Skip to content

Commit

Permalink
update vendored dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
dimbleby committed Dec 10, 2022
1 parent c42f5a2 commit bea666e
Show file tree
Hide file tree
Showing 53 changed files with 2,316 additions and 11,513 deletions.
9 changes: 7 additions & 2 deletions src/poetry/core/_vendor/jsonschema/_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class FormatChecker:
tuple[_FormatCheckCallable, _RaisesType],
] = {}

def __init__(self, formats: typing.Iterable[str] = None):
def __init__(self, formats: typing.Iterable[str] | None = None):
if formats is None:
formats = self.checkers.keys()
self.checkers = {k: self.checkers[k] for k in formats}
Expand Down Expand Up @@ -454,6 +454,9 @@ def is_relative_json_pointer(instance: object) -> bool:
# https://tools.ietf.org/html/draft-handrews-relative-json-pointer-01#section-3
if not isinstance(instance, str):
return True
if not instance:
return False

non_negative_integer, rest = [], ""
for i, character in enumerate(instance):
if character.isdigit():
Expand Down Expand Up @@ -498,7 +501,9 @@ def is_uri_template(instance: object) -> bool:
def is_duration(instance: object) -> bool:
if not isinstance(instance, str):
return True
return bool(isoduration.parse_duration(instance))
isoduration.parse_duration(instance)
# FIXME: See bolsote/isoduration#25 and bolsote/isoduration#21
return instance.endswith(tuple("DMYWHMS"))


@_checks_drafts(
Expand Down
25 changes: 17 additions & 8 deletions src/poetry/core/_vendor/jsonschema/_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,23 +435,32 @@ def unevaluatedItems(validator, unevaluatedItems, instance, schema):
def unevaluatedProperties(validator, unevaluatedProperties, instance, schema):
if not validator.is_type(instance, "object"):
return
evaluated_property_keys = find_evaluated_property_keys_by_schema(
evaluated_keys = find_evaluated_property_keys_by_schema(
validator, instance, schema,
)
unevaluated_property_keys = []
unevaluated_keys = []
for property in instance:
if property not in evaluated_property_keys:
if property not in evaluated_keys:
for _ in validator.descend(
instance[property],
unevaluatedProperties,
path=property,
schema_path=property,
):
unevaluated_property_keys.append(property)

if unevaluated_property_keys:
error = "Unevaluated properties are not allowed (%s %s unexpected)"
yield ValidationError(error % extras_msg(unevaluated_property_keys))
# FIXME: Include context for each unevaluated property
# indicating why it's invalid under the subschema.
unevaluated_keys.append(property)

if unevaluated_keys:
if unevaluatedProperties is False:
error = "Unevaluated properties are not allowed (%s %s unexpected)"
yield ValidationError(error % extras_msg(unevaluated_keys))
else:
error = (
"Unevaluated properties are not valid under "
"the given schema (%s %s unevaluated and invalid)"
)
yield ValidationError(error % extras_msg(unevaluated_keys))


def prefixItems(validator, prefixItems, instance, schema):
Expand Down
3 changes: 2 additions & 1 deletion src/poetry/core/_vendor/jsonschema/protocols.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
# but use `jsonschema` for any types which will otherwise not be resolvable
if TYPE_CHECKING:
import jsonschema
import jsonschema.validators

from jsonschema.exceptions import ValidationError

Expand Down Expand Up @@ -107,7 +108,7 @@ class Validator(Protocol):
def __init__(
self,
schema: Mapping | bool,
resolver: jsonschema.RefResolver | None = None,
resolver: jsonschema.validators.RefResolver | None = None,
format_checker: jsonschema.FormatChecker | None = None,
) -> None:
...
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"$schema": "https://json-schema.org/draft/2019-09/schema",
"$id": "https://json-schema.org/draft/2019-09/meta/applicator",
"$vocabulary": {
"https://json-schema.org/draft/2019-09/vocab/applicator": true
},
"$recursiveAnchor": true,

"title": "Applicator vocabulary meta-schema",
"type": ["object", "boolean"],
"properties": {
"additionalItems": { "$recursiveRef": "#" },
"unevaluatedItems": { "$recursiveRef": "#" },
"items": {
"anyOf": [
{ "$recursiveRef": "#" },
{ "$ref": "#/$defs/schemaArray" }
]
},
"contains": { "$recursiveRef": "#" },
"additionalProperties": { "$recursiveRef": "#" },
"unevaluatedProperties": { "$recursiveRef": "#" },
"properties": {
"type": "object",
"additionalProperties": { "$recursiveRef": "#" },
"default": {}
},
"patternProperties": {
"type": "object",
"additionalProperties": { "$recursiveRef": "#" },
"propertyNames": { "format": "regex" },
"default": {}
},
"dependentSchemas": {
"type": "object",
"additionalProperties": {
"$recursiveRef": "#"
}
},
"propertyNames": { "$recursiveRef": "#" },
"if": { "$recursiveRef": "#" },
"then": { "$recursiveRef": "#" },
"else": { "$recursiveRef": "#" },
"allOf": { "$ref": "#/$defs/schemaArray" },
"anyOf": { "$ref": "#/$defs/schemaArray" },
"oneOf": { "$ref": "#/$defs/schemaArray" },
"not": { "$recursiveRef": "#" }
},
"$defs": {
"schemaArray": {
"type": "array",
"minItems": 1,
"items": { "$recursiveRef": "#" }
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"$schema": "https://json-schema.org/draft/2019-09/schema",
"$id": "https://json-schema.org/draft/2019-09/meta/content",
"$vocabulary": {
"https://json-schema.org/draft/2019-09/vocab/content": true
},
"$recursiveAnchor": true,

"title": "Content vocabulary meta-schema",

"type": ["object", "boolean"],
"properties": {
"contentMediaType": { "type": "string" },
"contentEncoding": { "type": "string" },
"contentSchema": { "$recursiveRef": "#" }
}
}
Loading

0 comments on commit bea666e

Please sign in to comment.