Coder Social home page Coder Social logo

Comments (3)

isaackogan avatar isaackogan commented on June 12, 2024

The specific thing it failed with:

print(field_name, current, value)
>>> comment_quality_scores {} Entry(key=[117, 115, 101, 114, 95, 116, 121, 112, 101, 95, 114, 117, 108, 101], value=200000)

changing the map type to a string fixed the issue. some info on why this worked would help a bunch

from python-betterproto.

johanjk avatar johanjk commented on June 12, 2024

I can't reproduce the issue.

Firstly, your proto did not compile as is, had to run on the following:

syntax = "proto3";

message WebcastChatMessage {
  //Common common = 1;
  //User user = 2;
  string content = 3;
  bool visibleToSender = 4;
  //Image backgroundImage = 5;
  string fullScreenTextColor = 6;
  //Image backgroundImageV2 = 7;
  //Image giftImage = 10;
  int32 inputType = 11;
  //User atUser = 12;
  repeated EmoteWithIndex emotesList = 13;
  string contentLanguage = 14;
  int32 quickChatScene = 16;
  int32 communityFlaggedStatus = 17;
  //UserIdentity UserIdentity = 18;
  map<int32, string> CommentQualityScores = 19;

  // @EmoteWithIndex
  // proto.webcast.im.ChatMessage
  message EmoteWithIndex {
    int64 index = 1;
    //Emote emote = 2;
  }
}

No reproducible test were supplied, I tried reproducing using the following:
protoc -I . --python_betterproto_out . message.proto

from msg import WebcastChatMessage, WebcastChatMessageEmoteWithIndex

x = WebcastChatMessage(
    content='hello',
    visible_to_sender=True,
    full_screen_text_color='#ffffff',
    input_type=1,
    emotes_list=[
        WebcastChatMessageEmoteWithIndex(1),
        WebcastChatMessageEmoteWithIndex(2),
    ],
    content_language='en-US',
    quick_chat_scene=0,
    community_flagged_status=2,
    comment_quality_scores={
        1: "bad",
        2: "rude",
    }
)

y = WebcastChatMessage().parse(bytes(x))
assert x == y

print(x)
print(y)

Leading to no errors on "betterproto[compiler]>=2.0.0b6"

from python-betterproto.

isaackogan avatar isaackogan commented on June 12, 2024

Hi, thanks for checking. Let me see if I'm on the latest version (I thought I am) and investigate some more.

Isaac

from python-betterproto.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.