././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1674656821.8292627 flake8_docstrings-1.7.0/0000755000175000017500000000000014364236066015434 5ustar00asottileasottile././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1674656745.0 flake8_docstrings-1.7.0/HISTORY.rst0000644000175000017500000000534414364235751017335 0ustar00asottileasottileHistory/Changelog ================= 1.7.0 ----- - Add ``--property-decorators`` option. 1.6.0 ----- - Fix ``--ignore-noqa`` by disabling ``pydocstyle``'s ``noqa`` handling. 1.5.0 ----- - Add ``--ignore-decorators`` option which allows functions with a specific decorator to ignore error codes. 1.4.0 ----- - Add ``--docstring-convention`` option which allows selection of conventions besides the default ``pep257``. Available options are based on those available from ``pydocstyle`` and are currently ``pep257``, ``google``, and ``numpy``. ``flake8-docstrings`` also adds a special ``all`` docstring convention which will enable all rules from ``pydocstyle``. Note that ``pydocstyle`` defines some conflicting rules so you'll want to use ``ignore`` / ``extend-ignore`` when selecting ``docstring-convention = all`` - Bump minimum flake8 version to 3 - Fix proper handling of ``stdin`` via ``--stdin-display-name`` 1.3.1 ----- - Fix incompatibility with pydocstyle 4.x 1.3.0 ----- - Bump minimum pydocstyle version to 2.1.0 1.2.0 ----- - Fix EnvironError and AllError invocations - Avoid Flake8 warning for requesting ``builtins`` 1.1.0 ----- - Upgrade dependency on pydocstyle to 2.0.0 1.0.3 ----- - Use flake8-polyfill to get standard-in to handle Flake8 3.x and 2.x 1.0.2 ----- - Use pycodestyle to get standard-in. 1.0.1 ----- - Make sure this works out of the box (is enabled by default) with Flake8 3.0 1.0.0 ----- - Switch dependency name to pydocstyle. pep257 was renamed to pydocstyle, this update switches the requirement to that new package name. Since we're swapping out dependencies, we've issued a major version bump. 0.2.7 ----- - Try to import pydocstyle (not pycodestyle) as pep257 0.2.6 ----- - Respect pep257's default ignore list - Handle AllError and other exceptions from pep257 0.2.5 ----- - Use pep257's ``tokenize_open`` function to pass input to the tool. - Use pep257's conventions so any error codes that are ignored by default using ``pep257`` are also ignored by default with this plugin. 0.2.4 ----- - Fix bug introduced in 0.2.2 where the file source was always None causing D100 and D104 errors for all files and no other errors to be found. 0.2.3 ----- - Remove extraneous space in error message. - Fix up how the plugin displays with ``flake8 --version``. 0.2.2 ----- - Better support for input provided via stdin. 0.2.1 ----- - Prevent AllError or EnvironmentErrors from being raised. Thanks Alex Pyrgiotis. 0.2.0 ----- - Upgrade to pep257 0.3.0 0.1.4 ----- - Stop truncating error messages 0.1.3 ----- - Really fix the installation issue this time. 0.1.2 ----- - Actually fix the PyPI release. **Ugh** 0.1.1 ----- - Fix the PyPI release. 0.1.0 ----- - Initial Release! ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1674656705.0 flake8_docstrings-1.7.0/LICENSE0000644000175000017500000000205514364235701016436 0ustar00asottileasottileCopyright (c) 2013 Simon Andre, Ian Cordasco Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1674656705.0 flake8_docstrings-1.7.0/MANIFEST.in0000644000175000017500000000016614364235701017170 0ustar00asottileasottileinclude HISTORY.rst include LICENSE include README.rst include flake8_docstrings.py include setup.cfg include tox.ini ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1674656821.8332627 flake8_docstrings-1.7.0/PKG-INFO0000644000175000017500000000364414364236066016540 0ustar00asottileasottileMetadata-Version: 2.1 Name: flake8_docstrings Version: 1.7.0 Summary: Extension for flake8 which uses pydocstyle to check docstrings Home-page: https://github.com/pycqa/flake8-docstrings Author: Simon ANDRÉ Author-email: sandre@anybox.fr Maintainer: Ian Cordasco Maintainer-email: graffatcolmingov@gmail.com License: MIT Keywords: PEP 257,pydocstyle,pep257,docstrings,flake8 Classifier: Environment :: Console Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: MIT License Classifier: Operating System :: OS Independent Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3 :: Only Classifier: Programming Language :: Python :: Implementation :: CPython Provides: flake8_docstrings Requires-Python: >=3.7 Description-Content-Type: text/x-rst License-File: LICENSE flake8-docstrings ================= A simple module that adds an extension for the fantastic pydocstyle_ tool to flake8_. Simply install this extension:: pip install flake8-docstrings and run flake8. You can set the pydocstyle convention_ at the command line using:: $ flake8 --docstring-convention numpy ... Or, adding ``docstring-convention=numpy`` to your flake8 configuration file. The available set of conventions depends on the version of pydocstyle installed. The default is ``pep257``, pydocstyle v2.0.0 added ``numpy`` (for the numpydoc standard), while pydocstyle v4.0.0 added ``google``. In order to choose a custom list of error codes, use the special value ``docstring-convention=all``, then choose the codes you want checked using flake8_'s built-in ``--ignore``/``--select`` functionality. Report any issues on our `bug tracker`_. .. _pydocstyle: https://github.com/pycqa/pydocstyle .. _flake8: https://github.com/pycqa/flake8 .. _convention: http://www.pydocstyle.org/en/latest/error_codes.html#default-conventions .. _bug tracker: https://github.com/pycqa/flake8-docstrings/issues ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1674656705.0 flake8_docstrings-1.7.0/README.rst0000644000175000017500000000213414364235701017116 0ustar00asottileasottileflake8-docstrings ================= A simple module that adds an extension for the fantastic pydocstyle_ tool to flake8_. Simply install this extension:: pip install flake8-docstrings and run flake8. You can set the pydocstyle convention_ at the command line using:: $ flake8 --docstring-convention numpy ... Or, adding ``docstring-convention=numpy`` to your flake8 configuration file. The available set of conventions depends on the version of pydocstyle installed. The default is ``pep257``, pydocstyle v2.0.0 added ``numpy`` (for the numpydoc standard), while pydocstyle v4.0.0 added ``google``. In order to choose a custom list of error codes, use the special value ``docstring-convention=all``, then choose the codes you want checked using flake8_'s built-in ``--ignore``/``--select`` functionality. Report any issues on our `bug tracker`_. .. _pydocstyle: https://github.com/pycqa/pydocstyle .. _flake8: https://github.com/pycqa/flake8 .. _convention: http://www.pydocstyle.org/en/latest/error_codes.html#default-conventions .. _bug tracker: https://github.com/pycqa/flake8-docstrings/issues ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1674656821.8292627 flake8_docstrings-1.7.0/flake8_docstrings.egg-info/0000755000175000017500000000000014364236066022537 5ustar00asottileasottile././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1674656821.0 flake8_docstrings-1.7.0/flake8_docstrings.egg-info/PKG-INFO0000644000175000017500000000364414364236065023642 0ustar00asottileasottileMetadata-Version: 2.1 Name: flake8-docstrings Version: 1.7.0 Summary: Extension for flake8 which uses pydocstyle to check docstrings Home-page: https://github.com/pycqa/flake8-docstrings Author: Simon ANDRÉ Author-email: sandre@anybox.fr Maintainer: Ian Cordasco Maintainer-email: graffatcolmingov@gmail.com License: MIT Keywords: PEP 257,pydocstyle,pep257,docstrings,flake8 Classifier: Environment :: Console Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: MIT License Classifier: Operating System :: OS Independent Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3 :: Only Classifier: Programming Language :: Python :: Implementation :: CPython Provides: flake8_docstrings Requires-Python: >=3.7 Description-Content-Type: text/x-rst License-File: LICENSE flake8-docstrings ================= A simple module that adds an extension for the fantastic pydocstyle_ tool to flake8_. Simply install this extension:: pip install flake8-docstrings and run flake8. You can set the pydocstyle convention_ at the command line using:: $ flake8 --docstring-convention numpy ... Or, adding ``docstring-convention=numpy`` to your flake8 configuration file. The available set of conventions depends on the version of pydocstyle installed. The default is ``pep257``, pydocstyle v2.0.0 added ``numpy`` (for the numpydoc standard), while pydocstyle v4.0.0 added ``google``. In order to choose a custom list of error codes, use the special value ``docstring-convention=all``, then choose the codes you want checked using flake8_'s built-in ``--ignore``/``--select`` functionality. Report any issues on our `bug tracker`_. .. _pydocstyle: https://github.com/pycqa/pydocstyle .. _flake8: https://github.com/pycqa/flake8 .. _convention: http://www.pydocstyle.org/en/latest/error_codes.html#default-conventions .. _bug tracker: https://github.com/pycqa/flake8-docstrings/issues ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1674656821.0 flake8_docstrings-1.7.0/flake8_docstrings.egg-info/SOURCES.txt0000644000175000017500000000052214364236065024421 0ustar00asottileasottileHISTORY.rst LICENSE MANIFEST.in README.rst flake8_docstrings.py setup.cfg setup.py tox.ini flake8_docstrings.egg-info/PKG-INFO flake8_docstrings.egg-info/SOURCES.txt flake8_docstrings.egg-info/dependency_links.txt flake8_docstrings.egg-info/entry_points.txt flake8_docstrings.egg-info/requires.txt flake8_docstrings.egg-info/top_level.txt././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1674656821.0 flake8_docstrings-1.7.0/flake8_docstrings.egg-info/dependency_links.txt0000644000175000017500000000000114364236065026604 0ustar00asottileasottile ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1674656821.0 flake8_docstrings-1.7.0/flake8_docstrings.egg-info/entry_points.txt0000644000175000017500000000006714364236065026037 0ustar00asottileasottile[flake8.extension] D = flake8_docstrings:pep257Checker ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1674656821.0 flake8_docstrings-1.7.0/flake8_docstrings.egg-info/requires.txt0000644000175000017500000000003214364236065025131 0ustar00asottileasottileflake8>=3 pydocstyle>=2.1 ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1674656821.0 flake8_docstrings-1.7.0/flake8_docstrings.egg-info/top_level.txt0000644000175000017500000000002214364236065025262 0ustar00asottileasottileflake8_docstrings ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1674656713.0 flake8_docstrings-1.7.0/flake8_docstrings.py0000644000175000017500000001422714364235711021421 0ustar00asottileasottile"""Implementation of pydocstyle integration with Flake8. pydocstyle docstrings convention needs error code and class parser for be included as module into flake8 """ import re supports_ignore_inline_noqa = False supports_property_decorators = False supports_ignore_self_only_init = False try: import pydocstyle as pep257 module_name = "pydocstyle" pydocstyle_version = tuple( int(num) for num in pep257.__version__.split(".") ) supports_ignore_inline_noqa = pydocstyle_version >= (6, 0, 0) supports_property_decorators = pydocstyle_version >= (6, 2, 0) supports_ignore_self_only_init = pydocstyle_version >= (6, 3, 0) except ImportError: import pep257 module_name = "pep257" __version__ = "1.7.0" __all__ = ("pep257Checker",) class _ContainsAll: def __contains__(self, code): # type: (str) -> bool return True class EnvironError(pep257.Error): def __init__(self, err): super().__init__( code="D998", short_desc="EnvironmentError: " + str(err), context=None, ) @property def line(self): """Return 0 as line number for EnvironmentError.""" return 0 class AllError(pep257.Error): def __init__(self, err): super().__init__( code="D999", short_desc=str(err).partition("\n")[0], context=None, ) @property def line(self): """pep257.AllError does not contain line number. Return 0 instead.""" return 0 class pep257Checker: """Flake8 needs a class to check python file.""" name = "flake8-docstrings" version = f"{__version__}, {module_name}: {pep257.__version__}" def __init__(self, tree, filename, lines): """Initialize the checker.""" self.tree = tree self.filename = filename self.checker = pep257.ConventionChecker() self.source = "".join(lines) @classmethod def add_options(cls, parser): """Add plugin configuration option to flake8.""" parser.add_option( "--docstring-convention", action="store", parse_from_config=True, default="pep257", choices=sorted(pep257.conventions) + ["all"], help=( "pydocstyle docstring convention, default 'pep257'. " "Use the special value 'all' to enable all codes (note: " "some codes are conflicting so you'll need to then exclude " "those)." ), ) parser.add_option( "--ignore-decorators", action="store", parse_from_config=True, default=None, help=( "pydocstyle ignore-decorators regular expression, " "default None. " "Ignore any functions or methods that are decorated by " "a function with a name fitting this regular expression. " "The default is not ignore any decorated functions. " ), ) if supports_property_decorators: from pydocstyle.config import ConfigurationParser default_property_decorators = ( ConfigurationParser.DEFAULT_PROPERTY_DECORATORS ) parser.add_option( "--property-decorators", action="store", parse_from_config=True, default=default_property_decorators, help=( "consider any method decorated with one of these " "decorators as a property, and consequently allow " "a docstring which is not in imperative mood; default " f"is --property-decorators='{default_property_decorators}'" ), ) if supports_ignore_self_only_init: parser.add_option( "--ignore-self-only-init", action="store_true", parse_from_config=True, help="ignore __init__ methods which only have a self param.", ) @classmethod def parse_options(cls, options): """Parse the configuration options given to flake8.""" cls.convention = options.docstring_convention cls.ignore_decorators = ( re.compile(options.ignore_decorators) if options.ignore_decorators else None ) if supports_property_decorators: cls.property_decorators = options.property_decorators if supports_ignore_self_only_init: cls.ignore_self_only_init = options.ignore_self_only_init def _call_check_source(self): check_source_kwargs = {} if supports_ignore_inline_noqa: check_source_kwargs["ignore_inline_noqa"] = True if supports_property_decorators: check_source_kwargs["property_decorators"] = ( set(self.property_decorators.split(",")) if self.property_decorators else None ) if supports_ignore_self_only_init: check_source_kwargs[ "ignore_self_only_init" ] = self.ignore_self_only_init return self.checker.check_source( self.source, self.filename, ignore_decorators=self.ignore_decorators, **check_source_kwargs, ) def _check_source(self): try: for err in self._call_check_source(): yield err except pep257.AllError as err: yield AllError(err) except OSError as err: yield EnvironError(err) def run(self): """Use directly check() api from pydocstyle.""" if self.convention == "all": checked_codes = _ContainsAll() else: checked_codes = pep257.conventions[self.convention] | { "D998", "D999", } for error in self._check_source(): if isinstance(error, pep257.Error) and error.code in checked_codes: # NOTE(sigmavirus24): Fixes GitLab#3 message = f"{error.code} {error.short_desc}" yield (error.line, 0, message, type(self)) ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1674656821.8332627 flake8_docstrings-1.7.0/setup.cfg0000644000175000017500000000207614364236066017262 0ustar00asottileasottile[metadata] name = flake8_docstrings version = attr: flake8_docstrings.__version__ description = Extension for flake8 which uses pydocstyle to check docstrings long_description = file: README.rst long_description_content_type = text/x-rst url = https://github.com/pycqa/flake8-docstrings author = Simon ANDRÉ author_email = sandre@anybox.fr maintainer = Ian Cordasco maintainer_email = graffatcolmingov@gmail.com license = MIT license_file = LICENSE classifiers = Environment :: Console Intended Audience :: Developers License :: OSI Approved :: MIT License Operating System :: OS Independent Programming Language :: Python :: 3 Programming Language :: Python :: 3 :: Only Programming Language :: Python :: Implementation :: CPython keywords = PEP 257, pydocstyle, pep257, docstrings, flake8 provides = flake8_docstrings [options] py_modules = flake8_docstrings install_requires = flake8>=3 pydocstyle>=2.1 python_requires = >=3.7 [options.entry_points] flake8.extension = D = flake8_docstrings:pep257Checker [wheel] universal = 1 [egg_info] tag_build = tag_date = 0 ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1674656705.0 flake8_docstrings-1.7.0/setup.py0000644000175000017500000000004614364235701017141 0ustar00asottileasottilefrom setuptools import setup setup() ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1674656705.0 flake8_docstrings-1.7.0/tox.ini0000644000175000017500000000077314364235701016751 0ustar00asottileasottile[tox] minversion = 1.6 envlist = pre-commit,py [testenv] deps = flake8 commands = flake8 {posargs} flake8_docstrings.py [testenv:release] basepython = python3.9 deps = twine >= 1.5.0 wheel commands = python setup.py sdist bdist_wheel twine upload --skip-existing {posargs} dist/* [testenv:pre-commit] skip_install = true deps = pre-commit commands = pre-commit run --all-files --show-diff-on-failure [flake8] ignore = D203 max_line_length = 79 exclude = .git,.tox,dist,docs,*egg