mirror of
https://github.com/samsonjs/vdirsyncer.git
synced 2026-03-25 08:55:50 +00:00
Update linting tools
This commit is contained in:
parent
fc4a02c0c9
commit
2b4496fea4
11 changed files with 14 additions and 20 deletions
|
|
@ -1,6 +1,6 @@
|
|||
repos:
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v4.5.0
|
||||
rev: v5.0.0
|
||||
hooks:
|
||||
- id: trailing-whitespace
|
||||
args: [--markdown-linebreak-ext=md]
|
||||
|
|
@ -9,7 +9,7 @@ repos:
|
|||
- id: check-added-large-files
|
||||
- id: debug-statements
|
||||
- repo: https://github.com/pre-commit/mirrors-mypy
|
||||
rev: "v1.8.0"
|
||||
rev: "v1.15.0"
|
||||
hooks:
|
||||
- id: mypy
|
||||
files: vdirsyncer/.*
|
||||
|
|
@ -18,7 +18,7 @@ repos:
|
|||
- types-docutils
|
||||
- types-requests
|
||||
- repo: https://github.com/charliermarsh/ruff-pre-commit
|
||||
rev: 'v0.2.2'
|
||||
rev: 'v0.11.4'
|
||||
hooks:
|
||||
- id: ruff
|
||||
args: [--fix, --exit-non-zero-on-fix]
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ SPDX-License-Identifier: BSD-3-Clause
|
|||
SPDX-FileCopyrightText: 2021 Intevation GmbH <https://intevation.de>
|
||||
Author: <bernhard.reiter@intevation.de>
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import re
|
||||
|
|
|
|||
|
|
@ -37,9 +37,7 @@ except ImportError:
|
|||
html_theme = "default"
|
||||
if not on_rtd:
|
||||
print("-" * 74)
|
||||
print(
|
||||
"Warning: sphinx-rtd-theme not installed, building with default " "theme."
|
||||
)
|
||||
print("Warning: sphinx-rtd-theme not installed, building with default theme.")
|
||||
print("-" * 74)
|
||||
|
||||
html_static_path = ["_static"]
|
||||
|
|
|
|||
|
|
@ -90,9 +90,7 @@ def test_empty_storage(tmpdir, runner):
|
|||
result = runner.invoke(["sync"])
|
||||
lines = result.output.splitlines()
|
||||
assert lines[0] == "Syncing my_pair"
|
||||
assert lines[1].startswith(
|
||||
"error: my_pair: " 'Storage "my_b" was completely emptied.'
|
||||
)
|
||||
assert lines[1].startswith('error: my_pair: Storage "my_b" was completely emptied.')
|
||||
assert result.exception
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@ def test_hash_item():
|
|||
|
||||
|
||||
def test_multiline_uid(benchmark):
|
||||
a = "BEGIN:FOO\r\n" "UID:123456789abcd\r\n" " efgh\r\n" "END:FOO\r\n"
|
||||
a = "BEGIN:FOO\r\nUID:123456789abcd\r\n efgh\r\nEND:FOO\r\n"
|
||||
assert benchmark(lambda: vobject.Item(a).uid) == "123456789abcdefgh"
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -359,7 +359,7 @@ def _resolve_conflict_via_command(
|
|||
new_b = f.read()
|
||||
|
||||
if new_a != new_b:
|
||||
raise exceptions.UserError("The two files are not completely " "equal.")
|
||||
raise exceptions.UserError("The two files are not completely equal.")
|
||||
return Item(new_a)
|
||||
finally:
|
||||
shutil.rmtree(dir)
|
||||
|
|
|
|||
|
|
@ -72,8 +72,7 @@ async def collections_for_pair(
|
|||
)
|
||||
else:
|
||||
raise exceptions.UserError(
|
||||
f"Please run `vdirsyncer discover {pair.name}` "
|
||||
" before synchronization."
|
||||
f"Please run `vdirsyncer discover {pair.name}` before synchronization."
|
||||
)
|
||||
|
||||
logger.info(f"Discovering collections for pair {pair.name}")
|
||||
|
|
|
|||
|
|
@ -56,9 +56,7 @@ def repair_item(href, item, seen_uids, repair_unsafe_uid):
|
|||
new_item = item.with_uid(generate_href())
|
||||
elif not href_safe(item.uid) or not href_safe(basename(href)):
|
||||
if not repair_unsafe_uid:
|
||||
logger.warning(
|
||||
"UID may cause problems, add " "--repair-unsafe-uid to repair."
|
||||
)
|
||||
logger.warning("UID may cause problems, add --repair-unsafe-uid to repair.")
|
||||
else:
|
||||
logger.warning("UID or href is unsafe, assigning random UID.")
|
||||
new_item = item.with_uid(generate_href())
|
||||
|
|
|
|||
|
|
@ -261,7 +261,7 @@ class Discover:
|
|||
|
||||
href = response.find("{DAV:}href")
|
||||
if href is None:
|
||||
raise InvalidXMLResponse("Missing href tag for collection " "props.")
|
||||
raise InvalidXMLResponse("Missing href tag for collection props.")
|
||||
href = urlparse.urljoin(str(r.url), href.text)
|
||||
if href not in done:
|
||||
done.add(href)
|
||||
|
|
@ -792,7 +792,7 @@ class CalDAVStorage(DAVStorage):
|
|||
self.item_types = tuple(item_types)
|
||||
if (start_date is None) != (end_date is None):
|
||||
raise exceptions.UserError(
|
||||
"If start_date is given, " "end_date has to be given too."
|
||||
"If start_date is given, end_date has to be given too."
|
||||
)
|
||||
elif start_date is not None and end_date is not None:
|
||||
namespace = dict(datetime.__dict__)
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ class SingleFileStorage(Storage):
|
|||
path = path % (collection,)
|
||||
except TypeError:
|
||||
raise ValueError(
|
||||
"Exactly one %s required in path " "if collection is not null."
|
||||
"Exactly one %s required in path if collection is not null."
|
||||
)
|
||||
|
||||
checkfile(path, create=True)
|
||||
|
|
|
|||
|
|
@ -221,7 +221,7 @@ def open_graphical_browser(url, new=0, autoraise=True):
|
|||
if browser.open(url, new, autoraise):
|
||||
return
|
||||
|
||||
raise RuntimeError("No graphical browser found. Please open the URL " "manually.")
|
||||
raise RuntimeError("No graphical browser found. Please open the URL manually.")
|
||||
|
||||
|
||||
@contextlib.contextmanager
|
||||
|
|
|
|||
Loading…
Reference in a new issue