mirror of
https://github.com/gryf/wicd.git
synced 2025-12-20 04:48:00 +01:00
Fix up some issues spotted by pychecker.
This commit is contained in:
@@ -40,13 +40,10 @@ class WiredConnectThread() -- Connection thread for wired
|
||||
# and helped keep this project moving
|
||||
#
|
||||
|
||||
import os
|
||||
import sys
|
||||
import re
|
||||
import sys
|
||||
import threading
|
||||
import thread
|
||||
import operator
|
||||
import misc
|
||||
import wnettools
|
||||
import wpath
|
||||
@@ -65,6 +62,12 @@ class Controller(object):
|
||||
after_script = None
|
||||
disconnect_script = None
|
||||
|
||||
def __init__(self):
|
||||
""" Initialise the class. """
|
||||
self.global_dns_1 = None
|
||||
self.global_dns_2 = None
|
||||
self.global_dns_3 = None
|
||||
|
||||
|
||||
|
||||
class ConnectThread(threading.Thread):
|
||||
@@ -141,7 +144,12 @@ class ConnectThread(threading.Thread):
|
||||
class Wireless(Controller):
|
||||
""" A wrapper for common wireless interface functions. """
|
||||
|
||||
wpa_driver = None
|
||||
def __init__(self):
|
||||
""" Initialise the class. """
|
||||
Controller.__init__(self)
|
||||
self.wpa_driver = None
|
||||
|
||||
|
||||
|
||||
def Scan(self,essid=None):
|
||||
""" Scan for available wireless networks.
|
||||
@@ -243,7 +251,7 @@ class Wireless(Controller):
|
||||
wiface.SetChannel(channel)
|
||||
wiface.SetEssid(essid)
|
||||
#Right now it just assumes you're using WEP
|
||||
if enc_used == True:
|
||||
if enc_used:
|
||||
wiface.SetKey(key)
|
||||
|
||||
wiface.Up()
|
||||
@@ -449,6 +457,11 @@ class WirelessConnectThread(ConnectThread):
|
||||
class Wired(Controller):
|
||||
""" A wrapper for common wired interface functions. """
|
||||
|
||||
def __init__(self):
|
||||
""" Initialise the class. """
|
||||
Controller.__init__(self)
|
||||
self.wpa_driver = None
|
||||
|
||||
def CheckPluggedIn(self):
|
||||
""" Check whether the wired connection is plugged in.
|
||||
|
||||
@@ -527,7 +540,7 @@ class WiredConnectThread(ConnectThread):
|
||||
"""
|
||||
ConnectThread.__init__(self, network, wireless, wired,
|
||||
before_script, after_script, disconnect_script, gdns1,
|
||||
gdns3, gdns3)
|
||||
gdns2, gdns3)
|
||||
|
||||
|
||||
def run(self):
|
||||
|
||||
14
wnettools.py
14
wnettools.py
@@ -232,7 +232,7 @@ class WirelessInterface(Interface):
|
||||
essid -- essid to set the interface to
|
||||
|
||||
"""
|
||||
cmd = 'iwconfig ' + self.wireless_interface + ' essid "' + essid + '"'
|
||||
cmd = 'iwconfig ' + self.iface + ' essid "' + essid + '"'
|
||||
if self.verbose: print cmd
|
||||
misc.Run(cmd)
|
||||
|
||||
@@ -354,7 +354,7 @@ class WirelessInterface(Interface):
|
||||
# Support for ralink legacy drivers (maybe only serialmonkey enhanced),
|
||||
# may not work w/ hidden networks
|
||||
else:
|
||||
iwpriv = misc.Run('iwpriv ' + self.wireless_interface + ' get_site_survey')
|
||||
iwpriv = misc.Run('iwpriv ' + self.iface + ' get_site_survey')
|
||||
lines = iwpriv.splitlines()
|
||||
lines = lines[2:]
|
||||
for x in lines: # Iterate through all networks found
|
||||
@@ -403,7 +403,7 @@ class WirelessInterface(Interface):
|
||||
mode = 'managed'
|
||||
cmd = 'iwconfig ' + self.iface + ' mode ' + mode
|
||||
if self.verbose: print cmd
|
||||
results = misc.Run(cmd)
|
||||
misc.Run(cmd)
|
||||
|
||||
|
||||
def SetChannel(self, channel):
|
||||
@@ -415,7 +415,7 @@ class WirelessInterface(Interface):
|
||||
"""
|
||||
cmd = 'iwconfig ' + self.iface + ' channel ' + str(channel)
|
||||
if self.verbose: print cmd
|
||||
results = misc.Run(cmd)
|
||||
misc.Run(cmd)
|
||||
|
||||
|
||||
def SetKey(self, key):
|
||||
@@ -427,7 +427,7 @@ class WirelessInterface(Interface):
|
||||
"""
|
||||
cmd = 'iwconfig ' + self.iface + ' key ' + key
|
||||
if self.verbose: print cmd
|
||||
results = misc.Run(cmd)
|
||||
misc.Run(cmd)
|
||||
|
||||
|
||||
def Associate(self, essid, channel=None, bssid=None):
|
||||
@@ -445,7 +445,7 @@ class WirelessInterface(Interface):
|
||||
if bssid:
|
||||
cmd += ' ap ' + bssid
|
||||
if self.verbose: print cmd
|
||||
results = misc.Run(cmd)
|
||||
misc.Run(cmd)
|
||||
|
||||
|
||||
def Authenticate(self, network):
|
||||
@@ -457,7 +457,7 @@ class WirelessInterface(Interface):
|
||||
"""
|
||||
misc.ParseEncryption(network)
|
||||
if self.wpa_driver == 'ralink legacy':
|
||||
_AuthenticateRalinkLegacy(network)
|
||||
self._AuthenticateRalinkLegacy(network)
|
||||
else:
|
||||
cmd = ('wpa_supplicant -B -i ' + self.iface + ' -c "'
|
||||
+ wpath.networks + network['bssid'].replace(':','').lower()
|
||||
|
||||
Reference in New Issue
Block a user