Skip to content
This repository was archived by the owner on Jan 15, 2025. It is now read-only.

Commit ec60f1c

Browse files
committed
fix __version__ and minor non-function typo
1 parent 244bf4b commit ec60f1c

File tree

3 files changed

+17
-14
lines changed

3 files changed

+17
-14
lines changed

flake8_idom_hooks/__init__.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
from pkg_resources import (
2+
get_distribution as _get_distribution,
3+
DistributionNotFound as _DistributionNotFound,
4+
)
5+
6+
try:
7+
__version__ = _get_distribution(__name__).version
8+
except _DistributionNotFound: # pragma: no cover
9+
# package is not installed
10+
__version__ = "0.0.0"
11+
112
from .flake8_plugin import Plugin
213

314
__all__ = ["Plugin"]

flake8_idom_hooks/flake8_plugin.py

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,18 @@
11
import ast
2-
from pkg_resources import (
3-
get_distribution as _get_distribution,
4-
DistributionNotFound as _DistributionNotFound,
5-
)
2+
63
from typing import List, Tuple, Type
74

5+
from flake8_idom_hooks import __version__
6+
87
from .utils import ErrorVisitor
98
from .rules_of_hooks import RulesOfHooksVisitor
109
from .exhaustive_deps import ExhaustiveDepsVisitor
1110

12-
try:
13-
__version__ = _get_distribution(__name__).version
14-
except _DistributionNotFound: # pragma: no cover
15-
# package is not installed
16-
__version__ = "0.0.0"
17-
1811

1912
class Plugin:
2013

2114
name = __name__
2215
version = __version__
23-
options = None
2416

2517
_visitor_types: List[Type[ErrorVisitor]] = [
2618
RulesOfHooksVisitor,

flake8_idom_hooks/rules_of_hooks.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@ def _check_if_propper_hook_usage(
6464
msg = f"hook {name!r} used outside element or hook definition"
6565
self._save_error(101, node, msg)
6666

67-
_loop_or_conditional = self._current_conditional or self._current_loop
68-
if _loop_or_conditional is not None:
69-
node_type = type(_loop_or_conditional)
67+
loop_or_conditional = self._current_conditional or self._current_loop
68+
if loop_or_conditional is not None:
69+
node_type = type(loop_or_conditional)
7070
node_type_to_name = {
7171
ast.If: "if statement",
7272
ast.IfExp: "inline if expression",

0 commit comments

Comments
 (0)