diff --git a/arcade/application.py b/arcade/application.py index 43f5eae18..8f79d40dd 100644 --- a/arcade/application.py +++ b/arcade/application.py @@ -137,7 +137,7 @@ def __init__( LOG.warning("Skipping antialiasing due missing hardware/driver support") config = None antialiasing = False - # If we still don't have a config + # If we still don't have a config if not config: config = pyglet.gl.Config( major_version=gl_version[0], diff --git a/arcade/examples/array_backed_grid_buffered.py b/arcade/examples/array_backed_grid_buffered.py index 5bbeb90e8..7323ea1cb 100644 --- a/arcade/examples/array_backed_grid_buffered.py +++ b/arcade/examples/array_backed_grid_buffered.py @@ -49,7 +49,7 @@ def __init__(self, width, height, title): # array is simply a list of lists. # This array can be altered later to contain 0 or 1 # to show a white or green cell. - # + # # A 4 x 4 grid would look like this # # grid = [ diff --git a/arcade/examples/array_backed_grid_sprites_1.py b/arcade/examples/array_backed_grid_sprites_1.py index c00bf6c29..fba7d83e6 100644 --- a/arcade/examples/array_backed_grid_sprites_1.py +++ b/arcade/examples/array_backed_grid_sprites_1.py @@ -47,7 +47,7 @@ def __init__(self, width, height, title): # array is simply a list of lists. # This array can be altered later to contain 0 or 1 # to show a white or green cell. - # + # # A 4 x 4 grid would look like this # # grid = [ diff --git a/arcade/examples/drawing_text_objects.py b/arcade/examples/drawing_text_objects.py index 9ebb0b813..54d97727a 100644 --- a/arcade/examples/drawing_text_objects.py +++ b/arcade/examples/drawing_text_objects.py @@ -58,7 +58,7 @@ def __init__(self, width, height, title): start_x, start_y, arcade.color.BLACK, - DEFAULT_FONT_SIZE + DEFAULT_FONT_SIZE ) # Show some built-in fonts @@ -108,7 +108,7 @@ def __init__(self, width, height, title): start_x, start_y, arcade.color.BLACK, DEFAULT_FONT_SIZE, - font_name="Kenney Mini Square", + font_name="Kenney Mini Square", ) start_y -= DEFAULT_LINE_HEIGHT @@ -135,7 +135,7 @@ def __init__(self, width, height, title): start_x, start_y, arcade.color.BLACK, DEFAULT_FONT_SIZE, - font_name="Kenney Rocket", + font_name="Kenney Rocket", ) start_y -= DEFAULT_LINE_HEIGHT @@ -237,7 +237,7 @@ def __init__(self, width, height, title): arcade.color.BLACK, DEFAULT_FONT_SIZE, anchor_x="left", - anchor_y="top", + anchor_y="top", ) start_y -= DEFAULT_LINE_HEIGHT * 2 @@ -330,7 +330,7 @@ def on_draw(self): self.bottom_left.x, self.bottom_left.y, arcade.color.BARN_RED, - 5, + 5, ) self.bottom_left.draw() diff --git a/arcade/examples/drawing_text_objects_batch.py b/arcade/examples/drawing_text_objects_batch.py index 2496eb2c9..5bfce1cc3 100644 --- a/arcade/examples/drawing_text_objects_batch.py +++ b/arcade/examples/drawing_text_objects_batch.py @@ -69,7 +69,7 @@ def __init__(self, width, height, title): start_y, arcade.color.BLACK, DEFAULT_FONT_SIZE, - batch=self.batch, + batch=self.batch, ) # Show some built-in fonts @@ -124,7 +124,7 @@ def __init__(self, width, height, title): arcade.color.BLACK, DEFAULT_FONT_SIZE, font_name="Kenney Mini Square", - batch=self.batch, + batch=self.batch, ) start_y -= DEFAULT_LINE_HEIGHT @@ -154,7 +154,7 @@ def __init__(self, width, height, title): arcade.color.BLACK, DEFAULT_FONT_SIZE, font_name="Kenney Rocket", - batch=self.batch, + batch=self.batch, ) start_y -= DEFAULT_LINE_HEIGHT @@ -264,7 +264,7 @@ def __init__(self, width, height, title): DEFAULT_FONT_SIZE, anchor_x="left", anchor_y="top", - batch=self.batch, + batch=self.batch, ) start_y -= DEFAULT_LINE_HEIGHT * 2 @@ -344,7 +344,7 @@ def on_draw(self): self.bottom_left.x, self.bottom_left.y, arcade.color.BARN_RED, - 5, + 5, ) arcade.draw_point( diff --git a/arcade/examples/gl/3d_sphere.py b/arcade/examples/gl/3d_sphere.py index 4dfc82aab..11da87a34 100644 --- a/arcade/examples/gl/3d_sphere.py +++ b/arcade/examples/gl/3d_sphere.py @@ -58,7 +58,7 @@ def __init__(self, width, height, title): if (l < 0.0) { l = abs(l); fragColor = vec4(0.75, 0.0, 0.0, 1.0) * (0.25 + abs(l) * 0.75); - } else { + } else { fragColor = vec4(1.0) * (0.25 + abs(l) * 0.75); } } diff --git a/arcade/examples/gl/chip8_display.py b/arcade/examples/gl/chip8_display.py index b503347f6..87f6ccb61 100644 --- a/arcade/examples/gl/chip8_display.py +++ b/arcade/examples/gl/chip8_display.py @@ -6,7 +6,7 @@ bits to represent what pixel is enabled/disabled so the byte size of the buffer is 8 x 4 = 32 bytes. -References: +References: http://mattmik.com/files/chip8/mastering/chip8.html https://github.com/JohnEarnest/Octo @@ -65,7 +65,7 @@ def __init__(self, width, height, title): } """ ) - # 8 x 4 + # 8 x 4 self.program['projection'] = self.projection self.program['screen'] = 0 b = 0 # border to test scale diff --git a/arcade/examples/gl/custom_sprite.py b/arcade/examples/gl/custom_sprite.py index 041963cc2..161802bc5 100644 --- a/arcade/examples/gl/custom_sprite.py +++ b/arcade/examples/gl/custom_sprite.py @@ -50,14 +50,14 @@ def __init__(self): size = in_size; } """, - geometry_shader=""" + geometry_shader=""" #version 330 // Configure inputs and outputs for the geometry shader // We are taking single points form the vertex shader per invocation // and emitting 4 new vertices creating a quad/sprites layout (points) in; - layout (triangle_strip, max_vertices = 4) out; + layout (triangle_strip, max_vertices = 4) out; // A uniform buffer that will automagically contain pyglet's projection matrix uniform WindowBlock { diff --git a/arcade/examples/gl/random_shader_simple.py b/arcade/examples/gl/random_shader_simple.py index 1344092fc..db5125a99 100644 --- a/arcade/examples/gl/random_shader_simple.py +++ b/arcade/examples/gl/random_shader_simple.py @@ -40,7 +40,7 @@ def __init__(self): in vec2 in_pos; - // This in the index of this specific vertex. + // This in the index of this specific vertex. // Flat just specifies that the value shouldn't be interpolated between vertices. flat out int vert_id; out vec2 vert_pos; @@ -50,7 +50,7 @@ def __init__(self): vert_id = gl_VertexID; vert_pos = in_pos; - } + } """, fragment_shader=""" @@ -61,7 +61,7 @@ def __init__(self): // predefining the function which will be over written with the code injection. // the random function takes in 1, 2, 3, or 4 floats and returns a new float between 0 and 1 float random(vec2 v); - float random(vec3 v); + float random(vec3 v); float random(vec4 v); // Both of these are used as seed values to make sure each call is unique @@ -76,7 +76,7 @@ def __init__(self): void main(){ float red = random(vec4(vert_pos.x, vert_pos.y, time_seed, vert_id)); - float green = random(vec4(vert_id, time_seed, vert_pos.y, vert_pos.x)); + float green = random(vec4(vert_id, time_seed, vert_pos.y, vert_pos.x)); float blue = random(vec4(vert_pos.y, vert_pos.x, time_seed, vert_id)); frag_colour = vec4(red, green, blue, 1.0); } diff --git a/arcade/examples/gl/spritelist_interaction_visualize_dist.py b/arcade/examples/gl/spritelist_interaction_visualize_dist.py index ccef4bb58..049cedaa2 100644 --- a/arcade/examples/gl/spritelist_interaction_visualize_dist.py +++ b/arcade/examples/gl/spritelist_interaction_visualize_dist.py @@ -36,7 +36,7 @@ def __init__(self): # Player self.player = arcade.Sprite( ":resources:images/animated_characters/female_person/femalePerson_idle.png", - scale=0.5, + scale=0.5, ) # This program draws lines from the player/origin diff --git a/arcade/examples/gl/spritelist_interaction_visualize_dist_los.py b/arcade/examples/gl/spritelist_interaction_visualize_dist_los.py index e545b1c95..8b2f1c014 100644 --- a/arcade/examples/gl/spritelist_interaction_visualize_dist_los.py +++ b/arcade/examples/gl/spritelist_interaction_visualize_dist_los.py @@ -6,7 +6,7 @@ This builds on a previous example adding line of sight (LoS) checks by using texture lookups. We our walls into a -texture and read the pixels in a line between the +texture and read the pixels in a line between the player and the target sprite to check if the path is colliding with something. @@ -31,7 +31,7 @@ def __init__(self): # Player self.player = arcade.Sprite( ":resources:images/animated_characters/female_person/femalePerson_idle.png", - scale=0.25, + scale=0.25, ) # Wall sprites we are checking collision against diff --git a/arcade/examples/gl/spritelist_interaction_visualize_dist_los_trans.py b/arcade/examples/gl/spritelist_interaction_visualize_dist_los_trans.py index 8c3e54ebe..a23616d21 100644 --- a/arcade/examples/gl/spritelist_interaction_visualize_dist_los_trans.py +++ b/arcade/examples/gl/spritelist_interaction_visualize_dist_los_trans.py @@ -39,7 +39,7 @@ def __init__(self): # Player self.player = arcade.Sprite( ":resources:images/animated_characters/female_person/femalePerson_idle.png", - scale=0.25, + scale=0.25, ) # Wall sprites we are checking collision against diff --git a/arcade/examples/gl/transform_emit.py b/arcade/examples/gl/transform_emit.py index 45367e09f..3e6ba33b5 100644 --- a/arcade/examples/gl/transform_emit.py +++ b/arcade/examples/gl/transform_emit.py @@ -135,14 +135,14 @@ def __init__(self): self.draw_geometry_1 = self.ctx.geometry( [ BufferDescription(self.buffer_pos_1, "2f", ("in_pos",)), - BufferDescription(self.buffer_colors, "3f", ("in_col",)), + BufferDescription(self.buffer_colors, "3f", ("in_col",)), ], mode=self.ctx.POINTS, ) self.draw_geometry_2 = self.ctx.geometry( [ BufferDescription(self.buffer_pos_2, "2f", ("in_pos",)), - BufferDescription(self.buffer_colors, "3f", ("in_col",)), + BufferDescription(self.buffer_colors, "3f", ("in_col",)), ], mode=self.ctx.POINTS, ) diff --git a/arcade/examples/gl/transform_point_grid.py b/arcade/examples/gl/transform_point_grid.py index 54d7aaa59..78954f42b 100644 --- a/arcade/examples/gl/transform_point_grid.py +++ b/arcade/examples/gl/transform_point_grid.py @@ -41,9 +41,9 @@ def gen_initial_data(window, width, height): def gen_colors(width, height): """Generate some random colors""" for _ in range(width * height): - yield random.uniform(0, 1) - yield random.uniform(0, 1) - yield random.uniform(0, 1) + yield random.uniform(0, 1) + yield random.uniform(0, 1) + yield random.uniform(0, 1) class MyGame(arcade.Window): @@ -152,7 +152,7 @@ def on_draw(self): # Calculate delta time (not extremely accurate, but good enough) now = time.time() - self.frame_time = now - self.last_time + self.frame_time = now - self.last_time self.last_time = now # Move points with transform diff --git a/arcade/examples/net_process_animal_facts.py b/arcade/examples/net_process_animal_facts.py index ab3e240f8..418f90195 100644 --- a/arcade/examples/net_process_animal_facts.py +++ b/arcade/examples/net_process_animal_facts.py @@ -1,5 +1,5 @@ """ -Display random animal facts from +Display random animal facts from * https://github.com/wh-iterabb-it/meowfacts * https://kinduff.github.io/dog-api/ diff --git a/arcade/examples/platform_tutorial/03_scene_object.py b/arcade/examples/platform_tutorial/03_scene_object.py index f8a270f5a..31b40109d 100644 --- a/arcade/examples/platform_tutorial/03_scene_object.py +++ b/arcade/examples/platform_tutorial/03_scene_object.py @@ -1,7 +1,7 @@ """ Platformer Game -python -m arcade.examples.platform_tutorial.03_scene_object +python -m arcade.examples.platform_tutorial.03_scene_object """ import arcade diff --git a/arcade/examples/platform_tutorial/05_add_gravity.py b/arcade/examples/platform_tutorial/05_add_gravity.py index d0e2366ff..d0627442f 100644 --- a/arcade/examples/platform_tutorial/05_add_gravity.py +++ b/arcade/examples/platform_tutorial/05_add_gravity.py @@ -1,7 +1,7 @@ """ Platformer Game -python -m arcade.examples.platform_tutorial.05_add_gravity +python -m arcade.examples.platform_tutorial.05_add_gravity """ import arcade diff --git a/arcade/examples/sound_speed_demo.py b/arcade/examples/sound_speed_demo.py index 15677cf41..9da91f9ee 100644 --- a/arcade/examples/sound_speed_demo.py +++ b/arcade/examples/sound_speed_demo.py @@ -5,7 +5,7 @@ command line with: python -m arcade.examples.sound_speed_demo -Left click a button to play a sound. +Left click a button to play a sound. Each button plays the same sound sample in a slightly different way. diff --git a/arcade/examples/sprite_rotate_around_point.py b/arcade/examples/sprite_rotate_around_point.py index ef2aba558..524018d91 100644 --- a/arcade/examples/sprite_rotate_around_point.py +++ b/arcade/examples/sprite_rotate_around_point.py @@ -42,7 +42,7 @@ def rotate_around_point(self, point, degrees, change_angle=True): if change_angle: self.angle += degrees - # Move the sprite along a circle centered on the point by degrees + # Move the sprite along a circle centered on the point by degrees self.position = rotate_point( self.center_x, self.center_y, point[0], point[1], degrees) diff --git a/arcade/examples/sprite_rotate_around_tank.py b/arcade/examples/sprite_rotate_around_tank.py index 743880084..eea0c8bc6 100644 --- a/arcade/examples/sprite_rotate_around_tank.py +++ b/arcade/examples/sprite_rotate_around_tank.py @@ -14,7 +14,7 @@ tank with a barrel that follows the mouse. You can press P to switch between two ways of rotating the barrel: 1. Correctly, with the barrel's rear against the tank's center -2. Incorrectly, around the barrel's center pinned to the tank's +2. Incorrectly, around the barrel's center pinned to the tank's Artwork from https://kenney.nl @@ -36,7 +36,7 @@ # This is half the length of the barrel sprite. # We use it to ensure the barrel's rear sits in the middle of the tank -TANK_BARREL_LENGTH_HALF = 15 +TANK_BARREL_LENGTH_HALF = 15 SCREEN_WIDTH = 800 @@ -93,7 +93,7 @@ def __init__(self): self.barrel.position =\ SCREEN_MIDDLE[0], SCREEN_MIDDLE[1] - TANK_BARREL_LENGTH_HALF - self.tank_direction = 0.0 # Forward & backward throttle + self.tank_direction = 0.0 # Forward & backward throttle self.tank_turning = 0.0 # Turning strength to the left or right self.mouse_pos = 0, 0 @@ -124,7 +124,7 @@ def on_update(self, delta_time: float): def move_tank(self, delta_time): """ - Perform all calculations for moving the tank's body and barrel + Perform all calculations for moving the tank's body and barrel """ # Rotate the tank's body in place without changing position @@ -142,12 +142,12 @@ def move_tank(self, delta_time): self.tank.center_x + x_dir,\ self.tank.center_y + y_dir - # Move the barrel with the body + # Move the barrel with the body self.barrel.position =\ self.barrel.center_x + x_dir,\ self.barrel.center_y + y_dir - # Begin rotating the barrel by finding the angle to the mouse + # Begin rotating the barrel by finding the angle to the mouse mouse_angle = get_angle_degrees( self.tank.center_x, self.tank.center_y, self.mouse_pos[0], self.mouse_pos[1]) @@ -164,7 +164,7 @@ def move_tank(self, delta_time): self.barrel.rotate_around_point(self.tank.position, angle_change) else: - # Swivel the barrel with its center aligned with the body's + # Swivel the barrel with its center aligned with the body's self.barrel.angle = mouse_angle def on_key_press(self, symbol: int, modifiers: int): diff --git a/arcade/experimental/__init__.py b/arcade/experimental/__init__.py index 3d20b5e15..6c06802bd 100644 --- a/arcade/experimental/__init__.py +++ b/arcade/experimental/__init__.py @@ -16,4 +16,4 @@ "ShadertoyBase", "CRTFilter", "BloomFilter", -] \ No newline at end of file +] diff --git a/arcade/experimental/actor_map.py b/arcade/experimental/actor_map.py index dc02926a7..debb349be 100644 --- a/arcade/experimental/actor_map.py +++ b/arcade/experimental/actor_map.py @@ -125,7 +125,7 @@ def __init__(self, ctx, *, size: Tuple[int, int]): ":resources:images/tiles/dirtCenter.png", ] self.textures = [ - arcade.load_texture(path, hit_box_algorithm=hitbox.algo_bounding_box) + arcade.load_texture(path, hit_box_algorithm=hitbox.algo_bounding_box) for path in texture_paths ] diff --git a/arcade/experimental/atlas_replace_image.py b/arcade/experimental/atlas_replace_image.py index ed01b9921..057c2c4de 100644 --- a/arcade/experimental/atlas_replace_image.py +++ b/arcade/experimental/atlas_replace_image.py @@ -81,7 +81,7 @@ def on_draw(self): def on_update(self, delta_time: float): self.elapsed_time += delta_time - # Change textures + # Change textures if self.elapsed_time > 1.0: # Replace the internal images. They all have the same size (required) self.sprite_1.texture.image = next(self.texture_cycle).image diff --git a/arcade/experimental/shadertoy.py b/arcade/experimental/shadertoy.py index a1c39f79c..f4035e9f8 100644 --- a/arcade/experimental/shadertoy.py +++ b/arcade/experimental/shadertoy.py @@ -188,7 +188,7 @@ def channel_time(self) -> List[float]: @property def channel_0(self) -> Optional[Texture2D]: """Get or set channel 0""" - return self._channel_0 + return self._channel_0 @channel_0.setter def channel_0(self, value: Texture2D): @@ -212,7 +212,7 @@ def channel_1(self, value: Texture2D): @property def channel_2(self) -> Optional[Texture2D]: """Get or set channel 2""" - return self._channel_2 + return self._channel_2 @channel_2.setter def channel_2(self, value: Texture2D): @@ -275,7 +275,7 @@ def render( self._render() def _render(self): - raise NotImplementedError + raise NotImplementedError def reload(self, source: str): """ @@ -337,7 +337,7 @@ def _set_source(self, source: str): try: self._program[f"iChannel{channel}"] = channel except KeyError: - pass + pass self._source = source diff --git a/arcade/experimental/shadertoy_demo_simple.py b/arcade/experimental/shadertoy_demo_simple.py index cb389e536..eeb696a9b 100644 --- a/arcade/experimental/shadertoy_demo_simple.py +++ b/arcade/experimental/shadertoy_demo_simple.py @@ -20,8 +20,8 @@ def __init__(self, width, height, title): // This interpolates from 0,0 to 1,1 from lower left to upper right vec2 uv = fragCoord.xy / iResolution.xy; // Write the fragment color - fragColor = vec4(uv, 0.0, 1.0); - } + fragColor = vec4(uv, 0.0, 1.0); + } """, ) diff --git a/arcade/geometry.py b/arcade/geometry.py index 386a4150c..617082413 100644 --- a/arcade/geometry.py +++ b/arcade/geometry.py @@ -197,4 +197,4 @@ def is_point_in_polygon(x: float, y: float, polygon: PointList) -> bool: # Return true if count is odd, false otherwise return count % 2 == 1 - + diff --git a/arcade/gl/compute_shader.py b/arcade/gl/compute_shader.py index f2de86fc1..6d1650a03 100644 --- a/arcade/gl/compute_shader.py +++ b/arcade/gl/compute_shader.py @@ -67,7 +67,7 @@ def __init__(self, ctx: "Context", glsl_source: str) -> None: gl.glGetProgramiv(self._glo, gl.GL_INFO_LOG_LENGTH, length) log = c_buffer(length.value) gl.glGetProgramInfoLog(self._glo, len(log), None, log) - raise ShaderException("Program link error: {}".format(log.value.decode())) + raise ShaderException("Program link error: {}".format(log.value.decode())) self._introspect_uniforms() self._introspect_uniform_blocks() diff --git a/arcade/gl/context.py b/arcade/gl/context.py index d49babde8..c804ad2ae 100644 --- a/arcade/gl/context.py +++ b/arcade/gl/context.py @@ -416,7 +416,7 @@ def enable_only(self, *args): # Make sure only blending is enabled ctx.enable_only(ctx.BLEND) # Make sure only depth test and culling is enabled - ctx.enable_only(ctx.DEPTH_TEST, ctx.CULL_FACE) + ctx.enable_only(ctx.DEPTH_TEST, ctx.CULL_FACE) """ self._flags = set(args) diff --git a/arcade/gl/framebuffer.py b/arcade/gl/framebuffer.py index c92a18978..98f86a5cd 100644 --- a/arcade/gl/framebuffer.py +++ b/arcade/gl/framebuffer.py @@ -177,7 +177,7 @@ def _set_viewport(self, value: Tuple[int, int, int, int]): def _get_scissor(self) -> Optional[Tuple[int, int, int, int]]: """ - Get or set the scissor box for this framebuffer. + Get or set the scissor box for this framebuffer. By default the scissor box is disabled and has no effect and will have an initial value of ``None``. The scissor @@ -518,7 +518,7 @@ class DefaultFrameBuffer(Framebuffer): somewhat sane initial values. Since this is a dynamic framebuffer we cannot trust the internal values. We can only trust what the pyglet window - itself reports related to window size and + itself reports related to window size and framebuffer size. This should be updated in the ``on_resize`` callback. """ @@ -610,7 +610,7 @@ def _set_viewport(self, value: Tuple[int, int, int, int]): def _get_scissor(self) -> Optional[Tuple[int, int, int, int]]: """ - Get or set the scissor box for this framebuffer. + Get or set the scissor box for this framebuffer. By default the scissor box is disabled and has no effect and will have an initial value of ``None``. The scissor diff --git a/arcade/gl/geometry.py b/arcade/gl/geometry.py index 327c1adf7..8b45e3b17 100644 --- a/arcade/gl/geometry.py +++ b/arcade/gl/geometry.py @@ -27,7 +27,7 @@ def quad_2d(size: Tuple[float, float] = (1.0, 1.0), pos: Tuple[float, float] = ( :param tuple size: width and height :param float pos: Center position x and y - :rtype: A :py:class:`~arcade.gl.geometry.Geometry` instance. + :rtype: A :py:class:`~arcade.gl.geometry.Geometry` instance. """ ctx = _get_active_context() width, height = size @@ -54,7 +54,7 @@ def screen_rectangle(bottom_left_x: float, bottom_left_y: float, width: float, h :param float bottom_left_x: Bottom left x position :param float bottom_left_y: Bottom left y position :param float width: Width of the rectangle - :param float height: Height of the rectangle + :param float height: Height of the rectangle """ ctx = _get_active_context() data = array('f', [ diff --git a/arcade/gl/texture.py b/arcade/gl/texture.py index 446b538c2..44474d8e4 100644 --- a/arcade/gl/texture.py +++ b/arcade/gl/texture.py @@ -415,7 +415,7 @@ def swizzle(self) -> str: texture.swizzle = 'R000' # Reverse the components - texture.swizzle = 'ABGR' + texture.swizzle = 'ABGR' """ gl.glActiveTexture(gl.GL_TEXTURE0 + self._ctx.default_texture_unit) gl.glBindTexture(self._target, self._glo) diff --git a/arcade/gl/types.py b/arcade/gl/types.py index f4c0a4e21..76bf0ce69 100644 --- a/arcade/gl/types.py +++ b/arcade/gl/types.py @@ -99,7 +99,7 @@ gl.GL_UNSIGNED_SHORT: "GL_UNSIGNED_SHORT", gl.GL_BYTE: "GL_BYTE", gl.GL_UNSIGNED_BYTE: "GL_UNSIGNED_BYTE", -} +} def gl_name(gl_type: gl.GLenum) -> str: diff --git a/arcade/gl/vertex_array.py b/arcade/gl/vertex_array.py index ec1e0ab5b..d4b45bac2 100644 --- a/arcade/gl/vertex_array.py +++ b/arcade/gl/vertex_array.py @@ -287,7 +287,7 @@ def render_indirect(self, buffer: Buffer, mode: gl.GLuint, count, first, stride) "Attempt to issue rendering commands outside the buffer. " f"first = {first}, count = {count} is reaching past " f"the buffer end. The buffer have room for {max_commands} " - f"draw commands. byte size {buffer.size}, stride {stride}." + f"draw commands. byte size {buffer.size}, stride {stride}." ) gl.glBindVertexArray(self.glo) @@ -364,7 +364,7 @@ def transform_separate( ): """ Run a transform feedback writing to separate buffers. - + :param List[Buffer] buffers: The buffers to write the output :param gl.GLenum mode: The input primitive mode :param gl.GLenum output_mode: The output primitive mode diff --git a/arcade/gui/examples/widget_gallery.py b/arcade/gui/examples/widget_gallery.py index d1005ea88..af78411f9 100644 --- a/arcade/gui/examples/widget_gallery.py +++ b/arcade/gui/examples/widget_gallery.py @@ -147,9 +147,9 @@ def __init__(self): example_text = dedent( """ - Gamers can feel when developers are passionate about their games. - They can smell it like a dog smells fear. - Don't be afraid to hold onto your unique vision: + Gamers can feel when developers are passionate about their games. + They can smell it like a dog smells fear. + Don't be afraid to hold onto your unique vision: just be aware that it may not turn out exactly how you envisioned. """ ) diff --git a/arcade/gui/widgets/buttons.py b/arcade/gui/widgets/buttons.py index a0a1fb3cb..b18412028 100644 --- a/arcade/gui/widgets/buttons.py +++ b/arcade/gui/widgets/buttons.py @@ -40,7 +40,7 @@ class UITextureButton(UIInteractiveWidget, UIStyledWidget["UITextureButton.UISty class UIStyle(UIStyleBase): """ Used to style the texture button. Below is its use case. - + .. code:: py button = UITextureButton(style={"normal": UITextureButton.UIStyle(...),}) @@ -219,7 +219,7 @@ def apply_style(self, style: UIStyle): class UIFlatButton(UIInteractiveWidget, UIStyledWidget, UITextWidget): """ A text button, with support for background color and a border. - + There are four states of the UITextureButton i.e normal, hovered, pressed and disabled. :param float x: x coordinate of bottom left @@ -236,7 +236,7 @@ class UIFlatButton(UIInteractiveWidget, UIStyledWidget, UITextWidget): class UIStyle(UIStyleBase): """ Used to style the button. Below is its use case. - + .. code:: py button = UIFlatButton(style={"normal": UIFlatButton.UIStyle(...),}) diff --git a/arcade/gui/widgets/slider.py b/arcade/gui/widgets/slider.py index d6e9e7954..3e9249c42 100644 --- a/arcade/gui/widgets/slider.py +++ b/arcade/gui/widgets/slider.py @@ -45,7 +45,7 @@ class UISlider(UIStyledWidget["UISlider.UIStyle"]): class UIStyle(UIStyleBase): """ Used to style the slider for different states. Below is its use case. - + .. code:: py button = UITextureButton(style={"normal": UITextureButton.UIStyle(...),}) diff --git a/arcade/gui/widgets/toggle.py b/arcade/gui/widgets/toggle.py index bde98c205..c4c90f9ba 100644 --- a/arcade/gui/widgets/toggle.py +++ b/arcade/gui/widgets/toggle.py @@ -55,7 +55,7 @@ def __init__( enhancer.enhance(1.5), name=self.normal_off_tex.cache_name + "_brighter", ) self.pressed_off_tex = Texture( - enhancer.enhance(0.5), name=self.normal_off_tex.cache_name + "_darker", + enhancer.enhance(0.5), name=self.normal_off_tex.cache_name + "_darker", ) self.value = value diff --git a/arcade/math.py b/arcade/math.py index ad33f453e..4b0b666d9 100644 --- a/arcade/math.py +++ b/arcade/math.py @@ -14,13 +14,13 @@ def round_fast(value: float, precision: int) -> float: Example:: - >>> round(3.5662457892, 1) + >>> round(3.5662457892, 1) 3.6 - >>> round(3.5662457892, 2) + >>> round(3.5662457892, 2) 3.57 - >>> round(3.5662457892, 3) + >>> round(3.5662457892, 3) 3.566 - >>> round(3.5662457892, 4) + >>> round(3.5662457892, 4) 3.5662 :param value: The value to round @@ -131,7 +131,7 @@ def rand_on_circle(center: Point, radius: float) -> Point: def rand_on_line(pos1: Point, pos2: Point) -> Point: """ Given two points defining a line, return a random point on that line. - + :param pos1: The first point :param pos2: The second point :return: A random point on the line @@ -142,7 +142,7 @@ def rand_on_line(pos1: Point, pos2: Point) -> Point: def rand_angle_360_deg() -> float: """ - Returns a random angle in degrees. + Returns a random angle in degrees. """ return random.uniform(0.0, 360.0) diff --git a/arcade/resources/__init__.py b/arcade/resources/__init__.py index 53d628864..217e93e08 100644 --- a/arcade/resources/__init__.py +++ b/arcade/resources/__init__.py @@ -758,4 +758,4 @@ def get_resource_handle_paths(handle: str) -> List[Path]: gui_switch_green = ':system:gui_basic_assets/toggle/switch_green.png' gui_switch_red = ':system:gui_basic_assets/toggle/switch_red.png' gui_dark_blue_gray_panel = ':system:gui_basic_assets/window/dark_blue_gray_panel.png' -gui_grey_panel = ':system:gui_basic_assets/window/grey_panel.png' \ No newline at end of file +gui_grey_panel = ':system:gui_basic_assets/window/grey_panel.png' diff --git a/arcade/scene.py b/arcade/scene.py index 87f6c21ea..782bef49a 100644 --- a/arcade/scene.py +++ b/arcade/scene.py @@ -25,7 +25,7 @@ class Scene: def __init__(self) -> None: self._sprite_lists: List[SpriteList] = [] self._name_mapping: Dict[str, SpriteList] = {} - + @classmethod def from_tilemap(cls, tilemap: TileMap) -> "Scene": """ @@ -353,4 +353,4 @@ def draw_hit_boxes( for sprite_list in self._sprite_lists: sprite_list.draw_hit_boxes(color, line_thickness) - \ No newline at end of file + diff --git a/arcade/shape_list.py b/arcade/shape_list.py index fd03086a8..986331cfc 100644 --- a/arcade/shape_list.py +++ b/arcade/shape_list.py @@ -536,7 +536,7 @@ def create_triangles_strip_filled_with_colors( color_sequence: Sequence[RGBA255], ) -> Shape: """ - This function creates multiple triangles using a vertex buffer object. + This function creates multiple triangles using a vertex buffer object. Triangles are built for every 3 sequential vertices with step of 1 vertex Total amount of triangles to be rendered: len(point_list) - 2 diff --git a/arcade/sprite_list/collision.py b/arcade/sprite_list/collision.py index 193658674..c16dc114e 100644 --- a/arcade/sprite_list/collision.py +++ b/arcade/sprite_list/collision.py @@ -245,7 +245,7 @@ def check_for_collision_with_lists( raise TypeError(f"Parameter 1 is not an instance of the Sprite class, it is an instance of {type(sprite)}.") sprites: List[SpriteType] = [] - sprites_to_check: Iterable[SpriteType] + sprites_to_check: Iterable[SpriteType] for sprite_list in sprite_lists: if sprite_list.spatial_hash is not None and method == 1: diff --git a/arcade/text.py b/arcade/text.py index 5db3ffbc2..3cdd163d7 100644 --- a/arcade/text.py +++ b/arcade/text.py @@ -408,7 +408,7 @@ def height(self, value): @property def size(self): """ - Get the size of the label + Get the size of the label """ return self._label.width, self._label.height diff --git a/arcade/texture/loading.py b/arcade/texture/loading.py index 012c2b075..36829f49d 100644 --- a/arcade/texture/loading.py +++ b/arcade/texture/loading.py @@ -37,7 +37,7 @@ def load_texture( :param int y: Y coordinate of the texture in the image. :param int width: Width of the texture in the image. :param int height: Height of the texture in the image. - :param str hit_box_algorithm: + :param str hit_box_algorithm: :returns: New :class:`Texture` object. :raises: ValueError """ @@ -72,7 +72,7 @@ def _load_tilemap_texture( :param int y: Y coordinate of the texture in the image. :param int width: Width of the texture in the image. :param int height: Height of the texture in the image. - :param str hit_box_algorithm: + :param str hit_box_algorithm: :returns: New :class:`Texture` object. :raises: ValueError """ @@ -133,7 +133,7 @@ def _load_or_get_image( ) -> Tuple[ImageData, bool]: """ Load an image, or return a cached version - + :param str file_path: Path to image :param str hit_box_algorithm: The hit box algorithm :param hash: Hash of the image @@ -228,7 +228,7 @@ def load_textures( if not sub_image: Texture.validate_crop(image, x, y, width, height) sub_image = ImageData(image.crop((x, y, x + width, y + height))) - _cache.image_data_cache.put(image_cache_name, sub_image) + _cache.image_data_cache.put(image_cache_name, sub_image) # Do we have a texture for this sub-image? texture_cache_name = Texture.create_cache_name(hash=sub_image.hash, hit_box_algorithm=hit_box_algorithm) diff --git a/arcade/texture/transforms.py b/arcade/texture/transforms.py index 0d203418e..e1f165156 100644 --- a/arcade/texture/transforms.py +++ b/arcade/texture/transforms.py @@ -34,7 +34,7 @@ class Transform: order = ( VertexOrder.UPPER_LEFT.value, VertexOrder.UPPER_RIGHT.value, - VertexOrder.LOWER_LEFT.value, + VertexOrder.LOWER_LEFT.value, VertexOrder.LOWER_RIGHT.value, ) @@ -145,9 +145,9 @@ class FlipLeftRightTransform(Transform): VertexOrder.UPPER_RIGHT.value, VertexOrder.UPPER_LEFT.value, VertexOrder.LOWER_RIGHT.value, - VertexOrder.LOWER_LEFT.value, + VertexOrder.LOWER_LEFT.value, ) - + @staticmethod def transform_hit_box_points( points: PointList, @@ -160,7 +160,7 @@ class FlipTopBottomTransform(Transform): Flip texture vertically / top to bottom. """ order = ( - VertexOrder.LOWER_LEFT.value, + VertexOrder.LOWER_LEFT.value, VertexOrder.LOWER_RIGHT.value, VertexOrder.UPPER_LEFT.value, VertexOrder.UPPER_RIGHT.value, @@ -179,7 +179,7 @@ class TransposeTransform(Transform): """ order = ( VertexOrder.UPPER_LEFT.value, - VertexOrder.LOWER_LEFT.value, + VertexOrder.LOWER_LEFT.value, VertexOrder.UPPER_RIGHT.value, VertexOrder.LOWER_RIGHT.value, ) diff --git a/arcade/texture_atlas/base.py b/arcade/texture_atlas/base.py index 681e4a3a1..85a0ab5f9 100644 --- a/arcade/texture_atlas/base.py +++ b/arcade/texture_atlas/base.py @@ -420,7 +420,7 @@ def textures(self) -> List["Texture"]: Return a list of all the textures in the atlas. A new list is constructed from the internal weak set of textures. - + :rtype: Set[Texture] """ return list(self._textures) @@ -454,7 +454,7 @@ def add(self, texture: "Texture") -> Tuple[int, AtlasRegion]: # Add the image if we don't already have it. # If the atlas is full we will try to resize it. - if not self.has_image(texture.image_data): + if not self.has_image(texture.image_data): try: x, y, slot, region = self.allocate(texture.image_data) except AllocatorException: @@ -783,7 +783,7 @@ def resize(self, size: Tuple[int, int]) -> None: # Update the texture regions. We need to copy the image regions # and re-apply the transforms on each texture for texture in textures: - self._allocate_texture(texture) + self._allocate_texture(texture) self.texture_uv_texture.write(self._texture_uv_data) self._texture_uv_data_changed = False diff --git a/arcade/window_commands.py b/arcade/window_commands.py index fa682e8c2..91def587b 100644 --- a/arcade/window_commands.py +++ b/arcade/window_commands.py @@ -171,7 +171,7 @@ def run(): window = get_window() # Used in some unit test - if os.environ.get('ARCADE_TEST'): + if os.environ.get('ARCADE_TEST'): window.on_update(window._update_rate) window.on_draw() elif window.headless: @@ -249,7 +249,7 @@ def start_render() -> None: """ Clears the window. - More practical alternatives to this function is + More practical alternatives to this function is :py:meth:`arcade.Window.clear` or :py:meth:`arcade.View.clear`. """ diff --git a/pyproject.toml b/pyproject.toml index e3e00649c..9003097ea 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -93,6 +93,14 @@ ignore = ["F811", "E731", "E741"] show-source = true line-length = 120 exclude = ["venv", ".venv*", "tests", "build", "doc", "util", ".mypy_cache", ".pytest_cache", "temp", "bugs"] +select = [ + "E", + "F", + # Whitespace linting must be re-enabled manually for ruff + # see https://beta.ruff.rs/docs/configuration/#using-pyprojecttoml + "W" +] + [tool.mypy] disable_error_code = "annotation-unchecked"