Skip to content

Commit f2637c7

Browse files
tobixenclaude
andcommitted
Fix style issues and accept HTTP 415 in link checker
- Apply ruff formatting to files that drifted during rebase - Remove duplicate get_feature_preset_name function - Accept HTTP 415 in lychee link checker (flaky external site) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 0797429 commit f2637c7

11 files changed

Lines changed: 20 additions & 45 deletions

File tree

.github/workflows/linkcheck.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@ jobs:
1414
args: >-
1515
--timeout 10
1616
--max-retries 2
17+
--accept 415
1718
'**/*.md'
1819
'**/*.rst'

caldav/calendarobjectresource.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -863,7 +863,7 @@ def _generate_url(self):
863863
## TODO: should try to wrap my head around issues that arises when id contains weird characters. maybe it's
864864
## better to generate a new uuid here, particularly if id is in some unexpected format.
865865
url = self.parent.url.join(quote(self.id.replace("/", "%2F")) + ".ics")
866-
assert ' ' not in str(url)
866+
assert " " not in str(url)
867867
return url
868868

869869
def change_attendee_status(self, attendee: Any | None = None, **kwargs) -> None:

caldav/config.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,13 +105,9 @@ def read_config(fn, interactive_error=False):
105105
return yaml.load(config_file, yaml.Loader)
106106
except (yaml.scanner.ScannerError, yaml.parser.ParserError) as e:
107107
# Re-raise YAML errors so they can be handled by caller
108-
raise ValueError(
109-
f"config file {fn} is neither valid JSON nor YAML: {e}"
110-
) from e
108+
raise ValueError(f"config file {fn} is neither valid JSON nor YAML: {e}") from e
111109
except ImportError:
112-
raise ValueError(
113-
f"config file {fn} is not valid JSON, and pyyaml is not installed"
114-
)
110+
raise ValueError(f"config file {fn} is not valid JSON, and pyyaml is not installed")
115111

116112
except FileNotFoundError:
117113
## File not found

caldav/davclient.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ def __init__(
263263
# Strip "compatibility_hints." prefix if present
264264
feature_name = features
265265
if feature_name.startswith("compatibility_hints."):
266-
feature_name = feature_name[len("compatibility_hints."):]
266+
feature_name = feature_name[len("compatibility_hints.") :]
267267
features = getattr(caldav.compatibility_hints, feature_name)
268268
self.features = FeatureSet(features)
269269
self.huge_tree = huge_tree

caldav/davobject.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def __init__(
9696
self.url = None
9797
else:
9898
self.url = URL.objectify(url)
99-
assert not ' ' in str(self.url)
99+
assert " " not in str(self.url)
100100

101101
@property
102102
def canonical_url(self) -> str:

tests/test_async_integration.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -207,9 +207,7 @@ async def async_task_list(self, async_client: Any) -> Any:
207207
# Check if server supports mixed calendars
208208
supports_mixed = True
209209
if hasattr(async_client, "features") and async_client.features:
210-
supports_mixed = async_client.features.is_supported(
211-
"save-load.todo.mixed-calendar"
212-
)
210+
supports_mixed = async_client.features.is_supported("save-load.todo.mixed-calendar")
213211

214212
calendar_name = f"async-task-list-{datetime.now().strftime('%Y%m%d%H%M%S%f')}"
215213

tests/test_caldav.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,14 @@
5050
# RFC6638 users for scheduling tests - loaded from config file
5151
_config = load_test_server_config()
5252
rfc6638_users = _config.get("rfc6638_users", [])
53+
from caldav import Calendar, DAVObject, Event, FreeBusy, Principal, Todo
5354
from caldav.compatibility_hints import (
5455
incompatibility_description,
5556
) ## TEMP - should be removed in the future
5657
from caldav.davclient import CONNKEYS, DAVClient, DAVResponse
5758
from caldav.elements import cdav, dav, ical
5859
from caldav.lib import error
5960
from caldav.lib.python_utilities import to_local, to_str
60-
from caldav import Calendar, DAVObject, Event, FreeBusy, Principal, Todo
6161
from caldav.search import CalDAVSearcher
6262

6363
log = logging.getLogger("caldav")

tests/test_servers/config_loader.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,11 @@ def _load_config_file(path: str) -> dict[str, dict[str, Any]]:
7979
try:
8080
cfg = read_config(path)
8181
except Exception as e:
82-
raise ConfigParseError(
83-
f"Config file '{path}' exists but could not be parsed: {e}"
84-
) from e
82+
raise ConfigParseError(f"Config file '{path}' exists but could not be parsed: {e}") from e
8583

8684
if not cfg:
8785
raise ConfigParseError(
88-
f"Config file '{path}' exists but could not be parsed. "
89-
"Check the YAML/JSON syntax."
86+
f"Config file '{path}' exists but could not be parsed. Check the YAML/JSON syntax."
9087
)
9188

9289
cfg = expand_env_vars(cfg)

tests/test_servers/registry.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,7 @@ def load_from_config(self, config: dict) -> None:
157157
server = server_class(server_config)
158158
self.register(server)
159159
except Exception as e:
160-
raise ValueError(
161-
f"Server '{name}': failed to create server instance: {e}"
162-
) from e
160+
raise ValueError(f"Server '{name}': failed to create server instance: {e}") from e
163161

164162
def auto_discover(self) -> None:
165163
"""
@@ -281,6 +279,7 @@ def get_registry() -> ServerRegistry:
281279
except Exception as e:
282280
# Log unexpected errors but don't silently ignore them
283281
import warnings
282+
284283
warnings.warn(
285284
f"Failed to load test server configuration: {e}. "
286285
"Check tests/caldav_test_servers.yaml for errors.",

tests/test_servers/test_config_loader.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def test_invalid_json_and_yaml_raises_error(self, tmp_path: Path) -> None:
4949
"""Test that content invalid as both JSON and YAML raises ConfigParseError."""
5050
config_file = tmp_path / "test_servers.json"
5151
# This is invalid for both JSON and YAML parsers
52-
config_file.write_text('{{{{invalid syntax}}}}')
52+
config_file.write_text("{{{{invalid syntax}}}}")
5353
with pytest.raises(ConfigParseError) as exc_info:
5454
load_test_server_config(str(config_file))
5555
assert "could not be parsed" in str(exc_info.value)

0 commit comments

Comments
 (0)