ByteString, specifying length for any bytes-like variable
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Python
- Estrellas
- 1.8k
- Forks
- 302
- Merge medio
- 23 h
- PR fusionados (30 d)
- 8
Descripción
This request is a combination of two additions to ByteString that apparently are not supported yet, or at least I could find no discussion of them.
- Support any bytes-like buffers, not only
bytes,bytearrayandmemoryview - Allow specifying the length of the buffer expected (in my case it usually must be exactly 32 bytes)
Ideally, Python typing would allow specifying bytes-like of (a) any length, (b) fixed length or (c) min and/or max length. Potentially also separately specifying if a writable buffer is expected.
While I don't expect for mypy to be able to check for all of that, it would at least be nice to include such information in the annotations for documentation purposes, avoiding the use of docstrings for parameter definitions where names and types are descriptive enough. Is there any way to do this without causing mypy errors, considering that I would rather have no type checking but documentative annotations than what the current implementation can do?
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
No se nombra ningún archivo, prueba ni punto de entrada. Empieza revisando el comportamiento de tipado existente de ByteString y las discusiones relacionadas sobre tipado; después, determina si los tipos similares a bytes, las longitudes fijas o acotadas y la capacidad de escritura se pueden representar sin errores de mypy. Se considerará terminado cuando exista un diseño de anotaciones acordado y el comportamiento documentado de la comprobación de tipos.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- python
- Área
- developer-experience
- Tipo de issue
- Nueva funcionalidad
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Estado de actividad
- Estancado
- Claridad
- Necesita aclaración
- Aptitud para principiantes
- 25/100