sbdl 1.18.17__tar.gz → 1.18.19__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sbdl
3
- Version: 1.18.17
3
+ Version: 1.18.19
4
4
  Summary: System Behaviour Description Language (Compiler)
5
5
  Home-page: https://sbdl.dev
6
6
  Author: Michael A. Hicks
@@ -0,0 +1,4 @@
1
+ [build-system]
2
+ requires = ["setuptools>=42", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sbdl
3
- Version: 1.18.17
3
+ Version: 1.18.19
4
4
  Summary: System Behaviour Description Language (Compiler)
5
5
  Home-page: https://sbdl.dev
6
6
  Author: Michael A. Hicks
@@ -1,10 +1,11 @@
1
1
  csv-to-sbdl.py
2
- sbdl
2
+ pyproject.toml
3
3
  sbdl.py
4
4
  sbdl_server.py
5
5
  setup.py
6
6
  sbdl.egg-info/PKG-INFO
7
7
  sbdl.egg-info/SOURCES.txt
8
8
  sbdl.egg-info/dependency_links.txt
9
+ sbdl.egg-info/entry_points.txt
9
10
  sbdl.egg-info/requires.txt
10
11
  sbdl.egg-info/top_level.txt
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ sbdl = sbdl:run_main
@@ -4,4 +4,3 @@ jinja2
4
4
  matplotlib
5
5
  networkx
6
6
  openpyxl
7
- pandas
@@ -130,41 +130,41 @@ _Ad='ascii'
130
130
  _Ac='relations'
131
131
  _Ab='actor'
132
132
  _Aa='function'
133
- _AZ='ignore'
134
- _AY='**LOCKED_CONFIG_KEYS'
135
- _AX='linux'
136
- _AW='openfmea_compoundfield_separator'
137
- _AV='usecase_diagram_descriptions'
138
- _AU='function_diagram_style'
139
- _AT='aspect_diagram_style'
140
- _AS='network_diagram_node_size'
141
- _AR='parser_allow_global_directive_definition'
142
- _AQ='parser_allow_directive_definition'
143
- _AP='plantuml_ortho_line_routing'
144
- _AO='plantuml_layout_tweaks'
145
- _AN='plantuml_raw_output'
146
- _AM='prolog_trace_file'
147
- _AL='sbdl_caching_dependent_files'
148
- _AK='sbdl_show_stack_trace'
149
- _AJ='test/example.cpp'
150
- _AI='test/example.sbdl'
151
- _AH='from:csv-matrix'
152
- _AG='from:json-tree'
153
- _AF='json-tree'
154
- _AE='csv-matrix'
155
- _AD='openfmea'
156
- _AC='{} ({})'
157
- _AB='OpenFMEA'
158
- _AA='left'
159
- _A9='right'
160
- _A8='system'
161
- _A7='occurrence_post'
162
- _A6='detectability_post'
163
- _A5='interface'
164
- _A4='parser_allow_directives'
165
- _A3='prolog_result_output'
166
- _A2='sbdl_sort_output_by_identifier'
167
- _A1='sbdl_sort_output_by_type'
133
+ _AZ='**LOCKED_CONFIG_KEYS'
134
+ _AY='linux'
135
+ _AX='openfmea_compoundfield_separator'
136
+ _AW='usecase_diagram_descriptions'
137
+ _AV='function_diagram_style'
138
+ _AU='aspect_diagram_style'
139
+ _AT='network_diagram_node_size'
140
+ _AS='parser_allow_global_directive_definition'
141
+ _AR='parser_allow_directive_definition'
142
+ _AQ='plantuml_ortho_line_routing'
143
+ _AP='plantuml_layout_tweaks'
144
+ _AO='plantuml_raw_output'
145
+ _AN='prolog_trace_file'
146
+ _AM='sbdl_caching_dependent_files'
147
+ _AL='sbdl_show_stack_trace'
148
+ _AK='test/example.cpp'
149
+ _AJ='test/example.sbdl'
150
+ _AI='from:csv-matrix'
151
+ _AH='from:json-tree'
152
+ _AG='json-tree'
153
+ _AF='csv-matrix'
154
+ _AE='openfmea'
155
+ _AD='{} ({})'
156
+ _AC='OpenFMEA'
157
+ _AB='left'
158
+ _AA='right'
159
+ _A9='system'
160
+ _A8='occurrence_post'
161
+ _A7='detectability_post'
162
+ _A6='interface'
163
+ _A5='parser_allow_directives'
164
+ _A4='prolog_result_output'
165
+ _A3='sbdl_sort_output_by_identifier'
166
+ _A2='sbdl_sort_output_by_type'
167
+ _A1='ignore'
168
168
  _A0='action'
169
169
  _z='@startuml\n{style}\n\n{header}\n{content}\n@enduml\n'
170
170
  _y='title "{}"\n'
@@ -219,16 +219,17 @@ _C=False
219
219
  _B=None
220
220
  _A=True
221
221
  import argparse,base64,datetime,csv,functools,getpass,hashlib,importlib,io,json,os,pathlib,pickle,platform,re,shlex,string,subprocess,sys,tarfile,tempfile,textwrap,time,traceback,types,unittest,urllib.request,urllib.parse,warnings,zlib,zipfile
222
+ warnings.filterwarnings(_A1,category=DeprecationWarning)
222
223
  __NAME=_j
223
- __VERSION='1.18.17'
224
- __VERSION_DEV='d210b50'
224
+ __VERSION='1.18.19'
225
+ __VERSION_DEV='ab2813a'
225
226
  __VERSION_DSL='25.6'
226
227
  __VERSION_REST_API='1.1.0'
227
228
  __AUTHOR='contact@sbdl.dev'
228
229
  __URL='https://sbdl.dev'
229
230
  __LOGO=''
230
231
  __HELP_TEXT=''
231
- _CONFIG_DATA={_B4:'_sbdl\\s?\\(',_B5:'\\)$',_B6:'_sbdl_block_begin',_B7:'_sbdl_block_end',_B8:'^\\.\\.\\.$',_B9:_B,_BA:_A,_BB:_C,_p:_A,_BC:{},_V:_C,_BD:_A,_BE:'.sbdl',_BF:_O,_BG:[],_k:[],_BH:5,_BI:_A,_BJ:'sbdl-package.tar.gz',_AK:_C,_A1:_C,_A2:_C,_BK:_A,_BL:_A,_BM:_C,_BN:'.sbdlc',_AL:{},_BO:_A,_l:_A,_A3:_C,_AM:_B,_AN:_C,_BP:'plantuml',_BQ:65536,_BR:'png',_BS:_A,_AO:_C,_AP:_C,_A4:_A,_BT:_A,_AQ:_A,_AR:_A,_T:{},_BU:_A,_BV:_A,_BW:_A,_BX:38,_BY:22,_BZ:_C,_Ba:_A,_AS:20000,_Bb:_CE,_Bc:200,_Bd:'',_Be:_C,_Bf:2,_Bg:_C,_W:"!pragma layout newlayouter\nskinparam dpi 200\nskinparam backgroundColor transparent\n'skinparam monochrome reverse\n\n",_Bh:'\n<style>\n node {\n HorizontalAlignment center\n MaximumWidth 150\n }\n wbsDiagram {\n Linecolor black\n arrow {\n LineColor black\n }\n .toplevel {\n }\n .source {\n LineStyle 2\n RoundCorner 10\n }\n .aspect {\n LineStyle 8.0;3.0\n LineColor lightgray\n BackgroundColor lightgray\n LineThickness 1.0\n RoundCorner 0\n Shadowing 0.0\n }\n }\n</style>',_Bi:_B,_AT:'hide circle',_Bj:'frame',_Bk:'class',_Bl:_C,_AU:_CF,_Bm:_C,_Bn:'participant','process_diagram_style':_CF,_Bo:_C,_q:_C,_b:15,_Bp:40,_Bq:'',_Br:_C,_Bs:'',_AV:_C,_Bt:0,_Bu:'[...]',_Bv:_C,_Bw:'less -R'if os.name=='posix'else'',_Bx:'SBDL_NO_PRETTY',_By:_C,_Bz:_A,_B_:_C,_C0:'1879da28-0fc2-4f1d-8ff1-407f4c070c44',_C1:'{base}/{endp}'.format(base=__URL,endp='rest.api'),_AW:'; ',_C2:'',_C3:_A,_C4:_A,_C5:_C,_C6:'https://fmea.dev',_C7:_A,_C8:_C,_C9:_C,_CA:_U,_CB:_B,_CC:8,_CD:'0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'}
232
+ _CONFIG_DATA={_B4:'_sbdl\\s?\\(',_B5:'\\)$',_B6:'_sbdl_block_begin',_B7:'_sbdl_block_end',_B8:'^\\.\\.\\.$',_B9:_B,_BA:_A,_BB:_C,_p:_A,_BC:{},_V:_C,_BD:_A,_BE:'.sbdl',_BF:_O,_BG:[],_k:[],_BH:5,_BI:_A,_BJ:'sbdl-package.tar.gz',_AL:_C,_A2:_C,_A3:_C,_BK:_A,_BL:_A,_BM:_C,_BN:'.sbdlc',_AM:{},_BO:_A,_l:_A,_A4:_C,_AN:_B,_AO:_C,_BP:'plantuml',_BQ:65536,_BR:'png',_BS:_A,_AP:_C,_AQ:_C,_A5:_A,_BT:_A,_AR:_A,_AS:_A,_T:{},_BU:_A,_BV:_A,_BW:_A,_BX:38,_BY:22,_BZ:_C,_Ba:_A,_AT:20000,_Bb:_CE,_Bc:200,_Bd:'',_Be:_C,_Bf:2,_Bg:_C,_W:"!pragma layout newlayouter\nskinparam dpi 200\nskinparam backgroundColor transparent\n'skinparam monochrome reverse\n\n",_Bh:'\n<style>\n node {\n HorizontalAlignment center\n MaximumWidth 150\n }\n wbsDiagram {\n Linecolor black\n arrow {\n LineColor black\n }\n .toplevel {\n }\n .source {\n LineStyle 2\n RoundCorner 10\n }\n .aspect {\n LineStyle 8.0;3.0\n LineColor lightgray\n BackgroundColor lightgray\n LineThickness 1.0\n RoundCorner 0\n Shadowing 0.0\n }\n }\n</style>',_Bi:_B,_AU:'hide circle',_Bj:'frame',_Bk:'class',_Bl:_C,_AV:_CF,_Bm:_C,_Bn:'participant','process_diagram_style':_CF,_Bo:_C,_q:_C,_b:15,_Bp:40,_Bq:'',_Br:_C,_Bs:'',_AW:_C,_Bt:0,_Bu:'[...]',_Bv:_C,_Bw:'less -R'if os.name=='posix'else'',_Bx:'SBDL_NO_PRETTY',_By:_C,_Bz:_A,_B_:_C,_C0:'1879da28-0fc2-4f1d-8ff1-407f4c070c44',_C1:'{base}/{endp}'.format(base=__URL,endp='rest.api'),_AX:'; ',_C2:'',_C3:_A,_C4:_A,_C5:_C,_C6:'https://fmea.dev',_C7:_A,_C8:_C,_C9:_C,_CA:_U,_CB:_B,_CC:8,_CD:'0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'}
232
233
  def name():return __NAME
233
234
  def version():return __VERSION
234
235
  def version_dev():return __VERSION_DEV
@@ -241,7 +242,7 @@ def logo():return __LOGO if allow_pretty_print()else''
241
242
  def help_text():return __HELP_TEXT
242
243
  def current_os():
243
244
  if sys.platform.startswith('win'):return'windows'
244
- elif sys.platform.startswith(_AX):return _AX
245
+ elif sys.platform.startswith(_AY):return _AY
245
246
  elif sys.platform.startswith('darwin'):return'macos'
246
247
  else:return
247
248
  def get_config_value(key,raise_on_missing=_A,default=_B,number=_B):
@@ -256,9 +257,9 @@ def get_config_value(key,raise_on_missing=_A,default=_B,number=_B):
256
257
  if number:float_val=float(result);int_val=int(result);result=int_val if int_val==float_val else float_val
257
258
  else:result=str(result)
258
259
  return result
259
- def config_key_locked(key):lock_key=_AY;return key in get_config_value(lock_key,raise_on_missing=_C,default={})
260
+ def config_key_locked(key):lock_key=_AZ;return key in get_config_value(lock_key,raise_on_missing=_C,default={})
260
261
  def lock_config_key(key):
261
- lock_key=_AY
262
+ lock_key=_AZ
262
263
  if not get_config_value(lock_key,raise_on_missing=_C):set_config_value(lock_key,{},warn_on_new=_C)
263
264
  add_to_config_value(lock_key,{key:_A})
264
265
  def set_config_value(key,data,warn_on_new=_A):
@@ -267,7 +268,7 @@ def set_config_value(key,data,warn_on_new=_A):
267
268
  _CONFIG_DATA[key]=data
268
269
  else:debug_out(f'Trying to set locked config key:: "{key}"')
269
270
  def use_config_data(new_config_data,skip_keys=_B):
270
- global _CONFIG_DATA;lock_key=_AY;skip_keys_l=list(get_config_value(lock_key,raise_on_missing=_C,default={}).keys())
271
+ global _CONFIG_DATA;lock_key=_AZ;skip_keys_l=list(get_config_value(lock_key,raise_on_missing=_C,default={}).keys())
271
272
  if skip_keys:skip_keys_l.extend(skip_keys)
272
273
  for skip_key in skip_keys_l:
273
274
  if skip_key in new_config_data:new_config_data.pop(skip_key)
@@ -290,7 +291,7 @@ def reset():
290
291
  def print_null(*content,end=_B,error=_C,verbose=_A,do_debug=_C,debug=_C,do_warning=_A,warning=_C,opts=_B,prefix=_B):0
291
292
  def safe_stdout_endcode(in_string):
292
293
  result=in_string
293
- if isinstance(result,str):result=result.encode(sys.stdout.encoding,errors=_AZ).decode(sys.stdout.encoding)
294
+ if isinstance(result,str):result=result.encode(sys.stdout.encoding,errors=_A1).decode(sys.stdout.encoding)
294
295
  return result
295
296
  def get_date_string():return datetime.datetime.fromtimestamp(time.time(),datetime.timezone.utc).strftime('%Y-%m-%dT%H:%M:%S')
296
297
  def get_user_string():
@@ -341,9 +342,9 @@ def rest_api_call(function_name,arguments_dict,print_l=print_null):
341
342
  def rest_api_call_ping(print_l):print_l(rest_api_call('ping',{'date':get_date_string()},print_l=print_l));return 0
342
343
  class SBDL_Parser:
343
344
  class Statements:declaration='declaration';using='using';scope='scope';operator='operator';customtype=_CH
344
- class Types:aspect=_c;requirement=_Y;mode='fmea:mode';effect='fmea:effect';cause='fmea:cause';current_control='fmea:control';current_detection='fmea:detection';action_control='fmea:action-control';action_detection='fmea:action-detection';test='test';definition='definition';realisation='realisation';function=_Aa;event='event';state='state';transition='transition';usecase='usecase';interface=_A5;trace='trace';group='group'
345
+ class Types:aspect=_c;requirement=_Y;mode='fmea:mode';effect='fmea:effect';cause='fmea:cause';current_control='fmea:control';current_detection='fmea:detection';action_control='fmea:action-control';action_detection='fmea:action-detection';test='test';definition='definition';realisation='realisation';function=_Aa;event='event';state='state';transition='transition';usecase='usecase';interface=_A6;trace='trace';group='group'
345
346
  class Tokens:declaration='is';declaration_group_delimeters=['{','}'];declaration_attribute_assign=' {} '.format(declaration);declaration_attribute_delimeter='"';general_separator=';';raw_content_delimiters=['[[[',']]]'];declaration_attribute_separator=general_separator;statement_separator=general_separator;hashbang='#!sbdl';prefix='@sbdl\\s';prefix_block_start='@sbdl\\-begin';prefix_block_end='@sbdl\\-end';comment='#';using='using';scope='scope';customtype=_CH;line_continuation=_X;replacement_string_default='';replacement_map={_S:',',';':';'};declaration_token_rule='\\s+{}\\s+'.format(declaration);declaration_rule='^.+?{}\\S+\\s*{}.*?{}\\s*$'.format(declaration_token_rule,declaration_group_delimeters[0],declaration_group_delimeters[1]);using_rule=_CI.format(using,declaration_group_delimeters[0],declaration_group_delimeters[1]);scope_rule=_CI.format(scope,declaration_group_delimeters[0],declaration_group_delimeters[1]);customtype_rule='^\\s*{}\\s+{}'.format(customtype,declaration_rule.replace('^',''));macro_delimeters=[_d,']'];macro_variable='@';macro_defer='%';macro_rule='\\{}{}(?:[^\\]\\\\]|\\\\.)*\\{}'.format(macro_delimeters[0],macro_variable,macro_delimeters[1]);macro_index_separator=':';whitespace_list=list(string.whitespace);escape=_X;stereotype_separator='^';link_operator='||';source_link_operator='~|';operator_rule='\\s*({}|{})\\s*'.format(_X+_X.join(link_operator),_X+_X.join(source_link_operator));inherit='inherit';compose='compose';hash_separator='~';scope_prefix=_m;stdio_name='-'
346
- class Attributes:description=_P;detectability=_s;detectability_post=_A6;severity=_t;occurrence=_u;occurrence_post=_A7;separator=_S;parent='parent';child='child';related='related';pragma='pragma';remark='remark';reference=_CJ;identifier=_CK;type=_K;types=_Z;stereotype='stereotype';actor=_Ab;tag='tag';description_bsci='description_bsci';precondition='precondition';postcondition='postcondition';invariant='invariant';output='output';input='input';custom_prefix='custom:';condition='condition';condition_alternative='alternative';custom_required_attr='required_property';custom_optional_attr='optional_property';custom_link_types='relation_type';color='color';control_only='control_only';return_control='return_control';raw_content='raw_content';loop_name='loop';parallel_name='parallel';port_name='port'
347
+ class Attributes:description=_P;detectability=_s;detectability_post=_A7;severity=_t;occurrence=_u;occurrence_post=_A8;separator=_S;parent='parent';child='child';related='related';pragma='pragma';remark='remark';reference=_CJ;identifier=_CK;type=_K;types=_Z;stereotype='stereotype';actor=_Ab;tag='tag';description_bsci='description_bsci';precondition='precondition';postcondition='postcondition';invariant='invariant';output='output';input='input';custom_prefix='custom:';condition='condition';condition_alternative='alternative';custom_required_attr='required_property';custom_optional_attr='optional_property';custom_link_types='relation_type';color='color';control_only='control_only';return_control='return_control';raw_content='raw_content';loop_name='loop';parallel_name='parallel';port_name='port'
347
348
  class Macros:self_element='SELF';self_reference='SELF_ID';self_reference_attr='SELF_PROP';abort='ABORT';message='MESSAGE';msg='MSG';date='DATE';user='USER';add='ADD';sub='SUB';equal='EQUAL';concat='CONCAT';instli='INSTLI';showall='SHOW_ALL';rmcom='RMCOM';mkid='MKID';dfp='DFP';requiredsl='REQUIRE_DSL_VERSION';requirecompiler='REQUIRE_COMPILER_VERSION';requiredsl_exact='REQUIRE_DSL_VERSION_EXACT';path='PATH';file_name='FILE';directory='DIR';context='CONTEXT';curline='=LINE';preline='-LINE';sucline='+LINE';line='LINE';import_sbdl='IMPORT';import_directive='IMPORT_DIRECTIVE';load_config='LOAD_CONFIG';git_commit_hash='GIT_COMMIT_HASH';define='DEFINE';define_append='DEFINE_APPEND';define_from_func='DEFUNC';define_from_index='DEFIND';define_from_file='DEFINEF';define_from_file_hash='DEFINEFH';expand_define='EXPAND';parsed_elements='PARSED_ELEMENTS';generated_elements='GENERATED_ELEMENTS';synthetic_element='SYNTHETIC_ELEMENT';cross_reference_available='CROSS_REFS_AVAILABLE';extend_cause='EXTEND_CAUSE';cpp_class='CPPCLASS';py_class='PYCLASS';c_func='CFUNC';py_func='PYFUNC';prolog_startup='PL_START';prolog_assert='PL_ASSERT';prolog_assert_n='PL_ASSERT!';prolog_cmd='PL_COMMAND';prolog_trace_file='PL_TRACE_FILE';prolog_result_output='PL_RESULT_OUTPUT';id_from_prop='ID_FROM_PROP'
348
349
  class Parser_Element:
349
350
  def __init__(self,content,source,indexes,context=''):self.__content=content;self.__source=source;self.__index=indexes;self.__context=context
@@ -524,7 +525,7 @@ class SBDL_Parser:
524
525
  try:result=prolog_query(prolog_assert[1],print_method)
525
526
  except Exception as e:error_count+=1;print_method(E.format(prolog_assert[3],prolog_assert[4],prolog_assert[0],prolog_assert[1],str(e)),error=_A)
526
527
  if assert_positive and len(result)==0 or not assert_positive and len(result)>0:print_method("Prolog Assert Failure [{}:{}]: {}\n\t'{}'".format(prolog_assert[3],prolog_assert[4],prolog_assert[0],prolog_assert[1]),error=_A);error_count+=1
527
- print_method('PrologAssert::{}: {}'.format(prolog_assert[0],'PASS'if error_count==0 else'FAIL'),debug=not get_config_value(_A3,number=_A),error=get_config_value(_A3,number=_A))
528
+ print_method('PrologAssert::{}: {}'.format(prolog_assert[0],'PASS'if error_count==0 else'FAIL'),debug=not get_config_value(_A4,number=_A),error=get_config_value(_A4,number=_A))
528
529
  return error_count
529
530
  def execute_prolog_commands(_,print_method):
530
531
  global SBDL_PROLOG_COMMANDS;error_count=0
@@ -543,7 +544,7 @@ class SBDL_Parser:
543
544
  if len(inp)!=0:raise Exception('Prolog Startup does not accept arguments')
544
545
  try:from pyswip import Prolog;SBDL_PROLOG_ENV=Prolog()
545
546
  except Exception as _:raise self.MacroReplaceException('ERROR creating Prolog environment. Do you have pyswip and swi-prolog installed?',first_pass_can_ignore=_C)
546
- trace_file_path=get_config_value(_AM)
547
+ trace_file_path=get_config_value(_AN)
547
548
  if trace_file_path:SBDL_PROLOG_TRACE=open_output_file(trace_file_path,is_text=_A,append=_C)
548
549
  else:SBDL_PROLOG_TRACE=_B
549
550
  return result_val
@@ -563,10 +564,10 @@ class SBDL_Parser:
563
564
  if not A in globals()and get_config_value(_l,number=_A):f_print('Prolog command specified but Prolog environment not started!',error=_A);result_val=D
564
565
  if not C in globals():SBDL_PROLOG_COMMANDS=[]
565
566
  SBDL_PROLOG_COMMANDS.append([inp[0],_S.join(inp[1:]),macros[self.Macros.path],macros[self.Macros.line]]);return result_val
566
- def prolog_result_output(_,*__):set_config_value(_A3,_A);return''
567
+ def prolog_result_output(_,*__):set_config_value(_A4,_A);return''
567
568
  def prolog_trace_file(_,*inp):
568
569
  if len(inp)<1:raise self.MacroReplaceException('Prolog tracefile requires a file path argument',first_pass_can_ignore=_C)
569
- set_config_value(_AM,inp[0]);return''
570
+ set_config_value(_AN,inp[0]);return''
570
571
  def import_directive(macros,*inp):
571
572
  param_path=''.join(inp);import_path=os.path.join(macros[SBDL_Parser.Macros.path].replace(macros[SBDL_Parser.Macros.file_name],''),param_path)
572
573
  if get_config_value(_BV,number=_A):
@@ -666,8 +667,8 @@ class SBDL_Parser:
666
667
  if SBDL_Parser.Attributes.stereotype in macro_content:m_stereotype=macro_content[SBDL_Parser.Attributes.stereotype];resultant_content=f"{m_identifier}{SBDL_Parser.Tokens.stereotype_separator}{m_stereotype}"
667
668
  else:resultant_content=m_identifier
668
669
  return resultant_content
669
- if get_config_value(_A4,number=_A)and result!=_B and isinstance(result,str):
670
- if get_config_value(_AQ,number=_A):macro_definitions[SBDL_Parser.Macros.define]=define_directive;macro_definitions[SBDL_Parser.Macros.define_append]=define_directive_append;macro_definitions[SBDL_Parser.Macros.define_from_func]=define_directive_from_function;macro_definitions[SBDL_Parser.Macros.define_from_index]=define_directive_from_index;macro_definitions[SBDL_Parser.Macros.define_from_file]=define_directive_from_file;macro_definitions[SBDL_Parser.Macros.define_from_file_hash]=define_directive_from_file_hash
670
+ if get_config_value(_A5,number=_A)and result!=_B and isinstance(result,str):
671
+ if get_config_value(_AR,number=_A):macro_definitions[SBDL_Parser.Macros.define]=define_directive;macro_definitions[SBDL_Parser.Macros.define_append]=define_directive_append;macro_definitions[SBDL_Parser.Macros.define_from_func]=define_directive_from_function;macro_definitions[SBDL_Parser.Macros.define_from_index]=define_directive_from_index;macro_definitions[SBDL_Parser.Macros.define_from_file]=define_directive_from_file;macro_definitions[SBDL_Parser.Macros.define_from_file_hash]=define_directive_from_file_hash
671
672
  else:macro_definitions.pop(SBDL_Parser.Macros.define,_B);macro_definitions.pop(SBDL_Parser.Macros.define_append,_B);macro_definitions.pop(SBDL_Parser.Macros.define_from_func,_B);macro_definitions.pop(SBDL_Parser.Macros.define_from_index,_B);macro_definitions.pop(SBDL_Parser.Macros.define_from_file,_B);macro_definitions.pop(SBDL_Parser.Macros.define_from_file_hash,_B)
672
673
  matches=re.findall(self.Tokens.macro_rule,result)
673
674
  for amatch in matches:
@@ -1018,7 +1019,7 @@ class SBDL_Semantics:
1018
1019
  if right_to_left:text_words.reverse()
1019
1020
  text_words=[x.capitalize()if not x.isupper()else x for x in text_words];return SBDL_Parser.sanitize_identifier(separator.join(text_words))
1020
1021
  @classmethod
1021
- def get_identifier_from_string_eng_standard(self,input_string,aggressive_length=20,min_word_len=3,separator='',right_to_left=_A):stop_words={'the','and','of','to','in','a','on','for','with','at','by','an',_A8,'shall','should','must','will','can','may','might','could','be','have','use','perform','execute','define','configure','manage','then'};stop_chars={'a','e','i','o','u'};abbreviations={'acceleration':'accel','actuator':'act','aerodynamics':'aero','analysis':'anal','approximate':'approx','architecture':'arch','assembly':'assy','auxiliary':'aux','battery':'batt','calculation':'calc','center of gravity':'cg','center of mass':'cm','coefficient':'coeff','configuration':'config',_o:'ctrl','controller':'cntrlr','coordinate':'coord','correction':'corr','current':'curr','data acquisition':'daq','decibel':'db','degrees of freedom':'dof','design':'des','development':'dev','diameter':'dia','dimension':'dim','dynamic':'dyn','efficiency':'eff','electrical':'elec','electromagnetic':'em','error':'err','estimate':'est','evaluation':'eval','failure mode and effects analysis':_x,'fatigue':'fat','feature':'feat','feedback':'fb','frequency':'freq',_Aa:'func','gradient':'grad','hardware':'hw','heat transfer':'ht','high voltage':'hv',_CK:'id','identification':'id','implementation':'impl','input':'in','inspection':'insp','instrumentation':'instr','integration':'intg',_A5:'intf','iteration':'iter','load':'ld','logic':'log','maintenance':'maint','management':'mgmt','manufacturing':'mfg','material':'matl','maximum':'max','measurement':'meas','mechanism':'mech','minimum':'min','model':'mdl','momentum':'mom','nominal':'nom','operating system':'os','optimization':'opt','output':'out','parameter':'param','performance':'perf','physics':'phys','position':'pos','power':'pwr','pressure':'pres','process':'proc','proportional-integral-derivative':'pid','quality assurance':'qa','radiation':'rad','redundancy':'redund',_CJ:'ref','reliability':'rel',_Y:'req','resolution':'res','resistance':'resist','safety':'sfty','sensor':'sens','simulation':'sim','software':'sw','specification':'spec','stability':'stab','static':'stat','structure':'struc','subsystem':'subsys',_A8:'sys','temperature':'temp','tension':'tens','testing':'test','thermal':'therm','torque':'torq','transient':'trans','uncertainty':'uncert','validation':'val','verification':'verif','voltage':'volt','weight':'wt','target':'targ'};return self.get_identifier_from_string(re.sub('[^a-zA-Z0-9.:_ ]+|(?<=.)\\.$','',input_string),aggressive_length,min_word_len,separator,stop_words=stop_words,stop_chars=stop_chars,abbreviations=abbreviations,right_to_left=right_to_left)
1022
+ def get_identifier_from_string_eng_standard(self,input_string,aggressive_length=20,min_word_len=3,separator='',right_to_left=_A):stop_words={'the','and','of','to','in','a','on','for','with','at','by','an',_A9,'shall','should','must','will','can','may','might','could','be','have','use','perform','execute','define','configure','manage','then'};stop_chars={'a','e','i','o','u'};abbreviations={'acceleration':'accel','actuator':'act','aerodynamics':'aero','analysis':'anal','approximate':'approx','architecture':'arch','assembly':'assy','auxiliary':'aux','battery':'batt','calculation':'calc','center of gravity':'cg','center of mass':'cm','coefficient':'coeff','configuration':'config',_o:'ctrl','controller':'cntrlr','coordinate':'coord','correction':'corr','current':'curr','data acquisition':'daq','decibel':'db','degrees of freedom':'dof','design':'des','development':'dev','diameter':'dia','dimension':'dim','dynamic':'dyn','efficiency':'eff','electrical':'elec','electromagnetic':'em','error':'err','estimate':'est','evaluation':'eval','failure mode and effects analysis':_x,'fatigue':'fat','feature':'feat','feedback':'fb','frequency':'freq',_Aa:'func','gradient':'grad','hardware':'hw','heat transfer':'ht','high voltage':'hv',_CK:'id','identification':'id','implementation':'impl','input':'in','inspection':'insp','instrumentation':'instr','integration':'intg',_A6:'intf','iteration':'iter','load':'ld','logic':'log','maintenance':'maint','management':'mgmt','manufacturing':'mfg','material':'matl','maximum':'max','measurement':'meas','mechanism':'mech','minimum':'min','model':'mdl','momentum':'mom','nominal':'nom','operating system':'os','optimization':'opt','output':'out','parameter':'param','performance':'perf','physics':'phys','position':'pos','power':'pwr','pressure':'pres','process':'proc','proportional-integral-derivative':'pid','quality assurance':'qa','radiation':'rad','redundancy':'redund',_CJ:'ref','reliability':'rel',_Y:'req','resolution':'res','resistance':'resist','safety':'sfty','sensor':'sens','simulation':'sim','software':'sw','specification':'spec','stability':'stab','static':'stat','structure':'struc','subsystem':'subsys',_A9:'sys','temperature':'temp','tension':'tens','testing':'test','thermal':'therm','torque':'torq','transient':'trans','uncertainty':'uncert','validation':'val','verification':'verif','voltage':'volt','weight':'wt','target':'targ'};return self.get_identifier_from_string(re.sub('[^a-zA-Z0-9.:_ ]+|(?<=.)\\.$','',input_string),aggressive_length,min_word_len,separator,stop_words=stop_words,stop_chars=stop_chars,abbreviations=abbreviations,right_to_left=right_to_left)
1022
1023
  @classmethod
1023
1024
  def shorten_string_on_word_boundary(self,input_string,shorten_length):return _I.join(input_string.split()[-len(input_string[-shorten_length:].split()):])
1024
1025
  @classmethod
@@ -1644,9 +1645,9 @@ class SBDL_AST:
1644
1645
  if pending_op!=_B:self.__parser_error(print_l,parsed_object.parser_element().reference(),'Dangling operator: missing operand?',pending_op.parser_element().content());error_count+=1
1645
1646
  if prune_missing_references:
1646
1647
  for element_id in sbdl_elements:sbdl_elements[element_id].prune_missing_references(sbdl_elements)
1647
- if get_config_value(_A4,number=_A):
1648
+ if get_config_value(_A5,number=_A):
1648
1649
  crossref_dict,crossref_errors=self.get_full_ast_as_dict(sbdl_elements);crossref_dict.update(SBDL_Parser.builtin_directive_dict())
1649
- if get_config_value(_AQ,number=_A)and get_config_value(_AR,number=_A):crossref_dict.update(get_config_value(_T))
1650
+ if get_config_value(_AR,number=_A)and get_config_value(_AS,number=_A):crossref_dict.update(get_config_value(_T))
1650
1651
  error_count+=crossref_errors;crossref_dict[SBDL_Parser.Macros.cross_reference_available]=_A;crossref_dict[SBDL_Parser.Macros.generated_elements]={};crossref_dict[SBDL_Parser.Macros.parsed_elements]=sbdl_elements;crossref_dict[SBDL_Parser.Macros.synthetic_element]=SBDL_Element_Synthetic
1651
1652
  for element_id in sbdl_elements:
1652
1653
  try:sbdl_elements[element_id].replace_directives_from_dict(crossref_dict,_A,print_l)
@@ -1878,14 +1879,14 @@ def msword_input_handler(file_reference):
1878
1879
  return result,handler
1879
1880
  def msexcel_input_handler(file_reference):
1880
1881
  result=_C;handler=_B;_,extension=os.path.splitext(file_reference)
1881
- if extension=='.xls'or extension=='.xlsx'or extension=='.ods':
1882
+ if extension=='.xls'or extension=='.xlsx':
1882
1883
  try:
1883
- import pandas;pdframe=pandas.read_excel(file_reference);content=[]
1884
- for col in pdframe:
1885
- content.append(str(col))
1886
- for cell in pdframe[col]:content.append(ms_character_fix(str(cell)))
1884
+ import openpyxl;wb=openpyxl.load_workbook(file_reference,data_only=_A);ws=wb.active;content=[]
1885
+ for col_cells in ws.iter_cols():
1886
+ header=col_cells[0].value;content.append(str(header))
1887
+ for cell in col_cells[1:]:content.append(ms_character_fix(str(cell.value)))
1887
1888
  handler=list_file_object(content);result=_A
1888
- except Exception as e:f_print('Trying to parse what looks like an MS Excel file but pandas package cannot be imported correctly:\n {}'.format(str(e)),do_warning=_A,warning=_A)
1889
+ except Exception as e:f_print('Trying to parse what looks like an MS Excel file but openpyxl package cannot be imported correctly:\n {}'.format(str(e)),do_warning=_A,warning=_A)
1889
1890
  return result,handler
1890
1891
  def make_remote_file_local(file_reference):
1891
1892
  local_file_reference=file_reference;parsed_file_reference=urllib.parse.urlparse(local_file_reference);error_string=_B
@@ -1931,14 +1932,14 @@ def context_directive_sniffer(context_lines,file_path,file_line,_,all_entries_re
1931
1932
  return result
1932
1933
  def get_parser_elements_from_filepath(filepath,elements_list,print_l=print_null,file_opener=open_input_file,read_input_set=_B):
1933
1934
  if read_input_set==_B:read_input_set={}
1934
- errors=0;line_count=0;line_buffer='';line_buffer_markers=[];add_to_config_value(_AL,{filepath:_A})
1935
+ errors=0;line_count=0;line_buffer='';line_buffer_markers=[];add_to_config_value(_AM,{filepath:_A})
1935
1936
  def handle_error(content,excep=''):nonlocal errors;print_l('{}:{}:: General reading error: {}\n {}'.format(filepath,line_count,str(excep),content.strip()),error=_A);errors+=1
1936
1937
  prev_non_sbdl_non_empty_lines=[''];next_non_sbdl_non_empty_lines=[''];non_sbdl_line_prefix=''
1937
1938
  def push_context(con):
1938
1939
  if len(prev_non_sbdl_non_empty_lines)>3:prev_non_sbdl_non_empty_lines.pop(0)
1939
1940
  prev_non_sbdl_non_empty_lines.append(con)
1940
1941
  local_directives={}
1941
- if get_config_value(_AR,number=_A):local_directives=get_config_value(_T)
1942
+ if get_config_value(_AS,number=_A):local_directives=get_config_value(_T)
1942
1943
  local_directives.update(SBDL_Parser.builtin_directive_dict())
1943
1944
  def update_per_file_directives(explicit_updates=_B):
1944
1945
  updates=explicit_updates
@@ -2109,13 +2110,13 @@ def aggregate_all_parser_elements_from_csv(input_list,do_recurse,do_hidden,print
2109
2110
  return aggregate_all_parser_elements_from_struct_func(input_list,do_recurse,do_hidden,print_l,file_opener,csv_nodes_extractor)
2110
2111
  def plantuml_writer(file_opener,output_file,content,_):
2111
2112
  content_to_output=content
2112
- if not get_config_value(_AN,number=_A):
2113
+ if not get_config_value(_AO,number=_A):
2113
2114
  try:
2114
2115
  plantuml_env=os.environ.copy();plantuml_env.pop('LD_LIBRARY_PATH',_B);plantuml_env['PLANTUML_LIMIT_SIZE']=str(get_config_value(_BQ));plantuml_command=get_config_value(_BP)
2115
2116
  if isinstance(plantuml_command,str):plantuml_command=shlex.split(plantuml_command)
2116
2117
  plantuml_command_full=plantuml_command+['-t',get_config_value(_BR),'-p'];debug_out('EXECUTE_PLANTUML: '+str(plantuml_command_full));exec_result=subprocess.run(plantuml_command_full,input=content.encode(),stdout=subprocess.PIPE,stderr=subprocess.STDOUT,env=plantuml_env,check=_C);content_to_output=exec_result.stdout
2117
2118
  except:raise Exception('Error while executing PlantUML')
2118
- with file_opener(output_file,is_text=get_config_value(_AN,number=_A))as plantuml_file:plantuml_file.write(content_to_output)
2119
+ with file_opener(output_file,is_text=get_config_value(_AO,number=_A))as plantuml_file:plantuml_file.write(content_to_output)
2119
2120
  def plantuml_footer_generator():
2120
2121
  footer_content=''
2121
2122
  if get_config_value(_BS,number=_A):footer_content+='footer \\nGenerated by {generator} on {date}\\n\\n\n'.format(generator='{} version {}'.format(__NAME,__VERSION),date=get_date_string())
@@ -2163,8 +2164,8 @@ def write_decomposition_graph_output(sbdl_ast,output_file,file_opener,arguments,
2163
2164
  def plantuml_decomposition_diagram():
2164
2165
  header=plantuml_footer_generator();title=_y.format(arguments.title)if arguments.title!=''else'';plant_uml_prepost=_z;content='';notes='';note_count=0;interface_count=0;relations='';descriptions=get_config_value(_Bl,number=_A);interface_mem={};handled_elems=[];indentation_prefix=_M
2165
2166
  def puml_id(elem_id):return plantuml_identifier(elem_id)
2166
- def note_rel_pos(posindex):positions={0:'top',1:'bottom',2:_A9,3:_AA};return positions[posindex%4]
2167
- def interface_rel_pos(posindex):positions={0:'up',1:'down',2:_A9,3:_AA};return positions[posindex%4]if get_config_value(_AO,number=_A)else''
2167
+ def note_rel_pos(posindex):positions={0:'top',1:'bottom',2:_AA,3:_AB};return positions[posindex%4]
2168
+ def interface_rel_pos(posindex):positions={0:'up',1:'down',2:_AA,3:_AB};return positions[posindex%4]if get_config_value(_AP,number=_A)else''
2168
2169
  def handle_elem(elem_id,pref='',parent_id=_B):
2169
2170
  nonlocal content,relations,notes,note_count,interface_mem,interface_count
2170
2171
  def add_interface_line(interface,type_name,pref_l=''):
@@ -2175,7 +2176,7 @@ def write_decomposition_graph_output(sbdl_ast,output_file,file_opener,arguments,
2175
2176
  for interface in interfaces:
2176
2177
  interface_elem=elements[interface.identifier()]
2177
2178
  if interface_elem.stereotype()==SBDL_Parser.Attributes.port_name:ports.append(interface)
2178
- else:add_interface_line(interface,_A5);stereotype=interface.stereotype();relations+='[{}] -{}- {}{}\n'.format(puml_id(elem_id),interface_rel_pos(interface_count),puml_id(interface.identifier()),''if not stereotype else': '+stereotype);interface_count+=1
2179
+ else:add_interface_line(interface,_A6);stereotype=interface.stereotype();relations+='[{}] -{}- {}{}\n'.format(puml_id(elem_id),interface_rel_pos(interface_count),puml_id(interface.identifier()),''if not stereotype else': '+stereotype);interface_count+=1
2179
2180
  aspect_stereotype=elements[elem_id].stereotype()
2180
2181
  if not aspect_stereotype:aspect_stereotype=elements[elem_id].type()
2181
2182
  else:aspect_stereotype=elements[elem_id].type()+_m+aspect_stereotype
@@ -2198,14 +2199,14 @@ def write_decomposition_graph_output(sbdl_ast,output_file,file_opener,arguments,
2198
2199
  for elem in elements_ordered:handle_elem(elem)
2199
2200
  for interface_id in interface_mem:
2200
2201
  for int_link in interface_mem[interface_id]:relations+='{} .{}. {}\n'.format(puml_id(interface_id),interface_rel_pos(interface_count),puml_id(int_link.identifier()));interface_count+=1
2201
- return plant_uml_prepost.format(style=(_CR if get_config_value(_AP,number=_A)else'')+get_config_value(_W)+get_config_value(_AT),header=header+title,content=content+_D+relations+_D+(_D+notes if descriptions or arguments.source else''))
2202
+ return plant_uml_prepost.format(style=(_CR if get_config_value(_AQ,number=_A)else'')+get_config_value(_W)+get_config_value(_AU),header=header+title,content=content+_D+relations+_D+(_D+notes if descriptions or arguments.source else''))
2202
2203
  plantuml_writer(file_opener,output_file,plantuml_decomposition_diagram(),print_l);return errors
2203
2204
  def write_element_graph_output(sbdl_ast,output_file,file_opener,arguments,print_l):
2204
2205
  elements,errors=sbdl_ast.elements(print_l,prune_missing_references=_A)
2205
2206
  def plantuml_decomposition_diagram():
2206
2207
  header=plantuml_footer_generator();title=_y.format(arguments.title)if arguments.title!=''else'';plant_uml_prepost=_z;content='';relations='';interface_mem={};handled_elems=[]
2207
- def puml_id(elem_id):return plantuml_identifier(elem_id).replace('(','').replace(')','').replace('[]','').replace(']','').replace(':',_U).encode(_Ad,_AZ).decode(_Ad)
2208
- def interface_rel_pos(posindex):positions={0:'up',1:'down',2:_A9,3:_AA};return positions[posindex%4]if get_config_value(_AO,number=_A)else''
2208
+ def puml_id(elem_id):return plantuml_identifier(elem_id).replace('(','').replace(')','').replace('[]','').replace(']','').replace(':',_U).encode(_Ad,_A1).decode(_Ad)
2209
+ def interface_rel_pos(posindex):positions={0:'up',1:'down',2:_AA,3:_AB};return positions[posindex%4]if get_config_value(_AP,number=_A)else''
2209
2210
  def detailed_content(elem_id):
2210
2211
  props=[];links={};result='\t{}: **{}**\n'.format(SBDL_Parser.Attributes.type,elements[elem_id].type());elem=elements[elem_id]
2211
2212
  for prop in elem.properties():props.append('\t{}:\n\t {}'.format(prop,textwrap.shorten(elem.get_property(prop),width=get_config_value(_Bp,number=_A),placeholder='...')))
@@ -2224,7 +2225,7 @@ def write_element_graph_output(sbdl_ast,output_file,file_opener,arguments,print_
2224
2225
  if not elem_id in handled_elems:
2225
2226
  handled_elems.append(elem_id);interfaces=[link for link in SBDL_AST.get_all_links_for_element(elements[elem_id],elements)if link.is_a(SBDL_Parser.Types.interface)]
2226
2227
  for interface in interfaces:
2227
- if not interface.identifier()in interface_mem:interface_mem[interface.identifier()]=_A;content+='\n{}{} "**{}**\\n{}" as {}'.format(pref,_A5,interface.identifier(),'',puml_id(interface.identifier()))
2228
+ if not interface.identifier()in interface_mem:interface_mem[interface.identifier()]=_A;content+='\n{}{} "**{}**\\n{}" as {}'.format(pref,_A6,interface.identifier(),'',puml_id(interface.identifier()))
2228
2229
  relations+='{} -{}- {}\n'.format(puml_id(elem_id),interface_rel_pos(interface_count),puml_id(interface.identifier()));interface_count+=1
2229
2230
  aspect_stereotype=elements[elem_id].stereotype()
2230
2231
  if not aspect_stereotype:aspect_stereotype=elements[elem_id].type()
@@ -2239,7 +2240,7 @@ def write_element_graph_output(sbdl_ast,output_file,file_opener,arguments,print_
2239
2240
  else:0
2240
2241
  elements_ordered=list(elements.keys())
2241
2242
  for elem in elements_ordered:handle_elem(elem)
2242
- return plant_uml_prepost.format(style=(_CR if get_config_value(_AP,number=_A)else'')+get_config_value(_W)+get_config_value(_AT),header=header+title,content=content+_D+relations+_D+(_D+''))
2243
+ return plant_uml_prepost.format(style=(_CR if get_config_value(_AQ,number=_A)else'')+get_config_value(_W)+get_config_value(_AU),header=header+title,content=content+_D+relations+_D+(_D+''))
2243
2244
  plantuml_writer(file_opener,output_file,plantuml_decomposition_diagram(),print_l);return errors
2244
2245
  def write_function_graph_output(sbdl_ast,output_file,file_opener,arguments,print_l):
2245
2246
  elements,errors=sbdl_ast.elements(print_l,prune_missing_references=_A);show_descriptions=get_config_value(_Bm,number=_A);event_count=0;entities={}
@@ -2297,7 +2298,7 @@ def write_function_graph_output(sbdl_ast,output_file,file_opener,arguments,print
2297
2298
  top_level_elems=SBDL_AST.get_top_level_element_set(elements)
2298
2299
  for func in[elements[x].identifier()for x in top_level_elems if elements[x].is_a(SBDL_Function)]:handle_func(func)
2299
2300
  if event_count>0:content='autonumber "[000]"\n'+content
2300
- return plant_uml_prepost.format(style=get_config_value(_W)+get_config_value(_AU),header=header+title,content=content)
2301
+ return plant_uml_prepost.format(style=get_config_value(_W)+get_config_value(_AV),header=header+title,content=content)
2301
2302
  plantuml_writer(file_opener,output_file,plantuml_function_diagram(),print_l);return errors
2302
2303
  def write_process_graph_output(sbdl_ast,output_file,file_opener,_,print_l):
2303
2304
  errors=0;elements,errors=sbdl_ast.elements(print_l,prune_missing_references=_A);show_descriptions=get_config_value(_Bo,number=_A);first_event=_A;g_process_elem=_B;note_stagger=_C
@@ -2310,7 +2311,7 @@ def write_process_graph_output(sbdl_ast,output_file,file_opener,_,print_l):
2310
2311
  if SBDL_Parser.Attributes.condition in event_elem.properties():condition=event_elem.get_property(SBDL_Parser.Attributes.condition)
2311
2312
  def emit_note():
2312
2313
  nonlocal event_cont,note_stagger
2313
- if show_descriptions and event_elem.description():event_cont+=f"{indent_str}note {_A9 if note_stagger else _AA}\n{indent_str}{event_elem.description()}\n{indent_str}end note\n";note_stagger=not note_stagger
2314
+ if show_descriptions and event_elem.description():event_cont+=f"{indent_str}note "+(_AA if note_stagger else _AB)+'\n{indent_str}{event_elem.description()}\n{indent_str}end note\n';note_stagger=not note_stagger
2314
2315
  if ev_aspect!=current_aspect and get_config_value(_q,number=_A):
2315
2316
  event_cont+=f"{indent_str}"
2316
2317
  if ev_aspect in elements:
@@ -2320,12 +2321,12 @@ def write_process_graph_output(sbdl_ast,output_file,file_opener,_,print_l):
2320
2321
  if first_event:
2321
2322
  event_cont+=f"{indent_str}start\n";first_event=_C
2322
2323
  if get_config_value(_q,number=_A):event_cont+=f"{indent_str}{elem_colour_prefix(g_process_elem)}:{g_process_elem.identifier()}; <<procedure>>\n";emit_note()
2323
- if is_loop:event_cont+=f"{indent_str}repeat{_D if control_only else""}"
2324
- if not control_only:event_cont+=f"{indent_str}{elem_colour_prefix(event_elem)if not is_loop else""}:{event_elem.identifier()}; <<task>>\n";emit_note()
2324
+ if is_loop:suffix=_D if control_only else'';event_cont+=f"{indent_str}repeat{suffix}"
2325
+ if not control_only:prefix=elem_colour_prefix(event_elem)if not is_loop else'';event_cont+=f"{indent_str}{prefix}:{event_elem.identifier()}; <<task>>\n";emit_note()
2325
2326
  if ev_links and condition and not is_loop:event_cont+=f"{indent_str}if ({condition}) then (condition met)\n"
2326
2327
  child_count=0
2327
2328
  for event_id in ev_links:
2328
- if is_parallel:event_cont+=f"{indent_str}fork{" again"if child_count else""}\n"
2329
+ if is_parallel:suffix=' again'if child_count else'';event_cont+=f"{indent_str}fork{suffix}\n"
2329
2330
  event_cont+=recurse_event_contents(elements[event_id],ev_aspect,indent=indent+2);child_count+=1
2330
2331
  if is_parallel:event_cont+=f"{indent_str}endfork\n"
2331
2332
  if ev_links and SBDL_Parser.Attributes.condition_alternative in event_elem.properties():
@@ -2337,7 +2338,7 @@ def write_process_graph_output(sbdl_ast,output_file,file_opener,_,print_l):
2337
2338
  def handle_process_element(process_elem):
2338
2339
  nonlocal g_process_elem,first_event;first_event=_A;g_process_elem=process_elem;process_cont=''
2339
2340
  if not get_config_value(_q,number=_A):
2340
- process_cont+=f'group {elem_colour_prefix(process_elem)}"**{f"{process_elem.type()}::{process_elem.stereotype()}"if process_elem.stereotype()else process_elem.type()}** {process_elem.identifier()}" {{\n';description=process_elem.description()
2341
+ process_cont+=f'group {elem_colour_prefix(process_elem)}"**'+(f"{process_elem.type()}::{process_elem.stereotype()}"if process_elem.stereotype()else process_elem.type())+'** {process_elem.identifier()}" {{\n';description=process_elem.description()
2341
2342
  if show_descriptions and description:process_cont+=f"note\n{description}\nend note\n"
2342
2343
  process_links=SBDL_AST.get_all_links_for_element(process_elem,elements)
2343
2344
  for event_id in[x.identifier()for x in process_links if x.is_a(SBDL_Event)and x.identifier()in elements]:process_cont+=recurse_event_contents(elements[event_id])
@@ -2345,7 +2346,7 @@ def write_process_graph_output(sbdl_ast,output_file,file_opener,_,print_l):
2345
2346
  if not get_config_value(_q,number=_A):process_cont+='}\n'
2346
2347
  return process_cont
2347
2348
  def plantuml_process_diagram():
2348
- process_dia_cont='';process_dia_cont+='@startuml\n';process_dia_cont+=get_config_value(_W)+get_config_value(_AU)+_f
2349
+ process_dia_cont='';process_dia_cont+='@startuml\n';process_dia_cont+=get_config_value(_W)+get_config_value(_AV)+_f
2349
2350
  for process_elem in[elements[f]for f in elements if elements[f].is_a(SBDL_Function)]:process_dia_cont+=handle_process_element(process_elem)
2350
2351
  process_dia_cont+='\n@enduml\n';return process_dia_cont
2351
2352
  plantuml_writer(file_opener,output_file,plantuml_process_diagram(),print_l);return errors
@@ -2382,7 +2383,7 @@ def write_usecase_graph_output(sbdl_ast,output_file,file_opener,arguments,print_
2382
2383
  relations=''
2383
2384
  for aspect in aspects:
2384
2385
  content+='\nframe "{}" {{\n'.format(puml_id(aspect))
2385
- for usecase_tuple in aspects[aspect]:content+=' usecase "{}" as {}\n'.format('**{}**\\n{}{}'.format(usecase_tuple[3],_H.join(textwrap.wrap(usecase_tuple[4],get_config_value(_b,number=_A))),_H+usecase_tuple[6]if arguments.source else'')if get_config_value(_AV,number=_A)else usecase_tuple[3],puml_id(usecase_tuple[3]));relations+='\n{} --> {}: {}{}\n'.format(puml_id(usecase_tuple[0]),puml_id(usecase_tuple[3]),'**{}**\\n{}'.format(usecase_tuple[1],_H.join(textwrap.wrap(usecase_tuple[2],get_config_value(_b,number=_A))))if get_config_value(_AV,number=_A)else usecase_tuple[1],_H+usecase_tuple[5]if arguments.source else'')
2386
+ for usecase_tuple in aspects[aspect]:content+=' usecase "{}" as {}\n'.format('**{}**\\n{}{}'.format(usecase_tuple[3],_H.join(textwrap.wrap(usecase_tuple[4],get_config_value(_b,number=_A))),_H+usecase_tuple[6]if arguments.source else'')if get_config_value(_AW,number=_A)else usecase_tuple[3],puml_id(usecase_tuple[3]));relations+='\n{} --> {}: {}{}\n'.format(puml_id(usecase_tuple[0]),puml_id(usecase_tuple[3]),'**{}**\\n{}'.format(usecase_tuple[1],_H.join(textwrap.wrap(usecase_tuple[2],get_config_value(_b,number=_A))))if get_config_value(_AW,number=_A)else usecase_tuple[1],_H+usecase_tuple[5]if arguments.source else'')
2386
2387
  content+='}\n'
2387
2388
  content+=relations;return plant_uml_prepost.format(style=get_config_value(_W)+get_config_value(_Bs),header=header+title,content=content)
2388
2389
  plantuml_writer(file_opener,output_file,plantuml_usecase_diagram(),print_l);return errors
@@ -2409,15 +2410,15 @@ def write_network_graph_output(sbdl_ast,output_file,_,arguments,print_l):
2409
2410
  colour_list=[]
2410
2411
  for node in sbdl_graph:colour_list.append(SBDL_Semantics.type_color(elements[elem_id_f(node)].type()))
2411
2412
  def mpl(graphin):return nx.multipartite_layout(graphin,subset_key='elem_type')
2412
- def dot(graphin):return nx.nx_agraph.graphviz_layout(graphin,prog='dot',args='-Goverlap=false -Goverlap_scaling=1000000 -Gscale={} -Gsep=20 -Gdefaultdist=100000'.format(get_config_value(_AS,number=_A)))
2413
+ def dot(graphin):return nx.nx_agraph.graphviz_layout(graphin,prog='dot',args='-Goverlap=false -Goverlap_scaling=1000000 -Gscale={} -Gsep=20 -Gdefaultdist=100000'.format(get_config_value(_AT,number=_A)))
2413
2414
  def spring(graphin):return nx.spring_layout(graphin,k=1)
2414
- layouts={_CE:mpl,'graphviz':dot,'spring':spring,'spiral':nx.spiral_layout,'random':nx.random_layout,'planar':nx.planar_layout};options={'font_size':10,'node_size':get_config_value(_AS,number=_A),'edgecolors':'gray','edge_color':'darkgray','linewidths':1,'with_labels':get_config_value(_Ba,number=_A),'width':2,'node_color':colour_list,'node_shape':'s','pos':layouts[get_config_value(_Bb,number=_C)](sbdl_graph)};plt.figure(figsize=(get_config_value(_BX,number=_A),get_config_value(_BY,number=_A)));nx.draw_networkx(sbdl_graph,**options,alpha=1.);ax=plt.gca();ax.margins(.0);plt.axis('off');plt.tight_layout();plt.plot();plt.savefig(output_file,dpi=get_config_value(_Bc,number=_A));return errors
2415
+ layouts={_CE:mpl,'graphviz':dot,'spring':spring,'spiral':nx.spiral_layout,'random':nx.random_layout,'planar':nx.planar_layout};options={'font_size':10,'node_size':get_config_value(_AT,number=_A),'edgecolors':'gray','edge_color':'darkgray','linewidths':1,'with_labels':get_config_value(_Ba,number=_A),'width':2,'node_color':colour_list,'node_shape':'s','pos':layouts[get_config_value(_Bb,number=_C)](sbdl_graph)};plt.figure(figsize=(get_config_value(_BX,number=_A),get_config_value(_BY,number=_A)));nx.draw_networkx(sbdl_graph,**options,alpha=1.);ax=plt.gca();ax.margins(.0);plt.axis('off');plt.tight_layout();plt.plot();plt.savefig(output_file,dpi=get_config_value(_Bc,number=_A));return errors
2415
2416
  class OpenFMEA:
2416
2417
  @classmethod
2417
2418
  def generate_sbdl_table_from_ast(self,sbdl_ast,id_in_body=_C,source_in_body=_C,print_l=print_null,multi_field_separator=_B):
2418
2419
  A='key';complex_aspect=get_config_value(_C9,number=_A)
2419
- if multi_field_separator is _B:multi_field_separator=get_config_value(_AW)
2420
- id_counter=0;sbdl_row={A:_B,_c:_B,_Y:_B,_L:_B,_a:_B,_R:_B,_o:_B,_g:_B,_t:_B,_u:_B,_A7:_B,_s:_B,_A6:_B,_A0:_B,_h:_B}
2420
+ if multi_field_separator is _B:multi_field_separator=get_config_value(_AX)
2421
+ id_counter=0;sbdl_row={A:_B,_c:_B,_Y:_B,_L:_B,_a:_B,_R:_B,_o:_B,_g:_B,_t:_B,_u:_B,_A8:_B,_s:_B,_A7:_B,_A0:_B,_h:_B}
2421
2422
  def is_row_empty(row):
2422
2423
  for column in row:
2423
2424
  if row[column]!=_B:return _C
@@ -2487,13 +2488,13 @@ class OpenFMEA:
2487
2488
  print_l('ADD',element.identifier(),debug=_A)
2488
2489
  if not is_fully_meta()and(get_config_value(_C4,number=_A)or not is_partly_meta()):add_row()
2489
2490
  elif element.is_a(SBDL_Failure_Cause):
2490
- events=get_compounded_linked_events();assign_column(_R,_I+events if len(events)>0 else'');assign_column_value(_u,element.rating());assign_column_value(_A7,element.rating(post=_A))
2491
+ events=get_compounded_linked_events();assign_column(_R,_I+events if len(events)>0 else'');assign_column_value(_u,element.rating());assign_column_value(_A8,element.rating(post=_A))
2491
2492
  if not element.is_meta():
2492
2493
  if complex_aspect:recurse_links(SBDL_Aspect,append=_A)
2493
2494
  recurse_links(SBDL_Failure_Current_Control,append=_A);recurse_links(SBDL_Failure_Current_Detection,append=_A);recurse_links(SBDL_Test_Definition,append=_A);recurse_links(SBDL_Failure_Action_Control,append=_A);recurse_links(SBDL_Failure_Action_Detection,append=_A)
2494
2495
  recurse_links(SBDL_Failure_Mode)
2495
2496
  elif element.is_a(SBDL_Failure_Mode):
2496
- assign_column(_L);assign_column_value(_s,element.rating());assign_column_value(_A6,element.rating(post=_A))
2497
+ assign_column(_L);assign_column_value(_s,element.rating());assign_column_value(_A7,element.rating(post=_A))
2497
2498
  if not element.is_meta():
2498
2499
  if complex_aspect:recurse_links(SBDL_Aspect,append=_A)
2499
2500
  recurse_links(SBDL_Requirement,append=_A);recurse_links(SBDL_Failure_Current_Control,append=_A);recurse_links(SBDL_Failure_Current_Detection,append=_A);recurse_links(SBDL_Test_Definition,append=_A);recurse_links(SBDL_Failure_Action_Control,append=_A);recurse_links(SBDL_Failure_Action_Detection,append=_A)
@@ -2535,9 +2536,9 @@ class OpenFMEA:
2535
2536
  resultant_entries=generate_table(start_node)+get_orphans(elements);apply_smart_keys(resultant_entries);check_row_keys(resultant_entries);return resultant_entries,errors
2536
2537
  @classmethod
2537
2538
  def struct_from_table(self,title,sbdl_table,open_fmea_type=_Q):
2538
- result_struct={_Al:_AB,'version':'1.0',_K:open_fmea_type,_i:{'title':title,'application':name(),'application_version':version(),'cmd_line':str(sys.argv),'date':get_date_string()},_x:sbdl_table,'layout':{}};result_struct[_i]['user']=get_user_string()
2539
- try:result_struct[_i][_A8]=platform.uname()
2540
- except Exception as _:result_struct[_i][_A8]='UNKNOWN'
2539
+ result_struct={_Al:_AC,'version':'1.0',_K:open_fmea_type,_i:{'title':title,'application':name(),'application_version':version(),'cmd_line':str(sys.argv),'date':get_date_string()},_x:sbdl_table,'layout':{}};result_struct[_i]['user']=get_user_string()
2540
+ try:result_struct[_i][_A9]=platform.uname()
2541
+ except Exception as _:result_struct[_i][_A9]='UNKNOWN'
2541
2542
  return result_struct
2542
2543
  @classmethod
2543
2544
  def read_file(self,file_path):
@@ -2550,7 +2551,7 @@ class OpenFMEA:
2550
2551
  def read_struct_from_file(self,open_sbdl_file):
2551
2552
  try:open_sbdl_content=json.load(open_sbdl_file)
2552
2553
  except json.JSONDecodeError as e:raise Exception(f"Not an OpenFMEA file (invalid JSON?): {str(e)}")from e
2553
- if not(_Al in open_sbdl_content and open_sbdl_content[_Al]==_AB):raise Exception('Not an OpenFMEA file')
2554
+ if not(_Al in open_sbdl_content and open_sbdl_content[_Al]==_AC):raise Exception('Not an OpenFMEA file')
2554
2555
  if not(_K in open_sbdl_content and open_sbdl_content[_K]in[_Q,'Analyzer']):raise Exception('Not an FMEA file')
2555
2556
  return open_sbdl_content
2556
2557
  @classmethod
@@ -2615,7 +2616,7 @@ class OpenFMEA:
2615
2616
  def sbdl_elements_from_table(self,sbdl_table,_):return self.elements_from_table(sbdl_table,_)
2616
2617
  @classmethod
2617
2618
  def elements_from_table(self,sbdl_table,_):
2618
- multi_field_separator=get_config_value(_AW);elems_to_consider={_c:SBDL_Parser.Types.aspect,_Y:SBDL_Parser.Types.requirement,_L:SBDL_Parser.Types.mode,_a:SBDL_Parser.Types.effect,_R:SBDL_Parser.Types.cause,_o:SBDL_Parser.Types.current_control,_g:SBDL_Parser.Types.current_detection,_A0:SBDL_Parser.Types.action_control,_h:SBDL_Parser.Types.action_detection};elem_rating={_a:_t,_R:_u,_L:_s};elem_rating_post={_R:_A7,_L:_A6};elem_link={_R:[_L,_o,_A0,_g,_h],_L:[_c,_a,_g,_Y,_h,_R],_Y:[_c,_L],_a:[_L],_o:[_R],_g:[_L],_A0:[_R],_h:[_L]};elem_present_every_row={_g,_h};replace_str=SBDL_Parser.Tokens.replacement_string_default;elements={};id_lookup={}
2619
+ multi_field_separator=get_config_value(_AX);elems_to_consider={_c:SBDL_Parser.Types.aspect,_Y:SBDL_Parser.Types.requirement,_L:SBDL_Parser.Types.mode,_a:SBDL_Parser.Types.effect,_R:SBDL_Parser.Types.cause,_o:SBDL_Parser.Types.current_control,_g:SBDL_Parser.Types.current_detection,_A0:SBDL_Parser.Types.action_control,_h:SBDL_Parser.Types.action_detection};elem_rating={_a:_t,_R:_u,_L:_s};elem_rating_post={_R:_A8,_L:_A7};elem_link={_R:[_L,_o,_A0,_g,_h],_L:[_c,_a,_g,_Y,_h,_R],_Y:[_c,_L],_a:[_L],_o:[_R],_g:[_L],_A0:[_R],_h:[_L]};elem_present_every_row={_g,_h};replace_str=SBDL_Parser.Tokens.replacement_string_default;elements={};id_lookup={}
2619
2620
  if not get_config_value(_C8,number=_A):elem_link[_L].remove(_R);elem_link[_a].remove(_L)
2620
2621
  def get_id_from_attr(attr_type,attr):
2621
2622
  A='$COUNTER$';result=self.get_id_from_string(attr)
@@ -2683,7 +2684,7 @@ class OpenFMEA:
2683
2684
  gen_elem_obj=general_entries[general_element]
2684
2685
  if'id'in gen_elem_obj and _P in gen_elem_obj and _K in gen_elem_obj:
2685
2686
  if gen_elem_obj[_K]in supported_general_types:
2686
- if supported_general_types[gen_elem_obj[_K]][B]==0:supported_general_types[gen_elem_obj[_K]][B]+=1;new_customtype_statement=SBDL_Parser.parse_customtype(SBDL_Parser.Parser_Element(supported_general_types[gen_elem_obj[_K]][C],_AB,0));new_customtype_def=SBDL_CustomType(new_customtype_statement);general_elements.append(new_customtype_def)
2687
+ if supported_general_types[gen_elem_obj[_K]][B]==0:supported_general_types[gen_elem_obj[_K]][B]+=1;new_customtype_statement=SBDL_Parser.parse_customtype(SBDL_Parser.Parser_Element(supported_general_types[gen_elem_obj[_K]][C],_AC,0));new_customtype_def=SBDL_CustomType(new_customtype_statement);general_elements.append(new_customtype_def)
2687
2688
  new_gen_elem=SBDL_Element_Synthetic(entry_identifier(gen_elem_obj),gen_elem_obj[_P],supported_general_types[gen_elem_obj[_K]][A],_B)
2688
2689
  if D in gen_elem_obj:
2689
2690
  for edge in gen_elem_obj[D]:
@@ -2710,7 +2711,7 @@ class OpenFMEA:
2710
2711
  else:debug_out(f"No FMEA data in {source_name}")
2711
2712
  if _i in openfmea_data and A in openfmea_data[_i]:elements.extend(self.elements_from_general(openfmea_data[_i][A],elements,source_name))
2712
2713
  else:debug_out(f"No general elements in {source_name}")
2713
- return[SBDL_Parser.Parser_Element(x.definition().string(),source_name,_AB)for x in elements]
2714
+ return[SBDL_Parser.Parser_Element(x.definition().string(),source_name,_AC)for x in elements]
2714
2715
  @classmethod
2715
2716
  def aggregate_all_parser_elements_from_files(self,source_files,recurse,hidden,print_l):
2716
2717
  if hidden or recurse:raise Exception('Cannot recurse for OpenFMEA input files')
@@ -2719,7 +2720,7 @@ class OpenFMEA:
2719
2720
  print_l(_CN.format(input_file))
2720
2721
  if is_input_file(input_file):open_sbdl_data=self.read_file(input_file);aggregated_elements.extend(self.statements_from_openfmea(open_sbdl_data,input_file))
2721
2722
  else:errors+=1;print_l(_CO.format(input_file),error=_A)
2722
- set_config_value(_A1,_A);set_config_value(_A2,_A);return aggregated_elements,errors
2723
+ set_config_value(_A2,_A);set_config_value(_A3,_A);return aggregated_elements,errors
2723
2724
  @classmethod
2724
2725
  def aggregate_all_parser_elements_from_quickshare(self,source_files,recurse,hidden,_):
2725
2726
  if hidden or recurse:raise Exception('Cannot recurse for OpenFMEA-Quickshare input files')
@@ -2728,7 +2729,7 @@ class OpenFMEA:
2728
2729
  with open_input_file(input_file)as open_quickshare_file:
2729
2730
  quickshare_content=open_quickshare_file.read();match=re.search('>>(.*?)<<',quickshare_content)
2730
2731
  if match:openfmea_file_content=zlib.decompress(base64.b64decode(match.group(1)));open_sbdl_data=self.read_struct_from_file(io.StringIO(openfmea_file_content.decode()));aggregated_elements.extend(self.statements_from_openfmea(open_sbdl_data,input_file))
2731
- set_config_value(_A1,_A);set_config_value(_A2,_A);return aggregated_elements,errors
2732
+ set_config_value(_A2,_A);set_config_value(_A3,_A);return aggregated_elements,errors
2732
2733
  def get_csv_writer(file_object):return csv.writer(file_object,delimiter=_S,quotechar='"',quoting=csv.QUOTE_MINIMAL,lineterminator=_D)
2733
2734
  def write_csv_output(sbdl_ast,output_file,file_opener,arguments,print_l):
2734
2735
  with file_opener(output_file)as csv_file:
@@ -2747,7 +2748,7 @@ def write_csv_output(sbdl_ast,output_file,file_opener,arguments,print_l):
2747
2748
  def write_aggregated_output(sbdl_ast,output_file,file_opener,__,print_l):
2748
2749
  print_l('Writing aggregate output: {}'.format(output_file),debug=_A);new_line_str=_f if get_config_value(_V,number=_A)else _D
2749
2750
  with file_opener(output_file)as fmfile:
2750
- sbdl_element_set,errors=sbdl_ast.elements(print_l=print_l);sbdl_elements=[sbdl_element_set[x]for x in sbdl_element_set];sort_by_type=get_config_value(_A1,number=_A);sort_by_iden=get_config_value(_A2,number=_A)
2751
+ sbdl_element_set,errors=sbdl_ast.elements(print_l=print_l);sbdl_elements=[sbdl_element_set[x]for x in sbdl_element_set];sort_by_type=get_config_value(_A2,number=_A);sort_by_iden=get_config_value(_A3,number=_A)
2751
2752
  def gen_sort_key(elem):
2752
2753
  key=[]
2753
2754
  if sort_by_type:key.append(elem.type())
@@ -2771,7 +2772,7 @@ def write_rpc_output(sbdl_ast,output_file,file_opener,arguments,print_l):
2771
2772
  return errors
2772
2773
  def query_output(sbdl_ast,_,__,___,____):
2773
2774
  elements,errors=sbdl_ast.elements()
2774
- for element_id in elements:element=elements[element_id];f_print(' Element ID: {}'.format(element.identifier()),opts=['BOLD'],prefix='');f_print(' Type: {}'.format(element.type()),opts=['BLUE'],prefix='');f_print(' Full Types: {}'.format(_G.join(element.types())),opts=['BLUE'],prefix='');f_print(' Description: {}'.format(element.description()),opts=['CYAN'],prefix='');f_print(' Links: {}'.format(_G.join([_AC.format(x.identifier(),x.type())for x in sbdl_ast.get_all_links_for_element(elements[element_id],elements)])),opts=[],prefix='');f_print(' Parents: {}'.format(_G.join([_AC.format(x.identifier(),x.type())for x in sbdl_ast.get_all_parents_for_element(elements[element_id],elements)])),opts=[],prefix='');f_print(' Children: {}'.format(_G.join([_AC.format(x.identifier(),x.type())for x in sbdl_ast.get_all_children_for_element(elements[element_id],elements)])),opts=[],prefix='');f_print(' Reference: {}'.format(element.reference()),opts=[],prefix='');f_print(' Properties: {}'.format(_G.join(['{}<-"{}"'.format(x,element.get_property(x))for x in element.properties()if x!=SBDL_Parser.Attributes.reference])),opts=[],prefix='');f_print(' Hash: {}'.format(element.hash()),prefix='')
2775
+ for element_id in elements:element=elements[element_id];f_print(' Element ID: {}'.format(element.identifier()),opts=['BOLD'],prefix='');f_print(' Type: {}'.format(element.type()),opts=['BLUE'],prefix='');f_print(' Full Types: {}'.format(_G.join(element.types())),opts=['BLUE'],prefix='');f_print(' Description: {}'.format(element.description()),opts=['CYAN'],prefix='');f_print(' Links: {}'.format(_G.join([_AD.format(x.identifier(),x.type())for x in sbdl_ast.get_all_links_for_element(elements[element_id],elements)])),opts=[],prefix='');f_print(' Parents: {}'.format(_G.join([_AD.format(x.identifier(),x.type())for x in sbdl_ast.get_all_parents_for_element(elements[element_id],elements)])),opts=[],prefix='');f_print(' Children: {}'.format(_G.join([_AD.format(x.identifier(),x.type())for x in sbdl_ast.get_all_children_for_element(elements[element_id],elements)])),opts=[],prefix='');f_print(' Reference: {}'.format(element.reference()),opts=[],prefix='');f_print(' Properties: {}'.format(_G.join(['{}<-"{}"'.format(x,element.get_property(x))for x in element.properties()if x!=SBDL_Parser.Attributes.reference])),opts=[],prefix='');f_print(' Hash: {}'.format(element.hash()),prefix='')
2775
2776
  return errors
2776
2777
  def write_matrixcsv_output(sbdl_ast,output_file,file_opener,__,___):
2777
2778
  elements_in,errors=sbdl_ast.elements();elements,errors_dict=sbdl_ast.get_full_ast_as_dict(elements_in,flatten_references=_A);errors+=errors_dict;column_pos={SBDL_Parser.Attributes.identifier:0,SBDL_Parser.Attributes.type:1,SBDL_Parser.Attributes.stereotype:2,SBDL_Parser.Attributes.description:3,SBDL_Parser.Attributes.reference:4}
@@ -2810,10 +2811,10 @@ def apply_template_to_officex_files(officex_dir,sbdl_ast,print_l):
2810
2811
  def find_templatable_files(find_path,pattern):return[p for p in pathlib.Path(find_path).rglob(pattern)if p.is_file()]
2811
2812
  for templatable_file in find_templatable_files(officex_dir,'*.xml'):debug_out(f"Templating OfficeX file: {templatable_file}");write_template_fill(sbdl_ast,templatable_file,_B,arguments=types.SimpleNamespace(**{'template':str(templatable_file)}),print_l=print_l)
2812
2813
  return 0
2813
- def template_docx_file(template_dict,infile,outfile):warnings.filterwarnings(_AZ,category=UserWarning,module='docxcompose');docxtpl=lazy_import('docxtpl');word_template=docxtpl.DocxTemplate(infile);word_template.render(template_dict);word_template.save(outfile)
2814
+ def template_docx_file(template_dict,infile,outfile):warnings.filterwarnings(_A1,category=UserWarning,module='docxcompose');docxtpl=lazy_import('docxtpl');word_template=docxtpl.DocxTemplate(infile);word_template.render(template_dict);word_template.save(outfile)
2814
2815
  def write_template_fill(sbdl_ast,output_file,file_opener,arguments,print_l):
2815
2816
  elements,errors=sbdl_ast.elements();full_dict,errors_dict=sbdl_ast.get_full_ast_as_dict(elements);errors+=errors_dict;template_context={_j:full_dict}
2816
- if get_config_value(_C7,number=_A):openfmea,errors_fmea=OpenFMEA.generate_sbdl_table_from_ast(sbdl_ast,id_in_body=arguments.identifier,source_in_body=arguments.source,print_l=print_l);errors+=errors_fmea;template_context[_AD]=openfmea
2817
+ if get_config_value(_C7,number=_A):openfmea,errors_fmea=OpenFMEA.generate_sbdl_table_from_ast(sbdl_ast,id_in_body=arguments.identifier,source_in_body=arguments.source,print_l=print_l);errors+=errors_fmea;template_context[_AE]=openfmea
2817
2818
  file_ext=os.path.splitext(arguments.template)[1]
2818
2819
  if arguments.template==_B:print_l('Template file not specified',error=_A);errors+=1
2819
2820
  elif file_ext in['.docx']:debug_out('Word Docx template detected');template_docx_file(template_context,arguments.template,output_file)
@@ -2874,7 +2875,7 @@ def update_self(print_l,force=_C):
2874
2875
  return ret
2875
2876
  def initialise_dependencies(print_l):
2876
2877
  errors=0;print_l('Installing dependencies...');install_target='~/.local/bin'
2877
- if current_os()==_AX:errors+=install_package('PlantUML',urllib.parse.urljoin(__URL,'deps/plantuml-headless-jre-linux-x64.tar.bz2'),install_target,print_l)
2878
+ if current_os()==_AY:errors+=install_package('PlantUML',urllib.parse.urljoin(__URL,'deps/plantuml-headless-jre-linux-x64.tar.bz2'),install_target,print_l)
2878
2879
  else:print_l(f"ERROR: No automatic PlantUML dependency file available for {current_os()}",error=_A);errors+=1
2879
2880
  print_l(f"Installation complete (errors: {errors}).");return errors
2880
2881
  def get_cache_file_path(input_file):
@@ -2891,7 +2892,7 @@ def check_ast_cache(do_caching,source_files,print_l):
2891
2892
  if os.path.getmtime(cache_file)>os.path.getmtime(input_file):valid_cache=_A
2892
2893
  else:print_l(f"Cache dirty for: {input_file}")
2893
2894
  if valid_cache:
2894
- for dep_file in get_config_value(_AL):
2895
+ for dep_file in get_config_value(_AM):
2895
2896
  if os.path.exists(dep_file):
2896
2897
  if os.path.getmtime(cache_file)<os.path.getmtime(dep_file):valid_cache=_C;print_l(f"Cache dependency dirty: {dep_file}");break
2897
2898
  else:print_l(f"Not creating cache for unsuitable path: {input_file}")
@@ -2948,7 +2949,7 @@ def main(arguments):
2948
2949
  else:print_l('Encountered {} errors during: {} {}'.format(error_count,step,content),error=_A)
2949
2950
  else:print_l(f"{step} done [{time.time()-step_time_point:.3f}s]")
2950
2951
  step_time_point=time.time()
2951
- operations={_Am:write_aggregated_output,'aggregate':write_aggregated_output,'query':query_output,_AE:write_matrixcsv_output,'matrixcsv':write_matrixcsv_output,_AF:write_matrixjson_output,'matrixjson':write_matrixjson_output,_An:write_yaml_tree_output,_CS:write_csv_output,'fmeacsv':write_csv_output,_AD:OpenFMEA.write_opensbdl_output,'openfmea-quickshare':OpenFMEA.write_quickshare_output,_Ao:OpenFMEA.write_opensbdl_portfolio_output,A:write_aggregated_output,_Ap:write_aggregated_output,B:write_aggregated_output,C:write_aggregated_output,_Aq:write_decomposition_graph_output,_Ar:write_element_graph_output,_As:write_requirement_graph_output,_At:write_network_graph_output,_Au:write_function_graph_output,_Av:write_process_graph_output,_Aw:write_state_graph_output,_Ax:write_usecase_graph_output,_CT:write_template_fill,'rpc':write_rpc_output,_AG:write_aggregated_output,_Ay:write_aggregated_output,_AH:write_aggregated_output,'type-info':write_type_information};macro_errors=0
2952
+ operations={_Am:write_aggregated_output,'aggregate':write_aggregated_output,'query':query_output,_AF:write_matrixcsv_output,'matrixcsv':write_matrixcsv_output,_AG:write_matrixjson_output,'matrixjson':write_matrixjson_output,_An:write_yaml_tree_output,_CS:write_csv_output,'fmeacsv':write_csv_output,_AE:OpenFMEA.write_opensbdl_output,'openfmea-quickshare':OpenFMEA.write_quickshare_output,_Ao:OpenFMEA.write_opensbdl_portfolio_output,A:write_aggregated_output,_Ap:write_aggregated_output,B:write_aggregated_output,C:write_aggregated_output,_Aq:write_decomposition_graph_output,_Ar:write_element_graph_output,_As:write_requirement_graph_output,_At:write_network_graph_output,_Au:write_function_graph_output,_Av:write_process_graph_output,_Aw:write_state_graph_output,_Ax:write_usecase_graph_output,_CT:write_template_fill,'rpc':write_rpc_output,_AH:write_aggregated_output,_Ay:write_aggregated_output,_AI:write_aggregated_output,'type-info':write_type_information};macro_errors=0
2952
2953
  for amacropath in arguments.custom_directive:macro_errors+=import_custom_directive_file(amacropath,print_l)
2953
2954
  check_step('Custom directive import',macro_errors);mode_errors=0
2954
2955
  for amodepath in arguments.custom_mode:
@@ -2958,10 +2959,10 @@ def main(arguments):
2958
2959
  def ext_mode_wrapper(a,b,c,d,e,func=new_modes[new_mode]):return func(a,b,c,d,e,_CONFIG_DATA)
2959
2960
  operations[new_mode]=ext_mode_wrapper
2960
2961
  check_step('Custom mode import',mode_errors)
2961
- if arguments.already_processed:print_l('Input should be treated as already-processed');arguments.skip_validation=_A;set_config_value(_A4,_C)
2962
+ if arguments.already_processed:print_l('Input should be treated as already-processed');arguments.skip_validation=_A;set_config_value(_A5,_C)
2962
2963
  if not arguments.mode in operations:print_l('Mode "{}" is not in available modes'.format(arguments.mode),error=_A);check_step('Mode selection',1,ignorable=_C)
2963
2964
  if len(arguments.source_files)==0:print_l('WARNING: no source files specified',error=_A)
2964
- aggregate_methods={_Ap:OpenFMEA.aggregate_all_parser_elements_from_files,A:OpenFMEA.aggregate_all_parser_elements_from_quickshare,C:OpenFMEA.aggregate_all_parser_elements_from_files,B:OpenFMEA.aggregate_all_parser_elements_from_quickshare,_AG:aggregate_all_parser_elements_from_json,_Ay:aggregate_all_parser_elements_from_yaml,_AH:aggregate_all_parser_elements_from_csv};aggregation_method=aggregate_all_parser_elements_from_files if not arguments.mode in aggregate_methods else aggregate_methods[arguments.mode];parser_elements,read_errors=aggregation_method([fix_wsl_path(x)for x in arguments.source_files],arguments.recurse,arguments.hidden,print_l);check_step('File reading',read_errors);sbdl_ast=load_ast_cache(parser_elements,get_config_value(_BM,number=_A),arguments.source_files,print_l);check_step('Parsing',sbdl_ast.check_parsing(print_l))
2965
+ aggregate_methods={_Ap:OpenFMEA.aggregate_all_parser_elements_from_files,A:OpenFMEA.aggregate_all_parser_elements_from_quickshare,C:OpenFMEA.aggregate_all_parser_elements_from_files,B:OpenFMEA.aggregate_all_parser_elements_from_quickshare,_AH:aggregate_all_parser_elements_from_json,_Ay:aggregate_all_parser_elements_from_yaml,_AI:aggregate_all_parser_elements_from_csv};aggregation_method=aggregate_all_parser_elements_from_files if not arguments.mode in aggregate_methods else aggregate_methods[arguments.mode];parser_elements,read_errors=aggregation_method([fix_wsl_path(x)for x in arguments.source_files],arguments.recurse,arguments.hidden,print_l);check_step('File reading',read_errors);sbdl_ast=load_ast_cache(parser_elements,get_config_value(_BM,number=_A),arguments.source_files,print_l);check_step('Parsing',sbdl_ast.check_parsing(print_l))
2965
2966
  for pre_hook in get_config_value(_BG):check_step('Pre Hook: {}'.format(pre_hook.__name__),pre_hook(sbdl_ast,print_l))
2966
2967
  sbdl_elements,statement_errors=sbdl_ast.elements(print_l);check_step('Element instantiation',statement_errors)
2967
2968
  if arguments.filter_related!=_B:sbdl_ast.add_filter_element_set_connected(arguments.filter_related,arguments.filter_depth)
@@ -2977,7 +2978,7 @@ def main(arguments):
2977
2978
  if arguments.trace:trace_elements,trace_errors=aggregate_all_parser_elements_from_files(arguments.trace,arguments.recurse,arguments.hidden,print_l);_,trace_process_errors=sbdl_ast.process_trace_elements(trace_elements,print_l);trace_errors+=trace_process_errors;check_step('Tracing',trace_errors)
2978
2979
  for post_hook in get_config_value(_k):check_step('Post Hook: {}'.format(post_hook.__name__),post_hook(sbdl_ast,print_l))
2979
2980
  print_l('Mode: {}'.format(arguments.mode));print_l('Writing: {}'.format(arguments.output));check_step('Output writing',operations[arguments.mode](sbdl_ast,arguments.output,open_output_file,arguments,print_l));print_l('C_DEF GLOBALS: {}'.format(get_config_value(_T)),debug=_A);print_l(f"All operations complete [{time.time()-start_time_point:.3f}s]");return total_errors if not arguments.skip_errors else 0
2980
- def handle_arguments(args_l):F='append';E='config_file';D='normal';C='output_file';B='element_identifier';A='store_true';operating_modes={_Am:'Parse all specified input files, gather SBDL elements, validate model, apply filters, write SBDL-formatted output','query':'Compile inputs, then pretty print the results (after filtering)',_AE:'Compile inputs, then write a CSV-formatted representation of the SBDL elements to the output',_AF:'Compile inputs, then write a JSON-formatted representation of the SBDL elements to the output',_An:'Compile inputs, then write a YAML-formatted representation of the SBDL elements to the output',_AH:'Read SBDL-schema CSV-matrix inputs and write SBDL-formatted output',_AG:'Read SBDL-schema JSON-tree inputs and write SBDL-formatted output',_Ay:'Read SBDL-schema YAML-tree inputs and write SBDL-formatted output',_AD:'Compile inputs, then write the FMEA-related content to an OpenFMEA-formatted ouput',_Ao:'Compile inputs, then write the FMEA-related content to an OpenFMEA Portfolio-formatted ouput, organised by aspect hierarchy',_Ap:'Read OpenFMEA-formatted input and write SBDL-formatted output',_CS:'Compile inputs, then write the FMEA-related content to a CSV-formatted ouput',_At:'Compile inputs, then write a PNG-formatted output, visually representing the network of SBDL elements',_As:'Compile inputs, then write a SysML-style requirements diagram to rendering-backend-formatted output',_Aq:'Compile inputs, then write a SysML-style block diagram to rendering-backend-formatted output (simplified, aspects only)',_Ar:'Compile inputs, then write a SysML-style block diagram to rendering-backend-formatted output (detailed, with properties and relations)',_Au:'Compile inputs, then write a SysML-style sequence diagram to rendering-backend-formatted output',_Av:'Compile inputs, then write a SysML-style activity diagram to rendering-backend-formatted output',_Aw:'Compile inputs, then write a SysML-style state diagram to rendering-backend-formatted output',_Ax:'Compile inputs, then write a SysML-style use-case diagram to rendering-backend-formatted output',_CT:"Compile inputs, then provide an object, 'sbdl', in a Jinja parsing environment and apply it to the specified template file",'rpc':'Compile inputs, then transmit to the RPC server for processing by the specified RPC (see --rpc)'};parser=argparse.ArgumentParser(description='{}\n\n{} Version {} (DSL Version {}). System Behaviour Description Language (SBDL) compiler.\nWWW: {}. Author: {}.'.format(logo(),name().upper(),version(),version_dsl(),url(),author()),epilog='e.g. "'+os.path.basename(sys.argv[0])+' <file 1> <file 2> <file n>"\n\n---------------\nOperating Modes\n---------------\n{}'.format(_D.join(['{}: {}'.format(x.rjust(25),operating_modes[x])for x in operating_modes])),formatter_class=argparse.RawDescriptionHelpFormatter);parser._positionals.title='Base Arguments';parser._optionals.title='Optional Arguments';parser.add_argument('source_files',help='List of files to compile ["-" implies stdin]',nargs=_O);parser.add_argument(_F,'--mode',metavar='operating_mode',help='Specify the mode of operation',default=_Am);parser.add_argument(_E,'--output',metavar=C,help='Specify the name of the output file',default=SBDL_Parser.Tokens.stdio_name);parser.add_argument('--version',help='Print the current version',action=A,default=_C);parser.add_argument('--debug',help=argparse.SUPPRESS,action=A,default=_C);parser.add_argument('-W','-w','--warning',help='Set warning level',choices=[D,'all'],default=D);parser.add_argument('--hidden',help='Include hidden files when recursing',action=A,default=_C);parser.add_argument('-i','--identifier',help='Include element identifiers in applicable output formats',action=A,default=_C);parser.add_argument('-s','--source',help='Include source reference in applicable output formats',action=A,default=_C);parser.add_argument('-r','--recurse',help='Recurse on directories specified in the input list',action=A,default=_C);parser.add_argument('--skip-errors',help='Do not stop for errors (emit warning instead)',action=A,default=_C);parser.add_argument('--skip-validation',help='Do not validate model elements and relations',action=A,default=_C);parser.add_argument('--already-processed',help='Disables certain processing actions (implies --skip-validation). Useful when input has already been processed',action=A,default=_C);parser.add_argument('--title',help='Provide a default title for certain output formats',default='');parser.add_argument('-v','--verbose',help='Enable verbose output during execution',action=A,default=_C);parser.add_argument('--dumpaffinitygraph',metavar=C,help=argparse.SUPPRESS,action=_B);parser.add_argument('--dumplanginfo',metavar=C,help=argparse.SUPPRESS,action=_B);parser.add_argument('--run_tests','--run-tests',action=A,help=argparse.SUPPRESS);parser.add_argument('--rest-api-ping',action=A,help=argparse.SUPPRESS);parser.add_argument('--manual',help='Show extensive {} manual page'.format(name().upper()),action=A);parser.add_argument('--dump-config','--dumpconfig',metavar=E,help='Dump the internal configuration to a named JSON file',action=_B);parser.add_argument('--load-config','--loadconfig',metavar=E,help='Load the internal configuration from a named JSON file',default=_B);parser.add_argument('--list-config','--listconfig',help='List internal configuration options',action=A,default=_C);parser.add_argument('--set-config','--setconfig',metavar=('config_option','config_value'),help='Set a named configuration option',action=F,nargs=2);parser.add_argument('-D','--define',metavar=('name','value'),help='Specify a named global definition',action=F,nargs=2);parser.add_argument('--trace',metavar='trace_files',help='Provide a trace file to be processed',default=_B,nargs=_O);parser.add_argument('--template',metavar='template_file',help="Specify a template file for the 'template-fill' mode",default=_B);parser.add_argument('-fr','--filter-related',metavar=B,help='Filter everything but those elements with a direct or indirect relation to the specified element identifier (regex) [INCLUDES: parents/children]',default=_B);parser.add_argument('-frx','--filter-related-x',metavar=B,help='Filter everything but those elements with a direct or indirect connection to the specified element identifier (regex) [EXCLUDES: parents/children]',default=_B);parser.add_argument('-fch','--filter-children',metavar=B,help='Filter everything but those elements which are children of the specified element identifier (regex)',default=_B);parser.add_argument('-fpa','--filter-parents',metavar=B,help='Filter everything but those elements which are parental ancestors of the specified element identifier (regex)',default=_B);parser.add_argument('-fd','--filter-depth',metavar='filter_depth',help='Maximum depth for filters which pursue links (natural number)',type=int,default=_B);parser.add_argument('-ft','--filter-type',metavar='element_type',help='Filter everything but those elements which are of the specified element type (regex)',default=_B);parser.add_argument('-fi','--filter-identifier',metavar=B,help='Filter everything but those elements whose identifiers match the specified string (regex)',default=_B);parser.add_argument('-fpr','--filter-property',metavar=('property_name','property_value'),help='Filter everything but those elements possessing a named property matching the specified string (regex)',default=_B,nargs=2);parser.add_argument('-fg','--filter-group',metavar='group_identifier',help='Shortcut filter for everything but those elements which are children of the specified group identifier (regex) -- excludes the group element itself',default=_B);parser.add_argument(_CU,metavar='compiler_definitions',help='Specify a file path defining custom compiler directives',default=[],nargs=_O);parser.add_argument(_CV,'--custom_mode',metavar='mode_definitions',help='Specify a file path containing custom compiler modes',default=[],nargs=_O);parser.add_argument('--rpc',help='Remote Procedure Call to be used by RPC-based modes',default=_B);parser.add_argument('--update',help=argparse.SUPPRESS,action=A,default=_C);parser.add_argument('--update-force',help=argparse.SUPPRESS,action=A,default=_C);parser.add_argument('--install-deps',help=argparse.SUPPRESS,action=A,default=_C);help_tmp=io.StringIO();parser.print_help(file=help_tmp);help_tmp.seek(0);global __HELP_TEXT;__HELP_TEXT=help_tmp.read();return parser.parse_args(args_l)
2981
+ def handle_arguments(args_l):F='append';E='config_file';D='normal';C='output_file';B='element_identifier';A='store_true';operating_modes={_Am:'Parse all specified input files, gather SBDL elements, validate model, apply filters, write SBDL-formatted output','query':'Compile inputs, then pretty print the results (after filtering)',_AF:'Compile inputs, then write a CSV-formatted representation of the SBDL elements to the output',_AG:'Compile inputs, then write a JSON-formatted representation of the SBDL elements to the output',_An:'Compile inputs, then write a YAML-formatted representation of the SBDL elements to the output',_AI:'Read SBDL-schema CSV-matrix inputs and write SBDL-formatted output',_AH:'Read SBDL-schema JSON-tree inputs and write SBDL-formatted output',_Ay:'Read SBDL-schema YAML-tree inputs and write SBDL-formatted output',_AE:'Compile inputs, then write the FMEA-related content to an OpenFMEA-formatted ouput',_Ao:'Compile inputs, then write the FMEA-related content to an OpenFMEA Portfolio-formatted ouput, organised by aspect hierarchy',_Ap:'Read OpenFMEA-formatted input and write SBDL-formatted output',_CS:'Compile inputs, then write the FMEA-related content to a CSV-formatted ouput',_At:'Compile inputs, then write a PNG-formatted output, visually representing the network of SBDL elements',_As:'Compile inputs, then write a SysML-style requirements diagram to rendering-backend-formatted output',_Aq:'Compile inputs, then write a SysML-style block diagram to rendering-backend-formatted output (simplified, aspects only)',_Ar:'Compile inputs, then write a SysML-style block diagram to rendering-backend-formatted output (detailed, with properties and relations)',_Au:'Compile inputs, then write a SysML-style sequence diagram to rendering-backend-formatted output',_Av:'Compile inputs, then write a SysML-style activity diagram to rendering-backend-formatted output',_Aw:'Compile inputs, then write a SysML-style state diagram to rendering-backend-formatted output',_Ax:'Compile inputs, then write a SysML-style use-case diagram to rendering-backend-formatted output',_CT:"Compile inputs, then provide an object, 'sbdl', in a Jinja parsing environment and apply it to the specified template file",'rpc':'Compile inputs, then transmit to the RPC server for processing by the specified RPC (see --rpc)'};parser=argparse.ArgumentParser(description='{}\n\n{} Version {} (DSL Version {}). System Behaviour Description Language (SBDL) compiler.\nWWW: {}. Author: {}.'.format(logo(),name().upper(),version(),version_dsl(),url(),author()),epilog='e.g. "'+os.path.basename(sys.argv[0])+' <file 1> <file 2> <file n>"\n\n---------------\nOperating Modes\n---------------\n{}'.format(_D.join(['{}: {}'.format(x.rjust(25),operating_modes[x])for x in operating_modes])),formatter_class=argparse.RawDescriptionHelpFormatter);parser._positionals.title='Base Arguments';parser._optionals.title='Optional Arguments';parser.add_argument('source_files',help='List of files to compile ["-" implies stdin]',nargs=_O);parser.add_argument(_F,'--mode',metavar='operating_mode',help='Specify the mode of operation',default=_Am);parser.add_argument(_E,'--output',metavar=C,help='Specify the name of the output file',default=SBDL_Parser.Tokens.stdio_name);parser.add_argument('--version',help='Print the current version',action=A,default=_C);parser.add_argument('--debug',help=argparse.SUPPRESS,action=A,default=_C);parser.add_argument('-W','-w','--warning',help='Set warning level',choices=[D,'all'],default=D);parser.add_argument('--hidden',help='Include hidden files when recursing',action=A,default=_C);parser.add_argument('-i','--identifier',help='Include element identifiers in applicable output formats',action=A,default=_C);parser.add_argument('-s','--source',help='Include source reference in applicable output formats',action=A,default=_C);parser.add_argument('-r','--recurse',help='Recurse on directories specified in the input list',action=A,default=_C);parser.add_argument('--skip-errors',help='Do not stop for errors (emit warning instead)',action=A,default=_C);parser.add_argument('--skip-validation',help='Do not validate model elements and relations',action=A,default=_C);parser.add_argument('--already-processed',help='Disables certain processing actions (implies --skip-validation). Useful when input has already been processed',action=A,default=_C);parser.add_argument('--title',help='Provide a default title for certain output formats',default='');parser.add_argument('-v','--verbose',help='Enable verbose output during execution',action=A,default=_C);parser.add_argument('--dumpaffinitygraph',metavar=C,help=argparse.SUPPRESS,action=_B);parser.add_argument('--dumplanginfo',metavar=C,help=argparse.SUPPRESS,action=_B);parser.add_argument('--run_tests','--run-tests',action=A,help=argparse.SUPPRESS);parser.add_argument('--rest-api-ping',action=A,help=argparse.SUPPRESS);parser.add_argument('--manual',help='Show extensive {} manual page'.format(name().upper()),action=A);parser.add_argument('--dump-config','--dumpconfig',metavar=E,help='Dump the internal configuration to a named JSON file',action=_B);parser.add_argument('--load-config','--loadconfig',metavar=E,help='Load the internal configuration from a named JSON file',default=_B);parser.add_argument('--list-config','--listconfig',help='List internal configuration options',action=A,default=_C);parser.add_argument('--set-config','--setconfig',metavar=('config_option','config_value'),help='Set a named configuration option',action=F,nargs=2);parser.add_argument('-D','--define',metavar=('name','value'),help='Specify a named global definition',action=F,nargs=2);parser.add_argument('--trace',metavar='trace_files',help='Provide a trace file to be processed',default=_B,nargs=_O);parser.add_argument('--template',metavar='template_file',help="Specify a template file for the 'template-fill' mode",default=_B);parser.add_argument('-fr','--filter-related',metavar=B,help='Filter everything but those elements with a direct or indirect relation to the specified element identifier (regex) [INCLUDES: parents/children]',default=_B);parser.add_argument('-frx','--filter-related-x',metavar=B,help='Filter everything but those elements with a direct or indirect connection to the specified element identifier (regex) [EXCLUDES: parents/children]',default=_B);parser.add_argument('-fch','--filter-children',metavar=B,help='Filter everything but those elements which are children of the specified element identifier (regex)',default=_B);parser.add_argument('-fpa','--filter-parents',metavar=B,help='Filter everything but those elements which are parental ancestors of the specified element identifier (regex)',default=_B);parser.add_argument('-fd','--filter-depth',metavar='filter_depth',help='Maximum depth for filters which pursue links (natural number)',type=int,default=_B);parser.add_argument('-ft','--filter-type',metavar='element_type',help='Filter everything but those elements which are of the specified element type (regex)',default=_B);parser.add_argument('-fi','--filter-identifier',metavar=B,help='Filter everything but those elements whose identifiers match the specified string (regex)',default=_B);parser.add_argument('-fpr','--filter-property',metavar=('property_name','property_value'),help='Filter everything but those elements possessing a named property matching the specified string (regex)',default=_B,nargs=2);parser.add_argument('-fg','--filter-group',metavar='group_identifier',help='Shortcut filter for everything but those elements which are children of the specified group identifier (regex) -- excludes the group element itself',default=_B);parser.add_argument(_CU,metavar='compiler_definitions',help='Specify a file path defining custom compiler directives',default=[],nargs=_O);parser.add_argument(_CV,'--custom_mode',metavar='mode_definitions',help='Specify a file path containing custom compiler modes',default=[],nargs=_O);parser.add_argument('--rpc',help='Remote Procedure Call to be used by RPC-based modes',default=_B);parser.add_argument('--update',help=argparse.SUPPRESS,action=A,default=_C);parser.add_argument('--update-force',help=argparse.SUPPRESS,action=A,default=_C);parser.add_argument('--install-deps',help=argparse.SUPPRESS,action=A,default=_C);help_tmp=io.StringIO();parser.print_help(file=help_tmp);help_tmp.seek(0);global __HELP_TEXT;__HELP_TEXT=help_tmp.read();return parser.parse_args(args_l)
2981
2982
  def show_manual(_):
2982
2983
  B='----------------------\n';A='===========================================================\n';manual_text=A;manual_text+=' {} Manual\n'.format(name().upper());manual_text+=A;manual_text+=help_text()+_D;manual_text+=B;manual_text+='Model Type Information\n';manual_text+=B
2983
2984
  def add_manual(strcon=''):nonlocal manual_text;manual_text+=strcon+_D
@@ -2989,7 +2990,7 @@ def show_manual(_):
2989
2990
  for category in sbdl_info_struct[_e]:
2990
2991
  add_manual_header(category,headchar='=');add_manual(sbdl_info_struct[_e][category][_P])
2991
2992
  for elem_type in sbdl_info_struct[_e][category][_Z]:
2992
- add_manual_header(_AC.format(elem_type,category));add_manual('Description:\n {}'.format(sbdl_types[elem_type][_P]));add_manual();add_manual('Relations:\n {}'.format(_S.join(sbdl_types[elem_type][_Ac])));add_manual();add_manual('Properties :')
2993
+ add_manual_header(_AD.format(elem_type,category));add_manual('Description:\n {}'.format(sbdl_types[elem_type][_P]));add_manual();add_manual('Relations:\n {}'.format(_S.join(sbdl_types[elem_type][_Ac])));add_manual();add_manual('Properties :')
2993
2994
  for elem_prop in sbdl_types[elem_type][_v]:
2994
2995
  if elem_prop in sbdl_properties:add_manual(' {:<15}: {}'.format(elem_prop,sbdl_properties[elem_prop]))
2995
2996
  add_manual('\n-------------------');add_manual('Compiler Directives');add_manual('-------------------\n')
@@ -3012,7 +3013,7 @@ class LanguageLevelTests(unittest.TestCase):
3012
3013
  def testLinks(self):main(handle_arguments(['test/link_test.sbdl',_E,self.TEST_OUTPUT_FILE]))
3013
3014
  def testCustomTypeParent(self):main(handle_arguments(['test/customtype_parent_test.sbdl',_E,self.TEST_OUTPUT_FILE]))
3014
3015
  def testCustomType(self):main(handle_arguments(['test/customtype_test.sbdl',_E,self.TEST_OUTPUT_FILE]))
3015
- def testLanguageExample(self):main(handle_arguments([_AI,_AJ,_E,self.TEST_OUTPUT_FILE]))
3016
+ def testLanguageExample(self):main(handle_arguments([_AJ,_AK,_E,self.TEST_OUTPUT_FILE]))
3016
3017
  def testFMEAHierarchical(self):main(handle_arguments(['test/fmea_hierarchical.sbdl',_E,self.TEST_OUTPUT_FILE]))
3017
3018
  def testEmbeddedExcel(self):main(handle_arguments(['test/excel_test.xlsx',_E,self.TEST_OUTPUT_FILE]))
3018
3019
  def testEmbeddedWord(self):main(handle_arguments(['test/word_test.docx',_E,self.TEST_OUTPUT_FILE]))
@@ -3034,19 +3035,19 @@ class LanguageLevelTests(unittest.TestCase):
3034
3035
  def testGeneralRequirementDiagram(self):main(handle_arguments([_J,_E,self.TEST_DIAGRAM_OUTPUT_FILE,_F,_As]))
3035
3036
  def testGeneralUsercaseDiagram(self):main(handle_arguments([_J,_E,self.TEST_DIAGRAM_OUTPUT_FILE,_F,_Ax]))
3036
3037
  def testGeneralNetworkDiagram(self):main(handle_arguments([_J,_E,self.TEST_DIAGRAM_OUTPUT_FILE,_F,_At]))
3037
- def testGeneralJSON(self):main(handle_arguments([_J,_E,self.TEST_OUTPUT_FILE,_F,_AF]))
3038
+ def testGeneralJSON(self):main(handle_arguments([_J,_E,self.TEST_OUTPUT_FILE,_F,_AG]))
3038
3039
  def testGeneralYAML(self):main(handle_arguments([_J,_E,self.TEST_OUTPUT_FILE,_F,_An]))
3039
- def testGeneralCSV(self):main(handle_arguments([_J,_E,self.TEST_OUTPUT_FILE,_F,_AE]))
3040
- def testGeneralOpenFMEA(self):main(handle_arguments([_J,_E,self.TEST_OUTPUT_FILE,_F,_AD]))
3040
+ def testGeneralCSV(self):main(handle_arguments([_J,_E,self.TEST_OUTPUT_FILE,_F,_AF]))
3041
+ def testGeneralOpenFMEA(self):main(handle_arguments([_J,_E,self.TEST_OUTPUT_FILE,_F,_AE]))
3041
3042
  def testGeneralOpenFMEAPortfolio(self):main(handle_arguments([_J,_E,self.TEST_OUTPUT_FILE,_F,_Ao]))
3042
3043
  def testGeneralFMEACSV(self):main(handle_arguments([_J,_E,self.TEST_OUTPUT_FILE,_F,'fmeacsv']))
3043
- def testFromJSON(self):main(handle_arguments([_AI,_AJ,_E,self.TEST_OUTPUT_FILE,_F,_AF]));reset();main(handle_arguments([self.TEST_OUTPUT_FILE,_E,self.TEST_OUTPUT_FILE2,_F,_AG]))
3044
- def testFromCSV(self):main(handle_arguments([_AI,_AJ,_E,self.TEST_OUTPUT_FILE,_F,_AE]));reset();main(handle_arguments([self.TEST_OUTPUT_FILE,_E,self.TEST_OUTPUT_FILE2,_F,_AH]))
3044
+ def testFromJSON(self):main(handle_arguments([_AJ,_AK,_E,self.TEST_OUTPUT_FILE,_F,_AG]));reset();main(handle_arguments([self.TEST_OUTPUT_FILE,_E,self.TEST_OUTPUT_FILE2,_F,_AH]))
3045
+ def testFromCSV(self):main(handle_arguments([_AJ,_AK,_E,self.TEST_OUTPUT_FILE,_F,_AF]));reset();main(handle_arguments([self.TEST_OUTPUT_FILE,_E,self.TEST_OUTPUT_FILE2,_F,_AI]))
3045
3046
  def testAPIBasic(self):
3046
3047
  ret_code,_,stderr=exec_external(['python','test/external_use_test.py'])
3047
3048
  if ret_code!=0:print(stderr);raise Exception('API Test failed')
3048
3049
  class LanguageSemanticTests(unittest.TestCase):
3049
- def setUp(self):self.parser_elements,errors=aggregate_all_parser_elements_from_files([_AI,_AJ],_C,_C,print_null,open_input_file);self.ast=SBDL_AST(self.parser_elements);self.sbdl_elements,statement_errors=self.ast.elements(print_null)
3050
+ def setUp(self):self.parser_elements,errors=aggregate_all_parser_elements_from_files([_AJ,_AK],_C,_C,print_null,open_input_file);self.ast=SBDL_AST(self.parser_elements);self.sbdl_elements,statement_errors=self.ast.elements(print_null)
3050
3051
  def test_general_elements_check(self):0
3051
3052
  def test_general_attributes_check(self):
3052
3053
  for elem in self.sbdl_elements:0
@@ -3062,7 +3063,7 @@ class LanguageSemanticTests(unittest.TestCase):
3062
3063
  def run_tests(_):errors=0;test_results=unittest.main(argv=[name()],exit=_C,verbosity=2).result;errors=errors+len(test_results.failures)+len(test_results.errors);return errors
3063
3064
  def handle_pre_exec_args(ARGS):
3064
3065
  global debug_out;debug_out=functools.partial(debug_out,do_debug=ARGS.debug)
3065
- if ARGS.debug:set_config_value(_AK,_A);ARGS.verbose=_A
3066
+ if ARGS.debug:set_config_value(_AL,_A);ARGS.verbose=_A
3066
3067
  if ARGS.load_config!=_B:f_print('Loading JSON config from {}'.format(ARGS.load_config),verbose=ARGS.verbose);load_config(ARGS.load_config)
3067
3068
  if ARGS.set_config!=_B:
3068
3069
  for config_param_pair in ARGS.set_config:set_config_value(config_param_pair[0],config_param_pair[1]);lock_config_key(config_param_pair[0])
@@ -3101,7 +3102,7 @@ def whoopsie_handler(whoopsie):
3101
3102
  A='---------------------------------';w_print=functools.partial(f_print,error=_A);p_print=functools.partial(w_print,opts=['RED']);w_print(' RUHROH! ',opts=['BOLD']);p_print(' _ ._ _ , _ ._');p_print(" (_ ' ( ` )_ .__)");p_print(' ( ( ( ) `) ) _)');p_print(' (__ (_ (_ . _) _) ,__)');p_print(" `~~`\\ ' . /`~~`");p_print(' ; ;');p_print(' / \\\\');p_print('_____________/_ __ \\_____________');w_print(A);w_print('>>>> Internal Compiler Error <<<<');w_print(A);w_print(' Version Information ');w_print(A);w_print('COMPILER: {}'.format(__VERSION));w_print(' DSL: {}'.format(__VERSION_DSL));w_print(A);w_print(' Command Line ');w_print(A);w_print(str(sys.argv));w_print(A);w_print(' Error Content ');w_print(A)
3102
3103
  try:w_print('"{}"'.format(str(whoopsie)))
3103
3104
  except Exception as _:w_print(_w)
3104
- if isinstance(whoopsie,Exception)and get_config_value(_AK,number=_A):
3105
+ if isinstance(whoopsie,Exception)and get_config_value(_AL,number=_A):
3105
3106
  w_print(A);w_print(' Stack Trace ');w_print(A)
3106
3107
  try:w_print(traceback.format_exc(),end='',prefix='')
3107
3108
  except Exception as _:w_print('Could not print stack trace')
@@ -2,14 +2,18 @@ from setuptools import setup
2
2
 
3
3
  setup(
4
4
  name='sbdl',
5
- version='1.18.17',
5
+ version='1.18.19',
6
6
  description = "System Behaviour Description Language (Compiler)",
7
7
  author = "Michael A. Hicks",
8
8
  author_email = "michael@mahicks.org",
9
9
  url = "https://sbdl.dev",
10
- scripts=['sbdl'],
11
10
  py_modules=['sbdl','csv-to-sbdl','sbdl_server'],
12
11
  license = "Proprietary",
13
12
  python_requires='>=3.6',
14
- install_requires=['networkx','matplotlib','docx2txt','pandas','openpyxl','docxtpl','jinja2']
13
+ install_requires=['networkx','matplotlib','docx2txt','openpyxl','docxtpl','jinja2'],
14
+ entry_points={
15
+ 'console_scripts': [
16
+ 'sbdl = sbdl:run_main',
17
+ ],
18
+ }
15
19
  )
sbdl-1.18.17/sbdl DELETED
@@ -1,5 +0,0 @@
1
- #!/usr/bin/python3
2
- import sys
3
- import subprocess
4
-
5
- subprocess.call([sys.executable, '-m', 'sbdl'] + sys.argv[1:])
File without changes
File without changes
File without changes