summaryrefslogtreecommitdiffstats
path: root/keystone/common
diff options
context:
space:
mode:
authorMonty Taylor <mordred@inaugust.com>2012-01-31 13:39:36 -0500
committerMonty Taylor <mordred@inaugust.com>2012-01-31 14:15:57 -0500
commitcf3f671a050f5cb5a2acc8c8c4b0b6b7a3a0d892 (patch)
treebd2a19e671e21965cb795de55c25275bc2990c41 /keystone/common
parent826319befdb552e1fb9098e0bd5518ce11915b0a (diff)
downloadkeystone-cf3f671a050f5cb5a2acc8c8c4b0b6b7a3a0d892.tar.gz
keystone-cf3f671a050f5cb5a2acc8c8c4b0b6b7a3a0d892.tar.xz
keystone-cf3f671a050f5cb5a2acc8c8c4b0b6b7a3a0d892.zip
Fix pep8 violations.
Change-Id: I12e304c567b92178e193c60599c3be606cc70d38
Diffstat (limited to 'keystone/common')
-rw-r--r--keystone/common/logging.py16
-rw-r--r--keystone/common/utils.py64
2 files changed, 40 insertions, 40 deletions
diff --git a/keystone/common/logging.py b/keystone/common/logging.py
index 7ef07376..a9aaccfc 100644
--- a/keystone/common/logging.py
+++ b/keystone/common/logging.py
@@ -45,11 +45,11 @@ SysLogHandler = SysLogHandler
def log_debug(f):
- @functools.wraps(f)
- def wrapper(*args, **kw):
- logging.debug('%s(%s, %s) ->', f.func_name, str(args), str(kw))
- rv = f(*args, **kw)
- logging.debug(pprint.pformat(rv, indent=2))
- logging.debug('')
- return rv
- return wrapper
+ @functools.wraps(f)
+ def wrapper(*args, **kw):
+ logging.debug('%s(%s, %s) ->', f.func_name, str(args), str(kw))
+ rv = f(*args, **kw)
+ logging.debug(pprint.pformat(rv, indent=2))
+ logging.debug('')
+ return rv
+ return wrapper
diff --git a/keystone/common/utils.py b/keystone/common/utils.py
index 3ee94894..95a1b971 100644
--- a/keystone/common/utils.py
+++ b/keystone/common/utils.py
@@ -161,38 +161,38 @@ def check_password(password, hashed):
# From python 2.7
def check_output(*popenargs, **kwargs):
- r"""Run command with arguments and return its output as a byte string.
-
- If the exit code was non-zero it raises a CalledProcessError. The
- CalledProcessError object will have the return code in the returncode
- attribute and output in the output attribute.
-
- The arguments are the same as for the Popen constructor. Example:
-
- >>> check_output(["ls", "-l", "/dev/null"])
- 'crw-rw-rw- 1 root root 1, 3 Oct 18 2007 /dev/null\n'
-
- The stdout argument is not allowed as it is used internally.
- To capture standard error in the result, use stderr=STDOUT.
-
- >>> check_output(["/bin/sh", "-c",
- ... "ls -l non_existent_file ; exit 0"],
- ... stderr=STDOUT)
- 'ls: non_existent_file: No such file or directory\n'
- """
- if 'stdout' in kwargs:
- raise ValueError('stdout argument not allowed, it will be overridden.')
- logging.debug(' '.join(popenargs[0]))
- process = subprocess.Popen(stdout=subprocess.PIPE, *popenargs, **kwargs)
- output, unused_err = process.communicate()
- retcode = process.poll()
- if retcode:
- cmd = kwargs.get("args")
- if cmd is None:
- cmd = popenargs[0]
- raise subprocess.CalledProcessError(retcode, cmd)
- return output
+ r"""Run command with arguments and return its output as a byte string.
+
+ If the exit code was non-zero it raises a CalledProcessError. The
+ CalledProcessError object will have the return code in the returncode
+ attribute and output in the output attribute.
+
+ The arguments are the same as for the Popen constructor. Example:
+
+ >>> check_output(["ls", "-l", "/dev/null"])
+ 'crw-rw-rw- 1 root root 1, 3 Oct 18 2007 /dev/null\n'
+
+ The stdout argument is not allowed as it is used internally.
+ To capture standard error in the result, use stderr=STDOUT.
+
+ >>> check_output(["/bin/sh", "-c",
+ ... "ls -l non_existent_file ; exit 0"],
+ ... stderr=STDOUT)
+ 'ls: non_existent_file: No such file or directory\n'
+ """
+ if 'stdout' in kwargs:
+ raise ValueError('stdout argument not allowed, it will be overridden.')
+ logging.debug(' '.join(popenargs[0]))
+ process = subprocess.Popen(stdout=subprocess.PIPE, *popenargs, **kwargs)
+ output, unused_err = process.communicate()
+ retcode = process.poll()
+ if retcode:
+ cmd = kwargs.get("args")
+ if cmd is None:
+ cmd = popenargs[0]
+ raise subprocess.CalledProcessError(retcode, cmd)
+ return output
def git(*args):
- return check_output(['git'] + list(args))
+ return check_output(['git'] + list(args))