repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
halcy/Mastodon.py | mastodon/Mastodon.py | Mastodon.search | def search(self, q, resolve=True, result_type=None, account_id=None, offset=None, min_id=None, max_id=None):
"""
Fetch matching hashtags, accounts and statuses. Will perform webfinger
lookups if resolve is True. Full-text search is only enabled if
the instance supports it, and is restric... | python | def search(self, q, resolve=True, result_type=None, account_id=None, offset=None, min_id=None, max_id=None):
"""
Fetch matching hashtags, accounts and statuses. Will perform webfinger
lookups if resolve is True. Full-text search is only enabled if
the instance supports it, and is restric... | [
"def",
"search",
"(",
"self",
",",
"q",
",",
"resolve",
"=",
"True",
",",
"result_type",
"=",
"None",
",",
"account_id",
"=",
"None",
",",
"offset",
"=",
"None",
",",
"min_id",
"=",
"None",
",",
"max_id",
"=",
"None",
")",
":",
"return",
"self",
".... | Fetch matching hashtags, accounts and statuses. Will perform webfinger
lookups if resolve is True. Full-text search is only enabled if
the instance supports it, and is restricted to statuses the logged-in
user wrote or was mentioned in.
`result_type` can be one of "accounts", "h... | [
"Fetch",
"matching",
"hashtags",
"accounts",
"and",
"statuses",
".",
"Will",
"perform",
"webfinger",
"lookups",
"if",
"resolve",
"is",
"True",
".",
"Full",
"-",
"text",
"search",
"is",
"only",
"enabled",
"if",
"the",
"instance",
"supports",
"it",
"and",
"is"... | 35c43562dd3d34d6ebf7a0f757c09e8fcccc957c | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L1110-L1127 | train |
halcy/Mastodon.py | mastodon/Mastodon.py | Mastodon.list | def list(self, id):
"""
Fetch info about a specific list.
Returns a `list dict`_.
"""
id = self.__unpack_id(id)
return self.__api_request('GET', '/api/v1/lists/{0}'.format(id)) | python | def list(self, id):
"""
Fetch info about a specific list.
Returns a `list dict`_.
"""
id = self.__unpack_id(id)
return self.__api_request('GET', '/api/v1/lists/{0}'.format(id)) | [
"def",
"list",
"(",
"self",
",",
"id",
")",
":",
"id",
"=",
"self",
".",
"__unpack_id",
"(",
"id",
")",
"return",
"self",
".",
"__api_request",
"(",
"'GET'",
",",
"'/api/v1/lists/{0}'",
".",
"format",
"(",
"id",
")",
")"
] | Fetch info about a specific list.
Returns a `list dict`_. | [
"Fetch",
"info",
"about",
"a",
"specific",
"list",
".",
"Returns",
"a",
"list",
"dict",
"_",
"."
] | 35c43562dd3d34d6ebf7a0f757c09e8fcccc957c | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L1174-L1181 | train |
halcy/Mastodon.py | mastodon/Mastodon.py | Mastodon.list_accounts | def list_accounts(self, id, max_id=None, min_id=None, since_id=None, limit=None):
"""
Get the accounts that are on the given list. A `limit` of 0 can
be specified to get all accounts without pagination.
Returns a list of `user dicts`_.
"""
id = self.__unpack_id(i... | python | def list_accounts(self, id, max_id=None, min_id=None, since_id=None, limit=None):
"""
Get the accounts that are on the given list. A `limit` of 0 can
be specified to get all accounts without pagination.
Returns a list of `user dicts`_.
"""
id = self.__unpack_id(i... | [
"def",
"list_accounts",
"(",
"self",
",",
"id",
",",
"max_id",
"=",
"None",
",",
"min_id",
"=",
"None",
",",
"since_id",
"=",
"None",
",",
"limit",
"=",
"None",
")",
":",
"id",
"=",
"self",
".",
"__unpack_id",
"(",
"id",
")",
"if",
"max_id",
"!=",
... | Get the accounts that are on the given list. A `limit` of 0 can
be specified to get all accounts without pagination.
Returns a list of `user dicts`_. | [
"Get",
"the",
"accounts",
"that",
"are",
"on",
"the",
"given",
"list",
".",
"A",
"limit",
"of",
"0",
"can",
"be",
"specified",
"to",
"get",
"all",
"accounts",
"without",
"pagination",
".",
"Returns",
"a",
"list",
"of",
"user",
"dicts",
"_",
"."
] | 35c43562dd3d34d6ebf7a0f757c09e8fcccc957c | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L1184-L1203 | train |
halcy/Mastodon.py | mastodon/Mastodon.py | Mastodon.status_reply | def status_reply(self, to_status, status, media_ids=None, sensitive=False, visibility=None,
spoiler_text=None, language=None, idempotency_key=None, content_type=None,
scheduled_at=None, poll=None, untag=False):
"""
Helper function - acts like status_post, but p... | python | def status_reply(self, to_status, status, media_ids=None, sensitive=False, visibility=None,
spoiler_text=None, language=None, idempotency_key=None, content_type=None,
scheduled_at=None, poll=None, untag=False):
"""
Helper function - acts like status_post, but p... | [
"def",
"status_reply",
"(",
"self",
",",
"to_status",
",",
"status",
",",
"media_ids",
"=",
"None",
",",
"sensitive",
"=",
"False",
",",
"visibility",
"=",
"None",
",",
"spoiler_text",
"=",
"None",
",",
"language",
"=",
"None",
",",
"idempotency_key",
"=",... | Helper function - acts like status_post, but prepends the name of all
the users that are being replied to to the status text and retains
CW and visibility if not explicitly overridden.
Set `untag` to True if you want the reply to only go to the user you
are replying to, removing... | [
"Helper",
"function",
"-",
"acts",
"like",
"status_post",
"but",
"prepends",
"the",
"name",
"of",
"all",
"the",
"users",
"that",
"are",
"being",
"replied",
"to",
"to",
"the",
"status",
"text",
"and",
"retains",
"CW",
"and",
"visibility",
"if",
"not",
"expl... | 35c43562dd3d34d6ebf7a0f757c09e8fcccc957c | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L1506-L1541 | train |
halcy/Mastodon.py | mastodon/Mastodon.py | Mastodon.status_delete | def status_delete(self, id):
"""
Delete a status
"""
id = self.__unpack_id(id)
url = '/api/v1/statuses/{0}'.format(str(id))
self.__api_request('DELETE', url) | python | def status_delete(self, id):
"""
Delete a status
"""
id = self.__unpack_id(id)
url = '/api/v1/statuses/{0}'.format(str(id))
self.__api_request('DELETE', url) | [
"def",
"status_delete",
"(",
"self",
",",
"id",
")",
":",
"id",
"=",
"self",
".",
"__unpack_id",
"(",
"id",
")",
"url",
"=",
"'/api/v1/statuses/{0}'",
".",
"format",
"(",
"str",
"(",
"id",
")",
")",
"self",
".",
"__api_request",
"(",
"'DELETE'",
",",
... | Delete a status | [
"Delete",
"a",
"status"
] | 35c43562dd3d34d6ebf7a0f757c09e8fcccc957c | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L1558-L1564 | train |
halcy/Mastodon.py | mastodon/Mastodon.py | Mastodon.status_unreblog | def status_unreblog(self, id):
"""
Un-reblog a status.
Returns a `toot dict`_ with the status that used to be reblogged.
"""
id = self.__unpack_id(id)
url = '/api/v1/statuses/{0}/unreblog'.format(str(id))
return self.__api_request('POST', url) | python | def status_unreblog(self, id):
"""
Un-reblog a status.
Returns a `toot dict`_ with the status that used to be reblogged.
"""
id = self.__unpack_id(id)
url = '/api/v1/statuses/{0}/unreblog'.format(str(id))
return self.__api_request('POST', url) | [
"def",
"status_unreblog",
"(",
"self",
",",
"id",
")",
":",
"id",
"=",
"self",
".",
"__unpack_id",
"(",
"id",
")",
"url",
"=",
"'/api/v1/statuses/{0}/unreblog'",
".",
"format",
"(",
"str",
"(",
"id",
")",
")",
"return",
"self",
".",
"__api_request",
"(",... | Un-reblog a status.
Returns a `toot dict`_ with the status that used to be reblogged. | [
"Un",
"-",
"reblog",
"a",
"status",
"."
] | 35c43562dd3d34d6ebf7a0f757c09e8fcccc957c | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L1589-L1597 | train |
halcy/Mastodon.py | mastodon/Mastodon.py | Mastodon.status_favourite | def status_favourite(self, id):
"""
Favourite a status.
Returns a `toot dict`_ with the favourited status.
"""
id = self.__unpack_id(id)
url = '/api/v1/statuses/{0}/favourite'.format(str(id))
return self.__api_request('POST', url) | python | def status_favourite(self, id):
"""
Favourite a status.
Returns a `toot dict`_ with the favourited status.
"""
id = self.__unpack_id(id)
url = '/api/v1/statuses/{0}/favourite'.format(str(id))
return self.__api_request('POST', url) | [
"def",
"status_favourite",
"(",
"self",
",",
"id",
")",
":",
"id",
"=",
"self",
".",
"__unpack_id",
"(",
"id",
")",
"url",
"=",
"'/api/v1/statuses/{0}/favourite'",
".",
"format",
"(",
"str",
"(",
"id",
")",
")",
"return",
"self",
".",
"__api_request",
"(... | Favourite a status.
Returns a `toot dict`_ with the favourited status. | [
"Favourite",
"a",
"status",
"."
] | 35c43562dd3d34d6ebf7a0f757c09e8fcccc957c | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L1600-L1608 | train |
halcy/Mastodon.py | mastodon/Mastodon.py | Mastodon.status_unfavourite | def status_unfavourite(self, id):
"""
Un-favourite a status.
Returns a `toot dict`_ with the un-favourited status.
"""
id = self.__unpack_id(id)
url = '/api/v1/statuses/{0}/unfavourite'.format(str(id))
return self.__api_request('POST', url) | python | def status_unfavourite(self, id):
"""
Un-favourite a status.
Returns a `toot dict`_ with the un-favourited status.
"""
id = self.__unpack_id(id)
url = '/api/v1/statuses/{0}/unfavourite'.format(str(id))
return self.__api_request('POST', url) | [
"def",
"status_unfavourite",
"(",
"self",
",",
"id",
")",
":",
"id",
"=",
"self",
".",
"__unpack_id",
"(",
"id",
")",
"url",
"=",
"'/api/v1/statuses/{0}/unfavourite'",
".",
"format",
"(",
"str",
"(",
"id",
")",
")",
"return",
"self",
".",
"__api_request",
... | Un-favourite a status.
Returns a `toot dict`_ with the un-favourited status. | [
"Un",
"-",
"favourite",
"a",
"status",
"."
] | 35c43562dd3d34d6ebf7a0f757c09e8fcccc957c | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L1611-L1619 | train |
halcy/Mastodon.py | mastodon/Mastodon.py | Mastodon.status_mute | def status_mute(self, id):
"""
Mute notifications for a status.
Returns a `toot dict`_ with the now muted status
"""
id = self.__unpack_id(id)
url = '/api/v1/statuses/{0}/mute'.format(str(id))
return self.__api_request('POST', url) | python | def status_mute(self, id):
"""
Mute notifications for a status.
Returns a `toot dict`_ with the now muted status
"""
id = self.__unpack_id(id)
url = '/api/v1/statuses/{0}/mute'.format(str(id))
return self.__api_request('POST', url) | [
"def",
"status_mute",
"(",
"self",
",",
"id",
")",
":",
"id",
"=",
"self",
".",
"__unpack_id",
"(",
"id",
")",
"url",
"=",
"'/api/v1/statuses/{0}/mute'",
".",
"format",
"(",
"str",
"(",
"id",
")",
")",
"return",
"self",
".",
"__api_request",
"(",
"'POS... | Mute notifications for a status.
Returns a `toot dict`_ with the now muted status | [
"Mute",
"notifications",
"for",
"a",
"status",
"."
] | 35c43562dd3d34d6ebf7a0f757c09e8fcccc957c | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L1622-L1630 | train |
halcy/Mastodon.py | mastodon/Mastodon.py | Mastodon.status_unmute | def status_unmute(self, id):
"""
Unmute notifications for a status.
Returns a `toot dict`_ with the status that used to be muted.
"""
id = self.__unpack_id(id)
url = '/api/v1/statuses/{0}/unmute'.format(str(id))
return self.__api_request('POST', url) | python | def status_unmute(self, id):
"""
Unmute notifications for a status.
Returns a `toot dict`_ with the status that used to be muted.
"""
id = self.__unpack_id(id)
url = '/api/v1/statuses/{0}/unmute'.format(str(id))
return self.__api_request('POST', url) | [
"def",
"status_unmute",
"(",
"self",
",",
"id",
")",
":",
"id",
"=",
"self",
".",
"__unpack_id",
"(",
"id",
")",
"url",
"=",
"'/api/v1/statuses/{0}/unmute'",
".",
"format",
"(",
"str",
"(",
"id",
")",
")",
"return",
"self",
".",
"__api_request",
"(",
"... | Unmute notifications for a status.
Returns a `toot dict`_ with the status that used to be muted. | [
"Unmute",
"notifications",
"for",
"a",
"status",
"."
] | 35c43562dd3d34d6ebf7a0f757c09e8fcccc957c | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L1633-L1641 | train |
halcy/Mastodon.py | mastodon/Mastodon.py | Mastodon.status_pin | def status_pin(self, id):
"""
Pin a status for the logged-in user.
Returns a `toot dict`_ with the now pinned status
"""
id = self.__unpack_id(id)
url = '/api/v1/statuses/{0}/pin'.format(str(id))
return self.__api_request('POST', url) | python | def status_pin(self, id):
"""
Pin a status for the logged-in user.
Returns a `toot dict`_ with the now pinned status
"""
id = self.__unpack_id(id)
url = '/api/v1/statuses/{0}/pin'.format(str(id))
return self.__api_request('POST', url) | [
"def",
"status_pin",
"(",
"self",
",",
"id",
")",
":",
"id",
"=",
"self",
".",
"__unpack_id",
"(",
"id",
")",
"url",
"=",
"'/api/v1/statuses/{0}/pin'",
".",
"format",
"(",
"str",
"(",
"id",
")",
")",
"return",
"self",
".",
"__api_request",
"(",
"'POST'... | Pin a status for the logged-in user.
Returns a `toot dict`_ with the now pinned status | [
"Pin",
"a",
"status",
"for",
"the",
"logged",
"-",
"in",
"user",
"."
] | 35c43562dd3d34d6ebf7a0f757c09e8fcccc957c | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L1644-L1652 | train |
halcy/Mastodon.py | mastodon/Mastodon.py | Mastodon.status_unpin | def status_unpin(self, id):
"""
Unpin a pinned status for the logged-in user.
Returns a `toot dict`_ with the status that used to be pinned.
"""
id = self.__unpack_id(id)
url = '/api/v1/statuses/{0}/unpin'.format(str(id))
return self.__api_request('POST', url) | python | def status_unpin(self, id):
"""
Unpin a pinned status for the logged-in user.
Returns a `toot dict`_ with the status that used to be pinned.
"""
id = self.__unpack_id(id)
url = '/api/v1/statuses/{0}/unpin'.format(str(id))
return self.__api_request('POST', url) | [
"def",
"status_unpin",
"(",
"self",
",",
"id",
")",
":",
"id",
"=",
"self",
".",
"__unpack_id",
"(",
"id",
")",
"url",
"=",
"'/api/v1/statuses/{0}/unpin'",
".",
"format",
"(",
"str",
"(",
"id",
")",
")",
"return",
"self",
".",
"__api_request",
"(",
"'P... | Unpin a pinned status for the logged-in user.
Returns a `toot dict`_ with the status that used to be pinned. | [
"Unpin",
"a",
"pinned",
"status",
"for",
"the",
"logged",
"-",
"in",
"user",
"."
] | 35c43562dd3d34d6ebf7a0f757c09e8fcccc957c | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L1655-L1663 | train |
halcy/Mastodon.py | mastodon/Mastodon.py | Mastodon.scheduled_status_update | def scheduled_status_update(self, id, scheduled_at):
"""
Update the scheduled time of a scheduled status.
New time must be at least 5 minutes into the future.
Returns a `scheduled toot dict`_
"""
scheduled_at = self.__consistent_isoformat_utc(scheduled_a... | python | def scheduled_status_update(self, id, scheduled_at):
"""
Update the scheduled time of a scheduled status.
New time must be at least 5 minutes into the future.
Returns a `scheduled toot dict`_
"""
scheduled_at = self.__consistent_isoformat_utc(scheduled_a... | [
"def",
"scheduled_status_update",
"(",
"self",
",",
"id",
",",
"scheduled_at",
")",
":",
"scheduled_at",
"=",
"self",
".",
"__consistent_isoformat_utc",
"(",
"scheduled_at",
")",
"id",
"=",
"self",
".",
"__unpack_id",
"(",
"id",
")",
"params",
"=",
"self",
"... | Update the scheduled time of a scheduled status.
New time must be at least 5 minutes into the future.
Returns a `scheduled toot dict`_ | [
"Update",
"the",
"scheduled",
"time",
"of",
"a",
"scheduled",
"status",
".",
"New",
"time",
"must",
"be",
"at",
"least",
"5",
"minutes",
"into",
"the",
"future",
".",
"Returns",
"a",
"scheduled",
"toot",
"dict",
"_"
] | 35c43562dd3d34d6ebf7a0f757c09e8fcccc957c | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L1669-L1681 | train |
halcy/Mastodon.py | mastodon/Mastodon.py | Mastodon.scheduled_status_delete | def scheduled_status_delete(self, id):
"""
Deletes a scheduled status.
"""
id = self.__unpack_id(id)
url = '/api/v1/scheduled_statuses/{0}'.format(str(id))
self.__api_request('DELETE', url) | python | def scheduled_status_delete(self, id):
"""
Deletes a scheduled status.
"""
id = self.__unpack_id(id)
url = '/api/v1/scheduled_statuses/{0}'.format(str(id))
self.__api_request('DELETE', url) | [
"def",
"scheduled_status_delete",
"(",
"self",
",",
"id",
")",
":",
"id",
"=",
"self",
".",
"__unpack_id",
"(",
"id",
")",
"url",
"=",
"'/api/v1/scheduled_statuses/{0}'",
".",
"format",
"(",
"str",
"(",
"id",
")",
")",
"self",
".",
"__api_request",
"(",
... | Deletes a scheduled status. | [
"Deletes",
"a",
"scheduled",
"status",
"."
] | 35c43562dd3d34d6ebf7a0f757c09e8fcccc957c | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L1684-L1690 | train |
halcy/Mastodon.py | mastodon/Mastodon.py | Mastodon.poll_vote | def poll_vote(self, id, choices):
"""
Vote in the given poll.
`choices` is the index of the choice you wish to register a vote for
(i.e. its index in the corresponding polls `options` field. In case
of a poll that allows selection of more than one option, a list of
... | python | def poll_vote(self, id, choices):
"""
Vote in the given poll.
`choices` is the index of the choice you wish to register a vote for
(i.e. its index in the corresponding polls `options` field. In case
of a poll that allows selection of more than one option, a list of
... | [
"def",
"poll_vote",
"(",
"self",
",",
"id",
",",
"choices",
")",
":",
"id",
"=",
"self",
".",
"__unpack_id",
"(",
"id",
")",
"if",
"not",
"isinstance",
"(",
"choices",
",",
"list",
")",
":",
"choices",
"=",
"[",
"choices",
"]",
"params",
"=",
"self... | Vote in the given poll.
`choices` is the index of the choice you wish to register a vote for
(i.e. its index in the corresponding polls `options` field. In case
of a poll that allows selection of more than one option, a list of
indices can be passed.
You can o... | [
"Vote",
"in",
"the",
"given",
"poll",
".",
"choices",
"is",
"the",
"index",
"of",
"the",
"choice",
"you",
"wish",
"to",
"register",
"a",
"vote",
"for",
"(",
"i",
".",
"e",
".",
"its",
"index",
"in",
"the",
"corresponding",
"polls",
"options",
"field",
... | 35c43562dd3d34d6ebf7a0f757c09e8fcccc957c | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L1696-L1717 | train |
halcy/Mastodon.py | mastodon/Mastodon.py | Mastodon.notifications_dismiss | def notifications_dismiss(self, id):
"""
Deletes a single notification
"""
id = self.__unpack_id(id)
params = self.__generate_params(locals())
self.__api_request('POST', '/api/v1/notifications/dismiss', params) | python | def notifications_dismiss(self, id):
"""
Deletes a single notification
"""
id = self.__unpack_id(id)
params = self.__generate_params(locals())
self.__api_request('POST', '/api/v1/notifications/dismiss', params) | [
"def",
"notifications_dismiss",
"(",
"self",
",",
"id",
")",
":",
"id",
"=",
"self",
".",
"__unpack_id",
"(",
"id",
")",
"params",
"=",
"self",
".",
"__generate_params",
"(",
"locals",
"(",
")",
")",
"self",
".",
"__api_request",
"(",
"'POST'",
",",
"'... | Deletes a single notification | [
"Deletes",
"a",
"single",
"notification"
] | 35c43562dd3d34d6ebf7a0f757c09e8fcccc957c | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L1732-L1738 | train |
halcy/Mastodon.py | mastodon/Mastodon.py | Mastodon.account_block | def account_block(self, id):
"""
Block a user.
Returns a `relationship dict`_ containing the updated relationship to the user.
"""
id = self.__unpack_id(id)
url = '/api/v1/accounts/{0}/block'.format(str(id))
return self.__api_request('POST', url) | python | def account_block(self, id):
"""
Block a user.
Returns a `relationship dict`_ containing the updated relationship to the user.
"""
id = self.__unpack_id(id)
url = '/api/v1/accounts/{0}/block'.format(str(id))
return self.__api_request('POST', url) | [
"def",
"account_block",
"(",
"self",
",",
"id",
")",
":",
"id",
"=",
"self",
".",
"__unpack_id",
"(",
"id",
")",
"url",
"=",
"'/api/v1/accounts/{0}/block'",
".",
"format",
"(",
"str",
"(",
"id",
")",
")",
"return",
"self",
".",
"__api_request",
"(",
"'... | Block a user.
Returns a `relationship dict`_ containing the updated relationship to the user. | [
"Block",
"a",
"user",
"."
] | 35c43562dd3d34d6ebf7a0f757c09e8fcccc957c | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L1801-L1809 | train |
halcy/Mastodon.py | mastodon/Mastodon.py | Mastodon.account_unblock | def account_unblock(self, id):
"""
Unblock a user.
Returns a `relationship dict`_ containing the updated relationship to the user.
"""
id = self.__unpack_id(id)
url = '/api/v1/accounts/{0}/unblock'.format(str(id))
return self.__api_request('POST', url) | python | def account_unblock(self, id):
"""
Unblock a user.
Returns a `relationship dict`_ containing the updated relationship to the user.
"""
id = self.__unpack_id(id)
url = '/api/v1/accounts/{0}/unblock'.format(str(id))
return self.__api_request('POST', url) | [
"def",
"account_unblock",
"(",
"self",
",",
"id",
")",
":",
"id",
"=",
"self",
".",
"__unpack_id",
"(",
"id",
")",
"url",
"=",
"'/api/v1/accounts/{0}/unblock'",
".",
"format",
"(",
"str",
"(",
"id",
")",
")",
"return",
"self",
".",
"__api_request",
"(",
... | Unblock a user.
Returns a `relationship dict`_ containing the updated relationship to the user. | [
"Unblock",
"a",
"user",
"."
] | 35c43562dd3d34d6ebf7a0f757c09e8fcccc957c | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L1812-L1820 | train |
halcy/Mastodon.py | mastodon/Mastodon.py | Mastodon.account_mute | def account_mute(self, id, notifications=True):
"""
Mute a user.
Set `notifications` to False to receive notifications even though the user is
muted from timelines.
Returns a `relationship dict`_ containing the updated relationship to the user.
"""
id = self.__u... | python | def account_mute(self, id, notifications=True):
"""
Mute a user.
Set `notifications` to False to receive notifications even though the user is
muted from timelines.
Returns a `relationship dict`_ containing the updated relationship to the user.
"""
id = self.__u... | [
"def",
"account_mute",
"(",
"self",
",",
"id",
",",
"notifications",
"=",
"True",
")",
":",
"id",
"=",
"self",
".",
"__unpack_id",
"(",
"id",
")",
"params",
"=",
"self",
".",
"__generate_params",
"(",
"locals",
"(",
")",
",",
"[",
"'id'",
"]",
")",
... | Mute a user.
Set `notifications` to False to receive notifications even though the user is
muted from timelines.
Returns a `relationship dict`_ containing the updated relationship to the user. | [
"Mute",
"a",
"user",
"."
] | 35c43562dd3d34d6ebf7a0f757c09e8fcccc957c | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L1823-L1835 | train |
halcy/Mastodon.py | mastodon/Mastodon.py | Mastodon.account_unmute | def account_unmute(self, id):
"""
Unmute a user.
Returns a `relationship dict`_ containing the updated relationship to the user.
"""
id = self.__unpack_id(id)
url = '/api/v1/accounts/{0}/unmute'.format(str(id))
return self.__api_request('POST', url) | python | def account_unmute(self, id):
"""
Unmute a user.
Returns a `relationship dict`_ containing the updated relationship to the user.
"""
id = self.__unpack_id(id)
url = '/api/v1/accounts/{0}/unmute'.format(str(id))
return self.__api_request('POST', url) | [
"def",
"account_unmute",
"(",
"self",
",",
"id",
")",
":",
"id",
"=",
"self",
".",
"__unpack_id",
"(",
"id",
")",
"url",
"=",
"'/api/v1/accounts/{0}/unmute'",
".",
"format",
"(",
"str",
"(",
"id",
")",
")",
"return",
"self",
".",
"__api_request",
"(",
... | Unmute a user.
Returns a `relationship dict`_ containing the updated relationship to the user. | [
"Unmute",
"a",
"user",
"."
] | 35c43562dd3d34d6ebf7a0f757c09e8fcccc957c | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L1838-L1846 | train |
halcy/Mastodon.py | mastodon/Mastodon.py | Mastodon.account_update_credentials | def account_update_credentials(self, display_name=None, note=None,
avatar=None, avatar_mime_type=None,
header=None, header_mime_type=None,
locked=None, fields=None):
"""
Update the profile for the c... | python | def account_update_credentials(self, display_name=None, note=None,
avatar=None, avatar_mime_type=None,
header=None, header_mime_type=None,
locked=None, fields=None):
"""
Update the profile for the c... | [
"def",
"account_update_credentials",
"(",
"self",
",",
"display_name",
"=",
"None",
",",
"note",
"=",
"None",
",",
"avatar",
"=",
"None",
",",
"avatar_mime_type",
"=",
"None",
",",
"header",
"=",
"None",
",",
"header_mime_type",
"=",
"None",
",",
"locked",
... | Update the profile for the currently logged-in user.
'note' is the user's bio.
'avatar' and 'header' are images. As with media uploads, it is possible to either
pass image data and a mime type, or a filename of an image file, for either.
'locked' specifies whether the user nee... | [
"Update",
"the",
"profile",
"for",
"the",
"currently",
"logged",
"-",
"in",
"user",
"."
] | 35c43562dd3d34d6ebf7a0f757c09e8fcccc957c | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L1849-L1913 | train |
halcy/Mastodon.py | mastodon/Mastodon.py | Mastodon.filter_create | def filter_create(self, phrase, context, irreversible = False, whole_word = True, expires_in = None):
"""
Creates a new keyword filter. `phrase` is the phrase that should be
filtered out, `context` specifies from where to filter the keywords.
Valid contexts are 'home', 'notifications', '... | python | def filter_create(self, phrase, context, irreversible = False, whole_word = True, expires_in = None):
"""
Creates a new keyword filter. `phrase` is the phrase that should be
filtered out, `context` specifies from where to filter the keywords.
Valid contexts are 'home', 'notifications', '... | [
"def",
"filter_create",
"(",
"self",
",",
"phrase",
",",
"context",
",",
"irreversible",
"=",
"False",
",",
"whole_word",
"=",
"True",
",",
"expires_in",
"=",
"None",
")",
":",
"params",
"=",
"self",
".",
"__generate_params",
"(",
"locals",
"(",
")",
")"... | Creates a new keyword filter. `phrase` is the phrase that should be
filtered out, `context` specifies from where to filter the keywords.
Valid contexts are 'home', 'notifications', 'public' and 'thread'.
Set `irreversible` to True if you want the filter to just delete statuses
s... | [
"Creates",
"a",
"new",
"keyword",
"filter",
".",
"phrase",
"is",
"the",
"phrase",
"that",
"should",
"be",
"filtered",
"out",
"context",
"specifies",
"from",
"where",
"to",
"filter",
"the",
"keywords",
".",
"Valid",
"contexts",
"are",
"home",
"notifications",
... | 35c43562dd3d34d6ebf7a0f757c09e8fcccc957c | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L1942-L1965 | train |
halcy/Mastodon.py | mastodon/Mastodon.py | Mastodon.filter_delete | def filter_delete(self, id):
"""
Deletes the filter with the given `id`.
"""
id = self.__unpack_id(id)
url = '/api/v1/filters/{0}'.format(str(id))
self.__api_request('DELETE', url) | python | def filter_delete(self, id):
"""
Deletes the filter with the given `id`.
"""
id = self.__unpack_id(id)
url = '/api/v1/filters/{0}'.format(str(id))
self.__api_request('DELETE', url) | [
"def",
"filter_delete",
"(",
"self",
",",
"id",
")",
":",
"id",
"=",
"self",
".",
"__unpack_id",
"(",
"id",
")",
"url",
"=",
"'/api/v1/filters/{0}'",
".",
"format",
"(",
"str",
"(",
"id",
")",
")",
"self",
".",
"__api_request",
"(",
"'DELETE'",
",",
... | Deletes the filter with the given `id`. | [
"Deletes",
"the",
"filter",
"with",
"the",
"given",
"id",
"."
] | 35c43562dd3d34d6ebf7a0f757c09e8fcccc957c | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L1981-L1987 | train |
halcy/Mastodon.py | mastodon/Mastodon.py | Mastodon.suggestion_delete | def suggestion_delete(self, account_id):
"""
Remove the user with the given `account_id` from the follow suggestions.
"""
account_id = self.__unpack_id(account_id)
url = '/api/v1/suggestions/{0}'.format(str(account_id))
self.__api_request('DELETE', url) | python | def suggestion_delete(self, account_id):
"""
Remove the user with the given `account_id` from the follow suggestions.
"""
account_id = self.__unpack_id(account_id)
url = '/api/v1/suggestions/{0}'.format(str(account_id))
self.__api_request('DELETE', url) | [
"def",
"suggestion_delete",
"(",
"self",
",",
"account_id",
")",
":",
"account_id",
"=",
"self",
".",
"__unpack_id",
"(",
"account_id",
")",
"url",
"=",
"'/api/v1/suggestions/{0}'",
".",
"format",
"(",
"str",
"(",
"account_id",
")",
")",
"self",
".",
"__api_... | Remove the user with the given `account_id` from the follow suggestions. | [
"Remove",
"the",
"user",
"with",
"the",
"given",
"account_id",
"from",
"the",
"follow",
"suggestions",
"."
] | 35c43562dd3d34d6ebf7a0f757c09e8fcccc957c | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L1993-L1999 | train |
halcy/Mastodon.py | mastodon/Mastodon.py | Mastodon.list_create | def list_create(self, title):
"""
Create a new list with the given `title`.
Returns the `list dict`_ of the created list.
"""
params = self.__generate_params(locals())
return self.__api_request('POST', '/api/v1/lists', params) | python | def list_create(self, title):
"""
Create a new list with the given `title`.
Returns the `list dict`_ of the created list.
"""
params = self.__generate_params(locals())
return self.__api_request('POST', '/api/v1/lists', params) | [
"def",
"list_create",
"(",
"self",
",",
"title",
")",
":",
"params",
"=",
"self",
".",
"__generate_params",
"(",
"locals",
"(",
")",
")",
"return",
"self",
".",
"__api_request",
"(",
"'POST'",
",",
"'/api/v1/lists'",
",",
"params",
")"
] | Create a new list with the given `title`.
Returns the `list dict`_ of the created list. | [
"Create",
"a",
"new",
"list",
"with",
"the",
"given",
"title",
".",
"Returns",
"the",
"list",
"dict",
"_",
"of",
"the",
"created",
"list",
"."
] | 35c43562dd3d34d6ebf7a0f757c09e8fcccc957c | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L2005-L2012 | train |
halcy/Mastodon.py | mastodon/Mastodon.py | Mastodon.list_update | def list_update(self, id, title):
"""
Update info about a list, where "info" is really the lists `title`.
Returns the `list dict`_ of the modified list.
"""
id = self.__unpack_id(id)
params = self.__generate_params(locals(), ['id'])
return self.__api_requ... | python | def list_update(self, id, title):
"""
Update info about a list, where "info" is really the lists `title`.
Returns the `list dict`_ of the modified list.
"""
id = self.__unpack_id(id)
params = self.__generate_params(locals(), ['id'])
return self.__api_requ... | [
"def",
"list_update",
"(",
"self",
",",
"id",
",",
"title",
")",
":",
"id",
"=",
"self",
".",
"__unpack_id",
"(",
"id",
")",
"params",
"=",
"self",
".",
"__generate_params",
"(",
"locals",
"(",
")",
",",
"[",
"'id'",
"]",
")",
"return",
"self",
"."... | Update info about a list, where "info" is really the lists `title`.
Returns the `list dict`_ of the modified list. | [
"Update",
"info",
"about",
"a",
"list",
"where",
"info",
"is",
"really",
"the",
"lists",
"title",
".",
"Returns",
"the",
"list",
"dict",
"_",
"of",
"the",
"modified",
"list",
"."
] | 35c43562dd3d34d6ebf7a0f757c09e8fcccc957c | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L2015-L2023 | train |
halcy/Mastodon.py | mastodon/Mastodon.py | Mastodon.list_delete | def list_delete(self, id):
"""
Delete a list.
"""
id = self.__unpack_id(id)
self.__api_request('DELETE', '/api/v1/lists/{0}'.format(id)) | python | def list_delete(self, id):
"""
Delete a list.
"""
id = self.__unpack_id(id)
self.__api_request('DELETE', '/api/v1/lists/{0}'.format(id)) | [
"def",
"list_delete",
"(",
"self",
",",
"id",
")",
":",
"id",
"=",
"self",
".",
"__unpack_id",
"(",
"id",
")",
"self",
".",
"__api_request",
"(",
"'DELETE'",
",",
"'/api/v1/lists/{0}'",
".",
"format",
"(",
"id",
")",
")"
] | Delete a list. | [
"Delete",
"a",
"list",
"."
] | 35c43562dd3d34d6ebf7a0f757c09e8fcccc957c | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L2026-L2031 | train |
halcy/Mastodon.py | mastodon/Mastodon.py | Mastodon.report | def report(self, account_id, status_ids = None, comment = None, forward = False):
"""
Report statuses to the instances administrators.
Accepts a list of toot IDs associated with the report, and a comment.
Set forward to True to forward a report of a remote user to that users
... | python | def report(self, account_id, status_ids = None, comment = None, forward = False):
"""
Report statuses to the instances administrators.
Accepts a list of toot IDs associated with the report, and a comment.
Set forward to True to forward a report of a remote user to that users
... | [
"def",
"report",
"(",
"self",
",",
"account_id",
",",
"status_ids",
"=",
"None",
",",
"comment",
"=",
"None",
",",
"forward",
"=",
"False",
")",
":",
"account_id",
"=",
"self",
".",
"__unpack_id",
"(",
"account_id",
")",
"if",
"not",
"status_ids",
"is",
... | Report statuses to the instances administrators.
Accepts a list of toot IDs associated with the report, and a comment.
Set forward to True to forward a report of a remote user to that users
instance as well as sending it to the instance local administrators.
Returns a `report ... | [
"Report",
"statuses",
"to",
"the",
"instances",
"administrators",
"."
] | 35c43562dd3d34d6ebf7a0f757c09e8fcccc957c | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L2065-L2088 | train |
halcy/Mastodon.py | mastodon/Mastodon.py | Mastodon.follow_request_authorize | def follow_request_authorize(self, id):
"""
Accept an incoming follow request.
"""
id = self.__unpack_id(id)
url = '/api/v1/follow_requests/{0}/authorize'.format(str(id))
self.__api_request('POST', url) | python | def follow_request_authorize(self, id):
"""
Accept an incoming follow request.
"""
id = self.__unpack_id(id)
url = '/api/v1/follow_requests/{0}/authorize'.format(str(id))
self.__api_request('POST', url) | [
"def",
"follow_request_authorize",
"(",
"self",
",",
"id",
")",
":",
"id",
"=",
"self",
".",
"__unpack_id",
"(",
"id",
")",
"url",
"=",
"'/api/v1/follow_requests/{0}/authorize'",
".",
"format",
"(",
"str",
"(",
"id",
")",
")",
"self",
".",
"__api_request",
... | Accept an incoming follow request. | [
"Accept",
"an",
"incoming",
"follow",
"request",
"."
] | 35c43562dd3d34d6ebf7a0f757c09e8fcccc957c | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L2094-L2100 | train |
halcy/Mastodon.py | mastodon/Mastodon.py | Mastodon.follow_request_reject | def follow_request_reject(self, id):
"""
Reject an incoming follow request.
"""
id = self.__unpack_id(id)
url = '/api/v1/follow_requests/{0}/reject'.format(str(id))
self.__api_request('POST', url) | python | def follow_request_reject(self, id):
"""
Reject an incoming follow request.
"""
id = self.__unpack_id(id)
url = '/api/v1/follow_requests/{0}/reject'.format(str(id))
self.__api_request('POST', url) | [
"def",
"follow_request_reject",
"(",
"self",
",",
"id",
")",
":",
"id",
"=",
"self",
".",
"__unpack_id",
"(",
"id",
")",
"url",
"=",
"'/api/v1/follow_requests/{0}/reject'",
".",
"format",
"(",
"str",
"(",
"id",
")",
")",
"self",
".",
"__api_request",
"(",
... | Reject an incoming follow request. | [
"Reject",
"an",
"incoming",
"follow",
"request",
"."
] | 35c43562dd3d34d6ebf7a0f757c09e8fcccc957c | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L2103-L2109 | train |
halcy/Mastodon.py | mastodon/Mastodon.py | Mastodon.domain_block | def domain_block(self, domain=None):
"""
Add a block for all statuses originating from the specified domain for the logged-in user.
"""
params = self.__generate_params(locals())
self.__api_request('POST', '/api/v1/domain_blocks', params) | python | def domain_block(self, domain=None):
"""
Add a block for all statuses originating from the specified domain for the logged-in user.
"""
params = self.__generate_params(locals())
self.__api_request('POST', '/api/v1/domain_blocks', params) | [
"def",
"domain_block",
"(",
"self",
",",
"domain",
"=",
"None",
")",
":",
"params",
"=",
"self",
".",
"__generate_params",
"(",
"locals",
"(",
")",
")",
"self",
".",
"__api_request",
"(",
"'POST'",
",",
"'/api/v1/domain_blocks'",
",",
"params",
")"
] | Add a block for all statuses originating from the specified domain for the logged-in user. | [
"Add",
"a",
"block",
"for",
"all",
"statuses",
"originating",
"from",
"the",
"specified",
"domain",
"for",
"the",
"logged",
"-",
"in",
"user",
"."
] | 35c43562dd3d34d6ebf7a0f757c09e8fcccc957c | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L2174-L2179 | train |
halcy/Mastodon.py | mastodon/Mastodon.py | Mastodon.domain_unblock | def domain_unblock(self, domain=None):
"""
Remove a domain block for the logged-in user.
"""
params = self.__generate_params(locals())
self.__api_request('DELETE', '/api/v1/domain_blocks', params) | python | def domain_unblock(self, domain=None):
"""
Remove a domain block for the logged-in user.
"""
params = self.__generate_params(locals())
self.__api_request('DELETE', '/api/v1/domain_blocks', params) | [
"def",
"domain_unblock",
"(",
"self",
",",
"domain",
"=",
"None",
")",
":",
"params",
"=",
"self",
".",
"__generate_params",
"(",
"locals",
"(",
")",
")",
"self",
".",
"__api_request",
"(",
"'DELETE'",
",",
"'/api/v1/domain_blocks'",
",",
"params",
")"
] | Remove a domain block for the logged-in user. | [
"Remove",
"a",
"domain",
"block",
"for",
"the",
"logged",
"-",
"in",
"user",
"."
] | 35c43562dd3d34d6ebf7a0f757c09e8fcccc957c | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L2182-L2187 | train |
halcy/Mastodon.py | mastodon/Mastodon.py | Mastodon.push_subscription_update | def push_subscription_update(self, follow_events=None,
favourite_events=None, reblog_events=None,
mention_events=None):
"""
Modifies what kind of events the app wishes to subscribe to.
Returns the updated `push subscription d... | python | def push_subscription_update(self, follow_events=None,
favourite_events=None, reblog_events=None,
mention_events=None):
"""
Modifies what kind of events the app wishes to subscribe to.
Returns the updated `push subscription d... | [
"def",
"push_subscription_update",
"(",
"self",
",",
"follow_events",
"=",
"None",
",",
"favourite_events",
"=",
"None",
",",
"reblog_events",
"=",
"None",
",",
"mention_events",
"=",
"None",
")",
":",
"params",
"=",
"{",
"}",
"if",
"follow_events",
"!=",
"N... | Modifies what kind of events the app wishes to subscribe to.
Returns the updated `push subscription dict`_. | [
"Modifies",
"what",
"kind",
"of",
"events",
"the",
"app",
"wishes",
"to",
"subscribe",
"to",
".",
"Returns",
"the",
"updated",
"push",
"subscription",
"dict",
"_",
"."
] | 35c43562dd3d34d6ebf7a0f757c09e8fcccc957c | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L2235-L2257 | train |
halcy/Mastodon.py | mastodon/Mastodon.py | Mastodon.stream_user | def stream_user(self, listener, run_async=False, timeout=__DEFAULT_STREAM_TIMEOUT, reconnect_async=False, reconnect_async_wait_sec=__DEFAULT_STREAM_RECONNECT_WAIT_SEC):
"""
Streams events that are relevant to the authorized user, i.e. home
timeline and notifications.
"""
return s... | python | def stream_user(self, listener, run_async=False, timeout=__DEFAULT_STREAM_TIMEOUT, reconnect_async=False, reconnect_async_wait_sec=__DEFAULT_STREAM_RECONNECT_WAIT_SEC):
"""
Streams events that are relevant to the authorized user, i.e. home
timeline and notifications.
"""
return s... | [
"def",
"stream_user",
"(",
"self",
",",
"listener",
",",
"run_async",
"=",
"False",
",",
"timeout",
"=",
"__DEFAULT_STREAM_TIMEOUT",
",",
"reconnect_async",
"=",
"False",
",",
"reconnect_async_wait_sec",
"=",
"__DEFAULT_STREAM_RECONNECT_WAIT_SEC",
")",
":",
"return",
... | Streams events that are relevant to the authorized user, i.e. home
timeline and notifications. | [
"Streams",
"events",
"that",
"are",
"relevant",
"to",
"the",
"authorized",
"user",
"i",
".",
"e",
".",
"home",
"timeline",
"and",
"notifications",
"."
] | 35c43562dd3d34d6ebf7a0f757c09e8fcccc957c | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L2393-L2398 | train |
halcy/Mastodon.py | mastodon/Mastodon.py | Mastodon.stream_hashtag | def stream_hashtag(self, tag, listener, run_async=False, timeout=__DEFAULT_STREAM_TIMEOUT, reconnect_async=False, reconnect_async_wait_sec=__DEFAULT_STREAM_RECONNECT_WAIT_SEC):
"""
Stream for all public statuses for the hashtag 'tag' seen by the connected
instance.
"""
if tag.sta... | python | def stream_hashtag(self, tag, listener, run_async=False, timeout=__DEFAULT_STREAM_TIMEOUT, reconnect_async=False, reconnect_async_wait_sec=__DEFAULT_STREAM_RECONNECT_WAIT_SEC):
"""
Stream for all public statuses for the hashtag 'tag' seen by the connected
instance.
"""
if tag.sta... | [
"def",
"stream_hashtag",
"(",
"self",
",",
"tag",
",",
"listener",
",",
"run_async",
"=",
"False",
",",
"timeout",
"=",
"__DEFAULT_STREAM_TIMEOUT",
",",
"reconnect_async",
"=",
"False",
",",
"reconnect_async_wait_sec",
"=",
"__DEFAULT_STREAM_RECONNECT_WAIT_SEC",
")",
... | Stream for all public statuses for the hashtag 'tag' seen by the connected
instance. | [
"Stream",
"for",
"all",
"public",
"statuses",
"for",
"the",
"hashtag",
"tag",
"seen",
"by",
"the",
"connected",
"instance",
"."
] | 35c43562dd3d34d6ebf7a0f757c09e8fcccc957c | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L2415-L2422 | train |
halcy/Mastodon.py | mastodon/Mastodon.py | Mastodon.stream_list | def stream_list(self, id, listener, run_async=False, timeout=__DEFAULT_STREAM_TIMEOUT, reconnect_async=False, reconnect_async_wait_sec=__DEFAULT_STREAM_RECONNECT_WAIT_SEC):
"""
Stream events for the current user, restricted to accounts on the given
list.
"""
id = self.__unpack_... | python | def stream_list(self, id, listener, run_async=False, timeout=__DEFAULT_STREAM_TIMEOUT, reconnect_async=False, reconnect_async_wait_sec=__DEFAULT_STREAM_RECONNECT_WAIT_SEC):
"""
Stream events for the current user, restricted to accounts on the given
list.
"""
id = self.__unpack_... | [
"def",
"stream_list",
"(",
"self",
",",
"id",
",",
"listener",
",",
"run_async",
"=",
"False",
",",
"timeout",
"=",
"__DEFAULT_STREAM_TIMEOUT",
",",
"reconnect_async",
"=",
"False",
",",
"reconnect_async_wait_sec",
"=",
"__DEFAULT_STREAM_RECONNECT_WAIT_SEC",
")",
":... | Stream events for the current user, restricted to accounts on the given
list. | [
"Stream",
"events",
"for",
"the",
"current",
"user",
"restricted",
"to",
"accounts",
"on",
"the",
"given",
"list",
"."
] | 35c43562dd3d34d6ebf7a0f757c09e8fcccc957c | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L2425-L2431 | train |
halcy/Mastodon.py | mastodon/Mastodon.py | Mastodon.__datetime_to_epoch | def __datetime_to_epoch(self, date_time):
"""
Converts a python datetime to unix epoch, accounting for
time zones and such.
Assumes UTC if timezone is not given.
"""
date_time_utc = None
if date_time.tzinfo is None:
date_time_utc = date_time.replace(t... | python | def __datetime_to_epoch(self, date_time):
"""
Converts a python datetime to unix epoch, accounting for
time zones and such.
Assumes UTC if timezone is not given.
"""
date_time_utc = None
if date_time.tzinfo is None:
date_time_utc = date_time.replace(t... | [
"def",
"__datetime_to_epoch",
"(",
"self",
",",
"date_time",
")",
":",
"date_time_utc",
"=",
"None",
"if",
"date_time",
".",
"tzinfo",
"is",
"None",
":",
"date_time_utc",
"=",
"date_time",
".",
"replace",
"(",
"tzinfo",
"=",
"pytz",
".",
"utc",
")",
"else"... | Converts a python datetime to unix epoch, accounting for
time zones and such.
Assumes UTC if timezone is not given. | [
"Converts",
"a",
"python",
"datetime",
"to",
"unix",
"epoch",
"accounting",
"for",
"time",
"zones",
"and",
"such",
"."
] | 35c43562dd3d34d6ebf7a0f757c09e8fcccc957c | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L2443-L2458 | train |
halcy/Mastodon.py | mastodon/Mastodon.py | Mastodon.__get_logged_in_id | def __get_logged_in_id(self):
"""
Fetch the logged in users ID, with caching. ID is reset on calls to log_in.
"""
if self.__logged_in_id == None:
self.__logged_in_id = self.account_verify_credentials().id
return self.__logged_in_id | python | def __get_logged_in_id(self):
"""
Fetch the logged in users ID, with caching. ID is reset on calls to log_in.
"""
if self.__logged_in_id == None:
self.__logged_in_id = self.account_verify_credentials().id
return self.__logged_in_id | [
"def",
"__get_logged_in_id",
"(",
"self",
")",
":",
"if",
"self",
".",
"__logged_in_id",
"==",
"None",
":",
"self",
".",
"__logged_in_id",
"=",
"self",
".",
"account_verify_credentials",
"(",
")",
".",
"id",
"return",
"self",
".",
"__logged_in_id"
] | Fetch the logged in users ID, with caching. ID is reset on calls to log_in. | [
"Fetch",
"the",
"logged",
"in",
"users",
"ID",
"with",
"caching",
".",
"ID",
"is",
"reset",
"on",
"calls",
"to",
"log_in",
"."
] | 35c43562dd3d34d6ebf7a0f757c09e8fcccc957c | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L2460-L2466 | train |
halcy/Mastodon.py | mastodon/Mastodon.py | Mastodon.__json_date_parse | def __json_date_parse(json_object):
"""
Parse dates in certain known json fields, if possible.
"""
known_date_fields = ["created_at", "week", "day", "expires_at", "scheduled_at"]
for k, v in json_object.items():
if k in known_date_fields:
if v != None:... | python | def __json_date_parse(json_object):
"""
Parse dates in certain known json fields, if possible.
"""
known_date_fields = ["created_at", "week", "day", "expires_at", "scheduled_at"]
for k, v in json_object.items():
if k in known_date_fields:
if v != None:... | [
"def",
"__json_date_parse",
"(",
"json_object",
")",
":",
"known_date_fields",
"=",
"[",
"\"created_at\"",
",",
"\"week\"",
",",
"\"day\"",
",",
"\"expires_at\"",
",",
"\"scheduled_at\"",
"]",
"for",
"k",
",",
"v",
"in",
"json_object",
".",
"items",
"(",
")",
... | Parse dates in certain known json fields, if possible. | [
"Parse",
"dates",
"in",
"certain",
"known",
"json",
"fields",
"if",
"possible",
"."
] | 35c43562dd3d34d6ebf7a0f757c09e8fcccc957c | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L2480-L2495 | train |
halcy/Mastodon.py | mastodon/Mastodon.py | Mastodon.__json_strnum_to_bignum | def __json_strnum_to_bignum(json_object):
"""
Converts json string numerals to native python bignums.
"""
for key in ('id', 'week', 'in_reply_to_id', 'in_reply_to_account_id', 'logins', 'registrations', 'statuses'):
if (key in json_object and isinstance(json_object[key], six.... | python | def __json_strnum_to_bignum(json_object):
"""
Converts json string numerals to native python bignums.
"""
for key in ('id', 'week', 'in_reply_to_id', 'in_reply_to_account_id', 'logins', 'registrations', 'statuses'):
if (key in json_object and isinstance(json_object[key], six.... | [
"def",
"__json_strnum_to_bignum",
"(",
"json_object",
")",
":",
"for",
"key",
"in",
"(",
"'id'",
",",
"'week'",
",",
"'in_reply_to_id'",
",",
"'in_reply_to_account_id'",
",",
"'logins'",
",",
"'registrations'",
",",
"'statuses'",
")",
":",
"if",
"(",
"key",
"i... | Converts json string numerals to native python bignums. | [
"Converts",
"json",
"string",
"numerals",
"to",
"native",
"python",
"bignums",
"."
] | 35c43562dd3d34d6ebf7a0f757c09e8fcccc957c | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L2511-L2522 | train |
halcy/Mastodon.py | mastodon/Mastodon.py | Mastodon.__json_hooks | def __json_hooks(json_object):
"""
All the json hooks. Used in request parsing.
"""
json_object = Mastodon.__json_strnum_to_bignum(json_object)
json_object = Mastodon.__json_date_parse(json_object)
json_object = Mastodon.__json_truefalse_parse(json_object)
... | python | def __json_hooks(json_object):
"""
All the json hooks. Used in request parsing.
"""
json_object = Mastodon.__json_strnum_to_bignum(json_object)
json_object = Mastodon.__json_date_parse(json_object)
json_object = Mastodon.__json_truefalse_parse(json_object)
... | [
"def",
"__json_hooks",
"(",
"json_object",
")",
":",
"json_object",
"=",
"Mastodon",
".",
"__json_strnum_to_bignum",
"(",
"json_object",
")",
"json_object",
"=",
"Mastodon",
".",
"__json_date_parse",
"(",
"json_object",
")",
"json_object",
"=",
"Mastodon",
".",
"_... | All the json hooks. Used in request parsing. | [
"All",
"the",
"json",
"hooks",
".",
"Used",
"in",
"request",
"parsing",
"."
] | 35c43562dd3d34d6ebf7a0f757c09e8fcccc957c | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L2525-L2533 | train |
halcy/Mastodon.py | mastodon/Mastodon.py | Mastodon.__consistent_isoformat_utc | def __consistent_isoformat_utc(datetime_val):
"""
Function that does what isoformat does but it actually does the same
every time instead of randomly doing different things on some systems
and also it represents that time as the equivalent UTC time.
"""
isotime = datetime... | python | def __consistent_isoformat_utc(datetime_val):
"""
Function that does what isoformat does but it actually does the same
every time instead of randomly doing different things on some systems
and also it represents that time as the equivalent UTC time.
"""
isotime = datetime... | [
"def",
"__consistent_isoformat_utc",
"(",
"datetime_val",
")",
":",
"isotime",
"=",
"datetime_val",
".",
"astimezone",
"(",
"pytz",
".",
"utc",
")",
".",
"strftime",
"(",
"\"%Y-%m-%dT%H:%M:%S%z\"",
")",
"if",
"isotime",
"[",
"-",
"2",
"]",
"!=",
"\":\"",
":"... | Function that does what isoformat does but it actually does the same
every time instead of randomly doing different things on some systems
and also it represents that time as the equivalent UTC time. | [
"Function",
"that",
"does",
"what",
"isoformat",
"does",
"but",
"it",
"actually",
"does",
"the",
"same",
"every",
"time",
"instead",
"of",
"randomly",
"doing",
"different",
"things",
"on",
"some",
"systems",
"and",
"also",
"it",
"represents",
"that",
"time",
... | 35c43562dd3d34d6ebf7a0f757c09e8fcccc957c | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L2536-L2545 | train |
halcy/Mastodon.py | mastodon/Mastodon.py | Mastodon.__generate_params | def __generate_params(self, params, exclude=[]):
"""
Internal named-parameters-to-dict helper.
Note for developers: If called with locals() as params,
as is the usual practice in this code, the __generate_params call
(or at least the locals() call) should generally be the first ... | python | def __generate_params(self, params, exclude=[]):
"""
Internal named-parameters-to-dict helper.
Note for developers: If called with locals() as params,
as is the usual practice in this code, the __generate_params call
(or at least the locals() call) should generally be the first ... | [
"def",
"__generate_params",
"(",
"self",
",",
"params",
",",
"exclude",
"=",
"[",
"]",
")",
":",
"params",
"=",
"collections",
".",
"OrderedDict",
"(",
"params",
")",
"del",
"params",
"[",
"'self'",
"]",
"param_keys",
"=",
"list",
"(",
"params",
".",
"... | Internal named-parameters-to-dict helper.
Note for developers: If called with locals() as params,
as is the usual practice in this code, the __generate_params call
(or at least the locals() call) should generally be the first thing
in your function. | [
"Internal",
"named",
"-",
"parameters",
"-",
"to",
"-",
"dict",
"helper",
"."
] | 35c43562dd3d34d6ebf7a0f757c09e8fcccc957c | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L2867-L2896 | train |
halcy/Mastodon.py | mastodon/Mastodon.py | Mastodon.__decode_webpush_b64 | def __decode_webpush_b64(self, data):
"""
Re-pads and decodes urlsafe base64.
"""
missing_padding = len(data) % 4
if missing_padding != 0:
data += '=' * (4 - missing_padding)
return base64.urlsafe_b64decode(data) | python | def __decode_webpush_b64(self, data):
"""
Re-pads and decodes urlsafe base64.
"""
missing_padding = len(data) % 4
if missing_padding != 0:
data += '=' * (4 - missing_padding)
return base64.urlsafe_b64decode(data) | [
"def",
"__decode_webpush_b64",
"(",
"self",
",",
"data",
")",
":",
"missing_padding",
"=",
"len",
"(",
"data",
")",
"%",
"4",
"if",
"missing_padding",
"!=",
"0",
":",
"data",
"+=",
"'='",
"*",
"(",
"4",
"-",
"missing_padding",
")",
"return",
"base64",
... | Re-pads and decodes urlsafe base64. | [
"Re",
"-",
"pads",
"and",
"decodes",
"urlsafe",
"base64",
"."
] | 35c43562dd3d34d6ebf7a0f757c09e8fcccc957c | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L2911-L2918 | train |
halcy/Mastodon.py | mastodon/Mastodon.py | Mastodon.__set_token_expired | def __set_token_expired(self, value):
"""Internal helper for oauth code"""
self._token_expired = datetime.datetime.now() + datetime.timedelta(seconds=value)
return | python | def __set_token_expired(self, value):
"""Internal helper for oauth code"""
self._token_expired = datetime.datetime.now() + datetime.timedelta(seconds=value)
return | [
"def",
"__set_token_expired",
"(",
"self",
",",
"value",
")",
":",
"self",
".",
"_token_expired",
"=",
"datetime",
".",
"datetime",
".",
"now",
"(",
")",
"+",
"datetime",
".",
"timedelta",
"(",
"seconds",
"=",
"value",
")",
"return"
] | Internal helper for oauth code | [
"Internal",
"helper",
"for",
"oauth",
"code"
] | 35c43562dd3d34d6ebf7a0f757c09e8fcccc957c | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L2924-L2927 | train |
halcy/Mastodon.py | mastodon/Mastodon.py | Mastodon.__protocolize | def __protocolize(base_url):
"""Internal add-protocol-to-url helper"""
if not base_url.startswith("http://") and not base_url.startswith("https://"):
base_url = "https://" + base_url
# Some API endpoints can't handle extra /'s in path requests
base_url = base_url.rstrip("/")... | python | def __protocolize(base_url):
"""Internal add-protocol-to-url helper"""
if not base_url.startswith("http://") and not base_url.startswith("https://"):
base_url = "https://" + base_url
# Some API endpoints can't handle extra /'s in path requests
base_url = base_url.rstrip("/")... | [
"def",
"__protocolize",
"(",
"base_url",
")",
":",
"if",
"not",
"base_url",
".",
"startswith",
"(",
"\"http://\"",
")",
"and",
"not",
"base_url",
".",
"startswith",
"(",
"\"https://\"",
")",
":",
"base_url",
"=",
"\"https://\"",
"+",
"base_url",
"base_url",
... | Internal add-protocol-to-url helper | [
"Internal",
"add",
"-",
"protocol",
"-",
"to",
"-",
"url",
"helper"
] | 35c43562dd3d34d6ebf7a0f757c09e8fcccc957c | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L2939-L2946 | train |
faucamp/python-gsmmodem | gsmmodem/modem.py | SentSms.status | def status(self):
""" Status of this SMS. Can be ENROUTE, DELIVERED or FAILED
The actual status report object may be accessed via the 'report' attribute
if status is 'DELIVERED' or 'FAILED'
"""
if self.report == None:
return SentSms.ENROUTE
else:
... | python | def status(self):
""" Status of this SMS. Can be ENROUTE, DELIVERED or FAILED
The actual status report object may be accessed via the 'report' attribute
if status is 'DELIVERED' or 'FAILED'
"""
if self.report == None:
return SentSms.ENROUTE
else:
... | [
"def",
"status",
"(",
"self",
")",
":",
"if",
"self",
".",
"report",
"==",
"None",
":",
"return",
"SentSms",
".",
"ENROUTE",
"else",
":",
"return",
"SentSms",
".",
"DELIVERED",
"if",
"self",
".",
"report",
".",
"deliveryStatus",
"==",
"StatusReport",
"."... | Status of this SMS. Can be ENROUTE, DELIVERED or FAILED
The actual status report object may be accessed via the 'report' attribute
if status is 'DELIVERED' or 'FAILED' | [
"Status",
"of",
"this",
"SMS",
".",
"Can",
"be",
"ENROUTE",
"DELIVERED",
"or",
"FAILED",
"The",
"actual",
"status",
"report",
"object",
"may",
"be",
"accessed",
"via",
"the",
"report",
"attribute",
"if",
"status",
"is",
"DELIVERED",
"or",
"FAILED"
] | 834c68b1387ca2c91e2210faa8f75526b39723b5 | https://github.com/faucamp/python-gsmmodem/blob/834c68b1387ca2c91e2210faa8f75526b39723b5/gsmmodem/modem.py#L76-L85 | train |
faucamp/python-gsmmodem | gsmmodem/modem.py | GsmModem.write | def write(self, data, waitForResponse=True, timeout=5, parseError=True, writeTerm='\r', expectedResponseTermSeq=None):
""" Write data to the modem.
This method adds the ``\\r\\n`` end-of-line sequence to the data parameter, and
writes it to the modem.
:param data: Command/data to be wr... | python | def write(self, data, waitForResponse=True, timeout=5, parseError=True, writeTerm='\r', expectedResponseTermSeq=None):
""" Write data to the modem.
This method adds the ``\\r\\n`` end-of-line sequence to the data parameter, and
writes it to the modem.
:param data: Command/data to be wr... | [
"def",
"write",
"(",
"self",
",",
"data",
",",
"waitForResponse",
"=",
"True",
",",
"timeout",
"=",
"5",
",",
"parseError",
"=",
"True",
",",
"writeTerm",
"=",
"'\\r'",
",",
"expectedResponseTermSeq",
"=",
"None",
")",
":",
"self",
".",
"log",
".",
"de... | Write data to the modem.
This method adds the ``\\r\\n`` end-of-line sequence to the data parameter, and
writes it to the modem.
:param data: Command/data to be written to the modem
:type data: str
:param waitForResponse: Whether this method should block and return the response... | [
"Write",
"data",
"to",
"the",
"modem",
"."
] | 834c68b1387ca2c91e2210faa8f75526b39723b5 | https://github.com/faucamp/python-gsmmodem/blob/834c68b1387ca2c91e2210faa8f75526b39723b5/gsmmodem/modem.py#L387-L446 | train |
faucamp/python-gsmmodem | gsmmodem/modem.py | GsmModem.smsTextMode | def smsTextMode(self, textMode):
""" Set to True for the modem to use text mode for SMS, or False for it to use PDU mode """
if textMode != self._smsTextMode:
if self.alive:
self.write('AT+CMGF={0}'.format(1 if textMode else 0))
self._smsTextMode = textMode
... | python | def smsTextMode(self, textMode):
""" Set to True for the modem to use text mode for SMS, or False for it to use PDU mode """
if textMode != self._smsTextMode:
if self.alive:
self.write('AT+CMGF={0}'.format(1 if textMode else 0))
self._smsTextMode = textMode
... | [
"def",
"smsTextMode",
"(",
"self",
",",
"textMode",
")",
":",
"if",
"textMode",
"!=",
"self",
".",
"_smsTextMode",
":",
"if",
"self",
".",
"alive",
":",
"self",
".",
"write",
"(",
"'AT+CMGF={0}'",
".",
"format",
"(",
"1",
"if",
"textMode",
"else",
"0",... | Set to True for the modem to use text mode for SMS, or False for it to use PDU mode | [
"Set",
"to",
"True",
"for",
"the",
"modem",
"to",
"use",
"text",
"mode",
"for",
"SMS",
"or",
"False",
"for",
"it",
"to",
"use",
"PDU",
"mode"
] | 834c68b1387ca2c91e2210faa8f75526b39723b5 | https://github.com/faucamp/python-gsmmodem/blob/834c68b1387ca2c91e2210faa8f75526b39723b5/gsmmodem/modem.py#L524-L530 | train |
faucamp/python-gsmmodem | gsmmodem/modem.py | GsmModem._compileSmsRegexes | def _compileSmsRegexes(self):
""" Compiles regular expression used for parsing SMS messages based on current mode """
if self._smsTextMode:
if self.CMGR_SM_DELIVER_REGEX_TEXT == None:
self.CMGR_SM_DELIVER_REGEX_TEXT = re.compile(r'^\+CMGR: "([^"]+)","([^"]+)",[^,]*,"([^"]+)"$... | python | def _compileSmsRegexes(self):
""" Compiles regular expression used for parsing SMS messages based on current mode """
if self._smsTextMode:
if self.CMGR_SM_DELIVER_REGEX_TEXT == None:
self.CMGR_SM_DELIVER_REGEX_TEXT = re.compile(r'^\+CMGR: "([^"]+)","([^"]+)",[^,]*,"([^"]+)"$... | [
"def",
"_compileSmsRegexes",
"(",
"self",
")",
":",
"if",
"self",
".",
"_smsTextMode",
":",
"if",
"self",
".",
"CMGR_SM_DELIVER_REGEX_TEXT",
"==",
"None",
":",
"self",
".",
"CMGR_SM_DELIVER_REGEX_TEXT",
"=",
"re",
".",
"compile",
"(",
"r'^\\+CMGR: \"([^\"]+)\",\"(... | Compiles regular expression used for parsing SMS messages based on current mode | [
"Compiles",
"regular",
"expression",
"used",
"for",
"parsing",
"SMS",
"messages",
"based",
"on",
"current",
"mode"
] | 834c68b1387ca2c91e2210faa8f75526b39723b5 | https://github.com/faucamp/python-gsmmodem/blob/834c68b1387ca2c91e2210faa8f75526b39723b5/gsmmodem/modem.py#L545-L552 | train |
faucamp/python-gsmmodem | gsmmodem/modem.py | GsmModem.smsc | def smsc(self, smscNumber):
""" Set the default SMSC number to use when sending SMS messages """
if smscNumber != self._smscNumber:
if self.alive:
self.write('AT+CSCA="{0}"'.format(smscNumber))
self._smscNumber = smscNumber | python | def smsc(self, smscNumber):
""" Set the default SMSC number to use when sending SMS messages """
if smscNumber != self._smscNumber:
if self.alive:
self.write('AT+CSCA="{0}"'.format(smscNumber))
self._smscNumber = smscNumber | [
"def",
"smsc",
"(",
"self",
",",
"smscNumber",
")",
":",
"if",
"smscNumber",
"!=",
"self",
".",
"_smscNumber",
":",
"if",
"self",
".",
"alive",
":",
"self",
".",
"write",
"(",
"'AT+CSCA=\"{0}\"'",
".",
"format",
"(",
"smscNumber",
")",
")",
"self",
"."... | Set the default SMSC number to use when sending SMS messages | [
"Set",
"the",
"default",
"SMSC",
"number",
"to",
"use",
"when",
"sending",
"SMS",
"messages"
] | 834c68b1387ca2c91e2210faa8f75526b39723b5 | https://github.com/faucamp/python-gsmmodem/blob/834c68b1387ca2c91e2210faa8f75526b39723b5/gsmmodem/modem.py#L568-L573 | train |
faucamp/python-gsmmodem | gsmmodem/modem.py | GsmModem.dial | def dial(self, number, timeout=5, callStatusUpdateCallbackFunc=None):
""" Calls the specified phone number using a voice phone call
:param number: The phone number to dial
:param timeout: Maximum time to wait for the call to be established
:param callStatusUpdateCallbackFunc: Callback f... | python | def dial(self, number, timeout=5, callStatusUpdateCallbackFunc=None):
""" Calls the specified phone number using a voice phone call
:param number: The phone number to dial
:param timeout: Maximum time to wait for the call to be established
:param callStatusUpdateCallbackFunc: Callback f... | [
"def",
"dial",
"(",
"self",
",",
"number",
",",
"timeout",
"=",
"5",
",",
"callStatusUpdateCallbackFunc",
"=",
"None",
")",
":",
"if",
"self",
".",
"_waitForCallInitUpdate",
":",
"self",
".",
"_dialEvent",
"=",
"threading",
".",
"Event",
"(",
")",
"try",
... | Calls the specified phone number using a voice phone call
:param number: The phone number to dial
:param timeout: Maximum time to wait for the call to be established
:param callStatusUpdateCallbackFunc: Callback function that is executed if the call's status changes due to
remote... | [
"Calls",
"the",
"specified",
"phone",
"number",
"using",
"a",
"voice",
"phone",
"call"
] | 834c68b1387ca2c91e2210faa8f75526b39723b5 | https://github.com/faucamp/python-gsmmodem/blob/834c68b1387ca2c91e2210faa8f75526b39723b5/gsmmodem/modem.py#L701-L742 | train |
faucamp/python-gsmmodem | gsmmodem/modem.py | GsmModem._handleCallInitiated | def _handleCallInitiated(self, regexMatch, callId=None, callType=1):
""" Handler for "outgoing call initiated" event notification line """
if self._dialEvent:
if regexMatch:
groups = regexMatch.groups()
# Set self._dialReponse to (callId, callType)
... | python | def _handleCallInitiated(self, regexMatch, callId=None, callType=1):
""" Handler for "outgoing call initiated" event notification line """
if self._dialEvent:
if regexMatch:
groups = regexMatch.groups()
# Set self._dialReponse to (callId, callType)
... | [
"def",
"_handleCallInitiated",
"(",
"self",
",",
"regexMatch",
",",
"callId",
"=",
"None",
",",
"callType",
"=",
"1",
")",
":",
"if",
"self",
".",
"_dialEvent",
":",
"if",
"regexMatch",
":",
"groups",
"=",
"regexMatch",
".",
"groups",
"(",
")",
"if",
"... | Handler for "outgoing call initiated" event notification line | [
"Handler",
"for",
"outgoing",
"call",
"initiated",
"event",
"notification",
"line"
] | 834c68b1387ca2c91e2210faa8f75526b39723b5 | https://github.com/faucamp/python-gsmmodem/blob/834c68b1387ca2c91e2210faa8f75526b39723b5/gsmmodem/modem.py#L935-L947 | train |
faucamp/python-gsmmodem | gsmmodem/modem.py | GsmModem._handleCallAnswered | def _handleCallAnswered(self, regexMatch, callId=None):
""" Handler for "outgoing call answered" event notification line """
if regexMatch:
groups = regexMatch.groups()
if len(groups) > 1:
callId = int(groups[0])
self.activeCalls[callId].answered =... | python | def _handleCallAnswered(self, regexMatch, callId=None):
""" Handler for "outgoing call answered" event notification line """
if regexMatch:
groups = regexMatch.groups()
if len(groups) > 1:
callId = int(groups[0])
self.activeCalls[callId].answered =... | [
"def",
"_handleCallAnswered",
"(",
"self",
",",
"regexMatch",
",",
"callId",
"=",
"None",
")",
":",
"if",
"regexMatch",
":",
"groups",
"=",
"regexMatch",
".",
"groups",
"(",
")",
"if",
"len",
"(",
"groups",
")",
">",
"1",
":",
"callId",
"=",
"int",
"... | Handler for "outgoing call answered" event notification line | [
"Handler",
"for",
"outgoing",
"call",
"answered",
"event",
"notification",
"line"
] | 834c68b1387ca2c91e2210faa8f75526b39723b5 | https://github.com/faucamp/python-gsmmodem/blob/834c68b1387ca2c91e2210faa8f75526b39723b5/gsmmodem/modem.py#L949-L964 | train |
faucamp/python-gsmmodem | gsmmodem/modem.py | GsmModem._handleSmsReceived | def _handleSmsReceived(self, notificationLine):
""" Handler for "new SMS" unsolicited notification line """
self.log.debug('SMS message received')
cmtiMatch = self.CMTI_REGEX.match(notificationLine)
if cmtiMatch:
msgMemory = cmtiMatch.group(1)
msgIndex = cmtiMatch... | python | def _handleSmsReceived(self, notificationLine):
""" Handler for "new SMS" unsolicited notification line """
self.log.debug('SMS message received')
cmtiMatch = self.CMTI_REGEX.match(notificationLine)
if cmtiMatch:
msgMemory = cmtiMatch.group(1)
msgIndex = cmtiMatch... | [
"def",
"_handleSmsReceived",
"(",
"self",
",",
"notificationLine",
")",
":",
"self",
".",
"log",
".",
"debug",
"(",
"'SMS message received'",
")",
"cmtiMatch",
"=",
"self",
".",
"CMTI_REGEX",
".",
"match",
"(",
"notificationLine",
")",
"if",
"cmtiMatch",
":",
... | Handler for "new SMS" unsolicited notification line | [
"Handler",
"for",
"new",
"SMS",
"unsolicited",
"notification",
"line"
] | 834c68b1387ca2c91e2210faa8f75526b39723b5 | https://github.com/faucamp/python-gsmmodem/blob/834c68b1387ca2c91e2210faa8f75526b39723b5/gsmmodem/modem.py#L991-L1000 | train |
faucamp/python-gsmmodem | gsmmodem/modem.py | GsmModem._handleSmsStatusReport | def _handleSmsStatusReport(self, notificationLine):
""" Handler for SMS status reports """
self.log.debug('SMS status report received')
cdsiMatch = self.CDSI_REGEX.match(notificationLine)
if cdsiMatch:
msgMemory = cdsiMatch.group(1)
msgIndex = cdsiMatch.group(2)
... | python | def _handleSmsStatusReport(self, notificationLine):
""" Handler for SMS status reports """
self.log.debug('SMS status report received')
cdsiMatch = self.CDSI_REGEX.match(notificationLine)
if cdsiMatch:
msgMemory = cdsiMatch.group(1)
msgIndex = cdsiMatch.group(2)
... | [
"def",
"_handleSmsStatusReport",
"(",
"self",
",",
"notificationLine",
")",
":",
"self",
".",
"log",
".",
"debug",
"(",
"'SMS status report received'",
")",
"cdsiMatch",
"=",
"self",
".",
"CDSI_REGEX",
".",
"match",
"(",
"notificationLine",
")",
"if",
"cdsiMatch... | Handler for SMS status reports | [
"Handler",
"for",
"SMS",
"status",
"reports"
] | 834c68b1387ca2c91e2210faa8f75526b39723b5 | https://github.com/faucamp/python-gsmmodem/blob/834c68b1387ca2c91e2210faa8f75526b39723b5/gsmmodem/modem.py#L1002-L1019 | train |
faucamp/python-gsmmodem | gsmmodem/modem.py | Call.hangup | def hangup(self):
""" End the phone call.
Does nothing if the call is already inactive.
"""
if self.active:
self._gsmModem.write('ATH')
self.answered = False
self.active = False
if self.id in self._gsmModem.activeCalls:
del... | python | def hangup(self):
""" End the phone call.
Does nothing if the call is already inactive.
"""
if self.active:
self._gsmModem.write('ATH')
self.answered = False
self.active = False
if self.id in self._gsmModem.activeCalls:
del... | [
"def",
"hangup",
"(",
"self",
")",
":",
"if",
"self",
".",
"active",
":",
"self",
".",
"_gsmModem",
".",
"write",
"(",
"'ATH'",
")",
"self",
".",
"answered",
"=",
"False",
"self",
".",
"active",
"=",
"False",
"if",
"self",
".",
"id",
"in",
"self",
... | End the phone call.
Does nothing if the call is already inactive. | [
"End",
"the",
"phone",
"call",
".",
"Does",
"nothing",
"if",
"the",
"call",
"is",
"already",
"inactive",
"."
] | 834c68b1387ca2c91e2210faa8f75526b39723b5 | https://github.com/faucamp/python-gsmmodem/blob/834c68b1387ca2c91e2210faa8f75526b39723b5/gsmmodem/modem.py#L1272-L1282 | train |
faucamp/python-gsmmodem | tools/gsmtermlib/terminal.py | GsmTerm._color | def _color(self, color, msg):
""" Converts a message to be printed to the user's terminal in red """
if self.useColor:
return '{0}{1}{2}'.format(color, msg, self.RESET_SEQ)
else:
return msg | python | def _color(self, color, msg):
""" Converts a message to be printed to the user's terminal in red """
if self.useColor:
return '{0}{1}{2}'.format(color, msg, self.RESET_SEQ)
else:
return msg | [
"def",
"_color",
"(",
"self",
",",
"color",
",",
"msg",
")",
":",
"if",
"self",
".",
"useColor",
":",
"return",
"'{0}{1}{2}'",
".",
"format",
"(",
"color",
",",
"msg",
",",
"self",
".",
"RESET_SEQ",
")",
"else",
":",
"return",
"msg"
] | Converts a message to be printed to the user's terminal in red | [
"Converts",
"a",
"message",
"to",
"be",
"printed",
"to",
"the",
"user",
"s",
"terminal",
"in",
"red"
] | 834c68b1387ca2c91e2210faa8f75526b39723b5 | https://github.com/faucamp/python-gsmmodem/blob/834c68b1387ca2c91e2210faa8f75526b39723b5/tools/gsmtermlib/terminal.py#L216-L221 | train |
faucamp/python-gsmmodem | tools/gsmtermlib/terminal.py | GsmTerm._cursorLeft | def _cursorLeft(self):
""" Handles "cursor left" events """
if self.cursorPos > 0:
self.cursorPos -= 1
sys.stdout.write(console.CURSOR_LEFT)
sys.stdout.flush() | python | def _cursorLeft(self):
""" Handles "cursor left" events """
if self.cursorPos > 0:
self.cursorPos -= 1
sys.stdout.write(console.CURSOR_LEFT)
sys.stdout.flush() | [
"def",
"_cursorLeft",
"(",
"self",
")",
":",
"if",
"self",
".",
"cursorPos",
">",
"0",
":",
"self",
".",
"cursorPos",
"-=",
"1",
"sys",
".",
"stdout",
".",
"write",
"(",
"console",
".",
"CURSOR_LEFT",
")",
"sys",
".",
"stdout",
".",
"flush",
"(",
"... | Handles "cursor left" events | [
"Handles",
"cursor",
"left",
"events"
] | 834c68b1387ca2c91e2210faa8f75526b39723b5 | https://github.com/faucamp/python-gsmmodem/blob/834c68b1387ca2c91e2210faa8f75526b39723b5/tools/gsmtermlib/terminal.py#L311-L316 | train |
faucamp/python-gsmmodem | tools/gsmtermlib/terminal.py | GsmTerm._cursorRight | def _cursorRight(self):
""" Handles "cursor right" events """
if self.cursorPos < len(self.inputBuffer):
self.cursorPos += 1
sys.stdout.write(console.CURSOR_RIGHT)
sys.stdout.flush() | python | def _cursorRight(self):
""" Handles "cursor right" events """
if self.cursorPos < len(self.inputBuffer):
self.cursorPos += 1
sys.stdout.write(console.CURSOR_RIGHT)
sys.stdout.flush() | [
"def",
"_cursorRight",
"(",
"self",
")",
":",
"if",
"self",
".",
"cursorPos",
"<",
"len",
"(",
"self",
".",
"inputBuffer",
")",
":",
"self",
".",
"cursorPos",
"+=",
"1",
"sys",
".",
"stdout",
".",
"write",
"(",
"console",
".",
"CURSOR_RIGHT",
")",
"s... | Handles "cursor right" events | [
"Handles",
"cursor",
"right",
"events"
] | 834c68b1387ca2c91e2210faa8f75526b39723b5 | https://github.com/faucamp/python-gsmmodem/blob/834c68b1387ca2c91e2210faa8f75526b39723b5/tools/gsmtermlib/terminal.py#L318-L323 | train |
faucamp/python-gsmmodem | tools/gsmtermlib/terminal.py | GsmTerm._cursorUp | def _cursorUp(self):
""" Handles "cursor up" events """
if self.historyPos > 0:
self.historyPos -= 1
clearLen = len(self.inputBuffer)
self.inputBuffer = list(self.history[self.historyPos])
self.cursorPos = len(self.inputBuffer)
self._refreshInp... | python | def _cursorUp(self):
""" Handles "cursor up" events """
if self.historyPos > 0:
self.historyPos -= 1
clearLen = len(self.inputBuffer)
self.inputBuffer = list(self.history[self.historyPos])
self.cursorPos = len(self.inputBuffer)
self._refreshInp... | [
"def",
"_cursorUp",
"(",
"self",
")",
":",
"if",
"self",
".",
"historyPos",
">",
"0",
":",
"self",
".",
"historyPos",
"-=",
"1",
"clearLen",
"=",
"len",
"(",
"self",
".",
"inputBuffer",
")",
"self",
".",
"inputBuffer",
"=",
"list",
"(",
"self",
".",
... | Handles "cursor up" events | [
"Handles",
"cursor",
"up",
"events"
] | 834c68b1387ca2c91e2210faa8f75526b39723b5 | https://github.com/faucamp/python-gsmmodem/blob/834c68b1387ca2c91e2210faa8f75526b39723b5/tools/gsmtermlib/terminal.py#L325-L332 | train |
faucamp/python-gsmmodem | tools/gsmtermlib/terminal.py | GsmTerm._handleBackspace | def _handleBackspace(self):
""" Handles backspace characters """
if self.cursorPos > 0:
#print( 'cp:',self.cursorPos,'was:', self.inputBuffer)
self.inputBuffer = self.inputBuffer[0:self.cursorPos-1] + self.inputBuffer[self.cursorPos:]
self.cursorPos -= 1
#... | python | def _handleBackspace(self):
""" Handles backspace characters """
if self.cursorPos > 0:
#print( 'cp:',self.cursorPos,'was:', self.inputBuffer)
self.inputBuffer = self.inputBuffer[0:self.cursorPos-1] + self.inputBuffer[self.cursorPos:]
self.cursorPos -= 1
#... | [
"def",
"_handleBackspace",
"(",
"self",
")",
":",
"if",
"self",
".",
"cursorPos",
">",
"0",
":",
"self",
".",
"inputBuffer",
"=",
"self",
".",
"inputBuffer",
"[",
"0",
":",
"self",
".",
"cursorPos",
"-",
"1",
"]",
"+",
"self",
".",
"inputBuffer",
"["... | Handles backspace characters | [
"Handles",
"backspace",
"characters"
] | 834c68b1387ca2c91e2210faa8f75526b39723b5 | https://github.com/faucamp/python-gsmmodem/blob/834c68b1387ca2c91e2210faa8f75526b39723b5/tools/gsmtermlib/terminal.py#L343-L350 | train |
faucamp/python-gsmmodem | tools/gsmtermlib/terminal.py | GsmTerm._handleDelete | def _handleDelete(self):
""" Handles "delete" characters """
if self.cursorPos < len(self.inputBuffer):
self.inputBuffer = self.inputBuffer[0:self.cursorPos] + self.inputBuffer[self.cursorPos+1:]
self._refreshInputPrompt(len(self.inputBuffer)+1) | python | def _handleDelete(self):
""" Handles "delete" characters """
if self.cursorPos < len(self.inputBuffer):
self.inputBuffer = self.inputBuffer[0:self.cursorPos] + self.inputBuffer[self.cursorPos+1:]
self._refreshInputPrompt(len(self.inputBuffer)+1) | [
"def",
"_handleDelete",
"(",
"self",
")",
":",
"if",
"self",
".",
"cursorPos",
"<",
"len",
"(",
"self",
".",
"inputBuffer",
")",
":",
"self",
".",
"inputBuffer",
"=",
"self",
".",
"inputBuffer",
"[",
"0",
":",
"self",
".",
"cursorPos",
"]",
"+",
"sel... | Handles "delete" characters | [
"Handles",
"delete",
"characters"
] | 834c68b1387ca2c91e2210faa8f75526b39723b5 | https://github.com/faucamp/python-gsmmodem/blob/834c68b1387ca2c91e2210faa8f75526b39723b5/tools/gsmtermlib/terminal.py#L352-L356 | train |
faucamp/python-gsmmodem | tools/gsmtermlib/terminal.py | GsmTerm._handleEnd | def _handleEnd(self):
""" Handles "end" character """
self.cursorPos = len(self.inputBuffer)
self._refreshInputPrompt(len(self.inputBuffer)) | python | def _handleEnd(self):
""" Handles "end" character """
self.cursorPos = len(self.inputBuffer)
self._refreshInputPrompt(len(self.inputBuffer)) | [
"def",
"_handleEnd",
"(",
"self",
")",
":",
"self",
".",
"cursorPos",
"=",
"len",
"(",
"self",
".",
"inputBuffer",
")",
"self",
".",
"_refreshInputPrompt",
"(",
"len",
"(",
"self",
".",
"inputBuffer",
")",
")"
] | Handles "end" character | [
"Handles",
"end",
"character"
] | 834c68b1387ca2c91e2210faa8f75526b39723b5 | https://github.com/faucamp/python-gsmmodem/blob/834c68b1387ca2c91e2210faa8f75526b39723b5/tools/gsmtermlib/terminal.py#L363-L366 | train |
faucamp/python-gsmmodem | tools/gsmtermlib/terminal.py | GsmTerm._doCommandCompletion | def _doCommandCompletion(self):
""" Command-completion method """
prefix = ''.join(self.inputBuffer).strip().upper()
matches = self.completion.keys(prefix)
matchLen = len(matches)
if matchLen == 0 and prefix[-1] == '=':
try:
... | python | def _doCommandCompletion(self):
""" Command-completion method """
prefix = ''.join(self.inputBuffer).strip().upper()
matches = self.completion.keys(prefix)
matchLen = len(matches)
if matchLen == 0 and prefix[-1] == '=':
try:
... | [
"def",
"_doCommandCompletion",
"(",
"self",
")",
":",
"prefix",
"=",
"''",
".",
"join",
"(",
"self",
".",
"inputBuffer",
")",
".",
"strip",
"(",
")",
".",
"upper",
"(",
")",
"matches",
"=",
"self",
".",
"completion",
".",
"keys",
"(",
"prefix",
")",
... | Command-completion method | [
"Command",
"-",
"completion",
"method"
] | 834c68b1387ca2c91e2210faa8f75526b39723b5 | https://github.com/faucamp/python-gsmmodem/blob/834c68b1387ca2c91e2210faa8f75526b39723b5/tools/gsmtermlib/terminal.py#L533-L568 | train |
faucamp/python-gsmmodem | gsmmodem/serial_comms.py | SerialComms.connect | def connect(self):
""" Connects to the device and starts the read thread """
self.serial = serial.Serial(port=self.port, baudrate=self.baudrate, timeout=self.timeout)
# Start read thread
self.alive = True
self.rxThread = threading.Thread(target=self._readLoop)
... | python | def connect(self):
""" Connects to the device and starts the read thread """
self.serial = serial.Serial(port=self.port, baudrate=self.baudrate, timeout=self.timeout)
# Start read thread
self.alive = True
self.rxThread = threading.Thread(target=self._readLoop)
... | [
"def",
"connect",
"(",
"self",
")",
":",
"self",
".",
"serial",
"=",
"serial",
".",
"Serial",
"(",
"port",
"=",
"self",
".",
"port",
",",
"baudrate",
"=",
"self",
".",
"baudrate",
",",
"timeout",
"=",
"self",
".",
"timeout",
")",
"self",
".",
"aliv... | Connects to the device and starts the read thread | [
"Connects",
"to",
"the",
"device",
"and",
"starts",
"the",
"read",
"thread"
] | 834c68b1387ca2c91e2210faa8f75526b39723b5 | https://github.com/faucamp/python-gsmmodem/blob/834c68b1387ca2c91e2210faa8f75526b39723b5/gsmmodem/serial_comms.py#L45-L52 | train |
faucamp/python-gsmmodem | gsmmodem/serial_comms.py | SerialComms.close | def close(self):
""" Stops the read thread, waits for it to exit cleanly, then closes the underlying serial port """
self.alive = False
self.rxThread.join()
self.serial.close() | python | def close(self):
""" Stops the read thread, waits for it to exit cleanly, then closes the underlying serial port """
self.alive = False
self.rxThread.join()
self.serial.close() | [
"def",
"close",
"(",
"self",
")",
":",
"self",
".",
"alive",
"=",
"False",
"self",
".",
"rxThread",
".",
"join",
"(",
")",
"self",
".",
"serial",
".",
"close",
"(",
")"
] | Stops the read thread, waits for it to exit cleanly, then closes the underlying serial port | [
"Stops",
"the",
"read",
"thread",
"waits",
"for",
"it",
"to",
"exit",
"cleanly",
"then",
"closes",
"the",
"underlying",
"serial",
"port"
] | 834c68b1387ca2c91e2210faa8f75526b39723b5 | https://github.com/faucamp/python-gsmmodem/blob/834c68b1387ca2c91e2210faa8f75526b39723b5/gsmmodem/serial_comms.py#L54-L58 | train |
faucamp/python-gsmmodem | gsmmodem/serial_comms.py | SerialComms._readLoop | def _readLoop(self):
""" Read thread main loop
Reads lines from the connected device
"""
try:
readTermSeq = list(self.RX_EOL_SEQ)
readTermLen = len(readTermSeq)
rxBuffer = []
while self.alive:
data = self.serial.rea... | python | def _readLoop(self):
""" Read thread main loop
Reads lines from the connected device
"""
try:
readTermSeq = list(self.RX_EOL_SEQ)
readTermLen = len(readTermSeq)
rxBuffer = []
while self.alive:
data = self.serial.rea... | [
"def",
"_readLoop",
"(",
"self",
")",
":",
"try",
":",
"readTermSeq",
"=",
"list",
"(",
"self",
".",
"RX_EOL_SEQ",
")",
"readTermLen",
"=",
"len",
"(",
"readTermSeq",
")",
"rxBuffer",
"=",
"[",
"]",
"while",
"self",
".",
"alive",
":",
"data",
"=",
"s... | Read thread main loop
Reads lines from the connected device | [
"Read",
"thread",
"main",
"loop",
"Reads",
"lines",
"from",
"the",
"connected",
"device"
] | 834c68b1387ca2c91e2210faa8f75526b39723b5 | https://github.com/faucamp/python-gsmmodem/blob/834c68b1387ca2c91e2210faa8f75526b39723b5/gsmmodem/serial_comms.py#L83-L118 | train |
faucamp/python-gsmmodem | gsmmodem/pdu.py | _decodeTimestamp | def _decodeTimestamp(byteIter):
""" Decodes a 7-octet timestamp """
dateStr = decodeSemiOctets(byteIter, 7)
timeZoneStr = dateStr[-2:]
return datetime.strptime(dateStr[:-2], '%y%m%d%H%M%S').replace(tzinfo=SmsPduTzInfo(timeZoneStr)) | python | def _decodeTimestamp(byteIter):
""" Decodes a 7-octet timestamp """
dateStr = decodeSemiOctets(byteIter, 7)
timeZoneStr = dateStr[-2:]
return datetime.strptime(dateStr[:-2], '%y%m%d%H%M%S').replace(tzinfo=SmsPduTzInfo(timeZoneStr)) | [
"def",
"_decodeTimestamp",
"(",
"byteIter",
")",
":",
"dateStr",
"=",
"decodeSemiOctets",
"(",
"byteIter",
",",
"7",
")",
"timeZoneStr",
"=",
"dateStr",
"[",
"-",
"2",
":",
"]",
"return",
"datetime",
".",
"strptime",
"(",
"dateStr",
"[",
":",
"-",
"2",
... | Decodes a 7-octet timestamp | [
"Decodes",
"a",
"7",
"-",
"octet",
"timestamp"
] | 834c68b1387ca2c91e2210faa8f75526b39723b5 | https://github.com/faucamp/python-gsmmodem/blob/834c68b1387ca2c91e2210faa8f75526b39723b5/gsmmodem/pdu.py#L494-L498 | train |
faucamp/python-gsmmodem | gsmmodem/pdu.py | decodeUcs2 | def decodeUcs2(byteIter, numBytes):
""" Decodes UCS2-encoded text from the specified byte iterator, up to a maximum of numBytes """
userData = []
i = 0
try:
while i < numBytes:
userData.append(unichr((next(byteIter) << 8) | next(byteIter)))
i += 2
except StopIteration... | python | def decodeUcs2(byteIter, numBytes):
""" Decodes UCS2-encoded text from the specified byte iterator, up to a maximum of numBytes """
userData = []
i = 0
try:
while i < numBytes:
userData.append(unichr((next(byteIter) << 8) | next(byteIter)))
i += 2
except StopIteration... | [
"def",
"decodeUcs2",
"(",
"byteIter",
",",
"numBytes",
")",
":",
"userData",
"=",
"[",
"]",
"i",
"=",
"0",
"try",
":",
"while",
"i",
"<",
"numBytes",
":",
"userData",
".",
"append",
"(",
"unichr",
"(",
"(",
"next",
"(",
"byteIter",
")",
"<<",
"8",
... | Decodes UCS2-encoded text from the specified byte iterator, up to a maximum of numBytes | [
"Decodes",
"UCS2",
"-",
"encoded",
"text",
"from",
"the",
"specified",
"byte",
"iterator",
"up",
"to",
"a",
"maximum",
"of",
"numBytes"
] | 834c68b1387ca2c91e2210faa8f75526b39723b5 | https://github.com/faucamp/python-gsmmodem/blob/834c68b1387ca2c91e2210faa8f75526b39723b5/gsmmodem/pdu.py#L795-L806 | train |
faucamp/python-gsmmodem | gsmmodem/pdu.py | InformationElement.encode | def encode(self):
""" Encodes this IE and returns the resulting bytes """
result = bytearray()
result.append(self.id)
result.append(self.dataLength)
result.extend(self.data)
return result | python | def encode(self):
""" Encodes this IE and returns the resulting bytes """
result = bytearray()
result.append(self.id)
result.append(self.dataLength)
result.extend(self.data)
return result | [
"def",
"encode",
"(",
"self",
")",
":",
"result",
"=",
"bytearray",
"(",
")",
"result",
".",
"append",
"(",
"self",
".",
"id",
")",
"result",
".",
"append",
"(",
"self",
".",
"dataLength",
")",
"result",
".",
"extend",
"(",
"self",
".",
"data",
")"... | Encodes this IE and returns the resulting bytes | [
"Encodes",
"this",
"IE",
"and",
"returns",
"the",
"resulting",
"bytes"
] | 834c68b1387ca2c91e2210faa8f75526b39723b5 | https://github.com/faucamp/python-gsmmodem/blob/834c68b1387ca2c91e2210faa8f75526b39723b5/gsmmodem/pdu.py#L123-L129 | train |
faucamp/python-gsmmodem | tools/sendsms.py | parseArgsPy26 | def parseArgsPy26():
""" Argument parser for Python 2.6 """
from gsmtermlib.posoptparse import PosOptionParser, Option
parser = PosOptionParser(description='Simple script for sending SMS messages')
parser.add_option('-i', '--port', metavar='PORT', help='port to which the GSM modem is connected; a number... | python | def parseArgsPy26():
""" Argument parser for Python 2.6 """
from gsmtermlib.posoptparse import PosOptionParser, Option
parser = PosOptionParser(description='Simple script for sending SMS messages')
parser.add_option('-i', '--port', metavar='PORT', help='port to which the GSM modem is connected; a number... | [
"def",
"parseArgsPy26",
"(",
")",
":",
"from",
"gsmtermlib",
".",
"posoptparse",
"import",
"PosOptionParser",
",",
"Option",
"parser",
"=",
"PosOptionParser",
"(",
"description",
"=",
"'Simple script for sending SMS messages'",
")",
"parser",
".",
"add_option",
"(",
... | Argument parser for Python 2.6 | [
"Argument",
"parser",
"for",
"Python",
"2",
".",
"6"
] | 834c68b1387ca2c91e2210faa8f75526b39723b5 | https://github.com/faucamp/python-gsmmodem/blob/834c68b1387ca2c91e2210faa8f75526b39723b5/tools/sendsms.py#L26-L40 | train |
faucamp/python-gsmmodem | gsmmodem/util.py | lineMatching | def lineMatching(regexStr, lines):
""" Searches through the specified list of strings and returns the regular expression
match for the first line that matches the specified regex string, or None if no match was found
Note: if you have a pre-compiled regex pattern, use lineMatchingPattern() instead
:t... | python | def lineMatching(regexStr, lines):
""" Searches through the specified list of strings and returns the regular expression
match for the first line that matches the specified regex string, or None if no match was found
Note: if you have a pre-compiled regex pattern, use lineMatchingPattern() instead
:t... | [
"def",
"lineMatching",
"(",
"regexStr",
",",
"lines",
")",
":",
"regex",
"=",
"re",
".",
"compile",
"(",
"regexStr",
")",
"for",
"line",
"in",
"lines",
":",
"m",
"=",
"regex",
".",
"match",
"(",
"line",
")",
"if",
"m",
":",
"return",
"m",
"else",
... | Searches through the specified list of strings and returns the regular expression
match for the first line that matches the specified regex string, or None if no match was found
Note: if you have a pre-compiled regex pattern, use lineMatchingPattern() instead
:type regexStr: Regular expression string to ... | [
"Searches",
"through",
"the",
"specified",
"list",
"of",
"strings",
"and",
"returns",
"the",
"regular",
"expression",
"match",
"for",
"the",
"first",
"line",
"that",
"matches",
"the",
"specified",
"regex",
"string",
"or",
"None",
"if",
"no",
"match",
"was",
... | 834c68b1387ca2c91e2210faa8f75526b39723b5 | https://github.com/faucamp/python-gsmmodem/blob/834c68b1387ca2c91e2210faa8f75526b39723b5/gsmmodem/util.py#L57-L75 | train |
faucamp/python-gsmmodem | gsmmodem/util.py | lineMatchingPattern | def lineMatchingPattern(pattern, lines):
""" Searches through the specified list of strings and returns the regular expression
match for the first line that matches the specified pre-compiled regex pattern, or None if no match was found
Note: if you are using a regex pattern string (i.e. not already compi... | python | def lineMatchingPattern(pattern, lines):
""" Searches through the specified list of strings and returns the regular expression
match for the first line that matches the specified pre-compiled regex pattern, or None if no match was found
Note: if you are using a regex pattern string (i.e. not already compi... | [
"def",
"lineMatchingPattern",
"(",
"pattern",
",",
"lines",
")",
":",
"for",
"line",
"in",
"lines",
":",
"m",
"=",
"pattern",
".",
"match",
"(",
"line",
")",
"if",
"m",
":",
"return",
"m",
"else",
":",
"return",
"None"
] | Searches through the specified list of strings and returns the regular expression
match for the first line that matches the specified pre-compiled regex pattern, or None if no match was found
Note: if you are using a regex pattern string (i.e. not already compiled), use lineMatching() instead
:type patte... | [
"Searches",
"through",
"the",
"specified",
"list",
"of",
"strings",
"and",
"returns",
"the",
"regular",
"expression",
"match",
"for",
"the",
"first",
"line",
"that",
"matches",
"the",
"specified",
"pre",
"-",
"compiled",
"regex",
"pattern",
"or",
"None",
"if",... | 834c68b1387ca2c91e2210faa8f75526b39723b5 | https://github.com/faucamp/python-gsmmodem/blob/834c68b1387ca2c91e2210faa8f75526b39723b5/gsmmodem/util.py#L77-L94 | train |
faucamp/python-gsmmodem | gsmmodem/util.py | allLinesMatchingPattern | def allLinesMatchingPattern(pattern, lines):
""" Like lineMatchingPattern, but returns all lines that match the specified pattern
:type pattern: Compiled regular expression pattern to use
:type lines: List of lines to search
:return: list of re.Match objects for each line matched, or an empty list if ... | python | def allLinesMatchingPattern(pattern, lines):
""" Like lineMatchingPattern, but returns all lines that match the specified pattern
:type pattern: Compiled regular expression pattern to use
:type lines: List of lines to search
:return: list of re.Match objects for each line matched, or an empty list if ... | [
"def",
"allLinesMatchingPattern",
"(",
"pattern",
",",
"lines",
")",
":",
"result",
"=",
"[",
"]",
"for",
"line",
"in",
"lines",
":",
"m",
"=",
"pattern",
".",
"match",
"(",
"line",
")",
"if",
"m",
":",
"result",
".",
"append",
"(",
"m",
")",
"retu... | Like lineMatchingPattern, but returns all lines that match the specified pattern
:type pattern: Compiled regular expression pattern to use
:type lines: List of lines to search
:return: list of re.Match objects for each line matched, or an empty list if none matched
:rtype: list | [
"Like",
"lineMatchingPattern",
"but",
"returns",
"all",
"lines",
"that",
"match",
"the",
"specified",
"pattern"
] | 834c68b1387ca2c91e2210faa8f75526b39723b5 | https://github.com/faucamp/python-gsmmodem/blob/834c68b1387ca2c91e2210faa8f75526b39723b5/gsmmodem/util.py#L96-L110 | train |
n8henrie/pycookiecheat | src/pycookiecheat/pycookiecheat.py | clean | def clean(decrypted: bytes) -> str:
r"""Strip padding from decrypted value.
Remove number indicated by padding
e.g. if last is '\x0e' then ord('\x0e') == 14, so take off 14.
Args:
decrypted: decrypted value
Returns:
Decrypted stripped of junk padding
"""
last = decrypted[-... | python | def clean(decrypted: bytes) -> str:
r"""Strip padding from decrypted value.
Remove number indicated by padding
e.g. if last is '\x0e' then ord('\x0e') == 14, so take off 14.
Args:
decrypted: decrypted value
Returns:
Decrypted stripped of junk padding
"""
last = decrypted[-... | [
"def",
"clean",
"(",
"decrypted",
":",
"bytes",
")",
"->",
"str",
":",
"r",
"last",
"=",
"decrypted",
"[",
"-",
"1",
"]",
"if",
"isinstance",
"(",
"last",
",",
"int",
")",
":",
"return",
"decrypted",
"[",
":",
"-",
"last",
"]",
".",
"decode",
"("... | r"""Strip padding from decrypted value.
Remove number indicated by padding
e.g. if last is '\x0e' then ord('\x0e') == 14, so take off 14.
Args:
decrypted: decrypted value
Returns:
Decrypted stripped of junk padding | [
"r",
"Strip",
"padding",
"from",
"decrypted",
"value",
"."
] | 1e0ba783da31689f5b37f9706205ff366d72f03d | https://github.com/n8henrie/pycookiecheat/blob/1e0ba783da31689f5b37f9706205ff366d72f03d/src/pycookiecheat/pycookiecheat.py#L26-L41 | train |
pyhys/minimalmodbus | omegacn7500.py | OmegaCN7500.set_pattern_step_setpoint | def set_pattern_step_setpoint(self, patternnumber, stepnumber, setpointvalue):
"""Set the setpoint value for a step.
Args:
* patternnumber (integer): 0-7
* stepnumber (integer): 0-7
* setpointvalue (float): Setpoint value
"""
_checkPatternNumber(patte... | python | def set_pattern_step_setpoint(self, patternnumber, stepnumber, setpointvalue):
"""Set the setpoint value for a step.
Args:
* patternnumber (integer): 0-7
* stepnumber (integer): 0-7
* setpointvalue (float): Setpoint value
"""
_checkPatternNumber(patte... | [
"def",
"set_pattern_step_setpoint",
"(",
"self",
",",
"patternnumber",
",",
"stepnumber",
",",
"setpointvalue",
")",
":",
"_checkPatternNumber",
"(",
"patternnumber",
")",
"_checkStepNumber",
"(",
"stepnumber",
")",
"_checkSetpointValue",
"(",
"setpointvalue",
",",
"s... | Set the setpoint value for a step.
Args:
* patternnumber (integer): 0-7
* stepnumber (integer): 0-7
* setpointvalue (float): Setpoint value | [
"Set",
"the",
"setpoint",
"value",
"for",
"a",
"step",
"."
] | e99f4d74c83258c6039073082955ac9bed3f2155 | https://github.com/pyhys/minimalmodbus/blob/e99f4d74c83258c6039073082955ac9bed3f2155/omegacn7500.py#L237-L250 | train |
pyhys/minimalmodbus | omegacn7500.py | OmegaCN7500.get_pattern_step_time | def get_pattern_step_time(self, patternnumber, stepnumber):
"""Get the step time.
Args:
* patternnumber (integer): 0-7
* stepnumber (integer): 0-7
Returns:
The step time (int??).
"""
_checkPatternNumber(pa... | python | def get_pattern_step_time(self, patternnumber, stepnumber):
"""Get the step time.
Args:
* patternnumber (integer): 0-7
* stepnumber (integer): 0-7
Returns:
The step time (int??).
"""
_checkPatternNumber(pa... | [
"def",
"get_pattern_step_time",
"(",
"self",
",",
"patternnumber",
",",
"stepnumber",
")",
":",
"_checkPatternNumber",
"(",
"patternnumber",
")",
"_checkStepNumber",
"(",
"stepnumber",
")",
"address",
"=",
"_calculateRegisterAddress",
"(",
"'time'",
",",
"patternnumbe... | Get the step time.
Args:
* patternnumber (integer): 0-7
* stepnumber (integer): 0-7
Returns:
The step time (int??). | [
"Get",
"the",
"step",
"time",
"."
] | e99f4d74c83258c6039073082955ac9bed3f2155 | https://github.com/pyhys/minimalmodbus/blob/e99f4d74c83258c6039073082955ac9bed3f2155/omegacn7500.py#L253-L268 | train |
pyhys/minimalmodbus | omegacn7500.py | OmegaCN7500.set_pattern_step_time | def set_pattern_step_time(self, patternnumber, stepnumber, timevalue):
"""Set the step time.
Args:
* patternnumber (integer): 0-7
* stepnumber (integer): 0-7
* timevalue (integer??): 0-900
"""
_checkPatternNumber(patternnumber)
_checkStepNumbe... | python | def set_pattern_step_time(self, patternnumber, stepnumber, timevalue):
"""Set the step time.
Args:
* patternnumber (integer): 0-7
* stepnumber (integer): 0-7
* timevalue (integer??): 0-900
"""
_checkPatternNumber(patternnumber)
_checkStepNumbe... | [
"def",
"set_pattern_step_time",
"(",
"self",
",",
"patternnumber",
",",
"stepnumber",
",",
"timevalue",
")",
":",
"_checkPatternNumber",
"(",
"patternnumber",
")",
"_checkStepNumber",
"(",
"stepnumber",
")",
"_checkTimeValue",
"(",
"timevalue",
",",
"self",
".",
"... | Set the step time.
Args:
* patternnumber (integer): 0-7
* stepnumber (integer): 0-7
* timevalue (integer??): 0-900 | [
"Set",
"the",
"step",
"time",
"."
] | e99f4d74c83258c6039073082955ac9bed3f2155 | https://github.com/pyhys/minimalmodbus/blob/e99f4d74c83258c6039073082955ac9bed3f2155/omegacn7500.py#L271-L284 | train |
pyhys/minimalmodbus | omegacn7500.py | OmegaCN7500.get_pattern_actual_step | def get_pattern_actual_step(self, patternnumber):
"""Get the 'actual step' parameter for a given pattern.
Args:
patternnumber (integer): 0-7
Returns:
The 'actual step' parameter (int).
"""
_checkPatternNumber(patternnumber)
... | python | def get_pattern_actual_step(self, patternnumber):
"""Get the 'actual step' parameter for a given pattern.
Args:
patternnumber (integer): 0-7
Returns:
The 'actual step' parameter (int).
"""
_checkPatternNumber(patternnumber)
... | [
"def",
"get_pattern_actual_step",
"(",
"self",
",",
"patternnumber",
")",
":",
"_checkPatternNumber",
"(",
"patternnumber",
")",
"address",
"=",
"_calculateRegisterAddress",
"(",
"'actualstep'",
",",
"patternnumber",
")",
"return",
"self",
".",
"read_register",
"(",
... | Get the 'actual step' parameter for a given pattern.
Args:
patternnumber (integer): 0-7
Returns:
The 'actual step' parameter (int). | [
"Get",
"the",
"actual",
"step",
"parameter",
"for",
"a",
"given",
"pattern",
"."
] | e99f4d74c83258c6039073082955ac9bed3f2155 | https://github.com/pyhys/minimalmodbus/blob/e99f4d74c83258c6039073082955ac9bed3f2155/omegacn7500.py#L287-L300 | train |
pyhys/minimalmodbus | omegacn7500.py | OmegaCN7500.set_pattern_actual_step | def set_pattern_actual_step(self, patternnumber, value):
"""Set the 'actual step' parameter for a given pattern.
Args:
* patternnumber (integer): 0-7
* value (integer): 0-7
"""
_checkPatternNumber(patternnumber)
_checkStepNumber(value)
ad... | python | def set_pattern_actual_step(self, patternnumber, value):
"""Set the 'actual step' parameter for a given pattern.
Args:
* patternnumber (integer): 0-7
* value (integer): 0-7
"""
_checkPatternNumber(patternnumber)
_checkStepNumber(value)
ad... | [
"def",
"set_pattern_actual_step",
"(",
"self",
",",
"patternnumber",
",",
"value",
")",
":",
"_checkPatternNumber",
"(",
"patternnumber",
")",
"_checkStepNumber",
"(",
"value",
")",
"address",
"=",
"_calculateRegisterAddress",
"(",
"'actualstep'",
",",
"patternnumber"... | Set the 'actual step' parameter for a given pattern.
Args:
* patternnumber (integer): 0-7
* value (integer): 0-7 | [
"Set",
"the",
"actual",
"step",
"parameter",
"for",
"a",
"given",
"pattern",
"."
] | e99f4d74c83258c6039073082955ac9bed3f2155 | https://github.com/pyhys/minimalmodbus/blob/e99f4d74c83258c6039073082955ac9bed3f2155/omegacn7500.py#L303-L314 | train |
pyhys/minimalmodbus | omegacn7500.py | OmegaCN7500.get_pattern_additional_cycles | def get_pattern_additional_cycles(self, patternnumber):
"""Get the number of additional cycles for a given pattern.
Args:
patternnumber (integer): 0-7
Returns:
The number of additional cycles (int).
"""
_checkPatternN... | python | def get_pattern_additional_cycles(self, patternnumber):
"""Get the number of additional cycles for a given pattern.
Args:
patternnumber (integer): 0-7
Returns:
The number of additional cycles (int).
"""
_checkPatternN... | [
"def",
"get_pattern_additional_cycles",
"(",
"self",
",",
"patternnumber",
")",
":",
"_checkPatternNumber",
"(",
"patternnumber",
")",
"address",
"=",
"_calculateRegisterAddress",
"(",
"'cycles'",
",",
"patternnumber",
")",
"return",
"self",
".",
"read_register",
"(",... | Get the number of additional cycles for a given pattern.
Args:
patternnumber (integer): 0-7
Returns:
The number of additional cycles (int). | [
"Get",
"the",
"number",
"of",
"additional",
"cycles",
"for",
"a",
"given",
"pattern",
"."
] | e99f4d74c83258c6039073082955ac9bed3f2155 | https://github.com/pyhys/minimalmodbus/blob/e99f4d74c83258c6039073082955ac9bed3f2155/omegacn7500.py#L317-L330 | train |
pyhys/minimalmodbus | omegacn7500.py | OmegaCN7500.set_pattern_additional_cycles | def set_pattern_additional_cycles(self, patternnumber, value):
"""Set the number of additional cycles for a given pattern.
Args:
* patternnumber (integer): 0-7
* value (integer): 0-99
"""
_checkPatternNumber(patternnumber)
minimalmodbus._checkInt(value, m... | python | def set_pattern_additional_cycles(self, patternnumber, value):
"""Set the number of additional cycles for a given pattern.
Args:
* patternnumber (integer): 0-7
* value (integer): 0-99
"""
_checkPatternNumber(patternnumber)
minimalmodbus._checkInt(value, m... | [
"def",
"set_pattern_additional_cycles",
"(",
"self",
",",
"patternnumber",
",",
"value",
")",
":",
"_checkPatternNumber",
"(",
"patternnumber",
")",
"minimalmodbus",
".",
"_checkInt",
"(",
"value",
",",
"minvalue",
"=",
"0",
",",
"maxvalue",
"=",
"99",
",",
"d... | Set the number of additional cycles for a given pattern.
Args:
* patternnumber (integer): 0-7
* value (integer): 0-99 | [
"Set",
"the",
"number",
"of",
"additional",
"cycles",
"for",
"a",
"given",
"pattern",
"."
] | e99f4d74c83258c6039073082955ac9bed3f2155 | https://github.com/pyhys/minimalmodbus/blob/e99f4d74c83258c6039073082955ac9bed3f2155/omegacn7500.py#L333-L344 | train |
pyhys/minimalmodbus | omegacn7500.py | OmegaCN7500.get_pattern_link_topattern | def get_pattern_link_topattern(self, patternnumber):
"""Get the 'linked pattern' value for a given pattern.
Args:
patternnumber (integer): From 0-7
Returns:
The 'linked pattern' value (int).
"""
_checkPatternNumber(patternnumber)
add... | python | def get_pattern_link_topattern(self, patternnumber):
"""Get the 'linked pattern' value for a given pattern.
Args:
patternnumber (integer): From 0-7
Returns:
The 'linked pattern' value (int).
"""
_checkPatternNumber(patternnumber)
add... | [
"def",
"get_pattern_link_topattern",
"(",
"self",
",",
"patternnumber",
")",
":",
"_checkPatternNumber",
"(",
"patternnumber",
")",
"address",
"=",
"_calculateRegisterAddress",
"(",
"'linkpattern'",
",",
"patternnumber",
")",
"return",
"self",
".",
"read_register",
"(... | Get the 'linked pattern' value for a given pattern.
Args:
patternnumber (integer): From 0-7
Returns:
The 'linked pattern' value (int). | [
"Get",
"the",
"linked",
"pattern",
"value",
"for",
"a",
"given",
"pattern",
"."
] | e99f4d74c83258c6039073082955ac9bed3f2155 | https://github.com/pyhys/minimalmodbus/blob/e99f4d74c83258c6039073082955ac9bed3f2155/omegacn7500.py#L347-L359 | train |
pyhys/minimalmodbus | omegacn7500.py | OmegaCN7500.get_all_pattern_variables | def get_all_pattern_variables(self, patternnumber):
"""Get all variables for a given pattern at one time.
Args:
patternnumber (integer): 0-7
Returns:
A descriptive multiline string.
"""
_checkPatternNumber(patternnumber)
... | python | def get_all_pattern_variables(self, patternnumber):
"""Get all variables for a given pattern at one time.
Args:
patternnumber (integer): 0-7
Returns:
A descriptive multiline string.
"""
_checkPatternNumber(patternnumber)
... | [
"def",
"get_all_pattern_variables",
"(",
"self",
",",
"patternnumber",
")",
":",
"_checkPatternNumber",
"(",
"patternnumber",
")",
"outputstring",
"=",
"''",
"for",
"stepnumber",
"in",
"range",
"(",
"8",
")",
":",
"outputstring",
"+=",
"'SP{0}: {1} Time{0}: {2}\\n'... | Get all variables for a given pattern at one time.
Args:
patternnumber (integer): 0-7
Returns:
A descriptive multiline string. | [
"Get",
"all",
"variables",
"for",
"a",
"given",
"pattern",
"at",
"one",
"time",
"."
] | e99f4d74c83258c6039073082955ac9bed3f2155 | https://github.com/pyhys/minimalmodbus/blob/e99f4d74c83258c6039073082955ac9bed3f2155/omegacn7500.py#L376-L398 | train |
pyhys/minimalmodbus | omegacn7500.py | OmegaCN7500.set_all_pattern_variables | def set_all_pattern_variables(self, patternnumber, \
sp0, ti0, sp1, ti1, sp2, ti2, sp3, ti3, sp4, ti4, sp5, ti5, sp6, ti6, sp7, ti7, \
actual_step, additional_cycles, link_pattern):
"""Set all variables for a given pattern at one time.
Args:
* patternnumber (integer): 0-7
... | python | def set_all_pattern_variables(self, patternnumber, \
sp0, ti0, sp1, ti1, sp2, ti2, sp3, ti3, sp4, ti4, sp5, ti5, sp6, ti6, sp7, ti7, \
actual_step, additional_cycles, link_pattern):
"""Set all variables for a given pattern at one time.
Args:
* patternnumber (integer): 0-7
... | [
"def",
"set_all_pattern_variables",
"(",
"self",
",",
"patternnumber",
",",
"sp0",
",",
"ti0",
",",
"sp1",
",",
"ti1",
",",
"sp2",
",",
"ti2",
",",
"sp3",
",",
"ti3",
",",
"sp4",
",",
"ti4",
",",
"sp5",
",",
"ti5",
",",
"sp6",
",",
"ti6",
",",
"s... | Set all variables for a given pattern at one time.
Args:
* patternnumber (integer): 0-7
* sp[*n*] (float): setpoint value for step *n*
* ti[*n*] (integer??): step time for step *n*, 0-900
* actual_step (int): ?
* additional_cycles(int): ?
... | [
"Set",
"all",
"variables",
"for",
"a",
"given",
"pattern",
"at",
"one",
"time",
"."
] | e99f4d74c83258c6039073082955ac9bed3f2155 | https://github.com/pyhys/minimalmodbus/blob/e99f4d74c83258c6039073082955ac9bed3f2155/omegacn7500.py#L401-L435 | train |
pyhys/minimalmodbus | dummy_serial.py | Serial.close | def close(self):
"""Close a port on dummy_serial."""
if VERBOSE:
_print_out('\nDummy_serial: Closing port\n')
if not self._isOpen:
raise IOError('Dummy_serial: The port is already closed')
self._isOpen = False
self.port = None | python | def close(self):
"""Close a port on dummy_serial."""
if VERBOSE:
_print_out('\nDummy_serial: Closing port\n')
if not self._isOpen:
raise IOError('Dummy_serial: The port is already closed')
self._isOpen = False
self.port = None | [
"def",
"close",
"(",
"self",
")",
":",
"if",
"VERBOSE",
":",
"_print_out",
"(",
"'\\nDummy_serial: Closing port\\n'",
")",
"if",
"not",
"self",
".",
"_isOpen",
":",
"raise",
"IOError",
"(",
"'Dummy_serial: The port is already closed'",
")",
"self",
".",
"_isOpen",... | Close a port on dummy_serial. | [
"Close",
"a",
"port",
"on",
"dummy_serial",
"."
] | e99f4d74c83258c6039073082955ac9bed3f2155 | https://github.com/pyhys/minimalmodbus/blob/e99f4d74c83258c6039073082955ac9bed3f2155/dummy_serial.py#L129-L138 | train |
pyhys/minimalmodbus | dummy_serial.py | Serial.write | def write(self, inputdata):
"""Write to a port on dummy_serial.
Args:
inputdata (string/bytes): data for sending to the port on dummy_serial. Will affect the response
for subsequent read operations.
Note that for Python2, the inputdata should be a **string**. For Pytho... | python | def write(self, inputdata):
"""Write to a port on dummy_serial.
Args:
inputdata (string/bytes): data for sending to the port on dummy_serial. Will affect the response
for subsequent read operations.
Note that for Python2, the inputdata should be a **string**. For Pytho... | [
"def",
"write",
"(",
"self",
",",
"inputdata",
")",
":",
"if",
"VERBOSE",
":",
"_print_out",
"(",
"'\\nDummy_serial: Writing to port. Given:'",
"+",
"repr",
"(",
"inputdata",
")",
"+",
"'\\n'",
")",
"if",
"sys",
".",
"version_info",
"[",
"0",
"]",
">",
"2"... | Write to a port on dummy_serial.
Args:
inputdata (string/bytes): data for sending to the port on dummy_serial. Will affect the response
for subsequent read operations.
Note that for Python2, the inputdata should be a **string**. For Python3 it should be of type **bytes**. | [
"Write",
"to",
"a",
"port",
"on",
"dummy_serial",
"."
] | e99f4d74c83258c6039073082955ac9bed3f2155 | https://github.com/pyhys/minimalmodbus/blob/e99f4d74c83258c6039073082955ac9bed3f2155/dummy_serial.py#L141-L169 | train |
pyhys/minimalmodbus | dummy_serial.py | Serial.read | def read(self, numberOfBytes):
"""Read from a port on dummy_serial.
The response is dependent on what was written last to the port on dummy_serial,
and what is defined in the :data:`RESPONSES` dictionary.
Args:
numberOfBytes (int): For compability with the real function.
... | python | def read(self, numberOfBytes):
"""Read from a port on dummy_serial.
The response is dependent on what was written last to the port on dummy_serial,
and what is defined in the :data:`RESPONSES` dictionary.
Args:
numberOfBytes (int): For compability with the real function.
... | [
"def",
"read",
"(",
"self",
",",
"numberOfBytes",
")",
":",
"if",
"VERBOSE",
":",
"_print_out",
"(",
"'\\nDummy_serial: Reading from port (max length {!r} bytes)'",
".",
"format",
"(",
"numberOfBytes",
")",
")",
"if",
"numberOfBytes",
"<",
"0",
":",
"raise",
"IOEr... | Read from a port on dummy_serial.
The response is dependent on what was written last to the port on dummy_serial,
and what is defined in the :data:`RESPONSES` dictionary.
Args:
numberOfBytes (int): For compability with the real function.
Returns a **string** for Python2 a... | [
"Read",
"from",
"a",
"port",
"on",
"dummy_serial",
"."
] | e99f4d74c83258c6039073082955ac9bed3f2155 | https://github.com/pyhys/minimalmodbus/blob/e99f4d74c83258c6039073082955ac9bed3f2155/dummy_serial.py#L172-L227 | train |
pyhys/minimalmodbus | minimalmodbus.py | _embedPayload | def _embedPayload(slaveaddress, mode, functioncode, payloaddata):
"""Build a request from the slaveaddress, the function code and the payload data.
Args:
* slaveaddress (int): The address of the slave.
* mode (str): The modbus protcol mode (MODE_RTU or MODE_ASCII)
* functioncode (int): ... | python | def _embedPayload(slaveaddress, mode, functioncode, payloaddata):
"""Build a request from the slaveaddress, the function code and the payload data.
Args:
* slaveaddress (int): The address of the slave.
* mode (str): The modbus protcol mode (MODE_RTU or MODE_ASCII)
* functioncode (int): ... | [
"def",
"_embedPayload",
"(",
"slaveaddress",
",",
"mode",
",",
"functioncode",
",",
"payloaddata",
")",
":",
"_checkSlaveaddress",
"(",
"slaveaddress",
")",
"_checkMode",
"(",
"mode",
")",
"_checkFunctioncode",
"(",
"functioncode",
",",
"None",
")",
"_checkString"... | Build a request from the slaveaddress, the function code and the payload data.
Args:
* slaveaddress (int): The address of the slave.
* mode (str): The modbus protcol mode (MODE_RTU or MODE_ASCII)
* functioncode (int): The function code for the command to be performed. Can for example be 16 ... | [
"Build",
"a",
"request",
"from",
"the",
"slaveaddress",
"the",
"function",
"code",
"and",
"the",
"payload",
"data",
"."
] | e99f4d74c83258c6039073082955ac9bed3f2155 | https://github.com/pyhys/minimalmodbus/blob/e99f4d74c83258c6039073082955ac9bed3f2155/minimalmodbus.py#L939-L977 | train |
pyhys/minimalmodbus | minimalmodbus.py | _extractPayload | def _extractPayload(response, slaveaddress, mode, functioncode):
"""Extract the payload data part from the slave's response.
Args:
* response (str): The raw response byte string from the slave.
* slaveaddress (int): The adress of the slave. Used here for error checking only.
* mode (str... | python | def _extractPayload(response, slaveaddress, mode, functioncode):
"""Extract the payload data part from the slave's response.
Args:
* response (str): The raw response byte string from the slave.
* slaveaddress (int): The adress of the slave. Used here for error checking only.
* mode (str... | [
"def",
"_extractPayload",
"(",
"response",
",",
"slaveaddress",
",",
"mode",
",",
"functioncode",
")",
":",
"BYTEPOSITION_FOR_ASCII_HEADER",
"=",
"0",
"BYTEPOSITION_FOR_SLAVEADDRESS",
"=",
"0",
"BYTEPOSITION_FOR_FUNCTIONCODE",
"=",
"1",
"NUMBER_OF_RESPONSE_STARTBYTES",
"=... | Extract the payload data part from the slave's response.
Args:
* response (str): The raw response byte string from the slave.
* slaveaddress (int): The adress of the slave. Used here for error checking only.
* mode (str): The modbus protcol mode (MODE_RTU or MODE_ASCII)
* functionco... | [
"Extract",
"the",
"payload",
"data",
"part",
"from",
"the",
"slave",
"s",
"response",
"."
] | e99f4d74c83258c6039073082955ac9bed3f2155 | https://github.com/pyhys/minimalmodbus/blob/e99f4d74c83258c6039073082955ac9bed3f2155/minimalmodbus.py#L980-L1103 | train |
pyhys/minimalmodbus | minimalmodbus.py | _predictResponseSize | def _predictResponseSize(mode, functioncode, payloadToSlave):
"""Calculate the number of bytes that should be received from the slave.
Args:
* mode (str): The modbus protcol mode (MODE_RTU or MODE_ASCII)
* functioncode (int): Modbus function code.
* payloadToSlave (str): The raw request that is ... | python | def _predictResponseSize(mode, functioncode, payloadToSlave):
"""Calculate the number of bytes that should be received from the slave.
Args:
* mode (str): The modbus protcol mode (MODE_RTU or MODE_ASCII)
* functioncode (int): Modbus function code.
* payloadToSlave (str): The raw request that is ... | [
"def",
"_predictResponseSize",
"(",
"mode",
",",
"functioncode",
",",
"payloadToSlave",
")",
":",
"MIN_PAYLOAD_LENGTH",
"=",
"4",
"BYTERANGE_FOR_GIVEN_SIZE",
"=",
"slice",
"(",
"2",
",",
"4",
")",
"NUMBER_OF_PAYLOAD_BYTES_IN_WRITE_CONFIRMATION",
"=",
"4",
"NUMBER_OF_P... | Calculate the number of bytes that should be received from the slave.
Args:
* mode (str): The modbus protcol mode (MODE_RTU or MODE_ASCII)
* functioncode (int): Modbus function code.
* payloadToSlave (str): The raw request that is to be sent to the slave (not hex encoded string)
Returns:
... | [
"Calculate",
"the",
"number",
"of",
"bytes",
"that",
"should",
"be",
"received",
"from",
"the",
"slave",
"."
] | e99f4d74c83258c6039073082955ac9bed3f2155 | https://github.com/pyhys/minimalmodbus/blob/e99f4d74c83258c6039073082955ac9bed3f2155/minimalmodbus.py#L1110-L1172 | train |
pyhys/minimalmodbus | minimalmodbus.py | _calculate_minimum_silent_period | def _calculate_minimum_silent_period(baudrate):
"""Calculate the silent period length to comply with the 3.5 character silence between messages.
Args:
baudrate (numerical): The baudrate for the serial port
Returns:
The number of seconds (float) that should pass between each message on the ... | python | def _calculate_minimum_silent_period(baudrate):
"""Calculate the silent period length to comply with the 3.5 character silence between messages.
Args:
baudrate (numerical): The baudrate for the serial port
Returns:
The number of seconds (float) that should pass between each message on the ... | [
"def",
"_calculate_minimum_silent_period",
"(",
"baudrate",
")",
":",
"_checkNumerical",
"(",
"baudrate",
",",
"minvalue",
"=",
"1",
",",
"description",
"=",
"'baudrate'",
")",
"BITTIMES_PER_CHARACTERTIME",
"=",
"11",
"MINIMUM_SILENT_CHARACTERTIMES",
"=",
"3.5",
"bitt... | Calculate the silent period length to comply with the 3.5 character silence between messages.
Args:
baudrate (numerical): The baudrate for the serial port
Returns:
The number of seconds (float) that should pass between each message on the bus.
Raises:
ValueError, TypeError. | [
"Calculate",
"the",
"silent",
"period",
"length",
"to",
"comply",
"with",
"the",
"3",
".",
"5",
"character",
"silence",
"between",
"messages",
"."
] | e99f4d74c83258c6039073082955ac9bed3f2155 | https://github.com/pyhys/minimalmodbus/blob/e99f4d74c83258c6039073082955ac9bed3f2155/minimalmodbus.py#L1175-L1194 | train |
pyhys/minimalmodbus | minimalmodbus.py | _numToTwoByteString | def _numToTwoByteString(value, numberOfDecimals=0, LsbFirst=False, signed=False):
"""Convert a numerical value to a two-byte string, possibly scaling it.
Args:
* value (float or int): The numerical value to be converted.
* numberOfDecimals (int): Number of decimals, 0 or more, for scaling.
... | python | def _numToTwoByteString(value, numberOfDecimals=0, LsbFirst=False, signed=False):
"""Convert a numerical value to a two-byte string, possibly scaling it.
Args:
* value (float or int): The numerical value to be converted.
* numberOfDecimals (int): Number of decimals, 0 or more, for scaling.
... | [
"def",
"_numToTwoByteString",
"(",
"value",
",",
"numberOfDecimals",
"=",
"0",
",",
"LsbFirst",
"=",
"False",
",",
"signed",
"=",
"False",
")",
":",
"_checkNumerical",
"(",
"value",
",",
"description",
"=",
"'inputvalue'",
")",
"_checkInt",
"(",
"numberOfDecim... | Convert a numerical value to a two-byte string, possibly scaling it.
Args:
* value (float or int): The numerical value to be converted.
* numberOfDecimals (int): Number of decimals, 0 or more, for scaling.
* LsbFirst (bol): Whether the least significant byte should be first in the resulting... | [
"Convert",
"a",
"numerical",
"value",
"to",
"a",
"two",
"-",
"byte",
"string",
"possibly",
"scaling",
"it",
"."
] | e99f4d74c83258c6039073082955ac9bed3f2155 | https://github.com/pyhys/minimalmodbus/blob/e99f4d74c83258c6039073082955ac9bed3f2155/minimalmodbus.py#L1219-L1277 | train |
pyhys/minimalmodbus | minimalmodbus.py | _twoByteStringToNum | def _twoByteStringToNum(bytestring, numberOfDecimals=0, signed=False):
"""Convert a two-byte string to a numerical value, possibly scaling it.
Args:
* bytestring (str): A string of length 2.
* numberOfDecimals (int): The number of decimals. Defaults to 0.
* signed (bol): Whether large p... | python | def _twoByteStringToNum(bytestring, numberOfDecimals=0, signed=False):
"""Convert a two-byte string to a numerical value, possibly scaling it.
Args:
* bytestring (str): A string of length 2.
* numberOfDecimals (int): The number of decimals. Defaults to 0.
* signed (bol): Whether large p... | [
"def",
"_twoByteStringToNum",
"(",
"bytestring",
",",
"numberOfDecimals",
"=",
"0",
",",
"signed",
"=",
"False",
")",
":",
"_checkString",
"(",
"bytestring",
",",
"minlength",
"=",
"2",
",",
"maxlength",
"=",
"2",
",",
"description",
"=",
"'bytestring'",
")"... | Convert a two-byte string to a numerical value, possibly scaling it.
Args:
* bytestring (str): A string of length 2.
* numberOfDecimals (int): The number of decimals. Defaults to 0.
* signed (bol): Whether large positive values should be interpreted as negative values.
Returns:
... | [
"Convert",
"a",
"two",
"-",
"byte",
"string",
"to",
"a",
"numerical",
"value",
"possibly",
"scaling",
"it",
"."
] | e99f4d74c83258c6039073082955ac9bed3f2155 | https://github.com/pyhys/minimalmodbus/blob/e99f4d74c83258c6039073082955ac9bed3f2155/minimalmodbus.py#L1280-L1323 | train |
pyhys/minimalmodbus | minimalmodbus.py | _pack | def _pack(formatstring, value):
"""Pack a value into a bytestring.
Uses the built-in :mod:`struct` Python module.
Args:
* formatstring (str): String for the packing. See the :mod:`struct` module for details.
* value (depends on formatstring): The value to be packed
Returns:
A ... | python | def _pack(formatstring, value):
"""Pack a value into a bytestring.
Uses the built-in :mod:`struct` Python module.
Args:
* formatstring (str): String for the packing. See the :mod:`struct` module for details.
* value (depends on formatstring): The value to be packed
Returns:
A ... | [
"def",
"_pack",
"(",
"formatstring",
",",
"value",
")",
":",
"_checkString",
"(",
"formatstring",
",",
"description",
"=",
"'formatstring'",
",",
"minlength",
"=",
"1",
")",
"try",
":",
"result",
"=",
"struct",
".",
"pack",
"(",
"formatstring",
",",
"value... | Pack a value into a bytestring.
Uses the built-in :mod:`struct` Python module.
Args:
* formatstring (str): String for the packing. See the :mod:`struct` module for details.
* value (depends on formatstring): The value to be packed
Returns:
A bytestring (str).
Raises:
... | [
"Pack",
"a",
"value",
"into",
"a",
"bytestring",
"."
] | e99f4d74c83258c6039073082955ac9bed3f2155 | https://github.com/pyhys/minimalmodbus/blob/e99f4d74c83258c6039073082955ac9bed3f2155/minimalmodbus.py#L1597-L1627 | train |
pyhys/minimalmodbus | minimalmodbus.py | _unpack | def _unpack(formatstring, packed):
"""Unpack a bytestring into a value.
Uses the built-in :mod:`struct` Python module.
Args:
* formatstring (str): String for the packing. See the :mod:`struct` module for details.
* packed (str): The bytestring to be unpacked.
Returns:
A value.... | python | def _unpack(formatstring, packed):
"""Unpack a bytestring into a value.
Uses the built-in :mod:`struct` Python module.
Args:
* formatstring (str): String for the packing. See the :mod:`struct` module for details.
* packed (str): The bytestring to be unpacked.
Returns:
A value.... | [
"def",
"_unpack",
"(",
"formatstring",
",",
"packed",
")",
":",
"_checkString",
"(",
"formatstring",
",",
"description",
"=",
"'formatstring'",
",",
"minlength",
"=",
"1",
")",
"_checkString",
"(",
"packed",
",",
"description",
"=",
"'packed string'",
",",
"mi... | Unpack a bytestring into a value.
Uses the built-in :mod:`struct` Python module.
Args:
* formatstring (str): String for the packing. See the :mod:`struct` module for details.
* packed (str): The bytestring to be unpacked.
Returns:
A value. The type depends on the formatstring.
... | [
"Unpack",
"a",
"bytestring",
"into",
"a",
"value",
"."
] | e99f4d74c83258c6039073082955ac9bed3f2155 | https://github.com/pyhys/minimalmodbus/blob/e99f4d74c83258c6039073082955ac9bed3f2155/minimalmodbus.py#L1630-L1662 | train |
pyhys/minimalmodbus | minimalmodbus.py | _hexencode | def _hexencode(bytestring, insert_spaces = False):
"""Convert a byte string to a hex encoded string.
For example 'J' will return '4A', and ``'\\x04'`` will return '04'.
Args:
bytestring (str): Can be for example ``'A\\x01B\\x45'``.
insert_spaces (bool): Insert space characters between pair... | python | def _hexencode(bytestring, insert_spaces = False):
"""Convert a byte string to a hex encoded string.
For example 'J' will return '4A', and ``'\\x04'`` will return '04'.
Args:
bytestring (str): Can be for example ``'A\\x01B\\x45'``.
insert_spaces (bool): Insert space characters between pair... | [
"def",
"_hexencode",
"(",
"bytestring",
",",
"insert_spaces",
"=",
"False",
")",
":",
"_checkString",
"(",
"bytestring",
",",
"description",
"=",
"'byte string'",
")",
"separator",
"=",
"''",
"if",
"not",
"insert_spaces",
"else",
"' '",
"byte_representions",
"="... | Convert a byte string to a hex encoded string.
For example 'J' will return '4A', and ``'\\x04'`` will return '04'.
Args:
bytestring (str): Can be for example ``'A\\x01B\\x45'``.
insert_spaces (bool): Insert space characters between pair of characters to increase readability.
Returns:
... | [
"Convert",
"a",
"byte",
"string",
"to",
"a",
"hex",
"encoded",
"string",
"."
] | e99f4d74c83258c6039073082955ac9bed3f2155 | https://github.com/pyhys/minimalmodbus/blob/e99f4d74c83258c6039073082955ac9bed3f2155/minimalmodbus.py#L1665-L1692 | train |
pyhys/minimalmodbus | minimalmodbus.py | _hexdecode | def _hexdecode(hexstring):
"""Convert a hex encoded string to a byte string.
For example '4A' will return 'J', and '04' will return ``'\\x04'`` (which has length 1).
Args:
hexstring (str): Can be for example 'A3' or 'A3B4'. Must be of even length.
Allowed characters are '0' to '9', 'a' to ... | python | def _hexdecode(hexstring):
"""Convert a hex encoded string to a byte string.
For example '4A' will return 'J', and '04' will return ``'\\x04'`` (which has length 1).
Args:
hexstring (str): Can be for example 'A3' or 'A3B4'. Must be of even length.
Allowed characters are '0' to '9', 'a' to ... | [
"def",
"_hexdecode",
"(",
"hexstring",
")",
":",
"_checkString",
"(",
"hexstring",
",",
"description",
"=",
"'hexstring'",
")",
"if",
"len",
"(",
"hexstring",
")",
"%",
"2",
"!=",
"0",
":",
"raise",
"ValueError",
"(",
"'The input hexstring must be of even length... | Convert a hex encoded string to a byte string.
For example '4A' will return 'J', and '04' will return ``'\\x04'`` (which has length 1).
Args:
hexstring (str): Can be for example 'A3' or 'A3B4'. Must be of even length.
Allowed characters are '0' to '9', 'a' to 'f' and 'A' to 'F' (not space).
... | [
"Convert",
"a",
"hex",
"encoded",
"string",
"to",
"a",
"byte",
"string",
"."
] | e99f4d74c83258c6039073082955ac9bed3f2155 | https://github.com/pyhys/minimalmodbus/blob/e99f4d74c83258c6039073082955ac9bed3f2155/minimalmodbus.py#L1695-L1733 | train |
pyhys/minimalmodbus | minimalmodbus.py | _bitResponseToValue | def _bitResponseToValue(bytestring):
"""Convert a response string to a numerical value.
Args:
bytestring (str): A string of length 1. Can be for example ``\\x01``.
Returns:
The converted value (int).
Raises:
TypeError, ValueError
"""
_checkString(bytestring, descripti... | python | def _bitResponseToValue(bytestring):
"""Convert a response string to a numerical value.
Args:
bytestring (str): A string of length 1. Can be for example ``\\x01``.
Returns:
The converted value (int).
Raises:
TypeError, ValueError
"""
_checkString(bytestring, descripti... | [
"def",
"_bitResponseToValue",
"(",
"bytestring",
")",
":",
"_checkString",
"(",
"bytestring",
",",
"description",
"=",
"'bytestring'",
",",
"minlength",
"=",
"1",
",",
"maxlength",
"=",
"1",
")",
"RESPONSE_ON",
"=",
"'\\x01'",
"RESPONSE_OFF",
"=",
"'\\x00'",
"... | Convert a response string to a numerical value.
Args:
bytestring (str): A string of length 1. Can be for example ``\\x01``.
Returns:
The converted value (int).
Raises:
TypeError, ValueError | [
"Convert",
"a",
"response",
"string",
"to",
"a",
"numerical",
"value",
"."
] | e99f4d74c83258c6039073082955ac9bed3f2155 | https://github.com/pyhys/minimalmodbus/blob/e99f4d74c83258c6039073082955ac9bed3f2155/minimalmodbus.py#L1747-L1770 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.