Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
c7c33fbc
提交
c7c33fbc
authored
4月 22, 2025
作者:
Ben Mares
提交者:
Michael Osthege
4月 25, 2025
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Tighten type annotations to remove str-based commands
上级
080214a3
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
9 行增加
和
5 行删除
+9
-5
cmodule.py
pytensor/link/c/cmodule.py
+1
-1
utils.py
pytensor/utils.py
+8
-4
没有找到文件。
pytensor/link/c/cmodule.py
浏览文件 @
c7c33fbc
...
@@ -2105,7 +2105,7 @@ class GCC_compiler(Compiler):
...
@@ -2105,7 +2105,7 @@ class GCC_compiler(Compiler):
)
)
detect_march
=
False
detect_march
=
False
def
get_lines
(
cmd
:
list
[
str
]
|
str
,
parse
:
bool
=
True
)
->
list
[
str
]
|
None
:
def
get_lines
(
cmd
:
list
[
str
],
parse
:
bool
=
True
)
->
list
[
str
]
|
None
:
p
=
subprocess_Popen
(
p
=
subprocess_Popen
(
cmd
,
cmd
,
stdout
=
subprocess
.
PIPE
,
stdout
=
subprocess
.
PIPE
,
...
...
pytensor/utils.py
浏览文件 @
c7c33fbc
...
@@ -123,7 +123,7 @@ def maybe_add_to_os_environ_pathlist(var: str, newpath: Path | str) -> None:
...
@@ -123,7 +123,7 @@ def maybe_add_to_os_environ_pathlist(var: str, newpath: Path | str) -> None:
pass
pass
def
subprocess_Popen
(
command
:
str
|
list
[
str
],
**
params
)
:
def
subprocess_Popen
(
command
:
list
[
str
],
**
params
)
->
subprocess
.
Popen
:
"""
"""
Utility function to work around windows behavior that open windows.
Utility function to work around windows behavior that open windows.
...
@@ -142,12 +142,12 @@ def subprocess_Popen(command: str | list[str], **params):
...
@@ -142,12 +142,12 @@ def subprocess_Popen(command: str | list[str], **params):
# in "The filename, directory name, or volume label syntax is incorrect" error message.
# in "The filename, directory name, or volume label syntax is incorrect" error message.
# Passing the command as a single string solves this problem.
# Passing the command as a single string solves this problem.
if
isinstance
(
command
,
list
):
if
isinstance
(
command
,
list
):
command
=
" "
.
join
(
command
)
command
=
" "
.
join
(
command
)
# type: ignore[assignment]
return
subprocess
.
Popen
(
command
,
startupinfo
=
startupinfo
,
**
params
)
return
subprocess
.
Popen
(
command
,
startupinfo
=
startupinfo
,
**
params
)
def
call_subprocess_Popen
(
command
,
**
params
)
:
def
call_subprocess_Popen
(
command
:
list
[
str
],
**
params
)
->
int
:
"""
"""
Calls subprocess_Popen and discards the output, returning only the
Calls subprocess_Popen and discards the output, returning only the
exit code.
exit code.
...
@@ -165,13 +165,17 @@ def call_subprocess_Popen(command, **params):
...
@@ -165,13 +165,17 @@ def call_subprocess_Popen(command, **params):
return
returncode
return
returncode
def
output_subprocess_Popen
(
command
,
**
params
)
:
def
output_subprocess_Popen
(
command
:
list
[
str
],
**
params
)
->
tuple
[
bytes
,
bytes
,
int
]
:
"""
"""
Calls subprocess_Popen, returning the output, error and exit code
Calls subprocess_Popen, returning the output, error and exit code
in a tuple.
in a tuple.
"""
"""
if
"stdout"
in
params
or
"stderr"
in
params
:
if
"stdout"
in
params
or
"stderr"
in
params
:
raise
TypeError
(
"don't use stderr or stdout with output_subprocess_Popen"
)
raise
TypeError
(
"don't use stderr or stdout with output_subprocess_Popen"
)
if
"encoding"
in
params
:
raise
TypeError
(
"adjust the output_subprocess_Popen type annotation to support str"
)
params
[
"stdout"
]
=
subprocess
.
PIPE
params
[
"stdout"
]
=
subprocess
.
PIPE
params
[
"stderr"
]
=
subprocess
.
PIPE
params
[
"stderr"
]
=
subprocess
.
PIPE
p
=
subprocess_Popen
(
command
,
**
params
)
p
=
subprocess_Popen
(
command
,
**
params
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论