From 0022d6f1152b94d518ceaeda4a3cf949b6abead4 Mon Sep 17 00:00:00 2001 From: Grigori Fursin Date: Mon, 21 Oct 2024 22:26:06 +0200 Subject: [PATCH 1/3] improved error messages --- cm/CHANGES.md | 3 +++ cm/cmind/__init__.py | 2 +- cm/cmind/core.py | 5 ++++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/cm/CHANGES.md b/cm/CHANGES.md index f36e8a8c6..f42173463 100644 --- a/cm/CHANGES.md +++ b/cm/CHANGES.md @@ -1,3 +1,6 @@ +## V3.2.6.1 + - improved error messages + ## V3.2.6 - Fix type of "unknown_keys" to list to be serializable https://github.com/mlcommons/ck/issues/1335 diff --git a/cm/cmind/__init__.py b/cm/cmind/__init__.py index f207710af..55c47496f 100644 --- a/cm/cmind/__init__.py +++ b/cm/cmind/__init__.py @@ -2,7 +2,7 @@ # # Written by Grigori Fursin -__version__ = "3.2.6" +__version__ = "3.2.6.1" from cmind.core import access from cmind.core import x diff --git a/cm/cmind/core.py b/cm/cmind/core.py index 25edc2b4b..a023eecf5 100644 --- a/cm/cmind/core.py +++ b/cm/cmind/core.py @@ -198,7 +198,10 @@ def errorx(self, r): else: message += ': ' - message += r['error'] + '\n' + text = r['error'].capitalize() + if not text.endswith('!'): text += '!' + + message += text + '\n' sys.stderr.write(message) From 86478f2cd3f10070e5e1317bcf3d0d50655b946e Mon Sep 17 00:00:00 2001 From: Grigori Fursin Date: Tue, 22 Oct 2024 16:20:44 +0200 Subject: [PATCH 2/3] minor clean up --- cm/cmind/core.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cm/cmind/core.py b/cm/cmind/core.py index a023eecf5..a8e109631 100644 --- a/cm/cmind/core.py +++ b/cm/cmind/core.py @@ -164,7 +164,8 @@ def errorx(self, r): if 'warning' in r: message = r.get('warning', '') if message != '': - message = '\nCMX warning: ' + message.capitalize() + '!\n' + message = message[0].upper() + message[1:] + message = '\nCMX warning: ' + message + '!\n' else: module_path = r.get('module_path', '') lineno = r.get('lineno', '') @@ -195,10 +196,13 @@ def errorx(self, r): if module_path != '' and lineno !='': message += f' in {module_path} ({lineno}):\n\n' + text = r['error'] + text = text[0].upper() + text[1:] + else: message += ': ' + text = r['error'] - text = r['error'].capitalize() if not text.endswith('!'): text += '!' message += text + '\n' From c98e2469bef028d6a397dc2ad0de34058829e001 Mon Sep 17 00:00:00 2001 From: Grigori Fursin Date: Wed, 23 Oct 2024 09:35:01 +0200 Subject: [PATCH 3/3] v3.2.7: minor improvement in error handling and messages --- cm/CHANGES.md | 4 ++-- cm/cmind/__init__.py | 2 +- cm/cmind/cli.py | 15 +++++++++++++++ cm/setup.py | 3 ++- 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/cm/CHANGES.md b/cm/CHANGES.md index f42173463..48804743a 100644 --- a/cm/CHANGES.md +++ b/cm/CHANGES.md @@ -1,5 +1,5 @@ -## V3.2.6.1 - - improved error messages +## V3.2.7 + - minor improvement in error handling and messages ## V3.2.6 - Fix type of "unknown_keys" to list to be serializable diff --git a/cm/cmind/__init__.py b/cm/cmind/__init__.py index 55c47496f..ec49ca881 100644 --- a/cm/cmind/__init__.py +++ b/cm/cmind/__init__.py @@ -2,7 +2,7 @@ # # Written by Grigori Fursin -__version__ = "3.2.6.1" +__version__ = "3.2.7" from cmind.core import access from cmind.core import x diff --git a/cm/cmind/cli.py b/cm/cmind/cli.py index 7e03d2347..be9ea72a9 100644 --- a/cm/cmind/cli.py +++ b/cm/cmind/cli.py @@ -193,6 +193,21 @@ def run_experiment(argv = None): return run(['run', 'experiment'] + argv) +############################################################ +def run_ff(argv = None): + """ + """ + + # Access CMX + if argv is None: + argv = sys.argv[1:] + + x = 'lex' + if len(argv) >0 and argv[0].startswith('_misc'): + x = argv[0] + + return runx(['run', 'f'+x+'.flow'] + argv) + ############################################################ def parse(cmd): """ diff --git a/cm/setup.py b/cm/setup.py index f48f65495..3d91b7143 100644 --- a/cm/setup.py +++ b/cm/setup.py @@ -101,10 +101,11 @@ def run(self): "cm = cmind.cli:run", "cmx = cmind.cli:runx", "cmr = cmind.cli:run_script", + "fflow = cmind.cli:run_ff", "cmrd = cmind.cli:docker_script", "cmg = cmind.cli:gui_script", "cme = cmind.cli:run_experiment" - ]}, + ]}, zip_safe=False,