Skip to content

Commit

Permalink
- run pyupgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
dataflake committed May 28, 2024
1 parent b28da28 commit 7b9921a
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/App/Undo.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def manage_undo_transactions(self, transaction_info=(), REQUEST=None):
raise

ts.abort()
error = '{}: {}'.format(exc.__class__.__name__, str(exc))
error = f'{exc.__class__.__name__}: {str(exc)}'
return self.manage_UndoForm(self, REQUEST,
manage_tabs_message=error,
manage_tabs_type='danger')
Expand Down
2 changes: 1 addition & 1 deletion src/App/ZODBConnectionDebugger.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def get_info(connection):
# output UTC time with the standard Z time zone indicator
open_since = "{}".format(
time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime(opened)))
open_for = "{:.2f}s".format(now - opened)
open_for = f"{now - opened:.2f}s"
else:
open_since = '(closed)'
open_for = ''
Expand Down
4 changes: 2 additions & 2 deletions src/OFS/ObjectManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -788,9 +788,9 @@ def compute_size(self, ob):
if ob_size < 1024:
return '1 KiB'
elif ob_size > 1048576:
return "{:0.02f} MiB".format(ob_size / 1048576.0)
return f"{ob_size / 1048576.0:0.02f} MiB"
else:
return "{:0.0f} KiB".format(ob_size / 1024.0)
return f"{ob_size / 1024.0:0.0f} KiB"

@security.protected(access_contents_information)
def last_modified(self, ob):
Expand Down
2 changes: 1 addition & 1 deletion src/Products/SiteAccess/VirtualHostMonster.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def set_map(self, map_text, RESPONSE=None):
# Drop the protocol, if any
line = line.split('://')[-1]
try:
host, path = [x.strip() for x in line.split('/', 1)]
host, path = (x.strip() for x in line.split('/', 1))
except Exception:
raise ValueError(
'Line needs a slash between host and path: %s' % line)
Expand Down
2 changes: 1 addition & 1 deletion src/ZPublisher/tests/test_xmlrpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def test_setBody(self):
response.setBody(body)

body_str = faux._body
self.assertEqual(type(body_str), type(''))
self.assertEqual(type(body_str), str)

as_set, method = xmlrpc.client.loads(body_str)
as_set = as_set[0]
Expand Down
2 changes: 1 addition & 1 deletion src/ZTUtils/Tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ def tree(self, root, expanded=None, subtree=0):
return node


_SIMPLE_TYPES = {type(''), type(b''), type(0), type(0.0), type(None)}
_SIMPLE_TYPES = {str, bytes, int, float, type(None)}


def simple_type(ob):
Expand Down
2 changes: 1 addition & 1 deletion src/Zope2/utilities/mkwsgiinstance.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ def get_zope2path(python):
try:
output = subprocess.check_output(
[python, '-c', 'import Zope2; print(Zope2.__file__)'],
universal_newlines=True, # makes Python 3 return text, not bytes
text=True, # makes Python 3 return text, not bytes
stderr=subprocess.PIPE)
zope2file = output.strip()
except subprocess.CalledProcessError:
Expand Down

0 comments on commit 7b9921a

Please sign in to comment.