From 9624e6c1094ec36ef18200566ece92a0f8d9cff2 Mon Sep 17 00:00:00 2001 From: Julian Hammer Date: Tue, 24 Mar 2020 15:20:49 +0100 Subject: [PATCH 1/2] closing cache file after dump --- osaca/semantics/hw_model.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/osaca/semantics/hw_model.py b/osaca/semantics/hw_model.py index a904b32..9c7e77d 100755 --- a/osaca/semantics/hw_model.py +++ b/osaca/semantics/hw_model.py @@ -337,7 +337,8 @@ class MachineModel(object): """ hashname = self._get_hashname(filepath) filepath = os.path.join(utils.CACHE_DIR, hashname + '.pickle') - pickle.dump(data, open(filepath, 'wb')) + with open(filepath, 'wb') as f: + pickle.dump(data, f) def _get_hashname(self, name): """Returns unique hashname for machine model""" @@ -397,7 +398,7 @@ class MachineModel(object): operand_string += 'p' if operand['post-indexed'] else '' return operand_string - def _create_db_operand_aarch64(operand): + def _create_db_operand_aarch64(self, operand): """Create instruction form operand for DB out of operand string.""" if operand == 'i': return {'class': 'immediate', 'imd': 'int'} @@ -418,7 +419,7 @@ class MachineModel(object): else: raise ValueError('Parameter {} is not a valid operand code'.format(operand)) - def _create_db_operand_x86(operand): + def _create_db_operand_x86(self, operand): """Create instruction form operand for DB out of operand string.""" if operand == 'r': return {'class': 'register', 'name': 'gpr'} From ac1295aac287ff301127773ff5f85fb46fe0af8a Mon Sep 17 00:00:00 2001 From: Julian Hammer Date: Tue, 24 Mar 2020 16:02:40 +0100 Subject: [PATCH 2/2] flag string in output now in line with required flags --- osaca/frontend.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osaca/frontend.py b/osaca/frontend.py index 7e0e991..d4b188b 100755 --- a/osaca/frontend.py +++ b/osaca/frontend.py @@ -279,7 +279,7 @@ class Frontend(object): '------------------\n' ' No final analysis is given. If you want to ignore this\n' ' warning and run the analysis anyway, start osaca with\n' - ' --ignore_unknown flag.\n' + ' --ignore-unknown flag.\n' '--------------------------------------------------------------------------------' '----------------{}\n' ).format(amount, '-' * len(str(amount)))