Skip to content

Commit

Permalink
type fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
tedivm committed Dec 29, 2023
1 parent 6a0586c commit 0901ca8
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 11 deletions.
29 changes: 22 additions & 7 deletions paracelsus/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def get_graph_string(
) -> str:
# Update the PYTHON_PATH to allow more module imports.
for dir in python_dir:
sys.path.append(dir)
sys.path.append(str(dir))

# Import the base class so the metadata class can be extracted from it.
# The metadata class is passed to the transformer.
Expand Down Expand Up @@ -66,7 +66,10 @@ def get_graph_string(

@app.command(help="Create the graph structure and print it to stdout.")
def graph(
base_class_path: Annotated[str, typer.Argument(help="The SQLAlchemy base class used by the database to graph.")],
base_class_path: Annotated[
str,
typer.Argument(help="The SQLAlchemy base class used by the database to graph."),
],
import_module: Annotated[
List[str],
typer.Option(
Expand All @@ -89,7 +92,10 @@ def graph(
):
typer.echo(
get_graph_string(
base_class_path=base_class_path, import_module=import_module, python_dir=python_dir, format=format.value
base_class_path=base_class_path,
import_module=import_module,
python_dir=python_dir,
format=format.value,
)
)

Expand All @@ -106,7 +112,10 @@ def inject(
exists=True,
),
],
base_class_path: Annotated[str, typer.Argument(help="The SQLAlchemy base class used by the database to graph.")],
base_class_path: Annotated[
str,
typer.Argument(help="The SQLAlchemy base class used by the database to graph."),
],
replace_begin_tag: Annotated[
str,
typer.Option(help=""),
Expand Down Expand Up @@ -137,18 +146,24 @@ def inject(
check: Annotated[
bool,
typer.Option(
"--check", help="Perform a dry run and return a success code of 0 if there are no changes or 1 otherwise."
"--check",
help="Perform a dry run and return a success code of 0 if there are no changes or 1 otherwise.",
),
] = False,
):
# Generate Graph
graph = get_graph_string(
base_class_path=base_class_path, import_module=import_module, python_dir=python_dir, format=format.value
base_class_path=base_class_path,
import_module=import_module,
python_dir=python_dir,
format=format.value,
)

comment_format = transformers[format].comment_format # type: ignore

# Convert Graph to Injection String
graph_piece = f"""{replace_begin_tag}
```{transformers[format].comment_format}
```{comment_format}
{graph}
```
{replace_end_tag}"""
Expand Down
3 changes: 0 additions & 3 deletions paracelsus/settings.py

This file was deleted.

2 changes: 1 addition & 1 deletion paracelsus/transformers/dot.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import pydot
import pydot # type: ignore
from sqlalchemy.sql.schema import MetaData, Table

from . import utils
Expand Down

0 comments on commit 0901ca8

Please sign in to comment.