mirror of
https://github.com/OMGeeky/google-apis-rs.git
synced 2026-02-23 15:49:49 +01:00
Revert "fix dict access errors while running test"
This reverts commit c4c38e927f.
This commit is contained in:
@@ -488,7 +488,7 @@ def is_nested_type_property(t):
|
|||||||
|
|
||||||
# Return True if the schema is nested
|
# Return True if the schema is nested
|
||||||
def is_nested_type(s):
|
def is_nested_type(s):
|
||||||
return len(s['parents']) > 0
|
return len(s.parents) > 0
|
||||||
|
|
||||||
|
|
||||||
# convert a rust-type to something that would be taken as input of a function
|
# convert a rust-type to something that would be taken as input of a function
|
||||||
@@ -509,9 +509,9 @@ def is_pod_property(p):
|
|||||||
return 'format' in p or p.get('type', '') == 'boolean'
|
return 'format' in p or p.get('type', '') == 'boolean'
|
||||||
|
|
||||||
|
|
||||||
def _traverse_schema_ids(s: dict, c):
|
def _traverse_schema_ids(s, c):
|
||||||
ids = [s['id']]
|
ids = [s.id]
|
||||||
used_by = s['used_by'] + s['parents']
|
used_by = s.used_by + s.parents
|
||||||
|
|
||||||
seen = set() # protect against loops, just to be sure ...
|
seen = set() # protect against loops, just to be sure ...
|
||||||
while used_by:
|
while used_by:
|
||||||
@@ -522,8 +522,8 @@ def _traverse_schema_ids(s: dict, c):
|
|||||||
ids.append(id)
|
ids.append(id)
|
||||||
|
|
||||||
oid = c.schemas[id]
|
oid = c.schemas[id]
|
||||||
used_by.extend(oid['used_by'])
|
used_by.extend(oid.used_by)
|
||||||
used_by.extend(oid['parents'])
|
used_by.extend(oid.parents)
|
||||||
# end gather usages
|
# end gather usages
|
||||||
return ids
|
return ids
|
||||||
|
|
||||||
@@ -531,9 +531,9 @@ def _traverse_schema_ids(s: dict, c):
|
|||||||
# Return sorted type names of all markers applicable to the given schema
|
# Return sorted type names of all markers applicable to the given schema
|
||||||
# This list is transitive. Thus, if the schema is used as child of someone with a trait, it
|
# This list is transitive. Thus, if the schema is used as child of someone with a trait, it
|
||||||
# inherits this trait
|
# inherits this trait
|
||||||
def schema_markers(s: dict, c, transitive=True):
|
def schema_markers(s, c, transitive=True):
|
||||||
res = set()
|
res = set()
|
||||||
ids = transitive and _traverse_schema_ids(s, c) or [s['id']]
|
ids = transitive and _traverse_schema_ids(s, c) or [s.id]
|
||||||
|
|
||||||
has_activity = False
|
has_activity = False
|
||||||
for sid in ids:
|
for sid in ids:
|
||||||
@@ -562,7 +562,7 @@ def schema_markers(s: dict, c, transitive=True):
|
|||||||
if is_nested_type(s):
|
if is_nested_type(s):
|
||||||
res.add(NESTED_MARKER_TRAIT)
|
res.add(NESTED_MARKER_TRAIT)
|
||||||
# if len(s.used_by) + len(s.parents) > 0:
|
# if len(s.used_by) + len(s.parents) > 0:
|
||||||
if len(c.sta_map.get(s['id'], dict())) == 0:
|
if len(c.sta_map.get(s.id, dict())) == 0:
|
||||||
res.add(PART_MARKER_TRAIT)
|
res.add(PART_MARKER_TRAIT)
|
||||||
|
|
||||||
if not has_activity:
|
if not has_activity:
|
||||||
@@ -633,7 +633,7 @@ def _method_params(m, required=None, location=None):
|
|||||||
np['priority'] = prio
|
np['priority'] = prio
|
||||||
res.append(np)
|
res.append(np)
|
||||||
# end for each parameter
|
# end for each parameter
|
||||||
return sorted(res, key=lambda p: (p['priority'], p['name']), reverse=True)
|
return sorted(res, key=lambda p: (p.priority, p.name), reverse=True)
|
||||||
|
|
||||||
|
|
||||||
def _method_io(type_name, c, m, marker=None):
|
def _method_io(type_name, c, m, marker=None):
|
||||||
@@ -671,7 +671,7 @@ def rust_copy_value_s(n, tn, p):
|
|||||||
# convert a schema into a property (for use with rust type generation).
|
# convert a schema into a property (for use with rust type generation).
|
||||||
# n = name of the property
|
# n = name of the property
|
||||||
def schema_to_required_property(s, n):
|
def schema_to_required_property(s, n):
|
||||||
return type(s)({'name': n, TREF: s['id'], 'priority': REQUEST_PRIORITY, 'is_query_param': False})
|
return type(s)({'name': n, TREF: s.id, 'priority': REQUEST_PRIORITY, 'is_query_param': False})
|
||||||
|
|
||||||
|
|
||||||
def is_required_property(p):
|
def is_required_property(p):
|
||||||
@@ -1137,7 +1137,7 @@ def find_fattest_resource(c):
|
|||||||
def parts_from_params(params):
|
def parts_from_params(params):
|
||||||
part_prop = None
|
part_prop = None
|
||||||
for p in params:
|
for p in params:
|
||||||
if p['name'] == 'part':
|
if p.name == 'part':
|
||||||
part_prop = p
|
part_prop = p
|
||||||
break
|
break
|
||||||
# end for each param
|
# end for each param
|
||||||
|
|||||||
Reference in New Issue
Block a user