diff --git a/bin/parallel_sync b/bin/parallel_sync index 47a9202a..2483dacf 100755 --- a/bin/parallel_sync +++ b/bin/parallel_sync @@ -409,7 +409,7 @@ def run_task( ), default="multiprocess_async", ) -def main(config: str, nprocs: int, mode: str, verbose: bool): +def main(config: str, nprocs: int, mode: str, verbose: bool) -> None: """ TODO: - Track progress across cpus/threads diff --git a/examples/airbnb/data.py b/examples/airbnb/data.py index 57bb6fd4..23bcac8d 100644 --- a/examples/airbnb/data.py +++ b/examples/airbnb/data.py @@ -17,7 +17,7 @@ help="Schema config", type=click.Path(exists=True), ) -def main(config): +def main(config: str) -> None: config: str = get_config(config) teardown(drop_db=False, config=config) doc: dict = next(config_loader(config)) diff --git a/examples/airbnb/schema.py b/examples/airbnb/schema.py index fb492718..0602542d 100644 --- a/examples/airbnb/schema.py +++ b/examples/airbnb/schema.py @@ -118,7 +118,7 @@ def setup(config: str) -> None: help="Schema config", type=click.Path(exists=True), ) -def main(config): +def main(config: str) -> None: config: str = get_config(config) teardown(config=config) setup(config) diff --git a/examples/ancestry/data.py b/examples/ancestry/data.py index f38683e8..e36c3ca7 100644 --- a/examples/ancestry/data.py +++ b/examples/ancestry/data.py @@ -14,7 +14,7 @@ help="Schema config", type=click.Path(exists=True), ) -def main(config): +def main(config: str) -> None: config: str = get_config(config) teardown(drop_db=False, config=config) doc: dict = next(config_loader(config)) diff --git a/examples/ancestry/schema.py b/examples/ancestry/schema.py index e4d348f1..d81ce65f 100644 --- a/examples/ancestry/schema.py +++ b/examples/ancestry/schema.py @@ -82,7 +82,7 @@ def setup(config: str) -> None: help="Schema config", type=click.Path(exists=True), ) -def main(config): +def main(config: str) -> None: config: str = get_config(config) teardown(config=config) setup(config) diff --git a/examples/book/benchmark.py b/examples/book/benchmark.py index 95109550..5568c424 100644 --- a/examples/book/benchmark.py +++ b/examples/book/benchmark.py @@ -134,7 +134,7 @@ def truncate_op(session: sessionmaker, model, nsize: int) -> None: case_sensitive=False, ), ) -def main(config, nsize, daemon, tg_op): +def main(config: str, nsize: int, daemon: bool, tg_op: str): show_settings() config: str = get_config(config) @@ -145,7 +145,7 @@ def main(config, nsize, daemon, tg_op): session = Session() model = Book - func = { + func: dict = { INSERT: insert_op, UPDATE: update_op, DELETE: delete_op, diff --git a/examples/book/data.py b/examples/book/data.py index 64264f98..1aad11c9 100644 --- a/examples/book/data.py +++ b/examples/book/data.py @@ -36,7 +36,7 @@ type=click.Path(exists=True), ) @click.option("--nsize", "-n", default=1, help="Number of dummy data samples") -def main(config, nsize): +def main(config: str, nsize: int): config: str = get_config(config) teardown(drop_db=False, config=config) diff --git a/examples/book/schema.py b/examples/book/schema.py index db47672a..79f383f8 100644 --- a/examples/book/schema.py +++ b/examples/book/schema.py @@ -259,7 +259,7 @@ def setup(config: str) -> None: help="Schema config", type=click.Path(exists=True), ) -def main(config): +def main(config: str) -> None: config: str = get_config(config) teardown(config=config) setup(config) diff --git a/examples/node/data.py b/examples/node/data.py index cb55fab4..fd6d474d 100644 --- a/examples/node/data.py +++ b/examples/node/data.py @@ -16,10 +16,10 @@ help="Schema config", type=click.Path(exists=True), ) -def main(config): +def main(config: str) -> None: config: str = get_config(config) teardown(drop_db=False, config=config) - doc = next(config_loader(config)) + doc: dict = next(config_loader(config)) database: str = doc.get("database", doc["index"]) with pg_engine(database) as engine: Session = sessionmaker(bind=engine, autoflush=True) diff --git a/examples/node/schema.py b/examples/node/schema.py index c21b753b..b869d3da 100644 --- a/examples/node/schema.py +++ b/examples/node/schema.py @@ -39,7 +39,7 @@ def setup(config: str) -> None: help="Schema config", type=click.Path(exists=True), ) -def main(config): +def main(config: str) -> None: config = get_config(config) teardown(config=config) setup(config) diff --git a/examples/quiz/data.py b/examples/quiz/data.py index 83ab4f67..e63af2cc 100644 --- a/examples/quiz/data.py +++ b/examples/quiz/data.py @@ -1,3 +1,5 @@ +import typing as t + import click from schema import Answer, Category, PossibleAnswer, Question, RealAnswer from sqlalchemy.orm import sessionmaker @@ -14,17 +16,17 @@ help="Schema config", type=click.Path(exists=True), ) -def main(config): +def main(config: str) -> None: config: str = get_config(config) teardown(drop_db=False, config=config) - doc = next(config_loader(config)) + doc: dict = next(config_loader(config)) database: str = doc.get("database", doc["index"]) with pg_engine(database) as engine: Session = sessionmaker(bind=engine, autoflush=True) session = Session() # Bootstrap - categories = [ + categories: t.List[Category] = [ Category( id=1, uid="c001", @@ -39,7 +41,7 @@ def main(config): with subtransactions(session): session.add_all(categories) - questions = [ + questions: t.List[Question] = [ Question( id=1, uid="q001", @@ -58,7 +60,7 @@ def main(config): with subtransactions(session): session.add_all(questions) - answers = [ + answers: t.List[Answer] = [ Answer(id=1, uid="a001", text="Red"), Answer(id=2, uid="a002", text="Yes"), Answer(id=3, uid="a003", text="Green"), @@ -67,7 +69,7 @@ def main(config): with subtransactions(session): session.add_all(answers) - possible_answers = [ + possible_answers: t.List[PossibleAnswer] = [ PossibleAnswer( question_id=1, question_uid="q001", @@ -96,7 +98,7 @@ def main(config): with subtransactions(session): session.add_all(possible_answers) - real_answers = [ + real_answers: t.List[RealAnswer] = [ RealAnswer( question_id=1, question_uid="q001", diff --git a/examples/quiz/schema.py b/examples/quiz/schema.py index 3aefb7c3..2ae5da13 100644 --- a/examples/quiz/schema.py +++ b/examples/quiz/schema.py @@ -122,7 +122,7 @@ def setup(config: str) -> None: help="Schema config", type=click.Path(exists=True), ) -def main(config): +def main(config: str) -> None: config: str = get_config(config) teardown(config=config) setup(config) diff --git a/examples/schemas/data.py b/examples/schemas/data.py index 61b770e6..1dbb2d8e 100644 --- a/examples/schemas/data.py +++ b/examples/schemas/data.py @@ -14,10 +14,10 @@ help="Schema config", type=click.Path(exists=True), ) -def main(config): +def main(config: str) -> None: config: str = get_config(config) teardown(drop_db=False, config=config) - doc = next(config_loader(config)) + doc: dict = next(config_loader(config)) database: str = doc.get("database", doc["index"]) with pg_engine(database) as engine: Session = sessionmaker(bind=engine, autoflush=True) diff --git a/examples/schemas/schema.py b/examples/schemas/schema.py index cde2551c..4f009edd 100644 --- a/examples/schemas/schema.py +++ b/examples/schemas/schema.py @@ -57,7 +57,7 @@ def setup(config: str) -> None: help="Schema config", type=click.Path(exists=True), ) -def main(config): +def main(config: str) -> None: config: str = get_config(config) teardown(config=config) setup(config) diff --git a/examples/social/data.py b/examples/social/data.py index 5f444bdf..a83616b5 100644 --- a/examples/social/data.py +++ b/examples/social/data.py @@ -1,3 +1,5 @@ +import typing as t + import click from schema import Comment, Post, PostComment, Tag, User, UserPost, UserTag from sqlalchemy.orm import sessionmaker @@ -14,7 +16,7 @@ help="Schema config", type=click.Path(exists=True), ) -def main(config): +def main(config: str) -> None: config: str = get_config(config) teardown(drop_db=False, config=config) doc: dict = next(config_loader(config)) @@ -24,7 +26,7 @@ def main(config): session = Session() # Bootstrap - users = [ + users: t.List[User] = [ User(name="Carla Ferreira Cardoso", age=19, gender="female"), User(name="Uwe Fuerst", age=58, gender="male"), User(name="Otitodilinna Chigolum", age=36, gender="male"), @@ -32,7 +34,7 @@ def main(config): with subtransactions(session): session.add_all(users) - posts = [ + posts: t.List[Post] = [ Post(slug="post_1", title="This is the first post"), Post(slug="post_2", title="This is the second post"), Post(slug="post_3", title="This is the third post"), @@ -40,7 +42,7 @@ def main(config): with subtransactions(session): session.add_all(posts) - comments = [ + comments: t.List[Comment] = [ Comment( title="Comment 1", content="This is a sample comment for comment 1", @@ -69,7 +71,7 @@ def main(config): with subtransactions(session): session.add_all(comments) - tags = [ + tags: t.List[Tag] = [ Tag(name="Economics"), Tag(name="Career"), Tag(name="Political"), @@ -86,7 +88,7 @@ def main(config): with subtransactions(session): session.add_all(tags) - user_posts = [ + user_posts: t.List[UserPost] = [ UserPost( user=users[0], post=posts[0], @@ -103,7 +105,7 @@ def main(config): with subtransactions(session): session.add_all(user_posts) - user_tags = [ + user_tags: t.List[UserTag] = [ UserTag( user=users[0], tag=tags[0], @@ -140,7 +142,7 @@ def main(config): with subtransactions(session): session.add_all(user_tags) - post_comments = [ + post_comments: t.List[PostComment] = [ PostComment( post=posts[0], comment=comments[0], diff --git a/examples/social/schema.py b/examples/social/schema.py index ecc82ea2..8589ad88 100644 --- a/examples/social/schema.py +++ b/examples/social/schema.py @@ -109,7 +109,7 @@ def setup(config: str) -> None: help="Schema config", type=click.Path(exists=True), ) -def main(config): +def main(config: str) -> None: config: str = get_config(config) teardown(config=config) setup(config) diff --git a/examples/starcraft/data.py b/examples/starcraft/data.py index bf86a75a..d17d2092 100644 --- a/examples/starcraft/data.py +++ b/examples/starcraft/data.py @@ -1,3 +1,5 @@ +import typing as t + import click from schema import Specie, Structure, Unit from sqlalchemy.orm import sessionmaker @@ -14,7 +16,7 @@ help="Schema config", type=click.Path(exists=True), ) -def main(config): +def main(config: str) -> None: config: str = get_config(config) teardown(drop_db=False, config=config) doc = next(config_loader(config)) @@ -23,7 +25,7 @@ def main(config): Session = sessionmaker(bind=engine, autoflush=True) session = Session() - species = [ + species: t.List[Specie] = [ Specie(id=1, name="Protos"), Specie(id=2, name="Zerg"), Specie(id=3, name="Terran"), @@ -31,7 +33,7 @@ def main(config): with subtransactions(session): session.add_all(species) - units = [ + units: t.List[Unit] = [ Unit( name="Archon", details="Created by merging two templar units, the archon is a powerful melee unit with a very durable force shield and a strong energy-based attack.", @@ -81,7 +83,7 @@ def main(config): with subtransactions(session): session.add_all(units) - structures = [ + structures: t.List[Structure] = [ Structure( name="Assimilator", details="Allows probes to harvest vespene gas from geysers.", diff --git a/examples/starcraft/schema.py b/examples/starcraft/schema.py index 5a45bfb8..4c14ce4f 100644 --- a/examples/starcraft/schema.py +++ b/examples/starcraft/schema.py @@ -64,7 +64,7 @@ def setup(config: str) -> None: help="Schema config", type=click.Path(exists=True), ) -def main(config): +def main(config: str) -> None: config: str = get_config(config) teardown(config=config) setup(config) diff --git a/examples/through/data.py b/examples/through/data.py index e8e3784c..07140932 100644 --- a/examples/through/data.py +++ b/examples/through/data.py @@ -1,3 +1,5 @@ +import typing as t + import click from schema import Customer, CustomerGroup, Group from sqlalchemy.orm import sessionmaker @@ -15,7 +17,7 @@ help="Schema config", type=click.Path(exists=True), ) -def main(config): +def main(config: str) -> None: config: str = get_config(config) teardown(drop_db=False, config=config) @@ -29,7 +31,7 @@ def main(config): Session = sessionmaker(bind=connection, autoflush=True) session = Session() - customers = [ + customers: t.List[Customer] = [ Customer(name="CustomerA"), Customer(name="CustomerB"), Customer(name="CustomerC"), @@ -37,7 +39,7 @@ def main(config): with subtransactions(session): session.add_all(customers) - groups = [ + groups: t.List[Group] = [ Group(group_name="GroupA"), Group(group_name="GroupB"), Group(group_name="GroupC"), @@ -45,7 +47,7 @@ def main(config): with subtransactions(session): session.add_all(groups) - customers_groups = [ + customers_groups: t.List[CustomerGroup] = [ CustomerGroup(customer=customers[0], group=groups[0]), CustomerGroup(customer=customers[1], group=groups[1]), CustomerGroup(customer=customers[2], group=groups[2]), diff --git a/examples/through/schema.py b/examples/through/schema.py index 238cbdea..8b4a8f38 100644 --- a/examples/through/schema.py +++ b/examples/through/schema.py @@ -83,7 +83,7 @@ def setup(config: str) -> None: help="Schema config", type=click.Path(exists=True), ) -def main(config): +def main(config: str) -> None: config: str = get_config(config) teardown(config=config) setup(config) diff --git a/plugins/openai_plugin.py b/plugins/openai_plugin.py index f322138f..4961200b 100644 --- a/plugins/openai_plugin.py +++ b/plugins/openai_plugin.py @@ -17,7 +17,7 @@ def __init__(self) -> None: self.client: OpenAI = OpenAI() self.model: str = "text-embedding-3-small" # vector dims must match models input dims - self.vector_dims = 1536 + self.vector_dims: int = 1536 name: str = "TextEmbedding3Small" diff --git a/plugins/sentence_transformer_plugin.py b/plugins/sentence_transformer_plugin.py index 28be3bdd..90ac5a8d 100644 --- a/plugins/sentence_transformer_plugin.py +++ b/plugins/sentence_transformer_plugin.py @@ -18,7 +18,7 @@ def __init__(self) -> None: "all-MiniLM-L6-v2" ) # vector dims must match models input dims - self.vector_dims = 1536 + self.vector_dims: int = 1536 name: str = "SentenceTransformer"