Skip to content

Commit 9df9c05

Browse files
committed
Enable pydocstyle (via flake8).
1 parent ac9174a commit 9df9c05

File tree

5 files changed

+22
-2
lines changed

5 files changed

+22
-2
lines changed

.flake8

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
[flake8]
22
ban-relative-imports = true
33
inline-quotes = "
4+
per-file-ignores =
5+
noxfile.py:D
6+
referencing/tests/*:D
7+
referencing/_attrs.py:D
48
ignore =
59
# Barring function calls in default args. Ha, no.
610
B008,
711
# See https://github.com/PyCQA/flake8-bugbear/issues/131
812
B306,
13+
# This rule makes diffs uglier when expanding docstrings (and it's uglier)
14+
D200,
915
# (flake8 default) old PEP8 boolean operator line breaks
1016
W503,

noxfile.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ def style(session):
4848
"flake8-broken-line",
4949
"flake8-bugbear",
5050
"flake8-commas",
51+
"flake8-docstrings",
5152
"flake8-quotes",
5253
"flake8-tidy-imports",
5354
)

referencing/__init__.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
1-
from referencing._core import Registry, Resource, Specification # noqa: F401
1+
"""
2+
Cross-specification, implementation-agnostic JSON referencing.
3+
"""
4+
from referencing._core import Registry, Resource, Specification
5+
6+
__all__ = ["Registry", "Resource", "Specification"]

referencing/_core.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,15 @@ class Resource(Generic[D]):
4646

4747
@classmethod
4848
def from_contents(cls, contents: D) -> Resource[D]:
49+
"""
50+
Attempt to discern which specification applies to the given contents.
51+
"""
4952
return cls(contents=contents, specification=Specification.OPAQUE)
5053

5154
def id(self) -> str | None:
55+
"""
56+
Retrieve this resource's (specification-specific) identifier.
57+
"""
5258
return self._specification.id_of(self.contents)
5359

5460

@@ -82,7 +88,6 @@ def crawl(self) -> Registry[D]:
8288
"""
8389
Immediately crawl all added resources, discovering subresources.
8490
"""
85-
8691
return self
8792

8893
def with_resources(

referencing/typing.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
"""
2+
Type-annotation related support for the referencing library.
3+
"""
14
from __future__ import annotations
25

36
from typing import TypeVar

0 commit comments

Comments
 (0)