Skip to content

Commit f83e94e

Browse files
committed
typing re
1 parent 34a578c commit f83e94e

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

src/nbdocs/process.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import re
22
import shutil
3+
import sys
34
from pathlib import Path
45
from typing import List, Optional, Set, Tuple
56

@@ -9,6 +10,13 @@
910

1011
from nbdocs.settings import NbDocsCfg
1112

13+
14+
if sys.version_info.minor < 9: # pragma: no cover
15+
from typing import Pattern
16+
rePattern = Pattern[str]
17+
else:
18+
rePattern = re.Pattern[str]
19+
1220
# Flags
1321
# Flag is starts with #, at start of the line, no more symbols at this line except whitespaces.
1422
HIDE = ["hide"] # hide cell
@@ -38,7 +46,7 @@ def generate_flags_string(flags: List[str]) -> str:
3846
return "|".join(result_flags)
3947

4048

41-
def get_flags_re(flags: List[str]) -> re.Pattern:
49+
def get_flags_re(flags: List[str]) -> rePattern:
4250
"""Create Regex pattern from list of flags.
4351
4452
Args:
@@ -74,7 +82,7 @@ def cell_check_flags(cell: NotebookNode) -> bool:
7482
return result
7583

7684

77-
def get_image_link_re(image_name: str = "") -> re.Pattern:
85+
def get_image_link_re(image_name: str = "") -> rePattern:
7886
"""Return regex pattern for image link with given name. If no name - any image link.
7987
8088
Args:

src/nbdocs/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "dev_0.2"
1+
__version__ = "0.2_dev"

0 commit comments

Comments
 (0)