-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
It claims to require Python 3.8 or higher, but actually needs Python ≥ 3.10.
The following files use features from Python 3.10
https://peps.python.org/pep-0604/
PEP 604 – Allow writing union types as X | Y :
epyr/sub/utils.py
epyr/physics/constants.py
Here are patches for epyr 0.2.0 that allow you to use older versions of Python (tested on 3.9).
utils.py:
--- utils.pySA 2025-10-13 12:53:29.615214221 +0700
+++ utils.py 2025-10-13 12:55:46.504684929 +0700
@@ -4,6 +4,7 @@
import warnings
from pathlib import Path
+from typing import Union, Optional
import numpy as np
# Regular expression to check if a string can be converted to a number
@@ -158,7 +159,8 @@
dimensions: list[int],
number_format_code: str,
byte_order: str,
- is_complex: bool | np.ndarray,
+ #is_complex: bool | np.ndarray,
+ is_complex: Union[bool, np.ndarray],
) -> np.ndarray:
"""
Reads binary data from a file into a NumPy array.
constants.py:
--- constants.py_SA 2025-10-13 12:36:45.845635278 +0700
+++ constants.py 2025-10-13 12:44:46.964849985 +0700
@@ -108,7 +108,10 @@
# BACKWARD COMPATIBILITY FUNCTIONS
# ============================================================================
-def gfree(return_uncertainty: bool = False) -> float | Tuple[float, float]:
+
+from typing import Union, Tuple
+#def gfree(return_uncertainty: bool = False) -> float | Tuple[float, float]:
+def gfree(return_uncertainty: bool = False) -> Union[float, Tuple[float, float]]:
"""
Free electron g-factor (dimensionless).
@@ -132,7 +135,8 @@
return GFREE
-def bmagn(return_uncertainty: bool = False) -> float | Tuple[float, float]:
+#def bmagn(return_uncertainty: bool = False) -> float | Tuple[float, float]:
+def bmagn(return_uncertainty: bool = False) -> Union[float, Tuple[float, float]]:
"""
Bohr magneton in SI units (J T⁻¹).
@@ -199,8 +203,8 @@
"""
return CLIGHT
-
-def boltzm(return_uncertainty: bool = False) -> float | Tuple[float, float]:
+#def boltzm(return_uncertainty: bool = False) -> float | Tuple[float, float]:
+def boltzm(return_uncertainty: bool = False) -> Union[float, Tuple[float, float]]:
"""
Boltzmann constant in SI units (J⋅K⁻¹).
@@ -222,8 +226,8 @@
return BOLTZM, 0.0 # Exact since 2019
return BOLTZM
-
-def avogadro(return_uncertainty: bool = False) -> float | Tuple[float, float]:
+#def avogadro(return_uncertainty: bool = False) -> float | Tuple[float, float]:
+def avogadro(return_uncertainty: bool = False) -> Union[float, Tuple[float, float]]:
"""
Avogadro constant in SI units (mol⁻¹).
@@ -245,8 +249,8 @@
return AVOGADRO, 0.0 # Exact since 2019
return AVOGADRO
-
-def nmagn(return_uncertainty: bool = False) -> float | Tuple[float, float]:
+#def nmagn(return_uncertainty: bool = False) -> float | Tuple[float, float]:
+def nmagn(return_uncertainty: bool = False) -> Union[float, Tuple[float, float]]:
"""
Nuclear magneton in SI units (J⋅T⁻¹).
@@ -269,8 +273,8 @@
return NMAGN, uncertainty
return NMAGN
-
-def echarge(return_uncertainty: bool = False) -> float | Tuple[float, float]:
+#def echarge(return_uncertainty: bool = False) -> float | Tuple[float, float]:
+def echarge(return_uncertainty: bool = False) -> Union[float, Tuple[float, float]]:
"""
Elementary charge in SI units (C).
@@ -292,8 +296,8 @@
return ECHARGE, 0.0 # Exact since 2019
return ECHARGE
-
-def evolt(return_uncertainty: bool = False) -> float | Tuple[float, float]:
+#def evolt(return_uncertainty: bool = False) -> float | Tuple[float, float]:
+def evolt(return_uncertainty: bool = False) -> Union[float, Tuple[float, float]]:
"""
Electron volt in SI units (J).
@@ -522,4 +526,4 @@
if __name__ == "__main__":
- constants_summary()
\ В конце файла нет новой строки
+ constants_summary()
Metadata
Metadata
Assignees
Labels
No labels