Showing 9 of 39 total issues
File application.py
has 455 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""Contains functions which are needed to run the runner script, but nowhere else."""
from __future__ import annotations
from argparse import ArgumentParser, Namespace
- Create a ticketCreate a ticket
Market
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
class Market(DictDeserializable):
"""Represent a market and its corresponding rules.
Events
------
- Create a ticketCreate a ticket
Function _explain_specific
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def _explain_specific(self, market: Market, indent: int = 0, sig_figs: int = 4) -> str:
f_val = parallel(self._value, market)
warn("Using a default specific explanation. This probably isn't what you want!")
ret = self.explain_abstract(indent=indent).rstrip('\n')
ret += " (-> "
- Read upRead up
- Create a ticketCreate a ticket
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 __format_resolve_to
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def __format_resolve_to(self, sig_figs: int) -> str:
val = self.resolve_to()
if val == "CANCEL":
ret = "CANCEL"
elif isinstance(val, bool) or self.market.outcomeType == Outcome.BINARY:
- Read upRead up
- Create a ticketCreate a ticket
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 date_deserialization_hook
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def date_deserialization_hook(json_dict):
"""JSON deserializer for datetime objects."""
for key, value in json_dict.items():
if isinstance(value, str):
if match(r'^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}$', value):
- Read upRead up
- Create a ticketCreate a ticket
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 __post_init__
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def __post_init__(self):
if not self.manifold.description.get("processed"):
explanation = "\n" + explain_abstract(
time_rules=self.time_rules, value_rules=self.value_rules
)
- Read upRead up
- Create a ticketCreate a ticket
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 from_env
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def from_env() -> 'Account':
"""Try to infer an account from environment variables."""
kwargs = {}
for f in fields(Account):
if f.init:
- Read upRead up
- Create a ticketCreate a ticket
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 resolve
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def resolve(self, override: Optional[AnyResolution] = None) -> Response:
"""Resolve this market according to our resolution rules.
Returns
-------
- Read upRead up
- Create a ticketCreate a ticket
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 _binary_value
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _binary_value(self, market: Market, mkt: APIMarket | None = None) -> float:
if mkt is None:
mkt = self.api_market(market=market)
if mkt.resolution == "YES":
- Read upRead up
- Create a ticketCreate a ticket
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"