增加环绕侦察场景适配
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -13,7 +13,7 @@ from jsonschema.exceptions import FormatError
|
||||
_FormatCheckCallable = typing.Callable[[object], bool]
|
||||
#: A format checker callable.
|
||||
_F = typing.TypeVar("_F", bound=_FormatCheckCallable)
|
||||
_RaisesType = typing.Union[type[Exception], tuple[type[Exception], ...]]
|
||||
_RaisesType = type[Exception] | tuple[type[Exception], ...]
|
||||
|
||||
_RE_DATE = re.compile(r"^\d{4}-\d{2}-\d{2}$", re.ASCII)
|
||||
|
||||
|
||||
@@ -9,8 +9,8 @@ from rpds import HashTrieMap
|
||||
from jsonschema.exceptions import UndefinedTypeCheck
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from collections.abc import Mapping
|
||||
from typing import Any, Callable
|
||||
from collections.abc import Callable, Mapping
|
||||
from typing import Any
|
||||
|
||||
|
||||
# unfortunately, the type of HashTrieMap is generic, and if used as an attrs
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
"""
|
||||
Some (initially private) typing helpers for jsonschema's types.
|
||||
"""
|
||||
from collections.abc import Iterable
|
||||
from typing import Any, Callable, Protocol, Union
|
||||
from collections.abc import Callable, Iterable
|
||||
from typing import Any, Protocol
|
||||
|
||||
import referencing.jsonschema
|
||||
|
||||
@@ -20,7 +20,7 @@ class SchemaKeywordValidator(Protocol):
|
||||
...
|
||||
|
||||
|
||||
id_of = Callable[[referencing.jsonschema.Schema], Union[str, None]]
|
||||
id_of = Callable[[referencing.jsonschema.Schema], str | None]
|
||||
|
||||
|
||||
ApplicableValidators = Callable[
|
||||
|
||||
@@ -321,7 +321,7 @@ class TestBestMatch(TestCase):
|
||||
|
||||
def test_one_error(self):
|
||||
validator = _LATEST_VERSION({"minProperties": 2})
|
||||
error, = validator.iter_errors({})
|
||||
validator.iter_errors({})
|
||||
self.assertEqual(
|
||||
exceptions.best_match(validator.iter_errors({})).validator,
|
||||
"minProperties",
|
||||
|
||||
@@ -2379,11 +2379,9 @@ class TestRefResolver(TestCase):
|
||||
self.assertEqual(url, "http://bar")
|
||||
yield BytesIO(json.dumps(schema).encode("utf8"))
|
||||
|
||||
self.addCleanup(setattr, validators, "urlopen", validators.urlopen)
|
||||
validators.urlopen = fake_urlopen
|
||||
|
||||
with self.resolver.resolving(ref) as resolved:
|
||||
pass
|
||||
with mock.patch("urllib.request.urlopen", new=fake_urlopen): # noqa: SIM117
|
||||
with self.resolver.resolving(ref) as resolved:
|
||||
pass
|
||||
self.assertEqual(resolved, 12)
|
||||
|
||||
def test_it_retrieves_local_refs_via_urlopen(self):
|
||||
|
||||
@@ -9,7 +9,6 @@ from functools import lru_cache
|
||||
from operator import methodcaller
|
||||
from typing import TYPE_CHECKING
|
||||
from urllib.parse import unquote, urldefrag, urljoin, urlsplit
|
||||
from urllib.request import urlopen
|
||||
from warnings import warn
|
||||
import contextlib
|
||||
import json
|
||||
@@ -1225,6 +1224,7 @@ class _RefResolver:
|
||||
result = requests.get(uri).json()
|
||||
else:
|
||||
# Otherwise, pass off to urllib and assume utf-8
|
||||
from urllib.request import urlopen
|
||||
with urlopen(uri) as url: # noqa: S310
|
||||
result = json.loads(url.read().decode("utf-8"))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user