Skip to content

Commit 19678bf

Browse files
type hints for databaseObj
1 parent aea33fe commit 19678bf

File tree

2 files changed

+16
-14
lines changed

2 files changed

+16
-14
lines changed

ReleaseNotes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Release v3.1.1
22
=======================================================
33

4-
* in nllfast and pythia6 compiles, fix for systems with f77 compiler (thanks Jonas Wuerzinger)
4+
* fixed issues with xsecComputer on lxplus (thanks Jonas Wuerzinger)
55
* added filter for slogdet warnings (relevant on MacOS)
66
* Minor fixes in slha printer
77
* Bumped up pythia8 from 8315 to 8316

smodels/experiment/databaseObj.py

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
from smodels.experiment.expAuxiliaryFuncs import cleanWalk
2929
from smodels.experiment.exceptions import SModelSExperimentError as SModelSError
3030
from smodels.base.smodelsLogging import logger
31-
from typing import Union
31+
from typing import List, Tuple, Union
3232
import logging
3333
os.environ["OMP_NUM_THREADS"] = "2"
3434

@@ -118,7 +118,7 @@ def __init__(self, base : Union[str,None] = None,
118118
self.selectExpResults()
119119

120120
@property
121-
def expResultList(self):
121+
def expResultList(self) -> List[ExpResult]:
122122
"""
123123
The combined list of results, compiled from the
124124
the active results in each subdatabase.
@@ -221,7 +221,7 @@ def __str__(self):
221221
idList += "%d datasets, %d txnames.\n" % (datasets, txnames)
222222
return idList
223223

224-
def __eq__(self, other):
224+
def __eq__(self, other: "Database" ):
225225
if type(other) != type(self):
226226
return False
227227
for x, y in zip(self.subs, other.subs):
@@ -291,7 +291,7 @@ def databaseParticles(self):
291291
return r[0] # FIXME do sth smarter?
292292

293293
@property
294-
def databaseVersion(self):
294+
def databaseVersion(self) -> str:
295295
"""
296296
The version of the database, concatenation of the individual versions
297297
@@ -530,7 +530,7 @@ def removeLinksToModel(self):
530530
if hasattr(er.globalInfo, "_databaseParticles"):
531531
del er.globalInfo._databaseParticles
532532

533-
def loadBinaryFile(self, lastm_only : bool = False):
533+
def loadBinaryFile(self, lastm_only : bool = False) -> "SubDatabase":
534534
"""
535535
Load a binary database, returning last modified, file count, database.
536536
@@ -797,7 +797,7 @@ def sizeof_fmt(num, suffix='B'):
797797
self.force_load = "pcl"
798798
return ("./", f"{filename}")
799799

800-
def fetchFromServer(self, path):
800+
def fetchFromServer(self, path: str) -> Tuple[str, str]:
801801
import requests
802802
import time
803803
import json
@@ -857,7 +857,7 @@ def __init__(self): self.status_code = -1
857857
self.force_load = "pcl"
858858
return ("./", filename)
859859

860-
def checkPathName(self, path):
860+
def checkPathName(self, path: str) -> Tuple[str, str]:
861861
"""
862862
checks the path name,
863863
returns the base directory and the pickle file name.
@@ -1060,9 +1060,10 @@ def createExpResult(self, root):
10601060
self.txt_meta.hasFastLim = True
10611061
return expres
10621062

1063-
def setActiveExpResults(self, analysisIDs=['all'], datasetIDs=['all'], txnames=['all'],
1064-
dataTypes=['all'], useNonValidated=False,
1065-
onlyWithExpected=False):
1063+
def setActiveExpResults(self, analysisIDs: Union[str, List[str]]=['all'],
1064+
datasetIDs: List[str]=['all'], txnames: Union[str, List[str]]=['all'],
1065+
dataTypes: List[str]=['all'], useNonValidated: bool=False,
1066+
onlyWithExpected: bool=False):
10661067
"""
10671068
Filter the experimental results and store them in activeResults.
10681069
@@ -1090,9 +1091,10 @@ def setActiveExpResults(self, analysisIDs=['all'], datasetIDs=['all'], txnames=[
10901091
dataTypes, useNonValidated,
10911092
onlyWithExpected)
10921093

1093-
def getExpResults(self, analysisIDs=['all'], datasetIDs=['all'], txnames=['all'],
1094-
dataTypes=['all'], useNonValidated=False,
1095-
onlyWithExpected=False):
1094+
def getExpResults(self, analysisIDs: Union[str, List[str]]=['all'],
1095+
datasetIDs: List[str]=['all'], txnames: Union[str, List[str]]=['all'],
1096+
dataTypes: List[str]=['all'], useNonValidated: bool=False,
1097+
onlyWithExpected: bool=False) -> List[ExpResult]:
10961098
"""
10971099
Returns a list of ExpResult objects.
10981100

0 commit comments

Comments
 (0)