mirror of
https://github.com/weechat/weechat.git
synced 2026-06-28 13:56:37 +02:00
core: Fix regex for constants in the Python stub generator
In Python raw strings, newlines can't be escaped with a backslash. If you do that, both the backslash and the newline become part of the string. This meant that the regex for constants both started and ended with a newline which caused every other constant to be skipped.
This commit is contained in:
committed by
Sébastien Helleu
parent
44e0414970
commit
827db6dc31
+5
-7
@@ -38,16 +38,14 @@ STUB_HEADER = """\
|
||||
from typing import Dict
|
||||
"""
|
||||
|
||||
CONSTANT_RE = r"""\
|
||||
`(?P<constant>WEECHAT_[A-Z0-9_]+)` \((?P<type>(string|integer))\)(?: \+)?\
|
||||
"""
|
||||
CONSTANT_RE = (
|
||||
r""" `(?P<constant>WEECHAT_[A-Z0-9_]+)` \((?P<type>(string|integer))\)(?: \+)?"""
|
||||
)
|
||||
|
||||
FUNCTION_RE = r"""\
|
||||
\[source,python\]
|
||||
FUNCTION_RE = r"""\[source,python\]
|
||||
----
|
||||
# prototype
|
||||
def (?P<function>\w+)(?P<args>[^)]*)(?P<return>\) -> [^:]+:) \.\.\.\
|
||||
"""
|
||||
def (?P<function>\w+)(?P<args>[^)]*)(?P<return>\) -> [^:]+:) \.\.\."""
|
||||
|
||||
|
||||
def print_stub_constants() -> None:
|
||||
|
||||
Reference in New Issue
Block a user