Skip to content

Commit

Permalink
docs: Don't use RST syntax in Python comments
Browse files Browse the repository at this point in the history
  • Loading branch information
jpmckinney committed Dec 15, 2024
1 parent c097737 commit 8b5b185
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ def main(file, tag, clobber, keep, verbose):
if not verbose:
warnings.filterwarnings("ignore", category=VersionedReleaseTypeWarning)

# Replace package-level ``$ref``s, like in ``records``.
# Replace package-level `$ref`s, like in `records`.
package_schema = replace_refs(
getattr(builder, f"{package_type}_package_schema")(embed=True, patched=patched)
)
Expand Down
16 changes: 8 additions & 8 deletions ocdskit/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def get_schema_fields(
nonmultilingual_pattern_properties = {}

required = schema.get('required', [])
# ``deprecated`` and ``whole_list_merge`` are inherited.
# `deprecated` and `whole_list_merge` are inherited.
deprecated = deprecated or _deprecated(schema)
whole_list_merge = whole_list_merge or schema.get('wholeListMerge', False)

Expand All @@ -101,12 +101,12 @@ def get_schema_fields(
):
multilingual.add(pattern[offset:end])
break
# Set ``multilingual`` on corresponding ``properties``. Yield remaining ``patternProperties``.
# Set `multilingual` on corresponding `properties`. Yield remaining `patternProperties`.
else:
nonmultilingual_pattern_properties[pattern] = subschema

if items := schema.get('items'):
# ``items`` advances the pointer and sets array context (for the next level only).
# `items` advances the pointer and sets array context (for the next level only).
yield from get_schema_fields(
items,
f'{pointer}/items',
Expand Down Expand Up @@ -161,7 +161,7 @@ def get_schema_fields(
merge_by_id=name == 'id' and array and not whole_list_merge,
)

# ``properties`` advances the pointer and path.
# `properties` advances the pointer and path.
yield from get_schema_fields(
subschema,
prop_pointer,
Expand All @@ -171,7 +171,7 @@ def get_schema_fields(
whole_list_merge=whole_list_merge,
)

# Yield ``patternProperties`` last, to be interpreted in the context of ``properties``.
# Yield `patternProperties` last, to be interpreted in the context of `properties`.
for name, subschema in nonmultilingual_pattern_properties.items():
prop_pointer = f'{pointer}/patternProperties/{name}'
prop_path_components = (*path_components, name)
Expand All @@ -186,10 +186,10 @@ def get_schema_fields(
deprecated_self=prop_deprecated,
deprecated=deprecated or prop_deprecated,
pattern=True,
# ``patternProperties`` can't be multilingual, required, or "id".
# `patternProperties` can't be multilingual, required, or "id".
)

# ``patternProperties`` advances the ppinter and path.
# `patternProperties` advances the ppinter and path.
yield from get_schema_fields(
subschema,
prop_pointer,
Expand All @@ -199,7 +199,7 @@ def get_schema_fields(
whole_list_merge=whole_list_merge,
)

# ``definitions`` is canonically only at the top level.
# `definitions` is canonically only at the top level.
if not pointer:
# Yield definitions last, to be interpreted in the context of other top-level properties.
for keyword in ('definitions', '$defs'):
Expand Down
10 changes: 5 additions & 5 deletions tests/test_regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
REMOVE = {"compiledRelease", "records", "releases", "value", "versionedRelease"}

EXCEPTIONS = {
# guatecompras/ocds_partyDetails_publicEntitiesLevelDetails_extension sets ``type`` to "object" but sets ``items``.
# guatecompras/ocds_partyDetails_publicEntitiesLevelDetails_extension sets `type` to "object" but sets `items`.
("complaints", "intervenients", "details", "entityType", "id"),
("complaints", "intervenients", "details", "legalEntityTypeDetail", "id"),
("complaints", "intervenients", "details", "level", "id"),
Expand Down Expand Up @@ -85,7 +85,7 @@ def test_schema_dict_fields_generator(scenario, package_type):
actual = {
f"/{'/'.join(field.path_components)}"
for field in get_schema_fields(schema)
# libcove doesn't support ``patternProperties``.
# libcove doesn't support `patternProperties`.
if not field.pattern
}

Expand All @@ -106,9 +106,9 @@ def test_get_schema_non_required_ids(scenario, package_type):
for field in get_schema_fields(schema)
if field.merge_by_id
and not field.required
# libcove doesn't support ``oneOf``.
# libcove doesn't support `oneOf`.
and field.path_components[:2] != ("records", "releases")
# libcove trusts ``type``, instead of using ``properties`` and ``items``.
# libcove trusts `type`, instead of using `properties` and `items`.
and tuple(c for c in field.path_components if c not in REMOVE) not in EXCEPTIONS
}

Expand All @@ -128,7 +128,7 @@ def test_get_schema_deprecated_paths(scenario, package_type):
field.path_components: [field.deprecated_self["deprecatedVersion"], field.deprecated_self["description"]]
for field in get_schema_fields(schema)
if field.deprecated
# libcove doesn't support ``oneOf``.
# libcove doesn't support `oneOf`.
and field.path_components[:2] != ("records", "releases")
# libcove doesn't inherit deprecation.
and field.deprecated_self
Expand Down

0 comments on commit 8b5b185

Please sign in to comment.