|
28 | 28 | from smodels.experiment.expAuxiliaryFuncs import cleanWalk |
29 | 29 | from smodels.experiment.exceptions import SModelSExperimentError as SModelSError |
30 | 30 | from smodels.base.smodelsLogging import logger |
31 | | -from typing import Union |
| 31 | +from typing import List, Tuple, Union |
32 | 32 | import logging |
33 | 33 | os.environ["OMP_NUM_THREADS"] = "2" |
34 | 34 |
|
@@ -118,7 +118,7 @@ def __init__(self, base : Union[str,None] = None, |
118 | 118 | self.selectExpResults() |
119 | 119 |
|
120 | 120 | @property |
121 | | - def expResultList(self): |
| 121 | + def expResultList(self) -> List[ExpResult]: |
122 | 122 | """ |
123 | 123 | The combined list of results, compiled from the |
124 | 124 | the active results in each subdatabase. |
@@ -221,7 +221,7 @@ def __str__(self): |
221 | 221 | idList += "%d datasets, %d txnames.\n" % (datasets, txnames) |
222 | 222 | return idList |
223 | 223 |
|
224 | | - def __eq__(self, other): |
| 224 | + def __eq__(self, other: "Database" ): |
225 | 225 | if type(other) != type(self): |
226 | 226 | return False |
227 | 227 | for x, y in zip(self.subs, other.subs): |
@@ -291,7 +291,7 @@ def databaseParticles(self): |
291 | 291 | return r[0] # FIXME do sth smarter? |
292 | 292 |
|
293 | 293 | @property |
294 | | - def databaseVersion(self): |
| 294 | + def databaseVersion(self) -> str: |
295 | 295 | """ |
296 | 296 | The version of the database, concatenation of the individual versions |
297 | 297 |
|
@@ -530,7 +530,7 @@ def removeLinksToModel(self): |
530 | 530 | if hasattr(er.globalInfo, "_databaseParticles"): |
531 | 531 | del er.globalInfo._databaseParticles |
532 | 532 |
|
533 | | - def loadBinaryFile(self, lastm_only : bool = False): |
| 533 | + def loadBinaryFile(self, lastm_only : bool = False) -> "SubDatabase": |
534 | 534 | """ |
535 | 535 | Load a binary database, returning last modified, file count, database. |
536 | 536 |
|
@@ -797,7 +797,7 @@ def sizeof_fmt(num, suffix='B'): |
797 | 797 | self.force_load = "pcl" |
798 | 798 | return ("./", f"{filename}") |
799 | 799 |
|
800 | | - def fetchFromServer(self, path): |
| 800 | + def fetchFromServer(self, path: str) -> Tuple[str, str]: |
801 | 801 | import requests |
802 | 802 | import time |
803 | 803 | import json |
@@ -857,7 +857,7 @@ def __init__(self): self.status_code = -1 |
857 | 857 | self.force_load = "pcl" |
858 | 858 | return ("./", filename) |
859 | 859 |
|
860 | | - def checkPathName(self, path): |
| 860 | + def checkPathName(self, path: str) -> Tuple[str, str]: |
861 | 861 | """ |
862 | 862 | checks the path name, |
863 | 863 | returns the base directory and the pickle file name. |
@@ -1060,9 +1060,10 @@ def createExpResult(self, root): |
1060 | 1060 | self.txt_meta.hasFastLim = True |
1061 | 1061 | return expres |
1062 | 1062 |
|
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): |
1066 | 1067 | """ |
1067 | 1068 | Filter the experimental results and store them in activeResults. |
1068 | 1069 |
|
@@ -1090,9 +1091,10 @@ def setActiveExpResults(self, analysisIDs=['all'], datasetIDs=['all'], txnames=[ |
1090 | 1091 | dataTypes, useNonValidated, |
1091 | 1092 | onlyWithExpected) |
1092 | 1093 |
|
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]: |
1096 | 1098 | """ |
1097 | 1099 | Returns a list of ExpResult objects. |
1098 | 1100 |
|
|
0 commit comments