pyupgrade · PyMySQL/PyMySQL@9694747 · GitHub | Latest TMZ Celebrity News & Gossip | Watch TMZ Live
Skip to content

Commit 9694747

Browse files
committed
pyupgrade
1 parent 1f0b785 commit 9694747

File tree

3 files changed

+11
-20
lines changed

3 files changed

+11
-20
lines changed

docs/source/conf.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# -*- coding: utf-8 -*-
2-
#
31
# PyMySQL documentation build configuration file, created by
42
# sphinx-quickstart on Tue May 17 12:01:11 2016.
53
#

pymysql/connections.py

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,7 @@ def _lenenc_int(i):
8484
return b"\xfe" + struct.pack("<Q", i)
8585
else:
8686
raise ValueError(
87-
"Encoding %x is larger than %x - no representation in LengthEncodedInteger"
88-
% (i, (1 << 64))
87+
f"Encoding {i:x} is larger than {1 << 64:x} - no representation in LengthEncodedInteger"
8988
)
9089

9190

@@ -999,9 +998,8 @@ def _process_auth(self, plugin_name, auth_packet):
999998
if plugin_name != b"dialog":
1000999
raise err.OperationalError(
10011000
CR.CR_AUTH_PLUGIN_CANNOT_LOAD,
1002-
"Authentication plugin '%s'"
1003-
" not loaded: - %r missing authenticate method"
1004-
% (plugin_name, type(handler)),
1001+
f"Authentication plugin '{plugin_name}'"
1002+
f" not loaded: - {type(handler)!r} missing authenticate method",
10051003
)
10061004
if plugin_name == b"caching_sha2_password":
10071005
return _auth.caching_sha2_password_auth(self, auth_packet)
@@ -1037,16 +1035,14 @@ def _process_auth(self, plugin_name, auth_packet):
10371035
except AttributeError:
10381036
raise err.OperationalError(
10391037
CR.CR_AUTH_PLUGIN_CANNOT_LOAD,
1040-
"Authentication plugin '%s'"
1041-
" not loaded: - %r missing prompt method"
1042-
% (plugin_name, handler),
1038+
f"Authentication plugin '{plugin_name}'"
1039+
f" not loaded: - {handler!r} missing prompt method",
10431040
)
10441041
except TypeError:
10451042
raise err.OperationalError(
10461043
CR.CR_AUTH_PLUGIN_ERR,
1047-
"Authentication plugin '%s'"
1048-
" %r didn't respond with string. Returned '%r' to prompt %r"
1049-
% (plugin_name, handler, resp, prompt),
1044+
f"Authentication plugin '{plugin_name}'"
1045+
f" {handler!r} didn't respond with string. Returned '{resp!r}' to prompt {prompt!r}",
10501046
)
10511047
else:
10521048
raise err.OperationalError(
@@ -1079,9 +1075,8 @@ def _get_auth_plugin_handler(self, plugin_name):
10791075
except TypeError:
10801076
raise err.OperationalError(
10811077
CR.CR_AUTH_PLUGIN_CANNOT_LOAD,
1082-
"Authentication plugin '%s'"
1083-
" not loaded: - %r cannot be constructed with connection object"
1084-
% (plugin_name, plugin_class),
1078+
f"Authentication plugin '{plugin_name}'"
1079+
f" not loaded: - {plugin_class!r} cannot be constructed with connection object",
10851080
)
10861081
else:
10871082
handler = None

pymysql/protocol.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,7 @@ def read(self, size):
6565
if len(result) != size:
6666
error = (
6767
"Result length not requested length:\n"
68-
"Expected=%s. Actual=%s. Position: %s. Data Length: %s"
69-
% (size, len(result), self._position, len(self._data))
68+
f"Expected={size}. Actual={len(result)}. Position: {self._position}. Data Length: {len(self._data)}"
7069
)
7170
if DEBUG:
7271
print(error)
@@ -89,8 +88,7 @@ def advance(self, length):
8988
new_position = self._position + length
9089
if new_position < 0 or new_position > len(self._data):
9190
raise Exception(
92-
"Invalid advance amount (%s) for cursor. Position=%s"
93-
% (length, new_position)
91+
f"Invalid advance amount ({length}) for cursor. Position={new_position}"
9492
)
9593
self._position = new_position
9694

0 commit comments

Comments
 (0)

TMZ Celebrity News – Breaking Stories, Videos & Gossip

Looking for the latest TMZ celebrity news? You've come to the right place. From shocking Hollywood scandals to exclusive videos, TMZ delivers it all in real time.

Whether it’s a red carpet slip-up, a viral paparazzi moment, or a legal drama involving your favorite stars, TMZ news is always first to break the story. Stay in the loop with daily updates, insider tips, and jaw-dropping photos.

🎥 Watch TMZ Live

TMZ Live brings you daily celebrity news and interviews straight from the TMZ newsroom. Don’t miss a beat—watch now and see what’s trending in Hollywood.