partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
valid | Channel.send_maps | Sends a request to the server containing maps (dicts). | hangups/channel.py | async def send_maps(self, map_list):
"""Sends a request to the server containing maps (dicts)."""
params = {
'VER': 8, # channel protocol version
'RID': 81188, # request identifier
'ctype': 'hangouts', # client type
}
if self._gsessionid_param is no... | async def send_maps(self, map_list):
"""Sends a request to the server containing maps (dicts)."""
params = {
'VER': 8, # channel protocol version
'RID': 81188, # request identifier
'ctype': 'hangouts', # client type
}
if self._gsessionid_param is no... | [
"Sends",
"a",
"request",
"to",
"the",
"server",
"containing",
"maps",
"(",
"dicts",
")",
"."
] | tdryer/hangups | python | https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/channel.py#L217-L235 | [
"async",
"def",
"send_maps",
"(",
"self",
",",
"map_list",
")",
":",
"params",
"=",
"{",
"'VER'",
":",
"8",
",",
"# channel protocol version",
"'RID'",
":",
"81188",
",",
"# request identifier",
"'ctype'",
":",
"'hangouts'",
",",
"# client type",
"}",
"if",
... | 85c0bf0a57698d077461283895707260f9dbf931 |
valid | Channel._fetch_channel_sid | Creates a new channel for receiving push data.
Sending an empty forward channel request will create a new channel on
the server.
There's a separate API to get the gsessionid alone that Hangouts for
Chrome uses, but if we don't send a gsessionid with this request, it
will return... | hangups/channel.py | async def _fetch_channel_sid(self):
"""Creates a new channel for receiving push data.
Sending an empty forward channel request will create a new channel on
the server.
There's a separate API to get the gsessionid alone that Hangouts for
Chrome uses, but if we don't send a gsess... | async def _fetch_channel_sid(self):
"""Creates a new channel for receiving push data.
Sending an empty forward channel request will create a new channel on
the server.
There's a separate API to get the gsessionid alone that Hangouts for
Chrome uses, but if we don't send a gsess... | [
"Creates",
"a",
"new",
"channel",
"for",
"receiving",
"push",
"data",
"."
] | tdryer/hangups | python | https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/channel.py#L241-L260 | [
"async",
"def",
"_fetch_channel_sid",
"(",
"self",
")",
":",
"logger",
".",
"info",
"(",
"'Requesting new gsessionid and SID...'",
")",
"# Set SID and gsessionid to None so they aren't sent in by send_maps.",
"self",
".",
"_sid_param",
"=",
"None",
"self",
".",
"_gsessionid... | 85c0bf0a57698d077461283895707260f9dbf931 |
valid | Channel._longpoll_request | Open a long-polling request and receive arrays.
This method uses keep-alive to make re-opening the request faster, but
the remote server will set the "Connection: close" header once an hour.
Raises hangups.NetworkError or ChannelSessionError. | hangups/channel.py | async def _longpoll_request(self):
"""Open a long-polling request and receive arrays.
This method uses keep-alive to make re-opening the request faster, but
the remote server will set the "Connection: close" header once an hour.
Raises hangups.NetworkError or ChannelSessionError.
... | async def _longpoll_request(self):
"""Open a long-polling request and receive arrays.
This method uses keep-alive to make re-opening the request faster, but
the remote server will set the "Connection: close" header once an hour.
Raises hangups.NetworkError or ChannelSessionError.
... | [
"Open",
"a",
"long",
"-",
"polling",
"request",
"and",
"receive",
"arrays",
"."
] | tdryer/hangups | python | https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/channel.py#L262-L308 | [
"async",
"def",
"_longpoll_request",
"(",
"self",
")",
":",
"params",
"=",
"{",
"'VER'",
":",
"8",
",",
"# channel protocol version",
"'gsessionid'",
":",
"self",
".",
"_gsessionid_param",
",",
"'RID'",
":",
"'rpc'",
",",
"# request identifier",
"'t'",
":",
"1... | 85c0bf0a57698d077461283895707260f9dbf931 |
valid | Channel._on_push_data | Parse push data and trigger events. | hangups/channel.py | async def _on_push_data(self, data_bytes):
"""Parse push data and trigger events."""
logger.debug('Received chunk:\n{}'.format(data_bytes))
for chunk in self._chunk_parser.get_chunks(data_bytes):
# Consider the channel connected once the first chunk is received.
if not s... | async def _on_push_data(self, data_bytes):
"""Parse push data and trigger events."""
logger.debug('Received chunk:\n{}'.format(data_bytes))
for chunk in self._chunk_parser.get_chunks(data_bytes):
# Consider the channel connected once the first chunk is received.
if not s... | [
"Parse",
"push",
"data",
"and",
"trigger",
"events",
"."
] | tdryer/hangups | python | https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/channel.py#L310-L334 | [
"async",
"def",
"_on_push_data",
"(",
"self",
",",
"data_bytes",
")",
":",
"logger",
".",
"debug",
"(",
"'Received chunk:\\n{}'",
".",
"format",
"(",
"data_bytes",
")",
")",
"for",
"chunk",
"in",
"self",
".",
"_chunk_parser",
".",
"get_chunks",
"(",
"data_by... | 85c0bf0a57698d077461283895707260f9dbf931 |
valid | ConversationEvent.user_id | Who created the event (:class:`~hangups.user.UserID`). | hangups/conversation_event.py | def user_id(self):
"""Who created the event (:class:`~hangups.user.UserID`)."""
return user.UserID(chat_id=self._event.sender_id.chat_id,
gaia_id=self._event.sender_id.gaia_id) | def user_id(self):
"""Who created the event (:class:`~hangups.user.UserID`)."""
return user.UserID(chat_id=self._event.sender_id.chat_id,
gaia_id=self._event.sender_id.gaia_id) | [
"Who",
"created",
"the",
"event",
"(",
":",
"class",
":",
"~hangups",
".",
"user",
".",
"UserID",
")",
"."
] | tdryer/hangups | python | https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/conversation_event.py#L34-L37 | [
"def",
"user_id",
"(",
"self",
")",
":",
"return",
"user",
".",
"UserID",
"(",
"chat_id",
"=",
"self",
".",
"_event",
".",
"sender_id",
".",
"chat_id",
",",
"gaia_id",
"=",
"self",
".",
"_event",
".",
"sender_id",
".",
"gaia_id",
")"
] | 85c0bf0a57698d077461283895707260f9dbf931 |
valid | ChatMessageSegment.from_str | Construct :class:`ChatMessageSegment` list parsed from a string.
Args:
text (str): Text to parse. May contain line breaks, URLs and
formatting markup (simplified Markdown and HTML) to be
converted into equivalent segments.
Returns:
List of :class... | hangups/conversation_event.py | def from_str(text):
"""Construct :class:`ChatMessageSegment` list parsed from a string.
Args:
text (str): Text to parse. May contain line breaks, URLs and
formatting markup (simplified Markdown and HTML) to be
converted into equivalent segments.
Retu... | def from_str(text):
"""Construct :class:`ChatMessageSegment` list parsed from a string.
Args:
text (str): Text to parse. May contain line breaks, URLs and
formatting markup (simplified Markdown and HTML) to be
converted into equivalent segments.
Retu... | [
"Construct",
":",
"class",
":",
"ChatMessageSegment",
"list",
"parsed",
"from",
"a",
"string",
"."
] | tdryer/hangups | python | https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/conversation_event.py#L88-L101 | [
"def",
"from_str",
"(",
"text",
")",
":",
"segment_list",
"=",
"chat_message_parser",
".",
"parse",
"(",
"text",
")",
"return",
"[",
"ChatMessageSegment",
"(",
"segment",
".",
"text",
",",
"*",
"*",
"segment",
".",
"params",
")",
"for",
"segment",
"in",
... | 85c0bf0a57698d077461283895707260f9dbf931 |
valid | ChatMessageSegment.deserialize | Construct :class:`ChatMessageSegment` from ``Segment`` message.
Args:
segment: ``Segment`` message to parse.
Returns:
:class:`ChatMessageSegment` object. | hangups/conversation_event.py | def deserialize(segment):
"""Construct :class:`ChatMessageSegment` from ``Segment`` message.
Args:
segment: ``Segment`` message to parse.
Returns:
:class:`ChatMessageSegment` object.
"""
link_target = segment.link_data.link_target
return ChatMess... | def deserialize(segment):
"""Construct :class:`ChatMessageSegment` from ``Segment`` message.
Args:
segment: ``Segment`` message to parse.
Returns:
:class:`ChatMessageSegment` object.
"""
link_target = segment.link_data.link_target
return ChatMess... | [
"Construct",
":",
"class",
":",
"ChatMessageSegment",
"from",
"Segment",
"message",
"."
] | tdryer/hangups | python | https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/conversation_event.py#L104-L121 | [
"def",
"deserialize",
"(",
"segment",
")",
":",
"link_target",
"=",
"segment",
".",
"link_data",
".",
"link_target",
"return",
"ChatMessageSegment",
"(",
"segment",
".",
"text",
",",
"segment_type",
"=",
"segment",
".",
"type",
",",
"is_bold",
"=",
"segment",
... | 85c0bf0a57698d077461283895707260f9dbf931 |
valid | ChatMessageSegment.serialize | Serialize this segment to a ``Segment`` message.
Returns:
``Segment`` message. | hangups/conversation_event.py | def serialize(self):
"""Serialize this segment to a ``Segment`` message.
Returns:
``Segment`` message.
"""
segment = hangouts_pb2.Segment(
type=self.type_,
text=self.text,
formatting=hangouts_pb2.Formatting(
bold=self.is_bo... | def serialize(self):
"""Serialize this segment to a ``Segment`` message.
Returns:
``Segment`` message.
"""
segment = hangouts_pb2.Segment(
type=self.type_,
text=self.text,
formatting=hangouts_pb2.Formatting(
bold=self.is_bo... | [
"Serialize",
"this",
"segment",
"to",
"a",
"Segment",
"message",
"."
] | tdryer/hangups | python | https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/conversation_event.py#L123-L141 | [
"def",
"serialize",
"(",
"self",
")",
":",
"segment",
"=",
"hangouts_pb2",
".",
"Segment",
"(",
"type",
"=",
"self",
".",
"type_",
",",
"text",
"=",
"self",
".",
"text",
",",
"formatting",
"=",
"hangouts_pb2",
".",
"Formatting",
"(",
"bold",
"=",
"self... | 85c0bf0a57698d077461283895707260f9dbf931 |
valid | ChatMessageEvent.text | Text of the message without formatting (:class:`str`). | hangups/conversation_event.py | def text(self):
"""Text of the message without formatting (:class:`str`)."""
lines = ['']
for segment in self.segments:
if segment.type_ == hangouts_pb2.SEGMENT_TYPE_TEXT:
lines[-1] += segment.text
elif segment.type_ == hangouts_pb2.SEGMENT_TYPE_LINK:
... | def text(self):
"""Text of the message without formatting (:class:`str`)."""
lines = ['']
for segment in self.segments:
if segment.type_ == hangouts_pb2.SEGMENT_TYPE_TEXT:
lines[-1] += segment.text
elif segment.type_ == hangouts_pb2.SEGMENT_TYPE_LINK:
... | [
"Text",
"of",
"the",
"message",
"without",
"formatting",
"(",
":",
"class",
":",
"str",
")",
"."
] | tdryer/hangups | python | https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/conversation_event.py#L151-L165 | [
"def",
"text",
"(",
"self",
")",
":",
"lines",
"=",
"[",
"''",
"]",
"for",
"segment",
"in",
"self",
".",
"segments",
":",
"if",
"segment",
".",
"type_",
"==",
"hangouts_pb2",
".",
"SEGMENT_TYPE_TEXT",
":",
"lines",
"[",
"-",
"1",
"]",
"+=",
"segment"... | 85c0bf0a57698d077461283895707260f9dbf931 |
valid | ChatMessageEvent.segments | List of :class:`ChatMessageSegment` in message (:class:`list`). | hangups/conversation_event.py | def segments(self):
"""List of :class:`ChatMessageSegment` in message (:class:`list`)."""
seg_list = self._event.chat_message.message_content.segment
return [ChatMessageSegment.deserialize(seg) for seg in seg_list] | def segments(self):
"""List of :class:`ChatMessageSegment` in message (:class:`list`)."""
seg_list = self._event.chat_message.message_content.segment
return [ChatMessageSegment.deserialize(seg) for seg in seg_list] | [
"List",
"of",
":",
"class",
":",
"ChatMessageSegment",
"in",
"message",
"(",
":",
"class",
":",
"list",
")",
"."
] | tdryer/hangups | python | https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/conversation_event.py#L168-L171 | [
"def",
"segments",
"(",
"self",
")",
":",
"seg_list",
"=",
"self",
".",
"_event",
".",
"chat_message",
".",
"message_content",
".",
"segment",
"return",
"[",
"ChatMessageSegment",
".",
"deserialize",
"(",
"seg",
")",
"for",
"seg",
"in",
"seg_list",
"]"
] | 85c0bf0a57698d077461283895707260f9dbf931 |
valid | ChatMessageEvent.attachments | List of attachments in the message (:class:`list`). | hangups/conversation_event.py | def attachments(self):
"""List of attachments in the message (:class:`list`)."""
raw_attachments = self._event.chat_message.message_content.attachment
if raw_attachments is None:
raw_attachments = []
attachments = []
for attachment in raw_attachments:
for ... | def attachments(self):
"""List of attachments in the message (:class:`list`)."""
raw_attachments = self._event.chat_message.message_content.attachment
if raw_attachments is None:
raw_attachments = []
attachments = []
for attachment in raw_attachments:
for ... | [
"List",
"of",
"attachments",
"in",
"the",
"message",
"(",
":",
"class",
":",
"list",
")",
"."
] | tdryer/hangups | python | https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/conversation_event.py#L174-L196 | [
"def",
"attachments",
"(",
"self",
")",
":",
"raw_attachments",
"=",
"self",
".",
"_event",
".",
"chat_message",
".",
"message_content",
".",
"attachment",
"if",
"raw_attachments",
"is",
"None",
":",
"raw_attachments",
"=",
"[",
"]",
"attachments",
"=",
"[",
... | 85c0bf0a57698d077461283895707260f9dbf931 |
valid | MembershipChangeEvent.participant_ids | :class:`~hangups.user.UserID` of users involved (:class:`list`). | hangups/conversation_event.py | def participant_ids(self):
""":class:`~hangups.user.UserID` of users involved (:class:`list`)."""
return [user.UserID(chat_id=id_.chat_id, gaia_id=id_.gaia_id)
for id_ in self._event.membership_change.participant_ids] | def participant_ids(self):
""":class:`~hangups.user.UserID` of users involved (:class:`list`)."""
return [user.UserID(chat_id=id_.chat_id, gaia_id=id_.gaia_id)
for id_ in self._event.membership_change.participant_ids] | [
":",
"class",
":",
"~hangups",
".",
"user",
".",
"UserID",
"of",
"users",
"involved",
"(",
":",
"class",
":",
"list",
")",
"."
] | tdryer/hangups | python | https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/conversation_event.py#L263-L266 | [
"def",
"participant_ids",
"(",
"self",
")",
":",
"return",
"[",
"user",
".",
"UserID",
"(",
"chat_id",
"=",
"id_",
".",
"chat_id",
",",
"gaia_id",
"=",
"id_",
".",
"gaia_id",
")",
"for",
"id_",
"in",
"self",
".",
"_event",
".",
"membership_change",
"."... | 85c0bf0a57698d077461283895707260f9dbf931 |
valid | _decode_field | Decode optional or required field. | hangups/pblite.py | def _decode_field(message, field, value):
"""Decode optional or required field."""
if field.type == FieldDescriptor.TYPE_MESSAGE:
decode(getattr(message, field.name), value)
else:
try:
if field.type == FieldDescriptor.TYPE_BYTES:
value = base64.b64decode(value)
... | def _decode_field(message, field, value):
"""Decode optional or required field."""
if field.type == FieldDescriptor.TYPE_MESSAGE:
decode(getattr(message, field.name), value)
else:
try:
if field.type == FieldDescriptor.TYPE_BYTES:
value = base64.b64decode(value)
... | [
"Decode",
"optional",
"or",
"required",
"field",
"."
] | tdryer/hangups | python | https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/pblite.py#L26-L40 | [
"def",
"_decode_field",
"(",
"message",
",",
"field",
",",
"value",
")",
":",
"if",
"field",
".",
"type",
"==",
"FieldDescriptor",
".",
"TYPE_MESSAGE",
":",
"decode",
"(",
"getattr",
"(",
"message",
",",
"field",
".",
"name",
")",
",",
"value",
")",
"e... | 85c0bf0a57698d077461283895707260f9dbf931 |
valid | _decode_repeated_field | Decode repeated field. | hangups/pblite.py | def _decode_repeated_field(message, field, value_list):
"""Decode repeated field."""
if field.type == FieldDescriptor.TYPE_MESSAGE:
for value in value_list:
decode(getattr(message, field.name).add(), value)
else:
try:
for value in value_list:
if field.... | def _decode_repeated_field(message, field, value_list):
"""Decode repeated field."""
if field.type == FieldDescriptor.TYPE_MESSAGE:
for value in value_list:
decode(getattr(message, field.name).add(), value)
else:
try:
for value in value_list:
if field.... | [
"Decode",
"repeated",
"field",
"."
] | tdryer/hangups | python | https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/pblite.py#L43-L61 | [
"def",
"_decode_repeated_field",
"(",
"message",
",",
"field",
",",
"value_list",
")",
":",
"if",
"field",
".",
"type",
"==",
"FieldDescriptor",
".",
"TYPE_MESSAGE",
":",
"for",
"value",
"in",
"value_list",
":",
"decode",
"(",
"getattr",
"(",
"message",
",",... | 85c0bf0a57698d077461283895707260f9dbf931 |
valid | decode | Decode pblite to Protocol Buffer message.
This method is permissive of decoding errors and will log them as warnings
and continue decoding where possible.
The first element of the outer pblite list must often be ignored using the
ignore_first_item parameter because it contains an abbreviation of the n... | hangups/pblite.py | def decode(message, pblite, ignore_first_item=False):
"""Decode pblite to Protocol Buffer message.
This method is permissive of decoding errors and will log them as warnings
and continue decoding where possible.
The first element of the outer pblite list must often be ignored using the
ignore_firs... | def decode(message, pblite, ignore_first_item=False):
"""Decode pblite to Protocol Buffer message.
This method is permissive of decoding errors and will log them as warnings
and continue decoding where possible.
The first element of the outer pblite list must often be ignored using the
ignore_firs... | [
"Decode",
"pblite",
"to",
"Protocol",
"Buffer",
"message",
"."
] | tdryer/hangups | python | https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/pblite.py#L64-L116 | [
"def",
"decode",
"(",
"message",
",",
"pblite",
",",
"ignore_first_item",
"=",
"False",
")",
":",
"if",
"not",
"isinstance",
"(",
"pblite",
",",
"list",
")",
":",
"logger",
".",
"warning",
"(",
"'Ignoring invalid message: expected list, got %r'",
",",
"type",
... | 85c0bf0a57698d077461283895707260f9dbf931 |
valid | CQHttp.send_private_msg | 发送私聊消息
------------
:param int user_id: 对方 QQ 号
:param str | list[ dict[ str, unknown ] ] message: 要发送的内容
:param bool auto_escape: 消息内容是否作为纯文本发送(即不解析 CQ 码),`message` 数据类型为 `list` 时无效
:return: {"message_id": int 消息ID}
:rtype: dict[string, int] | cqhttp_helper.py | def send_private_msg(self, *, user_id, message, auto_escape=False):
'''
发送私聊消息
------------
:param int user_id: 对方 QQ 号
:param str | list[ dict[ str, unknown ] ] message: 要发送的内容
:param bool auto_escape: 消息内容是否作为纯文本发送(即不解析 CQ 码),`message` 数据类型为 `list` 时无效
:return... | def send_private_msg(self, *, user_id, message, auto_escape=False):
'''
发送私聊消息
------------
:param int user_id: 对方 QQ 号
:param str | list[ dict[ str, unknown ] ] message: 要发送的内容
:param bool auto_escape: 消息内容是否作为纯文本发送(即不解析 CQ 码),`message` 数据类型为 `list` 时无效
:return... | [
"发送私聊消息"
] | richardchien/python-cqhttp | python | https://github.com/richardchien/python-cqhttp/blob/1869819a8f89001e3f70668e31afc6c78f7f5bc2/cqhttp_helper.py#L212-L225 | [
"def",
"send_private_msg",
"(",
"self",
",",
"*",
",",
"user_id",
",",
"message",
",",
"auto_escape",
"=",
"False",
")",
":",
"return",
"super",
"(",
")",
".",
"__getattr__",
"(",
"'send_private_msg'",
")",
"(",
"user_id",
"=",
"user_id",
",",
"message",
... | 1869819a8f89001e3f70668e31afc6c78f7f5bc2 |
valid | CQHttp.send_private_msg_async | 发送私聊消息 (异步版本)
------------
:param int user_id: 对方 QQ 号
:param str | list[ dict[ str, unknown ] ] message: 要发送的内容
:param bool auto_escape: 消息内容是否作为纯文本发送(即不解析 CQ 码),`message` 数据类型为 `list` 时无效
:return: None
:rtype: None | cqhttp_helper.py | def send_private_msg_async(self, *, user_id, message, auto_escape=False):
"""
发送私聊消息 (异步版本)
------------
:param int user_id: 对方 QQ 号
:param str | list[ dict[ str, unknown ] ] message: 要发送的内容
:param bool auto_escape: 消息内容是否作为纯文本发送(即不解析 CQ 码),`message` 数据类型为 `list` 时无效
... | def send_private_msg_async(self, *, user_id, message, auto_escape=False):
"""
发送私聊消息 (异步版本)
------------
:param int user_id: 对方 QQ 号
:param str | list[ dict[ str, unknown ] ] message: 要发送的内容
:param bool auto_escape: 消息内容是否作为纯文本发送(即不解析 CQ 码),`message` 数据类型为 `list` 时无效
... | [
"发送私聊消息",
"(",
"异步版本",
")"
] | richardchien/python-cqhttp | python | https://github.com/richardchien/python-cqhttp/blob/1869819a8f89001e3f70668e31afc6c78f7f5bc2/cqhttp_helper.py#L227-L240 | [
"def",
"send_private_msg_async",
"(",
"self",
",",
"*",
",",
"user_id",
",",
"message",
",",
"auto_escape",
"=",
"False",
")",
":",
"return",
"super",
"(",
")",
".",
"__getattr__",
"(",
"'send_private_msg_async'",
")",
"(",
"user_id",
"=",
"user_id",
",",
... | 1869819a8f89001e3f70668e31afc6c78f7f5bc2 |
valid | CQHttp.send_group_msg | 发送群消息
------------
:param int group_id: 群号
:param str | list[ dict[ str, unknown ] ] message: 要发送的内容
:param bool auto_escape: 消息内容是否作为纯文本发送(即不解析 CQ 码),`message` 数据类型为 `list` 时无效
:return: {"message_id": int 消息ID}
:rtype: dict[string, int] | cqhttp_helper.py | def send_group_msg(self, *, group_id, message, auto_escape=False):
"""
发送群消息
------------
:param int group_id: 群号
:param str | list[ dict[ str, unknown ] ] message: 要发送的内容
:param bool auto_escape: 消息内容是否作为纯文本发送(即不解析 CQ 码),`message` 数据类型为 `list` 时无效
:return: {"me... | def send_group_msg(self, *, group_id, message, auto_escape=False):
"""
发送群消息
------------
:param int group_id: 群号
:param str | list[ dict[ str, unknown ] ] message: 要发送的内容
:param bool auto_escape: 消息内容是否作为纯文本发送(即不解析 CQ 码),`message` 数据类型为 `list` 时无效
:return: {"me... | [
"发送群消息"
] | richardchien/python-cqhttp | python | https://github.com/richardchien/python-cqhttp/blob/1869819a8f89001e3f70668e31afc6c78f7f5bc2/cqhttp_helper.py#L242-L255 | [
"def",
"send_group_msg",
"(",
"self",
",",
"*",
",",
"group_id",
",",
"message",
",",
"auto_escape",
"=",
"False",
")",
":",
"return",
"super",
"(",
")",
".",
"__getattr__",
"(",
"'send_group_msg'",
")",
"(",
"group_id",
"=",
"group_id",
",",
"message",
... | 1869819a8f89001e3f70668e31afc6c78f7f5bc2 |
valid | CQHttp.send_group_msg_async | 发送群消息 (异步版本)
------------
:param int group_id: 群号
:param str | list[ dict[ str, unknown ] ] message: 要发送的内容
:param bool auto_escape: 消息内容是否作为纯文本发送(即不解析 CQ 码),`message` 数据类型为 `list` 时无效
:return: None
:rtype: None | cqhttp_helper.py | def send_group_msg_async(self, *, group_id, message, auto_escape=False):
"""
发送群消息 (异步版本)
------------
:param int group_id: 群号
:param str | list[ dict[ str, unknown ] ] message: 要发送的内容
:param bool auto_escape: 消息内容是否作为纯文本发送(即不解析 CQ 码),`message` 数据类型为 `list` 时无效
... | def send_group_msg_async(self, *, group_id, message, auto_escape=False):
"""
发送群消息 (异步版本)
------------
:param int group_id: 群号
:param str | list[ dict[ str, unknown ] ] message: 要发送的内容
:param bool auto_escape: 消息内容是否作为纯文本发送(即不解析 CQ 码),`message` 数据类型为 `list` 时无效
... | [
"发送群消息",
"(",
"异步版本",
")"
] | richardchien/python-cqhttp | python | https://github.com/richardchien/python-cqhttp/blob/1869819a8f89001e3f70668e31afc6c78f7f5bc2/cqhttp_helper.py#L257-L270 | [
"def",
"send_group_msg_async",
"(",
"self",
",",
"*",
",",
"group_id",
",",
"message",
",",
"auto_escape",
"=",
"False",
")",
":",
"return",
"super",
"(",
")",
".",
"__getattr__",
"(",
"'send_group_msg_async'",
")",
"(",
"group_id",
"=",
"group_id",
",",
"... | 1869819a8f89001e3f70668e31afc6c78f7f5bc2 |
valid | CQHttp.send_discuss_msg | 发送讨论组消息
------------
:param int discuss_id: 讨论组 ID(正常情况下看不到,需要从讨论组消息上报的数据中获得)
:param str | list[ dict[ str, unknown ] ] message: 要发送的内容
:param bool auto_escape: 消息内容是否作为纯文本发送(即不解析 CQ 码),`message` 数据类型为 `list` 时无效
:return: {"message_id": int 消息ID}
:rtype: dict[string, in... | cqhttp_helper.py | def send_discuss_msg(self, *, discuss_id, message, auto_escape=False):
"""
发送讨论组消息
------------
:param int discuss_id: 讨论组 ID(正常情况下看不到,需要从讨论组消息上报的数据中获得)
:param str | list[ dict[ str, unknown ] ] message: 要发送的内容
:param bool auto_escape: 消息内容是否作为纯文本发送(即不解析 CQ 码),`message`... | def send_discuss_msg(self, *, discuss_id, message, auto_escape=False):
"""
发送讨论组消息
------------
:param int discuss_id: 讨论组 ID(正常情况下看不到,需要从讨论组消息上报的数据中获得)
:param str | list[ dict[ str, unknown ] ] message: 要发送的内容
:param bool auto_escape: 消息内容是否作为纯文本发送(即不解析 CQ 码),`message`... | [
"发送讨论组消息"
] | richardchien/python-cqhttp | python | https://github.com/richardchien/python-cqhttp/blob/1869819a8f89001e3f70668e31afc6c78f7f5bc2/cqhttp_helper.py#L272-L285 | [
"def",
"send_discuss_msg",
"(",
"self",
",",
"*",
",",
"discuss_id",
",",
"message",
",",
"auto_escape",
"=",
"False",
")",
":",
"return",
"super",
"(",
")",
".",
"__getattr__",
"(",
"'send_discuss_msg'",
")",
"(",
"discuss_id",
"=",
"discuss_id",
",",
"me... | 1869819a8f89001e3f70668e31afc6c78f7f5bc2 |
valid | CQHttp.send_discuss_msg_async | 发送讨论组消息 (异步版本)
------------
:param int discuss_id: 讨论组 ID(正常情况下看不到,需要从讨论组消息上报的数据中获得)
:param str | list[ dict[ str, unknown ] ] message: 要发送的内容
:param bool auto_escape: 消息内容是否作为纯文本发送(即不解析 CQ 码),`message` 数据类型为 `list` 时无效
:return: None
:rtype: None | cqhttp_helper.py | def send_discuss_msg_async(self, *, discuss_id, message, auto_escape=False):
"""
发送讨论组消息 (异步版本)
------------
:param int discuss_id: 讨论组 ID(正常情况下看不到,需要从讨论组消息上报的数据中获得)
:param str | list[ dict[ str, unknown ] ] message: 要发送的内容
:param bool auto_escape: 消息内容是否作为纯文本发送(即不解析 CQ... | def send_discuss_msg_async(self, *, discuss_id, message, auto_escape=False):
"""
发送讨论组消息 (异步版本)
------------
:param int discuss_id: 讨论组 ID(正常情况下看不到,需要从讨论组消息上报的数据中获得)
:param str | list[ dict[ str, unknown ] ] message: 要发送的内容
:param bool auto_escape: 消息内容是否作为纯文本发送(即不解析 CQ... | [
"发送讨论组消息",
"(",
"异步版本",
")"
] | richardchien/python-cqhttp | python | https://github.com/richardchien/python-cqhttp/blob/1869819a8f89001e3f70668e31afc6c78f7f5bc2/cqhttp_helper.py#L287-L300 | [
"def",
"send_discuss_msg_async",
"(",
"self",
",",
"*",
",",
"discuss_id",
",",
"message",
",",
"auto_escape",
"=",
"False",
")",
":",
"return",
"super",
"(",
")",
".",
"__getattr__",
"(",
"'send_discuss_msg_async'",
")",
"(",
"discuss_id",
"=",
"discuss_id",
... | 1869819a8f89001e3f70668e31afc6c78f7f5bc2 |
valid | CQHttp.send_msg_async | 发送消息 (异步版本)
------------
:param str message_type: 消息类型,支持 `private`、`group`、`discuss`,分别对应私聊、群组、讨论组
:param int user_id: 对方 QQ 号(消息类型为 `private` 时需要)
:param int group_id: 群号(消息类型为 `group` 时需要)
:param int discuss_id: 讨论组 ID(需要从上报消息中获取,消息类型为 `discuss` 时需要)
:param str | lis... | cqhttp_helper.py | def send_msg_async(self, *, message_type, user_id=None, group_id=None, discuss_id=None, message, auto_escape=False):
"""
发送消息 (异步版本)
------------
:param str message_type: 消息类型,支持 `private`、`group`、`discuss`,分别对应私聊、群组、讨论组
:param int user_id: 对方 QQ 号(消息类型为 `private` 时需要)
... | def send_msg_async(self, *, message_type, user_id=None, group_id=None, discuss_id=None, message, auto_escape=False):
"""
发送消息 (异步版本)
------------
:param str message_type: 消息类型,支持 `private`、`group`、`discuss`,分别对应私聊、群组、讨论组
:param int user_id: 对方 QQ 号(消息类型为 `private` 时需要)
... | [
"发送消息",
"(",
"异步版本",
")"
] | richardchien/python-cqhttp | python | https://github.com/richardchien/python-cqhttp/blob/1869819a8f89001e3f70668e31afc6c78f7f5bc2/cqhttp_helper.py#L321-L338 | [
"def",
"send_msg_async",
"(",
"self",
",",
"*",
",",
"message_type",
",",
"user_id",
"=",
"None",
",",
"group_id",
"=",
"None",
",",
"discuss_id",
"=",
"None",
",",
"message",
",",
"auto_escape",
"=",
"False",
")",
":",
"return",
"super",
"(",
")",
"."... | 1869819a8f89001e3f70668e31afc6c78f7f5bc2 |
valid | CQHttp.send_like | 发送好友赞
------------
:param int user_id: 对方 QQ 号
:param int times: 赞的次数,每个好友每天最多 10 次
:return: None
:rtype: None | cqhttp_helper.py | def send_like(self, *, user_id, times=1):
"""
发送好友赞
------------
:param int user_id: 对方 QQ 号
:param int times: 赞的次数,每个好友每天最多 10 次
:return: None
:rtype: None
"""
return super().__getattr__('send_like') \
(user_id=user_id, times=times) | def send_like(self, *, user_id, times=1):
"""
发送好友赞
------------
:param int user_id: 对方 QQ 号
:param int times: 赞的次数,每个好友每天最多 10 次
:return: None
:rtype: None
"""
return super().__getattr__('send_like') \
(user_id=user_id, times=times) | [
"发送好友赞"
] | richardchien/python-cqhttp | python | https://github.com/richardchien/python-cqhttp/blob/1869819a8f89001e3f70668e31afc6c78f7f5bc2/cqhttp_helper.py#L353-L365 | [
"def",
"send_like",
"(",
"self",
",",
"*",
",",
"user_id",
",",
"times",
"=",
"1",
")",
":",
"return",
"super",
"(",
")",
".",
"__getattr__",
"(",
"'send_like'",
")",
"(",
"user_id",
"=",
"user_id",
",",
"times",
"=",
"times",
")"
] | 1869819a8f89001e3f70668e31afc6c78f7f5bc2 |
valid | CQHttp.set_group_kick | 群组踢人
------------
:param int group_id: 群号
:param int user_id: 要踢的 QQ 号
:param bool reject_add_request: 拒绝此人的加群请求
:return: None
:rtype: None | cqhttp_helper.py | def set_group_kick(self, *, group_id, user_id, reject_add_request=False):
"""
群组踢人
------------
:param int group_id: 群号
:param int user_id: 要踢的 QQ 号
:param bool reject_add_request: 拒绝此人的加群请求
:return: None
:rtype: None
"""
return super()._... | def set_group_kick(self, *, group_id, user_id, reject_add_request=False):
"""
群组踢人
------------
:param int group_id: 群号
:param int user_id: 要踢的 QQ 号
:param bool reject_add_request: 拒绝此人的加群请求
:return: None
:rtype: None
"""
return super()._... | [
"群组踢人"
] | richardchien/python-cqhttp | python | https://github.com/richardchien/python-cqhttp/blob/1869819a8f89001e3f70668e31afc6c78f7f5bc2/cqhttp_helper.py#L367-L380 | [
"def",
"set_group_kick",
"(",
"self",
",",
"*",
",",
"group_id",
",",
"user_id",
",",
"reject_add_request",
"=",
"False",
")",
":",
"return",
"super",
"(",
")",
".",
"__getattr__",
"(",
"'set_group_kick'",
")",
"(",
"group_id",
"=",
"group_id",
",",
"user_... | 1869819a8f89001e3f70668e31afc6c78f7f5bc2 |
valid | CQHttp.set_group_ban | 群组单人禁言
------------
:param int group_id: 群号
:param int user_id: 要禁言的 QQ 号
:param int duration: 禁言时长,单位秒,0 表示取消禁言
:return: None
:rtype: None | cqhttp_helper.py | def set_group_ban(self, *, group_id, user_id, duration=30 * 60):
"""
群组单人禁言
------------
:param int group_id: 群号
:param int user_id: 要禁言的 QQ 号
:param int duration: 禁言时长,单位秒,0 表示取消禁言
:return: None
:rtype: None
"""
return super().__getattr_... | def set_group_ban(self, *, group_id, user_id, duration=30 * 60):
"""
群组单人禁言
------------
:param int group_id: 群号
:param int user_id: 要禁言的 QQ 号
:param int duration: 禁言时长,单位秒,0 表示取消禁言
:return: None
:rtype: None
"""
return super().__getattr_... | [
"群组单人禁言"
] | richardchien/python-cqhttp | python | https://github.com/richardchien/python-cqhttp/blob/1869819a8f89001e3f70668e31afc6c78f7f5bc2/cqhttp_helper.py#L382-L395 | [
"def",
"set_group_ban",
"(",
"self",
",",
"*",
",",
"group_id",
",",
"user_id",
",",
"duration",
"=",
"30",
"*",
"60",
")",
":",
"return",
"super",
"(",
")",
".",
"__getattr__",
"(",
"'set_group_ban'",
")",
"(",
"group_id",
"=",
"group_id",
",",
"user_... | 1869819a8f89001e3f70668e31afc6c78f7f5bc2 |
valid | CQHttp.set_group_anonymous_ban | 群组匿名用户禁言
------------
:param int group_id: 群号
:param str flag: 要禁言的匿名用户的 flag(需从群消息上报的数据中获得)
:param int duration: 禁言时长,单位秒,**无法取消匿名用户禁言**
:return: None
:rtype: None | cqhttp_helper.py | def set_group_anonymous_ban(self, *, group_id, flag, duration=30 * 60):
"""
群组匿名用户禁言
------------
:param int group_id: 群号
:param str flag: 要禁言的匿名用户的 flag(需从群消息上报的数据中获得)
:param int duration: 禁言时长,单位秒,**无法取消匿名用户禁言**
:return: None
:rtype: None
"""
... | def set_group_anonymous_ban(self, *, group_id, flag, duration=30 * 60):
"""
群组匿名用户禁言
------------
:param int group_id: 群号
:param str flag: 要禁言的匿名用户的 flag(需从群消息上报的数据中获得)
:param int duration: 禁言时长,单位秒,**无法取消匿名用户禁言**
:return: None
:rtype: None
"""
... | [
"群组匿名用户禁言"
] | richardchien/python-cqhttp | python | https://github.com/richardchien/python-cqhttp/blob/1869819a8f89001e3f70668e31afc6c78f7f5bc2/cqhttp_helper.py#L397-L410 | [
"def",
"set_group_anonymous_ban",
"(",
"self",
",",
"*",
",",
"group_id",
",",
"flag",
",",
"duration",
"=",
"30",
"*",
"60",
")",
":",
"return",
"super",
"(",
")",
".",
"__getattr__",
"(",
"'set_group_anonymous_ban'",
")",
"(",
"group_id",
"=",
"group_id"... | 1869819a8f89001e3f70668e31afc6c78f7f5bc2 |
valid | CQHttp.set_group_whole_ban | 群组全员禁言
------------
:param int group_id: 群号
:param bool enable: 是否禁言
:return: None
:rtype: None | cqhttp_helper.py | def set_group_whole_ban(self, *, group_id, enable=True):
"""
群组全员禁言
------------
:param int group_id: 群号
:param bool enable: 是否禁言
:return: None
:rtype: None
"""
return super().__getattr__('set_group_whole_ban') \
(group_id=group_id, e... | def set_group_whole_ban(self, *, group_id, enable=True):
"""
群组全员禁言
------------
:param int group_id: 群号
:param bool enable: 是否禁言
:return: None
:rtype: None
"""
return super().__getattr__('set_group_whole_ban') \
(group_id=group_id, e... | [
"群组全员禁言"
] | richardchien/python-cqhttp | python | https://github.com/richardchien/python-cqhttp/blob/1869819a8f89001e3f70668e31afc6c78f7f5bc2/cqhttp_helper.py#L412-L424 | [
"def",
"set_group_whole_ban",
"(",
"self",
",",
"*",
",",
"group_id",
",",
"enable",
"=",
"True",
")",
":",
"return",
"super",
"(",
")",
".",
"__getattr__",
"(",
"'set_group_whole_ban'",
")",
"(",
"group_id",
"=",
"group_id",
",",
"enable",
"=",
"enable",
... | 1869819a8f89001e3f70668e31afc6c78f7f5bc2 |
valid | CQHttp.set_group_admin | 群组设置管理员
------------
:param int group_id: 群号
:param user_id: 要设置管理员的 QQ 号
:param enable: True 为设置,False 为取消
:return: None
:rtype: None | cqhttp_helper.py | def set_group_admin(self, *, group_id, user_id, enable=True):
"""
群组设置管理员
------------
:param int group_id: 群号
:param user_id: 要设置管理员的 QQ 号
:param enable: True 为设置,False 为取消
:return: None
:rtype: None
"""
return super().__getattr__('set_g... | def set_group_admin(self, *, group_id, user_id, enable=True):
"""
群组设置管理员
------------
:param int group_id: 群号
:param user_id: 要设置管理员的 QQ 号
:param enable: True 为设置,False 为取消
:return: None
:rtype: None
"""
return super().__getattr__('set_g... | [
"群组设置管理员"
] | richardchien/python-cqhttp | python | https://github.com/richardchien/python-cqhttp/blob/1869819a8f89001e3f70668e31afc6c78f7f5bc2/cqhttp_helper.py#L426-L439 | [
"def",
"set_group_admin",
"(",
"self",
",",
"*",
",",
"group_id",
",",
"user_id",
",",
"enable",
"=",
"True",
")",
":",
"return",
"super",
"(",
")",
".",
"__getattr__",
"(",
"'set_group_admin'",
")",
"(",
"group_id",
"=",
"group_id",
",",
"user_id",
"=",... | 1869819a8f89001e3f70668e31afc6c78f7f5bc2 |
valid | CQHttp.set_group_anonymous | 群组匿名
------------
:param int group_id: 群号
:param bool enable: 是否允许匿名聊天
:return: None
:rtype: None | cqhttp_helper.py | def set_group_anonymous(self, *, group_id, enable=True):
"""
群组匿名
------------
:param int group_id: 群号
:param bool enable: 是否允许匿名聊天
:return: None
:rtype: None
"""
return super().__getattr__('set_group_anonymous') \
(group_id=group_id,... | def set_group_anonymous(self, *, group_id, enable=True):
"""
群组匿名
------------
:param int group_id: 群号
:param bool enable: 是否允许匿名聊天
:return: None
:rtype: None
"""
return super().__getattr__('set_group_anonymous') \
(group_id=group_id,... | [
"群组匿名"
] | richardchien/python-cqhttp | python | https://github.com/richardchien/python-cqhttp/blob/1869819a8f89001e3f70668e31afc6c78f7f5bc2/cqhttp_helper.py#L441-L453 | [
"def",
"set_group_anonymous",
"(",
"self",
",",
"*",
",",
"group_id",
",",
"enable",
"=",
"True",
")",
":",
"return",
"super",
"(",
")",
".",
"__getattr__",
"(",
"'set_group_anonymous'",
")",
"(",
"group_id",
"=",
"group_id",
",",
"enable",
"=",
"enable",
... | 1869819a8f89001e3f70668e31afc6c78f7f5bc2 |
valid | CQHttp.set_group_card | 设置群名片(群备注)
------------
:param int group_id: 群号
:param int user_id: 要设置的 QQ 号
:param str | None card: 群名片内容,不填或空字符串表示删除群名片
:return: None
:rtype: None | cqhttp_helper.py | def set_group_card(self, *, group_id, user_id, card=None):
"""
设置群名片(群备注)
------------
:param int group_id: 群号
:param int user_id: 要设置的 QQ 号
:param str | None card: 群名片内容,不填或空字符串表示删除群名片
:return: None
:rtype: None
"""
return super().__geta... | def set_group_card(self, *, group_id, user_id, card=None):
"""
设置群名片(群备注)
------------
:param int group_id: 群号
:param int user_id: 要设置的 QQ 号
:param str | None card: 群名片内容,不填或空字符串表示删除群名片
:return: None
:rtype: None
"""
return super().__geta... | [
"设置群名片(群备注)"
] | richardchien/python-cqhttp | python | https://github.com/richardchien/python-cqhttp/blob/1869819a8f89001e3f70668e31afc6c78f7f5bc2/cqhttp_helper.py#L455-L468 | [
"def",
"set_group_card",
"(",
"self",
",",
"*",
",",
"group_id",
",",
"user_id",
",",
"card",
"=",
"None",
")",
":",
"return",
"super",
"(",
")",
".",
"__getattr__",
"(",
"'set_group_card'",
")",
"(",
"group_id",
"=",
"group_id",
",",
"user_id",
"=",
"... | 1869819a8f89001e3f70668e31afc6c78f7f5bc2 |
valid | CQHttp.set_group_leave | 退出群组
------------
:param int group_id: 群号
:param bool is_dismiss: 是否解散,如果登录号是群主,则仅在此项为 true 时能够解散
:return: None
:rtype: None | cqhttp_helper.py | def set_group_leave(self, *, group_id, is_dismiss=False):
"""
退出群组
------------
:param int group_id: 群号
:param bool is_dismiss: 是否解散,如果登录号是群主,则仅在此项为 true 时能够解散
:return: None
:rtype: None
"""
return super().__getattr__('set_group_leave') \
... | def set_group_leave(self, *, group_id, is_dismiss=False):
"""
退出群组
------------
:param int group_id: 群号
:param bool is_dismiss: 是否解散,如果登录号是群主,则仅在此项为 true 时能够解散
:return: None
:rtype: None
"""
return super().__getattr__('set_group_leave') \
... | [
"退出群组"
] | richardchien/python-cqhttp | python | https://github.com/richardchien/python-cqhttp/blob/1869819a8f89001e3f70668e31afc6c78f7f5bc2/cqhttp_helper.py#L470-L482 | [
"def",
"set_group_leave",
"(",
"self",
",",
"*",
",",
"group_id",
",",
"is_dismiss",
"=",
"False",
")",
":",
"return",
"super",
"(",
")",
".",
"__getattr__",
"(",
"'set_group_leave'",
")",
"(",
"group_id",
"=",
"group_id",
",",
"is_dismiss",
"=",
"is_dismi... | 1869819a8f89001e3f70668e31afc6c78f7f5bc2 |
valid | CQHttp.set_group_special_title | 设置群组专属头衔
------------
:param int group_id: 群号
:param int user_id: 要设置的 QQ 号
:param str special_title: 专属头衔,不填或空字符串表示删除专属头衔,只能保留前6个英文与汉字,Emoji 根据字符实际字符长度占用只能放最多3个甚至更少,超出长度部分会被截断
:param int duration: 专属头衔有效期,单位秒,-1 表示永久,不过此项似乎没有效果,可能是只有某些特殊的时间长度有效,有待测试
:return: None
... | cqhttp_helper.py | def set_group_special_title(self, *, group_id, user_id, special_title, duration=-1):
"""
设置群组专属头衔
------------
:param int group_id: 群号
:param int user_id: 要设置的 QQ 号
:param str special_title: 专属头衔,不填或空字符串表示删除专属头衔,只能保留前6个英文与汉字,Emoji 根据字符实际字符长度占用只能放最多3个甚至更少,超出长度部分会被截断
... | def set_group_special_title(self, *, group_id, user_id, special_title, duration=-1):
"""
设置群组专属头衔
------------
:param int group_id: 群号
:param int user_id: 要设置的 QQ 号
:param str special_title: 专属头衔,不填或空字符串表示删除专属头衔,只能保留前6个英文与汉字,Emoji 根据字符实际字符长度占用只能放最多3个甚至更少,超出长度部分会被截断
... | [
"设置群组专属头衔"
] | richardchien/python-cqhttp | python | https://github.com/richardchien/python-cqhttp/blob/1869819a8f89001e3f70668e31afc6c78f7f5bc2/cqhttp_helper.py#L484-L498 | [
"def",
"set_group_special_title",
"(",
"self",
",",
"*",
",",
"group_id",
",",
"user_id",
",",
"special_title",
",",
"duration",
"=",
"-",
"1",
")",
":",
"return",
"super",
"(",
")",
".",
"__getattr__",
"(",
"'set_group_special_title'",
")",
"(",
"group_id",... | 1869819a8f89001e3f70668e31afc6c78f7f5bc2 |
valid | CQHttp.set_friend_add_request | 处理加好友请求
------------
:param str flag: 加好友请求的 flag(需从上报的数据中获得)
:param bool approve: 是否同意请求
:param str remark: 添加后的好友备注(仅在同意时有效)
:return: None
:rtype: None | cqhttp_helper.py | def set_friend_add_request(self, *, flag, approve=True, remark=None):
"""
处理加好友请求
------------
:param str flag: 加好友请求的 flag(需从上报的数据中获得)
:param bool approve: 是否同意请求
:param str remark: 添加后的好友备注(仅在同意时有效)
:return: None
:rtype: None
"""
return... | def set_friend_add_request(self, *, flag, approve=True, remark=None):
"""
处理加好友请求
------------
:param str flag: 加好友请求的 flag(需从上报的数据中获得)
:param bool approve: 是否同意请求
:param str remark: 添加后的好友备注(仅在同意时有效)
:return: None
:rtype: None
"""
return... | [
"处理加好友请求"
] | richardchien/python-cqhttp | python | https://github.com/richardchien/python-cqhttp/blob/1869819a8f89001e3f70668e31afc6c78f7f5bc2/cqhttp_helper.py#L513-L526 | [
"def",
"set_friend_add_request",
"(",
"self",
",",
"*",
",",
"flag",
",",
"approve",
"=",
"True",
",",
"remark",
"=",
"None",
")",
":",
"return",
"super",
"(",
")",
".",
"__getattr__",
"(",
"'set_friend_add_request'",
")",
"(",
"flag",
"=",
"flag",
",",
... | 1869819a8f89001e3f70668e31afc6c78f7f5bc2 |
valid | CQHttp.set_group_add_request | 处理加群请求、群组成员邀请
------------
:param str flag: 加群请求的 flag(需从上报的数据中获得)
:param str type: `add` 或 `invite`,请求类型(需要和上报消息中的 `sub_type` 字段相符)
:param bool approve: 是否同意请求/邀请
:param str reason: 拒绝理由(仅在拒绝时有效)
:return: None
:rtype: None | cqhttp_helper.py | def set_group_add_request(self, *, flag, type, approve=True, reason=None):
"""
处理加群请求、群组成员邀请
------------
:param str flag: 加群请求的 flag(需从上报的数据中获得)
:param str type: `add` 或 `invite`,请求类型(需要和上报消息中的 `sub_type` 字段相符)
:param bool approve: 是否同意请求/邀请
:param str reason: ... | def set_group_add_request(self, *, flag, type, approve=True, reason=None):
"""
处理加群请求、群组成员邀请
------------
:param str flag: 加群请求的 flag(需从上报的数据中获得)
:param str type: `add` 或 `invite`,请求类型(需要和上报消息中的 `sub_type` 字段相符)
:param bool approve: 是否同意请求/邀请
:param str reason: ... | [
"处理加群请求、群组成员邀请"
] | richardchien/python-cqhttp | python | https://github.com/richardchien/python-cqhttp/blob/1869819a8f89001e3f70668e31afc6c78f7f5bc2/cqhttp_helper.py#L528-L542 | [
"def",
"set_group_add_request",
"(",
"self",
",",
"*",
",",
"flag",
",",
"type",
",",
"approve",
"=",
"True",
",",
"reason",
"=",
"None",
")",
":",
"return",
"super",
"(",
")",
".",
"__getattr__",
"(",
"'set_group_add_request'",
")",
"(",
"flag",
"=",
... | 1869819a8f89001e3f70668e31afc6c78f7f5bc2 |
valid | CQHttp.get_stranger_info | 获取陌生人信息
------------
:param int user_id: QQ 号(不可以是登录号)
:param bool no_cache: 是否不使用缓存(使用缓存可能更新不及时,但响应更快)
:return: { "user_id": (QQ 号: int), "nickname": (昵称: str), "sex": (性别: str in ['male', 'female', 'unknown']), "age": (年龄: int) }
:rtype: dict[ str, int | str ]
------... | cqhttp_helper.py | def get_stranger_info(self, *, user_id, no_cache=False):
"""
获取陌生人信息
------------
:param int user_id: QQ 号(不可以是登录号)
:param bool no_cache: 是否不使用缓存(使用缓存可能更新不及时,但响应更快)
:return: { "user_id": (QQ 号: int), "nickname": (昵称: str), "sex": (性别: str in ['male', 'female', 'unknown'... | def get_stranger_info(self, *, user_id, no_cache=False):
"""
获取陌生人信息
------------
:param int user_id: QQ 号(不可以是登录号)
:param bool no_cache: 是否不使用缓存(使用缓存可能更新不及时,但响应更快)
:return: { "user_id": (QQ 号: int), "nickname": (昵称: str), "sex": (性别: str in ['male', 'female', 'unknown'... | [
"获取陌生人信息"
] | richardchien/python-cqhttp | python | https://github.com/richardchien/python-cqhttp/blob/1869819a8f89001e3f70668e31afc6c78f7f5bc2/cqhttp_helper.py#L567-L593 | [
"def",
"get_stranger_info",
"(",
"self",
",",
"*",
",",
"user_id",
",",
"no_cache",
"=",
"False",
")",
":",
"return",
"super",
"(",
")",
".",
"__getattr__",
"(",
"'get_stranger_info'",
")",
"(",
"user_id",
"=",
"user_id",
",",
"no_cache",
"=",
"no_cache",
... | 1869819a8f89001e3f70668e31afc6c78f7f5bc2 |
valid | CQHttp.get_group_member_info | 获取群成员信息
------------
:param int group_id: 群号
:param int user_id: QQ 号(不可以是登录号)
:param bool no_cache: 是否不使用缓存(使用缓存可能更新不及时,但响应更快)
:return: { "group_id": (群号: int), "user_id": (QQ 号: int), "nickname": (昵称: str), "card": (群名片/备注: str), "sex": (性别: str in ['male', 'female', 'unknown... | cqhttp_helper.py | def get_group_member_info(self, *, group_id, user_id, no_cache=False):
"""
获取群成员信息
------------
:param int group_id: 群号
:param int user_id: QQ 号(不可以是登录号)
:param bool no_cache: 是否不使用缓存(使用缓存可能更新不及时,但响应更快)
:return: { "group_id": (群号: int), "user_id": (QQ 号: int), "... | def get_group_member_info(self, *, group_id, user_id, no_cache=False):
"""
获取群成员信息
------------
:param int group_id: 群号
:param int user_id: QQ 号(不可以是登录号)
:param bool no_cache: 是否不使用缓存(使用缓存可能更新不及时,但响应更快)
:return: { "group_id": (群号: int), "user_id": (QQ 号: int), "... | [
"获取群成员信息"
] | richardchien/python-cqhttp | python | https://github.com/richardchien/python-cqhttp/blob/1869819a8f89001e3f70668e31afc6c78f7f5bc2/cqhttp_helper.py#L619-L656 | [
"def",
"get_group_member_info",
"(",
"self",
",",
"*",
",",
"group_id",
",",
"user_id",
",",
"no_cache",
"=",
"False",
")",
":",
"return",
"super",
"(",
")",
".",
"__getattr__",
"(",
"'get_group_member_info'",
")",
"(",
"group_id",
"=",
"group_id",
",",
"u... | 1869819a8f89001e3f70668e31afc6c78f7f5bc2 |
valid | CQHttp.get_record | 获取语音
------------
:param str file: 收到的语音文件名,如 `0B38145AA44505000B38145AA4450500.silk`
:param str out_format: 要转换到的格式,目前支持 `mp3`、`amr`、`wma`、`m4a`、`spx`、`ogg`、`wav`、`flac`
:return: { "file": (转换后的语音文件名: str)}
:rtype: dict[ str, str ]
------------
其实并不是真的获取语音,而... | cqhttp_helper.py | def get_record(self, *, file, out_format):
"""
获取语音
------------
:param str file: 收到的语音文件名,如 `0B38145AA44505000B38145AA4450500.silk`
:param str out_format: 要转换到的格式,目前支持 `mp3`、`amr`、`wma`、`m4a`、`spx`、`ogg`、`wav`、`flac`
:return: { "file": (转换后的语音文件名: str)}
:rtype:... | def get_record(self, *, file, out_format):
"""
获取语音
------------
:param str file: 收到的语音文件名,如 `0B38145AA44505000B38145AA4450500.silk`
:param str out_format: 要转换到的格式,目前支持 `mp3`、`amr`、`wma`、`m4a`、`spx`、`ogg`、`wav`、`flac`
:return: { "file": (转换后的语音文件名: str)}
:rtype:... | [
"获取语音"
] | richardchien/python-cqhttp | python | https://github.com/richardchien/python-cqhttp/blob/1869819a8f89001e3f70668e31afc6c78f7f5bc2/cqhttp_helper.py#L746-L772 | [
"def",
"get_record",
"(",
"self",
",",
"*",
",",
"file",
",",
"out_format",
")",
":",
"return",
"super",
"(",
")",
".",
"__getattr__",
"(",
"'get_record'",
")",
"(",
"file",
"=",
"file",
",",
"out_format",
"=",
"out_format",
")"
] | 1869819a8f89001e3f70668e31afc6c78f7f5bc2 |
valid | CQHttp.send | 便捷回复。会根据传入的context自动判断回复对象
------------
:param dict context: 事件收到的content
:return: None
:rtype: None
------------ | cqhttp_helper.py | def send(self, context, message, **kwargs):
"""
便捷回复。会根据传入的context自动判断回复对象
------------
:param dict context: 事件收到的content
:return: None
:rtype: None
------------
"""
context = context.copy()
context['message'] = message
context.upda... | def send(self, context, message, **kwargs):
"""
便捷回复。会根据传入的context自动判断回复对象
------------
:param dict context: 事件收到的content
:return: None
:rtype: None
------------
"""
context = context.copy()
context['message'] = message
context.upda... | [
"便捷回复。会根据传入的context自动判断回复对象",
"------------",
":",
"param",
"dict",
"context",
":",
"事件收到的content",
":",
"return",
":",
"None",
":",
"rtype",
":",
"None",
"------------"
] | richardchien/python-cqhttp | python | https://github.com/richardchien/python-cqhttp/blob/1869819a8f89001e3f70668e31afc6c78f7f5bc2/cqhttp_helper.py#L936-L955 | [
"def",
"send",
"(",
"self",
",",
"context",
",",
"message",
",",
"*",
"*",
"kwargs",
")",
":",
"context",
"=",
"context",
".",
"copy",
"(",
")",
"context",
"[",
"'message'",
"]",
"=",
"message",
"context",
".",
"update",
"(",
"kwargs",
")",
"if",
"... | 1869819a8f89001e3f70668e31afc6c78f7f5bc2 |
valid | toposort_flatten | Returns a single list of dependencies. For any set returned by
toposort(), those items are sorted and appended to the result (just to
make the results deterministic). | django_seed/toposort.py | def toposort_flatten(data, sort=True):
"""Returns a single list of dependencies. For any set returned by
toposort(), those items are sorted and appended to the result (just to
make the results deterministic)."""
result = []
for d in toposort(data):
try:
result.extend((sorted if sort els... | def toposort_flatten(data, sort=True):
"""Returns a single list of dependencies. For any set returned by
toposort(), those items are sorted and appended to the result (just to
make the results deterministic)."""
result = []
for d in toposort(data):
try:
result.extend((sorted if sort els... | [
"Returns",
"a",
"single",
"list",
"of",
"dependencies",
".",
"For",
"any",
"set",
"returned",
"by",
"toposort",
"()",
"those",
"items",
"are",
"sorted",
"and",
"appended",
"to",
"the",
"result",
"(",
"just",
"to",
"make",
"the",
"results",
"deterministic",
... | Brobin/django-seed | python | https://github.com/Brobin/django-seed/blob/eb4c60a62d8c42dc52e2c48e7fd88a349770cfee/django_seed/toposort.py#L61-L72 | [
"def",
"toposort_flatten",
"(",
"data",
",",
"sort",
"=",
"True",
")",
":",
"result",
"=",
"[",
"]",
"for",
"d",
"in",
"toposort",
"(",
"data",
")",
":",
"try",
":",
"result",
".",
"extend",
"(",
"(",
"sorted",
"if",
"sort",
"else",
"list",
")",
... | eb4c60a62d8c42dc52e2c48e7fd88a349770cfee |
valid | _timezone_format | Generates a timezone aware datetime if the 'USE_TZ' setting is enabled
:param value: The datetime value
:return: A locale aware datetime | django_seed/guessers.py | def _timezone_format(value):
"""
Generates a timezone aware datetime if the 'USE_TZ' setting is enabled
:param value: The datetime value
:return: A locale aware datetime
"""
return timezone.make_aware(value, timezone.get_current_timezone()) if getattr(settings, 'USE_TZ', False) else value | def _timezone_format(value):
"""
Generates a timezone aware datetime if the 'USE_TZ' setting is enabled
:param value: The datetime value
:return: A locale aware datetime
"""
return timezone.make_aware(value, timezone.get_current_timezone()) if getattr(settings, 'USE_TZ', False) else value | [
"Generates",
"a",
"timezone",
"aware",
"datetime",
"if",
"the",
"USE_TZ",
"setting",
"is",
"enabled"
] | Brobin/django-seed | python | https://github.com/Brobin/django-seed/blob/eb4c60a62d8c42dc52e2c48e7fd88a349770cfee/django_seed/guessers.py#L11-L18 | [
"def",
"_timezone_format",
"(",
"value",
")",
":",
"return",
"timezone",
".",
"make_aware",
"(",
"value",
",",
"timezone",
".",
"get_current_timezone",
"(",
")",
")",
"if",
"getattr",
"(",
"settings",
",",
"'USE_TZ'",
",",
"False",
")",
"else",
"value"
] | eb4c60a62d8c42dc52e2c48e7fd88a349770cfee |
valid | NameGuesser.guess_format | Returns a faker method based on the field's name
:param name: | django_seed/guessers.py | def guess_format(self, name):
"""
Returns a faker method based on the field's name
:param name:
"""
name = name.lower()
faker = self.faker
if re.findall(r'^is[_A-Z]', name): return lambda x: faker.boolean()
elif re.findall(r'(_a|A)t$', name): return lambda... | def guess_format(self, name):
"""
Returns a faker method based on the field's name
:param name:
"""
name = name.lower()
faker = self.faker
if re.findall(r'^is[_A-Z]', name): return lambda x: faker.boolean()
elif re.findall(r'(_a|A)t$', name): return lambda... | [
"Returns",
"a",
"faker",
"method",
"based",
"on",
"the",
"field",
"s",
"name",
":",
"param",
"name",
":"
] | Brobin/django-seed | python | https://github.com/Brobin/django-seed/blob/eb4c60a62d8c42dc52e2c48e7fd88a349770cfee/django_seed/guessers.py#L26-L49 | [
"def",
"guess_format",
"(",
"self",
",",
"name",
")",
":",
"name",
"=",
"name",
".",
"lower",
"(",
")",
"faker",
"=",
"self",
".",
"faker",
"if",
"re",
".",
"findall",
"(",
"r'^is[_A-Z]'",
",",
"name",
")",
":",
"return",
"lambda",
"x",
":",
"faker... | eb4c60a62d8c42dc52e2c48e7fd88a349770cfee |
valid | FieldTypeGuesser.guess_format | Returns the correct faker function based on the field type
:param field: | django_seed/guessers.py | def guess_format(self, field):
"""
Returns the correct faker function based on the field type
:param field:
"""
faker = self.faker
provider = self.provider
if isinstance(field, DurationField): return lambda x: provider.duration()
if isinstance(field, UUID... | def guess_format(self, field):
"""
Returns the correct faker function based on the field type
:param field:
"""
faker = self.faker
provider = self.provider
if isinstance(field, DurationField): return lambda x: provider.duration()
if isinstance(field, UUID... | [
"Returns",
"the",
"correct",
"faker",
"function",
"based",
"on",
"the",
"field",
"type",
":",
"param",
"field",
":"
] | Brobin/django-seed | python | https://github.com/Brobin/django-seed/blob/eb4c60a62d8c42dc52e2c48e7fd88a349770cfee/django_seed/guessers.py#L61-L107 | [
"def",
"guess_format",
"(",
"self",
",",
"field",
")",
":",
"faker",
"=",
"self",
".",
"faker",
"provider",
"=",
"self",
".",
"provider",
"if",
"isinstance",
"(",
"field",
",",
"DurationField",
")",
":",
"return",
"lambda",
"x",
":",
"provider",
".",
"... | eb4c60a62d8c42dc52e2c48e7fd88a349770cfee |
valid | ModelSeeder.guess_field_formatters | Gets the formatter methods for each field using the guessers
or related object fields
:param faker: Faker factory object | django_seed/seeder.py | def guess_field_formatters(self, faker):
"""
Gets the formatter methods for each field using the guessers
or related object fields
:param faker: Faker factory object
"""
formatters = {}
name_guesser = NameGuesser(faker)
field_type_guesser = FieldTypeGuesse... | def guess_field_formatters(self, faker):
"""
Gets the formatter methods for each field using the guessers
or related object fields
:param faker: Faker factory object
"""
formatters = {}
name_guesser = NameGuesser(faker)
field_type_guesser = FieldTypeGuesse... | [
"Gets",
"the",
"formatter",
"methods",
"for",
"each",
"field",
"using",
"the",
"guessers",
"or",
"related",
"object",
"fields",
":",
"param",
"faker",
":",
"Faker",
"factory",
"object"
] | Brobin/django-seed | python | https://github.com/Brobin/django-seed/blob/eb4c60a62d8c42dc52e2c48e7fd88a349770cfee/django_seed/seeder.py#L29-L65 | [
"def",
"guess_field_formatters",
"(",
"self",
",",
"faker",
")",
":",
"formatters",
"=",
"{",
"}",
"name_guesser",
"=",
"NameGuesser",
"(",
"faker",
")",
"field_type_guesser",
"=",
"FieldTypeGuesser",
"(",
"faker",
")",
"for",
"field",
"in",
"self",
".",
"mo... | eb4c60a62d8c42dc52e2c48e7fd88a349770cfee |
valid | ModelSeeder.execute | Execute the stages entities to insert
:param using:
:param inserted_entities: | django_seed/seeder.py | def execute(self, using, inserted_entities):
"""
Execute the stages entities to insert
:param using:
:param inserted_entities:
"""
def format_field(format, inserted_entities):
if callable(format):
return format(inserted_entities)
r... | def execute(self, using, inserted_entities):
"""
Execute the stages entities to insert
:param using:
:param inserted_entities:
"""
def format_field(format, inserted_entities):
if callable(format):
return format(inserted_entities)
r... | [
"Execute",
"the",
"stages",
"entities",
"to",
"insert",
":",
"param",
"using",
":",
":",
"param",
"inserted_entities",
":"
] | Brobin/django-seed | python | https://github.com/Brobin/django-seed/blob/eb4c60a62d8c42dc52e2c48e7fd88a349770cfee/django_seed/seeder.py#L67-L103 | [
"def",
"execute",
"(",
"self",
",",
"using",
",",
"inserted_entities",
")",
":",
"def",
"format_field",
"(",
"format",
",",
"inserted_entities",
")",
":",
"if",
"callable",
"(",
"format",
")",
":",
"return",
"format",
"(",
"inserted_entities",
")",
"return",... | eb4c60a62d8c42dc52e2c48e7fd88a349770cfee |
valid | Seeder.add_entity | Add an order for the generation of $number records for $entity.
:param model: mixed A Django Model classname,
or a faker.orm.django.EntitySeeder instance
:type model: Model
:param number: int The number of entities to seed
:type number: integer
:param customFieldFormatte... | django_seed/seeder.py | def add_entity(self, model, number, customFieldFormatters=None):
"""
Add an order for the generation of $number records for $entity.
:param model: mixed A Django Model classname,
or a faker.orm.django.EntitySeeder instance
:type model: Model
:param number: int The number... | def add_entity(self, model, number, customFieldFormatters=None):
"""
Add an order for the generation of $number records for $entity.
:param model: mixed A Django Model classname,
or a faker.orm.django.EntitySeeder instance
:type model: Model
:param number: int The number... | [
"Add",
"an",
"order",
"for",
"the",
"generation",
"of",
"$number",
"records",
"for",
"$entity",
"."
] | Brobin/django-seed | python | https://github.com/Brobin/django-seed/blob/eb4c60a62d8c42dc52e2c48e7fd88a349770cfee/django_seed/seeder.py#L116-L139 | [
"def",
"add_entity",
"(",
"self",
",",
"model",
",",
"number",
",",
"customFieldFormatters",
"=",
"None",
")",
":",
"if",
"not",
"isinstance",
"(",
"model",
",",
"ModelSeeder",
")",
":",
"model",
"=",
"ModelSeeder",
"(",
"model",
")",
"model",
".",
"fiel... | eb4c60a62d8c42dc52e2c48e7fd88a349770cfee |
valid | Seeder.execute | Populate the database using all the Entity classes previously added.
:param using A Django database connection name
:rtype: A list of the inserted PKs | django_seed/seeder.py | def execute(self, using=None):
"""
Populate the database using all the Entity classes previously added.
:param using A Django database connection name
:rtype: A list of the inserted PKs
"""
if not using:
using = self.get_connection()
inserted_entitie... | def execute(self, using=None):
"""
Populate the database using all the Entity classes previously added.
:param using A Django database connection name
:rtype: A list of the inserted PKs
"""
if not using:
using = self.get_connection()
inserted_entitie... | [
"Populate",
"the",
"database",
"using",
"all",
"the",
"Entity",
"classes",
"previously",
"added",
"."
] | Brobin/django-seed | python | https://github.com/Brobin/django-seed/blob/eb4c60a62d8c42dc52e2c48e7fd88a349770cfee/django_seed/seeder.py#L141-L160 | [
"def",
"execute",
"(",
"self",
",",
"using",
"=",
"None",
")",
":",
"if",
"not",
"using",
":",
"using",
"=",
"self",
".",
"get_connection",
"(",
")",
"inserted_entities",
"=",
"{",
"}",
"for",
"klass",
"in",
"self",
".",
"orders",
":",
"number",
"=",... | eb4c60a62d8c42dc52e2c48e7fd88a349770cfee |
valid | Seeder.get_connection | use the first connection available
:rtype: Connection | django_seed/seeder.py | def get_connection(self):
"""
use the first connection available
:rtype: Connection
"""
klass = self.entities.keys()
if not klass:
message = 'No classed found. Did you add entities to the Seeder?'
raise SeederException(message)
klass = lis... | def get_connection(self):
"""
use the first connection available
:rtype: Connection
"""
klass = self.entities.keys()
if not klass:
message = 'No classed found. Did you add entities to the Seeder?'
raise SeederException(message)
klass = lis... | [
"use",
"the",
"first",
"connection",
"available",
":",
"rtype",
":",
"Connection"
] | Brobin/django-seed | python | https://github.com/Brobin/django-seed/blob/eb4c60a62d8c42dc52e2c48e7fd88a349770cfee/django_seed/seeder.py#L162-L174 | [
"def",
"get_connection",
"(",
"self",
")",
":",
"klass",
"=",
"self",
".",
"entities",
".",
"keys",
"(",
")",
"if",
"not",
"klass",
":",
"message",
"=",
"'No classed found. Did you add entities to the Seeder?'",
"raise",
"SeederException",
"(",
"message",
")",
"... | eb4c60a62d8c42dc52e2c48e7fd88a349770cfee |
valid | ADS1x15._read | Perform an ADC read with the provided mux, gain, data_rate, and mode
values. Returns the signed integer result of the read. | Adafruit_ADS1x15/ADS1x15.py | def _read(self, mux, gain, data_rate, mode):
"""Perform an ADC read with the provided mux, gain, data_rate, and mode
values. Returns the signed integer result of the read.
"""
config = ADS1x15_CONFIG_OS_SINGLE # Go out of power-down mode for conversion.
# Specify mux value.
... | def _read(self, mux, gain, data_rate, mode):
"""Perform an ADC read with the provided mux, gain, data_rate, and mode
values. Returns the signed integer result of the read.
"""
config = ADS1x15_CONFIG_OS_SINGLE # Go out of power-down mode for conversion.
# Specify mux value.
... | [
"Perform",
"an",
"ADC",
"read",
"with",
"the",
"provided",
"mux",
"gain",
"data_rate",
"and",
"mode",
"values",
".",
"Returns",
"the",
"signed",
"integer",
"result",
"of",
"the",
"read",
"."
] | adafruit/Adafruit_Python_ADS1x15 | python | https://github.com/adafruit/Adafruit_Python_ADS1x15/blob/804728974fcefaafc8b5994be65d22e9c198a8d1/Adafruit_ADS1x15/ADS1x15.py#L105-L134 | [
"def",
"_read",
"(",
"self",
",",
"mux",
",",
"gain",
",",
"data_rate",
",",
"mode",
")",
":",
"config",
"=",
"ADS1x15_CONFIG_OS_SINGLE",
"# Go out of power-down mode for conversion.",
"# Specify mux value.",
"config",
"|=",
"(",
"mux",
"&",
"0x07",
")",
"<<",
"... | 804728974fcefaafc8b5994be65d22e9c198a8d1 |
valid | ADS1x15._read_comparator | Perform an ADC read with the provided mux, gain, data_rate, and mode
values and with the comparator enabled as specified. Returns the signed
integer result of the read. | Adafruit_ADS1x15/ADS1x15.py | def _read_comparator(self, mux, gain, data_rate, mode, high_threshold,
low_threshold, active_low, traditional, latching,
num_readings):
"""Perform an ADC read with the provided mux, gain, data_rate, and mode
values and with the comparator enabled as spec... | def _read_comparator(self, mux, gain, data_rate, mode, high_threshold,
low_threshold, active_low, traditional, latching,
num_readings):
"""Perform an ADC read with the provided mux, gain, data_rate, and mode
values and with the comparator enabled as spec... | [
"Perform",
"an",
"ADC",
"read",
"with",
"the",
"provided",
"mux",
"gain",
"data_rate",
"and",
"mode",
"values",
"and",
"with",
"the",
"comparator",
"enabled",
"as",
"specified",
".",
"Returns",
"the",
"signed",
"integer",
"result",
"of",
"the",
"read",
"."
] | adafruit/Adafruit_Python_ADS1x15 | python | https://github.com/adafruit/Adafruit_Python_ADS1x15/blob/804728974fcefaafc8b5994be65d22e9c198a8d1/Adafruit_ADS1x15/ADS1x15.py#L136-L183 | [
"def",
"_read_comparator",
"(",
"self",
",",
"mux",
",",
"gain",
",",
"data_rate",
",",
"mode",
",",
"high_threshold",
",",
"low_threshold",
",",
"active_low",
",",
"traditional",
",",
"latching",
",",
"num_readings",
")",
":",
"assert",
"num_readings",
"==",
... | 804728974fcefaafc8b5994be65d22e9c198a8d1 |
valid | ADS1x15.read_adc | Read a single ADC channel and return the ADC value as a signed integer
result. Channel must be a value within 0-3. | Adafruit_ADS1x15/ADS1x15.py | def read_adc(self, channel, gain=1, data_rate=None):
"""Read a single ADC channel and return the ADC value as a signed integer
result. Channel must be a value within 0-3.
"""
assert 0 <= channel <= 3, 'Channel must be a value within 0-3!'
# Perform a single shot read and set the... | def read_adc(self, channel, gain=1, data_rate=None):
"""Read a single ADC channel and return the ADC value as a signed integer
result. Channel must be a value within 0-3.
"""
assert 0 <= channel <= 3, 'Channel must be a value within 0-3!'
# Perform a single shot read and set the... | [
"Read",
"a",
"single",
"ADC",
"channel",
"and",
"return",
"the",
"ADC",
"value",
"as",
"a",
"signed",
"integer",
"result",
".",
"Channel",
"must",
"be",
"a",
"value",
"within",
"0",
"-",
"3",
"."
] | adafruit/Adafruit_Python_ADS1x15 | python | https://github.com/adafruit/Adafruit_Python_ADS1x15/blob/804728974fcefaafc8b5994be65d22e9c198a8d1/Adafruit_ADS1x15/ADS1x15.py#L185-L192 | [
"def",
"read_adc",
"(",
"self",
",",
"channel",
",",
"gain",
"=",
"1",
",",
"data_rate",
"=",
"None",
")",
":",
"assert",
"0",
"<=",
"channel",
"<=",
"3",
",",
"'Channel must be a value within 0-3!'",
"# Perform a single shot read and set the mux value to the channel ... | 804728974fcefaafc8b5994be65d22e9c198a8d1 |
valid | ADS1x15.read_adc_difference | Read the difference between two ADC channels and return the ADC value
as a signed integer result. Differential must be one of:
- 0 = Channel 0 minus channel 1
- 1 = Channel 0 minus channel 3
- 2 = Channel 1 minus channel 3
- 3 = Channel 2 minus channel 3 | Adafruit_ADS1x15/ADS1x15.py | def read_adc_difference(self, differential, gain=1, data_rate=None):
"""Read the difference between two ADC channels and return the ADC value
as a signed integer result. Differential must be one of:
- 0 = Channel 0 minus channel 1
- 1 = Channel 0 minus channel 3
- 2 = Chan... | def read_adc_difference(self, differential, gain=1, data_rate=None):
"""Read the difference between two ADC channels and return the ADC value
as a signed integer result. Differential must be one of:
- 0 = Channel 0 minus channel 1
- 1 = Channel 0 minus channel 3
- 2 = Chan... | [
"Read",
"the",
"difference",
"between",
"two",
"ADC",
"channels",
"and",
"return",
"the",
"ADC",
"value",
"as",
"a",
"signed",
"integer",
"result",
".",
"Differential",
"must",
"be",
"one",
"of",
":",
"-",
"0",
"=",
"Channel",
"0",
"minus",
"channel",
"1... | adafruit/Adafruit_Python_ADS1x15 | python | https://github.com/adafruit/Adafruit_Python_ADS1x15/blob/804728974fcefaafc8b5994be65d22e9c198a8d1/Adafruit_ADS1x15/ADS1x15.py#L194-L205 | [
"def",
"read_adc_difference",
"(",
"self",
",",
"differential",
",",
"gain",
"=",
"1",
",",
"data_rate",
"=",
"None",
")",
":",
"assert",
"0",
"<=",
"differential",
"<=",
"3",
",",
"'Differential must be a value within 0-3!'",
"# Perform a single shot read using the p... | 804728974fcefaafc8b5994be65d22e9c198a8d1 |
valid | ADS1x15.start_adc | Start continuous ADC conversions on the specified channel (0-3). Will
return an initial conversion result, then call the get_last_result()
function to read the most recent conversion result. Call stop_adc() to
stop conversions. | Adafruit_ADS1x15/ADS1x15.py | def start_adc(self, channel, gain=1, data_rate=None):
"""Start continuous ADC conversions on the specified channel (0-3). Will
return an initial conversion result, then call the get_last_result()
function to read the most recent conversion result. Call stop_adc() to
stop conversions.
... | def start_adc(self, channel, gain=1, data_rate=None):
"""Start continuous ADC conversions on the specified channel (0-3). Will
return an initial conversion result, then call the get_last_result()
function to read the most recent conversion result. Call stop_adc() to
stop conversions.
... | [
"Start",
"continuous",
"ADC",
"conversions",
"on",
"the",
"specified",
"channel",
"(",
"0",
"-",
"3",
")",
".",
"Will",
"return",
"an",
"initial",
"conversion",
"result",
"then",
"call",
"the",
"get_last_result",
"()",
"function",
"to",
"read",
"the",
"most"... | adafruit/Adafruit_Python_ADS1x15 | python | https://github.com/adafruit/Adafruit_Python_ADS1x15/blob/804728974fcefaafc8b5994be65d22e9c198a8d1/Adafruit_ADS1x15/ADS1x15.py#L207-L216 | [
"def",
"start_adc",
"(",
"self",
",",
"channel",
",",
"gain",
"=",
"1",
",",
"data_rate",
"=",
"None",
")",
":",
"assert",
"0",
"<=",
"channel",
"<=",
"3",
",",
"'Channel must be a value within 0-3!'",
"# Start continuous reads and set the mux value to the channel plu... | 804728974fcefaafc8b5994be65d22e9c198a8d1 |
valid | ADS1x15.start_adc_difference | Start continuous ADC conversions between two ADC channels. Differential
must be one of:
- 0 = Channel 0 minus channel 1
- 1 = Channel 0 minus channel 3
- 2 = Channel 1 minus channel 3
- 3 = Channel 2 minus channel 3
Will return an initial conversion result, then c... | Adafruit_ADS1x15/ADS1x15.py | def start_adc_difference(self, differential, gain=1, data_rate=None):
"""Start continuous ADC conversions between two ADC channels. Differential
must be one of:
- 0 = Channel 0 minus channel 1
- 1 = Channel 0 minus channel 3
- 2 = Channel 1 minus channel 3
- 3 = C... | def start_adc_difference(self, differential, gain=1, data_rate=None):
"""Start continuous ADC conversions between two ADC channels. Differential
must be one of:
- 0 = Channel 0 minus channel 1
- 1 = Channel 0 minus channel 3
- 2 = Channel 1 minus channel 3
- 3 = C... | [
"Start",
"continuous",
"ADC",
"conversions",
"between",
"two",
"ADC",
"channels",
".",
"Differential",
"must",
"be",
"one",
"of",
":",
"-",
"0",
"=",
"Channel",
"0",
"minus",
"channel",
"1",
"-",
"1",
"=",
"Channel",
"0",
"minus",
"channel",
"3",
"-",
... | adafruit/Adafruit_Python_ADS1x15 | python | https://github.com/adafruit/Adafruit_Python_ADS1x15/blob/804728974fcefaafc8b5994be65d22e9c198a8d1/Adafruit_ADS1x15/ADS1x15.py#L218-L232 | [
"def",
"start_adc_difference",
"(",
"self",
",",
"differential",
",",
"gain",
"=",
"1",
",",
"data_rate",
"=",
"None",
")",
":",
"assert",
"0",
"<=",
"differential",
"<=",
"3",
",",
"'Differential must be a value within 0-3!'",
"# Perform a single shot read using the ... | 804728974fcefaafc8b5994be65d22e9c198a8d1 |
valid | ADS1x15.start_adc_comparator | Start continuous ADC conversions on the specified channel (0-3) with
the comparator enabled. When enabled the comparator to will check if
the ADC value is within the high_threshold & low_threshold value (both
should be signed 16-bit integers) and trigger the ALERT pin. The
behavior can... | Adafruit_ADS1x15/ADS1x15.py | def start_adc_comparator(self, channel, high_threshold, low_threshold,
gain=1, data_rate=None, active_low=True,
traditional=True, latching=False, num_readings=1):
"""Start continuous ADC conversions on the specified channel (0-3) with
the compara... | def start_adc_comparator(self, channel, high_threshold, low_threshold,
gain=1, data_rate=None, active_low=True,
traditional=True, latching=False, num_readings=1):
"""Start continuous ADC conversions on the specified channel (0-3) with
the compara... | [
"Start",
"continuous",
"ADC",
"conversions",
"on",
"the",
"specified",
"channel",
"(",
"0",
"-",
"3",
")",
"with",
"the",
"comparator",
"enabled",
".",
"When",
"enabled",
"the",
"comparator",
"to",
"will",
"check",
"if",
"the",
"ADC",
"value",
"is",
"withi... | adafruit/Adafruit_Python_ADS1x15 | python | https://github.com/adafruit/Adafruit_Python_ADS1x15/blob/804728974fcefaafc8b5994be65d22e9c198a8d1/Adafruit_ADS1x15/ADS1x15.py#L234-L263 | [
"def",
"start_adc_comparator",
"(",
"self",
",",
"channel",
",",
"high_threshold",
",",
"low_threshold",
",",
"gain",
"=",
"1",
",",
"data_rate",
"=",
"None",
",",
"active_low",
"=",
"True",
",",
"traditional",
"=",
"True",
",",
"latching",
"=",
"False",
"... | 804728974fcefaafc8b5994be65d22e9c198a8d1 |
valid | ADS1x15.start_adc_difference_comparator | Start continuous ADC conversions between two channels with
the comparator enabled. See start_adc_difference for valid differential
parameter values and their meaning. When enabled the comparator to will
check if the ADC value is within the high_threshold & low_threshold value
(both sho... | Adafruit_ADS1x15/ADS1x15.py | def start_adc_difference_comparator(self, differential, high_threshold, low_threshold,
gain=1, data_rate=None, active_low=True,
traditional=True, latching=False, num_readings=1):
"""Start continuous ADC conversions between two chann... | def start_adc_difference_comparator(self, differential, high_threshold, low_threshold,
gain=1, data_rate=None, active_low=True,
traditional=True, latching=False, num_readings=1):
"""Start continuous ADC conversions between two chann... | [
"Start",
"continuous",
"ADC",
"conversions",
"between",
"two",
"channels",
"with",
"the",
"comparator",
"enabled",
".",
"See",
"start_adc_difference",
"for",
"valid",
"differential",
"parameter",
"values",
"and",
"their",
"meaning",
".",
"When",
"enabled",
"the",
... | adafruit/Adafruit_Python_ADS1x15 | python | https://github.com/adafruit/Adafruit_Python_ADS1x15/blob/804728974fcefaafc8b5994be65d22e9c198a8d1/Adafruit_ADS1x15/ADS1x15.py#L265-L295 | [
"def",
"start_adc_difference_comparator",
"(",
"self",
",",
"differential",
",",
"high_threshold",
",",
"low_threshold",
",",
"gain",
"=",
"1",
",",
"data_rate",
"=",
"None",
",",
"active_low",
"=",
"True",
",",
"traditional",
"=",
"True",
",",
"latching",
"="... | 804728974fcefaafc8b5994be65d22e9c198a8d1 |
valid | ADS1x15.get_last_result | Read the last conversion result when in continuous conversion mode.
Will return a signed integer value. | Adafruit_ADS1x15/ADS1x15.py | def get_last_result(self):
"""Read the last conversion result when in continuous conversion mode.
Will return a signed integer value.
"""
# Retrieve the conversion register value, convert to a signed int, and
# return it.
result = self._device.readList(ADS1x15_POINTER_CON... | def get_last_result(self):
"""Read the last conversion result when in continuous conversion mode.
Will return a signed integer value.
"""
# Retrieve the conversion register value, convert to a signed int, and
# return it.
result = self._device.readList(ADS1x15_POINTER_CON... | [
"Read",
"the",
"last",
"conversion",
"result",
"when",
"in",
"continuous",
"conversion",
"mode",
".",
"Will",
"return",
"a",
"signed",
"integer",
"value",
"."
] | adafruit/Adafruit_Python_ADS1x15 | python | https://github.com/adafruit/Adafruit_Python_ADS1x15/blob/804728974fcefaafc8b5994be65d22e9c198a8d1/Adafruit_ADS1x15/ADS1x15.py#L305-L312 | [
"def",
"get_last_result",
"(",
"self",
")",
":",
"# Retrieve the conversion register value, convert to a signed int, and",
"# return it.",
"result",
"=",
"self",
".",
"_device",
".",
"readList",
"(",
"ADS1x15_POINTER_CONVERSION",
",",
"2",
")",
"return",
"self",
".",
"_... | 804728974fcefaafc8b5994be65d22e9c198a8d1 |
valid | remove_exited_dusty_containers | Removed all dusty containers with 'Exited' in their status | dusty/systems/docker/cleanup.py | def remove_exited_dusty_containers():
"""Removed all dusty containers with 'Exited' in their status"""
client = get_docker_client()
exited_containers = get_exited_dusty_containers()
removed_containers = []
for container in exited_containers:
log_to_client("Removing container {}".format(conta... | def remove_exited_dusty_containers():
"""Removed all dusty containers with 'Exited' in their status"""
client = get_docker_client()
exited_containers = get_exited_dusty_containers()
removed_containers = []
for container in exited_containers:
log_to_client("Removing container {}".format(conta... | [
"Removed",
"all",
"dusty",
"containers",
"with",
"Exited",
"in",
"their",
"status"
] | gamechanger/dusty | python | https://github.com/gamechanger/dusty/blob/dc12de90bb6945023d6f43a8071e984313a1d984/dusty/systems/docker/cleanup.py#L14-L26 | [
"def",
"remove_exited_dusty_containers",
"(",
")",
":",
"client",
"=",
"get_docker_client",
"(",
")",
"exited_containers",
"=",
"get_exited_dusty_containers",
"(",
")",
"removed_containers",
"=",
"[",
"]",
"for",
"container",
"in",
"exited_containers",
":",
"log_to_cl... | dc12de90bb6945023d6f43a8071e984313a1d984 |
valid | remove_images | Removes all dangling images as well as all images referenced in a dusty spec; forceful removal is not used | dusty/systems/docker/cleanup.py | def remove_images():
"""Removes all dangling images as well as all images referenced in a dusty spec; forceful removal is not used"""
client = get_docker_client()
removed = _remove_dangling_images()
dusty_images = get_dusty_images()
all_images = client.images(all=True)
for image in all_images:
... | def remove_images():
"""Removes all dangling images as well as all images referenced in a dusty spec; forceful removal is not used"""
client = get_docker_client()
removed = _remove_dangling_images()
dusty_images = get_dusty_images()
all_images = client.images(all=True)
for image in all_images:
... | [
"Removes",
"all",
"dangling",
"images",
"as",
"well",
"as",
"all",
"images",
"referenced",
"in",
"a",
"dusty",
"spec",
";",
"forceful",
"removal",
"is",
"not",
"used"
] | gamechanger/dusty | python | https://github.com/gamechanger/dusty/blob/dc12de90bb6945023d6f43a8071e984313a1d984/dusty/systems/docker/cleanup.py#L42-L57 | [
"def",
"remove_images",
"(",
")",
":",
"client",
"=",
"get_docker_client",
"(",
")",
"removed",
"=",
"_remove_dangling_images",
"(",
")",
"dusty_images",
"=",
"get_dusty_images",
"(",
")",
"all_images",
"=",
"client",
".",
"images",
"(",
"all",
"=",
"True",
... | dc12de90bb6945023d6f43a8071e984313a1d984 |
valid | update_nginx_from_config | Write the given config to disk as a Dusty sub-config
in the Nginx includes directory. Then, either start nginx
or tell it to reload its config to pick up what we've
just written. | dusty/systems/nginx/__init__.py | def update_nginx_from_config(nginx_config):
"""Write the given config to disk as a Dusty sub-config
in the Nginx includes directory. Then, either start nginx
or tell it to reload its config to pick up what we've
just written."""
logging.info('Updating nginx with new Dusty config')
temp_dir = tem... | def update_nginx_from_config(nginx_config):
"""Write the given config to disk as a Dusty sub-config
in the Nginx includes directory. Then, either start nginx
or tell it to reload its config to pick up what we've
just written."""
logging.info('Updating nginx with new Dusty config')
temp_dir = tem... | [
"Write",
"the",
"given",
"config",
"to",
"disk",
"as",
"a",
"Dusty",
"sub",
"-",
"config",
"in",
"the",
"Nginx",
"includes",
"directory",
".",
"Then",
"either",
"start",
"nginx",
"or",
"tell",
"it",
"to",
"reload",
"its",
"config",
"to",
"pick",
"up",
... | gamechanger/dusty | python | https://github.com/gamechanger/dusty/blob/dc12de90bb6945023d6f43a8071e984313a1d984/dusty/systems/nginx/__init__.py#L17-L29 | [
"def",
"update_nginx_from_config",
"(",
"nginx_config",
")",
":",
"logging",
".",
"info",
"(",
"'Updating nginx with new Dusty config'",
")",
"temp_dir",
"=",
"tempfile",
".",
"mkdtemp",
"(",
")",
"os",
".",
"mkdir",
"(",
"os",
".",
"path",
".",
"join",
"(",
... | dc12de90bb6945023d6f43a8071e984313a1d984 |
valid | _compose_restart | Well, this is annoying. Compose 1.2 shipped with the
restart functionality fucking broken, so we can't set a faster
timeout than 10 seconds (which is way too long) using Compose.
We are therefore resigned to trying to hack this together
ourselves. Lame.
Relevant fix which will make it into the next... | dusty/systems/docker/compose.py | def _compose_restart(services):
"""Well, this is annoying. Compose 1.2 shipped with the
restart functionality fucking broken, so we can't set a faster
timeout than 10 seconds (which is way too long) using Compose.
We are therefore resigned to trying to hack this together
ourselves. Lame.
Releva... | def _compose_restart(services):
"""Well, this is annoying. Compose 1.2 shipped with the
restart functionality fucking broken, so we can't set a faster
timeout than 10 seconds (which is way too long) using Compose.
We are therefore resigned to trying to hack this together
ourselves. Lame.
Releva... | [
"Well",
"this",
"is",
"annoying",
".",
"Compose",
"1",
".",
"2",
"shipped",
"with",
"the",
"restart",
"functionality",
"fucking",
"broken",
"so",
"we",
"can",
"t",
"set",
"a",
"faster",
"timeout",
"than",
"10",
"seconds",
"(",
"which",
"is",
"way",
"too"... | gamechanger/dusty | python | https://github.com/gamechanger/dusty/blob/dc12de90bb6945023d6f43a8071e984313a1d984/dusty/systems/docker/compose.py#L64-L93 | [
"def",
"_compose_restart",
"(",
"services",
")",
":",
"def",
"_restart_container",
"(",
"client",
",",
"container",
")",
":",
"log_to_client",
"(",
"'Restarting {}'",
".",
"format",
"(",
"get_canonical_container_name",
"(",
"container",
")",
")",
")",
"client",
... | dc12de90bb6945023d6f43a8071e984313a1d984 |
valid | update_running_containers_from_spec | Takes in a Compose spec from the Dusty Compose compiler,
writes it to the Compose spec folder so Compose can pick it
up, then does everything needed to make sure the Docker VM is
up and running containers with the updated config. | dusty/systems/docker/compose.py | def update_running_containers_from_spec(compose_config, recreate_containers=True):
"""Takes in a Compose spec from the Dusty Compose compiler,
writes it to the Compose spec folder so Compose can pick it
up, then does everything needed to make sure the Docker VM is
up and running containers with the upda... | def update_running_containers_from_spec(compose_config, recreate_containers=True):
"""Takes in a Compose spec from the Dusty Compose compiler,
writes it to the Compose spec folder so Compose can pick it
up, then does everything needed to make sure the Docker VM is
up and running containers with the upda... | [
"Takes",
"in",
"a",
"Compose",
"spec",
"from",
"the",
"Dusty",
"Compose",
"compiler",
"writes",
"it",
"to",
"the",
"Compose",
"spec",
"folder",
"so",
"Compose",
"can",
"pick",
"it",
"up",
"then",
"does",
"everything",
"needed",
"to",
"make",
"sure",
"the",... | gamechanger/dusty | python | https://github.com/gamechanger/dusty/blob/dc12de90bb6945023d6f43a8071e984313a1d984/dusty/systems/docker/compose.py#L95-L101 | [
"def",
"update_running_containers_from_spec",
"(",
"compose_config",
",",
"recreate_containers",
"=",
"True",
")",
":",
"write_composefile",
"(",
"compose_config",
",",
"constants",
".",
"COMPOSEFILE_PATH",
")",
"compose_up",
"(",
"constants",
".",
"COMPOSEFILE_PATH",
"... | dc12de90bb6945023d6f43a8071e984313a1d984 |
valid | Repo.resolve | We require the list of all remote repo paths to be passed in
to this because otherwise we would need to import the spec assembler
in this module, which would give us circular imports. | dusty/source.py | def resolve(cls, all_known_repos, name):
"""We require the list of all remote repo paths to be passed in
to this because otherwise we would need to import the spec assembler
in this module, which would give us circular imports."""
match = None
for repo in all_known_repos:
... | def resolve(cls, all_known_repos, name):
"""We require the list of all remote repo paths to be passed in
to this because otherwise we would need to import the spec assembler
in this module, which would give us circular imports."""
match = None
for repo in all_known_repos:
... | [
"We",
"require",
"the",
"list",
"of",
"all",
"remote",
"repo",
"paths",
"to",
"be",
"passed",
"in",
"to",
"this",
"because",
"otherwise",
"we",
"would",
"need",
"to",
"import",
"the",
"spec",
"assembler",
"in",
"this",
"module",
"which",
"would",
"give",
... | gamechanger/dusty | python | https://github.com/gamechanger/dusty/blob/dc12de90bb6945023d6f43a8071e984313a1d984/dusty/source.py#L43-L60 | [
"def",
"resolve",
"(",
"cls",
",",
"all_known_repos",
",",
"name",
")",
":",
"match",
"=",
"None",
"for",
"repo",
"in",
"all_known_repos",
":",
"if",
"repo",
".",
"remote_path",
"==",
"name",
":",
"# user passed in a full name",
"return",
"repo",
"if",
"name... | dc12de90bb6945023d6f43a8071e984313a1d984 |
valid | Repo.ensure_local_repo | Given a Dusty repo object, clone the remote into Dusty's local repos
directory if it does not already exist. | dusty/source.py | def ensure_local_repo(self):
"""Given a Dusty repo object, clone the remote into Dusty's local repos
directory if it does not already exist."""
if os.path.exists(self.managed_path):
logging.debug('Repo {} already exists'.format(self.remote_path))
return
logging.i... | def ensure_local_repo(self):
"""Given a Dusty repo object, clone the remote into Dusty's local repos
directory if it does not already exist."""
if os.path.exists(self.managed_path):
logging.debug('Repo {} already exists'.format(self.remote_path))
return
logging.i... | [
"Given",
"a",
"Dusty",
"repo",
"object",
"clone",
"the",
"remote",
"into",
"Dusty",
"s",
"local",
"repos",
"directory",
"if",
"it",
"does",
"not",
"already",
"exist",
"."
] | gamechanger/dusty | python | https://github.com/gamechanger/dusty/blob/dc12de90bb6945023d6f43a8071e984313a1d984/dusty/source.py#L126-L139 | [
"def",
"ensure_local_repo",
"(",
"self",
")",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"self",
".",
"managed_path",
")",
":",
"logging",
".",
"debug",
"(",
"'Repo {} already exists'",
".",
"format",
"(",
"self",
".",
"remote_path",
")",
")",
"re... | dc12de90bb6945023d6f43a8071e984313a1d984 |
valid | Repo.update_local_repo | Given a remote path (e.g. github.com/gamechanger/gclib), pull the latest
commits from master to bring the local copy up to date. | dusty/source.py | def update_local_repo(self, force=False):
"""Given a remote path (e.g. github.com/gamechanger/gclib), pull the latest
commits from master to bring the local copy up to date."""
self.ensure_local_repo()
logging.info('Updating local repo {}'.format(self.remote_path))
managed_repo... | def update_local_repo(self, force=False):
"""Given a remote path (e.g. github.com/gamechanger/gclib), pull the latest
commits from master to bring the local copy up to date."""
self.ensure_local_repo()
logging.info('Updating local repo {}'.format(self.remote_path))
managed_repo... | [
"Given",
"a",
"remote",
"path",
"(",
"e",
".",
"g",
".",
"github",
".",
"com",
"/",
"gamechanger",
"/",
"gclib",
")",
"pull",
"the",
"latest",
"commits",
"from",
"master",
"to",
"bring",
"the",
"local",
"copy",
"up",
"to",
"date",
"."
] | gamechanger/dusty | python | https://github.com/gamechanger/dusty/blob/dc12de90bb6945023d6f43a8071e984313a1d984/dusty/source.py#L159-L178 | [
"def",
"update_local_repo",
"(",
"self",
",",
"force",
"=",
"False",
")",
":",
"self",
".",
"ensure_local_repo",
"(",
")",
"logging",
".",
"info",
"(",
"'Updating local repo {}'",
".",
"format",
"(",
"self",
".",
"remote_path",
")",
")",
"managed_repo",
"=",... | dc12de90bb6945023d6f43a8071e984313a1d984 |
valid | Repo.update_local_repo_async | Local repo updating suitable for asynchronous, parallel execution.
We still need to run `ensure_local_repo` synchronously because it
does a bunch of non-threadsafe filesystem operations. | dusty/source.py | def update_local_repo_async(self, task_queue, force=False):
"""Local repo updating suitable for asynchronous, parallel execution.
We still need to run `ensure_local_repo` synchronously because it
does a bunch of non-threadsafe filesystem operations."""
self.ensure_local_repo()
ta... | def update_local_repo_async(self, task_queue, force=False):
"""Local repo updating suitable for asynchronous, parallel execution.
We still need to run `ensure_local_repo` synchronously because it
does a bunch of non-threadsafe filesystem operations."""
self.ensure_local_repo()
ta... | [
"Local",
"repo",
"updating",
"suitable",
"for",
"asynchronous",
"parallel",
"execution",
".",
"We",
"still",
"need",
"to",
"run",
"ensure_local_repo",
"synchronously",
"because",
"it",
"does",
"a",
"bunch",
"of",
"non",
"-",
"threadsafe",
"filesystem",
"operations... | gamechanger/dusty | python | https://github.com/gamechanger/dusty/blob/dc12de90bb6945023d6f43a8071e984313a1d984/dusty/source.py#L180-L185 | [
"def",
"update_local_repo_async",
"(",
"self",
",",
"task_queue",
",",
"force",
"=",
"False",
")",
":",
"self",
".",
"ensure_local_repo",
"(",
")",
"task_queue",
".",
"enqueue_task",
"(",
"self",
".",
"update_local_repo",
",",
"force",
"=",
"force",
")"
] | dc12de90bb6945023d6f43a8071e984313a1d984 |
valid | nfs_path_exists | The normal HFS file system that your mac uses does not work the same way
as the NFS file system. In HFS, capitalization does not matter, but in
NFS it does. This function checks if a folder exists in HFS file system
using NFS semantics (case sensitive) | dusty/commands/repos.py | def nfs_path_exists(path):
"""
The normal HFS file system that your mac uses does not work the same way
as the NFS file system. In HFS, capitalization does not matter, but in
NFS it does. This function checks if a folder exists in HFS file system
using NFS semantics (case sensitive)... | def nfs_path_exists(path):
"""
The normal HFS file system that your mac uses does not work the same way
as the NFS file system. In HFS, capitalization does not matter, but in
NFS it does. This function checks if a folder exists in HFS file system
using NFS semantics (case sensitive)... | [
"The",
"normal",
"HFS",
"file",
"system",
"that",
"your",
"mac",
"uses",
"does",
"not",
"work",
"the",
"same",
"way",
"as",
"the",
"NFS",
"file",
"system",
".",
"In",
"HFS",
"capitalization",
"does",
"not",
"matter",
"but",
"in",
"NFS",
"it",
"does",
"... | gamechanger/dusty | python | https://github.com/gamechanger/dusty/blob/dc12de90bb6945023d6f43a8071e984313a1d984/dusty/commands/repos.py#L24-L37 | [
"def",
"nfs_path_exists",
"(",
"path",
")",
":",
"split_path",
"=",
"path",
".",
"lstrip",
"(",
"'/'",
")",
".",
"split",
"(",
"'/'",
")",
"recreated_path",
"=",
"'/'",
"for",
"path_element",
"in",
"split_path",
":",
"if",
"path_element",
"not",
"in",
"o... | dc12de90bb6945023d6f43a8071e984313a1d984 |
valid | update_managed_repos | For any active, managed repos, update the Dusty-managed
copy to bring it up to date with the latest master. | dusty/commands/repos.py | def update_managed_repos(force=False):
"""For any active, managed repos, update the Dusty-managed
copy to bring it up to date with the latest master."""
log_to_client('Pulling latest updates for all active managed repos:')
update_specs_repo_and_known_hosts()
repos_to_update = get_all_repos(active_on... | def update_managed_repos(force=False):
"""For any active, managed repos, update the Dusty-managed
copy to bring it up to date with the latest master."""
log_to_client('Pulling latest updates for all active managed repos:')
update_specs_repo_and_known_hosts()
repos_to_update = get_all_repos(active_on... | [
"For",
"any",
"active",
"managed",
"repos",
"update",
"the",
"Dusty",
"-",
"managed",
"copy",
"to",
"bring",
"it",
"up",
"to",
"date",
"with",
"the",
"latest",
"master",
"."
] | gamechanger/dusty | python | https://github.com/gamechanger/dusty/blob/dc12de90bb6945023d6f43a8071e984313a1d984/dusty/commands/repos.py#L100-L110 | [
"def",
"update_managed_repos",
"(",
"force",
"=",
"False",
")",
":",
"log_to_client",
"(",
"'Pulling latest updates for all active managed repos:'",
")",
"update_specs_repo_and_known_hosts",
"(",
")",
"repos_to_update",
"=",
"get_all_repos",
"(",
"active_only",
"=",
"True",... | dc12de90bb6945023d6f43a8071e984313a1d984 |
valid | prep_for_start_local_env | Daemon-side command to ensure we're running the latest
versions of any managed repos, including the
specs repo, before we do anything else in the up flow. | dusty/commands/run.py | def prep_for_start_local_env(pull_repos):
"""Daemon-side command to ensure we're running the latest
versions of any managed repos, including the
specs repo, before we do anything else in the up flow."""
if pull_repos:
update_managed_repos(force=True)
assembled_spec = spec_assembler.get_assem... | def prep_for_start_local_env(pull_repos):
"""Daemon-side command to ensure we're running the latest
versions of any managed repos, including the
specs repo, before we do anything else in the up flow."""
if pull_repos:
update_managed_repos(force=True)
assembled_spec = spec_assembler.get_assem... | [
"Daemon",
"-",
"side",
"command",
"to",
"ensure",
"we",
"re",
"running",
"the",
"latest",
"versions",
"of",
"any",
"managed",
"repos",
"including",
"the",
"specs",
"repo",
"before",
"we",
"do",
"anything",
"else",
"in",
"the",
"up",
"flow",
"."
] | gamechanger/dusty | python | https://github.com/gamechanger/dusty/blob/dc12de90bb6945023d6f43a8071e984313a1d984/dusty/commands/run.py#L21-L30 | [
"def",
"prep_for_start_local_env",
"(",
"pull_repos",
")",
":",
"if",
"pull_repos",
":",
"update_managed_repos",
"(",
"force",
"=",
"True",
")",
"assembled_spec",
"=",
"spec_assembler",
".",
"get_assembled_specs",
"(",
")",
"if",
"not",
"assembled_spec",
"[",
"con... | dc12de90bb6945023d6f43a8071e984313a1d984 |
valid | log_in_to_required_registries | Client-side command which runs the user through a login flow
(via the Docker command-line client so auth is persisted)
for any registries of active images which require a login. This
is based on the `image_requires_login` key in the individual specs. | dusty/commands/run.py | def log_in_to_required_registries():
"""Client-side command which runs the user through a login flow
(via the Docker command-line client so auth is persisted)
for any registries of active images which require a login. This
is based on the `image_requires_login` key in the individual specs."""
regist... | def log_in_to_required_registries():
"""Client-side command which runs the user through a login flow
(via the Docker command-line client so auth is persisted)
for any registries of active images which require a login. This
is based on the `image_requires_login` key in the individual specs."""
regist... | [
"Client",
"-",
"side",
"command",
"which",
"runs",
"the",
"user",
"through",
"a",
"login",
"flow",
"(",
"via",
"the",
"Docker",
"command",
"-",
"line",
"client",
"so",
"auth",
"is",
"persisted",
")",
"for",
"any",
"registries",
"of",
"active",
"images",
... | gamechanger/dusty | python | https://github.com/gamechanger/dusty/blob/dc12de90bb6945023d6f43a8071e984313a1d984/dusty/commands/run.py#L32-L44 | [
"def",
"log_in_to_required_registries",
"(",
")",
":",
"registries",
"=",
"set",
"(",
")",
"specs",
"=",
"spec_assembler",
".",
"get_assembled_specs",
"(",
")",
"for",
"spec",
"in",
"specs",
".",
"get_apps_and_services",
"(",
")",
":",
"if",
"'image'",
"in",
... | dc12de90bb6945023d6f43a8071e984313a1d984 |
valid | start_local_env | This command will use the compilers to get compose specs
will pass those specs to the systems that need them. Those
systems will in turn launch the services needed to make the
local environment go. | dusty/commands/run.py | def start_local_env(recreate_containers):
"""This command will use the compilers to get compose specs
will pass those specs to the systems that need them. Those
systems will in turn launch the services needed to make the
local environment go."""
assembled_spec = spec_assembler.get_assembled_specs()... | def start_local_env(recreate_containers):
"""This command will use the compilers to get compose specs
will pass those specs to the systems that need them. Those
systems will in turn launch the services needed to make the
local environment go."""
assembled_spec = spec_assembler.get_assembled_specs()... | [
"This",
"command",
"will",
"use",
"the",
"compilers",
"to",
"get",
"compose",
"specs",
"will",
"pass",
"those",
"specs",
"to",
"the",
"systems",
"that",
"need",
"them",
".",
"Those",
"systems",
"will",
"in",
"turn",
"launch",
"the",
"services",
"needed",
"... | gamechanger/dusty | python | https://github.com/gamechanger/dusty/blob/dc12de90bb6945023d6f43a8071e984313a1d984/dusty/commands/run.py#L47-L96 | [
"def",
"start_local_env",
"(",
"recreate_containers",
")",
":",
"assembled_spec",
"=",
"spec_assembler",
".",
"get_assembled_specs",
"(",
")",
"required_absent_assets",
"=",
"virtualbox",
".",
"required_absent_assets",
"(",
"assembled_spec",
")",
"if",
"required_absent_as... | dc12de90bb6945023d6f43a8071e984313a1d984 |
valid | stop_apps_or_services | Stop any currently running Docker containers associated with
Dusty, or associated with the provided apps_or_services. Does not remove
the service's containers. | dusty/commands/run.py | def stop_apps_or_services(app_or_service_names=None, rm_containers=False):
"""Stop any currently running Docker containers associated with
Dusty, or associated with the provided apps_or_services. Does not remove
the service's containers."""
if app_or_service_names:
log_to_client("Stopping the fo... | def stop_apps_or_services(app_or_service_names=None, rm_containers=False):
"""Stop any currently running Docker containers associated with
Dusty, or associated with the provided apps_or_services. Does not remove
the service's containers."""
if app_or_service_names:
log_to_client("Stopping the fo... | [
"Stop",
"any",
"currently",
"running",
"Docker",
"containers",
"associated",
"with",
"Dusty",
"or",
"associated",
"with",
"the",
"provided",
"apps_or_services",
".",
"Does",
"not",
"remove",
"the",
"service",
"s",
"containers",
"."
] | gamechanger/dusty | python | https://github.com/gamechanger/dusty/blob/dc12de90bb6945023d6f43a8071e984313a1d984/dusty/commands/run.py#L99-L110 | [
"def",
"stop_apps_or_services",
"(",
"app_or_service_names",
"=",
"None",
",",
"rm_containers",
"=",
"False",
")",
":",
"if",
"app_or_service_names",
":",
"log_to_client",
"(",
"\"Stopping the following apps or services: {}\"",
".",
"format",
"(",
"', '",
".",
"join",
... | dc12de90bb6945023d6f43a8071e984313a1d984 |
valid | restart_apps_or_services | Restart any containers associated with Dusty, or associated with
the provided app_or_service_names. | dusty/commands/run.py | def restart_apps_or_services(app_or_service_names=None):
"""Restart any containers associated with Dusty, or associated with
the provided app_or_service_names."""
if app_or_service_names:
log_to_client("Restarting the following apps or services: {}".format(', '.join(app_or_service_names)))
else:... | def restart_apps_or_services(app_or_service_names=None):
"""Restart any containers associated with Dusty, or associated with
the provided app_or_service_names."""
if app_or_service_names:
log_to_client("Restarting the following apps or services: {}".format(', '.join(app_or_service_names)))
else:... | [
"Restart",
"any",
"containers",
"associated",
"with",
"Dusty",
"or",
"associated",
"with",
"the",
"provided",
"app_or_service_names",
"."
] | gamechanger/dusty | python | https://github.com/gamechanger/dusty/blob/dc12de90bb6945023d6f43a8071e984313a1d984/dusty/commands/run.py#L113-L131 | [
"def",
"restart_apps_or_services",
"(",
"app_or_service_names",
"=",
"None",
")",
":",
"if",
"app_or_service_names",
":",
"log_to_client",
"(",
"\"Restarting the following apps or services: {}\"",
".",
"format",
"(",
"', '",
".",
"join",
"(",
"app_or_service_names",
")",
... | dc12de90bb6945023d6f43a8071e984313a1d984 |
valid | case_insensitive_rename | A hack to allow us to rename paths in a case-insensitive filesystem like HFS. | dusty/path.py | def case_insensitive_rename(src, dst):
"""A hack to allow us to rename paths in a case-insensitive filesystem like HFS."""
temp_dir = tempfile.mkdtemp()
shutil.rmtree(temp_dir)
shutil.move(src, temp_dir)
shutil.move(temp_dir, dst) | def case_insensitive_rename(src, dst):
"""A hack to allow us to rename paths in a case-insensitive filesystem like HFS."""
temp_dir = tempfile.mkdtemp()
shutil.rmtree(temp_dir)
shutil.move(src, temp_dir)
shutil.move(temp_dir, dst) | [
"A",
"hack",
"to",
"allow",
"us",
"to",
"rename",
"paths",
"in",
"a",
"case",
"-",
"insensitive",
"filesystem",
"like",
"HFS",
"."
] | gamechanger/dusty | python | https://github.com/gamechanger/dusty/blob/dc12de90bb6945023d6f43a8071e984313a1d984/dusty/path.py#L31-L36 | [
"def",
"case_insensitive_rename",
"(",
"src",
",",
"dst",
")",
":",
"temp_dir",
"=",
"tempfile",
".",
"mkdtemp",
"(",
")",
"shutil",
".",
"rmtree",
"(",
"temp_dir",
")",
"shutil",
".",
"move",
"(",
"src",
",",
"temp_dir",
")",
"shutil",
".",
"move",
"(... | dc12de90bb6945023d6f43a8071e984313a1d984 |
valid | _compose_dict_for_nginx | Return a dictionary containing the Compose spec required to run
Dusty's nginx container used for host forwarding. | dusty/compiler/compose/__init__.py | def _compose_dict_for_nginx(port_specs):
"""Return a dictionary containing the Compose spec required to run
Dusty's nginx container used for host forwarding."""
spec = {'image': constants.NGINX_IMAGE,
'volumes': ['{}:{}'.format(constants.NGINX_CONFIG_DIR_IN_VM, constants.NGINX_CONFIG_DIR_IN_CONT... | def _compose_dict_for_nginx(port_specs):
"""Return a dictionary containing the Compose spec required to run
Dusty's nginx container used for host forwarding."""
spec = {'image': constants.NGINX_IMAGE,
'volumes': ['{}:{}'.format(constants.NGINX_CONFIG_DIR_IN_VM, constants.NGINX_CONFIG_DIR_IN_CONT... | [
"Return",
"a",
"dictionary",
"containing",
"the",
"Compose",
"spec",
"required",
"to",
"run",
"Dusty",
"s",
"nginx",
"container",
"used",
"for",
"host",
"forwarding",
"."
] | gamechanger/dusty | python | https://github.com/gamechanger/dusty/blob/dc12de90bb6945023d6f43a8071e984313a1d984/dusty/compiler/compose/__init__.py#L17-L29 | [
"def",
"_compose_dict_for_nginx",
"(",
"port_specs",
")",
":",
"spec",
"=",
"{",
"'image'",
":",
"constants",
".",
"NGINX_IMAGE",
",",
"'volumes'",
":",
"[",
"'{}:{}'",
".",
"format",
"(",
"constants",
".",
"NGINX_CONFIG_DIR_IN_VM",
",",
"constants",
".",
"NGI... | dc12de90bb6945023d6f43a8071e984313a1d984 |
valid | get_compose_dict | This function returns a dictionary representation of a docker-compose.yml file, based on assembled_specs from
the spec_assembler, and port_specs from the port_spec compiler | dusty/compiler/compose/__init__.py | def get_compose_dict(assembled_specs, port_specs):
""" This function returns a dictionary representation of a docker-compose.yml file, based on assembled_specs from
the spec_assembler, and port_specs from the port_spec compiler """
compose_dict = _compose_dict_for_nginx(port_specs)
for app_name in assem... | def get_compose_dict(assembled_specs, port_specs):
""" This function returns a dictionary representation of a docker-compose.yml file, based on assembled_specs from
the spec_assembler, and port_specs from the port_spec compiler """
compose_dict = _compose_dict_for_nginx(port_specs)
for app_name in assem... | [
"This",
"function",
"returns",
"a",
"dictionary",
"representation",
"of",
"a",
"docker",
"-",
"compose",
".",
"yml",
"file",
"based",
"on",
"assembled_specs",
"from",
"the",
"spec_assembler",
"and",
"port_specs",
"from",
"the",
"port_spec",
"compiler"
] | gamechanger/dusty | python | https://github.com/gamechanger/dusty/blob/dc12de90bb6945023d6f43a8071e984313a1d984/dusty/compiler/compose/__init__.py#L31-L39 | [
"def",
"get_compose_dict",
"(",
"assembled_specs",
",",
"port_specs",
")",
":",
"compose_dict",
"=",
"_compose_dict_for_nginx",
"(",
"port_specs",
")",
"for",
"app_name",
"in",
"assembled_specs",
"[",
"'apps'",
"]",
".",
"keys",
"(",
")",
":",
"compose_dict",
"[... | dc12de90bb6945023d6f43a8071e984313a1d984 |
valid | _conditional_links | Given the assembled specs and app_name, this function will return all apps and services specified in
'conditional_links' if they are specified in 'apps' or 'services' in assembled_specs. That means that
some other part of the system has declared them as necessary, so they should be linked to this app | dusty/compiler/compose/__init__.py | def _conditional_links(assembled_specs, app_name):
""" Given the assembled specs and app_name, this function will return all apps and services specified in
'conditional_links' if they are specified in 'apps' or 'services' in assembled_specs. That means that
some other part of the system has declared them as... | def _conditional_links(assembled_specs, app_name):
""" Given the assembled specs and app_name, this function will return all apps and services specified in
'conditional_links' if they are specified in 'apps' or 'services' in assembled_specs. That means that
some other part of the system has declared them as... | [
"Given",
"the",
"assembled",
"specs",
"and",
"app_name",
"this",
"function",
"will",
"return",
"all",
"apps",
"and",
"services",
"specified",
"in",
"conditional_links",
"if",
"they",
"are",
"specified",
"in",
"apps",
"or",
"services",
"in",
"assembled_specs",
".... | gamechanger/dusty | python | https://github.com/gamechanger/dusty/blob/dc12de90bb6945023d6f43a8071e984313a1d984/dusty/compiler/compose/__init__.py#L56-L68 | [
"def",
"_conditional_links",
"(",
"assembled_specs",
",",
"app_name",
")",
":",
"link_to_apps",
"=",
"[",
"]",
"potential_links",
"=",
"assembled_specs",
"[",
"'apps'",
"]",
"[",
"app_name",
"]",
"[",
"'conditional_links'",
"]",
"for",
"potential_link",
"in",
"p... | dc12de90bb6945023d6f43a8071e984313a1d984 |
valid | _get_build_path | Given a spec for an app, returns the value of the `build` field for docker-compose.
If the path is relative, it is expanded and added to the path of the app's repo. | dusty/compiler/compose/__init__.py | def _get_build_path(app_spec):
""" Given a spec for an app, returns the value of the `build` field for docker-compose.
If the path is relative, it is expanded and added to the path of the app's repo. """
if os.path.isabs(app_spec['build']):
return app_spec['build']
return os.path.join(Repo(app_s... | def _get_build_path(app_spec):
""" Given a spec for an app, returns the value of the `build` field for docker-compose.
If the path is relative, it is expanded and added to the path of the app's repo. """
if os.path.isabs(app_spec['build']):
return app_spec['build']
return os.path.join(Repo(app_s... | [
"Given",
"a",
"spec",
"for",
"an",
"app",
"returns",
"the",
"value",
"of",
"the",
"build",
"field",
"for",
"docker",
"-",
"compose",
".",
"If",
"the",
"path",
"is",
"relative",
"it",
"is",
"expanded",
"and",
"added",
"to",
"the",
"path",
"of",
"the",
... | gamechanger/dusty | python | https://github.com/gamechanger/dusty/blob/dc12de90bb6945023d6f43a8071e984313a1d984/dusty/compiler/compose/__init__.py#L70-L75 | [
"def",
"_get_build_path",
"(",
"app_spec",
")",
":",
"if",
"os",
".",
"path",
".",
"isabs",
"(",
"app_spec",
"[",
"'build'",
"]",
")",
":",
"return",
"app_spec",
"[",
"'build'",
"]",
"return",
"os",
".",
"path",
".",
"join",
"(",
"Repo",
"(",
"app_sp... | dc12de90bb6945023d6f43a8071e984313a1d984 |
valid | _composed_app_dict | This function returns a dictionary of the docker-compose.yml specifications for one app | dusty/compiler/compose/__init__.py | def _composed_app_dict(app_name, assembled_specs, port_specs):
""" This function returns a dictionary of the docker-compose.yml specifications for one app """
logging.info("Compose Compiler: Compiling dict for app {}".format(app_name))
app_spec = assembled_specs['apps'][app_name]
compose_dict = app_spec... | def _composed_app_dict(app_name, assembled_specs, port_specs):
""" This function returns a dictionary of the docker-compose.yml specifications for one app """
logging.info("Compose Compiler: Compiling dict for app {}".format(app_name))
app_spec = assembled_specs['apps'][app_name]
compose_dict = app_spec... | [
"This",
"function",
"returns",
"a",
"dictionary",
"of",
"the",
"docker",
"-",
"compose",
".",
"yml",
"specifications",
"for",
"one",
"app"
] | gamechanger/dusty | python | https://github.com/gamechanger/dusty/blob/dc12de90bb6945023d6f43a8071e984313a1d984/dusty/compiler/compose/__init__.py#L101-L129 | [
"def",
"_composed_app_dict",
"(",
"app_name",
",",
"assembled_specs",
",",
"port_specs",
")",
":",
"logging",
".",
"info",
"(",
"\"Compose Compiler: Compiling dict for app {}\"",
".",
"format",
"(",
"app_name",
")",
")",
"app_spec",
"=",
"assembled_specs",
"[",
"'ap... | dc12de90bb6945023d6f43a8071e984313a1d984 |
valid | _composed_service_dict | This function returns a dictionary of the docker_compose specifications
for one service. Currently, this is just the Dusty service spec with
an additional volume mount to support Dusty's cp functionality. | dusty/compiler/compose/__init__.py | def _composed_service_dict(service_spec):
"""This function returns a dictionary of the docker_compose specifications
for one service. Currently, this is just the Dusty service spec with
an additional volume mount to support Dusty's cp functionality."""
compose_dict = service_spec.plain_dict()
_apply... | def _composed_service_dict(service_spec):
"""This function returns a dictionary of the docker_compose specifications
for one service. Currently, this is just the Dusty service spec with
an additional volume mount to support Dusty's cp functionality."""
compose_dict = service_spec.plain_dict()
_apply... | [
"This",
"function",
"returns",
"a",
"dictionary",
"of",
"the",
"docker_compose",
"specifications",
"for",
"one",
"service",
".",
"Currently",
"this",
"is",
"just",
"the",
"Dusty",
"service",
"spec",
"with",
"an",
"additional",
"volume",
"mount",
"to",
"support",... | gamechanger/dusty | python | https://github.com/gamechanger/dusty/blob/dc12de90bb6945023d6f43a8071e984313a1d984/dusty/compiler/compose/__init__.py#L131-L139 | [
"def",
"_composed_service_dict",
"(",
"service_spec",
")",
":",
"compose_dict",
"=",
"service_spec",
".",
"plain_dict",
"(",
")",
"_apply_env_overrides",
"(",
"env_overrides_for_app_or_service",
"(",
"service_spec",
".",
"name",
")",
",",
"compose_dict",
")",
"compose... | dc12de90bb6945023d6f43a8071e984313a1d984 |
valid | _get_ports_list | Returns a list of formatted port mappings for an app | dusty/compiler/compose/__init__.py | def _get_ports_list(app_name, port_specs):
""" Returns a list of formatted port mappings for an app """
if app_name not in port_specs['docker_compose']:
return []
return ["{}:{}".format(port_spec['mapped_host_port'], port_spec['in_container_port'])
for port_spec in port_specs['docker_com... | def _get_ports_list(app_name, port_specs):
""" Returns a list of formatted port mappings for an app """
if app_name not in port_specs['docker_compose']:
return []
return ["{}:{}".format(port_spec['mapped_host_port'], port_spec['in_container_port'])
for port_spec in port_specs['docker_com... | [
"Returns",
"a",
"list",
"of",
"formatted",
"port",
"mappings",
"for",
"an",
"app"
] | gamechanger/dusty | python | https://github.com/gamechanger/dusty/blob/dc12de90bb6945023d6f43a8071e984313a1d984/dusty/compiler/compose/__init__.py#L141-L146 | [
"def",
"_get_ports_list",
"(",
"app_name",
",",
"port_specs",
")",
":",
"if",
"app_name",
"not",
"in",
"port_specs",
"[",
"'docker_compose'",
"]",
":",
"return",
"[",
"]",
"return",
"[",
"\"{}:{}\"",
".",
"format",
"(",
"port_spec",
"[",
"'mapped_host_port'",
... | dc12de90bb6945023d6f43a8071e984313a1d984 |
valid | _get_compose_volumes | This returns formatted volume specifications for a docker-compose app. We mount the app
as well as any libs it needs so that local code is used in our container, instead of whatever
code was in the docker image.
Additionally, we create a volume for the /cp directory used by Dusty to facilitate
easy fil... | dusty/compiler/compose/__init__.py | def _get_compose_volumes(app_name, assembled_specs):
""" This returns formatted volume specifications for a docker-compose app. We mount the app
as well as any libs it needs so that local code is used in our container, instead of whatever
code was in the docker image.
Additionally, we create a volume f... | def _get_compose_volumes(app_name, assembled_specs):
""" This returns formatted volume specifications for a docker-compose app. We mount the app
as well as any libs it needs so that local code is used in our container, instead of whatever
code was in the docker image.
Additionally, we create a volume f... | [
"This",
"returns",
"formatted",
"volume",
"specifications",
"for",
"a",
"docker",
"-",
"compose",
"app",
".",
"We",
"mount",
"the",
"app",
"as",
"well",
"as",
"any",
"libs",
"it",
"needs",
"so",
"that",
"local",
"code",
"is",
"used",
"in",
"our",
"contai... | gamechanger/dusty | python | https://github.com/gamechanger/dusty/blob/dc12de90bb6945023d6f43a8071e984313a1d984/dusty/compiler/compose/__init__.py#L148-L158 | [
"def",
"_get_compose_volumes",
"(",
"app_name",
",",
"assembled_specs",
")",
":",
"volumes",
"=",
"[",
"]",
"volumes",
".",
"append",
"(",
"_get_cp_volume_mount",
"(",
"app_name",
")",
")",
"volumes",
"+=",
"get_app_volume_mounts",
"(",
"app_name",
",",
"assembl... | dc12de90bb6945023d6f43a8071e984313a1d984 |
valid | validate_specs_from_path | Validates Dusty specs at the given path. The following checks are performed:
-That the given path exists
-That there are bundles in the given path
-That the fields in the specs match those allowed in our schemas
-That references to apps, libs, and services point at defined specs
... | dusty/commands/validate.py | def validate_specs_from_path(specs_path):
"""
Validates Dusty specs at the given path. The following checks are performed:
-That the given path exists
-That there are bundles in the given path
-That the fields in the specs match those allowed in our schemas
-That references to ap... | def validate_specs_from_path(specs_path):
"""
Validates Dusty specs at the given path. The following checks are performed:
-That the given path exists
-That there are bundles in the given path
-That the fields in the specs match those allowed in our schemas
-That references to ap... | [
"Validates",
"Dusty",
"specs",
"at",
"the",
"given",
"path",
".",
"The",
"following",
"checks",
"are",
"performed",
":",
"-",
"That",
"the",
"given",
"path",
"exists",
"-",
"That",
"there",
"are",
"bundles",
"in",
"the",
"given",
"path",
"-",
"That",
"th... | gamechanger/dusty | python | https://github.com/gamechanger/dusty/blob/dc12de90bb6945023d6f43a8071e984313a1d984/dusty/commands/validate.py#L83-L101 | [
"def",
"validate_specs_from_path",
"(",
"specs_path",
")",
":",
"# Validation of fields with schemer is now down implicitly through get_specs_from_path",
"# We are dealing with Dusty_Specs class in this file",
"log_to_client",
"(",
"\"Validating specs at path {}\"",
".",
"format",
"(",
"... | dc12de90bb6945023d6f43a8071e984313a1d984 |
valid | _env_vars_from_file | This code is copied from Docker Compose, so that we're exactly compatible
with their `env_file` option | dusty/commands/env.py | def _env_vars_from_file(filename):
"""
This code is copied from Docker Compose, so that we're exactly compatible
with their `env_file` option
"""
def split_env(env):
if '=' in env:
return env.split('=', 1)
else:
return env, None
env = {}
for line in op... | def _env_vars_from_file(filename):
"""
This code is copied from Docker Compose, so that we're exactly compatible
with their `env_file` option
"""
def split_env(env):
if '=' in env:
return env.split('=', 1)
else:
return env, None
env = {}
for line in op... | [
"This",
"code",
"is",
"copied",
"from",
"Docker",
"Compose",
"so",
"that",
"we",
"re",
"exactly",
"compatible",
"with",
"their",
"env_file",
"option"
] | gamechanger/dusty | python | https://github.com/gamechanger/dusty/blob/dc12de90bb6945023d6f43a8071e984313a1d984/dusty/commands/env.py#L50-L66 | [
"def",
"_env_vars_from_file",
"(",
"filename",
")",
":",
"def",
"split_env",
"(",
"env",
")",
":",
"if",
"'='",
"in",
"env",
":",
"return",
"env",
".",
"split",
"(",
"'='",
",",
"1",
")",
"else",
":",
"return",
"env",
",",
"None",
"env",
"=",
"{",
... | dc12de90bb6945023d6f43a8071e984313a1d984 |
valid | _get_dependent | Returns everything of type <dependent_type> that <name>, of type <root_spec_type> depends on
Names only are returned in a set | dusty/compiler/spec_assembler.py | def _get_dependent(dependent_type, name, specs, root_spec_type):
"""
Returns everything of type <dependent_type> that <name>, of type <root_spec_type> depends on
Names only are returned in a set
"""
spec = specs[root_spec_type].get(name)
if spec is None:
raise RuntimeError("{} {} was ref... | def _get_dependent(dependent_type, name, specs, root_spec_type):
"""
Returns everything of type <dependent_type> that <name>, of type <root_spec_type> depends on
Names only are returned in a set
"""
spec = specs[root_spec_type].get(name)
if spec is None:
raise RuntimeError("{} {} was ref... | [
"Returns",
"everything",
"of",
"type",
"<dependent_type",
">",
"that",
"<name",
">",
"of",
"type",
"<root_spec_type",
">",
"depends",
"on",
"Names",
"only",
"are",
"returned",
"in",
"a",
"set"
] | gamechanger/dusty | python | https://github.com/gamechanger/dusty/blob/dc12de90bb6945023d6f43a8071e984313a1d984/dusty/compiler/spec_assembler.py#L12-L24 | [
"def",
"_get_dependent",
"(",
"dependent_type",
",",
"name",
",",
"specs",
",",
"root_spec_type",
")",
":",
"spec",
"=",
"specs",
"[",
"root_spec_type",
"]",
".",
"get",
"(",
"name",
")",
"if",
"spec",
"is",
"None",
":",
"raise",
"RuntimeError",
"(",
"\"... | dc12de90bb6945023d6f43a8071e984313a1d984 |
valid | _get_referenced_apps | Returns a set of all apps that are required to run any bundle in specs[constants.CONFIG_BUNDLES_KEY] | dusty/compiler/spec_assembler.py | def _get_referenced_apps(specs):
"""
Returns a set of all apps that are required to run any bundle in specs[constants.CONFIG_BUNDLES_KEY]
"""
activated_bundles = specs[constants.CONFIG_BUNDLES_KEY].keys()
all_active_apps = set()
for active_bundle in activated_bundles:
bundle_spec = specs... | def _get_referenced_apps(specs):
"""
Returns a set of all apps that are required to run any bundle in specs[constants.CONFIG_BUNDLES_KEY]
"""
activated_bundles = specs[constants.CONFIG_BUNDLES_KEY].keys()
all_active_apps = set()
for active_bundle in activated_bundles:
bundle_spec = specs... | [
"Returns",
"a",
"set",
"of",
"all",
"apps",
"that",
"are",
"required",
"to",
"run",
"any",
"bundle",
"in",
"specs",
"[",
"constants",
".",
"CONFIG_BUNDLES_KEY",
"]"
] | gamechanger/dusty | python | https://github.com/gamechanger/dusty/blob/dc12de90bb6945023d6f43a8071e984313a1d984/dusty/compiler/spec_assembler.py#L29-L40 | [
"def",
"_get_referenced_apps",
"(",
"specs",
")",
":",
"activated_bundles",
"=",
"specs",
"[",
"constants",
".",
"CONFIG_BUNDLES_KEY",
"]",
".",
"keys",
"(",
")",
"all_active_apps",
"=",
"set",
"(",
")",
"for",
"active_bundle",
"in",
"activated_bundles",
":",
... | dc12de90bb6945023d6f43a8071e984313a1d984 |
valid | _expand_libs_in_apps | Expands specs.apps.depends.libs to include any indirectly required libs | dusty/compiler/spec_assembler.py | def _expand_libs_in_apps(specs):
"""
Expands specs.apps.depends.libs to include any indirectly required libs
"""
for app_name, app_spec in specs['apps'].iteritems():
if 'depends' in app_spec and 'libs' in app_spec['depends']:
app_spec['depends']['libs'] = _get_dependent('libs', app_n... | def _expand_libs_in_apps(specs):
"""
Expands specs.apps.depends.libs to include any indirectly required libs
"""
for app_name, app_spec in specs['apps'].iteritems():
if 'depends' in app_spec and 'libs' in app_spec['depends']:
app_spec['depends']['libs'] = _get_dependent('libs', app_n... | [
"Expands",
"specs",
".",
"apps",
".",
"depends",
".",
"libs",
"to",
"include",
"any",
"indirectly",
"required",
"libs"
] | gamechanger/dusty | python | https://github.com/gamechanger/dusty/blob/dc12de90bb6945023d6f43a8071e984313a1d984/dusty/compiler/spec_assembler.py#L42-L48 | [
"def",
"_expand_libs_in_apps",
"(",
"specs",
")",
":",
"for",
"app_name",
",",
"app_spec",
"in",
"specs",
"[",
"'apps'",
"]",
".",
"iteritems",
"(",
")",
":",
"if",
"'depends'",
"in",
"app_spec",
"and",
"'libs'",
"in",
"app_spec",
"[",
"'depends'",
"]",
... | dc12de90bb6945023d6f43a8071e984313a1d984 |
valid | _expand_libs_in_libs | Expands specs.libs.depends.libs to include any indirectly required libs | dusty/compiler/spec_assembler.py | def _expand_libs_in_libs(specs):
"""
Expands specs.libs.depends.libs to include any indirectly required libs
"""
for lib_name, lib_spec in specs['libs'].iteritems():
if 'depends' in lib_spec and 'libs' in lib_spec['depends']:
lib_spec['depends']['libs'] = _get_dependent('libs', lib_n... | def _expand_libs_in_libs(specs):
"""
Expands specs.libs.depends.libs to include any indirectly required libs
"""
for lib_name, lib_spec in specs['libs'].iteritems():
if 'depends' in lib_spec and 'libs' in lib_spec['depends']:
lib_spec['depends']['libs'] = _get_dependent('libs', lib_n... | [
"Expands",
"specs",
".",
"libs",
".",
"depends",
".",
"libs",
"to",
"include",
"any",
"indirectly",
"required",
"libs"
] | gamechanger/dusty | python | https://github.com/gamechanger/dusty/blob/dc12de90bb6945023d6f43a8071e984313a1d984/dusty/compiler/spec_assembler.py#L50-L56 | [
"def",
"_expand_libs_in_libs",
"(",
"specs",
")",
":",
"for",
"lib_name",
",",
"lib_spec",
"in",
"specs",
"[",
"'libs'",
"]",
".",
"iteritems",
"(",
")",
":",
"if",
"'depends'",
"in",
"lib_spec",
"and",
"'libs'",
"in",
"lib_spec",
"[",
"'depends'",
"]",
... | dc12de90bb6945023d6f43a8071e984313a1d984 |
valid | _get_referenced_libs | Returns all libs that are referenced in specs.apps.depends.libs | dusty/compiler/spec_assembler.py | def _get_referenced_libs(specs):
"""
Returns all libs that are referenced in specs.apps.depends.libs
"""
active_libs = set()
for app_spec in specs['apps'].values():
for lib in app_spec['depends']['libs']:
active_libs.add(lib)
return active_libs | def _get_referenced_libs(specs):
"""
Returns all libs that are referenced in specs.apps.depends.libs
"""
active_libs = set()
for app_spec in specs['apps'].values():
for lib in app_spec['depends']['libs']:
active_libs.add(lib)
return active_libs | [
"Returns",
"all",
"libs",
"that",
"are",
"referenced",
"in",
"specs",
".",
"apps",
".",
"depends",
".",
"libs"
] | gamechanger/dusty | python | https://github.com/gamechanger/dusty/blob/dc12de90bb6945023d6f43a8071e984313a1d984/dusty/compiler/spec_assembler.py#L58-L66 | [
"def",
"_get_referenced_libs",
"(",
"specs",
")",
":",
"active_libs",
"=",
"set",
"(",
")",
"for",
"app_spec",
"in",
"specs",
"[",
"'apps'",
"]",
".",
"values",
"(",
")",
":",
"for",
"lib",
"in",
"app_spec",
"[",
"'depends'",
"]",
"[",
"'libs'",
"]",
... | dc12de90bb6945023d6f43a8071e984313a1d984 |
valid | _get_referenced_services | Returns all services that are referenced in specs.apps.depends.services,
or in specs.bundles.services | dusty/compiler/spec_assembler.py | def _get_referenced_services(specs):
"""
Returns all services that are referenced in specs.apps.depends.services,
or in specs.bundles.services
"""
active_services = set()
for app_spec in specs['apps'].values():
for service in app_spec['depends']['services']:
active_services.a... | def _get_referenced_services(specs):
"""
Returns all services that are referenced in specs.apps.depends.services,
or in specs.bundles.services
"""
active_services = set()
for app_spec in specs['apps'].values():
for service in app_spec['depends']['services']:
active_services.a... | [
"Returns",
"all",
"services",
"that",
"are",
"referenced",
"in",
"specs",
".",
"apps",
".",
"depends",
".",
"services",
"or",
"in",
"specs",
".",
"bundles",
".",
"services"
] | gamechanger/dusty | python | https://github.com/gamechanger/dusty/blob/dc12de90bb6945023d6f43a8071e984313a1d984/dusty/compiler/spec_assembler.py#L68-L80 | [
"def",
"_get_referenced_services",
"(",
"specs",
")",
":",
"active_services",
"=",
"set",
"(",
")",
"for",
"app_spec",
"in",
"specs",
"[",
"'apps'",
"]",
".",
"values",
"(",
")",
":",
"for",
"service",
"in",
"app_spec",
"[",
"'depends'",
"]",
"[",
"'serv... | dc12de90bb6945023d6f43a8071e984313a1d984 |
valid | _add_active_assets | This function adds an assets key to the specs, which is filled in with a dictionary
of all assets defined by apps and libs in the specs | dusty/compiler/spec_assembler.py | def _add_active_assets(specs):
"""
This function adds an assets key to the specs, which is filled in with a dictionary
of all assets defined by apps and libs in the specs
"""
specs['assets'] = {}
for spec in specs.get_apps_and_libs():
for asset in spec['assets']:
if not specs... | def _add_active_assets(specs):
"""
This function adds an assets key to the specs, which is filled in with a dictionary
of all assets defined by apps and libs in the specs
"""
specs['assets'] = {}
for spec in specs.get_apps_and_libs():
for asset in spec['assets']:
if not specs... | [
"This",
"function",
"adds",
"an",
"assets",
"key",
"to",
"the",
"specs",
"which",
"is",
"filled",
"in",
"with",
"a",
"dictionary",
"of",
"all",
"assets",
"defined",
"by",
"apps",
"and",
"libs",
"in",
"the",
"specs"
] | gamechanger/dusty | python | https://github.com/gamechanger/dusty/blob/dc12de90bb6945023d6f43a8071e984313a1d984/dusty/compiler/spec_assembler.py#L96-L110 | [
"def",
"_add_active_assets",
"(",
"specs",
")",
":",
"specs",
"[",
"'assets'",
"]",
"=",
"{",
"}",
"for",
"spec",
"in",
"specs",
".",
"get_apps_and_libs",
"(",
")",
":",
"for",
"asset",
"in",
"spec",
"[",
"'assets'",
"]",
":",
"if",
"not",
"specs",
"... | dc12de90bb6945023d6f43a8071e984313a1d984 |
valid | _get_expanded_active_specs | This function removes any unnecessary bundles, apps, libs, and services that aren't needed by
the activated_bundles. It also expands inside specs.apps.depends.libs all libs that are needed
indirectly by each app | dusty/compiler/spec_assembler.py | def _get_expanded_active_specs(specs):
"""
This function removes any unnecessary bundles, apps, libs, and services that aren't needed by
the activated_bundles. It also expands inside specs.apps.depends.libs all libs that are needed
indirectly by each app
"""
_filter_active(constants.CONFIG_BUND... | def _get_expanded_active_specs(specs):
"""
This function removes any unnecessary bundles, apps, libs, and services that aren't needed by
the activated_bundles. It also expands inside specs.apps.depends.libs all libs that are needed
indirectly by each app
"""
_filter_active(constants.CONFIG_BUND... | [
"This",
"function",
"removes",
"any",
"unnecessary",
"bundles",
"apps",
"libs",
"and",
"services",
"that",
"aren",
"t",
"needed",
"by",
"the",
"activated_bundles",
".",
"It",
"also",
"expands",
"inside",
"specs",
".",
"apps",
".",
"depends",
".",
"libs",
"al... | gamechanger/dusty | python | https://github.com/gamechanger/dusty/blob/dc12de90bb6945023d6f43a8071e984313a1d984/dusty/compiler/spec_assembler.py#L112-L123 | [
"def",
"_get_expanded_active_specs",
"(",
"specs",
")",
":",
"_filter_active",
"(",
"constants",
".",
"CONFIG_BUNDLES_KEY",
",",
"specs",
")",
"_filter_active",
"(",
"'apps'",
",",
"specs",
")",
"_expand_libs_in_apps",
"(",
"specs",
")",
"_filter_active",
"(",
"'l... | dc12de90bb6945023d6f43a8071e984313a1d984 |
valid | get_repo_of_app_or_library | This function takes an app or library name and will return the corresponding repo
for that app or library | dusty/compiler/spec_assembler.py | def get_repo_of_app_or_library(app_or_library_name):
""" This function takes an app or library name and will return the corresponding repo
for that app or library"""
specs = get_specs()
repo_name = specs.get_app_or_lib(app_or_library_name)['repo']
if not repo_name:
return None
return Rep... | def get_repo_of_app_or_library(app_or_library_name):
""" This function takes an app or library name and will return the corresponding repo
for that app or library"""
specs = get_specs()
repo_name = specs.get_app_or_lib(app_or_library_name)['repo']
if not repo_name:
return None
return Rep... | [
"This",
"function",
"takes",
"an",
"app",
"or",
"library",
"name",
"and",
"will",
"return",
"the",
"corresponding",
"repo",
"for",
"that",
"app",
"or",
"library"
] | gamechanger/dusty | python | https://github.com/gamechanger/dusty/blob/dc12de90bb6945023d6f43a8071e984313a1d984/dusty/compiler/spec_assembler.py#L152-L159 | [
"def",
"get_repo_of_app_or_library",
"(",
"app_or_library_name",
")",
":",
"specs",
"=",
"get_specs",
"(",
")",
"repo_name",
"=",
"specs",
".",
"get_app_or_lib",
"(",
"app_or_library_name",
")",
"[",
"'repo'",
"]",
"if",
"not",
"repo_name",
":",
"return",
"None"... | dc12de90bb6945023d6f43a8071e984313a1d984 |
valid | get_same_container_repos_from_spec | Given the spec of an app or library, returns all repos that are guaranteed
to live in the same container | dusty/compiler/spec_assembler.py | def get_same_container_repos_from_spec(app_or_library_spec):
"""Given the spec of an app or library, returns all repos that are guaranteed
to live in the same container"""
repos = set()
app_or_lib_repo = get_repo_of_app_or_library(app_or_library_spec.name)
if app_or_lib_repo is not None:
rep... | def get_same_container_repos_from_spec(app_or_library_spec):
"""Given the spec of an app or library, returns all repos that are guaranteed
to live in the same container"""
repos = set()
app_or_lib_repo = get_repo_of_app_or_library(app_or_library_spec.name)
if app_or_lib_repo is not None:
rep... | [
"Given",
"the",
"spec",
"of",
"an",
"app",
"or",
"library",
"returns",
"all",
"repos",
"that",
"are",
"guaranteed",
"to",
"live",
"in",
"the",
"same",
"container"
] | gamechanger/dusty | python | https://github.com/gamechanger/dusty/blob/dc12de90bb6945023d6f43a8071e984313a1d984/dusty/compiler/spec_assembler.py#L174-L183 | [
"def",
"get_same_container_repos_from_spec",
"(",
"app_or_library_spec",
")",
":",
"repos",
"=",
"set",
"(",
")",
"app_or_lib_repo",
"=",
"get_repo_of_app_or_library",
"(",
"app_or_library_spec",
".",
"name",
")",
"if",
"app_or_lib_repo",
"is",
"not",
"None",
":",
"... | dc12de90bb6945023d6f43a8071e984313a1d984 |
valid | get_same_container_repos | Given the name of an app or library, returns all repos that are guaranteed
to live in the same container | dusty/compiler/spec_assembler.py | def get_same_container_repos(app_or_library_name):
"""Given the name of an app or library, returns all repos that are guaranteed
to live in the same container"""
specs = get_expanded_libs_specs()
spec = specs.get_app_or_lib(app_or_library_name)
return get_same_container_repos_from_spec(spec) | def get_same_container_repos(app_or_library_name):
"""Given the name of an app or library, returns all repos that are guaranteed
to live in the same container"""
specs = get_expanded_libs_specs()
spec = specs.get_app_or_lib(app_or_library_name)
return get_same_container_repos_from_spec(spec) | [
"Given",
"the",
"name",
"of",
"an",
"app",
"or",
"library",
"returns",
"all",
"repos",
"that",
"are",
"guaranteed",
"to",
"live",
"in",
"the",
"same",
"container"
] | gamechanger/dusty | python | https://github.com/gamechanger/dusty/blob/dc12de90bb6945023d6f43a8071e984313a1d984/dusty/compiler/spec_assembler.py#L185-L190 | [
"def",
"get_same_container_repos",
"(",
"app_or_library_name",
")",
":",
"specs",
"=",
"get_expanded_libs_specs",
"(",
")",
"spec",
"=",
"specs",
".",
"get_app_or_lib",
"(",
"app_or_library_name",
")",
"return",
"get_same_container_repos_from_spec",
"(",
"spec",
")"
] | dc12de90bb6945023d6f43a8071e984313a1d984 |
valid | _dusty_hosts_config | Return a string of all host rules required to match
the given spec. This string is wrapped in the Dusty hosts
header and footer so it can be easily removed later. | dusty/systems/hosts/__init__.py | def _dusty_hosts_config(hosts_specs):
"""Return a string of all host rules required to match
the given spec. This string is wrapped in the Dusty hosts
header and footer so it can be easily removed later."""
rules = ''.join(['{} {}\n'.format(spec['forwarded_ip'], spec['host_address']) for spec in hosts_... | def _dusty_hosts_config(hosts_specs):
"""Return a string of all host rules required to match
the given spec. This string is wrapped in the Dusty hosts
header and footer so it can be easily removed later."""
rules = ''.join(['{} {}\n'.format(spec['forwarded_ip'], spec['host_address']) for spec in hosts_... | [
"Return",
"a",
"string",
"of",
"all",
"host",
"rules",
"required",
"to",
"match",
"the",
"given",
"spec",
".",
"This",
"string",
"is",
"wrapped",
"in",
"the",
"Dusty",
"hosts",
"header",
"and",
"footer",
"so",
"it",
"can",
"be",
"easily",
"removed",
"lat... | gamechanger/dusty | python | https://github.com/gamechanger/dusty/blob/dc12de90bb6945023d6f43a8071e984313a1d984/dusty/systems/hosts/__init__.py#L7-L12 | [
"def",
"_dusty_hosts_config",
"(",
"hosts_specs",
")",
":",
"rules",
"=",
"''",
".",
"join",
"(",
"[",
"'{} {}\\n'",
".",
"format",
"(",
"spec",
"[",
"'forwarded_ip'",
"]",
",",
"spec",
"[",
"'host_address'",
"]",
")",
"for",
"spec",
"in",
"hosts_specs",
... | dc12de90bb6945023d6f43a8071e984313a1d984 |
valid | update_hosts_file_from_port_spec | Given a port spec, update the hosts file specified at
constants.HOST_PATH to contain the port mappings specified
in the spec. Any existing Dusty configurations are replaced. | dusty/systems/hosts/__init__.py | def update_hosts_file_from_port_spec(port_spec):
"""Given a port spec, update the hosts file specified at
constants.HOST_PATH to contain the port mappings specified
in the spec. Any existing Dusty configurations are replaced."""
logging.info('Updating hosts file to match port spec')
hosts_specs = po... | def update_hosts_file_from_port_spec(port_spec):
"""Given a port spec, update the hosts file specified at
constants.HOST_PATH to contain the port mappings specified
in the spec. Any existing Dusty configurations are replaced."""
logging.info('Updating hosts file to match port spec')
hosts_specs = po... | [
"Given",
"a",
"port",
"spec",
"update",
"the",
"hosts",
"file",
"specified",
"at",
"constants",
".",
"HOST_PATH",
"to",
"contain",
"the",
"port",
"mappings",
"specified",
"in",
"the",
"spec",
".",
"Any",
"existing",
"Dusty",
"configurations",
"are",
"replaced"... | gamechanger/dusty | python | https://github.com/gamechanger/dusty/blob/dc12de90bb6945023d6f43a8071e984313a1d984/dusty/systems/hosts/__init__.py#L14-L23 | [
"def",
"update_hosts_file_from_port_spec",
"(",
"port_spec",
")",
":",
"logging",
".",
"info",
"(",
"'Updating hosts file to match port spec'",
")",
"hosts_specs",
"=",
"port_spec",
"[",
"'hosts_file'",
"]",
"current_hosts",
"=",
"config_file",
".",
"read",
"(",
"cons... | dc12de90bb6945023d6f43a8071e984313a1d984 |
valid | _move_temp_binary_to_path | Moves the temporary binary to the location of the binary that's currently being run.
Preserves owner, group, and permissions of original binary | dusty/commands/upgrade.py | def _move_temp_binary_to_path(tmp_binary_path):
"""Moves the temporary binary to the location of the binary that's currently being run.
Preserves owner, group, and permissions of original binary"""
# pylint: disable=E1101
binary_path = _get_binary_location()
if not binary_path.endswith(constants.DUS... | def _move_temp_binary_to_path(tmp_binary_path):
"""Moves the temporary binary to the location of the binary that's currently being run.
Preserves owner, group, and permissions of original binary"""
# pylint: disable=E1101
binary_path = _get_binary_location()
if not binary_path.endswith(constants.DUS... | [
"Moves",
"the",
"temporary",
"binary",
"to",
"the",
"location",
"of",
"the",
"binary",
"that",
"s",
"currently",
"being",
"run",
".",
"Preserves",
"owner",
"group",
"and",
"permissions",
"of",
"original",
"binary"
] | gamechanger/dusty | python | https://github.com/gamechanger/dusty/blob/dc12de90bb6945023d6f43a8071e984313a1d984/dusty/commands/upgrade.py#L57-L71 | [
"def",
"_move_temp_binary_to_path",
"(",
"tmp_binary_path",
")",
":",
"# pylint: disable=E1101",
"binary_path",
"=",
"_get_binary_location",
"(",
")",
"if",
"not",
"binary_path",
".",
"endswith",
"(",
"constants",
".",
"DUSTY_BINARY_NAME",
")",
":",
"raise",
"RuntimeE... | dc12de90bb6945023d6f43a8071e984313a1d984 |
valid | parallel_task_queue | Context manager for setting up a TaskQueue. Upon leaving the
context manager, all tasks that were enqueued will be executed
in parallel subject to `pool_size` concurrency constraints. | dusty/parallel.py | def parallel_task_queue(pool_size=multiprocessing.cpu_count()):
"""Context manager for setting up a TaskQueue. Upon leaving the
context manager, all tasks that were enqueued will be executed
in parallel subject to `pool_size` concurrency constraints."""
task_queue = TaskQueue(pool_size)
yield task_q... | def parallel_task_queue(pool_size=multiprocessing.cpu_count()):
"""Context manager for setting up a TaskQueue. Upon leaving the
context manager, all tasks that were enqueued will be executed
in parallel subject to `pool_size` concurrency constraints."""
task_queue = TaskQueue(pool_size)
yield task_q... | [
"Context",
"manager",
"for",
"setting",
"up",
"a",
"TaskQueue",
".",
"Upon",
"leaving",
"the",
"context",
"manager",
"all",
"tasks",
"that",
"were",
"enqueued",
"will",
"be",
"executed",
"in",
"parallel",
"subject",
"to",
"pool_size",
"concurrency",
"constraints... | gamechanger/dusty | python | https://github.com/gamechanger/dusty/blob/dc12de90bb6945023d6f43a8071e984313a1d984/dusty/parallel.py#L45-L51 | [
"def",
"parallel_task_queue",
"(",
"pool_size",
"=",
"multiprocessing",
".",
"cpu_count",
"(",
")",
")",
":",
"task_queue",
"=",
"TaskQueue",
"(",
"pool_size",
")",
"yield",
"task_queue",
"task_queue",
".",
"execute",
"(",
")"
] | dc12de90bb6945023d6f43a8071e984313a1d984 |
valid | _nginx_location_spec | This will output the nginx location config string for specific port spec | dusty/compiler/nginx/__init__.py | def _nginx_location_spec(port_spec, bridge_ip):
"""This will output the nginx location config string for specific port spec """
location_string_spec = "\t \t location / { \n"
for location_setting in ['proxy_http_version 1.1;',
'proxy_set_header Upgrade $http_upgrade;',
... | def _nginx_location_spec(port_spec, bridge_ip):
"""This will output the nginx location config string for specific port spec """
location_string_spec = "\t \t location / { \n"
for location_setting in ['proxy_http_version 1.1;',
'proxy_set_header Upgrade $http_upgrade;',
... | [
"This",
"will",
"output",
"the",
"nginx",
"location",
"config",
"string",
"for",
"specific",
"port",
"spec"
] | gamechanger/dusty | python | https://github.com/gamechanger/dusty/blob/dc12de90bb6945023d6f43a8071e984313a1d984/dusty/compiler/nginx/__init__.py#L8-L19 | [
"def",
"_nginx_location_spec",
"(",
"port_spec",
",",
"bridge_ip",
")",
":",
"location_string_spec",
"=",
"\"\\t \\t location / { \\n\"",
"for",
"location_setting",
"in",
"[",
"'proxy_http_version 1.1;'",
",",
"'proxy_set_header Upgrade $http_upgrade;'",
",",
"'proxy_set_header... | dc12de90bb6945023d6f43a8071e984313a1d984 |
valid | _nginx_http_spec | This will output the nginx HTTP config string for specific port spec | dusty/compiler/nginx/__init__.py | def _nginx_http_spec(port_spec, bridge_ip):
"""This will output the nginx HTTP config string for specific port spec """
server_string_spec = "\t server {\n"
server_string_spec += "\t \t {}\n".format(_nginx_max_file_size_string())
server_string_spec += "\t \t {}\n".format(_nginx_listen_string(port_spec))... | def _nginx_http_spec(port_spec, bridge_ip):
"""This will output the nginx HTTP config string for specific port spec """
server_string_spec = "\t server {\n"
server_string_spec += "\t \t {}\n".format(_nginx_max_file_size_string())
server_string_spec += "\t \t {}\n".format(_nginx_listen_string(port_spec))... | [
"This",
"will",
"output",
"the",
"nginx",
"HTTP",
"config",
"string",
"for",
"specific",
"port",
"spec"
] | gamechanger/dusty | python | https://github.com/gamechanger/dusty/blob/dc12de90bb6945023d6f43a8071e984313a1d984/dusty/compiler/nginx/__init__.py#L38-L47 | [
"def",
"_nginx_http_spec",
"(",
"port_spec",
",",
"bridge_ip",
")",
":",
"server_string_spec",
"=",
"\"\\t server {\\n\"",
"server_string_spec",
"+=",
"\"\\t \\t {}\\n\"",
".",
"format",
"(",
"_nginx_max_file_size_string",
"(",
")",
")",
"server_string_spec",
"+=",
"\"\... | dc12de90bb6945023d6f43a8071e984313a1d984 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.