Skip to content

doc_stack/no_types_in_docstrings #1862

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Aug 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion arcade/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

def configure_logging(level: Optional[int] = None):
"""Set up basic logging.
:param int level: The log level. Defaults to DEBUG.
:param level: The log level. Defaults to DEBUG.
"""
import logging
level = level or logging.DEBUG
Expand Down
215 changes: 106 additions & 109 deletions arcade/application.py

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion arcade/background/background_texture.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def wrap_y(self, value: int):

def use(self, unit: int = 0) -> None:
"""Bind the texture to a channel,
:param int unit: The texture unit to bind the texture.
:param unit: The texture unit to bind the texture.
"""
self.texture.use(unit)

Expand Down
10 changes: 5 additions & 5 deletions arcade/cache/hit_box.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def get(self, name_or_texture: Union[str, "Texture"]) -> Optional[PointList]:
points = cache.get("hash|(0, 1, 2, 3)|simple|")

:param keys: List of keys to use for the cache entry
:param str hit_box_algorithm: The hit box algorithm used
:param hit_box_algorithm: The hit box algorithm used
"""
from arcade import Texture

Expand All @@ -79,8 +79,8 @@ def put(self, name_or_texture: Union[str, "Texture"], points: PointList) -> None
# Cache with custom string
cache.put("my_custom_points", points)

:param List[Any] keys: List of keys to use for the cache entry
:param PointList points: The hit box points
:param keys: List of keys to use for the cache entry
:param points: The hit box points
"""
from arcade import Texture

Expand Down Expand Up @@ -124,8 +124,8 @@ def save(self, path: Path, indent: int = 0) -> None:

if the file extension is ".gz" the file will be compressed.

:param Path path: The path to save the cache to
:param int indent: The indentation level for the json file
:param path: The path to save the cache to
:param indent: The indentation level for the json file
"""
if indent == 0:
data_str = json.dumps(self._entries)
Expand Down
43 changes: 21 additions & 22 deletions arcade/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def _set_projection_matrix(self, *, update_combined_matrix: bool = True) -> None
"""
Helper method. This will just pre-compute the projection and combined matrix

:param bool update_combined_matrix: if True will also update the combined matrix (projection @ view)
:param update_combined_matrix: if True will also update the combined matrix (projection @ view)
"""
self._projection_matrix = Mat4.orthogonal_projection(*self._projection, -100, 100)
if update_combined_matrix:
Expand All @@ -157,7 +157,7 @@ def _set_view_matrix(self, *, update_combined_matrix: bool = True) -> None:
"""
Helper method. This will just pre-compute the view and combined matrix

:param bool update_combined_matrix: if True will also update the combined matrix (projection @ view)
:param update_combined_matrix: if True will also update the combined matrix (projection @ view)
"""

# Figure out our 'real' position
Expand All @@ -181,8 +181,8 @@ def move_to(self, vector: Union[Vec2, tuple], speed: float = 1.0) -> None:
The camera will lerp towards this position based on the provided speed,
updating its position every time the use() function is called.

:param Vec2 vector: Vector to move the camera towards.
:param Vec2 speed: How fast to move the camera, 1.0 is instant, 0.1 moves slowly
:param vector: Vector to move the camera towards.
:param speed: How fast to move the camera, 1.0 is instant, 0.1 moves slowly
"""
self.goal_position = Vec2(*vector)
self.move_speed = speed
Expand Down Expand Up @@ -221,7 +221,7 @@ def get_map_coordinates(self, camera_vector: Union[Vec2, tuple]) -> Vec2:
"""
Returns map coordinates in pixels from screen coordinates based on the camera position

:param Vec2 camera_vector: Vector captured from the camera viewport
:param camera_vector: Vector captured from the camera viewport
"""
return Vec2(*self.position) + Vec2(*camera_vector)

Expand All @@ -230,9 +230,9 @@ def resize(self, viewport_width: int, viewport_height: int, *,
"""
Resize the camera's viewport. Call this when the window resizes.

:param int viewport_width: Width of the viewport
:param int viewport_height: Height of the viewport
:param bool resize_projection: if True the projection will also be resized
:param viewport_width: Width of the viewport
:param viewport_height: Height of the viewport
:param resize_projection: if True the projection will also be resized
"""
new_viewport = (self._viewport[0], self._viewport[1], viewport_width, viewport_height)
self.set_viewport(new_viewport)
Expand Down Expand Up @@ -272,12 +272,12 @@ class Camera(SimpleCamera):
It is very useful for separating a scrolling screen of sprites, and a GUI overlay.
For an example of this in action, see :ref:`sprite_move_scrolling`.

:param tuple viewport: (left, bottom, width, height) size of the viewport. If None the window size will be used.
:param tuple projection: (left, right, bottom, top) size of the projection. If None the window size will be used.
:param float zoom: the zoom to apply to the projection
:param float rotation: the angle in degrees to rotate the projection
:param tuple anchor: the x, y point where the camera rotation will anchor. Default is the center of the viewport.
:param Window window: Window to associate with this camera, if working with a multi-window program.
:param viewport: (left, bottom, width, height) size of the viewport. If None the window size will be used.
:param projection: (left, right, bottom, top) size of the projection. If None the window size will be used.
:param zoom: the zoom to apply to the projection
:param rotation: the angle in degrees to rotate the projection
:param anchor: the x, y point where the camera rotation will anchor. Default is the center of the viewport.
:param window: Window to associate with this camera, if working with a multi-window program.
"""
def __init__(
self, *,
Expand Down Expand Up @@ -331,7 +331,7 @@ def _set_projection_matrix(self, *, update_combined_matrix: bool = True) -> None
"""
Helper method. This will just pre-compute the projection and combined matrix

:param bool update_combined_matrix: if True will also update the combined matrix (projection @ view)
:param update_combined_matrix: if True will also update the combined matrix (projection @ view)
"""
# apply zoom
left, right, bottom, top = self._projection
Expand All @@ -347,7 +347,7 @@ def _set_projection_matrix(self, *, update_combined_matrix: bool = True) -> None
def _set_view_matrix(self, *, update_combined_matrix: bool = True) -> None:
"""
Helper method. This will just pre-compute the view and combined matrix
:param bool update_combined_matrix: if True will also update the combined matrix (projection @ view)
:param update_combined_matrix: if True will also update the combined matrix (projection @ view)
"""

# Figure out our 'real' position plus the shake
Expand Down Expand Up @@ -540,9 +540,9 @@ def shake(self, velocity: Union[Vec2, tuple], speed: float = 1.5, damping: float
"""
Add a camera shake.

:param Vec2 velocity: Vector to start moving the camera
:param float speed: How fast to shake
:param float damping: How fast to stop shaking
:param velocity: Vector to start moving the camera
:param speed: How fast to shake
:param damping: How fast to stop shaking
"""
if not isinstance(velocity, Vec2):
velocity = Vec2(*velocity)
Expand All @@ -568,10 +568,9 @@ def get_sprites_at_point(self, point: "Point", sprite_list: "SpriteList") -> Lis
the specified point. If a sprite has a different center_x/center_y but touches the point,
this will return that sprite.

:param Point point: Point to check
:param SpriteList sprite_list: SpriteList to check against
:param point: Point to check
:param sprite_list: SpriteList to check against

:returns: List of sprites colliding, or an empty list.
:rtype: list
"""
raise NotImplementedError()
40 changes: 20 additions & 20 deletions arcade/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ class ArcadeContext(Context):
**This is part of the low level rendering API in arcade
and is mainly for more advanced usage**

:param pyglet.window.Window window: The pyglet window
:param str gc_mode: The garbage collection mode for opengl objects.
:param window: The pyglet window
:param gc_mode: The garbage collection mode for opengl objects.
``auto`` is just what we would expect in python
while ``context_gc`` (default) requires you to call ``Context.gc()``.
The latter can be useful when using multiple threads when
Expand Down Expand Up @@ -367,17 +367,17 @@ def load_program(
fragment_shader="frag.glsl",
)

:param Union[str,pathlib.Path] vertex_shader: path to vertex shader
:param Union[str,pathlib.Path] fragment_shader: path to fragment shader (optional)
:param Union[str,pathlib.Path] geometry_shader: path to geometry shader (optional)
:param Union[str,pathlib.Path] tess_control_shader: Tessellation Control Shader
:param Union[str,pathlib.Path] tess_evaluation_shader: Tessellation Evaluation Shader
:param List[Union[str,pathlib.Path]] common: Common files to be included in all shaders
:param dict defines: Substitute ``#define`` values in the source
:param Optional[Sequence[str]] varyings: The name of the out attributes in a transform shader.
:param vertex_shader: path to vertex shader
:param fragment_shader: path to fragment shader (optional)
:param geometry_shader: path to geometry shader (optional)
:param tess_control_shader: Tessellation Control Shader
:param tess_evaluation_shader: Tessellation Evaluation Shader
:param common: Common files to be included in all shaders
:param defines: Substitute ``#define`` values in the source
:param varyings: The name of the out attributes in a transform shader.
This is normally not necessary since we auto detect them,
but some more complex out structures we can't detect.
:param str varyings_capture_mode: The capture mode for transforms.
:param varyings_capture_mode: The capture mode for transforms.
``"interleaved"`` means all out attribute will be written to a single buffer.
``"separate"`` means each out attribute will be written separate buffers.
Based on these settings the `transform()` method will accept a single
Expand Down Expand Up @@ -430,8 +430,8 @@ def load_compute_shader(self, path: Union[str, Path], common: Iterable[Union[str

ctx.load_compute_shader(":shader:compute/do_work.glsl")

:param Union[str,pathlib.Path] path: Path to texture
:param Iterable[Union[str,pathlib.Path]] common: Common source injected into compute shader
:param path: Path to texture
:param common: Common source injected into compute shader
"""
from arcade.resources import resolve
path = resolve(path)
Expand Down Expand Up @@ -459,9 +459,9 @@ def load_texture(
# Load a texture using Arcade resource handle
texture = window.ctx.load_texture(":textures:background.png")

:param Union[str,pathlib.Path] path: Path to texture
:param bool flip: Flips the image upside down
:param bool build_mipmaps: Build mipmaps for the texture
:param path: Path to texture
:param flip: Flips the image upside down
:param build_mipmaps: Build mipmaps for the texture
"""
from arcade.resources import resolve

Expand Down Expand Up @@ -494,7 +494,7 @@ def shader_inc(self, source: str) -> str:

#include :my_shader:lib/common.glsl

:param str source: Shader
:param source: Shader
"""
from arcade.resources import resolve
lines = source.splitlines()
Expand All @@ -514,9 +514,9 @@ def get_framebuffer_image(
"""
Shortcut method for reading data from a framebuffer and converting it to a PIL image.

:param Framebuffer fbo: Framebuffer to get image from
:param int components: Number of components to read
:param bool flip: Flip the image upside down
:param fbo: Framebuffer to get image from
:param components: Number of components to read
:param flip: Flip the image upside down
"""
mode = "RGBA"[:components]
image = Image.frombuffer(
Expand Down
Loading