Python pycodestyle.readlines() Examples

The following are 5 code examples of pycodestyle.readlines(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module pycodestyle , or try the search function .
Example #1
Source File: __init__.py    From gql with MIT License 5 votes vote down vote up
def load_file(self):
        if self.filename in ("stdin", "-", None):
            self.filename = "stdin"
            self.lines = pycodestyle.stdin_get_value().splitlines(True)
        else:
            self.lines = pycodestyle.readlines(self.filename)

        if not self.tree:
            self.tree = ast.parse("".join(self.lines)) 
Example #2
Source File: flake8_tuple.py    From flake8_tuple with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def get_lines(filename):
    if filename in ('stdin', '-', None):
        return stdin_utils.stdin_get_value().splitlines(True)
    else:
        return pep8.readlines(filename) 
Example #3
Source File: flake8_bandit.py    From flake8-bandit with MIT License 5 votes vote down vote up
def _load_source(self):
        """Loads the file in a way that auto-detects source encoding and deals
        with broken terminal encodings for stdin.

        Stolen from flake8_import_order because it's good.
        """

        if self.filename in ("stdin", "-", None):
            self.filename = "stdin"
            self.lines = stdin_utils.stdin_get_value().splitlines(True)
        else:
            self.lines = pycodestyle.readlines(self.filename)
        if not self.tree:
            self.tree = ast.parse("".join(self.lines)) 
Example #4
Source File: bugbear.py    From flake8-bugbear with MIT License 5 votes vote down vote up
def load_file(self):
        """Loads the file in a way that auto-detects source encoding and deals
        with broken terminal encodings for stdin.

        Stolen from flake8_import_order because it's good.
        """

        if self.filename in ("stdin", "-", None):
            self.filename = "stdin"
            self.lines = pycodestyle.stdin_get_value().splitlines(True)
        else:
            self.lines = pycodestyle.readlines(self.filename)

        if not self.tree:
            self.tree = ast.parse("".join(self.lines)) 
Example #5
Source File: __init__.py    From flake8-quotes with MIT License 5 votes vote down vote up
def get_file_contents(self):
        if self.filename in ('stdin', '-', None):
            return stdin_get_value().splitlines(True)
        else:
            if self.lines:
                return self.lines
            else:
                return readlines(self.filename)