From f93aa0889d33c94ec4b13e08123eaa00139694d5 Mon Sep 17 00:00:00 2001 From: murilobalves Date: Fri, 9 Jan 2026 18:08:43 +0100 Subject: [PATCH 1/2] Replace np.float_ to np.float64 and np.complex_ to np.complex128 --- mathphys/functions.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mathphys/functions.py b/mathphys/functions.py index 29f9daa..2d9fde1 100644 --- a/mathphys/functions.py +++ b/mathphys/functions.py @@ -289,6 +289,7 @@ def repo_info(repo_path): def get_path_from_package(package): """Return the directory where package is installed. + Args: package (str or module): Package name or module Raises: @@ -330,7 +331,7 @@ def get_package_string(package): repo_str += '+' if info['last_tag'] else '' repo_str += f"{info['last_commit']:s}" if info['is_dirty']: - repo_str += f"+dirty" + repo_str += "+dirty" else: repo_str += f'{ver:s}' return repo_str @@ -350,7 +351,7 @@ def flatten(x): # ------------------------- HELPER METHODS ------------------------------------ _BUILTINTYPES = (int, float, complex, str, bytes, bool) _BUILTINNAMES = {typ.__name__ for typ in _BUILTINTYPES} -_NPTYPES = (_np.int_, _np.float_, _np.complex_, _np.bool_) +_NPTYPES = (_np.int_, _np.float64, _np.complex128, _np.bool_) def _save_recursive_hdf5(fil, path, obj, compress): From 7969e17933232dfaa8ad0e0fd7e6b3026a17a7b2 Mon Sep 17 00:00:00 2001 From: murilobalves Date: Fri, 9 Jan 2026 18:08:57 +0100 Subject: [PATCH 2/2] Apply formatter --- mathphys/functions.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/mathphys/functions.py b/mathphys/functions.py index 2d9fde1..11dd3f2 100644 --- a/mathphys/functions.py +++ b/mathphys/functions.py @@ -1,4 +1,5 @@ """Useful functions.""" + import builtins as _builtins import gzip as _gzip import os as _os @@ -48,7 +49,7 @@ def generate_random_numbers(n_part, dist_type='exp', cutoff=3): above = above[indcs] if dist_type in 'uniform': - numbers -= 1/2 + numbers -= 1 / 2 numbers *= 2 return numbers @@ -305,7 +306,7 @@ def get_path_from_package(package): else: raise ValueError('Invalid package type, must be str or module') dist = _implib_meta.distribution(pkg) - return str(dist.locate_file("")), dist.version + return str(dist.locate_file('')), dist.version def is_git_repo(path): @@ -326,12 +327,12 @@ def get_package_string(package): if is_git_repo(path): info = repo_info(path) if info['last_tag']: - repo_str += f"{info['last_tag']:s}" + repo_str += f'{info["last_tag"]:s}' if info['last_tag_commit'] != info['last_commit']: repo_str += '+' if info['last_tag'] else '' - repo_str += f"{info['last_commit']:s}" + repo_str += f'{info["last_commit"]:s}' if info['is_dirty']: - repo_str += "+dirty" + repo_str += '+dirty' else: repo_str += f'{ver:s}' return repo_str @@ -373,7 +374,7 @@ def _save_recursive_hdf5(fil, path, obj, compress): for key, item in obj.items(): _save_recursive_hdf5(fil, path + key, item, compress) else: - raise TypeError('Data type not valid: '+typ.__name__+'.') + raise TypeError('Data type not valid: ' + typ.__name__ + '.') fil[path].attrs['type'] = typ.__name__ @@ -384,7 +385,8 @@ def _load_recursive_hdf5(fil): return [_load_recursive_hdf5(fil[str(i)]) for i in range(len(fil))] elif typ == 'tuple': return tuple([ - _load_recursive_hdf5(fil[str(i)]) for i in range(len(fil))]) + _load_recursive_hdf5(fil[str(i)]) for i in range(len(fil)) + ]) elif typ == 'set': return {_load_recursive_hdf5(fil[str(i)]) for i in range(len(fil))} elif typ == 'dict':