[go: up one dir, main page]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Match with botocore codestyle #952

Merged
merged 6 commits into from
Jul 20, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Apply codestyle across all codebase
- Trim white spaces in all files
- Apply black to aiobotocore, examples, and tests
- Apply isort to aiobotocore, examples, and tests
  • Loading branch information
gmsantos committed Jul 4, 2022
commit 821a649c41e1a5295c7cbd9fd85d1a6d3596b94b
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* [ ] Detailed description of issue
* [ ] Alternative methods considered (if any)
* [ ] How issue is being resolved
* [ ] How issue can be reproduced
* [ ] How issue can be reproduced
* [ ] If this is providing a new feature (can be provided via link to issue with these details):
* [ ] Detailed description of new feature
* [ ] Why needed
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,4 @@ target/
# rope
.ropeproject

Pipfile.lock
Pipfile.lock
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ Enable type checking and code completion
----------------------------------------

Install types-aiobotocore_ that contains type annotations for `aiobotocore`
and all supported botocore_ services.
and all supported botocore_ services.

.. code:: bash

Expand Down
4 changes: 2 additions & 2 deletions aiobotocore/_endpoint_helpers.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import aiohttp.http_exceptions
import asyncio

import aiohttp.http_exceptions
import botocore.retryhandler
import wrapt


# Monkey patching: We need to insert the aiohttp exception equivalents
# The only other way to do this would be to have another config file :(
_aiohttp_retryable_exceptions = [
Expand Down
8 changes: 6 additions & 2 deletions aiobotocore/_helpers.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import inspect

try:
from contextlib import asynccontextmanager # noqa: F401 lgtm[py/unused-import]
from contextlib import ( # noqa: F401 lgtm[py/unused-import]
asynccontextmanager,
)
except ImportError:
from async_generator import asynccontextmanager # noqa: F401 E501, lgtm[py/unused-import]
from async_generator import ( # noqa: F401 E501, lgtm[py/unused-import]
asynccontextmanager,
)


async def resolve_awaitable(obj):
Expand Down
51 changes: 36 additions & 15 deletions aiobotocore/args.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import copy

from botocore.args import ClientArgsCreator
import botocore.serialize
import botocore.parsers
import botocore.serialize
from botocore.args import ClientArgsCreator

from .config import AioConfig
from .endpoint import AioEndpointCreator
Expand All @@ -12,14 +12,29 @@
class AioClientArgsCreator(ClientArgsCreator):
# NOTE: we override this so we can pull out the custom AioConfig params and
# use an AioEndpointCreator
def get_client_args(self, service_model, region_name, is_secure,
endpoint_url, verify, credentials, scoped_config,
client_config, endpoint_bridge):
def get_client_args(
self,
service_model,
region_name,
is_secure,
endpoint_url,
verify,
credentials,
scoped_config,
client_config,
endpoint_bridge,
):
final_args = self.compute_client_args(
service_model, client_config, endpoint_bridge, region_name,
endpoint_url, is_secure, scoped_config)
service_model,
client_config,
endpoint_bridge,
region_name,
endpoint_url,
is_secure,
scoped_config,
)

service_name = final_args['service_name'] # noqa
service_name = final_args['service_name'] # noqa
parameter_validation = final_args['parameter_validation']
endpoint_config = final_args['endpoint_config']
protocol = final_args['protocol']
Expand All @@ -33,10 +48,12 @@ def get_client_args(self, service_model, region_name, is_secure,

event_emitter = copy.copy(self._event_emitter)
signer = AioRequestSigner(
service_model.service_id, signing_region,
service_model.service_id,
signing_region,
endpoint_config['signing_name'],
endpoint_config['signature_version'],
credentials, event_emitter
credentials,
event_emitter,
)

config_kwargs['s3'] = s3_config
Expand All @@ -51,19 +68,23 @@ def get_client_args(self, service_model, region_name, is_secure,
endpoint_creator = AioEndpointCreator(event_emitter)

endpoint = endpoint_creator.create_endpoint(
service_model, region_name=endpoint_region_name,
endpoint_url=endpoint_config['endpoint_url'], verify=verify,
service_model,
region_name=endpoint_region_name,
endpoint_url=endpoint_config['endpoint_url'],
verify=verify,
response_parser_factory=self._response_parser_factory,
max_pool_connections=new_config.max_pool_connections,
proxies=new_config.proxies,
timeout=(new_config.connect_timeout, new_config.read_timeout),
socket_options=socket_options,
client_cert=new_config.client_cert,
proxies_config=new_config.proxies_config,
connector_args=new_config.connector_args)
connector_args=new_config.connector_args,
)

serializer = botocore.serialize.create_serializer(
protocol, parameter_validation)
protocol, parameter_validation
)
response_parser = botocore.parsers.create_parser(protocol)
return {
'serializer': serializer,
Expand All @@ -75,5 +96,5 @@ def get_client_args(self, service_model, region_name, is_secure,
'loader': self._loader,
'client_config': new_config,
'partition': partition,
'exceptions_factory': self._exceptions_factory
'exceptions_factory': self._exceptions_factory,
}
4 changes: 2 additions & 2 deletions aiobotocore/awsrequest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from botocore.awsrequest import AWSResponse
import botocore.utils
from botocore.awsrequest import AWSResponse


class AioAWSResponse(AWSResponse):
Expand All @@ -10,7 +10,7 @@ async def _content_prop(self):

if self._content is None:
# NOTE: this will cache the data in self.raw
self._content = await self.raw.read() or bytes()
self._content = await self.raw.read() or b''

return self._content

Expand Down
Loading