Skip to content

Commit 9bd9c5b

Browse files
authored
doc_stack/no_types_in_docstrings (#1862)
* initial commit for doc_stack/no_types_in_docstrings * Remove all types from :param: docstrings; standardize on typehints Find-and-replace: (:param )\S+ (\S+:) with: $1$2 * Write script to remove :rtype: annotations * Commit results of running that script * Prevent `-> None` annotation from appearing on class constructors * fix
1 parent 34d7c87 commit 9bd9c5b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+1176
-1165
lines changed

arcade/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
def configure_logging(level: Optional[int] = None):
2121
"""Set up basic logging.
22-
:param int level: The log level. Defaults to DEBUG.
22+
:param level: The log level. Defaults to DEBUG.
2323
"""
2424
import logging
2525
level = level or logging.DEBUG

arcade/application.py

Lines changed: 106 additions & 109 deletions
Large diffs are not rendered by default.

arcade/background/background_texture.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ def wrap_y(self, value: int):
118118

119119
def use(self, unit: int = 0) -> None:
120120
"""Bind the texture to a channel,
121-
:param int unit: The texture unit to bind the texture.
121+
:param unit: The texture unit to bind the texture.
122122
"""
123123
self.texture.use(unit)
124124

arcade/cache/hit_box.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def get(self, name_or_texture: Union[str, "Texture"]) -> Optional[PointList]:
5757
points = cache.get("hash|(0, 1, 2, 3)|simple|")
5858
5959
:param keys: List of keys to use for the cache entry
60-
:param str hit_box_algorithm: The hit box algorithm used
60+
:param hit_box_algorithm: The hit box algorithm used
6161
"""
6262
from arcade import Texture
6363

@@ -79,8 +79,8 @@ def put(self, name_or_texture: Union[str, "Texture"], points: PointList) -> None
7979
# Cache with custom string
8080
cache.put("my_custom_points", points)
8181
82-
:param List[Any] keys: List of keys to use for the cache entry
83-
:param PointList points: The hit box points
82+
:param keys: List of keys to use for the cache entry
83+
:param points: The hit box points
8484
"""
8585
from arcade import Texture
8686

@@ -124,8 +124,8 @@ def save(self, path: Path, indent: int = 0) -> None:
124124
125125
if the file extension is ".gz" the file will be compressed.
126126
127-
:param Path path: The path to save the cache to
128-
:param int indent: The indentation level for the json file
127+
:param path: The path to save the cache to
128+
:param indent: The indentation level for the json file
129129
"""
130130
if indent == 0:
131131
data_str = json.dumps(self._entries)

arcade/camera.py

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ def _set_projection_matrix(self, *, update_combined_matrix: bool = True) -> None
147147
"""
148148
Helper method. This will just pre-compute the projection and combined matrix
149149
150-
:param bool update_combined_matrix: if True will also update the combined matrix (projection @ view)
150+
:param update_combined_matrix: if True will also update the combined matrix (projection @ view)
151151
"""
152152
self._projection_matrix = Mat4.orthogonal_projection(*self._projection, -100, 100)
153153
if update_combined_matrix:
@@ -157,7 +157,7 @@ def _set_view_matrix(self, *, update_combined_matrix: bool = True) -> None:
157157
"""
158158
Helper method. This will just pre-compute the view and combined matrix
159159
160-
:param bool update_combined_matrix: if True will also update the combined matrix (projection @ view)
160+
:param update_combined_matrix: if True will also update the combined matrix (projection @ view)
161161
"""
162162

163163
# Figure out our 'real' position
@@ -181,8 +181,8 @@ def move_to(self, vector: Union[Vec2, tuple], speed: float = 1.0) -> None:
181181
The camera will lerp towards this position based on the provided speed,
182182
updating its position every time the use() function is called.
183183
184-
:param Vec2 vector: Vector to move the camera towards.
185-
:param Vec2 speed: How fast to move the camera, 1.0 is instant, 0.1 moves slowly
184+
:param vector: Vector to move the camera towards.
185+
:param speed: How fast to move the camera, 1.0 is instant, 0.1 moves slowly
186186
"""
187187
self.goal_position = Vec2(*vector)
188188
self.move_speed = speed
@@ -221,7 +221,7 @@ def get_map_coordinates(self, camera_vector: Union[Vec2, tuple]) -> Vec2:
221221
"""
222222
Returns map coordinates in pixels from screen coordinates based on the camera position
223223
224-
:param Vec2 camera_vector: Vector captured from the camera viewport
224+
:param camera_vector: Vector captured from the camera viewport
225225
"""
226226
return Vec2(*self.position) + Vec2(*camera_vector)
227227

@@ -230,9 +230,9 @@ def resize(self, viewport_width: int, viewport_height: int, *,
230230
"""
231231
Resize the camera's viewport. Call this when the window resizes.
232232
233-
:param int viewport_width: Width of the viewport
234-
:param int viewport_height: Height of the viewport
235-
:param bool resize_projection: if True the projection will also be resized
233+
:param viewport_width: Width of the viewport
234+
:param viewport_height: Height of the viewport
235+
:param resize_projection: if True the projection will also be resized
236236
"""
237237
new_viewport = (self._viewport[0], self._viewport[1], viewport_width, viewport_height)
238238
self.set_viewport(new_viewport)
@@ -272,12 +272,12 @@ class Camera(SimpleCamera):
272272
It is very useful for separating a scrolling screen of sprites, and a GUI overlay.
273273
For an example of this in action, see :ref:`sprite_move_scrolling`.
274274
275-
:param tuple viewport: (left, bottom, width, height) size of the viewport. If None the window size will be used.
276-
:param tuple projection: (left, right, bottom, top) size of the projection. If None the window size will be used.
277-
:param float zoom: the zoom to apply to the projection
278-
:param float rotation: the angle in degrees to rotate the projection
279-
:param tuple anchor: the x, y point where the camera rotation will anchor. Default is the center of the viewport.
280-
:param Window window: Window to associate with this camera, if working with a multi-window program.
275+
:param viewport: (left, bottom, width, height) size of the viewport. If None the window size will be used.
276+
:param projection: (left, right, bottom, top) size of the projection. If None the window size will be used.
277+
:param zoom: the zoom to apply to the projection
278+
:param rotation: the angle in degrees to rotate the projection
279+
:param anchor: the x, y point where the camera rotation will anchor. Default is the center of the viewport.
280+
:param window: Window to associate with this camera, if working with a multi-window program.
281281
"""
282282
def __init__(
283283
self, *,
@@ -331,7 +331,7 @@ def _set_projection_matrix(self, *, update_combined_matrix: bool = True) -> None
331331
"""
332332
Helper method. This will just pre-compute the projection and combined matrix
333333
334-
:param bool update_combined_matrix: if True will also update the combined matrix (projection @ view)
334+
:param update_combined_matrix: if True will also update the combined matrix (projection @ view)
335335
"""
336336
# apply zoom
337337
left, right, bottom, top = self._projection
@@ -347,7 +347,7 @@ def _set_projection_matrix(self, *, update_combined_matrix: bool = True) -> None
347347
def _set_view_matrix(self, *, update_combined_matrix: bool = True) -> None:
348348
"""
349349
Helper method. This will just pre-compute the view and combined matrix
350-
:param bool update_combined_matrix: if True will also update the combined matrix (projection @ view)
350+
:param update_combined_matrix: if True will also update the combined matrix (projection @ view)
351351
"""
352352

353353
# Figure out our 'real' position plus the shake
@@ -540,9 +540,9 @@ def shake(self, velocity: Union[Vec2, tuple], speed: float = 1.5, damping: float
540540
"""
541541
Add a camera shake.
542542
543-
:param Vec2 velocity: Vector to start moving the camera
544-
:param float speed: How fast to shake
545-
:param float damping: How fast to stop shaking
543+
:param velocity: Vector to start moving the camera
544+
:param speed: How fast to shake
545+
:param damping: How fast to stop shaking
546546
"""
547547
if not isinstance(velocity, Vec2):
548548
velocity = Vec2(*velocity)
@@ -568,10 +568,9 @@ def get_sprites_at_point(self, point: "Point", sprite_list: "SpriteList") -> Lis
568568
the specified point. If a sprite has a different center_x/center_y but touches the point,
569569
this will return that sprite.
570570
571-
:param Point point: Point to check
572-
:param SpriteList sprite_list: SpriteList to check against
571+
:param point: Point to check
572+
:param sprite_list: SpriteList to check against
573573
574574
:returns: List of sprites colliding, or an empty list.
575-
:rtype: list
576575
"""
577576
raise NotImplementedError()

arcade/context.py

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ class ArcadeContext(Context):
3535
**This is part of the low level rendering API in arcade
3636
and is mainly for more advanced usage**
3737
38-
:param pyglet.window.Window window: The pyglet window
39-
:param str gc_mode: The garbage collection mode for opengl objects.
38+
:param window: The pyglet window
39+
:param gc_mode: The garbage collection mode for opengl objects.
4040
``auto`` is just what we would expect in python
4141
while ``context_gc`` (default) requires you to call ``Context.gc()``.
4242
The latter can be useful when using multiple threads when
@@ -367,17 +367,17 @@ def load_program(
367367
fragment_shader="frag.glsl",
368368
)
369369
370-
:param Union[str,pathlib.Path] vertex_shader: path to vertex shader
371-
:param Union[str,pathlib.Path] fragment_shader: path to fragment shader (optional)
372-
:param Union[str,pathlib.Path] geometry_shader: path to geometry shader (optional)
373-
:param Union[str,pathlib.Path] tess_control_shader: Tessellation Control Shader
374-
:param Union[str,pathlib.Path] tess_evaluation_shader: Tessellation Evaluation Shader
375-
:param List[Union[str,pathlib.Path]] common: Common files to be included in all shaders
376-
:param dict defines: Substitute ``#define`` values in the source
377-
:param Optional[Sequence[str]] varyings: The name of the out attributes in a transform shader.
370+
:param vertex_shader: path to vertex shader
371+
:param fragment_shader: path to fragment shader (optional)
372+
:param geometry_shader: path to geometry shader (optional)
373+
:param tess_control_shader: Tessellation Control Shader
374+
:param tess_evaluation_shader: Tessellation Evaluation Shader
375+
:param common: Common files to be included in all shaders
376+
:param defines: Substitute ``#define`` values in the source
377+
:param varyings: The name of the out attributes in a transform shader.
378378
This is normally not necessary since we auto detect them,
379379
but some more complex out structures we can't detect.
380-
:param str varyings_capture_mode: The capture mode for transforms.
380+
:param varyings_capture_mode: The capture mode for transforms.
381381
``"interleaved"`` means all out attribute will be written to a single buffer.
382382
``"separate"`` means each out attribute will be written separate buffers.
383383
Based on these settings the `transform()` method will accept a single
@@ -430,8 +430,8 @@ def load_compute_shader(self, path: Union[str, Path], common: Iterable[Union[str
430430
431431
ctx.load_compute_shader(":shader:compute/do_work.glsl")
432432
433-
:param Union[str,pathlib.Path] path: Path to texture
434-
:param Iterable[Union[str,pathlib.Path]] common: Common source injected into compute shader
433+
:param path: Path to texture
434+
:param common: Common source injected into compute shader
435435
"""
436436
from arcade.resources import resolve
437437
path = resolve(path)
@@ -459,9 +459,9 @@ def load_texture(
459459
# Load a texture using Arcade resource handle
460460
texture = window.ctx.load_texture(":textures:background.png")
461461
462-
:param Union[str,pathlib.Path] path: Path to texture
463-
:param bool flip: Flips the image upside down
464-
:param bool build_mipmaps: Build mipmaps for the texture
462+
:param path: Path to texture
463+
:param flip: Flips the image upside down
464+
:param build_mipmaps: Build mipmaps for the texture
465465
"""
466466
from arcade.resources import resolve
467467

@@ -494,7 +494,7 @@ def shader_inc(self, source: str) -> str:
494494
495495
#include :my_shader:lib/common.glsl
496496
497-
:param str source: Shader
497+
:param source: Shader
498498
"""
499499
from arcade.resources import resolve
500500
lines = source.splitlines()
@@ -514,9 +514,9 @@ def get_framebuffer_image(
514514
"""
515515
Shortcut method for reading data from a framebuffer and converting it to a PIL image.
516516
517-
:param Framebuffer fbo: Framebuffer to get image from
518-
:param int components: Number of components to read
519-
:param bool flip: Flip the image upside down
517+
:param fbo: Framebuffer to get image from
518+
:param components: Number of components to read
519+
:param flip: Flip the image upside down
520520
"""
521521
mode = "RGBA"[:components]
522522
image = Image.frombuffer(

0 commit comments

Comments
 (0)