-
Notifications
You must be signed in to change notification settings - Fork 0
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
Generated bad codes by corrupting good codes #3
base: main
Are you sure you want to change the base?
Conversation
gen_err.py
Outdated
import random | ||
import re | ||
|
||
__action_pattern_map = { |
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.
any reason for naming this variable with double underscores at the start?
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.
No
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.
let's remove the underscores then.
gen_err.py
Outdated
'replaceElifwithElseif': ("elif", "elseif"), | ||
} | ||
|
||
_actions = list(__action_pattern_map.keys()) |
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.
any reason to start this variable with underscore
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.
No
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.
let's remove it from start then
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.
Could you please test this python file to make sure the file work as expected even after the changes (like variable name change)?
gen_err.py
Outdated
actions_kw = list(action_pattern_map_kw.keys()) | ||
|
||
def corrupt_syntax(line): | ||
|
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.
Is this a good practice to leave empty line at the start of function?
Didn't just mean to follow python code style guide for if else, but the whole code.
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.
Empty lines were just for good readability. Will update according to style guide.
Tested the code before committing changes. Code is running as per requirement.
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.
Empty lines were just for good readability.
No worries, the perspective of good readability differs from person to person.
See the usage of blank lines here for reference: https://peps.python.org/pep-0008/#blank-lines
gen_err.py
Outdated
return line | ||
|
||
def corrupt_kw_typo(line): | ||
|
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.
why this empty line?
could you please squash the commits into one. |
1724b7b
to
3769e0e
Compare
Do you mean along with the first commit? All the commits into 1 i meant. |
Yes! |
Merging this for now. For example: Now, in master branch. So, to keep main branch clean with relevant commits. we squash commits which aren't atomic and independent on their own. |
Okay |
Removed underscores and extra lines. Followed python code convention. Generated bad codes by corrupting good codes
3769e0e
to
506724e
Compare
Please review the error generation code.