Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[hotpatch] resolving typing issue for python version < 3.10 #163

Merged
merged 2 commits into from
Apr 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions brkraw/api/pvobj/base.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
from __future__ import annotations
import os
import zipfile
from collections import OrderedDict
from collections import defaultdict
from .parameters import Parameter
from typing import Optional

class BaseMethods:
"""
Expand Down Expand Up @@ -163,7 +165,7 @@ def __getattr__(self, key):
def contents(self):
return self._contents

def get_fid(self, scan_id:int|None = None):
def get_fid(self, scan_id:Optional[int] = None):
try:
pvobj = self.get_scan(scan_id) if hasattr(self, 'get_scan') else self
except KeyError:
Expand All @@ -175,7 +177,7 @@ def get_fid(self, scan_id:int|None = None):
raise FileNotFoundError(f"The required file '{' or '.join(fid_files)}' does not exist. "
"Please check the dataset and ensure the file is in the expected location.")

def get_2dseq(self, scan_id:int|None = None, reco_id:int|None = None):
def get_2dseq(self, scan_id:Optional[int] = None, reco_id:Optional[int] = None):
try:
if scan_id and hasattr(self, 'get_scan'):
pvobj = self.get_scan(scan_id).get_reco(reco_id)
Expand Down
4 changes: 3 additions & 1 deletion brkraw/api/pvobj/pvscan.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from __future__ import annotations
import os
from collections import OrderedDict
from typing import Optional
from .base import BaseMethods
from .pvreco import PvReco

Expand All @@ -22,7 +24,7 @@ class PvScan(BaseMethods):
avail (list): A list of available items.
contents (dict): A dictionary of pvscan contents.
"""
def __init__(self, scan_id: int|None, pathes, contents=None, recos=None):
def __init__(self, scan_id: Optional[int], pathes, contents=None, recos=None):
"""
Initialize a Dataset object.

Expand Down