Open the file for reading and yield lines as they are added
195146
def readlines(self, offset=0):
        """"""
        try:
            with open(self._filepath) as fp:
                # For full read go through existing lines in file
                if self._full_read:
                    fp.seek(offset)
                    for row in fp:
                        yield row

                # Okay now dynamically tail the file
                if self._tail:
                    while True:
                        current = fp.tell()
                        row = fp.readline()
                        if row:
                            yield row
                        else:
                            fp.seek(current)
                            time.sleep(self._sleep)

        except IOError as err:
            print('Error reading the file {0}: {1}'.format(self._filepath, err))
            return
153751
def gen_lines_from_textfiles(
        files: Iterable[TextIO]) -> Generator[str, None, None]:
    
    for file in files:
        for line in file:
            yield line
665674
def read_lines(self, file_path, empty_lines=False, signal_ready=True):
        
        file_handler, file_id = self._get_file(file_path)
        file_handler.seek(0, os.SEEK_END)

        if signal_ready:
            self.signal_ready()

        while self.thread_server.is_alive():
            line = six.text_type(file_handler.readline(), "utf-8")
            if line:
                yield line
                continue
            elif empty_lines:
                yield line

            time.sleep(0.1)

            if file_id != self._get_file_id(os.stat(file_path)) and os.path.isfile(file_path):
                file_handler, file_id = self._get_file(file_path)
144264
def lines_iter(self):
        '''
        
        '''
        # Convert unicode chars to string
        byte_to_string = lambda x: x.strip().decode(u'utf-8') if isinstance(x, bytes) else x.strip()

        # Read the entire contents of the Dockerfile, decoding each line, and return the result as an array
        with open(self.docker_file_path, u'r') as f:
            for line in f:
                yield byte_to_string(line)
300745
def expand_include(filename):
        
        open_files = set()

        def _expand_include_rec(filename):
            if filename in open_files:
                raise RuntimeError('Recursive include statement detected for '
                                   'file: ' + filename)
            else:
                open_files.add(filename)

            with open(filename) as open_file:
                for line in open_file:
                    line_stripped = line.strip().replace("//", "#")
                    if line_stripped.startswith('@include '):
                        inc_to_clean = line_stripped.split(None, 1)[1]
                        inc_filename = inc_to_clean.replace('"'," ").strip()
                        for included_line in _expand_include_rec(inc_filename):
                            yield included_line
                    else:
                        yield line

            open_files.remove(filename)

        try:
            lines = []
            for line in _expand_include_rec(filename):
                lines.append(line)
            return ''.join(lines)
        except RuntimeError:
            return None
1204015
def get_lines(fname):
    """"""
    for line in fileinput.input(fname):
        yield fileinput.filelineno(), line.strip()
80560
def copy_all_lines_from_to(inputFile, outputFile):
    """"""
    currentLine = inputFile.readline()
    while currentLine:
        outputFile.write(currentLine)
        currentLine = inputFile.readline()
942459
def stream_stdin_lines():
    """"""
    stdin = os.fdopen(sys.stdin.fileno(), 'r', 0)
    while True:
        line = stdin.readline()
        if line:
            yield line
        else:
            break
274272
def read(self, file, *, fs):
        
        for line in file:
            yield line.rstrip(self.eol)
433739
def from_file (filename):
    
    entries = []
    with open(filename) as fd:
        lines = []
        for line in fd.readlines():
            line = line.rstrip()
            if not line:
                if lines:
                    entries.append(from_headers("\r\n".join(lines)))
                lines = []
            else:
                lines.append(line)
        if lines:
            entries.append(from_headers("\r\n".join(lines)))
        return entries
687631
def readlines(self, *args, **kwargs):
        """"""
        return list(iter(partial(self.readline, *args, **kwargs), u''))
1180232
def read_in_chunks(file_object, chunk_size=CHUNK_SIZE):
    """"""
    while True:
        data = file_object.read(chunk_size)
        if not data:
            break
        yield data
1273783
def init_read_line(self):
        """"""
        format_list = self._format_list
        self._re_cvt = self.match_input_fmt(format_list)
        regexp0_str = "".join([subs[0] for subs in self._re_cvt])
        self._regexp_str = regexp0_str
        self._re = re.compile(regexp0_str)
        self._match_exps = [
            subs[1] for subs in self._re_cvt if subs[1] is not None
        ]
        self._divisors = [subs[2] for subs in self._re_cvt if subs[2] is not None]
        self._in_cvt_fns = [
            subs[3] for subs in self._re_cvt if subs[3] is not None
        ]
        self._read_line_init = True
987612
def generate_lines(text, ext=['.txt', '.md', '.rst', '.asciidoc', '.asc']):
    
    """

    if isinstance(text, basestring):
        if len(text) <= 256:
            if os.path.isfile(text) and os.path.splitext(text)[-1].lower() in ext:
                return open(text)
            elif os.path.isdir(text):
                return chain.from_iterable(generate_lines(stat['path']) for stat in find_files(text, ext=ext))
            else:
                return (line for line in Split(text=text))
        else:
            return Split(text=text)
    return chain.from_iterable(generate_lines(obj) for obj in text)
788825
def get_file_lines(self, subsystem, option):
        
        assert subsystem in self
        with open(os.path.join(self.per_subsystem[subsystem], subsystem + '.' + option)) as f:
            for line in f:
                yield line
427725
def parse_file(file):
    
    lines = []
    for line in file:
        line = line.rstrip('\n')
        if line == '%%':
            # This is a separator between items. Parse the data we've
            # collected and yield the result.
            yield from parse_item(lines)
            lines.clear()
        elif line.startswith('  '):
            # This is a continuation line. Concatenate it to the previous
            # line, including one of the spaces.
            lines[-1] += line[1:]
        else:
            lines.append(line)
    yield from parse_item(lines)
697140
def gen_lines(self, block, indent):
        
        prefix1 = indent + self.PS1
        prefix2 = indent + self.PS2
        prefix = prefix1
        for line in block:
            if line.startswith(prefix):
                yield line[len(prefix):]
            elif line == prefix.rstrip() + u"\n":
                yield u"\n"
            else:
                raise AssertionError("line=%r, prefix=%r" % (line, prefix))
            prefix = prefix2
        while True:
            yield ""