Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commit6b51eda

Browse files
committed
refactor!(ruff): Run all automated fixes as of ruff 0.3.4
ruff check --select ALL . --fix --unsafe-fixes --preview --show-fixes; ruff format .Fixed 206 errors:- conftest.py: 1 × PIE790 (unnecessary-placeholder)- docs/conf.py: 1 × RET505 (superfluous-else-return)- src/libvcs/__init__.py: 1 × RUF022 (unsorted-dunder-all)- src/libvcs/_internal/query_list.py: 3 × RSE102 (unnecessary-paren-on-raise-exception) 2 × ANN204 (missing-return-type-special-method) 1 × T201 (print) 1 × PLR5501 (collapsible-else-if) 1 × RET505 (superfluous-else-return) 1 × RET506 (superfluous-else-raise) 1 × F841 (unused-variable)- src/libvcs/_internal/run.py: 1 × TID252 (relative-imports) 1 × I001 (unsorted-imports)- src/libvcs/_internal/shortcuts.py: 3 × RET505 (superfluous-else-return) 3 × ANN204 (missing-return-type-special-method) 2 × COM812 (missing-trailing-comma) 1 × PLR6201 (literal-membership)- src/libvcs/_internal/subprocess.py: 1 × ANN204 (missing-return-type-special-method)- src/libvcs/cmd/git.py: 1 × PLR5501 (collapsible-else-if) 1 × PLR2044 (empty-comment) 1 × RET505 (superfluous-else-return)- src/libvcs/cmd/svn.py: 1 × RSE102 (unnecessary-paren-on-raise-exception) 1 × ANN204 (missing-return-type-special-method)- src/libvcs/pytest_plugin.py: 12 × PT001 (pytest-fixture-incorrect-parentheses-style) 3 × PT003 (pytest-extraneous-scope-function) 1 × ANN204 (missing-return-type-special-method) 1 × E303 (too-many-blank-lines) 1 × PT025 (pytest-erroneous-use-fixtures-on-fixture) 1 × RET504 (unnecessary-assign) 1 × SIM103 (needless-bool)- src/libvcs/sync/base.py: 1 × F841 (unused-variable) 1 × RET504 (unnecessary-assign) 1 × E303 (too-many-blank-lines)- src/libvcs/sync/git.py: 5 × ANN204 (missing-return-type-special-method) 1 × TID252 (relative-imports) 1 × RET505 (superfluous-else-return) 1 × I001 (unsorted-imports) 1 × PLR5501 (collapsible-else-if) 1 × E303 (too-many-blank-lines) 1 × PLR1714 (repeated-equality-comparison) 1 × RSE102 (unnecessary-paren-on-raise-exception) 1 × PIE804 (unnecessary-dict-kwargs) 1 × F841 (unused-variable) 1 × PLR6201 (literal-membership) 1 × RET504 (unnecessary-assign)- src/libvcs/sync/svn.py: 1 × FURB167 (regex-flag-alias) 1 × ANN204 (missing-return-type-special-method) 1 × PIE810 (multiple-starts-ends-with)- src/libvcs/url/base.py: 1 × ANN204 (missing-return-type-special-method)- src/libvcs/url/registry.py: 1 × ANN204 (missing-return-type-special-method)- src/libvcs/url/svn.py: 2 × PLR2044 (empty-comment)- tests/_internal/subprocess/test_SubprocessCommand.py: 9 × PT007 (pytest-parametrize-values-wrong-type) 6 × PT006 (pytest-parametrize-names-wrong-type) 1 × PLW1510 (subprocess-run-without-check)- tests/_internal/test_query_list.py: 38 × PT007 (pytest-parametrize-values-wrong-type) 1 × PT006 (pytest-parametrize-names-wrong-type)- tests/sync/test_git.py: 38 × PT007 (pytest-parametrize-values-wrong-type) 12 × PT006 (pytest-parametrize-names-wrong-type) 10 × PIE804 (unnecessary-dict-kwargs) 1 × COM812 (missing-trailing-comma)- tests/test_shortcuts.py: 1 × PT006 (pytest-parametrize-names-wrong-type)- tests/url/test_git.py: 4 × PT006 (pytest-parametrize-names-wrong-type)- tests/url/test_hg.py: 3 × PT006 (pytest-parametrize-names-wrong-type) 1 × PT014 (pytest-duplicate-parametrize-test-cases)- tests/url/test_registry.py: 1 × FURB148 (unnecessary-enumerate)- tests/url/test_svn.py: 3 × PT006 (pytest-parametrize-names-wrong-type) 1 × PT014 (pytest-duplicate-parametrize-test-cases)
1 parent7720bbc commit6b51eda

File tree

24 files changed

+307
-354
lines changed

24 files changed

+307
-354
lines changed

‎conftest.py‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,3 @@ def setup(
4242
set_home:pathlib.Path,
4343
)->None:
4444
"""Configure test fixtures for pytest."""
45-
pass

‎docs/conf.py‎

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -209,15 +209,14 @@ def linkcode_resolve(domain: str, info: dict[str, str]) -> t.Union[None, str]:
209209
fn,
210210
linespec,
211211
)
212-
else:
213-
return"{}/blob/v{}/{}/{}/{}{}".format(
214-
about["__github__"],
215-
about["__version__"],
216-
"src",
217-
about["__package_name__"],
218-
fn,
219-
linespec,
220-
)
212+
return"{}/blob/v{}/{}/{}/{}{}".format(
213+
about["__github__"],
214+
about["__version__"],
215+
"src",
216+
about["__package_name__"],
217+
fn,
218+
linespec,
219+
)
221220

222221

223222
defremove_tabs_js(app:"Sphinx",exc:Exception)->None:

‎src/libvcs/__init__.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
from .sync.svnimportSvnSync
1010

1111
__all__= [
12+
"BaseSync",
13+
"CmdLoggingAdapter",
1214
"GitSync",
1315
"HgSync",
1416
"SvnSync",
15-
"BaseSync",
16-
"CmdLoggingAdapter",
1717
]
1818

1919
logger=logging.getLogger(__name__)

‎src/libvcs/_internal/query_list.py‎

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,8 @@ def keygetter(
8484
dct=dct[sub_field]
8585
elifhasattr(dct,sub_field):
8686
dct=getattr(dct,sub_field)
87-
exceptExceptionase:
87+
exceptException:
8888
traceback.print_stack()
89-
print(f"Above error was{e}")
9089
returnNone
9190
returndct
9291

@@ -304,12 +303,12 @@ def lookup_iregex(
304303

305304

306305
classPKRequiredException(Exception):
307-
def__init__(self,*args:object):
306+
def__init__(self,*args:object)->None:
308307
returnsuper().__init__("items() require a pk_key exists")
309308

310309

311310
classOpNotFound(ValueError):
312-
def__init__(self,op:str,*args:object):
311+
def__init__(self,op:str,*args:object)->None:
313312
returnsuper().__init__(f"{op} not in LOOKUP_NAME_MAP")
314313

315314

@@ -470,7 +469,7 @@ def __init__(self, items: t.Optional["Iterable[T]"] = None) -> None:
470469

471470
defitems(self)->list[tuple[str,T]]:
472471
ifself.pk_keyisNone:
473-
raisePKRequiredException()
472+
raisePKRequiredException
474473
return [(getattr(item,self.pk_key),item)foriteminself]
475474

476475
def__eq__(
@@ -490,9 +489,8 @@ def __eq__(
490489
forkeyina_keys:
491490
ifabs(a[key]-b[key])>1:
492491
returnFalse
493-
else:
494-
ifa!=b:
495-
returnFalse
492+
elifa!=b:
493+
returnFalse
496494

497495
returnTrue
498496
returnFalse
@@ -529,8 +527,7 @@ def filter_lookup(obj: t.Any) -> bool:
529527
defval_match(obj:t.Union[str,list[t.Any],T])->bool:
530528
ifisinstance(matcher,list):
531529
returnobjinmatcher
532-
else:
533-
returnbool(obj==matcher)
530+
returnbool(obj==matcher)
534531

535532
_filter=val_match
536533
else:
@@ -546,9 +543,9 @@ def get(
546543
)->t.Optional[T]:
547544
objs=self.filter(matcher=matcher,**kwargs)
548545
iflen(objs)>1:
549-
raiseMultipleObjectsReturned()
550-
eliflen(objs)==0:
546+
raiseMultipleObjectsReturned
547+
iflen(objs)==0:
551548
ifdefault==no_arg:
552-
raiseObjectDoesNotExist()
549+
raiseObjectDoesNotExist
553550
returndefault
554551
returnobjs[0]

‎src/libvcs/_internal/run.py‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,9 @@
1515
fromcollections.abcimportIterable,Mapping,MutableMapping,Sequence
1616
fromtypingimportIO,TYPE_CHECKING,Any,AnyStr,Callable,Optional,Protocol,Union
1717

18+
fromlibvcsimportexc
1819
fromlibvcs._internal.typesimportStrOrBytesPath
1920

20-
from ..importexc
21-
2221
logger=logging.getLogger(__name__)
2322

2423
console_encoding=sys.__stdout__.encoding

‎src/libvcs/_internal/shortcuts.py‎

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,17 @@
1919

2020

2121
classVCSNoMatchFoundForUrl(exc.LibVCSException):
22-
def__init__(self,url:str,*args:object):
22+
def__init__(self,url:str,*args:object)->None:
2323
returnsuper().__init__(f"No VCS found for url:{url}")
2424

2525

2626
classVCSMultipleMatchFoundForUrl(exc.LibVCSException):
27-
def__init__(self,url:str,*args:object):
27+
def__init__(self,url:str,*args:object)->None:
2828
returnsuper().__init__(f"Multiple VCS found for url:{url}")
2929

3030

3131
classVCSNotSupported(exc.LibVCSException):
32-
def__init__(self,url:str,vcs:str,*args:object):
32+
def__init__(self,url:str,vcs:str,*args:object)->None:
3333
returnsuper().__init__(f"VCS '{vcs}' not supported, based on URL:{url}")
3434

3535

@@ -110,7 +110,7 @@ def create_project(
110110
assertvcs_matches[0].vcsisnotNone
111111

112112
defis_vcs(val:t.Any)->"TypeGuard[VCSLiteral]":
113-
returnisinstance(val,str)andvalin["git","hg","svn"]
113+
returnisinstance(val,str)andvalin{"git","hg","svn"}
114114

115115
ifis_vcs(vcs_matches[0].vcs):
116116
vcs=vcs_matches[0].vcs
@@ -119,13 +119,18 @@ def is_vcs(val: t.Any) -> "TypeGuard[VCSLiteral]":
119119

120120
ifvcs=="git":
121121
returnGitSync(
122-
url=url,path=path,progress_callback=progress_callback,**kwargs
122+
url=url,
123+
path=path,
124+
progress_callback=progress_callback,
125+
**kwargs,
123126
)
124-
elifvcs=="hg":
127+
ifvcs=="hg":
125128
returnHgSync(url=url,path=path,progress_callback=progress_callback,**kwargs)
126-
elifvcs=="svn":
129+
ifvcs=="svn":
127130
returnSvnSync(
128-
url=url,path=path,progress_callback=progress_callback,**kwargs
131+
url=url,
132+
path=path,
133+
progress_callback=progress_callback,
134+
**kwargs,
129135
)
130-
else:
131-
raiseInvalidVCS("VCS %s is not a valid VCS"%vcs)
136+
raiseInvalidVCS("VCS %s is not a valid VCS"%vcs)

‎src/libvcs/_internal/subprocess.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767

6868

6969
classSubprocessCheckOutputError(Exception):
70-
def__init__(self,output:str,*args:object):
70+
def__init__(self,output:str,*args:object)->None:
7171
returnsuper().__init__(f"output is not str or bytes:{output}")
7272

7373

‎src/libvcs/cmd/git.py‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ def run(
206206
defstringify(v:Any)->str:
207207
ifisinstance(v,bool):
208208
return"true"ifTrueelse"false"
209-
elifnotisinstance(v,str):
209+
ifnotisinstance(v,str):
210210
returnstr(v)
211211
returnv
212212

@@ -398,7 +398,6 @@ def fetch(
398398
Union[bool,Literal["yes","on-demand"]]
399399
]=None,
400400
submodule_prefix:Optional[StrOrBytesPath]=None,
401-
#
402401
_all:Optional[bool]=None,
403402
force:Optional[bool]=None,
404403
keep:Optional[bool]=None,
@@ -1821,9 +1820,8 @@ def rev_parse(
18211820
ifparseoptisTrue:
18221821
ifargsisnotNone:
18231822
local_flags.extend(["--",args])
1824-
else:
1825-
ifargsisnotNone:
1826-
local_flags.append(args)
1823+
elifargsisnotNone:
1824+
local_flags.append(args)
18271825

18281826
returnself.run(
18291827
["rev-parse",*local_flags],

‎src/libvcs/cmd/svn.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
classSvnPropsetValueOrValuePathRequired(exc.LibVCSException,TypeError):
2626
"""Raised when required parameters are not passed."""
2727

28-
def__init__(self,*args:object):
28+
def__init__(self,*args:object)->None:
2929
returnsuper().__init__("Must enter a value or value_path")
3030

3131

@@ -783,7 +783,7 @@ def propset(
783783
elifisinstance(value_path,pathlib.Path):
784784
local_flags.extend(["--file",str(pathlib.Path(value_path).absolute())])
785785
else:
786-
raiseSvnPropsetValueOrValuePathRequired()
786+
raiseSvnPropsetValueOrValuePathRequired
787787

788788
ifpathisnotNone:
789789
ifisinstance(path, (str,pathlib.Path)):

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp