Maintenance: apply refurb fixes and tighten ruff#671
Merged
Conversation
penguinolog
commented
Nov 16, 2023
| if key == "backspace": | ||
| raise ColumnDeleteEvent(self.letter, from_parent=True) | ||
| if key in list("0123456789"): | ||
| if key in string.digits: |
Collaborator
Author
There was a problem hiding this comment.
we can iterate over string directly without cast
we can use stdlib human-readable constant instead of copy-paste
penguinolog
commented
Nov 16, 2023
| "+": (lambda a, b: a + b), | ||
| "-": (lambda a, b: a - b), | ||
| "*": (lambda a, b: a * b), | ||
| "+": operator.add, |
Collaborator
Author
There was a problem hiding this comment.
we have stdlib fuctions (mostly used by data engineers)
Pull Request Test Coverage Report for Build 6888615993
💛 - Coveralls |
penguinolog
commented
Nov 16, 2023
| """ | ||
| out = [] | ||
| for match in re.finditer(ATTR_RE, chart): | ||
| for match in ATTR_RE.finditer(chart): |
Collaborator
Author
There was a problem hiding this comment.
compiled regex do not require re-compilation
penguinolog
commented
Nov 16, 2023
| return None | ||
|
|
||
| c256 = _parse_color_256("#" + "".join(format(int(x, 16) // 16, "x") for x in [desc[1:3], desc[3:5], desc[5:7]])) | ||
| c256 = _parse_color_256("#" + "".join(format(int(x, 16) // 16, "x") for x in (desc[1:3], desc[3:5], desc[5:7]))) |
Collaborator
Author
There was a problem hiding this comment.
recommended to use temporary tuples instead of temporary lists
penguinolog
commented
Nov 16, 2023
| for digit, key in zip("235678", ("insert", "delete", "page up", "page down", "home", "end")) | ||
| ), | ||
| *((f"O{chr(ord('p') + n)}", str(n)) for n in range(10)), | ||
| *((f"O{ord('p') + n:c}", str(n)) for n in range(10)), |
Collaborator
Author
There was a problem hiding this comment.
:c command execute chr internally during string formatting
penguinolog
commented
Nov 16, 2023
|
|
||
| def get_depth(self): | ||
| if self._depth is None and self._parent is None: | ||
| if self._depth is self._parent is None: |
Collaborator
Author
There was a problem hiding this comment.
... is ... is ... is recommended (and should be faster than or)
wardi
approved these changes
Nov 16, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Checklist
masterorpython-dual-supportbranchtoxsuccessfully in local environment