changes to fix flake8 issues
This commit is contained in:
parent
1fc8d647c3
commit
dee91e97bf
23 changed files with 51 additions and 1005 deletions
|
@ -550,7 +550,7 @@ class CoreHandler(socketserver.BaseRequestHandler):
|
|||
# TODO: this needs to be removed, make use of the broadcast message methods
|
||||
replies = message_handler(message)
|
||||
self.dispatch_replies(replies, message)
|
||||
except:
|
||||
except Exception:
|
||||
logging.exception(
|
||||
"%s: exception while handling message: %s",
|
||||
threading.currentThread().getName(),
|
||||
|
@ -946,7 +946,7 @@ class CoreHandler(socketserver.BaseRequestHandler):
|
|||
session = self.coreemu.create_session(master=False)
|
||||
try:
|
||||
session.open_xml(file_name, start=True)
|
||||
except:
|
||||
except Exception:
|
||||
self.coreemu.delete_session(session.id)
|
||||
raise
|
||||
else:
|
||||
|
|
|
@ -4,6 +4,7 @@ commeffect.py: EMANE CommEffect model for CORE
|
|||
|
||||
import logging
|
||||
import os
|
||||
from builtins import int
|
||||
|
||||
from lxml import etree
|
||||
from past.builtins import basestring
|
||||
|
@ -147,7 +148,7 @@ class EmaneCommEffectModel(emanemodel.EmaneModel):
|
|||
jitter=convert_none(jitter),
|
||||
loss=convert_none(loss),
|
||||
duplicate=convert_none(duplicate),
|
||||
unicast=long(convert_none(bw)),
|
||||
broadcast=long(convert_none(mbw)),
|
||||
unicast=int(convert_none(bw)),
|
||||
broadcast=int(convert_none(mbw)),
|
||||
)
|
||||
service.publish(nemid2, event)
|
||||
|
|
|
@ -1136,7 +1136,7 @@ class Session(object):
|
|||
for hook in self._state_hooks.get(state, []):
|
||||
try:
|
||||
hook(state)
|
||||
except:
|
||||
except Exception:
|
||||
message = "exception occured when running %s state hook: %s" % (
|
||||
coreapi.state_name(state),
|
||||
hook,
|
||||
|
|
|
@ -6,7 +6,7 @@ import logging
|
|||
import random
|
||||
import socket
|
||||
import struct
|
||||
from builtins import bytes, range
|
||||
from builtins import bytes, int, range
|
||||
from socket import AF_INET, AF_INET6
|
||||
|
||||
|
||||
|
@ -43,8 +43,8 @@ class MacAddress(object):
|
|||
if not self.addr:
|
||||
return IpAddress.from_string("::")
|
||||
tmp = struct.unpack("!Q", "\x00\x00" + self.addr)[0]
|
||||
nic = long(tmp) & 0x000000FFFFFF
|
||||
oui = long(tmp) & 0xFFFFFF000000
|
||||
nic = int(tmp) & 0x000000FFFFFF
|
||||
oui = int(tmp) & 0xFFFFFF000000
|
||||
# toggle U/L bit
|
||||
oui ^= 0x020000000000
|
||||
# append EUI-48 octets
|
||||
|
|
|
@ -147,7 +147,7 @@ class EbtablesQueue(object):
|
|||
# TODO: if these are WlanNodes, this will never throw an exception
|
||||
try:
|
||||
wlan.session
|
||||
except:
|
||||
except Exception:
|
||||
# Just mark as updated to remove from self.updates.
|
||||
self.updated(wlan)
|
||||
continue
|
||||
|
|
|
@ -488,7 +488,7 @@ class CoreServices(object):
|
|||
for service in boot_path:
|
||||
try:
|
||||
self.boot_service(node, service)
|
||||
except:
|
||||
except Exception:
|
||||
logging.exception("exception booting service: %s", service.name)
|
||||
raise
|
||||
|
||||
|
|
|
@ -179,9 +179,8 @@ bootdaemon()
|
|||
flags="$flags -6"
|
||||
fi
|
||||
|
||||
|
||||
#force FRR to use CORE generated conf file
|
||||
flags="$flags -d -f $FRR_CONF"
|
||||
flags="$flags -d -f $FRR_CONF"
|
||||
$FRR_SBIN_DIR/$1 $flags
|
||||
|
||||
if [ "$?" != "0" ]; then
|
||||
|
@ -207,7 +206,7 @@ bootfrr()
|
|||
|
||||
bootdaemon "zebra"
|
||||
for r in rip ripng ospf6 ospf bgp babel; do
|
||||
if grep -q "^router \<${r}\>" $FRR_CONF; then
|
||||
if grep -q "^router \\<${r}\\>" $FRR_CONF; then
|
||||
bootdaemon "${r}d"
|
||||
fi
|
||||
done
|
||||
|
|
|
@ -180,7 +180,7 @@ class NrlOlsr(NrlService):
|
|||
cmd += " -rpipe %s_olsr" % node.name
|
||||
|
||||
servicenames = map(lambda x: x.name, node.services)
|
||||
if "SMF" in servicenames and not "NHDP" in servicenames:
|
||||
if "SMF" in servicenames and "NHDP" not in servicenames:
|
||||
cmd += " -flooding s-mpr"
|
||||
cmd += " -smfClient %s_smf" % node.name
|
||||
if "zebra" in servicenames:
|
||||
|
|
|
@ -199,7 +199,7 @@ bootquagga()
|
|||
|
||||
bootdaemon "zebra"
|
||||
for r in rip ripng ospf6 ospf bgp babel; do
|
||||
if grep -q "^router \<${r}\>" $QUAGGA_CONF; then
|
||||
if grep -q "^router \\<${r}\\>" $QUAGGA_CONF; then
|
||||
bootdaemon "${r}d"
|
||||
fi
|
||||
done
|
||||
|
|
|
@ -156,7 +156,7 @@ class Nat(CoreService):
|
|||
cfg += "# NAT out the first interface by default\n"
|
||||
have_nat = False
|
||||
for ifc in node.netifs():
|
||||
if hasattr(ifc, "control") and ifc.control == True:
|
||||
if hasattr(ifc, "control") and ifc.control is True:
|
||||
continue
|
||||
if have_nat:
|
||||
cfg += cls.generateifcnatrule(ifc, line_prefix="#")
|
||||
|
|
|
@ -143,7 +143,7 @@ exec 2> /dev/null
|
|||
IP="${2}"
|
||||
NET="${3}"
|
||||
if [ -z "$NET" ]; then
|
||||
NET="24"
|
||||
NET="24"
|
||||
fi
|
||||
|
||||
/sbin/ip addr add ${IP}/${NET} dev "$1"
|
||||
|
@ -165,7 +165,7 @@ exec 2> /dev/null
|
|||
IP="${2}"
|
||||
NET="${3}"
|
||||
if [ -z "$NET" ]; then
|
||||
NET="24"
|
||||
NET="24"
|
||||
fi
|
||||
|
||||
/sbin/ip addr del ${IP}/${NET} dev "$1"
|
||||
|
|
|
@ -495,7 +495,7 @@ Group ${APACHE_RUN_GROUP}
|
|||
|
||||
AccessFileName .htaccess
|
||||
|
||||
<Files ~ "^\.ht">
|
||||
<Files ~ "^\\.ht">
|
||||
"""
|
||||
cfg += permstr[version]
|
||||
cfg += """\
|
||||
|
@ -542,22 +542,22 @@ ServerSignature On
|
|||
TraceEnable Off
|
||||
|
||||
<VirtualHost *:80>
|
||||
ServerAdmin webmaster@localhost
|
||||
DocumentRoot /var/www
|
||||
<Directory />
|
||||
Options FollowSymLinks
|
||||
AllowOverride None
|
||||
</Directory>
|
||||
<Directory /var/www/>
|
||||
Options Indexes FollowSymLinks MultiViews
|
||||
AllowOverride None
|
||||
ServerAdmin webmaster@localhost
|
||||
DocumentRoot /var/www
|
||||
<Directory />
|
||||
Options FollowSymLinks
|
||||
AllowOverride None
|
||||
</Directory>
|
||||
<Directory /var/www/>
|
||||
Options Indexes FollowSymLinks MultiViews
|
||||
AllowOverride None
|
||||
"""
|
||||
cfg += permstr2[version]
|
||||
cfg += """\
|
||||
</Directory>
|
||||
ErrorLog ${APACHE_LOG_DIR}/error.log
|
||||
LogLevel warn
|
||||
CustomLog ${APACHE_LOG_DIR}/access.log combined
|
||||
</Directory>
|
||||
ErrorLog ${APACHE_LOG_DIR}/error.log
|
||||
LogLevel warn
|
||||
CustomLog ${APACHE_LOG_DIR}/access.log combined
|
||||
</VirtualHost>
|
||||
|
||||
"""
|
||||
|
|
|
@ -438,7 +438,7 @@ def load_classes(path, clazz):
|
|||
for member in members:
|
||||
valid_class = member[1]
|
||||
classes.append(valid_class)
|
||||
except:
|
||||
except Exception:
|
||||
logging.exception(
|
||||
"unexpected error during import, skipping: %s", import_statement
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue