repository_name
stringlengths
7
55
func_path_in_repository
stringlengths
4
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
75
104k
language
stringclasses
1 value
func_code_string
stringlengths
75
104k
func_code_tokens
listlengths
19
28.4k
func_documentation_string
stringlengths
1
46.9k
func_documentation_tokens
listlengths
1
1.97k
split_name
stringclasses
1 value
func_code_url
stringlengths
87
315
spacetelescope/acstools
acstools/utils_calib.py
extract_flatfield
def extract_flatfield(prihdr, scihdu): """Extract flatfield data from ``PFLTFILE``. Parameters ---------- prihdr : obj FITS primary header HDU. scihdu : obj Extension HDU of the science image. This is only used to extract subarray data. Returns ------- invflat ...
python
def extract_flatfield(prihdr, scihdu): """Extract flatfield data from ``PFLTFILE``. Parameters ---------- prihdr : obj FITS primary header HDU. scihdu : obj Extension HDU of the science image. This is only used to extract subarray data. Returns ------- invflat ...
[ "def", "extract_flatfield", "(", "prihdr", ",", "scihdu", ")", ":", "for", "ff", "in", "[", "'DFLTFILE'", ",", "'LFLTFILE'", "]", ":", "vv", "=", "prihdr", ".", "get", "(", "ff", ",", "'N/A'", ")", "if", "vv", "!=", "'N/A'", ":", "warnings", ".", "...
Extract flatfield data from ``PFLTFILE``. Parameters ---------- prihdr : obj FITS primary header HDU. scihdu : obj Extension HDU of the science image. This is only used to extract subarray data. Returns ------- invflat : ndarray or `None` Inverse flatfield,...
[ "Extract", "flatfield", "data", "from", "PFLTFILE", "." ]
train
https://github.com/spacetelescope/acstools/blob/bbf8dd080cefcbf88529ec87c420f9e1b8002554/acstools/utils_calib.py#L123-L165
spacetelescope/acstools
acstools/utils_calib.py
from_irafpath
def from_irafpath(irafpath): """Resolve IRAF path like ``jref$`` into actual file path. Parameters ---------- irafpath : str Path containing IRAF syntax. Returns ------- realpath : str Actual file path. If input does not follow ``path$filename`` format, then this is...
python
def from_irafpath(irafpath): """Resolve IRAF path like ``jref$`` into actual file path. Parameters ---------- irafpath : str Path containing IRAF syntax. Returns ------- realpath : str Actual file path. If input does not follow ``path$filename`` format, then this is...
[ "def", "from_irafpath", "(", "irafpath", ")", ":", "s", "=", "irafpath", ".", "split", "(", "'$'", ")", "if", "len", "(", "s", ")", "!=", "2", ":", "return", "irafpath", "if", "len", "(", "s", "[", "0", "]", ")", "==", "0", ":", "return", "iraf...
Resolve IRAF path like ``jref$`` into actual file path. Parameters ---------- irafpath : str Path containing IRAF syntax. Returns ------- realpath : str Actual file path. If input does not follow ``path$filename`` format, then this is the same as input. Raises ...
[ "Resolve", "IRAF", "path", "like", "jref$", "into", "actual", "file", "path", "." ]
train
https://github.com/spacetelescope/acstools/blob/bbf8dd080cefcbf88529ec87c420f9e1b8002554/acstools/utils_calib.py#L168-L200
spacetelescope/acstools
acstools/utils_calib.py
extract_ref
def extract_ref(scihdu, refhdu): """Extract section of the reference image that corresponds to the given science image. This only returns a view, not a copy of the reference image's array. Parameters ---------- scihdu, refhdu : obj Extension HDU's of the science and reference image...
python
def extract_ref(scihdu, refhdu): """Extract section of the reference image that corresponds to the given science image. This only returns a view, not a copy of the reference image's array. Parameters ---------- scihdu, refhdu : obj Extension HDU's of the science and reference image...
[ "def", "extract_ref", "(", "scihdu", ",", "refhdu", ")", ":", "same_size", ",", "rx", ",", "ry", ",", "x0", ",", "y0", "=", "find_line", "(", "scihdu", ",", "refhdu", ")", "# Use the whole reference image", "if", "same_size", ":", "return", "refhdu", ".", ...
Extract section of the reference image that corresponds to the given science image. This only returns a view, not a copy of the reference image's array. Parameters ---------- scihdu, refhdu : obj Extension HDU's of the science and reference image, respectively. Returns ...
[ "Extract", "section", "of", "the", "reference", "image", "that", "corresponds", "to", "the", "given", "science", "image", "." ]
train
https://github.com/spacetelescope/acstools/blob/bbf8dd080cefcbf88529ec87c420f9e1b8002554/acstools/utils_calib.py#L203-L249
spacetelescope/acstools
acstools/utils_calib.py
find_line
def find_line(scihdu, refhdu): """Obtain bin factors and corner location to extract and bin the appropriate subset of a reference image to match a science image. If the science image has zero offset and is the same size and binning as the reference image, ``same_size`` will be set to `True`. Ot...
python
def find_line(scihdu, refhdu): """Obtain bin factors and corner location to extract and bin the appropriate subset of a reference image to match a science image. If the science image has zero offset and is the same size and binning as the reference image, ``same_size`` will be set to `True`. Ot...
[ "def", "find_line", "(", "scihdu", ",", "refhdu", ")", ":", "sci_bin", ",", "sci_corner", "=", "get_corner", "(", "scihdu", ".", "header", ")", "ref_bin", ",", "ref_corner", "=", "get_corner", "(", "refhdu", ".", "header", ")", "# We can use the reference imag...
Obtain bin factors and corner location to extract and bin the appropriate subset of a reference image to match a science image. If the science image has zero offset and is the same size and binning as the reference image, ``same_size`` will be set to `True`. Otherwise, the values of ``rx``, ``ry``,...
[ "Obtain", "bin", "factors", "and", "corner", "location", "to", "extract", "and", "bin", "the", "appropriate", "subset", "of", "a", "reference", "image", "to", "match", "a", "science", "image", "." ]
train
https://github.com/spacetelescope/acstools/blob/bbf8dd080cefcbf88529ec87c420f9e1b8002554/acstools/utils_calib.py#L252-L351
spacetelescope/acstools
acstools/utils_calib.py
get_corner
def get_corner(hdr, rsize=1): """Obtain bin and corner information for a subarray. ``LTV1``, ``LTV2``, ``LTM1_1``, and ``LTM2_2`` keywords are extracted from the given extension header and converted to bin and corner values (0-indexed). ``LTV1`` for the CCD uses the beginning of the illuminated ...
python
def get_corner(hdr, rsize=1): """Obtain bin and corner information for a subarray. ``LTV1``, ``LTV2``, ``LTM1_1``, and ``LTM2_2`` keywords are extracted from the given extension header and converted to bin and corner values (0-indexed). ``LTV1`` for the CCD uses the beginning of the illuminated ...
[ "def", "get_corner", "(", "hdr", ",", "rsize", "=", "1", ")", ":", "ltm", ",", "ltv", "=", "get_lt", "(", "hdr", ")", "return", "from_lt", "(", "rsize", ",", "ltm", ",", "ltv", ")" ]
Obtain bin and corner information for a subarray. ``LTV1``, ``LTV2``, ``LTM1_1``, and ``LTM2_2`` keywords are extracted from the given extension header and converted to bin and corner values (0-indexed). ``LTV1`` for the CCD uses the beginning of the illuminated portion as the origin, not the begi...
[ "Obtain", "bin", "and", "corner", "information", "for", "a", "subarray", "." ]
train
https://github.com/spacetelescope/acstools/blob/bbf8dd080cefcbf88529ec87c420f9e1b8002554/acstools/utils_calib.py#L354-L388
spacetelescope/acstools
acstools/utils_calib.py
get_lt
def get_lt(hdr): """Obtain the LTV and LTM keyword values. Note that this returns the values just as read from the header, which means in particular that the LTV values are for one-indexed pixel coordinates. LTM keywords are the diagonal elements of MWCS linear transformation matrix, while LTV...
python
def get_lt(hdr): """Obtain the LTV and LTM keyword values. Note that this returns the values just as read from the header, which means in particular that the LTV values are for one-indexed pixel coordinates. LTM keywords are the diagonal elements of MWCS linear transformation matrix, while LTV...
[ "def", "get_lt", "(", "hdr", ")", ":", "ltm", "=", "(", "hdr", ".", "get", "(", "'LTM1_1'", ",", "1.0", ")", ",", "hdr", ".", "get", "(", "'LTM2_2'", ",", "1.0", ")", ")", "if", "ltm", "[", "0", "]", "<=", "0", "or", "ltm", "[", "1", "]", ...
Obtain the LTV and LTM keyword values. Note that this returns the values just as read from the header, which means in particular that the LTV values are for one-indexed pixel coordinates. LTM keywords are the diagonal elements of MWCS linear transformation matrix, while LTV's are MWCS linear trans...
[ "Obtain", "the", "LTV", "and", "LTM", "keyword", "values", "." ]
train
https://github.com/spacetelescope/acstools/blob/bbf8dd080cefcbf88529ec87c420f9e1b8002554/acstools/utils_calib.py#L391-L428
spacetelescope/acstools
acstools/utils_calib.py
from_lt
def from_lt(rsize, ltm, ltv): """Compute the corner location and pixel size in units of unbinned pixels. .. note:: Translated from ``calacs/lib/fromlt.c``. Parameters ---------- rsize : int Reference pixel size. Usually 1. ltm, ltv : tuple of float See :func:`get_lt`. ...
python
def from_lt(rsize, ltm, ltv): """Compute the corner location and pixel size in units of unbinned pixels. .. note:: Translated from ``calacs/lib/fromlt.c``. Parameters ---------- rsize : int Reference pixel size. Usually 1. ltm, ltv : tuple of float See :func:`get_lt`. ...
[ "def", "from_lt", "(", "rsize", ",", "ltm", ",", "ltv", ")", ":", "dbinx", "=", "rsize", "/", "ltm", "[", "0", "]", "dbiny", "=", "rsize", "/", "ltm", "[", "1", "]", "dxcorner", "=", "(", "dbinx", "-", "rsize", ")", "-", "dbinx", "*", "ltv", ...
Compute the corner location and pixel size in units of unbinned pixels. .. note:: Translated from ``calacs/lib/fromlt.c``. Parameters ---------- rsize : int Reference pixel size. Usually 1. ltm, ltv : tuple of float See :func:`get_lt`. Returns ------- bin : tuple ...
[ "Compute", "the", "corner", "location", "and", "pixel", "size", "in", "units", "of", "unbinned", "pixels", "." ]
train
https://github.com/spacetelescope/acstools/blob/bbf8dd080cefcbf88529ec87c420f9e1b8002554/acstools/utils_calib.py#L431-L464
spacetelescope/acstools
acstools/utils_calib.py
hdr_vals_for_overscan
def hdr_vals_for_overscan(root): """Retrieve header keyword values from RAW and SPT FITS files to pass on to :func:`check_oscntab` and :func:`check_overscan`. Parameters ---------- root : str Rootname of the observation. Can be relative path to the file excluding the type of FIT...
python
def hdr_vals_for_overscan(root): """Retrieve header keyword values from RAW and SPT FITS files to pass on to :func:`check_oscntab` and :func:`check_overscan`. Parameters ---------- root : str Rootname of the observation. Can be relative path to the file excluding the type of FIT...
[ "def", "hdr_vals_for_overscan", "(", "root", ")", ":", "with", "fits", ".", "open", "(", "root", "+", "'_spt.fits'", ")", "as", "hdu", ":", "spthdr", "=", "hdu", "[", "0", "]", ".", "header", "with", "fits", ".", "open", "(", "root", "+", "'_raw.fits...
Retrieve header keyword values from RAW and SPT FITS files to pass on to :func:`check_oscntab` and :func:`check_overscan`. Parameters ---------- root : str Rootname of the observation. Can be relative path to the file excluding the type of FITS file and extension, e.g., '/my...
[ "Retrieve", "header", "keyword", "values", "from", "RAW", "and", "SPT", "FITS", "files", "to", "pass", "on", "to", ":", "func", ":", "check_oscntab", "and", ":", "func", ":", "check_overscan", "." ]
train
https://github.com/spacetelescope/acstools/blob/bbf8dd080cefcbf88529ec87c420f9e1b8002554/acstools/utils_calib.py#L476-L518
spacetelescope/acstools
acstools/utils_calib.py
check_oscntab
def check_oscntab(oscntab, ccdamp, xsize, ysize, leading, trailing): """Check if the supplied parameters are in the ``OSCNTAB`` reference file. .. note:: Even if an entry does not exist in ``OSCNTAB``, as long as the subarray does not have any overscan, it should not be a proble...
python
def check_oscntab(oscntab, ccdamp, xsize, ysize, leading, trailing): """Check if the supplied parameters are in the ``OSCNTAB`` reference file. .. note:: Even if an entry does not exist in ``OSCNTAB``, as long as the subarray does not have any overscan, it should not be a proble...
[ "def", "check_oscntab", "(", "oscntab", ",", "ccdamp", ",", "xsize", ",", "ysize", ",", "leading", ",", "trailing", ")", ":", "tab", "=", "Table", ".", "read", "(", "oscntab", ")", "ccdamp", "=", "ccdamp", ".", "lower", "(", ")", ".", "rstrip", "(", ...
Check if the supplied parameters are in the ``OSCNTAB`` reference file. .. note:: Even if an entry does not exist in ``OSCNTAB``, as long as the subarray does not have any overscan, it should not be a problem for CALACS. .. note:: This function does not check the virtual bias r...
[ "Check", "if", "the", "supplied", "parameters", "are", "in", "the", "OSCNTAB", "reference", "file", "." ]
train
https://github.com/spacetelescope/acstools/blob/bbf8dd080cefcbf88529ec87c420f9e1b8002554/acstools/utils_calib.py#L521-L566
spacetelescope/acstools
acstools/utils_calib.py
check_overscan
def check_overscan(xstart, xsize, total_prescan_pixels=24, total_science_pixels=4096): """Check image for bias columns. Parameters ---------- xstart : int Starting column of the readout in detector coordinates. xsize : int Number of columns in the readout. t...
python
def check_overscan(xstart, xsize, total_prescan_pixels=24, total_science_pixels=4096): """Check image for bias columns. Parameters ---------- xstart : int Starting column of the readout in detector coordinates. xsize : int Number of columns in the readout. t...
[ "def", "check_overscan", "(", "xstart", ",", "xsize", ",", "total_prescan_pixels", "=", "24", ",", "total_science_pixels", "=", "4096", ")", ":", "hasoverscan", "=", "False", "leading", "=", "0", "trailing", "=", "0", "if", "xstart", "<", "total_prescan_pixels...
Check image for bias columns. Parameters ---------- xstart : int Starting column of the readout in detector coordinates. xsize : int Number of columns in the readout. total_prescan_pixels : int Total prescan pixels for a single amplifier on a detector. Default is 2...
[ "Check", "image", "for", "bias", "columns", "." ]
train
https://github.com/spacetelescope/acstools/blob/bbf8dd080cefcbf88529ec87c420f9e1b8002554/acstools/utils_calib.py#L569-L616
rkhleics/wagtailmodeladmin
wagtailmodeladmin/middleware.py
ModelAdminMiddleware.process_request
def process_request(self, request): """ Ignore unnecessary actions for static file requests, posts, or ajax requests. We're only interested in redirecting following a 'natural' request redirection to the `wagtailadmin_explore_root` or `wagtailadmin_explore` views. """ ...
python
def process_request(self, request): """ Ignore unnecessary actions for static file requests, posts, or ajax requests. We're only interested in redirecting following a 'natural' request redirection to the `wagtailadmin_explore_root` or `wagtailadmin_explore` views. """ ...
[ "def", "process_request", "(", "self", ",", "request", ")", ":", "referer_url", "=", "request", ".", "META", ".", "get", "(", "'HTTP_REFERER'", ")", "return_to_index_url", "=", "request", ".", "session", ".", "get", "(", "'return_to_index_url'", ")", "try", ...
Ignore unnecessary actions for static file requests, posts, or ajax requests. We're only interested in redirecting following a 'natural' request redirection to the `wagtailadmin_explore_root` or `wagtailadmin_explore` views.
[ "Ignore", "unnecessary", "actions", "for", "static", "file", "requests", "posts", "or", "ajax", "requests", ".", "We", "re", "only", "interested", "in", "redirecting", "following", "a", "natural", "request", "redirection", "to", "the", "wagtailadmin_explore_root", ...
train
https://github.com/rkhleics/wagtailmodeladmin/blob/7fddc853bab2ff3868b8c7a03329308c55f16358/wagtailmodeladmin/middleware.py#L14-L63
spacetelescope/acstools
acstools/acs2d.py
acs2d
def acs2d(input, exec_path='', time_stamps=False, verbose=False, quiet=False, exe_args=None): r""" Run the acs2d.e executable as from the shell. Output is automatically named based on input suffix: +--------------------+----------------+------------------------------+ | INPUT ...
python
def acs2d(input, exec_path='', time_stamps=False, verbose=False, quiet=False, exe_args=None): r""" Run the acs2d.e executable as from the shell. Output is automatically named based on input suffix: +--------------------+----------------+------------------------------+ | INPUT ...
[ "def", "acs2d", "(", "input", ",", "exec_path", "=", "''", ",", "time_stamps", "=", "False", ",", "verbose", "=", "False", ",", "quiet", "=", "False", ",", "exe_args", "=", "None", ")", ":", "from", "stsci", ".", "tools", "import", "parseinput", "# Opt...
r""" Run the acs2d.e executable as from the shell. Output is automatically named based on input suffix: +--------------------+----------------+------------------------------+ | INPUT | OUTPUT | EXPECTED DATA | +====================+================+=...
[ "r", "Run", "the", "acs2d", ".", "e", "executable", "as", "from", "the", "shell", "." ]
train
https://github.com/spacetelescope/acstools/blob/bbf8dd080cefcbf88529ec87c420f9e1b8002554/acstools/acs2d.py#L32-L109
spacetelescope/acstools
acstools/acs2d.py
run
def run(configobj=None): """ TEAL interface for the `acs2d` function. """ acs2d(configobj['input'], exec_path=configobj['exec_path'], time_stamps=configobj['time_stamps'], verbose=configobj['verbose'], quiet=configobj['quiet'] )
python
def run(configobj=None): """ TEAL interface for the `acs2d` function. """ acs2d(configobj['input'], exec_path=configobj['exec_path'], time_stamps=configobj['time_stamps'], verbose=configobj['verbose'], quiet=configobj['quiet'] )
[ "def", "run", "(", "configobj", "=", "None", ")", ":", "acs2d", "(", "configobj", "[", "'input'", "]", ",", "exec_path", "=", "configobj", "[", "'exec_path'", "]", ",", "time_stamps", "=", "configobj", "[", "'time_stamps'", "]", ",", "verbose", "=", "con...
TEAL interface for the `acs2d` function.
[ "TEAL", "interface", "for", "the", "acs2d", "function", "." ]
train
https://github.com/spacetelescope/acstools/blob/bbf8dd080cefcbf88529ec87c420f9e1b8002554/acstools/acs2d.py#L120-L130
spacetelescope/acstools
acstools/acscte.py
run
def run(configobj=None): """ TEAL interface for the `acscte` function. """ acscte(configobj['input'], exec_path=configobj['exec_path'], time_stamps=configobj['time_stamps'], verbose=configobj['verbose'], quiet=configobj['quiet'], single_core=config...
python
def run(configobj=None): """ TEAL interface for the `acscte` function. """ acscte(configobj['input'], exec_path=configobj['exec_path'], time_stamps=configobj['time_stamps'], verbose=configobj['verbose'], quiet=configobj['quiet'], single_core=config...
[ "def", "run", "(", "configobj", "=", "None", ")", ":", "acscte", "(", "configobj", "[", "'input'", "]", ",", "exec_path", "=", "configobj", "[", "'exec_path'", "]", ",", "time_stamps", "=", "configobj", "[", "'time_stamps'", "]", ",", "verbose", "=", "co...
TEAL interface for the `acscte` function.
[ "TEAL", "interface", "for", "the", "acscte", "function", "." ]
train
https://github.com/spacetelescope/acstools/blob/bbf8dd080cefcbf88529ec87c420f9e1b8002554/acstools/acscte.py#L121-L132
spacetelescope/acstools
acstools/acszpt.py
Query._check_inputs
def _check_inputs(self): """Check the inputs to ensure they are valid. Returns ------- status : bool True if all inputs are valid, False if one is not. """ valid_detector = True valid_filter = True valid_date = True # Determine the su...
python
def _check_inputs(self): """Check the inputs to ensure they are valid. Returns ------- status : bool True if all inputs are valid, False if one is not. """ valid_detector = True valid_filter = True valid_date = True # Determine the su...
[ "def", "_check_inputs", "(", "self", ")", ":", "valid_detector", "=", "True", "valid_filter", "=", "True", "valid_date", "=", "True", "# Determine the submitted detector is valid", "if", "self", ".", "detector", "not", "in", "self", ".", "_valid_detectors", ":", "...
Check the inputs to ensure they are valid. Returns ------- status : bool True if all inputs are valid, False if one is not.
[ "Check", "the", "inputs", "to", "ensure", "they", "are", "valid", "." ]
train
https://github.com/spacetelescope/acstools/blob/bbf8dd080cefcbf88529ec87c420f9e1b8002554/acstools/acszpt.py#L206-L248
spacetelescope/acstools
acstools/acszpt.py
Query._check_date
def _check_date(self, fmt='%Y-%m-%d'): """Convenience method for determining if the input date is valid. Parameters ---------- fmt : str The format of the date string. The default is ``%Y-%m-%d``, which corresponds to ``YYYY-MM-DD``. Returns ----...
python
def _check_date(self, fmt='%Y-%m-%d'): """Convenience method for determining if the input date is valid. Parameters ---------- fmt : str The format of the date string. The default is ``%Y-%m-%d``, which corresponds to ``YYYY-MM-DD``. Returns ----...
[ "def", "_check_date", "(", "self", ",", "fmt", "=", "'%Y-%m-%d'", ")", ":", "result", "=", "None", "try", ":", "dt_obj", "=", "dt", ".", "datetime", ".", "strptime", "(", "self", ".", "date", ",", "fmt", ")", "except", "ValueError", ":", "result", "=...
Convenience method for determining if the input date is valid. Parameters ---------- fmt : str The format of the date string. The default is ``%Y-%m-%d``, which corresponds to ``YYYY-MM-DD``. Returns ------- status : str or `None` If ...
[ "Convenience", "method", "for", "determining", "if", "the", "input", "date", "is", "valid", "." ]
train
https://github.com/spacetelescope/acstools/blob/bbf8dd080cefcbf88529ec87c420f9e1b8002554/acstools/acszpt.py#L250-L283
spacetelescope/acstools
acstools/acszpt.py
Query._submit_request
def _submit_request(self): """Submit a request to the ACS Zeropoint Calculator. If an exception is raised during the request, an error message is given. Otherwise, the response is saved in the corresponding attribute. """ try: self._response = urlopen(self._...
python
def _submit_request(self): """Submit a request to the ACS Zeropoint Calculator. If an exception is raised during the request, an error message is given. Otherwise, the response is saved in the corresponding attribute. """ try: self._response = urlopen(self._...
[ "def", "_submit_request", "(", "self", ")", ":", "try", ":", "self", ".", "_response", "=", "urlopen", "(", "self", ".", "_url", ")", "except", "URLError", "as", "e", ":", "msg", "=", "(", "'{}\\n{}\\nThe query failed! Please check your inputs. '", "'If the erro...
Submit a request to the ACS Zeropoint Calculator. If an exception is raised during the request, an error message is given. Otherwise, the response is saved in the corresponding attribute.
[ "Submit", "a", "request", "to", "the", "ACS", "Zeropoint", "Calculator", "." ]
train
https://github.com/spacetelescope/acstools/blob/bbf8dd080cefcbf88529ec87c420f9e1b8002554/acstools/acszpt.py#L285-L303
spacetelescope/acstools
acstools/acszpt.py
Query._parse_and_format
def _parse_and_format(self): """ Parse and format the results returned by the ACS Zeropoint Calculator. Using ``beautifulsoup4``, find all the ``<tb> </tb>`` tags present in the response. Format the results into an astropy.table.QTable with corresponding units and assign it to the zpt_t...
python
def _parse_and_format(self): """ Parse and format the results returned by the ACS Zeropoint Calculator. Using ``beautifulsoup4``, find all the ``<tb> </tb>`` tags present in the response. Format the results into an astropy.table.QTable with corresponding units and assign it to the zpt_t...
[ "def", "_parse_and_format", "(", "self", ")", ":", "soup", "=", "BeautifulSoup", "(", "self", ".", "_response", ".", "read", "(", ")", ",", "'html.parser'", ")", "# Grab all elements in the table returned by the ZPT calc.", "td", "=", "soup", ".", "find_all", "(",...
Parse and format the results returned by the ACS Zeropoint Calculator. Using ``beautifulsoup4``, find all the ``<tb> </tb>`` tags present in the response. Format the results into an astropy.table.QTable with corresponding units and assign it to the zpt_table attribute.
[ "Parse", "and", "format", "the", "results", "returned", "by", "the", "ACS", "Zeropoint", "Calculator", "." ]
train
https://github.com/spacetelescope/acstools/blob/bbf8dd080cefcbf88529ec87c420f9e1b8002554/acstools/acszpt.py#L305-L349
spacetelescope/acstools
acstools/acszpt.py
Query.fetch
def fetch(self): """Submit the request to the ACS Zeropoints Calculator. This method will: * submit the request * parse the response * format the results into a table with the correct units Returns ------- tab : `astropy.table.QTable` or `None` ...
python
def fetch(self): """Submit the request to the ACS Zeropoints Calculator. This method will: * submit the request * parse the response * format the results into a table with the correct units Returns ------- tab : `astropy.table.QTable` or `None` ...
[ "def", "fetch", "(", "self", ")", ":", "LOG", ".", "info", "(", "'Checking inputs...'", ")", "valid_inputs", "=", "self", ".", "_check_inputs", "(", ")", "if", "valid_inputs", ":", "LOG", ".", "info", "(", "'Submitting request to {}'", ".", "format", "(", ...
Submit the request to the ACS Zeropoints Calculator. This method will: * submit the request * parse the response * format the results into a table with the correct units Returns ------- tab : `astropy.table.QTable` or `None` If the request was succe...
[ "Submit", "the", "request", "to", "the", "ACS", "Zeropoints", "Calculator", "." ]
train
https://github.com/spacetelescope/acstools/blob/bbf8dd080cefcbf88529ec87c420f9e1b8002554/acstools/acszpt.py#L351-L379
rkhleics/wagtailmodeladmin
wagtailmodeladmin/options.py
ModelAdmin.get_queryset
def get_queryset(self, request): """ Returns a QuerySet of all model instances that can be edited by the admin site. """ qs = self.model._default_manager.get_queryset() ordering = self.get_ordering(request) if ordering: qs = qs.order_by(*ordering) ...
python
def get_queryset(self, request): """ Returns a QuerySet of all model instances that can be edited by the admin site. """ qs = self.model._default_manager.get_queryset() ordering = self.get_ordering(request) if ordering: qs = qs.order_by(*ordering) ...
[ "def", "get_queryset", "(", "self", ",", "request", ")", ":", "qs", "=", "self", ".", "model", ".", "_default_manager", ".", "get_queryset", "(", ")", "ordering", "=", "self", ".", "get_ordering", "(", "request", ")", "if", "ordering", ":", "qs", "=", ...
Returns a QuerySet of all model instances that can be edited by the admin site.
[ "Returns", "a", "QuerySet", "of", "all", "model", "instances", "that", "can", "be", "edited", "by", "the", "admin", "site", "." ]
train
https://github.com/rkhleics/wagtailmodeladmin/blob/7fddc853bab2ff3868b8c7a03329308c55f16358/wagtailmodeladmin/options.py#L236-L245
rkhleics/wagtailmodeladmin
wagtailmodeladmin/options.py
ModelAdmin.index_view
def index_view(self, request): """ Instantiates a class-based view to provide listing functionality for the assigned model. The view class used can be overridden by changing the 'index_view_class' attribute. """ kwargs = {'model_admin': self} view_class = self.ind...
python
def index_view(self, request): """ Instantiates a class-based view to provide listing functionality for the assigned model. The view class used can be overridden by changing the 'index_view_class' attribute. """ kwargs = {'model_admin': self} view_class = self.ind...
[ "def", "index_view", "(", "self", ",", "request", ")", ":", "kwargs", "=", "{", "'model_admin'", ":", "self", "}", "view_class", "=", "self", ".", "index_view_class", "return", "view_class", ".", "as_view", "(", "*", "*", "kwargs", ")", "(", "request", "...
Instantiates a class-based view to provide listing functionality for the assigned model. The view class used can be overridden by changing the 'index_view_class' attribute.
[ "Instantiates", "a", "class", "-", "based", "view", "to", "provide", "listing", "functionality", "for", "the", "assigned", "model", ".", "The", "view", "class", "used", "can", "be", "overridden", "by", "changing", "the", "index_view_class", "attribute", "." ]
train
https://github.com/rkhleics/wagtailmodeladmin/blob/7fddc853bab2ff3868b8c7a03329308c55f16358/wagtailmodeladmin/options.py#L316-L324
rkhleics/wagtailmodeladmin
wagtailmodeladmin/options.py
ModelAdmin.create_view
def create_view(self, request): """ Instantiates a class-based view to provide 'creation' functionality for the assigned model, or redirect to Wagtail's create view if the assigned model extends 'Page'. The view class used can be overridden by changing the 'create_view_class' att...
python
def create_view(self, request): """ Instantiates a class-based view to provide 'creation' functionality for the assigned model, or redirect to Wagtail's create view if the assigned model extends 'Page'. The view class used can be overridden by changing the 'create_view_class' att...
[ "def", "create_view", "(", "self", ",", "request", ")", ":", "kwargs", "=", "{", "'model_admin'", ":", "self", "}", "view_class", "=", "self", ".", "create_view_class", "return", "view_class", ".", "as_view", "(", "*", "*", "kwargs", ")", "(", "request", ...
Instantiates a class-based view to provide 'creation' functionality for the assigned model, or redirect to Wagtail's create view if the assigned model extends 'Page'. The view class used can be overridden by changing the 'create_view_class' attribute.
[ "Instantiates", "a", "class", "-", "based", "view", "to", "provide", "creation", "functionality", "for", "the", "assigned", "model", "or", "redirect", "to", "Wagtail", "s", "create", "view", "if", "the", "assigned", "model", "extends", "Page", ".", "The", "v...
train
https://github.com/rkhleics/wagtailmodeladmin/blob/7fddc853bab2ff3868b8c7a03329308c55f16358/wagtailmodeladmin/options.py#L326-L335
rkhleics/wagtailmodeladmin
wagtailmodeladmin/options.py
ModelAdmin.choose_parent_view
def choose_parent_view(self, request): """ Instantiates a class-based view to provide a view that allows a parent page to be chosen for a new object, where the assigned model extends Wagtail's Page model, and there is more than one potential parent for new instances. The view cla...
python
def choose_parent_view(self, request): """ Instantiates a class-based view to provide a view that allows a parent page to be chosen for a new object, where the assigned model extends Wagtail's Page model, and there is more than one potential parent for new instances. The view cla...
[ "def", "choose_parent_view", "(", "self", ",", "request", ")", ":", "kwargs", "=", "{", "'model_admin'", ":", "self", "}", "view_class", "=", "self", ".", "choose_parent_view_class", "return", "view_class", ".", "as_view", "(", "*", "*", "kwargs", ")", "(", ...
Instantiates a class-based view to provide a view that allows a parent page to be chosen for a new object, where the assigned model extends Wagtail's Page model, and there is more than one potential parent for new instances. The view class used can be overridden by changing the 'choose_p...
[ "Instantiates", "a", "class", "-", "based", "view", "to", "provide", "a", "view", "that", "allows", "a", "parent", "page", "to", "be", "chosen", "for", "a", "new", "object", "where", "the", "assigned", "model", "extends", "Wagtail", "s", "Page", "model", ...
train
https://github.com/rkhleics/wagtailmodeladmin/blob/7fddc853bab2ff3868b8c7a03329308c55f16358/wagtailmodeladmin/options.py#L342-L352
rkhleics/wagtailmodeladmin
wagtailmodeladmin/options.py
ModelAdmin.edit_view
def edit_view(self, request, object_id): """ Instantiates a class-based view to provide 'edit' functionality for the assigned model, or redirect to Wagtail's edit view if the assigned model extends 'Page'. The view class used can be overridden by changing the 'edit_view_class' a...
python
def edit_view(self, request, object_id): """ Instantiates a class-based view to provide 'edit' functionality for the assigned model, or redirect to Wagtail's edit view if the assigned model extends 'Page'. The view class used can be overridden by changing the 'edit_view_class' a...
[ "def", "edit_view", "(", "self", ",", "request", ",", "object_id", ")", ":", "kwargs", "=", "{", "'model_admin'", ":", "self", ",", "'object_id'", ":", "object_id", "}", "view_class", "=", "self", ".", "edit_view_class", "return", "view_class", ".", "as_view...
Instantiates a class-based view to provide 'edit' functionality for the assigned model, or redirect to Wagtail's edit view if the assigned model extends 'Page'. The view class used can be overridden by changing the 'edit_view_class' attribute.
[ "Instantiates", "a", "class", "-", "based", "view", "to", "provide", "edit", "functionality", "for", "the", "assigned", "model", "or", "redirect", "to", "Wagtail", "s", "edit", "view", "if", "the", "assigned", "model", "extends", "Page", ".", "The", "view", ...
train
https://github.com/rkhleics/wagtailmodeladmin/blob/7fddc853bab2ff3868b8c7a03329308c55f16358/wagtailmodeladmin/options.py#L354-L363
rkhleics/wagtailmodeladmin
wagtailmodeladmin/options.py
ModelAdmin.confirm_delete_view
def confirm_delete_view(self, request, object_id): """ Instantiates a class-based view to provide 'delete confirmation' functionality for the assigned model, or redirect to Wagtail's delete confirmation view if the assigned model extends 'Page'. The view class used can be overrid...
python
def confirm_delete_view(self, request, object_id): """ Instantiates a class-based view to provide 'delete confirmation' functionality for the assigned model, or redirect to Wagtail's delete confirmation view if the assigned model extends 'Page'. The view class used can be overrid...
[ "def", "confirm_delete_view", "(", "self", ",", "request", ",", "object_id", ")", ":", "kwargs", "=", "{", "'model_admin'", ":", "self", ",", "'object_id'", ":", "object_id", "}", "view_class", "=", "self", ".", "confirm_delete_view_class", "return", "view_class...
Instantiates a class-based view to provide 'delete confirmation' functionality for the assigned model, or redirect to Wagtail's delete confirmation view if the assigned model extends 'Page'. The view class used can be overridden by changing the 'confirm_delete_view_class' attribute.
[ "Instantiates", "a", "class", "-", "based", "view", "to", "provide", "delete", "confirmation", "functionality", "for", "the", "assigned", "model", "or", "redirect", "to", "Wagtail", "s", "delete", "confirmation", "view", "if", "the", "assigned", "model", "extend...
train
https://github.com/rkhleics/wagtailmodeladmin/blob/7fddc853bab2ff3868b8c7a03329308c55f16358/wagtailmodeladmin/options.py#L365-L375
rkhleics/wagtailmodeladmin
wagtailmodeladmin/options.py
ModelAdmin.unpublish_view
def unpublish_view(self, request, object_id): """ Instantiates a class-based view that redirects to Wagtail's 'unpublish' view for models that extend 'Page' (if the user has sufficient permissions). We do this via our own view so that we can reliably control redirection of the us...
python
def unpublish_view(self, request, object_id): """ Instantiates a class-based view that redirects to Wagtail's 'unpublish' view for models that extend 'Page' (if the user has sufficient permissions). We do this via our own view so that we can reliably control redirection of the us...
[ "def", "unpublish_view", "(", "self", ",", "request", ",", "object_id", ")", ":", "kwargs", "=", "{", "'model_admin'", ":", "self", ",", "'object_id'", ":", "object_id", "}", "view_class", "=", "self", ".", "unpublish_view_class", "return", "view_class", ".", ...
Instantiates a class-based view that redirects to Wagtail's 'unpublish' view for models that extend 'Page' (if the user has sufficient permissions). We do this via our own view so that we can reliably control redirection of the user back to the index_view once the action is completed. Th...
[ "Instantiates", "a", "class", "-", "based", "view", "that", "redirects", "to", "Wagtail", "s", "unpublish", "view", "for", "models", "that", "extend", "Page", "(", "if", "the", "user", "has", "sufficient", "permissions", ")", ".", "We", "do", "this", "via"...
train
https://github.com/rkhleics/wagtailmodeladmin/blob/7fddc853bab2ff3868b8c7a03329308c55f16358/wagtailmodeladmin/options.py#L377-L388
rkhleics/wagtailmodeladmin
wagtailmodeladmin/options.py
ModelAdmin.copy_view
def copy_view(self, request, object_id): """ Instantiates a class-based view that redirects to Wagtail's 'copy' view for models that extend 'Page' (if the user has sufficient permissions). We do this via our own view so that we can reliably control redirection of the user back to...
python
def copy_view(self, request, object_id): """ Instantiates a class-based view that redirects to Wagtail's 'copy' view for models that extend 'Page' (if the user has sufficient permissions). We do this via our own view so that we can reliably control redirection of the user back to...
[ "def", "copy_view", "(", "self", ",", "request", ",", "object_id", ")", ":", "kwargs", "=", "{", "'model_admin'", ":", "self", ",", "'object_id'", ":", "object_id", "}", "view_class", "=", "self", ".", "copy_view_class", "return", "view_class", ".", "as_view...
Instantiates a class-based view that redirects to Wagtail's 'copy' view for models that extend 'Page' (if the user has sufficient permissions). We do this via our own view so that we can reliably control redirection of the user back to the index_view once the action is completed. The vie...
[ "Instantiates", "a", "class", "-", "based", "view", "that", "redirects", "to", "Wagtail", "s", "copy", "view", "for", "models", "that", "extend", "Page", "(", "if", "the", "user", "has", "sufficient", "permissions", ")", ".", "We", "do", "this", "via", "...
train
https://github.com/rkhleics/wagtailmodeladmin/blob/7fddc853bab2ff3868b8c7a03329308c55f16358/wagtailmodeladmin/options.py#L390-L401
rkhleics/wagtailmodeladmin
wagtailmodeladmin/options.py
ModelAdmin.get_templates
def get_templates(self, action='index'): """ Utility function that provides a list of templates to try for a given view, when the template isn't overridden by one of the template attributes on the class. """ app = self.opts.app_label model_name = self.opts.model_n...
python
def get_templates(self, action='index'): """ Utility function that provides a list of templates to try for a given view, when the template isn't overridden by one of the template attributes on the class. """ app = self.opts.app_label model_name = self.opts.model_n...
[ "def", "get_templates", "(", "self", ",", "action", "=", "'index'", ")", ":", "app", "=", "self", ".", "opts", ".", "app_label", "model_name", "=", "self", ".", "opts", ".", "model_name", "return", "[", "'wagtailmodeladmin/%s/%s/%s.html'", "%", "(", "app", ...
Utility function that provides a list of templates to try for a given view, when the template isn't overridden by one of the template attributes on the class.
[ "Utility", "function", "that", "provides", "a", "list", "of", "templates", "to", "try", "for", "a", "given", "view", "when", "the", "template", "isn", "t", "overridden", "by", "one", "of", "the", "template", "attributes", "on", "the", "class", "." ]
train
https://github.com/rkhleics/wagtailmodeladmin/blob/7fddc853bab2ff3868b8c7a03329308c55f16358/wagtailmodeladmin/options.py#L403-L415
rkhleics/wagtailmodeladmin
wagtailmodeladmin/options.py
ModelAdmin.get_permissions_for_registration
def get_permissions_for_registration(self): """ Utilised by Wagtail's 'register_permissions' hook to allow permissions for a model to be assigned to groups in settings. This is only required if the model isn't a Page model, and isn't registered as a Snippet """ from wagta...
python
def get_permissions_for_registration(self): """ Utilised by Wagtail's 'register_permissions' hook to allow permissions for a model to be assigned to groups in settings. This is only required if the model isn't a Page model, and isn't registered as a Snippet """ from wagta...
[ "def", "get_permissions_for_registration", "(", "self", ")", ":", "from", "wagtail", ".", "wagtailsnippets", ".", "models", "import", "SNIPPET_MODELS", "if", "not", "self", ".", "is_pagemodel", "and", "self", ".", "model", "not", "in", "SNIPPET_MODELS", ":", "re...
Utilised by Wagtail's 'register_permissions' hook to allow permissions for a model to be assigned to groups in settings. This is only required if the model isn't a Page model, and isn't registered as a Snippet
[ "Utilised", "by", "Wagtail", "s", "register_permissions", "hook", "to", "allow", "permissions", "for", "a", "model", "to", "be", "assigned", "to", "groups", "in", "settings", ".", "This", "is", "only", "required", "if", "the", "model", "isn", "t", "a", "Pa...
train
https://github.com/rkhleics/wagtailmodeladmin/blob/7fddc853bab2ff3868b8c7a03329308c55f16358/wagtailmodeladmin/options.py#L481-L490
rkhleics/wagtailmodeladmin
wagtailmodeladmin/options.py
ModelAdmin.get_admin_urls_for_registration
def get_admin_urls_for_registration(self): """ Utilised by Wagtail's 'register_admin_urls' hook to register urls for our the views that class offers. """ urls = ( url(get_url_pattern(self.opts), self.index_view, name=get_url_name(self.opts)), ...
python
def get_admin_urls_for_registration(self): """ Utilised by Wagtail's 'register_admin_urls' hook to register urls for our the views that class offers. """ urls = ( url(get_url_pattern(self.opts), self.index_view, name=get_url_name(self.opts)), ...
[ "def", "get_admin_urls_for_registration", "(", "self", ")", ":", "urls", "=", "(", "url", "(", "get_url_pattern", "(", "self", ".", "opts", ")", ",", "self", ".", "index_view", ",", "name", "=", "get_url_name", "(", "self", ".", "opts", ")", ")", ",", ...
Utilised by Wagtail's 'register_admin_urls' hook to register urls for our the views that class offers.
[ "Utilised", "by", "Wagtail", "s", "register_admin_urls", "hook", "to", "register", "urls", "for", "our", "the", "views", "that", "class", "offers", "." ]
train
https://github.com/rkhleics/wagtailmodeladmin/blob/7fddc853bab2ff3868b8c7a03329308c55f16358/wagtailmodeladmin/options.py#L492-L533
rkhleics/wagtailmodeladmin
wagtailmodeladmin/options.py
ModelAdminGroup.get_menu_item
def get_menu_item(self): """ Utilised by Wagtail's 'register_menu_item' hook to create a menu for this group with a SubMenu linking to listing pages for any associated ModelAdmin instances """ if self.modeladmin_instances: submenu = SubMenu(self.get_submenu_it...
python
def get_menu_item(self): """ Utilised by Wagtail's 'register_menu_item' hook to create a menu for this group with a SubMenu linking to listing pages for any associated ModelAdmin instances """ if self.modeladmin_instances: submenu = SubMenu(self.get_submenu_it...
[ "def", "get_menu_item", "(", "self", ")", ":", "if", "self", ".", "modeladmin_instances", ":", "submenu", "=", "SubMenu", "(", "self", ".", "get_submenu_items", "(", ")", ")", "return", "GroupMenuItem", "(", "self", ",", "self", ".", "get_menu_order", "(", ...
Utilised by Wagtail's 'register_menu_item' hook to create a menu for this group with a SubMenu linking to listing pages for any associated ModelAdmin instances
[ "Utilised", "by", "Wagtail", "s", "register_menu_item", "hook", "to", "create", "a", "menu", "for", "this", "group", "with", "a", "SubMenu", "linking", "to", "listing", "pages", "for", "any", "associated", "ModelAdmin", "instances" ]
train
https://github.com/rkhleics/wagtailmodeladmin/blob/7fddc853bab2ff3868b8c7a03329308c55f16358/wagtailmodeladmin/options.py#L579-L587
rkhleics/wagtailmodeladmin
wagtailmodeladmin/options.py
ModelAdminGroup.get_permissions_for_registration
def get_permissions_for_registration(self): """ Utilised by Wagtail's 'register_permissions' hook to allow permissions for a all models grouped by this class to be assigned to Groups in settings. """ qs = Permission.objects.none() for instance in self.modeladmin_i...
python
def get_permissions_for_registration(self): """ Utilised by Wagtail's 'register_permissions' hook to allow permissions for a all models grouped by this class to be assigned to Groups in settings. """ qs = Permission.objects.none() for instance in self.modeladmin_i...
[ "def", "get_permissions_for_registration", "(", "self", ")", ":", "qs", "=", "Permission", ".", "objects", ".", "none", "(", ")", "for", "instance", "in", "self", ".", "modeladmin_instances", ":", "qs", "=", "qs", "|", "instance", ".", "get_permissions_for_reg...
Utilised by Wagtail's 'register_permissions' hook to allow permissions for a all models grouped by this class to be assigned to Groups in settings.
[ "Utilised", "by", "Wagtail", "s", "register_permissions", "hook", "to", "allow", "permissions", "for", "a", "all", "models", "grouped", "by", "this", "class", "to", "be", "assigned", "to", "Groups", "in", "settings", "." ]
train
https://github.com/rkhleics/wagtailmodeladmin/blob/7fddc853bab2ff3868b8c7a03329308c55f16358/wagtailmodeladmin/options.py#L589-L598
rkhleics/wagtailmodeladmin
wagtailmodeladmin/options.py
ModelAdminGroup.get_admin_urls_for_registration
def get_admin_urls_for_registration(self): """ Utilised by Wagtail's 'register_admin_urls' hook to register urls for used by any associated ModelAdmin instances """ urls = [] for instance in self.modeladmin_instances: urls.extend(instance.get_admin_urls_for_re...
python
def get_admin_urls_for_registration(self): """ Utilised by Wagtail's 'register_admin_urls' hook to register urls for used by any associated ModelAdmin instances """ urls = [] for instance in self.modeladmin_instances: urls.extend(instance.get_admin_urls_for_re...
[ "def", "get_admin_urls_for_registration", "(", "self", ")", ":", "urls", "=", "[", "]", "for", "instance", "in", "self", ".", "modeladmin_instances", ":", "urls", ".", "extend", "(", "instance", ".", "get_admin_urls_for_registration", "(", ")", ")", "return", ...
Utilised by Wagtail's 'register_admin_urls' hook to register urls for used by any associated ModelAdmin instances
[ "Utilised", "by", "Wagtail", "s", "register_admin_urls", "hook", "to", "register", "urls", "for", "used", "by", "any", "associated", "ModelAdmin", "instances" ]
train
https://github.com/rkhleics/wagtailmodeladmin/blob/7fddc853bab2ff3868b8c7a03329308c55f16358/wagtailmodeladmin/options.py#L600-L608
rkhleics/wagtailmodeladmin
wagtailmodeladmin/menus.py
GroupMenuItem.is_shown
def is_shown(self, request): """ If there aren't any visible items in the submenu, don't bother to show this menu item """ for menuitem in self.menu._registered_menu_items: if menuitem.is_shown(request): return True return False
python
def is_shown(self, request): """ If there aren't any visible items in the submenu, don't bother to show this menu item """ for menuitem in self.menu._registered_menu_items: if menuitem.is_shown(request): return True return False
[ "def", "is_shown", "(", "self", ",", "request", ")", ":", "for", "menuitem", "in", "self", ".", "menu", ".", "_registered_menu_items", ":", "if", "menuitem", ".", "is_shown", "(", "request", ")", ":", "return", "True", "return", "False" ]
If there aren't any visible items in the submenu, don't bother to show this menu item
[ "If", "there", "aren", "t", "any", "visible", "items", "in", "the", "submenu", "don", "t", "bother", "to", "show", "this", "menu", "item" ]
train
https://github.com/rkhleics/wagtailmodeladmin/blob/7fddc853bab2ff3868b8c7a03329308c55f16358/wagtailmodeladmin/menus.py#L34-L42
spacetelescope/acstools
acstools/acscteforwardmodel.py
run
def run(configobj=None): """ TEAL interface for the `acscteforwardmodel` function. """ acscteforwardmodel(configobj['input'], exec_path=configobj['exec_path'], time_stamps=configobj['time_stamps'], verbose=configobj['verbose'], ...
python
def run(configobj=None): """ TEAL interface for the `acscteforwardmodel` function. """ acscteforwardmodel(configobj['input'], exec_path=configobj['exec_path'], time_stamps=configobj['time_stamps'], verbose=configobj['verbose'], ...
[ "def", "run", "(", "configobj", "=", "None", ")", ":", "acscteforwardmodel", "(", "configobj", "[", "'input'", "]", ",", "exec_path", "=", "configobj", "[", "'exec_path'", "]", ",", "time_stamps", "=", "configobj", "[", "'time_stamps'", "]", ",", "verbose", ...
TEAL interface for the `acscteforwardmodel` function.
[ "TEAL", "interface", "for", "the", "acscteforwardmodel", "function", "." ]
train
https://github.com/spacetelescope/acstools/blob/bbf8dd080cefcbf88529ec87c420f9e1b8002554/acstools/acscteforwardmodel.py#L127-L138
spacetelescope/acstools
acstools/acsccd.py
run
def run(configobj=None): """ TEAL interface for the `acsccd` function. """ acsccd(configobj['input'], exec_path=configobj['exec_path'], time_stamps=configobj['time_stamps'], verbose=configobj['verbose'], quiet=configobj['quiet'] #, #dqicorr=config...
python
def run(configobj=None): """ TEAL interface for the `acsccd` function. """ acsccd(configobj['input'], exec_path=configobj['exec_path'], time_stamps=configobj['time_stamps'], verbose=configobj['verbose'], quiet=configobj['quiet'] #, #dqicorr=config...
[ "def", "run", "(", "configobj", "=", "None", ")", ":", "acsccd", "(", "configobj", "[", "'input'", "]", ",", "exec_path", "=", "configobj", "[", "'exec_path'", "]", ",", "time_stamps", "=", "configobj", "[", "'time_stamps'", "]", ",", "verbose", "=", "co...
TEAL interface for the `acsccd` function.
[ "TEAL", "interface", "for", "the", "acsccd", "function", "." ]
train
https://github.com/spacetelescope/acstools/blob/bbf8dd080cefcbf88529ec87c420f9e1b8002554/acstools/acsccd.py#L134-L148
spacetelescope/acstools
acstools/acs_destripe_plus.py
destripe_plus
def destripe_plus(inputfile, suffix='strp', stat='pmode1', maxiter=15, sigrej=2.0, lower=None, upper=None, binwidth=0.3, scimask1=None, scimask2=None, dqbits=None, rpt_clean=0, atol=0.01, cte_correct=True, clobber=False, verbose=True): r"""Cali...
python
def destripe_plus(inputfile, suffix='strp', stat='pmode1', maxiter=15, sigrej=2.0, lower=None, upper=None, binwidth=0.3, scimask1=None, scimask2=None, dqbits=None, rpt_clean=0, atol=0.01, cte_correct=True, clobber=False, verbose=True): r"""Cali...
[ "def", "destripe_plus", "(", "inputfile", ",", "suffix", "=", "'strp'", ",", "stat", "=", "'pmode1'", ",", "maxiter", "=", "15", ",", "sigrej", "=", "2.0", ",", "lower", "=", "None", ",", "upper", "=", "None", ",", "binwidth", "=", "0.3", ",", "scima...
r"""Calibrate post-SM4 ACS/WFC exposure(s) and use standalone :ref:`acsdestripe`. This takes a RAW image and generates a FLT file containing its calibrated and destriped counterpart. If CTE correction is performed, FLC will also be present. Parameters ---------- inputfile : str or list of ...
[ "r", "Calibrate", "post", "-", "SM4", "ACS", "/", "WFC", "exposure", "(", "s", ")", "and", "use", "standalone", ":", "ref", ":", "acsdestripe", "." ]
train
https://github.com/spacetelescope/acstools/blob/bbf8dd080cefcbf88529ec87c420f9e1b8002554/acstools/acs_destripe_plus.py#L111-L498
spacetelescope/acstools
acstools/acs_destripe_plus.py
run
def run(configobj=None): """TEAL interface for :func:`destripe_plus`.""" destripe_plus( configobj['input'], suffix=configobj['suffix'], stat=configobj['stat'], maxiter=configobj['maxiter'], sigrej=configobj['sigrej'], lower=configobj['lower'], upper=config...
python
def run(configobj=None): """TEAL interface for :func:`destripe_plus`.""" destripe_plus( configobj['input'], suffix=configobj['suffix'], stat=configobj['stat'], maxiter=configobj['maxiter'], sigrej=configobj['sigrej'], lower=configobj['lower'], upper=config...
[ "def", "run", "(", "configobj", "=", "None", ")", ":", "destripe_plus", "(", "configobj", "[", "'input'", "]", ",", "suffix", "=", "configobj", "[", "'suffix'", "]", ",", "stat", "=", "configobj", "[", "'stat'", "]", ",", "maxiter", "=", "configobj", "...
TEAL interface for :func:`destripe_plus`.
[ "TEAL", "interface", "for", ":", "func", ":", "destripe_plus", "." ]
train
https://github.com/spacetelescope/acstools/blob/bbf8dd080cefcbf88529ec87c420f9e1b8002554/acstools/acs_destripe_plus.py#L537-L555
spacetelescope/acstools
acstools/acs_destripe_plus.py
main
def main(): """Command line driver.""" import argparse # Parse input parameters parser = argparse.ArgumentParser( prog=__taskname__, description=( 'Run CALACS and standalone acs_destripe script on given post-SM4 ' 'ACS/WFC RAW full-frame or supported subarray ima...
python
def main(): """Command line driver.""" import argparse # Parse input parameters parser = argparse.ArgumentParser( prog=__taskname__, description=( 'Run CALACS and standalone acs_destripe script on given post-SM4 ' 'ACS/WFC RAW full-frame or supported subarray ima...
[ "def", "main", "(", ")", ":", "import", "argparse", "# Parse input parameters", "parser", "=", "argparse", ".", "ArgumentParser", "(", "prog", "=", "__taskname__", ",", "description", "=", "(", "'Run CALACS and standalone acs_destripe script on given post-SM4 '", "'ACS/WF...
Command line driver.
[ "Command", "line", "driver", "." ]
train
https://github.com/spacetelescope/acstools/blob/bbf8dd080cefcbf88529ec87c420f9e1b8002554/acstools/acs_destripe_plus.py#L562-L636
rkhleics/wagtailmodeladmin
wagtailmodeladmin/views.py
IndexView.get_search_results
def get_search_results(self, request, queryset, search_term): """ Returns a tuple containing a queryset to implement the search, and a boolean indicating if the results may contain duplicates. """ # Apply keyword searches. def construct_search(field_name): if ...
python
def get_search_results(self, request, queryset, search_term): """ Returns a tuple containing a queryset to implement the search, and a boolean indicating if the results may contain duplicates. """ # Apply keyword searches. def construct_search(field_name): if ...
[ "def", "get_search_results", "(", "self", ",", "request", ",", "queryset", ",", "search_term", ")", ":", "# Apply keyword searches.", "def", "construct_search", "(", "field_name", ")", ":", "if", "field_name", ".", "startswith", "(", "'^'", ")", ":", "return", ...
Returns a tuple containing a queryset to implement the search, and a boolean indicating if the results may contain duplicates.
[ "Returns", "a", "tuple", "containing", "a", "queryset", "to", "implement", "the", "search", "and", "a", "boolean", "indicating", "if", "the", "results", "may", "contain", "duplicates", "." ]
train
https://github.com/rkhleics/wagtailmodeladmin/blob/7fddc853bab2ff3868b8c7a03329308c55f16358/wagtailmodeladmin/views.py#L297-L327
rkhleics/wagtailmodeladmin
wagtailmodeladmin/views.py
IndexView.get_filters_params
def get_filters_params(self, params=None): """ Returns all params except IGNORED_PARAMS """ if not params: params = self.params lookup_params = params.copy() # a dictionary of the query string # Remove all the parameters that are globally and systematically ...
python
def get_filters_params(self, params=None): """ Returns all params except IGNORED_PARAMS """ if not params: params = self.params lookup_params = params.copy() # a dictionary of the query string # Remove all the parameters that are globally and systematically ...
[ "def", "get_filters_params", "(", "self", ",", "params", "=", "None", ")", ":", "if", "not", "params", ":", "params", "=", "self", ".", "params", "lookup_params", "=", "params", ".", "copy", "(", ")", "# a dictionary of the query string", "# Remove all the param...
Returns all params except IGNORED_PARAMS
[ "Returns", "all", "params", "except", "IGNORED_PARAMS" ]
train
https://github.com/rkhleics/wagtailmodeladmin/blob/7fddc853bab2ff3868b8c7a03329308c55f16358/wagtailmodeladmin/views.py#L377-L389
rkhleics/wagtailmodeladmin
wagtailmodeladmin/views.py
IndexView.get_ordering_field
def get_ordering_field(self, field_name): """ Returns the proper model field name corresponding to the given field_name to use for ordering. field_name may either be the name of a proper model field or the name of a method (on the admin or model) or a callable with the 'admin_ord...
python
def get_ordering_field(self, field_name): """ Returns the proper model field name corresponding to the given field_name to use for ordering. field_name may either be the name of a proper model field or the name of a method (on the admin or model) or a callable with the 'admin_ord...
[ "def", "get_ordering_field", "(", "self", ",", "field_name", ")", ":", "try", ":", "field", "=", "self", ".", "opts", ".", "get_field", "(", "field_name", ")", "return", "field", ".", "name", "except", "FieldDoesNotExist", ":", "# See whether field_name is a nam...
Returns the proper model field name corresponding to the given field_name to use for ordering. field_name may either be the name of a proper model field or the name of a method (on the admin or model) or a callable with the 'admin_order_field' attribute. Returns None if no proper model f...
[ "Returns", "the", "proper", "model", "field", "name", "corresponding", "to", "the", "given", "field_name", "to", "use", "for", "ordering", ".", "field_name", "may", "either", "be", "the", "name", "of", "a", "proper", "model", "field", "or", "the", "name", ...
train
https://github.com/rkhleics/wagtailmodeladmin/blob/7fddc853bab2ff3868b8c7a03329308c55f16358/wagtailmodeladmin/views.py#L494-L514
rkhleics/wagtailmodeladmin
wagtailmodeladmin/views.py
IndexView.get_ordering
def get_ordering(self, request, queryset): """ Returns the list of ordering fields for the change list. First we check the get_ordering() method in model admin, then we check the object's default ordering. Then, any manually-specified ordering from the query string overrides anyt...
python
def get_ordering(self, request, queryset): """ Returns the list of ordering fields for the change list. First we check the get_ordering() method in model admin, then we check the object's default ordering. Then, any manually-specified ordering from the query string overrides anyt...
[ "def", "get_ordering", "(", "self", ",", "request", ",", "queryset", ")", ":", "params", "=", "self", ".", "params", "ordering", "=", "list", "(", "self", ".", "get_default_ordering", "(", "request", ")", ")", "if", "ORDER_VAR", "in", "params", ":", "# C...
Returns the list of ordering fields for the change list. First we check the get_ordering() method in model admin, then we check the object's default ordering. Then, any manually-specified ordering from the query string overrides anything. Finally, a deterministic order is guaranteed by e...
[ "Returns", "the", "list", "of", "ordering", "fields", "for", "the", "change", "list", ".", "First", "we", "check", "the", "get_ordering", "()", "method", "in", "model", "admin", "then", "we", "check", "the", "object", "s", "default", "ordering", ".", "Then...
train
https://github.com/rkhleics/wagtailmodeladmin/blob/7fddc853bab2ff3868b8c7a03329308c55f16358/wagtailmodeladmin/views.py#L516-L558
rkhleics/wagtailmodeladmin
wagtailmodeladmin/views.py
IndexView.get_ordering_field_columns
def get_ordering_field_columns(self): """ Returns an OrderedDict of ordering field column numbers and asc/desc """ # We must cope with more than one column having the same underlying # sort field, so we base things on column numbers. ordering = self._get_default_ordering...
python
def get_ordering_field_columns(self): """ Returns an OrderedDict of ordering field column numbers and asc/desc """ # We must cope with more than one column having the same underlying # sort field, so we base things on column numbers. ordering = self._get_default_ordering...
[ "def", "get_ordering_field_columns", "(", "self", ")", ":", "# We must cope with more than one column having the same underlying", "# sort field, so we base things on column numbers.", "ordering", "=", "self", ".", "_get_default_ordering", "(", ")", "ordering_fields", "=", "Ordered...
Returns an OrderedDict of ordering field column numbers and asc/desc
[ "Returns", "an", "OrderedDict", "of", "ordering", "field", "column", "numbers", "and", "asc", "/", "desc" ]
train
https://github.com/rkhleics/wagtailmodeladmin/blob/7fddc853bab2ff3868b8c7a03329308c55f16358/wagtailmodeladmin/views.py#L560-L591
rkhleics/wagtailmodeladmin
wagtailmodeladmin/views.py
InspectView.get_field_label
def get_field_label(self, field_name, field=None): """ Return a label to display for a field """ label = None if field is not None: label = getattr(field, 'verbose_name', None) if label is None: label = getattr(field, 'name', None) if label is None...
python
def get_field_label(self, field_name, field=None): """ Return a label to display for a field """ label = None if field is not None: label = getattr(field, 'verbose_name', None) if label is None: label = getattr(field, 'name', None) if label is None...
[ "def", "get_field_label", "(", "self", ",", "field_name", ",", "field", "=", "None", ")", ":", "label", "=", "None", "if", "field", "is", "not", "None", ":", "label", "=", "getattr", "(", "field", ",", "'verbose_name'", ",", "None", ")", "if", "label",...
Return a label to display for a field
[ "Return", "a", "label", "to", "display", "for", "a", "field" ]
train
https://github.com/rkhleics/wagtailmodeladmin/blob/7fddc853bab2ff3868b8c7a03329308c55f16358/wagtailmodeladmin/views.py#L732-L741
rkhleics/wagtailmodeladmin
wagtailmodeladmin/views.py
InspectView.get_field_display_value
def get_field_display_value(self, field_name, field=None): """ Return a display value for a field """ """ Firstly, check for a 'get_fieldname_display' property/method on the model, and return the value of that, if present. """ val_funct = getattr(self.instance, 'get_%s_d...
python
def get_field_display_value(self, field_name, field=None): """ Return a display value for a field """ """ Firstly, check for a 'get_fieldname_display' property/method on the model, and return the value of that, if present. """ val_funct = getattr(self.instance, 'get_%s_d...
[ "def", "get_field_display_value", "(", "self", ",", "field_name", ",", "field", "=", "None", ")", ":", "\"\"\"\n Firstly, check for a 'get_fieldname_display' property/method on\n the model, and return the value of that, if present.\n \"\"\"", "val_funct", "=", "get...
Return a display value for a field
[ "Return", "a", "display", "value", "for", "a", "field" ]
train
https://github.com/rkhleics/wagtailmodeladmin/blob/7fddc853bab2ff3868b8c7a03329308c55f16358/wagtailmodeladmin/views.py#L743-L784
rkhleics/wagtailmodeladmin
wagtailmodeladmin/views.py
InspectView.get_image_field_display
def get_image_field_display(self, field_name, field): """ Render an image """ image = getattr(self.instance, field_name) if image: fltr, _ = Filter.objects.get_or_create(spec='max-400x400') rendition = image.get_rendition(fltr) return rendition.img_tag ...
python
def get_image_field_display(self, field_name, field): """ Render an image """ image = getattr(self.instance, field_name) if image: fltr, _ = Filter.objects.get_or_create(spec='max-400x400') rendition = image.get_rendition(fltr) return rendition.img_tag ...
[ "def", "get_image_field_display", "(", "self", ",", "field_name", ",", "field", ")", ":", "image", "=", "getattr", "(", "self", ".", "instance", ",", "field_name", ")", "if", "image", ":", "fltr", ",", "_", "=", "Filter", ".", "objects", ".", "get_or_cre...
Render an image
[ "Render", "an", "image" ]
train
https://github.com/rkhleics/wagtailmodeladmin/blob/7fddc853bab2ff3868b8c7a03329308c55f16358/wagtailmodeladmin/views.py#L786-L793
rkhleics/wagtailmodeladmin
wagtailmodeladmin/views.py
InspectView.get_document_field_display
def get_document_field_display(self, field_name, field): """ Render a link to a document """ document = getattr(self.instance, field_name) if document: return mark_safe( '<a href="%s">%s <span class="meta">(%s, %s)</span></a>' % ( document.url, ...
python
def get_document_field_display(self, field_name, field): """ Render a link to a document """ document = getattr(self.instance, field_name) if document: return mark_safe( '<a href="%s">%s <span class="meta">(%s, %s)</span></a>' % ( document.url, ...
[ "def", "get_document_field_display", "(", "self", ",", "field_name", ",", "field", ")", ":", "document", "=", "getattr", "(", "self", ".", "instance", ",", "field_name", ")", "if", "document", ":", "return", "mark_safe", "(", "'<a href=\"%s\">%s <span class=\"meta...
Render a link to a document
[ "Render", "a", "link", "to", "a", "document" ]
train
https://github.com/rkhleics/wagtailmodeladmin/blob/7fddc853bab2ff3868b8c7a03329308c55f16358/wagtailmodeladmin/views.py#L795-L807
rkhleics/wagtailmodeladmin
wagtailmodeladmin/views.py
InspectView.get_dict_for_field
def get_dict_for_field(self, field_name): """ Return a dictionary containing `label` and `value` values to display for a field. """ try: field = self.model._meta.get_field(field_name) except FieldDoesNotExist: field = None return { ...
python
def get_dict_for_field(self, field_name): """ Return a dictionary containing `label` and `value` values to display for a field. """ try: field = self.model._meta.get_field(field_name) except FieldDoesNotExist: field = None return { ...
[ "def", "get_dict_for_field", "(", "self", ",", "field_name", ")", ":", "try", ":", "field", "=", "self", ".", "model", ".", "_meta", ".", "get_field", "(", "field_name", ")", "except", "FieldDoesNotExist", ":", "field", "=", "None", "return", "{", "'label'...
Return a dictionary containing `label` and `value` values to display for a field.
[ "Return", "a", "dictionary", "containing", "label", "and", "value", "values", "to", "display", "for", "a", "field", "." ]
train
https://github.com/rkhleics/wagtailmodeladmin/blob/7fddc853bab2ff3868b8c7a03329308c55f16358/wagtailmodeladmin/views.py#L809-L821
rkhleics/wagtailmodeladmin
wagtailmodeladmin/views.py
InspectView.get_fields_dict
def get_fields_dict(self): """ Return a list of `label`/`value` dictionaries to represent the fiels named by the model_admin class's `get_inspect_view_fields` method """ fields = [] for field_name in self.model_admin.get_inspect_view_fields(): fields.append(se...
python
def get_fields_dict(self): """ Return a list of `label`/`value` dictionaries to represent the fiels named by the model_admin class's `get_inspect_view_fields` method """ fields = [] for field_name in self.model_admin.get_inspect_view_fields(): fields.append(se...
[ "def", "get_fields_dict", "(", "self", ")", ":", "fields", "=", "[", "]", "for", "field_name", "in", "self", ".", "model_admin", ".", "get_inspect_view_fields", "(", ")", ":", "fields", ".", "append", "(", "self", ".", "get_dict_for_field", "(", "field_name"...
Return a list of `label`/`value` dictionaries to represent the fiels named by the model_admin class's `get_inspect_view_fields` method
[ "Return", "a", "list", "of", "label", "/", "value", "dictionaries", "to", "represent", "the", "fiels", "named", "by", "the", "model_admin", "class", "s", "get_inspect_view_fields", "method" ]
train
https://github.com/rkhleics/wagtailmodeladmin/blob/7fddc853bab2ff3868b8c7a03329308c55f16358/wagtailmodeladmin/views.py#L823-L831
rkhleics/wagtailmodeladmin
wagtailmodeladmin/templatetags/wagtailmodeladmin_tags.py
items_for_result
def items_for_result(view, result): """ Generates the actual list of data. """ model_admin = view.model_admin for field_name in view.list_display: empty_value_display = model_admin.get_empty_value_display() row_classes = ['field-%s' % field_name] try: f, attr, val...
python
def items_for_result(view, result): """ Generates the actual list of data. """ model_admin = view.model_admin for field_name in view.list_display: empty_value_display = model_admin.get_empty_value_display() row_classes = ['field-%s' % field_name] try: f, attr, val...
[ "def", "items_for_result", "(", "view", ",", "result", ")", ":", "model_admin", "=", "view", ".", "model_admin", "for", "field_name", "in", "view", ".", "list_display", ":", "empty_value_display", "=", "model_admin", ".", "get_empty_value_display", "(", ")", "ro...
Generates the actual list of data.
[ "Generates", "the", "actual", "list", "of", "data", "." ]
train
https://github.com/rkhleics/wagtailmodeladmin/blob/7fddc853bab2ff3868b8c7a03329308c55f16358/wagtailmodeladmin/templatetags/wagtailmodeladmin_tags.py#L26-L78
rkhleics/wagtailmodeladmin
wagtailmodeladmin/templatetags/wagtailmodeladmin_tags.py
result_list
def result_list(context): """ Displays the headers and data list together """ view = context['view'] object_list = context['object_list'] headers = list(result_headers(view)) num_sorted_fields = 0 for h in headers: if h['sortable'] and h['sorted']: num_sorted_fields +...
python
def result_list(context): """ Displays the headers and data list together """ view = context['view'] object_list = context['object_list'] headers = list(result_headers(view)) num_sorted_fields = 0 for h in headers: if h['sortable'] and h['sorted']: num_sorted_fields +...
[ "def", "result_list", "(", "context", ")", ":", "view", "=", "context", "[", "'view'", "]", "object_list", "=", "context", "[", "'object_list'", "]", "headers", "=", "list", "(", "result_headers", "(", "view", ")", ")", "num_sorted_fields", "=", "0", "for"...
Displays the headers and data list together
[ "Displays", "the", "headers", "and", "data", "list", "together" ]
train
https://github.com/rkhleics/wagtailmodeladmin/blob/7fddc853bab2ff3868b8c7a03329308c55f16358/wagtailmodeladmin/templatetags/wagtailmodeladmin_tags.py#L88-L103
spacetelescope/acstools
acstools/acssum.py
run
def run(configobj=None): """ TEAL interface for the `acssum` function. """ acssum(configobj['input'], configobj['output'], exec_path=configobj['exec_path'], time_stamps=configobj['time_stamps'], verbose=configobj['verbose'], quiet=configobj['quiet'...
python
def run(configobj=None): """ TEAL interface for the `acssum` function. """ acssum(configobj['input'], configobj['output'], exec_path=configobj['exec_path'], time_stamps=configobj['time_stamps'], verbose=configobj['verbose'], quiet=configobj['quiet'...
[ "def", "run", "(", "configobj", "=", "None", ")", ":", "acssum", "(", "configobj", "[", "'input'", "]", ",", "configobj", "[", "'output'", "]", ",", "exec_path", "=", "configobj", "[", "'exec_path'", "]", ",", "time_stamps", "=", "configobj", "[", "'time...
TEAL interface for the `acssum` function.
[ "TEAL", "interface", "for", "the", "acssum", "function", "." ]
train
https://github.com/spacetelescope/acstools/blob/bbf8dd080cefcbf88529ec87c420f9e1b8002554/acstools/acssum.py#L111-L122
spacetelescope/acstools
acstools/satdet.py
_detsat_one
def _detsat_one(filename, ext, sigma=2.0, low_thresh=0.1, h_thresh=0.5, small_edge=60, line_len=200, line_gap=75, percentile=(4.5, 93.0), buf=200, plot=False, verbose=False): """Called by :func:`detsat`.""" if verbose: t_beg = time.time() fname = '{0}[{1}]'.format(fi...
python
def _detsat_one(filename, ext, sigma=2.0, low_thresh=0.1, h_thresh=0.5, small_edge=60, line_len=200, line_gap=75, percentile=(4.5, 93.0), buf=200, plot=False, verbose=False): """Called by :func:`detsat`.""" if verbose: t_beg = time.time() fname = '{0}[{1}]'.format(fi...
[ "def", "_detsat_one", "(", "filename", ",", "ext", ",", "sigma", "=", "2.0", ",", "low_thresh", "=", "0.1", ",", "h_thresh", "=", "0.5", ",", "small_edge", "=", "60", ",", "line_len", "=", "200", ",", "line_gap", "=", "75", ",", "percentile", "=", "(...
Called by :func:`detsat`.
[ "Called", "by", ":", "func", ":", "detsat", "." ]
train
https://github.com/spacetelescope/acstools/blob/bbf8dd080cefcbf88529ec87c420f9e1b8002554/acstools/satdet.py#L180-L444
spacetelescope/acstools
acstools/satdet.py
_get_valid_indices
def _get_valid_indices(shape, ix0, ix1, iy0, iy1): """Give array shape and desired indices, return indices that are correctly bounded by the shape.""" ymax, xmax = shape if ix0 < 0: ix0 = 0 if ix1 > xmax: ix1 = xmax if iy0 < 0: iy0 = 0 if iy1 > ymax: iy1 = ym...
python
def _get_valid_indices(shape, ix0, ix1, iy0, iy1): """Give array shape and desired indices, return indices that are correctly bounded by the shape.""" ymax, xmax = shape if ix0 < 0: ix0 = 0 if ix1 > xmax: ix1 = xmax if iy0 < 0: iy0 = 0 if iy1 > ymax: iy1 = ym...
[ "def", "_get_valid_indices", "(", "shape", ",", "ix0", ",", "ix1", ",", "iy0", ",", "iy1", ")", ":", "ymax", ",", "xmax", "=", "shape", "if", "ix0", "<", "0", ":", "ix0", "=", "0", "if", "ix1", ">", "xmax", ":", "ix1", "=", "xmax", "if", "iy0",...
Give array shape and desired indices, return indices that are correctly bounded by the shape.
[ "Give", "array", "shape", "and", "desired", "indices", "return", "indices", "that", "are", "correctly", "bounded", "by", "the", "shape", "." ]
train
https://github.com/spacetelescope/acstools/blob/bbf8dd080cefcbf88529ec87c420f9e1b8002554/acstools/satdet.py#L447-L465
spacetelescope/acstools
acstools/satdet.py
_rotate_point
def _rotate_point(point, angle, ishape, rshape, reverse=False): """Transform a point from original image coordinates to rotated image coordinates and back. It assumes the rotation point is the center of an image. This works on a simple rotation transformation:: newx = (startx) * np.cos(angle) ...
python
def _rotate_point(point, angle, ishape, rshape, reverse=False): """Transform a point from original image coordinates to rotated image coordinates and back. It assumes the rotation point is the center of an image. This works on a simple rotation transformation:: newx = (startx) * np.cos(angle) ...
[ "def", "_rotate_point", "(", "point", ",", "angle", ",", "ishape", ",", "rshape", ",", "reverse", "=", "False", ")", ":", "# unpack the image and rotated images shapes", "if", "reverse", ":", "angle", "=", "(", "angle", "*", "-", "1", ")", "temp", "=", "i...
Transform a point from original image coordinates to rotated image coordinates and back. It assumes the rotation point is the center of an image. This works on a simple rotation transformation:: newx = (startx) * np.cos(angle) - (starty) * np.sin(angle) newy = (startx) * np.sin(angle) + (s...
[ "Transform", "a", "point", "from", "original", "image", "coordinates", "to", "rotated", "image", "coordinates", "and", "back", ".", "It", "assumes", "the", "rotation", "point", "is", "the", "center", "of", "an", "image", "." ]
train
https://github.com/spacetelescope/acstools/blob/bbf8dd080cefcbf88529ec87c420f9e1b8002554/acstools/satdet.py#L468-L532
spacetelescope/acstools
acstools/satdet.py
make_mask
def make_mask(filename, ext, trail_coords, sublen=75, subwidth=200, order=3, sigma=4, pad=10, plot=False, verbose=False): """Create DQ mask for an image for a given satellite trail. This mask can be added to existing DQ data using :func:`update_dq`. .. note:: Unlike :func:`detsat`, m...
python
def make_mask(filename, ext, trail_coords, sublen=75, subwidth=200, order=3, sigma=4, pad=10, plot=False, verbose=False): """Create DQ mask for an image for a given satellite trail. This mask can be added to existing DQ data using :func:`update_dq`. .. note:: Unlike :func:`detsat`, m...
[ "def", "make_mask", "(", "filename", ",", "ext", ",", "trail_coords", ",", "sublen", "=", "75", ",", "subwidth", "=", "200", ",", "order", "=", "3", ",", "sigma", "=", "4", ",", "pad", "=", "10", ",", "plot", "=", "False", ",", "verbose", "=", "F...
Create DQ mask for an image for a given satellite trail. This mask can be added to existing DQ data using :func:`update_dq`. .. note:: Unlike :func:`detsat`, multiprocessing is not available for this function. Parameters ---------- filename : str FITS image filename. ...
[ "Create", "DQ", "mask", "for", "an", "image", "for", "a", "given", "satellite", "trail", ".", "This", "mask", "can", "be", "added", "to", "existing", "DQ", "data", "using", ":", "func", ":", "update_dq", "." ]
train
https://github.com/spacetelescope/acstools/blob/bbf8dd080cefcbf88529ec87c420f9e1b8002554/acstools/satdet.py#L535-L874
spacetelescope/acstools
acstools/satdet.py
update_dq
def update_dq(filename, ext, mask, dqval=16384, verbose=True): """Update the given image and DQ extension with the given satellite trails mask and flag. Parameters ---------- filename : str FITS image filename to update. ext : int, str, or tuple DQ extension, as accepted by ``a...
python
def update_dq(filename, ext, mask, dqval=16384, verbose=True): """Update the given image and DQ extension with the given satellite trails mask and flag. Parameters ---------- filename : str FITS image filename to update. ext : int, str, or tuple DQ extension, as accepted by ``a...
[ "def", "update_dq", "(", "filename", ",", "ext", ",", "mask", ",", "dqval", "=", "16384", ",", "verbose", "=", "True", ")", ":", "with", "fits", ".", "open", "(", "filename", ",", "mode", "=", "'update'", ")", "as", "pf", ":", "dqarr", "=", "pf", ...
Update the given image and DQ extension with the given satellite trails mask and flag. Parameters ---------- filename : str FITS image filename to update. ext : int, str, or tuple DQ extension, as accepted by ``astropy.io.fits``, to update. mask : ndarray Boolean mask,...
[ "Update", "the", "given", "image", "and", "DQ", "extension", "with", "the", "given", "satellite", "trails", "mask", "and", "flag", "." ]
train
https://github.com/spacetelescope/acstools/blob/bbf8dd080cefcbf88529ec87c420f9e1b8002554/acstools/satdet.py#L877-L927
spacetelescope/acstools
acstools/satdet.py
_satdet_worker
def _satdet_worker(work_queue, done_queue, sigma=2.0, low_thresh=0.1, h_thresh=0.5, small_edge=60, line_len=200, line_gap=75, percentile=(4.5, 93.0), buf=200): """Multiprocessing worker.""" for fil, chip in iter(work_queue.get, 'STOP'): try: result = _de...
python
def _satdet_worker(work_queue, done_queue, sigma=2.0, low_thresh=0.1, h_thresh=0.5, small_edge=60, line_len=200, line_gap=75, percentile=(4.5, 93.0), buf=200): """Multiprocessing worker.""" for fil, chip in iter(work_queue.get, 'STOP'): try: result = _de...
[ "def", "_satdet_worker", "(", "work_queue", ",", "done_queue", ",", "sigma", "=", "2.0", ",", "low_thresh", "=", "0.1", ",", "h_thresh", "=", "0.5", ",", "small_edge", "=", "60", ",", "line_len", "=", "200", ",", "line_gap", "=", "75", ",", "percentile",...
Multiprocessing worker.
[ "Multiprocessing", "worker", "." ]
train
https://github.com/spacetelescope/acstools/blob/bbf8dd080cefcbf88529ec87c420f9e1b8002554/acstools/satdet.py#L934-L952
spacetelescope/acstools
acstools/satdet.py
detsat
def detsat(searchpattern, chips=[1, 4], n_processes=4, sigma=2.0, low_thresh=0.1, h_thresh=0.5, small_edge=60, line_len=200, line_gap=75, percentile=(4.5, 93.0), buf=200, plot=False, verbose=True): """Find satellite trails in the given images and extensions. The trails are calcu...
python
def detsat(searchpattern, chips=[1, 4], n_processes=4, sigma=2.0, low_thresh=0.1, h_thresh=0.5, small_edge=60, line_len=200, line_gap=75, percentile=(4.5, 93.0), buf=200, plot=False, verbose=True): """Find satellite trails in the given images and extensions. The trails are calcu...
[ "def", "detsat", "(", "searchpattern", ",", "chips", "=", "[", "1", ",", "4", "]", ",", "n_processes", "=", "4", ",", "sigma", "=", "2.0", ",", "low_thresh", "=", "0.1", ",", "h_thresh", "=", "0.5", ",", "small_edge", "=", "60", ",", "line_len", "=...
Find satellite trails in the given images and extensions. The trails are calculated using Probabilistic Hough Transform. .. note:: The trail endpoints found here are crude approximations. Use :func:`make_mask` to create the actual DQ mask for the trail(s) of interest. Parameters ...
[ "Find", "satellite", "trails", "in", "the", "given", "images", "and", "extensions", ".", "The", "trails", "are", "calculated", "using", "Probabilistic", "Hough", "Transform", "." ]
train
https://github.com/spacetelescope/acstools/blob/bbf8dd080cefcbf88529ec87c420f9e1b8002554/acstools/satdet.py#L955-L1149
seanpar203/event-bus
event_bus/bus.py
EventBus.on
def on(self, event: str) -> Callable: """ Decorator for subscribing a function to a specific event. :param event: Name of the event to subscribe to. :type event: str :return: The outer function. :rtype: Callable """ def outer(func): self.add_event(f...
python
def on(self, event: str) -> Callable: """ Decorator for subscribing a function to a specific event. :param event: Name of the event to subscribe to. :type event: str :return: The outer function. :rtype: Callable """ def outer(func): self.add_event(f...
[ "def", "on", "(", "self", ",", "event", ":", "str", ")", "->", "Callable", ":", "def", "outer", "(", "func", ")", ":", "self", ".", "add_event", "(", "func", ",", "event", ")", "@", "wraps", "(", "func", ")", "def", "wrapper", "(", "*", "args", ...
Decorator for subscribing a function to a specific event. :param event: Name of the event to subscribe to. :type event: str :return: The outer function. :rtype: Callable
[ "Decorator", "for", "subscribing", "a", "function", "to", "a", "specific", "event", "." ]
train
https://github.com/seanpar203/event-bus/blob/60319b9eb4e38c348e80f3ec625312eda75da765/event_bus/bus.py#L73-L92
seanpar203/event-bus
event_bus/bus.py
EventBus.add_event
def add_event(self, func: Callable, event: str) -> None: """ Adds a function to a event. :param func: The function to call when event is emitted :type func: Callable :param event: Name of the event. :type event: str """ self._events[event].add(func)
python
def add_event(self, func: Callable, event: str) -> None: """ Adds a function to a event. :param func: The function to call when event is emitted :type func: Callable :param event: Name of the event. :type event: str """ self._events[event].add(func)
[ "def", "add_event", "(", "self", ",", "func", ":", "Callable", ",", "event", ":", "str", ")", "->", "None", ":", "self", ".", "_events", "[", "event", "]", ".", "add", "(", "func", ")" ]
Adds a function to a event. :param func: The function to call when event is emitted :type func: Callable :param event: Name of the event. :type event: str
[ "Adds", "a", "function", "to", "a", "event", "." ]
train
https://github.com/seanpar203/event-bus/blob/60319b9eb4e38c348e80f3ec625312eda75da765/event_bus/bus.py#L94-L103
seanpar203/event-bus
event_bus/bus.py
EventBus.emit
def emit(self, event: str, *args, **kwargs) -> None: """ Emit an event and run the subscribed functions. :param event: Name of the event. :type event: str .. notes: Passing in threads=True as a kwarg allows to run emitted events as separate threads. This can sig...
python
def emit(self, event: str, *args, **kwargs) -> None: """ Emit an event and run the subscribed functions. :param event: Name of the event. :type event: str .. notes: Passing in threads=True as a kwarg allows to run emitted events as separate threads. This can sig...
[ "def", "emit", "(", "self", ",", "event", ":", "str", ",", "*", "args", ",", "*", "*", "kwargs", ")", "->", "None", ":", "threads", "=", "kwargs", ".", "pop", "(", "'threads'", ",", "None", ")", "if", "threads", ":", "events", "=", "[", "Thread",...
Emit an event and run the subscribed functions. :param event: Name of the event. :type event: str .. notes: Passing in threads=True as a kwarg allows to run emitted events as separate threads. This can significantly speed up code execution depending on the c...
[ "Emit", "an", "event", "and", "run", "the", "subscribed", "functions", "." ]
train
https://github.com/seanpar203/event-bus/blob/60319b9eb4e38c348e80f3ec625312eda75da765/event_bus/bus.py#L105-L130
seanpar203/event-bus
event_bus/bus.py
EventBus.emit_only
def emit_only(self, event: str, func_names: Union[str, List[str]], *args, **kwargs) -> None: """ Specifically only emits certain subscribed events. :param event: Name of the event. :type event: str :param func_names: Function(s) to emit. :type func_names: Unio...
python
def emit_only(self, event: str, func_names: Union[str, List[str]], *args, **kwargs) -> None: """ Specifically only emits certain subscribed events. :param event: Name of the event. :type event: str :param func_names: Function(s) to emit. :type func_names: Unio...
[ "def", "emit_only", "(", "self", ",", "event", ":", "str", ",", "func_names", ":", "Union", "[", "str", ",", "List", "[", "str", "]", "]", ",", "*", "args", ",", "*", "*", "kwargs", ")", "->", "None", ":", "if", "isinstance", "(", "func_names", "...
Specifically only emits certain subscribed events. :param event: Name of the event. :type event: str :param func_names: Function(s) to emit. :type func_names: Union[ str | List[str] ]
[ "Specifically", "only", "emits", "certain", "subscribed", "events", "." ]
train
https://github.com/seanpar203/event-bus/blob/60319b9eb4e38c348e80f3ec625312eda75da765/event_bus/bus.py#L132-L147
seanpar203/event-bus
event_bus/bus.py
EventBus.emit_after
def emit_after(self, event: str) -> Callable: """ Decorator that emits events after the function is completed. :param event: Name of the event. :type event: str :return: Callable .. note: This plainly just calls functions without passing params into the ...
python
def emit_after(self, event: str) -> Callable: """ Decorator that emits events after the function is completed. :param event: Name of the event. :type event: str :return: Callable .. note: This plainly just calls functions without passing params into the ...
[ "def", "emit_after", "(", "self", ",", "event", ":", "str", ")", "->", "Callable", ":", "def", "outer", "(", "func", ")", ":", "@", "wraps", "(", "func", ")", "def", "wrapper", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "returned", "=",...
Decorator that emits events after the function is completed. :param event: Name of the event. :type event: str :return: Callable .. note: This plainly just calls functions without passing params into the subscribed callables. This is great if you want to do som...
[ "Decorator", "that", "emits", "events", "after", "the", "function", "is", "completed", "." ]
train
https://github.com/seanpar203/event-bus/blob/60319b9eb4e38c348e80f3ec625312eda75da765/event_bus/bus.py#L149-L173
seanpar203/event-bus
event_bus/bus.py
EventBus.remove_event
def remove_event(self, func_name: str, event: str) -> None: """ Removes a subscribed function from a specific event. :param func_name: The name of the function to be removed. :type func_name: str :param event: The name of the event. :type event: str :raise EventDoesntE...
python
def remove_event(self, func_name: str, event: str) -> None: """ Removes a subscribed function from a specific event. :param func_name: The name of the function to be removed. :type func_name: str :param event: The name of the event. :type event: str :raise EventDoesntE...
[ "def", "remove_event", "(", "self", ",", "func_name", ":", "str", ",", "event", ":", "str", ")", "->", "None", ":", "event_funcs_copy", "=", "self", ".", "_events", "[", "event", "]", ".", "copy", "(", ")", "for", "func", "in", "self", ".", "_event_f...
Removes a subscribed function from a specific event. :param func_name: The name of the function to be removed. :type func_name: str :param event: The name of the event. :type event: str :raise EventDoesntExist if there func_name doesn't exist in event.
[ "Removes", "a", "subscribed", "function", "from", "a", "specific", "event", "." ]
train
https://github.com/seanpar203/event-bus/blob/60319b9eb4e38c348e80f3ec625312eda75da765/event_bus/bus.py#L175-L196
seanpar203/event-bus
event_bus/bus.py
EventBus._event_funcs
def _event_funcs(self, event: str) -> Iterable[Callable]: """ Returns an Iterable of the functions subscribed to a event. :param event: Name of the event. :type event: str :return: A iterable to do things with. :rtype: Iterable """ for func in self._events[event...
python
def _event_funcs(self, event: str) -> Iterable[Callable]: """ Returns an Iterable of the functions subscribed to a event. :param event: Name of the event. :type event: str :return: A iterable to do things with. :rtype: Iterable """ for func in self._events[event...
[ "def", "_event_funcs", "(", "self", ",", "event", ":", "str", ")", "->", "Iterable", "[", "Callable", "]", ":", "for", "func", "in", "self", ".", "_events", "[", "event", "]", ":", "yield", "func" ]
Returns an Iterable of the functions subscribed to a event. :param event: Name of the event. :type event: str :return: A iterable to do things with. :rtype: Iterable
[ "Returns", "an", "Iterable", "of", "the", "functions", "subscribed", "to", "a", "event", "." ]
train
https://github.com/seanpar203/event-bus/blob/60319b9eb4e38c348e80f3ec625312eda75da765/event_bus/bus.py#L202-L212
seanpar203/event-bus
event_bus/bus.py
EventBus._event_func_names
def _event_func_names(self, event: str) -> List[str]: """ Returns string name of each function subscribed to an event. :param event: Name of the event. :type event: str :return: Names of functions subscribed to a specific event. :rtype: list """ return [func.__n...
python
def _event_func_names(self, event: str) -> List[str]: """ Returns string name of each function subscribed to an event. :param event: Name of the event. :type event: str :return: Names of functions subscribed to a specific event. :rtype: list """ return [func.__n...
[ "def", "_event_func_names", "(", "self", ",", "event", ":", "str", ")", "->", "List", "[", "str", "]", ":", "return", "[", "func", ".", "__name__", "for", "func", "in", "self", ".", "_events", "[", "event", "]", "]" ]
Returns string name of each function subscribed to an event. :param event: Name of the event. :type event: str :return: Names of functions subscribed to a specific event. :rtype: list
[ "Returns", "string", "name", "of", "each", "function", "subscribed", "to", "an", "event", "." ]
train
https://github.com/seanpar203/event-bus/blob/60319b9eb4e38c348e80f3ec625312eda75da765/event_bus/bus.py#L214-L223
seanpar203/event-bus
event_bus/bus.py
EventBus._subscribed_event_count
def _subscribed_event_count(self) -> int: """ Returns the total amount of subscribed events. :return: Integer amount events. :rtype: int """ event_counter = Counter() # type: Dict[Any, int] for key, values in self._events.items(): event_counter[key] = len(v...
python
def _subscribed_event_count(self) -> int: """ Returns the total amount of subscribed events. :return: Integer amount events. :rtype: int """ event_counter = Counter() # type: Dict[Any, int] for key, values in self._events.items(): event_counter[key] = len(v...
[ "def", "_subscribed_event_count", "(", "self", ")", "->", "int", ":", "event_counter", "=", "Counter", "(", ")", "# type: Dict[Any, int]", "for", "key", ",", "values", "in", "self", ".", "_events", ".", "items", "(", ")", ":", "event_counter", "[", "key", ...
Returns the total amount of subscribed events. :return: Integer amount events. :rtype: int
[ "Returns", "the", "total", "amount", "of", "subscribed", "events", "." ]
train
https://github.com/seanpar203/event-bus/blob/60319b9eb4e38c348e80f3ec625312eda75da765/event_bus/bus.py#L225-L236
spacetelescope/acstools
acstools/acs_destripe.py
clean
def clean(input, suffix, stat="pmode1", maxiter=15, sigrej=2.0, lower=None, upper=None, binwidth=0.3, mask1=None, mask2=None, dqbits=None, rpt_clean=0, atol=0.01, clobber=False, verbose=True): r"""Remove horizontal stripes from ACS WFC post-SM4 data. Parameters ---------- ...
python
def clean(input, suffix, stat="pmode1", maxiter=15, sigrej=2.0, lower=None, upper=None, binwidth=0.3, mask1=None, mask2=None, dqbits=None, rpt_clean=0, atol=0.01, clobber=False, verbose=True): r"""Remove horizontal stripes from ACS WFC post-SM4 data. Parameters ---------- ...
[ "def", "clean", "(", "input", ",", "suffix", ",", "stat", "=", "\"pmode1\"", ",", "maxiter", "=", "15", ",", "sigrej", "=", "2.0", ",", "lower", "=", "None", ",", "upper", "=", "None", ",", "binwidth", "=", "0.3", ",", "mask1", "=", "None", ",", ...
r"""Remove horizontal stripes from ACS WFC post-SM4 data. Parameters ---------- input : str or list of str Input filenames in one of these formats: * a Python list of filenames * a partial filename with wildcards ('\*flt.fits') * filename of an ASN table ('j1234...
[ "r", "Remove", "horizontal", "stripes", "from", "ACS", "WFC", "post", "-", "SM4", "data", "." ]
train
https://github.com/spacetelescope/acstools/blob/bbf8dd080cefcbf88529ec87c420f9e1b8002554/acstools/acs_destripe.py#L222-L463
spacetelescope/acstools
acstools/acs_destripe.py
perform_correction
def perform_correction(image, output, stat="pmode1", maxiter=15, sigrej=2.0, lower=None, upper=None, binwidth=0.3, mask=None, dqbits=None, rpt_clean=0, atol=0.01, clobber=False, verbose=True): """ Clean each input image. Parameters --...
python
def perform_correction(image, output, stat="pmode1", maxiter=15, sigrej=2.0, lower=None, upper=None, binwidth=0.3, mask=None, dqbits=None, rpt_clean=0, atol=0.01, clobber=False, verbose=True): """ Clean each input image. Parameters --...
[ "def", "perform_correction", "(", "image", ",", "output", ",", "stat", "=", "\"pmode1\"", ",", "maxiter", "=", "15", ",", "sigrej", "=", "2.0", ",", "lower", "=", "None", ",", "upper", "=", "None", ",", "binwidth", "=", "0.3", ",", "mask", "=", "None...
Clean each input image. Parameters ---------- image : str Input image name. output : str Output image name. mask : `numpy.ndarray` Mask array. maxiter, sigrej, clobber See :func:`clean`. dqbits : int, str, or None Data quality bits to be considere...
[ "Clean", "each", "input", "image", "." ]
train
https://github.com/spacetelescope/acstools/blob/bbf8dd080cefcbf88529ec87c420f9e1b8002554/acstools/acs_destripe.py#L466-L547
spacetelescope/acstools
acstools/acs_destripe.py
clean_streak
def clean_streak(image, stat="pmode1", maxiter=15, sigrej=2.0, lower=None, upper=None, binwidth=0.3, mask=None, rpt_clean=0, atol=0.01, verbose=True): """ Apply destriping algorithm to input array. Parameters ---------- image : `StripeArray` object Arrays a...
python
def clean_streak(image, stat="pmode1", maxiter=15, sigrej=2.0, lower=None, upper=None, binwidth=0.3, mask=None, rpt_clean=0, atol=0.01, verbose=True): """ Apply destriping algorithm to input array. Parameters ---------- image : `StripeArray` object Arrays a...
[ "def", "clean_streak", "(", "image", ",", "stat", "=", "\"pmode1\"", ",", "maxiter", "=", "15", ",", "sigrej", "=", "2.0", ",", "lower", "=", "None", ",", "upper", "=", "None", ",", "binwidth", "=", "0.3", ",", "mask", "=", "None", ",", "rpt_clean", ...
Apply destriping algorithm to input array. Parameters ---------- image : `StripeArray` object Arrays are modifed in-place. stat : str Statistics for background computations (see :py:func:`clean` for more details) mask : `numpy.ndarray` Mask array. Pixels with zero ...
[ "Apply", "destriping", "algorithm", "to", "input", "array", "." ]
train
https://github.com/spacetelescope/acstools/blob/bbf8dd080cefcbf88529ec87c420f9e1b8002554/acstools/acs_destripe.py#L583-L890
spacetelescope/acstools
acstools/acs_destripe.py
djs_iterstat
def djs_iterstat(InputArr, MaxIter=10, SigRej=3.0, Max=None, Min=None, Mask=None, lineno=None): """ Iterative sigma-clipping. Parameters ---------- InputArr : `numpy.ndarray` Input image array. MaxIter, SigRej : see `clean` Max, Min : float Max and min val...
python
def djs_iterstat(InputArr, MaxIter=10, SigRej=3.0, Max=None, Min=None, Mask=None, lineno=None): """ Iterative sigma-clipping. Parameters ---------- InputArr : `numpy.ndarray` Input image array. MaxIter, SigRej : see `clean` Max, Min : float Max and min val...
[ "def", "djs_iterstat", "(", "InputArr", ",", "MaxIter", "=", "10", ",", "SigRej", "=", "3.0", ",", "Max", "=", "None", ",", "Min", "=", "None", ",", "Mask", "=", "None", ",", "lineno", "=", "None", ")", ":", "NGood", "=", "InputArr", ".", "size", ...
Iterative sigma-clipping. Parameters ---------- InputArr : `numpy.ndarray` Input image array. MaxIter, SigRej : see `clean` Max, Min : float Max and min values for clipping. Mask : `numpy.ndarray` Mask array to indicate pixels to reject, in addition to clipping. ...
[ "Iterative", "sigma", "-", "clipping", "." ]
train
https://github.com/spacetelescope/acstools/blob/bbf8dd080cefcbf88529ec87c420f9e1b8002554/acstools/acs_destripe.py#L899-L1010
spacetelescope/acstools
acstools/acs_destripe.py
run
def run(configobj=None): """TEAL interface for the `clean` function.""" clean(configobj['input'], suffix=configobj['suffix'], stat=configobj['stat'], maxiter=configobj['maxiter'], sigrej=configobj['sigrej'], lower=configobj['lower'], upper=configobj['u...
python
def run(configobj=None): """TEAL interface for the `clean` function.""" clean(configobj['input'], suffix=configobj['suffix'], stat=configobj['stat'], maxiter=configobj['maxiter'], sigrej=configobj['sigrej'], lower=configobj['lower'], upper=configobj['u...
[ "def", "run", "(", "configobj", "=", "None", ")", ":", "clean", "(", "configobj", "[", "'input'", "]", ",", "suffix", "=", "configobj", "[", "'suffix'", "]", ",", "stat", "=", "configobj", "[", "'stat'", "]", ",", "maxiter", "=", "configobj", "[", "'...
TEAL interface for the `clean` function.
[ "TEAL", "interface", "for", "the", "clean", "function", "." ]
train
https://github.com/spacetelescope/acstools/blob/bbf8dd080cefcbf88529ec87c420f9e1b8002554/acstools/acs_destripe.py#L1022-L1039
spacetelescope/acstools
acstools/acs_destripe.py
main
def main(): """Command line driver.""" import argparse parser = argparse.ArgumentParser( prog=__taskname__, description='Remove horizontal stripes from ACS WFC post-SM4 data.') parser.add_argument( 'arg0', metavar='input', type=str, help='Input file') parser.add_argument( ...
python
def main(): """Command line driver.""" import argparse parser = argparse.ArgumentParser( prog=__taskname__, description='Remove horizontal stripes from ACS WFC post-SM4 data.') parser.add_argument( 'arg0', metavar='input', type=str, help='Input file') parser.add_argument( ...
[ "def", "main", "(", ")", ":", "import", "argparse", "parser", "=", "argparse", ".", "ArgumentParser", "(", "prog", "=", "__taskname__", ",", "description", "=", "'Remove horizontal stripes from ACS WFC post-SM4 data.'", ")", "parser", ".", "add_argument", "(", "'arg...
Command line driver.
[ "Command", "line", "driver", "." ]
train
https://github.com/spacetelescope/acstools/blob/bbf8dd080cefcbf88529ec87c420f9e1b8002554/acstools/acs_destripe.py#L1046-L1111
spacetelescope/acstools
acstools/acs_destripe.py
StripeArray.configure_arrays
def configure_arrays(self): """Get the SCI and ERR data.""" self.science = self.hdulist['sci', 1].data self.err = self.hdulist['err', 1].data self.dq = self.hdulist['dq', 1].data if (self.ampstring == 'ABCD'): self.science = np.concatenate( (self.scien...
python
def configure_arrays(self): """Get the SCI and ERR data.""" self.science = self.hdulist['sci', 1].data self.err = self.hdulist['err', 1].data self.dq = self.hdulist['dq', 1].data if (self.ampstring == 'ABCD'): self.science = np.concatenate( (self.scien...
[ "def", "configure_arrays", "(", "self", ")", ":", "self", ".", "science", "=", "self", ".", "hdulist", "[", "'sci'", ",", "1", "]", ".", "data", "self", ".", "err", "=", "self", ".", "hdulist", "[", "'err'", ",", "1", "]", ".", "data", "self", "....
Get the SCI and ERR data.
[ "Get", "the", "SCI", "and", "ERR", "data", "." ]
train
https://github.com/spacetelescope/acstools/blob/bbf8dd080cefcbf88529ec87c420f9e1b8002554/acstools/acs_destripe.py#L99-L113
spacetelescope/acstools
acstools/acs_destripe.py
StripeArray.ingest_flatfield
def ingest_flatfield(self): """Process flatfield.""" self.invflat = extract_flatfield( self.hdulist[0].header, self.hdulist[1]) # If BIAS or DARK, set flatfield to unity if self.invflat is None: self.invflat = np.ones_like(self.science) return ...
python
def ingest_flatfield(self): """Process flatfield.""" self.invflat = extract_flatfield( self.hdulist[0].header, self.hdulist[1]) # If BIAS or DARK, set flatfield to unity if self.invflat is None: self.invflat = np.ones_like(self.science) return ...
[ "def", "ingest_flatfield", "(", "self", ")", ":", "self", ".", "invflat", "=", "extract_flatfield", "(", "self", ".", "hdulist", "[", "0", "]", ".", "header", ",", "self", ".", "hdulist", "[", "1", "]", ")", "# If BIAS or DARK, set flatfield to unity", "if",...
Process flatfield.
[ "Process", "flatfield", "." ]
train
https://github.com/spacetelescope/acstools/blob/bbf8dd080cefcbf88529ec87c420f9e1b8002554/acstools/acs_destripe.py#L115-L129
spacetelescope/acstools
acstools/acs_destripe.py
StripeArray.ingest_flash
def ingest_flash(self): """Process post-flash.""" self.flash = extract_flash(self.hdulist[0].header, self.hdulist[1]) # Set post-flash to zeros if self.flash is None: self.flash = np.zeros_like(self.science) return # Apply the flash subtraction if neces...
python
def ingest_flash(self): """Process post-flash.""" self.flash = extract_flash(self.hdulist[0].header, self.hdulist[1]) # Set post-flash to zeros if self.flash is None: self.flash = np.zeros_like(self.science) return # Apply the flash subtraction if neces...
[ "def", "ingest_flash", "(", "self", ")", ":", "self", ".", "flash", "=", "extract_flash", "(", "self", ".", "hdulist", "[", "0", "]", ".", "header", ",", "self", ".", "hdulist", "[", "1", "]", ")", "# Set post-flash to zeros", "if", "self", ".", "flash...
Process post-flash.
[ "Process", "post", "-", "flash", "." ]
train
https://github.com/spacetelescope/acstools/blob/bbf8dd080cefcbf88529ec87c420f9e1b8002554/acstools/acs_destripe.py#L131-L144
spacetelescope/acstools
acstools/acs_destripe.py
StripeArray.ingest_dark
def ingest_dark(self): """Process dark.""" self.dark = extract_dark(self.hdulist[0].header, self.hdulist[1]) # If BIAS or DARK, set dark to zeros if self.dark is None: self.dark = np.zeros_like(self.science) return # Apply the dark subtraction if necess...
python
def ingest_dark(self): """Process dark.""" self.dark = extract_dark(self.hdulist[0].header, self.hdulist[1]) # If BIAS or DARK, set dark to zeros if self.dark is None: self.dark = np.zeros_like(self.science) return # Apply the dark subtraction if necess...
[ "def", "ingest_dark", "(", "self", ")", ":", "self", ".", "dark", "=", "extract_dark", "(", "self", ".", "hdulist", "[", "0", "]", ".", "header", ",", "self", ".", "hdulist", "[", "1", "]", ")", "# If BIAS or DARK, set dark to zeros", "if", "self", ".", ...
Process dark.
[ "Process", "dark", "." ]
train
https://github.com/spacetelescope/acstools/blob/bbf8dd080cefcbf88529ec87c420f9e1b8002554/acstools/acs_destripe.py#L146-L159
spacetelescope/acstools
acstools/acs_destripe.py
StripeArray.write_corrected
def write_corrected(self, output, clobber=False): """Write out the destriped data.""" # un-apply the flatfield if necessary if self.flatcorr != 'COMPLETE': self.science = self.science / self.invflat self.err = self.err / self.invflat # un-apply the post-flash if...
python
def write_corrected(self, output, clobber=False): """Write out the destriped data.""" # un-apply the flatfield if necessary if self.flatcorr != 'COMPLETE': self.science = self.science / self.invflat self.err = self.err / self.invflat # un-apply the post-flash if...
[ "def", "write_corrected", "(", "self", ",", "output", ",", "clobber", "=", "False", ")", ":", "# un-apply the flatfield if necessary", "if", "self", ".", "flatcorr", "!=", "'COMPLETE'", ":", "self", ".", "science", "=", "self", ".", "science", "/", "self", "...
Write out the destriped data.
[ "Write", "out", "the", "destriped", "data", "." ]
train
https://github.com/spacetelescope/acstools/blob/bbf8dd080cefcbf88529ec87c420f9e1b8002554/acstools/acs_destripe.py#L161-L191
spacetelescope/acstools
acstools/calacs.py
calacs
def calacs(input_file, exec_path=None, time_stamps=False, temp_files=False, verbose=False, debug=False, quiet=False, single_core=False, exe_args=None): """ Run the calacs.e executable as from the shell. By default this will run the calacs given by 'calacs.e'. Parameters -----...
python
def calacs(input_file, exec_path=None, time_stamps=False, temp_files=False, verbose=False, debug=False, quiet=False, single_core=False, exe_args=None): """ Run the calacs.e executable as from the shell. By default this will run the calacs given by 'calacs.e'. Parameters -----...
[ "def", "calacs", "(", "input_file", ",", "exec_path", "=", "None", ",", "time_stamps", "=", "False", ",", "temp_files", "=", "False", ",", "verbose", "=", "False", ",", "debug", "=", "False", ",", "quiet", "=", "False", ",", "single_core", "=", "False", ...
Run the calacs.e executable as from the shell. By default this will run the calacs given by 'calacs.e'. Parameters ---------- input_file : str Name of input file. exec_path : str, optional The complete path to a calacs executable. time_stamps : bool, optional Set to T...
[ "Run", "the", "calacs", ".", "e", "executable", "as", "from", "the", "shell", "." ]
train
https://github.com/spacetelescope/acstools/blob/bbf8dd080cefcbf88529ec87c420f9e1b8002554/acstools/calacs.py#L28-L104
spacetelescope/acstools
acstools/calacs.py
run
def run(configobj=None): """ TEAL interface for the `calacs` function. """ calacs(configobj['input_file'], exec_path=configobj['exec_path'], time_stamps=configobj['time_stamps'], temp_files=configobj['temp_files'], verbose=configobj['verbose'], deb...
python
def run(configobj=None): """ TEAL interface for the `calacs` function. """ calacs(configobj['input_file'], exec_path=configobj['exec_path'], time_stamps=configobj['time_stamps'], temp_files=configobj['temp_files'], verbose=configobj['verbose'], deb...
[ "def", "run", "(", "configobj", "=", "None", ")", ":", "calacs", "(", "configobj", "[", "'input_file'", "]", ",", "exec_path", "=", "configobj", "[", "'exec_path'", "]", ",", "time_stamps", "=", "configobj", "[", "'time_stamps'", "]", ",", "temp_files", "=...
TEAL interface for the `calacs` function.
[ "TEAL", "interface", "for", "the", "calacs", "function", "." ]
train
https://github.com/spacetelescope/acstools/blob/bbf8dd080cefcbf88529ec87c420f9e1b8002554/acstools/calacs.py#L115-L128
rkhleics/wagtailmodeladmin
wagtailmodeladmin/helpers.py
PermissionHelper.has_any_permissions
def has_any_permissions(self, user): """ Return a boolean to indicate whether the supplied user has any permissions at all on the associated model """ for perm in self.get_all_model_permissions(): if self.has_specific_permission(user, perm.codename): r...
python
def has_any_permissions(self, user): """ Return a boolean to indicate whether the supplied user has any permissions at all on the associated model """ for perm in self.get_all_model_permissions(): if self.has_specific_permission(user, perm.codename): r...
[ "def", "has_any_permissions", "(", "self", ",", "user", ")", ":", "for", "perm", "in", "self", ".", "get_all_model_permissions", "(", ")", ":", "if", "self", ".", "has_specific_permission", "(", "user", ",", "perm", ".", "codename", ")", ":", "return", "Tr...
Return a boolean to indicate whether the supplied user has any permissions at all on the associated model
[ "Return", "a", "boolean", "to", "indicate", "whether", "the", "supplied", "user", "has", "any", "permissions", "at", "all", "on", "the", "associated", "model" ]
train
https://github.com/rkhleics/wagtailmodeladmin/blob/7fddc853bab2ff3868b8c7a03329308c55f16358/wagtailmodeladmin/helpers.py#L31-L39
rkhleics/wagtailmodeladmin
wagtailmodeladmin/helpers.py
PagePermissionHelper.get_valid_parent_pages
def get_valid_parent_pages(self, user): """ Identifies possible parent pages for the current user by first looking at allowed_parent_page_models() on self.model to limit options to the correct type of page, then checking permissions on those individual pages to make sure we have ...
python
def get_valid_parent_pages(self, user): """ Identifies possible parent pages for the current user by first looking at allowed_parent_page_models() on self.model to limit options to the correct type of page, then checking permissions on those individual pages to make sure we have ...
[ "def", "get_valid_parent_pages", "(", "self", ",", "user", ")", ":", "# Start with empty qs", "parents_qs", "=", "Page", ".", "objects", ".", "none", "(", ")", "# Add pages of the correct type", "for", "pt", "in", "self", ".", "model", ".", "allowed_parent_page_mo...
Identifies possible parent pages for the current user by first looking at allowed_parent_page_models() on self.model to limit options to the correct type of page, then checking permissions on those individual pages to make sure we have permission to add a subpage to it.
[ "Identifies", "possible", "parent", "pages", "for", "the", "current", "user", "by", "first", "looking", "at", "allowed_parent_page_models", "()", "on", "self", ".", "model", "to", "limit", "options", "to", "the", "correct", "type", "of", "page", "then", "check...
train
https://github.com/rkhleics/wagtailmodeladmin/blob/7fddc853bab2ff3868b8c7a03329308c55f16358/wagtailmodeladmin/helpers.py#L108-L128
spacetelescope/acstools
acstools/acsrej.py
acsrej
def acsrej(input, output, exec_path='', time_stamps=False, verbose=False, shadcorr=False, crrejtab='', crmask=False, scalense=None, initgues='', skysub='', crsigmas='', crradius=None, crthresh=None, badinpdq=None, newbias=False, readnoise_only=False, exe_args=None): r""" Run the...
python
def acsrej(input, output, exec_path='', time_stamps=False, verbose=False, shadcorr=False, crrejtab='', crmask=False, scalense=None, initgues='', skysub='', crsigmas='', crradius=None, crthresh=None, badinpdq=None, newbias=False, readnoise_only=False, exe_args=None): r""" Run the...
[ "def", "acsrej", "(", "input", ",", "output", ",", "exec_path", "=", "''", ",", "time_stamps", "=", "False", ",", "verbose", "=", "False", ",", "shadcorr", "=", "False", ",", "crrejtab", "=", "''", ",", "crmask", "=", "False", ",", "scalense", "=", "...
r""" Run the acsrej.e executable as from the shell. Parameters ---------- input : str or list of str Input filenames in one of these formats: * a Python list of filenames * a partial filename with wildcards ('\*flt.fits') * filename of an ASN table ('j123456...
[ "r", "Run", "the", "acsrej", ".", "e", "executable", "as", "from", "the", "shell", "." ]
train
https://github.com/spacetelescope/acstools/blob/bbf8dd080cefcbf88529ec87c420f9e1b8002554/acstools/acsrej.py#L38-L198
spacetelescope/acstools
acstools/acsrej.py
run
def run(configobj=None): """ TEAL interface for the `acsrej` function. """ acsrej(configobj['input'], configobj['output'], exec_path=configobj['exec_path'], time_stamps=configobj['time_stamps'], verbose=configobj['verbose'], shadcorr=configobj['sha...
python
def run(configobj=None): """ TEAL interface for the `acsrej` function. """ acsrej(configobj['input'], configobj['output'], exec_path=configobj['exec_path'], time_stamps=configobj['time_stamps'], verbose=configobj['verbose'], shadcorr=configobj['sha...
[ "def", "run", "(", "configobj", "=", "None", ")", ":", "acsrej", "(", "configobj", "[", "'input'", "]", ",", "configobj", "[", "'output'", "]", ",", "exec_path", "=", "configobj", "[", "'exec_path'", "]", ",", "time_stamps", "=", "configobj", "[", "'time...
TEAL interface for the `acsrej` function.
[ "TEAL", "interface", "for", "the", "acsrej", "function", "." ]
train
https://github.com/spacetelescope/acstools/blob/bbf8dd080cefcbf88529ec87c420f9e1b8002554/acstools/acsrej.py#L209-L229
google/python-atfork
atfork/__init__.py
monkeypatch_os_fork_functions
def monkeypatch_os_fork_functions(): """ Replace os.fork* with wrappers that use ForkSafeLock to acquire all locks before forking and release them afterwards. """ builtin_function = type(''.join) if hasattr(os, 'fork') and isinstance(os.fork, builtin_function): global _orig_os_fork ...
python
def monkeypatch_os_fork_functions(): """ Replace os.fork* with wrappers that use ForkSafeLock to acquire all locks before forking and release them afterwards. """ builtin_function = type(''.join) if hasattr(os, 'fork') and isinstance(os.fork, builtin_function): global _orig_os_fork ...
[ "def", "monkeypatch_os_fork_functions", "(", ")", ":", "builtin_function", "=", "type", "(", "''", ".", "join", ")", "if", "hasattr", "(", "os", ",", "'fork'", ")", "and", "isinstance", "(", "os", ".", "fork", ",", "builtin_function", ")", ":", "global", ...
Replace os.fork* with wrappers that use ForkSafeLock to acquire all locks before forking and release them afterwards.
[ "Replace", "os", ".", "fork", "*", "with", "wrappers", "that", "use", "ForkSafeLock", "to", "acquire", "all", "locks", "before", "forking", "and", "release", "them", "afterwards", "." ]
train
https://github.com/google/python-atfork/blob/0ba186bd3a75f823c720e711b39d73441da67ea4/atfork/__init__.py#L58-L71
google/python-atfork
atfork/__init__.py
atfork
def atfork(prepare=None, parent=None, child=None): """A Python work-a-like of pthread_atfork. Any time a fork() is called from Python, all 'prepare' callables will be called in the order they were registered using this function. After the fork (successful or not), all 'parent' callables will be ca...
python
def atfork(prepare=None, parent=None, child=None): """A Python work-a-like of pthread_atfork. Any time a fork() is called from Python, all 'prepare' callables will be called in the order they were registered using this function. After the fork (successful or not), all 'parent' callables will be ca...
[ "def", "atfork", "(", "prepare", "=", "None", ",", "parent", "=", "None", ",", "child", "=", "None", ")", ":", "assert", "not", "prepare", "or", "callable", "(", "prepare", ")", "assert", "not", "parent", "or", "callable", "(", "parent", ")", "assert",...
A Python work-a-like of pthread_atfork. Any time a fork() is called from Python, all 'prepare' callables will be called in the order they were registered using this function. After the fork (successful or not), all 'parent' callables will be called in the parent process. If the fork succeeded, al...
[ "A", "Python", "work", "-", "a", "-", "like", "of", "pthread_atfork", ".", "Any", "time", "a", "fork", "()", "is", "called", "from", "Python", "all", "prepare", "callables", "will", "be", "called", "in", "the", "order", "they", "were", "registered", "usi...
train
https://github.com/google/python-atfork/blob/0ba186bd3a75f823c720e711b39d73441da67ea4/atfork/__init__.py#L82-L108
google/python-atfork
atfork/__init__.py
_call_atfork_list
def _call_atfork_list(call_list): """ Given a list of callables in call_list, call them all in order and save and return a list of sys.exc_info() tuples for each exception raised. """ exception_list = [] for func in call_list: try: func() except: exception...
python
def _call_atfork_list(call_list): """ Given a list of callables in call_list, call them all in order and save and return a list of sys.exc_info() tuples for each exception raised. """ exception_list = [] for func in call_list: try: func() except: exception...
[ "def", "_call_atfork_list", "(", "call_list", ")", ":", "exception_list", "=", "[", "]", "for", "func", "in", "call_list", ":", "try", ":", "func", "(", ")", "except", ":", "exception_list", ".", "append", "(", "sys", ".", "exc_info", "(", ")", ")", "r...
Given a list of callables in call_list, call them all in order and save and return a list of sys.exc_info() tuples for each exception raised.
[ "Given", "a", "list", "of", "callables", "in", "call_list", "call", "them", "all", "in", "order", "and", "save", "and", "return", "a", "list", "of", "sys", ".", "exc_info", "()", "tuples", "for", "each", "exception", "raised", "." ]
train
https://github.com/google/python-atfork/blob/0ba186bd3a75f823c720e711b39d73441da67ea4/atfork/__init__.py#L111-L122
google/python-atfork
atfork/__init__.py
parent_after_fork_release
def parent_after_fork_release(): """ Call all parent after fork callables, release the lock and print all prepare and parent callback exceptions. """ prepare_exceptions = list(_prepare_call_exceptions) del _prepare_call_exceptions[:] exceptions = _call_atfork_list(_parent_call_list) _for...
python
def parent_after_fork_release(): """ Call all parent after fork callables, release the lock and print all prepare and parent callback exceptions. """ prepare_exceptions = list(_prepare_call_exceptions) del _prepare_call_exceptions[:] exceptions = _call_atfork_list(_parent_call_list) _for...
[ "def", "parent_after_fork_release", "(", ")", ":", "prepare_exceptions", "=", "list", "(", "_prepare_call_exceptions", ")", "del", "_prepare_call_exceptions", "[", ":", "]", "exceptions", "=", "_call_atfork_list", "(", "_parent_call_list", ")", "_fork_lock", ".", "rel...
Call all parent after fork callables, release the lock and print all prepare and parent callback exceptions.
[ "Call", "all", "parent", "after", "fork", "callables", "release", "the", "lock", "and", "print", "all", "prepare", "and", "parent", "callback", "exceptions", "." ]
train
https://github.com/google/python-atfork/blob/0ba186bd3a75f823c720e711b39d73441da67ea4/atfork/__init__.py#L131-L141
google/python-atfork
atfork/__init__.py
_print_exception_list
def _print_exception_list(exceptions, message, output_file=None): """ Given a list of sys.exc_info tuples, print them all using the traceback module preceeded by a message and separated by a blank line. """ output_file = output_file or sys.stderr message = 'Exception %s:\n' % message for exc...
python
def _print_exception_list(exceptions, message, output_file=None): """ Given a list of sys.exc_info tuples, print them all using the traceback module preceeded by a message and separated by a blank line. """ output_file = output_file or sys.stderr message = 'Exception %s:\n' % message for exc...
[ "def", "_print_exception_list", "(", "exceptions", ",", "message", ",", "output_file", "=", "None", ")", ":", "output_file", "=", "output_file", "or", "sys", ".", "stderr", "message", "=", "'Exception %s:\\n'", "%", "message", "for", "exc_type", ",", "exc_value"...
Given a list of sys.exc_info tuples, print them all using the traceback module preceeded by a message and separated by a blank line.
[ "Given", "a", "list", "of", "sys", ".", "exc_info", "tuples", "print", "them", "all", "using", "the", "traceback", "module", "preceeded", "by", "a", "message", "and", "separated", "by", "a", "blank", "line", "." ]
train
https://github.com/google/python-atfork/blob/0ba186bd3a75f823c720e711b39d73441da67ea4/atfork/__init__.py#L155-L166
google/python-atfork
atfork/__init__.py
os_forkpty_wrapper
def os_forkpty_wrapper(): """Wraps os.forkpty() to run atfork handlers.""" pid = None prepare_to_fork_acquire() try: pid, fd = _orig_os_forkpty() finally: if pid == 0: child_after_fork_release() else: parent_after_fork_release() return pid, fd
python
def os_forkpty_wrapper(): """Wraps os.forkpty() to run atfork handlers.""" pid = None prepare_to_fork_acquire() try: pid, fd = _orig_os_forkpty() finally: if pid == 0: child_after_fork_release() else: parent_after_fork_release() return pid, fd
[ "def", "os_forkpty_wrapper", "(", ")", ":", "pid", "=", "None", "prepare_to_fork_acquire", "(", ")", "try", ":", "pid", ",", "fd", "=", "_orig_os_forkpty", "(", ")", "finally", ":", "if", "pid", "==", "0", ":", "child_after_fork_release", "(", ")", "else",...
Wraps os.forkpty() to run atfork handlers.
[ "Wraps", "os", ".", "forkpty", "()", "to", "run", "atfork", "handlers", "." ]
train
https://github.com/google/python-atfork/blob/0ba186bd3a75f823c720e711b39d73441da67ea4/atfork/__init__.py#L185-L196
ekampf/pymaybe
pymaybe/__init__.py
maybe
def maybe(value): """Wraps an object with a Maybe instance. >>> maybe("I'm a value") Something("I'm a value") >>> maybe(None); Nothing Testing for value: >>> maybe("I'm a value").is_some() True >>> maybe("I'm a value").is_none() False >>> may...
python
def maybe(value): """Wraps an object with a Maybe instance. >>> maybe("I'm a value") Something("I'm a value") >>> maybe(None); Nothing Testing for value: >>> maybe("I'm a value").is_some() True >>> maybe("I'm a value").is_none() False >>> may...
[ "def", "maybe", "(", "value", ")", ":", "if", "isinstance", "(", "value", ",", "Maybe", ")", ":", "return", "value", "if", "value", "is", "not", "None", ":", "return", "Something", "(", "value", ")", "return", "Nothing", "(", ")" ]
Wraps an object with a Maybe instance. >>> maybe("I'm a value") Something("I'm a value") >>> maybe(None); Nothing Testing for value: >>> maybe("I'm a value").is_some() True >>> maybe("I'm a value").is_none() False >>> maybe(None).is_some() ...
[ "Wraps", "an", "object", "with", "a", "Maybe", "instance", "." ]
train
https://github.com/ekampf/pymaybe/blob/f755600f5478b6b595e2100417b39a7bc3de2c6f/pymaybe/__init__.py#L472-L575
ianepperson/telnetsrvlib
telnetsrv/evtlet.py
TelnetHandler.setup
def setup(self): '''Called after instantiation''' TelnetHandlerBase.setup(self) # Spawn a greenlet to handle socket input self.greenlet_ic = eventlet.spawn(self.inputcooker) # Note that inputcooker exits on EOF # Sleep for 0.5 second to allow options negotiation ...
python
def setup(self): '''Called after instantiation''' TelnetHandlerBase.setup(self) # Spawn a greenlet to handle socket input self.greenlet_ic = eventlet.spawn(self.inputcooker) # Note that inputcooker exits on EOF # Sleep for 0.5 second to allow options negotiation ...
[ "def", "setup", "(", "self", ")", ":", "TelnetHandlerBase", ".", "setup", "(", "self", ")", "# Spawn a greenlet to handle socket input", "self", ".", "greenlet_ic", "=", "eventlet", ".", "spawn", "(", "self", ".", "inputcooker", ")", "# Note that inputcooker exits o...
Called after instantiation
[ "Called", "after", "instantiation" ]
train
https://github.com/ianepperson/telnetsrvlib/blob/fac52a4a333c2d373d53d295a76a0bbd71e5d682/telnetsrv/evtlet.py#L16-L24
ianepperson/telnetsrvlib
telnetsrv/evtlet.py
TelnetHandler.inputcooker_store_queue
def inputcooker_store_queue(self, char): """Put the cooked data in the input queue (no locking needed)""" if type(char) in [type(()), type([]), type("")]: for v in char: self.cookedq.put(v) else: self.cookedq.put(char)
python
def inputcooker_store_queue(self, char): """Put the cooked data in the input queue (no locking needed)""" if type(char) in [type(()), type([]), type("")]: for v in char: self.cookedq.put(v) else: self.cookedq.put(char)
[ "def", "inputcooker_store_queue", "(", "self", ",", "char", ")", ":", "if", "type", "(", "char", ")", "in", "[", "type", "(", "(", ")", ")", ",", "type", "(", "[", "]", ")", ",", "type", "(", "\"\"", ")", "]", ":", "for", "v", "in", "char", "...
Put the cooked data in the input queue (no locking needed)
[ "Put", "the", "cooked", "data", "in", "the", "input", "queue", "(", "no", "locking", "needed", ")" ]
train
https://github.com/ianepperson/telnetsrvlib/blob/fac52a4a333c2d373d53d295a76a0bbd71e5d682/telnetsrv/evtlet.py#L51-L57
ianepperson/telnetsrvlib
telnetsrv/paramiko_ssh.py
SSHHandler.setup
def setup(self): '''Setup the connection.''' log.debug( 'New request from address %s, port %d', self.client_address ) try: self.transport.load_server_moduli() except: log.exception( '(Failed to load moduli -- gex will be unsupported.)' ) rais...
python
def setup(self): '''Setup the connection.''' log.debug( 'New request from address %s, port %d', self.client_address ) try: self.transport.load_server_moduli() except: log.exception( '(Failed to load moduli -- gex will be unsupported.)' ) rais...
[ "def", "setup", "(", "self", ")", ":", "log", ".", "debug", "(", "'New request from address %s, port %d'", ",", "self", ".", "client_address", ")", "try", ":", "self", ".", "transport", ".", "load_server_moduli", "(", ")", "except", ":", "log", ".", "excepti...
Setup the connection.
[ "Setup", "the", "connection", "." ]
train
https://github.com/ianepperson/telnetsrvlib/blob/fac52a4a333c2d373d53d295a76a0bbd71e5d682/telnetsrv/paramiko_ssh.py#L71-L108
ianepperson/telnetsrvlib
telnetsrv/paramiko_ssh.py
SSHHandler.streamserver_handle
def streamserver_handle(cls, socket, address): '''Translate this class for use in a StreamServer''' request = cls.dummy_request() request._sock = socket server = None cls(request, address, server)
python
def streamserver_handle(cls, socket, address): '''Translate this class for use in a StreamServer''' request = cls.dummy_request() request._sock = socket server = None cls(request, address, server)
[ "def", "streamserver_handle", "(", "cls", ",", "socket", ",", "address", ")", ":", "request", "=", "cls", ".", "dummy_request", "(", ")", "request", ".", "_sock", "=", "socket", "server", "=", "None", "cls", "(", "request", ",", "address", ",", "server",...
Translate this class for use in a StreamServer
[ "Translate", "this", "class", "for", "use", "in", "a", "StreamServer" ]
train
https://github.com/ianepperson/telnetsrvlib/blob/fac52a4a333c2d373d53d295a76a0bbd71e5d682/telnetsrv/paramiko_ssh.py#L118-L123
ianepperson/telnetsrvlib
telnetsrv/paramiko_ssh.py
SSHHandler.check_channel_shell_request
def check_channel_shell_request(self, channel): '''Request to start a shell on the given channel''' try: self.channels[channel].start() except KeyError: log.error('Requested to start a channel (%r) that was not previously set up.', channel) return False ...
python
def check_channel_shell_request(self, channel): '''Request to start a shell on the given channel''' try: self.channels[channel].start() except KeyError: log.error('Requested to start a channel (%r) that was not previously set up.', channel) return False ...
[ "def", "check_channel_shell_request", "(", "self", ",", "channel", ")", ":", "try", ":", "self", ".", "channels", "[", "channel", "]", ".", "start", "(", ")", "except", "KeyError", ":", "log", ".", "error", "(", "'Requested to start a channel (%r) that was not p...
Request to start a shell on the given channel
[ "Request", "to", "start", "a", "shell", "on", "the", "given", "channel" ]
train
https://github.com/ianepperson/telnetsrvlib/blob/fac52a4a333c2d373d53d295a76a0bbd71e5d682/telnetsrv/paramiko_ssh.py#L200-L208
ianepperson/telnetsrvlib
telnetsrv/paramiko_ssh.py
SSHHandler.check_channel_pty_request
def check_channel_pty_request(self, channel, term, width, height, pixelwidth, pixelheight, modes): '''Request to allocate a PTY terminal.''' #self.sshterm = term #print "term: %r, modes: %r" % (term, modes) log.debug('PTY requested. Setting up %r.', sel...
python
def check_channel_pty_request(self, channel, term, width, height, pixelwidth, pixelheight, modes): '''Request to allocate a PTY terminal.''' #self.sshterm = term #print "term: %r, modes: %r" % (term, modes) log.debug('PTY requested. Setting up %r.', sel...
[ "def", "check_channel_pty_request", "(", "self", ",", "channel", ",", "term", ",", "width", ",", "height", ",", "pixelwidth", ",", "pixelheight", ",", "modes", ")", ":", "#self.sshterm = term", "#print \"term: %r, modes: %r\" % (term, modes)", "log", ".", "debug", "...
Request to allocate a PTY terminal.
[ "Request", "to", "allocate", "a", "PTY", "terminal", "." ]
train
https://github.com/ianepperson/telnetsrvlib/blob/fac52a4a333c2d373d53d295a76a0bbd71e5d682/telnetsrv/paramiko_ssh.py#L210-L219
deeplearning4j/pydl4j
pydl4j/downloader.py
download
def download(url, file_name): r = requests.get(url, stream=True) file_size = int(r.headers['Content-length']) ''' if py3: file_size = int(u.getheader("Content-Length")[0]) else: file_size = int(u.info().getheaders("Content-Length")[0]) ''' file_exists = False if...
python
def download(url, file_name): r = requests.get(url, stream=True) file_size = int(r.headers['Content-length']) ''' if py3: file_size = int(u.getheader("Content-Length")[0]) else: file_size = int(u.info().getheaders("Content-Length")[0]) ''' file_exists = False if...
[ "def", "download", "(", "url", ",", "file_name", ")", ":", "r", "=", "requests", ".", "get", "(", "url", ",", "stream", "=", "True", ")", "file_size", "=", "int", "(", "r", ".", "headers", "[", "'Content-length'", "]", ")", "file_exists", "=", "False...
if py3: file_size = int(u.getheader("Content-Length")[0]) else: file_size = int(u.info().getheaders("Content-Length")[0])
[ "if", "py3", ":", "file_size", "=", "int", "(", "u", ".", "getheader", "(", "Content", "-", "Length", ")", "[", "0", "]", ")", "else", ":", "file_size", "=", "int", "(", "u", ".", "info", "()", ".", "getheaders", "(", "Content", "-", "Length", ")...
train
https://github.com/deeplearning4j/pydl4j/blob/63f8a1cae2afb4b08dbfe28ef8e08de741f0d3cd/pydl4j/downloader.py#L23-L82