зеркало из https://github.com/mozilla/kitsune.git
Fix new lint errors.
This commit is contained in:
Родитель
2efa521263
Коммит
58fc925204
|
@ -328,8 +328,8 @@ def l10n_overview_rows(locale, product=None):
|
|||
'SELECT COUNT(*) FROM wiki_document transdoc '
|
||||
'INNER JOIN wiki_document engdoc ON transdoc.parent_id=engdoc.id '
|
||||
'INNER JOIN wiki_revision curtransrev '
|
||||
' ON transdoc.current_revision_id=curtransrev.id '
|
||||
+ extra_joins +
|
||||
' ON transdoc.current_revision_id=curtransrev.id ' +
|
||||
extra_joins +
|
||||
'WHERE transdoc.locale=%s '
|
||||
' AND engdoc.category NOT IN '
|
||||
' (' + ','.join(ignore_categories) + ')'
|
||||
|
@ -591,8 +591,8 @@ class MostVisitedDefaultLanguageReadout(Readout):
|
|||
'LEFT JOIN wiki_revision engrev ON '
|
||||
' engrev.document_id=engdoc.id '
|
||||
' AND engrev.reviewed IS NULL '
|
||||
' AND engrev.id>engdoc.current_revision_id '
|
||||
+ extra_joins +
|
||||
' AND engrev.id>engdoc.current_revision_id ' +
|
||||
extra_joins +
|
||||
'WHERE engdoc.locale=%s AND '
|
||||
'NOT engdoc.is_archived AND '
|
||||
'NOT engdoc.category IN (' + (
|
||||
|
@ -650,8 +650,8 @@ class CategoryReadout(Readout):
|
|||
'FROM wiki_document engdoc '
|
||||
'LEFT JOIN dashboards_wikidocumentvisits ON '
|
||||
' engdoc.id=dashboards_wikidocumentvisits.document_id '
|
||||
' AND dashboards_wikidocumentvisits.period=%s '
|
||||
+ extra_joins +
|
||||
' AND dashboards_wikidocumentvisits.period=%s ' +
|
||||
extra_joins +
|
||||
'WHERE engdoc.locale=%s AND '
|
||||
' NOT engdoc.is_archived ' + (
|
||||
self.where_clause) +
|
||||
|
@ -816,8 +816,8 @@ class TemplateTranslationsReadout(Readout):
|
|||
'FROM wiki_document engdoc '
|
||||
'LEFT JOIN wiki_document transdoc ON '
|
||||
' transdoc.parent_id=engdoc.id '
|
||||
' AND transdoc.locale=%s '
|
||||
+ extra_joins +
|
||||
' AND transdoc.locale=%s ' +
|
||||
extra_joins +
|
||||
'WHERE engdoc.locale=%s '
|
||||
' AND engdoc.is_localizable '
|
||||
' AND NOT engdoc.is_archived '
|
||||
|
@ -884,14 +884,14 @@ class UnreviewedReadout(Readout):
|
|||
'LEFT JOIN dashboards_wikidocumentvisits ON '
|
||||
' wiki_document.' + english_id +
|
||||
' =dashboards_wikidocumentvisits.document_id AND '
|
||||
' dashboards_wikidocumentvisits.period=%s '
|
||||
+ extra_joins +
|
||||
' dashboards_wikidocumentvisits.period=%s ' +
|
||||
extra_joins +
|
||||
'WHERE wiki_revision.reviewed IS NULL '
|
||||
'AND (wiki_document.current_revision_id IS NULL OR '
|
||||
' wiki_revision.id>wiki_document.current_revision_id) '
|
||||
'AND wiki_document.locale=%s AND NOT wiki_document.is_archived '
|
||||
'GROUP BY wiki_document.id '
|
||||
+ self._order_clause() + self._limit_clause(max))
|
||||
'GROUP BY wiki_document.id ' +
|
||||
self._order_clause() + self._limit_clause(max))
|
||||
|
||||
return query, params
|
||||
|
||||
|
@ -1001,8 +1001,8 @@ class UnreadyForLocalizationReadout(Readout):
|
|||
' engdoc.id=wiki_revision.document_id '
|
||||
'LEFT JOIN dashboards_wikidocumentvisits visits ON '
|
||||
' engdoc.id=visits.document_id AND '
|
||||
' visits.period=%s '
|
||||
+ extra_joins +
|
||||
' visits.period=%s ' +
|
||||
extra_joins +
|
||||
'WHERE engdoc.locale=%s ' # shouldn't be necessary
|
||||
'AND NOT engdoc.is_archived '
|
||||
'AND engdoc.is_localizable '
|
||||
|
@ -1019,8 +1019,8 @@ class UnreadyForLocalizationReadout(Readout):
|
|||
'AND (wiki_revision.id>'
|
||||
' engdoc.latest_localizable_revision_id OR '
|
||||
' engdoc.latest_localizable_revision_id IS NULL) '
|
||||
'GROUP BY engdoc.id '
|
||||
+ self._order_clause() + self._limit_clause(max))
|
||||
'GROUP BY engdoc.id ' +
|
||||
self._order_clause() + self._limit_clause(max))
|
||||
|
||||
return query, params
|
||||
|
||||
|
@ -1068,13 +1068,13 @@ class NeedsChangesReadout(Readout):
|
|||
'FROM wiki_document engdoc '
|
||||
'LEFT JOIN dashboards_wikidocumentvisits visits ON '
|
||||
' engdoc.id=visits.document_id AND '
|
||||
' visits.period=%s '
|
||||
+ extra_joins +
|
||||
' visits.period=%s ' +
|
||||
extra_joins +
|
||||
'WHERE engdoc.locale=%s ' # shouldn't be necessary
|
||||
'AND engdoc.needs_change '
|
||||
'AND NOT engdoc.is_archived '
|
||||
'GROUP BY engdoc.id '
|
||||
+ self._order_clause() + self._limit_clause(max))
|
||||
'GROUP BY engdoc.id ' +
|
||||
self._order_clause() + self._limit_clause(max))
|
||||
|
||||
return query, params
|
||||
|
||||
|
@ -1128,13 +1128,13 @@ class CannedResponsesReadout(Readout):
|
|||
' AND transdoc.locale=%s '
|
||||
'LEFT JOIN dashboards_wikidocumentvisits engvisits ON '
|
||||
' engdoc.id=engvisits.document_id '
|
||||
' AND engvisits.period=%s '
|
||||
+ extra_joins +
|
||||
' AND engvisits.period=%s ' +
|
||||
extra_joins +
|
||||
'WHERE engdoc.category = %s '
|
||||
' AND engdoc.locale = %s '
|
||||
' AND NOT engdoc.is_archived '
|
||||
'ORDER BY engvisits.visits DESC '
|
||||
+ self._limit_clause(max)
|
||||
'ORDER BY engvisits.visits DESC ' +
|
||||
self._limit_clause(max)
|
||||
)
|
||||
|
||||
return query, params
|
||||
|
|
|
@ -10,8 +10,8 @@ def global_settings(request):
|
|||
|
||||
|
||||
def i18n(request):
|
||||
return {'LANG': (settings.LANGUAGE_URL_MAP.get(translation.get_language())
|
||||
or translation.get_language()),
|
||||
return {'LANG': (settings.LANGUAGE_URL_MAP.get(translation.get_language()) or
|
||||
translation.get_language()),
|
||||
'DIR': 'rtl' if translation.get_language_bidi() else 'ltr'}
|
||||
|
||||
|
||||
|
|
|
@ -24,10 +24,10 @@ def send_postatus_errors():
|
|||
return
|
||||
|
||||
def new_section(line):
|
||||
return (line.startswith('dennis ')
|
||||
or line.startswith('Totals')
|
||||
or line.startswith('BUSTED')
|
||||
or line.startswith('COMPILED'))
|
||||
return (line.startswith('dennis ') or
|
||||
line.startswith('Totals') or
|
||||
line.startswith('BUSTED') or
|
||||
line.startswith('COMPILED'))
|
||||
|
||||
# Download the postatus file
|
||||
postatus = requests.get('https://support.mozilla.org/media/postatus.txt')
|
||||
|
|
|
@ -143,10 +143,10 @@ class RemoveSlashMiddleware(object):
|
|||
"""
|
||||
|
||||
def process_response(self, request, response):
|
||||
if (response.status_code == 404
|
||||
and request.path_info.endswith('/')
|
||||
and not is_valid_path(request.path_info)
|
||||
and is_valid_path(request.path_info[:-1])):
|
||||
if (response.status_code == 404 and
|
||||
request.path_info.endswith('/') and
|
||||
not is_valid_path(request.path_info) and
|
||||
is_valid_path(request.path_info[:-1])):
|
||||
# Use request.path because we munged app/locale in path_info.
|
||||
newurl = request.path[:-1]
|
||||
if request.GET:
|
||||
|
|
|
@ -74,8 +74,8 @@ def handle403(request):
|
|||
no_cookies = False
|
||||
referer = request.META.get('HTTP_REFERER')
|
||||
if referer:
|
||||
no_cookies = (referer.endswith(reverse('users.login'))
|
||||
or referer.endswith(reverse('users.register')))
|
||||
no_cookies = (referer.endswith(reverse('users.login')) or
|
||||
referer.endswith(reverse('users.register')))
|
||||
|
||||
return render(request, 'handlers/403.html', {
|
||||
'form': AuthenticationForm(),
|
||||
|
|
|
@ -14,7 +14,7 @@ from waffle.views import wafflejs
|
|||
from kitsune.sumo.monkeypatch import patch
|
||||
patch()
|
||||
|
||||
from django.contrib import admin
|
||||
from django.contrib import admin # noqa
|
||||
admin.autodiscover()
|
||||
|
||||
authority.autodiscover()
|
||||
|
|
|
@ -37,8 +37,8 @@ class LogoutDeactivatedUsersMiddleware(object):
|
|||
def process_request(self, request):
|
||||
user = request.user
|
||||
|
||||
if (user.is_authenticated() and not user.is_active
|
||||
and not request.session.get('in-aaq', False)):
|
||||
if (user.is_authenticated() and not user.is_active and
|
||||
not request.session.get('in-aaq', False)):
|
||||
|
||||
# The user is auth'd, not active and not in AAQ. /KICK
|
||||
logout(request)
|
||||
|
|
|
@ -323,8 +323,8 @@ def profile(request, template, username):
|
|||
|
||||
user_profile = get_object_or_404(Profile, user__id=user.id)
|
||||
|
||||
if not (request.user.has_perm('users.deactivate_users')
|
||||
or user_profile.user.is_active):
|
||||
if not (request.user.has_perm('users.deactivate_users') or
|
||||
user_profile.user.is_active):
|
||||
raise Http404('No Profile matches the given query.')
|
||||
|
||||
groups = user_profile.user.groups.all()
|
||||
|
|
|
@ -197,8 +197,8 @@ class DocumentForm(forms.ModelForm):
|
|||
# Create the share link if it doesn't exist and is in
|
||||
# a category it should show for.
|
||||
doc.save()
|
||||
if (doc.category in settings.IA_DEFAULT_CATEGORIES
|
||||
and not doc.share_link):
|
||||
if (doc.category in settings.IA_DEFAULT_CATEGORIES and
|
||||
not doc.share_link):
|
||||
# This operates under the constraints of passing in a list.
|
||||
add_short_links.delay([doc.pk])
|
||||
|
||||
|
|
|
@ -266,8 +266,7 @@ class ForParser(object):
|
|||
# distance it from the preceding paragraph, take them into
|
||||
# account before adding more.
|
||||
prespace += paragraph_padding(
|
||||
preceding_whitespace(match.string, match.start(1))
|
||||
+ prespace)
|
||||
preceding_whitespace(match.string, match.start(1)) + prespace)
|
||||
|
||||
# If tag (including trailing whitespace) wasn't at the bottom
|
||||
# of the document, space it off from following block elements:
|
||||
|
|
|
@ -44,9 +44,9 @@ class ProductTopicsAndSubtopicsWidget(forms.widgets.SelectMultiple):
|
|||
def process_topic(self, value, topic):
|
||||
if isinstance(value, (int, long)) and topic.id == value:
|
||||
topic.checked = True
|
||||
elif (not isinstance(value, basestring)
|
||||
and isinstance(value, collections.Iterable)
|
||||
and topic.id in value):
|
||||
elif (not isinstance(value, basestring) and
|
||||
isinstance(value, collections.Iterable) and
|
||||
topic.id in value):
|
||||
topic.checked = True
|
||||
else:
|
||||
topic.checked = False
|
||||
|
|
|
@ -1,26 +1,12 @@
|
|||
#!/usr/bin/env python
|
||||
import os
|
||||
import site
|
||||
import sys
|
||||
|
||||
from dennis.cmdline import click_run
|
||||
|
||||
ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
path = lambda *a: os.path.join(ROOT, *a)
|
||||
|
||||
prev_sys_path = list(sys.path)
|
||||
|
||||
site.addsitedir(path('vendor'))
|
||||
|
||||
# Move the new items to the front of sys.path.
|
||||
new_sys_path = []
|
||||
for item in list(sys.path):
|
||||
if item not in prev_sys_path:
|
||||
new_sys_path.append(item)
|
||||
sys.path.remove(item)
|
||||
sys.path[:0] = new_sys_path
|
||||
|
||||
# Now we can import from third-party libraries.
|
||||
from dennis.cmdline import click_run
|
||||
def path(components):
|
||||
return os.path.join(ROOT, *components)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
|
@ -22,10 +22,10 @@ SCRIPTS_DIR = os.path.dirname(__file__)
|
|||
site.addsitedir(os.path.join(SCRIPTS_DIR, '..', 'vendor'))
|
||||
|
||||
|
||||
import sys
|
||||
from collections import defaultdict
|
||||
import sys # noqa
|
||||
from collections import defaultdict # noqa
|
||||
|
||||
import polib
|
||||
import polib # noqa
|
||||
|
||||
|
||||
USAGE = 'usage: localestats.py <locales-dir>'
|
||||
|
|
Загрузка…
Ссылка в новой задаче