def from_dict(rsa_public_key_dict):
     if not rsa_public_key_dict:
         return None
     rsa_public_key_ = RSAPublicKey()
     rsa_public_key_.modulus = String.from_dict(rsa_public_key_dict.get('modulus'))
     rsa_public_key_.exponent = Integer.from_dict(rsa_public_key_dict.get('exponent'))
     return rsa_public_key_
    def from_dict(dns_record_dict):
        if not dns_record_dict:
            return None

        dns_record_ = DNSRecord()
        dns_record_.description = StructuredText.from_dict(dns_record_dict.get('description'))
        dns_record_.domain_name = URI.from_dict(dns_record_dict.get('domain_name'))
        dns_record_.ip_address = Address.from_dict(dns_record_dict.get('ip_address'))
        dns_record_.address_class = String.from_dict(dns_record_dict.get('address_class'))
        dns_record_.entry_type = String.from_dict(dns_record_dict.get('entry_type'))
        dns_record_.record_name = String.from_dict(dns_record_dict.get('record_name'))
        dns_record_.record_type = String.from_dict(dns_record_dict.get('record_type'))
        dns_record_.ttl = Integer.from_dict(dns_record_dict.get('record_type'))
        dns_record_.flags = HexBinary.from_dict(dns_record_dict.get('flags'))
        dns_record_.data_length = Integer.from_dict(dns_record_dict.get('data_length'))
        dns_record_.record_data = dns_record_dict.get('record_data')

        return dns_record_
    def from_dict(addr_dict, category=None):
        if not addr_dict:
            return None

        addr = Address()

        # Shortcut if only a string is passed as a parameter
        if not isinstance(addr_dict, dict):
            addr.address_value = String.from_dict(addr_dict)
            addr.category = category
            return addr

        ObjectProperties.from_dict(addr_dict, addr)

        addr.category = addr_dict.get('category')
        addr.is_destination = addr_dict.get('is_destination')
        addr.is_source = addr_dict.get('is_source')
        addr.address_value = String.from_dict(addr_dict.get('address_value'))
        addr.vlan_name = String.from_dict(addr_dict.get('vlan_name'))
        addr.vlan_num = Integer.from_dict(addr_dict.get('vlan_num'))

        return addr
Esempio n. 4
0
 def test_list_numerics(self):
     i = Integer([1, 2, 3])
     i2 = Integer.from_dict({'value': ['1', '2', '3']})
     self.assertEqual(i.to_dict(), i2.to_dict())
Esempio n. 5
0
 def test_list_numerics(self):
     i = Integer([1, 2, 3])
     i2 = Integer.from_dict({'value': ['1', '2', '3']})
     self.assertEqual(i.to_dict(), i2.to_dict())