Passed
Pull Request — master (#259)
by Piotr
01:21
created

serialize_request()   A

Complexity

Conditions 2

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 10
Bugs 0 Features 0
Metric Value
cc 2
c 10
b 0
f 0
dl 0
loc 7
rs 9.4285
1
from django.contrib.auth import get_user_model
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 'django.contrib.auth'
Loading history...
2
3
from djoser import exceptions, signals
4
from djoser.conf import settings
5
from djoser.pipelines.base import BasePipeline
6
7
User = get_user_model()
0 ignored issues
show
Coding Style Naming introduced by
The name User does not conform to the constant naming conventions ((([A-Z_][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...
8
9
10
def serialize_request(request, **kwargs):
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...
Unused Code introduced by
The argument kwargs seems to be unused.
Loading history...
11
    serializer_class = settings.SERIALIZERS.user_delete
12
    context = {'request': request}
13
    serializer = serializer_class(data=request.data, **{'context': context})
14
    if not serializer.is_valid(raise_exception=False):
15
        raise exceptions.ValidationError(serializer.errors)
16
    return {'serializer': serializer}
17
18
19
def perform(request, **kwargs):
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...
Unused Code introduced by
The argument kwargs seems to be unused.
Loading history...
20
    assert hasattr(request, 'user')
21
22
    user = request.user
23
    request.user.delete()
24
    return {'user': user}
25
26
27
def signal(request, user, **kwargs):
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...
Unused Code introduced by
The argument kwargs seems to be unused.
Loading history...
28
    signals.user_deleted.send(sender=None, user=user, request=request)
29
30
31
class Pipeline(BasePipeline):
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...
32
    steps = settings.PIPELINES.user_delete
33