question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[sgf-parsing] fix escaped characters test

See original GitHub issue

Running the tests for sgf-parsing throws a DeprecationWarning related to an invalid escape sequence. This is due to the \] inclusions in the test string, which really should be \\] to work correctly.

Now from the canonical data we are getting '(;A[\\]b\\nc\\nd\\t\\te \\n\\]])', but by the time it’s rendered into the _test.py it’s become "(;A[\]b\nc\nd\t\te \n\]])", leading to the aforementioned warning.

To fix this we’d seemingly need to flag the literal as raw before parsing the json file, or we’d need to manually correct for improperly escaped non-control characters.

Unfortunately we cannot just render the strings with “r” in front of them in the Jinja template, as that ends up turning \n into two characters, \\ and n.

Open to ideas.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:12 (12 by maintainers)

github_iconTop GitHub Comments

2reactions
yawpitchcommented, Feb 29, 2020

No worries, I just wanted to have both our thoughts down in case I’m wrong and we need to revisit in the future.

1reaction
cmccandlesscommented, Feb 20, 2020

The above suggestion works on my machine. If that’s an acceptable solution, I’ll PR it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

SabakiHQ/sgf: A library for parsing SGF files. - GitHub
Resolves escaped characters and returns the new string. sgf.parseVertex(input). input <String>. Turns an SGF point ...
Read more >
Process escape sequences in a string in Python
The correct thing to do is use the 'string-escape' code to decode the string. ... But if there are any literal non-ASCII characters...
Read more >
SGF Parsing in Python on Exercism
Can you solve SGF Parsing in Python? ... Parsing a Smart Game Format string. ... Note that SGF does not have escape sequences...
Read more >
Jelly escaping types - ServiceNow Docs
You use different methods when escaping characters in JavaScript and HTML. ... Test a fix script · Run fix scripts ... XML parser...
Read more >
Preventing Escape Sequence Interpretation in Python
After the encounter of a backslash (inside a string), any following character (with the ( \ )) would be looked upon the aforementioned...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found