forked from openai/openai-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove support for py <3.6, mypy, lots of cleanup (#19)
* python 3.6 + typing (#25) - Formally require Python 3.6 or later. This never worked under Python 2.7. - Drop now-unnecessary `__future__` and `six` references. - Use `py.typed` to declare that we support type hints. - Fix a variety of mypy errors. - Don't use star imports, so that other packages can tell if they're making an invalid reference. - Drop support for non-`requests` HTTP clients. - Drop `EngineAPIResource.update`; it could never have worked. Tested against primaryapi and engineapi in staging, and it doesn't break them. After this, `mypy ./openai` runs clean. * delete unused code (#27) - Delete `ListObject`. It has some typing errors that suggest it never worked, and it is unused as far as I can tell. - Delete `VerifyMixin`. It is unused. - Delete `CardError`. It is unused and smells of rotten pasta. - Delete `OpenAIErrorWithParamCode`, which only has one subclass, `InvalidRequestError`, and make `InvalidRequestError` a direct subclass of `OpenAIError`. Currrently, `OpenAIErrorWithParamCode` depends on the internal structure of `InvalidRequestError` so they're not independent. * boring formatting and typing fixes (#26) These are another step towards being able to enforce black, flake8, and mypy on CI. * fix more typing issues in prep for CI (#28) - Simplify `platform.XXX` calls. As far as I know these can't raise an exception in Python 3. - Simplify `EngineAPIResource` constructor and remove its unused `retrieve` method. * Update readme, bump version * typo fix Co-authored-by: Madeleine Thompson <madeleineth@gmail.com> Co-authored-by: Madeleine Thompson <madeleine@openai.com>
- Loading branch information
1 parent
d53d9ef
commit 40c32f9
Showing
33 changed files
with
153 additions
and
1,734 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
from openai.api_resources.completion import Completion | ||
from openai.api_resources.engine import Engine | ||
from openai.api_resources.error_object import ErrorObject | ||
from openai.api_resources.file import File | ||
from openai.api_resources.answer import Answer | ||
from openai.api_resources.classification import Classification | ||
from openai.api_resources.snapshot import Snapshot | ||
from openai.api_resources.fine_tune import FineTune | ||
from openai.api_resources.completion import Completion # noqa: F401 | ||
from openai.api_resources.engine import Engine # noqa: F401 | ||
from openai.api_resources.error_object import ErrorObject # noqa: F401 | ||
from openai.api_resources.file import File # noqa: F401 | ||
from openai.api_resources.answer import Answer # noqa: F401 | ||
from openai.api_resources.classification import Classification # noqa: F401 | ||
from openai.api_resources.snapshot import Snapshot # noqa: F401 | ||
from openai.api_resources.fine_tune import FineTune # noqa: F401 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,12 @@ | ||
from __future__ import absolute_import, division, print_function | ||
|
||
# flake8: noqa | ||
|
||
from openai.api_resources.abstract.api_resource import APIResource | ||
from openai.api_resources.abstract.singleton_api_resource import ( | ||
SingletonAPIResource, | ||
) | ||
|
||
from openai.api_resources.abstract.createable_api_resource import ( | ||
CreateableAPIResource, | ||
) | ||
from openai.api_resources.abstract.updateable_api_resource import ( | ||
UpdateableAPIResource, | ||
) | ||
from openai.api_resources.abstract.deletable_api_resource import ( | ||
DeletableAPIResource, | ||
) | ||
from openai.api_resources.abstract.listable_api_resource import ( | ||
ListableAPIResource, | ||
) | ||
from openai.api_resources.abstract.verify_mixin import VerifyMixin | ||
|
||
from openai.api_resources.abstract.singleton_api_resource import SingletonAPIResource | ||
from openai.api_resources.abstract.createable_api_resource import CreateableAPIResource | ||
from openai.api_resources.abstract.updateable_api_resource import UpdateableAPIResource | ||
from openai.api_resources.abstract.deletable_api_resource import DeletableAPIResource | ||
from openai.api_resources.abstract.listable_api_resource import ListableAPIResource | ||
from openai.api_resources.abstract.custom_method import custom_method | ||
|
||
from openai.api_resources.abstract.nested_resource_class_methods import ( | ||
nested_resource_class_methods, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.