Data validation using Python type hints
3371 matches across 15 categories. Click a row to expand file-level details.
| Severity | File | Line | Snippet |
|---|---|---|---|
| LOW | tests/test_assert_in_validators.py | 23 | def test_assert_raises_validation_error(): |
| LOW | tests/test_dunder_all.py | 13 | def test_explicit_reexports_exist() -> None: |
| LOW | tests/test_version.py | 31 | def test_version_attribute_is_present(): |
| LOW | tests/test_version.py | 35 | def test_version_attribute_is_a_string(): |
| LOW | tests/test_version.py | 39 | def test_check_pydantic_core_version() -> None: |
| LOW | tests/test_computed_fields.py | 69 | def test_computed_fields_json_schema(): |
| LOW | tests/test_computed_fields.py | 217 | def test_properties_and_computed_fields(): |
| LOW | tests/test_computed_fields.py | 244 | def test_computed_fields_repr(): |
| LOW | tests/test_computed_fields.py | 426 | def test_private_computed_field(): |
| LOW | tests/test_computed_fields.py | 546 | def test_abstractmethod_missing(bases: tuple[Any, ...]): |
| LOW | tests/test_computed_fields.py | 567 | def __get_pydantic_core_schema__(cls, source: Any, handler: GetCoreSchemaHandler) -> core_schema.CoreSchema: |
| LOW | tests/test_computed_fields.py | 573 | def test_computed_fields_infer_return_type(): |
| LOW | tests/test_computed_fields.py | 583 | def test_computed_fields_missing_return_type(): |
| LOW | tests/test_computed_fields.py | 611 | def my_aliased_computed_field_none(self) -> int: |
| LOW | tests/test_computed_fields.py | 660 | def test_alias_generator_defer_build() -> None: |
| LOW | tests/test_computed_fields.py | 740 | def test_multiple_references_to_schema(model_factory: Callable[[], Any]) -> None: |
| LOW | tests/test_computed_fields.py | 765 | def test_generic_computed_field(): |
| LOW | tests/test_computed_fields.py | 796 | def test_computed_field_override_raises(): |
| LOW | tests/test_computed_fields.py | 812 | def test_computed_field_excluded_from_model_dump_recursive() -> None: |
| LOW | tests/test_computed_fields.py | 828 | def test_computed_field_with_field_serializer(): |
| LOW | tests/test_computed_fields.py | 844 | def test_computed_fields_exclude() -> None: |
| LOW | tests/test_computed_fields.py | 859 | def test_computed_fields_serialization_exclude_if() -> None: |
| LOW | tests/test_computed_fields.py | 881 | def test_computed_fields_serialization_exclude_if_from_annotated() -> None: |
| LOW | tests/test_v1.py | 34 | def test_isinstance_does_not_raise_deprecation_warnings(): |
| LOW | tests/test_utils.py | 39 | def test_import_module_invalid(): |
| LOW | tests/test_utils.py | 94 | def test_lenient_issubclass_with_generic_aliases(): |
| LOW | tests/test_utils.py | 101 | def test_lenient_issubclass_is_lenient(): |
| LOW | tests/test_utils.py | 318 | def test_deep_update_is_not_mutating(): |
| LOW | tests/test_utils.py | 364 | def test_smart_deepcopy_immutable_non_sequence(obj, mocker): |
| LOW | tests/test_utils.py | 372 | def test_smart_deepcopy_empty_collection(empty_collection, mocker): |
| LOW | tests/test_utils.py | 382 | def test_smart_deepcopy_collection(collection, mocker): |
| LOW | tests/test_utils.py | 389 | def test_smart_deepcopy_error(error, mocker): |
| LOW | tests/test_utils.py | 439 | def test_on_lower_camel_zero_length(): |
| LOW | tests/test_utils.py | 443 | def test_on_lower_camel_one_length(): |
| LOW | tests/test_utils.py | 447 | def test_on_lower_camel_many_length(): |
| LOW | tests/conftest.py | 30 | def _extract_source_code_from_function(function: FunctionType): |
| LOW | tests/conftest.py | 153 | def generate_schema_call_counter(*args: Any, **kwargs: Any) -> Any: |
| LOW | tests/test_warnings.py | 5 | def test_pydantic_deprecation_warning(): |
| LOW | tests/test_warnings.py | 13 | def test_pydantic_deprecation_warning_tailing_dot_in_message(): |
| LOW | tests/test_warnings.py | 20 | def test_pydantic_deprecation_warning_calculated_expected_removal(): |
| LOW | tests/test_decorators.py | 11 | def _two_pos_required_args_extra_optional(a, b, c=1, d=2, *, e=3): |
| LOW | tests/test_decorators.py | 19 | def _one_pos_required_arg_one_optional(a, b=1): |
| LOW | tests/test_decorators.py | 47 | def test_inspect_validator_error_wrap(): |
| LOW | tests/test_decorators.py | 62 | def test_inspect_validator_error(mode): |
| LOW | tests/test_decorators.py | 76 | def test_inspect_field_serializer_no_signature() -> None: |
| LOW | tests/test_decorators.py | 100 | def test_inspect_annotated_serializer(obj, mode, expected): |
| LOW | tests/test_decorators.py | 105 | def test_inspect_annotated_serializer_invalid_number_of_arguments(mode): |
| LOW | tests/test_decorators.py | 114 | def test_plain_class_not_mutated() -> None: |
| LOW | tests/test_decorators.py | 128 | def test_decorator_info_not_mutated() -> None: |
| LOW | tests/test_types_typeddict.py | 89 | def test_typeddict_annotated_simple(TypedDict, req_no_req): |
| LOW | tests/test_types_typeddict.py | 109 | def test_typeddict_total_false(TypedDict, req_no_req): |
| LOW | tests/test_types_typeddict.py | 176 | def test_partial_new_typeddict(TypedDict): |
| LOW | tests/test_types_typeddict.py | 190 | def test_typeddict_extra_default(TypedDict): |
| LOW | tests/test_types_typeddict.py | 230 | def __get_pydantic_core_schema__( |
| LOW | tests/test_types_typeddict.py | 311 | def test_typeddict_postponed_annotation(TypedDict): |
| LOW | tests/test_types_typeddict.py | 351 | def test_typeddict_from_attributes(): |
| LOW | tests/test_types_typeddict.py | 383 | def test_typeddict_not_required_schema(TypedDict, req_no_req): |
| LOW | tests/test_types_typeddict.py | 414 | def test_typed_dict_inheritance_schema(TypedDict, req_no_req): |
| LOW | tests/test_types_typeddict.py | 449 | def test_typeddict_annotated_nonoptional_schema(TypedDict): |
| LOW | tests/test_types_typeddict.py | 529 | def test_generic_typeddict_in_concrete_model(): |
| 2686 more matches not shown… | |||
| Severity | File | Line | Snippet |
|---|---|---|---|
| LOW | tests/conftest.py | 1 | |
| LOW | tests/test_types_typeddict.py | 15 | |
| LOW | tests/test_plugins.py | 1 | |
| LOW | tests/test_model_validator.py | 1 | |
| LOW | tests/test_typing.py | 7 | |
| LOW | tests/test_docs.py | 1 | |
| LOW | tests/test_docs.py | 41 | |
| LOW | tests/test_docs.py | 46 | |
| LOW | tests/test_docs.py | 51 | |
| LOW | tests/test_deprecated_validate_arguments.py | 3 | |
| LOW | tests/test_types_namedtuple.py | 7 | |
| LOW | tests/test_pipeline.py | 3 | |
| LOW | tests/test_titles.py | 14 | |
| LOW | tests/test_titles.py | 14 | |
| LOW | tests/mypy/test_mypy.py | 1 | |
| LOW | tests/mypy/test_mypy.py | 7 | |
| LOW | tests/mypy/test_mypy.py | 12 | |
| LOW | tests/mypy/test_mypy.py | 12 | |
| LOW | tests/mypy/modules/create_model_var.py | 1 | |
| LOW | tests/mypy/outputs/mypy-plugin_ini/create_model_var.py | 1 | |
| LOW | tests/benchmarks/test_discriminated_unions.py | 1 | |
| LOW | tests/benchmarks/test_fastapi_startup_generics.py | 3 | |
| LOW | tests/benchmarks/test_fastapi_startup_simple.py | 3 | |
| LOW | tests/benchmarks/basemodel_eq_performance.py | 1 | |
| LOW | tests/benchmarks/basemodel_eq_performance.py | 559 | |
| LOW | tests/benchmarks/basemodel_eq_performance.py | 560 | |
| LOW | docs/plugins/conversion_table.py | 1 | |
| LOW | docs/plugins/algolia.py | 4 | |
| LOW | docs/plugins/main.py | 1 | |
| LOW | pydantic-core/python/pydantic_core/__init__.py | 1 | |
| LOW | pydantic-core/python/pydantic_core/__init__.py | 8 | |
| LOW | pydantic-core/python/pydantic_core/__init__.py | 8 | |
| LOW | pydantic-core/python/pydantic_core/__init__.py | 8 | |
| LOW | pydantic-core/python/pydantic_core/__init__.py | 8 | |
| LOW | pydantic-core/python/pydantic_core/__init__.py | 8 | |
| LOW | pydantic-core/python/pydantic_core/__init__.py | 8 | |
| LOW | pydantic-core/python/pydantic_core/__init__.py | 8 | |
| LOW | pydantic-core/python/pydantic_core/__init__.py | 8 | |
| LOW | pydantic-core/python/pydantic_core/__init__.py | 8 | |
| LOW | pydantic-core/python/pydantic_core/__init__.py | 8 | |
| LOW | pydantic-core/python/pydantic_core/__init__.py | 8 | |
| LOW | pydantic-core/python/pydantic_core/__init__.py | 8 | |
| LOW | pydantic-core/python/pydantic_core/__init__.py | 8 | |
| LOW | pydantic-core/python/pydantic_core/__init__.py | 8 | |
| LOW | pydantic-core/python/pydantic_core/__init__.py | 8 | |
| LOW | pydantic-core/python/pydantic_core/__init__.py | 8 | |
| LOW | pydantic-core/python/pydantic_core/__init__.py | 8 | |
| LOW | pydantic-core/python/pydantic_core/__init__.py | 8 | |
| LOW | pydantic-core/python/pydantic_core/__init__.py | 8 | |
| LOW | pydantic-core/python/pydantic_core/__init__.py | 8 | |
| LOW | pydantic-core/python/pydantic_core/__init__.py | 31 | |
| LOW | pydantic-core/python/pydantic_core/__init__.py | 31 | |
| LOW | pydantic-core/python/pydantic_core/__init__.py | 31 | |
| LOW | pydantic-core/python/pydantic_core/core_schema.py | 6 | |
| LOW | pydantic-core/tests/conftest.py | 1 | |
| LOW | pydantic-core/tests/test_typing.py | 1 | |
| LOW | pydantic-core/tests/test_strict.py | 1 | |
| LOW | pydantic-core/tests/serializers/test_union.py | 1 | |
| LOW | pydantic-core/tests/benchmarks/nested_schema.py | 1 | |
| LOW | pydantic-core/tests/benchmarks/complete_schema.py | 1 | |
| 189 more matches not shown… | |||
| Severity | File | Line | Snippet |
|---|---|---|---|
| HIGH | .github/actions/people/people.py | 364 | Make a GraphQL request to GitHub API. Args: settings: Configuration settings including API token qu |
| HIGH | pydantic/color.py | 114 | Returns the name of the color if it can be found in `COLORS_BY_VALUE` dictionary, otherwise returns the hexadeci |
| HIGH | pydantic/color.py | 260 | Parse a tuple or list to get RGBA values. Args: value: A tuple or list. Returns: An `RGBA` tup |
| HIGH | pydantic/color.py | 282 | Parse a string representing a color to an RGBA tuple. Possible formats for the input string include: * named c |
| HIGH | pydantic/color.py | 356 | Parse the color value provided and return a number between 0 and 1. Args: value: An integer or string color |
| HIGH | pydantic/color.py | 383 | Parse an alpha value checking it's a valid float in the range 0 to 1. Args: value: The input value to parse |
| HIGH | pydantic/color.py | 441 | Converts a float value between 0 and 1 (inclusive) to an integer between 0 and 255 (inclusive). Args: c: Th |
| HIGH | pydantic/fields.py | 293 | Create a new `FieldInfo` object with the `Field` function. Args: default: The default value for the |
| HIGH | pydantic/fields.py | 645 | Return a new `FieldInfo` instance from a `dataclasses.Field` instance. Args: dc_field: The `datacla |
| HIGH | pydantic/fields.py | 1210 | !!! abstract "Usage Documentation" [Fields](../concepts/fields.md) Create a field for objects that can be c |
| HIGH | pydantic/fields.py | 1521 | !!! abstract "Usage Documentation" [Private Model Attributes](../concepts/models.md#private-model-attributes) |
| HIGH | pydantic/fields.py | 1709 | !!! abstract "Usage Documentation" [The `computed_field` decorator](../concepts/fields.md#the-computed_field-dec |
| HIGH | pydantic/json_schema.py | 224 | !!! abstract "Usage Documentation" [Customizing the JSON Schema Generation Process](../concepts/json_schema.md#c |
| HIGH | pydantic/json_schema.py | 353 | Generates JSON schema definitions from a list of core schemas, pairing the generated definitions with a mapping |
| HIGH | pydantic/json_schema.py | 400 | Generates a JSON schema for a specified schema in a specified mode. Args: schema: A Pydantic model. |
| HIGH | pydantic/json_schema.py | 485 | Generate a JSON schema based on the input schema. Args: schema_or_field: The core schema to |
| HIGH | pydantic/json_schema.py | 1705 | Resolve a JsonSchemaValue to the non-ref schema if it is a $ref schema. Args: json_schema: The sche |
| HIGH | pydantic/root_model.py | 74 | Create a new model using the provided root object and update fields set. Args: root: The root objec |
| HIGH | pydantic/type_adapter.py | 264 | Initialize the core schema, validator, and serializer for the type. Args: ns_resolver: The namespac |
| HIGH | pydantic/type_adapter.py | 409 | Validate a Python object against the model. Args: object: The Python object to validate against the |
| HIGH | pydantic/dataclasses.py | 80 | !!! abstract "Usage Documentation" [`dataclasses`](../concepts/dataclasses.md) A decorator used to create a |
| HIGH | pydantic/main.py | 630 | Compute the class name for parametrizations of generic classes. This method can be overridden to achieve a cust |
| HIGH | pydantic/main.py | 733 | Validate a pydantic model instance. Args: obj: The object to validate. strict: Whether |
| HIGH | pydantic/main.py | 781 | !!! abstract "Usage Documentation" [JSON Parsing](../concepts/json.md#json-parsing) Validate the gi |
| HIGH | pydantic/main.py | 1777 | !!! abstract "Usage Documentation" [Dynamic Model Creation](../concepts/models.md#dynamic-model-creation) D |
| HIGH | pydantic/annotated_handlers.py | 51 | Get the real schema for a `{"$ref": ...}` schema. If the schema given is not a `$ref` schema, it will be returne |
| HIGH | pydantic/annotated_handlers.py | 101 | Get the real schema for a `definition-ref` schema. If the schema given is not a `definition-ref` schema, it will |
| HIGH | pydantic/_internal/_schema_generation_shared.py | 41 | Resolves `$ref` in the json schema. This returns the input json schema if there is no `$ref` in json schema. |
| HIGH | pydantic/_internal/_schema_generation_shared.py | 104 | Resolves reference in the core schema. Args: maybe_ref_schema: The input core schema that may conta |
| HIGH | pydantic/_internal/_decorators_v1.py | 55 | Wrap a V1 style field validator for V2 compatibility. Args: validator: The V1 style field validator. R |
| HIGH | pydantic/_internal/_known_annotated_metadata.py | 170 | Apply `annotation` to `schema` if it is an annotation we know about (Gt, Le, etc.). Otherwise return `None`. Th |
| HIGH | pydantic/_internal/_model_construction.py | 413 | Iterate over the namespace and: * gather private attributes * check for items which look like fields but are not |
| HIGH | pydantic/_internal/_model_construction.py | 616 | Finish building a model class. This logic must be called after class has been created since validation functions mu |
| HIGH | pydantic/_internal/_generate_schema.py | 719 | Generate core schema. Args: obj: The object to generate core schema for. Returns: |
| HIGH | pydantic/_internal/_discriminated_union.py | 39 | Applies the discriminator and returns a new core schema. Args: schema: The input schema. discrimina |
| HIGH | pydantic/_internal/_discriminated_union.py | 141 | Return a new CoreSchema based on `schema` that uses a tagged-union with the discriminator provided to this class |
| HIGH | pydantic/_internal/_decorators.py | 351 | Get the attribute from the next class in the MRO that has it, aiming to simulate calling the method on the actual cl |
| HIGH | pydantic/_internal/_decorators.py | 386 | Get an attribute out of the `__dict__` following the MRO. This prevents the call to `__get__` on the descriptor, and |
| HIGH | pydantic/_internal/_fields.py | 230 | Collect the fields and class variables names of a nascent Pydantic model. The fields collection process is *lenient |
| HIGH | pydantic/_internal/_generics.py | 166 | Used inside a function to check whether it was called globally. Args: depth: The depth to get the frame. |
| HIGH | pydantic/_internal/_dataclasses.py | 93 | Finish building a pydantic dataclass. This logic is called on a class which has already been wrapped in `dataclasse |
| Severity | File | Line | Snippet |
|---|---|---|---|
| HIGH | tests/test_serialize.py | 246 | assert MyModel(x=None).model_dump_json() == '{"x":null}' |
| HIGH | tests/test_edge_cases.py | 2227 | '{"v": null}', |
| HIGH | tests/test_json.py | 328 | == '{"name":"Pumbaa","SSN":234,"birthday":737424000.0,"phone":18007267864,"friend":null}' |
| HIGH | tests/test_types.py | 4396 | Foobar.model_validate_json('{"password": 1234, "empty_password": null}') |
| HIGH | pydantic-core/tests/test_json.py | 185 | assert v.validate_json('{"1": 1, "2": "a", "3": null}') == {'1': 1, '2': 'a', '3': None} |
| HIGH | pydantic-core/tests/serializers/test_model.py | 315 | assert s.to_json(BasicModel(foo=None, bar=b'more')) == b'{"foo":null,"bar":"more"}' |
| HIGH | pydantic-core/tests/serializers/test_model.py | 827 | s.to_json(Model(3, 4), exclude_none=False, by_alias=True) == b'{"width":3,"height":4,"Area":12,"volume":null}' |
| HIGH | pydantic-core/tests/serializers/test_model.py | 883 | s.to_json(Model(3, 4), exclude_none=False, by_alias=True) == b'{"width":3,"height":4,"volume":null,"Area":12}' |
| HIGH | pydantic-core/tests/serializers/test_model.py | 1090 | assert s.to_json(m) == b'{"field_a":"test","field_b":12,"field_c":null,"field_d":[1,2,3]}' |
| HIGH | pydantic-core/tests/serializers/test_model.py | 1104 | assert s.to_json(m, exclude={'field_d': [0]}) == b'{"field_a":"test","field_b":12,"field_c":null,"field_d":[2,3]}' |
| HIGH | pydantic-core/tests/serializers/test_typed_dict.py | 156 | assert v.to_json({'foo': 1, 'bar': b'more', 'c': None}) == b'{"foo":1,"bar":"more","c":null}' |
| HIGH | pydantic-core/tests/serializers/test_typed_dict.py | 157 | assert v.to_json({'foo': None, 'bar': b'more'}) == b'{"foo":null,"bar":"more"}' |
| HIGH | pydantic-core/tests/serializers/test_any.py | 656 | assert s.to_json([inf]) == b'[null]' |
| HIGH | pydantic-core/tests/serializers/test_any.py | 659 | assert s.to_json([nan]) == b'[null]' |
| HIGH | pydantic-core/tests/serializers/test_json.py | 23 | assert s.to_json(v) == b'["a",[1,2],null]' |
| HIGH | pydantic/json_schema.py | 1474 | with self._config_wrapper_stack.push(config): |
| HIGH | pydantic/json_schema.py | 1616 | with self._config_wrapper_stack.push(config): |
| HIGH | pydantic/json_schema.py | 1827 | with self._config_wrapper_stack.push(config): |
| HIGH | pydantic/_internal/_typing_extra.py | 328 | with ns_resolver.push(base): |
| HIGH | pydantic/_internal/_typing_extra.py | 382 | with ns_resolver.push(base): |
| HIGH | pydantic/_internal/_namespace_utils.py | 202 | with ns_resolver.push(Model): |
| HIGH | pydantic/_internal/_namespace_utils.py | 209 | with ns_resolver.push(Sub): |
| HIGH | pydantic/_internal/_generate_schema.py | 774 | with self._config_wrapper_stack.push(config_wrapper), self._ns_resolver.push(cls): |
| HIGH | pydantic/_internal/_generate_schema.py | 1035 | with self.model_type_stack.push(obj): |
| HIGH | pydantic/_internal/_generate_schema.py | 1291 | with self.field_name_stack.push(name): |
| HIGH | pydantic/_internal/_generate_schema.py | 1368 | with self._ns_resolver.push(origin): |
| HIGH | pydantic/_internal/_generate_schema.py | 1405 | self.model_type_stack.push(typed_dict_cls), |
| HIGH | pydantic/_internal/_generate_schema.py | 1431 | with self._config_wrapper_stack.push(config): |
| HIGH | pydantic/_internal/_generate_schema.py | 1534 | self.model_type_stack.push(namedtuple_cls), |
| HIGH | pydantic/_internal/_generate_schema.py | 1600 | with self.field_name_stack.push(name): |
| HIGH | pydantic/_internal/_generate_schema.py | 1650 | with self.field_name_stack.push(name): |
| HIGH | pydantic/_internal/_generate_schema.py | 1838 | self.model_type_stack.push(dataclass), |
| HIGH | pydantic/_internal/_generate_schema.py | 1868 | with self._ns_resolver.push(dataclass), self._config_wrapper_stack.push(config): |
| HIGH | pydantic/_internal/_fields.py | 458 | with ns_resolver.push(cls): |
| HIGH | pydantic/_internal/_fields.py | 558 | with ns_resolver.push(base): |
| HIGH | pydantic/_internal/_fields.py | 655 | with ns_resolver.push(cls): |
| Severity | File | Line | Snippet |
|---|---|---|---|
| HIGH | tests/test_dataclasses.py | 0 | we promise that if you add a validator with the same _function_ name as an existing validator it replaces the existing v |
| HIGH | tests/test_validators.py | 0 | we promise that if you add a validator with the same _function_ name as an existing validator it replaces the existing v |
| HIGH | tests/test_validators.py | 0 | we promise that if you add a validator with the same _function_ name as an existing validator it replaces the existing v |
| HIGH | tests/mypy/modules/decorator_implicit_classmethod.py | 0 | test that the mypy plugin implicitly transforms the right decorators into class methods. |
| HIGH | …yproject-plugin_toml/decorator_implicit_classmethod.py | 0 | test that the mypy plugin implicitly transforms the right decorators into class methods. |
| HIGH | …puts/mypy-plugin_ini/decorator_implicit_classmethod.py | 0 | test that the mypy plugin implicitly transforms the right decorators into class methods. |
| HIGH | tests/benchmarks/basemodel_eq_performance.py | 0 | object.__setattr__(left, 'cache', none) object.__setattr__(right, 'cache', -1) |
| HIGH | tests/benchmarks/basemodel_eq_performance.py | 0 | object.__setattr__(left, 'cache', none) object.__setattr__(right, 'cache', -1) |
| HIGH | tests/benchmarks/basemodel_eq_performance.py | 0 | object.__setattr__(left, 'cache', none) object.__setattr__(right, 'cache', -1) |
| HIGH | tests/benchmarks/basemodel_eq_performance.py | 0 | object.__setattr__(left, 'cache', none) object.__setattr__(right, 'cache', -1) |
| HIGH | pydantic-core/tests/serializers/test_model.py | 0 | this test reflects the priority that applies for config vs runtime serialization alias configuration. if the runtime val |
| HIGH | pydantic-core/tests/serializers/test_typed_dict.py | 0 | this test reflects the priority that applies for config vs runtime serialization alias configuration. if the runtime val |
| HIGH | pydantic-core/tests/serializers/test_dataclasses.py | 0 | this test reflects the priority that applies for config vs runtime serialization alias configuration. if the runtime val |
| HIGH | pydantic-core/tests/validators/test_typed_dict.py | 0 | this test reflects the priority that applies for config vs runtime validation alias configuration. runtime values take p |
| HIGH | pydantic-core/tests/validators/test_dataclasses.py | 0 | this test reflects the priority that applies for config vs runtime validation alias configuration. runtime values take p |
| HIGH | pydantic-core/tests/validators/test_model_fields.py | 0 | this test reflects the priority that applies for config vs runtime validation alias configuration. runtime values take p |
| HIGH | pydantic-core/tests/validators/test_arguments.py | 0 | this test reflects the priority that applies for config vs runtime validation alias configuration. runtime values take p |
| HIGH | …antic-core/tests/validators/arguments_v3/test_alias.py | 0 | this test reflects the priority that applies for config vs runtime validation alias configuration. runtime values take p |
| HIGH | pydantic-core/tests/validators/test_url.py | 0 | hosts can't be provided with any single url values. |
| HIGH | pydantic-core/tests/validators/test_url.py | 0 | hosts can't be provided with any single url values. |
| HIGH | pydantic-core/tests/validators/test_url.py | 0 | hosts can't be provided with any single url values. |
| HIGH | pydantic/types.py | 0 | get the json format for the encoded data. returns: the json format for the encoded data. |
| HIGH | pydantic/types.py | 0 | get the json format for the encoded data. returns: the json format for the encoded data. |
| HIGH | pydantic/types.py | 0 | get the json format for the encoded data. returns: the json format for the encoded data. |
| Severity | File | Line | Snippet |
|---|---|---|---|
| LOW | tests/test_exports.py | 33 | |
| LOW | tests/test_exports.py | 39 | |
| LOW | docs/plugins/main.py | 54 | |
| LOW | pydantic-core/wasm-preview/run_tests.py | 18 | |
| LOW | pydantic-core/tests/test_errors.py | 702 | |
| LOW | pydantic-core/tests/validators/test_string.py | 351 | |
| LOW | pydantic-core/tests/validators/test_with_default.py | 822 | |
| LOW | pydantic-core/tests/validators/test_url.py | 70 | |
| LOW | pydantic-core/tests/validators/test_url.py | 484 | |
| LOW | pydantic-core/tests/validators/test_url.py | 982 | |
| LOW | pydantic-core/tests/validators/test_url.py | 1038 | |
| LOW | .github/actions/people/people.py | 451 | |
| LOW | .github/actions/people/people.py | 497 | |
| LOW | .github/actions/people/people.py | 581 | |
| LOW | pydantic/fields.py | 481 | |
| LOW | pydantic/fields.py | 578 | |
| LOW | pydantic/fields.py | 836 | |
| LOW | pydantic/mypy.py | 186 | |
| LOW | pydantic/mypy.py | 359 | |
| LOW | pydantic/mypy.py | 569 | |
| LOW | pydantic/mypy.py | 902 | |
| LOW | pydantic/mypy.py | 999 | |
| LOW | pydantic/mypy.py | 1024 | |
| LOW | pydantic/mypy.py | 1082 | |
| LOW | pydantic/types.py | 3074 | |
| LOW | pydantic/types.py | 1028 | |
| LOW | pydantic/json_schema.py | 2793 | |
| LOW | pydantic/json_schema.py | 200 | |
| LOW | pydantic/json_schema.py | 836 | |
| LOW | pydantic/json_schema.py | 879 | |
| LOW | pydantic/json_schema.py | 1361 | |
| LOW | pydantic/json_schema.py | 1455 | |
| LOW | pydantic/json_schema.py | 1537 | |
| LOW | pydantic/json_schema.py | 2418 | |
| LOW | pydantic/json_schema.py | 2422 | |
| LOW | pydantic/main.py | 317 | |
| LOW | pydantic/main.py | 393 | |
| LOW | pydantic/main.py | 1425 | |
| LOW | pydantic/main.py | 1080 | |
| LOW | pydantic/v1/_hypothesis_plugin.py | 356 | |
| LOW | pydantic/v1/fields.py | 197 | |
| LOW | pydantic/v1/fields.py | 581 | |
| LOW | pydantic/v1/fields.py | 850 | |
| LOW | pydantic/v1/fields.py | 898 | |
| LOW | pydantic/v1/fields.py | 1000 | |
| LOW | pydantic/v1/fields.py | 1053 | |
| LOW | pydantic/v1/fields.py | 1171 | |
| LOW | pydantic/v1/decorator.py | 61 | |
| LOW | pydantic/v1/decorator.py | 179 | |
| LOW | pydantic/v1/validators.py | 81 | |
| LOW | pydantic/v1/validators.py | 316 | |
| LOW | pydantic/v1/validators.py | 699 | |
| LOW | pydantic/v1/env_settings.py | 166 | |
| LOW | pydantic/v1/env_settings.py | 281 | |
| LOW | pydantic/v1/env_settings.py | 94 | |
| LOW | pydantic/v1/mypy.py | 171 | |
| LOW | pydantic/v1/mypy.py | 344 | |
| LOW | pydantic/v1/mypy.py | 539 | |
| LOW | pydantic/v1/class_validators.py | 195 | |
| LOW | pydantic/v1/class_validators.py | 288 | |
| 65 more matches not shown… | |||
| Severity | File | Line | Snippet |
|---|---|---|---|
| LOW | README.md | 50 | name: str = 'John Doe' |
| LOW | README.md | 57 | #> User id=123 name='John Doe' signup_ts=datetime.datetime(2017, 6, 1, 12, 22) friends=[1, 2, 3] |
| LOW | tests/test_types_typeddict.py | 978 | m = Model.model_validate({'a': {'name': 'John Doe', 'extra': 'something'}}) |
| LOW | tests/test_types_typeddict.py | 980 | assert m.model_dump() == {'a': {'name': 'John Doe', 'extra': 'something'}} |
| LOW | tests/test_rich_repr.py | 13 | name: str = 'John Doe' |
| LOW | tests/test_rich_repr.py | 26 | ('name', 'John Doe'), |
| LOW | tests/test_dataclasses.py | 561 | name: str = 'John Doe' |
| LOW | tests/test_dataclasses.py | 570 | assert fields['name'].default == 'John Doe' |
| LOW | tests/test_dataclasses.py | 614 | name: str = 'John Doe' |
| LOW | tests/test_dataclasses.py | 642 | 'name': {'default': 'John Doe', 'title': 'Name', 'type': 'string'}, |
| LOW | tests/test_config.py | 124 | ('id: int = 1', 'bar=2', 'baz: Any', "name: str = 'John Doe'", 'foo: str', '**data'), |
| LOW | tests/test_config.py | 126 | assert _equals(str(sig), "(id: int = 1, bar=2, *, baz: Any, name: str = 'John Doe', foo: str, **data) -> None") |
| LOW | tests/test_config.py | 111 | name: str = 'John Doe' |
| LOW | tests/test_edge_cases.py | 2327 | assert module.User(id=12).model_dump() == {'id': 12, 'name': 'Jane Doe'} |
| LOW | tests/test_edge_cases.py | 2800 | data = {'age': 'John Doe'} |
| LOW | tests/test_edge_cases.py | 2320 | name: str = 'Jane Doe' |
| LOW | tests/test_model_signature.py | 53 | name: str = 'John Doe' |
| LOW | tests/test_model_signature.py | 66 | ('id: int = 1', 'bar=2', 'baz: Any', "name: str = 'John Doe'", 'foo: str', '**data'), |
| LOW | tests/test_model_signature.py | 69 | assert _equals(str(sig), "(id: int = 1, bar=2, *, baz: Any, name: str = 'John Doe', foo: str, **data) -> None") |
| LOW | tests/test_types.py | 7046 | assert Foo(baz=' uSeR@ExAmPlE.com ').baz == 'user@example.com' |
| LOW | docs/index.md | 63 | name: str = 'John Doe' # (2)! |
| LOW | docs/index.md | 86 | 'name': 'John Doe', |
| LOW | docs/index.md | 120 | name: str = 'John Doe' |
| LOW | docs/plugins/devtools_output.html | 22 | user: id=123 name='John Doe' signup_ts=datetime.datetime(2019, 6, 1, 12, 22) friends=[1234, 4567, 7890] address=Address( |
| LOW | docs/integrations/devtools.md | 38 | name='John Doe', |
| LOW | docs/examples/queues.md | 38 | user1 = User(id=1, name='John Doe', email='john@example.com') |
| LOW | docs/examples/queues.md | 39 | user2 = User(id=2, name='Jane Doe', email='jane@example.com') |
| LOW | docs/examples/queues.md | 42 | #> Added to queue: {"id":1,"name":"John Doe","email":"john@example.com"} |
| LOW | docs/examples/queues.md | 45 | #> Added to queue: {"id":2,"name":"Jane Doe","email":"jane@example.com"} |
| LOW | docs/examples/queues.md | 59 | #> Validated user: User(id=1, name='John Doe', email='john@example.com') |
| LOW | docs/examples/queues.md | 62 | #> Validated user: User(id=2, name='Jane Doe', email='jane@example.com') |
| LOW | docs/examples/queues.md | 109 | user1 = User(id=1, name='John Doe', email='john@example.com') |
| LOW | docs/examples/queues.md | 110 | user2 = User(id=2, name='Jane Doe', email='jane@example.com') |
| LOW | docs/examples/queues.md | 113 | #> Added to queue: {"id":1,"name":"John Doe","email":"john@example.com"} |
| LOW | docs/examples/queues.md | 116 | #> Added to queue: {"id":2,"name":"Jane Doe","email":"jane@example.com"} |
| LOW | docs/examples/queues.md | 205 | user1 = User(id=1, name='John Doe', email='john@example.com') |
| LOW | docs/examples/queues.md | 206 | user2 = User(id=2, name='Jane Doe', email='jane@example.com') |
| LOW | docs/examples/files.md | 16 | "name": "John Doe", |
| LOW | docs/examples/files.md | 39 | #> name='John Doe' age=30 email='john@example.com' |
| LOW | docs/examples/files.md | 97 | "name": "John Doe", |
| LOW | docs/examples/files.md | 102 | "name": "Jane Doe", |
| LOW | docs/examples/files.md | 128 | #> [Person(name='John Doe', age=30, email='john@example.com'), Person(name='Jane Doe', age=25, email='jane@example.com') |
| LOW | docs/examples/files.md | 128 | #> [Person(name='John Doe', age=30, email='john@example.com'), Person(name='Jane Doe', age=25, email='jane@example.com') |
| LOW | docs/examples/files.md | 142 | {"name": "John Doe", "age": 30, "email": "john@example.com"} |
| LOW | docs/examples/files.md | 143 | {"name": "Jane Doe", "age": 25, "email": "jane@example.com"} |
| LOW | docs/examples/files.md | 163 | #> [Person(name='John Doe', age=30, email='john@example.com'), Person(name='Jane Doe', age=25, email='jane@example.com') |
| LOW | docs/examples/files.md | 163 | #> [Person(name='John Doe', age=30, email='john@example.com'), Person(name='Jane Doe', age=25, email='jane@example.com') |
| LOW | docs/examples/files.md | 199 | #> [Person(name='John Doe', age=30, email='john@example.com'), Person(name='Jane Doe', age=25, email='jane@example.com') |
| LOW | docs/examples/files.md | 199 | #> [Person(name='John Doe', age=30, email='john@example.com'), Person(name='Jane Doe', age=25, email='jane@example.com') |
| LOW | docs/examples/files.md | 209 | name = "John Doe" |
| LOW | docs/examples/files.md | 233 | #> name='John Doe' age=30 email='john@example.com' |
| LOW | docs/examples/files.md | 267 | #> name='John Doe' age=30 email='john@example.com' |
| LOW | docs/examples/files.md | 303 | #> name='John Doe' age=30 email='john@example.com' |
| LOW | docs/examples/files.md | 337 | #> name='John Doe' age=30 email='john@example.com' |
| LOW | docs/concepts/json_schema.md | 939 | 'name': 'John Doe', |
| LOW | docs/concepts/json_schema.md | 953 | "name": "John Doe" |
| LOW | docs/concepts/unions.md | 152 | user_01 = User(id=123, name='John Doe') |
| LOW | docs/concepts/unions.md | 154 | #> id=123 name='John Doe' |
| LOW | docs/concepts/unions.md | 157 | user_02 = User(id='1234', name='John Doe') |
| LOW | docs/concepts/unions.md | 159 | #> id='1234' name='John Doe' |
| 20 more matches not shown… | |||
| Severity | File | Line | Snippet |
|---|---|---|---|
| MEDIUM | tests/test_validators.py | 3131 | ) # Create a Sub instance without triggering validation (e.g., using model_construct) |
| MEDIUM | tests/test_main.py | 2954 | # Defining a nested type does not error |
| MEDIUM | tests/test_types.py | 6546 | # Create a module that exists, but fails to import due to missing dependency |
| MEDIUM | pydantic/types.py | 995 | # Create an instance |
| MEDIUM | pydantic/json_schema.py | 102 | """This class is used to emit warnings produced during JSON schema generation. |
| MEDIUM | pydantic/json_schema.py | 2464 | """This method is responsible for ignoring warnings as desired, and for formatting the warning messages. |
| MEDIUM | pydantic/root_model.py | 136 | """This method is included just to get a more accurate return type for type checkers. |
| MEDIUM | pydantic/functional_serializers.py | 158 | """This method is used to get the Pydantic core schema of the class. |
| MEDIUM | pydantic/_internal/_model_construction.py | 371 | """This function is meant to behave like a BaseModel method to initialize private attributes. |
| MEDIUM | pydantic/_internal/_generate_schema.py | 2166 | # Create a new ComputedFieldInfo so that different type parametrizations of the same |
| MEDIUM | pydantic/_internal/_generate_schema.py | 2337 | # Create a new union schema, preserving the order of the union: |
| MEDIUM | pydantic/_internal/_discriminated_union.py | 74 | """This class is used to convert an input schema containing a union schema into one where that union is |
| MEDIUM | pydantic/_internal/_decorators.py | 762 | # Define the types we want to check against as a single tuple. |
| MEDIUM | pydantic/plugin/__init__.py | 55 | """This method is called for each plugin every time a new [`SchemaValidator`][pydantic_core.SchemaValidator] |
| MEDIUM | pydantic/deprecated/config.py | 31 | """This class is only retained for backwards compatibility. |
| Severity | File | Line | Snippet |
|---|---|---|---|
| LOW | tests/test_dataclasses.py | 2254 | # for standard dataclasses, so we just use TypeAdapter to get validation for each. |
| MEDIUM | tests/test_edge_cases.py | 2240 | """This is primarily included in order to document the behavior / limitations of the `Hashable` type's validation lo |
| LOW | pydantic-core/tests/serializers/test_any.py | 348 | # because when recursion is detected and we're in mode python, we just return the value |
| LOW | pydantic-core/tests/serializers/test_any.py | 383 | # when recursion is detected and we're in mode python, we just return the value |
| LOW | pydantic/functional_validators.py | 277 | # we don't want to bother with further validation, just return the new value |
| LOW | pydantic/types.py | 1751 | # hence we just use `secret_display` |
| MEDIUM | pydantic/json_schema.py | 2806 | # for instance when "examples" is used as a property key. A more robust solution |
| LOW | pydantic/json_schema.py | 461 | # If a schema with the same CoreRef has been handled, just return a reference to it |
| LOW | pydantic/main.py | 1220 | # early if there are no keys to ignore (we would just return False later on anyway) |
| LOW | pydantic/v1/error_wrappers.py | 46 | # but recursive, therefore just use: |
| MEDIUM | pydantic/_internal/_docs_extraction.py | 97 | # making it way more robust. |
| LOW | pydantic/_internal/_validators.py | 75 | # otherwise we just return the value and let the next validator do the rest of the work |
| Severity | File | Line | Snippet |
|---|---|---|---|
| LOW | tests/test_edge_cases.py | 1161 | ] |
| LOW | tests/test_edge_cases.py | 1181 | # class Model(BaseModel): |
| LOW | pydantic-core/tests/test.rs | 1 | #[cfg(test)] |
| LOW | pydantic-core/src/definitions.rs | 21 | |
| LOW | pydantic-core/src/validators/validation_state.rs | 21 | pub struct ValidationState<'a, 'py> { |
| LOW | pydantic-core/src/errors/location.rs | 81 | } |
| LOW | .github/workflows/third-party.yml | 1 | # This workflow is a daily cron job, inspired by: |
| LOW | pydantic/fields.py | 541 | # HACK: It is common for users to define "make model partial" (or similar) utilities, that |
| LOW | pydantic/main.py | 1221 | model_fields = type(self).__pydantic_fields__.keys() |
| LOW | pydantic/v1/_hypothesis_plugin.py | 41 | # them on-disk, and that's unsafe in general without being told *where* to do so. |
| LOW | pydantic/v1/generics.py | 221 | if not issubclass(base_model, GenericModel): |
| LOW | pydantic/_internal/_namespace_utils.py | 201 | # This is roughly what happens when we build a core schema for `Model`: |
| LOW | pydantic/_internal/_namespace_utils.py | 261 | # Adding `__type_params__` *before* `vars(typ)`, as the latter takes priority |
| LOW | pydantic/_internal/_discriminated_union.py | 101 | # this, the inference logic gets complicated very quickly, and could result in confusing |
| LOW | pydantic/_internal/_discriminated_union.py | 121 | # as an indication that, even if None is discovered as one of the union choices, we will not need to wrap |
| LOW | pydantic/_internal/_discriminated_union.py | 201 | # was flattened by pydantic_core. |
| LOW | pydantic/_internal/_fields.py | 341 | if assigned_value is PydanticUndefined: # no assignment, just a plain annotation |
| LOW | pydantic/_internal/_generics.py | 121 | The created submodel. |
| Severity | File | Line | Snippet |
|---|---|---|---|
| LOW | tests/test_config.py | 460 | def my_function(): |
| LOW | tests/test_config.py | 486 | def my_function(): |
| LOW | tests/test_types.py | 6035 | def my_function(y: type_hint): |
| LOW | tests/test_types.py | 7278 | def do_something(self): |
| LOW | tests/test_types.py | 7287 | def do_something(self): |
| LOW | pydantic-core/tests/test_errors.py | 87 | def my_function(input_value, info): |
| LOW | pydantic-core/tests/validators/test_function.py | 65 | def my_function(input_value, info): |
| LOW | pydantic-core/tests/validators/test_function.py | 100 | def my_function(input_value, info): |
| LOW | pydantic-core/tests/validators/test_call.py | 26 | def my_function(a, b, c): |
| LOW | pydantic-core/tests/validators/test_call.py | 69 | def my_function(a, b, c): |
| LOW | pydantic-core/tests/validators/test_call.py | 83 | def my_function(a): |
| LOW | pydantic-core/tests/validators/test_call.py | 93 | def my_function(a): |
| LOW | pydantic-core/tests/validators/test_call.py | 177 | def my_function(a, b, c): |
| LOW | pydantic-core/tests/validators/test_call.py | 197 | def my_function(a): |
| Severity | File | Line | Snippet |
|---|---|---|---|
| HIGH | pydantic-core/wasm-preview/worker.js | 28 | print(tty); |
| HIGH | pydantic-core/wasm-preview/worker.js | 32 | print(tty); |
| Severity | File | Line | Snippet |
|---|---|---|---|
| CRITICAL | pydantic/v1/mypy.py | 334 | for name, sym in self._ctx.cls.info.names.items(): |
| Severity | File | Line | Snippet |
|---|---|---|---|
| LOW | tests/mypy/test_mypy.py | 207 | except Exception: |
| LOW | pydantic-core/wasm-preview/run_tests.py | 63 | except Exception: |
| LOW | pydantic/json_schema.py | 1199 | except Exception: |
| LOW | pydantic/v1/_hypothesis_plugin.py | 226 | except Exception: # pragma: no cover |
| LOW | pydantic/_internal/_core_utils.py | 87 | except Exception: |
| LOW | pydantic/_internal/_typing_extra.py | 342 | except Exception: |
| LOW | pydantic/plugin/_schema_validator.py | 119 | except Exception as exception: |
| Severity | File | Line | Snippet |
|---|---|---|---|
| MEDIUM | tests/test_deprecated.py | 574 |