Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(702)

Unified Diff: tools/json_schema_compiler/schema_util.py

Issue 10381089: Revert 136296 - Make all extension api types fully qualified. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/json_schema_compiler/model_test.py ('k') | tools/json_schema_compiler/schema_util_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/json_schema_compiler/schema_util.py
===================================================================
--- tools/json_schema_compiler/schema_util.py (revision 136322)
+++ tools/json_schema_compiler/schema_util.py (working copy)
@@ -1,37 +0,0 @@
-# Copyright (c) 2012 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-"""Utilies for the processing of schema python structures.
-"""
-
-def StripSchemaNamespace(s):
- last_dot = s.rfind('.')
- if not last_dot == -1:
- return s[last_dot + 1:]
- return s
-
-def PrefixSchemasWithNamespace(schemas):
- for s in schemas:
- _PrefixWithNamespace(s.get("namespace"), s)
-
-def _MaybePrefixFieldWithNamespace(namespace, schema, key):
- if type(schema) == dict and key in schema:
- old_value = schema[key]
- if not "." in old_value:
- schema[key] = namespace + "." + old_value
-
-def _PrefixTypesWithNamespace(namespace, types):
- for t in types:
- _MaybePrefixFieldWithNamespace(namespace, t, "id")
- _MaybePrefixFieldWithNamespace(namespace, t, "customBindings")
-
-def _PrefixWithNamespace(namespace, schema):
- if type(schema) == dict:
- if "types" in schema:
- _PrefixTypesWithNamespace(namespace, schema.get("types"))
- _MaybePrefixFieldWithNamespace(namespace, schema, "$ref")
- for s in schema:
- _PrefixWithNamespace(namespace, schema[s])
- elif type(schema) == list:
- for s in schema:
- _PrefixWithNamespace(namespace, s)
« no previous file with comments | « tools/json_schema_compiler/model_test.py ('k') | tools/json_schema_compiler/schema_util_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698