Get the scope text, with a possible maximum number of lines.

        :param max_lines: limit the number of lines returned to a maximum.
        :return: str
432691
def text(self, max_lines=sys.maxsize):
        
        ret_val = []
        block = self._trigger.next()
        _, end = self.get_range()
        while (block.isValid() and block.blockNumber() <= end and
               len(ret_val) < max_lines):
            ret_val.append(block.text())
            block = block.next()
        return '\n'.join(ret_val)
243828
def recv_line(self, max_size=None, timeout='default', ending=None):
        
        if ending is None:
            ending = self.LINE_ENDING
        return self.recv_until(ending, max_size, timeout)
541867
def getline(file_or_script, line_number, opts=default_opts):
    
    filename = unmap_file(file_or_script)
    filename, line_number = unmap_file_line(filename, line_number)
    lines = getlines(filename, opts)
    if lines and line_number >=1 and line_number <= maxline(filename):
        line = lines[line_number-1]
        if get_option('strip_nl', opts):
            return line.rstrip('\n')
        else:
            return line
        pass
    else:
        return None
    return
471694
def max(self):
        
        res = self._qexec("max(%s)" % self._name)
        if len(res) > 0:
            self._max = res[0][0]
        return self._max
567255
def lines(text):
    
    assert text is not None
    assert '\r' not in text
    previous_newline_index = 0
    newline_index = text.find('\n')
    while newline_index != -1:
        yield text[previous_newline_index:newline_index]
        previous_newline_index = newline_index + 1
        newline_index = text.find('\n', previous_newline_index)
    last_line = text[previous_newline_index:]
    if last_line != '':
        yield last_line
1311693
def _selectedLinesRange(self):
        
        (startLine, startCol), (endLine, endCol) = self._qpart.selectedPosition
        start = min(startLine, endLine)
        end = max(startLine, endLine)
        return start, end
7820
def split_lines(source, maxline=79):
    
    result = []
    extend = result.extend
    append = result.append
    line = []
    multiline = False
    count = 0
    find = str.find
    for item in source:
        index = find(item, '\n')
        if index:
            line.append(item)
            multiline = index > 0
            count += len(item)
        else:
            if line:
                if count <= maxline or multiline:
                    extend(line)
                else:
                    wrap_line(line, maxline, result)
                count = 0
                multiline = False
                line = []
            append(item)
    return result
797726
def find_quote_position(lines, max_wrap_lines, limit=None):
    

    for n in range(len(lines)):
        end, typ = find_pattern_on_line(lines, n, max_wrap_lines)
        if typ:
            return end
        if limit != None and n >= limit-1:
            return n

    return None
1056786
def long_path_formatter(line, max_width=pd.get_option('max_colwidth')):
    

    if len(line) > max_width:

        tokens = line.split(".")
        trial1 = "%s...%s" % (tokens[0], tokens[-1])

        if len(trial1) > max_width:

            return "...%s" %(tokens[-1][-1:-(max_width-3)])

        else:

            return trial1

    else:

        return line
502381
function getMaxLines(height) {
        var availHeight = height || element.clientHeight,
          lineHeight = getLineHeight(element);

        return Math.max(Math.floor(availHeight / lineHeight), 0);
      }
919740
function getMaxLengthLine(...texts) {
            let textSizes = texts.filter(x => !!x)
                .map(x => x.node().getBBox().width);

            return d3Array.max(textSizes);
        }
1085899
def line_numbers
      return (line..line) unless @value && text

      end_line = line + lines.count
      end_line = nontrivial_end_line if line == end_line

      (line..end_line)
    end
1295356
def lines
      ret = [Attributes::HEADER]
      # Sort by name, but id goes first
      @attrs.sort_by{|x| x[:name] == 'id' ? '_' : x[:name]}.each do |row|
        line = "# * #{row[:name]} [#{row[:type]}]#{row[:desc].to_s.empty? ? "" : " - #{row[:desc]}"}"
        # split into lines that don't exceed 80 chars
        lt = wrap_text(line, MAX_CHARS_PER_LINE-3).split("\n")
        line = ([lt[0]] + lt[1..-1].map{|x| "#   #{x}"}).join("\n")
        ret << line
      end
      ret
    end
344278
def max_line_ext(network, snapshots, share=1.01):

    

    lines_snom = network.lines.s_nom.sum()
    links_pnom = network.links.p_nom.sum()

    def _rule(m):

        lines_opt = sum(m.passive_branch_s_nom[index]
                        for index
                        in m.passive_branch_s_nom_index)

        links_opt = sum(m.link_p_nom[index]
                        for index
                        in m.link_p_nom_index)

        return (lines_opt + links_opt) <= (lines_snom + links_pnom) * share
    network.model.max_line_ext = Constraint(rule=_rule)
744619
def get_text_line(self, line_nb):
        """"""
        # Taking into account the case when a file ends in an empty line,
        # since splitlines doesn't return that line as the last element
        # TODO: Make this function more efficient
        try:
            return to_text_string(self.toPlainText()).splitlines()[line_nb]
        except IndexError:
            return self.get_line_separator()
48610
def read(scope, filename):
    
    with open(filename[0], 'r') as fp:
        lines = fp.readlines()
    scope.define(__response__=lines)
    return lines
1139946
def get_current_line(self):
        """"""
        cursor = self.textCursor()
        cursor.select(QTextCursor.BlockUnderCursor)
        return to_text_string(cursor.selectedText())