| OLD | NEW |
| 1 # Copyright (c) 2011 Mitch Garnaat http://garnaat.org/ | 1 # Copyright (c) 2011 Mitch Garnaat http://garnaat.org/ |
| 2 # Copyright (c) 2011 Amazon.com, Inc. or its affiliates. All Rights Reserved | 2 # Copyright (c) 2011 Amazon.com, Inc. or its affiliates. All Rights Reserved |
| 3 # | 3 # |
| 4 # Permission is hereby granted, free of charge, to any person obtaining a | 4 # Permission is hereby granted, free of charge, to any person obtaining a |
| 5 # copy of this software and associated documentation files (the | 5 # copy of this software and associated documentation files (the |
| 6 # "Software"), to deal in the Software without restriction, including | 6 # "Software"), to deal in the Software without restriction, including |
| 7 # without limitation the rights to use, copy, modify, merge, publish, dis- | 7 # without limitation the rights to use, copy, modify, merge, publish, dis- |
| 8 # tribute, sublicense, and/or sell copies of the Software, and to permit | 8 # tribute, sublicense, and/or sell copies of the Software, and to permit |
| 9 # persons to whom the Software is furnished to do so, subject to the fol- | 9 # persons to whom the Software is furnished to do so, subject to the fol- |
| 10 # lowing conditions: | 10 # lowing conditions: |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 if response is not self._response: | 138 if response is not self._response: |
| 139 continue | 139 continue |
| 140 break | 140 break |
| 141 | 141 |
| 142 | 142 |
| 143 class Layer2(object): | 143 class Layer2(object): |
| 144 | 144 |
| 145 def __init__(self, aws_access_key_id=None, aws_secret_access_key=None, | 145 def __init__(self, aws_access_key_id=None, aws_secret_access_key=None, |
| 146 is_secure=True, port=None, proxy=None, proxy_port=None, | 146 is_secure=True, port=None, proxy=None, proxy_port=None, |
| 147 debug=0, security_token=None, region=None, | 147 debug=0, security_token=None, region=None, |
| 148 validate_certs=True, dynamizer=LossyFloatDynamizer): | 148 validate_certs=True, dynamizer=LossyFloatDynamizer, |
| 149 profile_name=None): |
| 149 self.layer1 = Layer1(aws_access_key_id, aws_secret_access_key, | 150 self.layer1 = Layer1(aws_access_key_id, aws_secret_access_key, |
| 150 is_secure, port, proxy, proxy_port, | 151 is_secure, port, proxy, proxy_port, |
| 151 debug, security_token, region, | 152 debug, security_token, region, |
| 152 validate_certs=validate_certs) | 153 validate_certs=validate_certs, |
| 154 profile_name=profile_name) |
| 153 self.dynamizer = dynamizer() | 155 self.dynamizer = dynamizer() |
| 154 | 156 |
| 155 def use_decimals(self): | 157 def use_decimals(self): |
| 156 """ | 158 """ |
| 157 Use the ``decimal.Decimal`` type for encoding/decoding numeric types. | 159 Use the ``decimal.Decimal`` type for encoding/decoding numeric types. |
| 158 | 160 |
| 159 By default, ints/floats are used to represent numeric types | 161 By default, ints/floats are used to represent numeric types |
| 160 ('N', 'NS') received from DynamoDB. Using the ``Decimal`` | 162 ('N', 'NS') received from DynamoDB. Using the ``Decimal`` |
| 161 type is recommended to prevent loss of precision. | 163 type is recommended to prevent loss of precision. |
| 162 | 164 |
| (...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 795 esk = None | 797 esk = None |
| 796 kwargs = {'table_name': table.name, | 798 kwargs = {'table_name': table.name, |
| 797 'scan_filter': self.dynamize_scan_filter(scan_filter), | 799 'scan_filter': self.dynamize_scan_filter(scan_filter), |
| 798 'attributes_to_get': attributes_to_get, | 800 'attributes_to_get': attributes_to_get, |
| 799 'limit': request_limit, | 801 'limit': request_limit, |
| 800 'count': count, | 802 'count': count, |
| 801 'exclusive_start_key': esk, | 803 'exclusive_start_key': esk, |
| 802 'object_hook': self.dynamizer.decode} | 804 'object_hook': self.dynamizer.decode} |
| 803 return TableGenerator(table, self.layer1.scan, | 805 return TableGenerator(table, self.layer1.scan, |
| 804 max_results, item_class, kwargs) | 806 max_results, item_class, kwargs) |
| OLD | NEW |