Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
#!/usr/bin/env python
from __future__ import print_function
import pytest
from circuits import Component, Event
pytestmark = pytest.mark.skip("XXX: This test fails intermittently")
class test(Event):
"""test Event"""
class coroutine1(Event):
"""coroutine Event"""
complete = True
class coroutine2(Event):
"""coroutine Event"""
complete = True
class App(Component):
returned = False
#!/usr/bin/env python
from __future__ import print_function
import pytest
from circuits import Component, Event, handler
class test(Event):
"""test Event"""
success = True
class foo(Event):
"""foo Event"""
class App(Component):
@handler("test", priority=1)
def on_test(self, event):
event.stop()
yield
@handler("test")
def on_test_ignored(self):
return "Hello World!"
@pytest.fixture
#!/usr/bin/env python
import sys
from time import sleep
from circuits import future, Component, Event
class Test(Event):
"""Test Event"""
class App(Component):
def __init__(self, N):
super(App, self).__init__()
self.N = N
self.n = 0
def __tick__(self):
if self.n == self.N:
raise SystemExit, 0
print "."
def started(self, component, mode):
def test_subclass_looses_properties():
class hello(Event):
success = True
e = hello().child('success')
assert e.success is False
#!/usr/bin/env python
from circuits import Component, Event
class hello(Event):
"""hello Event"""
class foo(Event):
"""foo Event"""
class bar(Event):
"""bar Event"""
class App(Component):
fd.close()
###
### Events
###
class Create(Event):
"""Create(Event) -> Create Event"""
class Load(Event):
"""Load(Event) -> Load Event"""
class Verify(Event):
"""Verify(Event) -> Verify Event"""
class Upgrade(Event):
"""Upgrade(Event) -> Upgrade Event"""
class Created(Event):
"""Created(Event) -> Created Event"""
class Loaded(Event):
"""Loaded(Event) -> Loaded Event"""
class Invalid(Event):
"""Invalid(Event) -> Invalid Event
args: path, msg
"""
class NeedsUpgrade(Event):
"""NeedsUpgrade(Event) -> NeedsUpgrade Event
def started(self, component):
"""started Event handler
"""
self.serial_ports = self.read_serial_ports()
# Timer(seconds, event, persist=False)
Timer(self.timer_interval, Event.create("timer"), persist=True).register(self)
#!/usr/bin/env python
from circuits import Component, Event
class woof(Event):
"""woof Event"""
class Pound(Component):
def __init__(self):
super(Pound, self).__init__()
self.bob = Bob().register(self)
self.fred = Fred().register(self)
def started(self, *args):
self.fire(woof())
# Module: ann
# Date: 18th March 2006
# Author: James Mills
"""Artificial Neural Networking Library
...
"""
import math
from time import sleep
from circuits import Event, Component
class Signal(Event): pass
class Node(Component):
def __init__(self, *args, **kwargs):
super(Node, self).__init__(*args, **kwargs)
self.start()
def __repr__(self):
return "" % (id(self), self.running)
def fire(self, level=1.0):
self.push(Signal(level), "signal", self.channel)
class Synapse(Node):
help="Wait for a node HELO before start. (Default: False)")
opts, args = parser.parse_args()
return opts, args
###
### Events
###
class Start(Event): pass
class Stop(Event): pass
class Term(Event): pass
class Query(Event): pass
class Busy(Event): pass
class Ready(Event): pass
class Task(Event): pass
class Run(Event): pass
class Done(Event): pass
class Task(Event): pass
class Prime(Event): pass
###
### Components
###
class PrimeFinder(Component):
id = uuid()
term = False
busy = False