partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
train
url_host
Parses hostname from URL. :param url: URL :return: hostname
jutil/urls.py
def url_host(url: str) -> str: """ Parses hostname from URL. :param url: URL :return: hostname """ from urllib.parse import urlparse res = urlparse(url) return res.netloc.split(':')[0] if res.netloc else ''
def url_host(url: str) -> str: """ Parses hostname from URL. :param url: URL :return: hostname """ from urllib.parse import urlparse res = urlparse(url) return res.netloc.split(':')[0] if res.netloc else ''
[ "Parses", "hostname", "from", "URL", ".", ":", "param", "url", ":", "URL", ":", "return", ":", "hostname" ]
kajala/django-jutil
python
https://github.com/kajala/django-jutil/blob/2abd93ebad51042744eaeb1ee1074ed0eb55ad0c/jutil/urls.py#L38-L46
[ "def", "url_host", "(", "url", ":", "str", ")", "->", "str", ":", "from", "urllib", ".", "parse", "import", "urlparse", "res", "=", "urlparse", "(", "url", ")", "return", "res", ".", "netloc", ".", "split", "(", "':'", ")", "[", "0", "]", "if", "...
2abd93ebad51042744eaeb1ee1074ed0eb55ad0c
train
vitools.ufloatDict_nominal
This gives us a dictionary of nominal values from a dictionary of uncertainties
bin/lib/CodeTools/various.py
def ufloatDict_nominal(self, ufloat_dict): 'This gives us a dictionary of nominal values from a dictionary of uncertainties' return OrderedDict(izip(ufloat_dict.keys(), map(lambda x: x.nominal_value, ufloat_dict.values())))
def ufloatDict_nominal(self, ufloat_dict): 'This gives us a dictionary of nominal values from a dictionary of uncertainties' return OrderedDict(izip(ufloat_dict.keys(), map(lambda x: x.nominal_value, ufloat_dict.values())))
[ "This", "gives", "us", "a", "dictionary", "of", "nominal", "values", "from", "a", "dictionary", "of", "uncertainties" ]
Vital-Fernandez/dazer
python
https://github.com/Vital-Fernandez/dazer/blob/3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244/bin/lib/CodeTools/various.py#L75-L77
[ "def", "ufloatDict_nominal", "(", "self", ",", "ufloat_dict", ")", ":", "return", "OrderedDict", "(", "izip", "(", "ufloat_dict", ".", "keys", "(", ")", ",", "map", "(", "lambda", "x", ":", "x", ".", "nominal_value", ",", "ufloat_dict", ".", "values", "(...
3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244
train
vitools.ufloatDict_stdev
This gives us a dictionary of nominal values from a dictionary of uncertainties
bin/lib/CodeTools/various.py
def ufloatDict_stdev(self, ufloat_dict): 'This gives us a dictionary of nominal values from a dictionary of uncertainties' return OrderedDict(izip(ufloat_dict.keys(), map(lambda x: x.std_dev, ufloat_dict.values())))
def ufloatDict_stdev(self, ufloat_dict): 'This gives us a dictionary of nominal values from a dictionary of uncertainties' return OrderedDict(izip(ufloat_dict.keys(), map(lambda x: x.std_dev, ufloat_dict.values())))
[ "This", "gives", "us", "a", "dictionary", "of", "nominal", "values", "from", "a", "dictionary", "of", "uncertainties" ]
Vital-Fernandez/dazer
python
https://github.com/Vital-Fernandez/dazer/blob/3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244/bin/lib/CodeTools/various.py#L80-L82
[ "def", "ufloatDict_stdev", "(", "self", ",", "ufloat_dict", ")", ":", "return", "OrderedDict", "(", "izip", "(", "ufloat_dict", ".", "keys", "(", ")", ",", "map", "(", "lambda", "x", ":", "x", ".", "std_dev", ",", "ufloat_dict", ".", "values", "(", ")"...
3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244
train
docs
Build the documentation for the project. Args: recreate (bool): If set to **True**, the build and output directories will be cleared prior to generating the docs. gen_index (bool): If set to **True**, it will generate top-level index file for the refe...
src/peltak/logic/docs.py
def docs(recreate, gen_index, run_doctests): # type: (bool, bool, bool) -> None """ Build the documentation for the project. Args: recreate (bool): If set to **True**, the build and output directories will be cleared prior to generating the docs. gen_index (bool): ...
def docs(recreate, gen_index, run_doctests): # type: (bool, bool, bool) -> None """ Build the documentation for the project. Args: recreate (bool): If set to **True**, the build and output directories will be cleared prior to generating the docs. gen_index (bool): ...
[ "Build", "the", "documentation", "for", "the", "project", "." ]
novopl/peltak
python
https://github.com/novopl/peltak/blob/b627acc019e3665875fe76cdca0a14773b69beaa/src/peltak/logic/docs.py#L32-L89
[ "def", "docs", "(", "recreate", ",", "gen_index", ",", "run_doctests", ")", ":", "# type: (bool, bool, bool) -> None", "build_dir", "=", "conf", ".", "get_path", "(", "'build_dir'", ",", "'.build'", ")", "docs_dir", "=", "conf", ".", "get_path", "(", "'docs.path...
b627acc019e3665875fe76cdca0a14773b69beaa
train
gen_ref_docs
Generate reference documentation for the project. This will use **sphinx-refdoc** to generate the source .rst files for the reference documentation. Args: gen_index (bool): Set it to **True** if you want to generate the index file with the list of top-level packages. This i...
src/peltak/logic/docs.py
def gen_ref_docs(gen_index=False): # type: (int, bool) -> None """ Generate reference documentation for the project. This will use **sphinx-refdoc** to generate the source .rst files for the reference documentation. Args: gen_index (bool): Set it to **True** if you want to gene...
def gen_ref_docs(gen_index=False): # type: (int, bool) -> None """ Generate reference documentation for the project. This will use **sphinx-refdoc** to generate the source .rst files for the reference documentation. Args: gen_index (bool): Set it to **True** if you want to gene...
[ "Generate", "reference", "documentation", "for", "the", "project", "." ]
novopl/peltak
python
https://github.com/novopl/peltak/blob/b627acc019e3665875fe76cdca0a14773b69beaa/src/peltak/logic/docs.py#L92-L146
[ "def", "gen_ref_docs", "(", "gen_index", "=", "False", ")", ":", "# type: (int, bool) -> None", "try", ":", "from", "refdoc", "import", "generate_docs", "except", "ImportError", "as", "ex", ":", "msg", "=", "(", "\"You need to install sphinx-refdoc if you want to genera...
b627acc019e3665875fe76cdca0a14773b69beaa
train
generate_id_name_map
Generate the ID-NAME map dict :param sdk: CloudGenix API constructor :param reverse: Generate reverse name-> ID map as well, return tuple with both. :return: ID Name dictionary
cloudgenix_idname/__init__.py
def generate_id_name_map(sdk, reverse=False): """ Generate the ID-NAME map dict :param sdk: CloudGenix API constructor :param reverse: Generate reverse name-> ID map as well, return tuple with both. :return: ID Name dictionary """ global_id_name_dict = {} global_name_id_dict = {} #...
def generate_id_name_map(sdk, reverse=False): """ Generate the ID-NAME map dict :param sdk: CloudGenix API constructor :param reverse: Generate reverse name-> ID map as well, return tuple with both. :return: ID Name dictionary """ global_id_name_dict = {} global_name_id_dict = {} #...
[ "Generate", "the", "ID", "-", "NAME", "map", "dict", ":", "param", "sdk", ":", "CloudGenix", "API", "constructor", ":", "param", "reverse", ":", "Generate", "reverse", "name", "-", ">", "ID", "map", "as", "well", "return", "tuple", "with", "both", ".", ...
ebob9/cloudgenix-idname
python
https://github.com/ebob9/cloudgenix-idname/blob/f372eaa768dad0610a0f225015f34067416c2b4a/cloudgenix_idname/__init__.py#L386-L719
[ "def", "generate_id_name_map", "(", "sdk", ",", "reverse", "=", "False", ")", ":", "global_id_name_dict", "=", "{", "}", "global_name_id_dict", "=", "{", "}", "# system struct", "system_list", "=", "[", "]", "# Global lookup dictionary for sub items", "if_id_to_name",...
f372eaa768dad0610a0f225015f34067416c2b4a
train
revrank_dict
Reverse sorts a #dict by a given key, optionally returning it as a #tuple. By default, the @dict is sorted by it's value. @dict: the #dict you wish to sorts @key: the #sorted key to use @as_tuple: returns result as a #tuple ((k, v),...) -> :class:OrderedDict or #tuple
vital/tools/dicts.py
def revrank_dict(dict, key=lambda t: t[1], as_tuple=False): """ Reverse sorts a #dict by a given key, optionally returning it as a #tuple. By default, the @dict is sorted by it's value. @dict: the #dict you wish to sorts @key: the #sorted key to use @as_tuple: returns result as a #t...
def revrank_dict(dict, key=lambda t: t[1], as_tuple=False): """ Reverse sorts a #dict by a given key, optionally returning it as a #tuple. By default, the @dict is sorted by it's value. @dict: the #dict you wish to sorts @key: the #sorted key to use @as_tuple: returns result as a #t...
[ "Reverse", "sorts", "a", "#dict", "by", "a", "given", "key", "optionally", "returning", "it", "as", "a", "#tuple", ".", "By", "default", "the", "@dict", "is", "sorted", "by", "it", "s", "value", "." ]
jaredLunde/vital-tools
python
https://github.com/jaredLunde/vital-tools/blob/ea924c9bbb6ec22aa66f8095f018b1ee0099ac04/vital/tools/dicts.py#L31-L42
[ "def", "revrank_dict", "(", "dict", ",", "key", "=", "lambda", "t", ":", "t", "[", "1", "]", ",", "as_tuple", "=", "False", ")", ":", "sorted_list", "=", "sorted", "(", "dict", ".", "items", "(", ")", ",", "key", "=", "key", ",", "reverse", "=", ...
ea924c9bbb6ec22aa66f8095f018b1ee0099ac04
train
rank_dict
Sorts a #dict by a given key, optionally returning it as a #tuple. By default, the @dict is sorted by it's value. @dict: the #dict you wish to sorts @key: the #sorted key to use @as_tuple: returns result as a #tuple ((k, v),...) -> :class:OrderedDict or #tuple
vital/tools/dicts.py
def rank_dict(dict, key=lambda t: t[1], as_tuple=False): """ Sorts a #dict by a given key, optionally returning it as a #tuple. By default, the @dict is sorted by it's value. @dict: the #dict you wish to sorts @key: the #sorted key to use @as_tuple: returns result as a #tuple ((k, v...
def rank_dict(dict, key=lambda t: t[1], as_tuple=False): """ Sorts a #dict by a given key, optionally returning it as a #tuple. By default, the @dict is sorted by it's value. @dict: the #dict you wish to sorts @key: the #sorted key to use @as_tuple: returns result as a #tuple ((k, v...
[ "Sorts", "a", "#dict", "by", "a", "given", "key", "optionally", "returning", "it", "as", "a", "#tuple", ".", "By", "default", "the", "@dict", "is", "sorted", "by", "it", "s", "value", "." ]
jaredLunde/vital-tools
python
https://github.com/jaredLunde/vital-tools/blob/ea924c9bbb6ec22aa66f8095f018b1ee0099ac04/vital/tools/dicts.py#L45-L56
[ "def", "rank_dict", "(", "dict", ",", "key", "=", "lambda", "t", ":", "t", "[", "1", "]", ",", "as_tuple", "=", "False", ")", ":", "sorted_list", "=", "sorted", "(", "dict", ".", "items", "(", ")", ",", "key", "=", "key", ")", "return", "OrderedD...
ea924c9bbb6ec22aa66f8095f018b1ee0099ac04
train
getitem_in
Finds a key in @obj via a period-delimited string @name. @obj: (#dict) @name: (#str) |.|-separated keys to search @obj in .. obj = {'foo': {'bar': {'baz': True}}} getitem_in(obj, 'foo.bar.baz') .. |True|
vital/tools/dicts.py
def getitem_in(obj, name): """ Finds a key in @obj via a period-delimited string @name. @obj: (#dict) @name: (#str) |.|-separated keys to search @obj in .. obj = {'foo': {'bar': {'baz': True}}} getitem_in(obj, 'foo.bar.baz') .. |True| """ for p...
def getitem_in(obj, name): """ Finds a key in @obj via a period-delimited string @name. @obj: (#dict) @name: (#str) |.|-separated keys to search @obj in .. obj = {'foo': {'bar': {'baz': True}}} getitem_in(obj, 'foo.bar.baz') .. |True| """ for p...
[ "Finds", "a", "key", "in" ]
jaredLunde/vital-tools
python
https://github.com/jaredLunde/vital-tools/blob/ea924c9bbb6ec22aa66f8095f018b1ee0099ac04/vital/tools/dicts.py#L59-L71
[ "def", "getitem_in", "(", "obj", ",", "name", ")", ":", "for", "part", "in", "name", ".", "split", "(", "'.'", ")", ":", "obj", "=", "obj", "[", "part", "]", "return", "obj" ]
ea924c9bbb6ec22aa66f8095f018b1ee0099ac04
train
start
Create a new release. It will bump the current version number and create a release branch called `release/<version>` with one new commit (the version bump). **Example Config**:: \b version_file: 'src/mypkg/__init__.py' **Examples**:: \b $ peltak release start patch ...
src/peltak/extra/gitflow/commands/release.py
def start(component, exact): # type: (str) -> None """ Create a new release. It will bump the current version number and create a release branch called `release/<version>` with one new commit (the version bump). **Example Config**:: \b version_file: 'src/mypkg/__init__.py' **...
def start(component, exact): # type: (str) -> None """ Create a new release. It will bump the current version number and create a release branch called `release/<version>` with one new commit (the version bump). **Example Config**:: \b version_file: 'src/mypkg/__init__.py' **...
[ "Create", "a", "new", "release", "." ]
novopl/peltak
python
https://github.com/novopl/peltak/blob/b627acc019e3665875fe76cdca0a14773b69beaa/src/peltak/extra/gitflow/commands/release.py#L59-L81
[ "def", "start", "(", "component", ",", "exact", ")", ":", "# type: (str) -> None", "from", "peltak", ".", "extra", ".", "gitflow", "import", "logic", "logic", ".", "release", ".", "start", "(", "component", ",", "exact", ")" ]
b627acc019e3665875fe76cdca0a14773b69beaa
train
tag_release
Tag the current commit with as the current version release. This should be the same commit as the one that's uploaded as the release (to pypi for example). **Example Config**:: \b version_file: 'src/mypkg/__init__.py' Examples:: $ peltak release tag # Tag the curren...
src/peltak/extra/gitflow/commands/release.py
def tag_release(message): # type: (str, bool) -> None """ Tag the current commit with as the current version release. This should be the same commit as the one that's uploaded as the release (to pypi for example). **Example Config**:: \b version_file: 'src/mypkg/__init__.py' ...
def tag_release(message): # type: (str, bool) -> None """ Tag the current commit with as the current version release. This should be the same commit as the one that's uploaded as the release (to pypi for example). **Example Config**:: \b version_file: 'src/mypkg/__init__.py' ...
[ "Tag", "the", "current", "commit", "with", "as", "the", "current", "version", "release", "." ]
novopl/peltak
python
https://github.com/novopl/peltak/blob/b627acc019e3665875fe76cdca0a14773b69beaa/src/peltak/extra/gitflow/commands/release.py#L91-L109
[ "def", "tag_release", "(", "message", ")", ":", "# type: (str, bool) -> None", "from", "peltak", ".", "extra", ".", "gitflow", "import", "logic", "logic", ".", "release", ".", "tag", "(", "message", ")" ]
b627acc019e3665875fe76cdca0a14773b69beaa
train
query_file_location
This function asks for a location file address from the command terminal it checks if the file exists before proceeding with the code "question" is a string that is presented to the user. "default_address" is the presumed file location.
working_examples/pyCloudy_heliumEmissivities.py
def query_file_location(question, default_address): """ This function asks for a location file address from the command terminal it checks if the file exists before proceeding with the code "question" is a string that is presented to the user. "default_address" is the presumed file location. ""...
def query_file_location(question, default_address): """ This function asks for a location file address from the command terminal it checks if the file exists before proceeding with the code "question" is a string that is presented to the user. "default_address" is the presumed file location. ""...
[ "This", "function", "asks", "for", "a", "location", "file", "address", "from", "the", "command", "terminal", "it", "checks", "if", "the", "file", "exists", "before", "proceeding", "with", "the", "code", "question", "is", "a", "string", "that", "is", "present...
Vital-Fernandez/dazer
python
https://github.com/Vital-Fernandez/dazer/blob/3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244/working_examples/pyCloudy_heliumEmissivities.py#L8-L30
[ "def", "query_file_location", "(", "question", ",", "default_address", ")", ":", "while", "True", ":", "if", "default_address", "==", "None", ":", "prompt", "=", "'{}:'", ".", "format", "(", "question", ",", "default_address", ")", "else", ":", "prompt", "="...
3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244
train
declare_output_files
This method establishes the output files from pycloudy grids For these simulations in which we are only want to calculate the emissivities from the hydrogen and helium lines most of the default files from pycloudy outputs are not required :return:
working_examples/pyCloudy_heliumEmissivities.py
def declare_output_files(): """ This method establishes the output files from pycloudy grids For these simulations in which we are only want to calculate the emissivities from the hydrogen and helium lines most of the default files from pycloudy outputs are not required :return: """ #Exclu...
def declare_output_files(): """ This method establishes the output files from pycloudy grids For these simulations in which we are only want to calculate the emissivities from the hydrogen and helium lines most of the default files from pycloudy outputs are not required :return: """ #Exclu...
[ "This", "method", "establishes", "the", "output", "files", "from", "pycloudy", "grids", "For", "these", "simulations", "in", "which", "we", "are", "only", "want", "to", "calculate", "the", "emissivities", "from", "the", "hydrogen", "and", "helium", "lines", "m...
Vital-Fernandez/dazer
python
https://github.com/Vital-Fernandez/dazer/blob/3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244/working_examples/pyCloudy_heliumEmissivities.py#L85-L120
[ "def", "declare_output_files", "(", ")", ":", "#Exclude these files from being generated by the simulations", "components_remove", "=", "[", "#['radius', '.rad'],", "#['continuum', '.cont'],", "#['physical conditions', '.phy'],", "[", "'overview'", ",", "'.ovr'", "]", ",", "[", ...
3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244
train
format_full_name
Limits name length to specified length. Tries to keep name as human-readable an natural as possible. :param first_name: First name :param last_name: Last name :param max_length: Maximum length :return: Full name of shortened version depending on length
jutil/format.py
def format_full_name(first_name: str, last_name: str, max_length: int = 20): """ Limits name length to specified length. Tries to keep name as human-readable an natural as possible. :param first_name: First name :param last_name: Last name :param max_length: Maximum length :return: Full name of ...
def format_full_name(first_name: str, last_name: str, max_length: int = 20): """ Limits name length to specified length. Tries to keep name as human-readable an natural as possible. :param first_name: First name :param last_name: Last name :param max_length: Maximum length :return: Full name of ...
[ "Limits", "name", "length", "to", "specified", "length", ".", "Tries", "to", "keep", "name", "as", "human", "-", "readable", "an", "natural", "as", "possible", ".", ":", "param", "first_name", ":", "First", "name", ":", "param", "last_name", ":", "Last", ...
kajala/django-jutil
python
https://github.com/kajala/django-jutil/blob/2abd93ebad51042744eaeb1ee1074ed0eb55ad0c/jutil/format.py#L6-L47
[ "def", "format_full_name", "(", "first_name", ":", "str", ",", "last_name", ":", "str", ",", "max_length", ":", "int", "=", "20", ")", ":", "# dont allow commas in limited names", "first_name", "=", "first_name", ".", "replace", "(", "','", ",", "' '", ")", ...
2abd93ebad51042744eaeb1ee1074ed0eb55ad0c
train
format_timedelta
Formats timedelta to readable format, e.g. 1h30min. :param dt: timedelta :return: str
jutil/format.py
def format_timedelta(dt: timedelta) -> str: """ Formats timedelta to readable format, e.g. 1h30min. :param dt: timedelta :return: str """ seconds = int(dt.total_seconds()) days, remainder = divmod(seconds, 86400) hours, remainder = divmod(remainder, 3600) minutes, seconds = divmod(re...
def format_timedelta(dt: timedelta) -> str: """ Formats timedelta to readable format, e.g. 1h30min. :param dt: timedelta :return: str """ seconds = int(dt.total_seconds()) days, remainder = divmod(seconds, 86400) hours, remainder = divmod(remainder, 3600) minutes, seconds = divmod(re...
[ "Formats", "timedelta", "to", "readable", "format", "e", ".", "g", ".", "1h30min", ".", ":", "param", "dt", ":", "timedelta", ":", "return", ":", "str" ]
kajala/django-jutil
python
https://github.com/kajala/django-jutil/blob/2abd93ebad51042744eaeb1ee1074ed0eb55ad0c/jutil/format.py#L50-L69
[ "def", "format_timedelta", "(", "dt", ":", "timedelta", ")", "->", "str", ":", "seconds", "=", "int", "(", "dt", ".", "total_seconds", "(", ")", ")", "days", ",", "remainder", "=", "divmod", "(", "seconds", ",", "86400", ")", "hours", ",", "remainder",...
2abd93ebad51042744eaeb1ee1074ed0eb55ad0c
train
format_xml
Formats XML document as human-readable plain text. :param xml_str: str (Input XML str) :param exceptions: Raise exceptions on error :return: str (Formatted XML str)
jutil/format.py
def format_xml(xml_str: str, exceptions: bool=False): """ Formats XML document as human-readable plain text. :param xml_str: str (Input XML str) :param exceptions: Raise exceptions on error :return: str (Formatted XML str) """ try: import xml.dom.minidom return xml.dom.minido...
def format_xml(xml_str: str, exceptions: bool=False): """ Formats XML document as human-readable plain text. :param xml_str: str (Input XML str) :param exceptions: Raise exceptions on error :return: str (Formatted XML str) """ try: import xml.dom.minidom return xml.dom.minido...
[ "Formats", "XML", "document", "as", "human", "-", "readable", "plain", "text", ".", ":", "param", "xml_str", ":", "str", "(", "Input", "XML", "str", ")", ":", "param", "exceptions", ":", "Raise", "exceptions", "on", "error", ":", "return", ":", "str", ...
kajala/django-jutil
python
https://github.com/kajala/django-jutil/blob/2abd93ebad51042744eaeb1ee1074ed0eb55ad0c/jutil/format.py#L72-L85
[ "def", "format_xml", "(", "xml_str", ":", "str", ",", "exceptions", ":", "bool", "=", "False", ")", ":", "try", ":", "import", "xml", ".", "dom", ".", "minidom", "return", "xml", ".", "dom", ".", "minidom", ".", "parseString", "(", "xml_str", ")", "....
2abd93ebad51042744eaeb1ee1074ed0eb55ad0c
train
IsogeoSearchForm.worker_allocator
Handler starting the asyncio part.
isogeo_pysdk/samples/desktop_ttk_search_form/isogeo_tk_search_form_py3_async.py
def worker_allocator(self, async_loop, to_do, **kwargs): """ Handler starting the asyncio part. """ d = kwargs threading.Thread( target=self._asyncio_thread, args=(async_loop, to_do, d) ).start()
def worker_allocator(self, async_loop, to_do, **kwargs): """ Handler starting the asyncio part. """ d = kwargs threading.Thread( target=self._asyncio_thread, args=(async_loop, to_do, d) ).start()
[ "Handler", "starting", "the", "asyncio", "part", "." ]
isogeo/isogeo-api-py-minsdk
python
https://github.com/isogeo/isogeo-api-py-minsdk/blob/57a604be92c7767b26abd247012cc1a584b386a0/isogeo_pysdk/samples/desktop_ttk_search_form/isogeo_tk_search_form_py3_async.py#L266-L271
[ "def", "worker_allocator", "(", "self", ",", "async_loop", ",", "to_do", ",", "*", "*", "kwargs", ")", ":", "d", "=", "kwargs", "threading", ".", "Thread", "(", "target", "=", "self", ".", "_asyncio_thread", ",", "args", "=", "(", "async_loop", ",", "t...
57a604be92c7767b26abd247012cc1a584b386a0
train
send_mail
Sends a mail using the configured mail server for Pulsar. See mailgun documentation at https://documentation.mailgun.com/en/latest/user_manual.html#sending-via-api for specifics. Args: form: `dict`. The mail form fields, i.e. 'to', 'from', ... Returns: `requests.models.Response` instanc...
pulsarpy/utils.py
def send_mail(form, from_name): """ Sends a mail using the configured mail server for Pulsar. See mailgun documentation at https://documentation.mailgun.com/en/latest/user_manual.html#sending-via-api for specifics. Args: form: `dict`. The mail form fields, i.e. 'to', 'from', ... Returns:...
def send_mail(form, from_name): """ Sends a mail using the configured mail server for Pulsar. See mailgun documentation at https://documentation.mailgun.com/en/latest/user_manual.html#sending-via-api for specifics. Args: form: `dict`. The mail form fields, i.e. 'to', 'from', ... Returns:...
[ "Sends", "a", "mail", "using", "the", "configured", "mail", "server", "for", "Pulsar", ".", "See", "mailgun", "documentation", "at", "https", ":", "//", "documentation", ".", "mailgun", ".", "com", "/", "en", "/", "latest", "/", "user_manual", ".", "html#s...
nathankw/pulsarpy
python
https://github.com/nathankw/pulsarpy/blob/359b040c0f2383b88c0b5548715fefd35f5f634c/pulsarpy/utils.py#L15-L48
[ "def", "send_mail", "(", "form", ",", "from_name", ")", ":", "form", "[", "\"from\"", "]", "=", "\"{} <mailgun@{}>\"", ".", "format", "(", "from_name", ",", "pulsarpy", ".", "MAIL_DOMAIN", ")", ",", "if", "not", "pulsarpy", ".", "MAIL_SERVER_URL", ":", "ra...
359b040c0f2383b88c0b5548715fefd35f5f634c
train
get_exp_of_biosample
Determines whether the biosample is part of a ChipseqExperiment or SingleCellSorting Experiment, and if so, returns the associated experiment as a models.Model instance that is one of those two classes. The biosample is determined to be part of a ChipseqExperiment if the Biosample.chipseq_experiment_id attr...
pulsarpy/utils.py
def get_exp_of_biosample(biosample_rec): """ Determines whether the biosample is part of a ChipseqExperiment or SingleCellSorting Experiment, and if so, returns the associated experiment as a models.Model instance that is one of those two classes. The biosample is determined to be part of a ChipseqExper...
def get_exp_of_biosample(biosample_rec): """ Determines whether the biosample is part of a ChipseqExperiment or SingleCellSorting Experiment, and if so, returns the associated experiment as a models.Model instance that is one of those two classes. The biosample is determined to be part of a ChipseqExper...
[ "Determines", "whether", "the", "biosample", "is", "part", "of", "a", "ChipseqExperiment", "or", "SingleCellSorting", "Experiment", "and", "if", "so", "returns", "the", "associated", "experiment", "as", "a", "models", ".", "Model", "instance", "that", "is", "one...
nathankw/pulsarpy
python
https://github.com/nathankw/pulsarpy/blob/359b040c0f2383b88c0b5548715fefd35f5f634c/pulsarpy/utils.py#L57-L84
[ "def", "get_exp_of_biosample", "(", "biosample_rec", ")", ":", "chip_exp_id", "=", "biosample_rec", ".", "chipseq_experiment_id", "ssc_id", "=", "biosample_rec", ".", "sorting_biosample_single_cell_sorting_id", "if", "chip_exp_id", ":", "return", "{", "\"type\"", ":", "...
359b040c0f2383b88c0b5548715fefd35f5f634c
train
_clean_text
Clean up a multiple-line, potentially multiple-paragraph text string. This is used to extract the first paragraph of a string and eliminate line breaks and indentation. Lines will be joined together by a single space. :param text: The text string to clean up. It is safe to pass ``No...
cli_tools.py
def _clean_text(text): """ Clean up a multiple-line, potentially multiple-paragraph text string. This is used to extract the first paragraph of a string and eliminate line breaks and indentation. Lines will be joined together by a single space. :param text: The text string to clean up. It is...
def _clean_text(text): """ Clean up a multiple-line, potentially multiple-paragraph text string. This is used to extract the first paragraph of a string and eliminate line breaks and indentation. Lines will be joined together by a single space. :param text: The text string to clean up. It is...
[ "Clean", "up", "a", "multiple", "-", "line", "potentially", "multiple", "-", "paragraph", "text", "string", ".", "This", "is", "used", "to", "extract", "the", "first", "paragraph", "of", "a", "string", "and", "eliminate", "line", "breaks", "and", "indentatio...
klmitch/cli_tools
python
https://github.com/klmitch/cli_tools/blob/3f9b5fd8d7458a402b3999618644ffa419d8a946/cli_tools.py#L28-L52
[ "def", "_clean_text", "(", "text", ")", ":", "desc", "=", "[", "]", "for", "line", "in", "(", "text", "or", "''", ")", ".", "strip", "(", ")", ".", "split", "(", "'\\n'", ")", ":", "# Clean up the line...", "line", "=", "line", ".", "strip", "(", ...
3f9b5fd8d7458a402b3999618644ffa419d8a946
train
prog
Decorator used to specify the program name for the console script help message. :param text: The text to use for the program name.
cli_tools.py
def prog(text): """ Decorator used to specify the program name for the console script help message. :param text: The text to use for the program name. """ def decorator(func): adaptor = ScriptAdaptor._get_adaptor(func) adaptor.prog = text return func return decorato...
def prog(text): """ Decorator used to specify the program name for the console script help message. :param text: The text to use for the program name. """ def decorator(func): adaptor = ScriptAdaptor._get_adaptor(func) adaptor.prog = text return func return decorato...
[ "Decorator", "used", "to", "specify", "the", "program", "name", "for", "the", "console", "script", "help", "message", "." ]
klmitch/cli_tools
python
https://github.com/klmitch/cli_tools/blob/3f9b5fd8d7458a402b3999618644ffa419d8a946/cli_tools.py#L693-L705
[ "def", "prog", "(", "text", ")", ":", "def", "decorator", "(", "func", ")", ":", "adaptor", "=", "ScriptAdaptor", ".", "_get_adaptor", "(", "func", ")", "adaptor", ".", "prog", "=", "text", "return", "func", "return", "decorator" ]
3f9b5fd8d7458a402b3999618644ffa419d8a946
train
usage
Decorator used to specify a usage string for the console script help message. :param text: The text to use for the usage.
cli_tools.py
def usage(text): """ Decorator used to specify a usage string for the console script help message. :param text: The text to use for the usage. """ def decorator(func): adaptor = ScriptAdaptor._get_adaptor(func) adaptor.usage = text return func return decorator
def usage(text): """ Decorator used to specify a usage string for the console script help message. :param text: The text to use for the usage. """ def decorator(func): adaptor = ScriptAdaptor._get_adaptor(func) adaptor.usage = text return func return decorator
[ "Decorator", "used", "to", "specify", "a", "usage", "string", "for", "the", "console", "script", "help", "message", "." ]
klmitch/cli_tools
python
https://github.com/klmitch/cli_tools/blob/3f9b5fd8d7458a402b3999618644ffa419d8a946/cli_tools.py#L708-L720
[ "def", "usage", "(", "text", ")", ":", "def", "decorator", "(", "func", ")", ":", "adaptor", "=", "ScriptAdaptor", ".", "_get_adaptor", "(", "func", ")", "adaptor", ".", "usage", "=", "text", "return", "func", "return", "decorator" ]
3f9b5fd8d7458a402b3999618644ffa419d8a946
train
description
Decorator used to specify a short description of the console script. This can be used to override the default, which is derived from the docstring of the function. :param text: The text to use for the description.
cli_tools.py
def description(text): """ Decorator used to specify a short description of the console script. This can be used to override the default, which is derived from the docstring of the function. :param text: The text to use for the description. """ def decorator(func): adaptor = Scrip...
def description(text): """ Decorator used to specify a short description of the console script. This can be used to override the default, which is derived from the docstring of the function. :param text: The text to use for the description. """ def decorator(func): adaptor = Scrip...
[ "Decorator", "used", "to", "specify", "a", "short", "description", "of", "the", "console", "script", ".", "This", "can", "be", "used", "to", "override", "the", "default", "which", "is", "derived", "from", "the", "docstring", "of", "the", "function", "." ]
klmitch/cli_tools
python
https://github.com/klmitch/cli_tools/blob/3f9b5fd8d7458a402b3999618644ffa419d8a946/cli_tools.py#L723-L736
[ "def", "description", "(", "text", ")", ":", "def", "decorator", "(", "func", ")", ":", "adaptor", "=", "ScriptAdaptor", ".", "_get_adaptor", "(", "func", ")", "adaptor", ".", "description", "=", "text", "return", "func", "return", "decorator" ]
3f9b5fd8d7458a402b3999618644ffa419d8a946
train
epilog
Decorator used to specify an epilog for the console script help message. :param text: The text to use for the epilog.
cli_tools.py
def epilog(text): """ Decorator used to specify an epilog for the console script help message. :param text: The text to use for the epilog. """ def decorator(func): adaptor = ScriptAdaptor._get_adaptor(func) adaptor.epilog = text return func return decorator
def epilog(text): """ Decorator used to specify an epilog for the console script help message. :param text: The text to use for the epilog. """ def decorator(func): adaptor = ScriptAdaptor._get_adaptor(func) adaptor.epilog = text return func return decorator
[ "Decorator", "used", "to", "specify", "an", "epilog", "for", "the", "console", "script", "help", "message", "." ]
klmitch/cli_tools
python
https://github.com/klmitch/cli_tools/blob/3f9b5fd8d7458a402b3999618644ffa419d8a946/cli_tools.py#L739-L751
[ "def", "epilog", "(", "text", ")", ":", "def", "decorator", "(", "func", ")", ":", "adaptor", "=", "ScriptAdaptor", ".", "_get_adaptor", "(", "func", ")", "adaptor", ".", "epilog", "=", "text", "return", "func", "return", "decorator" ]
3f9b5fd8d7458a402b3999618644ffa419d8a946
train
formatter_class
Decorator used to specify the formatter class for the console script. :param klass: The formatter class to use.
cli_tools.py
def formatter_class(klass): """ Decorator used to specify the formatter class for the console script. :param klass: The formatter class to use. """ def decorator(func): adaptor = ScriptAdaptor._get_adaptor(func) adaptor.formatter_class = klass return func return dec...
def formatter_class(klass): """ Decorator used to specify the formatter class for the console script. :param klass: The formatter class to use. """ def decorator(func): adaptor = ScriptAdaptor._get_adaptor(func) adaptor.formatter_class = klass return func return dec...
[ "Decorator", "used", "to", "specify", "the", "formatter", "class", "for", "the", "console", "script", "." ]
klmitch/cli_tools
python
https://github.com/klmitch/cli_tools/blob/3f9b5fd8d7458a402b3999618644ffa419d8a946/cli_tools.py#L754-L766
[ "def", "formatter_class", "(", "klass", ")", ":", "def", "decorator", "(", "func", ")", ":", "adaptor", "=", "ScriptAdaptor", ".", "_get_adaptor", "(", "func", ")", "adaptor", ".", "formatter_class", "=", "klass", "return", "func", "return", "decorator" ]
3f9b5fd8d7458a402b3999618644ffa419d8a946
train
argument
Decorator used to specify an argument taken by the console script. Positional and keyword arguments have the same meaning as those given to ``argparse.ArgumentParser.add_argument()``.
cli_tools.py
def argument(*args, **kwargs): """ Decorator used to specify an argument taken by the console script. Positional and keyword arguments have the same meaning as those given to ``argparse.ArgumentParser.add_argument()``. """ def decorator(func): adaptor = ScriptAdaptor._get_adaptor(func) ...
def argument(*args, **kwargs): """ Decorator used to specify an argument taken by the console script. Positional and keyword arguments have the same meaning as those given to ``argparse.ArgumentParser.add_argument()``. """ def decorator(func): adaptor = ScriptAdaptor._get_adaptor(func) ...
[ "Decorator", "used", "to", "specify", "an", "argument", "taken", "by", "the", "console", "script", ".", "Positional", "and", "keyword", "arguments", "have", "the", "same", "meaning", "as", "those", "given", "to", "argparse", ".", "ArgumentParser", ".", "add_ar...
klmitch/cli_tools
python
https://github.com/klmitch/cli_tools/blob/3f9b5fd8d7458a402b3999618644ffa419d8a946/cli_tools.py#L769-L781
[ "def", "argument", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "def", "decorator", "(", "func", ")", ":", "adaptor", "=", "ScriptAdaptor", ".", "_get_adaptor", "(", "func", ")", "group", "=", "kwargs", ".", "pop", "(", "'group'", ",", "None"...
3f9b5fd8d7458a402b3999618644ffa419d8a946
train
argument_group
Decorator used to specify an argument group. Keyword arguments have the same meaning as those given to ``argparse.ArgumentParser.add_argument_group()``. Arguments may be placed in a given argument group by passing the ``group`` keyword argument to @argument(). :param group: The name of the argume...
cli_tools.py
def argument_group(group, **kwargs): """ Decorator used to specify an argument group. Keyword arguments have the same meaning as those given to ``argparse.ArgumentParser.add_argument_group()``. Arguments may be placed in a given argument group by passing the ``group`` keyword argument to @argu...
def argument_group(group, **kwargs): """ Decorator used to specify an argument group. Keyword arguments have the same meaning as those given to ``argparse.ArgumentParser.add_argument_group()``. Arguments may be placed in a given argument group by passing the ``group`` keyword argument to @argu...
[ "Decorator", "used", "to", "specify", "an", "argument", "group", ".", "Keyword", "arguments", "have", "the", "same", "meaning", "as", "those", "given", "to", "argparse", ".", "ArgumentParser", ".", "add_argument_group", "()", "." ]
klmitch/cli_tools
python
https://github.com/klmitch/cli_tools/blob/3f9b5fd8d7458a402b3999618644ffa419d8a946/cli_tools.py#L784-L800
[ "def", "argument_group", "(", "group", ",", "*", "*", "kwargs", ")", ":", "def", "decorator", "(", "func", ")", ":", "adaptor", "=", "ScriptAdaptor", ".", "_get_adaptor", "(", "func", ")", "adaptor", ".", "_add_group", "(", "group", ",", "'group'", ",", ...
3f9b5fd8d7458a402b3999618644ffa419d8a946
train
subparsers
Decorator used to specify alternate keyword arguments to pass to the ``argparse.ArgumentParser.add_subparsers()`` call.
cli_tools.py
def subparsers(**kwargs): """ Decorator used to specify alternate keyword arguments to pass to the ``argparse.ArgumentParser.add_subparsers()`` call. """ def decorator(func): adaptor = ScriptAdaptor._get_adaptor(func) adaptor.subkwargs = kwargs adaptor.do_subs = True ...
def subparsers(**kwargs): """ Decorator used to specify alternate keyword arguments to pass to the ``argparse.ArgumentParser.add_subparsers()`` call. """ def decorator(func): adaptor = ScriptAdaptor._get_adaptor(func) adaptor.subkwargs = kwargs adaptor.do_subs = True ...
[ "Decorator", "used", "to", "specify", "alternate", "keyword", "arguments", "to", "pass", "to", "the", "argparse", ".", "ArgumentParser", ".", "add_subparsers", "()", "call", "." ]
klmitch/cli_tools
python
https://github.com/klmitch/cli_tools/blob/3f9b5fd8d7458a402b3999618644ffa419d8a946/cli_tools.py#L822-L833
[ "def", "subparsers", "(", "*", "*", "kwargs", ")", ":", "def", "decorator", "(", "func", ")", ":", "adaptor", "=", "ScriptAdaptor", ".", "_get_adaptor", "(", "func", ")", "adaptor", ".", "subkwargs", "=", "kwargs", "adaptor", ".", "do_subs", "=", "True",...
3f9b5fd8d7458a402b3999618644ffa419d8a946
train
load_subcommands
Decorator used to load subcommands from a given ``pkg_resources`` entrypoint group. Each function must be appropriately decorated with the ``cli_tools`` decorators to be considered an extension. :param group: The name of the ``pkg_resources`` entrypoint group.
cli_tools.py
def load_subcommands(group): """ Decorator used to load subcommands from a given ``pkg_resources`` entrypoint group. Each function must be appropriately decorated with the ``cli_tools`` decorators to be considered an extension. :param group: The name of the ``pkg_resources`` entrypoint group. ...
def load_subcommands(group): """ Decorator used to load subcommands from a given ``pkg_resources`` entrypoint group. Each function must be appropriately decorated with the ``cli_tools`` decorators to be considered an extension. :param group: The name of the ``pkg_resources`` entrypoint group. ...
[ "Decorator", "used", "to", "load", "subcommands", "from", "a", "given", "pkg_resources", "entrypoint", "group", ".", "Each", "function", "must", "be", "appropriately", "decorated", "with", "the", "cli_tools", "decorators", "to", "be", "considered", "an", "extensio...
klmitch/cli_tools
python
https://github.com/klmitch/cli_tools/blob/3f9b5fd8d7458a402b3999618644ffa419d8a946/cli_tools.py#L836-L849
[ "def", "load_subcommands", "(", "group", ")", ":", "def", "decorator", "(", "func", ")", ":", "adaptor", "=", "ScriptAdaptor", ".", "_get_adaptor", "(", "func", ")", "adaptor", ".", "_add_extensions", "(", "group", ")", "return", "func", "return", "decorator...
3f9b5fd8d7458a402b3999618644ffa419d8a946
train
Trie._collapse_subtree
Collapse a sub-tree.
ptrie/ptrie.py
def _collapse_subtree(self, name, recursive=True): """Collapse a sub-tree.""" oname = name children = self._db[name]["children"] data = self._db[name]["data"] del_list = [] while (len(children) == 1) and (not data): del_list.append(name) name = chi...
def _collapse_subtree(self, name, recursive=True): """Collapse a sub-tree.""" oname = name children = self._db[name]["children"] data = self._db[name]["data"] del_list = [] while (len(children) == 1) and (not data): del_list.append(name) name = chi...
[ "Collapse", "a", "sub", "-", "tree", "." ]
pmacosta/ptrie
python
https://github.com/pmacosta/ptrie/blob/c176d3ee810b7b5243c7ff2bbf2f1af0b0fff2a8/ptrie/ptrie.py#L127-L152
[ "def", "_collapse_subtree", "(", "self", ",", "name", ",", "recursive", "=", "True", ")", ":", "oname", "=", "name", "children", "=", "self", ".", "_db", "[", "name", "]", "[", "\"children\"", "]", "data", "=", "self", ".", "_db", "[", "name", "]", ...
c176d3ee810b7b5243c7ff2bbf2f1af0b0fff2a8
train
Trie._create_intermediate_nodes
Create intermediate nodes if hierarchy does not exist.
ptrie/ptrie.py
def _create_intermediate_nodes(self, name): """Create intermediate nodes if hierarchy does not exist.""" hierarchy = self._split_node_name(name, self.root_name) node_tree = [ self.root_name + self._node_separator + self._node_separator.join(hierarchy[: num + 1...
def _create_intermediate_nodes(self, name): """Create intermediate nodes if hierarchy does not exist.""" hierarchy = self._split_node_name(name, self.root_name) node_tree = [ self.root_name + self._node_separator + self._node_separator.join(hierarchy[: num + 1...
[ "Create", "intermediate", "nodes", "if", "hierarchy", "does", "not", "exist", "." ]
pmacosta/ptrie
python
https://github.com/pmacosta/ptrie/blob/c176d3ee810b7b5243c7ff2bbf2f1af0b0fff2a8/ptrie/ptrie.py#L154-L172
[ "def", "_create_intermediate_nodes", "(", "self", ",", "name", ")", ":", "hierarchy", "=", "self", ".", "_split_node_name", "(", "name", ",", "self", ".", "root_name", ")", "node_tree", "=", "[", "self", ".", "root_name", "+", "self", ".", "_node_separator",...
c176d3ee810b7b5243c7ff2bbf2f1af0b0fff2a8
train
Trie._create_node
Create new tree node.
ptrie/ptrie.py
def _create_node(self, name, parent, children, data): """Create new tree node.""" self._db[name] = {"parent": parent, "children": children, "data": data}
def _create_node(self, name, parent, children, data): """Create new tree node.""" self._db[name] = {"parent": parent, "children": children, "data": data}
[ "Create", "new", "tree", "node", "." ]
pmacosta/ptrie
python
https://github.com/pmacosta/ptrie/blob/c176d3ee810b7b5243c7ff2bbf2f1af0b0fff2a8/ptrie/ptrie.py#L174-L176
[ "def", "_create_node", "(", "self", ",", "name", ",", "parent", ",", "children", ",", "data", ")", ":", "self", ".", "_db", "[", "name", "]", "=", "{", "\"parent\"", ":", "parent", ",", "\"children\"", ":", "children", ",", "\"data\"", ":", "data", "...
c176d3ee810b7b5243c7ff2bbf2f1af0b0fff2a8
train
Trie._delete_subtree
Delete subtree private method. No argument validation and usage of getter/setter private methods is used for speed
ptrie/ptrie.py
def _delete_subtree(self, nodes): """ Delete subtree private method. No argument validation and usage of getter/setter private methods is used for speed """ nodes = nodes if isinstance(nodes, list) else [nodes] iobj = [ (self._db[node]["parent"], node...
def _delete_subtree(self, nodes): """ Delete subtree private method. No argument validation and usage of getter/setter private methods is used for speed """ nodes = nodes if isinstance(nodes, list) else [nodes] iobj = [ (self._db[node]["parent"], node...
[ "Delete", "subtree", "private", "method", "." ]
pmacosta/ptrie
python
https://github.com/pmacosta/ptrie/blob/c176d3ee810b7b5243c7ff2bbf2f1af0b0fff2a8/ptrie/ptrie.py#L190-L213
[ "def", "_delete_subtree", "(", "self", ",", "nodes", ")", ":", "nodes", "=", "nodes", "if", "isinstance", "(", "nodes", ",", "list", ")", "else", "[", "nodes", "]", "iobj", "=", "[", "(", "self", ".", "_db", "[", "node", "]", "[", "\"parent\"", "]"...
c176d3ee810b7b5243c7ff2bbf2f1af0b0fff2a8
train
Trie._find_common_prefix
Find common prefix between two nodes.
ptrie/ptrie.py
def _find_common_prefix(self, node1, node2): """Find common prefix between two nodes.""" tokens1 = [item.strip() for item in node1.split(self.node_separator)] tokens2 = [item.strip() for item in node2.split(self.node_separator)] ret = [] for token1, token2 in zip(tokens1, tokens2...
def _find_common_prefix(self, node1, node2): """Find common prefix between two nodes.""" tokens1 = [item.strip() for item in node1.split(self.node_separator)] tokens2 = [item.strip() for item in node2.split(self.node_separator)] ret = [] for token1, token2 in zip(tokens1, tokens2...
[ "Find", "common", "prefix", "between", "two", "nodes", "." ]
pmacosta/ptrie
python
https://github.com/pmacosta/ptrie/blob/c176d3ee810b7b5243c7ff2bbf2f1af0b0fff2a8/ptrie/ptrie.py#L223-L233
[ "def", "_find_common_prefix", "(", "self", ",", "node1", ",", "node2", ")", ":", "tokens1", "=", "[", "item", ".", "strip", "(", ")", "for", "item", "in", "node1", ".", "split", "(", "self", ".", "node_separator", ")", "]", "tokens2", "=", "[", "item...
c176d3ee810b7b5243c7ff2bbf2f1af0b0fff2a8
train
Trie._prt
Print a row (leaf) of tree. :param name: Full node name :type name: string :param lparent: Position in full node name of last separator before node to be printed :type lparent: integer :param pre1: Connector next to node name, either a null character ...
ptrie/ptrie.py
def _prt(self, name, lparent, sep, pre1, pre2): """ Print a row (leaf) of tree. :param name: Full node name :type name: string :param lparent: Position in full node name of last separator before node to be printed :type lparent: integer ...
def _prt(self, name, lparent, sep, pre1, pre2): """ Print a row (leaf) of tree. :param name: Full node name :type name: string :param lparent: Position in full node name of last separator before node to be printed :type lparent: integer ...
[ "Print", "a", "row", "(", "leaf", ")", "of", "tree", "." ]
pmacosta/ptrie
python
https://github.com/pmacosta/ptrie/blob/c176d3ee810b7b5243c7ff2bbf2f1af0b0fff2a8/ptrie/ptrie.py#L273-L308
[ "def", "_prt", "(", "self", ",", "name", ",", "lparent", ",", "sep", ",", "pre1", ",", "pre2", ")", ":", "# pylint: disable=R0914", "nname", "=", "name", "[", "lparent", "+", "1", ":", "]", "children", "=", "self", ".", "_db", "[", "name", "]", "["...
c176d3ee810b7b5243c7ff2bbf2f1af0b0fff2a8
train
Trie._rename_node
Rename node private method. No argument validation and usage of getter/setter private methods is used for speed
ptrie/ptrie.py
def _rename_node(self, name, new_name): """ Rename node private method. No argument validation and usage of getter/setter private methods is used for speed """ # Update parent if not self.is_root(name): parent = self._db[name]["parent"] se...
def _rename_node(self, name, new_name): """ Rename node private method. No argument validation and usage of getter/setter private methods is used for speed """ # Update parent if not self.is_root(name): parent = self._db[name]["parent"] se...
[ "Rename", "node", "private", "method", "." ]
pmacosta/ptrie
python
https://github.com/pmacosta/ptrie/blob/c176d3ee810b7b5243c7ff2bbf2f1af0b0fff2a8/ptrie/ptrie.py#L310-L346
[ "def", "_rename_node", "(", "self", ",", "name", ",", "new_name", ")", ":", "# Update parent", "if", "not", "self", ".", "is_root", "(", "name", ")", ":", "parent", "=", "self", ".", "_db", "[", "name", "]", "[", "\"parent\"", "]", "self", ".", "_db"...
c176d3ee810b7b5243c7ff2bbf2f1af0b0fff2a8
train
Trie._search_tree
Search_tree for nodes that contain a specific hierarchy name.
ptrie/ptrie.py
def _search_tree(self, name): """Search_tree for nodes that contain a specific hierarchy name.""" tpl1 = "{sep}{name}{sep}".format(sep=self._node_separator, name=name) tpl2 = "{sep}{name}".format(sep=self._node_separator, name=name) tpl3 = "{name}{sep}".format(sep=self._node_separator, n...
def _search_tree(self, name): """Search_tree for nodes that contain a specific hierarchy name.""" tpl1 = "{sep}{name}{sep}".format(sep=self._node_separator, name=name) tpl2 = "{sep}{name}".format(sep=self._node_separator, name=name) tpl3 = "{name}{sep}".format(sep=self._node_separator, n...
[ "Search_tree", "for", "nodes", "that", "contain", "a", "specific", "hierarchy", "name", "." ]
pmacosta/ptrie
python
https://github.com/pmacosta/ptrie/blob/c176d3ee810b7b5243c7ff2bbf2f1af0b0fff2a8/ptrie/ptrie.py#L348-L362
[ "def", "_search_tree", "(", "self", ",", "name", ")", ":", "tpl1", "=", "\"{sep}{name}{sep}\"", ".", "format", "(", "sep", "=", "self", ".", "_node_separator", ",", "name", "=", "name", ")", "tpl2", "=", "\"{sep}{name}\"", ".", "format", "(", "sep", "=",...
c176d3ee810b7b5243c7ff2bbf2f1af0b0fff2a8
train
Trie._validate_node_name
Validate NodeName pseudo-type.
ptrie/ptrie.py
def _validate_node_name(self, var_value): """Validate NodeName pseudo-type.""" # pylint: disable=R0201 var_values = var_value if isinstance(var_value, list) else [var_value] for item in var_values: if (not isinstance(item, str)) or ( isinstance(item, str) ...
def _validate_node_name(self, var_value): """Validate NodeName pseudo-type.""" # pylint: disable=R0201 var_values = var_value if isinstance(var_value, list) else [var_value] for item in var_values: if (not isinstance(item, str)) or ( isinstance(item, str) ...
[ "Validate", "NodeName", "pseudo", "-", "type", "." ]
pmacosta/ptrie
python
https://github.com/pmacosta/ptrie/blob/c176d3ee810b7b5243c7ff2bbf2f1af0b0fff2a8/ptrie/ptrie.py#L381-L399
[ "def", "_validate_node_name", "(", "self", ",", "var_value", ")", ":", "# pylint: disable=R0201", "var_values", "=", "var_value", "if", "isinstance", "(", "var_value", ",", "list", ")", "else", "[", "var_value", "]", "for", "item", "in", "var_values", ":", "if...
c176d3ee810b7b5243c7ff2bbf2f1af0b0fff2a8
train
Trie._validate_nodes_with_data
Validate NodeWithData pseudo-type.
ptrie/ptrie.py
def _validate_nodes_with_data(self, names): """Validate NodeWithData pseudo-type.""" names = names if isinstance(names, list) else [names] if not names: raise RuntimeError("Argument `nodes` is not valid") for ndict in names: if (not isinstance(ndict, dict)) or ( ...
def _validate_nodes_with_data(self, names): """Validate NodeWithData pseudo-type.""" names = names if isinstance(names, list) else [names] if not names: raise RuntimeError("Argument `nodes` is not valid") for ndict in names: if (not isinstance(ndict, dict)) or ( ...
[ "Validate", "NodeWithData", "pseudo", "-", "type", "." ]
pmacosta/ptrie
python
https://github.com/pmacosta/ptrie/blob/c176d3ee810b7b5243c7ff2bbf2f1af0b0fff2a8/ptrie/ptrie.py#L401-L424
[ "def", "_validate_nodes_with_data", "(", "self", ",", "names", ")", ":", "names", "=", "names", "if", "isinstance", "(", "names", ",", "list", ")", "else", "[", "names", "]", "if", "not", "names", ":", "raise", "RuntimeError", "(", "\"Argument `nodes` is not...
c176d3ee810b7b5243c7ff2bbf2f1af0b0fff2a8
train
Trie.add_nodes
r""" Add nodes to tree. :param nodes: Node(s) to add with associated data. If there are several list items in the argument with the same node name the resulting node data is a list with items corresponding to the data of each entry in th...
ptrie/ptrie.py
def add_nodes(self, nodes): # noqa: D302 r""" Add nodes to tree. :param nodes: Node(s) to add with associated data. If there are several list items in the argument with the same node name the resulting node data is a list with items ...
def add_nodes(self, nodes): # noqa: D302 r""" Add nodes to tree. :param nodes: Node(s) to add with associated data. If there are several list items in the argument with the same node name the resulting node data is a list with items ...
[ "r", "Add", "nodes", "to", "tree", "." ]
pmacosta/ptrie
python
https://github.com/pmacosta/ptrie/blob/c176d3ee810b7b5243c7ff2bbf2f1af0b0fff2a8/ptrie/ptrie.py#L426-L508
[ "def", "add_nodes", "(", "self", ",", "nodes", ")", ":", "# noqa: D302", "self", ".", "_validate_nodes_with_data", "(", "nodes", ")", "nodes", "=", "nodes", "if", "isinstance", "(", "nodes", ",", "list", ")", "else", "[", "nodes", "]", "# Create root node (i...
c176d3ee810b7b5243c7ff2bbf2f1af0b0fff2a8
train
Trie.collapse_subtree
r""" Collapse a sub-tree. Nodes that have a single child and no data are combined with their child as a single tree node :param name: Root of the sub-tree to collapse :type name: :ref:`NodeName` :param recursive: Flag that indicates whether the collapse operation ...
ptrie/ptrie.py
def collapse_subtree(self, name, recursive=True): # noqa: D302 r""" Collapse a sub-tree. Nodes that have a single child and no data are combined with their child as a single tree node :param name: Root of the sub-tree to collapse :type name: :ref:`NodeName` :...
def collapse_subtree(self, name, recursive=True): # noqa: D302 r""" Collapse a sub-tree. Nodes that have a single child and no data are combined with their child as a single tree node :param name: Root of the sub-tree to collapse :type name: :ref:`NodeName` :...
[ "r", "Collapse", "a", "sub", "-", "tree", "." ]
pmacosta/ptrie
python
https://github.com/pmacosta/ptrie/blob/c176d3ee810b7b5243c7ff2bbf2f1af0b0fff2a8/ptrie/ptrie.py#L510-L567
[ "def", "collapse_subtree", "(", "self", ",", "name", ",", "recursive", "=", "True", ")", ":", "# noqa: D302", "if", "self", ".", "_validate_node_name", "(", "name", ")", ":", "raise", "RuntimeError", "(", "\"Argument `name` is not valid\"", ")", "if", "not", "...
c176d3ee810b7b5243c7ff2bbf2f1af0b0fff2a8
train
Trie.copy_subtree
r""" Copy a sub-tree from one sub-node to another. Data is added if some nodes of the source sub-tree exist in the destination sub-tree :param source_name: Root node of the sub-tree to copy from :type source_name: :ref:`NodeName` :param dest_name: Root node of the sub...
ptrie/ptrie.py
def copy_subtree(self, source_node, dest_node): # noqa: D302 r""" Copy a sub-tree from one sub-node to another. Data is added if some nodes of the source sub-tree exist in the destination sub-tree :param source_name: Root node of the sub-tree to copy from :type source...
def copy_subtree(self, source_node, dest_node): # noqa: D302 r""" Copy a sub-tree from one sub-node to another. Data is added if some nodes of the source sub-tree exist in the destination sub-tree :param source_name: Root node of the sub-tree to copy from :type source...
[ "r", "Copy", "a", "sub", "-", "tree", "from", "one", "sub", "-", "node", "to", "another", "." ]
pmacosta/ptrie
python
https://github.com/pmacosta/ptrie/blob/c176d3ee810b7b5243c7ff2bbf2f1af0b0fff2a8/ptrie/ptrie.py#L569-L642
[ "def", "copy_subtree", "(", "self", ",", "source_node", ",", "dest_node", ")", ":", "# noqa: D302", "if", "self", ".", "_validate_node_name", "(", "source_node", ")", ":", "raise", "RuntimeError", "(", "\"Argument `source_node` is not valid\"", ")", "if", "self", ...
c176d3ee810b7b5243c7ff2bbf2f1af0b0fff2a8
train
Trie.delete_prefix
r""" Delete hierarchy levels from all nodes in the tree. :param nodes: Prefix to delete :type nodes: :ref:`NodeName` :raises: * RuntimeError (Argument \`name\` is not a valid prefix) * RuntimeError (Argument \`name\` is not valid) For example: ...
ptrie/ptrie.py
def delete_prefix(self, name): # noqa: D302 r""" Delete hierarchy levels from all nodes in the tree. :param nodes: Prefix to delete :type nodes: :ref:`NodeName` :raises: * RuntimeError (Argument \`name\` is not a valid prefix) * RuntimeError (Argument \`nam...
def delete_prefix(self, name): # noqa: D302 r""" Delete hierarchy levels from all nodes in the tree. :param nodes: Prefix to delete :type nodes: :ref:`NodeName` :raises: * RuntimeError (Argument \`name\` is not a valid prefix) * RuntimeError (Argument \`nam...
[ "r", "Delete", "hierarchy", "levels", "from", "all", "nodes", "in", "the", "tree", "." ]
pmacosta/ptrie
python
https://github.com/pmacosta/ptrie/blob/c176d3ee810b7b5243c7ff2bbf2f1af0b0fff2a8/ptrie/ptrie.py#L644-L692
[ "def", "delete_prefix", "(", "self", ",", "name", ")", ":", "# noqa: D302", "if", "self", ".", "_validate_node_name", "(", "name", ")", ":", "raise", "RuntimeError", "(", "\"Argument `name` is not valid\"", ")", "if", "(", "not", "self", ".", "root_name", ".",...
c176d3ee810b7b5243c7ff2bbf2f1af0b0fff2a8
train
Trie.delete_subtree
r""" Delete nodes (and their sub-trees) from the tree. :param nodes: Node(s) to delete :type nodes: :ref:`NodeName` or list of :ref:`NodeName` :raises: * RuntimeError (Argument \`nodes\` is not valid) * RuntimeError (Node *[node_name]* not in tree) Using th...
ptrie/ptrie.py
def delete_subtree(self, nodes): # noqa: D302 r""" Delete nodes (and their sub-trees) from the tree. :param nodes: Node(s) to delete :type nodes: :ref:`NodeName` or list of :ref:`NodeName` :raises: * RuntimeError (Argument \`nodes\` is not valid) * RuntimeE...
def delete_subtree(self, nodes): # noqa: D302 r""" Delete nodes (and their sub-trees) from the tree. :param nodes: Node(s) to delete :type nodes: :ref:`NodeName` or list of :ref:`NodeName` :raises: * RuntimeError (Argument \`nodes\` is not valid) * RuntimeE...
[ "r", "Delete", "nodes", "(", "and", "their", "sub", "-", "trees", ")", "from", "the", "tree", "." ]
pmacosta/ptrie
python
https://github.com/pmacosta/ptrie/blob/c176d3ee810b7b5243c7ff2bbf2f1af0b0fff2a8/ptrie/ptrie.py#L694-L729
[ "def", "delete_subtree", "(", "self", ",", "nodes", ")", ":", "# noqa: D302", "if", "self", ".", "_validate_node_name", "(", "nodes", ")", ":", "raise", "RuntimeError", "(", "\"Argument `nodes` is not valid\"", ")", "self", ".", "_delete_subtree", "(", "nodes", ...
c176d3ee810b7b5243c7ff2bbf2f1af0b0fff2a8
train
Trie.flatten_subtree
r""" Flatten sub-tree. Nodes that have children and no data are merged with each child :param name: Ending hierarchy node whose sub-trees are to be flattened :type name: :ref:`NodeName` :raises: * RuntimeError (Argument \`name\` is not valid) ...
ptrie/ptrie.py
def flatten_subtree(self, name): # noqa: D302 r""" Flatten sub-tree. Nodes that have children and no data are merged with each child :param name: Ending hierarchy node whose sub-trees are to be flattened :type name: :ref:`NodeName` :raises: ...
def flatten_subtree(self, name): # noqa: D302 r""" Flatten sub-tree. Nodes that have children and no data are merged with each child :param name: Ending hierarchy node whose sub-trees are to be flattened :type name: :ref:`NodeName` :raises: ...
[ "r", "Flatten", "sub", "-", "tree", "." ]
pmacosta/ptrie
python
https://github.com/pmacosta/ptrie/blob/c176d3ee810b7b5243c7ff2bbf2f1af0b0fff2a8/ptrie/ptrie.py#L731-L807
[ "def", "flatten_subtree", "(", "self", ",", "name", ")", ":", "# noqa: D302", "if", "self", ".", "_validate_node_name", "(", "name", ")", ":", "raise", "RuntimeError", "(", "\"Argument `name` is not valid\"", ")", "self", ".", "_node_in_tree", "(", "name", ")", ...
c176d3ee810b7b5243c7ff2bbf2f1af0b0fff2a8
train
Trie.get_children
r""" Get the children node names of a node. :param name: Parent node name :type name: :ref:`NodeName` :rtype: list of :ref:`NodeName` :raises: * RuntimeError (Argument \`name\` is not valid) * RuntimeError (Node *[name]* not in tree)
ptrie/ptrie.py
def get_children(self, name): r""" Get the children node names of a node. :param name: Parent node name :type name: :ref:`NodeName` :rtype: list of :ref:`NodeName` :raises: * RuntimeError (Argument \`name\` is not valid) * RuntimeError (Node *[name]...
def get_children(self, name): r""" Get the children node names of a node. :param name: Parent node name :type name: :ref:`NodeName` :rtype: list of :ref:`NodeName` :raises: * RuntimeError (Argument \`name\` is not valid) * RuntimeError (Node *[name]...
[ "r", "Get", "the", "children", "node", "names", "of", "a", "node", "." ]
pmacosta/ptrie
python
https://github.com/pmacosta/ptrie/blob/c176d3ee810b7b5243c7ff2bbf2f1af0b0fff2a8/ptrie/ptrie.py#L809-L826
[ "def", "get_children", "(", "self", ",", "name", ")", ":", "if", "self", ".", "_validate_node_name", "(", "name", ")", ":", "raise", "RuntimeError", "(", "\"Argument `name` is not valid\"", ")", "self", ".", "_node_in_tree", "(", "name", ")", "return", "sorted...
c176d3ee810b7b5243c7ff2bbf2f1af0b0fff2a8
train
Trie.get_data
r""" Get the data associated with a node. :param name: Node name :type name: :ref:`NodeName` :rtype: any type or list of objects of any type :raises: * RuntimeError (Argument \`name\` is not valid) * RuntimeError (Node *[name]* not in tree)
ptrie/ptrie.py
def get_data(self, name): r""" Get the data associated with a node. :param name: Node name :type name: :ref:`NodeName` :rtype: any type or list of objects of any type :raises: * RuntimeError (Argument \`name\` is not valid) * RuntimeError (Node *[na...
def get_data(self, name): r""" Get the data associated with a node. :param name: Node name :type name: :ref:`NodeName` :rtype: any type or list of objects of any type :raises: * RuntimeError (Argument \`name\` is not valid) * RuntimeError (Node *[na...
[ "r", "Get", "the", "data", "associated", "with", "a", "node", "." ]
pmacosta/ptrie
python
https://github.com/pmacosta/ptrie/blob/c176d3ee810b7b5243c7ff2bbf2f1af0b0fff2a8/ptrie/ptrie.py#L828-L845
[ "def", "get_data", "(", "self", ",", "name", ")", ":", "if", "self", ".", "_validate_node_name", "(", "name", ")", ":", "raise", "RuntimeError", "(", "\"Argument `name` is not valid\"", ")", "self", ".", "_node_in_tree", "(", "name", ")", "return", "self", "...
c176d3ee810b7b5243c7ff2bbf2f1af0b0fff2a8
train
Trie.get_leafs
r""" Get the sub-tree leaf node(s). :param name: Sub-tree root node name :type name: :ref:`NodeName` :rtype: list of :ref:`NodeName` :raises: * RuntimeError (Argument \`name\` is not valid) * RuntimeError (Node *[name]* not in tree)
ptrie/ptrie.py
def get_leafs(self, name): r""" Get the sub-tree leaf node(s). :param name: Sub-tree root node name :type name: :ref:`NodeName` :rtype: list of :ref:`NodeName` :raises: * RuntimeError (Argument \`name\` is not valid) * RuntimeError (Node *[name]* no...
def get_leafs(self, name): r""" Get the sub-tree leaf node(s). :param name: Sub-tree root node name :type name: :ref:`NodeName` :rtype: list of :ref:`NodeName` :raises: * RuntimeError (Argument \`name\` is not valid) * RuntimeError (Node *[name]* no...
[ "r", "Get", "the", "sub", "-", "tree", "leaf", "node", "(", "s", ")", "." ]
pmacosta/ptrie
python
https://github.com/pmacosta/ptrie/blob/c176d3ee810b7b5243c7ff2bbf2f1af0b0fff2a8/ptrie/ptrie.py#L847-L864
[ "def", "get_leafs", "(", "self", ",", "name", ")", ":", "if", "self", ".", "_validate_node_name", "(", "name", ")", ":", "raise", "RuntimeError", "(", "\"Argument `name` is not valid\"", ")", "self", ".", "_node_in_tree", "(", "name", ")", "return", "[", "no...
c176d3ee810b7b5243c7ff2bbf2f1af0b0fff2a8
train
Trie.get_node
r""" Get a tree node structure. The structure is a dictionary with the following keys: * **parent** (*NodeName*) Parent node name, :code:`''` if the node is the root node * **children** (*list of NodeName*) Children node names, an empty list if node is a leaf ...
ptrie/ptrie.py
def get_node(self, name): r""" Get a tree node structure. The structure is a dictionary with the following keys: * **parent** (*NodeName*) Parent node name, :code:`''` if the node is the root node * **children** (*list of NodeName*) Children node names, an ...
def get_node(self, name): r""" Get a tree node structure. The structure is a dictionary with the following keys: * **parent** (*NodeName*) Parent node name, :code:`''` if the node is the root node * **children** (*list of NodeName*) Children node names, an ...
[ "r", "Get", "a", "tree", "node", "structure", "." ]
pmacosta/ptrie
python
https://github.com/pmacosta/ptrie/blob/c176d3ee810b7b5243c7ff2bbf2f1af0b0fff2a8/ptrie/ptrie.py#L866-L893
[ "def", "get_node", "(", "self", ",", "name", ")", ":", "if", "self", ".", "_validate_node_name", "(", "name", ")", ":", "raise", "RuntimeError", "(", "\"Argument `name` is not valid\"", ")", "self", ".", "_node_in_tree", "(", "name", ")", "return", "self", "...
c176d3ee810b7b5243c7ff2bbf2f1af0b0fff2a8
train
Trie.get_node_children
r""" Get the list of children structures of a node. See :py:meth:`ptrie.Trie.get_node` for details about the structure :param name: Parent node name :type name: :ref:`NodeName` :rtype: list :raises: * RuntimeError (Argument \`name\` is not valid) *...
ptrie/ptrie.py
def get_node_children(self, name): r""" Get the list of children structures of a node. See :py:meth:`ptrie.Trie.get_node` for details about the structure :param name: Parent node name :type name: :ref:`NodeName` :rtype: list :raises: * RuntimeError (...
def get_node_children(self, name): r""" Get the list of children structures of a node. See :py:meth:`ptrie.Trie.get_node` for details about the structure :param name: Parent node name :type name: :ref:`NodeName` :rtype: list :raises: * RuntimeError (...
[ "r", "Get", "the", "list", "of", "children", "structures", "of", "a", "node", "." ]
pmacosta/ptrie
python
https://github.com/pmacosta/ptrie/blob/c176d3ee810b7b5243c7ff2bbf2f1af0b0fff2a8/ptrie/ptrie.py#L895-L914
[ "def", "get_node_children", "(", "self", ",", "name", ")", ":", "if", "self", ".", "_validate_node_name", "(", "name", ")", ":", "raise", "RuntimeError", "(", "\"Argument `name` is not valid\"", ")", "self", ".", "_node_in_tree", "(", "name", ")", "return", "[...
c176d3ee810b7b5243c7ff2bbf2f1af0b0fff2a8
train
Trie.get_node_parent
r""" Get the parent structure of a node. See :py:meth:`ptrie.Trie.get_node` for details about the structure :param name: Child node name :type name: :ref:`NodeName` :rtype: dictionary :raises: * RuntimeError (Argument \`name\` is not valid) * Runti...
ptrie/ptrie.py
def get_node_parent(self, name): r""" Get the parent structure of a node. See :py:meth:`ptrie.Trie.get_node` for details about the structure :param name: Child node name :type name: :ref:`NodeName` :rtype: dictionary :raises: * RuntimeError (Argument...
def get_node_parent(self, name): r""" Get the parent structure of a node. See :py:meth:`ptrie.Trie.get_node` for details about the structure :param name: Child node name :type name: :ref:`NodeName` :rtype: dictionary :raises: * RuntimeError (Argument...
[ "r", "Get", "the", "parent", "structure", "of", "a", "node", "." ]
pmacosta/ptrie
python
https://github.com/pmacosta/ptrie/blob/c176d3ee810b7b5243c7ff2bbf2f1af0b0fff2a8/ptrie/ptrie.py#L916-L935
[ "def", "get_node_parent", "(", "self", ",", "name", ")", ":", "if", "self", ".", "_validate_node_name", "(", "name", ")", ":", "raise", "RuntimeError", "(", "\"Argument `name` is not valid\"", ")", "self", ".", "_node_in_tree", "(", "name", ")", "return", "sel...
c176d3ee810b7b5243c7ff2bbf2f1af0b0fff2a8
train
Trie.get_subtree
r""" Get all node names in a sub-tree. :param name: Sub-tree root node name :type name: :ref:`NodeName` :rtype: list of :ref:`NodeName` :raises: * RuntimeError (Argument \`name\` is not valid) * RuntimeError (Node *[name]* not in tree) Using the sa...
ptrie/ptrie.py
def get_subtree(self, name): # noqa: D302 r""" Get all node names in a sub-tree. :param name: Sub-tree root node name :type name: :ref:`NodeName` :rtype: list of :ref:`NodeName` :raises: * RuntimeError (Argument \`name\` is not valid) * RuntimeErro...
def get_subtree(self, name): # noqa: D302 r""" Get all node names in a sub-tree. :param name: Sub-tree root node name :type name: :ref:`NodeName` :rtype: list of :ref:`NodeName` :raises: * RuntimeError (Argument \`name\` is not valid) * RuntimeErro...
[ "r", "Get", "all", "node", "names", "in", "a", "sub", "-", "tree", "." ]
pmacosta/ptrie
python
https://github.com/pmacosta/ptrie/blob/c176d3ee810b7b5243c7ff2bbf2f1af0b0fff2a8/ptrie/ptrie.py#L937-L975
[ "def", "get_subtree", "(", "self", ",", "name", ")", ":", "# noqa: D302", "if", "self", ".", "_validate_node_name", "(", "name", ")", ":", "raise", "RuntimeError", "(", "\"Argument `name` is not valid\"", ")", "self", ".", "_node_in_tree", "(", "name", ")", "r...
c176d3ee810b7b5243c7ff2bbf2f1af0b0fff2a8
train
Trie.in_tree
r""" Test if a node is in the tree. :param name: Node name to search for :type name: :ref:`NodeName` :rtype: boolean :raises: RuntimeError (Argument \`name\` is not valid)
ptrie/ptrie.py
def in_tree(self, name): r""" Test if a node is in the tree. :param name: Node name to search for :type name: :ref:`NodeName` :rtype: boolean :raises: RuntimeError (Argument \`name\` is not valid) """ if self._validate_node_name(name): rais...
def in_tree(self, name): r""" Test if a node is in the tree. :param name: Node name to search for :type name: :ref:`NodeName` :rtype: boolean :raises: RuntimeError (Argument \`name\` is not valid) """ if self._validate_node_name(name): rais...
[ "r", "Test", "if", "a", "node", "is", "in", "the", "tree", "." ]
pmacosta/ptrie
python
https://github.com/pmacosta/ptrie/blob/c176d3ee810b7b5243c7ff2bbf2f1af0b0fff2a8/ptrie/ptrie.py#L996-L1009
[ "def", "in_tree", "(", "self", ",", "name", ")", ":", "if", "self", ".", "_validate_node_name", "(", "name", ")", ":", "raise", "RuntimeError", "(", "\"Argument `name` is not valid\"", ")", "return", "name", "in", "self", ".", "_db" ]
c176d3ee810b7b5243c7ff2bbf2f1af0b0fff2a8
train
Trie.is_leaf
r""" Test if a node is a leaf node (node with no children). :param name: Node name :type name: :ref:`NodeName` :rtype: boolean :raises: * RuntimeError (Argument \`name\` is not valid) * RuntimeError (Node *[name]* not in tree)
ptrie/ptrie.py
def is_leaf(self, name): r""" Test if a node is a leaf node (node with no children). :param name: Node name :type name: :ref:`NodeName` :rtype: boolean :raises: * RuntimeError (Argument \`name\` is not valid) * RuntimeError (Node *[name]* not in tre...
def is_leaf(self, name): r""" Test if a node is a leaf node (node with no children). :param name: Node name :type name: :ref:`NodeName` :rtype: boolean :raises: * RuntimeError (Argument \`name\` is not valid) * RuntimeError (Node *[name]* not in tre...
[ "r", "Test", "if", "a", "node", "is", "a", "leaf", "node", "(", "node", "with", "no", "children", ")", "." ]
pmacosta/ptrie
python
https://github.com/pmacosta/ptrie/blob/c176d3ee810b7b5243c7ff2bbf2f1af0b0fff2a8/ptrie/ptrie.py#L1011-L1028
[ "def", "is_leaf", "(", "self", ",", "name", ")", ":", "if", "self", ".", "_validate_node_name", "(", "name", ")", ":", "raise", "RuntimeError", "(", "\"Argument `name` is not valid\"", ")", "self", ".", "_node_in_tree", "(", "name", ")", "return", "not", "se...
c176d3ee810b7b5243c7ff2bbf2f1af0b0fff2a8
train
Trie.make_root
r""" Make a sub-node the root node of the tree. All nodes not belonging to the sub-tree are deleted :param name: New root node name :type name: :ref:`NodeName` :raises: * RuntimeError (Argument \`name\` is not valid) * RuntimeError (Node *[name]* not in tre...
ptrie/ptrie.py
def make_root(self, name): # noqa: D302 r""" Make a sub-node the root node of the tree. All nodes not belonging to the sub-tree are deleted :param name: New root node name :type name: :ref:`NodeName` :raises: * RuntimeError (Argument \`name\` is not valid) ...
def make_root(self, name): # noqa: D302 r""" Make a sub-node the root node of the tree. All nodes not belonging to the sub-tree are deleted :param name: New root node name :type name: :ref:`NodeName` :raises: * RuntimeError (Argument \`name\` is not valid) ...
[ "r", "Make", "a", "sub", "-", "node", "the", "root", "node", "of", "the", "tree", "." ]
pmacosta/ptrie
python
https://github.com/pmacosta/ptrie/blob/c176d3ee810b7b5243c7ff2bbf2f1af0b0fff2a8/ptrie/ptrie.py#L1030-L1075
[ "def", "make_root", "(", "self", ",", "name", ")", ":", "# noqa: D302", "if", "self", ".", "_validate_node_name", "(", "name", ")", ":", "raise", "RuntimeError", "(", "\"Argument `name` is not valid\"", ")", "if", "(", "name", "!=", "self", ".", "root_name", ...
c176d3ee810b7b5243c7ff2bbf2f1af0b0fff2a8
train
Trie.print_node
r""" Print node information (parent, children and data). :param name: Node name :type name: :ref:`NodeName` :raises: * RuntimeError (Argument \`name\` is not valid) * RuntimeError (Node *[name]* not in tree) Using the same example tree created in :p...
ptrie/ptrie.py
def print_node(self, name): # noqa: D302 r""" Print node information (parent, children and data). :param name: Node name :type name: :ref:`NodeName` :raises: * RuntimeError (Argument \`name\` is not valid) * RuntimeError (Node *[name]* not in tree) ...
def print_node(self, name): # noqa: D302 r""" Print node information (parent, children and data). :param name: Node name :type name: :ref:`NodeName` :raises: * RuntimeError (Argument \`name\` is not valid) * RuntimeError (Node *[name]* not in tree) ...
[ "r", "Print", "node", "information", "(", "parent", "children", "and", "data", ")", "." ]
pmacosta/ptrie
python
https://github.com/pmacosta/ptrie/blob/c176d3ee810b7b5243c7ff2bbf2f1af0b0fff2a8/ptrie/ptrie.py#L1077-L1133
[ "def", "print_node", "(", "self", ",", "name", ")", ":", "# noqa: D302", "if", "self", ".", "_validate_node_name", "(", "name", ")", ":", "raise", "RuntimeError", "(", "\"Argument `name` is not valid\"", ")", "self", ".", "_node_in_tree", "(", "name", ")", "no...
c176d3ee810b7b5243c7ff2bbf2f1af0b0fff2a8
train
Trie.rename_node
r""" Rename a tree node. It is typical to have a root node name with more than one hierarchy level after using :py:meth:`ptrie.Trie.make_root`. In this instance the root node *can* be renamed as long as the new root name has the same or less hierarchy levels as the existing root...
ptrie/ptrie.py
def rename_node(self, name, new_name): # noqa: D302 r""" Rename a tree node. It is typical to have a root node name with more than one hierarchy level after using :py:meth:`ptrie.Trie.make_root`. In this instance the root node *can* be renamed as long as the new root name has t...
def rename_node(self, name, new_name): # noqa: D302 r""" Rename a tree node. It is typical to have a root node name with more than one hierarchy level after using :py:meth:`ptrie.Trie.make_root`. In this instance the root node *can* be renamed as long as the new root name has t...
[ "r", "Rename", "a", "tree", "node", "." ]
pmacosta/ptrie
python
https://github.com/pmacosta/ptrie/blob/c176d3ee810b7b5243c7ff2bbf2f1af0b0fff2a8/ptrie/ptrie.py#L1135-L1203
[ "def", "rename_node", "(", "self", ",", "name", ",", "new_name", ")", ":", "# noqa: D302", "if", "self", ".", "_validate_node_name", "(", "name", ")", ":", "raise", "RuntimeError", "(", "\"Argument `name` is not valid\"", ")", "if", "self", ".", "_validate_node_...
c176d3ee810b7b5243c7ff2bbf2f1af0b0fff2a8
train
Trie.search_tree
r""" Search tree for all nodes with a specific name. :param name: Node name to search for :type name: :ref:`NodeName` :raises: RuntimeError (Argument \`name\` is not valid) For example: >>> from __future__ import print_function >>> import pprint, ptri...
ptrie/ptrie.py
def search_tree(self, name): # noqa: D302 r""" Search tree for all nodes with a specific name. :param name: Node name to search for :type name: :ref:`NodeName` :raises: RuntimeError (Argument \`name\` is not valid) For example: >>> from __future__ import...
def search_tree(self, name): # noqa: D302 r""" Search tree for all nodes with a specific name. :param name: Node name to search for :type name: :ref:`NodeName` :raises: RuntimeError (Argument \`name\` is not valid) For example: >>> from __future__ import...
[ "r", "Search", "tree", "for", "all", "nodes", "with", "a", "specific", "name", "." ]
pmacosta/ptrie
python
https://github.com/pmacosta/ptrie/blob/c176d3ee810b7b5243c7ff2bbf2f1af0b0fff2a8/ptrie/ptrie.py#L1205-L1243
[ "def", "search_tree", "(", "self", ",", "name", ")", ":", "# noqa: D302", "if", "self", ".", "_validate_node_name", "(", "name", ")", ":", "raise", "RuntimeError", "(", "\"Argument `name` is not valid\"", ")", "return", "self", ".", "_search_tree", "(", "name", ...
c176d3ee810b7b5243c7ff2bbf2f1af0b0fff2a8
train
find_root
Find base directory (root) for a filename. Parameters ---------- filename : instance of Path search the root for this file target: str 'bids' (the directory containing 'participants.tsv'), 'subject' (the directory starting with 'sub-'), 'session' (the directory starting with ...
bidso/find.py
def find_root(filename, target='bids'): """Find base directory (root) for a filename. Parameters ---------- filename : instance of Path search the root for this file target: str 'bids' (the directory containing 'participants.tsv'), 'subject' (the directory starting with 'sub...
def find_root(filename, target='bids'): """Find base directory (root) for a filename. Parameters ---------- filename : instance of Path search the root for this file target: str 'bids' (the directory containing 'participants.tsv'), 'subject' (the directory starting with 'sub...
[ "Find", "base", "directory", "(", "root", ")", "for", "a", "filename", "." ]
gpiantoni/bidso
python
https://github.com/gpiantoni/bidso/blob/af163b921ec4e3d70802de07f174de184491cfce/bidso/find.py#L8-L33
[ "def", "find_root", "(", "filename", ",", "target", "=", "'bids'", ")", ":", "lg", ".", "debug", "(", "f'Searching root in {filename}'", ")", "if", "target", "==", "'bids'", "and", "(", "filename", "/", "'dataset_description.json'", ")", ".", "exists", "(", ...
af163b921ec4e3d70802de07f174de184491cfce
train
find_in_bids
Find nearest file matching some criteria. Parameters ---------- filename : instance of Path search the root for this file pattern : str glob string for search criteria of the filename of interest (remember to include '*'). The pattern is passed directly to rglob. wildcard : ...
bidso/find.py
def find_in_bids(filename, pattern=None, generator=False, upwards=False, wildcard=True, **kwargs): """Find nearest file matching some criteria. Parameters ---------- filename : instance of Path search the root for this file pattern : str glob string for search crite...
def find_in_bids(filename, pattern=None, generator=False, upwards=False, wildcard=True, **kwargs): """Find nearest file matching some criteria. Parameters ---------- filename : instance of Path search the root for this file pattern : str glob string for search crite...
[ "Find", "nearest", "file", "matching", "some", "criteria", "." ]
gpiantoni/bidso
python
https://github.com/gpiantoni/bidso/blob/af163b921ec4e3d70802de07f174de184491cfce/bidso/find.py#L36-L86
[ "def", "find_in_bids", "(", "filename", ",", "pattern", "=", "None", ",", "generator", "=", "False", ",", "upwards", "=", "False", ",", "wildcard", "=", "True", ",", "*", "*", "kwargs", ")", ":", "if", "upwards", "and", "generator", ":", "raise", "Valu...
af163b921ec4e3d70802de07f174de184491cfce
train
Fig_Conf.define_format
Seaborn color blind #0072B2 dark blue #009E73 green #D55E00 orangish #CC79A7 pink #F0E442 yellow #56B4E9 cyan #bcbd22 olive #adicional #7f7f7f grey #FFB5B8 skin
bin/lib/Plotting_Libraries/dazer_plotter.py
def define_format(self, plotStyle, plotSize): #Default sizes for computer sizing_dict = {} sizing_dict['figure.figsize'] = (14, 8) sizing_dict['legend.fontsize'] = 15 sizing_dict['axes.labelsize'] = 20 sizing_dict['axes.titlesize'] = 24 sizing_dict['xtick.labelsi...
def define_format(self, plotStyle, plotSize): #Default sizes for computer sizing_dict = {} sizing_dict['figure.figsize'] = (14, 8) sizing_dict['legend.fontsize'] = 15 sizing_dict['axes.labelsize'] = 20 sizing_dict['axes.titlesize'] = 24 sizing_dict['xtick.labelsi...
[ "Seaborn", "color", "blind", "#0072B2", "dark", "blue", "#009E73", "green", "#D55E00", "orangish", "#CC79A7", "pink", "#F0E442", "yellow", "#56B4E9", "cyan", "#bcbd22", "olive", "#adicional", "#7f7f7f", "grey", "#FFB5B8", "skin" ]
Vital-Fernandez/dazer
python
https://github.com/Vital-Fernandez/dazer/blob/3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244/bin/lib/Plotting_Libraries/dazer_plotter.py#L42-L163
[ "def", "define_format", "(", "self", ",", "plotStyle", ",", "plotSize", ")", ":", "#Default sizes for computer", "sizing_dict", "=", "{", "}", "sizing_dict", "[", "'figure.figsize'", "]", "=", "(", "14", ",", "8", ")", "sizing_dict", "[", "'legend.fontsize'", ...
3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244
train
Electrodes.get_xyz
Get xyz coordinates for these electrodes Parameters ---------- list_of_names : list of str list of electrode names to use Returns ------- list of tuples of 3 floats (x, y, z) list of xyz coordinates for all the electrodes TODO --...
bidso/objects.py
def get_xyz(self, list_of_names=None): """Get xyz coordinates for these electrodes Parameters ---------- list_of_names : list of str list of electrode names to use Returns ------- list of tuples of 3 floats (x, y, z) list of xyz coordinat...
def get_xyz(self, list_of_names=None): """Get xyz coordinates for these electrodes Parameters ---------- list_of_names : list of str list of electrode names to use Returns ------- list of tuples of 3 floats (x, y, z) list of xyz coordinat...
[ "Get", "xyz", "coordinates", "for", "these", "electrodes" ]
gpiantoni/bidso
python
https://github.com/gpiantoni/bidso/blob/af163b921ec4e3d70802de07f174de184491cfce/bidso/objects.py#L12-L37
[ "def", "get_xyz", "(", "self", ",", "list_of_names", "=", "None", ")", ":", "if", "list_of_names", "is", "not", "None", ":", "filter_lambda", "=", "lambda", "x", ":", "x", "[", "'name'", "]", "in", "list_of_names", "else", ":", "filter_lambda", "=", "Non...
af163b921ec4e3d70802de07f174de184491cfce
train
bces
Does the entire regression calculation for 4 slopes: OLS(Y|X), OLS(X|Y), bisector, orthogonal. Fitting form: Y=AX+B. Usage: >>> a,b,aerr,berr,covab=bces(x,xerr,y,yerr,cov) Output: - a,b : best-fit parameters a,b of the linear regression - aerr,berr : the standard deviations in a,b - covab : the covariance between ...
bin/lib/Math_Libraries/bces_script.py
def bces(y1,y1err,y2,y2err,cerr): """ Does the entire regression calculation for 4 slopes: OLS(Y|X), OLS(X|Y), bisector, orthogonal. Fitting form: Y=AX+B. Usage: >>> a,b,aerr,berr,covab=bces(x,xerr,y,yerr,cov) Output: - a,b : best-fit parameters a,b of the linear regression - aerr,berr : the standard deviations i...
def bces(y1,y1err,y2,y2err,cerr): """ Does the entire regression calculation for 4 slopes: OLS(Y|X), OLS(X|Y), bisector, orthogonal. Fitting form: Y=AX+B. Usage: >>> a,b,aerr,berr,covab=bces(x,xerr,y,yerr,cov) Output: - a,b : best-fit parameters a,b of the linear regression - aerr,berr : the standard deviations i...
[ "Does", "the", "entire", "regression", "calculation", "for", "4", "slopes", ":", "OLS", "(", "Y|X", ")", "OLS", "(", "X|Y", ")", "bisector", "orthogonal", ".", "Fitting", "form", ":", "Y", "=", "AX", "+", "B", "." ]
Vital-Fernandez/dazer
python
https://github.com/Vital-Fernandez/dazer/blob/3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244/bin/lib/Math_Libraries/bces_script.py#L6-L79
[ "def", "bces", "(", "y1", ",", "y1err", ",", "y2", ",", "y2err", ",", "cerr", ")", ":", "# Arrays holding the code main results for each method:", "# Elements: 0-Y|X, 1-X|Y, 2-bisector, 3-orthogonal", "a", ",", "b", ",", "avar", ",", "bvar", ",", "covarxiz", ",", ...
3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244
train
bootstrap
Constructs Monte Carlo simulated data set using the Bootstrap algorithm. Usage: >>> bootstrap(x) where x is either an array or a list of arrays. If it is a list, the code returns the corresponding list of bootstrapped arrays assuming...
bin/lib/Math_Libraries/bces_script.py
def bootstrap(v): """ Constructs Monte Carlo simulated data set using the Bootstrap algorithm. Usage: >>> bootstrap(x) where x is either an array or a list of arrays. If it is a list, the code returns the corresponding list of bootst...
def bootstrap(v): """ Constructs Monte Carlo simulated data set using the Bootstrap algorithm. Usage: >>> bootstrap(x) where x is either an array or a list of arrays. If it is a list, the code returns the corresponding list of bootst...
[ "Constructs", "Monte", "Carlo", "simulated", "data", "set", "using", "the", "Bootstrap", "algorithm", "." ]
Vital-Fernandez/dazer
python
https://github.com/Vital-Fernandez/dazer/blob/3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244/bin/lib/Math_Libraries/bces_script.py#L81-L107
[ "def", "bootstrap", "(", "v", ")", ":", "if", "type", "(", "v", ")", "==", "list", ":", "vboot", "=", "[", "]", "# list of boostrapped arrays", "n", "=", "v", "[", "0", "]", ".", "size", "iran", "=", "scipy", ".", "random", ".", "randint", "(", "...
3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244
train
bcesboot
Does the BCES with bootstrapping. Usage: >>> a,b,aerr,berr,covab=bcesboot(x,xerr,y,yerr,cov,nsim) :param x,y: data :param xerr,yerr: measurement errors affecting x and y :param cov: covariance between the measurement errors (all are arrays) :param nsim: number of Monte Carlo simulations (bootstraps) :re...
bin/lib/Math_Libraries/bces_script.py
def bcesboot(y1,y1err,y2,y2err,cerr,nsim=10000): """ Does the BCES with bootstrapping. Usage: >>> a,b,aerr,berr,covab=bcesboot(x,xerr,y,yerr,cov,nsim) :param x,y: data :param xerr,yerr: measurement errors affecting x and y :param cov: covariance between the measurement errors (all are arrays) :param ns...
def bcesboot(y1,y1err,y2,y2err,cerr,nsim=10000): """ Does the BCES with bootstrapping. Usage: >>> a,b,aerr,berr,covab=bcesboot(x,xerr,y,yerr,cov,nsim) :param x,y: data :param xerr,yerr: measurement errors affecting x and y :param cov: covariance between the measurement errors (all are arrays) :param ns...
[ "Does", "the", "BCES", "with", "bootstrapping", ".", "Usage", ":", ">>>", "a", "b", "aerr", "berr", "covab", "=", "bcesboot", "(", "x", "xerr", "y", "yerr", "cov", "nsim", ")", ":", "param", "x", "y", ":", "data", ":", "param", "xerr", "yerr", ":",...
Vital-Fernandez/dazer
python
https://github.com/Vital-Fernandez/dazer/blob/3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244/bin/lib/Math_Libraries/bces_script.py#L109-L171
[ "def", "bcesboot", "(", "y1", ",", "y1err", ",", "y2", ",", "y2err", ",", "cerr", ",", "nsim", "=", "10000", ")", ":", "# Progress bar initialization", "\"\"\"\n\tMy convention for storing the results of the bces code below as \n\tmatrixes for processing later are as follow:\n\...
3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244
train
bcesboot_backup
Does the BCES with bootstrapping. Usage: >>> a,b,aerr,berr,covab=bcesboot(x,xerr,y,yerr,cov,nsim) :param x,y: data :param xerr,yerr: measurement errors affecting x and y :param cov: covariance between the measurement errors (all are arrays) :param nsim: number of Monte Carlo simulations (bootstraps) :returns: a,b ...
bin/lib/Math_Libraries/bces_script.py
def bcesboot_backup(y1,y1err,y2,y2err,cerr,nsim=10000): """ Does the BCES with bootstrapping. Usage: >>> a,b,aerr,berr,covab=bcesboot(x,xerr,y,yerr,cov,nsim) :param x,y: data :param xerr,yerr: measurement errors affecting x and y :param cov: covariance between the measurement errors (all are arrays) :param nsim: n...
def bcesboot_backup(y1,y1err,y2,y2err,cerr,nsim=10000): """ Does the BCES with bootstrapping. Usage: >>> a,b,aerr,berr,covab=bcesboot(x,xerr,y,yerr,cov,nsim) :param x,y: data :param xerr,yerr: measurement errors affecting x and y :param cov: covariance between the measurement errors (all are arrays) :param nsim: n...
[ "Does", "the", "BCES", "with", "bootstrapping", "." ]
Vital-Fernandez/dazer
python
https://github.com/Vital-Fernandez/dazer/blob/3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244/bin/lib/Math_Libraries/bces_script.py#L173-L237
[ "def", "bcesboot_backup", "(", "y1", ",", "y1err", ",", "y2", ",", "y2err", ",", "cerr", ",", "nsim", "=", "10000", ")", ":", "import", "fish", "# Progress bar initialization", "peixe", "=", "fish", ".", "ProgressFish", "(", "total", "=", "nsim", ")", "p...
3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244
train
ab
This method is the big bottleneck of the parallel BCES code. That's the reason why I put these calculations in a separate method, in order to distribute this among the cores. In the original BCES method, this is inside the main routine. Argument: [y1,y1err,y2,y2err,cerr,nsim] where nsim is the number of bootstrapp...
bin/lib/Math_Libraries/bces_script.py
def ab(x): """ This method is the big bottleneck of the parallel BCES code. That's the reason why I put these calculations in a separate method, in order to distribute this among the cores. In the original BCES method, this is inside the main routine. Argument: [y1,y1err,y2,y2err,cerr,nsim] where nsim is the numb...
def ab(x): """ This method is the big bottleneck of the parallel BCES code. That's the reason why I put these calculations in a separate method, in order to distribute this among the cores. In the original BCES method, this is inside the main routine. Argument: [y1,y1err,y2,y2err,cerr,nsim] where nsim is the numb...
[ "This", "method", "is", "the", "big", "bottleneck", "of", "the", "parallel", "BCES", "code", ".", "That", "s", "the", "reason", "why", "I", "put", "these", "calculations", "in", "a", "separate", "method", "in", "order", "to", "distribute", "this", "among",...
Vital-Fernandez/dazer
python
https://github.com/Vital-Fernandez/dazer/blob/3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244/bin/lib/Math_Libraries/bces_script.py#L242-L274
[ "def", "ab", "(", "x", ")", ":", "y1", ",", "y1err", ",", "y2", ",", "y2err", ",", "cerr", ",", "nsim", "=", "x", "[", "0", "]", ",", "x", "[", "1", "]", ",", "x", "[", "2", "]", ",", "x", "[", "3", "]", ",", "x", "[", "4", "]", ","...
3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244
train
bcesp
Parallel implementation of the BCES with bootstrapping. Divide the bootstraps equally among the threads (cores) of the machine. It will automatically detect the number of cores available. Usage: >>> a,b,aerr,berr,covab=bcesp(x,xerr,y,yerr,cov,nsim) :param x,y: data :param xerr,yerr: measurement errors affecting x an...
bin/lib/Math_Libraries/bces_script.py
def bcesp(y1,y1err,y2,y2err,cerr,nsim=10000): """ Parallel implementation of the BCES with bootstrapping. Divide the bootstraps equally among the threads (cores) of the machine. It will automatically detect the number of cores available. Usage: >>> a,b,aerr,berr,covab=bcesp(x,xerr,y,yerr,cov,nsim) :param x,y: data ...
def bcesp(y1,y1err,y2,y2err,cerr,nsim=10000): """ Parallel implementation of the BCES with bootstrapping. Divide the bootstraps equally among the threads (cores) of the machine. It will automatically detect the number of cores available. Usage: >>> a,b,aerr,berr,covab=bcesp(x,xerr,y,yerr,cov,nsim) :param x,y: data ...
[ "Parallel", "implementation", "of", "the", "BCES", "with", "bootstrapping", ".", "Divide", "the", "bootstraps", "equally", "among", "the", "threads", "(", "cores", ")", "of", "the", "machine", ".", "It", "will", "automatically", "detect", "the", "number", "of"...
Vital-Fernandez/dazer
python
https://github.com/Vital-Fernandez/dazer/blob/3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244/bin/lib/Math_Libraries/bces_script.py#L276-L361
[ "def", "bcesp", "(", "y1", ",", "y1err", ",", "y2", ",", "y2err", ",", "cerr", ",", "nsim", "=", "10000", ")", ":", "import", "time", "# for benchmarking", "import", "multiprocessing", "print", "\"BCES,\"", ",", "nsim", ",", "\"trials... \"", ",", "tic", ...
3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244
train
mean
Return the sample arithmetic mean of data.
vital/debug/stats.py
def mean(data): """Return the sample arithmetic mean of data.""" #: http://stackoverflow.com/a/27758326 n = len(data) if n < 1: raise ValueError('mean requires at least one data point') return sum(data)/n
def mean(data): """Return the sample arithmetic mean of data.""" #: http://stackoverflow.com/a/27758326 n = len(data) if n < 1: raise ValueError('mean requires at least one data point') return sum(data)/n
[ "Return", "the", "sample", "arithmetic", "mean", "of", "data", "." ]
jaredLunde/vital-tools
python
https://github.com/jaredLunde/vital-tools/blob/ea924c9bbb6ec22aa66f8095f018b1ee0099ac04/vital/debug/stats.py#L19-L25
[ "def", "mean", "(", "data", ")", ":", "#: http://stackoverflow.com/a/27758326", "n", "=", "len", "(", "data", ")", "if", "n", "<", "1", ":", "raise", "ValueError", "(", "'mean requires at least one data point'", ")", "return", "sum", "(", "data", ")", "/", "...
ea924c9bbb6ec22aa66f8095f018b1ee0099ac04
train
pstdev
Calculates the population standard deviation.
vital/debug/stats.py
def pstdev(data): """Calculates the population standard deviation.""" #: http://stackoverflow.com/a/27758326 n = len(data) if n < 2: raise ValueError('variance requires at least two data points') ss = _ss(data) pvar = ss/n # the population variance return pvar**0.5
def pstdev(data): """Calculates the population standard deviation.""" #: http://stackoverflow.com/a/27758326 n = len(data) if n < 2: raise ValueError('variance requires at least two data points') ss = _ss(data) pvar = ss/n # the population variance return pvar**0.5
[ "Calculates", "the", "population", "standard", "deviation", "." ]
jaredLunde/vital-tools
python
https://github.com/jaredLunde/vital-tools/blob/ea924c9bbb6ec22aa66f8095f018b1ee0099ac04/vital/debug/stats.py#L36-L44
[ "def", "pstdev", "(", "data", ")", ":", "#: http://stackoverflow.com/a/27758326", "n", "=", "len", "(", "data", ")", "if", "n", "<", "2", ":", "raise", "ValueError", "(", "'variance requires at least two data points'", ")", "ss", "=", "_ss", "(", "data", ")", ...
ea924c9bbb6ec22aa66f8095f018b1ee0099ac04
train
median
Calcuates the median value in a @lst
vital/debug/stats.py
def median(lst): """ Calcuates the median value in a @lst """ #: http://stackoverflow.com/a/24101534 sortedLst = sorted(lst) lstLen = len(lst) index = (lstLen - 1) // 2 if (lstLen % 2): return sortedLst[index] else: return (sortedLst[index] + sortedLst[index + 1])/2.0
def median(lst): """ Calcuates the median value in a @lst """ #: http://stackoverflow.com/a/24101534 sortedLst = sorted(lst) lstLen = len(lst) index = (lstLen - 1) // 2 if (lstLen % 2): return sortedLst[index] else: return (sortedLst[index] + sortedLst[index + 1])/2.0
[ "Calcuates", "the", "median", "value", "in", "a" ]
jaredLunde/vital-tools
python
https://github.com/jaredLunde/vital-tools/blob/ea924c9bbb6ec22aa66f8095f018b1ee0099ac04/vital/debug/stats.py#L47-L56
[ "def", "median", "(", "lst", ")", ":", "#: http://stackoverflow.com/a/24101534", "sortedLst", "=", "sorted", "(", "lst", ")", "lstLen", "=", "len", "(", "lst", ")", "index", "=", "(", "lstLen", "-", "1", ")", "//", "2", "if", "(", "lstLen", "%", "2", ...
ea924c9bbb6ec22aa66f8095f018b1ee0099ac04
train
send_email
:param recipients: List of recipients; or single email (str); or comma-separated email list (str); or list of name-email pairs (e.g. settings.ADMINS) :param subject: Subject of the email :param text: Body (text) :param html: Body (html) :param sender: Sender email, or settings.DEFAULT_FROM_EMAIL if miss...
jutil/email.py
def send_email(recipients: list, subject: str, text: str, html: str='', sender: str='', files: list=[], exceptions: bool=False): """ :param recipients: List of recipients; or single email (str); or comma-separated email list (str); or list of name-email pairs (e.g. settings.ADMINS) :param subject: Subject o...
def send_email(recipients: list, subject: str, text: str, html: str='', sender: str='', files: list=[], exceptions: bool=False): """ :param recipients: List of recipients; or single email (str); or comma-separated email list (str); or list of name-email pairs (e.g. settings.ADMINS) :param subject: Subject o...
[ ":", "param", "recipients", ":", "List", "of", "recipients", ";", "or", "single", "email", "(", "str", ")", ";", "or", "comma", "-", "separated", "email", "list", "(", "str", ")", ";", "or", "list", "of", "name", "-", "email", "pairs", "(", "e", "....
kajala/django-jutil
python
https://github.com/kajala/django-jutil/blob/2abd93ebad51042744eaeb1ee1074ed0eb55ad0c/jutil/email.py#L7-L90
[ "def", "send_email", "(", "recipients", ":", "list", ",", "subject", ":", "str", ",", "text", ":", "str", ",", "html", ":", "str", "=", "''", ",", "sender", ":", "str", "=", "''", ",", "files", ":", "list", "=", "[", "]", ",", "exceptions", ":", ...
2abd93ebad51042744eaeb1ee1074ed0eb55ad0c
train
remove_whitespace
Unsafely attempts to remove HTML whitespace. This is not an HTML parser which is why its considered 'unsafe', but it should work for most implementations. Just use on at your own risk. @s: #str -> HTML with whitespace removed, ignoring <pre>, script, textarea and code tags
vital/tools/html.py
def remove_whitespace(s): """ Unsafely attempts to remove HTML whitespace. This is not an HTML parser which is why its considered 'unsafe', but it should work for most implementations. Just use on at your own risk. @s: #str -> HTML with whitespace removed, ignoring <pre>, script, t...
def remove_whitespace(s): """ Unsafely attempts to remove HTML whitespace. This is not an HTML parser which is why its considered 'unsafe', but it should work for most implementations. Just use on at your own risk. @s: #str -> HTML with whitespace removed, ignoring <pre>, script, t...
[ "Unsafely", "attempts", "to", "remove", "HTML", "whitespace", ".", "This", "is", "not", "an", "HTML", "parser", "which", "is", "why", "its", "considered", "unsafe", "but", "it", "should", "work", "for", "most", "implementations", ".", "Just", "use", "on", ...
jaredLunde/vital-tools
python
https://github.com/jaredLunde/vital-tools/blob/ea924c9bbb6ec22aa66f8095f018b1ee0099ac04/vital/tools/html.py#L38-L56
[ "def", "remove_whitespace", "(", "s", ")", ":", "ignores", "=", "{", "}", "for", "ignore", "in", "html_ignore_whitespace_re", ".", "finditer", "(", "s", ")", ":", "name", "=", "\"{}{}{}\"", ".", "format", "(", "r\"{}\"", ",", "uuid", ".", "uuid4", "(", ...
ea924c9bbb6ec22aa66f8095f018b1ee0099ac04
train
hashtag_links
Turns hashtag-like strings into HTML links @uri: /uri/ root for the hashtag-like @s: the #str string you're looking for |#|hashtags in -> #str HTML link |<a href="/uri/hashtag">hashtag</a>|
vital/tools/html.py
def hashtag_links(uri, s): """ Turns hashtag-like strings into HTML links @uri: /uri/ root for the hashtag-like @s: the #str string you're looking for |#|hashtags in -> #str HTML link |<a href="/uri/hashtag">hashtag</a>| """ for tag, after in hashtag_re.findall(s): _uri = '...
def hashtag_links(uri, s): """ Turns hashtag-like strings into HTML links @uri: /uri/ root for the hashtag-like @s: the #str string you're looking for |#|hashtags in -> #str HTML link |<a href="/uri/hashtag">hashtag</a>| """ for tag, after in hashtag_re.findall(s): _uri = '...
[ "Turns", "hashtag", "-", "like", "strings", "into", "HTML", "links" ]
jaredLunde/vital-tools
python
https://github.com/jaredLunde/vital-tools/blob/ea924c9bbb6ec22aa66f8095f018b1ee0099ac04/vital/tools/html.py#L59-L71
[ "def", "hashtag_links", "(", "uri", ",", "s", ")", ":", "for", "tag", ",", "after", "in", "hashtag_re", ".", "findall", "(", "s", ")", ":", "_uri", "=", "'/'", "+", "(", "uri", "or", "\"\"", ")", ".", "lstrip", "(", "\"/\"", ")", "+", "quote", ...
ea924c9bbb6ec22aa66f8095f018b1ee0099ac04
train
mentions_links
Turns mentions-like strings into HTML links, @uri: /uri/ root for the hashtag-like @s: the #str string you're looking for |@|mentions in -> #str HTML link |<a href="/uri/mention">mention</a>|
vital/tools/html.py
def mentions_links(uri, s): """ Turns mentions-like strings into HTML links, @uri: /uri/ root for the hashtag-like @s: the #str string you're looking for |@|mentions in -> #str HTML link |<a href="/uri/mention">mention</a>| """ for username, after in mentions_re.findall(s): ...
def mentions_links(uri, s): """ Turns mentions-like strings into HTML links, @uri: /uri/ root for the hashtag-like @s: the #str string you're looking for |@|mentions in -> #str HTML link |<a href="/uri/mention">mention</a>| """ for username, after in mentions_re.findall(s): ...
[ "Turns", "mentions", "-", "like", "strings", "into", "HTML", "links", "@uri", ":", "/", "uri", "/", "root", "for", "the", "hashtag", "-", "like", "@s", ":", "the", "#str", "string", "you", "re", "looking", "for", "|@|mentions", "in" ]
jaredLunde/vital-tools
python
https://github.com/jaredLunde/vital-tools/blob/ea924c9bbb6ec22aa66f8095f018b1ee0099ac04/vital/tools/html.py#L74-L85
[ "def", "mentions_links", "(", "uri", ",", "s", ")", ":", "for", "username", ",", "after", "in", "mentions_re", ".", "findall", "(", "s", ")", ":", "_uri", "=", "'/'", "+", "(", "uri", "or", "\"\"", ")", ".", "lstrip", "(", "\"/\"", ")", "+", "quo...
ea924c9bbb6ec22aa66f8095f018b1ee0099ac04
train
SqlaFilterTree.filter
Return a new filtered query. Use the tree to filter the query and return a new query "filtered". This query can be filtered again using another tree or even a manual filter. To manually filter query see : - https://docs.sqlalchemy.org/en/rel_1_2/orm/query.html?highlight...
src/sqla_filters/tree/tree.py
def filter(self, query: Query): """Return a new filtered query. Use the tree to filter the query and return a new query "filtered". This query can be filtered again using another tree or even a manual filter. To manually filter query see : - https://docs.sqlalch...
def filter(self, query: Query): """Return a new filtered query. Use the tree to filter the query and return a new query "filtered". This query can be filtered again using another tree or even a manual filter. To manually filter query see : - https://docs.sqlalch...
[ "Return", "a", "new", "filtered", "query", ".", "Use", "the", "tree", "to", "filter", "the", "query", "and", "return", "a", "new", "query", "filtered", ".", "This", "query", "can", "be", "filtered", "again", "using", "another", "tree", "or", "even", "a",...
MarcAureleCoste/sqla-filters
python
https://github.com/MarcAureleCoste/sqla-filters/blob/a9596f660a11d275bf0e831ecd9e502b0af2a087/src/sqla_filters/tree/tree.py#L26-L37
[ "def", "filter", "(", "self", ",", "query", ":", "Query", ")", ":", "entity", "=", "query", ".", "column_descriptions", "[", "0", "]", "[", "'type'", "]", "new_query", ",", "filters", "=", "self", ".", "_root", ".", "filter", "(", "query", ",", "enti...
a9596f660a11d275bf0e831ecd9e502b0af2a087
train
print_progress_bar
Call in a loop to create terminal progress bar @params: iteration - Required : current iteration (Int) total - Required : total iterations (Int) prefix - Optional : prefix string (Str) suffix - Optional : suffix string (Str) decimals - Optional : pos...
pyzure/send/common.py
def print_progress_bar(iteration, total, prefix='', suffix='', decimals=1, length=100, fill='█'): """ Call in a loop to create terminal progress bar @params: iteration - Required : current iteration (Int) total - Required : total iterations (Int) prefix - Optional : p...
def print_progress_bar(iteration, total, prefix='', suffix='', decimals=1, length=100, fill='█'): """ Call in a loop to create terminal progress bar @params: iteration - Required : current iteration (Int) total - Required : total iterations (Int) prefix - Optional : p...
[ "Call", "in", "a", "loop", "to", "create", "terminal", "progress", "bar" ]
dacker-team/pyzure
python
https://github.com/dacker-team/pyzure/blob/1e6d202f91ca0f080635adc470d9d18585056d53/pyzure/send/common.py#L77-L96
[ "def", "print_progress_bar", "(", "iteration", ",", "total", ",", "prefix", "=", "''", ",", "suffix", "=", "''", ",", "decimals", "=", "1", ",", "length", "=", "100", ",", "fill", "=", "'█'):", "", "", "percent", "=", "(", "\"{0:.\"", "+", "str", "...
1e6d202f91ca0f080635adc470d9d18585056d53
train
print_progress_bar_multi_threads
Call in a loop to create terminal progress bar @params: iteration - Required : current iteration (Int) total - Required : total iterations (Int) prefix - Optional : prefix string (Str) suffix - Optional : suffix string (Str) decimals - Optional : pos...
pyzure/send/common.py
def print_progress_bar_multi_threads(nb_threads, suffix='', decimals=1, length=15, fill='█'): """ Call in a loop to create terminal progress bar @params: iteration - Required : current iteration (Int) total - Required : total iterations (Int) ...
def print_progress_bar_multi_threads(nb_threads, suffix='', decimals=1, length=15, fill='█'): """ Call in a loop to create terminal progress bar @params: iteration - Required : current iteration (Int) total - Required : total iterations (Int) ...
[ "Call", "in", "a", "loop", "to", "create", "terminal", "progress", "bar" ]
dacker-team/pyzure
python
https://github.com/dacker-team/pyzure/blob/1e6d202f91ca0f080635adc470d9d18585056d53/pyzure/send/common.py#L99-L131
[ "def", "print_progress_bar_multi_threads", "(", "nb_threads", ",", "suffix", "=", "''", ",", "decimals", "=", "1", ",", "length", "=", "15", ",", "fill", "=", "'█'):", "", "", "string", "=", "\"\"", "for", "k", "in", "range", "(", "nb_threads", ")", ":...
1e6d202f91ca0f080635adc470d9d18585056d53
train
upload
Upload the release to a pypi server. TODO: Make sure the git directory is clean before allowing a release. Args: target (str): pypi target as defined in ~/.pypirc
src/peltak/extra/pypi/logic.py
def upload(target): # type: (str) -> None """ Upload the release to a pypi server. TODO: Make sure the git directory is clean before allowing a release. Args: target (str): pypi target as defined in ~/.pypirc """ log.info("Uploading to pypi server <33>{}".format(target)) ...
def upload(target): # type: (str) -> None """ Upload the release to a pypi server. TODO: Make sure the git directory is clean before allowing a release. Args: target (str): pypi target as defined in ~/.pypirc """ log.info("Uploading to pypi server <33>{}".format(target)) ...
[ "Upload", "the", "release", "to", "a", "pypi", "server", "." ]
novopl/peltak
python
https://github.com/novopl/peltak/blob/b627acc019e3665875fe76cdca0a14773b69beaa/src/peltak/extra/pypi/logic.py#L31-L44
[ "def", "upload", "(", "target", ")", ":", "# type: (str) -> None", "log", ".", "info", "(", "\"Uploading to pypi server <33>{}\"", ".", "format", "(", "target", ")", ")", "with", "conf", ".", "within_proj_dir", "(", ")", ":", "shell", ".", "run", "(", "'pyth...
b627acc019e3665875fe76cdca0a14773b69beaa
train
gen_pypirc
Generate ~/.pypirc with the given credentials. Useful for CI builds. Can also get credentials through env variables ``PYPI_USER`` and ``PYPI_PASS``. Args: username (str): pypi username. If not given it will try to take it from the `` PYPI_USER`` env variable. passwo...
src/peltak/extra/pypi/logic.py
def gen_pypirc(username=None, password=None): # type: (str, str) -> None """ Generate ~/.pypirc with the given credentials. Useful for CI builds. Can also get credentials through env variables ``PYPI_USER`` and ``PYPI_PASS``. Args: username (str): pypi username. If not given it...
def gen_pypirc(username=None, password=None): # type: (str, str) -> None """ Generate ~/.pypirc with the given credentials. Useful for CI builds. Can also get credentials through env variables ``PYPI_USER`` and ``PYPI_PASS``. Args: username (str): pypi username. If not given it...
[ "Generate", "~", "/", ".", "pypirc", "with", "the", "given", "credentials", "." ]
novopl/peltak
python
https://github.com/novopl/peltak/blob/b627acc019e3665875fe76cdca0a14773b69beaa/src/peltak/extra/pypi/logic.py#L47-L84
[ "def", "gen_pypirc", "(", "username", "=", "None", ",", "password", "=", "None", ")", ":", "# type: (str, str) -> None", "path", "=", "join", "(", "conf", ".", "getenv", "(", "'HOME'", ")", ",", "'.pypirc'", ")", "username", "=", "username", "or", "conf", ...
b627acc019e3665875fe76cdca0a14773b69beaa
train
pick_sdf
Returns a full path to the chosen SDF file. The supplied file is not expected to contain a recognised SDF extension, this is added automatically. If a file with the extension `.sdf.gz` or `.sdf` is found the path to it (excluding the extension) is returned. If this fails, `None` is returned. :param...
src/python/pipelines_utils/file_utils.py
def pick_sdf(filename, directory=None): """Returns a full path to the chosen SDF file. The supplied file is not expected to contain a recognised SDF extension, this is added automatically. If a file with the extension `.sdf.gz` or `.sdf` is found the path to it (excluding the extension) is returned....
def pick_sdf(filename, directory=None): """Returns a full path to the chosen SDF file. The supplied file is not expected to contain a recognised SDF extension, this is added automatically. If a file with the extension `.sdf.gz` or `.sdf` is found the path to it (excluding the extension) is returned....
[ "Returns", "a", "full", "path", "to", "the", "chosen", "SDF", "file", ".", "The", "supplied", "file", "is", "not", "expected", "to", "contain", "a", "recognised", "SDF", "extension", "this", "is", "added", "automatically", ".", "If", "a", "file", "with", ...
InformaticsMatters/pipelines-utils
python
https://github.com/InformaticsMatters/pipelines-utils/blob/058aa6eceeff28c4ae402f6f58c58720bff0298e/src/python/pipelines_utils/file_utils.py#L53-L83
[ "def", "pick_sdf", "(", "filename", ",", "directory", "=", "None", ")", ":", "if", "directory", "is", "None", ":", "directory", "=", "utils", ".", "get_undecorated_calling_module", "(", ")", "# If the 'cwd' is not '/output' (which indicates we're in a Container)", "# th...
058aa6eceeff28c4ae402f6f58c58720bff0298e
train
main
Handles external calling for this module Execute this python module and provide the args shown below to external call this module to send Slack messages with attachments! :return: None
pycons3rt/slack.py
def main(): """Handles external calling for this module Execute this python module and provide the args shown below to external call this module to send Slack messages with attachments! :return: None """ log = logging.getLogger(mod_logger + '.main') parser = argparse.ArgumentParser(descrip...
def main(): """Handles external calling for this module Execute this python module and provide the args shown below to external call this module to send Slack messages with attachments! :return: None """ log = logging.getLogger(mod_logger + '.main') parser = argparse.ArgumentParser(descrip...
[ "Handles", "external", "calling", "for", "this", "module" ]
cons3rt/pycons3rt
python
https://github.com/cons3rt/pycons3rt/blob/f004ab3a35c5bff2f698131fef3b2a8ed5a7596d/pycons3rt/slack.py#L293-L340
[ "def", "main", "(", ")", ":", "log", "=", "logging", ".", "getLogger", "(", "mod_logger", "+", "'.main'", ")", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "'This Python module allows '", "'sending Slack messages.'", ")", "parser", ...
f004ab3a35c5bff2f698131fef3b2a8ed5a7596d
train
SlackMessage.set_text
Sets the text attribute of the payload :param text: (str) Text of the message :return: None
pycons3rt/slack.py
def set_text(self, text): """Sets the text attribute of the payload :param text: (str) Text of the message :return: None """ log = logging.getLogger(self.cls_logger + '.set_text') if not isinstance(text, basestring): msg = 'text arg must be a string' ...
def set_text(self, text): """Sets the text attribute of the payload :param text: (str) Text of the message :return: None """ log = logging.getLogger(self.cls_logger + '.set_text') if not isinstance(text, basestring): msg = 'text arg must be a string' ...
[ "Sets", "the", "text", "attribute", "of", "the", "payload" ]
cons3rt/pycons3rt
python
https://github.com/cons3rt/pycons3rt/blob/f004ab3a35c5bff2f698131fef3b2a8ed5a7596d/pycons3rt/slack.py#L86-L98
[ "def", "set_text", "(", "self", ",", "text", ")", ":", "log", "=", "logging", ".", "getLogger", "(", "self", ".", "cls_logger", "+", "'.set_text'", ")", "if", "not", "isinstance", "(", "text", ",", "basestring", ")", ":", "msg", "=", "'text arg must be a...
f004ab3a35c5bff2f698131fef3b2a8ed5a7596d
train
SlackMessage.set_icon
Sets the icon_url for the message :param icon_url: (str) Icon URL :return: None
pycons3rt/slack.py
def set_icon(self, icon_url): """Sets the icon_url for the message :param icon_url: (str) Icon URL :return: None """ log = logging.getLogger(self.cls_logger + '.set_icon') if not isinstance(icon_url, basestring): msg = 'icon_url arg must be a string' ...
def set_icon(self, icon_url): """Sets the icon_url for the message :param icon_url: (str) Icon URL :return: None """ log = logging.getLogger(self.cls_logger + '.set_icon') if not isinstance(icon_url, basestring): msg = 'icon_url arg must be a string' ...
[ "Sets", "the", "icon_url", "for", "the", "message" ]
cons3rt/pycons3rt
python
https://github.com/cons3rt/pycons3rt/blob/f004ab3a35c5bff2f698131fef3b2a8ed5a7596d/pycons3rt/slack.py#L100-L112
[ "def", "set_icon", "(", "self", ",", "icon_url", ")", ":", "log", "=", "logging", ".", "getLogger", "(", "self", ".", "cls_logger", "+", "'.set_icon'", ")", "if", "not", "isinstance", "(", "icon_url", ",", "basestring", ")", ":", "msg", "=", "'icon_url a...
f004ab3a35c5bff2f698131fef3b2a8ed5a7596d
train
SlackMessage.add_attachment
Adds an attachment to the SlackMessage payload This public method adds a slack message to the attachment list. :param attachment: SlackAttachment object :return: None
pycons3rt/slack.py
def add_attachment(self, attachment): """Adds an attachment to the SlackMessage payload This public method adds a slack message to the attachment list. :param attachment: SlackAttachment object :return: None """ log = logging.getLogger(self.cls_logger + '.add_at...
def add_attachment(self, attachment): """Adds an attachment to the SlackMessage payload This public method adds a slack message to the attachment list. :param attachment: SlackAttachment object :return: None """ log = logging.getLogger(self.cls_logger + '.add_at...
[ "Adds", "an", "attachment", "to", "the", "SlackMessage", "payload" ]
cons3rt/pycons3rt
python
https://github.com/cons3rt/pycons3rt/blob/f004ab3a35c5bff2f698131fef3b2a8ed5a7596d/pycons3rt/slack.py#L114-L129
[ "def", "add_attachment", "(", "self", ",", "attachment", ")", ":", "log", "=", "logging", ".", "getLogger", "(", "self", ".", "cls_logger", "+", "'.add_attachment'", ")", "if", "not", "isinstance", "(", "attachment", ",", "SlackAttachment", ")", ":", "msg", ...
f004ab3a35c5bff2f698131fef3b2a8ed5a7596d
train
SlackMessage.send
Sends the Slack message This public method sends the Slack message along with any attachments, then clears the attachments array. :return: None :raises: OSError
pycons3rt/slack.py
def send(self): """Sends the Slack message This public method sends the Slack message along with any attachments, then clears the attachments array. :return: None :raises: OSError """ log = logging.getLogger(self.cls_logger + '.send') if self.attachment...
def send(self): """Sends the Slack message This public method sends the Slack message along with any attachments, then clears the attachments array. :return: None :raises: OSError """ log = logging.getLogger(self.cls_logger + '.send') if self.attachment...
[ "Sends", "the", "Slack", "message" ]
cons3rt/pycons3rt
python
https://github.com/cons3rt/pycons3rt/blob/f004ab3a35c5bff2f698131fef3b2a8ed5a7596d/pycons3rt/slack.py#L131-L173
[ "def", "send", "(", "self", ")", ":", "log", "=", "logging", ".", "getLogger", "(", "self", ".", "cls_logger", "+", "'.send'", ")", "if", "self", ".", "attachments", ":", "self", ".", "payload", "[", "'attachments'", "]", "=", "self", ".", "attachments...
f004ab3a35c5bff2f698131fef3b2a8ed5a7596d
train
Cons3rtSlacker.send_cons3rt_agent_logs
Sends a Slack message with an attachment for each cons3rt agent log :return:
pycons3rt/slack.py
def send_cons3rt_agent_logs(self): """Sends a Slack message with an attachment for each cons3rt agent log :return: """ log = logging.getLogger(self.cls_logger + '.send_cons3rt_agent_logs') log.debug('Searching for log files in directory: {d}'.format(d=self.dep.cons3rt_agent_log...
def send_cons3rt_agent_logs(self): """Sends a Slack message with an attachment for each cons3rt agent log :return: """ log = logging.getLogger(self.cls_logger + '.send_cons3rt_agent_logs') log.debug('Searching for log files in directory: {d}'.format(d=self.dep.cons3rt_agent_log...
[ "Sends", "a", "Slack", "message", "with", "an", "attachment", "for", "each", "cons3rt", "agent", "log" ]
cons3rt/pycons3rt
python
https://github.com/cons3rt/pycons3rt/blob/f004ab3a35c5bff2f698131fef3b2a8ed5a7596d/pycons3rt/slack.py#L234-L257
[ "def", "send_cons3rt_agent_logs", "(", "self", ")", ":", "log", "=", "logging", ".", "getLogger", "(", "self", ".", "cls_logger", "+", "'.send_cons3rt_agent_logs'", ")", "log", ".", "debug", "(", "'Searching for log files in directory: {d}'", ".", "format", "(", "...
f004ab3a35c5bff2f698131fef3b2a8ed5a7596d
train
Cons3rtSlacker.send_text_file
Sends a Slack message with the contents of a text file :param: test_file: (str) Full path to text file to send :return: None :raises: Cons3rtSlackerError
pycons3rt/slack.py
def send_text_file(self, text_file): """Sends a Slack message with the contents of a text file :param: test_file: (str) Full path to text file to send :return: None :raises: Cons3rtSlackerError """ log = logging.getLogger(self.cls_logger + '.send_text_file') if ...
def send_text_file(self, text_file): """Sends a Slack message with the contents of a text file :param: test_file: (str) Full path to text file to send :return: None :raises: Cons3rtSlackerError """ log = logging.getLogger(self.cls_logger + '.send_text_file') if ...
[ "Sends", "a", "Slack", "message", "with", "the", "contents", "of", "a", "text", "file" ]
cons3rt/pycons3rt
python
https://github.com/cons3rt/pycons3rt/blob/f004ab3a35c5bff2f698131fef3b2a8ed5a7596d/pycons3rt/slack.py#L259-L290
[ "def", "send_text_file", "(", "self", ",", "text_file", ")", ":", "log", "=", "logging", ".", "getLogger", "(", "self", ".", "cls_logger", "+", "'.send_text_file'", ")", "if", "not", "isinstance", "(", "text_file", ",", "basestring", ")", ":", "msg", "=", ...
f004ab3a35c5bff2f698131fef3b2a8ed5a7596d
train
deploy
Deploy the app to the target environment. The target environments can be configured using the ENVIRONMENTS conf variable. This will also collect all static files and compile translation messages
src/peltak_appengine/cli.py
def deploy(project, version, promote, quiet): """ Deploy the app to the target environment. The target environments can be configured using the ENVIRONMENTS conf variable. This will also collect all static files and compile translation messages """ from . import logic logic.deploy(project,...
def deploy(project, version, promote, quiet): """ Deploy the app to the target environment. The target environments can be configured using the ENVIRONMENTS conf variable. This will also collect all static files and compile translation messages """ from . import logic logic.deploy(project,...
[ "Deploy", "the", "app", "to", "the", "target", "environment", "." ]
novopl/peltak
python
https://github.com/novopl/peltak/blob/b627acc019e3665875fe76cdca0a14773b69beaa/src/peltak_appengine/cli.py#L59-L68
[ "def", "deploy", "(", "project", ",", "version", ",", "promote", ",", "quiet", ")", ":", "from", ".", "import", "logic", "logic", ".", "deploy", "(", "project", ",", "version", ",", "promote", ",", "quiet", ")" ]
b627acc019e3665875fe76cdca0a14773b69beaa
train
devserver
Run devserver.
src/peltak_appengine/cli.py
def devserver(port, admin_port, clear): # type: (int, int, bool) -> None """ Run devserver. """ from . import logic logic.devserver(port, admin_port, clear)
def devserver(port, admin_port, clear): # type: (int, int, bool) -> None """ Run devserver. """ from . import logic logic.devserver(port, admin_port, clear)
[ "Run", "devserver", "." ]
novopl/peltak
python
https://github.com/novopl/peltak/blob/b627acc019e3665875fe76cdca0a14773b69beaa/src/peltak_appengine/cli.py#L76-L81
[ "def", "devserver", "(", "port", ",", "admin_port", ",", "clear", ")", ":", "# type: (int, int, bool) -> None", "from", ".", "import", "logic", "logic", ".", "devserver", "(", "port", ",", "admin_port", ",", "clear", ")" ]
b627acc019e3665875fe76cdca0a14773b69beaa
train
gaussian_filter1d_ppxf
Convolve a spectrum by a Gaussian with different sigma for every pixel. If all sigma are the same this routine produces the same output as scipy.ndimage.gaussian_filter1d, except for the border treatment. Here the first/last p pixels are filled with zeros. When creating a template library for SDSS data,...
bin/lib/Astro_Libraries/old_versions/attributes_declaration.py
def gaussian_filter1d_ppxf(spec, sig): """ Convolve a spectrum by a Gaussian with different sigma for every pixel. If all sigma are the same this routine produces the same output as scipy.ndimage.gaussian_filter1d, except for the border treatment. Here the first/last p pixels are filled with zeros. ...
def gaussian_filter1d_ppxf(spec, sig): """ Convolve a spectrum by a Gaussian with different sigma for every pixel. If all sigma are the same this routine produces the same output as scipy.ndimage.gaussian_filter1d, except for the border treatment. Here the first/last p pixels are filled with zeros. ...
[ "Convolve", "a", "spectrum", "by", "a", "Gaussian", "with", "different", "sigma", "for", "every", "pixel", ".", "If", "all", "sigma", "are", "the", "same", "this", "routine", "produces", "the", "same", "output", "as", "scipy", ".", "ndimage", ".", "gaussia...
Vital-Fernandez/dazer
python
https://github.com/Vital-Fernandez/dazer/blob/3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244/bin/lib/Astro_Libraries/old_versions/attributes_declaration.py#L1-L40
[ "def", "gaussian_filter1d_ppxf", "(", "spec", ",", "sig", ")", ":", "sig", "=", "sig", ".", "clip", "(", "0.01", ")", "# forces zero sigmas to have 0.01 pixels", "p", "=", "int", "(", "np", ".", "ceil", "(", "np", ".", "max", "(", "3", "*", "sig", ")",...
3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244
train
App.call_plugins
For each plugins, check if a "step" method exist on it, and call it Args: step (str): The method to search and call on each plugin
chuda/app.py
def call_plugins(self, step): ''' For each plugins, check if a "step" method exist on it, and call it Args: step (str): The method to search and call on each plugin ''' for plugin in self.plugins: try: getattr(plugin, step)() e...
def call_plugins(self, step): ''' For each plugins, check if a "step" method exist on it, and call it Args: step (str): The method to search and call on each plugin ''' for plugin in self.plugins: try: getattr(plugin, step)() e...
[ "For", "each", "plugins", "check", "if", "a", "step", "method", "exist", "on", "it", "and", "call", "it" ]
Varkal/chuda
python
https://github.com/Varkal/chuda/blob/0d93b716dede35231c21be97bcc19a656655983f/chuda/app.py#L206-L219
[ "def", "call_plugins", "(", "self", ",", "step", ")", ":", "for", "plugin", "in", "self", ".", "plugins", ":", "try", ":", "getattr", "(", "plugin", ",", "step", ")", "(", ")", "except", "AttributeError", ":", "self", ".", "logger", ".", "debug", "("...
0d93b716dede35231c21be97bcc19a656655983f
train
App.run
Run the application
chuda/app.py
def run(self): """ Run the application """ self.call_plugins("on_run") if vars(self.arguments).get("version", None): self.logger.info("{app_name}: {version}".format(app_name=self.app_name, version=self.version)) else: if self.arguments.command == "...
def run(self): """ Run the application """ self.call_plugins("on_run") if vars(self.arguments).get("version", None): self.logger.info("{app_name}: {version}".format(app_name=self.app_name, version=self.version)) else: if self.arguments.command == "...
[ "Run", "the", "application" ]
Varkal/chuda
python
https://github.com/Varkal/chuda/blob/0d93b716dede35231c21be97bcc19a656655983f/chuda/app.py#L266-L278
[ "def", "run", "(", "self", ")", ":", "self", ".", "call_plugins", "(", "\"on_run\"", ")", "if", "vars", "(", "self", ".", "arguments", ")", ".", "get", "(", "\"version\"", ",", "None", ")", ":", "self", ".", "logger", ".", "info", "(", "\"{app_name}:...
0d93b716dede35231c21be97bcc19a656655983f
train
pretend_option
Decorator to add a --pretend option to any click command. The value won't be passed down to the command, but rather handled in the callback. The value will be accessible through `peltak.core.context` under 'pretend' if the command needs it. To get the current value you can do: >>> from peltak.comm...
src/peltak/commands/__init__.py
def pretend_option(fn): # type: (FunctionType) -> FunctionType """ Decorator to add a --pretend option to any click command. The value won't be passed down to the command, but rather handled in the callback. The value will be accessible through `peltak.core.context` under 'pretend' if the command n...
def pretend_option(fn): # type: (FunctionType) -> FunctionType """ Decorator to add a --pretend option to any click command. The value won't be passed down to the command, but rather handled in the callback. The value will be accessible through `peltak.core.context` under 'pretend' if the command n...
[ "Decorator", "to", "add", "a", "--", "pretend", "option", "to", "any", "click", "command", "." ]
novopl/peltak
python
https://github.com/novopl/peltak/blob/b627acc019e3665875fe76cdca0a14773b69beaa/src/peltak/commands/__init__.py#L57-L92
[ "def", "pretend_option", "(", "fn", ")", ":", "# type: (FunctionType) -> FunctionType", "def", "set_pretend", "(", "ctx", ",", "param", ",", "value", ")", ":", "# pylint: disable=missing-docstring", "# type: (click.Context, str, Any) -> None", "from", "peltak", ".", "core...
b627acc019e3665875fe76cdca0a14773b69beaa
train
verbose_option
Decorator to add a --verbose option to any click command. The value won't be passed down to the command, but rather handled in the callback. The value will be accessible through `peltak.core.context` under 'verbose' if the command needs it. To get the current value you can do: >>> from peltak.core...
src/peltak/commands/__init__.py
def verbose_option(fn): """ Decorator to add a --verbose option to any click command. The value won't be passed down to the command, but rather handled in the callback. The value will be accessible through `peltak.core.context` under 'verbose' if the command needs it. To get the current value you can d...
def verbose_option(fn): """ Decorator to add a --verbose option to any click command. The value won't be passed down to the command, but rather handled in the callback. The value will be accessible through `peltak.core.context` under 'verbose' if the command needs it. To get the current value you can d...
[ "Decorator", "to", "add", "a", "--", "verbose", "option", "to", "any", "click", "command", "." ]
novopl/peltak
python
https://github.com/novopl/peltak/blob/b627acc019e3665875fe76cdca0a14773b69beaa/src/peltak/commands/__init__.py#L134-L159
[ "def", "verbose_option", "(", "fn", ")", ":", "def", "set_verbose", "(", "ctx", ",", "param", ",", "value", ")", ":", "# pylint: disable=missing-docstring", "# type: (click.Context, str, Any) -> None", "from", "peltak", ".", "core", "import", "context", "context", "...
b627acc019e3665875fe76cdca0a14773b69beaa
train
changelog
Print change log since last release.
src/peltak/extra/changelog/logic.py
def changelog(): # type: () -> str """ Print change log since last release. """ # Skip 'v' prefix versions = [x for x in git.tags() if versioning.is_valid(x[1:])] cmd = 'git log --format=%H' if versions: cmd += ' {}..HEAD'.format(versions[-1]) hashes = shell.run(cmd, capture=True)....
def changelog(): # type: () -> str """ Print change log since last release. """ # Skip 'v' prefix versions = [x for x in git.tags() if versioning.is_valid(x[1:])] cmd = 'git log --format=%H' if versions: cmd += ' {}..HEAD'.format(versions[-1]) hashes = shell.run(cmd, capture=True)....
[ "Print", "change", "log", "since", "last", "release", "." ]
novopl/peltak
python
https://github.com/novopl/peltak/blob/b627acc019e3665875fe76cdca0a14773b69beaa/src/peltak/extra/changelog/logic.py#L34-L80
[ "def", "changelog", "(", ")", ":", "# type: () -> str", "# Skip 'v' prefix", "versions", "=", "[", "x", "for", "x", "in", "git", ".", "tags", "(", ")", "if", "versioning", ".", "is_valid", "(", "x", "[", "1", ":", "]", ")", "]", "cmd", "=", "'git log...
b627acc019e3665875fe76cdca0a14773b69beaa
train
extract_changelog_items
Extract all tagged items from text. Args: text (str): Text to extract the tagged items from. Each tagged item is a paragraph that starts with a tag. It can also be a text list item. Returns: tuple[list[str], list[str], list[str]]: A tuple of `(features, chan...
src/peltak/extra/changelog/logic.py
def extract_changelog_items(text, tags): # type: (str) -> Dict[str, List[str]] """ Extract all tagged items from text. Args: text (str): Text to extract the tagged items from. Each tagged item is a paragraph that starts with a tag. It can also be a text list item. Retur...
def extract_changelog_items(text, tags): # type: (str) -> Dict[str, List[str]] """ Extract all tagged items from text. Args: text (str): Text to extract the tagged items from. Each tagged item is a paragraph that starts with a tag. It can also be a text list item. Retur...
[ "Extract", "all", "tagged", "items", "from", "text", "." ]
novopl/peltak
python
https://github.com/novopl/peltak/blob/b627acc019e3665875fe76cdca0a14773b69beaa/src/peltak/extra/changelog/logic.py#L83-L130
[ "def", "extract_changelog_items", "(", "text", ",", "tags", ")", ":", "# type: (str) -> Dict[str, List[str]]", "patterns", "=", "{", "x", "[", "'header'", "]", ":", "tag_re", "(", "x", "[", "'tag'", "]", ")", "for", "x", "in", "tags", "}", "items", "=", ...
b627acc019e3665875fe76cdca0a14773b69beaa
train
ExtensibleType._
Method to generate real metaclass to be used:: mc = ExtensibleType._("MyClass") # note this line @six.add_metaclass(mc) class MyClassBase(object): pass :param str cls_name: name of generated class :param class with_meta: Mix ...
extend_me.py
def _(mcs, cls_name="Object", with_meta=None): """ Method to generate real metaclass to be used:: mc = ExtensibleType._("MyClass") # note this line @six.add_metaclass(mc) class MyClassBase(object): pass :param str cls_name: name ...
def _(mcs, cls_name="Object", with_meta=None): """ Method to generate real metaclass to be used:: mc = ExtensibleType._("MyClass") # note this line @six.add_metaclass(mc) class MyClassBase(object): pass :param str cls_name: name ...
[ "Method", "to", "generate", "real", "metaclass", "to", "be", "used", "::" ]
katyukha/extend-me
python
https://github.com/katyukha/extend-me/blob/d45bc7bfcf071740ff927e7c4b8b035dbee75c13/extend_me.py#L377-L401
[ "def", "_", "(", "mcs", ",", "cls_name", "=", "\"Object\"", ",", "with_meta", "=", "None", ")", ":", "if", "with_meta", "is", "not", "None", ":", "class", "EXType", "(", "with_meta", ",", "mcs", ")", ":", "_cls_name", "=", "cls_name", "_base_classes", ...
d45bc7bfcf071740ff927e7c4b8b035dbee75c13
train
ExtensibleType.get_class
Generates new class to gether logic of all available extensions :: mc = ExtensibleType._("MyClass") @six.add_metaclass(mc) class MyClassBase(object): pass # get class with all extensions enabled MyClass = m...
extend_me.py
def get_class(mcs): """ Generates new class to gether logic of all available extensions :: mc = ExtensibleType._("MyClass") @six.add_metaclass(mc) class MyClassBase(object): pass # get class with all extensions ena...
def get_class(mcs): """ Generates new class to gether logic of all available extensions :: mc = ExtensibleType._("MyClass") @six.add_metaclass(mc) class MyClassBase(object): pass # get class with all extensions ena...
[ "Generates", "new", "class", "to", "gether", "logic", "of", "all", "available", "extensions", "::" ]
katyukha/extend-me
python
https://github.com/katyukha/extend-me/blob/d45bc7bfcf071740ff927e7c4b8b035dbee75c13/extend_me.py#L404-L422
[ "def", "get_class", "(", "mcs", ")", ":", "if", "mcs", ".", "_generated_class", "is", "None", ":", "mcs", ".", "_generated_class", "=", "type", "(", "mcs", ".", "_cls_name", ",", "tuple", "(", "mcs", ".", "_base_classes", ")", ",", "{", "'_generated'", ...
d45bc7bfcf071740ff927e7c4b8b035dbee75c13
train
ExtensibleByHashType._add_base_class
Adds new class *cls* to base classes
extend_me.py
def _add_base_class(mcs, cls): """ Adds new class *cls* to base classes """ # Do all magic only if subclass had defined required attributes if getattr(mcs, '_base_classes_hash', None) is not None: meta = getattr(cls, 'Meta', None) _hash = getattr(meta, mcs._hashat...
def _add_base_class(mcs, cls): """ Adds new class *cls* to base classes """ # Do all magic only if subclass had defined required attributes if getattr(mcs, '_base_classes_hash', None) is not None: meta = getattr(cls, 'Meta', None) _hash = getattr(meta, mcs._hashat...
[ "Adds", "new", "class", "*", "cls", "*", "to", "base", "classes" ]
katyukha/extend-me
python
https://github.com/katyukha/extend-me/blob/d45bc7bfcf071740ff927e7c4b8b035dbee75c13/extend_me.py#L578-L590
[ "def", "_add_base_class", "(", "mcs", ",", "cls", ")", ":", "# Do all magic only if subclass had defined required attributes", "if", "getattr", "(", "mcs", ",", "'_base_classes_hash'", ",", "None", ")", "is", "not", "None", ":", "meta", "=", "getattr", "(", "cls",...
d45bc7bfcf071740ff927e7c4b8b035dbee75c13