mirror of https://github.com/dirtbags/netarch.git
pep8 updates
This commit is contained in:
parent
5422390deb
commit
5089facf35
|
@ -75,6 +75,7 @@ dbch = (u'·☺☻♥♦♣♠•◘○◙♂♀♪♫☼'
|
|||
u'αßΓπΣσµτΦΘΩδ∞φε∩'
|
||||
u'⁰¹²³⁴⁵⁶⁷⁸⁹ⁱⁿ⁽⁼⁾¤')
|
||||
|
||||
|
||||
def unpack(fmt, buf):
|
||||
"""Unpack buf based on fmt, return the rest as a string."""
|
||||
|
||||
|
|
|
@ -138,7 +138,7 @@ def freqgraph(f):
|
|||
return 0
|
||||
items = []
|
||||
for c, n in f.iteritems():
|
||||
if type(n) != type(0):
|
||||
if not isinstance(n, int):
|
||||
n = len(n)
|
||||
items.append((c, n))
|
||||
items.sort(cmp2)
|
||||
|
@ -171,8 +171,7 @@ def rot(n, txt):
|
|||
for c in txt:
|
||||
if c.isalpha():
|
||||
o = ord(c) + n
|
||||
if ((c.islower() and o > ord('z')) or
|
||||
(c.isupper() and o > ord('Z'))):
|
||||
if ((c.islower() and o > ord('z')) or (c.isupper() and o > ord('Z'))):
|
||||
o -= 26
|
||||
out += chr(o)
|
||||
else:
|
||||
|
@ -223,7 +222,7 @@ def adds(txt):
|
|||
class XorMask(object):
|
||||
def __init__(self, mask, stick=False):
|
||||
self.offset = 0
|
||||
if type(mask) == type(''):
|
||||
if isinstance(mask, str):
|
||||
self._mask = tuple(ord(m) for m in mask)
|
||||
else:
|
||||
self._mask = tuple(mask)
|
||||
|
|
|
@ -159,7 +159,8 @@ class Frame(object):
|
|||
len(self.payload)))
|
||||
|
||||
def __arp_repr__(self):
|
||||
return '<Frame %s %s(%s) -> %s(%s)>' % (self.name,
|
||||
return '<Frame %s %s(%s) -> %s(%s)>' % (
|
||||
self.name,
|
||||
str_of_eth(self.ar_sha), self.src_addr,
|
||||
str_of_eth(self.ar_tha), self.dst_addr)
|
||||
|
||||
|
@ -601,7 +602,7 @@ class Packet(UserDict.DictMixin):
|
|||
"""Handle data from a Session class."""
|
||||
|
||||
data = self.parse(data)
|
||||
if self.opcode != None:
|
||||
if self.opcode is not None:
|
||||
try:
|
||||
f = getattr(self, 'opcode_%s' % self.opcode)
|
||||
except AttributeError:
|
||||
|
|
Loading…
Reference in New Issue