code
string
signature
string
docstring
string
loss_without_docstring
float64
loss_with_docstring
float64
factor
float64
if custom_headers is None: custom_headers = {} api_client = client.ApiClient(cls._get_api_context()) endpoint_url = cls._ENDPOINT_URL_READ.format(cls._determine_user_id(), cls._determine_monetary_account_id( monetary_account_id), mastercard_action_id, note_text_master_card_action_id) response_raw = api_client.get(endpoint_url, {}, custom_headers) return BunqResponseNoteTextMasterCardAction.cast_from_bunq_response( cls._from_json(response_raw, cls._OBJECT_TYPE_GET) )
def get(cls, mastercard_action_id, note_text_master_card_action_id, monetary_account_id=None, custom_headers=None)
:type api_context: context.ApiContext :type user_id: int :type monetary_account_id: int :type mastercard_action_id: int :type note_text_master_card_action_id: int :type custom_headers: dict[str, str]|None :rtype: BunqResponseNoteTextMasterCardAction
2.438765
2.183136
1.117093
if custom_headers is None: custom_headers = {} api_client = client.ApiClient(cls._get_api_context()) endpoint_url = cls._ENDPOINT_URL_READ.format(cls._determine_user_id(), cls._determine_monetary_account_id( monetary_account_id), request_response_id, note_text_request_response_id) response_raw = api_client.get(endpoint_url, {}, custom_headers) return BunqResponseNoteTextRequestResponse.cast_from_bunq_response( cls._from_json(response_raw, cls._OBJECT_TYPE_GET) )
def get(cls, request_response_id, note_text_request_response_id, monetary_account_id=None, custom_headers=None)
:type api_context: context.ApiContext :type user_id: int :type monetary_account_id: int :type request_response_id: int :type note_text_request_response_id: int :type custom_headers: dict[str, str]|None :rtype: BunqResponseNoteTextRequestResponse
2.444859
2.18322
1.119841
if custom_headers is None: custom_headers = {} request_map = { cls.FIELD_DESCRIPTION: description, cls.FIELD_ATTACHMENT_ID: attachment_id } request_map_string = converter.class_to_json(request_map) request_map_string = cls._remove_field_for_request(request_map_string) api_client = client.ApiClient(cls._get_api_context()) request_bytes = request_map_string.encode() endpoint_url = cls._ENDPOINT_URL_CREATE.format(cls._determine_user_id(), cls._determine_monetary_account_id( monetary_account_id), schedule_id, schedule_instance_id) response_raw = api_client.post(endpoint_url, request_bytes, custom_headers) return BunqResponseInt.cast_from_bunq_response( cls._process_for_id(response_raw) )
def create(cls, schedule_id, schedule_instance_id, attachment_id, monetary_account_id=None, description=None, custom_headers=None)
:type user_id: int :type monetary_account_id: int :type schedule_id: int :type schedule_instance_id: int :param attachment_id: The reference to the uploaded file to attach to this note. :type attachment_id: int :param description: Optional description of the attachment. :type description: str :type custom_headers: dict[str, str]|None :rtype: BunqResponseInt
2.330215
1.883659
1.237068
if custom_headers is None: custom_headers = {} api_client = client.ApiClient(cls._get_api_context()) request_map = { cls.FIELD_DESCRIPTION: description } request_map_string = converter.class_to_json(request_map) request_map_string = cls._remove_field_for_request(request_map_string) request_bytes = request_map_string.encode() endpoint_url = cls._ENDPOINT_URL_UPDATE.format(cls._determine_user_id(), cls._determine_monetary_account_id( monetary_account_id), schedule_id, schedule_instance_id, note_attachment_schedule_instance_id) response_raw = api_client.put(endpoint_url, request_bytes, custom_headers) return BunqResponseInt.cast_from_bunq_response( cls._process_for_id(response_raw) )
def update(cls, schedule_id, schedule_instance_id, note_attachment_schedule_instance_id, monetary_account_id=None, description=None, custom_headers=None)
:type user_id: int :type monetary_account_id: int :type schedule_id: int :type schedule_instance_id: int :type note_attachment_schedule_instance_id: int :param description: Optional description of the attachment. :type description: str :type custom_headers: dict[str, str]|None :rtype: BunqResponseInt
2.575831
2.099064
1.227133
if custom_headers is None: custom_headers = {} api_client = client.ApiClient(cls._get_api_context()) endpoint_url = cls._ENDPOINT_URL_DELETE.format(cls._determine_user_id(), cls._determine_monetary_account_id( monetary_account_id), schedule_id, schedule_instance_id, note_attachment_schedule_instance_id) response_raw = api_client.delete(endpoint_url, custom_headers) return BunqResponseNone.cast_from_bunq_response( client.BunqResponse(None, response_raw.headers) )
def delete(cls, schedule_id, schedule_instance_id, note_attachment_schedule_instance_id, monetary_account_id=None, custom_headers=None)
:type user_id: int :type monetary_account_id: int :type schedule_id: int :type schedule_instance_id: int :type note_attachment_schedule_instance_id: int :type custom_headers: dict[str, str]|None :rtype: BunqResponseNone
2.589995
2.197052
1.17885
if custom_headers is None: custom_headers = {} api_client = client.ApiClient(cls._get_api_context()) endpoint_url = cls._ENDPOINT_URL_READ.format(cls._determine_user_id(), cls._determine_monetary_account_id( monetary_account_id), schedule_payment_batch_id, note_text_schedule_payment_batch_id) response_raw = api_client.get(endpoint_url, {}, custom_headers) return BunqResponseNoteTextSchedulePaymentBatch.cast_from_bunq_response( cls._from_json(response_raw, cls._OBJECT_TYPE_GET) )
def get(cls, schedule_payment_batch_id, note_text_schedule_payment_batch_id, monetary_account_id=None, custom_headers=None)
:type api_context: context.ApiContext :type user_id: int :type monetary_account_id: int :type schedule_payment_batch_id: int :type note_text_schedule_payment_batch_id: int :type custom_headers: dict[str, str]|None :rtype: BunqResponseNoteTextSchedulePaymentBatch
2.464952
2.189029
1.126048
if custom_headers is None: custom_headers = {} api_client = client.ApiClient(cls._get_api_context()) endpoint_url = cls._ENDPOINT_URL_READ.format(cls._determine_user_id(), cls._determine_monetary_account_id( monetary_account_id), whitelist_id, whitelist_result_id, note_text_whitelist_result_id) response_raw = api_client.get(endpoint_url, {}, custom_headers) return BunqResponseNoteTextWhitelistResult.cast_from_bunq_response( cls._from_json(response_raw, cls._OBJECT_TYPE_GET) )
def get(cls, whitelist_id, whitelist_result_id, note_text_whitelist_result_id, monetary_account_id=None, custom_headers=None)
:type api_context: context.ApiContext :type user_id: int :type monetary_account_id: int :type whitelist_id: int :type whitelist_result_id: int :type note_text_whitelist_result_id: int :type custom_headers: dict[str, str]|None :rtype: BunqResponseNoteTextWhitelistResult
2.336974
2.095983
1.114978
if params is None: params = {} if custom_headers is None: custom_headers = {} api_client = client.ApiClient(cls._get_api_context()) endpoint_url = cls._ENDPOINT_URL_LISTING response_raw = api_client.get(endpoint_url, params, custom_headers) return BunqResponseUserList.cast_from_bunq_response( cls._from_json_list(response_raw) )
def list(cls, params=None, custom_headers=None)
Get a collection of all available users. :type params: dict[str, str]|None :type custom_headers: dict[str, str]|None :rtype: BunqResponseUserList
3.077629
2.339492
1.315512
if self._UserLight is not None: return self._UserLight if self._UserPerson is not None: return self._UserPerson if self._UserCompany is not None: return self._UserCompany if self._UserApiKey is not None: return self._UserApiKey raise exception.BunqException(self._ERROR_NULL_FIELDS)
def get_referenced_object(self)
:rtype: core.BunqModel :raise: BunqException
4.484954
3.904083
1.148786
if self._UserLight is not None: return False if self._UserPerson is not None: return False if self._UserCompany is not None: return False if self._UserApiKey is not None: return False return True
def is_all_field_none(self)
:rtype: bool
4.338703
3.756019
1.155133
if self._id_ is not None: return False if self._created is not None: return False if self._updated is not None: return False if self._public_uuid is not None: return False if self._first_name is not None: return False if self._middle_name is not None: return False if self._last_name is not None: return False if self._legal_name is not None: return False if self._display_name is not None: return False if self._public_nick_name is not None: return False if self._alias is not None: return False if self._tax_resident is not None: return False if self._document_type is not None: return False if self._document_number is not None: return False if self._document_country_of_issuance is not None: return False if self._address_main is not None: return False if self._address_postal is not None: return False if self._date_of_birth is not None: return False if self._place_of_birth is not None: return False if self._country_of_birth is not None: return False if self._nationality is not None: return False if self._language is not None: return False if self._region is not None: return False if self._gender is not None: return False if self._avatar is not None: return False if self._version_terms_of_service is not None: return False if self._status is not None: return False if self._sub_status is not None: return False if self._session_timeout is not None: return False if self._daily_limit_without_confirmation_login is not None: return False if self._notification_filters is not None: return False return True
def is_all_field_none(self)
:rtype: bool
1.928416
1.891187
1.019686
if self._id_ is not None: return False if self._created is not None: return False if self._updated is not None: return False if self._public_uuid is not None: return False if self._name is not None: return False if self._display_name is not None: return False if self._public_nick_name is not None: return False if self._alias is not None: return False if self._chamber_of_commerce_number is not None: return False if self._legal_form is not None: return False if self._type_of_business_entity is not None: return False if self._sector_of_industry is not None: return False if self._counter_bank_iban is not None: return False if self._avatar is not None: return False if self._address_main is not None: return False if self._address_postal is not None: return False if self._version_terms_of_service is not None: return False if self._director_alias is not None: return False if self._language is not None: return False if self._country is not None: return False if self._region is not None: return False if self._ubo is not None: return False if self._status is not None: return False if self._sub_status is not None: return False if self._session_timeout is not None: return False if self._card_ids is not None: return False if self._card_limits is not None: return False if self._daily_limit_without_confirmation_login is not None: return False if self._notification_filters is not None: return False if self._customer is not None: return False if self._customer_limit is not None: return False if self._billing_contract is not None: return False return True
def is_all_field_none(self)
:rtype: bool
2.525226
2.461787
1.025769
if self._id_ is not None: return False if self._created is not None: return False if self._updated is not None: return False if self._billing_account_id is not None: return False if self._invoice_notification_preference is not None: return False return True
def is_all_field_none(self)
:rtype: bool
3.29491
2.916947
1.129575
if self._id_ is not None: return False if self._created is not None: return False if self._updated is not None: return False if self._requested_by_user is not None: return False if self._granted_by_user is not None: return False return True
def is_all_field_none(self)
:rtype: bool
2.975042
2.657555
1.119466
if params is None: params = {} if custom_headers is None: custom_headers = {} api_client = client.ApiClient(cls._get_api_context()) endpoint_url = cls._ENDPOINT_URL_LISTING.format( cls._determine_user_id()) response_raw = api_client.get(endpoint_url, params, custom_headers) return BunqResponseOauthClientList.cast_from_bunq_response( cls._from_json_list(response_raw, cls._OBJECT_TYPE_GET) )
def list(cls, params=None, custom_headers=None)
:type user_id: int :type params: dict[str, str]|None :type custom_headers: dict[str, str]|None :rtype: BunqResponseOauthClientList
3.255985
2.23516
1.456713
if self._status is not None: return False if self._client_id is not None: return False if self._secret is not None: return False if self._callback_url is not None: return False return True
def is_all_field_none(self)
:rtype: bool
3.139951
2.773288
1.132212
if custom_headers is None: custom_headers = {} api_client = client.ApiClient(cls._get_api_context()) endpoint_url = cls._ENDPOINT_URL_READ.format( payment_service_provider_credential_id) response_raw = api_client.get(endpoint_url, {}, custom_headers) return BunqResponsePaymentServiceProviderCredential.cast_from_bunq_response( cls._from_json(response_raw, cls._OBJECT_TYPE_GET) )
def get(cls, payment_service_provider_credential_id, custom_headers=None)
:type api_context: context.ApiContext :type payment_service_provider_credential_id: int :type custom_headers: dict[str, str]|None :rtype: BunqResponsePaymentServiceProviderCredential
3.261019
2.546466
1.280606
if custom_headers is None: custom_headers = {} request_map = { cls.FIELD_CLIENT_PAYMENT_SERVICE_PROVIDER_CERTIFICATE: client_payment_service_provider_certificate, cls.FIELD_CLIENT_PAYMENT_SERVICE_PROVIDER_CERTIFICATE_CHAIN: client_payment_service_provider_certificate_chain, cls.FIELD_CLIENT_PUBLIC_KEY_SIGNATURE: client_public_key_signature } request_map_string = converter.class_to_json(request_map) request_map_string = cls._remove_field_for_request(request_map_string) api_client = client.ApiClient(cls._get_api_context()) request_bytes = request_map_string.encode() endpoint_url = cls._ENDPOINT_URL_CREATE response_raw = api_client.post(endpoint_url, request_bytes, custom_headers) return BunqResponseInt.cast_from_bunq_response( cls._process_for_id(response_raw) )
def create(cls, client_payment_service_provider_certificate, client_payment_service_provider_certificate_chain, client_public_key_signature, custom_headers=None)
:param client_payment_service_provider_certificate: Payment Services Directive 2 compatible QSEAL certificate :type client_payment_service_provider_certificate: str :param client_payment_service_provider_certificate_chain: Intermediate and root certificate belonging to the provided certificate. :type client_payment_service_provider_certificate_chain: str :param client_public_key_signature: The Base64 encoded signature of the public key provided during installation and with the installation token appended as a nonce. Signed with the private key belonging to the QSEAL certificate. :type client_public_key_signature: str :type custom_headers: dict[str, str]|None :rtype: BunqResponseInt
1.976989
1.834466
1.077692
if self._id_ is not None: return False if self._created is not None: return False if self._updated is not None: return False if self._status is not None: return False if self._expiry_time is not None: return False if self._token_value is not None: return False if self._permitted_device is not None: return False return True
def is_all_field_none(self)
:rtype: bool
2.759105
2.499571
1.103831
if custom_headers is None: custom_headers = {} api_client = client.ApiClient(cls._get_api_context()) endpoint_url = cls._ENDPOINT_URL_READ.format(cls._determine_user_id(), credential_password_ip_id, permitted_ip_id) response_raw = api_client.get(endpoint_url, {}, custom_headers) return BunqResponsePermittedIp.cast_from_bunq_response( cls._from_json(response_raw, cls._OBJECT_TYPE_GET) )
def get(cls, credential_password_ip_id, permitted_ip_id, custom_headers=None)
:type api_context: context.ApiContext :type user_id: int :type credential_password_ip_id: int :type permitted_ip_id: int :type custom_headers: dict[str, str]|None :rtype: BunqResponsePermittedIp
2.861922
2.344191
1.220857
if custom_headers is None: custom_headers = {} request_map = { } request_map_string = converter.class_to_json(request_map) request_map_string = cls._remove_field_for_request(request_map_string) api_client = client.ApiClient(cls._get_api_context()) request_bytes = request_map_string.encode() endpoint_url = cls._ENDPOINT_URL_CREATE response_raw = api_client.post(endpoint_url, request_bytes, custom_headers) return BunqResponseSandboxUser.cast_from_bunq_response( cls._from_json(response_raw, cls._OBJECT_TYPE_POST) )
def create(cls, custom_headers=None)
:type custom_headers: dict[str, str]|None :rtype: BunqResponseSandboxUser
3.612307
2.445262
1.477268
if custom_headers is None: custom_headers = {} request_map = { cls.FIELD_DESCRIPTION: description, cls.FIELD_EAN_CODE: ean_code, cls.FIELD_AVATAR_ATTACHMENT_UUID: avatar_attachment_uuid, cls.FIELD_TAB_ATTACHMENT: tab_attachment, cls.FIELD_QUANTITY: quantity, cls.FIELD_AMOUNT: amount } request_map_string = converter.class_to_json(request_map) request_map_string = cls._remove_field_for_request(request_map_string) api_client = client.ApiClient(cls._get_api_context()) request_bytes = request_map_string.encode() endpoint_url = cls._ENDPOINT_URL_CREATE.format(cls._determine_user_id(), cls._determine_monetary_account_id( monetary_account_id), cash_register_id, tab_uuid) response_raw = api_client.post(endpoint_url, request_bytes, custom_headers) return BunqResponseInt.cast_from_bunq_response( cls._process_for_id(response_raw) )
def create(cls, cash_register_id, tab_uuid, description, monetary_account_id=None, ean_code=None, avatar_attachment_uuid=None, tab_attachment=None, quantity=None, amount=None, custom_headers=None)
Create a new TabItem for a given Tab. :type user_id: int :type monetary_account_id: int :type cash_register_id: int :type tab_uuid: str :param description: The TabItem's brief description. Can't be empty and must be no longer than 100 characters :type description: str :param ean_code: The TabItem's EAN code. :type ean_code: str :param avatar_attachment_uuid: An AttachmentPublic UUID that used as an avatar for the TabItem. :type avatar_attachment_uuid: str :param tab_attachment: A list of AttachmentTab attached to the TabItem. :type tab_attachment: list[int] :param quantity: The quantity of the TabItem. Formatted as a number containing up to 15 digits, up to 15 decimals and using a dot. :type quantity: str :param amount: The money amount of the TabItem. Will not change the value of the corresponding Tab. :type amount: object_.Amount :type custom_headers: dict[str, str]|None :rtype: BunqResponseInt
1.873979
1.673177
1.120012
if custom_headers is None: custom_headers = {} request_map = { cls.FIELD_TOKEN: token } request_map_string = converter.class_to_json(request_map) request_map_string = cls._remove_field_for_request(request_map_string) api_client = client.ApiClient(cls._get_api_context()) request_bytes = request_map_string.encode() endpoint_url = cls._ENDPOINT_URL_CREATE.format(cls._determine_user_id()) response_raw = api_client.post(endpoint_url, request_bytes, custom_headers) return BunqResponseTokenQrRequestIdeal.cast_from_bunq_response( cls._from_json(response_raw, cls._OBJECT_TYPE_POST) )
def create(cls, token, custom_headers=None)
Create a request from an ideal transaction. :type user_id: int :param token: The token passed from a site or read from a QR code. :type token: str :type custom_headers: dict[str, str]|None :rtype: BunqResponseTokenQrRequestIdeal
3.139509
2.163725
1.450974
if self._id_ is not None: return False if self._time_responded is not None: return False if self._time_expiry is not None: return False if self._monetary_account_id is not None: return False if self._amount_inquired is not None: return False if self._amount_responded is not None: return False if self._alias is not None: return False if self._counterparty_alias is not None: return False if self._description is not None: return False if self._attachment is not None: return False if self._status is not None: return False if self._minimum_age is not None: return False if self._require_address is not None: return False if self._address_shipping is not None: return False if self._address_billing is not None: return False if self._geolocation is not None: return False if self._redirect_url is not None: return False if self._type_ is not None: return False if self._sub_type is not None: return False if self._allow_chat is not None: return False if self._eligible_whitelist_id is not None: return False return True
def is_all_field_none(self)
:rtype: bool
2.37516
2.311698
1.027452
if custom_headers is None: custom_headers = {} request_map = { cls.FIELD_MONETARY_ACCOUNT_PAYING_ID: monetary_account_paying_id, cls.FIELD_REQUEST_ID: request_id, cls.FIELD_MAXIMUM_AMOUNT_PER_MONTH: maximum_amount_per_month } request_map_string = converter.class_to_json(request_map) request_map_string = cls._remove_field_for_request(request_map_string) api_client = client.ApiClient(cls._get_api_context()) request_bytes = request_map_string.encode() endpoint_url = cls._ENDPOINT_URL_CREATE.format(cls._determine_user_id()) response_raw = api_client.post(endpoint_url, request_bytes, custom_headers) return BunqResponseInt.cast_from_bunq_response( cls._process_for_id(response_raw) )
def create(cls, monetary_account_paying_id, request_id, maximum_amount_per_month, custom_headers=None)
Create a new SDD whitelist entry. :type user_id: int :param monetary_account_paying_id: ID of the monetary account of which you want to pay from. :type monetary_account_paying_id: int :param request_id: ID of the request for which you want to whitelist the originating SDD. :type request_id: int :param maximum_amount_per_month: The maximum amount of money that is allowed to be deducted based on the whitelist. :type maximum_amount_per_month: object_.Amount :type custom_headers: dict[str, str]|None :rtype: BunqResponseInt
2.042193
1.88702
1.082232
if custom_headers is None: custom_headers = {} api_client = client.ApiClient(cls._get_api_context()) request_map = { cls.FIELD_MONETARY_ACCOUNT_PAYING_ID: monetary_account_paying_id, cls.FIELD_MAXIMUM_AMOUNT_PER_MONTH: maximum_amount_per_month } request_map_string = converter.class_to_json(request_map) request_map_string = cls._remove_field_for_request(request_map_string) request_bytes = request_map_string.encode() endpoint_url = cls._ENDPOINT_URL_UPDATE.format(cls._determine_user_id(), whitelist_sdd_id) response_raw = api_client.put(endpoint_url, request_bytes, custom_headers) return BunqResponseInt.cast_from_bunq_response( cls._process_for_id(response_raw) )
def update(cls, whitelist_sdd_id, monetary_account_paying_id=None, maximum_amount_per_month=None, custom_headers=None)
:type user_id: int :type whitelist_sdd_id: int :param monetary_account_paying_id: ID of the monetary account of which you want to pay from. :type monetary_account_paying_id: int :param maximum_amount_per_month: The maximum amount of money that is allowed to be deducted based on the whitelist. :type maximum_amount_per_month: object_.Amount :type custom_headers: dict[str, str]|None :rtype: BunqResponseInt
2.177772
2.002555
1.087497
if self._id_ is not None: return False if self._monetary_account_incoming_id is not None: return False if self._monetary_account_paying_id is not None: return False if self._type_ is not None: return False if self._status is not None: return False if self._credit_scheme_identifier is not None: return False if self._mandate_identifier is not None: return False if self._counterparty_alias is not None: return False if self._maximum_amount_per_month is not None: return False if self._user_alias_created is not None: return False return True
def is_all_field_none(self)
:rtype: bool
3.189333
3.023252
1.054934
obj_raw = json.loads(json_str) return deserialize(cls, obj_raw)
def json_to_class(cls, json_str)
:type cls: T|type :type json_str: str :rtype: T
6.244111
6.167827
1.012368
obj_raw = serialize(obj) return json.dumps(obj_raw, indent=_JSON_INDENT, sort_keys=True)
def class_to_json(obj)
:type obj: int|str|bool|float|bytes|unicode|list|dict|object :rtype: int|str|bool|list|dict
5.93344
7.169732
0.827568
class_name = target_class.__name__ if adapter.can_serialize(): cls._custom_serializers[class_name] = adapter if adapter.can_deserialize(): cls._custom_deserializers[class_name] = adapter
def register_custom_adapter(cls, target_class, adapter)
:type target_class: type :type adapter: JsonAdapter|type :rtype: None
2.816209
2.734447
1.029901
if cls_for.__name__ in cls._custom_serializers: return cls._custom_serializers[cls_for.__name__] return JsonAdapter
def _get_serializer(cls, cls_for)
:type cls_for: type :rtype: JsonAdapter
5.811713
3.116014
1.865111
if cls_for.__name__ in cls._custom_deserializers: return cls._custom_deserializers[cls_for.__name__] return JsonAdapter
def _get_deserializer(cls, cls_for)
:type cls_for: type :rtype: JsonAdapter
4.972003
2.867456
1.733942
cls._initialize() deserializer = cls._get_deserializer(cls_target) if deserializer == cls: return cls._deserialize_default(cls_target, obj_raw) else: return deserializer.deserialize(cls_target, obj_raw)
def deserialize(cls, cls_target, obj_raw)
:type cls_target: T|type :type obj_raw: int|str|bool|float|list|dict|None :rtype: T
2.838456
3.138048
0.904529
if cls._is_deserialized(cls_target, obj_raw): return obj_raw elif type(obj_raw) == dict: return cls._deserialize_dict(cls_target, obj_raw) else: return cls_target(obj_raw)
def _deserialize_default(cls, cls_target, obj_raw)
:type cls_target: T|type :type obj_raw: int|str|bool|float|list|dict|None :rtype: T
2.825645
2.536557
1.113969
if cls_target is None: return True if cls_target in {list, dict}: return True if cls._is_bytes_type(cls_target): return True if obj is None: return True if type(obj) in {list, cls_target}: return True return False
def _is_deserialized(cls, cls_target, obj)
:type cls_target: type :type obj: int|str|bool|float|bytes|unicode|list|dict|object :rtype: bool
3.752925
3.131654
1.198384
instance = cls_target.__new__(cls_target) dict_deserialized = cls._deserialize_dict_attributes(cls_target, dict_) instance.__dict__ = cls._fill_default_values(cls_target, dict_deserialized) return instance
def _deserialize_dict(cls, cls_target, dict_)
:type cls_target: T|type :type dict_: dict :rtype: T
3.995849
3.783918
1.056008
dict_deserialized = {} for key in dict_.keys(): key_deserialized = cls._deserialize_key(key) value_specs = cls._get_value_specs(cls_context, key_deserialized) if value_specs is not None: dict_deserialized[value_specs.name] = cls._deserialize_value( value_specs.types, dict_[key] ) else: cls._warn_key_unknown(cls_context, key) return dict_deserialized
def _deserialize_dict_attributes(cls, cls_context, dict_)
:type cls_context: type :type dict_: dict :rtype: dict
3.031188
3.025145
1.001998
if key in cls._KEYS_OVERLAPPING: return key + cls._SUFFIX_KEY_OVERLAPPING return key
def _deserialize_key(cls, key)
:type key: str :rtype: str
11.069263
8.883942
1.245986
if cls_in in {dict, list}: return ValueSpecs(None, ValueTypes(None, None)) else: return cls._fetch_attribute_specs_from_doc(cls_in, attribute_name)
def _get_value_specs(cls, cls_in, attribute_name)
:type cls_in: type :type attribute_name: str :rtype: ValueSpecs
6.609991
5.492615
1.203432
pattern = cls._TEMPLATE_PATTERN_PARAM_TYPES.format(attribute_name) match = re.search(pattern, cls_in.__doc__) if match is not None: return ValueSpecs( cls._fetch_name(match), ValueTypes( cls._fetch_type_main(cls_in, match), cls._fetch_type_sub(cls_in, match) ) ) else: return None
def _fetch_attribute_specs_from_doc(cls, cls_in, attribute_name)
:type cls_in: type :type attribute_name: str :rtype: ValueSpecs
4.173868
3.560989
1.172109
return cls._str_to_type( cls_in, match.group(cls._SUBMATCH_INDEX_TYPE_MAIN) )
def _fetch_type_main(cls, cls_in, match)
:type cls_in: type :type match: _sre.SRE_Match :rtype: type
7.93107
6.55858
1.209266
if match.group(cls._SUBMATCH_INDEX_TYPE_SUB): return cls._str_to_type( cls_in, match.group(cls._SUBMATCH_INDEX_TYPE_SUB) ) else: return None
def _fetch_type_sub(cls, cls_in, match)
:type cls_in: type :type match: _sre.SRE_Match :rtype: type
4.010496
3.44043
1.165696
if string in cls._TYPE_NAMES_BUILTIN: return eval(string) module_ = sys.modules[context_class.__module__] if hasattr(module_, string): return getattr(module_, string) return cls._str_to_type_from_member_module(module_, string)
def _str_to_type(cls, context_class, string)
:type context_class: type :type string: str :rtype: type
4.437289
4.264662
1.040478
module_name_short, class_name = string.split(cls._DELIMITER_MODULE) members = inspect.getmembers(module_, inspect.ismodule) for name, module_member in members: if module_name_short == name: return getattr(module_member, class_name) error_message = cls._ERROR_COULD_NOT_FIND_CLASS.format(string) raise exception.BunqException(error_message)
def _str_to_type_from_member_module(cls, module_, string)
:type module_: module :type string: str :rtype: type :raise: BunqException when could not find the class for the string.
4.131981
3.441859
1.200509
if types.main == list and value is not None: return cls._deserialize_list(types.sub, value) else: return cls.deserialize(types.main, value)
def _deserialize_value(cls, types, value)
:type types: ValueTypes :type value: int|str|bool|float|bytes|unicode|list|dict :rtype: int|str|bool|float|bytes|unicode|list|dict|object
5.069515
4.372909
1.159301
list_deserialized = [] for item in list_: item_deserialized = cls.deserialize(type_item, item) list_deserialized.append(item_deserialized) return list_deserialized
def _deserialize_list(cls, type_item, list_)
:type type_item: T|type :type list_: list :rtype: list[T]
2.309011
2.227703
1.036499
context_name = cls_context.__name__ warnings.warn(cls._WARNING_KEY_UNKNOWN.format(key, context_name))
def _warn_key_unknown(cls, cls_context, key)
:type cls_context: type :type key: str :rtype: None
5.631388
5.584103
1.008468
dict_with_default_values = dict(dict_) params = re.findall(cls._PATTERN_PARAM_NAME_TYPED_ANY, cls_context.__doc__) for param in params: if param not in dict_with_default_values: dict_with_default_values[param] = None return dict_with_default_values
def _fill_default_values(cls, cls_context, dict_)
:type cls_context: type :type dict_: dict :rtype: dict
3.914721
3.947108
0.991795
cls._initialize() serializer = cls._get_serializer(type(obj)) if serializer == cls: return cls._serialize_default(obj) else: return serializer.serialize(obj)
def serialize(cls, obj)
:type obj: int|str|bool|float|bytes|unicode|list|dict|object :rtype: int|str|bool|list|dict
4.34188
4.413271
0.983824
if obj is None or cls._is_primitive(obj): return obj elif cls._is_bytes(obj): return obj.decode() elif type(obj) == list: return cls._serialize_list(obj) else: dict_ = cls._get_obj_raw(obj) return cls._serialize_dict(dict_)
def _serialize_default(cls, obj)
:type obj: int|str|bool|float|bytes|unicode|list|dict|object :rtype: int|str|bool|list|dict
3.85331
3.388944
1.137024
list_serialized = [] for item in list_: item_serialized = cls.serialize(item) list_serialized.append(item_serialized) return list_serialized
def _serialize_list(cls, list_)
:type list_: list :rtype: list
2.945341
2.715031
1.084828
obj_serialized = {} for key in dict_.keys(): item_serialized = cls.serialize(dict_[key]) if item_serialized is not None: key = key.rstrip(cls._SUFFIX_KEY_OVERLAPPING) key = key.lstrip(cls._PREFIX_KEY_PROTECTED) obj_serialized[key] = item_serialized return obj_serialized
def _serialize_dict(cls, dict_)
:type dict_ dict :rtype: dict
3.835573
3.804259
1.008231
error_message = cls._generate_message_error( response_code, messages, response_id ) if response_code == cls._HTTP_RESPONSE_CODE_BAD_REQUEST: return BadRequestException( error_message, response_code, response_id ) if response_code == cls._HTTP_RESPONSE_CODE_UNAUTHORIZED: return UnauthorizedException( error_message, response_code, response_id ) if response_code == cls._HTTP_RESPONSE_CODE_FORBIDDEN: return ForbiddenException( error_message, response_code, response_id ) if response_code == cls._HTTP_RESPONSE_CODE_NOT_FOUND: return NotFoundException( error_message, response_code, response_id ) if response_code == cls._HTTP_RESPONSE_CODE_METHOD_NOT_ALLOWED: return MethodNotAllowedException( error_message, response_code, response_id ) if response_code == cls._HTTP_RESPONSE_CODE_TOO_MANY_REQUESTS: return TooManyRequestsException( error_message, response_code, response_id ) if response_code == cls._HTTP_RESPONSE_CODE_INTERNAL_SERVER_ERROR: return PleaseContactBunqException( error_message, response_code, response_id ) return UnknownApiErrorException( error_message, response_code, response_id )
def create_exception_for_response( cls, response_code, messages, response_id )
:type response_code: int :type messages: list[str] :type response_id: str :return: The exception according to the status code. :rtype: ApiException
1.476336
1.464556
1.008044
line_response_code = cls._FORMAT_RESPONSE_CODE_LINE \ .format(response_code) line_response_id = cls._FORMAT_RESPONSE_ID_LINE.format(response_id) line_error_message = cls._FORMAT_ERROR_MESSAGE_LINE.format( cls._GLUE_ERROR_MESSAGE_STRING_EMPTY.join(messages) ) return cls._glue_all_error_message( [line_response_code, line_response_id, line_error_message] )
def _generate_message_error(cls, response_code, messages, response_id)
:type response_code: int :type messages: list[str] :type response_id: str :rtype: str
3.285167
3.264654
1.006283
if self._type_ is not None: return False if self._type_description is not None: return False if self._type_description_translated is not None: return False if self._instance_description is not None: return False if self._product_vat_exclusive is not None: return False if self._product_vat_inclusive is not None: return False if self._item is not None: return False return True
def is_all_field_none(self)
:rtype: bool
3.308282
2.994756
1.104692
if self._billing_date is not None: return False if self._type_description is not None: return False if self._type_description_translated is not None: return False if self._unit_vat_exclusive is not None: return False if self._unit_vat_inclusive is not None: return False if self._vat is not None: return False if self._quantity is not None: return False if self._total_vat_exclusive is not None: return False if self._total_vat_inclusive is not None: return False return True
def is_all_field_none(self)
:rtype: bool
2.397599
2.263174
1.059396
if self._iban is not None: return False if self._display_name is not None: return False if self._avatar is not None: return False if self._label_user is not None: return False if self._country is not None: return False if self._bunq_me is not None: return False if self._is_light is not None: return False if self._swift_bic is not None: return False if self._swift_account_number is not None: return False if self._transferwise_account_number is not None: return False if self._transferwise_bank_code is not None: return False return True
def is_all_field_none(self)
:rtype: bool
2.732785
2.592021
1.054307
if self._uuid is not None: return False if self._anchor_uuid is not None: return False if self._image is not None: return False return True
def is_all_field_none(self)
:rtype: bool
4.65856
3.853966
1.20877
if self._attachment_public_uuid is not None: return False if self._content_type is not None: return False if self._height is not None: return False if self._width is not None: return False return True
def is_all_field_none(self)
:rtype: bool
3.881675
3.243375
1.196801
if self._uuid is not None: return False if self._avatar is not None: return False if self._public_nick_name is not None: return False if self._display_name is not None: return False if self._country is not None: return False return True
def is_all_field_none(self)
:rtype: bool
3.35868
2.950246
1.13844
if self._type_ is not None: return False if self._value is not None: return False if self._name is not None: return False return True
def is_all_field_none(self)
:rtype: bool
3.870435
2.997035
1.291421
if self._street is not None: return False if self._house_number is not None: return False if self._po_box is not None: return False if self._postal_code is not None: return False if self._city is not None: return False if self._country is not None: return False if self._province is not None: return False return True
def is_all_field_none(self)
:rtype: bool
2.004593
1.82119
1.100705
if self._latitude is not None: return False if self._longitude is not None: return False if self._altitude is not None: return False if self._radius is not None: return False return True
def is_all_field_none(self)
:rtype: bool
2.76103
2.367274
1.166333
if self._uuid is not None: return False if self._description is not None: return False if self._content_type is not None: return False return True
def is_all_field_none(self)
:rtype: bool
3.875186
3.224248
1.201888
if self._id_ is not None: return False if self._daily_limit is not None: return False if self._currency is not None: return False if self._type_ is not None: return False return True
def is_all_field_none(self)
:rtype: bool
3.884675
3.252188
1.19448
if self._id_ is not None: return False if self._country is not None: return False if self._expiry_time is not None: return False return True
def is_all_field_none(self)
:rtype: bool
4.707621
3.73041
1.261958
if self._id_ is not None: return False if self._uuid is not None: return False if self._description is not None: return False if self._status is not None: return False if self._monetary_account_id is not None: return False if self._four_digit is not None: return False return True
def is_all_field_none(self)
:rtype: bool
3.337229
2.989229
1.116418
if self._notification_delivery_method is not None: return False if self._notification_target is not None: return False if self._category is not None: return False return True
def is_all_field_none(self)
:rtype: bool
4.977707
4.155823
1.197767
if self._cash_register_qr_code is not None: return False if self._tab_qr_code is not None: return False if self._location is not None: return False return True
def is_all_field_none(self)
:rtype: bool
6.006432
4.931373
1.218004
if self._id_ is not None: return False if self._description is not None: return False if self._content_type is not None: return False return True
def is_all_field_none(self)
:rtype: bool
3.810972
3.109388
1.225634
if self._id_ is not None: return False if self._amount is not None: return False if self._alias is not None: return False if self._counterparty_alias is not None: return False if self._description is not None: return False if self._merchant_reference is not None: return False if self._type_ is not None: return False if self._attachment is not None: return False return True
def is_all_field_none(self)
:rtype: bool
2.510335
2.279812
1.101115
if self._Payment is not None: return self._Payment if self._PaymentBatch is not None: return self._PaymentBatch raise exception.BunqException(self._ERROR_NULL_FIELDS)
def get_referenced_object(self)
:rtype: core.BunqModel :raise: BunqException
8.717702
6.170355
1.412836
if self._share_detail is not None: return False if self._start_date is not None: return False if self._end_date is not None: return False return True
def is_all_field_none(self)
:rtype: bool
3.988024
3.334897
1.195846
if self._payment is not None: return False if self._read_only is not None: return False if self._draft_payment is not None: return False return True
def is_all_field_none(self)
:rtype: bool
5.343293
4.515712
1.183267
if self._view_balance is not None: return False if self._view_old_events is not None: return False if self._view_new_events is not None: return False return True
def is_all_field_none(self)
:rtype: bool
4.843542
3.986055
1.215122
if self._BunqMeTab is not None: return self._BunqMeTab if self._BunqMeTabResultResponse is not None: return self._BunqMeTabResultResponse if self._BunqMeFundraiserResult is not None: return self._BunqMeFundraiserResult if self._Card is not None: return self._Card if self._CardDebit is not None: return self._CardDebit if self._DraftPayment is not None: return self._DraftPayment if self._FeatureAnnouncement is not None: return self._FeatureAnnouncement if self._IdealMerchantTransaction is not None: return self._IdealMerchantTransaction if self._Invoice is not None: return self._Invoice if self._ScheduledPayment is not None: return self._ScheduledPayment if self._ScheduledPaymentBatch is not None: return self._ScheduledPaymentBatch if self._ScheduledInstance is not None: return self._ScheduledInstance if self._MasterCardAction is not None: return self._MasterCardAction if self._BankSwitchServiceNetherlandsIncomingPayment is not None: return self._BankSwitchServiceNetherlandsIncomingPayment if self._Payment is not None: return self._Payment if self._PaymentBatch is not None: return self._PaymentBatch if self._RequestInquiryBatch is not None: return self._RequestInquiryBatch if self._RequestInquiry is not None: return self._RequestInquiry if self._RequestResponse is not None: return self._RequestResponse if self._RewardRecipient is not None: return self._RewardRecipient if self._RewardSender is not None: return self._RewardSender if self._ShareInviteBankInquiryBatch is not None: return self._ShareInviteBankInquiryBatch if self._ShareInviteBankInquiry is not None: return self._ShareInviteBankInquiry if self._ShareInviteBankResponse is not None: return self._ShareInviteBankResponse if self._SofortMerchantTransaction is not None: return self._SofortMerchantTransaction if self._TabResultInquiry is not None: return self._TabResultInquiry if self._TabResultResponse is not None: return self._TabResultResponse if self._TransferwiseTransfer is not None: return self._TransferwiseTransfer raise exception.BunqException(self._ERROR_NULL_FIELDS)
def get_referenced_object(self)
:rtype: core.BunqModel :raise: BunqException
2.204162
2.191734
1.00567
if self._BunqMeTab is not None: return False if self._BunqMeTabResultResponse is not None: return False if self._BunqMeFundraiserResult is not None: return False if self._Card is not None: return False if self._CardDebit is not None: return False if self._DraftPayment is not None: return False if self._FeatureAnnouncement is not None: return False if self._IdealMerchantTransaction is not None: return False if self._Invoice is not None: return False if self._ScheduledPayment is not None: return False if self._ScheduledPaymentBatch is not None: return False if self._ScheduledInstance is not None: return False if self._MasterCardAction is not None: return False if self._BankSwitchServiceNetherlandsIncomingPayment is not None: return False if self._Payment is not None: return False if self._PaymentBatch is not None: return False if self._RequestInquiryBatch is not None: return False if self._RequestInquiry is not None: return False if self._RequestResponse is not None: return False if self._RewardRecipient is not None: return False if self._RewardSender is not None: return False if self._ShareInviteBankInquiryBatch is not None: return False if self._ShareInviteBankInquiry is not None: return False if self._ShareInviteBankResponse is not None: return False if self._SofortMerchantTransaction is not None: return False if self._TabResultInquiry is not None: return False if self._TabResultResponse is not None: return False if self._TransferwiseTransfer is not None: return False return True
def is_all_field_none(self)
:rtype: bool
2.700287
2.623226
1.029377
if self._uuid is not None: return False if self._type_ is not None: return False if self._second_line is not None: return False if self._expiry_date is not None: return False if self._status is not None: return False if self._label_user is not None: return False return True
def is_all_field_none(self)
:rtype: bool
3.332579
3.02918
1.100159
if self._BillingInvoice is not None: return self._BillingInvoice if self._DraftPayment is not None: return self._DraftPayment if self._MasterCardAction is not None: return self._MasterCardAction if self._Payment is not None: return self._Payment if self._PaymentBatch is not None: return self._PaymentBatch if self._RequestResponse is not None: return self._RequestResponse if self._ScheduleInstance is not None: return self._ScheduleInstance if self._TabResultResponse is not None: return self._TabResultResponse if self._WhitelistResult is not None: return self._WhitelistResult raise exception.BunqException(self._ERROR_NULL_FIELDS)
def get_referenced_object(self)
:rtype: core.BunqModel :raise: BunqException
3.603787
3.079737
1.170161
if self._BillingInvoice is not None: return False if self._DraftPayment is not None: return False if self._MasterCardAction is not None: return False if self._Payment is not None: return False if self._PaymentBatch is not None: return False if self._RequestResponse is not None: return False if self._ScheduleInstance is not None: return False if self._TabResultResponse is not None: return False if self._WhitelistResult is not None: return False return True
def is_all_field_none(self)
:rtype: bool
3.811346
3.588232
1.062179
if self._id_ is not None: return False if self._requestResponse is not None: return False if self._draftPayment is not None: return False return True
def is_all_field_none(self)
:rtype: bool
6.507406
5.309038
1.225722
if self._status is not None: return False if self._balance_preferred is not None: return False if self._balance_threshold_low is not None: return False if self._method_fill is not None: return False if self._issuer is not None: return False return True
def is_all_field_none(self)
:rtype: bool
4.758726
4.322963
1.100802
if self._status is not None: return False if self._balance_preferred is not None: return False if self._balance_threshold_high is not None: return False if self._savings_account_alias is not None: return False return True
def is_all_field_none(self)
:rtype: bool
5.102877
4.609335
1.107074
if self._color is not None: return False if self._default_avatar_status is not None: return False if self._restriction_chat is not None: return False return True
def is_all_field_none(self)
:rtype: bool
6.509602
5.116484
1.27228
if self._target_url is not None: return False if self._category is not None: return False if self._event_type is not None: return False if self._object_ is not None: return False return True
def is_all_field_none(self)
:rtype: bool
4.386141
3.597568
1.219196
if self._BunqMeFundraiserResult is not None: return self._BunqMeFundraiserResult if self._BunqMeTab is not None: return self._BunqMeTab if self._BunqMeTabResultInquiry is not None: return self._BunqMeTabResultInquiry if self._BunqMeTabResultResponse is not None: return self._BunqMeTabResultResponse if self._ChatMessage is not None: return self._ChatMessage if self._DraftPayment is not None: return self._DraftPayment if self._IdealMerchantTransaction is not None: return self._IdealMerchantTransaction if self._Invoice is not None: return self._Invoice if self._MasterCardAction is not None: return self._MasterCardAction if self._MonetaryAccount is not None: return self._MonetaryAccount if self._Payment is not None: return self._Payment if self._PaymentBatch is not None: return self._PaymentBatch if self._RequestInquiry is not None: return self._RequestInquiry if self._RequestInquiryBatch is not None: return self._RequestInquiryBatch if self._RequestResponse is not None: return self._RequestResponse if self._ShareInviteBankInquiry is not None: return self._ShareInviteBankInquiry if self._ShareInviteBankResponse is not None: return self._ShareInviteBankResponse if self._ScheduledPayment is not None: return self._ScheduledPayment if self._ScheduledInstance is not None: return self._ScheduledInstance if self._TabResultInquiry is not None: return self._TabResultInquiry if self._TabResultResponse is not None: return self._TabResultResponse if self._User is not None: return self._User raise exception.BunqException(self._ERROR_NULL_FIELDS)
def get_referenced_object(self)
:rtype: core.BunqModel :raise: BunqException
1.993142
1.945829
1.024316
if self._BunqMeFundraiserResult is not None: return False if self._BunqMeTab is not None: return False if self._BunqMeTabResultInquiry is not None: return False if self._BunqMeTabResultResponse is not None: return False if self._ChatMessage is not None: return False if self._DraftPayment is not None: return False if self._IdealMerchantTransaction is not None: return False if self._Invoice is not None: return False if self._MasterCardAction is not None: return False if self._MonetaryAccount is not None: return False if self._Payment is not None: return False if self._PaymentBatch is not None: return False if self._RequestInquiry is not None: return False if self._RequestInquiryBatch is not None: return False if self._RequestResponse is not None: return False if self._ShareInviteBankInquiry is not None: return False if self._ShareInviteBankResponse is not None: return False if self._ScheduledPayment is not None: return False if self._ScheduledInstance is not None: return False if self._TabResultInquiry is not None: return False if self._TabResultResponse is not None: return False if self._User is not None: return False return True
def is_all_field_none(self)
:rtype: bool
2.319745
2.230906
1.039822
if self._country is not None: return False if self._tax_number is not None: return False if self._status is not None: return False return True
def is_all_field_none(self)
:rtype: bool
4.292111
3.416424
1.256317
if self._name is not None: return False if self._date_of_birth is not None: return False if self._nationality is not None: return False return True
def is_all_field_none(self)
:rtype: bool
3.472907
2.761492
1.257619
if self._UserPerson is not None: return self._UserPerson if self._UserCompany is not None: return self._UserCompany raise exception.BunqException(self._ERROR_NULL_FIELDS)
def get_referenced_object(self)
:rtype: core.BunqModel :raise: BunqException
7.751822
6.111651
1.268368
instance = cls.__new__(cls) instance.pointer = pointer instance.label_monetary_account = LabelMonetaryAccount() instance.label_monetary_account._iban = pointer.value instance.label_monetary_account._display_name = pointer.name return instance
def create_from_pointer(cls, pointer)
:type pointer: Pointer
5.370042
5.202442
1.032216
instance = cls.__new__(cls) instance.label_monetary_account = label_monetary_account instance.pointer = Pointer() instance.pointer._name = label_monetary_account.display_name instance.pointer._type_ = cls._POINTER_TYPE_IBAN instance.pointer._value = label_monetary_account.iban return instance
def create_from_label_monetary_account(cls, label_monetary_account)
:type label_monetary_account: LabelMonetaryAccount
3.62098
3.7775
0.958565
model_ = super()._deserialize_default(cls_target, obj_raw) if isinstance( model_, core.AnchoredObjectInterface ) and model_.is_all_field_none(): for field in model_.__dict__: object_class = cls._get_object_class(field) contents = super()._deserialize_default(object_class, obj_raw) if contents.is_all_field_none(): setattr(model_, field, None) else: setattr(model_, field, contents) return model_
def deserialize(cls, cls_target, obj_raw)
:type cls_target: core.BunqModel :type obj_raw: int|str|bool|float|list|dict|None :rtype: T
4.105564
3.658998
1.122046
class_name = class_name.lstrip(cls.__STRING_FORMAT_UNDERSCORE) if class_name in cls._override_field_map: class_name = cls._override_field_map[class_name] try: return getattr(endpoint, class_name) except AttributeError: pass try: return getattr(object_, class_name) except AttributeError: pass raise BunqException(cls._ERROR_MODEL_NOT_FOUND.format(class_name))
def _get_object_class(cls, class_name)
:type class_name: str :rtype: core.BunqModel
3.924731
3.470109
1.131011
installation = target_class.__new__(target_class) server_public_key_wrapped = array[cls._INDEX_SERVER_PUBLIC_KEY] installation.__dict__ = { cls._ATTRIBUTE_ID: converter.deserialize( core.Id, array[cls._INDEX_ID][cls._FIELD_ID] ), cls._ATTRIBUTE_TOKEN: converter.deserialize( core.SessionToken, array[cls._INDEX_TOKEN][cls._FIELD_TOKEN] ), cls._ATTRIBUTE_SERVER_PUBLIC_KEY: converter.deserialize( core.PublicKeyServer, server_public_key_wrapped[cls._FIELD_SERVER_PUBLIC_KEY] ), } return installation
def deserialize(cls, target_class, array)
:type target_class: core.Installation|type :type array: list :rtype: core.Installation
3.685097
3.229004
1.141249
return [ {cls._FIELD_ID: converter.serialize(installation.id_)}, {cls._FIELD_TOKEN: converter.serialize(installation.token)}, { cls._FIELD_SERVER_PUBLIC_KEY: converter.serialize( installation.server_public_key ), }, ]
def serialize(cls, installation)
:type installation: core.Installation :rtype: list
4.484928
4.284356
1.046815
session_server = target_class.__new__(target_class) session_server.__dict__ = { cls._ATTRIBUTE_ID: converter.deserialize( core.Id, array[cls._INDEX_ID][cls._FIELD_ID] ), cls._ATTRIBUTE_TOKEN: converter.deserialize( core.SessionToken, array[cls._INDEX_TOKEN][cls._FIELD_TOKEN] ), cls._ATTRIBUTE_USER_COMPANY: None, cls._ATTRIBUTE_USER_PERSON: None, } user_dict_wrapped = array[cls._INDEX_USER] if cls._FIELD_USER_COMPANY in user_dict_wrapped: session_server.__dict__[cls._ATTRIBUTE_USER_COMPANY] = \ converter.deserialize( endpoint.UserCompany, user_dict_wrapped[cls._FIELD_USER_COMPANY] ) elif cls._FIELD_USER_PERSON in user_dict_wrapped: session_server.__dict__[cls._ATTRIBUTE_USER_PERSON] = \ converter.deserialize( endpoint.UserPerson, user_dict_wrapped[cls._FIELD_USER_PERSON] ) elif cls._FIELD_USER_API_KEY in user_dict_wrapped: session_server.__dict__[cls._ATTRIBUTE_USER_API_KEY] = \ converter.deserialize( endpoint.UserApiKey, user_dict_wrapped[cls._FIELD_USER_API_KEY] ) else: raise BunqException(cls._ERROR_COULD_NOT_DETERMINE_USER) return session_server
def deserialize(cls, target_class, array)
:type target_class: core.SessionServer|type :type array: list :rtype: core.SessionServer
2.266626
2.134185
1.062057
return [ {cls._FIELD_ID: converter.serialize(session_server.id_)}, {cls._FIELD_TOKEN: converter.serialize(session_server.token)}, { cls._FIELD_USER_COMPANY: converter.serialize(session_server.user_company), }, { cls._FIELD_USER_PERSON: converter.serialize(session_server.user_person), }, { cls._FIELD_USER_API_KEY: converter.serialize(session_server.user_api_key), }, ]
def serialize(cls, session_server)
:type session_server: core.SessionServer :rtype: list
2.594691
2.600445
0.997788
installation_context = target_class.__new__(target_class) private_key_client = security.rsa_key_from_string( obj[cls._FIELD_PRIVATE_KEY_CLIENT] ) public_key_client = security.rsa_key_from_string( obj[cls._FIELD_PUBLIC_KEY_CLIENT] ) public_key_server = security.rsa_key_from_string( obj[cls._FIELD_PUBLIC_KEY_SERVER] ) installation_context.__dict__ = { cls._ATTRIBUTE_TOKEN: obj[cls._FIELD_TOKEN], cls._ATTRIBUTE_PRIVATE_KEY_CLIENT: private_key_client, cls._ATTRIBUTE_PUBLIC_KEY_CLIENT: public_key_client, cls._ATTRIBUTE_PUBLIC_KEY_SERVER: public_key_server, } return installation_context
def deserialize(cls, target_class, obj)
:type target_class: context.InstallationContext|type :type obj: dict :rtype: context.InstallationContext
2.22612
2.077935
1.071314
return { cls._FIELD_TOKEN: installation_context.token, cls._FIELD_PUBLIC_KEY_CLIENT: security.public_key_to_string( installation_context.private_key_client.publickey() ), cls._FIELD_PRIVATE_KEY_CLIENT: security.private_key_to_string( installation_context.private_key_client ), cls._FIELD_PUBLIC_KEY_SERVER: security.public_key_to_string( installation_context.public_key_server ), }
def serialize(cls, installation_context)
:type installation_context: context.InstallationContext :rtype: dict
2.483279
2.350913
1.056304