[gnome-music] query: PEP-8 fixes



commit aea54133cbe0edd99a84efef1cf35cb9a91a9b1a
Author: Divyanshu Vishwakarma <divyanshu divix gmail com>
Date:   Thu Jul 21 01:57:18 2016 +0530

    query: PEP-8 fixes
    
    PEP-8 line length fix on translators comment.
    PEP-8 prepend order_by_statement with underscore to signify it being
    private.
    Reword the translators comment slightly.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=742531

 gnomemusic/query.py |   31 ++++++++++++++++++-------------
 1 files changed, 18 insertions(+), 13 deletions(-)
---
diff --git a/gnomemusic/query.py b/gnomemusic/query.py
index 812efef..0fb96a7 100644
--- a/gnomemusic/query.py
+++ b/gnomemusic/query.py
@@ -65,7 +65,7 @@ class Query():
         return '<Query>'
 
     @staticmethod
-    def order_by_statement(attr):
+    def _order_by_statement(attr):
         """Returns a specifically sorted SPARQL ORDER BY statement.
 
         Returns a SPARQL ORDER BY statement sorting by the given
@@ -82,18 +82,23 @@ class Query():
             'attribute': attr,
             'punctuation': PUNCTUATION_FILTER
         }
-        # TRANSLATORS: _("the") should be a space-separated list of all-lowercase articles
-        # (such as 'the') that should be ignored when alphabetizing artists/albums. This
-        # list should include 'the' regardless of language. If some articles occur more
-        # frequently than others, most common should appear first, least common last.
+
+        # TRANSLATORS: The following translatable string should be a
+        # space-separated list of all-lowercase articles that should be
+        # ignored when alphabetizing artists/albums. This list should
+        # include the basic english translatable strings regardless of
+        # language because it is so universal.
+        # If some articles occur more frequently than others, the most
+        # common one should appear first, the least common one last.
         for article in reversed(_("the a an").split(" ")):
-            return_statement = '''IF(STRSTARTS(%(attribute)s, "%(article)s"),
-            SUBSTR(%(attribute)s, %(substr_start)s),
-            %(nested_if)s)''' % {
+            return_statement = """IF(STRSTARTS(%(attribute)s, "%(article)s"),
+            SUBSTR(%(attribute)s, %(substr_start)s), %(nested_if)s)
+            """ % {
                 'attribute': attr,
                 'article': article + " ",
                 'substr_start': str(len(article) + 2),
-                'nested_if': return_statement}
+                'nested_if': return_statement
+            }
         return return_statement
 
     @staticmethod
@@ -158,8 +163,8 @@ class Query():
     '''.replace('\n', ' ').strip() % {
             'where_clause': where_clause.replace('\n', ' ').strip(),
             'music_dir': Query.MUSIC_URI,
-            'album_order': Query.order_by_statement("?title_lower"),
-            'artist_order': Query.order_by_statement("?artist_lower"),
+            'album_order': Query._order_by_statement("?title_lower"),
+            'artist_order': Query._order_by_statement("?artist_lower"),
         }
 
         return query
@@ -193,8 +198,8 @@ class Query():
     '''.replace('\n', ' ').strip() % {
             'where_clause': where_clause.replace('\n', ' ').strip(),
             'music_dir': Query.MUSIC_URI,
-            'artist_order': Query.order_by_statement("?artist_lower"),
-            'album_order': Query.order_by_statement("?title_lower")
+            'artist_order': Query._order_by_statement("?artist_lower"),
+            'album_order': Query._order_by_statement("?title_lower")
         }
 
         return query


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]