repository_name stringlengths 7 55 | func_path_in_repository stringlengths 4 223 | func_name stringlengths 1 134 | whole_func_string stringlengths 75 104k | language stringclasses 1
value | func_code_string stringlengths 75 104k | func_code_tokens listlengths 19 28.4k | func_documentation_string stringlengths 1 46.9k | func_documentation_tokens listlengths 1 1.97k | split_name stringclasses 1
value | func_code_url stringlengths 87 315 |
|---|---|---|---|---|---|---|---|---|---|---|
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",
"_",
"."
] | train | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L1174-L1181 |
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",
"_",
"."
] | train | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L1184-L1203 |
halcy/Mastodon.py | mastodon/Mastodon.py | Mastodon.status_post | def status_post(self, status, in_reply_to_id=None, media_ids=None,
sensitive=False, visibility=None, spoiler_text=None,
language=None, idempotency_key=None, content_type=None,
scheduled_at=None, poll=None):
"""
Post a status. Can optionally be ... | python | def status_post(self, status, in_reply_to_id=None, media_ids=None,
sensitive=False, visibility=None, spoiler_text=None,
language=None, idempotency_key=None, content_type=None,
scheduled_at=None, poll=None):
"""
Post a status. Can optionally be ... | [
"def",
"status_post",
"(",
"self",
",",
"status",
",",
"in_reply_to_id",
"=",
"None",
",",
"media_ids",
"=",
"None",
",",
"sensitive",
"=",
"False",
",",
"visibility",
"=",
"None",
",",
"spoiler_text",
"=",
"None",
",",
"language",
"=",
"None",
",",
"ide... | Post a status. Can optionally be in reply to another status and contain
media.
`media_ids` should be a list. (If it's not, the function will turn it
into one.) It can contain up to four pieces of media (uploaded via
`media_post()`_). `media_ids` can also be the `media dicts`_ r... | [
"Post",
"a",
"status",
".",
"Can",
"optionally",
"be",
"in",
"reply",
"to",
"another",
"status",
"and",
"contain",
"media",
".",
"media_ids",
"should",
"be",
"a",
"list",
".",
"(",
"If",
"it",
"s",
"not",
"the",
"function",
"will",
"turn",
"it",
"into"... | train | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L1386-L1492 |
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... | train | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L1506-L1541 |
halcy/Mastodon.py | mastodon/Mastodon.py | Mastodon.make_poll | def make_poll(self, options, expires_in, multiple=False, hide_totals=False):
"""
Generate a poll object that can be passed as the `poll` option when posting a status.
options is an array of strings with the poll options (Maximum, by default: 4),
expires_in is the time in seconds... | python | def make_poll(self, options, expires_in, multiple=False, hide_totals=False):
"""
Generate a poll object that can be passed as the `poll` option when posting a status.
options is an array of strings with the poll options (Maximum, by default: 4),
expires_in is the time in seconds... | [
"def",
"make_poll",
"(",
"self",
",",
"options",
",",
"expires_in",
",",
"multiple",
"=",
"False",
",",
"hide_totals",
"=",
"False",
")",
":",
"poll_params",
"=",
"locals",
"(",
")",
"del",
"poll_params",
"[",
"\"self\"",
"]",
"return",
"poll_params"
] | Generate a poll object that can be passed as the `poll` option when posting a status.
options is an array of strings with the poll options (Maximum, by default: 4),
expires_in is the time in seconds for which the poll should be open.
Set multiple to True to allow people to choose more t... | [
"Generate",
"a",
"poll",
"object",
"that",
"can",
"be",
"passed",
"as",
"the",
"poll",
"option",
"when",
"posting",
"a",
"status",
".",
"options",
"is",
"an",
"array",
"of",
"strings",
"with",
"the",
"poll",
"options",
"(",
"Maximum",
"by",
"default",
":... | train | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L1544-L1555 |
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"
] | train | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L1558-L1564 |
halcy/Mastodon.py | mastodon/Mastodon.py | Mastodon.status_reblog | def status_reblog(self, id, visibility=None):
"""
Reblog / boost a status.
The visibility parameter functions the same as in `status_post()`_ and
allows you to reduce the visibility of a reblogged status.
Returns a `toot dict`_ with a new status that wraps around the re... | python | def status_reblog(self, id, visibility=None):
"""
Reblog / boost a status.
The visibility parameter functions the same as in `status_post()`_ and
allows you to reduce the visibility of a reblogged status.
Returns a `toot dict`_ with a new status that wraps around the re... | [
"def",
"status_reblog",
"(",
"self",
",",
"id",
",",
"visibility",
"=",
"None",
")",
":",
"params",
"=",
"self",
".",
"__generate_params",
"(",
"locals",
"(",
")",
",",
"[",
"'id'",
"]",
")",
"valid_visibilities",
"=",
"[",
"'private'",
",",
"'public'",
... | Reblog / boost a status.
The visibility parameter functions the same as in `status_post()`_ and
allows you to reduce the visibility of a reblogged status.
Returns a `toot dict`_ with a new status that wraps around the reblogged one. | [
"Reblog",
"/",
"boost",
"a",
"status",
".",
"The",
"visibility",
"parameter",
"functions",
"the",
"same",
"as",
"in",
"status_post",
"()",
"_",
"and",
"allows",
"you",
"to",
"reduce",
"the",
"visibility",
"of",
"a",
"reblogged",
"status",
"."
] | train | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L1567-L1586 |
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",
"."
] | train | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L1589-L1597 |
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",
"."
] | train | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L1600-L1608 |
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",
"."
] | train | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L1611-L1619 |
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",
"."
] | train | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L1622-L1630 |
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",
"."
] | train | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L1633-L1641 |
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",
"."
] | train | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L1644-L1652 |
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",
"."
] | train | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L1655-L1663 |
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",
"_"
] | train | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L1669-L1681 |
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",
"."
] | train | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L1684-L1690 |
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",
... | train | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L1696-L1717 |
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"
] | train | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L1732-L1738 |
halcy/Mastodon.py | mastodon/Mastodon.py | Mastodon.conversations_read | def conversations_read(self, id):
"""
Marks a single conversation as read.
Returns the updated `conversation dict`_.
WARNING: This method is currently not documented in the official API and
might therefore be unstable.
"""
id = self.__unpack_id(i... | python | def conversations_read(self, id):
"""
Marks a single conversation as read.
Returns the updated `conversation dict`_.
WARNING: This method is currently not documented in the official API and
might therefore be unstable.
"""
id = self.__unpack_id(i... | [
"def",
"conversations_read",
"(",
"self",
",",
"id",
")",
":",
"id",
"=",
"self",
".",
"__unpack_id",
"(",
"id",
")",
"url",
"=",
"'/api/v1/conversations/{0}/read'",
".",
"format",
"(",
"str",
"(",
"id",
")",
")",
"return",
"self",
".",
"__api_request",
... | Marks a single conversation as read.
Returns the updated `conversation dict`_.
WARNING: This method is currently not documented in the official API and
might therefore be unstable. | [
"Marks",
"a",
"single",
"conversation",
"as",
"read",
".",
"Returns",
"the",
"updated",
"conversation",
"dict",
"_",
".",
"WARNING",
":",
"This",
"method",
"is",
"currently",
"not",
"documented",
"in",
"the",
"official",
"API",
"and",
"might",
"therefore",
"... | train | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L1745-L1756 |
halcy/Mastodon.py | mastodon/Mastodon.py | Mastodon.account_follow | def account_follow(self, id, reblogs=True):
"""
Follow a user.
Set `reblogs` to False to hide boosts by the followed user.
Returns a `relationship dict`_ containing the updated relationship to the user.
"""
id = self.__unpack_id(id)
params = self.__generate_para... | python | def account_follow(self, id, reblogs=True):
"""
Follow a user.
Set `reblogs` to False to hide boosts by the followed user.
Returns a `relationship dict`_ containing the updated relationship to the user.
"""
id = self.__unpack_id(id)
params = self.__generate_para... | [
"def",
"account_follow",
"(",
"self",
",",
"id",
",",
"reblogs",
"=",
"True",
")",
":",
"id",
"=",
"self",
".",
"__unpack_id",
"(",
"id",
")",
"params",
"=",
"self",
".",
"__generate_params",
"(",
"locals",
"(",
")",
")",
"if",
"params",
"[",
"\"rebl... | Follow a user.
Set `reblogs` to False to hide boosts by the followed user.
Returns a `relationship dict`_ containing the updated relationship to the user. | [
"Follow",
"a",
"user",
"."
] | train | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L1762-L1777 |
halcy/Mastodon.py | mastodon/Mastodon.py | Mastodon.follows | def follows(self, uri):
"""
Follow a remote user by uri (username@domain).
Returns a `user dict`_.
"""
params = self.__generate_params(locals())
return self.__api_request('POST', '/api/v1/follows', params) | python | def follows(self, uri):
"""
Follow a remote user by uri (username@domain).
Returns a `user dict`_.
"""
params = self.__generate_params(locals())
return self.__api_request('POST', '/api/v1/follows', params) | [
"def",
"follows",
"(",
"self",
",",
"uri",
")",
":",
"params",
"=",
"self",
".",
"__generate_params",
"(",
"locals",
"(",
")",
")",
"return",
"self",
".",
"__api_request",
"(",
"'POST'",
",",
"'/api/v1/follows'",
",",
"params",
")"
] | Follow a remote user by uri (username@domain).
Returns a `user dict`_. | [
"Follow",
"a",
"remote",
"user",
"by",
"uri",
"(",
"username@domain",
")",
"."
] | train | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L1780-L1787 |
halcy/Mastodon.py | mastodon/Mastodon.py | Mastodon.account_unfollow | def account_unfollow(self, id):
"""
Unfollow a user.
Returns a `relationship dict`_ containing the updated relationship to the user.
"""
id = self.__unpack_id(id)
url = '/api/v1/accounts/{0}/unfollow'.format(str(id))
return self.__api_request('POST', url) | python | def account_unfollow(self, id):
"""
Unfollow a user.
Returns a `relationship dict`_ containing the updated relationship to the user.
"""
id = self.__unpack_id(id)
url = '/api/v1/accounts/{0}/unfollow'.format(str(id))
return self.__api_request('POST', url) | [
"def",
"account_unfollow",
"(",
"self",
",",
"id",
")",
":",
"id",
"=",
"self",
".",
"__unpack_id",
"(",
"id",
")",
"url",
"=",
"'/api/v1/accounts/{0}/unfollow'",
".",
"format",
"(",
"str",
"(",
"id",
")",
")",
"return",
"self",
".",
"__api_request",
"("... | Unfollow a user.
Returns a `relationship dict`_ containing the updated relationship to the user. | [
"Unfollow",
"a",
"user",
"."
] | train | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L1790-L1798 |
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",
"."
] | train | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L1801-L1809 |
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",
"."
] | train | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L1812-L1820 |
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",
"."
] | train | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L1823-L1835 |
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",
"."
] | train | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L1838-L1846 |
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",
"."
] | train | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L1849-L1913 |
halcy/Mastodon.py | mastodon/Mastodon.py | Mastodon.account_pin | def account_pin(self, id):
"""
Pin / endorse a user.
Returns a `relationship dict`_ containing the updated relationship to the user.
"""
id = self.__unpack_id(id)
url = '/api/v1/accounts/{0}/pin'.format(str(id))
return self.__api_request('POST', url) | python | def account_pin(self, id):
"""
Pin / endorse a user.
Returns a `relationship dict`_ containing the updated relationship to the user.
"""
id = self.__unpack_id(id)
url = '/api/v1/accounts/{0}/pin'.format(str(id))
return self.__api_request('POST', url) | [
"def",
"account_pin",
"(",
"self",
",",
"id",
")",
":",
"id",
"=",
"self",
".",
"__unpack_id",
"(",
"id",
")",
"url",
"=",
"'/api/v1/accounts/{0}/pin'",
".",
"format",
"(",
"str",
"(",
"id",
")",
")",
"return",
"self",
".",
"__api_request",
"(",
"'POST... | Pin / endorse a user.
Returns a `relationship dict`_ containing the updated relationship to the user. | [
"Pin",
"/",
"endorse",
"a",
"user",
".",
"Returns",
"a",
"relationship",
"dict",
"_",
"containing",
"the",
"updated",
"relationship",
"to",
"the",
"user",
"."
] | train | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L1917-L1925 |
halcy/Mastodon.py | mastodon/Mastodon.py | Mastodon.account_unpin | def account_unpin(self, id):
"""
Unpin / un-endorse a user.
Returns a `relationship dict`_ containing the updated relationship to the user.
"""
id = self.__unpack_id(id)
url = '/api/v1/accounts/{0}/unpin'.format(str(id))
return self.__api_request('POST', url) | python | def account_unpin(self, id):
"""
Unpin / un-endorse a user.
Returns a `relationship dict`_ containing the updated relationship to the user.
"""
id = self.__unpack_id(id)
url = '/api/v1/accounts/{0}/unpin'.format(str(id))
return self.__api_request('POST', url) | [
"def",
"account_unpin",
"(",
"self",
",",
"id",
")",
":",
"id",
"=",
"self",
".",
"__unpack_id",
"(",
"id",
")",
"url",
"=",
"'/api/v1/accounts/{0}/unpin'",
".",
"format",
"(",
"str",
"(",
"id",
")",
")",
"return",
"self",
".",
"__api_request",
"(",
"'... | Unpin / un-endorse a user.
Returns a `relationship dict`_ containing the updated relationship to the user. | [
"Unpin",
"/",
"un",
"-",
"endorse",
"a",
"user",
"."
] | train | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L1928-L1936 |
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",
... | train | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L1942-L1965 |
halcy/Mastodon.py | mastodon/Mastodon.py | Mastodon.filter_update | def filter_update(self, id, phrase = None, context = None, irreversible = None, whole_word = None, expires_in = None):
"""
Updates the filter with the given `id`. Parameters are the same
as in `filter_create()`.
Returns the `filter dict`_ of the updated filter.
"""
... | python | def filter_update(self, id, phrase = None, context = None, irreversible = None, whole_word = None, expires_in = None):
"""
Updates the filter with the given `id`. Parameters are the same
as in `filter_create()`.
Returns the `filter dict`_ of the updated filter.
"""
... | [
"def",
"filter_update",
"(",
"self",
",",
"id",
",",
"phrase",
"=",
"None",
",",
"context",
"=",
"None",
",",
"irreversible",
"=",
"None",
",",
"whole_word",
"=",
"None",
",",
"expires_in",
"=",
"None",
")",
":",
"id",
"=",
"self",
".",
"__unpack_id",
... | Updates the filter with the given `id`. Parameters are the same
as in `filter_create()`.
Returns the `filter dict`_ of the updated filter. | [
"Updates",
"the",
"filter",
"with",
"the",
"given",
"id",
".",
"Parameters",
"are",
"the",
"same",
"as",
"in",
"filter_create",
"()",
".",
"Returns",
"the",
"filter",
"dict",
"_",
"of",
"the",
"updated",
"filter",
"."
] | train | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L1968-L1978 |
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",
"."
] | train | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L1981-L1987 |
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",
"."
] | train | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L1993-L1999 |
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",
"."
] | train | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L2005-L2012 |
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",
"."
] | train | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L2015-L2023 |
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",
"."
] | train | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L2026-L2031 |
halcy/Mastodon.py | mastodon/Mastodon.py | Mastodon.list_accounts_add | def list_accounts_add(self, id, account_ids):
"""
Add the account(s) given in `account_ids` to the list.
"""
id = self.__unpack_id(id)
if not isinstance(account_ids, list):
account_ids = [account_ids]
account_ids = list(map(lambda x: self.__unpack_id(... | python | def list_accounts_add(self, id, account_ids):
"""
Add the account(s) given in `account_ids` to the list.
"""
id = self.__unpack_id(id)
if not isinstance(account_ids, list):
account_ids = [account_ids]
account_ids = list(map(lambda x: self.__unpack_id(... | [
"def",
"list_accounts_add",
"(",
"self",
",",
"id",
",",
"account_ids",
")",
":",
"id",
"=",
"self",
".",
"__unpack_id",
"(",
"id",
")",
"if",
"not",
"isinstance",
"(",
"account_ids",
",",
"list",
")",
":",
"account_ids",
"=",
"[",
"account_ids",
"]",
... | Add the account(s) given in `account_ids` to the list. | [
"Add",
"the",
"account",
"(",
"s",
")",
"given",
"in",
"account_ids",
"to",
"the",
"list",
"."
] | train | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L2034-L2045 |
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",
"."
] | train | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L2065-L2088 |
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",
"."
] | train | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L2094-L2100 |
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",
"."
] | train | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L2103-L2109 |
halcy/Mastodon.py | mastodon/Mastodon.py | Mastodon.media_post | def media_post(self, media_file, mime_type=None, description=None, focus=None):
"""
Post an image. `media_file` can either be image data or
a file name. If image data is passed directly, the mime
type has to be specified manually, otherwise, it is
determined from the file name. `... | python | def media_post(self, media_file, mime_type=None, description=None, focus=None):
"""
Post an image. `media_file` can either be image data or
a file name. If image data is passed directly, the mime
type has to be specified manually, otherwise, it is
determined from the file name. `... | [
"def",
"media_post",
"(",
"self",
",",
"media_file",
",",
"mime_type",
"=",
"None",
",",
"description",
"=",
"None",
",",
"focus",
"=",
"None",
")",
":",
"if",
"mime_type",
"is",
"None",
"and",
"(",
"isinstance",
"(",
"media_file",
",",
"str",
")",
"an... | Post an image. `media_file` can either be image data or
a file name. If image data is passed directly, the mime
type has to be specified manually, otherwise, it is
determined from the file name. `focus` should be a tuple
of floats between -1 and 1, giving the x and y coordinates
... | [
"Post",
"an",
"image",
".",
"media_file",
"can",
"either",
"be",
"image",
"data",
"or",
"a",
"file",
"name",
".",
"If",
"image",
"data",
"is",
"passed",
"directly",
"the",
"mime",
"type",
"has",
"to",
"be",
"specified",
"manually",
"otherwise",
"it",
"is... | train | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L2115-L2152 |
halcy/Mastodon.py | mastodon/Mastodon.py | Mastodon.media_update | def media_update(self, id, description=None, focus=None):
"""
Update the metadata of the media file with the given `id`. `description` and
`focus` are as in `media_post()`_ .
Returns the updated `media dict`_.
"""
id = self.__unpack_id(id)
if focus != N... | python | def media_update(self, id, description=None, focus=None):
"""
Update the metadata of the media file with the given `id`. `description` and
`focus` are as in `media_post()`_ .
Returns the updated `media dict`_.
"""
id = self.__unpack_id(id)
if focus != N... | [
"def",
"media_update",
"(",
"self",
",",
"id",
",",
"description",
"=",
"None",
",",
"focus",
"=",
"None",
")",
":",
"id",
"=",
"self",
".",
"__unpack_id",
"(",
"id",
")",
"if",
"focus",
"!=",
"None",
":",
"focus",
"=",
"str",
"(",
"focus",
"[",
... | Update the metadata of the media file with the given `id`. `description` and
`focus` are as in `media_post()`_ .
Returns the updated `media dict`_. | [
"Update",
"the",
"metadata",
"of",
"the",
"media",
"file",
"with",
"the",
"given",
"id",
".",
"description",
"and",
"focus",
"are",
"as",
"in",
"media_post",
"()",
"_",
".",
"Returns",
"the",
"updated",
"media",
"dict",
"_",
"."
] | train | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L2155-L2168 |
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",
"."
] | train | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L2174-L2179 |
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",
"."
] | train | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L2182-L2187 |
halcy/Mastodon.py | mastodon/Mastodon.py | Mastodon.push_subscription_set | def push_subscription_set(self, endpoint, encrypt_params, follow_events=None,
favourite_events=None, reblog_events=None,
mention_events=None):
"""
Sets up or modifies the push subscription the logged-in user has for this app.
... | python | def push_subscription_set(self, endpoint, encrypt_params, follow_events=None,
favourite_events=None, reblog_events=None,
mention_events=None):
"""
Sets up or modifies the push subscription the logged-in user has for this app.
... | [
"def",
"push_subscription_set",
"(",
"self",
",",
"endpoint",
",",
"encrypt_params",
",",
"follow_events",
"=",
"None",
",",
"favourite_events",
"=",
"None",
",",
"reblog_events",
"=",
"None",
",",
"mention_events",
"=",
"None",
")",
":",
"endpoint",
"=",
"Mas... | Sets up or modifies the push subscription the logged-in user has for this app.
`endpoint` is the endpoint URL mastodon should call for pushes. Note that mastodon
requires https for this URL. `encrypt_params` is a dict with key parameters that allow
the server to encrypt data for you: A ... | [
"Sets",
"up",
"or",
"modifies",
"the",
"push",
"subscription",
"the",
"logged",
"-",
"in",
"user",
"has",
"for",
"this",
"app",
".",
"endpoint",
"is",
"the",
"endpoint",
"URL",
"mastodon",
"should",
"call",
"for",
"pushes",
".",
"Note",
"that",
"mastodon",... | train | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L2193-L2232 |
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",
"_",
"."
] | train | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L2235-L2257 |
halcy/Mastodon.py | mastodon/Mastodon.py | Mastodon.push_subscription_generate_keys | def push_subscription_generate_keys(self):
"""
Generates a private key, public key and shared secret for use in webpush subscriptions.
Returns two dicts: One with the private key and shared secret and another with the
public key and shared secret.
"""
push_key_p... | python | def push_subscription_generate_keys(self):
"""
Generates a private key, public key and shared secret for use in webpush subscriptions.
Returns two dicts: One with the private key and shared secret and another with the
public key and shared secret.
"""
push_key_p... | [
"def",
"push_subscription_generate_keys",
"(",
"self",
")",
":",
"push_key_pair",
"=",
"ec",
".",
"generate_private_key",
"(",
"ec",
".",
"SECP256R1",
"(",
")",
",",
"default_backend",
"(",
")",
")",
"push_key_priv",
"=",
"push_key_pair",
".",
"private_numbers",
... | Generates a private key, public key and shared secret for use in webpush subscriptions.
Returns two dicts: One with the private key and shared secret and another with the
public key and shared secret. | [
"Generates",
"a",
"private",
"key",
"public",
"key",
"and",
"shared",
"secret",
"for",
"use",
"in",
"webpush",
"subscriptions",
".",
"Returns",
"two",
"dicts",
":",
"One",
"with",
"the",
"private",
"key",
"and",
"shared",
"secret",
"and",
"another",
"with",
... | train | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L2270-L2292 |
halcy/Mastodon.py | mastodon/Mastodon.py | Mastodon.push_subscription_decrypt_push | def push_subscription_decrypt_push(self, data, decrypt_params, encryption_header, crypto_key_header):
"""
Decrypts `data` received in a webpush request. Requires the private key dict
from `push_subscription_generate_keys()`_ (`decrypt_params`) as well as the
Encryption and server Crypt... | python | def push_subscription_decrypt_push(self, data, decrypt_params, encryption_header, crypto_key_header):
"""
Decrypts `data` received in a webpush request. Requires the private key dict
from `push_subscription_generate_keys()`_ (`decrypt_params`) as well as the
Encryption and server Crypt... | [
"def",
"push_subscription_decrypt_push",
"(",
"self",
",",
"data",
",",
"decrypt_params",
",",
"encryption_header",
",",
"crypto_key_header",
")",
":",
"salt",
"=",
"self",
".",
"__decode_webpush_b64",
"(",
"encryption_header",
".",
"split",
"(",
"\"salt=\"",
")",
... | Decrypts `data` received in a webpush request. Requires the private key dict
from `push_subscription_generate_keys()`_ (`decrypt_params`) as well as the
Encryption and server Crypto-Key headers from the received webpush
Returns the decoded webpush as a `push notification dict`_. | [
"Decrypts",
"data",
"received",
"in",
"a",
"webpush",
"request",
".",
"Requires",
"the",
"private",
"key",
"dict",
"from",
"push_subscription_generate_keys",
"()",
"_",
"(",
"decrypt_params",
")",
"as",
"well",
"as",
"the",
"Encryption",
"and",
"server",
"Crypto... | train | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L2294-L2317 |
halcy/Mastodon.py | mastodon/Mastodon.py | Mastodon.fetch_next | def fetch_next(self, previous_page):
"""
Fetches the next page of results of a paginated request. Pass in the
previous page in its entirety, or the pagination information dict
returned as a part of that pages last status ('_pagination_next').
Returns the next page or None if no ... | python | def fetch_next(self, previous_page):
"""
Fetches the next page of results of a paginated request. Pass in the
previous page in its entirety, or the pagination information dict
returned as a part of that pages last status ('_pagination_next').
Returns the next page or None if no ... | [
"def",
"fetch_next",
"(",
"self",
",",
"previous_page",
")",
":",
"if",
"isinstance",
"(",
"previous_page",
",",
"list",
")",
"and",
"len",
"(",
"previous_page",
")",
"!=",
"0",
":",
"if",
"hasattr",
"(",
"previous_page",
"[",
"-",
"1",
"]",
",",
"'_pa... | Fetches the next page of results of a paginated request. Pass in the
previous page in its entirety, or the pagination information dict
returned as a part of that pages last status ('_pagination_next').
Returns the next page or None if no further data is available. | [
"Fetches",
"the",
"next",
"page",
"of",
"results",
"of",
"a",
"paginated",
"request",
".",
"Pass",
"in",
"the",
"previous",
"page",
"in",
"its",
"entirety",
"or",
"the",
"pagination",
"information",
"dict",
"returned",
"as",
"a",
"part",
"of",
"that",
"pag... | train | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L2322-L2344 |
halcy/Mastodon.py | mastodon/Mastodon.py | Mastodon.fetch_previous | def fetch_previous(self, next_page):
"""
Fetches the previous page of results of a paginated request. Pass in the
previous page in its entirety, or the pagination information dict
returned as a part of that pages first status ('_pagination_prev').
Returns the previous page or No... | python | def fetch_previous(self, next_page):
"""
Fetches the previous page of results of a paginated request. Pass in the
previous page in its entirety, or the pagination information dict
returned as a part of that pages first status ('_pagination_prev').
Returns the previous page or No... | [
"def",
"fetch_previous",
"(",
"self",
",",
"next_page",
")",
":",
"if",
"isinstance",
"(",
"next_page",
",",
"list",
")",
"and",
"len",
"(",
"next_page",
")",
"!=",
"0",
":",
"if",
"hasattr",
"(",
"next_page",
"[",
"0",
"]",
",",
"'_pagination_prev'",
... | Fetches the previous page of results of a paginated request. Pass in the
previous page in its entirety, or the pagination information dict
returned as a part of that pages first status ('_pagination_prev').
Returns the previous page or None if no further data is available. | [
"Fetches",
"the",
"previous",
"page",
"of",
"results",
"of",
"a",
"paginated",
"request",
".",
"Pass",
"in",
"the",
"previous",
"page",
"in",
"its",
"entirety",
"or",
"the",
"pagination",
"information",
"dict",
"returned",
"as",
"a",
"part",
"of",
"that",
... | train | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L2346-L2368 |
halcy/Mastodon.py | mastodon/Mastodon.py | Mastodon.fetch_remaining | def fetch_remaining(self, first_page):
"""
Fetches all the remaining pages of a paginated request starting from a
first page and returns the entire set of results (including the first page
that was passed in) as a big list.
Be careful, as this might generate a lot of requests, d... | python | def fetch_remaining(self, first_page):
"""
Fetches all the remaining pages of a paginated request starting from a
first page and returns the entire set of results (including the first page
that was passed in) as a big list.
Be careful, as this might generate a lot of requests, d... | [
"def",
"fetch_remaining",
"(",
"self",
",",
"first_page",
")",
":",
"first_page",
"=",
"copy",
".",
"deepcopy",
"(",
"first_page",
")",
"all_pages",
"=",
"[",
"]",
"current_page",
"=",
"first_page",
"while",
"current_page",
"is",
"not",
"None",
"and",
"len",... | Fetches all the remaining pages of a paginated request starting from a
first page and returns the entire set of results (including the first page
that was passed in) as a big list.
Be careful, as this might generate a lot of requests, depending on what you are
fetching, and might cause ... | [
"Fetches",
"all",
"the",
"remaining",
"pages",
"of",
"a",
"paginated",
"request",
"starting",
"from",
"a",
"first",
"page",
"and",
"returns",
"the",
"entire",
"set",
"of",
"results",
"(",
"including",
"the",
"first",
"page",
"that",
"was",
"passed",
"in",
... | train | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L2370-L2387 |
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",
"."
] | train | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L2393-L2398 |
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",
"."
] | train | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L2415-L2422 |
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",
"."
] | train | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L2425-L2431 |
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",
"."
] | train | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L2443-L2458 |
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",
"."
] | train | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L2460-L2466 |
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",
"."
] | train | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L2480-L2495 |
halcy/Mastodon.py | mastodon/Mastodon.py | Mastodon.__json_truefalse_parse | def __json_truefalse_parse(json_object):
"""
Parse 'True' / 'False' strings in certain known fields
"""
for key in ('follow', 'favourite', 'reblog', 'mention'):
if (key in json_object and isinstance(json_object[key], six.text_type)):
if json_object[key] == 'Tr... | python | def __json_truefalse_parse(json_object):
"""
Parse 'True' / 'False' strings in certain known fields
"""
for key in ('follow', 'favourite', 'reblog', 'mention'):
if (key in json_object and isinstance(json_object[key], six.text_type)):
if json_object[key] == 'Tr... | [
"def",
"__json_truefalse_parse",
"(",
"json_object",
")",
":",
"for",
"key",
"in",
"(",
"'follow'",
",",
"'favourite'",
",",
"'reblog'",
",",
"'mention'",
")",
":",
"if",
"(",
"key",
"in",
"json_object",
"and",
"isinstance",
"(",
"json_object",
"[",
"key",
... | Parse 'True' / 'False' strings in certain known fields | [
"Parse",
"True",
"/",
"False",
"strings",
"in",
"certain",
"known",
"fields"
] | train | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L2498-L2508 |
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",
"."
] | train | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L2511-L2522 |
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",
"."
] | train | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L2525-L2533 |
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",
... | train | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L2536-L2545 |
halcy/Mastodon.py | mastodon/Mastodon.py | Mastodon.__api_request | def __api_request(self, method, endpoint, params={}, files={}, headers={}, access_token_override=None, do_ratelimiting=True, use_json = False):
"""
Internal API request helper.
"""
response = None
remaining_wait = 0
# "pace" mode ratelimiting: Assume constant rate of requ... | python | def __api_request(self, method, endpoint, params={}, files={}, headers={}, access_token_override=None, do_ratelimiting=True, use_json = False):
"""
Internal API request helper.
"""
response = None
remaining_wait = 0
# "pace" mode ratelimiting: Assume constant rate of requ... | [
"def",
"__api_request",
"(",
"self",
",",
"method",
",",
"endpoint",
",",
"params",
"=",
"{",
"}",
",",
"files",
"=",
"{",
"}",
",",
"headers",
"=",
"{",
"}",
",",
"access_token_override",
"=",
"None",
",",
"do_ratelimiting",
"=",
"True",
",",
"use_jso... | Internal API request helper. | [
"Internal",
"API",
"request",
"helper",
"."
] | train | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L2547-L2752 |
halcy/Mastodon.py | mastodon/Mastodon.py | Mastodon.__stream | def __stream(self, endpoint, listener, params={}, run_async=False, timeout=__DEFAULT_STREAM_TIMEOUT, reconnect_async=False, reconnect_async_wait_sec=__DEFAULT_STREAM_RECONNECT_WAIT_SEC):
"""
Internal streaming API helper.
Returns a handle to the open connection that the user can close if they
... | python | def __stream(self, endpoint, listener, params={}, run_async=False, timeout=__DEFAULT_STREAM_TIMEOUT, reconnect_async=False, reconnect_async_wait_sec=__DEFAULT_STREAM_RECONNECT_WAIT_SEC):
"""
Internal streaming API helper.
Returns a handle to the open connection that the user can close if they
... | [
"def",
"__stream",
"(",
"self",
",",
"endpoint",
",",
"listener",
",",
"params",
"=",
"{",
"}",
",",
"run_async",
"=",
"False",
",",
"timeout",
"=",
"__DEFAULT_STREAM_TIMEOUT",
",",
"reconnect_async",
"=",
"False",
",",
"reconnect_async_wait_sec",
"=",
"__DEFA... | Internal streaming API helper.
Returns a handle to the open connection that the user can close if they
wish to terminate it. | [
"Internal",
"streaming",
"API",
"helper",
"."
] | train | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L2754-L2865 |
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",
"."
] | train | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L2867-L2896 |
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",
"."
] | train | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L2911-L2918 |
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"
] | train | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L2924-L2927 |
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",
"# Some API en... | Internal add-protocol-to-url helper | [
"Internal",
"add",
"-",
"protocol",
"-",
"to",
"-",
"url",
"helper"
] | train | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L2939-L2946 |
halcy/Mastodon.py | mastodon/streaming.py | StreamListener.handle_stream | def handle_stream(self, response):
"""
Handles a stream of events from the Mastodon server. When each event
is received, the corresponding .on_[name]() method is called.
response; a requests response object with the open stream for reading.
"""
event = {}
line_bu... | python | def handle_stream(self, response):
"""
Handles a stream of events from the Mastodon server. When each event
is received, the corresponding .on_[name]() method is called.
response; a requests response object with the open stream for reading.
"""
event = {}
line_bu... | [
"def",
"handle_stream",
"(",
"self",
",",
"response",
")",
":",
"event",
"=",
"{",
"}",
"line_buffer",
"=",
"bytearray",
"(",
")",
"try",
":",
"for",
"chunk",
"in",
"response",
".",
"iter_content",
"(",
"chunk_size",
"=",
"1",
")",
":",
"if",
"chunk",
... | Handles a stream of events from the Mastodon server. When each event
is received, the corresponding .on_[name]() method is called.
response; a requests response object with the open stream for reading. | [
"Handles",
"a",
"stream",
"of",
"events",
"from",
"the",
"Mastodon",
"server",
".",
"When",
"each",
"event",
"is",
"received",
"the",
"corresponding",
".",
"on_",
"[",
"name",
"]",
"()",
"method",
"is",
"called",
"."
] | train | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/streaming.py#L54-L99 |
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"
] | train | https://github.com/faucamp/python-gsmmodem/blob/834c68b1387ca2c91e2210faa8f75526b39723b5/gsmmodem/modem.py#L76-L85 |
faucamp/python-gsmmodem | gsmmodem/modem.py | GsmModem.connect | def connect(self, pin=None):
""" Opens the port and initializes the modem and SIM card
:param pin: The SIM card PIN code, if any
:type pin: str
:raise PinRequiredError: if the SIM card requires a PIN but none was provided
:raise IncorrectPinError: if the specif... | python | def connect(self, pin=None):
""" Opens the port and initializes the modem and SIM card
:param pin: The SIM card PIN code, if any
:type pin: str
:raise PinRequiredError: if the SIM card requires a PIN but none was provided
:raise IncorrectPinError: if the specif... | [
"def",
"connect",
"(",
"self",
",",
"pin",
"=",
"None",
")",
":",
"self",
".",
"log",
".",
"info",
"(",
"'Connecting to modem on port %s at %dbps'",
",",
"self",
".",
"port",
",",
"self",
".",
"baudrate",
")",
"super",
"(",
"GsmModem",
",",
"self",
")",
... | Opens the port and initializes the modem and SIM card
:param pin: The SIM card PIN code, if any
:type pin: str
:raise PinRequiredError: if the SIM card requires a PIN but none was provided
:raise IncorrectPinError: if the specified PIN is incorrect | [
"Opens",
"the",
"port",
"and",
"initializes",
"the",
"modem",
"and",
"SIM",
"card",
":",
"param",
"pin",
":",
"The",
"SIM",
"card",
"PIN",
"code",
"if",
"any",
":",
"type",
"pin",
":",
"str",
":",
"raise",
"PinRequiredError",
":",
"if",
"the",
"SIM",
... | train | https://github.com/faucamp/python-gsmmodem/blob/834c68b1387ca2c91e2210faa8f75526b39723b5/gsmmodem/modem.py#L164-L364 |
faucamp/python-gsmmodem | gsmmodem/modem.py | GsmModem._unlockSim | def _unlockSim(self, pin):
""" Unlocks the SIM card using the specified PIN (if necessary, else does nothing) """
# Unlock the SIM card if needed
try:
cpinResponse = lineStartingWith('+CPIN', self.write('AT+CPIN?', timeout=0.25))
except TimeoutException as timeout:
... | python | def _unlockSim(self, pin):
""" Unlocks the SIM card using the specified PIN (if necessary, else does nothing) """
# Unlock the SIM card if needed
try:
cpinResponse = lineStartingWith('+CPIN', self.write('AT+CPIN?', timeout=0.25))
except TimeoutException as timeout:
... | [
"def",
"_unlockSim",
"(",
"self",
",",
"pin",
")",
":",
"# Unlock the SIM card if needed",
"try",
":",
"cpinResponse",
"=",
"lineStartingWith",
"(",
"'+CPIN'",
",",
"self",
".",
"write",
"(",
"'AT+CPIN?'",
",",
"timeout",
"=",
"0.25",
")",
")",
"except",
"Ti... | Unlocks the SIM card using the specified PIN (if necessary, else does nothing) | [
"Unlocks",
"the",
"SIM",
"card",
"using",
"the",
"specified",
"PIN",
"(",
"if",
"necessary",
"else",
"does",
"nothing",
")"
] | train | https://github.com/faucamp/python-gsmmodem/blob/834c68b1387ca2c91e2210faa8f75526b39723b5/gsmmodem/modem.py#L366-L385 |
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",
"."
] | train | https://github.com/faucamp/python-gsmmodem/blob/834c68b1387ca2c91e2210faa8f75526b39723b5/gsmmodem/modem.py#L387-L446 |
faucamp/python-gsmmodem | gsmmodem/modem.py | GsmModem.signalStrength | def signalStrength(self):
""" Checks the modem's cellular network signal strength
:raise CommandError: if an error occurs
:return: The network signal strength as an integer between 0 and 99, or -1 if it is unknown
:rtype: int
"""
csq = self.CSQ_REGEX.mat... | python | def signalStrength(self):
""" Checks the modem's cellular network signal strength
:raise CommandError: if an error occurs
:return: The network signal strength as an integer between 0 and 99, or -1 if it is unknown
:rtype: int
"""
csq = self.CSQ_REGEX.mat... | [
"def",
"signalStrength",
"(",
"self",
")",
":",
"csq",
"=",
"self",
".",
"CSQ_REGEX",
".",
"match",
"(",
"self",
".",
"write",
"(",
"'AT+CSQ'",
")",
"[",
"0",
"]",
")",
"if",
"csq",
":",
"ss",
"=",
"int",
"(",
"csq",
".",
"group",
"(",
"1",
")"... | Checks the modem's cellular network signal strength
:raise CommandError: if an error occurs
:return: The network signal strength as an integer between 0 and 99, or -1 if it is unknown
:rtype: int | [
"Checks",
"the",
"modem",
"s",
"cellular",
"network",
"signal",
"strength",
":",
"raise",
"CommandError",
":",
"if",
"an",
"error",
"occurs",
":",
"return",
":",
"The",
"network",
"signal",
"strength",
"as",
"an",
"integer",
"between",
"0",
"and",
"99",
"o... | train | https://github.com/faucamp/python-gsmmodem/blob/834c68b1387ca2c91e2210faa8f75526b39723b5/gsmmodem/modem.py#L449-L462 |
faucamp/python-gsmmodem | gsmmodem/modem.py | GsmModem.networkName | def networkName(self):
""" :return: the name of the GSM Network Operator to which the modem is connected """
copsMatch = lineMatching(r'^\+COPS: (\d),(\d),"(.+)",{0,1}\d*$', self.write('AT+COPS?')) # response format: +COPS: mode,format,"operator_name",x
if copsMatch:
return copsMatch... | python | def networkName(self):
""" :return: the name of the GSM Network Operator to which the modem is connected """
copsMatch = lineMatching(r'^\+COPS: (\d),(\d),"(.+)",{0,1}\d*$', self.write('AT+COPS?')) # response format: +COPS: mode,format,"operator_name",x
if copsMatch:
return copsMatch... | [
"def",
"networkName",
"(",
"self",
")",
":",
"copsMatch",
"=",
"lineMatching",
"(",
"r'^\\+COPS: (\\d),(\\d),\"(.+)\",{0,1}\\d*$'",
",",
"self",
".",
"write",
"(",
"'AT+COPS?'",
")",
")",
"# response format: +COPS: mode,format,\"operator_name\",x",
"if",
"copsMatch",
":",... | :return: the name of the GSM Network Operator to which the modem is connected | [
":",
"return",
":",
"the",
"name",
"of",
"the",
"GSM",
"Network",
"Operator",
"to",
"which",
"the",
"modem",
"is",
"connected"
] | train | https://github.com/faucamp/python-gsmmodem/blob/834c68b1387ca2c91e2210faa8f75526b39723b5/gsmmodem/modem.py#L493-L497 |
faucamp/python-gsmmodem | gsmmodem/modem.py | GsmModem.supportedCommands | def supportedCommands(self):
""" :return: list of AT commands supported by this modem (without the AT prefix). Returns None if not known """
try:
# AT+CLAC responses differ between modems. Most respond with +CLAC: and then a comma-separated list of commands
# while others simply ... | python | def supportedCommands(self):
""" :return: list of AT commands supported by this modem (without the AT prefix). Returns None if not known """
try:
# AT+CLAC responses differ between modems. Most respond with +CLAC: and then a comma-separated list of commands
# while others simply ... | [
"def",
"supportedCommands",
"(",
"self",
")",
":",
"try",
":",
"# AT+CLAC responses differ between modems. Most respond with +CLAC: and then a comma-separated list of commands",
"# while others simply return each command on a new line, with no +CLAC: prefix",
"response",
"=",
"self",
".",
... | :return: list of AT commands supported by this modem (without the AT prefix). Returns None if not known | [
":",
"return",
":",
"list",
"of",
"AT",
"commands",
"supported",
"by",
"this",
"modem",
"(",
"without",
"the",
"AT",
"prefix",
")",
".",
"Returns",
"None",
"if",
"not",
"known"
] | train | https://github.com/faucamp/python-gsmmodem/blob/834c68b1387ca2c91e2210faa8f75526b39723b5/gsmmodem/modem.py#L500-L517 |
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"
] | train | https://github.com/faucamp/python-gsmmodem/blob/834c68b1387ca2c91e2210faa8f75526b39723b5/gsmmodem/modem.py#L524-L530 |
faucamp/python-gsmmodem | gsmmodem/modem.py | GsmModem._setSmsMemory | def _setSmsMemory(self, readDelete=None, write=None):
""" Set the current SMS memory to use for read/delete/write operations """
# Switch to the correct memory type if required
if write != None and write != self._smsMemWrite:
self.write()
readDel = readDelete or self._sms... | python | def _setSmsMemory(self, readDelete=None, write=None):
""" Set the current SMS memory to use for read/delete/write operations """
# Switch to the correct memory type if required
if write != None and write != self._smsMemWrite:
self.write()
readDel = readDelete or self._sms... | [
"def",
"_setSmsMemory",
"(",
"self",
",",
"readDelete",
"=",
"None",
",",
"write",
"=",
"None",
")",
":",
"# Switch to the correct memory type if required",
"if",
"write",
"!=",
"None",
"and",
"write",
"!=",
"self",
".",
"_smsMemWrite",
":",
"self",
".",
"writ... | Set the current SMS memory to use for read/delete/write operations | [
"Set",
"the",
"current",
"SMS",
"memory",
"to",
"use",
"for",
"read",
"/",
"delete",
"/",
"write",
"operations"
] | train | https://github.com/faucamp/python-gsmmodem/blob/834c68b1387ca2c91e2210faa8f75526b39723b5/gsmmodem/modem.py#L532-L543 |
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"
] | train | https://github.com/faucamp/python-gsmmodem/blob/834c68b1387ca2c91e2210faa8f75526b39723b5/gsmmodem/modem.py#L545-L552 |
faucamp/python-gsmmodem | gsmmodem/modem.py | GsmModem.smsc | def smsc(self):
""" :return: The default SMSC number stored on the SIM card """
if self._smscNumber == None:
try:
readSmsc = self.write('AT+CSCA?')
except SmscNumberUnknownError:
pass # Some modems return a CMS 330 error if the value isn't set
... | python | def smsc(self):
""" :return: The default SMSC number stored on the SIM card """
if self._smscNumber == None:
try:
readSmsc = self.write('AT+CSCA?')
except SmscNumberUnknownError:
pass # Some modems return a CMS 330 error if the value isn't set
... | [
"def",
"smsc",
"(",
"self",
")",
":",
"if",
"self",
".",
"_smscNumber",
"==",
"None",
":",
"try",
":",
"readSmsc",
"=",
"self",
".",
"write",
"(",
"'AT+CSCA?'",
")",
"except",
"SmscNumberUnknownError",
":",
"pass",
"# Some modems return a CMS 330 error if the va... | :return: The default SMSC number stored on the SIM card | [
":",
"return",
":",
"The",
"default",
"SMSC",
"number",
"stored",
"on",
"the",
"SIM",
"card"
] | train | https://github.com/faucamp/python-gsmmodem/blob/834c68b1387ca2c91e2210faa8f75526b39723b5/gsmmodem/modem.py#L555-L566 |
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"
] | train | https://github.com/faucamp/python-gsmmodem/blob/834c68b1387ca2c91e2210faa8f75526b39723b5/gsmmodem/modem.py#L568-L573 |
faucamp/python-gsmmodem | gsmmodem/modem.py | GsmModem.waitForNetworkCoverage | def waitForNetworkCoverage(self, timeout=None):
""" Block until the modem has GSM network coverage.
This method blocks until the modem is registered with the network
and the signal strength is greater than 0, optionally timing out
if a timeout was specified
:pa... | python | def waitForNetworkCoverage(self, timeout=None):
""" Block until the modem has GSM network coverage.
This method blocks until the modem is registered with the network
and the signal strength is greater than 0, optionally timing out
if a timeout was specified
:pa... | [
"def",
"waitForNetworkCoverage",
"(",
"self",
",",
"timeout",
"=",
"None",
")",
":",
"block",
"=",
"[",
"True",
"]",
"if",
"timeout",
"!=",
"None",
":",
"# Set up a timeout mechanism",
"def",
"_cancelBlock",
"(",
")",
":",
"block",
"[",
"0",
"]",
"=",
"F... | Block until the modem has GSM network coverage.
This method blocks until the modem is registered with the network
and the signal strength is greater than 0, optionally timing out
if a timeout was specified
:param timeout: Maximum time to wait for network coverage, in s... | [
"Block",
"until",
"the",
"modem",
"has",
"GSM",
"network",
"coverage",
".",
"This",
"method",
"blocks",
"until",
"the",
"modem",
"is",
"registered",
"with",
"the",
"network",
"and",
"the",
"signal",
"strength",
"is",
"greater",
"than",
"0",
"optionally",
"ti... | train | https://github.com/faucamp/python-gsmmodem/blob/834c68b1387ca2c91e2210faa8f75526b39723b5/gsmmodem/modem.py#L575-L625 |
faucamp/python-gsmmodem | gsmmodem/modem.py | GsmModem.sendSms | def sendSms(self, destination, text, waitForDeliveryReport=False, deliveryTimeout=15, sendFlash=False):
""" Send an SMS text message
:param destination: the recipient's phone number
:type destination: str
:param text: the message text
:type text: str
:param waitF... | python | def sendSms(self, destination, text, waitForDeliveryReport=False, deliveryTimeout=15, sendFlash=False):
""" Send an SMS text message
:param destination: the recipient's phone number
:type destination: str
:param text: the message text
:type text: str
:param waitF... | [
"def",
"sendSms",
"(",
"self",
",",
"destination",
",",
"text",
",",
"waitForDeliveryReport",
"=",
"False",
",",
"deliveryTimeout",
"=",
"15",
",",
"sendFlash",
"=",
"False",
")",
":",
"if",
"self",
".",
"_smsTextMode",
":",
"self",
".",
"write",
"(",
"'... | Send an SMS text message
:param destination: the recipient's phone number
:type destination: str
:param text: the message text
:type text: str
:param waitForDeliveryReport: if True, this method blocks until a delivery report is received for the sent message
:type... | [
"Send",
"an",
"SMS",
"text",
"message",
":",
"param",
"destination",
":",
"the",
"recipient",
"s",
"phone",
"number",
":",
"type",
"destination",
":",
"str",
":",
"param",
"text",
":",
"the",
"message",
"text",
":",
"type",
"text",
":",
"str",
":",
"pa... | train | https://github.com/faucamp/python-gsmmodem/blob/834c68b1387ca2c91e2210faa8f75526b39723b5/gsmmodem/modem.py#L627-L666 |
faucamp/python-gsmmodem | gsmmodem/modem.py | GsmModem.sendUssd | def sendUssd(self, ussdString, responseTimeout=15):
""" Starts a USSD session by dialing the the specified USSD string, or \
sends the specified string in the existing USSD session (if any)
:param ussdString: The USSD access number to dial
:param responseTimeout: Maximum... | python | def sendUssd(self, ussdString, responseTimeout=15):
""" Starts a USSD session by dialing the the specified USSD string, or \
sends the specified string in the existing USSD session (if any)
:param ussdString: The USSD access number to dial
:param responseTimeout: Maximum... | [
"def",
"sendUssd",
"(",
"self",
",",
"ussdString",
",",
"responseTimeout",
"=",
"15",
")",
":",
"self",
".",
"_ussdSessionEvent",
"=",
"threading",
".",
"Event",
"(",
")",
"try",
":",
"cusdResponse",
"=",
"self",
".",
"write",
"(",
"'AT+CUSD=1,\"{0}\",15'",
... | Starts a USSD session by dialing the the specified USSD string, or \
sends the specified string in the existing USSD session (if any)
:param ussdString: The USSD access number to dial
:param responseTimeout: Maximum time to wait a response, in seconds
:raise Tim... | [
"Starts",
"a",
"USSD",
"session",
"by",
"dialing",
"the",
"the",
"specified",
"USSD",
"string",
"or",
"\\",
"sends",
"the",
"specified",
"string",
"in",
"the",
"existing",
"USSD",
"session",
"(",
"if",
"any",
")",
":",
"param",
"ussdString",
":",
"The",
... | train | https://github.com/faucamp/python-gsmmodem/blob/834c68b1387ca2c91e2210faa8f75526b39723b5/gsmmodem/modem.py#L668-L699 |
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",
":",
"# Wait for the \"call originated\" notification message",
"self",
".",
"_dialEvent",
"... | 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"
] | train | https://github.com/faucamp/python-gsmmodem/blob/834c68b1387ca2c91e2210faa8f75526b39723b5/gsmmodem/modem.py#L701-L742 |
faucamp/python-gsmmodem | gsmmodem/modem.py | GsmModem.processStoredSms | def processStoredSms(self, unreadOnly=False):
""" Process all SMS messages currently stored on the device/SIM card.
Reads all (or just unread) received SMS messages currently stored on the
device/SIM card, initiates "SMS received" events for them, and removes
them from the SIM... | python | def processStoredSms(self, unreadOnly=False):
""" Process all SMS messages currently stored on the device/SIM card.
Reads all (or just unread) received SMS messages currently stored on the
device/SIM card, initiates "SMS received" events for them, and removes
them from the SIM... | [
"def",
"processStoredSms",
"(",
"self",
",",
"unreadOnly",
"=",
"False",
")",
":",
"states",
"=",
"[",
"Sms",
".",
"STATUS_RECEIVED_UNREAD",
"]",
"if",
"not",
"unreadOnly",
":",
"states",
".",
"insert",
"(",
"0",
",",
"Sms",
".",
"STATUS_RECEIVED_READ",
")... | Process all SMS messages currently stored on the device/SIM card.
Reads all (or just unread) received SMS messages currently stored on the
device/SIM card, initiates "SMS received" events for them, and removes
them from the SIM card.
This is useful if SMS messages were receive... | [
"Process",
"all",
"SMS",
"messages",
"currently",
"stored",
"on",
"the",
"device",
"/",
"SIM",
"card",
".",
"Reads",
"all",
"(",
"or",
"just",
"unread",
")",
"received",
"SMS",
"messages",
"currently",
"stored",
"on",
"the",
"device",
"/",
"SIM",
"card",
... | train | https://github.com/faucamp/python-gsmmodem/blob/834c68b1387ca2c91e2210faa8f75526b39723b5/gsmmodem/modem.py#L744-L762 |
faucamp/python-gsmmodem | gsmmodem/modem.py | GsmModem.listStoredSms | def listStoredSms(self, status=Sms.STATUS_ALL, memory=None, delete=False):
""" Returns SMS messages currently stored on the device/SIM card.
The messages are read from the memory set by the "memory" parameter.
:param status: Filter messages based on this read status; must be 0-... | python | def listStoredSms(self, status=Sms.STATUS_ALL, memory=None, delete=False):
""" Returns SMS messages currently stored on the device/SIM card.
The messages are read from the memory set by the "memory" parameter.
:param status: Filter messages based on this read status; must be 0-... | [
"def",
"listStoredSms",
"(",
"self",
",",
"status",
"=",
"Sms",
".",
"STATUS_ALL",
",",
"memory",
"=",
"None",
",",
"delete",
"=",
"False",
")",
":",
"self",
".",
"_setSmsMemory",
"(",
"readDelete",
"=",
"memory",
")",
"messages",
"=",
"[",
"]",
"delMe... | Returns SMS messages currently stored on the device/SIM card.
The messages are read from the memory set by the "memory" parameter.
:param status: Filter messages based on this read status; must be 0-4 (see Sms class)
:type status: int
:param memory: The memory type to r... | [
"Returns",
"SMS",
"messages",
"currently",
"stored",
"on",
"the",
"device",
"/",
"SIM",
"card",
".",
"The",
"messages",
"are",
"read",
"from",
"the",
"memory",
"set",
"by",
"the",
"memory",
"parameter",
".",
":",
"param",
"status",
":",
"Filter",
"messages... | train | https://github.com/faucamp/python-gsmmodem/blob/834c68b1387ca2c91e2210faa8f75526b39723b5/gsmmodem/modem.py#L764-L845 |
faucamp/python-gsmmodem | gsmmodem/modem.py | GsmModem._handleModemNotification | def _handleModemNotification(self, lines):
""" Handler for unsolicited notifications from the modem
This method simply spawns a separate thread to handle the actual notification
(in order to release the read thread so that the handlers are able to write back to the modem, etc)
... | python | def _handleModemNotification(self, lines):
""" Handler for unsolicited notifications from the modem
This method simply spawns a separate thread to handle the actual notification
(in order to release the read thread so that the handlers are able to write back to the modem, etc)
... | [
"def",
"_handleModemNotification",
"(",
"self",
",",
"lines",
")",
":",
"threading",
".",
"Thread",
"(",
"target",
"=",
"self",
".",
"__threadedHandleModemNotification",
",",
"kwargs",
"=",
"{",
"'lines'",
":",
"lines",
"}",
")",
".",
"start",
"(",
")"
] | Handler for unsolicited notifications from the modem
This method simply spawns a separate thread to handle the actual notification
(in order to release the read thread so that the handlers are able to write back to the modem, etc)
:param lines The lines that were read | [
"Handler",
"for",
"unsolicited",
"notifications",
"from",
"the",
"modem",
"This",
"method",
"simply",
"spawns",
"a",
"separate",
"thread",
"to",
"handle",
"the",
"actual",
"notification",
"(",
"in",
"order",
"to",
"release",
"the",
"read",
"thread",
"so",
"tha... | train | https://github.com/faucamp/python-gsmmodem/blob/834c68b1387ca2c91e2210faa8f75526b39723b5/gsmmodem/modem.py#L847-L855 |
faucamp/python-gsmmodem | gsmmodem/modem.py | GsmModem.__threadedHandleModemNotification | def __threadedHandleModemNotification(self, lines):
""" Implementation of _handleModemNotification() to be run in a separate thread
:param lines The lines that were read
"""
for line in lines:
if 'RING' in line:
# Incoming call (or existing call is ri... | python | def __threadedHandleModemNotification(self, lines):
""" Implementation of _handleModemNotification() to be run in a separate thread
:param lines The lines that were read
"""
for line in lines:
if 'RING' in line:
# Incoming call (or existing call is ri... | [
"def",
"__threadedHandleModemNotification",
"(",
"self",
",",
"lines",
")",
":",
"for",
"line",
"in",
"lines",
":",
"if",
"'RING'",
"in",
"line",
":",
"# Incoming call (or existing call is ringing)",
"self",
".",
"_handleIncomingCall",
"(",
"lines",
")",
"return",
... | Implementation of _handleModemNotification() to be run in a separate thread
:param lines The lines that were read | [
"Implementation",
"of",
"_handleModemNotification",
"()",
"to",
"be",
"run",
"in",
"a",
"separate",
"thread",
":",
"param",
"lines",
"The",
"lines",
"that",
"were",
"read"
] | train | https://github.com/faucamp/python-gsmmodem/blob/834c68b1387ca2c91e2210faa8f75526b39723b5/gsmmodem/modem.py#L857-L888 |
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",
"(",
")",
"# Set se... | Handler for "outgoing call initiated" event notification line | [
"Handler",
"for",
"outgoing",
"call",
"initiated",
"event",
"notification",
"line"
] | train | https://github.com/faucamp/python-gsmmodem/blob/834c68b1387ca2c91e2210faa8f75526b39723b5/gsmmodem/modem.py#L935-L947 |
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"
] | train | https://github.com/faucamp/python-gsmmodem/blob/834c68b1387ca2c91e2210faa8f75526b39723b5/gsmmodem/modem.py#L949-L964 |
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"
] | train | https://github.com/faucamp/python-gsmmodem/blob/834c68b1387ca2c91e2210faa8f75526b39723b5/gsmmodem/modem.py#L991-L1000 |
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"
] | train | https://github.com/faucamp/python-gsmmodem/blob/834c68b1387ca2c91e2210faa8f75526b39723b5/gsmmodem/modem.py#L1002-L1019 |
faucamp/python-gsmmodem | gsmmodem/modem.py | GsmModem.readStoredSms | def readStoredSms(self, index, memory=None):
""" Reads and returns the SMS message at the specified index
:param index: The index of the SMS message in the specified memory
:type index: int
:param memory: The memory type to read from. If None, use the current default SMS read me... | python | def readStoredSms(self, index, memory=None):
""" Reads and returns the SMS message at the specified index
:param index: The index of the SMS message in the specified memory
:type index: int
:param memory: The memory type to read from. If None, use the current default SMS read me... | [
"def",
"readStoredSms",
"(",
"self",
",",
"index",
",",
"memory",
"=",
"None",
")",
":",
"# Switch to the correct memory type if required",
"self",
".",
"_setSmsMemory",
"(",
"readDelete",
"=",
"memory",
")",
"msgData",
"=",
"self",
".",
"write",
"(",
"'AT+CMGR=... | Reads and returns the SMS message at the specified index
:param index: The index of the SMS message in the specified memory
:type index: int
:param memory: The memory type to read from. If None, use the current default SMS read memory
:type memory: str or None
:... | [
"Reads",
"and",
"returns",
"the",
"SMS",
"message",
"at",
"the",
"specified",
"index",
":",
"param",
"index",
":",
"The",
"index",
"of",
"the",
"SMS",
"message",
"in",
"the",
"specified",
"memory",
":",
"type",
"index",
":",
"int",
":",
"param",
"memory"... | train | https://github.com/faucamp/python-gsmmodem/blob/834c68b1387ca2c91e2210faa8f75526b39723b5/gsmmodem/modem.py#L1021-L1073 |
faucamp/python-gsmmodem | gsmmodem/modem.py | GsmModem.deleteStoredSms | def deleteStoredSms(self, index, memory=None):
""" Deletes the SMS message stored at the specified index in modem/SIM card memory
:param index: The index of the SMS message in the specified memory
:type index: int
:param memory: The memory type to delete from. If None, use the c... | python | def deleteStoredSms(self, index, memory=None):
""" Deletes the SMS message stored at the specified index in modem/SIM card memory
:param index: The index of the SMS message in the specified memory
:type index: int
:param memory: The memory type to delete from. If None, use the c... | [
"def",
"deleteStoredSms",
"(",
"self",
",",
"index",
",",
"memory",
"=",
"None",
")",
":",
"self",
".",
"_setSmsMemory",
"(",
"readDelete",
"=",
"memory",
")",
"self",
".",
"write",
"(",
"'AT+CMGD={0},0'",
".",
"format",
"(",
"index",
")",
")"
] | Deletes the SMS message stored at the specified index in modem/SIM card memory
:param index: The index of the SMS message in the specified memory
:type index: int
:param memory: The memory type to delete from. If None, use the current default SMS read/delete memory
:type memory:... | [
"Deletes",
"the",
"SMS",
"message",
"stored",
"at",
"the",
"specified",
"index",
"in",
"modem",
"/",
"SIM",
"card",
"memory",
":",
"param",
"index",
":",
"The",
"index",
"of",
"the",
"SMS",
"message",
"in",
"the",
"specified",
"memory",
":",
"type",
"ind... | train | https://github.com/faucamp/python-gsmmodem/blob/834c68b1387ca2c91e2210faa8f75526b39723b5/gsmmodem/modem.py#L1075-L1086 |
faucamp/python-gsmmodem | gsmmodem/modem.py | GsmModem.deleteMultipleStoredSms | def deleteMultipleStoredSms(self, delFlag=4, memory=None):
""" Deletes all SMS messages that have the specified read status.
The messages are read from the memory set by the "memory" parameter.
The value of the "delFlag" paramater is the same as the "DelFlag" parameter of the +CMGD comm... | python | def deleteMultipleStoredSms(self, delFlag=4, memory=None):
""" Deletes all SMS messages that have the specified read status.
The messages are read from the memory set by the "memory" parameter.
The value of the "delFlag" paramater is the same as the "DelFlag" parameter of the +CMGD comm... | [
"def",
"deleteMultipleStoredSms",
"(",
"self",
",",
"delFlag",
"=",
"4",
",",
"memory",
"=",
"None",
")",
":",
"if",
"0",
"<",
"delFlag",
"<=",
"4",
":",
"self",
".",
"_setSmsMemory",
"(",
"readDelete",
"=",
"memory",
")",
"self",
".",
"write",
"(",
... | Deletes all SMS messages that have the specified read status.
The messages are read from the memory set by the "memory" parameter.
The value of the "delFlag" paramater is the same as the "DelFlag" parameter of the +CMGD command:
1: Delete All READ messages
2: Delete All READ and... | [
"Deletes",
"all",
"SMS",
"messages",
"that",
"have",
"the",
"specified",
"read",
"status",
".",
"The",
"messages",
"are",
"read",
"from",
"the",
"memory",
"set",
"by",
"the",
"memory",
"parameter",
".",
"The",
"value",
"of",
"the",
"delFlag",
"paramater",
... | train | https://github.com/faucamp/python-gsmmodem/blob/834c68b1387ca2c91e2210faa8f75526b39723b5/gsmmodem/modem.py#L1088-L1112 |
faucamp/python-gsmmodem | gsmmodem/modem.py | GsmModem._handleUssd | def _handleUssd(self, lines):
""" Handler for USSD event notification line(s) """
if self._ussdSessionEvent:
# A sendUssd() call is waiting for this response - parse it
self._ussdResponse = self._parseCusdResponse(lines)
# Notify waiting thread
self._ussdS... | python | def _handleUssd(self, lines):
""" Handler for USSD event notification line(s) """
if self._ussdSessionEvent:
# A sendUssd() call is waiting for this response - parse it
self._ussdResponse = self._parseCusdResponse(lines)
# Notify waiting thread
self._ussdS... | [
"def",
"_handleUssd",
"(",
"self",
",",
"lines",
")",
":",
"if",
"self",
".",
"_ussdSessionEvent",
":",
"# A sendUssd() call is waiting for this response - parse it",
"self",
".",
"_ussdResponse",
"=",
"self",
".",
"_parseCusdResponse",
"(",
"lines",
")",
"# Notify wa... | Handler for USSD event notification line(s) | [
"Handler",
"for",
"USSD",
"event",
"notification",
"line",
"(",
"s",
")"
] | train | https://github.com/faucamp/python-gsmmodem/blob/834c68b1387ca2c91e2210faa8f75526b39723b5/gsmmodem/modem.py#L1114-L1120 |
faucamp/python-gsmmodem | gsmmodem/modem.py | GsmModem._parseCusdResponse | def _parseCusdResponse(self, lines):
""" Parses one or more +CUSD notification lines (for USSD)
:return: USSD response object
:rtype: gsmmodem.modem.Ussd
"""
if len(lines) > 1:
# Issue #20: Some modem/network combinations use \r\n as in-message EOL indicators;
... | python | def _parseCusdResponse(self, lines):
""" Parses one or more +CUSD notification lines (for USSD)
:return: USSD response object
:rtype: gsmmodem.modem.Ussd
"""
if len(lines) > 1:
# Issue #20: Some modem/network combinations use \r\n as in-message EOL indicators;
... | [
"def",
"_parseCusdResponse",
"(",
"self",
",",
"lines",
")",
":",
"if",
"len",
"(",
"lines",
")",
">",
"1",
":",
"# Issue #20: Some modem/network combinations use \\r\\n as in-message EOL indicators;",
"# - join lines to compensate for that (thanks to davidjb for the fix)",
"# Al... | Parses one or more +CUSD notification lines (for USSD)
:return: USSD response object
:rtype: gsmmodem.modem.Ussd | [
"Parses",
"one",
"or",
"more",
"+",
"CUSD",
"notification",
"lines",
"(",
"for",
"USSD",
")",
":",
"return",
":",
"USSD",
"response",
"object",
":",
"rtype",
":",
"gsmmodem",
".",
"modem",
".",
"Ussd"
] | train | https://github.com/faucamp/python-gsmmodem/blob/834c68b1387ca2c91e2210faa8f75526b39723b5/gsmmodem/modem.py#L1122-L1153 |
faucamp/python-gsmmodem | gsmmodem/modem.py | GsmModem._pollCallStatus | def _pollCallStatus(self, expectedState, callId=None, timeout=None):
""" Poll the status of outgoing calls.
This is used for modems that do not have a known set of call status update notifications.
:param expectedState: The internal state we are waiting for. 0 == initiated, 1 == ans... | python | def _pollCallStatus(self, expectedState, callId=None, timeout=None):
""" Poll the status of outgoing calls.
This is used for modems that do not have a known set of call status update notifications.
:param expectedState: The internal state we are waiting for. 0 == initiated, 1 == ans... | [
"def",
"_pollCallStatus",
"(",
"self",
",",
"expectedState",
",",
"callId",
"=",
"None",
",",
"timeout",
"=",
"None",
")",
":",
"callDone",
"=",
"False",
"timeLeft",
"=",
"timeout",
"or",
"999999",
"while",
"self",
".",
"alive",
"and",
"not",
"callDone",
... | Poll the status of outgoing calls.
This is used for modems that do not have a known set of call status update notifications.
:param expectedState: The internal state we are waiting for. 0 == initiated, 1 == answered, 2 = hangup
:type expectedState: int
:raise Timeou... | [
"Poll",
"the",
"status",
"of",
"outgoing",
"calls",
".",
"This",
"is",
"used",
"for",
"modems",
"that",
"do",
"not",
"have",
"a",
"known",
"set",
"of",
"call",
"status",
"update",
"notifications",
".",
":",
"param",
"expectedState",
":",
"The",
"internal",... | train | https://github.com/faucamp/python-gsmmodem/blob/834c68b1387ca2c91e2210faa8f75526b39723b5/gsmmodem/modem.py#L1159-L1204 |
faucamp/python-gsmmodem | gsmmodem/modem.py | Call.sendDtmfTone | def sendDtmfTone(self, tones):
""" Send one or more DTMF tones to the remote party (only allowed for an answered call)
Note: this is highly device-dependent, and might not work
:param digits: A str containining one or more DTMF tones to play, e.g. "3" or "\*123#"
:rai... | python | def sendDtmfTone(self, tones):
""" Send one or more DTMF tones to the remote party (only allowed for an answered call)
Note: this is highly device-dependent, and might not work
:param digits: A str containining one or more DTMF tones to play, e.g. "3" or "\*123#"
:rai... | [
"def",
"sendDtmfTone",
"(",
"self",
",",
"tones",
")",
":",
"if",
"self",
".",
"answered",
":",
"dtmfCommandBase",
"=",
"self",
".",
"DTMF_COMMAND_BASE",
".",
"format",
"(",
"cid",
"=",
"self",
".",
"id",
")",
"toneLen",
"=",
"len",
"(",
"tones",
")",
... | Send one or more DTMF tones to the remote party (only allowed for an answered call)
Note: this is highly device-dependent, and might not work
:param digits: A str containining one or more DTMF tones to play, e.g. "3" or "\*123#"
:raise CommandError: if the command failed/is n... | [
"Send",
"one",
"or",
"more",
"DTMF",
"tones",
"to",
"the",
"remote",
"party",
"(",
"only",
"allowed",
"for",
"an",
"answered",
"call",
")",
"Note",
":",
"this",
"is",
"highly",
"device",
"-",
"dependent",
"and",
"might",
"not",
"work",
":",
"param",
"d... | train | https://github.com/faucamp/python-gsmmodem/blob/834c68b1387ca2c91e2210faa8f75526b39723b5/gsmmodem/modem.py#L1241-L1270 |
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",
"."
] | train | https://github.com/faucamp/python-gsmmodem/blob/834c68b1387ca2c91e2210faa8f75526b39723b5/gsmmodem/modem.py#L1272-L1282 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.