Reads a document.

        :param str document_link:
            The link to the document.
        :param dict options:
            The request options for the request.

        :return:
            The read Document.
        :rtype:
            dict
499980
def ReadItem(self, document_link, options=None):
        
        if options is None:
            options = {}

        path = base.GetPathFromLink(document_link)
        document_id = base.GetResourceIdOrFullNameFromLink(document_link)
        return self.Read(path,
                         'docs',
                         document_id,
                         None,
                         options)
621786
def ReadUser(self, user_link, options=None):
        
        if options is None:
            options = {}

        path = base.GetPathFromLink(user_link)
        user_id = base.GetResourceIdOrFullNameFromLink(user_link)
        return self.Read(path, 'users', user_id, None, options)
1201183
def read_links(self, file, encoding=None):
        '''
        '''
        return [item[0] for item in self.iter_text(file, encoding) if item[1]]
172969
def get_pages(url):
    
    while True:
        yield url
        doc = html.parse(url).find("body")
        links = [a for a in doc.findall(".//a") if a.text and a.text.startswith("next ")]
        if not links:
            break
        url = urljoin(url, links[0].get('href'))
106255
def links(self, fromVertice, toVertice, **edgeArgs) :
        
        if isinstance(fromVertice, Document) or isinstance(getattr(fromVertice, 'document', None), Document):
            if not fromVertice._id :
                fromVertice.save()
            self._from = fromVertice._id
        elif (type(fromVertice) is bytes) or (type(fromVertice) is str):
            self._from  = fromVertice
        elif not self._from:
            raise CreationError('fromVertice %s is invalid!' % str(fromVertice))
        
        if isinstance(toVertice, Document) or isinstance(getattr(toVertice, 'document', None), Document):
            if not toVertice._id:
                toVertice.save()
            self._to = toVertice._id
        elif (type(toVertice) is bytes) or (type(toVertice) is str):
            self._to = toVertice
        elif not self._to:
            raise CreationError('toVertice %s is invalid!' % str(toVertice))
        
        self.save(**edgeArgs)
1272717
def _parse_doc(doc):
    
    lines = doc.split("\n")
    descriptions = list(itertools.takewhile(_checker(_KEYWORDS), lines))

    if len(descriptions) < 3:
        description = lines[0]
    else:
        description = "{0}\n\n{1}".format(
            lines[0], textwrap.dedent("\n".join(descriptions[2:])))

    args = list(itertools.takewhile(
        _checker(_KEYWORDS_OTHERS),
        itertools.dropwhile(_checker(_KEYWORDS_ARGS), lines)))
    argmap = {}
    if len(args) > 1:
        for pair in args[1:]:
            kv = [v.strip() for v in pair.split(":")]
            if len(kv) >= 2:
                argmap[kv[0]] = ":".join(kv[1:])

    return dict(headline=descriptions[0], description=description, args=argmap)
538245
function readFile(options, href) {
	var filePath = path.join(path.isAbsolute(href) ? options.root : path.dirname(options.from), href);

	return new Promise(function (resolve, reject) {
		return fs.readFile(filePath, 'utf8', function (err, res) {
			return err ? reject(err) : resolve(res);
		});
	});
}
107419
public Document read() {
        try {
            do {
                if (stream == null) {
                    // Open the stream to the next file ...
                    stream = openNextFile();
                    if (stream == null) {
                        // No more files to read ...
                        return null;
                    }
                    documents = Json.readMultiple(stream, false);
                }
                try {
                    Document doc = documents.nextDocument();
                    if (doc != null) return doc;
                } catch (IOException e) {
                    // We'll just continue ...
                }
                // Close the stream and try opening the next stream ...
                close(stream);
                stream = null;
            } while (true);
        } catch (IOException e) {
            problems.addError(JcrI18n.problemsWritingDocumentToBackup, currentFile.getAbsolutePath(), e.getMessage());
            return null;
        }
    }
423456
def readFile(filename, encoding, options):
    
    ret = libxml2mod.xmlReadFile(filename, encoding, options)
    if ret is None:raise treeError('xmlReadFile() failed')
    return xmlDoc(_obj=ret)
1123326
function DocumentGraph(options) {
    this.options = object.extend(defaultOptions, options || {});
    this._gloss = new Glossary();
    
    // Parse redis cluster configuration in the form of:
    // "host:port,host:port,host:port"
    if (this.options.redisCluster) {
        var addresses = this.options.redisCluster.split(',');
        var config = [];
        for (var i = 0; i < addresses.length; i++) {
            var items = addresses[i].split(':');
            var host = "0.0.0.0";
            var port = 6379;
            if (items.length == 1) {
                port = parseInt(items[0]);
            } else {
                if (items[0].length > 0) {
                    host = items[0];
                }
                port = parseInt(items[1]);
            }
            config.push({ port: port, host: host });
        }
        this._redisCluster = RedisCluster.create(config, { return_buffers: true });
    } else {
        this._redisClient = redis.createClient(this.options.redisPort, this.options.redisHost, { return_buffers: true });
        this._redisClient.select(this.options.redisDb);
        this._redisStream = RedisStream(this.options.redisPort, this.options.redisHost, this.options.redisDb);
    }

    this._k_Total = this._fmt(TOTAL);
    this._k_TotalTerms = this._fmt(TOTAL, TERMS);
}
936662
def serialize_link(ctx, document, elem, root):
    

    _a = etree.SubElement(root, 'a')

    for el in elem.elements:
        _ser = ctx.get_serializer(el)

        if _ser:
            _td = _ser(ctx, document, el, _a)
        else:
            if isinstance(el, doc.Text):
                children = list(_a)

                if len(children) == 0:
                    _text = _a.text or u''

                    _a.text = u'{}{}'.format(_text, el.value())
                else:
                    _text = children[-1].tail or u''

                    children[-1].tail = u'{}{}'.format(_text, el.value())
   
    if elem.rid in document.relationships[ctx.options['relationship']]:
        _a.set('href', document.relationships[ctx.options['relationship']][elem.rid].get('target', ''))

    fire_hooks(ctx, document, elem, _a, ctx.get_hook('a'))

    return root
1058968
def links
      # Find all anchor elements
      doc.xpath('//a').map do |element|
        # extract all the href attributes
        element.attribute('href')
      end.compact.map(&:value).map do |href|
        # return them as new document objects
        Snapshotify::Document.new(href, url)
      end.compact
    end
391169
def get_input_document(document):
    """"""
    try:
        if document.SUBCLASS_OF_ID == 0xf33fdb68:  # crc32(b'InputDocument'):
            return document
    except AttributeError:
        _raise_cast_fail(document, 'InputDocument')

    if isinstance(document, types.Document):
        return types.InputDocument(
            id=document.id, access_hash=document.access_hash,
            file_reference=document.file_reference)

    if isinstance(document, types.DocumentEmpty):
        return types.InputDocumentEmpty()

    if isinstance(document, types.MessageMediaDocument):
        return get_input_document(document.document)

    if isinstance(document, types.Message):
        return get_input_document(document.media)

    _raise_cast_fail(document, 'InputDocument')
599199
def get_document(user_name, intra_hash, file_name)
      response = @conn.get get_document_href(user_name, intra_hash, file_name)
      if response.status == 200
        return [response.body, response.headers['content-type']]
      end
      return nil, nil
    end
1177524
def parse_document(text, options=0):
    
    encoded_text = text.encode('utf-8')
    return _cmark.lib.cmark_parse_document(
        encoded_text, len(encoded_text), options)
1337791
@SuppressWarnings("unchecked")
    public static org.bson.Document decodeMongoDoc(org.bson.Document doc) {
        org.bson.Document newDoc = new org.bson.Document();
        for (String key : doc.keySet()) {
            Object value = doc.get(key);
            if (value instanceof org.bson.Document)
                value = decodeMongoDoc(doc.get(key, org.bson.Document.class));
            else if (value instanceof List<?>) {
                for (int i=0; i < ((List<?>)value).size(); i++) {
                    Object obj = ((List<?>)value).get(i);
                    if (obj instanceof org.bson.Document)
                        ((List<org.bson.Document>)value).set(i, decodeMongoDoc((org.bson.Document)obj));
                }
            }

            String newKey = key;
            if (key.startsWith("\\uff04"))
                newKey = "$" + key.substring(6);
            if (key.contains("\\uff0e")) {
                newKey = newKey.replace("\\uff0e", ".");
            }
            newDoc.put(newKey, value);
        }
        return newDoc;
    }
1006839
def _get_options(options_file=None):
    

    if options_file is not None:
        with open(options_file, 'r') as opt_file:
            options = json.loads(opt_file.read())
    else:
        options = {}
    return options