Type Aliases
codePost Types
Please see the codePost API Reference and the codePost Python SDK.
These types are imported into a single module in codepost_powertools in
codepost_powertools.utils.cptypes.
from codepost_powertools.utils.codepost_utils import get_course
from codepost_powertools.utils.cptypes import Course
course: Optional[Course] = get_course("COS126", "F2022")
Powertools Aliases
Type definitions and aliases.
- codepost_powertools.utils.types.PathLike
Alias =
os.PathLike|strA path-like argument.
- codepost_powertools.utils.types.CourseArg
Alias =
Course|Tuple[str, str]The course object, or a tuple of course name and period.
- codepost_powertools.utils.types.AssignmentArg
Alias =
Assignment|strThe assignment object, or the assignment name.
- codepost_powertools.utils.types.SuccessOrNone
Alias (generic
T) =Tuple[Literal[True], T]|Tuple[Literal[False], None]The return type of a “successful” function: either True and the return value, or False and None. These functions usually accept a
logparameter for whether to show log messages on failures or raise exceptions.
- codepost_powertools.utils.types.SuccessOrErrorMsg
Alias =
Tuple[Literal[True], None]|Tuple[Literal[False], str]The return type of a “silent” function: either True and None, or False and an error message. These functions usually do not accept a
logparameter; the successful state is returned in the tuple, and the user can decide what to do with the error message.