Skip to content

Commit

Permalink
Linting
Browse files Browse the repository at this point in the history
  • Loading branch information
domdfcoding committed Sep 14, 2020
1 parent 0e0fe37 commit 3dd3eca
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
2 changes: 1 addition & 1 deletion __pkginfo__.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
web = github_url = "https://github.com/domdfcoding/attr_utils"
repo_root = pathlib.Path(__file__).parent
install_requires = (repo_root / "requirements.txt").read_text(encoding="utf-8").split('\n')
extras_require = {'sphinx': ['sphinx>=3.0.3', 'sphinx_toolbox>=0.4.0'], 'all': ['sphinx>=3.0.3', 'sphinx_toolbox>=0.4.0']}
extras_require = {'sphinx': ['sphinx>=3.0.3', 'sphinx_toolbox>=0.6.0'], 'all': ['sphinx>=3.0.3', 'sphinx_toolbox>=0.6.0']}



Expand Down
15 changes: 6 additions & 9 deletions attr_utils/docstrings.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@
# stdlib
import re
from typing import Optional, Pattern, Type
from domdf_python_tools.doctools import base_new_docstrings, prettify_docstrings, PYPY
from domdf_python_tools.typing import MethodDescriptorType, MethodWrapperType, WrapperDescriptorType

# 3rd party
from domdf_python_tools.doctools import PYPY, base_new_docstrings, prettify_docstrings
from domdf_python_tools.typing import MethodDescriptorType, MethodWrapperType, WrapperDescriptorType

__all__ = ["add_attrs_doc"]

Expand Down Expand Up @@ -59,9 +60,9 @@ def add_attrs_doc(obj: Type) -> Type:

if hasattr(obj, "__repr__"):
if (
obj.__repr__.__doc__.strip() == attrs_docstring
obj.__repr__.__doc__ is None or obj.__repr__.__doc__.strip() == attrs_docstring
or attrs_20_1_docstring.match(obj.__repr__.__doc__)
):
):
_new_doc = f"{new_docstrings['__repr__']}" # \n\n{attrs_docstring}
obj.__repr__.__doc__ = _new_doc # prevents strange formatting in pycharm

Expand All @@ -80,11 +81,7 @@ def add_attrs_doc(obj: Type) -> Type:

doc: Optional[str] = attribute.__doc__

if (
doc is None
or doc.strip() == attrs_docstring
or attrs_20_1_docstring.match(doc)
):
if doc is None or doc.strip() == attrs_docstring or attrs_20_1_docstring.match(doc):
_new_doc = f"{new_docstrings[attr_name]}" # \n\n{attrs_docstring}
attribute.__doc__ = _new_doc # prevents strange formatting in pycharm

Expand Down

0 comments on commit 3dd3eca

Please sign in to comment.