HEPCloud / decisionengine_modules

Apache License 2.0
2 stars 19 forks source link

Eliminate escaping of double quotation marks to conform with NEWT API's changed behavior #461

Closed namrathaurs closed 1 year ago

namrathaurs commented 1 year ago

As per Steve (Steven Timm), NERSC has changed the behavior of the NEWT API where it does not allow escaping of double quotes, which was previously allowed. Steve came up with a live patch for the production code and wanted the patch to be applied, as per acceptable coding standards.

Since both 1.7.x and 2.x series of Decision Engine is based on python 3, the solution being proposed in this PR is to use the f-string notation (i.e. f" ") instead of .format().

Pat Riehecky suggested to run the change through black and was considered. First, all the literals of the query variable (string) was changed to the f-string notation and was passed through black. No changes were added/made. Next, only the first literal of the query variable was changed to have the f-string notation while other parts were left as-is. black reported no changes being made. Technically, the first literal doesn't need an f and is more of a style choice. I added f for all the literals so as to maintain consistency/readability as per this SO discussion.