Skip to content

Commit

Permalink
Add docstrings for constants/enums
Browse files Browse the repository at this point in the history
  • Loading branch information
chanhosuh committed Oct 31, 2023
1 parent 1b2381f commit 605455c
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions curvesim/constants.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
"""
Constants and Enum types used in Curvesim.
"""
from enum import Enum


class StrEnum(str, Enum):
"""
Custom string enum type since the builtin `StrEnum` is not available
until Python 3.11.
"""

def __str__(self):
"""
Regular Enum's __str__ is the name, rather than the value,
Expand All @@ -12,13 +20,14 @@ def __str__(self):
so we need to explicit use the value.
This is not necessary in Python 3.11 or above, where the
builtin `StrEnum` has this behavior.
This behaves like the builtin `StrEnum` (available in 3.11).
"""
return str.__str__(self)


class Chain(StrEnum):
"""Identifiers for chains & layer 2s."""

MAINNET = "mainnet"
ARBITRUM = "arbitrum"
OPTIMISM = "optimism"
Expand All @@ -29,5 +38,7 @@ class Chain(StrEnum):


class Env(StrEnum):
"""Names for different API environments."""

PROD = "prod"
STAGING = "staging"

0 comments on commit 605455c

Please sign in to comment.