Invalid Enum member names which contain the Enum name
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 45/100
Direzione di ricerca
Ricrea l’issue con la definizione test.proto e il comando documentato protoc -I . --python_betterproto_out=lib test.proto. Confronta il file generato lib/hello/__init__.py con l’output previsto di 2.0.0b6, concentrandoti sui membri dell’enum Risk. Il lavoro è completato quando i nomi dell’enum, come LOW_RISK e HIGH_RISK, vengono preservati invece di diventare _.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Summary
2.0.0b7 breaks enums with underscores in field names
Reproduction Steps
Test proto definition, in test.proto:
syntax = "proto3";
package hello;
// Greeting represents a message you can tell a user.
message Greeting {
Risk risk = 1;
}
enum Risk {
LOW_RISK = 0;
HIGH_RISK = 1;
}
Protoc compiler invocation:
$ protoc -I . --python_betterproto_out=lib test.proto
Expected Results
2.0.0b6 output (lib/hello/__init__.py):
# Generated by the protocol buffer compiler. DO NOT EDIT!
# sources: test.proto
# plugin: python-betterproto
# This file has been @generated
from dataclasses import dataclass
import betterproto
class Risk(betterproto.Enum):
LOW_RISK = 0
HIGH_RISK = 1
@dataclass(eq=False, repr=False)
class Greeting(betterproto.Message):
"""Greeting represents a message you can tell a user."""
risk: "Risk" = betterproto.enum_field(1)
Actual Results
2.0.0b7 output (lib/hello/__init__.py):
# Generated by the protocol buffer compiler. DO NOT EDIT!
# sources: test.proto
# plugin: python-betterproto
# This file has been @generated
from dataclasses import dataclass
import betterproto
class Risk(betterproto.Enum):
_ = 0
_ = 1
@dataclass(eq=False, repr=False)
class Greeting(betterproto.Message):
"""Greeting represents a message you can tell a user."""
risk: "Risk" = betterproto.enum_field(1)
System Information
- Protoc version: libprotoc 27.3
- Python version: Python 3.11.7
- Betterproto version:
Name: betterproto
Version: 2.0.0b7
Summary: A better Protobuf / gRPC generator & library
Home-page: https://github.com/danielgtaylor/python-betterproto
Author: Daniel G. Taylor
Author-email: [email protected]
License: MIT
Location: /Users/connor/Code/tests/test070/.venv/lib/python3.11/site-packages
Requires: grpclib, python-dateutil, typing-extensions
Required-by:
Checklist
- I have searched the issues for duplicates.
- I have shown the entire traceback, if possible.
- I have verified this issue occurs on the latest prelease of betterproto which can be installed using
pip install -U --pre betterproto, if possible.
- Lingua principale
- Python
- Stelle
- 1.8k
- Fork
- 235
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di danielgtaylor/python-betterproto
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 55/100
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 15/100
-
bug investigation needed
Difficoltà 3/5 1-2 giorni Idoneità per principianti 42/100
-
bug investigation needed
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
-
bug investigation needed
Difficoltà 4/5 3-5 giorni Idoneità per principianti 38/100
danielgtaylor/python-betterproto#676 · 3 commenti ·
Tutte le issue di danielgtaylor/python-betterproto
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
CLIMADA-project/climada_python#1337 ·
I maintainer di solito rispondono entro 3 giorni
-
tail without reverseAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
8go/matrix-commander#233 ·
-
documentation
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
-
documentation enhancement priority:high size:M
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
Validate non-divisible effective batch sizes in the Unsloth LoRA backendForse già presa @debesh-biswas l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100