change __dict__ to vars function

Back gunicorn/argparse_compat.py gunicorn/six.py files changes

Back run_gunicorn.py file changes
This commit is contained in:
Saeed Gharedaghi 2017-01-09 00:57:45 +03:30 committed by Berker Peksag
parent 3f9eace246
commit ab444eed50
3 changed files with 7 additions and 7 deletions

View File

@ -100,7 +100,7 @@ class Application(BaseApplication):
return cfg return cfg
def get_config_from_module_name(self, module_name): def get_config_from_module_name(self, module_name):
return util.import_module(module_name).__dict__ return vars(util.import_module(module_name))
def load_config_from_module_name_or_filename(self, location): def load_config_from_module_name_or_filename(self, location):
""" """
@ -167,7 +167,7 @@ class Application(BaseApplication):
# Lastly, update the configuration with any command line # Lastly, update the configuration with any command line
# settings. # settings.
for k, v in args.__dict__.items(): for k, v in vars(args).items():
if v is None: if v is None:
continue continue
if k == "args": if k == "args":

View File

@ -387,7 +387,7 @@ def import_app(module):
is_debug = logging.root.level == logging.DEBUG is_debug = logging.root.level == logging.DEBUG
try: try:
app = eval(obj, mod.__dict__) app = eval(obj, vars(mod))
except NameError: except NameError:
if is_debug: if is_debug:
traceback.print_exception(*sys.exc_info()) traceback.print_exception(*sys.exc_info())

View File

@ -38,12 +38,12 @@ try:
except ImportError: except ImportError:
class SimpleNamespace(object): class SimpleNamespace(object):
def __init__(self, **kwargs): def __init__(self, **kwargs):
self.__dict__.update(kwargs) vars(self).update(kwargs)
def __repr__(self): def __repr__(self):
keys = sorted(self.__dict__) keys = sorted(vars(self))
items = ("{}={!r}".format(k, self.__dict__[k]) for k in keys) items = ("{}={!r}".format(k, vars(self)[k]) for k in keys)
return "{}({})".format(type(self).__name__, ", ".join(items)) return "{}({})".format(type(self).__name__, ", ".join(items))
def __eq__(self, other): def __eq__(self, other):
return self.__dict__ == other.__dict__ return vars(self) == vars(other)