Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
try:
return int(value)
except ValueError:
print "Invalid network id"
return None
class ExtendedOption (Option):
TYPES = Option.TYPES + ("base64", "hexint", )
TYPE_CHECKER = copy(Option.TYPE_CHECKER)
TYPE_CHECKER["base64"] = DecodeBase64Option
TYPE_CHECKER["hexint"] = DecodeHexIntOption
if __name__ == '__main__':
devMgr = WeaveDeviceMgr.WeaveDeviceManager()
cmdLine = " ".join(sys.argv[1:])
args = shlex.split(cmdLine)
optParser = OptionParser(usage=optparse.SUPPRESS_USAGE, option_class=ExtendedOption)
print "Connecting to device ..."
print ''
print '#################################connect#################################'
optParser.add_option("", "--pairing-code", action="store", dest="pairingCode", type="string")
optParser.add_option("", "--access-token", action="store", dest="accessToken", type="base64")
optParser.add_option("", "--use-dummy-access-token", action="store_true", dest="useDummyAccessToken")
optParser.add_option("", "--ble", action="store_true", dest="useBle")
optParser.add_option("", "--account-id", action="store", dest="account_id")
Cmd.__init__(self)
Cmd.identchars = string.ascii_letters + string.digits + '-'
if (sys.stdin.isatty()):
self.prompt = "weave-device-mgr > "
else:
self.use_rawinput = 0
self.prompt = ""
DeviceMgrCmd.command_names.sort()
self.bleMgr = None
self.devMgr = WeaveDeviceMgr.WeaveDeviceManager()
if (rendezvousAddr):
try:
self.devMgr.SetRendezvousAddress(rendezvousAddr)
except WeaveDeviceMgr.DeviceManagerException, ex:
print str(ex)
return
self.historyFileName = os.path.expanduser("~/.weave-device-mgr-history")
try:
import readline
if 'libedit' in readline.__doc__:
readline.parse_and_bind("bind ^I rl_complete")
readline.set_completer_delims(' ')
try: