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

_csv.pyi: minor cleanup #7789

Merged
merged 2 commits into from
May 6, 2022
Merged

_csv.pyi: minor cleanup #7789

merged 2 commits into from
May 6, 2022

Conversation

AlexWaygood
Copy link
Member

  • _csv._Writer is a confusing name for a protocol, given that there's also _csv._writer and _csv.writer. It's exactly the same as _typeshed.SupportsWrite[str], so we may as well just use that.
  • The strict field of a _csv.Dialect object is documented as being a bool, not an int: https://docs.python.org/3/library/csv.html#csv.Dialect.strict
  • _QuotingType should really be a union of literal types: the runtime raises an exception if we pass in anything that's not QUOTE_ALL, QUOTE_MINIMAL, QUOTE_NONE or QUOTE_NONNUMERIC. It's probably unwise to use a union of literals here right now due to Temporary moratorium on literal constants (until the end of 2022) #7258, but we should use a type alias to indicate that int isn't really the correct type here.
  • _csv._reader.dialect and _csv._writer.dialect are read-only properties at runtime.

@github-actions

This comment has been minimized.

1 similar comment
@github-actions
Copy link
Contributor

github-actions bot commented May 6, 2022

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@hauntsaninja hauntsaninja merged commit 5f55717 into python:master May 6, 2022
@AlexWaygood AlexWaygood deleted the csv2 branch May 6, 2022 18:38
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.

2 participants