changeset 233:e34c53a3e407

fixes from eric's style check
author Dirk Olmes <dirk@xanthippe.ping.de>
date Thu, 25 Sep 2014 17:26:34 +0200
parents 18865de3a87d
children 82199c57ad93
files BackendFactory.py PreferencesDialog.py backend/AbstractFeedUpdater.py backend/couchdb/CouchDbBackend.py backend/couchdb/ListDateTimeField.py backend/couchdb/Preferences.py backend/sqlalchemy/Mapping.py backend/sqlalchemy/Preferences.py feedworm.py prettyprint.py
diffstat 10 files changed, 15 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/BackendFactory.py	Thu Sep 25 17:10:40 2014 +0200
+++ b/BackendFactory.py	Thu Sep 25 17:26:34 2014 +0200
@@ -6,7 +6,7 @@
 
 def _parseArguments():
     parser = argparse.ArgumentParser()
-    parser.add_argument("--backend", nargs="?", choices=[SQLALCHEMY_BACKEND, COUCHDB_BACKEND], 
+    parser.add_argument("--backend", nargs="?", choices=[SQLALCHEMY_BACKEND, COUCHDB_BACKEND],
         required=True, help="Specify the backend to use: either sqlalchemy or couchdb")
     return parser.parse_known_args()
 
--- a/PreferencesDialog.py	Thu Sep 25 17:10:40 2014 +0200
+++ b/PreferencesDialog.py	Thu Sep 25 17:26:34 2014 +0200
@@ -82,7 +82,7 @@
 
     def accept(self):
         self.storeProxySettings()
-        self.preferences.commit();
+        self.preferences.commit()
         super(PreferencesDialog, self).accept()
 
     def reject(self):
--- a/backend/AbstractFeedUpdater.py	Thu Sep 25 17:10:40 2014 +0200
+++ b/backend/AbstractFeedUpdater.py	Thu Sep 25 17:26:34 2014 +0200
@@ -27,7 +27,7 @@
     def _retrieveFeed(self):
         if self.preferences.isProxyConfigured():
             proxyUrl = "http://%s:%i" % (self.preferences.proxyHost(), self.preferences.proxyPort())
-            proxyHandler = ProxyHandler({"http" : proxyUrl})
+            proxyHandler = ProxyHandler({"http": proxyUrl})
             result = feedparser.parse(self.feed.rss_url, handlers=[proxyHandler])
         else:
             # when updating to python3 see http://code.google.com/p/feedparser/issues/detail?id=260
@@ -88,7 +88,7 @@
 
     def _setFeedTitle(self, feedDict):
         if self.feed.title is None:
-            if feedDict.feed.has_key("title"):
+            if 'title' in feedDict.feed:
                 self.feed.title = feedDict.feed.title
             else:
                 self.feed.title = self.feed.rss_url
--- a/backend/couchdb/CouchDbBackend.py	Thu Sep 25 17:10:40 2014 +0200
+++ b/backend/couchdb/CouchDbBackend.py	Thu Sep 25 17:26:34 2014 +0200
@@ -58,7 +58,7 @@
     def _retrieveEntriesForSelectedFeed(self, hideReadEntries):
         viewResults = FeedEntry.entriesForFeed(self.selectedFeed, self.database)
         if hideReadEntries:
-            filterFunc = lambda feedEntry: feedEntry.read == False
+            filterFunc = lambda feedEntry: feedEntry.read is False
             viewResults = filter(filterFunc, viewResults)
         return viewResults
 
@@ -76,7 +76,6 @@
     def toggleSelectedFeedEntryRead(self):
         self.selectedFeedEntry.toggleRead(self.database)
 
-
     def createFeed(self, url):
         feed = Feed.create(url)
         feed.store(self.database)
--- a/backend/couchdb/ListDateTimeField.py	Thu Sep 25 17:10:40 2014 +0200
+++ b/backend/couchdb/ListDateTimeField.py	Thu Sep 25 17:26:34 2014 +0200
@@ -10,5 +10,5 @@
 
     def _to_json(self, value):
         if isinstance(value, datetime):
-            return [ value.year, value.month, value.day, value.hour, value.minute, value.second ]
+            return [value.year, value.month, value.day, value.hour, value.minute, value.second]
         return value
--- a/backend/couchdb/Preferences.py	Thu Sep 25 17:10:40 2014 +0200
+++ b/backend/couchdb/Preferences.py	Thu Sep 25 17:26:34 2014 +0200
@@ -21,7 +21,7 @@
             row = iter(viewResults).next()
             self.document = self.database[row.id]
         except StopIteration:
-            empty = { "doctype" : "preferences" }
+            empty = {"doctype": "preferences"}
             doc_id, doc_rev = self.database.save(empty)                 #@UnusedVariable
             self.document = self.database[doc_id]
 
--- a/backend/sqlalchemy/Mapping.py	Thu Sep 25 17:10:40 2014 +0200
+++ b/backend/sqlalchemy/Mapping.py	Thu Sep 25 17:26:34 2014 +0200
@@ -18,8 +18,10 @@
 feedEntryTable = None
 
 def createMapping(engine):
-    """ Make sure the mapping is defined only once. This is not really needed for the feed updater
-        or the GUI app but comes in handy when working interactively with the system. """
+    """
+    Make sure the mapping is defined only once. This is not really needed for the feed updater
+    or the GUI app but comes in handy when working interactively with the system. 
+    """
     global mappingDefined
     if not mappingDefined:
         _createMapping(engine)
--- a/backend/sqlalchemy/Preferences.py	Thu Sep 25 17:10:40 2014 +0200
+++ b/backend/sqlalchemy/Preferences.py	Thu Sep 25 17:26:34 2014 +0200
@@ -23,7 +23,7 @@
         self.cache = {}
 
     def _cachedPreference(self, key, defaultValue=None, addIfMissing=True):
-        if self.cache.has_key(key):
+        if key in self.cache:
             return self.cache[key]
         else:
             pref = Preference.forKey(key, self.session)
--- a/feedworm.py	Thu Sep 25 17:10:40 2014 +0200
+++ b/feedworm.py	Thu Sep 25 17:26:34 2014 +0200
@@ -19,7 +19,7 @@
 
 def configureLogging():
     logging.basicConfig(level=logging.DEBUG)
-    
+
 def setupProxy(preferences):
     if preferences.isProxyConfigured() and preferences.useProxy():
         proxyHost = preferences.proxyHost()
--- a/prettyprint.py	Thu Sep 25 17:10:40 2014 +0200
+++ b/prettyprint.py	Thu Sep 25 17:26:34 2014 +0200
@@ -1,7 +1,7 @@
 # -*- coding: utf-8 -*-
 import sys
 
-newlineAfter = [ '{', '[', ',' ]
+newlineAfter = ['{', '[', ',']
 newlineBefore = [ '}', ']' ]
 
 def prettyPrint(file):
@@ -38,7 +38,7 @@
     
 def nl_p(char):
     sys.stdout.write("\n")
-    sys.stdout.write(char)    
+    sys.stdout.write(char)
 
 if __name__ == "__main__":
     if len(sys.argv) < 2: