Invalid Enum member names which contain the Enum name
まだ誰も着手していません。
評価
調査の方向性
test.proto の定義と、ドキュメントに記載されている protoc -I . --python_betterproto_out=lib test.proto コマンドを使って issue を再現します。生成された lib/hello/__init__.py を 2.0.0b6 で期待される出力と比較し、Risk enum のメンバーに重点を置きます。LOW_RISK や HIGH_RISK などの enum 名が _ に変わらず保持されていれば完了です。
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- Python
- スター
- 1.8k
- フォーク
- 235
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
danielgtaylor/python-betterproto のほかの issue
-
難易度 3/5 1〜2日 初心者へのやさしさ 55/100
-
難易度 5/5 1週間以上 初心者へのやさしさ 15/100
-
bug investigation needed
難易度 3/5 1〜2日 初心者へのやさしさ 42/100
-
bug investigation needed
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
-
bug investigation needed
難易度 4/5 3〜5日 初心者へのやさしさ 38/100
danielgtaylor/python-betterproto#676 · コメント 3 件 ·
danielgtaylor/python-betterproto の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
MISP/misp-workbench#496 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1〜3時間 初心者へのやさしさ 88/100
fossasia/visdom-dev#69 ·
メンテナーはふだん 3 日以内に返信
-
[Bug] Parameters named like a property break to_xcal()対応中かも @atharvasalunke1267 が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
collective/icalendar#2018 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信