diff --git a/src/dipdup/dipdup.py b/src/dipdup/dipdup.py index 4c576363b..280b26227 100644 --- a/src/dipdup/dipdup.py +++ b/src/dipdup/dipdup.py @@ -2,8 +2,8 @@ import hashlib import logging from contextlib import suppress +from os import listdir from os.path import join -from posix import listdir from typing import Dict, List, Optional, cast from apscheduler.schedulers import SchedulerNotRunningError # type: ignore diff --git a/src/dipdup/exceptions.py b/src/dipdup/exceptions.py index da1d7e801..ec1e9f407 100644 --- a/src/dipdup/exceptions.py +++ b/src/dipdup/exceptions.py @@ -1,7 +1,7 @@ import traceback from abc import ABC, abstractmethod -from typing import Optional, Type, Any from pprint import pformat +from typing import Any, Optional, Type from tabulate import tabulate @@ -144,7 +144,7 @@ def format_help(self) -> str: class InvalidDataError(DipDupError): """Failed to validate operation/big_map data against a generated type class""" - def __init__(self, data: Any, type_cls: Type, error_context : Optional[Any] = None) -> None: + def __init__(self, data: Any, type_cls: Type, error_context: Optional[Any] = None) -> None: super().__init__(None) self.data = data self.type_name = type_cls.__name__ @@ -154,5 +154,5 @@ def format_help(self) -> str: return _data_validation_error.format( invalid_data=pformat(self.data, compact=True), type_name=self.type_name, - error_context=pformat(self.error_context, compact=True) + error_context=pformat(self.error_context, compact=True), ) diff --git a/src/dipdup/index.py b/src/dipdup/index.py index 1bdee86ca..9294b4f93 100644 --- a/src/dipdup/index.py +++ b/src/dipdup/index.py @@ -3,6 +3,7 @@ from collections import defaultdict, deque, namedtuple from contextlib import suppress from typing import Deque, Dict, List, Optional, Set, Tuple, Union, cast + from pydantic.error_wrappers import ValidationError from dipdup.config import ( @@ -19,9 +20,9 @@ ) from dipdup.context import DipDupContext, HandlerContext from dipdup.datasources.tzkt.datasource import BigMapFetcher, OperationFetcher, TzktDatasource +from dipdup.exceptions import InvalidDataError from dipdup.models import BigMapData, BigMapDiff, HeadBlockData, OperationData, Origination, State, TemporaryState, Transaction from dipdup.utils import FormattedLogger, in_global_transaction -from dipdup.exceptions import InvalidDataError # NOTE: Operations of a single contract call OperationSubgroup = namedtuple('OperationSubgroup', ('hash', 'counter')) @@ -300,7 +301,7 @@ async def _on_match( error_context = dict( hash=operation.hash, counter=operation.counter, - nonce=operation.nonce + nonce=operation.nonce, ) raise InvalidDataError(operation.parameter_json, parameter_type, error_context) from e