/
opt
/
imh-python
/
lib
/
python3.9
/
site-packages
/
botocore
/
/opt/imh-python/lib/python3.9/site-packages/botocore
mkdir
upload
Name
Size
Mode
Actions
data/
-
0755
rm
docs/
-
0755
rm
retries/
-
0755
rm
vendored/
-
0755
rm
__pycache__/
-
0755
rm
args.py
16199
0644
edit
dl
rm
auth.py
34966
0644
edit
dl
rm
awsrequest.py
23247
0644
edit
dl
rm
cacert.pem
271088
0644
edit
dl
rm
client.py
41514
0644
edit
dl
rm
compat.py
11715
0644
edit
dl
rm
config.py
12721
0644
edit
dl
rm
configloader.py
9580
0644
edit
dl
rm
configprovider.py
22235
0644
edit
dl
rm
credentials.py
81582
0644
edit
dl
rm
discovery.py
11031
0644
edit
dl
rm
endpoint.py
13811
0644
edit
dl
rm
errorfactory.py
3727
0644
edit
dl
rm
eventstream.py
20517
0644
edit
dl
rm
exceptions.py
19927
0644
edit
dl
rm
handlers.py
45142
0644
edit
dl
rm
history.py
1748
0644
edit
dl
rm
hooks.py
24573
0644
edit
dl
rm
httpsession.py
13547
0644
edit
dl
rm
loaders.py
17355
0644
edit
dl
rm
model.py
28352
0644
edit
dl
rm
monitoring.py
20586
0644
edit
dl
rm
paginate.py
27128
0644
edit
dl
rm
parsers.py
42301
0644
edit
dl
rm
regions.py
8975
0644
edit
dl
rm
response.py
6434
0644
edit
dl
rm
retryhandler.py
13781
0644
edit
dl
rm
serialize.py
30430
0644
edit
dl
rm
session.py
43433
0644
edit
dl
rm
signers.py
28234
0644
edit
dl
rm
stub.py
14361
0644
edit
dl
rm
translate.py
3412
0644
edit
dl
rm
utils.py
86492
0644
edit
dl
rm
validate.py
11323
0644
edit
dl
rm
waiter.py
13860
0644
edit
dl
rm
__init__.py
3881
0644
edit
dl
rm
Edit:
/opt/imh-python/lib/python3.9/site-packages/botocore/errorfactory.py
(3727B)
# Copyright 2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). You # may not use this file except in compliance with the License. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" file accompanying this file. This file is # distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF # ANY KIND, either express or implied. See the License for the specific # language governing permissions and limitations under the License. from botocore.exceptions import ClientError from botocore.utils import get_service_module_name class BaseClientExceptions(object): ClientError = ClientError def __init__(self, code_to_exception): """Base class for exceptions object on a client :type code_to_exception: dict :param code_to_exception: Mapping of error codes (strings) to exception class that should be raised when encountering a particular error code. """ self._code_to_exception = code_to_exception def from_code(self, error_code): """Retrieves the error class based on the error code This is helpful for identifying the exception class needing to be caught based on the ClientError.parsed_reponse['Error']['Code'] value :type error_code: string :param error_code: The error code associated to a ClientError exception :rtype: ClientError or a subclass of ClientError :returns: The appropriate modeled exception class for that error code. If the error code does not match any of the known modeled exceptions then return a generic ClientError. """ return self._code_to_exception.get(error_code, self.ClientError) def __getattr__(self, name): exception_cls_names = [ exception_cls.__name__ for exception_cls in self._code_to_exception.values() ] raise AttributeError( '%r object has no attribute %r. Valid exceptions are: %s' % ( self, name, ', '.join(exception_cls_names))) class ClientExceptionsFactory(object): def __init__(self): self._client_exceptions_cache = {} def create_client_exceptions(self, service_model): """Creates a ClientExceptions object for the particular service client :type service_model: botocore.model.ServiceModel :param service_model: The service model for the client :rtype: object that subclasses from BaseClientExceptions :returns: The exceptions object of a client that can be used to grab the various different modeled exceptions. """ service_name = service_model.service_name if service_name not in self._client_exceptions_cache: client_exceptions = self._create_client_exceptions(service_model) self._client_exceptions_cache[service_name] = client_exceptions return self._client_exceptions_cache[service_name] def _create_client_exceptions(self, service_model): cls_props = {} code_to_exception = {} for error_shape in service_model.error_shapes: exception_name = str(error_shape.name) exception_cls = type(exception_name, (ClientError,), {}) cls_props[exception_name] = exception_cls code = str(error_shape.error_code) code_to_exception[code] = exception_cls cls_name = str(get_service_module_name(service_model) + 'Exceptions') client_exceptions_cls = type( cls_name, (BaseClientExceptions,), cls_props) return client_exceptions_cls(code_to_exception)
Save
cmd:
run