How to use the flake8.__version__ function in flake8

To help you get started, we’ve selected a few flake8 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 m-burst / flake8-pytest-style / tests / test_config.py View on Github external
def option_manager() -> OptionManager:
    manager = OptionManager(prog='flake8', version=flake8.__version__)
    PytestStylePlugin.add_options(option_manager=manager)
    return manager
github leo-editor / leo-editor / pyflakes-leo.py View on Github external
def report_version():
    try:
        import flake8

        print('flake8 version: %s' % flake8.__version__)
    except Exception:
        g.trace('can not import flake8')
#@+node:ekr.20160518000549.15: ** scanOptions
github wbond / certvalidator / dev / lint.py View on Github external
def run():
    """
    Runs flake8 lint

    :return:
        A bool - if flake8 did not find any errors
    """

    print('Running flake8 %s' % flake8.__version__)

    flake8_style = get_style_guide(config_file=os.path.join(package_root, 'tox.ini'))

    paths = []
    for _dir in [package_name, 'dev', 'tests']:
        for root, _, filenames in os.walk(_dir):
            for filename in filenames:
                if not filename.endswith('.py'):
                    continue
                paths.append(os.path.join(root, filename))
    report = flake8_style.check_files(paths)
    success = report.total_errors == 0
    if success:
        print('OK')
    return success
github mozilla / version-control-tools / pylib / flake8 / flake8 / engine.py View on Github external
def get_parser():
    """This returns an instance of optparse.OptionParser with all the
    extensions registered and options set. This wraps ``pep8.get_parser``.
    """
    (extensions, parser_hooks, options_hooks) = _register_extensions()
    details = ', '.join(['%s: %s' % ext for ext in extensions])
    parser = pep8.get_parser('flake8', '%s (%s)' % (__version__, details))
    for opt in ('--repeat', '--testsuite', '--doctest'):
        try:
            parser.remove_option(opt)
        except ValueError:
            pass
    parser.add_option('--exit-zero', action='store_true',
                      help="exit with code 0 even if there are errors")
    for parser_hook in parser_hooks:
        parser_hook(parser)
    parser.add_option('--install-hook', default=False, action='store_true',
                      help='Install the appropriate hook for this '
                      'repository.', dest='install_hook')
    return parser, options_hooks
github wbond / asn1crypto / dev / lint.py View on Github external
def run():
    """
    Runs flake8 lint

    :return:
        A bool - if flake8 did not find any errors
    """

    print('Running flake8 %s' % flake8.__version__)

    flake8_style = get_style_guide(config_file=os.path.join(package_root, 'tox.ini'))

    paths = []
    for _dir in [package_name, 'dev', 'tests']:
        for root, _, filenames in os.walk(_dir):
            for filename in filenames:
                if not filename.endswith('.py'):
                    continue
                paths.append(os.path.join(root, filename))
    report = flake8_style.check_files(paths)
    success = report.total_errors == 0
    if success:
        print('OK')
    return success
github wbond / oscrypto / dev / lint.py View on Github external
def run():
    """
    Runs flake8 lint

    :return:
        A bool - if flake8 did not find any errors
    """

    print('Running flake8 %s' % flake8.__version__)

    flake8_style = get_style_guide(config_file=os.path.join(package_root, 'tox.ini'))

    paths = []
    for _dir in [package_name, 'dev', 'tests']:
        for root, _, filenames in os.walk(_dir):
            for filename in filenames:
                if not filename.endswith('.py'):
                    continue
                paths.append(os.path.join(root, filename))
    report = flake8_style.check_files(paths)
    success = report.total_errors == 0
    if success:
        print('OK')
    return success
github PyCQA / flake8 / docs / source / conf.py View on Github external
# The master toctree document.
master_doc = 'index'

# General information about the project.
project = u'flake8'
copyright = u'2016, Ian Stapleton Cordasco'
author = u'Ian Stapleton Cordasco'

import flake8
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = flake8.__version__
# The full version, including alpha/beta/rc tags.
release = flake8.__version__

rst_epilog = """
.. |Flake8| replace:: :program:`Flake8`
"""

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None

# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
github PyCQA / flake8 / src / flake8 / main / application.py View on Github external
    def __init__(self, program="flake8", version=flake8.__version__):
        """Initialize our application.

        :param str program:
            The name of the program/application that we're executing.
        :param str version:
            The version of the program/application we're executing.
        """
        #: The timestamp when the Application instance was instantiated.
        self.start_time = time.time()
        #: The timestamp when the Application finished reported errors.
        self.end_time = None  # type: float
        #: The name of the program being run
        self.program = program
        #: The version of the program being run
        self.version = version
        #: The instance of :class:`flake8.options.manager.OptionManager` used
github zrzka / blackmamba / blackmamba / lib / flake8 / main / application.py View on Github external
    def __init__(self, program='flake8', version=flake8.__version__):
        # type: (str, str) -> NoneType
        """Initialize our application.

        :param str program:
            The name of the program/application that we're executing.
        :param str version:
            The version of the program/application we're executing.
        """
        #: The timestamp when the Application instance was instantiated.
        self.start_time = time.time()
        #: The timestamp when the Application finished reported errors.
        self.end_time = None
        #: The name of the program being run
        self.program = program
        #: The version of the program being run
        self.version = version
github wbond / csrbuilder / dev / lint.py View on Github external
def run():
    """
    Runs flake8 lint

    :return:
        A bool - if flake8 did not find any errors
    """

    print('Running flake8 %s' % flake8.__version__)

    flake8_style = get_style_guide(config_file=os.path.join(package_root, 'tox.ini'))

    paths = []
    for _dir in [package_name, 'dev', 'tests']:
        for root, _, filenames in os.walk(_dir):
            for filename in filenames:
                if not filename.endswith('.py'):
                    continue
                paths.append(os.path.join(root, filename))
    report = flake8_style.check_files(paths)
    success = report.total_errors == 0
    if success:
        print('OK')
    return success