mirror of
https://github.com/codex-storage/deluge.git
synced 2025-02-04 07:33:31 +00:00
[Python-Modernize] lib2to3.fixes.fix_has_key
This commit is contained in:
parent
682acc11ec
commit
95f859673e
@ -197,7 +197,7 @@ what is currently in the config and it could not convert the value
|
||||
if isinstance(value, basestring):
|
||||
value = utf8_encoded(value)
|
||||
|
||||
if not self.__config.has_key(key):
|
||||
if key not in self.__config:
|
||||
self.__config[key] = value
|
||||
log.debug("Setting '%s' to %s of %s", key, value, type(value))
|
||||
return
|
||||
|
@ -151,7 +151,7 @@ Date: %(date)s
|
||||
|
||||
if security_enabled:
|
||||
server.ehlo()
|
||||
if not server.esmtp_features.has_key('starttls'):
|
||||
if 'starttls' not in server.esmtp_features:
|
||||
log.warning("TLS/SSL enabled but server does not support it")
|
||||
else:
|
||||
server.starttls()
|
||||
|
@ -115,7 +115,7 @@ class TorrentInfo(object):
|
||||
# Get list of files from torrent info
|
||||
paths = {}
|
||||
dirs = {}
|
||||
if self.__m_metadata["info"].has_key("files"):
|
||||
if "files" in self.__m_metadata["info"]:
|
||||
prefix = ""
|
||||
if len(self.__m_metadata["info"]["files"]) > 1:
|
||||
prefix = self.__m_name
|
||||
@ -176,7 +176,7 @@ class TorrentInfo(object):
|
||||
}
|
||||
|
||||
self.__m_files = []
|
||||
if self.__m_metadata["info"].has_key("files"):
|
||||
if "files" in self.__m_metadata["info"]:
|
||||
prefix = ""
|
||||
if len(self.__m_metadata["info"]["files"]) > 1:
|
||||
prefix = self.__m_name
|
||||
|
@ -202,7 +202,7 @@ class PeersTab(Tab):
|
||||
|
||||
for (index, column) in enumerate(self.listview.get_columns()):
|
||||
cname = column.get_title()
|
||||
if state["columns"].has_key(cname):
|
||||
if cname in state["columns"]:
|
||||
cstate = state["columns"][cname]
|
||||
column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
|
||||
column.set_fixed_width(cstate["width"] if cstate["width"] > 0 else 10)
|
||||
@ -240,7 +240,7 @@ class PeersTab(Tab):
|
||||
if country == " ":
|
||||
return None
|
||||
|
||||
if not self.cached_flag_pixbufs.has_key(country):
|
||||
if country not in self.cached_flag_pixbufs:
|
||||
# We haven't created a pixbuf for this country yet
|
||||
try:
|
||||
self.cached_flag_pixbufs[country] = gtk.gdk.pixbuf_new_from_file(
|
||||
@ -257,7 +257,7 @@ class PeersTab(Tab):
|
||||
new_ips = set()
|
||||
for peer in status["peers"]:
|
||||
new_ips.add(peer["ip"])
|
||||
if self.peers.has_key(peer["ip"]):
|
||||
if peer["ip"] in self.peers:
|
||||
# We already have this peer in our list, so lets just update it
|
||||
row = self.peers[peer["ip"]]
|
||||
if not self.liststore.iter_is_valid(row):
|
||||
|
Loading…
x
Reference in New Issue
Block a user