if HAVE_FLAKE8
ALL_LOCAL += flake8-check
flake8-check: $(FLAKE8_PYFILES)
- $(AM_V_GEN) if flake8 $^ --ignore=E111,E112,E113,E123,E126,E127,E128,E129,E131,E201,E203,E222,E225,E226,E231,E241,E251,E261,E262,E265,E271,E501,E502,E703,E711,E713,E721,W601 ${FLAKE8_FLAGS}; then touch $@; else exit 1; fi
+ $(AM_V_GEN) if flake8 $^ --ignore=E111,E112,E113,E123,E126,E127,E128,E129,E131,E201,E203,E222,E225,E226,E231,E241,E251,E261,E262,E265,E271,E501,E502,E703,E713,W601 ${FLAKE8_FLAGS}; then touch $@; else exit 1; fi
endif
include $(srcdir)/manpages.mk
if host in self.psk_hosts:
raise error.Error("host %s already defined for psk" % host)
- if vals["certificate"] == None:
+ if vals["certificate"] is None:
raise error.Error("'certificate' not defined for %s" % host)
- elif vals["private_key"] == None:
+ elif vals["private_key"] is None:
# Assume the private key is stored in the same PEM file as
# the certificate. We make a copy of "vals" so that we don't
# modify the original "vals", which would cause the script
if (msg.type == ovs.jsonrpc.Message.T_NOTIFY
and msg.method == "update"
and len(msg.params) == 2
- and msg.params[0] == None):
+ and msg.params[0] is None):
# Database contents changed.
self.__parse_update(msg.params[1])
elif (msg.type == ovs.jsonrpc.Message.T_REPLY
def json_type_to_string(type_):
- if type_ == None:
+ if type_ is None:
return "null"
elif type_ == bool:
return "boolean"
from ovs.db import error
import ovs.db.parser
-from ovs.db import types
+import ovs.db.types
def _check_id(name, json):
return DbSchema.from_json(self.to_json())
def __follow_ref_table(self, column, base, base_name):
- if not base or base.type != types.UuidType or not base.ref_table_name:
+ if (not base or base.type != ovs.db.types.UuidType
+ or not base.ref_table_name):
return
base.ref_table = self.tables.get(base.ref_table_name)
indexes_json = parser.get_optional("indexes", [list], [])
parser.finish()
- if max_rows == None:
+ if max_rows is None:
max_rows = sys.maxint
elif max_rows <= 0:
raise error.Error("maxRows must be at least 1", json)
parser = ovs.db.parser.Parser(json, "schema for column %s" % name)
mutable = parser.get_optional("mutable", [bool], True)
ephemeral = parser.get_optional("ephemeral", [bool], False)
- type_ = types.Type.from_json(parser.get("type", [dict, str, unicode]))
+ type_ = ovs.db.types.Type.from_json(parser.get("type",
+ [dict, str, unicode]))
parser.finish()
return ColumnSchema(name, mutable, not ephemeral, type_)
elif self.parse_state != Parser.__parse_end:
self.__error("unexpected end of input")
- if self.error == None:
+ if self.error is None:
assert len(self.stack) == 1
return self.stack.pop()
else:
request.id = "echo"
self.rpc.send(request)
else:
- assert action == None
+ assert action is None
def wait(self, poller):
if self.rpc is not None:
import ovs.db.idl
import ovs.db.schema
from ovs.db import data
-from ovs.db import types
+import ovs.db.types
import ovs.ovsuuid
import ovs.poller
import ovs.util
def do_default_atoms():
- for type_ in types.ATOMIC_TYPES:
- if type_ == types.VoidType:
+ for type_ in ovs.db.types.ATOMIC_TYPES:
+ if type_ == ovs.db.types.VoidType:
continue
sys.stdout.write("%s: " % type_.to_string())
def do_default_data():
any_errors = False
for n_min in 0, 1:
- for key in types.ATOMIC_TYPES:
- if key == types.VoidType:
+ for key in ovs.db.types.ATOMIC_TYPES:
+ if key == ovs.db.types.VoidType:
continue
- for value in types.ATOMIC_TYPES:
- if value == types.VoidType:
+ for value in ovs.db.types.ATOMIC_TYPES:
+ if value == ovs.db.types.VoidType:
valueBase = None
else:
- valueBase = types.BaseType(value)
- type_ = types.Type(types.BaseType(key), valueBase, n_min, 1)
+ valueBase = ovs.db.types.BaseType(value)
+ type_ = ovs.db.types.Type(ovs.db.types.BaseType(key),
+ valueBase, n_min, 1)
assert type_.is_valid()
sys.stdout.write("key %s, value %s, n_min %d: "
def do_parse_atomic_type(type_string):
type_json = unbox_json(ovs.json.from_string(type_string))
- atomic_type = types.AtomicType.from_json(type_json)
+ atomic_type = ovs.db.types.AtomicType.from_json(type_json)
print ovs.json.to_string(atomic_type.to_json(), sort_keys=True)
def do_parse_base_type(type_string):
type_json = unbox_json(ovs.json.from_string(type_string))
- base_type = types.BaseType.from_json(type_json)
+ base_type = ovs.db.types.BaseType.from_json(type_json)
print ovs.json.to_string(base_type.to_json(), sort_keys=True)
def do_parse_type(type_string):
type_json = unbox_json(ovs.json.from_string(type_string))
- type_ = types.Type.from_json(type_json)
+ type_ = ovs.db.types.Type.from_json(type_json)
print ovs.json.to_string(type_.to_json(), sort_keys=True)
def do_parse_atoms(type_string, *atom_strings):
type_json = unbox_json(ovs.json.from_string(type_string))
- base = types.BaseType.from_json(type_json)
+ base = ovs.db.types.BaseType.from_json(type_json)
for atom_string in atom_strings:
atom_json = unbox_json(ovs.json.from_string(atom_string))
try:
def do_parse_data(type_string, *data_strings):
type_json = unbox_json(ovs.json.from_string(type_string))
- type_ = types.Type.from_json(type_json)
+ type_ = ovs.db.types.Type.from_json(type_json)
for datum_string in data_strings:
datum_json = unbox_json(ovs.json.from_string(datum_string))
datum = data.Datum.from_json(type_, datum_json)
def do_sort_atoms(type_string, atom_strings):
type_json = unbox_json(ovs.json.from_string(type_string))
- base = types.BaseType.from_json(type_json)
+ base = ovs.db.types.BaseType.from_json(type_json)
atoms = [data.Atom.from_json(base, atom_json)
for atom_json in unbox_json(ovs.json.from_string(atom_strings))]
print ovs.json.to_string([data.Atom.to_json(atom)
print(" %sconnected" % negate)
if (old.last_connected != new.last_connected or
- (new.msec_since_connect != None and
+ (new.msec_since_connect is not None and
old.msec_since_connect != new.msec_since_connect - delta) or
(old.total_connected_duration != new.total_connected_duration - delta
and not (old.total_connected_duration == 0 and
% (new.msec_since_connect, new.total_connected_duration))
if (old.last_disconnected != new.last_disconnected or
- (new.msec_since_disconnect != None and
+ (new.msec_since_disconnect is not None and
old.msec_since_disconnect != new.msec_since_disconnect - delta)):
print(" disconnected at %d ms (%d ms ago)"
% (new.last_disconnected, new.msec_since_disconnect))
def call_prog(prog, args_list):
cmd = [prog, "-vconsole:off"] + args_list
output = subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()
- if len(output) == 0 or output[0] == None:
+ if len(output) == 0 or output[0] is None:
output = ""
else:
output = output[0].strip()
column = vtep_ctl("--columns=tunnel_key find logical_switch "
"name=%s" % self.name)
tunnel_key = column.partition(":")[2].strip()
- if (tunnel_key and type(eval(tunnel_key)) == types.IntType):
+ if tunnel_key and isinstance(eval(tunnel_key), types.IntType):
self.tunnel_key = tunnel_key
vlog.info("using tunnel key %s in %s"
% (self.tunnel_key, self.name))