text stringlengths 81 112k |
|---|
Transition the SCTP association to a new state.
def _set_state(self, state):
"""
Transition the SCTP association to a new state.
"""
if state != self._association_state:
self.__log_debug('- %s -> %s', self._association_state, state)
self._association_state = stat... |
Transmit outbound data.
async def _transmit(self):
"""
Transmit outbound data.
"""
# send FORWARD TSN
if self._forward_tsn_chunk is not None:
await self._send_chunk(self._forward_tsn_chunk)
self._forward_tsn_chunk = None
# ensure T3 is runnin... |
Try to advance "Advanced.Peer.Ack.Point" according to RFC 3758.
def _update_advanced_peer_ack_point(self):
"""
Try to advance "Advanced.Peer.Ack.Point" according to RFC 3758.
"""
if uint32_gt(self._last_sacked_tsn, self._advanced_peer_ack_tsn):
self._advanced_peer_ack_tsn = ... |
Update RTO given a new roundtrip measurement R.
def _update_rto(self, R):
"""
Update RTO given a new roundtrip measurement R.
"""
if self._srtt is None:
self._rttvar = R / 2
self._srtt = R
else:
self._rttvar = (1 - SCTP_RTO_BETA) * self._rttva... |
Request closing the datachannel by sending an Outgoing Stream Reset Request.
def _data_channel_close(self, channel, transmit=True):
"""
Request closing the datachannel by sending an Outgoing Stream Reset Request.
"""
if channel.readyState not in ['closing', 'closed']:
channe... |
Try to flush buffered data to the SCTP layer.
We wait until the association is established, as we need to know
whether we are a client or a server to correctly assign an odd/even ID
to the data channels.
async def _data_channel_flush(self):
"""
Try to flush buffered data to the... |
Add signaling method arguments to an argparse.ArgumentParser.
def add_signaling_arguments(parser):
"""
Add signaling method arguments to an argparse.ArgumentParser.
"""
parser.add_argument('--signaling', '-s', choices=[
'copy-and-paste', 'tcp-socket', 'unix-socket'])
parser.add_argument('--... |
Create a signaling method based on command-line arguments.
def create_signaling(args):
"""
Create a signaling method based on command-line arguments.
"""
if args.signaling == 'tcp-socket':
return TcpSocketSignaling(args.signaling_host, args.signaling_port)
elif args.signaling == 'unix-socke... |
Receive the next frame.
async def recv(self):
"""
Receive the next frame.
"""
if self.readyState != 'live':
raise MediaStreamError
frame = await self._queue.get()
if frame is None:
self.stop()
raise MediaStreamError
return fra... |
Returns statistics about the RTP receiver.
:rtype: :class:`RTCStatsReport`
async def getStats(self):
"""
Returns statistics about the RTP receiver.
:rtype: :class:`RTCStatsReport`
"""
for ssrc, stream in self.__remote_streams.items():
self.__stats.add(RTCIn... |
Returns a :class:`RTCRtpSynchronizationSource` for each unique SSRC identifier
received in the last 10 seconds.
def getSynchronizationSources(self):
"""
Returns a :class:`RTCRtpSynchronizationSource` for each unique SSRC identifier
received in the last 10 seconds.
"""
cu... |
Attempt to set the parameters controlling the receiving of media.
:param: parameters: The :class:`RTCRtpParameters` for the receiver.
async def receive(self, parameters: RTCRtpReceiveParameters):
"""
Attempt to set the parameters controlling the receiving of media.
:param: parameters:... |
Irreversibly stop the receiver.
async def stop(self):
"""
Irreversibly stop the receiver.
"""
if self.__started:
self.__transport._unregister_rtp_receiver(self)
self.__stop_decoder()
self.__rtcp_task.cancel()
await self.__rtcp_exited.wait(... |
Handle an incoming RTP packet.
async def _handle_rtp_packet(self, packet: RtpPacket, arrival_time_ms: int):
"""
Handle an incoming RTP packet.
"""
self.__log_debug('< %s', packet)
# feed bitrate estimator
if self.__remote_bitrate_estimator is not None:
if pa... |
Send an RTCP packet to report missing RTP packets.
async def _send_rtcp_nack(self, media_ssrc, lost):
"""
Send an RTCP packet to report missing RTP packets.
"""
if self.__rtcp_ssrc is not None:
packet = RtcpRtpfbPacket(
fmt=RTCP_RTPFB_NACK, ssrc=self.__rtcp_s... |
Send an RTCP packet to report picture loss.
async def _send_rtcp_pli(self, media_ssrc):
"""
Send an RTCP packet to report picture loss.
"""
if self.__rtcp_ssrc is not None:
packet = RtcpPsfbPacket(fmt=RTCP_PSFB_PLI, ssrc=self.__rtcp_ssrc, media_ssrc=media_ssrc)
a... |
Stop the decoder thread, which will in turn stop the track.
def __stop_decoder(self):
"""
Stop the decoder thread, which will in turn stop the track.
"""
if self.__decoder_thread:
self.__decoder_queue.put(None)
self.__decoder_thread.join()
self.__deco... |
This is usually an implementation of Ledger
def init_domain_ledger(self):
"""
This is usually an implementation of Ledger
"""
if self.config.primaryStorage is None:
genesis_txn_initiator = GenesisTxnInitiatorFromFile(
self.genesis_dir, self.config.domainTrans... |
All the data of the transaction might not be stored in ledger so the
extra data that is omitted from ledger needs to be fetched from the
appropriate data store
:param txn:
:return:
def update_txn_with_extra_data(self, txn):
"""
All the data of the transaction might not b... |
Make key(path)-value pair for state from ATTRIB or GET_ATTR
:return: state path, state value, value for attribute store
def prepare_attr_for_state(txn, path_only=False):
"""
Make key(path)-value pair for state from ATTRIB or GET_ATTR
:return: state path, state value, value for attribute store
"""
... |
ATTR and GET_ATTR can have one of 'raw', 'enc' and 'hash' fields.
This method checks which of them presents and return it's name
and value in it.
def _extract_attr_typed_value(txn_data):
"""
ATTR and GET_ATTR can have one of 'raw', 'enc' and 'hash' fields.
This method checks which of them presents ... |
Test for the directory, open old and new ledger, migrate data, rename directories
def _migrate_ledger(data_directory,
old_ledger_file, new_ledger_file,
serializer: MappingSerializer = None):
"""
Test for the directory, open old and new ledger, migrate data, rename direct... |
Get a nym, if role is provided then get nym with that role
:param nym:
:param role:
:param isCommitted:
:return:
def getNym(self, nym, role=None, isCommitted=True):
"""
Get a nym, if role is provided then get nym with that role
:param nym:
:param role:
... |
Unschedule current action
Note that it does not add record to action log and does not do
required steps to resume previous action. If you need this - use
_cancelScheduledAction
def _unscheduleAction(self):
"""
Unschedule current action
Note that it does not add record ... |
Find rule_id for incoming action_id and return AuthConstraint instance
def get_auth_constraint(self, action_id: str) -> AbstractAuthConstraint:
"""
Find rule_id for incoming action_id and return AuthConstraint instance
"""
if self.anyone_can_write_map:
return self._find_auth... |
Appends event to log
Be careful it opens file every time!
def _append(self, ev_type: Enum, data: ActionLogData) -> None:
"""
Appends event to log
Be careful it opens file every time!
"""
event = ActionLogEvent(None, ev_type, data, types=self._event_types)
with op... |
The state trie stores the hash of the whole attribute data at:
the did+attribute name if the data is plaintext (RAW)
the did+hash(attribute) if the data is encrypted (ENC)
If the attribute is HASH, then nothing is stored in attribute store,
the trie stores a blank value for the k... |
depends on config
def create_auth_strategy(self):
"""depends on config"""
if self.config.authPolicy == LOCAL_AUTH_POLICY:
return LocalAuthStrategy(auth_map=self.auth_map,
anyone_can_write_map=self.anyone_can_write_map if self.anyone_can_write else None)
... |
Return path to state as 'str' type or None
def gen_txn_path(self, txn):
"""Return path to state as 'str' type or None"""
txn_type = get_type(txn)
if txn_type not in self.state_update_handlers:
logger.error('Cannot generate id for txn of type {}'.format(txn_type))
return... |
For getting reply we need:
1. Get REVOC_REG_ENTRY by "TO" timestamp from state
2. If FROM is given in request, then Get REVOC_REG_ENTRY by "FROM" timestamp from state
3. Get ISSUANCE_TYPE for REVOC_REG_DEF (revoked/issued strategy)
4. Compute issued and revoked indices by corresponding s... |
Queries state for data on specified path
:param path: path to data
:param isCommitted: queries the committed state root if True else the uncommitted root
:param with_proof: creates proof if True
:return: data
def lookup(self, path, isCommitted=True, with_proof=False) -> (str, int):
... |
The state trie stores the hash of the whole attribute data at:
the did+attribute name if the data is plaintext (RAW)
the did+hash(attribute) if the data is encrypted (ENC)
If the attribute is HASH, then nothing is stored in attribute store,
the trie stores a blank value for the k... |
Some transactions need to be transformed before they can be stored in the
ledger, eg. storing certain payload in another data store and only its
hash in the ledger
def transform_txn_for_ledger(txn):
"""
Some transactions need to be transformed before they can be stored in the
le... |
Creating copy of result so that `RAW`, `ENC` or `HASH` can be
replaced by their hashes. We do not insert actual attribute data
in the ledger but only the hash of it.
def transform_attrib_for_ledger(txn):
"""
Creating copy of result so that `RAW`, `ENC` or `HASH` can be
replaced ... |
Encrypt the provided value with symmetric encryption
:param val: the value to encrypt
:param secretKey: Optional key, if provided should be either in hex or bytes
:return: Tuple of the encrypted value and secret key encoded in hex
def getSymmetricallyEncryptedVal(val, secretKey: Union[str, bytes] = None) ... |
Finds the index of an item in list, which satisfies predicate
:param predicateFn: predicate function to run on items of list
:param items: list of tuples
:return: first index for which predicate function returns True
def getIndex(predicateFn: Callable[[T], bool], items: List[T]) -> int:
"""
Finds t... |
Create base transactions
:param key: ledger
:param force: replace existing transaction files
def setupTxns(self, key, force: bool = False):
"""
Create base transactions
:param key: ledger
:param force: replace existing transaction files
"""
import data
... |
Check if an image with a given tag exists. No side-effects. Idempotent.
Handles ImageNotFound and APIError exceptions, but only reraises APIError.
def getImageByTag(tag):
'''Check if an image with a given tag exists. No side-effects. Idempotent.
Handles ImageNotFound and APIError exceptions, but only rerai... |
Check if an image with a given tag exists. If not, build an image from
using a given dockerfile in a given path, tagging it with a given tag.
No extra side effects. Handles and reraises BuildError, TypeError, and
APIError exceptions.
def getImage(path, dockerfile, tag):
'''Check if an image with a give... |
Run a docker container using a given image; passing keyword arguments
documented to be accepted by docker's client.containers.run function
No extra side effects. Handles and reraises ContainerError, ImageNotFound,
and APIError exceptions.
def runContainer(image, **kwargs):
'''Run a docker container usi... |
Get the container with the given name or ID (str). No side effects.
Idempotent. Returns None if the container does not exist. Otherwise, the
continer is returned
def getContainer(name_or_id):
'''Get the container with the given name or ID (str). No side effects.
Idempotent. Returns None if the containe... |
Check if container with the given name or ID (str) is running. No side
effects. Idempotent. Returns True if running, False if not.
def containerIsRunning(name_or_id):
'''Check if container with the given name or ID (str) is running. No side
effects. Idempotent. Returns True if running, False if not.'''
... |
Check if a container with a given tag exists. No side-effects.
Idempotent. Handles NotFound and APIError exceptions, but only reraises
APIError. Returns None if the container is not found. Otherwise, returns the
container.
def getContainerByTag(tag):
'''Check if a container with a given tag exists. No ... |
Check if a container with a given tag exists. Kill it if it exists.
No extra side effects. Handles and reraises TypeError, and
APIError exceptions.
def removeContainer(tag):
'''Check if a container with a given tag exists. Kill it if it exists.
No extra side effects. Handles and reraises TypeError, and... |
Start the indy_pool docker container iff it is not already running. See
<indy-sdk>/ci/indy-pool.dockerfile for details. Idempotent. Simply ensures
that the indy_pool container is up and running.
def startIndyPool(**kwargs):
'''Start the indy_pool docker container iff it is not already running. See
<ind... |
Restart the indy_pool docker container. Idempotent. Ensures that the
indy_pool container is a new running instance.
def restartIndyPool(**kwargs):
'''Restart the indy_pool docker container. Idempotent. Ensures that the
indy_pool container is a new running instance.'''
print("Restarting...")
try:
... |
Special signing state where the the data for an attribute is hashed
before signing
:return: state to be used when signing
def signingPayloadState(self, identifier=None):
"""
Special signing state where the the data for an attribute is hashed
before signing
:return: state... |
Test for the directory, open old and new ledger, migrate data, rename directories
def _migrate_ledger(data_directory,
old_ledger_file, new_ledger_file,
serializer: MappingSerializer = None):
"""
Test for the directory, open old and new ledger, migrate data, rename direct... |
None roles are stored as empty strings, so the role returned as None
by this function means that corresponding DID is not stored in a ledger.
def get_role(self, request: Request):
"""
None roles are stored as empty strings, so the role returned as None
by this function means that corres... |
Handles transaction of type POOL_CONFIG
:param txn:
def handleConfigTxn(self, txn) -> None:
"""
Handles transaction of type POOL_CONFIG
:param txn:
"""
if get_type(txn) == POOL_CONFIG:
self.writes = get_payload_data(txn)[WRITES] |
Checks ledger config txns and perfomes recent one
:return:
def processLedger(self) -> None:
"""
Checks ledger config txns and perfomes recent one
:return:
"""
logger.debug('{} processing config ledger for any POOL_CONFIGs'.format(
self), extra={"tags": ["po... |
Handles transaction of type POOL_RESTART
Can schedule or cancel restart to a newer
version at specified time
:param req:
def handleRestartRequest(self, req: Request) -> None:
"""
Handles transaction of type POOL_RESTART
Can schedule or cancel restart to a newer
... |
Schedules node restart to a newer version
:param version: version to restart to
:param when: restart time
def _scheduleRestart(self,
when: Union[datetime, str],
failTimeout) -> None:
"""
Schedules node restart to a newer version
... |
Cancels scheduled restart
:param when: time restart was scheduled to
:param version: version restart scheduled for
def _cancelScheduledRestart(self, justification=None) -> None:
"""
Cancels scheduled restart
:param when: time restart was scheduled to
:param version: ve... |
Callback which is called when restart time come.
Writes restart record to restart log and asks
node control service to perform restart
:param ev_data: restart event data
:param version: version to restart to
def _callRestartAgent(self, ev_data: RestartLogData, failTimeout) -> None:
... |
This function is called when time for restart is up
def _declareTimeoutExceeded(self, ev_data: RestartLogData):
"""
This function is called when time for restart is up
"""
logger.info("Timeout exceeded for {}".format(ev_data.when))
last = self._actionLog.last_event
if (l... |
Checks ledger for planned but not yet performed upgrades
and schedules upgrade for the most recent one
Assumption: Only version is enough to identify a release, no hash
checking is done
:return:
def processLedger(self) -> None:
"""
Checks ledger for planned but not yet ... |
Checks last record in upgrade log to find out whether it
is about scheduling upgrade. If so - checks whether current version
is equals to the one in that record
:returns: upgrade execution result
def didLastExecutedUpgradeSucceeded(self) -> bool:
"""
Checks last record in upgra... |
Handles transaction of type POOL_UPGRADE
Can schedule or cancel upgrade to a newer
version at specified time
:param txn:
def handleUpgradeTxn(self, txn) -> None:
"""
Handles transaction of type POOL_UPGRADE
Can schedule or cancel upgrade to a newer
version at sp... |
Schedules node upgrade to a newer version
:param ev_data: upgrade event parameters
def _scheduleUpgrade(self,
ev_data: UpgradeLogData,
failTimeout) -> None:
"""
Schedules node upgrade to a newer version
:param ev_data: upgrade event pa... |
Cancels scheduled upgrade
:param when: time upgrade was scheduled to
:param version: version upgrade scheduled for
def _cancelScheduledUpgrade(self, justification=None) -> None:
"""
Cancels scheduled upgrade
:param when: time upgrade was scheduled to
:param version: ve... |
Callback which is called when upgrade time come.
Writes upgrade record to upgrade log and asks
node control service to perform upgrade
:param when: upgrade time
:param version: version to upgrade to
def _callUpgradeAgent(self, ev_data, failTimeout) -> None:
"""
Callback... |
This function is called when time for upgrade is up
def _declareTimeoutExceeded(self, ev_data: UpgradeLogData):
"""
This function is called when time for upgrade is up
"""
logger.info("Timeout exceeded for {}:{}"
.format(ev_data.when, ev_data.version))
last =... |
Validates schedule of planned node upgrades
:param schedule: dictionary of node ids and upgrade times
:param node_srvs: dictionary of node ids and services
:return: a 2-tuple of whether schedule valid or not and the reason
def isScheduleValid(self, schedule, node_srvs, force) -> (bool, str):
... |
Retrieves a temporary access token
def get_token(self, url):
"""
Retrieves a temporary access token
"""
# A hack to avoid url-encoding the url, since the authorization service
# doesn't work with correctly encoded urls
parsed_url = urlparse.urlsplit(url)
parsed_... |
Synthesizes text to spoken audio using web sockets. It supports the use of
the SSML <mark> element to identify the location of user-specified markers in the audio.
It can also return timing information for all strings of the input text.
Note:The service processes one request per connection.
... |
Classify images.
Classify images with built-in or custom classifiers.
:param file images_file: An image file (.gif, .jpg, .png, .tif) or .zip file with
images. Maximum image size is 10 MB. Include no more than 20 images and limit the
.zip file to 100 MB. Encode the image and .zip file ... |
Create a classifier.
Train a new multi-faceted classifier on the uploaded image data. Create your
custom classifier with positive or negative examples. Include at least two sets of
examples, either two positive example files or one positive and one negative file.
You can upload a maximu... |
Delete a classifier.
:param str classifier_id: The ID of the classifier.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
def delete_classifier(self, classifier_id, *... |
Return a json dictionary representing this model.
def _to_dict(self):
"""Return a json dictionary representing this model."""
_dict = {}
if hasattr(self, 'class_name') and self.class_name is not None:
_dict['class'] = self.class_name
return _dict |
Return a json dictionary representing this model.
def _to_dict(self):
"""Return a json dictionary representing this model."""
_dict = {}
if hasattr(self, 'class_name') and self.class_name is not None:
_dict['class'] = self.class_name
if hasattr(self, 'score') and self.score ... |
Initialize a ClassifiedImage object from a json dictionary.
def _from_dict(cls, _dict):
"""Initialize a ClassifiedImage object from a json dictionary."""
args = {}
if 'source_url' in _dict:
args['source_url'] = _dict.get('source_url')
if 'resolved_url' in _dict:
... |
Return a json dictionary representing this model.
def _to_dict(self):
"""Return a json dictionary representing this model."""
_dict = {}
if hasattr(self, 'source_url') and self.source_url is not None:
_dict['source_url'] = self.source_url
if hasattr(self, 'resolved_url') and... |
Initialize a Classifier object from a json dictionary.
def _from_dict(cls, _dict):
"""Initialize a Classifier object from a json dictionary."""
args = {}
if 'classifier_id' in _dict:
args['classifier_id'] = _dict.get('classifier_id')
else:
raise ValueError(
... |
Return a json dictionary representing this model.
def _to_dict(self):
"""Return a json dictionary representing this model."""
_dict = {}
if hasattr(self, 'classifier_id') and self.classifier_id is not None:
_dict['classifier_id'] = self.classifier_id
if hasattr(self, 'name')... |
Initialize a ClassifierResult object from a json dictionary.
def _from_dict(cls, _dict):
"""Initialize a ClassifierResult object from a json dictionary."""
args = {}
if 'name' in _dict:
args['name'] = _dict.get('name')
else:
raise ValueError(
'Req... |
Return a json dictionary representing this model.
def _to_dict(self):
"""Return a json dictionary representing this model."""
_dict = {}
if hasattr(self, 'name') and self.name is not None:
_dict['name'] = self.name
if hasattr(self, 'classifier_id') and self.classifier_id is ... |
Return a json dictionary representing this model.
def _to_dict(self):
"""Return a json dictionary representing this model."""
_dict = {}
if hasattr(self, 'classifiers') and self.classifiers is not None:
_dict['classifiers'] = [x._to_dict() for x in self.classifiers]
return _... |
Initialize a DetectedFaces object from a json dictionary.
def _from_dict(cls, _dict):
"""Initialize a DetectedFaces object from a json dictionary."""
args = {}
if 'images_processed' in _dict:
args['images_processed'] = _dict.get('images_processed')
else:
raise Va... |
Return a json dictionary representing this model.
def _to_dict(self):
"""Return a json dictionary representing this model."""
_dict = {}
if hasattr(self,
'images_processed') and self.images_processed is not None:
_dict['images_processed'] = self.images_processed
... |
Return a json dictionary representing this model.
def _to_dict(self):
"""Return a json dictionary representing this model."""
_dict = {}
if hasattr(self, 'code') and self.code is not None:
_dict['code'] = self.code
if hasattr(self, 'description') and self.description is not ... |
Initialize a Face object from a json dictionary.
def _from_dict(cls, _dict):
"""Initialize a Face object from a json dictionary."""
args = {}
if 'age' in _dict:
args['age'] = FaceAge._from_dict(_dict.get('age'))
if 'gender' in _dict:
args['gender'] = FaceGender._... |
Return a json dictionary representing this model.
def _to_dict(self):
"""Return a json dictionary representing this model."""
_dict = {}
if hasattr(self, 'age') and self.age is not None:
_dict['age'] = self.age._to_dict()
if hasattr(self, 'gender') and self.gender is not Non... |
Return a json dictionary representing this model.
def _to_dict(self):
"""Return a json dictionary representing this model."""
_dict = {}
if hasattr(self, 'min') and self.min is not None:
_dict['min'] = self.min
if hasattr(self, 'max') and self.max is not None:
_d... |
Return a json dictionary representing this model.
def _to_dict(self):
"""Return a json dictionary representing this model."""
_dict = {}
if hasattr(self, 'gender') and self.gender is not None:
_dict['gender'] = self.gender
if hasattr(self, 'gender_label') and self.gender_lab... |
Return a json dictionary representing this model.
def _to_dict(self):
"""Return a json dictionary representing this model."""
_dict = {}
if hasattr(self, 'width') and self.width is not None:
_dict['width'] = self.width
if hasattr(self, 'height') and self.height is not None:
... |
Return a json dictionary representing this model.
def _to_dict(self):
"""Return a json dictionary representing this model."""
_dict = {}
if hasattr(self, 'warning_id') and self.warning_id is not None:
_dict['warning_id'] = self.warning_id
if hasattr(self, 'description') and ... |
Send user input to assistant.
Send user input to an assistant and receive a response.
There is no rate limit for this operation.
:param str assistant_id: Unique identifier of the assistant. You can find the
assistant ID of an assistant on the **Assistants** tab of the Watson Assistant
... |
Return a json dictionary representing this model.
def _to_dict(self):
"""Return a json dictionary representing this model."""
_dict = {}
if hasattr(self, 'group') and self.group is not None:
_dict['group'] = self.group
if hasattr(self, 'location') and self.location is not No... |
Return a json dictionary representing this model.
def _to_dict(self):
"""Return a json dictionary representing this model."""
_dict = {}
if hasattr(self, 'level') and self.level is not None:
_dict['level'] = self.level
if hasattr(self, 'message') and self.message is not None... |
Return a json dictionary representing this model.
def _to_dict(self):
"""Return a json dictionary representing this model."""
_dict = {}
if hasattr(self, 'name') and self.name is not None:
_dict['name'] = self.name
if hasattr(self, 'action_type') and self.action_type is not ... |
Return a json dictionary representing this model.
def _to_dict(self):
"""Return a json dictionary representing this model."""
_dict = {}
if hasattr(self, 'input') and self.input is not None:
_dict['input'] = self.input._to_dict()
return _dict |
Return a json dictionary representing this model.
def _to_dict(self):
"""Return a json dictionary representing this model."""
_dict = {}
if hasattr(self, 'dialog_node') and self.dialog_node is not None:
_dict['dialog_node'] = self.dialog_node
if hasattr(self, 'title') and se... |
Return a json dictionary representing this model.
def _to_dict(self):
"""Return a json dictionary representing this model."""
_dict = {}
if hasattr(self, 'label') and self.label is not None:
_dict['label'] = self.label
if hasattr(self, 'value') and self.value is not None:
... |
Initialize a MessageContext object from a json dictionary.
def _from_dict(cls, _dict):
"""Initialize a MessageContext object from a json dictionary."""
args = {}
if 'global' in _dict:
args['global_'] = MessageContextGlobal._from_dict(
_dict.get('global'))
if ... |
Return a json dictionary representing this model.
def _to_dict(self):
"""Return a json dictionary representing this model."""
_dict = {}
if hasattr(self, 'global_') and self.global_ is not None:
_dict['global'] = self.global_._to_dict()
if hasattr(self, 'skills') and self.sk... |
Return a json dictionary representing this model.
def _to_dict(self):
"""Return a json dictionary representing this model."""
_dict = {}
if hasattr(self, 'system') and self.system is not None:
_dict['system'] = self.system._to_dict()
return _dict |
Return a json dictionary representing this model.
def _to_dict(self):
"""Return a json dictionary representing this model."""
_dict = {}
if hasattr(self, 'timezone') and self.timezone is not None:
_dict['timezone'] = self.timezone
if hasattr(self, 'user_id') and self.user_id... |
Initialize a MessageInput object from a json dictionary.
def _from_dict(cls, _dict):
"""Initialize a MessageInput object from a json dictionary."""
args = {}
if 'message_type' in _dict:
args['message_type'] = _dict.get('message_type')
if 'text' in _dict:
args['te... |
Return a json dictionary representing this model.
def _to_dict(self):
"""Return a json dictionary representing this model."""
_dict = {}
if hasattr(self, 'message_type') and self.message_type is not None:
_dict['message_type'] = self.message_type
if hasattr(self, 'text') and... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.