diff --git a/tools/code_processing/loader.py b/tools/code_processing/loader.py index aa1cde7..0683933 100644 --- a/tools/code_processing/loader.py +++ b/tools/code_processing/loader.py @@ -11,7 +11,7 @@ def indent_at(string, pos): if pos <= 0: return "" - newline_before = string.rfind('\n', 0, pos-1) + newline_before = string.rfind('\n', 0, pos - 1) if newline_before == -1: return "" diff --git a/tools/code_processing/python_to_ts.py b/tools/code_processing/python_to_ts.py index 5dd3cd9..557ff2d 100644 --- a/tools/code_processing/python_to_ts.py +++ b/tools/code_processing/python_to_ts.py @@ -1,10 +1,7 @@ import re -import os -import sys import ast import pprint import inspect -import argparse def snake_to_lower_camel(string): @@ -161,9 +158,6 @@ def delete_statement(self, targets): def type_alias(self, obj): raise NotImplementedError - def convert_name(self, name, annotation): - raise NotImplementedError - def expr_func(self, name, args): raise NotImplementedError @@ -258,6 +252,7 @@ def convert_ast(self, obj): pattern = None else: pattern = self.expression_to_string(obj.pattern) + self.begin_switch_case(pattern) with IndentationManager(self, False): self.convert_ast(obj.body) self.end_switch_case() @@ -558,4 +553,3 @@ def format_comment(self, value): def expression_statement(self, v): self.push_code(v + ";") - diff --git a/tools/lottie_markdown.py b/tools/lottie_markdown.py index 7e06077..d6f9667 100644 --- a/tools/lottie_markdown.py +++ b/tools/lottie_markdown.py @@ -1242,12 +1242,9 @@ def render_code(self, parent, index, language, code, selector): def render_pseudocode(self, parent, pseudo: str): pre = etree.SubElement(parent, "pre") for line in pseudo.splitlines(): - # stripped = line.lstrip() - # indent = line[0:len(line) - len(stripped)] - # etree.SubElement(pre, "span").text = indent - l = etree.SubElement(pre, "span") - l.text = line - l.tail = "\n" + span = etree.SubElement(pre, "span") + span.text = line + span.tail = "\n" class LottieExtension(Extension):