ruff: enable RUF ruleset
This commit is contained in:
parent
dc0726c347
commit
c3da26abcb
15 changed files with 31 additions and 27 deletions
|
@ -392,7 +392,7 @@ def module_install(*, user: bool, module: Sequence[str], parallel: bool=False, b
|
|||
# I think it only helps for pypi artifacts (not git!),
|
||||
# and only if they weren't cached
|
||||
for r in requirements:
|
||||
cmds.append(pre_cmd + [r])
|
||||
cmds.append([*pre_cmd, r])
|
||||
else:
|
||||
if parallel:
|
||||
warning('parallel install is not supported on this platform, installing sequentially...')
|
||||
|
|
|
@ -153,7 +153,7 @@ def test_sort_res_by() -> None:
|
|||
Exc('last'),
|
||||
]
|
||||
|
||||
results2 = sort_res_by(ress + [0], lambda x: int(x))
|
||||
results2 = sort_res_by([*ress, 0], lambda x: int(x))
|
||||
assert results2 == [Exc('last'), 0] + results[:-1]
|
||||
|
||||
assert sort_res_by(['caba', 'a', 'aba', 'daba'], key=lambda x: len(x)) == ['a', 'aba', 'caba', 'daba']
|
||||
|
@ -166,7 +166,7 @@ def test_sort_res_by() -> None:
|
|||
def set_error_datetime(e: Exception, dt: Optional[datetime]) -> None:
|
||||
if dt is None:
|
||||
return
|
||||
e.args = e.args + (dt,)
|
||||
e.args = (*e.args, dt)
|
||||
# todo not sure if should return new exception?
|
||||
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ def import_source(
|
|||
warnings.warn(f"""If you don't want to use this module, to hide this message, add '{module_name}' to your core config disabled_modules in your config, like:
|
||||
|
||||
class core:
|
||||
disabled_modules = [{repr(module_name)}]
|
||||
disabled_modules = [{module_name!r}]
|
||||
""")
|
||||
# try to check if this is a config error or based on dependencies not being installed
|
||||
if isinstance(err, (ImportError, AttributeError)):
|
||||
|
|
|
@ -67,21 +67,21 @@ def match_structure(
|
|||
|
||||
export_dir
|
||||
├── exp_2020
|
||||
│ ├── channel_data
|
||||
│ │ ├── data1
|
||||
│ │ └── data2
|
||||
│ ├── index.json
|
||||
│ ├── messages
|
||||
│ │ └── messages.csv
|
||||
│ └── profile
|
||||
│ └── settings.json
|
||||
│ ├── channel_data
|
||||
│ │ ├── data1
|
||||
│ │ └── data2
|
||||
│ ├── index.json
|
||||
│ ├── messages
|
||||
│ │ └── messages.csv
|
||||
│ └── profile
|
||||
│ └── settings.json
|
||||
└── exp_2021
|
||||
├── channel_data
|
||||
│ ├── data1
|
||||
│ └── data2
|
||||
│ ├── data1
|
||||
│ └── data2
|
||||
├── index.json
|
||||
├── messages
|
||||
│ └── messages.csv
|
||||
│ └── messages.csv
|
||||
└── profile
|
||||
└── settings.json
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ def user_forced() -> Sequence[str]:
|
|||
def _abbr_to_timezone_map() -> Dict[str, pytz.BaseTzInfo]:
|
||||
# also force UTC to always correspond to utc
|
||||
# this makes more sense than Zulu it ends up by default
|
||||
timezones = pytz.all_timezones + ['UTC'] + list(user_forced())
|
||||
timezones = [*pytz.all_timezones, 'UTC', *user_forced()]
|
||||
|
||||
res: Dict[str, pytz.BaseTzInfo] = {}
|
||||
for tzname in timezones:
|
||||
|
|
|
@ -74,7 +74,7 @@ def _discover_path_importables(pkg_pth: Path, pkg_name: str) -> Iterable[HPIModu
|
|||
continue
|
||||
|
||||
rel_pt = pkg_dir_path.relative_to(pkg_pth)
|
||||
pkg_pref = '.'.join((pkg_name, ) + rel_pt.parts)
|
||||
pkg_pref = '.'.join((pkg_name, *rel_pt.parts))
|
||||
|
||||
yield from _walk_packages(
|
||||
(str(pkg_dir_path), ), prefix=f'{pkg_pref}.',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue