Skip to content

Commit

Permalink
Some linting fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
gnattishness committed Sep 9, 2021
1 parent a46e948 commit 5101c60
Showing 1 changed file with 15 additions and 18 deletions.
33 changes: 15 additions & 18 deletions rotkehlchen/exchanges/btcmarkets.py
@@ -1,14 +1,12 @@
import base64
import hashlib
from http import HTTPStatus
import hmac
import itertools
import json
import logging # lgtm [py/import-and-import-from] # https://github.com/github/codeql/issues/6088
import time
from collections import OrderedDict
from json.decoder import JSONDecodeError
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, Union
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple

import gevent
import requests
Expand Down Expand Up @@ -36,19 +34,15 @@
deserialize_asset_movement_category,
deserialize_timestamp_from_date,
deserialize_fee,
deserialize_int_from_str
deserialize_int_from_str,
)
from rotkehlchen.typing import (
ApiKey,
ApiSecret,
AssetAmount,
AssetMovementCategory,
Fee,
Timestamp,
TradeType,
)
from rotkehlchen.user_messages import MessagesAggregator
from rotkehlchen.utils.misc import timestamp_to_iso8601

if TYPE_CHECKING:
from rotkehlchen.db.dbhandler import DBHandler
Expand Down Expand Up @@ -119,8 +113,8 @@ def _asset_movement_from_btcmarkets(raw_tx: Dict) -> Optional[AssetMovement]:
transaction_id = raw_tx["paymentDetail"].get("txId")
address = raw_tx["paymentDetail"].get("address")
else:
transaction_id=None
address=None
transaction_id = None
address = None

# NOTE: could also use "creationTime" field, but that's when the withdrawal may have started
# which may be different to when it became "complete"
Expand All @@ -143,9 +137,9 @@ def _asset_movement_from_btcmarkets(raw_tx: Dict) -> Optional[AssetMovement]:
timestamp=timestamp,
asset=asset,
amount=amount,
fee_asset=asset, # Fee is taken in the same asset
fee_asset=asset, # Fee is taken in the same asset
fee=fee,
link=raw_tx["id"]
link=raw_tx["id"],
)


Expand Down Expand Up @@ -186,7 +180,7 @@ def __init__(
self.api_version = "v3"
self.msg_aggregator = msg_aggregator
self.session.headers.update(
{"Content-Type": "application/json", "BM-AUTH-APIKEY": api_key}
{"Content-Type": "application/json", "BM-AUTH-APIKEY": api_key},
)

def first_connection(self) -> None:
Expand Down Expand Up @@ -371,12 +365,15 @@ def _gather_paginated_data(
# TODO what should I do when this is called on an endpoint that doesn't support pagination?
# - get single page and warn? or raise error
# - either programmer error or the API changed
# TODO could also specify a persistent limit across queries (e.g. if we only want to get the first 205 values)
# TODO could also specify a persistent limit across queries
# (e.g. if we only want to get the first 205 values)
# forward or back directions?
# TODO "stop_when" callable? evaluated on each result?
# when would you want to page forward?
if page_size > MAX_LIMIT_PER_PAGE:
raise ValueError(f'Requested page_size {page_size} greater than MAX_LIMIT_PER_PAGE {MAX_LIMIT_PER_PAGE}')
raise ValueError(
f'Requested page_size {page_size} greater than MAX_LIMIT_PER_PAGE {MAX_LIMIT_PER_PAGE}'
)
data_pages = []
# TODO do both before & after get returned?
# or is it always one or the other?
Expand All @@ -388,8 +385,8 @@ def _gather_paginated_data(
if last_before is not None:
call_params["before"] = last_before
## I think this breaks, can't have both before and after
#if last_after is not None:
# call_params["after"] = last_after
# if last_after is not None:
# call_params["after"] = last_after
# Nicer name for ret_data!!
(ret_data, response) = self._api_query(
verb=verb,
Expand Down Expand Up @@ -466,7 +463,7 @@ def query_online_deposits_withdrawals(
movements = []
try:
resp = self._gather_paginated_data(
verb="GET",
verb="GET",
endpoint="transfers",
)
except KeyError as e:
Expand Down

0 comments on commit 5101c60

Please sign in to comment.