diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index e6e0074..19c693e 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -20,7 +20,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - python -m pip install flake8 flake8-import-order + python -m pip install flake8==5.0.4 flake8-import-order - name: Lint with flake8 run: | diff --git a/moai/metadata/datacite.py b/moai/metadata/datacite.py index 3f8ee48..d1bba2b 100644 --- a/moai/metadata/datacite.py +++ b/moai/metadata/datacite.py @@ -89,9 +89,11 @@ def __call__(self, element, metadata): if not isinstance(idf_list, list): idf_list = [idf_list] for identifier in idf_list: - nameIdf = NONE.nameIdentifier(identifier['Name_Identifier']) - nameIdf.attrib['nameIdentifierScheme'] = identifier['Name_Identifier_Scheme'] - creator.append(nameIdf) + if 'Name_Identifier' in identifier: + nameIdf = NONE.nameIdentifier(identifier['Name_Identifier']) + if 'Name_Identifier_Scheme' in identifier: + nameIdf.attrib['nameIdentifierScheme'] = identifier['Name_Identifier_Scheme'] + creator.append(nameIdf) creators.append(creator) datacite.append(creators) @@ -214,9 +216,11 @@ def __call__(self, element, metadata): if not isinstance(idf_list, list): idf_list = [idf_list] for identifier in idf_list: - nameIdf = NONE.nameIdentifier(identifier['Name_Identifier']) - nameIdf.attrib['nameIdentifierScheme'] = identifier['Name_Identifier_Scheme'] - contributor.append(nameIdf) + if 'Name_Identifier' in identifier: + nameIdf = NONE.nameIdentifier(identifier['Name_Identifier']) + if 'Name_Identifier_Scheme' in identifier: + nameIdf.attrib['nameIdentifierScheme'] = identifier['Name_Identifier_Scheme'] + contributor.append(nameIdf) contributors.append(contributor) @@ -242,9 +246,12 @@ def __call__(self, element, metadata): if not isinstance(idf_list, list): idf_list = [idf_list] for identifier in idf_list: - nameIdf = NONE.nameIdentifier(identifier['Name_Identifier']) - nameIdf.attrib['nameIdentifierScheme'] = identifier['Name_Identifier_Scheme'] - contributor.append(nameIdf) + + if 'Name_Identifier' in identifier: + nameIdf = NONE.nameIdentifier(identifier['Name_Identifier']) + if 'Name_Identifier_Scheme' in identifier: + nameIdf.attrib['nameIdentifierScheme'] = identifier['Name_Identifier_Scheme'] + contributor.append(nameIdf) contributors.append(contributor) except KeyError: diff --git a/moai/metadata/oaidc.py b/moai/metadata/oaidc.py index 87e7231..68b637c 100644 --- a/moai/metadata/oaidc.py +++ b/moai/metadata/oaidc.py @@ -137,7 +137,7 @@ def __call__(self, element, metadata): if not isinstance(con_list, list): con_list = [con_list] - for dccon in creator_list: + for dccon in con_list: name = dccon['Name']['Given_Name'] + ' ' + dccon['Name']['Family_Name'] affiliation_list = dccon['Affiliation']