| OLD | NEW |
| 1 # Copyright 2014 Google Inc. All Rights Reserved. | 1 # Copyright 2014 Google Inc. All Rights Reserved. |
| 2 # | 2 # |
| 3 # Licensed under the Apache License, Version 2.0 (the "License"); | 3 # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 # you may not use this file except in compliance with the License. | 4 # you may not use this file except in compliance with the License. |
| 5 # You may obtain a copy of the License at | 5 # You may obtain a copy of the License at |
| 6 # | 6 # |
| 7 # http://www.apache.org/licenses/LICENSE-2.0 | 7 # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 # | 8 # |
| 9 # Unless required by applicable law or agreed to in writing, software | 9 # Unless required by applicable law or agreed to in writing, software |
| 10 # distributed under the License is distributed on an "AS IS" BASIS, | 10 # distributed under the License is distributed on an "AS IS" BASIS, |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 | 56 |
| 57 The constructor takes a discovery document in which to look up named schema. | 57 The constructor takes a discovery document in which to look up named schema. |
| 58 """ | 58 """ |
| 59 | 59 |
| 60 # TODO(jcgregorio) support format, enum, minimum, maximum | 60 # TODO(jcgregorio) support format, enum, minimum, maximum |
| 61 | 61 |
| 62 __author__ = 'jcgregorio@google.com (Joe Gregorio)' | 62 __author__ = 'jcgregorio@google.com (Joe Gregorio)' |
| 63 | 63 |
| 64 import copy | 64 import copy |
| 65 | 65 |
| 66 from third_party.oauth2client import util | 66 from oauth2client import util |
| 67 | 67 |
| 68 | 68 |
| 69 class Schemas(object): | 69 class Schemas(object): |
| 70 """Schemas for an API.""" | 70 """Schemas for an API.""" |
| 71 | 71 |
| 72 def __init__(self, discovery): | 72 def __init__(self, discovery): |
| 73 """Constructor. | 73 """Constructor. |
| 74 | 74 |
| 75 Args: | 75 Args: |
| 76 discovery: object, Deserialized discovery document from which we pull | 76 discovery: object, Deserialized discovery document from which we pull |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 from_cache: callable(name, seen), Callable that retrieves an object | 302 from_cache: callable(name, seen), Callable that retrieves an object |
| 303 prototype for a schema with the given name. Seen is a list of schema | 303 prototype for a schema with the given name. Seen is a list of schema |
| 304 names already seen as we recursively descend the schema definition. | 304 names already seen as we recursively descend the schema definition. |
| 305 | 305 |
| 306 Returns: | 306 Returns: |
| 307 Prototype object based on the schema, in Python code with comments. | 307 Prototype object based on the schema, in Python code with comments. |
| 308 The lines of the code will all be properly indented. | 308 The lines of the code will all be properly indented. |
| 309 """ | 309 """ |
| 310 self.from_cache = from_cache | 310 self.from_cache = from_cache |
| 311 return self._to_str_impl(self.schema) | 311 return self._to_str_impl(self.schema) |
| OLD | NEW |