Skip to content

Commit

Permalink
Replace string concatenation with fstring (#8760)
Browse files Browse the repository at this point in the history
  • Loading branch information
em1le committed Jan 7, 2024
1 parent 232acf9 commit e1d3df4
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions celery/utils/term.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def __init__(self, *s, **kwargs):
}

def _add(self, a, b):
return str(a) + str(b)
return f"{a}{b}"

def _fold_no_color(self, a, b):
try:
Expand All @@ -68,7 +68,7 @@ def _fold_no_color(self, a, b):
except AttributeError:
B = str(b)

return ''.join((str(A), str(B)))
return f"{A}{B}"

def no_color(self):
if self.s:
Expand All @@ -79,13 +79,13 @@ def embed(self):
prefix = ''
if self.enabled:
prefix = self.op
return ''.join((str(prefix), str(reduce(self._add, self.s))))
return f"{prefix}{reduce(self._add, self.s)}"

def __str__(self):
suffix = ''
if self.enabled:
suffix = RESET_SEQ
return str(''.join((self.embed(), str(suffix))))
return f"{self.embed()}{suffix}"

def node(self, s, op):
return self.__class__(enabled=self.enabled, op=op, *s)
Expand Down Expand Up @@ -157,7 +157,7 @@ def reset(self, *s):
return self.node(s or [''], RESET_SEQ)

def __add__(self, other):
return str(self) + str(other)
return f"{self}{other}"


def supports_images():
Expand Down

0 comments on commit e1d3df4

Please sign in to comment.