Add Python type annotations to constructor body assignments#8
Conversation
…_init__` method. I modified `Json2SharpLib/Emitters/Python/PythonClassEmitter.cs` to include type hints when assigning instance variables in the constructor body, which occurs when the `AddTypeHints` option is enabled. I also refactored the type hint generation for arrays into a reusable `GetArrayTypeHint` method and introduced a `GetPropertyType` helper to determine the correct Python types for properties, including objects and arrays. Finally, I updated the test expectation files in `Json2SharpTests/PythonTests/Models/Answers/` to match this new format and confirmed that all unit tests pass for the .NET 8.0 target.
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
The user wants to add Python type annotations to the instance variable assignments in the
__init__method of classes generated by the library, and update the corresponding unit tests to reflect this change.Modified
Json2SharpLib/Emitters/Python/PythonClassEmitter.csto support type annotations in the constructor body.Updated test expectation files in
Json2SharpTests/PythonTests/Models/Answers/for:Verified with
dotnet test Json2SharpTests/Json2SharpTests.csproj.PR created automatically by Jules for task 2859604139089415028 started by @FuzzyLab-Shared