-
Notifications
You must be signed in to change notification settings - Fork 12
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
Use ruff's formatter #177
Use ruff's formatter #177
Changes from all commits
811078f
6990c36
00678cb
7451642
fec15d1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
|
||
|
||
class AlignTo(Construct): | ||
def __init__(self, modulus, pattern = b"\x00"): | ||
def __init__(self, modulus, pattern=b"\x00"): | ||
super().__init__() | ||
self.modulus = modulus | ||
self.pattern = pattern | ||
|
@@ -29,7 +29,7 @@ def _build(self, obj, stream, context, path): | |
|
||
|
||
class AlignedPrefixed(Subconstruct): | ||
def __init__(self, length_field, subcon, modulus, length_size, pad_byte=b"\xFF"): | ||
def __init__(self, length_field, subcon, modulus, length_size, pad_byte=b"\xff"): | ||
super().__init__(subcon) | ||
self.length_field = length_field | ||
self.modulus = modulus | ||
|
@@ -112,13 +112,14 @@ def PrefixedAllowZeroLen(lengthfield, subcon, includelengthfield=False): | |
return FocusedSeq( | ||
"prefixed", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think that we should choose either the / format or the = format and standardize it across the repo. I'm partial to the = format because it feels more readable to me. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is probably more of a "we should pick one and manually update code to comply/enforce it on new PRs" than something that ruff can handle There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
if we must pick one, it needs to be the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm fine having both. |
||
"len" / Peek(lengthfield), | ||
"prefixed" / Prefixed( | ||
"prefixed" | ||
/ Prefixed( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. . |
||
lengthfield, | ||
IfThenElse( | ||
construct.this._parsing, | ||
If(construct.this.len > 0, subcon), | ||
If(construct.this.prefixed, subcon), | ||
), | ||
includelengthfield | ||
) | ||
includelengthfield, | ||
), | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personal preference but hex escapes look better with A-F capitalized, especially \x.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm indifferent, but I don't believe it's configurable