Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pre-commit.ci] pre-commit autoupdate #128

Merged
merged 4 commits into from
Apr 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.2.2
rev: v0.3.5
hooks:
- id: ruff
args: [ --fix, --exit-non-zero-on-fix ]
7 changes: 3 additions & 4 deletions src/mercury_engine_data_structures/common_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,10 +276,9 @@ def _build(self, obj: construct.Container, stream, context, path):
self.value_type._build(value, stream, context, field_path)

def _emitparse(self, code):
return "Container(({}, {}) for i in range({}))".format(
self.key_type._compileparse(code),
self.value_type._compileparse(code),
self.count_type._compileparse(code),
return (
f"Container(({self.key_type._compileparse(code)}, {self.value_type._compileparse(code)}) "
f"for i in range({self.count_type._compileparse(code)}))"
)

def _emitbuild(self, code):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,10 @@ def _insert_cond(self, code: construct.CodeGen):
return f"linkedinstances[{id(self.condfunc)}](this)"

def _emitparse(self, code):
return "(({}) if ({}) else ({}))".format(self.thensubcon._compileparse(code),
self._insert_cond(code),
self.elsesubcon._compileparse(code), )
return (
f"(({self.thensubcon._compileparse(code)}) if ({self._insert_cond(code)}) "
f"else ({self.elsesubcon._compileparse(code)}))"
)

def _emitbuild(self, code):
return (f"(({self.thensubcon._compilebuild(code)}) if ("
Expand Down
7 changes: 3 additions & 4 deletions tools/create_class_definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,10 +197,9 @@ def export_code(self):

for type_name in sorted(self._types_with_pointer):
if type_name != "base::reflection::CTypedValue":
code += '{}.add_option("{}", {})\n'.format(
self.pointer_to_type(type_name),
type_name,
self.ensure_exported_type(type_name),
code += (
f'{self.pointer_to_type(type_name)}.add_option("{type_name}", '
f'{self.ensure_exported_type(type_name)})\n'
)
for child in sorted(self.children_for(type_name)):
code += f'{self.pointer_to_type(type_name)}.add_option("{child}", {self.ensure_exported_type(child)})\n'
Expand Down
8 changes: 4 additions & 4 deletions tools/ghidra_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -661,10 +661,10 @@ def _merge_split_types(final_results: dict[str, typing.Any]):

both_hash = key in hashes and similar[0] in hashes
if both_hash:
print("{} (Hash: {}) is similar to {} (Hash: {})".format(
key, key in dread_data.all_name_to_property_id(),
similar[0], similar[0] in dread_data.all_name_to_property_id(),
))
print(
f"{key} (Hash: {key in dread_data.all_name_to_property_id()}) is similar to "
f"{similar[0]} (Hash: {similar[0] in dread_data.all_name_to_property_id()})"
)
elif key in hashes:
wrong_to_correct[similar[0]] = key
elif similar[0] in hashes:
Expand Down
Loading