mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 10:40:03 +01:00
Miscellaneous tidying up, no semantic changes.
Signed-off-by: Ewan Mellor <ewan@xensource.com>
This commit is contained in:
1 parent
3fba743862
commit
a0c858f6bf
7 files changed
+14
-17
No files matched your search
@@ -18,8 +18,6 @@ import xen.util.auxbin
|
||||
|
||||
import xen.lowlevel.xc
|
||||
|
||||
from xen.xend.xenstore.xsutil import IntroduceDomain
|
||||
|
||||
from XendError import XendError
|
||||
from XendLogging import log
|
||||
|
||||
|
||||
@@ -100,7 +100,7 @@ class XendClientProtocol:
|
||||
"""
|
||||
return self.xendRequest(url, "POST", args)
|
||||
|
||||
def handleStatus(self, version, status, message):
|
||||
def handleStatus(self, _, status, message):
|
||||
"""Handle the status returned from the request.
|
||||
"""
|
||||
status = int(status)
|
||||
@@ -114,8 +114,8 @@ class XendClientProtocol:
|
||||
"""Handle the data returned in response to the request.
|
||||
"""
|
||||
if data is None: return None
|
||||
type = self.getHeader('Content-Type')
|
||||
if type != sxp.mime_type:
|
||||
typ = self.getHeader('Content-Type')
|
||||
if typ != sxp.mime_type:
|
||||
return data
|
||||
try:
|
||||
pin = sxp.Parser()
|
||||
@@ -205,5 +205,5 @@ class UnixXendClientProtocol(HttpXendClientProtocol):
|
||||
path = xroot.get_xend_unix_path()
|
||||
self.path = path
|
||||
|
||||
def makeConnection(self, url):
|
||||
def makeConnection(self, _):
|
||||
return UnixConnection(self.path)
|
||||
@@ -171,7 +171,7 @@ class XendRoot:
|
||||
v = self.get_config_value(name, val)
|
||||
try:
|
||||
return int(v)
|
||||
except Exception, ex:
|
||||
except Exception:
|
||||
raise XendError("invalid xend config %s: expected int: %s" % (name, v))
|
||||
|
||||
def get_xend_http_server(self):
|
||||
|
||||
@@ -71,8 +71,8 @@ class NetifController(DevController):
|
||||
script = os.path.join(xroot.network_script_dir,
|
||||
sxp.child_value(config, 'script',
|
||||
xroot.get_vif_script()))
|
||||
type = sxp.child_value(config, 'type')
|
||||
if type == 'ioemu':
|
||||
typ = sxp.child_value(config, 'type')
|
||||
if typ == 'ioemu':
|
||||
return (None,{},{})
|
||||
bridge = sxp.child_value(config, 'bridge')
|
||||
mac = sxp.child_value(config, 'mac')
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
# Copyright (C) 2005 XenSource Ltd
|
||||
#============================================================================
|
||||
|
||||
import socket
|
||||
import sys
|
||||
import StringIO
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@ import xen.xend.sxp
|
||||
class test_sxp(unittest.TestCase):
|
||||
|
||||
def testAllFromString(self):
|
||||
def t(input, expected):
|
||||
self.assertEqual(xen.xend.sxp.all_from_string(input), expected)
|
||||
def t(inp, expected):
|
||||
self.assertEqual(xen.xend.sxp.all_from_string(inp), expected)
|
||||
|
||||
t('String', ['String'])
|
||||
t('(String Thing)', [['String', 'Thing']])
|
||||
|
||||
@@ -25,14 +25,14 @@ import commands
|
||||
import random
|
||||
|
||||
|
||||
def getUuidUuidgen(random = True):
|
||||
def getUuidUuidgen(randomly = True):
|
||||
"""Generate a UUID using the command uuidgen.
|
||||
|
||||
If random is true (default) generates a random uuid.
|
||||
If random is false generates a time-based uuid.
|
||||
If randomly is true (default) generates a random uuid.
|
||||
If randomly is false generates a time-based uuid.
|
||||
"""
|
||||
cmd = "uuidgen"
|
||||
if random:
|
||||
if randomly:
|
||||
cmd += " -r"
|
||||
else:
|
||||
cmd += " -t"
|
||||
@@ -42,7 +42,7 @@ def getUuidUuidgen(random = True):
|
||||
def getUuidRandom():
|
||||
"""Generate a random UUID."""
|
||||
|
||||
return [ random.randint(0, 255) for i in range(0, 16) ]
|
||||
return [ random.randint(0, 255) for _ in range(0, 16) ]
|
||||
|
||||
|
||||
#uuidFactory = getUuidUuidgen
|
||||
|
||||