azure-servicebus/azure/servicebus/control_client/_serialization.py
def _convert_etree_element_to_subscription(entry_element):
    '''Converts entry element to subscription

    The xml format for subscription:
<entry xmlns='http://www.w3.org/2005/Atom'>
    <content type='application/xml'>
    <SubscriptionDescription
        xmlns:i="http://www.w3.org/2001/XMLSchema-instance"
        xmlns="http://schemas.microsoft.com/netservices/2010/10/servicebus/connect">
        <LockDuration>PT5M</LockDuration>
        <RequiresSession>false</RequiresSession>
        <DefaultMessageTimeToLive>P10675199DT2H48M5.4775807S</DefaultMessageTimeToLive>
        <DeadLetteringOnMessageExpiration>false</DeadLetteringOnMessageExpiration>
        <DeadLetteringOnFilterEvaluationExceptions>true</DeadLetteringOnFilterEvaluationExceptions>
    </SubscriptionDescription>
    </content>
</entry>
    '''
    subscription = Subscription()

    subscription_element = entry_element.find('./atom:content/sb:SubscriptionDescription', _etree_sb_feed_namespaces)
    if subscription_element is not None:
        mappings = [
            ('LockDuration', 'lock_duration', None),
            ('RequiresSession', 'requires_session', _parse_bool),
            ('DefaultMessageTimeToLive', 'default_message_time_to_live', None),
            ('DeadLetteringOnFilterEvaluationExceptions', 'dead_lettering_on_filter_evaluation_exceptions', _parse_bool),  # pylint: disable=line-too-long
            ('DeadLetteringOnMessageExpiration', 'dead_lettering_on_message_expiration', _parse_bool),
            ('EnableBatchedOperations', 'enable_batched_operations', _parse_bool),
            ('MaxDeliveryCount', 'max_delivery_count', int),
            ('MessageCount', 'message_count', int),
        ]

        for mapping in mappings:
            _read_etree_element(subscription_element, mapping[0], subscription, mapping[1], mapping[2])

    for name, value in _ETreeXmlToObject.get_entry_properties_from_element(
            entry_element, True, '/subscriptions').items():
        setattr(subscription, name, value)

    return subscription
def _convert_etree_element_to_subscription(entry_element):
    '''Converts entry element to subscription

    The xml format for subscription:
<entry xmlns='http://www.w3.org/2005/Atom'>
    <content type='application/xml'>
    <SubscriptionDescription
        xmlns:i="http://www.w3.org/2001/XMLSchema-instance"
        xmlns="http://schemas.microsoft.com/netservices/2010/10/servicebus/connect">
        <LockDuration>PT5M</LockDuration>
        <RequiresSession>false</RequiresSession>
        <DefaultMessageTimeToLive>P10675199DT2H48M5.4775807S</DefaultMessageTimeToLive>
        <DeadLetteringOnMessageExpiration>false</DeadLetteringOnMessageExpiration>
        <DeadLetteringOnFilterEvaluationExceptions>true</DeadLetteringOnFilterEvaluationExceptions>
    </SubscriptionDescription>
    </content>
</entry>
    '''
    subscription = Subscription()

    subscription_element = entry_element.find('./atom:content/sb:SubscriptionDescription', _etree_sb_feed_namespaces)
    if subscription_element is not None:
        mappings = [
            ('LockDuration', 'lock_duration', None),
            ('RequiresSession', 'requires_session', _parse_bool),
            ('DefaultMessageTimeToLive', 'default_message_time_to_live', None),
            ('DeadLetteringOnFilterEvaluationExceptions', 'dead_lettering_on_filter_evaluation_exceptions', _parse_bool),  # pylint: disable=line-too-long
            ('DeadLetteringOnMessageExpiration', 'dead_lettering_on_message_expiration', _parse_bool),
            ('EnableBatchedOperations', 'enable_batched_operations', _parse_bool),
            ('MaxDeliveryCount', 'max_delivery_count', int),
            ('MessageCount', 'message_count', int),
        ]

        for mapping in mappings:
            _read_etree_element(subscription_element, mapping[0], subscription, mapping[1], mapping[2])

    for name, value in _ETreeXmlToObject.get_entry_properties_from_element(
            entry_element, True, '/subscriptions').items():
        setattr(subscription, name, value)

    return subscription
def _convert_etree_element_to_subscription ( entry_element ) : subscription = Subscription ( ) subscription_element = entry_element . find ( './atom:content/sb:SubscriptionDescription' , _etree_sb_feed_namespaces ) if subscription_element is not None : mappings = [ ( 'LockDuration' , 'lock_duration' , None ) , ( 'RequiresSession' , 'requires_session' , _parse_bool ) , ( 'DefaultMessageTimeToLive' , 'default_message_time_to_live' , None ) , ( 'DeadLetteringOnFilterEvaluationExceptions' , 'dead_lettering_on_filter_evaluation_exceptions' , _parse_bool ) , # pylint: disable=line-too-long ( 'DeadLetteringOnMessageExpiration' , 'dead_lettering_on_message_expiration' , _parse_bool ) , ( 'EnableBatchedOperations' , 'enable_batched_operations' , _parse_bool ) , ( 'MaxDeliveryCount' , 'max_delivery_count' , int ) , ( 'MessageCount' , 'message_count' , int ) , ] for mapping in mappings : _read_etree_element ( subscription_element , mapping [ 0 ] , subscription , mapping [ 1 ] , mapping [ 2 ] ) for name , value in _ETreeXmlToObject . get_entry_properties_from_element ( entry_element , True , '/subscriptions' ) . items ( ) : setattr ( subscription , name , value ) return subscription
Converts entry element to subscription

    The xml format for subscription:
<entry xmlns='http://www.w3.org/2005/Atom'>
    <content type='application/xml'>
    <SubscriptionDescription
        xmlns:i="http://www.w3.org/2001/XMLSchema-instance"
        xmlns="http://schemas.microsoft.com/netservices/2010/10/servicebus/connect">
        <LockDuration>PT5M</LockDuration>
        <RequiresSession>false</RequiresSession>
        <DefaultMessageTimeToLive>P10675199DT2H48M5.4775807S</DefaultMessageTimeToLive>
        <DeadLetteringOnMessageExpiration>false</DeadLetteringOnMessageExpiration>
        <DeadLetteringOnFilterEvaluationExceptions>true</DeadLetteringOnFilterEvaluationExceptions>
    </SubscriptionDescription>
    </content>
</entry>
Converts entry element to subscription