Skip to content

Commit

Permalink
Linting
Browse files Browse the repository at this point in the history
  • Loading branch information
OpenBagTwo committed May 4, 2024
1 parent c6b4534 commit 4cdfe3e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion enderchest/craft.py
Original file line number Diff line number Diff line change
Expand Up @@ -920,7 +920,7 @@ def _prompt_for_instance_numbers(

prior_criteria: list[tuple[str, tuple[str, ...]]] = []
prior_instance_selections: list[str] = []
for i, (condition, values) in enumerate(shulker_box.match_criteria):
for condition, values in shulker_box.match_criteria:
if condition == "instances":
prior_instance_selections.extend(values)
else:
Expand Down
2 changes: 1 addition & 1 deletion enderchest/enderchest.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ def from_cfg(cls, config_file: Path) -> "EnderChest":
)
ender_chest.do_not_sync.insert(0, chest_cfg_exclusion)
requires_rewrite = True
for setting in folder_defaults:
for setting in folder_defaults.keys():
if folder_defaults[setting] is None:
folder_defaults[setting] = dict(_DEFAULTS)[setting] # type: ignore
# requires_rewrite = True # though I'm considering it
Expand Down
5 changes: 2 additions & 3 deletions enderchest/test/test_break.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def test_break_asks_you_if_youre_really_sure(

assert errorish_log[-2].levelno == logging.WARNING
assert errorish_log[-2].message.startswith("Are you sure")
assert " - bee\n - Drowned" in errorish_log[-2].message
assert errorish_log[-2].args == (" - bee\n - Drowned",)

assert len(errorish_log) == 2

Expand All @@ -142,7 +142,7 @@ def test_break_skips_invalid_instances(
]
assert len(errorish_log) == 3
assert errorish_log[-3].levelno == logging.WARNING
assert "drowned" in errorish_log[-3].message
assert errorish_log[-3].args == ("drowned",)
assert errorish_log[-3].message.lower().endswith("skipping.")

def test_break_deregisters_instances_afterwards(
Expand All @@ -152,7 +152,6 @@ def test_break_deregisters_instances_afterwards(
monkeypatch.setattr("builtins.input", script_reader)

def mock_break(*args, **kwargs):
print("Hi mom")
pass

monkeypatch.setattr(uninstall, "_break", mock_break)
Expand Down
12 changes: 6 additions & 6 deletions enderchest/uninstall.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,20 +73,20 @@ def break_instances(minecraft_root: Path, instance_names: Iterable[str]) -> None
instances.append(instance_lookup[name])
except KeyError:
BREAK_LOGGER.warning(
f'No instance named "{name}" is registered to this EnderChest.'
"\nSkipping."
f'No instance named "%s" is registered to this EnderChest.'
"\nSkipping.",
name,
)
if len(instances) == 0:
BREAK_LOGGER.error("No valid instances specified.\nAborting.")
return

BREAK_LOGGER.warning(
"Are you sure you want to remove the following instances from your EnderChest?"
+ "\n"
+ "\n".join((f" - {instance.name}" for instance in instances))
+ "\nDoing so will replace ALL the symlinks in each of the above instances"
"\n%s\nDoing so will replace ALL the symlinks in each of the above instances"
"\nwith copies of their EnderChest-linked targets."
"\n\nTHIS CANNOT EASILY BE UNDONE!!"
"\n\nTHIS CANNOT EASILY BE UNDONE!!",
"\n".join((f" - {instance.name}" for instance in instances)),
)
if not confirm(default=False):
BREAK_LOGGER.error("Aborting.")
Expand Down

0 comments on commit 4cdfe3e

Please sign in to comment.