repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
ShadowBlip/Neteria | neteria/core.py | ListenerUDP.scheduler | def scheduler(self, sleep_time=0.2):
"""Starts the scheduler to check for scheduled calls and execute them
at the correct time.
Args:
sleep_time (float): The amount of time to wait in seconds between
each loop iteration. This prevents the scheduler from consuming
... | python | def scheduler(self, sleep_time=0.2):
"""Starts the scheduler to check for scheduled calls and execute them
at the correct time.
Args:
sleep_time (float): The amount of time to wait in seconds between
each loop iteration. This prevents the scheduler from consuming
... | [
"def",
"scheduler",
"(",
"self",
",",
"sleep_time",
"=",
"0.2",
")",
":",
"while",
"self",
".",
"listening",
":",
"if",
"self",
".",
"scheduled_calls",
":",
"timestamp",
"=",
"time",
".",
"time",
"(",
")",
"self",
".",
"scheduled_calls",
"[",
":",
"]",... | Starts the scheduler to check for scheduled calls and execute them
at the correct time.
Args:
sleep_time (float): The amount of time to wait in seconds between
each loop iteration. This prevents the scheduler from consuming
100% of the host's CPU. Defaults to 0.2 secon... | [
"Starts",
"the",
"scheduler",
"to",
"check",
"for",
"scheduled",
"calls",
"and",
"execute",
"them",
"at",
"the",
"correct",
"time",
"."
] | 1a8c976eb2beeca0a5a272a34ac58b2c114495a4 | https://github.com/ShadowBlip/Neteria/blob/1a8c976eb2beeca0a5a272a34ac58b2c114495a4/neteria/core.py#L244-L267 | train |
ShadowBlip/Neteria | neteria/core.py | ListenerUDP.call_later | def call_later(self, time_seconds, callback, arguments):
"""Schedules a function to be run x number of seconds from now.
The call_later method is primarily used to resend messages if we
haven't received a confirmation message from the receiving host.
We can wait x number of seconds for ... | python | def call_later(self, time_seconds, callback, arguments):
"""Schedules a function to be run x number of seconds from now.
The call_later method is primarily used to resend messages if we
haven't received a confirmation message from the receiving host.
We can wait x number of seconds for ... | [
"def",
"call_later",
"(",
"self",
",",
"time_seconds",
",",
"callback",
",",
"arguments",
")",
":",
"scheduled_call",
"=",
"{",
"'ts'",
":",
"time",
".",
"time",
"(",
")",
"+",
"time_seconds",
",",
"'callback'",
":",
"callback",
",",
"'args'",
":",
"argu... | Schedules a function to be run x number of seconds from now.
The call_later method is primarily used to resend messages if we
haven't received a confirmation message from the receiving host.
We can wait x number of seconds for a response and then try
sending the message again.
... | [
"Schedules",
"a",
"function",
"to",
"be",
"run",
"x",
"number",
"of",
"seconds",
"from",
"now",
"."
] | 1a8c976eb2beeca0a5a272a34ac58b2c114495a4 | https://github.com/ShadowBlip/Neteria/blob/1a8c976eb2beeca0a5a272a34ac58b2c114495a4/neteria/core.py#L269-L292 | train |
ShadowBlip/Neteria | neteria/core.py | ListenerUDP.time_reached | def time_reached(self, current_time, scheduled_call):
"""Checks to see if it's time to run a scheduled call or not.
If it IS time to run a scheduled call, this function will execute the
method associated with that call.
Args:
current_time (float): Current timestamp from time.... | python | def time_reached(self, current_time, scheduled_call):
"""Checks to see if it's time to run a scheduled call or not.
If it IS time to run a scheduled call, this function will execute the
method associated with that call.
Args:
current_time (float): Current timestamp from time.... | [
"def",
"time_reached",
"(",
"self",
",",
"current_time",
",",
"scheduled_call",
")",
":",
"if",
"current_time",
">=",
"scheduled_call",
"[",
"'ts'",
"]",
":",
"scheduled_call",
"[",
"'callback'",
"]",
"(",
"scheduled_call",
"[",
"'args'",
"]",
")",
"return",
... | Checks to see if it's time to run a scheduled call or not.
If it IS time to run a scheduled call, this function will execute the
method associated with that call.
Args:
current_time (float): Current timestamp from time.time().
scheduled_call (dict): A scheduled call diction... | [
"Checks",
"to",
"see",
"if",
"it",
"s",
"time",
"to",
"run",
"a",
"scheduled",
"call",
"or",
"not",
"."
] | 1a8c976eb2beeca0a5a272a34ac58b2c114495a4 | https://github.com/ShadowBlip/Neteria/blob/1a8c976eb2beeca0a5a272a34ac58b2c114495a4/neteria/core.py#L294-L322 | train |
ShadowBlip/Neteria | neteria/core.py | ListenerUDP.send_datagram | def send_datagram(self, message, address, message_type="unicast"):
"""Sends a UDP datagram packet to the requested address.
Datagrams can be sent as a "unicast", "multicast", or "broadcast"
message. Unicast messages are messages that will be sent to a single
host, multicast messages wil... | python | def send_datagram(self, message, address, message_type="unicast"):
"""Sends a UDP datagram packet to the requested address.
Datagrams can be sent as a "unicast", "multicast", or "broadcast"
message. Unicast messages are messages that will be sent to a single
host, multicast messages wil... | [
"def",
"send_datagram",
"(",
"self",
",",
"message",
",",
"address",
",",
"message_type",
"=",
"\"unicast\"",
")",
":",
"if",
"self",
".",
"bufsize",
"is",
"not",
"0",
"and",
"len",
"(",
"message",
")",
">",
"self",
".",
"bufsize",
":",
"raise",
"Excep... | Sends a UDP datagram packet to the requested address.
Datagrams can be sent as a "unicast", "multicast", or "broadcast"
message. Unicast messages are messages that will be sent to a single
host, multicast messages will be delivered to all hosts listening for
multicast messages, and broa... | [
"Sends",
"a",
"UDP",
"datagram",
"packet",
"to",
"the",
"requested",
"address",
"."
] | 1a8c976eb2beeca0a5a272a34ac58b2c114495a4 | https://github.com/ShadowBlip/Neteria/blob/1a8c976eb2beeca0a5a272a34ac58b2c114495a4/neteria/core.py#L324-L360 | train |
ShadowBlip/Neteria | neteria/core.py | ListenerUDP.receive_datagram | def receive_datagram(self, data, address):
"""Executes when UDP data has been received and sends the packet data
to our app to process the request.
Args:
data (str): The raw serialized packet data received.
address (tuple): The address and port of the origin of the received
... | python | def receive_datagram(self, data, address):
"""Executes when UDP data has been received and sends the packet data
to our app to process the request.
Args:
data (str): The raw serialized packet data received.
address (tuple): The address and port of the origin of the received
... | [
"def",
"receive_datagram",
"(",
"self",
",",
"data",
",",
"address",
")",
":",
"if",
"not",
"self",
".",
"app",
":",
"logger",
".",
"debug",
"(",
"\"Packet received\"",
",",
"address",
",",
"data",
")",
"return",
"False",
"try",
":",
"response",
"=",
"... | Executes when UDP data has been received and sends the packet data
to our app to process the request.
Args:
data (str): The raw serialized packet data received.
address (tuple): The address and port of the origin of the received
packet. E.g. (address, port).
Ret... | [
"Executes",
"when",
"UDP",
"data",
"has",
"been",
"received",
"and",
"sends",
"the",
"packet",
"data",
"to",
"our",
"app",
"to",
"process",
"the",
"request",
"."
] | 1a8c976eb2beeca0a5a272a34ac58b2c114495a4 | https://github.com/ShadowBlip/Neteria/blob/1a8c976eb2beeca0a5a272a34ac58b2c114495a4/neteria/core.py#L362-L394 | train |
sprockets/sprockets.mixins.metrics | examples/statsd.py | make_application | def make_application():
"""
Create a application configured to send metrics.
Metrics will be sent to localhost:8125 namespaced with
``webapps``. Run netcat or a similar listener then run this
example. HTTP GETs will result in a metric like::
webapps.SimpleHandler.GET.204:255.24497032165527... | python | def make_application():
"""
Create a application configured to send metrics.
Metrics will be sent to localhost:8125 namespaced with
``webapps``. Run netcat or a similar listener then run this
example. HTTP GETs will result in a metric like::
webapps.SimpleHandler.GET.204:255.24497032165527... | [
"def",
"make_application",
"(",
")",
":",
"settings",
"=",
"{",
"}",
"application",
"=",
"web",
".",
"Application",
"(",
"[",
"web",
".",
"url",
"(",
"'/'",
",",
"SimpleHandler",
")",
"]",
",",
"**",
"settings",
")",
"statsd",
".",
"install",
"(",
"a... | Create a application configured to send metrics.
Metrics will be sent to localhost:8125 namespaced with
``webapps``. Run netcat or a similar listener then run this
example. HTTP GETs will result in a metric like::
webapps.SimpleHandler.GET.204:255.24497032165527|ms | [
"Create",
"a",
"application",
"configured",
"to",
"send",
"metrics",
"."
] | 0b17d5f0c09a2be9db779e17e6789d3d5ff9a0d0 | https://github.com/sprockets/sprockets.mixins.metrics/blob/0b17d5f0c09a2be9db779e17e6789d3d5ff9a0d0/examples/statsd.py#L34-L48 | train |
ehansis/ozelot | examples/leonardo/leonardo/common/analysis.py | plots_html_page | def plots_html_page(query_module):
"""Generate analysis output as html page
Args:
query_module (module): module to use for querying data for the
desired model/pipeline variant, e.g. leonardo.standard.queries
"""
# page template
template = jenv.get_template("analysis.html")
... | python | def plots_html_page(query_module):
"""Generate analysis output as html page
Args:
query_module (module): module to use for querying data for the
desired model/pipeline variant, e.g. leonardo.standard.queries
"""
# page template
template = jenv.get_template("analysis.html")
... | [
"def",
"plots_html_page",
"(",
"query_module",
")",
":",
"template",
"=",
"jenv",
".",
"get_template",
"(",
"\"analysis.html\"",
")",
"context",
"=",
"dict",
"(",
"extended",
"=",
"config",
".",
"EXTENDED",
")",
"cl",
"=",
"client",
".",
"get_client",
"(",
... | Generate analysis output as html page
Args:
query_module (module): module to use for querying data for the
desired model/pipeline variant, e.g. leonardo.standard.queries | [
"Generate",
"analysis",
"output",
"as",
"html",
"page"
] | 948675e02eb6fca940450f5cb814f53e97159e5b | https://github.com/ehansis/ozelot/blob/948675e02eb6fca940450f5cb814f53e97159e5b/examples/leonardo/leonardo/common/analysis.py#L50-L113 | train |
fkarb/xltable | xltable/worksheet.py | _to_pywintypes | def _to_pywintypes(row):
"""convert values in a row to types accepted by excel"""
def _pywintype(x):
if isinstance(x, dt.date):
return dt.datetime(x.year, x.month, x.day, tzinfo=dt.timezone.utc)
elif isinstance(x, (dt.datetime, pa.Timestamp)):
if x.tzinfo is None:
... | python | def _to_pywintypes(row):
"""convert values in a row to types accepted by excel"""
def _pywintype(x):
if isinstance(x, dt.date):
return dt.datetime(x.year, x.month, x.day, tzinfo=dt.timezone.utc)
elif isinstance(x, (dt.datetime, pa.Timestamp)):
if x.tzinfo is None:
... | [
"def",
"_to_pywintypes",
"(",
"row",
")",
":",
"def",
"_pywintype",
"(",
"x",
")",
":",
"if",
"isinstance",
"(",
"x",
",",
"dt",
".",
"date",
")",
":",
"return",
"dt",
".",
"datetime",
"(",
"x",
".",
"year",
",",
"x",
".",
"month",
",",
"x",
".... | convert values in a row to types accepted by excel | [
"convert",
"values",
"in",
"a",
"row",
"to",
"types",
"accepted",
"by",
"excel"
] | 7a592642d27ad5ee90d2aa8c26338abaa9d84bea | https://github.com/fkarb/xltable/blob/7a592642d27ad5ee90d2aa8c26338abaa9d84bea/xltable/worksheet.py#L640-L666 | train |
fkarb/xltable | xltable/worksheet.py | Worksheet.iterrows | def iterrows(self, workbook=None):
"""
Yield rows as lists of data.
The data is exactly as it is in the source pandas DataFrames and
any formulas are not resolved.
"""
resolved_tables = []
max_height = 0
max_width = 0
# while yielding rows __form... | python | def iterrows(self, workbook=None):
"""
Yield rows as lists of data.
The data is exactly as it is in the source pandas DataFrames and
any formulas are not resolved.
"""
resolved_tables = []
max_height = 0
max_width = 0
# while yielding rows __form... | [
"def",
"iterrows",
"(",
"self",
",",
"workbook",
"=",
"None",
")",
":",
"resolved_tables",
"=",
"[",
"]",
"max_height",
"=",
"0",
"max_width",
"=",
"0",
"self",
".",
"__formula_values",
"=",
"{",
"}",
"for",
"name",
",",
"(",
"table",
",",
"(",
"row"... | Yield rows as lists of data.
The data is exactly as it is in the source pandas DataFrames and
any formulas are not resolved. | [
"Yield",
"rows",
"as",
"lists",
"of",
"data",
"."
] | 7a592642d27ad5ee90d2aa8c26338abaa9d84bea | https://github.com/fkarb/xltable/blob/7a592642d27ad5ee90d2aa8c26338abaa9d84bea/xltable/worksheet.py#L115-L169 | train |
redhat-cip/python-dciclient | dciclient/v1/api/file.py | create | def create(context, name, content=None, file_path=None, mime='text/plain',
jobstate_id=None, md5=None, job_id=None, test_id=None):
"""Method to create a file on the Control-Server
This method allows one to upload a file to the Control-Server. The file
to be uploaded can be specified in two diffe... | python | def create(context, name, content=None, file_path=None, mime='text/plain',
jobstate_id=None, md5=None, job_id=None, test_id=None):
"""Method to create a file on the Control-Server
This method allows one to upload a file to the Control-Server. The file
to be uploaded can be specified in two diffe... | [
"def",
"create",
"(",
"context",
",",
"name",
",",
"content",
"=",
"None",
",",
"file_path",
"=",
"None",
",",
"mime",
"=",
"'text/plain'",
",",
"jobstate_id",
"=",
"None",
",",
"md5",
"=",
"None",
",",
"job_id",
"=",
"None",
",",
"test_id",
"=",
"No... | Method to create a file on the Control-Server
This method allows one to upload a file to the Control-Server. The file
to be uploaded can be specified in two different ways either by specifying
its content directly or or by specifying the file_path where the file is
located.
content can be in the f... | [
"Method",
"to",
"create",
"a",
"file",
"on",
"the",
"Control",
"-",
"Server"
] | a4aa5899062802bbe4c30a075d8447f8d222d214 | https://github.com/redhat-cip/python-dciclient/blob/a4aa5899062802bbe4c30a075d8447f8d222d214/dciclient/v1/api/file.py#L26-L65 | train |
lsst-sqre/documenteer | documenteer/sphinxext/lssttasks/configfieldlists.py | register_formatter | def register_formatter(field_typestr):
"""Decorate a configuration field formatter function to register it with
the `get_field_formatter` accessor.
This decorator also performs common helpers for the formatter functions:
- Does type checking on the field argument passed to a formatter.
- Assembles... | python | def register_formatter(field_typestr):
"""Decorate a configuration field formatter function to register it with
the `get_field_formatter` accessor.
This decorator also performs common helpers for the formatter functions:
- Does type checking on the field argument passed to a formatter.
- Assembles... | [
"def",
"register_formatter",
"(",
"field_typestr",
")",
":",
"def",
"decorator_register",
"(",
"formatter",
")",
":",
"@",
"functools",
".",
"wraps",
"(",
"formatter",
")",
"def",
"wrapped_formatter",
"(",
"*",
"args",
",",
"**",
"kwargs",
")",
":",
"field_n... | Decorate a configuration field formatter function to register it with
the `get_field_formatter` accessor.
This decorator also performs common helpers for the formatter functions:
- Does type checking on the field argument passed to a formatter.
- Assembles a section node from the nodes returned by the... | [
"Decorate",
"a",
"configuration",
"field",
"formatter",
"function",
"to",
"register",
"it",
"with",
"the",
"get_field_formatter",
"accessor",
"."
] | 75f02901a80042b28d074df1cc1dca32eb8e38c8 | https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxext/lssttasks/configfieldlists.py#L281-L319 | train |
lsst-sqre/documenteer | documenteer/sphinxext/lssttasks/configfieldlists.py | format_configurablefield_nodes | def format_configurablefield_nodes(field_name, field, field_id, state, lineno):
"""Create a section node that documents a ConfigurableField config field.
Parameters
----------
field_name : `str`
Name of the configuration field (the attribute name of on the config
class).
field : ``l... | python | def format_configurablefield_nodes(field_name, field, field_id, state, lineno):
"""Create a section node that documents a ConfigurableField config field.
Parameters
----------
field_name : `str`
Name of the configuration field (the attribute name of on the config
class).
field : ``l... | [
"def",
"format_configurablefield_nodes",
"(",
"field_name",
",",
"field",
",",
"field_id",
",",
"state",
",",
"lineno",
")",
":",
"default_item",
"=",
"nodes",
".",
"definition_list_item",
"(",
")",
"default_item",
".",
"append",
"(",
"nodes",
".",
"term",
"("... | Create a section node that documents a ConfigurableField config field.
Parameters
----------
field_name : `str`
Name of the configuration field (the attribute name of on the config
class).
field : ``lsst.pex.config.ConfigurableField``
A configuration field.
field_id : `str`
... | [
"Create",
"a",
"section",
"node",
"that",
"documents",
"a",
"ConfigurableField",
"config",
"field",
"."
] | 75f02901a80042b28d074df1cc1dca32eb8e38c8 | https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxext/lssttasks/configfieldlists.py#L380-L424 | train |
lsst-sqre/documenteer | documenteer/sphinxext/lssttasks/configfieldlists.py | format_listfield_nodes | def format_listfield_nodes(field_name, field, field_id, state, lineno):
"""Create a section node that documents a ListField config field.
Parameters
----------
field_name : `str`
Name of the configuration field (the attribute name of on the config
class).
field : ``lsst.pex.config.L... | python | def format_listfield_nodes(field_name, field, field_id, state, lineno):
"""Create a section node that documents a ListField config field.
Parameters
----------
field_name : `str`
Name of the configuration field (the attribute name of on the config
class).
field : ``lsst.pex.config.L... | [
"def",
"format_listfield_nodes",
"(",
"field_name",
",",
"field",
",",
"field_id",
",",
"state",
",",
"lineno",
")",
":",
"itemtype_node",
"=",
"nodes",
".",
"definition_list_item",
"(",
")",
"itemtype_node",
"+=",
"nodes",
".",
"term",
"(",
"text",
"=",
"'I... | Create a section node that documents a ListField config field.
Parameters
----------
field_name : `str`
Name of the configuration field (the attribute name of on the config
class).
field : ``lsst.pex.config.ListField``
A configuration field.
field_id : `str`
Unique i... | [
"Create",
"a",
"section",
"node",
"that",
"documents",
"a",
"ListField",
"config",
"field",
"."
] | 75f02901a80042b28d074df1cc1dca32eb8e38c8 | https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxext/lssttasks/configfieldlists.py#L428-L529 | train |
lsst-sqre/documenteer | documenteer/sphinxext/lssttasks/configfieldlists.py | format_choicefield_nodes | def format_choicefield_nodes(field_name, field, field_id, state, lineno):
"""Create a section node that documents a ChoiceField config field.
Parameters
----------
field_name : `str`
Name of the configuration field (the attribute name of on the config
class).
field : ``lsst.pex.conf... | python | def format_choicefield_nodes(field_name, field, field_id, state, lineno):
"""Create a section node that documents a ChoiceField config field.
Parameters
----------
field_name : `str`
Name of the configuration field (the attribute name of on the config
class).
field : ``lsst.pex.conf... | [
"def",
"format_choicefield_nodes",
"(",
"field_name",
",",
"field",
",",
"field_id",
",",
"state",
",",
"lineno",
")",
":",
"choice_dl",
"=",
"nodes",
".",
"definition_list",
"(",
")",
"for",
"choice_value",
",",
"choice_doc",
"in",
"field",
".",
"allowed",
... | Create a section node that documents a ChoiceField config field.
Parameters
----------
field_name : `str`
Name of the configuration field (the attribute name of on the config
class).
field : ``lsst.pex.config.ChoiceField``
A configuration field.
field_id : `str`
Uniq... | [
"Create",
"a",
"section",
"node",
"that",
"documents",
"a",
"ChoiceField",
"config",
"field",
"."
] | 75f02901a80042b28d074df1cc1dca32eb8e38c8 | https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxext/lssttasks/configfieldlists.py#L533-L605 | train |
lsst-sqre/documenteer | documenteer/sphinxext/lssttasks/configfieldlists.py | format_rangefield_nodes | def format_rangefield_nodes(field_name, field, field_id, state, lineno):
"""Create a section node that documents a RangeField config field.
Parameters
----------
field_name : `str`
Name of the configuration field (the attribute name of on the config
class).
field : ``lsst.pex.config... | python | def format_rangefield_nodes(field_name, field, field_id, state, lineno):
"""Create a section node that documents a RangeField config field.
Parameters
----------
field_name : `str`
Name of the configuration field (the attribute name of on the config
class).
field : ``lsst.pex.config... | [
"def",
"format_rangefield_nodes",
"(",
"field_name",
",",
"field",
",",
"field_id",
",",
"state",
",",
"lineno",
")",
":",
"field_type_item",
"=",
"nodes",
".",
"definition_list_item",
"(",
")",
"field_type_item",
".",
"append",
"(",
"nodes",
".",
"term",
"(",... | Create a section node that documents a RangeField config field.
Parameters
----------
field_name : `str`
Name of the configuration field (the attribute name of on the config
class).
field : ``lsst.pex.config.RangeField``
A configuration field.
field_id : `str`
Unique... | [
"Create",
"a",
"section",
"node",
"that",
"documents",
"a",
"RangeField",
"config",
"field",
"."
] | 75f02901a80042b28d074df1cc1dca32eb8e38c8 | https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxext/lssttasks/configfieldlists.py#L609-L670 | train |
lsst-sqre/documenteer | documenteer/sphinxext/lssttasks/configfieldlists.py | format_dictfield_nodes | def format_dictfield_nodes(field_name, field, field_id, state, lineno):
"""Create a section node that documents a DictField config field.
Parameters
----------
field_name : `str`
Name of the configuration field (the attribute name of on the config
class).
field : ``lsst.pex.config.D... | python | def format_dictfield_nodes(field_name, field, field_id, state, lineno):
"""Create a section node that documents a DictField config field.
Parameters
----------
field_name : `str`
Name of the configuration field (the attribute name of on the config
class).
field : ``lsst.pex.config.D... | [
"def",
"format_dictfield_nodes",
"(",
"field_name",
",",
"field",
",",
"field_id",
",",
"state",
",",
"lineno",
")",
":",
"valuetype_item",
"=",
"nodes",
".",
"definition_list_item",
"(",
")",
"valuetype_item",
"=",
"nodes",
".",
"term",
"(",
"text",
"=",
"'... | Create a section node that documents a DictField config field.
Parameters
----------
field_name : `str`
Name of the configuration field (the attribute name of on the config
class).
field : ``lsst.pex.config.DictField``
A configuration field.
field_id : `str`
Unique i... | [
"Create",
"a",
"section",
"node",
"that",
"documents",
"a",
"DictField",
"config",
"field",
"."
] | 75f02901a80042b28d074df1cc1dca32eb8e38c8 | https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxext/lssttasks/configfieldlists.py#L674-L720 | train |
lsst-sqre/documenteer | documenteer/sphinxext/lssttasks/configfieldlists.py | format_configfield_nodes | def format_configfield_nodes(field_name, field, field_id, state, lineno):
"""Create a section node that documents a ConfigField config field.
Parameters
----------
field_name : `str`
Name of the configuration field (the attribute name of on the config
class).
field : ``lsst.pex.conf... | python | def format_configfield_nodes(field_name, field, field_id, state, lineno):
"""Create a section node that documents a ConfigField config field.
Parameters
----------
field_name : `str`
Name of the configuration field (the attribute name of on the config
class).
field : ``lsst.pex.conf... | [
"def",
"format_configfield_nodes",
"(",
"field_name",
",",
"field",
",",
"field_id",
",",
"state",
",",
"lineno",
")",
":",
"dtype_node",
"=",
"nodes",
".",
"definition_list_item",
"(",
")",
"dtype_node",
"=",
"nodes",
".",
"term",
"(",
"text",
"=",
"'Data t... | Create a section node that documents a ConfigField config field.
Parameters
----------
field_name : `str`
Name of the configuration field (the attribute name of on the config
class).
field : ``lsst.pex.config.ConfigField``
A configuration field.
field_id : `str`
Uniq... | [
"Create",
"a",
"section",
"node",
"that",
"documents",
"a",
"ConfigField",
"config",
"field",
"."
] | 75f02901a80042b28d074df1cc1dca32eb8e38c8 | https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxext/lssttasks/configfieldlists.py#L724-L768 | train |
lsst-sqre/documenteer | documenteer/sphinxext/lssttasks/configfieldlists.py | format_configchoicefield_nodes | def format_configchoicefield_nodes(field_name, field, field_id, state, lineno):
"""Create a section node that documents a ConfigChoiceField config field.
Parameters
----------
field_name : `str`
Name of the configuration field (the attribute name of on the config
class).
field : ``l... | python | def format_configchoicefield_nodes(field_name, field, field_id, state, lineno):
"""Create a section node that documents a ConfigChoiceField config field.
Parameters
----------
field_name : `str`
Name of the configuration field (the attribute name of on the config
class).
field : ``l... | [
"def",
"format_configchoicefield_nodes",
"(",
"field_name",
",",
"field",
",",
"field_id",
",",
"state",
",",
"lineno",
")",
":",
"choice_dl",
"=",
"nodes",
".",
"definition_list",
"(",
")",
"for",
"choice_value",
",",
"choice_class",
"in",
"field",
".",
"type... | Create a section node that documents a ConfigChoiceField config field.
Parameters
----------
field_name : `str`
Name of the configuration field (the attribute name of on the config
class).
field : ``lsst.pex.config.ConfigChoiceField``
A configuration field.
field_id : `str`
... | [
"Create",
"a",
"section",
"node",
"that",
"documents",
"a",
"ConfigChoiceField",
"config",
"field",
"."
] | 75f02901a80042b28d074df1cc1dca32eb8e38c8 | https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxext/lssttasks/configfieldlists.py#L772-L846 | train |
lsst-sqre/documenteer | documenteer/sphinxext/lssttasks/configfieldlists.py | format_configdictfield_nodes | def format_configdictfield_nodes(field_name, field, field_id, state, lineno):
"""Create a section node that documents a ConfigDictField config field.
Parameters
----------
field_name : `str`
Name of the configuration field (the attribute name of on the config
class).
field : ``lsst.... | python | def format_configdictfield_nodes(field_name, field, field_id, state, lineno):
"""Create a section node that documents a ConfigDictField config field.
Parameters
----------
field_name : `str`
Name of the configuration field (the attribute name of on the config
class).
field : ``lsst.... | [
"def",
"format_configdictfield_nodes",
"(",
"field_name",
",",
"field",
",",
"field_id",
",",
"state",
",",
"lineno",
")",
":",
"value_item",
"=",
"nodes",
".",
"definition_list_item",
"(",
")",
"value_item",
"+=",
"nodes",
".",
"term",
"(",
"text",
"=",
"\"... | Create a section node that documents a ConfigDictField config field.
Parameters
----------
field_name : `str`
Name of the configuration field (the attribute name of on the config
class).
field : ``lsst.pex.config.ConfigDictField``
A configuration field.
field_id : `str`
... | [
"Create",
"a",
"section",
"node",
"that",
"documents",
"a",
"ConfigDictField",
"config",
"field",
"."
] | 75f02901a80042b28d074df1cc1dca32eb8e38c8 | https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxext/lssttasks/configfieldlists.py#L850-L895 | train |
lsst-sqre/documenteer | documenteer/sphinxext/lssttasks/configfieldlists.py | format_registryfield_nodes | def format_registryfield_nodes(field_name, field, field_id, state, lineno):
"""Create a section node that documents a RegistryField config field.
Parameters
----------
field_name : `str`
Name of the configuration field (the attribute name of on the config
class).
field : ``lsst.pex.... | python | def format_registryfield_nodes(field_name, field, field_id, state, lineno):
"""Create a section node that documents a RegistryField config field.
Parameters
----------
field_name : `str`
Name of the configuration field (the attribute name of on the config
class).
field : ``lsst.pex.... | [
"def",
"format_registryfield_nodes",
"(",
"field_name",
",",
"field",
",",
"field_id",
",",
"state",
",",
"lineno",
")",
":",
"from",
"lsst",
".",
"pex",
".",
"config",
".",
"registry",
"import",
"ConfigurableWrapper",
"choice_dl",
"=",
"nodes",
".",
"definiti... | Create a section node that documents a RegistryField config field.
Parameters
----------
field_name : `str`
Name of the configuration field (the attribute name of on the config
class).
field : ``lsst.pex.config.RegistryField``
A configuration field.
field_id : `str`
... | [
"Create",
"a",
"section",
"node",
"that",
"documents",
"a",
"RegistryField",
"config",
"field",
"."
] | 75f02901a80042b28d074df1cc1dca32eb8e38c8 | https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxext/lssttasks/configfieldlists.py#L899-L990 | train |
lsst-sqre/documenteer | documenteer/sphinxext/lssttasks/configfieldlists.py | create_field_type_item_node | def create_field_type_item_node(field, state):
"""Create a definition list item node that describes a field's type.
Parameters
----------
field : ``lsst.pex.config.Field``
A configuration field.
state : ``docutils.statemachine.State``
Usually the directive's ``state`` attribute.
... | python | def create_field_type_item_node(field, state):
"""Create a definition list item node that describes a field's type.
Parameters
----------
field : ``lsst.pex.config.Field``
A configuration field.
state : ``docutils.statemachine.State``
Usually the directive's ``state`` attribute.
... | [
"def",
"create_field_type_item_node",
"(",
"field",
",",
"state",
")",
":",
"type_item",
"=",
"nodes",
".",
"definition_list_item",
"(",
")",
"type_item",
".",
"append",
"(",
"nodes",
".",
"term",
"(",
"text",
"=",
"\"Field type\"",
")",
")",
"type_item_conten... | Create a definition list item node that describes a field's type.
Parameters
----------
field : ``lsst.pex.config.Field``
A configuration field.
state : ``docutils.statemachine.State``
Usually the directive's ``state`` attribute.
Returns
-------
``docutils.nodes.definition_... | [
"Create",
"a",
"definition",
"list",
"item",
"node",
"that",
"describes",
"a",
"field",
"s",
"type",
"."
] | 75f02901a80042b28d074df1cc1dca32eb8e38c8 | https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxext/lssttasks/configfieldlists.py#L993-L1020 | train |
lsst-sqre/documenteer | documenteer/sphinxext/lssttasks/configfieldlists.py | create_default_item_node | def create_default_item_node(field, state):
"""Create a definition list item node that describes the default value
of a Field config.
Parameters
----------
field : ``lsst.pex.config.Field``
A configuration field.
state : ``docutils.statemachine.State``
Usually the directive's ``... | python | def create_default_item_node(field, state):
"""Create a definition list item node that describes the default value
of a Field config.
Parameters
----------
field : ``lsst.pex.config.Field``
A configuration field.
state : ``docutils.statemachine.State``
Usually the directive's ``... | [
"def",
"create_default_item_node",
"(",
"field",
",",
"state",
")",
":",
"default_item",
"=",
"nodes",
".",
"definition_list_item",
"(",
")",
"default_item",
".",
"append",
"(",
"nodes",
".",
"term",
"(",
"text",
"=",
"\"Default\"",
")",
")",
"default_item_con... | Create a definition list item node that describes the default value
of a Field config.
Parameters
----------
field : ``lsst.pex.config.Field``
A configuration field.
state : ``docutils.statemachine.State``
Usually the directive's ``state`` attribute.
Returns
-------
``d... | [
"Create",
"a",
"definition",
"list",
"item",
"node",
"that",
"describes",
"the",
"default",
"value",
"of",
"a",
"Field",
"config",
"."
] | 75f02901a80042b28d074df1cc1dca32eb8e38c8 | https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxext/lssttasks/configfieldlists.py#L1023-L1047 | train |
lsst-sqre/documenteer | documenteer/sphinxext/lssttasks/configfieldlists.py | create_keytype_item_node | def create_keytype_item_node(field, state):
"""Create a definition list item node that describes the key type
of a dict-type config field.
Parameters
----------
field : ``lsst.pex.config.Field``
A ``lsst.pex.config.DictField`` or ``lsst.pex.config.DictConfigField``.
state : ``docutils.s... | python | def create_keytype_item_node(field, state):
"""Create a definition list item node that describes the key type
of a dict-type config field.
Parameters
----------
field : ``lsst.pex.config.Field``
A ``lsst.pex.config.DictField`` or ``lsst.pex.config.DictConfigField``.
state : ``docutils.s... | [
"def",
"create_keytype_item_node",
"(",
"field",
",",
"state",
")",
":",
"keytype_node",
"=",
"nodes",
".",
"definition_list_item",
"(",
")",
"keytype_node",
"=",
"nodes",
".",
"term",
"(",
"text",
"=",
"'Key type'",
")",
"keytype_def",
"=",
"nodes",
".",
"d... | Create a definition list item node that describes the key type
of a dict-type config field.
Parameters
----------
field : ``lsst.pex.config.Field``
A ``lsst.pex.config.DictField`` or ``lsst.pex.config.DictConfigField``.
state : ``docutils.statemachine.State``
Usually the directive's... | [
"Create",
"a",
"definition",
"list",
"item",
"node",
"that",
"describes",
"the",
"key",
"type",
"of",
"a",
"dict",
"-",
"type",
"config",
"field",
"."
] | 75f02901a80042b28d074df1cc1dca32eb8e38c8 | https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxext/lssttasks/configfieldlists.py#L1050-L1074 | train |
lsst-sqre/documenteer | documenteer/sphinxext/lssttasks/configfieldlists.py | create_description_node | def create_description_node(field, state):
"""Creates docutils nodes for the Field's description, built from the
field's ``doc`` and ``optional`` attributes.
Parameters
----------
field : ``lsst.pex.config.Field``
A configuration field.
state : ``docutils.statemachine.State``
Us... | python | def create_description_node(field, state):
"""Creates docutils nodes for the Field's description, built from the
field's ``doc`` and ``optional`` attributes.
Parameters
----------
field : ``lsst.pex.config.Field``
A configuration field.
state : ``docutils.statemachine.State``
Us... | [
"def",
"create_description_node",
"(",
"field",
",",
"state",
")",
":",
"doc_container_node",
"=",
"nodes",
".",
"container",
"(",
")",
"doc_container_node",
"+=",
"parse_rst_content",
"(",
"field",
".",
"doc",
",",
"state",
")",
"return",
"doc_container_node"
] | Creates docutils nodes for the Field's description, built from the
field's ``doc`` and ``optional`` attributes.
Parameters
----------
field : ``lsst.pex.config.Field``
A configuration field.
state : ``docutils.statemachine.State``
Usually the directive's ``state`` attribute.
Re... | [
"Creates",
"docutils",
"nodes",
"for",
"the",
"Field",
"s",
"description",
"built",
"from",
"the",
"field",
"s",
"doc",
"and",
"optional",
"attributes",
"."
] | 75f02901a80042b28d074df1cc1dca32eb8e38c8 | https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxext/lssttasks/configfieldlists.py#L1077-L1096 | train |
lsst-sqre/documenteer | documenteer/sphinxext/lssttasks/configfieldlists.py | create_title_node | def create_title_node(field_name, field, field_id, state, lineno):
"""Create docutils nodes for the configuration field's title and
reference target node.
Parameters
----------
field : ``lsst.pex.config.Field``
A configuration field.
state : ``docutils.statemachine.State``
Usual... | python | def create_title_node(field_name, field, field_id, state, lineno):
"""Create docutils nodes for the configuration field's title and
reference target node.
Parameters
----------
field : ``lsst.pex.config.Field``
A configuration field.
state : ``docutils.statemachine.State``
Usual... | [
"def",
"create_title_node",
"(",
"field_name",
",",
"field",
",",
"field_id",
",",
"state",
",",
"lineno",
")",
":",
"env",
"=",
"state",
".",
"document",
".",
"settings",
".",
"env",
"ref_target",
"=",
"create_configfield_ref_target_node",
"(",
"field_id",
",... | Create docutils nodes for the configuration field's title and
reference target node.
Parameters
----------
field : ``lsst.pex.config.Field``
A configuration field.
state : ``docutils.statemachine.State``
Usually the directive's ``state`` attribute.
Returns
-------
``doc... | [
"Create",
"docutils",
"nodes",
"for",
"the",
"configuration",
"field",
"s",
"title",
"and",
"reference",
"target",
"node",
"."
] | 75f02901a80042b28d074df1cc1dca32eb8e38c8 | https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxext/lssttasks/configfieldlists.py#L1099-L1124 | train |
lsst-sqre/documenteer | documenteer/sphinxext/lssttasks/configfieldlists.py | create_configfield_ref_target_node | def create_configfield_ref_target_node(target_id, env, lineno):
"""Create a ``target`` node that marks a configuration field.
Internally, this also adds to the ``lsst_configfields`` attribute of the
environment that is consumed by `documenteer.sphinxext.lssttasks.
crossrefs.process_pending_configfield_... | python | def create_configfield_ref_target_node(target_id, env, lineno):
"""Create a ``target`` node that marks a configuration field.
Internally, this also adds to the ``lsst_configfields`` attribute of the
environment that is consumed by `documenteer.sphinxext.lssttasks.
crossrefs.process_pending_configfield_... | [
"def",
"create_configfield_ref_target_node",
"(",
"target_id",
",",
"env",
",",
"lineno",
")",
":",
"target_node",
"=",
"nodes",
".",
"target",
"(",
"''",
",",
"''",
",",
"ids",
"=",
"[",
"target_id",
"]",
")",
"if",
"not",
"hasattr",
"(",
"env",
",",
... | Create a ``target`` node that marks a configuration field.
Internally, this also adds to the ``lsst_configfields`` attribute of the
environment that is consumed by `documenteer.sphinxext.lssttasks.
crossrefs.process_pending_configfield_xref_nodes`.
See also
--------
`documenteer.sphinxext.lsst... | [
"Create",
"a",
"target",
"node",
"that",
"marks",
"a",
"configuration",
"field",
"."
] | 75f02901a80042b28d074df1cc1dca32eb8e38c8 | https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxext/lssttasks/configfieldlists.py#L1127-L1150 | train |
bgyori/pykqml | kqml/kqml_module.py | translate_argv | def translate_argv(raw_args):
"""Enables conversion from system arguments.
Parameters
----------
raw_args : list
Arguments taken raw from the system input.
Returns
-------
kwargs : dict
The input arguments formatted as a kwargs dict.
To use as input, simply use `KQM... | python | def translate_argv(raw_args):
"""Enables conversion from system arguments.
Parameters
----------
raw_args : list
Arguments taken raw from the system input.
Returns
-------
kwargs : dict
The input arguments formatted as a kwargs dict.
To use as input, simply use `KQM... | [
"def",
"translate_argv",
"(",
"raw_args",
")",
":",
"kwargs",
"=",
"{",
"}",
"def",
"get_parameter",
"(",
"param_str",
")",
":",
"for",
"i",
",",
"a",
"in",
"enumerate",
"(",
"raw_args",
")",
":",
"if",
"a",
"==",
"param_str",
":",
"assert",
"len",
"... | Enables conversion from system arguments.
Parameters
----------
raw_args : list
Arguments taken raw from the system input.
Returns
-------
kwargs : dict
The input arguments formatted as a kwargs dict.
To use as input, simply use `KQMLModule(**kwargs)`. | [
"Enables",
"conversion",
"from",
"system",
"arguments",
"."
] | c18b39868626215deb634567c6bd7c0838e443c0 | https://github.com/bgyori/pykqml/blob/c18b39868626215deb634567c6bd7c0838e443c0/kqml/kqml_module.py#L22-L75 | train |
lsst-sqre/documenteer | documenteer/sphinxext/lssttasks/topiclists.py | BaseTopicListDirective._build_toctree | def _build_toctree(self):
"""Create a hidden toctree node with the contents of a directory
prefixed by the directory name specified by the `toctree` directive
option.
"""
dirname = posixpath.dirname(self._env.docname)
tree_prefix = self.options['toctree'].strip()
... | python | def _build_toctree(self):
"""Create a hidden toctree node with the contents of a directory
prefixed by the directory name specified by the `toctree` directive
option.
"""
dirname = posixpath.dirname(self._env.docname)
tree_prefix = self.options['toctree'].strip()
... | [
"def",
"_build_toctree",
"(",
"self",
")",
":",
"dirname",
"=",
"posixpath",
".",
"dirname",
"(",
"self",
".",
"_env",
".",
"docname",
")",
"tree_prefix",
"=",
"self",
".",
"options",
"[",
"'toctree'",
"]",
".",
"strip",
"(",
")",
"root",
"=",
"posixpa... | Create a hidden toctree node with the contents of a directory
prefixed by the directory name specified by the `toctree` directive
option. | [
"Create",
"a",
"hidden",
"toctree",
"node",
"with",
"the",
"contents",
"of",
"a",
"directory",
"prefixed",
"by",
"the",
"directory",
"name",
"specified",
"by",
"the",
"toctree",
"directive",
"option",
"."
] | 75f02901a80042b28d074df1cc1dca32eb8e38c8 | https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxext/lssttasks/topiclists.py#L74-L104 | train |
mastro35/flows | flows/Actions/WebserverAction.py | MyServerRequestHandler.do_GET | def do_GET(self):
"""
Handle GET WebMethod
"""
self.send_response(200)
self.send_header("Content-type", "text/html")
self.end_headers()
self.wfile.write(bytes(json.dumps(self.message), "utf-8")) | python | def do_GET(self):
"""
Handle GET WebMethod
"""
self.send_response(200)
self.send_header("Content-type", "text/html")
self.end_headers()
self.wfile.write(bytes(json.dumps(self.message), "utf-8")) | [
"def",
"do_GET",
"(",
"self",
")",
":",
"self",
".",
"send_response",
"(",
"200",
")",
"self",
".",
"send_header",
"(",
"\"Content-type\"",
",",
"\"text/html\"",
")",
"self",
".",
"end_headers",
"(",
")",
"self",
".",
"wfile",
".",
"write",
"(",
"bytes",... | Handle GET WebMethod | [
"Handle",
"GET",
"WebMethod"
] | 05e488385673a69597b5b39c7728795aa4d5eb18 | https://github.com/mastro35/flows/blob/05e488385673a69597b5b39c7728795aa4d5eb18/flows/Actions/WebserverAction.py#L76-L84 | train |
mastro35/flows | flows/Actions/WebserverAction.py | DannyHTTPServer.serve_forever | def serve_forever(self, poll_interval=0.5):
"""
Cycle for webserer
"""
while self.is_alive:
self.handle_request()
time.sleep(poll_interval) | python | def serve_forever(self, poll_interval=0.5):
"""
Cycle for webserer
"""
while self.is_alive:
self.handle_request()
time.sleep(poll_interval) | [
"def",
"serve_forever",
"(",
"self",
",",
"poll_interval",
"=",
"0.5",
")",
":",
"while",
"self",
".",
"is_alive",
":",
"self",
".",
"handle_request",
"(",
")",
"time",
".",
"sleep",
"(",
"poll_interval",
")"
] | Cycle for webserer | [
"Cycle",
"for",
"webserer"
] | 05e488385673a69597b5b39c7728795aa4d5eb18 | https://github.com/mastro35/flows/blob/05e488385673a69597b5b39c7728795aa4d5eb18/flows/Actions/WebserverAction.py#L100-L106 | train |
mastro35/flows | flows/Actions/WebserverAction.py | DannyHTTPServer.stop | def stop(self):
"""
Stop the webserver
"""
self.is_alive = False
self.server_close()
flows.Global.LOGGER.info("Server Stops " + (str(self.server_address))) | python | def stop(self):
"""
Stop the webserver
"""
self.is_alive = False
self.server_close()
flows.Global.LOGGER.info("Server Stops " + (str(self.server_address))) | [
"def",
"stop",
"(",
"self",
")",
":",
"self",
".",
"is_alive",
"=",
"False",
"self",
".",
"server_close",
"(",
")",
"flows",
".",
"Global",
".",
"LOGGER",
".",
"info",
"(",
"\"Server Stops \"",
"+",
"(",
"str",
"(",
"self",
".",
"server_address",
")",
... | Stop the webserver | [
"Stop",
"the",
"webserver"
] | 05e488385673a69597b5b39c7728795aa4d5eb18 | https://github.com/mastro35/flows/blob/05e488385673a69597b5b39c7728795aa4d5eb18/flows/Actions/WebserverAction.py#L108-L114 | train |
yymao/generic-catalog-reader | GCR/query.py | GCRQuery.check_scalar | def check_scalar(self, scalar_dict):
"""
check if `scalar_dict` satisfy query
"""
table = {k: np.array([v]) for k, v in scalar_dict.items()}
return self.mask(table)[0] | python | def check_scalar(self, scalar_dict):
"""
check if `scalar_dict` satisfy query
"""
table = {k: np.array([v]) for k, v in scalar_dict.items()}
return self.mask(table)[0] | [
"def",
"check_scalar",
"(",
"self",
",",
"scalar_dict",
")",
":",
"table",
"=",
"{",
"k",
":",
"np",
".",
"array",
"(",
"[",
"v",
"]",
")",
"for",
"k",
",",
"v",
"in",
"scalar_dict",
".",
"items",
"(",
")",
"}",
"return",
"self",
".",
"mask",
"... | check if `scalar_dict` satisfy query | [
"check",
"if",
"scalar_dict",
"satisfy",
"query"
] | bc6267ac41b9f68106ed6065184469ac13fdc0b6 | https://github.com/yymao/generic-catalog-reader/blob/bc6267ac41b9f68106ed6065184469ac13fdc0b6/GCR/query.py#L28-L33 | train |
untwisted/untwisted | untwisted/stdin.py | Stdin.dumpfile | def dumpfile(self, fd):
"""
Dump a file through a Spin instance.
"""
self.start()
dump = DumpFile(fd)
self.queue.append(dump) | python | def dumpfile(self, fd):
"""
Dump a file through a Spin instance.
"""
self.start()
dump = DumpFile(fd)
self.queue.append(dump) | [
"def",
"dumpfile",
"(",
"self",
",",
"fd",
")",
":",
"self",
".",
"start",
"(",
")",
"dump",
"=",
"DumpFile",
"(",
"fd",
")",
"self",
".",
"queue",
".",
"append",
"(",
"dump",
")"
] | Dump a file through a Spin instance. | [
"Dump",
"a",
"file",
"through",
"a",
"Spin",
"instance",
"."
] | 8a8d9c8a8d0f3452d5de67cd760297bb5759f637 | https://github.com/untwisted/untwisted/blob/8a8d9c8a8d0f3452d5de67cd760297bb5759f637/untwisted/stdin.py#L62-L69 | train |
lsst-sqre/documenteer | documenteer/sphinxext/remotecodeblock.py | RemoteCodeBlock.run | def run(self):
"""Run the ``remote-code-block`` directive.
"""
document = self.state.document
if not document.settings.file_insertion_enabled:
return [document.reporter.warning('File insertion disabled',
line=self.lineno)]
... | python | def run(self):
"""Run the ``remote-code-block`` directive.
"""
document = self.state.document
if not document.settings.file_insertion_enabled:
return [document.reporter.warning('File insertion disabled',
line=self.lineno)]
... | [
"def",
"run",
"(",
"self",
")",
":",
"document",
"=",
"self",
".",
"state",
".",
"document",
"if",
"not",
"document",
".",
"settings",
".",
"file_insertion_enabled",
":",
"return",
"[",
"document",
".",
"reporter",
".",
"warning",
"(",
"'File insertion disab... | Run the ``remote-code-block`` directive. | [
"Run",
"the",
"remote",
"-",
"code",
"-",
"block",
"directive",
"."
] | 75f02901a80042b28d074df1cc1dca32eb8e38c8 | https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxext/remotecodeblock.py#L75-L124 | train |
lsst-sqre/documenteer | documenteer/sphinxext/remotecodeblock.py | RemoteCodeBlockReader.read_file | def read_file(self, url, location=None):
"""Read content from the web by overriding
`LiteralIncludeReader.read_file`.
"""
response = requests_retry_session().get(url, timeout=10.0)
response.raise_for_status()
text = response.text
if 'tab-width' in self.options:
... | python | def read_file(self, url, location=None):
"""Read content from the web by overriding
`LiteralIncludeReader.read_file`.
"""
response = requests_retry_session().get(url, timeout=10.0)
response.raise_for_status()
text = response.text
if 'tab-width' in self.options:
... | [
"def",
"read_file",
"(",
"self",
",",
"url",
",",
"location",
"=",
"None",
")",
":",
"response",
"=",
"requests_retry_session",
"(",
")",
".",
"get",
"(",
"url",
",",
"timeout",
"=",
"10.0",
")",
"response",
".",
"raise_for_status",
"(",
")",
"text",
"... | Read content from the web by overriding
`LiteralIncludeReader.read_file`. | [
"Read",
"content",
"from",
"the",
"web",
"by",
"overriding",
"LiteralIncludeReader",
".",
"read_file",
"."
] | 75f02901a80042b28d074df1cc1dca32eb8e38c8 | https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxext/remotecodeblock.py#L131-L141 | train |
mastro35/flows | flows/Actions/PassOnInterval.py | PassOnInterval.verify_time | def verify_time(self, now):
'''Verify the time'''
return now.time() >= self.start_time and now.time() <= self.end_time | python | def verify_time(self, now):
'''Verify the time'''
return now.time() >= self.start_time and now.time() <= self.end_time | [
"def",
"verify_time",
"(",
"self",
",",
"now",
")",
":",
"return",
"now",
".",
"time",
"(",
")",
">=",
"self",
".",
"start_time",
"and",
"now",
".",
"time",
"(",
")",
"<=",
"self",
".",
"end_time"
] | Verify the time | [
"Verify",
"the",
"time"
] | 05e488385673a69597b5b39c7728795aa4d5eb18 | https://github.com/mastro35/flows/blob/05e488385673a69597b5b39c7728795aa4d5eb18/flows/Actions/PassOnInterval.py#L63-L65 | train |
mastro35/flows | flows/Actions/PassOnInterval.py | PassOnInterval.verify_weekday | def verify_weekday(self, now):
'''Verify the weekday'''
return self.weekdays == "*" or str(now.weekday()) in self.weekdays.split(" ") | python | def verify_weekday(self, now):
'''Verify the weekday'''
return self.weekdays == "*" or str(now.weekday()) in self.weekdays.split(" ") | [
"def",
"verify_weekday",
"(",
"self",
",",
"now",
")",
":",
"return",
"self",
".",
"weekdays",
"==",
"\"*\"",
"or",
"str",
"(",
"now",
".",
"weekday",
"(",
")",
")",
"in",
"self",
".",
"weekdays",
".",
"split",
"(",
"\" \"",
")"
] | Verify the weekday | [
"Verify",
"the",
"weekday"
] | 05e488385673a69597b5b39c7728795aa4d5eb18 | https://github.com/mastro35/flows/blob/05e488385673a69597b5b39c7728795aa4d5eb18/flows/Actions/PassOnInterval.py#L67-L69 | train |
mastro35/flows | flows/Actions/PassOnInterval.py | PassOnInterval.verify_day | def verify_day(self, now):
'''Verify the day'''
return self.day == "*" or str(now.day) in self.day.split(" ") | python | def verify_day(self, now):
'''Verify the day'''
return self.day == "*" or str(now.day) in self.day.split(" ") | [
"def",
"verify_day",
"(",
"self",
",",
"now",
")",
":",
"return",
"self",
".",
"day",
"==",
"\"*\"",
"or",
"str",
"(",
"now",
".",
"day",
")",
"in",
"self",
".",
"day",
".",
"split",
"(",
"\" \"",
")"
] | Verify the day | [
"Verify",
"the",
"day"
] | 05e488385673a69597b5b39c7728795aa4d5eb18 | https://github.com/mastro35/flows/blob/05e488385673a69597b5b39c7728795aa4d5eb18/flows/Actions/PassOnInterval.py#L71-L73 | train |
mastro35/flows | flows/Actions/PassOnInterval.py | PassOnInterval.verify_month | def verify_month(self, now):
'''Verify the month'''
return self.month == "*" or str(now.month) in self.month.split(" ") | python | def verify_month(self, now):
'''Verify the month'''
return self.month == "*" or str(now.month) in self.month.split(" ") | [
"def",
"verify_month",
"(",
"self",
",",
"now",
")",
":",
"return",
"self",
".",
"month",
"==",
"\"*\"",
"or",
"str",
"(",
"now",
".",
"month",
")",
"in",
"self",
".",
"month",
".",
"split",
"(",
"\" \"",
")"
] | Verify the month | [
"Verify",
"the",
"month"
] | 05e488385673a69597b5b39c7728795aa4d5eb18 | https://github.com/mastro35/flows/blob/05e488385673a69597b5b39c7728795aa4d5eb18/flows/Actions/PassOnInterval.py#L75-L77 | train |
maljovec/topopy | topopy/TopologicalObject.py | TopologicalObject.aggregate_duplicates | def aggregate_duplicates(X, Y, aggregator="mean", precision=precision):
""" A function that will attempt to collapse duplicates in
domain space, X, by aggregating values over the range space,
Y.
@ In, X, an m-by-n array of values specifying m
n-dimensional samples... | python | def aggregate_duplicates(X, Y, aggregator="mean", precision=precision):
""" A function that will attempt to collapse duplicates in
domain space, X, by aggregating values over the range space,
Y.
@ In, X, an m-by-n array of values specifying m
n-dimensional samples... | [
"def",
"aggregate_duplicates",
"(",
"X",
",",
"Y",
",",
"aggregator",
"=",
"\"mean\"",
",",
"precision",
"=",
"precision",
")",
":",
"if",
"callable",
"(",
"aggregator",
")",
":",
"pass",
"elif",
"\"min\"",
"in",
"aggregator",
".",
"lower",
"(",
")",
":"... | A function that will attempt to collapse duplicates in
domain space, X, by aggregating values over the range space,
Y.
@ In, X, an m-by-n array of values specifying m
n-dimensional samples
@ In, Y, a m vector of values specifying the output
respons... | [
"A",
"function",
"that",
"will",
"attempt",
"to",
"collapse",
"duplicates",
"in",
"domain",
"space",
"X",
"by",
"aggregating",
"values",
"over",
"the",
"range",
"space",
"Y",
"."
] | 4be598d51c4e4043b73d4ad44beed6d289e2f088 | https://github.com/maljovec/topopy/blob/4be598d51c4e4043b73d4ad44beed6d289e2f088/topopy/TopologicalObject.py#L19-L94 | train |
maljovec/topopy | topopy/TopologicalObject.py | TopologicalObject.__set_data | def __set_data(self, X, Y, w=None):
""" Internally assigns the input data and normalizes it
according to the user's specifications
@ In, X, an m-by-n array of values specifying m
n-dimensional samples
@ In, Y, a m vector of values specifying the output
... | python | def __set_data(self, X, Y, w=None):
""" Internally assigns the input data and normalizes it
according to the user's specifications
@ In, X, an m-by-n array of values specifying m
n-dimensional samples
@ In, Y, a m vector of values specifying the output
... | [
"def",
"__set_data",
"(",
"self",
",",
"X",
",",
"Y",
",",
"w",
"=",
"None",
")",
":",
"self",
".",
"X",
"=",
"X",
"self",
".",
"Y",
"=",
"Y",
"self",
".",
"check_duplicates",
"(",
")",
"if",
"w",
"is",
"not",
"None",
":",
"self",
".",
"w",
... | Internally assigns the input data and normalizes it
according to the user's specifications
@ In, X, an m-by-n array of values specifying m
n-dimensional samples
@ In, Y, a m vector of values specifying the output
responses corresponding to the m samples specif... | [
"Internally",
"assigns",
"the",
"input",
"data",
"and",
"normalizes",
"it",
"according",
"to",
"the",
"user",
"s",
"specifications"
] | 4be598d51c4e4043b73d4ad44beed6d289e2f088 | https://github.com/maljovec/topopy/blob/4be598d51c4e4043b73d4ad44beed6d289e2f088/topopy/TopologicalObject.py#L168-L198 | train |
maljovec/topopy | topopy/TopologicalObject.py | TopologicalObject.build | def build(self, X, Y, w=None, edges=None):
""" Assigns data to this object and builds the requested topological
structure
@ In, X, an m-by-n array of values specifying m
n-dimensional samples
@ In, Y, a m vector of values specifying the output
response... | python | def build(self, X, Y, w=None, edges=None):
""" Assigns data to this object and builds the requested topological
structure
@ In, X, an m-by-n array of values specifying m
n-dimensional samples
@ In, Y, a m vector of values specifying the output
response... | [
"def",
"build",
"(",
"self",
",",
"X",
",",
"Y",
",",
"w",
"=",
"None",
",",
"edges",
"=",
"None",
")",
":",
"self",
".",
"reset",
"(",
")",
"if",
"X",
"is",
"None",
"or",
"Y",
"is",
"None",
":",
"return",
"self",
".",
"__set_data",
"(",
"X",... | Assigns data to this object and builds the requested topological
structure
@ In, X, an m-by-n array of values specifying m
n-dimensional samples
@ In, Y, a m vector of values specifying the output
responses corresponding to the m samples specified by X
... | [
"Assigns",
"data",
"to",
"this",
"object",
"and",
"builds",
"the",
"requested",
"topological",
"structure"
] | 4be598d51c4e4043b73d4ad44beed6d289e2f088 | https://github.com/maljovec/topopy/blob/4be598d51c4e4043b73d4ad44beed6d289e2f088/topopy/TopologicalObject.py#L200-L234 | train |
maljovec/topopy | topopy/TopologicalObject.py | TopologicalObject.load_data_and_build | def load_data_and_build(self, filename, delimiter=","):
""" Convenience function for directly working with a data file.
This opens a file and reads the data into an array, sets the
data as an nparray and list of dimnames
@ In, filename, string representing the data file
... | python | def load_data_and_build(self, filename, delimiter=","):
""" Convenience function for directly working with a data file.
This opens a file and reads the data into an array, sets the
data as an nparray and list of dimnames
@ In, filename, string representing the data file
... | [
"def",
"load_data_and_build",
"(",
"self",
",",
"filename",
",",
"delimiter",
"=",
"\",\"",
")",
":",
"data",
"=",
"np",
".",
"genfromtxt",
"(",
"filename",
",",
"dtype",
"=",
"float",
",",
"delimiter",
"=",
"delimiter",
",",
"names",
"=",
"True",
")",
... | Convenience function for directly working with a data file.
This opens a file and reads the data into an array, sets the
data as an nparray and list of dimnames
@ In, filename, string representing the data file | [
"Convenience",
"function",
"for",
"directly",
"working",
"with",
"a",
"data",
"file",
".",
"This",
"opens",
"a",
"file",
"and",
"reads",
"the",
"data",
"into",
"an",
"array",
"sets",
"the",
"data",
"as",
"an",
"nparray",
"and",
"list",
"of",
"dimnames"
] | 4be598d51c4e4043b73d4ad44beed6d289e2f088 | https://github.com/maljovec/topopy/blob/4be598d51c4e4043b73d4ad44beed6d289e2f088/topopy/TopologicalObject.py#L236-L250 | train |
maljovec/topopy | topopy/TopologicalObject.py | TopologicalObject.get_normed_x | def get_normed_x(self, rows=None, cols=None):
""" Returns the normalized input data requested by the user
@ In, rows, a list of non-negative integers specifying the
row indices to return
@ In, cols, a list of non-negative integers specifying the
column indices to ... | python | def get_normed_x(self, rows=None, cols=None):
""" Returns the normalized input data requested by the user
@ In, rows, a list of non-negative integers specifying the
row indices to return
@ In, cols, a list of non-negative integers specifying the
column indices to ... | [
"def",
"get_normed_x",
"(",
"self",
",",
"rows",
"=",
"None",
",",
"cols",
"=",
"None",
")",
":",
"if",
"rows",
"is",
"None",
":",
"rows",
"=",
"list",
"(",
"range",
"(",
"0",
",",
"self",
".",
"get_sample_size",
"(",
")",
")",
")",
"if",
"cols",... | Returns the normalized input data requested by the user
@ In, rows, a list of non-negative integers specifying the
row indices to return
@ In, cols, a list of non-negative integers specifying the
column indices to return
@ Out, a matrix of floating point value... | [
"Returns",
"the",
"normalized",
"input",
"data",
"requested",
"by",
"the",
"user"
] | 4be598d51c4e4043b73d4ad44beed6d289e2f088 | https://github.com/maljovec/topopy/blob/4be598d51c4e4043b73d4ad44beed6d289e2f088/topopy/TopologicalObject.py#L252-L272 | train |
maljovec/topopy | topopy/TopologicalObject.py | TopologicalObject.get_x | def get_x(self, rows=None, cols=None):
""" Returns the input data requested by the user
@ In, rows, a list of non-negative integers specifying the
row indices to return
@ In, cols, a list of non-negative integers specifying the
column indices to return
... | python | def get_x(self, rows=None, cols=None):
""" Returns the input data requested by the user
@ In, rows, a list of non-negative integers specifying the
row indices to return
@ In, cols, a list of non-negative integers specifying the
column indices to return
... | [
"def",
"get_x",
"(",
"self",
",",
"rows",
"=",
"None",
",",
"cols",
"=",
"None",
")",
":",
"if",
"rows",
"is",
"None",
":",
"rows",
"=",
"list",
"(",
"range",
"(",
"0",
",",
"self",
".",
"get_sample_size",
"(",
")",
")",
")",
"if",
"cols",
"is"... | Returns the input data requested by the user
@ In, rows, a list of non-negative integers specifying the
row indices to return
@ In, cols, a list of non-negative integers specifying the
column indices to return
@ Out, a matrix of floating point values specifyin... | [
"Returns",
"the",
"input",
"data",
"requested",
"by",
"the",
"user"
] | 4be598d51c4e4043b73d4ad44beed6d289e2f088 | https://github.com/maljovec/topopy/blob/4be598d51c4e4043b73d4ad44beed6d289e2f088/topopy/TopologicalObject.py#L274-L295 | train |
maljovec/topopy | topopy/TopologicalObject.py | TopologicalObject.get_y | def get_y(self, indices=None):
""" Returns the output data requested by the user
@ In, indices, a list of non-negative integers specifying
the row indices to return
@ Out, an nparray of floating point values specifying the output
data values filtered by the indice... | python | def get_y(self, indices=None):
""" Returns the output data requested by the user
@ In, indices, a list of non-negative integers specifying
the row indices to return
@ Out, an nparray of floating point values specifying the output
data values filtered by the indice... | [
"def",
"get_y",
"(",
"self",
",",
"indices",
"=",
"None",
")",
":",
"if",
"indices",
"is",
"None",
":",
"indices",
"=",
"list",
"(",
"range",
"(",
"0",
",",
"self",
".",
"get_sample_size",
"(",
")",
")",
")",
"else",
":",
"if",
"not",
"hasattr",
... | Returns the output data requested by the user
@ In, indices, a list of non-negative integers specifying
the row indices to return
@ Out, an nparray of floating point values specifying the output
data values filtered by the indices input parameter. | [
"Returns",
"the",
"output",
"data",
"requested",
"by",
"the",
"user"
] | 4be598d51c4e4043b73d4ad44beed6d289e2f088 | https://github.com/maljovec/topopy/blob/4be598d51c4e4043b73d4ad44beed6d289e2f088/topopy/TopologicalObject.py#L297-L313 | train |
maljovec/topopy | topopy/TopologicalObject.py | TopologicalObject.get_weights | def get_weights(self, indices=None):
""" Returns the weights requested by the user
@ In, indices, a list of non-negative integers specifying
the row indices to return
@ Out, a list of floating point values specifying the
weights associated to the input data rows f... | python | def get_weights(self, indices=None):
""" Returns the weights requested by the user
@ In, indices, a list of non-negative integers specifying
the row indices to return
@ Out, a list of floating point values specifying the
weights associated to the input data rows f... | [
"def",
"get_weights",
"(",
"self",
",",
"indices",
"=",
"None",
")",
":",
"if",
"indices",
"is",
"None",
":",
"indices",
"=",
"list",
"(",
"range",
"(",
"0",
",",
"self",
".",
"get_sample_size",
"(",
")",
")",
")",
"else",
":",
"indices",
"=",
"sor... | Returns the weights requested by the user
@ In, indices, a list of non-negative integers specifying
the row indices to return
@ Out, a list of floating point values specifying the
weights associated to the input data rows filtered by the
indices input paramete... | [
"Returns",
"the",
"weights",
"requested",
"by",
"the",
"user"
] | 4be598d51c4e4043b73d4ad44beed6d289e2f088 | https://github.com/maljovec/topopy/blob/4be598d51c4e4043b73d4ad44beed6d289e2f088/topopy/TopologicalObject.py#L315-L330 | train |
maljovec/topopy | topopy/TopologicalObject.py | TopologicalObject.check_duplicates | def check_duplicates(self):
""" Function to test whether duplicates exist in the input or
output space. First, if an aggregator function has been
specified, the domain space duplicates will be consolidated
using the function to generate a new range value for that
... | python | def check_duplicates(self):
""" Function to test whether duplicates exist in the input or
output space. First, if an aggregator function has been
specified, the domain space duplicates will be consolidated
using the function to generate a new range value for that
... | [
"def",
"check_duplicates",
"(",
"self",
")",
":",
"if",
"self",
".",
"aggregator",
"is",
"not",
"None",
":",
"X",
",",
"Y",
"=",
"TopologicalObject",
".",
"aggregate_duplicates",
"(",
"self",
".",
"X",
",",
"self",
".",
"Y",
",",
"self",
".",
"aggregat... | Function to test whether duplicates exist in the input or
output space. First, if an aggregator function has been
specified, the domain space duplicates will be consolidated
using the function to generate a new range value for that
shared point. Otherwise, it will raise a... | [
"Function",
"to",
"test",
"whether",
"duplicates",
"exist",
"in",
"the",
"input",
"or",
"output",
"space",
".",
"First",
"if",
"an",
"aggregator",
"function",
"has",
"been",
"specified",
"the",
"domain",
"space",
"duplicates",
"will",
"be",
"consolidated",
"us... | 4be598d51c4e4043b73d4ad44beed6d289e2f088 | https://github.com/maljovec/topopy/blob/4be598d51c4e4043b73d4ad44beed6d289e2f088/topopy/TopologicalObject.py#L353-L392 | train |
bskinn/pent | pent/utils.py | column_stack_2d | def column_stack_2d(data):
"""Perform column-stacking on a list of 2d data blocks."""
return list(list(itt.chain.from_iterable(_)) for _ in zip(*data)) | python | def column_stack_2d(data):
"""Perform column-stacking on a list of 2d data blocks."""
return list(list(itt.chain.from_iterable(_)) for _ in zip(*data)) | [
"def",
"column_stack_2d",
"(",
"data",
")",
":",
"return",
"list",
"(",
"list",
"(",
"itt",
".",
"chain",
".",
"from_iterable",
"(",
"_",
")",
")",
"for",
"_",
"in",
"zip",
"(",
"*",
"data",
")",
")"
] | Perform column-stacking on a list of 2d data blocks. | [
"Perform",
"column",
"-",
"stacking",
"on",
"a",
"list",
"of",
"2d",
"data",
"blocks",
"."
] | 7a81e55f46bc3aed3f09d96449d59a770b4730c2 | https://github.com/bskinn/pent/blob/7a81e55f46bc3aed3f09d96449d59a770b4730c2/pent/utils.py#L30-L32 | train |
lsst-sqre/documenteer | documenteer/stackdocs/rootdiscovery.py | discover_conf_py_directory | def discover_conf_py_directory(initial_dir):
"""Discover the directory containing the conf.py file.
This function is useful for building stack docs since it will look in
the current working directory and all parents.
Parameters
----------
initial_dir : `str`
The inititial directory to ... | python | def discover_conf_py_directory(initial_dir):
"""Discover the directory containing the conf.py file.
This function is useful for building stack docs since it will look in
the current working directory and all parents.
Parameters
----------
initial_dir : `str`
The inititial directory to ... | [
"def",
"discover_conf_py_directory",
"(",
"initial_dir",
")",
":",
"initial_dir",
"=",
"pathlib",
".",
"Path",
"(",
"initial_dir",
")",
".",
"resolve",
"(",
")",
"try",
":",
"return",
"str",
"(",
"_search_parents",
"(",
"initial_dir",
")",
")",
"except",
"Fi... | Discover the directory containing the conf.py file.
This function is useful for building stack docs since it will look in
the current working directory and all parents.
Parameters
----------
initial_dir : `str`
The inititial directory to search from. In practice, this is often the
... | [
"Discover",
"the",
"directory",
"containing",
"the",
"conf",
".",
"py",
"file",
"."
] | 75f02901a80042b28d074df1cc1dca32eb8e38c8 | https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/stackdocs/rootdiscovery.py#L51-L81 | train |
lsst-sqre/documenteer | documenteer/stackdocs/rootdiscovery.py | _search_parents | def _search_parents(initial_dir):
"""Search the initial and parent directories for a ``conf.py`` Sphinx
configuration file that represents the root of a Sphinx project.
Returns
-------
root_dir : `pathlib.Path`
Directory path containing a ``conf.py`` file.
Raises
------
FileNot... | python | def _search_parents(initial_dir):
"""Search the initial and parent directories for a ``conf.py`` Sphinx
configuration file that represents the root of a Sphinx project.
Returns
-------
root_dir : `pathlib.Path`
Directory path containing a ``conf.py`` file.
Raises
------
FileNot... | [
"def",
"_search_parents",
"(",
"initial_dir",
")",
":",
"root_paths",
"=",
"(",
"'.'",
",",
"'/'",
")",
"parent",
"=",
"pathlib",
".",
"Path",
"(",
"initial_dir",
")",
"while",
"True",
":",
"if",
"_has_conf_py",
"(",
"parent",
")",
":",
"return",
"parent... | Search the initial and parent directories for a ``conf.py`` Sphinx
configuration file that represents the root of a Sphinx project.
Returns
-------
root_dir : `pathlib.Path`
Directory path containing a ``conf.py`` file.
Raises
------
FileNotFoundError
Raised if a ``conf.py`... | [
"Search",
"the",
"initial",
"and",
"parent",
"directories",
"for",
"a",
"conf",
".",
"py",
"Sphinx",
"configuration",
"file",
"that",
"represents",
"the",
"root",
"of",
"a",
"Sphinx",
"project",
"."
] | 75f02901a80042b28d074df1cc1dca32eb8e38c8 | https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/stackdocs/rootdiscovery.py#L91-L118 | train |
micolous/python-slackrealtime | src/slackrealtime/session.py | request_session | def request_session(token, url=None):
"""
Requests a WebSocket session for the Real-Time Messaging API.
Returns a SessionMetadata object containing the information retrieved from
the API call.
"""
if url is None:
api = SlackApi()
else:
api = SlackApi(url)
response = api.rtm.start(token=token)
return Ses... | python | def request_session(token, url=None):
"""
Requests a WebSocket session for the Real-Time Messaging API.
Returns a SessionMetadata object containing the information retrieved from
the API call.
"""
if url is None:
api = SlackApi()
else:
api = SlackApi(url)
response = api.rtm.start(token=token)
return Ses... | [
"def",
"request_session",
"(",
"token",
",",
"url",
"=",
"None",
")",
":",
"if",
"url",
"is",
"None",
":",
"api",
"=",
"SlackApi",
"(",
")",
"else",
":",
"api",
"=",
"SlackApi",
"(",
"url",
")",
"response",
"=",
"api",
".",
"rtm",
".",
"start",
"... | Requests a WebSocket session for the Real-Time Messaging API.
Returns a SessionMetadata object containing the information retrieved from
the API call. | [
"Requests",
"a",
"WebSocket",
"session",
"for",
"the",
"Real",
"-",
"Time",
"Messaging",
"API",
".",
"Returns",
"a",
"SessionMetadata",
"object",
"containing",
"the",
"information",
"retrieved",
"from",
"the",
"API",
"call",
"."
] | e9c94416f979a6582110ebba09c147de2bfe20a1 | https://github.com/micolous/python-slackrealtime/blob/e9c94416f979a6582110ebba09c147de2bfe20a1/src/slackrealtime/session.py#L208-L221 | train |
micolous/python-slackrealtime | src/slackrealtime/session.py | SessionMetadata._find_resource_by_key | def _find_resource_by_key(self, resource_list, key, value):
"""
Finds a resource by key, first case insensitive match.
Returns tuple of (key, resource)
Raises KeyError if the given key cannot be found.
"""
original = value
value = unicode(value.upper())
for k, resource in resource_list.iteritems():
... | python | def _find_resource_by_key(self, resource_list, key, value):
"""
Finds a resource by key, first case insensitive match.
Returns tuple of (key, resource)
Raises KeyError if the given key cannot be found.
"""
original = value
value = unicode(value.upper())
for k, resource in resource_list.iteritems():
... | [
"def",
"_find_resource_by_key",
"(",
"self",
",",
"resource_list",
",",
"key",
",",
"value",
")",
":",
"original",
"=",
"value",
"value",
"=",
"unicode",
"(",
"value",
".",
"upper",
"(",
")",
")",
"for",
"k",
",",
"resource",
"in",
"resource_list",
".",
... | Finds a resource by key, first case insensitive match.
Returns tuple of (key, resource)
Raises KeyError if the given key cannot be found. | [
"Finds",
"a",
"resource",
"by",
"key",
"first",
"case",
"insensitive",
"match",
"."
] | e9c94416f979a6582110ebba09c147de2bfe20a1 | https://github.com/micolous/python-slackrealtime/blob/e9c94416f979a6582110ebba09c147de2bfe20a1/src/slackrealtime/session.py#L61-L75 | train |
micolous/python-slackrealtime | src/slackrealtime/session.py | SessionMetadata.find_im_by_user_name | def find_im_by_user_name(self, name, auto_create=True):
"""
Finds the ID of the IM with a particular user by name, with the option
to automatically create a new channel if it doesn't exist.
"""
uid = self.find_user_by_name(name)[0]
try:
return self.find_im_by_user_id(uid)
except KeyError:
# IM does ... | python | def find_im_by_user_name(self, name, auto_create=True):
"""
Finds the ID of the IM with a particular user by name, with the option
to automatically create a new channel if it doesn't exist.
"""
uid = self.find_user_by_name(name)[0]
try:
return self.find_im_by_user_id(uid)
except KeyError:
# IM does ... | [
"def",
"find_im_by_user_name",
"(",
"self",
",",
"name",
",",
"auto_create",
"=",
"True",
")",
":",
"uid",
"=",
"self",
".",
"find_user_by_name",
"(",
"name",
")",
"[",
"0",
"]",
"try",
":",
"return",
"self",
".",
"find_im_by_user_id",
"(",
"uid",
")",
... | Finds the ID of the IM with a particular user by name, with the option
to automatically create a new channel if it doesn't exist. | [
"Finds",
"the",
"ID",
"of",
"the",
"IM",
"with",
"a",
"particular",
"user",
"by",
"name",
"with",
"the",
"option",
"to",
"automatically",
"create",
"a",
"new",
"channel",
"if",
"it",
"doesn",
"t",
"exist",
"."
] | e9c94416f979a6582110ebba09c147de2bfe20a1 | https://github.com/micolous/python-slackrealtime/blob/e9c94416f979a6582110ebba09c147de2bfe20a1/src/slackrealtime/session.py#L92-L106 | train |
micolous/python-slackrealtime | src/slackrealtime/session.py | SessionMetadata.update | def update(self, event):
"""
All messages from the Protocol get passed through this method. This
allows the client to have an up-to-date state for the client.
However, this method doesn't actually update right away. Instead, the
acutal update happens in another thread, potentially later, in order to
al... | python | def update(self, event):
"""
All messages from the Protocol get passed through this method. This
allows the client to have an up-to-date state for the client.
However, this method doesn't actually update right away. Instead, the
acutal update happens in another thread, potentially later, in order to
al... | [
"def",
"update",
"(",
"self",
",",
"event",
")",
":",
"event",
"=",
"event",
".",
"copy",
"(",
")",
"reactor",
".",
"callInThread",
"(",
"self",
".",
"_update_deferred",
",",
"event",
")"
] | All messages from the Protocol get passed through this method. This
allows the client to have an up-to-date state for the client.
However, this method doesn't actually update right away. Instead, the
acutal update happens in another thread, potentially later, in order to
allow user code to handle the event... | [
"All",
"messages",
"from",
"the",
"Protocol",
"get",
"passed",
"through",
"this",
"method",
".",
"This",
"allows",
"the",
"client",
"to",
"have",
"an",
"up",
"-",
"to",
"-",
"date",
"state",
"for",
"the",
"client",
".",
"However",
"this",
"method",
"does... | e9c94416f979a6582110ebba09c147de2bfe20a1 | https://github.com/micolous/python-slackrealtime/blob/e9c94416f979a6582110ebba09c147de2bfe20a1/src/slackrealtime/session.py#L108-L125 | train |
fkarb/xltable | xltable/chart.py | Chart.iter_series | def iter_series(self, workbook, row, col):
"""
Yield series dictionaries with values resolved to the final excel formulas.
"""
for series in self.__series:
series = dict(series)
series["values"] = series["values"].get_formula(workbook, row, col)
if "ca... | python | def iter_series(self, workbook, row, col):
"""
Yield series dictionaries with values resolved to the final excel formulas.
"""
for series in self.__series:
series = dict(series)
series["values"] = series["values"].get_formula(workbook, row, col)
if "ca... | [
"def",
"iter_series",
"(",
"self",
",",
"workbook",
",",
"row",
",",
"col",
")",
":",
"for",
"series",
"in",
"self",
".",
"__series",
":",
"series",
"=",
"dict",
"(",
"series",
")",
"series",
"[",
"\"values\"",
"]",
"=",
"series",
"[",
"\"values\"",
... | Yield series dictionaries with values resolved to the final excel formulas. | [
"Yield",
"series",
"dictionaries",
"with",
"values",
"resolved",
"to",
"the",
"final",
"excel",
"formulas",
"."
] | 7a592642d27ad5ee90d2aa8c26338abaa9d84bea | https://github.com/fkarb/xltable/blob/7a592642d27ad5ee90d2aa8c26338abaa9d84bea/xltable/chart.py#L85-L94 | train |
gmdzy2010/dingtalk_sdk_gmdzy2010 | dingtalk_sdk_gmdzy2010/user_request.py | DeptUserRequest.get_userinfo | def get_userinfo(self):
"""Method to get current user's name, mobile, email and position."""
wanted_fields = ["name", "mobile", "orgEmail", "position", "avatar"]
userinfo = {k: self.json_response.get(k, None) for k in wanted_fields}
return userinfo | python | def get_userinfo(self):
"""Method to get current user's name, mobile, email and position."""
wanted_fields = ["name", "mobile", "orgEmail", "position", "avatar"]
userinfo = {k: self.json_response.get(k, None) for k in wanted_fields}
return userinfo | [
"def",
"get_userinfo",
"(",
"self",
")",
":",
"wanted_fields",
"=",
"[",
"\"name\"",
",",
"\"mobile\"",
",",
"\"orgEmail\"",
",",
"\"position\"",
",",
"\"avatar\"",
"]",
"userinfo",
"=",
"{",
"k",
":",
"self",
".",
"json_response",
".",
"get",
"(",
"k",
... | Method to get current user's name, mobile, email and position. | [
"Method",
"to",
"get",
"current",
"user",
"s",
"name",
"mobile",
"email",
"and",
"position",
"."
] | b06cb1f78f89be9554dcb6101af8bc72718a9ecd | https://github.com/gmdzy2010/dingtalk_sdk_gmdzy2010/blob/b06cb1f78f89be9554dcb6101af8bc72718a9ecd/dingtalk_sdk_gmdzy2010/user_request.py#L30-L34 | train |
gmdzy2010/dingtalk_sdk_gmdzy2010 | dingtalk_sdk_gmdzy2010/user_request.py | AdminUsersRequest.get_admin_ids | def get_admin_ids(self):
"""Method to get the administrator id list."""
admins = self.json_response.get("admin_list", None)
admin_ids = [admin_id for admin_id in admins["userid"]]
return admin_ids | python | def get_admin_ids(self):
"""Method to get the administrator id list."""
admins = self.json_response.get("admin_list", None)
admin_ids = [admin_id for admin_id in admins["userid"]]
return admin_ids | [
"def",
"get_admin_ids",
"(",
"self",
")",
":",
"admins",
"=",
"self",
".",
"json_response",
".",
"get",
"(",
"\"admin_list\"",
",",
"None",
")",
"admin_ids",
"=",
"[",
"admin_id",
"for",
"admin_id",
"in",
"admins",
"[",
"\"userid\"",
"]",
"]",
"return",
... | Method to get the administrator id list. | [
"Method",
"to",
"get",
"the",
"administrator",
"id",
"list",
"."
] | b06cb1f78f89be9554dcb6101af8bc72718a9ecd | https://github.com/gmdzy2010/dingtalk_sdk_gmdzy2010/blob/b06cb1f78f89be9554dcb6101af8bc72718a9ecd/dingtalk_sdk_gmdzy2010/user_request.py#L54-L58 | train |
zsimic/runez | src/runez/program.py | run | def run(program, *args, **kwargs):
"""Run 'program' with 'args'"""
args = flattened(args, split=SHELL)
full_path = which(program)
logger = kwargs.pop("logger", LOG.debug)
fatal = kwargs.pop("fatal", True)
dryrun = kwargs.pop("dryrun", is_dryrun())
include_error = kwargs.pop("include_error",... | python | def run(program, *args, **kwargs):
"""Run 'program' with 'args'"""
args = flattened(args, split=SHELL)
full_path = which(program)
logger = kwargs.pop("logger", LOG.debug)
fatal = kwargs.pop("fatal", True)
dryrun = kwargs.pop("dryrun", is_dryrun())
include_error = kwargs.pop("include_error",... | [
"def",
"run",
"(",
"program",
",",
"*",
"args",
",",
"**",
"kwargs",
")",
":",
"args",
"=",
"flattened",
"(",
"args",
",",
"split",
"=",
"SHELL",
")",
"full_path",
"=",
"which",
"(",
"program",
")",
"logger",
"=",
"kwargs",
".",
"pop",
"(",
"\"logg... | Run 'program' with 'args | [
"Run",
"program",
"with",
"args"
] | 14363b719a1aae1528859a501a22d075ce0abfcc | https://github.com/zsimic/runez/blob/14363b719a1aae1528859a501a22d075ce0abfcc/src/runez/program.py#L100-L143 | train |
gmdzy2010/dingtalk_sdk_gmdzy2010 | dingtalk_sdk_gmdzy2010/department_request.py | DeptRequest.get_dept_name | def get_dept_name(self):
"""Method to get the department name"""
self.logger.info("%s\t%s" % (self.request_method, self.request_url))
return self.json_response.get("name", None) | python | def get_dept_name(self):
"""Method to get the department name"""
self.logger.info("%s\t%s" % (self.request_method, self.request_url))
return self.json_response.get("name", None) | [
"def",
"get_dept_name",
"(",
"self",
")",
":",
"self",
".",
"logger",
".",
"info",
"(",
"\"%s\\t%s\"",
"%",
"(",
"self",
".",
"request_method",
",",
"self",
".",
"request_url",
")",
")",
"return",
"self",
".",
"json_response",
".",
"get",
"(",
"\"name\""... | Method to get the department name | [
"Method",
"to",
"get",
"the",
"department",
"name"
] | b06cb1f78f89be9554dcb6101af8bc72718a9ecd | https://github.com/gmdzy2010/dingtalk_sdk_gmdzy2010/blob/b06cb1f78f89be9554dcb6101af8bc72718a9ecd/dingtalk_sdk_gmdzy2010/department_request.py#L22-L25 | train |
gmdzy2010/dingtalk_sdk_gmdzy2010 | dingtalk_sdk_gmdzy2010/department_request.py | DeptRequest.get_dept_manager_ids | def get_dept_manager_ids(self):
"""Method to get the id list of department manager."""
self.logger.info("%s\t%s" % (self.request_method, self.request_url))
return self.json_response.get("deptManagerUseridList", None) | python | def get_dept_manager_ids(self):
"""Method to get the id list of department manager."""
self.logger.info("%s\t%s" % (self.request_method, self.request_url))
return self.json_response.get("deptManagerUseridList", None) | [
"def",
"get_dept_manager_ids",
"(",
"self",
")",
":",
"self",
".",
"logger",
".",
"info",
"(",
"\"%s\\t%s\"",
"%",
"(",
"self",
".",
"request_method",
",",
"self",
".",
"request_url",
")",
")",
"return",
"self",
".",
"json_response",
".",
"get",
"(",
"\"... | Method to get the id list of department manager. | [
"Method",
"to",
"get",
"the",
"id",
"list",
"of",
"department",
"manager",
"."
] | b06cb1f78f89be9554dcb6101af8bc72718a9ecd | https://github.com/gmdzy2010/dingtalk_sdk_gmdzy2010/blob/b06cb1f78f89be9554dcb6101af8bc72718a9ecd/dingtalk_sdk_gmdzy2010/department_request.py#L27-L30 | train |
gmdzy2010/dingtalk_sdk_gmdzy2010 | dingtalk_sdk_gmdzy2010/department_request.py | DeptsRequest.get_depts | def get_depts(self, dept_name=None):
"""Method to get department by name."""
depts = self.json_response.get("department", None)
params = self.kwargs.get("params", None)
fetch_child = params.get("fetch_child", True) if params else True
if dept_name is not None:
d... | python | def get_depts(self, dept_name=None):
"""Method to get department by name."""
depts = self.json_response.get("department", None)
params = self.kwargs.get("params", None)
fetch_child = params.get("fetch_child", True) if params else True
if dept_name is not None:
d... | [
"def",
"get_depts",
"(",
"self",
",",
"dept_name",
"=",
"None",
")",
":",
"depts",
"=",
"self",
".",
"json_response",
".",
"get",
"(",
"\"department\"",
",",
"None",
")",
"params",
"=",
"self",
".",
"kwargs",
".",
"get",
"(",
"\"params\"",
",",
"None",... | Method to get department by name. | [
"Method",
"to",
"get",
"department",
"by",
"name",
"."
] | b06cb1f78f89be9554dcb6101af8bc72718a9ecd | https://github.com/gmdzy2010/dingtalk_sdk_gmdzy2010/blob/b06cb1f78f89be9554dcb6101af8bc72718a9ecd/dingtalk_sdk_gmdzy2010/department_request.py#L52-L61 | train |
lsst-sqre/documenteer | documenteer/sphinxext/__init__.py | setup | def setup(app):
"""Wrapper for the `setup` functions of each individual extension module.
"""
jira.setup(app)
lsstdocushare.setup(app)
mockcoderefs.setup(app)
packagetoctree.setup(app)
remotecodeblock.setup(app)
try:
__version__ = get_distribution('documenteer').version
exce... | python | def setup(app):
"""Wrapper for the `setup` functions of each individual extension module.
"""
jira.setup(app)
lsstdocushare.setup(app)
mockcoderefs.setup(app)
packagetoctree.setup(app)
remotecodeblock.setup(app)
try:
__version__ = get_distribution('documenteer').version
exce... | [
"def",
"setup",
"(",
"app",
")",
":",
"jira",
".",
"setup",
"(",
"app",
")",
"lsstdocushare",
".",
"setup",
"(",
"app",
")",
"mockcoderefs",
".",
"setup",
"(",
"app",
")",
"packagetoctree",
".",
"setup",
"(",
"app",
")",
"remotecodeblock",
".",
"setup"... | Wrapper for the `setup` functions of each individual extension module. | [
"Wrapper",
"for",
"the",
"setup",
"functions",
"of",
"each",
"individual",
"extension",
"module",
"."
] | 75f02901a80042b28d074df1cc1dca32eb8e38c8 | https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxext/__init__.py#L25-L41 | train |
lsst-sqre/documenteer | documenteer/sphinxext/lssttasks/crossrefs.py | task_ref_role | def task_ref_role(name, rawtext, text, lineno, inliner,
options=None, content=None):
"""Process a role that references the target nodes created by the
``lsst-task`` directive.
Parameters
----------
name
The role name used in the document.
rawtext
The entire mar... | python | def task_ref_role(name, rawtext, text, lineno, inliner,
options=None, content=None):
"""Process a role that references the target nodes created by the
``lsst-task`` directive.
Parameters
----------
name
The role name used in the document.
rawtext
The entire mar... | [
"def",
"task_ref_role",
"(",
"name",
",",
"rawtext",
",",
"text",
",",
"lineno",
",",
"inliner",
",",
"options",
"=",
"None",
",",
"content",
"=",
"None",
")",
":",
"node",
"=",
"pending_task_xref",
"(",
"rawsource",
"=",
"text",
")",
"return",
"[",
"n... | Process a role that references the target nodes created by the
``lsst-task`` directive.
Parameters
----------
name
The role name used in the document.
rawtext
The entire markup snippet, with role.
text
The text marked with the role.
lineno
The line number whe... | [
"Process",
"a",
"role",
"that",
"references",
"the",
"target",
"nodes",
"created",
"by",
"the",
"lsst",
"-",
"task",
"directive",
"."
] | 75f02901a80042b28d074df1cc1dca32eb8e38c8 | https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxext/lssttasks/crossrefs.py#L89-L120 | train |
lsst-sqre/documenteer | documenteer/sphinxext/lssttasks/crossrefs.py | process_pending_task_xref_nodes | def process_pending_task_xref_nodes(app, doctree, fromdocname):
"""Process the ``pending_task_xref`` nodes during the ``doctree-resolved``
event to insert links to the locations of ``lsst-task-topic`` directives.
"""
logger = getLogger(__name__)
env = app.builder.env
for node in doctree.travers... | python | def process_pending_task_xref_nodes(app, doctree, fromdocname):
"""Process the ``pending_task_xref`` nodes during the ``doctree-resolved``
event to insert links to the locations of ``lsst-task-topic`` directives.
"""
logger = getLogger(__name__)
env = app.builder.env
for node in doctree.travers... | [
"def",
"process_pending_task_xref_nodes",
"(",
"app",
",",
"doctree",
",",
"fromdocname",
")",
":",
"logger",
"=",
"getLogger",
"(",
"__name__",
")",
"env",
"=",
"app",
".",
"builder",
".",
"env",
"for",
"node",
"in",
"doctree",
".",
"traverse",
"(",
"pend... | Process the ``pending_task_xref`` nodes during the ``doctree-resolved``
event to insert links to the locations of ``lsst-task-topic`` directives. | [
"Process",
"the",
"pending_task_xref",
"nodes",
"during",
"the",
"doctree",
"-",
"resolved",
"event",
"to",
"insert",
"links",
"to",
"the",
"locations",
"of",
"lsst",
"-",
"task",
"-",
"topic",
"directives",
"."
] | 75f02901a80042b28d074df1cc1dca32eb8e38c8 | https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxext/lssttasks/crossrefs.py#L123-L173 | train |
lsst-sqre/documenteer | documenteer/sphinxext/lssttasks/crossrefs.py | config_ref_role | def config_ref_role(name, rawtext, text, lineno, inliner,
options=None, content=None):
"""Process a role that references the target nodes created by the
``lsst-config-topic`` directive.
Parameters
----------
name
The role name used in the document.
rawtext
Th... | python | def config_ref_role(name, rawtext, text, lineno, inliner,
options=None, content=None):
"""Process a role that references the target nodes created by the
``lsst-config-topic`` directive.
Parameters
----------
name
The role name used in the document.
rawtext
Th... | [
"def",
"config_ref_role",
"(",
"name",
",",
"rawtext",
",",
"text",
",",
"lineno",
",",
"inliner",
",",
"options",
"=",
"None",
",",
"content",
"=",
"None",
")",
":",
"node",
"=",
"pending_config_xref",
"(",
"rawsource",
"=",
"text",
")",
"return",
"[",
... | Process a role that references the target nodes created by the
``lsst-config-topic`` directive.
Parameters
----------
name
The role name used in the document.
rawtext
The entire markup snippet, with role.
text
The text marked with the role.
lineno
The line nu... | [
"Process",
"a",
"role",
"that",
"references",
"the",
"target",
"nodes",
"created",
"by",
"the",
"lsst",
"-",
"config",
"-",
"topic",
"directive",
"."
] | 75f02901a80042b28d074df1cc1dca32eb8e38c8 | https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxext/lssttasks/crossrefs.py#L176-L212 | train |
lsst-sqre/documenteer | documenteer/sphinxext/lssttasks/crossrefs.py | process_pending_config_xref_nodes | def process_pending_config_xref_nodes(app, doctree, fromdocname):
"""Process the ``pending_config_xref`` nodes during the ``doctree-resolved``
event to insert links to the locations of ``lsst-config-topic`` directives.
See also
--------
`config_ref_role`
`ConfigTopicTargetDirective`
`pendin... | python | def process_pending_config_xref_nodes(app, doctree, fromdocname):
"""Process the ``pending_config_xref`` nodes during the ``doctree-resolved``
event to insert links to the locations of ``lsst-config-topic`` directives.
See also
--------
`config_ref_role`
`ConfigTopicTargetDirective`
`pendin... | [
"def",
"process_pending_config_xref_nodes",
"(",
"app",
",",
"doctree",
",",
"fromdocname",
")",
":",
"logger",
"=",
"getLogger",
"(",
"__name__",
")",
"env",
"=",
"app",
".",
"builder",
".",
"env",
"for",
"node",
"in",
"doctree",
".",
"traverse",
"(",
"pe... | Process the ``pending_config_xref`` nodes during the ``doctree-resolved``
event to insert links to the locations of ``lsst-config-topic`` directives.
See also
--------
`config_ref_role`
`ConfigTopicTargetDirective`
`pending_config_xref` | [
"Process",
"the",
"pending_config_xref",
"nodes",
"during",
"the",
"doctree",
"-",
"resolved",
"event",
"to",
"insert",
"links",
"to",
"the",
"locations",
"of",
"lsst",
"-",
"config",
"-",
"topic",
"directives",
"."
] | 75f02901a80042b28d074df1cc1dca32eb8e38c8 | https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxext/lssttasks/crossrefs.py#L215-L271 | train |
lsst-sqre/documenteer | documenteer/sphinxext/lssttasks/crossrefs.py | configfield_ref_role | def configfield_ref_role(name, rawtext, text, lineno, inliner,
options=None, content=None):
"""Process a role that references the Task configuration field nodes
created by the ``lsst-config-fields``, ``lsst-task-config-subtasks``,
and ``lsst-task-config-subtasks`` directives.
P... | python | def configfield_ref_role(name, rawtext, text, lineno, inliner,
options=None, content=None):
"""Process a role that references the Task configuration field nodes
created by the ``lsst-config-fields``, ``lsst-task-config-subtasks``,
and ``lsst-task-config-subtasks`` directives.
P... | [
"def",
"configfield_ref_role",
"(",
"name",
",",
"rawtext",
",",
"text",
",",
"lineno",
",",
"inliner",
",",
"options",
"=",
"None",
",",
"content",
"=",
"None",
")",
":",
"node",
"=",
"pending_configfield_xref",
"(",
"rawsource",
"=",
"text",
")",
"return... | Process a role that references the Task configuration field nodes
created by the ``lsst-config-fields``, ``lsst-task-config-subtasks``,
and ``lsst-task-config-subtasks`` directives.
Parameters
----------
name
The role name used in the document.
rawtext
The entire markup snippet,... | [
"Process",
"a",
"role",
"that",
"references",
"the",
"Task",
"configuration",
"field",
"nodes",
"created",
"by",
"the",
"lsst",
"-",
"config",
"-",
"fields",
"lsst",
"-",
"task",
"-",
"config",
"-",
"subtasks",
"and",
"lsst",
"-",
"task",
"-",
"config",
... | 75f02901a80042b28d074df1cc1dca32eb8e38c8 | https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxext/lssttasks/crossrefs.py#L274-L311 | train |
lsst-sqre/documenteer | documenteer/sphinxext/lssttasks/crossrefs.py | process_pending_configfield_xref_nodes | def process_pending_configfield_xref_nodes(app, doctree, fromdocname):
"""Process the ``pending_configfield_xref`` nodes during the
``doctree-resolved`` event to insert links to the locations of
configuration field nodes.
See also
--------
`format_configfield_id`
`configfield_ref_role`
... | python | def process_pending_configfield_xref_nodes(app, doctree, fromdocname):
"""Process the ``pending_configfield_xref`` nodes during the
``doctree-resolved`` event to insert links to the locations of
configuration field nodes.
See also
--------
`format_configfield_id`
`configfield_ref_role`
... | [
"def",
"process_pending_configfield_xref_nodes",
"(",
"app",
",",
"doctree",
",",
"fromdocname",
")",
":",
"logger",
"=",
"getLogger",
"(",
"__name__",
")",
"env",
"=",
"app",
".",
"builder",
".",
"env",
"for",
"node",
"in",
"doctree",
".",
"traverse",
"(",
... | Process the ``pending_configfield_xref`` nodes during the
``doctree-resolved`` event to insert links to the locations of
configuration field nodes.
See also
--------
`format_configfield_id`
`configfield_ref_role`
`pending_configfield_xref` | [
"Process",
"the",
"pending_configfield_xref",
"nodes",
"during",
"the",
"doctree",
"-",
"resolved",
"event",
"to",
"insert",
"links",
"to",
"the",
"locations",
"of",
"configuration",
"field",
"nodes",
"."
] | 75f02901a80042b28d074df1cc1dca32eb8e38c8 | https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxext/lssttasks/crossrefs.py#L314-L377 | train |
zsimic/runez | src/runez/config.py | to_bytesize | def to_bytesize(value, default_unit=None, base=DEFAULT_BASE):
"""Convert `value` to bytes, accepts notations such as "4k" to mean 4096 bytes
Args:
value (str | unicode | int | None): Number of bytes optionally suffixed by a char from UNITS
default_unit (str | unicode | None): Default unit to us... | python | def to_bytesize(value, default_unit=None, base=DEFAULT_BASE):
"""Convert `value` to bytes, accepts notations such as "4k" to mean 4096 bytes
Args:
value (str | unicode | int | None): Number of bytes optionally suffixed by a char from UNITS
default_unit (str | unicode | None): Default unit to us... | [
"def",
"to_bytesize",
"(",
"value",
",",
"default_unit",
"=",
"None",
",",
"base",
"=",
"DEFAULT_BASE",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"(",
"int",
",",
"float",
")",
")",
":",
"return",
"unitized",
"(",
"value",
",",
"default_unit",
"... | Convert `value` to bytes, accepts notations such as "4k" to mean 4096 bytes
Args:
value (str | unicode | int | None): Number of bytes optionally suffixed by a char from UNITS
default_unit (str | unicode | None): Default unit to use for unqualified values
base (int): Base to use (usually 102... | [
"Convert",
"value",
"to",
"bytes",
"accepts",
"notations",
"such",
"as",
"4k",
"to",
"mean",
"4096",
"bytes"
] | 14363b719a1aae1528859a501a22d075ce0abfcc | https://github.com/zsimic/runez/blob/14363b719a1aae1528859a501a22d075ce0abfcc/src/runez/config.py#L372-L404 | train |
zsimic/runez | src/runez/config.py | to_number | def to_number(result_type, value, default=None, minimum=None, maximum=None):
"""Cast `value` to numeric `result_type` if possible
Args:
result_type (type): Numerical type to convert to (one of: int, float, ...)
value (str | unicode): Value to convert
default (result_type.__class__ | Non... | python | def to_number(result_type, value, default=None, minimum=None, maximum=None):
"""Cast `value` to numeric `result_type` if possible
Args:
result_type (type): Numerical type to convert to (one of: int, float, ...)
value (str | unicode): Value to convert
default (result_type.__class__ | Non... | [
"def",
"to_number",
"(",
"result_type",
",",
"value",
",",
"default",
"=",
"None",
",",
"minimum",
"=",
"None",
",",
"maximum",
"=",
"None",
")",
":",
"try",
":",
"return",
"capped",
"(",
"result_type",
"(",
"value",
")",
",",
"minimum",
",",
"maximum"... | Cast `value` to numeric `result_type` if possible
Args:
result_type (type): Numerical type to convert to (one of: int, float, ...)
value (str | unicode): Value to convert
default (result_type.__class__ | None): Default to use `value` can't be turned into an int
minimum (result_type.... | [
"Cast",
"value",
"to",
"numeric",
"result_type",
"if",
"possible"
] | 14363b719a1aae1528859a501a22d075ce0abfcc | https://github.com/zsimic/runez/blob/14363b719a1aae1528859a501a22d075ce0abfcc/src/runez/config.py#L451-L468 | train |
zsimic/runez | src/runez/config.py | Configuration.set_providers | def set_providers(self, *providers):
"""Replace current providers with given ones"""
if self.providers:
self.clear()
for provider in providers:
self.add(provider) | python | def set_providers(self, *providers):
"""Replace current providers with given ones"""
if self.providers:
self.clear()
for provider in providers:
self.add(provider) | [
"def",
"set_providers",
"(",
"self",
",",
"*",
"providers",
")",
":",
"if",
"self",
".",
"providers",
":",
"self",
".",
"clear",
"(",
")",
"for",
"provider",
"in",
"providers",
":",
"self",
".",
"add",
"(",
"provider",
")"
] | Replace current providers with given ones | [
"Replace",
"current",
"providers",
"with",
"given",
"ones"
] | 14363b719a1aae1528859a501a22d075ce0abfcc | https://github.com/zsimic/runez/blob/14363b719a1aae1528859a501a22d075ce0abfcc/src/runez/config.py#L62-L67 | train |
zsimic/runez | src/runez/config.py | Configuration.get_bytesize | def get_bytesize(self, key, default=None, minimum=None, maximum=None, default_unit=None, base=DEFAULT_BASE):
"""Size in bytes expressed by value configured under 'key'
Args:
key (str | unicode): Key to lookup
default (int | str | unicode | None): Default to use if key is not con... | python | def get_bytesize(self, key, default=None, minimum=None, maximum=None, default_unit=None, base=DEFAULT_BASE):
"""Size in bytes expressed by value configured under 'key'
Args:
key (str | unicode): Key to lookup
default (int | str | unicode | None): Default to use if key is not con... | [
"def",
"get_bytesize",
"(",
"self",
",",
"key",
",",
"default",
"=",
"None",
",",
"minimum",
"=",
"None",
",",
"maximum",
"=",
"None",
",",
"default_unit",
"=",
"None",
",",
"base",
"=",
"DEFAULT_BASE",
")",
":",
"value",
"=",
"to_bytesize",
"(",
"self... | Size in bytes expressed by value configured under 'key'
Args:
key (str | unicode): Key to lookup
default (int | str | unicode | None): Default to use if key is not configured
minimum (int | str | unicode | None): If specified, result can't be below this minimum
m... | [
"Size",
"in",
"bytes",
"expressed",
"by",
"value",
"configured",
"under",
"key"
] | 14363b719a1aae1528859a501a22d075ce0abfcc | https://github.com/zsimic/runez/blob/14363b719a1aae1528859a501a22d075ce0abfcc/src/runez/config.py#L196-L213 | train |
sprockets/sprockets.mixins.metrics | sprockets/mixins/metrics/statsd.py | install | def install(application, **kwargs):
"""Call this to install StatsD for the Tornado application.
:param tornado.web.Application application: the application to
install the collector into.
:param kwargs: keyword parameters to pass to the
:class:`StatsDCollector` initializer.
:returns: :da... | python | def install(application, **kwargs):
"""Call this to install StatsD for the Tornado application.
:param tornado.web.Application application: the application to
install the collector into.
:param kwargs: keyword parameters to pass to the
:class:`StatsDCollector` initializer.
:returns: :da... | [
"def",
"install",
"(",
"application",
",",
"**",
"kwargs",
")",
":",
"if",
"getattr",
"(",
"application",
",",
"'statsd'",
",",
"None",
")",
"is",
"not",
"None",
":",
"LOGGER",
".",
"warning",
"(",
"'Statsd collector is already installed'",
")",
"return",
"F... | Call this to install StatsD for the Tornado application.
:param tornado.web.Application application: the application to
install the collector into.
:param kwargs: keyword parameters to pass to the
:class:`StatsDCollector` initializer.
:returns: :data:`True` if the client was installed succe... | [
"Call",
"this",
"to",
"install",
"StatsD",
"for",
"the",
"Tornado",
"application",
"."
] | 0b17d5f0c09a2be9db779e17e6789d3d5ff9a0d0 | https://github.com/sprockets/sprockets.mixins.metrics/blob/0b17d5f0c09a2be9db779e17e6789d3d5ff9a0d0/sprockets/mixins/metrics/statsd.py#L202-L234 | train |
sprockets/sprockets.mixins.metrics | sprockets/mixins/metrics/statsd.py | StatsdMixin.record_timing | def record_timing(self, duration, *path):
"""Record a timing.
This method records a timing to the application's namespace
followed by a calculated path. Each element of `path` is
converted to a string and normalized before joining the
elements by periods. The normalization pro... | python | def record_timing(self, duration, *path):
"""Record a timing.
This method records a timing to the application's namespace
followed by a calculated path. Each element of `path` is
converted to a string and normalized before joining the
elements by periods. The normalization pro... | [
"def",
"record_timing",
"(",
"self",
",",
"duration",
",",
"*",
"path",
")",
":",
"self",
".",
"application",
".",
"statsd",
".",
"send",
"(",
"path",
",",
"duration",
"*",
"1000.0",
",",
"'ms'",
")"
] | Record a timing.
This method records a timing to the application's namespace
followed by a calculated path. Each element of `path` is
converted to a string and normalized before joining the
elements by periods. The normalization process is little
more than replacing periods wi... | [
"Record",
"a",
"timing",
"."
] | 0b17d5f0c09a2be9db779e17e6789d3d5ff9a0d0 | https://github.com/sprockets/sprockets.mixins.metrics/blob/0b17d5f0c09a2be9db779e17e6789d3d5ff9a0d0/sprockets/mixins/metrics/statsd.py#L19-L32 | train |
sprockets/sprockets.mixins.metrics | sprockets/mixins/metrics/statsd.py | StatsdMixin.increase_counter | def increase_counter(self, *path, **kwargs):
"""Increase a counter.
This method increases a counter within the application's
namespace. Each element of `path` is converted to a string
and normalized before joining the elements by periods. The
normalization process is little mo... | python | def increase_counter(self, *path, **kwargs):
"""Increase a counter.
This method increases a counter within the application's
namespace. Each element of `path` is converted to a string
and normalized before joining the elements by periods. The
normalization process is little mo... | [
"def",
"increase_counter",
"(",
"self",
",",
"*",
"path",
",",
"**",
"kwargs",
")",
":",
"self",
".",
"application",
".",
"statsd",
".",
"send",
"(",
"path",
",",
"kwargs",
".",
"get",
"(",
"'amount'",
",",
"'1'",
")",
",",
"'c'",
")"
] | Increase a counter.
This method increases a counter within the application's
namespace. Each element of `path` is converted to a string
and normalized before joining the elements by periods. The
normalization process is little more than replacing periods
with dashes.
... | [
"Increase",
"a",
"counter",
"."
] | 0b17d5f0c09a2be9db779e17e6789d3d5ff9a0d0 | https://github.com/sprockets/sprockets.mixins.metrics/blob/0b17d5f0c09a2be9db779e17e6789d3d5ff9a0d0/sprockets/mixins/metrics/statsd.py#L34-L48 | train |
sprockets/sprockets.mixins.metrics | sprockets/mixins/metrics/statsd.py | StatsdMixin.execution_timer | def execution_timer(self, *path):
"""
Record the time it takes to perform an arbitrary code block.
:param path: elements of the metric path to record
This method returns a context manager that records the amount
of time spent inside of the context and submits a timing metric
... | python | def execution_timer(self, *path):
"""
Record the time it takes to perform an arbitrary code block.
:param path: elements of the metric path to record
This method returns a context manager that records the amount
of time spent inside of the context and submits a timing metric
... | [
"def",
"execution_timer",
"(",
"self",
",",
"*",
"path",
")",
":",
"start",
"=",
"time",
".",
"time",
"(",
")",
"try",
":",
"yield",
"finally",
":",
"self",
".",
"record_timing",
"(",
"max",
"(",
"start",
",",
"time",
".",
"time",
"(",
")",
")",
... | Record the time it takes to perform an arbitrary code block.
:param path: elements of the metric path to record
This method returns a context manager that records the amount
of time spent inside of the context and submits a timing metric
to the specified `path` using (:meth:`record_tim... | [
"Record",
"the",
"time",
"it",
"takes",
"to",
"perform",
"an",
"arbitrary",
"code",
"block",
"."
] | 0b17d5f0c09a2be9db779e17e6789d3d5ff9a0d0 | https://github.com/sprockets/sprockets.mixins.metrics/blob/0b17d5f0c09a2be9db779e17e6789d3d5ff9a0d0/sprockets/mixins/metrics/statsd.py#L51-L66 | train |
sprockets/sprockets.mixins.metrics | sprockets/mixins/metrics/statsd.py | StatsdMixin.on_finish | def on_finish(self):
"""
Records the time taken to process the request.
This method records the amount of time taken to process the request
(as reported by
:meth:`~tornado.httputil.HTTPServerRequest.request_time`) under the
path defined by the class's module, it's name, ... | python | def on_finish(self):
"""
Records the time taken to process the request.
This method records the amount of time taken to process the request
(as reported by
:meth:`~tornado.httputil.HTTPServerRequest.request_time`) under the
path defined by the class's module, it's name, ... | [
"def",
"on_finish",
"(",
"self",
")",
":",
"super",
"(",
")",
".",
"on_finish",
"(",
")",
"self",
".",
"record_timing",
"(",
"self",
".",
"request",
".",
"request_time",
"(",
")",
",",
"self",
".",
"__class__",
".",
"__name__",
",",
"self",
".",
"req... | Records the time taken to process the request.
This method records the amount of time taken to process the request
(as reported by
:meth:`~tornado.httputil.HTTPServerRequest.request_time`) under the
path defined by the class's module, it's name, the request method,
and the statu... | [
"Records",
"the",
"time",
"taken",
"to",
"process",
"the",
"request",
"."
] | 0b17d5f0c09a2be9db779e17e6789d3d5ff9a0d0 | https://github.com/sprockets/sprockets.mixins.metrics/blob/0b17d5f0c09a2be9db779e17e6789d3d5ff9a0d0/sprockets/mixins/metrics/statsd.py#L68-L83 | train |
sprockets/sprockets.mixins.metrics | sprockets/mixins/metrics/statsd.py | StatsDCollector._tcp_on_closed | async def _tcp_on_closed(self):
"""Invoked when the socket is closed."""
LOGGER.warning('Not connected to statsd, connecting in %s seconds',
self._tcp_reconnect_sleep)
await asyncio.sleep(self._tcp_reconnect_sleep)
self._sock = self._tcp_socket() | python | async def _tcp_on_closed(self):
"""Invoked when the socket is closed."""
LOGGER.warning('Not connected to statsd, connecting in %s seconds',
self._tcp_reconnect_sleep)
await asyncio.sleep(self._tcp_reconnect_sleep)
self._sock = self._tcp_socket() | [
"async",
"def",
"_tcp_on_closed",
"(",
"self",
")",
":",
"LOGGER",
".",
"warning",
"(",
"'Not connected to statsd, connecting in %s seconds'",
",",
"self",
".",
"_tcp_reconnect_sleep",
")",
"await",
"asyncio",
".",
"sleep",
"(",
"self",
".",
"_tcp_reconnect_sleep",
... | Invoked when the socket is closed. | [
"Invoked",
"when",
"the",
"socket",
"is",
"closed",
"."
] | 0b17d5f0c09a2be9db779e17e6789d3d5ff9a0d0 | https://github.com/sprockets/sprockets.mixins.metrics/blob/0b17d5f0c09a2be9db779e17e6789d3d5ff9a0d0/sprockets/mixins/metrics/statsd.py#L135-L140 | train |
sprockets/sprockets.mixins.metrics | sprockets/mixins/metrics/statsd.py | StatsDCollector.send | def send(self, path, value, metric_type):
"""Send a metric to Statsd.
:param list path: The metric path to record
:param mixed value: The value to record
:param str metric_type: The metric type
"""
msg = self._msg_format.format(
path=self._build_path(path, m... | python | def send(self, path, value, metric_type):
"""Send a metric to Statsd.
:param list path: The metric path to record
:param mixed value: The value to record
:param str metric_type: The metric type
"""
msg = self._msg_format.format(
path=self._build_path(path, m... | [
"def",
"send",
"(",
"self",
",",
"path",
",",
"value",
",",
"metric_type",
")",
":",
"msg",
"=",
"self",
".",
"_msg_format",
".",
"format",
"(",
"path",
"=",
"self",
".",
"_build_path",
"(",
"path",
",",
"metric_type",
")",
",",
"value",
"=",
"value"... | Send a metric to Statsd.
:param list path: The metric path to record
:param mixed value: The value to record
:param str metric_type: The metric type | [
"Send",
"a",
"metric",
"to",
"Statsd",
"."
] | 0b17d5f0c09a2be9db779e17e6789d3d5ff9a0d0 | https://github.com/sprockets/sprockets.mixins.metrics/blob/0b17d5f0c09a2be9db779e17e6789d3d5ff9a0d0/sprockets/mixins/metrics/statsd.py#L146-L172 | train |
sprockets/sprockets.mixins.metrics | sprockets/mixins/metrics/statsd.py | StatsDCollector._build_path | def _build_path(self, path, metric_type):
"""Return a normalized path.
:param list path: elements of the metric path to record
:param str metric_type: The metric type
:rtype: str
"""
path = self._get_prefixes(metric_type) + list(path)
return '{}.{}'.format(self.... | python | def _build_path(self, path, metric_type):
"""Return a normalized path.
:param list path: elements of the metric path to record
:param str metric_type: The metric type
:rtype: str
"""
path = self._get_prefixes(metric_type) + list(path)
return '{}.{}'.format(self.... | [
"def",
"_build_path",
"(",
"self",
",",
"path",
",",
"metric_type",
")",
":",
"path",
"=",
"self",
".",
"_get_prefixes",
"(",
"metric_type",
")",
"+",
"list",
"(",
"path",
")",
"return",
"'{}.{}'",
".",
"format",
"(",
"self",
".",
"_namespace",
",",
"'... | Return a normalized path.
:param list path: elements of the metric path to record
:param str metric_type: The metric type
:rtype: str | [
"Return",
"a",
"normalized",
"path",
"."
] | 0b17d5f0c09a2be9db779e17e6789d3d5ff9a0d0 | https://github.com/sprockets/sprockets.mixins.metrics/blob/0b17d5f0c09a2be9db779e17e6789d3d5ff9a0d0/sprockets/mixins/metrics/statsd.py#L174-L184 | train |
sprockets/sprockets.mixins.metrics | sprockets/mixins/metrics/statsd.py | StatsDCollector._get_prefixes | def _get_prefixes(self, metric_type):
"""Get prefixes where applicable
Add metric prefix counters, timers respectively if
:attr:`prepend_metric_type` flag is True.
:param str metric_type: The metric type
:rtype: list
"""
prefixes = []
if self._prepend_m... | python | def _get_prefixes(self, metric_type):
"""Get prefixes where applicable
Add metric prefix counters, timers respectively if
:attr:`prepend_metric_type` flag is True.
:param str metric_type: The metric type
:rtype: list
"""
prefixes = []
if self._prepend_m... | [
"def",
"_get_prefixes",
"(",
"self",
",",
"metric_type",
")",
":",
"prefixes",
"=",
"[",
"]",
"if",
"self",
".",
"_prepend_metric_type",
":",
"prefixes",
".",
"append",
"(",
"self",
".",
"METRIC_TYPES",
"[",
"metric_type",
"]",
")",
"return",
"prefixes"
] | Get prefixes where applicable
Add metric prefix counters, timers respectively if
:attr:`prepend_metric_type` flag is True.
:param str metric_type: The metric type
:rtype: list | [
"Get",
"prefixes",
"where",
"applicable"
] | 0b17d5f0c09a2be9db779e17e6789d3d5ff9a0d0 | https://github.com/sprockets/sprockets.mixins.metrics/blob/0b17d5f0c09a2be9db779e17e6789d3d5ff9a0d0/sprockets/mixins/metrics/statsd.py#L186-L199 | train |
mesbahamin/chronophore | chronophore/qtview.py | QtChronophoreUI._show_feedback_label | def _show_feedback_label(self, message, seconds=None):
"""Display a message in lbl_feedback, which times out after some
number of seconds.
"""
if seconds is None:
seconds = CONFIG['MESSAGE_DURATION']
logger.debug('Label feedback: "{}"'.format(message))
self.... | python | def _show_feedback_label(self, message, seconds=None):
"""Display a message in lbl_feedback, which times out after some
number of seconds.
"""
if seconds is None:
seconds = CONFIG['MESSAGE_DURATION']
logger.debug('Label feedback: "{}"'.format(message))
self.... | [
"def",
"_show_feedback_label",
"(",
"self",
",",
"message",
",",
"seconds",
"=",
"None",
")",
":",
"if",
"seconds",
"is",
"None",
":",
"seconds",
"=",
"CONFIG",
"[",
"'MESSAGE_DURATION'",
"]",
"logger",
".",
"debug",
"(",
"'Label feedback: \"{}\"'",
".",
"fo... | Display a message in lbl_feedback, which times out after some
number of seconds. | [
"Display",
"a",
"message",
"in",
"lbl_feedback",
"which",
"times",
"out",
"after",
"some",
"number",
"of",
"seconds",
"."
] | ee140c61b4dfada966f078de8304bac737cec6f7 | https://github.com/mesbahamin/chronophore/blob/ee140c61b4dfada966f078de8304bac737cec6f7/chronophore/qtview.py#L137-L149 | train |
mesbahamin/chronophore | chronophore/qtview.py | QtUserTypeSelectionDialog.update_user_type | def update_user_type(self):
"""Return either 'tutor' or 'student' based on which radio
button is selected.
"""
if self.rb_tutor.isChecked():
self.user_type = 'tutor'
elif self.rb_student.isChecked():
self.user_type = 'student'
self.accept() | python | def update_user_type(self):
"""Return either 'tutor' or 'student' based on which radio
button is selected.
"""
if self.rb_tutor.isChecked():
self.user_type = 'tutor'
elif self.rb_student.isChecked():
self.user_type = 'student'
self.accept() | [
"def",
"update_user_type",
"(",
"self",
")",
":",
"if",
"self",
".",
"rb_tutor",
".",
"isChecked",
"(",
")",
":",
"self",
".",
"user_type",
"=",
"'tutor'",
"elif",
"self",
".",
"rb_student",
".",
"isChecked",
"(",
")",
":",
"self",
".",
"user_type",
"=... | Return either 'tutor' or 'student' based on which radio
button is selected. | [
"Return",
"either",
"tutor",
"or",
"student",
"based",
"on",
"which",
"radio",
"button",
"is",
"selected",
"."
] | ee140c61b4dfada966f078de8304bac737cec6f7 | https://github.com/mesbahamin/chronophore/blob/ee140c61b4dfada966f078de8304bac737cec6f7/chronophore/qtview.py#L278-L286 | train |
pereorga/csvshuf | csvshuf/csvshuf.py | shuffle_sattolo | def shuffle_sattolo(items):
"""Shuffle items in place using Sattolo's algorithm."""
_randrange = random.randrange
for i in reversed(range(1, len(items))):
j = _randrange(i) # 0 <= j < i
items[j], items[i] = items[i], items[j] | python | def shuffle_sattolo(items):
"""Shuffle items in place using Sattolo's algorithm."""
_randrange = random.randrange
for i in reversed(range(1, len(items))):
j = _randrange(i) # 0 <= j < i
items[j], items[i] = items[i], items[j] | [
"def",
"shuffle_sattolo",
"(",
"items",
")",
":",
"_randrange",
"=",
"random",
".",
"randrange",
"for",
"i",
"in",
"reversed",
"(",
"range",
"(",
"1",
",",
"len",
"(",
"items",
")",
")",
")",
":",
"j",
"=",
"_randrange",
"(",
"i",
")",
"items",
"["... | Shuffle items in place using Sattolo's algorithm. | [
"Shuffle",
"items",
"in",
"place",
"using",
"Sattolo",
"s",
"algorithm",
"."
] | 70fdd4f512ef980bffe9cc51bfe59fea116d7c2f | https://github.com/pereorga/csvshuf/blob/70fdd4f512ef980bffe9cc51bfe59fea116d7c2f/csvshuf/csvshuf.py#L19-L24 | train |
pereorga/csvshuf | csvshuf/csvshuf.py | column_list | def column_list(string):
"""Validate and convert comma-separated list of column numbers."""
try:
columns = list(map(int, string.split(',')))
except ValueError as e:
raise argparse.ArgumentTypeError(*e.args)
for column in columns:
if column < 1:
raise argparse.Argument... | python | def column_list(string):
"""Validate and convert comma-separated list of column numbers."""
try:
columns = list(map(int, string.split(',')))
except ValueError as e:
raise argparse.ArgumentTypeError(*e.args)
for column in columns:
if column < 1:
raise argparse.Argument... | [
"def",
"column_list",
"(",
"string",
")",
":",
"try",
":",
"columns",
"=",
"list",
"(",
"map",
"(",
"int",
",",
"string",
".",
"split",
"(",
"','",
")",
")",
")",
"except",
"ValueError",
"as",
"e",
":",
"raise",
"argparse",
".",
"ArgumentTypeError",
... | Validate and convert comma-separated list of column numbers. | [
"Validate",
"and",
"convert",
"comma",
"-",
"separated",
"list",
"of",
"column",
"numbers",
"."
] | 70fdd4f512ef980bffe9cc51bfe59fea116d7c2f | https://github.com/pereorga/csvshuf/blob/70fdd4f512ef980bffe9cc51bfe59fea116d7c2f/csvshuf/csvshuf.py#L27-L38 | train |
pereorga/csvshuf | csvshuf/csvshuf.py | main | def main():
parser = argparse.ArgumentParser(description='Shuffle columns in a CSV file')
parser.add_argument(metavar="FILE", dest='input_file', type=argparse.FileType('r'), nargs='?',
default=sys.stdin, help='Input CSV file. If omitted, read standard input.')
parser.add_argument('-s... | python | def main():
parser = argparse.ArgumentParser(description='Shuffle columns in a CSV file')
parser.add_argument(metavar="FILE", dest='input_file', type=argparse.FileType('r'), nargs='?',
default=sys.stdin, help='Input CSV file. If omitted, read standard input.')
parser.add_argument('-s... | [
"def",
"main",
"(",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"description",
"=",
"'Shuffle columns in a CSV file'",
")",
"parser",
".",
"add_argument",
"(",
"metavar",
"=",
"\"FILE\"",
",",
"dest",
"=",
"'input_file'",
",",
"type",
"=",... | Get the first row and use it as column headers | [
"Get",
"the",
"first",
"row",
"and",
"use",
"it",
"as",
"column",
"headers"
] | 70fdd4f512ef980bffe9cc51bfe59fea116d7c2f | https://github.com/pereorga/csvshuf/blob/70fdd4f512ef980bffe9cc51bfe59fea116d7c2f/csvshuf/csvshuf.py#L41-L101 | train |
bgyori/pykqml | kqml/kqml_list.py | KQMLList.get | def get(self, keyword):
"""Return the element of the list after the given keyword.
Parameters
----------
keyword : str
The keyword parameter to find in the list.
Putting a colon before the keyword is optional, if no colon is
given, it is added automat... | python | def get(self, keyword):
"""Return the element of the list after the given keyword.
Parameters
----------
keyword : str
The keyword parameter to find in the list.
Putting a colon before the keyword is optional, if no colon is
given, it is added automat... | [
"def",
"get",
"(",
"self",
",",
"keyword",
")",
":",
"if",
"not",
"keyword",
".",
"startswith",
"(",
"':'",
")",
":",
"keyword",
"=",
"':'",
"+",
"keyword",
"for",
"i",
",",
"s",
"in",
"enumerate",
"(",
"self",
".",
"data",
")",
":",
"if",
"s",
... | Return the element of the list after the given keyword.
Parameters
----------
keyword : str
The keyword parameter to find in the list.
Putting a colon before the keyword is optional, if no colon is
given, it is added automatically (e.g. "keyword" will be foun... | [
"Return",
"the",
"element",
"of",
"the",
"list",
"after",
"the",
"given",
"keyword",
"."
] | c18b39868626215deb634567c6bd7c0838e443c0 | https://github.com/bgyori/pykqml/blob/c18b39868626215deb634567c6bd7c0838e443c0/kqml/kqml_list.py#L44-L72 | train |
bgyori/pykqml | kqml/kqml_list.py | KQMLList.gets | def gets(self, keyword):
"""Return the element of the list after the given keyword as string.
Parameters
----------
keyword : str
The keyword parameter to find in the list.
Putting a colon before the keyword is optional, if no colon is
given, it is ad... | python | def gets(self, keyword):
"""Return the element of the list after the given keyword as string.
Parameters
----------
keyword : str
The keyword parameter to find in the list.
Putting a colon before the keyword is optional, if no colon is
given, it is ad... | [
"def",
"gets",
"(",
"self",
",",
"keyword",
")",
":",
"param",
"=",
"self",
".",
"get",
"(",
"keyword",
")",
"if",
"param",
"is",
"not",
"None",
":",
"return",
"safe_decode",
"(",
"param",
".",
"string_value",
"(",
")",
")",
"return",
"None"
] | Return the element of the list after the given keyword as string.
Parameters
----------
keyword : str
The keyword parameter to find in the list.
Putting a colon before the keyword is optional, if no colon is
given, it is added automatically (e.g. "keyword" wi... | [
"Return",
"the",
"element",
"of",
"the",
"list",
"after",
"the",
"given",
"keyword",
"as",
"string",
"."
] | c18b39868626215deb634567c6bd7c0838e443c0 | https://github.com/bgyori/pykqml/blob/c18b39868626215deb634567c6bd7c0838e443c0/kqml/kqml_list.py#L74-L97 | train |
bgyori/pykqml | kqml/kqml_list.py | KQMLList.append | def append(self, obj):
"""Append an element to the end of the list.
Parameters
----------
obj : KQMLObject or str
If a string is passed, it is instantiated as a
KQMLToken before being added to the list.
"""
if isinstance(obj, str):
obj... | python | def append(self, obj):
"""Append an element to the end of the list.
Parameters
----------
obj : KQMLObject or str
If a string is passed, it is instantiated as a
KQMLToken before being added to the list.
"""
if isinstance(obj, str):
obj... | [
"def",
"append",
"(",
"self",
",",
"obj",
")",
":",
"if",
"isinstance",
"(",
"obj",
",",
"str",
")",
":",
"obj",
"=",
"KQMLToken",
"(",
"obj",
")",
"self",
".",
"data",
".",
"append",
"(",
"obj",
")"
] | Append an element to the end of the list.
Parameters
----------
obj : KQMLObject or str
If a string is passed, it is instantiated as a
KQMLToken before being added to the list. | [
"Append",
"an",
"element",
"to",
"the",
"end",
"of",
"the",
"list",
"."
] | c18b39868626215deb634567c6bd7c0838e443c0 | https://github.com/bgyori/pykqml/blob/c18b39868626215deb634567c6bd7c0838e443c0/kqml/kqml_list.py#L100-L111 | train |
bgyori/pykqml | kqml/kqml_list.py | KQMLList.push | def push(self, obj):
"""Prepend an element to the beginnging of the list.
Parameters
----------
obj : KQMLObject or str
If a string is passed, it is instantiated as a
KQMLToken before being added to the list.
"""
if isinstance(obj, str):
... | python | def push(self, obj):
"""Prepend an element to the beginnging of the list.
Parameters
----------
obj : KQMLObject or str
If a string is passed, it is instantiated as a
KQMLToken before being added to the list.
"""
if isinstance(obj, str):
... | [
"def",
"push",
"(",
"self",
",",
"obj",
")",
":",
"if",
"isinstance",
"(",
"obj",
",",
"str",
")",
":",
"obj",
"=",
"KQMLToken",
"(",
"obj",
")",
"self",
".",
"data",
".",
"insert",
"(",
"0",
",",
"obj",
")"
] | Prepend an element to the beginnging of the list.
Parameters
----------
obj : KQMLObject or str
If a string is passed, it is instantiated as a
KQMLToken before being added to the list. | [
"Prepend",
"an",
"element",
"to",
"the",
"beginnging",
"of",
"the",
"list",
"."
] | c18b39868626215deb634567c6bd7c0838e443c0 | https://github.com/bgyori/pykqml/blob/c18b39868626215deb634567c6bd7c0838e443c0/kqml/kqml_list.py#L113-L124 | train |
bgyori/pykqml | kqml/kqml_list.py | KQMLList.set | def set(self, keyword, value):
"""Set the element of the list after the given keyword.
Parameters
----------
keyword : str
The keyword parameter to find in the list.
Putting a colon before the keyword is optional, if no colon is
given, it is added aut... | python | def set(self, keyword, value):
"""Set the element of the list after the given keyword.
Parameters
----------
keyword : str
The keyword parameter to find in the list.
Putting a colon before the keyword is optional, if no colon is
given, it is added aut... | [
"def",
"set",
"(",
"self",
",",
"keyword",
",",
"value",
")",
":",
"if",
"not",
"keyword",
".",
"startswith",
"(",
"':'",
")",
":",
"keyword",
"=",
"':'",
"+",
"keyword",
"if",
"isinstance",
"(",
"value",
",",
"str",
")",
":",
"value",
"=",
"KQMLTo... | Set the element of the list after the given keyword.
Parameters
----------
keyword : str
The keyword parameter to find in the list.
Putting a colon before the keyword is optional, if no colon is
given, it is added automatically (e.g. "keyword" will be found a... | [
"Set",
"the",
"element",
"of",
"the",
"list",
"after",
"the",
"given",
"keyword",
"."
] | c18b39868626215deb634567c6bd7c0838e443c0 | https://github.com/bgyori/pykqml/blob/c18b39868626215deb634567c6bd7c0838e443c0/kqml/kqml_list.py#L149-L182 | train |
bgyori/pykqml | kqml/kqml_list.py | KQMLList.sets | def sets(self, keyword, value):
"""Set the element of the list after the given keyword as string.
Parameters
----------
keyword : str
The keyword parameter to find in the list.
Putting a colon before the keyword is optional, if no colon is
given, it i... | python | def sets(self, keyword, value):
"""Set the element of the list after the given keyword as string.
Parameters
----------
keyword : str
The keyword parameter to find in the list.
Putting a colon before the keyword is optional, if no colon is
given, it i... | [
"def",
"sets",
"(",
"self",
",",
"keyword",
",",
"value",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"str",
")",
":",
"value",
"=",
"KQMLString",
"(",
"value",
")",
"self",
".",
"set",
"(",
"keyword",
",",
"value",
")"
] | Set the element of the list after the given keyword as string.
Parameters
----------
keyword : str
The keyword parameter to find in the list.
Putting a colon before the keyword is optional, if no colon is
given, it is added automatically (e.g. "keyword" will ... | [
"Set",
"the",
"element",
"of",
"the",
"list",
"after",
"the",
"given",
"keyword",
"as",
"string",
"."
] | c18b39868626215deb634567c6bd7c0838e443c0 | https://github.com/bgyori/pykqml/blob/c18b39868626215deb634567c6bd7c0838e443c0/kqml/kqml_list.py#L184-L204 | train |
mastro35/flows | flows/ConfigManager.py | ConfigManager.read_recipe | def read_recipe(self, filename):
"""
Read a recipe file from disk
"""
Global.LOGGER.debug(f"reading recipe {filename}")
if not os.path.isfile(filename):
Global.LOGGER.error(filename + " recipe not found, skipping")
return
config = configparser.Con... | python | def read_recipe(self, filename):
"""
Read a recipe file from disk
"""
Global.LOGGER.debug(f"reading recipe {filename}")
if not os.path.isfile(filename):
Global.LOGGER.error(filename + " recipe not found, skipping")
return
config = configparser.Con... | [
"def",
"read_recipe",
"(",
"self",
",",
"filename",
")",
":",
"Global",
".",
"LOGGER",
".",
"debug",
"(",
"f\"reading recipe {filename}\"",
")",
"if",
"not",
"os",
".",
"path",
".",
"isfile",
"(",
"filename",
")",
":",
"Global",
".",
"LOGGER",
".",
"erro... | Read a recipe file from disk | [
"Read",
"a",
"recipe",
"file",
"from",
"disk"
] | 05e488385673a69597b5b39c7728795aa4d5eb18 | https://github.com/mastro35/flows/blob/05e488385673a69597b5b39c7728795aa4d5eb18/flows/ConfigManager.py#L56-L73 | train |
mastro35/flows | flows/ConfigManager.py | ConfigManager.set_socket_address | def set_socket_address(self):
"""
Set a random port to be used by zmq
"""
Global.LOGGER.debug('defining socket addresses for zmq')
random.seed()
default_port = random.randrange(5001, 5999)
internal_0mq_address = "tcp://127.0.0.1"
internal_0mq_port... | python | def set_socket_address(self):
"""
Set a random port to be used by zmq
"""
Global.LOGGER.debug('defining socket addresses for zmq')
random.seed()
default_port = random.randrange(5001, 5999)
internal_0mq_address = "tcp://127.0.0.1"
internal_0mq_port... | [
"def",
"set_socket_address",
"(",
"self",
")",
":",
"Global",
".",
"LOGGER",
".",
"debug",
"(",
"'defining socket addresses for zmq'",
")",
"random",
".",
"seed",
"(",
")",
"default_port",
"=",
"random",
".",
"randrange",
"(",
"5001",
",",
"5999",
")",
"inte... | Set a random port to be used by zmq | [
"Set",
"a",
"random",
"port",
"to",
"be",
"used",
"by",
"zmq"
] | 05e488385673a69597b5b39c7728795aa4d5eb18 | https://github.com/mastro35/flows/blob/05e488385673a69597b5b39c7728795aa4d5eb18/flows/ConfigManager.py#L75-L93 | train |
yymao/generic-catalog-reader | GCR/base.py | BaseGenericCatalog.get_quantities | def get_quantities(self, quantities, filters=None, native_filters=None, return_iterator=False):
"""
Fetch quantities from this catalog.
Parameters
----------
quantities : str or list of str or tuple of str
quantities to fetch
filters : list of tuple, or GCRQ... | python | def get_quantities(self, quantities, filters=None, native_filters=None, return_iterator=False):
"""
Fetch quantities from this catalog.
Parameters
----------
quantities : str or list of str or tuple of str
quantities to fetch
filters : list of tuple, or GCRQ... | [
"def",
"get_quantities",
"(",
"self",
",",
"quantities",
",",
"filters",
"=",
"None",
",",
"native_filters",
"=",
"None",
",",
"return_iterator",
"=",
"False",
")",
":",
"quantities",
"=",
"self",
".",
"_preprocess_requested_quantities",
"(",
"quantities",
")",
... | Fetch quantities from this catalog.
Parameters
----------
quantities : str or list of str or tuple of str
quantities to fetch
filters : list of tuple, or GCRQuery instance, optional
filters to apply. Each filter should be in the format of (callable, str, str, ..... | [
"Fetch",
"quantities",
"from",
"this",
"catalog",
"."
] | bc6267ac41b9f68106ed6065184469ac13fdc0b6 | https://github.com/yymao/generic-catalog-reader/blob/bc6267ac41b9f68106ed6065184469ac13fdc0b6/GCR/base.py#L41-L77 | train |
yymao/generic-catalog-reader | GCR/base.py | BaseGenericCatalog.list_all_quantities | def list_all_quantities(self, include_native=False, with_info=False):
"""
Return a list of all available quantities in this catalog.
If *include_native* is `True`, includes native quantities.
If *with_info* is `True`, return a dict with quantity info.
See also: list_all_native_... | python | def list_all_quantities(self, include_native=False, with_info=False):
"""
Return a list of all available quantities in this catalog.
If *include_native* is `True`, includes native quantities.
If *with_info* is `True`, return a dict with quantity info.
See also: list_all_native_... | [
"def",
"list_all_quantities",
"(",
"self",
",",
"include_native",
"=",
"False",
",",
"with_info",
"=",
"False",
")",
":",
"q",
"=",
"set",
"(",
"self",
".",
"_quantity_modifiers",
")",
"if",
"include_native",
":",
"q",
".",
"update",
"(",
"self",
".",
"_... | Return a list of all available quantities in this catalog.
If *include_native* is `True`, includes native quantities.
If *with_info* is `True`, return a dict with quantity info.
See also: list_all_native_quantities | [
"Return",
"a",
"list",
"of",
"all",
"available",
"quantities",
"in",
"this",
"catalog",
"."
] | bc6267ac41b9f68106ed6065184469ac13fdc0b6 | https://github.com/yymao/generic-catalog-reader/blob/bc6267ac41b9f68106ed6065184469ac13fdc0b6/GCR/base.py#L126-L138 | train |
yymao/generic-catalog-reader | GCR/base.py | BaseGenericCatalog.list_all_native_quantities | def list_all_native_quantities(self, with_info=False):
"""
Return a list of all available native quantities in this catalog.
If *with_info* is `True`, return a dict with quantity info.
See also: list_all_quantities
"""
q = self._native_quantities
return {k: self... | python | def list_all_native_quantities(self, with_info=False):
"""
Return a list of all available native quantities in this catalog.
If *with_info* is `True`, return a dict with quantity info.
See also: list_all_quantities
"""
q = self._native_quantities
return {k: self... | [
"def",
"list_all_native_quantities",
"(",
"self",
",",
"with_info",
"=",
"False",
")",
":",
"q",
"=",
"self",
".",
"_native_quantities",
"return",
"{",
"k",
":",
"self",
".",
"get_quantity_info",
"(",
"k",
")",
"for",
"k",
"in",
"q",
"}",
"if",
"with_inf... | Return a list of all available native quantities in this catalog.
If *with_info* is `True`, return a dict with quantity info.
See also: list_all_quantities | [
"Return",
"a",
"list",
"of",
"all",
"available",
"native",
"quantities",
"in",
"this",
"catalog",
"."
] | bc6267ac41b9f68106ed6065184469ac13fdc0b6 | https://github.com/yymao/generic-catalog-reader/blob/bc6267ac41b9f68106ed6065184469ac13fdc0b6/GCR/base.py#L140-L149 | train |
yymao/generic-catalog-reader | GCR/base.py | BaseGenericCatalog.first_available | def first_available(self, *quantities):
"""
Return the first available quantity in the input arguments.
Return `None` if none of them is available.
"""
for i, q in enumerate(quantities):
if self.has_quantity(q):
if i:
warnings.warn(... | python | def first_available(self, *quantities):
"""
Return the first available quantity in the input arguments.
Return `None` if none of them is available.
"""
for i, q in enumerate(quantities):
if self.has_quantity(q):
if i:
warnings.warn(... | [
"def",
"first_available",
"(",
"self",
",",
"*",
"quantities",
")",
":",
"for",
"i",
",",
"q",
"in",
"enumerate",
"(",
"quantities",
")",
":",
"if",
"self",
".",
"has_quantity",
"(",
"q",
")",
":",
"if",
"i",
":",
"warnings",
".",
"warn",
"(",
"'{}... | Return the first available quantity in the input arguments.
Return `None` if none of them is available. | [
"Return",
"the",
"first",
"available",
"quantity",
"in",
"the",
"input",
"arguments",
".",
"Return",
"None",
"if",
"none",
"of",
"them",
"is",
"available",
"."
] | bc6267ac41b9f68106ed6065184469ac13fdc0b6 | https://github.com/yymao/generic-catalog-reader/blob/bc6267ac41b9f68106ed6065184469ac13fdc0b6/GCR/base.py#L151-L160 | train |
yymao/generic-catalog-reader | GCR/base.py | BaseGenericCatalog.get_input_kwargs | def get_input_kwargs(self, key=None, default=None):
"""
Deprecated. Use `get_catalog_info` instead.
Get information from the catalog config file.
If *key* is `None`, return the full dict.
"""
warnings.warn("`get_input_kwargs` is deprecated; use `get_catalog_info` instead... | python | def get_input_kwargs(self, key=None, default=None):
"""
Deprecated. Use `get_catalog_info` instead.
Get information from the catalog config file.
If *key* is `None`, return the full dict.
"""
warnings.warn("`get_input_kwargs` is deprecated; use `get_catalog_info` instead... | [
"def",
"get_input_kwargs",
"(",
"self",
",",
"key",
"=",
"None",
",",
"default",
"=",
"None",
")",
":",
"warnings",
".",
"warn",
"(",
"\"`get_input_kwargs` is deprecated; use `get_catalog_info` instead.\"",
",",
"DeprecationWarning",
")",
"return",
"self",
".",
"get... | Deprecated. Use `get_catalog_info` instead.
Get information from the catalog config file.
If *key* is `None`, return the full dict. | [
"Deprecated",
".",
"Use",
"get_catalog_info",
"instead",
"."
] | bc6267ac41b9f68106ed6065184469ac13fdc0b6 | https://github.com/yymao/generic-catalog-reader/blob/bc6267ac41b9f68106ed6065184469ac13fdc0b6/GCR/base.py#L162-L170 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.