Skip to content

Commit 1cb6a80

Browse files
Apply ruff/Pylint rule PLW0120
PLW0120 `else` clause on loop without a `break` statement; remove the `else` and dedent its contents
1 parent 21af19b commit 1cb6a80

File tree

3 files changed

+9
-12
lines changed

3 files changed

+9
-12
lines changed

_own_version_helper.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@ def parse(root: str, config: Configuration) -> ScmVersion | None:
4444
else:
4545
if parsed is not None:
4646
return parsed
47-
else:
48-
return None
47+
return None
4948

5049

5150
def scm_version() -> str:

src/setuptools_scm/_entrypoints.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,7 @@ def _get_ep(group: str, name: str) -> Any | None:
7272
for ep in iter_entry_points(group, name):
7373
log.debug("ep found: %s", ep.name)
7474
return ep.load()
75-
else:
76-
return None
75+
return None
7776

7877

7978
def _get_from_object_reference_str(path: str, group: str) -> Any | None:

src/setuptools_scm/git.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -321,15 +321,14 @@ def archival_to_version(
321321
version = tag_to_version(ref, config)
322322
if version is not None:
323323
return meta(version, config=config)
324+
node = data.get("node")
325+
if node is None:
326+
return None
327+
elif "$FORMAT" in node.upper():
328+
warnings.warn("unprocessed git archival found (no export subst applied)")
329+
return None
324330
else:
325-
node = data.get("node")
326-
if node is None:
327-
return None
328-
elif "$FORMAT" in node.upper():
329-
warnings.warn("unprocessed git archival found (no export subst applied)")
330-
return None
331-
else:
332-
return meta("0.0", node=node, config=config)
331+
return meta("0.0", node=node, config=config)
333332

334333

335334
def parse_archival(root: _t.PathT, config: Configuration) -> ScmVersion | None:

0 commit comments

Comments
 (0)