From 5f51339e9f9b6a7499af03919461f3cf5ae2a70b Mon Sep 17 00:00:00 2001 From: Sergio Oliveira Date: Wed, 28 Jan 2015 15:01:04 -0200 Subject: [PATCH] Fixed missing flake8 checks --- colab/api/resources.py | 100 ++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------------------------- colab/badger/tests.py | 2 +- colab/badger/utils.py | 40 ++++++++++++++++++++-------------------- colab/home/models.py | 2 +- colab/home/tests.py | 2 +- colab/home/views.py | 28 ++++++++++++++-------------- colab/planet/admin.py | 2 +- colab/planet/models.py | 2 +- colab/planet/tests.py | 2 +- colab/planet/views.py | 2 +- colab/search/admin.py | 2 +- colab/search/models.py | 2 +- colab/search/tests.py | 2 +- colab/search/views.py | 238 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------------------------------------------------------------------------------------------- colab/super_archives/apps.py | 2 +- colab/super_archives/management/commands/message.py | 8 ++++---- colab/super_archives/search_indexes.py | 4 ++-- colab/super_archives/utils/url.py | 2 +- colab/super_archives/views.py | 2 +- 19 files changed, 222 insertions(+), 222 deletions(-) diff --git a/colab/api/resources.py b/colab/api/resources.py index 37f82fa..38baa71 100644 --- a/colab/api/resources.py +++ b/colab/api/resources.py @@ -7,7 +7,7 @@ from tastypie.constants import ALL_WITH_RELATIONS, ALL from tastypie.resources import ModelResource from colab.super_archives.models import Message, EmailAddress -#from proxy.trac.models import Revision, Ticket, Wiki +# from proxy.trac.models import Revision, Ticket, Wiki User = get_user_model() @@ -65,56 +65,56 @@ class MessageResource(ModelResource): } -#class RevisionResource(ModelResource): -# class Meta: -# queryset = Revision.objects.all() -# resource_name = 'revision' -# excludes = ['collaborators', ] -# filtering = { -# 'key': ALL, -# 'rev': ALL, -# 'author': ALL, -# 'message': ALL, -# 'repository_name': ALL, -# 'created': ALL, -# } +# class RevisionResource(ModelResource): +# class Meta: +# queryset = Revision.objects.all() +# resource_name = 'revision' +# excludes = ['collaborators', ] +# filtering = { +# 'key': ALL, +# 'rev': ALL, +# 'author': ALL, +# 'message': ALL, +# 'repository_name': ALL, +# 'created': ALL, +# } # # -#class TicketResource(ModelResource): -# class Meta: -# queryset = Ticket.objects.all() -# resource_name = 'ticket' -# excludes = ['collaborators', ] -# filtering = { -# 'id': ALL, -# 'summary': ALL, -# 'description': ALL, -# 'milestone': ALL, -# 'priority': ALL, -# 'component': ALL, -# 'version': ALL, -# 'severity': ALL, -# 'reporter': ALL, -# 'author': ALL, -# 'status': ALL, -# 'keywords': ALL, -# 'created': ALL, -# 'modified': ALL, -# 'modified_by': ALL, -# } +# class TicketResource(ModelResource): +# class Meta: +# queryset = Ticket.objects.all() +# resource_name = 'ticket' +# excludes = ['collaborators', ] +# filtering = { +# 'id': ALL, +# 'summary': ALL, +# 'description': ALL, +# 'milestone': ALL, +# 'priority': ALL, +# 'component': ALL, +# 'version': ALL, +# 'severity': ALL, +# 'reporter': ALL, +# 'author': ALL, +# 'status': ALL, +# 'keywords': ALL, +# 'created': ALL, +# 'modified': ALL, +# 'modified_by': ALL, +# } # # -#class WikiResource(ModelResource): -# class Meta: -# queryset = Wiki.objects.all() -# resource_name = 'wiki' -# excludes = ['collaborators', ] -# filtering = { -# 'name': ALL, -# 'wiki_text': ALL, -# 'author': ALL, -# 'name': ALL, -# 'created': ALL, -# 'modified': ALL, -# 'modified_by': ALL, -# } +# class WikiResource(ModelResource): +# class Meta: +# queryset = Wiki.objects.all() +# resource_name = 'wiki' +# excludes = ['collaborators', ] +# filtering = { +# 'name': ALL, +# 'wiki_text': ALL, +# 'author': ALL, +# 'name': ALL, +# 'created': ALL, +# 'modified': ALL, +# 'modified_by': ALL, +# } diff --git a/colab/badger/tests.py b/colab/badger/tests.py index e88a4a2..55be646 100644 --- a/colab/badger/tests.py +++ b/colab/badger/tests.py @@ -1,4 +1,4 @@ # uncomment the import if you really use. -#from django.test import TestCase +# from django.test import TestCase # Create your tests here. diff --git a/colab/badger/utils.py b/colab/badger/utils.py index 4270b9e..3037ca0 100644 --- a/colab/badger/utils.py +++ b/colab/badger/utils.py @@ -2,40 +2,40 @@ from django.db.models import Count -#from proxy.trac.models import (Ticket, Wiki) -#from proxy.trac.models import (Revision, WikiCollabCount, TicketCollabCount) +# from proxy.trac.models import (Ticket, Wiki) +# from proxy.trac.models import (Revision, WikiCollabCount, TicketCollabCount) from colab.accounts.models import User -#def get_wiki_counters(): -# return {author: count for author, count in -# WikiCollabCount.objects.values_list()} +# def get_wiki_counters(): +# return {author: count for author, count in +# WikiCollabCount.objects.values_list()} -#def get_revision_counters(): -# return { -# author: count for author, count in Revision.objects.values_list( -# 'author' -# ).annotate(count=Count('author')) -# } +# def get_revision_counters(): +# return { +# author: count for author, count in Revision.objects.values_list( +# 'author' +# ).annotate(count=Count('author')) +# } -#def get_ticket_counters(): -# return {author: count for author, count in -# TicketCollabCount.objects.values_list()} +# def get_ticket_counters(): +# return {author: count for author, count in +# TicketCollabCount.objects.values_list()} def get_users_counters(): - #wiki_counters = get_wiki_counters() - #revision_counters = get_revision_counters() - #ticket_counters = get_ticket_counters() + # wiki_counters = get_wiki_counters() + # revision_counters = get_revision_counters() + # ticket_counters = get_ticket_counters() users_counters = {} for user in User.objects.annotate(message_count=Count('emails__message')): users_counters[user.username] = { 'messages': user.message_count, - #'wikis': wiki_counters.get(user.username, 0), - #'revisions': revision_counters.get(user.username, 0), - #'tickets': ticket_counters.get(user.username, 0), + # 'wikis': wiki_counters.get(user.username, 0), + # 'revisions': revision_counters.get(user.username, 0), + # 'tickets': ticket_counters.get(user.username, 0), } return users_counters diff --git a/colab/home/models.py b/colab/home/models.py index eb2ad62..b47bc55 100644 --- a/colab/home/models.py +++ b/colab/home/models.py @@ -1,4 +1,4 @@ # uncomment the import if you really use. -#from django.db import models +# from django.db import models # Create your models here. diff --git a/colab/home/tests.py b/colab/home/tests.py index e88a4a2..55be646 100644 --- a/colab/home/tests.py +++ b/colab/home/tests.py @@ -1,4 +1,4 @@ # uncomment the import if you really use. -#from django.test import TestCase +# from django.test import TestCase # Create your tests here. diff --git a/colab/home/views.py b/colab/home/views.py index 1399392..832048a 100644 --- a/colab/home/views.py +++ b/colab/home/views.py @@ -8,7 +8,7 @@ from django.http import HttpResponse, Http404 from haystack.query import SearchQuerySet -#from proxy.trac.models import WikiCollabCount, TicketCollabCount +# from proxy.trac.models import WikiCollabCount, TicketCollabCount from colab.search.utils import trans from colab.super_archives.models import Thread @@ -25,19 +25,19 @@ def dashboard(request): type='thread', ).count() # TODO: this section should be inside trac app and only use it here - #if settings.TRAC_ENABLED: - # for type in ['changeset', 'attachment']: - # count_types[type] = SearchQuerySet().filter( - # type=type, - # ).count() - - # count_types['ticket'] = sum([ - # ticket.count for ticket in TicketCollabCount.objects.all() - # ]) - - # count_types['wiki'] = sum([ - # wiki.count for wiki in WikiCollabCount.objects.all() - # ]) + # if settings.TRAC_ENABLED: + # for type in ['changeset', 'attachment']: + # count_types[type] = SearchQuerySet().filter( + # type=type, + # ).count() + + # count_types['ticket'] = sum([ + # ticket.count for ticket in TicketCollabCount.objects.all() + # ]) + + # count_types['wiki'] = sum([ + # wiki.count for wiki in WikiCollabCount.objects.all() + # ]) cache.set('home_chart', count_types) diff --git a/colab/planet/admin.py b/colab/planet/admin.py index 6e63521..2e9147e 100644 --- a/colab/planet/admin.py +++ b/colab/planet/admin.py @@ -1,4 +1,4 @@ # uncomment the import if you really use. -#from django.contrib import admin +# from django.contrib import admin # Register your models here. diff --git a/colab/planet/models.py b/colab/planet/models.py index eb2ad62..b47bc55 100644 --- a/colab/planet/models.py +++ b/colab/planet/models.py @@ -1,4 +1,4 @@ # uncomment the import if you really use. -#from django.db import models +# from django.db import models # Create your models here. diff --git a/colab/planet/tests.py b/colab/planet/tests.py index e88a4a2..55be646 100644 --- a/colab/planet/tests.py +++ b/colab/planet/tests.py @@ -1,4 +1,4 @@ # uncomment the import if you really use. -#from django.test import TestCase +# from django.test import TestCase # Create your tests here. diff --git a/colab/planet/views.py b/colab/planet/views.py index de8a5a0..70ce736 100644 --- a/colab/planet/views.py +++ b/colab/planet/views.py @@ -1,4 +1,4 @@ # uncomment the import if you really use. -#from django.shortcuts import render +# from django.shortcuts import render # Create your views here. diff --git a/colab/search/admin.py b/colab/search/admin.py index 6e63521..2e9147e 100644 --- a/colab/search/admin.py +++ b/colab/search/admin.py @@ -1,4 +1,4 @@ # uncomment the import if you really use. -#from django.contrib import admin +# from django.contrib import admin # Register your models here. diff --git a/colab/search/models.py b/colab/search/models.py index eb2ad62..b47bc55 100644 --- a/colab/search/models.py +++ b/colab/search/models.py @@ -1,4 +1,4 @@ # uncomment the import if you really use. -#from django.db import models +# from django.db import models # Create your models here. diff --git a/colab/search/tests.py b/colab/search/tests.py index e88a4a2..55be646 100644 --- a/colab/search/tests.py +++ b/colab/search/tests.py @@ -1,4 +1,4 @@ # uncomment the import if you really use. -#from django.test import TestCase +# from django.test import TestCase # Create your tests here. diff --git a/colab/search/views.py b/colab/search/views.py index 813bd6a..56f61e0 100644 --- a/colab/search/views.py +++ b/colab/search/views.py @@ -5,7 +5,7 @@ from django.utils.translation import ugettext as _ from haystack.views import SearchView -#from proxy.trac.models import Attachment +# from proxy.trac.models import Attachment class ColabSearchView(SearchView): @@ -29,112 +29,112 @@ class ColabSearchView(SearchView): }, } # TODO: Replace for a more generic plugin architecture - #if settings.TRAC_ENABLED: - # types['wiki'] = { - # 'name': _(u'Wiki'), - # 'fields': ( - # ('author', _(u'Author'), self.request.GET.get('author')), - # ( - # 'collaborators', - # _(u'Collaborators'), - # self.request.GET.get('collaborators'), - # ), - # ), - # } - - # types['ticket'] = { - # 'name': _(u'Ticket'), - # 'fields': ( - # ( - # 'milestone', - # _(u'Milestone'), - # self.request.GET.get('milestone') - # ), - # ( - # 'priority', - # _(u'Priority'), - # self.request.GET.get('priority') - # ), - # ( - # 'component', - # _(u'Component'), - # self.request.GET.get('component') - # ), - # ( - # 'severity', - # _(u'Severity'), - # self.request.GET.get('severity') - # ), - # ( - # 'reporter', - # _(u'Reporter'), - # self.request.GET.get('reporter') - # ), - # ('author', _(u'Author'), self.request.GET.get('author')), - # ('tag', _(u'Status'), self.request.GET.get('tag')), - # ( - # 'keywords', - # _(u'Keywords'), - # self.request.GET.get('keywords'), - # ), - # ( - # 'collaborators', - # _(u'Collaborators'), - # self.request.GET.get('collaborators') - # ), - # ), - # } - - # types['changeset'] = { - # 'name': _(u'Changeset'), - # 'fields': ( - # ('author', _(u'Author'), self.request.GET.get('author')), - # ( - # 'repository_name', - # _(u'Repository'), - # self.request.GET.get('repository_name'), - # ), - # ) - # } - - # types['user'] = { - # 'name': _(u'User'), - # 'fields': ( - # ( - # 'username', - # _(u'Username'), - # self.request.GET.get('username'), - # ), - # ('name', _(u'Name'), self.request.GET.get('name')), - # ( - # 'institution', - # _(u'Institution'), - # self.request.GET.get('institution'), - # ), - # ('role', _(u'Role'), self.request.GET.get('role')) - # ), - # } - - # types['attachment'] = { - # 'name': _(u'Attachment'), - # 'fields': ( - # ( - # 'filename', - # _(u'Filename'), - # self.request.GET.get('filename') - # ), - # ('author', _(u'Author'), self.request.GET.get('author')), - # ( - # 'used_by', - # _(u'Used by'), self.request.GET.get('used_by')), - # ( - # 'mimetype', - # _(u'File type'), - # self.request.GET.get('mimetype') - # ), - # ('size', _(u'Size'), self.request.GET.get('size')), - # ) - # } + # if settings.TRAC_ENABLED: + # types['wiki'] = { + # 'name': _(u'Wiki'), + # 'fields': ( + # ('author', _(u'Author'), self.request.GET.get('author')), + # ( + # 'collaborators', + # _(u'Collaborators'), + # self.request.GET.get('collaborators'), + # ), + # ), + # } + + # types['ticket'] = { + # 'name': _(u'Ticket'), + # 'fields': ( + # ( + # 'milestone', + # _(u'Milestone'), + # self.request.GET.get('milestone') + # ), + # ( + # 'priority', + # _(u'Priority'), + # self.request.GET.get('priority') + # ), + # ( + # 'component', + # _(u'Component'), + # self.request.GET.get('component') + # ), + # ( + # 'severity', + # _(u'Severity'), + # self.request.GET.get('severity') + # ), + # ( + # 'reporter', + # _(u'Reporter'), + # self.request.GET.get('reporter') + # ), + # ('author', _(u'Author'), self.request.GET.get('author')), + # ('tag', _(u'Status'), self.request.GET.get('tag')), + # ( + # 'keywords', + # _(u'Keywords'), + # self.request.GET.get('keywords'), + # ), + # ( + # 'collaborators', + # _(u'Collaborators'), + # self.request.GET.get('collaborators') + # ), + # ), + # } + + # types['changeset'] = { + # 'name': _(u'Changeset'), + # 'fields': ( + # ('author', _(u'Author'), self.request.GET.get('author')), + # ( + # 'repository_name', + # _(u'Repository'), + # self.request.GET.get('repository_name'), + # ), + # ) + # } + + # types['user'] = { + # 'name': _(u'User'), + # 'fields': ( + # ( + # 'username', + # _(u'Username'), + # self.request.GET.get('username'), + # ), + # ('name', _(u'Name'), self.request.GET.get('name')), + # ( + # 'institution', + # _(u'Institution'), + # self.request.GET.get('institution'), + # ), + # ('role', _(u'Role'), self.request.GET.get('role')) + # ), + # } + + # types['attachment'] = { + # 'name': _(u'Attachment'), + # 'fields': ( + # ( + # 'filename', + # _(u'Filename'), + # self.request.GET.get('filename') + # ), + # ('author', _(u'Author'), self.request.GET.get('author')), + # ( + # 'used_by', + # _(u'Used by'), self.request.GET.get('used_by')), + # ( + # 'mimetype', + # _(u'File type'), + # self.request.GET.get('mimetype') + # ), + # ('size', _(u'Size'), self.request.GET.get('size')), + # ) + # } try: type_chosen = self.form.cleaned_data.get('type') @@ -145,19 +145,19 @@ class ColabSearchView(SearchView): size_choices = () used_by_choices = () - #if type_chosen == 'attachment': - # mimetype_choices = [ - # (type_, display) + # if type_chosen == 'attachment': + # mimetype_choices = [ + # (type_, display) # for type_, display, mimelist_ in settings.FILE_TYPE_GROUPINGS] - # size_choices = [ - # ('<500KB', u'< 500 KB'), - # ('500KB__10MB', u'>= 500 KB <= 10 MB'), - # ('>10MB', u'> 10 MB'), - # ] - # used_by_choices = set([ - # (v, v) for v in Attachment.objects.values_list('used_by', - # flat=True) - # ]) + # size_choices = [ + # ('<500KB', u'< 500 KB'), + # ('500KB__10MB', u'>= 500 KB <= 10 MB'), + # ('>10MB', u'> 10 MB'), + # ] + # used_by_choices = set([ + # (v, v) for v in Attachment.objects.values_list('used_by', + # flat=True) + # ]) mimetype_chosen = self.request.GET.get('mimetype') size_chosen = self.request.GET.get('size') diff --git a/colab/super_archives/apps.py b/colab/super_archives/apps.py index f1b940f..19f36c3 100644 --- a/colab/super_archives/apps.py +++ b/colab/super_archives/apps.py @@ -8,4 +8,4 @@ class SuperArchivesConfig(AppConfig): def ready(self): pass - #from . import signals + # from . import signals diff --git a/colab/super_archives/management/commands/message.py b/colab/super_archives/management/commands/message.py index 8c5be92..1ce06f9 100644 --- a/colab/super_archives/management/commands/message.py +++ b/colab/super_archives/management/commands/message.py @@ -57,7 +57,7 @@ class Message(mailbox.mboxMessage): """Get the body of the email message""" if self.is_multipart(): - #get the plain text version only + # get the plain text version only text_parts = [part for part in typed_subpart_iterator(self, 'text', @@ -71,15 +71,15 @@ class Message(mailbox.mboxMessage): return u"\n".join(body).strip() - else: # if it is not multipart, the payload will be a string - # representing the message body + else: # if it is not multipart, the payload will be a string + # representing the message body body = unicode(self.get_payload(decode=True), get_charset(self), "replace") return body.strip() def get_received_datetime(self): - if not self in ('Received'): + if self not in ('Received'): return None # The time received should always be the last element # in the `Received` attribute from the message headers diff --git a/colab/super_archives/search_indexes.py b/colab/super_archives/search_indexes.py index 30b4029..f0165e9 100644 --- a/colab/super_archives/search_indexes.py +++ b/colab/super_archives/search_indexes.py @@ -36,8 +36,8 @@ class ThreadIndex(BaseIndex, indexes.Indexable): def get_updated_field(self): return 'latest_message__received_time' - #def prepare_fullname(self, obj): - # return obj.message_set.first().from_address.get_full_name() + # def prepare_fullname(self, obj): + # return obj.message_set.first().from_address.get_full_name() def prepare_fullname_and_username(self, obj): from_address = obj.message_set.first().from_address diff --git a/colab/super_archives/utils/url.py b/colab/super_archives/utils/url.py index e8a7cf6..791e3ca 100644 --- a/colab/super_archives/utils/url.py +++ b/colab/super_archives/utils/url.py @@ -14,7 +14,7 @@ def append_to_get(path, query=None, **kwargs): def pop_from_get(path, query=None, **kwargs): query_dict = dict(urlparse.parse_qsl(query)) for key, value in kwargs.items(): - if not query_dict in (key): + if query_dict not in (key): continue if query_dict[key] == value: del query_dict[key] diff --git a/colab/super_archives/views.py b/colab/super_archives/views.py index 04c07ab..3e67428 100644 --- a/colab/super_archives/views.py +++ b/colab/super_archives/views.py @@ -126,7 +126,7 @@ class ThreadDashboardView(View): all_lists = mailman.all_lists(description=True) context['lists'] = [] - #lists = MailingList.objects.filter() + # lists = MailingList.objects.filter() for list_ in MailingList.objects.order_by('name'): context['lists'].append(( list_.name, -- libgit2 0.21.2