浏览代码

Fix _has_[gs]etter in Auto KWArgs

Need to check if f[gs]et is not None.
master
Nate Bohman 4 年前
父节点
当前提交
e99f6053a1
签署人:: Nate Bohman <natrinicle@gmail.com> GPG 密钥 ID: C10546A54ABA1CE5
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. +2
    -2
      python_utils/kwargs_init.py

+ 2
- 2
python_utils/kwargs_init.py 查看文件

@@ -18,14 +18,14 @@ class AutoKWArgs(object):
"""Check if property has getter."""
class_attribute = getattr(type(self), property_key, None)
if isinstance(class_attribute, property):
return class_attribute.fget is None
return class_attribute.fget is not None
return False

def _has_setter(self, property_key):
"""Check if property has setter."""
class_attribute = getattr(type(self), property_key, None)
if isinstance(class_attribute, property):
return class_attribute.fset is None
return class_attribute.fset is not None
return False

@property

正在加载...
取消
保存