_id stringlengths 2 7 | title stringlengths 1 88 | partition stringclasses 3
values | text stringlengths 75 19.8k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q8900 | InlineQueryResultCachedVoice.to_array | train | def to_array(self):
"""
Serializes this InlineQueryResultCachedVoice to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(InlineQueryResultCachedVoice, self).to_array()
# 'type' and 'id' given by superclass
ar... | python | {
"resource": ""
} |
q8901 | InlineQueryResultCachedAudio.from_array | train | def from_array(array):
"""
Deserialize a new InlineQueryResultCachedAudio from a given dictionary.
:return: new InlineQueryResultCachedAudio instance.
:rtype: InlineQueryResultCachedAudio
"""
if array is None or not array:
return None
# end if
... | python | {
"resource": ""
} |
q8902 | InputTextMessageContent.to_array | train | def to_array(self):
"""
Serializes this InputTextMessageContent to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(InputTextMessageContent, self).to_array()
array['message_text'] = u(self.message_text) # py2: type ... | python | {
"resource": ""
} |
q8903 | InputLocationMessageContent.to_array | train | def to_array(self):
"""
Serializes this InputLocationMessageContent to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(InputLocationMessageContent, self).to_array()
array['latitude'] = float(self.latitude) # type f... | python | {
"resource": ""
} |
q8904 | InputLocationMessageContent.from_array | train | def from_array(array):
"""
Deserialize a new InputLocationMessageContent from a given dictionary.
:return: new InputLocationMessageContent instance.
:rtype: InputLocationMessageContent
"""
if array is None or not array:
return None
# end if
as... | python | {
"resource": ""
} |
q8905 | InputVenueMessageContent.to_array | train | def to_array(self):
"""
Serializes this InputVenueMessageContent to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(InputVenueMessageContent, self).to_array()
array['latitude'] = float(self.latitude) # type float
... | python | {
"resource": ""
} |
q8906 | InputVenueMessageContent.from_array | train | def from_array(array):
"""
Deserialize a new InputVenueMessageContent from a given dictionary.
:return: new InputVenueMessageContent instance.
:rtype: InputVenueMessageContent
"""
if array is None or not array:
return None
# end if
assert_type... | python | {
"resource": ""
} |
q8907 | InputContactMessageContent.to_array | train | def to_array(self):
"""
Serializes this InputContactMessageContent to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(InputContactMessageContent, self).to_array()
array['phone_number'] = u(self.phone_number) # py2:... | python | {
"resource": ""
} |
q8908 | can_strip_prefix | train | def can_strip_prefix(text:str, prefix:str) -> (bool, str):
"""
If the given text starts with the given prefix, True and the text without that prefix is returned.
Else False and the original text is returned.
Note: the text always is stripped, before returning.
:param text:
:param prefix:
:... | python | {
"resource": ""
} |
q8909 | Function.class_name | train | def class_name(self) -> str:
"""
Makes the fist letter big, keep the rest of the camelCaseApiName.
"""
if not self.api_name: # empty string
return self.api_name
# end if
return self.api_name[0].upper() + self.api_name[1:] | python | {
"resource": ""
} |
q8910 | Function.class_name_teleflask_message | train | def class_name_teleflask_message(self) -> str:
"""
If it starts with `Send` remove that.
"""
# strip leading "Send"
name = self.class_name # "sendPhoto" -> "SendPhoto"
name = name[4:] if name.startswith('Send') else name # "SendPhoto" -> "Photo"
name = name + "M... | python | {
"resource": ""
} |
q8911 | Import.full | train | def full(self):
""" self.path + "." + self.name """
if self.path:
if self.name:
return self.path + "." + self.name
else:
return self.path
# end if
else:
if self.name:
return self.name
else... | python | {
"resource": ""
} |
q8912 | ResponseBot.do | train | def do(self, command, files=None, use_long_polling=False, request_timeout=None, **query):
"""
Return the request params we would send to the api.
"""
url, params = self._prepare_request(command, query)
return {
"url": url, "params": params, "files": files, "stream": u... | python | {
"resource": ""
} |
q8913 | Update.to_array | train | def to_array(self):
"""
Serializes this Update to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(Update, self).to_array()
array['update_id'] = int(self.update_id) # type int
if self.message is not None:
... | python | {
"resource": ""
} |
q8914 | WebhookInfo.to_array | train | def to_array(self):
"""
Serializes this WebhookInfo to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(WebhookInfo, self).to_array()
array['url'] = u(self.url) # py2: type unicode, py3: type str
array['has_... | python | {
"resource": ""
} |
q8915 | WebhookInfo.from_array | train | def from_array(array):
"""
Deserialize a new WebhookInfo from a given dictionary.
:return: new WebhookInfo instance.
:rtype: WebhookInfo
"""
if array is None or not array:
return None
# end if
assert_type_or_raise(array, dict, parameter_name="... | python | {
"resource": ""
} |
q8916 | CallbackQuery.to_array | train | def to_array(self):
"""
Serializes this CallbackQuery to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(CallbackQuery, self).to_array()
array['id'] = u(self.id) # py2: type unicode, py3: type str
array['fr... | python | {
"resource": ""
} |
q8917 | CallbackQuery.from_array | train | def from_array(array):
"""
Deserialize a new CallbackQuery from a given dictionary.
:return: new CallbackQuery instance.
:rtype: CallbackQuery
"""
if array is None or not array:
return None
# end if
assert_type_or_raise(array, dict, parameter_... | python | {
"resource": ""
} |
q8918 | ResponseParameters.to_array | train | def to_array(self):
"""
Serializes this ResponseParameters to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(ResponseParameters, self).to_array()
if self.migrate_to_chat_id is not None:
array['migrate_t... | python | {
"resource": ""
} |
q8919 | ResponseParameters.from_array | train | def from_array(array):
"""
Deserialize a new ResponseParameters from a given dictionary.
:return: new ResponseParameters instance.
:rtype: ResponseParameters
"""
if array is None or not array:
return None
# end if
assert_type_or_raise(array, d... | python | {
"resource": ""
} |
q8920 | Xmrs.from_xmrs | train | def from_xmrs(cls, xmrs, **kwargs):
"""
Facilitate conversion among subclasses.
Args:
xmrs (:class:`Xmrs`): instance to convert from; possibly
an instance of a subclass, such as :class:`Mrs` or
:class:`Dmrs`
**kwargs: additional keyword ar... | python | {
"resource": ""
} |
q8921 | Xmrs.is_connected | train | def is_connected(self):
"""
Return `True` if the Xmrs represents a connected graph.
Subgraphs can be connected through things like arguments,
QEQs, and label equalities.
"""
nids = set(self._nodeids) # the nids left to find
if len(nids) == 0:
raise X... | python | {
"resource": ""
} |
q8922 | Xmrs.validate | train | def validate(self):
"""
Check that the Xmrs is well-formed.
The Xmrs is analyzed and a list of problems is compiled. If
any problems exist, an :exc:`XmrsError` is raised with the list
joined as the error message. A well-formed Xmrs has the
following properties:
... | python | {
"resource": ""
} |
q8923 | Mrs.to_dict | train | def to_dict(self, short_pred=True, properties=True):
"""
Encode the Mrs as a dictionary suitable for JSON serialization.
"""
def _lnk(obj): return {'from': obj.cfrom, 'to': obj.cto}
def _ep(ep, short_pred=True):
p = ep.pred.short_form() if short_pred else ep.pred.stri... | python | {
"resource": ""
} |
q8924 | Dmrs.to_dict | train | def to_dict(self, short_pred=True, properties=True):
"""
Encode the Dmrs as a dictionary suitable for JSON serialization.
"""
qs = set(self.nodeids(quantifier=True))
def _lnk(obj): return {'from': obj.cfrom, 'to': obj.cto}
def _node(node, short_pred=True):
p =... | python | {
"resource": ""
} |
q8925 | Dmrs.to_triples | train | def to_triples(self, short_pred=True, properties=True):
"""
Encode the Dmrs as triples suitable for PENMAN serialization.
"""
ts = []
qs = set(self.nodeids(quantifier=True))
for n in nodes(self):
pred = n.pred.short_form() if short_pred else n.pred.string
... | python | {
"resource": ""
} |
q8926 | Invoice.to_array | train | def to_array(self):
"""
Serializes this Invoice to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(Invoice, self).to_array()
array['title'] = u(self.title) # py2: type unicode, py3: type str
array['descript... | python | {
"resource": ""
} |
q8927 | ShippingAddress.to_array | train | def to_array(self):
"""
Serializes this ShippingAddress to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(ShippingAddress, self).to_array()
array['country_code'] = u(self.country_code) # py2: type unicode, py3: ty... | python | {
"resource": ""
} |
q8928 | OrderInfo.to_array | train | def to_array(self):
"""
Serializes this OrderInfo to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(OrderInfo, self).to_array()
if self.name is not None:
array['name'] = u(self.name) # py2: type unicod... | python | {
"resource": ""
} |
q8929 | SuccessfulPayment.to_array | train | def to_array(self):
"""
Serializes this SuccessfulPayment to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(SuccessfulPayment, self).to_array()
array['currency'] = u(self.currency) # py2: type unicode, py3: type s... | python | {
"resource": ""
} |
q8930 | SuccessfulPayment.from_array | train | def from_array(array):
"""
Deserialize a new SuccessfulPayment from a given dictionary.
:return: new SuccessfulPayment instance.
:rtype: SuccessfulPayment
"""
if array is None or not array:
return None
# end if
assert_type_or_raise(array, dict... | python | {
"resource": ""
} |
q8931 | ShippingQuery.to_array | train | def to_array(self):
"""
Serializes this ShippingQuery to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(ShippingQuery, self).to_array()
array['id'] = u(self.id) # py2: type unicode, py3: type str
array['fr... | python | {
"resource": ""
} |
q8932 | ShippingQuery.from_array | train | def from_array(array):
"""
Deserialize a new ShippingQuery from a given dictionary.
:return: new ShippingQuery instance.
:rtype: ShippingQuery
"""
if array is None or not array:
return None
# end if
assert_type_or_raise(array, dict, parameter_... | python | {
"resource": ""
} |
q8933 | PreCheckoutQuery.to_array | train | def to_array(self):
"""
Serializes this PreCheckoutQuery to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(PreCheckoutQuery, self).to_array()
array['id'] = u(self.id) # py2: type unicode, py3: type str
arr... | python | {
"resource": ""
} |
q8934 | PreCheckoutQuery.from_array | train | def from_array(array):
"""
Deserialize a new PreCheckoutQuery from a given dictionary.
:return: new PreCheckoutQuery instance.
:rtype: PreCheckoutQuery
"""
if array is None or not array:
return None
# end if
assert_type_or_raise(array, dict, p... | python | {
"resource": ""
} |
q8935 | InputMediaPhoto.to_array | train | def to_array(self):
"""
Serializes this InputMediaPhoto to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(InputMediaPhoto, self).to_array()
array['type'] = u(self.type) # py2: type unicode, py3: type str
... | python | {
"resource": ""
} |
q8936 | dump | train | def dump(destination, ms, single=False, pretty_print=False, **kwargs):
"""
Serialize Xmrs objects to the Prolog representation and write to a file.
Args:
destination: filename or file object where data will be written
ms: an iterator of Xmrs objects to serialize (unless the
*sin... | python | {
"resource": ""
} |
q8937 | dumps | train | def dumps(ms, single=False, pretty_print=False, **kwargs):
"""
Serialize an Xmrs object to the Prolog representation
Args:
ms: an iterator of Xmrs objects to serialize (unless the
*single* option is `True`)
single: if `True`, treat *ms* as a single Xmrs object instead
... | python | {
"resource": ""
} |
q8938 | convert | train | def convert(path, source_fmt, target_fmt, select='result:mrs',
properties=True, show_status=False, predicate_modifiers=False,
color=False, pretty_print=False, indent=None):
"""
Convert between various DELPH-IN Semantics representations.
Args:
path (str, file): filename, test... | python | {
"resource": ""
} |
q8939 | non_argument_modifiers | train | def non_argument_modifiers(role='ARG1', only_connecting=True):
"""
Return a function that finds non-argument modifier dependencies.
Args:
role (str): the role that is assigned to the dependency
only_connecting (bool): if `True`, only return dependencies
that connect separate com... | python | {
"resource": ""
} |
q8940 | dumps | train | def dumps(ms, single=False,
properties=False, pretty_print=True,
show_status=False, predicate_modifiers=False, **kwargs):
"""
Serialize an Xmrs object to a Eds representation
Args:
ms: an iterator of :class:`~delphin.mrs.xmrs.Xmrs` objects to
serialize (unless the *s... | python | {
"resource": ""
} |
q8941 | Eds.nodes | train | def nodes(self):
"""Return the list of nodes."""
getnode = self._nodes.__getitem__
return [getnode(nid) for nid in self._nodeids] | python | {
"resource": ""
} |
q8942 | Eds.to_dict | train | def to_dict(self, properties=True):
"""
Encode the Eds as a dictionary suitable for JSON serialization.
"""
nodes = {}
for node in self.nodes():
nd = {
'label': node.pred.short_form(),
'edges': self.edges(node.nodeid)
}
... | python | {
"resource": ""
} |
q8943 | Eds.to_triples | train | def to_triples(self, short_pred=True, properties=True):
"""
Encode the Eds as triples suitable for PENMAN serialization.
"""
node_triples, edge_triples = [], []
# sort nodeids just so top var is first
nodes = sorted(self.nodes(), key=lambda n: n.nodeid != self.top)
... | python | {
"resource": ""
} |
q8944 | LookaheadIterator.next | train | def next(self, skip=None):
"""
Remove the next datum from the buffer and return it.
"""
buffer = self._buffer
popleft = buffer.popleft
if skip is not None:
while True:
try:
if not skip(buffer[0]):
bre... | python | {
"resource": ""
} |
q8945 | InlineQueryResultPhoto.to_array | train | def to_array(self):
"""
Serializes this InlineQueryResultPhoto to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(InlineQueryResultPhoto, self).to_array()
array['type'] = u(self.type) # py2: type unicode, py3: type... | python | {
"resource": ""
} |
q8946 | InlineQueryResultMpeg4Gif.to_array | train | def to_array(self):
"""
Serializes this InlineQueryResultMpeg4Gif to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(InlineQueryResultMpeg4Gif, self).to_array()
array['type'] = u(self.type) # py2: type unicode, py3... | python | {
"resource": ""
} |
q8947 | InlineQueryResultVideo.to_array | train | def to_array(self):
"""
Serializes this InlineQueryResultVideo to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(InlineQueryResultVideo, self).to_array()
array['type'] = u(self.type) # py2: type unicode, py3: type... | python | {
"resource": ""
} |
q8948 | InlineQueryResultVoice.to_array | train | def to_array(self):
"""
Serializes this InlineQueryResultVoice to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(InlineQueryResultVoice, self).to_array()
array['type'] = u(self.type) # py2: type unicode, py3: type... | python | {
"resource": ""
} |
q8949 | InlineQueryResultDocument.to_array | train | def to_array(self):
"""
Serializes this InlineQueryResultDocument to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(InlineQueryResultDocument, self).to_array()
array['type'] = u(self.type) # py2: type unicode, py3... | python | {
"resource": ""
} |
q8950 | InlineQueryResultVenue.to_array | train | def to_array(self):
"""
Serializes this InlineQueryResultVenue to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(InlineQueryResultVenue, self).to_array()
array['type'] = u(self.type) # py2: type unicode, py3: type... | python | {
"resource": ""
} |
q8951 | InlineQueryResultCachedPhoto.to_array | train | def to_array(self):
"""
Serializes this InlineQueryResultCachedPhoto to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(InlineQueryResultCachedPhoto, self).to_array()
array['type'] = u(self.type) # py2: type unicod... | python | {
"resource": ""
} |
q8952 | InlineQueryResultCachedMpeg4Gif.to_array | train | def to_array(self):
"""
Serializes this InlineQueryResultCachedMpeg4Gif to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(InlineQueryResultCachedMpeg4Gif, self).to_array()
array['type'] = u(self.type) # py2: type ... | python | {
"resource": ""
} |
q8953 | InlineQueryResultCachedSticker.to_array | train | def to_array(self):
"""
Serializes this InlineQueryResultCachedSticker to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(InlineQueryResultCachedSticker, self).to_array()
array['type'] = u(self.type) # py2: type un... | python | {
"resource": ""
} |
q8954 | InlineQueryResultCachedVideo.to_array | train | def to_array(self):
"""
Serializes this InlineQueryResultCachedVideo to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(InlineQueryResultCachedVideo, self).to_array()
array['type'] = u(self.type) # py2: type unicod... | python | {
"resource": ""
} |
q8955 | InlineQueryResultCachedAudio.to_array | train | def to_array(self):
"""
Serializes this InlineQueryResultCachedAudio to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(InlineQueryResultCachedAudio, self).to_array()
array['type'] = u(self.type) # py2: type unicod... | python | {
"resource": ""
} |
q8956 | MessageEntity.to_array | train | def to_array(self):
"""
Serializes this MessageEntity to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(MessageEntity, self).to_array()
array['type'] = u(self.type) # py2: type unicode, py3: type str
arra... | python | {
"resource": ""
} |
q8957 | PhotoSize.to_array | train | def to_array(self):
"""
Serializes this PhotoSize to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(PhotoSize, self).to_array()
array['file_id'] = u(self.file_id) # py2: type unicode, py3: type str
array[... | python | {
"resource": ""
} |
q8958 | Audio.to_array | train | def to_array(self):
"""
Serializes this Audio to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(Audio, self).to_array()
array['file_id'] = u(self.file_id) # py2: type unicode, py3: type str
array['duratio... | python | {
"resource": ""
} |
q8959 | Audio.from_array | train | def from_array(array):
"""
Deserialize a new Audio from a given dictionary.
:return: new Audio instance.
:rtype: Audio
"""
if array is None or not array:
return None
# end if
assert_type_or_raise(array, dict, parameter_name="array")
fr... | python | {
"resource": ""
} |
q8960 | Document.to_array | train | def to_array(self):
"""
Serializes this Document to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(Document, self).to_array()
array['file_id'] = u(self.file_id) # py2: type unicode, py3: type str
if self.... | python | {
"resource": ""
} |
q8961 | Animation.to_array | train | def to_array(self):
"""
Serializes this Animation to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(Animation, self).to_array()
array['file_id'] = u(self.file_id) # py2: type unicode, py3: type str
array[... | python | {
"resource": ""
} |
q8962 | Voice.to_array | train | def to_array(self):
"""
Serializes this Voice to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(Voice, self).to_array()
array['file_id'] = u(self.file_id) # py2: type unicode, py3: type str
array['duratio... | python | {
"resource": ""
} |
q8963 | VideoNote.to_array | train | def to_array(self):
"""
Serializes this VideoNote to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(VideoNote, self).to_array()
array['file_id'] = u(self.file_id) # py2: type unicode, py3: type str
array[... | python | {
"resource": ""
} |
q8964 | Contact.to_array | train | def to_array(self):
"""
Serializes this Contact to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(Contact, self).to_array()
array['phone_number'] = u(self.phone_number) # py2: type unicode, py3: type str
... | python | {
"resource": ""
} |
q8965 | Location.to_array | train | def to_array(self):
"""
Serializes this Location to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(Location, self).to_array()
array['longitude'] = float(self.longitude) # type float
array['latitude'] = flo... | python | {
"resource": ""
} |
q8966 | Location.from_array | train | def from_array(array):
"""
Deserialize a new Location from a given dictionary.
:return: new Location instance.
:rtype: Location
"""
if array is None or not array:
return None
# end if
assert_type_or_raise(array, dict, parameter_name="array")
... | python | {
"resource": ""
} |
q8967 | Venue.to_array | train | def to_array(self):
"""
Serializes this Venue to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(Venue, self).to_array()
array['location'] = self.location.to_array() # type Location
array['title'] = u(self... | python | {
"resource": ""
} |
q8968 | UserProfilePhotos.to_array | train | def to_array(self):
"""
Serializes this UserProfilePhotos to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(UserProfilePhotos, self).to_array()
array['total_count'] = int(self.total_count) # type int
array... | python | {
"resource": ""
} |
q8969 | File.to_array | train | def to_array(self):
"""
Serializes this File to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(File, self).to_array()
array['file_id'] = u(self.file_id) # py2: type unicode, py3: type str
if self.file_siz... | python | {
"resource": ""
} |
q8970 | ChatPhoto.to_array | train | def to_array(self):
"""
Serializes this ChatPhoto to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(ChatPhoto, self).to_array()
array['small_file_id'] = u(self.small_file_id) # py2: type unicode, py3: type str
... | python | {
"resource": ""
} |
q8971 | Sticker.to_array | train | def to_array(self):
"""
Serializes this Sticker to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(Sticker, self).to_array()
array['file_id'] = u(self.file_id) # py2: type unicode, py3: type str
array['wid... | python | {
"resource": ""
} |
q8972 | Game.to_array | train | def to_array(self):
"""
Serializes this Game to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(Game, self).to_array()
array['title'] = u(self.title) # py2: type unicode, py3: type str
array['description']... | python | {
"resource": ""
} |
q8973 | VideoNote.from_array | train | def from_array(array):
"""
Deserialize a new VideoNote from a given dictionary.
:return: new VideoNote instance.
:rtype: VideoNote
"""
if array is None or not array:
return None
# end if
assert_type_or_raise(array, dict, parameter_name="array"... | python | {
"resource": ""
} |
q8974 | ReplyKeyboardMarkup.to_array | train | def to_array(self):
"""
Serializes this ReplyKeyboardMarkup to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(ReplyKeyboardMarkup, self).to_array()
array['keyboard'] = self._as_array(self.keyboard) # type list of ... | python | {
"resource": ""
} |
q8975 | KeyboardButton.to_array | train | def to_array(self):
"""
Serializes this KeyboardButton to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(KeyboardButton, self).to_array()
array['text'] = u(self.text) # py2: type unicode, py3: type str
if... | python | {
"resource": ""
} |
q8976 | KeyboardButton.from_array | train | def from_array(array):
"""
Deserialize a new KeyboardButton from a given dictionary.
:return: new KeyboardButton instance.
:rtype: KeyboardButton
"""
if array is None or not array:
return None
# end if
assert_type_or_raise(array, dict, paramet... | python | {
"resource": ""
} |
q8977 | ReplyKeyboardRemove.to_array | train | def to_array(self):
"""
Serializes this ReplyKeyboardRemove to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(ReplyKeyboardRemove, self).to_array()
array['remove_keyboard'] = bool(self.remove_keyboard) # type bool... | python | {
"resource": ""
} |
q8978 | InlineKeyboardMarkup.to_array | train | def to_array(self):
"""
Serializes this InlineKeyboardMarkup to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(InlineKeyboardMarkup, self).to_array()
array['inline_keyboard'] = self._as_array(self.inline_keyboard) ... | python | {
"resource": ""
} |
q8979 | InlineKeyboardButton.to_array | train | def to_array(self):
"""
Serializes this InlineKeyboardButton to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(InlineKeyboardButton, self).to_array()
array['text'] = u(self.text) # py2: type unicode, py3: type str... | python | {
"resource": ""
} |
q8980 | InlineKeyboardButton.from_array | train | def from_array(array):
"""
Deserialize a new InlineKeyboardButton from a given dictionary.
:return: new InlineKeyboardButton instance.
:rtype: InlineKeyboardButton
"""
if array is None or not array:
return None
# end if
assert_type_or_raise(ar... | python | {
"resource": ""
} |
q8981 | ForceReply.to_array | train | def to_array(self):
"""
Serializes this ForceReply to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(ForceReply, self).to_array()
array['force_reply'] = bool(self.force_reply) # type bool
if self.selective... | python | {
"resource": ""
} |
q8982 | ForceReply.from_array | train | def from_array(array):
"""
Deserialize a new ForceReply from a given dictionary.
:return: new ForceReply instance.
:rtype: ForceReply
"""
if array is None or not array:
return None
# end if
assert_type_or_raise(array, dict, parameter_name="arr... | python | {
"resource": ""
} |
q8983 | PassportElementErrorDataField.to_array | train | def to_array(self):
"""
Serializes this PassportElementErrorDataField to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(PassportElementErrorDataField, self).to_array()
array['source'] = u(self.source) # py2: type ... | python | {
"resource": ""
} |
q8984 | PassportElementErrorReverseSide.to_array | train | def to_array(self):
"""
Serializes this PassportElementErrorReverseSide to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(PassportElementErrorReverseSide, self).to_array()
array['source'] = u(self.source) # py2: t... | python | {
"resource": ""
} |
q8985 | PassportElementErrorFiles.to_array | train | def to_array(self):
"""
Serializes this PassportElementErrorFiles to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(PassportElementErrorFiles, self).to_array()
array['source'] = u(self.source) # py2: type unicode,... | python | {
"resource": ""
} |
q8986 | PassportElementErrorFiles.from_array | train | def from_array(array):
"""
Deserialize a new PassportElementErrorFiles from a given dictionary.
:return: new PassportElementErrorFiles instance.
:rtype: PassportElementErrorFiles
"""
if array is None or not array:
return None
# end if
assert_t... | python | {
"resource": ""
} |
q8987 | PassportElementErrorUnspecified.to_array | train | def to_array(self):
"""
Serializes this PassportElementErrorUnspecified to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(PassportElementErrorUnspecified, self).to_array()
array['source'] = u(self.source) # py2: t... | python | {
"resource": ""
} |
q8988 | PassportElementErrorUnspecified.from_array | train | def from_array(array):
"""
Deserialize a new PassportElementErrorUnspecified from a given dictionary.
:return: new PassportElementErrorUnspecified instance.
:rtype: PassportElementErrorUnspecified
"""
if array is None or not array:
return None
# end i... | python | {
"resource": ""
} |
q8989 | InlineQuery.to_array | train | def to_array(self):
"""
Serializes this InlineQuery to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(InlineQuery, self).to_array()
array['id'] = u(self.id) # py2: type unicode, py3: type str
array['from']... | python | {
"resource": ""
} |
q8990 | InlineQuery.from_array | train | def from_array(array):
"""
Deserialize a new InlineQuery from a given dictionary.
:return: new InlineQuery instance.
:rtype: InlineQuery
"""
if array is None or not array:
return None
# end if
assert_type_or_raise(array, dict, parameter_name="... | python | {
"resource": ""
} |
q8991 | ChosenInlineResult.to_array | train | def to_array(self):
"""
Serializes this ChosenInlineResult to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(ChosenInlineResult, self).to_array()
array['result_id'] = u(self.result_id) # py2: type unicode, py3: ty... | python | {
"resource": ""
} |
q8992 | ChosenInlineResult.from_array | train | def from_array(array):
"""
Deserialize a new ChosenInlineResult from a given dictionary.
:return: new ChosenInlineResult instance.
:rtype: ChosenInlineResult
"""
if array is None or not array:
return None
# end if
assert_type_or_raise(array, d... | python | {
"resource": ""
} |
q8993 | Update.from_array | train | def from_array(array):
"""
Deserialize a new Update from a given dictionary.
:return: new Update instance.
:rtype: Update
"""
if array is None or not array:
return None
# end if
assert_type_or_raise(array, dict, parameter_name="array")
... | python | {
"resource": ""
} |
q8994 | YyToken.to_dict | train | def to_dict(self):
"""
Encode the token as a dictionary suitable for JSON serialization.
"""
d = {
'id': self.id,
'start': self.start,
'end': self.end,
'form': self.form
}
if self.lnk is not None:
cfrom, cto = se... | python | {
"resource": ""
} |
q8995 | YyTokenLattice.from_string | train | def from_string(cls, s):
"""
Decode from the YY token lattice format.
"""
def _qstrip(s):
return s[1:-1] # remove assumed quote characters
tokens = []
for match in _yy_re.finditer(s):
d = match.groupdict()
lnk, pos = None, []
... | python | {
"resource": ""
} |
q8996 | loads | train | def loads(s, single=False, version=_default_version,
strict=False, errors='warn'):
"""
Deserialize SimpleMRS string representations
Args:
s (str): a SimpleMRS string
single (bool): if `True`, only return the first Xmrs object
Returns:
a generator of Xmrs objects (unles... | python | {
"resource": ""
} |
q8997 | dumps | train | def dumps(ms, single=False, version=_default_version, properties=True,
pretty_print=False, color=False, **kwargs):
"""
Serialize an Xmrs object to a SimpleMRS representation
Args:
ms: an iterator of Xmrs objects to serialize (unless the
*single* option is `True`)
singl... | python | {
"resource": ""
} |
q8998 | _read_lnk | train | def _read_lnk(tokens):
"""Read and return a tuple of the pred's lnk type and lnk value,
if a pred lnk is specified."""
# < FROM : TO > or < FROM # TO > or < TOK... > or < @ EDGE >
lnk = None
if tokens[0] == '<':
tokens.popleft() # we just checked this is a left angle
if tokens[0]... | python | {
"resource": ""
} |
q8999 | serialize | train | def serialize(ms, version=_default_version, properties=True,
pretty_print=False, color=False):
"""Serialize an MRS structure into a SimpleMRS string."""
delim = '\n' if pretty_print else _default_mrs_delim
output = delim.join(
_serialize_mrs(m, properties=properties,
... | python | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.