instructor
instructor copied to clipboard
Update mode.py to warn in `Mode.FUNCTIONS` access vs. in `__new__`
Currently, any import of instructor
raises a DeprecationWarning
. This is noisy and also makes it impossible to have test suites raise an error on DeprecationWarning
. Example code:
import warnings
warnings.simplefilter("default")
import instructor # raises `DeprecationWarning: FUNCTIONS is deprecated and will be removed in future versionss enum_member = enum_class._new_member_(enum_class, *args)`
:rocket: This description was created by Ellipsis for commit 90edc70cefc2ee9f30870f5f510ad2f33ace54eb |
---|
Summary:
This PR moves the deprecation warning for FUNCTIONS
in Mode
class to only trigger when accessed, reducing import-time noise.
Key points:
- Moved
DeprecationWarning
forFUNCTIONS
from__new__
to__getattribute__
in aMode
metaclass. - Reduces warning noise at import time.
- Allows better handling of
DeprecationWarning
in test suites.
Generated with :heart: by ellipsis.dev
:rocket: This description was created by Ellipsis for commit 9ef6f1aa5d17baeada3febcc5fb7ef98813d86ac |
---|
Summary:
This PR moves the deprecation warning for FUNCTIONS
in the Mode
class to only trigger when accessed, reducing import-time noise.
Key points:
- Moved
DeprecationWarning
forFUNCTIONS
from__new__
to__getattribute__
inMode
class using_WarnOnFunctionsAccessEnumMeta
metaclass. - Reduces warning noise at import time.
- Allows better handling of
DeprecationWarning
in test suites.
Generated with :heart: by ellipsis.dev