def __init__(self, url, app_key, app_secret, group_name='default', query_message_interval=50, heartbeat_interval=30,
                 sdk_version='top-sdk-java-201403304', *args, **kwargs):
        super(TmcClient, self).__init__(url, *args, **kwargs)
        Event.__init__(self)

        self.on('on_init', lambda: logger.info('WebSocket Start Connect: %s@%s' % (url, group_name)))

        assert isinstance(url, (str, unicode)) and len(url) > 0
        assert isinstance(app_key, (str, unicode)) and len(app_key) > 0
        assert isinstance(app_secret, (str, unicode)) and len(app_secret) > 0
        assert isinstance(group_name, (str, unicode)) and len(group_name) > 0
        assert isinstance(query_message_interval, int) and 0 < query_message_interval < 60
        assert isinstance(heartbeat_interval, int) and 0 < heartbeat_interval < 60

        self.sdk_version = sdk_version
        self.url = url
        self.app_secret = app_secret
        self.app_key = app_key
        self.group_name = group_name
        self.query_message_interval = query_message_interval
        self.heartbeat_interval = heartbeat_interval

        self.token = None

        self.fire('on_init')
        self.on('on_handshake_success', self._start_query_loop)
        self.on('on_confirm_message', self._on_confirm_message)
Example #2
0
    def __init__(self, bot, raw):
        Event.__init__(self, bot, raw)

        if not self.is_a(*UPDATE_EVENTS):
            self.channel = models.Channel(self.raw["channel"])
        else:
            self.channel = bot.get_channel(self.raw["channel"])
Example #3
0
 def __init__(self, etype, bubbles=True, cancelable=False,
                 relatedObject=None, shiftKey=None, keyCode=0,
                     direction='none'):
     Event.__init__(self, etype, bubbles, cancelable)
     self.relatedObject = relatedObject
     self.keyCode = keyCode
     self.shiftKey = shiftKey
 def __init__(self, event_start_date, event_start_month, event_start_year, event_end_date, event_end_month,
              event_end_year, number_of_participants, winner, fund, event_head, first_score,
              second_score, third_score, max_score, judge_fees, banner_price, ):
     Event.__init__(self, event_start_date, event_start_month, event_start_year, event_end_date, event_end_month,
                    event_end_year, number_of_participants, winner, first_score, second_score, max_score,
                    third_score, fund, event_head)
     self.judge_fees = judge_fees
     self.banner_price = banner_price
Example #5
0
	def __init__( self, id, user = None, subscriptionSource = None, resourceUri = None, event = None, contentType = None, expires = None, silent = False ):
		Event.__init__( self, id )
		self.user = user
		self.subscriptionSource = subscriptionSource
		self.resourceUri = resourceUri
		self.event = event
		self.contentType = contentType
		self.expires = expires
		self.silent = silent
Example #6
0
 def __init__(self, *args, **kwargs):
     """Stores t2 and channel and passes to Event.__init__"""
     # Store items:
     if "dur" in kwargs:
         self.dur = kwargs.pop("dur")
     else:
         self.dur = timedelta(0, 0, 0)
     # Refer to parent:
     Event.__init__(self, *args, **kwargs)
 def __init__(self, event_start_date, event_start_month, event_start_year,
              event_end_date, event_end_month, event_end_year,
              number_of_participants, winner, fund, event_head,
              number_of_sub_events, first_score, second_score, max_score,
              third_score):
     Event.__init__(self, event_start_date, event_start_month,
                    event_start_year, event_end_date, event_end_month,
                    event_end_year, number_of_participants, winner, fund,
                    event_head, first_score, second_score, max_score,
                    third_score)
     self.number_of_sub_events = number_of_sub_events
Example #8
0
 def __init__( self , *args , **kwargs ):
     """Doesn't do much"""
     # Retrieve argument intended for here:
     if "colour" in kwargs:
         self.colour = kwargs.pop("colour")
     else:
         self.colour = 'b'
     if "times" in kwargs:
         self.times = kwargs.pop("times")
     Event.__init__( self , *args , **kwargs )
     # Find times if not provided:
     if not hasattr( self , "times" ) :
         self.times , self.chans = self.GetPeaks( self.t )
Example #9
0
    def __init__(self, bot, raw):
        Event.__init__(self, bot, raw)
        self.emoji = raw["reaction"]
        self.reaction_type = raw["item"]["type"]

        if bot:
            self.user = bot.get_user(raw.get("user", ""))
        else:
            self.user = raw.get("user", "")

        if self.reaction_type == "message":
            self.target = bot.get_channel(raw["item"]["channel"]) if bot else raw["item"]["channel"]
        else:
            self.target = raw["item"]["file"]
Example #10
0
    def __init__(self, etype, bubbles=False, cancelable=False, 
                    charCodeValue=0, keyCodeValue=0, keyLocationValue=0, 
                        ctrlKeyValue=False, altKeyValue=False, 
                            shiftKeyValue=False, controlKeyValue=False, 
                                commandKeyValue=False):
        Event.__init__(self, etype, bubbles, cancelable)

        self.keyCode = keyCodeValue
        self.keyLocation = keyLocationValue
        self.charCode = charCodeValue

        self.shiftKey = shiftKeyValue
        self.altKey = altKeyValue
        self.controlKey = controlKeyValue
        self.commandKey = commandKeyValue
        self.ctrlKey = ctrlKeyValue or self.controlKey or self.commandKey
Example #11
0
 def __init__(self, etype, bubbles=True, cancelable=False, 
                 localX=0.0, localY=0.0, relatedObject=None, 
                     ctrlKey=False, altKey=False, shiftKey=False, 
                         buttonDown=False, delta=0, commandKey=False, 
                             clickCount=0):
     Event.__init__(self, etype, bubbles, cancelable=True)
     self.localX = float(localX)
     self.localY = float(localY)
     self.relatedObject = relatedObject
     self.ctrlKey = ctrlKey
     self.altKey = altKey
     self.shiftKey = shiftKey
     self.buttonDown = buttonDown
     self.delta = delta
     self.commandKey = commandKey
     self.clickCount = clickCount
     self.stageX = 0.0
     self.stageY = 0.0
Example #12
0
    def __init__(self,
                 url,
                 app_key,
                 app_secret,
                 group_name='default',
                 query_message_interval=50,
                 heartbeat_interval=30,
                 sdk_version='top-sdk-java-201403304',
                 *args,
                 **kwargs):
        super(TmcClient, self).__init__(url, *args, **kwargs)
        Event.__init__(self)

        self.on(
            'on_init', lambda: logger.info('WebSocket Start Connect: %s@%s' %
                                           (url, group_name)))

        assert isinstance(url, (str, unicode)) and len(url) > 0
        assert isinstance(app_key, (str, unicode)) and len(app_key) > 0
        assert isinstance(app_secret, (str, unicode)) and len(app_secret) > 0
        assert isinstance(group_name, (str, unicode)) and len(group_name) > 0
        assert isinstance(query_message_interval,
                          int) and 0 < query_message_interval < 60
        assert isinstance(heartbeat_interval,
                          int) and 0 < heartbeat_interval < 60

        self.sdk_version = sdk_version
        self.url = url
        self.app_secret = app_secret
        self.app_key = app_key
        self.group_name = group_name
        self.query_message_interval = query_message_interval
        self.heartbeat_interval = heartbeat_interval

        self.token = None

        self.fire('on_init')
        self.on('on_handshake_success', self._start_query_loop)
        self.on('on_confirm_message', self._on_confirm_message)
Example #13
0
 def __init__(self, time, group, index):
     Event.__init__(self, time)
     self.elevator_group = group
     self.elevator_index = index
Example #14
0
 def __init__(self, eventNumber, threadId, producer_thread, producer_event, address_range_start, address_range_end):
     Event.__init__(self, eventNumber, threadId)
     self.producer_thread = producer_thread
     self.producer_event = producer_event
     self.address_range_start = address_range_start
     self.address_range_end = address_range_end
Example #15
0
 def __init__( self , t="unk" , text="Cursor" , **kwargs ):
     """Doesn't do much"""
     Event.__init__( self , t , text , **kwargs )
Example #16
0
 def __init__(self, source, status):
     Event.__init__(self, "StatusEvent")
     self.source = source
     self.status = status
Example #17
0
    def __init__(self, bot, raw):
        Event.__init__(self, bot, raw)

        self.file = models.File(self.raw["file"]) if "file" in self.raw \
            else None
Example #18
0
 def __init__(self, source, old_state, new_state):
     Event.__init__(self, source)
     self.old_state = old_state
     self.new_state = new_state
 def __init__(self, utilization):
     Event.__init__(self, "FurnaceUtilizationEvent")
     self.utilization = utilization
Example #20
0
 def __init__(self, on_event, event_type: Event.TYPES, constant: bool = False, toggle: bool = False):
     Event.__init__(self, on_event=on_event, event_type=event_type, constant=constant, toggle=toggle)
Example #21
0
 def __init__(self, status):
     Event.__init__(self, "HeaterCommandEvent")
     self.status = status
Example #22
0
 def __init__(self, t, label, value):
     Event.__init__(self, t, label)
     self.value = value
Example #23
0
 def __init__(self, target):
     Event.__init__(self, "StatusRequestEvent")
     self.target = target
Example #24
0
 def __init__(self, sensor, temperature, averagingPeriod):
     Event.__init__(self, "TemperatureEvent")
     self.sensor = sensor
     self.temperature = temperature
     self.averagingPeriod = averagingPeriod
Example #25
0
 def __init__(self, sensor, temperature):
     Event.__init__(self, "RawReadingEvent")
     self.sensor = sensor
     self.temperature = temperature
     self.current = {}
Example #26
0
    def __init__(self, bot, raw):
        Event.__init__(self, bot, raw)

        self.user = models.User(self.raw["user"])
Example #27
0
 def __init__(self, source, conn):
     self.conn = conn
     Event.__init__(self, source)
Example #28
0
 def __init__(self, time, group, index):
     Event.__init__(self, time)
     self.elevator_group = group
     self.elevator_index = index
Example #29
0
 def __init__(self, source, msg):
     self.message = msg
     Event.__init__(self, source)
Example #30
0
 def __init__(self, name, value, replay = False):
     Event.__init__(self, "PropertyChangeEvent")
     self.name = name
     self.value = value
     self.replay = replay
Example #31
0
 def __init__(self, thing, data):
     Event.__init__(self, thing, 'overheated', data=data)
Example #32
0
 def __init__(self, bot, raw):
     Event.__init__(self, bot, raw)
     if "subtype" in raw:
         self.msg = None
     else:
         self.msg = models.Message(raw)
 def __init__(self, request):
     Event.__init__(self, request)
     self.setType(PeerEvent.TYPE)
     self._senderAddress    = None
     self._recipientAddress = None
Example #34
0
    def __init__(self):
        """."""
        self.consumers = set()

        Event.__init__(self)