Merge lp:~mvo/software-center/fix-new-pep8 into lp:software-center

Proposed by Michael Vogt
Status: Merged
Merged at revision: 3100
Proposed branch: lp:~mvo/software-center/fix-new-pep8
Merge into: lp:software-center
Diff against target: 433 lines (+43/-44)
19 files modified
softwarecenter/backend/installbackend_impl/aptd.py (+3/-3)
softwarecenter/backend/installbackend_impl/packagekitd.py (+2/-2)
softwarecenter/backend/launchpad.py (+1/-1)
softwarecenter/backend/weblive.py (+1/-1)
softwarecenter/backend/weblive_pristine.py (+6/-6)
softwarecenter/db/appfilter.py (+2/-2)
softwarecenter/db/categories.py (+1/-1)
softwarecenter/db/pkginfo_impl/aptcache.py (+7/-7)
softwarecenter/ui/gtk3/app.py (+3/-3)
softwarecenter/ui/gtk3/panes/historypane.py (+1/-1)
softwarecenter/ui/gtk3/panes/pendingpane.py (+1/-1)
softwarecenter/ui/gtk3/utils.py (+2/-3)
softwarecenter/ui/gtk3/views/appdetailsview.py (+2/-2)
softwarecenter/ui/gtk3/views/purchaseview.py (+1/-1)
softwarecenter/ui/gtk3/widgets/apptreeview.py (+1/-1)
softwarecenter/ui/gtk3/widgets/recommendations.py (+2/-2)
softwarecenter/ui/gtk3/widgets/reviews.py (+2/-2)
softwarecenter/ui/gtk3/widgets/weblivedialog.py (+1/-1)
softwarecenter/utils.py (+4/-4)
To merge this branch: bzr merge lp:~mvo/software-center/fix-new-pep8
Reviewer Review Type Date Requested Status
Gary Lasker (community) Approve
Review via email: mp+119695@code.launchpad.net

Description of the change

This branch fixes the pep8 issues that the quantal pep8 branch complains about.

To post a comment you must log in.
lp:~mvo/software-center/fix-new-pep8 updated
3080. By Michael Vogt

softwarecenter/ui/gtk3/widgets/apptreeview.py: fix a leftover pep8 issue

3081. By Michael Vogt

merged from trunk

3082. By Michael Vogt

fix some more pep8 issues from recent merges

Revision history for this message
Gary Lasker (gary-lasker) wrote :

This is very nice, thanks a lot for this, mvo!

Oh, I found that there's an issue that doesn't allow this branch to run on Precise (a crash in the weblive code where it has been updated to use isinstance). This has a very simple fix so I will make a branch for that and propose it for merging.

Thanks again!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'softwarecenter/backend/installbackend_impl/aptd.py'
2--- softwarecenter/backend/installbackend_impl/aptd.py 2012-07-16 16:43:26 +0000
3+++ softwarecenter/backend/installbackend_impl/aptd.py 2012-08-16 14:48:21 +0000
4@@ -323,7 +323,7 @@
5 def remove_multiple(self, apps, iconnames, addons_install=[],
6 addons_remove=[], metadatas=None):
7 """ queue a list of packages for removal """
8- if metadatas == None:
9+ if metadatas is None:
10 metadatas = []
11 for item in apps:
12 metadatas.append(None)
13@@ -367,7 +367,7 @@
14 def install_multiple(self, apps, iconnames, addons_install=[],
15 addons_remove=[], metadatas=None):
16 """ queue a list of packages for install """
17- if metadatas == None:
18+ if metadatas is None:
19 metadatas = []
20 for item in apps:
21 metadatas.append(None)
22@@ -582,7 +582,7 @@
23 'sc_add_repo_and_install_try': "1",
24 'sc_add_repo_and_install_license_key': license_key or "",
25 'sc_add_repo_and_install_license_key_path': license_key_path or "",
26- 'sc_add_repo_and_install_license_key_token': \
27+ 'sc_add_repo_and_install_license_key_token':
28 json_oauth_token or "",
29 }
30
31
32=== modified file 'softwarecenter/backend/installbackend_impl/packagekitd.py'
33--- softwarecenter/backend/installbackend_impl/packagekitd.py 2012-03-19 21:01:47 +0000
34+++ softwarecenter/backend/installbackend_impl/packagekitd.py 2012-08-16 14:48:21 +0000
35@@ -119,8 +119,8 @@
36 #LOG.debug('is_downloading ' + str(self._trans.get_property('status')))
37 status = self._trans.get_property('status')
38 return status == packagekit.StatusEnum.DOWNLOAD or \
39- (status >= packagekit.StatusEnum.DOWNLOAD_REPOSITORY and \
40- status <= packagekit.StatusEnum.DOWNLOAD_UPDATEINFO)
41+ (status >= packagekit.StatusEnum.DOWNLOAD_REPOSITORY and
42+ status <= packagekit.StatusEnum.DOWNLOAD_UPDATEINFO)
43
44 def cancel(self):
45 proxy = dbus.SystemBus().get_object('org.freedesktop.PackageKit',
46
47=== modified file 'softwarecenter/backend/launchpad.py'
48--- softwarecenter/backend/launchpad.py 2012-03-19 14:20:55 +0000
49+++ softwarecenter/backend/launchpad.py 2012-08-16 14:48:21 +0000
50@@ -266,7 +266,7 @@
51 return self._format_archive_subscription_urls_as_deb_lines(urls)
52
53 def _format_archive_subscription_urls_as_deb_lines(self, urls):
54- deb_lines = ["deb %s %s main" % (url, self.distro.get_codename()) \
55+ deb_lines = ["deb %s %s main" % (url, self.distro.get_codename())
56 for url in urls]
57 return deb_lines
58
59
60=== modified file 'softwarecenter/backend/weblive.py'
61--- softwarecenter/backend/weblive.py 2012-03-19 13:35:47 +0000
62+++ softwarecenter/backend/weblive.py 2012-08-16 14:48:21 +0000
63@@ -265,7 +265,7 @@
64
65 qtnx_start_timer()
66
67- if wait == False:
68+ if wait is False:
69 # Start in the background and attach a watch for when it exits
70 (self.helper_pid, stdin, stdout, stderr) = GObject.spawn_async(
71 cmd, standard_input=True, standard_output=True,
72
73=== modified file 'softwarecenter/backend/weblive_pristine.py'
74--- softwarecenter/backend/weblive_pristine.py 2012-03-19 13:35:47 +0000
75+++ softwarecenter/backend/weblive_pristine.py 2012-08-16 14:48:21 +0000
76@@ -138,7 +138,7 @@
77 query['locale'] = locale
78 reply = self.do_query(query)
79
80- if type(reply['message']) != type([]):
81+ if not isinstance(reply['message'], []):
82 if reply['message'] == 1:
83 raise WebLiveError("Reached user limit, return false.")
84 elif reply['message'] == 2:
85@@ -165,7 +165,7 @@
86 query['action'] = 'list_everything'
87 reply = self.do_query(query)
88
89- if type(reply['message']) != type({}):
90+ if not isinstance(reply['message'], {}):
91 raise WebLiveError("Invalid value, expected '%s' and got '%s'."
92 % (type({}), type(reply['message'])))
93
94@@ -193,7 +193,7 @@
95 query['serverid'] = serverid
96 reply = self.do_query(query)
97
98- if type(reply['message']) != type([]):
99+ if not isinstance(reply['message'], []):
100 raise WebLiveError("Invalid value, expected '%s' and got '%s'."
101 % (type({}), type(reply['message'])))
102
103@@ -207,7 +207,7 @@
104 query['action'] = 'list_package_blacklist'
105 reply = self.do_query(query)
106
107- if type(reply['message']) != type([]):
108+ if not isinstance(reply['message'], []):
109 raise WebLiveError("Invalid value, expected '%s' and got '%s'."
110 % (type({}), type(reply['message'])))
111
112@@ -222,7 +222,7 @@
113 query['serverid'] = serverid
114 reply = self.do_query(query)
115
116- if type(reply['message']) != type([]):
117+ if not isinstance(reply['message'], []):
118 raise WebLiveError("Invalid value, expected '%s' and got '%s'."
119 % (type({}), type(reply['message'])))
120
121@@ -236,7 +236,7 @@
122 query['action'] = 'list_servers'
123 reply = self.do_query(query)
124
125- if type(reply['message']) != type({}):
126+ if isinstance(reply['message'], {}):
127 raise WebLiveError("Invalid value, expected '%s' and got '%s'."
128 % (type({}), type(reply['message'])))
129
130
131=== modified file 'softwarecenter/db/appfilter.py'
132--- softwarecenter/db/appfilter.py 2012-04-30 22:27:29 +0000
133+++ softwarecenter/db/appfilter.py 2012-08-16 14:48:21 +0000
134@@ -101,8 +101,8 @@
135 if global_filter.supported_only:
136 if not self.distro.is_supported(self.cache, doc, pkgname):
137 return False
138- if self.restricted_list != False: # keep != False as the set can be
139- # empty
140+ if self.restricted_list is not False: # keep != False as the set can
141+ # be empty
142 if not pkgname in self.restricted_list:
143 return False
144 return True
145
146=== modified file 'softwarecenter/db/categories.py'
147--- softwarecenter/db/categories.py 2012-08-16 01:30:32 +0000
148+++ softwarecenter/db/categories.py 2012-08-16 14:48:21 +0000
149@@ -250,7 +250,7 @@
150 def parse_applications_menu(self, datadir):
151 """ parse a application menu and return a list of Category objects """
152 if datadir in self.CATEGORIES_PARSER_CACHE:
153- return self.CATEGORIES_PARSER_CACHE[datadir]
154+ return self.CATEGORIES_PARSER_CACHE[datadir]
155 categories = []
156 # we support multiple menu files and menu drop ins
157 menu_files = [datadir + "/desktop/software-center.menu"]
158
159=== modified file 'softwarecenter/db/pkginfo_impl/aptcache.py'
160--- softwarecenter/db/pkginfo_impl/aptcache.py 2012-08-01 04:37:06 +0000
161+++ softwarecenter/db/pkginfo_impl/aptcache.py 2012-08-16 14:48:21 +0000
162@@ -242,7 +242,7 @@
163 else:
164 progress = GtkMainIterationProgress()
165 with ExecutionTime("open the apt cache (in event loop)"):
166- if self._cache == None:
167+ if self._cache is None:
168 self._cache = apt.Cache(progress)
169 else:
170 self._cache.open(progress)
171@@ -394,7 +394,7 @@
172 @convert_package_argument
173 def _get_depends_by_type(self, pkg, types):
174 version = pkg.installed
175- if version == None:
176+ if version is None:
177 version = pkg.candidate
178 return version.get_dependencies(*types)
179
180@@ -515,7 +515,7 @@
181 @convert_package_argument
182 def _get_changes_without_applying(self, pkg):
183 try:
184- if pkg.installed == None:
185+ if pkg.installed is None:
186 pkg.mark_install()
187 else:
188 pkg.mark_delete()
189@@ -587,7 +587,7 @@
190 if addons_install is not None:
191 all_install += addons_install
192
193- if version == None:
194+ if version is None:
195 # its important that its the first pkg as the depcache will
196 # get cleared for each pkg and that will means that the
197 # set_candidate_release is lost again
198@@ -609,7 +609,7 @@
199 deps_inst = self._try_install_and_get_all_deps_installed(
200 self._cache[p])
201 for dep in deps_inst:
202- if self._cache[dep].installed == None:
203+ if self._cache[dep].installed is None:
204 dep_version = self._cache[dep].candidate
205 pkgs_to_install.append(dep_version)
206 deps_remove = self._try_install_and_get_all_deps_removed(
207@@ -626,13 +626,13 @@
208 deps_inst = self._try_install_and_get_all_deps_installed(
209 self._cache[p])
210 for dep in deps_inst:
211- if self._cache[dep].installed == None:
212+ if self._cache[dep].installed is None:
213 version = self._cache[dep].candidate
214 pkgs_to_install.append(version)
215 deps_remove = self._try_install_and_get_all_deps_removed(
216 self._cache[p])
217 for dep in deps_remove:
218- if self._cache[dep].installed != None:
219+ if self._cache[dep].installed is not None:
220 version = self._cache[dep].installed
221 pkgs_to_remove.append(version)
222
223
224=== modified file 'softwarecenter/ui/gtk3/app.py'
225--- softwarecenter/ui/gtk3/app.py 2012-08-09 02:35:18 +0000
226+++ softwarecenter/ui/gtk3/app.py 2012-08-16 14:48:21 +0000
227@@ -1129,7 +1129,7 @@
228 if self.menuitem_view.blocked:
229 return
230 from softwarecenter.db.appfilter import get_global_filter
231- if get_global_filter().supported_only == True:
232+ if get_global_filter().supported_only is True:
233 get_global_filter().supported_only = False
234
235 self.available_pane.refresh_apps()
236@@ -1142,7 +1142,7 @@
237 if self.menuitem_view.blocked:
238 return
239 from softwarecenter.db.appfilter import get_global_filter
240- if get_global_filter().supported_only == False:
241+ if get_global_filter().supported_only is False:
242 get_global_filter().supported_only = True
243
244 self.available_pane.refresh_apps()
245@@ -1200,7 +1200,7 @@
246
247 def _ask_and_repair_broken_cache(self):
248 # wait until the window window is available
249- if self.window_main.props.visible == False:
250+ if self.window_main.props.visible is False:
251 GObject.timeout_add_seconds(1, self._ask_and_repair_broken_cache)
252 return
253 if dialogs.confirm_repair_broken_cache(self.window_main,
254
255=== modified file 'softwarecenter/ui/gtk3/panes/historypane.py'
256--- softwarecenter/ui/gtk3/panes/historypane.py 2012-06-18 20:26:49 +0000
257+++ softwarecenter/ui/gtk3/panes/historypane.py 2012-08-16 14:48:21 +0000
258@@ -160,7 +160,7 @@
259 self.busy_cursor = Gdk.Cursor.new(Gdk.CursorType.WATCH)
260
261 def init_view(self):
262- if self.history == None:
263+ if self.history is None:
264 # if the history is not yet initialized we have to load and parse
265 # it show a spinner while we do that
266 self.realize()
267
268=== modified file 'softwarecenter/ui/gtk3/panes/pendingpane.py'
269--- softwarecenter/ui/gtk3/panes/pendingpane.py 2012-06-18 20:26:49 +0000
270+++ softwarecenter/ui/gtk3/panes/pendingpane.py 2012-08-16 14:48:21 +0000
271@@ -84,7 +84,7 @@
272 def _on_button_pressed(self, widget, event):
273 """button press handler to capture clicks on the cancel button"""
274 #print "_on_clicked: ", event
275- if event == None or event.button != 1:
276+ if event is None or event.button != 1:
277 return
278 res = self.tv.get_path_at_pos(int(event.x), int(event.y))
279 if not res:
280
281=== modified file 'softwarecenter/ui/gtk3/utils.py'
282--- softwarecenter/ui/gtk3/utils.py 2012-03-26 14:58:22 +0000
283+++ softwarecenter/ui/gtk3/utils.py 2012-08-16 14:48:21 +0000
284@@ -60,9 +60,8 @@
285 context.remove_provider_for_screen(screen, toplevel._css_provider)
286
287 # munge css path for theme-name
288- css_path = os.path.join(datadir,
289- "ui/gtk3/css/softwarecenter.%s.css" % \
290- theme_name)
291+ css_path = os.path.join(
292+ datadir, "ui/gtk3/css/softwarecenter.%s.css" % theme_name)
293
294 # if no css for theme-name try fallback css
295 if not os.path.exists(css_path):
296
297=== modified file 'softwarecenter/ui/gtk3/views/appdetailsview.py'
298--- softwarecenter/ui/gtk3/views/appdetailsview.py 2012-08-16 02:22:16 +0000
299+++ softwarecenter/ui/gtk3/views/appdetailsview.py 2012-08-16 14:48:21 +0000
300@@ -594,7 +594,7 @@
301
302 loader = self.get_ancestor(AppDetailsView).review_loader
303 stats = loader.get_review_stats(self.app)
304- if stats != None:
305+ if stats is not None:
306 rating = Star()
307 #~ rating.set_visible_window(False)
308 rating.set_size_small()
309@@ -672,7 +672,7 @@
310
311 addon = Addon(self.db, self.icons, addon_name)
312 #addon.pkgname.connect("clicked", not yet suitable for use)
313- addon.set_active(self.cache[addon_name].installed != None)
314+ addon.set_active(self.cache[addon_name].installed is not None)
315 addon.checkbutton.connect("toggled",
316 self.addons_manager.mark_changes)
317 self.pack_start(addon, False, False, 0)
318
319=== modified file 'softwarecenter/ui/gtk3/views/purchaseview.py'
320--- softwarecenter/ui/gtk3/views/purchaseview.py 2012-08-10 13:23:52 +0000
321+++ softwarecenter/ui/gtk3/views/purchaseview.py 2012-08-16 14:48:21 +0000
322@@ -247,7 +247,7 @@
323 except:
324 LOG.debug("error processing json: '%s'" % json_string)
325 return
326- if res["successful"] == False:
327+ if res["successful"] is False:
328 if (res.get("user_canceled", False) or
329 # note the different spelling
330 res.get("user_cancelled", False) or
331
332=== modified file 'softwarecenter/ui/gtk3/widgets/apptreeview.py'
333--- softwarecenter/ui/gtk3/widgets/apptreeview.py 2012-07-19 09:29:16 +0000
334+++ softwarecenter/ui/gtk3/widgets/apptreeview.py 2012-08-16 14:48:21 +0000
335@@ -179,7 +179,7 @@
336 "apptreeview.expand_path: Supplied 'old' "
337 "path is an invalid tree path: '%s'" % old)
338
339- if path == None:
340+ if path is None:
341 return
342
343 model.row_changed(path, model.get_iter(path))
344
345=== modified file 'softwarecenter/ui/gtk3/widgets/recommendations.py'
346--- softwarecenter/ui/gtk3/widgets/recommendations.py 2012-08-16 07:03:58 +0000
347+++ softwarecenter/ui/gtk3/widgets/recommendations.py 2012-08-16 14:48:21 +0000
348@@ -158,7 +158,7 @@
349 self.subcategory = None
350 self.set_header_label(_(u"Recommended For You"))
351 self.recommended_for_you_content = None
352- # .is_opted_in() means either "successfully opted-in" or
353+ # .is_opted_in() means either "successfully opted-in" or
354 # "requested opt-in" (but not done yet)
355 if self.recommender_agent.is_opted_in():
356 if network_state_is_connected():
357@@ -167,7 +167,7 @@
358 if self.recommender_agent.opt_in_requested:
359 # the user has opted in but has not yet completed the
360 # initial recommender profile upload, therefore there
361- # are no cached values available yet to display
362+ # are no cached values available yet to display
363 self._show_no_network_view()
364 else:
365 # display cached recommendations
366
367=== modified file 'softwarecenter/ui/gtk3/widgets/reviews.py'
368--- softwarecenter/ui/gtk3/widgets/reviews.py 2012-05-31 12:28:46 +0000
369+++ softwarecenter/ui/gtk3/widgets/reviews.py 2012-08-16 14:48:21 +0000
370@@ -713,7 +713,7 @@
371 self.footer.pack_start(self.useful, False, False, 3)
372 # add here, but only populate if its not the own review
373 self.likebox = Gtk.HBox()
374- if already_voted == None and not current_user_reviewer:
375+ if already_voted is None and not current_user_reviewer:
376 m = '<small>%s</small>'
377 self.yes_like = Link(m % _('Yes'))
378 self.yes_like.set_name("subtle-label")
379@@ -755,7 +755,7 @@
380 '''returns Gtk.Label() to be used as usefulness label depending
381 on passed in parameters
382 '''
383- if already_voted == None:
384+ if already_voted is None:
385 if useful_total == 0 and current_user_reviewer:
386 s = ""
387 elif useful_total == 0:
388
389=== modified file 'softwarecenter/ui/gtk3/widgets/weblivedialog.py'
390--- softwarecenter/ui/gtk3/widgets/weblivedialog.py 2012-03-08 17:42:36 +0000
391+++ softwarecenter/ui/gtk3/widgets/weblivedialog.py 2012-08-16 14:48:21 +0000
392@@ -101,7 +101,7 @@
393 self.set_border_width(8)
394
395 def run(self):
396- if self.show_dialog == False:
397+ if self.show_dialog is False:
398 return Gtk.ResponseType.OK
399
400 self.show_all()
401
402=== modified file 'softwarecenter/utils.py'
403--- softwarecenter/utils.py 2012-08-16 02:11:29 +0000
404+++ softwarecenter/utils.py 2012-08-16 14:48:21 +0000
405@@ -398,7 +398,7 @@
406 try:
407 icon = icons.load_icon(iconname, iconsize, 0)
408 except Exception as e:
409- LOG.warning(utf8("could not load icon '%s', displaying missing "\
410+ LOG.warning(utf8("could not load icon '%s', displaying missing "
411 "icon instead: %s ") % (
412 utf8(iconname), utf8(e.message)))
413 icon = icons.load_icon(missingicon, iconsize, 0)
414@@ -542,8 +542,8 @@
415
416
417 def get_nice_size(n_bytes):
418- nice_size = lambda s: [(s % 1024 ** i and "%.1f" % (s / 1024.0 ** i) or \
419- str(s / 1024 ** i)) + x.strip() for i, x in enumerate(' KMGTPEZY') \
420+ nice_size = lambda s: [(s % 1024 ** i and "%.1f" % (s / 1024.0 ** i) or
421+ str(s / 1024 ** i)) + x.strip() for i, x in enumerate(' KMGTPEZY')
422 if s < 1024 ** (i + 1) or i == 8][0]
423 return nice_size(n_bytes)
424
425@@ -667,7 +667,7 @@
426 softwarecenter.paths.APP_INSTALL_PATH
427 if not os.path.exists(path):
428 softwarecenter.paths.APP_INSTALL_PATH = './build/share/app-install'
429- logging.warn("using local APP_INSTALL_PATH: %s" %\
430+ logging.warn("using local APP_INSTALL_PATH: %s" %
431 softwarecenter.paths.APP_INSTALL_PATH)
432 else:
433 datadir = softwarecenter.paths.datadir

Subscribers

People subscribed via source and target branches