MCPcopy Index your code
hub / github.com/googleapis/google-api-python-client / _cast

Function _cast

googleapiclient/discovery.py:742–770  ·  view source on GitHub ↗

Convert value to a string based on JSON Schema type. See http://tools.ietf.org/html/draft-zyp-json-schema-03 for more details on JSON Schema. Args: value: any, the value to convert schema_type: string, the type that value should be interpreted as Returns: A strin

(value, schema_type)

Source from the content-addressed store, hash-verified

740
741
742def _cast(value, schema_type):
743 """Convert value to a string based on JSON Schema type.
744
745 See http://tools.ietf.org/html/draft-zyp-json-schema-03 for more details on
746 JSON Schema.
747
748 Args:
749 value: any, the value to convert
750 schema_type: string, the type that value should be interpreted as
751
752 Returns:
753 A string representation of 'value' based on the schema_type.
754 """
755 if schema_type == "string":
756 if type(value) == type("") or type(value) == type(""):
757 return value
758 else:
759 return str(value)
760 elif schema_type == "integer":
761 return str(int(value))
762 elif schema_type == "number":
763 return str(float(value))
764 elif schema_type == "boolean":
765 return str(bool(value)).lower()
766 else:
767 if type(value) == type("") or type(value) == type(""):
768 return value
769 else:
770 return str(value)
771
772
773def _media_size_to_long(maxSize):

Callers 1

methodFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…