for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
from rest_framework import serializers
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.
from social_core import exceptions
from social_django.utils import load_backend, load_strategy
class ProviderAuthSerializer(serializers.Serializer):
id = serializers.IntegerField(read_only=True)
id
([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$
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.
email = serializers.CharField(read_only=True)
code = serializers.CharField(write_only=True)
state = serializers.CharField(required=False, write_only=True)
def create(self, validated_data):
validated_data
strategy = load_strategy(self.context['request'])
redirect_uri = strategy.session_get('redirect_uri')
backend_name = self.context['view'].kwargs['provider']
backend = load_backend(
strategy, backend_name, redirect_uri=redirect_uri
)
return backend.auth_complete()
def update(self, instance, validated_data):
pass
def validate_state(self, value):
value
try:
backend.validate_state()
except exceptions.AuthException:
raise serializers.ValidationError('State could not be verified.')
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.