#44577: generate_packets.py: overhaul Variant.get_send() and Variant.get_receive() string formatting Open Date: 2022-05-12 22:34 Last Update: 2022-05-14 23:15 URL for this Ticket: https://osdn.net//projects/freeciv/ticket/44577 RSS feed for this Ticket: https://osdn.net/ticket/ticket_rss.php?group_id=12505&tid=44577 --------------------------------------------------------------------- Last Changes/Comment on this Ticket: 2022-05-14 23:15 Updated by: alienvalkyrie * Details Updated Comment: get_receive() parts done. --------------------------------------------------------------------- Ticket Status: Reporter: alienvalkyrie Owner: alienvalkyrie Type: Patches Status: Open [Owner assigned] Priority: 5 - Medium MileStone: 3.2.0 Component: Bootstrap Severity: 5 - Medium Resolution: None --------------------------------------------------------------------- Ticket details: Part of #43927. Split from #44575. The get_send() and get_receive() methods of the Variant class do their own formatting thing that needs to be replaced with something more robust. For this reason, they've been left out of a number of recent refactorings, which should also be applied to them once viable. Steps to be done: For Variant.get_receive(), along with Variant.get_delta_receive_body() (and Field.get_get_real()): #44597 Replace the <var>-based custom formatting with a string join #44598 Distribute the % (printf-style) formatting out to the individual parts (that need them) in get_receive() #44599 Replace % formatting with str.format() and only the required arguments in get_receive(); cf. #44575 #44601 Deal with string formatting in get_delta_receive_body() (and Field.get_get_real()) For Variant.get_send(), along with Variant.get_delta_send_body() – exact steps to be determined This is more complicated, since get_delta_send_body() may also emit code containing placeholders for the custom formatting mode Apply the equivalent of #44583 and #44584 to the resulting code -- Ticket information of Freeciv project Freeciv Project is hosted on OSDN Project URL: https://osdn.net/projects/freeciv/ OSDN: https://osdn.net URL for this Ticket: https://osdn.net/projects/freeciv/ticket/44577 RSS feed for this Ticket: https://osdn.net/ticket/ticket_rss.php?group_id=12505&tid=44577