Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Fix the type signature of collision check methods.#2578

Merged
pushfoo merged 1 commit into
pythonarcade:developmentpythonarcade/arcade:developmentfrom
sjrd:fix-type-sig-of-collision-checkssjrd/arcade:fix-type-sig-of-collision-checksCopy head branch name to clipboard
Feb 26, 2025
Merged

Fix the type signature of collision check methods.#2578
pushfoo merged 1 commit into
pythonarcade:developmentpythonarcade/arcade:developmentfrom
sjrd:fix-type-sig-of-collision-checkssjrd/arcade:fix-type-sig-of-collision-checksCopy head branch name to clipboard

Conversation

@sjrd

@sjrd sjrd commented Feb 21, 2025

Copy link
Copy Markdown
Contributor

The type of the sprites in the result never depend on the first argument single sprite. Instead, it depends on the type of sprites in the given sprite_list.

Previously, some signatures did not accurately reflect those properties. This commit fixes them.

Fixes #2576.


I don't think this can be tested per se? The tests don't seem to be checked by mypy, are they?

FWIW, changing sprite_list: SpriteList to SpriteList[BasicSprite] (only) did report type errors inside check_collision_with_sprite_list. It previously passed the type checker only because it was inferred as SpriteList[Unknown], which it was happy to assign to Iterable[SpriteType].

The type of the sprites in the result never depend on the first
argument single sprite. Instead, it depends on the type of sprites
in the given `sprite_list`.

Previously, some signatures did not accurately reflect those
properties. This commit fixes them.

Fixes pythonarcade#2576.

@pushfoo pushfoo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm in favor of merging since:

  1. The SpriteList is more crucial than the physics engines
  2. The physics engine annotations are sort of kludgy
  3. #2580

@pushfoo pushfoo merged commit 21fe980 into pythonarcade:development Feb 26, 2025
@sjrd sjrd deleted the fix-type-sig-of-collision-checks branch February 26, 2025 15:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

check_for_collision_with_list does not return the right SpriteType

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.