From 088e6b647c01f89beb2f7aa4946dff3a3080d409 Mon Sep 17 00:00:00 2001 From: Jaipal Reddy Kasturi Date: Mon, 14 Aug 2023 11:34:35 +0530 Subject: [PATCH] Adding ignoring statements for newer version of pyright --- snowfakery/salesforce.py | 8 ++++---- snowfakery/tools/mkdocs.py | 2 +- snowfakery/tools/snowbench.py | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/snowfakery/salesforce.py b/snowfakery/salesforce.py index ffd419cc..639397e8 100644 --- a/snowfakery/salesforce.py +++ b/snowfakery/salesforce.py @@ -11,8 +11,8 @@ def create_cci_record_type_tables(db_url: str): engine = create_engine(db_url) metadata = MetaData() metadata.reflect(views=True, bind=engine) - with engine.connect() as connection, connection.begin(): - for tablename, table in list(metadata.tables.items()): + with engine.connect() as connection, connection.begin(): # type: ignore + for tablename, table in list(metadata.tables.items()): # type: ignore record_type_column = find_record_type_column( tablename, table.columns.keys() ) @@ -37,12 +37,12 @@ def _populate_rt_table( ): column = getattr(table.columns, columnname) query_res = connection.execute(select(column).where(column is not None).distinct()) - record_types = [res[0] for res in query_res if res[0]] + record_types = [res[0] for res in query_res if res[0]] # type: ignore if record_types: insert_stmt = rt_table.insert() rows = [ - dict(zip(rt_table.columns.keys(), (rtname, rtname))) + dict(zip(rt_table.columns.keys(), (rtname, rtname))) # type: ignore for rtname in record_types ] diff --git a/snowfakery/tools/mkdocs.py b/snowfakery/tools/mkdocs.py index fd7edea2..a82ac31f 100644 --- a/snowfakery/tools/mkdocs.py +++ b/snowfakery/tools/mkdocs.py @@ -9,7 +9,7 @@ class Plugin(BasePlugin): config_scheme = ( - ("build_locales", mkdocs.config.config_options.Type(bool, default=False)), + ("build_locales", mkdocs.config.config_options.Type(bool, default=False)), # type: ignore ) def on_config(self, config): diff --git a/snowfakery/tools/snowbench.py b/snowfakery/tools/snowbench.py index e720fda8..0c5fb762 100644 --- a/snowfakery/tools/snowbench.py +++ b/snowfakery/tools/snowbench.py @@ -129,7 +129,7 @@ def status(tempdir, num_records, num_records_tablename, progress_bar): start = time() sleep(2) previous_count = 0 - for i in range(1, 10 ** 20): + for i in range(1, 10**20): sleep(1) if i in (2, 5, 10, 20, 30, 45, 90, 150) or (i % 60 == 0): print() @@ -163,7 +163,7 @@ def count_database(filename, counts): dburl = f"sqlite:///{filename}?mode=ro" engine = create_engine(dburl) insp = inspect(engine) - tables = insp.get_table_names() + tables = insp.get_table_names() # type: ignore for table in tables: counts[table] += count_table(engine, table) return counts