reogranized imports

This commit is contained in:
Louis Heredero 2024-03-24 11:33:34 +01:00
parent dd2ffebca2
commit 5a4d30e162
9 changed files with 25 additions and 8 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
__pycache__
*.jpg
*.png

View File

@ -1,6 +1,7 @@
import json
import re
class Config:
DEFAULT_FONT_FAMILY = "Ubuntu Mono"
DEFAULT_FONT_SIZE = 16

View File

@ -3,6 +3,7 @@ import os
from schema import InstructionSetSchema
description = """Examples:
- Default theme (black on white):
python main.py schema.xml -o out.jpg
@ -17,6 +18,7 @@ description = """Examples:
python main.py schema.xml -o out.png -c transparent.json
"""
if __name__ == "__main__":
parser = argparse.ArgumentParser(description=description, formatter_class=argparse.RawTextHelpFormatter)
parser.add_argument("schema", help="Path to the schema description. Accepted formats are: YAML, JSON and XML")

View File

@ -1,6 +1,8 @@
from __future__ import annotations
from typing import Union
class Range:
def __init__(self,
start: int,

View File

@ -1,16 +1,19 @@
from __future__ import annotations
import os
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from config import Config
from range import Range
from schema import InstructionSetSchema
import pygame
from structure import Structure
from vec import Vec
if TYPE_CHECKING:
from config import Config
from range import Range
from schema import InstructionSetSchema
class Renderer:
WIDTH = 1200
HEIGHT = 800
@ -45,8 +48,7 @@ class Renderer:
def drawStructure(self,
struct: Structure,
structures: dict[str,
Structure],
structures: dict[str, Structure],
ox: float = 0,
oy: float = 0) -> float:

View File

@ -1,5 +1,6 @@
import json
import os
import yaml
from config import Config
@ -7,9 +8,11 @@ from renderer import Renderer
from structure import Structure
from xml_loader import XMLLoader
class UnsupportedFormatException(Exception):
...
class InstructionSetSchema:
VALID_EXTENSIONS = ("yaml", "json", "xml")

View File

@ -1,6 +1,8 @@
from __future__ import annotations
from range import Range
class Structure:
def __init__(self,
name: str,

2
vec.py
View File

@ -1,6 +1,8 @@
from __future__ import annotations
from math import sqrt
class Vec:
def __init__(self, x: float = 0, y: float = 0) -> None:
self.x = x

View File

@ -1,7 +1,9 @@
from __future__ import annotations
from bs4 import BeautifulSoup
from typing import TYPE_CHECKING
from bs4 import BeautifulSoup
if TYPE_CHECKING:
from io import TextIOWrapper