From 2cf11f1150ca0022e9591a255d1e721a8b5ce935 Mon Sep 17 00:00:00 2001 From: Teresia Olsson Date: Thu, 13 Nov 2025 11:16:37 +0100 Subject: [PATCH 1/2] Fix import to be compatible with Python 3.10. --- pyaml/bpm/bpm.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pyaml/bpm/bpm.py b/pyaml/bpm/bpm.py index dd016c3a..f6a8e3f3 100644 --- a/pyaml/bpm/bpm.py +++ b/pyaml/bpm/bpm.py @@ -2,8 +2,10 @@ from ..lattice.abstract_impl import RBpmArray, RWBpmOffsetArray, RWBpmTiltScalar from ..bpm.bpm_model import BPMModel from ..common.exception import PyAMLException - -from typing import Self +try: + from typing import Self # Python 3.11+ +except ImportError: + from typing_extensions import Self # Python 3.10 and earlier PYAMLCLASS = "BPM" From e47ad94fc2115131df2d5bf1d11e92accaceca0c Mon Sep 17 00:00:00 2001 From: Teresia Olsson Date: Thu, 13 Nov 2025 11:17:44 +0100 Subject: [PATCH 2/2] Fix import to be compatible with Python 3.10. --- pyaml/diagnostics/tune_monitor.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pyaml/diagnostics/tune_monitor.py b/pyaml/diagnostics/tune_monitor.py index 613783ab..12c66a5a 100644 --- a/pyaml/diagnostics/tune_monitor.py +++ b/pyaml/diagnostics/tune_monitor.py @@ -1,8 +1,10 @@ from ..common.element import Element, ElementConfigModel from ..common.abstract import ReadFloatArray from ..control.deviceaccess import DeviceAccess - -from typing import Self +try: + from typing import Self # Python 3.11+ +except ImportError: + from typing_extensions import Self # Python 3.10 and earlier from pydantic import ConfigDict PYAMLCLASS = "BetatronTuneMonitor"