Python: CTFWriter: forbid Stream.__init__()
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Tue, 9 Dec 2014 00:02:13 +0000 (19:02 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 13 Feb 2015 17:18:45 +0000 (12:18 -0500)
In the CTF writer API, a Stream object may only
be created using Writer.create_stream(), therefore
rendering Stream.__init__() useless for the user,
since the resulting object is not, and cannot, be
associated with a Writer object.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
bindings/python/bt.py

index 8105056a8fab0d5299242f2ca4f6027e8f5ab23b..2bbe6b2549331ba52f96772b04e1f3920cebc5ef 100644 (file)
@@ -2620,18 +2620,8 @@ class CTFWriter:
                 raise ValueError("Failed to set packet context type.")
 
     class Stream:
-        def __init__(self, stream_class):
-            """
-            Create a stream of the given class.
-            """
-
-            if not isinstance(stream_class, CTFWriter.StreamClass):
-                raise TypeError("Invalid stream_class argument must be of type StreamClass.")
-
-            self._s = nbt._bt_ctf_stream_create(stream_class._sc)
-
-            if self._s is None:
-                raise ValueError("Stream creation failed.")
+        def __init__(self):
+            raise NotImplementedError("Stream cannot be instantiated; use Writer.create_stream()")
 
         def __del__(self):
             nbt._bt_ctf_stream_put(self._s)
This page took 0.030738 seconds and 4 git commands to generate.