Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR reapply Cody/QC fix that replaces string replacement using '%' by string replacement using the format method to the current develop version. It replaces PR #592.
Cody/QC suggested a fix to replace all string replacements using
%
bystring replacements using the
format
method. Yet, the suggestedreplacement introduce a syntax error by replacing all occurences similar
to
%4s
to something like{0:4!s}
; where what follows the column isthe format for the replacement and what follows the bang is the type for
the conversion.
Cody's replacement leads to the following exception:
It appears that the column part and the bang part of the format should
be written the other way around so
{0:4!s}
should actually be{0!s>4}
. Note that the>
character is important as it describes howthe data should be aligned. By default, without the >, strings are flush
to the left while
%4s
flush strings to the right. Note that{0!d:4}
does flush to the right on the contrary to what happens with strings.
In MDAnalysis, the only faulty replacements where about string format.
They could be detected using the following grep statement:
I fixed the faulty replacement with the following command: