Make a Converter without the default hook factories
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 25/100
Línea de trabajo
The payload names no files. Start with the fallback-hook-factories section of the docs and the unstructure_fallback_factory and structure_fallback_factory arguments of Converter, to see how a child converter consults its parent. Then check why the default structure_attrs_fromdict preference overrides the parent's hook. The issue is open on which approach to take (a BaseConverter workaround or new __init__ flags), so agree on a design with maintainers first. Done means a child converter uses a hook registered on its parent even when a default hook exists.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
The problem
Let's take the fallback-hook-factories section
parent = Converter()
child = Converter(
unstructure_fallback_factory=parent.get_unstructure_hook,
structure_fallback_factory=parent.get_structure_hook,
)
Let's say in parent you added another custom hook factory such as
@parent.register_structure_hook_factory(lambda val: issubclass(val, Foo))
def structure_Foo(cls) -> StructureHook:
...
You would expect that the child would pick up this new converter of the parent, but that is not the case if there is already a way to structure Foo from the default converters in Converter
So what now?
One way around this is to use BaseConverter I guess, but it is not quite that straightforward and trying it out I still hit some other preferences that override it, e.g. structure_attrs_fromdict.
Another option would be to have flags in the __init__ of those converters to truely not add any defaults and let it fallback to the parent more directly.
- Lenguaje dominante
- Python
- Estrellas
- 1.1k
- Forks
- 177
- Merge medio
- 14 h 46 min
- PR fusionados (30 d)
- 5
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
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.
Más de python-attrs/cattrs
-
Dataclass default_factory field treated as required in union disambiguationPosiblemente ocupada @Eryx-Z la tomó hace 3 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
python-attrs/cattrs#796 ·
Los mantenedores suelen responder en 1 día
-
decimal.Decimal not handled in preconf converters (json, pyyaml)Posiblemente ocupada @Binilkks la tomó hace 115 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
python-attrs/cattrs#761 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 64/100
python-attrs/cattrs#513 · 4 comentarios ·
Los mantenedores suelen responder en 1 día
-
Structure hook on a PEP 695 alias is ignored inside a passthrough unionPosiblemente ocupada @Eryx-Z la tomó hace 3 días. Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 62/100
python-attrs/cattrs#797 ·
Los mantenedores suelen responder en 1 día
-
msgspec converter skips hooks and drops private fields in nested recursionPosiblemente ocupada @Gabrieljr42 la tomó hace 3 días. Abierto
Dificultad 3/5 Medio día Aptitud para principiantes 64/100
python-attrs/cattrs#795 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Todos los issues de python-attrs/cattrs
Issues similares
-
wr.dynamodb.read_items returns [{}] for a single partition value that does not existPosiblemente ocupada @auraseb la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
aws/aws-sdk-pandas#3520 ·
Los mantenedores suelen responder en 2 días
-
requires triage typing
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
sqlalchemy/sqlalchemy#13704 ·
Los mantenedores suelen responder en 1 día
-
Edit tool converts CRLF files to LFPosiblemente ocupada @RaphaelFakhri la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
huggingface/tau#774 ·
Los mantenedores suelen responder en 1 día
-
show ignores the row limit when a column or table name contains "limit"Posiblemente ocupada @RaphaelFakhri la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
Los mantenedores suelen responder en 1 día
-
What happened to `check.py`?Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
linebender/resvg#1179 · 1 comentario ·
Los mantenedores suelen responder en 2 días