litestar-org / polyfactory

Simple and powerful factories for mock data generation
https://polyfactory.litestar.dev/
MIT License
988 stars 78 forks source link

refactor: change order of imports for pydantic v1 #509

Closed guacs closed 5 months ago

guacs commented 5 months ago

Description

When importing PyObject from pydantic, if it's v2 then a warning is raised due to it being deprecated in favor of ImportString. The expected ImportError doesn't occur until after the import of PyObject takes place hence any user that's using pydantic v2 would see the warning. This ensures that PyObject is imported last so that the warning is not raised.

sonarcloud[bot] commented 5 months ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
50.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud

github-actions[bot] commented 5 months ago

Documentation preview will be available shortly at https://litestar-org.github.io/polyfactory-docs-preview/509