瀏覽代碼

fix: define `__slots__` to avoid `__dict__` creation

version-14
Sagar Vora 3 年之前
父節點
當前提交
d2dfc8c335
共有 1 個檔案被更改,包括 4 行新增5 行删除
  1. +4
    -5
      frappe/__init__.py

+ 4
- 5
frappe/__init__.py 查看文件

@@ -55,20 +55,19 @@ controllers = {}
class _dict(dict):
"""dict like object that exposes keys as attributes"""

__slots__ = ()
__getattr__ = dict.get
__setattr__ = dict.__setitem__
__delattr__ = dict.__delitem__
__setstate__ = dict.update

def __getstate__(self):
return self

def __setstate__(self, d):
self.update(d)

def update(self, d):
def update(self, *args, **kwargs):
"""update and return self -- the missing dict feature in python"""

super().update(d)
super().update(*args, **kwargs)
return self

def copy(self):


Loading…
取消
儲存