Skip to content

Commit

Permalink
Merge branch 'cdeil-fix-docstrings' into development
Browse files Browse the repository at this point in the history
  • Loading branch information
einarf committed Feb 2, 2025
2 parents 64546b7 + 8b846c5 commit 7717e3f
Show file tree
Hide file tree
Showing 21 changed files with 47 additions and 64 deletions.
8 changes: 4 additions & 4 deletions arcade/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -1388,9 +1388,9 @@ def on_mouse_drag(
Change in x since the last time this method was called
dy:
Change in y since the last time this method was called
buttons:
_buttons:
Which button is pressed
modifiers:
_modifiers:
Bitwise 'and' of all modifiers (shift, ctrl, num lock)
active during this event. See :ref:`keyboard_modifiers`.
"""
Expand Down Expand Up @@ -1493,9 +1493,9 @@ def on_key_release(self, _symbol: int, _modifiers: int) -> bool | None:
* Showing which keys are currently pressed down
Args:
symbol:
_symbol:
Key that was released
modifiers:
_modifiers:
Bitwise 'and' of all modifiers (shift, ctrl, num lock) active
during this event. See :ref:`keyboard_modifiers`.
"""
Expand Down
6 changes: 2 additions & 4 deletions arcade/cache/hit_box.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,8 @@ def get(self, name_or_texture: str | Texture) -> Point2List | None:
points = cache.get("hash|(0, 1, 2, 3)|simple|")
Args:
keys:
name_or_texture:
The texture or cache name to get the hit box for
hit_box_algorithm:
The hit box algorithm used
"""
from arcade import Texture

Expand All @@ -85,7 +83,7 @@ def put(self, name_or_texture: str | Texture, points: Point2List) -> None:
cache.put("my_custom_points", points)
Args:
keys:
name_or_texture:
The texture or cache name to store the hit box for
points:
The hit box points
Expand Down
13 changes: 7 additions & 6 deletions arcade/camera/camera_2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,13 +343,14 @@ def match_window(
Should be called when the window is resized.
Args:
and_projection: Flag whether to also equalize the projection to the viewport.
viewport: Flag whether to equalise the viewport to the value.
projection: Flag whether to also equalize the projection to the viewport.
On by default
and_scissor: Flag whether to also equalize the scissor box to the viewport.
scissor: Flag whether to also equalize the scissor box to the viewport.
On by default
and_position: Flag whether to also center the camera to the viewport.
position: Flag whether to also center the camera to the viewport.
Off by default
aspect_ratio: The ratio between width and height that the viewport should
aspect: The ratio between width and height that the viewport should
be constrained to. If unset then the viewport just matches the window
size. The aspect ratio describes how much larger the width should be
compared to the height. i.e. for an aspect ratio of ``4:3`` you should
Expand Down Expand Up @@ -383,7 +384,7 @@ def match_target(
scissor: Flag whether to update the scissor value.
position: Flag whether to also center the camera to the value.
Off by default
aspect_ratio: The ratio between width and height that the value should
aspect: The ratio between width and height that the value should
be constrained to. i.e. for an aspect ratio of ``4:3`` you should
input ``4.0/3.0`` or ``1.33333...``. Cannot be equal to zero.
If unset then the value will not be updated.
Expand Down Expand Up @@ -425,7 +426,7 @@ def update_values(
scissor: Flag whether to update the scissor value.
position: Flag whether to also center the camera to the value.
Off by default
aspect_ratio: The ratio between width and height that the value should
aspect: The ratio between width and height that the value should
be constrained to. i.e. for an aspect ratio of ``4:3`` you should
input ``4.0/3.0`` or ``1.33333...``. Cannot be equal to zero.
If unset then the value will not be updated.
Expand Down
2 changes: 0 additions & 2 deletions arcade/camera/data_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -450,8 +450,6 @@ def unproject(self, screen_coordinate: Point) -> Vec3:
Args:
screen_coordinate: A 2D position in pixels should generally be inside
the range of the active viewport.
depth: The depth of the query. This can be though of how far along the forward vector
the final coord will be.
Returns:
A 3D vector in world space.
"""
Expand Down
4 changes: 2 additions & 2 deletions arcade/camera/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class ViewportProjector:
Args:
viewport: The viewport to project to.
window: The window to bind the camera to. Defaults to the currently active window.
context: The window context to bind the camera to. Defaults to the currently active window.
"""

def __init__(
Expand Down Expand Up @@ -108,7 +108,7 @@ class DefaultProjector(ViewportProjector):
no instance where a developer would want to use this class.
Args:
window: The window to bind the camera to. Defaults to the currently active window.
context: The window context to bind the camera to. Defaults to the currently active window.
"""

def __init__(self, *, context: ArcadeContext | None = None):
Expand Down
2 changes: 0 additions & 2 deletions arcade/camera/orthographic.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,11 +181,9 @@ def unproject(self, screen_coordinate: Point) -> Vec3:
Args:
screen_coordinate: A 2D position in pixels from the bottom left of the screen.
This should ALWAYS be in the range of 0.0 - screen size.
depth: The depth of the query
Returns:
A 3D vector in world space.
"""

_projection = generate_orthographic_matrix(self._projection, self._view.zoom)
_view = generate_view_matrix(self._view)
return unproject_orthographic(screen_coordinate, self.viewport.lbwh_int, _view, _projection)
4 changes: 2 additions & 2 deletions arcade/draw/rect.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,9 @@ def draw_lbwh_rectangle_outline(
Draw a rectangle extending from bottom left to top right
Args:
bottom_left_x:
left:
The x coordinate of the left edge of the rectangle.
bottom_left_y:
bottom:
The y coordinate of the bottom of the rectangle.
width:
The width of the rectangle.
Expand Down
3 changes: 2 additions & 1 deletion arcade/future/light/lights.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ class LightLayer(RenderTargetTexture):
The size of a layer should ideally be of the same size and the screen.
Args:
size: Width and height of light layer
width: Width of light layer
height: Height of light layer
"""

def __init__(self, width: int, height: int):
Expand Down
11 changes: 8 additions & 3 deletions arcade/future/video/video_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,16 @@ def __init__(self, path: str | Path, loop: bool = False):

def draw(self, left: int = 0, bottom: int = 0, size: tuple[int, int] | None = None) -> None:
"""
Call this in `on_draw`.
Draw the current video frame.
Args:
size: Pass None as one of the elements if you want to use the
dimension(width, height) attribute.
left:
Window position from the left.
bottom:
Window position from the bottom.
size:
The size of the video rectangle.
If `None`, the video will be drawn in its original size.
"""
if size and len(size) == 2:
self._width = size[0] or self.width
Expand Down
2 changes: 0 additions & 2 deletions arcade/gl/framebuffer.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,8 +347,6 @@ def clear(
A 3 or 4 component tuple containing the color in normalized form
depth:
Value to clear the depth buffer (unused)
normalized:
If the color values are normalized or not
viewport:
The viewport range to clear
"""
Expand Down
2 changes: 0 additions & 2 deletions arcade/gl/glsl.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ class ShaderSource:
Common source code to inject
source_type:
The shader type
depth_attachment:
A depth attachment (optional)
"""

def __init__(
Expand Down
1 change: 0 additions & 1 deletion arcade/gui/surface.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,6 @@ def draw(
Args:
area: Limit the area in the surface we're drawing
(l, b, w, h)
pixelated: If True, the texture will be rendered pixelated
"""
# Set blend function
blend_func = self.ctx.blend_func
Expand Down
3 changes: 0 additions & 3 deletions arcade/paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,9 +253,6 @@ class AStarBarrierList:
Bottom of playing field
top (int):
Top of playing field
barrier_list:
SpriteList of barriers to use in _AStarSearch,
``None`` if not recalculated
Attributes:
grid_size:
Expand Down
4 changes: 2 additions & 2 deletions arcade/sections.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,8 +425,8 @@ def on_key_release(self, _symbol: int, _modifiers: int):
Called when the user releases a key.
Args:
symbol: the key released
modifiers: the modifiers pressed
_symbol: the key released
_modifiers: the modifiers pressed
"""
pass

Expand Down
1 change: 0 additions & 1 deletion arcade/shape_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,6 @@ def create_lines(
Args:
point_list: A list of points that make up the shape.
color: A color such as a :py:class:`~arcade.types.Color`
line_width: Width of the line
"""
return create_line_generic(point_list, color, gl.GL_LINES)

Expand Down
2 changes: 1 addition & 1 deletion arcade/sound.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ def play_sound(
try:
return sound.play(volume, pan, loop, speed)
except Exception as ex:
logger.warn("Error playing sound.", ex)
logger.warning("Error playing sound.", ex)
return None


Expand Down
4 changes: 1 addition & 3 deletions arcade/sprite/animated.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ class TextureAnimation:
Args:
keyframes:
List of keyframes for the animation.
loop:
If the animation should loop.
"""

__slots__ = ("_keyframes", "_duration_ms", "_timeline")
Expand Down Expand Up @@ -358,7 +356,7 @@ def update_animation(self, delta_time: float = 1 / 60) -> None:
self.texture = texture_list[self.cur_texture_index]

if self._texture is None:
logger.warn("Error, no texture set")
logger.warning("Error, no texture set")
else:
self.width = self._texture.width * self.scale_x
self.height = self._texture.height * self.scale_x
17 changes: 4 additions & 13 deletions arcade/texture/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,22 +133,16 @@ def load_or_get_spritesheet_texture(
hit_box_algorithm: hitbox.HitBoxAlgorithm | None = None,
) -> Texture:
"""
Slice out a a texture at x, y, width, height from a sprite sheet.
Slice out a texture slice from a sprite sheet.
* If the spritesheet is not already loaded, it will be loaded and cached.
* If the sliced texture is already cached, it will be returned instead.
Args:
path:
Path to the sprite sheet image
x:
X position of the texture in the sprite sheet
y:
Y position of the texture in the sprite sheet
width:
Width of the texture
height:
Height of the texture
rect:
Slice of the texture in the sprite sheet.
hit_box_algorithm (optional):
Hit box algorithm to use. If not specified, the global default will be used.
"""
Expand Down Expand Up @@ -188,9 +182,6 @@ def load_or_get_image(
Path of the file to load.
hash:
Optional override for image hash
cache:
If ``True``, the image will be cached. If ``False``, the
image will not be cached or returned from the cache.
mode:
The mode to use for the image. Default is "RGBA".
"""
Expand Down Expand Up @@ -223,7 +214,7 @@ def load_or_get_texture(
entire image is loaded.
Args:
file_name:
file_path:
Path to the image file.
x (optional):
X coordinate of the texture in the image.
Expand Down
10 changes: 6 additions & 4 deletions arcade/texture_atlas/atlas_default.py
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,7 @@ def get_texture_id(self, texture: "Texture") -> int:
Get the internal id for a Texture in the atlas
Args:
atlas_name: The name of the texture in the atlas
texture: The texture to get.
"""
return self._texture_uvs.get_slot_or_raise(texture.atlas_name)

Expand Down Expand Up @@ -883,7 +883,7 @@ def to_image(
Number of components. (3 = RGB, 4 = RGBA)
draw_borders:
Draw region borders into image
color:
border_color:
RGB color of the borders
Returns:
A pillow image containing the atlas texture
Expand Down Expand Up @@ -931,7 +931,7 @@ def show(
Number of components. (3 = RGB, 4 = RGBA)
draw_borders:
Draw region borders into image
color:
border_color:
RGB color of the borders
"""
self.to_image(
Expand Down Expand Up @@ -962,7 +962,9 @@ def save(
Flip the image horizontally
components:
Number of components. (3 = RGB, 4 = RGBA)
color:
draw_borders:
Draw region borders into image
border_color:
RGB color of the borders
"""
self.to_image(
Expand Down
10 changes: 6 additions & 4 deletions arcade/texture_atlas/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ def get_texture_id(self, texture: Texture) -> int:
Get the internal id for a Texture in the atlas
Args:
atlas_name: The name of the texture in the atlas
texture: The texture to get
"""
...

Expand Down Expand Up @@ -364,7 +364,7 @@ def to_image(
Number of components. (3 = RGB, 4 = RGBA)
draw_borders:
Draw region borders into image
color:
border_color:
RGB color of the borders
Returns:
A pillow image containing the atlas texture
Expand Down Expand Up @@ -392,7 +392,7 @@ def show(
Number of components. (3 = RGB, 4 = RGBA)
draw_borders:
Draw region borders into image
color:
border_color:
RGB color of the borders
"""
self.to_image(
Expand Down Expand Up @@ -425,7 +425,9 @@ def save(
Flip the image horizontally
components:
Number of components. (3 = RGB, 4 = RGBA)
color:
draw_borders:
Draw region borders into image
border_color:
RGB color of the borders
"""

Expand Down
2 changes: 0 additions & 2 deletions arcade/texture_atlas/region.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ class AtlasRegion:
Args:
atlas:
The atlas this region belongs to
texture:
The Arcade texture
x:
The x position of the texture
y:
Expand Down

0 comments on commit 7717e3f

Please sign in to comment.