Commit 5f51339e9f9b6a7499af03919461f3cf5ae2a70b
1 parent
cc39a5d3
Exists in
master
and in
39 other branches
Fixed missing flake8 checks
Showing
19 changed files
with
222 additions
and
222 deletions
Show diff stats
colab/api/resources.py
... | ... | @@ -7,7 +7,7 @@ from tastypie.constants import ALL_WITH_RELATIONS, ALL |
7 | 7 | from tastypie.resources import ModelResource |
8 | 8 | |
9 | 9 | from colab.super_archives.models import Message, EmailAddress |
10 | -#from proxy.trac.models import Revision, Ticket, Wiki | |
10 | +# from proxy.trac.models import Revision, Ticket, Wiki | |
11 | 11 | |
12 | 12 | User = get_user_model() |
13 | 13 | |
... | ... | @@ -65,56 +65,56 @@ class MessageResource(ModelResource): |
65 | 65 | } |
66 | 66 | |
67 | 67 | |
68 | -#class RevisionResource(ModelResource): | |
69 | -# class Meta: | |
70 | -# queryset = Revision.objects.all() | |
71 | -# resource_name = 'revision' | |
72 | -# excludes = ['collaborators', ] | |
73 | -# filtering = { | |
74 | -# 'key': ALL, | |
75 | -# 'rev': ALL, | |
76 | -# 'author': ALL, | |
77 | -# 'message': ALL, | |
78 | -# 'repository_name': ALL, | |
79 | -# 'created': ALL, | |
80 | -# } | |
68 | +# class RevisionResource(ModelResource): | |
69 | +# class Meta: | |
70 | +# queryset = Revision.objects.all() | |
71 | +# resource_name = 'revision' | |
72 | +# excludes = ['collaborators', ] | |
73 | +# filtering = { | |
74 | +# 'key': ALL, | |
75 | +# 'rev': ALL, | |
76 | +# 'author': ALL, | |
77 | +# 'message': ALL, | |
78 | +# 'repository_name': ALL, | |
79 | +# 'created': ALL, | |
80 | +# } | |
81 | 81 | # |
82 | 82 | # |
83 | -#class TicketResource(ModelResource): | |
84 | -# class Meta: | |
85 | -# queryset = Ticket.objects.all() | |
86 | -# resource_name = 'ticket' | |
87 | -# excludes = ['collaborators', ] | |
88 | -# filtering = { | |
89 | -# 'id': ALL, | |
90 | -# 'summary': ALL, | |
91 | -# 'description': ALL, | |
92 | -# 'milestone': ALL, | |
93 | -# 'priority': ALL, | |
94 | -# 'component': ALL, | |
95 | -# 'version': ALL, | |
96 | -# 'severity': ALL, | |
97 | -# 'reporter': ALL, | |
98 | -# 'author': ALL, | |
99 | -# 'status': ALL, | |
100 | -# 'keywords': ALL, | |
101 | -# 'created': ALL, | |
102 | -# 'modified': ALL, | |
103 | -# 'modified_by': ALL, | |
104 | -# } | |
83 | +# class TicketResource(ModelResource): | |
84 | +# class Meta: | |
85 | +# queryset = Ticket.objects.all() | |
86 | +# resource_name = 'ticket' | |
87 | +# excludes = ['collaborators', ] | |
88 | +# filtering = { | |
89 | +# 'id': ALL, | |
90 | +# 'summary': ALL, | |
91 | +# 'description': ALL, | |
92 | +# 'milestone': ALL, | |
93 | +# 'priority': ALL, | |
94 | +# 'component': ALL, | |
95 | +# 'version': ALL, | |
96 | +# 'severity': ALL, | |
97 | +# 'reporter': ALL, | |
98 | +# 'author': ALL, | |
99 | +# 'status': ALL, | |
100 | +# 'keywords': ALL, | |
101 | +# 'created': ALL, | |
102 | +# 'modified': ALL, | |
103 | +# 'modified_by': ALL, | |
104 | +# } | |
105 | 105 | # |
106 | 106 | # |
107 | -#class WikiResource(ModelResource): | |
108 | -# class Meta: | |
109 | -# queryset = Wiki.objects.all() | |
110 | -# resource_name = 'wiki' | |
111 | -# excludes = ['collaborators', ] | |
112 | -# filtering = { | |
113 | -# 'name': ALL, | |
114 | -# 'wiki_text': ALL, | |
115 | -# 'author': ALL, | |
116 | -# 'name': ALL, | |
117 | -# 'created': ALL, | |
118 | -# 'modified': ALL, | |
119 | -# 'modified_by': ALL, | |
120 | -# } | |
107 | +# class WikiResource(ModelResource): | |
108 | +# class Meta: | |
109 | +# queryset = Wiki.objects.all() | |
110 | +# resource_name = 'wiki' | |
111 | +# excludes = ['collaborators', ] | |
112 | +# filtering = { | |
113 | +# 'name': ALL, | |
114 | +# 'wiki_text': ALL, | |
115 | +# 'author': ALL, | |
116 | +# 'name': ALL, | |
117 | +# 'created': ALL, | |
118 | +# 'modified': ALL, | |
119 | +# 'modified_by': ALL, | |
120 | +# } | ... | ... |
colab/badger/tests.py
colab/badger/utils.py
... | ... | @@ -2,40 +2,40 @@ |
2 | 2 | |
3 | 3 | from django.db.models import Count |
4 | 4 | |
5 | -#from proxy.trac.models import (Ticket, Wiki) | |
6 | -#from proxy.trac.models import (Revision, WikiCollabCount, TicketCollabCount) | |
5 | +# from proxy.trac.models import (Ticket, Wiki) | |
6 | +# from proxy.trac.models import (Revision, WikiCollabCount, TicketCollabCount) | |
7 | 7 | from colab.accounts.models import User |
8 | 8 | |
9 | 9 | |
10 | -#def get_wiki_counters(): | |
11 | -# return {author: count for author, count in | |
12 | -# WikiCollabCount.objects.values_list()} | |
10 | +# def get_wiki_counters(): | |
11 | +# return {author: count for author, count in | |
12 | +# WikiCollabCount.objects.values_list()} | |
13 | 13 | |
14 | 14 | |
15 | -#def get_revision_counters(): | |
16 | -# return { | |
17 | -# author: count for author, count in Revision.objects.values_list( | |
18 | -# 'author' | |
19 | -# ).annotate(count=Count('author')) | |
20 | -# } | |
15 | +# def get_revision_counters(): | |
16 | +# return { | |
17 | +# author: count for author, count in Revision.objects.values_list( | |
18 | +# 'author' | |
19 | +# ).annotate(count=Count('author')) | |
20 | +# } | |
21 | 21 | |
22 | 22 | |
23 | -#def get_ticket_counters(): | |
24 | -# return {author: count for author, count in | |
25 | -# TicketCollabCount.objects.values_list()} | |
23 | +# def get_ticket_counters(): | |
24 | +# return {author: count for author, count in | |
25 | +# TicketCollabCount.objects.values_list()} | |
26 | 26 | |
27 | 27 | |
28 | 28 | def get_users_counters(): |
29 | - #wiki_counters = get_wiki_counters() | |
30 | - #revision_counters = get_revision_counters() | |
31 | - #ticket_counters = get_ticket_counters() | |
29 | + # wiki_counters = get_wiki_counters() | |
30 | + # revision_counters = get_revision_counters() | |
31 | + # ticket_counters = get_ticket_counters() | |
32 | 32 | |
33 | 33 | users_counters = {} |
34 | 34 | for user in User.objects.annotate(message_count=Count('emails__message')): |
35 | 35 | users_counters[user.username] = { |
36 | 36 | 'messages': user.message_count, |
37 | - #'wikis': wiki_counters.get(user.username, 0), | |
38 | - #'revisions': revision_counters.get(user.username, 0), | |
39 | - #'tickets': ticket_counters.get(user.username, 0), | |
37 | + # 'wikis': wiki_counters.get(user.username, 0), | |
38 | + # 'revisions': revision_counters.get(user.username, 0), | |
39 | + # 'tickets': ticket_counters.get(user.username, 0), | |
40 | 40 | } |
41 | 41 | return users_counters | ... | ... |
colab/home/models.py
colab/home/tests.py
colab/home/views.py
... | ... | @@ -8,7 +8,7 @@ from django.http import HttpResponse, Http404 |
8 | 8 | |
9 | 9 | from haystack.query import SearchQuerySet |
10 | 10 | |
11 | -#from proxy.trac.models import WikiCollabCount, TicketCollabCount | |
11 | +# from proxy.trac.models import WikiCollabCount, TicketCollabCount | |
12 | 12 | from colab.search.utils import trans |
13 | 13 | from colab.super_archives.models import Thread |
14 | 14 | |
... | ... | @@ -25,19 +25,19 @@ def dashboard(request): |
25 | 25 | type='thread', |
26 | 26 | ).count() |
27 | 27 | # TODO: this section should be inside trac app and only use it here |
28 | - #if settings.TRAC_ENABLED: | |
29 | - # for type in ['changeset', 'attachment']: | |
30 | - # count_types[type] = SearchQuerySet().filter( | |
31 | - # type=type, | |
32 | - # ).count() | |
33 | - | |
34 | - # count_types['ticket'] = sum([ | |
35 | - # ticket.count for ticket in TicketCollabCount.objects.all() | |
36 | - # ]) | |
37 | - | |
38 | - # count_types['wiki'] = sum([ | |
39 | - # wiki.count for wiki in WikiCollabCount.objects.all() | |
40 | - # ]) | |
28 | + # if settings.TRAC_ENABLED: | |
29 | + # for type in ['changeset', 'attachment']: | |
30 | + # count_types[type] = SearchQuerySet().filter( | |
31 | + # type=type, | |
32 | + # ).count() | |
33 | + | |
34 | + # count_types['ticket'] = sum([ | |
35 | + # ticket.count for ticket in TicketCollabCount.objects.all() | |
36 | + # ]) | |
37 | + | |
38 | + # count_types['wiki'] = sum([ | |
39 | + # wiki.count for wiki in WikiCollabCount.objects.all() | |
40 | + # ]) | |
41 | 41 | |
42 | 42 | cache.set('home_chart', count_types) |
43 | 43 | ... | ... |
colab/planet/admin.py
colab/planet/models.py
colab/planet/tests.py
colab/planet/views.py
colab/search/admin.py
colab/search/models.py
colab/search/tests.py
colab/search/views.py
... | ... | @@ -5,7 +5,7 @@ from django.utils.translation import ugettext as _ |
5 | 5 | |
6 | 6 | from haystack.views import SearchView |
7 | 7 | |
8 | -#from proxy.trac.models import Attachment | |
8 | +# from proxy.trac.models import Attachment | |
9 | 9 | |
10 | 10 | |
11 | 11 | class ColabSearchView(SearchView): |
... | ... | @@ -29,112 +29,112 @@ class ColabSearchView(SearchView): |
29 | 29 | }, |
30 | 30 | } |
31 | 31 | # TODO: Replace for a more generic plugin architecture |
32 | - #if settings.TRAC_ENABLED: | |
33 | - # types['wiki'] = { | |
34 | - # 'name': _(u'Wiki'), | |
35 | - # 'fields': ( | |
36 | - # ('author', _(u'Author'), self.request.GET.get('author')), | |
37 | - # ( | |
38 | - # 'collaborators', | |
39 | - # _(u'Collaborators'), | |
40 | - # self.request.GET.get('collaborators'), | |
41 | - # ), | |
42 | - # ), | |
43 | - # } | |
44 | - | |
45 | - # types['ticket'] = { | |
46 | - # 'name': _(u'Ticket'), | |
47 | - # 'fields': ( | |
48 | - # ( | |
49 | - # 'milestone', | |
50 | - # _(u'Milestone'), | |
51 | - # self.request.GET.get('milestone') | |
52 | - # ), | |
53 | - # ( | |
54 | - # 'priority', | |
55 | - # _(u'Priority'), | |
56 | - # self.request.GET.get('priority') | |
57 | - # ), | |
58 | - # ( | |
59 | - # 'component', | |
60 | - # _(u'Component'), | |
61 | - # self.request.GET.get('component') | |
62 | - # ), | |
63 | - # ( | |
64 | - # 'severity', | |
65 | - # _(u'Severity'), | |
66 | - # self.request.GET.get('severity') | |
67 | - # ), | |
68 | - # ( | |
69 | - # 'reporter', | |
70 | - # _(u'Reporter'), | |
71 | - # self.request.GET.get('reporter') | |
72 | - # ), | |
73 | - # ('author', _(u'Author'), self.request.GET.get('author')), | |
74 | - # ('tag', _(u'Status'), self.request.GET.get('tag')), | |
75 | - # ( | |
76 | - # 'keywords', | |
77 | - # _(u'Keywords'), | |
78 | - # self.request.GET.get('keywords'), | |
79 | - # ), | |
80 | - # ( | |
81 | - # 'collaborators', | |
82 | - # _(u'Collaborators'), | |
83 | - # self.request.GET.get('collaborators') | |
84 | - # ), | |
85 | - # ), | |
86 | - # } | |
87 | - | |
88 | - # types['changeset'] = { | |
89 | - # 'name': _(u'Changeset'), | |
90 | - # 'fields': ( | |
91 | - # ('author', _(u'Author'), self.request.GET.get('author')), | |
92 | - # ( | |
93 | - # 'repository_name', | |
94 | - # _(u'Repository'), | |
95 | - # self.request.GET.get('repository_name'), | |
96 | - # ), | |
97 | - # ) | |
98 | - # } | |
99 | - | |
100 | - # types['user'] = { | |
101 | - # 'name': _(u'User'), | |
102 | - # 'fields': ( | |
103 | - # ( | |
104 | - # 'username', | |
105 | - # _(u'Username'), | |
106 | - # self.request.GET.get('username'), | |
107 | - # ), | |
108 | - # ('name', _(u'Name'), self.request.GET.get('name')), | |
109 | - # ( | |
110 | - # 'institution', | |
111 | - # _(u'Institution'), | |
112 | - # self.request.GET.get('institution'), | |
113 | - # ), | |
114 | - # ('role', _(u'Role'), self.request.GET.get('role')) | |
115 | - # ), | |
116 | - # } | |
117 | - | |
118 | - # types['attachment'] = { | |
119 | - # 'name': _(u'Attachment'), | |
120 | - # 'fields': ( | |
121 | - # ( | |
122 | - # 'filename', | |
123 | - # _(u'Filename'), | |
124 | - # self.request.GET.get('filename') | |
125 | - # ), | |
126 | - # ('author', _(u'Author'), self.request.GET.get('author')), | |
127 | - # ( | |
128 | - # 'used_by', | |
129 | - # _(u'Used by'), self.request.GET.get('used_by')), | |
130 | - # ( | |
131 | - # 'mimetype', | |
132 | - # _(u'File type'), | |
133 | - # self.request.GET.get('mimetype') | |
134 | - # ), | |
135 | - # ('size', _(u'Size'), self.request.GET.get('size')), | |
136 | - # ) | |
137 | - # } | |
32 | + # if settings.TRAC_ENABLED: | |
33 | + # types['wiki'] = { | |
34 | + # 'name': _(u'Wiki'), | |
35 | + # 'fields': ( | |
36 | + # ('author', _(u'Author'), self.request.GET.get('author')), | |
37 | + # ( | |
38 | + # 'collaborators', | |
39 | + # _(u'Collaborators'), | |
40 | + # self.request.GET.get('collaborators'), | |
41 | + # ), | |
42 | + # ), | |
43 | + # } | |
44 | + | |
45 | + # types['ticket'] = { | |
46 | + # 'name': _(u'Ticket'), | |
47 | + # 'fields': ( | |
48 | + # ( | |
49 | + # 'milestone', | |
50 | + # _(u'Milestone'), | |
51 | + # self.request.GET.get('milestone') | |
52 | + # ), | |
53 | + # ( | |
54 | + # 'priority', | |
55 | + # _(u'Priority'), | |
56 | + # self.request.GET.get('priority') | |
57 | + # ), | |
58 | + # ( | |
59 | + # 'component', | |
60 | + # _(u'Component'), | |
61 | + # self.request.GET.get('component') | |
62 | + # ), | |
63 | + # ( | |
64 | + # 'severity', | |
65 | + # _(u'Severity'), | |
66 | + # self.request.GET.get('severity') | |
67 | + # ), | |
68 | + # ( | |
69 | + # 'reporter', | |
70 | + # _(u'Reporter'), | |
71 | + # self.request.GET.get('reporter') | |
72 | + # ), | |
73 | + # ('author', _(u'Author'), self.request.GET.get('author')), | |
74 | + # ('tag', _(u'Status'), self.request.GET.get('tag')), | |
75 | + # ( | |
76 | + # 'keywords', | |
77 | + # _(u'Keywords'), | |
78 | + # self.request.GET.get('keywords'), | |
79 | + # ), | |
80 | + # ( | |
81 | + # 'collaborators', | |
82 | + # _(u'Collaborators'), | |
83 | + # self.request.GET.get('collaborators') | |
84 | + # ), | |
85 | + # ), | |
86 | + # } | |
87 | + | |
88 | + # types['changeset'] = { | |
89 | + # 'name': _(u'Changeset'), | |
90 | + # 'fields': ( | |
91 | + # ('author', _(u'Author'), self.request.GET.get('author')), | |
92 | + # ( | |
93 | + # 'repository_name', | |
94 | + # _(u'Repository'), | |
95 | + # self.request.GET.get('repository_name'), | |
96 | + # ), | |
97 | + # ) | |
98 | + # } | |
99 | + | |
100 | + # types['user'] = { | |
101 | + # 'name': _(u'User'), | |
102 | + # 'fields': ( | |
103 | + # ( | |
104 | + # 'username', | |
105 | + # _(u'Username'), | |
106 | + # self.request.GET.get('username'), | |
107 | + # ), | |
108 | + # ('name', _(u'Name'), self.request.GET.get('name')), | |
109 | + # ( | |
110 | + # 'institution', | |
111 | + # _(u'Institution'), | |
112 | + # self.request.GET.get('institution'), | |
113 | + # ), | |
114 | + # ('role', _(u'Role'), self.request.GET.get('role')) | |
115 | + # ), | |
116 | + # } | |
117 | + | |
118 | + # types['attachment'] = { | |
119 | + # 'name': _(u'Attachment'), | |
120 | + # 'fields': ( | |
121 | + # ( | |
122 | + # 'filename', | |
123 | + # _(u'Filename'), | |
124 | + # self.request.GET.get('filename') | |
125 | + # ), | |
126 | + # ('author', _(u'Author'), self.request.GET.get('author')), | |
127 | + # ( | |
128 | + # 'used_by', | |
129 | + # _(u'Used by'), self.request.GET.get('used_by')), | |
130 | + # ( | |
131 | + # 'mimetype', | |
132 | + # _(u'File type'), | |
133 | + # self.request.GET.get('mimetype') | |
134 | + # ), | |
135 | + # ('size', _(u'Size'), self.request.GET.get('size')), | |
136 | + # ) | |
137 | + # } | |
138 | 138 | |
139 | 139 | try: |
140 | 140 | type_chosen = self.form.cleaned_data.get('type') |
... | ... | @@ -145,19 +145,19 @@ class ColabSearchView(SearchView): |
145 | 145 | size_choices = () |
146 | 146 | used_by_choices = () |
147 | 147 | |
148 | - #if type_chosen == 'attachment': | |
149 | - # mimetype_choices = [ | |
150 | - # (type_, display) | |
148 | + # if type_chosen == 'attachment': | |
149 | + # mimetype_choices = [ | |
150 | + # (type_, display) | |
151 | 151 | # for type_, display, mimelist_ in settings.FILE_TYPE_GROUPINGS] |
152 | - # size_choices = [ | |
153 | - # ('<500KB', u'< 500 KB'), | |
154 | - # ('500KB__10MB', u'>= 500 KB <= 10 MB'), | |
155 | - # ('>10MB', u'> 10 MB'), | |
156 | - # ] | |
157 | - # used_by_choices = set([ | |
158 | - # (v, v) for v in Attachment.objects.values_list('used_by', | |
159 | - # flat=True) | |
160 | - # ]) | |
152 | + # size_choices = [ | |
153 | + # ('<500KB', u'< 500 KB'), | |
154 | + # ('500KB__10MB', u'>= 500 KB <= 10 MB'), | |
155 | + # ('>10MB', u'> 10 MB'), | |
156 | + # ] | |
157 | + # used_by_choices = set([ | |
158 | + # (v, v) for v in Attachment.objects.values_list('used_by', | |
159 | + # flat=True) | |
160 | + # ]) | |
161 | 161 | |
162 | 162 | mimetype_chosen = self.request.GET.get('mimetype') |
163 | 163 | size_chosen = self.request.GET.get('size') | ... | ... |
colab/super_archives/apps.py
colab/super_archives/management/commands/message.py
... | ... | @@ -57,7 +57,7 @@ class Message(mailbox.mboxMessage): |
57 | 57 | """Get the body of the email message""" |
58 | 58 | |
59 | 59 | if self.is_multipart(): |
60 | - #get the plain text version only | |
60 | + # get the plain text version only | |
61 | 61 | text_parts = [part |
62 | 62 | for part in typed_subpart_iterator(self, |
63 | 63 | 'text', |
... | ... | @@ -71,15 +71,15 @@ class Message(mailbox.mboxMessage): |
71 | 71 | |
72 | 72 | return u"\n".join(body).strip() |
73 | 73 | |
74 | - else: # if it is not multipart, the payload will be a string | |
75 | - # representing the message body | |
74 | + else: # if it is not multipart, the payload will be a string | |
75 | + # representing the message body | |
76 | 76 | body = unicode(self.get_payload(decode=True), |
77 | 77 | get_charset(self), |
78 | 78 | "replace") |
79 | 79 | return body.strip() |
80 | 80 | |
81 | 81 | def get_received_datetime(self): |
82 | - if not self in ('Received'): | |
82 | + if self not in ('Received'): | |
83 | 83 | return None |
84 | 84 | # The time received should always be the last element |
85 | 85 | # in the `Received` attribute from the message headers | ... | ... |
colab/super_archives/search_indexes.py
... | ... | @@ -36,8 +36,8 @@ class ThreadIndex(BaseIndex, indexes.Indexable): |
36 | 36 | def get_updated_field(self): |
37 | 37 | return 'latest_message__received_time' |
38 | 38 | |
39 | - #def prepare_fullname(self, obj): | |
40 | - # return obj.message_set.first().from_address.get_full_name() | |
39 | + # def prepare_fullname(self, obj): | |
40 | + # return obj.message_set.first().from_address.get_full_name() | |
41 | 41 | |
42 | 42 | def prepare_fullname_and_username(self, obj): |
43 | 43 | from_address = obj.message_set.first().from_address | ... | ... |
colab/super_archives/utils/url.py
... | ... | @@ -14,7 +14,7 @@ def append_to_get(path, query=None, **kwargs): |
14 | 14 | def pop_from_get(path, query=None, **kwargs): |
15 | 15 | query_dict = dict(urlparse.parse_qsl(query)) |
16 | 16 | for key, value in kwargs.items(): |
17 | - if not query_dict in (key): | |
17 | + if query_dict not in (key): | |
18 | 18 | continue |
19 | 19 | if query_dict[key] == value: |
20 | 20 | del query_dict[key] | ... | ... |
colab/super_archives/views.py
... | ... | @@ -126,7 +126,7 @@ class ThreadDashboardView(View): |
126 | 126 | all_lists = mailman.all_lists(description=True) |
127 | 127 | |
128 | 128 | context['lists'] = [] |
129 | - #lists = MailingList.objects.filter() | |
129 | + # lists = MailingList.objects.filter() | |
130 | 130 | for list_ in MailingList.objects.order_by('name'): |
131 | 131 | context['lists'].append(( |
132 | 132 | list_.name, | ... | ... |