Showing 82 of 136 total issues
Consider simplifying this complex logical expression. Open
if len(args) == 1 and isinstance(args[0], str) and not base and not quote:
import re
price, assets = args[0].split(" ")
base_symbol, quote_symbol = assets_from_string(assets)
Consider simplifying this complex logical expression. Open
if len(args) == 1 and isinstance(args[0], str) and not base and not quote:
import re
price, assets = args[0].split(" ")
base_symbol, quote_symbol = assets_from_string(assets)
File transactionbuilder.py
has 453 lines of code (exceeds 250 allowed). Consider refactoring. Open
# -*- coding: utf-8 -*-
import struct
import logging
from datetime import datetime, timedelta
from binascii import unhexlify
File price.py
has 406 lines of code (exceeds 250 allowed). Consider refactoring. Open
# -*- coding: utf-8 -*-
from fractions import Fraction
from .exceptions import InvalidAssetException
from .utils import assets_from_string, formatTimeString, parse_time
from .instance import AbstractBlockchainInstanceProvider
File account.py
has 382 lines of code (exceeds 250 allowed). Consider refactoring. Open
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import hashlib
import re
File ripemd160.py
has 369 lines of code (exceeds 250 allowed). Consider refactoring. Open
# -*- coding: utf-8 -*-
# Copyright (c) 2021 Pieter Wuille
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
Consider simplifying this complex logical expression. Open
if len(args) == 1 and isinstance(args[0], Amount):
# Copy Asset object
self["amount"] = args[0]["amount"]
self["symbol"] = args[0]["symbol"]
self["asset"] = args[0]["asset"]
Consider simplifying this complex logical expression. Open
if len(args) == 1 and isinstance(args[0], Amount):
# Copy Asset object
self["amount"] = args[0]["amount"]
self["symbol"] = args[0]["symbol"]
self["asset"] = args[0]["asset"]
Function sign_message
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
def sign_message(message, wif, hashfn=hashlib.sha256):
"""Sign a digest with a wif key
:param str wif: Private key in
"""
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Amount
has 31 functions (exceeds 20 allowed). Consider refactoring. Open
class Amount(dict, AbstractBlockchainInstanceProvider):
"""This class deals with Amounts of any asset to simplify dealing with the tuple::
(amount, asset)
Function __init__
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def __init__(
self,
*args,
base=None,
quote=None,
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Wallet
has 30 functions (exceeds 20 allowed). Consider refactoring. Open
class Wallet(AbstractBlockchainInstanceProvider):
"""The wallet is meant to maintain access to private keys for
your accounts. It either uses manually provided private keys
or uses a SQLite database managed by storage.py.
TransactionBuilder
has 29 functions (exceeds 20 allowed). Consider refactoring. Open
class TransactionBuilder(dict, AbstractBlockchainInstanceProvider):
"""This class simplifies the creation of transactions by adding
operations and signers.
"""
File transactionbuilder.py
has 306 lines of code (exceeds 250 allowed). Consider refactoring. Open
# -*- coding: utf-8 -*-
import struct
import logging
from binascii import unhexlify
from ..exceptions import (
File types.py
has 301 lines of code (exceeds 250 allowed). Consider refactoring. Open
# -*- coding: utf-8 -*-
import json
import struct
import time
from calendar import timegm
Function history
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def history(self, first=0, last=0, limit=-1, only_ops=[], exclude_ops=[]):
"""Returns a generator for individual account transactions. The
latest operation will be first. This call can be used in a
``for`` loop.
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function recoverPubkeyParameter
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def recoverPubkeyParameter(message, digest, signature, pubkey):
"""Use to derive a number that allows to easily recover the
public key from the signature
"""
if not isinstance(message, bytes):
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
File message.py
has 281 lines of code (exceeds 250 allowed). Consider refactoring. Open
# -*- coding: utf-8 -*-
import json
import logging
import re
File amount.py
has 275 lines of code (exceeds 250 allowed). Consider refactoring. Open
# -*- coding: utf-8 -*-
from .asset import Asset
from .instance import AbstractBlockchainInstanceProvider
Function __init__
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self, data, klass=None, lazy=False, use_cache=True, *args, **kwargs):
Caching.__init__(self, *args, **kwargs)
self._use_cache = use_cache
if self.perform_id_tests:
assert self.type_id or self.type_ids, "Need type_id or type_ids"
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"