diff --git a/build/pkgs/configure/checksums.ini b/build/pkgs/configure/checksums.ini index 9882f48fdce..0656d302cbd 100644 --- a/build/pkgs/configure/checksums.ini +++ b/build/pkgs/configure/checksums.ini @@ -1,3 +1,3 @@ tarball=configure-VERSION.tar.gz -sha1=0f6355fc136bb6619585863b9e4bc954cc6e0e3d -sha256=5b618581d51997afa78b5e6647584f7ef4e6d5844823dd44e607f2accd7abba5 +sha1=b08e077178bfe0d44d6028e67233ab008dd8dd05 +sha256=49ef0dab4287764522f7290d51ebbfe38492b2695201d87dd8452020a3b4d9d6 diff --git a/build/pkgs/configure/package-version.txt b/build/pkgs/configure/package-version.txt index f215e057b9e..e790ec6325f 100644 --- a/build/pkgs/configure/package-version.txt +++ b/build/pkgs/configure/package-version.txt @@ -1 +1 @@ -b9cb7bc2559cde857d84d77f0b37a3616ce1eb6c +448f7e212e38ad2bd0ed6be7ae8cad1cb3615913 diff --git a/src/sage/misc/replace_dot_all.py b/src/sage/misc/replace_dot_all.py index 16ac2124377..ea51a9b3159 100644 --- a/src/sage/misc/replace_dot_all.py +++ b/src/sage/misc/replace_dot_all.py @@ -456,8 +456,8 @@ def walkdir_replace_dot_all(dir, file_regex=r'.*[.](py|pyx|pxi)$', package_regex finally: # Print report also when interrupted if verbosity: - log_messages = sorted(log_messages.rstrip().split('\n')) - for i, message in enumerate(log_messages, start=1): + log_messages_split = sorted(log_messages.rstrip().split('\n')) + for i, message in enumerate(log_messages_split, start=1): # add index to each line print(f'{i}. {message.rstrip()}') report = 'REPORT:\n' diff --git a/src/sage/misc/temporary_file.py b/src/sage/misc/temporary_file.py index ff8c7a751ac..998260be8eb 100644 --- a/src/sage/misc/temporary_file.py +++ b/src/sage/misc/temporary_file.py @@ -23,11 +23,10 @@ # https://www.gnu.org/licenses/ # **************************************************************************** -import io +import atexit import os import tempfile - -import atexit +from typing import IO # Until tmp_dir() and tmp_filename() are removed, we use this directory # as the parent for all temporary files & directories created by them. @@ -41,7 +40,7 @@ # temporary directory ################################################################# -def tmp_dir(name='dir_', ext=''): +def tmp_dir(name='dir_', ext='') -> str: r""" Create and return a temporary directory in ``$HOME/.sage/temp/hostname/pid/`` @@ -84,7 +83,7 @@ def tmp_dir(name='dir_', ext=''): # temporary filename ################################################################# -def tmp_filename(name='tmp_', ext=''): +def tmp_filename(name='tmp_', ext='') -> str: r""" Create and return a temporary file in ``$HOME/.sage/temp/hostname/pid/`` @@ -163,8 +162,8 @@ class atomic_write: mode bits of the file were changed manually). (Not to be confused with the file opening mode.) - - ``binary`` -- boolean (default: ``True`` on Python 2, ``False`` on Python - 3); the underlying file is opened in binary mode. If ``False`` then it is + - ``binary`` -- boolean (default: ``False``); + the underlying file is opened in binary mode. If ``False`` then it is opened in text mode and an encoding with which to write the file may be supplied. @@ -299,7 +298,7 @@ class atomic_write: False """ def __init__(self, target_filename, append=False, mode=0o666, - binary=None, **kwargs): + binary=False, **kwargs) -> None: """ TESTS:: @@ -320,13 +319,11 @@ def __init__(self, target_filename, append=False, mode=0o666, os.umask(umask) self.mode = mode & (~umask) - # 'binary' mode is the default on Python 2, whereas 'text' mode is the - # default on Python 3--this reflects consistent handling of the default - # str type on the two platforms - self.binary = False if binary is None else binary + # 'text' mode is the default on Python 3 + self.binary = binary self.kwargs = kwargs - def __enter__(self): + def __enter__(self) -> IO: """ Create and return a temporary file in ``self.tmpdir`` (normally the same directory as the target file). @@ -372,7 +369,7 @@ def __enter__(self): return self.tempfile - def __exit__(self, exc_type, exc_val, exc_tb): + def __exit__(self, exc_type, exc_val, exc_tb) -> None: """ If the ``with`` block was successful, move the temporary file to the target file. Otherwise, delete the temporary file. @@ -457,7 +454,7 @@ class atomic_dir: ....: h.read() 'Second' """ - def __init__(self, target_directory): + def __init__(self, target_directory) -> None: r""" TESTS:: @@ -492,7 +489,7 @@ def __enter__(self): self.tempname = os.path.abspath(tdir.name) return tdir - def __exit__(self, exc_type, exc_val, exc_tb): + def __exit__(self, exc_type, exc_val, exc_tb) -> None: """ If the ``with`` block was successful, move the temporary directory to the target directory. Otherwise, delete the temporary directory. @@ -518,7 +515,8 @@ def __exit__(self, exc_type, exc_val, exc_tb): try: os.rename(self.tempname, self.target) except OSError: - # Race: Another thread or process must have created the directory + # Race: Another thread or process must have created + # the directory pass else: # Failure: delete temporary file @@ -528,7 +526,7 @@ def __exit__(self, exc_type, exc_val, exc_tb): _spyx_tmp = None -def spyx_tmp(): +def spyx_tmp() -> str: r""" The temporary directory used to store pyx files.