FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

docs: Reduce noisy changes in docs regen by parthea · Pull Request #1135 · googleapis/google-api-python-client · GitHub

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (4) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
2 changes: 1 addition & 1 deletion describe.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ def add_param(pname, desc):
pname = m.group(1)
desc = m.group(2)
add_param(pname, desc)
parameters = ", ".join(parameters)
parameters = ", ".join(sorted(parameters))
else:
parameters = ""
return parameters
Expand Down
8 changes: 5 additions & 3 deletions googleapiclient/discovery.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -898,7 +898,9 @@ def set_parameters(self, method_desc):
comes from the dictionary of methods stored in the 'methods' key in
the deserialized discovery document.
"""
for arg, desc in six.iteritems(method_desc.get("parameters", {})):
parameters = method_desc.get("parameters", {})
sorted_parameters = OrderedDict(sorted(parameters.items()))
for arg, desc in six.iteritems(sorted_parameters):
param = key2param(arg)
self.argmap[param] = arg

Expand Down Expand Up @@ -1137,7 +1139,7 @@ def method(self, **kwargs):
if "body" in all_args:
args_ordered.append("body")

for name in all_args:
for name in sorted(all_args):
if name not in args_ordered:
args_ordered.append(name)

Expand All @@ -1155,7 +1157,7 @@ def method(self, **kwargs):
paramdoc = paramdesc.get("description", "A parameter")
if "$ref" in paramdesc:
docs.append(
(" %s: object, %s%s%s\n The object takes the" " form of:\n\n%s\n\n")
(" %s: object, %s%s%s\n The object takes the form of:\n\n%s\n\n")
% (
arg,
paramdoc,
Expand Down
9 changes: 6 additions & 3 deletions googleapiclient/schema.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@

import copy

from collections import OrderedDict
from googleapiclient import _helpers as util


Expand Down Expand Up @@ -124,7 +125,7 @@ def prettyPrintByName(self, name):
comments that conforms to the given schema.
"""
# Return with trailing comma and newline removed.
return self._prettyPrintByName(name, seen=[], dent=1)[:-2]
return self._prettyPrintByName(name, seen=[], dent=0)[:-2]

@util.positional(2)
def _prettyPrintSchema(self, schema, seen=None, dent=0):
Expand Down Expand Up @@ -155,7 +156,7 @@ def prettyPrintSchema(self, schema):
comments that conforms to the given schema.
"""
# Return with trailing comma and newline removed.
return self._prettyPrintSchema(schema, dent=1)[:-2]
return self._prettyPrintSchema(schema, dent=0)[:-2]

def get(self, name, default=None):
"""Get deserialized JSON schema from the schema name.
Expand Down Expand Up @@ -253,7 +254,9 @@ def _to_str_impl(self, schema):
self.emitEnd("{", schema.get("description", ""))
self.indent()
if "properties" in schema:
for pname, pschema in six.iteritems(schema.get("properties", {})):
properties = schema.get("properties", {})
sorted_properties = OrderedDict(sorted(properties.items()))
for pname, pschema in six.iteritems(sorted_properties):
self.emitBegin('"%s": ' % pname)
self._to_str_impl(pschema)
elif "additionalProperties" in schema:
Expand Down
28 changes: 14 additions & 14 deletions tests/test_schema.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,20 @@ def datafile(filename):


LOAD_FEED = """{
"items": [
{
"longVal": 42,
"kind": "zoo#loadValue",
"enumVal": "A String",
"anyVal": "", # Anything will do.
"nullVal": None,
"stringVal": "A String",
"doubleVal": 3.14,
"booleanVal": True or False, # True or False.
},
],
"kind": "zoo#loadFeed",
}"""
"items": [
{
"longVal": 42,
"kind": "zoo#loadValue",
"enumVal": "A String",
"anyVal": "", # Anything will do.
"nullVal": None,
"stringVal": "A String",
"doubleVal": 3.14,
"booleanVal": True or False, # True or False.
},
],
"kind": "zoo#loadFeed",
}"""


class SchemasTest(unittest.TestCase):
Expand Down

Back | FazBrowse Home | New Git URL