mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
Remove fallback for types.SimpleNamespace (#2049)
This commit is contained in:
parent
a13a2096ed
commit
c435341e66
@ -48,18 +48,3 @@ def requires_mac_ver(*min_version):
|
|||||||
wrapper.min_version = min_version
|
wrapper.min_version = min_version
|
||||||
return wrapper
|
return wrapper
|
||||||
return decorator
|
return decorator
|
||||||
|
|
||||||
try:
|
|
||||||
from types import SimpleNamespace # pylint: disable=unused-import
|
|
||||||
except ImportError:
|
|
||||||
class SimpleNamespace(object):
|
|
||||||
def __init__(self, **kwargs):
|
|
||||||
vars(self).update(kwargs)
|
|
||||||
|
|
||||||
def __repr__(self):
|
|
||||||
keys = sorted(vars(self))
|
|
||||||
items = ("{}={!r}".format(k, vars(self)[k]) for k in keys)
|
|
||||||
return "{}({})".format(type(self).__name__, ", ".join(items))
|
|
||||||
|
|
||||||
def __eq__(self, other):
|
|
||||||
return vars(self) == vars(other)
|
|
||||||
|
|||||||
@ -1,10 +1,9 @@
|
|||||||
import datetime
|
import datetime
|
||||||
|
from types import SimpleNamespace
|
||||||
|
|
||||||
from gunicorn.config import Config
|
from gunicorn.config import Config
|
||||||
from gunicorn.glogging import Logger
|
from gunicorn.glogging import Logger
|
||||||
|
|
||||||
from support import SimpleNamespace
|
|
||||||
|
|
||||||
|
|
||||||
def test_atoms_defaults():
|
def test_atoms_defaults():
|
||||||
response = SimpleNamespace(
|
response = SimpleNamespace(
|
||||||
|
|||||||
@ -5,10 +5,10 @@ import shutil
|
|||||||
import socket
|
import socket
|
||||||
import tempfile
|
import tempfile
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
|
from types import SimpleNamespace
|
||||||
|
|
||||||
from gunicorn.config import Config
|
from gunicorn.config import Config
|
||||||
from gunicorn.instrument.statsd import Statsd
|
from gunicorn.instrument.statsd import Statsd
|
||||||
from support import SimpleNamespace
|
|
||||||
|
|
||||||
|
|
||||||
class StatsdTestException(Exception):
|
class StatsdTestException(Exception):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user