ome / omero-blitz

Gradle project containing Ice remoting code for OMERO
https://www.openmicroscopy.org/omero
GNU General Public License v2.0
0 stars 15 forks source link

Replace all '\[]' slice strings with '[' #68

Closed joshmoore closed 4 years ago

joshmoore commented 5 years ago

In Python 3, the doc strings of Python modules are unicode and the initial slash is interpreted as an invalid escape sequence:

target/IceImport.py:22: in load
    __import__(target)
E     File "/py/target/omero_Scripts_ice.py", line 454
E       """
E        ^
E   SyntaxError: invalid escape sequence \[

see also: https://github.com/ome/omero-blitz/commit/64222ab24

sbesson commented 5 years ago

Main downside of this approach that the generated Sphinx API docs does not seem to unescape the [

Screen Shot 2019-09-12 at 16 13 58

The only other alternative to this proposal I found of would be to generate raw docstrings which should handle backslahes - see the last paragraph of https://www.python.org/dev/peps/pep-0257/#what-is-a-docstring. I have not looked into whether this is something that can be achieved without great efforts either in slice2py and/or in some post-processing step.

joshmoore commented 5 years ago

Odd. In my testing, barring the r""", the lbrack was the only thing that was properly rendered.

joshmoore commented 4 years ago

Latest seems to be fine without this. Closing.