[Python-modules-commits] [python-social-auth] 75/322: PEP8

Wolfgang Borgert debacle at moszumanska.debian.org
Sat Dec 24 15:12:51 UTC 2016


This is an automated email from the git hooks/post-receive script.

debacle pushed a commit to tag v0.2.10
in repository python-social-auth.

commit 6d97ff65ffca7aefae85f76e1734fa7c75b66f28
Author: Matías Aguirre <matiasaguirre at gmail.com>
Date:   Fri Jan 2 05:00:19 2015 -0200

    PEP8
---
 social/backends/professionali.py | 40 ++++++++++++++++++++++------------------
 1 file changed, 22 insertions(+), 18 deletions(-)

diff --git a/social/backends/professionali.py b/social/backends/professionali.py
index 7f0ca27..5e79ba9 100644
--- a/social/backends/professionali.py
+++ b/social/backends/professionali.py
@@ -1,44 +1,48 @@
 # -*- coding: utf-8 -*-
 """
-professionaly OAuth 2.0 support.
+Professionaly OAuth 2.0 support.
 
 This contribution adds support for professionaly.ru OAuth 2.0.
 Username is retrieved from the identity returned by server.
 """
 from time import time
 
-from social.backends.oauth import BaseOAuth2
 from social.utils import parse_qs
+from social.backends.oauth import BaseOAuth2
 
 
 class ProfessionaliOAuth2(BaseOAuth2):
     name = 'professionali'
     ID_KEY = 'user_id'
-    EXTRA_DATA = [('avatar_big', 'avatar_big'),
-                  ('link', 'link')]
     AUTHORIZATION_URL = 'https://api.professionali.ru/oauth/authorize.html'
     ACCESS_TOKEN_URL = 'https://api.professionali.ru/oauth/getToken.json'
     ACCESS_TOKEN_METHOD = 'POST'
+    EXTRA_DATA = [
+        ('avatar_big', 'avatar_big'),
+        ('link', 'link')
+    ]
 
     def get_user_details(self, response):
         first_name, last_name = map(response.get, ('firstname', 'lastname'))
-        email = (self.setting('FAKE_EMAIL')
-                 and '%s at professionali.ru' % time()
-                 or '')
-        return {'username': '%s_%s' % (last_name, first_name),
-                'first_name': first_name,
-                'last_name': last_name,
-                'email': email}
+        email = ''
+        if self.setting('FAKE_EMAIL'):
+            email = '{0}@professionali.ru'.format(time())
+        return {
+            'username': '{0}_{1}'.format(last_name, first_name),
+            'first_name': first_name,
+            'last_name': last_name,
+            'email': email
+        }
 
     def user_data(self, access_token, response, *args, **kwargs):
         url = 'https://api.professionali.ru/v6/users/get.json'
-        default_fields = list(set(['firstname', 'lastname',
-                                   'avatar_big', 'link']
-                                  + self.setting('EXTRA_DATA', [])))
-        fields = ','.join(default_fields)
-        params = {'fields': fields,
-                  'access_token': access_token,
-                  'ids[]': response['user_id']}
+        fields = list(set(['firstname', 'lastname', 'avatar_big', 'link'] +
+                          self.setting('EXTRA_DATA', [])))
+        params = {
+            'fields': ','.join(fields),
+            'access_token': access_token,
+            'ids[]': response['user_id']
+        }
         try:
             return self.get_json(url, params)[0]
         except (TypeError, KeyError, IOError, ValueError, IndexError):

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-social-auth.git



More information about the Python-modules-commits mailing list