repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
carpedm20/fbchat | fbchat/_client.py | Client.muteThreadReactions | def muteThreadReactions(self, mute=True, thread_id=None):
"""
Mutes thread reactions
:param mute: Boolean. True to mute, False to unmute
:param thread_id: User/Group ID to mute. See :ref:`intro_threads`
"""
thread_id, thread_type = self._getThread(thread_id, None)
... | python | def muteThreadReactions(self, mute=True, thread_id=None):
"""
Mutes thread reactions
:param mute: Boolean. True to mute, False to unmute
:param thread_id: User/Group ID to mute. See :ref:`intro_threads`
"""
thread_id, thread_type = self._getThread(thread_id, None)
... | [
"def",
"muteThreadReactions",
"(",
"self",
",",
"mute",
"=",
"True",
",",
"thread_id",
"=",
"None",
")",
":",
"thread_id",
",",
"thread_type",
"=",
"self",
".",
"_getThread",
"(",
"thread_id",
",",
"None",
")",
"data",
"=",
"{",
"\"reactions_mute_mode\"",
... | Mutes thread reactions
:param mute: Boolean. True to mute, False to unmute
:param thread_id: User/Group ID to mute. See :ref:`intro_threads` | [
"Mutes",
"thread",
"reactions"
] | f480d68b5773473e6daba7f66075ee30e8d737a8 | https://github.com/carpedm20/fbchat/blob/f480d68b5773473e6daba7f66075ee30e8d737a8/fbchat/_client.py#L2353-L2362 | train |
carpedm20/fbchat | fbchat/_client.py | Client.muteThreadMentions | def muteThreadMentions(self, mute=True, thread_id=None):
"""
Mutes thread mentions
:param mute: Boolean. True to mute, False to unmute
:param thread_id: User/Group ID to mute. See :ref:`intro_threads`
"""
thread_id, thread_type = self._getThread(thread_id, None)
... | python | def muteThreadMentions(self, mute=True, thread_id=None):
"""
Mutes thread mentions
:param mute: Boolean. True to mute, False to unmute
:param thread_id: User/Group ID to mute. See :ref:`intro_threads`
"""
thread_id, thread_type = self._getThread(thread_id, None)
... | [
"def",
"muteThreadMentions",
"(",
"self",
",",
"mute",
"=",
"True",
",",
"thread_id",
"=",
"None",
")",
":",
"thread_id",
",",
"thread_type",
"=",
"self",
".",
"_getThread",
"(",
"thread_id",
",",
"None",
")",
"data",
"=",
"{",
"\"mentions_mute_mode\"",
":... | Mutes thread mentions
:param mute: Boolean. True to mute, False to unmute
:param thread_id: User/Group ID to mute. See :ref:`intro_threads` | [
"Mutes",
"thread",
"mentions"
] | f480d68b5773473e6daba7f66075ee30e8d737a8 | https://github.com/carpedm20/fbchat/blob/f480d68b5773473e6daba7f66075ee30e8d737a8/fbchat/_client.py#L2372-L2381 | train |
carpedm20/fbchat | fbchat/_client.py | Client._pullMessage | def _pullMessage(self):
"""Call pull api with seq value to get message data."""
data = {
"msgs_recv": 0,
"sticky_token": self._sticky,
"sticky_pool": self._pool,
"clientid": self._client_id,
"state": "active" if self._markAlive else "offline",
... | python | def _pullMessage(self):
"""Call pull api with seq value to get message data."""
data = {
"msgs_recv": 0,
"sticky_token": self._sticky,
"sticky_pool": self._pool,
"clientid": self._client_id,
"state": "active" if self._markAlive else "offline",
... | [
"def",
"_pullMessage",
"(",
"self",
")",
":",
"data",
"=",
"{",
"\"msgs_recv\"",
":",
"0",
",",
"\"sticky_token\"",
":",
"self",
".",
"_sticky",
",",
"\"sticky_pool\"",
":",
"self",
".",
"_pool",
",",
"\"clientid\"",
":",
"self",
".",
"_client_id",
",",
... | Call pull api with seq value to get message data. | [
"Call",
"pull",
"api",
"with",
"seq",
"value",
"to",
"get",
"message",
"data",
"."
] | f480d68b5773473e6daba7f66075ee30e8d737a8 | https://github.com/carpedm20/fbchat/blob/f480d68b5773473e6daba7f66075ee30e8d737a8/fbchat/_client.py#L2409-L2418 | train |
carpedm20/fbchat | fbchat/_client.py | Client._parseMessage | def _parseMessage(self, content):
"""Get message and author name from content. May contain multiple messages in the content."""
self._seq = content.get("seq", "0")
if "lb_info" in content:
self._sticky = content["lb_info"]["sticky"]
self._pool = content["lb_info"]["pool"... | python | def _parseMessage(self, content):
"""Get message and author name from content. May contain multiple messages in the content."""
self._seq = content.get("seq", "0")
if "lb_info" in content:
self._sticky = content["lb_info"]["sticky"]
self._pool = content["lb_info"]["pool"... | [
"def",
"_parseMessage",
"(",
"self",
",",
"content",
")",
":",
"self",
".",
"_seq",
"=",
"content",
".",
"get",
"(",
"\"seq\"",
",",
"\"0\"",
")",
"if",
"\"lb_info\"",
"in",
"content",
":",
"self",
".",
"_sticky",
"=",
"content",
"[",
"\"lb_info\"",
"]... | Get message and author name from content. May contain multiple messages in the content. | [
"Get",
"message",
"and",
"author",
"name",
"from",
"content",
".",
"May",
"contain",
"multiple",
"messages",
"in",
"the",
"content",
"."
] | f480d68b5773473e6daba7f66075ee30e8d737a8 | https://github.com/carpedm20/fbchat/blob/f480d68b5773473e6daba7f66075ee30e8d737a8/fbchat/_client.py#L2966-L3066 | train |
carpedm20/fbchat | fbchat/_client.py | Client.doOneListen | def doOneListen(self, markAlive=None):
"""
Does one cycle of the listening loop.
This method is useful if you want to control fbchat from an external event loop
.. warning::
`markAlive` parameter is deprecated now, use :func:`fbchat.Client.setActiveStatus`
or `ma... | python | def doOneListen(self, markAlive=None):
"""
Does one cycle of the listening loop.
This method is useful if you want to control fbchat from an external event loop
.. warning::
`markAlive` parameter is deprecated now, use :func:`fbchat.Client.setActiveStatus`
or `ma... | [
"def",
"doOneListen",
"(",
"self",
",",
"markAlive",
"=",
"None",
")",
":",
"if",
"markAlive",
"is",
"not",
"None",
":",
"self",
".",
"_markAlive",
"=",
"markAlive",
"try",
":",
"if",
"self",
".",
"_markAlive",
":",
"self",
".",
"_ping",
"(",
")",
"c... | Does one cycle of the listening loop.
This method is useful if you want to control fbchat from an external event loop
.. warning::
`markAlive` parameter is deprecated now, use :func:`fbchat.Client.setActiveStatus`
or `markAlive` parameter in :func:`fbchat.Client.listen` instead.... | [
"Does",
"one",
"cycle",
"of",
"the",
"listening",
"loop",
".",
"This",
"method",
"is",
"useful",
"if",
"you",
"want",
"to",
"control",
"fbchat",
"from",
"an",
"external",
"event",
"loop"
] | f480d68b5773473e6daba7f66075ee30e8d737a8 | https://github.com/carpedm20/fbchat/blob/f480d68b5773473e6daba7f66075ee30e8d737a8/fbchat/_client.py#L3076-L3113 | train |
carpedm20/fbchat | fbchat/_client.py | Client.listen | def listen(self, markAlive=None):
"""
Initializes and runs the listening loop continually
:param markAlive: Whether this should ping the Facebook server each time the loop runs
:type markAlive: bool
"""
if markAlive is not None:
self.setActiveStatus(markAlive... | python | def listen(self, markAlive=None):
"""
Initializes and runs the listening loop continually
:param markAlive: Whether this should ping the Facebook server each time the loop runs
:type markAlive: bool
"""
if markAlive is not None:
self.setActiveStatus(markAlive... | [
"def",
"listen",
"(",
"self",
",",
"markAlive",
"=",
"None",
")",
":",
"if",
"markAlive",
"is",
"not",
"None",
":",
"self",
".",
"setActiveStatus",
"(",
"markAlive",
")",
"self",
".",
"startListening",
"(",
")",
"self",
".",
"onListening",
"(",
")",
"w... | Initializes and runs the listening loop continually
:param markAlive: Whether this should ping the Facebook server each time the loop runs
:type markAlive: bool | [
"Initializes",
"and",
"runs",
"the",
"listening",
"loop",
"continually"
] | f480d68b5773473e6daba7f66075ee30e8d737a8 | https://github.com/carpedm20/fbchat/blob/f480d68b5773473e6daba7f66075ee30e8d737a8/fbchat/_client.py#L3120-L3136 | train |
carpedm20/fbchat | fbchat/_client.py | Client.onMessage | def onMessage(
self,
mid=None,
author_id=None,
message=None,
message_object=None,
thread_id=None,
thread_type=ThreadType.USER,
ts=None,
metadata=None,
msg=None,
):
"""
Called when the client is listening, and somebody se... | python | def onMessage(
self,
mid=None,
author_id=None,
message=None,
message_object=None,
thread_id=None,
thread_type=ThreadType.USER,
ts=None,
metadata=None,
msg=None,
):
"""
Called when the client is listening, and somebody se... | [
"def",
"onMessage",
"(",
"self",
",",
"mid",
"=",
"None",
",",
"author_id",
"=",
"None",
",",
"message",
"=",
"None",
",",
"message_object",
"=",
"None",
",",
"thread_id",
"=",
"None",
",",
"thread_type",
"=",
"ThreadType",
".",
"USER",
",",
"ts",
"=",... | Called when the client is listening, and somebody sends a message
:param mid: The message ID
:param author_id: The ID of the author
:param message: (deprecated. Use `message_object.text` instead)
:param message_object: The message (As a `Message` object)
:param thread_id: Thread... | [
"Called",
"when",
"the",
"client",
"is",
"listening",
"and",
"somebody",
"sends",
"a",
"message"
] | f480d68b5773473e6daba7f66075ee30e8d737a8 | https://github.com/carpedm20/fbchat/blob/f480d68b5773473e6daba7f66075ee30e8d737a8/fbchat/_client.py#L3189-L3216 | train |
carpedm20/fbchat | fbchat/_client.py | Client.onColorChange | def onColorChange(
self,
mid=None,
author_id=None,
new_color=None,
thread_id=None,
thread_type=ThreadType.USER,
ts=None,
metadata=None,
msg=None,
):
"""
Called when the client is listening, and somebody changes a thread's color
... | python | def onColorChange(
self,
mid=None,
author_id=None,
new_color=None,
thread_id=None,
thread_type=ThreadType.USER,
ts=None,
metadata=None,
msg=None,
):
"""
Called when the client is listening, and somebody changes a thread's color
... | [
"def",
"onColorChange",
"(",
"self",
",",
"mid",
"=",
"None",
",",
"author_id",
"=",
"None",
",",
"new_color",
"=",
"None",
",",
"thread_id",
"=",
"None",
",",
"thread_type",
"=",
"ThreadType",
".",
"USER",
",",
"ts",
"=",
"None",
",",
"metadata",
"=",... | Called when the client is listening, and somebody changes a thread's color
:param mid: The action ID
:param author_id: The ID of the person who changed the color
:param new_color: The new color
:param thread_id: Thread ID that the action was sent to. See :ref:`intro_threads`
:pa... | [
"Called",
"when",
"the",
"client",
"is",
"listening",
"and",
"somebody",
"changes",
"a",
"thread",
"s",
"color"
] | f480d68b5773473e6daba7f66075ee30e8d737a8 | https://github.com/carpedm20/fbchat/blob/f480d68b5773473e6daba7f66075ee30e8d737a8/fbchat/_client.py#L3218-L3247 | train |
carpedm20/fbchat | fbchat/_client.py | Client.onEmojiChange | def onEmojiChange(
self,
mid=None,
author_id=None,
new_emoji=None,
thread_id=None,
thread_type=ThreadType.USER,
ts=None,
metadata=None,
msg=None,
):
"""
Called when the client is listening, and somebody changes a thread's emoji
... | python | def onEmojiChange(
self,
mid=None,
author_id=None,
new_emoji=None,
thread_id=None,
thread_type=ThreadType.USER,
ts=None,
metadata=None,
msg=None,
):
"""
Called when the client is listening, and somebody changes a thread's emoji
... | [
"def",
"onEmojiChange",
"(",
"self",
",",
"mid",
"=",
"None",
",",
"author_id",
"=",
"None",
",",
"new_emoji",
"=",
"None",
",",
"thread_id",
"=",
"None",
",",
"thread_type",
"=",
"ThreadType",
".",
"USER",
",",
"ts",
"=",
"None",
",",
"metadata",
"=",... | Called when the client is listening, and somebody changes a thread's emoji
:param mid: The action ID
:param author_id: The ID of the person who changed the emoji
:param new_emoji: The new emoji
:param thread_id: Thread ID that the action was sent to. See :ref:`intro_threads`
:pa... | [
"Called",
"when",
"the",
"client",
"is",
"listening",
"and",
"somebody",
"changes",
"a",
"thread",
"s",
"emoji"
] | f480d68b5773473e6daba7f66075ee30e8d737a8 | https://github.com/carpedm20/fbchat/blob/f480d68b5773473e6daba7f66075ee30e8d737a8/fbchat/_client.py#L3249-L3277 | train |
carpedm20/fbchat | fbchat/_client.py | Client.onTitleChange | def onTitleChange(
self,
mid=None,
author_id=None,
new_title=None,
thread_id=None,
thread_type=ThreadType.USER,
ts=None,
metadata=None,
msg=None,
):
"""
Called when the client is listening, and somebody changes the title of a th... | python | def onTitleChange(
self,
mid=None,
author_id=None,
new_title=None,
thread_id=None,
thread_type=ThreadType.USER,
ts=None,
metadata=None,
msg=None,
):
"""
Called when the client is listening, and somebody changes the title of a th... | [
"def",
"onTitleChange",
"(",
"self",
",",
"mid",
"=",
"None",
",",
"author_id",
"=",
"None",
",",
"new_title",
"=",
"None",
",",
"thread_id",
"=",
"None",
",",
"thread_type",
"=",
"ThreadType",
".",
"USER",
",",
"ts",
"=",
"None",
",",
"metadata",
"=",... | Called when the client is listening, and somebody changes the title of a thread
:param mid: The action ID
:param author_id: The ID of the person who changed the title
:param new_title: The new title
:param thread_id: Thread ID that the action was sent to. See :ref:`intro_threads`
... | [
"Called",
"when",
"the",
"client",
"is",
"listening",
"and",
"somebody",
"changes",
"the",
"title",
"of",
"a",
"thread"
] | f480d68b5773473e6daba7f66075ee30e8d737a8 | https://github.com/carpedm20/fbchat/blob/f480d68b5773473e6daba7f66075ee30e8d737a8/fbchat/_client.py#L3279-L3307 | train |
carpedm20/fbchat | fbchat/_client.py | Client.onImageChange | def onImageChange(
self,
mid=None,
author_id=None,
new_image=None,
thread_id=None,
thread_type=ThreadType.GROUP,
ts=None,
msg=None,
):
"""
Called when the client is listening, and somebody changes the image of a thread
:param m... | python | def onImageChange(
self,
mid=None,
author_id=None,
new_image=None,
thread_id=None,
thread_type=ThreadType.GROUP,
ts=None,
msg=None,
):
"""
Called when the client is listening, and somebody changes the image of a thread
:param m... | [
"def",
"onImageChange",
"(",
"self",
",",
"mid",
"=",
"None",
",",
"author_id",
"=",
"None",
",",
"new_image",
"=",
"None",
",",
"thread_id",
"=",
"None",
",",
"thread_type",
"=",
"ThreadType",
".",
"GROUP",
",",
"ts",
"=",
"None",
",",
"msg",
"=",
"... | Called when the client is listening, and somebody changes the image of a thread
:param mid: The action ID
:param author_id: The ID of the person who changed the image
:param new_image: The ID of the new image
:param thread_id: Thread ID that the action was sent to. See :ref:`intro_threa... | [
"Called",
"when",
"the",
"client",
"is",
"listening",
"and",
"somebody",
"changes",
"the",
"image",
"of",
"a",
"thread"
] | f480d68b5773473e6daba7f66075ee30e8d737a8 | https://github.com/carpedm20/fbchat/blob/f480d68b5773473e6daba7f66075ee30e8d737a8/fbchat/_client.py#L3309-L3331 | train |
carpedm20/fbchat | fbchat/_client.py | Client.onNicknameChange | def onNicknameChange(
self,
mid=None,
author_id=None,
changed_for=None,
new_nickname=None,
thread_id=None,
thread_type=ThreadType.USER,
ts=None,
metadata=None,
msg=None,
):
"""
Called when the client is listening, and so... | python | def onNicknameChange(
self,
mid=None,
author_id=None,
changed_for=None,
new_nickname=None,
thread_id=None,
thread_type=ThreadType.USER,
ts=None,
metadata=None,
msg=None,
):
"""
Called when the client is listening, and so... | [
"def",
"onNicknameChange",
"(",
"self",
",",
"mid",
"=",
"None",
",",
"author_id",
"=",
"None",
",",
"changed_for",
"=",
"None",
",",
"new_nickname",
"=",
"None",
",",
"thread_id",
"=",
"None",
",",
"thread_type",
"=",
"ThreadType",
".",
"USER",
",",
"ts... | Called when the client is listening, and somebody changes the nickname of a person
:param mid: The action ID
:param author_id: The ID of the person who changed the nickname
:param changed_for: The ID of the person whom got their nickname changed
:param new_nickname: The new nickname
... | [
"Called",
"when",
"the",
"client",
"is",
"listening",
"and",
"somebody",
"changes",
"the",
"nickname",
"of",
"a",
"person"
] | f480d68b5773473e6daba7f66075ee30e8d737a8 | https://github.com/carpedm20/fbchat/blob/f480d68b5773473e6daba7f66075ee30e8d737a8/fbchat/_client.py#L3333-L3363 | train |
carpedm20/fbchat | fbchat/_client.py | Client.onAdminAdded | def onAdminAdded(
self,
mid=None,
added_id=None,
author_id=None,
thread_id=None,
thread_type=ThreadType.GROUP,
ts=None,
msg=None,
):
"""
Called when the client is listening, and somebody adds an admin to a group thread
:param m... | python | def onAdminAdded(
self,
mid=None,
added_id=None,
author_id=None,
thread_id=None,
thread_type=ThreadType.GROUP,
ts=None,
msg=None,
):
"""
Called when the client is listening, and somebody adds an admin to a group thread
:param m... | [
"def",
"onAdminAdded",
"(",
"self",
",",
"mid",
"=",
"None",
",",
"added_id",
"=",
"None",
",",
"author_id",
"=",
"None",
",",
"thread_id",
"=",
"None",
",",
"thread_type",
"=",
"ThreadType",
".",
"GROUP",
",",
"ts",
"=",
"None",
",",
"msg",
"=",
"No... | Called when the client is listening, and somebody adds an admin to a group thread
:param mid: The action ID
:param added_id: The ID of the admin who got added
:param author_id: The ID of the person who added the admins
:param thread_id: Thread ID that the action was sent to. See :ref:`i... | [
"Called",
"when",
"the",
"client",
"is",
"listening",
"and",
"somebody",
"adds",
"an",
"admin",
"to",
"a",
"group",
"thread"
] | f480d68b5773473e6daba7f66075ee30e8d737a8 | https://github.com/carpedm20/fbchat/blob/f480d68b5773473e6daba7f66075ee30e8d737a8/fbchat/_client.py#L3365-L3385 | train |
carpedm20/fbchat | fbchat/_client.py | Client.onAdminRemoved | def onAdminRemoved(
self,
mid=None,
removed_id=None,
author_id=None,
thread_id=None,
thread_type=ThreadType.GROUP,
ts=None,
msg=None,
):
"""
Called when the client is listening, and somebody removes an admin from a group thread
... | python | def onAdminRemoved(
self,
mid=None,
removed_id=None,
author_id=None,
thread_id=None,
thread_type=ThreadType.GROUP,
ts=None,
msg=None,
):
"""
Called when the client is listening, and somebody removes an admin from a group thread
... | [
"def",
"onAdminRemoved",
"(",
"self",
",",
"mid",
"=",
"None",
",",
"removed_id",
"=",
"None",
",",
"author_id",
"=",
"None",
",",
"thread_id",
"=",
"None",
",",
"thread_type",
"=",
"ThreadType",
".",
"GROUP",
",",
"ts",
"=",
"None",
",",
"msg",
"=",
... | Called when the client is listening, and somebody removes an admin from a group thread
:param mid: The action ID
:param removed_id: The ID of the admin who got removed
:param author_id: The ID of the person who removed the admins
:param thread_id: Thread ID that the action was sent to. ... | [
"Called",
"when",
"the",
"client",
"is",
"listening",
"and",
"somebody",
"removes",
"an",
"admin",
"from",
"a",
"group",
"thread"
] | f480d68b5773473e6daba7f66075ee30e8d737a8 | https://github.com/carpedm20/fbchat/blob/f480d68b5773473e6daba7f66075ee30e8d737a8/fbchat/_client.py#L3387-L3407 | train |
carpedm20/fbchat | fbchat/_client.py | Client.onApprovalModeChange | def onApprovalModeChange(
self,
mid=None,
approval_mode=None,
author_id=None,
thread_id=None,
thread_type=ThreadType.GROUP,
ts=None,
msg=None,
):
"""
Called when the client is listening, and somebody changes approval mode in a group thr... | python | def onApprovalModeChange(
self,
mid=None,
approval_mode=None,
author_id=None,
thread_id=None,
thread_type=ThreadType.GROUP,
ts=None,
msg=None,
):
"""
Called when the client is listening, and somebody changes approval mode in a group thr... | [
"def",
"onApprovalModeChange",
"(",
"self",
",",
"mid",
"=",
"None",
",",
"approval_mode",
"=",
"None",
",",
"author_id",
"=",
"None",
",",
"thread_id",
"=",
"None",
",",
"thread_type",
"=",
"ThreadType",
".",
"GROUP",
",",
"ts",
"=",
"None",
",",
"msg",... | Called when the client is listening, and somebody changes approval mode in a group thread
:param mid: The action ID
:param approval_mode: True if approval mode is activated
:param author_id: The ID of the person who changed approval mode
:param thread_id: Thread ID that the action was s... | [
"Called",
"when",
"the",
"client",
"is",
"listening",
"and",
"somebody",
"changes",
"approval",
"mode",
"in",
"a",
"group",
"thread"
] | f480d68b5773473e6daba7f66075ee30e8d737a8 | https://github.com/carpedm20/fbchat/blob/f480d68b5773473e6daba7f66075ee30e8d737a8/fbchat/_client.py#L3409-L3432 | train |
carpedm20/fbchat | fbchat/_client.py | Client.onMessageSeen | def onMessageSeen(
self,
seen_by=None,
thread_id=None,
thread_type=ThreadType.USER,
seen_ts=None,
ts=None,
metadata=None,
msg=None,
):
"""
Called when the client is listening, and somebody marks a message as seen
:param seen_by... | python | def onMessageSeen(
self,
seen_by=None,
thread_id=None,
thread_type=ThreadType.USER,
seen_ts=None,
ts=None,
metadata=None,
msg=None,
):
"""
Called when the client is listening, and somebody marks a message as seen
:param seen_by... | [
"def",
"onMessageSeen",
"(",
"self",
",",
"seen_by",
"=",
"None",
",",
"thread_id",
"=",
"None",
",",
"thread_type",
"=",
"ThreadType",
".",
"USER",
",",
"seen_ts",
"=",
"None",
",",
"ts",
"=",
"None",
",",
"metadata",
"=",
"None",
",",
"msg",
"=",
"... | Called when the client is listening, and somebody marks a message as seen
:param seen_by: The ID of the person who marked the message as seen
:param thread_id: Thread ID that the action was sent to. See :ref:`intro_threads`
:param thread_type: Type of thread that the action was sent to. See :re... | [
"Called",
"when",
"the",
"client",
"is",
"listening",
"and",
"somebody",
"marks",
"a",
"message",
"as",
"seen"
] | f480d68b5773473e6daba7f66075ee30e8d737a8 | https://github.com/carpedm20/fbchat/blob/f480d68b5773473e6daba7f66075ee30e8d737a8/fbchat/_client.py#L3434-L3460 | train |
carpedm20/fbchat | fbchat/_client.py | Client.onMessageDelivered | def onMessageDelivered(
self,
msg_ids=None,
delivered_for=None,
thread_id=None,
thread_type=ThreadType.USER,
ts=None,
metadata=None,
msg=None,
):
"""
Called when the client is listening, and somebody marks messages as delivered
... | python | def onMessageDelivered(
self,
msg_ids=None,
delivered_for=None,
thread_id=None,
thread_type=ThreadType.USER,
ts=None,
metadata=None,
msg=None,
):
"""
Called when the client is listening, and somebody marks messages as delivered
... | [
"def",
"onMessageDelivered",
"(",
"self",
",",
"msg_ids",
"=",
"None",
",",
"delivered_for",
"=",
"None",
",",
"thread_id",
"=",
"None",
",",
"thread_type",
"=",
"ThreadType",
".",
"USER",
",",
"ts",
"=",
"None",
",",
"metadata",
"=",
"None",
",",
"msg",... | Called when the client is listening, and somebody marks messages as delivered
:param msg_ids: The messages that are marked as delivered
:param delivered_for: The person that marked the messages as delivered
:param thread_id: Thread ID that the action was sent to. See :ref:`intro_threads`
... | [
"Called",
"when",
"the",
"client",
"is",
"listening",
"and",
"somebody",
"marks",
"messages",
"as",
"delivered"
] | f480d68b5773473e6daba7f66075ee30e8d737a8 | https://github.com/carpedm20/fbchat/blob/f480d68b5773473e6daba7f66075ee30e8d737a8/fbchat/_client.py#L3462-L3488 | train |
carpedm20/fbchat | fbchat/_client.py | Client.onMarkedSeen | def onMarkedSeen(
self, threads=None, seen_ts=None, ts=None, metadata=None, msg=None
):
"""
Called when the client is listening, and the client has successfully marked threads as seen
:param threads: The threads that were marked
:param author_id: The ID of the person who cha... | python | def onMarkedSeen(
self, threads=None, seen_ts=None, ts=None, metadata=None, msg=None
):
"""
Called when the client is listening, and the client has successfully marked threads as seen
:param threads: The threads that were marked
:param author_id: The ID of the person who cha... | [
"def",
"onMarkedSeen",
"(",
"self",
",",
"threads",
"=",
"None",
",",
"seen_ts",
"=",
"None",
",",
"ts",
"=",
"None",
",",
"metadata",
"=",
"None",
",",
"msg",
"=",
"None",
")",
":",
"log",
".",
"info",
"(",
"\"Marked messages as seen in threads {} at {}s\... | Called when the client is listening, and the client has successfully marked threads as seen
:param threads: The threads that were marked
:param author_id: The ID of the person who changed the emoji
:param seen_ts: A timestamp of when the threads were seen
:param ts: A timestamp of the a... | [
"Called",
"when",
"the",
"client",
"is",
"listening",
"and",
"the",
"client",
"has",
"successfully",
"marked",
"threads",
"as",
"seen"
] | f480d68b5773473e6daba7f66075ee30e8d737a8 | https://github.com/carpedm20/fbchat/blob/f480d68b5773473e6daba7f66075ee30e8d737a8/fbchat/_client.py#L3490-L3508 | train |
carpedm20/fbchat | fbchat/_client.py | Client.onPeopleAdded | def onPeopleAdded(
self,
mid=None,
added_ids=None,
author_id=None,
thread_id=None,
ts=None,
msg=None,
):
"""
Called when the client is listening, and somebody adds people to a group thread
:param mid: The action ID
:param added... | python | def onPeopleAdded(
self,
mid=None,
added_ids=None,
author_id=None,
thread_id=None,
ts=None,
msg=None,
):
"""
Called when the client is listening, and somebody adds people to a group thread
:param mid: The action ID
:param added... | [
"def",
"onPeopleAdded",
"(",
"self",
",",
"mid",
"=",
"None",
",",
"added_ids",
"=",
"None",
",",
"author_id",
"=",
"None",
",",
"thread_id",
"=",
"None",
",",
"ts",
"=",
"None",
",",
"msg",
"=",
"None",
",",
")",
":",
"log",
".",
"info",
"(",
"\... | Called when the client is listening, and somebody adds people to a group thread
:param mid: The action ID
:param added_ids: The IDs of the people who got added
:param author_id: The ID of the person who added the people
:param thread_id: Thread ID that the action was sent to. See :ref:`... | [
"Called",
"when",
"the",
"client",
"is",
"listening",
"and",
"somebody",
"adds",
"people",
"to",
"a",
"group",
"thread"
] | f480d68b5773473e6daba7f66075ee30e8d737a8 | https://github.com/carpedm20/fbchat/blob/f480d68b5773473e6daba7f66075ee30e8d737a8/fbchat/_client.py#L3536-L3557 | train |
carpedm20/fbchat | fbchat/_client.py | Client.onPersonRemoved | def onPersonRemoved(
self,
mid=None,
removed_id=None,
author_id=None,
thread_id=None,
ts=None,
msg=None,
):
"""
Called when the client is listening, and somebody removes a person from a group thread
:param mid: The action ID
:p... | python | def onPersonRemoved(
self,
mid=None,
removed_id=None,
author_id=None,
thread_id=None,
ts=None,
msg=None,
):
"""
Called when the client is listening, and somebody removes a person from a group thread
:param mid: The action ID
:p... | [
"def",
"onPersonRemoved",
"(",
"self",
",",
"mid",
"=",
"None",
",",
"removed_id",
"=",
"None",
",",
"author_id",
"=",
"None",
",",
"thread_id",
"=",
"None",
",",
"ts",
"=",
"None",
",",
"msg",
"=",
"None",
",",
")",
":",
"log",
".",
"info",
"(",
... | Called when the client is listening, and somebody removes a person from a group thread
:param mid: The action ID
:param removed_id: The ID of the person who got removed
:param author_id: The ID of the person who removed the person
:param thread_id: Thread ID that the action was sent to.... | [
"Called",
"when",
"the",
"client",
"is",
"listening",
"and",
"somebody",
"removes",
"a",
"person",
"from",
"a",
"group",
"thread"
] | f480d68b5773473e6daba7f66075ee30e8d737a8 | https://github.com/carpedm20/fbchat/blob/f480d68b5773473e6daba7f66075ee30e8d737a8/fbchat/_client.py#L3559-L3578 | train |
carpedm20/fbchat | fbchat/_client.py | Client.onGamePlayed | def onGamePlayed(
self,
mid=None,
author_id=None,
game_id=None,
game_name=None,
score=None,
leaderboard=None,
thread_id=None,
thread_type=None,
ts=None,
metadata=None,
msg=None,
):
"""
Called when the cli... | python | def onGamePlayed(
self,
mid=None,
author_id=None,
game_id=None,
game_name=None,
score=None,
leaderboard=None,
thread_id=None,
thread_type=None,
ts=None,
metadata=None,
msg=None,
):
"""
Called when the cli... | [
"def",
"onGamePlayed",
"(",
"self",
",",
"mid",
"=",
"None",
",",
"author_id",
"=",
"None",
",",
"game_id",
"=",
"None",
",",
"game_name",
"=",
"None",
",",
"score",
"=",
"None",
",",
"leaderboard",
"=",
"None",
",",
"thread_id",
"=",
"None",
",",
"t... | Called when the client is listening, and somebody plays a game
:param mid: The action ID
:param author_id: The ID of the person who played the game
:param game_id: The ID of the game
:param game_name: Name of the game
:param score: Score obtained in the game
:param leade... | [
"Called",
"when",
"the",
"client",
"is",
"listening",
"and",
"somebody",
"plays",
"a",
"game"
] | f480d68b5773473e6daba7f66075ee30e8d737a8 | https://github.com/carpedm20/fbchat/blob/f480d68b5773473e6daba7f66075ee30e8d737a8/fbchat/_client.py#L3617-L3651 | train |
carpedm20/fbchat | fbchat/_client.py | Client.onReactionAdded | def onReactionAdded(
self,
mid=None,
reaction=None,
author_id=None,
thread_id=None,
thread_type=None,
ts=None,
msg=None,
):
"""
Called when the client is listening, and somebody reacts to a message
:param mid: Message ID, that ... | python | def onReactionAdded(
self,
mid=None,
reaction=None,
author_id=None,
thread_id=None,
thread_type=None,
ts=None,
msg=None,
):
"""
Called when the client is listening, and somebody reacts to a message
:param mid: Message ID, that ... | [
"def",
"onReactionAdded",
"(",
"self",
",",
"mid",
"=",
"None",
",",
"reaction",
"=",
"None",
",",
"author_id",
"=",
"None",
",",
"thread_id",
"=",
"None",
",",
"thread_type",
"=",
"None",
",",
"ts",
"=",
"None",
",",
"msg",
"=",
"None",
",",
")",
... | Called when the client is listening, and somebody reacts to a message
:param mid: Message ID, that user reacted to
:param reaction: Reaction
:param add_reaction: Whether user added or removed reaction
:param author_id: The ID of the person who reacted to the message
:param threa... | [
"Called",
"when",
"the",
"client",
"is",
"listening",
"and",
"somebody",
"reacts",
"to",
"a",
"message"
] | f480d68b5773473e6daba7f66075ee30e8d737a8 | https://github.com/carpedm20/fbchat/blob/f480d68b5773473e6daba7f66075ee30e8d737a8/fbchat/_client.py#L3653-L3681 | train |
carpedm20/fbchat | fbchat/_client.py | Client.onReactionRemoved | def onReactionRemoved(
self,
mid=None,
author_id=None,
thread_id=None,
thread_type=None,
ts=None,
msg=None,
):
"""
Called when the client is listening, and somebody removes reaction from a message
:param mid: Message ID, that user reac... | python | def onReactionRemoved(
self,
mid=None,
author_id=None,
thread_id=None,
thread_type=None,
ts=None,
msg=None,
):
"""
Called when the client is listening, and somebody removes reaction from a message
:param mid: Message ID, that user reac... | [
"def",
"onReactionRemoved",
"(",
"self",
",",
"mid",
"=",
"None",
",",
"author_id",
"=",
"None",
",",
"thread_id",
"=",
"None",
",",
"thread_type",
"=",
"None",
",",
"ts",
"=",
"None",
",",
"msg",
"=",
"None",
",",
")",
":",
"log",
".",
"info",
"("... | Called when the client is listening, and somebody removes reaction from a message
:param mid: Message ID, that user reacted to
:param author_id: The ID of the person who removed reaction
:param thread_id: Thread ID that the action was sent to. See :ref:`intro_threads`
:param thread_type... | [
"Called",
"when",
"the",
"client",
"is",
"listening",
"and",
"somebody",
"removes",
"reaction",
"from",
"a",
"message"
] | f480d68b5773473e6daba7f66075ee30e8d737a8 | https://github.com/carpedm20/fbchat/blob/f480d68b5773473e6daba7f66075ee30e8d737a8/fbchat/_client.py#L3683-L3707 | train |
carpedm20/fbchat | fbchat/_client.py | Client.onBlock | def onBlock(
self, author_id=None, thread_id=None, thread_type=None, ts=None, msg=None
):
"""
Called when the client is listening, and somebody blocks client
:param author_id: The ID of the person who blocked
:param thread_id: Thread ID that the action was sent to. See :ref:... | python | def onBlock(
self, author_id=None, thread_id=None, thread_type=None, ts=None, msg=None
):
"""
Called when the client is listening, and somebody blocks client
:param author_id: The ID of the person who blocked
:param thread_id: Thread ID that the action was sent to. See :ref:... | [
"def",
"onBlock",
"(",
"self",
",",
"author_id",
"=",
"None",
",",
"thread_id",
"=",
"None",
",",
"thread_type",
"=",
"None",
",",
"ts",
"=",
"None",
",",
"msg",
"=",
"None",
")",
":",
"log",
".",
"info",
"(",
"\"{} blocked {} ({}) thread\"",
".",
"for... | Called when the client is listening, and somebody blocks client
:param author_id: The ID of the person who blocked
:param thread_id: Thread ID that the action was sent to. See :ref:`intro_threads`
:param thread_type: Type of thread that the action was sent to. See :ref:`intro_threads`
:... | [
"Called",
"when",
"the",
"client",
"is",
"listening",
"and",
"somebody",
"blocks",
"client"
] | f480d68b5773473e6daba7f66075ee30e8d737a8 | https://github.com/carpedm20/fbchat/blob/f480d68b5773473e6daba7f66075ee30e8d737a8/fbchat/_client.py#L3709-L3724 | train |
carpedm20/fbchat | fbchat/_client.py | Client.onLiveLocation | def onLiveLocation(
self,
mid=None,
location=None,
author_id=None,
thread_id=None,
thread_type=None,
ts=None,
msg=None,
):
"""
Called when the client is listening and somebody sends live location info
:param mid: The action ID
... | python | def onLiveLocation(
self,
mid=None,
location=None,
author_id=None,
thread_id=None,
thread_type=None,
ts=None,
msg=None,
):
"""
Called when the client is listening and somebody sends live location info
:param mid: The action ID
... | [
"def",
"onLiveLocation",
"(",
"self",
",",
"mid",
"=",
"None",
",",
"location",
"=",
"None",
",",
"author_id",
"=",
"None",
",",
"thread_id",
"=",
"None",
",",
"thread_type",
"=",
"None",
",",
"ts",
"=",
"None",
",",
"msg",
"=",
"None",
",",
")",
"... | Called when the client is listening and somebody sends live location info
:param mid: The action ID
:param location: Sent location info
:param author_id: The ID of the person who sent location info
:param thread_id: Thread ID that the action was sent to. See :ref:`intro_threads`
... | [
"Called",
"when",
"the",
"client",
"is",
"listening",
"and",
"somebody",
"sends",
"live",
"location",
"info"
] | f480d68b5773473e6daba7f66075ee30e8d737a8 | https://github.com/carpedm20/fbchat/blob/f480d68b5773473e6daba7f66075ee30e8d737a8/fbchat/_client.py#L3743-L3770 | train |
carpedm20/fbchat | fbchat/_client.py | Client.onUserJoinedCall | def onUserJoinedCall(
self,
mid=None,
joined_id=None,
is_video_call=None,
thread_id=None,
thread_type=None,
ts=None,
metadata=None,
msg=None,
):
"""
Called when the client is listening, and somebody joins a group call
:... | python | def onUserJoinedCall(
self,
mid=None,
joined_id=None,
is_video_call=None,
thread_id=None,
thread_type=None,
ts=None,
metadata=None,
msg=None,
):
"""
Called when the client is listening, and somebody joins a group call
:... | [
"def",
"onUserJoinedCall",
"(",
"self",
",",
"mid",
"=",
"None",
",",
"joined_id",
"=",
"None",
",",
"is_video_call",
"=",
"None",
",",
"thread_id",
"=",
"None",
",",
"thread_type",
"=",
"None",
",",
"ts",
"=",
"None",
",",
"metadata",
"=",
"None",
","... | Called when the client is listening, and somebody joins a group call
:param mid: The action ID
:param joined_id: The ID of the person who joined the call
:param is_video_call: True if it's video call
:param thread_id: Thread ID that the action was sent to. See :ref:`intro_threads`
... | [
"Called",
"when",
"the",
"client",
"is",
"listening",
"and",
"somebody",
"joins",
"a",
"group",
"call"
] | f480d68b5773473e6daba7f66075ee30e8d737a8 | https://github.com/carpedm20/fbchat/blob/f480d68b5773473e6daba7f66075ee30e8d737a8/fbchat/_client.py#L3836-L3862 | train |
carpedm20/fbchat | fbchat/_client.py | Client.onPollCreated | def onPollCreated(
self,
mid=None,
poll=None,
author_id=None,
thread_id=None,
thread_type=None,
ts=None,
metadata=None,
msg=None,
):
"""
Called when the client is listening, and somebody creates a group poll
:param mid:... | python | def onPollCreated(
self,
mid=None,
poll=None,
author_id=None,
thread_id=None,
thread_type=None,
ts=None,
metadata=None,
msg=None,
):
"""
Called when the client is listening, and somebody creates a group poll
:param mid:... | [
"def",
"onPollCreated",
"(",
"self",
",",
"mid",
"=",
"None",
",",
"poll",
"=",
"None",
",",
"author_id",
"=",
"None",
",",
"thread_id",
"=",
"None",
",",
"thread_type",
"=",
"None",
",",
"ts",
"=",
"None",
",",
"metadata",
"=",
"None",
",",
"msg",
... | Called when the client is listening, and somebody creates a group poll
:param mid: The action ID
:param poll: Created poll
:param author_id: The ID of the person who created the poll
:param thread_id: Thread ID that the action was sent to. See :ref:`intro_threads`
:param thread_... | [
"Called",
"when",
"the",
"client",
"is",
"listening",
"and",
"somebody",
"creates",
"a",
"group",
"poll"
] | f480d68b5773473e6daba7f66075ee30e8d737a8 | https://github.com/carpedm20/fbchat/blob/f480d68b5773473e6daba7f66075ee30e8d737a8/fbchat/_client.py#L3864-L3893 | train |
carpedm20/fbchat | fbchat/_client.py | Client.onPollVoted | def onPollVoted(
self,
mid=None,
poll=None,
added_options=None,
removed_options=None,
author_id=None,
thread_id=None,
thread_type=None,
ts=None,
metadata=None,
msg=None,
):
"""
Called when the client is listening... | python | def onPollVoted(
self,
mid=None,
poll=None,
added_options=None,
removed_options=None,
author_id=None,
thread_id=None,
thread_type=None,
ts=None,
metadata=None,
msg=None,
):
"""
Called when the client is listening... | [
"def",
"onPollVoted",
"(",
"self",
",",
"mid",
"=",
"None",
",",
"poll",
"=",
"None",
",",
"added_options",
"=",
"None",
",",
"removed_options",
"=",
"None",
",",
"author_id",
"=",
"None",
",",
"thread_id",
"=",
"None",
",",
"thread_type",
"=",
"None",
... | Called when the client is listening, and somebody votes in a group poll
:param mid: The action ID
:param poll: Poll, that user voted in
:param author_id: The ID of the person who voted in the poll
:param thread_id: Thread ID that the action was sent to. See :ref:`intro_threads`
... | [
"Called",
"when",
"the",
"client",
"is",
"listening",
"and",
"somebody",
"votes",
"in",
"a",
"group",
"poll"
] | f480d68b5773473e6daba7f66075ee30e8d737a8 | https://github.com/carpedm20/fbchat/blob/f480d68b5773473e6daba7f66075ee30e8d737a8/fbchat/_client.py#L3895-L3926 | train |
carpedm20/fbchat | fbchat/_client.py | Client.onPlanDeleted | def onPlanDeleted(
self,
mid=None,
plan=None,
author_id=None,
thread_id=None,
thread_type=None,
ts=None,
metadata=None,
msg=None,
):
"""
Called when the client is listening, and somebody deletes a plan
:param mid: The a... | python | def onPlanDeleted(
self,
mid=None,
plan=None,
author_id=None,
thread_id=None,
thread_type=None,
ts=None,
metadata=None,
msg=None,
):
"""
Called when the client is listening, and somebody deletes a plan
:param mid: The a... | [
"def",
"onPlanDeleted",
"(",
"self",
",",
"mid",
"=",
"None",
",",
"plan",
"=",
"None",
",",
"author_id",
"=",
"None",
",",
"thread_id",
"=",
"None",
",",
"thread_type",
"=",
"None",
",",
"ts",
"=",
"None",
",",
"metadata",
"=",
"None",
",",
"msg",
... | Called when the client is listening, and somebody deletes a plan
:param mid: The action ID
:param plan: Deleted plan
:param author_id: The ID of the person who deleted the plan
:param thread_id: Thread ID that the action was sent to. See :ref:`intro_threads`
:param thread_type: ... | [
"Called",
"when",
"the",
"client",
"is",
"listening",
"and",
"somebody",
"deletes",
"a",
"plan"
] | f480d68b5773473e6daba7f66075ee30e8d737a8 | https://github.com/carpedm20/fbchat/blob/f480d68b5773473e6daba7f66075ee30e8d737a8/fbchat/_client.py#L4017-L4046 | train |
carpedm20/fbchat | fbchat/_client.py | Client.onPlanParticipation | def onPlanParticipation(
self,
mid=None,
plan=None,
take_part=None,
author_id=None,
thread_id=None,
thread_type=None,
ts=None,
metadata=None,
msg=None,
):
"""
Called when the client is listening, and somebody takes part ... | python | def onPlanParticipation(
self,
mid=None,
plan=None,
take_part=None,
author_id=None,
thread_id=None,
thread_type=None,
ts=None,
metadata=None,
msg=None,
):
"""
Called when the client is listening, and somebody takes part ... | [
"def",
"onPlanParticipation",
"(",
"self",
",",
"mid",
"=",
"None",
",",
"plan",
"=",
"None",
",",
"take_part",
"=",
"None",
",",
"author_id",
"=",
"None",
",",
"thread_id",
"=",
"None",
",",
"thread_type",
"=",
"None",
",",
"ts",
"=",
"None",
",",
"... | Called when the client is listening, and somebody takes part in a plan or not
:param mid: The action ID
:param plan: Plan
:param take_part: Whether the person takes part in the plan or not
:param author_id: The ID of the person who will participate in the plan or not
:param thre... | [
"Called",
"when",
"the",
"client",
"is",
"listening",
"and",
"somebody",
"takes",
"part",
"in",
"a",
"plan",
"or",
"not"
] | f480d68b5773473e6daba7f66075ee30e8d737a8 | https://github.com/carpedm20/fbchat/blob/f480d68b5773473e6daba7f66075ee30e8d737a8/fbchat/_client.py#L4048-L4087 | train |
carpedm20/fbchat | fbchat/_graphql.py | graphql_queries_to_json | def graphql_queries_to_json(*queries):
"""
Queries should be a list of GraphQL objects
"""
rtn = {}
for i, query in enumerate(queries):
rtn["q{}".format(i)] = query.value
return json.dumps(rtn) | python | def graphql_queries_to_json(*queries):
"""
Queries should be a list of GraphQL objects
"""
rtn = {}
for i, query in enumerate(queries):
rtn["q{}".format(i)] = query.value
return json.dumps(rtn) | [
"def",
"graphql_queries_to_json",
"(",
"*",
"queries",
")",
":",
"rtn",
"=",
"{",
"}",
"for",
"i",
",",
"query",
"in",
"enumerate",
"(",
"queries",
")",
":",
"rtn",
"[",
"\"q{}\"",
".",
"format",
"(",
"i",
")",
"]",
"=",
"query",
".",
"value",
"ret... | Queries should be a list of GraphQL objects | [
"Queries",
"should",
"be",
"a",
"list",
"of",
"GraphQL",
"objects"
] | f480d68b5773473e6daba7f66075ee30e8d737a8 | https://github.com/carpedm20/fbchat/blob/f480d68b5773473e6daba7f66075ee30e8d737a8/fbchat/_graphql.py#L30-L37 | train |
jarun/Buku | bukuserver/server.py | get_tags | def get_tags():
"""get tags."""
tags = getattr(flask.g, 'bukudb', get_bukudb()).get_tag_all()
result = {
'tags': tags[0]
}
if request.path.startswith('/api/'):
res = jsonify(result)
else:
res = render_template('bukuserver/tags.html', result=result)
return res | python | def get_tags():
"""get tags."""
tags = getattr(flask.g, 'bukudb', get_bukudb()).get_tag_all()
result = {
'tags': tags[0]
}
if request.path.startswith('/api/'):
res = jsonify(result)
else:
res = render_template('bukuserver/tags.html', result=result)
return res | [
"def",
"get_tags",
"(",
")",
":",
"tags",
"=",
"getattr",
"(",
"flask",
".",
"g",
",",
"'bukudb'",
",",
"get_bukudb",
"(",
")",
")",
".",
"get_tag_all",
"(",
")",
"result",
"=",
"{",
"'tags'",
":",
"tags",
"[",
"0",
"]",
"}",
"if",
"request",
"."... | get tags. | [
"get",
"tags",
"."
] | 5f101363cf68f7666d4f5b28f0887ee07e916054 | https://github.com/jarun/Buku/blob/5f101363cf68f7666d4f5b28f0887ee07e916054/bukuserver/server.py#L42-L52 | train |
jarun/Buku | bukuserver/server.py | create_app | def create_app(config_filename=None):
"""create app."""
app = FlaskAPI(__name__)
per_page = int(os.getenv('BUKUSERVER_PER_PAGE', str(views.DEFAULT_PER_PAGE)))
per_page = per_page if per_page > 0 else views.DEFAULT_PER_PAGE
app.config['BUKUSERVER_PER_PAGE'] = per_page
url_render_mode = os.getenv(... | python | def create_app(config_filename=None):
"""create app."""
app = FlaskAPI(__name__)
per_page = int(os.getenv('BUKUSERVER_PER_PAGE', str(views.DEFAULT_PER_PAGE)))
per_page = per_page if per_page > 0 else views.DEFAULT_PER_PAGE
app.config['BUKUSERVER_PER_PAGE'] = per_page
url_render_mode = os.getenv(... | [
"def",
"create_app",
"(",
"config_filename",
"=",
"None",
")",
":",
"app",
"=",
"FlaskAPI",
"(",
"__name__",
")",
"per_page",
"=",
"int",
"(",
"os",
".",
"getenv",
"(",
"'BUKUSERVER_PER_PAGE'",
",",
"str",
"(",
"views",
".",
"DEFAULT_PER_PAGE",
")",
")",
... | create app. | [
"create",
"app",
"."
] | 5f101363cf68f7666d4f5b28f0887ee07e916054 | https://github.com/jarun/Buku/blob/5f101363cf68f7666d4f5b28f0887ee07e916054/bukuserver/server.py#L519-L591 | train |
jarun/Buku | bukuserver/views.py | CustomAdminIndexView.search | def search(self):
"redirect to bookmark search"
form = forms.HomeForm()
bbm_filter = bs_filters.BookmarkBukuFilter(
all_keywords=False, deep=form.deep.data, regex=form.regex.data)
op_text = bbm_filter.operation()
values_combi = sorted(itertools.product([True, False], ... | python | def search(self):
"redirect to bookmark search"
form = forms.HomeForm()
bbm_filter = bs_filters.BookmarkBukuFilter(
all_keywords=False, deep=form.deep.data, regex=form.regex.data)
op_text = bbm_filter.operation()
values_combi = sorted(itertools.product([True, False], ... | [
"def",
"search",
"(",
"self",
")",
":",
"form",
"=",
"forms",
".",
"HomeForm",
"(",
")",
"bbm_filter",
"=",
"bs_filters",
".",
"BookmarkBukuFilter",
"(",
"all_keywords",
"=",
"False",
",",
"deep",
"=",
"form",
".",
"deep",
".",
"data",
",",
"regex",
"=... | redirect to bookmark search | [
"redirect",
"to",
"bookmark",
"search"
] | 5f101363cf68f7666d4f5b28f0887ee07e916054 | https://github.com/jarun/Buku/blob/5f101363cf68f7666d4f5b28f0887ee07e916054/bukuserver/views.py#L38-L52 | train |
lepture/mistune | mistune.py | Renderer.autolink | def autolink(self, link, is_email=False):
"""Rendering a given link or email address.
:param link: link content or email address.
:param is_email: whether this is an email or not.
"""
text = link = escape_link(link)
if is_email:
link = 'mailto:%s' % link
... | python | def autolink(self, link, is_email=False):
"""Rendering a given link or email address.
:param link: link content or email address.
:param is_email: whether this is an email or not.
"""
text = link = escape_link(link)
if is_email:
link = 'mailto:%s' % link
... | [
"def",
"autolink",
"(",
"self",
",",
"link",
",",
"is_email",
"=",
"False",
")",
":",
"text",
"=",
"link",
"=",
"escape_link",
"(",
"link",
")",
"if",
"is_email",
":",
"link",
"=",
"'mailto:%s'",
"%",
"link",
"return",
"'<a href=\"%s\">%s</a>'",
"%",
"("... | Rendering a given link or email address.
:param link: link content or email address.
:param is_email: whether this is an email or not. | [
"Rendering",
"a",
"given",
"link",
"or",
"email",
"address",
"."
] | 449c2b52961c30665ccba6a822652ec7d0e15938 | https://github.com/lepture/mistune/blob/449c2b52961c30665ccba6a822652ec7d0e15938/mistune.py#L871-L880 | train |
getsentry/sentry-python | sentry_sdk/hub.py | init | def init(*args, **kwargs):
"""Initializes the SDK and optionally integrations.
This takes the same arguments as the client constructor.
"""
global _initial_client
client = Client(*args, **kwargs)
Hub.current.bind_client(client)
rv = _InitGuard(client)
if client is not None:
_ini... | python | def init(*args, **kwargs):
"""Initializes the SDK and optionally integrations.
This takes the same arguments as the client constructor.
"""
global _initial_client
client = Client(*args, **kwargs)
Hub.current.bind_client(client)
rv = _InitGuard(client)
if client is not None:
_ini... | [
"def",
"init",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"global",
"_initial_client",
"client",
"=",
"Client",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"Hub",
".",
"current",
".",
"bind_client",
"(",
"client",
")",
"rv",
"=",
"_In... | Initializes the SDK and optionally integrations.
This takes the same arguments as the client constructor. | [
"Initializes",
"the",
"SDK",
"and",
"optionally",
"integrations",
"."
] | a1d77722bdce0b94660ebf50b5c4a4645916d084 | https://github.com/getsentry/sentry-python/blob/a1d77722bdce0b94660ebf50b5c4a4645916d084/sentry_sdk/hub.py#L61-L72 | train |
getsentry/sentry-python | sentry_sdk/hub.py | HubMeta.current | def current(self):
# type: () -> Hub
"""Returns the current instance of the hub."""
rv = _local.get(None)
if rv is None:
rv = Hub(GLOBAL_HUB)
_local.set(rv)
return rv | python | def current(self):
# type: () -> Hub
"""Returns the current instance of the hub."""
rv = _local.get(None)
if rv is None:
rv = Hub(GLOBAL_HUB)
_local.set(rv)
return rv | [
"def",
"current",
"(",
"self",
")",
":",
"# type: () -> Hub",
"rv",
"=",
"_local",
".",
"get",
"(",
"None",
")",
"if",
"rv",
"is",
"None",
":",
"rv",
"=",
"Hub",
"(",
"GLOBAL_HUB",
")",
"_local",
".",
"set",
"(",
"rv",
")",
"return",
"rv"
] | Returns the current instance of the hub. | [
"Returns",
"the",
"current",
"instance",
"of",
"the",
"hub",
"."
] | a1d77722bdce0b94660ebf50b5c4a4645916d084 | https://github.com/getsentry/sentry-python/blob/a1d77722bdce0b94660ebf50b5c4a4645916d084/sentry_sdk/hub.py#L77-L84 | train |
getsentry/sentry-python | sentry_sdk/hub.py | Hub.get_integration | def get_integration(self, name_or_class):
# type: (Union[str, Integration]) -> Any
"""Returns the integration for this hub by name or class. If there
is no client bound or the client does not have that integration
then `None` is returned.
If the return value is not `None` the h... | python | def get_integration(self, name_or_class):
# type: (Union[str, Integration]) -> Any
"""Returns the integration for this hub by name or class. If there
is no client bound or the client does not have that integration
then `None` is returned.
If the return value is not `None` the h... | [
"def",
"get_integration",
"(",
"self",
",",
"name_or_class",
")",
":",
"# type: (Union[str, Integration]) -> Any",
"if",
"isinstance",
"(",
"name_or_class",
",",
"str",
")",
":",
"integration_name",
"=",
"name_or_class",
"elif",
"name_or_class",
".",
"identifier",
"is... | Returns the integration for this hub by name or class. If there
is no client bound or the client does not have that integration
then `None` is returned.
If the return value is not `None` the hub is guaranteed to have a
client attached. | [
"Returns",
"the",
"integration",
"for",
"this",
"hub",
"by",
"name",
"or",
"class",
".",
"If",
"there",
"is",
"no",
"client",
"bound",
"or",
"the",
"client",
"does",
"not",
"have",
"that",
"integration",
"then",
"None",
"is",
"returned",
"."
] | a1d77722bdce0b94660ebf50b5c4a4645916d084 | https://github.com/getsentry/sentry-python/blob/a1d77722bdce0b94660ebf50b5c4a4645916d084/sentry_sdk/hub.py#L196-L235 | train |
getsentry/sentry-python | sentry_sdk/hub.py | Hub.bind_client | def bind_client(self, new):
"""Binds a new client to the hub."""
top = self._stack[-1]
self._stack[-1] = (new, top[1]) | python | def bind_client(self, new):
"""Binds a new client to the hub."""
top = self._stack[-1]
self._stack[-1] = (new, top[1]) | [
"def",
"bind_client",
"(",
"self",
",",
"new",
")",
":",
"top",
"=",
"self",
".",
"_stack",
"[",
"-",
"1",
"]",
"self",
".",
"_stack",
"[",
"-",
"1",
"]",
"=",
"(",
"new",
",",
"top",
"[",
"1",
"]",
")"
] | Binds a new client to the hub. | [
"Binds",
"a",
"new",
"client",
"to",
"the",
"hub",
"."
] | a1d77722bdce0b94660ebf50b5c4a4645916d084 | https://github.com/getsentry/sentry-python/blob/a1d77722bdce0b94660ebf50b5c4a4645916d084/sentry_sdk/hub.py#L248-L251 | train |
getsentry/sentry-python | sentry_sdk/hub.py | Hub.capture_event | def capture_event(self, event, hint=None):
# type: (Dict[str, Any], Dict[str, Any]) -> Optional[str]
"""Captures an event. The return value is the ID of the event.
The event is a dictionary following the Sentry v7/v8 protocol
specification. Optionally an event hint dict can be passed ... | python | def capture_event(self, event, hint=None):
# type: (Dict[str, Any], Dict[str, Any]) -> Optional[str]
"""Captures an event. The return value is the ID of the event.
The event is a dictionary following the Sentry v7/v8 protocol
specification. Optionally an event hint dict can be passed ... | [
"def",
"capture_event",
"(",
"self",
",",
"event",
",",
"hint",
"=",
"None",
")",
":",
"# type: (Dict[str, Any], Dict[str, Any]) -> Optional[str]",
"client",
",",
"scope",
"=",
"self",
".",
"_stack",
"[",
"-",
"1",
"]",
"if",
"client",
"is",
"not",
"None",
"... | Captures an event. The return value is the ID of the event.
The event is a dictionary following the Sentry v7/v8 protocol
specification. Optionally an event hint dict can be passed that
is used by processors to extract additional information from it.
Typically the event hint object wo... | [
"Captures",
"an",
"event",
".",
"The",
"return",
"value",
"is",
"the",
"ID",
"of",
"the",
"event",
"."
] | a1d77722bdce0b94660ebf50b5c4a4645916d084 | https://github.com/getsentry/sentry-python/blob/a1d77722bdce0b94660ebf50b5c4a4645916d084/sentry_sdk/hub.py#L253-L268 | train |
getsentry/sentry-python | sentry_sdk/hub.py | Hub.capture_message | def capture_message(self, message, level=None):
# type: (str, Optional[Any]) -> Optional[str]
"""Captures a message. The message is just a string. If no level
is provided the default level is `info`.
"""
if self.client is None:
return None
if level is None:
... | python | def capture_message(self, message, level=None):
# type: (str, Optional[Any]) -> Optional[str]
"""Captures a message. The message is just a string. If no level
is provided the default level is `info`.
"""
if self.client is None:
return None
if level is None:
... | [
"def",
"capture_message",
"(",
"self",
",",
"message",
",",
"level",
"=",
"None",
")",
":",
"# type: (str, Optional[Any]) -> Optional[str]",
"if",
"self",
".",
"client",
"is",
"None",
":",
"return",
"None",
"if",
"level",
"is",
"None",
":",
"level",
"=",
"\"... | Captures a message. The message is just a string. If no level
is provided the default level is `info`. | [
"Captures",
"a",
"message",
".",
"The",
"message",
"is",
"just",
"a",
"string",
".",
"If",
"no",
"level",
"is",
"provided",
"the",
"default",
"level",
"is",
"info",
"."
] | a1d77722bdce0b94660ebf50b5c4a4645916d084 | https://github.com/getsentry/sentry-python/blob/a1d77722bdce0b94660ebf50b5c4a4645916d084/sentry_sdk/hub.py#L270-L279 | train |
getsentry/sentry-python | sentry_sdk/hub.py | Hub.capture_exception | def capture_exception(self, error=None):
# type: (Optional[BaseException]) -> Optional[str]
"""Captures an exception.
The argument passed can be `None` in which case the last exception
will be reported, otherwise an exception object or an `exc_info`
tuple.
"""
cl... | python | def capture_exception(self, error=None):
# type: (Optional[BaseException]) -> Optional[str]
"""Captures an exception.
The argument passed can be `None` in which case the last exception
will be reported, otherwise an exception object or an `exc_info`
tuple.
"""
cl... | [
"def",
"capture_exception",
"(",
"self",
",",
"error",
"=",
"None",
")",
":",
"# type: (Optional[BaseException]) -> Optional[str]",
"client",
"=",
"self",
".",
"client",
"if",
"client",
"is",
"None",
":",
"return",
"None",
"if",
"error",
"is",
"None",
":",
"ex... | Captures an exception.
The argument passed can be `None` in which case the last exception
will be reported, otherwise an exception object or an `exc_info`
tuple. | [
"Captures",
"an",
"exception",
"."
] | a1d77722bdce0b94660ebf50b5c4a4645916d084 | https://github.com/getsentry/sentry-python/blob/a1d77722bdce0b94660ebf50b5c4a4645916d084/sentry_sdk/hub.py#L281-L303 | train |
getsentry/sentry-python | sentry_sdk/hub.py | Hub.push_scope | def push_scope(self, callback=None): # noqa
"""Pushes a new layer on the scope stack. Returns a context manager
that should be used to pop the scope again. Alternatively a callback
can be provided that is executed in the context of the scope.
"""
if callback is not None:
... | python | def push_scope(self, callback=None): # noqa
"""Pushes a new layer on the scope stack. Returns a context manager
that should be used to pop the scope again. Alternatively a callback
can be provided that is executed in the context of the scope.
"""
if callback is not None:
... | [
"def",
"push_scope",
"(",
"self",
",",
"callback",
"=",
"None",
")",
":",
"# noqa",
"if",
"callback",
"is",
"not",
"None",
":",
"with",
"self",
".",
"push_scope",
"(",
")",
"as",
"scope",
":",
"callback",
"(",
"scope",
")",
"return",
"None",
"client",
... | Pushes a new layer on the scope stack. Returns a context manager
that should be used to pop the scope again. Alternatively a callback
can be provided that is executed in the context of the scope. | [
"Pushes",
"a",
"new",
"layer",
"on",
"the",
"scope",
"stack",
".",
"Returns",
"a",
"context",
"manager",
"that",
"should",
"be",
"used",
"to",
"pop",
"the",
"scope",
"again",
".",
"Alternatively",
"a",
"callback",
"can",
"be",
"provided",
"that",
"is",
"... | a1d77722bdce0b94660ebf50b5c4a4645916d084 | https://github.com/getsentry/sentry-python/blob/a1d77722bdce0b94660ebf50b5c4a4645916d084/sentry_sdk/hub.py#L357-L372 | train |
getsentry/sentry-python | sentry_sdk/hub.py | Hub.configure_scope | def configure_scope(self, callback=None): # noqa
"""Reconfigures the scope."""
client, scope = self._stack[-1]
if callback is not None:
if client is not None:
callback(scope)
return None
@contextmanager
def inner():
if clien... | python | def configure_scope(self, callback=None): # noqa
"""Reconfigures the scope."""
client, scope = self._stack[-1]
if callback is not None:
if client is not None:
callback(scope)
return None
@contextmanager
def inner():
if clien... | [
"def",
"configure_scope",
"(",
"self",
",",
"callback",
"=",
"None",
")",
":",
"# noqa",
"client",
",",
"scope",
"=",
"self",
".",
"_stack",
"[",
"-",
"1",
"]",
"if",
"callback",
"is",
"not",
"None",
":",
"if",
"client",
"is",
"not",
"None",
":",
"... | Reconfigures the scope. | [
"Reconfigures",
"the",
"scope",
"."
] | a1d77722bdce0b94660ebf50b5c4a4645916d084 | https://github.com/getsentry/sentry-python/blob/a1d77722bdce0b94660ebf50b5c4a4645916d084/sentry_sdk/hub.py#L393-L410 | train |
getsentry/sentry-python | sentry_sdk/hub.py | Hub.flush | def flush(self, timeout=None, callback=None):
"""Alias for self.client.flush"""
client, scope = self._stack[-1]
if client is not None:
return client.flush(timeout=timeout, callback=callback) | python | def flush(self, timeout=None, callback=None):
"""Alias for self.client.flush"""
client, scope = self._stack[-1]
if client is not None:
return client.flush(timeout=timeout, callback=callback) | [
"def",
"flush",
"(",
"self",
",",
"timeout",
"=",
"None",
",",
"callback",
"=",
"None",
")",
":",
"client",
",",
"scope",
"=",
"self",
".",
"_stack",
"[",
"-",
"1",
"]",
"if",
"client",
"is",
"not",
"None",
":",
"return",
"client",
".",
"flush",
... | Alias for self.client.flush | [
"Alias",
"for",
"self",
".",
"client",
".",
"flush"
] | a1d77722bdce0b94660ebf50b5c4a4645916d084 | https://github.com/getsentry/sentry-python/blob/a1d77722bdce0b94660ebf50b5c4a4645916d084/sentry_sdk/hub.py#L412-L416 | train |
getsentry/sentry-python | sentry_sdk/client.py | Client.capture_event | def capture_event(self, event, hint=None, scope=None):
# type: (Dict[str, Any], Any, Scope) -> Optional[str]
"""Captures an event.
This takes the ready made event and an optoinal hint and scope. The
hint is internally used to further customize the representation of the
error. ... | python | def capture_event(self, event, hint=None, scope=None):
# type: (Dict[str, Any], Any, Scope) -> Optional[str]
"""Captures an event.
This takes the ready made event and an optoinal hint and scope. The
hint is internally used to further customize the representation of the
error. ... | [
"def",
"capture_event",
"(",
"self",
",",
"event",
",",
"hint",
"=",
"None",
",",
"scope",
"=",
"None",
")",
":",
"# type: (Dict[str, Any], Any, Scope) -> Optional[str]",
"if",
"self",
".",
"transport",
"is",
"None",
":",
"return",
"None",
"if",
"hint",
"is",
... | Captures an event.
This takes the ready made event and an optoinal hint and scope. The
hint is internally used to further customize the representation of the
error. When provided it's a dictionary of optional information such
as exception info.
If the transport is not set not... | [
"Captures",
"an",
"event",
"."
] | a1d77722bdce0b94660ebf50b5c4a4645916d084 | https://github.com/getsentry/sentry-python/blob/a1d77722bdce0b94660ebf50b5c4a4645916d084/sentry_sdk/client.py#L206-L231 | train |
getsentry/sentry-python | sentry_sdk/client.py | Client.flush | def flush(self, timeout=None, callback=None):
"""
Wait `timeout` seconds for the current events to be sent. If no
`timeout` is provided, the `shutdown_timeout` option value is used.
The `callback` is invoked with two arguments: the number of pending
events and the configured tim... | python | def flush(self, timeout=None, callback=None):
"""
Wait `timeout` seconds for the current events to be sent. If no
`timeout` is provided, the `shutdown_timeout` option value is used.
The `callback` is invoked with two arguments: the number of pending
events and the configured tim... | [
"def",
"flush",
"(",
"self",
",",
"timeout",
"=",
"None",
",",
"callback",
"=",
"None",
")",
":",
"if",
"self",
".",
"transport",
"is",
"not",
"None",
":",
"if",
"timeout",
"is",
"None",
":",
"timeout",
"=",
"self",
".",
"options",
"[",
"\"shutdown_t... | Wait `timeout` seconds for the current events to be sent. If no
`timeout` is provided, the `shutdown_timeout` option value is used.
The `callback` is invoked with two arguments: the number of pending
events and the configured timeout. For instance the default atexit
integration will us... | [
"Wait",
"timeout",
"seconds",
"for",
"the",
"current",
"events",
"to",
"be",
"sent",
".",
"If",
"no",
"timeout",
"is",
"provided",
"the",
"shutdown_timeout",
"option",
"value",
"is",
"used",
"."
] | a1d77722bdce0b94660ebf50b5c4a4645916d084 | https://github.com/getsentry/sentry-python/blob/a1d77722bdce0b94660ebf50b5c4a4645916d084/sentry_sdk/client.py#L243-L255 | train |
getsentry/sentry-python | sentry_sdk/integrations/__init__.py | setup_integrations | def setup_integrations(integrations, with_defaults=True):
# type: (List[Integration], bool) -> Dict[str, Integration]
"""Given a list of integration instances this installs them all. When
`with_defaults` is set to `True` then all default integrations are added
unless they were already provided before.
... | python | def setup_integrations(integrations, with_defaults=True):
# type: (List[Integration], bool) -> Dict[str, Integration]
"""Given a list of integration instances this installs them all. When
`with_defaults` is set to `True` then all default integrations are added
unless they were already provided before.
... | [
"def",
"setup_integrations",
"(",
"integrations",
",",
"with_defaults",
"=",
"True",
")",
":",
"# type: (List[Integration], bool) -> Dict[str, Integration]",
"integrations",
"=",
"dict",
"(",
"(",
"integration",
".",
"identifier",
",",
"integration",
")",
"for",
"integr... | Given a list of integration instances this installs them all. When
`with_defaults` is set to `True` then all default integrations are added
unless they were already provided before. | [
"Given",
"a",
"list",
"of",
"integration",
"instances",
"this",
"installs",
"them",
"all",
".",
"When",
"with_defaults",
"is",
"set",
"to",
"True",
"then",
"all",
"default",
"integrations",
"are",
"added",
"unless",
"they",
"were",
"already",
"provided",
"befo... | a1d77722bdce0b94660ebf50b5c4a4645916d084 | https://github.com/getsentry/sentry-python/blob/a1d77722bdce0b94660ebf50b5c4a4645916d084/sentry_sdk/integrations/__init__.py#L57-L98 | train |
getsentry/sentry-python | sentry_sdk/scope.py | Scope.clear | def clear(self):
# type: () -> None
"""Clears the entire scope."""
self._level = None
self._fingerprint = None
self._transaction = None
self._user = None
self._tags = {} # type: Dict[str, Any]
self._contexts = {} # type: Dict[str, Dict]
self._ex... | python | def clear(self):
# type: () -> None
"""Clears the entire scope."""
self._level = None
self._fingerprint = None
self._transaction = None
self._user = None
self._tags = {} # type: Dict[str, Any]
self._contexts = {} # type: Dict[str, Dict]
self._ex... | [
"def",
"clear",
"(",
"self",
")",
":",
"# type: () -> None",
"self",
".",
"_level",
"=",
"None",
"self",
".",
"_fingerprint",
"=",
"None",
"self",
".",
"_transaction",
"=",
"None",
"self",
".",
"_user",
"=",
"None",
"self",
".",
"_tags",
"=",
"{",
"}",... | Clears the entire scope. | [
"Clears",
"the",
"entire",
"scope",
"."
] | a1d77722bdce0b94660ebf50b5c4a4645916d084 | https://github.com/getsentry/sentry-python/blob/a1d77722bdce0b94660ebf50b5c4a4645916d084/sentry_sdk/scope.py#L120-L135 | train |
getsentry/sentry-python | sentry_sdk/scope.py | Scope.add_error_processor | def add_error_processor(self, func, cls=None):
# type: (Callable, Optional[type]) -> None
""""Register a scope local error processor on the scope.
The error processor works similar to an event processor but is
invoked with the original exception info triple as second argument.
"... | python | def add_error_processor(self, func, cls=None):
# type: (Callable, Optional[type]) -> None
""""Register a scope local error processor on the scope.
The error processor works similar to an event processor but is
invoked with the original exception info triple as second argument.
"... | [
"def",
"add_error_processor",
"(",
"self",
",",
"func",
",",
"cls",
"=",
"None",
")",
":",
"# type: (Callable, Optional[type]) -> None",
"if",
"cls",
"is",
"not",
"None",
":",
"real_func",
"=",
"func",
"def",
"func",
"(",
"event",
",",
"exc_info",
")",
":",
... | Register a scope local error processor on the scope.
The error processor works similar to an event processor but is
invoked with the original exception info triple as second argument. | [
"Register",
"a",
"scope",
"local",
"error",
"processor",
"on",
"the",
"scope",
"."
] | a1d77722bdce0b94660ebf50b5c4a4645916d084 | https://github.com/getsentry/sentry-python/blob/a1d77722bdce0b94660ebf50b5c4a4645916d084/sentry_sdk/scope.py#L150-L169 | train |
getsentry/sentry-python | sentry_sdk/scope.py | Scope.apply_to_event | def apply_to_event(self, event, hint=None):
# type: (Dict[str, Any], Dict[str, Any]) -> Optional[Dict[str, Any]]
"""Applies the information contained on the scope to the given event."""
def _drop(event, cause, ty):
# type: (Dict[str, Any], Callable, str) -> Optional[Any]
... | python | def apply_to_event(self, event, hint=None):
# type: (Dict[str, Any], Dict[str, Any]) -> Optional[Dict[str, Any]]
"""Applies the information contained on the scope to the given event."""
def _drop(event, cause, ty):
# type: (Dict[str, Any], Callable, str) -> Optional[Any]
... | [
"def",
"apply_to_event",
"(",
"self",
",",
"event",
",",
"hint",
"=",
"None",
")",
":",
"# type: (Dict[str, Any], Dict[str, Any]) -> Optional[Dict[str, Any]]",
"def",
"_drop",
"(",
"event",
",",
"cause",
",",
"ty",
")",
":",
"# type: (Dict[str, Any], Callable, str) -> O... | Applies the information contained on the scope to the given event. | [
"Applies",
"the",
"information",
"contained",
"on",
"the",
"scope",
"to",
"the",
"given",
"event",
"."
] | a1d77722bdce0b94660ebf50b5c4a4645916d084 | https://github.com/getsentry/sentry-python/blob/a1d77722bdce0b94660ebf50b5c4a4645916d084/sentry_sdk/scope.py#L172-L225 | train |
getsentry/sentry-python | sentry_sdk/integrations/atexit.py | default_callback | def default_callback(pending, timeout):
"""This is the default shutdown callback that is set on the options.
It prints out a message to stderr that informs the user that some events
are still pending and the process is waiting for them to flush out.
"""
def echo(msg):
sys.stderr.write(msg +... | python | def default_callback(pending, timeout):
"""This is the default shutdown callback that is set on the options.
It prints out a message to stderr that informs the user that some events
are still pending and the process is waiting for them to flush out.
"""
def echo(msg):
sys.stderr.write(msg +... | [
"def",
"default_callback",
"(",
"pending",
",",
"timeout",
")",
":",
"def",
"echo",
"(",
"msg",
")",
":",
"sys",
".",
"stderr",
".",
"write",
"(",
"msg",
"+",
"\"\\n\"",
")",
"echo",
"(",
"\"Sentry is attempting to send %i pending error messages\"",
"%",
"pend... | This is the default shutdown callback that is set on the options.
It prints out a message to stderr that informs the user that some events
are still pending and the process is waiting for them to flush out. | [
"This",
"is",
"the",
"default",
"shutdown",
"callback",
"that",
"is",
"set",
"on",
"the",
"options",
".",
"It",
"prints",
"out",
"a",
"message",
"to",
"stderr",
"that",
"informs",
"the",
"user",
"that",
"some",
"events",
"are",
"still",
"pending",
"and",
... | a1d77722bdce0b94660ebf50b5c4a4645916d084 | https://github.com/getsentry/sentry-python/blob/a1d77722bdce0b94660ebf50b5c4a4645916d084/sentry_sdk/integrations/atexit.py#L16-L28 | train |
getsentry/sentry-python | sentry_sdk/integrations/wsgi.py | get_host | def get_host(environ):
# type: (Dict[str, str]) -> str
"""Return the host for the given WSGI environment. Yanked from Werkzeug."""
if environ.get("HTTP_HOST"):
rv = environ["HTTP_HOST"]
if environ["wsgi.url_scheme"] == "http" and rv.endswith(":80"):
rv = rv[:-3]
elif envi... | python | def get_host(environ):
# type: (Dict[str, str]) -> str
"""Return the host for the given WSGI environment. Yanked from Werkzeug."""
if environ.get("HTTP_HOST"):
rv = environ["HTTP_HOST"]
if environ["wsgi.url_scheme"] == "http" and rv.endswith(":80"):
rv = rv[:-3]
elif envi... | [
"def",
"get_host",
"(",
"environ",
")",
":",
"# type: (Dict[str, str]) -> str",
"if",
"environ",
".",
"get",
"(",
"\"HTTP_HOST\"",
")",
":",
"rv",
"=",
"environ",
"[",
"\"HTTP_HOST\"",
"]",
"if",
"environ",
"[",
"\"wsgi.url_scheme\"",
"]",
"==",
"\"http\"",
"a... | Return the host for the given WSGI environment. Yanked from Werkzeug. | [
"Return",
"the",
"host",
"for",
"the",
"given",
"WSGI",
"environment",
".",
"Yanked",
"from",
"Werkzeug",
"."
] | a1d77722bdce0b94660ebf50b5c4a4645916d084 | https://github.com/getsentry/sentry-python/blob/a1d77722bdce0b94660ebf50b5c4a4645916d084/sentry_sdk/integrations/wsgi.py#L35-L55 | train |
getsentry/sentry-python | sentry_sdk/integrations/wsgi.py | get_request_url | def get_request_url(environ):
# type: (Dict[str, str]) -> str
"""Return the absolute URL without query string for the given WSGI
environment."""
return "%s://%s/%s" % (
environ.get("wsgi.url_scheme"),
get_host(environ),
wsgi_decoding_dance(environ.get("PATH_INFO") or "").lstrip("... | python | def get_request_url(environ):
# type: (Dict[str, str]) -> str
"""Return the absolute URL without query string for the given WSGI
environment."""
return "%s://%s/%s" % (
environ.get("wsgi.url_scheme"),
get_host(environ),
wsgi_decoding_dance(environ.get("PATH_INFO") or "").lstrip("... | [
"def",
"get_request_url",
"(",
"environ",
")",
":",
"# type: (Dict[str, str]) -> str",
"return",
"\"%s://%s/%s\"",
"%",
"(",
"environ",
".",
"get",
"(",
"\"wsgi.url_scheme\"",
")",
",",
"get_host",
"(",
"environ",
")",
",",
"wsgi_decoding_dance",
"(",
"environ",
"... | Return the absolute URL without query string for the given WSGI
environment. | [
"Return",
"the",
"absolute",
"URL",
"without",
"query",
"string",
"for",
"the",
"given",
"WSGI",
"environment",
"."
] | a1d77722bdce0b94660ebf50b5c4a4645916d084 | https://github.com/getsentry/sentry-python/blob/a1d77722bdce0b94660ebf50b5c4a4645916d084/sentry_sdk/integrations/wsgi.py#L58-L66 | train |
getsentry/sentry-python | sentry_sdk/integrations/wsgi.py | _get_environ | def _get_environ(environ):
# type: (Dict[str, str]) -> Iterator[Tuple[str, str]]
"""
Returns our whitelisted environment variables.
"""
keys = ["SERVER_NAME", "SERVER_PORT"]
if _should_send_default_pii():
# Add all three headers here to make debugging of proxy setup easier.
keys ... | python | def _get_environ(environ):
# type: (Dict[str, str]) -> Iterator[Tuple[str, str]]
"""
Returns our whitelisted environment variables.
"""
keys = ["SERVER_NAME", "SERVER_PORT"]
if _should_send_default_pii():
# Add all three headers here to make debugging of proxy setup easier.
keys ... | [
"def",
"_get_environ",
"(",
"environ",
")",
":",
"# type: (Dict[str, str]) -> Iterator[Tuple[str, str]]",
"keys",
"=",
"[",
"\"SERVER_NAME\"",
",",
"\"SERVER_PORT\"",
"]",
"if",
"_should_send_default_pii",
"(",
")",
":",
"# Add all three headers here to make debugging of proxy ... | Returns our whitelisted environment variables. | [
"Returns",
"our",
"whitelisted",
"environment",
"variables",
"."
] | a1d77722bdce0b94660ebf50b5c4a4645916d084 | https://github.com/getsentry/sentry-python/blob/a1d77722bdce0b94660ebf50b5c4a4645916d084/sentry_sdk/integrations/wsgi.py#L96-L108 | train |
getsentry/sentry-python | sentry_sdk/integrations/wsgi.py | get_client_ip | def get_client_ip(environ):
# type: (Dict[str, str]) -> Optional[Any]
"""
Infer the user IP address from various headers. This cannot be used in
security sensitive situations since the value may be forged from a client,
but it's good enough for the event payload.
"""
try:
return envi... | python | def get_client_ip(environ):
# type: (Dict[str, str]) -> Optional[Any]
"""
Infer the user IP address from various headers. This cannot be used in
security sensitive situations since the value may be forged from a client,
but it's good enough for the event payload.
"""
try:
return envi... | [
"def",
"get_client_ip",
"(",
"environ",
")",
":",
"# type: (Dict[str, str]) -> Optional[Any]",
"try",
":",
"return",
"environ",
"[",
"\"HTTP_X_FORWARDED_FOR\"",
"]",
".",
"split",
"(",
"\",\"",
")",
"[",
"0",
"]",
".",
"strip",
"(",
")",
"except",
"(",
"KeyErr... | Infer the user IP address from various headers. This cannot be used in
security sensitive situations since the value may be forged from a client,
but it's good enough for the event payload. | [
"Infer",
"the",
"user",
"IP",
"address",
"from",
"various",
"headers",
".",
"This",
"cannot",
"be",
"used",
"in",
"security",
"sensitive",
"situations",
"since",
"the",
"value",
"may",
"be",
"forged",
"from",
"a",
"client",
"but",
"it",
"s",
"good",
"enoug... | a1d77722bdce0b94660ebf50b5c4a4645916d084 | https://github.com/getsentry/sentry-python/blob/a1d77722bdce0b94660ebf50b5c4a4645916d084/sentry_sdk/integrations/wsgi.py#L132-L149 | train |
getsentry/sentry-python | sentry_sdk/utils.py | event_hint_with_exc_info | def event_hint_with_exc_info(exc_info=None):
# type: (ExcInfo) -> Dict[str, Optional[ExcInfo]]
"""Creates a hint with the exc info filled in."""
if exc_info is None:
exc_info = sys.exc_info()
else:
exc_info = exc_info_from_error(exc_info)
if exc_info[0] is None:
exc_info = No... | python | def event_hint_with_exc_info(exc_info=None):
# type: (ExcInfo) -> Dict[str, Optional[ExcInfo]]
"""Creates a hint with the exc info filled in."""
if exc_info is None:
exc_info = sys.exc_info()
else:
exc_info = exc_info_from_error(exc_info)
if exc_info[0] is None:
exc_info = No... | [
"def",
"event_hint_with_exc_info",
"(",
"exc_info",
"=",
"None",
")",
":",
"# type: (ExcInfo) -> Dict[str, Optional[ExcInfo]]",
"if",
"exc_info",
"is",
"None",
":",
"exc_info",
"=",
"sys",
".",
"exc_info",
"(",
")",
"else",
":",
"exc_info",
"=",
"exc_info_from_error... | Creates a hint with the exc info filled in. | [
"Creates",
"a",
"hint",
"with",
"the",
"exc",
"info",
"filled",
"in",
"."
] | a1d77722bdce0b94660ebf50b5c4a4645916d084 | https://github.com/getsentry/sentry-python/blob/a1d77722bdce0b94660ebf50b5c4a4645916d084/sentry_sdk/utils.py#L81-L90 | train |
getsentry/sentry-python | sentry_sdk/utils.py | format_and_strip | def format_and_strip(template, params, strip_string=strip_string):
"""Format a string containing %s for placeholders and call `strip_string`
on each parameter. The string template itself does not have a maximum
length.
TODO: handle other placeholders, not just %s
"""
chunks = template.split(u"%... | python | def format_and_strip(template, params, strip_string=strip_string):
"""Format a string containing %s for placeholders and call `strip_string`
on each parameter. The string template itself does not have a maximum
length.
TODO: handle other placeholders, not just %s
"""
chunks = template.split(u"%... | [
"def",
"format_and_strip",
"(",
"template",
",",
"params",
",",
"strip_string",
"=",
"strip_string",
")",
":",
"chunks",
"=",
"template",
".",
"split",
"(",
"u\"%s\"",
")",
"if",
"not",
"chunks",
":",
"raise",
"ValueError",
"(",
"\"No formatting placeholders fou... | Format a string containing %s for placeholders and call `strip_string`
on each parameter. The string template itself does not have a maximum
length.
TODO: handle other placeholders, not just %s | [
"Format",
"a",
"string",
"containing",
"%s",
"for",
"placeholders",
"and",
"call",
"strip_string",
"on",
"each",
"parameter",
".",
"The",
"string",
"template",
"itself",
"does",
"not",
"have",
"a",
"maximum",
"length",
"."
] | a1d77722bdce0b94660ebf50b5c4a4645916d084 | https://github.com/getsentry/sentry-python/blob/a1d77722bdce0b94660ebf50b5c4a4645916d084/sentry_sdk/utils.py#L876-L930 | train |
getsentry/sentry-python | sentry_sdk/utils.py | Auth.store_api_url | def store_api_url(self):
"""Returns the API url for storing events."""
return "%s://%s%sapi/%s/store/" % (
self.scheme,
self.host,
self.path,
self.project_id,
) | python | def store_api_url(self):
"""Returns the API url for storing events."""
return "%s://%s%sapi/%s/store/" % (
self.scheme,
self.host,
self.path,
self.project_id,
) | [
"def",
"store_api_url",
"(",
"self",
")",
":",
"return",
"\"%s://%s%sapi/%s/store/\"",
"%",
"(",
"self",
".",
"scheme",
",",
"self",
".",
"host",
",",
"self",
".",
"path",
",",
"self",
".",
"project_id",
",",
")"
] | Returns the API url for storing events. | [
"Returns",
"the",
"API",
"url",
"for",
"storing",
"events",
"."
] | a1d77722bdce0b94660ebf50b5c4a4645916d084 | https://github.com/getsentry/sentry-python/blob/a1d77722bdce0b94660ebf50b5c4a4645916d084/sentry_sdk/utils.py#L182-L189 | train |
getsentry/sentry-python | sentry_sdk/utils.py | Auth.to_header | def to_header(self, timestamp=None):
"""Returns the auth header a string."""
rv = [("sentry_key", self.public_key), ("sentry_version", self.version)]
if timestamp is not None:
rv.append(("sentry_timestamp", str(to_timestamp(timestamp))))
if self.client is not None:
... | python | def to_header(self, timestamp=None):
"""Returns the auth header a string."""
rv = [("sentry_key", self.public_key), ("sentry_version", self.version)]
if timestamp is not None:
rv.append(("sentry_timestamp", str(to_timestamp(timestamp))))
if self.client is not None:
... | [
"def",
"to_header",
"(",
"self",
",",
"timestamp",
"=",
"None",
")",
":",
"rv",
"=",
"[",
"(",
"\"sentry_key\"",
",",
"self",
".",
"public_key",
")",
",",
"(",
"\"sentry_version\"",
",",
"self",
".",
"version",
")",
"]",
"if",
"timestamp",
"is",
"not",... | Returns the auth header a string. | [
"Returns",
"the",
"auth",
"header",
"a",
"string",
"."
] | a1d77722bdce0b94660ebf50b5c4a4645916d084 | https://github.com/getsentry/sentry-python/blob/a1d77722bdce0b94660ebf50b5c4a4645916d084/sentry_sdk/utils.py#L191-L200 | train |
abseil/abseil-py | absl/flags/_defines.py | _register_bounds_validator_if_needed | def _register_bounds_validator_if_needed(parser, name, flag_values):
"""Enforces lower and upper bounds for numeric flags.
Args:
parser: NumericParser (either FloatParser or IntegerParser), provides lower
and upper bounds, and help text to display.
name: str, name of the flag
flag_values: FlagV... | python | def _register_bounds_validator_if_needed(parser, name, flag_values):
"""Enforces lower and upper bounds for numeric flags.
Args:
parser: NumericParser (either FloatParser or IntegerParser), provides lower
and upper bounds, and help text to display.
name: str, name of the flag
flag_values: FlagV... | [
"def",
"_register_bounds_validator_if_needed",
"(",
"parser",
",",
"name",
",",
"flag_values",
")",
":",
"if",
"parser",
".",
"lower_bound",
"is",
"not",
"None",
"or",
"parser",
".",
"upper_bound",
"is",
"not",
"None",
":",
"def",
"checker",
"(",
"value",
")... | Enforces lower and upper bounds for numeric flags.
Args:
parser: NumericParser (either FloatParser or IntegerParser), provides lower
and upper bounds, and help text to display.
name: str, name of the flag
flag_values: FlagValues. | [
"Enforces",
"lower",
"and",
"upper",
"bounds",
"for",
"numeric",
"flags",
"."
] | 9d73fdaa23a6b6726aa5731390f388c0c6250ee5 | https://github.com/abseil/abseil-py/blob/9d73fdaa23a6b6726aa5731390f388c0c6250ee5/absl/flags/_defines.py#L39-L56 | train |
abseil/abseil-py | absl/flags/_defines.py | DEFINE | def DEFINE(parser, name, default, help, flag_values=_flagvalues.FLAGS, # pylint: disable=redefined-builtin,invalid-name
serializer=None, module_name=None, **args):
"""Registers a generic Flag object.
NOTE: in the docstrings of all DEFINE* functions, "registers" is short
for "creates a new flag and re... | python | def DEFINE(parser, name, default, help, flag_values=_flagvalues.FLAGS, # pylint: disable=redefined-builtin,invalid-name
serializer=None, module_name=None, **args):
"""Registers a generic Flag object.
NOTE: in the docstrings of all DEFINE* functions, "registers" is short
for "creates a new flag and re... | [
"def",
"DEFINE",
"(",
"parser",
",",
"name",
",",
"default",
",",
"help",
",",
"flag_values",
"=",
"_flagvalues",
".",
"FLAGS",
",",
"# pylint: disable=redefined-builtin,invalid-name",
"serializer",
"=",
"None",
",",
"module_name",
"=",
"None",
",",
"*",
"*",
... | Registers a generic Flag object.
NOTE: in the docstrings of all DEFINE* functions, "registers" is short
for "creates a new flag and registers it".
Auxiliary function: clients should use the specialized DEFINE_<type>
function instead.
Args:
parser: ArgumentParser, used to parse the flag arguments.
n... | [
"Registers",
"a",
"generic",
"Flag",
"object",
"."
] | 9d73fdaa23a6b6726aa5731390f388c0c6250ee5 | https://github.com/abseil/abseil-py/blob/9d73fdaa23a6b6726aa5731390f388c0c6250ee5/absl/flags/_defines.py#L59-L82 | train |
abseil/abseil-py | absl/flags/_defines.py | DEFINE_string | def DEFINE_string( # pylint: disable=invalid-name,redefined-builtin
name, default, help, flag_values=_flagvalues.FLAGS, **args):
"""Registers a flag whose value can be any string."""
parser = _argument_parser.ArgumentParser()
serializer = _argument_parser.ArgumentSerializer()
DEFINE(parser, name, default, ... | python | def DEFINE_string( # pylint: disable=invalid-name,redefined-builtin
name, default, help, flag_values=_flagvalues.FLAGS, **args):
"""Registers a flag whose value can be any string."""
parser = _argument_parser.ArgumentParser()
serializer = _argument_parser.ArgumentSerializer()
DEFINE(parser, name, default, ... | [
"def",
"DEFINE_string",
"(",
"# pylint: disable=invalid-name,redefined-builtin",
"name",
",",
"default",
",",
"help",
",",
"flag_values",
"=",
"_flagvalues",
".",
"FLAGS",
",",
"*",
"*",
"args",
")",
":",
"parser",
"=",
"_argument_parser",
".",
"ArgumentParser",
"... | Registers a flag whose value can be any string. | [
"Registers",
"a",
"flag",
"whose",
"value",
"can",
"be",
"any",
"string",
"."
] | 9d73fdaa23a6b6726aa5731390f388c0c6250ee5 | https://github.com/abseil/abseil-py/blob/9d73fdaa23a6b6726aa5731390f388c0c6250ee5/absl/flags/_defines.py#L236-L241 | train |
abseil/abseil-py | absl/flags/_defines.py | DEFINE_boolean | def DEFINE_boolean( # pylint: disable=invalid-name,redefined-builtin
name, default, help, flag_values=_flagvalues.FLAGS, module_name=None,
**args):
"""Registers a boolean flag.
Such a boolean flag does not take an argument. If a user wants to
specify a false value explicitly, the long option beginning ... | python | def DEFINE_boolean( # pylint: disable=invalid-name,redefined-builtin
name, default, help, flag_values=_flagvalues.FLAGS, module_name=None,
**args):
"""Registers a boolean flag.
Such a boolean flag does not take an argument. If a user wants to
specify a false value explicitly, the long option beginning ... | [
"def",
"DEFINE_boolean",
"(",
"# pylint: disable=invalid-name,redefined-builtin",
"name",
",",
"default",
",",
"help",
",",
"flag_values",
"=",
"_flagvalues",
".",
"FLAGS",
",",
"module_name",
"=",
"None",
",",
"*",
"*",
"args",
")",
":",
"DEFINE_flag",
"(",
"_f... | Registers a boolean flag.
Such a boolean flag does not take an argument. If a user wants to
specify a false value explicitly, the long option beginning with 'no'
must be used: i.e. --noflag
This flag will have a value of None, True or False. None is possible
if default=None and the user does not specify t... | [
"Registers",
"a",
"boolean",
"flag",
"."
] | 9d73fdaa23a6b6726aa5731390f388c0c6250ee5 | https://github.com/abseil/abseil-py/blob/9d73fdaa23a6b6726aa5731390f388c0c6250ee5/absl/flags/_defines.py#L244-L268 | train |
abseil/abseil-py | absl/flags/_defines.py | DEFINE_float | def DEFINE_float( # pylint: disable=invalid-name,redefined-builtin
name, default, help, lower_bound=None, upper_bound=None,
flag_values=_flagvalues.FLAGS, **args): # pylint: disable=invalid-name
"""Registers a flag whose value must be a float.
If lower_bound or upper_bound are set, then this flag must b... | python | def DEFINE_float( # pylint: disable=invalid-name,redefined-builtin
name, default, help, lower_bound=None, upper_bound=None,
flag_values=_flagvalues.FLAGS, **args): # pylint: disable=invalid-name
"""Registers a flag whose value must be a float.
If lower_bound or upper_bound are set, then this flag must b... | [
"def",
"DEFINE_float",
"(",
"# pylint: disable=invalid-name,redefined-builtin",
"name",
",",
"default",
",",
"help",
",",
"lower_bound",
"=",
"None",
",",
"upper_bound",
"=",
"None",
",",
"flag_values",
"=",
"_flagvalues",
".",
"FLAGS",
",",
"*",
"*",
"args",
")... | Registers a flag whose value must be a float.
If lower_bound or upper_bound are set, then this flag must be
within the given range.
Args:
name: str, the flag name.
default: float|str|None, the default value of the flag.
help: str, the help message.
lower_bound: float, min value of the flag.
... | [
"Registers",
"a",
"flag",
"whose",
"value",
"must",
"be",
"a",
"float",
"."
] | 9d73fdaa23a6b6726aa5731390f388c0c6250ee5 | https://github.com/abseil/abseil-py/blob/9d73fdaa23a6b6726aa5731390f388c0c6250ee5/absl/flags/_defines.py#L271-L292 | train |
abseil/abseil-py | absl/flags/_defines.py | DEFINE_integer | def DEFINE_integer( # pylint: disable=invalid-name,redefined-builtin
name, default, help, lower_bound=None, upper_bound=None,
flag_values=_flagvalues.FLAGS, **args):
"""Registers a flag whose value must be an integer.
If lower_bound, or upper_bound are set, then this flag must be
within the given range.... | python | def DEFINE_integer( # pylint: disable=invalid-name,redefined-builtin
name, default, help, lower_bound=None, upper_bound=None,
flag_values=_flagvalues.FLAGS, **args):
"""Registers a flag whose value must be an integer.
If lower_bound, or upper_bound are set, then this flag must be
within the given range.... | [
"def",
"DEFINE_integer",
"(",
"# pylint: disable=invalid-name,redefined-builtin",
"name",
",",
"default",
",",
"help",
",",
"lower_bound",
"=",
"None",
",",
"upper_bound",
"=",
"None",
",",
"flag_values",
"=",
"_flagvalues",
".",
"FLAGS",
",",
"*",
"*",
"args",
... | Registers a flag whose value must be an integer.
If lower_bound, or upper_bound are set, then this flag must be
within the given range.
Args:
name: str, the flag name.
default: int|str|None, the default value of the flag.
help: str, the help message.
lower_bound: int, min value of the flag.
... | [
"Registers",
"a",
"flag",
"whose",
"value",
"must",
"be",
"an",
"integer",
"."
] | 9d73fdaa23a6b6726aa5731390f388c0c6250ee5 | https://github.com/abseil/abseil-py/blob/9d73fdaa23a6b6726aa5731390f388c0c6250ee5/absl/flags/_defines.py#L295-L316 | train |
abseil/abseil-py | absl/flags/_defines.py | DEFINE_enum_class | def DEFINE_enum_class( # pylint: disable=invalid-name,redefined-builtin
name, default, enum_class, help, flag_values=_flagvalues.FLAGS,
module_name=None, **args):
"""Registers a flag whose value can be the name of enum members.
Args:
name: str, the flag name.
default: Enum|str|None, the default va... | python | def DEFINE_enum_class( # pylint: disable=invalid-name,redefined-builtin
name, default, enum_class, help, flag_values=_flagvalues.FLAGS,
module_name=None, **args):
"""Registers a flag whose value can be the name of enum members.
Args:
name: str, the flag name.
default: Enum|str|None, the default va... | [
"def",
"DEFINE_enum_class",
"(",
"# pylint: disable=invalid-name,redefined-builtin",
"name",
",",
"default",
",",
"enum_class",
",",
"help",
",",
"flag_values",
"=",
"_flagvalues",
".",
"FLAGS",
",",
"module_name",
"=",
"None",
",",
"*",
"*",
"args",
")",
":",
"... | Registers a flag whose value can be the name of enum members.
Args:
name: str, the flag name.
default: Enum|str|None, the default value of the flag.
enum_class: class, the Enum class with all the possible values for the flag.
help: str, the help message.
flag_values: FlagValues, the FlagValues in... | [
"Registers",
"a",
"flag",
"whose",
"value",
"can",
"be",
"the",
"name",
"of",
"enum",
"members",
"."
] | 9d73fdaa23a6b6726aa5731390f388c0c6250ee5 | https://github.com/abseil/abseil-py/blob/9d73fdaa23a6b6726aa5731390f388c0c6250ee5/absl/flags/_defines.py#L343-L360 | train |
abseil/abseil-py | absl/flags/_defines.py | DEFINE_spaceseplist | def DEFINE_spaceseplist( # pylint: disable=invalid-name,redefined-builtin
name, default, help, comma_compat=False, flag_values=_flagvalues.FLAGS,
**args):
"""Registers a flag whose value is a whitespace-separated list of strings.
Any whitespace can be used as a separator.
Args:
name: str, the flag ... | python | def DEFINE_spaceseplist( # pylint: disable=invalid-name,redefined-builtin
name, default, help, comma_compat=False, flag_values=_flagvalues.FLAGS,
**args):
"""Registers a flag whose value is a whitespace-separated list of strings.
Any whitespace can be used as a separator.
Args:
name: str, the flag ... | [
"def",
"DEFINE_spaceseplist",
"(",
"# pylint: disable=invalid-name,redefined-builtin",
"name",
",",
"default",
",",
"help",
",",
"comma_compat",
"=",
"False",
",",
"flag_values",
"=",
"_flagvalues",
".",
"FLAGS",
",",
"*",
"*",
"args",
")",
":",
"parser",
"=",
"... | Registers a flag whose value is a whitespace-separated list of strings.
Any whitespace can be used as a separator.
Args:
name: str, the flag name.
default: list|str|None, the default value of the flag.
help: str, the help message.
comma_compat: bool - Whether to support comma as an additional sepa... | [
"Registers",
"a",
"flag",
"whose",
"value",
"is",
"a",
"whitespace",
"-",
"separated",
"list",
"of",
"strings",
"."
] | 9d73fdaa23a6b6726aa5731390f388c0c6250ee5 | https://github.com/abseil/abseil-py/blob/9d73fdaa23a6b6726aa5731390f388c0c6250ee5/absl/flags/_defines.py#L383-L405 | train |
abseil/abseil-py | absl/flags/_defines.py | DEFINE_multi_enum | def DEFINE_multi_enum( # pylint: disable=invalid-name,redefined-builtin
name, default, enum_values, help, flag_values=_flagvalues.FLAGS,
case_sensitive=True, **args):
"""Registers a flag whose value can be a list strings from enum_values.
Use the flag on the command line multiple times to place multiple
... | python | def DEFINE_multi_enum( # pylint: disable=invalid-name,redefined-builtin
name, default, enum_values, help, flag_values=_flagvalues.FLAGS,
case_sensitive=True, **args):
"""Registers a flag whose value can be a list strings from enum_values.
Use the flag on the command line multiple times to place multiple
... | [
"def",
"DEFINE_multi_enum",
"(",
"# pylint: disable=invalid-name,redefined-builtin",
"name",
",",
"default",
",",
"enum_values",
",",
"help",
",",
"flag_values",
"=",
"_flagvalues",
".",
"FLAGS",
",",
"case_sensitive",
"=",
"True",
",",
"*",
"*",
"args",
")",
":",... | Registers a flag whose value can be a list strings from enum_values.
Use the flag on the command line multiple times to place multiple
enum values into the list. The 'default' may be a single string
(which will be converted into a single-element list) or a list of
strings.
Args:
name: str, the flag nam... | [
"Registers",
"a",
"flag",
"whose",
"value",
"can",
"be",
"a",
"list",
"strings",
"from",
"enum_values",
"."
] | 9d73fdaa23a6b6726aa5731390f388c0c6250ee5 | https://github.com/abseil/abseil-py/blob/9d73fdaa23a6b6726aa5731390f388c0c6250ee5/absl/flags/_defines.py#L519-L544 | train |
abseil/abseil-py | absl/flags/_defines.py | DEFINE_multi_enum_class | def DEFINE_multi_enum_class( # pylint: disable=invalid-name,redefined-builtin
name,
default,
enum_class,
help,
flag_values=_flagvalues.FLAGS,
module_name=None,
**args):
"""Registers a flag whose value can be a list of enum members.
Use the flag on the command line multiple times to pla... | python | def DEFINE_multi_enum_class( # pylint: disable=invalid-name,redefined-builtin
name,
default,
enum_class,
help,
flag_values=_flagvalues.FLAGS,
module_name=None,
**args):
"""Registers a flag whose value can be a list of enum members.
Use the flag on the command line multiple times to pla... | [
"def",
"DEFINE_multi_enum_class",
"(",
"# pylint: disable=invalid-name,redefined-builtin",
"name",
",",
"default",
",",
"enum_class",
",",
"help",
",",
"flag_values",
"=",
"_flagvalues",
".",
"FLAGS",
",",
"module_name",
"=",
"None",
",",
"*",
"*",
"args",
")",
":... | Registers a flag whose value can be a list of enum members.
Use the flag on the command line multiple times to place multiple
enum values into the list.
Args:
name: str, the flag name.
default: Union[Iterable[Enum], Iterable[Text], Enum, Text, None], the
default value of the flag; see
`D... | [
"Registers",
"a",
"flag",
"whose",
"value",
"can",
"be",
"a",
"list",
"of",
"enum",
"members",
"."
] | 9d73fdaa23a6b6726aa5731390f388c0c6250ee5 | https://github.com/abseil/abseil-py/blob/9d73fdaa23a6b6726aa5731390f388c0c6250ee5/absl/flags/_defines.py#L547-L579 | train |
abseil/abseil-py | absl/flags/_argument_parser.py | ArgumentParser.parse | def parse(self, argument):
"""Parses the string argument and returns the native value.
By default it returns its argument unmodified.
Args:
argument: string argument passed in the commandline.
Raises:
ValueError: Raised when it fails to parse the argument.
TypeError: Raised when the... | python | def parse(self, argument):
"""Parses the string argument and returns the native value.
By default it returns its argument unmodified.
Args:
argument: string argument passed in the commandline.
Raises:
ValueError: Raised when it fails to parse the argument.
TypeError: Raised when the... | [
"def",
"parse",
"(",
"self",
",",
"argument",
")",
":",
"if",
"not",
"isinstance",
"(",
"argument",
",",
"six",
".",
"string_types",
")",
":",
"raise",
"TypeError",
"(",
"'flag value must be a string, found \"{}\"'",
".",
"format",
"(",
"type",
"(",
"argument"... | Parses the string argument and returns the native value.
By default it returns its argument unmodified.
Args:
argument: string argument passed in the commandline.
Raises:
ValueError: Raised when it fails to parse the argument.
TypeError: Raised when the argument has the wrong type.
... | [
"Parses",
"the",
"string",
"argument",
"and",
"returns",
"the",
"native",
"value",
"."
] | 9d73fdaa23a6b6726aa5731390f388c0c6250ee5 | https://github.com/abseil/abseil-py/blob/9d73fdaa23a6b6726aa5731390f388c0c6250ee5/absl/flags/_argument_parser.py#L97-L115 | train |
abseil/abseil-py | absl/flags/_argument_parser.py | NumericParser.is_outside_bounds | def is_outside_bounds(self, val):
"""Returns whether the value is outside the bounds or not."""
return ((self.lower_bound is not None and val < self.lower_bound) or
(self.upper_bound is not None and val > self.upper_bound)) | python | def is_outside_bounds(self, val):
"""Returns whether the value is outside the bounds or not."""
return ((self.lower_bound is not None and val < self.lower_bound) or
(self.upper_bound is not None and val > self.upper_bound)) | [
"def",
"is_outside_bounds",
"(",
"self",
",",
"val",
")",
":",
"return",
"(",
"(",
"self",
".",
"lower_bound",
"is",
"not",
"None",
"and",
"val",
"<",
"self",
".",
"lower_bound",
")",
"or",
"(",
"self",
".",
"upper_bound",
"is",
"not",
"None",
"and",
... | Returns whether the value is outside the bounds or not. | [
"Returns",
"whether",
"the",
"value",
"is",
"outside",
"the",
"bounds",
"or",
"not",
"."
] | 9d73fdaa23a6b6726aa5731390f388c0c6250ee5 | https://github.com/abseil/abseil-py/blob/9d73fdaa23a6b6726aa5731390f388c0c6250ee5/absl/flags/_argument_parser.py#L145-L148 | train |
abseil/abseil-py | absl/flags/_argument_parser.py | FloatParser.convert | def convert(self, argument):
"""Returns the float value of argument."""
if (_is_integer_type(argument) or isinstance(argument, float) or
isinstance(argument, six.string_types)):
return float(argument)
else:
raise TypeError(
'Expect argument to be a string, int, or float, found ... | python | def convert(self, argument):
"""Returns the float value of argument."""
if (_is_integer_type(argument) or isinstance(argument, float) or
isinstance(argument, six.string_types)):
return float(argument)
else:
raise TypeError(
'Expect argument to be a string, int, or float, found ... | [
"def",
"convert",
"(",
"self",
",",
"argument",
")",
":",
"if",
"(",
"_is_integer_type",
"(",
"argument",
")",
"or",
"isinstance",
"(",
"argument",
",",
"float",
")",
"or",
"isinstance",
"(",
"argument",
",",
"six",
".",
"string_types",
")",
")",
":",
... | Returns the float value of argument. | [
"Returns",
"the",
"float",
"value",
"of",
"argument",
"."
] | 9d73fdaa23a6b6726aa5731390f388c0c6250ee5 | https://github.com/abseil/abseil-py/blob/9d73fdaa23a6b6726aa5731390f388c0c6250ee5/absl/flags/_argument_parser.py#L209-L217 | train |
abseil/abseil-py | absl/flags/_argument_parser.py | IntegerParser.convert | def convert(self, argument):
"""Returns the int value of argument."""
if _is_integer_type(argument):
return argument
elif isinstance(argument, six.string_types):
base = 10
if len(argument) > 2 and argument[0] == '0':
if argument[1] == 'o':
base = 8
elif argument[1... | python | def convert(self, argument):
"""Returns the int value of argument."""
if _is_integer_type(argument):
return argument
elif isinstance(argument, six.string_types):
base = 10
if len(argument) > 2 and argument[0] == '0':
if argument[1] == 'o':
base = 8
elif argument[1... | [
"def",
"convert",
"(",
"self",
",",
"argument",
")",
":",
"if",
"_is_integer_type",
"(",
"argument",
")",
":",
"return",
"argument",
"elif",
"isinstance",
"(",
"argument",
",",
"six",
".",
"string_types",
")",
":",
"base",
"=",
"10",
"if",
"len",
"(",
... | Returns the int value of argument. | [
"Returns",
"the",
"int",
"value",
"of",
"argument",
"."
] | 9d73fdaa23a6b6726aa5731390f388c0c6250ee5 | https://github.com/abseil/abseil-py/blob/9d73fdaa23a6b6726aa5731390f388c0c6250ee5/absl/flags/_argument_parser.py#L254-L268 | train |
abseil/abseil-py | absl/flags/_argument_parser.py | EnumClassParser.parse | def parse(self, argument):
"""Determines validity of argument and returns the correct element of enum.
Args:
argument: str or Enum class member, the supplied flag value.
Returns:
The first matching Enum class member in Enum class.
Raises:
ValueError: Raised when argument didn't matc... | python | def parse(self, argument):
"""Determines validity of argument and returns the correct element of enum.
Args:
argument: str or Enum class member, the supplied flag value.
Returns:
The first matching Enum class member in Enum class.
Raises:
ValueError: Raised when argument didn't matc... | [
"def",
"parse",
"(",
"self",
",",
"argument",
")",
":",
"if",
"isinstance",
"(",
"argument",
",",
"self",
".",
"enum_class",
")",
":",
"return",
"argument",
"if",
"argument",
"not",
"in",
"self",
".",
"enum_class",
".",
"__members__",
":",
"raise",
"Valu... | Determines validity of argument and returns the correct element of enum.
Args:
argument: str or Enum class member, the supplied flag value.
Returns:
The first matching Enum class member in Enum class.
Raises:
ValueError: Raised when argument didn't match anything in enum. | [
"Determines",
"validity",
"of",
"argument",
"and",
"returns",
"the",
"correct",
"element",
"of",
"enum",
"."
] | 9d73fdaa23a6b6726aa5731390f388c0c6250ee5 | https://github.com/abseil/abseil-py/blob/9d73fdaa23a6b6726aa5731390f388c0c6250ee5/absl/flags/_argument_parser.py#L380-L398 | train |
abseil/abseil-py | absl/flags/_argument_parser.py | ListParser.parse | def parse(self, argument):
"""Parses argument as comma-separated list of strings."""
if isinstance(argument, list):
return argument
elif not argument:
return []
else:
try:
return [s.strip() for s in list(csv.reader([argument], strict=True))[0]]
except csv.Error as e:
... | python | def parse(self, argument):
"""Parses argument as comma-separated list of strings."""
if isinstance(argument, list):
return argument
elif not argument:
return []
else:
try:
return [s.strip() for s in list(csv.reader([argument], strict=True))[0]]
except csv.Error as e:
... | [
"def",
"parse",
"(",
"self",
",",
"argument",
")",
":",
"if",
"isinstance",
"(",
"argument",
",",
"list",
")",
":",
"return",
"argument",
"elif",
"not",
"argument",
":",
"return",
"[",
"]",
"else",
":",
"try",
":",
"return",
"[",
"s",
".",
"strip",
... | Parses argument as comma-separated list of strings. | [
"Parses",
"argument",
"as",
"comma",
"-",
"separated",
"list",
"of",
"strings",
"."
] | 9d73fdaa23a6b6726aa5731390f388c0c6250ee5 | https://github.com/abseil/abseil-py/blob/9d73fdaa23a6b6726aa5731390f388c0c6250ee5/absl/flags/_argument_parser.py#L494-L510 | train |
abseil/abseil-py | absl/flags/_argument_parser.py | WhitespaceSeparatedListParser.parse | def parse(self, argument):
"""Parses argument as whitespace-separated list of strings.
It also parses argument as comma-separated list of strings if requested.
Args:
argument: string argument passed in the commandline.
Returns:
[str], the parsed flag value.
"""
if isinstance(argum... | python | def parse(self, argument):
"""Parses argument as whitespace-separated list of strings.
It also parses argument as comma-separated list of strings if requested.
Args:
argument: string argument passed in the commandline.
Returns:
[str], the parsed flag value.
"""
if isinstance(argum... | [
"def",
"parse",
"(",
"self",
",",
"argument",
")",
":",
"if",
"isinstance",
"(",
"argument",
",",
"list",
")",
":",
"return",
"argument",
"elif",
"not",
"argument",
":",
"return",
"[",
"]",
"else",
":",
"if",
"self",
".",
"_comma_compat",
":",
"argumen... | Parses argument as whitespace-separated list of strings.
It also parses argument as comma-separated list of strings if requested.
Args:
argument: string argument passed in the commandline.
Returns:
[str], the parsed flag value. | [
"Parses",
"argument",
"as",
"whitespace",
"-",
"separated",
"list",
"of",
"strings",
"."
] | 9d73fdaa23a6b6726aa5731390f388c0c6250ee5 | https://github.com/abseil/abseil-py/blob/9d73fdaa23a6b6726aa5731390f388c0c6250ee5/absl/flags/_argument_parser.py#L534-L552 | train |
abseil/abseil-py | absl/flags/_flagvalues.py | FlagValues.set_gnu_getopt | def set_gnu_getopt(self, gnu_getopt=True):
"""Sets whether or not to use GNU style scanning.
GNU style allows mixing of flag and non-flag arguments. See
http://docs.python.org/library/getopt.html#getopt.gnu_getopt
Args:
gnu_getopt: bool, whether or not to use GNU style scanning.
"""
self... | python | def set_gnu_getopt(self, gnu_getopt=True):
"""Sets whether or not to use GNU style scanning.
GNU style allows mixing of flag and non-flag arguments. See
http://docs.python.org/library/getopt.html#getopt.gnu_getopt
Args:
gnu_getopt: bool, whether or not to use GNU style scanning.
"""
self... | [
"def",
"set_gnu_getopt",
"(",
"self",
",",
"gnu_getopt",
"=",
"True",
")",
":",
"self",
".",
"__dict__",
"[",
"'__use_gnu_getopt'",
"]",
"=",
"gnu_getopt",
"self",
".",
"__dict__",
"[",
"'__use_gnu_getopt_explicitly_set'",
"]",
"=",
"True"
] | Sets whether or not to use GNU style scanning.
GNU style allows mixing of flag and non-flag arguments. See
http://docs.python.org/library/getopt.html#getopt.gnu_getopt
Args:
gnu_getopt: bool, whether or not to use GNU style scanning. | [
"Sets",
"whether",
"or",
"not",
"to",
"use",
"GNU",
"style",
"scanning",
"."
] | 9d73fdaa23a6b6726aa5731390f388c0c6250ee5 | https://github.com/abseil/abseil-py/blob/9d73fdaa23a6b6726aa5731390f388c0c6250ee5/absl/flags/_flagvalues.py#L126-L136 | train |
abseil/abseil-py | absl/flags/_flagvalues.py | FlagValues._assert_validators | def _assert_validators(self, validators):
"""Asserts if all validators in the list are satisfied.
It asserts validators in the order they were created.
Args:
validators: Iterable(validators.Validator), validators to be
verified.
Raises:
AttributeError: Raised if validators work w... | python | def _assert_validators(self, validators):
"""Asserts if all validators in the list are satisfied.
It asserts validators in the order they were created.
Args:
validators: Iterable(validators.Validator), validators to be
verified.
Raises:
AttributeError: Raised if validators work w... | [
"def",
"_assert_validators",
"(",
"self",
",",
"validators",
")",
":",
"for",
"validator",
"in",
"sorted",
"(",
"validators",
",",
"key",
"=",
"lambda",
"validator",
":",
"validator",
".",
"insertion_index",
")",
":",
"try",
":",
"validator",
".",
"verify",
... | Asserts if all validators in the list are satisfied.
It asserts validators in the order they were created.
Args:
validators: Iterable(validators.Validator), validators to be
verified.
Raises:
AttributeError: Raised if validators work with a non-existing flag.
IllegalFlagValueEr... | [
"Asserts",
"if",
"all",
"validators",
"in",
"the",
"list",
"are",
"satisfied",
"."
] | 9d73fdaa23a6b6726aa5731390f388c0c6250ee5 | https://github.com/abseil/abseil-py/blob/9d73fdaa23a6b6726aa5731390f388c0c6250ee5/absl/flags/_flagvalues.py#L512-L531 | train |
abseil/abseil-py | absl/flags/_flagvalues.py | FlagValues.set_default | def set_default(self, name, value):
"""Changes the default value of the named flag object.
The flag's current value is also updated if the flag is currently using
the default value, i.e. not specified in the command line, and not set
by FLAGS.name = value.
Args:
name: str, the name of the fl... | python | def set_default(self, name, value):
"""Changes the default value of the named flag object.
The flag's current value is also updated if the flag is currently using
the default value, i.e. not specified in the command line, and not set
by FLAGS.name = value.
Args:
name: str, the name of the fl... | [
"def",
"set_default",
"(",
"self",
",",
"name",
",",
"value",
")",
":",
"fl",
"=",
"self",
".",
"_flags",
"(",
")",
"if",
"name",
"not",
"in",
"fl",
":",
"self",
".",
"_set_unknown_flag",
"(",
"name",
",",
"value",
")",
"return",
"fl",
"[",
"name",... | Changes the default value of the named flag object.
The flag's current value is also updated if the flag is currently using
the default value, i.e. not specified in the command line, and not set
by FLAGS.name = value.
Args:
name: str, the name of the flag to modify.
value: The new default ... | [
"Changes",
"the",
"default",
"value",
"of",
"the",
"named",
"flag",
"object",
"."
] | 9d73fdaa23a6b6726aa5731390f388c0c6250ee5 | https://github.com/abseil/abseil-py/blob/9d73fdaa23a6b6726aa5731390f388c0c6250ee5/absl/flags/_flagvalues.py#L563-L583 | train |
abseil/abseil-py | absl/flags/_flagvalues.py | FlagValues.flag_values_dict | def flag_values_dict(self):
"""Returns a dictionary that maps flag names to flag values."""
return {name: flag.value for name, flag in six.iteritems(self._flags())} | python | def flag_values_dict(self):
"""Returns a dictionary that maps flag names to flag values."""
return {name: flag.value for name, flag in six.iteritems(self._flags())} | [
"def",
"flag_values_dict",
"(",
"self",
")",
":",
"return",
"{",
"name",
":",
"flag",
".",
"value",
"for",
"name",
",",
"flag",
"in",
"six",
".",
"iteritems",
"(",
"self",
".",
"_flags",
"(",
")",
")",
"}"
] | Returns a dictionary that maps flag names to flag values. | [
"Returns",
"a",
"dictionary",
"that",
"maps",
"flag",
"names",
"to",
"flag",
"values",
"."
] | 9d73fdaa23a6b6726aa5731390f388c0c6250ee5 | https://github.com/abseil/abseil-py/blob/9d73fdaa23a6b6726aa5731390f388c0c6250ee5/absl/flags/_flagvalues.py#L821-L823 | train |
abseil/abseil-py | absl/flags/_flagvalues.py | FlagValues.get_help | def get_help(self, prefix='', include_special_flags=True):
"""Returns a help string for all known flags.
Args:
prefix: str, per-line output prefix.
include_special_flags: bool, whether to include description of
SPECIAL_FLAGS, i.e. --flagfile and --undefok.
Returns:
str, formatted... | python | def get_help(self, prefix='', include_special_flags=True):
"""Returns a help string for all known flags.
Args:
prefix: str, per-line output prefix.
include_special_flags: bool, whether to include description of
SPECIAL_FLAGS, i.e. --flagfile and --undefok.
Returns:
str, formatted... | [
"def",
"get_help",
"(",
"self",
",",
"prefix",
"=",
"''",
",",
"include_special_flags",
"=",
"True",
")",
":",
"flags_by_module",
"=",
"self",
".",
"flags_by_module_dict",
"(",
")",
"if",
"flags_by_module",
":",
"modules",
"=",
"sorted",
"(",
"flags_by_module"... | Returns a help string for all known flags.
Args:
prefix: str, per-line output prefix.
include_special_flags: bool, whether to include description of
SPECIAL_FLAGS, i.e. --flagfile and --undefok.
Returns:
str, formatted help message. | [
"Returns",
"a",
"help",
"string",
"for",
"all",
"known",
"flags",
"."
] | 9d73fdaa23a6b6726aa5731390f388c0c6250ee5 | https://github.com/abseil/abseil-py/blob/9d73fdaa23a6b6726aa5731390f388c0c6250ee5/absl/flags/_flagvalues.py#L829-L857 | train |
abseil/abseil-py | absl/flags/_flagvalues.py | FlagValues._get_help_for_modules | def _get_help_for_modules(self, modules, prefix, include_special_flags):
"""Returns the help string for a list of modules.
Private to absl.flags package.
Args:
modules: List[str], a list of modules to get the help string for.
prefix: str, a string that is prepended to each generated help line.... | python | def _get_help_for_modules(self, modules, prefix, include_special_flags):
"""Returns the help string for a list of modules.
Private to absl.flags package.
Args:
modules: List[str], a list of modules to get the help string for.
prefix: str, a string that is prepended to each generated help line.... | [
"def",
"_get_help_for_modules",
"(",
"self",
",",
"modules",
",",
"prefix",
",",
"include_special_flags",
")",
":",
"output_lines",
"=",
"[",
"]",
"for",
"module",
"in",
"modules",
":",
"self",
".",
"_render_our_module_flags",
"(",
"module",
",",
"output_lines",... | Returns the help string for a list of modules.
Private to absl.flags package.
Args:
modules: List[str], a list of modules to get the help string for.
prefix: str, a string that is prepended to each generated help line.
include_special_flags: bool, whether to include description of
SP... | [
"Returns",
"the",
"help",
"string",
"for",
"a",
"list",
"of",
"modules",
"."
] | 9d73fdaa23a6b6726aa5731390f388c0c6250ee5 | https://github.com/abseil/abseil-py/blob/9d73fdaa23a6b6726aa5731390f388c0c6250ee5/absl/flags/_flagvalues.py#L859-L879 | train |
abseil/abseil-py | absl/flags/_flagvalues.py | FlagValues._render_our_module_key_flags | def _render_our_module_key_flags(self, module, output_lines, prefix=''):
"""Returns a help string for the key flags of a given module.
Args:
module: module|str, the module to render key flags for.
output_lines: [str], a list of strings. The generated help message
lines will be appended t... | python | def _render_our_module_key_flags(self, module, output_lines, prefix=''):
"""Returns a help string for the key flags of a given module.
Args:
module: module|str, the module to render key flags for.
output_lines: [str], a list of strings. The generated help message
lines will be appended t... | [
"def",
"_render_our_module_key_flags",
"(",
"self",
",",
"module",
",",
"output_lines",
",",
"prefix",
"=",
"''",
")",
":",
"key_flags",
"=",
"self",
".",
"get_key_flags_for_module",
"(",
"module",
")",
"if",
"key_flags",
":",
"self",
".",
"_render_module_flags"... | Returns a help string for the key flags of a given module.
Args:
module: module|str, the module to render key flags for.
output_lines: [str], a list of strings. The generated help message
lines will be appended to this list.
prefix: str, a string that is prepended to each generated hel... | [
"Returns",
"a",
"help",
"string",
"for",
"the",
"key",
"flags",
"of",
"a",
"given",
"module",
"."
] | 9d73fdaa23a6b6726aa5731390f388c0c6250ee5 | https://github.com/abseil/abseil-py/blob/9d73fdaa23a6b6726aa5731390f388c0c6250ee5/absl/flags/_flagvalues.py#L894-L905 | train |
abseil/abseil-py | absl/flags/_flagvalues.py | FlagValues.module_help | def module_help(self, module):
"""Describes the key flags of a module.
Args:
module: module|str, the module to describe the key flags for.
Returns:
str, describing the key flags of a module.
"""
helplist = []
self._render_our_module_key_flags(module, helplist)
return '\n'.join(... | python | def module_help(self, module):
"""Describes the key flags of a module.
Args:
module: module|str, the module to describe the key flags for.
Returns:
str, describing the key flags of a module.
"""
helplist = []
self._render_our_module_key_flags(module, helplist)
return '\n'.join(... | [
"def",
"module_help",
"(",
"self",
",",
"module",
")",
":",
"helplist",
"=",
"[",
"]",
"self",
".",
"_render_our_module_key_flags",
"(",
"module",
",",
"helplist",
")",
"return",
"'\\n'",
".",
"join",
"(",
"helplist",
")"
] | Describes the key flags of a module.
Args:
module: module|str, the module to describe the key flags for.
Returns:
str, describing the key flags of a module. | [
"Describes",
"the",
"key",
"flags",
"of",
"a",
"module",
"."
] | 9d73fdaa23a6b6726aa5731390f388c0c6250ee5 | https://github.com/abseil/abseil-py/blob/9d73fdaa23a6b6726aa5731390f388c0c6250ee5/absl/flags/_flagvalues.py#L907-L918 | train |
abseil/abseil-py | absl/flags/_flagvalues.py | FlagValues.write_help_in_xml_format | def write_help_in_xml_format(self, outfile=None):
"""Outputs flag documentation in XML format.
NOTE: We use element names that are consistent with those used by
the C++ command-line flag library, from
https://github.com/gflags/gflags.
We also use a few new elements (e.g., <key>), but we do not
... | python | def write_help_in_xml_format(self, outfile=None):
"""Outputs flag documentation in XML format.
NOTE: We use element names that are consistent with those used by
the C++ command-line flag library, from
https://github.com/gflags/gflags.
We also use a few new elements (e.g., <key>), but we do not
... | [
"def",
"write_help_in_xml_format",
"(",
"self",
",",
"outfile",
"=",
"None",
")",
":",
"doc",
"=",
"minidom",
".",
"Document",
"(",
")",
"all_flag",
"=",
"doc",
".",
"createElement",
"(",
"'AllFlags'",
")",
"doc",
".",
"appendChild",
"(",
"all_flag",
")",
... | Outputs flag documentation in XML format.
NOTE: We use element names that are consistent with those used by
the C++ command-line flag library, from
https://github.com/gflags/gflags.
We also use a few new elements (e.g., <key>), but we do not
interfere / overlap with existing XML elements used by th... | [
"Outputs",
"flag",
"documentation",
"in",
"XML",
"format",
"."
] | 9d73fdaa23a6b6726aa5731390f388c0c6250ee5 | https://github.com/abseil/abseil-py/blob/9d73fdaa23a6b6726aa5731390f388c0c6250ee5/absl/flags/_flagvalues.py#L1206-L1255 | train |
abseil/abseil-py | absl/logging/converter.py | absl_to_cpp | def absl_to_cpp(level):
"""Converts an absl log level to a cpp log level.
Args:
level: int, an absl.logging level.
Raises:
TypeError: Raised when level is not an integer.
Returns:
The corresponding integer level for use in Abseil C++.
"""
if not isinstance(level, int):
raise TypeError('Ex... | python | def absl_to_cpp(level):
"""Converts an absl log level to a cpp log level.
Args:
level: int, an absl.logging level.
Raises:
TypeError: Raised when level is not an integer.
Returns:
The corresponding integer level for use in Abseil C++.
"""
if not isinstance(level, int):
raise TypeError('Ex... | [
"def",
"absl_to_cpp",
"(",
"level",
")",
":",
"if",
"not",
"isinstance",
"(",
"level",
",",
"int",
")",
":",
"raise",
"TypeError",
"(",
"'Expect an int level, found {}'",
".",
"format",
"(",
"type",
"(",
"level",
")",
")",
")",
"if",
"level",
">=",
"0",
... | Converts an absl log level to a cpp log level.
Args:
level: int, an absl.logging level.
Raises:
TypeError: Raised when level is not an integer.
Returns:
The corresponding integer level for use in Abseil C++. | [
"Converts",
"an",
"absl",
"log",
"level",
"to",
"a",
"cpp",
"log",
"level",
"."
] | 9d73fdaa23a6b6726aa5731390f388c0c6250ee5 | https://github.com/abseil/abseil-py/blob/9d73fdaa23a6b6726aa5731390f388c0c6250ee5/absl/logging/converter.py#L117-L135 | train |
abseil/abseil-py | absl/logging/converter.py | absl_to_standard | def absl_to_standard(level):
"""Converts an integer level from the absl value to the standard value.
Args:
level: int, an absl.logging level.
Raises:
TypeError: Raised when level is not an integer.
Returns:
The corresponding integer level for use in standard logging.
"""
if not isinstance(lev... | python | def absl_to_standard(level):
"""Converts an integer level from the absl value to the standard value.
Args:
level: int, an absl.logging level.
Raises:
TypeError: Raised when level is not an integer.
Returns:
The corresponding integer level for use in standard logging.
"""
if not isinstance(lev... | [
"def",
"absl_to_standard",
"(",
"level",
")",
":",
"if",
"not",
"isinstance",
"(",
"level",
",",
"int",
")",
":",
"raise",
"TypeError",
"(",
"'Expect an int level, found {}'",
".",
"format",
"(",
"type",
"(",
"level",
")",
")",
")",
"if",
"level",
"<",
"... | Converts an integer level from the absl value to the standard value.
Args:
level: int, an absl.logging level.
Raises:
TypeError: Raised when level is not an integer.
Returns:
The corresponding integer level for use in standard logging. | [
"Converts",
"an",
"integer",
"level",
"from",
"the",
"absl",
"value",
"to",
"the",
"standard",
"value",
"."
] | 9d73fdaa23a6b6726aa5731390f388c0c6250ee5 | https://github.com/abseil/abseil-py/blob/9d73fdaa23a6b6726aa5731390f388c0c6250ee5/absl/logging/converter.py#L138-L157 | train |
abseil/abseil-py | absl/logging/converter.py | standard_to_absl | def standard_to_absl(level):
"""Converts an integer level from the standard value to the absl value.
Args:
level: int, a Python standard logging level.
Raises:
TypeError: Raised when level is not an integer.
Returns:
The corresponding integer level for use in absl logging.
"""
if not isinstan... | python | def standard_to_absl(level):
"""Converts an integer level from the standard value to the absl value.
Args:
level: int, a Python standard logging level.
Raises:
TypeError: Raised when level is not an integer.
Returns:
The corresponding integer level for use in absl logging.
"""
if not isinstan... | [
"def",
"standard_to_absl",
"(",
"level",
")",
":",
"if",
"not",
"isinstance",
"(",
"level",
",",
"int",
")",
":",
"raise",
"TypeError",
"(",
"'Expect an int level, found {}'",
".",
"format",
"(",
"type",
"(",
"level",
")",
")",
")",
"if",
"level",
"<",
"... | Converts an integer level from the standard value to the absl value.
Args:
level: int, a Python standard logging level.
Raises:
TypeError: Raised when level is not an integer.
Returns:
The corresponding integer level for use in absl logging. | [
"Converts",
"an",
"integer",
"level",
"from",
"the",
"standard",
"value",
"to",
"the",
"absl",
"value",
"."
] | 9d73fdaa23a6b6726aa5731390f388c0c6250ee5 | https://github.com/abseil/abseil-py/blob/9d73fdaa23a6b6726aa5731390f388c0c6250ee5/absl/logging/converter.py#L172-L200 | train |
abseil/abseil-py | absl/app.py | parse_flags_with_usage | def parse_flags_with_usage(args):
"""Tries to parse the flags, print usage, and exit if unparseable.
Args:
args: [str], a non-empty list of the command line arguments including
program name.
Returns:
[str], a non-empty list of remaining command line arguments after parsing
flags, including p... | python | def parse_flags_with_usage(args):
"""Tries to parse the flags, print usage, and exit if unparseable.
Args:
args: [str], a non-empty list of the command line arguments including
program name.
Returns:
[str], a non-empty list of remaining command line arguments after parsing
flags, including p... | [
"def",
"parse_flags_with_usage",
"(",
"args",
")",
":",
"try",
":",
"return",
"FLAGS",
"(",
"args",
")",
"except",
"flags",
".",
"Error",
"as",
"error",
":",
"sys",
".",
"stderr",
".",
"write",
"(",
"'FATAL Flags parsing error: %s\\n'",
"%",
"error",
")",
... | Tries to parse the flags, print usage, and exit if unparseable.
Args:
args: [str], a non-empty list of the command line arguments including
program name.
Returns:
[str], a non-empty list of remaining command line arguments after parsing
flags, including program name. | [
"Tries",
"to",
"parse",
"the",
"flags",
"print",
"usage",
"and",
"exit",
"if",
"unparseable",
"."
] | 9d73fdaa23a6b6726aa5731390f388c0c6250ee5 | https://github.com/abseil/abseil-py/blob/9d73fdaa23a6b6726aa5731390f388c0c6250ee5/absl/app.py#L147-L163 | train |
abseil/abseil-py | absl/app.py | define_help_flags | def define_help_flags():
"""Registers help flags. Idempotent."""
# Use a global to ensure idempotence.
global _define_help_flags_called
if not _define_help_flags_called:
flags.DEFINE_flag(HelpFlag())
flags.DEFINE_flag(HelpshortFlag()) # alias for --help
flags.DEFINE_flag(HelpfullFlag())
flags.... | python | def define_help_flags():
"""Registers help flags. Idempotent."""
# Use a global to ensure idempotence.
global _define_help_flags_called
if not _define_help_flags_called:
flags.DEFINE_flag(HelpFlag())
flags.DEFINE_flag(HelpshortFlag()) # alias for --help
flags.DEFINE_flag(HelpfullFlag())
flags.... | [
"def",
"define_help_flags",
"(",
")",
":",
"# Use a global to ensure idempotence.",
"global",
"_define_help_flags_called",
"if",
"not",
"_define_help_flags_called",
":",
"flags",
".",
"DEFINE_flag",
"(",
"HelpFlag",
"(",
")",
")",
"flags",
".",
"DEFINE_flag",
"(",
"He... | Registers help flags. Idempotent. | [
"Registers",
"help",
"flags",
".",
"Idempotent",
"."
] | 9d73fdaa23a6b6726aa5731390f388c0c6250ee5 | https://github.com/abseil/abseil-py/blob/9d73fdaa23a6b6726aa5731390f388c0c6250ee5/absl/app.py#L169-L179 | train |
abseil/abseil-py | absl/app.py | _register_and_parse_flags_with_usage | def _register_and_parse_flags_with_usage(
argv=None,
flags_parser=parse_flags_with_usage,
):
"""Registers help flags, parses arguments and shows usage if appropriate.
This also calls sys.exit(0) if flag --only_check_args is True.
Args:
argv: [str], a non-empty list of the command line arguments incl... | python | def _register_and_parse_flags_with_usage(
argv=None,
flags_parser=parse_flags_with_usage,
):
"""Registers help flags, parses arguments and shows usage if appropriate.
This also calls sys.exit(0) if flag --only_check_args is True.
Args:
argv: [str], a non-empty list of the command line arguments incl... | [
"def",
"_register_and_parse_flags_with_usage",
"(",
"argv",
"=",
"None",
",",
"flags_parser",
"=",
"parse_flags_with_usage",
",",
")",
":",
"if",
"_register_and_parse_flags_with_usage",
".",
"done",
":",
"raise",
"SystemError",
"(",
"'Flag registration can be done only once... | Registers help flags, parses arguments and shows usage if appropriate.
This also calls sys.exit(0) if flag --only_check_args is True.
Args:
argv: [str], a non-empty list of the command line arguments including
program name, sys.argv is used if None.
flags_parser: Callable[[List[Text]], Any], the f... | [
"Registers",
"help",
"flags",
"parses",
"arguments",
"and",
"shows",
"usage",
"if",
"appropriate",
"."
] | 9d73fdaa23a6b6726aa5731390f388c0c6250ee5 | https://github.com/abseil/abseil-py/blob/9d73fdaa23a6b6726aa5731390f388c0c6250ee5/absl/app.py#L182-L226 | train |
abseil/abseil-py | absl/app.py | _run_main | def _run_main(main, argv):
"""Calls main, optionally with pdb or profiler."""
if FLAGS.run_with_pdb:
sys.exit(pdb.runcall(main, argv))
elif FLAGS.run_with_profiling or FLAGS.profile_file:
# Avoid import overhead since most apps (including performance-sensitive
# ones) won't be run with profiling.
... | python | def _run_main(main, argv):
"""Calls main, optionally with pdb or profiler."""
if FLAGS.run_with_pdb:
sys.exit(pdb.runcall(main, argv))
elif FLAGS.run_with_profiling or FLAGS.profile_file:
# Avoid import overhead since most apps (including performance-sensitive
# ones) won't be run with profiling.
... | [
"def",
"_run_main",
"(",
"main",
",",
"argv",
")",
":",
"if",
"FLAGS",
".",
"run_with_pdb",
":",
"sys",
".",
"exit",
"(",
"pdb",
".",
"runcall",
"(",
"main",
",",
"argv",
")",
")",
"elif",
"FLAGS",
".",
"run_with_profiling",
"or",
"FLAGS",
".",
"prof... | Calls main, optionally with pdb or profiler. | [
"Calls",
"main",
"optionally",
"with",
"pdb",
"or",
"profiler",
"."
] | 9d73fdaa23a6b6726aa5731390f388c0c6250ee5 | https://github.com/abseil/abseil-py/blob/9d73fdaa23a6b6726aa5731390f388c0c6250ee5/absl/app.py#L231-L251 | train |
abseil/abseil-py | absl/app.py | _call_exception_handlers | def _call_exception_handlers(exception):
"""Calls any installed exception handlers."""
for handler in EXCEPTION_HANDLERS:
try:
if handler.wants(exception):
handler.handle(exception)
except: # pylint: disable=bare-except
try:
# We don't want to stop for exceptions in the exceptio... | python | def _call_exception_handlers(exception):
"""Calls any installed exception handlers."""
for handler in EXCEPTION_HANDLERS:
try:
if handler.wants(exception):
handler.handle(exception)
except: # pylint: disable=bare-except
try:
# We don't want to stop for exceptions in the exceptio... | [
"def",
"_call_exception_handlers",
"(",
"exception",
")",
":",
"for",
"handler",
"in",
"EXCEPTION_HANDLERS",
":",
"try",
":",
"if",
"handler",
".",
"wants",
"(",
"exception",
")",
":",
"handler",
".",
"handle",
"(",
"exception",
")",
"except",
":",
"# pylint... | Calls any installed exception handlers. | [
"Calls",
"any",
"installed",
"exception",
"handlers",
"."
] | 9d73fdaa23a6b6726aa5731390f388c0c6250ee5 | https://github.com/abseil/abseil-py/blob/9d73fdaa23a6b6726aa5731390f388c0c6250ee5/absl/app.py#L254-L267 | train |
abseil/abseil-py | absl/app.py | run | def run(
main,
argv=None,
flags_parser=parse_flags_with_usage,
):
"""Begins executing the program.
Args:
main: The main function to execute. It takes an single argument "argv",
which is a list of command line arguments with parsed flags removed.
If it returns an integer, it is used ... | python | def run(
main,
argv=None,
flags_parser=parse_flags_with_usage,
):
"""Begins executing the program.
Args:
main: The main function to execute. It takes an single argument "argv",
which is a list of command line arguments with parsed flags removed.
If it returns an integer, it is used ... | [
"def",
"run",
"(",
"main",
",",
"argv",
"=",
"None",
",",
"flags_parser",
"=",
"parse_flags_with_usage",
",",
")",
":",
"try",
":",
"args",
"=",
"_run_init",
"(",
"sys",
".",
"argv",
"if",
"argv",
"is",
"None",
"else",
"argv",
",",
"flags_parser",
",",... | Begins executing the program.
Args:
main: The main function to execute. It takes an single argument "argv",
which is a list of command line arguments with parsed flags removed.
If it returns an integer, it is used as the process's exit code.
argv: A non-empty list of the command line argument... | [
"Begins",
"executing",
"the",
"program",
"."
] | 9d73fdaa23a6b6726aa5731390f388c0c6250ee5 | https://github.com/abseil/abseil-py/blob/9d73fdaa23a6b6726aa5731390f388c0c6250ee5/absl/app.py#L270-L310 | train |
abseil/abseil-py | absl/app.py | _run_init | def _run_init(
argv,
flags_parser,
):
"""Does one-time initialization and re-parses flags on rerun."""
if _run_init.done:
return flags_parser(argv)
command_name.make_process_name_useful()
# Set up absl logging handler.
logging.use_absl_handler()
args = _register_and_parse_flags_with_usage(
... | python | def _run_init(
argv,
flags_parser,
):
"""Does one-time initialization and re-parses flags on rerun."""
if _run_init.done:
return flags_parser(argv)
command_name.make_process_name_useful()
# Set up absl logging handler.
logging.use_absl_handler()
args = _register_and_parse_flags_with_usage(
... | [
"def",
"_run_init",
"(",
"argv",
",",
"flags_parser",
",",
")",
":",
"if",
"_run_init",
".",
"done",
":",
"return",
"flags_parser",
"(",
"argv",
")",
"command_name",
".",
"make_process_name_useful",
"(",
")",
"# Set up absl logging handler.",
"logging",
".",
"us... | Does one-time initialization and re-parses flags on rerun. | [
"Does",
"one",
"-",
"time",
"initialization",
"and",
"re",
"-",
"parses",
"flags",
"on",
"rerun",
"."
] | 9d73fdaa23a6b6726aa5731390f388c0c6250ee5 | https://github.com/abseil/abseil-py/blob/9d73fdaa23a6b6726aa5731390f388c0c6250ee5/absl/app.py#L339-L361 | train |
abseil/abseil-py | absl/app.py | install_exception_handler | def install_exception_handler(handler):
"""Installs an exception handler.
Args:
handler: ExceptionHandler, the exception handler to install.
Raises:
TypeError: Raised when the handler was not of the correct type.
All installed exception handlers will be called if main() exits via
an abnormal except... | python | def install_exception_handler(handler):
"""Installs an exception handler.
Args:
handler: ExceptionHandler, the exception handler to install.
Raises:
TypeError: Raised when the handler was not of the correct type.
All installed exception handlers will be called if main() exits via
an abnormal except... | [
"def",
"install_exception_handler",
"(",
"handler",
")",
":",
"if",
"not",
"isinstance",
"(",
"handler",
",",
"ExceptionHandler",
")",
":",
"raise",
"TypeError",
"(",
"'handler of type %s does not inherit from ExceptionHandler'",
"%",
"type",
"(",
"handler",
")",
")",... | Installs an exception handler.
Args:
handler: ExceptionHandler, the exception handler to install.
Raises:
TypeError: Raised when the handler was not of the correct type.
All installed exception handlers will be called if main() exits via
an abnormal exception, i.e. not one of SystemExit, KeyboardInte... | [
"Installs",
"an",
"exception",
"handler",
"."
] | 9d73fdaa23a6b6726aa5731390f388c0c6250ee5 | https://github.com/abseil/abseil-py/blob/9d73fdaa23a6b6726aa5731390f388c0c6250ee5/absl/app.py#L444-L460 | train |
abseil/abseil-py | absl/flags/_validators.py | register_validator | def register_validator(flag_name,
checker,
message='Flag validation failed',
flag_values=_flagvalues.FLAGS):
"""Adds a constraint, which will be enforced during program execution.
The constraint is validated when flags are initially parsed, and a... | python | def register_validator(flag_name,
checker,
message='Flag validation failed',
flag_values=_flagvalues.FLAGS):
"""Adds a constraint, which will be enforced during program execution.
The constraint is validated when flags are initially parsed, and a... | [
"def",
"register_validator",
"(",
"flag_name",
",",
"checker",
",",
"message",
"=",
"'Flag validation failed'",
",",
"flag_values",
"=",
"_flagvalues",
".",
"FLAGS",
")",
":",
"v",
"=",
"SingleFlagValidator",
"(",
"flag_name",
",",
"checker",
",",
"message",
")"... | Adds a constraint, which will be enforced during program execution.
The constraint is validated when flags are initially parsed, and after each
change of the corresponding flag's value.
Args:
flag_name: str, name of the flag to be checked.
checker: callable, a function to validate the flag.
input... | [
"Adds",
"a",
"constraint",
"which",
"will",
"be",
"enforced",
"during",
"program",
"execution",
"."
] | 9d73fdaa23a6b6726aa5731390f388c0c6250ee5 | https://github.com/abseil/abseil-py/blob/9d73fdaa23a6b6726aa5731390f388c0c6250ee5/absl/flags/_validators.py#L196-L223 | train |
abseil/abseil-py | absl/flags/_validators.py | validator | def validator(flag_name, message='Flag validation failed',
flag_values=_flagvalues.FLAGS):
"""A function decorator for defining a flag validator.
Registers the decorated function as a validator for flag_name, e.g.
@flags.validator('foo')
def _CheckFoo(foo):
...
See register_validator() fo... | python | def validator(flag_name, message='Flag validation failed',
flag_values=_flagvalues.FLAGS):
"""A function decorator for defining a flag validator.
Registers the decorated function as a validator for flag_name, e.g.
@flags.validator('foo')
def _CheckFoo(foo):
...
See register_validator() fo... | [
"def",
"validator",
"(",
"flag_name",
",",
"message",
"=",
"'Flag validation failed'",
",",
"flag_values",
"=",
"_flagvalues",
".",
"FLAGS",
")",
":",
"def",
"decorate",
"(",
"function",
")",
":",
"register_validator",
"(",
"flag_name",
",",
"function",
",",
"... | A function decorator for defining a flag validator.
Registers the decorated function as a validator for flag_name, e.g.
@flags.validator('foo')
def _CheckFoo(foo):
...
See register_validator() for the specification of checker function.
Args:
flag_name: str, name of the flag to be checked.
mess... | [
"A",
"function",
"decorator",
"for",
"defining",
"a",
"flag",
"validator",
"."
] | 9d73fdaa23a6b6726aa5731390f388c0c6250ee5 | https://github.com/abseil/abseil-py/blob/9d73fdaa23a6b6726aa5731390f388c0c6250ee5/absl/flags/_validators.py#L226-L257 | train |
abseil/abseil-py | absl/flags/_validators.py | mark_flags_as_required | def mark_flags_as_required(flag_names, flag_values=_flagvalues.FLAGS):
"""Ensures that flags are not None during program execution.
Recommended usage:
if __name__ == '__main__':
flags.mark_flags_as_required(['flag1', 'flag2', 'flag3'])
app.run()
Args:
flag_names: Sequence[str], names of the... | python | def mark_flags_as_required(flag_names, flag_values=_flagvalues.FLAGS):
"""Ensures that flags are not None during program execution.
Recommended usage:
if __name__ == '__main__':
flags.mark_flags_as_required(['flag1', 'flag2', 'flag3'])
app.run()
Args:
flag_names: Sequence[str], names of the... | [
"def",
"mark_flags_as_required",
"(",
"flag_names",
",",
"flag_values",
"=",
"_flagvalues",
".",
"FLAGS",
")",
":",
"for",
"flag_name",
"in",
"flag_names",
":",
"mark_flag_as_required",
"(",
"flag_name",
",",
"flag_values",
")"
] | Ensures that flags are not None during program execution.
Recommended usage:
if __name__ == '__main__':
flags.mark_flags_as_required(['flag1', 'flag2', 'flag3'])
app.run()
Args:
flag_names: Sequence[str], names of the flags.
flag_values: flags.FlagValues, optional FlagValues instance wher... | [
"Ensures",
"that",
"flags",
"are",
"not",
"None",
"during",
"program",
"execution",
"."
] | 9d73fdaa23a6b6726aa5731390f388c0c6250ee5 | https://github.com/abseil/abseil-py/blob/9d73fdaa23a6b6726aa5731390f388c0c6250ee5/absl/flags/_validators.py#L367-L384 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.