neulab/docprompting-conala huggingface dataset:
pygame.sndarray
  
 pygame module for accessing sound sample data  Functions to convert between NumPy arrays and Sound objects. This module will only be available when pygame can use the external NumPy package. Sound data is made of thousands of samples per second, and each sample is the amplitude of the wave at a particular moment in time. For example, in 22-kHz format, element number 5 of the array is the amplitude of the wave after 5/22000 seconds. Each sample is an 8-bit or 16-bit integer, depending on the data format. A stereo sound file has two values per sample, while a mono sound file only has one.   pygame.sndarray.array() 
 copy Sound samples into an array array(Sound) -> array  Creates a new array for the sound data and copies the samples. The array will always be in the format returned from pygame.mixer.get_init(). 
   pygame.sndarray.samples() 
 reference Sound samples into an array samples(Sound) -> array  Creates a new array that directly references the samples in a Sound object. Modifying the array will change the Sound. The array will always be in the format returned from pygame.mixer.get_init(). 
   pygame.sndarray.make_sound() 
 convert an array into a Sound object make_sound(array) -> Sound  Create a new playable Sound object from an array. The mixer module must be initialized and the array format must be similar to the mixer audio format. 
   pygame.sndarray.use_arraytype() 
 Sets the array system to be used for sound arrays use_arraytype (arraytype) -> None  DEPRECATED: Uses the requested array type for the module functions. The only supported arraytype is 'numpy'. Other values will raise ValueError. 
   pygame.sndarray.get_arraytype() 
 Gets the currently active array type. get_arraytype () -> str  DEPRECATED: Returns the currently active array type. This will be a value of the get_arraytypes() tuple and indicates which type of array module is used for the array creation.  New in pygame 1.8.  
   pygame.sndarray.get_arraytypes() 
 Gets the array system types currently supported. get_arraytypes () -> tuple  DEPRECATED: Checks, which array systems are available and returns them as a tuple of strings. The values of the tuple can be used directly in the pygame.sndarray.use_arraytype() () method. If no supported array system could be found, None will be returned.  New in pygame 1.8.
pygame.mouse.get_cursor() 
 get the image of the mouse cursor get_cursor() -> (size, hotspot, xormasks, andmasks)  Get the information about the mouse system cursor. The return value is the same data as the arguments passed into pygame.mouse.set_cursor().  Note This method is unavailable with pygame 2, as SDL2 does not provide the underlying code to implement this method.
pygame.mouse.get_focused() 
 check if the display is receiving mouse input get_focused() -> bool  Returns true when pygame is receiving mouse input events (or, in windowing terminology, is "active" or has the "focus"). This method is most useful when working in a window. By contrast, in full-screen mode, this method always returns true. Note: under MS Windows, the window that has the mouse focus also has the keyboard focus. But under X-Windows, one window can receive mouse events and another receive keyboard events. pygame.mouse.get_focused() indicates whether the pygame window receives mouse events.
pygame.mouse.get_pos() 
 get the mouse cursor position get_pos() -> (x, y)  Returns the x and y position of the mouse cursor. The position is relative to the top-left corner of the display. The cursor position can be located outside of the display window, but is always constrained to the screen.
pygame.mouse.get_pressed() 
 get the state of the mouse buttons get_pressed(num_buttons=3) -> (button1, button2, button3) get_pressed(num_buttons=5) -> (button1, button2, button3, button4, button5)  Returns a sequence of booleans representing the state of all the mouse buttons. A true value means the mouse is currently being pressed at the time of the call. Note, to get all of the mouse events it is better to use either pygame.event.wait() or pygame.event.get() and check all of those events to see if they are MOUSEBUTTONDOWN, MOUSEBUTTONUP, or MOUSEMOTION. Note, that on X11 some X servers use middle button emulation. When you click both buttons 1 and 3 at the same time a 2 button event can be emitted. Note, remember to call pygame.event.get() before this function. Otherwise it will not work as expected. To support five button mice, an optional parameter num_buttons has been added in pygame 2. When this is set to 5, button4 and button5 are added to the returned tuple. Only 3 and 5 are valid values for this parameter.  Changed in pygame 2.0.0: num_buttons argument added
pygame.mouse.get_rel() 
 get the amount of mouse movement get_rel() -> (x, y)  Returns the amount of movement in x and y since the previous call to this function. The relative movement of the mouse cursor is constrained to the edges of the screen, but see the virtual input mouse mode for a way around this. Virtual input mode is described at the top of the page.
pygame.mouse.get_visible() 
 get the current visibility state of the mouse cursor get_visible() -> bool  Get the current visibility state of the mouse cursor. True if the mouse is visible, False otherwise.  New in pygame 2.0.0.
pygame.mouse.set_cursor() 
 set the image for the mouse cursor set_cursor(size, hotspot, xormasks, andmasks) -> None  When the mouse cursor is visible, it will be displayed as a black and white bitmap using the given bitmask arrays. The size is a sequence containing the cursor width and height. hotspot is a sequence containing the cursor hotspot position. A cursor has a width and height, but a mouse position is represented by a set of point coordinates. So the value passed into the cursor hotspot variable helps pygame to actually determine at what exact point the cursor is at. xormasks is a sequence of bytes containing the cursor xor data masks. Lastly andmasks, a sequence of bytes containing the cursor bitmask data. To create these variables, we can make use of the pygame.cursors.compile() function. Width and height must be a multiple of 8, and the mask arrays must be the correct size for the given width and height. Otherwise an exception is raised. See the pygame.cursor module for help creating default and custom masks for the mouse cursor and also for more examples related to cursors.
pygame.mouse.set_pos() 
 set the mouse cursor position set_pos([x, y]) -> None  Set the current mouse position to arguments given. If the mouse cursor is visible it will jump to the new coordinates. Moving the mouse will generate a new pygame.MOUSEMOTION event.
pygame.mouse.set_system_cursor() 
 set the mouse cursor to a system variant set_system_cursor(constant) -> None  When the mouse cursor is visible, it will displayed as a operating system specific variant of the options below. Pygame Cursor Constant           Description
--------------------------------------------
pygame.SYSTEM_CURSOR_ARROW       arrow
pygame.SYSTEM_CURSOR_IBEAM       i-beam
pygame.SYSTEM_CURSOR_WAIT        wait
pygame.SYSTEM_CURSOR_CROSSHAIR   crosshair
pygame.SYSTEM_CURSOR_WAITARROW   small wait cursor
                                 (or wait if not available)
pygame.SYSTEM_CURSOR_SIZENWSE    double arrow pointing
                                 northwest and southeast
pygame.SYSTEM_CURSOR_SIZENESW    double arrow pointing
                                 northeast and southwest
pygame.SYSTEM_CURSOR_SIZEWE      double arrow pointing
                                 west and east
pygame.SYSTEM_CURSOR_SIZENS      double arrow pointing
                                 north and south
pygame.SYSTEM_CURSOR_SIZEALL     four pointed arrow pointing
                                 north, south, east, and west
pygame.SYSTEM_CURSOR_NO          slashed circle or crossbones
pygame.SYSTEM_CURSOR_HAND        hand  New in pygame 2.0.0.
pygame.mouse.set_visible() 
 hide or show the mouse cursor set_visible(bool) -> bool  If the bool argument is true, the mouse cursor will be visible. This will return the previous visible state of the cursor.
pygame.Overlay
  
 pygame object for video overlay graphics Overlay(format, (width, height)) -> Overlay  The Overlay objects provide support for accessing hardware video overlays. Video overlays do not use standard RGB pixel formats, and can use multiple resolutions of data to create a single image. The Overlay objects represent lower level access to the display hardware. To use the object you must understand the technical details of video overlays. The Overlay format determines the type of pixel data used. Not all hardware will support all types of overlay formats. Here is a list of available format types: YV12_OVERLAY, IYUV_OVERLAY, YUY2_OVERLAY, UYVY_OVERLAY, YVYU_OVERLAY The width and height arguments control the size for the overlay image data. The overlay image can be displayed at any size, not just the resolution of the overlay. The overlay objects are always visible, and always show above the regular display contents.   display() 
 set the overlay pixel data display((y, u, v)) -> None display() -> None  Display the YUV data in SDL's overlay planes. The y, u, and v arguments are strings of binary data. The data must be in the correct format used to create the Overlay. If no argument is passed in, the Overlay will simply be redrawn with the current data. This can be useful when the Overlay is not really hardware accelerated. The strings are not validated, and improperly sized strings could crash the program. 
   set_location() 
 control where the overlay is displayed set_location(rect) -> None  Set the location for the overlay. The overlay will always be shown relative to the main display Surface. This does not actually redraw the overlay, it will be updated on the next call to Overlay.display(). 
   get_hardware() 
 test if the Overlay is hardware accelerated get_hardware(rect) -> int  Returns a True value when the Overlay is hardware accelerated. If the platform does not support acceleration, software rendering is used.
display() 
 set the overlay pixel data display((y, u, v)) -> None display() -> None  Display the YUV data in SDL's overlay planes. The y, u, and v arguments are strings of binary data. The data must be in the correct format used to create the Overlay. If no argument is passed in, the Overlay will simply be redrawn with the current data. This can be useful when the Overlay is not really hardware accelerated. The strings are not validated, and improperly sized strings could crash the program.
get_hardware() 
 test if the Overlay is hardware accelerated get_hardware(rect) -> int  Returns a True value when the Overlay is hardware accelerated. If the platform does not support acceleration, software rendering is used.
set_location() 
 control where the overlay is displayed set_location(rect) -> None  Set the location for the overlay. The overlay will always be shown relative to the main display Surface. This does not actually redraw the overlay, it will be updated on the next call to Overlay.display().
close() 
 Closes the PixelArray, and releases Surface lock. transpose() -> PixelArray  This method is for explicitly closing the PixelArray, and releasing a lock on the Suface.  New in pygame 1.9.4.
compare() 
 Compares the PixelArray with another one. compare(array, distance=0, weights=(0.299, 0.587, 0.114)) -> PixelArray  Compares the contents of the PixelArray with those from the passed in PixelArray. It returns a new PixelArray with a black/white color mask that indicates the differences (black) of both arrays. Both PixelArray objects must have identical bit depths and dimensions. It uses a simple weighted Euclidean distance formula to calculate the distance between the colors. The distance space ranges from 0.0 to 1.0 and is used as a threshold for the color detection. This causes the comparison to mark pixels with a similar, but not exactly identical color, as white.  New in pygame 1.8.1.
extract() 
 Extracts the passed color from the PixelArray. extract(color, distance=0, weights=(0.299, 0.587, 0.114)) -> PixelArray  Extracts the passed color by changing all matching pixels to white, while non-matching pixels are changed to black. This returns a new PixelArray with the black/white color mask. It uses a simple weighted Euclidean distance formula to calculate the distance between the colors. The distance space ranges from 0.0 to 1.0 and is used as threshold for the color detection. This causes the extraction to take pixels with a similar, but not exactly identical color, into account as well.  New in pygame 1.8.1.
itemsize 
 Returns the byte size of a pixel array item itemsize -> int  This is the same as Surface.get_bytesize() for the pixel array's surface.  New in pygame 1.9.2.
make_surface() 
 Creates a new Surface from the current PixelArray. make_surface() -> Surface  Creates a new Surface from the current PixelArray. Depending on the current PixelArray the size, pixel order etc. will be different from the original Surface. # Create a new surface flipped around the vertical axis.
sf = pxarray[:,::-1].make_surface ()  New in pygame 1.8.1.
ndim 
 Returns the number of dimensions. ndim -> int  A pixel array can be 1 or 2 dimensional.  New in pygame 1.9.2.
replace() 
 Replaces the passed color in the PixelArray with another one. replace(color, repcolor, distance=0, weights=(0.299, 0.587, 0.114)) -> None  Replaces the pixels with the passed color in the PixelArray by changing them them to the passed replacement color. It uses a simple weighted Euclidean distance formula to calculate the distance between the colors. The distance space ranges from 0.0 to 1.0 and is used as threshold for the color detection. This causes the replacement to take pixels with a similar, but not exactly identical color, into account as well. This is an in place operation that directly affects the pixels of the PixelArray.  New in pygame 1.8.1.
shape 
 Returns the array size. shape -> tuple of int's  A tuple or length ndim giving the length of each dimension. Analogous to Surface.get_size().  New in pygame 1.9.2.
strides 
 Returns byte offsets for each array dimension. strides -> tuple of int's  A tuple or length ndim byte counts. When a stride is multiplied by the corresponding index it gives the offset of that index from the start of the array. A stride is negative for an array that has is inverted (has a negative step).  New in pygame 1.9.2.
surface 
 Gets the Surface the PixelArray uses. surface -> Surface  The Surface the PixelArray was created for.
transpose() 
 Exchanges the x and y axis. transpose() -> PixelArray  This method returns a new view of the pixel array with the rows and columns swapped. So for a (w, h) sized array a (h, w) slice is returned. If an array is one dimensional, then a length 1 x dimension is added, resulting in a 2D pixel array.  New in pygame 1.9.2.
pygame.pixelcopy.array_to_surface() 
 copy an array object to a surface array_to_surface(<surface>, <array>) -> None  See pygame.surfarray.blit_array().
pygame.pixelcopy.make_surface() 
 Copy an array to a new surface pygame.pixelcopy.make_surface(array) -> Surface  Create a new Surface that best resembles the data and format of the array. The array can be 2D or 3D with any sized integer values.
pygame.pixelcopy.map_array() 
 copy an array to another array, using surface format map_array(<array>, <array>, <surface>) -> None  Map an array of color element values - (w, h, ..., 3) - to an array of pixels - (w, h) according to the format of <surface>.
pygame.pixelcopy.surface_to_array() 
 copy surface pixels to an array object surface_to_array(array, surface, kind='P', opaque=255, clear=0) -> None  The surface_to_array function copies pixels from a Surface object to a 2D or 3D array. Depending on argument kind and the target array dimension, a copy may be raw pixel value, RGB, a color component slice, or colorkey alpha transparency value. Recognized kind values are the single character codes 'P', 'R', 'G', 'B', 'A', and 'C'. Kind codes are case insensitive, so 'p' is equivalent to 'P'. The first two dimensions of the target must be the surface size (w, h). The default 'P' kind code does a direct raw integer pixel (mapped) value copy to a 2D array and a 'RGB' pixel component (unmapped) copy to a 3D array having shape (w, h, 3). For an 8 bit colormap surface this means the table index is copied to a 2D array, not the table value itself. A 2D array's item size must be at least as large as the surface's pixel byte size. The item size of a 3D array must be at least one byte. For the 'R', 'G', 'B', and 'A' copy kinds a single color component of the unmapped surface pixels are copied to the target 2D array. For kind 'A' and surfaces with source alpha (the surface was created with the SRCALPHA flag), has a colorkey (set with Surface.set_colorkey()), or has a blanket alpha (set with Surface.set_alpha()) then the alpha values are those expected for a SDL surface. If a surface has no explicit alpha value, then the target array is filled with the value of the optional opaque surface_to_array argument (default 255: not transparent). Copy kind 'C' is a special case for alpha copy of a source surface with colorkey. Unlike the 'A' color component copy, the clear argument value is used for colorkey matches, opaque otherwise. By default, a match has alpha 0 (totally transparent), while everything else is alpha 255 (totally opaque). It is a more general implementation of pygame.surfarray.array_colorkey(). Specific to surface_to_array, a ValueError is raised for target arrays with incorrect shape or item size. A TypeError is raised for an incorrect kind code. Surface specific problems, such as locking, raise a pygame.error.
pygame.quit() 
 uninitialize all pygame modules quit() -> None  Uninitialize all pygame modules that have previously been initialized. When the Python interpreter shuts down, this method is called regardless, so your program should not need it, except when it wants to terminate its pygame resources and continue. It is safe to call this function more than once as repeated calls have no effect.  Note Calling pygame.quit() will not exit your program. Consider letting your program end in the same way a normal Python program will end.
clamp() 
 moves the rectangle inside another clamp(Rect) -> Rect  Returns a new rectangle that is moved to be completely inside the argument Rect. If the rectangle is too large to fit inside, it is centered inside the argument Rect, but its size is not changed.
clamp_ip() 
 moves the rectangle inside another, in place clamp_ip(Rect) -> None  Same as the Rect.clamp() method, but operates in place.
clip() 
 crops a rectangle inside another clip(Rect) -> Rect  Returns a new rectangle that is cropped to be completely inside the argument Rect. If the two rectangles do not overlap to begin with, a Rect with 0 size is returned.
clipline() 
 crops a line inside a rectangle clipline(x1, y1, x2, y2) -> ((cx1, cy1), (cx2, cy2)) clipline(x1, y1, x2, y2) -> () clipline((x1, y1), (x2, y2)) -> ((cx1, cy1), (cx2, cy2)) clipline((x1, y1), (x2, y2)) -> () clipline((x1, y1, x2, y2)) -> ((cx1, cy1), (cx2, cy2)) clipline((x1, y1, x2, y2)) -> () clipline(((x1, y1), (x2, y2))) -> ((cx1, cy1), (cx2, cy2)) clipline(((x1, y1), (x2, y2))) -> ()  Returns the coordinates of a line that is cropped to be completely inside the rectangle. If the line does not overlap the rectangle, then an empty tuple is returned. The line to crop can be any of the following formats (floats can be used in place of ints, but they will be truncated):  
 four ints 2 lists/tuples/Vector2s of 2 ints a list/tuple of four ints a list/tuple of 2 lists/tuples/Vector2s of 2 ints  
     
Returns:
a tuple with the coordinates of the given line cropped to be completely inside the rectangle is returned, if the given line does not overlap the rectangle, an empty tuple is returned  
Return type:
tuple(tuple(int, int), tuple(int, int)) or ()  
Raises:

TypeError -- if the line coordinates are not given as one of the above described line formats     Note This method can be used for collision detection between a rect and a line. See example code below.   Note The rect.bottom and rect.right attributes of a pygame.Rect always lie one pixel outside of its actual border.  # Example using clipline().
clipped_line = rect.clipline(line)

if clipped_line:
    # If clipped_line is not an empty tuple then the line
    # collides/overlaps with the rect. The returned value contains
    # the endpoints of the clipped line.
    start, end = clipped_line
    x1, y1 = start
    x2, y2 = end
else:
    print("No clipping. The line is fully outside the rect.")  New in pygame 2.0.0.
collidedict() 
 test if one rectangle in a dictionary intersects collidedict(dict) -> (key, value) collidedict(dict) -> None collidedict(dict, use_values=0) -> (key, value) collidedict(dict, use_values=0) -> None  Returns the first key and value pair that intersects with the calling Rect object. If no collisions are found, None is returned. If use_values is 0 (default) then the dict's keys will be used in the collision detection, otherwise the dict's values will be used.  Note Rect objects cannot be used as keys in a dictionary (they are not hashable), so they must be converted to a tuple/list. e.g. rect.collidedict({tuple(key_rect) : value})
collidedictall() 
 test if all rectangles in a dictionary intersect collidedictall(dict) -> [(key, value), ...] collidedictall(dict, use_values=0) -> [(key, value), ...]  Returns a list of all the key and value pairs that intersect with the calling Rect object. If no collisions are found an empty list is returned. If use_values is 0 (default) then the dict's keys will be used in the collision detection, otherwise the dict's values will be used.  Note Rect objects cannot be used as keys in a dictionary (they are not hashable), so they must be converted to a tuple/list. e.g. rect.collidedictall({tuple(key_rect) : value})
collidelist() 
 test if one rectangle in a list intersects collidelist(list) -> index  Test whether the rectangle collides with any in a sequence of rectangles. The index of the first collision found is returned. If no collisions are found an index of -1 is returned.
collidelistall() 
 test if all rectangles in a list intersect collidelistall(list) -> indices  Returns a list of all the indices that contain rectangles that collide with the Rect. If no intersecting rectangles are found, an empty list is returned.
collidepoint() 
 test if a point is inside a rectangle collidepoint(x, y) -> bool collidepoint((x,y)) -> bool  Returns true if the given point is inside the rectangle. A point along the right or bottom edge is not considered to be inside the rectangle.  Note For collision detection between a rect and a line the clipline() method can be used.
colliderect() 
 test if two rectangles overlap colliderect(Rect) -> bool  Returns true if any portion of either rectangle overlap (except the top+bottom or left+right edges).  Note For collision detection between a rect and a line the clipline() method can be used.
contains() 
 test if one rectangle is inside another contains(Rect) -> bool  Returns true when the argument is completely inside the Rect.
copy() 
 copy the rectangle copy() -> Rect  Returns a new rectangle having the same position and size as the original. New in pygame 1.9
fit() 
 resize and move a rectangle with aspect ratio fit(Rect) -> Rect  Returns a new rectangle that is moved and resized to fit another. The aspect ratio of the original Rect is preserved, so the new rectangle may be smaller than the target in either width or height.
inflate() 
 grow or shrink the rectangle size inflate(x, y) -> Rect  Returns a new rectangle with the size changed by the given offset. The rectangle remains centered around its current center. Negative values will shrink the rectangle. Note, uses integers, if the offset given is too small(< 2 > -2), center will be off.
inflate_ip() 
 grow or shrink the rectangle size, in place inflate_ip(x, y) -> None  Same as the Rect.inflate() method, but operates in place.
move() 
 moves the rectangle move(x, y) -> Rect  Returns a new rectangle that is moved by the given offset. The x and y arguments can be any integer value, positive or negative.