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
is_bool_list
Check that the value is a list of booleans. You can optionally specify the minimum and maximum number of members. Each list member is checked that it is a boolean. >>> vtor = Validator() >>> vtor.check('bool_list', ()) [] >>> vtor.check('bool_list', []) [] >>> check_res = vtor.check('...
lib/stsci/tools/validate.py
def is_bool_list(value, min=None, max=None): """ Check that the value is a list of booleans. You can optionally specify the minimum and maximum number of members. Each list member is checked that it is a boolean. >>> vtor = Validator() >>> vtor.check('bool_list', ()) [] >>> vtor.check...
def is_bool_list(value, min=None, max=None): """ Check that the value is a list of booleans. You can optionally specify the minimum and maximum number of members. Each list member is checked that it is a boolean. >>> vtor = Validator() >>> vtor.check('bool_list', ()) [] >>> vtor.check...
[ "Check", "that", "the", "value", "is", "a", "list", "of", "booleans", "." ]
spacetelescope/stsci.tools
python
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/validate.py#L1134-L1157
[ "def", "is_bool_list", "(", "value", ",", "min", "=", "None", ",", "max", "=", "None", ")", ":", "return", "[", "is_boolean", "(", "mem", ")", "for", "mem", "in", "is_list", "(", "value", ",", "min", ",", "max", ")", "]" ]
9a022503ad24ca54ce83331482dfa3ff6de9f403
train
is_float_list
Check that the value is a list of floats. You can optionally specify the minimum and maximum number of members. Each list member is checked that it is a float. >>> vtor = Validator() >>> vtor.check('float_list', ()) [] >>> vtor.check('float_list', []) [] >>> vtor.check('float_list', (...
lib/stsci/tools/validate.py
def is_float_list(value, min=None, max=None): """ Check that the value is a list of floats. You can optionally specify the minimum and maximum number of members. Each list member is checked that it is a float. >>> vtor = Validator() >>> vtor.check('float_list', ()) [] >>> vtor.check('...
def is_float_list(value, min=None, max=None): """ Check that the value is a list of floats. You can optionally specify the minimum and maximum number of members. Each list member is checked that it is a float. >>> vtor = Validator() >>> vtor.check('float_list', ()) [] >>> vtor.check('...
[ "Check", "that", "the", "value", "is", "a", "list", "of", "floats", "." ]
spacetelescope/stsci.tools
python
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/validate.py#L1160-L1181
[ "def", "is_float_list", "(", "value", ",", "min", "=", "None", ",", "max", "=", "None", ")", ":", "return", "[", "is_float", "(", "mem", ")", "for", "mem", "in", "is_list", "(", "value", ",", "min", ",", "max", ")", "]" ]
9a022503ad24ca54ce83331482dfa3ff6de9f403
train
is_string_list
Check that the value is a list of strings. You can optionally specify the minimum and maximum number of members. Each list member is checked that it is a string. >>> vtor = Validator() >>> vtor.check('string_list', ()) [] >>> vtor.check('string_list', []) [] >>> vtor.check('string_lis...
lib/stsci/tools/validate.py
def is_string_list(value, min=None, max=None): """ Check that the value is a list of strings. You can optionally specify the minimum and maximum number of members. Each list member is checked that it is a string. >>> vtor = Validator() >>> vtor.check('string_list', ()) [] >>> vtor.che...
def is_string_list(value, min=None, max=None): """ Check that the value is a list of strings. You can optionally specify the minimum and maximum number of members. Each list member is checked that it is a string. >>> vtor = Validator() >>> vtor.check('string_list', ()) [] >>> vtor.che...
[ "Check", "that", "the", "value", "is", "a", "list", "of", "strings", "." ]
spacetelescope/stsci.tools
python
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/validate.py#L1184-L1208
[ "def", "is_string_list", "(", "value", ",", "min", "=", "None", ",", "max", "=", "None", ")", ":", "if", "isinstance", "(", "value", ",", "string_types", ")", ":", "raise", "VdtTypeError", "(", "value", ")", "return", "[", "is_string", "(", "mem", ")",...
9a022503ad24ca54ce83331482dfa3ff6de9f403
train
is_ip_addr_list
Check that the value is a list of IP addresses. You can optionally specify the minimum and maximum number of members. Each list member is checked that it is an IP address. >>> vtor = Validator() >>> vtor.check('ip_addr_list', ()) [] >>> vtor.check('ip_addr_list', []) [] >>> vtor.check...
lib/stsci/tools/validate.py
def is_ip_addr_list(value, min=None, max=None): """ Check that the value is a list of IP addresses. You can optionally specify the minimum and maximum number of members. Each list member is checked that it is an IP address. >>> vtor = Validator() >>> vtor.check('ip_addr_list', ()) [] ...
def is_ip_addr_list(value, min=None, max=None): """ Check that the value is a list of IP addresses. You can optionally specify the minimum and maximum number of members. Each list member is checked that it is an IP address. >>> vtor = Validator() >>> vtor.check('ip_addr_list', ()) [] ...
[ "Check", "that", "the", "value", "is", "a", "list", "of", "IP", "addresses", "." ]
spacetelescope/stsci.tools
python
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/validate.py#L1211-L1230
[ "def", "is_ip_addr_list", "(", "value", ",", "min", "=", "None", ",", "max", "=", "None", ")", ":", "return", "[", "is_ip_addr", "(", "mem", ")", "for", "mem", "in", "is_list", "(", "value", ",", "min", ",", "max", ")", "]" ]
9a022503ad24ca54ce83331482dfa3ff6de9f403
train
force_list
Check that a value is a list, coercing strings into a list with one member. Useful where users forget the trailing comma that turns a single value into a list. You can optionally specify the minimum and maximum number of members. A minumum of greater than one will fail if the user only supplies a s...
lib/stsci/tools/validate.py
def force_list(value, min=None, max=None): """ Check that a value is a list, coercing strings into a list with one member. Useful where users forget the trailing comma that turns a single value into a list. You can optionally specify the minimum and maximum number of members. A minumum of great...
def force_list(value, min=None, max=None): """ Check that a value is a list, coercing strings into a list with one member. Useful where users forget the trailing comma that turns a single value into a list. You can optionally specify the minimum and maximum number of members. A minumum of great...
[ "Check", "that", "a", "value", "is", "a", "list", "coercing", "strings", "into", "a", "list", "with", "one", "member", ".", "Useful", "where", "users", "forget", "the", "trailing", "comma", "that", "turns", "a", "single", "value", "into", "a", "list", "....
spacetelescope/stsci.tools
python
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/validate.py#L1233-L1253
[ "def", "force_list", "(", "value", ",", "min", "=", "None", ",", "max", "=", "None", ")", ":", "if", "not", "isinstance", "(", "value", ",", "(", "list", ",", "tuple", ")", ")", ":", "value", "=", "[", "value", "]", "return", "is_list", "(", "val...
9a022503ad24ca54ce83331482dfa3ff6de9f403
train
is_mixed_list
Check that the value is a list. Allow specifying the type of each member. Work on lists of specific lengths. You specify each member as a positional argument specifying type Each type should be one of the following strings : 'integer', 'float', 'ip_addr', 'string', 'boolean' So you can spec...
lib/stsci/tools/validate.py
def is_mixed_list(value, *args): """ Check that the value is a list. Allow specifying the type of each member. Work on lists of specific lengths. You specify each member as a positional argument specifying type Each type should be one of the following strings : 'integer', 'float', 'ip_ad...
def is_mixed_list(value, *args): """ Check that the value is a list. Allow specifying the type of each member. Work on lists of specific lengths. You specify each member as a positional argument specifying type Each type should be one of the following strings : 'integer', 'float', 'ip_ad...
[ "Check", "that", "the", "value", "is", "a", "list", ".", "Allow", "specifying", "the", "type", "of", "each", "member", ".", "Work", "on", "lists", "of", "specific", "lengths", "." ]
spacetelescope/stsci.tools
python
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/validate.py#L1265-L1331
[ "def", "is_mixed_list", "(", "value", ",", "*", "args", ")", ":", "try", ":", "length", "=", "len", "(", "value", ")", "except", "TypeError", ":", "raise", "VdtTypeError", "(", "value", ")", "if", "length", "<", "len", "(", "args", ")", ":", "raise",...
9a022503ad24ca54ce83331482dfa3ff6de9f403
train
is_option
This check matches the value to any of a set of options. >>> vtor = Validator() >>> vtor.check('option("yoda", "jedi")', 'yoda') 'yoda' >>> vtor.check('option("yoda", "jedi")', 'jed') # doctest: +SKIP Traceback (most recent call last): VdtValueError: the value "jed" is unacceptable. >>> vt...
lib/stsci/tools/validate.py
def is_option(value, *options): """ This check matches the value to any of a set of options. >>> vtor = Validator() >>> vtor.check('option("yoda", "jedi")', 'yoda') 'yoda' >>> vtor.check('option("yoda", "jedi")', 'jed') # doctest: +SKIP Traceback (most recent call last): VdtValueError:...
def is_option(value, *options): """ This check matches the value to any of a set of options. >>> vtor = Validator() >>> vtor.check('option("yoda", "jedi")', 'yoda') 'yoda' >>> vtor.check('option("yoda", "jedi")', 'jed') # doctest: +SKIP Traceback (most recent call last): VdtValueError:...
[ "This", "check", "matches", "the", "value", "to", "any", "of", "a", "set", "of", "options", "." ]
spacetelescope/stsci.tools
python
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/validate.py#L1334-L1352
[ "def", "is_option", "(", "value", ",", "*", "options", ")", ":", "if", "not", "isinstance", "(", "value", ",", "string_types", ")", ":", "raise", "VdtTypeError", "(", "value", ")", "if", "not", "value", "in", "options", ":", "raise", "VdtValueError", "("...
9a022503ad24ca54ce83331482dfa3ff6de9f403
train
Validator.check
Usage: check(check, value) Arguments: check: string representing check to apply (including arguments) value: object to be checked Returns value, converted to correct type if necessary If the check fails, raises a ``ValidateError`` subclass. >>> vtor = Validator...
lib/stsci/tools/validate.py
def check(self, check, value, missing=False): """ Usage: check(check, value) Arguments: check: string representing check to apply (including arguments) value: object to be checked Returns value, converted to correct type if necessary If the check fails, ...
def check(self, check, value, missing=False): """ Usage: check(check, value) Arguments: check: string representing check to apply (including arguments) value: object to be checked Returns value, converted to correct type if necessary If the check fails, ...
[ "Usage", ":", "check", "(", "check", "value", ")" ]
spacetelescope/stsci.tools
python
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/validate.py#L575-L608
[ "def", "check", "(", "self", ",", "check", ",", "value", ",", "missing", "=", "False", ")", ":", "fun_name", ",", "fun_args", ",", "fun_kwargs", ",", "default", "=", "self", ".", "_parse_with_caching", "(", "check", ")", "if", "missing", ":", "if", "de...
9a022503ad24ca54ce83331482dfa3ff6de9f403
train
Validator._unquote
Unquote a value if necessary.
lib/stsci/tools/validate.py
def _unquote(self, val): """Unquote a value if necessary.""" if (len(val) >= 2) and (val[0] in ("'", '"')) and (val[0] == val[-1]): val = val[1:-1] return val
def _unquote(self, val): """Unquote a value if necessary.""" if (len(val) >= 2) and (val[0] in ("'", '"')) and (val[0] == val[-1]): val = val[1:-1] return val
[ "Unquote", "a", "value", "if", "necessary", "." ]
spacetelescope/stsci.tools
python
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/validate.py#L693-L697
[ "def", "_unquote", "(", "self", ",", "val", ")", ":", "if", "(", "len", "(", "val", ")", ">=", "2", ")", "and", "(", "val", "[", "0", "]", "in", "(", "\"'\"", ",", "'\"'", ")", ")", "and", "(", "val", "[", "0", "]", "==", "val", "[", "-",...
9a022503ad24ca54ce83331482dfa3ff6de9f403
train
Validator._list_handle
Take apart a ``keyword=list('val, 'val')`` type string.
lib/stsci/tools/validate.py
def _list_handle(self, listmatch): """Take apart a ``keyword=list('val, 'val')`` type string.""" out = [] name = listmatch.group(1) args = listmatch.group(2) for arg in self._list_members.findall(args): out.append(self._unquote(arg)) return name, out
def _list_handle(self, listmatch): """Take apart a ``keyword=list('val, 'val')`` type string.""" out = [] name = listmatch.group(1) args = listmatch.group(2) for arg in self._list_members.findall(args): out.append(self._unquote(arg)) return name, out
[ "Take", "apart", "a", "keyword", "=", "list", "(", "val", "val", ")", "type", "string", "." ]
spacetelescope/stsci.tools
python
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/validate.py#L700-L707
[ "def", "_list_handle", "(", "self", ",", "listmatch", ")", ":", "out", "=", "[", "]", "name", "=", "listmatch", ".", "group", "(", "1", ")", "args", "=", "listmatch", ".", "group", "(", "2", ")", "for", "arg", "in", "self", ".", "_list_members", "....
9a022503ad24ca54ce83331482dfa3ff6de9f403
train
Validator.get_default_value
Given a check, return the default value for the check (converted to the right type). If the check doesn't specify a default value then a ``KeyError`` will be raised.
lib/stsci/tools/validate.py
def get_default_value(self, check): """ Given a check, return the default value for the check (converted to the right type). If the check doesn't specify a default value then a ``KeyError`` will be raised. """ fun_name, fun_args, fun_kwargs, default = self._parse...
def get_default_value(self, check): """ Given a check, return the default value for the check (converted to the right type). If the check doesn't specify a default value then a ``KeyError`` will be raised. """ fun_name, fun_args, fun_kwargs, default = self._parse...
[ "Given", "a", "check", "return", "the", "default", "value", "for", "the", "check", "(", "converted", "to", "the", "right", "type", ")", "." ]
spacetelescope/stsci.tools
python
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/validate.py#L723-L737
[ "def", "get_default_value", "(", "self", ",", "check", ")", ":", "fun_name", ",", "fun_args", ",", "fun_kwargs", ",", "default", "=", "self", ".", "_parse_with_caching", "(", "check", ")", "if", "default", "is", "None", ":", "raise", "KeyError", "(", "'Che...
9a022503ad24ca54ce83331482dfa3ff6de9f403
train
_ConstantValueImageBaseHDU.match_header
A constant value HDU will only be recognized as such if the header contains a valid PIXVALUE and NAXIS == 0.
lib/stsci/tools/stpyfits.py
def match_header(cls, header): """A constant value HDU will only be recognized as such if the header contains a valid PIXVALUE and NAXIS == 0. """ pixvalue = header.get('PIXVALUE') naxis = header.get('NAXIS', 0) return (super(_ConstantValueImageBaseHDU, cls).match_heade...
def match_header(cls, header): """A constant value HDU will only be recognized as such if the header contains a valid PIXVALUE and NAXIS == 0. """ pixvalue = header.get('PIXVALUE') naxis = header.get('NAXIS', 0) return (super(_ConstantValueImageBaseHDU, cls).match_heade...
[ "A", "constant", "value", "HDU", "will", "only", "be", "recognized", "as", "such", "if", "the", "header", "contains", "a", "valid", "PIXVALUE", "and", "NAXIS", "==", "0", "." ]
spacetelescope/stsci.tools
python
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/stpyfits.py#L230-L240
[ "def", "match_header", "(", "cls", ",", "header", ")", ":", "pixvalue", "=", "header", ".", "get", "(", "'PIXVALUE'", ")", "naxis", "=", "header", ".", "get", "(", "'NAXIS'", ",", "0", ")", "return", "(", "super", "(", "_ConstantValueImageBaseHDU", ",", ...
9a022503ad24ca54ce83331482dfa3ff6de9f403
train
_ConstantValueImageBaseHDU._check_constant_value_data
Verify that the HDU's data is a constant value array.
lib/stsci/tools/stpyfits.py
def _check_constant_value_data(self, data): """Verify that the HDU's data is a constant value array.""" arrayval = data.flat[0] if np.all(data == arrayval): return arrayval return None
def _check_constant_value_data(self, data): """Verify that the HDU's data is a constant value array.""" arrayval = data.flat[0] if np.all(data == arrayval): return arrayval return None
[ "Verify", "that", "the", "HDU", "s", "data", "is", "a", "constant", "value", "array", "." ]
spacetelescope/stsci.tools
python
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/stpyfits.py#L307-L313
[ "def", "_check_constant_value_data", "(", "self", ",", "data", ")", ":", "arrayval", "=", "data", ".", "flat", "[", "0", "]", "if", "np", ".", "all", "(", "data", "==", "arrayval", ")", ":", "return", "arrayval", "return", "None" ]
9a022503ad24ca54ce83331482dfa3ff6de9f403
train
ListSingleSelectDialog.get_current_index
Return currently selected index (or -1)
lib/stsci/tools/listdlg.py
def get_current_index(self): """ Return currently selected index (or -1) """ # Need to convert to int; currently API returns a tuple of string curSel = self.__lb.curselection() if curSel and len(curSel) > 0: return int(curSel[0]) else: return -1
def get_current_index(self): """ Return currently selected index (or -1) """ # Need to convert to int; currently API returns a tuple of string curSel = self.__lb.curselection() if curSel and len(curSel) > 0: return int(curSel[0]) else: return -1
[ "Return", "currently", "selected", "index", "(", "or", "-", "1", ")" ]
spacetelescope/stsci.tools
python
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/listdlg.py#L40-L48
[ "def", "get_current_index", "(", "self", ")", ":", "# Need to convert to int; currently API returns a tuple of string", "curSel", "=", "self", ".", "__lb", ".", "curselection", "(", ")", "if", "curSel", "and", "len", "(", "curSel", ")", ">", "0", ":", "return", ...
9a022503ad24ca54ce83331482dfa3ff6de9f403
train
convert
Input GEIS files "input" will be read and a HDUList object will be returned that matches the waiver-FITS format written out by 'stwfits' in IRAF. The user can use the writeto method to write the HDUList object to a FITS file.
lib/stsci/tools/convertgeis.py
def convert(input): """Input GEIS files "input" will be read and a HDUList object will be returned that matches the waiver-FITS format written out by 'stwfits' in IRAF. The user can use the writeto method to write the HDUList object to a FITS file. """ global dat cardLen = fits.C...
def convert(input): """Input GEIS files "input" will be read and a HDUList object will be returned that matches the waiver-FITS format written out by 'stwfits' in IRAF. The user can use the writeto method to write the HDUList object to a FITS file. """ global dat cardLen = fits.C...
[ "Input", "GEIS", "files", "input", "will", "be", "read", "and", "a", "HDUList", "object", "will", "be", "returned", "that", "matches", "the", "waiver", "-", "FITS", "format", "written", "out", "by", "stwfits", "in", "IRAF", "." ]
spacetelescope/stsci.tools
python
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/convertgeis.py#L102-L361
[ "def", "convert", "(", "input", ")", ":", "global", "dat", "cardLen", "=", "fits", ".", "Card", ".", "length", "# input file(s) must be of the form *.??h and *.??d", "if", "input", "[", "-", "1", "]", "!=", "'h'", "or", "input", "[", "-", "4", "]", "!=", ...
9a022503ad24ca54ce83331482dfa3ff6de9f403
train
BaseConfig._loadConfig
loads configuration from some predictable locations. :return: the config.
backend/src/core/BaseConfig.py
def _loadConfig(self): """ loads configuration from some predictable locations. :return: the config. """ configPath = path.join(self._getConfigPath(), self._name + ".yml") if os.path.exists(configPath): self.logger.warning("Loading config from " + configPath) ...
def _loadConfig(self): """ loads configuration from some predictable locations. :return: the config. """ configPath = path.join(self._getConfigPath(), self._name + ".yml") if os.path.exists(configPath): self.logger.warning("Loading config from " + configPath) ...
[ "loads", "configuration", "from", "some", "predictable", "locations", ".", ":", "return", ":", "the", "config", "." ]
3ll3d00d/vibe
python
https://github.com/3ll3d00d/vibe/blob/124b029f13ac746723e92cb47e9cb56edd2e54b5/backend/src/core/BaseConfig.py#L54-L66
[ "def", "_loadConfig", "(", "self", ")", ":", "configPath", "=", "path", ".", "join", "(", "self", ".", "_getConfigPath", "(", ")", ",", "self", ".", "_name", "+", "\".yml\"", ")", "if", "os", ".", "path", ".", "exists", "(", "configPath", ")", ":", ...
124b029f13ac746723e92cb47e9cb56edd2e54b5
train
BaseConfig._storeConfig
Writes the config to the configPath. :param config a dict of config. :param configPath the path to the file to write to, intermediate dirs will be created as necessary.
backend/src/core/BaseConfig.py
def _storeConfig(self, config, configPath): """ Writes the config to the configPath. :param config a dict of config. :param configPath the path to the file to write to, intermediate dirs will be created as necessary. """ self.logger.info("Writing to " + str(configPath)) ...
def _storeConfig(self, config, configPath): """ Writes the config to the configPath. :param config a dict of config. :param configPath the path to the file to write to, intermediate dirs will be created as necessary. """ self.logger.info("Writing to " + str(configPath)) ...
[ "Writes", "the", "config", "to", "the", "configPath", ".", ":", "param", "config", "a", "dict", "of", "config", ".", ":", "param", "configPath", "the", "path", "to", "the", "file", "to", "write", "to", "intermediate", "dirs", "will", "be", "created", "as...
3ll3d00d/vibe
python
https://github.com/3ll3d00d/vibe/blob/124b029f13ac746723e92cb47e9cb56edd2e54b5/backend/src/core/BaseConfig.py#L68-L77
[ "def", "_storeConfig", "(", "self", ",", "config", ",", "configPath", ")", ":", "self", ".", "logger", ".", "info", "(", "\"Writing to \"", "+", "str", "(", "configPath", ")", ")", "os", ".", "makedirs", "(", "os", ".", "path", ".", "dirname", "(", "...
124b029f13ac746723e92cb47e9cb56edd2e54b5
train
BaseConfig._getConfigPath
Gets the currently configured config path. :return: the path, raises ValueError if it doesn't exist.
backend/src/core/BaseConfig.py
def _getConfigPath(self): """ Gets the currently configured config path. :return: the path, raises ValueError if it doesn't exist. """ confHome = environ.get('VIBE_CONFIG_HOME') return confHome if confHome is not None else path.join(path.expanduser("~"), '.vibe')
def _getConfigPath(self): """ Gets the currently configured config path. :return: the path, raises ValueError if it doesn't exist. """ confHome = environ.get('VIBE_CONFIG_HOME') return confHome if confHome is not None else path.join(path.expanduser("~"), '.vibe')
[ "Gets", "the", "currently", "configured", "config", "path", ".", ":", "return", ":", "the", "path", "raises", "ValueError", "if", "it", "doesn", "t", "exist", "." ]
3ll3d00d/vibe
python
https://github.com/3ll3d00d/vibe/blob/124b029f13ac746723e92cb47e9cb56edd2e54b5/backend/src/core/BaseConfig.py#L87-L93
[ "def", "_getConfigPath", "(", "self", ")", ":", "confHome", "=", "environ", ".", "get", "(", "'VIBE_CONFIG_HOME'", ")", "return", "confHome", "if", "confHome", "is", "not", "None", "else", "path", ".", "join", "(", "path", ".", "expanduser", "(", "\"~\"", ...
124b029f13ac746723e92cb47e9cb56edd2e54b5
train
BaseConfig.configureLogger
Configures the python logging system to log to a debug file and to stdout for warn and above. :return: the base logger.
backend/src/core/BaseConfig.py
def configureLogger(self): """ Configures the python logging system to log to a debug file and to stdout for warn and above. :return: the base logger. """ baseLogLevel = logging.DEBUG if self.isDebugLogging() else logging.INFO # create recorder app root logger log...
def configureLogger(self): """ Configures the python logging system to log to a debug file and to stdout for warn and above. :return: the base logger. """ baseLogLevel = logging.DEBUG if self.isDebugLogging() else logging.INFO # create recorder app root logger log...
[ "Configures", "the", "python", "logging", "system", "to", "log", "to", "a", "debug", "file", "and", "to", "stdout", "for", "warn", "and", "above", ".", ":", "return", ":", "the", "base", "logger", "." ]
3ll3d00d/vibe
python
https://github.com/3ll3d00d/vibe/blob/124b029f13ac746723e92cb47e9cb56edd2e54b5/backend/src/core/BaseConfig.py#L95-L118
[ "def", "configureLogger", "(", "self", ")", ":", "baseLogLevel", "=", "logging", ".", "DEBUG", "if", "self", ".", "isDebugLogging", "(", ")", "else", "logging", ".", "INFO", "# create recorder app root logger", "logger", "=", "logging", ".", "getLogger", "(", ...
124b029f13ac746723e92cb47e9cb56edd2e54b5
train
ibm_to_ieee
Translate IBM-format floating point numbers (as bytes) to IEEE 754 64-bit floating point format (as Python float).
xport/v56.py
def ibm_to_ieee(ibm): ''' Translate IBM-format floating point numbers (as bytes) to IEEE 754 64-bit floating point format (as Python float). ''' # IBM mainframe: sign * 0.mantissa * 16 ** (exponent - 64) # Python uses IEEE: sign * 1.mantissa * 2 ** (exponent - 1023) # Pad-out to 8 bytes ...
def ibm_to_ieee(ibm): ''' Translate IBM-format floating point numbers (as bytes) to IEEE 754 64-bit floating point format (as Python float). ''' # IBM mainframe: sign * 0.mantissa * 16 ** (exponent - 64) # Python uses IEEE: sign * 1.mantissa * 2 ** (exponent - 1023) # Pad-out to 8 bytes ...
[ "Translate", "IBM", "-", "format", "floating", "point", "numbers", "(", "as", "bytes", ")", "to", "IEEE", "754", "64", "-", "bit", "floating", "point", "format", "(", "as", "Python", "float", ")", "." ]
selik/xport
python
https://github.com/selik/xport/blob/fafd15a24ccd102fc92d0c0123b9877a0c752182/xport/v56.py#L36-L96
[ "def", "ibm_to_ieee", "(", "ibm", ")", ":", "# IBM mainframe: sign * 0.mantissa * 16 ** (exponent - 64)", "# Python uses IEEE: sign * 1.mantissa * 2 ** (exponent - 1023)", "# Pad-out to 8 bytes if necessary. We expect 2 to 8 bytes, but", "# there's no need to check; bizarre sizes will cause a s...
fafd15a24ccd102fc92d0c0123b9877a0c752182
train
ieee_to_ibm
Translate Python floating point numbers to IBM-format (as bytes).
xport/v56.py
def ieee_to_ibm(ieee): ''' Translate Python floating point numbers to IBM-format (as bytes). ''' # Python uses IEEE: sign * 1.mantissa * 2 ** (exponent - 1023) # IBM mainframe: sign * 0.mantissa * 16 ** (exponent - 64) if ieee == 0.0: return b'\x00' * 8 if ieee is None or math.is...
def ieee_to_ibm(ieee): ''' Translate Python floating point numbers to IBM-format (as bytes). ''' # Python uses IEEE: sign * 1.mantissa * 2 ** (exponent - 1023) # IBM mainframe: sign * 0.mantissa * 16 ** (exponent - 64) if ieee == 0.0: return b'\x00' * 8 if ieee is None or math.is...
[ "Translate", "Python", "floating", "point", "numbers", "to", "IBM", "-", "format", "(", "as", "bytes", ")", "." ]
selik/xport
python
https://github.com/selik/xport/blob/fafd15a24ccd102fc92d0c0123b9877a0c752182/xport/v56.py#L600-L657
[ "def", "ieee_to_ibm", "(", "ieee", ")", ":", "# Python uses IEEE: sign * 1.mantissa * 2 ** (exponent - 1023)", "# IBM mainframe: sign * 0.mantissa * 16 ** (exponent - 64)", "if", "ieee", "==", "0.0", ":", "return", "b'\\x00'", "*", "8", "if", "ieee", "is", "None", "or", ...
fafd15a24ccd102fc92d0c0123b9877a0c752182
train
dumps
Serialize ``columns`` to a JSON formatted ``bytes`` object.
xport/v56.py
def dumps(columns): ''' Serialize ``columns`` to a JSON formatted ``bytes`` object. ''' fp = BytesIO() dump(columns, fp) fp.seek(0) return fp.read()
def dumps(columns): ''' Serialize ``columns`` to a JSON formatted ``bytes`` object. ''' fp = BytesIO() dump(columns, fp) fp.seek(0) return fp.read()
[ "Serialize", "columns", "to", "a", "JSON", "formatted", "bytes", "object", "." ]
selik/xport
python
https://github.com/selik/xport/blob/fafd15a24ccd102fc92d0c0123b9877a0c752182/xport/v56.py#L669-L676
[ "def", "dumps", "(", "columns", ")", ":", "fp", "=", "BytesIO", "(", ")", "dump", "(", "columns", ",", "fp", ")", "fp", ".", "seek", "(", "0", ")", "return", "fp", ".", "read", "(", ")" ]
fafd15a24ccd102fc92d0c0123b9877a0c752182
train
Library.match
Parse the 3-line (240-byte) header of a SAS XPORT file.
xport/v56.py
def match(header): ''' Parse the 3-line (240-byte) header of a SAS XPORT file. ''' mo = Library.header_re.match(header) if mo is None: raise ValueError(f'Not a SAS Version 5 or 6 XPORT file') return { 'created': strptime(mo['created']), ...
def match(header): ''' Parse the 3-line (240-byte) header of a SAS XPORT file. ''' mo = Library.header_re.match(header) if mo is None: raise ValueError(f'Not a SAS Version 5 or 6 XPORT file') return { 'created': strptime(mo['created']), ...
[ "Parse", "the", "3", "-", "line", "(", "240", "-", "byte", ")", "header", "of", "a", "SAS", "XPORT", "file", "." ]
selik/xport
python
https://github.com/selik/xport/blob/fafd15a24ccd102fc92d0c0123b9877a0c752182/xport/v56.py#L146-L158
[ "def", "match", "(", "header", ")", ":", "mo", "=", "Library", ".", "header_re", ".", "match", "(", "header", ")", "if", "mo", "is", "None", ":", "raise", "ValueError", "(", "f'Not a SAS Version 5 or 6 XPORT file'", ")", "return", "{", "'created'", ":", "s...
fafd15a24ccd102fc92d0c0123b9877a0c752182
train
Member.header_match
Parse the 4-line (320-byte) library member header.
xport/v56.py
def header_match(cls, header): ''' Parse the 4-line (320-byte) library member header. ''' mo = cls.header_re.match(header) if mo is None: msg = f'Expected {cls.header_re.pattern!r}, got {header!r}' raise ValueError(msg) return { 'name':...
def header_match(cls, header): ''' Parse the 4-line (320-byte) library member header. ''' mo = cls.header_re.match(header) if mo is None: msg = f'Expected {cls.header_re.pattern!r}, got {header!r}' raise ValueError(msg) return { 'name':...
[ "Parse", "the", "4", "-", "line", "(", "320", "-", "byte", ")", "library", "member", "header", "." ]
selik/xport
python
https://github.com/selik/xport/blob/fafd15a24ccd102fc92d0c0123b9877a0c752182/xport/v56.py#L292-L309
[ "def", "header_match", "(", "cls", ",", "header", ")", ":", "mo", "=", "cls", ".", "header_re", ".", "match", "(", "header", ")", "if", "mo", "is", "None", ":", "msg", "=", "f'Expected {cls.header_re.pattern!r}, got {header!r}'", "raise", "ValueError", "(", ...
fafd15a24ccd102fc92d0c0123b9877a0c752182
train
Variable.header_match
Parse a member namestrs header (1 line, 80 bytes).
xport/v56.py
def header_match(cls, data): ''' Parse a member namestrs header (1 line, 80 bytes). ''' mo = cls.header_re.match(data) return int(mo['n_variables'])
def header_match(cls, data): ''' Parse a member namestrs header (1 line, 80 bytes). ''' mo = cls.header_re.match(data) return int(mo['n_variables'])
[ "Parse", "a", "member", "namestrs", "header", "(", "1", "line", "80", "bytes", ")", "." ]
selik/xport
python
https://github.com/selik/xport/blob/fafd15a24ccd102fc92d0c0123b9877a0c752182/xport/v56.py#L421-L426
[ "def", "header_match", "(", "cls", ",", "data", ")", ":", "mo", "=", "cls", ".", "header_re", ".", "match", "(", "data", ")", "return", "int", "(", "mo", "[", "'n_variables'", "]", ")" ]
fafd15a24ccd102fc92d0c0123b9877a0c752182
train
Variable.readall
Parse variable metadata for a XPORT file member.
xport/v56.py
def readall(cls, member, size): ''' Parse variable metadata for a XPORT file member. ''' fp = member.library.fp LINE = member.library.LINE n = cls.header_match(fp.read(LINE)) namestrs = [fp.read(size) for i in range(n)] # Each namestr field is 140 bytes ...
def readall(cls, member, size): ''' Parse variable metadata for a XPORT file member. ''' fp = member.library.fp LINE = member.library.LINE n = cls.header_match(fp.read(LINE)) namestrs = [fp.read(size) for i in range(n)] # Each namestr field is 140 bytes ...
[ "Parse", "variable", "metadata", "for", "a", "XPORT", "file", "member", "." ]
selik/xport
python
https://github.com/selik/xport/blob/fafd15a24ccd102fc92d0c0123b9877a0c752182/xport/v56.py#L464-L489
[ "def", "readall", "(", "cls", ",", "member", ",", "size", ")", ":", "fp", "=", "member", ".", "library", ".", "fp", "LINE", "=", "member", ".", "library", ".", "LINE", "n", "=", "cls", ".", "header_match", "(", "fp", ".", "read", "(", "LINE", ")"...
fafd15a24ccd102fc92d0c0123b9877a0c752182
train
to_jd
Determine Julian day count from Islamic date
convertdate/islamic.py
def to_jd(year, month, day): '''Determine Julian day count from Islamic date''' return (day + ceil(29.5 * (month - 1)) + (year - 1) * 354 + trunc((3 + (11 * year)) / 30) + EPOCH) - 1
def to_jd(year, month, day): '''Determine Julian day count from Islamic date''' return (day + ceil(29.5 * (month - 1)) + (year - 1) * 354 + trunc((3 + (11 * year)) / 30) + EPOCH) - 1
[ "Determine", "Julian", "day", "count", "from", "Islamic", "date" ]
fitnr/convertdate
python
https://github.com/fitnr/convertdate/blob/e920f168a87f99183b0aa7290d6c3af222582d43/convertdate/islamic.py#L28-L30
[ "def", "to_jd", "(", "year", ",", "month", ",", "day", ")", ":", "return", "(", "day", "+", "ceil", "(", "29.5", "*", "(", "month", "-", "1", ")", ")", "+", "(", "year", "-", "1", ")", "*", "354", "+", "trunc", "(", "(", "3", "+", "(", "1...
e920f168a87f99183b0aa7290d6c3af222582d43
train
from_jd
Calculate Islamic date from Julian day
convertdate/islamic.py
def from_jd(jd): '''Calculate Islamic date from Julian day''' jd = trunc(jd) + 0.5 year = trunc(((30 * (jd - EPOCH)) + 10646) / 10631) month = min(12, ceil((jd - (29 + to_jd(year, 1, 1))) / 29.5) + 1) day = int(jd - to_jd(year, month, 1)) + 1 return (year, month, day)
def from_jd(jd): '''Calculate Islamic date from Julian day''' jd = trunc(jd) + 0.5 year = trunc(((30 * (jd - EPOCH)) + 10646) / 10631) month = min(12, ceil((jd - (29 + to_jd(year, 1, 1))) / 29.5) + 1) day = int(jd - to_jd(year, month, 1)) + 1 return (year, month, day)
[ "Calculate", "Islamic", "date", "from", "Julian", "day" ]
fitnr/convertdate
python
https://github.com/fitnr/convertdate/blob/e920f168a87f99183b0aa7290d6c3af222582d43/convertdate/islamic.py#L33-L40
[ "def", "from_jd", "(", "jd", ")", ":", "jd", "=", "trunc", "(", "jd", ")", "+", "0.5", "year", "=", "trunc", "(", "(", "(", "30", "*", "(", "jd", "-", "EPOCH", ")", ")", "+", "10646", ")", "/", "10631", ")", "month", "=", "min", "(", "12", ...
e920f168a87f99183b0aa7290d6c3af222582d43
train
EditParDialog.checkAllTriggers
Go over all widgets and let them know they have been edited recently and they need to check for any trigger actions. This would be used right after all the widgets have their values set or forced (e.g. via setAllEntriesFromParList).
lib/stsci/tools/editpar.py
def checkAllTriggers(self, action): """ Go over all widgets and let them know they have been edited recently and they need to check for any trigger actions. This would be used right after all the widgets have their values set or forced (e.g. via setAllEntriesFromParList). ""...
def checkAllTriggers(self, action): """ Go over all widgets and let them know they have been edited recently and they need to check for any trigger actions. This would be used right after all the widgets have their values set or forced (e.g. via setAllEntriesFromParList). ""...
[ "Go", "over", "all", "widgets", "and", "let", "them", "know", "they", "have", "been", "edited", "recently", "and", "they", "need", "to", "check", "for", "any", "trigger", "actions", ".", "This", "would", "be", "used", "right", "after", "all", "the", "wid...
spacetelescope/stsci.tools
python
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/editpar.py#L417-L423
[ "def", "checkAllTriggers", "(", "self", ",", "action", ")", ":", "for", "entry", "in", "self", ".", "entryNo", ":", "entry", ".", "widgetEdited", "(", "action", "=", "action", ",", "skipDups", "=", "False", ")" ]
9a022503ad24ca54ce83331482dfa3ff6de9f403
train
EditParDialog.freshenFocus
Did something which requires a new look. Move scrollbar up. This often needs to be delayed a bit however, to let other events in the queue through first.
lib/stsci/tools/editpar.py
def freshenFocus(self): """ Did something which requires a new look. Move scrollbar up. This often needs to be delayed a bit however, to let other events in the queue through first. """ self.top.update_idletasks() self.top.after(10, self.setViewAtTop)
def freshenFocus(self): """ Did something which requires a new look. Move scrollbar up. This often needs to be delayed a bit however, to let other events in the queue through first. """ self.top.update_idletasks() self.top.after(10, self.setViewAtTop)
[ "Did", "something", "which", "requires", "a", "new", "look", ".", "Move", "scrollbar", "up", ".", "This", "often", "needs", "to", "be", "delayed", "a", "bit", "however", "to", "let", "other", "events", "in", "the", "queue", "through", "first", "." ]
spacetelescope/stsci.tools
python
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/editpar.py#L426-L431
[ "def", "freshenFocus", "(", "self", ")", ":", "self", ".", "top", ".", "update_idletasks", "(", ")", "self", ".", "top", ".", "after", "(", "10", ",", "self", ".", "setViewAtTop", ")" ]
9a022503ad24ca54ce83331482dfa3ff6de9f403
train
EditParDialog.mwl
Mouse Wheel - under tkinter we seem to need Tk v8.5+ for this
lib/stsci/tools/editpar.py
def mwl(self, event): """Mouse Wheel - under tkinter we seem to need Tk v8.5+ for this """ if event.num == 4: # up on Linux self.top.f.canvas.yview_scroll(-1*self._tmwm, 'units') elif event.num == 5: # down on Linux self.top.f.canvas.yview_scroll(1*self._tmwm, 'units') ...
def mwl(self, event): """Mouse Wheel - under tkinter we seem to need Tk v8.5+ for this """ if event.num == 4: # up on Linux self.top.f.canvas.yview_scroll(-1*self._tmwm, 'units') elif event.num == 5: # down on Linux self.top.f.canvas.yview_scroll(1*self._tmwm, 'units') ...
[ "Mouse", "Wheel", "-", "under", "tkinter", "we", "seem", "to", "need", "Tk", "v8", ".", "5", "+", "for", "this" ]
spacetelescope/stsci.tools
python
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/editpar.py#L444-L451
[ "def", "mwl", "(", "self", ",", "event", ")", ":", "if", "event", ".", "num", "==", "4", ":", "# up on Linux", "self", ".", "top", ".", "f", ".", "canvas", ".", "yview_scroll", "(", "-", "1", "*", "self", ".", "_tmwm", ",", "'units'", ")", "elif"...
9a022503ad24ca54ce83331482dfa3ff6de9f403
train
EditParDialog.focusNext
Set focus to next item in sequence
lib/stsci/tools/editpar.py
def focusNext(self, event): """Set focus to next item in sequence""" try: event.widget.tk_focusNext().focus_set() except TypeError: # see tkinter equivalent code for tk_focusNext to see # commented original version name = event.widget.tk.call('tk_f...
def focusNext(self, event): """Set focus to next item in sequence""" try: event.widget.tk_focusNext().focus_set() except TypeError: # see tkinter equivalent code for tk_focusNext to see # commented original version name = event.widget.tk.call('tk_f...
[ "Set", "focus", "to", "next", "item", "in", "sequence" ]
spacetelescope/stsci.tools
python
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/editpar.py#L458-L466
[ "def", "focusNext", "(", "self", ",", "event", ")", ":", "try", ":", "event", ".", "widget", ".", "tk_focusNext", "(", ")", ".", "focus_set", "(", ")", "except", "TypeError", ":", "# see tkinter equivalent code for tk_focusNext to see", "# commented original version...
9a022503ad24ca54ce83331482dfa3ff6de9f403
train
EditParDialog.focusPrev
Set focus to previous item in sequence
lib/stsci/tools/editpar.py
def focusPrev(self, event): """Set focus to previous item in sequence""" try: event.widget.tk_focusPrev().focus_set() except TypeError: # see tkinter equivalent code for tk_focusPrev to see # commented original version name = event.widget.tk.call('...
def focusPrev(self, event): """Set focus to previous item in sequence""" try: event.widget.tk_focusPrev().focus_set() except TypeError: # see tkinter equivalent code for tk_focusPrev to see # commented original version name = event.widget.tk.call('...
[ "Set", "focus", "to", "previous", "item", "in", "sequence" ]
spacetelescope/stsci.tools
python
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/editpar.py#L468-L476
[ "def", "focusPrev", "(", "self", ",", "event", ")", ":", "try", ":", "event", ".", "widget", ".", "tk_focusPrev", "(", ")", ".", "focus_set", "(", ")", "except", "TypeError", ":", "# see tkinter equivalent code for tk_focusPrev to see", "# commented original version...
9a022503ad24ca54ce83331482dfa3ff6de9f403
train
EditParDialog.doScroll
Scroll the panel down to ensure widget with focus to be visible Tracks the last widget that doScroll was called for and ignores repeated calls. That handles the case where the focus moves not between parameter entries but to someplace outside the hierarchy. In that case the scrolling i...
lib/stsci/tools/editpar.py
def doScroll(self, event): """Scroll the panel down to ensure widget with focus to be visible Tracks the last widget that doScroll was called for and ignores repeated calls. That handles the case where the focus moves not between parameter entries but to someplace outside the hierarchy...
def doScroll(self, event): """Scroll the panel down to ensure widget with focus to be visible Tracks the last widget that doScroll was called for and ignores repeated calls. That handles the case where the focus moves not between parameter entries but to someplace outside the hierarchy...
[ "Scroll", "the", "panel", "down", "to", "ensure", "widget", "with", "focus", "to", "be", "visible" ]
spacetelescope/stsci.tools
python
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/editpar.py#L478-L508
[ "def", "doScroll", "(", "self", ",", "event", ")", ":", "canvas", "=", "self", ".", "top", ".", "f", ".", "canvas", "widgetWithFocus", "=", "event", ".", "widget", "if", "widgetWithFocus", "is", "self", ".", "lastFocusWidget", ":", "return", "FALSE", "se...
9a022503ad24ca54ce83331482dfa3ff6de9f403
train
EditParDialog._handleParListMismatch
Handle the situation where two par lists do not match. This is meant to allow subclasses to override. Note that this only handles "missing" pars and "extra" pars, not wrong-type pars.
lib/stsci/tools/editpar.py
def _handleParListMismatch(self, probStr, extra=False): """ Handle the situation where two par lists do not match. This is meant to allow subclasses to override. Note that this only handles "missing" pars and "extra" pars, not wrong-type pars. """ errmsg = 'ERROR: mismatch between defau...
def _handleParListMismatch(self, probStr, extra=False): """ Handle the situation where two par lists do not match. This is meant to allow subclasses to override. Note that this only handles "missing" pars and "extra" pars, not wrong-type pars. """ errmsg = 'ERROR: mismatch between defau...
[ "Handle", "the", "situation", "where", "two", "par", "lists", "do", "not", "match", ".", "This", "is", "meant", "to", "allow", "subclasses", "to", "override", ".", "Note", "that", "this", "only", "handles", "missing", "pars", "and", "extra", "pars", "not",...
spacetelescope/stsci.tools
python
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/editpar.py#L511-L522
[ "def", "_handleParListMismatch", "(", "self", ",", "probStr", ",", "extra", "=", "False", ")", ":", "errmsg", "=", "'ERROR: mismatch between default and current par lists '", "+", "'for task \"'", "+", "self", ".", "taskName", "+", "'\"'", "if", "probStr", ":", "e...
9a022503ad24ca54ce83331482dfa3ff6de9f403
train
EditParDialog._setupDefaultParamList
This creates self.defaultParamList. It also does some checks on the paramList, sets its order if needed, and deletes any extra or unknown pars if found. We assume the order of self.defaultParamList is the correct order.
lib/stsci/tools/editpar.py
def _setupDefaultParamList(self): """ This creates self.defaultParamList. It also does some checks on the paramList, sets its order if needed, and deletes any extra or unknown pars if found. We assume the order of self.defaultParamList is the correct order. """ # Obtain the def...
def _setupDefaultParamList(self): """ This creates self.defaultParamList. It also does some checks on the paramList, sets its order if needed, and deletes any extra or unknown pars if found. We assume the order of self.defaultParamList is the correct order. """ # Obtain the def...
[ "This", "creates", "self", ".", "defaultParamList", ".", "It", "also", "does", "some", "checks", "on", "the", "paramList", "sets", "its", "order", "if", "needed", "and", "deletes", "any", "extra", "or", "unknown", "pars", "if", "found", ".", "We", "assume"...
spacetelescope/stsci.tools
python
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/editpar.py#L525-L579
[ "def", "_setupDefaultParamList", "(", "self", ")", ":", "# Obtain the default parameter list", "self", ".", "defaultParamList", "=", "self", ".", "_taskParsObj", ".", "getDefaultParList", "(", ")", "theParamList", "=", "self", ".", "_taskParsObj", ".", "getParList", ...
9a022503ad24ca54ce83331482dfa3ff6de9f403
train
EditParDialog._toggleSectionActiveState
Make an entire section (minus skipList items) either active or inactive. sectionName is the same as the param's scope.
lib/stsci/tools/editpar.py
def _toggleSectionActiveState(self, sectionName, state, skipList): """ Make an entire section (minus skipList items) either active or inactive. sectionName is the same as the param's scope. """ # Get model data, the list of pars theParamList = self._taskParsObj.getParList() ...
def _toggleSectionActiveState(self, sectionName, state, skipList): """ Make an entire section (minus skipList items) either active or inactive. sectionName is the same as the param's scope. """ # Get model data, the list of pars theParamList = self._taskParsObj.getParList() ...
[ "Make", "an", "entire", "section", "(", "minus", "skipList", "items", ")", "either", "active", "or", "inactive", ".", "sectionName", "is", "the", "same", "as", "the", "param", "s", "scope", "." ]
spacetelescope/stsci.tools
python
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/editpar.py#L645-L659
[ "def", "_toggleSectionActiveState", "(", "self", ",", "sectionName", ",", "state", ",", "skipList", ")", ":", "# Get model data, the list of pars", "theParamList", "=", "self", ".", "_taskParsObj", ".", "getParList", "(", ")", "# Loop over their assoc. entries", "for", ...
9a022503ad24ca54ce83331482dfa3ff6de9f403
train
EditParDialog.saveAs
Save the parameter settings to a user-specified file. Any changes here must be coordinated with the corresponding tpar save_as function.
lib/stsci/tools/editpar.py
def saveAs(self, event=None): """ Save the parameter settings to a user-specified file. Any changes here must be coordinated with the corresponding tpar save_as function. """ self.debug('Clicked Save as...') # On Linux Pers..Dlg causes the cwd to change, so get a copy of curren...
def saveAs(self, event=None): """ Save the parameter settings to a user-specified file. Any changes here must be coordinated with the corresponding tpar save_as function. """ self.debug('Clicked Save as...') # On Linux Pers..Dlg causes the cwd to change, so get a copy of curren...
[ "Save", "the", "parameter", "settings", "to", "a", "user", "-", "specified", "file", ".", "Any", "changes", "here", "must", "be", "coordinated", "with", "the", "corresponding", "tpar", "save_as", "function", "." ]
spacetelescope/stsci.tools
python
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/editpar.py#L1122-L1190
[ "def", "saveAs", "(", "self", ",", "event", "=", "None", ")", ":", "self", ".", "debug", "(", "'Clicked Save as...'", ")", "# On Linux Pers..Dlg causes the cwd to change, so get a copy of current", "curdir", "=", "os", ".", "getcwd", "(", ")", "# The user wishes to sa...
9a022503ad24ca54ce83331482dfa3ff6de9f403
train
EditParDialog.htmlHelp
Pop up the help in a browser window. By default, this tries to show the help for the current task. With the option arguments, it can be used to show any help string.
lib/stsci/tools/editpar.py
def htmlHelp(self, helpString=None, title=None, istask=False, tag=None): """ Pop up the help in a browser window. By default, this tries to show the help for the current task. With the option arguments, it can be used to show any help string. """ # Check the help string. If it turns o...
def htmlHelp(self, helpString=None, title=None, istask=False, tag=None): """ Pop up the help in a browser window. By default, this tries to show the help for the current task. With the option arguments, it can be used to show any help string. """ # Check the help string. If it turns o...
[ "Pop", "up", "the", "help", "in", "a", "browser", "window", ".", "By", "default", "this", "tries", "to", "show", "the", "help", "for", "the", "current", "task", ".", "With", "the", "option", "arguments", "it", "can", "be", "used", "to", "show", "any", ...
spacetelescope/stsci.tools
python
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/editpar.py#L1298-L1329
[ "def", "htmlHelp", "(", "self", ",", "helpString", "=", "None", ",", "title", "=", "None", ",", "istask", "=", "False", ",", "tag", "=", "None", ")", ":", "# Check the help string. If it turns out to be a URL, launch that,", "# if not, dump it to a quick and dirty tmp ...
9a022503ad24ca54ce83331482dfa3ff6de9f403
train
EditParDialog._showAnyHelp
Invoke task/epar/etc. help and put the page in a window. This same logic is used for GUI help, task help, log msgs, etc.
lib/stsci/tools/editpar.py
def _showAnyHelp(self, kind, tag=None): """ Invoke task/epar/etc. help and put the page in a window. This same logic is used for GUI help, task help, log msgs, etc. """ # sanity check assert kind in ('epar', 'task', 'log'), 'Unknown help kind: '+str(kind) #---------------------...
def _showAnyHelp(self, kind, tag=None): """ Invoke task/epar/etc. help and put the page in a window. This same logic is used for GUI help, task help, log msgs, etc. """ # sanity check assert kind in ('epar', 'task', 'log'), 'Unknown help kind: '+str(kind) #---------------------...
[ "Invoke", "task", "/", "epar", "/", "etc", ".", "help", "and", "put", "the", "page", "in", "a", "window", ".", "This", "same", "logic", "is", "used", "for", "GUI", "help", "task", "help", "log", "msgs", "etc", "." ]
spacetelescope/stsci.tools
python
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/editpar.py#L1332-L1383
[ "def", "_showAnyHelp", "(", "self", ",", "kind", ",", "tag", "=", "None", ")", ":", "# sanity check", "assert", "kind", "in", "(", "'epar'", ",", "'task'", ",", "'log'", ")", ",", "'Unknown help kind: '", "+", "str", "(", "kind", ")", "#-------------------...
9a022503ad24ca54ce83331482dfa3ff6de9f403
train
EditParDialog.setAllEntriesFromParList
Set all the parameter entry values in the GUI to the values in the given par list. If 'updateModel' is True, the internal param list will be updated to the new values as well as the GUI entries (slower and not always necessary). Note the corresponding TparDisplay method.
lib/stsci/tools/editpar.py
def setAllEntriesFromParList(self, aParList, updateModel=False): """ Set all the parameter entry values in the GUI to the values in the given par list. If 'updateModel' is True, the internal param list will be updated to the new values as well as the GUI entries (slower and n...
def setAllEntriesFromParList(self, aParList, updateModel=False): """ Set all the parameter entry values in the GUI to the values in the given par list. If 'updateModel' is True, the internal param list will be updated to the new values as well as the GUI entries (slower and n...
[ "Set", "all", "the", "parameter", "entry", "values", "in", "the", "GUI", "to", "the", "values", "in", "the", "given", "par", "list", ".", "If", "updateModel", "is", "True", "the", "internal", "param", "list", "will", "be", "updated", "to", "the", "new", ...
spacetelescope/stsci.tools
python
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/editpar.py#L1473-L1530
[ "def", "setAllEntriesFromParList", "(", "self", ",", "aParList", ",", "updateModel", "=", "False", ")", ":", "# Get model data, the list of pars", "theParamList", "=", "self", ".", "_taskParsObj", ".", "getParList", "(", ")", "# we may modify members", "if", "len", ...
9a022503ad24ca54ce83331482dfa3ff6de9f403
train
EditParDialog.getValue
Return current par value from the GUI. This does not do any validation, and it it not necessarily the same value saved in the model, which is always behind the GUI setting, in time. This is NOT to be used to get all the values - it would not be efficient.
lib/stsci/tools/editpar.py
def getValue(self, name, scope=None, native=False): """ Return current par value from the GUI. This does not do any validation, and it it not necessarily the same value saved in the model, which is always behind the GUI setting, in time. This is NOT to be used to get all the values - it ...
def getValue(self, name, scope=None, native=False): """ Return current par value from the GUI. This does not do any validation, and it it not necessarily the same value saved in the model, which is always behind the GUI setting, in time. This is NOT to be used to get all the values - it ...
[ "Return", "current", "par", "value", "from", "the", "GUI", ".", "This", "does", "not", "do", "any", "validation", "and", "it", "it", "not", "necessarily", "the", "same", "value", "saved", "in", "the", "model", "which", "is", "always", "behind", "the", "G...
spacetelescope/stsci.tools
python
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/editpar.py#L1540-L1564
[ "def", "getValue", "(", "self", ",", "name", ",", "scope", "=", "None", ",", "native", "=", "False", ")", ":", "# Get model data, the list of pars", "theParamList", "=", "self", ".", "_taskParsObj", ".", "getParList", "(", ")", "# NOTE: If par scope is given, it w...
9a022503ad24ca54ce83331482dfa3ff6de9f403
train
EditParDialog.checkSetSaveChildren
Check, then set, then save the parameter settings for all child (pset) windows. Prompts if any problems are found. Returns None on success, list of bad entries on failure.
lib/stsci/tools/editpar.py
def checkSetSaveChildren(self, doSave=True): """Check, then set, then save the parameter settings for all child (pset) windows. Prompts if any problems are found. Returns None on success, list of bad entries on failure. """ if self.isChild: return #...
def checkSetSaveChildren(self, doSave=True): """Check, then set, then save the parameter settings for all child (pset) windows. Prompts if any problems are found. Returns None on success, list of bad entries on failure. """ if self.isChild: return #...
[ "Check", "then", "set", "then", "save", "the", "parameter", "settings", "for", "all", "child", "(", "pset", ")", "windows", "." ]
spacetelescope/stsci.tools
python
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/editpar.py#L1658-L1685
[ "def", "checkSetSaveChildren", "(", "self", ",", "doSave", "=", "True", ")", ":", "if", "self", ".", "isChild", ":", "return", "# Need to get all the entries and verify them.", "# Save the children in backwards order to coincide with the", "# display of the dialogs (LIFO)", "fo...
9a022503ad24ca54ce83331482dfa3ff6de9f403
train
EditParDialog._pushMessages
Internal callback used to make sure the msg list keeps moving.
lib/stsci/tools/editpar.py
def _pushMessages(self): """ Internal callback used to make sure the msg list keeps moving. """ # This continues to get itself called until no msgs are left in list. self.showStatus('') if len(self._statusMsgsToShow) > 0: self.top.after(200, self._pushMessages)
def _pushMessages(self): """ Internal callback used to make sure the msg list keeps moving. """ # This continues to get itself called until no msgs are left in list. self.showStatus('') if len(self._statusMsgsToShow) > 0: self.top.after(200, self._pushMessages)
[ "Internal", "callback", "used", "to", "make", "sure", "the", "msg", "list", "keeps", "moving", "." ]
spacetelescope/stsci.tools
python
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/editpar.py#L1688-L1693
[ "def", "_pushMessages", "(", "self", ")", ":", "# This continues to get itself called until no msgs are left in list.", "self", ".", "showStatus", "(", "''", ")", "if", "len", "(", "self", ".", "_statusMsgsToShow", ")", ">", "0", ":", "self", ".", "top", ".", "a...
9a022503ad24ca54ce83331482dfa3ff6de9f403
train
EditParDialog.showStatus
Show the given status string, but not until any given delay from the previous message has expired. keep is a time (secs) to force the message to remain without being overwritten or cleared. cat is a string category used only in the historical log.
lib/stsci/tools/editpar.py
def showStatus(self, msg, keep=0, cat=None): """ Show the given status string, but not until any given delay from the previous message has expired. keep is a time (secs) to force the message to remain without being overwritten or cleared. cat is a string category used only in...
def showStatus(self, msg, keep=0, cat=None): """ Show the given status string, but not until any given delay from the previous message has expired. keep is a time (secs) to force the message to remain without being overwritten or cleared. cat is a string category used only in...
[ "Show", "the", "given", "status", "string", "but", "not", "until", "any", "given", "delay", "from", "the", "previous", "message", "has", "expired", ".", "keep", "is", "a", "time", "(", "secs", ")", "to", "force", "the", "message", "to", "remain", "withou...
spacetelescope/stsci.tools
python
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/editpar.py#L1701-L1749
[ "def", "showStatus", "(", "self", ",", "msg", ",", "keep", "=", "0", ",", "cat", "=", "None", ")", ":", "# prep it, space-wise", "msg", "=", "msg", ".", "strip", "(", ")", "if", "len", "(", "msg", ")", ">", "0", ":", "# right here is the ideal place to...
9a022503ad24ca54ce83331482dfa3ff6de9f403
train
teal
Start the GUI session, or simply load a task's ConfigObj.
lib/stsci/tools/teal.py
def teal(theTask, parent=None, loadOnly=False, returnAs="dict", canExecute=True, strict=False, errorsToTerm=False, autoClose=True, defaults=False): # overrides=None): """ Start the GUI session, or simply load a task's ConfigObj. """ if loadOnly: # this forces returnAs="dict" obj...
def teal(theTask, parent=None, loadOnly=False, returnAs="dict", canExecute=True, strict=False, errorsToTerm=False, autoClose=True, defaults=False): # overrides=None): """ Start the GUI session, or simply load a task's ConfigObj. """ if loadOnly: # this forces returnAs="dict" obj...
[ "Start", "the", "GUI", "session", "or", "simply", "load", "a", "task", "s", "ConfigObj", "." ]
spacetelescope/stsci.tools
python
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/teal.py#L167-L227
[ "def", "teal", "(", "theTask", ",", "parent", "=", "None", ",", "loadOnly", "=", "False", ",", "returnAs", "=", "\"dict\"", ",", "canExecute", "=", "True", ",", "strict", "=", "False", ",", "errorsToTerm", "=", "False", ",", "autoClose", "=", "True", "...
9a022503ad24ca54ce83331482dfa3ff6de9f403
train
load
Shortcut to load TEAL .cfg files for non-GUI access where loadOnly=True.
lib/stsci/tools/teal.py
def load(theTask, canExecute=True, strict=True, defaults=False): """ Shortcut to load TEAL .cfg files for non-GUI access where loadOnly=True. """ return teal(theTask, parent=None, loadOnly=True, returnAs="dict", canExecute=canExecute, strict=strict, errorsToTerm=True, default...
def load(theTask, canExecute=True, strict=True, defaults=False): """ Shortcut to load TEAL .cfg files for non-GUI access where loadOnly=True. """ return teal(theTask, parent=None, loadOnly=True, returnAs="dict", canExecute=canExecute, strict=strict, errorsToTerm=True, default...
[ "Shortcut", "to", "load", "TEAL", ".", "cfg", "files", "for", "non", "-", "GUI", "access", "where", "loadOnly", "=", "True", "." ]
spacetelescope/stsci.tools
python
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/teal.py#L232-L237
[ "def", "load", "(", "theTask", ",", "canExecute", "=", "True", ",", "strict", "=", "True", ",", "defaults", "=", "False", ")", ":", "return", "teal", "(", "theTask", ",", "parent", "=", "None", ",", "loadOnly", "=", "True", ",", "returnAs", "=", "\"d...
9a022503ad24ca54ce83331482dfa3ff6de9f403
train
unlearn
Find the task named taskPkgName, and delete any/all user-owned .cfg files in the user's resource directory which apply to that task. Like a unix utility, this returns 0 on success (no files found or only 1 found but deleted). For multiple files found, this uses deleteAll, returning the file-name-list i...
lib/stsci/tools/teal.py
def unlearn(taskPkgName, deleteAll=False): """ Find the task named taskPkgName, and delete any/all user-owned .cfg files in the user's resource directory which apply to that task. Like a unix utility, this returns 0 on success (no files found or only 1 found but deleted). For multiple files found, this...
def unlearn(taskPkgName, deleteAll=False): """ Find the task named taskPkgName, and delete any/all user-owned .cfg files in the user's resource directory which apply to that task. Like a unix utility, this returns 0 on success (no files found or only 1 found but deleted). For multiple files found, this...
[ "Find", "the", "task", "named", "taskPkgName", "and", "delete", "any", "/", "all", "user", "-", "owned", ".", "cfg", "files", "in", "the", "user", "s", "resource", "directory", "which", "apply", "to", "that", "task", ".", "Like", "a", "unix", "utility", ...
spacetelescope/stsci.tools
python
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/teal.py#L248-L270
[ "def", "unlearn", "(", "taskPkgName", ",", "deleteAll", "=", "False", ")", ":", "# this WILL throw an exception if the taskPkgName isn't found", "flist", "=", "cfgpars", ".", "getUsrCfgFilesForPyPkg", "(", "taskPkgName", ")", "# can raise", "if", "flist", "is", "None", ...
9a022503ad24ca54ce83331482dfa3ff6de9f403
train
diffFromDefaults
Load the given file (or existing object), and return a dict of its values which are different from the default values. If report is set, print to stdout the differences.
lib/stsci/tools/teal.py
def diffFromDefaults(theTask, report=False): """ Load the given file (or existing object), and return a dict of its values which are different from the default values. If report is set, print to stdout the differences. """ # get the 2 dicts (trees: dicts of dicts) defaultTree = load(theTask, canExe...
def diffFromDefaults(theTask, report=False): """ Load the given file (or existing object), and return a dict of its values which are different from the default values. If report is set, print to stdout the differences. """ # get the 2 dicts (trees: dicts of dicts) defaultTree = load(theTask, canExe...
[ "Load", "the", "given", "file", "(", "or", "existing", "object", ")", "and", "return", "a", "dict", "of", "its", "values", "which", "are", "different", "from", "the", "default", "values", ".", "If", "report", "is", "set", "print", "to", "stdout", "the", ...
spacetelescope/stsci.tools
python
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/teal.py#L273-L297
[ "def", "diffFromDefaults", "(", "theTask", ",", "report", "=", "False", ")", ":", "# get the 2 dicts (trees: dicts of dicts)", "defaultTree", "=", "load", "(", "theTask", ",", "canExecute", "=", "False", ",", "strict", "=", "True", ",", "defaults", "=", "True", ...
9a022503ad24ca54ce83331482dfa3ff6de9f403
train
_isInstalled
Return True if the given file name is located in an installed area (versus a user-owned file)
lib/stsci/tools/teal.py
def _isInstalled(fullFname): """ Return True if the given file name is located in an installed area (versus a user-owned file) """ if not fullFname: return False if not os.path.exists(fullFname): return False instAreas = [] try: import site instAreas = site.getsitepackages() ...
def _isInstalled(fullFname): """ Return True if the given file name is located in an installed area (versus a user-owned file) """ if not fullFname: return False if not os.path.exists(fullFname): return False instAreas = [] try: import site instAreas = site.getsitepackages() ...
[ "Return", "True", "if", "the", "given", "file", "name", "is", "located", "in", "an", "installed", "area", "(", "versus", "a", "user", "-", "owned", "file", ")" ]
spacetelescope/stsci.tools
python
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/teal.py#L304-L320
[ "def", "_isInstalled", "(", "fullFname", ")", ":", "if", "not", "fullFname", ":", "return", "False", "if", "not", "os", ".", "path", ".", "exists", "(", "fullFname", ")", ":", "return", "False", "instAreas", "=", "[", "]", "try", ":", "import", "site",...
9a022503ad24ca54ce83331482dfa3ff6de9f403
train
execEmbCode
.cfgspc embedded code execution is done here, in a relatively confined space. The variables available to the code to be executed are: SCOPE, NAME, VAL, PARENT, TEAL The code string itself is expected to set a var named OUT
lib/stsci/tools/teal.py
def execEmbCode(SCOPE, NAME, VAL, TEAL, codeStr): """ .cfgspc embedded code execution is done here, in a relatively confined space. The variables available to the code to be executed are: SCOPE, NAME, VAL, PARENT, TEAL The code string itself is expected to set a var named OUT """ ...
def execEmbCode(SCOPE, NAME, VAL, TEAL, codeStr): """ .cfgspc embedded code execution is done here, in a relatively confined space. The variables available to the code to be executed are: SCOPE, NAME, VAL, PARENT, TEAL The code string itself is expected to set a var named OUT """ ...
[ ".", "cfgspc", "embedded", "code", "execution", "is", "done", "here", "in", "a", "relatively", "confined", "space", ".", "The", "variables", "available", "to", "the", "code", "to", "be", "executed", "are", ":", "SCOPE", "NAME", "VAL", "PARENT", "TEAL", "Th...
spacetelescope/stsci.tools
python
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/teal.py#L343-L361
[ "def", "execEmbCode", "(", "SCOPE", ",", "NAME", ",", "VAL", ",", "TEAL", ",", "codeStr", ")", ":", "# This was all we needed in Python 2.x", "# OUT = None", "# exec codeStr", "# return OUT", "# In Python 3 (& 2.x) be more explicit: http://bugs.python.org/issue4831", "PA...
9a022503ad24ca54ce83331482dfa3ff6de9f403
train
print_tasknames
Print a message listing TEAL-enabled tasks available under a given installation directory (where pkgName resides). If always is True, this will always print when tasks are found; otherwise it will only print found tasks when in interactive mode. The parameter 'hidden' supports a ...
lib/stsci/tools/teal.py
def print_tasknames(pkgName, aDir, term_width=80, always=False, hidden=None): """ Print a message listing TEAL-enabled tasks available under a given installation directory (where pkgName resides). If always is True, this will always print when tasks are found; otherwise i...
def print_tasknames(pkgName, aDir, term_width=80, always=False, hidden=None): """ Print a message listing TEAL-enabled tasks available under a given installation directory (where pkgName resides). If always is True, this will always print when tasks are found; otherwise i...
[ "Print", "a", "message", "listing", "TEAL", "-", "enabled", "tasks", "available", "under", "a", "given", "installation", "directory", "(", "where", "pkgName", "resides", ")", ".", "If", "always", "is", "True", "this", "will", "always", "print", "when", "task...
spacetelescope/stsci.tools
python
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/teal.py#L365-L400
[ "def", "print_tasknames", "(", "pkgName", ",", "aDir", ",", "term_width", "=", "80", ",", "always", "=", "False", ",", "hidden", "=", "None", ")", ":", "# See if we can bail out early", "if", "not", "always", ":", "# We can't use the sys.ps1 check if in PyRAF since ...
9a022503ad24ca54ce83331482dfa3ff6de9f403
train
getHelpFileAsString
This functions will return useful help as a string read from a file in the task's installed directory called "<module>.help". If no such file can be found, it will simply return an empty string. Notes ----- The location of the actual help file will be found under the task's installed directory...
lib/stsci/tools/teal.py
def getHelpFileAsString(taskname,taskpath): """ This functions will return useful help as a string read from a file in the task's installed directory called "<module>.help". If no such file can be found, it will simply return an empty string. Notes ----- The location of the actual help fil...
def getHelpFileAsString(taskname,taskpath): """ This functions will return useful help as a string read from a file in the task's installed directory called "<module>.help". If no such file can be found, it will simply return an empty string. Notes ----- The location of the actual help fil...
[ "This", "functions", "will", "return", "useful", "help", "as", "a", "string", "read", "from", "a", "file", "in", "the", "task", "s", "installed", "directory", "called", "<module", ">", ".", "help", "." ]
spacetelescope/stsci.tools
python
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/teal.py#L402-L451
[ "def", "getHelpFileAsString", "(", "taskname", ",", "taskpath", ")", ":", "#get the local library directory where the code is stored", "pathsplit", "=", "os", ".", "path", ".", "split", "(", "taskpath", ")", "# taskpath should be task's __file__", "if", "taskname", ".", ...
9a022503ad24ca54ce83331482dfa3ff6de9f403
train
cfgGetBool
Get a stringified val from a ConfigObj obj and return it as bool
lib/stsci/tools/teal.py
def cfgGetBool(theObj, name, dflt): """ Get a stringified val from a ConfigObj obj and return it as bool """ strval = theObj.get(name, None) if strval is None: return dflt return strval.lower().strip() == 'true'
def cfgGetBool(theObj, name, dflt): """ Get a stringified val from a ConfigObj obj and return it as bool """ strval = theObj.get(name, None) if strval is None: return dflt return strval.lower().strip() == 'true'
[ "Get", "a", "stringified", "val", "from", "a", "ConfigObj", "obj", "and", "return", "it", "as", "bool" ]
spacetelescope/stsci.tools
python
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/teal.py#L454-L459
[ "def", "cfgGetBool", "(", "theObj", ",", "name", ",", "dflt", ")", ":", "strval", "=", "theObj", ".", "get", "(", "name", ",", "None", ")", "if", "strval", "is", "None", ":", "return", "dflt", "return", "strval", ".", "lower", "(", ")", ".", "strip...
9a022503ad24ca54ce83331482dfa3ff6de9f403
train
ConfigObjEparDialog._overrideMasterSettings
Override so that we can run in a different mode.
lib/stsci/tools/teal.py
def _overrideMasterSettings(self): """ Override so that we can run in a different mode. """ # config-obj dict of defaults cod = self._getGuiSettings() # our own GUI setup self._appName = APP_NAME self._appHelpString = tealHelpString self._useS...
def _overrideMasterSettings(self): """ Override so that we can run in a different mode. """ # config-obj dict of defaults cod = self._getGuiSettings() # our own GUI setup self._appName = APP_NAME self._appHelpString = tealHelpString self._useS...
[ "Override", "so", "that", "we", "can", "run", "in", "a", "different", "mode", "." ]
spacetelescope/stsci.tools
python
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/teal.py#L488-L531
[ "def", "_overrideMasterSettings", "(", "self", ")", ":", "# config-obj dict of defaults", "cod", "=", "self", ".", "_getGuiSettings", "(", ")", "# our own GUI setup", "self", ".", "_appName", "=", "APP_NAME", "self", ".", "_appHelpString", "=", "tealHelpString", "se...
9a022503ad24ca54ce83331482dfa3ff6de9f403
train
ConfigObjEparDialog._doActualSave
Override this so we can handle case of file not writable, as well as to make our _lastSavedState copy.
lib/stsci/tools/teal.py
def _doActualSave(self, fname, comment, set_ro=False, overwriteRO=False): """ Override this so we can handle case of file not writable, as well as to make our _lastSavedState copy. """ self.debug('Saving, file name given: '+str(fname)+', set_ro: '+\ str(set_ro)+', overwrit...
def _doActualSave(self, fname, comment, set_ro=False, overwriteRO=False): """ Override this so we can handle case of file not writable, as well as to make our _lastSavedState copy. """ self.debug('Saving, file name given: '+str(fname)+', set_ro: '+\ str(set_ro)+', overwrit...
[ "Override", "this", "so", "we", "can", "handle", "case", "of", "file", "not", "writable", "as", "well", "as", "to", "make", "our", "_lastSavedState", "copy", "." ]
spacetelescope/stsci.tools
python
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/teal.py#L540-L586
[ "def", "_doActualSave", "(", "self", ",", "fname", ",", "comment", ",", "set_ro", "=", "False", ",", "overwriteRO", "=", "False", ")", ":", "self", ".", "debug", "(", "'Saving, file name given: '", "+", "str", "(", "fname", ")", "+", "', set_ro: '", "+", ...
9a022503ad24ca54ce83331482dfa3ff6de9f403
train
ConfigObjEparDialog.hasUnsavedChanges
Determine if there are any edits in the GUI that have not yet been saved (e.g. to a file).
lib/stsci/tools/teal.py
def hasUnsavedChanges(self): """ Determine if there are any edits in the GUI that have not yet been saved (e.g. to a file). """ # Sanity check - this case shouldn't occur assert self._lastSavedState is not None, \ "BUG: Please report this as it should never occur." ...
def hasUnsavedChanges(self): """ Determine if there are any edits in the GUI that have not yet been saved (e.g. to a file). """ # Sanity check - this case shouldn't occur assert self._lastSavedState is not None, \ "BUG: Please report this as it should never occur." ...
[ "Determine", "if", "there", "are", "any", "edits", "in", "the", "GUI", "that", "have", "not", "yet", "been", "saved", "(", "e", ".", "g", ".", "to", "a", "file", ")", "." ]
spacetelescope/stsci.tools
python
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/teal.py#L594-L615
[ "def", "hasUnsavedChanges", "(", "self", ")", ":", "# Sanity check - this case shouldn't occur", "assert", "self", ".", "_lastSavedState", "is", "not", "None", ",", "\"BUG: Please report this as it should never occur.\"", "# Force the current GUI values into our model in memory, but ...
9a022503ad24ca54ce83331482dfa3ff6de9f403
train
ConfigObjEparDialog._defineEditedCallbackObjectFor
Override to allow us to use an edited callback.
lib/stsci/tools/teal.py
def _defineEditedCallbackObjectFor(self, parScope, parName): """ Override to allow us to use an edited callback. """ # We know that the _taskParsObj is a ConfigObjPars triggerStrs = self._taskParsObj.getTriggerStrings(parScope, parName) # Some items will have a trigger, but likely most...
def _defineEditedCallbackObjectFor(self, parScope, parName): """ Override to allow us to use an edited callback. """ # We know that the _taskParsObj is a ConfigObjPars triggerStrs = self._taskParsObj.getTriggerStrings(parScope, parName) # Some items will have a trigger, but likely most...
[ "Override", "to", "allow", "us", "to", "use", "an", "edited", "callback", "." ]
spacetelescope/stsci.tools
python
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/teal.py#L619-L629
[ "def", "_defineEditedCallbackObjectFor", "(", "self", ",", "parScope", ",", "parName", ")", ":", "# We know that the _taskParsObj is a ConfigObjPars", "triggerStrs", "=", "self", ".", "_taskParsObj", ".", "getTriggerStrings", "(", "parScope", ",", "parName", ")", "# Som...
9a022503ad24ca54ce83331482dfa3ff6de9f403
train
ConfigObjEparDialog.updateTitle
Override so we can append read-only status.
lib/stsci/tools/teal.py
def updateTitle(self, atitle): """ Override so we can append read-only status. """ if atitle and os.path.exists(atitle): if _isInstalled(atitle): atitle += ' [installed]' elif not os.access(atitle, os.W_OK): atitle += ' [read only]' super...
def updateTitle(self, atitle): """ Override so we can append read-only status. """ if atitle and os.path.exists(atitle): if _isInstalled(atitle): atitle += ' [installed]' elif not os.access(atitle, os.W_OK): atitle += ' [read only]' super...
[ "Override", "so", "we", "can", "append", "read", "-", "only", "status", "." ]
spacetelescope/stsci.tools
python
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/teal.py#L643-L650
[ "def", "updateTitle", "(", "self", ",", "atitle", ")", ":", "if", "atitle", "and", "os", ".", "path", ".", "exists", "(", "atitle", ")", ":", "if", "_isInstalled", "(", "atitle", ")", ":", "atitle", "+=", "' [installed]'", "elif", "not", "os", ".", ...
9a022503ad24ca54ce83331482dfa3ff6de9f403
train
ConfigObjEparDialog.edited
This is the callback function invoked when an item is edited. This is only called for those items which were previously specified to use this mechanism. We do not turn this on for all items because the performance might be prohibitive. This kicks off any previously regis...
lib/stsci/tools/teal.py
def edited(self, scope, name, lastSavedVal, newVal, action): """ This is the callback function invoked when an item is edited. This is only called for those items which were previously specified to use this mechanism. We do not turn this on for all items because the performa...
def edited(self, scope, name, lastSavedVal, newVal, action): """ This is the callback function invoked when an item is edited. This is only called for those items which were previously specified to use this mechanism. We do not turn this on for all items because the performa...
[ "This", "is", "the", "callback", "function", "invoked", "when", "an", "item", "is", "edited", ".", "This", "is", "only", "called", "for", "those", "items", "which", "were", "previously", "specified", "to", "use", "this", "mechanism", ".", "We", "do", "not"...
spacetelescope/stsci.tools
python
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/teal.py#L653-L755
[ "def", "edited", "(", "self", ",", "scope", ",", "name", ",", "lastSavedVal", ",", "newVal", ",", "action", ")", ":", "# Get name(s) of any triggers that this par triggers", "triggerNamesTup", "=", "self", ".", "_taskParsObj", ".", "getTriggerStrings", "(", "scope",...
9a022503ad24ca54ce83331482dfa3ff6de9f403
train
ConfigObjEparDialog.findNextSection
Starts with given par (scope+name) and looks further down the list of parameters until one of a different non-null scope is found. Upon success, returns the (scope, name) tuple, otherwise (None, None).
lib/stsci/tools/teal.py
def findNextSection(self, scope, name): """ Starts with given par (scope+name) and looks further down the list of parameters until one of a different non-null scope is found. Upon success, returns the (scope, name) tuple, otherwise (None, None). """ # first find index of starting point ...
def findNextSection(self, scope, name): """ Starts with given par (scope+name) and looks further down the list of parameters until one of a different non-null scope is found. Upon success, returns the (scope, name) tuple, otherwise (None, None). """ # first find index of starting point ...
[ "Starts", "with", "given", "par", "(", "scope", "+", "name", ")", "and", "looks", "further", "down", "the", "list", "of", "parameters", "until", "one", "of", "a", "different", "non", "-", "null", "scope", "is", "found", ".", "Upon", "success", "returns",...
spacetelescope/stsci.tools
python
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/teal.py#L758-L778
[ "def", "findNextSection", "(", "self", ",", "scope", ",", "name", ")", ":", "# first find index of starting point", "plist", "=", "self", ".", "_taskParsObj", ".", "getParList", "(", ")", "start", "=", "0", "for", "i", "in", "range", "(", "len", "(", "plis...
9a022503ad24ca54ce83331482dfa3ff6de9f403
train
ConfigObjEparDialog._setTaskParsObj
Overridden version for ConfigObj. theTask can be either a .cfg file name or a ConfigObjPars object.
lib/stsci/tools/teal.py
def _setTaskParsObj(self, theTask): """ Overridden version for ConfigObj. theTask can be either a .cfg file name or a ConfigObjPars object. """ # Create the ConfigObjPars obj self._taskParsObj = cfgpars.getObjectFromTaskArg(theTask, self._strict, F...
def _setTaskParsObj(self, theTask): """ Overridden version for ConfigObj. theTask can be either a .cfg file name or a ConfigObjPars object. """ # Create the ConfigObjPars obj self._taskParsObj = cfgpars.getObjectFromTaskArg(theTask, self._strict, F...
[ "Overridden", "version", "for", "ConfigObj", ".", "theTask", "can", "be", "either", "a", ".", "cfg", "file", "name", "or", "a", "ConfigObjPars", "object", "." ]
spacetelescope/stsci.tools
python
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/teal.py#L781-L792
[ "def", "_setTaskParsObj", "(", "self", ",", "theTask", ")", ":", "# Create the ConfigObjPars obj", "self", ".", "_taskParsObj", "=", "cfgpars", ".", "getObjectFromTaskArg", "(", "theTask", ",", "self", ".", "_strict", ",", "False", ")", "# Tell it that we can be use...
9a022503ad24ca54ce83331482dfa3ff6de9f403
train
ConfigObjEparDialog._getSaveAsFilter
Return a string to be used as the filter arg to the save file dialog during Save-As.
lib/stsci/tools/teal.py
def _getSaveAsFilter(self): """ Return a string to be used as the filter arg to the save file dialog during Save-As. """ # figure the dir to use, start with the one from the file absRcDir = os.path.abspath(self._rcDir) thedir = os.path.abspath(os.path.dirname(self._taskParsOb...
def _getSaveAsFilter(self): """ Return a string to be used as the filter arg to the save file dialog during Save-As. """ # figure the dir to use, start with the one from the file absRcDir = os.path.abspath(self._rcDir) thedir = os.path.abspath(os.path.dirname(self._taskParsOb...
[ "Return", "a", "string", "to", "be", "used", "as", "the", "filter", "arg", "to", "the", "save", "file", "dialog", "during", "Save", "-", "As", "." ]
spacetelescope/stsci.tools
python
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/teal.py#L797-L813
[ "def", "_getSaveAsFilter", "(", "self", ")", ":", "# figure the dir to use, start with the one from the file", "absRcDir", "=", "os", ".", "path", ".", "abspath", "(", "self", ".", "_rcDir", ")", "thedir", "=", "os", ".", "path", ".", "abspath", "(", "os", "."...
9a022503ad24ca54ce83331482dfa3ff6de9f403
train
ConfigObjEparDialog._getOpenChoices
Go through all possible sites to find applicable .cfg files. Return as an iterable.
lib/stsci/tools/teal.py
def _getOpenChoices(self): """ Go through all possible sites to find applicable .cfg files. Return as an iterable. """ tsk = self._taskParsObj.getName() taskFiles = set() dirsSoFar = [] # this helps speed this up (skip unneeded globs) # last dir aDir = os.pat...
def _getOpenChoices(self): """ Go through all possible sites to find applicable .cfg files. Return as an iterable. """ tsk = self._taskParsObj.getName() taskFiles = set() dirsSoFar = [] # this helps speed this up (skip unneeded globs) # last dir aDir = os.pat...
[ "Go", "through", "all", "possible", "sites", "to", "find", "applicable", ".", "cfg", "files", ".", "Return", "as", "an", "iterable", "." ]
spacetelescope/stsci.tools
python
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/teal.py#L816-L863
[ "def", "_getOpenChoices", "(", "self", ")", ":", "tsk", "=", "self", ".", "_taskParsObj", ".", "getName", "(", ")", "taskFiles", "=", "set", "(", ")", "dirsSoFar", "=", "[", "]", "# this helps speed this up (skip unneeded globs)", "# last dir", "aDir", "=", "o...
9a022503ad24ca54ce83331482dfa3ff6de9f403
train
ConfigObjEparDialog.pfopen
Load the parameter settings from a user-specified file.
lib/stsci/tools/teal.py
def pfopen(self, event=None): """ Load the parameter settings from a user-specified file. """ # Get the selected file name fname = self._openMenuChoice.get() # Also allow them to simply find any file - do not check _task_name_... # (could use tkinter's FileDialog, but this one ...
def pfopen(self, event=None): """ Load the parameter settings from a user-specified file. """ # Get the selected file name fname = self._openMenuChoice.get() # Also allow them to simply find any file - do not check _task_name_... # (could use tkinter's FileDialog, but this one ...
[ "Load", "the", "parameter", "settings", "from", "a", "user", "-", "specified", "file", "." ]
spacetelescope/stsci.tools
python
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/teal.py#L867-L934
[ "def", "pfopen", "(", "self", ",", "event", "=", "None", ")", ":", "# Get the selected file name", "fname", "=", "self", ".", "_openMenuChoice", ".", "get", "(", ")", "# Also allow them to simply find any file - do not check _task_name_...", "# (could use tkinter's FileDial...
9a022503ad24ca54ce83331482dfa3ff6de9f403
train
ConfigObjEparDialog._handleParListMismatch
Override to include ConfigObj filename and specific errors. Note that this only handles "missing" pars and "extra" pars, not wrong-type pars. So it isn't that big of a deal.
lib/stsci/tools/teal.py
def _handleParListMismatch(self, probStr, extra=False): """ Override to include ConfigObj filename and specific errors. Note that this only handles "missing" pars and "extra" pars, not wrong-type pars. So it isn't that big of a deal. """ # keep down the duplicate errors if extr...
def _handleParListMismatch(self, probStr, extra=False): """ Override to include ConfigObj filename and specific errors. Note that this only handles "missing" pars and "extra" pars, not wrong-type pars. So it isn't that big of a deal. """ # keep down the duplicate errors if extr...
[ "Override", "to", "include", "ConfigObj", "filename", "and", "specific", "errors", ".", "Note", "that", "this", "only", "handles", "missing", "pars", "and", "extra", "pars", "not", "wrong", "-", "type", "pars", ".", "So", "it", "isn", "t", "that", "big", ...
spacetelescope/stsci.tools
python
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/teal.py#L944-L965
[ "def", "_handleParListMismatch", "(", "self", ",", "probStr", ",", "extra", "=", "False", ")", ":", "# keep down the duplicate errors", "if", "extra", ":", "return", "True", "# the base class is already stating it will be ignored", "# find the actual errors, and then add that t...
9a022503ad24ca54ce83331482dfa3ff6de9f403
train
ConfigObjEparDialog._setToDefaults
Load the default parameter settings into the GUI.
lib/stsci/tools/teal.py
def _setToDefaults(self): """ Load the default parameter settings into the GUI. """ # Create an empty object, where every item is set to it's default value try: tmpObj = cfgpars.ConfigObjPars(self._taskParsObj.filename, associatedPkg=\ ...
def _setToDefaults(self): """ Load the default parameter settings into the GUI. """ # Create an empty object, where every item is set to it's default value try: tmpObj = cfgpars.ConfigObjPars(self._taskParsObj.filename, associatedPkg=\ ...
[ "Load", "the", "default", "parameter", "settings", "into", "the", "GUI", "." ]
spacetelescope/stsci.tools
python
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/teal.py#L968-L993
[ "def", "_setToDefaults", "(", "self", ")", ":", "# Create an empty object, where every item is set to it's default value", "try", ":", "tmpObj", "=", "cfgpars", ".", "ConfigObjPars", "(", "self", ".", "_taskParsObj", ".", "filename", ",", "associatedPkg", "=", "self", ...
9a022503ad24ca54ce83331482dfa3ff6de9f403
train
ConfigObjEparDialog.getDict
Retrieve the current parameter settings from the GUI.
lib/stsci/tools/teal.py
def getDict(self): """ Retrieve the current parameter settings from the GUI.""" # We are going to have to return the dict so let's # first make sure all of our models are up to date with the values in # the GUI right now. badList = self.checkSetSaveEntries(doSave=False) i...
def getDict(self): """ Retrieve the current parameter settings from the GUI.""" # We are going to have to return the dict so let's # first make sure all of our models are up to date with the values in # the GUI right now. badList = self.checkSetSaveEntries(doSave=False) i...
[ "Retrieve", "the", "current", "parameter", "settings", "from", "the", "GUI", "." ]
spacetelescope/stsci.tools
python
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/teal.py#L995-L1003
[ "def", "getDict", "(", "self", ")", ":", "# We are going to have to return the dict so let's", "# first make sure all of our models are up to date with the values in", "# the GUI right now.", "badList", "=", "self", ".", "checkSetSaveEntries", "(", "doSave", "=", "False", ")", ...
9a022503ad24ca54ce83331482dfa3ff6de9f403
train
ConfigObjEparDialog.loadDict
Load the parameter settings from a given dict into the GUI.
lib/stsci/tools/teal.py
def loadDict(self, theDict): """ Load the parameter settings from a given dict into the GUI. """ # We are going to have to merge this info into ourselves so let's # first make sure all of our models are up to date with the values in # the GUI right now. badList = self.checkSetSav...
def loadDict(self, theDict): """ Load the parameter settings from a given dict into the GUI. """ # We are going to have to merge this info into ourselves so let's # first make sure all of our models are up to date with the values in # the GUI right now. badList = self.checkSetSav...
[ "Load", "the", "parameter", "settings", "from", "a", "given", "dict", "into", "the", "GUI", "." ]
spacetelescope/stsci.tools
python
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/teal.py#L1005-L1030
[ "def", "loadDict", "(", "self", ",", "theDict", ")", ":", "# We are going to have to merge this info into ourselves so let's", "# first make sure all of our models are up to date with the values in", "# the GUI right now.", "badList", "=", "self", ".", "checkSetSaveEntries", "(", "...
9a022503ad24ca54ce83331482dfa3ff6de9f403
train
ConfigObjEparDialog._getGuiSettings
Return a dict (ConfigObj) of all user settings found in rcFile.
lib/stsci/tools/teal.py
def _getGuiSettings(self): """ Return a dict (ConfigObj) of all user settings found in rcFile. """ # Put the settings into a ConfigObj dict (don't use a config-spec) rcFile = self._rcDir+os.sep+APP_NAME.lower()+'.cfg' if os.path.exists(rcFile): try: return con...
def _getGuiSettings(self): """ Return a dict (ConfigObj) of all user settings found in rcFile. """ # Put the settings into a ConfigObj dict (don't use a config-spec) rcFile = self._rcDir+os.sep+APP_NAME.lower()+'.cfg' if os.path.exists(rcFile): try: return con...
[ "Return", "a", "dict", "(", "ConfigObj", ")", "of", "all", "user", "settings", "found", "in", "rcFile", "." ]
spacetelescope/stsci.tools
python
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/teal.py#L1033-L1046
[ "def", "_getGuiSettings", "(", "self", ")", ":", "# Put the settings into a ConfigObj dict (don't use a config-spec)", "rcFile", "=", "self", ".", "_rcDir", "+", "os", ".", "sep", "+", "APP_NAME", ".", "lower", "(", ")", "+", "'.cfg'", "if", "os", ".", "path", ...
9a022503ad24ca54ce83331482dfa3ff6de9f403
train
ConfigObjEparDialog._saveGuiSettings
The base class doesn't implement this, so we will - save settings (only GUI stuff, not task related) to a file.
lib/stsci/tools/teal.py
def _saveGuiSettings(self): """ The base class doesn't implement this, so we will - save settings (only GUI stuff, not task related) to a file. """ # Put the settings into a ConfigObj dict (don't use a config-spec) rcFile = self._rcDir+os.sep+APP_NAME.lower()+'.cfg' # if ...
def _saveGuiSettings(self): """ The base class doesn't implement this, so we will - save settings (only GUI stuff, not task related) to a file. """ # Put the settings into a ConfigObj dict (don't use a config-spec) rcFile = self._rcDir+os.sep+APP_NAME.lower()+'.cfg' # if ...
[ "The", "base", "class", "doesn", "t", "implement", "this", "so", "we", "will", "-", "save", "settings", "(", "only", "GUI", "stuff", "not", "task", "related", ")", "to", "a", "file", "." ]
spacetelescope/stsci.tools
python
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/teal.py#L1049-L1072
[ "def", "_saveGuiSettings", "(", "self", ")", ":", "# Put the settings into a ConfigObj dict (don't use a config-spec)", "rcFile", "=", "self", ".", "_rcDir", "+", "os", ".", "sep", "+", "APP_NAME", ".", "lower", "(", ")", "+", "'.cfg'", "#", "if", "os", ".", "...
9a022503ad24ca54ce83331482dfa3ff6de9f403
train
ConfigObjEparDialog._applyTriggerValue
Here we look through the entire .cfgspc to see if any parameters are affected by this trigger. For those that are, we apply the action to the GUI widget. The action is specified by depType.
lib/stsci/tools/teal.py
def _applyTriggerValue(self, triggerName, outval): """ Here we look through the entire .cfgspc to see if any parameters are affected by this trigger. For those that are, we apply the action to the GUI widget. The action is specified by depType. """ # First find which items are dependen...
def _applyTriggerValue(self, triggerName, outval): """ Here we look through the entire .cfgspc to see if any parameters are affected by this trigger. For those that are, we apply the action to the GUI widget. The action is specified by depType. """ # First find which items are dependen...
[ "Here", "we", "look", "through", "the", "entire", ".", "cfgspc", "to", "see", "if", "any", "parameters", "are", "affected", "by", "this", "trigger", ".", "For", "those", "that", "are", "we", "apply", "the", "action", "to", "the", "GUI", "widget", ".", ...
spacetelescope/stsci.tools
python
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/teal.py#L1075-L1161
[ "def", "_applyTriggerValue", "(", "self", ",", "triggerName", ",", "outval", ")", ":", "# First find which items are dependent upon this trigger (cached)", "# e.g. { scope1.name1 : dep'cy-type, scope2.name2 : dep'cy-type, ... }", "depParsDict", "=", "self", ".", "_taskParsObj", "."...
9a022503ad24ca54ce83331482dfa3ff6de9f403
train
readASNTable
Given a fits filename repesenting an association table reads in the table as a dictionary which can be used by pydrizzle and multidrizzle. An association table is a FITS binary table with 2 required columns: 'MEMNAME', 'MEMTYPE'. It checks 'MEMPRSNT' column and removes all files for which its value is 'no'...
lib/stsci/tools/asnutil.py
def readASNTable(fname, output=None, prodonly=False): """ Given a fits filename repesenting an association table reads in the table as a dictionary which can be used by pydrizzle and multidrizzle. An association table is a FITS binary table with 2 required columns: 'MEMNAME', 'MEMTYPE'. It checks '...
def readASNTable(fname, output=None, prodonly=False): """ Given a fits filename repesenting an association table reads in the table as a dictionary which can be used by pydrizzle and multidrizzle. An association table is a FITS binary table with 2 required columns: 'MEMNAME', 'MEMTYPE'. It checks '...
[ "Given", "a", "fits", "filename", "repesenting", "an", "association", "table", "reads", "in", "the", "table", "as", "a", "dictionary", "which", "can", "be", "used", "by", "pydrizzle", "and", "multidrizzle", "." ]
spacetelescope/stsci.tools
python
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/asnutil.py#L24-L168
[ "def", "readASNTable", "(", "fname", ",", "output", "=", "None", ",", "prodonly", "=", "False", ")", ":", "try", ":", "f", "=", "fits", ".", "open", "(", "fu", ".", "osfn", "(", "fname", ")", ")", "except", ":", "raise", "IOError", "(", "\"Can't op...
9a022503ad24ca54ce83331482dfa3ff6de9f403
train
ASNTable.write
Write association table to a file.
lib/stsci/tools/asnutil.py
def write(self, output=None): """ Write association table to a file. """ if not output: outfile = self['output']+'_asn.fits' output = self['output'] else: outfile = output # Delete the file if it exists. if os.path.exists(outf...
def write(self, output=None): """ Write association table to a file. """ if not output: outfile = self['output']+'_asn.fits' output = self['output'] else: outfile = output # Delete the file if it exists. if os.path.exists(outf...
[ "Write", "association", "table", "to", "a", "file", "." ]
spacetelescope/stsci.tools
python
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/asnutil.py#L353-L429
[ "def", "write", "(", "self", ",", "output", "=", "None", ")", ":", "if", "not", "output", ":", "outfile", "=", "self", "[", "'output'", "]", "+", "'_asn.fits'", "output", "=", "self", "[", "'output'", "]", "else", ":", "outfile", "=", "output", "# De...
9a022503ad24ca54ce83331482dfa3ff6de9f403
train
ShiftFile.readShiftFile
Reads a shift file from disk and populates a dictionary.
lib/stsci/tools/asnutil.py
def readShiftFile(self, filename): """ Reads a shift file from disk and populates a dictionary. """ order = [] fshift = open(filename,'r') flines = fshift.readlines() fshift.close() common = [f.strip('#').strip() for f in flines if f.startswith('#')] ...
def readShiftFile(self, filename): """ Reads a shift file from disk and populates a dictionary. """ order = [] fshift = open(filename,'r') flines = fshift.readlines() fshift.close() common = [f.strip('#').strip() for f in flines if f.startswith('#')] ...
[ "Reads", "a", "shift", "file", "from", "disk", "and", "populates", "a", "dictionary", "." ]
spacetelescope/stsci.tools
python
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/asnutil.py#L616-L675
[ "def", "readShiftFile", "(", "self", ",", "filename", ")", ":", "order", "=", "[", "]", "fshift", "=", "open", "(", "filename", ",", "'r'", ")", "flines", "=", "fshift", ".", "readlines", "(", ")", "fshift", ".", "close", "(", ")", "common", "=", "...
9a022503ad24ca54ce83331482dfa3ff6de9f403
train
ShiftFile.writeShiftFile
Writes a shift file object to a file on disk using the convention for shift file format.
lib/stsci/tools/asnutil.py
def writeShiftFile(self, filename="shifts.txt"): """ Writes a shift file object to a file on disk using the convention for shift file format. """ lines = ['# frame: ', self['frame'], '\n', '# refimage: ', self['refimage'], '\n', '# form: ', self['form'],...
def writeShiftFile(self, filename="shifts.txt"): """ Writes a shift file object to a file on disk using the convention for shift file format. """ lines = ['# frame: ', self['frame'], '\n', '# refimage: ', self['refimage'], '\n', '# form: ', self['form'],...
[ "Writes", "a", "shift", "file", "object", "to", "a", "file", "on", "disk", "using", "the", "convention", "for", "shift", "file", "format", "." ]
spacetelescope/stsci.tools
python
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/asnutil.py#L686-L704
[ "def", "writeShiftFile", "(", "self", ",", "filename", "=", "\"shifts.txt\"", ")", ":", "lines", "=", "[", "'# frame: '", ",", "self", "[", "'frame'", "]", ",", "'\\n'", ",", "'# refimage: '", ",", "self", "[", "'refimage'", "]", ",", "'\\n'", ",", "'# f...
9a022503ad24ca54ce83331482dfa3ff6de9f403
train
weave
Send a message to a recipient Args: target (string, class, instance, function or builtin): The object to weave. aspects (:py:obj:`aspectlib.Aspect`, function decorator or list of): The aspects to apply to the object. subclasses (bool): If ``True``, subcla...
src/aspectlib/__init__.py
def weave(target, aspects, **options): """ Send a message to a recipient Args: target (string, class, instance, function or builtin): The object to weave. aspects (:py:obj:`aspectlib.Aspect`, function decorator or list of): The aspects to apply to the object. ...
def weave(target, aspects, **options): """ Send a message to a recipient Args: target (string, class, instance, function or builtin): The object to weave. aspects (:py:obj:`aspectlib.Aspect`, function decorator or list of): The aspects to apply to the object. ...
[ "Send", "a", "message", "to", "a", "recipient" ]
ionelmc/python-aspectlib
python
https://github.com/ionelmc/python-aspectlib/blob/7dba7651ab76160b9ce66c9c11e770f7844e95ec/src/aspectlib/__init__.py#L366-L506
[ "def", "weave", "(", "target", ",", "aspects", ",", "*", "*", "options", ")", ":", "if", "not", "callable", "(", "aspects", ")", ":", "if", "not", "hasattr", "(", "aspects", ",", "'__iter__'", ")", ":", "raise", "ExpectedAdvice", "(", "'%s must be an `As...
7dba7651ab76160b9ce66c9c11e770f7844e95ec
train
weave_instance
Low-level weaver for instances. .. warning:: You should not use this directly. :returns: An :obj:`aspectlib.Rollback` object.
src/aspectlib/__init__.py
def weave_instance(instance, aspect, methods=NORMAL_METHODS, lazy=False, bag=BrokenBag, **options): """ Low-level weaver for instances. .. warning:: You should not use this directly. :returns: An :obj:`aspectlib.Rollback` object. """ if bag.has(instance): return Nothing entangleme...
def weave_instance(instance, aspect, methods=NORMAL_METHODS, lazy=False, bag=BrokenBag, **options): """ Low-level weaver for instances. .. warning:: You should not use this directly. :returns: An :obj:`aspectlib.Rollback` object. """ if bag.has(instance): return Nothing entangleme...
[ "Low", "-", "level", "weaver", "for", "instances", "." ]
ionelmc/python-aspectlib
python
https://github.com/ionelmc/python-aspectlib/blob/7dba7651ab76160b9ce66c9c11e770f7844e95ec/src/aspectlib/__init__.py#L524-L555
[ "def", "weave_instance", "(", "instance", ",", "aspect", ",", "methods", "=", "NORMAL_METHODS", ",", "lazy", "=", "False", ",", "bag", "=", "BrokenBag", ",", "*", "*", "options", ")", ":", "if", "bag", ".", "has", "(", "instance", ")", ":", "return", ...
7dba7651ab76160b9ce66c9c11e770f7844e95ec
train
weave_module
Low-level weaver for "whole module weaving". .. warning:: You should not use this directly. :returns: An :obj:`aspectlib.Rollback` object.
src/aspectlib/__init__.py
def weave_module(module, aspect, methods=NORMAL_METHODS, lazy=False, bag=BrokenBag, **options): """ Low-level weaver for "whole module weaving". .. warning:: You should not use this directly. :returns: An :obj:`aspectlib.Rollback` object. """ if bag.has(module): return Nothing ent...
def weave_module(module, aspect, methods=NORMAL_METHODS, lazy=False, bag=BrokenBag, **options): """ Low-level weaver for "whole module weaving". .. warning:: You should not use this directly. :returns: An :obj:`aspectlib.Rollback` object. """ if bag.has(module): return Nothing ent...
[ "Low", "-", "level", "weaver", "for", "whole", "module", "weaving", "." ]
ionelmc/python-aspectlib
python
https://github.com/ionelmc/python-aspectlib/blob/7dba7651ab76160b9ce66c9c11e770f7844e95ec/src/aspectlib/__init__.py#L558-L586
[ "def", "weave_module", "(", "module", ",", "aspect", ",", "methods", "=", "NORMAL_METHODS", ",", "lazy", "=", "False", ",", "bag", "=", "BrokenBag", ",", "*", "*", "options", ")", ":", "if", "bag", ".", "has", "(", "module", ")", ":", "return", "Noth...
7dba7651ab76160b9ce66c9c11e770f7844e95ec
train
weave_class
Low-level weaver for classes. .. warning:: You should not use this directly.
src/aspectlib/__init__.py
def weave_class(klass, aspect, methods=NORMAL_METHODS, subclasses=True, lazy=False, owner=None, name=None, aliases=True, bases=True, bag=BrokenBag): """ Low-level weaver for classes. .. warning:: You should not use this directly. """ assert isclass(klass), "Can't weave %r. Must be a...
def weave_class(klass, aspect, methods=NORMAL_METHODS, subclasses=True, lazy=False, owner=None, name=None, aliases=True, bases=True, bag=BrokenBag): """ Low-level weaver for classes. .. warning:: You should not use this directly. """ assert isclass(klass), "Can't weave %r. Must be a...
[ "Low", "-", "level", "weaver", "for", "classes", "." ]
ionelmc/python-aspectlib
python
https://github.com/ionelmc/python-aspectlib/blob/7dba7651ab76160b9ce66c9c11e770f7844e95ec/src/aspectlib/__init__.py#L589-L666
[ "def", "weave_class", "(", "klass", ",", "aspect", ",", "methods", "=", "NORMAL_METHODS", ",", "subclasses", "=", "True", ",", "lazy", "=", "False", ",", "owner", "=", "None", ",", "name", "=", "None", ",", "aliases", "=", "True", ",", "bases", "=", ...
7dba7651ab76160b9ce66c9c11e770f7844e95ec
train
patch_module
Low-level attribute patcher. :param module module: Object to patch. :param str name: Attribute to patch :param replacement: The replacement value. :param original: The original value (in case the object beeing patched uses descriptors or is plain weird). :param bool aliases: If ``True`` patch all t...
src/aspectlib/__init__.py
def patch_module(module, name, replacement, original=UNSPECIFIED, aliases=True, location=None, **_bogus_options): """ Low-level attribute patcher. :param module module: Object to patch. :param str name: Attribute to patch :param replacement: The replacement value. :param original: The original ...
def patch_module(module, name, replacement, original=UNSPECIFIED, aliases=True, location=None, **_bogus_options): """ Low-level attribute patcher. :param module module: Object to patch. :param str name: Attribute to patch :param replacement: The replacement value. :param original: The original ...
[ "Low", "-", "level", "attribute", "patcher", "." ]
ionelmc/python-aspectlib
python
https://github.com/ionelmc/python-aspectlib/blob/7dba7651ab76160b9ce66c9c11e770f7844e95ec/src/aspectlib/__init__.py#L685-L734
[ "def", "patch_module", "(", "module", ",", "name", ",", "replacement", ",", "original", "=", "UNSPECIFIED", ",", "aliases", "=", "True", ",", "location", "=", "None", ",", "*", "*", "_bogus_options", ")", ":", "rollback", "=", "Rollback", "(", ")", "seen...
7dba7651ab76160b9ce66c9c11e770f7844e95ec
train
patch_module_function
Low-level patcher for one function from a specified module. .. warning:: You should not use this directly. :returns: An :obj:`aspectlib.Rollback` object.
src/aspectlib/__init__.py
def patch_module_function(module, target, aspect, force_name=None, bag=BrokenBag, **options): """ Low-level patcher for one function from a specified module. .. warning:: You should not use this directly. :returns: An :obj:`aspectlib.Rollback` object. """ logdebug("patch_module_function (modul...
def patch_module_function(module, target, aspect, force_name=None, bag=BrokenBag, **options): """ Low-level patcher for one function from a specified module. .. warning:: You should not use this directly. :returns: An :obj:`aspectlib.Rollback` object. """ logdebug("patch_module_function (modul...
[ "Low", "-", "level", "patcher", "for", "one", "function", "from", "a", "specified", "module", "." ]
ionelmc/python-aspectlib
python
https://github.com/ionelmc/python-aspectlib/blob/7dba7651ab76160b9ce66c9c11e770f7844e95ec/src/aspectlib/__init__.py#L737-L748
[ "def", "patch_module_function", "(", "module", ",", "target", ",", "aspect", ",", "force_name", "=", "None", ",", "bag", "=", "BrokenBag", ",", "*", "*", "options", ")", ":", "logdebug", "(", "\"patch_module_function (module=%s, target=%s, aspect=%s, force_name=%s, **...
7dba7651ab76160b9ce66c9c11e770f7844e95ec
train
unframe
Strip leading DLE and trailing DLE/ETX from packet. :param packet: TSIP packet with leading DLE and trailing DLE/ETX. :type packet: Binary string. :return: TSIP packet with leading DLE and trailing DLE/ETX removed. :raise: ``ValueError`` if `packet` does not start with DLE and end in DLE/ETX.
tsip/llapi.py
def unframe(packet): """ Strip leading DLE and trailing DLE/ETX from packet. :param packet: TSIP packet with leading DLE and trailing DLE/ETX. :type packet: Binary string. :return: TSIP packet with leading DLE and trailing DLE/ETX removed. :raise: ``ValueError`` if `packet` does not start with ...
def unframe(packet): """ Strip leading DLE and trailing DLE/ETX from packet. :param packet: TSIP packet with leading DLE and trailing DLE/ETX. :type packet: Binary string. :return: TSIP packet with leading DLE and trailing DLE/ETX removed. :raise: ``ValueError`` if `packet` does not start with ...
[ "Strip", "leading", "DLE", "and", "trailing", "DLE", "/", "ETX", "from", "packet", "." ]
mjuenema/python-TSIP
python
https://github.com/mjuenema/python-TSIP/blob/e02b68d05772127ea493cd639b3d5f8fb73df402/tsip/llapi.py#L41-L56
[ "def", "unframe", "(", "packet", ")", ":", "if", "is_framed", "(", "packet", ")", ":", "return", "packet", ".", "lstrip", "(", "CHR_DLE", ")", ".", "rstrip", "(", "CHR_ETX", ")", ".", "rstrip", "(", "CHR_DLE", ")", "else", ":", "raise", "ValueError", ...
e02b68d05772127ea493cd639b3d5f8fb73df402
train
stuff
Add byte stuffing to TSIP packet. :param packet: TSIP packet with byte stuffing. The packet must already have been stripped or `ValueError` will be raised. :type packet: Binary string. :return: Packet with byte stuffing.
tsip/llapi.py
def stuff(packet): """ Add byte stuffing to TSIP packet. :param packet: TSIP packet with byte stuffing. The packet must already have been stripped or `ValueError` will be raised. :type packet: Binary string. :return: Packet with byte stuffing. """ if is_framed(packet): rais...
def stuff(packet): """ Add byte stuffing to TSIP packet. :param packet: TSIP packet with byte stuffing. The packet must already have been stripped or `ValueError` will be raised. :type packet: Binary string. :return: Packet with byte stuffing. """ if is_framed(packet): rais...
[ "Add", "byte", "stuffing", "to", "TSIP", "packet", ".", ":", "param", "packet", ":", "TSIP", "packet", "with", "byte", "stuffing", ".", "The", "packet", "must", "already", "have", "been", "stripped", "or", "ValueError", "will", "be", "raised", ".", ":", ...
mjuenema/python-TSIP
python
https://github.com/mjuenema/python-TSIP/blob/e02b68d05772127ea493cd639b3d5f8fb73df402/tsip/llapi.py#L59-L72
[ "def", "stuff", "(", "packet", ")", ":", "if", "is_framed", "(", "packet", ")", ":", "raise", "ValueError", "(", "'packet contains leading DLE and trailing DLE/ETX'", ")", "else", ":", "return", "packet", ".", "replace", "(", "CHR_DLE", ",", "CHR_DLE", "+", "C...
e02b68d05772127ea493cd639b3d5f8fb73df402
train
unstuff
Remove byte stuffing from a TSIP packet. :param packet: TSIP packet with byte stuffing. The packet must already have been stripped or `ValueError` will be raised. :type packet: Binary string. :return: Packet without byte stuffing.
tsip/llapi.py
def unstuff(packet): """ Remove byte stuffing from a TSIP packet. :param packet: TSIP packet with byte stuffing. The packet must already have been stripped or `ValueError` will be raised. :type packet: Binary string. :return: Packet without byte stuffing. """ if is_framed(packet):...
def unstuff(packet): """ Remove byte stuffing from a TSIP packet. :param packet: TSIP packet with byte stuffing. The packet must already have been stripped or `ValueError` will be raised. :type packet: Binary string. :return: Packet without byte stuffing. """ if is_framed(packet):...
[ "Remove", "byte", "stuffing", "from", "a", "TSIP", "packet", "." ]
mjuenema/python-TSIP
python
https://github.com/mjuenema/python-TSIP/blob/e02b68d05772127ea493cd639b3d5f8fb73df402/tsip/llapi.py#L76-L90
[ "def", "unstuff", "(", "packet", ")", ":", "if", "is_framed", "(", "packet", ")", ":", "raise", "ValueError", "(", "'packet contains leading DLE and trailing DLE/ETX'", ")", "else", ":", "return", "packet", ".", "replace", "(", "CHR_DLE", "+", "CHR_DLE", ",", ...
e02b68d05772127ea493cd639b3d5f8fb73df402
train
parseFilename
Parse out filename from any specified extensions. Returns rootname and string version of extension name. Modified from 'pydrizzle.fileutil' to allow this module to be independent of PyDrizzle/MultiDrizzle.
lib/stsci/tools/iterfile.py
def parseFilename(filename): """ Parse out filename from any specified extensions. Returns rootname and string version of extension name. Modified from 'pydrizzle.fileutil' to allow this module to be independent of PyDrizzle/MultiDrizzle. """ # Parse out any extension speci...
def parseFilename(filename): """ Parse out filename from any specified extensions. Returns rootname and string version of extension name. Modified from 'pydrizzle.fileutil' to allow this module to be independent of PyDrizzle/MultiDrizzle. """ # Parse out any extension speci...
[ "Parse", "out", "filename", "from", "any", "specified", "extensions", ".", "Returns", "rootname", "and", "string", "version", "of", "extension", "name", "." ]
spacetelescope/stsci.tools
python
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/iterfile.py#L111-L153
[ "def", "parseFilename", "(", "filename", ")", ":", "# Parse out any extension specified in filename", "_indx", "=", "filename", ".", "find", "(", "'['", ")", "if", "_indx", ">", "0", ":", "# Read extension name provided", "_fname", "=", "filename", "[", ":", "_ind...
9a022503ad24ca54ce83331482dfa3ff6de9f403
train
IterFitsFile._shape
Returns the shape of the data array associated with this file.
lib/stsci/tools/iterfile.py
def _shape(self): """ Returns the shape of the data array associated with this file.""" hdu = self.open() _shape = hdu.shape if not self.inmemory: self.close() del hdu return _shape
def _shape(self): """ Returns the shape of the data array associated with this file.""" hdu = self.open() _shape = hdu.shape if not self.inmemory: self.close() del hdu return _shape
[ "Returns", "the", "shape", "of", "the", "data", "array", "associated", "with", "this", "file", "." ]
spacetelescope/stsci.tools
python
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/iterfile.py#L35-L42
[ "def", "_shape", "(", "self", ")", ":", "hdu", "=", "self", ".", "open", "(", ")", "_shape", "=", "hdu", ".", "shape", "if", "not", "self", ".", "inmemory", ":", "self", ".", "close", "(", ")", "del", "hdu", "return", "_shape" ]
9a022503ad24ca54ce83331482dfa3ff6de9f403
train
IterFitsFile._data
Returns the data array associated with this file/extenstion.
lib/stsci/tools/iterfile.py
def _data(self): """ Returns the data array associated with this file/extenstion.""" hdu = self.open() _data = hdu.data.copy() if not self.inmemory: self.close() del hdu return _data
def _data(self): """ Returns the data array associated with this file/extenstion.""" hdu = self.open() _data = hdu.data.copy() if not self.inmemory: self.close() del hdu return _data
[ "Returns", "the", "data", "array", "associated", "with", "this", "file", "/", "extenstion", "." ]
spacetelescope/stsci.tools
python
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/iterfile.py#L44-L51
[ "def", "_data", "(", "self", ")", ":", "hdu", "=", "self", ".", "open", "(", ")", "_data", "=", "hdu", ".", "data", ".", "copy", "(", ")", "if", "not", "self", ".", "inmemory", ":", "self", ".", "close", "(", ")", "del", "hdu", "return", "_data...
9a022503ad24ca54ce83331482dfa3ff6de9f403
train
IterFitsFile.type
Returns the shape of the data array associated with this file.
lib/stsci/tools/iterfile.py
def type(self): """ Returns the shape of the data array associated with this file.""" hdu = self.open() _type = hdu.data.dtype.name if not self.inmemory: self.close() del hdu return _type
def type(self): """ Returns the shape of the data array associated with this file.""" hdu = self.open() _type = hdu.data.dtype.name if not self.inmemory: self.close() del hdu return _type
[ "Returns", "the", "shape", "of", "the", "data", "array", "associated", "with", "this", "file", "." ]
spacetelescope/stsci.tools
python
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/iterfile.py#L53-L60
[ "def", "type", "(", "self", ")", ":", "hdu", "=", "self", ".", "open", "(", ")", "_type", "=", "hdu", ".", "data", ".", "dtype", ".", "name", "if", "not", "self", ".", "inmemory", ":", "self", ".", "close", "(", ")", "del", "hdu", "return", "_t...
9a022503ad24ca54ce83331482dfa3ff6de9f403
train
IterFitsFile.open
Opens the file for subsequent access.
lib/stsci/tools/iterfile.py
def open(self): """ Opens the file for subsequent access. """ if self.handle is None: self.handle = fits.open(self.fname, mode='readonly') if self.extn: if len(self.extn) == 1: hdu = self.handle[self.extn[0]] else: hdu = self....
def open(self): """ Opens the file for subsequent access. """ if self.handle is None: self.handle = fits.open(self.fname, mode='readonly') if self.extn: if len(self.extn) == 1: hdu = self.handle[self.extn[0]] else: hdu = self....
[ "Opens", "the", "file", "for", "subsequent", "access", "." ]
spacetelescope/stsci.tools
python
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/iterfile.py#L62-L77
[ "def", "open", "(", "self", ")", ":", "if", "self", ".", "handle", "is", "None", ":", "self", ".", "handle", "=", "fits", ".", "open", "(", "self", ".", "fname", ",", "mode", "=", "'readonly'", ")", "if", "self", ".", "extn", ":", "if", "len", ...
9a022503ad24ca54ce83331482dfa3ff6de9f403
train
ActiveMeasurement.overlapsWith
Tests if the given times overlap with this measurement. :param targetStartTime: the target start time. :param duration: the duration :return: true if the given times overlap with this measurement.
backend/src/analyser/common/measurementcontroller.py
def overlapsWith(self, targetStartTime, duration): """ Tests if the given times overlap with this measurement. :param targetStartTime: the target start time. :param duration: the duration :return: true if the given times overlap with this measurement. """ targetEn...
def overlapsWith(self, targetStartTime, duration): """ Tests if the given times overlap with this measurement. :param targetStartTime: the target start time. :param duration: the duration :return: true if the given times overlap with this measurement. """ targetEn...
[ "Tests", "if", "the", "given", "times", "overlap", "with", "this", "measurement", ".", ":", "param", "targetStartTime", ":", "the", "target", "start", "time", ".", ":", "param", "duration", ":", "the", "duration", ":", "return", ":", "true", "if", "the", ...
3ll3d00d/vibe
python
https://github.com/3ll3d00d/vibe/blob/124b029f13ac746723e92cb47e9cb56edd2e54b5/backend/src/analyser/common/measurementcontroller.py#L98-L107
[ "def", "overlapsWith", "(", "self", ",", "targetStartTime", ",", "duration", ")", ":", "targetEndTime", "=", "targetStartTime", "+", "datetime", ".", "timedelta", "(", "days", "=", "0", ",", "seconds", "=", "duration", ")", "return", "(", "self", ".", "sta...
124b029f13ac746723e92cb47e9cb56edd2e54b5
train
ActiveMeasurement.updateDeviceStatus
Updates the current device status. :param deviceName: the device name. :param state: the state. :param reason: the reason for the change. :return:
backend/src/analyser/common/measurementcontroller.py
def updateDeviceStatus(self, deviceName, state, reason=None): """ Updates the current device status. :param deviceName: the device name. :param state: the state. :param reason: the reason for the change. :return: """ logger.info('Updating recording device ...
def updateDeviceStatus(self, deviceName, state, reason=None): """ Updates the current device status. :param deviceName: the device name. :param state: the state. :param reason: the reason for the change. :return: """ logger.info('Updating recording device ...
[ "Updates", "the", "current", "device", "status", ".", ":", "param", "deviceName", ":", "the", "device", "name", ".", ":", "param", "state", ":", "the", "state", ".", ":", "param", "reason", ":", "the", "reason", "for", "the", "change", ".", ":", "retur...
3ll3d00d/vibe
python
https://github.com/3ll3d00d/vibe/blob/124b029f13ac746723e92cb47e9cb56edd2e54b5/backend/src/analyser/common/measurementcontroller.py#L109-L129
[ "def", "updateDeviceStatus", "(", "self", ",", "deviceName", ",", "state", ",", "reason", "=", "None", ")", ":", "logger", ".", "info", "(", "'Updating recording device state for '", "+", "deviceName", "+", "' to '", "+", "state", ".", "name", "+", "(", "''"...
124b029f13ac746723e92cb47e9cb56edd2e54b5
train
ActiveMeasurement.stillRecording
For a device that is recording, updates the last timestamp so we now when we last received data. :param deviceId: the device id. :param dataCount: the no of items of data recorded in this batch. :return:
backend/src/analyser/common/measurementcontroller.py
def stillRecording(self, deviceId, dataCount): """ For a device that is recording, updates the last timestamp so we now when we last received data. :param deviceId: the device id. :param dataCount: the no of items of data recorded in this batch. :return: """ statu...
def stillRecording(self, deviceId, dataCount): """ For a device that is recording, updates the last timestamp so we now when we last received data. :param deviceId: the device id. :param dataCount: the no of items of data recorded in this batch. :return: """ statu...
[ "For", "a", "device", "that", "is", "recording", "updates", "the", "last", "timestamp", "so", "we", "now", "when", "we", "last", "received", "data", ".", ":", "param", "deviceId", ":", "the", "device", "id", ".", ":", "param", "dataCount", ":", "the", ...
3ll3d00d/vibe
python
https://github.com/3ll3d00d/vibe/blob/124b029f13ac746723e92cb47e9cb56edd2e54b5/backend/src/analyser/common/measurementcontroller.py#L131-L142
[ "def", "stillRecording", "(", "self", ",", "deviceId", ",", "dataCount", ")", ":", "status", "=", "self", ".", "recordingDevices", "[", "deviceId", "]", "if", "status", "is", "not", "None", ":", "if", "status", "[", "'state'", "]", "==", "MeasurementStatus...
124b029f13ac746723e92cb47e9cb56edd2e54b5
train
CompleteMeasurement.inflate
loads the recording into memory and returns it as a Signal :return:
backend/src/analyser/common/measurementcontroller.py
def inflate(self): """ loads the recording into memory and returns it as a Signal :return: """ if self.measurementParameters['accelerometerEnabled']: if len(self.data) == 0: logger.info('Loading measurement data for ' + self.name) self....
def inflate(self): """ loads the recording into memory and returns it as a Signal :return: """ if self.measurementParameters['accelerometerEnabled']: if len(self.data) == 0: logger.info('Loading measurement data for ' + self.name) self....
[ "loads", "the", "recording", "into", "memory", "and", "returns", "it", "as", "a", "Signal", ":", "return", ":" ]
3ll3d00d/vibe
python
https://github.com/3ll3d00d/vibe/blob/124b029f13ac746723e92cb47e9cb56edd2e54b5/backend/src/analyser/common/measurementcontroller.py#L178-L190
[ "def", "inflate", "(", "self", ")", ":", "if", "self", ".", "measurementParameters", "[", "'accelerometerEnabled'", "]", ":", "if", "len", "(", "self", ".", "data", ")", "==", "0", ":", "logger", ".", "info", "(", "'Loading measurement data for '", "+", "s...
124b029f13ac746723e92cb47e9cb56edd2e54b5
train
MeasurementController._sweep
Checks the state of each measurement and verifies their state, if an active measurement is now complete then passes them to the completed measurement set, if failed then to the failed set, if failed and old then evicts. :return:
backend/src/analyser/common/measurementcontroller.py
def _sweep(self): """ Checks the state of each measurement and verifies their state, if an active measurement is now complete then passes them to the completed measurement set, if failed then to the failed set, if failed and old then evicts. :return: """ while self.runnin...
def _sweep(self): """ Checks the state of each measurement and verifies their state, if an active measurement is now complete then passes them to the completed measurement set, if failed then to the failed set, if failed and old then evicts. :return: """ while self.runnin...
[ "Checks", "the", "state", "of", "each", "measurement", "and", "verifies", "their", "state", "if", "an", "active", "measurement", "is", "now", "complete", "then", "passes", "them", "to", "the", "completed", "measurement", "set", "if", "failed", "then", "to", ...
3ll3d00d/vibe
python
https://github.com/3ll3d00d/vibe/blob/124b029f13ac746723e92cb47e9cb56edd2e54b5/backend/src/analyser/common/measurementcontroller.py#L233-L266
[ "def", "_sweep", "(", "self", ")", ":", "while", "self", ".", "running", ":", "for", "am", "in", "list", "(", "self", ".", "activeMeasurements", ")", ":", "now", "=", "datetime", ".", "datetime", ".", "utcnow", "(", ")", "# devices were allocated and have ...
124b029f13ac746723e92cb47e9cb56edd2e54b5
train
MeasurementController.schedule
Schedules a new measurement with the given name. :param name: :param duration: :param startTime: :param description: :return: a tuple boolean: measurement was scheduled if true message: description, generally only used as an error code
backend/src/analyser/common/measurementcontroller.py
def schedule(self, name, duration, startTime, description=None): """ Schedules a new measurement with the given name. :param name: :param duration: :param startTime: :param description: :return: a tuple boolean: measurement was scheduled if true ...
def schedule(self, name, duration, startTime, description=None): """ Schedules a new measurement with the given name. :param name: :param duration: :param startTime: :param description: :return: a tuple boolean: measurement was scheduled if true ...
[ "Schedules", "a", "new", "measurement", "with", "the", "given", "name", ".", ":", "param", "name", ":", ":", "param", "duration", ":", ":", "param", "startTime", ":", ":", "param", "description", ":", ":", "return", ":", "a", "tuple", "boolean", ":", "...
3ll3d00d/vibe
python
https://github.com/3ll3d00d/vibe/blob/124b029f13ac746723e92cb47e9cb56edd2e54b5/backend/src/analyser/common/measurementcontroller.py#L302-L333
[ "def", "schedule", "(", "self", ",", "name", ",", "duration", ",", "startTime", ",", "description", "=", "None", ")", ":", "if", "self", ".", "_clashes", "(", "startTime", ",", "duration", ")", ":", "return", "False", ",", "MEASUREMENT_TIMES_CLASH", "else"...
124b029f13ac746723e92cb47e9cb56edd2e54b5
train
MeasurementController._clashes
verifies that this measurement does not clash with an already scheduled measurement. :param startTime: the start time. :param duration: the duration. :return: true if the measurement is allowed.
backend/src/analyser/common/measurementcontroller.py
def _clashes(self, startTime, duration): """ verifies that this measurement does not clash with an already scheduled measurement. :param startTime: the start time. :param duration: the duration. :return: true if the measurement is allowed. """ return [m for m in s...
def _clashes(self, startTime, duration): """ verifies that this measurement does not clash with an already scheduled measurement. :param startTime: the start time. :param duration: the duration. :return: true if the measurement is allowed. """ return [m for m in s...
[ "verifies", "that", "this", "measurement", "does", "not", "clash", "with", "an", "already", "scheduled", "measurement", ".", ":", "param", "startTime", ":", "the", "start", "time", ".", ":", "param", "duration", ":", "the", "duration", ".", ":", "return", ...
3ll3d00d/vibe
python
https://github.com/3ll3d00d/vibe/blob/124b029f13ac746723e92cb47e9cb56edd2e54b5/backend/src/analyser/common/measurementcontroller.py#L335-L342
[ "def", "_clashes", "(", "self", ",", "startTime", ",", "duration", ")", ":", "return", "[", "m", "for", "m", "in", "self", ".", "activeMeasurements", "if", "m", ".", "overlapsWith", "(", "startTime", ",", "duration", ")", "]" ]
124b029f13ac746723e92cb47e9cb56edd2e54b5
train
MeasurementController.startMeasurement
Starts the measurement for the device. :param deviceId: the device that is starting. :param measurementId: the measurement that is started. :return: true if it started (i.e. device and measurement exists).
backend/src/analyser/common/measurementcontroller.py
def startMeasurement(self, measurementId, deviceId): """ Starts the measurement for the device. :param deviceId: the device that is starting. :param measurementId: the measurement that is started. :return: true if it started (i.e. device and measurement exists). """ ...
def startMeasurement(self, measurementId, deviceId): """ Starts the measurement for the device. :param deviceId: the device that is starting. :param measurementId: the measurement that is started. :return: true if it started (i.e. device and measurement exists). """ ...
[ "Starts", "the", "measurement", "for", "the", "device", ".", ":", "param", "deviceId", ":", "the", "device", "that", "is", "starting", ".", ":", "param", "measurementId", ":", "the", "measurement", "that", "is", "started", ".", ":", "return", ":", "true", ...
3ll3d00d/vibe
python
https://github.com/3ll3d00d/vibe/blob/124b029f13ac746723e92cb47e9cb56edd2e54b5/backend/src/analyser/common/measurementcontroller.py#L344-L358
[ "def", "startMeasurement", "(", "self", ",", "measurementId", ",", "deviceId", ")", ":", "am", ",", "handler", "=", "self", ".", "getDataHandler", "(", "measurementId", ",", "deviceId", ")", "if", "am", "is", "not", "None", ":", "am", ".", "status", "=",...
124b029f13ac746723e92cb47e9cb56edd2e54b5
train
MeasurementController.getDataHandler
finds the handler. :param measurementId: the measurement :param deviceId: the device. :return: active measurement and handler
backend/src/analyser/common/measurementcontroller.py
def getDataHandler(self, measurementId, deviceId): """ finds the handler. :param measurementId: the measurement :param deviceId: the device. :return: active measurement and handler """ am = next((m for m in self.activeMeasurements if m.id == measurementId), None) ...
def getDataHandler(self, measurementId, deviceId): """ finds the handler. :param measurementId: the measurement :param deviceId: the device. :return: active measurement and handler """ am = next((m for m in self.activeMeasurements if m.id == measurementId), None) ...
[ "finds", "the", "handler", ".", ":", "param", "measurementId", ":", "the", "measurement", ":", "param", "deviceId", ":", "the", "device", ".", ":", "return", ":", "active", "measurement", "and", "handler" ]
3ll3d00d/vibe
python
https://github.com/3ll3d00d/vibe/blob/124b029f13ac746723e92cb47e9cb56edd2e54b5/backend/src/analyser/common/measurementcontroller.py#L360-L375
[ "def", "getDataHandler", "(", "self", ",", "measurementId", ",", "deviceId", ")", ":", "am", "=", "next", "(", "(", "m", "for", "m", "in", "self", ".", "activeMeasurements", "if", "m", ".", "id", "==", "measurementId", ")", ",", "None", ")", "if", "a...
124b029f13ac746723e92cb47e9cb56edd2e54b5
train
MeasurementController.recordData
Passes the data to the handler. :param deviceId: the device the data comes from. :param measurementId: the measurement id. :param data: the data. :return: true if the data was handled.
backend/src/analyser/common/measurementcontroller.py
def recordData(self, measurementId, deviceId, data): """ Passes the data to the handler. :param deviceId: the device the data comes from. :param measurementId: the measurement id. :param data: the data. :return: true if the data was handled. """ am, handle...
def recordData(self, measurementId, deviceId, data): """ Passes the data to the handler. :param deviceId: the device the data comes from. :param measurementId: the measurement id. :param data: the data. :return: true if the data was handled. """ am, handle...
[ "Passes", "the", "data", "to", "the", "handler", ".", ":", "param", "deviceId", ":", "the", "device", "the", "data", "comes", "from", ".", ":", "param", "measurementId", ":", "the", "measurement", "id", ".", ":", "param", "data", ":", "the", "data", "....
3ll3d00d/vibe
python
https://github.com/3ll3d00d/vibe/blob/124b029f13ac746723e92cb47e9cb56edd2e54b5/backend/src/analyser/common/measurementcontroller.py#L377-L392
[ "def", "recordData", "(", "self", ",", "measurementId", ",", "deviceId", ",", "data", ")", ":", "am", ",", "handler", "=", "self", ".", "getDataHandler", "(", "measurementId", ",", "deviceId", ")", "if", "handler", "is", "not", "None", ":", "am", ".", ...
124b029f13ac746723e92cb47e9cb56edd2e54b5