Skip to content

Commit

Permalink
refactor configuration.py
Browse files Browse the repository at this point in the history
  • Loading branch information
ruslanlazin committed Feb 5, 2019
1 parent f9b6755 commit 0988b1e
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 105 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,35 +14,22 @@ import six
from six.moves import http_client as httplib


class TypeWithDefault(type):
def __init__(cls, name, bases, dct):
super(TypeWithDefault, cls).__init__(name, bases, dct)
cls._default = None

def __call__(cls):
if cls._default is None:
cls._default = type.__call__(cls)
return cls._two_level_copy(cls._default)

def set_default(cls, 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)):
class Configuration(object):
"""NOTE: This class is auto generated by the swagger code generator program.

Ref: https://github.com/swagger-api/swagger-codegen
Do not edit the class manually.
"""

_default = None

def __init__(self):
"""Constructor"""
if self._default:
for key in self._default.__dict__.keys():
self.__dict__[key] = copy.copy(self._default.__dict__[key])
return

# Default Base url
self.host = "{{{basePath}}}"
# Temp file folder for downloading files
Expand Down Expand Up @@ -101,6 +88,10 @@ class Configuration(six.with_metaclass(TypeWithDefault, object)):
# Safe chars for path_param
self.safe_chars_for_path_param = ''

@classmethod
def set_default(cls, default):
cls._default = default

@property
def logger_file(self):
"""The logger file.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,35 +23,22 @@
from six.moves import http_client as httplib


class TypeWithDefault(type):
def __init__(cls, name, bases, dct):
super(TypeWithDefault, cls).__init__(name, bases, dct)
cls._default = None

def __call__(cls):
if cls._default is None:
cls._default = type.__call__(cls)
return cls._two_level_copy(cls._default)

def set_default(cls, 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)):
class Configuration(object):
"""NOTE: This class is auto generated by the swagger code generator program.
Ref: https://github.com/swagger-api/swagger-codegen
Do not edit the class manually.
"""

_default = None

def __init__(self):
"""Constructor"""
if self._default:
for key in self._default.__dict__.keys():
self.__dict__[key] = copy.copy(self._default.__dict__[key])
return

# Default Base url
self.host = "https://petstore.swagger.io */ ' \" =end -- \\r\\n \\n \\r/v2 */ ' \" =end -- \\r\\n \\n \\r"
# Temp file folder for downloading files
Expand Down Expand Up @@ -110,6 +97,10 @@ def __init__(self):
# Safe chars for path_param
self.safe_chars_for_path_param = ''

@classmethod
def set_default(cls, default):
cls._default = default

@property
def logger_file(self):
"""The logger file.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,35 +23,22 @@
from six.moves import http_client as httplib


class TypeWithDefault(type):
def __init__(cls, name, bases, dct):
super(TypeWithDefault, cls).__init__(name, bases, dct)
cls._default = None

def __call__(cls):
if cls._default is None:
cls._default = type.__call__(cls)
return cls._two_level_copy(cls._default)

def set_default(cls, 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)):
class Configuration(object):
"""NOTE: This class is auto generated by the swagger code generator program.
Ref: https://github.com/swagger-api/swagger-codegen
Do not edit the class manually.
"""

_default = None

def __init__(self):
"""Constructor"""
if self._default:
for key in self._default.__dict__.keys():
self.__dict__[key] = copy.copy(self._default.__dict__[key])
return

# Default Base url
self.host = "https://petstore.swagger.io:80/v2"
# Temp file folder for downloading files
Expand Down Expand Up @@ -110,6 +97,10 @@ def __init__(self):
# Safe chars for path_param
self.safe_chars_for_path_param = ''

@classmethod
def set_default(cls, default):
cls._default = default

@property
def logger_file(self):
"""The logger file.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,35 +23,22 @@
from six.moves import http_client as httplib


class TypeWithDefault(type):
def __init__(cls, name, bases, dct):
super(TypeWithDefault, cls).__init__(name, bases, dct)
cls._default = None

def __call__(cls):
if cls._default is None:
cls._default = type.__call__(cls)
return cls._two_level_copy(cls._default)

def set_default(cls, 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)):
class Configuration(object):
"""NOTE: This class is auto generated by the swagger code generator program.
Ref: https://github.com/swagger-api/swagger-codegen
Do not edit the class manually.
"""

_default = None

def __init__(self):
"""Constructor"""
if self._default:
for key in self._default.__dict__.keys():
self.__dict__[key] = copy.copy(self._default.__dict__[key])
return

# Default Base url
self.host = "https://petstore.swagger.io:80/v2"
# Temp file folder for downloading files
Expand Down Expand Up @@ -110,6 +97,10 @@ def __init__(self):
# Safe chars for path_param
self.safe_chars_for_path_param = ''

@classmethod
def set_default(cls, default):
cls._default = default

@property
def logger_file(self):
"""The logger file.
Expand Down
33 changes: 12 additions & 21 deletions samples/client/petstore/python/petstore_api/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,35 +23,22 @@
from six.moves import http_client as httplib


class TypeWithDefault(type):
def __init__(cls, name, bases, dct):
super(TypeWithDefault, cls).__init__(name, bases, dct)
cls._default = None

def __call__(cls):
if cls._default is None:
cls._default = type.__call__(cls)
return cls._two_level_copy(cls._default)

def set_default(cls, 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)):
class Configuration(object):
"""NOTE: This class is auto generated by the swagger code generator program.
Ref: https://github.com/swagger-api/swagger-codegen
Do not edit the class manually.
"""

_default = None

def __init__(self):
"""Constructor"""
if self._default:
for key in self._default.__dict__.keys():
self.__dict__[key] = copy.copy(self._default.__dict__[key])
return

# Default Base url
self.host = "https://petstore.swagger.io:80/v2"
# Temp file folder for downloading files
Expand Down Expand Up @@ -110,6 +97,10 @@ def __init__(self):
# Safe chars for path_param
self.safe_chars_for_path_param = ''

@classmethod
def set_default(cls, default):
cls._default = default

@property
def logger_file(self):
"""The logger file.
Expand Down

0 comments on commit 0988b1e

Please sign in to comment.