2727THE SOFTWARE.
2828"""
2929
30- import re
31- from functools import reduce , wraps
32- import operator
33- import sys
34- import logging
35- from typing import (
36- Any , Callable , Dict , Generic , Hashable , Iterable ,
37- List , Optional , Set , Tuple , TypeVar , Union , ClassVar )
3830import builtins
39-
31+ import logging
4032import math
33+ import operator
34+ import re
35+ import sys
36+ from functools import reduce , wraps
4137from sys import intern
38+ from typing import (Any , Callable , ClassVar , Dict , Generic , Hashable , Iterable ,
39+ List , Optional , Set , Tuple , TypeVar , Union )
40+
4241
4342try :
44- from typing import SupportsIndex , Concatenate
43+ from typing import Concatenate , SupportsIndex
4544except ImportError :
46- from typing_extensions import SupportsIndex , Concatenate
45+ from typing_extensions import Concatenate , SupportsIndex
4746
4847try :
4948 from typing import ParamSpec
@@ -1584,6 +1583,8 @@ def get_write_to_map_from_permutation(original, permuted):
15841583# {{{ graph algorithms
15851584
15861585from pytools .graph import a_star as a_star_moved
1586+
1587+
15871588a_star = MovedFunctionDeprecationWrapper (a_star_moved )
15881589
15891590# }}}
@@ -1871,7 +1872,7 @@ def string_histogram( # pylint: disable=too-many-arguments,too-many-locals
18711872 print (value , bin_nr , bin_starts )
18721873 raise
18731874
1874- from math import floor , ceil
1875+ from math import ceil , floor
18751876 if use_unicode :
18761877 def format_bar (cnt ):
18771878 scaled = cnt * width / max_count
@@ -2169,7 +2170,7 @@ def assert_not_a_file(name):
21692170
21702171
21712172def add_python_path_relative_to_script (rel_path ):
2172- from os .path import dirname , join , abspath
2173+ from os .path import abspath , dirname , join
21732174
21742175 script_name = sys .argv [0 ]
21752176 rel_script_dir = dirname (script_name )
@@ -2391,8 +2392,9 @@ def download_from_web_if_not_present(url, local_name=None):
23912392 local_name = basename (url )
23922393
23932394 if not exists (local_name ):
2394- from pytools .version import VERSION_TEXT
23952395 from urllib .request import Request , urlopen
2396+
2397+ from pytools .version import VERSION_TEXT
23962398 req = Request (url , headers = {
23972399 "User-Agent" : f"pytools/{ VERSION_TEXT } "
23982400 })
@@ -2412,7 +2414,7 @@ def find_git_revision(tree_root): # pylint: disable=too-many-locals
24122414 # Keep this routine self-contained so that it can be copy-pasted into
24132415 # setup.py.
24142416
2415- from os .path import join , exists , abspath
2417+ from os .path import abspath , exists , join
24162418 tree_root = abspath (tree_root )
24172419
24182420 if not exists (join (tree_root , ".git" )):
@@ -2432,7 +2434,7 @@ def find_git_revision(tree_root): # pylint: disable=too-many-locals
24322434 env ["LANG" ] = "C"
24332435 env ["LC_ALL" ] = "C"
24342436
2435- from subprocess import Popen , PIPE , STDOUT
2437+ from subprocess import PIPE , STDOUT , Popen
24362438 p = Popen (["git" , "rev-parse" , "HEAD" ], shell = False ,
24372439 stdin = PIPE , stdout = PIPE , stderr = STDOUT , close_fds = True ,
24382440 cwd = tree_root , env = env )
@@ -2808,8 +2810,8 @@ def unordered_hash(hash_instance, iterable, hash_constructor=None):
28082810 """
28092811
28102812 if hash_constructor is None :
2811- from functools import partial
28122813 import hashlib
2814+ from functools import partial
28132815 hash_constructor = partial (hashlib .new , hash_instance .name )
28142816
28152817 h_int = 0
0 commit comments