Search is not available for this dataset
identifier
stringlengths
1
155
parameters
stringlengths
2
6.09k
docstring
stringlengths
11
63.4k
docstring_summary
stringlengths
0
63.4k
function
stringlengths
29
99.8k
function_tokens
list
start_point
list
end_point
list
language
stringclasses
1 value
docstring_language
stringlengths
2
7
docstring_language_predictions
stringlengths
18
23
is_langid_reliable
stringclasses
2 values
Image.putpalette
(self, data, rawmode="RGB")
Attaches a palette to this image. The image must be a "P", "PA", "L" or "LA" image. The palette sequence must contain at most 768 integer values, or 1024 integer values if alpha is included. Each group of values represents the red, green, blue (and alpha if included) values fo...
Attaches a palette to this image. The image must be a "P", "PA", "L" or "LA" image.
def putpalette(self, data, rawmode="RGB"): """ Attaches a palette to this image. The image must be a "P", "PA", "L" or "LA" image. The palette sequence must contain at most 768 integer values, or 1024 integer values if alpha is included. Each group of values represents ...
[ "def", "putpalette", "(", "self", ",", "data", ",", "rawmode", "=", "\"RGB\"", ")", ":", "from", ".", "import", "ImagePalette", "if", "self", ".", "mode", "not", "in", "(", "\"L\"", ",", "\"LA\"", ",", "\"P\"", ",", "\"PA\"", ")", ":", "raise", "Valu...
[ 1748, 4 ]
[ 1775, 19 ]
python
en
['en', 'error', 'th']
False
Image.putpixel
(self, xy, value)
Modifies the pixel at the given position. The color is given as a single numerical value for single-band images, and a tuple for multi-band images. In addition to this, RGB and RGBA tuples are accepted for P images. Note that this method is relatively slow. For more extensive ...
Modifies the pixel at the given position. The color is given as a single numerical value for single-band images, and a tuple for multi-band images. In addition to this, RGB and RGBA tuples are accepted for P images.
def putpixel(self, xy, value): """ Modifies the pixel at the given position. The color is given as a single numerical value for single-band images, and a tuple for multi-band images. In addition to this, RGB and RGBA tuples are accepted for P images. Note that this metho...
[ "def", "putpixel", "(", "self", ",", "xy", ",", "value", ")", ":", "if", "self", ".", "readonly", ":", "self", ".", "_copy", "(", ")", "self", ".", "load", "(", ")", "if", "self", ".", "pyaccess", ":", "return", "self", ".", "pyaccess", ".", "put...
[ 1777, 4 ]
[ 1813, 42 ]
python
en
['en', 'error', 'th']
False
Image.remap_palette
(self, dest_map, source_palette=None)
Rewrites the image to reorder the palette. :param dest_map: A list of indexes into the original palette. e.g. ``[1,0]`` would swap a two item palette, and ``list(range(256))`` is the identity transform. :param source_palette: Bytes or None. :returns: An :py:class...
Rewrites the image to reorder the palette.
def remap_palette(self, dest_map, source_palette=None): """ Rewrites the image to reorder the palette. :param dest_map: A list of indexes into the original palette. e.g. ``[1,0]`` would swap a two item palette, and ``list(range(256))`` is the identity transform. :p...
[ "def", "remap_palette", "(", "self", ",", "dest_map", ",", "source_palette", "=", "None", ")", ":", "from", ".", "import", "ImagePalette", "if", "self", ".", "mode", "not", "in", "(", "\"L\"", ",", "\"P\"", ")", ":", "raise", "ValueError", "(", "\"illega...
[ 1815, 4 ]
[ 1885, 19 ]
python
en
['en', 'error', 'th']
False
Image._get_safe_box
(self, size, resample, box)
Expands the box so it includes adjacent pixels that may be used by resampling with the given resampling filter.
Expands the box so it includes adjacent pixels that may be used by resampling with the given resampling filter.
def _get_safe_box(self, size, resample, box): """Expands the box so it includes adjacent pixels that may be used by resampling with the given resampling filter. """ filter_support = _filters_support[resample] - 0.5 scale_x = (box[2] - box[0]) / size[0] scale_y = (box[3] -...
[ "def", "_get_safe_box", "(", "self", ",", "size", ",", "resample", ",", "box", ")", ":", "filter_support", "=", "_filters_support", "[", "resample", "]", "-", "0.5", "scale_x", "=", "(", "box", "[", "2", "]", "-", "box", "[", "0", "]", ")", "/", "s...
[ 1887, 4 ]
[ 1902, 9 ]
python
en
['en', 'fr', 'en']
True
Image.resize
(self, size, resample=None, box=None, reducing_gap=None)
Returns a resized copy of this image. :param size: The requested size in pixels, as a 2-tuple: (width, height). :param resample: An optional resampling filter. This can be one of :py:data:`PIL.Image.NEAREST`, :py:data:`PIL.Image.BOX`, :py:data:`PIL.Image.BILIN...
Returns a resized copy of this image.
def resize(self, size, resample=None, box=None, reducing_gap=None): """ Returns a resized copy of this image. :param size: The requested size in pixels, as a 2-tuple: (width, height). :param resample: An optional resampling filter. This can be one of :py:data:`PIL...
[ "def", "resize", "(", "self", ",", "size", ",", "resample", "=", "None", ",", "box", "=", "None", ",", "reducing_gap", "=", "None", ")", ":", "if", "resample", "is", "None", ":", "type_special", "=", "\";\"", "in", "self", ".", "mode", "resample", "=...
[ 1904, 4 ]
[ 2000, 61 ]
python
en
['en', 'error', 'th']
False
Image.reduce
(self, factor, box=None)
Returns a copy of the image reduced ``factor`` times. If the size of the image is not dividable by ``factor``, the resulting size will be rounded up. :param factor: A greater than 0 integer or tuple of two integers for width and height separately. :param box: An opti...
Returns a copy of the image reduced ``factor`` times. If the size of the image is not dividable by ``factor``, the resulting size will be rounded up.
def reduce(self, factor, box=None): """ Returns a copy of the image reduced ``factor`` times. If the size of the image is not dividable by ``factor``, the resulting size will be rounded up. :param factor: A greater than 0 integer or tuple of two integers for width and...
[ "def", "reduce", "(", "self", ",", "factor", ",", "box", "=", "None", ")", ":", "if", "not", "isinstance", "(", "factor", ",", "(", "list", ",", "tuple", ")", ")", ":", "factor", "=", "(", "factor", ",", "factor", ")", "if", "box", "is", "None", ...
[ 2002, 4 ]
[ 2033, 53 ]
python
en
['en', 'error', 'th']
False
Image.rotate
( self, angle, resample=NEAREST, expand=0, center=None, translate=None, fillcolor=None, )
Returns a rotated copy of this image. This method returns a copy of this image, rotated the given number of degrees counter clockwise around its centre. :param angle: In degrees counter clockwise. :param resample: An optional resampling filter. This can be one of :...
Returns a rotated copy of this image. This method returns a copy of this image, rotated the given number of degrees counter clockwise around its centre.
def rotate( self, angle, resample=NEAREST, expand=0, center=None, translate=None, fillcolor=None, ): """ Returns a rotated copy of this image. This method returns a copy of this image, rotated the given number of degrees counter ...
[ "def", "rotate", "(", "self", ",", "angle", ",", "resample", "=", "NEAREST", ",", "expand", "=", "0", ",", "center", "=", "None", ",", "translate", "=", "None", ",", "fillcolor", "=", "None", ",", ")", ":", "angle", "=", "angle", "%", "360.0", "# F...
[ 2035, 4 ]
[ 2150, 84 ]
python
en
['en', 'error', 'th']
False
Image.save
(self, fp, format=None, **params)
Saves this image under the given filename. If no format is specified, the format to use is determined from the filename extension, if possible. Keyword options can be used to provide additional instructions to the writer. If a writer doesn't recognise an option, it is ...
Saves this image under the given filename. If no format is specified, the format to use is determined from the filename extension, if possible.
def save(self, fp, format=None, **params): """ Saves this image under the given filename. If no format is specified, the format to use is determined from the filename extension, if possible. Keyword options can be used to provide additional instructions to the writer. I...
[ "def", "save", "(", "self", ",", "fp", ",", "format", "=", "None", ",", "*", "*", "params", ")", ":", "filename", "=", "\"\"", "open_fp", "=", "False", "if", "isPath", "(", "fp", ")", ":", "filename", "=", "fp", "open_fp", "=", "True", "elif", "i...
[ 2152, 4 ]
[ 2238, 26 ]
python
en
['en', 'error', 'th']
False
Image.seek
(self, frame)
Seeks to the given frame in this sequence file. If you seek beyond the end of the sequence, the method raises an ``EOFError`` exception. When a sequence file is opened, the library automatically seeks to frame 0. See :py:meth:`~PIL.Image.Image.tell`. If defined, :attr:...
Seeks to the given frame in this sequence file. If you seek beyond the end of the sequence, the method raises an ``EOFError`` exception. When a sequence file is opened, the library automatically seeks to frame 0.
def seek(self, frame): """ Seeks to the given frame in this sequence file. If you seek beyond the end of the sequence, the method raises an ``EOFError`` exception. When a sequence file is opened, the library automatically seeks to frame 0. See :py:meth:`~PIL.Image.Image....
[ "def", "seek", "(", "self", ",", "frame", ")", ":", "# overridden by file handlers", "if", "frame", "!=", "0", ":", "raise", "EOFError" ]
[ 2240, 4 ]
[ 2259, 26 ]
python
en
['en', 'error', 'th']
False
Image.show
(self, title=None, command=None)
Displays this image. This method is mainly intended for debugging purposes. This method calls :py:func:`PIL.ImageShow.show` internally. You can use :py:func:`PIL.ImageShow.register` to override its default behaviour. The image is first saved to a temporary file. By default, it will be...
Displays this image. This method is mainly intended for debugging purposes.
def show(self, title=None, command=None): """ Displays this image. This method is mainly intended for debugging purposes. This method calls :py:func:`PIL.ImageShow.show` internally. You can use :py:func:`PIL.ImageShow.register` to override its default behaviour. The image is fi...
[ "def", "show", "(", "self", ",", "title", "=", "None", ",", "command", "=", "None", ")", ":", "if", "command", "is", "not", "None", ":", "warnings", ".", "warn", "(", "\"The command parameter is deprecated and will be removed in Pillow 9 \"", "\"(2022-01-02). Use a ...
[ 2261, 4 ]
[ 2288, 49 ]
python
en
['en', 'error', 'th']
False
Image.split
(self)
Split this image into individual bands. This method returns a tuple of individual image bands from an image. For example, splitting an "RGB" image creates three new images each containing a copy of one of the original bands (red, green, blue). If you need only one band,...
Split this image into individual bands. This method returns a tuple of individual image bands from an image. For example, splitting an "RGB" image creates three new images each containing a copy of one of the original bands (red, green, blue).
def split(self): """ Split this image into individual bands. This method returns a tuple of individual image bands from an image. For example, splitting an "RGB" image creates three new images each containing a copy of one of the original bands (red, green, blue). ...
[ "def", "split", "(", "self", ")", ":", "self", ".", "load", "(", ")", "if", "self", ".", "im", ".", "bands", "==", "1", ":", "ims", "=", "[", "self", ".", "copy", "(", ")", "]", "else", ":", "ims", "=", "map", "(", "self", ".", "_new", ",",...
[ 2290, 4 ]
[ 2309, 25 ]
python
en
['en', 'error', 'th']
False
Image.getchannel
(self, channel)
Returns an image containing a single channel of the source image. :param channel: What channel to return. Could be index (0 for "R" channel of "RGB") or channel name ("A" for alpha channel of "RGBA"). :returns: An image in "L" mode. .. versionadded:: 4.3.0
Returns an image containing a single channel of the source image.
def getchannel(self, channel): """ Returns an image containing a single channel of the source image. :param channel: What channel to return. Could be index (0 for "R" channel of "RGB") or channel name ("A" for alpha channel of "RGBA"). :returns: An image in "L" mode....
[ "def", "getchannel", "(", "self", ",", "channel", ")", ":", "self", ".", "load", "(", ")", "if", "isinstance", "(", "channel", ",", "str", ")", ":", "try", ":", "channel", "=", "self", ".", "getbands", "(", ")", ".", "index", "(", "channel", ")", ...
[ 2311, 4 ]
[ 2330, 50 ]
python
en
['en', 'error', 'th']
False
Image.tell
(self)
Returns the current frame number. See :py:meth:`~PIL.Image.Image.seek`. If defined, :attr:`~PIL.Image.Image.n_frames` refers to the number of available frames. :returns: Frame number, starting with 0.
Returns the current frame number. See :py:meth:`~PIL.Image.Image.seek`.
def tell(self): """ Returns the current frame number. See :py:meth:`~PIL.Image.Image.seek`. If defined, :attr:`~PIL.Image.Image.n_frames` refers to the number of available frames. :returns: Frame number, starting with 0. """ return 0
[ "def", "tell", "(", "self", ")", ":", "return", "0" ]
[ 2332, 4 ]
[ 2341, 16 ]
python
en
['en', 'error', 'th']
False
Image.thumbnail
(self, size, resample=BICUBIC, reducing_gap=2.0)
Make this image into a thumbnail. This method modifies the image to contain a thumbnail version of itself, no larger than the given size. This method calculates an appropriate thumbnail size to preserve the aspect of the image, calls the :py:meth:`~PIL.Image.Image.draft` metho...
Make this image into a thumbnail. This method modifies the image to contain a thumbnail version of itself, no larger than the given size. This method calculates an appropriate thumbnail size to preserve the aspect of the image, calls the :py:meth:`~PIL.Image.Image.draft` metho...
def thumbnail(self, size, resample=BICUBIC, reducing_gap=2.0): """ Make this image into a thumbnail. This method modifies the image to contain a thumbnail version of itself, no larger than the given size. This method calculates an appropriate thumbnail size to preserve the aspe...
[ "def", "thumbnail", "(", "self", ",", "size", ",", "resample", "=", "BICUBIC", ",", "reducing_gap", "=", "2.0", ")", ":", "x", ",", "y", "=", "map", "(", "math", ".", "floor", ",", "size", ")", "if", "x", ">=", "self", ".", "width", "and", "y", ...
[ 2343, 4 ]
[ 2413, 28 ]
python
en
['en', 'error', 'th']
False
Image.transform
( self, size, method, data=None, resample=NEAREST, fill=1, fillcolor=None )
Transforms this image. This method creates a new image with the given size, and the same mode as the original, and copies data to the new image using the given transform. :param size: The output size. :param method: The transformation method. This is one of :py:data...
Transforms this image. This method creates a new image with the given size, and the same mode as the original, and copies data to the new image using the given transform.
def transform( self, size, method, data=None, resample=NEAREST, fill=1, fillcolor=None ): """ Transforms this image. This method creates a new image with the given size, and the same mode as the original, and copies data to the new image using the given transform. :...
[ "def", "transform", "(", "self", ",", "size", ",", "method", ",", "data", "=", "None", ",", "resample", "=", "NEAREST", ",", "fill", "=", "1", ",", "fillcolor", "=", "None", ")", ":", "if", "self", ".", "mode", "in", "(", "\"LA\"", ",", "\"RGBA\"",...
[ 2417, 4 ]
[ 2493, 17 ]
python
en
['en', 'error', 'th']
False
Image.transpose
(self, method)
Transpose image (flip or rotate in 90 degree steps) :param method: One of :py:data:`PIL.Image.FLIP_LEFT_RIGHT`, :py:data:`PIL.Image.FLIP_TOP_BOTTOM`, :py:data:`PIL.Image.ROTATE_90`, :py:data:`PIL.Image.ROTATE_180`, :py:data:`PIL.Image.ROTATE_270`, :py:data:`PIL.Image.TRAN...
Transpose image (flip or rotate in 90 degree steps)
def transpose(self, method): """ Transpose image (flip or rotate in 90 degree steps) :param method: One of :py:data:`PIL.Image.FLIP_LEFT_RIGHT`, :py:data:`PIL.Image.FLIP_TOP_BOTTOM`, :py:data:`PIL.Image.ROTATE_90`, :py:data:`PIL.Image.ROTATE_180`, :py:data:`PIL.Image.ROTATE_...
[ "def", "transpose", "(", "self", ",", "method", ")", ":", "self", ".", "load", "(", ")", "return", "self", ".", "_new", "(", "self", ".", "im", ".", "transpose", "(", "method", ")", ")" ]
[ 2568, 4 ]
[ 2580, 51 ]
python
en
['en', 'error', 'th']
False
Image.effect_spread
(self, distance)
Randomly spread pixels in an image. :param distance: Distance to spread pixels.
Randomly spread pixels in an image.
def effect_spread(self, distance): """ Randomly spread pixels in an image. :param distance: Distance to spread pixels. """ self.load() return self._new(self.im.effect_spread(distance))
[ "def", "effect_spread", "(", "self", ",", "distance", ")", ":", "self", ".", "load", "(", ")", "return", "self", ".", "_new", "(", "self", ".", "im", ".", "effect_spread", "(", "distance", ")", ")" ]
[ 2582, 4 ]
[ 2589, 57 ]
python
en
['en', 'error', 'th']
False
Image.toqimage
(self)
Returns a QImage copy of this image
Returns a QImage copy of this image
def toqimage(self): """Returns a QImage copy of this image""" from . import ImageQt if not ImageQt.qt_is_installed: raise ImportError("Qt bindings are not installed") return ImageQt.toqimage(self)
[ "def", "toqimage", "(", "self", ")", ":", "from", ".", "import", "ImageQt", "if", "not", "ImageQt", ".", "qt_is_installed", ":", "raise", "ImportError", "(", "\"Qt bindings are not installed\"", ")", "return", "ImageQt", ".", "toqimage", "(", "self", ")" ]
[ 2591, 4 ]
[ 2597, 37 ]
python
en
['en', 'en', 'en']
True
Image.toqpixmap
(self)
Returns a QPixmap copy of this image
Returns a QPixmap copy of this image
def toqpixmap(self): """Returns a QPixmap copy of this image""" from . import ImageQt if not ImageQt.qt_is_installed: raise ImportError("Qt bindings are not installed") return ImageQt.toqpixmap(self)
[ "def", "toqpixmap", "(", "self", ")", ":", "from", ".", "import", "ImageQt", "if", "not", "ImageQt", ".", "qt_is_installed", ":", "raise", "ImportError", "(", "\"Qt bindings are not installed\"", ")", "return", "ImageQt", ".", "toqpixmap", "(", "self", ")" ]
[ 2599, 4 ]
[ 2605, 38 ]
python
en
['en', 'ca', 'en']
True
AnsiToWin32.should_wrap
(self)
True if this class is actually needed. If false, then the output stream will not be affected, nor will win32 calls be issued, so wrapping stdout is not actually required. This will generally be False on non-Windows platforms, unless optional functionality like autoreset has been...
True if this class is actually needed. If false, then the output stream will not be affected, nor will win32 calls be issued, so wrapping stdout is not actually required. This will generally be False on non-Windows platforms, unless optional functionality like autoreset has been...
def should_wrap(self): ''' True if this class is actually needed. If false, then the output stream will not be affected, nor will win32 calls be issued, so wrapping stdout is not actually required. This will generally be False on non-Windows platforms, unless optional functionali...
[ "def", "should_wrap", "(", "self", ")", ":", "return", "self", ".", "convert", "or", "self", ".", "strip", "or", "self", ".", "autoreset" ]
[ 105, 4 ]
[ 113, 59 ]
python
en
['en', 'error', 'th']
False
AnsiToWin32.write_and_convert
(self, text)
Write the given text to our wrapped stream, stripping any ANSI sequences from the text, and optionally converting them into win32 calls.
Write the given text to our wrapped stream, stripping any ANSI sequences from the text, and optionally converting them into win32 calls.
def write_and_convert(self, text): ''' Write the given text to our wrapped stream, stripping any ANSI sequences from the text, and optionally converting them into win32 calls. ''' cursor = 0 text = self.convert_osc(text) for match in self.ANSI_CSI_RE.findi...
[ "def", "write_and_convert", "(", "self", ",", "text", ")", ":", "cursor", "=", "0", "text", "=", "self", ".", "convert_osc", "(", "text", ")", "for", "match", "in", "self", ".", "ANSI_CSI_RE", ".", "finditer", "(", "text", ")", ":", "start", ",", "en...
[ 176, 4 ]
[ 189, 54 ]
python
en
['en', 'error', 'th']
False
url_to_file_path
(url, filecache)
Return the file cache path based on the URL. This does not ensure the file exists!
Return the file cache path based on the URL.
def url_to_file_path(url, filecache): """Return the file cache path based on the URL. This does not ensure the file exists! """ key = CacheController.cache_url(url) return filecache._fn(key)
[ "def", "url_to_file_path", "(", "url", ",", "filecache", ")", ":", "key", "=", "CacheController", ".", "cache_url", "(", "url", ")", "return", "filecache", ".", "_fn", "(", "key", ")" ]
[ 139, 0 ]
[ 145, 29 ]
python
en
['en', 'en', 'en']
True
get_searchresult
(site, bot, channel, args, nick)
The flesh of this module. Parse the search result and return title & link
The flesh of this module. Parse the search result and return title & link
def get_searchresult(site, bot, channel, args, nick): "The flesh of this module. Parse the search result and return title & link" cx = bot.factory.network.get(site) if not cx: return bot.say(channel, "Could not find a CX ID.") url = "https://www.googleapis.com/customsearch/v1?q=%s&cx=%s&num=1&...
[ "def", "get_searchresult", "(", "site", ",", "bot", ",", "channel", ",", "args", ",", "nick", ")", ":", "cx", "=", "bot", ".", "factory", ".", "network", ".", "get", "(", "site", ")", "if", "not", "cx", ":", "return", "bot", ".", "say", "(", "cha...
[ 15, 0 ]
[ 38, 74 ]
python
en
['en', 'en', 'en']
True
command_g
(bot, user, channel, args)
Searches Google and returns the first result. Usage: g <searchterm>
Searches Google and returns the first result. Usage: g <searchterm>
def command_g(bot, user, channel, args): "Searches Google and returns the first result. Usage: g <searchterm>" if not args: return bot.say(channel, "Usage: g <searchterm>.") get_searchresult("gcx", bot, channel, args, get_nick(user))
[ "def", "command_g", "(", "bot", ",", "user", ",", "channel", ",", "args", ")", ":", "if", "not", "args", ":", "return", "bot", ".", "say", "(", "channel", ",", "\"Usage: g <searchterm>.\"", ")", "get_searchresult", "(", "\"gcx\"", ",", "bot", ",", "chann...
[ 41, 0 ]
[ 47, 63 ]
python
en
['en', 'en', 'en']
True
command_yt
(bot, user, channel, args)
Searches Youtube and returns the first result. Usage: yt <searchterm>
Searches Youtube and returns the first result. Usage: yt <searchterm>
def command_yt(bot, user, channel, args): "Searches Youtube and returns the first result. Usage: yt <searchterm>" if not args: return bot.say(channel, "Usage: yt <searchterm>.") get_searchresult("ytcx", bot, channel, args, get_nick(user))
[ "def", "command_yt", "(", "bot", ",", "user", ",", "channel", ",", "args", ")", ":", "if", "not", "args", ":", "return", "bot", ".", "say", "(", "channel", ",", "\"Usage: yt <searchterm>.\"", ")", "get_searchresult", "(", "\"ytcx\"", ",", "bot", ",", "ch...
[ 50, 0 ]
[ 56, 64 ]
python
en
['en', 'en', 'en']
True
command_wiki
(bot, user, channel, args)
Searches Wikipedia and returns the first result. Usage: wiki <searchterm>
Searches Wikipedia and returns the first result. Usage: wiki <searchterm>
def command_wiki(bot, user, channel, args): "Searches Wikipedia and returns the first result. Usage: wiki <searchterm>" if not args: return bot.say(channel, "Usage: wiki <searchterm>.") get_searchresult("wikicx", bot, channel, args, get_nick(user))
[ "def", "command_wiki", "(", "bot", ",", "user", ",", "channel", ",", "args", ")", ":", "if", "not", "args", ":", "return", "bot", ".", "say", "(", "channel", ",", "\"Usage: wiki <searchterm>.\"", ")", "get_searchresult", "(", "\"wikicx\"", ",", "bot", ",",...
[ 59, 0 ]
[ 65, 66 ]
python
en
['en', 'en', 'en']
True
Distribution.patch
(cls)
Replace distutils.dist.Distribution with this class for the duration of this context.
Replace distutils.dist.Distribution with this class for the duration of this context.
def patch(cls): """ Replace distutils.dist.Distribution with this class for the duration of this context. """ orig = distutils.core.Distribution distutils.core.Distribution = cls try: yield finally: distutils.core.Distributi...
[ "def", "patch", "(", "cls", ")", ":", "orig", "=", "distutils", ".", "core", ".", "Distribution", "distutils", ".", "core", ".", "Distribution", "=", "cls", "try", ":", "yield", "finally", ":", "distutils", ".", "core", ".", "Distribution", "=", "orig" ]
[ 49, 4 ]
[ 60, 46 ]
python
en
['en', 'error', 'th']
False
get_return_data_type
(func_name)
Return a somewhat-helpful data type given a function name
Return a somewhat-helpful data type given a function name
def get_return_data_type(func_name): """Return a somewhat-helpful data type given a function name""" if func_name.startswith('get_'): if func_name.endswith('_list'): return 'List' elif func_name.endswith('_count'): return 'Integer' return ''
[ "def", "get_return_data_type", "(", "func_name", ")", ":", "if", "func_name", ".", "startswith", "(", "'get_'", ")", ":", "if", "func_name", ".", "endswith", "(", "'_list'", ")", ":", "return", "'List'", "elif", "func_name", ".", "endswith", "(", "'_count'",...
[ 355, 0 ]
[ 362, 13 ]
python
en
['en', 'en', 'en']
True
get_readable_field_data_type
(field)
Return the description for a given field type, if it exists. Fields' descriptions can contain format strings, which will be interpolated with the values of field.__dict__ before being output.
Return the description for a given field type, if it exists. Fields' descriptions can contain format strings, which will be interpolated with the values of field.__dict__ before being output.
def get_readable_field_data_type(field): """ Return the description for a given field type, if it exists. Fields' descriptions can contain format strings, which will be interpolated with the values of field.__dict__ before being output. """ return field.description % field.__dict__
[ "def", "get_readable_field_data_type", "(", "field", ")", ":", "return", "field", ".", "description", "%", "field", ".", "__dict__" ]
[ 365, 0 ]
[ 371, 45 ]
python
en
['en', 'error', 'th']
False
extract_views_from_urlpatterns
(urlpatterns, base='', namespace=None)
Return a list of views from a list of urlpatterns. Each object in the returned list is a two-tuple: (view_func, regex)
Return a list of views from a list of urlpatterns.
def extract_views_from_urlpatterns(urlpatterns, base='', namespace=None): """ Return a list of views from a list of urlpatterns. Each object in the returned list is a two-tuple: (view_func, regex) """ views = [] for p in urlpatterns: if hasattr(p, 'url_patterns'): try: ...
[ "def", "extract_views_from_urlpatterns", "(", "urlpatterns", ",", "base", "=", "''", ",", "namespace", "=", "None", ")", ":", "views", "=", "[", "]", "for", "p", "in", "urlpatterns", ":", "if", "hasattr", "(", "p", ",", "'url_patterns'", ")", ":", "try",...
[ 374, 0 ]
[ 399, 16 ]
python
en
['en', 'error', 'th']
False
simplify_regex
(pattern)
r""" Clean up urlpattern regexes into something more readable by humans. For example, turn "^(?P<sport_slug>\w+)/athletes/(?P<athlete_slug>\w+)/$" into "/<sport_slug>/athletes/<athlete_slug>/".
r""" Clean up urlpattern regexes into something more readable by humans. For example, turn "^(?P<sport_slug>\w+)/athletes/(?P<athlete_slug>\w+)/$" into "/<sport_slug>/athletes/<athlete_slug>/".
def simplify_regex(pattern): r""" Clean up urlpattern regexes into something more readable by humans. For example, turn "^(?P<sport_slug>\w+)/athletes/(?P<athlete_slug>\w+)/$" into "/<sport_slug>/athletes/<athlete_slug>/". """ pattern = replace_named_groups(pattern) pattern = replace_unnamed...
[ "def", "simplify_regex", "(", "pattern", ")", ":", "pattern", "=", "replace_named_groups", "(", "pattern", ")", "pattern", "=", "replace_unnamed_groups", "(", "pattern", ")", "# clean up any outstanding regex-y characters.", "pattern", "=", "pattern", ".", "replace", ...
[ 402, 0 ]
[ 414, 18 ]
python
cy
['en', 'cy', 'hi']
False
sdist_add_defaults.add_defaults
(self)
Add all the default files to self.filelist: - README or README.txt - setup.py - test/test*.py - all pure Python modules mentioned in setup script - all files pointed by package_data (build_py) - all files defined in data_files. - all files defined as...
Add all the default files to self.filelist: - README or README.txt - setup.py - test/test*.py - all pure Python modules mentioned in setup script - all files pointed by package_data (build_py) - all files defined in data_files. - all files defined as...
def add_defaults(self): """Add all the default files to self.filelist: - README or README.txt - setup.py - test/test*.py - all pure Python modules mentioned in setup script - all files pointed by package_data (build_py) - all files defined in data_file...
[ "def", "add_defaults", "(", "self", ")", ":", "self", ".", "_add_defaults_standards", "(", ")", "self", ".", "_add_defaults_optional", "(", ")", "self", ".", "_add_defaults_python", "(", ")", "self", ".", "_add_defaults_data_files", "(", ")", "self", ".", "_ad...
[ 17, 4 ]
[ 37, 36 ]
python
en
['en', 'en', 'en']
True
sdist_add_defaults._cs_path_exists
(fspath)
Case-sensitive path existence check >>> sdist_add_defaults._cs_path_exists(__file__) True >>> sdist_add_defaults._cs_path_exists(__file__.upper()) False
Case-sensitive path existence check
def _cs_path_exists(fspath): """ Case-sensitive path existence check >>> sdist_add_defaults._cs_path_exists(__file__) True >>> sdist_add_defaults._cs_path_exists(__file__.upper()) False """ if not os.path.exists(fspath): return False #...
[ "def", "_cs_path_exists", "(", "fspath", ")", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "fspath", ")", ":", "return", "False", "# make absolute so we always have a directory", "abspath", "=", "os", ".", "path", ".", "abspath", "(", "fspath", "...
[ 40, 4 ]
[ 54, 48 ]
python
en
['en', 'error', 'th']
False
stream_encode_multipart
( values, use_tempfile=True, threshold=1024 * 500, boundary=None, charset="utf-8" )
Encode a dict of values (either strings or file descriptors or :class:`FileStorage` objects.) into a multipart encoded string stored in a file descriptor.
Encode a dict of values (either strings or file descriptors or :class:`FileStorage` objects.) into a multipart encoded string stored in a file descriptor.
def stream_encode_multipart( values, use_tempfile=True, threshold=1024 * 500, boundary=None, charset="utf-8" ): """Encode a dict of values (either strings or file descriptors or :class:`FileStorage` objects.) into a multipart encoded string stored in a file descriptor. """ if boundary is None: ...
[ "def", "stream_encode_multipart", "(", "values", ",", "use_tempfile", "=", "True", ",", "threshold", "=", "1024", "*", "500", ",", "boundary", "=", "None", ",", "charset", "=", "\"utf-8\"", ")", ":", "if", "boundary", "is", "None", ":", "boundary", "=", ...
[ 60, 0 ]
[ 133, 40 ]
python
en
['en', 'en', 'en']
True
encode_multipart
(values, boundary=None, charset="utf-8")
Like `stream_encode_multipart` but returns a tuple in the form (``boundary``, ``data``) where data is a bytestring.
Like `stream_encode_multipart` but returns a tuple in the form (``boundary``, ``data``) where data is a bytestring.
def encode_multipart(values, boundary=None, charset="utf-8"): """Like `stream_encode_multipart` but returns a tuple in the form (``boundary``, ``data``) where data is a bytestring. """ stream, length, boundary = stream_encode_multipart( values, use_tempfile=False, boundary=boundary, charset=char...
[ "def", "encode_multipart", "(", "values", ",", "boundary", "=", "None", ",", "charset", "=", "\"utf-8\"", ")", ":", "stream", ",", "length", ",", "boundary", "=", "stream_encode_multipart", "(", "values", ",", "use_tempfile", "=", "False", ",", "boundary", "...
[ 136, 0 ]
[ 143, 34 ]
python
en
['en', 'en', 'en']
True
File
(fd, filename=None, mimetype=None)
Backwards compat. .. deprecated:: 0.5
Backwards compat.
def File(fd, filename=None, mimetype=None): """Backwards compat. .. deprecated:: 0.5 """ from warnings import warn warn( "'werkzeug.test.File' is deprecated as of version 0.5 and will" " be removed in version 1.0. Use 'EnvironBuilder' or" " 'FileStorage' instead.", ...
[ "def", "File", "(", "fd", ",", "filename", "=", "None", ",", "mimetype", "=", "None", ")", ":", "from", "warnings", "import", "warn", "warn", "(", "\"'werkzeug.test.File' is deprecated as of version 0.5 and will\"", "\" be removed in version 1.0. Use 'EnvironBuilder' or\"",...
[ 146, 0 ]
[ 160, 68 ]
python
en
['en', 'da', 'en']
False
_iter_data
(data)
Iterates over a `dict` or :class:`MultiDict` yielding all keys and values. This is used to iterate over the data passed to the :class:`EnvironBuilder`.
Iterates over a `dict` or :class:`MultiDict` yielding all keys and values. This is used to iterate over the data passed to the :class:`EnvironBuilder`.
def _iter_data(data): """Iterates over a `dict` or :class:`MultiDict` yielding all keys and values. This is used to iterate over the data passed to the :class:`EnvironBuilder`. """ if isinstance(data, MultiDict): for key, values in iterlists(data): for value in values: ...
[ "def", "_iter_data", "(", "data", ")", ":", "if", "isinstance", "(", "data", ",", "MultiDict", ")", ":", "for", "key", ",", "values", "in", "iterlists", "(", "data", ")", ":", "for", "value", "in", "values", ":", "yield", "key", ",", "value", "else",...
[ 226, 0 ]
[ 242, 33 ]
python
en
['en', 'en', 'en']
True
create_environ
(*args, **kwargs)
Create a new WSGI environ dict based on the values passed. The first parameter should be the path of the request which defaults to '/'. The second one can either be an absolute path (in that case the host is localhost:80) or a full path to the request with scheme, netloc port and the path to the scrip...
Create a new WSGI environ dict based on the values passed. The first parameter should be the path of the request which defaults to '/'. The second one can either be an absolute path (in that case the host is localhost:80) or a full path to the request with scheme, netloc port and the path to the scrip...
def create_environ(*args, **kwargs): """Create a new WSGI environ dict based on the values passed. The first parameter should be the path of the request which defaults to '/'. The second one can either be an absolute path (in that case the host is localhost:80) or a full path to the request with schem...
[ "def", "create_environ", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "builder", "=", "EnvironBuilder", "(", "*", "args", ",", "*", "*", "kwargs", ")", "try", ":", "return", "builder", ".", "get_environ", "(", ")", "finally", ":", "builder", ...
[ 1069, 0 ]
[ 1088, 23 ]
python
en
['en', 'en', 'en']
True
run_wsgi_app
(app, environ, buffered=False)
Return a tuple in the form (app_iter, status, headers) of the application output. This works best if you pass it an application that returns an iterator all the time. Sometimes applications may use the `write()` callable returned by the `start_response` function. This tries to resolve such edge c...
Return a tuple in the form (app_iter, status, headers) of the application output. This works best if you pass it an application that returns an iterator all the time.
def run_wsgi_app(app, environ, buffered=False): """Return a tuple in the form (app_iter, status, headers) of the application output. This works best if you pass it an application that returns an iterator all the time. Sometimes applications may use the `write()` callable returned by the `start_res...
[ "def", "run_wsgi_app", "(", "app", ",", "environ", ",", "buffered", "=", "False", ")", ":", "environ", "=", "_get_environ", "(", "environ", ")", "response", "=", "[", "]", "buffer", "=", "[", "]", "def", "start_response", "(", "status", ",", "headers", ...
[ 1091, 0 ]
[ 1145, 54 ]
python
en
['en', 'en', 'en']
True
_TestCookieJar.inject_wsgi
(self, environ)
Inject the cookies as client headers into the server's wsgi environment.
Inject the cookies as client headers into the server's wsgi environment.
def inject_wsgi(self, environ): """Inject the cookies as client headers into the server's wsgi environment. """ cvals = ["%s=%s" % (c.name, c.value) for c in self] if cvals: environ["HTTP_COOKIE"] = "; ".join(cvals) else: environ.pop("HTTP_COOKIE"...
[ "def", "inject_wsgi", "(", "self", ",", "environ", ")", ":", "cvals", "=", "[", "\"%s=%s\"", "%", "(", "c", ".", "name", ",", "c", ".", "value", ")", "for", "c", "in", "self", "]", "if", "cvals", ":", "environ", "[", "\"HTTP_COOKIE\"", "]", "=", ...
[ 206, 4 ]
[ 215, 44 ]
python
en
['en', 'en', 'en']
True
_TestCookieJar.extract_wsgi
(self, environ, headers)
Extract the server's set-cookie headers as cookies into the cookie jar.
Extract the server's set-cookie headers as cookies into the cookie jar.
def extract_wsgi(self, environ, headers): """Extract the server's set-cookie headers as cookies into the cookie jar. """ self.extract_cookies( _TestCookieResponse(headers), U2Request(get_current_url(environ)) )
[ "def", "extract_wsgi", "(", "self", ",", "environ", ",", "headers", ")", ":", "self", ".", "extract_cookies", "(", "_TestCookieResponse", "(", "headers", ")", ",", "U2Request", "(", "get_current_url", "(", "environ", ")", ")", ")" ]
[ 217, 4 ]
[ 223, 9 ]
python
en
['en', 'en', 'en']
True
EnvironBuilder.from_environ
(cls, environ, **kwargs)
Turn an environ dict back into a builder. Any extra kwargs override the args extracted from the environ. .. versionadded:: 0.15
Turn an environ dict back into a builder. Any extra kwargs override the args extracted from the environ.
def from_environ(cls, environ, **kwargs): """Turn an environ dict back into a builder. Any extra kwargs override the args extracted from the environ. .. versionadded:: 0.15 """ headers = Headers(EnvironHeaders(environ)) out = { "path": environ["PATH_INFO"], ...
[ "def", "from_environ", "(", "cls", ",", "environ", ",", "*", "*", "kwargs", ")", ":", "headers", "=", "Headers", "(", "EnvironHeaders", "(", "environ", ")", ")", "out", "=", "{", "\"path\"", ":", "environ", "[", "\"PATH_INFO\"", "]", ",", "\"base_url\"",...
[ 429, 4 ]
[ 453, 25 ]
python
en
['es', 'en', 'sw']
False
EnvironBuilder._add_file_from_data
(self, key, value)
Called in the EnvironBuilder to add files from the data dict.
Called in the EnvironBuilder to add files from the data dict.
def _add_file_from_data(self, key, value): """Called in the EnvironBuilder to add files from the data dict.""" if isinstance(value, tuple): self.files.add_file(key, *value) elif isinstance(value, dict): from warnings import warn warn( "Passing...
[ "def", "_add_file_from_data", "(", "self", ",", "key", ",", "value", ")", ":", "if", "isinstance", "(", "value", ",", "tuple", ")", ":", "self", ".", "files", ".", "add_file", "(", "key", ",", "*", "value", ")", "elif", "isinstance", "(", "value", ",...
[ 455, 4 ]
[ 475, 43 ]
python
en
['en', 'en', 'en']
True
EnvironBuilder.base_url
(self)
The base URL is used to extract the URL scheme, host name, port, and root path.
The base URL is used to extract the URL scheme, host name, port, and root path.
def base_url(self): """The base URL is used to extract the URL scheme, host name, port, and root path. """ return self._make_base_url(self.url_scheme, self.host, self.script_root)
[ "def", "base_url", "(", "self", ")", ":", "return", "self", ".", "_make_base_url", "(", "self", ".", "url_scheme", ",", "self", ".", "host", ",", "self", ".", "script_root", ")" ]
[ 482, 4 ]
[ 486, 80 ]
python
en
['en', 'en', 'en']
True
EnvironBuilder.server_name
(self)
The server name (read-only, use :attr:`host` to set)
The server name (read-only, use :attr:`host` to set)
def server_name(self): """The server name (read-only, use :attr:`host` to set)""" return self.host.split(":", 1)[0]
[ "def", "server_name", "(", "self", ")", ":", "return", "self", ".", "host", ".", "split", "(", "\":\"", ",", "1", ")", "[", "0", "]" ]
[ 659, 4 ]
[ 661, 41 ]
python
en
['en', 'en', 'en']
True
EnvironBuilder.server_port
(self)
The server port as integer (read-only, use :attr:`host` to set)
The server port as integer (read-only, use :attr:`host` to set)
def server_port(self): """The server port as integer (read-only, use :attr:`host` to set)""" pieces = self.host.split(":", 1) if len(pieces) == 2 and pieces[1].isdigit(): return int(pieces[1]) elif self.url_scheme == "https": return 443 return 80
[ "def", "server_port", "(", "self", ")", ":", "pieces", "=", "self", ".", "host", ".", "split", "(", "\":\"", ",", "1", ")", "if", "len", "(", "pieces", ")", "==", "2", "and", "pieces", "[", "1", "]", ".", "isdigit", "(", ")", ":", "return", "in...
[ 664, 4 ]
[ 671, 17 ]
python
en
['en', 'en', 'en']
True
EnvironBuilder.close
(self)
Closes all files. If you put real :class:`file` objects into the :attr:`files` dict you can call this method to automatically close them all in one go.
Closes all files. If you put real :class:`file` objects into the :attr:`files` dict you can call this method to automatically close them all in one go.
def close(self): """Closes all files. If you put real :class:`file` objects into the :attr:`files` dict you can call this method to automatically close them all in one go. """ if self.closed: return try: files = itervalues(self.files) exce...
[ "def", "close", "(", "self", ")", ":", "if", "self", ".", "closed", ":", "return", "try", ":", "files", "=", "itervalues", "(", "self", ".", "files", ")", "except", "AttributeError", ":", "files", "=", "(", ")", "for", "f", "in", "files", ":", "try...
[ 679, 4 ]
[ 695, 26 ]
python
en
['en', 'en', 'en']
True
EnvironBuilder.get_environ
(self)
Return the built environ. .. versionchanged:: 0.15 The content type and length headers are set based on input stream detection. Previously this only set the WSGI keys.
Return the built environ.
def get_environ(self): """Return the built environ. .. versionchanged:: 0.15 The content type and length headers are set based on input stream detection. Previously this only set the WSGI keys. """ input_stream = self.input_stream content_leng...
[ "def", "get_environ", "(", "self", ")", ":", "input_stream", "=", "self", ".", "input_stream", "content_length", "=", "self", ".", "content_length", "mimetype", "=", "self", ".", "mimetype", "content_type", "=", "self", ".", "content_type", "if", "input_stream",...
[ 697, 4 ]
[ 781, 21 ]
python
en
['en', 'be', 'en']
True
EnvironBuilder.get_request
(self, cls=None)
Returns a request with the data. If the request class is not specified :attr:`request_class` is used. :param cls: The request wrapper to use.
Returns a request with the data. If the request class is not specified :attr:`request_class` is used.
def get_request(self, cls=None): """Returns a request with the data. If the request class is not specified :attr:`request_class` is used. :param cls: The request wrapper to use. """ if cls is None: cls = self.request_class return cls(self.get_environ())
[ "def", "get_request", "(", "self", ",", "cls", "=", "None", ")", ":", "if", "cls", "is", "None", ":", "cls", "=", "self", ".", "request_class", "return", "cls", "(", "self", ".", "get_environ", "(", ")", ")" ]
[ 783, 4 ]
[ 791, 38 ]
python
en
['en', 'en', 'en']
True
Client.set_cookie
( self, server_name, key, value="", max_age=None, expires=None, path="/", domain=None, secure=None, httponly=False, charset="utf-8", )
Sets a cookie in the client's cookie jar. The server name is required and has to match the one that is also passed to the open call.
Sets a cookie in the client's cookie jar. The server name is required and has to match the one that is also passed to the open call.
def set_cookie( self, server_name, key, value="", max_age=None, expires=None, path="/", domain=None, secure=None, httponly=False, charset="utf-8", ): """Sets a cookie in the client's cookie jar. The server name ...
[ "def", "set_cookie", "(", "self", ",", "server_name", ",", "key", ",", "value", "=", "\"\"", ",", "max_age", "=", "None", ",", "expires", "=", "None", ",", "path", "=", "\"/\"", ",", "domain", "=", "None", ",", "secure", "=", "None", ",", "httponly",...
[ 848, 4 ]
[ 871, 54 ]
python
en
['en', 'en', 'en']
True
Client.delete_cookie
(self, server_name, key, path="/", domain=None)
Deletes a cookie in the test client.
Deletes a cookie in the test client.
def delete_cookie(self, server_name, key, path="/", domain=None): """Deletes a cookie in the test client.""" self.set_cookie( server_name, key, expires=0, max_age=0, path=path, domain=domain )
[ "def", "delete_cookie", "(", "self", ",", "server_name", ",", "key", ",", "path", "=", "\"/\"", ",", "domain", "=", "None", ")", ":", "self", ".", "set_cookie", "(", "server_name", ",", "key", ",", "expires", "=", "0", ",", "max_age", "=", "0", ",", ...
[ 873, 4 ]
[ 877, 9 ]
python
en
['en', 'en', 'en']
True
Client.run_wsgi_app
(self, environ, buffered=False)
Runs the wrapped WSGI app with the given environment.
Runs the wrapped WSGI app with the given environment.
def run_wsgi_app(self, environ, buffered=False): """Runs the wrapped WSGI app with the given environment.""" if self.cookie_jar is not None: self.cookie_jar.inject_wsgi(environ) rv = run_wsgi_app(self.application, environ, buffered=buffered) if self.cookie_jar is not None: ...
[ "def", "run_wsgi_app", "(", "self", ",", "environ", ",", "buffered", "=", "False", ")", ":", "if", "self", ".", "cookie_jar", "is", "not", "None", ":", "self", ".", "cookie_jar", ".", "inject_wsgi", "(", "environ", ")", "rv", "=", "run_wsgi_app", "(", ...
[ 879, 4 ]
[ 886, 17 ]
python
en
['en', 'en', 'en']
True
Client.resolve_redirect
(self, response, new_location, environ, buffered=False)
Perform a new request to the location given by the redirect response to the previous request.
Perform a new request to the location given by the redirect response to the previous request.
def resolve_redirect(self, response, new_location, environ, buffered=False): """Perform a new request to the location given by the redirect response to the previous request. """ scheme, netloc, path, qs, anchor = url_parse(new_location) builder = EnvironBuilder.from_environ(envir...
[ "def", "resolve_redirect", "(", "self", ",", "response", ",", "new_location", ",", "environ", ",", "buffered", "=", "False", ")", ":", "scheme", ",", "netloc", ",", "path", ",", "qs", ",", "anchor", "=", "url_parse", "(", "new_location", ")", "builder", ...
[ 888, 4 ]
[ 949, 56 ]
python
en
['en', 'en', 'en']
True
Client.open
(self, *args, **kwargs)
Takes the same arguments as the :class:`EnvironBuilder` class with some additions: You can provide a :class:`EnvironBuilder` or a WSGI environment as only argument instead of the :class:`EnvironBuilder` arguments and two optional keyword arguments (`as_tuple`, `buffered`) that change th...
Takes the same arguments as the :class:`EnvironBuilder` class with some additions: You can provide a :class:`EnvironBuilder` or a WSGI environment as only argument instead of the :class:`EnvironBuilder` arguments and two optional keyword arguments (`as_tuple`, `buffered`) that change th...
def open(self, *args, **kwargs): """Takes the same arguments as the :class:`EnvironBuilder` class with some additions: You can provide a :class:`EnvironBuilder` or a WSGI environment as only argument instead of the :class:`EnvironBuilder` arguments and two optional keyword arguments (`a...
[ "def", "open", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "as_tuple", "=", "kwargs", ".", "pop", "(", "\"as_tuple\"", ",", "False", ")", "buffered", "=", "kwargs", ".", "pop", "(", "\"buffered\"", ",", "False", ")", "follow_red...
[ 951, 4 ]
[ 1023, 23 ]
python
en
['en', 'en', 'en']
True
Client.get
(self, *args, **kw)
Like open but method is enforced to GET.
Like open but method is enforced to GET.
def get(self, *args, **kw): """Like open but method is enforced to GET.""" kw["method"] = "GET" return self.open(*args, **kw)
[ "def", "get", "(", "self", ",", "*", "args", ",", "*", "*", "kw", ")", ":", "kw", "[", "\"method\"", "]", "=", "\"GET\"", "return", "self", ".", "open", "(", "*", "args", ",", "*", "*", "kw", ")" ]
[ 1025, 4 ]
[ 1028, 37 ]
python
en
['en', 'en', 'en']
True
Client.patch
(self, *args, **kw)
Like open but method is enforced to PATCH.
Like open but method is enforced to PATCH.
def patch(self, *args, **kw): """Like open but method is enforced to PATCH.""" kw["method"] = "PATCH" return self.open(*args, **kw)
[ "def", "patch", "(", "self", ",", "*", "args", ",", "*", "*", "kw", ")", ":", "kw", "[", "\"method\"", "]", "=", "\"PATCH\"", "return", "self", ".", "open", "(", "*", "args", ",", "*", "*", "kw", ")" ]
[ 1030, 4 ]
[ 1033, 37 ]
python
en
['en', 'en', 'en']
True
Client.post
(self, *args, **kw)
Like open but method is enforced to POST.
Like open but method is enforced to POST.
def post(self, *args, **kw): """Like open but method is enforced to POST.""" kw["method"] = "POST" return self.open(*args, **kw)
[ "def", "post", "(", "self", ",", "*", "args", ",", "*", "*", "kw", ")", ":", "kw", "[", "\"method\"", "]", "=", "\"POST\"", "return", "self", ".", "open", "(", "*", "args", ",", "*", "*", "kw", ")" ]
[ 1035, 4 ]
[ 1038, 37 ]
python
en
['en', 'en', 'en']
True
Client.head
(self, *args, **kw)
Like open but method is enforced to HEAD.
Like open but method is enforced to HEAD.
def head(self, *args, **kw): """Like open but method is enforced to HEAD.""" kw["method"] = "HEAD" return self.open(*args, **kw)
[ "def", "head", "(", "self", ",", "*", "args", ",", "*", "*", "kw", ")", ":", "kw", "[", "\"method\"", "]", "=", "\"HEAD\"", "return", "self", ".", "open", "(", "*", "args", ",", "*", "*", "kw", ")" ]
[ 1040, 4 ]
[ 1043, 37 ]
python
en
['en', 'fy', 'en']
True
Client.put
(self, *args, **kw)
Like open but method is enforced to PUT.
Like open but method is enforced to PUT.
def put(self, *args, **kw): """Like open but method is enforced to PUT.""" kw["method"] = "PUT" return self.open(*args, **kw)
[ "def", "put", "(", "self", ",", "*", "args", ",", "*", "*", "kw", ")", ":", "kw", "[", "\"method\"", "]", "=", "\"PUT\"", "return", "self", ".", "open", "(", "*", "args", ",", "*", "*", "kw", ")" ]
[ 1045, 4 ]
[ 1048, 37 ]
python
en
['en', 'en', 'en']
True
Client.delete
(self, *args, **kw)
Like open but method is enforced to DELETE.
Like open but method is enforced to DELETE.
def delete(self, *args, **kw): """Like open but method is enforced to DELETE.""" kw["method"] = "DELETE" return self.open(*args, **kw)
[ "def", "delete", "(", "self", ",", "*", "args", ",", "*", "*", "kw", ")", ":", "kw", "[", "\"method\"", "]", "=", "\"DELETE\"", "return", "self", ".", "open", "(", "*", "args", ",", "*", "*", "kw", ")" ]
[ 1050, 4 ]
[ 1053, 37 ]
python
en
['en', 'fy', 'en']
True
Client.options
(self, *args, **kw)
Like open but method is enforced to OPTIONS.
Like open but method is enforced to OPTIONS.
def options(self, *args, **kw): """Like open but method is enforced to OPTIONS.""" kw["method"] = "OPTIONS" return self.open(*args, **kw)
[ "def", "options", "(", "self", ",", "*", "args", ",", "*", "*", "kw", ")", ":", "kw", "[", "\"method\"", "]", "=", "\"OPTIONS\"", "return", "self", ".", "open", "(", "*", "args", ",", "*", "*", "kw", ")" ]
[ 1055, 4 ]
[ 1058, 37 ]
python
en
['en', 'en', 'en']
True
Client.trace
(self, *args, **kw)
Like open but method is enforced to TRACE.
Like open but method is enforced to TRACE.
def trace(self, *args, **kw): """Like open but method is enforced to TRACE.""" kw["method"] = "TRACE" return self.open(*args, **kw)
[ "def", "trace", "(", "self", ",", "*", "args", ",", "*", "*", "kw", ")", ":", "kw", "[", "\"method\"", "]", "=", "\"TRACE\"", "return", "self", ".", "open", "(", "*", "args", ",", "*", "*", "kw", ")" ]
[ 1060, 4 ]
[ 1063, 37 ]
python
en
['en', 'en', 'en']
True
is_double_callable
(application)
Tests to see if an application is a legacy-style (double-callable) application.
Tests to see if an application is a legacy-style (double-callable) application.
def is_double_callable(application): """ Tests to see if an application is a legacy-style (double-callable) application. """ # Look for a hint on the object first if getattr(application, "_asgi_single_callable", False): return False if getattr(application, "_asgi_double_callable", False)...
[ "def", "is_double_callable", "(", "application", ")", ":", "# Look for a hint on the object first", "if", "getattr", "(", "application", ",", "\"_asgi_single_callable\"", ",", "False", ")", ":", "return", "False", "if", "getattr", "(", "application", ",", "\"_asgi_dou...
[ 5, 0 ]
[ 24, 55 ]
python
en
['en', 'error', 'th']
False
double_to_single_callable
(application)
Transforms a double-callable ASGI application into a single-callable one.
Transforms a double-callable ASGI application into a single-callable one.
def double_to_single_callable(application): """ Transforms a double-callable ASGI application into a single-callable one. """ async def new_application(scope, receive, send): instance = application(scope) return await instance(receive, send) return new_application
[ "def", "double_to_single_callable", "(", "application", ")", ":", "async", "def", "new_application", "(", "scope", ",", "receive", ",", "send", ")", ":", "instance", "=", "application", "(", "scope", ")", "return", "await", "instance", "(", "receive", ",", "...
[ 27, 0 ]
[ 36, 26 ]
python
en
['en', 'error', 'th']
False
guarantee_single_callable
(application)
Takes either a single- or double-callable application and always returns it in single-callable style. Use this to add backwards compatibility for ASGI 2.0 applications to your server/test harness/etc.
Takes either a single- or double-callable application and always returns it in single-callable style. Use this to add backwards compatibility for ASGI 2.0 applications to your server/test harness/etc.
def guarantee_single_callable(application): """ Takes either a single- or double-callable application and always returns it in single-callable style. Use this to add backwards compatibility for ASGI 2.0 applications to your server/test harness/etc. """ if is_double_callable(application): ...
[ "def", "guarantee_single_callable", "(", "application", ")", ":", "if", "is_double_callable", "(", "application", ")", ":", "application", "=", "double_to_single_callable", "(", "application", ")", "return", "application" ]
[ 39, 0 ]
[ 47, 22 ]
python
en
['en', 'error', 'th']
False
FileOps.match
(self, target)
Searches target for pattern and returns a bool.
Searches target for pattern and returns a bool.
def match(self, target): """Searches target for pattern and returns a bool.""" if not self.hidden and target.startswith("."): return False if self.matchexcludecheck: if self.match_exclude(target) is False: return False if self.excludes and target i...
[ "def", "match", "(", "self", ",", "target", ")", ":", "if", "not", "self", ".", "hidden", "and", "target", ".", "startswith", "(", "\".\"", ")", ":", "return", "False", "if", "self", ".", "matchexcludecheck", ":", "if", "self", ".", "match_exclude", "(...
[ 132, 4 ]
[ 146, 19 ]
python
en
['en', 'en', 'en']
True
FileOps.get_dirs
(self, root, dirs)
Sort, match and decode a list of dirs.
Sort, match and decode a list of dirs.
def get_dirs(self, root, dirs): """Sort, match and decode a list of dirs.""" return [(root, d.decode("utf-8"), u"") for d in dirs if self.match(d)]
[ "def", "get_dirs", "(", "self", ",", "root", ",", "dirs", ")", ":", "return", "[", "(", "root", ",", "d", ".", "decode", "(", "\"utf-8\"", ")", ",", "u\"\"", ")", "for", "d", "in", "dirs", "if", "self", ".", "match", "(", "d", ")", "]" ]
[ 148, 4 ]
[ 150, 78 ]
python
en
['en', 'en', 'en']
True
FileOps.get_files
(self, root, files)
Sort, match and decode a list of files.
Sort, match and decode a list of files.
def get_files(self, root, files): """Sort, match and decode a list of files.""" return [(root,) + os.path.splitext(f.decode("utf-8")) for f in files if self.match(f)]
[ "def", "get_files", "(", "self", ",", "root", ",", "files", ")", ":", "return", "[", "(", "root", ",", ")", "+", "os", ".", "path", ".", "splitext", "(", "f", ".", "decode", "(", "\"utf-8\"", ")", ")", "for", "f", "in", "files", "if", "self", "...
[ 152, 4 ]
[ 155, 46 ]
python
en
['en', 'en', 'en']
True
FileOps.get_targets
(self, path=None)
Return a list of files and/or dirs in path.
Return a list of files and/or dirs in path.
def get_targets(self, path=None): """Return a list of files and/or dirs in path.""" if not path: path = os.getcwd() # Determine recursion depth. levels = 0 if self.recursive: levels = self.recursivedepth targets = [] for root, dirs, files...
[ "def", "get_targets", "(", "self", ",", "path", "=", "None", ")", ":", "if", "not", "path", ":", "path", "=", "os", ".", "getcwd", "(", ")", "# Determine recursion depth.", "levels", "=", "0", "if", "self", ".", "recursive", ":", "levels", "=", "self",...
[ 157, 4 ]
[ 183, 22 ]
python
en
['en', 'en', 'en']
True
FileOps.get_previews
(self, targets, matchpat=None, replacepat=None)
Simulate rename operation on targets and return results as list.
Simulate rename operation on targets and return results as list.
def get_previews(self, targets, matchpat=None, replacepat=None): """Simulate rename operation on targets and return results as list.""" if matchpat: self.matchedit = matchpat if replacepat: self.replaceedit = replacepat if self.mediamode: self.set_medi...
[ "def", "get_previews", "(", "self", ",", "targets", ",", "matchpat", "=", "None", ",", "replacepat", "=", "None", ")", ":", "if", "matchpat", ":", "self", ".", "matchedit", "=", "matchpat", "if", "replacepat", ":", "self", ".", "replaceedit", "=", "repla...
[ 185, 4 ]
[ 194, 44 ]
python
en
['en', 'en', 'en']
True
GDALBand._flush
(self)
Call the flush method on the Band's parent raster and force a refresh of the statistics attribute when requested the next time.
Call the flush method on the Band's parent raster and force a refresh of the statistics attribute when requested the next time.
def _flush(self): """ Call the flush method on the Band's parent raster and force a refresh of the statistics attribute when requested the next time. """ self.source._flush() self._stats_refresh = True
[ "def", "_flush", "(", "self", ")", ":", "self", ".", "source", ".", "_flush", "(", ")", "self", ".", "_stats_refresh", "=", "True" ]
[ 21, 4 ]
[ 27, 34 ]
python
en
['en', 'error', 'th']
False
GDALBand.description
(self)
Return the description string of the band.
Return the description string of the band.
def description(self): """ Return the description string of the band. """ return force_str(capi.get_band_description(self._ptr))
[ "def", "description", "(", "self", ")", ":", "return", "force_str", "(", "capi", ".", "get_band_description", "(", "self", ".", "_ptr", ")", ")" ]
[ 30, 4 ]
[ 34, 62 ]
python
en
['en', 'error', 'th']
False
GDALBand.width
(self)
Width (X axis) in pixels of the band.
Width (X axis) in pixels of the band.
def width(self): """ Width (X axis) in pixels of the band. """ return capi.get_band_xsize(self._ptr)
[ "def", "width", "(", "self", ")", ":", "return", "capi", ".", "get_band_xsize", "(", "self", ".", "_ptr", ")" ]
[ 37, 4 ]
[ 41, 45 ]
python
en
['en', 'error', 'th']
False
GDALBand.height
(self)
Height (Y axis) in pixels of the band.
Height (Y axis) in pixels of the band.
def height(self): """ Height (Y axis) in pixels of the band. """ return capi.get_band_ysize(self._ptr)
[ "def", "height", "(", "self", ")", ":", "return", "capi", ".", "get_band_ysize", "(", "self", ".", "_ptr", ")" ]
[ 44, 4 ]
[ 48, 45 ]
python
en
['en', 'error', 'th']
False
GDALBand.pixel_count
(self)
Return the total number of pixels in this band.
Return the total number of pixels in this band.
def pixel_count(self): """ Return the total number of pixels in this band. """ return self.width * self.height
[ "def", "pixel_count", "(", "self", ")", ":", "return", "self", ".", "width", "*", "self", ".", "height" ]
[ 51, 4 ]
[ 55, 39 ]
python
en
['en', 'error', 'th']
False
GDALBand.statistics
(self, refresh=False, approximate=False)
Compute statistics on the pixel values of this band. The return value is a tuple with the following structure: (minimum, maximum, mean, standard deviation). If approximate=True, the statistics may be computed based on overviews or a subset of image tiles. If refresh=T...
Compute statistics on the pixel values of this band.
def statistics(self, refresh=False, approximate=False): """ Compute statistics on the pixel values of this band. The return value is a tuple with the following structure: (minimum, maximum, mean, standard deviation). If approximate=True, the statistics may be computed based on ...
[ "def", "statistics", "(", "self", ",", "refresh", "=", "False", ",", "approximate", "=", "False", ")", ":", "# Prepare array with arguments for capi function", "smin", ",", "smax", ",", "smean", ",", "sstd", "=", "c_double", "(", ")", ",", "c_double", "(", "...
[ 59, 4 ]
[ 103, 21 ]
python
en
['en', 'error', 'th']
False
GDALBand.min
(self)
Return the minimum pixel value for this band.
Return the minimum pixel value for this band.
def min(self): """ Return the minimum pixel value for this band. """ return self.statistics()[0]
[ "def", "min", "(", "self", ")", ":", "return", "self", ".", "statistics", "(", ")", "[", "0", "]" ]
[ 106, 4 ]
[ 110, 35 ]
python
en
['en', 'error', 'th']
False
GDALBand.max
(self)
Return the maximum pixel value for this band.
Return the maximum pixel value for this band.
def max(self): """ Return the maximum pixel value for this band. """ return self.statistics()[1]
[ "def", "max", "(", "self", ")", ":", "return", "self", ".", "statistics", "(", ")", "[", "1", "]" ]
[ 113, 4 ]
[ 117, 35 ]
python
en
['en', 'error', 'th']
False
GDALBand.mean
(self)
Return the mean of all pixel values of this band.
Return the mean of all pixel values of this band.
def mean(self): """ Return the mean of all pixel values of this band. """ return self.statistics()[2]
[ "def", "mean", "(", "self", ")", ":", "return", "self", ".", "statistics", "(", ")", "[", "2", "]" ]
[ 120, 4 ]
[ 124, 35 ]
python
en
['en', 'error', 'th']
False
GDALBand.std
(self)
Return the standard deviation of all pixel values of this band.
Return the standard deviation of all pixel values of this band.
def std(self): """ Return the standard deviation of all pixel values of this band. """ return self.statistics()[3]
[ "def", "std", "(", "self", ")", ":", "return", "self", ".", "statistics", "(", ")", "[", "3", "]" ]
[ 127, 4 ]
[ 131, 35 ]
python
en
['en', 'error', 'th']
False
GDALBand.nodata_value
(self)
Return the nodata value for this band, or None if it isn't set.
Return the nodata value for this band, or None if it isn't set.
def nodata_value(self): """ Return the nodata value for this band, or None if it isn't set. """ # Get value and nodata exists flag nodata_exists = c_int() value = capi.get_band_nodata_value(self._ptr, nodata_exists) if not nodata_exists: value = None ...
[ "def", "nodata_value", "(", "self", ")", ":", "# Get value and nodata exists flag", "nodata_exists", "=", "c_int", "(", ")", "value", "=", "capi", ".", "get_band_nodata_value", "(", "self", ".", "_ptr", ",", "nodata_exists", ")", "if", "not", "nodata_exists", ":...
[ 134, 4 ]
[ 146, 20 ]
python
en
['en', 'error', 'th']
False
GDALBand.nodata_value
(self, value)
Set the nodata value for this band.
Set the nodata value for this band.
def nodata_value(self, value): """ Set the nodata value for this band. """ if value is None: if not capi.delete_band_nodata_value: raise ValueError('GDAL >= 2.1 required to delete nodata values.') capi.delete_band_nodata_value(self._ptr) el...
[ "def", "nodata_value", "(", "self", ",", "value", ")", ":", "if", "value", "is", "None", ":", "if", "not", "capi", ".", "delete_band_nodata_value", ":", "raise", "ValueError", "(", "'GDAL >= 2.1 required to delete nodata values.'", ")", "capi", ".", "delete_band_n...
[ 149, 4 ]
[ 161, 21 ]
python
en
['en', 'error', 'th']
False
GDALBand.datatype
(self, as_string=False)
Return the GDAL Pixel Datatype for this band.
Return the GDAL Pixel Datatype for this band.
def datatype(self, as_string=False): """ Return the GDAL Pixel Datatype for this band. """ dtype = capi.get_band_datatype(self._ptr) if as_string: dtype = GDAL_PIXEL_TYPES[dtype] return dtype
[ "def", "datatype", "(", "self", ",", "as_string", "=", "False", ")", ":", "dtype", "=", "capi", ".", "get_band_datatype", "(", "self", ".", "_ptr", ")", "if", "as_string", ":", "dtype", "=", "GDAL_PIXEL_TYPES", "[", "dtype", "]", "return", "dtype" ]
[ 163, 4 ]
[ 170, 20 ]
python
en
['en', 'error', 'th']
False
GDALBand.color_interp
(self, as_string=False)
Return the GDAL color interpretation for this band.
Return the GDAL color interpretation for this band.
def color_interp(self, as_string=False): """Return the GDAL color interpretation for this band.""" color = capi.get_band_color_interp(self._ptr) if as_string: color = GDAL_COLOR_TYPES[color] return color
[ "def", "color_interp", "(", "self", ",", "as_string", "=", "False", ")", ":", "color", "=", "capi", ".", "get_band_color_interp", "(", "self", ".", "_ptr", ")", "if", "as_string", ":", "color", "=", "GDAL_COLOR_TYPES", "[", "color", "]", "return", "color" ...
[ 172, 4 ]
[ 177, 20 ]
python
en
['en', 'en', 'en']
True
GDALBand.data
(self, data=None, offset=None, size=None, shape=None, as_memoryview=False)
Read or writes pixel values for this band. Blocks of data can be accessed by specifying the width, height and offset of the desired block. The same specification can be used to update parts of a raster by providing an array of values. Allowed input data types are bytes, memoryv...
Read or writes pixel values for this band. Blocks of data can be accessed by specifying the width, height and offset of the desired block. The same specification can be used to update parts of a raster by providing an array of values.
def data(self, data=None, offset=None, size=None, shape=None, as_memoryview=False): """ Read or writes pixel values for this band. Blocks of data can be accessed by specifying the width, height and offset of the desired block. The same specification can be used to update parts of...
[ "def", "data", "(", "self", ",", "data", "=", "None", ",", "offset", "=", "None", ",", "size", "=", "None", ",", "shape", "=", "None", ",", "as_memoryview", "=", "False", ")", ":", "offset", "=", "offset", "or", "(", "0", ",", "0", ")", "size", ...
[ 179, 4 ]
[ 232, 25 ]
python
en
['en', 'error', 'th']
False
constant
(image, value)
Fill a channel with a given grey level. :rtype: :py:class:`~PIL.Image.Image`
Fill a channel with a given grey level.
def constant(image, value): """Fill a channel with a given grey level. :rtype: :py:class:`~PIL.Image.Image` """ return Image.new("L", image.size, value)
[ "def", "constant", "(", "image", ",", "value", ")", ":", "return", "Image", ".", "new", "(", "\"L\"", ",", "image", ".", "size", ",", "value", ")" ]
[ 20, 0 ]
[ 26, 44 ]
python
en
['en', 'en', 'en']
True
duplicate
(image)
Copy a channel. Alias for :py:meth:`PIL.Image.Image.copy`. :rtype: :py:class:`~PIL.Image.Image`
Copy a channel. Alias for :py:meth:`PIL.Image.Image.copy`.
def duplicate(image): """Copy a channel. Alias for :py:meth:`PIL.Image.Image.copy`. :rtype: :py:class:`~PIL.Image.Image` """ return image.copy()
[ "def", "duplicate", "(", "image", ")", ":", "return", "image", ".", "copy", "(", ")" ]
[ 29, 0 ]
[ 35, 23 ]
python
en
['en', 'fr', 'en']
True
invert
(image)
Invert an image (channel). .. code-block:: python out = MAX - image :rtype: :py:class:`~PIL.Image.Image`
Invert an image (channel).
def invert(image): """ Invert an image (channel). .. code-block:: python out = MAX - image :rtype: :py:class:`~PIL.Image.Image` """ image.load() return image._new(image.im.chop_invert())
[ "def", "invert", "(", "image", ")", ":", "image", ".", "load", "(", ")", "return", "image", ".", "_new", "(", "image", ".", "im", ".", "chop_invert", "(", ")", ")" ]
[ 38, 0 ]
[ 50, 45 ]
python
en
['en', 'error', 'th']
False
lighter
(image1, image2)
Compares the two images, pixel by pixel, and returns a new image containing the lighter values. .. code-block:: python out = max(image1, image2) :rtype: :py:class:`~PIL.Image.Image`
Compares the two images, pixel by pixel, and returns a new image containing the lighter values.
def lighter(image1, image2): """ Compares the two images, pixel by pixel, and returns a new image containing the lighter values. .. code-block:: python out = max(image1, image2) :rtype: :py:class:`~PIL.Image.Image` """ image1.load() image2.load() return image1._new(image1...
[ "def", "lighter", "(", "image1", ",", "image2", ")", ":", "image1", ".", "load", "(", ")", "image2", ".", "load", "(", ")", "return", "image1", ".", "_new", "(", "image1", ".", "im", ".", "chop_lighter", "(", "image2", ".", "im", ")", ")" ]
[ 53, 0 ]
[ 67, 57 ]
python
en
['en', 'error', 'th']
False
darker
(image1, image2)
Compares the two images, pixel by pixel, and returns a new image containing the darker values. .. code-block:: python out = min(image1, image2) :rtype: :py:class:`~PIL.Image.Image`
Compares the two images, pixel by pixel, and returns a new image containing the darker values.
def darker(image1, image2): """ Compares the two images, pixel by pixel, and returns a new image containing the darker values. .. code-block:: python out = min(image1, image2) :rtype: :py:class:`~PIL.Image.Image` """ image1.load() image2.load() return image1._new(image1.i...
[ "def", "darker", "(", "image1", ",", "image2", ")", ":", "image1", ".", "load", "(", ")", "image2", ".", "load", "(", ")", "return", "image1", ".", "_new", "(", "image1", ".", "im", ".", "chop_darker", "(", "image2", ".", "im", ")", ")" ]
[ 70, 0 ]
[ 84, 56 ]
python
en
['en', 'error', 'th']
False
difference
(image1, image2)
Returns the absolute value of the pixel-by-pixel difference between the two images. .. code-block:: python out = abs(image1 - image2) :rtype: :py:class:`~PIL.Image.Image`
Returns the absolute value of the pixel-by-pixel difference between the two images.
def difference(image1, image2): """ Returns the absolute value of the pixel-by-pixel difference between the two images. .. code-block:: python out = abs(image1 - image2) :rtype: :py:class:`~PIL.Image.Image` """ image1.load() image2.load() return image1._new(image1.im.chop...
[ "def", "difference", "(", "image1", ",", "image2", ")", ":", "image1", ".", "load", "(", ")", "image2", ".", "load", "(", ")", "return", "image1", ".", "_new", "(", "image1", ".", "im", ".", "chop_difference", "(", "image2", ".", "im", ")", ")" ]
[ 87, 0 ]
[ 101, 60 ]
python
en
['en', 'error', 'th']
False
multiply
(image1, image2)
Superimposes two images on top of each other. If you multiply an image with a solid black image, the result is black. If you multiply with a solid white image, the image is unaffected. .. code-block:: python out = image1 * image2 / MAX :rtype: :py:class:`~PIL.Image.Image`
Superimposes two images on top of each other.
def multiply(image1, image2): """ Superimposes two images on top of each other. If you multiply an image with a solid black image, the result is black. If you multiply with a solid white image, the image is unaffected. .. code-block:: python out = image1 * image2 / MAX :rtype: :py:cl...
[ "def", "multiply", "(", "image1", ",", "image2", ")", ":", "image1", ".", "load", "(", ")", "image2", ".", "load", "(", ")", "return", "image1", ".", "_new", "(", "image1", ".", "im", ".", "chop_multiply", "(", "image2", ".", "im", ")", ")" ]
[ 104, 0 ]
[ 120, 58 ]
python
en
['en', 'error', 'th']
False
screen
(image1, image2)
Superimposes two inverted images on top of each other. .. code-block:: python out = MAX - ((MAX - image1) * (MAX - image2) / MAX) :rtype: :py:class:`~PIL.Image.Image`
Superimposes two inverted images on top of each other.
def screen(image1, image2): """ Superimposes two inverted images on top of each other. .. code-block:: python out = MAX - ((MAX - image1) * (MAX - image2) / MAX) :rtype: :py:class:`~PIL.Image.Image` """ image1.load() image2.load() return image1._new(image1.im.chop_screen(imag...
[ "def", "screen", "(", "image1", ",", "image2", ")", ":", "image1", ".", "load", "(", ")", "image2", ".", "load", "(", ")", "return", "image1", ".", "_new", "(", "image1", ".", "im", ".", "chop_screen", "(", "image2", ".", "im", ")", ")" ]
[ 123, 0 ]
[ 136, 56 ]
python
en
['en', 'error', 'th']
False
soft_light
(image1, image2)
Superimposes two images on top of each other using the Soft Light algorithm :rtype: :py:class:`~PIL.Image.Image`
Superimposes two images on top of each other using the Soft Light algorithm
def soft_light(image1, image2): """ Superimposes two images on top of each other using the Soft Light algorithm :rtype: :py:class:`~PIL.Image.Image` """ image1.load() image2.load() return image1._new(image1.im.chop_soft_light(image2.im))
[ "def", "soft_light", "(", "image1", ",", "image2", ")", ":", "image1", ".", "load", "(", ")", "image2", ".", "load", "(", ")", "return", "image1", ".", "_new", "(", "image1", ".", "im", ".", "chop_soft_light", "(", "image2", ".", "im", ")", ")" ]
[ 139, 0 ]
[ 148, 60 ]
python
en
['en', 'error', 'th']
False
hard_light
(image1, image2)
Superimposes two images on top of each other using the Hard Light algorithm :rtype: :py:class:`~PIL.Image.Image`
Superimposes two images on top of each other using the Hard Light algorithm
def hard_light(image1, image2): """ Superimposes two images on top of each other using the Hard Light algorithm :rtype: :py:class:`~PIL.Image.Image` """ image1.load() image2.load() return image1._new(image1.im.chop_hard_light(image2.im))
[ "def", "hard_light", "(", "image1", ",", "image2", ")", ":", "image1", ".", "load", "(", ")", "image2", ".", "load", "(", ")", "return", "image1", ".", "_new", "(", "image1", ".", "im", ".", "chop_hard_light", "(", "image2", ".", "im", ")", ")" ]
[ 151, 0 ]
[ 160, 60 ]
python
en
['en', 'error', 'th']
False
overlay
(image1, image2)
Superimposes two images on top of each other using the Overlay algorithm :rtype: :py:class:`~PIL.Image.Image`
Superimposes two images on top of each other using the Overlay algorithm
def overlay(image1, image2): """ Superimposes two images on top of each other using the Overlay algorithm :rtype: :py:class:`~PIL.Image.Image` """ image1.load() image2.load() return image1._new(image1.im.chop_overlay(image2.im))
[ "def", "overlay", "(", "image1", ",", "image2", ")", ":", "image1", ".", "load", "(", ")", "image2", ".", "load", "(", ")", "return", "image1", ".", "_new", "(", "image1", ".", "im", ".", "chop_overlay", "(", "image2", ".", "im", ")", ")" ]
[ 163, 0 ]
[ 172, 57 ]
python
en
['en', 'error', 'th']
False
add
(image1, image2, scale=1.0, offset=0)
Adds two images, dividing the result by scale and adding the offset. If omitted, scale defaults to 1.0, and offset to 0.0. .. code-block:: python out = ((image1 + image2) / scale + offset) :rtype: :py:class:`~PIL.Image.Image`
Adds two images, dividing the result by scale and adding the offset. If omitted, scale defaults to 1.0, and offset to 0.0.
def add(image1, image2, scale=1.0, offset=0): """ Adds two images, dividing the result by scale and adding the offset. If omitted, scale defaults to 1.0, and offset to 0.0. .. code-block:: python out = ((image1 + image2) / scale + offset) :rtype: :py:class:`~PIL.Image.Image` """ ...
[ "def", "add", "(", "image1", ",", "image2", ",", "scale", "=", "1.0", ",", "offset", "=", "0", ")", ":", "image1", ".", "load", "(", ")", "image2", ".", "load", "(", ")", "return", "image1", ".", "_new", "(", "image1", ".", "im", ".", "chop_add",...
[ 175, 0 ]
[ 189, 68 ]
python
en
['en', 'error', 'th']
False
subtract
(image1, image2, scale=1.0, offset=0)
Subtracts two images, dividing the result by scale and adding the offset. If omitted, scale defaults to 1.0, and offset to 0.0. .. code-block:: python out = ((image1 - image2) / scale + offset) :rtype: :py:class:`~PIL.Image.Image`
Subtracts two images, dividing the result by scale and adding the offset. If omitted, scale defaults to 1.0, and offset to 0.0.
def subtract(image1, image2, scale=1.0, offset=0): """ Subtracts two images, dividing the result by scale and adding the offset. If omitted, scale defaults to 1.0, and offset to 0.0. .. code-block:: python out = ((image1 - image2) / scale + offset) :rtype: :py:class:`~PIL.Image.Image` ...
[ "def", "subtract", "(", "image1", ",", "image2", ",", "scale", "=", "1.0", ",", "offset", "=", "0", ")", ":", "image1", ".", "load", "(", ")", "image2", ".", "load", "(", ")", "return", "image1", ".", "_new", "(", "image1", ".", "im", ".", "chop_...
[ 192, 0 ]
[ 206, 73 ]
python
en
['en', 'error', 'th']
False
add_modulo
(image1, image2)
Add two images, without clipping the result. .. code-block:: python out = ((image1 + image2) % MAX) :rtype: :py:class:`~PIL.Image.Image`
Add two images, without clipping the result.
def add_modulo(image1, image2): """Add two images, without clipping the result. .. code-block:: python out = ((image1 + image2) % MAX) :rtype: :py:class:`~PIL.Image.Image` """ image1.load() image2.load() return image1._new(image1.im.chop_add_modulo(image2.im))
[ "def", "add_modulo", "(", "image1", ",", "image2", ")", ":", "image1", ".", "load", "(", ")", "image2", ".", "load", "(", ")", "return", "image1", ".", "_new", "(", "image1", ".", "im", ".", "chop_add_modulo", "(", "image2", ".", "im", ")", ")" ]
[ 209, 0 ]
[ 221, 60 ]
python
en
['en', 'en', 'en']
True
subtract_modulo
(image1, image2)
Subtract two images, without clipping the result. .. code-block:: python out = ((image1 - image2) % MAX) :rtype: :py:class:`~PIL.Image.Image`
Subtract two images, without clipping the result.
def subtract_modulo(image1, image2): """Subtract two images, without clipping the result. .. code-block:: python out = ((image1 - image2) % MAX) :rtype: :py:class:`~PIL.Image.Image` """ image1.load() image2.load() return image1._new(image1.im.chop_subtract_modulo(image2.im))
[ "def", "subtract_modulo", "(", "image1", ",", "image2", ")", ":", "image1", ".", "load", "(", ")", "image2", ".", "load", "(", ")", "return", "image1", ".", "_new", "(", "image1", ".", "im", ".", "chop_subtract_modulo", "(", "image2", ".", "im", ")", ...
[ 224, 0 ]
[ 236, 65 ]
python
en
['en', 'en', 'en']
True