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

Distinguish str from Iterable[str] in arguments #64

Open
5 of 10 tasks
abelcheung opened this issue Oct 21, 2024 · 0 comments
Open
5 of 10 tasks

Distinguish str from Iterable[str] in arguments #64

abelcheung opened this issue Oct 21, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@abelcheung
Copy link
Owner

abelcheung commented Oct 21, 2024

It is a common typing problem that str can actually be used in Iterable[str] arguments and most likely cause undesirable effect. We should find all places where such problem may occur (including Collection[str] and Sequence[str] as well as bytes counterparts), and use warnings.deprecated to intercept str usage. Potentially problematic functions / methods below:

  • etree._ElementTree.write(method='c14n',inclusive_ns_prefixes=...) (06f868b)
  • etree.C14NWriterTarget.__init__(...)
  • etree.Extension(function_mapping=...)
  • etree.canonicalize(...)
  • etree.cleanup_namespaces(keep_ns_prefixes=...)
  • etree.fromstringlist(strings=...) (bc8798b)
  • etree.strip_attributes(__attrib=...)
  • etree.tostring(method='c14n',inclusive_ns_prefixes=...) (06f868b)
  • html.soupparser.fromstring(exclude_encodings=...) (68facbc)
  • html.soupparser.parse(exclude_encodings=...) (68facbc)

Note that only pyright would provide deprecation warnings; it remains unsupported as of mypy 1.13.

@abelcheung abelcheung converted this from a draft issue Oct 21, 2024
@abelcheung abelcheung added the bug Something isn't working label Oct 21, 2024
@abelcheung abelcheung self-assigned this Oct 22, 2024
abelcheung added a commit that referenced this issue Nov 7, 2024
Fix inclusive_ns_prefixes parameter in C14N writing, partially addresses #64
abelcheung added a commit that referenced this issue Nov 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: In Progress
Development

No branches or pull requests

1 participant