Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenDILab开源决策智能平台
treevalue
提交
3748f19a
T
treevalue
项目概览
OpenDILab开源决策智能平台
/
treevalue
大约 1 年 前同步成功
通知
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,发现更多精彩内容 >>
You need to sign in or sign up before continuing.
提交
3748f19a
编写于
11月 28, 2022
作者:
HansBug
😆
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
dev(hansbug): put constraint into it
上级
db5c6bc7
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
9 addition
and
3 deletion
+9
-3
treevalue/tree/tree/tree.pxd
treevalue/tree/tree/tree.pxd
+3
-1
treevalue/tree/tree/tree.pyx
treevalue/tree/tree/tree.pyx
+6
-2
未找到文件。
treevalue/tree/tree/tree.pxd
浏览文件 @
3748f19a
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
from
libcpp
cimport
bool
from
libcpp
cimport
bool
from
.constraint
cimport
Constraint
from
..common.delay
cimport
DelayedProxy
from
..common.delay
cimport
DelayedProxy
from
..common.storage
cimport
TreeStorage
from
..common.storage
cimport
TreeStorage
...
@@ -11,6 +12,7 @@ cdef class _CObject:
...
@@ -11,6 +12,7 @@ cdef class _CObject:
cdef
class
TreeValue
:
cdef
class
TreeValue
:
cdef
readonly
TreeStorage
_st
cdef
readonly
TreeStorage
_st
cdef
readonly
Constraint
_constraint
cdef
readonly
type
_type
cdef
readonly
type
_type
cpdef
TreeStorage
_detach
(
self
)
cpdef
TreeStorage
_detach
(
self
)
...
@@ -20,7 +22,7 @@ cdef class TreeValue:
...
@@ -20,7 +22,7 @@ cdef class TreeValue:
cpdef
_getitem_extern
(
self
,
object
key
)
cpdef
_getitem_extern
(
self
,
object
key
)
cpdef
_setitem_extern
(
self
,
object
key
,
object
value
)
cpdef
_setitem_extern
(
self
,
object
key
,
object
value
)
cpdef
_delitem_extern
(
self
,
object
key
)
cpdef
_delitem_extern
(
self
,
object
key
)
cdef
void
_update
(
self
,
object
d
,
dict
kwargs
)
except
*
cdef
void
_update
(
self
,
object
d
,
dict
kwargs
)
except
*
cpdef
public
get
(
self
,
str
key
,
object
default
=
*
)
cpdef
public
get
(
self
,
str
key
,
object
default
=
*
)
cpdef
public
pop
(
self
,
str
key
,
object
default
=
*
)
cpdef
public
pop
(
self
,
str
key
,
object
default
=
*
)
cpdef
public
popitem
(
self
)
cpdef
public
popitem
(
self
)
...
...
treevalue/tree/tree/tree.pyx
浏览文件 @
3748f19a
...
@@ -8,6 +8,7 @@ from operator import itemgetter
...
@@ -8,6 +8,7 @@ from operator import itemgetter
import
cython
import
cython
from
hbutils.design
import
SingletonMark
from
hbutils.design
import
SingletonMark
from
.constraint
cimport
Constraint
,
to_constraint
,
EmptyConstraint
from
..common.delay
cimport
undelay
,
_c_delayed_partial
,
DelayedProxy
from
..common.delay
cimport
undelay
,
_c_delayed_partial
,
DelayedProxy
from
..common.storage
cimport
TreeStorage
,
create_storage
,
_c_undelay_data
from
..common.storage
cimport
TreeStorage
,
create_storage
,
_c_undelay_data
from
...utils
import
format_tree
from
...utils
import
format_tree
...
@@ -56,12 +57,13 @@ cdef class TreeValue:
...
@@ -56,12 +57,13 @@ cdef class TreeValue:
The `TreeValue` class is a light-weight framework just for DIY.
The `TreeValue` class is a light-weight framework just for DIY.
"""
"""
def
__cinit__
(
self
,
object
data
):
def
__cinit__
(
self
,
object
data
,
Constraint
constraint
=
None
):
self
.
_st
=
_DEFAULT_STORAGE
self
.
_st
=
_DEFAULT_STORAGE
self
.
_constraint
=
EmptyConstraint
()
if
constraint
is
None
else
constraint
self
.
_type
=
type
(
self
)
self
.
_type
=
type
(
self
)
@
cython
.
binding
(
True
)
@
cython
.
binding
(
True
)
def
__init__
(
self
,
object
data
):
def
__init__
(
self
,
object
data
,
object
constraint
=
None
):
"""
"""
Constructor of :class:`TreeValue`.
Constructor of :class:`TreeValue`.
...
@@ -100,6 +102,8 @@ cdef class TreeValue:
...
@@ -100,6 +102,8 @@ cdef class TreeValue:
"Unknown initialization type for tree value - {type}."
.
format
(
"Unknown initialization type for tree value - {type}."
.
format
(
type
=
repr
(
type
(
data
).
__name__
)))
type
=
repr
(
type
(
data
).
__name__
)))
self
.
_constraint
=
to_constraint
(
constraint
)
def
__getnewargs_ex__
(
self
):
# for __cinit__, when pickle.loads
def
__getnewargs_ex__
(
self
):
# for __cinit__, when pickle.loads
return
({},),
{}
return
({},),
{}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录