本文整理汇总了Python中twilio.base.deserialize.decimal函数的典型用法代码示例。如果您正苦于以下问题:Python decimal函数的具体用法?Python decimal怎么用?Python decimal使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了decimal函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, version, payload, account_sid, country_code):
"""
Initialize the VoipInstance
:returns: twilio.rest.api.v2010.account.available_phone_number.voip.VoipInstance
:rtype: twilio.rest.api.v2010.account.available_phone_number.voip.VoipInstance
"""
super(VoipInstance, self).__init__(version)
# Marshaled Properties
self._properties = {
'friendly_name': payload['friendly_name'],
'phone_number': payload['phone_number'],
'lata': payload['lata'],
'locality': payload['locality'],
'rate_center': payload['rate_center'],
'latitude': deserialize.decimal(payload['latitude']),
'longitude': deserialize.decimal(payload['longitude']),
'region': payload['region'],
'postal_code': payload['postal_code'],
'iso_country': payload['iso_country'],
'address_requirements': payload['address_requirements'],
'beta': payload['beta'],
'capabilities': payload['capabilities'],
}
# Context
self._context = None
self._solution = {'account_sid': account_sid, 'country_code': country_code, }
示例2: __init__
def __init__(self, version, payload, account_sid, sid=None):
"""
Initialize the FeedbackSummaryInstance
:returns: twilio.rest.api.v2010.account.call.feedback_summary.FeedbackSummaryInstance
:rtype: twilio.rest.api.v2010.account.call.feedback_summary.FeedbackSummaryInstance
"""
super(FeedbackSummaryInstance, self).__init__(version)
# Marshaled Properties
self._properties = {
'account_sid': payload['account_sid'],
'call_count': deserialize.integer(payload['call_count']),
'call_feedback_count': deserialize.integer(payload['call_feedback_count']),
'date_created': deserialize.rfc2822_datetime(payload['date_created']),
'date_updated': deserialize.rfc2822_datetime(payload['date_updated']),
'end_date': deserialize.iso8601_datetime(payload['end_date']),
'include_subaccounts': payload['include_subaccounts'],
'issues': payload['issues'],
'quality_score_average': deserialize.decimal(payload['quality_score_average']),
'quality_score_median': deserialize.decimal(payload['quality_score_median']),
'quality_score_standard_deviation': deserialize.decimal(payload['quality_score_standard_deviation']),
'sid': payload['sid'],
'start_date': deserialize.iso8601_datetime(payload['start_date']),
'status': payload['status'],
}
# Context
self._context = None
self._solution = {'account_sid': account_sid, 'sid': sid or self._properties['sid'], }
示例3: __init__
def __init__(self, version, payload, account_sid, call_sid, sid=None):
"""
Initialize the RecordingInstance
:returns: twilio.rest.api.v2010.account.call.recording.RecordingInstance
:rtype: twilio.rest.api.v2010.account.call.recording.RecordingInstance
"""
super(RecordingInstance, self).__init__(version)
# Marshaled Properties
self._properties = {
'account_sid': payload['account_sid'],
'api_version': payload['api_version'],
'call_sid': payload['call_sid'],
'date_created': deserialize.rfc2822_datetime(payload['date_created']),
'date_updated': deserialize.rfc2822_datetime(payload['date_updated']),
'duration': payload['duration'],
'sid': payload['sid'],
'price': deserialize.decimal(payload['price']),
'uri': payload['uri'],
'encryption_details': payload['encryption_details'],
}
# Context
self._context = None
self._solution = {
'account_sid': account_sid,
'call_sid': call_sid,
'sid': sid or self._properties['sid'],
}
示例4: __init__
def __init__(self, version, payload, account_sid, recording_sid, sid=None):
"""
Initialize the TranscriptionInstance
:returns: twilio.rest.api.v2010.account.recording.transcription.TranscriptionInstance
:rtype: twilio.rest.api.v2010.account.recording.transcription.TranscriptionInstance
"""
super(TranscriptionInstance, self).__init__(version)
# Marshaled Properties
self._properties = {
'account_sid': payload['account_sid'],
'api_version': payload['api_version'],
'date_created': deserialize.rfc2822_datetime(payload['date_created']),
'date_updated': deserialize.rfc2822_datetime(payload['date_updated']),
'duration': payload['duration'],
'price': deserialize.decimal(payload['price']),
'price_unit': payload['price_unit'],
'recording_sid': payload['recording_sid'],
'sid': payload['sid'],
'status': payload['status'],
'transcription_text': payload['transcription_text'],
'type': payload['type'],
'uri': payload['uri'],
}
# Context
self._context = None
self._solution = {
'account_sid': account_sid,
'recording_sid': recording_sid,
'sid': sid or self._properties['sid'],
}
示例5: __init__
def __init__(self, version, payload, sid=None):
"""
Initialize the FaxInstance
:returns: twilio.rest.fax.v1.fax.FaxInstance
:rtype: twilio.rest.fax.v1.fax.FaxInstance
"""
super(FaxInstance, self).__init__(version)
# Marshaled Properties
self._properties = {
'sid': payload['sid'],
'account_sid': payload['account_sid'],
'from_': payload['from'],
'to': payload['to'],
'quality': payload['quality'],
'media_sid': payload['media_sid'],
'media_url': payload['media_url'],
'num_pages': deserialize.integer(payload['num_pages']),
'duration': deserialize.integer(payload['duration']),
'status': payload['status'],
'direction': payload['direction'],
'api_version': payload['api_version'],
'price': deserialize.decimal(payload['price']),
'price_unit': payload['price_unit'],
'date_created': deserialize.iso8601_datetime(payload['date_created']),
'date_updated': deserialize.iso8601_datetime(payload['date_updated']),
'links': payload['links'],
'url': payload['url'],
}
# Context
self._context = None
self._solution = {'sid': sid or self._properties['sid'], }
示例6: __init__
def __init__(self, version, payload, account_sid, sid=None):
"""
Initialize the CallInstance
:returns: twilio.rest.api.v2010.account.call.CallInstance
:rtype: twilio.rest.api.v2010.account.call.CallInstance
"""
super(CallInstance, self).__init__(version)
# Marshaled Properties
self._properties = {
'account_sid': payload['account_sid'],
'annotation': payload['annotation'],
'answered_by': payload['answered_by'],
'api_version': payload['api_version'],
'caller_name': payload['caller_name'],
'date_created': deserialize.rfc2822_datetime(payload['date_created']),
'date_updated': deserialize.rfc2822_datetime(payload['date_updated']),
'direction': payload['direction'],
'duration': payload['duration'],
'end_time': deserialize.rfc2822_datetime(payload['end_time']),
'forwarded_from': payload['forwarded_from'],
'from_': payload['from'],
'from_formatted': payload['from_formatted'],
'group_sid': payload['group_sid'],
'parent_call_sid': payload['parent_call_sid'],
'phone_number_sid': payload['phone_number_sid'],
'price': deserialize.decimal(payload['price']),
'price_unit': payload['price_unit'],
'sid': payload['sid'],
'start_time': deserialize.rfc2822_datetime(payload['start_time']),
'status': payload['status'],
'subresource_uris': payload['subresource_uris'],
'to': payload['to'],
'to_formatted': payload['to_formatted'],
'uri': payload['uri'],
}
# Context
self._context = None
self._solution = {
'account_sid': account_sid,
'sid': sid or self._properties['sid'],
}
示例7: test_positive
def test_positive(self):
self.assertEqual(0.0123, deserialize.decimal(0.0123))
示例8: test_zero
def test_zero(self):
self.assertEqual(0, deserialize.decimal(0))
示例9: test_negative
def test_negative(self):
self.assertEqual(-0.0123, deserialize.decimal(-0.0123))
示例10: test_positive_string
def test_positive_string(self):
self.assertEqual(Decimal('0.0123'), deserialize.decimal('0.0123'))
示例11: test_negative_string
def test_negative_string(self):
self.assertEqual(Decimal('-0.0123'), deserialize.decimal('-0.0123'))
示例12: test_zero_string
def test_zero_string(self):
self.assertEqual(Decimal('0.0000'), deserialize.decimal('0.0000'))
示例13: test_empty_string
def test_empty_string(self):
self.assertEqual('', deserialize.decimal(''))
示例14: test_none
def test_none(self):
self.assertEqual(None, deserialize.decimal(None))