Skip to content

Commit aeca810

Browse files
committed
chore: ruff format all files
1 parent 8a1fa72 commit aeca810

18 files changed

+8388
-8339
lines changed

UnityPy/classes/generated.py

Lines changed: 8232 additions & 8232 deletions
Large diffs are not rendered by default.

UnityPy/enums/ClassIDType.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# https://docs.unity3d.com/Manual/ClassIDReference.html
1+
# https://docs.unity3d.com/Manual/ClassIDReference.html
22
from .ExtendableEnum import ExtendableEnum
33

44

UnityPy/enums/CommonString.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
CommonString = {
1+
CommonString = {
22
0: "AABB",
33
5: "AnimationClip",
44
19: "AnimationCurve",

UnityPy/environment.py

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -71,19 +71,23 @@ def load_files(self, files: List[str]):
7171

7272
def load_folder(self, path: str):
7373
"""Loads all files in the given path and its subdirs into the Environment."""
74-
self.load_files([
75-
self.fs.sep.join([root, f])
76-
for root, dirs, files in self.fs.walk(path)
77-
for f in files
78-
])
74+
self.load_files(
75+
[
76+
self.fs.sep.join([root, f])
77+
for root, dirs, files in self.fs.walk(path)
78+
for f in files
79+
]
80+
)
7981

8082
def load(self, files: List[str]):
8183
"""Loads all files into the Environment."""
82-
self.files.update({
83-
ntpath.basename(f): self.load_file(self.fs.open(f, "rb"), self, f)
84-
for f in files
85-
if self.fs.exists(f)
86-
})
84+
self.files.update(
85+
{
86+
ntpath.basename(f): self.load_file(self.fs.open(f, "rb"), self, f)
87+
for f in files
88+
if self.fs.exists(f)
89+
}
90+
)
8791

8892
def _load_split_file(self, basename: str) -> bytes:
8993
file: list[str] = []

UnityPy/export/ShaderConverter.py

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -343,21 +343,25 @@ def ConvertSerializedShaderRTBlendState(rbBlend):
343343

344344
def ConvertSerializedTagMap(m_Tags: SerializedTagMap, intent: int) -> str:
345345
if m_Tags.tags:
346-
return "".join([
347-
" " * intent,
348-
"Tags { ",
349-
*[f'"{key}" = "{value}" ' for key, value in m_Tags.tags],
350-
"}\n",
351-
])
346+
return "".join(
347+
[
348+
" " * intent,
349+
"Tags { ",
350+
*[f'"{key}" = "{value}" ' for key, value in m_Tags.tags],
351+
"}\n",
352+
]
353+
)
352354
return ""
353355

354356

355357
def ConvertSerializedProperties(m_PropInfo: SerializedProperties) -> str:
356-
return "\n".join([
357-
"Properties {\n",
358-
*[ConvertSerializedProperty(m_Prop) for m_Prop in m_PropInfo.m_Props],
359-
"}\n",
360-
])
358+
return "\n".join(
359+
[
360+
"Properties {\n",
361+
*[ConvertSerializedProperty(m_Prop) for m_Prop in m_PropInfo.m_Props],
362+
"}\n",
363+
]
364+
)
361365

362366

363367
def ConvertSerializedProperty(m_Prop: SerializedProperty) -> str:

UnityPy/export/Texture2DConverter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from __future__ import annotations
1+
from __future__ import annotations
22

33
import struct
44
from copy import copy

UnityPy/files/SerializedFile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from __future__ import annotations
1+
from __future__ import annotations
22

33
import re
44
from ntpath import basename

UnityPy/files/WebFile.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Optional
1+
from typing import Optional
22

33
from ..helpers import CompressionHelper
44
from ..streams import EndianBinaryReader, EndianBinaryWriter
@@ -79,14 +79,16 @@ def save(
7979
writer.write_string_to_null(signature)
8080

8181
# data offset
82-
offset = sum([
83-
writer.Position, # signature
84-
sum(
85-
len(path.encode("utf-8")) for path in files.keys()
86-
), # path of each file
87-
4 * 3 * len(files), # 3 ints per file
88-
4, # offset int
89-
])
82+
offset = sum(
83+
[
84+
writer.Position, # signature
85+
sum(
86+
len(path.encode("utf-8")) for path in files.keys()
87+
), # path of each file
88+
4 * 3 * len(files), # 3 ints per file
89+
4, # offset int
90+
]
91+
)
9092

9193
writer.write_int(offset)
9294

UnityPy/helpers/ImportHelper.py

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -113,16 +113,18 @@ def check_file_type(
113113
reader.endian = old_endian
114114
reader.Position = 0
115115
# check info
116-
if any((
117-
version < 0,
118-
version > 100,
119-
*[
120-
x < 0 or x > reader.Length
121-
for x in [file_size, metadata_size, version, data_offset]
122-
],
123-
file_size < metadata_size,
124-
file_size < data_offset,
125-
)):
116+
if any(
117+
(
118+
version < 0,
119+
version > 100,
120+
*[
121+
x < 0 or x > reader.Length
122+
for x in [file_size, metadata_size, version, data_offset]
123+
],
124+
file_size < metadata_size,
125+
file_size < data_offset,
126+
)
127+
):
126128
return FileType.ResourceFile, reader
127129
else:
128130
return FileType.AssetsFile, reader
@@ -137,13 +139,15 @@ def parse_file(
137139
) -> Union[files.File, EndianBinaryReader]:
138140
if typ is None:
139141
typ, _ = check_file_type(reader)
140-
if typ == FileType.AssetsFile and not name.endswith((
141-
".resS",
142-
".resource",
143-
".config",
144-
".xml",
145-
".dat",
146-
)):
142+
if typ == FileType.AssetsFile and not name.endswith(
143+
(
144+
".resS",
145+
".resource",
146+
".config",
147+
".xml",
148+
".dat",
149+
)
150+
):
147151
f = files.SerializedFile(reader, parent, name=name, is_dependency=is_dependency)
148152
elif typ == FileType.BundleFile:
149153
f = files.BundleFile(reader, parent, name=name, is_dependency=is_dependency)

UnityPy/helpers/Tpk.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -367,13 +367,15 @@ def __eq__(self, other: TpkUnityClass) -> bool:
367367
return self.to_dict() == other.to_dict()
368368

369369
def __hash__(self) -> int:
370-
return hash((
371-
self.Name,
372-
self.Base,
373-
self.Flags,
374-
self.EditorRootNode,
375-
self.ReleaseRootNode,
376-
))
370+
return hash(
371+
(
372+
self.Name,
373+
self.Base,
374+
self.Flags,
375+
self.EditorRootNode,
376+
self.ReleaseRootNode,
377+
)
378+
)
377379

378380

379381
class TpkClassInformation:

0 commit comments

Comments
 (0)