repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
partition
stringclasses
1 value
casacore/python-casacore
casacore/images/image.py
image.getdata
def getdata(self, blc=(), trc=(), inc=()): """Get image data. Using the arguments blc (bottom left corner), trc (top right corner), and inc (stride) it is possible to get a data slice. The data is returned as a numpy array. Its dimensionality is the same as the dimensionality o...
python
def getdata(self, blc=(), trc=(), inc=()): """Get image data. Using the arguments blc (bottom left corner), trc (top right corner), and inc (stride) it is possible to get a data slice. The data is returned as a numpy array. Its dimensionality is the same as the dimensionality o...
[ "def", "getdata", "(", "self", ",", "blc", "=", "(", ")", ",", "trc", "=", "(", ")", ",", "inc", "=", "(", ")", ")", ":", "return", "self", ".", "_getdata", "(", "self", ".", "_adjustBlc", "(", "blc", ")", ",", "self", ".", "_adjustTrc", "(", ...
Get image data. Using the arguments blc (bottom left corner), trc (top right corner), and inc (stride) it is possible to get a data slice. The data is returned as a numpy array. Its dimensionality is the same as the dimensionality of the image, even if an axis has length 1.
[ "Get", "image", "data", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/images/image.py#L292-L304
train
casacore/python-casacore
casacore/images/image.py
image.getmask
def getmask(self, blc=(), trc=(), inc=()): """Get image mask. Using the arguments blc (bottom left corner), trc (top right corner), and inc (stride) it is possible to get a mask slice. Not all axes need to be specified. Missing values default to begin, end, and 1. The mask is r...
python
def getmask(self, blc=(), trc=(), inc=()): """Get image mask. Using the arguments blc (bottom left corner), trc (top right corner), and inc (stride) it is possible to get a mask slice. Not all axes need to be specified. Missing values default to begin, end, and 1. The mask is r...
[ "def", "getmask", "(", "self", ",", "blc", "=", "(", ")", ",", "trc", "=", "(", ")", ",", "inc", "=", "(", ")", ")", ":", "return", "numpy", ".", "logical_not", "(", "self", ".", "_getmask", "(", "self", ".", "_adjustBlc", "(", "blc", ")", ",",...
Get image mask. Using the arguments blc (bottom left corner), trc (top right corner), and inc (stride) it is possible to get a mask slice. Not all axes need to be specified. Missing values default to begin, end, and 1. The mask is returned as a numpy array. Its dimensionality is the sa...
[ "Get", "image", "mask", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/images/image.py#L307-L327
train
casacore/python-casacore
casacore/images/image.py
image.get
def get(self, blc=(), trc=(), inc=()): """Get image data and mask. Get the image data and mask (see ::func:`getdata` and :func:`getmask`) as a numpy masked array. """ return nma.masked_array(self.getdata(blc, trc, inc), self.getmask(blc, trc, inc...
python
def get(self, blc=(), trc=(), inc=()): """Get image data and mask. Get the image data and mask (see ::func:`getdata` and :func:`getmask`) as a numpy masked array. """ return nma.masked_array(self.getdata(blc, trc, inc), self.getmask(blc, trc, inc...
[ "def", "get", "(", "self", ",", "blc", "=", "(", ")", ",", "trc", "=", "(", ")", ",", "inc", "=", "(", ")", ")", ":", "return", "nma", ".", "masked_array", "(", "self", ".", "getdata", "(", "blc", ",", "trc", ",", "inc", ")", ",", "self", "...
Get image data and mask. Get the image data and mask (see ::func:`getdata` and :func:`getmask`) as a numpy masked array.
[ "Get", "image", "data", "and", "mask", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/images/image.py#L330-L338
train
casacore/python-casacore
casacore/images/image.py
image.putdata
def putdata(self, value, blc=(), trc=(), inc=()): """Put image data. Using the arguments blc (bottom left corner), trc (top right corner), and inc (stride) it is possible to put a data slice. Not all axes need to be specified. Missing values default to begin, end, and 1. The da...
python
def putdata(self, value, blc=(), trc=(), inc=()): """Put image data. Using the arguments blc (bottom left corner), trc (top right corner), and inc (stride) it is possible to put a data slice. Not all axes need to be specified. Missing values default to begin, end, and 1. The da...
[ "def", "putdata", "(", "self", ",", "value", ",", "blc", "=", "(", ")", ",", "trc", "=", "(", ")", ",", "inc", "=", "(", ")", ")", ":", "return", "self", ".", "_putdata", "(", "value", ",", "self", ".", "_adjustBlc", "(", "blc", ")", ",", "se...
Put image data. Using the arguments blc (bottom left corner), trc (top right corner), and inc (stride) it is possible to put a data slice. Not all axes need to be specified. Missing values default to begin, end, and 1. The data should be a numpy array. Its dimensionality must be the sa...
[ "Put", "image", "data", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/images/image.py#L340-L352
train
casacore/python-casacore
casacore/images/image.py
image.putmask
def putmask(self, value, blc=(), trc=(), inc=()): """Put image mask. Using the arguments blc (bottom left corner), trc (top right corner), and inc (stride) it is possible to put a data slice. Not all axes need to be specified. Missing values default to begin, end, and 1. The da...
python
def putmask(self, value, blc=(), trc=(), inc=()): """Put image mask. Using the arguments blc (bottom left corner), trc (top right corner), and inc (stride) it is possible to put a data slice. Not all axes need to be specified. Missing values default to begin, end, and 1. The da...
[ "def", "putmask", "(", "self", ",", "value", ",", "blc", "=", "(", ")", ",", "trc", "=", "(", ")", ",", "inc", "=", "(", ")", ")", ":", "return", "self", ".", "_putmask", "(", "~", "value", ",", "self", ".", "_adjustBlc", "(", "blc", ")", ","...
Put image mask. Using the arguments blc (bottom left corner), trc (top right corner), and inc (stride) it is possible to put a data slice. Not all axes need to be specified. Missing values default to begin, end, and 1. The data should be a numpy array. Its dimensionality must be the sa...
[ "Put", "image", "mask", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/images/image.py#L354-L375
train
casacore/python-casacore
casacore/images/image.py
image.put
def put(self, value, blc=(), trc=(), inc=()): """Put image data and mask. Put the image data and optionally the mask (see ::func:`getdata` and :func:`getmask`). If the `value` argument is a numpy masked array, but data and mask will bw written. If it is a normal numpy array, onl...
python
def put(self, value, blc=(), trc=(), inc=()): """Put image data and mask. Put the image data and optionally the mask (see ::func:`getdata` and :func:`getmask`). If the `value` argument is a numpy masked array, but data and mask will bw written. If it is a normal numpy array, onl...
[ "def", "put", "(", "self", ",", "value", ",", "blc", "=", "(", ")", ",", "trc", "=", "(", ")", ",", "inc", "=", "(", ")", ")", ":", "if", "isinstance", "(", "value", ",", "nma", ".", "MaskedArray", ")", ":", "self", ".", "putdata", "(", "valu...
Put image data and mask. Put the image data and optionally the mask (see ::func:`getdata` and :func:`getmask`). If the `value` argument is a numpy masked array, but data and mask will bw written. If it is a normal numpy array, only the data will be written.
[ "Put", "image", "data", "and", "mask", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/images/image.py#L377-L391
train
casacore/python-casacore
casacore/images/image.py
image.subimage
def subimage(self, blc=(), trc=(), inc=(), dropdegenerate=True): """Form a subimage. An image object containing a subset of an image is returned. The arguments blc (bottom left corner), trc (top right corner), and inc (stride) define the subset. Not all axes need to be specified. ...
python
def subimage(self, blc=(), trc=(), inc=(), dropdegenerate=True): """Form a subimage. An image object containing a subset of an image is returned. The arguments blc (bottom left corner), trc (top right corner), and inc (stride) define the subset. Not all axes need to be specified. ...
[ "def", "subimage", "(", "self", ",", "blc", "=", "(", ")", ",", "trc", "=", "(", ")", ",", "inc", "=", "(", ")", ",", "dropdegenerate", "=", "True", ")", ":", "return", "image", "(", "self", ".", "_subimage", "(", "self", ".", "_adjustBlc", "(", ...
Form a subimage. An image object containing a subset of an image is returned. The arguments blc (bottom left corner), trc (top right corner), and inc (stride) define the subset. Not all axes need to be specified. Missing values default to begin, end, and 1. By default axes with...
[ "Form", "a", "subimage", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/images/image.py#L426-L444
train
casacore/python-casacore
casacore/images/image.py
image.info
def info(self): """Get coordinates, image info, and unit".""" return {'coordinates': self._coordinates(), 'imageinfo': self._imageinfo(), 'miscinfo': self._miscinfo(), 'unit': self._unit() }
python
def info(self): """Get coordinates, image info, and unit".""" return {'coordinates': self._coordinates(), 'imageinfo': self._imageinfo(), 'miscinfo': self._miscinfo(), 'unit': self._unit() }
[ "def", "info", "(", "self", ")", ":", "return", "{", "'coordinates'", ":", "self", ".", "_coordinates", "(", ")", ",", "'imageinfo'", ":", "self", ".", "_imageinfo", "(", ")", ",", "'miscinfo'", ":", "self", ".", "_miscinfo", "(", ")", ",", "'unit'", ...
Get coordinates, image info, and unit".
[ "Get", "coordinates", "image", "info", "and", "unit", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/images/image.py#L484-L490
train
casacore/python-casacore
casacore/images/image.py
image.tofits
def tofits(self, filename, overwrite=True, velocity=True, optical=True, bitpix=-32, minpix=1, maxpix=-1): """Write the image to a file in FITS format. `filename` FITS file name `overwrite` If False, an exception is raised if the new image file already exists. ...
python
def tofits(self, filename, overwrite=True, velocity=True, optical=True, bitpix=-32, minpix=1, maxpix=-1): """Write the image to a file in FITS format. `filename` FITS file name `overwrite` If False, an exception is raised if the new image file already exists. ...
[ "def", "tofits", "(", "self", ",", "filename", ",", "overwrite", "=", "True", ",", "velocity", "=", "True", ",", "optical", "=", "True", ",", "bitpix", "=", "-", "32", ",", "minpix", "=", "1", ",", "maxpix", "=", "-", "1", ")", ":", "return", "se...
Write the image to a file in FITS format. `filename` FITS file name `overwrite` If False, an exception is raised if the new image file already exists. Default is True. `velocity` By default a velocity primary spectral axis is written if possible. ...
[ "Write", "the", "image", "to", "a", "file", "in", "FITS", "format", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/images/image.py#L492-L519
train
casacore/python-casacore
casacore/images/image.py
image.saveas
def saveas(self, filename, overwrite=True, hdf5=False, copymask=True, newmaskname="", newtileshape=()): """Write the image to disk. Note that the created disk file is a snapshot, so it is not updated for possible later changes in the image object. `overwrite` I...
python
def saveas(self, filename, overwrite=True, hdf5=False, copymask=True, newmaskname="", newtileshape=()): """Write the image to disk. Note that the created disk file is a snapshot, so it is not updated for possible later changes in the image object. `overwrite` I...
[ "def", "saveas", "(", "self", ",", "filename", ",", "overwrite", "=", "True", ",", "hdf5", "=", "False", ",", "copymask", "=", "True", ",", "newmaskname", "=", "\"\"", ",", "newtileshape", "=", "(", ")", ")", ":", "self", ".", "_saveas", "(", "filena...
Write the image to disk. Note that the created disk file is a snapshot, so it is not updated for possible later changes in the image object. `overwrite` If False, an exception is raised if the new image file already exists. Default is True. `ashdf5` If Tru...
[ "Write", "the", "image", "to", "disk", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/images/image.py#L521-L547
train
casacore/python-casacore
casacore/images/image.py
image.statistics
def statistics(self, axes=(), minmaxvalues=(), exclude=False, robust=True): """Calculate statistics for the image. Statistics are returned in a dict for the given axes. E.g. if axes [0,1] is given in a 3-dim image, the statistics are calculated for each plane along the 3rd axis. By defa...
python
def statistics(self, axes=(), minmaxvalues=(), exclude=False, robust=True): """Calculate statistics for the image. Statistics are returned in a dict for the given axes. E.g. if axes [0,1] is given in a 3-dim image, the statistics are calculated for each plane along the 3rd axis. By defa...
[ "def", "statistics", "(", "self", ",", "axes", "=", "(", ")", ",", "minmaxvalues", "=", "(", ")", ",", "exclude", "=", "False", ",", "robust", "=", "True", ")", ":", "return", "self", ".", "_statistics", "(", "self", ".", "_adaptAxes", "(", "axes", ...
Calculate statistics for the image. Statistics are returned in a dict for the given axes. E.g. if axes [0,1] is given in a 3-dim image, the statistics are calculated for each plane along the 3rd axis. By default statistics are calculated for the entire image. `minmaxvalues` can...
[ "Calculate", "statistics", "for", "the", "image", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/images/image.py#L549-L565
train
casacore/python-casacore
casacore/images/image.py
image.regrid
def regrid(self, axes, coordsys, outname="", overwrite=True, outshape=(), interpolation="linear", decimate=10, replicate=False, refchange=True, forceregrid=False): """Regrid the image to a new image object. Regrid the image on the given axes to the given co...
python
def regrid(self, axes, coordsys, outname="", overwrite=True, outshape=(), interpolation="linear", decimate=10, replicate=False, refchange=True, forceregrid=False): """Regrid the image to a new image object. Regrid the image on the given axes to the given co...
[ "def", "regrid", "(", "self", ",", "axes", ",", "coordsys", ",", "outname", "=", "\"\"", ",", "overwrite", "=", "True", ",", "outshape", "=", "(", ")", ",", "interpolation", "=", "\"linear\"", ",", "decimate", "=", "10", ",", "replicate", "=", "False",...
Regrid the image to a new image object. Regrid the image on the given axes to the given coordinate system. The output is stored in the given file; it no file name is given a temporary image is made. If the output shape is empty, the old shape is used. `replicate=True` means...
[ "Regrid", "the", "image", "to", "a", "new", "image", "object", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/images/image.py#L567-L584
train
casacore/python-casacore
casacore/images/image.py
image.view
def view(self, tempname='/tmp/tempimage'): """Display the image using casaviewer. If the image is not persistent, a copy will be made that the user has to delete once viewing has finished. The name of the copy can be given in argument `tempname`. Default is '/tmp/tempimage'. ""...
python
def view(self, tempname='/tmp/tempimage'): """Display the image using casaviewer. If the image is not persistent, a copy will be made that the user has to delete once viewing has finished. The name of the copy can be given in argument `tempname`. Default is '/tmp/tempimage'. ""...
[ "def", "view", "(", "self", ",", "tempname", "=", "'/tmp/tempimage'", ")", ":", "import", "os", "if", "os", ".", "system", "(", "'test -x `which casaviewer` > /dev/null 2>&1'", ")", "==", "0", ":", "six", ".", "print_", "(", "\"Starting casaviewer in the backgroun...
Display the image using casaviewer. If the image is not persistent, a copy will be made that the user has to delete once viewing has finished. The name of the copy can be given in argument `tempname`. Default is '/tmp/tempimage'.
[ "Display", "the", "image", "using", "casaviewer", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/images/image.py#L586-L612
train
casacore/python-casacore
setup.py
find_library_file
def find_library_file(libname): """ Try to get the directory of the specified library. It adds to the search path the library paths given to distutil's build_ext. """ # Use a dummy argument parser to get user specified library dirs parser = argparse.ArgumentParser(add_help=False) parser.add_...
python
def find_library_file(libname): """ Try to get the directory of the specified library. It adds to the search path the library paths given to distutil's build_ext. """ # Use a dummy argument parser to get user specified library dirs parser = argparse.ArgumentParser(add_help=False) parser.add_...
[ "def", "find_library_file", "(", "libname", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "add_help", "=", "False", ")", "parser", ".", "add_argument", "(", "\"--library-dirs\"", ",", "\"-L\"", ",", "default", "=", "''", ")", "args", ",", ...
Try to get the directory of the specified library. It adds to the search path the library paths given to distutil's build_ext.
[ "Try", "to", "get", "the", "directory", "of", "the", "specified", "library", ".", "It", "adds", "to", "the", "search", "path", "the", "library", "paths", "given", "to", "distutil", "s", "build_ext", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/setup.py#L40-L57
train
casacore/python-casacore
setup.py
find_boost
def find_boost(): """Find the name of the boost-python library. Returns None if none is found.""" short_version = "{}{}".format(sys.version_info[0], sys.version_info[1]) boostlibnames = ['boost_python-py' + short_version, 'boost_python' + short_version, 'boost_pytho...
python
def find_boost(): """Find the name of the boost-python library. Returns None if none is found.""" short_version = "{}{}".format(sys.version_info[0], sys.version_info[1]) boostlibnames = ['boost_python-py' + short_version, 'boost_python' + short_version, 'boost_pytho...
[ "def", "find_boost", "(", ")", ":", "short_version", "=", "\"{}{}\"", ".", "format", "(", "sys", ".", "version_info", "[", "0", "]", ",", "sys", ".", "version_info", "[", "1", "]", ")", "boostlibnames", "=", "[", "'boost_python-py'", "+", "short_version", ...
Find the name of the boost-python library. Returns None if none is found.
[ "Find", "the", "name", "of", "the", "boost", "-", "python", "library", ".", "Returns", "None", "if", "none", "is", "found", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/setup.py#L64-L80
train
casacore/python-casacore
casacore/tables/tablerow.py
_tablerow.put
def put(self, rownr, value, matchingfields=True): """Put the values into the given row. The value should be a dict (as returned by method :func:`get`. The names of the fields in the dict should match the names of the columns used in the `tablerow` object. `matchingfields=True` ...
python
def put(self, rownr, value, matchingfields=True): """Put the values into the given row. The value should be a dict (as returned by method :func:`get`. The names of the fields in the dict should match the names of the columns used in the `tablerow` object. `matchingfields=True` ...
[ "def", "put", "(", "self", ",", "rownr", ",", "value", ",", "matchingfields", "=", "True", ")", ":", "self", ".", "_put", "(", "rownr", ",", "value", ",", "matchingfields", ")" ]
Put the values into the given row. The value should be a dict (as returned by method :func:`get`. The names of the fields in the dict should match the names of the columns used in the `tablerow` object. `matchingfields=True` means that the value may contain more fields and only...
[ "Put", "the", "values", "into", "the", "given", "row", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/tables/tablerow.py#L52-L63
train
casacore/python-casacore
casacore/quanta/quantity.py
quantity
def quantity(*args): """Create a quantity. This can be from a scalar or vector. Example:: q1 = quantity(1.0, "km/s") q2 = quantity("1km/s") q1 = quantity([1.0,2.0], "km/s") """ if len(args) == 1: if isinstance(args[0], str): # use copy constructor to create quant...
python
def quantity(*args): """Create a quantity. This can be from a scalar or vector. Example:: q1 = quantity(1.0, "km/s") q2 = quantity("1km/s") q1 = quantity([1.0,2.0], "km/s") """ if len(args) == 1: if isinstance(args[0], str): # use copy constructor to create quant...
[ "def", "quantity", "(", "*", "args", ")", ":", "if", "len", "(", "args", ")", "==", "1", ":", "if", "isinstance", "(", "args", "[", "0", "]", ",", "str", ")", ":", "return", "Quantity", "(", "from_string", "(", "args", "[", "0", "]", ")", ")", ...
Create a quantity. This can be from a scalar or vector. Example:: q1 = quantity(1.0, "km/s") q2 = quantity("1km/s") q1 = quantity([1.0,2.0], "km/s")
[ "Create", "a", "quantity", ".", "This", "can", "be", "from", "a", "scalar", "or", "vector", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/quanta/quantity.py#L43-L70
train
casacore/python-casacore
casacore/util/substitute.py
getvariable
def getvariable(name): """Get the value of a local variable somewhere in the call stack.""" import inspect fr = inspect.currentframe() try: while fr: fr = fr.f_back vars = fr.f_locals if name in vars: return vars[name] except: pass ...
python
def getvariable(name): """Get the value of a local variable somewhere in the call stack.""" import inspect fr = inspect.currentframe() try: while fr: fr = fr.f_back vars = fr.f_locals if name in vars: return vars[name] except: pass ...
[ "def", "getvariable", "(", "name", ")", ":", "import", "inspect", "fr", "=", "inspect", ".", "currentframe", "(", ")", "try", ":", "while", "fr", ":", "fr", "=", "fr", ".", "f_back", "vars", "=", "fr", ".", "f_locals", "if", "name", "in", "vars", "...
Get the value of a local variable somewhere in the call stack.
[ "Get", "the", "value", "of", "a", "local", "variable", "somewhere", "in", "the", "call", "stack", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/util/substitute.py#L47-L59
train
casacore/python-casacore
casacore/util/substitute.py
substitute
def substitute(s, objlist=(), globals={}, locals={}): """Substitute global python variables in a command string. This function parses a string and tries to substitute parts like `$name` by their value. It is uses by :mod:`image` and :mod:`table` to handle image and table objects in a command, but also ...
python
def substitute(s, objlist=(), globals={}, locals={}): """Substitute global python variables in a command string. This function parses a string and tries to substitute parts like `$name` by their value. It is uses by :mod:`image` and :mod:`table` to handle image and table objects in a command, but also ...
[ "def", "substitute", "(", "s", ",", "objlist", "=", "(", ")", ",", "globals", "=", "{", "}", ",", "locals", "=", "{", "}", ")", ":", "if", "not", "locals", ":", "locals", "=", "getlocals", "(", "3", ")", "backslash", "=", "False", "dollar", "=", ...
Substitute global python variables in a command string. This function parses a string and tries to substitute parts like `$name` by their value. It is uses by :mod:`image` and :mod:`table` to handle image and table objects in a command, but also other variables (integers, strings, etc.) can be substitu...
[ "Substitute", "global", "python", "variables", "in", "a", "command", "string", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/util/substitute.py#L62-L206
train
casacore/python-casacore
casacore/tables/table.py
taql
def taql(command, style='Python', tables=[], globals={}, locals={}): """Execute a TaQL command and return a table object. A `TaQL <../../doc/199.html>`_ command is an SQL-like command to do a selection of rows and/or columns in a table. The default style used in a TaQL command is python, which mea...
python
def taql(command, style='Python', tables=[], globals={}, locals={}): """Execute a TaQL command and return a table object. A `TaQL <../../doc/199.html>`_ command is an SQL-like command to do a selection of rows and/or columns in a table. The default style used in a TaQL command is python, which mea...
[ "def", "taql", "(", "command", ",", "style", "=", "'Python'", ",", "tables", "=", "[", "]", ",", "globals", "=", "{", "}", ",", "locals", "=", "{", "}", ")", ":", "cmd", "=", "command", "tabs", "=", "[", "]", "for", "tab", "in", "tables", ":", ...
Execute a TaQL command and return a table object. A `TaQL <../../doc/199.html>`_ command is an SQL-like command to do a selection of rows and/or columns in a table. The default style used in a TaQL command is python, which means 0-based indexing, C-ordered arrays, and non-inclusive end in ranges. ...
[ "Execute", "a", "TaQL", "command", "and", "return", "a", "table", "object", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/tables/table.py#L104-L162
train
casacore/python-casacore
casacore/tables/table.py
table.iter
def iter(self, columnnames, order='', sort=True): """Return a tableiter object. :class:`tableiter` lets one iterate over a table by returning in each iteration step a reference table containing equal values for the given columns. By default a sort is done on the given columns to...
python
def iter(self, columnnames, order='', sort=True): """Return a tableiter object. :class:`tableiter` lets one iterate over a table by returning in each iteration step a reference table containing equal values for the given columns. By default a sort is done on the given columns to...
[ "def", "iter", "(", "self", ",", "columnnames", ",", "order", "=", "''", ",", "sort", "=", "True", ")", ":", "from", ".", "tableiter", "import", "tableiter", "return", "tableiter", "(", "self", ",", "columnnames", ",", "order", ",", "sort", ")" ]
Return a tableiter object. :class:`tableiter` lets one iterate over a table by returning in each iteration step a reference table containing equal values for the given columns. By default a sort is done on the given columns to get the correct iteration order. `order` ...
[ "Return", "a", "tableiter", "object", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/tables/table.py#L507-L530
train
casacore/python-casacore
casacore/tables/table.py
table.index
def index(self, columnnames, sort=True): """Return a tableindex object. :class:`tableindex` lets one get the row numbers of the rows holding given values for the columns for which the index is created. It uses an in-memory index on which a binary search is done. By default the t...
python
def index(self, columnnames, sort=True): """Return a tableindex object. :class:`tableindex` lets one get the row numbers of the rows holding given values for the columns for which the index is created. It uses an in-memory index on which a binary search is done. By default the t...
[ "def", "index", "(", "self", ",", "columnnames", ",", "sort", "=", "True", ")", ":", "from", ".", "tableindex", "import", "tableindex", "return", "tableindex", "(", "self", ",", "columnnames", ",", "sort", ")" ]
Return a tableindex object. :class:`tableindex` lets one get the row numbers of the rows holding given values for the columns for which the index is created. It uses an in-memory index on which a binary search is done. By default the table is sorted on the given columns to get the corre...
[ "Return", "a", "tableindex", "object", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/tables/table.py#L532-L549
train
casacore/python-casacore
casacore/tables/table.py
table.toascii
def toascii(self, asciifile, headerfile='', columnnames=(), sep=' ', precision=(), usebrackets=True): """Write the table in ASCII format. It is approximately the inverse of the from-ASCII-contructor. `asciifile` The name of the resulting ASCII file. `headerfil...
python
def toascii(self, asciifile, headerfile='', columnnames=(), sep=' ', precision=(), usebrackets=True): """Write the table in ASCII format. It is approximately the inverse of the from-ASCII-contructor. `asciifile` The name of the resulting ASCII file. `headerfil...
[ "def", "toascii", "(", "self", ",", "asciifile", ",", "headerfile", "=", "''", ",", "columnnames", "=", "(", ")", ",", "sep", "=", "' '", ",", "precision", "=", "(", ")", ",", "usebrackets", "=", "True", ")", ":", "msg", "=", "self", ".", "_toascii...
Write the table in ASCII format. It is approximately the inverse of the from-ASCII-contructor. `asciifile` The name of the resulting ASCII file. `headerfile` The name of an optional file containing the header info. If not given or if equal to argument `asciifile`,...
[ "Write", "the", "table", "in", "ASCII", "format", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/tables/table.py#L582-L627
train
casacore/python-casacore
casacore/tables/table.py
table.copy
def copy(self, newtablename, deep=False, valuecopy=False, dminfo={}, endian='aipsrc', memorytable=False, copynorows=False): """Copy the table and return a table object for the copy. It copies all data in the columns and keywords. Besides the table, all its subtables are copied too....
python
def copy(self, newtablename, deep=False, valuecopy=False, dminfo={}, endian='aipsrc', memorytable=False, copynorows=False): """Copy the table and return a table object for the copy. It copies all data in the columns and keywords. Besides the table, all its subtables are copied too....
[ "def", "copy", "(", "self", ",", "newtablename", ",", "deep", "=", "False", ",", "valuecopy", "=", "False", ",", "dminfo", "=", "{", "}", ",", "endian", "=", "'aipsrc'", ",", "memorytable", "=", "False", ",", "copynorows", "=", "False", ")", ":", "t"...
Copy the table and return a table object for the copy. It copies all data in the columns and keywords. Besides the table, all its subtables are copied too. By default a shallow copy is made (usually by copying files). It means that the copy of a reference table is also a reference table...
[ "Copy", "the", "table", "and", "return", "a", "table", "object", "for", "the", "copy", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/tables/table.py#L638-L679
train
casacore/python-casacore
casacore/tables/table.py
table.copyrows
def copyrows(self, outtable, startrowin=0, startrowout=-1, nrow=-1): """Copy the contents of rows from this table to outtable. The contents of the columns with matching names are copied. The other arguments can be used to specify where to start copying. By default the entire input table...
python
def copyrows(self, outtable, startrowin=0, startrowout=-1, nrow=-1): """Copy the contents of rows from this table to outtable. The contents of the columns with matching names are copied. The other arguments can be used to specify where to start copying. By default the entire input table...
[ "def", "copyrows", "(", "self", ",", "outtable", ",", "startrowin", "=", "0", ",", "startrowout", "=", "-", "1", ",", "nrow", "=", "-", "1", ")", ":", "self", ".", "_copyrows", "(", "outtable", ",", "startrowin", ",", "startrowout", ",", "nrow", ")" ...
Copy the contents of rows from this table to outtable. The contents of the columns with matching names are copied. The other arguments can be used to specify where to start copying. By default the entire input table is appended to the output table. Rows are added to the output table if ...
[ "Copy", "the", "contents", "of", "rows", "from", "this", "table", "to", "outtable", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/tables/table.py#L681-L705
train
casacore/python-casacore
casacore/tables/table.py
table.rownumbers
def rownumbers(self, table=None): """Return a list containing the row numbers of this table. This method can be useful after a selection or a sort. It returns the row numbers of the rows in this table with respect to the given table. If no table is given, the original table is used. ...
python
def rownumbers(self, table=None): """Return a list containing the row numbers of this table. This method can be useful after a selection or a sort. It returns the row numbers of the rows in this table with respect to the given table. If no table is given, the original table is used. ...
[ "def", "rownumbers", "(", "self", ",", "table", "=", "None", ")", ":", "if", "table", "is", "None", ":", "return", "self", ".", "_rownumbers", "(", "Table", "(", ")", ")", "return", "self", ".", "_rownumbers", "(", "table", ")" ]
Return a list containing the row numbers of this table. This method can be useful after a selection or a sort. It returns the row numbers of the rows in this table with respect to the given table. If no table is given, the original table is used. For example:: t = table('W53...
[ "Return", "a", "list", "containing", "the", "row", "numbers", "of", "this", "table", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/tables/table.py#L819-L847
train
casacore/python-casacore
casacore/tables/table.py
table.getcolshapestring
def getcolshapestring(self, columnname, startrow=0, nrow=-1, rowincr=1): """Get the shapes of all cells in the column in string format. It returns the shape in a string like [10,20,30]. If the column contains fixed shape arrays, a single shape is returned. Oth...
python
def getcolshapestring(self, columnname, startrow=0, nrow=-1, rowincr=1): """Get the shapes of all cells in the column in string format. It returns the shape in a string like [10,20,30]. If the column contains fixed shape arrays, a single shape is returned. Oth...
[ "def", "getcolshapestring", "(", "self", ",", "columnname", ",", "startrow", "=", "0", ",", "nrow", "=", "-", "1", ",", "rowincr", "=", "1", ")", ":", "return", "self", ".", "_getcolshapestring", "(", "columnname", ",", "startrow", ",", "nrow", ",", "r...
Get the shapes of all cells in the column in string format. It returns the shape in a string like [10,20,30]. If the column contains fixed shape arrays, a single shape is returned. Otherwise a list of shape strings is returned. The column can be sliced by giving a start row (default 0...
[ "Get", "the", "shapes", "of", "all", "cells", "in", "the", "column", "in", "string", "format", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/tables/table.py#L921-L936
train
casacore/python-casacore
casacore/tables/table.py
table.getcellnp
def getcellnp(self, columnname, rownr, nparray): """Get data from a column cell into the given numpy array . Get the contents of a cell containing an array into the given numpy array. The numpy array has to be C-contiguous with a shape matching the shape of the column cell. Data...
python
def getcellnp(self, columnname, rownr, nparray): """Get data from a column cell into the given numpy array . Get the contents of a cell containing an array into the given numpy array. The numpy array has to be C-contiguous with a shape matching the shape of the column cell. Data...
[ "def", "getcellnp", "(", "self", ",", "columnname", ",", "rownr", ",", "nparray", ")", ":", "if", "not", "nparray", ".", "flags", ".", "c_contiguous", "or", "nparray", ".", "size", "==", "0", ":", "raise", "ValueError", "(", "\"Argument 'nparray' has to be a...
Get data from a column cell into the given numpy array . Get the contents of a cell containing an array into the given numpy array. The numpy array has to be C-contiguous with a shape matching the shape of the column cell. Data type coercion will be done as needed.
[ "Get", "data", "from", "a", "column", "cell", "into", "the", "given", "numpy", "array", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/tables/table.py#L963-L975
train
casacore/python-casacore
casacore/tables/table.py
table.getcellslice
def getcellslice(self, columnname, rownr, blc, trc, inc=[]): """Get a slice from a column cell holding an array. The columnname and (0-relative) rownr indicate the table cell. The slice to get is defined by the blc, trc, and optional inc arguments (blc = bottom-left corner, trc=top-rig...
python
def getcellslice(self, columnname, rownr, blc, trc, inc=[]): """Get a slice from a column cell holding an array. The columnname and (0-relative) rownr indicate the table cell. The slice to get is defined by the blc, trc, and optional inc arguments (blc = bottom-left corner, trc=top-rig...
[ "def", "getcellslice", "(", "self", ",", "columnname", ",", "rownr", ",", "blc", ",", "trc", ",", "inc", "=", "[", "]", ")", ":", "return", "self", ".", "_getcellslice", "(", "columnname", ",", "rownr", ",", "blc", ",", "trc", ",", "inc", ")" ]
Get a slice from a column cell holding an array. The columnname and (0-relative) rownr indicate the table cell. The slice to get is defined by the blc, trc, and optional inc arguments (blc = bottom-left corner, trc=top-right corner, inc=stride). Not all axes have to be filled in for bl...
[ "Get", "a", "slice", "from", "a", "column", "cell", "holding", "an", "array", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/tables/table.py#L977-L990
train
casacore/python-casacore
casacore/tables/table.py
table.getcellslicenp
def getcellslicenp(self, columnname, nparray, rownr, blc, trc, inc=[]): """Get a slice from a column cell into the given numpy array. The columnname and (0-relative) rownr indicate the table cell. The numpy array has to be C-contiguous with a shape matching the shape of the slice. Data...
python
def getcellslicenp(self, columnname, nparray, rownr, blc, trc, inc=[]): """Get a slice from a column cell into the given numpy array. The columnname and (0-relative) rownr indicate the table cell. The numpy array has to be C-contiguous with a shape matching the shape of the slice. Data...
[ "def", "getcellslicenp", "(", "self", ",", "columnname", ",", "nparray", ",", "rownr", ",", "blc", ",", "trc", ",", "inc", "=", "[", "]", ")", ":", "if", "not", "nparray", ".", "flags", ".", "c_contiguous", "or", "nparray", ".", "size", "==", "0", ...
Get a slice from a column cell into the given numpy array. The columnname and (0-relative) rownr indicate the table cell. The numpy array has to be C-contiguous with a shape matching the shape of the slice. Data type coercion will be done as needed. The slice to get is defined by the ...
[ "Get", "a", "slice", "from", "a", "column", "cell", "into", "the", "given", "numpy", "array", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/tables/table.py#L992-L1011
train
casacore/python-casacore
casacore/tables/table.py
table.getcolnp
def getcolnp(self, columnname, nparray, startrow=0, nrow=-1, rowincr=1): """Get the contents of a column or part of it into the given numpy array. The numpy array has to be C-contiguous with a shape matching the shape of the column (part). Data type coercion will be done as needed. ...
python
def getcolnp(self, columnname, nparray, startrow=0, nrow=-1, rowincr=1): """Get the contents of a column or part of it into the given numpy array. The numpy array has to be C-contiguous with a shape matching the shape of the column (part). Data type coercion will be done as needed. ...
[ "def", "getcolnp", "(", "self", ",", "columnname", ",", "nparray", ",", "startrow", "=", "0", ",", "nrow", "=", "-", "1", ",", "rowincr", "=", "1", ")", ":", "if", "(", "not", "nparray", ".", "flags", ".", "c_contiguous", ")", "or", "nparray", ".",...
Get the contents of a column or part of it into the given numpy array. The numpy array has to be C-contiguous with a shape matching the shape of the column (part). Data type coercion will be done as needed. If the column contains arrays, they should all have the same shape. An ...
[ "Get", "the", "contents", "of", "a", "column", "or", "part", "of", "it", "into", "the", "given", "numpy", "array", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/tables/table.py#L1036-L1054
train
casacore/python-casacore
casacore/tables/table.py
table.getcolslice
def getcolslice(self, columnname, blc, trc, inc=[], startrow=0, nrow=-1, rowincr=1): """Get a slice from a table column holding arrays. The slice in each array is given by blc, trc, and inc (as in getcellslice). The column can be sliced by giving a start row (default...
python
def getcolslice(self, columnname, blc, trc, inc=[], startrow=0, nrow=-1, rowincr=1): """Get a slice from a table column holding arrays. The slice in each array is given by blc, trc, and inc (as in getcellslice). The column can be sliced by giving a start row (default...
[ "def", "getcolslice", "(", "self", ",", "columnname", ",", "blc", ",", "trc", ",", "inc", "=", "[", "]", ",", "startrow", "=", "0", ",", "nrow", "=", "-", "1", ",", "rowincr", "=", "1", ")", ":", "return", "self", ".", "_getcolslice", "(", "colum...
Get a slice from a table column holding arrays. The slice in each array is given by blc, trc, and inc (as in getcellslice). The column can be sliced by giving a start row (default 0), number of rows (default all), and row stride (default 1). It returns a numpy array where the f...
[ "Get", "a", "slice", "from", "a", "table", "column", "holding", "arrays", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/tables/table.py#L1066-L1080
train
casacore/python-casacore
casacore/tables/table.py
table.getcolslicenp
def getcolslicenp(self, columnname, nparray, blc, trc, inc=[], startrow=0, nrow=-1, rowincr=1): """Get a slice from a table column into the given numpy array. The numpy array has to be C-contiguous with a shape matching the shape of the column (slice). Data type coercion w...
python
def getcolslicenp(self, columnname, nparray, blc, trc, inc=[], startrow=0, nrow=-1, rowincr=1): """Get a slice from a table column into the given numpy array. The numpy array has to be C-contiguous with a shape matching the shape of the column (slice). Data type coercion w...
[ "def", "getcolslicenp", "(", "self", ",", "columnname", ",", "nparray", ",", "blc", ",", "trc", ",", "inc", "=", "[", "]", ",", "startrow", "=", "0", ",", "nrow", "=", "-", "1", ",", "rowincr", "=", "1", ")", ":", "if", "not", "nparray", ".", "...
Get a slice from a table column into the given numpy array. The numpy array has to be C-contiguous with a shape matching the shape of the column (slice). Data type coercion will be done as needed. The slice in each array is given by blc, trc, and inc (as in getcellslice). The c...
[ "Get", "a", "slice", "from", "a", "table", "column", "into", "the", "given", "numpy", "array", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/tables/table.py#L1082-L1102
train
casacore/python-casacore
casacore/tables/table.py
table.putcell
def putcell(self, columnname, rownr, value): """Put a value into one or more table cells. The columnname and (0-relative) rownrs indicate the table cells. rownr can be a single row number or a sequence of row numbers. If multiple rownrs are given, the given value is put in all those ro...
python
def putcell(self, columnname, rownr, value): """Put a value into one or more table cells. The columnname and (0-relative) rownrs indicate the table cells. rownr can be a single row number or a sequence of row numbers. If multiple rownrs are given, the given value is put in all those ro...
[ "def", "putcell", "(", "self", ",", "columnname", ",", "rownr", ",", "value", ")", ":", "self", ".", "_putcell", "(", "columnname", ",", "rownr", ",", "value", ")" ]
Put a value into one or more table cells. The columnname and (0-relative) rownrs indicate the table cells. rownr can be a single row number or a sequence of row numbers. If multiple rownrs are given, the given value is put in all those rows. The given value has to be convertible to th...
[ "Put", "a", "value", "into", "one", "or", "more", "table", "cells", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/tables/table.py#L1104-L1124
train
casacore/python-casacore
casacore/tables/table.py
table.putcellslice
def putcellslice(self, columnname, rownr, value, blc, trc, inc=[]): """Put into a slice of a table cell holding an array. The columnname and (0-relative) rownr indicate the table cell. Unlike putcell only a single row can be given. The slice to put is defined by the blc, trc, and optio...
python
def putcellslice(self, columnname, rownr, value, blc, trc, inc=[]): """Put into a slice of a table cell holding an array. The columnname and (0-relative) rownr indicate the table cell. Unlike putcell only a single row can be given. The slice to put is defined by the blc, trc, and optio...
[ "def", "putcellslice", "(", "self", ",", "columnname", ",", "rownr", ",", "value", ",", "blc", ",", "trc", ",", "inc", "=", "[", "]", ")", ":", "self", ".", "_putcellslice", "(", "columnname", ",", "rownr", ",", "value", ",", "blc", ",", "trc", ","...
Put into a slice of a table cell holding an array. The columnname and (0-relative) rownr indicate the table cell. Unlike putcell only a single row can be given. The slice to put is defined by the blc, trc, and optional inc arguments (blc = bottom-left corner, trc=top-right corner, inc=...
[ "Put", "into", "a", "slice", "of", "a", "table", "cell", "holding", "an", "array", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/tables/table.py#L1126-L1144
train
casacore/python-casacore
casacore/tables/table.py
table.putcolslice
def putcolslice(self, columnname, value, blc, trc, inc=[], startrow=0, nrow=-1, rowincr=1): """Put into a slice in a table column holding arrays. Its arguments are the same as for getcolslice and putcellslice. """ self._putcolslice(columnname, value, blc, trc, inc, ...
python
def putcolslice(self, columnname, value, blc, trc, inc=[], startrow=0, nrow=-1, rowincr=1): """Put into a slice in a table column holding arrays. Its arguments are the same as for getcolslice and putcellslice. """ self._putcolslice(columnname, value, blc, trc, inc, ...
[ "def", "putcolslice", "(", "self", ",", "columnname", ",", "value", ",", "blc", ",", "trc", ",", "inc", "=", "[", "]", ",", "startrow", "=", "0", ",", "nrow", "=", "-", "1", ",", "rowincr", "=", "1", ")", ":", "self", ".", "_putcolslice", "(", ...
Put into a slice in a table column holding arrays. Its arguments are the same as for getcolslice and putcellslice.
[ "Put", "into", "a", "slice", "in", "a", "table", "column", "holding", "arrays", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/tables/table.py#L1171-L1179
train
casacore/python-casacore
casacore/tables/table.py
table.addcols
def addcols(self, desc, dminfo={}, addtoparent=True): """Add one or more columns. Columns can always be added to a normal table. They can also be added to a reference table and optionally to its parent table. `desc` contains a description of the column(s) to be added....
python
def addcols(self, desc, dminfo={}, addtoparent=True): """Add one or more columns. Columns can always be added to a normal table. They can also be added to a reference table and optionally to its parent table. `desc` contains a description of the column(s) to be added....
[ "def", "addcols", "(", "self", ",", "desc", ",", "dminfo", "=", "{", "}", ",", "addtoparent", "=", "True", ")", ":", "tdesc", "=", "desc", "if", "'name'", "in", "desc", ":", "import", "casacore", ".", "tables", ".", "tableutil", "as", "pt", "if", "...
Add one or more columns. Columns can always be added to a normal table. They can also be added to a reference table and optionally to its parent table. `desc` contains a description of the column(s) to be added. It can be given in three ways: - a dict cre...
[ "Add", "one", "or", "more", "columns", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/tables/table.py#L1181-L1229
train
casacore/python-casacore
casacore/tables/table.py
table.renamecol
def renamecol(self, oldname, newname): """Rename a single table column. Renaming a column in a reference table does NOT rename the column in the referenced table. """ self._renamecol(oldname, newname) self._makerow()
python
def renamecol(self, oldname, newname): """Rename a single table column. Renaming a column in a reference table does NOT rename the column in the referenced table. """ self._renamecol(oldname, newname) self._makerow()
[ "def", "renamecol", "(", "self", ",", "oldname", ",", "newname", ")", ":", "self", ".", "_renamecol", "(", "oldname", ",", "newname", ")", "self", ".", "_makerow", "(", ")" ]
Rename a single table column. Renaming a column in a reference table does NOT rename the column in the referenced table.
[ "Rename", "a", "single", "table", "column", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/tables/table.py#L1231-L1239
train
casacore/python-casacore
casacore/tables/table.py
table.fieldnames
def fieldnames(self, keyword=''): """Get the names of the fields in a table keyword value. The value of a keyword can be a struct (python dict). This method returns the names of the fields in that struct. Each field in a struct can be a struct in itself. Names of fields in a sub...
python
def fieldnames(self, keyword=''): """Get the names of the fields in a table keyword value. The value of a keyword can be a struct (python dict). This method returns the names of the fields in that struct. Each field in a struct can be a struct in itself. Names of fields in a sub...
[ "def", "fieldnames", "(", "self", ",", "keyword", "=", "''", ")", ":", "if", "isinstance", "(", "keyword", ",", "str", ")", ":", "return", "self", ".", "_getfieldnames", "(", "''", ",", "keyword", ",", "-", "1", ")", "else", ":", "return", "self", ...
Get the names of the fields in a table keyword value. The value of a keyword can be a struct (python dict). This method returns the names of the fields in that struct. Each field in a struct can be a struct in itself. Names of fields in a sub-struct can be obtained by giving a keyword n...
[ "Get", "the", "names", "of", "the", "fields", "in", "a", "table", "keyword", "value", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/tables/table.py#L1263-L1283
train
casacore/python-casacore
casacore/tables/table.py
table.colfieldnames
def colfieldnames(self, columnname, keyword=''): """Get the names of the fields in a column keyword value. The value of a keyword can be a struct (python dict). This method returns the names of the fields in that struct. Each field in a struct can be a struct in itself. Names of fields ...
python
def colfieldnames(self, columnname, keyword=''): """Get the names of the fields in a column keyword value. The value of a keyword can be a struct (python dict). This method returns the names of the fields in that struct. Each field in a struct can be a struct in itself. Names of fields ...
[ "def", "colfieldnames", "(", "self", ",", "columnname", ",", "keyword", "=", "''", ")", ":", "if", "isinstance", "(", "keyword", ",", "str", ")", ":", "return", "self", ".", "_getfieldnames", "(", "columnname", ",", "keyword", ",", "-", "1", ")", "else...
Get the names of the fields in a column keyword value. The value of a keyword can be a struct (python dict). This method returns the names of the fields in that struct. Each field in a struct can be a struct in itself. Names of fields in a sub-struct can be obtained by giving a keyword ...
[ "Get", "the", "names", "of", "the", "fields", "in", "a", "column", "keyword", "value", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/tables/table.py#L1285-L1305
train
casacore/python-casacore
casacore/tables/table.py
table.getkeyword
def getkeyword(self, keyword): """Get the value of a table keyword. The value of a keyword can be a: - scalar which is returned as a normal python scalar. - an array which is returned as a numpy array. - a reference to a table which is returned as a string containing its ...
python
def getkeyword(self, keyword): """Get the value of a table keyword. The value of a keyword can be a: - scalar which is returned as a normal python scalar. - an array which is returned as a numpy array. - a reference to a table which is returned as a string containing its ...
[ "def", "getkeyword", "(", "self", ",", "keyword", ")", ":", "if", "isinstance", "(", "keyword", ",", "str", ")", ":", "return", "self", ".", "_getkeyword", "(", "''", ",", "keyword", ",", "-", "1", ")", "else", ":", "return", "self", ".", "_getkeywor...
Get the value of a table keyword. The value of a keyword can be a: - scalar which is returned as a normal python scalar. - an array which is returned as a numpy array. - a reference to a table which is returned as a string containing its name prefixed by 'Table :'. It can be ...
[ "Get", "the", "value", "of", "a", "table", "keyword", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/tables/table.py#L1307-L1333
train
casacore/python-casacore
casacore/tables/table.py
table.getcolkeyword
def getcolkeyword(self, columnname, keyword): """Get the value of a column keyword. It is similar to :func:`getkeyword`. """ if isinstance(keyword, str): return self._getkeyword(columnname, keyword, -1) else: return self._getkeyword(columnname, '', keywo...
python
def getcolkeyword(self, columnname, keyword): """Get the value of a column keyword. It is similar to :func:`getkeyword`. """ if isinstance(keyword, str): return self._getkeyword(columnname, keyword, -1) else: return self._getkeyword(columnname, '', keywo...
[ "def", "getcolkeyword", "(", "self", ",", "columnname", ",", "keyword", ")", ":", "if", "isinstance", "(", "keyword", ",", "str", ")", ":", "return", "self", ".", "_getkeyword", "(", "columnname", ",", "keyword", ",", "-", "1", ")", "else", ":", "retur...
Get the value of a column keyword. It is similar to :func:`getkeyword`.
[ "Get", "the", "value", "of", "a", "column", "keyword", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/tables/table.py#L1335-L1344
train
casacore/python-casacore
casacore/tables/table.py
table.getsubtables
def getsubtables(self): """Get the names of all subtables.""" keyset = self.getkeywords() names = [] for key, value in keyset.items(): if isinstance(value, str) and value.find('Table: ') == 0: names.append(_do_remove_prefix(value)) return names
python
def getsubtables(self): """Get the names of all subtables.""" keyset = self.getkeywords() names = [] for key, value in keyset.items(): if isinstance(value, str) and value.find('Table: ') == 0: names.append(_do_remove_prefix(value)) return names
[ "def", "getsubtables", "(", "self", ")", ":", "keyset", "=", "self", ".", "getkeywords", "(", ")", "names", "=", "[", "]", "for", "key", ",", "value", "in", "keyset", ".", "items", "(", ")", ":", "if", "isinstance", "(", "value", ",", "str", ")", ...
Get the names of all subtables.
[ "Get", "the", "names", "of", "all", "subtables", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/tables/table.py#L1364-L1371
train
casacore/python-casacore
casacore/tables/table.py
table.putkeyword
def putkeyword(self, keyword, value, makesubrecord=False): """Put the value of a table keyword. The value of a keyword can be a: - scalar which can be given a normal python scalar or numpy scalar. - an array which can be given as a numpy array. A 1-dimensional array can also ...
python
def putkeyword(self, keyword, value, makesubrecord=False): """Put the value of a table keyword. The value of a keyword can be a: - scalar which can be given a normal python scalar or numpy scalar. - an array which can be given as a numpy array. A 1-dimensional array can also ...
[ "def", "putkeyword", "(", "self", ",", "keyword", ",", "value", ",", "makesubrecord", "=", "False", ")", ":", "val", "=", "value", "if", "isinstance", "(", "val", ",", "table", ")", ":", "val", "=", "_add_prefix", "(", "val", ".", "name", "(", ")", ...
Put the value of a table keyword. The value of a keyword can be a: - scalar which can be given a normal python scalar or numpy scalar. - an array which can be given as a numpy array. A 1-dimensional array can also be given as a sequence (tuple or list). - a reference to a tab...
[ "Put", "the", "value", "of", "a", "table", "keyword", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/tables/table.py#L1373-L1408
train
casacore/python-casacore
casacore/tables/table.py
table.removekeyword
def removekeyword(self, keyword): """Remove a table keyword. Similar to :func:`getkeyword` the name can consist of multiple parts. In that case a field in a struct will be removed. Instead of a keyword name an index can be given which removes the i-th keyword. """ ...
python
def removekeyword(self, keyword): """Remove a table keyword. Similar to :func:`getkeyword` the name can consist of multiple parts. In that case a field in a struct will be removed. Instead of a keyword name an index can be given which removes the i-th keyword. """ ...
[ "def", "removekeyword", "(", "self", ",", "keyword", ")", ":", "if", "isinstance", "(", "keyword", ",", "str", ")", ":", "self", ".", "_removekeyword", "(", "''", ",", "keyword", ",", "-", "1", ")", "else", ":", "self", ".", "_removekeyword", "(", "'...
Remove a table keyword. Similar to :func:`getkeyword` the name can consist of multiple parts. In that case a field in a struct will be removed. Instead of a keyword name an index can be given which removes the i-th keyword.
[ "Remove", "a", "table", "keyword", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/tables/table.py#L1444-L1457
train
casacore/python-casacore
casacore/tables/table.py
table.removecolkeyword
def removecolkeyword(self, columnname, keyword): """Remove a column keyword. It is similar to :func:`removekeyword`. """ if isinstance(keyword, str): self._removekeyword(columnname, keyword, -1) else: self._removekeyword(columnname, '', keyword)
python
def removecolkeyword(self, columnname, keyword): """Remove a column keyword. It is similar to :func:`removekeyword`. """ if isinstance(keyword, str): self._removekeyword(columnname, keyword, -1) else: self._removekeyword(columnname, '', keyword)
[ "def", "removecolkeyword", "(", "self", ",", "columnname", ",", "keyword", ")", ":", "if", "isinstance", "(", "keyword", ",", "str", ")", ":", "self", ".", "_removekeyword", "(", "columnname", ",", "keyword", ",", "-", "1", ")", "else", ":", "self", "....
Remove a column keyword. It is similar to :func:`removekeyword`.
[ "Remove", "a", "column", "keyword", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/tables/table.py#L1459-L1468
train
casacore/python-casacore
casacore/tables/table.py
table.getdesc
def getdesc(self, actual=True): """Get the table description. By default it returns the actual description (thus telling the actual array shapes and data managers used). `actual=False` means that the original description as made by :func:`maketabdesc` is returned. """ ...
python
def getdesc(self, actual=True): """Get the table description. By default it returns the actual description (thus telling the actual array shapes and data managers used). `actual=False` means that the original description as made by :func:`maketabdesc` is returned. """ ...
[ "def", "getdesc", "(", "self", ",", "actual", "=", "True", ")", ":", "tabledesc", "=", "self", ".", "_getdesc", "(", "actual", ",", "True", ")", "hcdefs", "=", "tabledesc", ".", "get", "(", "'_define_hypercolumn_'", ",", "{", "}", ")", "for", "c", ",...
Get the table description. By default it returns the actual description (thus telling the actual array shapes and data managers used). `actual=False` means that the original description as made by :func:`maketabdesc` is returned.
[ "Get", "the", "table", "description", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/tables/table.py#L1470-L1491
train
casacore/python-casacore
casacore/tables/table.py
table.getcoldesc
def getcoldesc(self, columnname, actual=True): """Get the description of a column. By default it returns the actual description (thus telling the actual array shapes and data managers used). `actual=False` means that the original description as made by :func:`makescacoldesc` or ...
python
def getcoldesc(self, columnname, actual=True): """Get the description of a column. By default it returns the actual description (thus telling the actual array shapes and data managers used). `actual=False` means that the original description as made by :func:`makescacoldesc` or ...
[ "def", "getcoldesc", "(", "self", ",", "columnname", ",", "actual", "=", "True", ")", ":", "return", "self", ".", "_getcoldesc", "(", "columnname", ",", "actual", ",", "True", ")" ]
Get the description of a column. By default it returns the actual description (thus telling the actual array shapes and data managers used). `actual=False` means that the original description as made by :func:`makescacoldesc` or :func:`makearrcoldesc` is returned.
[ "Get", "the", "description", "of", "a", "column", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/tables/table.py#L1493-L1502
train
casacore/python-casacore
casacore/tables/table.py
table.coldesc
def coldesc(self, columnname, actual=True): """Make the description of a column. Make the description object of the given column as :func:`makecoldesc` is doing with the description given by :func:`getcoldesc`. """ import casacore.tables.tableutil as pt return p...
python
def coldesc(self, columnname, actual=True): """Make the description of a column. Make the description object of the given column as :func:`makecoldesc` is doing with the description given by :func:`getcoldesc`. """ import casacore.tables.tableutil as pt return p...
[ "def", "coldesc", "(", "self", ",", "columnname", ",", "actual", "=", "True", ")", ":", "import", "casacore", ".", "tables", ".", "tableutil", "as", "pt", "return", "pt", ".", "makecoldesc", "(", "columnname", ",", "self", ".", "getcoldesc", "(", "column...
Make the description of a column. Make the description object of the given column as :func:`makecoldesc` is doing with the description given by :func:`getcoldesc`.
[ "Make", "the", "description", "of", "a", "column", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/tables/table.py#L1504-L1513
train
casacore/python-casacore
casacore/tables/table.py
table.getdminfo
def getdminfo(self, columnname=None): """Get data manager info. Each column in a table is stored using a data manager. A storage manager is a data manager storing the physically in a file. A virtual column engine is a data manager that does not store data but calculates it on th...
python
def getdminfo(self, columnname=None): """Get data manager info. Each column in a table is stored using a data manager. A storage manager is a data manager storing the physically in a file. A virtual column engine is a data manager that does not store data but calculates it on th...
[ "def", "getdminfo", "(", "self", ",", "columnname", "=", "None", ")", ":", "dminfo", "=", "self", ".", "_getdminfo", "(", ")", "if", "columnname", "is", "None", ":", "return", "dminfo", "for", "fld", "in", "dminfo", ".", "values", "(", ")", ":", "if"...
Get data manager info. Each column in a table is stored using a data manager. A storage manager is a data manager storing the physically in a file. A virtual column engine is a data manager that does not store data but calculates it on the fly (e.g. scaling floats to short to re...
[ "Get", "data", "manager", "info", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/tables/table.py#L1515-L1551
train
casacore/python-casacore
casacore/tables/table.py
table.setdmprop
def setdmprop(self, name, properties, bycolumn=True): """Set properties of a data manager. Properties (e.g. cachesize) of a data manager can be changed by defining them appropriately in the properties argument (a dict). Current values can be obtained using function :func:`getdmprop` whi...
python
def setdmprop(self, name, properties, bycolumn=True): """Set properties of a data manager. Properties (e.g. cachesize) of a data manager can be changed by defining them appropriately in the properties argument (a dict). Current values can be obtained using function :func:`getdmprop` whi...
[ "def", "setdmprop", "(", "self", ",", "name", ",", "properties", ",", "bycolumn", "=", "True", ")", ":", "return", "self", ".", "_setdmprop", "(", "name", ",", "properties", ",", "bycolumn", ")" ]
Set properties of a data manager. Properties (e.g. cachesize) of a data manager can be changed by defining them appropriately in the properties argument (a dict). Current values can be obtained using function :func:`getdmprop` which also serves as a template. The dict can contain more f...
[ "Set", "properties", "of", "a", "data", "manager", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/tables/table.py#L1575-L1589
train
casacore/python-casacore
casacore/tables/table.py
table.showstructure
def showstructure(self, dataman=True, column=True, subtable=False, sort=False): """Show table structure in a formatted string. The structure of this table and optionally its subtables is shown. It shows the data manager info and column descriptions. Optionally the ...
python
def showstructure(self, dataman=True, column=True, subtable=False, sort=False): """Show table structure in a formatted string. The structure of this table and optionally its subtables is shown. It shows the data manager info and column descriptions. Optionally the ...
[ "def", "showstructure", "(", "self", ",", "dataman", "=", "True", ",", "column", "=", "True", ",", "subtable", "=", "False", ",", "sort", "=", "False", ")", ":", "return", "self", ".", "_showstructure", "(", "dataman", ",", "column", ",", "subtable", "...
Show table structure in a formatted string. The structure of this table and optionally its subtables is shown. It shows the data manager info and column descriptions. Optionally the columns are sorted in alphabetical order. `dataman` Show data manager info? If False, only col...
[ "Show", "table", "structure", "in", "a", "formatted", "string", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/tables/table.py#L1591-L1612
train
casacore/python-casacore
casacore/tables/table.py
table.summary
def summary(self, recurse=False): """Print a summary of the table. It prints the number of columns and rows, column names, and table and column keywords. If `recurse=True` it also prints the summary of all subtables, i.e. tables referenced by table keywords. """ ...
python
def summary(self, recurse=False): """Print a summary of the table. It prints the number of columns and rows, column names, and table and column keywords. If `recurse=True` it also prints the summary of all subtables, i.e. tables referenced by table keywords. """ ...
[ "def", "summary", "(", "self", ",", "recurse", "=", "False", ")", ":", "six", ".", "print_", "(", "'Table summary:'", ",", "self", ".", "name", "(", ")", ")", "six", ".", "print_", "(", "'Shape:'", ",", "self", ".", "ncols", "(", ")", ",", "'column...
Print a summary of the table. It prints the number of columns and rows, column names, and table and column keywords. If `recurse=True` it also prints the summary of all subtables, i.e. tables referenced by table keywords.
[ "Print", "a", "summary", "of", "the", "table", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/tables/table.py#L1614-L1643
train
casacore/python-casacore
casacore/tables/table.py
table.selectrows
def selectrows(self, rownrs): """Return a reference table containing the given rows.""" t = self._selectrows(rownrs, name='') # selectrows returns a Table object, so turn that into table. return table(t, _oper=3)
python
def selectrows(self, rownrs): """Return a reference table containing the given rows.""" t = self._selectrows(rownrs, name='') # selectrows returns a Table object, so turn that into table. return table(t, _oper=3)
[ "def", "selectrows", "(", "self", ",", "rownrs", ")", ":", "t", "=", "self", ".", "_selectrows", "(", "rownrs", ",", "name", "=", "''", ")", "return", "table", "(", "t", ",", "_oper", "=", "3", ")" ]
Return a reference table containing the given rows.
[ "Return", "a", "reference", "table", "containing", "the", "given", "rows", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/tables/table.py#L1645-L1649
train
casacore/python-casacore
casacore/tables/table.py
table.query
def query(self, query='', name='', sortlist='', columns='', limit=0, offset=0, style='Python'): """Query the table and return the result as a reference table. This method queries the table. It forms a `TaQL <../../doc/199.html>`_ command from the given arguments and execut...
python
def query(self, query='', name='', sortlist='', columns='', limit=0, offset=0, style='Python'): """Query the table and return the result as a reference table. This method queries the table. It forms a `TaQL <../../doc/199.html>`_ command from the given arguments and execut...
[ "def", "query", "(", "self", ",", "query", "=", "''", ",", "name", "=", "''", ",", "sortlist", "=", "''", ",", "columns", "=", "''", ",", "limit", "=", "0", ",", "offset", "=", "0", ",", "style", "=", "'Python'", ")", ":", "if", "not", "query",...
Query the table and return the result as a reference table. This method queries the table. It forms a `TaQL <../../doc/199.html>`_ command from the given arguments and executes it using the :func:`taql` function. The result is returned in a so-called reference table which ...
[ "Query", "the", "table", "and", "return", "the", "result", "as", "a", "reference", "table", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/tables/table.py#L1651-L1709
train
casacore/python-casacore
casacore/tables/table.py
table.sort
def sort(self, sortlist, name='', limit=0, offset=0, style='Python'): """Sort the table and return the result as a reference table. This method sorts the table. It forms a `TaQL <../../doc/199.html>`_ command from the given arguments and executes it using the :func:...
python
def sort(self, sortlist, name='', limit=0, offset=0, style='Python'): """Sort the table and return the result as a reference table. This method sorts the table. It forms a `TaQL <../../doc/199.html>`_ command from the given arguments and executes it using the :func:...
[ "def", "sort", "(", "self", ",", "sortlist", ",", "name", "=", "''", ",", "limit", "=", "0", ",", "offset", "=", "0", ",", "style", "=", "'Python'", ")", ":", "command", "=", "'select from $1 orderby '", "+", "sortlist", "if", "limit", ">", "0", ":",...
Sort the table and return the result as a reference table. This method sorts the table. It forms a `TaQL <../../doc/199.html>`_ command from the given arguments and executes it using the :func:`taql` function. The result is returned in a so-called reference table which reference...
[ "Sort", "the", "table", "and", "return", "the", "result", "as", "a", "reference", "table", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/tables/table.py#L1711-L1747
train
casacore/python-casacore
casacore/tables/table.py
table.select
def select(self, columns, name='', style='Python'): """Select columns and return the result as a reference table. This method represents the SELECT part of a TaQL command using the given columns (or column expressions). It forms a `TaQL <../../doc/199.html>`_ command from the gi...
python
def select(self, columns, name='', style='Python'): """Select columns and return the result as a reference table. This method represents the SELECT part of a TaQL command using the given columns (or column expressions). It forms a `TaQL <../../doc/199.html>`_ command from the gi...
[ "def", "select", "(", "self", ",", "columns", ",", "name", "=", "''", ",", "style", "=", "'Python'", ")", ":", "command", "=", "'select '", "+", "columns", "+", "' from $1'", "if", "name", ":", "command", "+=", "' giving '", "+", "name", "return", "tab...
Select columns and return the result as a reference table. This method represents the SELECT part of a TaQL command using the given columns (or column expressions). It forms a `TaQL <../../doc/199.html>`_ command from the given arguments and executes it using the :func:`taql` fu...
[ "Select", "columns", "and", "return", "the", "result", "as", "a", "reference", "table", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/tables/table.py#L1749-L1776
train
casacore/python-casacore
casacore/tables/table.py
table.browse
def browse(self, wait=True, tempname="/tmp/seltable"): """ Browse a table using casabrowser or a simple wxwidget based browser. By default the casabrowser is used if it can be found (in your PATH). Otherwise the wxwidget one is used if wx can be loaded. The casabrowser can only...
python
def browse(self, wait=True, tempname="/tmp/seltable"): """ Browse a table using casabrowser or a simple wxwidget based browser. By default the casabrowser is used if it can be found (in your PATH). Otherwise the wxwidget one is used if wx can be loaded. The casabrowser can only...
[ "def", "browse", "(", "self", ",", "wait", "=", "True", ",", "tempname", "=", "\"/tmp/seltable\"", ")", ":", "import", "os", "if", "os", ".", "system", "(", "'test `which casabrowser`x != x'", ")", "==", "0", ":", "waitstr1", "=", "\"\"", "waitstr2", "=", ...
Browse a table using casabrowser or a simple wxwidget based browser. By default the casabrowser is used if it can be found (in your PATH). Otherwise the wxwidget one is used if wx can be loaded. The casabrowser can only browse tables that are persistent on disk. This gives prob...
[ "Browse", "a", "table", "using", "casabrowser", "or", "a", "simple", "wxwidget", "based", "browser", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/tables/table.py#L1797-L1871
train
casacore/python-casacore
casacore/tables/table.py
table.view
def view(self, wait=True, tempname="/tmp/seltable"): """ View a table using casaviewer, casabrowser, or wxwidget based browser. The table is viewed depending on the type: MeasurementSet is viewed using casaviewer. Image is viewed using casaviewer. ot...
python
def view(self, wait=True, tempname="/tmp/seltable"): """ View a table using casaviewer, casabrowser, or wxwidget based browser. The table is viewed depending on the type: MeasurementSet is viewed using casaviewer. Image is viewed using casaviewer. ot...
[ "def", "view", "(", "self", ",", "wait", "=", "True", ",", "tempname", "=", "\"/tmp/seltable\"", ")", ":", "import", "os", "viewed", "=", "False", "type", "=", "self", ".", "info", "(", ")", "[", "\"type\"", "]", "if", "type", "==", "\"Measurement Set\...
View a table using casaviewer, casabrowser, or wxwidget based browser. The table is viewed depending on the type: MeasurementSet is viewed using casaviewer. Image is viewed using casaviewer. other are browsed using the :func:`browse` function. ...
[ "View", "a", "table", "using", "casaviewer", "casabrowser", "or", "wxwidget", "based", "browser", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/tables/table.py#L1873-L1950
train
casacore/python-casacore
casacore/tables/table.py
table._repr_html_
def _repr_html_(self): """Give a nice representation of tables in notebooks.""" out = "<table class='taqltable' style='overflow-x:auto'>\n" # Print column names (not if they are all auto-generated) if not(all([colname[:4] == "Col_" for colname in self.colnames()])): out += "...
python
def _repr_html_(self): """Give a nice representation of tables in notebooks.""" out = "<table class='taqltable' style='overflow-x:auto'>\n" # Print column names (not if they are all auto-generated) if not(all([colname[:4] == "Col_" for colname in self.colnames()])): out += "...
[ "def", "_repr_html_", "(", "self", ")", ":", "out", "=", "\"<table class='taqltable' style='overflow-x:auto'>\\n\"", "if", "not", "(", "all", "(", "[", "colname", "[", ":", "4", "]", "==", "\"Col_\"", "for", "colname", "in", "self", ".", "colnames", "(", ")"...
Give a nice representation of tables in notebooks.
[ "Give", "a", "nice", "representation", "of", "tables", "in", "notebooks", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/tables/table.py#L1952-L1985
train
Kronuz/pyScss
scss/extension/core.py
nth
def nth(lst, n): """Return the nth item in the list.""" expect_type(n, (String, Number), unit=None) if isinstance(n, String): if n.value.lower() == 'first': i = 0 elif n.value.lower() == 'last': i = -1 else: raise ValueError("Invalid index %r" % (...
python
def nth(lst, n): """Return the nth item in the list.""" expect_type(n, (String, Number), unit=None) if isinstance(n, String): if n.value.lower() == 'first': i = 0 elif n.value.lower() == 'last': i = -1 else: raise ValueError("Invalid index %r" % (...
[ "def", "nth", "(", "lst", ",", "n", ")", ":", "expect_type", "(", "n", ",", "(", "String", ",", "Number", ")", ",", "unit", "=", "None", ")", "if", "isinstance", "(", "n", ",", "String", ")", ":", "if", "n", ".", "value", ".", "lower", "(", "...
Return the nth item in the list.
[ "Return", "the", "nth", "item", "in", "the", "list", "." ]
fb32b317f6e2b4b4aad2b86a74844658ac4aa11e
https://github.com/Kronuz/pyScss/blob/fb32b317f6e2b4b4aad2b86a74844658ac4aa11e/scss/extension/core.py#L657-L672
train
Kronuz/pyScss
scss/extension/core.py
CoreExtension.handle_import
def handle_import(self, name, compilation, rule): """Implementation of the core Sass import mechanism, which just looks for files on disk. """ # TODO this is all not terribly well-specified by Sass. at worst, # it's unclear how far "upwards" we should be allowed to go. but i'm ...
python
def handle_import(self, name, compilation, rule): """Implementation of the core Sass import mechanism, which just looks for files on disk. """ # TODO this is all not terribly well-specified by Sass. at worst, # it's unclear how far "upwards" we should be allowed to go. but i'm ...
[ "def", "handle_import", "(", "self", ",", "name", ",", "compilation", ",", "rule", ")", ":", "path", "=", "PurePosixPath", "(", "name", ")", "search_exts", "=", "list", "(", "compilation", ".", "compiler", ".", "dynamic_extensions", ")", "if", "path", ".",...
Implementation of the core Sass import mechanism, which just looks for files on disk.
[ "Implementation", "of", "the", "core", "Sass", "import", "mechanism", "which", "just", "looks", "for", "files", "on", "disk", "." ]
fb32b317f6e2b4b4aad2b86a74844658ac4aa11e
https://github.com/Kronuz/pyScss/blob/fb32b317f6e2b4b4aad2b86a74844658ac4aa11e/scss/extension/core.py#L25-L80
train
Kronuz/pyScss
yapps2.py
print_error
def print_error(input, err, scanner): """This is a really dumb long function to print error messages nicely.""" p = err.pos # Figure out the line number line = input[:p].count('\n') print err.msg + " on line " + repr(line + 1) + ":" # Now try printing part of the line text = input[max(p - 80...
python
def print_error(input, err, scanner): """This is a really dumb long function to print error messages nicely.""" p = err.pos # Figure out the line number line = input[:p].count('\n') print err.msg + " on line " + repr(line + 1) + ":" # Now try printing part of the line text = input[max(p - 80...
[ "def", "print_error", "(", "input", ",", "err", ",", "scanner", ")", ":", "p", "=", "err", ".", "pos", "line", "=", "input", "[", ":", "p", "]", ".", "count", "(", "'\\n'", ")", "print", "err", ".", "msg", "+", "\" on line \"", "+", "repr", "(", ...
This is a really dumb long function to print error messages nicely.
[ "This", "is", "a", "really", "dumb", "long", "function", "to", "print", "error", "messages", "nicely", "." ]
fb32b317f6e2b4b4aad2b86a74844658ac4aa11e
https://github.com/Kronuz/pyScss/blob/fb32b317f6e2b4b4aad2b86a74844658ac4aa11e/yapps2.py#L892-L929
train
Kronuz/pyScss
yapps2.py
Generator.equal_set
def equal_set(self, a, b): "See if a and b have the same elements" if len(a) != len(b): return 0 if a == b: return 1 return self.subset(a, b) and self.subset(b, a)
python
def equal_set(self, a, b): "See if a and b have the same elements" if len(a) != len(b): return 0 if a == b: return 1 return self.subset(a, b) and self.subset(b, a)
[ "def", "equal_set", "(", "self", ",", "a", ",", "b", ")", ":", "\"See if a and b have the same elements\"", "if", "len", "(", "a", ")", "!=", "len", "(", "b", ")", ":", "return", "0", "if", "a", "==", "b", ":", "return", "1", "return", "self", ".", ...
See if a and b have the same elements
[ "See", "if", "a", "and", "b", "have", "the", "same", "elements" ]
fb32b317f6e2b4b4aad2b86a74844658ac4aa11e
https://github.com/Kronuz/pyScss/blob/fb32b317f6e2b4b4aad2b86a74844658ac4aa11e/yapps2.py#L111-L117
train
Kronuz/pyScss
yapps2.py
Generator.add_to
def add_to(self, parent, additions): "Modify parent to include all elements in additions" for x in additions: if x not in parent: parent.append(x) self.changed()
python
def add_to(self, parent, additions): "Modify parent to include all elements in additions" for x in additions: if x not in parent: parent.append(x) self.changed()
[ "def", "add_to", "(", "self", ",", "parent", ",", "additions", ")", ":", "\"Modify parent to include all elements in additions\"", "for", "x", "in", "additions", ":", "if", "x", "not", "in", "parent", ":", "parent", ".", "append", "(", "x", ")", "self", ".",...
Modify parent to include all elements in additions
[ "Modify", "parent", "to", "include", "all", "elements", "in", "additions" ]
fb32b317f6e2b4b4aad2b86a74844658ac4aa11e
https://github.com/Kronuz/pyScss/blob/fb32b317f6e2b4b4aad2b86a74844658ac4aa11e/yapps2.py#L119-L124
train
Kronuz/pyScss
scss/namespace.py
Namespace.declare_alias
def declare_alias(self, name): """Insert a Python function into this Namespace with an explicitly-given name, but detect its argument count automatically. """ def decorator(f): self._auto_register_function(f, name) return f return decorator
python
def declare_alias(self, name): """Insert a Python function into this Namespace with an explicitly-given name, but detect its argument count automatically. """ def decorator(f): self._auto_register_function(f, name) return f return decorator
[ "def", "declare_alias", "(", "self", ",", "name", ")", ":", "def", "decorator", "(", "f", ")", ":", "self", ".", "_auto_register_function", "(", "f", ",", "name", ")", "return", "f", "return", "decorator" ]
Insert a Python function into this Namespace with an explicitly-given name, but detect its argument count automatically.
[ "Insert", "a", "Python", "function", "into", "this", "Namespace", "with", "an", "explicitly", "-", "given", "name", "but", "detect", "its", "argument", "count", "automatically", "." ]
fb32b317f6e2b4b4aad2b86a74844658ac4aa11e
https://github.com/Kronuz/pyScss/blob/fb32b317f6e2b4b4aad2b86a74844658ac4aa11e/scss/namespace.py#L150-L158
train
Kronuz/pyScss
scss/util.py
tmemoize.collect
def collect(self): """Clear cache of results which have timed out""" for func in self._caches: cache = {} for key in self._caches[func]: if (time.time() - self._caches[func][key][1]) < self._timeouts[func]: cache[key] = self._caches[func][key] ...
python
def collect(self): """Clear cache of results which have timed out""" for func in self._caches: cache = {} for key in self._caches[func]: if (time.time() - self._caches[func][key][1]) < self._timeouts[func]: cache[key] = self._caches[func][key] ...
[ "def", "collect", "(", "self", ")", ":", "for", "func", "in", "self", ".", "_caches", ":", "cache", "=", "{", "}", "for", "key", "in", "self", ".", "_caches", "[", "func", "]", ":", "if", "(", "time", ".", "time", "(", ")", "-", "self", ".", ...
Clear cache of results which have timed out
[ "Clear", "cache", "of", "results", "which", "have", "timed", "out" ]
fb32b317f6e2b4b4aad2b86a74844658ac4aa11e
https://github.com/Kronuz/pyScss/blob/fb32b317f6e2b4b4aad2b86a74844658ac4aa11e/scss/util.py#L206-L213
train
Kronuz/pyScss
scss/rule.py
extend_unique
def extend_unique(seq, more): """Return a new sequence containing the items in `seq` plus any items in `more` that aren't already in `seq`, preserving the order of both. """ seen = set(seq) new = [] for item in more: if item not in seen: seen.add(item) new.append(...
python
def extend_unique(seq, more): """Return a new sequence containing the items in `seq` plus any items in `more` that aren't already in `seq`, preserving the order of both. """ seen = set(seq) new = [] for item in more: if item not in seen: seen.add(item) new.append(...
[ "def", "extend_unique", "(", "seq", ",", "more", ")", ":", "seen", "=", "set", "(", "seq", ")", "new", "=", "[", "]", "for", "item", "in", "more", ":", "if", "item", "not", "in", "seen", ":", "seen", ".", "add", "(", "item", ")", "new", ".", ...
Return a new sequence containing the items in `seq` plus any items in `more` that aren't already in `seq`, preserving the order of both.
[ "Return", "a", "new", "sequence", "containing", "the", "items", "in", "seq", "plus", "any", "items", "in", "more", "that", "aren", "t", "already", "in", "seq", "preserving", "the", "order", "of", "both", "." ]
fb32b317f6e2b4b4aad2b86a74844658ac4aa11e
https://github.com/Kronuz/pyScss/blob/fb32b317f6e2b4b4aad2b86a74844658ac4aa11e/scss/rule.py#L17-L28
train
Kronuz/pyScss
scss/rule.py
RuleAncestry.with_more_selectors
def with_more_selectors(self, selectors): """Return a new ancestry that also matches the given selectors. No nesting is done. """ if self.headers and self.headers[-1].is_selector: new_selectors = extend_unique( self.headers[-1].selectors, sele...
python
def with_more_selectors(self, selectors): """Return a new ancestry that also matches the given selectors. No nesting is done. """ if self.headers and self.headers[-1].is_selector: new_selectors = extend_unique( self.headers[-1].selectors, sele...
[ "def", "with_more_selectors", "(", "self", ",", "selectors", ")", ":", "if", "self", ".", "headers", "and", "self", ".", "headers", "[", "-", "1", "]", ".", "is_selector", ":", "new_selectors", "=", "extend_unique", "(", "self", ".", "headers", "[", "-",...
Return a new ancestry that also matches the given selectors. No nesting is done.
[ "Return", "a", "new", "ancestry", "that", "also", "matches", "the", "given", "selectors", ".", "No", "nesting", "is", "done", "." ]
fb32b317f6e2b4b4aad2b86a74844658ac4aa11e
https://github.com/Kronuz/pyScss/blob/fb32b317f6e2b4b4aad2b86a74844658ac4aa11e/scss/rule.py#L194-L207
train
Kronuz/pyScss
scss/calculator.py
Calculator.parse_interpolations
def parse_interpolations(self, string): """Parse a string for interpolations, but don't treat anything else as Sass syntax. Returns an AST node. """ # Shortcut: if there are no #s in the string in the first place, it # must not have any interpolations, right? if '#' not ...
python
def parse_interpolations(self, string): """Parse a string for interpolations, but don't treat anything else as Sass syntax. Returns an AST node. """ # Shortcut: if there are no #s in the string in the first place, it # must not have any interpolations, right? if '#' not ...
[ "def", "parse_interpolations", "(", "self", ",", "string", ")", ":", "if", "'#'", "not", "in", "string", ":", "return", "Literal", "(", "String", ".", "unquoted", "(", "string", ")", ")", "return", "self", ".", "parse_expression", "(", "string", ",", "'g...
Parse a string for interpolations, but don't treat anything else as Sass syntax. Returns an AST node.
[ "Parse", "a", "string", "for", "interpolations", "but", "don", "t", "treat", "anything", "else", "as", "Sass", "syntax", ".", "Returns", "an", "AST", "node", "." ]
fb32b317f6e2b4b4aad2b86a74844658ac4aa11e
https://github.com/Kronuz/pyScss/blob/fb32b317f6e2b4b4aad2b86a74844658ac4aa11e/scss/calculator.py#L174-L182
train
Kronuz/pyScss
scss/calculator.py
Calculator.parse_vars_and_interpolations
def parse_vars_and_interpolations(self, string): """Parse a string for variables and interpolations, but don't treat anything else as Sass syntax. Returns an AST node. """ # Shortcut: if there are no #s or $s in the string in the first place, # it must not have anything of inter...
python
def parse_vars_and_interpolations(self, string): """Parse a string for variables and interpolations, but don't treat anything else as Sass syntax. Returns an AST node. """ # Shortcut: if there are no #s or $s in the string in the first place, # it must not have anything of inter...
[ "def", "parse_vars_and_interpolations", "(", "self", ",", "string", ")", ":", "if", "'#'", "not", "in", "string", "and", "'$'", "not", "in", "string", ":", "return", "Literal", "(", "String", ".", "unquoted", "(", "string", ")", ")", "return", "self", "....
Parse a string for variables and interpolations, but don't treat anything else as Sass syntax. Returns an AST node.
[ "Parse", "a", "string", "for", "variables", "and", "interpolations", "but", "don", "t", "treat", "anything", "else", "as", "Sass", "syntax", ".", "Returns", "an", "AST", "node", "." ]
fb32b317f6e2b4b4aad2b86a74844658ac4aa11e
https://github.com/Kronuz/pyScss/blob/fb32b317f6e2b4b4aad2b86a74844658ac4aa11e/scss/calculator.py#L184-L193
train
Kronuz/pyScss
scss/extension/compass/helpers.py
reject
def reject(lst, *values): """Removes the given values from the list""" lst = List.from_maybe(lst) values = frozenset(List.from_maybe_starargs(values)) ret = [] for item in lst: if item not in values: ret.append(item) return List(ret, use_comma=lst.use_comma)
python
def reject(lst, *values): """Removes the given values from the list""" lst = List.from_maybe(lst) values = frozenset(List.from_maybe_starargs(values)) ret = [] for item in lst: if item not in values: ret.append(item) return List(ret, use_comma=lst.use_comma)
[ "def", "reject", "(", "lst", ",", "*", "values", ")", ":", "lst", "=", "List", ".", "from_maybe", "(", "lst", ")", "values", "=", "frozenset", "(", "List", ".", "from_maybe_starargs", "(", "values", ")", ")", "ret", "=", "[", "]", "for", "item", "i...
Removes the given values from the list
[ "Removes", "the", "given", "values", "from", "the", "list" ]
fb32b317f6e2b4b4aad2b86a74844658ac4aa11e
https://github.com/Kronuz/pyScss/blob/fb32b317f6e2b4b4aad2b86a74844658ac4aa11e/scss/extension/compass/helpers.py#L87-L96
train
Kronuz/pyScss
scss/errors.py
add_error_marker
def add_error_marker(text, position, start_line=1): """Add a caret marking a given position in a string of input. Returns (new_text, caret_line). """ indent = " " lines = [] caret_line = start_line for line in text.split("\n"): lines.append(indent + line) if 0 <= positio...
python
def add_error_marker(text, position, start_line=1): """Add a caret marking a given position in a string of input. Returns (new_text, caret_line). """ indent = " " lines = [] caret_line = start_line for line in text.split("\n"): lines.append(indent + line) if 0 <= positio...
[ "def", "add_error_marker", "(", "text", ",", "position", ",", "start_line", "=", "1", ")", ":", "indent", "=", "\" \"", "lines", "=", "[", "]", "caret_line", "=", "start_line", "for", "line", "in", "text", ".", "split", "(", "\"\\n\"", ")", ":", "li...
Add a caret marking a given position in a string of input. Returns (new_text, caret_line).
[ "Add", "a", "caret", "marking", "a", "given", "position", "in", "a", "string", "of", "input", "." ]
fb32b317f6e2b4b4aad2b86a74844658ac4aa11e
https://github.com/Kronuz/pyScss/blob/fb32b317f6e2b4b4aad2b86a74844658ac4aa11e/scss/errors.py#L34-L53
train
Kronuz/pyScss
scss/errors.py
SassBaseError.format_sass_stack
def format_sass_stack(self): """Return a "traceback" of Sass imports.""" if not self.rule_stack: return "" ret = ["on ", self.format_file_and_line(self.rule_stack[0]), "\n"] last_file = self.rule_stack[0].source_file # TODO this could go away if rules knew their imp...
python
def format_sass_stack(self): """Return a "traceback" of Sass imports.""" if not self.rule_stack: return "" ret = ["on ", self.format_file_and_line(self.rule_stack[0]), "\n"] last_file = self.rule_stack[0].source_file # TODO this could go away if rules knew their imp...
[ "def", "format_sass_stack", "(", "self", ")", ":", "if", "not", "self", ".", "rule_stack", ":", "return", "\"\"", "ret", "=", "[", "\"on \"", ",", "self", ".", "format_file_and_line", "(", "self", ".", "rule_stack", "[", "0", "]", ")", ",", "\"\\n\"", ...
Return a "traceback" of Sass imports.
[ "Return", "a", "traceback", "of", "Sass", "imports", "." ]
fb32b317f6e2b4b4aad2b86a74844658ac4aa11e
https://github.com/Kronuz/pyScss/blob/fb32b317f6e2b4b4aad2b86a74844658ac4aa11e/scss/errors.py#L80-L101
train
Kronuz/pyScss
scss/errors.py
SassError.format_python_stack
def format_python_stack(self): """Return a traceback of Python frames, from where the error occurred to where it was first caught and wrapped. """ ret = ["Traceback:\n"] ret.extend(traceback.format_tb(self.original_traceback)) return "".join(ret)
python
def format_python_stack(self): """Return a traceback of Python frames, from where the error occurred to where it was first caught and wrapped. """ ret = ["Traceback:\n"] ret.extend(traceback.format_tb(self.original_traceback)) return "".join(ret)
[ "def", "format_python_stack", "(", "self", ")", ":", "ret", "=", "[", "\"Traceback:\\n\"", "]", "ret", ".", "extend", "(", "traceback", ".", "format_tb", "(", "self", ".", "original_traceback", ")", ")", "return", "\"\"", ".", "join", "(", "ret", ")" ]
Return a traceback of Python frames, from where the error occurred to where it was first caught and wrapped.
[ "Return", "a", "traceback", "of", "Python", "frames", "from", "where", "the", "error", "occurred", "to", "where", "it", "was", "first", "caught", "and", "wrapped", "." ]
fb32b317f6e2b4b4aad2b86a74844658ac4aa11e
https://github.com/Kronuz/pyScss/blob/fb32b317f6e2b4b4aad2b86a74844658ac4aa11e/scss/errors.py#L217-L223
train
Kronuz/pyScss
scss/errors.py
SassError.to_css
def to_css(self): """Return a stylesheet that will show the wrapped error at the top of the browser window. """ # TODO should this include the traceback? any security concerns? prefix = self.format_prefix() original_error = self.format_original_error() sass_stack...
python
def to_css(self): """Return a stylesheet that will show the wrapped error at the top of the browser window. """ # TODO should this include the traceback? any security concerns? prefix = self.format_prefix() original_error = self.format_original_error() sass_stack...
[ "def", "to_css", "(", "self", ")", ":", "prefix", "=", "self", ".", "format_prefix", "(", ")", "original_error", "=", "self", ".", "format_original_error", "(", ")", "sass_stack", "=", "self", ".", "format_sass_stack", "(", ")", "message", "=", "prefix", "...
Return a stylesheet that will show the wrapped error at the top of the browser window.
[ "Return", "a", "stylesheet", "that", "will", "show", "the", "wrapped", "error", "at", "the", "top", "of", "the", "browser", "window", "." ]
fb32b317f6e2b4b4aad2b86a74844658ac4aa11e
https://github.com/Kronuz/pyScss/blob/fb32b317f6e2b4b4aad2b86a74844658ac4aa11e/scss/errors.py#L249-L268
train
Kronuz/pyScss
scss/compiler.py
compile_string
def compile_string(string, compiler_class=Compiler, **kwargs): """Compile a single string, and return a string of CSS. Keyword arguments are passed along to the underlying `Compiler`. """ compiler = compiler_class(**kwargs) return compiler.compile_string(string)
python
def compile_string(string, compiler_class=Compiler, **kwargs): """Compile a single string, and return a string of CSS. Keyword arguments are passed along to the underlying `Compiler`. """ compiler = compiler_class(**kwargs) return compiler.compile_string(string)
[ "def", "compile_string", "(", "string", ",", "compiler_class", "=", "Compiler", ",", "**", "kwargs", ")", ":", "compiler", "=", "compiler_class", "(", "**", "kwargs", ")", "return", "compiler", ".", "compile_string", "(", "string", ")" ]
Compile a single string, and return a string of CSS. Keyword arguments are passed along to the underlying `Compiler`.
[ "Compile", "a", "single", "string", "and", "return", "a", "string", "of", "CSS", "." ]
fb32b317f6e2b4b4aad2b86a74844658ac4aa11e
https://github.com/Kronuz/pyScss/blob/fb32b317f6e2b4b4aad2b86a74844658ac4aa11e/scss/compiler.py#L240-L246
train
Kronuz/pyScss
scss/compiler.py
Compilation.parse_selectors
def parse_selectors(self, raw_selectors): """ Parses out the old xCSS "foo extends bar" syntax. Returns a 2-tuple: a set of selectors, and a set of extended selectors. """ # Fix tabs and spaces in selectors raw_selectors = _spaces_re.sub(' ', raw_selectors) part...
python
def parse_selectors(self, raw_selectors): """ Parses out the old xCSS "foo extends bar" syntax. Returns a 2-tuple: a set of selectors, and a set of extended selectors. """ # Fix tabs and spaces in selectors raw_selectors = _spaces_re.sub(' ', raw_selectors) part...
[ "def", "parse_selectors", "(", "self", ",", "raw_selectors", ")", ":", "raw_selectors", "=", "_spaces_re", ".", "sub", "(", "' '", ",", "raw_selectors", ")", "parts", "=", "_xcss_extends_re", ".", "split", "(", "raw_selectors", ",", "1", ")", "if", "len", ...
Parses out the old xCSS "foo extends bar" syntax. Returns a 2-tuple: a set of selectors, and a set of extended selectors.
[ "Parses", "out", "the", "old", "xCSS", "foo", "extends", "bar", "syntax", "." ]
fb32b317f6e2b4b4aad2b86a74844658ac4aa11e
https://github.com/Kronuz/pyScss/blob/fb32b317f6e2b4b4aad2b86a74844658ac4aa11e/scss/compiler.py#L308-L329
train
Kronuz/pyScss
scss/compiler.py
Compilation._get_properties
def _get_properties(self, rule, scope, block): """ Implements properties and variables extraction and assignment """ prop, raw_value = (_prop_split_re.split(block.prop, 1) + [None])[:2] if raw_value is not None: raw_value = raw_value.strip() try: ...
python
def _get_properties(self, rule, scope, block): """ Implements properties and variables extraction and assignment """ prop, raw_value = (_prop_split_re.split(block.prop, 1) + [None])[:2] if raw_value is not None: raw_value = raw_value.strip() try: ...
[ "def", "_get_properties", "(", "self", ",", "rule", ",", "scope", ",", "block", ")", ":", "prop", ",", "raw_value", "=", "(", "_prop_split_re", ".", "split", "(", "block", ".", "prop", ",", "1", ")", "+", "[", "None", "]", ")", "[", ":", "2", "]"...
Implements properties and variables extraction and assignment
[ "Implements", "properties", "and", "variables", "extraction", "and", "assignment" ]
fb32b317f6e2b4b4aad2b86a74844658ac4aa11e
https://github.com/Kronuz/pyScss/blob/fb32b317f6e2b4b4aad2b86a74844658ac4aa11e/scss/compiler.py#L1027-L1105
train
Kronuz/pyScss
scss/types.py
_constrain
def _constrain(value, lb=0, ub=1): """Helper for Color constructors. Constrains a value to a range.""" if value < lb: return lb elif value > ub: return ub else: return value
python
def _constrain(value, lb=0, ub=1): """Helper for Color constructors. Constrains a value to a range.""" if value < lb: return lb elif value > ub: return ub else: return value
[ "def", "_constrain", "(", "value", ",", "lb", "=", "0", ",", "ub", "=", "1", ")", ":", "if", "value", "<", "lb", ":", "return", "lb", "elif", "value", ">", "ub", ":", "return", "ub", "else", ":", "return", "value" ]
Helper for Color constructors. Constrains a value to a range.
[ "Helper", "for", "Color", "constructors", ".", "Constrains", "a", "value", "to", "a", "range", "." ]
fb32b317f6e2b4b4aad2b86a74844658ac4aa11e
https://github.com/Kronuz/pyScss/blob/fb32b317f6e2b4b4aad2b86a74844658ac4aa11e/scss/types.py#L808-L815
train
Kronuz/pyScss
scss/types.py
Number._add_sub
def _add_sub(self, other, op): """Implements both addition and subtraction.""" if not isinstance(other, Number): return NotImplemented # If either side is unitless, inherit the other side's units. Skip all # the rest of the conversion math, too. if self.is_unitless ...
python
def _add_sub(self, other, op): """Implements both addition and subtraction.""" if not isinstance(other, Number): return NotImplemented # If either side is unitless, inherit the other side's units. Skip all # the rest of the conversion math, too. if self.is_unitless ...
[ "def", "_add_sub", "(", "self", ",", "other", ",", "op", ")", ":", "if", "not", "isinstance", "(", "other", ",", "Number", ")", ":", "return", "NotImplemented", "if", "self", ".", "is_unitless", "or", "other", ".", "is_unitless", ":", "return", "Number",...
Implements both addition and subtraction.
[ "Implements", "both", "addition", "and", "subtraction", "." ]
fb32b317f6e2b4b4aad2b86a74844658ac4aa11e
https://github.com/Kronuz/pyScss/blob/fb32b317f6e2b4b4aad2b86a74844658ac4aa11e/scss/types.py#L442-L483
train
Kronuz/pyScss
scss/types.py
Number.to_base_units
def to_base_units(self): """Convert to a fixed set of "base" units. The particular units are arbitrary; what's important is that they're consistent. Used for addition and comparisons. """ # Convert to "standard" units, as defined by the conversions dict above amount = s...
python
def to_base_units(self): """Convert to a fixed set of "base" units. The particular units are arbitrary; what's important is that they're consistent. Used for addition and comparisons. """ # Convert to "standard" units, as defined by the conversions dict above amount = s...
[ "def", "to_base_units", "(", "self", ")", ":", "amount", "=", "self", ".", "value", "numer_factor", ",", "numer_units", "=", "convert_units_to_base_units", "(", "self", ".", "unit_numer", ")", "denom_factor", ",", "denom_units", "=", "convert_units_to_base_units", ...
Convert to a fixed set of "base" units. The particular units are arbitrary; what's important is that they're consistent. Used for addition and comparisons.
[ "Convert", "to", "a", "fixed", "set", "of", "base", "units", ".", "The", "particular", "units", "are", "arbitrary", ";", "what", "s", "important", "is", "that", "they", "re", "consistent", "." ]
fb32b317f6e2b4b4aad2b86a74844658ac4aa11e
https://github.com/Kronuz/pyScss/blob/fb32b317f6e2b4b4aad2b86a74844658ac4aa11e/scss/types.py#L487-L503
train
Kronuz/pyScss
scss/types.py
Number.wrap_python_function
def wrap_python_function(cls, fn): """Wraps an unary Python math function, translating the argument from Sass to Python on the way in, and vice versa for the return value. Used to wrap simple Python functions like `ceil`, `floor`, etc. """ def wrapped(sass_arg): # TO...
python
def wrap_python_function(cls, fn): """Wraps an unary Python math function, translating the argument from Sass to Python on the way in, and vice versa for the return value. Used to wrap simple Python functions like `ceil`, `floor`, etc. """ def wrapped(sass_arg): # TO...
[ "def", "wrap_python_function", "(", "cls", ",", "fn", ")", ":", "def", "wrapped", "(", "sass_arg", ")", ":", "python_arg", "=", "sass_arg", ".", "value", "python_ret", "=", "fn", "(", "python_arg", ")", "sass_ret", "=", "cls", "(", "python_ret", ",", "un...
Wraps an unary Python math function, translating the argument from Sass to Python on the way in, and vice versa for the return value. Used to wrap simple Python functions like `ceil`, `floor`, etc.
[ "Wraps", "an", "unary", "Python", "math", "function", "translating", "the", "argument", "from", "Sass", "to", "Python", "on", "the", "way", "in", "and", "vice", "versa", "for", "the", "return", "value", "." ]
fb32b317f6e2b4b4aad2b86a74844658ac4aa11e
https://github.com/Kronuz/pyScss/blob/fb32b317f6e2b4b4aad2b86a74844658ac4aa11e/scss/types.py#L508-L524
train
Kronuz/pyScss
scss/types.py
Number.to_python_index
def to_python_index(self, length, check_bounds=True, circular=False): """Return a plain Python integer appropriate for indexing a sequence of the given length. Raise if this is impossible for any reason whatsoever. """ if not self.is_unitless: raise ValueError("Index...
python
def to_python_index(self, length, check_bounds=True, circular=False): """Return a plain Python integer appropriate for indexing a sequence of the given length. Raise if this is impossible for any reason whatsoever. """ if not self.is_unitless: raise ValueError("Index...
[ "def", "to_python_index", "(", "self", ",", "length", ",", "check_bounds", "=", "True", ",", "circular", "=", "False", ")", ":", "if", "not", "self", ".", "is_unitless", ":", "raise", "ValueError", "(", "\"Index cannot have units: {0!r}\"", ".", "format", "(",...
Return a plain Python integer appropriate for indexing a sequence of the given length. Raise if this is impossible for any reason whatsoever.
[ "Return", "a", "plain", "Python", "integer", "appropriate", "for", "indexing", "a", "sequence", "of", "the", "given", "length", ".", "Raise", "if", "this", "is", "impossible", "for", "any", "reason", "whatsoever", "." ]
fb32b317f6e2b4b4aad2b86a74844658ac4aa11e
https://github.com/Kronuz/pyScss/blob/fb32b317f6e2b4b4aad2b86a74844658ac4aa11e/scss/types.py#L526-L550
train
Kronuz/pyScss
scss/types.py
List.maybe_new
def maybe_new(cls, values, use_comma=True): """If `values` contains only one item, return that item. Otherwise, return a List as normal. """ if len(values) == 1: return values[0] else: return cls(values, use_comma=use_comma)
python
def maybe_new(cls, values, use_comma=True): """If `values` contains only one item, return that item. Otherwise, return a List as normal. """ if len(values) == 1: return values[0] else: return cls(values, use_comma=use_comma)
[ "def", "maybe_new", "(", "cls", ",", "values", ",", "use_comma", "=", "True", ")", ":", "if", "len", "(", "values", ")", "==", "1", ":", "return", "values", "[", "0", "]", "else", ":", "return", "cls", "(", "values", ",", "use_comma", "=", "use_com...
If `values` contains only one item, return that item. Otherwise, return a List as normal.
[ "If", "values", "contains", "only", "one", "item", "return", "that", "item", ".", "Otherwise", "return", "a", "List", "as", "normal", "." ]
fb32b317f6e2b4b4aad2b86a74844658ac4aa11e
https://github.com/Kronuz/pyScss/blob/fb32b317f6e2b4b4aad2b86a74844658ac4aa11e/scss/types.py#L636-L643
train
Kronuz/pyScss
scss/types.py
List.from_maybe_starargs
def from_maybe_starargs(cls, args, use_comma=True): """If `args` has one element which appears to be a list, return it. Otherwise, return a list as normal. Mainly used by Sass function implementations that predate `...` support, so they can accept both a list of arguments and a single l...
python
def from_maybe_starargs(cls, args, use_comma=True): """If `args` has one element which appears to be a list, return it. Otherwise, return a list as normal. Mainly used by Sass function implementations that predate `...` support, so they can accept both a list of arguments and a single l...
[ "def", "from_maybe_starargs", "(", "cls", ",", "args", ",", "use_comma", "=", "True", ")", ":", "if", "len", "(", "args", ")", "==", "1", ":", "if", "isinstance", "(", "args", "[", "0", "]", ",", "cls", ")", ":", "return", "args", "[", "0", "]", ...
If `args` has one element which appears to be a list, return it. Otherwise, return a list as normal. Mainly used by Sass function implementations that predate `...` support, so they can accept both a list of arguments and a single list stored in a variable.
[ "If", "args", "has", "one", "element", "which", "appears", "to", "be", "a", "list", "return", "it", ".", "Otherwise", "return", "a", "list", "as", "normal", "." ]
fb32b317f6e2b4b4aad2b86a74844658ac4aa11e
https://github.com/Kronuz/pyScss/blob/fb32b317f6e2b4b4aad2b86a74844658ac4aa11e/scss/types.py#L664-L678
train
Kronuz/pyScss
scss/types.py
Color.from_name
def from_name(cls, name): """Build a Color from a CSS color name.""" self = cls.__new__(cls) # TODO self.original_literal = name r, g, b, a = COLOR_NAMES[name] self.value = r, g, b, a return self
python
def from_name(cls, name): """Build a Color from a CSS color name.""" self = cls.__new__(cls) # TODO self.original_literal = name r, g, b, a = COLOR_NAMES[name] self.value = r, g, b, a return self
[ "def", "from_name", "(", "cls", ",", "name", ")", ":", "self", "=", "cls", ".", "__new__", "(", "cls", ")", "self", ".", "original_literal", "=", "name", "r", ",", "g", ",", "b", ",", "a", "=", "COLOR_NAMES", "[", "name", "]", "self", ".", "value...
Build a Color from a CSS color name.
[ "Build", "a", "Color", "from", "a", "CSS", "color", "name", "." ]
fb32b317f6e2b4b4aad2b86a74844658ac4aa11e
https://github.com/Kronuz/pyScss/blob/fb32b317f6e2b4b4aad2b86a74844658ac4aa11e/scss/types.py#L893-L901
train
Kronuz/pyScss
scss/types.py
String.unquoted
def unquoted(cls, value, literal=False): """Helper to create a string with no quotes.""" return cls(value, quotes=None, literal=literal)
python
def unquoted(cls, value, literal=False): """Helper to create a string with no quotes.""" return cls(value, quotes=None, literal=literal)
[ "def", "unquoted", "(", "cls", ",", "value", ",", "literal", "=", "False", ")", ":", "return", "cls", "(", "value", ",", "quotes", "=", "None", ",", "literal", "=", "literal", ")" ]
Helper to create a string with no quotes.
[ "Helper", "to", "create", "a", "string", "with", "no", "quotes", "." ]
fb32b317f6e2b4b4aad2b86a74844658ac4aa11e
https://github.com/Kronuz/pyScss/blob/fb32b317f6e2b4b4aad2b86a74844658ac4aa11e/scss/types.py#L1096-L1098
train
Kronuz/pyScss
scss/selector.py
_is_combinator_subset_of
def _is_combinator_subset_of(specific, general, is_first=True): """Return whether `specific` matches a non-strict subset of what `general` matches. """ if is_first and general == ' ': # First selector always has a space to mean "descendent of root", which # still holds if any other selec...
python
def _is_combinator_subset_of(specific, general, is_first=True): """Return whether `specific` matches a non-strict subset of what `general` matches. """ if is_first and general == ' ': # First selector always has a space to mean "descendent of root", which # still holds if any other selec...
[ "def", "_is_combinator_subset_of", "(", "specific", ",", "general", ",", "is_first", "=", "True", ")", ":", "if", "is_first", "and", "general", "==", "' '", ":", "return", "True", "if", "specific", "==", "general", ":", "return", "True", "if", "specific", ...
Return whether `specific` matches a non-strict subset of what `general` matches.
[ "Return", "whether", "specific", "matches", "a", "non", "-", "strict", "subset", "of", "what", "general", "matches", "." ]
fb32b317f6e2b4b4aad2b86a74844658ac4aa11e
https://github.com/Kronuz/pyScss/blob/fb32b317f6e2b4b4aad2b86a74844658ac4aa11e/scss/selector.py#L62-L80
train
Kronuz/pyScss
scss/selector.py
_weave_conflicting_selectors
def _weave_conflicting_selectors(prefixes, a, b, suffix=()): """Part of the selector merge algorithm above. Not useful on its own. Pay no attention to the man behind the curtain. """ # OK, what this actually does: given a list of selector chains, two # "conflicting" selector chains, and an optiona...
python
def _weave_conflicting_selectors(prefixes, a, b, suffix=()): """Part of the selector merge algorithm above. Not useful on its own. Pay no attention to the man behind the curtain. """ # OK, what this actually does: given a list of selector chains, two # "conflicting" selector chains, and an optiona...
[ "def", "_weave_conflicting_selectors", "(", "prefixes", ",", "a", ",", "b", ",", "suffix", "=", "(", ")", ")", ":", "both", "=", "a", "and", "b", "for", "prefix", "in", "prefixes", ":", "yield", "prefix", "+", "a", "+", "b", "+", "suffix", "if", "b...
Part of the selector merge algorithm above. Not useful on its own. Pay no attention to the man behind the curtain.
[ "Part", "of", "the", "selector", "merge", "algorithm", "above", ".", "Not", "useful", "on", "its", "own", ".", "Pay", "no", "attention", "to", "the", "man", "behind", "the", "curtain", "." ]
fb32b317f6e2b4b4aad2b86a74844658ac4aa11e
https://github.com/Kronuz/pyScss/blob/fb32b317f6e2b4b4aad2b86a74844658ac4aa11e/scss/selector.py#L550-L569
train
Kronuz/pyScss
scss/selector.py
_merge_simple_selectors
def _merge_simple_selectors(a, b): """Merge two simple selectors, for the purposes of the LCS algorithm below. In practice this returns the more specific selector if one is a subset of the other, else it returns None. """ # TODO what about combinators if a.is_superset_of(b): return b ...
python
def _merge_simple_selectors(a, b): """Merge two simple selectors, for the purposes of the LCS algorithm below. In practice this returns the more specific selector if one is a subset of the other, else it returns None. """ # TODO what about combinators if a.is_superset_of(b): return b ...
[ "def", "_merge_simple_selectors", "(", "a", ",", "b", ")", ":", "if", "a", ".", "is_superset_of", "(", "b", ")", ":", "return", "b", "elif", "b", ".", "is_superset_of", "(", "a", ")", ":", "return", "a", "else", ":", "return", "None" ]
Merge two simple selectors, for the purposes of the LCS algorithm below. In practice this returns the more specific selector if one is a subset of the other, else it returns None.
[ "Merge", "two", "simple", "selectors", "for", "the", "purposes", "of", "the", "LCS", "algorithm", "below", "." ]
fb32b317f6e2b4b4aad2b86a74844658ac4aa11e
https://github.com/Kronuz/pyScss/blob/fb32b317f6e2b4b4aad2b86a74844658ac4aa11e/scss/selector.py#L572-L584
train
Kronuz/pyScss
scss/selector.py
longest_common_subsequence
def longest_common_subsequence(a, b, mergefunc=None): """Find the longest common subsequence between two iterables. The longest common subsequence is the core of any diff algorithm: it's the longest sequence of elements that appears in both parent sequences in the same order, but NOT necessarily consec...
python
def longest_common_subsequence(a, b, mergefunc=None): """Find the longest common subsequence between two iterables. The longest common subsequence is the core of any diff algorithm: it's the longest sequence of elements that appears in both parent sequences in the same order, but NOT necessarily consec...
[ "def", "longest_common_subsequence", "(", "a", ",", "b", ",", "mergefunc", "=", "None", ")", ":", "if", "mergefunc", "is", "None", ":", "def", "mergefunc", "(", "a", ",", "b", ")", ":", "if", "a", "==", "b", ":", "return", "a", "return", "None", "e...
Find the longest common subsequence between two iterables. The longest common subsequence is the core of any diff algorithm: it's the longest sequence of elements that appears in both parent sequences in the same order, but NOT necessarily consecutively. Original algorithm borrowed from Wikipedia: ...
[ "Find", "the", "longest", "common", "subsequence", "between", "two", "iterables", "." ]
fb32b317f6e2b4b4aad2b86a74844658ac4aa11e
https://github.com/Kronuz/pyScss/blob/fb32b317f6e2b4b4aad2b86a74844658ac4aa11e/scss/selector.py#L587-L664
train
Kronuz/pyScss
scss/selector.py
SimpleSelector.is_superset_of
def is_superset_of(self, other, soft_combinator=False): """Return True iff this selector matches the same elements as `other`, and perhaps others. That is, ``.foo`` is a superset of ``.foo.bar``, because the latter is more specific. Set `soft_combinator` true to ignore the spec...
python
def is_superset_of(self, other, soft_combinator=False): """Return True iff this selector matches the same elements as `other`, and perhaps others. That is, ``.foo`` is a superset of ``.foo.bar``, because the latter is more specific. Set `soft_combinator` true to ignore the spec...
[ "def", "is_superset_of", "(", "self", ",", "other", ",", "soft_combinator", "=", "False", ")", ":", "if", "soft_combinator", "and", "self", ".", "combinator", "==", "' '", ":", "combinator_superset", "=", "True", "else", ":", "combinator_superset", "=", "(", ...
Return True iff this selector matches the same elements as `other`, and perhaps others. That is, ``.foo`` is a superset of ``.foo.bar``, because the latter is more specific. Set `soft_combinator` true to ignore the specific case of this selector having a descendent combinator a...
[ "Return", "True", "iff", "this", "selector", "matches", "the", "same", "elements", "as", "other", "and", "perhaps", "others", "." ]
fb32b317f6e2b4b4aad2b86a74844658ac4aa11e
https://github.com/Kronuz/pyScss/blob/fb32b317f6e2b4b4aad2b86a74844658ac4aa11e/scss/selector.py#L136-L160
train
Kronuz/pyScss
scss/selector.py
Selector.substitute
def substitute(self, target, replacement): """Return a list of selectors obtained by replacing the `target` selector with `replacement`. Herein lie the guts of the Sass @extend directive. In general, for a selector ``a X b Y c``, a target ``X Y``, and a replacement ``q Z``, ret...
python
def substitute(self, target, replacement): """Return a list of selectors obtained by replacing the `target` selector with `replacement`. Herein lie the guts of the Sass @extend directive. In general, for a selector ``a X b Y c``, a target ``X Y``, and a replacement ``q Z``, ret...
[ "def", "substitute", "(", "self", ",", "target", ",", "replacement", ")", ":", "p_before", ",", "p_extras", ",", "p_after", "=", "self", ".", "break_around", "(", "target", ".", "simple_selectors", ")", "r_trail", "=", "replacement", ".", "simple_selectors", ...
Return a list of selectors obtained by replacing the `target` selector with `replacement`. Herein lie the guts of the Sass @extend directive. In general, for a selector ``a X b Y c``, a target ``X Y``, and a replacement ``q Z``, return the selectors ``a q X b Z c`` and ``q a X b ...
[ "Return", "a", "list", "of", "selectors", "obtained", "by", "replacing", "the", "target", "selector", "with", "replacement", "." ]
fb32b317f6e2b4b4aad2b86a74844658ac4aa11e
https://github.com/Kronuz/pyScss/blob/fb32b317f6e2b4b4aad2b86a74844658ac4aa11e/scss/selector.py#L428-L459
train
Kronuz/pyScss
scss/cssdefs.py
convert_units_to_base_units
def convert_units_to_base_units(units): """Convert a set of units into a set of "base" units. Returns a 2-tuple of `factor, new_units`. """ total_factor = 1 new_units = [] for unit in units: if unit not in BASE_UNIT_CONVERSIONS: continue factor, new_unit = BASE_UNIT...
python
def convert_units_to_base_units(units): """Convert a set of units into a set of "base" units. Returns a 2-tuple of `factor, new_units`. """ total_factor = 1 new_units = [] for unit in units: if unit not in BASE_UNIT_CONVERSIONS: continue factor, new_unit = BASE_UNIT...
[ "def", "convert_units_to_base_units", "(", "units", ")", ":", "total_factor", "=", "1", "new_units", "=", "[", "]", "for", "unit", "in", "units", ":", "if", "unit", "not", "in", "BASE_UNIT_CONVERSIONS", ":", "continue", "factor", ",", "new_unit", "=", "BASE_...
Convert a set of units into a set of "base" units. Returns a 2-tuple of `factor, new_units`.
[ "Convert", "a", "set", "of", "units", "into", "a", "set", "of", "base", "units", "." ]
fb32b317f6e2b4b4aad2b86a74844658ac4aa11e
https://github.com/Kronuz/pyScss/blob/fb32b317f6e2b4b4aad2b86a74844658ac4aa11e/scss/cssdefs.py#L208-L224
train
Kronuz/pyScss
scss/cssdefs.py
count_base_units
def count_base_units(units): """Returns a dict mapping names of base units to how many times they appear in the given iterable of units. Effectively this counts how many length units you have, how many time units, and so forth. """ ret = {} for unit in units: factor, base_unit = get_con...
python
def count_base_units(units): """Returns a dict mapping names of base units to how many times they appear in the given iterable of units. Effectively this counts how many length units you have, how many time units, and so forth. """ ret = {} for unit in units: factor, base_unit = get_con...
[ "def", "count_base_units", "(", "units", ")", ":", "ret", "=", "{", "}", "for", "unit", "in", "units", ":", "factor", ",", "base_unit", "=", "get_conversion_factor", "(", "unit", ")", "ret", ".", "setdefault", "(", "base_unit", ",", "0", ")", "ret", "[...
Returns a dict mapping names of base units to how many times they appear in the given iterable of units. Effectively this counts how many length units you have, how many time units, and so forth.
[ "Returns", "a", "dict", "mapping", "names", "of", "base", "units", "to", "how", "many", "times", "they", "appear", "in", "the", "given", "iterable", "of", "units", ".", "Effectively", "this", "counts", "how", "many", "length", "units", "you", "have", "how"...
fb32b317f6e2b4b4aad2b86a74844658ac4aa11e
https://github.com/Kronuz/pyScss/blob/fb32b317f6e2b4b4aad2b86a74844658ac4aa11e/scss/cssdefs.py#L227-L239
train
Kronuz/pyScss
scss/cssdefs.py
cancel_base_units
def cancel_base_units(units, to_remove): """Given a list of units, remove a specified number of each base unit. Arguments: units: an iterable of units to_remove: a mapping of base_unit => count, such as that returned from count_base_units Returns a 2-tuple of (factor, remaining...
python
def cancel_base_units(units, to_remove): """Given a list of units, remove a specified number of each base unit. Arguments: units: an iterable of units to_remove: a mapping of base_unit => count, such as that returned from count_base_units Returns a 2-tuple of (factor, remaining...
[ "def", "cancel_base_units", "(", "units", ",", "to_remove", ")", ":", "to_remove", "=", "to_remove", ".", "copy", "(", ")", "remaining_units", "=", "[", "]", "total_factor", "=", "Fraction", "(", "1", ")", "for", "unit", "in", "units", ":", "factor", ","...
Given a list of units, remove a specified number of each base unit. Arguments: units: an iterable of units to_remove: a mapping of base_unit => count, such as that returned from count_base_units Returns a 2-tuple of (factor, remaining_units).
[ "Given", "a", "list", "of", "units", "remove", "a", "specified", "number", "of", "each", "base", "unit", "." ]
fb32b317f6e2b4b4aad2b86a74844658ac4aa11e
https://github.com/Kronuz/pyScss/blob/fb32b317f6e2b4b4aad2b86a74844658ac4aa11e/scss/cssdefs.py#L242-L267
train
Kronuz/pyScss
scss/cssdefs.py
is_builtin_css_function
def is_builtin_css_function(name): """Returns whether the given `name` looks like the name of a builtin CSS function. Unrecognized functions not in this list produce warnings. """ name = name.replace('_', '-') if name in BUILTIN_FUNCTIONS: return True # Vendor-specific functions (...
python
def is_builtin_css_function(name): """Returns whether the given `name` looks like the name of a builtin CSS function. Unrecognized functions not in this list produce warnings. """ name = name.replace('_', '-') if name in BUILTIN_FUNCTIONS: return True # Vendor-specific functions (...
[ "def", "is_builtin_css_function", "(", "name", ")", ":", "name", "=", "name", ".", "replace", "(", "'_'", ",", "'-'", ")", "if", "name", "in", "BUILTIN_FUNCTIONS", ":", "return", "True", "if", "name", "[", "0", "]", "==", "'-'", "and", "'-'", "in", "...
Returns whether the given `name` looks like the name of a builtin CSS function. Unrecognized functions not in this list produce warnings.
[ "Returns", "whether", "the", "given", "name", "looks", "like", "the", "name", "of", "a", "builtin", "CSS", "function", "." ]
fb32b317f6e2b4b4aad2b86a74844658ac4aa11e
https://github.com/Kronuz/pyScss/blob/fb32b317f6e2b4b4aad2b86a74844658ac4aa11e/scss/cssdefs.py#L336-L351
train
Kronuz/pyScss
scss/cssdefs.py
determine_encoding
def determine_encoding(buf): """Return the appropriate encoding for the given CSS source, according to the CSS charset rules. `buf` may be either a string or bytes. """ # The ultimate default is utf8; bravo, W3C bom_encoding = 'UTF-8' if not buf: # What return bom_encoding ...
python
def determine_encoding(buf): """Return the appropriate encoding for the given CSS source, according to the CSS charset rules. `buf` may be either a string or bytes. """ # The ultimate default is utf8; bravo, W3C bom_encoding = 'UTF-8' if not buf: # What return bom_encoding ...
[ "def", "determine_encoding", "(", "buf", ")", ":", "bom_encoding", "=", "'UTF-8'", "if", "not", "buf", ":", "return", "bom_encoding", "if", "isinstance", "(", "buf", ",", "six", ".", "text_type", ")", ":", "if", "buf", "[", "0", "]", "==", "'\\ufeff'", ...
Return the appropriate encoding for the given CSS source, according to the CSS charset rules. `buf` may be either a string or bytes.
[ "Return", "the", "appropriate", "encoding", "for", "the", "given", "CSS", "source", "according", "to", "the", "CSS", "charset", "rules", "." ]
fb32b317f6e2b4b4aad2b86a74844658ac4aa11e
https://github.com/Kronuz/pyScss/blob/fb32b317f6e2b4b4aad2b86a74844658ac4aa11e/scss/cssdefs.py#L358-L432
train
Kronuz/pyScss
scss/ast.py
Interpolation.maybe
def maybe(cls, parts, quotes=None, type=String, **kwargs): """Returns an interpolation if there are multiple parts, otherwise a plain Literal. This keeps the AST somewhat simpler, but also is the only way `Literal.from_bareword` gets called. """ if len(parts) > 1: re...
python
def maybe(cls, parts, quotes=None, type=String, **kwargs): """Returns an interpolation if there are multiple parts, otherwise a plain Literal. This keeps the AST somewhat simpler, but also is the only way `Literal.from_bareword` gets called. """ if len(parts) > 1: re...
[ "def", "maybe", "(", "cls", ",", "parts", ",", "quotes", "=", "None", ",", "type", "=", "String", ",", "**", "kwargs", ")", ":", "if", "len", "(", "parts", ")", ">", "1", ":", "return", "cls", "(", "parts", ",", "quotes", "=", "quotes", ",", "t...
Returns an interpolation if there are multiple parts, otherwise a plain Literal. This keeps the AST somewhat simpler, but also is the only way `Literal.from_bareword` gets called.
[ "Returns", "an", "interpolation", "if", "there", "are", "multiple", "parts", "otherwise", "a", "plain", "Literal", ".", "This", "keeps", "the", "AST", "somewhat", "simpler", "but", "also", "is", "the", "only", "way", "Literal", ".", "from_bareword", "gets", ...
fb32b317f6e2b4b4aad2b86a74844658ac4aa11e
https://github.com/Kronuz/pyScss/blob/fb32b317f6e2b4b4aad2b86a74844658ac4aa11e/scss/ast.py#L274-L285
train