From 87985fd51e3ae1d7882b215e6988792a605ecd18 Mon Sep 17 00:00:00 2001 From: kompotkot Date: Tue, 28 May 2024 13:57:33 +0000 Subject: [PATCH] Black and isort fixes --- moonstreamdb-v3/moonstreamdbv3/models.py | 337 +++++++++--------- .../moonstreamdbv3/models_indexes.py | 15 +- 2 files changed, 174 insertions(+), 178 deletions(-) diff --git a/moonstreamdb-v3/moonstreamdbv3/models.py b/moonstreamdb-v3/moonstreamdbv3/models.py index 9503b0bd..e0612696 100644 --- a/moonstreamdb-v3/moonstreamdbv3/models.py +++ b/moonstreamdb-v3/moonstreamdbv3/models.py @@ -68,7 +68,6 @@ def pg_utcnow(element, compiler, **kwargs): class EvmBasedLabel(Base): # type: ignore __abstract__ = True - id = Column( UUID(as_uuid=True), primary_key=True, @@ -135,17 +134,17 @@ class EthereumLabel(EvmBasedLabel): # type: ignore unique=False, ), Index( - 'uk_ethereum_labels_tx_hash_tx_call', - 'transaction_hash', + "uk_ethereum_labels_tx_hash_tx_call", + "transaction_hash", unique=True, - postgresql_where=text("label='seer' and label_type='tx_call'") + postgresql_where=text("label='seer' and label_type='tx_call'"), ), Index( - 'uk_ethereum_labels_tx_hash_log_idx_evt', - 'transaction_hash', - 'log_index', + "uk_ethereum_labels_tx_hash_log_idx_evt", + "transaction_hash", + "log_index", unique=True, - postgresql_where=text("label='seer' and label_type='event'") + postgresql_where=text("label='seer' and label_type='event'"), ), ) @@ -167,19 +166,18 @@ class SepoliaLabel(EvmBasedLabel): # type: ignore unique=False, ), Index( - 'uk_sepolia_labels_tx_hash_tx_call', - 'transaction_hash', + "uk_sepolia_labels_tx_hash_tx_call", + "transaction_hash", unique=True, - postgresql_where=text("label='seer' and label_type='tx_call'") + postgresql_where=text("label='seer' and label_type='tx_call'"), ), Index( - 'uk_sepolia_labels_tx_hash_log_idx_evt', - 'transaction_hash', - 'log_index', + "uk_sepolia_labels_tx_hash_log_idx_evt", + "transaction_hash", + "log_index", unique=True, - postgresql_where=text("label='seer' and label_type='event'") - ) - + postgresql_where=text("label='seer' and label_type='event'"), + ), ) @@ -200,18 +198,18 @@ class PolygonLabel(EvmBasedLabel): # type: ignore unique=False, ), Index( - 'uk_polygon_labels_tx_hash_tx_call', - 'transaction_hash', + "uk_polygon_labels_tx_hash_tx_call", + "transaction_hash", unique=True, - postgresql_where=text("label='seer' and label_type='tx_call'") + postgresql_where=text("label='seer' and label_type='tx_call'"), ), Index( - 'uk_polygon_labels_tx_hash_log_idx_evt', - 'transaction_hash', - 'log_index', + "uk_polygon_labels_tx_hash_log_idx_evt", + "transaction_hash", + "log_index", unique=True, - postgresql_where=text("label='seer' and label_type='event'") - ) + postgresql_where=text("label='seer' and label_type='event'"), + ), ) @@ -232,18 +230,18 @@ class MumbaiLabel(EvmBasedLabel): # type: ignore unique=False, ), Index( - 'uk_mumbai_labels_tx_hash_tx_call', - 'transaction_hash', + "uk_mumbai_labels_tx_hash_tx_call", + "transaction_hash", unique=True, - postgresql_where=text("label='seer' and label_type='tx_call'") + postgresql_where=text("label='seer' and label_type='tx_call'"), ), Index( - 'uk_mumbai_labels_tx_hash_log_idx_evt', - 'transaction_hash', - 'log_index', + "uk_mumbai_labels_tx_hash_log_idx_evt", + "transaction_hash", + "log_index", unique=True, - postgresql_where=text("label='seer' and label_type='event'") - ) + postgresql_where=text("label='seer' and label_type='event'"), + ), ) @@ -264,18 +262,18 @@ class AmoyLabel(EvmBasedLabel): # type: ignore unique=False, ), Index( - 'uk_amoy_labels_tx_hash_tx_call', - 'transaction_hash', + "uk_amoy_labels_tx_hash_tx_call", + "transaction_hash", unique=True, - postgresql_where=text("label='seer' and label_type='tx_call'") + postgresql_where=text("label='seer' and label_type='tx_call'"), ), Index( - 'uk_amoy_labels_tx_hash_log_idx_evt', - 'transaction_hash', - 'log_index', + "uk_amoy_labels_tx_hash_log_idx_evt", + "transaction_hash", + "log_index", unique=True, - postgresql_where=text("label='seer' and label_type='event'") - ) + postgresql_where=text("label='seer' and label_type='event'"), + ), ) @@ -296,19 +294,18 @@ class XDaiLabel(EvmBasedLabel): # type: ignore unique=False, ), Index( - 'uk_xdai_labels_tx_hash_tx_call', - 'transaction_hash', + "uk_xdai_labels_tx_hash_tx_call", + "transaction_hash", unique=True, - postgresql_where=text("label='seer' and label_type='tx_call'") + postgresql_where=text("label='seer' and label_type='tx_call'"), ), Index( - 'uk_xdai_labels_tx_hash_log_idx_evt', - 'transaction_hash', - 'log_index', + "uk_xdai_labels_tx_hash_log_idx_evt", + "transaction_hash", + "log_index", unique=True, - postgresql_where=text("label='seer' and label_type='event'") - ) - + postgresql_where=text("label='seer' and label_type='event'"), + ), ) @@ -329,18 +326,18 @@ class ZkSyncEraLabel(EvmBasedLabel): # type: ignore unique=False, ), Index( - 'uk_zksync_era_labels_tx_hash_tx_call', - 'transaction_hash', + "uk_zksync_era_labels_tx_hash_tx_call", + "transaction_hash", unique=True, - postgresql_where=text("label='seer' and label_type='tx_call'") + postgresql_where=text("label='seer' and label_type='tx_call'"), ), Index( - 'uk_zksync_era_labels_tx_hash_log_idx_evt', - 'transaction_hash', - 'log_index', + "uk_zksync_era_labels_tx_hash_log_idx_evt", + "transaction_hash", + "log_index", unique=True, - postgresql_where=text("label='seer' and label_type='event'") - ) + postgresql_where=text("label='seer' and label_type='event'"), + ), ) @@ -361,18 +358,18 @@ class ZkSyncEraSepoliaLabel(EvmBasedLabel): # type: ignore unique=False, ), Index( - 'uk_zksync_era_sepolia_labels_tx_hash_tx_call', - 'transaction_hash', + "uk_zksync_era_sepolia_labels_tx_hash_tx_call", + "transaction_hash", unique=True, - postgresql_where=text("label='seer' and label_type='tx_call'") + postgresql_where=text("label='seer' and label_type='tx_call'"), ), Index( - 'uk_zksync_era_sepolia_labels_tx_hash_log_idx_evt', - 'transaction_hash', - 'log_index', + "uk_zksync_era_sepolia_labels_tx_hash_log_idx_evt", + "transaction_hash", + "log_index", unique=True, - postgresql_where=text("label='seer' and label_type='event'") - ) + postgresql_where=text("label='seer' and label_type='event'"), + ), ) @@ -393,18 +390,18 @@ class BaseLabel(EvmBasedLabel): # type: ignore unique=False, ), Index( - 'uk_base_labels_tx_hash_tx_call', - 'transaction_hash', + "uk_base_labels_tx_hash_tx_call", + "transaction_hash", unique=True, - postgresql_where=text("label='seer' and label_type='tx_call'") + postgresql_where=text("label='seer' and label_type='tx_call'"), ), Index( - 'uk_base_labels_tx_hash_log_idx_evt', - 'transaction_hash', - 'log_index', + "uk_base_labels_tx_hash_log_idx_evt", + "transaction_hash", + "log_index", unique=True, - postgresql_where=text("label='seer' and label_type='event'") - ) + postgresql_where=text("label='seer' and label_type='event'"), + ), ) @@ -425,18 +422,18 @@ class ArbitrumNovaLabel(EvmBasedLabel): # type: ignore unique=False, ), Index( - 'uk_arbitrum_nova_labels_tx_hash_tx_call', - 'transaction_hash', + "uk_arbitrum_nova_labels_tx_hash_tx_call", + "transaction_hash", unique=True, - postgresql_where=text("label='seer' and label_type='tx_call'") + postgresql_where=text("label='seer' and label_type='tx_call'"), ), Index( - 'uk_arbitrum_nova_labels_tx_hash_log_idx_evt', - 'transaction_hash', - 'log_index', + "uk_arbitrum_nova_labels_tx_hash_log_idx_evt", + "transaction_hash", + "log_index", unique=True, - postgresql_where=text("label='seer' and label_type='event'") - ) + postgresql_where=text("label='seer' and label_type='event'"), + ), ) @@ -457,18 +454,18 @@ class ArbitrumOneLabel(EvmBasedLabel): # type: ignore unique=False, ), Index( - 'uk_arbitrum_one_labels_tx_hash_tx_call', - 'transaction_hash', + "uk_arbitrum_one_labels_tx_hash_tx_call", + "transaction_hash", unique=True, - postgresql_where=text("label='seer' and label_type='tx_call'") + postgresql_where=text("label='seer' and label_type='tx_call'"), ), Index( - 'uk_arbitrum_one_labels_tx_hash_log_idx_evt', - 'transaction_hash', - 'log_index', + "uk_arbitrum_one_labels_tx_hash_log_idx_evt", + "transaction_hash", + "log_index", unique=True, - postgresql_where=text("label='seer' and label_type='event'") - ) + postgresql_where=text("label='seer' and label_type='event'"), + ), ) @@ -489,18 +486,18 @@ class ArbitrumSepoliaLabel(EvmBasedLabel): # type: ignore unique=False, ), Index( - 'uk_arbitrum_sepolia_labels_tx_hash_tx_call', - 'transaction_hash', + "uk_arbitrum_sepolia_labels_tx_hash_tx_call", + "transaction_hash", unique=True, - postgresql_where=text("label='seer' and label_type='tx_call'") + postgresql_where=text("label='seer' and label_type='tx_call'"), ), Index( - 'uk_arbitrum_sepolia_labels_tx_hash_log_idx_evt', - 'transaction_hash', - 'log_index', + "uk_arbitrum_sepolia_labels_tx_hash_log_idx_evt", + "transaction_hash", + "log_index", unique=True, - postgresql_where=text("label='seer' and label_type='event'") - ) + postgresql_where=text("label='seer' and label_type='event'"), + ), ) @@ -521,18 +518,18 @@ class XaiLabel(EvmBasedLabel): # type: ignore unique=False, ), Index( - 'uk_xai_labels_tx_hash_tx_call', - 'transaction_hash', + "uk_xai_labels_tx_hash_tx_call", + "transaction_hash", unique=True, - postgresql_where=text("label='seer' and label_type='tx_call'") + postgresql_where=text("label='seer' and label_type='tx_call'"), ), Index( - 'uk_xai_labels_tx_hash_log_idx_evt', - 'transaction_hash', - 'log_index', + "uk_xai_labels_tx_hash_log_idx_evt", + "transaction_hash", + "log_index", unique=True, - postgresql_where=text("label='seer' and label_type='event'") - ) + postgresql_where=text("label='seer' and label_type='event'"), + ), ) @@ -553,18 +550,18 @@ class XaiSepoliaLabel(EvmBasedLabel): # type: ignore unique=False, ), Index( - 'uk_xai_sepolia_labels_tx_hash_tx_call', - 'transaction_hash', + "uk_xai_sepolia_labels_tx_hash_tx_call", + "transaction_hash", unique=True, - postgresql_where=text("label='seer' and label_type='tx_call'") + postgresql_where=text("label='seer' and label_type='tx_call'"), ), Index( - 'uk_xai_sepolia_labels_tx_hash_log_idx_evt', - 'transaction_hash', - 'log_index', + "uk_xai_sepolia_labels_tx_hash_log_idx_evt", + "transaction_hash", + "log_index", unique=True, - postgresql_where=text("label='seer' and label_type='event'") - ) + postgresql_where=text("label='seer' and label_type='event'"), + ), ) @@ -585,18 +582,18 @@ class AvalancheLabel(EvmBasedLabel): # type: ignore unique=False, ), Index( - 'uk_avalanche_labels_tx_hash_tx_call', - 'transaction_hash', + "uk_avalanche_labels_tx_hash_tx_call", + "transaction_hash", unique=True, - postgresql_where=text("label='seer' and label_type='tx_call'") + postgresql_where=text("label='seer' and label_type='tx_call'"), ), Index( - 'uk_avalanche_labels_tx_hash_log_idx_evt', - 'transaction_hash', - 'log_index', + "uk_avalanche_labels_tx_hash_log_idx_evt", + "transaction_hash", + "log_index", unique=True, - postgresql_where=text("label='seer' and label_type='event'") - ) + postgresql_where=text("label='seer' and label_type='event'"), + ), ) @@ -617,18 +614,18 @@ class AvalancheFujiLabel(EvmBasedLabel): # type: ignore unique=False, ), Index( - 'uk_avalanche_fuji_labels_tx_hash_tx_call', - 'transaction_hash', + "uk_avalanche_fuji_labels_tx_hash_tx_call", + "transaction_hash", unique=True, - postgresql_where=text("label='seer' and label_type='tx_call'") + postgresql_where=text("label='seer' and label_type='tx_call'"), ), Index( - 'uk_avalanche_fuji_labels_tx_hash_log_idx_evt', - 'transaction_hash', - 'log_index', + "uk_avalanche_fuji_labels_tx_hash_log_idx_evt", + "transaction_hash", + "log_index", unique=True, - postgresql_where=text("label='seer' and label_type='event'") - ) + postgresql_where=text("label='seer' and label_type='event'"), + ), ) @@ -649,18 +646,18 @@ class BlastLabel(EvmBasedLabel): # type: ignore unique=False, ), Index( - 'uk_blast_labels_tx_hash_tx_call', - 'transaction_hash', + "uk_blast_labels_tx_hash_tx_call", + "transaction_hash", unique=True, - postgresql_where=text("label='seer' and label_type='tx_call'") + postgresql_where=text("label='seer' and label_type='tx_call'"), ), Index( - 'uk_blast_labels_tx_hash_log_idx_evt', - 'transaction_hash', - 'log_index', + "uk_blast_labels_tx_hash_log_idx_evt", + "transaction_hash", + "log_index", unique=True, - postgresql_where=text("label='seer' and label_type='event'") - ) + postgresql_where=text("label='seer' and label_type='event'"), + ), ) @@ -681,18 +678,18 @@ class BlastSepoliaLabel(EvmBasedLabel): # type: ignore unique=False, ), Index( - 'uk_blast_sepolia_labels_tx_hash_tx_call', - 'transaction_hash', + "uk_blast_sepolia_labels_tx_hash_tx_call", + "transaction_hash", unique=True, - postgresql_where=text("label='seer' and label_type='tx_call'") + postgresql_where=text("label='seer' and label_type='tx_call'"), ), Index( - 'uk_blast_sepolia_labels_tx_hash_log_idx_evt', - 'transaction_hash', - 'log_index', + "uk_blast_sepolia_labels_tx_hash_log_idx_evt", + "transaction_hash", + "log_index", unique=True, - postgresql_where=text("label='seer' and label_type='event'") - ) + postgresql_where=text("label='seer' and label_type='event'"), + ), ) @@ -713,18 +710,18 @@ class ProofOfPlayApexLabel(EvmBasedLabel): # type: ignore unique=False, ), Index( - 'uk_proofofplay_apex_labels_tx_hash_tx_call', - 'transaction_hash', + "uk_proofofplay_apex_labels_tx_hash_tx_call", + "transaction_hash", unique=True, - postgresql_where=text("label='seer' and label_type='tx_call'") + postgresql_where=text("label='seer' and label_type='tx_call'"), ), Index( - 'uk_proofofplay_apex_labels_tx_hash_log_idx_evt', - 'transaction_hash', - 'log_index', + "uk_proofofplay_apex_labels_tx_hash_log_idx_evt", + "transaction_hash", + "log_index", unique=True, - postgresql_where=text("label='seer' and label_type='event'") - ) + postgresql_where=text("label='seer' and label_type='event'"), + ), ) @@ -745,18 +742,18 @@ class StarknetLabel(EvmBasedLabel): # type: ignore unique=False, ), Index( - 'uk_starknet_labels_tx_hash_tx_call', - 'transaction_hash', + "uk_starknet_labels_tx_hash_tx_call", + "transaction_hash", unique=True, - postgresql_where=text("label='seer' and label_type='tx_call'") + postgresql_where=text("label='seer' and label_type='tx_call'"), ), Index( - 'uk_starknet_labels_tx_hash_log_idx_evt', - 'transaction_hash', - 'log_index', + "uk_starknet_labels_tx_hash_log_idx_evt", + "transaction_hash", + "log_index", unique=True, - postgresql_where=text("label='seer' and label_type='event'") - ) + postgresql_where=text("label='seer' and label_type='event'"), + ), ) @@ -777,16 +774,16 @@ class StarknetSepoliaLabel(EvmBasedLabel): # type: ignore unique=False, ), Index( - 'uk_starknet_sepolia_labels_tx_hash_tx_call', - 'transaction_hash', + "uk_starknet_sepolia_labels_tx_hash_tx_call", + "transaction_hash", unique=True, - postgresql_where=text("label='seer' and label_type='tx_call'") + postgresql_where=text("label='seer' and label_type='tx_call'"), ), Index( - 'uk_starknet_sepolia_labels_tx_hash_log_idx_evt', - 'transaction_hash', - 'log_index', + "uk_starknet_sepolia_labels_tx_hash_log_idx_evt", + "transaction_hash", + "log_index", unique=True, - postgresql_where=text("label='seer' and label_type='event'") - ) + postgresql_where=text("label='seer' and label_type='event'"), + ), ) diff --git a/moonstreamdb-v3/moonstreamdbv3/models_indexes.py b/moonstreamdb-v3/moonstreamdbv3/models_indexes.py index 6b3d8905..b1c87668 100644 --- a/moonstreamdb-v3/moonstreamdbv3/models_indexes.py +++ b/moonstreamdb-v3/moonstreamdbv3/models_indexes.py @@ -1,26 +1,25 @@ import uuid from sqlalchemy import ( - LargeBinary, VARCHAR, BigInteger, + Boolean, Column, DateTime, - Integer, - Index, - MetaData, - Text, - Boolean, - UniqueConstraint, ForeignKey, + Index, + Integer, + LargeBinary, + MetaData, PrimaryKeyConstraint, + Text, + UniqueConstraint, ) from sqlalchemy.dialects.postgresql import UUID from sqlalchemy.ext.compiler import compiles from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.sql import expression - """ Naming conventions doc https://docs.sqlalchemy.org/en/13/core/constraints.html#configuring-constraint-naming-conventions