Skip to content

Commit 11694e3

Browse files
committed
ruff fmt
1 parent db74d2f commit 11694e3

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

tools/rpau/src/rpau/logic.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
logger = get_logger(__name__)
1919

20+
2021
def fetch_upstream(*, base_url: str, path: str, version: str) -> str:
2122
upstream_url = "/".join((base_url, version, path))
2223
logger.debug(f"{upstream_url=}")
@@ -44,6 +45,7 @@ def get_upstream_contents(
4445
else:
4546
return fetch()
4647

48+
4749
def format_patch(patch_conf: Patch) -> str:
4850
"""
4951
Transforms a patch definition to a raw python code.
@@ -80,6 +82,7 @@ def format_patch(patch_conf: Patch) -> str:
8082

8183
return res.strip().rstrip(";").strip()
8284

85+
8386
def iter_patches(tree: ast.Module, conf: Conf) -> "Iterator[tuple[int, str]]":
8487
"""
8588
Get needed patches to apply for given ast tree based on the conf.
@@ -117,14 +120,14 @@ def iter_patches(tree: ast.Module, conf: Conf) -> "Iterator[tuple[int, str]]":
117120
if not (patch_conf := cls_conf.pop(fn_node.name, None)):
118121
continue
119122

120-
'''
123+
"""
121124
if any(
122125
is_patch_present(dec_node, patch_conf)
123126
for dec_node in fn_node.decorator_list
124127
if isinstance(dec_node, (ast.Attribute, ast.Call))
125128
):
126129
continue
127-
'''
130+
"""
128131

129132
lineno = min(
130133
(dec_node.lineno for dec_node in fn_node.decorator_list),
@@ -158,6 +161,7 @@ def iter_patches(tree: ast.Module, conf: Conf) -> "Iterator[tuple[int, str]]":
158161
""".rstrip(),
159162
)
160163

164+
161165
def apply_conf(contents: str, conf: dict) -> str:
162166
"""
163167
Patch a given source code based on the conf.
@@ -184,6 +188,7 @@ def apply_conf(contents: str, conf: dict) -> str:
184188

185189
return "\n".join(lines)
186190

191+
187192
def run(
188193
conf: dict,
189194
path: str,
@@ -196,7 +201,7 @@ def run(
196201
path=path, version=version, base_url=base_upstream_url, cache_dir=cache_dir
197202
)
198203

199-
patched_contents=apply_conf(contents, conf)
204+
patched_contents = apply_conf(contents, conf)
200205
new_contents = f"# upstream_version: {version}\n{patched_contents}"
201206

202207
output_file = output_dir / path

0 commit comments

Comments
 (0)