Skip to content

Commit

Permalink
regenerate petstore
Browse files Browse the repository at this point in the history
  • Loading branch information
ruslanlazin committed Jan 28, 2019
1 parent d94139a commit f9b6755
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,16 @@ def __init__(cls, name, bases, dct):
def __call__(cls):
if cls._default is None:
cls._default = type.__call__(cls)
return copy.copy(cls._default)
return cls._two_level_copy(cls._default)

def set_default(cls, default):
cls._default = copy.copy(default)
cls._default = cls._two_level_copy(default)

def _two_level_copy(cls, obj):
newone = copy.copy(obj)
for key in obj.__dict__.keys():
newone.__dict__[key] = copy.copy(obj.__dict__[key])
return newone


class Configuration(six.with_metaclass(TypeWithDefault, object)):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,16 @@ def __init__(cls, name, bases, dct):
def __call__(cls):
if cls._default is None:
cls._default = type.__call__(cls)
return copy.copy(cls._default)
return cls._two_level_copy(cls._default)

def set_default(cls, default):
cls._default = copy.copy(default)
cls._default = cls._two_level_copy(default)

def _two_level_copy(cls, obj):
newone = copy.copy(obj)
for key in obj.__dict__.keys():
newone.__dict__[key] = copy.copy(obj.__dict__[key])
return newone


class Configuration(six.with_metaclass(TypeWithDefault, object)):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,16 @@ def __init__(cls, name, bases, dct):
def __call__(cls):
if cls._default is None:
cls._default = type.__call__(cls)
return copy.copy(cls._default)
return cls._two_level_copy(cls._default)

def set_default(cls, default):
cls._default = copy.copy(default)
cls._default = cls._two_level_copy(default)

def _two_level_copy(cls, obj):
newone = copy.copy(obj)
for key in obj.__dict__.keys():
newone.__dict__[key] = copy.copy(obj.__dict__[key])
return newone


class Configuration(six.with_metaclass(TypeWithDefault, object)):
Expand Down
10 changes: 8 additions & 2 deletions samples/client/petstore/python/petstore_api/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,16 @@ def __init__(cls, name, bases, dct):
def __call__(cls):
if cls._default is None:
cls._default = type.__call__(cls)
return copy.copy(cls._default)
return cls._two_level_copy(cls._default)

def set_default(cls, default):
cls._default = copy.copy(default)
cls._default = cls._two_level_copy(default)

def _two_level_copy(cls, obj):
newone = copy.copy(obj)
for key in obj.__dict__.keys():
newone.__dict__[key] = copy.copy(obj.__dict__[key])
return newone


class Configuration(six.with_metaclass(TypeWithDefault, object)):
Expand Down

0 comments on commit f9b6755

Please sign in to comment.