Skip to content

Commit 22d4eae

Browse files
chore: Replace darglint with Ruff's implementation of pydoclint (#2590)
1 parent 9e7f71b commit 22d4eae

File tree

8 files changed

+32
-59
lines changed

8 files changed

+32
-59
lines changed

.flake8

Lines changed: 0 additions & 10 deletions
This file was deleted.

.pre-commit-config.yaml

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ repos:
5050
- id: check-readthedocs
5151

5252
- repo: https://github.com/astral-sh/ruff-pre-commit
53-
rev: v0.5.6
53+
rev: v0.5.7
5454
hooks:
5555
- id: ruff
5656
args: [--fix, --exit-non-zero-on-fix, --show-fixes]
@@ -64,18 +64,6 @@ repos:
6464
cookiecutter/.*
6565
)$
6666
67-
- repo: https://github.com/pycqa/flake8
68-
rev: 7.1.1
69-
hooks:
70-
- id: flake8
71-
additional_dependencies:
72-
- darglint==1.8.1
73-
files: |
74-
(?x)^(
75-
singer_sdk/.*|
76-
samples/.*
77-
)$
78-
7967
- repo: https://github.com/python-poetry/poetry
8068
rev: 1.8.0
8169
hooks:

pyproject.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,7 @@ select = [
314314
"E", # pycodestyle (error)
315315
"W", # pycodestyle (warning)
316316
"C90", # mccabe
317+
"DOC", # pydocstyle
317318
"I", # isort
318319
"N", # pep8-naming
319320
"D", # pydocstyle/flake8-docstrings
@@ -373,6 +374,7 @@ unfixable = [
373374
"ANN",
374375
"D1",
375376
"D2",
377+
"DOC",
376378
"FBT001",
377379
"FBT003",
378380
"PLR2004",
@@ -381,8 +383,10 @@ unfixable = [
381383
"PLC2701", # Allow usage of private members in tests
382384
"PLR6301", # Don't suggest making test methods static, etc.
383385
]
386+
# Disabled some checks in helper modules
387+
"singer_sdk/helpers/_*.py" = ["DOC"]
384388
# Disabled some checks in samples code
385-
"samples/*" = ["ANN", "D"]
389+
"samples/*" = ["ANN", "D", "DOC"]
386390
# Templates support a generic resource of type Any.
387391
"singer_sdk/testing/*.py" = ["S101"]
388392
"singer_sdk/testing/templates.py" = ["ANN401"]

singer_sdk/_singerlib/catalog.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ def get_standard_metadata(
199199
else:
200200
entry = Metadata(inclusion=Metadata.InclusionType.AVAILABLE)
201201

202-
mapping[("properties", field_name)] = entry
202+
mapping["properties", field_name] = entry
203203

204204
mapping[()] = root
205205

singer_sdk/streams/core.py

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,11 @@ def get_starting_timestamp(
277277
and datetime replication keys. For non-datetime replication keys, use
278278
:meth:`~singer_sdk.Stream.get_starting_replication_key_value()`
279279
280+
.. note::
281+
282+
This method requires :attr:`~singer_sdk.Stream.replication_key` to be set
283+
to a non-null value, indicating the stream should be synced incrementally.
284+
280285
Args:
281286
context: Stream partition or context dictionary.
282287
@@ -285,11 +290,6 @@ def get_starting_timestamp(
285290
286291
Raises:
287292
ValueError: If the replication value is not a valid timestamp.
288-
289-
.. note::
290-
291-
This method requires :attr:`~singer_sdk.Stream.replication_key` to be set
292-
to a non-null value, indicating the stream should be synced incrementally.
293293
"""
294294
value = self.get_starting_replication_key_value(context)
295295

@@ -358,9 +358,6 @@ def _write_replication_key_signpost(
358358
Args:
359359
context: Stream partition or context dictionary.
360360
value: TODO
361-
362-
Returns:
363-
TODO
364361
"""
365362
if not value:
366363
return
@@ -1175,9 +1172,6 @@ def sync(self, context: types.Context | None = None) -> None:
11751172
11761173
Args:
11771174
context: Stream partition or context dictionary.
1178-
1179-
Raises:
1180-
Exception: Any exception raised by the sync process.
11811175
"""
11821176
msg = f"Beginning {self.replication_method.lower()} sync of '{self.name}'"
11831177
if context:

singer_sdk/target_base.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -242,9 +242,6 @@ def add_sink(
242242
243243
Returns:
244244
A new sink for the stream.
245-
246-
Raises:
247-
Exception: If sink setup fails.
248245
"""
249246
self.logger.info("Initializing '%s' target sink...", self.name)
250247
sink_class = self.get_sink_class(stream_name=stream_name)

tests/_singerlib/test_catalog.py

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -86,19 +86,19 @@ def test_selection_mask():
8686
assert mask[()] is True
8787

8888
# Explicitly deselected
89-
assert mask[("properties", "id")] is False
89+
assert mask["properties", "id"] is False
9090

9191
# Missing defaults to parent selection
92-
assert mask[("properties", "name")] is True
92+
assert mask["properties", "name"] is True
9393

9494
# Explicitly selected
95-
assert mask[("properties", "an_object")] is False
95+
assert mask["properties", "an_object"] is False
9696

9797
# Missing defaults to parent selection
98-
assert mask[("properties", "an_object", "properties", "id")] is False
98+
assert mask["properties", "an_object", "properties", "id"] is False
9999

100100
# Explicitly selected nested property
101-
assert mask[("properties", "an_object", "properties", "a_string")] is True
101+
assert mask["properties", "an_object", "properties", "a_string"] is True
102102

103103

104104
def test_metadata_mapping():
@@ -112,27 +112,27 @@ def test_metadata_mapping():
112112
forced_replication_method="FULL_TABLE",
113113
)
114114
)
115-
assert mapping[("properties", "id")] == Metadata(
115+
assert mapping["properties", "id"] == Metadata(
116116
inclusion=Metadata.InclusionType.AUTOMATIC,
117117
selected=True,
118118
)
119-
assert mapping[("properties", "name")] == Metadata(
119+
assert mapping["properties", "name"] == Metadata(
120120
inclusion=Metadata.InclusionType.AVAILABLE,
121121
selected=True,
122122
)
123-
assert mapping[("properties", "missing")] == Metadata()
123+
assert mapping["properties", "missing"] == Metadata()
124124

125125
selection_mask = mapping.resolve_selection()
126126
assert selection_mask[()] is True
127-
assert selection_mask[("properties", "id")] is True
128-
assert selection_mask[("properties", "updated_at")] is True
129-
assert selection_mask[("properties", "name")] is True
130-
assert selection_mask[("properties", "missing")] is True
131-
assert selection_mask[("properties", "an_object")] is False
132-
assert selection_mask[("properties", "an_object", "properties", "nested")] is False
133-
assert selection_mask[("properties", "not_supported_selected")] is False
134-
assert selection_mask[("properties", "not_supported_not_selected")] is False
135-
assert selection_mask[("properties", "selected_by_default")] is True
127+
assert selection_mask["properties", "id"] is True
128+
assert selection_mask["properties", "updated_at"] is True
129+
assert selection_mask["properties", "name"] is True
130+
assert selection_mask["properties", "missing"] is True
131+
assert selection_mask["properties", "an_object"] is False
132+
assert selection_mask["properties", "an_object", "properties", "nested"] is False
133+
assert selection_mask["properties", "not_supported_selected"] is False
134+
assert selection_mask["properties", "not_supported_not_selected"] is False
135+
assert selection_mask["properties", "selected_by_default"] is True
136136

137137

138138
def test_empty_metadata_mapping():
@@ -264,11 +264,11 @@ def test_standard_metadata(
264264
assert stream_metadata.schema_name == schema_name
265265

266266
for pk in key_properties:
267-
pk_metadata = metadata[("properties", pk)]
267+
pk_metadata = metadata["properties", pk]
268268
assert pk_metadata.inclusion == Metadata.InclusionType.AUTOMATIC
269269
assert pk_metadata.selected is None
270270

271271
for rk in valid_replication_keys or []:
272-
rk_metadata = metadata[("properties", rk)]
272+
rk_metadata = metadata["properties", rk]
273273
assert rk_metadata.inclusion == Metadata.InclusionType.AUTOMATIC
274274
assert rk_metadata.selected is None

tests/samples/test_tap_countries.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ def tally_messages(messages: list) -> t.Counter:
140140
assert counter["SCHEMA", "countries"] == 1
141141
assert counter["BATCH", "countries"] == 1
142142

143-
assert counter[("STATE",)] == 3
143+
assert counter["STATE",] == 3
144144

145145

146146
@pytest.mark.snapshot

0 commit comments

Comments
 (0)