summaryrefslogtreecommitdiff
path: root/python/samba/compat.py
diff options
context:
space:
mode:
authorJoe Guo <joeg@catalyst.net.nz>2018-09-04 01:05:20 +1200
committerAndrew Bartlett <abartlet@samba.org>2018-09-06 12:10:11 +0200
commit0f67b6e4b90d54fb75e078972baf392fca643056 (patch)
tree484f6529ded499e7b31570b474c31713ceae52eb /python/samba/compat.py
parentd02ec9f2ad90f3d4eae041e078cc228730b3d34f (diff)
downloadsamba-0f67b6e4b90d54fb75e078972baf392fca643056.tar.gz
PEP8: fix E111: indentation is not a multiple of four
Signed-off-by: Joe Guo <joeg@catalyst.net.nz> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'python/samba/compat.py')
-rw-r--r--python/samba/compat.py44
1 files changed, 22 insertions, 22 deletions
diff --git a/python/samba/compat.py b/python/samba/compat.py
index e151d9e8bac..54f5bce3aa5 100644
--- a/python/samba/compat.py
+++ b/python/samba/compat.py
@@ -37,12 +37,12 @@ if PY3:
# the PY2 code runs unchanged in PY2 whereas the code in PY3 possibly
# encodes the variable (see PY2 implementation of this function below)
def get_bytes(bytesorstring):
- tmp = bytesorstring
- if isinstance(bytesorstring, str):
- tmp = bytesorstring.encode('utf8')
- elif not isinstance(bytesorstring, bytes):
- raise ValueError('Expected byte or string for %s:%s' % (type(bytesorstring), bytesorstring))
- return tmp
+ tmp = bytesorstring
+ if isinstance(bytesorstring, str):
+ tmp = bytesorstring.encode('utf8')
+ elif not isinstance(bytesorstring, bytes):
+ raise ValueError('Expected byte or string for %s:%s' % (type(bytesorstring), bytesorstring))
+ return tmp
# helper function to get a string from a variable that maybe 'str' or
# 'bytes' if 'bytes' then it is decoded using 'utf8'. If 'str' is passed
@@ -51,12 +51,12 @@ if PY3:
# the PY2 code runs unchanged in PY2 whereas the code in PY3 possibly
# decodes the variable (see PY2 implementation of this function below)
def get_string(bytesorstring):
- tmp = bytesorstring
- if isinstance(bytesorstring, bytes):
- tmp = bytesorstring.decode('utf8')
- elif not isinstance(bytesorstring, str):
- raise ValueError('Expected byte of string for %s:%s' % (type(bytesorstring), bytesorstring))
- return tmp
+ tmp = bytesorstring
+ if isinstance(bytesorstring, bytes):
+ tmp = bytesorstring.decode('utf8')
+ elif not isinstance(bytesorstring, str):
+ raise ValueError('Expected byte of string for %s:%s' % (type(bytesorstring), bytesorstring))
+ return tmp
def cmp_fn(x, y):
"""
@@ -90,12 +90,12 @@ else:
# the PY2 code runs unchanged in PY2 whereas the code in PY3 possibly
# encodes the variable (see PY3 implementation of this function above)
def get_bytes(bytesorstring):
- tmp = bytesorstring
- if isinstance(bytesorstring, unicode):
- tmp = bytesorstring.encode('utf8')
- elif not isinstance(bytesorstring, str):
- raise ValueError('Expected string for %s:%s' % (type(bytesorstring), bytesorstring))
- return tmp
+ tmp = bytesorstring
+ if isinstance(bytesorstring, unicode):
+ tmp = bytesorstring.encode('utf8')
+ elif not isinstance(bytesorstring, str):
+ raise ValueError('Expected string for %s:%s' % (type(bytesorstring), bytesorstring))
+ return tmp
# Helper function to return string.
# if 'str' or 'unicode' passed in they are returned unchanged
@@ -104,10 +104,10 @@ else:
# the PY2 code runs unchanged in PY2 whereas the code in PY3 possibly
# decodes the variable (see PY3 implementation of this function above)
def get_string(bytesorstring):
- tmp = bytesorstring
- if not(isinstance(bytesorstring, str) or isinstance(bytesorstring, unicode)):
- raise ValueError('Expected str or unicode for %s:%s' % (type(bytesorstring), bytesorstring))
- return tmp
+ tmp = bytesorstring
+ if not(isinstance(bytesorstring, str) or isinstance(bytesorstring, unicode)):
+ raise ValueError('Expected str or unicode for %s:%s' % (type(bytesorstring), bytesorstring))
+ return tmp
if sys.version_info < (2, 7):