Common#
Common yet miscellaneous utilities functions.
identity(x)
#
Returns the sole argument passed to it doing nothing.
This function is exposed in the package namespace and the builtins namespace.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
T
|
Any object. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
out |
T
|
The same object passed to it. |
imperative(*exprs)
#
Returns the last expression passed into the function.
If no expression are passed, returns None, per Python's convention.
This function is exposed in the package namespace and the builtins namespace.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*exprs
|
*tuple[*Ts, R]
|
Any number of expressions. |
()
|
Returns:
| Name | Type | Description |
|---|---|---|
out |
R
|
The last expression passed into the function. |
not_none(x)
#
Type narrowing: assert the value isn't None.
This function is exposed in the package namespace.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
T
|
Any value that type-checked to be |
required |
Returns:
| Name | Type | Description |
|---|---|---|
out |
T
|
The same value passed to it. |
Raises:
| Type | Description |
|---|---|
ValueError
|
if the input is actually |
todo(message=None)
#
Marks an unimplemented location that might be implemented in the future.
See todo! for usage.
This function is exposed in the package namespace and the builtins namespace.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
message
|
str | None
|
The extra message to be displayed. |
None
|
Raises:
| Type | Description |
|---|---|
NotImplementedError
|
Always. |
unimplemented(message=None)
#
Marks an unimplemented location that might not be implemented in the future.
See unimplemented! for usage.
This function is exposed in the package namespace and the builtins namespace.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
message
|
str | None
|
The extra message to be displayed. |
None
|
Raises:
| Type | Description |
|---|---|
NotImplementedError
|
Always. |