-
Notifications
You must be signed in to change notification settings - Fork 54
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
Align cyber #533
Align cyber #533
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #533 +/- ##
==========================================
- Coverage 73.69% 73.63% -0.07%
==========================================
Files 277 277
Lines 23058 23080 +22
==========================================
+ Hits 16992 16994 +2
- Misses 6066 6086 +20
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
dissect/target/helpers/cyber.py
Outdated
if char != " ": | ||
is_indent = False | ||
|
||
if ( | ||
("\n" in char or "\r\n" in char) | ||
or (not mask_space and char == " ") | ||
or (not mask_indent and is_indent) | ||
): | ||
if "\n" in char: | ||
is_indent = True | ||
sys.__stdout__.write(char) | ||
continue |
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.
Maybe an idea to add a custom generator function that already pre-checks char
for these values? Then you won't have the same code eveywhere
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.
Feel free to make a suggestion.
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.
Something like this maybe?
def some_good_name_for_a_generator(character_map: Iterator, mask_space, mask_indent) -> Iterator:
is_indent = True
for char, *remainder in character_map:
if char != " ":
is_indent = False
if (
("\n" in char or "\r\n" in char)
or (not mask_space and char == " ")
or (not mask_indent and is_indent)
):
if "\n" in char:
is_indent = True
yield True, char, *remainder
else:
yield False, char, *remainder
...
for send_white_space, char, has_ansi, *others in some_good_name_for_a_generator(...):
if send_white_space:
sys.__stdout__.write(char)
continue
dissect/target/helpers/cyber.py
Outdated
|
||
if ( | ||
("\n" in char or "\r\n" in char) | ||
or (not mask_space and char == " ") |
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.
It won't mask the indentation, as mask_space
will tell it to print the space instead.
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.
Works as intended for me.
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.
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.
Should be fixed now.
No description provided.