Пример #1
0
    def _extract_event_state(klass, event_type, event_name):
        """Extracts event state from raw event type and name"""
        partitioned = event_name.partition(event_type)

        if len(partitioned) == 2:
            raw_state = partitioned[1]
        elif len(partitioned) == 3:
            raw_state = ''.join(partitioned[0::2])

        klass_state = camel_to_underscore(raw_state)

        return klass_state
Пример #2
0
    def _extract_event_state(klass, event_type, event_name):
        """Extracts event state from raw event type and name"""
        partitioned = event_name.partition(event_type)

        if len(partitioned) == 2:
            raw_state = partitioned[1]
        elif len(partitioned) == 3:
            raw_state = ''.join(partitioned[0::2])

        klass_state = camel_to_underscore(raw_state)

        return klass_state
Пример #3
0
    def _extract_event_state(klass, event_type, event_name):
        """Extracts event state from raw event type and name

        Example:

            With event_name = 'StartChildWorkflowExecutionInitiated'
             and event_type = 'ChildWorkflowExecution'
            left == 'Start'
            sep == 'ChildWorkflowExecution'
            right == 'Initiated'

            Returns: 'start_initiated'

        """
        left, sep, right = event_name.partition(event_type)
        return camel_to_underscore(left + right)
Пример #4
0
    def _extract_event_state(klass, event_type, event_name):
        """Extracts event state from raw event type and name

        Example:

            With event_name = 'StartChildWorkflowExecutionInitiated'
             and event_type = 'ChildWorkflowExecution'
            left == 'Start'
            sep == 'ChildWorkflowExecution'
            right == 'Initiated'

            Returns: 'start_initiated'

        """
        left, sep, right = event_name.partition(event_type)
        return camel_to_underscore(left + right)
Пример #5
0
 def process_attributes(self):
     """Processes the event raw_data attributes_key elements
     and sets current instance attributes accordingly"""
     for key, value in iteritems(self.raw[self._attributes_key]):
         setattr(self, camel_to_underscore(key), value)
Пример #6
0
 def process_attributes(self):
     """Processes the event raw_data attributes_key elements
     and sets current instance attributes accordingly"""
     for key, value in iteritems(self.raw[self._attributes_key]):
         setattr(self, camel_to_underscore(key), value)