Type compatibility with `h11._headers.Header`
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 1/5
- Temps estimé
- 1-3 heures
- Accessibilité débutants
- 48/100
- Type d'issue
- Bug
- Clarté
- Clairement spécifiée
- Activité
- À l'abandon
- Stack technique
- python
- Domaine
- networking
Piste de recherche
Start in src/wsproto/typing.py and inspect how the Headers alias is defined. Compare it with h11._headers.Headers from version 0.13.0, then verify that the reported mypy error is resolved and that existing checks still pass. Done means wsproto.Header is type-compatible with h11 headers.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
At the moment, the wsproto.typing.Header type is not compatible with h11._headers.Header which is defined as the following, starting with version 0.13.0:
class Headers(Sequence[Tuple[bytes, bytes]]):
[...]
The following patch might provide this compatibility:
diff --git a/src/wsproto/typing.py b/src/wsproto/typing.py
index a44b27e..1786501 100644
--- a/src/wsproto/typing.py
+++ b/src/wsproto/typing.py
@@ -1,3 +1,3 @@
-from typing import List, Tuple
+from typing import Sequence, Tuple
-Headers = List[Tuple[bytes, bytes]]
+Headers = Sequence[Tuple[bytes, bytes]]
This would fix mypy errors such as:
error: Argument "headers" to "initiate_upgrade_connection" of "WSConnection" has incompatible type "Headers"; expected "List[Tuple[bytes, bytes]]" [arg-type]
Would that make sense? I can make a PR if necessary.
- Langage dominant
- Python
- Étoiles
- 303
- Forks
- 57
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de python-hyper/wsproto
-
Compression Ouverte
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 25/100
python-hyper/wsproto#199 · 5 commentaires ·
-
Difficulté 3/5 1-2 jours Accessibilité débutants 38/100
python-hyper/wsproto#182 ·
Toutes les issues de python-hyper/wsproto
Issues similaires
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 86/100
zostera/django-bootstrap4#894 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
use-agent-os/agent-os#3276 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100
zephyrproject-rtos/zephyr#119726 ·
-
area/auth bug comp/agent P3 platform/discord type/security
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100
NousResearch/hermes-agent#117848 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
zilliztech/memsearch#759 ·