Giter Club home page Giter Club logo

Comments (5)

jedie avatar jedie commented on August 19, 2024 1

Removed with #39 ... Can you confirm?

from python-creole.

jugmac00 avatar jugmac00 commented on August 19, 2024 1

Indeed, the deprecation warnings are gone.

from python-creole.

jedie avatar jedie commented on August 19, 2024

One of these have i fixed with 97acbc4#diff-7e85869c19954199a320efc15b208cb9

But two still exists. But i haven't find the wrong regexp :(

from python-creole.

jugmac00 avatar jugmac00 commented on August 19, 2024

These are really tough ones! Especially as the deprecation warning is truncated.

I patchted CPython in sre_parse.py (at the line with Flags not at the start of the expression) and now I get the full deprecation warning:

creole/parser/creol2html_parser.py:51
  /home/jugmac00/Projects/python-creole/creole/parser/creol2html_parser.py:51: DeprecationWarning: Flags not at the start of the expression '\n            \\| \\s*\n            (\n                (?P<head> [=][^|]+ ) |\n                (?P<cell> (  (?P<link>\n            \\[\\[\n            (?P<link_target>.+?) \\s*\n            ([|] \\s* (?P<link_text>.+?) \\s*)?\n            ]]\n        )|\n        (?P<macro_inline>\n        << \\s* (?P<macro_inline_start>\\w+) \\s* (?P<macro_inline_args>.*?) \\s* >>\n        (?P<macro_inline_text>(.|\\n)*?)\n        <</ \\s* (?P=macro_inline_start) \\s* >>\n        )\n    |(?P<macro_tag>\n            <<(?P<macro_tag_name> \\w+) (?P<macro_tag_args>.*?) \\s* /*>>\n        )|(?i)(?P<image>\n            {{\n            (?P<image_target>.+?) \\s*\n            (\\| \\s* (?P<image_text>.+?) \\s*)?\n            }}\n        )|(?P<pre_inline> {{{ (?P<pre_inline_text>.*?) }}} ) | [^|])+ )\n            ) \\s*\n        '
    cell_re = re.compile(x, re.VERBOSE | re.UNICODE)

creole/parser/creol2html_parser.py:55
  /home/jugmac00/Projects/python-creole/creole/parser/creol2html_parser.py:55: DeprecationWarning: Flags not at the start of the expression '(?P<link>\n            \\[\\[\n            (?P<link_target>.+?) \\s*\n            ([|] \\s* (?P<link_text>.+?) \\s*)?\n            ]]\n        )|(?P<url>\n            (^ | (?<=\\s))\n            (?P<escaped_url>~)?\n            (?P<url_target> (?P<url_proto> http|https|ftp|nntp|news|mailto|telnet|file|irc )://[^$\\s]+ )\n        )|\n        (?P<macro_inline>\n        << \\s* (?P<macro_inline_start>\\w+) \\s* (?P<macro_inline_args>.*?) \\s* >>\n        (?P<macro_inline_text>(.|\\n)*?)\n        <</ \\s* (?P=macro_inline_start) \\s* >>\n        )\n    |(?P<macro_tag>\n            <<(?P<macro_tag_name> \\w+) (?P<macro_tag_args>.*?) \\s* /*>>\n        )|(?P<pre_inline> {{{ (?P<pre_inline_text>.*?) }}} )|(?i)(?P<image>\n            {{\n            (?P<image_target>.+?) \\s*\n            (\\| \\s* (?P<image_text>.+?) \\s*)?\n            }}\n        )|(?P<strong>\\*\\* (?P<strong_text>.+?) \\*\\* )|(?P<emphasis>(?<!:)// (?P<emphasis_text>.+?) (?<!:)// )|(?P<monospace> \\#\\# (?P<monospace_text>.+?) \\#\\# )|(?P<underline> __ (?P<underline_text>.+?) __ )|(?P<superscript> \\^\\^ (?P<superscript_text>.+?) \\^\\^ )|(?P<subscript> ,, (?P<subscript_text>.+?) ,, )|(?P<small>-- (?P<small_text>.+?) -- )|(?P<delete> ~~ (?P<delete_text>.+?) ~~ )|(?P<linebreak> \\\\\\\\ )|(?P<escape> ~ (?P<escaped_char>\\S) )|(?P<char> . )'
    inline_re = re.compile('|'.join(INLINE_RULES), INLINE_FLAGS)

So it seems it is the ?i flag.

When I remove the flag from InlineRules.image (just for debugging) indeed I get no more deprecation warnings from regex.

As a side note - the tests still pass - so either this flag is not needed at all, or the tests miss a special test case.

Does this help you? Unfortunately, I rarely work with regexes, and especially not with complex ones as here. Without further studying I cannot help here.

from python-creole.

jedie avatar jedie commented on August 19, 2024

remove the flag from InlineRules.image

(?i) is re.IGNORECASE so it can be removed, see also: 97acbc4#commitcomment-36877309

from python-creole.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.