Skip to content

fix: replace mutable default argument in get_all_uids#391

Open
t7929375-eng wants to merge 1 commit intoentrius:testfrom
t7929375-eng:fix/mutable-default-get-all-uids
Open

fix: replace mutable default argument in get_all_uids#391
t7929375-eng wants to merge 1 commit intoentrius:testfrom
t7929375-eng:fix/mutable-default-get-all-uids

Conversation

@t7929375-eng
Copy link
Copy Markdown

Summary

get_all_uids() in gittensor/utils/uids.py uses a mutable default argument (exclude: List[int] = []). This is a well-known Python anti-pattern (W0102) — if any caller mutates the list, the shared default object is permanently corrupted for all subsequent calls.

Replaced with Optional[List[int]] = None and an explicit if exclude is None: exclude = [] guard.

Type of Change

  • Bug fix

Testing

  • ruff check passes
  • pyright passes
  • Self-reviewed

Checklist

  • Code follows project style guidelines
  • Self-review completed

cc @anderdc @LandynDev

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.

1 participant