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
robdmc/crontabs
crontabs/crontabs.py
Tab.starting_at
def starting_at(self, datetime_or_str): """ Set the starting time for the cron job. If not specified, the starting time will always be the beginning of the interval that is current when the cron is started. :param datetime_or_str: a datetime object or a string that dateutil.parser can ...
python
def starting_at(self, datetime_or_str): """ Set the starting time for the cron job. If not specified, the starting time will always be the beginning of the interval that is current when the cron is started. :param datetime_or_str: a datetime object or a string that dateutil.parser can ...
[ "def", "starting_at", "(", "self", ",", "datetime_or_str", ")", ":", "if", "isinstance", "(", "datetime_or_str", ",", "str", ")", ":", "self", ".", "_starting_at", "=", "parse", "(", "datetime_or_str", ")", "elif", "isinstance", "(", "datetime_or_str", ",", ...
Set the starting time for the cron job. If not specified, the starting time will always be the beginning of the interval that is current when the cron is started. :param datetime_or_str: a datetime object or a string that dateutil.parser can understand :return: self
[ "Set", "the", "starting", "time", "for", "the", "cron", "job", ".", "If", "not", "specified", "the", "starting", "time", "will", "always", "be", "the", "beginning", "of", "the", "interval", "that", "is", "current", "when", "the", "cron", "is", "started", ...
3a347f9309eb1b4c7c222363ede338a158f5072c
https://github.com/robdmc/crontabs/blob/3a347f9309eb1b4c7c222363ede338a158f5072c/crontabs/crontabs.py#L61-L75
train
robdmc/crontabs
crontabs/crontabs.py
Tab.run
def run(self, func, *func_args, **func__kwargs): """ Specify the function to run at the scheduled times :param func: a callable :param func_args: the args to the callable :param func__kwargs: the kwargs to the callable :return: """ self._func = func ...
python
def run(self, func, *func_args, **func__kwargs): """ Specify the function to run at the scheduled times :param func: a callable :param func_args: the args to the callable :param func__kwargs: the kwargs to the callable :return: """ self._func = func ...
[ "def", "run", "(", "self", ",", "func", ",", "*", "func_args", ",", "**", "func__kwargs", ")", ":", "self", ".", "_func", "=", "func", "self", ".", "_func_args", "=", "func_args", "self", ".", "_func_kwargs", "=", "func__kwargs", "return", "self" ]
Specify the function to run at the scheduled times :param func: a callable :param func_args: the args to the callable :param func__kwargs: the kwargs to the callable :return:
[ "Specify", "the", "function", "to", "run", "at", "the", "scheduled", "times" ]
3a347f9309eb1b4c7c222363ede338a158f5072c
https://github.com/robdmc/crontabs/blob/3a347f9309eb1b4c7c222363ede338a158f5072c/crontabs/crontabs.py#L93-L105
train
robdmc/crontabs
crontabs/crontabs.py
Tab._get_target
def _get_target(self): """ returns a callable with no arguments designed to be the target of a Subprocess """ if None in [self._func, self._func_kwargs, self._func_kwargs, self._every_kwargs]: raise ValueError('You must call the .every() and .run() methods on every ta...
python
def _get_target(self): """ returns a callable with no arguments designed to be the target of a Subprocess """ if None in [self._func, self._func_kwargs, self._func_kwargs, self._every_kwargs]: raise ValueError('You must call the .every() and .run() methods on every ta...
[ "def", "_get_target", "(", "self", ")", ":", "if", "None", "in", "[", "self", ".", "_func", ",", "self", ".", "_func_kwargs", ",", "self", ".", "_func_kwargs", ",", "self", ".", "_every_kwargs", "]", ":", "raise", "ValueError", "(", "'You must call the .ev...
returns a callable with no arguments designed to be the target of a Subprocess
[ "returns", "a", "callable", "with", "no", "arguments", "designed", "to", "be", "the", "target", "of", "a", "Subprocess" ]
3a347f9309eb1b4c7c222363ede338a158f5072c
https://github.com/robdmc/crontabs/blob/3a347f9309eb1b4c7c222363ede338a158f5072c/crontabs/crontabs.py#L197-L204
train
robdmc/crontabs
crontabs/processes.py
wrapped_target
def wrapped_target(target, q_stdout, q_stderr, q_error, robust, name, *args, **kwargs): # pragma: no cover """ Wraps a target with queues replacing stdout and stderr """ import sys sys.stdout = IOQueue(q_stdout) sys.stderr = IOQueue(q_stderr) try: target(*args, **kwargs) except...
python
def wrapped_target(target, q_stdout, q_stderr, q_error, robust, name, *args, **kwargs): # pragma: no cover """ Wraps a target with queues replacing stdout and stderr """ import sys sys.stdout = IOQueue(q_stdout) sys.stderr = IOQueue(q_stderr) try: target(*args, **kwargs) except...
[ "def", "wrapped_target", "(", "target", ",", "q_stdout", ",", "q_stderr", ",", "q_error", ",", "robust", ",", "name", ",", "*", "args", ",", "**", "kwargs", ")", ":", "import", "sys", "sys", ".", "stdout", "=", "IOQueue", "(", "q_stdout", ")", "sys", ...
Wraps a target with queues replacing stdout and stderr
[ "Wraps", "a", "target", "with", "queues", "replacing", "stdout", "and", "stderr" ]
3a347f9309eb1b4c7c222363ede338a158f5072c
https://github.com/robdmc/crontabs/blob/3a347f9309eb1b4c7c222363ede338a158f5072c/crontabs/processes.py#L85-L107
train
robdmc/crontabs
crontabs/processes.py
ProcessMonitor.loop
def loop(self, max_seconds=None): """ Main loop for the process. This will run continuously until maxiter """ loop_started = datetime.datetime.now() self._is_running = True while self._is_running: self.process_error_queue(self.q_error) if max_se...
python
def loop(self, max_seconds=None): """ Main loop for the process. This will run continuously until maxiter """ loop_started = datetime.datetime.now() self._is_running = True while self._is_running: self.process_error_queue(self.q_error) if max_se...
[ "def", "loop", "(", "self", ",", "max_seconds", "=", "None", ")", ":", "loop_started", "=", "datetime", ".", "datetime", ".", "now", "(", ")", "self", ".", "_is_running", "=", "True", "while", "self", ".", "_is_running", ":", "self", ".", "process_error_...
Main loop for the process. This will run continuously until maxiter
[ "Main", "loop", "for", "the", "process", ".", "This", "will", "run", "continuously", "until", "maxiter" ]
3a347f9309eb1b4c7c222363ede338a158f5072c
https://github.com/robdmc/crontabs/blob/3a347f9309eb1b4c7c222363ede338a158f5072c/crontabs/processes.py#L156-L174
train
gusutabopb/aioinflux
aioinflux/serialization/common.py
escape
def escape(string, escape_pattern): """Assistant function for string escaping""" try: return string.translate(escape_pattern) except AttributeError: warnings.warn("Non-string-like data passed. " "Attempting to convert to 'str'.") return str(string).translate(tag...
python
def escape(string, escape_pattern): """Assistant function for string escaping""" try: return string.translate(escape_pattern) except AttributeError: warnings.warn("Non-string-like data passed. " "Attempting to convert to 'str'.") return str(string).translate(tag...
[ "def", "escape", "(", "string", ",", "escape_pattern", ")", ":", "try", ":", "return", "string", ".", "translate", "(", "escape_pattern", ")", "except", "AttributeError", ":", "warnings", ".", "warn", "(", "\"Non-string-like data passed. \"", "\"Attempting to conver...
Assistant function for string escaping
[ "Assistant", "function", "for", "string", "escaping" ]
2e4b7b3e13604e7618c686d89a0673f0bc70b24e
https://github.com/gusutabopb/aioinflux/blob/2e4b7b3e13604e7618c686d89a0673f0bc70b24e/aioinflux/serialization/common.py#L13-L20
train
gusutabopb/aioinflux
aioinflux/serialization/usertype.py
_make_serializer
def _make_serializer(meas, schema, rm_none, extra_tags, placeholder): # noqa: C901 """Factory of line protocol parsers""" _validate_schema(schema, placeholder) tags = [] fields = [] ts = None meas = meas for k, t in schema.items(): if t is MEASUREMENT: meas = f"{{i.{k}}}...
python
def _make_serializer(meas, schema, rm_none, extra_tags, placeholder): # noqa: C901 """Factory of line protocol parsers""" _validate_schema(schema, placeholder) tags = [] fields = [] ts = None meas = meas for k, t in schema.items(): if t is MEASUREMENT: meas = f"{{i.{k}}}...
[ "def", "_make_serializer", "(", "meas", ",", "schema", ",", "rm_none", ",", "extra_tags", ",", "placeholder", ")", ":", "_validate_schema", "(", "schema", ",", "placeholder", ")", "tags", "=", "[", "]", "fields", "=", "[", "]", "ts", "=", "None", "meas",...
Factory of line protocol parsers
[ "Factory", "of", "line", "protocol", "parsers" ]
2e4b7b3e13604e7618c686d89a0673f0bc70b24e
https://github.com/gusutabopb/aioinflux/blob/2e4b7b3e13604e7618c686d89a0673f0bc70b24e/aioinflux/serialization/usertype.py#L67-L122
train
gusutabopb/aioinflux
aioinflux/serialization/usertype.py
lineprotocol
def lineprotocol( cls=None, *, schema: Optional[Mapping[str, type]] = None, rm_none: bool = False, extra_tags: Optional[Mapping[str, str]] = None, placeholder: bool = False ): """Adds ``to_lineprotocol`` method to arbitrary user-defined classes :param cls: Class ...
python
def lineprotocol( cls=None, *, schema: Optional[Mapping[str, type]] = None, rm_none: bool = False, extra_tags: Optional[Mapping[str, str]] = None, placeholder: bool = False ): """Adds ``to_lineprotocol`` method to arbitrary user-defined classes :param cls: Class ...
[ "def", "lineprotocol", "(", "cls", "=", "None", ",", "*", ",", "schema", ":", "Optional", "[", "Mapping", "[", "str", ",", "type", "]", "]", "=", "None", ",", "rm_none", ":", "bool", "=", "False", ",", "extra_tags", ":", "Optional", "[", "Mapping", ...
Adds ``to_lineprotocol`` method to arbitrary user-defined classes :param cls: Class to monkey-patch :param schema: Schema dictionary (attr/type pairs). :param rm_none: Whether apply a regex to remove ``None`` values. If ``False``, passing ``None`` values to boolean, integer or float or time fields ...
[ "Adds", "to_lineprotocol", "method", "to", "arbitrary", "user", "-", "defined", "classes" ]
2e4b7b3e13604e7618c686d89a0673f0bc70b24e
https://github.com/gusutabopb/aioinflux/blob/2e4b7b3e13604e7618c686d89a0673f0bc70b24e/aioinflux/serialization/usertype.py#L125-L152
train
gusutabopb/aioinflux
aioinflux/serialization/mapping.py
_serialize_fields
def _serialize_fields(point): """Field values can be floats, integers, strings, or Booleans.""" output = [] for k, v in point['fields'].items(): k = escape(k, key_escape) if isinstance(v, bool): output.append(f'{k}={v}') elif isinstance(v, int): output.append(...
python
def _serialize_fields(point): """Field values can be floats, integers, strings, or Booleans.""" output = [] for k, v in point['fields'].items(): k = escape(k, key_escape) if isinstance(v, bool): output.append(f'{k}={v}') elif isinstance(v, int): output.append(...
[ "def", "_serialize_fields", "(", "point", ")", ":", "output", "=", "[", "]", "for", "k", ",", "v", "in", "point", "[", "'fields'", "]", ".", "items", "(", ")", ":", "k", "=", "escape", "(", "k", ",", "key_escape", ")", "if", "isinstance", "(", "v...
Field values can be floats, integers, strings, or Booleans.
[ "Field", "values", "can", "be", "floats", "integers", "strings", "or", "Booleans", "." ]
2e4b7b3e13604e7618c686d89a0673f0bc70b24e
https://github.com/gusutabopb/aioinflux/blob/2e4b7b3e13604e7618c686d89a0673f0bc70b24e/aioinflux/serialization/mapping.py#L57-L74
train
gusutabopb/aioinflux
aioinflux/serialization/__init__.py
serialize
def serialize(data, measurement=None, tag_columns=None, **extra_tags): """Converts input data into line protocol format""" if isinstance(data, bytes): return data elif isinstance(data, str): return data.encode('utf-8') elif hasattr(data, 'to_lineprotocol'): return data.to_linepro...
python
def serialize(data, measurement=None, tag_columns=None, **extra_tags): """Converts input data into line protocol format""" if isinstance(data, bytes): return data elif isinstance(data, str): return data.encode('utf-8') elif hasattr(data, 'to_lineprotocol'): return data.to_linepro...
[ "def", "serialize", "(", "data", ",", "measurement", "=", "None", ",", "tag_columns", "=", "None", ",", "**", "extra_tags", ")", ":", "if", "isinstance", "(", "data", ",", "bytes", ")", ":", "return", "data", "elif", "isinstance", "(", "data", ",", "st...
Converts input data into line protocol format
[ "Converts", "input", "data", "into", "line", "protocol", "format" ]
2e4b7b3e13604e7618c686d89a0673f0bc70b24e
https://github.com/gusutabopb/aioinflux/blob/2e4b7b3e13604e7618c686d89a0673f0bc70b24e/aioinflux/serialization/__init__.py#L9-L24
train
gusutabopb/aioinflux
aioinflux/iterutils.py
iterpoints
def iterpoints(resp: dict, parser: Optional[Callable] = None) -> Iterator[Any]: """Iterates a response JSON yielding data point by point. Can be used with both regular and chunked responses. By default, returns just a plain list of values representing each point, without column names, or other metadata...
python
def iterpoints(resp: dict, parser: Optional[Callable] = None) -> Iterator[Any]: """Iterates a response JSON yielding data point by point. Can be used with both regular and chunked responses. By default, returns just a plain list of values representing each point, without column names, or other metadata...
[ "def", "iterpoints", "(", "resp", ":", "dict", ",", "parser", ":", "Optional", "[", "Callable", "]", "=", "None", ")", "->", "Iterator", "[", "Any", "]", ":", "for", "statement", "in", "resp", "[", "'results'", "]", ":", "if", "'series'", "not", "in"...
Iterates a response JSON yielding data point by point. Can be used with both regular and chunked responses. By default, returns just a plain list of values representing each point, without column names, or other metadata. In case a specific format is needed, an optional ``parser`` argument can be pass...
[ "Iterates", "a", "response", "JSON", "yielding", "data", "point", "by", "point", "." ]
2e4b7b3e13604e7618c686d89a0673f0bc70b24e
https://github.com/gusutabopb/aioinflux/blob/2e4b7b3e13604e7618c686d89a0673f0bc70b24e/aioinflux/iterutils.py#L6-L48
train
gusutabopb/aioinflux
aioinflux/serialization/dataframe.py
parse
def parse(resp) -> DataFrameType: """Makes a dictionary of DataFrames from a response object""" statements = [] for statement in resp['results']: series = {} for s in statement.get('series', []): series[_get_name(s)] = _drop_zero_index(_serializer(s)) statements.append(se...
python
def parse(resp) -> DataFrameType: """Makes a dictionary of DataFrames from a response object""" statements = [] for statement in resp['results']: series = {} for s in statement.get('series', []): series[_get_name(s)] = _drop_zero_index(_serializer(s)) statements.append(se...
[ "def", "parse", "(", "resp", ")", "->", "DataFrameType", ":", "statements", "=", "[", "]", "for", "statement", "in", "resp", "[", "'results'", "]", ":", "series", "=", "{", "}", "for", "s", "in", "statement", ".", "get", "(", "'series'", ",", "[", ...
Makes a dictionary of DataFrames from a response object
[ "Makes", "a", "dictionary", "of", "DataFrames", "from", "a", "response", "object" ]
2e4b7b3e13604e7618c686d89a0673f0bc70b24e
https://github.com/gusutabopb/aioinflux/blob/2e4b7b3e13604e7618c686d89a0673f0bc70b24e/aioinflux/serialization/dataframe.py#L44-L59
train
gusutabopb/aioinflux
aioinflux/serialization/dataframe.py
_itertuples
def _itertuples(df): """Custom implementation of ``DataFrame.itertuples`` that returns plain tuples instead of namedtuples. About 50% faster. """ cols = [df.iloc[:, k] for k in range(len(df.columns))] return zip(df.index, *cols)
python
def _itertuples(df): """Custom implementation of ``DataFrame.itertuples`` that returns plain tuples instead of namedtuples. About 50% faster. """ cols = [df.iloc[:, k] for k in range(len(df.columns))] return zip(df.index, *cols)
[ "def", "_itertuples", "(", "df", ")", ":", "cols", "=", "[", "df", ".", "iloc", "[", ":", ",", "k", "]", "for", "k", "in", "range", "(", "len", "(", "df", ".", "columns", ")", ")", "]", "return", "zip", "(", "df", ".", "index", ",", "*", "c...
Custom implementation of ``DataFrame.itertuples`` that returns plain tuples instead of namedtuples. About 50% faster.
[ "Custom", "implementation", "of", "DataFrame", ".", "itertuples", "that", "returns", "plain", "tuples", "instead", "of", "namedtuples", ".", "About", "50%", "faster", "." ]
2e4b7b3e13604e7618c686d89a0673f0bc70b24e
https://github.com/gusutabopb/aioinflux/blob/2e4b7b3e13604e7618c686d89a0673f0bc70b24e/aioinflux/serialization/dataframe.py#L65-L70
train
gusutabopb/aioinflux
aioinflux/serialization/dataframe.py
serialize
def serialize(df, measurement, tag_columns=None, **extra_tags) -> bytes: """Converts a Pandas DataFrame into line protocol format""" # Pre-processing if measurement is None: raise ValueError("Missing 'measurement'") if not isinstance(df.index, pd.DatetimeIndex): raise ValueError('DataFra...
python
def serialize(df, measurement, tag_columns=None, **extra_tags) -> bytes: """Converts a Pandas DataFrame into line protocol format""" # Pre-processing if measurement is None: raise ValueError("Missing 'measurement'") if not isinstance(df.index, pd.DatetimeIndex): raise ValueError('DataFra...
[ "def", "serialize", "(", "df", ",", "measurement", ",", "tag_columns", "=", "None", ",", "**", "extra_tags", ")", "->", "bytes", ":", "if", "measurement", "is", "None", ":", "raise", "ValueError", "(", "\"Missing 'measurement'\"", ")", "if", "not", "isinstan...
Converts a Pandas DataFrame into line protocol format
[ "Converts", "a", "Pandas", "DataFrame", "into", "line", "protocol", "format" ]
2e4b7b3e13604e7618c686d89a0673f0bc70b24e
https://github.com/gusutabopb/aioinflux/blob/2e4b7b3e13604e7618c686d89a0673f0bc70b24e/aioinflux/serialization/dataframe.py#L86-L127
train
gusutabopb/aioinflux
aioinflux/client.py
runner
def runner(coro): """Function execution decorator.""" @wraps(coro) def inner(self, *args, **kwargs): if self.mode == 'async': return coro(self, *args, **kwargs) return self._loop.run_until_complete(coro(self, *args, **kwargs)) return inner
python
def runner(coro): """Function execution decorator.""" @wraps(coro) def inner(self, *args, **kwargs): if self.mode == 'async': return coro(self, *args, **kwargs) return self._loop.run_until_complete(coro(self, *args, **kwargs)) return inner
[ "def", "runner", "(", "coro", ")", ":", "@", "wraps", "(", "coro", ")", "def", "inner", "(", "self", ",", "*", "args", ",", "**", "kwargs", ")", ":", "if", "self", ".", "mode", "==", "'async'", ":", "return", "coro", "(", "self", ",", "*", "arg...
Function execution decorator.
[ "Function", "execution", "decorator", "." ]
2e4b7b3e13604e7618c686d89a0673f0bc70b24e
https://github.com/gusutabopb/aioinflux/blob/2e4b7b3e13604e7618c686d89a0673f0bc70b24e/aioinflux/client.py#L25-L34
train
gusutabopb/aioinflux
aioinflux/client.py
InfluxDBClient._check_error
def _check_error(response): """Checks for JSON error messages and raises Python exception""" if 'error' in response: raise InfluxDBError(response['error']) elif 'results' in response: for statement in response['results']: if 'error' in statement: ...
python
def _check_error(response): """Checks for JSON error messages and raises Python exception""" if 'error' in response: raise InfluxDBError(response['error']) elif 'results' in response: for statement in response['results']: if 'error' in statement: ...
[ "def", "_check_error", "(", "response", ")", ":", "if", "'error'", "in", "response", ":", "raise", "InfluxDBError", "(", "response", "[", "'error'", "]", ")", "elif", "'results'", "in", "response", ":", "for", "statement", "in", "response", "[", "'results'",...
Checks for JSON error messages and raises Python exception
[ "Checks", "for", "JSON", "error", "messages", "and", "raises", "Python", "exception" ]
2e4b7b3e13604e7618c686d89a0673f0bc70b24e
https://github.com/gusutabopb/aioinflux/blob/2e4b7b3e13604e7618c686d89a0673f0bc70b24e/aioinflux/client.py#L384-L392
train
remcohaszing/pywakeonlan
wakeonlan.py
create_magic_packet
def create_magic_packet(macaddress): """ Create a magic packet. A magic packet is a packet that can be used with the for wake on lan protocol to wake up a computer. The packet is constructed from the mac address given as a parameter. Args: macaddress (str): the mac address that should ...
python
def create_magic_packet(macaddress): """ Create a magic packet. A magic packet is a packet that can be used with the for wake on lan protocol to wake up a computer. The packet is constructed from the mac address given as a parameter. Args: macaddress (str): the mac address that should ...
[ "def", "create_magic_packet", "(", "macaddress", ")", ":", "if", "len", "(", "macaddress", ")", "==", "12", ":", "pass", "elif", "len", "(", "macaddress", ")", "==", "17", ":", "sep", "=", "macaddress", "[", "2", "]", "macaddress", "=", "macaddress", "...
Create a magic packet. A magic packet is a packet that can be used with the for wake on lan protocol to wake up a computer. The packet is constructed from the mac address given as a parameter. Args: macaddress (str): the mac address that should be parsed into a magic packet.
[ "Create", "a", "magic", "packet", "." ]
d30b66172c483c4baadb426f493c3de30fecc19b
https://github.com/remcohaszing/pywakeonlan/blob/d30b66172c483c4baadb426f493c3de30fecc19b/wakeonlan.py#L19-L47
train
remcohaszing/pywakeonlan
wakeonlan.py
send_magic_packet
def send_magic_packet(*macs, **kwargs): """ Wake up computers having any of the given mac addresses. Wake on lan must be enabled on the host device. Args: macs (str): One or more macaddresses of machines to wake. Keyword Args: ip_address (str): the ip address of the host to send t...
python
def send_magic_packet(*macs, **kwargs): """ Wake up computers having any of the given mac addresses. Wake on lan must be enabled on the host device. Args: macs (str): One or more macaddresses of machines to wake. Keyword Args: ip_address (str): the ip address of the host to send t...
[ "def", "send_magic_packet", "(", "*", "macs", ",", "**", "kwargs", ")", ":", "packets", "=", "[", "]", "ip", "=", "kwargs", ".", "pop", "(", "'ip_address'", ",", "BROADCAST_IP", ")", "port", "=", "kwargs", ".", "pop", "(", "'port'", ",", "DEFAULT_PORT"...
Wake up computers having any of the given mac addresses. Wake on lan must be enabled on the host device. Args: macs (str): One or more macaddresses of machines to wake. Keyword Args: ip_address (str): the ip address of the host to send the magic packet to (default "25...
[ "Wake", "up", "computers", "having", "any", "of", "the", "given", "mac", "addresses", "." ]
d30b66172c483c4baadb426f493c3de30fecc19b
https://github.com/remcohaszing/pywakeonlan/blob/d30b66172c483c4baadb426f493c3de30fecc19b/wakeonlan.py#L50-L82
train
remcohaszing/pywakeonlan
wakeonlan.py
main
def main(argv=None): """ Run wake on lan as a CLI application. """ parser = argparse.ArgumentParser( description='Wake one or more computers using the wake on lan' ' protocol.') parser.add_argument( 'macs', metavar='mac address', nargs='+', ...
python
def main(argv=None): """ Run wake on lan as a CLI application. """ parser = argparse.ArgumentParser( description='Wake one or more computers using the wake on lan' ' protocol.') parser.add_argument( 'macs', metavar='mac address', nargs='+', ...
[ "def", "main", "(", "argv", "=", "None", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "'Wake one or more computers using the wake on lan'", "' protocol.'", ")", "parser", ".", "add_argument", "(", "'macs'", ",", "metavar", "...
Run wake on lan as a CLI application.
[ "Run", "wake", "on", "lan", "as", "a", "CLI", "application", "." ]
d30b66172c483c4baadb426f493c3de30fecc19b
https://github.com/remcohaszing/pywakeonlan/blob/d30b66172c483c4baadb426f493c3de30fecc19b/wakeonlan.py#L85-L111
train
liminspace/django-mjml
mjml/templatetags/mjml.py
mjml
def mjml(parser, token): """ Compile MJML template after render django template. Usage: {% mjml %} .. MJML template code .. {% endmjml %} """ nodelist = parser.parse(('endmjml',)) parser.delete_first_token() tokens = token.split_contents() if len(tokens) != 1...
python
def mjml(parser, token): """ Compile MJML template after render django template. Usage: {% mjml %} .. MJML template code .. {% endmjml %} """ nodelist = parser.parse(('endmjml',)) parser.delete_first_token() tokens = token.split_contents() if len(tokens) != 1...
[ "def", "mjml", "(", "parser", ",", "token", ")", ":", "nodelist", "=", "parser", ".", "parse", "(", "(", "'endmjml'", ",", ")", ")", "parser", ".", "delete_first_token", "(", ")", "tokens", "=", "token", ".", "split_contents", "(", ")", "if", "len", ...
Compile MJML template after render django template. Usage: {% mjml %} .. MJML template code .. {% endmjml %}
[ "Compile", "MJML", "template", "after", "render", "django", "template", "." ]
6f3e5959ccd35d1b2bcebc6f892a9400294736fb
https://github.com/liminspace/django-mjml/blob/6f3e5959ccd35d1b2bcebc6f892a9400294736fb/mjml/templatetags/mjml.py#L18-L32
train
moonso/vcf_parser
vcf_parser/header_parser.py
HeaderParser.parse_header_line
def parse_header_line(self, line): """docstring for parse_header_line""" self.header = line[1:].rstrip().split('\t') if len(self.header) < 9: self.header = line[1:].rstrip().split() self.individuals = self.header[9:]
python
def parse_header_line(self, line): """docstring for parse_header_line""" self.header = line[1:].rstrip().split('\t') if len(self.header) < 9: self.header = line[1:].rstrip().split() self.individuals = self.header[9:]
[ "def", "parse_header_line", "(", "self", ",", "line", ")", ":", "self", ".", "header", "=", "line", "[", "1", ":", "]", ".", "rstrip", "(", ")", ".", "split", "(", "'\\t'", ")", "if", "len", "(", "self", ".", "header", ")", "<", "9", ":", "self...
docstring for parse_header_line
[ "docstring", "for", "parse_header_line" ]
8e2b6724e31995e0d43af501f25974310c6b843b
https://github.com/moonso/vcf_parser/blob/8e2b6724e31995e0d43af501f25974310c6b843b/vcf_parser/header_parser.py#L178-L183
train
moonso/vcf_parser
vcf_parser/header_parser.py
HeaderParser.print_header
def print_header(self): """Returns a list with the header lines if proper format""" lines_to_print = [] lines_to_print.append('##fileformat='+self.fileformat) if self.filedate: lines_to_print.append('##fileformat='+self.fileformat) for filt in self.filter...
python
def print_header(self): """Returns a list with the header lines if proper format""" lines_to_print = [] lines_to_print.append('##fileformat='+self.fileformat) if self.filedate: lines_to_print.append('##fileformat='+self.fileformat) for filt in self.filter...
[ "def", "print_header", "(", "self", ")", ":", "lines_to_print", "=", "[", "]", "lines_to_print", ".", "append", "(", "'##fileformat='", "+", "self", ".", "fileformat", ")", "if", "self", ".", "filedate", ":", "lines_to_print", ".", "append", "(", "'##filefor...
Returns a list with the header lines if proper format
[ "Returns", "a", "list", "with", "the", "header", "lines", "if", "proper", "format" ]
8e2b6724e31995e0d43af501f25974310c6b843b
https://github.com/moonso/vcf_parser/blob/8e2b6724e31995e0d43af501f25974310c6b843b/vcf_parser/header_parser.py#L185-L205
train
moonso/vcf_parser
vcf_parser/parser.py
VCFParser.add_variant
def add_variant(self, chrom, pos, rs_id, ref, alt, qual, filt, info, form=None, genotypes=[]): """ Add a variant to the parser. This function is for building a vcf. It takes the relevant parameters and make a vcf variant in the proper format. """ variant_info = ...
python
def add_variant(self, chrom, pos, rs_id, ref, alt, qual, filt, info, form=None, genotypes=[]): """ Add a variant to the parser. This function is for building a vcf. It takes the relevant parameters and make a vcf variant in the proper format. """ variant_info = ...
[ "def", "add_variant", "(", "self", ",", "chrom", ",", "pos", ",", "rs_id", ",", "ref", ",", "alt", ",", "qual", ",", "filt", ",", "info", ",", "form", "=", "None", ",", "genotypes", "=", "[", "]", ")", ":", "variant_info", "=", "[", "chrom", ",",...
Add a variant to the parser. This function is for building a vcf. It takes the relevant parameters and make a vcf variant in the proper format.
[ "Add", "a", "variant", "to", "the", "parser", ".", "This", "function", "is", "for", "building", "a", "vcf", ".", "It", "takes", "the", "relevant", "parameters", "and", "make", "a", "vcf", "variant", "in", "the", "proper", "format", "." ]
8e2b6724e31995e0d43af501f25974310c6b843b
https://github.com/moonso/vcf_parser/blob/8e2b6724e31995e0d43af501f25974310c6b843b/vcf_parser/parser.py#L173-L202
train
hfaran/piazza-api
piazza_api/rpc.py
PiazzaRPC.content_get
def content_get(self, cid, nid=None): """Get data from post `cid` in network `nid` :type nid: str :param nid: This is the ID of the network (or class) from which to query posts. This is optional and only to override the existing `network_id` entered when created the cla...
python
def content_get(self, cid, nid=None): """Get data from post `cid` in network `nid` :type nid: str :param nid: This is the ID of the network (or class) from which to query posts. This is optional and only to override the existing `network_id` entered when created the cla...
[ "def", "content_get", "(", "self", ",", "cid", ",", "nid", "=", "None", ")", ":", "r", "=", "self", ".", "request", "(", "method", "=", "\"content.get\"", ",", "data", "=", "{", "\"cid\"", ":", "cid", "}", ",", "nid", "=", "nid", ")", "return", "...
Get data from post `cid` in network `nid` :type nid: str :param nid: This is the ID of the network (or class) from which to query posts. This is optional and only to override the existing `network_id` entered when created the class :type cid: str|int :param cid...
[ "Get", "data", "from", "post", "cid", "in", "network", "nid" ]
26201d06e26bada9a838f6765c1bccedad05bd39
https://github.com/hfaran/piazza-api/blob/26201d06e26bada9a838f6765c1bccedad05bd39/piazza_api/rpc.py#L82-L98
train
hfaran/piazza-api
piazza_api/rpc.py
PiazzaRPC.content_create
def content_create(self, params): """Create a post or followup. :type params: dict :param params: A dict of options to pass to the endpoint. Depends on the specific type of content being created. :returns: Python object containing returned data """ r = self....
python
def content_create(self, params): """Create a post or followup. :type params: dict :param params: A dict of options to pass to the endpoint. Depends on the specific type of content being created. :returns: Python object containing returned data """ r = self....
[ "def", "content_create", "(", "self", ",", "params", ")", ":", "r", "=", "self", ".", "request", "(", "method", "=", "\"content.create\"", ",", "data", "=", "params", ")", "return", "self", ".", "_handle_error", "(", "r", ",", "\"Could not create object {}.\...
Create a post or followup. :type params: dict :param params: A dict of options to pass to the endpoint. Depends on the specific type of content being created. :returns: Python object containing returned data
[ "Create", "a", "post", "or", "followup", "." ]
26201d06e26bada9a838f6765c1bccedad05bd39
https://github.com/hfaran/piazza-api/blob/26201d06e26bada9a838f6765c1bccedad05bd39/piazza_api/rpc.py#L100-L115
train
hfaran/piazza-api
piazza_api/rpc.py
PiazzaRPC.add_students
def add_students(self, student_emails, nid=None): """Enroll students in a network `nid`. Piazza will email these students with instructions to activate their account. :type student_emails: list of str :param student_emails: A listing of email addresses to enroll in...
python
def add_students(self, student_emails, nid=None): """Enroll students in a network `nid`. Piazza will email these students with instructions to activate their account. :type student_emails: list of str :param student_emails: A listing of email addresses to enroll in...
[ "def", "add_students", "(", "self", ",", "student_emails", ",", "nid", "=", "None", ")", ":", "r", "=", "self", ".", "request", "(", "method", "=", "\"network.update\"", ",", "data", "=", "{", "\"from\"", ":", "\"ClassSettingsPage\"", ",", "\"add_students\""...
Enroll students in a network `nid`. Piazza will email these students with instructions to activate their account. :type student_emails: list of str :param student_emails: A listing of email addresses to enroll in the network (or class). This can be a list of length one. ...
[ "Enroll", "students", "in", "a", "network", "nid", "." ]
26201d06e26bada9a838f6765c1bccedad05bd39
https://github.com/hfaran/piazza-api/blob/26201d06e26bada9a838f6765c1bccedad05bd39/piazza_api/rpc.py#L185-L211
train
hfaran/piazza-api
piazza_api/rpc.py
PiazzaRPC.get_all_users
def get_all_users(self, nid=None): """Get a listing of data for each user in a network `nid` :type nid: str :param nid: This is the ID of the network to get users from. This is optional and only to override the existing `network_id` entered when created the class ...
python
def get_all_users(self, nid=None): """Get a listing of data for each user in a network `nid` :type nid: str :param nid: This is the ID of the network to get users from. This is optional and only to override the existing `network_id` entered when created the class ...
[ "def", "get_all_users", "(", "self", ",", "nid", "=", "None", ")", ":", "r", "=", "self", ".", "request", "(", "method", "=", "\"network.get_all_users\"", ",", "nid", "=", "nid", ")", "return", "self", ".", "_handle_error", "(", "r", ",", "\"Could not ge...
Get a listing of data for each user in a network `nid` :type nid: str :param nid: This is the ID of the network to get users from. This is optional and only to override the existing `network_id` entered when created the class :returns: Python object containing returned ...
[ "Get", "a", "listing", "of", "data", "for", "each", "user", "in", "a", "network", "nid" ]
26201d06e26bada9a838f6765c1bccedad05bd39
https://github.com/hfaran/piazza-api/blob/26201d06e26bada9a838f6765c1bccedad05bd39/piazza_api/rpc.py#L213-L227
train
hfaran/piazza-api
piazza_api/rpc.py
PiazzaRPC.get_users
def get_users(self, user_ids, nid=None): """Get a listing of data for specific users `user_ids` in a network `nid` :type user_ids: list of str :param user_ids: a list of user ids. These are the same ids that are returned by get_all_users. :type nid: str :pa...
python
def get_users(self, user_ids, nid=None): """Get a listing of data for specific users `user_ids` in a network `nid` :type user_ids: list of str :param user_ids: a list of user ids. These are the same ids that are returned by get_all_users. :type nid: str :pa...
[ "def", "get_users", "(", "self", ",", "user_ids", ",", "nid", "=", "None", ")", ":", "r", "=", "self", ".", "request", "(", "method", "=", "\"network.get_users\"", ",", "data", "=", "{", "\"ids\"", ":", "user_ids", "}", ",", "nid", "=", "nid", ")", ...
Get a listing of data for specific users `user_ids` in a network `nid` :type user_ids: list of str :param user_ids: a list of user ids. These are the same ids that are returned by get_all_users. :type nid: str :param nid: This is the ID of the network to get studen...
[ "Get", "a", "listing", "of", "data", "for", "specific", "users", "user_ids", "in", "a", "network", "nid" ]
26201d06e26bada9a838f6765c1bccedad05bd39
https://github.com/hfaran/piazza-api/blob/26201d06e26bada9a838f6765c1bccedad05bd39/piazza_api/rpc.py#L229-L248
train
hfaran/piazza-api
piazza_api/rpc.py
PiazzaRPC.remove_users
def remove_users(self, user_ids, nid=None): """Remove users from a network `nid` :type user_ids: list of str :param user_ids: a list of user ids. These are the same ids that are returned by get_all_users. :type nid: str :param nid: This is the ID of the network to ...
python
def remove_users(self, user_ids, nid=None): """Remove users from a network `nid` :type user_ids: list of str :param user_ids: a list of user ids. These are the same ids that are returned by get_all_users. :type nid: str :param nid: This is the ID of the network to ...
[ "def", "remove_users", "(", "self", ",", "user_ids", ",", "nid", "=", "None", ")", ":", "r", "=", "self", ".", "request", "(", "method", "=", "\"network.update\"", ",", "data", "=", "{", "\"remove_users\"", ":", "user_ids", "}", ",", "nid", "=", "nid",...
Remove users from a network `nid` :type user_ids: list of str :param user_ids: a list of user ids. These are the same ids that are returned by get_all_users. :type nid: str :param nid: This is the ID of the network to remove students from. This is optional and ...
[ "Remove", "users", "from", "a", "network", "nid" ]
26201d06e26bada9a838f6765c1bccedad05bd39
https://github.com/hfaran/piazza-api/blob/26201d06e26bada9a838f6765c1bccedad05bd39/piazza_api/rpc.py#L250-L270
train
hfaran/piazza-api
piazza_api/rpc.py
PiazzaRPC.get_my_feed
def get_my_feed(self, limit=150, offset=20, sort="updated", nid=None): """Get my feed :type limit: int :param limit: Number of posts from feed to get, starting from ``offset`` :type offset: int :param offset: Offset starting from bottom of feed :type sort: str :p...
python
def get_my_feed(self, limit=150, offset=20, sort="updated", nid=None): """Get my feed :type limit: int :param limit: Number of posts from feed to get, starting from ``offset`` :type offset: int :param offset: Offset starting from bottom of feed :type sort: str :p...
[ "def", "get_my_feed", "(", "self", ",", "limit", "=", "150", ",", "offset", "=", "20", ",", "sort", "=", "\"updated\"", ",", "nid", "=", "None", ")", ":", "r", "=", "self", ".", "request", "(", "method", "=", "\"network.get_my_feed\"", ",", "nid", "=...
Get my feed :type limit: int :param limit: Number of posts from feed to get, starting from ``offset`` :type offset: int :param offset: Offset starting from bottom of feed :type sort: str :param sort: How to sort feed that will be retrieved; only current known...
[ "Get", "my", "feed" ]
26201d06e26bada9a838f6765c1bccedad05bd39
https://github.com/hfaran/piazza-api/blob/26201d06e26bada9a838f6765c1bccedad05bd39/piazza_api/rpc.py#L272-L296
train
hfaran/piazza-api
piazza_api/rpc.py
PiazzaRPC.filter_feed
def filter_feed(self, updated=False, following=False, folder=False, filter_folder="", sort="updated", nid=None): """Get filtered feed Only one filter type (updated, following, folder) is possible. :type nid: str :param nid: This is the ID of the network to get the ...
python
def filter_feed(self, updated=False, following=False, folder=False, filter_folder="", sort="updated", nid=None): """Get filtered feed Only one filter type (updated, following, folder) is possible. :type nid: str :param nid: This is the ID of the network to get the ...
[ "def", "filter_feed", "(", "self", ",", "updated", "=", "False", ",", "following", "=", "False", ",", "folder", "=", "False", ",", "filter_folder", "=", "\"\"", ",", "sort", "=", "\"updated\"", ",", "nid", "=", "None", ")", ":", "assert", "sum", "(", ...
Get filtered feed Only one filter type (updated, following, folder) is possible. :type nid: str :param nid: This is the ID of the network to get the feed from. This is optional and only to override the existing `network_id` entered when created the class :type ...
[ "Get", "filtered", "feed" ]
26201d06e26bada9a838f6765c1bccedad05bd39
https://github.com/hfaran/piazza-api/blob/26201d06e26bada9a838f6765c1bccedad05bd39/piazza_api/rpc.py#L298-L343
train
hfaran/piazza-api
piazza_api/rpc.py
PiazzaRPC.search
def search(self, query, nid=None): """Search for posts with ``query`` :type nid: str :param nid: This is the ID of the network to get the feed from. This is optional and only to override the existing `network_id` entered when created the class :type query: str ...
python
def search(self, query, nid=None): """Search for posts with ``query`` :type nid: str :param nid: This is the ID of the network to get the feed from. This is optional and only to override the existing `network_id` entered when created the class :type query: str ...
[ "def", "search", "(", "self", ",", "query", ",", "nid", "=", "None", ")", ":", "r", "=", "self", ".", "request", "(", "method", "=", "\"network.search\"", ",", "nid", "=", "nid", ",", "data", "=", "dict", "(", "query", "=", "query", ")", ")", "re...
Search for posts with ``query`` :type nid: str :param nid: This is the ID of the network to get the feed from. This is optional and only to override the existing `network_id` entered when created the class :type query: str :param query: The search query; should ...
[ "Search", "for", "posts", "with", "query" ]
26201d06e26bada9a838f6765c1bccedad05bd39
https://github.com/hfaran/piazza-api/blob/26201d06e26bada9a838f6765c1bccedad05bd39/piazza_api/rpc.py#L345-L362
train
hfaran/piazza-api
piazza_api/rpc.py
PiazzaRPC.get_stats
def get_stats(self, nid=None): """Get statistics for class :type nid: str :param nid: This is the ID of the network to get stats from. This is optional and only to override the existing `network_id` entered when created the class """ r = self.request( ...
python
def get_stats(self, nid=None): """Get statistics for class :type nid: str :param nid: This is the ID of the network to get stats from. This is optional and only to override the existing `network_id` entered when created the class """ r = self.request( ...
[ "def", "get_stats", "(", "self", ",", "nid", "=", "None", ")", ":", "r", "=", "self", ".", "request", "(", "api_type", "=", "\"main\"", ",", "method", "=", "\"network.get_stats\"", ",", "nid", "=", "nid", ",", ")", "return", "self", ".", "_handle_error...
Get statistics for class :type nid: str :param nid: This is the ID of the network to get stats from. This is optional and only to override the existing `network_id` entered when created the class
[ "Get", "statistics", "for", "class" ]
26201d06e26bada9a838f6765c1bccedad05bd39
https://github.com/hfaran/piazza-api/blob/26201d06e26bada9a838f6765c1bccedad05bd39/piazza_api/rpc.py#L364-L377
train
hfaran/piazza-api
piazza_api/rpc.py
PiazzaRPC.request
def request(self, method, data=None, nid=None, nid_key='nid', api_type="logic", return_response=False): """Get data from arbitrary Piazza API endpoint `method` in network `nid` :type method: str :param method: An internal Piazza API method name like `content.get` or...
python
def request(self, method, data=None, nid=None, nid_key='nid', api_type="logic", return_response=False): """Get data from arbitrary Piazza API endpoint `method` in network `nid` :type method: str :param method: An internal Piazza API method name like `content.get` or...
[ "def", "request", "(", "self", ",", "method", ",", "data", "=", "None", ",", "nid", "=", "None", ",", "nid_key", "=", "'nid'", ",", "api_type", "=", "\"logic\"", ",", "return_response", "=", "False", ")", ":", "self", ".", "_check_authenticated", "(", ...
Get data from arbitrary Piazza API endpoint `method` in network `nid` :type method: str :param method: An internal Piazza API method name like `content.get` or `network.get_users` :type data: dict :param data: Key-value data to pass to Piazza in the request :type ...
[ "Get", "data", "from", "arbitrary", "Piazza", "API", "endpoint", "method", "in", "network", "nid" ]
26201d06e26bada9a838f6765c1bccedad05bd39
https://github.com/hfaran/piazza-api/blob/26201d06e26bada9a838f6765c1bccedad05bd39/piazza_api/rpc.py#L392-L439
train
hfaran/piazza-api
piazza_api/rpc.py
PiazzaRPC._handle_error
def _handle_error(self, result, err_msg): """Check result for error :type result: dict :param result: response body :type err_msg: str :param err_msg: The message given to the :class:`RequestError` instance raised :returns: Actual result from result :...
python
def _handle_error(self, result, err_msg): """Check result for error :type result: dict :param result: response body :type err_msg: str :param err_msg: The message given to the :class:`RequestError` instance raised :returns: Actual result from result :...
[ "def", "_handle_error", "(", "self", ",", "result", ",", "err_msg", ")", ":", "if", "result", ".", "get", "(", "u'error'", ")", ":", "raise", "RequestError", "(", "\"{}\\nResponse: {}\"", ".", "format", "(", "err_msg", ",", "json", ".", "dumps", "(", "re...
Check result for error :type result: dict :param result: response body :type err_msg: str :param err_msg: The message given to the :class:`RequestError` instance raised :returns: Actual result from result :raises RequestError: If result has error
[ "Check", "result", "for", "error" ]
26201d06e26bada9a838f6765c1bccedad05bd39
https://github.com/hfaran/piazza-api/blob/26201d06e26bada9a838f6765c1bccedad05bd39/piazza_api/rpc.py#L454-L471
train
hfaran/piazza-api
piazza_api/piazza.py
Piazza.get_user_classes
def get_user_classes(self): """Get list of the current user's classes. This is a subset of the information returned by the call to ``get_user_status``. :returns: Classes of currently authenticated user :rtype: list """ # Previously getting classes from profile (such a li...
python
def get_user_classes(self): """Get list of the current user's classes. This is a subset of the information returned by the call to ``get_user_status``. :returns: Classes of currently authenticated user :rtype: list """ # Previously getting classes from profile (such a li...
[ "def", "get_user_classes", "(", "self", ")", ":", "status", "=", "self", ".", "get_user_status", "(", ")", "uid", "=", "status", "[", "'id'", "]", "raw_classes", "=", "status", ".", "get", "(", "'networks'", ",", "[", "]", ")", "classes", "=", "[", "...
Get list of the current user's classes. This is a subset of the information returned by the call to ``get_user_status``. :returns: Classes of currently authenticated user :rtype: list
[ "Get", "list", "of", "the", "current", "user", "s", "classes", ".", "This", "is", "a", "subset", "of", "the", "information", "returned", "by", "the", "call", "to", "get_user_status", "." ]
26201d06e26bada9a838f6765c1bccedad05bd39
https://github.com/hfaran/piazza-api/blob/26201d06e26bada9a838f6765c1bccedad05bd39/piazza_api/piazza.py#L66-L89
train
hfaran/piazza-api
piazza_api/nonce.py
nonce
def nonce(): """ Returns a new nonce to be used with the Piazza API. """ nonce_part1 = _int2base(int(_time()*1000), 36) nonce_part2 = _int2base(round(_random()*1679616), 36) return "{}{}".format(nonce_part1, nonce_part2)
python
def nonce(): """ Returns a new nonce to be used with the Piazza API. """ nonce_part1 = _int2base(int(_time()*1000), 36) nonce_part2 = _int2base(round(_random()*1679616), 36) return "{}{}".format(nonce_part1, nonce_part2)
[ "def", "nonce", "(", ")", ":", "nonce_part1", "=", "_int2base", "(", "int", "(", "_time", "(", ")", "*", "1000", ")", ",", "36", ")", "nonce_part2", "=", "_int2base", "(", "round", "(", "_random", "(", ")", "*", "1679616", ")", ",", "36", ")", "r...
Returns a new nonce to be used with the Piazza API.
[ "Returns", "a", "new", "nonce", "to", "be", "used", "with", "the", "Piazza", "API", "." ]
26201d06e26bada9a838f6765c1bccedad05bd39
https://github.com/hfaran/piazza-api/blob/26201d06e26bada9a838f6765c1bccedad05bd39/piazza_api/nonce.py#L7-L13
train
hfaran/piazza-api
piazza_api/network.py
Network.iter_all_posts
def iter_all_posts(self, limit=None): """Get all posts visible to the current user This grabs you current feed and ids of all posts from it; each post is then individually fetched. This method does not go against a bulk endpoint; it retrieves each post individually, so a caution...
python
def iter_all_posts(self, limit=None): """Get all posts visible to the current user This grabs you current feed and ids of all posts from it; each post is then individually fetched. This method does not go against a bulk endpoint; it retrieves each post individually, so a caution...
[ "def", "iter_all_posts", "(", "self", ",", "limit", "=", "None", ")", ":", "feed", "=", "self", ".", "get_feed", "(", "limit", "=", "999999", ",", "offset", "=", "0", ")", "cids", "=", "[", "post", "[", "'id'", "]", "for", "post", "in", "feed", "...
Get all posts visible to the current user This grabs you current feed and ids of all posts from it; each post is then individually fetched. This method does not go against a bulk endpoint; it retrieves each post individually, so a caution to the user when using this. :type limi...
[ "Get", "all", "posts", "visible", "to", "the", "current", "user" ]
26201d06e26bada9a838f6765c1bccedad05bd39
https://github.com/hfaran/piazza-api/blob/26201d06e26bada9a838f6765c1bccedad05bd39/piazza_api/network.py#L85-L107
train
hfaran/piazza-api
piazza_api/network.py
Network.create_post
def create_post(self, post_type, post_folders, post_subject, post_content, is_announcement=0, bypass_email=0, anonymous=False): """Create a post It seems like if the post has `<p>` tags, then it's treated as HTML, but is treated as text otherwise. You'll want to provide `content` accord...
python
def create_post(self, post_type, post_folders, post_subject, post_content, is_announcement=0, bypass_email=0, anonymous=False): """Create a post It seems like if the post has `<p>` tags, then it's treated as HTML, but is treated as text otherwise. You'll want to provide `content` accord...
[ "def", "create_post", "(", "self", ",", "post_type", ",", "post_folders", ",", "post_subject", ",", "post_content", ",", "is_announcement", "=", "0", ",", "bypass_email", "=", "0", ",", "anonymous", "=", "False", ")", ":", "params", "=", "{", "\"anonymous\""...
Create a post It seems like if the post has `<p>` tags, then it's treated as HTML, but is treated as text otherwise. You'll want to provide `content` accordingly. :type post_type: str :param post_type: 'note', 'question' :type post_folders: str :param post_folde...
[ "Create", "a", "post" ]
26201d06e26bada9a838f6765c1bccedad05bd39
https://github.com/hfaran/piazza-api/blob/26201d06e26bada9a838f6765c1bccedad05bd39/piazza_api/network.py#L109-L145
train
hfaran/piazza-api
piazza_api/network.py
Network.create_followup
def create_followup(self, post, content, anonymous=False): """Create a follow-up on a post `post`. It seems like if the post has `<p>` tags, then it's treated as HTML, but is treated as text otherwise. You'll want to provide `content` accordingly. :type post: dict|str|int ...
python
def create_followup(self, post, content, anonymous=False): """Create a follow-up on a post `post`. It seems like if the post has `<p>` tags, then it's treated as HTML, but is treated as text otherwise. You'll want to provide `content` accordingly. :type post: dict|str|int ...
[ "def", "create_followup", "(", "self", ",", "post", ",", "content", ",", "anonymous", "=", "False", ")", ":", "try", ":", "cid", "=", "post", "[", "\"id\"", "]", "except", "KeyError", ":", "cid", "=", "post", "params", "=", "{", "\"cid\"", ":", "cid"...
Create a follow-up on a post `post`. It seems like if the post has `<p>` tags, then it's treated as HTML, but is treated as text otherwise. You'll want to provide `content` accordingly. :type post: dict|str|int :param post: Either the post dict returned by another API method, ...
[ "Create", "a", "follow", "-", "up", "on", "a", "post", "post", "." ]
26201d06e26bada9a838f6765c1bccedad05bd39
https://github.com/hfaran/piazza-api/blob/26201d06e26bada9a838f6765c1bccedad05bd39/piazza_api/network.py#L147-L179
train
hfaran/piazza-api
piazza_api/network.py
Network.create_instructor_answer
def create_instructor_answer(self, post, content, revision, anonymous=False): """Create an instructor's answer to a post `post`. It seems like if the post has `<p>` tags, then it's treated as HTML, but is treated as text otherwise. You'll want to provide `content` accordingly. ...
python
def create_instructor_answer(self, post, content, revision, anonymous=False): """Create an instructor's answer to a post `post`. It seems like if the post has `<p>` tags, then it's treated as HTML, but is treated as text otherwise. You'll want to provide `content` accordingly. ...
[ "def", "create_instructor_answer", "(", "self", ",", "post", ",", "content", ",", "revision", ",", "anonymous", "=", "False", ")", ":", "try", ":", "cid", "=", "post", "[", "\"id\"", "]", "except", "KeyError", ":", "cid", "=", "post", "params", "=", "{...
Create an instructor's answer to a post `post`. It seems like if the post has `<p>` tags, then it's treated as HTML, but is treated as text otherwise. You'll want to provide `content` accordingly. :type post: dict|str|int :param post: Either the post dict returned by another A...
[ "Create", "an", "instructor", "s", "answer", "to", "a", "post", "post", "." ]
26201d06e26bada9a838f6765c1bccedad05bd39
https://github.com/hfaran/piazza-api/blob/26201d06e26bada9a838f6765c1bccedad05bd39/piazza_api/network.py#L181-L213
train
hfaran/piazza-api
piazza_api/network.py
Network.mark_as_duplicate
def mark_as_duplicate(self, duplicated_cid, master_cid, msg=''): """Mark the post at ``duplicated_cid`` as a duplicate of ``master_cid`` :type duplicated_cid: int :param duplicated_cid: The numeric id of the duplicated post :type master_cid: int :param master_cid: The numeric ...
python
def mark_as_duplicate(self, duplicated_cid, master_cid, msg=''): """Mark the post at ``duplicated_cid`` as a duplicate of ``master_cid`` :type duplicated_cid: int :param duplicated_cid: The numeric id of the duplicated post :type master_cid: int :param master_cid: The numeric ...
[ "def", "mark_as_duplicate", "(", "self", ",", "duplicated_cid", ",", "master_cid", ",", "msg", "=", "''", ")", ":", "content_id_from", "=", "self", ".", "get_post", "(", "duplicated_cid", ")", "[", "\"id\"", "]", "content_id_to", "=", "self", ".", "get_post"...
Mark the post at ``duplicated_cid`` as a duplicate of ``master_cid`` :type duplicated_cid: int :param duplicated_cid: The numeric id of the duplicated post :type master_cid: int :param master_cid: The numeric id of an older post. This will be the post that gets kept and ``...
[ "Mark", "the", "post", "at", "duplicated_cid", "as", "a", "duplicate", "of", "master_cid" ]
26201d06e26bada9a838f6765c1bccedad05bd39
https://github.com/hfaran/piazza-api/blob/26201d06e26bada9a838f6765c1bccedad05bd39/piazza_api/network.py#L248-L268
train
hfaran/piazza-api
piazza_api/network.py
Network.resolve_post
def resolve_post(self, post): """Mark post as resolved :type post: dict|str|int :param post: Either the post dict returned by another API method, or the `cid` field of that post. :returns: True if it is successful. False otherwise """ try: cid = ...
python
def resolve_post(self, post): """Mark post as resolved :type post: dict|str|int :param post: Either the post dict returned by another API method, or the `cid` field of that post. :returns: True if it is successful. False otherwise """ try: cid = ...
[ "def", "resolve_post", "(", "self", ",", "post", ")", ":", "try", ":", "cid", "=", "post", "[", "\"id\"", "]", "except", "KeyError", ":", "cid", "=", "post", "params", "=", "{", "\"cid\"", ":", "cid", ",", "\"resolved\"", ":", "\"true\"", "}", "retur...
Mark post as resolved :type post: dict|str|int :param post: Either the post dict returned by another API method, or the `cid` field of that post. :returns: True if it is successful. False otherwise
[ "Mark", "post", "as", "resolved" ]
26201d06e26bada9a838f6765c1bccedad05bd39
https://github.com/hfaran/piazza-api/blob/26201d06e26bada9a838f6765c1bccedad05bd39/piazza_api/network.py#L270-L288
train
hfaran/piazza-api
piazza_api/network.py
Network.delete_post
def delete_post(self, post): """ Deletes post by cid :type post: dict|str|int :param post: Either the post dict returned by another API method, the post ID, or the `cid` field of that post. :rtype: dict :returns: Dictionary with information about the post cid. ...
python
def delete_post(self, post): """ Deletes post by cid :type post: dict|str|int :param post: Either the post dict returned by another API method, the post ID, or the `cid` field of that post. :rtype: dict :returns: Dictionary with information about the post cid. ...
[ "def", "delete_post", "(", "self", ",", "post", ")", ":", "try", ":", "cid", "=", "post", "[", "'id'", "]", "except", "KeyError", ":", "cid", "=", "post", "except", "TypeError", ":", "post", "=", "self", ".", "get_post", "(", "post", ")", "cid", "=...
Deletes post by cid :type post: dict|str|int :param post: Either the post dict returned by another API method, the post ID, or the `cid` field of that post. :rtype: dict :returns: Dictionary with information about the post cid.
[ "Deletes", "post", "by", "cid" ]
26201d06e26bada9a838f6765c1bccedad05bd39
https://github.com/hfaran/piazza-api/blob/26201d06e26bada9a838f6765c1bccedad05bd39/piazza_api/network.py#L378-L400
train
hfaran/piazza-api
piazza_api/network.py
Network.get_feed
def get_feed(self, limit=100, offset=0): """Get your feed for this network Pagination for this can be achieved by using the ``limit`` and ``offset`` params :type limit: int :param limit: Number of posts from feed to get, starting from ``offset`` :type offset: int ...
python
def get_feed(self, limit=100, offset=0): """Get your feed for this network Pagination for this can be achieved by using the ``limit`` and ``offset`` params :type limit: int :param limit: Number of posts from feed to get, starting from ``offset`` :type offset: int ...
[ "def", "get_feed", "(", "self", ",", "limit", "=", "100", ",", "offset", "=", "0", ")", ":", "return", "self", ".", "_rpc", ".", "get_my_feed", "(", "limit", "=", "limit", ",", "offset", "=", "offset", ")" ]
Get your feed for this network Pagination for this can be achieved by using the ``limit`` and ``offset`` params :type limit: int :param limit: Number of posts from feed to get, starting from ``offset`` :type offset: int :param offset: Offset starting from bottom of feed...
[ "Get", "your", "feed", "for", "this", "network" ]
26201d06e26bada9a838f6765c1bccedad05bd39
https://github.com/hfaran/piazza-api/blob/26201d06e26bada9a838f6765c1bccedad05bd39/piazza_api/network.py#L406-L423
train
hfaran/piazza-api
piazza_api/network.py
Network.get_filtered_feed
def get_filtered_feed(self, feed_filter): """Get your feed containing only posts filtered by ``feed_filter`` :type feed_filter: FeedFilter :param feed_filter: Must be an instance of either: UnreadFilter, FollowingFilter, or FolderFilter :rtype: dict """ asser...
python
def get_filtered_feed(self, feed_filter): """Get your feed containing only posts filtered by ``feed_filter`` :type feed_filter: FeedFilter :param feed_filter: Must be an instance of either: UnreadFilter, FollowingFilter, or FolderFilter :rtype: dict """ asser...
[ "def", "get_filtered_feed", "(", "self", ",", "feed_filter", ")", ":", "assert", "isinstance", "(", "feed_filter", ",", "(", "UnreadFilter", ",", "FollowingFilter", ",", "FolderFilter", ")", ")", "return", "self", ".", "_rpc", ".", "filter_feed", "(", "**", ...
Get your feed containing only posts filtered by ``feed_filter`` :type feed_filter: FeedFilter :param feed_filter: Must be an instance of either: UnreadFilter, FollowingFilter, or FolderFilter :rtype: dict
[ "Get", "your", "feed", "containing", "only", "posts", "filtered", "by", "feed_filter" ]
26201d06e26bada9a838f6765c1bccedad05bd39
https://github.com/hfaran/piazza-api/blob/26201d06e26bada9a838f6765c1bccedad05bd39/piazza_api/network.py#L425-L435
train
lucaskjaero/PyCasia
pycasia/CASIA.py
CASIA.get_dataset
def get_dataset(self, dataset): """ Checks to see if the dataset is present. If not, it downloads and unzips it. """ # If the dataset is present, no need to download anything. success = True dataset_path = self.base_dataset_path + dataset if not isdir(dataset_path...
python
def get_dataset(self, dataset): """ Checks to see if the dataset is present. If not, it downloads and unzips it. """ # If the dataset is present, no need to download anything. success = True dataset_path = self.base_dataset_path + dataset if not isdir(dataset_path...
[ "def", "get_dataset", "(", "self", ",", "dataset", ")", ":", "success", "=", "True", "dataset_path", "=", "self", ".", "base_dataset_path", "+", "dataset", "if", "not", "isdir", "(", "dataset_path", ")", ":", "was_error", "=", "False", "for", "iteration", ...
Checks to see if the dataset is present. If not, it downloads and unzips it.
[ "Checks", "to", "see", "if", "the", "dataset", "is", "present", ".", "If", "not", "it", "downloads", "and", "unzips", "it", "." ]
511ddb7809d788fc2c7bc7c1e8600db60bac8152
https://github.com/lucaskjaero/PyCasia/blob/511ddb7809d788fc2c7bc7c1e8600db60bac8152/pycasia/CASIA.py#L72-L121
train
ashleysommer/sanicpluginsframework
spf/plugin.py
SanicPlugin.first_plugin_context
def first_plugin_context(self): """Returns the context is associated with the first app this plugin was registered on""" # Note, because registrations are stored in a set, its not _really_ # the first one, but whichever one it sees first in the set. first_spf_reg = next(iter(sel...
python
def first_plugin_context(self): """Returns the context is associated with the first app this plugin was registered on""" # Note, because registrations are stored in a set, its not _really_ # the first one, but whichever one it sees first in the set. first_spf_reg = next(iter(sel...
[ "def", "first_plugin_context", "(", "self", ")", ":", "first_spf_reg", "=", "next", "(", "iter", "(", "self", ".", "registrations", ")", ")", "return", "self", ".", "get_context_from_spf", "(", "first_spf_reg", ")" ]
Returns the context is associated with the first app this plugin was registered on
[ "Returns", "the", "context", "is", "associated", "with", "the", "first", "app", "this", "plugin", "was", "registered", "on" ]
2cb1656d9334f04c30c738074784b0450c1b893e
https://github.com/ashleysommer/sanicpluginsframework/blob/2cb1656d9334f04c30c738074784b0450c1b893e/spf/plugin.py#L191-L197
train
ashleysommer/sanicpluginsframework
spf/plugin.py
SanicPlugin.route_wrapper
async def route_wrapper(self, route, request, context, request_args, request_kw, *decorator_args, with_context=None, **decorator_kw): """This is the function that is called when a route is decorated with your plugin decorator. Context will norma...
python
async def route_wrapper(self, route, request, context, request_args, request_kw, *decorator_args, with_context=None, **decorator_kw): """This is the function that is called when a route is decorated with your plugin decorator. Context will norma...
[ "async", "def", "route_wrapper", "(", "self", ",", "route", ",", "request", ",", "context", ",", "request_args", ",", "request_kw", ",", "*", "decorator_args", ",", "with_context", "=", "None", ",", "**", "decorator_kw", ")", ":", "if", "with_context", ":", ...
This is the function that is called when a route is decorated with your plugin decorator. Context will normally be None, but the user can pass use_context=True so the route will get the plugin context
[ "This", "is", "the", "function", "that", "is", "called", "when", "a", "route", "is", "decorated", "with", "your", "plugin", "decorator", ".", "Context", "will", "normally", "be", "None", "but", "the", "user", "can", "pass", "use_context", "=", "True", "so"...
2cb1656d9334f04c30c738074784b0450c1b893e
https://github.com/ashleysommer/sanicpluginsframework/blob/2cb1656d9334f04c30c738074784b0450c1b893e/spf/plugin.py#L370-L385
train
ionelmc/python-manhole
src/manhole/__init__.py
check_credentials
def check_credentials(client): """ Checks credentials for given socket. """ pid, uid, gid = get_peercred(client) euid = os.geteuid() client_name = "PID:%s UID:%s GID:%s" % (pid, uid, gid) if uid not in (0, euid): raise SuspiciousClient("Can't accept client with %s. It doesn't match ...
python
def check_credentials(client): """ Checks credentials for given socket. """ pid, uid, gid = get_peercred(client) euid = os.geteuid() client_name = "PID:%s UID:%s GID:%s" % (pid, uid, gid) if uid not in (0, euid): raise SuspiciousClient("Can't accept client with %s. It doesn't match ...
[ "def", "check_credentials", "(", "client", ")", ":", "pid", ",", "uid", ",", "gid", "=", "get_peercred", "(", "client", ")", "euid", "=", "os", ".", "geteuid", "(", ")", "client_name", "=", "\"PID:%s UID:%s GID:%s\"", "%", "(", "pid", ",", "uid", ",", ...
Checks credentials for given socket.
[ "Checks", "credentials", "for", "given", "socket", "." ]
6a519a1f25142b047e814c6d00f4ef404856a15d
https://github.com/ionelmc/python-manhole/blob/6a519a1f25142b047e814c6d00f4ef404856a15d/src/manhole/__init__.py#L242-L256
train
ionelmc/python-manhole
src/manhole/__init__.py
handle_connection_exec
def handle_connection_exec(client): """ Alternate connection handler. No output redirection. """ class ExitExecLoop(Exception): pass def exit(): raise ExitExecLoop() client.settimeout(None) fh = os.fdopen(client.detach() if hasattr(client, 'detach') else client.fileno()) ...
python
def handle_connection_exec(client): """ Alternate connection handler. No output redirection. """ class ExitExecLoop(Exception): pass def exit(): raise ExitExecLoop() client.settimeout(None) fh = os.fdopen(client.detach() if hasattr(client, 'detach') else client.fileno()) ...
[ "def", "handle_connection_exec", "(", "client", ")", ":", "class", "ExitExecLoop", "(", "Exception", ")", ":", "pass", "def", "exit", "(", ")", ":", "raise", "ExitExecLoop", "(", ")", "client", ".", "settimeout", "(", "None", ")", "fh", "=", "os", ".", ...
Alternate connection handler. No output redirection.
[ "Alternate", "connection", "handler", ".", "No", "output", "redirection", "." ]
6a519a1f25142b047e814c6d00f4ef404856a15d
https://github.com/ionelmc/python-manhole/blob/6a519a1f25142b047e814c6d00f4ef404856a15d/src/manhole/__init__.py#L259-L281
train
ionelmc/python-manhole
src/manhole/__init__.py
handle_connection_repl
def handle_connection_repl(client): """ Handles connection. """ client.settimeout(None) # # disable this till we have evidence that it's needed # client.setsockopt(socket.SOL_SOCKET, socket.SO_SNDBUF, 0) # # Note: setting SO_RCVBUF on UDS has no effect, see: http://man7.org/linux/man-pages/m...
python
def handle_connection_repl(client): """ Handles connection. """ client.settimeout(None) # # disable this till we have evidence that it's needed # client.setsockopt(socket.SOL_SOCKET, socket.SO_SNDBUF, 0) # # Note: setting SO_RCVBUF on UDS has no effect, see: http://man7.org/linux/man-pages/m...
[ "def", "handle_connection_repl", "(", "client", ")", ":", "client", ".", "settimeout", "(", "None", ")", "backup", "=", "[", "]", "old_interval", "=", "getinterval", "(", ")", "patches", "=", "[", "(", "'r'", ",", "(", "'stdin'", ",", "'__stdin__'", ")",...
Handles connection.
[ "Handles", "connection", "." ]
6a519a1f25142b047e814c6d00f4ef404856a15d
https://github.com/ionelmc/python-manhole/blob/6a519a1f25142b047e814c6d00f4ef404856a15d/src/manhole/__init__.py#L284-L335
train
ionelmc/python-manhole
src/manhole/__init__.py
install
def install(verbose=True, verbose_destination=sys.__stderr__.fileno() if hasattr(sys.__stderr__, 'fileno') else sys.__stderr__, strict=True, **kwargs): """ Installs the manhole. Args: verbose (bool): Set it to ``False`` to squelch the logging. verbose_des...
python
def install(verbose=True, verbose_destination=sys.__stderr__.fileno() if hasattr(sys.__stderr__, 'fileno') else sys.__stderr__, strict=True, **kwargs): """ Installs the manhole. Args: verbose (bool): Set it to ``False`` to squelch the logging. verbose_des...
[ "def", "install", "(", "verbose", "=", "True", ",", "verbose_destination", "=", "sys", ".", "__stderr__", ".", "fileno", "(", ")", "if", "hasattr", "(", "sys", ".", "__stderr__", ",", "'fileno'", ")", "else", "sys", ".", "__stderr__", ",", "strict", "=",...
Installs the manhole. Args: verbose (bool): Set it to ``False`` to squelch the logging. verbose_destination (file descriptor or handle): Destination for verbose messages. Default is unbuffered stderr (stderr ``2`` file descriptor). patch_fork (bool): Set it to ``False`` if you d...
[ "Installs", "the", "manhole", "." ]
6a519a1f25142b047e814c6d00f4ef404856a15d
https://github.com/ionelmc/python-manhole/blob/6a519a1f25142b047e814c6d00f4ef404856a15d/src/manhole/__init__.py#L569-L618
train
ionelmc/python-manhole
src/manhole/__init__.py
dump_stacktraces
def dump_stacktraces(): """ Dumps thread ids and tracebacks to stdout. """ lines = [] for thread_id, stack in sys._current_frames().items(): # pylint: disable=W0212 lines.append("\n######### ProcessID=%s, ThreadID=%s #########" % ( os.getpid(), thread_id )) for f...
python
def dump_stacktraces(): """ Dumps thread ids and tracebacks to stdout. """ lines = [] for thread_id, stack in sys._current_frames().items(): # pylint: disable=W0212 lines.append("\n######### ProcessID=%s, ThreadID=%s #########" % ( os.getpid(), thread_id )) for f...
[ "def", "dump_stacktraces", "(", ")", ":", "lines", "=", "[", "]", "for", "thread_id", ",", "stack", "in", "sys", ".", "_current_frames", "(", ")", ".", "items", "(", ")", ":", "lines", ".", "append", "(", "\"\\n######### ProcessID=%s, ThreadID=%s #########\"",...
Dumps thread ids and tracebacks to stdout.
[ "Dumps", "thread", "ids", "and", "tracebacks", "to", "stdout", "." ]
6a519a1f25142b047e814c6d00f4ef404856a15d
https://github.com/ionelmc/python-manhole/blob/6a519a1f25142b047e814c6d00f4ef404856a15d/src/manhole/__init__.py#L621-L636
train
ionelmc/python-manhole
src/manhole/__init__.py
ManholeThread.clone
def clone(self, **kwargs): """ Make a fresh thread with the same options. This is usually used on dead threads. """ return ManholeThread( self.get_socket, self.sigmask, self.start_timeout, connection_handler=self.connection_handler, daemon_connection=s...
python
def clone(self, **kwargs): """ Make a fresh thread with the same options. This is usually used on dead threads. """ return ManholeThread( self.get_socket, self.sigmask, self.start_timeout, connection_handler=self.connection_handler, daemon_connection=s...
[ "def", "clone", "(", "self", ",", "**", "kwargs", ")", ":", "return", "ManholeThread", "(", "self", ".", "get_socket", ",", "self", ".", "sigmask", ",", "self", ".", "start_timeout", ",", "connection_handler", "=", "self", ".", "connection_handler", ",", "...
Make a fresh thread with the same options. This is usually used on dead threads.
[ "Make", "a", "fresh", "thread", "with", "the", "same", "options", ".", "This", "is", "usually", "used", "on", "dead", "threads", "." ]
6a519a1f25142b047e814c6d00f4ef404856a15d
https://github.com/ionelmc/python-manhole/blob/6a519a1f25142b047e814c6d00f4ef404856a15d/src/manhole/__init__.py#L167-L176
train
ionelmc/python-manhole
src/manhole/__init__.py
Manhole.reinstall
def reinstall(self): """ Reinstalls the manhole. Checks if the thread is running. If not, it starts it again. """ with _LOCK: if not (self.thread.is_alive() and self.thread in _ORIGINAL__ACTIVE): self.thread = self.thread.clone(bind_delay=self.reinstall_delay)...
python
def reinstall(self): """ Reinstalls the manhole. Checks if the thread is running. If not, it starts it again. """ with _LOCK: if not (self.thread.is_alive() and self.thread in _ORIGINAL__ACTIVE): self.thread = self.thread.clone(bind_delay=self.reinstall_delay)...
[ "def", "reinstall", "(", "self", ")", ":", "with", "_LOCK", ":", "if", "not", "(", "self", ".", "thread", ".", "is_alive", "(", ")", "and", "self", ".", "thread", "in", "_ORIGINAL__ACTIVE", ")", ":", "self", ".", "thread", "=", "self", ".", "thread",...
Reinstalls the manhole. Checks if the thread is running. If not, it starts it again.
[ "Reinstalls", "the", "manhole", ".", "Checks", "if", "the", "thread", "is", "running", ".", "If", "not", "it", "starts", "it", "again", "." ]
6a519a1f25142b047e814c6d00f4ef404856a15d
https://github.com/ionelmc/python-manhole/blob/6a519a1f25142b047e814c6d00f4ef404856a15d/src/manhole/__init__.py#L502-L510
train
ionelmc/python-manhole
src/manhole/__init__.py
Manhole.patched_forkpty
def patched_forkpty(self): """Fork a new process with a new pseudo-terminal as controlling tty.""" pid, master_fd = self.original_os_forkpty() if not pid: _LOG('Fork detected. Reinstalling Manhole.') self.reinstall() return pid, master_fd
python
def patched_forkpty(self): """Fork a new process with a new pseudo-terminal as controlling tty.""" pid, master_fd = self.original_os_forkpty() if not pid: _LOG('Fork detected. Reinstalling Manhole.') self.reinstall() return pid, master_fd
[ "def", "patched_forkpty", "(", "self", ")", ":", "pid", ",", "master_fd", "=", "self", ".", "original_os_forkpty", "(", ")", "if", "not", "pid", ":", "_LOG", "(", "'Fork detected. Reinstalling Manhole.'", ")", "self", ".", "reinstall", "(", ")", "return", "p...
Fork a new process with a new pseudo-terminal as controlling tty.
[ "Fork", "a", "new", "process", "with", "a", "new", "pseudo", "-", "terminal", "as", "controlling", "tty", "." ]
6a519a1f25142b047e814c6d00f4ef404856a15d
https://github.com/ionelmc/python-manhole/blob/6a519a1f25142b047e814c6d00f4ef404856a15d/src/manhole/__init__.py#L546-L552
train
ambitioninc/newrelic-api
newrelic_api/alert_conditions_nrql.py
AlertConditionsNRQL.update
def update( # noqa: C901 self, alert_condition_nrql_id, policy_id, name=None, threshold_type=None, query=None, since_value=None, terms=None, expected_groups=None, value_function=None, runbook_url=None, ignore_overlap=None, enabled=True): """ Updates any of the option...
python
def update( # noqa: C901 self, alert_condition_nrql_id, policy_id, name=None, threshold_type=None, query=None, since_value=None, terms=None, expected_groups=None, value_function=None, runbook_url=None, ignore_overlap=None, enabled=True): """ Updates any of the option...
[ "def", "update", "(", "self", ",", "alert_condition_nrql_id", ",", "policy_id", ",", "name", "=", "None", ",", "threshold_type", "=", "None", ",", "query", "=", "None", ",", "since_value", "=", "None", ",", "terms", "=", "None", ",", "expected_groups", "="...
Updates any of the optional parameters of the alert condition nrql :type alert_condition_nrql_id: int :param alert_condition_nrql_id: Alerts condition NRQL id to update :type policy_id: int :param policy_id: Alert policy id where target alert condition belongs to :type conditi...
[ "Updates", "any", "of", "the", "optional", "parameters", "of", "the", "alert", "condition", "nrql" ]
07b4430aa6ae61e4704e2928a6e7a24c76f0f424
https://github.com/ambitioninc/newrelic-api/blob/07b4430aa6ae61e4704e2928a6e7a24c76f0f424/newrelic_api/alert_conditions_nrql.py#L67-L224
train
ambitioninc/newrelic-api
newrelic_api/alert_conditions_nrql.py
AlertConditionsNRQL.create
def create( self, policy_id, name, threshold_type, query, since_value, terms, expected_groups=None, value_function=None, runbook_url=None, ignore_overlap=None, enabled=True): """ Creates an alert condition nrql :type policy_id: int :param policy_id: A...
python
def create( self, policy_id, name, threshold_type, query, since_value, terms, expected_groups=None, value_function=None, runbook_url=None, ignore_overlap=None, enabled=True): """ Creates an alert condition nrql :type policy_id: int :param policy_id: A...
[ "def", "create", "(", "self", ",", "policy_id", ",", "name", ",", "threshold_type", ",", "query", ",", "since_value", ",", "terms", ",", "expected_groups", "=", "None", ",", "value_function", "=", "None", ",", "runbook_url", "=", "None", ",", "ignore_overlap...
Creates an alert condition nrql :type policy_id: int :param policy_id: Alert policy id where target alert condition nrql belongs to :type name: str :param name: The name of the alert :type threshold_type: str :param type: The threshold_type of the condition, can be sta...
[ "Creates", "an", "alert", "condition", "nrql" ]
07b4430aa6ae61e4704e2928a6e7a24c76f0f424
https://github.com/ambitioninc/newrelic-api/blob/07b4430aa6ae61e4704e2928a6e7a24c76f0f424/newrelic_api/alert_conditions_nrql.py#L226-L350
train
ambitioninc/newrelic-api
newrelic_api/alert_conditions_nrql.py
AlertConditionsNRQL.delete
def delete(self, alert_condition_nrql_id): """ This API endpoint allows you to delete an alert condition nrql :type alert_condition_nrql_id: integer :param alert_condition_nrql_id: Alert Condition ID :rtype: dict :return: The JSON response of the API :: ...
python
def delete(self, alert_condition_nrql_id): """ This API endpoint allows you to delete an alert condition nrql :type alert_condition_nrql_id: integer :param alert_condition_nrql_id: Alert Condition ID :rtype: dict :return: The JSON response of the API :: ...
[ "def", "delete", "(", "self", ",", "alert_condition_nrql_id", ")", ":", "return", "self", ".", "_delete", "(", "url", "=", "'{0}alerts_nrql_conditions/{1}.json'", ".", "format", "(", "self", ".", "URL", ",", "alert_condition_nrql_id", ")", ",", "headers", "=", ...
This API endpoint allows you to delete an alert condition nrql :type alert_condition_nrql_id: integer :param alert_condition_nrql_id: Alert Condition ID :rtype: dict :return: The JSON response of the API :: { "nrql_condition": { "type": "str...
[ "This", "API", "endpoint", "allows", "you", "to", "delete", "an", "alert", "condition", "nrql" ]
07b4430aa6ae61e4704e2928a6e7a24c76f0f424
https://github.com/ambitioninc/newrelic-api/blob/07b4430aa6ae61e4704e2928a6e7a24c76f0f424/newrelic_api/alert_conditions_nrql.py#L352-L394
train
ambitioninc/newrelic-api
newrelic_api/servers.py
Servers.list
def list(self, filter_name=None, filter_ids=None, filter_labels=None, page=None): """ This API endpoint returns a paginated list of the Servers associated with your New Relic account. Servers can be filtered by their name or by a list of server IDs. :type filter_name: str ...
python
def list(self, filter_name=None, filter_ids=None, filter_labels=None, page=None): """ This API endpoint returns a paginated list of the Servers associated with your New Relic account. Servers can be filtered by their name or by a list of server IDs. :type filter_name: str ...
[ "def", "list", "(", "self", ",", "filter_name", "=", "None", ",", "filter_ids", "=", "None", ",", "filter_labels", "=", "None", ",", "page", "=", "None", ")", ":", "label_param", "=", "''", "if", "filter_labels", ":", "label_param", "=", "';'", ".", "j...
This API endpoint returns a paginated list of the Servers associated with your New Relic account. Servers can be filtered by their name or by a list of server IDs. :type filter_name: str :param filter_name: Filter by server name :type filter_ids: list of ints :param fil...
[ "This", "API", "endpoint", "returns", "a", "paginated", "list", "of", "the", "Servers", "associated", "with", "your", "New", "Relic", "account", ".", "Servers", "can", "be", "filtered", "by", "their", "name", "or", "by", "a", "list", "of", "server", "IDs",...
07b4430aa6ae61e4704e2928a6e7a24c76f0f424
https://github.com/ambitioninc/newrelic-api/blob/07b4430aa6ae61e4704e2928a6e7a24c76f0f424/newrelic_api/servers.py#L8-L82
train
ambitioninc/newrelic-api
newrelic_api/servers.py
Servers.update
def update(self, id, name=None): """ Updates any of the optional parameters of the server :type id: int :param id: Server ID :type name: str :param name: The name of the server :rtype: dict :return: The JSON response of the API :: ...
python
def update(self, id, name=None): """ Updates any of the optional parameters of the server :type id: int :param id: Server ID :type name: str :param name: The name of the server :rtype: dict :return: The JSON response of the API :: ...
[ "def", "update", "(", "self", ",", "id", ",", "name", "=", "None", ")", ":", "nr_data", "=", "self", ".", "show", "(", "id", ")", "[", "'server'", "]", "data", "=", "{", "'server'", ":", "{", "'name'", ":", "name", "or", "nr_data", "[", "'name'",...
Updates any of the optional parameters of the server :type id: int :param id: Server ID :type name: str :param name: The name of the server :rtype: dict :return: The JSON response of the API :: { "server": { "id...
[ "Updates", "any", "of", "the", "optional", "parameters", "of", "the", "server" ]
07b4430aa6ae61e4704e2928a6e7a24c76f0f424
https://github.com/ambitioninc/newrelic-api/blob/07b4430aa6ae61e4704e2928a6e7a24c76f0f424/newrelic_api/servers.py#L123-L172
train
ambitioninc/newrelic-api
newrelic_api/alert_policies.py
AlertPolicies.create
def create(self, name, incident_preference): """ This API endpoint allows you to create an alert policy :type name: str :param name: The name of the policy :type incident_preference: str :param incident_preference: Can be PER_POLICY, PER_CONDITION or PER_CON...
python
def create(self, name, incident_preference): """ This API endpoint allows you to create an alert policy :type name: str :param name: The name of the policy :type incident_preference: str :param incident_preference: Can be PER_POLICY, PER_CONDITION or PER_CON...
[ "def", "create", "(", "self", ",", "name", ",", "incident_preference", ")", ":", "data", "=", "{", "\"policy\"", ":", "{", "\"name\"", ":", "name", ",", "\"incident_preference\"", ":", "incident_preference", "}", "}", "return", "self", ".", "_post", "(", "...
This API endpoint allows you to create an alert policy :type name: str :param name: The name of the policy :type incident_preference: str :param incident_preference: Can be PER_POLICY, PER_CONDITION or PER_CONDITION_AND_TARGET :rtype: dict :return: The JSON...
[ "This", "API", "endpoint", "allows", "you", "to", "create", "an", "alert", "policy" ]
07b4430aa6ae61e4704e2928a6e7a24c76f0f424
https://github.com/ambitioninc/newrelic-api/blob/07b4430aa6ae61e4704e2928a6e7a24c76f0f424/newrelic_api/alert_policies.py#L49-L88
train
ambitioninc/newrelic-api
newrelic_api/alert_policies.py
AlertPolicies.update
def update(self, id, name, incident_preference): """ This API endpoint allows you to update an alert policy :type id: integer :param id: The id of the policy :type name: str :param name: The name of the policy :type incident_preference: str :param incid...
python
def update(self, id, name, incident_preference): """ This API endpoint allows you to update an alert policy :type id: integer :param id: The id of the policy :type name: str :param name: The name of the policy :type incident_preference: str :param incid...
[ "def", "update", "(", "self", ",", "id", ",", "name", ",", "incident_preference", ")", ":", "data", "=", "{", "\"policy\"", ":", "{", "\"name\"", ":", "name", ",", "\"incident_preference\"", ":", "incident_preference", "}", "}", "return", "self", ".", "_pu...
This API endpoint allows you to update an alert policy :type id: integer :param id: The id of the policy :type name: str :param name: The name of the policy :type incident_preference: str :param incident_preference: Can be PER_POLICY, PER_CONDITION or PER_C...
[ "This", "API", "endpoint", "allows", "you", "to", "update", "an", "alert", "policy" ]
07b4430aa6ae61e4704e2928a6e7a24c76f0f424
https://github.com/ambitioninc/newrelic-api/blob/07b4430aa6ae61e4704e2928a6e7a24c76f0f424/newrelic_api/alert_policies.py#L90-L132
train
ambitioninc/newrelic-api
newrelic_api/alert_policies.py
AlertPolicies.delete
def delete(self, id): """ This API endpoint allows you to delete an alert policy :type id: integer :param id: The id of the policy :rtype: dict :return: The JSON response of the API :: { "policy": { "created_at":...
python
def delete(self, id): """ This API endpoint allows you to delete an alert policy :type id: integer :param id: The id of the policy :rtype: dict :return: The JSON response of the API :: { "policy": { "created_at":...
[ "def", "delete", "(", "self", ",", "id", ")", ":", "return", "self", ".", "_delete", "(", "url", "=", "'{0}alerts_policies/{1}.json'", ".", "format", "(", "self", ".", "URL", ",", "id", ")", ",", "headers", "=", "self", ".", "headers", ")" ]
This API endpoint allows you to delete an alert policy :type id: integer :param id: The id of the policy :rtype: dict :return: The JSON response of the API :: { "policy": { "created_at": "time", "id": "intege...
[ "This", "API", "endpoint", "allows", "you", "to", "delete", "an", "alert", "policy" ]
07b4430aa6ae61e4704e2928a6e7a24c76f0f424
https://github.com/ambitioninc/newrelic-api/blob/07b4430aa6ae61e4704e2928a6e7a24c76f0f424/newrelic_api/alert_policies.py#L134-L161
train
ambitioninc/newrelic-api
newrelic_api/alert_policies.py
AlertPolicies.associate_with_notification_channel
def associate_with_notification_channel(self, id, channel_id): """ This API endpoint allows you to associate an alert policy with an notification channel :type id: integer :param id: The id of the policy :type channel_id: integer :param channel_id: The id of...
python
def associate_with_notification_channel(self, id, channel_id): """ This API endpoint allows you to associate an alert policy with an notification channel :type id: integer :param id: The id of the policy :type channel_id: integer :param channel_id: The id of...
[ "def", "associate_with_notification_channel", "(", "self", ",", "id", ",", "channel_id", ")", ":", "return", "self", ".", "_put", "(", "url", "=", "'{0}alerts_policy_channels.json?policy_id={1}&channel_ids={2}'", ".", "format", "(", "self", ".", "URL", ",", "id", ...
This API endpoint allows you to associate an alert policy with an notification channel :type id: integer :param id: The id of the policy :type channel_id: integer :param channel_id: The id of the notification channel :rtype: dict :return: The JSON response ...
[ "This", "API", "endpoint", "allows", "you", "to", "associate", "an", "alert", "policy", "with", "an", "notification", "channel" ]
07b4430aa6ae61e4704e2928a6e7a24c76f0f424
https://github.com/ambitioninc/newrelic-api/blob/07b4430aa6ae61e4704e2928a6e7a24c76f0f424/newrelic_api/alert_policies.py#L163-L195
train
ambitioninc/newrelic-api
newrelic_api/alert_policies.py
AlertPolicies.dissociate_from_notification_channel
def dissociate_from_notification_channel(self, id, channel_id): """ This API endpoint allows you to dissociate an alert policy from an notification channel :type id: integer :param id: The id of the policy :type channel_id: integer :param channel_id: The id ...
python
def dissociate_from_notification_channel(self, id, channel_id): """ This API endpoint allows you to dissociate an alert policy from an notification channel :type id: integer :param id: The id of the policy :type channel_id: integer :param channel_id: The id ...
[ "def", "dissociate_from_notification_channel", "(", "self", ",", "id", ",", "channel_id", ")", ":", "return", "self", ".", "_delete", "(", "url", "=", "'{0}alerts_policy_channels.json?policy_id={1}&channel_id={2}'", ".", "format", "(", "self", ".", "URL", ",", "id",...
This API endpoint allows you to dissociate an alert policy from an notification channel :type id: integer :param id: The id of the policy :type channel_id: integer :param channel_id: The id of the notification channel :rtype: dict :return: The JSON response...
[ "This", "API", "endpoint", "allows", "you", "to", "dissociate", "an", "alert", "policy", "from", "an", "notification", "channel" ]
07b4430aa6ae61e4704e2928a6e7a24c76f0f424
https://github.com/ambitioninc/newrelic-api/blob/07b4430aa6ae61e4704e2928a6e7a24c76f0f424/newrelic_api/alert_policies.py#L197-L234
train
ambitioninc/newrelic-api
newrelic_api/alert_conditions.py
AlertConditions.list
def list(self, policy_id, page=None): """ This API endpoint returns a paginated list of alert conditions associated with the given policy_id. This API endpoint returns a paginated list of the alert conditions associated with your New Relic account. Alert conditions can be filter...
python
def list(self, policy_id, page=None): """ This API endpoint returns a paginated list of alert conditions associated with the given policy_id. This API endpoint returns a paginated list of the alert conditions associated with your New Relic account. Alert conditions can be filter...
[ "def", "list", "(", "self", ",", "policy_id", ",", "page", "=", "None", ")", ":", "filters", "=", "[", "'policy_id={0}'", ".", "format", "(", "policy_id", ")", ",", "'page={0}'", ".", "format", "(", "page", ")", "if", "page", "else", "None", "]", "re...
This API endpoint returns a paginated list of alert conditions associated with the given policy_id. This API endpoint returns a paginated list of the alert conditions associated with your New Relic account. Alert conditions can be filtered by their name, list of IDs, type (application, ...
[ "This", "API", "endpoint", "returns", "a", "paginated", "list", "of", "alert", "conditions", "associated", "with", "the", "given", "policy_id", "." ]
07b4430aa6ae61e4704e2928a6e7a24c76f0f424
https://github.com/ambitioninc/newrelic-api/blob/07b4430aa6ae61e4704e2928a6e7a24c76f0f424/newrelic_api/alert_conditions.py#L9-L72
train
ambitioninc/newrelic-api
newrelic_api/alert_conditions.py
AlertConditions.update
def update( self, alert_condition_id, policy_id, type=None, condition_scope=None, name=None, entities=None, metric=None, runbook_url=None, terms=None, user_defined=None, enabled=None): """ ...
python
def update( self, alert_condition_id, policy_id, type=None, condition_scope=None, name=None, entities=None, metric=None, runbook_url=None, terms=None, user_defined=None, enabled=None): """ ...
[ "def", "update", "(", "self", ",", "alert_condition_id", ",", "policy_id", ",", "type", "=", "None", ",", "condition_scope", "=", "None", ",", "name", "=", "None", ",", "entities", "=", "None", ",", "metric", "=", "None", ",", "runbook_url", "=", "None",...
Updates any of the optional parameters of the alert condition :type alert_condition_id: int :param alert_condition_id: Alerts condition id to update :type policy_id: int :param policy_id: Alert policy id where target alert condition belongs to :type type: str :param ty...
[ "Updates", "any", "of", "the", "optional", "parameters", "of", "the", "alert", "condition" ]
07b4430aa6ae61e4704e2928a6e7a24c76f0f424
https://github.com/ambitioninc/newrelic-api/blob/07b4430aa6ae61e4704e2928a6e7a24c76f0f424/newrelic_api/alert_conditions.py#L74-L207
train
ambitioninc/newrelic-api
newrelic_api/alert_conditions.py
AlertConditions.create
def create( self, policy_id, type, condition_scope, name, entities, metric, terms, runbook_url=None, user_defined=None, enabled=True): """ Creates an alert condition :type pol...
python
def create( self, policy_id, type, condition_scope, name, entities, metric, terms, runbook_url=None, user_defined=None, enabled=True): """ Creates an alert condition :type pol...
[ "def", "create", "(", "self", ",", "policy_id", ",", "type", ",", "condition_scope", ",", "name", ",", "entities", ",", "metric", ",", "terms", ",", "runbook_url", "=", "None", ",", "user_defined", "=", "None", ",", "enabled", "=", "True", ")", ":", "d...
Creates an alert condition :type policy_id: int :param policy_id: Alert policy id where target alert condition belongs to :type type: str :param type: The type of the condition, can be apm_app_metric, apm_kt_metric, servers_metric, browser_metric, mobile_metric :ty...
[ "Creates", "an", "alert", "condition" ]
07b4430aa6ae61e4704e2928a6e7a24c76f0f424
https://github.com/ambitioninc/newrelic-api/blob/07b4430aa6ae61e4704e2928a6e7a24c76f0f424/newrelic_api/alert_conditions.py#L209-L315
train
ambitioninc/newrelic-api
newrelic_api/alert_conditions.py
AlertConditions.delete
def delete(self, alert_condition_id): """ This API endpoint allows you to delete an alert condition :type alert_condition_id: integer :param alert_condition_id: Alert Condition ID :rtype: dict :return: The JSON response of the API :: { ...
python
def delete(self, alert_condition_id): """ This API endpoint allows you to delete an alert condition :type alert_condition_id: integer :param alert_condition_id: Alert Condition ID :rtype: dict :return: The JSON response of the API :: { ...
[ "def", "delete", "(", "self", ",", "alert_condition_id", ")", ":", "return", "self", ".", "_delete", "(", "url", "=", "'{0}alerts_conditions/{1}.json'", ".", "format", "(", "self", ".", "URL", ",", "alert_condition_id", ")", ",", "headers", "=", "self", ".",...
This API endpoint allows you to delete an alert condition :type alert_condition_id: integer :param alert_condition_id: Alert Condition ID :rtype: dict :return: The JSON response of the API :: { "condition": { "id": "integer", ...
[ "This", "API", "endpoint", "allows", "you", "to", "delete", "an", "alert", "condition" ]
07b4430aa6ae61e4704e2928a6e7a24c76f0f424
https://github.com/ambitioninc/newrelic-api/blob/07b4430aa6ae61e4704e2928a6e7a24c76f0f424/newrelic_api/alert_conditions.py#L317-L362
train
ambitioninc/newrelic-api
newrelic_api/alert_conditions_infra.py
AlertConditionsInfra.list
def list(self, policy_id, limit=None, offset=None): """ This API endpoint returns a paginated list of alert conditions for infrastucture metrics associated with the given policy_id. :type policy_id: int :param policy_id: Alert policy id :type limit: string :para...
python
def list(self, policy_id, limit=None, offset=None): """ This API endpoint returns a paginated list of alert conditions for infrastucture metrics associated with the given policy_id. :type policy_id: int :param policy_id: Alert policy id :type limit: string :para...
[ "def", "list", "(", "self", ",", "policy_id", ",", "limit", "=", "None", ",", "offset", "=", "None", ")", ":", "filters", "=", "[", "'policy_id={0}'", ".", "format", "(", "policy_id", ")", ",", "'limit={0}'", ".", "format", "(", "limit", ")", "if", "...
This API endpoint returns a paginated list of alert conditions for infrastucture metrics associated with the given policy_id. :type policy_id: int :param policy_id: Alert policy id :type limit: string :param limit: Max amount of results to return :type offset: string ...
[ "This", "API", "endpoint", "returns", "a", "paginated", "list", "of", "alert", "conditions", "for", "infrastucture", "metrics", "associated", "with", "the", "given", "policy_id", "." ]
07b4430aa6ae61e4704e2928a6e7a24c76f0f424
https://github.com/ambitioninc/newrelic-api/blob/07b4430aa6ae61e4704e2928a6e7a24c76f0f424/newrelic_api/alert_conditions_infra.py#L13-L69
train
ambitioninc/newrelic-api
newrelic_api/alert_conditions_infra.py
AlertConditionsInfra.show
def show(self, alert_condition_infra_id): """ This API endpoint returns an alert condition for infrastucture, identified by its ID. :type alert_condition_infra_id: int :param alert_condition_infra_id: Alert Condition Infra ID :rtype: dict :return: The JSON respo...
python
def show(self, alert_condition_infra_id): """ This API endpoint returns an alert condition for infrastucture, identified by its ID. :type alert_condition_infra_id: int :param alert_condition_infra_id: Alert Condition Infra ID :rtype: dict :return: The JSON respo...
[ "def", "show", "(", "self", ",", "alert_condition_infra_id", ")", ":", "return", "self", ".", "_get", "(", "url", "=", "'{0}alerts/conditions/{1}'", ".", "format", "(", "self", ".", "URL", ",", "alert_condition_infra_id", ")", ",", "headers", "=", "self", "....
This API endpoint returns an alert condition for infrastucture, identified by its ID. :type alert_condition_infra_id: int :param alert_condition_infra_id: Alert Condition Infra ID :rtype: dict :return: The JSON response of the API :: { "dat...
[ "This", "API", "endpoint", "returns", "an", "alert", "condition", "for", "infrastucture", "identified", "by", "its", "ID", "." ]
07b4430aa6ae61e4704e2928a6e7a24c76f0f424
https://github.com/ambitioninc/newrelic-api/blob/07b4430aa6ae61e4704e2928a6e7a24c76f0f424/newrelic_api/alert_conditions_infra.py#L71-L106
train
ambitioninc/newrelic-api
newrelic_api/alert_conditions_infra.py
AlertConditionsInfra.create
def create(self, policy_id, name, condition_type, alert_condition_configuration, enabled=True): """ This API endpoint allows you to create an alert condition for infrastucture :type policy_id: int :param policy_id: Alert policy id :type name: str :param name: The name o...
python
def create(self, policy_id, name, condition_type, alert_condition_configuration, enabled=True): """ This API endpoint allows you to create an alert condition for infrastucture :type policy_id: int :param policy_id: Alert policy id :type name: str :param name: The name o...
[ "def", "create", "(", "self", ",", "policy_id", ",", "name", ",", "condition_type", ",", "alert_condition_configuration", ",", "enabled", "=", "True", ")", ":", "data", "=", "{", "\"data\"", ":", "alert_condition_configuration", "}", "data", "[", "'data'", "]"...
This API endpoint allows you to create an alert condition for infrastucture :type policy_id: int :param policy_id: Alert policy id :type name: str :param name: The name of the alert condition :type condition_type: str :param condition_type: The type of the alert condit...
[ "This", "API", "endpoint", "allows", "you", "to", "create", "an", "alert", "condition", "for", "infrastucture" ]
07b4430aa6ae61e4704e2928a6e7a24c76f0f424
https://github.com/ambitioninc/newrelic-api/blob/07b4430aa6ae61e4704e2928a6e7a24c76f0f424/newrelic_api/alert_conditions_infra.py#L108-L166
train
ambitioninc/newrelic-api
newrelic_api/alert_conditions_infra.py
AlertConditionsInfra.update
def update(self, alert_condition_infra_id, policy_id, name, condition_type, alert_condition_configuration, enabled=True): """ This API endpoint allows you to update an alert condition for infrastucture :type alert_condition_infra_id: int :param alert_condition_infra_id: A...
python
def update(self, alert_condition_infra_id, policy_id, name, condition_type, alert_condition_configuration, enabled=True): """ This API endpoint allows you to update an alert condition for infrastucture :type alert_condition_infra_id: int :param alert_condition_infra_id: A...
[ "def", "update", "(", "self", ",", "alert_condition_infra_id", ",", "policy_id", ",", "name", ",", "condition_type", ",", "alert_condition_configuration", ",", "enabled", "=", "True", ")", ":", "data", "=", "{", "\"data\"", ":", "alert_condition_configuration", "}...
This API endpoint allows you to update an alert condition for infrastucture :type alert_condition_infra_id: int :param alert_condition_infra_id: Alert Condition Infra ID :type policy_id: int :param policy_id: Alert policy id :type name: str :param name: The name of the...
[ "This", "API", "endpoint", "allows", "you", "to", "update", "an", "alert", "condition", "for", "infrastucture" ]
07b4430aa6ae61e4704e2928a6e7a24c76f0f424
https://github.com/ambitioninc/newrelic-api/blob/07b4430aa6ae61e4704e2928a6e7a24c76f0f424/newrelic_api/alert_conditions_infra.py#L168-L230
train
ambitioninc/newrelic-api
newrelic_api/alert_conditions_infra.py
AlertConditionsInfra.delete
def delete(self, alert_condition_infra_id): """ This API endpoint allows you to delete an alert condition for infrastucture :type alert_condition_infra_id: integer :param alert_condition_infra_id: Alert Condition Infra ID :rtype: dict :return: The JSON response of the A...
python
def delete(self, alert_condition_infra_id): """ This API endpoint allows you to delete an alert condition for infrastucture :type alert_condition_infra_id: integer :param alert_condition_infra_id: Alert Condition Infra ID :rtype: dict :return: The JSON response of the A...
[ "def", "delete", "(", "self", ",", "alert_condition_infra_id", ")", ":", "return", "self", ".", "_delete", "(", "url", "=", "'{0}alerts/conditions/{1}'", ".", "format", "(", "self", ".", "URL", ",", "alert_condition_infra_id", ")", ",", "headers", "=", "self",...
This API endpoint allows you to delete an alert condition for infrastucture :type alert_condition_infra_id: integer :param alert_condition_infra_id: Alert Condition Infra ID :rtype: dict :return: The JSON response of the API :: {}
[ "This", "API", "endpoint", "allows", "you", "to", "delete", "an", "alert", "condition", "for", "infrastucture" ]
07b4430aa6ae61e4704e2928a6e7a24c76f0f424
https://github.com/ambitioninc/newrelic-api/blob/07b4430aa6ae61e4704e2928a6e7a24c76f0f424/newrelic_api/alert_conditions_infra.py#L232-L251
train
ambitioninc/newrelic-api
newrelic_api/labels.py
Labels.create
def create(self, name, category, applications=None, servers=None): """ This API endpoint will create a new label with the provided name and category :type name: str :param name: The name of the label :type category: str :param category: The Category :ty...
python
def create(self, name, category, applications=None, servers=None): """ This API endpoint will create a new label with the provided name and category :type name: str :param name: The name of the label :type category: str :param category: The Category :ty...
[ "def", "create", "(", "self", ",", "name", ",", "category", ",", "applications", "=", "None", ",", "servers", "=", "None", ")", ":", "data", "=", "{", "\"label\"", ":", "{", "\"category\"", ":", "category", ",", "\"name\"", ":", "name", ",", "\"links\"...
This API endpoint will create a new label with the provided name and category :type name: str :param name: The name of the label :type category: str :param category: The Category :type applications: list of int :param applications: An optional list of applicati...
[ "This", "API", "endpoint", "will", "create", "a", "new", "label", "with", "the", "provided", "name", "and", "category" ]
07b4430aa6ae61e4704e2928a6e7a24c76f0f424
https://github.com/ambitioninc/newrelic-api/blob/07b4430aa6ae61e4704e2928a6e7a24c76f0f424/newrelic_api/labels.py#L62-L117
train
ambitioninc/newrelic-api
newrelic_api/labels.py
Labels.delete
def delete(self, key): """ When applications are provided, this endpoint will remove those applications from the label. When no applications are provided, this endpoint will remove the label. :type key: str :param key: Label key. Example: 'Language:Java' :rtype...
python
def delete(self, key): """ When applications are provided, this endpoint will remove those applications from the label. When no applications are provided, this endpoint will remove the label. :type key: str :param key: Label key. Example: 'Language:Java' :rtype...
[ "def", "delete", "(", "self", ",", "key", ")", ":", "return", "self", ".", "_delete", "(", "url", "=", "'{url}labels/labels/{key}.json'", ".", "format", "(", "url", "=", "self", ".", "URL", ",", "key", "=", "key", ")", ",", "headers", "=", "self", "....
When applications are provided, this endpoint will remove those applications from the label. When no applications are provided, this endpoint will remove the label. :type key: str :param key: Label key. Example: 'Language:Java' :rtype: dict :return: The JSON response o...
[ "When", "applications", "are", "provided", "this", "endpoint", "will", "remove", "those", "applications", "from", "the", "label", "." ]
07b4430aa6ae61e4704e2928a6e7a24c76f0f424
https://github.com/ambitioninc/newrelic-api/blob/07b4430aa6ae61e4704e2928a6e7a24c76f0f424/newrelic_api/labels.py#L119-L156
train
ambitioninc/newrelic-api
newrelic_api/plugins.py
Plugins.list
def list(self, filter_guid=None, filter_ids=None, detailed=None, page=None): """ This API endpoint returns a paginated list of the plugins associated with your New Relic account. Plugins can be filtered by their name or by a list of IDs. :type filter_guid: str :param fi...
python
def list(self, filter_guid=None, filter_ids=None, detailed=None, page=None): """ This API endpoint returns a paginated list of the plugins associated with your New Relic account. Plugins can be filtered by their name or by a list of IDs. :type filter_guid: str :param fi...
[ "def", "list", "(", "self", ",", "filter_guid", "=", "None", ",", "filter_ids", "=", "None", ",", "detailed", "=", "None", ",", "page", "=", "None", ")", ":", "filters", "=", "[", "'filter[guid]={0}'", ".", "format", "(", "filter_guid", ")", "if", "fil...
This API endpoint returns a paginated list of the plugins associated with your New Relic account. Plugins can be filtered by their name or by a list of IDs. :type filter_guid: str :param filter_guid: Filter by name :type filter_ids: list of ints :param filter_ids: Filt...
[ "This", "API", "endpoint", "returns", "a", "paginated", "list", "of", "the", "plugins", "associated", "with", "your", "New", "Relic", "account", "." ]
07b4430aa6ae61e4704e2928a6e7a24c76f0f424
https://github.com/ambitioninc/newrelic-api/blob/07b4430aa6ae61e4704e2928a6e7a24c76f0f424/newrelic_api/plugins.py#L8-L100
train
ambitioninc/newrelic-api
newrelic_api/application_instances.py
ApplicationInstances.list
def list( self, application_id, filter_hostname=None, filter_ids=None, page=None): """ This API endpoint returns a paginated list of instances associated with the given application. Application instances can be filtered by hostname, or the list of applica...
python
def list( self, application_id, filter_hostname=None, filter_ids=None, page=None): """ This API endpoint returns a paginated list of instances associated with the given application. Application instances can be filtered by hostname, or the list of applica...
[ "def", "list", "(", "self", ",", "application_id", ",", "filter_hostname", "=", "None", ",", "filter_ids", "=", "None", ",", "page", "=", "None", ")", ":", "filters", "=", "[", "'filter[hostname]={0}'", ".", "format", "(", "filter_hostname", ")", "if", "fi...
This API endpoint returns a paginated list of instances associated with the given application. Application instances can be filtered by hostname, or the list of application instance IDs. :type application_id: int :param application_id: Application ID :type filter_hostn...
[ "This", "API", "endpoint", "returns", "a", "paginated", "list", "of", "instances", "associated", "with", "the", "given", "application", "." ]
07b4430aa6ae61e4704e2928a6e7a24c76f0f424
https://github.com/ambitioninc/newrelic-api/blob/07b4430aa6ae61e4704e2928a6e7a24c76f0f424/newrelic_api/application_instances.py#L8-L88
train
ambitioninc/newrelic-api
newrelic_api/application_hosts.py
ApplicationHosts.show
def show(self, application_id, host_id): """ This API endpoint returns a single application host, identified by its ID. :type application_id: int :param application_id: Application ID :type host_id: int :param host_id: Application host ID :rtype: dict ...
python
def show(self, application_id, host_id): """ This API endpoint returns a single application host, identified by its ID. :type application_id: int :param application_id: Application ID :type host_id: int :param host_id: Application host ID :rtype: dict ...
[ "def", "show", "(", "self", ",", "application_id", ",", "host_id", ")", ":", "return", "self", ".", "_get", "(", "url", "=", "'{root}applications/{application_id}/hosts/{host_id}.json'", ".", "format", "(", "root", "=", "self", ".", "URL", ",", "application_id",...
This API endpoint returns a single application host, identified by its ID. :type application_id: int :param application_id: Application ID :type host_id: int :param host_id: Application host ID :rtype: dict :return: The JSON response of the API :: ...
[ "This", "API", "endpoint", "returns", "a", "single", "application", "host", "identified", "by", "its", "ID", "." ]
07b4430aa6ae61e4704e2928a6e7a24c76f0f424
https://github.com/ambitioninc/newrelic-api/blob/07b4430aa6ae61e4704e2928a6e7a24c76f0f424/newrelic_api/application_hosts.py#L91-L143
train
ambitioninc/newrelic-api
newrelic_api/components.py
Components.metric_data
def metric_data( self, id, names, values=None, from_dt=None, to_dt=None, summarize=False): """ This API endpoint returns a list of values for each of the requested metrics. The list of available metrics can be returned using the Metric Name API endpoint. ...
python
def metric_data( self, id, names, values=None, from_dt=None, to_dt=None, summarize=False): """ This API endpoint returns a list of values for each of the requested metrics. The list of available metrics can be returned using the Metric Name API endpoint. ...
[ "def", "metric_data", "(", "self", ",", "id", ",", "names", ",", "values", "=", "None", ",", "from_dt", "=", "None", ",", "to_dt", "=", "None", ",", "summarize", "=", "False", ")", ":", "params", "=", "[", "'from={0}'", ".", "format", "(", "from_dt",...
This API endpoint returns a list of values for each of the requested metrics. The list of available metrics can be returned using the Metric Name API endpoint. Metric data can be filtered by a number of parameters, including multiple names and values, and by time range. Metric names and...
[ "This", "API", "endpoint", "returns", "a", "list", "of", "values", "for", "each", "of", "the", "requested", "metrics", ".", "The", "list", "of", "available", "metrics", "can", "be", "returned", "using", "the", "Metric", "Name", "API", "endpoint", "." ]
07b4430aa6ae61e4704e2928a6e7a24c76f0f424
https://github.com/ambitioninc/newrelic-api/blob/07b4430aa6ae61e4704e2928a6e7a24c76f0f424/newrelic_api/components.py#L176-L251
train
ambitioninc/newrelic-api
newrelic_api/dashboards.py
Dashboards.create
def create(self, dashboard_data): """ This API endpoint creates a dashboard and all defined widgets. :type dashboard: dict :param dashboard: Dashboard Dictionary :rtype dict :return: The JSON response of the API :: { "dashboard": { ...
python
def create(self, dashboard_data): """ This API endpoint creates a dashboard and all defined widgets. :type dashboard: dict :param dashboard: Dashboard Dictionary :rtype dict :return: The JSON response of the API :: { "dashboard": { ...
[ "def", "create", "(", "self", ",", "dashboard_data", ")", ":", "return", "self", ".", "_post", "(", "url", "=", "'{0}dashboards.json'", ".", "format", "(", "self", ".", "URL", ")", ",", "headers", "=", "self", ".", "headers", ",", "data", "=", "dashboa...
This API endpoint creates a dashboard and all defined widgets. :type dashboard: dict :param dashboard: Dashboard Dictionary :rtype dict :return: The JSON response of the API :: { "dashboard": { "id": "integer", ...
[ "This", "API", "endpoint", "creates", "a", "dashboard", "and", "all", "defined", "widgets", "." ]
07b4430aa6ae61e4704e2928a6e7a24c76f0f424
https://github.com/ambitioninc/newrelic-api/blob/07b4430aa6ae61e4704e2928a6e7a24c76f0f424/newrelic_api/dashboards.py#L151-L209
train
ambitioninc/newrelic-api
newrelic_api/dashboards.py
Dashboards.update
def update(self, id, dashboard_data): """ This API endpoint updates a dashboard and all defined widgets. :type id: int :param id: Dashboard ID :type dashboard: dict :param dashboard: Dashboard Dictionary :rtype dict :return: The JSON response of the API...
python
def update(self, id, dashboard_data): """ This API endpoint updates a dashboard and all defined widgets. :type id: int :param id: Dashboard ID :type dashboard: dict :param dashboard: Dashboard Dictionary :rtype dict :return: The JSON response of the API...
[ "def", "update", "(", "self", ",", "id", ",", "dashboard_data", ")", ":", "return", "self", ".", "_put", "(", "url", "=", "'{0}dashboards/{1}.json'", ".", "format", "(", "self", ".", "URL", ",", "id", ")", ",", "headers", "=", "self", ".", "headers", ...
This API endpoint updates a dashboard and all defined widgets. :type id: int :param id: Dashboard ID :type dashboard: dict :param dashboard: Dashboard Dictionary :rtype dict :return: The JSON response of the API :: { "dashboard": { ...
[ "This", "API", "endpoint", "updates", "a", "dashboard", "and", "all", "defined", "widgets", "." ]
07b4430aa6ae61e4704e2928a6e7a24c76f0f424
https://github.com/ambitioninc/newrelic-api/blob/07b4430aa6ae61e4704e2928a6e7a24c76f0f424/newrelic_api/dashboards.py#L211-L272
train
borntyping/python-dice
dice/grammar.py
operatorPrecedence
def operatorPrecedence(base, operators): """ This re-implements pyparsing's operatorPrecedence function. It gets rid of a few annoying bugs, like always putting operators inside a Group, and matching the whole grammar with Forward first (there may actually be a reason for that, but I couldn't find ...
python
def operatorPrecedence(base, operators): """ This re-implements pyparsing's operatorPrecedence function. It gets rid of a few annoying bugs, like always putting operators inside a Group, and matching the whole grammar with Forward first (there may actually be a reason for that, but I couldn't find ...
[ "def", "operatorPrecedence", "(", "base", ",", "operators", ")", ":", "expression", "=", "Forward", "(", ")", "last", "=", "base", "|", "Suppress", "(", "'('", ")", "+", "expression", "+", "Suppress", "(", "')'", ")", "def", "parse_operator", "(", "expr"...
This re-implements pyparsing's operatorPrecedence function. It gets rid of a few annoying bugs, like always putting operators inside a Group, and matching the whole grammar with Forward first (there may actually be a reason for that, but I couldn't find it). It doesn't support trinary expressions, but ...
[ "This", "re", "-", "implements", "pyparsing", "s", "operatorPrecedence", "function", "." ]
88398c77534ebec19f1f18478e475d0b7a5bc717
https://github.com/borntyping/python-dice/blob/88398c77534ebec19f1f18478e475d0b7a5bc717/dice/grammar.py#L25-L83
train
borntyping/python-dice
dice/elements.py
Element.set_parse_attributes
def set_parse_attributes(self, string, location, tokens): "Fluent API for setting parsed location" self.string = string self.location = location self.tokens = tokens return self
python
def set_parse_attributes(self, string, location, tokens): "Fluent API for setting parsed location" self.string = string self.location = location self.tokens = tokens return self
[ "def", "set_parse_attributes", "(", "self", ",", "string", ",", "location", ",", "tokens", ")", ":", "\"Fluent API for setting parsed location\"", "self", ".", "string", "=", "string", "self", ".", "location", "=", "location", "self", ".", "tokens", "=", "tokens...
Fluent API for setting parsed location
[ "Fluent", "API", "for", "setting", "parsed", "location" ]
88398c77534ebec19f1f18478e475d0b7a5bc717
https://github.com/borntyping/python-dice/blob/88398c77534ebec19f1f18478e475d0b7a5bc717/dice/elements.py#L26-L31
train
borntyping/python-dice
dice/elements.py
Element.evaluate_object
def evaluate_object(obj, cls=None, cache=False, **kwargs): """Evaluates elements, and coerces objects to a class if needed""" old_obj = obj if isinstance(obj, Element): if cache: obj = obj.evaluate_cached(**kwargs) else: obj = obj.evaluate(...
python
def evaluate_object(obj, cls=None, cache=False, **kwargs): """Evaluates elements, and coerces objects to a class if needed""" old_obj = obj if isinstance(obj, Element): if cache: obj = obj.evaluate_cached(**kwargs) else: obj = obj.evaluate(...
[ "def", "evaluate_object", "(", "obj", ",", "cls", "=", "None", ",", "cache", "=", "False", ",", "**", "kwargs", ")", ":", "old_obj", "=", "obj", "if", "isinstance", "(", "obj", ",", "Element", ")", ":", "if", "cache", ":", "obj", "=", "obj", ".", ...
Evaluates elements, and coerces objects to a class if needed
[ "Evaluates", "elements", "and", "coerces", "objects", "to", "a", "class", "if", "needed" ]
88398c77534ebec19f1f18478e475d0b7a5bc717
https://github.com/borntyping/python-dice/blob/88398c77534ebec19f1f18478e475d0b7a5bc717/dice/elements.py#L44-L60
train
networks-lab/metaknowledge
metaknowledge/graphHelpers.py
readGraph
def readGraph(edgeList, nodeList = None, directed = False, idKey = 'ID', eSource = 'From', eDest = 'To'): """Reads the files given by _edgeList_ and _nodeList_ and creates a networkx graph for the files. This is designed only for the files produced by metaknowledge and is meant to be the reverse of [writeGraph...
python
def readGraph(edgeList, nodeList = None, directed = False, idKey = 'ID', eSource = 'From', eDest = 'To'): """Reads the files given by _edgeList_ and _nodeList_ and creates a networkx graph for the files. This is designed only for the files produced by metaknowledge and is meant to be the reverse of [writeGraph...
[ "def", "readGraph", "(", "edgeList", ",", "nodeList", "=", "None", ",", "directed", "=", "False", ",", "idKey", "=", "'ID'", ",", "eSource", "=", "'From'", ",", "eDest", "=", "'To'", ")", ":", "progArgs", "=", "(", "0", ",", "\"Starting to reading graphs...
Reads the files given by _edgeList_ and _nodeList_ and creates a networkx graph for the files. This is designed only for the files produced by metaknowledge and is meant to be the reverse of [writeGraph()](#metaknowledge.graphHelpers.writeGraph), if this does not produce the desired results the networkx builtin [n...
[ "Reads", "the", "files", "given", "by", "_edgeList_", "and", "_nodeList_", "and", "creates", "a", "networkx", "graph", "for", "the", "files", "." ]
8162bf95e66bb6f9916081338e6e2a6132faff75
https://github.com/networks-lab/metaknowledge/blob/8162bf95e66bb6f9916081338e6e2a6132faff75/metaknowledge/graphHelpers.py#L11-L94
train
networks-lab/metaknowledge
metaknowledge/graphHelpers.py
writeGraph
def writeGraph(grph, name, edgeInfo = True, typing = False, suffix = 'csv', overwrite = True, allSameAttribute = False): """Writes both the edge list and the node attribute list of _grph_ to files starting with _name_. The output files start with _name_, the file type (edgeList, nodeAttributes) then if typing ...
python
def writeGraph(grph, name, edgeInfo = True, typing = False, suffix = 'csv', overwrite = True, allSameAttribute = False): """Writes both the edge list and the node attribute list of _grph_ to files starting with _name_. The output files start with _name_, the file type (edgeList, nodeAttributes) then if typing ...
[ "def", "writeGraph", "(", "grph", ",", "name", ",", "edgeInfo", "=", "True", ",", "typing", "=", "False", ",", "suffix", "=", "'csv'", ",", "overwrite", "=", "True", ",", "allSameAttribute", "=", "False", ")", ":", "progArgs", "=", "(", "0", ",", "\"...
Writes both the edge list and the node attribute list of _grph_ to files starting with _name_. The output files start with _name_, the file type (edgeList, nodeAttributes) then if typing is True the type of graph (directed or undirected) then the suffix, the default is as follows: >> name_fileType.suffix ...
[ "Writes", "both", "the", "edge", "list", "and", "the", "node", "attribute", "list", "of", "_grph_", "to", "files", "starting", "with", "_name_", "." ]
8162bf95e66bb6f9916081338e6e2a6132faff75
https://github.com/networks-lab/metaknowledge/blob/8162bf95e66bb6f9916081338e6e2a6132faff75/metaknowledge/graphHelpers.py#L96-L170
train
networks-lab/metaknowledge
metaknowledge/graphHelpers.py
getNodeDegrees
def getNodeDegrees(grph, weightString = "weight", strictMode = False, returnType = int, edgeType = 'bi'): """ Retunrs a dictionary of nodes to their degrees, the degree is determined by adding the weight of edge with the weight being the string weightString that gives the name of the attribute of each edge con...
python
def getNodeDegrees(grph, weightString = "weight", strictMode = False, returnType = int, edgeType = 'bi'): """ Retunrs a dictionary of nodes to their degrees, the degree is determined by adding the weight of edge with the weight being the string weightString that gives the name of the attribute of each edge con...
[ "def", "getNodeDegrees", "(", "grph", ",", "weightString", "=", "\"weight\"", ",", "strictMode", "=", "False", ",", "returnType", "=", "int", ",", "edgeType", "=", "'bi'", ")", ":", "ndsDict", "=", "{", "}", "for", "nd", "in", "grph", ".", "nodes", "("...
Retunrs a dictionary of nodes to their degrees, the degree is determined by adding the weight of edge with the weight being the string weightString that gives the name of the attribute of each edge containng thier weight. The Weights are then converted to the type returnType. If weightString is give as False instead ea...
[ "Retunrs", "a", "dictionary", "of", "nodes", "to", "their", "degrees", "the", "degree", "is", "determined", "by", "adding", "the", "weight", "of", "edge", "with", "the", "weight", "being", "the", "string", "weightString", "that", "gives", "the", "name", "of"...
8162bf95e66bb6f9916081338e6e2a6132faff75
https://github.com/networks-lab/metaknowledge/blob/8162bf95e66bb6f9916081338e6e2a6132faff75/metaknowledge/graphHelpers.py#L457-L486
train
networks-lab/metaknowledge
metaknowledge/graphHelpers.py
mergeGraphs
def mergeGraphs(targetGraph, addedGraph, incrementedNodeVal = 'count', incrementedEdgeVal = 'weight'): """A quick way of merging graphs, this is meant to be quick and is only intended for graphs generated by metaknowledge. This does not check anything and as such may cause unexpected results if the source and targe...
python
def mergeGraphs(targetGraph, addedGraph, incrementedNodeVal = 'count', incrementedEdgeVal = 'weight'): """A quick way of merging graphs, this is meant to be quick and is only intended for graphs generated by metaknowledge. This does not check anything and as such may cause unexpected results if the source and targe...
[ "def", "mergeGraphs", "(", "targetGraph", ",", "addedGraph", ",", "incrementedNodeVal", "=", "'count'", ",", "incrementedEdgeVal", "=", "'weight'", ")", ":", "for", "addedNode", ",", "attribs", "in", "addedGraph", ".", "nodes", "(", "data", "=", "True", ")", ...
A quick way of merging graphs, this is meant to be quick and is only intended for graphs generated by metaknowledge. This does not check anything and as such may cause unexpected results if the source and target were not generated by the same method. **mergeGraphs**() will **modify** _targetGraph_ in place by addi...
[ "A", "quick", "way", "of", "merging", "graphs", "this", "is", "meant", "to", "be", "quick", "and", "is", "only", "intended", "for", "graphs", "generated", "by", "metaknowledge", ".", "This", "does", "not", "check", "anything", "and", "as", "such", "may", ...
8162bf95e66bb6f9916081338e6e2a6132faff75
https://github.com/networks-lab/metaknowledge/blob/8162bf95e66bb6f9916081338e6e2a6132faff75/metaknowledge/graphHelpers.py#L691-L732
train
networks-lab/metaknowledge
metaknowledge/medline/tagProcessing/tagFunctions.py
AD
def AD(val): """Affiliation Undoing what the parser does then splitting at the semicolons and dropping newlines extra fitlering is required beacuse some AD's end with a semicolon""" retDict = {} for v in val: split = v.split(' : ') retDict[split[0]] = [s for s in' : '.join(split[1:]).rep...
python
def AD(val): """Affiliation Undoing what the parser does then splitting at the semicolons and dropping newlines extra fitlering is required beacuse some AD's end with a semicolon""" retDict = {} for v in val: split = v.split(' : ') retDict[split[0]] = [s for s in' : '.join(split[1:]).rep...
[ "def", "AD", "(", "val", ")", ":", "retDict", "=", "{", "}", "for", "v", "in", "val", ":", "split", "=", "v", ".", "split", "(", "' : '", ")", "retDict", "[", "split", "[", "0", "]", "]", "=", "[", "s", "for", "s", "in", "' : '", ".", "join...
Affiliation Undoing what the parser does then splitting at the semicolons and dropping newlines extra fitlering is required beacuse some AD's end with a semicolon
[ "Affiliation", "Undoing", "what", "the", "parser", "does", "then", "splitting", "at", "the", "semicolons", "and", "dropping", "newlines", "extra", "fitlering", "is", "required", "beacuse", "some", "AD", "s", "end", "with", "a", "semicolon" ]
8162bf95e66bb6f9916081338e6e2a6132faff75
https://github.com/networks-lab/metaknowledge/blob/8162bf95e66bb6f9916081338e6e2a6132faff75/metaknowledge/medline/tagProcessing/tagFunctions.py#L218-L225
train
networks-lab/metaknowledge
metaknowledge/medline/tagProcessing/tagFunctions.py
AUID
def AUID(val): """AuthorIdentifier one line only just need to undo the parser's effects""" retDict = {} for v in val: split = v.split(' : ') retDict[split[0]] = ' : '.join(split[1:]) return retDict
python
def AUID(val): """AuthorIdentifier one line only just need to undo the parser's effects""" retDict = {} for v in val: split = v.split(' : ') retDict[split[0]] = ' : '.join(split[1:]) return retDict
[ "def", "AUID", "(", "val", ")", ":", "retDict", "=", "{", "}", "for", "v", "in", "val", ":", "split", "=", "v", ".", "split", "(", "' : '", ")", "retDict", "[", "split", "[", "0", "]", "]", "=", "' : '", ".", "join", "(", "split", "[", "1", ...
AuthorIdentifier one line only just need to undo the parser's effects
[ "AuthorIdentifier", "one", "line", "only", "just", "need", "to", "undo", "the", "parser", "s", "effects" ]
8162bf95e66bb6f9916081338e6e2a6132faff75
https://github.com/networks-lab/metaknowledge/blob/8162bf95e66bb6f9916081338e6e2a6132faff75/metaknowledge/medline/tagProcessing/tagFunctions.py#L322-L329
train
networks-lab/metaknowledge
metaknowledge/constants.py
isInteractive
def isInteractive(): """ A basic check of if the program is running in interactive mode """ if sys.stdout.isatty() and os.name != 'nt': #Hopefully everything but ms supports '\r' try: import threading except ImportError: return False else: ...
python
def isInteractive(): """ A basic check of if the program is running in interactive mode """ if sys.stdout.isatty() and os.name != 'nt': #Hopefully everything but ms supports '\r' try: import threading except ImportError: return False else: ...
[ "def", "isInteractive", "(", ")", ":", "if", "sys", ".", "stdout", ".", "isatty", "(", ")", "and", "os", ".", "name", "!=", "'nt'", ":", "try", ":", "import", "threading", "except", "ImportError", ":", "return", "False", "else", ":", "return", "True", ...
A basic check of if the program is running in interactive mode
[ "A", "basic", "check", "of", "if", "the", "program", "is", "running", "in", "interactive", "mode" ]
8162bf95e66bb6f9916081338e6e2a6132faff75
https://github.com/networks-lab/metaknowledge/blob/8162bf95e66bb6f9916081338e6e2a6132faff75/metaknowledge/constants.py#L27-L40
train
networks-lab/metaknowledge
metaknowledge/grants/nsercGrant.py
NSERCGrant.getInstitutions
def getInstitutions(self, tags = None, seperator = ";", _getTag = False): """Returns a list with the names of the institution. The optional arguments are ignored # Returns `list [str]` > A list with 1 entry the name of the institution """ if tags is None: t...
python
def getInstitutions(self, tags = None, seperator = ";", _getTag = False): """Returns a list with the names of the institution. The optional arguments are ignored # Returns `list [str]` > A list with 1 entry the name of the institution """ if tags is None: t...
[ "def", "getInstitutions", "(", "self", ",", "tags", "=", "None", ",", "seperator", "=", "\";\"", ",", "_getTag", "=", "False", ")", ":", "if", "tags", "is", "None", ":", "tags", "=", "[", "]", "elif", "isinstance", "(", "tags", ",", "str", ")", ":"...
Returns a list with the names of the institution. The optional arguments are ignored # Returns `list [str]` > A list with 1 entry the name of the institution
[ "Returns", "a", "list", "with", "the", "names", "of", "the", "institution", ".", "The", "optional", "arguments", "are", "ignored" ]
8162bf95e66bb6f9916081338e6e2a6132faff75
https://github.com/networks-lab/metaknowledge/blob/8162bf95e66bb6f9916081338e6e2a6132faff75/metaknowledge/grants/nsercGrant.py#L46-L62
train
networks-lab/metaknowledge
metaknowledge/medline/recordMedline.py
MedlineRecord.writeRecord
def writeRecord(self, f): """This is nearly identical to the original the FAU tag is the only tag not writen in the same place, doing so would require changing the parser and lots of extra logic. """ if self.bad: raise BadPubmedRecord("This record cannot be converted to a file as the...
python
def writeRecord(self, f): """This is nearly identical to the original the FAU tag is the only tag not writen in the same place, doing so would require changing the parser and lots of extra logic. """ if self.bad: raise BadPubmedRecord("This record cannot be converted to a file as the...
[ "def", "writeRecord", "(", "self", ",", "f", ")", ":", "if", "self", ".", "bad", ":", "raise", "BadPubmedRecord", "(", "\"This record cannot be converted to a file as the input was malformed.\\nThe original line number (if any) is: {} and the original file is: '{}'\"", ".", "form...
This is nearly identical to the original the FAU tag is the only tag not writen in the same place, doing so would require changing the parser and lots of extra logic.
[ "This", "is", "nearly", "identical", "to", "the", "original", "the", "FAU", "tag", "is", "the", "only", "tag", "not", "writen", "in", "the", "same", "place", "doing", "so", "would", "require", "changing", "the", "parser", "and", "lots", "of", "extra", "l...
8162bf95e66bb6f9916081338e6e2a6132faff75
https://github.com/networks-lab/metaknowledge/blob/8162bf95e66bb6f9916081338e6e2a6132faff75/metaknowledge/medline/recordMedline.py#L66-L88
train
networks-lab/metaknowledge
metaknowledge/contour/plotting.py
quickVisual
def quickVisual(G, showLabel = False): """Just makes a simple _matplotlib_ figure and displays it, with each node coloured by its type. You can add labels with _showLabel_. This looks a bit nicer than the one provided my _networkx_'s defaults. # Parameters _showLabel_ : `optional [bool]` > Default `F...
python
def quickVisual(G, showLabel = False): """Just makes a simple _matplotlib_ figure and displays it, with each node coloured by its type. You can add labels with _showLabel_. This looks a bit nicer than the one provided my _networkx_'s defaults. # Parameters _showLabel_ : `optional [bool]` > Default `F...
[ "def", "quickVisual", "(", "G", ",", "showLabel", "=", "False", ")", ":", "colours", "=", "\"brcmykwg\"", "f", "=", "plt", ".", "figure", "(", "1", ")", "ax", "=", "f", ".", "add_subplot", "(", "1", ",", "1", ",", "1", ")", "ndTypes", "=", "[", ...
Just makes a simple _matplotlib_ figure and displays it, with each node coloured by its type. You can add labels with _showLabel_. This looks a bit nicer than the one provided my _networkx_'s defaults. # Parameters _showLabel_ : `optional [bool]` > Default `False`, if `True` labels will be added to the n...
[ "Just", "makes", "a", "simple", "_matplotlib_", "figure", "and", "displays", "it", "with", "each", "node", "coloured", "by", "its", "type", ".", "You", "can", "add", "labels", "with", "_showLabel_", ".", "This", "looks", "a", "bit", "nicer", "than", "the",...
8162bf95e66bb6f9916081338e6e2a6132faff75
https://github.com/networks-lab/metaknowledge/blob/8162bf95e66bb6f9916081338e6e2a6132faff75/metaknowledge/contour/plotting.py#L8-L38
train
networks-lab/metaknowledge
metaknowledge/contour/plotting.py
graphDensityContourPlot
def graphDensityContourPlot(G, iters = 50, layout = None, layoutScaleFactor = 1, overlay = False, nodeSize = 10, axisSamples = 100, blurringFactor = .1, contours = 15, graphType = 'coloured'): """Creates a 3D plot giving the density of nodes on a 2D plane, as a surface in 3D. Most of the options are for tweaki...
python
def graphDensityContourPlot(G, iters = 50, layout = None, layoutScaleFactor = 1, overlay = False, nodeSize = 10, axisSamples = 100, blurringFactor = .1, contours = 15, graphType = 'coloured'): """Creates a 3D plot giving the density of nodes on a 2D plane, as a surface in 3D. Most of the options are for tweaki...
[ "def", "graphDensityContourPlot", "(", "G", ",", "iters", "=", "50", ",", "layout", "=", "None", ",", "layoutScaleFactor", "=", "1", ",", "overlay", "=", "False", ",", "nodeSize", "=", "10", ",", "axisSamples", "=", "100", ",", "blurringFactor", "=", ".1...
Creates a 3D plot giving the density of nodes on a 2D plane, as a surface in 3D. Most of the options are for tweaking the final appearance. _layout_ and _layoutScaleFactor_ allow a pre-layout graph to be provided. If a layout is not provided the [networkx.spring_layout()](https://networkx.github.io/documentation/l...
[ "Creates", "a", "3D", "plot", "giving", "the", "density", "of", "nodes", "on", "a", "2D", "plane", "as", "a", "surface", "in", "3D", "." ]
8162bf95e66bb6f9916081338e6e2a6132faff75
https://github.com/networks-lab/metaknowledge/blob/8162bf95e66bb6f9916081338e6e2a6132faff75/metaknowledge/contour/plotting.py#L40-L125
train
networks-lab/metaknowledge
metaknowledge/WOS/tagProcessing/helpFuncs.py
makeBiDirectional
def makeBiDirectional(d): """ Helper for generating tagNameConverter Makes dict that maps from key to value and back """ dTmp = d.copy() for k in d: dTmp[d[k]] = k return dTmp
python
def makeBiDirectional(d): """ Helper for generating tagNameConverter Makes dict that maps from key to value and back """ dTmp = d.copy() for k in d: dTmp[d[k]] = k return dTmp
[ "def", "makeBiDirectional", "(", "d", ")", ":", "dTmp", "=", "d", ".", "copy", "(", ")", "for", "k", "in", "d", ":", "dTmp", "[", "d", "[", "k", "]", "]", "=", "k", "return", "dTmp" ]
Helper for generating tagNameConverter Makes dict that maps from key to value and back
[ "Helper", "for", "generating", "tagNameConverter", "Makes", "dict", "that", "maps", "from", "key", "to", "value", "and", "back" ]
8162bf95e66bb6f9916081338e6e2a6132faff75
https://github.com/networks-lab/metaknowledge/blob/8162bf95e66bb6f9916081338e6e2a6132faff75/metaknowledge/WOS/tagProcessing/helpFuncs.py#L27-L35
train
networks-lab/metaknowledge
metaknowledge/WOS/tagProcessing/helpFuncs.py
reverseDict
def reverseDict(d): """ Helper for generating fullToTag Makes dict of value to key """ retD = {} for k in d: retD[d[k]] = k return retD
python
def reverseDict(d): """ Helper for generating fullToTag Makes dict of value to key """ retD = {} for k in d: retD[d[k]] = k return retD
[ "def", "reverseDict", "(", "d", ")", ":", "retD", "=", "{", "}", "for", "k", "in", "d", ":", "retD", "[", "d", "[", "k", "]", "]", "=", "k", "return", "retD" ]
Helper for generating fullToTag Makes dict of value to key
[ "Helper", "for", "generating", "fullToTag", "Makes", "dict", "of", "value", "to", "key" ]
8162bf95e66bb6f9916081338e6e2a6132faff75
https://github.com/networks-lab/metaknowledge/blob/8162bf95e66bb6f9916081338e6e2a6132faff75/metaknowledge/WOS/tagProcessing/helpFuncs.py#L37-L45
train