Browse Source

some further yapf format tweaks

Rafał Pitoń 8 years ago
parent
commit
04db8546dd

+ 1 - 3
.style.yapf

@@ -8,6 +8,4 @@ join_multiple_lines = false
 split_arguments_when_comma_terminated = true
 split_before_first_argument = true
 split_before_logical_operator = true
-split_before_named_assigns = true
-split_penalty_after_opening_bracket = 200
-split_penalty_excess_character = 200
+split_before_named_assigns = true

+ 15 - 3
misago/conf/tests/test_admin_views.py

@@ -17,7 +17,11 @@ class AdminSettingsViewsTests(AdminTestCase):
 
         self.assertEqual(response.status_code, 200)
         for group in SettingsGroup.objects.all():
-            group_link = reverse('misago:admin:system:settings:group', kwargs={'key': group.key})
+            group_link = reverse(
+                'misago:admin:system:settings:group', kwargs={
+                    'key': group.key,
+                }
+            )
             self.assertContains(response, group.name)
             self.assertContains(response, group_link)
 
@@ -25,7 +29,11 @@ class AdminSettingsViewsTests(AdminTestCase):
         """
         invalid group results in redirect to settings list
         """
-        group_link = reverse('misago:admin:system:settings:group', kwargs={'key': 'invalid-group'})
+        group_link = reverse(
+            'misago:admin:system:settings:group', kwargs={
+                'key': 'invalid-group',
+            }
+        )
         response = self.client.get(group_link)
         self.assertEqual(response.status_code, 302)
         self.assertTrue(reverse('misago:admin:system:settings:index') in response['location'])
@@ -35,7 +43,11 @@ class AdminSettingsViewsTests(AdminTestCase):
         each settings group view returns 200 and contains all settings in group
         """
         for group in SettingsGroup.objects.all():
-            group_link = reverse('misago:admin:system:settings:group', kwargs={'key': group.key})
+            group_link = reverse(
+                'misago:admin:system:settings:group', kwargs={
+                    'key': group.key,
+                }
+            )
             response = self.client.get(group_link)
 
             self.assertEqual(response.status_code, 200)

+ 3 - 3
misago/conf/tests/test_migrationutils.py

@@ -70,16 +70,16 @@ class DBConfMigrationUtilsTests(TestCase):
                 'value': "Eric",
                 'field_extra': {
                     'min_length': 2,
-                    'max_length': 255
+                    'max_length': 255,
                 },
             }, {
                 'setting': 'fish_new_license_no',
                 'name': "Fish's changed license number",
                 'default_value': '123-456',
                 'field_extra': {
-                    'max_length': 255
+                    'max_length': 255,
                 },
-            }, )
+            }, ),
         }
 
         migrationutils.migrate_settings_group(

+ 17 - 4
misago/conf/tests/test_models.py

@@ -6,13 +6,22 @@ from misago.conf.models import Setting
 class SettingModelTests(TestCase):
     def test_real_value(self):
         """setting returns real value correctyly"""
-        setting_model = Setting(python_type='list', dry_value='')
+        setting_model = Setting(
+            python_type='list',
+            dry_value='',
+        )
         self.assertEqual(setting_model.value, [])
 
-        setting_model = Setting(python_type='list', dry_value='Arthur,Lancelot,Patsy')
+        setting_model = Setting(
+            python_type='list',
+            dry_value='Arthur,Lancelot,Patsy',
+        )
         self.assertEqual(setting_model.value, ['Arthur', 'Lancelot', 'Patsy'])
 
-        setting_model = Setting(python_type='list', default_value='Arthur,Patsy')
+        setting_model = Setting(
+            python_type='list',
+            default_value='Arthur,Patsy',
+        )
         self.assertEqual(setting_model.value, ['Arthur', 'Patsy'])
 
         setting_model = Setting(
@@ -22,7 +31,11 @@ class SettingModelTests(TestCase):
 
     def test_set_value(self):
         """setting sets value correctyly"""
-        setting_model = Setting(python_type='int', dry_value='42', default_value='9001')
+        setting_model = Setting(
+            python_type='int',
+            dry_value='42',
+            default_value='9001',
+        )
 
         setting_model.value = 3000
         self.assertEqual(setting_model.value, 3000)

+ 5 - 5
misago/conf/tests/test_settings.py

@@ -53,19 +53,19 @@ class GatewaySettingsTests(TestCase):
                 'value': "Public Eric",
                 'field_extra': {
                     'min_length': 2,
-                    'max_length': 255
+                    'max_length': 255,
                 },
-                'is_public': True
+                'is_public': True,
             }, {
                 'setting': 'private_fish_name',
                 'name': "Fish's name",
                 'value': "Private Eric",
                 'field_extra': {
                     'min_length': 2,
-                    'max_length': 255
+                    'max_length': 255,
                 },
-                'is_public': False
-            }, )
+                'is_public': False,
+            }, ),
         }
 
         migrate_settings_group(apps, test_group)

+ 3 - 1
misago/threads/api/postendpoints/merge.py

@@ -95,7 +95,9 @@ def clean_posts_for_merge(request, thread):
                     raise MergeError(authorship_error)
 
             if posts[0].pk != thread.first_post_id:
-                if posts[0].is_hidden != post.is_hidden or posts[0].is_unapproved != post.is_unapproved:
+                if posts[0].is_hidden != post.is_hidden or posts[
+                        0
+                ].is_unapproved != post.is_unapproved:
                     raise MergeError(_("Posts with different visibility can't be merged."))
 
             posts.append(post)

+ 2 - 1
misago/threads/api/postingendpoint/floodprotection.py

@@ -13,7 +13,8 @@ MIN_POSTING_PAUSE = 3
 
 class FloodProtectionMiddleware(PostingMiddleware):
     def use_this_middleware(self):
-        return not self.user.acl_cache['can_omit_flood_protection'] and self.mode != PostingEndpoint.EDIT
+        return not self.user.acl_cache['can_omit_flood_protection'
+                                       ] and self.mode != PostingEndpoint.EDIT
 
     def interrupt_posting(self, serializer):
         now = timezone.now()

+ 2 - 1
misago/threads/tests/test_threadslists.py

@@ -362,7 +362,8 @@ class AllThreadsListTests(ThreadsListTestCase):
 
         for thread in threads[:settings.MISAGO_THREADS_PER_PAGE]:
             self.assertNotContains(response, thread.get_absolute_url())
-        for thread in threads[settings.MISAGO_THREADS_PER_PAGE:settings.MISAGO_THREADS_PER_PAGE * 2]:
+        for thread in threads[settings.MISAGO_THREADS_PER_PAGE:settings.MISAGO_THREADS_PER_PAGE * 2
+                              ]:
             self.assertContains(response, thread.get_absolute_url())
         for thread in threads[settings.MISAGO_THREADS_PER_PAGE * 2:]:
             self.assertNotContains(response, thread.get_absolute_url())

+ 2 - 1
misago/users/search.py

@@ -46,7 +46,8 @@ def search_users(**filters):
     # lets grab head and tail results:
     results += list(queryset.filter(slug__startswith=username)[:HEAD_RESULTS])
     results += list(
-        queryset.filter(slug__contains=username).exclude(pk__in=[r.pk for r in results])[:TAIL_RESULTS]
+        queryset.filter(slug__contains=username).exclude(pk__in=[r.pk
+                                                                 for r in results])[:TAIL_RESULTS]
     )
 
     return results

+ 3 - 2
misago/users/serializers/auth.py

@@ -32,8 +32,9 @@ class AuthenticatedUserSerializer(UserSerializer, AuthFlags):
     class Meta:
         model = UserModel
         fields = UserSerializer.Meta.fields + (
-            'is_hiding_presence', 'limits_private_thread_invites_to', 'subscribe_to_started_threads',
-            'subscribe_to_replied_threads', 'is_authenticated', 'is_anonymous',
+            'is_hiding_presence', 'limits_private_thread_invites_to',
+            'subscribe_to_started_threads', 'subscribe_to_replied_threads', 'is_authenticated',
+            'is_anonymous',
         )
 
     def get_acl(self, obj):