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

Unified Diff: recipe_engine/util.py

Issue 1785543004: Split Placeholder into InputPlaceholder and OutputPlaceholder. (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/recipes-py@master
Patch Set: Simplify InputPlaceholder.cleanup Created 4 years, 9 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 | « recipe_engine/step_runner.py ('k') | recipe_modules/json/api.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: recipe_engine/util.py
diff --git a/recipe_engine/util.py b/recipe_engine/util.py
index 75cd5f9441f5b9eed881ef37bdf4ccedabcaa6e1..200e5c8174050e7f33b86ced479f76ca37e70b7e 100644
--- a/recipe_engine/util.py
+++ b/recipe_engine/util.py
@@ -34,7 +34,7 @@ class ModuleInjectionSite(object):
class Placeholder(object):
- """Base class for json placeholders. Do not use directly."""
+ """Base class for command line argument placeholders. Do not use directly."""
def __init__(self):
self.name_pieces = None
@@ -50,6 +50,25 @@ class Placeholder(object):
"""Return [cmd items]*"""
raise NotImplementedError
+ @property
+ def name(self):
+ assert self.name_pieces
+ return "%s.%s" % self.name_pieces
+
+
+class InputPlaceholder(Placeholder):
+ """Base class for json/raw_io input placeholders. Do not use directly."""
+ def cleanup(self, test_enabled):
+ """Called after step completion.
+
+ Args:
+ test_enabled (bool) - indicate whether running in simulation mode.
+ """
+ pass
+
+
+class OutputPlaceholder(Placeholder):
+ """Base class for json/raw_io output placeholders. Do not use directly."""
def result(self, presentation, test):
"""Called after step completion.
@@ -57,17 +76,11 @@ class Placeholder(object):
presentation (StepPresentation) - for the current step.
test (PlaceholderTestData) - test data for this placeholder.
- Returns value to add to step result.
-
May optionally modify presentation as a side-effect.
+ Returned value will be added to the step result.
"""
pass
- @property
- def name(self):
- assert self.name_pieces
- return "%s.%s" % self.name_pieces
-
def static_wraps(func):
wrapped_fn = func
« no previous file with comments | « recipe_engine/step_runner.py ('k') | recipe_modules/json/api.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698