dojo.common package

Common contains types for users to use in their own code.

Submodules

Logging routines.

class dojo.common.logger.Level

Bases: object

Log Levels.

CRITICAL = 50
DEBUG = 10
DOJO_DEBUG = 11
ERROR = 40
FULL = 0
INFO = 20
WARNING = 30
dojo.common.logger.log(level, msg, *args, **kwargs)

Log a message.

Parameters:
  • level – log level that the message should be recorded under

  • msg – the log message

dojo.common.logger.redirect_stdout_sterr(fn)

Suppress function from printing to sys.stdout.

dojo.common.logger.redirected_stdout_sterr()

Redirect stdout and stderr within the context to logger.

Yield:

None

Various type definitions used throughout the dojo package.

Generic utility functions such as datetime and search functions.

dojo.common.utils.div_round_up(numerator: int, denominator: int) int

Divide two integers and round up.

Parameters:
  • numerator – numerator

  • denominator – denominator

Returns:

rounded up quotient

dojo.common.utils.integerdiv(a: int, b: int, roundup: bool) int

Integerdiv with roundup as in UniswapV3Pool.

dojo.common.utils.round_to_nearest_n(x: float, n: int) int

Round a number to the nearest multiple of n.

Parameters:
  • x – number to round

  • n – multiple

Returns:

rounded number