Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
b7ac8a08
提交
b7ac8a08
authored
12月 14, 2022
作者:
Maxim Kochurov
提交者:
Maxim Kochurov
12月 16, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
remove deprecation utility, favor pydeprecate (
https://pypi.org/project/pyDeprecate/
)
上级
225346d7
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
3 行增加
和
43 行删除
+3
-43
environment.yml
environment.yml
+2
-0
utils.py
pytensor/utils.py
+1
-43
没有找到文件。
environment.yml
浏览文件 @
b7ac8a08
...
...
@@ -16,6 +16,7 @@ dependencies:
-
logical-unification
-
miniKanren
-
cons
-
pydeprecate
# Intel BLAS
-
mkl
-
mkl-service
...
...
@@ -49,3 +50,4 @@ dependencies:
# optional
-
sympy
-
cython
pytensor/utils.py
浏览文件 @
b7ac8a08
"""Utility functions that only depend on the standard library."""
import
hashlib
import
inspect
import
logging
import
os
import
struct
import
subprocess
import
sys
import
traceback
import
warnings
from
collections
import
OrderedDict
from
collections.abc
import
Callable
from
functools
import
partial
,
wraps
from
functools
import
partial
from
typing
import
List
,
Set
...
...
@@ -19,7 +16,6 @@ __all__ = [
"get_unbound_function"
,
"maybe_add_to_os_environ_pathlist"
,
"DefaultOrderedDict"
,
"deprecated"
,
"subprocess_Popen"
,
"call_subprocess_Popen"
,
"output_subprocess_Popen"
,
...
...
@@ -140,44 +136,6 @@ def maybe_add_to_os_environ_pathlist(var, newpath):
pass
def
deprecated
(
message
:
str
=
""
):
"""
This is a decorator which can be used to mark functions
as deprecated. It will result in a warning being emitted
when the function is used first time and filter is set for show DeprecationWarning.
Taken from https://stackoverflow.com/a/40899499/4473230
"""
def
decorator_wrapper
(
func
):
@wraps
(
func
)
def
function_wrapper
(
*
args
,
**
kwargs
):
nonlocal
message
current_call_source
=
"|"
.
join
(
traceback
.
format_stack
(
inspect
.
currentframe
())
)
if
current_call_source
not
in
function_wrapper
.
last_call_source
:
if
not
message
:
message
=
f
"Function {func.__name__} is deprecated."
warnings
.
warn
(
message
,
category
=
DeprecationWarning
,
stacklevel
=
2
,
)
function_wrapper
.
last_call_source
.
add
(
current_call_source
)
return
func
(
*
args
,
**
kwargs
)
function_wrapper
.
last_call_source
=
set
()
return
function_wrapper
return
decorator_wrapper
def
subprocess_Popen
(
command
,
**
params
):
"""
Utility function to work around windows behavior that open windows.
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论