Fix ECR models for Python 3.8

Before this fix, using moto.ecr with Python 3.8 results in the
following error:

RuntimeError: dictionary keys changed during iteration
This commit is contained in:
Chih-Hsuan Yen 2019-10-27 16:58:03 +08:00
parent 6b67002a42
commit 77bc97c8da
No known key found for this signature in database
GPG Key ID: 0453A6CA23C56315

View File

@ -2,7 +2,6 @@ from __future__ import unicode_literals
import hashlib
import re
from copy import copy
from datetime import datetime
from random import random
@ -27,11 +26,12 @@ class BaseObject(BaseModel):
return ''.join(words)
def gen_response_object(self):
response_object = copy(self.__dict__)
for key, value in response_object.items():
response_object = dict()
for key, value in self.__dict__.items():
if '_' in key:
response_object[self.camelCase(key)] = value
del response_object[key]
else:
response_object[key] = value
return response_object
@property