Skip to content

Conversation

@samn
Copy link
Contributor

@samn samn commented Apr 8, 2025

Also upgrades a couple of dev dependencies needed to get the build running.

Fixes the following warning that Pydantic v2 issues used with this library:

PydanticDeprecatedSince20: Support for class-based `config` is deprecated, use ConfigDict instead. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.11/migration/
    warnings.warn(DEPRECATION_MESSAGE, DeprecationWarning)

Also upgrades a couple of dev dependencies needed to get
the build running.
Comment on lines +46 to +50
if _PYDANTIC_2_0:
model_config = pydantic.ConfigDict(populate_by_name=True)
else:

class Config:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ran a little test in the repl to show that this works:

>>> class A:
...     if True:
...             a_field = 1
...     else:
...             class SubClass:
...                     b_field = 2
... 
>>> A().a_field
1
>>> A().b_field
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'A' object has no attribute 'b_field'. Did you mean: 'a_field'?
>>> class A:
...     if False:
...             a_field = 1
...     else:
...             class SubClass:
...                     b_field = 2
... 
>>> A().a_field
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'A' object has no attribute 'a_field'
>>> A().SubClass
<class '__main__.A.SubClass'>
>>> A().SubClass().b_field
2

@samn
Copy link
Contributor Author

samn commented Apr 8, 2025

@microsoft-github-policy-service agree [company="Upstream Tech"]

@samn
Copy link
Contributor Author

samn commented Apr 8, 2025

@microsoft-github-policy-service agree company="Upstream Tech"

@ghidalgo3 ghidalgo3 merged commit 90ef249 into microsoft:main May 28, 2025
1 check passed
@ghidalgo3
Copy link
Collaborator

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants