'Python object content keys description in function signature
Is there a possible way to describe the content of a returned object in function comments ?
This seems doesn't work, I don't have access, with IntelliSense, to the content of the returned object properties.
Example :
def parse_configuration(path_to_json: str, path_to_schema: str):
"""
Parse a configuration file and check it with a json schema
:param path_to_json: Path to the configuration file (json format)
:param path_to_schema: Path to the json schema (json format)
:return: {"name", "version", "port", "address", "database_path"} or ParseError exception
"""
with open(path_to_json, "r") as jsonFile:
with open(path_to_schema, "r") as schemaFile:
json_object = json.load(jsonFile)
json_schema = json.load(schemaFile)
if validate_json(json_object, json_schema):
return json_object
else:
raise ParseError
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
