Skip to content

Commit e1b585b

Browse files
committed
update regular_expression docs
1 parent b121cac commit e1b585b

File tree

3 files changed

+150
-169
lines changed

3 files changed

+150
-169
lines changed

pyformlang/regular_expression/python_regex.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
"""
2-
A class to read Python format regex
3-
"""
1+
"""A class to read Python format regex."""
42

53
from typing import List, Tuple, Union, Pattern
64
from re import compile as compile_regex
@@ -56,7 +54,7 @@
5654

5755

5856
class PythonRegex(Regex):
59-
""" Represents a regular expression as used in Python.
57+
r"""Represents a regular expression as used in Python.
6058
6159
It adds the following features to the basic regex:
6260
@@ -70,9 +68,9 @@ class PythonRegex(Regex):
7068
7169
Parameters
7270
----------
73-
python_regex : Union[str, Pattern[str]]
74-
The regex represented as a string or a compiled regex (
75-
re.compile(...))
71+
python_regex:
72+
The regex represented as a string or a compiled regex
73+
(re.compile(...)).
7674
7775
Raises
7876
------
@@ -95,10 +93,10 @@ class PythonRegex(Regex):
9593
True
9694
>>> p_regex.accepts(["d"])
9795
False
98-
9996
"""
10097

10198
def __init__(self, python_regex: Union[str, Pattern[str]]) -> None:
99+
"""Initializes the regex in python format."""
102100
if isinstance(python_regex, str):
103101
compile_regex(python_regex) # Check if it is valid
104102
else:

0 commit comments

Comments
 (0)