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

Unified Diff: recipe_modules/raw_io/api.py

Issue 1773273003: Make output placeholders like json.output index-able by name. (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/recipes-py@master
Patch Set: Rebase. 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_modules/json/test_api.py ('k') | recipe_modules/raw_io/example.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: recipe_modules/raw_io/api.py
diff --git a/recipe_modules/raw_io/api.py b/recipe_modules/raw_io/api.py
index ca64afb24a14393be4cde578529e7efc0a6e9f47..01ebf42dfc320e407bbc3fa55b0a5148a6ffa121 100644
--- a/recipe_modules/raw_io/api.py
+++ b/recipe_modules/raw_io/api.py
@@ -43,11 +43,11 @@ class InputDataPlaceholder(recipe_util.InputPlaceholder):
class OutputDataPlaceholder(recipe_util.OutputPlaceholder):
- def __init__(self, suffix, leak_to):
+ def __init__(self, suffix, leak_to, name=None):
self.suffix = suffix
self.leak_to = leak_to
self._backing_file = None
- super(OutputDataPlaceholder, self).__init__()
+ super(OutputDataPlaceholder, self).__init__(name=name)
@property
def backing_file(self):
@@ -81,11 +81,11 @@ class OutputDataPlaceholder(recipe_util.OutputPlaceholder):
class OutputDataDirPlaceholder(recipe_util.OutputPlaceholder):
- def __init__(self, suffix, leak_to):
+ def __init__(self, suffix, leak_to, name=None):
self.suffix = suffix
self.leak_to = leak_to
self._backing_dir = None
- super(OutputDataDirPlaceholder, self).__init__()
+ super(OutputDataDirPlaceholder, self).__init__(name=name)
@property
def backing_file(self): # pragma: no cover
@@ -136,7 +136,7 @@ class RawIOApi(recipe_api.RecipeApi):
@recipe_util.returns_placeholder
@staticmethod
- def output(suffix='', leak_to=None):
+ def output(suffix='', leak_to=None, name=None):
"""Returns a Placeholder for use as a step argument, or for std{out,err}.
If 'leak_to' is None, the placeholder is backed by a temporary file with
@@ -146,11 +146,11 @@ class RawIOApi(recipe_api.RecipeApi):
redirects IO to a file at that path. Once step finishes, the file is
NOT deleted (i.e. it's 'leaking'). 'suffix' is ignored in that case.
"""
- return OutputDataPlaceholder(suffix, leak_to)
+ return OutputDataPlaceholder(suffix, leak_to, name=name)
@recipe_util.returns_placeholder
@staticmethod
- def output_dir(suffix='', leak_to=None):
+ def output_dir(suffix='', leak_to=None, name=None):
"""Returns a directory Placeholder for use as a step argument.
If 'leak_to' is None, the placeholder is backed by a temporary dir with
@@ -160,4 +160,4 @@ class RawIOApi(recipe_api.RecipeApi):
redirects IO to a dir at that path. Once step finishes, the dir is
NOT deleted (i.e. it's 'leaking'). 'suffix' is ignored in that case.
"""
- return OutputDataDirPlaceholder(suffix, leak_to)
+ return OutputDataDirPlaceholder(suffix, leak_to, name=name)
« no previous file with comments | « recipe_modules/json/test_api.py ('k') | recipe_modules/raw_io/example.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698