mirror of
https://github.com/iluvcapra/ptulsconv.git
synced 2025-12-31 08:50:48 +00:00
Bugfixes/linted
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
import sys
|
||||
from collections import namedtuple
|
||||
from fractions import Fraction
|
||||
from typing import Iterator, Tuple, Callable, Generator, Dict, List
|
||||
@@ -72,9 +71,9 @@ class TagCompiler:
|
||||
def _marker_tags(self, at):
|
||||
retval = dict()
|
||||
applicable = [(m, t) for (m, t) in self.session.markers_timed() if t <= at]
|
||||
for marker, time in sorted(applicable, key=lambda x: x[1]):
|
||||
retval.update(parse_tags(marker.comments).tag_dict)
|
||||
retval.update(parse_tags(marker.name).tag_dict)
|
||||
for marker, _ in sorted(applicable, key=lambda x: x[1]):
|
||||
retval.update(parse_tags(marker.comments or "").tag_dict)
|
||||
retval.update(parse_tags(marker.name or "").tag_dict)
|
||||
|
||||
return retval
|
||||
|
||||
|
||||
@@ -28,14 +28,14 @@ tag_grammar = Grammar(
|
||||
)
|
||||
|
||||
|
||||
def parse_tags(prompt) -> "TaggedStringResult":
|
||||
def parse_tags(prompt: str) -> "TaggedStringResult":
|
||||
ast = tag_grammar.parse(prompt)
|
||||
return TagListVisitor().visit(ast)
|
||||
|
||||
|
||||
class TaggedStringResult:
|
||||
content: Optional[str]
|
||||
tag_dict: Optional[Dict[str, str]]
|
||||
content: str
|
||||
tag_dict: Dict[str, str]
|
||||
mode: TagPreModes
|
||||
|
||||
def __init__(self, content, tag_dict, mode):
|
||||
|
||||
Reference in New Issue
Block a user