提交 f37ee844 authored 作者: Virgile Andreani's avatar Virgile Andreani 提交者: Virgile Andreani

Apply rule PTH208

上级 cbd662fc
import logging import logging
import os import os
import sys import sys
from pathlib import Path
if sys.platform == "win32": if sys.platform == "win32":
...@@ -65,11 +66,7 @@ def main(): ...@@ -65,11 +66,7 @@ def main():
# Print a warning if some cached modules were not removed, so that the # Print a warning if some cached modules were not removed, so that the
# user knows he should manually delete them, or call # user knows he should manually delete them, or call
# pytensor-cache purge, # to properly clear the cache. # pytensor-cache purge, # to properly clear the cache.
items = [ items = list(Path(cache.dirname).glob("tmp*"))
item
for item in sorted(os.listdir(cache.dirname))
if item.startswith("tmp")
]
if items: if items:
_logger.warning( _logger.warning(
"There remain elements in the cache dir that you may " "There remain elements in the cache dir that you may "
......
...@@ -77,7 +77,6 @@ Optimizations associated with these BLAS Ops are in tensor.rewriting.blas ...@@ -77,7 +77,6 @@ Optimizations associated with these BLAS Ops are in tensor.rewriting.blas
import functools import functools
import logging import logging
import os
import shlex import shlex
import warnings import warnings
from pathlib import Path from pathlib import Path
...@@ -402,9 +401,9 @@ def _ldflags( ...@@ -402,9 +401,9 @@ def _ldflags(
include_dir=False, include_dir=False,
) )
for d in dirs: for d in dirs:
for f in os.listdir(d.strip('"')): for f in Path(d.strip('"')).iterdir():
if f.endswith(".so") or f.endswith(".dylib") or f.endswith(".dll"): if f.suffix in {".so", ".dylib", ".dll"}:
if any(f.find(ll) >= 0 for ll in l): if any(f.stem.find(ll) >= 0 for ll in l):
found_dyn = True found_dyn = True
# Special treatment of clang framework. Specifically for MacOS Accelerate # Special treatment of clang framework. Specifically for MacOS Accelerate
if "-framework" in l and "Accelerate" in l: if "-framework" in l and "Accelerate" in l:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论