After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 777219 - PEP 8 fix : application.py
PEP 8 fix : application.py
Status: RESOLVED FIXED
Product: gnome-music
Classification: Applications
Component: general
3.23.x
Other Linux
: Normal normal
: ---
Assigned To: gnome-music-maint
gnome-music-maint
Depends on:
Blocks:
 
 
Reported: 2017-01-13 14:34 UTC by Abhinav Singh
Modified: 2017-02-13 22:12 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
PEP fixes (5.52 KB, patch)
2017-01-13 14:37 UTC, Abhinav Singh
none Details | Review
Cleanup - application.py (5.08 KB, patch)
2017-01-14 20:19 UTC, Abhinav Singh
none Details | Review
Removed unused functions. (1.05 KB, patch)
2017-01-16 12:53 UTC, Abhinav Singh
committed Details | Review
Code clean up (4.98 KB, patch)
2017-01-16 12:53 UTC, Abhinav Singh
committed Details | Review

Description Abhinav Singh 2017-01-13 14:34:01 UTC
Currently application.py does not follow all PEP guidelines.
Comment 1 Abhinav Singh 2017-01-13 14:37:06 UTC
Created attachment 343434 [details] [review]
PEP fixes
Comment 2 Marinus Schraal 2017-01-14 12:41:26 UTC
Review of attachment 343434 [details] [review]:

Just some minor notes.

::: gnomemusic/application.py
@@ +45,1 @@
 logger = logging.getLogger(__name__)

unused

@@ +57,2 @@
         GLib.set_prgname('gnome-music')
         self.settings = Gio.Settings.new('org.gnome.Music')

self._settings possible?

@@ +73,2 @@
+    @log
+    def do_startup(self):

Why reorder these? do_startup, quit & do_activate

@@ +77,3 @@
+        self._build_app_menu()
+
+    def do_activate(self):

@log

@@ +80,3 @@
+        if not self._window:
+            self._window = Window(self)
+            self.service = MediaPlayer2Service(self)

self._service, but since it isn't used it isn't needed really.

@@ +106,2 @@
     @log
+    def _new_playlist(self, action, param):

if it doesn't do anything, it can go. But make it a separate patch.
Comment 3 Abhinav Singh 2017-01-14 20:19:54 UTC
Created attachment 343483 [details] [review]
Cleanup - application.py

Followed PEP guidelines, and minor refactor of application.py


If I remove new_playlist action in a new patch, should I make it a patch of a patch?
Comment 4 Marinus Schraal 2017-01-16 07:50:51 UTC
Review of attachment 343483 [details] [review]:

almost done

::: gnomemusic/application.py
@@ +90,3 @@
     @log
+    def _about(self, action, param):
+        @log

I think inner function logging is a bit overkill.

@@ -116,3 @@
         if not self._window:
             self._window = Window(self)
-            self.service = MediaPlayer2Service(self)

I actually meant that it doesn't need to be assigned, it does need to be initialized. Actually I'm not 100% sure how the GC handles such a case, should check.
Comment 5 Marinus Schraal 2017-01-16 07:52:09 UTC
regarding comment #3 : I think just 2 patches stacking, remove the unused function first and then have the cleanup patch.
Comment 6 Abhinav Singh 2017-01-16 12:53:24 UTC
Created attachment 343550 [details] [review]
Removed unused functions.
Comment 7 Abhinav Singh 2017-01-16 12:53:53 UTC
Created attachment 343551 [details] [review]
Code clean up
Comment 8 Marinus Schraal 2017-02-13 21:58:15 UTC
Review of attachment 343550 [details] [review]:

lgtm
Comment 9 Marinus Schraal 2017-02-13 21:59:42 UTC
Review of attachment 343551 [details] [review]:

lgtm
Comment 10 Marinus Schraal 2017-02-13 22:12:04 UTC
Thanks for the patches. Committed.