From 21e8f82fd742fb8809b7d13cb620930f203551bd Mon Sep 17 00:00:00 2001 From: Laurent Bachelier Date: Sat, 11 Oct 2014 01:27:24 +0200 Subject: [PATCH] pep8: Use "X not in Y" instead of "not X in Y" flake8 --select E713, semi-manual fixing --- docs/source/genapi.py | 2 +- modules/audioaddict/module.py | 8 ++++---- modules/aum/module.py | 4 ++-- modules/axabanque/pages.py | 2 +- modules/banqueaccord/pages.py | 2 +- modules/banquepopulaire/pages.py | 4 ++-- modules/barclays/pages.py | 2 +- modules/bred/pages.py | 4 ++-- modules/canalplus/pages.py | 2 +- modules/canaltp/browser.py | 2 +- modules/cic/pages.py | 2 +- modules/cragr/mobile/browser.py | 4 ++-- modules/cragr/mobile/pages/accounts_list.py | 2 +- modules/creditdunord/pages.py | 2 +- modules/creditmutuel/browser.py | 2 +- modules/creditmutuel/pages.py | 2 +- modules/dlfp/module.py | 4 ++-- modules/feedly/module.py | 2 +- modules/fourchan/module.py | 8 +++----- modules/gazelle/browser.py | 2 +- modules/gdcvault/video.py | 2 +- modules/googletranslate/module.py | 4 ++-- modules/groupamaes/pages.py | 4 ++-- modules/hds/module.py | 2 +- modules/jvmalin/pages.py | 2 +- modules/kickass/pages.py | 2 +- modules/newsfeed/module.py | 2 +- modules/nolifetv/module.py | 2 +- modules/nolifetv/pages.py | 2 +- modules/nova/module.py | 2 +- modules/okc/module.py | 4 ++-- modules/okc/pages.py | 2 +- modules/ouifm/module.py | 2 +- modules/quvi/module.py | 2 +- modules/redmine/pages/issues.py | 4 ++-- modules/seloger/module.py | 2 +- modules/societegenerale/pages/accounts_list.py | 2 +- modules/tinder/browser.py | 2 +- modules/voyagessncf/module.py | 2 +- modules/wordreference/module.py | 4 ++-- weboob/applications/havedate/havedate.py | 6 +++--- weboob/applications/qflatboob/main_window.py | 2 +- weboob/applications/qhavedate/main_window.py | 2 +- weboob/applications/translaboob/translaboob.py | 4 ++-- weboob/browser/browsers.py | 2 +- weboob/capabilities/base.py | 2 +- weboob/capabilities/contact.py | 2 +- weboob/core/repositories.py | 2 +- weboob/deprecated/browser/browser.py | 2 +- weboob/tools/application/base.py | 4 ++-- weboob/tools/application/console.py | 4 ++-- weboob/tools/application/formatters/iformatter.py | 4 ++-- weboob/tools/application/qt/backendcfg.py | 4 ++-- weboob/tools/application/repl.py | 2 +- weboob/tools/capabilities/messages/GenericModule.py | 2 +- weboob/tools/storage.py | 2 +- weboob/tools/value.py | 6 +++--- 57 files changed, 81 insertions(+), 83 deletions(-) diff --git a/docs/source/genapi.py b/docs/source/genapi.py index d0214c13..2fa6acda 100755 --- a/docs/source/genapi.py +++ b/docs/source/genapi.py @@ -20,7 +20,7 @@ def genapi(): subs = set() for f in files: - if not '.' in f: + if '.' not in f: continue f, ext = f.rsplit('.', 1) diff --git a/modules/audioaddict/module.py b/modules/audioaddict/module.py index 46515c4d..e3a3522b 100644 --- a/modules/audioaddict/module.py +++ b/modules/audioaddict/module.py @@ -33,7 +33,7 @@ __all__ = ['AudioAddictModule'] # # WARNING # -# AudioAddict playlists do not seem to be appreciated by mplayer +# AudioAddict playlists do not seem to be appreciated by mplayer # VLC plays them successfully, therefore I advice to set the media_player # option to another player in the ~/.config/weboob/radioob config file: # [ROOT] @@ -160,7 +160,7 @@ class AudioAddictModule(Module, CapRadio, CapCollection): streamName = self._get_stream_name(selectedNetwork, quality) if not self.RADIOS: self.RADIOS = {} - if not selectedNetwork in self.RADIOS: + if selectedNetwork not in self.RADIOS: document = self.browser.location('http://listen.%s/%s' % (self.NETWORKS[selectedNetwork]['domain'], streamName)) @@ -199,7 +199,7 @@ class AudioAddictModule(Module, CapRadio, CapCollection): def get_current(self, network, radio): channel = {} - if not network in self.HISTORY: + if network not in self.HISTORY: self._get_tracks_history(network) channel = self.HISTORY[network].get(str(self.RADIOS[network][radio]['id'])) else: @@ -229,7 +229,7 @@ class AudioAddictModule(Module, CapRadio, CapCollection): self._fetch_radio_list(network) - if not radioName in self.RADIOS[network]: + if radioName not in self.RADIOS[network]: return None radio_dict = self.RADIOS[network][radioName] diff --git a/modules/aum/module.py b/modules/aum/module.py index 32b1546e..b5ce0528 100644 --- a/modules/aum/module.py +++ b/modules/aum/module.py @@ -196,7 +196,7 @@ class AuMModule(Module, CapMessages, CapMessagesPost, CapDating, CapChat, CapCon flags |= Message.IS_UNREAD if get_profiles: - if not mail['from'] in contacts: + if mail['from'] not in contacts: try: with self.browser: contacts[mail['from']] = self.get_contact(mail['from']) @@ -329,7 +329,7 @@ class AuMModule(Module, CapMessages, CapMessagesPost, CapDating, CapChat, CapCon def _get_slut(self, id): id = int(id) sluts = self.storage.get('sluts') - if not sluts or not id in sluts: + if not sluts or id not in sluts: slut = {'lastmsg': datetime.datetime(1970,1,1), 'status': None} else: diff --git a/modules/axabanque/pages.py b/modules/axabanque/pages.py index 5d7ef9f5..a1e8fd47 100644 --- a/modules/axabanque/pages.py +++ b/modules/axabanque/pages.py @@ -128,7 +128,7 @@ class AccountsPage(BasePage): continue self.logger.debug('Args: %r' % args) - if not 'paramNumCompte' in args: + if 'paramNumCompte' not in args: try: label = unicode(table.xpath('./caption')[0].text.strip()) except Exception: diff --git a/modules/banqueaccord/pages.py b/modules/banqueaccord/pages.py index b91d848d..eea392d5 100644 --- a/modules/banqueaccord/pages.py +++ b/modules/banqueaccord/pages.py @@ -171,7 +171,7 @@ class AccountsPage(LoggedPage, HTMLPage): continue if len(left.xpath('./span[@class="precision"]')) == 0 or \ - (left.text is None or not 'total' in left.text.lower()): + (left.text is None or 'total' not in left.text.lower()): continue balance -= CleanDecimal('.', replace_dots=False)(right) diff --git a/modules/banquepopulaire/pages.py b/modules/banquepopulaire/pages.py index 6627aa1a..9fbbf5f0 100644 --- a/modules/banquepopulaire/pages.py +++ b/modules/banquepopulaire/pages.py @@ -266,13 +266,13 @@ class AccountsPage(BasePage): currency = Account.get_currency(m.group(1)) for tr in div.getnext().xpath('.//tbody/tr'): - if not 'id' in tr.attrib: + if 'id' not in tr.attrib: continue args = dict(parse_qsl(tr.attrib['id'])) tds = tr.findall('td') - if len(tds) < 4 or not 'identifiant' in args: + if len(tds) < 4 or 'identifiant' not in args: self.logger.warning('Unable to parse an account') continue diff --git a/modules/barclays/pages.py b/modules/barclays/pages.py index 3707981e..4e65c5f7 100644 --- a/modules/barclays/pages.py +++ b/modules/barclays/pages.py @@ -104,7 +104,7 @@ class AccountsPage(Page): text = script.text if text is None: continue - if not 'remotePerso' in text: + if 'remotePerso' not in text: continue account = None diff --git a/modules/bred/pages.py b/modules/bred/pages.py index 52c13c69..6703675d 100644 --- a/modules/bred/pages.py +++ b/modules/bred/pages.py @@ -153,7 +153,7 @@ class AccountsPage(BredBasePage): if a is None: for a in cols[0].xpath('.//li/a'): args = self.js2args(a.attrib['href']) - if not 'numero_compte' in args or not 'numero_poste' in args: + if 'numero_compte' not in args or 'numero_poste' not in args: self.logger.warning('Card link with strange args: %s' % args) continue @@ -168,7 +168,7 @@ class AccountsPage(BredBasePage): args = self.js2args(a.attrib['href']) - if not 'numero_compte' in args or not 'numero_poste' in args: + if 'numero_compte' not in args or 'numero_poste' not in args: self.logger.warning('Account link for %r with strange args: %s' % (a.attrib.get('alt', a.text), args)) continue diff --git a/modules/canalplus/pages.py b/modules/canalplus/pages.py index 8230030f..98eb21dc 100644 --- a/modules/canalplus/pages.py +++ b/modules/canalplus/pages.py @@ -117,6 +117,6 @@ class VideoPage(Page): def get_video(self, video): _id = self.group_dict['id'] for vid in self.document.getchildren(): - if not _id in vid.find('ID').text: + if _id not in vid.find('ID').text: continue return self.parse_video(vid, video) diff --git a/modules/canaltp/browser.py b/modules/canaltp/browser.py index b4287132..1b022891 100644 --- a/modules/canaltp/browser.py +++ b/modules/canaltp/browser.py @@ -51,7 +51,7 @@ class CanalTP(Browser): result = result departure = '' for line in result.split('&'): - if not '=' in line: + if '=' not in line: raise BrokenPageError('Unable to parse result: %s' % line) key, value = line.split('=', 1) if key == 'nomgare': diff --git a/modules/cic/pages.py b/modules/cic/pages.py index 6d89d29c..e08754f9 100644 --- a/modules/cic/pages.py +++ b/modules/cic/pages.py @@ -93,7 +93,7 @@ class AccountsPage(Page): url = urlparse(link) p = parse_qs(url.query) - if not 'rib' in p: + if 'rib' not in p: continue for i in (2,1): diff --git a/modules/cragr/mobile/browser.py b/modules/cragr/mobile/browser.py index 7a526943..3a104919 100644 --- a/modules/cragr/mobile/browser.py +++ b/modules/cragr/mobile/browser.py @@ -208,11 +208,11 @@ class CragrMobile(Browser): target_accounts = self.page.get_transfer_target_accounts() # check that the given source account can be used - if not account in source_accounts.values(): + if account not in source_accounts.values(): raise TransferError('You cannot use account %s as a source account.' % account) # check that the given source account can be used - if not to in target_accounts.values(): + if to not in target_accounts.values(): raise TransferError('You cannot use account %s as a target account.' % to) # separate euros from cents diff --git a/modules/cragr/mobile/pages/accounts_list.py b/modules/cragr/mobile/pages/accounts_list.py index 3c17be86..bdabe6df 100644 --- a/modules/cragr/mobile/pages/accounts_list.py +++ b/modules/cragr/mobile/pages/accounts_list.py @@ -109,7 +109,7 @@ class AccountsList(CragrBasePage): elif self.look_like_account_name(token): required_tokens['account_name'] = token elif self.look_like_account_owner(token): - if 'account_owner' in optional_tokens and not 'account_name' in required_tokens: + if 'account_owner' in optional_tokens and 'account_name' not in required_tokens: required_tokens['account_name'] = optional_tokens['account_owner'] optional_tokens['account_owner'] = token # Step 3: create account objects diff --git a/modules/creditdunord/pages.py b/modules/creditdunord/pages.py index 25406eb7..a7c3130e 100644 --- a/modules/creditdunord/pages.py +++ b/modules/creditdunord/pages.py @@ -296,7 +296,7 @@ class ProTransactionsPage(TransactionsPage): for i, key, value in re.findall('listeopecv\[(\d+)\]\[\'(\w+)\'\]="(.*)";', txt): i = int(i) - if not i in transactions: + if i not in transactions: transactions[i] = {} transactions[i][key] = value diff --git a/modules/creditmutuel/browser.py b/modules/creditmutuel/browser.py index 03d1c2c0..95841add 100644 --- a/modules/creditmutuel/browser.py +++ b/modules/creditmutuel/browser.py @@ -177,7 +177,7 @@ class CreditMutuelBrowser(LoginBrowser): # look for the known "everything went well" message content = page.response.text transfer_ok_message = u'Votre virement a été exécuté ce jour' - if not transfer_ok_message in content: + if transfer_ok_message not in content: raise TransferError('The expected message "%s" was not found.' % transfer_ok_message) # We now have to return a Transfer object diff --git a/modules/creditmutuel/pages.py b/modules/creditmutuel/pages.py index a94731cf..ed957f5a 100644 --- a/modules/creditmutuel/pages.py +++ b/modules/creditmutuel/pages.py @@ -124,7 +124,7 @@ class AccountsPage(LoggedPage, HTMLPage): url = urlparse(link) p = parse_qs(url.query) - if not 'rib' in p: + if 'rib' not in p: raise SkipItem() balance = CleanDecimal('./td[2] | ./td[3]', replace_dots=True)(self) diff --git a/modules/dlfp/module.py b/modules/dlfp/module.py index 13e32a7d..5ea2a67d 100644 --- a/modules/dlfp/module.py +++ b/modules/dlfp/module.py @@ -119,7 +119,7 @@ class DLFPModule(Module, CapMessages, CapMessagesPost, CapContent): thread = Thread(content.id) flags = Message.IS_HTML - if not thread.id in self.storage.get('seen', default={}): + if thread.id not in self.storage.get('seen', default={}): flags |= Message.IS_UNREAD thread.title = content.title @@ -148,7 +148,7 @@ class DLFPModule(Module, CapMessages, CapMessagesPost, CapContent): Insert 'com' comment and its children in the parent message. """ flags = Message.IS_HTML - if not com.id in self.storage.get('seen', parent.thread.id, 'comments', default=[]): + if com.id not in self.storage.get('seen', parent.thread.id, 'comments', default=[]): flags |= Message.IS_UNREAD if getseen or flags & Message.IS_UNREAD: diff --git a/modules/feedly/module.py b/modules/feedly/module.py index 7e28b01a..532e97d2 100644 --- a/modules/feedly/module.py +++ b/modules/feedly/module.py @@ -76,7 +76,7 @@ class FeedlyModule(Module, CapMessages, CapCollection): if entry is None: return None - if not thread.id in self.storage.get('seen', default=[]): + if thread.id not in self.storage.get('seen', default=[]): entry.flags = Message.IS_UNREAD entry.thread = thread diff --git a/modules/fourchan/module.py b/modules/fourchan/module.py index 60e1cf1d..4ed1fe9d 100644 --- a/modules/fourchan/module.py +++ b/modules/fourchan/module.py @@ -18,8 +18,6 @@ # along with weboob. If not, see . - - from weboob.capabilities.messages import CapMessages, Message, Thread from weboob.tools.backend import Module, BackendConfig from weboob.tools.value import Value @@ -51,7 +49,7 @@ class FourChanModule(Module, CapMessages): thread = id id = thread.id - if not '.' in id: + if '.' not in id: self.logger.warning('Malformated ID (%s)' % id) return @@ -61,7 +59,7 @@ class FourChanModule(Module, CapMessages): _thread = self.browser.get_thread(board, thread_id) flags = 0 - if not _thread.id in self.storage.get('boards', board, default={}): + if _thread.id not in self.storage.get('boards', board, default={}): flags |= Message.IS_UNREAD if not thread: @@ -81,7 +79,7 @@ class FourChanModule(Module, CapMessages): for comment in _thread.comments: flags = 0 - if not comment.id in self.storage.get('boards', board, _thread.id, default=[]): + if comment.id not in self.storage.get('boards', board, _thread.id, default=[]): flags |= Message.IS_UNREAD m = Message(thread=thread, diff --git a/modules/gazelle/browser.py b/modules/gazelle/browser.py index 42044cdc..144a4632 100644 --- a/modules/gazelle/browser.py +++ b/modules/gazelle/browser.py @@ -60,7 +60,7 @@ class GazelleBrowser(Browser): return self.page.iter_torrents() def get_torrent(self, fullid): - if not '.' in fullid: + if '.' not in fullid: return None id, torrentid = fullid.split('.', 1) self.location(self.buildurl('/torrents.php', id=id, torrentid=torrentid)) diff --git a/modules/gdcvault/video.py b/modules/gdcvault/video.py index 27ea7399..43b74787 100644 --- a/modules/gdcvault/video.py +++ b/modules/gdcvault/video.py @@ -57,7 +57,7 @@ class GDCVaultVideo(BaseVideo): # # file will not be accessible (not free and not logged in) # return None - if not 'vault_media_id' in data: + if 'vault_media_id' not in data: return None media_id = int(data['vault_media_id']) video = GDCVaultVideo(media_id) diff --git a/modules/googletranslate/module.py b/modules/googletranslate/module.py index d4bb0910..7235561f 100644 --- a/modules/googletranslate/module.py +++ b/modules/googletranslate/module.py @@ -49,10 +49,10 @@ class GoogleTranslateModule(Module, CapTranslate): } def translate(self, lan_from, lan_to, text): - if not lan_from in self.GOOGLELANGUAGE.keys(): + if lan_from not in self.GOOGLELANGUAGE.keys(): raise LanguageNotSupported() - if not lan_to in self.GOOGLELANGUAGE.keys(): + if lan_to not in self.GOOGLELANGUAGE.keys(): raise LanguageNotSupported() translation = Translation(0) diff --git a/modules/groupamaes/pages.py b/modules/groupamaes/pages.py index 537aa63d..202c7373 100644 --- a/modules/groupamaes/pages.py +++ b/modules/groupamaes/pages.py @@ -72,7 +72,7 @@ class OperationsFuturesPage(LoggedPage, HTMLPage): klass = Transaction def condition(self): - return not u'Aucune opération en attente' in CleanText(TableCell('date'))(self) + return u'Aucune opération en attente' not in CleanText(TableCell('date'))(self) obj_date = Date(CleanText(TableCell('date')), LinearDateGuesser()) obj_type = Transaction.TYPE_UNKNOWN @@ -94,7 +94,7 @@ class OperationsTraiteesPage(LoggedPage, HTMLPage): klass = Transaction def condition(self): - return not u'Aucune opération' in CleanText(TableCell('date'))(self) + return u'Aucune opération' not in CleanText(TableCell('date'))(self) obj_date = Date(CleanText(TableCell('date')), LinearDateGuesser()) obj_type = Transaction.TYPE_UNKNOWN diff --git a/modules/hds/module.py b/modules/hds/module.py index 4fa91c93..a69b5467 100644 --- a/modules/hds/module.py +++ b/modules/hds/module.py @@ -68,7 +68,7 @@ class HDSModule(Module, CapMessages): thread = Thread(story.id) flags = 0 - if not thread.id in self.storage.get('seen', default=[]): + if thread.id not in self.storage.get('seen', default=[]): flags |= Message.IS_UNREAD thread.title = story.title diff --git a/modules/jvmalin/pages.py b/modules/jvmalin/pages.py index fc2d3ac1..ad567a51 100644 --- a/modules/jvmalin/pages.py +++ b/modules/jvmalin/pages.py @@ -131,7 +131,7 @@ class RoadmapPage(Page): continue for td in self.parser.select(tr, 'td'): - if not 'class' in td.attrib: + if 'class' not in td.attrib: continue if 'iti-inner' in td.attrib['class']: diff --git a/modules/kickass/pages.py b/modules/kickass/pages.py index c1ab540d..1f5f9f7a 100644 --- a/modules/kickass/pages.py +++ b/modules/kickass/pages.py @@ -32,7 +32,7 @@ class TorrentsPage(Page): if tr.attrib.get('class', '') == 'odd' or tr.attrib.get('class', '') == ' even': magnet = NotAvailable url = NotAvailable - if not 'id' in tr.attrib: + if 'id' not in tr.attrib: continue title = self.parser.tocleanstring(tr.find('.//a[@class="cellMainLink"]')) # WTF is that? diff --git a/modules/newsfeed/module.py b/modules/newsfeed/module.py index 5977e3c0..b1f8da3d 100644 --- a/modules/newsfeed/module.py +++ b/modules/newsfeed/module.py @@ -54,7 +54,7 @@ class NewsfeedModule(Module, CapMessages): return None flags = Message.IS_HTML - if not thread.id in self.storage.get('seen', default=[]): + if thread.id not in self.storage.get('seen', default=[]): flags |= Message.IS_UNREAD if len(entry.content) > 0: content = u"

Link %s

%s" % (entry.link, entry.content[0]) diff --git a/modules/nolifetv/module.py b/modules/nolifetv/module.py index c02798ff..2ef7e782 100644 --- a/modules/nolifetv/module.py +++ b/modules/nolifetv/module.py @@ -128,6 +128,6 @@ class NolifeTVModule(Module, CapVideo, CapCollection): 'quality=%s&a=UEM%%7CSEM%%7CMEM%%7CCH%%7CSWQ&skey=%s&id%%5Fnlshow=%s×tamp=%s' % (quality, skey, id, timestamp)) values = dict([urllib.splitvalue(s) for s in data.split('&')]) - if not 'url' in values: + if 'url' not in values: return None return unicode(values['url']) diff --git a/modules/nolifetv/pages.py b/modules/nolifetv/pages.py index e722a1e7..cb8d1a52 100644 --- a/modules/nolifetv/pages.py +++ b/modules/nolifetv/pages.py @@ -92,7 +92,7 @@ class FamilyPage(Page): subs = list() for el in self.document.xpath('//ul/li[@data-role="list-divider"]'): - if not el.text in subs: + if el.text not in subs: yield Collection([el.text], unicode(el.text)) subs.append(el.text) diff --git a/modules/nova/module.py b/modules/nova/module.py index a58e9d30..e4674c20 100644 --- a/modules/nova/module.py +++ b/modules/nova/module.py @@ -63,7 +63,7 @@ class NovaModule(Module, CapRadio, CapCollection): if not isinstance(radio, Radio): radio = Radio(radio) - if not radio.id in self._RADIOS: + if radio.id not in self._RADIOS: return None title, description, url = self._RADIOS[radio.id] diff --git a/modules/okc/module.py b/modules/okc/module.py index c0872435..06798b81 100644 --- a/modules/okc/module.py +++ b/modules/okc/module.py @@ -169,7 +169,7 @@ class OkCModule(Module, CapMessages, CapContact, CapMessagesPost, CapDating): flags |= Message.IS_UNREAD if get_profiles: - if not mail['id_from'] in contacts: + if mail['id_from'] not in contacts: with self.browser: contacts[mail['id_from']] = self.get_contact(mail['id_from']) @@ -219,7 +219,7 @@ class OkCModule(Module, CapMessages, CapContact, CapMessagesPost, CapDating): def _get_slut(self, id): sluts = self.storage.get('sluts') - if not sluts or not id in sluts: + if not sluts or id not in sluts: slut = {'lastmsg': datetime.datetime(1970,1,1)} else: slut = self.storage.get('sluts', id) diff --git a/modules/okc/pages.py b/modules/okc/pages.py index 946a8f99..905ec494 100644 --- a/modules/okc/pages.py +++ b/modules/okc/pages.py @@ -163,7 +163,7 @@ class ProfilePage(Page): if 'looking for' in label: for i, li in enumerate(val.xpath('.//li')): profile['data']['look_for'].value['look_for_%s' % i] = ProfileNode('look_for_%s' % i, '', li.text.strip()) - elif 'summary' in label and not 'summary' in profile: + elif 'summary' in label and 'summary' not in profile: profile['summary'] = txt else: key = label.replace(' ', '_') diff --git a/modules/ouifm/module.py b/modules/ouifm/module.py index 4124da88..e7ff1b78 100644 --- a/modules/ouifm/module.py +++ b/modules/ouifm/module.py @@ -79,7 +79,7 @@ class OuiFMModule(Module, CapRadio, CapCollection): if not isinstance(radio, Radio): radio = Radio(radio) - if not radio.id in self._RADIOS: + if radio.id not in self._RADIOS: return None title, description, url, bitrate = self._RADIOS[radio.id] diff --git a/modules/quvi/module.py b/modules/quvi/module.py index 41d5dc0f..c7561a09 100644 --- a/modules/quvi/module.py +++ b/modules/quvi/module.py @@ -104,7 +104,7 @@ class QuviVideo(BaseVideo): if _id.startswith('http'): return _id - if not '.' in _id: + if '.' not in _id: raise UserError('Please give an ID in form WEBSITE.ID (for example youtube.BaW_jenozKc). Supported websites are: %s' % ', '.join(cls.BACKENDS.keys())) sub_backend, sub_id = _id.split('.', 1) diff --git a/modules/redmine/pages/issues.py b/modules/redmine/pages/issues.py index 30cd0f87..c446a556 100644 --- a/modules/redmine/pages/issues.py +++ b/modules/redmine/pages/issues.py @@ -160,7 +160,7 @@ class IssuesPage(BaseIssuePage): def get_values(key): values = [] - if not key in args: + if key not in args: return values for key, value in args[key]['values']: if value.isdigit(): @@ -394,7 +394,7 @@ class IssuePage(NewIssuePage): # check issue 666 on symlink.me i = 0 alist = author.findall('a') - if not 'title' in alist[i].attrib: + if 'title' not in alist[i].attrib: params['author'] = (int(alist[i].attrib['href'].split('/')[-1]), to_unicode(alist[i].text)) i += 1 diff --git a/modules/seloger/module.py b/modules/seloger/module.py index 2912158f..0426e31f 100644 --- a/modules/seloger/module.py +++ b/modules/seloger/module.py @@ -64,7 +64,7 @@ class SeLogerModule(Module, CapHousing): if categories['label'] != 'Villes': continue for city in categories['values']: - if not 'value' in city: + if 'value' not in city: continue c = City(city['value']) c.name = unicode(city['label']) diff --git a/modules/societegenerale/pages/accounts_list.py b/modules/societegenerale/pages/accounts_list.py index 93bf698e..470e545e 100644 --- a/modules/societegenerale/pages/accounts_list.py +++ b/modules/societegenerale/pages/accounts_list.py @@ -52,7 +52,7 @@ class AccountsList(BasePage): def get_list(self): for tr in self.document.getiterator('tr'): - if not 'LGNTableRow' in tr.attrib.get('class', '').split(): + if 'LGNTableRow' not in tr.attrib.get('class', '').split(): continue account = Account() diff --git a/modules/tinder/browser.py b/modules/tinder/browser.py index 5dc4f86c..2a9436e8 100644 --- a/modules/tinder/browser.py +++ b/modules/tinder/browser.py @@ -45,7 +45,7 @@ class FacebookBrowser(DomainBrowser): form['pass'] = password form['persistent'] = 1 form.submit(allow_redirects=False) - if not 'Location' in self.response.headers: + if 'Location' not in self.response.headers: raise BrowserIncorrectPassword() self.location(self.response.headers['Location']) diff --git a/modules/voyagessncf/module.py b/modules/voyagessncf/module.py index 53d00ac3..0e139f45 100644 --- a/modules/voyagessncf/module.py +++ b/modules/voyagessncf/module.py @@ -90,7 +90,7 @@ class VoyagesSNCFModule(Module, CapTravel): yield Station(_id, unicode(name)) # ...then ones whose name contains pattern. for _id, name in enumerate(self.STATIONS): - if pattern in name.lower() and not _id in already: + if pattern in name.lower() and _id not in already: yield Station(_id, unicode(name)) def iter_station_departures(self, station_id, arrival_id=None, date=None): diff --git a/modules/wordreference/module.py b/modules/wordreference/module.py index 5fe316d9..80709b94 100644 --- a/modules/wordreference/module.py +++ b/modules/wordreference/module.py @@ -43,10 +43,10 @@ class WordReferenceModule(Module, CapTranslate): } def translate(self, lan_from, lan_to, text): - if not lan_from in self.WRLANGUAGE.keys(): + if lan_from not in self.WRLANGUAGE.keys(): raise LanguageNotSupported() - if not lan_to in self.WRLANGUAGE.keys(): + if lan_to not in self.WRLANGUAGE.keys(): raise LanguageNotSupported() translation = Translation(0) diff --git a/weboob/applications/havedate/havedate.py b/weboob/applications/havedate/havedate.py index c90e321b..f74936c3 100644 --- a/weboob/applications/havedate/havedate.py +++ b/weboob/applications/havedate/havedate.py @@ -205,7 +205,7 @@ class HaveDate(Boobmsg): if backend_name == '*': backend_name = None - elif backend_name is not None and not backend_name in [b.name for b in self.enabled_backends]: + elif backend_name is not None and backend_name not in [b.name for b in self.enabled_backends]: print('Error: No such backend "%s"' % backend_name, file=self.stderr) return 1 @@ -223,13 +223,13 @@ class HaveDate(Boobmsg): optims = {} backends = set() for (name, optim) in self.do('iter_optimizations', backends=backend_name): - if optims_names is not None and not name in optims_names: + if optims_names is not None and name not in optims_names: continue if optim.is_running(): status = 'RUNNING' else: status = '-------' - if not name in optims: + if name not in optims: optims[name] = {optim.backend: status} else: optims[name][optim.backend] = status diff --git a/weboob/applications/qflatboob/main_window.py b/weboob/applications/qflatboob/main_window.py index deb2c53e..f87b2513 100644 --- a/weboob/applications/qflatboob/main_window.py +++ b/weboob/applications/qflatboob/main_window.py @@ -49,7 +49,7 @@ class HousingListWidgetItem(QListWidgetItem): text += u'
%s' % storage.get('notes', self.housing.fullid, default='').strip().replace('\n', '
') self.setText(text) - if not self.housing.fullid in storage.get('read'): + if self.housing.fullid not in storage.get('read'): self.setBackground(QBrush(QColor(200, 200, 255))) self.read = False elif self.housing.fullid in storage.get('bookmarks'): diff --git a/weboob/applications/qhavedate/main_window.py b/weboob/applications/qhavedate/main_window.py index c60e3417..5643a103 100644 --- a/weboob/applications/qhavedate/main_window.py +++ b/weboob/applications/qhavedate/main_window.py @@ -80,7 +80,7 @@ class MainWindow(QtMainWindow): def tabChanged(self, i): widget = self.ui.tabWidget.currentWidget() - if hasattr(widget, 'load') and not i in self.loaded_tabs: + if hasattr(widget, 'load') and i not in self.loaded_tabs: widget.load() self.loaded_tabs[i] = True diff --git a/weboob/applications/translaboob/translaboob.py b/weboob/applications/translaboob/translaboob.py index b780a975..92dc1d9f 100644 --- a/weboob/applications/translaboob/translaboob.py +++ b/weboob/applications/translaboob/translaboob.py @@ -103,9 +103,9 @@ class Translaboob(ReplApplication): lan_from, lan_to, text = self.parse_command_args(line, 3, 2) try: - if not lan_from in self.LANGUAGE.keys(): + if lan_from not in self.LANGUAGE.keys(): raise LanguageNotSupported() - if not lan_to in self.LANGUAGE.keys(): + if lan_to not in self.LANGUAGE.keys(): raise LanguageNotSupported() if not text or text == '-': diff --git a/weboob/browser/browsers.py b/weboob/browser/browsers.py index f49f0a92..cb60d11c 100644 --- a/weboob/browser/browsers.py +++ b/weboob/browser/browsers.py @@ -366,7 +366,7 @@ class Browser(object): It only redirect to the refresh URL if the sleep time is inferior to REFRESH_MAX. """ - if not 'Refresh' in response.headers: + if 'Refresh' not in response.headers: return response m = self.REFRESH_RE.match(response.headers['Refresh']) diff --git a/weboob/capabilities/base.py b/weboob/capabilities/base.py index 0c9d333c..27fd7577 100644 --- a/weboob/capabilities/base.py +++ b/weboob/capabilities/base.py @@ -392,7 +392,7 @@ class BaseObject(object): try: attr = (self._fields or {})[name] except KeyError: - if not name in dir(self) and not name.startswith('_'): + if name not in dir(self) and not name.startswith('_'): warnings.warn('Creating a non-field attribute %s. Please prefix it with _' % name, AttributeCreationWarning, stacklevel=2) object.__setattr__(self, name, value) diff --git a/weboob/capabilities/contact.py b/weboob/capabilities/contact.py index bafee621..b85dba6d 100644 --- a/weboob/capabilities/contact.py +++ b/weboob/capabilities/contact.py @@ -101,7 +101,7 @@ class Contact(BaseObject): :type name: str :param kwargs: See :class:`ContactPhoto` to know what other parameters you can use """ - if not name in self.photos: + if name not in self.photos: self.photos[name] = ContactPhoto(name) photo = self.photos[name] diff --git a/weboob/core/repositories.py b/weboob/core/repositories.py index d7afe42a..dbf74481 100644 --- a/weboob/core/repositories.py +++ b/weboob/core/repositories.py @@ -483,7 +483,7 @@ class Repositories(object): modules = {} for repos in reversed(self.repositories): for name, info in repos.modules.iteritems(): - if not name in modules and (not caps or info.has_caps(caps)): + if name not in modules and (not caps or info.has_caps(caps)): modules[name] = self._extend_module_info(repos, info) return modules diff --git a/weboob/deprecated/browser/browser.py b/weboob/deprecated/browser/browser.py index 718ddc74..f30098aa 100644 --- a/weboob/deprecated/browser/browser.py +++ b/weboob/deprecated/browser/browser.py @@ -265,7 +265,7 @@ class StandardBrowser(mechanize.Browser): """ Download URL data specifying what to do on failure (nothing by default). """ - if not 'if_fail' in kwargs: + if 'if_fail' not in kwargs: kwargs['if_fail'] = None result = self.openurl(url, *args, **kwargs) diff --git a/weboob/tools/application/base.py b/weboob/tools/application/base.py index 3866a732..552d2d46 100644 --- a/weboob/tools/application/base.py +++ b/weboob/tools/application/base.py @@ -204,7 +204,7 @@ class Application(object): if path is None: path = os.path.join(self.CONFDIR, self.APPNAME + '.storage') - elif not os.path.sep in path: + elif os.path.sep not in path: path = os.path.join(self.CONFDIR, path) storage = klass(path) @@ -232,7 +232,7 @@ class Application(object): if path is None: path = os.path.join(self.CONFDIR, self.APPNAME) - elif not os.path.sep in path: + elif os.path.sep not in path: path = os.path.join(self.CONFDIR, path) self.config = klass(path) diff --git a/weboob/tools/application/console.py b/weboob/tools/application/console.py index 81511ee4..35c9cf90 100644 --- a/weboob/tools/application/console.py +++ b/weboob/tools/application/console.py @@ -201,7 +201,7 @@ class ConsoleApplication(Application): sys.exit(1) def do(self, function, *args, **kwargs): - if not 'backends' in kwargs: + if 'backends' not in kwargs: kwargs['backends'] = self.enabled_backends return self.weboob.do(function, *args, **kwargs) @@ -216,7 +216,7 @@ class ConsoleApplication(Application): backend_name = backends[0][0] else: raise BackendNotGiven(_id, backends) - if backend_name is not None and not backend_name in dict(backends): + if backend_name is not None and backend_name not in dict(backends): # Is the backend a short version of a real one? found = False for key in dict(backends): diff --git a/weboob/tools/application/formatters/iformatter.py b/weboob/tools/application/formatters/iformatter.py index 9d033087..217f8061 100644 --- a/weboob/tools/application/formatters/iformatter.py +++ b/weboob/tools/application/formatters/iformatter.py @@ -149,7 +149,7 @@ class IFormatter(object): if selected_fields: # can be an empty list (nothing to do), or None (return all fields) obj = obj.copy() for name, value in obj.iter_fields(): - if not name in selected_fields: + if name not in selected_fields: delattr(obj, name) if self.MANDATORY_FIELDS: @@ -167,7 +167,7 @@ class IFormatter(object): if selected_fields: obj = obj.copy() for name, value in obj.iteritems(): - if not name in selected_fields: + if name not in selected_fields: obj.pop(name) if self.MANDATORY_FIELDS: diff --git a/weboob/tools/application/qt/backendcfg.py b/weboob/tools/application/qt/backendcfg.py index 74e113af..63a2b241 100644 --- a/weboob/tools/application/qt/backendcfg.py +++ b/weboob/tools/application/qt/backendcfg.py @@ -128,7 +128,7 @@ class BackendCfg(QDialog): self.connect(self.ui.configButtonBox, SIGNAL('rejected()'), self.rejectBackend) def get_icon_cache(self, path): - if not path in self.icon_cache: + if path not in self.icon_cache: img = QImage(path) self.icon_cache[path] = QIcon(QPixmap.fromImage(img)) return self.icon_cache[path] @@ -358,7 +358,7 @@ class BackendCfg(QDialog): self.ui.moduleInfo.document().addResource(QTextDocument.ImageResource, QUrl('mydata://logo.png'), QVariant(img)) - if not module.name in [n for n, ign, ign2 in self.weboob.backends_config.iter_backends()]: + if module.name not in [n for n, ign, ign2 in self.weboob.backends_config.iter_backends()]: self.ui.nameEdit.setText(module.name) else: self.ui.nameEdit.setText('') diff --git a/weboob/tools/application/repl.py b/weboob/tools/application/repl.py index d95f74cc..8acdebcf 100644 --- a/weboob/tools/application/repl.py +++ b/weboob/tools/application/repl.py @@ -207,7 +207,7 @@ class ReplApplication(Cmd, ConsoleApplication): backend.DESCRIPTION)) i = self.ask('Select a backend to proceed with "%s"' % id) if not i.isdigit(): - if not i in dict(e.backends): + if i not in dict(e.backends): print('Error: %s is not a valid backend' % i, file=self.stderr) continue backend_name = i diff --git a/weboob/tools/capabilities/messages/GenericModule.py b/weboob/tools/capabilities/messages/GenericModule.py index dc6e0788..3dcc863c 100644 --- a/weboob/tools/capabilities/messages/GenericModule.py +++ b/weboob/tools/capabilities/messages/GenericModule.py @@ -57,7 +57,7 @@ class GenericNewspaperModule(Module, CapMessages): thread = Thread(id) flags = Message.IS_HTML - if not thread.id in self.storage.get('seen', default={}): + if thread.id not in self.storage.get('seen', default={}): flags |= Message.IS_UNREAD thread.title = content.title if not thread.date: diff --git a/weboob/tools/storage.py b/weboob/tools/storage.py index eeef1106..be70238b 100644 --- a/weboob/tools/storage.py +++ b/weboob/tools/storage.py @@ -62,7 +62,7 @@ class StandardStorage(IStorage): def load(self, what, name, default={}): d = {} - if not what in self.config.values: + if what not in self.config.values: self.config.values[what] = {} else: d = self.config.values[what].get(name, {}) diff --git a/weboob/tools/value.py b/weboob/tools/value.py index 6fe19e02..c87bf550 100644 --- a/weboob/tools/value.py +++ b/weboob/tools/value.py @@ -90,7 +90,7 @@ class Value(object): raise ValueError('Value can\'t be empty') if self.regexp is not None and not re.match(self.regexp, unicode(v)): raise ValueError('Value "%s" does not match regexp "%s"' % (v, self.regexp)) - if self.choices is not None and not v in self.choices: + if self.choices is not None and v not in self.choices: raise ValueError('Value "%s" is not in list: %s' % ( v, ', '.join(unicode(s) for s in self.choices))) @@ -254,8 +254,8 @@ class ValueBool(Value): def check_valid(self, v): if not isinstance(v, bool) and \ - not unicode(v).lower() in ('y', 'yes', '1', 'true', 'on', - 'n', 'no', '0', 'false', 'off'): + unicode(v).lower() not in ('y', 'yes', '1', 'true', 'on', + 'n', 'no', '0', 'false', 'off'): raise ValueError('Value "%s" is not a boolean (y/n)' % v) def get(self):