From bdf4c13f4e207cdb9cf994fca6e9336885e37c8f Mon Sep 17 00:00:00 2001 From: Romain Bignon Date: Sat, 27 Jul 2013 19:00:58 +0200 Subject: [PATCH] remove useless calls to ReplApplication.flush() (closes #812) --- weboob/applications/boobank/boobank.py | 2 -- weboob/applications/boobill/boobill.py | 3 --- weboob/applications/booblyrics/booblyrics.py | 2 -- weboob/applications/boobmsg/boobmsg.py | 8 ------- weboob/applications/boobooks/boobooks.py | 1 - .../applications/boobtracker/boobtracker.py | 3 --- weboob/applications/cineoob/cineoob.py | 21 ------------------- weboob/applications/comparoob/comparoob.py | 2 -- weboob/applications/cookboob/cookboob.py | 2 -- weboob/applications/flatboob/flatboob.py | 2 -- weboob/applications/galleroob/galleroob.py | 2 -- weboob/applications/handjoob/handjoob.py | 2 -- weboob/applications/havedate/havedate.py | 2 -- weboob/applications/radioob/radioob.py | 2 -- weboob/applications/suboob/suboob.py | 2 -- .../applications/translaboob/translaboob.py | 1 - weboob/applications/traveloob/traveloob.py | 3 --- weboob/applications/videoob/videoob.py | 2 -- .../webcontentedit/webcontentedit.py | 1 - weboob/applications/weboobcfg/weboobcfg.py | 2 -- .../applications/weboorrents/weboorrents.py | 2 -- weboob/applications/wetboobs/wetboobs.py | 7 ------- 22 files changed, 74 deletions(-) diff --git a/weboob/applications/boobank/boobank.py b/weboob/applications/boobank/boobank.py index b1795473..830edc35 100644 --- a/weboob/applications/boobank/boobank.py +++ b/weboob/applications/boobank/boobank.py @@ -329,7 +329,6 @@ class Boobank(ReplApplication): self.start_format() for backend, recipient in self.do('iter_transfer_recipients', id_from, backends=names): self.cached_format(recipient) - self.flush() return 0 id_to, backend_name_to = self.parse_id(id_to) @@ -361,7 +360,6 @@ class Boobank(ReplApplication): self.start_format() for backend, transfer in self.do('transfer', id_from, id_to, amount, reason, backends=names): self.format(transfer) - self.flush() def do_investment(self, id): """ diff --git a/weboob/applications/boobill/boobill.py b/weboob/applications/boobill/boobill.py index 4ba66e0f..244245e3 100644 --- a/weboob/applications/boobill/boobill.py +++ b/weboob/applications/boobill/boobill.py @@ -73,7 +73,6 @@ class Boobill(ReplApplication): self.start_format() for backend, result in self.do(method, id, backends=names): self.format(result) - self.flush() def do_subscriptions(self, line): """ @@ -84,7 +83,6 @@ class Boobill(ReplApplication): self.start_format() for subscription in self.get_object_list('iter_subscription'): self.format(subscription) - self.flush() def do_details(self, id): """ @@ -117,7 +115,6 @@ class Boobill(ReplApplication): mysum.price = detail.price + mysum.price self.format(mysum) - self.flush() def do_balance(self, id): """ diff --git a/weboob/applications/booblyrics/booblyrics.py b/weboob/applications/booblyrics/booblyrics.py index b2df5b1b..520bb0e1 100644 --- a/weboob/applications/booblyrics/booblyrics.py +++ b/weboob/applications/booblyrics/booblyrics.py @@ -90,7 +90,6 @@ class Booblyrics(ReplApplication): self.start_format() self.format(songlyrics) - self.flush() def complete_search(self, text, line, *ignored): args = line.split(' ') @@ -112,4 +111,3 @@ class Booblyrics(ReplApplication): self.start_format(pattern=pattern) for backend, songlyrics in self.do('iter_lyrics', criteria, pattern): self.cached_format(songlyrics) - self.flush() diff --git a/weboob/applications/boobmsg/boobmsg.py b/weboob/applications/boobmsg/boobmsg.py index 449516f6..157e0cc0 100644 --- a/weboob/applications/boobmsg/boobmsg.py +++ b/weboob/applications/boobmsg/boobmsg.py @@ -418,7 +418,6 @@ class Boobmsg(ReplApplication): else: self.threads.append(thread) self.format(thread) - self.flush() def do_export_all(self, arg): """ @@ -438,7 +437,6 @@ class Boobmsg(ReplApplication): self.start_format() for backend, msg in self.do(func): self.format(msg) - self.flush() def do_export_thread(self, arg): """ @@ -453,7 +451,6 @@ class Boobmsg(ReplApplication): if thread is not None : for msg in thread.iter_all_messages(): self.format(msg) - self.flush() def do_show(self, arg): """ @@ -477,7 +474,6 @@ class Boobmsg(ReplApplication): if message is not None: self.start_format() self.format(message) - self.flush() self.weboob.do('set_message_read', message, backends=message.backend) return else: @@ -500,8 +496,6 @@ class Boobmsg(ReplApplication): if not found: self.logger.error(u'Profile not found') - else: - self.flush() def do_photos(self, id): """ @@ -535,5 +529,3 @@ class Boobmsg(ReplApplication): if not found: self.logger.error(u'Profile not found') - else: - self.flush() diff --git a/weboob/applications/boobooks/boobooks.py b/weboob/applications/boobooks/boobooks.py index 416dc6b2..a6612d37 100644 --- a/weboob/applications/boobooks/boobooks.py +++ b/weboob/applications/boobooks/boobooks.py @@ -69,4 +69,3 @@ class Boobooks(ReplApplication): for backend, renew in self.do('renew_book', id, backends=names): self.format(renew) - self.flush() diff --git a/weboob/applications/boobtracker/boobtracker.py b/weboob/applications/boobtracker/boobtracker.py index 83c77ec4..7b17bf4e 100644 --- a/weboob/applications/boobtracker/boobtracker.py +++ b/weboob/applications/boobtracker/boobtracker.py @@ -134,7 +134,6 @@ class BoobTracker(ReplApplication): for backend, issue in self.do('iter_issues', query, backends=backends): self.add_object(issue) self.format(issue) - self.flush() def complete_get(self, text, line, *ignored): args = line.split(' ') @@ -156,7 +155,6 @@ class BoobTracker(ReplApplication): print >>sys.stderr, 'Issue not found: %s' % line return 3 self.format(issue) - self.flush() def complete_comment(self, text, line, *ignored): args = line.split(' ') @@ -346,7 +344,6 @@ class BoobTracker(ReplApplication): if i: print 'Issue %s%s@%s%s updated' % (self.BOLD, issue.id, issue.backend, self.NC) self.format(i) - self.flush() def complete_attach(self, text, line, *ignored): args = line.split(' ') diff --git a/weboob/applications/cineoob/cineoob.py b/weboob/applications/cineoob/cineoob.py index 8f48fab2..f5659ccf 100644 --- a/weboob/applications/cineoob/cineoob.py +++ b/weboob/applications/cineoob/cineoob.py @@ -244,18 +244,15 @@ class Cineoob(ReplApplication): lid1 = [] for backend, id in self.do('iter_person_movies_ids', person1.id, caps=ICapCinema): lid1.append(id) - self.flush() lid2 = [] for backend, id in self.do('iter_person_movies_ids', person2.id, caps=ICapCinema): lid2.append(id) - self.flush() self.options.count = initial_count inter = list(set(lid1) & set(lid2)) for common in inter: movie = self.get_object(common, 'get_movie', caps=ICapCinema) if movie: self.cached_format(movie) - self.flush() def do_persons_in_common(self, line): """ @@ -264,7 +261,6 @@ class Cineoob(ReplApplication): Get the list of common persons between two movies. """ id1, id2 = self.parse_command_args(line, 2, 1) - self.flush() movie1 = self.get_object(id1, 'get_movie', caps=ICapCinema) if not movie1: @@ -281,17 +277,14 @@ class Cineoob(ReplApplication): lid1 = [] for backend, id in self.do('iter_movie_persons_ids', movie1.id, caps=ICapCinema): lid1.append(id) - self.flush() lid2 = [] for backend, id in self.do('iter_movie_persons_ids', movie2.id, caps=ICapCinema): lid2.append(id) - self.flush() self.options.count = initial_count inter = list(set(lid1) & set(lid2)) for common in inter: person = self.get_object(common, 'get_person', caps=ICapCinema) self.cached_format(person) - self.flush() def do_info_movie(self, id): """ @@ -307,7 +300,6 @@ class Cineoob(ReplApplication): self.start_format() self.format(movie) - self.flush() def do_info_person(self, id): """ @@ -323,7 +315,6 @@ class Cineoob(ReplApplication): self.start_format() self.format(person) - self.flush() @defaultcount(10) def do_search_movie(self, pattern): @@ -339,7 +330,6 @@ class Cineoob(ReplApplication): self.start_format(pattern=pattern) for backend, movie in self.do('iter_movies', pattern=pattern, caps=ICapCinema): self.cached_format(movie) - self.flush() @defaultcount(10) def do_search_person(self, pattern): @@ -355,7 +345,6 @@ class Cineoob(ReplApplication): self.start_format(pattern=pattern) for backend, person in self.do('iter_persons', pattern=pattern, caps=ICapCinema): self.cached_format(person) - self.flush() def do_casting(self, line): """ @@ -373,7 +362,6 @@ class Cineoob(ReplApplication): for backend, person in self.do('iter_movie_persons', movie.id, role, backends=movie.backend, caps=ICapCinema): self.cached_format(person) - self.flush() def do_filmography(self, line): """ @@ -391,7 +379,6 @@ class Cineoob(ReplApplication): for backend, movie in self.do('iter_person_movies', person.id, role, backends=person.backend, caps=ICapCinema): self.cached_format(movie) - self.flush() def do_biography(self, person_id): """ @@ -406,7 +393,6 @@ class Cineoob(ReplApplication): self.start_format() self.format(person) - self.flush() def complete_releases(self, text, line, *ignored): args = line.split(' ') @@ -436,7 +422,6 @@ class Cineoob(ReplApplication): return 3 self.start_format() self.format(movie) - self.flush() #================== TORRENT ================== @@ -459,7 +444,6 @@ class Cineoob(ReplApplication): self.start_format() self.format(torrent) - self.flush() def complete_getfile_torrent(self, text, line, *ignored): args = line.split(' ', 2) @@ -523,7 +507,6 @@ class Cineoob(ReplApplication): self.start_format(pattern=pattern) for backend, torrent in self.do('iter_torrents', pattern=pattern, caps=ICapTorrent): self.cached_format(torrent) - self.flush() @defaultcount(10) def do_search_movie_torrent(self, id): @@ -546,7 +529,6 @@ class Cineoob(ReplApplication): self.start_format(pattern=pattern) for backend, torrent in self.do('iter_torrents', pattern=pattern, caps=ICapTorrent): self.cached_format(torrent) - self.flush() #================== SUBTITLE ================== @@ -569,7 +551,6 @@ class Cineoob(ReplApplication): self.start_format() self.format(subtitle) - self.flush() def complete_getfile_subtitle(self, text, line, *ignored): args = line.split(' ', 2) @@ -648,7 +629,6 @@ class Cineoob(ReplApplication): self.start_format(pattern=pattern) for backend, subtitle in self.do('iter_subtitles', language=language, pattern=pattern, caps=ICapSubtitle): self.cached_format(subtitle) - self.flush() @defaultcount(10) def do_search_movie_subtitle(self, line): @@ -691,4 +671,3 @@ class Cineoob(ReplApplication): self.start_format(pattern=pattern) for backend, subtitle in self.do('iter_subtitles', language=language, pattern=pattern, caps=ICapSubtitle): self.cached_format(subtitle) - self.flush() diff --git a/weboob/applications/comparoob/comparoob.py b/weboob/applications/comparoob/comparoob.py index 27b62652..1b4c401d 100644 --- a/weboob/applications/comparoob/comparoob.py +++ b/weboob/applications/comparoob/comparoob.py @@ -125,7 +125,6 @@ class Comparoob(ReplApplication): products.append(price) for price in sorted(products, key=self._get_price): self.cached_format(price) - self.flush() def _get_price(self, price): return price.cost @@ -147,4 +146,3 @@ class Comparoob(ReplApplication): self.start_format() self.format(price) - self.flush() diff --git a/weboob/applications/cookboob/cookboob.py b/weboob/applications/cookboob/cookboob.py index 20ba7ece..59ebfaf1 100644 --- a/weboob/applications/cookboob/cookboob.py +++ b/weboob/applications/cookboob/cookboob.py @@ -105,7 +105,6 @@ class Cookboob(ReplApplication): self.start_format() self.format(recipe) - self.flush() def complete_export(self, text, line, *ignored): args = line.split(' ', 2) @@ -159,4 +158,3 @@ class Cookboob(ReplApplication): self.start_format(pattern=pattern) for backend, recipe in self.do('iter_recipes', pattern=pattern): self.cached_format(recipe) - self.flush() diff --git a/weboob/applications/flatboob/flatboob.py b/weboob/applications/flatboob/flatboob.py index cecc4968..0f424202 100644 --- a/weboob/applications/flatboob/flatboob.py +++ b/weboob/applications/flatboob/flatboob.py @@ -143,7 +143,6 @@ class Flatboob(ReplApplication): self.start_format() for backend, housing in self.do('search_housings', query): self.cached_format(housing) - self.flush() def ask_int(self, txt): r = self.ask(txt, default='', regexp='(\d+|)') @@ -168,4 +167,3 @@ class Flatboob(ReplApplication): self.start_format() self.format(housing) - self.flush() diff --git a/weboob/applications/galleroob/galleroob.py b/weboob/applications/galleroob/galleroob.py index 04dd46bd..2cc539b2 100644 --- a/weboob/applications/galleroob/galleroob.py +++ b/weboob/applications/galleroob/galleroob.py @@ -75,7 +75,6 @@ class Galleroob(ReplApplication): for backend, gallery in self.do('search_gallery', pattern=pattern, max_results=self.options.count): self.cached_format(gallery) - self.flush() def do_download(self, line): """ @@ -157,4 +156,3 @@ class Galleroob(ReplApplication): self.start_format() self.format(gallery) - self.flush() diff --git a/weboob/applications/handjoob/handjoob.py b/weboob/applications/handjoob/handjoob.py index 827aed7d..01b9d547 100644 --- a/weboob/applications/handjoob/handjoob.py +++ b/weboob/applications/handjoob/handjoob.py @@ -98,7 +98,6 @@ class Handjoob(ReplApplication): self.start_format(pattern=pattern) for backend, job_advert in self.do('search_job', pattern): self.cached_format(job_advert) - self.flush() def complete_info(self, text, line, *ignored): args = line.split(' ') @@ -123,4 +122,3 @@ class Handjoob(ReplApplication): self.start_format() self.format(job_advert) - self.flush() diff --git a/weboob/applications/havedate/havedate.py b/weboob/applications/havedate/havedate.py index 954339e1..ad0151b8 100644 --- a/weboob/applications/havedate/havedate.py +++ b/weboob/applications/havedate/havedate.py @@ -245,7 +245,6 @@ class HaveDate(Boobmsg): status = '' line.append((b, status)) self.format(tuple(line)) - self.flush() return print >>sys.stderr, "No such command '%s'" % cmd return 1 @@ -260,4 +259,3 @@ class HaveDate(Boobmsg): self.start_format() for backend, event in self.do('iter_events'): self.cached_format(event) - self.flush() diff --git a/weboob/applications/radioob/radioob.py b/weboob/applications/radioob/radioob.py index 20b673f0..5895e653 100644 --- a/weboob/applications/radioob/radioob.py +++ b/weboob/applications/radioob/radioob.py @@ -117,7 +117,6 @@ class Radioob(ReplApplication): print >>sys.stderr, 'Radio not found:', _id return 3 self.format(radio) - self.flush() @defaultcount(10) def do_search(self, pattern=None): @@ -133,7 +132,6 @@ class Radioob(ReplApplication): for backend, radio in self.do('iter_radios_search', pattern=pattern): self.add_object(radio) self.format(radio) - self.flush() def do_ls(self, line): """ diff --git a/weboob/applications/suboob/suboob.py b/weboob/applications/suboob/suboob.py index e409a9d1..bd7f01a6 100644 --- a/weboob/applications/suboob/suboob.py +++ b/weboob/applications/suboob/suboob.py @@ -119,7 +119,6 @@ class Suboob(ReplApplication): self.start_format() self.format(subtitle) - self.flush() def complete_download(self, text, line, *ignored): args = line.split(' ', 2) @@ -199,4 +198,3 @@ class Suboob(ReplApplication): self.start_format(pattern=pattern) for backend, subtitle in self.do('iter_subtitles', language=language, pattern=pattern): self.cached_format(subtitle) - self.flush() diff --git a/weboob/applications/translaboob/translaboob.py b/weboob/applications/translaboob/translaboob.py index 9c7bf91f..280441e5 100644 --- a/weboob/applications/translaboob/translaboob.py +++ b/weboob/applications/translaboob/translaboob.py @@ -114,7 +114,6 @@ class Translaboob(ReplApplication): self.start_format(source=text) for backend, translation in self.do('translate', self.LANGUAGE[lan_from], self.LANGUAGE[lan_to], text): self.format(translation) - self.flush() except (TranslationFail, LanguageNotSupported) as error: print >>sys.stderr, error pass diff --git a/weboob/applications/traveloob/traveloob.py b/weboob/applications/traveloob/traveloob.py index 234e1da1..31095356 100644 --- a/weboob/applications/traveloob/traveloob.py +++ b/weboob/applications/traveloob/traveloob.py @@ -51,7 +51,6 @@ class Traveloob(ReplApplication): """ for backend, station in self.do('iter_station_search', pattern): self.format(station) - self.flush() @defaultcount(10) def do_departures(self, line): @@ -80,7 +79,6 @@ class Traveloob(ReplApplication): for backend, departure in self.do('iter_station_departures', station_id, arrival_id, backends=backends): self.format(departure) - self.flush() def do_roadmap(self, line): """ @@ -110,7 +108,6 @@ class Traveloob(ReplApplication): for backend, route in self.do('iter_roadmap', departure, arrival, filters): self.format(route) - self.flush() def parse_datetime(self, text): if text is None: diff --git a/weboob/applications/videoob/videoob.py b/weboob/applications/videoob/videoob.py index df58f984..44eecbec 100644 --- a/weboob/applications/videoob/videoob.py +++ b/weboob/applications/videoob/videoob.py @@ -179,7 +179,6 @@ class Videoob(ReplApplication): self.start_format() self.format(video) - self.flush() def complete_nsfw(self, text, line, begidx, endidx): return ['on', 'off'] @@ -220,4 +219,3 @@ class Videoob(ReplApplication): for backend, video in self.do('search_videos', pattern=pattern, nsfw=self.nsfw, max_results=self.options.count): self.cached_format(video) - self.flush() diff --git a/weboob/applications/webcontentedit/webcontentedit.py b/weboob/applications/webcontentedit/webcontentedit.py index 3b8ed05d..1e583d42 100644 --- a/weboob/applications/webcontentedit/webcontentedit.py +++ b/weboob/applications/webcontentedit/webcontentedit.py @@ -162,7 +162,6 @@ class WebContentEdit(ReplApplication): self.start_format() for backend, revision in self.do('iter_revisions', _id, max_results=self.options.count, backends=backend_names): self.format(revision) - self.flush() def do_get(self, line): """ diff --git a/weboob/applications/weboobcfg/weboobcfg.py b/weboob/applications/weboobcfg/weboobcfg.py index 1dff94e4..beac87ed 100644 --- a/weboob/applications/weboobcfg/weboobcfg.py +++ b/weboob/applications/weboobcfg/weboobcfg.py @@ -134,7 +134,6 @@ class WeboobCfg(ReplApplication): for key, value in params.iteritems())), ]) self.format(row) - self.flush() def do_remove(self, instance_name): """ @@ -195,7 +194,6 @@ class WeboobCfg(ReplApplication): ('Description', info.description), ]) self.format(row) - self.flush() def do_info(self, line): """ diff --git a/weboob/applications/weboorrents/weboorrents.py b/weboob/applications/weboorrents/weboorrents.py index a1b7194b..9ead91e8 100644 --- a/weboob/applications/weboorrents/weboorrents.py +++ b/weboob/applications/weboorrents/weboorrents.py @@ -104,7 +104,6 @@ class Weboorrents(ReplApplication): self.start_format() self.format(torrent) - self.flush() def complete_getfile(self, text, line, *ignored): args = line.split(' ', 2) @@ -168,4 +167,3 @@ class Weboorrents(ReplApplication): self.start_format(pattern=pattern) for backend, torrent in self.do('iter_torrents', pattern=pattern): self.cached_format(torrent) - self.flush() diff --git a/weboob/applications/wetboobs/wetboobs.py b/weboob/applications/wetboobs/wetboobs.py index 45ba6ee1..6fde363e 100644 --- a/weboob/applications/wetboobs/wetboobs.py +++ b/weboob/applications/wetboobs/wetboobs.py @@ -91,7 +91,6 @@ class WetBoobs(ReplApplication): self.start_format() for backend, city in self.do('iter_city_search', pattern, caps=ICapWeather): self.cached_format(city) - self.flush() def complete_current(self, text, line, *ignored): args = line.split(' ') @@ -124,7 +123,6 @@ class WetBoobs(ReplApplication): for backend, current in self.do('get_current', _id, backends=backend_name, caps=ICapWeather): if current: self.format(current) - self.flush() def complete_forecasts(self, text, line, *ignored): args = line.split(' ') @@ -149,7 +147,6 @@ class WetBoobs(ReplApplication): for backend, forecast in self.do('iter_forecast', _id, backends=backend_name, caps=ICapWeather): self.format(forecast) - self.flush() def do_gauges(self, pattern): """ @@ -161,7 +158,6 @@ class WetBoobs(ReplApplication): self.start_format() for backend, gauge in self.do('iter_gauges', pattern or None, caps=ICapGauge): self.cached_format(gauge) - self.flush() def complete_gauge(self, text, line, *ignored): args = line.split(' ') @@ -180,7 +176,6 @@ class WetBoobs(ReplApplication): self.start_format() for backend, measure in self.do('iter_gauge_history', _id, backends=backend_name, caps=ICapGauge): self.format(measure) - self.flush() def complete_last_sensor_measure(self, text, line, *ignored): args = line.split(' ') @@ -199,7 +194,6 @@ class WetBoobs(ReplApplication): self.start_format() for backend, measure in self.do('get_last_measure', _id, backends=backend_name, caps=ICapGauge): self.format(measure) - self.flush() def do_sensors(self, line): """ @@ -213,4 +207,3 @@ class WetBoobs(ReplApplication): self.start_format() for backend, sensor in self.do('iter_sensors', _id, pattern=pattern, backends=backend_name, caps=ICapGauge): self.format(sensor) - self.flush()