Skip to content

Commit

Permalink
enable F841 (unused vars)
Browse files Browse the repository at this point in the history
  • Loading branch information
aljazerzen committed Mar 8, 2024
1 parent cbcb4ce commit d9ee83a
Show file tree
Hide file tree
Showing 19 changed files with 27 additions and 31 deletions.
2 changes: 1 addition & 1 deletion edb/common/markup/renderers/terminal.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ def check_folded_fit(pos, data, width):
elif el == HEADER:
# ``item[1]`` -- text to output, ``item[2]`` -- its style,
#
_, text, style, level = el
_, text, style, _level = el
if item[2] is None:
result.append(item[1])
else:
Expand Down
4 changes: 2 additions & 2 deletions edb/edgeql/compiler/inference/cardinality.py
Original file line number Diff line number Diff line change
Expand Up @@ -804,12 +804,12 @@ def __infer_oper_call(
elif str(ir.func_shortname) == 'std::EXCEPT':
# EXCEPT cardinality cannot be greater than the first argument, but
# the lower bound can be ZERO.
lower, upper = _card_to_bounds(cards[0])
_lower, upper = _card_to_bounds(cards[0])
return _bounds_to_card(CB_ZERO, upper)
elif str(ir.func_shortname) == 'std::INTERSECT':
# INTERSECT takes the minimum of cardinalities and makes the lower
# bound ZERO.
lower, upper = _card_to_bounds(min_cardinality(cards))
_lower, upper = _card_to_bounds(min_cardinality(cards))
return _bounds_to_card(CB_ZERO, upper)
elif str(ir.func_shortname) == 'std::??':
# Coalescing takes the maximum of both lower and upper bounds.
Expand Down
2 changes: 1 addition & 1 deletion edb/edgeql/parser/grammar/ddl.py
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,7 @@ def reduce_CREATE_DATABASE_from_template(self, *kids):
CREATE DATABASE DatabaseName FROM AnyNodeName
OptCreateDatabaseCommandsBlock
"""
_, _, name, _, template, commands = kids
_, _, _name, _, _template, _commands = kids
self.val = qlast.CreateDatabase(
name=kids[2].val,
commands=kids[5].val,
Expand Down
2 changes: 1 addition & 1 deletion edb/graphql/translator.py
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ def visit_FieldNode(self, node):
if self._is_duplicate_field(node):
return

is_top, path, prevt, target, steps = \
_is_top, _path, prevt, target, steps = \
self._prepare_field(node)

json_mode = False
Expand Down
2 changes: 1 addition & 1 deletion edb/pgsql/compiler/relgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -1817,7 +1817,7 @@ def process_set_as_coalesce(
with ctx.new() as newctx:
newctx.expr_exposed = False
left_ir, right_ir = (a.expr for a in expr.args)
left_card, right_card = (a.cardinality for a in expr.args)
_left_card, right_card = (a.cardinality for a in expr.args)
is_object = (
ir_set.path_id.is_objtype_path()
or ir_set.path_id.is_tuple_path()
Expand Down
4 changes: 2 additions & 2 deletions edb/pgsql/delta.py
Original file line number Diff line number Diff line change
Expand Up @@ -2679,7 +2679,7 @@ def _undo_everything(
pass

if prop.get_default(schema):
delta_alter, cmd_alter, alter_context = prop.init_delta_branch(
delta_alter, cmd_alter, _alter_context = prop.init_delta_branch(
schema, context, cmdtype=sd.AlterObject)
cmd_alter.set_attribute_value('default', None)
cmd.add(delta_alter)
Expand Down Expand Up @@ -2716,7 +2716,7 @@ def _undo_everything(
elif isinstance(obj, s_props.Property):
new_typ = props[obj]

delta_alter, cmd_alter, alter_context = obj.init_delta_branch(
delta_alter, cmd_alter, _alter_context = obj.init_delta_branch(
schema, context, cmdtype=sd.AlterObject)
cmd_alter.set_attribute_value('target', new_typ)
cmd_alter.set_attribute_value('default', None)
Expand Down
2 changes: 1 addition & 1 deletion edb/schema/pointers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1799,7 +1799,7 @@ def validate_object(
# because it's impossible to actually guarantee that any
# SELECT involving a path is non-empty
ptr_cardinality = scls.get_cardinality(schema)
default_required, default_cardinality = \
_default_required, default_cardinality = \
default_expr.irast.cardinality.to_schema_value()

if (ptr_cardinality is qltypes.SchemaCardinality.One
Expand Down
2 changes: 1 addition & 1 deletion edb/schema/reflection/structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ def generate_structure(
read_ptr = f'{read_ptr}[IS {rschema_name}]'

if field.reflection_proxy:
proxy_type, proxy_link = field.reflection_proxy
_proxy_type, proxy_link = field.reflection_proxy
read_ptr = (
f'{read_ptr}: {{name, value := .{proxy_link}.id}}'
)
Expand Down
4 changes: 2 additions & 2 deletions edb/server/compiler_pool/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,12 +381,12 @@ async def _call_for_client(
if status == 0:
worker.set_client_schema(client_id, client_schema)
if method_name == "compile":
units, new_pickled_state = data[0]
_units, new_pickled_state = data[0]
if new_pickled_state:
sid = worker._last_pickled_state = next_tx_state_id()
resp = pickle.dumps((0, (*data[0], sid)), -1)
elif status == 1:
exc, tb = data
exc, _tb = data
if not isinstance(exc, state_mod.FailedStateSync):
worker.set_client_schema(client_id, client_schema)
else:
Expand Down
2 changes: 1 addition & 1 deletion edb/server/pgcluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ async def _copy_database(
pg_restore = self._find_pg_binary('pg_restore')

src_conn_args, src_env = self._dump_restore_conn_args(src_dbname)
tgt_conn_args, tgt_env = self._dump_restore_conn_args(tgt_dbname)
tgt_conn_args, _tgt_env = self._dump_restore_conn_args(tgt_dbname)

dump_args = [
pg_dump, '--verbose', '--format=c', *src_conn_args, *src_args
Expand Down
2 changes: 1 addition & 1 deletion edb/testbase/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ async def _wait_for_db_config(
(
rdata,
_headers,
status,
_status,
) = cls.http_con_request(
http_con,
prefix="",
Expand Down
4 changes: 0 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,6 @@ lint.ignore = [
"E731", # Do not assign a lambda expression, use a def
"E741", # Ambiguous variable name: l or i or I
"E252", # Missing whitespace around parameter equals

# TODO: enable this
"F841", # unused variable

# TODO: enable this
"B905", # zip() without an explicit strict= parameter
Expand All @@ -238,4 +235,3 @@ exclude = ["postgres", ".github"]
lint.flake8-bugbear.extend-immutable-calls = [
"immutables.Map"
]

2 changes: 1 addition & 1 deletion tests/test_backend_connect.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ def get_connection_spec(cls, kwargs=None):
conn_spec = cls.cluster.get_connection_spec()
conn_spec['host'] = 'localhost'
if kwargs.get('dsn'):
addrs, params = pgconnparams.parse_dsn(kwargs['dsn'])
_addrs, params = pgconnparams.parse_dsn(kwargs['dsn'])
for k in (
'user',
'password',
Expand Down
2 changes: 1 addition & 1 deletion tests/test_edgeql_extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,7 @@ async def _check(_cfg_obj='Config', **kwargs):
async for tr in self.try_until_succeeds(ignore=AssertionError):
async with tr:
with self.http_con() as http_con:
rdata, _headers, status = self.http_con_request(
rdata, _headers, _status = self.http_con_request(
http_con,
prefix="",
path="server-info",
Expand Down
4 changes: 2 additions & 2 deletions tests/test_edgeql_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ async def test_edgeql_update_simple_05(self):
)

async def test_edgeql_update_returning_01(self):
orig1, orig2, orig3 = self.original
_orig1, orig2, _orig3 = self.original

await self.assert_query_result(
r"""
Expand Down Expand Up @@ -326,7 +326,7 @@ async def test_edgeql_update_returning_02(self):
)

async def test_edgeql_update_returning_03(self):
orig1, orig2, orig3 = self.original
_orig1, _orig2, _orig3 = self.original

await self.assert_query_result(
r"""
Expand Down
4 changes: 2 additions & 2 deletions tests/test_http_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ def _scram_auth_expect_failure(self, user, password):
content,
headers,
status,
sid,
expected_server_sig,
_sid,
_expected_server_sig,
) = self._scram_auth(user, password)
self.assertEqual(status, 401)
self.assertEqual(content, b"Authentication failed")
Expand Down
6 changes: 3 additions & 3 deletions tests/test_http_ext_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -2555,7 +2555,7 @@ async def test_http_auth_ext_local_password_register_json_02(self):
}
json_data_encoded = json.dumps(json_data).encode()

body, headers, status = self.http_con_request(
body, _headers, status = self.http_con_request(
http_con,
None,
path="register",
Expand Down Expand Up @@ -2721,7 +2721,7 @@ async def test_http_auth_ext_local_password_authenticate_01(self):
}
auth_data_encoded = urllib.parse.urlencode(auth_data).encode()

body, headers, status = self.http_con_request(
body, _headers, status = self.http_con_request(
http_con,
None,
path="authenticate",
Expand Down Expand Up @@ -3765,7 +3765,7 @@ async def test_http_auth_ext_webauthn_authenticate_options(self):
public_key=public_key,
)

body, headers, status = self.http_con_request(
body, _headers, status = self.http_con_request(
http_con,
path=f"webauthn/authenticate/options?email={email}",
)
Expand Down
6 changes: 3 additions & 3 deletions tests/test_server_compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ async def check_pid(self, pid, server):

async def test_server_compiler_pool_restart(self):
pids = []
async with self.compiler_pool(2) as (server, proto, proc, sn):
async with self.compiler_pool(2) as (server, proto, _proc, _sn):
# Make sure both compiler workers are up and ready
pid1 = await asyncio.wait_for(proto.connected.get(), LONG_WAIT)
pid2 = await asyncio.wait_for(proto.connected.get(), SHORT_WAIT)
Expand Down Expand Up @@ -177,7 +177,7 @@ async def test_server_compiler_pool_restart(self):
os.kill(pid, 0)

async def test_server_compiler_pool_template_proc_exit(self):
async with self.compiler_pool(2) as (server, proto, proc, sn):
async with self.compiler_pool(2) as (server, proto, proc, _sn):
# Make sure both compiler workers are up and ready
pid1 = await asyncio.wait_for(proto.connected.get(), LONG_WAIT)
pid2 = await asyncio.wait_for(proto.connected.get(), SHORT_WAIT)
Expand Down Expand Up @@ -214,7 +214,7 @@ async def test_server_compiler_pool_template_proc_exit(self):
os.kill(pid, 0)

async def test_server_compiler_pool_server_exit(self):
async with self.compiler_pool(2) as (server, proto, proc, sn):
async with self.compiler_pool(2) as (server, proto, proc, _sn):
# Make sure both compiler workers are up and ready
pid1 = await asyncio.wait_for(proto.connected.get(), LONG_WAIT)
pid2 = await asyncio.wait_for(proto.connected.get(), SHORT_WAIT)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_server_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -1316,7 +1316,7 @@ async def _test_server_ops_global_compile_cache(
) as http_con:
async for tr in self.try_until_succeeds(ignore=AssertionError):
async with tr:
response, _, status = self.http_con_json_request(
_response, _, status = self.http_con_json_request(
http_con,
path=f"/db/{conn.dbname}/ext/auth/register",
body={
Expand Down

0 comments on commit d9ee83a

Please sign in to comment.