Skip to content

Commit 13d5129

Browse files
authored
Bump Refactor to 0.5.0 (#35)
1 parent 0da0763 commit 13d5129

File tree

5 files changed

+59
-56
lines changed

5 files changed

+59
-56
lines changed

airflint/actions/new_statements.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22
import ast
33
from dataclasses import dataclass
44

5-
from refactor import Action, Context, common
5+
from refactor import Context, common
6+
from refactor.actions import LazyInsertAfter
67
from refactor.ast import split_lines
78

89

910
@dataclass
10-
class NewStatementsAction(Action):
11+
class NewStatementsAction(LazyInsertAfter):
1112
"""Add new statements after the node's line."""
1213

1314
statements: list[ast.stmt]

airflint/rules/use_function_level_imports.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# Credits go to GitHub user @isidentical who provided most of the solution.
22
import ast
33

4-
from refactor import Action, Rule, context
4+
from refactor import Rule, context
5+
from refactor.actions import BaseAction
56
from refactor.context import ScopeType
67

78
from airflint.actions.new_statements import NewStatementsAction
@@ -12,7 +13,7 @@ class UseFunctionLevelImports(Rule):
1213

1314
context_providers = (context.Scope,)
1415

15-
def match(self, node: ast.AST) -> Action:
16+
def match(self, node: ast.AST) -> BaseAction:
1617
# Instead of going import -> function, we are going
1718
# function -> import since this way it is easier to
1819
# do the refactorings one by one and finally remove

airflint/rules/use_jinja_variable_get.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
from importlib import import_module
33
from typing import Any
44

5-
from refactor import ReplacementAction, Rule
5+
from refactor import Rule
6+
from refactor.actions import Replace
67
from refactor.context import Ancestry, Scope
78

89

@@ -145,7 +146,7 @@ def match(self, node):
145146
for operator_keyword in self._get_operator_keywords(reference=node):
146147
self._lookup_template_fields(keyword=operator_keyword)
147148

148-
return ReplacementAction(
149+
return Replace(
149150
node,
150151
target=ast.Constant(value=self._construct_value(node)),
151152
)

poetry.lock

+49-49
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ airflint = "airflint.__main__:main"
1212

1313
[tool.poetry.dependencies]
1414
python = "^3.9"
15-
refactor = "^0.4.4"
15+
refactor = "^0.5.0"
1616

1717
[tool.poetry.dev-dependencies]
1818
pytest = "^7.1.1"

0 commit comments

Comments
 (0)