Skip to content

Instantly share code, notes, and snippets.

@vinitkumar
Created April 30, 2022 19:01
Show Gist options
  • Save vinitkumar/8688ca7afb0765bd3d4d601370c3e1ed to your computer and use it in GitHub Desktop.
Save vinitkumar/8688ca7afb0765bd3d4d601370c3e1ed to your computer and use it in GitHub Desktop.
def convert_none(
key: str, val: None, attr_type: bool, attr: Dict[str, Any] = {}, cdata: bool = False
) -> str:
"""Converts a null value into an XML element"""
LOG.info(f'Inside convert_none(): key="{str(key)}" val={type(val)}')
key, attr = make_valid_xml_name(key, attr)
if attr_type:
attr["type"] = get_xml_type(val)
attrstring = make_attrstring(attr)
return f"<{key}{attrstring}></{key}>"
#################################
mypyc temp.pyl.py
json2xml/temp.py: error: Local variable "val" has inferred type None; add an annotation
##################################
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment