Skip to content

Added __all__ to many files #1681

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 28 commits into from
Apr 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
f4a012b
Added __all__ to many files
Apr 5, 2023
ab519c1
Again added __all__ to many files
Apr 5, 2023
5aaeda5
Shouldn't conflict
Apr 5, 2023
cc687e6
Merge branch 'development' into add__all__to_all
gran4 Apr 5, 2023
b54ae24
Should fix tests failing
Apr 5, 2023
5ac2231
Merge branch 'add__all__to_all' of https://github.com/gran4/arcade in…
Apr 5, 2023
9322588
Update scene.py
gran4 Apr 5, 2023
d771ed2
rand_on_circle wasn't in __all__
Apr 5, 2023
bb183f4
Merge branch 'add__all__to_all' of https://github.com/gran4/arcade in…
Apr 5, 2023
fcf86d4
Try to fix reviews
Apr 7, 2023
e5216af
...
Apr 7, 2023
d24c21e
Merge branch 'pythonarcade:development' into add__all__to_all
gran4 Apr 14, 2023
6052d53
Update arcade/hitbox/base.py
gran4 Apr 15, 2023
f0fcf23
Update arcade/physics_engines.py
gran4 Apr 15, 2023
899ab3e
Update arcade/scene.py
gran4 Apr 15, 2023
f4768c2
Thought I fixed this
Apr 17, 2023
6f115cf
Merge branch 'add__all__to_all' of https://github.com/gran4/arcade in…
Apr 17, 2023
56914a0
Merge branch 'development' into pushfoo_add__all__to_all
pushfoo Apr 19, 2023
80105f0
Fix whitespace issues with ruff --fix arcade
pushfoo Apr 19, 2023
6b9de38
Fix __all__ for arcade.types
pushfoo Apr 20, 2023
8e61323
Fix indent & line spacing in shape_list.py
pushfoo Apr 20, 2023
cc8296c
Add spacing in sprite.py
pushfoo Apr 20, 2023
943f4da
Revert removed newlines in scene docstrings
pushfoo Apr 20, 2023
1c45217
Add mouse button constants to application.py's __all__
pushfoo Apr 20, 2023
6b54ccf
Remove obsolete SimpleSprite line from top-level __all__
pushfoo Apr 20, 2023
00e5f8f
Delete scene.py
gran4 Apr 20, 2023
484bbf1
Merge branch 'pushfoo_add__all__to_all'
Apr 20, 2023
ae863d7
.
Apr 20, 2023
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
1 change: 0 additions & 1 deletion arcade/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,6 @@ def configure_logging(level: Optional[int] = None):
'Scene',
'Sound',
'BasicSprite',
# 'SimpleSprite',
'Sprite',
'SpriteType',
'PymunkMixin',
Expand Down
11 changes: 11 additions & 0 deletions arcade/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,17 @@

_window: 'Window'

__all__ = [
"get_screens",
"NoOpenGLException",
"Window",
"open_window",
"View",
"MOUSE_BUTTON_LEFT",
"MOUSE_BUTTON_MIDDLE",
"MOUSE_BUTTON_RIGHT"
]


def get_screens():
"""
Expand Down
5 changes: 5 additions & 0 deletions arcade/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@
FourIntTuple = Tuple[int, int, int, int]
FourFloatTuple = Tuple[float, float, float, float]

__all__ = [
"SimpleCamera",
"Camera"
]


class SimpleCamera:
"""
Expand Down
1 change: 1 addition & 0 deletions arcade/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from pyglet.math import Mat4
from arcade.texture_atlas import TextureAtlas

__all__ = ["ArcadeContext"]

class ArcadeContext(Context):
"""
Expand Down
5 changes: 5 additions & 0 deletions arcade/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@

import pyglet.input

__all__ = [
"get_controllers",
"ControllerManager"
]


def get_controllers():
"""This returns a list of controllers, it is synonymous with calling ``pyglet.input.get_controllers()``
Expand Down
33 changes: 33 additions & 0 deletions arcade/draw_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,39 @@
)
from arcade.utils import warning, ReplacementWarning

__all__ = [
"draw_arc_filled",
"draw_arc_outline",
"draw_parabola_filled",
"draw_parabola_outline",
"draw_circle_filled",
"draw_circle_outline",
"draw_ellipse_filled",
"draw_ellipse_outline",
"draw_line_strip",
"draw_line",
"draw_lines",
"draw_point",
"draw_points",
"draw_polygon_filled",
"draw_polygon_outline",
"draw_triangle_filled",
"draw_triangle_outline",
"draw_lrtb_rectangle_outline",
"draw_lrbt_rectangle_outline",
"draw_xywh_rectangle_outline",
"draw_rectangle_outline",
"draw_lrtb_rectangle_filled",
"draw_lrbt_rectangle_filled",
"draw_xywh_rectangle_filled",
"draw_rectangle_filled",
"draw_scaled_texture_rectangle",
"draw_texture_rectangle",
"draw_lrwh_rectangle_textured",
"get_pixel",
"get_image"
]

# --- BEGIN ARC FUNCTIONS # # #


Expand Down
2 changes: 2 additions & 0 deletions arcade/drawing_support.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

import math

__all__ = ["get_points_for_thick_line"]


def get_points_for_thick_line(start_x: float, start_y: float,
end_x: float, end_y: float,
Expand Down
3 changes: 3 additions & 0 deletions arcade/hitbox/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
from arcade.types import Point, PointList


__all__ = ["HitBoxAlgorithm", "HitBox", "RotatableHitBox"]


class HitBoxAlgorithm:
"""
Base class for hit box algorithms. Hit box algorithms are used to calculate the
Expand Down
5 changes: 5 additions & 0 deletions arcade/joysticks.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
from typing import List
from pyglet.input import Joystick

__all__ = [
"get_joysticks",
"get_game_controllers"
]


def get_joysticks() -> List[Joystick]:
"""
Expand Down
20 changes: 20 additions & 0 deletions arcade/math.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,26 @@
_PRECISION = 2


__all__ = [
"round_fast",
"clamp",
"lerp",
"lerp_vec",
"lerp_angle",
"rand_in_rect",
"rand_in_circle",
"rand_on_circle",
"rand_on_line",
"rand_angle_360_deg",
"rand_angle_spread_deg",
"rand_vec_spread_deg",
"rand_vec_magnitude",
"get_distance",
"rotate_point",
"get_angle_degrees",
"get_angle_radians",
]

def round_fast(value: float, precision: int) -> float:
"""
A high performance version of python's built-in round() function.
Expand Down
6 changes: 6 additions & 0 deletions arcade/paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@
from arcade.math import get_distance, lerp_vec
from arcade.types import Point

__all__ = [
"AStarBarrierList",
"astar_calculate_path",
"has_line_of_sight"
]


def _spot_is_blocked(position: Point,
moving_sprite: Sprite,
Expand Down
1 change: 1 addition & 0 deletions arcade/perf_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import arcade
from arcade.types import Color, RGBA255

__all__ = ["PerfGraph"]

class PerfGraph(arcade.Sprite):
"""
Expand Down
10 changes: 10 additions & 0 deletions arcade/perf_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@
_frame_times: collections.deque = collections.deque()
_max_history: int = 100

__all__ = [
"print_timings",
"clear_timings",
"get_timings",
"enable_timings",
"disable_timings",
"get_fps",
"timings_enabled"
]


def _dispatch_event(self, *args):
"""
Expand Down
5 changes: 5 additions & 0 deletions arcade/physics_engines.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
)
from arcade.math import get_distance

__all__ = [
"PhysicsEngineSimple",
"PhysicsEnginePlatformer"
]


def _circular_check(player: Sprite, walls: List[SpriteList]):
"""
Expand Down
6 changes: 6 additions & 0 deletions arcade/pymunk_physics_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@

LOG = logging.getLogger(__name__)

__all__ = [
"PymunkPhysicsObject",
"PymunkException",
"PymunkPhysicsEngine"
]


class PymunkPhysicsObject:
""" Object that holds pymunk body/shape for a sprite. """
Expand Down
7 changes: 7 additions & 0 deletions arcade/resources/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@
"system": [SYSTEM_PATH],
}

__all__ = [
"resolve_resource_path",
"resolve",
"add_resource_handle",
"get_resource_handle_paths",
]


@warning(
warning_type=ReplacementWarning,
Expand Down
6 changes: 4 additions & 2 deletions arcade/scene.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@

from warnings import warn

__all__ = ["Scene"]


class Scene:
"""
Class that represents a `scene` object. Most games will use Scenes to render their Sprites.
Expand Down Expand Up @@ -180,7 +183,6 @@ def add_sprite_list_after(
Add a SpriteList to the scene with the specified name after a specific SpriteList.

This will add a new SpriteList to the scene after the specified SpriteList in the draw order.

If no SpriteList is supplied via the `sprite_list` parameter then a new one will be
created, and the `use_spatial_hash` parameter will be respected for that creation.

Expand Down Expand Up @@ -266,8 +268,8 @@ def update(self, names: Optional[List[str]] = None) -> None:
def on_update(self, delta_time: float = 1 / 60, names: Optional[List[str]] = None) -> None:
"""
Used to call on_update of SpriteLists contained in the scene.
Similar to update() but allows passing a delta_time variable.

Similar to update() but allows passing a delta_time variable.
If `names` parameter is provided then only the specified spritelists
will be updated. If `names` is not provided, then every SpriteList
in the scene will have on_update called.
Expand Down
5 changes: 5 additions & 0 deletions arcade/sections.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@
if TYPE_CHECKING:
from arcade import View

__all__ = [
"Section",
"SectionManager"
]


class Section:
"""
Expand Down
26 changes: 26 additions & 0 deletions arcade/shape_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,32 @@
from .math import rotate_point


__all__ = [
"Shape",
"create_line",
"create_line_generic_with_colors",
"create_line_generic",
"create_line_strip",
"create_line_loop",
"create_lines",
"create_lines_with_colors",
"create_polygon",
"create_rectangle_filled",
"create_rectangle_outline",
"get_rectangle_points",
"create_rectangle",
"create_rectangle_filled_with_colors",
"create_rectangles_filled_with_colors",
"create_triangles_filled_with_colors",
"create_triangles_strip_filled_with_colors",
"create_ellipse_filled",
"create_ellipse_outline",
"create_ellipse",
"create_ellipse_filled_with_colors",
"ShapeElementList",
]


class Shape:
"""
A container for arbitrary geometry representing a shape.
Expand Down
7 changes: 7 additions & 0 deletions arcade/sound.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@

import pyglet.media as media

__all__ = [
"Sound",
"load_sound",
"play_sound",
"stop_sound"
]


class Sound:
"""This class represents a sound you can play."""
Expand Down
3 changes: 3 additions & 0 deletions arcade/sprite/sprite.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
from arcade.sprite_list import SpriteList


__all__ = ["Sprite"]


class Sprite(BasicSprite, PymunkMixin):
"""
Sprites are used to render image data to the screen & perform collisions.
Expand Down
7 changes: 7 additions & 0 deletions arcade/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@
from arcade.utils import PerformanceWarning, warning


__all__ = ["load_font",
"Text",
"create_text_sprite",
"draw_text"
]


def load_font(path: Union[str, Path]) -> None:
"""
Load fonts in a file (usually .ttf) adding them to a global font registry.
Expand Down
2 changes: 2 additions & 0 deletions arcade/texture/texture.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
from arcade import TextureAtlas
from arcade.sprite_list import SpriteList

__all__ = ["ImageData", "Texture"]

LOG = logging.getLogger(__name__)


Expand Down
6 changes: 6 additions & 0 deletions arcade/tilemap/tilemap.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@
_FLIPPED_VERTICALLY_FLAG = 0x40000000
_FLIPPED_DIAGONALLY_FLAG = 0x20000000

__all__ = [
"TileMap",
"load_tilemap",
"read_tmx"
]


def _get_image_info_from_tileset(tile: pytiled_parser.Tile):
image_x = 0
Expand Down
20 changes: 20 additions & 0 deletions arcade/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,26 @@
RGBA255OrNormalized = Union[RGBA255, RGBANormalized]


__all__ = [
"BufferProtocol",
"Color",
"ColorLike",
"IPoint",
"PathOrTexture",
"Point",
"PointList",
"NamedPoint",
"Rect",
"RectList",
"RGB",
"RGBA255",
"RGBANormalized",
"RGBA255OrNormalized",
"TiledObject",
"Vector"
]


class Color(RGBA255):
"""
A :py:class:`tuple` subclass representing an RGBA Color.
Expand Down
Loading