Message ID | 1479979585-5103-1-git-send-email-stephen@that.guru |
---|---|
State | Accepted |
Headers | show |
LGTM Reviewed-by: Daniel Axtens <dja@axtens.net> Regards, Daniel Stephen Finucane <stephen@that.guru> writes: > flake8 3.2.0 updates the pycodestyle dependency to 2.2.0, which in > turn resolves a bug with E305. Upgrading results in a small number of > additional pep8 issues. Resolve these now. > > Signed-off-by: Stephen Finucane <stephen@that.guru> > --- > patchwork/admin.py | 24 ++++++++++++++++++++++++ > patchwork/bin/pwclient | 5 ++++- > patchwork/models.py | 2 ++ > patchwork/templatetags/syntax.py | 1 + > patchwork/views/xmlrpc.py | 1 + > 5 files changed, 32 insertions(+), 1 deletion(-) > > diff --git a/patchwork/admin.py b/patchwork/admin.py > index e80415a..d43cc4d 100644 > --- a/patchwork/admin.py > +++ b/patchwork/admin.py > @@ -47,6 +47,8 @@ class UserProfileInline(admin.StackedInline): > > class UserAdmin(BaseUserAdmin): > inlines = (UserProfileInline, ) > + > + > admin.site.unregister(User) > admin.site.register(User, UserAdmin) > > @@ -61,6 +63,8 @@ class ProjectAdmin(admin.ModelAdmin): > inlines = [ > DelegationRuleInline, > ] > + > + > admin.site.register(Project, ProjectAdmin) > > > @@ -74,11 +78,15 @@ class PersonAdmin(admin.ModelAdmin): > has_account.boolean = True > has_account.admin_order_field = 'user' > has_account.short_description = 'Account' > + > + > admin.site.register(Person, PersonAdmin) > > > class StateAdmin(admin.ModelAdmin): > list_display = ('name', 'action_required') > + > + > admin.site.register(State, StateAdmin) > > > @@ -87,6 +95,8 @@ class SubmissionAdmin(admin.ModelAdmin): > list_filter = ('project', ) > search_fields = ('name', 'submitter__name', 'submitter__email') > date_hierarchy = 'date' > + > + > admin.site.register(Submission, SubmissionAdmin) > admin.site.register(CoverLetter, SubmissionAdmin) > > @@ -104,6 +114,8 @@ class PatchAdmin(admin.ModelAdmin): > is_pull_request.boolean = True > is_pull_request.admin_order_field = 'pull_url' > is_pull_request.short_description = 'Pull' > + > + > admin.site.register(Patch, PatchAdmin) > > > @@ -111,6 +123,8 @@ class CommentAdmin(admin.ModelAdmin): > list_display = ('submission', 'submitter', 'date') > search_fields = ('submission__name', 'submitter__name', 'submitter__email') > date_hierarchy = 'date' > + > + > admin.site.register(Comment, CommentAdmin) > > > @@ -130,6 +144,8 @@ class SeriesAdmin(admin.ModelAdmin): > def received_all(self, series): > return series.received_all > received_all.boolean = True > + > + > admin.site.register(Series, SeriesAdmin) > > > @@ -148,6 +164,8 @@ class SeriesInline(admin.StackedInline): > > class SeriesReferenceAdmin(admin.ModelAdmin): > model = SeriesReference > + > + > admin.site.register(SeriesReference, SeriesReferenceAdmin) > > > @@ -157,6 +175,8 @@ class CheckAdmin(admin.ModelAdmin): > exclude = ('date', ) > search_fields = ('patch__name', 'project__name') > date_hierarchy = 'date' > + > + > admin.site.register(Check, CheckAdmin) > > > @@ -164,9 +184,13 @@ class BundleAdmin(admin.ModelAdmin): > list_display = ('name', 'owner', 'project', 'public') > list_filter = ('public', 'project') > search_fields = ('name', 'owner') > + > + > admin.site.register(Bundle, BundleAdmin) > > > class TagAdmin(admin.ModelAdmin): > list_display = ('name',) > + > + > admin.site.register(Tag, TagAdmin) > diff --git a/patchwork/bin/pwclient b/patchwork/bin/pwclient > index ce18e54..48d7be9 100755 > --- a/patchwork/bin/pwclient > +++ b/patchwork/bin/pwclient > @@ -377,6 +377,7 @@ def patch_id_from_hash(rpc, project, hash): > sys.exit(1) > return patch_id > > + > auth_actions = ['check_create', 'update'] > > > @@ -606,7 +607,8 @@ def main(): > config.read([CONFIG_FILE]) > > if not config.has_section('options') and os.path.exists(CONFIG_FILE): > - sys.stderr.write('%s is in the old format. Migrating it...' % CONFIG_FILE) > + sys.stderr.write('%s is in the old format. Migrating it...' % > + CONFIG_FILE) > > old_project = config.get('base', 'project') > > @@ -793,5 +795,6 @@ def main(): > action_parser.print_help() > sys.exit(1) > > + > if __name__ == "__main__": > main() > diff --git a/patchwork/models.py b/patchwork/models.py > index a27dda6..15a2936 100644 > --- a/patchwork/models.py > +++ b/patchwork/models.py > @@ -172,6 +172,7 @@ def _user_saved_callback(sender, created, instance, **kwargs): > profile = UserProfile(user=instance) > profile.save() > > + > models.signals.post_save.connect(_user_saved_callback, sender=User) > > > @@ -907,4 +908,5 @@ def _patch_change_callback(sender, instance, **kwargs): > notification.last_modified = datetime.datetime.now() > notification.save() > > + > models.signals.pre_save.connect(_patch_change_callback, sender=Patch) > diff --git a/patchwork/templatetags/syntax.py b/patchwork/templatetags/syntax.py > index 341a181..27ff8c3 100644 > --- a/patchwork/templatetags/syntax.py > +++ b/patchwork/templatetags/syntax.py > @@ -33,6 +33,7 @@ def _compile(value): > regex, cls = value > return re.compile(regex, re.M | re.I), cls > > + > _patch_span_res = [_compile(x) for x in [ > (r'^(Index:?|diff|\-\-\-|\+\+\+|\*\*\*) .*$', 'p_header'), > (r'^\+.*$', 'p_add'), > diff --git a/patchwork/views/xmlrpc.py b/patchwork/views/xmlrpc.py > index 0c3f581..6ef957c 100644 > --- a/patchwork/views/xmlrpc.py > +++ b/patchwork/views/xmlrpc.py > @@ -133,6 +133,7 @@ class PatchworkXMLRPCDispatcher(SimpleXMLRPCDispatcher, > > return response > > + > dispatcher = PatchworkXMLRPCDispatcher() > > # XMLRPC view function > -- > 2.7.4 > > _______________________________________________ > Patchwork mailing list > Patchwork@lists.ozlabs.org > https://lists.ozlabs.org/listinfo/patchwork
diff --git a/patchwork/admin.py b/patchwork/admin.py index e80415a..d43cc4d 100644 --- a/patchwork/admin.py +++ b/patchwork/admin.py @@ -47,6 +47,8 @@ class UserProfileInline(admin.StackedInline): class UserAdmin(BaseUserAdmin): inlines = (UserProfileInline, ) + + admin.site.unregister(User) admin.site.register(User, UserAdmin) @@ -61,6 +63,8 @@ class ProjectAdmin(admin.ModelAdmin): inlines = [ DelegationRuleInline, ] + + admin.site.register(Project, ProjectAdmin) @@ -74,11 +78,15 @@ class PersonAdmin(admin.ModelAdmin): has_account.boolean = True has_account.admin_order_field = 'user' has_account.short_description = 'Account' + + admin.site.register(Person, PersonAdmin) class StateAdmin(admin.ModelAdmin): list_display = ('name', 'action_required') + + admin.site.register(State, StateAdmin) @@ -87,6 +95,8 @@ class SubmissionAdmin(admin.ModelAdmin): list_filter = ('project', ) search_fields = ('name', 'submitter__name', 'submitter__email') date_hierarchy = 'date' + + admin.site.register(Submission, SubmissionAdmin) admin.site.register(CoverLetter, SubmissionAdmin) @@ -104,6 +114,8 @@ class PatchAdmin(admin.ModelAdmin): is_pull_request.boolean = True is_pull_request.admin_order_field = 'pull_url' is_pull_request.short_description = 'Pull' + + admin.site.register(Patch, PatchAdmin) @@ -111,6 +123,8 @@ class CommentAdmin(admin.ModelAdmin): list_display = ('submission', 'submitter', 'date') search_fields = ('submission__name', 'submitter__name', 'submitter__email') date_hierarchy = 'date' + + admin.site.register(Comment, CommentAdmin) @@ -130,6 +144,8 @@ class SeriesAdmin(admin.ModelAdmin): def received_all(self, series): return series.received_all received_all.boolean = True + + admin.site.register(Series, SeriesAdmin) @@ -148,6 +164,8 @@ class SeriesInline(admin.StackedInline): class SeriesReferenceAdmin(admin.ModelAdmin): model = SeriesReference + + admin.site.register(SeriesReference, SeriesReferenceAdmin) @@ -157,6 +175,8 @@ class CheckAdmin(admin.ModelAdmin): exclude = ('date', ) search_fields = ('patch__name', 'project__name') date_hierarchy = 'date' + + admin.site.register(Check, CheckAdmin) @@ -164,9 +184,13 @@ class BundleAdmin(admin.ModelAdmin): list_display = ('name', 'owner', 'project', 'public') list_filter = ('public', 'project') search_fields = ('name', 'owner') + + admin.site.register(Bundle, BundleAdmin) class TagAdmin(admin.ModelAdmin): list_display = ('name',) + + admin.site.register(Tag, TagAdmin) diff --git a/patchwork/bin/pwclient b/patchwork/bin/pwclient index ce18e54..48d7be9 100755 --- a/patchwork/bin/pwclient +++ b/patchwork/bin/pwclient @@ -377,6 +377,7 @@ def patch_id_from_hash(rpc, project, hash): sys.exit(1) return patch_id + auth_actions = ['check_create', 'update'] @@ -606,7 +607,8 @@ def main(): config.read([CONFIG_FILE]) if not config.has_section('options') and os.path.exists(CONFIG_FILE): - sys.stderr.write('%s is in the old format. Migrating it...' % CONFIG_FILE) + sys.stderr.write('%s is in the old format. Migrating it...' % + CONFIG_FILE) old_project = config.get('base', 'project') @@ -793,5 +795,6 @@ def main(): action_parser.print_help() sys.exit(1) + if __name__ == "__main__": main() diff --git a/patchwork/models.py b/patchwork/models.py index a27dda6..15a2936 100644 --- a/patchwork/models.py +++ b/patchwork/models.py @@ -172,6 +172,7 @@ def _user_saved_callback(sender, created, instance, **kwargs): profile = UserProfile(user=instance) profile.save() + models.signals.post_save.connect(_user_saved_callback, sender=User) @@ -907,4 +908,5 @@ def _patch_change_callback(sender, instance, **kwargs): notification.last_modified = datetime.datetime.now() notification.save() + models.signals.pre_save.connect(_patch_change_callback, sender=Patch) diff --git a/patchwork/templatetags/syntax.py b/patchwork/templatetags/syntax.py index 341a181..27ff8c3 100644 --- a/patchwork/templatetags/syntax.py +++ b/patchwork/templatetags/syntax.py @@ -33,6 +33,7 @@ def _compile(value): regex, cls = value return re.compile(regex, re.M | re.I), cls + _patch_span_res = [_compile(x) for x in [ (r'^(Index:?|diff|\-\-\-|\+\+\+|\*\*\*) .*$', 'p_header'), (r'^\+.*$', 'p_add'), diff --git a/patchwork/views/xmlrpc.py b/patchwork/views/xmlrpc.py index 0c3f581..6ef957c 100644 --- a/patchwork/views/xmlrpc.py +++ b/patchwork/views/xmlrpc.py @@ -133,6 +133,7 @@ class PatchworkXMLRPCDispatcher(SimpleXMLRPCDispatcher, return response + dispatcher = PatchworkXMLRPCDispatcher() # XMLRPC view function
flake8 3.2.0 updates the pycodestyle dependency to 2.2.0, which in turn resolves a bug with E305. Upgrading results in a small number of additional pep8 issues. Resolve these now. Signed-off-by: Stephen Finucane <stephen@that.guru> --- patchwork/admin.py | 24 ++++++++++++++++++++++++ patchwork/bin/pwclient | 5 ++++- patchwork/models.py | 2 ++ patchwork/templatetags/syntax.py | 1 + patchwork/views/xmlrpc.py | 1 + 5 files changed, 32 insertions(+), 1 deletion(-)