Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
authorFrederic Leger2014-03-13 06:44:45 -0400
committerFrederic Leger2014-03-13 11:06:58 -0400
commit4e3ba4dad9a03f3b979553972be55594c70b3e37 (patch)
tree4efb3246e34ad8d74d1c76a1601b42d5a3d042bd /python
parentc5e711d87dbf7c682b0d1619dc636ca120f69a58 (diff)
downloadorg.eclipse.tcf-4e3ba4dad9a03f3b979553972be55594c70b3e37.tar.gz
org.eclipse.tcf-4e3ba4dad9a03f3b979553972be55594c70b3e37.tar.xz
org.eclipse.tcf-4e3ba4dad9a03f3b979553972be55594c70b3e37.zip
Stricter PEP8.
Applied strict PEP8 coding style.
Diffstat (limited to 'python')
-rw-r--r--python/src/tcf/services/local/LocatorService.py46
1 files changed, 22 insertions, 24 deletions
diff --git a/python/src/tcf/services/local/LocatorService.py b/python/src/tcf/services/local/LocatorService.py
index 5587d60b8..b5c232644 100644
--- a/python/src/tcf/services/local/LocatorService.py
+++ b/python/src/tcf/services/local/LocatorService.py
@@ -478,7 +478,7 @@ class LocatorService(locator.LocatorService):
(subnet.address, subnet.broadcast))
logging.trace(buf.getvalue())
- def __getAllIpAddresses (self) :
+ def __getAllIpAddresses(self):
import fcntl # @UnresolvedImport
import struct
import array
@@ -486,14 +486,12 @@ class LocatorService(locator.LocatorService):
nBytes = 8192
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
names = array.array('B', '\0' * nBytes)
- ifcfg = struct.unpack \
- (
- 'iL',
- fcntl.ioctl (s.fileno(), 0x8912, # @UndefinedVariable
- struct.pack ('iL', nBytes, names.buffer_info ()[0]))
- )[0]
-
- namestr = names.tostring ()
+ ifcfg = struct.unpack('iL',
+ fcntl.ioctl(s.fileno(), 0x8912,
+ struct.pack('iL', nBytes,
+ names.buffer_info()[0])))[0]
+
+ namestr = names.tostring()
res = []
# the ipconf structure changed at a time, check if there are more than
@@ -503,37 +501,37 @@ class LocatorService(locator.LocatorService):
sz = 32
altSz = 40
- if len (namestr) > sz :
+ if len(namestr) > sz:
# check for name at 32->32+16
- secondName = str (namestr [sz:sz + 16].split ('\0', 1)[0])
- secondAltName = str (namestr [altSz:altSz + 16].split ('\0', 1)[0])
+ secondName = str(namestr[sz:sz + 16].split('\0', 1)[0])
+ secondAltName = str(namestr[altSz:altSz + 16].split('\0', 1)[0])
- if (not secondName.isalnum ()) and (secondAltName.isalnum ()) :
+ if (not secondName.isalnum()) and (secondAltName.isalnum()):
ifconfSz = 40
- for ix in range (0, ifcfg, ifconfSz):
+ for ix in range(0, ifcfg, ifconfSz):
ipStartIx = ix + 20
ipEndIx = ix + 24
- ip = namestr [ipStartIx : ipEndIx]
- res.append (str (ord (ip [0])) + '.' + str (ord (ip [1])) + '.' + \
- str (ord (ip [2])) + '.' + str (ord (ip [3])))
+ ip = namestr[ipStartIx:ipEndIx]
+ res.append(str(ord(ip[0])) + '.' + str(ord(ip[1])) + '.' + \
+ str(ord(ip[2])) + '.' + str(ord(ip[3])))
return (res)
def __getSubNetList(self, _set):
hostname = socket.gethostname()
- if len (self.addr_list) == 0 :
+ if len(self.addr_list) == 0:
# Create the list of IP address for this host
- _, _, self.addr_list = socket.gethostbyname_ex (hostname)
+ _, _, self.addr_list = socket.gethostbyname_ex(hostname)
if not "127.0.0.1" in self.addr_list:
- self.addr_list.append ("127.0.0.1")
+ self.addr_list.append("127.0.0.1")
# On unix hosts, use sockets to get the other interfaces IPs
- if (platform.system() != 'Windows') :
- for ip_addr in self.__getAllIpAddresses () :
- if not ip_addr in self.addr_list :
- self.addr_list.append (ip_addr)
+ if (platform.system() != 'Windows'):
+ for ip_addr in self.__getAllIpAddresses():
+ if not ip_addr in self.addr_list:
+ self.addr_list.append(ip_addr)
for address in self.addr_list:
rawaddr = socket.inet_aton(address)

Back to the top