diff --git a/.gitattributes b/.gitattributes index 7fcb22213bc884723ab8e2184bc27fc8c7b53dd1..68a653c765ee2160ee2c8fb097e3d24026a2e1c5 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1586,3 +1586,4 @@ parrot/lib/python3.10/site-packages/scipy/signal/_peak_finding_utils.cpython-310 parrot/lib/python3.10/site-packages/scipy/interpolate/_dfitpack.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text parrot/lib/python3.10/site-packages/scipy/signal/tests/__pycache__/test_filter_design.cpython-310.pyc filter=lfs diff=lfs merge=lfs -text parrot/lib/python3.10/site-packages/scipy/stats/__pycache__/_continuous_distns.cpython-310.pyc filter=lfs diff=lfs merge=lfs -text +vllm/lib/python3.10/site-packages/functorch/_C.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text diff --git a/vllm/lib/python3.10/site-packages/functorch/_C.cpython-310-x86_64-linux-gnu.so b/vllm/lib/python3.10/site-packages/functorch/_C.cpython-310-x86_64-linux-gnu.so new file mode 100644 index 0000000000000000000000000000000000000000..bec054f026d93c4030a1a27636879fc9832ea179 --- /dev/null +++ b/vllm/lib/python3.10/site-packages/functorch/_C.cpython-310-x86_64-linux-gnu.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9d3fe8b0579d327f70965aa4078078ec8a9c0a71741bcbced65b3db69b79522c +size 320240 diff --git a/vllm/lib/python3.10/site-packages/pydantic/parse.py b/vllm/lib/python3.10/site-packages/pydantic/parse.py new file mode 100644 index 0000000000000000000000000000000000000000..68b7f0464ece32edfb955eec0cb24655752716d6 --- /dev/null +++ b/vllm/lib/python3.10/site-packages/pydantic/parse.py @@ -0,0 +1,5 @@ +"""The `parse` module is a backport module from V1.""" + +from ._migration import getattr_migration + +__getattr__ = getattr_migration(__name__) diff --git a/vllm/lib/python3.10/site-packages/pydantic/type_adapter.py b/vllm/lib/python3.10/site-packages/pydantic/type_adapter.py new file mode 100644 index 0000000000000000000000000000000000000000..b32c05cd3c4bd4afeeabcdc9b02a83f81ce7b7ef --- /dev/null +++ b/vllm/lib/python3.10/site-packages/pydantic/type_adapter.py @@ -0,0 +1,676 @@ +"""Type adapter specification.""" + +from __future__ import annotations as _annotations + +import sys +from dataclasses import is_dataclass +from types import FrameType +from typing import ( + Any, + Generic, + Iterable, + Literal, + TypeVar, + cast, + final, + overload, +) + +from pydantic_core import CoreSchema, SchemaSerializer, SchemaValidator, Some +from typing_extensions import ParamSpec, is_typeddict + +from pydantic.errors import PydanticUserError +from pydantic.main import BaseModel, IncEx + +from ._internal import _config, _generate_schema, _mock_val_ser, _namespace_utils, _repr, _typing_extra, _utils +from .config import ConfigDict +from .errors import PydanticUndefinedAnnotation +from .json_schema import ( + DEFAULT_REF_TEMPLATE, + GenerateJsonSchema, + JsonSchemaKeyT, + JsonSchemaMode, + JsonSchemaValue, +) +from .plugin._schema_validator import PluggableSchemaValidator, create_schema_validator + +T = TypeVar('T') +R = TypeVar('R') +P = ParamSpec('P') +TypeAdapterT = TypeVar('TypeAdapterT', bound='TypeAdapter') + + +def _getattr_no_parents(obj: Any, attribute: str) -> Any: + """Returns the attribute value without attempting to look up attributes from parent types.""" + if hasattr(obj, '__dict__'): + try: + return obj.__dict__[attribute] + except KeyError: + pass + + slots = getattr(obj, '__slots__', None) + if slots is not None and attribute in slots: + return getattr(obj, attribute) + else: + raise AttributeError(attribute) + + +def _type_has_config(type_: Any) -> bool: + """Returns whether the type has config.""" + type_ = _typing_extra.annotated_type(type_) or type_ + try: + return issubclass(type_, BaseModel) or is_dataclass(type_) or is_typeddict(type_) + except TypeError: + # type is not a class + return False + + +@final +class TypeAdapter(Generic[T]): + """Usage docs: https://docs.pydantic.dev/2.10/concepts/type_adapter/ + + Type adapters provide a flexible way to perform validation and serialization based on a Python type. + + A `TypeAdapter` instance exposes some of the functionality from `BaseModel` instance methods + for types that do not have such methods (such as dataclasses, primitive types, and more). + + **Note:** `TypeAdapter` instances are not types, and cannot be used as type annotations for fields. + + Args: + type: The type associated with the `TypeAdapter`. + config: Configuration for the `TypeAdapter`, should be a dictionary conforming to + [`ConfigDict`][pydantic.config.ConfigDict]. + + !!! note + You cannot provide a configuration when instantiating a `TypeAdapter` if the type you're using + has its own config that cannot be overridden (ex: `BaseModel`, `TypedDict`, and `dataclass`). A + [`type-adapter-config-unused`](../errors/usage_errors.md#type-adapter-config-unused) error will + be raised in this case. + _parent_depth: Depth at which to search for the [parent frame][frame-objects]. This frame is used when + resolving forward annotations during schema building, by looking for the globals and locals of this + frame. Defaults to 2, which will result in the frame where the `TypeAdapter` was instantiated. + + !!! note + This parameter is named with an underscore to suggest its private nature and discourage use. + It may be deprecated in a minor version, so we only recommend using it if you're comfortable + with potential change in behavior/support. It's default value is 2 because internally, + the `TypeAdapter` class makes another call to fetch the frame. + module: The module that passes to plugin if provided. + + Attributes: + core_schema: The core schema for the type. + validator: The schema validator for the type. + serializer: The schema serializer for the type. + pydantic_complete: Whether the core schema for the type is successfully built. + + ??? tip "Compatibility with `mypy`" + Depending on the type used, `mypy` might raise an error when instantiating a `TypeAdapter`. As a workaround, you can explicitly + annotate your variable: + + ```py + from typing import Union + + from pydantic import TypeAdapter + + ta: TypeAdapter[Union[str, int]] = TypeAdapter(Union[str, int]) # type: ignore[arg-type] + ``` + + ??? info "Namespace management nuances and implementation details" + + Here, we collect some notes on namespace management, and subtle differences from `BaseModel`: + + `BaseModel` uses its own `__module__` to find out where it was defined + and then looks for symbols to resolve forward references in those globals. + On the other hand, `TypeAdapter` can be initialized with arbitrary objects, + which may not be types and thus do not have a `__module__` available. + So instead we look at the globals in our parent stack frame. + + It is expected that the `ns_resolver` passed to this function will have the correct + namespace for the type we're adapting. See the source code for `TypeAdapter.__init__` + and `TypeAdapter.rebuild` for various ways to construct this namespace. + + This works for the case where this function is called in a module that + has the target of forward references in its scope, but + does not always work for more complex cases. + + For example, take the following: + + ```python {title="a.py"} + from typing import Dict, List + + IntList = List[int] + OuterDict = Dict[str, 'IntList'] + ``` + + ```python {test="skip" title="b.py"} + from a import OuterDict + + from pydantic import TypeAdapter + + IntList = int # replaces the symbol the forward reference is looking for + v = TypeAdapter(OuterDict) + v({'x': 1}) # should fail but doesn't + ``` + + If `OuterDict` were a `BaseModel`, this would work because it would resolve + the forward reference within the `a.py` namespace. + But `TypeAdapter(OuterDict)` can't determine what module `OuterDict` came from. + + In other words, the assumption that _all_ forward references exist in the + module we are being called from is not technically always true. + Although most of the time it is and it works fine for recursive models and such, + `BaseModel`'s behavior isn't perfect either and _can_ break in similar ways, + so there is no right or wrong between the two. + + But at the very least this behavior is _subtly_ different from `BaseModel`'s. + """ + + core_schema: CoreSchema + validator: SchemaValidator | PluggableSchemaValidator + serializer: SchemaSerializer + pydantic_complete: bool + + @overload + def __init__( + self, + type: type[T], + *, + config: ConfigDict | None = ..., + _parent_depth: int = ..., + module: str | None = ..., + ) -> None: ... + + # This second overload is for unsupported special forms (such as Annotated, Union, etc.) + # Currently there is no way to type this correctly + # See https://github.com/python/typing/pull/1618 + @overload + def __init__( + self, + type: Any, + *, + config: ConfigDict | None = ..., + _parent_depth: int = ..., + module: str | None = ..., + ) -> None: ... + + def __init__( + self, + type: Any, + *, + config: ConfigDict | None = None, + _parent_depth: int = 2, + module: str | None = None, + ) -> None: + if _type_has_config(type) and config is not None: + raise PydanticUserError( + 'Cannot use `config` when the type is a BaseModel, dataclass or TypedDict.' + ' These types can have their own config and setting the config via the `config`' + ' parameter to TypeAdapter will not override it, thus the `config` you passed to' + ' TypeAdapter becomes meaningless, which is probably not what you want.', + code='type-adapter-config-unused', + ) + + self._type = type + self._config = config + self._parent_depth = _parent_depth + self.pydantic_complete = False + + parent_frame = self._fetch_parent_frame() + if parent_frame is not None: + globalns = parent_frame.f_globals + # Do not provide a local ns if the type adapter happens to be instantiated at the module level: + localns = parent_frame.f_locals if parent_frame.f_locals is not globalns else {} + else: + globalns = {} + localns = {} + + self._module_name = module or cast(str, globalns.get('__name__', '')) + self._init_core_attrs( + ns_resolver=_namespace_utils.NsResolver( + namespaces_tuple=_namespace_utils.NamespacesTuple(locals=localns, globals=globalns), + parent_namespace=localns, + ), + force=False, + ) + + def _fetch_parent_frame(self) -> FrameType | None: + frame = sys._getframe(self._parent_depth) + if frame.f_globals.get('__name__') == 'typing': + # Because `TypeAdapter` is generic, explicitly parametrizing the class results + # in a `typing._GenericAlias` instance, which proxies instantiation calls to the + # "real" `TypeAdapter` class and thus adding an extra frame to the call. To avoid + # pulling anything from the `typing` module, use the correct frame (the one before): + return frame.f_back + + return frame + + def _init_core_attrs( + self, ns_resolver: _namespace_utils.NsResolver, force: bool, raise_errors: bool = False + ) -> bool: + """Initialize the core schema, validator, and serializer for the type. + + Args: + ns_resolver: The namespace resolver to use when building the core schema for the adapted type. + force: Whether to force the construction of the core schema, validator, and serializer. + If `force` is set to `False` and `_defer_build` is `True`, the core schema, validator, and serializer will be set to mocks. + raise_errors: Whether to raise errors if initializing any of the core attrs fails. + + Returns: + `True` if the core schema, validator, and serializer were successfully initialized, otherwise `False`. + + Raises: + PydanticUndefinedAnnotation: If `PydanticUndefinedAnnotation` occurs in`__get_pydantic_core_schema__` + and `raise_errors=True`. + """ + if not force and self._defer_build: + _mock_val_ser.set_type_adapter_mocks(self, str(self._type)) + self.pydantic_complete = False + return False + + try: + self.core_schema = _getattr_no_parents(self._type, '__pydantic_core_schema__') + self.validator = _getattr_no_parents(self._type, '__pydantic_validator__') + self.serializer = _getattr_no_parents(self._type, '__pydantic_serializer__') + + # TODO: we don't go through the rebuild logic here directly because we don't want + # to repeat all of the namespace fetching logic that we've already done + # so we simply skip to the block below that does the actual schema generation + if ( + isinstance(self.core_schema, _mock_val_ser.MockCoreSchema) + or isinstance(self.validator, _mock_val_ser.MockValSer) + or isinstance(self.serializer, _mock_val_ser.MockValSer) + ): + raise AttributeError() + except AttributeError: + config_wrapper = _config.ConfigWrapper(self._config) + + schema_generator = _generate_schema.GenerateSchema(config_wrapper, ns_resolver=ns_resolver) + + try: + core_schema = schema_generator.generate_schema(self._type) + except PydanticUndefinedAnnotation: + if raise_errors: + raise + _mock_val_ser.set_type_adapter_mocks(self, str(self._type)) + return False + + try: + self.core_schema = schema_generator.clean_schema(core_schema) + except schema_generator.CollectedInvalid: + _mock_val_ser.set_type_adapter_mocks(self, str(self._type)) + return False + + core_config = config_wrapper.core_config(None) + + self.validator = create_schema_validator( + schema=self.core_schema, + schema_type=self._type, + schema_type_module=self._module_name, + schema_type_name=str(self._type), + schema_kind='TypeAdapter', + config=core_config, + plugin_settings=config_wrapper.plugin_settings, + ) + self.serializer = SchemaSerializer(self.core_schema, core_config) + + self.pydantic_complete = True + return True + + @property + def _defer_build(self) -> bool: + config = self._config if self._config is not None else self._model_config + if config: + return config.get('defer_build') is True + return False + + @property + def _model_config(self) -> ConfigDict | None: + type_: Any = _typing_extra.annotated_type(self._type) or self._type # Eg FastAPI heavily uses Annotated + if _utils.lenient_issubclass(type_, BaseModel): + return type_.model_config + return getattr(type_, '__pydantic_config__', None) + + def __repr__(self) -> str: + return f'TypeAdapter({_repr.display_as_type(self._type)})' + + def rebuild( + self, + *, + force: bool = False, + raise_errors: bool = True, + _parent_namespace_depth: int = 2, + _types_namespace: _namespace_utils.MappingNamespace | None = None, + ) -> bool | None: + """Try to rebuild the pydantic-core schema for the adapter's type. + + This may be necessary when one of the annotations is a ForwardRef which could not be resolved during + the initial attempt to build the schema, and automatic rebuilding fails. + + Args: + force: Whether to force the rebuilding of the type adapter's schema, defaults to `False`. + raise_errors: Whether to raise errors, defaults to `True`. + _parent_namespace_depth: Depth at which to search for the [parent frame][frame-objects]. This + frame is used when resolving forward annotations during schema rebuilding, by looking for + the locals of this frame. Defaults to 2, which will result in the frame where the method + was called. + _types_namespace: An explicit types namespace to use, instead of using the local namespace + from the parent frame. Defaults to `None`. + + Returns: + Returns `None` if the schema is already "complete" and rebuilding was not required. + If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. + """ + if not force and self.pydantic_complete: + return None + + if _types_namespace is not None: + rebuild_ns = _types_namespace + elif _parent_namespace_depth > 0: + rebuild_ns = _typing_extra.parent_frame_namespace(parent_depth=_parent_namespace_depth, force=True) or {} + else: + rebuild_ns = {} + + # we have to manually fetch globals here because there's no type on the stack of the NsResolver + # and so we skip the globalns = get_module_ns_of(typ) call that would normally happen + globalns = sys._getframe(max(_parent_namespace_depth - 1, 1)).f_globals + ns_resolver = _namespace_utils.NsResolver( + namespaces_tuple=_namespace_utils.NamespacesTuple(locals=rebuild_ns, globals=globalns), + parent_namespace=rebuild_ns, + ) + return self._init_core_attrs(ns_resolver=ns_resolver, force=True, raise_errors=raise_errors) + + def validate_python( + self, + object: Any, + /, + *, + strict: bool | None = None, + from_attributes: bool | None = None, + context: dict[str, Any] | None = None, + experimental_allow_partial: bool | Literal['off', 'on', 'trailing-strings'] = False, + ) -> T: + """Validate a Python object against the model. + + Args: + object: The Python object to validate against the model. + strict: Whether to strictly check types. + from_attributes: Whether to extract data from object attributes. + context: Additional context to pass to the validator. + experimental_allow_partial: **Experimental** whether to enable + [partial validation](../concepts/experimental.md#partial-validation), e.g. to process streams. + * False / 'off': Default behavior, no partial validation. + * True / 'on': Enable partial validation. + * 'trailing-strings': Enable partial validation and allow trailing strings in the input. + + !!! note + When using `TypeAdapter` with a Pydantic `dataclass`, the use of the `from_attributes` + argument is not supported. + + Returns: + The validated object. + """ + return self.validator.validate_python( + object, + strict=strict, + from_attributes=from_attributes, + context=context, + allow_partial=experimental_allow_partial, + ) + + def validate_json( + self, + data: str | bytes | bytearray, + /, + *, + strict: bool | None = None, + context: dict[str, Any] | None = None, + experimental_allow_partial: bool | Literal['off', 'on', 'trailing-strings'] = False, + ) -> T: + """Usage docs: https://docs.pydantic.dev/2.10/concepts/json/#json-parsing + + Validate a JSON string or bytes against the model. + + Args: + data: The JSON data to validate against the model. + strict: Whether to strictly check types. + context: Additional context to use during validation. + experimental_allow_partial: **Experimental** whether to enable + [partial validation](../concepts/experimental.md#partial-validation), e.g. to process streams. + * False / 'off': Default behavior, no partial validation. + * True / 'on': Enable partial validation. + * 'trailing-strings': Enable partial validation and allow trailing strings in the input. + + Returns: + The validated object. + """ + return self.validator.validate_json( + data, strict=strict, context=context, allow_partial=experimental_allow_partial + ) + + def validate_strings( + self, + obj: Any, + /, + *, + strict: bool | None = None, + context: dict[str, Any] | None = None, + experimental_allow_partial: bool | Literal['off', 'on', 'trailing-strings'] = False, + ) -> T: + """Validate object contains string data against the model. + + Args: + obj: The object contains string data to validate. + strict: Whether to strictly check types. + context: Additional context to use during validation. + experimental_allow_partial: **Experimental** whether to enable + [partial validation](../concepts/experimental.md#partial-validation), e.g. to process streams. + * False / 'off': Default behavior, no partial validation. + * True / 'on': Enable partial validation. + * 'trailing-strings': Enable partial validation and allow trailing strings in the input. + + Returns: + The validated object. + """ + return self.validator.validate_strings( + obj, strict=strict, context=context, allow_partial=experimental_allow_partial + ) + + def get_default_value(self, *, strict: bool | None = None, context: dict[str, Any] | None = None) -> Some[T] | None: + """Get the default value for the wrapped type. + + Args: + strict: Whether to strictly check types. + context: Additional context to pass to the validator. + + Returns: + The default value wrapped in a `Some` if there is one or None if not. + """ + return self.validator.get_default_value(strict=strict, context=context) + + def dump_python( + self, + instance: T, + /, + *, + mode: Literal['json', 'python'] = 'python', + include: IncEx | None = None, + exclude: IncEx | None = None, + by_alias: bool = False, + exclude_unset: bool = False, + exclude_defaults: bool = False, + exclude_none: bool = False, + round_trip: bool = False, + warnings: bool | Literal['none', 'warn', 'error'] = True, + serialize_as_any: bool = False, + context: dict[str, Any] | None = None, + ) -> Any: + """Dump an instance of the adapted type to a Python object. + + Args: + instance: The Python object to serialize. + mode: The output format. + include: Fields to include in the output. + exclude: Fields to exclude from the output. + by_alias: Whether to use alias names for field names. + exclude_unset: Whether to exclude unset fields. + exclude_defaults: Whether to exclude fields with default values. + exclude_none: Whether to exclude fields with None values. + round_trip: Whether to output the serialized data in a way that is compatible with deserialization. + warnings: How to handle serialization errors. False/"none" ignores them, True/"warn" logs errors, + "error" raises a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError]. + serialize_as_any: Whether to serialize fields with duck-typing serialization behavior. + context: Additional context to pass to the serializer. + + Returns: + The serialized object. + """ + return self.serializer.to_python( + instance, + mode=mode, + by_alias=by_alias, + include=include, + exclude=exclude, + exclude_unset=exclude_unset, + exclude_defaults=exclude_defaults, + exclude_none=exclude_none, + round_trip=round_trip, + warnings=warnings, + serialize_as_any=serialize_as_any, + context=context, + ) + + def dump_json( + self, + instance: T, + /, + *, + indent: int | None = None, + include: IncEx | None = None, + exclude: IncEx | None = None, + by_alias: bool = False, + exclude_unset: bool = False, + exclude_defaults: bool = False, + exclude_none: bool = False, + round_trip: bool = False, + warnings: bool | Literal['none', 'warn', 'error'] = True, + serialize_as_any: bool = False, + context: dict[str, Any] | None = None, + ) -> bytes: + """Usage docs: https://docs.pydantic.dev/2.10/concepts/json/#json-serialization + + Serialize an instance of the adapted type to JSON. + + Args: + instance: The instance to be serialized. + indent: Number of spaces for JSON indentation. + include: Fields to include. + exclude: Fields to exclude. + by_alias: Whether to use alias names for field names. + exclude_unset: Whether to exclude unset fields. + exclude_defaults: Whether to exclude fields with default values. + exclude_none: Whether to exclude fields with a value of `None`. + round_trip: Whether to serialize and deserialize the instance to ensure round-tripping. + warnings: How to handle serialization errors. False/"none" ignores them, True/"warn" logs errors, + "error" raises a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError]. + serialize_as_any: Whether to serialize fields with duck-typing serialization behavior. + context: Additional context to pass to the serializer. + + Returns: + The JSON representation of the given instance as bytes. + """ + return self.serializer.to_json( + instance, + indent=indent, + include=include, + exclude=exclude, + by_alias=by_alias, + exclude_unset=exclude_unset, + exclude_defaults=exclude_defaults, + exclude_none=exclude_none, + round_trip=round_trip, + warnings=warnings, + serialize_as_any=serialize_as_any, + context=context, + ) + + def json_schema( + self, + *, + by_alias: bool = True, + ref_template: str = DEFAULT_REF_TEMPLATE, + schema_generator: type[GenerateJsonSchema] = GenerateJsonSchema, + mode: JsonSchemaMode = 'validation', + ) -> dict[str, Any]: + """Generate a JSON schema for the adapted type. + + Args: + by_alias: Whether to use alias names for field names. + ref_template: The format string used for generating $ref strings. + schema_generator: The generator class used for creating the schema. + mode: The mode to use for schema generation. + + Returns: + The JSON schema for the model as a dictionary. + """ + schema_generator_instance = schema_generator(by_alias=by_alias, ref_template=ref_template) + if isinstance(self.core_schema, _mock_val_ser.MockCoreSchema): + self.core_schema.rebuild() + assert not isinstance(self.core_schema, _mock_val_ser.MockCoreSchema), 'this is a bug! please report it' + return schema_generator_instance.generate(self.core_schema, mode=mode) + + @staticmethod + def json_schemas( + inputs: Iterable[tuple[JsonSchemaKeyT, JsonSchemaMode, TypeAdapter[Any]]], + /, + *, + by_alias: bool = True, + title: str | None = None, + description: str | None = None, + ref_template: str = DEFAULT_REF_TEMPLATE, + schema_generator: type[GenerateJsonSchema] = GenerateJsonSchema, + ) -> tuple[dict[tuple[JsonSchemaKeyT, JsonSchemaMode], JsonSchemaValue], JsonSchemaValue]: + """Generate a JSON schema including definitions from multiple type adapters. + + Args: + inputs: Inputs to schema generation. The first two items will form the keys of the (first) + output mapping; the type adapters will provide the core schemas that get converted into + definitions in the output JSON schema. + by_alias: Whether to use alias names. + title: The title for the schema. + description: The description for the schema. + ref_template: The format string used for generating $ref strings. + schema_generator: The generator class used for creating the schema. + + Returns: + A tuple where: + + - The first element is a dictionary whose keys are tuples of JSON schema key type and JSON mode, and + whose values are the JSON schema corresponding to that pair of inputs. (These schemas may have + JsonRef references to definitions that are defined in the second returned element.) + - The second element is a JSON schema containing all definitions referenced in the first returned + element, along with the optional title and description keys. + + """ + schema_generator_instance = schema_generator(by_alias=by_alias, ref_template=ref_template) + + inputs_ = [] + for key, mode, adapter in inputs: + # This is the same pattern we follow for model json schemas - we attempt a core schema rebuild if we detect a mock + if isinstance(adapter.core_schema, _mock_val_ser.MockCoreSchema): + adapter.core_schema.rebuild() + assert not isinstance( + adapter.core_schema, _mock_val_ser.MockCoreSchema + ), 'this is a bug! please report it' + inputs_.append((key, mode, adapter.core_schema)) + + json_schemas_map, definitions = schema_generator_instance.generate_definitions(inputs_) + + json_schema: dict[str, Any] = {} + if definitions: + json_schema['$defs'] = definitions + if title: + json_schema['title'] = title + if description: + json_schema['description'] = description + + return json_schemas_map, json_schema diff --git a/vllm/lib/python3.10/site-packages/pydantic/validators.py b/vllm/lib/python3.10/site-packages/pydantic/validators.py new file mode 100644 index 0000000000000000000000000000000000000000..7921b04f05d5ef0ad20365e7372a48d86724dc51 --- /dev/null +++ b/vllm/lib/python3.10/site-packages/pydantic/validators.py @@ -0,0 +1,5 @@ +"""The `validators` module is a backport module from V1.""" + +from ._migration import getattr_migration + +__getattr__ = getattr_migration(__name__) diff --git a/vllm/lib/python3.10/site-packages/rich/__pycache__/__main__.cpython-310.pyc b/vllm/lib/python3.10/site-packages/rich/__pycache__/__main__.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..db9682ad80d1ff5670c256042b37eb5a6c6d4599 Binary files /dev/null and b/vllm/lib/python3.10/site-packages/rich/__pycache__/__main__.cpython-310.pyc differ diff --git a/vllm/lib/python3.10/site-packages/rich/__pycache__/_cell_widths.cpython-310.pyc b/vllm/lib/python3.10/site-packages/rich/__pycache__/_cell_widths.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5f86710a116ebc2b03a17c23afdd7ca55cd97814 Binary files /dev/null and b/vllm/lib/python3.10/site-packages/rich/__pycache__/_cell_widths.cpython-310.pyc differ diff --git a/vllm/lib/python3.10/site-packages/rich/__pycache__/_emoji_replace.cpython-310.pyc b/vllm/lib/python3.10/site-packages/rich/__pycache__/_emoji_replace.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..23bea43485ca1eb46ae35bf4e3feed527ebf98d5 Binary files /dev/null and b/vllm/lib/python3.10/site-packages/rich/__pycache__/_emoji_replace.cpython-310.pyc differ diff --git a/vllm/lib/python3.10/site-packages/rich/__pycache__/_export_format.cpython-310.pyc b/vllm/lib/python3.10/site-packages/rich/__pycache__/_export_format.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..66898a9f6097ea72984e64f27d745045673d693e Binary files /dev/null and b/vllm/lib/python3.10/site-packages/rich/__pycache__/_export_format.cpython-310.pyc differ diff --git a/vllm/lib/python3.10/site-packages/rich/__pycache__/_extension.cpython-310.pyc b/vllm/lib/python3.10/site-packages/rich/__pycache__/_extension.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..cd6ae2d0634c430bce31731f886044e188db8a58 Binary files /dev/null and b/vllm/lib/python3.10/site-packages/rich/__pycache__/_extension.cpython-310.pyc differ diff --git a/vllm/lib/python3.10/site-packages/rich/__pycache__/_fileno.cpython-310.pyc b/vllm/lib/python3.10/site-packages/rich/__pycache__/_fileno.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7ac150879ce9b287651b824de4f073265268335e Binary files /dev/null and b/vllm/lib/python3.10/site-packages/rich/__pycache__/_fileno.cpython-310.pyc differ diff --git a/vllm/lib/python3.10/site-packages/rich/__pycache__/_inspect.cpython-310.pyc b/vllm/lib/python3.10/site-packages/rich/__pycache__/_inspect.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..bbf5ccbb85c928e5775f5ba3adb4c196c77af9b0 Binary files /dev/null and b/vllm/lib/python3.10/site-packages/rich/__pycache__/_inspect.cpython-310.pyc differ diff --git a/vllm/lib/python3.10/site-packages/rich/__pycache__/_log_render.cpython-310.pyc b/vllm/lib/python3.10/site-packages/rich/__pycache__/_log_render.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..fce10cbdb8002fcea6cb2f43bfdc487b0aeae8d5 Binary files /dev/null and b/vllm/lib/python3.10/site-packages/rich/__pycache__/_log_render.cpython-310.pyc differ diff --git a/vllm/lib/python3.10/site-packages/rich/__pycache__/_null_file.cpython-310.pyc b/vllm/lib/python3.10/site-packages/rich/__pycache__/_null_file.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d7a942ed37c9602eea822def0c3955bd0f78415e Binary files /dev/null and b/vllm/lib/python3.10/site-packages/rich/__pycache__/_null_file.cpython-310.pyc differ diff --git a/vllm/lib/python3.10/site-packages/rich/__pycache__/_palettes.cpython-310.pyc b/vllm/lib/python3.10/site-packages/rich/__pycache__/_palettes.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..407771a855d8d0b637a190c3ef3b610cc120a13e Binary files /dev/null and b/vllm/lib/python3.10/site-packages/rich/__pycache__/_palettes.cpython-310.pyc differ diff --git a/vllm/lib/python3.10/site-packages/rich/__pycache__/_ratio.cpython-310.pyc b/vllm/lib/python3.10/site-packages/rich/__pycache__/_ratio.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..92a903eeaf6fd026bd69ebf55c005a93051f51a4 Binary files /dev/null and b/vllm/lib/python3.10/site-packages/rich/__pycache__/_ratio.cpython-310.pyc differ diff --git a/vllm/lib/python3.10/site-packages/rich/__pycache__/_spinners.cpython-310.pyc b/vllm/lib/python3.10/site-packages/rich/__pycache__/_spinners.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..46c9bc7396bbd43eb05ba187ac6d90d94607a0f6 Binary files /dev/null and b/vllm/lib/python3.10/site-packages/rich/__pycache__/_spinners.cpython-310.pyc differ diff --git a/vllm/lib/python3.10/site-packages/rich/__pycache__/_stack.cpython-310.pyc b/vllm/lib/python3.10/site-packages/rich/__pycache__/_stack.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..44b76f7ffda33907879633d5708b2b2696e20b9b Binary files /dev/null and b/vllm/lib/python3.10/site-packages/rich/__pycache__/_stack.cpython-310.pyc differ diff --git a/vllm/lib/python3.10/site-packages/rich/__pycache__/_timer.cpython-310.pyc b/vllm/lib/python3.10/site-packages/rich/__pycache__/_timer.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..586f45299656dfcf801b935f2fe1240d7b587699 Binary files /dev/null and b/vllm/lib/python3.10/site-packages/rich/__pycache__/_timer.cpython-310.pyc differ diff --git a/vllm/lib/python3.10/site-packages/rich/__pycache__/_win32_console.cpython-310.pyc b/vllm/lib/python3.10/site-packages/rich/__pycache__/_win32_console.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..704c0d849f68d5d884cb5e16232f583fc8b3d87e Binary files /dev/null and b/vllm/lib/python3.10/site-packages/rich/__pycache__/_win32_console.cpython-310.pyc differ diff --git a/vllm/lib/python3.10/site-packages/rich/__pycache__/_windows.cpython-310.pyc b/vllm/lib/python3.10/site-packages/rich/__pycache__/_windows.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..81bae94827a52ee88fe26f0a94b06adf656e1194 Binary files /dev/null and b/vllm/lib/python3.10/site-packages/rich/__pycache__/_windows.cpython-310.pyc differ diff --git a/vllm/lib/python3.10/site-packages/rich/__pycache__/_windows_renderer.cpython-310.pyc b/vllm/lib/python3.10/site-packages/rich/__pycache__/_windows_renderer.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1d61cbef244512e728526174862e7b61f2a0903a Binary files /dev/null and b/vllm/lib/python3.10/site-packages/rich/__pycache__/_windows_renderer.cpython-310.pyc differ diff --git a/vllm/lib/python3.10/site-packages/rich/__pycache__/_wrap.cpython-310.pyc b/vllm/lib/python3.10/site-packages/rich/__pycache__/_wrap.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..27d703229568a6dee1a03e5ee4075e5f1133207b Binary files /dev/null and b/vllm/lib/python3.10/site-packages/rich/__pycache__/_wrap.cpython-310.pyc differ diff --git a/vllm/lib/python3.10/site-packages/rich/__pycache__/abc.cpython-310.pyc b/vllm/lib/python3.10/site-packages/rich/__pycache__/abc.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..038c9bea91ff227a66442f0c5a2e681a00115739 Binary files /dev/null and b/vllm/lib/python3.10/site-packages/rich/__pycache__/abc.cpython-310.pyc differ diff --git a/vllm/lib/python3.10/site-packages/rich/__pycache__/align.cpython-310.pyc b/vllm/lib/python3.10/site-packages/rich/__pycache__/align.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7890e1900effa394ed3e683485b73bd317bd64a3 Binary files /dev/null and b/vllm/lib/python3.10/site-packages/rich/__pycache__/align.cpython-310.pyc differ diff --git a/vllm/lib/python3.10/site-packages/rich/__pycache__/ansi.cpython-310.pyc b/vllm/lib/python3.10/site-packages/rich/__pycache__/ansi.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..728f1261aaf93b99ba520da5f323513788bf82e7 Binary files /dev/null and b/vllm/lib/python3.10/site-packages/rich/__pycache__/ansi.cpython-310.pyc differ diff --git a/vllm/lib/python3.10/site-packages/rich/__pycache__/bar.cpython-310.pyc b/vllm/lib/python3.10/site-packages/rich/__pycache__/bar.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1e972de264c14393f4b0fbe6b9d903f7a538e9e1 Binary files /dev/null and b/vllm/lib/python3.10/site-packages/rich/__pycache__/bar.cpython-310.pyc differ diff --git a/vllm/lib/python3.10/site-packages/rich/__pycache__/box.cpython-310.pyc b/vllm/lib/python3.10/site-packages/rich/__pycache__/box.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8fb28787dc6aa927af4045a1ea1595c09483c24e Binary files /dev/null and b/vllm/lib/python3.10/site-packages/rich/__pycache__/box.cpython-310.pyc differ diff --git a/vllm/lib/python3.10/site-packages/rich/__pycache__/cells.cpython-310.pyc b/vllm/lib/python3.10/site-packages/rich/__pycache__/cells.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ca409b5e4af1ef1e8170d3c51a8a384b228fda29 Binary files /dev/null and b/vllm/lib/python3.10/site-packages/rich/__pycache__/cells.cpython-310.pyc differ diff --git a/vllm/lib/python3.10/site-packages/rich/__pycache__/color.cpython-310.pyc b/vllm/lib/python3.10/site-packages/rich/__pycache__/color.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f653c642b9cd5ea99238fee4b567c4348188d42c Binary files /dev/null and b/vllm/lib/python3.10/site-packages/rich/__pycache__/color.cpython-310.pyc differ diff --git a/vllm/lib/python3.10/site-packages/rich/__pycache__/color_triplet.cpython-310.pyc b/vllm/lib/python3.10/site-packages/rich/__pycache__/color_triplet.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..183ad34d78c4a1b32d0f322079f515b083b9aa54 Binary files /dev/null and b/vllm/lib/python3.10/site-packages/rich/__pycache__/color_triplet.cpython-310.pyc differ diff --git a/vllm/lib/python3.10/site-packages/rich/__pycache__/columns.cpython-310.pyc b/vllm/lib/python3.10/site-packages/rich/__pycache__/columns.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1f99fba127b8520da4b56cbb5d36d389c832c4a2 Binary files /dev/null and b/vllm/lib/python3.10/site-packages/rich/__pycache__/columns.cpython-310.pyc differ diff --git a/vllm/lib/python3.10/site-packages/rich/__pycache__/constrain.cpython-310.pyc b/vllm/lib/python3.10/site-packages/rich/__pycache__/constrain.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..065a66877d04100b06e9e7a6ffbc3631d1bd4b1b Binary files /dev/null and b/vllm/lib/python3.10/site-packages/rich/__pycache__/constrain.cpython-310.pyc differ diff --git a/vllm/lib/python3.10/site-packages/rich/__pycache__/containers.cpython-310.pyc b/vllm/lib/python3.10/site-packages/rich/__pycache__/containers.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f4d141fd65e0968151fe7a9f07973be63aeb5c93 Binary files /dev/null and b/vllm/lib/python3.10/site-packages/rich/__pycache__/containers.cpython-310.pyc differ diff --git a/vllm/lib/python3.10/site-packages/rich/__pycache__/control.cpython-310.pyc b/vllm/lib/python3.10/site-packages/rich/__pycache__/control.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..fe8a03dc86083f7aa508b36753efd9caaed6b229 Binary files /dev/null and b/vllm/lib/python3.10/site-packages/rich/__pycache__/control.cpython-310.pyc differ diff --git a/vllm/lib/python3.10/site-packages/rich/__pycache__/diagnose.cpython-310.pyc b/vllm/lib/python3.10/site-packages/rich/__pycache__/diagnose.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7ac4c355b6b4391bb89c07a7a13d7596b7a9d80f Binary files /dev/null and b/vllm/lib/python3.10/site-packages/rich/__pycache__/diagnose.cpython-310.pyc differ diff --git a/vllm/lib/python3.10/site-packages/rich/__pycache__/emoji.cpython-310.pyc b/vllm/lib/python3.10/site-packages/rich/__pycache__/emoji.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c01776b8265626f237dabba44846e3fc7e7da67a Binary files /dev/null and b/vllm/lib/python3.10/site-packages/rich/__pycache__/emoji.cpython-310.pyc differ diff --git a/vllm/lib/python3.10/site-packages/rich/__pycache__/errors.cpython-310.pyc b/vllm/lib/python3.10/site-packages/rich/__pycache__/errors.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d62694653db8c975a46a57930a5cd9319e348f39 Binary files /dev/null and b/vllm/lib/python3.10/site-packages/rich/__pycache__/errors.cpython-310.pyc differ diff --git a/vllm/lib/python3.10/site-packages/rich/__pycache__/file_proxy.cpython-310.pyc b/vllm/lib/python3.10/site-packages/rich/__pycache__/file_proxy.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5c5e854814d911620c53c6d2effa5d36e4494b1a Binary files /dev/null and b/vllm/lib/python3.10/site-packages/rich/__pycache__/file_proxy.cpython-310.pyc differ diff --git a/vllm/lib/python3.10/site-packages/rich/__pycache__/filesize.cpython-310.pyc b/vllm/lib/python3.10/site-packages/rich/__pycache__/filesize.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..cdabb38f487349a348267c746e34521dcdc15dad Binary files /dev/null and b/vllm/lib/python3.10/site-packages/rich/__pycache__/filesize.cpython-310.pyc differ diff --git a/vllm/lib/python3.10/site-packages/rich/__pycache__/highlighter.cpython-310.pyc b/vllm/lib/python3.10/site-packages/rich/__pycache__/highlighter.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f8fba138ef7dec7dce9f240f7108d24a9380ba65 Binary files /dev/null and b/vllm/lib/python3.10/site-packages/rich/__pycache__/highlighter.cpython-310.pyc differ diff --git a/vllm/lib/python3.10/site-packages/rich/__pycache__/jupyter.cpython-310.pyc b/vllm/lib/python3.10/site-packages/rich/__pycache__/jupyter.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..41e156ea4772aec4d16ec88398c7ce07e02ee03c Binary files /dev/null and b/vllm/lib/python3.10/site-packages/rich/__pycache__/jupyter.cpython-310.pyc differ diff --git a/vllm/lib/python3.10/site-packages/rich/__pycache__/layout.cpython-310.pyc b/vllm/lib/python3.10/site-packages/rich/__pycache__/layout.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a9c330445167b55b87ca0f657fc6d5188148302b Binary files /dev/null and b/vllm/lib/python3.10/site-packages/rich/__pycache__/layout.cpython-310.pyc differ diff --git a/vllm/lib/python3.10/site-packages/rich/__pycache__/live.cpython-310.pyc b/vllm/lib/python3.10/site-packages/rich/__pycache__/live.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c4e848b2f90800780fa3c9549a511b3e825e5d59 Binary files /dev/null and b/vllm/lib/python3.10/site-packages/rich/__pycache__/live.cpython-310.pyc differ diff --git a/vllm/lib/python3.10/site-packages/rich/__pycache__/logging.cpython-310.pyc b/vllm/lib/python3.10/site-packages/rich/__pycache__/logging.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..91042dd56c1e2334f0edfee404bbd0b9a74f98e2 Binary files /dev/null and b/vllm/lib/python3.10/site-packages/rich/__pycache__/logging.cpython-310.pyc differ diff --git a/vllm/lib/python3.10/site-packages/rich/__pycache__/markdown.cpython-310.pyc b/vllm/lib/python3.10/site-packages/rich/__pycache__/markdown.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..970aebd7c32b16973b23a736a6cd759c1fbfed5f Binary files /dev/null and b/vllm/lib/python3.10/site-packages/rich/__pycache__/markdown.cpython-310.pyc differ diff --git a/vllm/lib/python3.10/site-packages/rich/__pycache__/markup.cpython-310.pyc b/vllm/lib/python3.10/site-packages/rich/__pycache__/markup.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..cb3da49b6070345123b6535aa96372a4b3574318 Binary files /dev/null and b/vllm/lib/python3.10/site-packages/rich/__pycache__/markup.cpython-310.pyc differ diff --git a/vllm/lib/python3.10/site-packages/rich/__pycache__/measure.cpython-310.pyc b/vllm/lib/python3.10/site-packages/rich/__pycache__/measure.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f9fc0561dee96b6f2703b46cdf799483cf47644e Binary files /dev/null and b/vllm/lib/python3.10/site-packages/rich/__pycache__/measure.cpython-310.pyc differ diff --git a/vllm/lib/python3.10/site-packages/rich/__pycache__/padding.cpython-310.pyc b/vllm/lib/python3.10/site-packages/rich/__pycache__/padding.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..dba19aecd4023edec06c93f6c9b62bf576b85b47 Binary files /dev/null and b/vllm/lib/python3.10/site-packages/rich/__pycache__/padding.cpython-310.pyc differ diff --git a/vllm/lib/python3.10/site-packages/rich/__pycache__/palette.cpython-310.pyc b/vllm/lib/python3.10/site-packages/rich/__pycache__/palette.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..371df19529fff5b6ef12a69eb9fd1e8d19b1f123 Binary files /dev/null and b/vllm/lib/python3.10/site-packages/rich/__pycache__/palette.cpython-310.pyc differ diff --git a/vllm/lib/python3.10/site-packages/rich/__pycache__/panel.cpython-310.pyc b/vllm/lib/python3.10/site-packages/rich/__pycache__/panel.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7750e5c8048a1f28b61094db3c3fb895c56043db Binary files /dev/null and b/vllm/lib/python3.10/site-packages/rich/__pycache__/panel.cpython-310.pyc differ diff --git a/vllm/lib/python3.10/site-packages/rich/__pycache__/progress.cpython-310.pyc b/vllm/lib/python3.10/site-packages/rich/__pycache__/progress.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c0b7212fbf89db05b29552bb45e95d3fc878e40b Binary files /dev/null and b/vllm/lib/python3.10/site-packages/rich/__pycache__/progress.cpython-310.pyc differ diff --git a/vllm/lib/python3.10/site-packages/rich/__pycache__/progress_bar.cpython-310.pyc b/vllm/lib/python3.10/site-packages/rich/__pycache__/progress_bar.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ac34dd25b247b6ef3fdbbdd89b5b793a4ac7274f Binary files /dev/null and b/vllm/lib/python3.10/site-packages/rich/__pycache__/progress_bar.cpython-310.pyc differ diff --git a/vllm/lib/python3.10/site-packages/rich/__pycache__/prompt.cpython-310.pyc b/vllm/lib/python3.10/site-packages/rich/__pycache__/prompt.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e7b4ee2009522903f342742b8dbc1a5e131ab966 Binary files /dev/null and b/vllm/lib/python3.10/site-packages/rich/__pycache__/prompt.cpython-310.pyc differ diff --git a/vllm/lib/python3.10/site-packages/rich/__pycache__/protocol.cpython-310.pyc b/vllm/lib/python3.10/site-packages/rich/__pycache__/protocol.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..85260022335ce7a1309f6272c9864943f14b92d3 Binary files /dev/null and b/vllm/lib/python3.10/site-packages/rich/__pycache__/protocol.cpython-310.pyc differ diff --git a/vllm/lib/python3.10/site-packages/rich/__pycache__/region.cpython-310.pyc b/vllm/lib/python3.10/site-packages/rich/__pycache__/region.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..55bf882ac8385d4767cbdecde68a14f1555fcac1 Binary files /dev/null and b/vllm/lib/python3.10/site-packages/rich/__pycache__/region.cpython-310.pyc differ diff --git a/vllm/lib/python3.10/site-packages/rich/__pycache__/repr.cpython-310.pyc b/vllm/lib/python3.10/site-packages/rich/__pycache__/repr.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4b6ca57262ed704174583cf3efe06a390a0bdb76 Binary files /dev/null and b/vllm/lib/python3.10/site-packages/rich/__pycache__/repr.cpython-310.pyc differ diff --git a/vllm/lib/python3.10/site-packages/rich/__pycache__/rule.cpython-310.pyc b/vllm/lib/python3.10/site-packages/rich/__pycache__/rule.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c5374e73b2380bc9e3d21db3424a86776344188c Binary files /dev/null and b/vllm/lib/python3.10/site-packages/rich/__pycache__/rule.cpython-310.pyc differ diff --git a/vllm/lib/python3.10/site-packages/rich/__pycache__/screen.cpython-310.pyc b/vllm/lib/python3.10/site-packages/rich/__pycache__/screen.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..14cd2ea59f7f7feeb75c586572b21a8d13af274c Binary files /dev/null and b/vllm/lib/python3.10/site-packages/rich/__pycache__/screen.cpython-310.pyc differ diff --git a/vllm/lib/python3.10/site-packages/rich/__pycache__/segment.cpython-310.pyc b/vllm/lib/python3.10/site-packages/rich/__pycache__/segment.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e4fb15690a97c513f730d1dc1c60d99d1279c81d Binary files /dev/null and b/vllm/lib/python3.10/site-packages/rich/__pycache__/segment.cpython-310.pyc differ diff --git a/vllm/lib/python3.10/site-packages/rich/__pycache__/spinner.cpython-310.pyc b/vllm/lib/python3.10/site-packages/rich/__pycache__/spinner.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1761de052c003c7c6039ce25eab68d6f856320c4 Binary files /dev/null and b/vllm/lib/python3.10/site-packages/rich/__pycache__/spinner.cpython-310.pyc differ diff --git a/vllm/lib/python3.10/site-packages/rich/__pycache__/style.cpython-310.pyc b/vllm/lib/python3.10/site-packages/rich/__pycache__/style.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b26b8463b144b24a4b5f45bdecf660c39b432730 Binary files /dev/null and b/vllm/lib/python3.10/site-packages/rich/__pycache__/style.cpython-310.pyc differ diff --git a/vllm/lib/python3.10/site-packages/rich/__pycache__/styled.cpython-310.pyc b/vllm/lib/python3.10/site-packages/rich/__pycache__/styled.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7ac9167fbc368e45915f35867fa4839231aa40d5 Binary files /dev/null and b/vllm/lib/python3.10/site-packages/rich/__pycache__/styled.cpython-310.pyc differ diff --git a/vllm/lib/python3.10/site-packages/rich/__pycache__/syntax.cpython-310.pyc b/vllm/lib/python3.10/site-packages/rich/__pycache__/syntax.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7c57319513c956f8a61135d806fd51be387d5d6d Binary files /dev/null and b/vllm/lib/python3.10/site-packages/rich/__pycache__/syntax.cpython-310.pyc differ diff --git a/vllm/lib/python3.10/site-packages/rich/__pycache__/table.cpython-310.pyc b/vllm/lib/python3.10/site-packages/rich/__pycache__/table.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2578a9a3c4837774b70d786334c467be807afa2d Binary files /dev/null and b/vllm/lib/python3.10/site-packages/rich/__pycache__/table.cpython-310.pyc differ diff --git a/vllm/lib/python3.10/site-packages/rich/__pycache__/text.cpython-310.pyc b/vllm/lib/python3.10/site-packages/rich/__pycache__/text.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..690b868195829ef3c578e9ef39cf5ef494036621 Binary files /dev/null and b/vllm/lib/python3.10/site-packages/rich/__pycache__/text.cpython-310.pyc differ diff --git a/vllm/lib/python3.10/site-packages/rich/__pycache__/theme.cpython-310.pyc b/vllm/lib/python3.10/site-packages/rich/__pycache__/theme.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e7b12dc04c3af5567bf24efa5a02481f8a989af3 Binary files /dev/null and b/vllm/lib/python3.10/site-packages/rich/__pycache__/theme.cpython-310.pyc differ diff --git a/vllm/lib/python3.10/site-packages/rich/__pycache__/themes.cpython-310.pyc b/vllm/lib/python3.10/site-packages/rich/__pycache__/themes.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..dfac9dcbd6afa556b9d1ca0af5bac6bef2fc47e7 Binary files /dev/null and b/vllm/lib/python3.10/site-packages/rich/__pycache__/themes.cpython-310.pyc differ diff --git a/vllm/lib/python3.10/site-packages/rich/__pycache__/traceback.cpython-310.pyc b/vllm/lib/python3.10/site-packages/rich/__pycache__/traceback.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..65d0dc2d0bc4996a63f28aac0e4ff91e5a36aa20 Binary files /dev/null and b/vllm/lib/python3.10/site-packages/rich/__pycache__/traceback.cpython-310.pyc differ diff --git a/vllm/lib/python3.10/site-packages/rich/__pycache__/tree.cpython-310.pyc b/vllm/lib/python3.10/site-packages/rich/__pycache__/tree.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..045595bff47e4f781dd12b0cfdfb5f286f27c1fb Binary files /dev/null and b/vllm/lib/python3.10/site-packages/rich/__pycache__/tree.cpython-310.pyc differ diff --git a/vllm/lib/python3.10/site-packages/rich/bar.py b/vllm/lib/python3.10/site-packages/rich/bar.py new file mode 100644 index 0000000000000000000000000000000000000000..022284b57881d8b133aced5b5a843e6447bb4e0b --- /dev/null +++ b/vllm/lib/python3.10/site-packages/rich/bar.py @@ -0,0 +1,93 @@ +from typing import Optional, Union + +from .color import Color +from .console import Console, ConsoleOptions, RenderResult +from .jupyter import JupyterMixin +from .measure import Measurement +from .segment import Segment +from .style import Style + +# There are left-aligned characters for 1/8 to 7/8, but +# the right-aligned characters exist only for 1/8 and 4/8. +BEGIN_BLOCK_ELEMENTS = ["█", "█", "█", "▐", "▐", "▐", "▕", "▕"] +END_BLOCK_ELEMENTS = [" ", "▏", "▎", "▍", "▌", "▋", "▊", "▉"] +FULL_BLOCK = "█" + + +class Bar(JupyterMixin): + """Renders a solid block bar. + + Args: + size (float): Value for the end of the bar. + begin (float): Begin point (between 0 and size, inclusive). + end (float): End point (between 0 and size, inclusive). + width (int, optional): Width of the bar, or ``None`` for maximum width. Defaults to None. + color (Union[Color, str], optional): Color of the bar. Defaults to "default". + bgcolor (Union[Color, str], optional): Color of bar background. Defaults to "default". + """ + + def __init__( + self, + size: float, + begin: float, + end: float, + *, + width: Optional[int] = None, + color: Union[Color, str] = "default", + bgcolor: Union[Color, str] = "default", + ): + self.size = size + self.begin = max(begin, 0) + self.end = min(end, size) + self.width = width + self.style = Style(color=color, bgcolor=bgcolor) + + def __repr__(self) -> str: + return f"Bar({self.size}, {self.begin}, {self.end})" + + def __rich_console__( + self, console: Console, options: ConsoleOptions + ) -> RenderResult: + width = min( + self.width if self.width is not None else options.max_width, + options.max_width, + ) + + if self.begin >= self.end: + yield Segment(" " * width, self.style) + yield Segment.line() + return + + prefix_complete_eights = int(width * 8 * self.begin / self.size) + prefix_bar_count = prefix_complete_eights // 8 + prefix_eights_count = prefix_complete_eights % 8 + + body_complete_eights = int(width * 8 * self.end / self.size) + body_bar_count = body_complete_eights // 8 + body_eights_count = body_complete_eights % 8 + + # When start and end fall into the same cell, we ideally should render + # a symbol that's "center-aligned", but there is no good symbol in Unicode. + # In this case, we fall back to right-aligned block symbol for simplicity. + + prefix = " " * prefix_bar_count + if prefix_eights_count: + prefix += BEGIN_BLOCK_ELEMENTS[prefix_eights_count] + + body = FULL_BLOCK * body_bar_count + if body_eights_count: + body += END_BLOCK_ELEMENTS[body_eights_count] + + suffix = " " * (width - len(body)) + + yield Segment(prefix + body[len(prefix) :] + suffix, self.style) + yield Segment.line() + + def __rich_measure__( + self, console: Console, options: ConsoleOptions + ) -> Measurement: + return ( + Measurement(self.width, self.width) + if self.width is not None + else Measurement(4, options.max_width) + ) diff --git a/vllm/lib/python3.10/site-packages/rich/box.py b/vllm/lib/python3.10/site-packages/rich/box.py new file mode 100644 index 0000000000000000000000000000000000000000..aa4ada32ed6a9f7813d7eb16f475cee4a1b8caa7 --- /dev/null +++ b/vllm/lib/python3.10/site-packages/rich/box.py @@ -0,0 +1,480 @@ +import sys +from typing import TYPE_CHECKING, Iterable, List + +if sys.version_info >= (3, 8): + from typing import Literal +else: + from typing_extensions import Literal # pragma: no cover + + +from ._loop import loop_last + +if TYPE_CHECKING: + from rich.console import ConsoleOptions + + +class Box: + """Defines characters to render boxes. + + ┌─┬┐ top + │ ││ head + ├─┼┤ head_row + │ ││ mid + ├─┼┤ row + ├─┼┤ foot_row + │ ││ foot + └─┴┘ bottom + + Args: + box (str): Characters making up box. + ascii (bool, optional): True if this box uses ascii characters only. Default is False. + """ + + def __init__(self, box: str, *, ascii: bool = False) -> None: + self._box = box + self.ascii = ascii + line1, line2, line3, line4, line5, line6, line7, line8 = box.splitlines() + # top + self.top_left, self.top, self.top_divider, self.top_right = iter(line1) + # head + self.head_left, _, self.head_vertical, self.head_right = iter(line2) + # head_row + ( + self.head_row_left, + self.head_row_horizontal, + self.head_row_cross, + self.head_row_right, + ) = iter(line3) + + # mid + self.mid_left, _, self.mid_vertical, self.mid_right = iter(line4) + # row + self.row_left, self.row_horizontal, self.row_cross, self.row_right = iter(line5) + # foot_row + ( + self.foot_row_left, + self.foot_row_horizontal, + self.foot_row_cross, + self.foot_row_right, + ) = iter(line6) + # foot + self.foot_left, _, self.foot_vertical, self.foot_right = iter(line7) + # bottom + self.bottom_left, self.bottom, self.bottom_divider, self.bottom_right = iter( + line8 + ) + + def __repr__(self) -> str: + return "Box(...)" + + def __str__(self) -> str: + return self._box + + def substitute(self, options: "ConsoleOptions", safe: bool = True) -> "Box": + """Substitute this box for another if it won't render due to platform issues. + + Args: + options (ConsoleOptions): Console options used in rendering. + safe (bool, optional): Substitute this for another Box if there are known problems + displaying on the platform (currently only relevant on Windows). Default is True. + + Returns: + Box: A different Box or the same Box. + """ + box = self + if options.legacy_windows and safe: + box = LEGACY_WINDOWS_SUBSTITUTIONS.get(box, box) + if options.ascii_only and not box.ascii: + box = ASCII + return box + + def get_plain_headed_box(self) -> "Box": + """If this box uses special characters for the borders of the header, then + return the equivalent box that does not. + + Returns: + Box: The most similar Box that doesn't use header-specific box characters. + If the current Box already satisfies this criterion, then it's returned. + """ + return PLAIN_HEADED_SUBSTITUTIONS.get(self, self) + + def get_top(self, widths: Iterable[int]) -> str: + """Get the top of a simple box. + + Args: + widths (List[int]): Widths of columns. + + Returns: + str: A string of box characters. + """ + + parts: List[str] = [] + append = parts.append + append(self.top_left) + for last, width in loop_last(widths): + append(self.top * width) + if not last: + append(self.top_divider) + append(self.top_right) + return "".join(parts) + + def get_row( + self, + widths: Iterable[int], + level: Literal["head", "row", "foot", "mid"] = "row", + edge: bool = True, + ) -> str: + """Get the top of a simple box. + + Args: + width (List[int]): Widths of columns. + + Returns: + str: A string of box characters. + """ + if level == "head": + left = self.head_row_left + horizontal = self.head_row_horizontal + cross = self.head_row_cross + right = self.head_row_right + elif level == "row": + left = self.row_left + horizontal = self.row_horizontal + cross = self.row_cross + right = self.row_right + elif level == "mid": + left = self.mid_left + horizontal = " " + cross = self.mid_vertical + right = self.mid_right + elif level == "foot": + left = self.foot_row_left + horizontal = self.foot_row_horizontal + cross = self.foot_row_cross + right = self.foot_row_right + else: + raise ValueError("level must be 'head', 'row' or 'foot'") + + parts: List[str] = [] + append = parts.append + if edge: + append(left) + for last, width in loop_last(widths): + append(horizontal * width) + if not last: + append(cross) + if edge: + append(right) + return "".join(parts) + + def get_bottom(self, widths: Iterable[int]) -> str: + """Get the bottom of a simple box. + + Args: + widths (List[int]): Widths of columns. + + Returns: + str: A string of box characters. + """ + + parts: List[str] = [] + append = parts.append + append(self.bottom_left) + for last, width in loop_last(widths): + append(self.bottom * width) + if not last: + append(self.bottom_divider) + append(self.bottom_right) + return "".join(parts) + + +# fmt: off +ASCII: Box = Box( + "+--+\n" + "| ||\n" + "|-+|\n" + "| ||\n" + "|-+|\n" + "|-+|\n" + "| ||\n" + "+--+\n", + ascii=True, +) + +ASCII2: Box = Box( + "+-++\n" + "| ||\n" + "+-++\n" + "| ||\n" + "+-++\n" + "+-++\n" + "| ||\n" + "+-++\n", + ascii=True, +) + +ASCII_DOUBLE_HEAD: Box = Box( + "+-++\n" + "| ||\n" + "+=++\n" + "| ||\n" + "+-++\n" + "+-++\n" + "| ||\n" + "+-++\n", + ascii=True, +) + +SQUARE: Box = Box( + "┌─┬┐\n" + "│ ││\n" + "├─┼┤\n" + "│ ││\n" + "├─┼┤\n" + "├─┼┤\n" + "│ ││\n" + "└─┴┘\n" +) + +SQUARE_DOUBLE_HEAD: Box = Box( + "┌─┬┐\n" + "│ ││\n" + "╞═╪╡\n" + "│ ││\n" + "├─┼┤\n" + "├─┼┤\n" + "│ ││\n" + "└─┴┘\n" +) + +MINIMAL: Box = Box( + " ╷ \n" + " │ \n" + "╶─┼╴\n" + " │ \n" + "╶─┼╴\n" + "╶─┼╴\n" + " │ \n" + " ╵ \n" +) + + +MINIMAL_HEAVY_HEAD: Box = Box( + " ╷ \n" + " │ \n" + "╺━┿╸\n" + " │ \n" + "╶─┼╴\n" + "╶─┼╴\n" + " │ \n" + " ╵ \n" +) + +MINIMAL_DOUBLE_HEAD: Box = Box( + " ╷ \n" + " │ \n" + " ═╪ \n" + " │ \n" + " ─┼ \n" + " ─┼ \n" + " │ \n" + " ╵ \n" +) + + +SIMPLE: Box = Box( + " \n" + " \n" + " ── \n" + " \n" + " \n" + " ── \n" + " \n" + " \n" +) + +SIMPLE_HEAD: Box = Box( + " \n" + " \n" + " ── \n" + " \n" + " \n" + " \n" + " \n" + " \n" +) + + +SIMPLE_HEAVY: Box = Box( + " \n" + " \n" + " ━━ \n" + " \n" + " \n" + " ━━ \n" + " \n" + " \n" +) + + +HORIZONTALS: Box = Box( + " ── \n" + " \n" + " ── \n" + " \n" + " ── \n" + " ── \n" + " \n" + " ── \n" +) + +ROUNDED: Box = Box( + "╭─┬╮\n" + "│ ││\n" + "├─┼┤\n" + "│ ││\n" + "├─┼┤\n" + "├─┼┤\n" + "│ ││\n" + "╰─┴╯\n" +) + +HEAVY: Box = Box( + "┏━┳┓\n" + "┃ ┃┃\n" + "┣━╋┫\n" + "┃ ┃┃\n" + "┣━╋┫\n" + "┣━╋┫\n" + "┃ ┃┃\n" + "┗━┻┛\n" +) + +HEAVY_EDGE: Box = Box( + "┏━┯┓\n" + "┃ │┃\n" + "┠─┼┨\n" + "┃ │┃\n" + "┠─┼┨\n" + "┠─┼┨\n" + "┃ │┃\n" + "┗━┷┛\n" +) + +HEAVY_HEAD: Box = Box( + "┏━┳┓\n" + "┃ ┃┃\n" + "┡━╇┩\n" + "│ ││\n" + "├─┼┤\n" + "├─┼┤\n" + "│ ││\n" + "└─┴┘\n" +) + +DOUBLE: Box = Box( + "╔═╦╗\n" + "║ ║║\n" + "╠═╬╣\n" + "║ ║║\n" + "╠═╬╣\n" + "╠═╬╣\n" + "║ ║║\n" + "╚═╩╝\n" +) + +DOUBLE_EDGE: Box = Box( + "╔═╤╗\n" + "║ │║\n" + "╟─┼╢\n" + "║ │║\n" + "╟─┼╢\n" + "╟─┼╢\n" + "║ │║\n" + "╚═╧╝\n" +) + +MARKDOWN: Box = Box( + " \n" + "| ||\n" + "|-||\n" + "| ||\n" + "|-||\n" + "|-||\n" + "| ||\n" + " \n", + ascii=True, +) +# fmt: on + +# Map Boxes that don't render with raster fonts on to equivalent that do +LEGACY_WINDOWS_SUBSTITUTIONS = { + ROUNDED: SQUARE, + MINIMAL_HEAVY_HEAD: MINIMAL, + SIMPLE_HEAVY: SIMPLE, + HEAVY: SQUARE, + HEAVY_EDGE: SQUARE, + HEAVY_HEAD: SQUARE, +} + +# Map headed boxes to their headerless equivalents +PLAIN_HEADED_SUBSTITUTIONS = { + HEAVY_HEAD: SQUARE, + SQUARE_DOUBLE_HEAD: SQUARE, + MINIMAL_DOUBLE_HEAD: MINIMAL, + MINIMAL_HEAVY_HEAD: MINIMAL, + ASCII_DOUBLE_HEAD: ASCII2, +} + + +if __name__ == "__main__": # pragma: no cover + from rich.columns import Columns + from rich.panel import Panel + + from . import box as box + from .console import Console + from .table import Table + from .text import Text + + console = Console(record=True) + + BOXES = [ + "ASCII", + "ASCII2", + "ASCII_DOUBLE_HEAD", + "SQUARE", + "SQUARE_DOUBLE_HEAD", + "MINIMAL", + "MINIMAL_HEAVY_HEAD", + "MINIMAL_DOUBLE_HEAD", + "SIMPLE", + "SIMPLE_HEAD", + "SIMPLE_HEAVY", + "HORIZONTALS", + "ROUNDED", + "HEAVY", + "HEAVY_EDGE", + "HEAVY_HEAD", + "DOUBLE", + "DOUBLE_EDGE", + "MARKDOWN", + ] + + console.print(Panel("[bold green]Box Constants", style="green"), justify="center") + console.print() + + columns = Columns(expand=True, padding=2) + for box_name in sorted(BOXES): + table = Table( + show_footer=True, style="dim", border_style="not dim", expand=True + ) + table.add_column("Header 1", "Footer 1") + table.add_column("Header 2", "Footer 2") + table.add_row("Cell", "Cell") + table.add_row("Cell", "Cell") + table.box = getattr(box, box_name) + table.title = Text(f"box.{box_name}", style="magenta") + columns.add_renderable(table) + console.print(columns) + + # console.save_svg("box.svg") diff --git a/vllm/lib/python3.10/site-packages/rich/highlighter.py b/vllm/lib/python3.10/site-packages/rich/highlighter.py new file mode 100644 index 0000000000000000000000000000000000000000..e4c462e2b632a268ecfb4772320206b94a3d859c --- /dev/null +++ b/vllm/lib/python3.10/site-packages/rich/highlighter.py @@ -0,0 +1,232 @@ +import re +from abc import ABC, abstractmethod +from typing import List, Union + +from .text import Span, Text + + +def _combine_regex(*regexes: str) -> str: + """Combine a number of regexes in to a single regex. + + Returns: + str: New regex with all regexes ORed together. + """ + return "|".join(regexes) + + +class Highlighter(ABC): + """Abstract base class for highlighters.""" + + def __call__(self, text: Union[str, Text]) -> Text: + """Highlight a str or Text instance. + + Args: + text (Union[str, ~Text]): Text to highlight. + + Raises: + TypeError: If not called with text or str. + + Returns: + Text: A test instance with highlighting applied. + """ + if isinstance(text, str): + highlight_text = Text(text) + elif isinstance(text, Text): + highlight_text = text.copy() + else: + raise TypeError(f"str or Text instance required, not {text!r}") + self.highlight(highlight_text) + return highlight_text + + @abstractmethod + def highlight(self, text: Text) -> None: + """Apply highlighting in place to text. + + Args: + text (~Text): A text object highlight. + """ + + +class NullHighlighter(Highlighter): + """A highlighter object that doesn't highlight. + + May be used to disable highlighting entirely. + + """ + + def highlight(self, text: Text) -> None: + """Nothing to do""" + + +class RegexHighlighter(Highlighter): + """Applies highlighting from a list of regular expressions.""" + + highlights: List[str] = [] + base_style: str = "" + + def highlight(self, text: Text) -> None: + """Highlight :class:`rich.text.Text` using regular expressions. + + Args: + text (~Text): Text to highlighted. + + """ + + highlight_regex = text.highlight_regex + for re_highlight in self.highlights: + highlight_regex(re_highlight, style_prefix=self.base_style) + + +class ReprHighlighter(RegexHighlighter): + """Highlights the text typically produced from ``__repr__`` methods.""" + + base_style = "repr." + highlights = [ + r"(?P<)(?P[-\w.:|]*)(?P[\w\W]*)(?P>)", + r'(?P[\w_]{1,50})=(?P"?[\w_]+"?)?', + r"(?P[][{}()])", + _combine_regex( + r"(?P[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})", + r"(?P([A-Fa-f0-9]{1,4}::?){1,7}[A-Fa-f0-9]{1,4})", + r"(?P(?:[0-9A-Fa-f]{1,2}-){7}[0-9A-Fa-f]{1,2}|(?:[0-9A-Fa-f]{1,2}:){7}[0-9A-Fa-f]{1,2}|(?:[0-9A-Fa-f]{4}\.){3}[0-9A-Fa-f]{4})", + r"(?P(?:[0-9A-Fa-f]{1,2}-){5}[0-9A-Fa-f]{1,2}|(?:[0-9A-Fa-f]{1,2}:){5}[0-9A-Fa-f]{1,2}|(?:[0-9A-Fa-f]{4}\.){2}[0-9A-Fa-f]{4})", + r"(?P[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12})", + r"(?P[\w.]*?)\(", + r"\b(?PTrue)\b|\b(?PFalse)\b|\b(?PNone)\b", + r"(?P\.\.\.)", + r"(?P(?(?\B(/[-\w._+]+)*\/)(?P[-\w._+]*)?", + r"(?b?'''.*?(?(file|https|http|ws|wss)://[-0-9a-zA-Z$_+!`(),.?/;:&=%#~@]*)", + ), + ] + + +class JSONHighlighter(RegexHighlighter): + """Highlights JSON""" + + # Captures the start and end of JSON strings, handling escaped quotes + JSON_STR = r"(?b?\".*?(?[\{\[\(\)\]\}])", + r"\b(?Ptrue)\b|\b(?Pfalse)\b|\b(?Pnull)\b", + r"(?P(? None: + super().highlight(text) + + # Additional work to handle highlighting JSON keys + plain = text.plain + append = text.spans.append + whitespace = self.JSON_WHITESPACE + for match in re.finditer(self.JSON_STR, plain): + start, end = match.span() + cursor = end + while cursor < len(plain): + char = plain[cursor] + cursor += 1 + if char == ":": + append(Span(start, end, "json.key")) + elif char in whitespace: + continue + break + + +class ISO8601Highlighter(RegexHighlighter): + """Highlights the ISO8601 date time strings. + Regex reference: https://www.oreilly.com/library/view/regular-expressions-cookbook/9781449327453/ch04s07.html + """ + + base_style = "iso8601." + highlights = [ + # + # Dates + # + # Calendar month (e.g. 2008-08). The hyphen is required + r"^(?P[0-9]{4})-(?P1[0-2]|0[1-9])$", + # Calendar date w/o hyphens (e.g. 20080830) + r"^(?P(?P[0-9]{4})(?P1[0-2]|0[1-9])(?P3[01]|0[1-9]|[12][0-9]))$", + # Ordinal date (e.g. 2008-243). The hyphen is optional + r"^(?P(?P[0-9]{4})-?(?P36[0-6]|3[0-5][0-9]|[12][0-9]{2}|0[1-9][0-9]|00[1-9]))$", + # + # Weeks + # + # Week of the year (e.g., 2008-W35). The hyphen is optional + r"^(?P(?P[0-9]{4})-?W(?P5[0-3]|[1-4][0-9]|0[1-9]))$", + # Week date (e.g., 2008-W35-6). The hyphens are optional + r"^(?P(?P[0-9]{4})-?W(?P5[0-3]|[1-4][0-9]|0[1-9])-?(?P[1-7]))$", + # + # Times + # + # Hours and minutes (e.g., 17:21). The colon is optional + r"^(?P