[python] Add back __enter__ and __exit__ methods for non asyncio (#16979)

This commit is contained in:
Yohei Kitamura 2023-11-04 04:54:17 -04:00 committed by GitHub
parent c4b18f206d
commit 61629ae8ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 22 additions and 0 deletions

View File

@ -92,6 +92,13 @@ class ApiClient:
async def close(self):
await self.rest_client.close()
{{/asyncio}}
{{^asyncio}}
def __enter__(self):
return self
def __exit__(self, exc_type, exc_value, traceback):
pass
{{/asyncio}}
@property
def user_agent(self):

View File

@ -90,6 +90,11 @@ class ApiClient:
self.user_agent = 'OpenAPI-Generator/1.0.0/python'
self.client_side_validation = configuration.client_side_validation
def __enter__(self):
return self
def __exit__(self, exc_type, exc_value, traceback):
pass
@property
def user_agent(self):

View File

@ -90,6 +90,11 @@ class ApiClient:
self.user_agent = 'OpenAPI-Generator/1.0.0/python'
self.client_side_validation = configuration.client_side_validation
def __enter__(self):
return self
def __exit__(self, exc_type, exc_value, traceback):
pass
@property
def user_agent(self):

View File

@ -89,6 +89,11 @@ class ApiClient:
self.user_agent = 'OpenAPI-Generator/1.0.0/python'
self.client_side_validation = configuration.client_side_validation
def __enter__(self):
return self
def __exit__(self, exc_type, exc_value, traceback):
pass
@property
def user_agent(self):