Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 8f04db0

Browse filesBrowse files
committed
chore(ruff) Automated fixes for Python 3.9 + ruff 0.8.4
Fixed 9 errors: - src/libvcs/_internal/query_list.py: 1 × RUF052 (used-dummy-variable) - src/libvcs/cmd/git.py: 2 × PLC1802 (len-test) - src/libvcs/sync/svn.py: 5 × RUF052 (used-dummy-variable) 1 × RUF039 (unraw-re-pattern) ruff check . --select ALL --fix --unsafe-fixes --preview --show-fixes --ignore T201 --ignore PT014 --ignore RUF100; ruff format .;
1 parent 7cbe802 commit 8f04db0
Copy full SHA for 8f04db0

File tree

Expand file treeCollapse file tree

3 files changed

+16
-16
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+16
-16
lines changed

‎src/libvcs/_internal/query_list.py

Copy file name to clipboardExpand all lines: src/libvcs/_internal/query_list.py
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -526,19 +526,19 @@ def filter_lookup(obj: t.Any) -> bool:
526526
return True
527527

528528
if callable(matcher):
529-
_filter = matcher
529+
filter_ = matcher
530530
elif matcher is not None:
531531

532532
def val_match(obj: t.Union[str, list[t.Any], T]) -> bool:
533533
if isinstance(matcher, list):
534534
return obj in matcher
535535
return bool(obj == matcher)
536536

537-
_filter = val_match
537+
filter_ = val_match
538538
else:
539-
_filter = filter_lookup
539+
filter_ = filter_lookup
540540

541-
return self.__class__(k for k in self if _filter(k))
541+
return self.__class__(k for k in self if filter_(k))
542542

543543
def get(
544544
self,

‎src/libvcs/cmd/git.py

Copy file name to clipboardExpand all lines: src/libvcs/cmd/git.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2033,7 +2033,7 @@ def rev_list(
20332033
"rev-list",
20342034
*local_flags,
20352035
*required_flags,
2036-
*(["--", *path_flags] if len(path_flags) else []),
2036+
*(["--", *path_flags] if path_flags else []),
20372037
],
20382038
check_returncode=check_returncode,
20392039
log_in_real_time=log_in_real_time,
@@ -2156,7 +2156,7 @@ def show_ref(
21562156
[
21572157
"show-ref",
21582158
*local_flags,
2159-
*(["--", *pattern_flags] if len(pattern_flags) else []),
2159+
*(["--", *pattern_flags] if pattern_flags else []),
21602160
],
21612161
check_returncode=check_returncode,
21622162
)

‎src/libvcs/sync/svn.py

Copy file name to clipboardExpand all lines: src/libvcs/sync/svn.py
+10-10Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,9 @@ def get_revision_file(self, location: str) -> int:
104104
"""Return revision for a file."""
105105
current_rev = self.cmd.info(location)
106106

107-
_INI_RE = re.compile(r"^([^:]+):\s+(\S.*)$", re.MULTILINE)
107+
INI_RE = re.compile(r"^([^:]+):\s+(\S.*)$", re.MULTILINE)
108108

109-
info_list = _INI_RE.findall(current_rev)
109+
info_list = INI_RE.findall(current_rev)
110110
return int(dict(info_list)["Revision"])
111111

112112
def get_revision(self, location: Optional[str] = None) -> int:
@@ -165,10 +165,10 @@ def update_repo(
165165

166166
@classmethod
167167
def _get_svn_url_rev(cls, location: str) -> tuple[Optional[str], int]:
168-
_svn_xml_url_re = re.compile('url="([^"]+)"')
169-
_svn_rev_re = re.compile(r'committed-rev="(\d+)"')
170-
_svn_info_xml_rev_re = re.compile(r'\s*revision="(\d+)"')
171-
_svn_info_xml_url_re = re.compile(r"<url>(.*)</url>")
168+
svn_xml_url_re = re.compile(r'url="([^"]+)"')
169+
svn_rev_re = re.compile(r'committed-rev="(\d+)"')
170+
svn_info_xml_rev_re = re.compile(r'\s*revision="(\d+)"')
171+
svn_info_xml_url_re = re.compile(r"<url>(.*)</url>")
172172

173173
entries_path = pathlib.Path(location) / ".svn" / "entries"
174174
if entries_path.exists():
@@ -184,11 +184,11 @@ def _get_svn_url_rev(cls, location: str) -> tuple[Optional[str], int]:
184184
url = entries[0][3]
185185
revs = [int(d[9]) for d in entries if len(d) > 9 and d[9]] + [0]
186186
elif data.startswith("<?xml"):
187-
match = _svn_xml_url_re.search(data)
187+
match = svn_xml_url_re.search(data)
188188
if not match:
189189
raise SvnUrlRevFormattingError(data=data)
190190
url = match.group(1) # get repository URL
191-
revs = [int(m.group(1)) for m in _svn_rev_re.finditer(data)] + [0]
191+
revs = [int(m.group(1)) for m in svn_rev_re.finditer(data)] + [0]
192192
else:
193193
try:
194194
# Note that using get_remote_call_options is not necessary here
@@ -200,10 +200,10 @@ def _get_svn_url_rev(cls, location: str) -> tuple[Optional[str], int]:
200200
target=pathlib.Path(location),
201201
xml=True,
202202
)
203-
match = _svn_info_xml_url_re.search(xml)
203+
match = svn_info_xml_url_re.search(xml)
204204
assert match is not None
205205
url = match.group(1)
206-
revs = [int(m.group(1)) for m in _svn_info_xml_rev_re.finditer(xml)]
206+
revs = [int(m.group(1)) for m in svn_info_xml_rev_re.finditer(xml)]
207207
except Exception:
208208
url, revs = None, []
209209

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.