Repository Analysis

pydantic/pydantic

Data validation using Python type hints

14.1 Low AI signal View on GitHub
14.1
Adjusted Score
14.1
Raw Score
100%
Time Factor
2026-05-29
Last Push
27,884
Stars
Python
Language
237,608
Lines of Code
695
Files
3371
Pattern Hits
2026-05-31
Scan Date

Score History

Severity Breakdown

CRITICAL 1HIGH 103MEDIUM 19LOW 3248

Pattern Findings

3371 matches across 15 categories. Click a row to expand file-level details.

Hyper-Verbose Identifiers2746 hits · 2312 pts
SeverityFileLineSnippet
LOWtests/test_assert_in_validators.py23def test_assert_raises_validation_error():
LOWtests/test_dunder_all.py13def test_explicit_reexports_exist() -> None:
LOWtests/test_version.py31def test_version_attribute_is_present():
LOWtests/test_version.py35def test_version_attribute_is_a_string():
LOWtests/test_version.py39def test_check_pydantic_core_version() -> None:
LOWtests/test_computed_fields.py69def test_computed_fields_json_schema():
LOWtests/test_computed_fields.py217def test_properties_and_computed_fields():
LOWtests/test_computed_fields.py244def test_computed_fields_repr():
LOWtests/test_computed_fields.py426def test_private_computed_field():
LOWtests/test_computed_fields.py546def test_abstractmethod_missing(bases: tuple[Any, ...]):
LOWtests/test_computed_fields.py567 def __get_pydantic_core_schema__(cls, source: Any, handler: GetCoreSchemaHandler) -> core_schema.CoreSchema:
LOWtests/test_computed_fields.py573def test_computed_fields_infer_return_type():
LOWtests/test_computed_fields.py583def test_computed_fields_missing_return_type():
LOWtests/test_computed_fields.py611 def my_aliased_computed_field_none(self) -> int:
LOWtests/test_computed_fields.py660def test_alias_generator_defer_build() -> None:
LOWtests/test_computed_fields.py740def test_multiple_references_to_schema(model_factory: Callable[[], Any]) -> None:
LOWtests/test_computed_fields.py765def test_generic_computed_field():
LOWtests/test_computed_fields.py796def test_computed_field_override_raises():
LOWtests/test_computed_fields.py812def test_computed_field_excluded_from_model_dump_recursive() -> None:
LOWtests/test_computed_fields.py828def test_computed_field_with_field_serializer():
LOWtests/test_computed_fields.py844def test_computed_fields_exclude() -> None:
LOWtests/test_computed_fields.py859def test_computed_fields_serialization_exclude_if() -> None:
LOWtests/test_computed_fields.py881def test_computed_fields_serialization_exclude_if_from_annotated() -> None:
LOWtests/test_v1.py34def test_isinstance_does_not_raise_deprecation_warnings():
LOWtests/test_utils.py39def test_import_module_invalid():
LOWtests/test_utils.py94def test_lenient_issubclass_with_generic_aliases():
LOWtests/test_utils.py101def test_lenient_issubclass_is_lenient():
LOWtests/test_utils.py318def test_deep_update_is_not_mutating():
LOWtests/test_utils.py364def test_smart_deepcopy_immutable_non_sequence(obj, mocker):
LOWtests/test_utils.py372def test_smart_deepcopy_empty_collection(empty_collection, mocker):
LOWtests/test_utils.py382def test_smart_deepcopy_collection(collection, mocker):
LOWtests/test_utils.py389def test_smart_deepcopy_error(error, mocker):
LOWtests/test_utils.py439def test_on_lower_camel_zero_length():
LOWtests/test_utils.py443def test_on_lower_camel_one_length():
LOWtests/test_utils.py447def test_on_lower_camel_many_length():
LOWtests/conftest.py30def _extract_source_code_from_function(function: FunctionType):
LOWtests/conftest.py153 def generate_schema_call_counter(*args: Any, **kwargs: Any) -> Any:
LOWtests/test_warnings.py5def test_pydantic_deprecation_warning():
LOWtests/test_warnings.py13def test_pydantic_deprecation_warning_tailing_dot_in_message():
LOWtests/test_warnings.py20def test_pydantic_deprecation_warning_calculated_expected_removal():
LOWtests/test_decorators.py11def _two_pos_required_args_extra_optional(a, b, c=1, d=2, *, e=3):
LOWtests/test_decorators.py19def _one_pos_required_arg_one_optional(a, b=1):
LOWtests/test_decorators.py47def test_inspect_validator_error_wrap():
LOWtests/test_decorators.py62def test_inspect_validator_error(mode):
LOWtests/test_decorators.py76def test_inspect_field_serializer_no_signature() -> None:
LOWtests/test_decorators.py100def test_inspect_annotated_serializer(obj, mode, expected):
LOWtests/test_decorators.py105def test_inspect_annotated_serializer_invalid_number_of_arguments(mode):
LOWtests/test_decorators.py114def test_plain_class_not_mutated() -> None:
LOWtests/test_decorators.py128def test_decorator_info_not_mutated() -> None:
LOWtests/test_types_typeddict.py89def test_typeddict_annotated_simple(TypedDict, req_no_req):
LOWtests/test_types_typeddict.py109def test_typeddict_total_false(TypedDict, req_no_req):
LOWtests/test_types_typeddict.py176def test_partial_new_typeddict(TypedDict):
LOWtests/test_types_typeddict.py190def test_typeddict_extra_default(TypedDict):
LOWtests/test_types_typeddict.py230 def __get_pydantic_core_schema__(
LOWtests/test_types_typeddict.py311def test_typeddict_postponed_annotation(TypedDict):
LOWtests/test_types_typeddict.py351def test_typeddict_from_attributes():
LOWtests/test_types_typeddict.py383def test_typeddict_not_required_schema(TypedDict, req_no_req):
LOWtests/test_types_typeddict.py414def test_typed_dict_inheritance_schema(TypedDict, req_no_req):
LOWtests/test_types_typeddict.py449def test_typeddict_annotated_nonoptional_schema(TypedDict):
LOWtests/test_types_typeddict.py529def test_generic_typeddict_in_concrete_model():
2686 more matches not shown…
Unused Imports249 hits · 228 pts
SeverityFileLineSnippet
LOWtests/conftest.py1
LOWtests/test_types_typeddict.py15
LOWtests/test_plugins.py1
LOWtests/test_model_validator.py1
LOWtests/test_typing.py7
LOWtests/test_docs.py1
LOWtests/test_docs.py41
LOWtests/test_docs.py46
LOWtests/test_docs.py51
LOWtests/test_deprecated_validate_arguments.py3
LOWtests/test_types_namedtuple.py7
LOWtests/test_pipeline.py3
LOWtests/test_titles.py14
LOWtests/test_titles.py14
LOWtests/mypy/test_mypy.py1
LOWtests/mypy/test_mypy.py7
LOWtests/mypy/test_mypy.py12
LOWtests/mypy/test_mypy.py12
LOWtests/mypy/modules/create_model_var.py1
LOWtests/mypy/outputs/mypy-plugin_ini/create_model_var.py1
LOWtests/benchmarks/test_discriminated_unions.py1
LOWtests/benchmarks/test_fastapi_startup_generics.py3
LOWtests/benchmarks/test_fastapi_startup_simple.py3
LOWtests/benchmarks/basemodel_eq_performance.py1
LOWtests/benchmarks/basemodel_eq_performance.py559
LOWtests/benchmarks/basemodel_eq_performance.py560
LOWdocs/plugins/conversion_table.py1
LOWdocs/plugins/algolia.py4
LOWdocs/plugins/main.py1
LOWpydantic-core/python/pydantic_core/__init__.py1
LOWpydantic-core/python/pydantic_core/__init__.py8
LOWpydantic-core/python/pydantic_core/__init__.py8
LOWpydantic-core/python/pydantic_core/__init__.py8
LOWpydantic-core/python/pydantic_core/__init__.py8
LOWpydantic-core/python/pydantic_core/__init__.py8
LOWpydantic-core/python/pydantic_core/__init__.py8
LOWpydantic-core/python/pydantic_core/__init__.py8
LOWpydantic-core/python/pydantic_core/__init__.py8
LOWpydantic-core/python/pydantic_core/__init__.py8
LOWpydantic-core/python/pydantic_core/__init__.py8
LOWpydantic-core/python/pydantic_core/__init__.py8
LOWpydantic-core/python/pydantic_core/__init__.py8
LOWpydantic-core/python/pydantic_core/__init__.py8
LOWpydantic-core/python/pydantic_core/__init__.py8
LOWpydantic-core/python/pydantic_core/__init__.py8
LOWpydantic-core/python/pydantic_core/__init__.py8
LOWpydantic-core/python/pydantic_core/__init__.py8
LOWpydantic-core/python/pydantic_core/__init__.py8
LOWpydantic-core/python/pydantic_core/__init__.py8
LOWpydantic-core/python/pydantic_core/__init__.py8
LOWpydantic-core/python/pydantic_core/__init__.py31
LOWpydantic-core/python/pydantic_core/__init__.py31
LOWpydantic-core/python/pydantic_core/__init__.py31
LOWpydantic-core/python/pydantic_core/core_schema.py6
LOWpydantic-core/tests/conftest.py1
LOWpydantic-core/tests/test_typing.py1
LOWpydantic-core/tests/test_strict.py1
LOWpydantic-core/tests/serializers/test_union.py1
LOWpydantic-core/tests/benchmarks/nested_schema.py1
LOWpydantic-core/tests/benchmarks/complete_schema.py1
189 more matches not shown…
Docstring Block Structure41 hits · 205 pts
SeverityFileLineSnippet
HIGH.github/actions/people/people.py364Make a GraphQL request to GitHub API. Args: settings: Configuration settings including API token qu
HIGHpydantic/color.py114Returns the name of the color if it can be found in `COLORS_BY_VALUE` dictionary, otherwise returns the hexadeci
HIGHpydantic/color.py260Parse a tuple or list to get RGBA values. Args: value: A tuple or list. Returns: An `RGBA` tup
HIGHpydantic/color.py282Parse a string representing a color to an RGBA tuple. Possible formats for the input string include: * named c
HIGHpydantic/color.py356Parse the color value provided and return a number between 0 and 1. Args: value: An integer or string color
HIGHpydantic/color.py383Parse an alpha value checking it's a valid float in the range 0 to 1. Args: value: The input value to parse
HIGHpydantic/color.py441Converts a float value between 0 and 1 (inclusive) to an integer between 0 and 255 (inclusive). Args: c: Th
HIGHpydantic/fields.py293Create a new `FieldInfo` object with the `Field` function. Args: default: The default value for the
HIGHpydantic/fields.py645Return a new `FieldInfo` instance from a `dataclasses.Field` instance. Args: dc_field: The `datacla
HIGHpydantic/fields.py1210!!! abstract "Usage Documentation" [Fields](../concepts/fields.md) Create a field for objects that can be c
HIGHpydantic/fields.py1521!!! abstract "Usage Documentation" [Private Model Attributes](../concepts/models.md#private-model-attributes)
HIGHpydantic/fields.py1709!!! abstract "Usage Documentation" [The `computed_field` decorator](../concepts/fields.md#the-computed_field-dec
HIGHpydantic/json_schema.py224!!! abstract "Usage Documentation" [Customizing the JSON Schema Generation Process](../concepts/json_schema.md#c
HIGHpydantic/json_schema.py353Generates JSON schema definitions from a list of core schemas, pairing the generated definitions with a mapping
HIGHpydantic/json_schema.py400Generates a JSON schema for a specified schema in a specified mode. Args: schema: A Pydantic model.
HIGHpydantic/json_schema.py485Generate a JSON schema based on the input schema. Args: schema_or_field: The core schema to
HIGHpydantic/json_schema.py1705Resolve a JsonSchemaValue to the non-ref schema if it is a $ref schema. Args: json_schema: The sche
HIGHpydantic/root_model.py74Create a new model using the provided root object and update fields set. Args: root: The root objec
HIGHpydantic/type_adapter.py264Initialize the core schema, validator, and serializer for the type. Args: ns_resolver: The namespac
HIGHpydantic/type_adapter.py409Validate a Python object against the model. Args: object: The Python object to validate against the
HIGHpydantic/dataclasses.py80!!! abstract "Usage Documentation" [`dataclasses`](../concepts/dataclasses.md) A decorator used to create a
HIGHpydantic/main.py630Compute the class name for parametrizations of generic classes. This method can be overridden to achieve a cust
HIGHpydantic/main.py733Validate a pydantic model instance. Args: obj: The object to validate. strict: Whether
HIGHpydantic/main.py781!!! abstract "Usage Documentation" [JSON Parsing](../concepts/json.md#json-parsing) Validate the gi
HIGHpydantic/main.py1777!!! abstract "Usage Documentation" [Dynamic Model Creation](../concepts/models.md#dynamic-model-creation) D
HIGHpydantic/annotated_handlers.py51Get the real schema for a `{"$ref": ...}` schema. If the schema given is not a `$ref` schema, it will be returne
HIGHpydantic/annotated_handlers.py101Get the real schema for a `definition-ref` schema. If the schema given is not a `definition-ref` schema, it will
HIGHpydantic/_internal/_schema_generation_shared.py41Resolves `$ref` in the json schema. This returns the input json schema if there is no `$ref` in json schema.
HIGHpydantic/_internal/_schema_generation_shared.py104Resolves reference in the core schema. Args: maybe_ref_schema: The input core schema that may conta
HIGHpydantic/_internal/_decorators_v1.py55Wrap a V1 style field validator for V2 compatibility. Args: validator: The V1 style field validator. R
HIGHpydantic/_internal/_known_annotated_metadata.py170Apply `annotation` to `schema` if it is an annotation we know about (Gt, Le, etc.). Otherwise return `None`. Th
HIGHpydantic/_internal/_model_construction.py413Iterate over the namespace and: * gather private attributes * check for items which look like fields but are not
HIGHpydantic/_internal/_model_construction.py616Finish building a model class. This logic must be called after class has been created since validation functions mu
HIGHpydantic/_internal/_generate_schema.py719Generate core schema. Args: obj: The object to generate core schema for. Returns:
HIGHpydantic/_internal/_discriminated_union.py39Applies the discriminator and returns a new core schema. Args: schema: The input schema. discrimina
HIGHpydantic/_internal/_discriminated_union.py141Return a new CoreSchema based on `schema` that uses a tagged-union with the discriminator provided to this class
HIGHpydantic/_internal/_decorators.py351Get the attribute from the next class in the MRO that has it, aiming to simulate calling the method on the actual cl
HIGHpydantic/_internal/_decorators.py386Get an attribute out of the `__dict__` following the MRO. This prevents the call to `__get__` on the descriptor, and
HIGHpydantic/_internal/_fields.py230Collect the fields and class variables names of a nascent Pydantic model. The fields collection process is *lenient
HIGHpydantic/_internal/_generics.py166Used inside a function to check whether it was called globally. Args: depth: The depth to get the frame.
HIGHpydantic/_internal/_dataclasses.py93Finish building a pydantic dataclass. This logic is called on a class which has already been wrapped in `dataclasse
Cross-Language Confusion36 hits · 178 pts
SeverityFileLineSnippet
HIGHtests/test_serialize.py246 assert MyModel(x=None).model_dump_json() == '{"x":null}'
HIGHtests/test_edge_cases.py2227 '{"v": null}',
HIGHtests/test_json.py328 == '{"name":"Pumbaa","SSN":234,"birthday":737424000.0,"phone":18007267864,"friend":null}'
HIGHtests/test_types.py4396 Foobar.model_validate_json('{"password": 1234, "empty_password": null}')
HIGHpydantic-core/tests/test_json.py185 assert v.validate_json('{"1": 1, "2": "a", "3": null}') == {'1': 1, '2': 'a', '3': None}
HIGHpydantic-core/tests/serializers/test_model.py315 assert s.to_json(BasicModel(foo=None, bar=b'more')) == b'{"foo":null,"bar":"more"}'
HIGHpydantic-core/tests/serializers/test_model.py827 s.to_json(Model(3, 4), exclude_none=False, by_alias=True) == b'{"width":3,"height":4,"Area":12,"volume":null}'
HIGHpydantic-core/tests/serializers/test_model.py883 s.to_json(Model(3, 4), exclude_none=False, by_alias=True) == b'{"width":3,"height":4,"volume":null,"Area":12}'
HIGHpydantic-core/tests/serializers/test_model.py1090 assert s.to_json(m) == b'{"field_a":"test","field_b":12,"field_c":null,"field_d":[1,2,3]}'
HIGHpydantic-core/tests/serializers/test_model.py1104 assert s.to_json(m, exclude={'field_d': [0]}) == b'{"field_a":"test","field_b":12,"field_c":null,"field_d":[2,3]}'
HIGHpydantic-core/tests/serializers/test_typed_dict.py156 assert v.to_json({'foo': 1, 'bar': b'more', 'c': None}) == b'{"foo":1,"bar":"more","c":null}'
HIGHpydantic-core/tests/serializers/test_typed_dict.py157 assert v.to_json({'foo': None, 'bar': b'more'}) == b'{"foo":null,"bar":"more"}'
HIGHpydantic-core/tests/serializers/test_any.py656 assert s.to_json([inf]) == b'[null]'
HIGHpydantic-core/tests/serializers/test_any.py659 assert s.to_json([nan]) == b'[null]'
HIGHpydantic-core/tests/serializers/test_json.py23 assert s.to_json(v) == b'["a",[1,2],null]'
HIGHpydantic/json_schema.py1474 with self._config_wrapper_stack.push(config):
HIGHpydantic/json_schema.py1616 with self._config_wrapper_stack.push(config):
HIGHpydantic/json_schema.py1827 with self._config_wrapper_stack.push(config):
HIGHpydantic/_internal/_typing_extra.py328 with ns_resolver.push(base):
HIGHpydantic/_internal/_typing_extra.py382 with ns_resolver.push(base):
HIGHpydantic/_internal/_namespace_utils.py202 with ns_resolver.push(Model):
HIGHpydantic/_internal/_namespace_utils.py209 with ns_resolver.push(Sub):
HIGHpydantic/_internal/_generate_schema.py774 with self._config_wrapper_stack.push(config_wrapper), self._ns_resolver.push(cls):
HIGHpydantic/_internal/_generate_schema.py1035 with self.model_type_stack.push(obj):
HIGHpydantic/_internal/_generate_schema.py1291 with self.field_name_stack.push(name):
HIGHpydantic/_internal/_generate_schema.py1368 with self._ns_resolver.push(origin):
HIGHpydantic/_internal/_generate_schema.py1405 self.model_type_stack.push(typed_dict_cls),
HIGHpydantic/_internal/_generate_schema.py1431 with self._config_wrapper_stack.push(config):
HIGHpydantic/_internal/_generate_schema.py1534 self.model_type_stack.push(namedtuple_cls),
HIGHpydantic/_internal/_generate_schema.py1600 with self.field_name_stack.push(name):
HIGHpydantic/_internal/_generate_schema.py1650 with self.field_name_stack.push(name):
HIGHpydantic/_internal/_generate_schema.py1838 self.model_type_stack.push(dataclass),
HIGHpydantic/_internal/_generate_schema.py1868 with self._ns_resolver.push(dataclass), self._config_wrapper_stack.push(config):
HIGHpydantic/_internal/_fields.py458 with ns_resolver.push(cls):
HIGHpydantic/_internal/_fields.py558 with ns_resolver.push(base):
HIGHpydantic/_internal/_fields.py655 with ns_resolver.push(cls):
Cross-File Repetition24 hits · 120 pts
SeverityFileLineSnippet
HIGHtests/test_dataclasses.py0we promise that if you add a validator with the same _function_ name as an existing validator it replaces the existing v
HIGHtests/test_validators.py0we promise that if you add a validator with the same _function_ name as an existing validator it replaces the existing v
HIGHtests/test_validators.py0we promise that if you add a validator with the same _function_ name as an existing validator it replaces the existing v
HIGHtests/mypy/modules/decorator_implicit_classmethod.py0test that the mypy plugin implicitly transforms the right decorators into class methods.
HIGH…yproject-plugin_toml/decorator_implicit_classmethod.py0test that the mypy plugin implicitly transforms the right decorators into class methods.
HIGH…puts/mypy-plugin_ini/decorator_implicit_classmethod.py0test that the mypy plugin implicitly transforms the right decorators into class methods.
HIGHtests/benchmarks/basemodel_eq_performance.py0object.__setattr__(left, 'cache', none) object.__setattr__(right, 'cache', -1)
HIGHtests/benchmarks/basemodel_eq_performance.py0object.__setattr__(left, 'cache', none) object.__setattr__(right, 'cache', -1)
HIGHtests/benchmarks/basemodel_eq_performance.py0object.__setattr__(left, 'cache', none) object.__setattr__(right, 'cache', -1)
HIGHtests/benchmarks/basemodel_eq_performance.py0object.__setattr__(left, 'cache', none) object.__setattr__(right, 'cache', -1)
HIGHpydantic-core/tests/serializers/test_model.py0this test reflects the priority that applies for config vs runtime serialization alias configuration. if the runtime val
HIGHpydantic-core/tests/serializers/test_typed_dict.py0this test reflects the priority that applies for config vs runtime serialization alias configuration. if the runtime val
HIGHpydantic-core/tests/serializers/test_dataclasses.py0this test reflects the priority that applies for config vs runtime serialization alias configuration. if the runtime val
HIGHpydantic-core/tests/validators/test_typed_dict.py0this test reflects the priority that applies for config vs runtime validation alias configuration. runtime values take p
HIGHpydantic-core/tests/validators/test_dataclasses.py0this test reflects the priority that applies for config vs runtime validation alias configuration. runtime values take p
HIGHpydantic-core/tests/validators/test_model_fields.py0this test reflects the priority that applies for config vs runtime validation alias configuration. runtime values take p
HIGHpydantic-core/tests/validators/test_arguments.py0this 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.py0this test reflects the priority that applies for config vs runtime validation alias configuration. runtime values take p
HIGHpydantic-core/tests/validators/test_url.py0hosts can't be provided with any single url values.
HIGHpydantic-core/tests/validators/test_url.py0hosts can't be provided with any single url values.
HIGHpydantic-core/tests/validators/test_url.py0hosts can't be provided with any single url values.
HIGHpydantic/types.py0get the json format for the encoded data. returns: the json format for the encoded data.
HIGHpydantic/types.py0get the json format for the encoded data. returns: the json format for the encoded data.
HIGHpydantic/types.py0get the json format for the encoded data. returns: the json format for the encoded data.
Deep Nesting125 hits · 108 pts
SeverityFileLineSnippet
LOWtests/test_exports.py33
LOWtests/test_exports.py39
LOWdocs/plugins/main.py54
LOWpydantic-core/wasm-preview/run_tests.py18
LOWpydantic-core/tests/test_errors.py702
LOWpydantic-core/tests/validators/test_string.py351
LOWpydantic-core/tests/validators/test_with_default.py822
LOWpydantic-core/tests/validators/test_url.py70
LOWpydantic-core/tests/validators/test_url.py484
LOWpydantic-core/tests/validators/test_url.py982
LOWpydantic-core/tests/validators/test_url.py1038
LOW.github/actions/people/people.py451
LOW.github/actions/people/people.py497
LOW.github/actions/people/people.py581
LOWpydantic/fields.py481
LOWpydantic/fields.py578
LOWpydantic/fields.py836
LOWpydantic/mypy.py186
LOWpydantic/mypy.py359
LOWpydantic/mypy.py569
LOWpydantic/mypy.py902
LOWpydantic/mypy.py999
LOWpydantic/mypy.py1024
LOWpydantic/mypy.py1082
LOWpydantic/types.py3074
LOWpydantic/types.py1028
LOWpydantic/json_schema.py2793
LOWpydantic/json_schema.py200
LOWpydantic/json_schema.py836
LOWpydantic/json_schema.py879
LOWpydantic/json_schema.py1361
LOWpydantic/json_schema.py1455
LOWpydantic/json_schema.py1537
LOWpydantic/json_schema.py2418
LOWpydantic/json_schema.py2422
LOWpydantic/main.py317
LOWpydantic/main.py393
LOWpydantic/main.py1425
LOWpydantic/main.py1080
LOWpydantic/v1/_hypothesis_plugin.py356
LOWpydantic/v1/fields.py197
LOWpydantic/v1/fields.py581
LOWpydantic/v1/fields.py850
LOWpydantic/v1/fields.py898
LOWpydantic/v1/fields.py1000
LOWpydantic/v1/fields.py1053
LOWpydantic/v1/fields.py1171
LOWpydantic/v1/decorator.py61
LOWpydantic/v1/decorator.py179
LOWpydantic/v1/validators.py81
LOWpydantic/v1/validators.py316
LOWpydantic/v1/validators.py699
LOWpydantic/v1/env_settings.py166
LOWpydantic/v1/env_settings.py281
LOWpydantic/v1/env_settings.py94
LOWpydantic/v1/mypy.py171
LOWpydantic/v1/mypy.py344
LOWpydantic/v1/mypy.py539
LOWpydantic/v1/class_validators.py195
LOWpydantic/v1/class_validators.py288
65 more matches not shown…
Fake / Example Data80 hits · 97 pts
SeverityFileLineSnippet
LOWREADME.md50 name: str = 'John Doe'
LOWREADME.md57#> User id=123 name='John Doe' signup_ts=datetime.datetime(2017, 6, 1, 12, 22) friends=[1, 2, 3]
LOWtests/test_types_typeddict.py978 m = Model.model_validate({'a': {'name': 'John Doe', 'extra': 'something'}})
LOWtests/test_types_typeddict.py980 assert m.model_dump() == {'a': {'name': 'John Doe', 'extra': 'something'}}
LOWtests/test_rich_repr.py13 name: str = 'John Doe'
LOWtests/test_rich_repr.py26 ('name', 'John Doe'),
LOWtests/test_dataclasses.py561 name: str = 'John Doe'
LOWtests/test_dataclasses.py570 assert fields['name'].default == 'John Doe'
LOWtests/test_dataclasses.py614 name: str = 'John Doe'
LOWtests/test_dataclasses.py642 'name': {'default': 'John Doe', 'title': 'Name', 'type': 'string'},
LOWtests/test_config.py124 ('id: int = 1', 'bar=2', 'baz: Any', "name: str = 'John Doe'", 'foo: str', '**data'),
LOWtests/test_config.py126 assert _equals(str(sig), "(id: int = 1, bar=2, *, baz: Any, name: str = 'John Doe', foo: str, **data) -> None")
LOWtests/test_config.py111 name: str = 'John Doe'
LOWtests/test_edge_cases.py2327 assert module.User(id=12).model_dump() == {'id': 12, 'name': 'Jane Doe'}
LOWtests/test_edge_cases.py2800 data = {'age': 'John Doe'}
LOWtests/test_edge_cases.py2320 name: str = 'Jane Doe'
LOWtests/test_model_signature.py53 name: str = 'John Doe'
LOWtests/test_model_signature.py66 ('id: int = 1', 'bar=2', 'baz: Any', "name: str = 'John Doe'", 'foo: str', '**data'),
LOWtests/test_model_signature.py69 assert _equals(str(sig), "(id: int = 1, bar=2, *, baz: Any, name: str = 'John Doe', foo: str, **data) -> None")
LOWtests/test_types.py7046 assert Foo(baz=' uSeR@ExAmPlE.com ').baz == 'user@example.com'
LOWdocs/index.md63 name: str = 'John Doe' # (2)!
LOWdocs/index.md86 'name': 'John Doe',
LOWdocs/index.md120 name: str = 'John Doe'
LOWdocs/plugins/devtools_output.html22user: id=123 name='John Doe' signup_ts=datetime.datetime(2019, 6, 1, 12, 22) friends=[1234, 4567, 7890] address=Address(
LOWdocs/integrations/devtools.md38 name='John Doe',
LOWdocs/examples/queues.md38user1 = User(id=1, name='John Doe', email='john@example.com')
LOWdocs/examples/queues.md39user2 = User(id=2, name='Jane Doe', email='jane@example.com')
LOWdocs/examples/queues.md42#> Added to queue: {"id":1,"name":"John Doe","email":"john@example.com"}
LOWdocs/examples/queues.md45#> Added to queue: {"id":2,"name":"Jane Doe","email":"jane@example.com"}
LOWdocs/examples/queues.md59#> Validated user: User(id=1, name='John Doe', email='john@example.com')
LOWdocs/examples/queues.md62#> Validated user: User(id=2, name='Jane Doe', email='jane@example.com')
LOWdocs/examples/queues.md109user1 = User(id=1, name='John Doe', email='john@example.com')
LOWdocs/examples/queues.md110user2 = User(id=2, name='Jane Doe', email='jane@example.com')
LOWdocs/examples/queues.md113#> Added to queue: {"id":1,"name":"John Doe","email":"john@example.com"}
LOWdocs/examples/queues.md116#> Added to queue: {"id":2,"name":"Jane Doe","email":"jane@example.com"}
LOWdocs/examples/queues.md205 user1 = User(id=1, name='John Doe', email='john@example.com')
LOWdocs/examples/queues.md206 user2 = User(id=2, name='Jane Doe', email='jane@example.com')
LOWdocs/examples/files.md16 "name": "John Doe",
LOWdocs/examples/files.md39#> name='John Doe' age=30 email='john@example.com'
LOWdocs/examples/files.md97 "name": "John Doe",
LOWdocs/examples/files.md102 "name": "Jane Doe",
LOWdocs/examples/files.md128#> [Person(name='John Doe', age=30, email='john@example.com'), Person(name='Jane Doe', age=25, email='jane@example.com')
LOWdocs/examples/files.md128#> [Person(name='John Doe', age=30, email='john@example.com'), Person(name='Jane Doe', age=25, email='jane@example.com')
LOWdocs/examples/files.md142{"name": "John Doe", "age": 30, "email": "john@example.com"}
LOWdocs/examples/files.md143{"name": "Jane Doe", "age": 25, "email": "jane@example.com"}
LOWdocs/examples/files.md163#> [Person(name='John Doe', age=30, email='john@example.com'), Person(name='Jane Doe', age=25, email='jane@example.com')
LOWdocs/examples/files.md163#> [Person(name='John Doe', age=30, email='john@example.com'), Person(name='Jane Doe', age=25, email='jane@example.com')
LOWdocs/examples/files.md199#> [Person(name='John Doe', age=30, email='john@example.com'), Person(name='Jane Doe', age=25, email='jane@example.com')
LOWdocs/examples/files.md199#> [Person(name='John Doe', age=30, email='john@example.com'), Person(name='Jane Doe', age=25, email='jane@example.com')
LOWdocs/examples/files.md209name = "John Doe"
LOWdocs/examples/files.md233#> name='John Doe' age=30 email='john@example.com'
LOWdocs/examples/files.md267#> name='John Doe' age=30 email='john@example.com'
LOWdocs/examples/files.md303#> name='John Doe' age=30 email='john@example.com'
LOWdocs/examples/files.md337#> name='John Doe' age=30 email='john@example.com'
LOWdocs/concepts/json_schema.md939 'name': 'John Doe',
LOWdocs/concepts/json_schema.md953 "name": "John Doe"
LOWdocs/concepts/unions.md152user_01 = User(id=123, name='John Doe')
LOWdocs/concepts/unions.md154#> id=123 name='John Doe'
LOWdocs/concepts/unions.md157user_02 = User(id='1234', name='John Doe')
LOWdocs/concepts/unions.md159#> id='1234' name='John Doe'
20 more matches not shown…
Self-Referential Comments15 hits · 28 pts
SeverityFileLineSnippet
MEDIUMtests/test_validators.py3131 ) # Create a Sub instance without triggering validation (e.g., using model_construct)
MEDIUMtests/test_main.py2954 # Defining a nested type does not error
MEDIUMtests/test_types.py6546 # Create a module that exists, but fails to import due to missing dependency
MEDIUMpydantic/types.py995 # Create an instance
MEDIUMpydantic/json_schema.py102 """This class is used to emit warnings produced during JSON schema generation.
MEDIUMpydantic/json_schema.py2464 """This method is responsible for ignoring warnings as desired, and for formatting the warning messages.
MEDIUMpydantic/root_model.py136 """This method is included just to get a more accurate return type for type checkers.
MEDIUMpydantic/functional_serializers.py158 """This method is used to get the Pydantic core schema of the class.
MEDIUMpydantic/_internal/_model_construction.py371 """This function is meant to behave like a BaseModel method to initialize private attributes.
MEDIUMpydantic/_internal/_generate_schema.py2166 # Create a new ComputedFieldInfo so that different type parametrizations of the same
MEDIUMpydantic/_internal/_generate_schema.py2337 # Create a new union schema, preserving the order of the union:
MEDIUMpydantic/_internal/_discriminated_union.py74 """This class is used to convert an input schema containing a union schema into one where that union is
MEDIUMpydantic/_internal/_decorators.py762 # Define the types we want to check against as a single tuple.
MEDIUMpydantic/plugin/__init__.py55 """This method is called for each plugin every time a new [`SchemaValidator`][pydantic_core.SchemaValidator]
MEDIUMpydantic/deprecated/config.py31 """This class is only retained for backwards compatibility.
AI Slop Vocabulary12 hits · 19 pts
SeverityFileLineSnippet
LOWtests/test_dataclasses.py2254 # for standard dataclasses, so we just use TypeAdapter to get validation for each.
MEDIUMtests/test_edge_cases.py2240 """This is primarily included in order to document the behavior / limitations of the `Hashable` type's validation lo
LOWpydantic-core/tests/serializers/test_any.py348 # because when recursion is detected and we're in mode python, we just return the value
LOWpydantic-core/tests/serializers/test_any.py383 # when recursion is detected and we're in mode python, we just return the value
LOWpydantic/functional_validators.py277 # we don't want to bother with further validation, just return the new value
LOWpydantic/types.py1751 # hence we just use `secret_display`
MEDIUMpydantic/json_schema.py2806 # for instance when "examples" is used as a property key. A more robust solution
LOWpydantic/json_schema.py461 # If a schema with the same CoreRef has been handled, just return a reference to it
LOWpydantic/main.py1220 # early if there are no keys to ignore (we would just return False later on anyway)
LOWpydantic/v1/error_wrappers.py46# but recursive, therefore just use:
MEDIUMpydantic/_internal/_docs_extraction.py97 # making it way more robust.
LOWpydantic/_internal/_validators.py75 # otherwise we just return the value and let the next validator do the rest of the work
Over-Commented Block18 hits · 17 pts
SeverityFileLineSnippet
LOWtests/test_edge_cases.py1161 ]
LOWtests/test_edge_cases.py1181# class Model(BaseModel):
LOWpydantic-core/tests/test.rs1#[cfg(test)]
LOWpydantic-core/src/definitions.rs21
LOWpydantic-core/src/validators/validation_state.rs21pub struct ValidationState<'a, 'py> {
LOWpydantic-core/src/errors/location.rs81}
LOW.github/workflows/third-party.yml1# This workflow is a daily cron job, inspired by:
LOWpydantic/fields.py541 # HACK: It is common for users to define "make model partial" (or similar) utilities, that
LOWpydantic/main.py1221 model_fields = type(self).__pydantic_fields__.keys()
LOWpydantic/v1/_hypothesis_plugin.py41# them on-disk, and that's unsafe in general without being told *where* to do so.
LOWpydantic/v1/generics.py221 if not issubclass(base_model, GenericModel):
LOWpydantic/_internal/_namespace_utils.py201 # This is roughly what happens when we build a core schema for `Model`:
LOWpydantic/_internal/_namespace_utils.py261 # Adding `__type_params__` *before* `vars(typ)`, as the latter takes priority
LOWpydantic/_internal/_discriminated_union.py101 # this, the inference logic gets complicated very quickly, and could result in confusing
LOWpydantic/_internal/_discriminated_union.py121 # as an indication that, even if None is discovered as one of the union choices, we will not need to wrap
LOWpydantic/_internal/_discriminated_union.py201 # was flattened by pydantic_core.
LOWpydantic/_internal/_fields.py341 if assigned_value is PydanticUndefined: # no assignment, just a plain annotation
LOWpydantic/_internal/_generics.py121 The created submodel.
Overly Generic Function Names14 hits · 12 pts
SeverityFileLineSnippet
LOWtests/test_config.py460 def my_function():
LOWtests/test_config.py486 def my_function():
LOWtests/test_types.py6035 def my_function(y: type_hint):
LOWtests/test_types.py7278 def do_something(self):
LOWtests/test_types.py7287 def do_something(self):
LOWpydantic-core/tests/test_errors.py87 def my_function(input_value, info):
LOWpydantic-core/tests/validators/test_function.py65 def my_function(input_value, info):
LOWpydantic-core/tests/validators/test_function.py100 def my_function(input_value, info):
LOWpydantic-core/tests/validators/test_call.py26 def my_function(a, b, c):
LOWpydantic-core/tests/validators/test_call.py69 def my_function(a, b, c):
LOWpydantic-core/tests/validators/test_call.py83 def my_function(a):
LOWpydantic-core/tests/validators/test_call.py93 def my_function(a):
LOWpydantic-core/tests/validators/test_call.py177 def my_function(a, b, c):
LOWpydantic-core/tests/validators/test_call.py197 def my_function(a):
Cross-Language Confusion (JS/TS)2 hits · 10 pts
SeverityFileLineSnippet
HIGHpydantic-core/wasm-preview/worker.js28 print(tty);
HIGHpydantic-core/wasm-preview/worker.js32 print(tty);
Hallucination Indicators1 hit · 10 pts
SeverityFileLineSnippet
CRITICALpydantic/v1/mypy.py334 for name, sym in self._ctx.cls.info.names.items():
Excessive Try-Catch Wrapping7 hits · 7 pts
SeverityFileLineSnippet
LOWtests/mypy/test_mypy.py207 except Exception:
LOWpydantic-core/wasm-preview/run_tests.py63except Exception:
LOWpydantic/json_schema.py1199 except Exception:
LOWpydantic/v1/_hypothesis_plugin.py226 except Exception: # pragma: no cover
LOWpydantic/_internal/_core_utils.py87 except Exception:
LOWpydantic/_internal/_typing_extra.py342 except Exception:
LOWpydantic/plugin/_schema_validator.py119 except Exception as exception:
Dead Code1 hit · 2 pts
SeverityFileLineSnippet
MEDIUMtests/test_deprecated.py574