No semantic change, just fixing style issues to comply with
pep8 rules.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
plugins/python/example.py | 10 ++++++++--
tests/python-exception.py | 4 ++++
tests/shebang.py | 5 ++++-
tests/test.py | 17 ++++++++++++++---
4 files changed, 30 insertions(+), 6 deletions(-)
diff --git a/plugins/python/example.py b/plugins/python/example.py
index be9d9a8..b0f2185 100644
--- a/plugins/python/example.py
+++ b/plugins/python/example.py
@@ -33,11 +33,13 @@ import errno
# per handle.
disk = bytearray(1024 * 1024)
+
# This just prints the extra command line parameters, but real plugins
# should parse them and reject any unknown parameters.
def config(key, value):
print ("ignored parameter %s=%s" % (key, value))
+
def open(readonly):
print ("open: readonly=%d" % readonly)
@@ -46,19 +48,23 @@ def open(readonly):
# callbacks [in the client connected phase].
return 1
+
def get_size(h):
global disk
- return len (disk)
+ return len(disk)
+
def pread(h, count, offset):
global disk
return disk[offset:offset+count]
+
def pwrite(h, buf, offset):
global disk
- end = offset + len (buf)
+ end = offset + len(buf)
disk[offset:end] = buf
+
def zero(h, count, offset, may_trim):
global disk
if may_trim:
diff --git a/tests/python-exception.py b/tests/python-exception.py
index 93531cc..1debf51 100644
--- a/tests/python-exception.py
+++ b/tests/python-exception.py
@@ -32,14 +32,18 @@
# A dummy python plugin which just raises an exception in config_complete.
+
def config_complete():
raise RuntimeError("this is the test string")
+
def open(readonly):
return 1
+
def get_size(h):
return 0
+
def pread(h, count, offset):
return ""
diff --git a/tests/shebang.py b/tests/shebang.py
index 012a73e..c7d833e 100755
--- a/tests/shebang.py
+++ b/tests/shebang.py
@@ -2,13 +2,16 @@
disk = bytearray(1024 * 1024)
+
def open(readonly):
print ("open: readonly=%d" % readonly)
return 1
+
def get_size(h):
global disk
- return len (disk)
+ return len(disk)
+
def pread(h, count, offset):
global disk
diff --git a/tests/test.py b/tests/test.py
index 5d68b32..015b20f 100644
--- a/tests/test.py
+++ b/tests/test.py
@@ -1,38 +1,49 @@
-disk = bytearray (1024*1024);
+disk = bytearray(1024*1024)
+
def config_complete():
pass
+
def open(readonly):
return 1
+
def get_size(h):
global disk
- return len (disk)
+ return len(disk)
+
def can_write(h):
return True
+
def can_flush(h):
return True
+
def is_rotational(h):
return False
+
def can_trim(h):
return True
+
def pread(h, count, offset):
global disk
return disk[offset:offset+count]
+
def pwrite(h, buf, offset):
global disk
- end = offset + len (buf)
+ end = offset + len(buf)
disk[offset:end] = buf
+
def flush(h):
pass
+
def trim(h, count, offset):
pass
--
2.14.3