mirror of
https://github.com/samsonjs/vdirsyncer.git
synced 2026-03-25 08:55:50 +00:00
Remove superfluous exception parens
This commit is contained in:
parent
defe8e2591
commit
24cb49f64c
21 changed files with 47 additions and 46 deletions
|
|
@ -76,7 +76,7 @@ def github_issue_role(name, rawtext, text, lineno, inliner, options=None, conten
|
|||
try:
|
||||
issue_num = int(text)
|
||||
if issue_num <= 0:
|
||||
raise ValueError()
|
||||
raise ValueError
|
||||
except ValueError:
|
||||
msg = inliner.reporter.error(f"Invalid GitHub issue: {text}", line=lineno)
|
||||
prb = inliner.problematic(rawtext, rawtext, msg)
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ select = [
|
|||
"UP",
|
||||
"C4",
|
||||
# "TID",
|
||||
"RSE"
|
||||
]
|
||||
target-version = "py37"
|
||||
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ class StorageTests:
|
|||
|
||||
:param collection: The name of the collection to create and use.
|
||||
"""
|
||||
raise NotImplementedError()
|
||||
raise NotImplementedError
|
||||
|
||||
@pytest_asyncio.fixture
|
||||
async def s(self, get_storage_args):
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ class ServerMixin:
|
|||
elif self.storage_class.fileext == ".vcf":
|
||||
pytest.skip("No carddav")
|
||||
else:
|
||||
raise RuntimeError()
|
||||
raise RuntimeError
|
||||
|
||||
@pytest.fixture
|
||||
def get_storage_args(self, davical_args, request):
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ class ServerMixin:
|
|||
elif self.storage_class.fileext == ".vcf":
|
||||
args["url"] = "https://carddav.fastmail.com/"
|
||||
else:
|
||||
raise RuntimeError()
|
||||
raise RuntimeError
|
||||
|
||||
if collection is not None:
|
||||
args = await slow_create_collection(
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ class ServerMixin:
|
|||
elif self.storage_class.fileext == ".vcf":
|
||||
args["url"] = "https://contacts.icloud.com/"
|
||||
else:
|
||||
raise RuntimeError()
|
||||
raise RuntimeError
|
||||
|
||||
if collection is not None:
|
||||
args = slow_create_collection(self.storage_class, args, collection)
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ class TestFilesystemStorage(StorageTests):
|
|||
@pytest.mark.asyncio
|
||||
async def test_post_hook_inactive(self, tmpdir, monkeypatch):
|
||||
def check_call_mock(*args, **kwargs):
|
||||
raise AssertionError()
|
||||
raise AssertionError
|
||||
|
||||
monkeypatch.setattr(subprocess, "call", check_call_mock)
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ class CombinedStorage(Storage):
|
|||
|
||||
def __init__(self, url, path, *, connector, **kwargs):
|
||||
if kwargs.get("collection", None) is not None:
|
||||
raise ValueError()
|
||||
raise ValueError
|
||||
|
||||
super().__init__(**kwargs)
|
||||
self.url = url
|
||||
|
|
|
|||
|
|
@ -207,13 +207,13 @@ def test_collection_required(a_requires, b_requires, tmpdir, runner, monkeypatch
|
|||
def __init__(self, require_collection, **kw):
|
||||
if require_collection:
|
||||
assert not kw.get("collection")
|
||||
raise exceptions.CollectionRequired()
|
||||
raise exceptions.CollectionRequired
|
||||
|
||||
async def get(self, href: str):
|
||||
raise NotImplementedError()
|
||||
raise NotImplementedError
|
||||
|
||||
async def list(self) -> List[tuple]:
|
||||
raise NotImplementedError()
|
||||
raise NotImplementedError
|
||||
|
||||
from vdirsyncer.cli.utils import storage_names
|
||||
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ def test_failed_strategy(monkeypatch, value_cache):
|
|||
|
||||
def strategy(x):
|
||||
calls.append(x)
|
||||
raise KeyboardInterrupt()
|
||||
raise KeyboardInterrupt
|
||||
|
||||
monkeypatch.setitem(STRATEGIES, "mystrategy", strategy)
|
||||
|
||||
|
|
|
|||
|
|
@ -535,7 +535,7 @@ class ActionIntentionallyFailed(Exception):
|
|||
|
||||
|
||||
def action_failure(*a, **kw):
|
||||
raise ActionIntentionallyFailed()
|
||||
raise ActionIntentionallyFailed
|
||||
|
||||
|
||||
class SyncMachine(RuleBasedStateMachine):
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ def _fetch_value(opts, key):
|
|||
try:
|
||||
ctx = click.get_current_context().find_object(AppContext)
|
||||
if ctx is None:
|
||||
raise RuntimeError()
|
||||
raise RuntimeError
|
||||
password_cache = ctx.fetched_params
|
||||
except RuntimeError:
|
||||
password_cache = {}
|
||||
|
|
|
|||
|
|
@ -80,12 +80,12 @@ async def sync_collection(
|
|||
)
|
||||
|
||||
if sync_failed:
|
||||
raise JobFailed()
|
||||
raise JobFailed
|
||||
except JobFailed:
|
||||
raise
|
||||
except BaseException:
|
||||
handle_cli_error(status_name)
|
||||
raise JobFailed()
|
||||
raise JobFailed
|
||||
|
||||
|
||||
async def discover_collections(pair, **kwargs):
|
||||
|
|
@ -161,7 +161,7 @@ async def metasync_collection(collection, general, *, connector: aiohttp.TCPConn
|
|||
)
|
||||
except BaseException:
|
||||
handle_cli_error(status_name)
|
||||
raise JobFailed()
|
||||
raise JobFailed
|
||||
|
||||
save_status(
|
||||
general["status_path"],
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ async def repair_storage(storage, repair_unsafe_uid):
|
|||
|
||||
def repair_item(href, item, seen_uids, repair_unsafe_uid):
|
||||
if item.parsed is None:
|
||||
raise IrreparableItem()
|
||||
raise IrreparableItem
|
||||
|
||||
new_item = item
|
||||
|
||||
|
|
@ -62,6 +62,6 @@ def repair_item(href, item, seen_uids, repair_unsafe_uid):
|
|||
new_item = item.with_uid(generate_href())
|
||||
|
||||
if not new_item.uid:
|
||||
raise IrreparableItem()
|
||||
raise IrreparableItem
|
||||
|
||||
return new_item
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ class Storage(metaclass=StorageMeta):
|
|||
"""
|
||||
if False:
|
||||
yield # Needs to be an async generator
|
||||
raise NotImplementedError()
|
||||
raise NotImplementedError
|
||||
|
||||
@classmethod
|
||||
async def create_collection(cls, collection, **kwargs):
|
||||
|
|
@ -117,7 +117,7 @@ class Storage(metaclass=StorageMeta):
|
|||
|
||||
The returned args should contain the collection name, for UI purposes.
|
||||
"""
|
||||
raise NotImplementedError()
|
||||
raise NotImplementedError
|
||||
|
||||
def __repr__(self):
|
||||
try:
|
||||
|
|
@ -184,7 +184,7 @@ class Storage(metaclass=StorageMeta):
|
|||
|
||||
:returns: (href, etag)
|
||||
"""
|
||||
raise NotImplementedError()
|
||||
raise NotImplementedError
|
||||
|
||||
async def update(self, href: str, item: Item, etag):
|
||||
"""Update an item.
|
||||
|
|
@ -197,7 +197,7 @@ class Storage(metaclass=StorageMeta):
|
|||
|
||||
:returns: etag
|
||||
"""
|
||||
raise NotImplementedError()
|
||||
raise NotImplementedError
|
||||
|
||||
async def delete(self, href: str, etag: str):
|
||||
"""Delete an item by href.
|
||||
|
|
@ -205,7 +205,7 @@ class Storage(metaclass=StorageMeta):
|
|||
:raises: :exc:`vdirsyncer.exceptions.PreconditionFailed` when item has
|
||||
a different etag or doesn't exist.
|
||||
"""
|
||||
raise NotImplementedError()
|
||||
raise NotImplementedError
|
||||
|
||||
@contextlib.asynccontextmanager
|
||||
async def at_once(self):
|
||||
|
|
|
|||
|
|
@ -690,7 +690,7 @@ class DAVStorage(Storage):
|
|||
try:
|
||||
tagname, namespace = self._property_table[key]
|
||||
except KeyError:
|
||||
raise exceptions.UnsupportedMetadataError()
|
||||
raise exceptions.UnsupportedMetadataError
|
||||
|
||||
xpath = f"{{{namespace}}}{tagname}"
|
||||
body = f"""<?xml version="1.0" encoding="utf-8" ?>
|
||||
|
|
@ -724,7 +724,7 @@ class DAVStorage(Storage):
|
|||
try:
|
||||
tagname, namespace = self._property_table[key]
|
||||
except KeyError:
|
||||
raise exceptions.UnsupportedMetadataError()
|
||||
raise exceptions.UnsupportedMetadataError
|
||||
|
||||
lxml_selector = f"{{{namespace}}}{tagname}"
|
||||
element = etree.Element(lxml_selector)
|
||||
|
|
|
|||
|
|
@ -190,7 +190,7 @@ class GoogleCalendarStorage(dav.CalDAVStorage):
|
|||
**kwargs,
|
||||
):
|
||||
if not kwargs.get("collection"):
|
||||
raise exceptions.CollectionRequired()
|
||||
raise exceptions.CollectionRequired
|
||||
|
||||
super().__init__(
|
||||
token_file=token_file,
|
||||
|
|
@ -228,7 +228,7 @@ class GoogleContactsStorage(dav.CardDAVStorage):
|
|||
|
||||
def __init__(self, token_file, client_id, client_secret, **kwargs):
|
||||
if not kwargs.get("collection"):
|
||||
raise exceptions.CollectionRequired()
|
||||
raise exceptions.CollectionRequired
|
||||
|
||||
super().__init__(
|
||||
token_file=token_file,
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ class SingleFileStorage(Storage):
|
|||
except TypeError:
|
||||
# If not exactly one '%s' is present, we cannot discover
|
||||
# collections because we wouldn't know which name to assign.
|
||||
raise NotImplementedError()
|
||||
raise NotImplementedError
|
||||
|
||||
placeholder_pos = path.index("%s")
|
||||
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ async def sync(
|
|||
- ``revert`` (default): Revert changes on other side.
|
||||
"""
|
||||
if storage_a.read_only and storage_b.read_only:
|
||||
raise BothReadOnly()
|
||||
raise BothReadOnly
|
||||
|
||||
if conflict_resolution == "a wins":
|
||||
conflict_resolution = lambda a, b: a # noqa: E731
|
||||
|
|
@ -165,7 +165,7 @@ async def sync(
|
|||
|
||||
class Action:
|
||||
async def _run_impl(self, a, b): # pragma: no cover
|
||||
raise NotImplementedError()
|
||||
raise NotImplementedError
|
||||
|
||||
async def run(self, a, b, conflict_resolution, partial_sync):
|
||||
with self.auto_rollback(a, b):
|
||||
|
|
|
|||
|
|
@ -47,63 +47,63 @@ class _StatusBase(metaclass=abc.ABCMeta):
|
|||
|
||||
@abc.abstractmethod
|
||||
def transaction(self):
|
||||
raise NotImplementedError()
|
||||
raise NotImplementedError
|
||||
|
||||
@abc.abstractmethod
|
||||
def insert_ident_a(self, ident, props):
|
||||
raise NotImplementedError()
|
||||
raise NotImplementedError
|
||||
|
||||
@abc.abstractmethod
|
||||
def insert_ident_b(self, ident, props):
|
||||
raise NotImplementedError()
|
||||
raise NotImplementedError
|
||||
|
||||
@abc.abstractmethod
|
||||
def update_ident_a(self, ident, props):
|
||||
raise NotImplementedError()
|
||||
raise NotImplementedError
|
||||
|
||||
@abc.abstractmethod
|
||||
def update_ident_b(self, ident, props):
|
||||
raise NotImplementedError()
|
||||
raise NotImplementedError
|
||||
|
||||
@abc.abstractmethod
|
||||
def remove_ident(self, ident):
|
||||
raise NotImplementedError()
|
||||
raise NotImplementedError
|
||||
|
||||
@abc.abstractmethod
|
||||
def get_a(self, ident):
|
||||
raise NotImplementedError()
|
||||
raise NotImplementedError
|
||||
|
||||
@abc.abstractmethod
|
||||
def get_b(self, ident):
|
||||
raise NotImplementedError()
|
||||
raise NotImplementedError
|
||||
|
||||
@abc.abstractmethod
|
||||
def get_new_a(self, ident):
|
||||
raise NotImplementedError()
|
||||
raise NotImplementedError
|
||||
|
||||
@abc.abstractmethod
|
||||
def get_new_b(self, ident):
|
||||
raise NotImplementedError()
|
||||
raise NotImplementedError
|
||||
|
||||
@abc.abstractmethod
|
||||
def iter_old(self):
|
||||
raise NotImplementedError()
|
||||
raise NotImplementedError
|
||||
|
||||
@abc.abstractmethod
|
||||
def iter_new(self):
|
||||
raise NotImplementedError()
|
||||
raise NotImplementedError
|
||||
|
||||
@abc.abstractmethod
|
||||
def get_by_href_a(self, href, default=(None, None)):
|
||||
raise NotImplementedError()
|
||||
raise NotImplementedError
|
||||
|
||||
@abc.abstractmethod
|
||||
def get_by_href_b(self, href, default=(None, None)):
|
||||
raise NotImplementedError()
|
||||
raise NotImplementedError
|
||||
|
||||
@abc.abstractmethod
|
||||
def rollback(self, ident):
|
||||
raise NotImplementedError()
|
||||
raise NotImplementedError
|
||||
|
||||
|
||||
class SqliteStatus(_StatusBase):
|
||||
|
|
|
|||
|
|
@ -352,7 +352,7 @@ class _Component:
|
|||
rv = line[len(prefix_with_params) :].split(":", 1)[-1]
|
||||
break
|
||||
else:
|
||||
raise KeyError()
|
||||
raise KeyError
|
||||
|
||||
for line in iterlines:
|
||||
if line.startswith((" ", "\t")):
|
||||
|
|
|
|||
Loading…
Reference in a new issue