Skip to content

Commit 617abe2

Browse files
committed
style: refactor project
1 parent cca18d2 commit 617abe2

6 files changed

Lines changed: 8 additions & 8 deletions

File tree

libdestruct/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
__all__ = [
2323
"array",
2424
"array_of",
25-
"offset",
2625
"c_int",
2726
"c_long",
2827
"c_str",
@@ -32,8 +31,9 @@
3231
"enum_of",
3332
"inflate",
3433
"inflater",
35-
"struct",
34+
"offset",
3635
"ptr",
3736
"ptr_to",
3837
"ptr_to_self",
38+
"struct",
3939
]

libdestruct/c/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from libdestruct.c.c_integer_types import c_char, c_int, c_long, c_short, c_uchar, c_uint, c_ulong, c_ushort
88
from libdestruct.c.c_str import c_str
99

10-
__all__ = ["c_char", "c_uchar", "c_short", "c_ushort", "c_int", "c_uint", "c_long", "c_ulong", "c_str"]
10+
__all__ = ["c_char", "c_int", "c_long", "c_short", "c_str", "c_uchar", "c_uint", "c_ulong", "c_ushort"]
1111

1212
import libdestruct.c.base_type_inflater
1313
import libdestruct.c.ctypes_generic_field # noqa: F401

libdestruct/c/c_str.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def count(self: c_str) -> int:
2626

2727
def get(self: c_str, index: int = -1) -> bytes:
2828
"""Return the character at the given index."""
29-
if index != -1 and index < 0 or index >= self.count():
29+
if (index != -1 and index < 0) or index >= self.count():
3030
raise IndexError("String index out of range.")
3131

3232
if index == -1:
@@ -40,7 +40,7 @@ def to_bytes(self: c_str) -> bytes:
4040

4141
def _set(self: c_str, value: bytes, index: int = -1) -> None:
4242
"""Set the character at the given index to the given value."""
43-
if index != -1 and index < 0 or index >= self.count():
43+
if (index != -1 and index < 0) or index >= self.count():
4444
raise IndexError("String index out of range.")
4545

4646
if index == -1:

libdestruct/common/struct/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from libdestruct.common.struct.struct import struct
99
from libdestruct.common.struct.struct_impl import struct_impl
1010

11-
__all__ = ["struct", "struct_impl", "ptr_to", "ptr_to_self"]
11+
__all__ = ["ptr_to", "ptr_to_self", "struct", "struct_impl"]
1212

1313
import libdestruct.common.ptr.ptr_field_inflater
1414
import libdestruct.common.struct.struct_inflater # noqa: F401

libdestruct/common/struct/struct_impl.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ def to_str(self: struct_impl, indent: int = 0) -> str:
175175
)
176176
return f"""{self.name} {{
177177
{members}
178-
{' ' * indent}}}"""
178+
{" " * indent}}}"""
179179

180180
def __repr__(self: struct_impl) -> str:
181181
"""Return a string representation of the struct."""

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ exclude = ["test/"]
4444

4545
[tool.ruff.lint]
4646
select = ["ALL"]
47-
ignore = ["D100", "D104", "EM", "FBT", "G", "TD", "TRY002", "TRY003", "RET505", "SLF001", "S603", "S606", "N801"]
47+
ignore = ["D100", "D104", "EM", "FBT", "G", "TD", "TRY002", "TRY003", "RET505", "SLF001", "S603", "S606", "N801", "COM812"]
4848

4949
[tool.ruff.lint.pydocstyle]
5050
convention = "google"

0 commit comments

Comments
 (0)