Skip to content

Commit 6d1a302

Browse files
committed
Ruff lint fixes.
1 parent 58d4ec8 commit 6d1a302

5 files changed

Lines changed: 11 additions & 11 deletions

File tree

pgspecial/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ def export(defn):
1111
return defn
1212

1313

14-
from . import dbcommands, iocommands # type: ignore[import]
14+
from . import dbcommands, iocommands # noqa

pgspecial/dbcommands.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1666,18 +1666,18 @@ def describe_one_table_details(cur, schema_name, relation_name, oid, verbose):
16661666
# */
16671667
tgenabled = row[2]
16681668
if category == 0:
1669-
if tgenabled == "O" or tgenabled == True:
1669+
if tgenabled == "O" or tgenabled is True:
16701670
list_trigger = True
16711671
elif category == 1:
1672-
if tgenabled == "D" or tgenabled == False:
1672+
if tgenabled == "D" or tgenabled is False:
16731673
list_trigger = True
16741674
elif category == 2:
16751675
if tgenabled == "A":
16761676
list_trigger = True
16771677
elif category == 3:
16781678
if tgenabled == "R":
16791679
list_trigger = True
1680-
if list_trigger == False:
1680+
if list_trigger is False:
16811681
continue
16821682

16831683
# /* Print the category heading once */

pgspecial/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ def register_special_command(
301301
)
302302

303303

304-
def chunks(l, n):
304+
def chunks(l, n): # noqa
305305
n = max(1, n)
306306
return [l[i : i + n] for i in range(0, len(l), n)]
307307

tests/dbutils.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def db_connection(dbname=None):
3131
conn = db_connection(dbname=None)
3232
CAN_CONNECT_TO_DB = True
3333
SERVER_VERSION = conn.info.server_version
34-
except:
34+
except Exception:
3535
CAN_CONNECT_TO_DB = False
3636
SERVER_VERSION = 0
3737

@@ -46,7 +46,7 @@ def create_db(dbname=TEST_DB_NAME):
4646
with db_connection(dbname=None).cursor() as cur:
4747
try:
4848
cur.execute("""CREATE DATABASE %s encoding UTF8 LC_COLLATE 'en_US.UTF-8' LC_CTYPE 'en_US.UTF-8' template template0""" % dbname)
49-
except:
49+
except Exception:
5050
pass
5151

5252

@@ -68,7 +68,7 @@ def setup_db(conn):
6868
cur.execute("create table inh2(value2 integer) inherits (tbl1, tbl2)")
6969
cur.execute(
7070
"""
71-
create table schema3.test_generated_default
71+
create table schema3.test_generated_default
7272
(id int GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY, some_stuff text)"""
7373
)
7474

@@ -164,7 +164,7 @@ def foreign_db_environ():
164164
try:
165165
with foreign_db_environ():
166166
CAN_CREATE_FDW_EXTENSION = True
167-
except:
167+
except Exception:
168168
CAN_CREATE_FDW_EXTENSION = False
169169

170170
fdw_test = pytest.mark.skipif(not CAN_CREATE_FDW_EXTENSION, reason="Unable to create a postgres_fdw extension.")

tests/test_specials.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -711,12 +711,12 @@ def test_slash_dF(executor):
711711
assert header == ["Schema", "Name", "Description"]
712712
assert ("pg_catalog", "spanish", "configuration for spanish language") in rows
713713

714-
results = executor(r"\dD *ian")
714+
_ = executor(r"\dD *ian")
715715
assert title is None
716716
assert header == ["Schema", "Name", "Description"]
717717
assert ("pg_catalog", "russian", "configuration for russian language") in rows
718718

719-
results = executor(r"\dD ge*")
719+
_ = executor(r"\dD ge*")
720720
assert title is None
721721
assert header == ["Schema", "Name", "Description"]
722722
assert ("pg_catalog", "german", "configuration for german language") in rows

0 commit comments

Comments
 (0)