Skip to content

Commit

Permalink
Merge branch 'release-1.34.147'
Browse files Browse the repository at this point in the history
* release-1.34.147:
  Bumping version to 1.34.147
  Update to latest models
  Bump certifi from 2024.6.2 to 2024.7.4
  Updating contributing guide
  Use --unsafe-fixes for older formatting fixes
  Run ruff over codebase
  Add ruff setup
  • Loading branch information
aws-sdk-python-automation committed Jul 23, 2024
2 parents 336da4e + 9a978b4 commit f7a8f7c
Show file tree
Hide file tree
Showing 115 changed files with 3,042 additions and 1,388 deletions.
37 changes: 37 additions & 0 deletions .changes/1.34.147.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[
{
"category": "``appsync``",
"description": "Adding support for paginators in AppSync list APIs",
"type": "api-change"
},
{
"category": "``cleanrooms``",
"description": "This release adds AWS Entity Resolution integration to associate ID namespaces & ID mapping workflow resources as part of ID namespace association and ID mapping table in AWS Clean Rooms. It also introduces a new ID_MAPPING_TABLE analysis rule to manage the protection on ID mapping table.",
"type": "api-change"
},
{
"category": "``cleanroomsml``",
"description": "Adds SQL query as the source of seed audience for audience generation job.",
"type": "api-change"
},
{
"category": "``connect``",
"description": "Added PostContactSummary segment type on ListRealTimeContactAnalysisSegmentsV2 API",
"type": "api-change"
},
{
"category": "``connect-contact-lens``",
"description": "Added PostContactSummary segment type on ListRealTimeContactAnalysisSegments API",
"type": "api-change"
},
{
"category": "``datazone``",
"description": "This release removes the deprecated dataProductItem field from Search API output.",
"type": "api-change"
},
{
"category": "``entityresolution``",
"description": "Support First Party ID Mapping",
"type": "api-change"
}
]
18 changes: 5 additions & 13 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,13 @@ repos:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: 'https://github.com/asottile/pyupgrade'
rev: v3.15.0
hooks:
- id: pyupgrade
args:
- '--py38-plus'
- repo: 'https://github.com/PyCQA/isort'
rev: 5.12.0
hooks:
- id: isort
- repo: 'https://github.com/psf/black'
rev: 23.11.0
hooks:
- id: black
- repo: 'https://github.com/pycqa/flake8'
rev: 6.1.0
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.4.8
hooks:
- id: flake8
- id: ruff
args: [ --fix ]
- id: ruff-format
12 changes: 12 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@
CHANGELOG
=========

1.34.147
========

* api-change:``appsync``: Adding support for paginators in AppSync list APIs
* api-change:``cleanrooms``: This release adds AWS Entity Resolution integration to associate ID namespaces & ID mapping workflow resources as part of ID namespace association and ID mapping table in AWS Clean Rooms. It also introduces a new ID_MAPPING_TABLE analysis rule to manage the protection on ID mapping table.
* api-change:``cleanroomsml``: Adds SQL query as the source of seed audience for audience generation job.
* api-change:``connect``: Added PostContactSummary segment type on ListRealTimeContactAnalysisSegmentsV2 API
* api-change:``connect-contact-lens``: Added PostContactSummary segment type on ListRealTimeContactAnalysisSegments API
* api-change:``datazone``: This release removes the deprecated dataProductItem field from Search API output.
* api-change:``entityresolution``: Support First Party ID Mapping


1.34.146
========

Expand Down
15 changes: 6 additions & 9 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,11 @@ Reporting An Issue/Feature

Codestyle
---------
This project uses flake8 to enforce codstyle requirements. We've codified this
process using a tool called `pre-commit <https://pre-commit.com/>`__. pre-commit
allows us to specify a config file with all tools required for code linting,
and surfaces either a git commit hook, or single command, for enforcing these.
This project uses `ruff <https://github.com/astral-sh/ruff>`__ to enforce
codstyle requirements. We've codified this process using a tool called
`pre-commit <https://pre-commit.com/>`__. pre-commit allows us to specify a
config file with all tools required for code linting, and surfaces either a
git commit hook, or single command, for enforcing these.

To validate your PR prior to publishing, you can use the following
`installation guide <https://pre-commit.com/#install>`__ to setup pre-commit.
Expand All @@ -88,11 +89,7 @@ to automatically perform the codestyle validation:
$ pre-commit run
This will automatically perform simple updates (such as white space clean up)
and provide a list of any failing flake8 checks. After these are addressed,
and provide a list of any failing checks. After these are addressed,
you can commit the changes prior to publishing the PR.
These checks are also included in our CI setup under the "Lint" workflow which
will provide output on Github for anything missed locally.

See the `flake8` section of the
`setup.cfg <https://github.com/boto/botocore/blob/develop/setup.cfg>`__ for the
currently enforced rules.
2 changes: 1 addition & 1 deletion botocore/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import os
import re

__version__ = '1.34.146'
__version__ = '1.34.147'


class NullHandler(logging.Handler):
Expand Down
3 changes: 2 additions & 1 deletion botocore/args.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
considered internal, and *not* a public API.
"""

import copy
import logging
import socket
Expand Down Expand Up @@ -460,7 +461,7 @@ def _get_sts_regional_endpoints_config(self):

def _set_global_sts_endpoint(self, endpoint_config, is_secure):
scheme = 'https' if is_secure else 'http'
endpoint_config['endpoint_url'] = '%s://sts.amazonaws.com' % scheme
endpoint_config['endpoint_url'] = f'{scheme}://sts.amazonaws.com'
endpoint_config['signing_region'] = 'us-east-1'

def _resolve_endpoint(
Expand Down
12 changes: 6 additions & 6 deletions botocore/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,12 +432,12 @@ def add_auth(self, request):
self._inject_signature_to_request(request, signature)

def _inject_signature_to_request(self, request, signature):
auth_str = ['AWS4-HMAC-SHA256 Credential=%s' % self.scope(request)]
auth_str = [f'AWS4-HMAC-SHA256 Credential={self.scope(request)}']
headers_to_sign = self.headers_to_sign(request)
auth_str.append(
f"SignedHeaders={self.signed_headers(headers_to_sign)}"
)
auth_str.append('Signature=%s' % signature)
auth_str.append(f'Signature={signature}')
request.headers['Authorization'] = ', '.join(auth_str)
return request

Expand Down Expand Up @@ -685,7 +685,7 @@ def _inject_signature_to_request(self, request, signature):
# Rather than calculating an "Authorization" header, for the query
# param quth, we just append an 'X-Amz-Signature' param to the end
# of the query string.
request.url += '&X-Amz-Signature=%s' % signature
request.url += f'&X-Amz-Signature={signature}'

def _normalize_url_path(self, path):
# For S3, we do not normalize the path.
Expand Down Expand Up @@ -777,7 +777,7 @@ def _inject_signature_to_request(self, request, signature):
# Rather than calculating an "Authorization" header, for the query
# param quth, we just append an 'X-Amz-Signature' param to the end
# of the query string.
request.url += '&X-Amz-Signature=%s' % signature
request.url += f'&X-Amz-Signature={signature}'


class S3SigV4QueryAuth(SigV4QueryAuth):
Expand Down Expand Up @@ -990,15 +990,15 @@ def get_signature(
string_to_sign = self.canonical_string(
method, split, headers, auth_path=auth_path
)
logger.debug('StringToSign:\n%s', string_to_sign)
logger.debug(f'StringToSign:\n{string_to_sign}')
return self.sign_string(string_to_sign)

def add_auth(self, request):
if self.credentials is None:
raise NoCredentialsError
logger.debug("Calculating signature using hmacv1 auth.")
split = urlsplit(request.url)
logger.debug('HTTP request method: %s', request.method)
logger.debug(f'HTTP request method: {request.method}')
signature = self.get_signature(
request.method, split, request.headers, auth_path=request.auth_path
)
Expand Down
4 changes: 2 additions & 2 deletions botocore/awsrequest.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,9 +280,9 @@ def prepare_request_dict(
percent_encode_sequence = botocore.utils.percent_encode_sequence
encoded_query_string = percent_encode_sequence(r['query_string'])
if '?' not in url:
url += '?%s' % encoded_query_string
url += f'?{encoded_query_string}'
else:
url += '&%s' % encoded_query_string
url += f'&{encoded_query_string}'
r['url'] = url
r['context'] = context
if context is None:
Expand Down
27 changes: 10 additions & 17 deletions botocore/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ def _create_client_class(self, service_name, service_model):
bases = [BaseClient]
service_id = service_model.service_id.hyphenize()
self._event_emitter.emit(
'creating-client-class.%s' % service_id,
f'creating-client-class.{service_id}',
class_attributes=class_attributes,
base_classes=bases,
)
Expand All @@ -223,10 +223,10 @@ def _normalize_fips_region(self, region_name, client_config):
else:
client_config = config_use_fips_endpoint
logger.warning(
'transforming region from %s to %s and setting '
f'transforming region from {region_name} to '
f'{normalized_region_name} and setting '
'use_fips_endpoint to true. client should not '
'be configured with a fips psuedo region.'
% (region_name, normalized_region_name)
)
region_name = normalized_region_name
return region_name, client_config
Expand Down Expand Up @@ -289,7 +289,7 @@ def _register_legacy_retries(self, client):
handler = self._retry_handler_factory.create_retry_handler(
retry_config, endpoint_prefix
)
unique_id = 'retry-config-%s' % service_event_name
unique_id = f'retry-config-{service_event_name}'
client.meta.events.register(
f"needs-retry.{service_event_name}", handler, unique_id=unique_id
)
Expand Down Expand Up @@ -573,7 +573,7 @@ def _api_call(self, *args, **kwargs):
method_name=operation_name,
event_emitter=self._event_emitter,
method_description=operation_model.documentation,
example_prefix='response = client.%s' % py_operation_name,
example_prefix=f'response = client.{py_operation_name}',
include_signature=False,
)
_api_call.__doc__ = docstring
Expand Down Expand Up @@ -982,9 +982,7 @@ def _make_api_call(self, operation_name, api_params):

service_id = self._service_model.service_id.hyphenize()
handler, event_response = self.meta.events.emit_until_response(
'before-call.{service_id}.{operation_name}'.format(
service_id=service_id, operation_name=operation_name
),
f'before-call.{service_id}.{operation_name}',
model=operation_model,
params=request_dict,
request_signer=self._request_signer,
Expand All @@ -1003,9 +1001,7 @@ def _make_api_call(self, operation_name, api_params):
)

self.meta.events.emit(
'after-call.{service_id}.{operation_name}'.format(
service_id=service_id, operation_name=operation_name
),
f'after-call.{service_id}.{operation_name}',
http_response=http,
parsed=parsed_response,
model=operation_model,
Expand All @@ -1027,10 +1023,7 @@ def _make_request(self, operation_model, request_dict, request_context):
return self._endpoint.make_request(operation_model, request_dict)
except Exception as e:
self.meta.events.emit(
'after-call-error.{service_id}.{operation_name}'.format(
service_id=self._service_model.service_id.hyphenize(),
operation_name=operation_model.name,
),
f'after-call-error.{self._service_model.service_id.hyphenize()}.{operation_model.name}',
exception=e,
context=request_context,
)
Expand Down Expand Up @@ -1259,13 +1252,13 @@ def get_waiter(self, waiter_name):
"""
config = self._get_waiter_config()
if not config:
raise ValueError("Waiter does not exist: %s" % waiter_name)
raise ValueError(f"Waiter does not exist: {waiter_name}")
model = waiter.WaiterModel(config)
mapping = {}
for name in model.waiter_names:
mapping[xform_name(name)] = name
if waiter_name not in mapping:
raise ValueError("Waiter does not exist: %s" % waiter_name)
raise ValueError(f"Waiter does not exist: {waiter_name}")

return waiter.create_waiter_with_client(
mapping[waiter_name], model, self
Expand Down
15 changes: 5 additions & 10 deletions botocore/configprovider.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"""This module contains the interface for controlling how configuration
is loaded.
"""

import copy
import logging
import os
Expand Down Expand Up @@ -697,7 +698,7 @@ def _convert_type(self, value):
return value

def __repr__(self):
return '[%s]' % ', '.join([str(p) for p in self._providers])
return '[{}]'.format(', '.join([str(p) for p in self._providers]))


class InstanceVarProvider(BaseProvider):
Expand Down Expand Up @@ -728,10 +729,7 @@ def provide(self):
return value

def __repr__(self):
return 'InstanceVarProvider(instance_var={}, session={})'.format(
self._instance_var,
self._session,
)
return f'InstanceVarProvider(instance_var={self._instance_var}, session={self._session})'


class ScopedConfigProvider(BaseProvider):
Expand Down Expand Up @@ -767,10 +765,7 @@ def provide(self):
return scoped_config.get(self._config_var_name)

def __repr__(self):
return 'ScopedConfigProvider(config_var_name={}, session={})'.format(
self._config_var_name,
self._session,
)
return f'ScopedConfigProvider(config_var_name={self._config_var_name}, session={self._session})'


class EnvironmentProvider(BaseProvider):
Expand Down Expand Up @@ -878,7 +873,7 @@ def provide(self):
return self._value

def __repr__(self):
return 'ConstantProvider(value=%s)' % self._value
return f'ConstantProvider(value={self._value})'


class ConfiguredEndpointProvider(BaseProvider):
Expand Down
14 changes: 7 additions & 7 deletions botocore/credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,7 @@ def __init__(
super().__init__(cache, expiry_window_seconds)

def _generate_assume_role_name(self):
self._role_session_name = 'botocore-session-%s' % (int(time.time()))
self._role_session_name = f'botocore-session-{int(time.time())}'
self._assume_kwargs['RoleSessionName'] = self._role_session_name
self._using_default_session_name = True

Expand Down Expand Up @@ -848,7 +848,7 @@ def _assume_role_kwargs(self):
mfa_serial = assume_role_kwargs.get('SerialNumber')

if mfa_serial is not None:
prompt = 'Enter MFA code for %s: ' % mfa_serial
prompt = f'Enter MFA code for {mfa_serial}: '
token_code = self._mfa_prompter(prompt)
assume_role_kwargs['TokenCode'] = token_code

Expand Down Expand Up @@ -1570,8 +1570,8 @@ def _get_role_config(self, profile_name):
if credential_source is not None and source_profile is not None:
raise InvalidConfigError(
error_msg=(
'The profile "%s" contains both source_profile and '
'credential_source.' % profile_name
f'The profile "{profile_name}" contains both '
'source_profile and credential_source.'
)
)
elif credential_source is None and source_profile is None:
Expand Down Expand Up @@ -1720,7 +1720,7 @@ def _resolve_credentials_from_source(
provider=credential_source,
error_msg=(
'No credentials found in credential_source referenced '
'in profile %s' % profile_name
f'in profile {profile_name}'
),
)
return credentials
Expand Down Expand Up @@ -2242,8 +2242,8 @@ def _load_sso_config(self):
missing = ', '.join(missing_config_vars)
raise InvalidConfigError(
error_msg=(
'The profile "%s" is configured to use SSO but is missing '
'required configuration: %s' % (profile_name, missing)
f'The profile "{profile_name}" is configured to use SSO '
f'but is missing required configuration: {missing}'
)
)
return config
Expand Down
Loading

0 comments on commit f7a8f7c

Please sign in to comment.