Skip to content

Changes occurences of str.format to f-strings #4118

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

Merged
merged 15 commits into from
Feb 23, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
f-string update red_black_tree.py
  • Loading branch information
CarsonHam committed Jan 13, 2021
commit 8a4374cf9d0dbf97d054e17ce315b0c9ab90d667
8 changes: 5 additions & 3 deletions data_structures/binary_tree/red_black_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -475,11 +475,13 @@ def __repr__(self) -> str:
from pprint import pformat

if self.left is None and self.right is None:
return "'{} {}'".format(self.label, (self.color and "red") or "blk")
return f"'{self.label} {(self.color and 'red') or 'blk'}'"
return pformat(
{
"%s %s"
% (self.label, (self.color and "red") or "blk"): (self.left, self.right)
f"{self.label} {(self.color and 'red') or 'blk'}": (
self.left,
self.right,
)
},
indent=1,
)
Expand Down