Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: use is to compare type of objects #11

Merged
merged 1 commit into from
Jan 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/zbmath_rest2oai/getWithSwagger.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def func_get_doc_to_xml(obj, xml):
if type(obj) in swagger_client_dicttype_list:
obj = obj.__dict__

if type(obj) == list:
if type(obj) is list:
for i in range(len(obj)):

if xml.lastChild.nodeName in ["zbmath:author_ids","zbmath:author_id", "zbmath:review","zbmath:keywords","zbmath:keyword"]:
Expand Down Expand Up @@ -118,7 +118,7 @@ def func_get_doc_to_xml(obj, xml):
func_get_doc_to_xml(obj[i], xml)


if type(obj) == dict:
if type(obj) is dict:
new_obj = dict()
for key_init in obj.keys():
if key_init in d.keys():
Expand Down Expand Up @@ -177,7 +177,7 @@ def func_get_doc_to_xml(obj, xml):
if type(new_obj[key]) not in [list,dict]:
new_obj[key] = new_obj[key].__dict__

if type(new_obj[key]) ==dict:
if type(new_obj[key]) is dict:

l_values = [node.nodeName for node in xml.childNodes]
l_values.sort()
Expand All @@ -200,7 +200,7 @@ def func_get_doc_to_xml(obj, xml):

xml = append_text_child(xmld, xml, key, "")

if type(new_obj[key]) == list:
if type(new_obj[key]) is list:
if key == 'references':
xml = append_text_child(xmld, xml, 'references', "")
xml = append_text_child(xmld, xml.lastChild, 'reference', "")
Expand Down