Skip to content

Commit

Permalink
Fixed some IBIS file parsing fragilities.
Browse files Browse the repository at this point in the history
  • Loading branch information
capn-freako committed Jan 21, 2020
1 parent 1c63766 commit be4bc5a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
9 changes: 4 additions & 5 deletions pyibisami/ibis_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,10 @@ def __init__(self, ibis_file_name, is_tx):
self.add_trait('ibis_ver', Float(model_dict['ibis_ver']))
self.add_trait('file_name', String(model_dict['file_name']))
self.add_trait('file_rev', String(model_dict['file_rev']))
self.add_trait('date', String(model_dict['date']))
if 'date' in model_dict:
self.add_trait('date', String(model_dict['date']))
else:
self.add_trait('date', String("(n/a)"))

self._ibis_parsing_errors = err_str
self._os_type = platform.system() # These 2 are used, to choose
Expand Down Expand Up @@ -256,11 +259,7 @@ def _pin_changed(self, new_value):
self.models = self.get_models(mname)
self.mod = self.models[0]

# _mod_changed_visits = 0
def _mod_changed(self, new_value):
# self._mod_changed_visits += 1
# if self._mod_changed_visits == 2:
# raise RuntimeError("Visit #{} to ``_mod_changed()``.".format(self._mod_changed_visits))
model = self._models[new_value]
os_type = self._os_type
os_bits = self._os_bits
Expand Down
17 changes: 11 additions & 6 deletions pyibisami/ibis_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,18 +217,23 @@ def partition(p, xs):
return ts, fs

def getFiles(x):
((_, _), fs) = x
return fs
if x:
((_, _), fs) = x[0]
return fs
else:
return []

def splitExecs(fs):
wins, lins = partition(isWin, fs)
return (getFiles(wins), getFiles(lins))

self._exec32Wins, self._exec32Lins = [], []
self._exec64Wins, self._exec64Lins = [], []
if 'algorithmic_model' in subDict:
execs = subDict['algorithmic_model']
exec64s, exec32s = partition(is64, execs)
if exec32s:
self._exec32Wins, self._exec32Lins = list(map(lambda x: list(map(getFiles, x))[0], partition(isWin, exec32s)))
if exec64s:
self._exec64Wins, self._exec64Lins = list(map(lambda x: list(map(getFiles, x))[0], partition(isWin, exec64s)))
self._exec32Wins, self._exec32Lins = splitExecs(exec32s)
self._exec64Wins, self._exec64Lins = splitExecs(exec64s)

# Set up the GUI.
self.add_trait('model_type', String(self._mtype))
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

setup(
name="PyIBIS-AMI",
version="3.3.0",
version="3.3.2",
packages=find_packages(exclude=["docs", "tests"]),
include_package_data=True,
description="Facilitates working directly with IBIS-AMI DLLs from the Python command prompt.",
Expand Down

0 comments on commit be4bc5a

Please sign in to comment.