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

Unified Diff: recipe_modules/properties/api.py

Issue 2415793003: Setup basic Runtime with properties and platform.
Patch Set: Split out, more immutables, better utilization. Created 4 years, 2 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
Index: recipe_modules/properties/api.py
diff --git a/recipe_modules/properties/api.py b/recipe_modules/properties/api.py
index 305b5d1698061a4cbc747e48ba6e91ae33079645..5de2cf4f8bb7630372f5891772ff19cad6ff3055 100644
--- a/recipe_modules/properties/api.py
+++ b/recipe_modules/properties/api.py
@@ -3,7 +3,6 @@
# that can be found in the LICENSE file.
from recipe_engine import recipe_api
-from recipe_engine.types import freeze
import collections
# Use RecipeApiPlain because collections.Mapping has its own metaclass.
@@ -21,25 +20,14 @@ class PropertiesApi(recipe_api.RecipeApiPlain, collections.Mapping):
properties_client = recipe_api.RequireClient('properties')
- def __init__(self, **kwargs):
- super(PropertiesApi, self).__init__(**kwargs)
- self._frozen_properties = None
-
- @property
- def _properties(self):
- if self._frozen_properties is None:
- self._frozen_properties = freeze(
- self.properties_client.get_properties())
- return self._frozen_properties
-
def __getitem__(self, key):
- return self._properties[key]
+ return self.properties_client.properties[key]
def __len__(self):
- return len(self._properties)
+ return len(self.properties_client.properties)
def __iter__(self):
- return iter(self._properties)
+ return iter(self.properties_client.properties)
def legacy(self): # pragma: no cover
"""Returns a reduced set of properties, possibly used by legacy scripts."""
@@ -54,4 +42,4 @@ class PropertiesApi(recipe_api.RecipeApiPlain, collections.Mapping):
def thaw(self):
"""Returns a vanilla python jsonish dictionary of properties."""
- return self.properties_client.get_properties()
+ return self.properties_client.mutable_properties()
« recipe_engine/recipe_api.py ('K') | « recipe_modules/platform/api.py ('k') | recipes.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698