repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1
value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
eighthave/pyvendapin | vendapin.py | Vendapin.reset | def reset(self, hard=False):
'''reset the card dispense, either soft or hard based on boolean 2nd arg'''
if hard:
self.sendcommand(Vendapin.RESET, 1, 0x01)
time.sleep(2)
else:
self.sendcommand(Vendapin.RESET)
time.sleep(2)
# parse the r... | python | def reset(self, hard=False):
'''reset the card dispense, either soft or hard based on boolean 2nd arg'''
if hard:
self.sendcommand(Vendapin.RESET, 1, 0x01)
time.sleep(2)
else:
self.sendcommand(Vendapin.RESET)
time.sleep(2)
# parse the r... | [
"def",
"reset",
"(",
"self",
",",
"hard",
"=",
"False",
")",
":",
"if",
"hard",
":",
"self",
".",
"sendcommand",
"(",
"Vendapin",
".",
"RESET",
",",
"1",
",",
"0x01",
")",
"time",
".",
"sleep",
"(",
"2",
")",
"else",
":",
"self",
".",
"sendcomman... | reset the card dispense, either soft or hard based on boolean 2nd arg | [
"reset",
"the",
"card",
"dispense",
"either",
"soft",
"or",
"hard",
"based",
"on",
"boolean",
"2nd",
"arg"
] | train | https://github.com/eighthave/pyvendapin/blob/270c4da5c31ab4a0435660b25b655692fdffcf01/vendapin.py#L250-L260 |
jantman/webhook2lambda2sqs | webhook2lambda2sqs/terraform_runner.py | TerraformRunner._validate | def _validate(self):
"""
Confirm that we can run terraform (by calling its version action)
and then validate the configuration.
"""
try:
out = self._run_tf('version')
except:
raise Exception('ERROR: executing \'%s version\' failed; is '
... | python | def _validate(self):
"""
Confirm that we can run terraform (by calling its version action)
and then validate the configuration.
"""
try:
out = self._run_tf('version')
except:
raise Exception('ERROR: executing \'%s version\' failed; is '
... | [
"def",
"_validate",
"(",
"self",
")",
":",
"try",
":",
"out",
"=",
"self",
".",
"_run_tf",
"(",
"'version'",
")",
"except",
":",
"raise",
"Exception",
"(",
"'ERROR: executing \\'%s version\\' failed; is '",
"'terraform installed and is the path to it (%s) '",
"'correct?... | Confirm that we can run terraform (by calling its version action)
and then validate the configuration. | [
"Confirm",
"that",
"we",
"can",
"run",
"terraform",
"(",
"by",
"calling",
"its",
"version",
"action",
")",
"and",
"then",
"validate",
"the",
"configuration",
"."
] | train | https://github.com/jantman/webhook2lambda2sqs/blob/c80c18d5a908ba8b8ee624dc3a977c633fba2b7c/webhook2lambda2sqs/terraform_runner.py#L65-L103 |
jantman/webhook2lambda2sqs | webhook2lambda2sqs/terraform_runner.py | TerraformRunner._args_for_remote | def _args_for_remote(self):
"""
Generate arguments for 'terraform remote config'. Return None if
not present in configuration.
:return: list of args for 'terraform remote config' or None
:rtype: :std:term:`list`
"""
conf = self.config.get('terraform_remote_state'... | python | def _args_for_remote(self):
"""
Generate arguments for 'terraform remote config'. Return None if
not present in configuration.
:return: list of args for 'terraform remote config' or None
:rtype: :std:term:`list`
"""
conf = self.config.get('terraform_remote_state'... | [
"def",
"_args_for_remote",
"(",
"self",
")",
":",
"conf",
"=",
"self",
".",
"config",
".",
"get",
"(",
"'terraform_remote_state'",
")",
"if",
"conf",
"is",
"None",
":",
"return",
"None",
"args",
"=",
"[",
"'-backend=%s'",
"%",
"conf",
"[",
"'backend'",
"... | Generate arguments for 'terraform remote config'. Return None if
not present in configuration.
:return: list of args for 'terraform remote config' or None
:rtype: :std:term:`list` | [
"Generate",
"arguments",
"for",
"terraform",
"remote",
"config",
".",
"Return",
"None",
"if",
"not",
"present",
"in",
"configuration",
"."
] | train | https://github.com/jantman/webhook2lambda2sqs/blob/c80c18d5a908ba8b8ee624dc3a977c633fba2b7c/webhook2lambda2sqs/terraform_runner.py#L105-L119 |
jantman/webhook2lambda2sqs | webhook2lambda2sqs/terraform_runner.py | TerraformRunner._set_remote | def _set_remote(self, stream=False):
"""
Call :py:meth:`~._args_for_remote`; if the return value is not None,
execute 'terraform remote config' with those arguments and ensure it
exits 0.
:param stream: whether or not to stream TF output in realtime
:type stream: bool
... | python | def _set_remote(self, stream=False):
"""
Call :py:meth:`~._args_for_remote`; if the return value is not None,
execute 'terraform remote config' with those arguments and ensure it
exits 0.
:param stream: whether or not to stream TF output in realtime
:type stream: bool
... | [
"def",
"_set_remote",
"(",
"self",
",",
"stream",
"=",
"False",
")",
":",
"args",
"=",
"self",
".",
"_args_for_remote",
"(",
")",
"if",
"args",
"is",
"None",
":",
"logger",
".",
"debug",
"(",
"'_args_for_remote() returned None; not configuring '",
"'terraform re... | Call :py:meth:`~._args_for_remote`; if the return value is not None,
execute 'terraform remote config' with those arguments and ensure it
exits 0.
:param stream: whether or not to stream TF output in realtime
:type stream: bool | [
"Call",
":",
"py",
":",
"meth",
":",
"~",
".",
"_args_for_remote",
";",
"if",
"the",
"return",
"value",
"is",
"not",
"None",
"execute",
"terraform",
"remote",
"config",
"with",
"those",
"arguments",
"and",
"ensure",
"it",
"exits",
"0",
"."
] | train | https://github.com/jantman/webhook2lambda2sqs/blob/c80c18d5a908ba8b8ee624dc3a977c633fba2b7c/webhook2lambda2sqs/terraform_runner.py#L121-L138 |
jantman/webhook2lambda2sqs | webhook2lambda2sqs/terraform_runner.py | TerraformRunner._run_tf | def _run_tf(self, cmd, cmd_args=[], stream=False):
"""
Run a single terraform command via :py:func:`~.utils.run_cmd`;
raise exception on non-zero exit status.
:param cmd: terraform command to run
:type cmd: str
:param cmd_args: arguments to command
:type cmd_args... | python | def _run_tf(self, cmd, cmd_args=[], stream=False):
"""
Run a single terraform command via :py:func:`~.utils.run_cmd`;
raise exception on non-zero exit status.
:param cmd: terraform command to run
:type cmd: str
:param cmd_args: arguments to command
:type cmd_args... | [
"def",
"_run_tf",
"(",
"self",
",",
"cmd",
",",
"cmd_args",
"=",
"[",
"]",
",",
"stream",
"=",
"False",
")",
":",
"args",
"=",
"[",
"self",
".",
"tf_path",
",",
"cmd",
"]",
"+",
"cmd_args",
"arg_str",
"=",
"' '",
".",
"join",
"(",
"args",
")",
... | Run a single terraform command via :py:func:`~.utils.run_cmd`;
raise exception on non-zero exit status.
:param cmd: terraform command to run
:type cmd: str
:param cmd_args: arguments to command
:type cmd_args: :std:term:`list`
:return: command output
:rtype: str
... | [
"Run",
"a",
"single",
"terraform",
"command",
"via",
":",
"py",
":",
"func",
":",
"~",
".",
"utils",
".",
"run_cmd",
";",
"raise",
"exception",
"on",
"non",
"-",
"zero",
"exit",
"status",
"."
] | train | https://github.com/jantman/webhook2lambda2sqs/blob/c80c18d5a908ba8b8ee624dc3a977c633fba2b7c/webhook2lambda2sqs/terraform_runner.py#L140-L161 |
jantman/webhook2lambda2sqs | webhook2lambda2sqs/terraform_runner.py | TerraformRunner._taint_deployment | def _taint_deployment(self, stream=False):
"""
Run 'terraform taint aws_api_gateway_deployment.depl' to taint the
deployment resource. This is a workaround for
https://github.com/hashicorp/terraform/issues/6613
:param stream: whether or not to stream TF output in realtime
... | python | def _taint_deployment(self, stream=False):
"""
Run 'terraform taint aws_api_gateway_deployment.depl' to taint the
deployment resource. This is a workaround for
https://github.com/hashicorp/terraform/issues/6613
:param stream: whether or not to stream TF output in realtime
... | [
"def",
"_taint_deployment",
"(",
"self",
",",
"stream",
"=",
"False",
")",
":",
"args",
"=",
"[",
"'aws_api_gateway_deployment.depl'",
"]",
"logger",
".",
"warning",
"(",
"'Running terraform taint: %s as workaround for '",
"'<https://github.com/hashicorp/terraform/issues/6613... | Run 'terraform taint aws_api_gateway_deployment.depl' to taint the
deployment resource. This is a workaround for
https://github.com/hashicorp/terraform/issues/6613
:param stream: whether or not to stream TF output in realtime
:type stream: bool | [
"Run",
"terraform",
"taint",
"aws_api_gateway_deployment",
".",
"depl",
"to",
"taint",
"the",
"deployment",
"resource",
".",
"This",
"is",
"a",
"workaround",
"for",
"https",
":",
"//",
"github",
".",
"com",
"/",
"hashicorp",
"/",
"terraform",
"/",
"issues",
... | train | https://github.com/jantman/webhook2lambda2sqs/blob/c80c18d5a908ba8b8ee624dc3a977c633fba2b7c/webhook2lambda2sqs/terraform_runner.py#L179-L196 |
jantman/webhook2lambda2sqs | webhook2lambda2sqs/terraform_runner.py | TerraformRunner.apply | def apply(self, stream=False):
"""
Run a 'terraform apply'
:param stream: whether or not to stream TF output in realtime
:type stream: bool
"""
self._setup_tf(stream=stream)
try:
self._taint_deployment(stream=stream)
except Exception:
... | python | def apply(self, stream=False):
"""
Run a 'terraform apply'
:param stream: whether or not to stream TF output in realtime
:type stream: bool
"""
self._setup_tf(stream=stream)
try:
self._taint_deployment(stream=stream)
except Exception:
... | [
"def",
"apply",
"(",
"self",
",",
"stream",
"=",
"False",
")",
":",
"self",
".",
"_setup_tf",
"(",
"stream",
"=",
"stream",
")",
"try",
":",
"self",
".",
"_taint_deployment",
"(",
"stream",
"=",
"stream",
")",
"except",
"Exception",
":",
"pass",
"args"... | Run a 'terraform apply'
:param stream: whether or not to stream TF output in realtime
:type stream: bool | [
"Run",
"a",
"terraform",
"apply"
] | train | https://github.com/jantman/webhook2lambda2sqs/blob/c80c18d5a908ba8b8ee624dc3a977c633fba2b7c/webhook2lambda2sqs/terraform_runner.py#L198-L217 |
jantman/webhook2lambda2sqs | webhook2lambda2sqs/terraform_runner.py | TerraformRunner._show_outputs | def _show_outputs(self):
"""
Print the terraform outputs.
"""
outs = self._get_outputs()
print("\n\n" + '=> Terraform Outputs:')
for k in sorted(outs):
print('%s = %s' % (k, outs[k])) | python | def _show_outputs(self):
"""
Print the terraform outputs.
"""
outs = self._get_outputs()
print("\n\n" + '=> Terraform Outputs:')
for k in sorted(outs):
print('%s = %s' % (k, outs[k])) | [
"def",
"_show_outputs",
"(",
"self",
")",
":",
"outs",
"=",
"self",
".",
"_get_outputs",
"(",
")",
"print",
"(",
"\"\\n\\n\"",
"+",
"'=> Terraform Outputs:'",
")",
"for",
"k",
"in",
"sorted",
"(",
"outs",
")",
":",
"print",
"(",
"'%s = %s'",
"%",
"(",
... | Print the terraform outputs. | [
"Print",
"the",
"terraform",
"outputs",
"."
] | train | https://github.com/jantman/webhook2lambda2sqs/blob/c80c18d5a908ba8b8ee624dc3a977c633fba2b7c/webhook2lambda2sqs/terraform_runner.py#L219-L226 |
jantman/webhook2lambda2sqs | webhook2lambda2sqs/terraform_runner.py | TerraformRunner._get_outputs | def _get_outputs(self):
"""
Return a dict of the terraform outputs.
:return: dict of terraform outputs
:rtype: dict
"""
if self.tf_version >= (0, 7, 0):
logger.debug('Running: terraform output')
res = self._run_tf('output', cmd_args=['-json'])
... | python | def _get_outputs(self):
"""
Return a dict of the terraform outputs.
:return: dict of terraform outputs
:rtype: dict
"""
if self.tf_version >= (0, 7, 0):
logger.debug('Running: terraform output')
res = self._run_tf('output', cmd_args=['-json'])
... | [
"def",
"_get_outputs",
"(",
"self",
")",
":",
"if",
"self",
".",
"tf_version",
">=",
"(",
"0",
",",
"7",
",",
"0",
")",
":",
"logger",
".",
"debug",
"(",
"'Running: terraform output'",
")",
"res",
"=",
"self",
".",
"_run_tf",
"(",
"'output'",
",",
"c... | Return a dict of the terraform outputs.
:return: dict of terraform outputs
:rtype: dict | [
"Return",
"a",
"dict",
"of",
"the",
"terraform",
"outputs",
"."
] | train | https://github.com/jantman/webhook2lambda2sqs/blob/c80c18d5a908ba8b8ee624dc3a977c633fba2b7c/webhook2lambda2sqs/terraform_runner.py#L228-L257 |
jantman/webhook2lambda2sqs | webhook2lambda2sqs/terraform_runner.py | TerraformRunner.destroy | def destroy(self, stream=False):
"""
Run a 'terraform destroy'
:param stream: whether or not to stream TF output in realtime
:type stream: bool
"""
self._setup_tf(stream=stream)
args = ['-refresh=true', '-force', '.']
logger.warning('Running terraform des... | python | def destroy(self, stream=False):
"""
Run a 'terraform destroy'
:param stream: whether or not to stream TF output in realtime
:type stream: bool
"""
self._setup_tf(stream=stream)
args = ['-refresh=true', '-force', '.']
logger.warning('Running terraform des... | [
"def",
"destroy",
"(",
"self",
",",
"stream",
"=",
"False",
")",
":",
"self",
".",
"_setup_tf",
"(",
"stream",
"=",
"stream",
")",
"args",
"=",
"[",
"'-refresh=true'",
",",
"'-force'",
",",
"'.'",
"]",
"logger",
".",
"warning",
"(",
"'Running terraform d... | Run a 'terraform destroy'
:param stream: whether or not to stream TF output in realtime
:type stream: bool | [
"Run",
"a",
"terraform",
"destroy"
] | train | https://github.com/jantman/webhook2lambda2sqs/blob/c80c18d5a908ba8b8ee624dc3a977c633fba2b7c/webhook2lambda2sqs/terraform_runner.py#L259-L273 |
jantman/webhook2lambda2sqs | webhook2lambda2sqs/terraform_runner.py | TerraformRunner._setup_tf | def _setup_tf(self, stream=False):
"""
Setup terraform; either 'remote config' or 'init' depending on version.
"""
if self.tf_version < (0, 9, 0):
self._set_remote(stream=stream)
return
self._run_tf('init', stream=stream)
logger.info('Terraform ini... | python | def _setup_tf(self, stream=False):
"""
Setup terraform; either 'remote config' or 'init' depending on version.
"""
if self.tf_version < (0, 9, 0):
self._set_remote(stream=stream)
return
self._run_tf('init', stream=stream)
logger.info('Terraform ini... | [
"def",
"_setup_tf",
"(",
"self",
",",
"stream",
"=",
"False",
")",
":",
"if",
"self",
".",
"tf_version",
"<",
"(",
"0",
",",
"9",
",",
"0",
")",
":",
"self",
".",
"_set_remote",
"(",
"stream",
"=",
"stream",
")",
"return",
"self",
".",
"_run_tf",
... | Setup terraform; either 'remote config' or 'init' depending on version. | [
"Setup",
"terraform",
";",
"either",
"remote",
"config",
"or",
"init",
"depending",
"on",
"version",
"."
] | train | https://github.com/jantman/webhook2lambda2sqs/blob/c80c18d5a908ba8b8ee624dc3a977c633fba2b7c/webhook2lambda2sqs/terraform_runner.py#L275-L283 |
njouanin/repool | repool/pool.py | ConnectionPool.new_conn | def new_conn(self):
"""
Create a new ConnectionWrapper instance
:return:
"""
"""
:return:
"""
logger.debug("Opening new connection to rethinkdb with args=%s" % self._conn_args)
return ConnectionWrapper(self._pool, **self._conn_args) | python | def new_conn(self):
"""
Create a new ConnectionWrapper instance
:return:
"""
"""
:return:
"""
logger.debug("Opening new connection to rethinkdb with args=%s" % self._conn_args)
return ConnectionWrapper(self._pool, **self._conn_args) | [
"def",
"new_conn",
"(",
"self",
")",
":",
"\"\"\"\n :return:\n \"\"\"",
"logger",
".",
"debug",
"(",
"\"Opening new connection to rethinkdb with args=%s\"",
"%",
"self",
".",
"_conn_args",
")",
"return",
"ConnectionWrapper",
"(",
"self",
".",
"_pool",
",",... | Create a new ConnectionWrapper instance
:return: | [
"Create",
"a",
"new",
"ConnectionWrapper",
"instance",
":",
"return",
":"
] | train | https://github.com/njouanin/repool/blob/27102cf84cb382c0b2d935f8b8651aa7f8c2777e/repool/pool.py#L83-L92 |
njouanin/repool | repool/pool.py | ConnectionPool.acquire | def acquire(self, timeout=None):
"""Acquire a connection
:param timeout: If provided, seconds to wait for a connection before raising
Queue.Empty. If not provided, blocks indefinitely.
:returns: Returns a RethinkDB connection
:raises Empty: No resources are available before t... | python | def acquire(self, timeout=None):
"""Acquire a connection
:param timeout: If provided, seconds to wait for a connection before raising
Queue.Empty. If not provided, blocks indefinitely.
:returns: Returns a RethinkDB connection
:raises Empty: No resources are available before t... | [
"def",
"acquire",
"(",
"self",
",",
"timeout",
"=",
"None",
")",
":",
"self",
".",
"_pool_lock",
".",
"acquire",
"(",
")",
"if",
"timeout",
"is",
"None",
":",
"conn_wrapper",
"=",
"self",
".",
"_pool",
".",
"get_nowait",
"(",
")",
"else",
":",
"conn_... | Acquire a connection
:param timeout: If provided, seconds to wait for a connection before raising
Queue.Empty. If not provided, blocks indefinitely.
:returns: Returns a RethinkDB connection
:raises Empty: No resources are available before timeout. | [
"Acquire",
"a",
"connection",
":",
"param",
"timeout",
":",
"If",
"provided",
"seconds",
"to",
"wait",
"for",
"a",
"connection",
"before",
"raising",
"Queue",
".",
"Empty",
".",
"If",
"not",
"provided",
"blocks",
"indefinitely",
".",
":",
"returns",
":",
"... | train | https://github.com/njouanin/repool/blob/27102cf84cb382c0b2d935f8b8651aa7f8c2777e/repool/pool.py#L94-L108 |
njouanin/repool | repool/pool.py | ConnectionPool.release | def release(self, conn):
"""Release a previously acquired connection.
The connection is put back into the pool."""
self._pool_lock.acquire()
self._pool.put(ConnectionWrapper(self._pool, conn))
self._current_acquired -= 1
self._pool_lock.release() | python | def release(self, conn):
"""Release a previously acquired connection.
The connection is put back into the pool."""
self._pool_lock.acquire()
self._pool.put(ConnectionWrapper(self._pool, conn))
self._current_acquired -= 1
self._pool_lock.release() | [
"def",
"release",
"(",
"self",
",",
"conn",
")",
":",
"self",
".",
"_pool_lock",
".",
"acquire",
"(",
")",
"self",
".",
"_pool",
".",
"put",
"(",
"ConnectionWrapper",
"(",
"self",
".",
"_pool",
",",
"conn",
")",
")",
"self",
".",
"_current_acquired",
... | Release a previously acquired connection.
The connection is put back into the pool. | [
"Release",
"a",
"previously",
"acquired",
"connection",
".",
"The",
"connection",
"is",
"put",
"back",
"into",
"the",
"pool",
"."
] | train | https://github.com/njouanin/repool/blob/27102cf84cb382c0b2d935f8b8651aa7f8c2777e/repool/pool.py#L110-L116 |
njouanin/repool | repool/pool.py | ConnectionPool.release_pool | def release_pool(self):
"""Release pool and all its connection"""
if self._current_acquired > 0:
raise PoolException("Can't release pool: %d connection(s) still acquired" % self._current_acquired)
while not self._pool.empty():
conn = self.acquire()
conn.close(... | python | def release_pool(self):
"""Release pool and all its connection"""
if self._current_acquired > 0:
raise PoolException("Can't release pool: %d connection(s) still acquired" % self._current_acquired)
while not self._pool.empty():
conn = self.acquire()
conn.close(... | [
"def",
"release_pool",
"(",
"self",
")",
":",
"if",
"self",
".",
"_current_acquired",
">",
"0",
":",
"raise",
"PoolException",
"(",
"\"Can't release pool: %d connection(s) still acquired\"",
"%",
"self",
".",
"_current_acquired",
")",
"while",
"not",
"self",
".",
... | Release pool and all its connection | [
"Release",
"pool",
"and",
"all",
"its",
"connection"
] | train | https://github.com/njouanin/repool/blob/27102cf84cb382c0b2d935f8b8651aa7f8c2777e/repool/pool.py#L123-L133 |
sveetch/boussole | boussole/watcher.py | SassLibraryEventHandler.index | def index(self):
"""
Reset inspector buffers and index project sources dependencies.
This have to be executed each time an event occurs.
Note:
If a Boussole exception occurs during operation, it will be catched
and an error flag will be set to ``True`` so event ... | python | def index(self):
"""
Reset inspector buffers and index project sources dependencies.
This have to be executed each time an event occurs.
Note:
If a Boussole exception occurs during operation, it will be catched
and an error flag will be set to ``True`` so event ... | [
"def",
"index",
"(",
"self",
")",
":",
"self",
".",
"_event_error",
"=",
"False",
"try",
":",
"compilable_files",
"=",
"self",
".",
"finder",
".",
"mirror_sources",
"(",
"self",
".",
"settings",
".",
"SOURCES_PATH",
",",
"targetdir",
"=",
"self",
".",
"s... | Reset inspector buffers and index project sources dependencies.
This have to be executed each time an event occurs.
Note:
If a Boussole exception occurs during operation, it will be catched
and an error flag will be set to ``True`` so event operation will
be blocked... | [
"Reset",
"inspector",
"buffers",
"and",
"index",
"project",
"sources",
"dependencies",
"."
] | train | https://github.com/sveetch/boussole/blob/22cc644e9d633f41ebfc167d427a71c1726cee21/boussole/watcher.py#L65-L95 |
sveetch/boussole | boussole/watcher.py | SassLibraryEventHandler.compile_source | def compile_source(self, sourcepath):
"""
Compile source to its destination
Check if the source is eligible to compile (not partial and allowed
from exclude patterns)
Args:
sourcepath (string): Sass source path to compile to its
destination using pro... | python | def compile_source(self, sourcepath):
"""
Compile source to its destination
Check if the source is eligible to compile (not partial and allowed
from exclude patterns)
Args:
sourcepath (string): Sass source path to compile to its
destination using pro... | [
"def",
"compile_source",
"(",
"self",
",",
"sourcepath",
")",
":",
"relpath",
"=",
"os",
".",
"path",
".",
"relpath",
"(",
"sourcepath",
",",
"self",
".",
"settings",
".",
"SOURCES_PATH",
")",
"conditions",
"=",
"{",
"'sourcedir'",
":",
"None",
",",
"'no... | Compile source to its destination
Check if the source is eligible to compile (not partial and allowed
from exclude patterns)
Args:
sourcepath (string): Sass source path to compile to its
destination using project settings.
Returns:
tuple or None... | [
"Compile",
"source",
"to",
"its",
"destination"
] | train | https://github.com/sveetch/boussole/blob/22cc644e9d633f41ebfc167d427a71c1726cee21/boussole/watcher.py#L97-L141 |
sveetch/boussole | boussole/watcher.py | SassLibraryEventHandler.compile_dependencies | def compile_dependencies(self, sourcepath, include_self=False):
"""
Apply compile on all dependencies
Args:
sourcepath (string): Sass source path to compile to its
destination using project settings.
Keyword Arguments:
include_self (bool): If ``T... | python | def compile_dependencies(self, sourcepath, include_self=False):
"""
Apply compile on all dependencies
Args:
sourcepath (string): Sass source path to compile to its
destination using project settings.
Keyword Arguments:
include_self (bool): If ``T... | [
"def",
"compile_dependencies",
"(",
"self",
",",
"sourcepath",
",",
"include_self",
"=",
"False",
")",
":",
"items",
"=",
"self",
".",
"inspector",
".",
"parents",
"(",
"sourcepath",
")",
"# Also add the current event related path",
"if",
"include_self",
":",
"ite... | Apply compile on all dependencies
Args:
sourcepath (string): Sass source path to compile to its
destination using project settings.
Keyword Arguments:
include_self (bool): If ``True`` the given sourcepath is add to
items to compile, else only its... | [
"Apply",
"compile",
"on",
"all",
"dependencies"
] | train | https://github.com/sveetch/boussole/blob/22cc644e9d633f41ebfc167d427a71c1726cee21/boussole/watcher.py#L143-L161 |
sveetch/boussole | boussole/watcher.py | SassLibraryEventHandler.on_moved | def on_moved(self, event):
"""
Called when a file or a directory is moved or renamed.
Many editors don't directly change a file, instead they make a
transitional file like ``*.part`` then move it to the final filename.
Args:
event: Watchdog event, either ``watchdog.... | python | def on_moved(self, event):
"""
Called when a file or a directory is moved or renamed.
Many editors don't directly change a file, instead they make a
transitional file like ``*.part`` then move it to the final filename.
Args:
event: Watchdog event, either ``watchdog.... | [
"def",
"on_moved",
"(",
"self",
",",
"event",
")",
":",
"if",
"not",
"self",
".",
"_event_error",
":",
"# We are only interested for final file, not transitional file",
"# from editors (like *.part)",
"pathtools_options",
"=",
"{",
"'included_patterns'",
":",
"self",
".",... | Called when a file or a directory is moved or renamed.
Many editors don't directly change a file, instead they make a
transitional file like ``*.part`` then move it to the final filename.
Args:
event: Watchdog event, either ``watchdog.events.DirMovedEvent`` or
``wat... | [
"Called",
"when",
"a",
"file",
"or",
"a",
"directory",
"is",
"moved",
"or",
"renamed",
"."
] | train | https://github.com/sveetch/boussole/blob/22cc644e9d633f41ebfc167d427a71c1726cee21/boussole/watcher.py#L175-L199 |
sveetch/boussole | boussole/watcher.py | SassLibraryEventHandler.on_created | def on_created(self, event):
"""
Called when a new file or directory is created.
Todo:
This should be also used (extended from another class?) to watch
for some special name file (like ".boussole-watcher-stop" create to
raise a KeyboardInterrupt, so we may be... | python | def on_created(self, event):
"""
Called when a new file or directory is created.
Todo:
This should be also used (extended from another class?) to watch
for some special name file (like ".boussole-watcher-stop" create to
raise a KeyboardInterrupt, so we may be... | [
"def",
"on_created",
"(",
"self",
",",
"event",
")",
":",
"if",
"not",
"self",
".",
"_event_error",
":",
"self",
".",
"logger",
".",
"info",
"(",
"u\"Change detected from a create on: %s\"",
",",
"event",
".",
"src_path",
")",
"self",
".",
"compile_dependencie... | Called when a new file or directory is created.
Todo:
This should be also used (extended from another class?) to watch
for some special name file (like ".boussole-watcher-stop" create to
raise a KeyboardInterrupt, so we may be able to unittest the
watcher (click.... | [
"Called",
"when",
"a",
"new",
"file",
"or",
"directory",
"is",
"created",
"."
] | train | https://github.com/sveetch/boussole/blob/22cc644e9d633f41ebfc167d427a71c1726cee21/boussole/watcher.py#L201-L220 |
sveetch/boussole | boussole/watcher.py | SassLibraryEventHandler.on_modified | def on_modified(self, event):
"""
Called when a file or directory is modified.
Args:
event: Watchdog event, ``watchdog.events.DirModifiedEvent`` or
``watchdog.events.FileModifiedEvent``.
"""
if not self._event_error:
self.logger.info(u"Cha... | python | def on_modified(self, event):
"""
Called when a file or directory is modified.
Args:
event: Watchdog event, ``watchdog.events.DirModifiedEvent`` or
``watchdog.events.FileModifiedEvent``.
"""
if not self._event_error:
self.logger.info(u"Cha... | [
"def",
"on_modified",
"(",
"self",
",",
"event",
")",
":",
"if",
"not",
"self",
".",
"_event_error",
":",
"self",
".",
"logger",
".",
"info",
"(",
"u\"Change detected from an edit on: %s\"",
",",
"event",
".",
"src_path",
")",
"self",
".",
"compile_dependencie... | Called when a file or directory is modified.
Args:
event: Watchdog event, ``watchdog.events.DirModifiedEvent`` or
``watchdog.events.FileModifiedEvent``. | [
"Called",
"when",
"a",
"file",
"or",
"directory",
"is",
"modified",
"."
] | train | https://github.com/sveetch/boussole/blob/22cc644e9d633f41ebfc167d427a71c1726cee21/boussole/watcher.py#L222-L234 |
sveetch/boussole | boussole/watcher.py | SassLibraryEventHandler.on_deleted | def on_deleted(self, event):
"""
Called when a file or directory is deleted.
Todo:
May be bugged with inspector and sass compiler since the does not
exists anymore.
Args:
event: Watchdog event, ``watchdog.events.DirDeletedEvent`` or
`... | python | def on_deleted(self, event):
"""
Called when a file or directory is deleted.
Todo:
May be bugged with inspector and sass compiler since the does not
exists anymore.
Args:
event: Watchdog event, ``watchdog.events.DirDeletedEvent`` or
`... | [
"def",
"on_deleted",
"(",
"self",
",",
"event",
")",
":",
"if",
"not",
"self",
".",
"_event_error",
":",
"self",
".",
"logger",
".",
"info",
"(",
"u\"Change detected from deletion of: %s\"",
",",
"event",
".",
"src_path",
")",
"# Never try to compile the deleted s... | Called when a file or directory is deleted.
Todo:
May be bugged with inspector and sass compiler since the does not
exists anymore.
Args:
event: Watchdog event, ``watchdog.events.DirDeletedEvent`` or
``watchdog.events.FileDeletedEvent``. | [
"Called",
"when",
"a",
"file",
"or",
"directory",
"is",
"deleted",
"."
] | train | https://github.com/sveetch/boussole/blob/22cc644e9d633f41ebfc167d427a71c1726cee21/boussole/watcher.py#L236-L252 |
sveetch/boussole | boussole/watcher.py | SassProjectEventHandler.compile_dependencies | def compile_dependencies(self, sourcepath, include_self=True):
"""
Same as inherit method but the default value for keyword argument
``ìnclude_self`` is ``True``.
"""
return super(SassProjectEventHandler, self).compile_dependencies(
sourcepath,
include_sel... | python | def compile_dependencies(self, sourcepath, include_self=True):
"""
Same as inherit method but the default value for keyword argument
``ìnclude_self`` is ``True``.
"""
return super(SassProjectEventHandler, self).compile_dependencies(
sourcepath,
include_sel... | [
"def",
"compile_dependencies",
"(",
"self",
",",
"sourcepath",
",",
"include_self",
"=",
"True",
")",
":",
"return",
"super",
"(",
"SassProjectEventHandler",
",",
"self",
")",
".",
"compile_dependencies",
"(",
"sourcepath",
",",
"include_self",
"=",
"include_self"... | Same as inherit method but the default value for keyword argument
``ìnclude_self`` is ``True``. | [
"Same",
"as",
"inherit",
"method",
"but",
"the",
"default",
"value",
"for",
"keyword",
"argument",
"ìnclude_self",
"is",
"True",
"."
] | train | https://github.com/sveetch/boussole/blob/22cc644e9d633f41ebfc167d427a71c1726cee21/boussole/watcher.py#L265-L273 |
1flow/python-ftr | ftr/process.py | requests_get | def requests_get(url):
""" Run :func:`requests.get` in a ``cached()`` wrapper.
The cache wrapper uses the default timeout (environment variable
``PYTHON_FTR_CACHE_TIMEOUT``, 3 days by default).
It is used in :func:`ftr_process`.
"""
LOGGER.info(u'Fetching %s…', url)
return requests.get(ur... | python | def requests_get(url):
""" Run :func:`requests.get` in a ``cached()`` wrapper.
The cache wrapper uses the default timeout (environment variable
``PYTHON_FTR_CACHE_TIMEOUT``, 3 days by default).
It is used in :func:`ftr_process`.
"""
LOGGER.info(u'Fetching %s…', url)
return requests.get(ur... | [
"def",
"requests_get",
"(",
"url",
")",
":",
"LOGGER",
".",
"info",
"(",
"u'Fetching %s…', ",
"u",
"l)",
"",
"return",
"requests",
".",
"get",
"(",
"url",
")"
] | Run :func:`requests.get` in a ``cached()`` wrapper.
The cache wrapper uses the default timeout (environment variable
``PYTHON_FTR_CACHE_TIMEOUT``, 3 days by default).
It is used in :func:`ftr_process`. | [
"Run",
":",
"func",
":",
"requests",
".",
"get",
"in",
"a",
"cached",
"()",
"wrapper",
"."
] | train | https://github.com/1flow/python-ftr/blob/90a2108c5ee005f1bf66dbe8cce68f2b7051b839/ftr/process.py#L65-L75 |
1flow/python-ftr | ftr/process.py | sanitize_next_page_link | def sanitize_next_page_link(next_page_link, base_url):
""" Convert relative links or query_string only links to absolute URLs. """
if not next_page_link.startswith(u'http'):
if next_page_link.startswith(u'?'):
# We have some "?current_page=2" scheme.
next_page_link = base_url + ... | python | def sanitize_next_page_link(next_page_link, base_url):
""" Convert relative links or query_string only links to absolute URLs. """
if not next_page_link.startswith(u'http'):
if next_page_link.startswith(u'?'):
# We have some "?current_page=2" scheme.
next_page_link = base_url + ... | [
"def",
"sanitize_next_page_link",
"(",
"next_page_link",
",",
"base_url",
")",
":",
"if",
"not",
"next_page_link",
".",
"startswith",
"(",
"u'http'",
")",
":",
"if",
"next_page_link",
".",
"startswith",
"(",
"u'?'",
")",
":",
"# We have some \"?current_page=2\" sche... | Convert relative links or query_string only links to absolute URLs. | [
"Convert",
"relative",
"links",
"or",
"query_string",
"only",
"links",
"to",
"absolute",
"URLs",
"."
] | train | https://github.com/1flow/python-ftr/blob/90a2108c5ee005f1bf66dbe8cce68f2b7051b839/ftr/process.py#L78-L106 |
1flow/python-ftr | ftr/process.py | ftr_process | def ftr_process(url=None, content=None, config=None, base_url=None):
u""" process an URL, or some already fetched content from a given URL.
:param url: The URL of article to extract. Can be
``None``, but only if you provide both ``content`` and
``config`` parameters.
:type url: str, unicode... | python | def ftr_process(url=None, content=None, config=None, base_url=None):
u""" process an URL, or some already fetched content from a given URL.
:param url: The URL of article to extract. Can be
``None``, but only if you provide both ``content`` and
``config`` parameters.
:type url: str, unicode... | [
"def",
"ftr_process",
"(",
"url",
"=",
"None",
",",
"content",
"=",
"None",
",",
"config",
"=",
"None",
",",
"base_url",
"=",
"None",
")",
":",
"if",
"url",
"is",
"None",
"and",
"content",
"is",
"None",
"and",
"config",
"is",
"None",
":",
"raise",
... | u""" process an URL, or some already fetched content from a given URL.
:param url: The URL of article to extract. Can be
``None``, but only if you provide both ``content`` and
``config`` parameters.
:type url: str, unicode or ``None``
:param content: the HTML content already downloaded. If... | [
"u",
"process",
"an",
"URL",
"or",
"some",
"already",
"fetched",
"content",
"from",
"a",
"given",
"URL",
"."
] | train | https://github.com/1flow/python-ftr/blob/90a2108c5ee005f1bf66dbe8cce68f2b7051b839/ftr/process.py#L109-L219 |
royi1000/py-libhdate | hdate/date.py | hebrew_number | def hebrew_number(num, hebrew=True, short=False):
"""Return "Gimatria" number."""
if not hebrew:
return str(num)
if not 0 <= num < 10000:
raise ValueError('num must be between 0 to 9999, got:{}'.format(num))
hstring = u""
if num >= 1000:
hstring += htables.DIGITS[0][num // 10... | python | def hebrew_number(num, hebrew=True, short=False):
"""Return "Gimatria" number."""
if not hebrew:
return str(num)
if not 0 <= num < 10000:
raise ValueError('num must be between 0 to 9999, got:{}'.format(num))
hstring = u""
if num >= 1000:
hstring += htables.DIGITS[0][num // 10... | [
"def",
"hebrew_number",
"(",
"num",
",",
"hebrew",
"=",
"True",
",",
"short",
"=",
"False",
")",
":",
"if",
"not",
"hebrew",
":",
"return",
"str",
"(",
"num",
")",
"if",
"not",
"0",
"<=",
"num",
"<",
"10000",
":",
"raise",
"ValueError",
"(",
"'num ... | Return "Gimatria" number. | [
"Return",
"Gimatria",
"number",
"."
] | train | https://github.com/royi1000/py-libhdate/blob/12af759fb69f1d6403abed3762beaf5ace16a34b/hdate/date.py#L425-L455 |
royi1000/py-libhdate | hdate/date.py | get_omer_string | def get_omer_string(omer): # pylint: disable=too-many-branches
"""Return a string representing the count of the Omer."""
# TODO: The following function should be simplified (see pylint)
tens = [u"", u"עשרה", u"עשרים", u"שלושים", u"ארבעים"]
ones = [u"", u"אחד", u"שנים", u"שלושה", u"ארבעה", u"חמשה",
... | python | def get_omer_string(omer): # pylint: disable=too-many-branches
"""Return a string representing the count of the Omer."""
# TODO: The following function should be simplified (see pylint)
tens = [u"", u"עשרה", u"עשרים", u"שלושים", u"ארבעים"]
ones = [u"", u"אחד", u"שנים", u"שלושה", u"ארבעה", u"חמשה",
... | [
"def",
"get_omer_string",
"(",
"omer",
")",
":",
"# pylint: disable=too-many-branches",
"# TODO: The following function should be simplified (see pylint)",
"tens",
"=",
"[",
"u\"\"",
",",
"u\"עשרה\", u\"",
"ע",
"רים\", u\"שלושי",
"ם",
", u\"ארבעים\"]",
"",
"",
"",
"ones",
... | Return a string representing the count of the Omer. | [
"Return",
"a",
"string",
"representing",
"the",
"count",
"of",
"the",
"Omer",
"."
] | train | https://github.com/royi1000/py-libhdate/blob/12af759fb69f1d6403abed3762beaf5ace16a34b/hdate/date.py#L458-L505 |
royi1000/py-libhdate | hdate/date.py | HDate.hdate | def hdate(self):
"""Return the hebrew date."""
if self._last_updated == "hdate":
return self._hdate
return conv.jdn_to_hdate(self._jdn) | python | def hdate(self):
"""Return the hebrew date."""
if self._last_updated == "hdate":
return self._hdate
return conv.jdn_to_hdate(self._jdn) | [
"def",
"hdate",
"(",
"self",
")",
":",
"if",
"self",
".",
"_last_updated",
"==",
"\"hdate\"",
":",
"return",
"self",
".",
"_hdate",
"return",
"conv",
".",
"jdn_to_hdate",
"(",
"self",
".",
"_jdn",
")"
] | Return the hebrew date. | [
"Return",
"the",
"hebrew",
"date",
"."
] | train | https://github.com/royi1000/py-libhdate/blob/12af759fb69f1d6403abed3762beaf5ace16a34b/hdate/date.py#L91-L95 |
royi1000/py-libhdate | hdate/date.py | HDate.hdate | def hdate(self, date):
"""Set the dates of the HDate object based on a given Hebrew date."""
# Sanity checks
if date is None and isinstance(self.gdate, datetime.date):
# Calculate the value since gdate has been set
date = self.hdate
if not isinstance(date, Hebrew... | python | def hdate(self, date):
"""Set the dates of the HDate object based on a given Hebrew date."""
# Sanity checks
if date is None and isinstance(self.gdate, datetime.date):
# Calculate the value since gdate has been set
date = self.hdate
if not isinstance(date, Hebrew... | [
"def",
"hdate",
"(",
"self",
",",
"date",
")",
":",
"# Sanity checks",
"if",
"date",
"is",
"None",
"and",
"isinstance",
"(",
"self",
".",
"gdate",
",",
"datetime",
".",
"date",
")",
":",
"# Calculate the value since gdate has been set",
"date",
"=",
"self",
... | Set the dates of the HDate object based on a given Hebrew date. | [
"Set",
"the",
"dates",
"of",
"the",
"HDate",
"object",
"based",
"on",
"a",
"given",
"Hebrew",
"date",
"."
] | train | https://github.com/royi1000/py-libhdate/blob/12af759fb69f1d6403abed3762beaf5ace16a34b/hdate/date.py#L98-L114 |
royi1000/py-libhdate | hdate/date.py | HDate.gdate | def gdate(self):
"""Return the Gregorian date for the given Hebrew date object."""
if self._last_updated == "gdate":
return self._gdate
return conv.jdn_to_gdate(self._jdn) | python | def gdate(self):
"""Return the Gregorian date for the given Hebrew date object."""
if self._last_updated == "gdate":
return self._gdate
return conv.jdn_to_gdate(self._jdn) | [
"def",
"gdate",
"(",
"self",
")",
":",
"if",
"self",
".",
"_last_updated",
"==",
"\"gdate\"",
":",
"return",
"self",
".",
"_gdate",
"return",
"conv",
".",
"jdn_to_gdate",
"(",
"self",
".",
"_jdn",
")"
] | Return the Gregorian date for the given Hebrew date object. | [
"Return",
"the",
"Gregorian",
"date",
"for",
"the",
"given",
"Hebrew",
"date",
"object",
"."
] | train | https://github.com/royi1000/py-libhdate/blob/12af759fb69f1d6403abed3762beaf5ace16a34b/hdate/date.py#L117-L121 |
royi1000/py-libhdate | hdate/date.py | HDate._jdn | def _jdn(self):
"""Return the Julian date number for the given date."""
if self._last_updated == "gdate":
return conv.gdate_to_jdn(self.gdate)
return conv.hdate_to_jdn(self.hdate) | python | def _jdn(self):
"""Return the Julian date number for the given date."""
if self._last_updated == "gdate":
return conv.gdate_to_jdn(self.gdate)
return conv.hdate_to_jdn(self.hdate) | [
"def",
"_jdn",
"(",
"self",
")",
":",
"if",
"self",
".",
"_last_updated",
"==",
"\"gdate\"",
":",
"return",
"conv",
".",
"gdate_to_jdn",
"(",
"self",
".",
"gdate",
")",
"return",
"conv",
".",
"hdate_to_jdn",
"(",
"self",
".",
"hdate",
")"
] | Return the Julian date number for the given date. | [
"Return",
"the",
"Julian",
"date",
"number",
"for",
"the",
"given",
"date",
"."
] | train | https://github.com/royi1000/py-libhdate/blob/12af759fb69f1d6403abed3762beaf5ace16a34b/hdate/date.py#L130-L134 |
royi1000/py-libhdate | hdate/date.py | HDate.hebrew_date | def hebrew_date(self):
"""Return the hebrew date string."""
return u"{} {} {}".format(
hebrew_number(self.hdate.day, hebrew=self.hebrew), # Day
htables.MONTHS[self.hdate.month - 1][self.hebrew], # Month
hebrew_number(self.hdate.year, hebrew=self.hebrew)) | python | def hebrew_date(self):
"""Return the hebrew date string."""
return u"{} {} {}".format(
hebrew_number(self.hdate.day, hebrew=self.hebrew), # Day
htables.MONTHS[self.hdate.month - 1][self.hebrew], # Month
hebrew_number(self.hdate.year, hebrew=self.hebrew)) | [
"def",
"hebrew_date",
"(",
"self",
")",
":",
"return",
"u\"{} {} {}\"",
".",
"format",
"(",
"hebrew_number",
"(",
"self",
".",
"hdate",
".",
"day",
",",
"hebrew",
"=",
"self",
".",
"hebrew",
")",
",",
"# Day",
"htables",
".",
"MONTHS",
"[",
"self",
"."... | Return the hebrew date string. | [
"Return",
"the",
"hebrew",
"date",
"string",
"."
] | train | https://github.com/royi1000/py-libhdate/blob/12af759fb69f1d6403abed3762beaf5ace16a34b/hdate/date.py#L137-L142 |
royi1000/py-libhdate | hdate/date.py | HDate.holiday_description | def holiday_description(self):
"""
Return the holiday description.
In case none exists will return None.
"""
entry = self._holiday_entry()
desc = entry.description
return desc.hebrew.long if self.hebrew else desc.english | python | def holiday_description(self):
"""
Return the holiday description.
In case none exists will return None.
"""
entry = self._holiday_entry()
desc = entry.description
return desc.hebrew.long if self.hebrew else desc.english | [
"def",
"holiday_description",
"(",
"self",
")",
":",
"entry",
"=",
"self",
".",
"_holiday_entry",
"(",
")",
"desc",
"=",
"entry",
".",
"description",
"return",
"desc",
".",
"hebrew",
".",
"long",
"if",
"self",
".",
"hebrew",
"else",
"desc",
".",
"english... | Return the holiday description.
In case none exists will return None. | [
"Return",
"the",
"holiday",
"description",
"."
] | train | https://github.com/royi1000/py-libhdate/blob/12af759fb69f1d6403abed3762beaf5ace16a34b/hdate/date.py#L150-L158 |
royi1000/py-libhdate | hdate/date.py | HDate._holiday_entry | def _holiday_entry(self):
"""Return the abstract holiday information from holidays table."""
holidays_list = self.get_holidays_for_year()
holidays_list = [
holiday for holiday, holiday_hdate in holidays_list if
holiday_hdate.hdate == self.hdate
]
assert le... | python | def _holiday_entry(self):
"""Return the abstract holiday information from holidays table."""
holidays_list = self.get_holidays_for_year()
holidays_list = [
holiday for holiday, holiday_hdate in holidays_list if
holiday_hdate.hdate == self.hdate
]
assert le... | [
"def",
"_holiday_entry",
"(",
"self",
")",
":",
"holidays_list",
"=",
"self",
".",
"get_holidays_for_year",
"(",
")",
"holidays_list",
"=",
"[",
"holiday",
"for",
"holiday",
",",
"holiday_hdate",
"in",
"holidays_list",
"if",
"holiday_hdate",
".",
"hdate",
"==",
... | Return the abstract holiday information from holidays table. | [
"Return",
"the",
"abstract",
"holiday",
"information",
"from",
"holidays",
"table",
"."
] | train | https://github.com/royi1000/py-libhdate/blob/12af759fb69f1d6403abed3762beaf5ace16a34b/hdate/date.py#L191-L201 |
royi1000/py-libhdate | hdate/date.py | HDate.rosh_hashana_dow | def rosh_hashana_dow(self):
"""Return the Hebrew day of week for Rosh Hashana."""
jdn = conv.hdate_to_jdn(HebrewDate(self.hdate.year, Months.Tishrei, 1))
return (jdn + 1) % 7 + 1 | python | def rosh_hashana_dow(self):
"""Return the Hebrew day of week for Rosh Hashana."""
jdn = conv.hdate_to_jdn(HebrewDate(self.hdate.year, Months.Tishrei, 1))
return (jdn + 1) % 7 + 1 | [
"def",
"rosh_hashana_dow",
"(",
"self",
")",
":",
"jdn",
"=",
"conv",
".",
"hdate_to_jdn",
"(",
"HebrewDate",
"(",
"self",
".",
"hdate",
".",
"year",
",",
"Months",
".",
"Tishrei",
",",
"1",
")",
")",
"return",
"(",
"jdn",
"+",
"1",
")",
"%",
"7",
... | Return the Hebrew day of week for Rosh Hashana. | [
"Return",
"the",
"Hebrew",
"day",
"of",
"week",
"for",
"Rosh",
"Hashana",
"."
] | train | https://github.com/royi1000/py-libhdate/blob/12af759fb69f1d6403abed3762beaf5ace16a34b/hdate/date.py#L217-L220 |
royi1000/py-libhdate | hdate/date.py | HDate.pesach_dow | def pesach_dow(self):
"""Return the first day of week for Pesach."""
jdn = conv.hdate_to_jdn(HebrewDate(self.hdate.year, Months.Nisan, 15))
return (jdn + 1) % 7 + 1 | python | def pesach_dow(self):
"""Return the first day of week for Pesach."""
jdn = conv.hdate_to_jdn(HebrewDate(self.hdate.year, Months.Nisan, 15))
return (jdn + 1) % 7 + 1 | [
"def",
"pesach_dow",
"(",
"self",
")",
":",
"jdn",
"=",
"conv",
".",
"hdate_to_jdn",
"(",
"HebrewDate",
"(",
"self",
".",
"hdate",
".",
"year",
",",
"Months",
".",
"Nisan",
",",
"15",
")",
")",
"return",
"(",
"jdn",
"+",
"1",
")",
"%",
"7",
"+",
... | Return the first day of week for Pesach. | [
"Return",
"the",
"first",
"day",
"of",
"week",
"for",
"Pesach",
"."
] | train | https://github.com/royi1000/py-libhdate/blob/12af759fb69f1d6403abed3762beaf5ace16a34b/hdate/date.py#L222-L225 |
royi1000/py-libhdate | hdate/date.py | HDate.omer_day | def omer_day(self):
"""Return the day of the Omer."""
first_omer_day = HebrewDate(self.hdate.year, Months.Nisan, 16)
omer_day = self._jdn - conv.hdate_to_jdn(first_omer_day) + 1
if not 0 < omer_day < 50:
return 0
return omer_day | python | def omer_day(self):
"""Return the day of the Omer."""
first_omer_day = HebrewDate(self.hdate.year, Months.Nisan, 16)
omer_day = self._jdn - conv.hdate_to_jdn(first_omer_day) + 1
if not 0 < omer_day < 50:
return 0
return omer_day | [
"def",
"omer_day",
"(",
"self",
")",
":",
"first_omer_day",
"=",
"HebrewDate",
"(",
"self",
".",
"hdate",
".",
"year",
",",
"Months",
".",
"Nisan",
",",
"16",
")",
"omer_day",
"=",
"self",
".",
"_jdn",
"-",
"conv",
".",
"hdate_to_jdn",
"(",
"first_omer... | Return the day of the Omer. | [
"Return",
"the",
"day",
"of",
"the",
"Omer",
"."
] | train | https://github.com/royi1000/py-libhdate/blob/12af759fb69f1d6403abed3762beaf5ace16a34b/hdate/date.py#L228-L234 |
royi1000/py-libhdate | hdate/date.py | HDate.next_day | def next_day(self):
"""Return the HDate for the next day."""
return HDate(self.gdate + datetime.timedelta(1), self.diaspora,
self.hebrew) | python | def next_day(self):
"""Return the HDate for the next day."""
return HDate(self.gdate + datetime.timedelta(1), self.diaspora,
self.hebrew) | [
"def",
"next_day",
"(",
"self",
")",
":",
"return",
"HDate",
"(",
"self",
".",
"gdate",
"+",
"datetime",
".",
"timedelta",
"(",
"1",
")",
",",
"self",
".",
"diaspora",
",",
"self",
".",
"hebrew",
")"
] | Return the HDate for the next day. | [
"Return",
"the",
"HDate",
"for",
"the",
"next",
"day",
"."
] | train | https://github.com/royi1000/py-libhdate/blob/12af759fb69f1d6403abed3762beaf5ace16a34b/hdate/date.py#L237-L240 |
royi1000/py-libhdate | hdate/date.py | HDate.previous_day | def previous_day(self):
"""Return the HDate for the previous day."""
return HDate(self.gdate + datetime.timedelta(-1), self.diaspora,
self.hebrew) | python | def previous_day(self):
"""Return the HDate for the previous day."""
return HDate(self.gdate + datetime.timedelta(-1), self.diaspora,
self.hebrew) | [
"def",
"previous_day",
"(",
"self",
")",
":",
"return",
"HDate",
"(",
"self",
".",
"gdate",
"+",
"datetime",
".",
"timedelta",
"(",
"-",
"1",
")",
",",
"self",
".",
"diaspora",
",",
"self",
".",
"hebrew",
")"
] | Return the HDate for the previous day. | [
"Return",
"the",
"HDate",
"for",
"the",
"previous",
"day",
"."
] | train | https://github.com/royi1000/py-libhdate/blob/12af759fb69f1d6403abed3762beaf5ace16a34b/hdate/date.py#L243-L246 |
royi1000/py-libhdate | hdate/date.py | HDate.upcoming_shabbat | def upcoming_shabbat(self):
"""Return the HDate for either the upcoming or current Shabbat.
If it is currently Shabbat, returns the HDate of the Saturday.
"""
if self.is_shabbat:
return self
# If it's Sunday, fast forward to the next Shabbat.
saturday = self.... | python | def upcoming_shabbat(self):
"""Return the HDate for either the upcoming or current Shabbat.
If it is currently Shabbat, returns the HDate of the Saturday.
"""
if self.is_shabbat:
return self
# If it's Sunday, fast forward to the next Shabbat.
saturday = self.... | [
"def",
"upcoming_shabbat",
"(",
"self",
")",
":",
"if",
"self",
".",
"is_shabbat",
":",
"return",
"self",
"# If it's Sunday, fast forward to the next Shabbat.",
"saturday",
"=",
"self",
".",
"gdate",
"+",
"datetime",
".",
"timedelta",
"(",
"(",
"12",
"-",
"self"... | Return the HDate for either the upcoming or current Shabbat.
If it is currently Shabbat, returns the HDate of the Saturday. | [
"Return",
"the",
"HDate",
"for",
"either",
"the",
"upcoming",
"or",
"current",
"Shabbat",
"."
] | train | https://github.com/royi1000/py-libhdate/blob/12af759fb69f1d6403abed3762beaf5ace16a34b/hdate/date.py#L249-L259 |
royi1000/py-libhdate | hdate/date.py | HDate.upcoming_shabbat_or_yom_tov | def upcoming_shabbat_or_yom_tov(self):
"""Return the HDate for the upcoming or current Shabbat or Yom Tov.
If it is currently Shabbat, returns the HDate of the Saturday.
If it is currently Yom Tov, returns the HDate of the first day
(rather than "leil" Yom Tov). To access Leil Yom Tov, ... | python | def upcoming_shabbat_or_yom_tov(self):
"""Return the HDate for the upcoming or current Shabbat or Yom Tov.
If it is currently Shabbat, returns the HDate of the Saturday.
If it is currently Yom Tov, returns the HDate of the first day
(rather than "leil" Yom Tov). To access Leil Yom Tov, ... | [
"def",
"upcoming_shabbat_or_yom_tov",
"(",
"self",
")",
":",
"if",
"self",
".",
"is_shabbat",
"or",
"self",
".",
"is_yom_tov",
":",
"return",
"self",
"if",
"self",
".",
"upcoming_yom_tov",
"<",
"self",
".",
"upcoming_shabbat",
":",
"return",
"self",
".",
"up... | Return the HDate for the upcoming or current Shabbat or Yom Tov.
If it is currently Shabbat, returns the HDate of the Saturday.
If it is currently Yom Tov, returns the HDate of the first day
(rather than "leil" Yom Tov). To access Leil Yom Tov, use
upcoming_shabbat_or_yom_tov.previous_d... | [
"Return",
"the",
"HDate",
"for",
"the",
"upcoming",
"or",
"current",
"Shabbat",
"or",
"Yom",
"Tov",
"."
] | train | https://github.com/royi1000/py-libhdate/blob/12af759fb69f1d6403abed3762beaf5ace16a34b/hdate/date.py#L262-L275 |
royi1000/py-libhdate | hdate/date.py | HDate.first_day | def first_day(self):
"""Return the first day of Yom Tov or Shabbat.
This is useful for three-day holidays, for example: it will return the
first in a string of Yom Tov + Shabbat.
If this HDate is Shabbat followed by no Yom Tov, returns the Saturday.
If this HDate is neither Yom ... | python | def first_day(self):
"""Return the first day of Yom Tov or Shabbat.
This is useful for three-day holidays, for example: it will return the
first in a string of Yom Tov + Shabbat.
If this HDate is Shabbat followed by no Yom Tov, returns the Saturday.
If this HDate is neither Yom ... | [
"def",
"first_day",
"(",
"self",
")",
":",
"day_iter",
"=",
"self",
"while",
"(",
"day_iter",
".",
"previous_day",
".",
"is_yom_tov",
"or",
"day_iter",
".",
"previous_day",
".",
"is_shabbat",
")",
":",
"day_iter",
"=",
"day_iter",
".",
"previous_day",
"retur... | Return the first day of Yom Tov or Shabbat.
This is useful for three-day holidays, for example: it will return the
first in a string of Yom Tov + Shabbat.
If this HDate is Shabbat followed by no Yom Tov, returns the Saturday.
If this HDate is neither Yom Tov, nor Shabbat, this just retu... | [
"Return",
"the",
"first",
"day",
"of",
"Yom",
"Tov",
"or",
"Shabbat",
"."
] | train | https://github.com/royi1000/py-libhdate/blob/12af759fb69f1d6403abed3762beaf5ace16a34b/hdate/date.py#L278-L291 |
royi1000/py-libhdate | hdate/date.py | HDate.last_day | def last_day(self):
"""Return the last day of Yom Tov or Shabbat.
This is useful for three-day holidays, for example: it will return the
last in a string of Yom Tov + Shabbat.
If this HDate is Shabbat followed by no Yom Tov, returns the Saturday.
If this HDate is neither Yom Tov... | python | def last_day(self):
"""Return the last day of Yom Tov or Shabbat.
This is useful for three-day holidays, for example: it will return the
last in a string of Yom Tov + Shabbat.
If this HDate is Shabbat followed by no Yom Tov, returns the Saturday.
If this HDate is neither Yom Tov... | [
"def",
"last_day",
"(",
"self",
")",
":",
"day_iter",
"=",
"self",
"while",
"day_iter",
".",
"next_day",
".",
"is_yom_tov",
"or",
"day_iter",
".",
"next_day",
".",
"is_shabbat",
":",
"day_iter",
"=",
"day_iter",
".",
"next_day",
"return",
"day_iter"
] | Return the last day of Yom Tov or Shabbat.
This is useful for three-day holidays, for example: it will return the
last in a string of Yom Tov + Shabbat.
If this HDate is Shabbat followed by no Yom Tov, returns the Saturday.
If this HDate is neither Yom Tov, nor Shabbat, this just return... | [
"Return",
"the",
"last",
"day",
"of",
"Yom",
"Tov",
"or",
"Shabbat",
"."
] | train | https://github.com/royi1000/py-libhdate/blob/12af759fb69f1d6403abed3762beaf5ace16a34b/hdate/date.py#L294-L306 |
royi1000/py-libhdate | hdate/date.py | HDate.get_holidays_for_year | def get_holidays_for_year(self, types=None):
"""Get all the actual holiday days for a given HDate's year.
If specified, use the list of types to limit the holidays returned.
"""
# Filter any non-related holidays depending on Israel/Diaspora only
holidays_list = [
hol... | python | def get_holidays_for_year(self, types=None):
"""Get all the actual holiday days for a given HDate's year.
If specified, use the list of types to limit the holidays returned.
"""
# Filter any non-related holidays depending on Israel/Diaspora only
holidays_list = [
hol... | [
"def",
"get_holidays_for_year",
"(",
"self",
",",
"types",
"=",
"None",
")",
":",
"# Filter any non-related holidays depending on Israel/Diaspora only",
"holidays_list",
"=",
"[",
"holiday",
"for",
"holiday",
"in",
"htables",
".",
"HOLIDAYS",
"if",
"(",
"holiday",
"."... | Get all the actual holiday days for a given HDate's year.
If specified, use the list of types to limit the holidays returned. | [
"Get",
"all",
"the",
"actual",
"holiday",
"days",
"for",
"a",
"given",
"HDate",
"s",
"year",
"."
] | train | https://github.com/royi1000/py-libhdate/blob/12af759fb69f1d6403abed3762beaf5ace16a34b/hdate/date.py#L308-L352 |
royi1000/py-libhdate | hdate/date.py | HDate.upcoming_yom_tov | def upcoming_yom_tov(self):
"""Find the next upcoming yom tov (i.e. no-melacha holiday).
If it is currently the day of yom tov (irrespective of zmanim), returns
that yom tov.
"""
if self.is_yom_tov:
return self
this_year = self.get_holidays_for_year([HolidayT... | python | def upcoming_yom_tov(self):
"""Find the next upcoming yom tov (i.e. no-melacha holiday).
If it is currently the day of yom tov (irrespective of zmanim), returns
that yom tov.
"""
if self.is_yom_tov:
return self
this_year = self.get_holidays_for_year([HolidayT... | [
"def",
"upcoming_yom_tov",
"(",
"self",
")",
":",
"if",
"self",
".",
"is_yom_tov",
":",
"return",
"self",
"this_year",
"=",
"self",
".",
"get_holidays_for_year",
"(",
"[",
"HolidayTypes",
".",
"YOM_TOV",
"]",
")",
"next_rosh_hashana",
"=",
"HDate",
"(",
"heb... | Find the next upcoming yom tov (i.e. no-melacha holiday).
If it is currently the day of yom tov (irrespective of zmanim), returns
that yom tov. | [
"Find",
"the",
"next",
"upcoming",
"yom",
"tov",
"(",
"i",
".",
"e",
".",
"no",
"-",
"melacha",
"holiday",
")",
"."
] | train | https://github.com/royi1000/py-libhdate/blob/12af759fb69f1d6403abed3762beaf5ace16a34b/hdate/date.py#L355-L379 |
royi1000/py-libhdate | hdate/date.py | HDate.get_reading | def get_reading(self):
"""Return number of hebrew parasha."""
_year_type = (self.year_size() % 10) - 3
year_type = (
self.diaspora * 1000 +
self.rosh_hashana_dow() * 100 +
_year_type * 10 +
self.pesach_dow())
_LOGGER.debug("Year type: %d",... | python | def get_reading(self):
"""Return number of hebrew parasha."""
_year_type = (self.year_size() % 10) - 3
year_type = (
self.diaspora * 1000 +
self.rosh_hashana_dow() * 100 +
_year_type * 10 +
self.pesach_dow())
_LOGGER.debug("Year type: %d",... | [
"def",
"get_reading",
"(",
"self",
")",
":",
"_year_type",
"=",
"(",
"self",
".",
"year_size",
"(",
")",
"%",
"10",
")",
"-",
"3",
"year_type",
"=",
"(",
"self",
".",
"diaspora",
"*",
"1000",
"+",
"self",
".",
"rosh_hashana_dow",
"(",
")",
"*",
"10... | Return number of hebrew parasha. | [
"Return",
"number",
"of",
"hebrew",
"parasha",
"."
] | train | https://github.com/royi1000/py-libhdate/blob/12af759fb69f1d6403abed3762beaf5ace16a34b/hdate/date.py#L381-L422 |
cgarciae/dataget | dataget/cli.py | ls | def ls(ctx, available):
"List installed datasets on path"
path = ctx.obj['path']
global_ = ctx.obj['global_']
_ls(available=available, **ctx.obj) | python | def ls(ctx, available):
"List installed datasets on path"
path = ctx.obj['path']
global_ = ctx.obj['global_']
_ls(available=available, **ctx.obj) | [
"def",
"ls",
"(",
"ctx",
",",
"available",
")",
":",
"path",
"=",
"ctx",
".",
"obj",
"[",
"'path'",
"]",
"global_",
"=",
"ctx",
".",
"obj",
"[",
"'global_'",
"]",
"_ls",
"(",
"available",
"=",
"available",
",",
"*",
"*",
"ctx",
".",
"obj",
")"
] | List installed datasets on path | [
"List",
"installed",
"datasets",
"on",
"path"
] | train | https://github.com/cgarciae/dataget/blob/04d3d9c68ebdcbed103605731a1be0f26e1c36fa/dataget/cli.py#L42-L48 |
cgarciae/dataget | dataget/cli.py | reqs | def reqs(ctx, dataset, kwargs):
"Get the dataset's pip requirements"
kwargs = parse_kwargs(kwargs)
(print)(data(dataset, **ctx.obj).reqs(**kwargs)) | python | def reqs(ctx, dataset, kwargs):
"Get the dataset's pip requirements"
kwargs = parse_kwargs(kwargs)
(print)(data(dataset, **ctx.obj).reqs(**kwargs)) | [
"def",
"reqs",
"(",
"ctx",
",",
"dataset",
",",
"kwargs",
")",
":",
"kwargs",
"=",
"parse_kwargs",
"(",
"kwargs",
")",
"(",
"print",
")",
"(",
"data",
"(",
"dataset",
",",
"*",
"*",
"ctx",
".",
"obj",
")",
".",
"reqs",
"(",
"*",
"*",
"kwargs",
... | Get the dataset's pip requirements | [
"Get",
"the",
"dataset",
"s",
"pip",
"requirements"
] | train | https://github.com/cgarciae/dataget/blob/04d3d9c68ebdcbed103605731a1be0f26e1c36fa/dataget/cli.py#L54-L58 |
cgarciae/dataget | dataget/cli.py | size | def size(ctx, dataset, kwargs):
"Show dataset size"
kwargs = parse_kwargs(kwargs)
(print)(data(dataset, **ctx.obj).get(**kwargs).complete_set.size) | python | def size(ctx, dataset, kwargs):
"Show dataset size"
kwargs = parse_kwargs(kwargs)
(print)(data(dataset, **ctx.obj).get(**kwargs).complete_set.size) | [
"def",
"size",
"(",
"ctx",
",",
"dataset",
",",
"kwargs",
")",
":",
"kwargs",
"=",
"parse_kwargs",
"(",
"kwargs",
")",
"(",
"print",
")",
"(",
"data",
"(",
"dataset",
",",
"*",
"*",
"ctx",
".",
"obj",
")",
".",
"get",
"(",
"*",
"*",
"kwargs",
"... | Show dataset size | [
"Show",
"dataset",
"size"
] | train | https://github.com/cgarciae/dataget/blob/04d3d9c68ebdcbed103605731a1be0f26e1c36fa/dataget/cli.py#L65-L69 |
cgarciae/dataget | dataget/cli.py | get | def get(ctx, dataset, rm, keep_compressed, dont_process, dont_download, keep_raw, kwargs):
"performs the operations download, extract, rm_compressed, processes and rm_raw, in sequence. KWARGS must be in the form: key=value, and are fowarded to all opeartions."
kwargs = parse_kwargs(kwargs)
process = not d... | python | def get(ctx, dataset, rm, keep_compressed, dont_process, dont_download, keep_raw, kwargs):
"performs the operations download, extract, rm_compressed, processes and rm_raw, in sequence. KWARGS must be in the form: key=value, and are fowarded to all opeartions."
kwargs = parse_kwargs(kwargs)
process = not d... | [
"def",
"get",
"(",
"ctx",
",",
"dataset",
",",
"rm",
",",
"keep_compressed",
",",
"dont_process",
",",
"dont_download",
",",
"keep_raw",
",",
"kwargs",
")",
":",
"kwargs",
"=",
"parse_kwargs",
"(",
"kwargs",
")",
"process",
"=",
"not",
"dont_process",
"rm_... | performs the operations download, extract, rm_compressed, processes and rm_raw, in sequence. KWARGS must be in the form: key=value, and are fowarded to all opeartions. | [
"performs",
"the",
"operations",
"download",
"extract",
"rm_compressed",
"processes",
"and",
"rm_raw",
"in",
"sequence",
".",
"KWARGS",
"must",
"be",
"in",
"the",
"form",
":",
"key",
"=",
"value",
"and",
"are",
"fowarded",
"to",
"all",
"opeartions",
"."
] | train | https://github.com/cgarciae/dataget/blob/04d3d9c68ebdcbed103605731a1be0f26e1c36fa/dataget/cli.py#L81-L91 |
cgarciae/dataget | dataget/cli.py | rm | def rm(ctx, dataset, kwargs):
"removes the dataset's folder if it exists"
kwargs = parse_kwargs(kwargs)
data(dataset, **ctx.obj).rm(**kwargs) | python | def rm(ctx, dataset, kwargs):
"removes the dataset's folder if it exists"
kwargs = parse_kwargs(kwargs)
data(dataset, **ctx.obj).rm(**kwargs) | [
"def",
"rm",
"(",
"ctx",
",",
"dataset",
",",
"kwargs",
")",
":",
"kwargs",
"=",
"parse_kwargs",
"(",
"kwargs",
")",
"data",
"(",
"dataset",
",",
"*",
"*",
"ctx",
".",
"obj",
")",
".",
"rm",
"(",
"*",
"*",
"kwargs",
")"
] | removes the dataset's folder if it exists | [
"removes",
"the",
"dataset",
"s",
"folder",
"if",
"it",
"exists"
] | train | https://github.com/cgarciae/dataget/blob/04d3d9c68ebdcbed103605731a1be0f26e1c36fa/dataget/cli.py#L98-L102 |
cgarciae/dataget | dataget/cli.py | rm_subsets | def rm_subsets(ctx, dataset, kwargs):
"removes the dataset's training-set and test-set folders if they exists"
kwargs = parse_kwargs(kwargs)
data(dataset, **ctx.obj).rm_subsets(**kwargs) | python | def rm_subsets(ctx, dataset, kwargs):
"removes the dataset's training-set and test-set folders if they exists"
kwargs = parse_kwargs(kwargs)
data(dataset, **ctx.obj).rm_subsets(**kwargs) | [
"def",
"rm_subsets",
"(",
"ctx",
",",
"dataset",
",",
"kwargs",
")",
":",
"kwargs",
"=",
"parse_kwargs",
"(",
"kwargs",
")",
"data",
"(",
"dataset",
",",
"*",
"*",
"ctx",
".",
"obj",
")",
".",
"rm_subsets",
"(",
"*",
"*",
"kwargs",
")"
] | removes the dataset's training-set and test-set folders if they exists | [
"removes",
"the",
"dataset",
"s",
"training",
"-",
"set",
"and",
"test",
"-",
"set",
"folders",
"if",
"they",
"exists"
] | train | https://github.com/cgarciae/dataget/blob/04d3d9c68ebdcbed103605731a1be0f26e1c36fa/dataget/cli.py#L108-L112 |
cgarciae/dataget | dataget/cli.py | extract | def extract(ctx, dataset, kwargs):
"extracts the files from the compressed archives"
kwargs = parse_kwargs(kwargs)
data(dataset, **ctx.obj).extract(**kwargs) | python | def extract(ctx, dataset, kwargs):
"extracts the files from the compressed archives"
kwargs = parse_kwargs(kwargs)
data(dataset, **ctx.obj).extract(**kwargs) | [
"def",
"extract",
"(",
"ctx",
",",
"dataset",
",",
"kwargs",
")",
":",
"kwargs",
"=",
"parse_kwargs",
"(",
"kwargs",
")",
"data",
"(",
"dataset",
",",
"*",
"*",
"ctx",
".",
"obj",
")",
".",
"extract",
"(",
"*",
"*",
"kwargs",
")"
] | extracts the files from the compressed archives | [
"extracts",
"the",
"files",
"from",
"the",
"compressed",
"archives"
] | train | https://github.com/cgarciae/dataget/blob/04d3d9c68ebdcbed103605731a1be0f26e1c36fa/dataget/cli.py#L129-L133 |
cgarciae/dataget | dataget/cli.py | rm_compressed | def rm_compressed(ctx, dataset, kwargs):
"removes the compressed files"
kwargs = parse_kwargs(kwargs)
data(dataset, **ctx.obj).rm_compressed(**kwargs) | python | def rm_compressed(ctx, dataset, kwargs):
"removes the compressed files"
kwargs = parse_kwargs(kwargs)
data(dataset, **ctx.obj).rm_compressed(**kwargs) | [
"def",
"rm_compressed",
"(",
"ctx",
",",
"dataset",
",",
"kwargs",
")",
":",
"kwargs",
"=",
"parse_kwargs",
"(",
"kwargs",
")",
"data",
"(",
"dataset",
",",
"*",
"*",
"ctx",
".",
"obj",
")",
".",
"rm_compressed",
"(",
"*",
"*",
"kwargs",
")"
] | removes the compressed files | [
"removes",
"the",
"compressed",
"files"
] | train | https://github.com/cgarciae/dataget/blob/04d3d9c68ebdcbed103605731a1be0f26e1c36fa/dataget/cli.py#L140-L144 |
cgarciae/dataget | dataget/cli.py | process | def process(ctx, dataset, kwargs):
"processes the data to a friendly format"
kwargs = parse_kwargs(kwargs)
data(dataset, **ctx.obj).process(**kwargs) | python | def process(ctx, dataset, kwargs):
"processes the data to a friendly format"
kwargs = parse_kwargs(kwargs)
data(dataset, **ctx.obj).process(**kwargs) | [
"def",
"process",
"(",
"ctx",
",",
"dataset",
",",
"kwargs",
")",
":",
"kwargs",
"=",
"parse_kwargs",
"(",
"kwargs",
")",
"data",
"(",
"dataset",
",",
"*",
"*",
"ctx",
".",
"obj",
")",
".",
"process",
"(",
"*",
"*",
"kwargs",
")"
] | processes the data to a friendly format | [
"processes",
"the",
"data",
"to",
"a",
"friendly",
"format"
] | train | https://github.com/cgarciae/dataget/blob/04d3d9c68ebdcbed103605731a1be0f26e1c36fa/dataget/cli.py#L150-L154 |
cgarciae/dataget | dataget/cli.py | rm_raw | def rm_raw(ctx, dataset, kwargs):
"removes the raw unprocessed data"
kwargs = parse_kwargs(kwargs)
data(dataset, **ctx.obj).rm_raw(**kwargs) | python | def rm_raw(ctx, dataset, kwargs):
"removes the raw unprocessed data"
kwargs = parse_kwargs(kwargs)
data(dataset, **ctx.obj).rm_raw(**kwargs) | [
"def",
"rm_raw",
"(",
"ctx",
",",
"dataset",
",",
"kwargs",
")",
":",
"kwargs",
"=",
"parse_kwargs",
"(",
"kwargs",
")",
"data",
"(",
"dataset",
",",
"*",
"*",
"ctx",
".",
"obj",
")",
".",
"rm_raw",
"(",
"*",
"*",
"kwargs",
")"
] | removes the raw unprocessed data | [
"removes",
"the",
"raw",
"unprocessed",
"data"
] | train | https://github.com/cgarciae/dataget/blob/04d3d9c68ebdcbed103605731a1be0f26e1c36fa/dataget/cli.py#L161-L165 |
chbrown/viz | viz/geom.py | hist | def hist(xs, range=None, margin=10, width=None):
'''
xs: array of numbers, preferably an np.array, can contain nans, infinities
range: (minimum, maximum) tuple of numbers (defaults to (min, max) of xs)
margin: number of characters to use for the min-max labels (default: 10)
width: number of characte... | python | def hist(xs, range=None, margin=10, width=None):
'''
xs: array of numbers, preferably an np.array, can contain nans, infinities
range: (minimum, maximum) tuple of numbers (defaults to (min, max) of xs)
margin: number of characters to use for the min-max labels (default: 10)
width: number of characte... | [
"def",
"hist",
"(",
"xs",
",",
"range",
"=",
"None",
",",
"margin",
"=",
"10",
",",
"width",
"=",
"None",
")",
":",
"if",
"width",
"is",
"None",
":",
"width",
"=",
"terminal",
".",
"width",
"(",
")",
"# add 1 to each margin for the [ and ] brackets",
"n_... | xs: array of numbers, preferably an np.array, can contain nans, infinities
range: (minimum, maximum) tuple of numbers (defaults to (min, max) of xs)
margin: number of characters to use for the min-max labels (default: 10)
width: number of characters that will fit in a row (defaults to your terminal width)
... | [
"xs",
":",
"array",
"of",
"numbers",
"preferably",
"an",
"np",
".",
"array",
"can",
"contain",
"nans",
"infinities",
"range",
":",
"(",
"minimum",
"maximum",
")",
"tuple",
"of",
"numbers",
"(",
"defaults",
"to",
"(",
"min",
"max",
")",
"of",
"xs",
")",... | train | https://github.com/chbrown/viz/blob/683a8f91630582d74250690a0e8ea7743ab94058/viz/geom.py#L14-L57 |
chbrown/viz | viz/geom.py | points | def points(ys, width=None):
'''Usage:
import scipy.stats
def walk(steps, position=0):
for step in steps:
position += step
yield position
positions = list(walk(scipy.stats.norm.rvs(size=1000)))
points(positions)
'''
if width is None:
width = terminal.wi... | python | def points(ys, width=None):
'''Usage:
import scipy.stats
def walk(steps, position=0):
for step in steps:
position += step
yield position
positions = list(walk(scipy.stats.norm.rvs(size=1000)))
points(positions)
'''
if width is None:
width = terminal.wi... | [
"def",
"points",
"(",
"ys",
",",
"width",
"=",
"None",
")",
":",
"if",
"width",
"is",
"None",
":",
"width",
"=",
"terminal",
".",
"width",
"(",
")",
"ys",
"=",
"np",
".",
"array",
"(",
"ys",
")",
"n",
"=",
"len",
"(",
"ys",
")",
"y_min",
",",... | Usage:
import scipy.stats
def walk(steps, position=0):
for step in steps:
position += step
yield position
positions = list(walk(scipy.stats.norm.rvs(size=1000)))
points(positions) | [
"Usage",
":",
"import",
"scipy",
".",
"stats",
"def",
"walk",
"(",
"steps",
"position",
"=",
"0",
")",
":",
"for",
"step",
"in",
"steps",
":",
"position",
"+",
"=",
"step",
"yield",
"position",
"positions",
"=",
"list",
"(",
"walk",
"(",
"scipy",
"."... | train | https://github.com/chbrown/viz/blob/683a8f91630582d74250690a0e8ea7743ab94058/viz/geom.py#L60-L93 |
grahambell/pymoc | lib/pymoc/io/fits.py | write_moc_fits_hdu | def write_moc_fits_hdu(moc):
"""Create a FITS table HDU representation of a MOC.
"""
# Ensure data are normalized.
moc.normalize()
# Determine whether a 32 or 64 bit column is required.
if moc.order < 14:
moc_type = np.int32
col_type = 'J'
else:
moc_type = np.int64
... | python | def write_moc_fits_hdu(moc):
"""Create a FITS table HDU representation of a MOC.
"""
# Ensure data are normalized.
moc.normalize()
# Determine whether a 32 or 64 bit column is required.
if moc.order < 14:
moc_type = np.int32
col_type = 'J'
else:
moc_type = np.int64
... | [
"def",
"write_moc_fits_hdu",
"(",
"moc",
")",
":",
"# Ensure data are normalized.",
"moc",
".",
"normalize",
"(",
")",
"# Determine whether a 32 or 64 bit column is required.",
"if",
"moc",
".",
"order",
"<",
"14",
":",
"moc_type",
"=",
"np",
".",
"int32",
"col_type... | Create a FITS table HDU representation of a MOC. | [
"Create",
"a",
"FITS",
"table",
"HDU",
"representation",
"of",
"a",
"MOC",
"."
] | train | https://github.com/grahambell/pymoc/blob/0e2e57ce07ff3de6ac024627c1fb6ad30c2fde48/lib/pymoc/io/fits.py#L35-L99 |
grahambell/pymoc | lib/pymoc/io/fits.py | write_moc_fits | def write_moc_fits(moc, filename, **kwargs):
"""Write a MOC as a FITS file.
Any additional keyword arguments are passed to the
astropy.io.fits.HDUList.writeto method.
"""
tbhdu = write_moc_fits_hdu(moc)
prihdr = fits.Header()
prihdu = fits.PrimaryHDU(header=prihdr)
hdulist = fits.HDULi... | python | def write_moc_fits(moc, filename, **kwargs):
"""Write a MOC as a FITS file.
Any additional keyword arguments are passed to the
astropy.io.fits.HDUList.writeto method.
"""
tbhdu = write_moc_fits_hdu(moc)
prihdr = fits.Header()
prihdu = fits.PrimaryHDU(header=prihdr)
hdulist = fits.HDULi... | [
"def",
"write_moc_fits",
"(",
"moc",
",",
"filename",
",",
"*",
"*",
"kwargs",
")",
":",
"tbhdu",
"=",
"write_moc_fits_hdu",
"(",
"moc",
")",
"prihdr",
"=",
"fits",
".",
"Header",
"(",
")",
"prihdu",
"=",
"fits",
".",
"PrimaryHDU",
"(",
"header",
"=",
... | Write a MOC as a FITS file.
Any additional keyword arguments are passed to the
astropy.io.fits.HDUList.writeto method. | [
"Write",
"a",
"MOC",
"as",
"a",
"FITS",
"file",
"."
] | train | https://github.com/grahambell/pymoc/blob/0e2e57ce07ff3de6ac024627c1fb6ad30c2fde48/lib/pymoc/io/fits.py#L102-L113 |
grahambell/pymoc | lib/pymoc/io/fits.py | read_moc_fits | def read_moc_fits(moc, filename, include_meta=False, **kwargs):
"""Read data from a FITS file into a MOC.
Any additional keyword arguments are passed to the
astropy.io.fits.open method.
"""
hl = fits.open(filename, mode='readonly', **kwargs)
read_moc_fits_hdu(moc, hl[1], include_meta) | python | def read_moc_fits(moc, filename, include_meta=False, **kwargs):
"""Read data from a FITS file into a MOC.
Any additional keyword arguments are passed to the
astropy.io.fits.open method.
"""
hl = fits.open(filename, mode='readonly', **kwargs)
read_moc_fits_hdu(moc, hl[1], include_meta) | [
"def",
"read_moc_fits",
"(",
"moc",
",",
"filename",
",",
"include_meta",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"hl",
"=",
"fits",
".",
"open",
"(",
"filename",
",",
"mode",
"=",
"'readonly'",
",",
"*",
"*",
"kwargs",
")",
"read_moc_fits_hdu... | Read data from a FITS file into a MOC.
Any additional keyword arguments are passed to the
astropy.io.fits.open method. | [
"Read",
"data",
"from",
"a",
"FITS",
"file",
"into",
"a",
"MOC",
"."
] | train | https://github.com/grahambell/pymoc/blob/0e2e57ce07ff3de6ac024627c1fb6ad30c2fde48/lib/pymoc/io/fits.py#L116-L125 |
grahambell/pymoc | lib/pymoc/io/fits.py | read_moc_fits_hdu | def read_moc_fits_hdu(moc, hdu, include_meta=False):
"""Read data from a FITS table HDU into a MOC.
"""
if include_meta:
header = hdu.header
if 'MOCTYPE' in header:
moc.type = header['MOCTYPE']
if 'MOCID' in header:
moc.id = header['MOCID']
if 'ORIGI... | python | def read_moc_fits_hdu(moc, hdu, include_meta=False):
"""Read data from a FITS table HDU into a MOC.
"""
if include_meta:
header = hdu.header
if 'MOCTYPE' in header:
moc.type = header['MOCTYPE']
if 'MOCID' in header:
moc.id = header['MOCID']
if 'ORIGI... | [
"def",
"read_moc_fits_hdu",
"(",
"moc",
",",
"hdu",
",",
"include_meta",
"=",
"False",
")",
":",
"if",
"include_meta",
":",
"header",
"=",
"hdu",
".",
"header",
"if",
"'MOCTYPE'",
"in",
"header",
":",
"moc",
".",
"type",
"=",
"header",
"[",
"'MOCTYPE'",
... | Read data from a FITS table HDU into a MOC. | [
"Read",
"data",
"from",
"a",
"FITS",
"table",
"HDU",
"into",
"a",
"MOC",
"."
] | train | https://github.com/grahambell/pymoc/blob/0e2e57ce07ff3de6ac024627c1fb6ad30c2fde48/lib/pymoc/io/fits.py#L128-L167 |
abingham/spor | src/spor/alignment/smith_waterman.py | _tracebacks | def _tracebacks(score_matrix, traceback_matrix, idx):
"""Implementation of traceeback.
This version can produce empty tracebacks, which we generally don't want
users seeing. So the higher level `tracebacks` filters those out.
"""
score = score_matrix[idx]
if score == 0:
yield ()
... | python | def _tracebacks(score_matrix, traceback_matrix, idx):
"""Implementation of traceeback.
This version can produce empty tracebacks, which we generally don't want
users seeing. So the higher level `tracebacks` filters those out.
"""
score = score_matrix[idx]
if score == 0:
yield ()
... | [
"def",
"_tracebacks",
"(",
"score_matrix",
",",
"traceback_matrix",
",",
"idx",
")",
":",
"score",
"=",
"score_matrix",
"[",
"idx",
"]",
"if",
"score",
"==",
"0",
":",
"yield",
"(",
")",
"return",
"directions",
"=",
"traceback_matrix",
"[",
"idx",
"]",
"... | Implementation of traceeback.
This version can produce empty tracebacks, which we generally don't want
users seeing. So the higher level `tracebacks` filters those out. | [
"Implementation",
"of",
"traceeback",
"."
] | train | https://github.com/abingham/spor/blob/673c8c36c99a4b9ea882f002bfb529f1eca89126/src/spor/alignment/smith_waterman.py#L29-L56 |
abingham/spor | src/spor/alignment/smith_waterman.py | tracebacks | def tracebacks(score_matrix, traceback_matrix, idx):
"""Calculate the tracebacks for `traceback_matrix` starting at index `idx`.
Returns: An iterable of tracebacks where each traceback is sequence of
(index, direction) tuples. Each `index` is an index into
`traceback_matrix`. `direction` indicates ... | python | def tracebacks(score_matrix, traceback_matrix, idx):
"""Calculate the tracebacks for `traceback_matrix` starting at index `idx`.
Returns: An iterable of tracebacks where each traceback is sequence of
(index, direction) tuples. Each `index` is an index into
`traceback_matrix`. `direction` indicates ... | [
"def",
"tracebacks",
"(",
"score_matrix",
",",
"traceback_matrix",
",",
"idx",
")",
":",
"return",
"filter",
"(",
"lambda",
"tb",
":",
"tb",
"!=",
"(",
")",
",",
"_tracebacks",
"(",
"score_matrix",
",",
"traceback_matrix",
",",
"idx",
")",
")"
] | Calculate the tracebacks for `traceback_matrix` starting at index `idx`.
Returns: An iterable of tracebacks where each traceback is sequence of
(index, direction) tuples. Each `index` is an index into
`traceback_matrix`. `direction` indicates the direction into which the
traceback "entered" the i... | [
"Calculate",
"the",
"tracebacks",
"for",
"traceback_matrix",
"starting",
"at",
"index",
"idx",
"."
] | train | https://github.com/abingham/spor/blob/673c8c36c99a4b9ea882f002bfb529f1eca89126/src/spor/alignment/smith_waterman.py#L59-L70 |
abingham/spor | src/spor/alignment/smith_waterman.py | build_score_matrix | def build_score_matrix(a, b, score_func, gap_penalty):
"""Calculate the score and traceback matrices for two input sequences and
scoring functions.
Returns: A tuple of (score-matrix, traceback-matrix). Each entry in the
score-matrix is a numeric score. Each entry in the traceback-matrix is a
lo... | python | def build_score_matrix(a, b, score_func, gap_penalty):
"""Calculate the score and traceback matrices for two input sequences and
scoring functions.
Returns: A tuple of (score-matrix, traceback-matrix). Each entry in the
score-matrix is a numeric score. Each entry in the traceback-matrix is a
lo... | [
"def",
"build_score_matrix",
"(",
"a",
",",
"b",
",",
"score_func",
",",
"gap_penalty",
")",
":",
"score_matrix",
"=",
"Matrix",
"(",
"rows",
"=",
"len",
"(",
"a",
")",
"+",
"1",
",",
"cols",
"=",
"len",
"(",
"b",
")",
"+",
"1",
")",
"traceback_mat... | Calculate the score and traceback matrices for two input sequences and
scoring functions.
Returns: A tuple of (score-matrix, traceback-matrix). Each entry in the
score-matrix is a numeric score. Each entry in the traceback-matrix is a
logical ORing of the direction bitfields. | [
"Calculate",
"the",
"score",
"and",
"traceback",
"matrices",
"for",
"two",
"input",
"sequences",
"and",
"scoring",
"functions",
"."
] | train | https://github.com/abingham/spor/blob/673c8c36c99a4b9ea882f002bfb529f1eca89126/src/spor/alignment/smith_waterman.py#L73-L107 |
abingham/spor | src/spor/alignment/smith_waterman.py | _traceback_to_alignment | def _traceback_to_alignment(tb, a, b):
"""Convert a traceback (i.e. as returned by `tracebacks()`) into an alignment
(i.e. as returned by `align`).
Arguments:
tb: A traceback.
a: the sequence defining the rows in the traceback matrix.
b: the sequence defining the columns in the traceback ... | python | def _traceback_to_alignment(tb, a, b):
"""Convert a traceback (i.e. as returned by `tracebacks()`) into an alignment
(i.e. as returned by `align`).
Arguments:
tb: A traceback.
a: the sequence defining the rows in the traceback matrix.
b: the sequence defining the columns in the traceback ... | [
"def",
"_traceback_to_alignment",
"(",
"tb",
",",
"a",
",",
"b",
")",
":",
"# We subtract 1 from the indices here because we're translating from the",
"# alignment matrix space (which has one extra row and column) to the space",
"# of the input sequences.",
"for",
"idx",
",",
"direct... | Convert a traceback (i.e. as returned by `tracebacks()`) into an alignment
(i.e. as returned by `align`).
Arguments:
tb: A traceback.
a: the sequence defining the rows in the traceback matrix.
b: the sequence defining the columns in the traceback matrix.
Returns: An iterable of (index, i... | [
"Convert",
"a",
"traceback",
"(",
"i",
".",
"e",
".",
"as",
"returned",
"by",
"tracebacks",
"()",
")",
"into",
"an",
"alignment",
"(",
"i",
".",
"e",
".",
"as",
"returned",
"by",
"align",
")",
"."
] | train | https://github.com/abingham/spor/blob/673c8c36c99a4b9ea882f002bfb529f1eca89126/src/spor/alignment/smith_waterman.py#L110-L131 |
abingham/spor | src/spor/alignment/smith_waterman.py | align | def align(a, b, score_func, gap_penalty):
"""Calculate the best alignments of sequences `a` and `b`.
Arguments:
a: The first of two sequences to align
b: The second of two sequences to align
score_func: A 2-ary callable which calculates the "match" score between
two elements in the se... | python | def align(a, b, score_func, gap_penalty):
"""Calculate the best alignments of sequences `a` and `b`.
Arguments:
a: The first of two sequences to align
b: The second of two sequences to align
score_func: A 2-ary callable which calculates the "match" score between
two elements in the se... | [
"def",
"align",
"(",
"a",
",",
"b",
",",
"score_func",
",",
"gap_penalty",
")",
":",
"score_matrix",
",",
"tb_matrix",
"=",
"build_score_matrix",
"(",
"a",
",",
"b",
",",
"score_func",
",",
"gap_penalty",
")",
"max_score",
"=",
"max",
"(",
"score_matrix",
... | Calculate the best alignments of sequences `a` and `b`.
Arguments:
a: The first of two sequences to align
b: The second of two sequences to align
score_func: A 2-ary callable which calculates the "match" score between
two elements in the sequences.
gap_penalty: A 1-ary callable whic... | [
"Calculate",
"the",
"best",
"alignments",
"of",
"sequences",
"a",
"and",
"b",
"."
] | train | https://github.com/abingham/spor/blob/673c8c36c99a4b9ea882f002bfb529f1eca89126/src/spor/alignment/smith_waterman.py#L134-L163 |
zendesk/connect_python_sdk | outbound/__init__.py | unsubscribe | def unsubscribe(user_id, from_all=False, campaign_ids=None, on_error=None, on_success=None):
""" Unsubscribe a user from some or all campaigns.
:param str | number user_id: the id you use to identify a user. this should
be static for the lifetime of a user.
:param bool from_all True to unsubscribe fro... | python | def unsubscribe(user_id, from_all=False, campaign_ids=None, on_error=None, on_success=None):
""" Unsubscribe a user from some or all campaigns.
:param str | number user_id: the id you use to identify a user. this should
be static for the lifetime of a user.
:param bool from_all True to unsubscribe fro... | [
"def",
"unsubscribe",
"(",
"user_id",
",",
"from_all",
"=",
"False",
",",
"campaign_ids",
"=",
"None",
",",
"on_error",
"=",
"None",
",",
"on_success",
"=",
"None",
")",
":",
"__subscription",
"(",
"user_id",
",",
"unsubscribe",
"=",
"True",
",",
"all_camp... | Unsubscribe a user from some or all campaigns.
:param str | number user_id: the id you use to identify a user. this should
be static for the lifetime of a user.
:param bool from_all True to unsubscribe from all campaigns. Take precedence over
campaigns IDs if both are given.
:param list of str ca... | [
"Unsubscribe",
"a",
"user",
"from",
"some",
"or",
"all",
"campaigns",
"."
] | train | https://github.com/zendesk/connect_python_sdk/blob/6d7c1a539dcf23c1b1942e9bf6c9084c929df7e6/outbound/__init__.py#L37-L62 |
zendesk/connect_python_sdk | outbound/__init__.py | subscribe | def subscribe(user_id, to_all=False, campaign_ids=None, on_error=None, on_success=None):
""" Resubscribe a user to some or all campaigns.
:param str | number user_id: the id you use to identify a user. this should
be static for the lifetime of a user.
:param bool to_all True to reubscribe to all campa... | python | def subscribe(user_id, to_all=False, campaign_ids=None, on_error=None, on_success=None):
""" Resubscribe a user to some or all campaigns.
:param str | number user_id: the id you use to identify a user. this should
be static for the lifetime of a user.
:param bool to_all True to reubscribe to all campa... | [
"def",
"subscribe",
"(",
"user_id",
",",
"to_all",
"=",
"False",
",",
"campaign_ids",
"=",
"None",
",",
"on_error",
"=",
"None",
",",
"on_success",
"=",
"None",
")",
":",
"__subscription",
"(",
"user_id",
",",
"unsubscribe",
"=",
"False",
",",
"all_campaig... | Resubscribe a user to some or all campaigns.
:param str | number user_id: the id you use to identify a user. this should
be static for the lifetime of a user.
:param bool to_all True to reubscribe to all campaigns. Take precedence over
campaigns IDs if both are given.
:param list of str campaign_... | [
"Resubscribe",
"a",
"user",
"to",
"some",
"or",
"all",
"campaigns",
"."
] | train | https://github.com/zendesk/connect_python_sdk/blob/6d7c1a539dcf23c1b1942e9bf6c9084c929df7e6/outbound/__init__.py#L64-L89 |
zendesk/connect_python_sdk | outbound/__init__.py | disable_all_tokens | def disable_all_tokens(platform, user_id, on_error=None, on_success=None):
""" Disable ALL device tokens for the given user on the specified platform.
:param str platform The platform which to disable token on. One of either
Google Cloud Messaging (outbound.GCM) or Apple Push Notification Service
(outb... | python | def disable_all_tokens(platform, user_id, on_error=None, on_success=None):
""" Disable ALL device tokens for the given user on the specified platform.
:param str platform The platform which to disable token on. One of either
Google Cloud Messaging (outbound.GCM) or Apple Push Notification Service
(outb... | [
"def",
"disable_all_tokens",
"(",
"platform",
",",
"user_id",
",",
"on_error",
"=",
"None",
",",
"on_success",
"=",
"None",
")",
":",
"__device_token",
"(",
"platform",
",",
"False",
",",
"user_id",
",",
"all",
"=",
"True",
",",
"on_error",
"=",
"on_error"... | Disable ALL device tokens for the given user on the specified platform.
:param str platform The platform which to disable token on. One of either
Google Cloud Messaging (outbound.GCM) or Apple Push Notification Service
(outbound.APNS).
:param str | number user_id: the id you use to identify a user. th... | [
"Disable",
"ALL",
"device",
"tokens",
"for",
"the",
"given",
"user",
"on",
"the",
"specified",
"platform",
"."
] | train | https://github.com/zendesk/connect_python_sdk/blob/6d7c1a539dcf23c1b1942e9bf6c9084c929df7e6/outbound/__init__.py#L91-L108 |
zendesk/connect_python_sdk | outbound/__init__.py | disable_token | def disable_token(platform, user_id, token, on_error=None, on_success=None):
""" Disable a device token for a user.
:param str platform The platform which to disable token on. One of either
Google Cloud Messaging (outbound.GCM) or Apple Push Notification Service
(outbound.APNS).
:param str | numbe... | python | def disable_token(platform, user_id, token, on_error=None, on_success=None):
""" Disable a device token for a user.
:param str platform The platform which to disable token on. One of either
Google Cloud Messaging (outbound.GCM) or Apple Push Notification Service
(outbound.APNS).
:param str | numbe... | [
"def",
"disable_token",
"(",
"platform",
",",
"user_id",
",",
"token",
",",
"on_error",
"=",
"None",
",",
"on_success",
"=",
"None",
")",
":",
"__device_token",
"(",
"platform",
",",
"False",
",",
"user_id",
",",
"token",
"=",
"token",
",",
"on_error",
"... | Disable a device token for a user.
:param str platform The platform which to disable token on. One of either
Google Cloud Messaging (outbound.GCM) or Apple Push Notification Service
(outbound.APNS).
:param str | number user_id: the id you use to identify a user. this should
be static for the lifet... | [
"Disable",
"a",
"device",
"token",
"for",
"a",
"user",
"."
] | train | https://github.com/zendesk/connect_python_sdk/blob/6d7c1a539dcf23c1b1942e9bf6c9084c929df7e6/outbound/__init__.py#L110-L129 |
zendesk/connect_python_sdk | outbound/__init__.py | register_token | def register_token(platform, user_id, token, on_error=None, on_success=None):
""" Register a device token for a user.
:param str platform The platform which to register token on. One of either
Google Cloud Messaging (outbound.GCM) or Apple Push Notification Service
(outbound.APNS).
:param str | nu... | python | def register_token(platform, user_id, token, on_error=None, on_success=None):
""" Register a device token for a user.
:param str platform The platform which to register token on. One of either
Google Cloud Messaging (outbound.GCM) or Apple Push Notification Service
(outbound.APNS).
:param str | nu... | [
"def",
"register_token",
"(",
"platform",
",",
"user_id",
",",
"token",
",",
"on_error",
"=",
"None",
",",
"on_success",
"=",
"None",
")",
":",
"__device_token",
"(",
"platform",
",",
"True",
",",
"user_id",
",",
"token",
"=",
"token",
",",
"on_error",
"... | Register a device token for a user.
:param str platform The platform which to register token on. One of either
Google Cloud Messaging (outbound.GCM) or Apple Push Notification Service
(outbound.APNS).
:param str | number user_id: the id you use to identify a user. this should
be static for the lif... | [
"Register",
"a",
"device",
"token",
"for",
"a",
"user",
"."
] | train | https://github.com/zendesk/connect_python_sdk/blob/6d7c1a539dcf23c1b1942e9bf6c9084c929df7e6/outbound/__init__.py#L131-L150 |
zendesk/connect_python_sdk | outbound/__init__.py | alias | def alias(user_id, previous_id, on_error=None, on_success=None):
""" Alias one user id to another.
:param str | number user_id: the id you use to identify a user. this will be the user's
primary user id.
:param str | number previous_id: the id you previously used to identify a user (or the old user id... | python | def alias(user_id, previous_id, on_error=None, on_success=None):
""" Alias one user id to another.
:param str | number user_id: the id you use to identify a user. this will be the user's
primary user id.
:param str | number previous_id: the id you previously used to identify a user (or the old user id... | [
"def",
"alias",
"(",
"user_id",
",",
"previous_id",
",",
"on_error",
"=",
"None",
",",
"on_success",
"=",
"None",
")",
":",
"if",
"not",
"__is_init",
"(",
")",
":",
"on_error",
"(",
"ERROR_INIT",
",",
"__error_message",
"(",
"ERROR_INIT",
")",
")",
"retu... | Alias one user id to another.
:param str | number user_id: the id you use to identify a user. this will be the user's
primary user id.
:param str | number previous_id: the id you previously used to identify a user (or the old user id
you want to associate with the new user id).
:param func on_err... | [
"Alias",
"one",
"user",
"id",
"to",
"another",
"."
] | train | https://github.com/zendesk/connect_python_sdk/blob/6d7c1a539dcf23c1b1942e9bf6c9084c929df7e6/outbound/__init__.py#L152-L197 |
zendesk/connect_python_sdk | outbound/__init__.py | identify | def identify(user_id, previous_id=None, group_id=None, group_attributes=None,
first_name=None, last_name=None, email=None,
phone_number=None, apns_tokens=None, gcm_tokens=None,
attributes=None, on_error=None, on_success=None):
""" Identifying a user creates a record of your user ... | python | def identify(user_id, previous_id=None, group_id=None, group_attributes=None,
first_name=None, last_name=None, email=None,
phone_number=None, apns_tokens=None, gcm_tokens=None,
attributes=None, on_error=None, on_success=None):
""" Identifying a user creates a record of your user ... | [
"def",
"identify",
"(",
"user_id",
",",
"previous_id",
"=",
"None",
",",
"group_id",
"=",
"None",
",",
"group_attributes",
"=",
"None",
",",
"first_name",
"=",
"None",
",",
"last_name",
"=",
"None",
",",
"email",
"=",
"None",
",",
"phone_number",
"=",
"N... | Identifying a user creates a record of your user in Outbound. Identify
calls should be made prior to sending any track events for a user.
:param str | number user_id: the id you use to identify a user. this should
be static for the lifetime of a user.
:param str | number previous_id: OPTIONAL the id y... | [
"Identifying",
"a",
"user",
"creates",
"a",
"record",
"of",
"your",
"user",
"in",
"Outbound",
".",
"Identify",
"calls",
"should",
"be",
"made",
"prior",
"to",
"sending",
"any",
"track",
"events",
"for",
"a",
"user",
"."
] | train | https://github.com/zendesk/connect_python_sdk/blob/6d7c1a539dcf23c1b1942e9bf6c9084c929df7e6/outbound/__init__.py#L199-L278 |
zendesk/connect_python_sdk | outbound/__init__.py | track | def track(user_id, event, first_name=None, last_name=None, email=None,
phone_number=None, apns_tokens=None, gcm_tokens=None,
user_attributes=None, properties=None, on_error=None, on_success=None, timestamp=None):
""" For any event you want to track, when a user triggers that event you
would call... | python | def track(user_id, event, first_name=None, last_name=None, email=None,
phone_number=None, apns_tokens=None, gcm_tokens=None,
user_attributes=None, properties=None, on_error=None, on_success=None, timestamp=None):
""" For any event you want to track, when a user triggers that event you
would call... | [
"def",
"track",
"(",
"user_id",
",",
"event",
",",
"first_name",
"=",
"None",
",",
"last_name",
"=",
"None",
",",
"email",
"=",
"None",
",",
"phone_number",
"=",
"None",
",",
"apns_tokens",
"=",
"None",
",",
"gcm_tokens",
"=",
"None",
",",
"user_attribut... | For any event you want to track, when a user triggers that event you
would call this function.
You can do an identify and track call simultaneously by including all the
identifiable user information in the track call.
:param str | number user_id: the id you user who triggered the event.
:param st... | [
"For",
"any",
"event",
"you",
"want",
"to",
"track",
"when",
"a",
"user",
"triggers",
"that",
"event",
"you",
"would",
"call",
"this",
"function",
"."
] | train | https://github.com/zendesk/connect_python_sdk/blob/6d7c1a539dcf23c1b1942e9bf6c9084c929df7e6/outbound/__init__.py#L280-L372 |
sveetch/boussole | boussole/conf/json_backend.py | SettingsBackendJson.dump | def dump(self, content, filepath, indent=4):
"""
Dump settings content to filepath.
Args:
content (str): Settings content.
filepath (str): Settings file location.
"""
with open(filepath, 'w') as fp:
json.dump(content, fp, indent=indent) | python | def dump(self, content, filepath, indent=4):
"""
Dump settings content to filepath.
Args:
content (str): Settings content.
filepath (str): Settings file location.
"""
with open(filepath, 'w') as fp:
json.dump(content, fp, indent=indent) | [
"def",
"dump",
"(",
"self",
",",
"content",
",",
"filepath",
",",
"indent",
"=",
"4",
")",
":",
"with",
"open",
"(",
"filepath",
",",
"'w'",
")",
"as",
"fp",
":",
"json",
".",
"dump",
"(",
"content",
",",
"fp",
",",
"indent",
"=",
"indent",
")"
] | Dump settings content to filepath.
Args:
content (str): Settings content.
filepath (str): Settings file location. | [
"Dump",
"settings",
"content",
"to",
"filepath",
"."
] | train | https://github.com/sveetch/boussole/blob/22cc644e9d633f41ebfc167d427a71c1726cee21/boussole/conf/json_backend.py#L28-L37 |
sveetch/boussole | boussole/conf/json_backend.py | SettingsBackendJson.parse | def parse(self, filepath, content):
"""
Parse opened settings content using JSON parser.
Args:
filepath (str): Settings object, depends from backend
content (str): Settings content from opened file, depends from
backend.
Raises:
bouss... | python | def parse(self, filepath, content):
"""
Parse opened settings content using JSON parser.
Args:
filepath (str): Settings object, depends from backend
content (str): Settings content from opened file, depends from
backend.
Raises:
bouss... | [
"def",
"parse",
"(",
"self",
",",
"filepath",
",",
"content",
")",
":",
"try",
":",
"parsed",
"=",
"json",
".",
"loads",
"(",
"content",
")",
"except",
"ValueError",
":",
"msg",
"=",
"\"No JSON object could be decoded from file: {}\"",
"raise",
"SettingsBackendE... | Parse opened settings content using JSON parser.
Args:
filepath (str): Settings object, depends from backend
content (str): Settings content from opened file, depends from
backend.
Raises:
boussole.exceptions.SettingsBackendError: If parser can not d... | [
"Parse",
"opened",
"settings",
"content",
"using",
"JSON",
"parser",
"."
] | train | https://github.com/sveetch/boussole/blob/22cc644e9d633f41ebfc167d427a71c1726cee21/boussole/conf/json_backend.py#L39-L61 |
cjw85/myriad | myriad/components.py | run_client | def run_client(ip, port, authkey, max_items=None, timeout=2):
"""Connect to a SwarmServer and do its dirty work.
:param ip: ip address of server
:param port: port to connect to on server
:param authkey: authorization key
:param max_items: maximum number of items to process from server.
Usef... | python | def run_client(ip, port, authkey, max_items=None, timeout=2):
"""Connect to a SwarmServer and do its dirty work.
:param ip: ip address of server
:param port: port to connect to on server
:param authkey: authorization key
:param max_items: maximum number of items to process from server.
Usef... | [
"def",
"run_client",
"(",
"ip",
",",
"port",
",",
"authkey",
",",
"max_items",
"=",
"None",
",",
"timeout",
"=",
"2",
")",
":",
"manager",
"=",
"make_client",
"(",
"ip",
",",
"port",
",",
"authkey",
")",
"job_q",
"=",
"manager",
".",
"get_job_q",
"("... | Connect to a SwarmServer and do its dirty work.
:param ip: ip address of server
:param port: port to connect to on server
:param authkey: authorization key
:param max_items: maximum number of items to process from server.
Useful for say running clients on a cluster. | [
"Connect",
"to",
"a",
"SwarmServer",
"and",
"do",
"its",
"dirty",
"work",
"."
] | train | https://github.com/cjw85/myriad/blob/518124d431bf5cd2a7853489eb9c95d849d12346/myriad/components.py#L117-L146 |
cjw85/myriad | myriad/components.py | worker | def worker(n):
"""Spend some time calculating exponentials."""
for _ in xrange(999999):
a = exp(n)
b = exp(2*n)
return n, a | python | def worker(n):
"""Spend some time calculating exponentials."""
for _ in xrange(999999):
a = exp(n)
b = exp(2*n)
return n, a | [
"def",
"worker",
"(",
"n",
")",
":",
"for",
"_",
"in",
"xrange",
"(",
"999999",
")",
":",
"a",
"=",
"exp",
"(",
"n",
")",
"b",
"=",
"exp",
"(",
"2",
"*",
"n",
")",
"return",
"n",
",",
"a"
] | Spend some time calculating exponentials. | [
"Spend",
"some",
"time",
"calculating",
"exponentials",
"."
] | train | https://github.com/cjw85/myriad/blob/518124d431bf5cd2a7853489eb9c95d849d12346/myriad/components.py#L148-L153 |
cjw85/myriad | myriad/components.py | MyriadServer.imap_unordered | def imap_unordered(self, jobs, timeout=0.5):
"""A iterator over a set of jobs.
:param jobs: the items to pass through our function
:param timeout: timeout between polling queues
Results are yielded as soon as they are available in the output
queue (up to the discretisation prov... | python | def imap_unordered(self, jobs, timeout=0.5):
"""A iterator over a set of jobs.
:param jobs: the items to pass through our function
:param timeout: timeout between polling queues
Results are yielded as soon as they are available in the output
queue (up to the discretisation prov... | [
"def",
"imap_unordered",
"(",
"self",
",",
"jobs",
",",
"timeout",
"=",
"0.5",
")",
":",
"timeout",
"=",
"max",
"(",
"timeout",
",",
"0.5",
")",
"jobs_iter",
"=",
"iter",
"(",
"jobs",
")",
"out_jobs",
"=",
"0",
"job",
"=",
"None",
"while",
"True",
... | A iterator over a set of jobs.
:param jobs: the items to pass through our function
:param timeout: timeout between polling queues
Results are yielded as soon as they are available in the output
queue (up to the discretisation provided by timeout). Since the
queues can be specif... | [
"A",
"iterator",
"over",
"a",
"set",
"of",
"jobs",
"."
] | train | https://github.com/cjw85/myriad/blob/518124d431bf5cd2a7853489eb9c95d849d12346/myriad/components.py#L58-L96 |
isambard-uob/ampal | src/ampal/protein.py | Polypeptide.primitive | def primitive(self):
"""Primitive of the backbone.
Notes
-----
This is the average of the positions of all the CAs in frames
of `sl` `Residues`.
"""
cas = self.get_reference_coords()
primitive_coords = make_primitive_extrapolate_ends(
cas, smo... | python | def primitive(self):
"""Primitive of the backbone.
Notes
-----
This is the average of the positions of all the CAs in frames
of `sl` `Residues`.
"""
cas = self.get_reference_coords()
primitive_coords = make_primitive_extrapolate_ends(
cas, smo... | [
"def",
"primitive",
"(",
"self",
")",
":",
"cas",
"=",
"self",
".",
"get_reference_coords",
"(",
")",
"primitive_coords",
"=",
"make_primitive_extrapolate_ends",
"(",
"cas",
",",
"smoothing_level",
"=",
"self",
".",
"sl",
")",
"primitive",
"=",
"Primitive",
".... | Primitive of the backbone.
Notes
-----
This is the average of the positions of all the CAs in frames
of `sl` `Residues`. | [
"Primitive",
"of",
"the",
"backbone",
"."
] | train | https://github.com/isambard-uob/ampal/blob/906e2afacb435ffb129b381f262ff8e7bfb324c5/src/ampal/protein.py#L246-L261 |
isambard-uob/ampal | src/ampal/protein.py | Polypeptide.fasta | def fasta(self):
"""Generates sequence data for the protein in FASTA format."""
max_line_length = 79
fasta_str = '>{0}:{1}|PDBID|CHAIN|SEQUENCE\n'.format(
self.parent.id.upper(), self.id)
seq = self.sequence
split_seq = [seq[i: i + max_line_length]
... | python | def fasta(self):
"""Generates sequence data for the protein in FASTA format."""
max_line_length = 79
fasta_str = '>{0}:{1}|PDBID|CHAIN|SEQUENCE\n'.format(
self.parent.id.upper(), self.id)
seq = self.sequence
split_seq = [seq[i: i + max_line_length]
... | [
"def",
"fasta",
"(",
"self",
")",
":",
"max_line_length",
"=",
"79",
"fasta_str",
"=",
"'>{0}:{1}|PDBID|CHAIN|SEQUENCE\\n'",
".",
"format",
"(",
"self",
".",
"parent",
".",
"id",
".",
"upper",
"(",
")",
",",
"self",
".",
"id",
")",
"seq",
"=",
"self",
... | Generates sequence data for the protein in FASTA format. | [
"Generates",
"sequence",
"data",
"for",
"the",
"protein",
"in",
"FASTA",
"format",
"."
] | train | https://github.com/isambard-uob/ampal/blob/906e2afacb435ffb129b381f262ff8e7bfb324c5/src/ampal/protein.py#L264-L274 |
isambard-uob/ampal | src/ampal/protein.py | Residue.centroid | def centroid(self):
"""Calculates the centroid of the residue.
Returns
-------
centroid : numpy.array or None
Returns a 3D coordinate for the residue unless a CB
atom is not available, in which case `None` is
returned.
Notes
-----
... | python | def centroid(self):
"""Calculates the centroid of the residue.
Returns
-------
centroid : numpy.array or None
Returns a 3D coordinate for the residue unless a CB
atom is not available, in which case `None` is
returned.
Notes
-----
... | [
"def",
"centroid",
"(",
"self",
")",
":",
"if",
"'CB'",
"in",
"self",
".",
"atoms",
":",
"cb_unit_vector",
"=",
"unit_vector",
"(",
"self",
"[",
"'CB'",
"]",
".",
"_vector",
"-",
"self",
"[",
"'CA'",
"]",
".",
"_vector",
")",
"return",
"self",
"[",
... | Calculates the centroid of the residue.
Returns
-------
centroid : numpy.array or None
Returns a 3D coordinate for the residue unless a CB
atom is not available, in which case `None` is
returned.
Notes
-----
Uses the definition of the... | [
"Calculates",
"the",
"centroid",
"of",
"the",
"residue",
"."
] | train | https://github.com/isambard-uob/ampal/blob/906e2afacb435ffb129b381f262ff8e7bfb324c5/src/ampal/protein.py#L900-L924 |
transmogrifier/pidigits | pidigits/pidigits.py | piGenLeibniz | def piGenLeibniz():
"""A generator function that yields the digits of Pi
"""
k = 1
z = (1,0,0,1)
while True:
lft = __lfts(k)
n = int(__next(z))
if __safe(z,n):
z = __prod(z,n)
yield n
else:
z = __cons(z,lft)
k += 1 | python | def piGenLeibniz():
"""A generator function that yields the digits of Pi
"""
k = 1
z = (1,0,0,1)
while True:
lft = __lfts(k)
n = int(__next(z))
if __safe(z,n):
z = __prod(z,n)
yield n
else:
z = __cons(z,lft)
k += 1 | [
"def",
"piGenLeibniz",
"(",
")",
":",
"k",
"=",
"1",
"z",
"=",
"(",
"1",
",",
"0",
",",
"0",
",",
"1",
")",
"while",
"True",
":",
"lft",
"=",
"__lfts",
"(",
"k",
")",
"n",
"=",
"int",
"(",
"__next",
"(",
"z",
")",
")",
"if",
"__safe",
"("... | A generator function that yields the digits of Pi | [
"A",
"generator",
"function",
"that",
"yields",
"the",
"digits",
"of",
"Pi"
] | train | https://github.com/transmogrifier/pidigits/blob/b12081126a76d30fb69839aa586420c5bb04feb8/pidigits/pidigits.py#L55-L68 |
transmogrifier/pidigits | pidigits/pidigits.py | getPiLeibniz | def getPiLeibniz(n):
"""Returns a list containing first n digits of Pi
"""
mypi = piGenLeibniz()
result = []
if n > 0:
result += [next(mypi) for i in range(n)]
mypi.close()
return result | python | def getPiLeibniz(n):
"""Returns a list containing first n digits of Pi
"""
mypi = piGenLeibniz()
result = []
if n > 0:
result += [next(mypi) for i in range(n)]
mypi.close()
return result | [
"def",
"getPiLeibniz",
"(",
"n",
")",
":",
"mypi",
"=",
"piGenLeibniz",
"(",
")",
"result",
"=",
"[",
"]",
"if",
"n",
">",
"0",
":",
"result",
"+=",
"[",
"next",
"(",
"mypi",
")",
"for",
"i",
"in",
"range",
"(",
"n",
")",
"]",
"mypi",
".",
"c... | Returns a list containing first n digits of Pi | [
"Returns",
"a",
"list",
"containing",
"first",
"n",
"digits",
"of",
"Pi"
] | train | https://github.com/transmogrifier/pidigits/blob/b12081126a76d30fb69839aa586420c5bb04feb8/pidigits/pidigits.py#L70-L78 |
mlavin/sickmuse | sickmuse/app.py | shutdown | def shutdown(server, graceful=True):
"""Shut down the application.
If a graceful stop is requested, waits for all of the IO loop's
handlers to finish before shutting down the rest of the process.
We impose a 10 second timeout.
Based on http://tornadogists.org/3428652/
"""
ioloop = IOLoop.i... | python | def shutdown(server, graceful=True):
"""Shut down the application.
If a graceful stop is requested, waits for all of the IO loop's
handlers to finish before shutting down the rest of the process.
We impose a 10 second timeout.
Based on http://tornadogists.org/3428652/
"""
ioloop = IOLoop.i... | [
"def",
"shutdown",
"(",
"server",
",",
"graceful",
"=",
"True",
")",
":",
"ioloop",
"=",
"IOLoop",
".",
"instance",
"(",
")",
"logging",
".",
"info",
"(",
"\"Stopping server...\"",
")",
"# Stop listening for new connections",
"server",
".",
"stop",
"(",
")",
... | Shut down the application.
If a graceful stop is requested, waits for all of the IO loop's
handlers to finish before shutting down the rest of the process.
We impose a 10 second timeout.
Based on http://tornadogists.org/3428652/ | [
"Shut",
"down",
"the",
"application",
"."
] | train | https://github.com/mlavin/sickmuse/blob/e301ea4f682b60d1cf45996d5630cbf02b099df0/sickmuse/app.py#L56-L95 |
UDICatNCHU/KEM | kem/__init__.py | KEM.most_similar | def most_similar(self, keyword, num):
"""
input: keyword term of top n
output: keyword result in json formmat
"""
try:
result = self.model.most_similar(keyword, topn = num) # most_similar return a list
return {'key':keyword, 'value':result, 'similarity':1}... | python | def most_similar(self, keyword, num):
"""
input: keyword term of top n
output: keyword result in json formmat
"""
try:
result = self.model.most_similar(keyword, topn = num) # most_similar return a list
return {'key':keyword, 'value':result, 'similarity':1}... | [
"def",
"most_similar",
"(",
"self",
",",
"keyword",
",",
"num",
")",
":",
"try",
":",
"result",
"=",
"self",
".",
"model",
".",
"most_similar",
"(",
"keyword",
",",
"topn",
"=",
"num",
")",
"# most_similar return a list",
"return",
"{",
"'key'",
":",
"ke... | input: keyword term of top n
output: keyword result in json formmat | [
"input",
":",
"keyword",
"term",
"of",
"top",
"n",
"output",
":",
"keyword",
"result",
"in",
"json",
"formmat"
] | train | https://github.com/UDICatNCHU/KEM/blob/c5fe8894cd87525fcd620c67a4930d192fae030f/kem/__init__.py#L17-L30 |
Kong/analytics-agent-python | mashapeanalytics/transport.py | HttpTransport.send | def send(self, alf):
''' Non-blocking send '''
send_alf = SendThread(self.url, alf, self.connection_timeout, self.retry_count)
send_alf.start() | python | def send(self, alf):
''' Non-blocking send '''
send_alf = SendThread(self.url, alf, self.connection_timeout, self.retry_count)
send_alf.start() | [
"def",
"send",
"(",
"self",
",",
"alf",
")",
":",
"send_alf",
"=",
"SendThread",
"(",
"self",
".",
"url",
",",
"alf",
",",
"self",
".",
"connection_timeout",
",",
"self",
".",
"retry_count",
")",
"send_alf",
".",
"start",
"(",
")"
] | Non-blocking send | [
"Non",
"-",
"blocking",
"send"
] | train | https://github.com/Kong/analytics-agent-python/blob/daa19bd645d45dd0cffc7f62cfbff05c2b320f36/mashapeanalytics/transport.py#L49-L52 |
sveetch/boussole | boussole/inspector.py | ScssInspector.look_source | def look_source(self, sourcepath, library_paths=None):
"""
Open a SCSS file (sourcepath) and find all involved file through
imports.
This will fill internal buffers ``_CHILDREN_MAP`` and ``_PARENTS_MAP``.
Args:
sourcepath (str): Source file path to start searching f... | python | def look_source(self, sourcepath, library_paths=None):
"""
Open a SCSS file (sourcepath) and find all involved file through
imports.
This will fill internal buffers ``_CHILDREN_MAP`` and ``_PARENTS_MAP``.
Args:
sourcepath (str): Source file path to start searching f... | [
"def",
"look_source",
"(",
"self",
",",
"sourcepath",
",",
"library_paths",
"=",
"None",
")",
":",
"# Don't inspect again source that has allready be inspected as a",
"# children of a previous source",
"if",
"sourcepath",
"not",
"in",
"self",
".",
"_CHILDREN_MAP",
":",
"w... | Open a SCSS file (sourcepath) and find all involved file through
imports.
This will fill internal buffers ``_CHILDREN_MAP`` and ``_PARENTS_MAP``.
Args:
sourcepath (str): Source file path to start searching for imports.
Keyword Arguments:
library_paths (list): L... | [
"Open",
"a",
"SCSS",
"file",
"(",
"sourcepath",
")",
"and",
"find",
"all",
"involved",
"file",
"through",
"imports",
"."
] | train | https://github.com/sveetch/boussole/blob/22cc644e9d633f41ebfc167d427a71c1726cee21/boussole/inspector.py#L48-L85 |
sveetch/boussole | boussole/inspector.py | ScssInspector.inspect | def inspect(self, *args, **kwargs):
"""
Recursively inspect all given SCSS files to find imported dependencies.
This does not return anything. Just fill internal buffers about
inspected files.
Note:
This will ignore orphan files (files that are not imported from
... | python | def inspect(self, *args, **kwargs):
"""
Recursively inspect all given SCSS files to find imported dependencies.
This does not return anything. Just fill internal buffers about
inspected files.
Note:
This will ignore orphan files (files that are not imported from
... | [
"def",
"inspect",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"library_paths",
"=",
"kwargs",
".",
"get",
"(",
"'library_paths'",
",",
"None",
")",
"for",
"sourcepath",
"in",
"args",
":",
"self",
".",
"look_source",
"(",
"sourcepa... | Recursively inspect all given SCSS files to find imported dependencies.
This does not return anything. Just fill internal buffers about
inspected files.
Note:
This will ignore orphan files (files that are not imported from
any of given SCSS files).
Args:
... | [
"Recursively",
"inspect",
"all",
"given",
"SCSS",
"files",
"to",
"find",
"imported",
"dependencies",
"."
] | train | https://github.com/sveetch/boussole/blob/22cc644e9d633f41ebfc167d427a71c1726cee21/boussole/inspector.py#L87-L110 |
sveetch/boussole | boussole/inspector.py | ScssInspector._get_recursive_dependancies | def _get_recursive_dependancies(self, dependencies_map, sourcepath,
recursive=True):
"""
Return all dependencies of a source, recursively searching through its
dependencies.
This is a common method used by ``children`` and ``parents`` methods.
... | python | def _get_recursive_dependancies(self, dependencies_map, sourcepath,
recursive=True):
"""
Return all dependencies of a source, recursively searching through its
dependencies.
This is a common method used by ``children`` and ``parents`` methods.
... | [
"def",
"_get_recursive_dependancies",
"(",
"self",
",",
"dependencies_map",
",",
"sourcepath",
",",
"recursive",
"=",
"True",
")",
":",
"# Direct dependencies",
"collected",
"=",
"set",
"(",
"[",
"]",
")",
"collected",
".",
"update",
"(",
"dependencies_map",
"."... | Return all dependencies of a source, recursively searching through its
dependencies.
This is a common method used by ``children`` and ``parents`` methods.
Args:
dependencies_map (dict): Internal buffer (internal buffers
``_CHILDREN_MAP`` or ``_PARENTS_MAP``) to use ... | [
"Return",
"all",
"dependencies",
"of",
"a",
"source",
"recursively",
"searching",
"through",
"its",
"dependencies",
"."
] | train | https://github.com/sveetch/boussole/blob/22cc644e9d633f41ebfc167d427a71c1726cee21/boussole/inspector.py#L112-L179 |
sveetch/boussole | boussole/inspector.py | ScssInspector.children | def children(self, sourcepath, recursive=True):
"""
Recursively find all children that are imported from the given source
path.
Args:
sourcepath (str): Source file path to search for.
Keyword Arguments:
recursive (bool): Switch to enabled recursive findi... | python | def children(self, sourcepath, recursive=True):
"""
Recursively find all children that are imported from the given source
path.
Args:
sourcepath (str): Source file path to search for.
Keyword Arguments:
recursive (bool): Switch to enabled recursive findi... | [
"def",
"children",
"(",
"self",
",",
"sourcepath",
",",
"recursive",
"=",
"True",
")",
":",
"return",
"self",
".",
"_get_recursive_dependancies",
"(",
"self",
".",
"_CHILDREN_MAP",
",",
"sourcepath",
",",
"recursive",
"=",
"True",
")"
] | Recursively find all children that are imported from the given source
path.
Args:
sourcepath (str): Source file path to search for.
Keyword Arguments:
recursive (bool): Switch to enabled recursive finding (if True).
Default to True.
Returns:
... | [
"Recursively",
"find",
"all",
"children",
"that",
"are",
"imported",
"from",
"the",
"given",
"source",
"path",
"."
] | train | https://github.com/sveetch/boussole/blob/22cc644e9d633f41ebfc167d427a71c1726cee21/boussole/inspector.py#L181-L200 |
sveetch/boussole | boussole/inspector.py | ScssInspector.parents | def parents(self, sourcepath, recursive=True):
"""
Recursively find all parents that import the given source path.
Args:
sourcepath (str): Source file path to search for.
Keyword Arguments:
recursive (bool): Switch to enabled recursive finding (if True).
... | python | def parents(self, sourcepath, recursive=True):
"""
Recursively find all parents that import the given source path.
Args:
sourcepath (str): Source file path to search for.
Keyword Arguments:
recursive (bool): Switch to enabled recursive finding (if True).
... | [
"def",
"parents",
"(",
"self",
",",
"sourcepath",
",",
"recursive",
"=",
"True",
")",
":",
"return",
"self",
".",
"_get_recursive_dependancies",
"(",
"self",
".",
"_PARENTS_MAP",
",",
"sourcepath",
",",
"recursive",
"=",
"True",
")"
] | Recursively find all parents that import the given source path.
Args:
sourcepath (str): Source file path to search for.
Keyword Arguments:
recursive (bool): Switch to enabled recursive finding (if True).
Default to True.
Returns:
set: List o... | [
"Recursively",
"find",
"all",
"parents",
"that",
"import",
"the",
"given",
"source",
"path",
"."
] | train | https://github.com/sveetch/boussole/blob/22cc644e9d633f41ebfc167d427a71c1726cee21/boussole/inspector.py#L202-L220 |
djangoer/django-selectize | selectize/templatetags/selectize_tags.py | selectize_tags_media | def selectize_tags_media(media_type='css',name=''):
"""
Usage:
------
To include css media:
selectize_tags_media 'css' <theme>
To include Selectize Scripts:
selectize_tags_media 'js'
To include Selectize Scripts and Jquery:
selectize_tags_media 'js' 'jquery'
"""
if media_type=='js':
str_script='<script s... | python | def selectize_tags_media(media_type='css',name=''):
"""
Usage:
------
To include css media:
selectize_tags_media 'css' <theme>
To include Selectize Scripts:
selectize_tags_media 'js'
To include Selectize Scripts and Jquery:
selectize_tags_media 'js' 'jquery'
"""
if media_type=='js':
str_script='<script s... | [
"def",
"selectize_tags_media",
"(",
"media_type",
"=",
"'css'",
",",
"name",
"=",
"''",
")",
":",
"if",
"media_type",
"==",
"'js'",
":",
"str_script",
"=",
"'<script src=\"{url}\"></script>\\n'",
"html",
"=",
"str_script",
".",
"format",
"(",
"url",
"=",
"stat... | Usage:
------
To include css media:
selectize_tags_media 'css' <theme>
To include Selectize Scripts:
selectize_tags_media 'js'
To include Selectize Scripts and Jquery:
selectize_tags_media 'js' 'jquery' | [
"Usage",
":",
"------",
"To",
"include",
"css",
"media",
":",
"selectize_tags_media",
"css",
"<theme",
">"
] | train | https://github.com/djangoer/django-selectize/blob/07507edf4a43b302b23dc1c0593f08b7a16cdbd3/selectize/templatetags/selectize_tags.py#L9-L31 |
jantman/webhook2lambda2sqs | webhook2lambda2sqs/aws.py | AWSInfo.show_cloudwatch_logs | def show_cloudwatch_logs(self, count=10, grp_name=None):
"""
Show ``count`` latest CloudWatch Logs entries for our lambda function.
:param count: number of log entries to show
:type count: int
"""
if grp_name is None:
grp_name = '/aws/lambda/%s' % self.config... | python | def show_cloudwatch_logs(self, count=10, grp_name=None):
"""
Show ``count`` latest CloudWatch Logs entries for our lambda function.
:param count: number of log entries to show
:type count: int
"""
if grp_name is None:
grp_name = '/aws/lambda/%s' % self.config... | [
"def",
"show_cloudwatch_logs",
"(",
"self",
",",
"count",
"=",
"10",
",",
"grp_name",
"=",
"None",
")",
":",
"if",
"grp_name",
"is",
"None",
":",
"grp_name",
"=",
"'/aws/lambda/%s'",
"%",
"self",
".",
"config",
".",
"func_name",
"logger",
".",
"debug",
"... | Show ``count`` latest CloudWatch Logs entries for our lambda function.
:param count: number of log entries to show
:type count: int | [
"Show",
"count",
"latest",
"CloudWatch",
"Logs",
"entries",
"for",
"our",
"lambda",
"function",
"."
] | train | https://github.com/jantman/webhook2lambda2sqs/blob/c80c18d5a908ba8b8ee624dc3a977c633fba2b7c/webhook2lambda2sqs/aws.py#L64-L90 |
jantman/webhook2lambda2sqs | webhook2lambda2sqs/aws.py | AWSInfo._show_log_stream | def _show_log_stream(self, conn, grp_name, stream_name, max_count=10):
"""
Show up to ``max`` events from a specified log stream; return the
number of events shown.
:param conn: AWS Logs API connection
:type conn: :py:class:`botocore:CloudWatchLogs.Client`
:param grp_nam... | python | def _show_log_stream(self, conn, grp_name, stream_name, max_count=10):
"""
Show up to ``max`` events from a specified log stream; return the
number of events shown.
:param conn: AWS Logs API connection
:type conn: :py:class:`botocore:CloudWatchLogs.Client`
:param grp_nam... | [
"def",
"_show_log_stream",
"(",
"self",
",",
"conn",
",",
"grp_name",
",",
"stream_name",
",",
"max_count",
"=",
"10",
")",
":",
"logger",
".",
"debug",
"(",
"'Showing up to %d events from stream %s'",
",",
"max_count",
",",
"stream_name",
")",
"events",
"=",
... | Show up to ``max`` events from a specified log stream; return the
number of events shown.
:param conn: AWS Logs API connection
:type conn: :py:class:`botocore:CloudWatchLogs.Client`
:param grp_name: log group name
:type grp_name: str
:param stream_name: log stream name
... | [
"Show",
"up",
"to",
"max",
"events",
"from",
"a",
"specified",
"log",
"stream",
";",
"return",
"the",
"number",
"of",
"events",
"shown",
"."
] | train | https://github.com/jantman/webhook2lambda2sqs/blob/c80c18d5a908ba8b8ee624dc3a977c633fba2b7c/webhook2lambda2sqs/aws.py#L92-L127 |
jantman/webhook2lambda2sqs | webhook2lambda2sqs/aws.py | AWSInfo._url_for_queue | def _url_for_queue(self, conn, name):
"""
Given a queue name, return the URL for it.
:param conn: SQS API connection
:type conn: :py:class:`botocore:SQS.Client`
:param name: queue name, or None for all queues in config.
:type name: str
:return: queue URL
... | python | def _url_for_queue(self, conn, name):
"""
Given a queue name, return the URL for it.
:param conn: SQS API connection
:type conn: :py:class:`botocore:SQS.Client`
:param name: queue name, or None for all queues in config.
:type name: str
:return: queue URL
... | [
"def",
"_url_for_queue",
"(",
"self",
",",
"conn",
",",
"name",
")",
":",
"res",
"=",
"conn",
".",
"get_queue_url",
"(",
"QueueName",
"=",
"name",
")",
"return",
"res",
"[",
"'QueueUrl'",
"]"
] | Given a queue name, return the URL for it.
:param conn: SQS API connection
:type conn: :py:class:`botocore:SQS.Client`
:param name: queue name, or None for all queues in config.
:type name: str
:return: queue URL
:rtype: str | [
"Given",
"a",
"queue",
"name",
"return",
"the",
"URL",
"for",
"it",
"."
] | train | https://github.com/jantman/webhook2lambda2sqs/blob/c80c18d5a908ba8b8ee624dc3a977c633fba2b7c/webhook2lambda2sqs/aws.py#L129-L141 |
jantman/webhook2lambda2sqs | webhook2lambda2sqs/aws.py | AWSInfo._delete_msg | def _delete_msg(self, conn, queue_url, receipt_handle):
"""
Delete the message specified by ``receipt_handle`` in the queue
specified by ``queue_url``.
:param conn: SQS API connection
:type conn: :py:class:`botocore:SQS.Client`
:param queue_url: queue URL to delete the m... | python | def _delete_msg(self, conn, queue_url, receipt_handle):
"""
Delete the message specified by ``receipt_handle`` in the queue
specified by ``queue_url``.
:param conn: SQS API connection
:type conn: :py:class:`botocore:SQS.Client`
:param queue_url: queue URL to delete the m... | [
"def",
"_delete_msg",
"(",
"self",
",",
"conn",
",",
"queue_url",
",",
"receipt_handle",
")",
":",
"resp",
"=",
"conn",
".",
"delete_message",
"(",
"QueueUrl",
"=",
"queue_url",
",",
"ReceiptHandle",
"=",
"receipt_handle",
")",
"if",
"resp",
"[",
"'ResponseM... | Delete the message specified by ``receipt_handle`` in the queue
specified by ``queue_url``.
:param conn: SQS API connection
:type conn: :py:class:`botocore:SQS.Client`
:param queue_url: queue URL to delete the message from
:type queue_url: str
:param receipt_handle: mess... | [
"Delete",
"the",
"message",
"specified",
"by",
"receipt_handle",
"in",
"the",
"queue",
"specified",
"by",
"queue_url",
"."
] | train | https://github.com/jantman/webhook2lambda2sqs/blob/c80c18d5a908ba8b8ee624dc3a977c633fba2b7c/webhook2lambda2sqs/aws.py#L143-L164 |
jantman/webhook2lambda2sqs | webhook2lambda2sqs/aws.py | AWSInfo._show_one_queue | def _show_one_queue(self, conn, name, count, delete=False):
"""
Show ``count`` messages from the specified SQS queue.
:param conn: SQS API connection
:type conn: :py:class:`botocore:SQS.Client`
:param name: queue name, or None for all queues in config.
:type name: str
... | python | def _show_one_queue(self, conn, name, count, delete=False):
"""
Show ``count`` messages from the specified SQS queue.
:param conn: SQS API connection
:type conn: :py:class:`botocore:SQS.Client`
:param name: queue name, or None for all queues in config.
:type name: str
... | [
"def",
"_show_one_queue",
"(",
"self",
",",
"conn",
",",
"name",
",",
"count",
",",
"delete",
"=",
"False",
")",
":",
"url",
"=",
"self",
".",
"_url_for_queue",
"(",
"conn",
",",
"name",
")",
"logger",
".",
"debug",
"(",
"\"Queue '%s' url: %s\"",
",",
... | Show ``count`` messages from the specified SQS queue.
:param conn: SQS API connection
:type conn: :py:class:`botocore:SQS.Client`
:param name: queue name, or None for all queues in config.
:type name: str
:param count: maximum number of messages to get from queue
:type c... | [
"Show",
"count",
"messages",
"from",
"the",
"specified",
"SQS",
"queue",
"."
] | train | https://github.com/jantman/webhook2lambda2sqs/blob/c80c18d5a908ba8b8ee624dc3a977c633fba2b7c/webhook2lambda2sqs/aws.py#L166-L228 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.