Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def actor_class(runtime):
class ActorForProxying(runtime.actor_class):
a_nested_object = pykka.traversable(NestedObject())
a_class_attr = 'class_attr'
def __init__(self):
super(runtime.actor_class, self).__init__()
self.an_instance_attr = 'an_instance_attr'
def a_method(self):
pass
return ActorForProxying
import pykka
class NestedWithNoMarker(object):
inner = 'nested_with_no_marker.inner'
class NestedWithNoMarkerAndSlots(object):
__slots__ = ['inner']
def __init__(self):
self.inner = 'nested_with_no_marker_and_slots.inner'
@pykka.traversable
class NestedWithDecoratorMarker(object):
inner = 'nested_with_decorator_marker.inner'
class NestedWithAttrMarker(object):
pykka_traversable = True
inner = 'nested_with_attr_marker.inner'
class NestedWithAttrMarkerAndSlots(object):
__slots__ = ['pykka_traversable', 'inner']
def __init__(self):
# Objects using '__slots__' cannot have class attributes.
self.pykka_traversable = True
self.inner = 'nested_with_attr_marker_and_slots.inner'
def actor_class(runtime):
class ActorWithTraversableObjects(runtime.actor_class):
nested_with_no_marker = NestedWithNoMarker()
nested_with_function_marker = pykka.traversable(NestedWithNoMarker())
nested_with_decorator_marker = NestedWithDecoratorMarker()
nested_with_attr_marker = NestedWithAttrMarker()
nested_with_attr_marker_and_slots = NestedWithAttrMarkerAndSlots()
@property
def nested_object_property(self):
return NestedWithAttrMarker()
return ActorWithTraversableObjects
def test_traversable_cannot_mark_object_using_slots():
with pytest.raises(Exception) as exc_info:
pykka.traversable(NestedWithNoMarkerAndSlots())
assert 'cannot be used to mark an object using slots' in str(exc_info.value)
self._tags = {}
self._pending_uri = None
self._pending_tags = None
self._pending_metadata = None
self._playbin = None
self._outputs = None
self._queue = None
self._about_to_finish_callback = None
self._handler = _Handler(self)
self._appsrc = _Appsrc()
self._signals = utils.Signals()
if mixer and self._config["audio"]["mixer"] == "software":
self.mixer = pykka.traversable(SoftwareMixer(mixer))
:rtype: :class:`True` if successful, else :class:`False`
"""
return self.audio.stop_playback().get()
def get_time_position(self):
"""
Get the current time position in milliseconds.
*MAY be reimplemented by subclass.*
:rtype: int
"""
return self.audio.get_position().get()
@pykka.traversable
class PlaylistsProvider:
"""
A playlist provider exposes a collection of playlists, methods to
create/change/delete playlists in this collection, and lookup of any
playlist the backend knows about.
:param backend: backend the controller is a part of
:type backend: :class:`mopidy.backend.Backend` instance
"""
def __init__(self, backend):
self.backend = backend
def as_list(self):
"""