Gets the meta for a given document reference url
195392
public function get($url)
    {
        if (isset($this->entries[$url])) {
            return $this->entries[$url];
        } else {
            return null;
        }
    }
94845
def iter_links_meta_element(cls, element):
        '''
        '''
        if element.attrib.get('http-equiv', '').lower() == 'refresh':
            content_value = element.attrib.get('content')

            if content_value:
                link = parse_refresh(content_value)

                if link:
                    yield LinkInfo(
                        element=element, tag=element.tag, attrib='http-equiv',
                        link=link,
                        inline=False, linked=True,
                        base_link=None,
                        value_type='refresh',
                        link_type=None  # treat it as a redirect
                    )
        else:
            for link_info in cls.iter_links_open_graph_meta(element):
                yield link_info
217236
def meta_view(self):
        
        # API_URL_PREFIX maybe diffierent in development and production,
        # so pick it from app.config other than store it in metafile
        self.meta["$url_prefix"] = current_app.config.get("API_URL_PREFIX", "")
        mediatype = request.accept_mimetypes.best_match(
            ['text/html', 'application/json'], default='text/html')
        dumped = json.dumps(
            self.meta, indent=4, sort_keys=True, ensure_ascii=False)
        if mediatype == 'application/json' or 'json' in request.args:
            return make_response(dumped, {
                "Content-Type": "application/json; charset=utf-8"
            })
        filename = request.args.get('f')
        if filename in ["res.js", "res.min.js"]:
            # cache parsed meta
            if self._resjs_cache is None:
                self._resjs_cache = parse_meta(self.meta)
            minify = filename == "res.min.js"
            code = generate_code(self._resjs_cache,
                                 prefix=self.meta["$url_prefix"], min=minify)
            response = make_response(code, {
                "Content-Type": "application/javascript"
            })
            # handle etag
            response.add_etag()
            return response.make_conditional(request)
        if filename:
            return send_from_directory(DOCS_DIST, basename(filename))
        with open(DOCS_HTML) as f:
            content = f.read()\
                .replace('$(title)', self.meta.get('$title', ''))\
                .replace('$(meta)', dumped)
        return make_response(content)
241518
def __meta_metadata(self, field, key):
        """"""
        mf = ''
        try:
            mf = str([f[key] for f in self.metadata
                     if f['field_name'] == field][0])
        except IndexError:
            print("%s not in metadata field:%s" % (key, field))
            return mf
        else:
            return mf
1259518
def getreference(self, validate=True):
        """"""

        if self.offset is None: return None #nothing to test
        if self.ref:
            ref = self.doc[self.ref]
        else:
            ref = self.finddefaultreference()

        if not ref:
            raise UnresolvableTextContent("Default reference for textcontent not found!")
        elif not ref.hastext(self.cls):
            raise UnresolvableTextContent("Reference (ID " + str(ref.id) + ") has no such text (class=" + self.cls+")")
        elif validate and self.text() != ref.textcontent(self.cls).text()[self.offset:self.offset+len(self.data[0])]:
            raise UnresolvableTextContent("Reference (ID " + str(ref.id) + ", class=" + self.cls+") found but no text match at specified offset ("+str(self.offset)+")! Expected '" + self.text() + "', got '" + ref.textcontent(self.cls).text()[self.offset:self.offset+len(self.data[0])] +"'")
        else:
            #finally, we made it!
            return ref
1253324
function checkMetaDocsUrl(context, exportsNode) {
    if (exportsNode.type !== "ObjectExpression") {

        // if the exported node is not the correct format, "internal-no-invalid-meta" will already report this.
        return;
    }

    const metaProperty = getPropertyFromObject("meta", exportsNode);
    const metaDocs = metaProperty && getPropertyFromObject("docs", metaProperty.value);
    const metaDocsUrl = metaDocs && getPropertyFromObject("url", metaDocs.value);

    if (!metaDocs) {
        context.report({
            node: metaProperty,
            message: "Rule is missing a meta.docs property"
        });
        return;
    }

    if (!metaDocsUrl) {
        context.report({
            node: metaDocs,
            message: "Rule is missing a meta.docs.url property"
        });
        return;
    }

    const ruleId = path.basename(context.getFilename().replace(/.js$/u, ""));
    const expected = `https://eslint.org/docs/rules/${ruleId}`;
    const url = metaDocsUrl.value.value;

    if (url !== expected) {
        context.report({
            node: metaDocsUrl.value,
            message: `Incorrect url. Expected "${expected}" but got "${url}"`
        });
    }

}
975524
def get_canonical_url(metadata, request):
    """"""
    slug_title = u'/{}'.format('-'.join(metadata['title'].split()))
    settings = get_current_registry().settings

    canon_host = settings.get('canonical-hostname',
                              re.sub('archive.', '', request.host))
    if metadata['canonical'] is None:
        canon_url = request.route_url(
                'content',
                ident_hash=metadata['id'],
                ignore=slug_title)
    else:
        canon_url = request.route_url(
                'content',
                ident_hash=metadata['canonical'],
                separator=':',
                page_ident_hash=metadata['id'],
                ignore=slug_title)

    return re.sub(request.host, canon_host, canon_url)
1115380
private function getMetadata()
    {
        $this->logger->debug('[Metadata] Retrieving metadata...');

        $values = [];
        // property is a space-separated list of values
        $propertyPattern = '/\s*(dc|dcterm|og|twitter)\s*:\s*(author|creator|description|title|image)\s*/i';

        // name is a single value
        $namePattern = '/^\s*(?:(dc|dcterm|og|twitter|weibo:(article|webpage))\s*[\.:]\s*)?(author|creator|description|title|image)\s*$/i';

        // Find description tags.
        foreach ($this->dom->getElementsByTagName('meta') as $meta) {
            /* @var DOMNode $meta */
            $elementName = $meta->getAttribute('name');
            $elementProperty = $meta->getAttribute('property');
            $content = $meta->getAttribute('content');
            $matches = null;
            $name = null;

            if ($elementProperty) {
                if (preg_match($propertyPattern, $elementProperty, $matches)) {
                    for ($i = count($matches) - 1; $i >= 0; $i--) {
                        // Convert to lowercase, and remove any whitespace
                        // so we can match below.
                        $name = preg_replace('/\s/', '', mb_strtolower($matches[$i]));
                        // multiple authors
                        $values[$name] = trim($content);
                    }
                }
            }

            if (!$matches && $elementName && preg_match($namePattern, $elementName)) {
                $name = $elementName;
                if ($content) {
                    // Convert to lowercase, remove any whitespace, and convert dots
                    // to colons so we can match below.
                    $name = preg_replace(['/\s/', '/\./'], ['', ':'], mb_strtolower($name));
                    $values[$name] = trim($content);
                }
            }
        }

        // get title
        /*
         * This is a very convoluted way of extracting the first matching key of the $values array
         * against a set of options.
         *
         * This could be easily replaced with an ugly set of isset($values['key']) or a bunch of ??s.
         * Will probably replace it with ??s after dropping support of PHP5.6
         */

        $key = current(array_intersect([
            'dc:title',
            'dcterm:title',
            'og:title',
            'weibo:article:title',
            'weibo:webpage:title',
            'title',
            'twitter:title'
        ], array_keys($values)));

        $this->setTitle(isset($values[$key]) ? trim($values[$key]) : null);

        if (!$this->getTitle()) {
            $this->setTitle($this->getArticleTitle());
        }

        // get author
        $key = current(array_intersect([
            'dc:creator',
            'dcterm:creator',
            'author'
        ], array_keys($values)));

        $this->setAuthor(isset($values[$key]) ? $values[$key] : null);

        // get description
        $key = current(array_intersect([
            'dc:description',
            'dcterm:description',
            'og:description',
            'weibo:article:description',
            'weibo:webpage:description',
            'description',
            'twitter:description'
        ], array_keys($values)));

        $this->setExcerpt(isset($values[$key]) ? $values[$key] : null);

        // get main image
        $key = current(array_intersect([
            'og:image',
            'twitter:image'
        ], array_keys($values)));

        $this->setImage(isset($values[$key]) ? $values[$key] : null);
    }
501808
function getDocsToPersist(docId, view, docIdsToChangesAndEmits) {
  var metaDocId = '_local/doc_' + docId;
  var defaultMetaDoc = {_id: metaDocId, keys: []};
  var docData = docIdsToChangesAndEmits[docId];
  var indexableKeysToKeyValues = docData.indexableKeysToKeyValues;
  var changes = docData.changes;

  function getMetaDoc() {
    if (isGenOne(changes)) {
      // generation 1, so we can safely assume initial state
      // for performance reasons (avoids unnecessary GETs)
      return Promise.resolve(defaultMetaDoc);
    }
    return view.db.get(metaDocId).catch(defaultsTo(defaultMetaDoc));
  }

  function getKeyValueDocs(metaDoc) {
    if (!metaDoc.keys.length) {
      // no keys, no need for a lookup
      return Promise.resolve({rows: []});
    }
    return view.db.allDocs({
      keys: metaDoc.keys,
      include_docs: true
    });
  }

  function processKvDocs(metaDoc, kvDocsRes) {
    var kvDocs = [];
    var oldKeysMap = {};

    for (var i = 0, len = kvDocsRes.rows.length; i < len; i++) {
      var row = kvDocsRes.rows[i];
      var doc = row.doc;
      if (!doc) { // deleted
        continue;
      }
      kvDocs.push(doc);
      oldKeysMap[doc._id] = true;
      doc._deleted = !indexableKeysToKeyValues[doc._id];
      if (!doc._deleted) {
        var keyValue = indexableKeysToKeyValues[doc._id];
        if ('value' in keyValue) {
          doc.value = keyValue.value;
        }
      }
    }

    var newKeys = Object.keys(indexableKeysToKeyValues);
    newKeys.forEach(function (key) {
      if (!oldKeysMap[key]) {
        // new doc
        var kvDoc = {
          _id: key
        };
        var keyValue = indexableKeysToKeyValues[key];
        if ('value' in keyValue) {
          kvDoc.value = keyValue.value;
        }
        kvDocs.push(kvDoc);
      }
    });
    metaDoc.keys = uniq(newKeys.concat(metaDoc.keys));
    kvDocs.push(metaDoc);

    return kvDocs;
  }

  return getMetaDoc().then(function (metaDoc) {
    return getKeyValueDocs(metaDoc).then(function (kvDocsRes) {
      return processKvDocs(metaDoc, kvDocsRes);
    });
  });
}
417093
def get_docs_url(self, role, name):
        

        if role == 'cite':
            # If the cross-reference is a citation, make sure that
            # the cite key is in the sphinx environment bibtex cache.
            # If it is, construct the url from the cite key, otherwise
            # raise an exception
            if name not in self.env.bibtex_cache.get_all_cited_keys():
                raise KeyError('cite key %s not found' % name, 'cite', 0)
            url = self.baseurl + 'zreferences.html#' + name
        elif role == 'ref':
            try:
                reftpl = self.env.domaindata['std']['labels'][name]
            except Exception:
                raise KeyError('ref label %s not found' % name, 'ref', 0)
            url = self.baseurl + reftpl[0] + '.html#' + reftpl[1]
        else:
            # If the  cross-reference is not a citation, try to look it
            # up in each of the IntersphinxInventory objects in our list
            url = None
            for ii in self.invlst:
                try:
                    url = ii.get_docs_url(role, name)
                except KeyError as ex:
                    # Re-raise the exception if multiple matches found,
                    # otherwise ignore it
                    if ex.args[1] == 'role' or ex.args[2] > 1:
                        raise ex
                else:
                    # If an exception was not raised, the lookup must
                    # have succeeded: break from the loop to terminate
                    # further searching
                    break

            if url is None:
                raise KeyError('name %s not found' % name, 'name', 0)

        return url
14506
def metadataURL(self, value):
        """"""
        if value != self._metadataURL:
            self._metadataURL = value
            self._metaFS = None
711306
def get_meta(path=None):
  
  if path:
    sys.path.insert(1, path)
  from wdiffhtml import __version__, __doc__
  if path:
    del(sys.path[0])
  return __version__, __doc__
98287
def get_meta_attributes(self, **kwargs):
        """"""
        superuser = kwargs.get('superuser', False)
        if (self.untl_object.qualifier == 'recordStatus'
                or self.untl_object.qualifier == 'system'):
            if superuser:
                self.editable = True
                self.repeatable = True
            else:
                self.editable = False
            self.view_type = 'qualified-input'
        elif self.untl_object.qualifier == 'hidden':
            self.label = 'Object Hidden'
            self.view_type = 'radio'
        else:
            self.editable = False
            self.view_type = 'qualified-input'
1016121
private List<Annotation> getDocMetaData(String document)
  {
    // lookup up meta data in the cache
    if (!docMetaDataCache.containsKey(docBrowserPanel.getCorpus()))
    {
      // get the metadata for the corpus
      WebResource res = Helper.getAnnisWebResource();
      res = res.path("meta/corpus/").path(
        urlPathEscape.escape(docBrowserPanel.getCorpus())).path("closure");
      
      Map<String, List<Annotation>> metaDataMap = new HashMap<>();
      
      // create a document -> metadata map
      for (Annotation a : res.get(new Helper.AnnotationListType()))
      {
        if (a.getAnnotationPath() != null
          && !a.getAnnotationPath().isEmpty()
          && a.getType().equals("DOCUMENT"))
        {
          String docName = a.getAnnotationPath().get(0);
          if (!metaDataMap.containsKey(docName)) {
            metaDataMap.put(docName, new ArrayList<Annotation>());
          }
          metaDataMap.get(docName).add(a);
        }
      }
      docMetaDataCache.put(docBrowserPanel.getCorpus(), metaDataMap);
    }
    
    if (docMetaDataCache.get(docBrowserPanel.getCorpus()).containsKey(document))
    {
      return docMetaDataCache.get(docBrowserPanel.getCorpus()).get(document);
    }
    else
    {
      return new ArrayList<Annotation>();
    }
  }
166111
def get(self, url):
        
        self._load(url)
        self._flush()

        return self.metadata[url]
105634
def retrieve_diaspora_host_meta(host):
    
    document, code, exception = fetch_document(host=host, path="/.well-known/host-meta")
    if exception:
        return None
    xrd = XRD.parse_xrd(document)
    return xrd
758142
def get_linked_metadata(obj, name=None, context=None, site=None, language=None):
    
    # XXX Check that 'modelinstance' and 'model' metadata are installed in backends
    # I believe that get_model() would return None if not
    Metadata = _get_metadata_model(name)
    InstanceMetadata = Metadata._meta.get_model('modelinstance')
    ModelMetadata = Metadata._meta.get_model('model')
    content_type = ContentType.objects.get_for_model(obj)
    instances = []
    if InstanceMetadata is not None:
        try:
            instance_md = InstanceMetadata.objects.get(_content_type=content_type, _object_id=obj.pk)
        except InstanceMetadata.DoesNotExist:
            instance_md = InstanceMetadata(_content_object=obj)
        instances.append(instance_md)
    if ModelMetadata is not None:
        try:
            model_md = ModelMetadata.objects.get(_content_type=content_type)
        except ModelMetadata.DoesNotExist:
            model_md = ModelMetadata(_content_type=content_type)
        instances.append(model_md)    
    return FormattedMetadata(Metadata, instances, '', site, language)