Skip to content

Commit

Permalink
Merge pull request #163 from dvm-shlee/main
Browse files Browse the repository at this point in the history
[hotpatch] resolving typing issue for python version < 3.10
  • Loading branch information
dvm-shlee authored Apr 15, 2024
2 parents ee23d76 + 089ab05 commit 857233f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
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

0 comments on commit 857233f

Please sign in to comment.