Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenDILab开源决策智能平台
treevalue
提交
472c0213
T
treevalue
项目概览
OpenDILab开源决策智能平台
/
treevalue
8 个月 前同步成功
通知
3
Star
213
Fork
3
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
treevalue
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
472c0213
编写于
1月 04, 2022
作者:
HansBug
😆
2
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(hansbug): fix a bug with method_treelize and classmethod_treelize
上级
1fc4b402
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
8 addition
and
4 deletion
+8
-4
treevalue/tree/func/func.py
treevalue/tree/func/func.py
+8
-4
未找到文件。
treevalue/tree/func/func.py
浏览文件 @
472c0213
...
...
@@ -68,7 +68,7 @@ AUTO_DETECT_RETURN_TYPE = SingletonMark("auto_detect_return_type")
def
method_treelize
(
mode
:
str
=
'strict'
,
return_type
:
Optional
[
Type
[
TreeClassType_
]]
=
AUTO_DETECT_RETURN_TYPE
,
inherit
:
bool
=
True
,
missing
:
Union
[
Any
,
Callable
]
=
MISSING_NOT_ALLOW
,
inherit
:
bool
=
True
,
missing
:
Union
[
Any
,
Callable
]
=
MISSING_NOT_ALLOW
,
delayed
:
bool
=
False
,
subside
:
Union
[
Mapping
,
bool
,
None
]
=
None
,
rise
:
Union
[
Mapping
,
bool
,
None
]
=
None
,
self_copy
:
bool
=
False
):
"""
...
...
@@ -87,6 +87,8 @@ def method_treelize(mode: str = 'strict', return_type: Optional[Type[TreeClassTy
- inherit (:obj:`bool`): Allow inheriting in wrapped function, default is `True`.
- missing (:obj:`Union[Any, Callable]`): Missing value or lambda generator of when missing,
\
default is `MISSING_NOT_ALLOW`, which means raise `KeyError` when missing detected.
- delayed (:obj:`bool`): Enable delayed mode or not, the calculation will be delayed when enabled,
\
default is ``False``, which means to all the calculation at once.
- subside (:obj:`Union[Mapping, bool, None]`): Subside enabled to function's arguments or not,
\
and subside configuration, default is `None` which means do not use subside.
\
When subside is `True`, it will use all the default arguments in `subside` function.
...
...
@@ -125,7 +127,7 @@ def method_treelize(mode: str = 'strict', return_type: Optional[Type[TreeClassTy
rise
=
None
def
_decorator
(
method
):
_treelized
=
_c_func_treelize
(
mode
,
_get_self_class
,
inherit
,
missing
,
subside
,
rise
)(
method
)
_treelized
=
_c_func_treelize
(
mode
,
_get_self_class
,
inherit
,
missing
,
delayed
,
subside
,
rise
)(
method
)
@
wraps
(
method
)
def
_new_method
(
self
,
*
args
,
**
kwargs
):
...
...
@@ -142,7 +144,7 @@ def method_treelize(mode: str = 'strict', return_type: Optional[Type[TreeClassTy
def
classmethod_treelize
(
mode
:
str
=
'strict'
,
return_type
:
Optional
[
Type
[
TreeClassType_
]]
=
AUTO_DETECT_RETURN_TYPE
,
inherit
:
bool
=
True
,
missing
:
Union
[
Any
,
Callable
]
=
MISSING_NOT_ALLOW
,
inherit
:
bool
=
True
,
missing
:
Union
[
Any
,
Callable
]
=
MISSING_NOT_ALLOW
,
delayed
:
bool
=
False
,
subside
:
Union
[
Mapping
,
bool
,
None
]
=
None
,
rise
:
Union
[
Mapping
,
bool
,
None
]
=
None
):
"""
Overview:
...
...
@@ -159,6 +161,8 @@ def classmethod_treelize(mode: str = 'strict', return_type: Optional[Type[TreeCl
- inherit (:obj:`bool`): Allow inheriting in wrapped function, default is `True`.
- missing (:obj:`Union[Any, Callable]`): Missing value or lambda generator of when missing,
\
default is `MISSING_NOT_ALLOW`, which means raise `KeyError` when missing detected.
- delayed (:obj:`bool`): Enable delayed mode or not, the calculation will be delayed when enabled,
\
default is ``False``, which means to all the calculation at once.
- subside (:obj:`Union[Mapping, bool, None]`): Subside enabled to function's arguments or not,
\
and subside configuration, default is `None` which means do not use subside.
\
When subside is `True`, it will use all the default arguments in `subside` function.
...
...
@@ -190,4 +194,4 @@ def classmethod_treelize(mode: str = 'strict', return_type: Optional[Type[TreeCl
def
_get_cls_class
(
cls
):
return
return_type
return
func_treelize
(
mode
,
_get_cls_class
,
inherit
,
missing
,
subside
,
rise
)
return
func_treelize
(
mode
,
_get_cls_class
,
inherit
,
missing
,
delayed
,
subside
,
rise
)
OpenDILab开源决策智能平台
@m0_55289267
mentioned in commit
d00644e3
·
1月 05, 2022
mentioned in commit
d00644e3
mentioned in commit d00644e3499cb0330a51283026aa80665062f022
开关提交列表
HansBug
😆
@HansBug
mentioned in commit
70e3487c
·
1月 05, 2022
mentioned in commit
70e3487c
mentioned in commit 70e3487c1980880dc332fd5068bfb6fd8e722bc3
开关提交列表
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录