Skip to content
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

Fix the type annotation for color param of Spinner.finalize() #2879

Merged
merged 1 commit into from Jan 17, 2023

Conversation

kurtmckee
Copy link
Contributor

Colorama's ANSI class attributes are defined as ints. However, when an ANSI class is instantiated (say, when the AnsiFore class is instantiated as Fore), instance attributes with identical names are dynamically created, but the attributes are strings containing ANSI escape sequences.

Thus, AnsiFore.YELLOW is an int, while Fore.YELLOW is a str. mypy 0.991 isn't catching this discrepancy, but PyCharm did.

Closes #2878.

Thanks for contribution

Please, make sure you address all the checklists (for details on how see
development documentation)!

  • ran the linter to address style issues (tox -e fix)

  • wrote descriptive pull request text

  • ensured there are test(s) validating the fix

    mypy didn't notice a problem before or after the fix, so I don't see a way to test this.

  • added news fragment in docs/changelog folder

  • updated/extended the documentation

    This doesn't seem necessary for this type of change. Please correct me if I'm wrong!

Colorama's ANSI class attributes are defined as ints.
However, when an ANSI class is instantiated
(say, when the `AnsiFore` class is instantiated as `Fore`),
instance attributes with identical names are dynamically created,
but the attributes are strings containing ANSI escape sequences.

Thus, `AnsiFore.YELLOW` is an int, while `Fore.YELLOW` is a str.
mypy 0.991 isn't catching this discrepancy, but PyCharm did.

Fixes tox-dev#2878
@gaborbernat gaborbernat merged commit d53f062 into tox-dev:main Jan 17, 2023
@kurtmckee kurtmckee deleted the fix-type-annotation branch January 17, 2023 15:22
descope bot added a commit to descope/django-descope that referenced this pull request Jan 31, 2023
This PR contains the following updates:

| Package | Type | Update | Change | Pending |
|---|---|---|---|---|
| [tox](https://togithub.com/tox-dev/tox)
([changelog](https://tox.wiki/en/latest/changelog.html)) | dev | patch |
`4.3.3` -> `4.3.4` | `4.4.3` (+4) |

---

### Release Notes

<details>
<summary>tox-dev/tox</summary>

### [`v4.3.4`](https://togithub.com/tox-dev/tox/releases/tag/4.3.4)

[Compare Source](https://togithub.com/tox-dev/tox/compare/4.3.3...4.3.4)

#### What's Changed

- Provision cwd by [@&#8203;masenf](https://togithub.com/masenf) in
[tox-dev/tox#2877
- Fix the type annotation for `color` param of `Spinner.finalize()` by
[@&#8203;kurtmckee](https://togithub.com/kurtmckee) in
[tox-dev/tox#2879

**Full Changelog**: tox-dev/tox@4.3.3...4.3.4

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNC4xMDEuMCIsInVwZGF0ZWRJblZlciI6IjM0LjEwMS4wIn0=-->

Co-authored-by: descope[bot] <descope[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incorrect type annotation for Spinner.finalize()
2 participants