Skip to content

Commit

Permalink
Remove posix import (#95)
Browse files Browse the repository at this point in the history
  • Loading branch information
droserasprout authored Jul 14, 2021
1 parent 7a38125 commit f99c269
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/dipdup/dipdup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/dipdup/exceptions.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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__
Expand All @@ -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),
)
5 changes: 3 additions & 2 deletions src/dipdup/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand All @@ -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'))
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit f99c269

Please sign in to comment.