Total Complexity | 5 |
Total Lines | 20 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | class BasePipeline(object): |
||
2 | steps = None |
||
3 | |||
4 | def __init__(self, request, steps=None): |
||
5 | self._request = request |
||
6 | if steps is not None: |
||
7 | self.steps = steps |
||
8 | |||
9 | def run(self): |
||
10 | assert self.steps is not None, ( |
||
11 | 'Pipeline `steps` have not been specified. ' |
||
12 | 'They are required to run the pipeline.' |
||
13 | ) |
||
14 | |||
15 | context = {'request': self._request} |
||
16 | for step_func in self.steps: |
||
17 | step_context = step_func(self._request, context) or {} |
||
18 | context.update(step_context) |
||
19 | |||
20 | return context |
||
21 |
The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:
If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.