Skip to content
New issue

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

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

Already on GitHub? # to your account

Fix warnings: Access to a protected member of a class #57

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Wuodan
Copy link
Contributor

@Wuodan Wuodan commented Aug 21, 2024

IntelliJ complains when a protected member is accessed from outside the class.

Example:

  • tminterface2.py: class TMInterface has a method _read_int32()
  • add_cp_as_triggers.py: uses the method and has a warning

This commit fixes the warnings where possible.

The warning is not always correct as found here:

trackmania_rl/buffer_utilities.py:280
target_buffer.extend(source_buffer.storage._storage)
Warning: _ListStorage.storage is not publicly accessible is wrong because ListStorage._storage is not publicly accessible

Fixes #56

@Wuodan Wuodan force-pushed the upstream/issue/56_Access-to-a-protected-member-of-a-class branch 2 times, most recently from fb29243 to 1c5ef08 Compare August 21, 2024 21:29
@pb4git
Copy link
Member

pb4git commented Aug 26, 2024

This PR modifies much more than just _storage. Is that intended?

IntelliJ complains when a protected member is accessed from outside the class.

Example:
- tminterface2.py: class `TMInterface` has a method `_read_int32()`
- add_cp_as_triggers.py: uses the method and has a warning

This commit fixes the warnings where possible.

The warning is not always correct as found here:

trackmania_rl/buffer_utilities.py:280
`target_buffer.extend(source_buffer.storage._storage)`
Warning: _ListStorage._storage is not publicly accessible_ is wrong because `ListStorage._storage` is not publicly accessible

Fixes Linesight-RL#56
@Wuodan Wuodan force-pushed the upstream/issue/56_Access-to-a-protected-member-of-a-class branch from 1c5ef08 to 07c6fc3 Compare August 30, 2024 14:45
@Wuodan Wuodan changed the title Access to a protected member of a class Fix warnings: Access to a protected member of a class Aug 30, 2024
@Wuodan
Copy link
Contributor Author

Wuodan commented Aug 30, 2024

Rebased the branch on main and changed both the commit message and the PR title/text to better explain the change.

Sorry for the confusion. The idea is to fix the warnings wherever possible, the note was about the exception where testing showed that _storage is correct and the warning should be ignored.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Warnings about "Access to a protected member"
2 participants