bt2: rename `_Trace.env` -> `_Trace.environment`
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Wed, 14 Aug 2019 15:07:34 +0000 (11:07 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Thu, 15 Aug 2019 15:41:44 +0000 (11:41 -0400)
This matches the library functions.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I20c8ff4f69ad1a6fcce19203374c0ffc7d413009
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1927
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
src/bindings/python/bt2/bt2/trace.py
src/bindings/python/bt2/bt2/trace_class.py
tests/bindings/python/bt2/test_trace.py

index 7f98ac8698f39a7f9aeb615e33c901a28b941152..fcfd16b1948dcf65edf7ebf79da0751934074461 100644 (file)
@@ -31,7 +31,7 @@ import functools
 import uuid as uuidp
 
 
-class _TraceEnv(collections.abc.MutableMapping):
+class _TraceEnvironment(collections.abc.MutableMapping):
     def __init__(self, trace):
         self._trace = trace
 
@@ -154,8 +154,8 @@ class _Trace(object._SharedObject, collections.abc.Mapping):
     _uuid = property(fset=_uuid)
 
     @property
-    def env(self):
-        return _TraceEnv(self)
+    def environment(self):
+        return _TraceEnvironment(self)
 
     def create_stream(self, stream_class, id=None, name=None, user_attributes=None):
         utils._check_type(stream_class, bt2_stream_class._StreamClass)
index 1ec2a5055e120f9fafac87029667a8038615f245..bd39beabdfa5516dad2961e59659ac15b63a985e 100644 (file)
@@ -48,7 +48,7 @@ class _TraceClass(object._SharedObject, collections.abc.Mapping):
 
     # Instantiate a trace of this class.
 
-    def __call__(self, name=None, user_attributes=None, uuid=None, env=None):
+    def __call__(self, name=None, user_attributes=None, uuid=None, environment=None):
         trace_ptr = native_bt.trace_create(self._ptr)
 
         if trace_ptr is None:
@@ -65,9 +65,9 @@ class _TraceClass(object._SharedObject, collections.abc.Mapping):
         if uuid is not None:
             trace._uuid = uuid
 
-        if env is not None:
-            for key, value in env.items():
-                trace.env[key] = value
+        if environment is not None:
+            for key, value in environment.items():
+                trace.environment[key] = value
 
         return trace
 
index 5a9275628cf7b0ac6018955aa146eea6448f9704..0cb3b94eb46b6386c640782df03511b803131afd 100644 (file)
@@ -29,7 +29,7 @@ class TraceTestCase(unittest.TestCase):
         trace = self._tc()
         self.assertIsNone(trace.name)
         self.assertIsNone(trace.uuid)
-        self.assertEqual(len(trace.env), 0)
+        self.assertEqual(len(trace.environment), 0)
         self.assertEqual(len(trace.user_attributes), 0)
 
     def test_create_invalid_name(self):
@@ -61,15 +61,15 @@ class TraceTestCase(unittest.TestCase):
         self.assertEqual(trace.uuid, uuid.UUID('da7d6b6f-3108-4706-89bd-ab554732611b'))
 
     def test_env_get(self):
-        trace = self._tc(env={'hello': 'you', 'foo': -5})
-        self.assertEqual(trace.env['hello'], 'you')
-        self.assertEqual(trace.env['foo'], -5)
+        trace = self._tc(environment={'hello': 'you', 'foo': -5})
+        self.assertEqual(trace.environment['hello'], 'you')
+        self.assertEqual(trace.environment['foo'], -5)
 
     def test_env_get_non_existent(self):
-        trace = self._tc(env={'hello': 'you', 'foo': -5})
+        trace = self._tc(environment={'hello': 'you', 'foo': -5})
 
         with self.assertRaises(KeyError):
-            trace.env['lel']
+            trace.environment['lel']
 
     def test_len(self):
         trace = self._tc()
This page took 0.026795 seconds and 4 git commands to generate.