pep8: Use "X not in Y" instead of "not X in Y"
flake8 --select E713, semi-manual fixing
This commit is contained in:
parent
31a96228db
commit
21e8f82fd7
57 changed files with 81 additions and 83 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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]
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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':
|
||||
|
|
|
|||
|
|
@ -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):
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -18,8 +18,6 @@
|
|||
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
|
||||
|
||||
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,
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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']:
|
||||
|
|
|
|||
|
|
@ -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?
|
||||
|
|
|
|||
|
|
@ -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"<p>Link %s</p> %s" % (entry.link, entry.content[0])
|
||||
|
|
|
|||
|
|
@ -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'])
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
|
|
@ -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]
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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(' ', '_')
|
||||
|
|
|
|||
|
|
@ -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]
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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'])
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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'])
|
||||
|
|
|
|||
|
|
@ -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):
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ class HousingListWidgetItem(QListWidgetItem):
|
|||
text += u'<br /><font color="#008800">%s</font>' % storage.get('notes', self.housing.fullid, default='').strip().replace('\n', '<br />')
|
||||
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'):
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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 == '-':
|
||||
|
|
|
|||
|
|
@ -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'])
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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]
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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):
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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('')
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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, {})
|
||||
|
|
|
|||
|
|
@ -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):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue