8000 Use Ruff instead of flake8 by methane · Pull Request #1112 · PyMySQL/PyMySQL · GitHub
[go: up one dir, main page]

Skip to content

Use Ruff instead of flake8 #1112

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 8 commits into from
May 24, 2023
Merged
Show file tree
Hide file tree
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
Decrease line length to 99 characters.
  • Loading branch information
methane committed May 24, 2023
commit 5d14ec4ac19091190325aabd8e90cee45aaab39d
15 changes: 10 additions & 5 deletions pymysql/connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,10 @@ class Connection:
the interface from which to connect to the host. Argument can be
a hostname or an IP address.
:param unix_socket: Use a unix socket rather than TCP/IP.
:param read_timeout: The timeout for reading from the connection in seconds (default: None - no timeout)
:param write_timeout: The timeout for writing to the connection in seconds (default: None - no timeout)
:param read_timeout: The timeout for reading from the connection in seconds.
(default: None - no timeout)
:param write_timeout: The timeout for writing to the connection in seconds.
(default: None - no timeout)
:param charset: Charset to use.
:param sql_mode: Default SQL_MODE to use.
:param read_default_file:
Expand All @@ -130,7 +132,8 @@ class Connection:
:param ssl_ca: Path to the file that contains a PEM-formatted CA certificate.
:param ssl_cert: Path to the file that contains a PEM-formatted client certificate.
:param ssl_disabled: A boolean value that disables usage of TLS.
:param ssl_key: Path to the file that contains a PEM-formatted private key for the client certificate.
:param ssl_key: Path to the file that contains a PEM-formatted private key for
the client certificate.
:param ssl_verify_cert: Set to true to check the server certificate's validity.
:param ssl_verify_identity: Set to true to check the server's identity.
:param read_default_group: Group to read from in the configuration file.
Expand Down Expand Up @@ -533,7 +536,8 @@ def cursor(self, cursor=None):
Create a new cursor to execute queries with.

:param cursor: The type of cursor to create. None means use Cursor.
:type cursor: :py:class:`Cursor`, :py:class:`SSCursor`, :py:class:`DictCursor`, or :py:class:`SSDictCursor`.
:type cursor: :py:class:`Cursor`, :py:class:`SSCursor`, :py:class:`DictCursor`,
or :py:class:`SSDictCursor`.
"""
if cursor:
return cursor(self)
Expand Down Expand Up @@ -1228,7 +1232,8 @@ def _check_packet_is_eof(self, packet):
# TODO: Support CLIENT.DEPRECATE_EOF
# 1) Add DEPRECATE_EOF to CAPABILITIES
# 2) Mask CAPABILITIES with server_capabilities
# 3) if server_capabilities & CLIENT.DEPRECATE_EOF: use OKPacketWrapper instead of EOFPacketWrapper
# 3) if server_capabilities & CLIENT.DEPRECATE_EOF:
# use OKPacketWrapper instead of EOFPacketWrapper
wp = EOFPacketWrapper(packet)
self.warning_count = wp.warning_count
self.has_next = wp.has_next
Expand Down
5 changes: 4 additions & 1 deletion pymysql/converters.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,10 @@ def escape_time(obj, mapping=None):

def escape_datetime(obj, mapping=None):
if obj.microsecond:
fmt = "'{0.year:04}-{0.month:02}-{0.day:02} {0.hour:02}:{0.minute:02}:{0.second:02}.{0.microsecond:06}'"
fmt = (
"'{0.year:04}-{0.month:02}-{0.day:02}"
+ " {0.hour:02}:{0.minute:02}:{0.second:02}.{0.microsecond:06}'"
)
else:
fmt = "'{0.year:04}-{0.month:02}-{0.day:02} {0.hour:02}:{0.minute:02}:{0.second:02}'"
return fmt.format(obj)
Expand Down
3 changes: 2 additions & 1 deletion pymysql/tests/test_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,8 @@ def realTestPamAuth(self):
)
except pymysql.OperationalError as e:
self.assertEqual(1045, e.args[0])
# we had 'bad guess at password' work with pam. Well at least we get a permission denied here
# we had 'bad guess at password' work with pam. Well at least we get
# a permission denied here
with self.assertRaises(pymysql.err.OperationalError):
pymysql.connect(
user=TestAuthentication.osuser,
Expand Down
3 changes: 2 additions & 1 deletion pymysql/tests/test_cursor.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ def test_executemany(self):
)
assert m is not None

# cursor._executed must bee "insert into test (data) values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9)"
# cursor._executed must bee "insert into test (data)
# values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9)"
# list args
data = range(10)
cursor.executemany("insert into test (data) values (%s)", data)
Expand Down
6 changes: 4 additions & 2 deletions pymysql/tests/test_load_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ def test_load_file(self):
)
try:
c.execute(
f"LOAD DATA LOCAL INFILE '{filename}' INTO TABLE test_load_local FIELDS TERMINATED BY ','"
f"LOAD DATA LOCAL INFILE '{filename}' INTO TABLE test_load_local"
+ " FIELDS TERMINATED BY ','"
)
c.execute("SELECT COUNT(*) FROM test_load_local")
self.assertEqual(22749, c.fetchone()[0])
Expand All @@ -53,7 +54,8 @@ def test_unbuffered_load_file(self):
)
try:
c.execute(
f"LOAD DATA LOCAL INFILE '{filename}' INTO TABLE test_load_local FIELDS TERMINATED BY ','"
f"LOAD DATA LOCAL INFILE '{filename}' INTO TABLE test_load_local"
+ " FIELDS TERMINATED BY ','"
)
c.execute("SELECT COUNT(*) FROM test_load_local")
self.assertEqual(22749, c.fetchone()[0])
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ exclude = ["tests*", "pymysql.tests*"]
version = {attr = "pymysql.VERSION"}

[tool.ruff]
line-length = 119
line-length = 99
exclude = [
"pymysql/tests/thirdparty",
]
0