-
Notifications
You must be signed in to change notification settings - Fork 181
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
Use fstrings #1245
Use fstrings #1245
Conversation
@@ -2295,7 +2295,7 @@ def print_profiles(self, w=0, cutoff=0, **print3options): | |||
linesep, w, len(t), _plural(len(t)), s, self._incl, **print3options) | |||
r = len(t) | |||
for v, k in sorted(t, reverse=True): | |||
s = 'object%(plural)s: %(total)s, %(avg)s, %(high)s: %(obj)s%(lengstr)s' % v.format(self._clip_, self._total) | |||
s = f"object{v.format(self._clip_, self._total)['plural']}: {v.format(self._clip_, self._total)['total']}, {v.format(self._clip_, self._total)['avg']}, {v.format(self._clip_, self._total)['high']}: {v.format(self._clip_, self._total)['obj']}{v.format(self._clip_, self._total)['lengstr']}" |
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.
Either revert this or reformat refactor it: the newer code is worse than the old
@@ -2889,7 +2889,7 @@ def refs(obj, **opts): | |||
_printf('%s%d type definitions: %s and %s, kind ... %s', linesep, | |||
n, 'basic-', 'itemsize (leng)', '-type[def]s') | |||
for k, v in sorted((_prepr(k), v) for k, v in _items(_typedefs)): | |||
s = '%(base)s and %(item)s%(leng)s, %(kind)s%(code)s' % v.format() | |||
s = f"{v.format()['base']} and {v.format()['item']}{v.format()['leng']}, {v.format()['kind']}{v.format()['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.
Either revert or refactor, the new code is worse than the old.
@@ -138,7 +138,7 @@ def test_get_result_hash_from_prefix(tmpdir): | |||
shutil.copyfile(machine_json, join(str(machine_dir), 'machine.json')) | |||
|
|||
for f in ['e5b6cdbc', 'e5bfoo12']: | |||
open(join(str(machine_dir), '{0}-py2.7-Cython-numpy1.8.json'.format(f)), 'a').close() | |||
open(join(str(machine_dir), f'{f}-py2.7-Cython-numpy1.8.json'), 'a').close() |
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.
Nit: it is a bit weird to be using these old versions of python (line 39?) and numpy (dunno where that comes from). If not too much trouble could you update them? If not no big deal.
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.
Thanks. Just a few small niggles.
Superseded by #1258 |
No description provided.