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
setupuv
Horn Schunck legacy OpenCV function requires we use these old-fashioned cv matrices, not numpy array
morecvutils/calcOptFlow.py
def setupuv(rc): """ Horn Schunck legacy OpenCV function requires we use these old-fashioned cv matrices, not numpy array """ if cv is not None: (r, c) = rc u = cv.CreateMat(r, c, cv.CV_32FC1) v = cv.CreateMat(r, c, cv.CV_32FC1) return (u, v) else: return [Non...
def setupuv(rc): """ Horn Schunck legacy OpenCV function requires we use these old-fashioned cv matrices, not numpy array """ if cv is not None: (r, c) = rc u = cv.CreateMat(r, c, cv.CV_32FC1) v = cv.CreateMat(r, c, cv.CV_32FC1) return (u, v) else: return [Non...
[ "Horn", "Schunck", "legacy", "OpenCV", "function", "requires", "we", "use", "these", "old", "-", "fashioned", "cv", "matrices", "not", "numpy", "array" ]
scivision/morecvutils
python
https://github.com/scivision/morecvutils/blob/03cd40ec9f4d577a6bc796185c3bec4a576c4d16/morecvutils/calcOptFlow.py#L39-L49
[ "def", "setupuv", "(", "rc", ")", ":", "if", "cv", "is", "not", "None", ":", "(", "r", ",", "c", ")", "=", "rc", "u", "=", "cv", ".", "CreateMat", "(", "r", ",", "c", ",", "cv", ".", "CV_32FC1", ")", "v", "=", "cv", ".", "CreateMat", "(", ...
03cd40ec9f4d577a6bc796185c3bec4a576c4d16
train
Model._init_cat_dict
Initialize a CatDict object, checking for errors.
astrocats/catalog/model.py
def _init_cat_dict(self, cat_dict_class, key_in_self, **kwargs): """Initialize a CatDict object, checking for errors. """ # Catch errors associated with crappy, but not unexpected data try: new_entry = cat_dict_class(self, key=key_in_self, **kwargs) except CatDictErro...
def _init_cat_dict(self, cat_dict_class, key_in_self, **kwargs): """Initialize a CatDict object, checking for errors. """ # Catch errors associated with crappy, but not unexpected data try: new_entry = cat_dict_class(self, key=key_in_self, **kwargs) except CatDictErro...
[ "Initialize", "a", "CatDict", "object", "checking", "for", "errors", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/catalog/model.py#L68-L79
[ "def", "_init_cat_dict", "(", "self", ",", "cat_dict_class", ",", "key_in_self", ",", "*", "*", "kwargs", ")", ":", "# Catch errors associated with crappy, but not unexpected data", "try", ":", "new_entry", "=", "cat_dict_class", "(", "self", ",", "key", "=", "key_i...
11abc3131c6366ecd23964369e55ff264add7805
train
Model._add_cat_dict
Add a CatDict to this Entry if initialization succeeds and it doesn't already exist within the Entry.
astrocats/catalog/model.py
def _add_cat_dict(self, cat_dict_class, key_in_self, check_for_dupes=True, **kwargs): """Add a CatDict to this Entry if initialization succeeds and it doesn't already exist within the Entry. """ # Try...
def _add_cat_dict(self, cat_dict_class, key_in_self, check_for_dupes=True, **kwargs): """Add a CatDict to this Entry if initialization succeeds and it doesn't already exist within the Entry. """ # Try...
[ "Add", "a", "CatDict", "to", "this", "Entry", "if", "initialization", "succeeds", "and", "it", "doesn", "t", "already", "exist", "within", "the", "Entry", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/catalog/model.py#L81-L105
[ "def", "_add_cat_dict", "(", "self", ",", "cat_dict_class", ",", "key_in_self", ",", "check_for_dupes", "=", "True", ",", "*", "*", "kwargs", ")", ":", "# Try to create a new instance of this subclass of `CatDict`", "new_entry", "=", "self", ".", "_init_cat_dict", "("...
11abc3131c6366ecd23964369e55ff264add7805
train
pbar
Wrapper for `tqdm` progress bar.
astrocats/catalog/utils/tq_funcs.py
def pbar(iter, desc='', **kwargs): """Wrapper for `tqdm` progress bar. """ return tqdm( iter, desc=('<' + str(datetime.now().strftime("%Y-%m-%d %H:%M:%S")) + '> ' + desc), dynamic_ncols=True, **kwargs)
def pbar(iter, desc='', **kwargs): """Wrapper for `tqdm` progress bar. """ return tqdm( iter, desc=('<' + str(datetime.now().strftime("%Y-%m-%d %H:%M:%S")) + '> ' + desc), dynamic_ncols=True, **kwargs)
[ "Wrapper", "for", "tqdm", "progress", "bar", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/catalog/utils/tq_funcs.py#L17-L25
[ "def", "pbar", "(", "iter", ",", "desc", "=", "''", ",", "*", "*", "kwargs", ")", ":", "return", "tqdm", "(", "iter", ",", "desc", "=", "(", "'<'", "+", "str", "(", "datetime", ".", "now", "(", ")", ".", "strftime", "(", "\"%Y-%m-%d %H:%M:%S\"", ...
11abc3131c6366ecd23964369e55ff264add7805
train
pbar_strings
Wrapper for `tqdm` progress bar which also sorts list of strings
astrocats/catalog/utils/tq_funcs.py
def pbar_strings(files, desc='', **kwargs): """Wrapper for `tqdm` progress bar which also sorts list of strings """ return tqdm( sorted(files, key=lambda s: s.lower()), desc=('<' + str(datetime.now().strftime("%Y-%m-%d %H:%M:%S")) + '> ' + desc), dynamic_ncols=True, ...
def pbar_strings(files, desc='', **kwargs): """Wrapper for `tqdm` progress bar which also sorts list of strings """ return tqdm( sorted(files, key=lambda s: s.lower()), desc=('<' + str(datetime.now().strftime("%Y-%m-%d %H:%M:%S")) + '> ' + desc), dynamic_ncols=True, ...
[ "Wrapper", "for", "tqdm", "progress", "bar", "which", "also", "sorts", "list", "of", "strings" ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/catalog/utils/tq_funcs.py#L28-L36
[ "def", "pbar_strings", "(", "files", ",", "desc", "=", "''", ",", "*", "*", "kwargs", ")", ":", "return", "tqdm", "(", "sorted", "(", "files", ",", "key", "=", "lambda", "s", ":", "s", ".", "lower", "(", ")", ")", ",", "desc", "=", "(", "'<'", ...
11abc3131c6366ecd23964369e55ff264add7805
train
_get_task_priority
Get the task `priority` corresponding to the given `task_priority`. If `task_priority` is an integer or 'None', return it. If `task_priority` is a str, return the priority of the task it matches. Otherwise, raise `ValueError`.
astrocats/catalog/catalog.py
def _get_task_priority(tasks, task_priority): """Get the task `priority` corresponding to the given `task_priority`. If `task_priority` is an integer or 'None', return it. If `task_priority` is a str, return the priority of the task it matches. Otherwise, raise `ValueError`. """ if task_priorit...
def _get_task_priority(tasks, task_priority): """Get the task `priority` corresponding to the given `task_priority`. If `task_priority` is an integer or 'None', return it. If `task_priority` is a str, return the priority of the task it matches. Otherwise, raise `ValueError`. """ if task_priorit...
[ "Get", "the", "task", "priority", "corresponding", "to", "the", "given", "task_priority", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/catalog/catalog.py#L1376-L1391
[ "def", "_get_task_priority", "(", "tasks", ",", "task_priority", ")", ":", "if", "task_priority", "is", "None", ":", "return", "None", "if", "is_integer", "(", "task_priority", ")", ":", "return", "task_priority", "if", "isinstance", "(", "task_priority", ",", ...
11abc3131c6366ecd23964369e55ff264add7805
train
Catalog.import_data
Run all of the import tasks. This is executed by the 'scripts.main.py' when the module is run as an executable. This can also be run as a method, in which case default arguments are loaded, but can be overriden using `**kwargs`.
astrocats/catalog/catalog.py
def import_data(self): """Run all of the import tasks. This is executed by the 'scripts.main.py' when the module is run as an executable. This can also be run as a method, in which case default arguments are loaded, but can be overriden using `**kwargs`. """ tasks_list ...
def import_data(self): """Run all of the import tasks. This is executed by the 'scripts.main.py' when the module is run as an executable. This can also be run as a method, in which case default arguments are loaded, but can be overriden using `**kwargs`. """ tasks_list ...
[ "Run", "all", "of", "the", "import", "tasks", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/catalog/catalog.py#L221-L288
[ "def", "import_data", "(", "self", ")", ":", "tasks_list", "=", "self", ".", "load_task_list", "(", ")", "warnings", ".", "filterwarnings", "(", "'ignore'", ",", "r'Warning: converting a masked element to nan.'", ")", "# FIX", "warnings", ".", "filterwarnings", "(",...
11abc3131c6366ecd23964369e55ff264add7805
train
Catalog.load_task_list
Load the list of tasks in this catalog's 'input/tasks.json' file. A `Task` object is created for each entry, with the parameters filled in. These are placed in an OrderedDict, sorted by the `priority` parameter, with positive values and then negative values, e.g. [0, 2, 10, -10, -1]...
astrocats/catalog/catalog.py
def load_task_list(self): """Load the list of tasks in this catalog's 'input/tasks.json' file. A `Task` object is created for each entry, with the parameters filled in. These are placed in an OrderedDict, sorted by the `priority` parameter, with positive values and then negative values,...
def load_task_list(self): """Load the list of tasks in this catalog's 'input/tasks.json' file. A `Task` object is created for each entry, with the parameters filled in. These are placed in an OrderedDict, sorted by the `priority` parameter, with positive values and then negative values,...
[ "Load", "the", "list", "of", "tasks", "in", "this", "catalog", "s", "input", "/", "tasks", ".", "json", "file", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/catalog/catalog.py#L290-L406
[ "def", "load_task_list", "(", "self", ")", ":", "# In update mode, do not delete old files", "if", "self", ".", "args", ".", "update", ":", "self", ".", "log", ".", "info", "(", "\"Disabling `pre-delete` for 'update' mode.\"", ")", "self", ".", "args", ".", "delet...
11abc3131c6366ecd23964369e55ff264add7805
train
Catalog.add_entry
Find an existing entry in, or add a new one to, the `entries` dict. FIX: rename to `create_entry`??? Returns ------- entries : OrderedDict of Entry objects newname : str Name of matching entry found in `entries`, or new entry added to `entries`
astrocats/catalog/catalog.py
def add_entry(self, name, load=True, delete=True): """Find an existing entry in, or add a new one to, the `entries` dict. FIX: rename to `create_entry`??? Returns ------- entries : OrderedDict of Entry objects newname : str Name of matching entry found in `e...
def add_entry(self, name, load=True, delete=True): """Find an existing entry in, or add a new one to, the `entries` dict. FIX: rename to `create_entry`??? Returns ------- entries : OrderedDict of Entry objects newname : str Name of matching entry found in `e...
[ "Find", "an", "existing", "entry", "in", "or", "add", "a", "new", "one", "to", "the", "entries", "dict", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/catalog/catalog.py#L438-L492
[ "def", "add_entry", "(", "self", ",", "name", ",", "load", "=", "True", ",", "delete", "=", "True", ")", ":", "newname", "=", "self", ".", "clean_entry_name", "(", "name", ")", "if", "not", "newname", ":", "raise", "(", "ValueError", "(", "'Fatal: Atte...
11abc3131c6366ecd23964369e55ff264add7805
train
Catalog.find_entry_name_of_alias
Return the first entry name with the given 'alias' included in its list of aliases. Returns ------- name of matching entry (str) or 'None' if no matches
astrocats/catalog/catalog.py
def find_entry_name_of_alias(self, alias): """Return the first entry name with the given 'alias' included in its list of aliases. Returns ------- name of matching entry (str) or 'None' if no matches """ if alias in self.aliases: name = self.aliases[a...
def find_entry_name_of_alias(self, alias): """Return the first entry name with the given 'alias' included in its list of aliases. Returns ------- name of matching entry (str) or 'None' if no matches """ if alias in self.aliases: name = self.aliases[a...
[ "Return", "the", "first", "entry", "name", "with", "the", "given", "alias", "included", "in", "its", "list", "of", "aliases", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/catalog/catalog.py#L517-L540
[ "def", "find_entry_name_of_alias", "(", "self", ",", "alias", ")", ":", "if", "alias", "in", "self", ".", "aliases", ":", "name", "=", "self", ".", "aliases", "[", "alias", "]", "if", "name", "in", "self", ".", "entries", ":", "return", "name", "else",...
11abc3131c6366ecd23964369e55ff264add7805
train
Catalog.copy_entry_to_entry
Used by `merge_duplicates`
astrocats/catalog/catalog.py
def copy_entry_to_entry(self, fromentry, destentry, check_for_dupes=True, compare_to_existing=True): """Used by `merge_duplicates` """ self.log.info("Copy entry object '{}' to '{}'".fo...
def copy_entry_to_entry(self, fromentry, destentry, check_for_dupes=True, compare_to_existing=True): """Used by `merge_duplicates` """ self.log.info("Copy entry object '{}' to '{}'".fo...
[ "Used", "by", "merge_duplicates" ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/catalog/catalog.py#L546-L617
[ "def", "copy_entry_to_entry", "(", "self", ",", "fromentry", ",", "destentry", ",", "check_for_dupes", "=", "True", ",", "compare_to_existing", "=", "True", ")", ":", "self", ".", "log", ".", "info", "(", "\"Copy entry object '{}' to '{}'\"", ".", "format", "(",...
11abc3131c6366ecd23964369e55ff264add7805
train
Catalog.merge_duplicates
Merge and remove duplicate entries. Compares each entry ('name') in `stubs` to all later entries to check for duplicates in name or alias. If a duplicate is found, they are merged and written to file.
astrocats/catalog/catalog.py
def merge_duplicates(self): """Merge and remove duplicate entries. Compares each entry ('name') in `stubs` to all later entries to check for duplicates in name or alias. If a duplicate is found, they are merged and written to file. """ if len(self.entries) == 0: ...
def merge_duplicates(self): """Merge and remove duplicate entries. Compares each entry ('name') in `stubs` to all later entries to check for duplicates in name or alias. If a duplicate is found, they are merged and written to file. """ if len(self.entries) == 0: ...
[ "Merge", "and", "remove", "duplicate", "entries", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/catalog/catalog.py#L652-L746
[ "def", "merge_duplicates", "(", "self", ")", ":", "if", "len", "(", "self", ".", "entries", ")", "==", "0", ":", "self", ".", "log", ".", "error", "(", "\"WARNING: `entries` is empty, loading stubs\"", ")", "if", "self", ".", "args", ".", "update", ":", ...
11abc3131c6366ecd23964369e55ff264add7805
train
Catalog.load_stubs
Load all events in their `stub` (name, alias, etc only) form. Used in `update` mode.
astrocats/catalog/catalog.py
def load_stubs(self, log_mem=False): """Load all events in their `stub` (name, alias, etc only) form. Used in `update` mode. """ # Initialize parameter related to diagnostic output of memory usage if log_mem: import psutil process = psutil.Process(os.getp...
def load_stubs(self, log_mem=False): """Load all events in their `stub` (name, alias, etc only) form. Used in `update` mode. """ # Initialize parameter related to diagnostic output of memory usage if log_mem: import psutil process = psutil.Process(os.getp...
[ "Load", "all", "events", "in", "their", "stub", "(", "name", "alias", "etc", "only", ")", "form", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/catalog/catalog.py#L754-L851
[ "def", "load_stubs", "(", "self", ",", "log_mem", "=", "False", ")", ":", "# Initialize parameter related to diagnostic output of memory usage", "if", "log_mem", ":", "import", "psutil", "process", "=", "psutil", ".", "Process", "(", "os", ".", "getpid", "(", ")",...
11abc3131c6366ecd23964369e55ff264add7805
train
Catalog._delete_entry_file
Delete the file associated with the given entry.
astrocats/catalog/catalog.py
def _delete_entry_file(self, entry_name=None, entry=None): """Delete the file associated with the given entry. """ if entry_name is None and entry is None: raise RuntimeError("Either `entry_name` or `entry` must be given.") elif entry_name is not None and entry is not None: ...
def _delete_entry_file(self, entry_name=None, entry=None): """Delete the file associated with the given entry. """ if entry_name is None and entry is None: raise RuntimeError("Either `entry_name` or `entry` must be given.") elif entry_name is not None and entry is not None: ...
[ "Delete", "the", "file", "associated", "with", "the", "given", "entry", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/catalog/catalog.py#L857-L884
[ "def", "_delete_entry_file", "(", "self", ",", "entry_name", "=", "None", ",", "entry", "=", "None", ")", ":", "if", "entry_name", "is", "None", "and", "entry", "is", "None", ":", "raise", "RuntimeError", "(", "\"Either `entry_name` or `entry` must be given.\"", ...
11abc3131c6366ecd23964369e55ff264add7805
train
Catalog.journal_entries
Write all entries in `entries` to files, and clear. Depending on arguments and `tasks`. Iterates over all elements of `entries`, saving (possibly 'burying') and deleting. - If ``clear == True``, then each element of `entries` is deleted, and a `stubs` entry is added
astrocats/catalog/catalog.py
def journal_entries(self, clear=True, gz=False, bury=False, write_stubs=False, final=False): """Write all entries in `entries` to files, and clear. Depending on arguments and `tasks`....
def journal_entries(self, clear=True, gz=False, bury=False, write_stubs=False, final=False): """Write all entries in `entries` to files, and clear. Depending on arguments and `tasks`....
[ "Write", "all", "entries", "in", "entries", "to", "files", "and", "clear", ".", "Depending", "on", "arguments", "and", "tasks", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/catalog/catalog.py#L889-L945
[ "def", "journal_entries", "(", "self", ",", "clear", "=", "True", ",", "gz", "=", "False", ",", "bury", "=", "False", ",", "write_stubs", "=", "False", ",", "final", "=", "False", ")", ":", "# if (self.current_task.priority >= 0 and", "# self.current_task...
11abc3131c6366ecd23964369e55ff264add7805
train
Catalog.set_preferred_names
Choose between each entries given name and its possible aliases for the best one.
astrocats/catalog/catalog.py
def set_preferred_names(self): """Choose between each entries given name and its possible aliases for the best one. """ if len(self.entries) == 0: self.log.error("WARNING: `entries` is empty, loading stubs") self.load_stubs() task_str = self.get_current_t...
def set_preferred_names(self): """Choose between each entries given name and its possible aliases for the best one. """ if len(self.entries) == 0: self.log.error("WARNING: `entries` is empty, loading stubs") self.load_stubs() task_str = self.get_current_t...
[ "Choose", "between", "each", "entries", "given", "name", "and", "its", "possible", "aliases", "for", "the", "best", "one", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/catalog/catalog.py#L975-L991
[ "def", "set_preferred_names", "(", "self", ")", ":", "if", "len", "(", "self", ".", "entries", ")", "==", "0", ":", "self", ".", "log", ".", "error", "(", "\"WARNING: `entries` is empty, loading stubs\"", ")", "self", ".", "load_stubs", "(", ")", "task_str",...
11abc3131c6366ecd23964369e55ff264add7805
train
Catalog._prep_git_add_file_list
Get a list of files which should be added to the given repository. Notes ----- * Finds files in the *root* of the given repository path. * If `file_types` is given, only use those file types. * If an uncompressed file is above the `size_limit`, it is compressed. * If a c...
astrocats/catalog/catalog.py
def _prep_git_add_file_list(self, repo, size_limit, fail=True, file_types=None): """Get a list of files which should be added to the given repository. Notes ----- ...
def _prep_git_add_file_list(self, repo, size_limit, fail=True, file_types=None): """Get a list of files which should be added to the given repository. Notes ----- ...
[ "Get", "a", "list", "of", "files", "which", "should", "be", "added", "to", "the", "given", "repository", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/catalog/catalog.py#L993-L1067
[ "def", "_prep_git_add_file_list", "(", "self", ",", "repo", ",", "size_limit", ",", "fail", "=", "True", ",", "file_types", "=", "None", ")", ":", "add_files", "=", "[", "]", "if", "file_types", "is", "None", ":", "file_patterns", "=", "[", "'*'", "]", ...
11abc3131c6366ecd23964369e55ff264add7805
train
Catalog.load_url
Load the given URL, or a cached-version. Load page from url or cached file, depending on the current settings. 'archived' mode applies when `args.archived` is true (from `--archived` CL argument), and when this task has `Task.archived` also set to True. 'archived' mode: ...
astrocats/catalog/catalog.py
def load_url(self, url, fname, repo=None, timeout=120, post=None, fail=False, write=True, json_sort=None, cache_only=False, archived_mode=None, ...
def load_url(self, url, fname, repo=None, timeout=120, post=None, fail=False, write=True, json_sort=None, cache_only=False, archived_mode=None, ...
[ "Load", "the", "given", "URL", "or", "a", "cached", "-", "version", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/catalog/catalog.py#L1093-L1276
[ "def", "load_url", "(", "self", ",", "url", ",", "fname", ",", "repo", "=", "None", ",", "timeout", "=", "120", ",", "post", "=", "None", ",", "fail", "=", "False", ",", "write", "=", "True", ",", "json_sort", "=", "None", ",", "cache_only", "=", ...
11abc3131c6366ecd23964369e55ff264add7805
train
Catalog.download_url
Download text from the given url. Returns `None` on failure. Arguments --------- self url : str URL web address to download. timeout : int Duration after which URL request should terminate. fail : bool If `True`, then an error...
astrocats/catalog/catalog.py
def download_url(self, url, timeout, fail=False, post=None, verify=True): """Download text from the given url. Returns `None` on failure. Arguments --------- self url : str URL web address to download. timeout : int Duration after which U...
def download_url(self, url, timeout, fail=False, post=None, verify=True): """Download text from the given url. Returns `None` on failure. Arguments --------- self url : str URL web address to download. timeout : int Duration after which U...
[ "Download", "text", "from", "the", "given", "url", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/catalog/catalog.py#L1296-L1373
[ "def", "download_url", "(", "self", ",", "url", ",", "timeout", ",", "fail", "=", "False", ",", "post", "=", "None", ",", "verify", "=", "True", ")", ":", "_CODE_ERRORS", "=", "[", "500", ",", "307", ",", "404", "]", "import", "requests", "session", ...
11abc3131c6366ecd23964369e55ff264add7805
train
CatDict.append_sources_from
Merge the source alias lists of two CatDicts.
astrocats/catalog/catdict.py
def append_sources_from(self, other): """Merge the source alias lists of two CatDicts.""" # Get aliases lists from this `CatDict` and other self_aliases = self[self._KEYS.SOURCE].split(',') other_aliases = other[self._KEYS.SOURCE].split(',') # Store alias to `self` self[...
def append_sources_from(self, other): """Merge the source alias lists of two CatDicts.""" # Get aliases lists from this `CatDict` and other self_aliases = self[self._KEYS.SOURCE].split(',') other_aliases = other[self._KEYS.SOURCE].split(',') # Store alias to `self` self[...
[ "Merge", "the", "source", "alias", "lists", "of", "two", "CatDicts", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/catalog/catdict.py#L202-L211
[ "def", "append_sources_from", "(", "self", ",", "other", ")", ":", "# Get aliases lists from this `CatDict` and other", "self_aliases", "=", "self", "[", "self", ".", "_KEYS", ".", "SOURCE", "]", ".", "split", "(", "','", ")", "other_aliases", "=", "other", "[",...
11abc3131c6366ecd23964369e55ff264add7805
train
Task.current_task
Name of current action for progress-bar output. The specific task string is depends on the configuration via `args`. Returns ------- ctask : str String representation of this task.
astrocats/catalog/task.py
def current_task(self, args): """Name of current action for progress-bar output. The specific task string is depends on the configuration via `args`. Returns ------- ctask : str String representation of this task. """ ctask = self.nice_name if self.n...
def current_task(self, args): """Name of current action for progress-bar output. The specific task string is depends on the configuration via `args`. Returns ------- ctask : str String representation of this task. """ ctask = self.nice_name if self.n...
[ "Name", "of", "current", "action", "for", "progress", "-", "bar", "output", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/catalog/task.py#L77-L93
[ "def", "current_task", "(", "self", ",", "args", ")", ":", "ctask", "=", "self", ".", "nice_name", "if", "self", ".", "nice_name", "is", "not", "None", "else", "self", ".", "name", "if", "args", "is", "not", "None", ":", "if", "args", ".", "update", ...
11abc3131c6366ecd23964369e55ff264add7805
train
Task.load_archive
Whether previously archived data should be loaded.
astrocats/catalog/task.py
def load_archive(self, args): """Whether previously archived data should be loaded. """ import warnings warnings.warn("`Task.load_archive()` is deprecated! " "`Catalog.load_url` handles the same functionality.") return self.archived or args.archived
def load_archive(self, args): """Whether previously archived data should be loaded. """ import warnings warnings.warn("`Task.load_archive()` is deprecated! " "`Catalog.load_url` handles the same functionality.") return self.archived or args.archived
[ "Whether", "previously", "archived", "data", "should", "be", "loaded", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/catalog/task.py#L95-L101
[ "def", "load_archive", "(", "self", ",", "args", ")", ":", "import", "warnings", "warnings", ".", "warn", "(", "\"`Task.load_archive()` is deprecated! \"", "\"`Catalog.load_url` handles the same functionality.\"", ")", "return", "self", ".", "archived", "or", "args", "...
11abc3131c6366ecd23964369e55ff264add7805
train
get_sha
Use `git rev-parse HEAD <REPO>` to get current SHA.
astrocats/catalog/gitter.py
def get_sha(path=None, log=None, short=False, timeout=None): """Use `git rev-parse HEAD <REPO>` to get current SHA. """ # git_command = "git rev-parse HEAD {}".format(repo_name).split() # git_command = "git rev-parse HEAD".split() git_command = ["git", "rev-parse"] if short: git_command....
def get_sha(path=None, log=None, short=False, timeout=None): """Use `git rev-parse HEAD <REPO>` to get current SHA. """ # git_command = "git rev-parse HEAD {}".format(repo_name).split() # git_command = "git rev-parse HEAD".split() git_command = ["git", "rev-parse"] if short: git_command....
[ "Use", "git", "rev", "-", "parse", "HEAD", "<REPO", ">", "to", "get", "current", "SHA", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/catalog/gitter.py#L30-L56
[ "def", "get_sha", "(", "path", "=", "None", ",", "log", "=", "None", ",", "short", "=", "False", ",", "timeout", "=", "None", ")", ":", "# git_command = \"git rev-parse HEAD {}\".format(repo_name).split()", "# git_command = \"git rev-parse HEAD\".split()", "git_command", ...
11abc3131c6366ecd23964369e55ff264add7805
train
git_add_commit_push_all_repos
Add all files in each data repository tree, commit, push. Creates a commit message based on the current catalog version info. If either the `git add` or `git push` commands fail, an error will be raised. Currently, if `commit` fails an error *WILL NOT* be raised because the `commit` command will retu...
astrocats/catalog/gitter.py
def git_add_commit_push_all_repos(cat): """Add all files in each data repository tree, commit, push. Creates a commit message based on the current catalog version info. If either the `git add` or `git push` commands fail, an error will be raised. Currently, if `commit` fails an error *WILL NOT* be ra...
def git_add_commit_push_all_repos(cat): """Add all files in each data repository tree, commit, push. Creates a commit message based on the current catalog version info. If either the `git add` or `git push` commands fail, an error will be raised. Currently, if `commit` fails an error *WILL NOT* be ra...
[ "Add", "all", "files", "in", "each", "data", "repository", "tree", "commit", "push", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/catalog/gitter.py#L59-L117
[ "def", "git_add_commit_push_all_repos", "(", "cat", ")", ":", "log", "=", "cat", ".", "log", "log", ".", "debug", "(", "\"gitter.git_add_commit_push_all_repos()\"", ")", "# Do not commit/push private repos", "all_repos", "=", "cat", ".", "PATHS", ".", "get_all_repo_fo...
11abc3131c6366ecd23964369e55ff264add7805
train
git_pull_all_repos
Perform a 'git pull' in each data repository. > `git pull -s recursive -X theirs`
astrocats/catalog/gitter.py
def git_pull_all_repos(cat, strategy_recursive=True, strategy='theirs'): """Perform a 'git pull' in each data repository. > `git pull -s recursive -X theirs` """ # raise RuntimeError("THIS DOESNT WORK YET!") log = cat.log log.debug("gitter.git_pull_all_repos()") log.warning("WARNING: using ...
def git_pull_all_repos(cat, strategy_recursive=True, strategy='theirs'): """Perform a 'git pull' in each data repository. > `git pull -s recursive -X theirs` """ # raise RuntimeError("THIS DOESNT WORK YET!") log = cat.log log.debug("gitter.git_pull_all_repos()") log.warning("WARNING: using ...
[ "Perform", "a", "git", "pull", "in", "each", "data", "repository", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/catalog/gitter.py#L120-L170
[ "def", "git_pull_all_repos", "(", "cat", ",", "strategy_recursive", "=", "True", ",", "strategy", "=", "'theirs'", ")", ":", "# raise RuntimeError(\"THIS DOESNT WORK YET!\")", "log", "=", "cat", ".", "log", "log", ".", "debug", "(", "\"gitter.git_pull_all_repos()\"", ...
11abc3131c6366ecd23964369e55ff264add7805
train
git_clone_all_repos
Perform a 'git clone' for each data repository that doesnt exist.
astrocats/catalog/gitter.py
def git_clone_all_repos(cat): """Perform a 'git clone' for each data repository that doesnt exist. """ log = cat.log log.debug("gitter.git_clone_all_repos()") all_repos = cat.PATHS.get_all_repo_folders() out_repos = cat.PATHS.get_repo_output_folders() for repo in all_repos: log.info...
def git_clone_all_repos(cat): """Perform a 'git clone' for each data repository that doesnt exist. """ log = cat.log log.debug("gitter.git_clone_all_repos()") all_repos = cat.PATHS.get_all_repo_folders() out_repos = cat.PATHS.get_repo_output_folders() for repo in all_repos: log.info...
[ "Perform", "a", "git", "clone", "for", "each", "data", "repository", "that", "doesnt", "exist", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/catalog/gitter.py#L173-L205
[ "def", "git_clone_all_repos", "(", "cat", ")", ":", "log", "=", "cat", ".", "log", "log", ".", "debug", "(", "\"gitter.git_clone_all_repos()\"", ")", "all_repos", "=", "cat", ".", "PATHS", ".", "get_all_repo_folders", "(", ")", "out_repos", "=", "cat", ".", ...
11abc3131c6366ecd23964369e55ff264add7805
train
git_reset_all_repos
Perform a 'git reset' in each data repository.
astrocats/catalog/gitter.py
def git_reset_all_repos(cat, hard=True, origin=False, clean=True): """Perform a 'git reset' in each data repository. """ log = cat.log log.debug("gitter.git_reset_all_repos()") all_repos = cat.PATHS.get_all_repo_folders() for repo in all_repos: log.warning("Repo in: '{}'".format(repo)) ...
def git_reset_all_repos(cat, hard=True, origin=False, clean=True): """Perform a 'git reset' in each data repository. """ log = cat.log log.debug("gitter.git_reset_all_repos()") all_repos = cat.PATHS.get_all_repo_folders() for repo in all_repos: log.warning("Repo in: '{}'".format(repo)) ...
[ "Perform", "a", "git", "reset", "in", "each", "data", "repository", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/catalog/gitter.py#L208-L248
[ "def", "git_reset_all_repos", "(", "cat", ",", "hard", "=", "True", ",", "origin", "=", "False", ",", "clean", "=", "True", ")", ":", "log", "=", "cat", ".", "log", "log", ".", "debug", "(", "\"gitter.git_reset_all_repos()\"", ")", "all_repos", "=", "cat...
11abc3131c6366ecd23964369e55ff264add7805
train
git_status_all_repos
Perform a 'git status' in each data repository.
astrocats/catalog/gitter.py
def git_status_all_repos(cat, hard=True, origin=False, clean=True): """Perform a 'git status' in each data repository. """ log = cat.log log.debug("gitter.git_status_all_repos()") all_repos = cat.PATHS.get_all_repo_folders() for repo_name in all_repos: log.info("Repo in: '{}'".format(re...
def git_status_all_repos(cat, hard=True, origin=False, clean=True): """Perform a 'git status' in each data repository. """ log = cat.log log.debug("gitter.git_status_all_repos()") all_repos = cat.PATHS.get_all_repo_folders() for repo_name in all_repos: log.info("Repo in: '{}'".format(re...
[ "Perform", "a", "git", "status", "in", "each", "data", "repository", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/catalog/gitter.py#L251-L275
[ "def", "git_status_all_repos", "(", "cat", ",", "hard", "=", "True", ",", "origin", "=", "False", ",", "clean", "=", "True", ")", ":", "log", "=", "cat", ".", "log", "log", ".", "debug", "(", "\"gitter.git_status_all_repos()\"", ")", "all_repos", "=", "c...
11abc3131c6366ecd23964369e55ff264add7805
train
clone
Given a list of repositories, make sure they're all cloned. Should be called from the subclassed `Catalog` objects, passed a list of specific repository names. Arguments --------- all_repos : list of str *Absolute* path specification of each target repository.
astrocats/catalog/gitter.py
def clone(repo, log, depth=1): """Given a list of repositories, make sure they're all cloned. Should be called from the subclassed `Catalog` objects, passed a list of specific repository names. Arguments --------- all_repos : list of str *Absolute* path specification of each target rep...
def clone(repo, log, depth=1): """Given a list of repositories, make sure they're all cloned. Should be called from the subclassed `Catalog` objects, passed a list of specific repository names. Arguments --------- all_repos : list of str *Absolute* path specification of each target rep...
[ "Given", "a", "list", "of", "repositories", "make", "sure", "they", "re", "all", "cloned", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/catalog/gitter.py#L278-L304
[ "def", "clone", "(", "repo", ",", "log", ",", "depth", "=", "1", ")", ":", "kwargs", "=", "{", "}", "if", "depth", ">", "0", ":", "kwargs", "[", "'depth'", "]", "=", "depth", "try", ":", "repo_name", "=", "os", ".", "path", ".", "split", "(", ...
11abc3131c6366ecd23964369e55ff264add7805
train
_call_command_in_repo
Use `subprocess` to call a command in a certain (repo) directory. Logs the output (both `stderr` and `stdout`) to the log, and checks the return codes to make sure they're valid. Raises error if not. Raises ------ exception `subprocess.CalledProcessError`: if the command fails
astrocats/catalog/gitter.py
def _call_command_in_repo(comm, repo, log, fail=False, log_flag=True): """Use `subprocess` to call a command in a certain (repo) directory. Logs the output (both `stderr` and `stdout`) to the log, and checks the return codes to make sure they're valid. Raises error if not. Raises ------ excep...
def _call_command_in_repo(comm, repo, log, fail=False, log_flag=True): """Use `subprocess` to call a command in a certain (repo) directory. Logs the output (both `stderr` and `stdout`) to the log, and checks the return codes to make sure they're valid. Raises error if not. Raises ------ excep...
[ "Use", "subprocess", "to", "call", "a", "command", "in", "a", "certain", "(", "repo", ")", "directory", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/catalog/gitter.py#L307-L335
[ "def", "_call_command_in_repo", "(", "comm", ",", "repo", ",", "log", ",", "fail", "=", "False", ",", "log_flag", "=", "True", ")", ":", "if", "log_flag", ":", "log", ".", "debug", "(", "\"Running '{}'.\"", ".", "format", "(", "\" \"", ".", "join", "("...
11abc3131c6366ecd23964369e55ff264add7805
train
Spectrum._check
Check that spectrum has legal combination of attributes.
astrocats/catalog/spectrum.py
def _check(self): """Check that spectrum has legal combination of attributes.""" # Run the super method super(Spectrum, self)._check() err_str = None has_data = self._KEYS.DATA in self has_wave = self._KEYS.WAVELENGTHS in self has_flux = self._KEYS.FLUXES in self...
def _check(self): """Check that spectrum has legal combination of attributes.""" # Run the super method super(Spectrum, self)._check() err_str = None has_data = self._KEYS.DATA in self has_wave = self._KEYS.WAVELENGTHS in self has_flux = self._KEYS.FLUXES in self...
[ "Check", "that", "spectrum", "has", "legal", "combination", "of", "attributes", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/catalog/spectrum.py#L112-L133
[ "def", "_check", "(", "self", ")", ":", "# Run the super method", "super", "(", "Spectrum", ",", "self", ")", ".", "_check", "(", ")", "err_str", "=", "None", "has_data", "=", "self", ".", "_KEYS", ".", "DATA", "in", "self", "has_wave", "=", "self", "....
11abc3131c6366ecd23964369e55ff264add7805
train
Spectrum.is_duplicate_of
Check if spectrum is duplicate of another.
astrocats/catalog/spectrum.py
def is_duplicate_of(self, other): """Check if spectrum is duplicate of another.""" if super(Spectrum, self).is_duplicate_of(other): return True row_matches = 0 for ri, row in enumerate(self.get(self._KEYS.DATA, [])): lambda1, flux1 = tuple(row[0:2]) if...
def is_duplicate_of(self, other): """Check if spectrum is duplicate of another.""" if super(Spectrum, self).is_duplicate_of(other): return True row_matches = 0 for ri, row in enumerate(self.get(self._KEYS.DATA, [])): lambda1, flux1 = tuple(row[0:2]) if...
[ "Check", "if", "spectrum", "is", "duplicate", "of", "another", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/catalog/spectrum.py#L135-L158
[ "def", "is_duplicate_of", "(", "self", ",", "other", ")", ":", "if", "super", "(", "Spectrum", ",", "self", ")", ".", "is_duplicate_of", "(", "other", ")", ":", "return", "True", "row_matches", "=", "0", "for", "ri", ",", "row", "in", "enumerate", "(",...
11abc3131c6366ecd23964369e55ff264add7805
train
Spectrum.sort_func
Logic for sorting keys in a `Spectrum` relative to one another.
astrocats/catalog/spectrum.py
def sort_func(self, key): """Logic for sorting keys in a `Spectrum` relative to one another.""" if key == self._KEYS.TIME: return 'aaa' if key == self._KEYS.DATA: return 'zzy' if key == self._KEYS.SOURCE: return 'zzz' return key
def sort_func(self, key): """Logic for sorting keys in a `Spectrum` relative to one another.""" if key == self._KEYS.TIME: return 'aaa' if key == self._KEYS.DATA: return 'zzy' if key == self._KEYS.SOURCE: return 'zzz' return key
[ "Logic", "for", "sorting", "keys", "in", "a", "Spectrum", "relative", "to", "one", "another", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/catalog/spectrum.py#L160-L168
[ "def", "sort_func", "(", "self", ",", "key", ")", ":", "if", "key", "==", "self", ".", "_KEYS", ".", "TIME", ":", "return", "'aaa'", "if", "key", "==", "self", ".", "_KEYS", ".", "DATA", ":", "return", "'zzy'", "if", "key", "==", "self", ".", "_K...
11abc3131c6366ecd23964369e55ff264add7805
train
Quantity.sort_func
Sorting logic for `Quantity` objects.
astrocats/catalog/quantity.py
def sort_func(self, key): """Sorting logic for `Quantity` objects.""" if key == self._KEYS.VALUE: return 'aaa' if key == self._KEYS.SOURCE: return 'zzz' return key
def sort_func(self, key): """Sorting logic for `Quantity` objects.""" if key == self._KEYS.VALUE: return 'aaa' if key == self._KEYS.SOURCE: return 'zzz' return key
[ "Sorting", "logic", "for", "Quantity", "objects", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/catalog/quantity.py#L113-L119
[ "def", "sort_func", "(", "self", ",", "key", ")", ":", "if", "key", "==", "self", ".", "_KEYS", ".", "VALUE", ":", "return", "'aaa'", "if", "key", "==", "self", ".", "_KEYS", ".", "SOURCE", ":", "return", "'zzz'", "return", "key" ]
11abc3131c6366ecd23964369e55ff264add7805
train
KeyCollection.keys
Return this class's attribute names (those not stating with '_'). Also retrieves the attributes from base classes, e.g. For: ``ENTRY(KeyCollection)``, ``ENTRY.keys()`` gives just the attributes of `ENTRY` (`KeyCollection` has no keys). For: ``SUPERNOVA(ENTRY)``, ``SUPERNOVA.keys()`...
astrocats/catalog/key.py
def keys(cls): """Return this class's attribute names (those not stating with '_'). Also retrieves the attributes from base classes, e.g. For: ``ENTRY(KeyCollection)``, ``ENTRY.keys()`` gives just the attributes of `ENTRY` (`KeyCollection` has no keys). For: ``SUPERNOVA(ENT...
def keys(cls): """Return this class's attribute names (those not stating with '_'). Also retrieves the attributes from base classes, e.g. For: ``ENTRY(KeyCollection)``, ``ENTRY.keys()`` gives just the attributes of `ENTRY` (`KeyCollection` has no keys). For: ``SUPERNOVA(ENT...
[ "Return", "this", "class", "s", "attribute", "names", "(", "those", "not", "stating", "with", "_", ")", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/catalog/key.py#L20-L54
[ "def", "keys", "(", "cls", ")", ":", "if", "cls", ".", "_keys", ":", "return", "cls", ".", "_keys", "# If `_keys` is not yet defined, create it", "# ----------------------------------------", "_keys", "=", "[", "]", "# get the keys from all base-classes aswell (when this is...
11abc3131c6366ecd23964369e55ff264add7805
train
KeyCollection.vals
Return this class's attribute values (those not stating with '_'). Returns ------- _vals : list of objects List of values of internal attributes. Order is effectiely random.
astrocats/catalog/key.py
def vals(cls): """Return this class's attribute values (those not stating with '_'). Returns ------- _vals : list of objects List of values of internal attributes. Order is effectiely random. """ if cls._vals: return cls._vals # If `_val...
def vals(cls): """Return this class's attribute values (those not stating with '_'). Returns ------- _vals : list of objects List of values of internal attributes. Order is effectiely random. """ if cls._vals: return cls._vals # If `_val...
[ "Return", "this", "class", "s", "attribute", "values", "(", "those", "not", "stating", "with", "_", ")", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/catalog/key.py#L57-L85
[ "def", "vals", "(", "cls", ")", ":", "if", "cls", ".", "_vals", ":", "return", "cls", ".", "_vals", "# If `_vals` is not yet defined, create it", "# ----------------------------------------", "_vals", "=", "[", "]", "# get the keys from all base-classes aswell (when this is...
11abc3131c6366ecd23964369e55ff264add7805
train
KeyCollection.compare_vals
Return this class's attribute values (those not stating with '_'), but only for attributes with `compare` set to `True`. Returns ------- _compare_vals : list of objects List of values of internal attributes to use when comparing `CatDict` objects. Order sorted by...
astrocats/catalog/key.py
def compare_vals(cls, sort=True): """Return this class's attribute values (those not stating with '_'), but only for attributes with `compare` set to `True`. Returns ------- _compare_vals : list of objects List of values of internal attributes to use when comparing ...
def compare_vals(cls, sort=True): """Return this class's attribute values (those not stating with '_'), but only for attributes with `compare` set to `True`. Returns ------- _compare_vals : list of objects List of values of internal attributes to use when comparing ...
[ "Return", "this", "class", "s", "attribute", "values", "(", "those", "not", "stating", "with", "_", ")", "but", "only", "for", "attributes", "with", "compare", "set", "to", "True", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/catalog/key.py#L88-L128
[ "def", "compare_vals", "(", "cls", ",", "sort", "=", "True", ")", ":", "if", "cls", ".", "_compare_vals", ":", "return", "cls", ".", "_compare_vals", "# If `_compare_vals` is not yet defined, create it", "# ----------------------------------------", "_compare_vals", "=", ...
11abc3131c6366ecd23964369e55ff264add7805
train
Key.pretty
Return a 'pretty' string representation of this `Key`. note: do not override the builtin `__str__` or `__repr__` methods!
astrocats/catalog/key.py
def pretty(self): """Return a 'pretty' string representation of this `Key`. note: do not override the builtin `__str__` or `__repr__` methods! """ retval = ("Key(name={}, type={}, listable={}, compare={}, " "priority={}, kind_preference={}, " "replace...
def pretty(self): """Return a 'pretty' string representation of this `Key`. note: do not override the builtin `__str__` or `__repr__` methods! """ retval = ("Key(name={}, type={}, listable={}, compare={}, " "priority={}, kind_preference={}, " "replace...
[ "Return", "a", "pretty", "string", "representation", "of", "this", "Key", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/catalog/key.py#L219-L229
[ "def", "pretty", "(", "self", ")", ":", "retval", "=", "(", "\"Key(name={}, type={}, listable={}, compare={}, \"", "\"priority={}, kind_preference={}, \"", "\"replace_better={})\"", ")", ".", "format", "(", "self", ".", "name", ",", "self", ".", "type", ",", "self", ...
11abc3131c6366ecd23964369e55ff264add7805
train
Key.check
Make sure given value is consistent with this `Key` specification. NOTE: if `type` is 'None', then `listable` also is *not* checked.
astrocats/catalog/key.py
def check(self, val): """Make sure given value is consistent with this `Key` specification. NOTE: if `type` is 'None', then `listable` also is *not* checked. """ # If there is no `type` requirement, everything is allowed if self.type is None: return True is_...
def check(self, val): """Make sure given value is consistent with this `Key` specification. NOTE: if `type` is 'None', then `listable` also is *not* checked. """ # If there is no `type` requirement, everything is allowed if self.type is None: return True is_...
[ "Make", "sure", "given", "value", "is", "consistent", "with", "this", "Key", "specification", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/catalog/key.py#L231-L265
[ "def", "check", "(", "self", ",", "val", ")", ":", "# If there is no `type` requirement, everything is allowed", "if", "self", ".", "type", "is", "None", ":", "return", "True", "is_list", "=", "isinstance", "(", "val", ",", "list", ")", "# If lists are not allowed...
11abc3131c6366ecd23964369e55ff264add7805
train
get_logger
Create a standard logger object which logs to file and or stdout stream. If a logger has already been created in this session, it is returned (unless `name` is given). Arguments --------- name : str, Handle for this logger, must be distinct for a distinct logger. stream_fmt : str or `N...
astrocats/catalog/utils/logger.py
def get_logger(name=None, stream_fmt=None, file_fmt=None, date_fmt=None, stream_level=None, file_level=None, tofile=None, tostr=True): """Create a standard logger object which logs to file and or stdout stream. If a logger has already been created in this session, it is returned ...
def get_logger(name=None, stream_fmt=None, file_fmt=None, date_fmt=None, stream_level=None, file_level=None, tofile=None, tostr=True): """Create a standard logger object which logs to file and or stdout stream. If a logger has already been created in this session, it is returned ...
[ "Create", "a", "standard", "logger", "object", "which", "logs", "to", "file", "and", "or", "stdout", "stream", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/catalog/utils/logger.py#L39-L133
[ "def", "get_logger", "(", "name", "=", "None", ",", "stream_fmt", "=", "None", ",", "file_fmt", "=", "None", ",", "date_fmt", "=", "None", ",", "stream_level", "=", "None", ",", "file_level", "=", "None", ",", "tofile", "=", "None", ",", "tostr", "=", ...
11abc3131c6366ecd23964369e55ff264add7805
train
log_raise
Log an error message and raise an error. Arguments --------- log : `logging.Logger` object err_str : str Error message to be logged and raised. err_type : `Exception` object Type of error to raise.
astrocats/catalog/utils/logger.py
def log_raise(log, err_str, err_type=RuntimeError): """Log an error message and raise an error. Arguments --------- log : `logging.Logger` object err_str : str Error message to be logged and raised. err_type : `Exception` object Type of error to raise. """ log.error(err...
def log_raise(log, err_str, err_type=RuntimeError): """Log an error message and raise an error. Arguments --------- log : `logging.Logger` object err_str : str Error message to be logged and raised. err_type : `Exception` object Type of error to raise. """ log.error(err...
[ "Log", "an", "error", "message", "and", "raise", "an", "error", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/catalog/utils/logger.py#L136-L154
[ "def", "log_raise", "(", "log", ",", "err_str", ",", "err_type", "=", "RuntimeError", ")", ":", "log", ".", "error", "(", "err_str", ")", "# Make sure output is flushed", "# (happens automatically to `StreamHandlers`, but not `FileHandlers`)", "for", "handle", "in", "lo...
11abc3131c6366ecd23964369e55ff264add7805
train
log_memory
Log the current memory usage.
astrocats/catalog/utils/logger.py
def log_memory(log, pref=None, lvl=logging.DEBUG, raise_flag=True): """Log the current memory usage. """ import os import sys cyc_str = "" KB = 1024.0 if pref is not None: cyc_str += "{}: ".format(pref) # Linux returns units in Bytes; OSX in kilobytes UNIT = KB*KB if sys.pla...
def log_memory(log, pref=None, lvl=logging.DEBUG, raise_flag=True): """Log the current memory usage. """ import os import sys cyc_str = "" KB = 1024.0 if pref is not None: cyc_str += "{}: ".format(pref) # Linux returns units in Bytes; OSX in kilobytes UNIT = KB*KB if sys.pla...
[ "Log", "the", "current", "memory", "usage", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/catalog/utils/logger.py#L157-L207
[ "def", "log_memory", "(", "log", ",", "pref", "=", "None", ",", "lvl", "=", "logging", ".", "DEBUG", ",", "raise_flag", "=", "True", ")", ":", "import", "os", "import", "sys", "cyc_str", "=", "\"\"", "KB", "=", "1024.0", "if", "pref", "is", "not", ...
11abc3131c6366ecd23964369e55ff264add7805
train
doblob
img: can be RGB (MxNx3) or gray (MxN) http://docs.opencv.org/master/modules/features2d/doc/drawing_function_of_keypoints_and_matches.html http://docs.opencv.org/trunk/modules/features2d/doc/drawing_function_of_keypoints_and_matches.html
morecvutils/connectedComponents.py
def doblob(morphed, blobdet, img, anno=True): """ img: can be RGB (MxNx3) or gray (MxN) http://docs.opencv.org/master/modules/features2d/doc/drawing_function_of_keypoints_and_matches.html http://docs.opencv.org/trunk/modules/features2d/doc/drawing_function_of_keypoints_and_matches.html """ keypo...
def doblob(morphed, blobdet, img, anno=True): """ img: can be RGB (MxNx3) or gray (MxN) http://docs.opencv.org/master/modules/features2d/doc/drawing_function_of_keypoints_and_matches.html http://docs.opencv.org/trunk/modules/features2d/doc/drawing_function_of_keypoints_and_matches.html """ keypo...
[ "img", ":", "can", "be", "RGB", "(", "MxNx3", ")", "or", "gray", "(", "MxN", ")", "http", ":", "//", "docs", ".", "opencv", ".", "org", "/", "master", "/", "modules", "/", "features2d", "/", "doc", "/", "drawing_function_of_keypoints_and_matches", ".", ...
scivision/morecvutils
python
https://github.com/scivision/morecvutils/blob/03cd40ec9f4d577a6bc796185c3bec4a576c4d16/morecvutils/connectedComponents.py#L9-L28
[ "def", "doblob", "(", "morphed", ",", "blobdet", ",", "img", ",", "anno", "=", "True", ")", ":", "keypoints", "=", "blobdet", ".", "detect", "(", "morphed", ")", "nkey", "=", "len", "(", "keypoints", ")", "kpsize", "=", "asarray", "(", "[", "k", "....
03cd40ec9f4d577a6bc796185c3bec4a576c4d16
train
ArgsHandler.load_args
Parse arguments and return configuration settings.
astrocats/catalog/argshandler.py
def load_args(self, args, clargs): """Parse arguments and return configuration settings. """ # Parse All Arguments args = self.parser.parse_args(args=clargs, namespace=args) # Print the help information if no subcommand is given # subcommand is required for operation ...
def load_args(self, args, clargs): """Parse arguments and return configuration settings. """ # Parse All Arguments args = self.parser.parse_args(args=clargs, namespace=args) # Print the help information if no subcommand is given # subcommand is required for operation ...
[ "Parse", "arguments", "and", "return", "configuration", "settings", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/catalog/argshandler.py#L56-L68
[ "def", "load_args", "(", "self", ",", "args", ",", "clargs", ")", ":", "# Parse All Arguments", "args", "=", "self", ".", "parser", ".", "parse_args", "(", "args", "=", "clargs", ",", "namespace", "=", "args", ")", "# Print the help information if no subcommand ...
11abc3131c6366ecd23964369e55ff264add7805
train
ArgsHandler._setup_argparse
Create `argparse` instance, and setup with appropriate parameters.
astrocats/catalog/argshandler.py
def _setup_argparse(self): """Create `argparse` instance, and setup with appropriate parameters. """ parser = argparse.ArgumentParser( prog='catalog', description='Parent Catalog class for astrocats.') subparsers = parser.add_subparsers( description='valid subcom...
def _setup_argparse(self): """Create `argparse` instance, and setup with appropriate parameters. """ parser = argparse.ArgumentParser( prog='catalog', description='Parent Catalog class for astrocats.') subparsers = parser.add_subparsers( description='valid subcom...
[ "Create", "argparse", "instance", "and", "setup", "with", "appropriate", "parameters", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/catalog/argshandler.py#L70-L93
[ "def", "_setup_argparse", "(", "self", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "prog", "=", "'catalog'", ",", "description", "=", "'Parent Catalog class for astrocats.'", ")", "subparsers", "=", "parser", ".", "add_subparsers", "(", "descr...
11abc3131c6366ecd23964369e55ff264add7805
train
ArgsHandler._add_parser_arguments_import
Create parser for 'import' subcommand, and associated arguments.
astrocats/catalog/argshandler.py
def _add_parser_arguments_import(self, subparsers): """Create parser for 'import' subcommand, and associated arguments. """ import_pars = subparsers.add_parser( "import", help="Import data.") import_pars.add_argument( '--update', '-u', dest='update', ...
def _add_parser_arguments_import(self, subparsers): """Create parser for 'import' subcommand, and associated arguments. """ import_pars = subparsers.add_parser( "import", help="Import data.") import_pars.add_argument( '--update', '-u', dest='update', ...
[ "Create", "parser", "for", "import", "subcommand", "and", "associated", "arguments", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/catalog/argshandler.py#L95-L138
[ "def", "_add_parser_arguments_import", "(", "self", ",", "subparsers", ")", ":", "import_pars", "=", "subparsers", ".", "add_parser", "(", "\"import\"", ",", "help", "=", "\"Import data.\"", ")", "import_pars", ".", "add_argument", "(", "'--update'", ",", "'-u'", ...
11abc3131c6366ecd23964369e55ff264add7805
train
ArgsHandler._add_parser_arguments_git
Create a sub-parsers for git subcommands.
astrocats/catalog/argshandler.py
def _add_parser_arguments_git(self, subparsers): """Create a sub-parsers for git subcommands. """ subparsers.add_parser( "git-clone", help="Clone all defined data repositories if they dont exist.") subparsers.add_parser( "git-push", help="...
def _add_parser_arguments_git(self, subparsers): """Create a sub-parsers for git subcommands. """ subparsers.add_parser( "git-clone", help="Clone all defined data repositories if they dont exist.") subparsers.add_parser( "git-push", help="...
[ "Create", "a", "sub", "-", "parsers", "for", "git", "subcommands", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/catalog/argshandler.py#L140-L167
[ "def", "_add_parser_arguments_git", "(", "self", ",", "subparsers", ")", ":", "subparsers", ".", "add_parser", "(", "\"git-clone\"", ",", "help", "=", "\"Clone all defined data repositories if they dont exist.\"", ")", "subparsers", ".", "add_parser", "(", "\"git-push\"",...
11abc3131c6366ecd23964369e55ff264add7805
train
ArgsHandler._add_parser_arguments_analyze
Create a parser for the 'analyze' subcommand.
astrocats/catalog/argshandler.py
def _add_parser_arguments_analyze(self, subparsers): """Create a parser for the 'analyze' subcommand. """ lyze_pars = subparsers.add_parser( "analyze", help="Perform basic analysis on this catalog.") lyze_pars.add_argument( '--count', '-c', dest='coun...
def _add_parser_arguments_analyze(self, subparsers): """Create a parser for the 'analyze' subcommand. """ lyze_pars = subparsers.add_parser( "analyze", help="Perform basic analysis on this catalog.") lyze_pars.add_argument( '--count', '-c', dest='coun...
[ "Create", "a", "parser", "for", "the", "analyze", "subcommand", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/catalog/argshandler.py#L169-L181
[ "def", "_add_parser_arguments_analyze", "(", "self", ",", "subparsers", ")", ":", "lyze_pars", "=", "subparsers", ".", "add_parser", "(", "\"analyze\"", ",", "help", "=", "\"Perform basic analysis on this catalog.\"", ")", "lyze_pars", ".", "add_argument", "(", "'--co...
11abc3131c6366ecd23964369e55ff264add7805
train
compress_gz
Compress the file with the given name and delete the uncompressed file. The compressed filename is simply the input filename with '.gz' appended. Arguments --------- fname : str Name of the file to compress and delete. Returns ------- comp_fname : str Name of the compresse...
astrocats/catalog/utils/imports.py
def compress_gz(fname): """Compress the file with the given name and delete the uncompressed file. The compressed filename is simply the input filename with '.gz' appended. Arguments --------- fname : str Name of the file to compress and delete. Returns ------- comp_fname : st...
def compress_gz(fname): """Compress the file with the given name and delete the uncompressed file. The compressed filename is simply the input filename with '.gz' appended. Arguments --------- fname : str Name of the file to compress and delete. Returns ------- comp_fname : st...
[ "Compress", "the", "file", "with", "the", "given", "name", "and", "delete", "the", "uncompressed", "file", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/catalog/utils/imports.py#L37-L60
[ "def", "compress_gz", "(", "fname", ")", ":", "import", "shutil", "import", "gzip", "comp_fname", "=", "fname", "+", "'.gz'", "with", "codecs", ".", "open", "(", "fname", ",", "'rb'", ")", "as", "f_in", ",", "gzip", ".", "open", "(", "comp_fname", ",",...
11abc3131c6366ecd23964369e55ff264add7805
train
draw_flow
draws flow vectors on image this came from opencv/examples directory another way: http://docs.opencv.org/trunk/doc/py_tutorials/py_gui/py_drawing_functions/py_drawing_functions.html
morecvutils/cv2draw.py
def draw_flow(img, flow, step=16, dtype=uint8): """ draws flow vectors on image this came from opencv/examples directory another way: http://docs.opencv.org/trunk/doc/py_tutorials/py_gui/py_drawing_functions/py_drawing_functions.html """ maxval = iinfo(img.dtype).max # scaleFact = 1. #arbit...
def draw_flow(img, flow, step=16, dtype=uint8): """ draws flow vectors on image this came from opencv/examples directory another way: http://docs.opencv.org/trunk/doc/py_tutorials/py_gui/py_drawing_functions/py_drawing_functions.html """ maxval = iinfo(img.dtype).max # scaleFact = 1. #arbit...
[ "draws", "flow", "vectors", "on", "image", "this", "came", "from", "opencv", "/", "examples", "directory", "another", "way", ":", "http", ":", "//", "docs", ".", "opencv", ".", "org", "/", "trunk", "/", "doc", "/", "py_tutorials", "/", "py_gui", "/", "...
scivision/morecvutils
python
https://github.com/scivision/morecvutils/blob/03cd40ec9f4d577a6bc796185c3bec4a576c4d16/morecvutils/cv2draw.py#L7-L33
[ "def", "draw_flow", "(", "img", ",", "flow", ",", "step", "=", "16", ",", "dtype", "=", "uint8", ")", ":", "maxval", "=", "iinfo", "(", "img", ".", "dtype", ")", ".", "max", "# scaleFact = 1. #arbitary factor to make flow visible", "canno", "=", "(", "0", ...
03cd40ec9f4d577a6bc796185c3bec4a576c4d16
train
draw_hsv
mag must be uint8, uint16, uint32 and 2-D ang is in radians (float)
morecvutils/cv2draw.py
def draw_hsv(mag, ang, dtype=uint8, fn=None): """ mag must be uint8, uint16, uint32 and 2-D ang is in radians (float) """ assert mag.shape == ang.shape assert mag.ndim == 2 maxval = iinfo(dtype).max hsv = dstack(((degrees(ang)/2).astype(dtype), # /2 to keep less than 255 ...
def draw_hsv(mag, ang, dtype=uint8, fn=None): """ mag must be uint8, uint16, uint32 and 2-D ang is in radians (float) """ assert mag.shape == ang.shape assert mag.ndim == 2 maxval = iinfo(dtype).max hsv = dstack(((degrees(ang)/2).astype(dtype), # /2 to keep less than 255 ...
[ "mag", "must", "be", "uint8", "uint16", "uint32", "and", "2", "-", "D", "ang", "is", "in", "radians", "(", "float", ")" ]
scivision/morecvutils
python
https://github.com/scivision/morecvutils/blob/03cd40ec9f4d577a6bc796185c3bec4a576c4d16/morecvutils/cv2draw.py#L36-L54
[ "def", "draw_hsv", "(", "mag", ",", "ang", ",", "dtype", "=", "uint8", ",", "fn", "=", "None", ")", ":", "assert", "mag", ".", "shape", "==", "ang", ".", "shape", "assert", "mag", ".", "ndim", "==", "2", "maxval", "=", "iinfo", "(", "dtype", ")",...
03cd40ec9f4d577a6bc796185c3bec4a576c4d16
train
flow2magang
flow dimensions y,x,2 3-D. flow[...,0] is magnitude, flow[...,1] is angle
morecvutils/cv2draw.py
def flow2magang(flow, dtype=uint8): """ flow dimensions y,x,2 3-D. flow[...,0] is magnitude, flow[...,1] is angle """ fx, fy = flow[..., 0], flow[..., 1] return hypot(fx, fy).astype(dtype), arctan2(fy, fx) + pi
def flow2magang(flow, dtype=uint8): """ flow dimensions y,x,2 3-D. flow[...,0] is magnitude, flow[...,1] is angle """ fx, fy = flow[..., 0], flow[..., 1] return hypot(fx, fy).astype(dtype), arctan2(fy, fx) + pi
[ "flow", "dimensions", "y", "x", "2", "3", "-", "D", ".", "flow", "[", "...", "0", "]", "is", "magnitude", "flow", "[", "...", "1", "]", "is", "angle" ]
scivision/morecvutils
python
https://github.com/scivision/morecvutils/blob/03cd40ec9f4d577a6bc796185c3bec4a576c4d16/morecvutils/cv2draw.py#L57-L62
[ "def", "flow2magang", "(", "flow", ",", "dtype", "=", "uint8", ")", ":", "fx", ",", "fy", "=", "flow", "[", "...", ",", "0", "]", ",", "flow", "[", "...", ",", "1", "]", "return", "hypot", "(", "fx", ",", "fy", ")", ".", "astype", "(", "dtype...
03cd40ec9f4d577a6bc796185c3bec4a576c4d16
train
IOC
dir One of IOC_NONE, IOC_WRITE, IOC_READ, or IOC_READ|IOC_WRITE. Direction is from the application's point of view, not kernel's. size (14-bits unsigned integer) Size of the buffer passed to ioctl's "arg" argument.
ioctl_opt/__init__.py
def IOC(dir, type, nr, size): """ dir One of IOC_NONE, IOC_WRITE, IOC_READ, or IOC_READ|IOC_WRITE. Direction is from the application's point of view, not kernel's. size (14-bits unsigned integer) Size of the buffer passed to ioctl's "arg" argument. """ assert dir <= _IOC_DIRM...
def IOC(dir, type, nr, size): """ dir One of IOC_NONE, IOC_WRITE, IOC_READ, or IOC_READ|IOC_WRITE. Direction is from the application's point of view, not kernel's. size (14-bits unsigned integer) Size of the buffer passed to ioctl's "arg" argument. """ assert dir <= _IOC_DIRM...
[ "dir", "One", "of", "IOC_NONE", "IOC_WRITE", "IOC_READ", "or", "IOC_READ|IOC_WRITE", ".", "Direction", "is", "from", "the", "application", "s", "point", "of", "view", "not", "kernel", "s", ".", "size", "(", "14", "-", "bits", "unsigned", "integer", ")", "S...
vpelletier/python-ioctl-opt
python
https://github.com/vpelletier/python-ioctl-opt/blob/29ec5029af4a7de8709c449090529c4cc63d62b0/ioctl_opt/__init__.py#L50-L62
[ "def", "IOC", "(", "dir", ",", "type", ",", "nr", ",", "size", ")", ":", "assert", "dir", "<=", "_IOC_DIRMASK", ",", "dir", "assert", "type", "<=", "_IOC_TYPEMASK", ",", "type", "assert", "nr", "<=", "_IOC_NRMASK", ",", "nr", "assert", "size", "<=", ...
29ec5029af4a7de8709c449090529c4cc63d62b0
train
IOC_TYPECHECK
Returns the size of given type, and check its suitability for use in an ioctl command number.
ioctl_opt/__init__.py
def IOC_TYPECHECK(t): """ Returns the size of given type, and check its suitability for use in an ioctl command number. """ result = ctypes.sizeof(t) assert result <= _IOC_SIZEMASK, result return result
def IOC_TYPECHECK(t): """ Returns the size of given type, and check its suitability for use in an ioctl command number. """ result = ctypes.sizeof(t) assert result <= _IOC_SIZEMASK, result return result
[ "Returns", "the", "size", "of", "given", "type", "and", "check", "its", "suitability", "for", "use", "in", "an", "ioctl", "command", "number", "." ]
vpelletier/python-ioctl-opt
python
https://github.com/vpelletier/python-ioctl-opt/blob/29ec5029af4a7de8709c449090529c4cc63d62b0/ioctl_opt/__init__.py#L64-L71
[ "def", "IOC_TYPECHECK", "(", "t", ")", ":", "result", "=", "ctypes", ".", "sizeof", "(", "t", ")", "assert", "result", "<=", "_IOC_SIZEMASK", ",", "result", "return", "result" ]
29ec5029af4a7de8709c449090529c4cc63d62b0
train
IOR
An ioctl with read parameters. size (ctype type or instance) Type/structure of the argument passed to ioctl's "arg" argument.
ioctl_opt/__init__.py
def IOR(type, nr, size): """ An ioctl with read parameters. size (ctype type or instance) Type/structure of the argument passed to ioctl's "arg" argument. """ return IOC(IOC_READ, type, nr, IOC_TYPECHECK(size))
def IOR(type, nr, size): """ An ioctl with read parameters. size (ctype type or instance) Type/structure of the argument passed to ioctl's "arg" argument. """ return IOC(IOC_READ, type, nr, IOC_TYPECHECK(size))
[ "An", "ioctl", "with", "read", "parameters", "." ]
vpelletier/python-ioctl-opt
python
https://github.com/vpelletier/python-ioctl-opt/blob/29ec5029af4a7de8709c449090529c4cc63d62b0/ioctl_opt/__init__.py#L79-L86
[ "def", "IOR", "(", "type", ",", "nr", ",", "size", ")", ":", "return", "IOC", "(", "IOC_READ", ",", "type", ",", "nr", ",", "IOC_TYPECHECK", "(", "size", ")", ")" ]
29ec5029af4a7de8709c449090529c4cc63d62b0
train
IOW
An ioctl with write parameters. size (ctype type or instance) Type/structure of the argument passed to ioctl's "arg" argument.
ioctl_opt/__init__.py
def IOW(type, nr, size): """ An ioctl with write parameters. size (ctype type or instance) Type/structure of the argument passed to ioctl's "arg" argument. """ return IOC(IOC_WRITE, type, nr, IOC_TYPECHECK(size))
def IOW(type, nr, size): """ An ioctl with write parameters. size (ctype type or instance) Type/structure of the argument passed to ioctl's "arg" argument. """ return IOC(IOC_WRITE, type, nr, IOC_TYPECHECK(size))
[ "An", "ioctl", "with", "write", "parameters", "." ]
vpelletier/python-ioctl-opt
python
https://github.com/vpelletier/python-ioctl-opt/blob/29ec5029af4a7de8709c449090529c4cc63d62b0/ioctl_opt/__init__.py#L88-L95
[ "def", "IOW", "(", "type", ",", "nr", ",", "size", ")", ":", "return", "IOC", "(", "IOC_WRITE", ",", "type", ",", "nr", ",", "IOC_TYPECHECK", "(", "size", ")", ")" ]
29ec5029af4a7de8709c449090529c4cc63d62b0
train
IOWR
An ioctl with both read an writes parameters. size (ctype type or instance) Type/structure of the argument passed to ioctl's "arg" argument.
ioctl_opt/__init__.py
def IOWR(type, nr, size): """ An ioctl with both read an writes parameters. size (ctype type or instance) Type/structure of the argument passed to ioctl's "arg" argument. """ return IOC(IOC_READ | IOC_WRITE, type, nr, IOC_TYPECHECK(size))
def IOWR(type, nr, size): """ An ioctl with both read an writes parameters. size (ctype type or instance) Type/structure of the argument passed to ioctl's "arg" argument. """ return IOC(IOC_READ | IOC_WRITE, type, nr, IOC_TYPECHECK(size))
[ "An", "ioctl", "with", "both", "read", "an", "writes", "parameters", "." ]
vpelletier/python-ioctl-opt
python
https://github.com/vpelletier/python-ioctl-opt/blob/29ec5029af4a7de8709c449090529c4cc63d62b0/ioctl_opt/__init__.py#L97-L104
[ "def", "IOWR", "(", "type", ",", "nr", ",", "size", ")", ":", "return", "IOC", "(", "IOC_READ", "|", "IOC_WRITE", ",", "type", ",", "nr", ",", "IOC_TYPECHECK", "(", "size", ")", ")" ]
29ec5029af4a7de8709c449090529c4cc63d62b0
train
_get_last_dirs
Get a path including only the trailing `num` directories. Returns ------- last_path : str
astrocats/catalog/analysis.py
def _get_last_dirs(path, num=1): """Get a path including only the trailing `num` directories. Returns ------- last_path : str """ head, tail = os.path.split(path) last_path = str(tail) for ii in range(num): head, tail = os.path.split(head) last_path = os.path.join(tail,...
def _get_last_dirs(path, num=1): """Get a path including only the trailing `num` directories. Returns ------- last_path : str """ head, tail = os.path.split(path) last_path = str(tail) for ii in range(num): head, tail = os.path.split(head) last_path = os.path.join(tail,...
[ "Get", "a", "path", "including", "only", "the", "trailing", "num", "directories", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/catalog/analysis.py#L169-L184
[ "def", "_get_last_dirs", "(", "path", ",", "num", "=", "1", ")", ":", "head", ",", "tail", "=", "os", ".", "path", ".", "split", "(", "path", ")", "last_path", "=", "str", "(", "tail", ")", "for", "ii", "in", "range", "(", "num", ")", ":", "hea...
11abc3131c6366ecd23964369e55ff264add7805
train
Analysis.analyze
Run the analysis routines determined from the given `args`.
astrocats/catalog/analysis.py
def analyze(self, args): """Run the analysis routines determined from the given `args`. """ self.log.info("Running catalog analysis") if args.count: self.count() return
def analyze(self, args): """Run the analysis routines determined from the given `args`. """ self.log.info("Running catalog analysis") if args.count: self.count() return
[ "Run", "the", "analysis", "routines", "determined", "from", "the", "given", "args", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/catalog/analysis.py#L34-L42
[ "def", "analyze", "(", "self", ",", "args", ")", ":", "self", ".", "log", ".", "info", "(", "\"Running catalog analysis\"", ")", "if", "args", ".", "count", ":", "self", ".", "count", "(", ")", "return" ]
11abc3131c6366ecd23964369e55ff264add7805
train
Analysis.count
Analyze the counts of ...things. Returns ------- retvals : dict Dictionary of 'property-name: counts' pairs for further processing
astrocats/catalog/analysis.py
def count(self): """Analyze the counts of ...things. Returns ------- retvals : dict Dictionary of 'property-name: counts' pairs for further processing """ self.log.info("Running 'count'") retvals = {} # Numbers of 'tasks' num_tasks =...
def count(self): """Analyze the counts of ...things. Returns ------- retvals : dict Dictionary of 'property-name: counts' pairs for further processing """ self.log.info("Running 'count'") retvals = {} # Numbers of 'tasks' num_tasks =...
[ "Analyze", "the", "counts", "of", "...", "things", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/catalog/analysis.py#L44-L64
[ "def", "count", "(", "self", ")", ":", "self", ".", "log", ".", "info", "(", "\"Running 'count'\"", ")", "retvals", "=", "{", "}", "# Numbers of 'tasks'", "num_tasks", "=", "self", ".", "_count_tasks", "(", ")", "retvals", "[", "'num_tasks'", "]", "=", "...
11abc3131c6366ecd23964369e55ff264add7805
train
Analysis._count_tasks
Count the number of tasks, both in the json and directory. Returns ------- num_tasks : int The total number of all tasks included in the `tasks.json` file.
astrocats/catalog/analysis.py
def _count_tasks(self): """Count the number of tasks, both in the json and directory. Returns ------- num_tasks : int The total number of all tasks included in the `tasks.json` file. """ self.log.warning("Tasks:") tasks, task_names = self.catalog._lo...
def _count_tasks(self): """Count the number of tasks, both in the json and directory. Returns ------- num_tasks : int The total number of all tasks included in the `tasks.json` file. """ self.log.warning("Tasks:") tasks, task_names = self.catalog._lo...
[ "Count", "the", "number", "of", "tasks", "both", "in", "the", "json", "and", "directory", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/catalog/analysis.py#L66-L87
[ "def", "_count_tasks", "(", "self", ")", ":", "self", ".", "log", ".", "warning", "(", "\"Tasks:\"", ")", "tasks", ",", "task_names", "=", "self", ".", "catalog", ".", "_load_task_list_from_file", "(", ")", "# Total number of all tasks", "num_tasks", "=", "len...
11abc3131c6366ecd23964369e55ff264add7805
train
Analysis._count_repo_files
Count the number of files in the data repositories. `_COUNT_FILE_TYPES` are used to determine which file types are checked explicitly. `_IGNORE_FILES` determine which files are ignored in (most) counts. Returns ------- repo_files : int Total number of (non-i...
astrocats/catalog/analysis.py
def _count_repo_files(self): """Count the number of files in the data repositories. `_COUNT_FILE_TYPES` are used to determine which file types are checked explicitly. `_IGNORE_FILES` determine which files are ignored in (most) counts. Returns ------- repo_files ...
def _count_repo_files(self): """Count the number of files in the data repositories. `_COUNT_FILE_TYPES` are used to determine which file types are checked explicitly. `_IGNORE_FILES` determine which files are ignored in (most) counts. Returns ------- repo_files ...
[ "Count", "the", "number", "of", "files", "in", "the", "data", "repositories", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/catalog/analysis.py#L89-L129
[ "def", "_count_repo_files", "(", "self", ")", ":", "self", ".", "log", ".", "warning", "(", "\"Files:\"", ")", "num_files", "=", "0", "repos", "=", "self", ".", "catalog", ".", "PATHS", ".", "get_all_repo_folders", "(", ")", "num_type", "=", "np", ".", ...
11abc3131c6366ecd23964369e55ff264add7805
train
Analysis._file_nums_str
Construct a string showing the number of different file types. Returns ------- f_str : str
astrocats/catalog/analysis.py
def _file_nums_str(self, n_all, n_type, n_ign): """Construct a string showing the number of different file types. Returns ------- f_str : str """ # 'other' is the difference between all and named n_oth = n_all - np.sum(n_type) f_str = "{} Files".format(n...
def _file_nums_str(self, n_all, n_type, n_ign): """Construct a string showing the number of different file types. Returns ------- f_str : str """ # 'other' is the difference between all and named n_oth = n_all - np.sum(n_type) f_str = "{} Files".format(n...
[ "Construct", "a", "string", "showing", "the", "number", "of", "different", "file", "types", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/catalog/analysis.py#L131-L147
[ "def", "_file_nums_str", "(", "self", ",", "n_all", ",", "n_type", ",", "n_ign", ")", ":", "# 'other' is the difference between all and named", "n_oth", "=", "n_all", "-", "np", ".", "sum", "(", "n_type", ")", "f_str", "=", "\"{} Files\"", ".", "format", "(", ...
11abc3131c6366ecd23964369e55ff264add7805
train
Analysis._count_files_by_type
Count files in the given path, with the given pattern. If `ignore = True`, skip files in the `_IGNORE_FILES` list. Returns ------- num_files : int
astrocats/catalog/analysis.py
def _count_files_by_type(self, path, pattern, ignore=True): """Count files in the given path, with the given pattern. If `ignore = True`, skip files in the `_IGNORE_FILES` list. Returns ------- num_files : int """ # Get all files matching the given path and pat...
def _count_files_by_type(self, path, pattern, ignore=True): """Count files in the given path, with the given pattern. If `ignore = True`, skip files in the `_IGNORE_FILES` list. Returns ------- num_files : int """ # Get all files matching the given path and pat...
[ "Count", "files", "in", "the", "given", "path", "with", "the", "given", "pattern", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/catalog/analysis.py#L149-L166
[ "def", "_count_files_by_type", "(", "self", ",", "path", ",", "pattern", ",", "ignore", "=", "True", ")", ":", "# Get all files matching the given path and pattern", "files", "=", "glob", "(", "os", ".", "path", ".", "join", "(", "path", ",", "pattern", ")", ...
11abc3131c6366ecd23964369e55ff264add7805
train
Source.bibcode_from_url
Given a URL, try to find the ADS bibcode. Currently: only `ads` URLs will work, e.g. Returns ------- code : str or 'None' The Bibcode if found, otherwise 'None'
astrocats/catalog/source.py
def bibcode_from_url(cls, url): """Given a URL, try to find the ADS bibcode. Currently: only `ads` URLs will work, e.g. Returns ------- code : str or 'None' The Bibcode if found, otherwise 'None' """ try: code = url.split('/abs/') ...
def bibcode_from_url(cls, url): """Given a URL, try to find the ADS bibcode. Currently: only `ads` URLs will work, e.g. Returns ------- code : str or 'None' The Bibcode if found, otherwise 'None' """ try: code = url.split('/abs/') ...
[ "Given", "a", "URL", "try", "to", "find", "the", "ADS", "bibcode", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/catalog/source.py#L101-L117
[ "def", "bibcode_from_url", "(", "cls", ",", "url", ")", ":", "try", ":", "code", "=", "url", ".", "split", "(", "'/abs/'", ")", "code", "=", "code", "[", "1", "]", ".", "strip", "(", ")", "return", "code", "except", ":", "return", "None" ]
11abc3131c6366ecd23964369e55ff264add7805
train
Entry._get_save_path
Return the path that this Entry should be saved to.
astrocats/catalog/entry.py
def _get_save_path(self, bury=False): """Return the path that this Entry should be saved to.""" filename = self.get_filename(self[self._KEYS.NAME]) # Put objects that shouldn't belong in this catalog in the boneyard if bury: outdir = self.catalog.get_repo_boneyard() ...
def _get_save_path(self, bury=False): """Return the path that this Entry should be saved to.""" filename = self.get_filename(self[self._KEYS.NAME]) # Put objects that shouldn't belong in this catalog in the boneyard if bury: outdir = self.catalog.get_repo_boneyard() ...
[ "Return", "the", "path", "that", "this", "Entry", "should", "be", "saved", "to", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/catalog/entry.py#L173-L197
[ "def", "_get_save_path", "(", "self", ",", "bury", "=", "False", ")", ":", "filename", "=", "self", ".", "get_filename", "(", "self", "[", "self", ".", "_KEYS", ".", "NAME", "]", ")", "# Put objects that shouldn't belong in this catalog in the boneyard", "if", "...
11abc3131c6366ecd23964369e55ff264add7805
train
Entry._ordered
Convert the object into a plain OrderedDict.
astrocats/catalog/entry.py
def _ordered(self, odict): """Convert the object into a plain OrderedDict.""" ndict = OrderedDict() if isinstance(odict, CatDict) or isinstance(odict, Entry): key = odict.sort_func else: key = None nkeys = list(sorted(odict.keys(), key=key)) for ...
def _ordered(self, odict): """Convert the object into a plain OrderedDict.""" ndict = OrderedDict() if isinstance(odict, CatDict) or isinstance(odict, Entry): key = odict.sort_func else: key = None nkeys = list(sorted(odict.keys(), key=key)) for ...
[ "Convert", "the", "object", "into", "a", "plain", "OrderedDict", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/catalog/entry.py#L199-L224
[ "def", "_ordered", "(", "self", ",", "odict", ")", ":", "ndict", "=", "OrderedDict", "(", ")", "if", "isinstance", "(", "odict", ",", "CatDict", ")", "or", "isinstance", "(", "odict", ",", "Entry", ")", ":", "key", "=", "odict", ".", "sort_func", "el...
11abc3131c6366ecd23964369e55ff264add7805
train
Entry.get_hash
Return a unique hash associated with the listed keys.
astrocats/catalog/entry.py
def get_hash(self, keys=[]): """Return a unique hash associated with the listed keys.""" if not len(keys): keys = list(self.keys()) string_rep = '' oself = self._ordered(deepcopy(self)) for key in keys: string_rep += json.dumps(oself.get(key, ''), sort_ke...
def get_hash(self, keys=[]): """Return a unique hash associated with the listed keys.""" if not len(keys): keys = list(self.keys()) string_rep = '' oself = self._ordered(deepcopy(self)) for key in keys: string_rep += json.dumps(oself.get(key, ''), sort_ke...
[ "Return", "a", "unique", "hash", "associated", "with", "the", "listed", "keys", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/catalog/entry.py#L226-L236
[ "def", "get_hash", "(", "self", ",", "keys", "=", "[", "]", ")", ":", "if", "not", "len", "(", "keys", ")", ":", "keys", "=", "list", "(", "self", ".", "keys", "(", ")", ")", "string_rep", "=", "''", "oself", "=", "self", ".", "_ordered", "(", ...
11abc3131c6366ecd23964369e55ff264add7805
train
Entry._clean_quantity
Clean quantity value before it is added to entry.
astrocats/catalog/entry.py
def _clean_quantity(self, quantity): """Clean quantity value before it is added to entry.""" value = quantity.get(QUANTITY.VALUE, '').strip() error = quantity.get(QUANTITY.E_VALUE, '').strip() unit = quantity.get(QUANTITY.U_VALUE, '').strip() kind = quantity.get(QUANTITY.KIND, ''...
def _clean_quantity(self, quantity): """Clean quantity value before it is added to entry.""" value = quantity.get(QUANTITY.VALUE, '').strip() error = quantity.get(QUANTITY.E_VALUE, '').strip() unit = quantity.get(QUANTITY.U_VALUE, '').strip() kind = quantity.get(QUANTITY.KIND, ''...
[ "Clean", "quantity", "value", "before", "it", "is", "added", "to", "entry", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/catalog/entry.py#L238-L267
[ "def", "_clean_quantity", "(", "self", ",", "quantity", ")", ":", "value", "=", "quantity", ".", "get", "(", "QUANTITY", ".", "VALUE", ",", "''", ")", ".", "strip", "(", ")", "error", "=", "quantity", ".", "get", "(", "QUANTITY", ".", "E_VALUE", ",",...
11abc3131c6366ecd23964369e55ff264add7805
train
Entry._convert_odict_to_classes
Convert `OrderedDict` into `Entry` or its derivative classes.
astrocats/catalog/entry.py
def _convert_odict_to_classes(self, data, clean=False, merge=True, pop_schema=True, compare_to_existing=True, filter...
def _convert_odict_to_classes(self, data, clean=False, merge=True, pop_schema=True, compare_to_existing=True, filter...
[ "Convert", "OrderedDict", "into", "Entry", "or", "its", "derivative", "classes", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/catalog/entry.py#L346-L485
[ "def", "_convert_odict_to_classes", "(", "self", ",", "data", ",", "clean", "=", "False", ",", "merge", "=", "True", ",", "pop_schema", "=", "True", ",", "compare_to_existing", "=", "True", ",", "filter_on", "=", "{", "}", ")", ":", "self", ".", "_log", ...
11abc3131c6366ecd23964369e55ff264add7805
train
Entry._check_cat_dict_source
Check that a source exists and that a quantity isn't erroneous.
astrocats/catalog/entry.py
def _check_cat_dict_source(self, cat_dict_class, key_in_self, **kwargs): """Check that a source exists and that a quantity isn't erroneous.""" # Make sure that a source is given source = kwargs.get(cat_dict_class._KEYS.SOURCE, None) if source is None: raise CatDictError( ...
def _check_cat_dict_source(self, cat_dict_class, key_in_self, **kwargs): """Check that a source exists and that a quantity isn't erroneous.""" # Make sure that a source is given source = kwargs.get(cat_dict_class._KEYS.SOURCE, None) if source is None: raise CatDictError( ...
[ "Check", "that", "a", "source", "exists", "and", "that", "a", "quantity", "isn", "t", "erroneous", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/catalog/entry.py#L487-L511
[ "def", "_check_cat_dict_source", "(", "self", ",", "cat_dict_class", ",", "key_in_self", ",", "*", "*", "kwargs", ")", ":", "# Make sure that a source is given", "source", "=", "kwargs", ".", "get", "(", "cat_dict_class", ".", "_KEYS", ".", "SOURCE", ",", "None"...
11abc3131c6366ecd23964369e55ff264add7805
train
Entry._add_cat_dict
Add a `CatDict` to this `Entry`. CatDict only added if initialization succeeds and it doesn't already exist within the Entry.
astrocats/catalog/entry.py
def _add_cat_dict(self, cat_dict_class, key_in_self, check_for_dupes=True, compare_to_existing=True, **kwargs): """Add a `CatDict` to this `Entry`. CatDict only added if initialization succeeds...
def _add_cat_dict(self, cat_dict_class, key_in_self, check_for_dupes=True, compare_to_existing=True, **kwargs): """Add a `CatDict` to this `Entry`. CatDict only added if initialization succeeds...
[ "Add", "a", "CatDict", "to", "this", "Entry", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/catalog/entry.py#L525-L586
[ "def", "_add_cat_dict", "(", "self", ",", "cat_dict_class", ",", "key_in_self", ",", "check_for_dupes", "=", "True", ",", "compare_to_existing", "=", "True", ",", "*", "*", "kwargs", ")", ":", "# Make sure that a source is given, and is valid (nor erroneous)", "if", "...
11abc3131c6366ecd23964369e55ff264add7805
train
Entry.init_from_file
Construct a new `Entry` instance from an input file. The input file can be given explicitly by `path`, or a path will be constructed appropriately if possible. Arguments --------- catalog : `astrocats.catalog.catalog.Catalog` instance The parent catalog object of wh...
astrocats/catalog/entry.py
def init_from_file(cls, catalog, name=None, path=None, clean=False, merge=True, pop_schema=True, ignore_keys=[], compare_to_existing=Tru...
def init_from_file(cls, catalog, name=None, path=None, clean=False, merge=True, pop_schema=True, ignore_keys=[], compare_to_existing=Tru...
[ "Construct", "a", "new", "Entry", "instance", "from", "an", "input", "file", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/catalog/entry.py#L595-L678
[ "def", "init_from_file", "(", "cls", ",", "catalog", ",", "name", "=", "None", ",", "path", "=", "None", ",", "clean", "=", "False", ",", "merge", "=", "True", ",", "pop_schema", "=", "True", ",", "ignore_keys", "=", "[", "]", ",", "compare_to_existing...
11abc3131c6366ecd23964369e55ff264add7805
train
Entry.add_alias
Add an alias, optionally 'cleaning' the alias string. Calls the parent `catalog` method `clean_entry_name` - to apply the same name-cleaning as is applied to entry names themselves. Returns ------- alias : str The stored version of the alias (cleaned or not).
astrocats/catalog/entry.py
def add_alias(self, alias, source, clean=True): """Add an alias, optionally 'cleaning' the alias string. Calls the parent `catalog` method `clean_entry_name` - to apply the same name-cleaning as is applied to entry names themselves. Returns ------- alias : str ...
def add_alias(self, alias, source, clean=True): """Add an alias, optionally 'cleaning' the alias string. Calls the parent `catalog` method `clean_entry_name` - to apply the same name-cleaning as is applied to entry names themselves. Returns ------- alias : str ...
[ "Add", "an", "alias", "optionally", "cleaning", "the", "alias", "string", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/catalog/entry.py#L680-L695
[ "def", "add_alias", "(", "self", ",", "alias", ",", "source", ",", "clean", "=", "True", ")", ":", "if", "clean", ":", "alias", "=", "self", ".", "catalog", ".", "clean_entry_name", "(", "alias", ")", "self", ".", "add_quantity", "(", "self", ".", "_...
11abc3131c6366ecd23964369e55ff264add7805
train
Entry.add_error
Add an `Error` instance to this entry.
astrocats/catalog/entry.py
def add_error(self, value, **kwargs): """Add an `Error` instance to this entry.""" kwargs.update({ERROR.VALUE: value}) self._add_cat_dict(Error, self._KEYS.ERRORS, **kwargs) return
def add_error(self, value, **kwargs): """Add an `Error` instance to this entry.""" kwargs.update({ERROR.VALUE: value}) self._add_cat_dict(Error, self._KEYS.ERRORS, **kwargs) return
[ "Add", "an", "Error", "instance", "to", "this", "entry", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/catalog/entry.py#L697-L701
[ "def", "add_error", "(", "self", ",", "value", ",", "*", "*", "kwargs", ")", ":", "kwargs", ".", "update", "(", "{", "ERROR", ".", "VALUE", ":", "value", "}", ")", "self", ".", "_add_cat_dict", "(", "Error", ",", "self", ".", "_KEYS", ".", "ERRORS"...
11abc3131c6366ecd23964369e55ff264add7805
train
Entry.add_photometry
Add a `Photometry` instance to this entry.
astrocats/catalog/entry.py
def add_photometry(self, compare_to_existing=True, **kwargs): """Add a `Photometry` instance to this entry.""" self._add_cat_dict( Photometry, self._KEYS.PHOTOMETRY, compare_to_existing=compare_to_existing, **kwargs) return
def add_photometry(self, compare_to_existing=True, **kwargs): """Add a `Photometry` instance to this entry.""" self._add_cat_dict( Photometry, self._KEYS.PHOTOMETRY, compare_to_existing=compare_to_existing, **kwargs) return
[ "Add", "a", "Photometry", "instance", "to", "this", "entry", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/catalog/entry.py#L703-L710
[ "def", "add_photometry", "(", "self", ",", "compare_to_existing", "=", "True", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_add_cat_dict", "(", "Photometry", ",", "self", ".", "_KEYS", ".", "PHOTOMETRY", ",", "compare_to_existing", "=", "compare_to_existi...
11abc3131c6366ecd23964369e55ff264add7805
train
Entry.merge_dupes
Merge two entries that correspond to the same entry.
astrocats/catalog/entry.py
def merge_dupes(self): """Merge two entries that correspond to the same entry.""" for dupe in self.dupe_of: if dupe in self.catalog.entries: if self.catalog.entries[dupe]._stub: # merge = False to avoid infinite recursion self.catalog.l...
def merge_dupes(self): """Merge two entries that correspond to the same entry.""" for dupe in self.dupe_of: if dupe in self.catalog.entries: if self.catalog.entries[dupe]._stub: # merge = False to avoid infinite recursion self.catalog.l...
[ "Merge", "two", "entries", "that", "correspond", "to", "the", "same", "entry", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/catalog/entry.py#L712-L723
[ "def", "merge_dupes", "(", "self", ")", ":", "for", "dupe", "in", "self", ".", "dupe_of", ":", "if", "dupe", "in", "self", ".", "catalog", ".", "entries", ":", "if", "self", ".", "catalog", ".", "entries", "[", "dupe", "]", ".", "_stub", ":", "# me...
11abc3131c6366ecd23964369e55ff264add7805
train
Entry.add_quantity
Add an `Quantity` instance to this entry.
astrocats/catalog/entry.py
def add_quantity(self, quantities, value, source, check_for_dupes=True, compare_to_existing=True, **kwargs): """Add an `Quantity` instance to this entry.""" success = True ...
def add_quantity(self, quantities, value, source, check_for_dupes=True, compare_to_existing=True, **kwargs): """Add an `Quantity` instance to this entry.""" success = True ...
[ "Add", "an", "Quantity", "instance", "to", "this", "entry", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/catalog/entry.py#L725-L746
[ "def", "add_quantity", "(", "self", ",", "quantities", ",", "value", ",", "source", ",", "check_for_dupes", "=", "True", ",", "compare_to_existing", "=", "True", ",", "*", "*", "kwargs", ")", ":", "success", "=", "True", "for", "quantity", "in", "listify",...
11abc3131c6366ecd23964369e55ff264add7805
train
Entry.add_self_source
Add a source that refers to the catalog itself. For now this points to the Open Supernova Catalog by default.
astrocats/catalog/entry.py
def add_self_source(self): """Add a source that refers to the catalog itself. For now this points to the Open Supernova Catalog by default. """ return self.add_source( bibcode=self.catalog.OSC_BIBCODE, name=self.catalog.OSC_NAME, url=self.catalog.OSC_...
def add_self_source(self): """Add a source that refers to the catalog itself. For now this points to the Open Supernova Catalog by default. """ return self.add_source( bibcode=self.catalog.OSC_BIBCODE, name=self.catalog.OSC_NAME, url=self.catalog.OSC_...
[ "Add", "a", "source", "that", "refers", "to", "the", "catalog", "itself", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/catalog/entry.py#L748-L757
[ "def", "add_self_source", "(", "self", ")", ":", "return", "self", ".", "add_source", "(", "bibcode", "=", "self", ".", "catalog", ".", "OSC_BIBCODE", ",", "name", "=", "self", ".", "catalog", ".", "OSC_NAME", ",", "url", "=", "self", ".", "catalog", "...
11abc3131c6366ecd23964369e55ff264add7805
train
Entry.add_source
Add a `Source` instance to this entry.
astrocats/catalog/entry.py
def add_source(self, allow_alias=False, **kwargs): """Add a `Source` instance to this entry.""" if not allow_alias and SOURCE.ALIAS in kwargs: err_str = "`{}` passed in kwargs, this shouldn't happen!".format( SOURCE.ALIAS) self._log.error(err_str) rais...
def add_source(self, allow_alias=False, **kwargs): """Add a `Source` instance to this entry.""" if not allow_alias and SOURCE.ALIAS in kwargs: err_str = "`{}` passed in kwargs, this shouldn't happen!".format( SOURCE.ALIAS) self._log.error(err_str) rais...
[ "Add", "a", "Source", "instance", "to", "this", "entry", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/catalog/entry.py#L759-L779
[ "def", "add_source", "(", "self", ",", "allow_alias", "=", "False", ",", "*", "*", "kwargs", ")", ":", "if", "not", "allow_alias", "and", "SOURCE", ".", "ALIAS", "in", "kwargs", ":", "err_str", "=", "\"`{}` passed in kwargs, this shouldn't happen!\"", ".", "fo...
11abc3131c6366ecd23964369e55ff264add7805
train
Entry.add_model
Add a `Model` instance to this entry.
astrocats/catalog/entry.py
def add_model(self, allow_alias=False, **kwargs): """Add a `Model` instance to this entry.""" if not allow_alias and MODEL.ALIAS in kwargs: err_str = "`{}` passed in kwargs, this shouldn't happen!".format( SOURCE.ALIAS) self._log.error(err_str) raise R...
def add_model(self, allow_alias=False, **kwargs): """Add a `Model` instance to this entry.""" if not allow_alias and MODEL.ALIAS in kwargs: err_str = "`{}` passed in kwargs, this shouldn't happen!".format( SOURCE.ALIAS) self._log.error(err_str) raise R...
[ "Add", "a", "Model", "instance", "to", "this", "entry", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/catalog/entry.py#L781-L801
[ "def", "add_model", "(", "self", ",", "allow_alias", "=", "False", ",", "*", "*", "kwargs", ")", ":", "if", "not", "allow_alias", "and", "MODEL", ".", "ALIAS", "in", "kwargs", ":", "err_str", "=", "\"`{}` passed in kwargs, this shouldn't happen!\"", ".", "form...
11abc3131c6366ecd23964369e55ff264add7805
train
Entry.add_spectrum
Add a `Spectrum` instance to this entry.
astrocats/catalog/entry.py
def add_spectrum(self, compare_to_existing=True, **kwargs): """Add a `Spectrum` instance to this entry.""" spec_key = self._KEYS.SPECTRA # Make sure that a source is given, and is valid (nor erroneous) source = self._check_cat_dict_source(Spectrum, spec_key, **kwargs) if source i...
def add_spectrum(self, compare_to_existing=True, **kwargs): """Add a `Spectrum` instance to this entry.""" spec_key = self._KEYS.SPECTRA # Make sure that a source is given, and is valid (nor erroneous) source = self._check_cat_dict_source(Spectrum, spec_key, **kwargs) if source i...
[ "Add", "a", "Spectrum", "instance", "to", "this", "entry", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/catalog/entry.py#L803-L831
[ "def", "add_spectrum", "(", "self", ",", "compare_to_existing", "=", "True", ",", "*", "*", "kwargs", ")", ":", "spec_key", "=", "self", ".", "_KEYS", ".", "SPECTRA", "# Make sure that a source is given, and is valid (nor erroneous)", "source", "=", "self", ".", "...
11abc3131c6366ecd23964369e55ff264add7805
train
Entry.check
Check that the entry has the required fields.
astrocats/catalog/entry.py
def check(self): """Check that the entry has the required fields.""" # Make sure there is a schema key in dict if self._KEYS.SCHEMA not in self: self[self._KEYS.SCHEMA] = self.catalog.SCHEMA.URL # Make sure there is a name key in dict if (self._KEYS.NAME not in self o...
def check(self): """Check that the entry has the required fields.""" # Make sure there is a schema key in dict if self._KEYS.SCHEMA not in self: self[self._KEYS.SCHEMA] = self.catalog.SCHEMA.URL # Make sure there is a name key in dict if (self._KEYS.NAME not in self o...
[ "Check", "that", "the", "entry", "has", "the", "required", "fields", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/catalog/entry.py#L833-L843
[ "def", "check", "(", "self", ")", ":", "# Make sure there is a schema key in dict", "if", "self", ".", "_KEYS", ".", "SCHEMA", "not", "in", "self", ":", "self", "[", "self", ".", "_KEYS", ".", "SCHEMA", "]", "=", "self", ".", "catalog", ".", "SCHEMA", "....
11abc3131c6366ecd23964369e55ff264add7805
train
Entry.get_aliases
Retrieve the aliases of this object as a list of strings. Arguments --------- includename : bool Include the 'name' parameter in the list of aliases.
astrocats/catalog/entry.py
def get_aliases(self, includename=True): """Retrieve the aliases of this object as a list of strings. Arguments --------- includename : bool Include the 'name' parameter in the list of aliases. """ # empty list if doesnt exist alias_quanta = self.get(...
def get_aliases(self, includename=True): """Retrieve the aliases of this object as a list of strings. Arguments --------- includename : bool Include the 'name' parameter in the list of aliases. """ # empty list if doesnt exist alias_quanta = self.get(...
[ "Retrieve", "the", "aliases", "of", "this", "object", "as", "a", "list", "of", "strings", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/catalog/entry.py#L856-L869
[ "def", "get_aliases", "(", "self", ",", "includename", "=", "True", ")", ":", "# empty list if doesnt exist", "alias_quanta", "=", "self", ".", "get", "(", "self", ".", "_KEYS", ".", "ALIAS", ",", "[", "]", ")", "aliases", "=", "[", "aq", "[", "QUANTITY"...
11abc3131c6366ecd23964369e55ff264add7805
train
Entry.get_entry_text
Retrieve the raw text from a file.
astrocats/catalog/entry.py
def get_entry_text(self, fname): """Retrieve the raw text from a file.""" if fname.split('.')[-1] == 'gz': with gz.open(fname, 'rt') as f: filetext = f.read() else: with codecs.open(fname, 'r') as f: filetext = f.read() return filet...
def get_entry_text(self, fname): """Retrieve the raw text from a file.""" if fname.split('.')[-1] == 'gz': with gz.open(fname, 'rt') as f: filetext = f.read() else: with codecs.open(fname, 'r') as f: filetext = f.read() return filet...
[ "Retrieve", "the", "raw", "text", "from", "a", "file", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/catalog/entry.py#L871-L879
[ "def", "get_entry_text", "(", "self", ",", "fname", ")", ":", "if", "fname", ".", "split", "(", "'.'", ")", "[", "-", "1", "]", "==", "'gz'", ":", "with", "gz", ".", "open", "(", "fname", ",", "'rt'", ")", "as", "f", ":", "filetext", "=", "f", ...
11abc3131c6366ecd23964369e55ff264add7805
train
Entry.get_source_by_alias
Given an alias, find the corresponding source in this entry. If the given alias doesn't exist (e.g. there are no sources), then a `ValueError` is raised. Arguments --------- alias : str The str-integer (e.g. '8') of the target source. Returns ------...
astrocats/catalog/entry.py
def get_source_by_alias(self, alias): """Given an alias, find the corresponding source in this entry. If the given alias doesn't exist (e.g. there are no sources), then a `ValueError` is raised. Arguments --------- alias : str The str-integer (e.g. '8') of t...
def get_source_by_alias(self, alias): """Given an alias, find the corresponding source in this entry. If the given alias doesn't exist (e.g. there are no sources), then a `ValueError` is raised. Arguments --------- alias : str The str-integer (e.g. '8') of t...
[ "Given", "an", "alias", "find", "the", "corresponding", "source", "in", "this", "entry", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/catalog/entry.py#L881-L902
[ "def", "get_source_by_alias", "(", "self", ",", "alias", ")", ":", "for", "source", "in", "self", ".", "get", "(", "self", ".", "_KEYS", ".", "SOURCES", ",", "[", "]", ")", ":", "if", "source", "[", "self", ".", "_KEYS", ".", "ALIAS", "]", "==", ...
11abc3131c6366ecd23964369e55ff264add7805
train
Entry.get_stub
Get a new `Entry` which contains the 'stub' of this one. The 'stub' is only the name and aliases. Usage: ----- To convert a normal entry into a stub (for example), overwrite the entry in place, i.e. >>> entries[name] = entries[name].get_stub() Returns -...
astrocats/catalog/entry.py
def get_stub(self): """Get a new `Entry` which contains the 'stub' of this one. The 'stub' is only the name and aliases. Usage: ----- To convert a normal entry into a stub (for example), overwrite the entry in place, i.e. >>> entries[name] = entries[name].get_st...
def get_stub(self): """Get a new `Entry` which contains the 'stub' of this one. The 'stub' is only the name and aliases. Usage: ----- To convert a normal entry into a stub (for example), overwrite the entry in place, i.e. >>> entries[name] = entries[name].get_st...
[ "Get", "a", "new", "Entry", "which", "contains", "the", "stub", "of", "this", "one", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/catalog/entry.py#L904-L934
[ "def", "get_stub", "(", "self", ")", ":", "stub", "=", "type", "(", "self", ")", "(", "self", ".", "catalog", ",", "self", "[", "self", ".", "_KEYS", ".", "NAME", "]", ",", "stub", "=", "True", ")", "if", "self", ".", "_KEYS", ".", "ALIAS", "in...
11abc3131c6366ecd23964369e55ff264add7805
train
Entry.is_erroneous
Check if attribute has been marked as being erroneous.
astrocats/catalog/entry.py
def is_erroneous(self, field, sources): """Check if attribute has been marked as being erroneous.""" if self._KEYS.ERRORS in self: my_errors = self[self._KEYS.ERRORS] for alias in sources.split(','): source = self.get_source_by_alias(alias) bib_err...
def is_erroneous(self, field, sources): """Check if attribute has been marked as being erroneous.""" if self._KEYS.ERRORS in self: my_errors = self[self._KEYS.ERRORS] for alias in sources.split(','): source = self.get_source_by_alias(alias) bib_err...
[ "Check", "if", "attribute", "has", "been", "marked", "as", "being", "erroneous", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/catalog/entry.py#L936-L960
[ "def", "is_erroneous", "(", "self", ",", "field", ",", "sources", ")", ":", "if", "self", ".", "_KEYS", ".", "ERRORS", "in", "self", ":", "my_errors", "=", "self", "[", "self", ".", "_KEYS", ".", "ERRORS", "]", "for", "alias", "in", "sources", ".", ...
11abc3131c6366ecd23964369e55ff264add7805
train
Entry.is_private
Check if attribute is private.
astrocats/catalog/entry.py
def is_private(self, key, sources): """Check if attribute is private.""" # aliases are always public. if key == ENTRY.ALIAS: return False return all([ SOURCE.PRIVATE in self.get_source_by_alias(x) for x in sources.split(',') ])
def is_private(self, key, sources): """Check if attribute is private.""" # aliases are always public. if key == ENTRY.ALIAS: return False return all([ SOURCE.PRIVATE in self.get_source_by_alias(x) for x in sources.split(',') ])
[ "Check", "if", "attribute", "is", "private", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/catalog/entry.py#L962-L970
[ "def", "is_private", "(", "self", ",", "key", ",", "sources", ")", ":", "# aliases are always public.", "if", "key", "==", "ENTRY", ".", "ALIAS", ":", "return", "False", "return", "all", "(", "[", "SOURCE", ".", "PRIVATE", "in", "self", ".", "get_source_by...
11abc3131c6366ecd23964369e55ff264add7805
train
Entry.sanitize
Sanitize the data (sort it, etc.) before writing it to disk. Template method that can be overridden in each catalog's subclassed `Entry` object.
astrocats/catalog/entry.py
def sanitize(self): """Sanitize the data (sort it, etc.) before writing it to disk. Template method that can be overridden in each catalog's subclassed `Entry` object. """ name = self[self._KEYS.NAME] aliases = self.get_aliases(includename=False) if name not in ...
def sanitize(self): """Sanitize the data (sort it, etc.) before writing it to disk. Template method that can be overridden in each catalog's subclassed `Entry` object. """ name = self[self._KEYS.NAME] aliases = self.get_aliases(includename=False) if name not in ...
[ "Sanitize", "the", "data", "(", "sort", "it", "etc", ".", ")", "before", "writing", "it", "to", "disk", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/catalog/entry.py#L1003-L1086
[ "def", "sanitize", "(", "self", ")", ":", "name", "=", "self", "[", "self", ".", "_KEYS", ".", "NAME", "]", "aliases", "=", "self", ".", "get_aliases", "(", "includename", "=", "False", ")", "if", "name", "not", "in", "aliases", ":", "# Assign the firs...
11abc3131c6366ecd23964369e55ff264add7805
train
Entry.save
Write entry to JSON file in the proper location. Arguments --------- bury : bool final : bool If this is the 'final' save, perform additional sanitization and cleaning operations.
astrocats/catalog/entry.py
def save(self, bury=False, final=False): """Write entry to JSON file in the proper location. Arguments --------- bury : bool final : bool If this is the 'final' save, perform additional sanitization and cleaning operations. """ outdir, f...
def save(self, bury=False, final=False): """Write entry to JSON file in the proper location. Arguments --------- bury : bool final : bool If this is the 'final' save, perform additional sanitization and cleaning operations. """ outdir, f...
[ "Write", "entry", "to", "JSON", "file", "in", "the", "proper", "location", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/catalog/entry.py#L1088-L1124
[ "def", "save", "(", "self", ",", "bury", "=", "False", ",", "final", "=", "False", ")", ":", "outdir", ",", "filename", "=", "self", ".", "_get_save_path", "(", "bury", "=", "bury", ")", "if", "final", ":", "self", ".", "sanitize", "(", ")", "# FIX...
11abc3131c6366ecd23964369e55ff264add7805
train
Entry.sort_func
Used to sort keys when writing Entry to JSON format. Should be supplemented/overridden by inheriting classes.
astrocats/catalog/entry.py
def sort_func(self, key): """Used to sort keys when writing Entry to JSON format. Should be supplemented/overridden by inheriting classes. """ if key == self._KEYS.SCHEMA: return 'aaa' if key == self._KEYS.NAME: return 'aab' if key == self._KEYS.S...
def sort_func(self, key): """Used to sort keys when writing Entry to JSON format. Should be supplemented/overridden by inheriting classes. """ if key == self._KEYS.SCHEMA: return 'aaa' if key == self._KEYS.NAME: return 'aab' if key == self._KEYS.S...
[ "Used", "to", "sort", "keys", "when", "writing", "Entry", "to", "JSON", "format", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/catalog/entry.py#L1130-L1149
[ "def", "sort_func", "(", "self", ",", "key", ")", ":", "if", "key", "==", "self", ".", "_KEYS", ".", "SCHEMA", ":", "return", "'aaa'", "if", "key", "==", "self", ".", "_KEYS", ".", "NAME", ":", "return", "'aab'", "if", "key", "==", "self", ".", "...
11abc3131c6366ecd23964369e55ff264add7805
train
set_pd_mag_from_counts
Set photometry dictionary from a counts measurement.
astrocats/catalog/photometry.py
def set_pd_mag_from_counts(photodict, c='', ec='', lec='', uec='', zp=DEFAULT_ZP, sig=DEFAULT_UL_SIGMA): """Set photometry dictionary from a counts measur...
def set_pd_mag_from_counts(photodict, c='', ec='', lec='', uec='', zp=DEFAULT_ZP, sig=DEFAULT_UL_SIGMA): """Set photometry dictionary from a counts measur...
[ "Set", "photometry", "dictionary", "from", "a", "counts", "measurement", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/catalog/photometry.py#L421-L459
[ "def", "set_pd_mag_from_counts", "(", "photodict", ",", "c", "=", "''", ",", "ec", "=", "''", ",", "lec", "=", "''", ",", "uec", "=", "''", ",", "zp", "=", "DEFAULT_ZP", ",", "sig", "=", "DEFAULT_UL_SIGMA", ")", ":", "with", "localcontext", "(", ")",...
11abc3131c6366ecd23964369e55ff264add7805
train
set_pd_mag_from_flux_density
Set photometry dictionary from a flux density measurement. `fd` is assumed to be in microjanskys.
astrocats/catalog/photometry.py
def set_pd_mag_from_flux_density(photodict, fd='', efd='', lefd='', uefd='', sig=DEFAULT_UL_SIGMA): """Set photometry dictionary from a flux density me...
def set_pd_mag_from_flux_density(photodict, fd='', efd='', lefd='', uefd='', sig=DEFAULT_UL_SIGMA): """Set photometry dictionary from a flux density me...
[ "Set", "photometry", "dictionary", "from", "a", "flux", "density", "measurement", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/catalog/photometry.py#L462-L500
[ "def", "set_pd_mag_from_flux_density", "(", "photodict", ",", "fd", "=", "''", ",", "efd", "=", "''", ",", "lefd", "=", "''", ",", "uefd", "=", "''", ",", "sig", "=", "DEFAULT_UL_SIGMA", ")", ":", "with", "localcontext", "(", ")", "as", "ctx", ":", "...
11abc3131c6366ecd23964369e55ff264add7805
train
Photometry._check
Check that entry attributes are legal.
astrocats/catalog/photometry.py
def _check(self): """Check that entry attributes are legal.""" # Run the super method super(Photometry, self)._check() err_str = None has_flux = self._KEYS.FLUX in self has_flux_dens = self._KEYS.FLUX_DENSITY in self has_u_flux = self._KEYS.U_FLUX in self ...
def _check(self): """Check that entry attributes are legal.""" # Run the super method super(Photometry, self)._check() err_str = None has_flux = self._KEYS.FLUX in self has_flux_dens = self._KEYS.FLUX_DENSITY in self has_u_flux = self._KEYS.U_FLUX in self ...
[ "Check", "that", "entry", "attributes", "are", "legal", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/catalog/photometry.py#L168-L208
[ "def", "_check", "(", "self", ")", ":", "# Run the super method", "super", "(", "Photometry", ",", "self", ")", ".", "_check", "(", ")", "err_str", "=", "None", "has_flux", "=", "self", ".", "_KEYS", ".", "FLUX", "in", "self", "has_flux_dens", "=", "self...
11abc3131c6366ecd23964369e55ff264add7805
train
Photometry.sort_func
Specify order for attributes.
astrocats/catalog/photometry.py
def sort_func(self, key): """Specify order for attributes.""" if key == self._KEYS.TIME: return 'aaa' if key == self._KEYS.MODEL: return 'zzy' if key == self._KEYS.SOURCE: return 'zzz' return key
def sort_func(self, key): """Specify order for attributes.""" if key == self._KEYS.TIME: return 'aaa' if key == self._KEYS.MODEL: return 'zzy' if key == self._KEYS.SOURCE: return 'zzz' return key
[ "Specify", "order", "for", "attributes", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/catalog/photometry.py#L221-L229
[ "def", "sort_func", "(", "self", ",", "key", ")", ":", "if", "key", "==", "self", ".", "_KEYS", ".", "TIME", ":", "return", "'aaa'", "if", "key", "==", "self", ".", "_KEYS", ".", "MODEL", ":", "return", "'zzy'", "if", "key", "==", "self", ".", "_...
11abc3131c6366ecd23964369e55ff264add7805
train
run_migrations_offline
Run migrations in 'offline' mode. This configures the context with just a URL and not an Engine, though an Engine is acceptable here as well. By skipping the Engine creation we don't even need a DBAPI to be available. Calls to context.execute() here emit the given string to the script output.
ziggurat_foundations/migrations/env.py
def run_migrations_offline(): """Run migrations in 'offline' mode. This configures the context with just a URL and not an Engine, though an Engine is acceptable here as well. By skipping the Engine creation we don't even need a DBAPI to be available. Calls to context.execute() here emit the g...
def run_migrations_offline(): """Run migrations in 'offline' mode. This configures the context with just a URL and not an Engine, though an Engine is acceptable here as well. By skipping the Engine creation we don't even need a DBAPI to be available. Calls to context.execute() here emit the g...
[ "Run", "migrations", "in", "offline", "mode", "." ]
ergo/ziggurat_foundations
python
https://github.com/ergo/ziggurat_foundations/blob/9eeec894d08e8d7defa60ddc04b63f69cd4cbeba/ziggurat_foundations/migrations/env.py#L51-L71
[ "def", "run_migrations_offline", "(", ")", ":", "url", "=", "get_url", "(", ")", "context", ".", "configure", "(", "url", "=", "url", ",", "version_table", "=", "\"alembic_ziggurat_foundations_version\"", ",", "transaction_per_migration", "=", "True", ",", ")", ...
9eeec894d08e8d7defa60ddc04b63f69cd4cbeba
train
run_migrations_online
Run migrations in 'online' mode. In this scenario we need to create an Engine and associate a connection with the context.
ziggurat_foundations/migrations/env.py
def run_migrations_online(): """Run migrations in 'online' mode. In this scenario we need to create an Engine and associate a connection with the context. """ engine = create_engine(get_url()) connection = engine.connect() context.configure( connection=connection, target_m...
def run_migrations_online(): """Run migrations in 'online' mode. In this scenario we need to create an Engine and associate a connection with the context. """ engine = create_engine(get_url()) connection = engine.connect() context.configure( connection=connection, target_m...
[ "Run", "migrations", "in", "online", "mode", "." ]
ergo/ziggurat_foundations
python
https://github.com/ergo/ziggurat_foundations/blob/9eeec894d08e8d7defa60ddc04b63f69cd4cbeba/ziggurat_foundations/migrations/env.py#L74-L95
[ "def", "run_migrations_online", "(", ")", ":", "engine", "=", "create_engine", "(", "get_url", "(", ")", ")", "connection", "=", "engine", ".", "connect", "(", ")", "context", ".", "configure", "(", "connection", "=", "connection", ",", "target_metadata", "=...
9eeec894d08e8d7defa60ddc04b63f69cd4cbeba
train
UserResourcePermissionService.by_resource_user_and_perm
return all instances by user name, perm name and resource id :param user_id: :param perm_name: :param resource_id: :param db_session: :return:
ziggurat_foundations/models/services/user_resource_permission.py
def by_resource_user_and_perm( cls, user_id, perm_name, resource_id, db_session=None ): """ return all instances by user name, perm name and resource id :param user_id: :param perm_name: :param resource_id: :param db_session: :return: """ ...
def by_resource_user_and_perm( cls, user_id, perm_name, resource_id, db_session=None ): """ return all instances by user name, perm name and resource id :param user_id: :param perm_name: :param resource_id: :param db_session: :return: """ ...
[ "return", "all", "instances", "by", "user", "name", "perm", "name", "and", "resource", "id" ]
ergo/ziggurat_foundations
python
https://github.com/ergo/ziggurat_foundations/blob/9eeec894d08e8d7defa60ddc04b63f69cd4cbeba/ziggurat_foundations/models/services/user_resource_permission.py#L27-L44
[ "def", "by_resource_user_and_perm", "(", "cls", ",", "user_id", ",", "perm_name", ",", "resource_id", ",", "db_session", "=", "None", ")", ":", "db_session", "=", "get_db_session", "(", "db_session", ")", "query", "=", "db_session", ".", "query", "(", "cls", ...
9eeec894d08e8d7defa60ddc04b63f69cd4cbeba
train
Library.tdSensor
Get the next sensor while iterating. :return: a dict with the keys: protocol, model, id, datatypes.
tellcore/library.py
def tdSensor(self): """Get the next sensor while iterating. :return: a dict with the keys: protocol, model, id, datatypes. """ protocol = create_string_buffer(20) model = create_string_buffer(20) sid = c_int() datatypes = c_int() self._lib.tdSensor(proto...
def tdSensor(self): """Get the next sensor while iterating. :return: a dict with the keys: protocol, model, id, datatypes. """ protocol = create_string_buffer(20) model = create_string_buffer(20) sid = c_int() datatypes = c_int() self._lib.tdSensor(proto...
[ "Get", "the", "next", "sensor", "while", "iterating", "." ]
erijo/tellcore-py
python
https://github.com/erijo/tellcore-py/blob/7a1eb53e12ef039a2350933e502633df7560f6a8/tellcore/library.py#L409-L423
[ "def", "tdSensor", "(", "self", ")", ":", "protocol", "=", "create_string_buffer", "(", "20", ")", "model", "=", "create_string_buffer", "(", "20", ")", "sid", "=", "c_int", "(", ")", "datatypes", "=", "c_int", "(", ")", "self", ".", "_lib", ".", "tdSe...
7a1eb53e12ef039a2350933e502633df7560f6a8