@@ -244,7 +244,7 @@ def __init__(self, hash_key=None, range_key=None, **attributes):
244
244
245
245
@classmethod
246
246
def has_map_or_list_attributes (cls ):
247
- for attr_value in cls ._get_attributes ().values ():
247
+ for attr_value in cls .get_attributes ().values ():
248
248
if isinstance (attr_value , MapAttribute ) or isinstance (attr_value , ListAttribute ):
249
249
return True
250
250
return False
@@ -356,7 +356,7 @@ def update_item(self, attribute, value=None, action=None, condition=None, condit
356
356
self ._conditional_operator_check (conditional_operator )
357
357
args , save_kwargs = self ._get_save_args (null_check = False )
358
358
attribute_cls = None
359
- for attr_name , attr_cls in self ._get_attributes ().items ():
359
+ for attr_name , attr_cls in self .get_attributes ().items ():
360
360
if attr_name == attribute :
361
361
attribute_cls = attr_cls
362
362
break
@@ -387,7 +387,7 @@ def update_item(self, attribute, value=None, action=None, condition=None, condit
387
387
388
388
for name , value in data .get (ATTRIBUTES ).items ():
389
389
attr_name = self ._dynamo_to_python_attr (name )
390
- attr = self ._get_attributes ().get (attr_name )
390
+ attr = self .get_attributes ().get (attr_name )
391
391
if attr :
392
392
setattr (self , attr_name , attr .deserialize (attr .get_value (value )))
393
393
return data
@@ -423,7 +423,7 @@ def update(self, attributes=None, actions=None, condition=None, conditional_oper
423
423
if expected_values :
424
424
kwargs ['expected' ] = self ._build_expected_values (expected_values , UPDATE_FILTER_OPERATOR_MAP )
425
425
426
- attrs = self ._get_attributes ()
426
+ attrs = self .get_attributes ()
427
427
attributes = attributes or {}
428
428
for attr , params in attributes .items ():
429
429
attribute_cls = attrs [attr ]
@@ -439,7 +439,7 @@ def update(self, attributes=None, actions=None, condition=None, conditional_oper
439
439
data = self ._get_connection ().update_item (* args , ** kwargs )
440
440
for name , value in data [ATTRIBUTES ].items ():
441
441
attr_name = self ._dynamo_to_python_attr (name )
442
- attr = self ._get_attributes ().get (attr_name )
442
+ attr = self .get_attributes ().get (attr_name )
443
443
if attr :
444
444
setattr (self , attr_name , attr .deserialize (attr .get_value (value )))
445
445
return data
@@ -511,19 +511,19 @@ def from_raw_data(cls, data):
511
511
hash_key_type = cls ._get_meta_data ().get_attribute_type (hash_keyname )
512
512
hash_key = mutable_data .pop (hash_keyname ).get (hash_key_type )
513
513
514
- hash_key_attr = cls ._get_attributes ().get (cls ._dynamo_to_python_attr (hash_keyname ))
514
+ hash_key_attr = cls .get_attributes ().get (cls ._dynamo_to_python_attr (hash_keyname ))
515
515
516
516
hash_key = hash_key_attr .deserialize (hash_key )
517
517
args = (hash_key ,)
518
518
kwargs = {}
519
519
if range_keyname :
520
- range_key_attr = cls ._get_attributes ().get (cls ._dynamo_to_python_attr (range_keyname ))
520
+ range_key_attr = cls .get_attributes ().get (cls ._dynamo_to_python_attr (range_keyname ))
521
521
range_key_type = cls ._get_meta_data ().get_attribute_type (range_keyname )
522
522
range_key = mutable_data .pop (range_keyname ).get (range_key_type )
523
523
kwargs ['range_key' ] = range_key_attr .deserialize (range_key )
524
524
for name , value in mutable_data .items ():
525
525
attr_name = cls ._dynamo_to_python_attr (name )
526
- attr = cls ._get_attributes ().get (attr_name , None )
526
+ attr = cls .get_attributes ().get (attr_name , None )
527
527
if attr :
528
528
kwargs [attr_name ] = attr .deserialize (attr .get_value (value ))
529
529
return cls (* args , ** kwargs )
@@ -557,12 +557,12 @@ def count(cls,
557
557
if index_name :
558
558
hash_key = cls ._index_classes [index_name ]._hash_key_attribute ().serialize (hash_key )
559
559
key_attribute_classes = cls ._index_classes [index_name ]._get_attributes ()
560
- non_key_attribute_classes = cls ._get_attributes ()
560
+ non_key_attribute_classes = cls .get_attributes ()
561
561
else :
562
562
hash_key = cls ._serialize_keys (hash_key )[0 ]
563
- non_key_attribute_classes = dict (cls ._get_attributes ())
564
- key_attribute_classes = dict (cls ._get_attributes ())
565
- for name , attr in cls ._get_attributes ().items ():
563
+ non_key_attribute_classes = dict (cls .get_attributes ())
564
+ key_attribute_classes = dict (cls .get_attributes ())
565
+ for name , attr in cls .get_attributes ().items ():
566
566
if attr .is_range_key or attr .is_hash_key :
567
567
key_attribute_classes [name ] = attr
568
568
else :
@@ -636,12 +636,12 @@ def query(cls,
636
636
if index_name :
637
637
hash_key = cls ._index_classes [index_name ]._hash_key_attribute ().serialize (hash_key )
638
638
key_attribute_classes = cls ._index_classes [index_name ]._get_attributes ()
639
- non_key_attribute_classes = cls ._get_attributes ()
639
+ non_key_attribute_classes = cls .get_attributes ()
640
640
else :
641
641
hash_key = cls ._serialize_keys (hash_key )[0 ]
642
642
non_key_attribute_classes = {}
643
643
key_attribute_classes = {}
644
- for name , attr in cls ._get_attributes ().items ():
644
+ for name , attr in cls .get_attributes ().items ():
645
645
if attr .is_range_key or attr .is_hash_key :
646
646
key_attribute_classes [name ] = attr
647
647
else :
@@ -729,7 +729,7 @@ def rate_limited_scan(cls,
729
729
key_filter , scan_filter = cls ._build_filters (
730
730
SCAN_OPERATOR_MAP ,
731
731
non_key_operator_map = SCAN_OPERATOR_MAP ,
732
- key_attribute_classes = cls ._get_attributes (),
732
+ key_attribute_classes = cls .get_attributes (),
733
733
filters = filters
734
734
)
735
735
key_filter .update (scan_filter )
@@ -786,7 +786,7 @@ def scan(cls,
786
786
key_filter , scan_filter = cls ._build_filters (
787
787
SCAN_OPERATOR_MAP ,
788
788
non_key_operator_map = SCAN_OPERATOR_MAP ,
789
- key_attribute_classes = cls ._get_attributes (),
789
+ key_attribute_classes = cls .get_attributes (),
790
790
filters = filters
791
791
)
792
792
key_filter .update (scan_filter )
@@ -950,7 +950,7 @@ def _build_expected_values(cls, expected_values, operator_map=None):
950
950
:param expected_values: A list of expected values
951
951
"""
952
952
expected_values_result = {}
953
- attributes = cls ._get_attributes ()
953
+ attributes = cls .get_attributes ()
954
954
filters = {}
955
955
for attr_name , attr_value in expected_values .items ():
956
956
attr_cond = VALUE
@@ -1109,7 +1109,7 @@ def _get_schema(cls):
1109
1109
pythonic (ATTR_DEFINITIONS ): [],
1110
1110
pythonic (KEY_SCHEMA ): []
1111
1111
}
1112
- for attr_name , attr_cls in cls ._get_attributes ().items ():
1112
+ for attr_name , attr_cls in cls .get_attributes ().items ():
1113
1113
if attr_cls .is_hash_key or attr_cls .is_range_key :
1114
1114
schema [pythonic (ATTR_DEFINITIONS )].append ({
1115
1115
pythonic (ATTR_NAME ): attr_cls .attr_name ,
@@ -1202,7 +1202,7 @@ def _range_key_attribute(cls):
1202
1202
"""
1203
1203
Returns the attribute class for the hash key
1204
1204
"""
1205
- attributes = cls ._get_attributes ()
1205
+ attributes = cls .get_attributes ()
1206
1206
range_keyname = cls ._get_meta_data ().range_keyname
1207
1207
if range_keyname :
1208
1208
attr = attributes [cls ._dynamo_to_python_attr (range_keyname )]
@@ -1215,7 +1215,7 @@ def _hash_key_attribute(cls):
1215
1215
"""
1216
1216
Returns the attribute class for the hash key
1217
1217
"""
1218
- attributes = cls ._get_attributes ()
1218
+ attributes = cls .get_attributes ()
1219
1219
hash_keyname = cls ._get_meta_data ().hash_keyname
1220
1220
return attributes [cls ._dynamo_to_python_attr (hash_keyname )]
1221
1221
@@ -1301,7 +1301,7 @@ def _deserialize(self, attrs):
1301
1301
1302
1302
:param attrs: A dictionary of attributes to update this item with.
1303
1303
"""
1304
- for name , attr in self ._get_attributes ().items ():
1304
+ for name , attr in self .get_attributes ().items ():
1305
1305
value = attrs .get (attr .attr_name , None )
1306
1306
if value is not None :
1307
1307
value = value .get (ATTR_TYPE_MAP [attr .attr_type ], None )
@@ -1318,7 +1318,7 @@ def _serialize(self, attr_map=False, null_check=True):
1318
1318
"""
1319
1319
attributes = pythonic (ATTRIBUTES )
1320
1320
attrs = {attributes : {}}
1321
- for name , attr in self ._get_attributes ().items ():
1321
+ for name , attr in self .get_attributes ().items ():
1322
1322
value = getattr (self , name )
1323
1323
if isinstance (value , MapAttribute ):
1324
1324
if not value .validate ():
0 commit comments