git://git.onelab.eu
/
sfa.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
5a6cbf4
)
2to3 -f has_key
author
Thierry Parmentelat
<thierry.parmentelat@inria.fr>
Fri, 1 Apr 2016 09:41:55 +0000
(11:41 +0200)
committer
Thierry Parmentelat
<thierry.parmentelat@inria.fr>
Fri, 1 Apr 2016 10:02:14 +0000
(12:02 +0200)
13 files changed:
sfa/client/client_helper.py
patch
|
blob
|
history
sfa/client/return_value.py
patch
|
blob
|
history
sfa/methods/Describe.py
patch
|
blob
|
history
sfa/methods/ListResources.py
patch
|
blob
|
history
sfa/planetlab/vlink.py
patch
|
blob
|
history
sfa/rspecs/versions/pgv2.py
patch
|
blob
|
history
sfa/server/xmlrpcapi.py
patch
|
blob
|
history
sfa/trust/certificate.py
patch
|
blob
|
history
sfa/trust/credential_factory.py
patch
|
blob
|
history
sfa/util/cache.py
patch
|
blob
|
history
sfa/util/callids.py
patch
|
blob
|
history
tools/depgraph2dot.py
patch
|
blob
|
history
wsdl/sfa2wsdl.py
patch
|
blob
|
history
diff --git
a/sfa/client/client_helper.py
b/sfa/client/client_helper.py
index
d9239ad
..
6e91706
100644
(file)
--- a/
sfa/client/client_helper.py
+++ b/
sfa/client/client_helper.py
@@
-41,7
+41,7
@@
def sfa_users_arg (records, slice_record):
extra_fields = list ( set(pl_fields).union(set(nitos_fields)))
# try to fill all these in
for field in extra_fields:
extra_fields = list ( set(pl_fields).union(set(nitos_fields)))
# try to fill all these in
for field in extra_fields:
- if
record.has_key(field)
: user[field]=record[field]
+ if
field in record
: user[field]=record[field]
users.append(user)
return users
users.append(user)
return users
diff --git
a/sfa/client/return_value.py
b/sfa/client/return_value.py
index
034dcd8
..
c2c4f47
100644
(file)
--- a/
sfa/client/return_value.py
+++ b/
sfa/client/return_value.py
@@
-16,7
+16,7
@@
class ReturnValue(dict):
@staticmethod
def get_key_value(key, return_value):
@staticmethod
def get_key_value(key, return_value):
- if isinstance(return_value, dict) and
return_value.has_key(key)
:
+ if isinstance(return_value, dict) and
key in return_value
:
return return_value.get(key)
else:
return return_value
return return_value.get(key)
else:
return return_value
diff --git
a/sfa/methods/Describe.py
b/sfa/methods/Describe.py
index
ae198c0
..
69d4fb7
100644
(file)
--- a/
sfa/methods/Describe.py
+++ b/
sfa/methods/Describe.py
@@
-55,7
+55,7
@@
class Describe(Method):
self.api.logger.debug("ListResources: sfatables on chain %s"%chain_name)
desc['geni_rspec'] = run_sfatables(chain_name, '', origin_hrn, desc['geni_rspec'])
self.api.logger.debug("ListResources: sfatables on chain %s"%chain_name)
desc['geni_rspec'] = run_sfatables(chain_name, '', origin_hrn, desc['geni_rspec'])
- if
options.has_key('geni_compressed')
and options['geni_compressed'] == True:
+ if
'geni_compressed' in options
and options['geni_compressed'] == True:
desc['geni_rspec'] = zlib.compress(desc['geni_rspec']).encode('base64')
return desc
desc['geni_rspec'] = zlib.compress(desc['geni_rspec']).encode('base64')
return desc
diff --git
a/sfa/methods/ListResources.py
b/sfa/methods/ListResources.py
index
33777fd
..
795594b
100644
(file)
--- a/
sfa/methods/ListResources.py
+++ b/
sfa/methods/ListResources.py
@@
-50,7
+50,7
@@
class ListResources(Method):
self.api.logger.debug("ListResources: sfatables on chain %s"%chain_name)
filtered_rspec = run_sfatables(chain_name, '', origin_hrn, rspec)
self.api.logger.debug("ListResources: sfatables on chain %s"%chain_name)
filtered_rspec = run_sfatables(chain_name, '', origin_hrn, rspec)
- if
options.has_key('geni_compressed')
and options['geni_compressed'] == True:
+ if
'geni_compressed' in options
and options['geni_compressed'] == True:
filtered_rspec = zlib.compress(filtered_rspec).encode('base64')
return filtered_rspec
filtered_rspec = zlib.compress(filtered_rspec).encode('base64')
return filtered_rspec
diff --git
a/sfa/planetlab/vlink.py
b/sfa/planetlab/vlink.py
index
625963d
..
b0a8300
100644
(file)
--- a/
sfa/planetlab/vlink.py
+++ b/
sfa/planetlab/vlink.py
@@
-41,7
+41,7
@@
def get_tc_rate(s):
if m is None:
return -1
suffix = m.group(2).lower()
if m is None:
return -1
suffix = m.group(2).lower()
- if suffix
es.has_key(suffix)
:
+ if suffix
in suffixes
:
return int(float(m.group(1)) * suffixes[suffix])
else:
return -1
return int(float(m.group(1)) * suffixes[suffix])
else:
return -1
diff --git
a/sfa/rspecs/versions/pgv2.py
b/sfa/rspecs/versions/pgv2.py
index
b227d32
..
a4f5963
100644
(file)
--- a/
sfa/rspecs/versions/pgv2.py
+++ b/
sfa/rspecs/versions/pgv2.py
@@
-214,7
+214,7
@@
class PGv2(RSpecVersion):
if not node['component_name']:
# this node element is part of a lease
continue
if not node['component_name']:
# this node element is part of a lease
continue
- if
not node.has_key('sliver')
or not node['sliver']:
+ if
'sliver' not in node
or not node['sliver']:
node['sliver'] = {'name': 'plab-vserver'}
main_nodes.append(node)
self.add_nodes(main_nodes)
node['sliver'] = {'name': 'plab-vserver'}
main_nodes.append(node)
self.add_nodes(main_nodes)
diff --git
a/sfa/server/xmlrpcapi.py
b/sfa/server/xmlrpcapi.py
index
1711f88
..
74e0026
100644
(file)
--- a/
sfa/server/xmlrpcapi.py
+++ b/
sfa/server/xmlrpcapi.py
@@
-136,7
+136,7
@@
class XmlrpcApi:
interface = xmlrpc_client
self.protocol = 'xmlrpc'
(args, method) = xmlrpc_client.loads(data)
interface = xmlrpc_client
self.protocol = 'xmlrpc'
(args, method) = xmlrpc_client.loads(data)
- if method
_map.has_key(method)
:
+ if method
in method_map
:
method = method_map[method]
methodresponse = True
method = method_map[method]
methodresponse = True
diff --git
a/sfa/trust/certificate.py
b/sfa/trust/certificate.py
index
494b977
..
8e9cf7d
100644
(file)
--- a/
sfa/trust/certificate.py
+++ b/
sfa/trust/certificate.py
@@
-641,7
+641,7
@@
class Certificate:
def set_data(self, str, field='subjectAltName'):
# pyOpenSSL only allows us to add extensions, so if we try to set the
# same extension more than once, it will not work
def set_data(self, str, field='subjectAltName'):
# pyOpenSSL only allows us to add extensions, so if we try to set the
# same extension more than once, it will not work
- if
self.data.has_key(field)
:
+ if
field in self.data
:
raise Exception("Cannot set {} more than once".format(field))
self.data[field] = str
self.add_extension(field, 0, str)
raise Exception("Cannot set {} more than once".format(field))
self.data[field] = str
self.add_extension(field, 0, str)
@@
-650,7
+650,7
@@
class Certificate:
# Return the data string that was previously set with set_data
def get_data(self, field='subjectAltName'):
# Return the data string that was previously set with set_data
def get_data(self, field='subjectAltName'):
- if
self.data.has_key(field)
:
+ if
field in self.data
:
return self.data[field]
try:
return self.data[field]
try:
diff --git
a/sfa/trust/credential_factory.py
b/sfa/trust/credential_factory.py
index
a51673e
..
cf5a8fb
100644
(file)
--- a/
sfa/trust/credential_factory.py
+++ b/
sfa/trust/credential_factory.py
@@
-69,7
+69,7
@@
class CredentialFactory:
# Try to treat the file as JSON, getting the cred_type from the struct
try:
credO = json.loads(credString, encoding='ascii')
# Try to treat the file as JSON, getting the cred_type from the struct
try:
credO = json.loads(credString, encoding='ascii')
- if
credO.has_key('geni_value') and credO.has_key('geni_type')
:
+ if
'geni_value' in credO and 'geni_type' in credO
:
cred_type = credO['geni_type']
credString = credO['geni_value']
except Exception as e:
cred_type = credO['geni_type']
credString = credO['geni_value']
except Exception as e:
diff --git
a/sfa/util/cache.py
b/sfa/util/cache.py
index
ee4716c
..
38eccc9
100644
(file)
--- a/
sfa/util/cache.py
+++ b/
sfa/util/cache.py
@@
-75,7
+75,7
@@
class Cache:
def add(self, key, value, ttl = DEFAULT_CACHE_TTL):
with self.lock:
def add(self, key, value, ttl = DEFAULT_CACHE_TTL):
with self.lock:
- if
self.cache.has_key(key)
:
+ if
key in self.cache
:
self.cache[key].set_data(value, ttl=ttl)
else:
self.cache[key] = CacheData(value, ttl)
self.cache[key].set_data(value, ttl=ttl)
else:
self.cache[key] = CacheData(value, ttl)
diff --git
a/sfa/util/callids.py
b/sfa/util/callids.py
index
ead60bb
..
6748546
100644
(file)
--- a/
sfa/util/callids.py
+++ b/
sfa/util/callids.py
@@
-44,7
+44,7
@@
class _call_ids_impl (dict):
logger.warning("_call_ids_impl.should_handle_call_id: could not acquire lock")
return False
# we're good to go
logger.warning("_call_ids_impl.should_handle_call_id: could not acquire lock")
return False
# we're good to go
- if
self.has_key(call_id)
:
+ if
call_id in self
:
self._purge()
self._lock.release()
return True
self._purge()
self._lock.release()
return True
diff --git
a/tools/depgraph2dot.py
b/tools/depgraph2dot.py
index
b8ecbce
..
ab07a31
100755
(executable)
--- a/
tools/depgraph2dot.py
+++ b/
tools/depgraph2dot.py
@@
-43,7
+43,7
@@
class pydepgraphdot:
# normalise our input data
for k,d in p.items():
for v in d.keys():
# normalise our input data
for k,d in p.items():
for v in d.keys():
- if
not p.has_key(v)
:
+ if
v not in p
:
p[v] = {}
f = self.get_output_file()
p[v] = {}
f = self.get_output_file()
diff --git
a/wsdl/sfa2wsdl.py
b/wsdl/sfa2wsdl.py
index
1a8ea21
..
2eb9463
100755
(executable)
--- a/
wsdl/sfa2wsdl.py
+++ b/
wsdl/sfa2wsdl.py
@@
-190,7
+190,7
@@
class WSDLGen:
in_el.setAttribute("name", method + "_in")
for service_name in function.interfaces:
in_el.setAttribute("name", method + "_in")
for service_name in function.interfaces:
- if (se
lf.services.has_key(service_name)
):
+ if (se
rvice_name in self.services
):
if (not method in self.services[service_name]):
self.services[service_name].append(method)
else:
if (not method in self.services[service_name]):
self.services[service_name].append(method)
else: