How to use the pep8.__version__ function in pep8

To help you get started, we’ve selected a few pep8 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mysql / mysql-utilities / support / pylint_tests.py View on Github external
_CURRENT_PATH = os.path.abspath(os.path.dirname(__file__))
(_BASE_PATH, _,) = os.path.split(_CURRENT_PATH)

if os.path.exists(os.path.join(_BASE_PATH, "internal")):
    _PACKAGES = _PACKAGES + (os.path.join("internal", "packaging"),)

# Add base path and mysql-test to sys.path
sys.path.append(_BASE_PATH)
sys.path.append(os.path.join(_BASE_PATH, "mysql-test", "mutlib"))

if pylint_version.split(".") < _PYLINT_MIN_VERSION.split("."):
    sys.stdout.write("ERROR: pylint version >= {0} is required to run "
                     "pylint_tests.\n".format(_PYLINT_MIN_VERSION))
    sys.exit(1)

if pep8_version.split(".") < _PEP8_MIN_VERSION.split("."):
    sys.stdout.write("ERROR: pep8 version >= {0} is required to run "
                     "pylint_tests.\n".format(_PEP8_MIN_VERSION))
    sys.exit(1)


class CustomTextReporter(TextReporter):
    """A reporter similar to TextReporter, but display messages in a custom
    format.
    """
    name = "custom"
    line_format = "{msg_id}:{line:4d},{column:2d}: {msg}"


class ParseableTextReporter(TextReporter):
    """A reporter very similar to TextReporter, but display messages in a form
    recognized by most text editors.
github mkouhei / backup2swift / src / backup2swift_tests / test_pep8.py View on Github external
def test_pep8():
        if pep8.__version__ >= '1.3':
            arglist = [['statistics', True],
                       ['show-source', True],
                       ['repeat', True],
                       ['exclude', []],
                       ['paths', [BASE_DIR]]]

            pep8style = pep8.StyleGuide(arglist,
                                        parse_argv=False,
                                        config_file=True)
            options = pep8style.options
            if options.doctest:
                import doctest
                fail_d, done_d = doctest.testmod(report=False,
                                                 verbose=options.verbose)
                fail_s, done_s = selftest(options)
                count_failed = fail_s + fail_d
github gpilab / framework / lib / gpi / make.py View on Github external
# AUTOPEP8
    if fmt:
        try:
            import autopep8
            print(("\nFound: autopep8 " + str(autopep8.__version__) + "..."))
            print(("Reformatting Python script: " + "".join(target)))
            os.system('autopep8 -i --max-line-length 256 ' + "".join(target))
        except:
            print("Failed to perform auto-formatting \
                with \'autopep8\'. Do you have it installed?")

    if 'pep8' in check_fmt:
        # PEP8
        try:
            import pep8
            print(("\nFound: pep8 " + str(pep8.__version__) + "..."))
            print(("Checking Python script: " + "".join(target)))
            print(("pep8 found these problems with your code, START" + Cl.WRN))
            os.system('pep8 --count --statistics --show-source '
                      + "".join(target))
            print((Cl.ESC + "pep8 END"))
        except:
            print("Failed to perform check with \'pep8\'. Do you have it installed?")

    if 'pyflakes' in check_fmt:
        # PYFLAKES
        try:
            import pyflakes
            print(("\nFound: pyflakes " + str(pyflakes.__version__) + "..."))
            print(("Checking Python script: " + "".join(target)))
            print(("pyflakes found these problems with your code, START" + Cl.FAIL))
            os.system('pyflakes ' + "".join(target))
github dreadatour / Flake8Lint / contrib / flake8 / engine.py View on Github external
def _register_extensions():
    """Register all the extensions."""
    extensions = util.OrderedSet()
    extensions.add(('pep8', pep8.__version__))
    parser_hooks = []
    options_hooks = []
    ignored_hooks = []
    try:
        from pkg_resources import iter_entry_points
    except ImportError:
        pass
    else:
        for entry in iter_entry_points('flake8.extension'):
            # Do not verify that the requirements versions are valid
            checker = _load_entry_point(entry, verify_requirements=False)
            pep8.register_check(checker, codes=[entry.name])
            extensions.add((checker.name, checker.version))
            if hasattr(checker, 'add_options'):
                parser_hooks.append(checker.add_options)
            if hasattr(checker, 'parse_options'):
github mozilla / version-control-tools / pylib / flake8 / flake8 / engine.py View on Github external
def _register_extensions():
    """Register all the extensions."""
    extensions = OrderedSet()
    extensions.add(('pep8', pep8.__version__))
    parser_hooks = []
    options_hooks = []
    try:
        from pkg_resources import iter_entry_points
    except ImportError:
        pass
    else:
        for entry in iter_entry_points('flake8.extension'):
            checker = entry.load()
            pep8.register_check(checker, codes=[entry.name])
            extensions.add((checker.name, checker.version))
            if hasattr(checker, 'add_options'):
                parser_hooks.append(checker.add_options)
            if hasattr(checker, 'parse_options'):
                options_hooks.append(checker.parse_options)
    return extensions, parser_hooks, options_hooks
github KDE / kate / addons / kate / pate / src / plugins / python_utils / python_checkers / pep8_checker.py View on Github external
import pep8

from PyKDE4.kdecore import i18n

from libkatepate.errors import showOk, showErrors, showError

from python_checkers.all_checker import checkAll
from python_checkers.utils import canCheckDocument
from python_settings import (KATE_ACTIONS,
                             DEFAULT_IGNORE_PEP8_ERRORS,
                             _IGNORE_PEP8_ERRORS)

OLD_PEP8_VERSIONS = ['1.0.1', '1.1', '1.2']


if pep8.__version__ not in OLD_PEP8_VERSIONS:
    class KateReport(pep8.BaseReport):

        def __init__(self, options):
            super(KateReport, self).__init__(options)
            self.error_list = []
            self.ignore = options.ignore

        def error(self, line_number, offset, text, check):
            code = super(KateReport, self).error(line_number, offset, text, check)
            self.error_list.append([line_number, offset, text[0:4], text])
            return code

        def get_errors(self):
            """
            Get the errors, and reset the checker
            """
github dreadatour / Flake8Lint / lint.py View on Github external
def tools_versions():
    """Return all lint tools versions."""
    return (
        ('pep8', pep8.__version__),
        ('flake8', flake8_version),
        ('pyflakes', pyflakes_version),
        ('mccabe', mccabe.__version__),
        ('pydocstyle', pydocstyle_version),
        ('naming', pep8ext_naming.__version__),
        ('debugger', flake8_debugger.__version__),
        ('import-order', flake8_import_order_version),
    )
github KDE / kate / kate / plugins / pate / src / plugins / python_utils / python_checkers / pep8_checker.py View on Github external
import kate
import pep8

from libkatepate.errors import showOk, showErrors, showError

from python_checkers.all_checker import checkAll
from python_checkers.utils import canCheckDocument
from python_settings import (KATE_ACTIONS,
                             DEFAULT_IGNORE_PEP8_ERRORS,
                             _IGNORE_PEP8_ERRORS)

OLD_PEP8_VERSIONS = ['1.0.1', '1.1', '1.2']


if pep8.__version__ not in OLD_PEP8_VERSIONS:
    class KateReport(pep8.BaseReport):

        def __init__(self, options):
            super(KateReport, self).__init__(options)
            self.error_list = []
            self.ignore = options.ignore

        def error(self, line_number, offset, text, check):
            code = super(KateReport, self).error(line_number, offset, text, check)
            self.error_list.append([line_number, offset, text[0:4], text])
            return code

        def get_errors(self):
            """
            Get the errors, and reset the checker
            """
github goinnn / Kate-plugins / kate_plugins / pyte_plugins / check_plugins / pep8_plugins.py View on Github external
# You should have received a copy of the GNU Lesser General Public License
# along with this software.  If not, see .

import sys

import kate
import pep8

from kate_settings_plugins import KATE_ACTIONS, IGNORE_PEP8_ERRORS
from pyte_plugins.check_plugins import commons
from pyte_plugins.check_plugins.check_all_plugins import checkAll

OLD_PEP8_VERSIONS = ['1.0.1', '1.1', '1.2']


if pep8.__version__ not in OLD_PEP8_VERSIONS:
    class KateReport(pep8.BaseReport):

        def __init__(self, options):
            super(KateReport, self).__init__(options)
            self.error_list = []
            self.ignore = options.ignore

        def error(self, line_number, offset, text, check):
            code = super(KateReport, self).error(line_number, offset, text, check)
            self.error_list.append([line_number, offset, text[0:4], text])
            return code

        def get_errors(self):
            """
            Get the errors, and reset the checker
            """