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
radujica/baloo
baloo/core/indexes/base.py
Index.fillna
def fillna(self, value): """Returns Index with missing values replaced with value. Parameters ---------- value : {int, float, bytes, bool} Scalar value to replace missing values with. Returns ------- Index With missing values replaced. ...
python
def fillna(self, value): """Returns Index with missing values replaced with value. Parameters ---------- value : {int, float, bytes, bool} Scalar value to replace missing values with. Returns ------- Index With missing values replaced. ...
[ "def", "fillna", "(", "self", ",", "value", ")", ":", "if", "not", "is_scalar", "(", "value", ")", ":", "raise", "TypeError", "(", "'Value to replace with is not a valid scalar'", ")", "return", "Index", "(", "weld_replace", "(", "self", ".", "weld_expr", ",",...
Returns Index with missing values replaced with value. Parameters ---------- value : {int, float, bytes, bool} Scalar value to replace missing values with. Returns ------- Index With missing values replaced.
[ "Returns", "Index", "with", "missing", "values", "replaced", "with", "value", "." ]
train
https://github.com/radujica/baloo/blob/f6e05e35b73a75e8a300754c6bdc575e5f2d53b9/baloo/core/indexes/base.py#L261-L283
radujica/baloo
baloo/core/indexes/base.py
Index.from_pandas
def from_pandas(cls, index): """Create baloo Index from pandas Index. Parameters ---------- index : pandas.base.Index Returns ------- Index """ from pandas import Index as PandasIndex check_type(index, PandasIndex) return Index(...
python
def from_pandas(cls, index): """Create baloo Index from pandas Index. Parameters ---------- index : pandas.base.Index Returns ------- Index """ from pandas import Index as PandasIndex check_type(index, PandasIndex) return Index(...
[ "def", "from_pandas", "(", "cls", ",", "index", ")", ":", "from", "pandas", "import", "Index", "as", "PandasIndex", "check_type", "(", "index", ",", "PandasIndex", ")", "return", "Index", "(", "index", ".", "values", ",", "index", ".", "dtype", ",", "ind...
Create baloo Index from pandas Index. Parameters ---------- index : pandas.base.Index Returns ------- Index
[ "Create", "baloo", "Index", "from", "pandas", "Index", "." ]
train
https://github.com/radujica/baloo/blob/f6e05e35b73a75e8a300754c6bdc575e5f2d53b9/baloo/core/indexes/base.py#L286-L303
radujica/baloo
baloo/core/indexes/base.py
Index.to_pandas
def to_pandas(self): """Convert to pandas Index. Returns ------- pandas.base.Index """ if not self.is_raw(): raise ValueError('Cannot convert to pandas Index if not evaluated.') from pandas import Index as PandasIndex return PandasIndex(sel...
python
def to_pandas(self): """Convert to pandas Index. Returns ------- pandas.base.Index """ if not self.is_raw(): raise ValueError('Cannot convert to pandas Index if not evaluated.') from pandas import Index as PandasIndex return PandasIndex(sel...
[ "def", "to_pandas", "(", "self", ")", ":", "if", "not", "self", ".", "is_raw", "(", ")", ":", "raise", "ValueError", "(", "'Cannot convert to pandas Index if not evaluated.'", ")", "from", "pandas", "import", "Index", "as", "PandasIndex", "return", "PandasIndex", ...
Convert to pandas Index. Returns ------- pandas.base.Index
[ "Convert", "to", "pandas", "Index", "." ]
train
https://github.com/radujica/baloo/blob/f6e05e35b73a75e8a300754c6bdc575e5f2d53b9/baloo/core/indexes/base.py#L305-L320
lemieuxl/pyGenClean
pyGenClean/PlinkUtils/__init__.py
get_plink_version
def get_plink_version(): """Gets the Plink version from the binary. :returns: the version of the Plink software :rtype: str This function uses :py:class:`subprocess.Popen` to gather the version of the Plink binary. Since executing the software to gather the version creates an output file, it i...
python
def get_plink_version(): """Gets the Plink version from the binary. :returns: the version of the Plink software :rtype: str This function uses :py:class:`subprocess.Popen` to gather the version of the Plink binary. Since executing the software to gather the version creates an output file, it i...
[ "def", "get_plink_version", "(", ")", ":", "# Running the command", "tmp_fn", "=", "None", "with", "tempfile", ".", "NamedTemporaryFile", "(", "delete", "=", "False", ")", "as", "tmpfile", ":", "tmp_fn", "=", "tmpfile", ".", "name", "+", "\"_pyGenClean\"", "# ...
Gets the Plink version from the binary. :returns: the version of the Plink software :rtype: str This function uses :py:class:`subprocess.Popen` to gather the version of the Plink binary. Since executing the software to gather the version creates an output file, it is deleted. .. warning:: ...
[ "Gets", "the", "Plink", "version", "from", "the", "binary", "." ]
train
https://github.com/lemieuxl/pyGenClean/blob/6173a48ccc0cf3a3bd711b1f2a1fa16248b8bf55/pyGenClean/PlinkUtils/__init__.py#L58-L101
williamjameshandley/fgivenx
fgivenx/_utils.py
_check_args
def _check_args(logZ, f, x, samples, weights): """ Sanity-check the arguments for :func:`fgivenx.drivers.compute_samples`. Parameters ---------- f, x, samples, weights: see arguments for :func:`fgivenx.drivers.compute_samples` """ # convert to arrays if logZ is None: logZ = ...
python
def _check_args(logZ, f, x, samples, weights): """ Sanity-check the arguments for :func:`fgivenx.drivers.compute_samples`. Parameters ---------- f, x, samples, weights: see arguments for :func:`fgivenx.drivers.compute_samples` """ # convert to arrays if logZ is None: logZ = ...
[ "def", "_check_args", "(", "logZ", ",", "f", ",", "x", ",", "samples", ",", "weights", ")", ":", "# convert to arrays", "if", "logZ", "is", "None", ":", "logZ", "=", "[", "0", "]", "f", "=", "[", "f", "]", "samples", "=", "[", "samples", "]", "we...
Sanity-check the arguments for :func:`fgivenx.drivers.compute_samples`. Parameters ---------- f, x, samples, weights: see arguments for :func:`fgivenx.drivers.compute_samples`
[ "Sanity", "-", "check", "the", "arguments", "for", ":", "func", ":", "fgivenx", ".", "drivers", ".", "compute_samples", "." ]
train
https://github.com/williamjameshandley/fgivenx/blob/a16790652a3cef3cfacd4b97da62786cb66fec13/fgivenx/_utils.py#L4-L61
williamjameshandley/fgivenx
fgivenx/_utils.py
_normalise_weights
def _normalise_weights(logZ, weights, ntrim=None): """ Correctly normalise the weights for trimming This takes a list of log-evidences, and re-normalises the weights so that the largest weight across all samples is 1, and the total weight in each set of samples is proportional to the evidence. Par...
python
def _normalise_weights(logZ, weights, ntrim=None): """ Correctly normalise the weights for trimming This takes a list of log-evidences, and re-normalises the weights so that the largest weight across all samples is 1, and the total weight in each set of samples is proportional to the evidence. Par...
[ "def", "_normalise_weights", "(", "logZ", ",", "weights", ",", "ntrim", "=", "None", ")", ":", "logZ", "-=", "logZ", ".", "max", "(", ")", "Zs", "=", "numpy", ".", "exp", "(", "logZ", ")", "weights", "=", "[", "w", "/", "w", ".", "sum", "(", ")...
Correctly normalise the weights for trimming This takes a list of log-evidences, and re-normalises the weights so that the largest weight across all samples is 1, and the total weight in each set of samples is proportional to the evidence. Parameters ---------- logZ: array-like log-evi...
[ "Correctly", "normalise", "the", "weights", "for", "trimming" ]
train
https://github.com/williamjameshandley/fgivenx/blob/a16790652a3cef3cfacd4b97da62786cb66fec13/fgivenx/_utils.py#L64-L102
williamjameshandley/fgivenx
fgivenx/_utils.py
_equally_weight_samples
def _equally_weight_samples(samples, weights): """ Convert samples to be equally weighted. Samples are trimmed by discarding samples in accordance with a probability determined by the corresponding weight. This function has assumed you have normalised the weights properly. If in doubt, convert wei...
python
def _equally_weight_samples(samples, weights): """ Convert samples to be equally weighted. Samples are trimmed by discarding samples in accordance with a probability determined by the corresponding weight. This function has assumed you have normalised the weights properly. If in doubt, convert wei...
[ "def", "_equally_weight_samples", "(", "samples", ",", "weights", ")", ":", "if", "len", "(", "weights", ")", "!=", "len", "(", "samples", ")", ":", "raise", "ValueError", "(", "\"len(weights) = %i != len(samples) = %i\"", "%", "(", "len", "(", "weights", ")",...
Convert samples to be equally weighted. Samples are trimmed by discarding samples in accordance with a probability determined by the corresponding weight. This function has assumed you have normalised the weights properly. If in doubt, convert weights via: `weights /= weights.max()` Parameters ...
[ "Convert", "samples", "to", "be", "equally", "weighted", "." ]
train
https://github.com/williamjameshandley/fgivenx/blob/a16790652a3cef3cfacd4b97da62786cb66fec13/fgivenx/_utils.py#L105-L147
hugobrilhante/django-gcm-android-ios
gcm/utils.py
notification_push
def notification_push(dev_type, to, message=None, **kwargs): """ Send data from your server to your users' devices. """ key = { 'ANDROID': settings.GCM_ANDROID_APIKEY, 'IOS': settings.GCM_IOS_APIKEY } if not key[dev_type]: raise ImproperlyConfigured( "You hav...
python
def notification_push(dev_type, to, message=None, **kwargs): """ Send data from your server to your users' devices. """ key = { 'ANDROID': settings.GCM_ANDROID_APIKEY, 'IOS': settings.GCM_IOS_APIKEY } if not key[dev_type]: raise ImproperlyConfigured( "You hav...
[ "def", "notification_push", "(", "dev_type", ",", "to", ",", "message", "=", "None", ",", "*", "*", "kwargs", ")", ":", "key", "=", "{", "'ANDROID'", ":", "settings", ".", "GCM_ANDROID_APIKEY", ",", "'IOS'", ":", "settings", ".", "GCM_IOS_APIKEY", "}", "...
Send data from your server to your users' devices.
[ "Send", "data", "from", "your", "server", "to", "your", "users", "devices", "." ]
train
https://github.com/hugobrilhante/django-gcm-android-ios/blob/d5abd4c79a00cd3db9021941a20fc844544a1f4d/gcm/utils.py#L9-L59
hugobrilhante/django-gcm-android-ios
gcm/utils.py
get_device_model
def get_device_model(): """ Returns the Device model that is active in this project. """ try: return apps.get_model(settings.GCM_DEVICE_MODEL) except ValueError: raise ImproperlyConfigured("GCM_DEVICE_MODEL must be of the form 'app_label.model_name'") except LookupError: ...
python
def get_device_model(): """ Returns the Device model that is active in this project. """ try: return apps.get_model(settings.GCM_DEVICE_MODEL) except ValueError: raise ImproperlyConfigured("GCM_DEVICE_MODEL must be of the form 'app_label.model_name'") except LookupError: ...
[ "def", "get_device_model", "(", ")", ":", "try", ":", "return", "apps", ".", "get_model", "(", "settings", ".", "GCM_DEVICE_MODEL", ")", "except", "ValueError", ":", "raise", "ImproperlyConfigured", "(", "\"GCM_DEVICE_MODEL must be of the form 'app_label.model_name'\"", ...
Returns the Device model that is active in this project.
[ "Returns", "the", "Device", "model", "that", "is", "active", "in", "this", "project", "." ]
train
https://github.com/hugobrilhante/django-gcm-android-ios/blob/d5abd4c79a00cd3db9021941a20fc844544a1f4d/gcm/utils.py#L62-L73
tek/proteome
proteome/project.py
ProjectLoader.from_json
def from_json(self, json: Map) -> Maybe[Project]: ''' Try to instantiate a Project from the given json object. Convert the **type** key to **tpe** and its value to Maybe. Make sure **root** is a directory, fall back to resolution by **tpe/name**. Reinsert the root dir int...
python
def from_json(self, json: Map) -> Maybe[Project]: ''' Try to instantiate a Project from the given json object. Convert the **type** key to **tpe** and its value to Maybe. Make sure **root** is a directory, fall back to resolution by **tpe/name**. Reinsert the root dir int...
[ "def", "from_json", "(", "self", ",", "json", ":", "Map", ")", "->", "Maybe", "[", "Project", "]", ":", "root", "=", "json", ".", "get", "(", "'root'", ")", ".", "map", "(", "mkpath", ")", ".", "or_else", "(", "json", ".", "get_all", "(", "'type'...
Try to instantiate a Project from the given json object. Convert the **type** key to **tpe** and its value to Maybe. Make sure **root** is a directory, fall back to resolution by **tpe/name**. Reinsert the root dir into the json dict, filter out all keys that aren't conta...
[ "Try", "to", "instantiate", "a", "Project", "from", "the", "given", "json", "object", ".", "Convert", "the", "**", "type", "**", "key", "to", "**", "tpe", "**", "and", "its", "value", "to", "Maybe", ".", "Make", "sure", "**", "root", "**", "is", "a",...
train
https://github.com/tek/proteome/blob/b4fea6ca633a5b9ff56eaaf2507028fc6ff078b9/proteome/project.py#L305-L323
ilblackdragon/django-misc
misc/decorators.py
to_template
def to_template(template_name=None): """ Decorator for simple call TemplateResponse Examples: @to_template("test.html") def test(request): return {'test': 100} @to_template def test2(request): return {'test': 100, 'TEMPLATE': 'test.html'} @to_template def test2(requ...
python
def to_template(template_name=None): """ Decorator for simple call TemplateResponse Examples: @to_template("test.html") def test(request): return {'test': 100} @to_template def test2(request): return {'test': 100, 'TEMPLATE': 'test.html'} @to_template def test2(requ...
[ "def", "to_template", "(", "template_name", "=", "None", ")", ":", "def", "decorator", "(", "view_func", ")", ":", "def", "_wrapped_view", "(", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "result", "=", "view_func", "(", "request", ...
Decorator for simple call TemplateResponse Examples: @to_template("test.html") def test(request): return {'test': 100} @to_template def test2(request): return {'test': 100, 'TEMPLATE': 'test.html'} @to_template def test2(request, template_name='test.html'): return {...
[ "Decorator", "for", "simple", "call", "TemplateResponse", "Examples", ":", "@to_template", "(", "test", ".", "html", ")", "def", "test", "(", "request", ")", ":", "return", "{", "test", ":", "100", "}" ]
train
https://github.com/ilblackdragon/django-misc/blob/0accd2dc97de656a1c9e275be81e817f78a2eb9d/misc/decorators.py#L12-L36
ilblackdragon/django-misc
misc/decorators.py
receiver
def receiver(signal, **kwargs): """ Introduced in Django 1.3 (django.dispatch.receiver) A decorator for connecting receivers to signals. Used by passing in the signal and keyword arguments to connect:: @receiver(post_save, sender=MyModel) def signal_receiver(sender, **kwargs): do_s...
python
def receiver(signal, **kwargs): """ Introduced in Django 1.3 (django.dispatch.receiver) A decorator for connecting receivers to signals. Used by passing in the signal and keyword arguments to connect:: @receiver(post_save, sender=MyModel) def signal_receiver(sender, **kwargs): do_s...
[ "def", "receiver", "(", "signal", ",", "*", "*", "kwargs", ")", ":", "def", "_decorator", "(", "func", ")", ":", "signal", ".", "connect", "(", "func", ",", "*", "*", "kwargs", ")", "return", "func", "return", "_decorator" ]
Introduced in Django 1.3 (django.dispatch.receiver) A decorator for connecting receivers to signals. Used by passing in the signal and keyword arguments to connect:: @receiver(post_save, sender=MyModel) def signal_receiver(sender, **kwargs): do_stuff()
[ "Introduced", "in", "Django", "1", ".", "3", "(", "django", ".", "dispatch", ".", "receiver", ")", "A", "decorator", "for", "connecting", "receivers", "to", "signals", ".", "Used", "by", "passing", "in", "the", "signal", "and", "keyword", "arguments", "to"...
train
https://github.com/ilblackdragon/django-misc/blob/0accd2dc97de656a1c9e275be81e817f78a2eb9d/misc/decorators.py#L40-L54
lemieuxl/pyGenClean
pyGenClean/run_data_clean_up.py
main
def main(): """The main function. These are the steps performed for the data clean up: 1. Prints the version number. 2. Reads the configuration file (:py:func:`read_config_file`). 3. Creates a new directory with ``data_clean_up`` as prefix and the date and time as suffix. 4. Check the i...
python
def main(): """The main function. These are the steps performed for the data clean up: 1. Prints the version number. 2. Reads the configuration file (:py:func:`read_config_file`). 3. Creates a new directory with ``data_clean_up`` as prefix and the date and time as suffix. 4. Check the i...
[ "def", "main", "(", ")", ":", "# Getting and checking the options", "args", "=", "parse_args", "(", ")", "check_args", "(", "args", ")", "# The directory name", "dirname", "=", "\"data_clean_up.\"", "dirname", "+=", "datetime", ".", "datetime", ".", "today", "(", ...
The main function. These are the steps performed for the data clean up: 1. Prints the version number. 2. Reads the configuration file (:py:func:`read_config_file`). 3. Creates a new directory with ``data_clean_up`` as prefix and the date and time as suffix. 4. Check the input file type (``b...
[ "The", "main", "function", "." ]
train
https://github.com/lemieuxl/pyGenClean/blob/6173a48ccc0cf3a3bd711b1f2a1fa16248b8bf55/pyGenClean/run_data_clean_up.py#L71-L267
lemieuxl/pyGenClean
pyGenClean/run_data_clean_up.py
run_duplicated_samples
def run_duplicated_samples(in_prefix, in_type, out_prefix, base_dir, options): """Runs step1 (duplicated samples). :param in_prefix: the prefix of the input files. :param in_type: the type of the input files. :param out_prefix: the output prefix. :param base_dir: the output directory. :param op...
python
def run_duplicated_samples(in_prefix, in_type, out_prefix, base_dir, options): """Runs step1 (duplicated samples). :param in_prefix: the prefix of the input files. :param in_type: the type of the input files. :param out_prefix: the output prefix. :param base_dir: the output directory. :param op...
[ "def", "run_duplicated_samples", "(", "in_prefix", ",", "in_type", ",", "out_prefix", ",", "base_dir", ",", "options", ")", ":", "# Creating the output directory", "os", ".", "mkdir", "(", "out_prefix", ")", "# We know we need tfile", "required_type", "=", "\"tfile\""...
Runs step1 (duplicated samples). :param in_prefix: the prefix of the input files. :param in_type: the type of the input files. :param out_prefix: the output prefix. :param base_dir: the output directory. :param options: the options needed. :type in_prefix: str :type in_type: str :type ...
[ "Runs", "step1", "(", "duplicated", "samples", ")", "." ]
train
https://github.com/lemieuxl/pyGenClean/blob/6173a48ccc0cf3a3bd711b1f2a1fa16248b8bf55/pyGenClean/run_data_clean_up.py#L270-L493
lemieuxl/pyGenClean
pyGenClean/run_data_clean_up.py
run_duplicated_snps
def run_duplicated_snps(in_prefix, in_type, out_prefix, base_dir, options): """Runs step2 (duplicated snps). :param in_prefix: the prefix of the input files. :param in_type: the type of the input files. :param out_prefix: the output prefix. :param base_dir: the output directory. :param options:...
python
def run_duplicated_snps(in_prefix, in_type, out_prefix, base_dir, options): """Runs step2 (duplicated snps). :param in_prefix: the prefix of the input files. :param in_type: the type of the input files. :param out_prefix: the output prefix. :param base_dir: the output directory. :param options:...
[ "def", "run_duplicated_snps", "(", "in_prefix", ",", "in_type", ",", "out_prefix", ",", "base_dir", ",", "options", ")", ":", "# Creating the output directory", "os", ".", "mkdir", "(", "out_prefix", ")", "# We know we need a tfile", "required_type", "=", "\"tfile\"",...
Runs step2 (duplicated snps). :param in_prefix: the prefix of the input files. :param in_type: the type of the input files. :param out_prefix: the output prefix. :param base_dir: the output directory. :param options: the options needed. :type in_prefix: str :type in_type: str :type out...
[ "Runs", "step2", "(", "duplicated", "snps", ")", "." ]
train
https://github.com/lemieuxl/pyGenClean/blob/6173a48ccc0cf3a3bd711b1f2a1fa16248b8bf55/pyGenClean/run_data_clean_up.py#L496-L731
lemieuxl/pyGenClean
pyGenClean/run_data_clean_up.py
run_noCall_hetero_snps
def run_noCall_hetero_snps(in_prefix, in_type, out_prefix, base_dir, options): """Runs step 3 (clean no call and hetero). :param in_prefix: the prefix of the input files. :param in_type: the type of the input files. :param out_prefix: the output prefix. :param base_dir: the output directory. :p...
python
def run_noCall_hetero_snps(in_prefix, in_type, out_prefix, base_dir, options): """Runs step 3 (clean no call and hetero). :param in_prefix: the prefix of the input files. :param in_type: the type of the input files. :param out_prefix: the output prefix. :param base_dir: the output directory. :p...
[ "def", "run_noCall_hetero_snps", "(", "in_prefix", ",", "in_type", ",", "out_prefix", ",", "base_dir", ",", "options", ")", ":", "# Creating the output directory", "os", ".", "mkdir", "(", "out_prefix", ")", "# We know we need a tfile", "required_type", "=", "\"tfile\...
Runs step 3 (clean no call and hetero). :param in_prefix: the prefix of the input files. :param in_type: the type of the input files. :param out_prefix: the output prefix. :param base_dir: the output directory. :param options: the options needed. :type in_prefix: str :type in_type: str ...
[ "Runs", "step", "3", "(", "clean", "no", "call", "and", "hetero", ")", "." ]
train
https://github.com/lemieuxl/pyGenClean/blob/6173a48ccc0cf3a3bd711b1f2a1fa16248b8bf55/pyGenClean/run_data_clean_up.py#L734-L849
lemieuxl/pyGenClean
pyGenClean/run_data_clean_up.py
run_sample_missingness
def run_sample_missingness(in_prefix, in_type, out_prefix, base_dir, options): """Runs step4 (clean mind). :param in_prefix: the prefix of the input files. :param in_type: the type of the input files. :param out_prefix: the output prefix. :param base_dir: the output directory. :param options: t...
python
def run_sample_missingness(in_prefix, in_type, out_prefix, base_dir, options): """Runs step4 (clean mind). :param in_prefix: the prefix of the input files. :param in_type: the type of the input files. :param out_prefix: the output prefix. :param base_dir: the output directory. :param options: t...
[ "def", "run_sample_missingness", "(", "in_prefix", ",", "in_type", ",", "out_prefix", ",", "base_dir", ",", "options", ")", ":", "# Creating the output directory", "os", ".", "mkdir", "(", "out_prefix", ")", "# We are looking at what we have", "required_type", "=", "\...
Runs step4 (clean mind). :param in_prefix: the prefix of the input files. :param in_type: the type of the input files. :param out_prefix: the output prefix. :param base_dir: the output directory. :param options: the options needed. :type in_prefix: str :type in_type: str :type out_pref...
[ "Runs", "step4", "(", "clean", "mind", ")", "." ]
train
https://github.com/lemieuxl/pyGenClean/blob/6173a48ccc0cf3a3bd711b1f2a1fa16248b8bf55/pyGenClean/run_data_clean_up.py#L852-L974
lemieuxl/pyGenClean
pyGenClean/run_data_clean_up.py
run_contamination
def run_contamination(in_prefix, in_type, out_prefix, base_dir, options): """Runs the contamination check for samples. :param in_prefix: the prefix of the input files. :param in_type: the type of the input files. :param out_prefix: the output prefix. :param base_dir: the output directory. :para...
python
def run_contamination(in_prefix, in_type, out_prefix, base_dir, options): """Runs the contamination check for samples. :param in_prefix: the prefix of the input files. :param in_type: the type of the input files. :param out_prefix: the output prefix. :param base_dir: the output directory. :para...
[ "def", "run_contamination", "(", "in_prefix", ",", "in_type", ",", "out_prefix", ",", "base_dir", ",", "options", ")", ":", "# Creating the output directory", "os", ".", "mkdir", "(", "out_prefix", ")", "# We know we need a bfile", "required_type", "=", "\"bfile\"", ...
Runs the contamination check for samples. :param in_prefix: the prefix of the input files. :param in_type: the type of the input files. :param out_prefix: the output prefix. :param base_dir: the output directory. :param options: the options needed. :type in_prefix: str :type in_type: str ...
[ "Runs", "the", "contamination", "check", "for", "samples", "." ]
train
https://github.com/lemieuxl/pyGenClean/blob/6173a48ccc0cf3a3bd711b1f2a1fa16248b8bf55/pyGenClean/run_data_clean_up.py#L1099-L1266
lemieuxl/pyGenClean
pyGenClean/run_data_clean_up.py
run_sex_check
def run_sex_check(in_prefix, in_type, out_prefix, base_dir, options): """Runs step6 (sexcheck). :param in_prefix: the prefix of the input files. :param in_type: the type of the input files. :param out_prefix: the output prefix. :param base_dir: the output directory. :param options: the options ...
python
def run_sex_check(in_prefix, in_type, out_prefix, base_dir, options): """Runs step6 (sexcheck). :param in_prefix: the prefix of the input files. :param in_type: the type of the input files. :param out_prefix: the output prefix. :param base_dir: the output directory. :param options: the options ...
[ "def", "run_sex_check", "(", "in_prefix", ",", "in_type", ",", "out_prefix", ",", "base_dir", ",", "options", ")", ":", "# Creating the output directory", "os", ".", "mkdir", "(", "out_prefix", ")", "# We know we need a bfile", "required_type", "=", "\"bfile\"", "ch...
Runs step6 (sexcheck). :param in_prefix: the prefix of the input files. :param in_type: the type of the input files. :param out_prefix: the output prefix. :param base_dir: the output directory. :param options: the options needed. :type in_prefix: str :type in_type: str :type out_prefix...
[ "Runs", "step6", "(", "sexcheck", ")", "." ]
train
https://github.com/lemieuxl/pyGenClean/blob/6173a48ccc0cf3a3bd711b1f2a1fa16248b8bf55/pyGenClean/run_data_clean_up.py#L1269-L1636
lemieuxl/pyGenClean
pyGenClean/run_data_clean_up.py
run_plate_bias
def run_plate_bias(in_prefix, in_type, out_prefix, base_dir, options): """Runs step7 (plate bias). :param in_prefix: the prefix of the input files. :param in_type: the type of the input files. :param out_prefix: the output prefix. :param base_dir: the output directory. :param options: the optio...
python
def run_plate_bias(in_prefix, in_type, out_prefix, base_dir, options): """Runs step7 (plate bias). :param in_prefix: the prefix of the input files. :param in_type: the type of the input files. :param out_prefix: the output prefix. :param base_dir: the output directory. :param options: the optio...
[ "def", "run_plate_bias", "(", "in_prefix", ",", "in_type", ",", "out_prefix", ",", "base_dir", ",", "options", ")", ":", "# Creating the output directory", "os", ".", "mkdir", "(", "out_prefix", ")", "# We know we need bfile", "required_type", "=", "\"bfile\"", "che...
Runs step7 (plate bias). :param in_prefix: the prefix of the input files. :param in_type: the type of the input files. :param out_prefix: the output prefix. :param base_dir: the output directory. :param options: the options needed. :type in_prefix: str :type in_type: str :type out_pref...
[ "Runs", "step7", "(", "plate", "bias", ")", "." ]
train
https://github.com/lemieuxl/pyGenClean/blob/6173a48ccc0cf3a3bd711b1f2a1fa16248b8bf55/pyGenClean/run_data_clean_up.py#L1639-L1803
lemieuxl/pyGenClean
pyGenClean/run_data_clean_up.py
run_remove_heterozygous_haploid
def run_remove_heterozygous_haploid(in_prefix, in_type, out_prefix, base_dir, options): """Runs step8 (remove heterozygous haploid). :param in_prefix: the prefix of the input files. :param in_type: the type of the input files. :param out_prefix: the output prefix. ...
python
def run_remove_heterozygous_haploid(in_prefix, in_type, out_prefix, base_dir, options): """Runs step8 (remove heterozygous haploid). :param in_prefix: the prefix of the input files. :param in_type: the type of the input files. :param out_prefix: the output prefix. ...
[ "def", "run_remove_heterozygous_haploid", "(", "in_prefix", ",", "in_type", ",", "out_prefix", ",", "base_dir", ",", "options", ")", ":", "# Creating the output directory", "os", ".", "mkdir", "(", "out_prefix", ")", "# We know we need bfile", "required_type", "=", "\...
Runs step8 (remove heterozygous haploid). :param in_prefix: the prefix of the input files. :param in_type: the type of the input files. :param out_prefix: the output prefix. :param base_dir: the output directory. :param options: the options needed. :type in_prefix: str :type in_type: str ...
[ "Runs", "step8", "(", "remove", "heterozygous", "haploid", ")", "." ]
train
https://github.com/lemieuxl/pyGenClean/blob/6173a48ccc0cf3a3bd711b1f2a1fa16248b8bf55/pyGenClean/run_data_clean_up.py#L1806-L1900
lemieuxl/pyGenClean
pyGenClean/run_data_clean_up.py
run_find_related_samples
def run_find_related_samples(in_prefix, in_type, out_prefix, base_dir, options): """Runs step9 (find related samples). :param in_prefix: the prefix of the input files. :param in_type: the type of the input files. :param out_prefix: the output prefix. :param base_dir: th...
python
def run_find_related_samples(in_prefix, in_type, out_prefix, base_dir, options): """Runs step9 (find related samples). :param in_prefix: the prefix of the input files. :param in_type: the type of the input files. :param out_prefix: the output prefix. :param base_dir: th...
[ "def", "run_find_related_samples", "(", "in_prefix", ",", "in_type", ",", "out_prefix", ",", "base_dir", ",", "options", ")", ":", "# Creating the output directory", "os", ".", "mkdir", "(", "out_prefix", ")", "# We know we need bfile", "required_type", "=", "\"bfile\...
Runs step9 (find related samples). :param in_prefix: the prefix of the input files. :param in_type: the type of the input files. :param out_prefix: the output prefix. :param base_dir: the output directory. :param options: the options needed. :type in_prefix: str :type in_type: str :typ...
[ "Runs", "step9", "(", "find", "related", "samples", ")", "." ]
train
https://github.com/lemieuxl/pyGenClean/blob/6173a48ccc0cf3a3bd711b1f2a1fa16248b8bf55/pyGenClean/run_data_clean_up.py#L1903-L2153
lemieuxl/pyGenClean
pyGenClean/run_data_clean_up.py
run_check_ethnicity
def run_check_ethnicity(in_prefix, in_type, out_prefix, base_dir, options): """Runs step10 (check ethnicity). :param in_prefix: the prefix of the input files. :param in_type: the type of the input files. :param out_prefix: the output prefix. :param base_dir: the output directory. :param options...
python
def run_check_ethnicity(in_prefix, in_type, out_prefix, base_dir, options): """Runs step10 (check ethnicity). :param in_prefix: the prefix of the input files. :param in_type: the type of the input files. :param out_prefix: the output prefix. :param base_dir: the output directory. :param options...
[ "def", "run_check_ethnicity", "(", "in_prefix", ",", "in_type", ",", "out_prefix", ",", "base_dir", ",", "options", ")", ":", "# Creating the output directory", "os", ".", "mkdir", "(", "out_prefix", ")", "# We know we need bfile", "required_type", "=", "\"bfile\"", ...
Runs step10 (check ethnicity). :param in_prefix: the prefix of the input files. :param in_type: the type of the input files. :param out_prefix: the output prefix. :param base_dir: the output directory. :param options: the options needed. :type in_prefix: str :type in_type: str :type ou...
[ "Runs", "step10", "(", "check", "ethnicity", ")", "." ]
train
https://github.com/lemieuxl/pyGenClean/blob/6173a48ccc0cf3a3bd711b1f2a1fa16248b8bf55/pyGenClean/run_data_clean_up.py#L2156-L2384
lemieuxl/pyGenClean
pyGenClean/run_data_clean_up.py
run_flag_maf_zero
def run_flag_maf_zero(in_prefix, in_type, out_prefix, base_dir, options): """Runs step11 (flag MAF zero). :param in_prefix: the prefix of the input files. :param in_type: the type of the input files. :param out_prefix: the output prefix. :param base_dir: the output directory. :param options: th...
python
def run_flag_maf_zero(in_prefix, in_type, out_prefix, base_dir, options): """Runs step11 (flag MAF zero). :param in_prefix: the prefix of the input files. :param in_type: the type of the input files. :param out_prefix: the output prefix. :param base_dir: the output directory. :param options: th...
[ "def", "run_flag_maf_zero", "(", "in_prefix", ",", "in_type", ",", "out_prefix", ",", "base_dir", ",", "options", ")", ":", "# Creating the output directory", "os", ".", "mkdir", "(", "out_prefix", ")", "# We know we need bfile", "required_type", "=", "\"bfile\"", "...
Runs step11 (flag MAF zero). :param in_prefix: the prefix of the input files. :param in_type: the type of the input files. :param out_prefix: the output prefix. :param base_dir: the output directory. :param options: the options needed. :type in_prefix: str :type in_type: str :type out_...
[ "Runs", "step11", "(", "flag", "MAF", "zero", ")", "." ]
train
https://github.com/lemieuxl/pyGenClean/blob/6173a48ccc0cf3a3bd711b1f2a1fa16248b8bf55/pyGenClean/run_data_clean_up.py#L2387-L2483
lemieuxl/pyGenClean
pyGenClean/run_data_clean_up.py
run_flag_hw
def run_flag_hw(in_prefix, in_type, out_prefix, base_dir, options): """Runs step12 (flag HW). :param in_prefix: the prefix of the input files. :param in_type: the type of the input files. :param out_prefix: the output prefix. :param base_dir: the output directory. :param options: the options ne...
python
def run_flag_hw(in_prefix, in_type, out_prefix, base_dir, options): """Runs step12 (flag HW). :param in_prefix: the prefix of the input files. :param in_type: the type of the input files. :param out_prefix: the output prefix. :param base_dir: the output directory. :param options: the options ne...
[ "def", "run_flag_hw", "(", "in_prefix", ",", "in_type", ",", "out_prefix", ",", "base_dir", ",", "options", ")", ":", "# Creating the output directory", "os", ".", "mkdir", "(", "out_prefix", ")", "# We know we need bfile", "required_type", "=", "\"bfile\"", "check_...
Runs step12 (flag HW). :param in_prefix: the prefix of the input files. :param in_type: the type of the input files. :param out_prefix: the output prefix. :param base_dir: the output directory. :param options: the options needed. :type in_prefix: str :type in_type: str :type out_prefix...
[ "Runs", "step12", "(", "flag", "HW", ")", "." ]
train
https://github.com/lemieuxl/pyGenClean/blob/6173a48ccc0cf3a3bd711b1f2a1fa16248b8bf55/pyGenClean/run_data_clean_up.py#L2486-L2619
lemieuxl/pyGenClean
pyGenClean/run_data_clean_up.py
run_compare_gold_standard
def run_compare_gold_standard(in_prefix, in_type, out_prefix, base_dir, options): """Compares with a gold standard data set (compare_gold_standard. :param in_prefix: the prefix of the input files. :param in_type: the type of the input files. :param out_prefix: the output p...
python
def run_compare_gold_standard(in_prefix, in_type, out_prefix, base_dir, options): """Compares with a gold standard data set (compare_gold_standard. :param in_prefix: the prefix of the input files. :param in_type: the type of the input files. :param out_prefix: the output p...
[ "def", "run_compare_gold_standard", "(", "in_prefix", ",", "in_type", ",", "out_prefix", ",", "base_dir", ",", "options", ")", ":", "# Creating the output directory", "os", ".", "mkdir", "(", "out_prefix", ")", "# We know we need bfile", "required_type", "=", "\"bfile...
Compares with a gold standard data set (compare_gold_standard. :param in_prefix: the prefix of the input files. :param in_type: the type of the input files. :param out_prefix: the output prefix. :param base_dir: the output directory. :param options: the options needed. :type in_prefix: str ...
[ "Compares", "with", "a", "gold", "standard", "data", "set", "(", "compare_gold_standard", "." ]
train
https://github.com/lemieuxl/pyGenClean/blob/6173a48ccc0cf3a3bd711b1f2a1fa16248b8bf55/pyGenClean/run_data_clean_up.py#L2622-L2694
lemieuxl/pyGenClean
pyGenClean/run_data_clean_up.py
run_subset_data
def run_subset_data(in_prefix, in_type, out_prefix, base_dir, options): """Subsets the data. :param in_prefix: the prefix of the input files. :param in_type: the type of the input files. :param out_prefix: the output prefix. :param base_dir: the output directory. :param options: the options nee...
python
def run_subset_data(in_prefix, in_type, out_prefix, base_dir, options): """Subsets the data. :param in_prefix: the prefix of the input files. :param in_type: the type of the input files. :param out_prefix: the output prefix. :param base_dir: the output directory. :param options: the options nee...
[ "def", "run_subset_data", "(", "in_prefix", ",", "in_type", ",", "out_prefix", ",", "base_dir", ",", "options", ")", ":", "# Creating the output directory", "os", ".", "mkdir", "(", "out_prefix", ")", "# The prefix of the script", "script_prefix", "=", "os", ".", ...
Subsets the data. :param in_prefix: the prefix of the input files. :param in_type: the type of the input files. :param out_prefix: the output prefix. :param base_dir: the output directory. :param options: the options needed. :type in_prefix: str :type in_type: str :type out_prefix: str...
[ "Subsets", "the", "data", "." ]
train
https://github.com/lemieuxl/pyGenClean/blob/6173a48ccc0cf3a3bd711b1f2a1fa16248b8bf55/pyGenClean/run_data_clean_up.py#L2697-L3092
lemieuxl/pyGenClean
pyGenClean/run_data_clean_up.py
run_command
def run_command(command): """Run a command using subprocesses. :param command: the command to run. :type command: list Tries to run a command. If it fails, raise a :py:class:`ProgramError`. .. warning:: The variable ``command`` should be a list of strings (no other type). """ ou...
python
def run_command(command): """Run a command using subprocesses. :param command: the command to run. :type command: list Tries to run a command. If it fails, raise a :py:class:`ProgramError`. .. warning:: The variable ``command`` should be a list of strings (no other type). """ ou...
[ "def", "run_command", "(", "command", ")", ":", "output", "=", "None", "try", ":", "output", "=", "subprocess", ".", "check_output", "(", "command", ",", "stderr", "=", "subprocess", ".", "STDOUT", ",", "shell", "=", "False", ")", "except", "subprocess", ...
Run a command using subprocesses. :param command: the command to run. :type command: list Tries to run a command. If it fails, raise a :py:class:`ProgramError`. .. warning:: The variable ``command`` should be a list of strings (no other type).
[ "Run", "a", "command", "using", "subprocesses", "." ]
train
https://github.com/lemieuxl/pyGenClean/blob/6173a48ccc0cf3a3bd711b1f2a1fa16248b8bf55/pyGenClean/run_data_clean_up.py#L3095-L3114
lemieuxl/pyGenClean
pyGenClean/run_data_clean_up.py
count_markers_samples
def count_markers_samples(prefix, file_type): """Counts the number of markers and samples in plink file. :param prefix: the prefix of the files. :param file_type: the file type. :type prefix: str :type file_type: str :returns: the number of markers and samples (in a tuple). """ # The...
python
def count_markers_samples(prefix, file_type): """Counts the number of markers and samples in plink file. :param prefix: the prefix of the files. :param file_type: the file type. :type prefix: str :type file_type: str :returns: the number of markers and samples (in a tuple). """ # The...
[ "def", "count_markers_samples", "(", "prefix", ",", "file_type", ")", ":", "# The files that will need counting", "sample_file", "=", "None", "marker_file", "=", "None", "if", "file_type", "==", "\"bfile\"", ":", "# Binary files (.bed, .bim and .fam)", "sample_file", "=",...
Counts the number of markers and samples in plink file. :param prefix: the prefix of the files. :param file_type: the file type. :type prefix: str :type file_type: str :returns: the number of markers and samples (in a tuple).
[ "Counts", "the", "number", "of", "markers", "and", "samples", "in", "plink", "file", "." ]
train
https://github.com/lemieuxl/pyGenClean/blob/6173a48ccc0cf3a3bd711b1f2a1fa16248b8bf55/pyGenClean/run_data_clean_up.py#L3117-L3159
lemieuxl/pyGenClean
pyGenClean/run_data_clean_up.py
check_input_files
def check_input_files(prefix, the_type, required_type): """Check that the file is of a certain file type. :param prefix: the prefix of the input files. :param the_type: the type of the input files (bfile, tfile or file). :param required_type: the required type of the input files (bfile, tfile or ...
python
def check_input_files(prefix, the_type, required_type): """Check that the file is of a certain file type. :param prefix: the prefix of the input files. :param the_type: the type of the input files (bfile, tfile or file). :param required_type: the required type of the input files (bfile, tfile or ...
[ "def", "check_input_files", "(", "prefix", ",", "the_type", ",", "required_type", ")", ":", "# The files required for each type", "bfile_type", "=", "{", "\".bed\"", ",", "\".bim\"", ",", "\".fam\"", "}", "tfile_type", "=", "{", "\".tped\"", ",", "\".tfam\"", "}",...
Check that the file is of a certain file type. :param prefix: the prefix of the input files. :param the_type: the type of the input files (bfile, tfile or file). :param required_type: the required type of the input files (bfile, tfile or file). :type prefix: str :type the...
[ "Check", "that", "the", "file", "is", "of", "a", "certain", "file", "type", "." ]
train
https://github.com/lemieuxl/pyGenClean/blob/6173a48ccc0cf3a3bd711b1f2a1fa16248b8bf55/pyGenClean/run_data_clean_up.py#L3162-L3277
lemieuxl/pyGenClean
pyGenClean/run_data_clean_up.py
all_files_exist
def all_files_exist(file_list): """Check if all files exist. :param file_list: the names of files to check. :type file_list: list :returns: ``True`` if all files exist, ``False`` otherwise. """ all_exist = True for filename in file_list: all_exist = all_exist and os.path.isfile(f...
python
def all_files_exist(file_list): """Check if all files exist. :param file_list: the names of files to check. :type file_list: list :returns: ``True`` if all files exist, ``False`` otherwise. """ all_exist = True for filename in file_list: all_exist = all_exist and os.path.isfile(f...
[ "def", "all_files_exist", "(", "file_list", ")", ":", "all_exist", "=", "True", "for", "filename", "in", "file_list", ":", "all_exist", "=", "all_exist", "and", "os", ".", "path", ".", "isfile", "(", "filename", ")", "return", "all_exist" ]
Check if all files exist. :param file_list: the names of files to check. :type file_list: list :returns: ``True`` if all files exist, ``False`` otherwise.
[ "Check", "if", "all", "files", "exist", "." ]
train
https://github.com/lemieuxl/pyGenClean/blob/6173a48ccc0cf3a3bd711b1f2a1fa16248b8bf55/pyGenClean/run_data_clean_up.py#L3280-L3293
lemieuxl/pyGenClean
pyGenClean/run_data_clean_up.py
read_config_file
def read_config_file(filename): """Reads the configuration file. :param filename: the name of the file containing the configuration. :type filename: str :returns: A tuple where the first element is a list of sections, and the second element is a map containing the configuration (options...
python
def read_config_file(filename): """Reads the configuration file. :param filename: the name of the file containing the configuration. :type filename: str :returns: A tuple where the first element is a list of sections, and the second element is a map containing the configuration (options...
[ "def", "read_config_file", "(", "filename", ")", ":", "# Creating the config parser", "config", "=", "ConfigParser", ".", "RawConfigParser", "(", "allow_no_value", "=", "True", ")", "config", ".", "optionxform", "=", "str", "config", ".", "read", "(", "filename", ...
Reads the configuration file. :param filename: the name of the file containing the configuration. :type filename: str :returns: A tuple where the first element is a list of sections, and the second element is a map containing the configuration (options and values). The st...
[ "Reads", "the", "configuration", "file", "." ]
train
https://github.com/lemieuxl/pyGenClean/blob/6173a48ccc0cf3a3bd711b1f2a1fa16248b8bf55/pyGenClean/run_data_clean_up.py#L3296-L3434
lemieuxl/pyGenClean
pyGenClean/run_data_clean_up.py
check_args
def check_args(args): """Checks the arguments and options. :param args: an object containing the options and arguments of the program. :type args: :py:class:`argparse.Namespace` :returns: ``True`` if everything was OK. If there is a problem with an option, an exception is raised using the :p...
python
def check_args(args): """Checks the arguments and options. :param args: an object containing the options and arguments of the program. :type args: :py:class:`argparse.Namespace` :returns: ``True`` if everything was OK. If there is a problem with an option, an exception is raised using the :p...
[ "def", "check_args", "(", "args", ")", ":", "# Checking the configuration file", "if", "not", "os", ".", "path", ".", "isfile", "(", "args", ".", "conf", ")", ":", "msg", "=", "\"{}: no such file\"", ".", "format", "(", "args", ".", "conf", ")", "raise", ...
Checks the arguments and options. :param args: an object containing the options and arguments of the program. :type args: :py:class:`argparse.Namespace` :returns: ``True`` if everything was OK. If there is a problem with an option, an exception is raised using the :py:class:`ProgramError` class,...
[ "Checks", "the", "arguments", "and", "options", "." ]
train
https://github.com/lemieuxl/pyGenClean/blob/6173a48ccc0cf3a3bd711b1f2a1fa16248b8bf55/pyGenClean/run_data_clean_up.py#L3437-L3479
OTL/jps
jps/security.py
Authenticator.instance
def instance(cls, public_keys_dir): '''Please avoid create multi instance''' if public_keys_dir in cls._authenticators: return cls._authenticators[public_keys_dir] new_instance = cls(public_keys_dir) cls._authenticators[public_keys_dir] = new_instance return new_insta...
python
def instance(cls, public_keys_dir): '''Please avoid create multi instance''' if public_keys_dir in cls._authenticators: return cls._authenticators[public_keys_dir] new_instance = cls(public_keys_dir) cls._authenticators[public_keys_dir] = new_instance return new_insta...
[ "def", "instance", "(", "cls", ",", "public_keys_dir", ")", ":", "if", "public_keys_dir", "in", "cls", ".", "_authenticators", ":", "return", "cls", ".", "_authenticators", "[", "public_keys_dir", "]", "new_instance", "=", "cls", "(", "public_keys_dir", ")", "...
Please avoid create multi instance
[ "Please", "avoid", "create", "multi", "instance" ]
train
https://github.com/OTL/jps/blob/2c5a438d59611fffca6853072c822ef22665ed87/jps/security.py#L18-L24
OTL/jps
jps/security.py
Authenticator.set_server_key
def set_server_key(self, zmq_socket, server_secret_key_path): '''must call before bind''' load_and_set_key(zmq_socket, server_secret_key_path) zmq_socket.curve_server = True
python
def set_server_key(self, zmq_socket, server_secret_key_path): '''must call before bind''' load_and_set_key(zmq_socket, server_secret_key_path) zmq_socket.curve_server = True
[ "def", "set_server_key", "(", "self", ",", "zmq_socket", ",", "server_secret_key_path", ")", ":", "load_and_set_key", "(", "zmq_socket", ",", "server_secret_key_path", ")", "zmq_socket", ".", "curve_server", "=", "True" ]
must call before bind
[ "must", "call", "before", "bind" ]
train
https://github.com/OTL/jps/blob/2c5a438d59611fffca6853072c822ef22665ed87/jps/security.py#L32-L35
OTL/jps
jps/security.py
Authenticator.set_client_key
def set_client_key(self, zmq_socket, client_secret_key_path, server_public_key_path): '''must call before bind''' load_and_set_key(zmq_socket, client_secret_key_path) server_public, _ = zmq.auth.load_certificate(server_public_key_path) zmq_socket.curve_serverkey = server_public
python
def set_client_key(self, zmq_socket, client_secret_key_path, server_public_key_path): '''must call before bind''' load_and_set_key(zmq_socket, client_secret_key_path) server_public, _ = zmq.auth.load_certificate(server_public_key_path) zmq_socket.curve_serverkey = server_public
[ "def", "set_client_key", "(", "self", ",", "zmq_socket", ",", "client_secret_key_path", ",", "server_public_key_path", ")", ":", "load_and_set_key", "(", "zmq_socket", ",", "client_secret_key_path", ")", "server_public", ",", "_", "=", "zmq", ".", "auth", ".", "lo...
must call before bind
[ "must", "call", "before", "bind" ]
train
https://github.com/OTL/jps/blob/2c5a438d59611fffca6853072c822ef22665ed87/jps/security.py#L37-L41
jrjparks/django-rest-framework-nested
rest_framework_nested/routers.py
SimpleRouter._register_nested_router
def _register_nested_router(self, router): """ NestedSimpleRouter.__init__ calls this method """ assert issubclass(router.__class__, NestedSimpleRouter), "You can only register NestedSimpleRouters" self.nested_routers.append(router)
python
def _register_nested_router(self, router): """ NestedSimpleRouter.__init__ calls this method """ assert issubclass(router.__class__, NestedSimpleRouter), "You can only register NestedSimpleRouters" self.nested_routers.append(router)
[ "def", "_register_nested_router", "(", "self", ",", "router", ")", ":", "assert", "issubclass", "(", "router", ".", "__class__", ",", "NestedSimpleRouter", ")", ",", "\"You can only register NestedSimpleRouters\"", "self", ".", "nested_routers", ".", "append", "(", ...
NestedSimpleRouter.__init__ calls this method
[ "NestedSimpleRouter", ".", "__init__", "calls", "this", "method" ]
train
https://github.com/jrjparks/django-rest-framework-nested/blob/8ab797281e11507b8142f342ad73ca48ef82565c/rest_framework_nested/routers.py#L13-L18
jrjparks/django-rest-framework-nested
rest_framework_nested/routers.py
SimpleRouter.get_urls
def get_urls(self): """ Returns a list of urls including all NestedSimpleRouter urls """ ret = super(SimpleRouter, self).get_urls() for router in self.nested_routers: ret.extend(router.get_urls()) return ret
python
def get_urls(self): """ Returns a list of urls including all NestedSimpleRouter urls """ ret = super(SimpleRouter, self).get_urls() for router in self.nested_routers: ret.extend(router.get_urls()) return ret
[ "def", "get_urls", "(", "self", ")", ":", "ret", "=", "super", "(", "SimpleRouter", ",", "self", ")", ".", "get_urls", "(", ")", "for", "router", "in", "self", ".", "nested_routers", ":", "ret", ".", "extend", "(", "router", ".", "get_urls", "(", ")"...
Returns a list of urls including all NestedSimpleRouter urls
[ "Returns", "a", "list", "of", "urls", "including", "all", "NestedSimpleRouter", "urls" ]
train
https://github.com/jrjparks/django-rest-framework-nested/blob/8ab797281e11507b8142f342ad73ca48ef82565c/rest_framework_nested/routers.py#L20-L27
radujica/baloo
baloo/weld/weld_utils.py
get_weld_obj_id
def get_weld_obj_id(weld_obj, data): """Helper method to update WeldObject with some data. Parameters ---------- weld_obj : WeldObject WeldObject to update. data : numpy.ndarray or WeldObject or str Data for which to get an id. If str, it is a placeholder or 'str' literal. Retu...
python
def get_weld_obj_id(weld_obj, data): """Helper method to update WeldObject with some data. Parameters ---------- weld_obj : WeldObject WeldObject to update. data : numpy.ndarray or WeldObject or str Data for which to get an id. If str, it is a placeholder or 'str' literal. Retu...
[ "def", "get_weld_obj_id", "(", "weld_obj", ",", "data", ")", ":", "obj_id", "=", "weld_obj", ".", "update", "(", "data", ")", "if", "isinstance", "(", "data", ",", "WeldObject", ")", ":", "obj_id", "=", "data", ".", "obj_id", "weld_obj", ".", "dependenci...
Helper method to update WeldObject with some data. Parameters ---------- weld_obj : WeldObject WeldObject to update. data : numpy.ndarray or WeldObject or str Data for which to get an id. If str, it is a placeholder or 'str' literal. Returns ------- str The id of th...
[ "Helper", "method", "to", "update", "WeldObject", "with", "some", "data", "." ]
train
https://github.com/radujica/baloo/blob/f6e05e35b73a75e8a300754c6bdc575e5f2d53b9/baloo/weld/weld_utils.py#L14-L35
radujica/baloo
baloo/weld/weld_utils.py
create_weld_object
def create_weld_object(data): """Helper method to create a WeldObject and update with data. Parameters ---------- data : numpy.ndarray or WeldObject or str Data to include in newly created object. If str, it is a placeholder or 'str' literal. Returns ------- (str, WeldObject) ...
python
def create_weld_object(data): """Helper method to create a WeldObject and update with data. Parameters ---------- data : numpy.ndarray or WeldObject or str Data to include in newly created object. If str, it is a placeholder or 'str' literal. Returns ------- (str, WeldObject) ...
[ "def", "create_weld_object", "(", "data", ")", ":", "weld_obj", "=", "create_empty_weld_object", "(", ")", "obj_id", "=", "get_weld_obj_id", "(", "weld_obj", ",", "data", ")", "return", "obj_id", ",", "weld_obj" ]
Helper method to create a WeldObject and update with data. Parameters ---------- data : numpy.ndarray or WeldObject or str Data to include in newly created object. If str, it is a placeholder or 'str' literal. Returns ------- (str, WeldObject) Object id for the data to use in t...
[ "Helper", "method", "to", "create", "a", "WeldObject", "and", "update", "with", "data", "." ]
train
https://github.com/radujica/baloo/blob/f6e05e35b73a75e8a300754c6bdc575e5f2d53b9/baloo/weld/weld_utils.py#L38-L56
radujica/baloo
baloo/weld/weld_utils.py
create_placeholder_weld_object
def create_placeholder_weld_object(data): """Helper method that creates a WeldObject that evaluates to itself. Parameters ---------- data : numpy.ndarray or WeldObject or str Data to wrap around. If str, it is a placeholder or 'str' literal. Returns ------- WeldObject WeldO...
python
def create_placeholder_weld_object(data): """Helper method that creates a WeldObject that evaluates to itself. Parameters ---------- data : numpy.ndarray or WeldObject or str Data to wrap around. If str, it is a placeholder or 'str' literal. Returns ------- WeldObject WeldO...
[ "def", "create_placeholder_weld_object", "(", "data", ")", ":", "obj_id", ",", "weld_obj", "=", "create_weld_object", "(", "data", ")", "weld_obj", ".", "weld_code", "=", "'{}'", ".", "format", "(", "str", "(", "obj_id", ")", ")", "return", "weld_obj" ]
Helper method that creates a WeldObject that evaluates to itself. Parameters ---------- data : numpy.ndarray or WeldObject or str Data to wrap around. If str, it is a placeholder or 'str' literal. Returns ------- WeldObject WeldObject wrapped around data.
[ "Helper", "method", "that", "creates", "a", "WeldObject", "that", "evaluates", "to", "itself", "." ]
train
https://github.com/radujica/baloo/blob/f6e05e35b73a75e8a300754c6bdc575e5f2d53b9/baloo/weld/weld_utils.py#L59-L76
radujica/baloo
baloo/weld/weld_utils.py
_extract_placeholder_weld_objects_at_index
def _extract_placeholder_weld_objects_at_index(dependency_name, length, readable_text, index): """Helper method that creates a WeldObject for each component of dependency. Parameters ---------- dependency_name : str The name of the dependency evaluating to a tuple. length : int Numb...
python
def _extract_placeholder_weld_objects_at_index(dependency_name, length, readable_text, index): """Helper method that creates a WeldObject for each component of dependency. Parameters ---------- dependency_name : str The name of the dependency evaluating to a tuple. length : int Numb...
[ "def", "_extract_placeholder_weld_objects_at_index", "(", "dependency_name", ",", "length", ",", "readable_text", ",", "index", ")", ":", "weld_objects", "=", "[", "]", "for", "i", "in", "range", "(", "length", ")", ":", "fake_weld_input", "=", "Cache", ".", "...
Helper method that creates a WeldObject for each component of dependency. Parameters ---------- dependency_name : str The name of the dependency evaluating to a tuple. length : int Number of components to create WeldObjects for readable_text : str Used when creating the plac...
[ "Helper", "method", "that", "creates", "a", "WeldObject", "for", "each", "component", "of", "dependency", "." ]
train
https://github.com/radujica/baloo/blob/f6e05e35b73a75e8a300754c6bdc575e5f2d53b9/baloo/weld/weld_utils.py#L79-L108
radujica/baloo
baloo/weld/weld_utils.py
to_weld_literal
def to_weld_literal(scalar, weld_type): """Return scalar formatted for Weld. Parameters ---------- scalar : {int, float, str, bool} Scalar data to convert to weld literal. weld_type : WeldType Desired Weld type. Returns ------- str String of the scalar to use in...
python
def to_weld_literal(scalar, weld_type): """Return scalar formatted for Weld. Parameters ---------- scalar : {int, float, str, bool} Scalar data to convert to weld literal. weld_type : WeldType Desired Weld type. Returns ------- str String of the scalar to use in...
[ "def", "to_weld_literal", "(", "scalar", ",", "weld_type", ")", ":", "try", ":", "if", "isinstance", "(", "scalar", ",", "int", ")", ":", "if", "isinstance", "(", "weld_type", ",", "WeldInt16", ")", ":", "return", "'{}si'", ".", "format", "(", "str", "...
Return scalar formatted for Weld. Parameters ---------- scalar : {int, float, str, bool} Scalar data to convert to weld literal. weld_type : WeldType Desired Weld type. Returns ------- str String of the scalar to use in Weld code. Examples -------- >>> ...
[ "Return", "scalar", "formatted", "for", "Weld", "." ]
train
https://github.com/radujica/baloo/blob/f6e05e35b73a75e8a300754c6bdc575e5f2d53b9/baloo/weld/weld_utils.py#L124-L179
radujica/baloo
baloo/weld/weld_utils.py
weld_combine_scalars
def weld_combine_scalars(scalars, weld_type): """Combine column-wise aggregations (so resulting scalars) into a single array. Parameters ---------- scalars : tuple of WeldObjects WeldObjects to combine. weld_type : WeldType The Weld type of the result. Currently expecting scalars to...
python
def weld_combine_scalars(scalars, weld_type): """Combine column-wise aggregations (so resulting scalars) into a single array. Parameters ---------- scalars : tuple of WeldObjects WeldObjects to combine. weld_type : WeldType The Weld type of the result. Currently expecting scalars to...
[ "def", "weld_combine_scalars", "(", "scalars", ",", "weld_type", ")", ":", "weld_obj", "=", "create_empty_weld_object", "(", ")", "obj_ids", "=", "(", "get_weld_obj_id", "(", "weld_obj", ",", "scalar", ")", "for", "scalar", "in", "scalars", ")", "merges", "=",...
Combine column-wise aggregations (so resulting scalars) into a single array. Parameters ---------- scalars : tuple of WeldObjects WeldObjects to combine. weld_type : WeldType The Weld type of the result. Currently expecting scalars to be of the same type. Returns ------- We...
[ "Combine", "column", "-", "wise", "aggregations", "(", "so", "resulting", "scalars", ")", "into", "a", "single", "array", "." ]
train
https://github.com/radujica/baloo/blob/f6e05e35b73a75e8a300754c6bdc575e5f2d53b9/baloo/weld/weld_utils.py#L182-L211
radujica/baloo
baloo/weld/weld_utils.py
weld_cast_scalar
def weld_cast_scalar(scalar, to_weld_type): """Returns the scalar casted to the request Weld type. Parameters ---------- scalar : {int, float, WeldObject} Input array. to_weld_type : WeldType Type of each element in the input array. Returns ------- WeldObject Re...
python
def weld_cast_scalar(scalar, to_weld_type): """Returns the scalar casted to the request Weld type. Parameters ---------- scalar : {int, float, WeldObject} Input array. to_weld_type : WeldType Type of each element in the input array. Returns ------- WeldObject Re...
[ "def", "weld_cast_scalar", "(", "scalar", ",", "to_weld_type", ")", ":", "if", "_not_possible_to_cast", "(", "scalar", ",", "to_weld_type", ")", ":", "raise", "TypeError", "(", "'Cannot cast scalar of type={} to type={}'", ".", "format", "(", "type", "(", "scalar", ...
Returns the scalar casted to the request Weld type. Parameters ---------- scalar : {int, float, WeldObject} Input array. to_weld_type : WeldType Type of each element in the input array. Returns ------- WeldObject Representation of this computation.
[ "Returns", "the", "scalar", "casted", "to", "the", "request", "Weld", "type", "." ]
train
https://github.com/radujica/baloo/blob/f6e05e35b73a75e8a300754c6bdc575e5f2d53b9/baloo/weld/weld_utils.py#L240-L268
radujica/baloo
baloo/weld/weld_utils.py
weld_cast_array
def weld_cast_array(array, weld_type, to_weld_type): """Cast array to a different type. Parameters ---------- array : numpy.ndarray or WeldObject Input data. weld_type : WeldType Type of each element in the input array. to_weld_type : WeldType Desired type. Returns ...
python
def weld_cast_array(array, weld_type, to_weld_type): """Cast array to a different type. Parameters ---------- array : numpy.ndarray or WeldObject Input data. weld_type : WeldType Type of each element in the input array. to_weld_type : WeldType Desired type. Returns ...
[ "def", "weld_cast_array", "(", "array", ",", "weld_type", ",", "to_weld_type", ")", ":", "if", "not", "is_numeric", "(", "weld_type", ")", "or", "not", "is_numeric", "(", "to_weld_type", ")", ":", "raise", "TypeError", "(", "'Cannot cast array of type={} to type={...
Cast array to a different type. Parameters ---------- array : numpy.ndarray or WeldObject Input data. weld_type : WeldType Type of each element in the input array. to_weld_type : WeldType Desired type. Returns ------- WeldObject Representation of this co...
[ "Cast", "array", "to", "a", "different", "type", "." ]
train
https://github.com/radujica/baloo/blob/f6e05e35b73a75e8a300754c6bdc575e5f2d53b9/baloo/weld/weld_utils.py#L276-L309
radujica/baloo
baloo/weld/weld_utils.py
weld_arrays_to_vec_of_struct
def weld_arrays_to_vec_of_struct(arrays, weld_types): """Create a vector of structs from multiple vectors. Parameters ---------- arrays : list of (numpy.ndarray or WeldObject) Arrays to put in a struct. weld_types : list of WeldType The Weld types of the arrays in the same order. ...
python
def weld_arrays_to_vec_of_struct(arrays, weld_types): """Create a vector of structs from multiple vectors. Parameters ---------- arrays : list of (numpy.ndarray or WeldObject) Arrays to put in a struct. weld_types : list of WeldType The Weld types of the arrays in the same order. ...
[ "def", "weld_arrays_to_vec_of_struct", "(", "arrays", ",", "weld_types", ")", ":", "weld_obj", "=", "create_empty_weld_object", "(", ")", "obj_ids", "=", "[", "get_weld_obj_id", "(", "weld_obj", ",", "array", ")", "for", "array", "in", "arrays", "]", "arrays", ...
Create a vector of structs from multiple vectors. Parameters ---------- arrays : list of (numpy.ndarray or WeldObject) Arrays to put in a struct. weld_types : list of WeldType The Weld types of the arrays in the same order. Returns ------- WeldObject Representation ...
[ "Create", "a", "vector", "of", "structs", "from", "multiple", "vectors", "." ]
train
https://github.com/radujica/baloo/blob/f6e05e35b73a75e8a300754c6bdc575e5f2d53b9/baloo/weld/weld_utils.py#L313-L350
radujica/baloo
baloo/weld/weld_utils.py
weld_vec_of_struct_to_struct_of_vec
def weld_vec_of_struct_to_struct_of_vec(vec_of_structs, weld_types): """Create a struct of vectors. Parameters ---------- vec_of_structs : WeldObject Encoding a vector of structs. weld_types : list of WeldType The Weld types of the arrays in the same order. Returns ------- ...
python
def weld_vec_of_struct_to_struct_of_vec(vec_of_structs, weld_types): """Create a struct of vectors. Parameters ---------- vec_of_structs : WeldObject Encoding a vector of structs. weld_types : list of WeldType The Weld types of the arrays in the same order. Returns ------- ...
[ "def", "weld_vec_of_struct_to_struct_of_vec", "(", "vec_of_structs", ",", "weld_types", ")", ":", "obj_id", ",", "weld_obj", "=", "create_weld_object", "(", "vec_of_structs", ")", "appenders", "=", "struct_of", "(", "'appender[{e}]'", ",", "weld_types", ")", "types", ...
Create a struct of vectors. Parameters ---------- vec_of_structs : WeldObject Encoding a vector of structs. weld_types : list of WeldType The Weld types of the arrays in the same order. Returns ------- WeldObject Representation of this computation.
[ "Create", "a", "struct", "of", "vectors", "." ]
train
https://github.com/radujica/baloo/blob/f6e05e35b73a75e8a300754c6bdc575e5f2d53b9/baloo/weld/weld_utils.py#L354-L391
radujica/baloo
baloo/weld/weld_utils.py
weld_select_from_struct
def weld_select_from_struct(struct_of_vec, index_to_select): """Select a single vector from the struct of vectors. Parameters ---------- struct_of_vec : WeldObject Encoding a struct of vectors. index_to_select : int Which vec to select from the struct. Returns ------- W...
python
def weld_select_from_struct(struct_of_vec, index_to_select): """Select a single vector from the struct of vectors. Parameters ---------- struct_of_vec : WeldObject Encoding a struct of vectors. index_to_select : int Which vec to select from the struct. Returns ------- W...
[ "def", "weld_select_from_struct", "(", "struct_of_vec", ",", "index_to_select", ")", ":", "obj_id", ",", "weld_obj", "=", "create_weld_object", "(", "struct_of_vec", ")", "weld_template", "=", "'{struct}.${index}'", "weld_obj", ".", "weld_code", "=", "weld_template", ...
Select a single vector from the struct of vectors. Parameters ---------- struct_of_vec : WeldObject Encoding a struct of vectors. index_to_select : int Which vec to select from the struct. Returns ------- WeldObject Representation of this computation.
[ "Select", "a", "single", "vector", "from", "the", "struct", "of", "vectors", "." ]
train
https://github.com/radujica/baloo/blob/f6e05e35b73a75e8a300754c6bdc575e5f2d53b9/baloo/weld/weld_utils.py#L394-L417
radujica/baloo
baloo/weld/weld_utils.py
weld_data_to_dict
def weld_data_to_dict(keys, keys_weld_types, values, values_weld_types): """Adds the key-value pairs in a dictionary. Overlapping keys are max-ed. Note this cannot be evaluated! Parameters ---------- keys : list of (numpy.ndarray or WeldObject) keys_weld_types : list of WeldType values : n...
python
def weld_data_to_dict(keys, keys_weld_types, values, values_weld_types): """Adds the key-value pairs in a dictionary. Overlapping keys are max-ed. Note this cannot be evaluated! Parameters ---------- keys : list of (numpy.ndarray or WeldObject) keys_weld_types : list of WeldType values : n...
[ "def", "weld_data_to_dict", "(", "keys", ",", "keys_weld_types", ",", "values", ",", "values_weld_types", ")", ":", "weld_obj_keys", "=", "weld_arrays_to_vec_of_struct", "(", "keys", ",", "keys_weld_types", ")", "weld_obj", "=", "create_empty_weld_object", "(", ")", ...
Adds the key-value pairs in a dictionary. Overlapping keys are max-ed. Note this cannot be evaluated! Parameters ---------- keys : list of (numpy.ndarray or WeldObject) keys_weld_types : list of WeldType values : numpy.ndarray or WeldObject values_weld_types : WeldType Returns ---...
[ "Adds", "the", "key", "-", "value", "pairs", "in", "a", "dictionary", ".", "Overlapping", "keys", "are", "max", "-", "ed", "." ]
train
https://github.com/radujica/baloo/blob/f6e05e35b73a75e8a300754c6bdc575e5f2d53b9/baloo/weld/weld_utils.py#L421-L462
simoninireland/epyc
epyc/experiment.py
Experiment.set
def set( self, params ): """Set the parameters for the experiment, returning the now-configured experiment. Be sure to call this base method when overriding. :param params: the parameters :returns: The experiment""" if self._parameters is not None: self.deconfigure(...
python
def set( self, params ): """Set the parameters for the experiment, returning the now-configured experiment. Be sure to call this base method when overriding. :param params: the parameters :returns: The experiment""" if self._parameters is not None: self.deconfigure(...
[ "def", "set", "(", "self", ",", "params", ")", ":", "if", "self", ".", "_parameters", "is", "not", "None", ":", "self", ".", "deconfigure", "(", ")", "self", ".", "configure", "(", "params", ")", "return", "self" ]
Set the parameters for the experiment, returning the now-configured experiment. Be sure to call this base method when overriding. :param params: the parameters :returns: The experiment
[ "Set", "the", "parameters", "for", "the", "experiment", "returning", "the", "now", "-", "configured", "experiment", ".", "Be", "sure", "to", "call", "this", "base", "method", "when", "overriding", "." ]
train
https://github.com/simoninireland/epyc/blob/b3b61007741a0ab3de64df89070a6f30de8ec268/epyc/experiment.py#L101-L110
simoninireland/epyc
epyc/experiment.py
Experiment.report
def report( self, params, meta, res ): """Return a properly-structured dict of results. The default returns a dict with results keyed by :attr:`Experiment.RESULTS`, the data point in the parameter space keyed by :attr:`Experiment.PARAMETERS`, and timing and other metadata keyed by :attr:...
python
def report( self, params, meta, res ): """Return a properly-structured dict of results. The default returns a dict with results keyed by :attr:`Experiment.RESULTS`, the data point in the parameter space keyed by :attr:`Experiment.PARAMETERS`, and timing and other metadata keyed by :attr:...
[ "def", "report", "(", "self", ",", "params", ",", "meta", ",", "res", ")", ":", "rc", "=", "dict", "(", ")", "rc", "[", "self", ".", "PARAMETERS", "]", "=", "params", ".", "copy", "(", ")", "rc", "[", "self", ".", "METADATA", "]", "=", "meta", ...
Return a properly-structured dict of results. The default returns a dict with results keyed by :attr:`Experiment.RESULTS`, the data point in the parameter space keyed by :attr:`Experiment.PARAMETERS`, and timing and other metadata keyed by :attr:`Experiment.METADATA`. Overriding this method can ...
[ "Return", "a", "properly", "-", "structured", "dict", "of", "results", ".", "The", "default", "returns", "a", "dict", "with", "results", "keyed", "by", ":", "attr", ":", "Experiment", ".", "RESULTS", "the", "data", "point", "in", "the", "parameter", "space...
train
https://github.com/simoninireland/epyc/blob/b3b61007741a0ab3de64df89070a6f30de8ec268/epyc/experiment.py#L120-L135
simoninireland/epyc
epyc/experiment.py
Experiment.run
def run( self ): """Run the experiment, using the parameters set using :meth:`set`. A "run" consists of calling :meth:`setUp`, :meth:`do`, and :meth:`tearDown`, followed by collecting and storing (and returning) the experiment's results. If running the experiment raises an except...
python
def run( self ): """Run the experiment, using the parameters set using :meth:`set`. A "run" consists of calling :meth:`setUp`, :meth:`do`, and :meth:`tearDown`, followed by collecting and storing (and returning) the experiment's results. If running the experiment raises an except...
[ "def", "run", "(", "self", ")", ":", "# perform the experiment protocol", "params", "=", "self", ".", "parameters", "(", ")", "self", ".", "_metadata", "=", "dict", "(", ")", "self", ".", "_results", "=", "None", "res", "=", "None", "doneSetupTime", "=", ...
Run the experiment, using the parameters set using :meth:`set`. A "run" consists of calling :meth:`setUp`, :meth:`do`, and :meth:`tearDown`, followed by collecting and storing (and returning) the experiment's results. If running the experiment raises an exception, that will be returned i...
[ "Run", "the", "experiment", "using", "the", "parameters", "set", "using", ":", "meth", ":", "set", ".", "A", "run", "consists", "of", "calling", ":", "meth", ":", "setUp", ":", "meth", ":", "do", "and", ":", "meth", ":", "tearDown", "followed", "by", ...
train
https://github.com/simoninireland/epyc/blob/b3b61007741a0ab3de64df89070a6f30de8ec268/epyc/experiment.py#L137-L199
simoninireland/epyc
epyc/experiment.py
Experiment.success
def success( self ): """Test whether the experiment has been run successfully. This will be False if the experiment hasn't been run, or if it's been run and failed (in which case the exception will be stored in the metadata). :returns: ``True`` if the experiment has been run successfull...
python
def success( self ): """Test whether the experiment has been run successfully. This will be False if the experiment hasn't been run, or if it's been run and failed (in which case the exception will be stored in the metadata). :returns: ``True`` if the experiment has been run successfull...
[ "def", "success", "(", "self", ")", ":", "if", "self", ".", "STATUS", "in", "self", ".", "metadata", "(", ")", ".", "keys", "(", ")", ":", "return", "(", "self", ".", "metadata", "(", ")", ")", "[", "self", ".", "STATUS", "]", "else", ":", "ret...
Test whether the experiment has been run successfully. This will be False if the experiment hasn't been run, or if it's been run and failed (in which case the exception will be stored in the metadata). :returns: ``True`` if the experiment has been run successfully
[ "Test", "whether", "the", "experiment", "has", "been", "run", "successfully", ".", "This", "will", "be", "False", "if", "the", "experiment", "hasn", "t", "been", "run", "or", "if", "it", "s", "been", "run", "and", "failed", "(", "in", "which", "case", ...
train
https://github.com/simoninireland/epyc/blob/b3b61007741a0ab3de64df89070a6f30de8ec268/epyc/experiment.py#L214-L223
simoninireland/epyc
epyc/experiment.py
Experiment.results
def results( self ): """Return a complete results dict. Only really makes sense for recently-executed experimental runs. :returns: the results dict""" return self.report(self.parameters(), self.metadata(), self.experimentalResults())
python
def results( self ): """Return a complete results dict. Only really makes sense for recently-executed experimental runs. :returns: the results dict""" return self.report(self.parameters(), self.metadata(), self.experimentalResults())
[ "def", "results", "(", "self", ")", ":", "return", "self", ".", "report", "(", "self", ".", "parameters", "(", ")", ",", "self", ".", "metadata", "(", ")", ",", "self", ".", "experimentalResults", "(", ")", ")" ]
Return a complete results dict. Only really makes sense for recently-executed experimental runs. :returns: the results dict
[ "Return", "a", "complete", "results", "dict", ".", "Only", "really", "makes", "sense", "for", "recently", "-", "executed", "experimental", "runs", "." ]
train
https://github.com/simoninireland/epyc/blob/b3b61007741a0ab3de64df89070a6f30de8ec268/epyc/experiment.py#L225-L232
OpenGeoVis/espatools
espatools/read.py
SetProperties
def SetProperties(has_props_cls, input_dict, include_immutable=True): """A helper method to set an ``HasProperties`` object's properties from a dictionary""" props = has_props_cls() if not isinstance(input_dict, (dict, collections.OrderedDict)): raise RuntimeError('input_dict invalid: ', input_dict)...
python
def SetProperties(has_props_cls, input_dict, include_immutable=True): """A helper method to set an ``HasProperties`` object's properties from a dictionary""" props = has_props_cls() if not isinstance(input_dict, (dict, collections.OrderedDict)): raise RuntimeError('input_dict invalid: ', input_dict)...
[ "def", "SetProperties", "(", "has_props_cls", ",", "input_dict", ",", "include_immutable", "=", "True", ")", ":", "props", "=", "has_props_cls", "(", ")", "if", "not", "isinstance", "(", "input_dict", ",", "(", "dict", ",", "collections", ".", "OrderedDict", ...
A helper method to set an ``HasProperties`` object's properties from a dictionary
[ "A", "helper", "method", "to", "set", "an", "HasProperties", "object", "s", "properties", "from", "a", "dictionary" ]
train
https://github.com/OpenGeoVis/espatools/blob/5c04daae0f035c7efcb4096bb85a26c6959ac9ea/espatools/read.py#L18-L52
OpenGeoVis/espatools
espatools/read.py
RasterSetReader.ReadTif
def ReadTif(tifFile): """Reads a tif file to a 2D NumPy array""" img = Image.open(tifFile) img = np.array(img) return img
python
def ReadTif(tifFile): """Reads a tif file to a 2D NumPy array""" img = Image.open(tifFile) img = np.array(img) return img
[ "def", "ReadTif", "(", "tifFile", ")", ":", "img", "=", "Image", ".", "open", "(", "tifFile", ")", "img", "=", "np", ".", "array", "(", "img", ")", "return", "img" ]
Reads a tif file to a 2D NumPy array
[ "Reads", "a", "tif", "file", "to", "a", "2D", "NumPy", "array" ]
train
https://github.com/OpenGeoVis/espatools/blob/5c04daae0f035c7efcb4096bb85a26c6959ac9ea/espatools/read.py#L63-L67
OpenGeoVis/espatools
espatools/read.py
RasterSetReader.GenerateBand
def GenerateBand(self, band, meta_only=False, cast=False): """Genreate a Band object given band metadata Args: band (dict): dictionary containing metadata for a given band Return: Band : the loaded Band onject""" # Read the band data and add it to dictionary ...
python
def GenerateBand(self, band, meta_only=False, cast=False): """Genreate a Band object given band metadata Args: band (dict): dictionary containing metadata for a given band Return: Band : the loaded Band onject""" # Read the band data and add it to dictionary ...
[ "def", "GenerateBand", "(", "self", ",", "band", ",", "meta_only", "=", "False", ",", "cast", "=", "False", ")", ":", "# Read the band data and add it to dictionary", "if", "not", "meta_only", ":", "fname", "=", "band", ".", "get", "(", "'file_name'", ")", "...
Genreate a Band object given band metadata Args: band (dict): dictionary containing metadata for a given band Return: Band : the loaded Band onject
[ "Genreate", "a", "Band", "object", "given", "band", "metadata" ]
train
https://github.com/OpenGeoVis/espatools/blob/5c04daae0f035c7efcb4096bb85a26c6959ac9ea/espatools/read.py#L82-L134
OpenGeoVis/espatools
espatools/read.py
RasterSetReader.Read
def Read(self, meta_only=False, allowed=None, cast=False): """Read the ESPA XML metadata file""" if allowed is not None and not isinstance(allowed, (list, tuple)): raise RuntimeError('`allowed` must be a list of str names.') meta = xmltodict.parse( open(self.filename...
python
def Read(self, meta_only=False, allowed=None, cast=False): """Read the ESPA XML metadata file""" if allowed is not None and not isinstance(allowed, (list, tuple)): raise RuntimeError('`allowed` must be a list of str names.') meta = xmltodict.parse( open(self.filename...
[ "def", "Read", "(", "self", ",", "meta_only", "=", "False", ",", "allowed", "=", "None", ",", "cast", "=", "False", ")", ":", "if", "allowed", "is", "not", "None", "and", "not", "isinstance", "(", "allowed", ",", "(", "list", ",", "tuple", ")", ")"...
Read the ESPA XML metadata file
[ "Read", "the", "ESPA", "XML", "metadata", "file" ]
train
https://github.com/OpenGeoVis/espatools/blob/5c04daae0f035c7efcb4096bb85a26c6959ac9ea/espatools/read.py#L137-L181
iDigBio/idigbio-python-client
idigbio/json_client.py
iDbApiJson.search_records
def search_records(self, rq={}, limit=100, offset=0, sort=None, fields=None, fields_exclude=FIELDS_EXCLUDE_DEFAULT): """ rq Search Query in iDigBio Query Format, using Record Query Fields sort field to sort on, pick from Record Query Fields fields ...
python
def search_records(self, rq={}, limit=100, offset=0, sort=None, fields=None, fields_exclude=FIELDS_EXCLUDE_DEFAULT): """ rq Search Query in iDigBio Query Format, using Record Query Fields sort field to sort on, pick from Record Query Fields fields ...
[ "def", "search_records", "(", "self", ",", "rq", "=", "{", "}", ",", "limit", "=", "100", ",", "offset", "=", "0", ",", "sort", "=", "None", ",", "fields", "=", "None", ",", "fields_exclude", "=", "FIELDS_EXCLUDE_DEFAULT", ")", ":", "if", "fields", "...
rq Search Query in iDigBio Query Format, using Record Query Fields sort field to sort on, pick from Record Query Fields fields a list of fields to return, specified using the fieldName parameter from Fields with type records fields_exclude a list of fields to exclude, specified...
[ "rq", "Search", "Query", "in", "iDigBio", "Query", "Format", "using", "Record", "Query", "Fields", "sort", "field", "to", "sort", "on", "pick", "from", "Record", "Query", "Fields", "fields", "a", "list", "of", "fields", "to", "return", "specified", "using", ...
train
https://github.com/iDigBio/idigbio-python-client/blob/e896075b9fed297fc420caf303b3bb5a2298d969/idigbio/json_client.py#L315-L332
iDigBio/idigbio-python-client
idigbio/json_client.py
iDbApiJson.search_media
def search_media(self, mq={}, rq={}, limit=100, offset=0, sort=None, fields=None, fields_exclude=FIELDS_EXCLUDE_DEFAULT): """ mq Search Query in iDigBio Query Format, using Media Query Fields rq Search Query in iDigBio Query Format, using Record Query Fields ...
python
def search_media(self, mq={}, rq={}, limit=100, offset=0, sort=None, fields=None, fields_exclude=FIELDS_EXCLUDE_DEFAULT): """ mq Search Query in iDigBio Query Format, using Media Query Fields rq Search Query in iDigBio Query Format, using Record Query Fields ...
[ "def", "search_media", "(", "self", ",", "mq", "=", "{", "}", ",", "rq", "=", "{", "}", ",", "limit", "=", "100", ",", "offset", "=", "0", ",", "sort", "=", "None", ",", "fields", "=", "None", ",", "fields_exclude", "=", "FIELDS_EXCLUDE_DEFAULT", "...
mq Search Query in iDigBio Query Format, using Media Query Fields rq Search Query in iDigBio Query Format, using Record Query Fields sort field to sort on, pick from Media Query Fields fields a list of fields to return, specified using the fieldName parameter from Fields with t...
[ "mq", "Search", "Query", "in", "iDigBio", "Query", "Format", "using", "Media", "Query", "Fields", "rq", "Search", "Query", "in", "iDigBio", "Query", "Format", "using", "Record", "Query", "Fields", "sort", "field", "to", "sort", "on", "pick", "from", "Media",...
train
https://github.com/iDigBio/idigbio-python-client/blob/e896075b9fed297fc420caf303b3bb5a2298d969/idigbio/json_client.py#L334-L352
titusz/epubcheck
src/epubcheck/utils.py
java_version
def java_version(): """Call java and return version information. :return unicode: Java version string """ result = subprocess.check_output( [c.JAVA, '-version'], stderr=subprocess.STDOUT ) first_line = result.splitlines()[0] return first_line.decode()
python
def java_version(): """Call java and return version information. :return unicode: Java version string """ result = subprocess.check_output( [c.JAVA, '-version'], stderr=subprocess.STDOUT ) first_line = result.splitlines()[0] return first_line.decode()
[ "def", "java_version", "(", ")", ":", "result", "=", "subprocess", ".", "check_output", "(", "[", "c", ".", "JAVA", ",", "'-version'", "]", ",", "stderr", "=", "subprocess", ".", "STDOUT", ")", "first_line", "=", "result", ".", "splitlines", "(", ")", ...
Call java and return version information. :return unicode: Java version string
[ "Call", "java", "and", "return", "version", "information", "." ]
train
https://github.com/titusz/epubcheck/blob/7adde81543d3ae7385ab7062adb76e1414d49c2e/src/epubcheck/utils.py#L13-L22
titusz/epubcheck
src/epubcheck/utils.py
epubcheck_help
def epubcheck_help(): """Return epubcheck.jar commandline help text. :return unicode: helptext from epubcheck.jar """ # tc = locale.getdefaultlocale()[1] with open(os.devnull, "w") as devnull: p = subprocess.Popen( [c.JAVA, '-Duser.language=en', '-jar', c.EPUBCHECK, '-h'], ...
python
def epubcheck_help(): """Return epubcheck.jar commandline help text. :return unicode: helptext from epubcheck.jar """ # tc = locale.getdefaultlocale()[1] with open(os.devnull, "w") as devnull: p = subprocess.Popen( [c.JAVA, '-Duser.language=en', '-jar', c.EPUBCHECK, '-h'], ...
[ "def", "epubcheck_help", "(", ")", ":", "# tc = locale.getdefaultlocale()[1]", "with", "open", "(", "os", ".", "devnull", ",", "\"w\"", ")", "as", "devnull", ":", "p", "=", "subprocess", ".", "Popen", "(", "[", "c", ".", "JAVA", ",", "'-Duser.language=en'", ...
Return epubcheck.jar commandline help text. :return unicode: helptext from epubcheck.jar
[ "Return", "epubcheck", ".", "jar", "commandline", "help", "text", "." ]
train
https://github.com/titusz/epubcheck/blob/7adde81543d3ae7385ab7062adb76e1414d49c2e/src/epubcheck/utils.py#L25-L41
titusz/epubcheck
src/epubcheck/utils.py
generate_sample_json
def generate_sample_json(): """Generate sample json data for testing""" check = EpubCheck(samples.EPUB3_VALID) with open(samples.RESULT_VALID, 'wb') as jsonfile: jsonfile.write(check._stdout) check = EpubCheck(samples.EPUB3_INVALID) with open(samples.RESULT_INVALID, 'wb') as jsonfile: ...
python
def generate_sample_json(): """Generate sample json data for testing""" check = EpubCheck(samples.EPUB3_VALID) with open(samples.RESULT_VALID, 'wb') as jsonfile: jsonfile.write(check._stdout) check = EpubCheck(samples.EPUB3_INVALID) with open(samples.RESULT_INVALID, 'wb') as jsonfile: ...
[ "def", "generate_sample_json", "(", ")", ":", "check", "=", "EpubCheck", "(", "samples", ".", "EPUB3_VALID", ")", "with", "open", "(", "samples", ".", "RESULT_VALID", ",", "'wb'", ")", "as", "jsonfile", ":", "jsonfile", ".", "write", "(", "check", ".", "...
Generate sample json data for testing
[ "Generate", "sample", "json", "data", "for", "testing" ]
train
https://github.com/titusz/epubcheck/blob/7adde81543d3ae7385ab7062adb76e1414d49c2e/src/epubcheck/utils.py#L52-L61
titusz/epubcheck
src/epubcheck/utils.py
iter_files
def iter_files(root, exts=None, recursive=False): """ Iterate over file paths within root filtered by specified extensions. :param compat.string_types root: Root folder to start collecting files :param iterable exts: Restrict results to given file extensions :param bool recursive: Wether to walk the...
python
def iter_files(root, exts=None, recursive=False): """ Iterate over file paths within root filtered by specified extensions. :param compat.string_types root: Root folder to start collecting files :param iterable exts: Restrict results to given file extensions :param bool recursive: Wether to walk the...
[ "def", "iter_files", "(", "root", ",", "exts", "=", "None", ",", "recursive", "=", "False", ")", ":", "if", "exts", "is", "not", "None", ":", "exts", "=", "set", "(", "(", "x", ".", "lower", "(", ")", "for", "x", "in", "exts", ")", ")", "def", ...
Iterate over file paths within root filtered by specified extensions. :param compat.string_types root: Root folder to start collecting files :param iterable exts: Restrict results to given file extensions :param bool recursive: Wether to walk the complete directory tree :rtype collections.Iterable[str]:...
[ "Iterate", "over", "file", "paths", "within", "root", "filtered", "by", "specified", "extensions", ".", ":", "param", "compat", ".", "string_types", "root", ":", "Root", "folder", "to", "start", "collecting", "files", ":", "param", "iterable", "exts", ":", "...
train
https://github.com/titusz/epubcheck/blob/7adde81543d3ae7385ab7062adb76e1414d49c2e/src/epubcheck/utils.py#L64-L94
ryanpetrello/cleaver
cleaver/backend/__init__.py
CleaverBackend.participate
def participate(self, identity, experiment_name, variant): """ Set the variant for a specific user and mark a participation for the experiment. Participation will *only* be marked for visitors who have been verified as humans (to avoid skewing reports with requests from bots and...
python
def participate(self, identity, experiment_name, variant): """ Set the variant for a specific user and mark a participation for the experiment. Participation will *only* be marked for visitors who have been verified as humans (to avoid skewing reports with requests from bots and...
[ "def", "participate", "(", "self", ",", "identity", ",", "experiment_name", ",", "variant", ")", ":", "self", ".", "set_variant", "(", "identity", ",", "experiment_name", ",", "variant", ")", "if", "self", ".", "is_verified_human", "(", "identity", ")", ":",...
Set the variant for a specific user and mark a participation for the experiment. Participation will *only* be marked for visitors who have been verified as humans (to avoid skewing reports with requests from bots and web crawlers).
[ "Set", "the", "variant", "for", "a", "specific", "user", "and", "mark", "a", "participation", "for", "the", "experiment", "." ]
train
https://github.com/ryanpetrello/cleaver/blob/0ef266e1a0603c6d414df4b9926ce2a59844db35/cleaver/backend/__init__.py#L104-L115
radujica/baloo
baloo/weld/convertors/utils.py
to_weld_vec
def to_weld_vec(weld_type, ndim): """Convert multi-dimensional data to WeldVec types. Parameters ---------- weld_type : WeldType WeldType of data. ndim : int Number of dimensions. Returns ------- WeldVec WeldVec of 1 or more dimensions. """ for i in ran...
python
def to_weld_vec(weld_type, ndim): """Convert multi-dimensional data to WeldVec types. Parameters ---------- weld_type : WeldType WeldType of data. ndim : int Number of dimensions. Returns ------- WeldVec WeldVec of 1 or more dimensions. """ for i in ran...
[ "def", "to_weld_vec", "(", "weld_type", ",", "ndim", ")", ":", "for", "i", "in", "range", "(", "ndim", ")", ":", "weld_type", "=", "WeldVec", "(", "weld_type", ")", "return", "weld_type" ]
Convert multi-dimensional data to WeldVec types. Parameters ---------- weld_type : WeldType WeldType of data. ndim : int Number of dimensions. Returns ------- WeldVec WeldVec of 1 or more dimensions.
[ "Convert", "multi", "-", "dimensional", "data", "to", "WeldVec", "types", "." ]
train
https://github.com/radujica/baloo/blob/f6e05e35b73a75e8a300754c6bdc575e5f2d53b9/baloo/weld/convertors/utils.py#L6-L24
radujica/baloo
baloo/weld/convertors/utils.py
to_shared_lib
def to_shared_lib(name): """Return library name depending on platform. Parameters ---------- name : str Name of library. Returns ------- str Name of library with extension. """ if sys.platform.startswith('linux'): return name + '.so' elif sys.platform.s...
python
def to_shared_lib(name): """Return library name depending on platform. Parameters ---------- name : str Name of library. Returns ------- str Name of library with extension. """ if sys.platform.startswith('linux'): return name + '.so' elif sys.platform.s...
[ "def", "to_shared_lib", "(", "name", ")", ":", "if", "sys", ".", "platform", ".", "startswith", "(", "'linux'", ")", ":", "return", "name", "+", "'.so'", "elif", "sys", ".", "platform", ".", "startswith", "(", "'darwin'", ")", ":", "return", "name", "+...
Return library name depending on platform. Parameters ---------- name : str Name of library. Returns ------- str Name of library with extension.
[ "Return", "library", "name", "depending", "on", "platform", "." ]
train
https://github.com/radujica/baloo/blob/f6e05e35b73a75e8a300754c6bdc575e5f2d53b9/baloo/weld/convertors/utils.py#L27-L48
spoqa/tsukkomi
tsukkomi/typed.py
check_type
def check_type(value: typing.Any, hint: typing.Optional[type]) -> bool: """Check given ``value``'s type. :param value: given argument :param hint: expected type of given ``value``. as like :mod:`typing` interprets, :const:`None` is interpreted as :class:`types.NoneType` ...
python
def check_type(value: typing.Any, hint: typing.Optional[type]) -> bool: """Check given ``value``'s type. :param value: given argument :param hint: expected type of given ``value``. as like :mod:`typing` interprets, :const:`None` is interpreted as :class:`types.NoneType` ...
[ "def", "check_type", "(", "value", ":", "typing", ".", "Any", ",", "hint", ":", "typing", ".", "Optional", "[", "type", "]", ")", "->", "bool", ":", "if", "hint", "is", "None", ":", "hint", "=", "NoneType", "actual_type", "=", "type", "(", "value", ...
Check given ``value``'s type. :param value: given argument :param hint: expected type of given ``value``. as like :mod:`typing` interprets, :const:`None` is interpreted as :class:`types.NoneType` :type hint: :class:`typing.Optional`[:class:`type`]
[ "Check", "given", "value", "s", "type", "." ]
train
https://github.com/spoqa/tsukkomi/blob/c67bd28a5211cdd11f8ac81f109c915f3b780445/tsukkomi/typed.py#L20-L50
spoqa/tsukkomi
tsukkomi/typed.py
check_return
def check_return(callable_name: str, r: typing.Any, hints: typing.Mapping[str, type]) -> None: """Check return type, raise :class:`TypeError` if return type is not expected type. :param str callable_name: callable name of :func:`~.typechecked` checked :param r: returned result :par...
python
def check_return(callable_name: str, r: typing.Any, hints: typing.Mapping[str, type]) -> None: """Check return type, raise :class:`TypeError` if return type is not expected type. :param str callable_name: callable name of :func:`~.typechecked` checked :param r: returned result :par...
[ "def", "check_return", "(", "callable_name", ":", "str", ",", "r", ":", "typing", ".", "Any", ",", "hints", ":", "typing", ".", "Mapping", "[", "str", ",", "type", "]", ")", "->", "None", ":", "correct", "=", "True", "if", "'return'", "not", "in", ...
Check return type, raise :class:`TypeError` if return type is not expected type. :param str callable_name: callable name of :func:`~.typechecked` checked :param r: returned result :param hints: assumed type of given ``r``
[ "Check", "return", "type", "raise", ":", "class", ":", "TypeError", "if", "return", "type", "is", "not", "expected", "type", "." ]
train
https://github.com/spoqa/tsukkomi/blob/c67bd28a5211cdd11f8ac81f109c915f3b780445/tsukkomi/typed.py#L53-L72
spoqa/tsukkomi
tsukkomi/typed.py
check_callable
def check_callable(callable_: typing.Callable, hint: type) -> bool: """Check argument type & return type of :class:`typing.Callable`. since it raises check :class:`typing.Callable` using `isinstance`, so compare in diffrent way :param callable_: callable object given as a argument :param hint: assu...
python
def check_callable(callable_: typing.Callable, hint: type) -> bool: """Check argument type & return type of :class:`typing.Callable`. since it raises check :class:`typing.Callable` using `isinstance`, so compare in diffrent way :param callable_: callable object given as a argument :param hint: assu...
[ "def", "check_callable", "(", "callable_", ":", "typing", ".", "Callable", ",", "hint", ":", "type", ")", "->", "bool", ":", "if", "not", "callable", "(", "callable_", ")", ":", "return", "type", "(", "callable_", ")", ",", "False", "if", "callable", "...
Check argument type & return type of :class:`typing.Callable`. since it raises check :class:`typing.Callable` using `isinstance`, so compare in diffrent way :param callable_: callable object given as a argument :param hint: assumed type of given ``callable_``
[ "Check", "argument", "type", "&", "return", "type", "of", ":", "class", ":", "typing", ".", "Callable", ".", "since", "it", "raises", "check", ":", "class", ":", "typing", ".", "Callable", "using", "isinstance", "so", "compare", "in", "diffrent", "way" ]
train
https://github.com/spoqa/tsukkomi/blob/c67bd28a5211cdd11f8ac81f109c915f3b780445/tsukkomi/typed.py#L75-L106
spoqa/tsukkomi
tsukkomi/typed.py
check_tuple
def check_tuple(data: typing.Tuple, hint: typing.Union[type, typing.TypingMeta]) -> bool: """Check argument type & return type of :class:`typing.Tuple`. since it raises check :class:`typing.Tuple` using `isinstance`, so compare in diffrent way :param data: tuple given as a argument ...
python
def check_tuple(data: typing.Tuple, hint: typing.Union[type, typing.TypingMeta]) -> bool: """Check argument type & return type of :class:`typing.Tuple`. since it raises check :class:`typing.Tuple` using `isinstance`, so compare in diffrent way :param data: tuple given as a argument ...
[ "def", "check_tuple", "(", "data", ":", "typing", ".", "Tuple", ",", "hint", ":", "typing", ".", "Union", "[", "type", ",", "typing", ".", "TypingMeta", "]", ")", "->", "bool", ":", "if", "not", "isinstance", "(", "data", ",", "tuple", ")", ":", "r...
Check argument type & return type of :class:`typing.Tuple`. since it raises check :class:`typing.Tuple` using `isinstance`, so compare in diffrent way :param data: tuple given as a argument :param hint: assumed type of given ``data``
[ "Check", "argument", "type", "&", "return", "type", "of", ":", "class", ":", "typing", ".", "Tuple", ".", "since", "it", "raises", "check", ":", "class", ":", "typing", ".", "Tuple", "using", "isinstance", "so", "compare", "in", "diffrent", "way" ]
train
https://github.com/spoqa/tsukkomi/blob/c67bd28a5211cdd11f8ac81f109c915f3b780445/tsukkomi/typed.py#L109-L142
spoqa/tsukkomi
tsukkomi/typed.py
check_union
def check_union(data: typing.Union, hint: type) -> bool: """Check argument type & return type of :class:`typing.Union`. since it raises check :class:`typing.Union` using `isinstance`, so compare in diffrent way :param data: union given as a argument :param hint: assumed type of given ``data`` ...
python
def check_union(data: typing.Union, hint: type) -> bool: """Check argument type & return type of :class:`typing.Union`. since it raises check :class:`typing.Union` using `isinstance`, so compare in diffrent way :param data: union given as a argument :param hint: assumed type of given ``data`` ...
[ "def", "check_union", "(", "data", ":", "typing", ".", "Union", ",", "hint", ":", "type", ")", "->", "bool", ":", "r", "=", "any", "(", "check_type", "(", "data", ",", "t", ")", "[", "1", "]", "for", "t", "in", "hint", ".", "__union_params__", ")...
Check argument type & return type of :class:`typing.Union`. since it raises check :class:`typing.Union` using `isinstance`, so compare in diffrent way :param data: union given as a argument :param hint: assumed type of given ``data``
[ "Check", "argument", "type", "&", "return", "type", "of", ":", "class", ":", "typing", ".", "Union", ".", "since", "it", "raises", "check", ":", "class", ":", "typing", ".", "Union", "using", "isinstance", "so", "compare", "in", "diffrent", "way" ]
train
https://github.com/spoqa/tsukkomi/blob/c67bd28a5211cdd11f8ac81f109c915f3b780445/tsukkomi/typed.py#L145-L161
spoqa/tsukkomi
tsukkomi/typed.py
check_arguments
def check_arguments(c: typing.Callable, hints: typing.Mapping[str, typing.Optional[type]], *args, **kwargs) -> None: """Check arguments type, raise :class:`TypeError` if argument type is not expected type. :param c: callable object want to check types :param hint...
python
def check_arguments(c: typing.Callable, hints: typing.Mapping[str, typing.Optional[type]], *args, **kwargs) -> None: """Check arguments type, raise :class:`TypeError` if argument type is not expected type. :param c: callable object want to check types :param hint...
[ "def", "check_arguments", "(", "c", ":", "typing", ".", "Callable", ",", "hints", ":", "typing", ".", "Mapping", "[", "str", ",", "typing", ".", "Optional", "[", "type", "]", "]", ",", "*", "args", ",", "*", "*", "kwargs", ")", "->", "None", ":", ...
Check arguments type, raise :class:`TypeError` if argument type is not expected type. :param c: callable object want to check types :param hints: assumed type of given ``c`` result of :func:`typing.get_type_hints`
[ "Check", "arguments", "type", "raise", ":", "class", ":", "TypeError", "if", "argument", "type", "is", "not", "expected", "type", "." ]
train
https://github.com/spoqa/tsukkomi/blob/c67bd28a5211cdd11f8ac81f109c915f3b780445/tsukkomi/typed.py#L164-L188
spoqa/tsukkomi
tsukkomi/typed.py
typechecked
def typechecked(call_: typing.Callable[..., T]) -> T: """A decorator to make a callable object checks its types .. code-block:: python from typing import Callable @typechecked def foobar(x: str) -> bool: return x == 'hello world' @typechecked def hello_world(fo...
python
def typechecked(call_: typing.Callable[..., T]) -> T: """A decorator to make a callable object checks its types .. code-block:: python from typing import Callable @typechecked def foobar(x: str) -> bool: return x == 'hello world' @typechecked def hello_world(fo...
[ "def", "typechecked", "(", "call_", ":", "typing", ".", "Callable", "[", "...", ",", "T", "]", ")", "->", "T", ":", "@", "functools", ".", "wraps", "(", "call_", ")", "def", "decorator", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "hints...
A decorator to make a callable object checks its types .. code-block:: python from typing import Callable @typechecked def foobar(x: str) -> bool: return x == 'hello world' @typechecked def hello_world(foo: str, bar: Callable[[str], bool]) -> bool: retur...
[ "A", "decorator", "to", "make", "a", "callable", "object", "checks", "its", "types" ]
train
https://github.com/spoqa/tsukkomi/blob/c67bd28a5211cdd11f8ac81f109c915f3b780445/tsukkomi/typed.py#L191-L225
winkidney/cmdtree
src/cmdtree/tree.py
CmdTree.get_cmd_by_path
def get_cmd_by_path(self, existed_cmd_path): """ :return: { "name": cmd_name, "cmd": Resource instance, "children": {} } """ parent = self.tree for cmd_name in existed_cmd_path: try: parent = parent['...
python
def get_cmd_by_path(self, existed_cmd_path): """ :return: { "name": cmd_name, "cmd": Resource instance, "children": {} } """ parent = self.tree for cmd_name in existed_cmd_path: try: parent = parent['...
[ "def", "get_cmd_by_path", "(", "self", ",", "existed_cmd_path", ")", ":", "parent", "=", "self", ".", "tree", "for", "cmd_name", "in", "existed_cmd_path", ":", "try", ":", "parent", "=", "parent", "[", "'children'", "]", "[", "cmd_name", "]", "except", "Ke...
:return: { "name": cmd_name, "cmd": Resource instance, "children": {} }
[ ":", "return", ":", "{", "name", ":", "cmd_name", "cmd", ":", "Resource", "instance", "children", ":", "{}", "}" ]
train
https://github.com/winkidney/cmdtree/blob/8558be856f4c3044cf13d2d07a86b69877bb6491/src/cmdtree/tree.py#L32-L50
winkidney/cmdtree
src/cmdtree/tree.py
CmdTree._add_node
def _add_node(self, cmd_node, cmd_path): """ :type cmd_path: list or tuple """ parent = self.tree for cmd_key in cmd_path: if cmd_key not in parent['children']: break parent = parent['children'][cmd_key] parent["children"][cmd_node[...
python
def _add_node(self, cmd_node, cmd_path): """ :type cmd_path: list or tuple """ parent = self.tree for cmd_key in cmd_path: if cmd_key not in parent['children']: break parent = parent['children'][cmd_key] parent["children"][cmd_node[...
[ "def", "_add_node", "(", "self", ",", "cmd_node", ",", "cmd_path", ")", ":", "parent", "=", "self", ".", "tree", "for", "cmd_key", "in", "cmd_path", ":", "if", "cmd_key", "not", "in", "parent", "[", "'children'", "]", ":", "break", "parent", "=", "pare...
:type cmd_path: list or tuple
[ ":", "type", "cmd_path", ":", "list", "or", "tuple" ]
train
https://github.com/winkidney/cmdtree/blob/8558be856f4c3044cf13d2d07a86b69877bb6491/src/cmdtree/tree.py#L52-L62
winkidney/cmdtree
src/cmdtree/tree.py
CmdTree.add_parent_commands
def add_parent_commands(self, cmd_path, help=None): """ Create parent command object in cmd tree then return the last parent command object. :rtype: dict """ existed_cmd_end_index = self.index_in_tree(cmd_path) new_path, existed_path = self._get_paths( ...
python
def add_parent_commands(self, cmd_path, help=None): """ Create parent command object in cmd tree then return the last parent command object. :rtype: dict """ existed_cmd_end_index = self.index_in_tree(cmd_path) new_path, existed_path = self._get_paths( ...
[ "def", "add_parent_commands", "(", "self", ",", "cmd_path", ",", "help", "=", "None", ")", ":", "existed_cmd_end_index", "=", "self", ".", "index_in_tree", "(", "cmd_path", ")", "new_path", ",", "existed_path", "=", "self", ".", "_get_paths", "(", "cmd_path", ...
Create parent command object in cmd tree then return the last parent command object. :rtype: dict
[ "Create", "parent", "command", "object", "in", "cmd", "tree", "then", "return", "the", "last", "parent", "command", "object", ".", ":", "rtype", ":", "dict" ]
train
https://github.com/winkidney/cmdtree/blob/8558be856f4c3044cf13d2d07a86b69877bb6491/src/cmdtree/tree.py#L80-L108
winkidney/cmdtree
src/cmdtree/tree.py
CmdTree.index_in_tree
def index_in_tree(self, cmd_path): """ Return the start index of which the element is not in cmd tree. :type cmd_path: list or tuple :return: None if cmd_path already indexed in tree. """ current_tree = self.tree for key in cmd_path: if key in current_...
python
def index_in_tree(self, cmd_path): """ Return the start index of which the element is not in cmd tree. :type cmd_path: list or tuple :return: None if cmd_path already indexed in tree. """ current_tree = self.tree for key in cmd_path: if key in current_...
[ "def", "index_in_tree", "(", "self", ",", "cmd_path", ")", ":", "current_tree", "=", "self", ".", "tree", "for", "key", "in", "cmd_path", ":", "if", "key", "in", "current_tree", "[", "'children'", "]", ":", "current_tree", "=", "current_tree", "[", "'child...
Return the start index of which the element is not in cmd tree. :type cmd_path: list or tuple :return: None if cmd_path already indexed in tree.
[ "Return", "the", "start", "index", "of", "which", "the", "element", "is", "not", "in", "cmd", "tree", ".", ":", "type", "cmd_path", ":", "list", "or", "tuple", ":", "return", ":", "None", "if", "cmd_path", "already", "indexed", "in", "tree", "." ]
train
https://github.com/winkidney/cmdtree/blob/8558be856f4c3044cf13d2d07a86b69877bb6491/src/cmdtree/tree.py#L110-L122
lemieuxl/pyGenClean
pyGenClean/LaTeX/auto_report.py
create_report
def create_report(outdirname, report_filename, **kwargs): """Creates a LaTeX report. :param report_filename: the name of the file. :param outdirname: the name of the output directory. :type report_filename: str :type outdirname: str """ # Checking the required variables if "steps" in ...
python
def create_report(outdirname, report_filename, **kwargs): """Creates a LaTeX report. :param report_filename: the name of the file. :param outdirname: the name of the output directory. :type report_filename: str :type outdirname: str """ # Checking the required variables if "steps" in ...
[ "def", "create_report", "(", "outdirname", ",", "report_filename", ",", "*", "*", "kwargs", ")", ":", "# Checking the required variables", "if", "\"steps\"", "in", "kwargs", ":", "assert", "\"descriptions\"", "in", "kwargs", "assert", "\"long_descriptions\"", "in", ...
Creates a LaTeX report. :param report_filename: the name of the file. :param outdirname: the name of the output directory. :type report_filename: str :type outdirname: str
[ "Creates", "a", "LaTeX", "report", "." ]
train
https://github.com/lemieuxl/pyGenClean/blob/6173a48ccc0cf3a3bd711b1f2a1fa16248b8bf55/pyGenClean/LaTeX/auto_report.py#L27-L181
lemieuxl/pyGenClean
pyGenClean/LaTeX/auto_report.py
_format_background
def _format_background(background): """Formats the background section :param background: the background content or file. :type background: str or file :returns: the background content. :rtype: str """ # Getting the background if os.path.isfile(background): with open(backgroun...
python
def _format_background(background): """Formats the background section :param background: the background content or file. :type background: str or file :returns: the background content. :rtype: str """ # Getting the background if os.path.isfile(background): with open(backgroun...
[ "def", "_format_background", "(", "background", ")", ":", "# Getting the background", "if", "os", ".", "path", ".", "isfile", "(", "background", ")", ":", "with", "open", "(", "background", ",", "\"r\"", ")", "as", "i_file", ":", "background", "=", "i_file",...
Formats the background section :param background: the background content or file. :type background: str or file :returns: the background content. :rtype: str
[ "Formats", "the", "background", "section" ]
train
https://github.com/lemieuxl/pyGenClean/blob/6173a48ccc0cf3a3bd711b1f2a1fa16248b8bf55/pyGenClean/LaTeX/auto_report.py#L184-L211
lemieuxl/pyGenClean
pyGenClean/LaTeX/auto_report.py
_create_summary_table
def _create_summary_table(fn, template, nb_samples, nb_markers): """Creates the final table. :param fn: the name of the file containing the summary. :param template: the Jinja2 template. :param nb_samples: the final number of samples. :param nb_markers: the final number of markers. :type fn: s...
python
def _create_summary_table(fn, template, nb_samples, nb_markers): """Creates the final table. :param fn: the name of the file containing the summary. :param template: the Jinja2 template. :param nb_samples: the final number of samples. :param nb_markers: the final number of markers. :type fn: s...
[ "def", "_create_summary_table", "(", "fn", ",", "template", ",", "nb_samples", ",", "nb_markers", ")", ":", "# The final data", "table_data", "=", "[", "]", "# Reading the summary file", "with", "open", "(", "fn", ",", "\"r\"", ")", "as", "i_file", ":", "data"...
Creates the final table. :param fn: the name of the file containing the summary. :param template: the Jinja2 template. :param nb_samples: the final number of samples. :param nb_markers: the final number of markers. :type fn: str :type template: Jinja2.template :type nb_samples: str :ty...
[ "Creates", "the", "final", "table", "." ]
train
https://github.com/lemieuxl/pyGenClean/blob/6173a48ccc0cf3a3bd711b1f2a1fa16248b8bf55/pyGenClean/LaTeX/auto_report.py#L214-L301
radujica/baloo
baloo/weld/weld_str.py
weld_str_lower
def weld_str_lower(array): """Convert values to lowercase. Parameters ---------- array : numpy.ndarray or WeldObject Input data. Returns ------- WeldObject Representation of this computation. """ obj_id, weld_obj = create_weld_object(array) weld_template = """...
python
def weld_str_lower(array): """Convert values to lowercase. Parameters ---------- array : numpy.ndarray or WeldObject Input data. Returns ------- WeldObject Representation of this computation. """ obj_id, weld_obj = create_weld_object(array) weld_template = """...
[ "def", "weld_str_lower", "(", "array", ")", ":", "obj_id", ",", "weld_obj", "=", "create_weld_object", "(", "array", ")", "weld_template", "=", "\"\"\"map(\n {array},\n |e: vec[i8]|\n result(\n for(e,\n appender[i8],\n |c: appende...
Convert values to lowercase. Parameters ---------- array : numpy.ndarray or WeldObject Input data. Returns ------- WeldObject Representation of this computation.
[ "Convert", "values", "to", "lowercase", "." ]
train
https://github.com/radujica/baloo/blob/f6e05e35b73a75e8a300754c6bdc575e5f2d53b9/baloo/weld/weld_str.py#L6-L38
radujica/baloo
baloo/weld/weld_str.py
weld_str_upper
def weld_str_upper(array): """Convert values to uppercase. Parameters ---------- array : numpy.ndarray or WeldObject Input data. Returns ------- WeldObject Representation of this computation. """ obj_id, weld_obj = create_weld_object(array) weld_template = """...
python
def weld_str_upper(array): """Convert values to uppercase. Parameters ---------- array : numpy.ndarray or WeldObject Input data. Returns ------- WeldObject Representation of this computation. """ obj_id, weld_obj = create_weld_object(array) weld_template = """...
[ "def", "weld_str_upper", "(", "array", ")", ":", "obj_id", ",", "weld_obj", "=", "create_weld_object", "(", "array", ")", "weld_template", "=", "\"\"\"map(\n {array},\n |e: vec[i8]|\n result(\n for(e,\n appender[i8],\n |c: appende...
Convert values to uppercase. Parameters ---------- array : numpy.ndarray or WeldObject Input data. Returns ------- WeldObject Representation of this computation.
[ "Convert", "values", "to", "uppercase", "." ]
train
https://github.com/radujica/baloo/blob/f6e05e35b73a75e8a300754c6bdc575e5f2d53b9/baloo/weld/weld_str.py#L41-L73
radujica/baloo
baloo/weld/weld_str.py
weld_str_capitalize
def weld_str_capitalize(array): """Capitalize first letter. Parameters ---------- array : numpy.ndarray or WeldObject Input data. Returns ------- WeldObject Representation of this computation. """ obj_id, weld_obj = create_weld_object(array) weld_template = ""...
python
def weld_str_capitalize(array): """Capitalize first letter. Parameters ---------- array : numpy.ndarray or WeldObject Input data. Returns ------- WeldObject Representation of this computation. """ obj_id, weld_obj = create_weld_object(array) weld_template = ""...
[ "def", "weld_str_capitalize", "(", "array", ")", ":", "obj_id", ",", "weld_obj", "=", "create_weld_object", "(", "array", ")", "weld_template", "=", "\"\"\"map(\n {array},\n |e: vec[i8]|\n let lenString = len(e);\n if(lenString > 0L,\n let res = appende...
Capitalize first letter. Parameters ---------- array : numpy.ndarray or WeldObject Input data. Returns ------- WeldObject Representation of this computation.
[ "Capitalize", "first", "letter", "." ]
train
https://github.com/radujica/baloo/blob/f6e05e35b73a75e8a300754c6bdc575e5f2d53b9/baloo/weld/weld_str.py#L76-L115
radujica/baloo
baloo/weld/weld_str.py
weld_str_get
def weld_str_get(array, i): """Retrieve character at index i. Parameters ---------- array : numpy.ndarray or WeldObject Input data. i : int Index of character to retrieve. If greater than length of string, returns None. Returns ------- WeldObject Representation ...
python
def weld_str_get(array, i): """Retrieve character at index i. Parameters ---------- array : numpy.ndarray or WeldObject Input data. i : int Index of character to retrieve. If greater than length of string, returns None. Returns ------- WeldObject Representation ...
[ "def", "weld_str_get", "(", "array", ",", "i", ")", ":", "obj_id", ",", "weld_obj", "=", "create_weld_object", "(", "array", ")", "index_literal", "=", "to_weld_literal", "(", "i", ",", "WeldLong", "(", ")", ")", "missing_literal", "=", "default_missing_data_l...
Retrieve character at index i. Parameters ---------- array : numpy.ndarray or WeldObject Input data. i : int Index of character to retrieve. If greater than length of string, returns None. Returns ------- WeldObject Representation of this computation.
[ "Retrieve", "character", "at", "index", "i", "." ]
train
https://github.com/radujica/baloo/blob/f6e05e35b73a75e8a300754c6bdc575e5f2d53b9/baloo/weld/weld_str.py#L118-L155
radujica/baloo
baloo/weld/weld_str.py
weld_str_strip
def weld_str_strip(array): """Strip whitespace from start and end of elements. Note it currently only looks for whitespace (Ascii 32), not tabs or EOL. Parameters ---------- array : numpy.ndarray or WeldObject Input data. Returns ------- WeldObject Representation of th...
python
def weld_str_strip(array): """Strip whitespace from start and end of elements. Note it currently only looks for whitespace (Ascii 32), not tabs or EOL. Parameters ---------- array : numpy.ndarray or WeldObject Input data. Returns ------- WeldObject Representation of th...
[ "def", "weld_str_strip", "(", "array", ")", ":", "obj_id", ",", "weld_obj", "=", "create_weld_object", "(", "array", ")", "# +3L = +1 compensate start_i already +1'ed, +1 compensate end_i already -1'ed, +1 compensate for slice with size", "weld_template", "=", "\"\"\"map(\n {arr...
Strip whitespace from start and end of elements. Note it currently only looks for whitespace (Ascii 32), not tabs or EOL. Parameters ---------- array : numpy.ndarray or WeldObject Input data. Returns ------- WeldObject Representation of this computation.
[ "Strip", "whitespace", "from", "start", "and", "end", "of", "elements", "." ]
train
https://github.com/radujica/baloo/blob/f6e05e35b73a75e8a300754c6bdc575e5f2d53b9/baloo/weld/weld_str.py#L158-L189
radujica/baloo
baloo/weld/weld_str.py
weld_str_slice
def weld_str_slice(array, start=None, stop=None, step=None): """Slice each element. Parameters ---------- array : numpy.ndarray or WeldObject Input data. start : int, optional stop : int, optional step : int, optional Returns ------- WeldObject Representation of...
python
def weld_str_slice(array, start=None, stop=None, step=None): """Slice each element. Parameters ---------- array : numpy.ndarray or WeldObject Input data. start : int, optional stop : int, optional step : int, optional Returns ------- WeldObject Representation of...
[ "def", "weld_str_slice", "(", "array", ",", "start", "=", "None", ",", "stop", "=", "None", ",", "step", "=", "None", ")", ":", "obj_id", ",", "weld_obj", "=", "create_weld_object", "(", "array", ")", "start", "=", "_prepare_slice", "(", "start", ",", ...
Slice each element. Parameters ---------- array : numpy.ndarray or WeldObject Input data. start : int, optional stop : int, optional step : int, optional Returns ------- WeldObject Representation of this computation.
[ "Slice", "each", "element", "." ]
train
https://github.com/radujica/baloo/blob/f6e05e35b73a75e8a300754c6bdc575e5f2d53b9/baloo/weld/weld_str.py#L200-L241
radujica/baloo
baloo/weld/weld_str.py
weld_str_startswith
def weld_str_startswith(array, pat): """Check which elements start with pattern. Parameters ---------- array : numpy.ndarray or WeldObject Input data. pat : str To check for. Returns ------- WeldObject Representation of this computation. """ obj_id, wel...
python
def weld_str_startswith(array, pat): """Check which elements start with pattern. Parameters ---------- array : numpy.ndarray or WeldObject Input data. pat : str To check for. Returns ------- WeldObject Representation of this computation. """ obj_id, wel...
[ "def", "weld_str_startswith", "(", "array", ",", "pat", ")", ":", "obj_id", ",", "weld_obj", "=", "create_weld_object", "(", "array", ")", "pat_id", "=", "get_weld_obj_id", "(", "weld_obj", ",", "pat", ")", "\"\"\"alternative implementation for reference\n let res ...
Check which elements start with pattern. Parameters ---------- array : numpy.ndarray or WeldObject Input data. pat : str To check for. Returns ------- WeldObject Representation of this computation.
[ "Check", "which", "elements", "start", "with", "pattern", "." ]
train
https://github.com/radujica/baloo/blob/f6e05e35b73a75e8a300754c6bdc575e5f2d53b9/baloo/weld/weld_str.py#L300-L354
radujica/baloo
baloo/weld/weld_str.py
weld_str_find
def weld_str_find(array, sub, start, end): """Return index of sub in elements if found, else -1. Parameters ---------- array : numpy.ndarray or WeldObject Input data. sub : str To check for. start : int Start index for searching. end : int or None Stop index ...
python
def weld_str_find(array, sub, start, end): """Return index of sub in elements if found, else -1. Parameters ---------- array : numpy.ndarray or WeldObject Input data. sub : str To check for. start : int Start index for searching. end : int or None Stop index ...
[ "def", "weld_str_find", "(", "array", ",", "sub", ",", "start", ",", "end", ")", ":", "obj_id", ",", "weld_obj", "=", "create_weld_object", "(", "array", ")", "sub_id", "=", "get_weld_obj_id", "(", "weld_obj", ",", "sub", ")", "if", "end", "is", "None", ...
Return index of sub in elements if found, else -1. Parameters ---------- array : numpy.ndarray or WeldObject Input data. sub : str To check for. start : int Start index for searching. end : int or None Stop index for searching. Returns ------- WeldOb...
[ "Return", "index", "of", "sub", "in", "elements", "if", "found", "else", "-", "1", "." ]
train
https://github.com/radujica/baloo/blob/f6e05e35b73a75e8a300754c6bdc575e5f2d53b9/baloo/weld/weld_str.py#L400-L473
radujica/baloo
baloo/weld/weld_str.py
weld_str_replace
def weld_str_replace(array, pat, rep): """Replace first occurrence of pat with rep. Parameters ---------- array : numpy.ndarray or WeldObject Input data. pat : str To find. rep : str To replace with. Returns ------- WeldObject Representation of this ...
python
def weld_str_replace(array, pat, rep): """Replace first occurrence of pat with rep. Parameters ---------- array : numpy.ndarray or WeldObject Input data. pat : str To find. rep : str To replace with. Returns ------- WeldObject Representation of this ...
[ "def", "weld_str_replace", "(", "array", ",", "pat", ",", "rep", ")", ":", "obj_id", ",", "weld_obj", "=", "create_weld_object", "(", "array", ")", "pat_id", "=", "get_weld_obj_id", "(", "weld_obj", ",", "pat", ")", "rep_id", "=", "get_weld_obj_id", "(", "...
Replace first occurrence of pat with rep. Parameters ---------- array : numpy.ndarray or WeldObject Input data. pat : str To find. rep : str To replace with. Returns ------- WeldObject Representation of this computation.
[ "Replace", "first", "occurrence", "of", "pat", "with", "rep", "." ]
train
https://github.com/radujica/baloo/blob/f6e05e35b73a75e8a300754c6bdc575e5f2d53b9/baloo/weld/weld_str.py#L476-L554
radujica/baloo
baloo/weld/weld_str.py
weld_str_split
def weld_str_split(array, pat, side): """Split on pat and return side. Parameters ---------- array : numpy.ndarray or WeldObject Input data. pat : str To find. side : {0, 1} Which side to return, with 0 being left and 1 being right Returns ------- WeldObject...
python
def weld_str_split(array, pat, side): """Split on pat and return side. Parameters ---------- array : numpy.ndarray or WeldObject Input data. pat : str To find. side : {0, 1} Which side to return, with 0 being left and 1 being right Returns ------- WeldObject...
[ "def", "weld_str_split", "(", "array", ",", "pat", ",", "side", ")", ":", "obj_id", ",", "weld_obj", "=", "create_weld_object", "(", "array", ")", "pat_id", "=", "get_weld_obj_id", "(", "weld_obj", ",", "pat", ")", "left_side_template", "=", "\"\"\"let pat_sta...
Split on pat and return side. Parameters ---------- array : numpy.ndarray or WeldObject Input data. pat : str To find. side : {0, 1} Which side to return, with 0 being left and 1 being right Returns ------- WeldObject Representation of this computation.
[ "Split", "on", "pat", "and", "return", "side", "." ]
train
https://github.com/radujica/baloo/blob/f6e05e35b73a75e8a300754c6bdc575e5f2d53b9/baloo/weld/weld_str.py#L557-L633
jtmoulia/switchboard-python
aplus/__init__.py
_isPromise
def _isPromise(obj): """ A utility function to determine if the specified object is a promise using "duck typing". """ return hasattr(obj, "fulfill") and \ _isFunction(getattr(obj, "fulfill")) and \ hasattr(obj, "reject") and \ _isFunction(getattr(obj, "reject")) and \ ...
python
def _isPromise(obj): """ A utility function to determine if the specified object is a promise using "duck typing". """ return hasattr(obj, "fulfill") and \ _isFunction(getattr(obj, "fulfill")) and \ hasattr(obj, "reject") and \ _isFunction(getattr(obj, "reject")) and \ ...
[ "def", "_isPromise", "(", "obj", ")", ":", "return", "hasattr", "(", "obj", ",", "\"fulfill\"", ")", "and", "_isFunction", "(", "getattr", "(", "obj", ",", "\"fulfill\"", ")", ")", "and", "hasattr", "(", "obj", ",", "\"reject\"", ")", "and", "_isFunction...
A utility function to determine if the specified object is a promise using "duck typing".
[ "A", "utility", "function", "to", "determine", "if", "the", "specified", "object", "is", "a", "promise", "using", "duck", "typing", "." ]
train
https://github.com/jtmoulia/switchboard-python/blob/c9b0cb74cb12a64385465091be633e78d39f08b1/aplus/__init__.py#L261-L271
jtmoulia/switchboard-python
aplus/__init__.py
listPromise
def listPromise(*args): """ A special function that takes a bunch of promises and turns them into a promise for a vector of values. In other words, this turns an list of promises for values into a promise for a list of values. """ ret = Promise() def handleSuccess(v, ret): for a...
python
def listPromise(*args): """ A special function that takes a bunch of promises and turns them into a promise for a vector of values. In other words, this turns an list of promises for values into a promise for a list of values. """ ret = Promise() def handleSuccess(v, ret): for a...
[ "def", "listPromise", "(", "*", "args", ")", ":", "ret", "=", "Promise", "(", ")", "def", "handleSuccess", "(", "v", ",", "ret", ")", ":", "for", "arg", "in", "args", ":", "if", "not", "arg", ".", "isFulfilled", "(", ")", ":", "return", "value", ...
A special function that takes a bunch of promises and turns them into a promise for a vector of values. In other words, this turns an list of promises for values into a promise for a list of values.
[ "A", "special", "function", "that", "takes", "a", "bunch", "of", "promises", "and", "turns", "them", "into", "a", "promise", "for", "a", "vector", "of", "values", ".", "In", "other", "words", "this", "turns", "an", "list", "of", "promises", "for", "value...
train
https://github.com/jtmoulia/switchboard-python/blob/c9b0cb74cb12a64385465091be633e78d39f08b1/aplus/__init__.py#L273-L297
jtmoulia/switchboard-python
aplus/__init__.py
dictPromise
def dictPromise(m): """ A special function that takes a dictionary of promises and turns them into a promise for a dictionary of values. In other words, this turns an dictionary of promises for values into a promise for a dictionary of values. """ ret = Promise() def handleSuccess(v, re...
python
def dictPromise(m): """ A special function that takes a dictionary of promises and turns them into a promise for a dictionary of values. In other words, this turns an dictionary of promises for values into a promise for a dictionary of values. """ ret = Promise() def handleSuccess(v, re...
[ "def", "dictPromise", "(", "m", ")", ":", "ret", "=", "Promise", "(", ")", "def", "handleSuccess", "(", "v", ",", "ret", ")", ":", "for", "p", "in", "m", ".", "values", "(", ")", ":", "if", "not", "p", ".", "isFulfilled", "(", ")", ":", "return...
A special function that takes a dictionary of promises and turns them into a promise for a dictionary of values. In other words, this turns an dictionary of promises for values into a promise for a dictionary of values.
[ "A", "special", "function", "that", "takes", "a", "dictionary", "of", "promises", "and", "turns", "them", "into", "a", "promise", "for", "a", "dictionary", "of", "values", ".", "In", "other", "words", "this", "turns", "an", "dictionary", "of", "promises", ...
train
https://github.com/jtmoulia/switchboard-python/blob/c9b0cb74cb12a64385465091be633e78d39f08b1/aplus/__init__.py#L299-L325
jtmoulia/switchboard-python
aplus/__init__.py
Promise.fulfill
def fulfill(self, value): """ Fulfill the promise with a given value. """ assert self._state==self.PENDING self._state=self.FULFILLED; self.value = value for callback in self._callbacks: try: callback(value) except Excepti...
python
def fulfill(self, value): """ Fulfill the promise with a given value. """ assert self._state==self.PENDING self._state=self.FULFILLED; self.value = value for callback in self._callbacks: try: callback(value) except Excepti...
[ "def", "fulfill", "(", "self", ",", "value", ")", ":", "assert", "self", ".", "_state", "==", "self", ".", "PENDING", "self", ".", "_state", "=", "self", ".", "FULFILLED", "self", ".", "value", "=", "value", "for", "callback", "in", "self", ".", "_ca...
Fulfill the promise with a given value.
[ "Fulfill", "the", "promise", "with", "a", "given", "value", "." ]
train
https://github.com/jtmoulia/switchboard-python/blob/c9b0cb74cb12a64385465091be633e78d39f08b1/aplus/__init__.py#L26-L45
jtmoulia/switchboard-python
aplus/__init__.py
Promise.reject
def reject(self, reason): """ Reject this promise for a given reason. """ assert self._state==self.PENDING self._state=self.REJECTED; self.reason = reason for errback in self._errbacks: try: errback(reason) except Exception...
python
def reject(self, reason): """ Reject this promise for a given reason. """ assert self._state==self.PENDING self._state=self.REJECTED; self.reason = reason for errback in self._errbacks: try: errback(reason) except Exception...
[ "def", "reject", "(", "self", ",", "reason", ")", ":", "assert", "self", ".", "_state", "==", "self", ".", "PENDING", "self", ".", "_state", "=", "self", ".", "REJECTED", "self", ".", "reason", "=", "reason", "for", "errback", "in", "self", ".", "_er...
Reject this promise for a given reason.
[ "Reject", "this", "promise", "for", "a", "given", "reason", "." ]
train
https://github.com/jtmoulia/switchboard-python/blob/c9b0cb74cb12a64385465091be633e78d39f08b1/aplus/__init__.py#L47-L66
jtmoulia/switchboard-python
aplus/__init__.py
Promise.get
def get(self, timeout=None): """Get the value of the promise, waiting if necessary.""" self.wait(timeout) if self._state==self.FULFILLED: return self.value else: raise ValueError("Calculation didn't yield a value")
python
def get(self, timeout=None): """Get the value of the promise, waiting if necessary.""" self.wait(timeout) if self._state==self.FULFILLED: return self.value else: raise ValueError("Calculation didn't yield a value")
[ "def", "get", "(", "self", ",", "timeout", "=", "None", ")", ":", "self", ".", "wait", "(", "timeout", ")", "if", "self", ".", "_state", "==", "self", ".", "FULFILLED", ":", "return", "self", ".", "value", "else", ":", "raise", "ValueError", "(", "...
Get the value of the promise, waiting if necessary.
[ "Get", "the", "value", "of", "the", "promise", "waiting", "if", "necessary", "." ]
train
https://github.com/jtmoulia/switchboard-python/blob/c9b0cb74cb12a64385465091be633e78d39f08b1/aplus/__init__.py#L80-L86
jtmoulia/switchboard-python
aplus/__init__.py
Promise.wait
def wait(self, timeout=None): """ An implementation of the wait method which doesn't involve polling but instead utilizes a "real" synchronization scheme. """ import threading if self._state!=self.PENDING: return e = threading.Event() ...
python
def wait(self, timeout=None): """ An implementation of the wait method which doesn't involve polling but instead utilizes a "real" synchronization scheme. """ import threading if self._state!=self.PENDING: return e = threading.Event() ...
[ "def", "wait", "(", "self", ",", "timeout", "=", "None", ")", ":", "import", "threading", "if", "self", ".", "_state", "!=", "self", ".", "PENDING", ":", "return", "e", "=", "threading", ".", "Event", "(", ")", "self", ".", "addCallback", "(", "lambd...
An implementation of the wait method which doesn't involve polling but instead utilizes a "real" synchronization scheme.
[ "An", "implementation", "of", "the", "wait", "method", "which", "doesn", "t", "involve", "polling", "but", "instead", "utilizes", "a", "real", "synchronization", "scheme", "." ]
train
https://github.com/jtmoulia/switchboard-python/blob/c9b0cb74cb12a64385465091be633e78d39f08b1/aplus/__init__.py#L88-L102
jtmoulia/switchboard-python
aplus/__init__.py
Promise.then
def then(self, success=None, failure=None): """ This method takes two optional arguments. The first argument is used if the "self promise" is fulfilled and the other is used if the "self promise" is rejected. In either case, this method returns another promise that effectively ...
python
def then(self, success=None, failure=None): """ This method takes two optional arguments. The first argument is used if the "self promise" is fulfilled and the other is used if the "self promise" is rejected. In either case, this method returns another promise that effectively ...
[ "def", "then", "(", "self", ",", "success", "=", "None", ",", "failure", "=", "None", ")", ":", "ret", "=", "Promise", "(", ")", "def", "callAndFulfill", "(", "v", ")", ":", "\"\"\"\n A callback to be invoked if the \"self promise\"\n is fulfil...
This method takes two optional arguments. The first argument is used if the "self promise" is fulfilled and the other is used if the "self promise" is rejected. In either case, this method returns another promise that effectively represents the result of either the first of the second ...
[ "This", "method", "takes", "two", "optional", "arguments", ".", "The", "first", "argument", "is", "used", "if", "the", "self", "promise", "is", "fulfilled", "and", "the", "other", "is", "used", "if", "the", "self", "promise", "is", "rejected", ".", "In", ...
train
https://github.com/jtmoulia/switchboard-python/blob/c9b0cb74cb12a64385465091be633e78d39f08b1/aplus/__init__.py#L121-L248