import uuid as uuidp
-class _TraceEnv(collections.abc.MutableMapping):
+class _TraceEnvironment(collections.abc.MutableMapping):
def __init__(self, trace):
self._trace = trace
_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)
# 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:
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
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):
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()