diff --git a/README.md b/README.md index b6c91ae84..9668c1e08 100755 --- a/README.md +++ b/README.md @@ -57,6 +57,10 @@ CK consists of several sub-projects: * Copyright (c) 2021-2024 MLCommons * Copyright (c) 2014-2021 cTuning foundation +### Author + +* [Grigori Fursin](https://cKnowledge.org/gfursin) (FlexAI, cTuning) + ### Maintainers * CM/CM4Research/CM4MLPerf-results: [Grigori Fursin](https://cKnowledge.org/gfursin) diff --git a/cm/CHANGES.md b/cm/CHANGES.md index 8416126a1..d15293319 100644 --- a/cm/CHANGES.md +++ b/cm/CHANGES.md @@ -1,5 +1,7 @@ -## V3.4.3.1 - - enhancing 'cm pull repo' based on user feedback +## V3.4.4 + - improved error reporting in utils.load_json and utils.load_yaml + - added utils.substitute_template + - enhanced 'cm pull repo' based on user feedback ## V3.4.3 - fixed pyproject.toml diff --git a/cm/cmind/__init__.py b/cm/cmind/__init__.py index 3e8c2744c..e996b7932 100644 --- a/cm/cmind/__init__.py +++ b/cm/cmind/__init__.py @@ -2,7 +2,7 @@ # # Written by Grigori Fursin -__version__ = "3.4.3.1" +__version__ = "3.4.4" from cmind.core import access from cmind.core import x diff --git a/cm/cmind/utils.py b/cm/cmind/utils.py index 23296c6e4..5ba5bbce1 100644 --- a/cm/cmind/utils.py +++ b/cm/cmind/utils.py @@ -204,7 +204,7 @@ def load_json(file_name, check_if_exists = False, encoding='utf8'): try: meta = json.load(jf) except Exception as e: - return {'return':4, 'error': format(e)} + return {'return':4, 'error': f'detected problem in {file_name}: {e}'} return {'return':0, 'meta': meta} @@ -274,7 +274,7 @@ def load_yaml(file_name, check_if_exists = False, encoding = 'utf8'): # To support old versions meta = yaml.safe_load(yf) except Exception as e: - return {'return':4, 'error': format(e)} + return {'return':4, 'error': f'detected problem in {file_name}: {e}'} return {'return':0, 'meta': meta} @@ -2152,3 +2152,21 @@ def digits(s, first = True): pass return v + +############################################################################## +def substitute_template(template, variables): + """ + Substitutes variables in a template string with values from a dictionary. + + Args: + template (str): The template string with placeholders (e.g., "something-{var1}-something-{var2}"). + vars (dict): A dictionary containing variable-value pairs (e.g., {'var1': 'a', 'var2': 'b'}). + + Returns: + str: The template string with placeholders replaced by the corresponding values. + """ + try: + return template.format(**variables) + except KeyError as e: + return f"Error: Missing value for {e.args[0]} in the vars dictionary." + diff --git a/cmx4mlops/README.md b/cmx4mlops/README.md new file mode 100644 index 000000000..a0990367e --- /dev/null +++ b/cmx4mlops/README.md @@ -0,0 +1 @@ +TBD diff --git a/cmx4mlops/cmr.yaml b/cmx4mlops/cmr.yaml new file mode 100644 index 000000000..54158c39c --- /dev/null +++ b/cmx4mlops/cmr.yaml @@ -0,0 +1,8 @@ +alias: cmx4mlops +uid: 428611a6db02407f + +git: true + +version: "0.5.1" + +author: "Grigori Fursin"