From 3701d7c20c5b037781ff0451544aad07e4470420 Mon Sep 17 00:00:00 2001 From: Stavros kois Date: Tue, 2 Jul 2024 16:48:22 +0300 Subject: [PATCH] update casing on variable names --- apps_schema/features/ix_volume.py | 12 ++++++------ catalog_reader/questions.py | 8 ++++---- catalog_reader/questions_util.py | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/apps_schema/features/ix_volume.py b/apps_schema/features/ix_volume.py index 5a0ceec..b509f23 100644 --- a/apps_schema/features/ix_volume.py +++ b/apps_schema/features/ix_volume.py @@ -13,13 +13,13 @@ def _validate(self, verrors, schema_obj, schema_str): return attrs = schema_obj.attrs - if 'datasetName' not in attrs: - verrors.add(f'{schema_str}.attrs', 'Variable "datasetName" must be specified.') - elif not isinstance(attrs[attrs.index('datasetName')].schema, StringSchema): - verrors.add(f'{schema_str}.attrs', 'Variable "datasetName" must be of string type.') + if 'dataset_name' not in attrs: + verrors.add(f'{schema_str}.attrs', 'Variable "dataset_name" must be specified.') + elif not isinstance(attrs[attrs.index('dataset_name')].schema, StringSchema): + verrors.add(f'{schema_str}.attrs', 'Variable "dataset_name" must be of string type.') - if 'aclEntries' in attrs and not isinstance(attrs[attrs.index('aclEntries')].schema, DictSchema): - verrors.add(f'{schema_str}.attrs', 'Variable "aclEntries" must be of dict type.') + if 'acl_entries' in attrs and not isinstance(attrs[attrs.index('acl_entries')].schema, DictSchema): + verrors.add(f'{schema_str}.attrs', 'Variable "acl_entries" must be of dict type.') if 'properties' in attrs: index = attrs.index('properties') diff --git a/catalog_reader/questions.py b/catalog_reader/questions.py index 4b47fea..c6178bf 100644 --- a/catalog_reader/questions.py +++ b/catalog_reader/questions.py @@ -83,10 +83,10 @@ def normalize_question(question: dict, version_data: dict, context: dict) -> Non elif ref == 'normalize/acl': data['attrs'] = ACL_QUESTION elif ref == 'normalize/ixVolume': - if schema['type'] == 'dict' and any(i['variable'] == 'aclEntries' for i in schema['attrs']): - # get index of aclEntries from attrs - acl_index = next(i for i, v in enumerate(schema['attrs']) if v['variable'] == 'aclEntries') - # insert acl question before aclEntries + if schema['type'] == 'dict' and any(i['variable'] == 'acl_entries' for i in schema['attrs']): + # get index of acl_entries from attrs + acl_index = next(i for i, v in enumerate(schema['attrs']) if v['variable'] == 'acl_entries') + # insert acl question before acl_entries schema['attrs'][acl_index]['schema']['attrs'] = IX_VOLUMES_ACL_QUESTION schema.update(data) diff --git a/catalog_reader/questions_util.py b/catalog_reader/questions_util.py index 98847a4..be0f90b 100644 --- a/catalog_reader/questions_util.py +++ b/catalog_reader/questions_util.py @@ -16,7 +16,7 @@ 'schema': { 'type': 'list', 'items': [{ - 'variable': 'aclEntry', + 'variable': 'acl_entry', 'label': 'ACL Entry', 'schema': { 'type': 'dict',