Passed
Pull Request — master (#259)
by Piotr
03:28
created

BasePipeline   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 20
rs 10
wmc 5

2 Methods

Rating   Name   Duplication   Size   Complexity  
A run() 0 12 3
A __init__() 0 4 2
1
from rest_framework import serializers
0 ignored issues
show
Coding Style introduced by
This module should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
introduced by
Unable to import 'rest_framework'
Loading history...
2
3
from djoser import exceptions
4
5
6
def default_view_pipeline_adapter(pipeline, request):
0 ignored issues
show
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
7
    try:
8
        result = pipeline(request).run()
9
    except exceptions.ValidationError as e:
0 ignored issues
show
Coding Style Naming introduced by
The name e does not conform to the variable naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
10
        raise serializers.ValidationError(e.errors)
11
12
    return result.get('response_data')
13
14
15
class BasePipeline(object):
0 ignored issues
show
Coding Style introduced by
This class should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
16
    steps = None
17
18
    def __init__(self, request, steps=None):
19
        self._request = request
20
        if steps is not None:
21
            self.steps = steps
22
23
    def run(self):
0 ignored issues
show
Coding Style introduced by
This method should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
24
        assert self.steps is not None, (
25
            'Pipeline `steps` have not been specified. '
26
            'They are required to run the pipeline.'
27
        )
28
29
        context = {'request': self._request}
30
        for step_func in self.steps:
31
            step_context = step_func(**context) or {}
32
            context.update(step_context)
33
34
        return context
35