fix: update imports
All checks were successful
Continuous Integration / Lint, Check & Test (push) Successful in 55s
All checks were successful
Continuous Integration / Lint, Check & Test (push) Successful in 55s
This commit is contained in:
parent
e9f3521ceb
commit
6c084a6b7d
1 changed files with 15 additions and 9 deletions
|
|
@ -1,12 +1,18 @@
|
||||||
from typing import Optional
|
|
||||||
from mistletoe import Document
|
|
||||||
from mistletoe.block_token import Paragraph, BlockToken, Heading, List, ListItem
|
|
||||||
from collections import Counter
|
from collections import Counter
|
||||||
|
|
||||||
from .markdown_tag import TagMarkdownRenderer
|
from mistletoe.block_token import (
|
||||||
|
BlockToken,
|
||||||
|
Document,
|
||||||
|
Heading,
|
||||||
|
List,
|
||||||
|
ListItem,
|
||||||
|
Paragraph,
|
||||||
|
)
|
||||||
|
|
||||||
from .extract_tag import extract_markers_and_tags, has_markers
|
from .extract_tag import extract_markers_and_tags, has_markers
|
||||||
from .shard import Shard, StreamFile
|
|
||||||
from .list import split_at
|
from .list import split_at
|
||||||
|
from .markdown_tag import TagMarkdownRenderer
|
||||||
|
from .shard import Shard, StreamFile
|
||||||
|
|
||||||
|
|
||||||
def get_line_number(block_token: BlockToken) -> int:
|
def get_line_number(block_token: BlockToken) -> int:
|
||||||
|
|
@ -71,7 +77,7 @@ def find_headings_by_level(
|
||||||
|
|
||||||
def calculate_heading_level_for_next_split(
|
def calculate_heading_level_for_next_split(
|
||||||
block_tokens: list[BlockToken],
|
block_tokens: list[BlockToken],
|
||||||
) -> Optional[int]:
|
) -> int | None:
|
||||||
"""
|
"""
|
||||||
If there is no marker in any heading, then return None.
|
If there is no marker in any heading, then return None.
|
||||||
If only the first token is a heading with a marker, then return None.
|
If only the first token is a heading with a marker, then return None.
|
||||||
|
|
@ -98,7 +104,7 @@ def calculate_heading_level_for_next_split(
|
||||||
|
|
||||||
def parse_single_block_shards(
|
def parse_single_block_shards(
|
||||||
block_token: BlockToken, start_line: int, end_line: int
|
block_token: BlockToken, start_line: int, end_line: int
|
||||||
) -> tuple[Optional[Shard], list[str]]:
|
) -> tuple[Shard | None, list[str]]:
|
||||||
markers, tags, children = [], [], []
|
markers, tags, children = [], [], []
|
||||||
|
|
||||||
if isinstance(block_token, List):
|
if isinstance(block_token, List):
|
||||||
|
|
@ -137,7 +143,7 @@ def parse_multiple_block_shards(
|
||||||
start_line: int,
|
start_line: int,
|
||||||
end_line: int,
|
end_line: int,
|
||||||
enforce_shard: bool = False,
|
enforce_shard: bool = False,
|
||||||
) -> tuple[Optional[Shard], list[str]]:
|
) -> tuple[Shard | None, list[str]]:
|
||||||
is_first_block_heading = isinstance(block_tokens[0], Heading) and has_markers(
|
is_first_block_heading = isinstance(block_tokens[0], Heading) and has_markers(
|
||||||
block_tokens[0]
|
block_tokens[0]
|
||||||
)
|
)
|
||||||
|
|
@ -180,7 +186,7 @@ def parse_header_shards(
|
||||||
start_line: int,
|
start_line: int,
|
||||||
end_line: int,
|
end_line: int,
|
||||||
use_first_child_as_header: bool = False,
|
use_first_child_as_header: bool = False,
|
||||||
) -> Optional[Shard]:
|
) -> Shard | None:
|
||||||
if len(block_tokens) == 0:
|
if len(block_tokens) == 0:
|
||||||
return build_shard(start_line, end_line)
|
return build_shard(start_line, end_line)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue