mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2025-12-22 19:31:08 -05:00
okay fine
This commit is contained in:
28
.venv/lib/python3.12/site-packages/black/rusty.py
Normal file
28
.venv/lib/python3.12/site-packages/black/rusty.py
Normal file
@@ -0,0 +1,28 @@
|
||||
"""An error-handling model influenced by that used by the Rust programming language
|
||||
|
||||
See https://doc.rust-lang.org/book/ch09-00-error-handling.html.
|
||||
"""
|
||||
|
||||
from typing import Generic, TypeVar, Union
|
||||
|
||||
T = TypeVar("T")
|
||||
E = TypeVar("E", bound=Exception)
|
||||
|
||||
|
||||
class Ok(Generic[T]):
|
||||
def __init__(self, value: T) -> None:
|
||||
self._value = value
|
||||
|
||||
def ok(self) -> T:
|
||||
return self._value
|
||||
|
||||
|
||||
class Err(Generic[E]):
|
||||
def __init__(self, e: E) -> None:
|
||||
self._e = e
|
||||
|
||||
def err(self) -> E:
|
||||
return self._e
|
||||
|
||||
|
||||
Result = Union[Ok[T], Err[E]]
|
||||
Reference in New Issue
Block a user