Skip to content

Commit

Permalink
Bump dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
i80and committed Apr 5, 2024
1 parent b78feb6 commit 39936ce
Show file tree
Hide file tree
Showing 15 changed files with 276 additions and 323 deletions.
436 changes: 218 additions & 218 deletions poetry.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pyinstaller = "^6.4.0"
[tool.poetry.dev-dependencies]
pytest = "^7.1.1"
pytest-cov = "^4.0.0"
black = "^23.7.0"
black = "^24.3.0"
pyflakes = "^2.4"
mypy = "1.6.1"
isort = "^5.10.1"
Expand Down
8 changes: 5 additions & 3 deletions snooty/builders/man.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,9 +290,11 @@ def handle_ListNode(self, node: n.ListNode) -> List[ManNode]:
ManNode.ElementType.LIST,
self.children(node.children),
{
"type": "unordered"
if node.enumtype == n.ListEnumType.unordered
else "ordered"
"type": (
"unordered"
if node.enumtype == n.ListEnumType.unordered
else "ordered"
)
},
)
]
Expand Down
17 changes: 9 additions & 8 deletions snooty/flutter.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ class HasAnnotations(Protocol):


class Constructable(Protocol):
def __init__(self, **kwargs: object) -> None:
...
def __init__(self, **kwargs: object) -> None: ...


_A = TypeVar("_A", bound=HasAnnotations)
Expand Down Expand Up @@ -80,12 +79,14 @@ def make_factory(value: object) -> Callable[[], Any]:
# in the lambda is a ~~hack~~ to avoid messing up the variable binding.
fields: Dict[str, _Field] = {
field.name: _Field(
field.default_factory
if field.default_factory is not MISSING
else (
(make_factory(field.default))
if field.default is not MISSING
else None
(
field.default_factory
if field.default_factory is not MISSING
else (
(make_factory(field.default))
if field.default is not MISSING
else None
)
),
hints[field.name],
)
Expand Down
6 changes: 3 additions & 3 deletions snooty/page_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ def start(

return result

self.worker: util.WorkerLauncher[
Postprocessor, PostprocessorResult
] = util.WorkerLauncher("postprocessor", start)
self.worker: util.WorkerLauncher[Postprocessor, PostprocessorResult] = (
util.WorkerLauncher("postprocessor", start)
)

def set_orphan_diagnostics(self, key: FileId, value: List[Diagnostic]) -> None:
"""Some diagnostics can't be associated with a parsed Page because of underlying
Expand Down
23 changes: 9 additions & 14 deletions snooty/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -1356,37 +1356,32 @@ class ProjectBackend:
def on_config(self, config: ProjectConfig, branch: str) -> None:
pass

def on_progress(self, progress: int, total: int, message: str) -> None:
...
def on_progress(self, progress: int, total: int, message: str) -> None: ...

def on_diagnostics(self, path: FileId, diagnostics: List[Diagnostic]) -> None:
...
def on_diagnostics(self, path: FileId, diagnostics: List[Diagnostic]) -> None: ...

def set_diagnostics(self, path: FileId, diagnostics: List[Diagnostic]) -> None:
...
def set_diagnostics(self, path: FileId, diagnostics: List[Diagnostic]) -> None: ...

def on_update(
self,
prefix: List[str],
build_identifiers: BuildIdentifierSet,
page_id: FileId,
page: Page,
) -> None:
...
) -> None: ...

def on_update_metadata(
self,
prefix: List[str],
build_identifiers: BuildIdentifierSet,
field: Dict[str, SerializableType],
) -> None:
...
) -> None: ...

def on_delete(self, page_id: FileId, build_identifiers: BuildIdentifierSet) -> None:
...
def on_delete(
self, page_id: FileId, build_identifiers: BuildIdentifierSet
) -> None: ...

def flush(self) -> None:
...
def flush(self) -> None: ...

def close(self) -> None:
pass
Expand Down
16 changes: 10 additions & 6 deletions snooty/postprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -2134,9 +2134,11 @@ def find_toctree_nodes(
toctree_node: Dict[str, object] = {}
if entry.ref_project:
toctree_node = {
"title": [n.Text((0,), entry.title).serialize()]
if entry.title
else None,
"title": (
[n.Text((0,), entry.title).serialize()]
if entry.title
else None
),
"options": {"project": entry.ref_project},
"children": [],
"slug": entry.ref_project,
Expand All @@ -2149,9 +2151,11 @@ def find_toctree_nodes(
external_nodes.add(ref_project_pair)
if entry.url:
toctree_node = {
"title": [n.Text((0,), entry.title).serialize()]
if entry.title
else None,
"title": (
[n.Text((0,), entry.title).serialize()]
if entry.title
else None
),
"url": entry.url,
"children": [],
}
Expand Down
20 changes: 9 additions & 11 deletions snooty/rstparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -973,17 +973,13 @@ def __init__(
project_config: ProjectConfig,
docpath: PurePath,
document: tinydocutils.nodes.document,
) -> None:
...
) -> None: ...

def dispatch_visit(self, node: tinydocutils.nodes.Node) -> None:
...
def dispatch_visit(self, node: tinydocutils.nodes.Node) -> None: ...

def dispatch_departure(self, node: tinydocutils.nodes.Node) -> None:
...
def dispatch_departure(self, node: tinydocutils.nodes.Node) -> None: ...

def add_diagnostics(self, diagnostics: Iterable[Diagnostic]) -> None:
...
def add_diagnostics(self, diagnostics: Iterable[Diagnostic]) -> None: ...


_V = TypeVar("_V", bound=Visitor, covariant=True)
Expand Down Expand Up @@ -1210,9 +1206,11 @@ def register_spec_with_docutils(
role_spec.type.domain or domain,
role_spec.type.name,
role_spec.type.tag,
role_spec.rstobject.type
if role_spec.rstobject
else specparser.TargetType.plain,
(
role_spec.rstobject.type
if role_spec.rstobject
else specparser.TargetType.plain
),
role_spec.type.format,
)
elif role_spec.type == specparser.PrimitiveRoleType.explicit_title:
Expand Down
1 change: 0 additions & 1 deletion snooty/tinydocutils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@


class Parser(parsers.Parser):

"""The reStructuredText parser."""

def __init__(self, inliner: Optional[states.Inliner] = None) -> None:
Expand Down
2 changes: 0 additions & 2 deletions snooty/tinydocutils/directives.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,6 @@ def format_values(values: Sequence[str]) -> str:


class DirectiveError(Exception):

"""
Store a message and a system message level.
Expand All @@ -203,7 +202,6 @@ def __init__(self, level: int, message: str) -> None:


class Directive:

"""
Base class for reStructuredText directives.
Expand Down
21 changes: 2 additions & 19 deletions snooty/tinydocutils/nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@


class Node:

"""Abstract base class of nodes in a document tree."""

parent: "Optional[Element]" = None
Expand Down Expand Up @@ -215,7 +214,6 @@ def unescape(text: str, restore_backslashes: bool = False) -> str:


class Text(Node):

"""
Instances are terminal nodes (leaves) containing text only; no child
nodes or attributes. Initialize by passing a string to the constructor.
Expand Down Expand Up @@ -253,7 +251,6 @@ def pformat(self, indent: str = " ", level: int = 0) -> str:


class Element(Node):

"""
`Element` is the superclass to all specific elements.
Expand Down Expand Up @@ -530,7 +527,6 @@ def setup_child(self, child: "Node") -> None:


class TextElement(Element):

"""
An element which directly contains text.
Expand Down Expand Up @@ -562,7 +558,6 @@ def __init__(


class FixedTextElement(TextElement):

"""An element which directly contains preformatted text."""

def __init__(
Expand Down Expand Up @@ -615,7 +610,6 @@ class Inline:


class document(Root, Structural, Element):

"""
The document root element.
Expand Down Expand Up @@ -1073,7 +1067,6 @@ class entry(Element):


class system_message(PreBibliographic, Element):

"""
System message element.
Expand Down Expand Up @@ -1143,7 +1136,6 @@ class substitution_reference(Inline, TextElement):


class NodeVisitor(Protocol):

"""
"Visitor" pattern [GoF95]_ abstract superclass implementation for
document tree traversals.
Expand Down Expand Up @@ -1171,15 +1163,12 @@ class NodeVisitor(Protocol):
1995.
"""

def dispatch_visit(self, node: Node) -> None:
...
def dispatch_visit(self, node: Node) -> None: ...

def dispatch_departure(self, node: Node) -> None:
...
def dispatch_departure(self, node: Node) -> None: ...


class TreePruningException(Exception):

"""
Base class for `NodeVisitor`-related tree pruning exceptions.
Expand All @@ -1192,7 +1181,6 @@ class TreePruningException(Exception):


class SkipChildren(TreePruningException):

"""
Do not visit any children of the current node. The current node's
siblings and ``depart_...`` method are not affected.
Expand All @@ -1202,7 +1190,6 @@ class SkipChildren(TreePruningException):


class SkipSiblings(TreePruningException):

"""
Do not visit any more siblings (to the right) of the current node. The
current node's children and its ``depart_...`` method are not affected.
Expand All @@ -1212,7 +1199,6 @@ class SkipSiblings(TreePruningException):


class SkipNode(TreePruningException):

"""
Do not visit the current node's children, and do not call the current
node's ``depart_...`` method.
Expand All @@ -1222,7 +1208,6 @@ class SkipNode(TreePruningException):


class SkipDeparture(TreePruningException):

"""
Do not call the current node's ``depart_...`` method. The current node's
children and siblings are not affected.
Expand All @@ -1232,7 +1217,6 @@ class SkipDeparture(TreePruningException):


class StopTraversal(TreePruningException):

"""
Stop the traversal alltogether. The current node's ``depart_...`` method
is not affected. The parent nodes ``depart_...`` methods are also called
Expand Down Expand Up @@ -1388,7 +1372,6 @@ def write(self, message: str) -> None:


class Reporter:

"""
Info/warning/error reporter and ``system_message`` element generator.
Expand Down
11 changes: 2 additions & 9 deletions snooty/tinydocutils/statemachine.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ class StateConfiguration(NamedTuple):


class StringList:

"""
List with extended functionality: slices of StringList objects are child
lists, linked to their parents. Changes made to a child list also affect
Expand Down Expand Up @@ -199,12 +198,10 @@ def __len__(self) -> int:
# just works.

@overload
def __getitem__(self, i: int) -> str:
...
def __getitem__(self, i: int) -> str: ...

@overload
def __getitem__(self, i: slice) -> "StringList":
...
def __getitem__(self, i: slice) -> "StringList": ...

def __getitem__(self, i: Union[int, slice]) -> Union[str, "StringList"]:
if isinstance(i, slice):
Expand Down Expand Up @@ -529,7 +526,6 @@ def replace(self, old: str, new: str) -> None:


class StateMachine:

"""
A finite state machine for text filters using regular expressions.
Expand Down Expand Up @@ -1039,7 +1035,6 @@ def get_first_known_indented(


class State:

"""
State superclass. Contains a list of transitions, and transition methods.
Expand Down Expand Up @@ -1185,7 +1180,6 @@ class UnexpectedIndentationError(StateMachineError):


class TransitionCorrection(Exception):

"""
Raise from within a transition method to switch to another transition.
Expand All @@ -1197,7 +1191,6 @@ def __init__(self, transition: str) -> None:


class StateCorrection(Exception):

"""
Raise from within a transition method to switch to another state.
Expand Down
Loading

0 comments on commit 39936ce

Please sign in to comment.