update ruff to v0.0.254 (#9110)

This commit is contained in:
skshetry
2023-03-04 17:26:59 +05:45
committed by GitHub
parent e4d514c990
commit 4c5d052d8c
8 changed files with 23 additions and 31 deletions
+1 -1
View File
@@ -43,7 +43,7 @@ repos:
hooks:
- id: isort
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: 'v0.0.247'
rev: 'v0.0.254'
hooks:
- id: ruff
- repo: https://github.com/codespell-project/codespell
+4 -5
View File
@@ -409,11 +409,10 @@ class Lockfile(FileMixin):
if version == LOCKFILE_VERSION.V1:
logger.info("Migrating lock file '%s' from v1 to v2", self.relpath)
migrate_lock_v1_to_v2(data, self.latest_version_info)
else:
if not data:
data.update(self.latest_version_info)
# order is important, meta should always be at the top
logger.info("Generating lock file '%s'", self.relpath)
elif not data:
data.update(self.latest_version_info)
# order is important, meta should always be at the top
logger.info("Generating lock file '%s'", self.relpath)
data["stages"] = data.get("stages", {})
modified = data["stages"].get(stage.name, {}) != stage_data.get(
+2 -3
View File
@@ -102,9 +102,8 @@ def _(obj: dict): # noqa: C901
if isinstance(v, bool):
if v:
result += f"--{k} "
else:
if config.get("bool", "store_true") == "boolean_optional":
result += f"--no-{k} "
elif config.get("bool", "store_true") == "boolean_optional":
result += f"--no-{k} "
elif isinstance(v, str):
result += f"--{k} {escape_str(v)} "
+5 -6
View File
@@ -218,13 +218,12 @@ def init(
provided=overrides,
stream=stream,
)
elif "live" in overrides:
# suppress `metrics`/`plots` if live is selected.
defaults.pop("metrics", None)
defaults.pop("plots", None)
else:
if "live" in overrides:
# suppress `metrics`/`plots` if live is selected.
defaults.pop("metrics", None)
defaults.pop("plots", None)
else:
defaults.pop("live", None) # suppress live otherwise
defaults.pop("live", None) # suppress live otherwise
context: Dict[str, str] = {**defaults, **overrides}
assert "cmd" in context
+3 -4
View File
@@ -412,10 +412,9 @@ def move_properties_to_head(result: Dict[str, Dict[str, Dict[str, Any]]]):
if rev_result["status"] == ExpStatus.Running.name:
head["status"] = ExpStatus.Running.name
rev_result["status"] = ExpStatus.Success.name
else:
if rev_result["checkpoint_tip"] == rev:
head = rev_result
checkpoint = True
elif rev_result["checkpoint_tip"] == rev:
head = rev_result
checkpoint = True
def show( # noqa: PLR0913
+4 -5
View File
@@ -154,12 +154,11 @@ def push_refspec(
for ref in scm.iter_refs(base=src):
refname = ref.split("/")[-1]
refspecs.append(f"{ref}:{dest}{refname}")
elif dest.endswith("/"):
refname = src.split("/")[-1]
refspecs.append(f"{src}:{dest}/{refname}")
else:
if dest.endswith("/"):
refname = src.split("/")[-1]
refspecs.append(f"{src}:{dest}/{refname}")
else:
refspecs.append(f"{src}:{dest}")
refspecs.append(f"{src}:{dest}")
try:
results = scm.push_refspecs(
+3 -6
View File
@@ -440,12 +440,9 @@ def _resolve_definitions(
result,
unpacked,
)
else:
if _matches(targets, config_path, plot_id):
adjusted_props = _adjust_sources(fs, plot_props, config_dir)
dpath.util.merge(
result, {"data": {plot_id: {**adjusted_props, **props}}}
)
elif _matches(targets, config_path, plot_id):
adjusted_props = _adjust_sources(fs, plot_props, config_dir)
dpath.util.merge(result, {"data": {plot_id: {**adjusted_props, **props}}})
return result
+1 -1
View File
@@ -230,7 +230,7 @@ ignored-argument-names = "_.*|args|kwargs"
[tool.ruff]
# external flake8 codes that should be preserved
external = ["B301", "C901", "E302", "W601"]
ignore = ["N818", "S101", "PT004", "PT007", "PT019", "SIM105", "SIM108", "SIM110", "SIM111", "SIM117", "TRY003", "TRY200", "TRY300", "TRY301", "PLR2004", "RUF005"]
ignore = ["N818", "S101", "PT004", "PT007", "PT019", "SIM105", "SIM108", "SIM110", "SIM117", "TRY003", "TRY200", "TRY300", "TRY301", "PLR2004", "PLW2901", "RUF005"]
select = ["F", "E", "W", "C90", "N", "UP", "YTT", "S", "BLE", "B", "A", "C4", "T10", "ISC", "ICN", "G", "INP", "PIE", "T20", "PT", "Q", "RET501", "RET504", "SIM", "TID", "TCH", "ARG", "PGH", "PLC", "PLE", "PLR", "PLW", "TRY", "RUF"]
show-source = true
target-version = "py38"