Mark unused variables as such

This commit is contained in:
Hugo Osvaldo Barrera 2025-11-06 01:05:48 +01:00
parent cbb4e314f6
commit c3262d88cc
10 changed files with 19 additions and 19 deletions

View file

@ -104,7 +104,7 @@ class StorageTests:
href, etag = await s.upload(get_item()) href, etag = await s.upload(get_item())
if etag is None: if etag is None:
_, etag = await s.get(href) _, etag = await s.get(href)
((href2, item, etag2),) = await aiostream.stream.list(s.get_multi([href] * 2)) ((href2, _item, etag2),) = await aiostream.stream.list(s.get_multi([href] * 2))
assert href2 == href assert href2 == href
assert etag2 == etag assert etag2 == etag
@ -118,7 +118,7 @@ class StorageTests:
@pytest.mark.asyncio @pytest.mark.asyncio
async def test_upload(self, s, get_item): async def test_upload(self, s, get_item):
item = get_item() item = get_item()
href, etag = await s.upload(item) href, _etag = await s.upload(item)
assert_item_equals((await s.get(href))[0], item) assert_item_equals((await s.get(href))[0], item)
@pytest.mark.asyncio @pytest.mark.asyncio
@ -146,7 +146,7 @@ class StorageTests:
@pytest.mark.asyncio @pytest.mark.asyncio
async def test_wrong_etag(self, s, get_item): async def test_wrong_etag(self, s, get_item):
item = get_item() item = get_item()
href, etag = await s.upload(item) href, _etag = await s.upload(item)
with pytest.raises(exceptions.PreconditionFailed): with pytest.raises(exceptions.PreconditionFailed):
await s.update(href, item, '"lolnope"') await s.update(href, item, '"lolnope"')
with pytest.raises(exceptions.PreconditionFailed): with pytest.raises(exceptions.PreconditionFailed):
@ -422,7 +422,7 @@ class StorageTests:
).strip() ).strip()
) )
href, etag = await s.upload(item) href, _etag = await s.upload(item)
item2, etag2 = await s.get(href) item2, _etag2 = await s.get(href)
assert normalize_item(item) == normalize_item(item2) assert normalize_item(item) == normalize_item(item2)

View file

@ -48,6 +48,6 @@ class DAVStorageTests(ServerMixin, StorageTests):
monkeypatch.setattr(s, "_get_href", lambda item: item.ident + s.fileext) monkeypatch.setattr(s, "_get_href", lambda item: item.ident + s.fileext)
item = get_item(uid="град сатану" + str(uuid.uuid4())) item = get_item(uid="град сатану" + str(uuid.uuid4()))
href, etag = await s.upload(item) href, _etag = await s.upload(item)
item2, etag2 = await s.get(href) item2, _etag2 = await s.get(href)
assert_item_equals(item, item2) assert_item_equals(item, item2)

View file

@ -90,7 +90,7 @@ class TestFilesystemStorage(StorageTests):
storage = self.storage_class(str(tmpdir), ".txt") storage = self.storage_class(str(tmpdir), ".txt")
item = Item("UID:" + "hue" * 600) item = Item("UID:" + "hue" * 600)
href, etag = await storage.upload(item) href, _etag = await storage.upload(item)
assert item.uid not in href assert item.uid not in href
@pytest.mark.asyncio @pytest.mark.asyncio

View file

@ -26,7 +26,7 @@ def read_config(tmpdir, monkeypatch):
def test_read_config(read_config): def test_read_config(read_config):
errors, c = read_config( _errors, c = read_config(
""" """
[general] [general]
status_path = "/tmp/status/" status_path = "/tmp/status/"

View file

@ -14,7 +14,7 @@ def test_handle_cli_error(capsys):
except BaseException: except BaseException:
handle_cli_error() handle_cli_error()
out, err = capsys.readouterr() _out, err = capsys.readouterr()
assert "returned something vdirsyncer doesn't understand" in err assert "returned something vdirsyncer doesn't understand" in err
assert "ayy lmao" in err assert "ayy lmao" in err

View file

@ -348,7 +348,7 @@ async def test_uses_get_multi(monkeypatch):
a = MemoryStorage() a = MemoryStorage()
b = MemoryStorage() b = MemoryStorage()
item = Item("UID:1") item = Item("UID:1")
expected_href, etag = await a.upload(item) expected_href, _etag = await a.upload(item)
await sync(a, b, {}) await sync(a, b, {})
assert get_multi_calls == [[expected_href]] assert get_multi_calls == [[expected_href]]
@ -385,7 +385,7 @@ async def test_changed_uids():
a = MemoryStorage() a = MemoryStorage()
b = MemoryStorage() b = MemoryStorage()
href_a, etag_a = await a.upload(Item("UID:A-ONE")) href_a, etag_a = await a.upload(Item("UID:A-ONE"))
href_b, etag_b = await b.upload(Item("UID:B-ONE")) _href_b, _etag_b = await b.upload(Item("UID:B-ONE"))
status = {} status = {}
await sync(a, b, status) await sync(a, b, status)
@ -469,7 +469,7 @@ async def test_moved_href():
a = MemoryStorage() a = MemoryStorage()
b = MemoryStorage() b = MemoryStorage()
status = {} status = {}
href, etag = await a.upload(Item("UID:haha")) _href, _etag = await a.upload(Item("UID:haha"))
await sync(a, b, status) await sync(a, b, status)
b.items["lol"] = b.items.pop("haha") b.items["lol"] = b.items.pop("haha")
@ -530,7 +530,7 @@ async def test_unicode_hrefs():
a = MemoryStorage() a = MemoryStorage()
b = MemoryStorage() b = MemoryStorage()
status = {} status = {}
href, etag = await a.upload(Item("UID:äää")) _href, _etag = await a.upload(Item("UID:äää"))
await sync(a, b, status) await sync(a, b, status)
@ -553,7 +553,7 @@ class SyncMachine(RuleBasedStateMachine):
if flaky_etags: if flaky_etags:
async def get(href): async def get(href):
old_etag, item = s.items[href] _old_etag, item = s.items[href]
etag = _random_string() etag = _random_string()
s.items[href] = etag, item s.items[href] = etag, item
return item, etag return item, etag

View file

@ -45,7 +45,7 @@ async def test_repair_uids(uid):
async def test_repair_unsafe_uids(uid): async def test_repair_unsafe_uids(uid):
s = MemoryStorage() s = MemoryStorage()
item = Item(f"BEGIN:VCARD\nUID:{uid}\nEND:VCARD") item = Item(f"BEGIN:VCARD\nUID:{uid}\nEND:VCARD")
href, etag = await s.upload(item) href, _etag = await s.upload(item)
assert (await s.get(href))[0].uid == uid assert (await s.get(href))[0].uid == uid
assert not href_safe(uid) assert not href_safe(uid)

View file

@ -115,7 +115,7 @@ def _fuzzy_matches_mimetype(strict, weak):
if strict is None or weak is None: if strict is None or weak is None:
return True return True
mediatype, subtype = strict.split("/") _mediatype, subtype = strict.split("/")
return subtype in weak return subtype in weak

View file

@ -130,7 +130,7 @@ class GoogleSession(dav.DAVSession):
async with self._session as session: async with self._session as session:
# Fail fast if the address is occupied # Fail fast if the address is occupied
authorization_url, state = session.authorization_url( authorization_url, _state = session.authorization_url(
TOKEN_URL, TOKEN_URL,
# access_type and approval_prompt are Google specific # access_type and approval_prompt are Google specific
# extra parameters. # extra parameters.

View file

@ -188,7 +188,7 @@ def join_collection(items, wrappers=_default_join_wrappers):
""" """
items1, items2 = tee((_Component.parse(x) for x in items), 2) items1, items2 = tee((_Component.parse(x) for x in items), 2)
item_type, wrapper_type = _get_item_type(items1, wrappers) _item_type, wrapper_type = _get_item_type(items1, wrappers)
wrapper_props = [] wrapper_props = []
def _get_item_components(x): def _get_item_components(x):