ry
ry = rust and python and bears, oh my!
DOCS: ryo3.dev (WIP)
ry
is a library of python shims/bindings to popular rust cratesryo3-*
is the collection of rust crates providing the shims used by ry and possibly your pyo3
rust-python library
THIS IS A WORK IN PROGRESS ~ FEEDBACK/PRs WELCOME!
Install
pip install ry
uv add ry
Check install: python -m ry
Quickstart
Check out the examples directory for some quickstart examples.
__
What and why?
This is a collection of pyo3-wrappers for rust crates I wish existed in python.
It all started with me wanting a fast python xxhash
and fnv-64
Who?
FAQ
(aka: questions that I have been asking myself)
- Q: Why?
- A: I (jesse) needed several hashing functions for python and then kept
adding things as I needed them
- Q: Does this have anything to do with the (excellent) package manager
rye
?
- A: short answer: no. long answer: no, it does not.
- Q: Why is the repo split into
ry
and ryo3
?
- A:
ry
is the python package, ryo3
is a rust crate setup to let you
"register" functions you may want if you were writing your own pyo3-python
bindings library; maybe someday the ryo3::libs
module will be split up
into separate packages
Crate bindings
ryo3-std
- wrapped crates:
heck
jiter
shlex
sqlformat
url
which
- compression:
- hashing:
- burnt-sushi:
FUTURE?
subprocess.redo
(subprocesses that are lessy finicky and support tee-ing)- wrappers:
ignore
http
regex
reqwest
(async http client / waiting on pyo3 asyncio to stabilize and for me to have more time)tokio
(fs
and process
)tracing
(could be nicer than python's awful logging lib -- currently a part of ry/ryo3 for my dev purposes - currently has impl thingy in utiles)tracing
(eg logging)uuid
- organization
- split up the
ryo3
type annotations? - chunk things into smaller sub-packages within the
ry
package?
API
ry.__init__
"""ry api ~ type annotations"""
import datetime as pydt
import typing as t
from os import PathLike
import typing_extensions as te
from . import http as http
from ._bytes import Bytes as Bytes
from ._jiff import Date as Date
from ._jiff import DateDifference as DateDifference
from ._jiff import DateTime as DateTime
from ._jiff import DateTimeDifference as DateTimeDifference
from ._jiff import DateTimeRound as DateTimeRound
from ._jiff import ISOWeekDate as ISOWeekDate
from ._jiff import Offset as Offset
from ._jiff import SignedDuration as SignedDuration
from ._jiff import Time as Time
from ._jiff import TimeDifference as TimeDifference
from ._jiff import TimeSpan as TimeSpan
from ._jiff import Timestamp as Timestamp
from ._jiff import TimestampDifference as TimestampDifference
from ._jiff import TimestampRound as TimestampRound
from ._jiff import TimeZone as TimeZone
from ._jiff import ZonedDateTime as ZonedDateTime
from ._jiff import ZonedDateTimeDifference as ZonedDateTimeDifference
from ._jiff import date as date
from ._jiff import datetime as datetime
from ._jiff import offset as offset
from ._jiff import time as time
from ._jiff import timespan as timespan
from .http import Headers as Headers
from .http import HttpStatus as HttpStatus
from .reqwest import HttpClient as HttpClient
from .reqwest import ReqwestError as ReqwestError
from .reqwest import Response as Response
from .reqwest import ResponseStream as ResponseStream
from .reqwest import fetch as fetch
__version__: str
__authors__: str
__build_profile__: str
__build_timestamp__: str
__pkg_name__: str
__description__: str
JsonPrimitive = None | bool | int | float | str
JsonValue = (
JsonPrimitive
| dict[str, JsonPrimitive | JsonValue]
| list[JsonPrimitive | JsonValue]
)
class Duration:
ZERO: Duration
MIN: Duration
MAX: Duration
NANOSECOND: Duration
MICROSECOND: Duration
MILLISECOND: Duration
SECOND: Duration
def __init__(self, secs: int = 0, nanos: int = 0) -> None: ...
def __eq__(self, other: object) -> bool: ...
def __ne__(self, other: object) -> bool: ...
def __lt__(self, other: Duration) -> bool: ...
def __le__(self, other: Duration) -> bool: ...
def __gt__(self, other: Duration) -> bool: ...
def __ge__(self, other: Duration) -> bool: ...
def __hash__(self) -> int: ...
def __richcmp__(
self, other: Duration | pydt.timedelta, op: int
) -> bool: ...
def __str__(self) -> str: ...
def abs_diff(self, other: Duration) -> Duration: ...
def sleep(self) -> None: ...
@classmethod
def from_pytimedelta(
cls: type[Duration], td: pydt.timedelta
) -> Duration: ...
def to_pytimedelta(self) -> pydt.timedelta: ...
@property
def is_zero(self) -> bool: ...
@property
def nanos(self) -> int: ...
@property
def secs(self) -> int: ...
@property
def days(self) -> int: ...
@property
def seconds(self) -> int: ...
@property
def microseconds(self) -> int: ...
@property
def subsec_micros(self) -> int: ...
@property
def subsec_millis(self) -> int: ...
@property
def subsec_nanos(self) -> int: ...
@classmethod
def from_hours(cls, hours: int) -> Duration: ...
@classmethod
def from_micros(cls, micros: int) -> Duration: ...
@classmethod
def from_millis(cls, millis: int) -> Duration: ...
@classmethod
def from_mins(cls, mins: int) -> Duration: ...
@classmethod
def from_nanos(cls, nanos: int) -> Duration: ...
@classmethod
def from_secs(cls, secs: int) -> Duration: ...
@classmethod
def from_secs_f32(cls, secs: float) -> Duration: ...
@classmethod
def from_secs_f64(cls, secs: float) -> Duration: ...
@classmethod
def from_days(cls, days: int) -> Duration: ...
@classmethod
def from_weeks(cls, weeks: int) -> Duration: ...
def as_micros(self) -> int: ...
def as_millis(self) -> int: ...
def as_nanos(self) -> int: ...
def as_secs(self) -> int: ...
def as_secs_f32(self) -> float: ...
def as_secs_f64(self) -> float: ...
def checked_add(self, other: Duration) -> Duration | None: ...
def checked_div(self, other: Duration) -> Duration | None: ...
def checked_mul(self, other: Duration) -> Duration | None: ...
def checked_sub(self, other: Duration) -> Duration | None: ...
def div_duration_f32(self, other: Duration) -> float: ...
def div_duration_f64(self, other: Duration) -> float: ...
def div_f32(self, other: float) -> Duration: ...
def div_f64(self, other: float) -> Duration: ...
def mul_f32(self, other: float) -> Duration: ...
def mul_f64(self, other: float) -> Duration: ...
def saturating_add(self, other: Duration) -> Duration: ...
def saturating_mul(self, other: Duration) -> Duration: ...
def saturating_sub(self, other: Duration) -> Duration: ...
class Instant:
def __init__(self) -> None: ...
@classmethod
def now(cls) -> Instant: ...
def __str__(self) -> str: ...
def __repr__(self) -> str: ...
def __eq__(self, other: object) -> bool: ...
def __ne__(self, other: object) -> bool: ...
def __lt__(self, other: Instant) -> bool: ...
def __le__(self, other: Instant) -> bool: ...
def __gt__(self, other: Instant) -> bool: ...
def __ge__(self, other: Instant) -> bool: ...
def __hash__(self) -> int: ...
def __add__(self, other: Duration) -> Instant: ...
def __iadd__(self, other: Duration) -> Instant: ...
@t.overload
def __sub__(self, other: Duration) -> Instant: ...
@t.overload
def __sub__(self, other: Instant) -> Duration: ...
def checked_add(self, other: Duration) -> Instant | None: ...
def checked_duration_since(self, earlier: Instant) -> Duration | None: ...
def checked_sub(self, other: Duration) -> Instant | None: ...
def duration_since(self, earlier: Instant) -> Duration: ...
def elapsed(self) -> Duration: ...
def saturating_duration_since(self, earlier: Instant) -> Duration: ...
def instant() -> Instant: ...
class FsPath:
def __init__(self, path: PathLike[str] | str | None = None) -> None: ...
def __fspath__(self) -> str: ...
def __str__(self) -> str: ...
def __repr__(self) -> str: ...
def __hash__(self) -> int: ...
def __eq__(self, other: object) -> bool: ...
def __ne__(self, other: object) -> bool: ...
def __lt__(self, other: PathLike[str] | str) -> bool: ...
def __le__(self, other: PathLike[str] | str) -> bool: ...
def __gt__(self, other: PathLike[str] | str) -> bool: ...
def __ge__(self, other: PathLike[str] | str) -> bool: ...
def __truediv__(self, other: PathLike[str] | str) -> FsPath: ...
def __rtruediv__(self, other: PathLike[str] | str) -> FsPath: ...
def read_text(self) -> str: ...
def read_bytes(self) -> bytes: ...
def absolute(self) -> FsPath: ...
def resolve(self) -> FsPath: ...
def write_text(self, data: str) -> None: ...
def write_bytes(self, data: bytes) -> None: ...
def joinpath(self, *paths: str) -> FsPath: ...
def exists(self) -> bool: ...
def with_name(self, name: str) -> FsPath: ...
def with_suffix(self, suffix: str) -> FsPath: ...
def iterdir(self) -> t.Iterator[FsPath]: ...
def relative_to(self, other: PathLike[str] | str | FsPath) -> FsPath: ...
def as_posix(self) -> str: ...
def __bytes__(self) -> bytes: ...
def as_uri(self) -> str: ...
def equiv(self, other: PathLike[str] | str | FsPath) -> bool: ...
def string(self) -> str: ...
def clone(self) -> FsPath: ...
@classmethod
def cwd(cls) -> FsPath: ...
@classmethod
def home(cls) -> FsPath: ...
@property
def anchor(self) -> str: ...
@property
def drive(self) -> str: ...
@property
def name(self) -> str: ...
@property
def parent(self) -> FsPath: ...
@property
def parents(self) -> t.Sequence[FsPath]: ...
@property
def parts(self) -> tuple[str, ...]: ...
@property
def root(self) -> str: ...
@property
def stem(self) -> str: ...
@property
def suffix(self) -> str: ...
@property
def suffixes(self) -> list[str]: ...
def _pop(self) -> FsPath: ...
def _push(self, path: PathLike[str] | str) -> FsPath: ...
def _set_extension(self, ext: str) -> FsPath: ...
def _set_file_name(self, name: str) -> FsPath: ...
def ancestors(self) -> t.Iterator[FsPath]: ...
def canonicalize(self) -> FsPath: ...
def components(self) -> t.Iterator[FsPath]: ...
def display(self) -> str: ...
def ends_with(self, path: PathLike[str] | str) -> bool: ...
def extension(self) -> str: ...
def file_name(self) -> str: ...
def file_prefix(self) -> FsPath: ...
def file_stem(self) -> str: ...
def has_root(self) -> bool: ...
def is_absolute(self) -> bool: ...
def is_dir(self) -> bool: ...
def is_file(self) -> bool: ...
def is_relative(self) -> bool: ...
def is_symlink(self) -> bool: ...
def starts_with(self, path: PathLike[str] | str) -> bool: ...
def strip_prefix(self, prefix: PathLike[str] | str) -> FsPath: ...
def with_extension(self, ext: str) -> FsPath: ...
def with_file_name(self, name: str) -> FsPath: ...
FsPathLike = str | FsPath | PathLike[str]
def pwd() -> str: ...
def home() -> str: ...
def cd(path: FsPathLike) -> None: ...
def ls(path: FsPathLike | None = None) -> list[FsPath]: ...
def quick_maths() -> t.Literal[3]:
"""Performs quick-maths
Implements the algorithm for performing "quick-maths" as described by
Big Shaq in his PHD thesis, 2017, in which he states:
> "2 plus 2 is 4, minus one that's 3, quick maths." (Big Shaq et al., 2017)
Reference:
https://youtu.be/3M_5oYU-IsU?t=60
Example:
>>> import ry
>>> result = ry.quick_maths()
>>> assert result == 3
NOTE: THIS IS FROM MY TEMPLATE RY03-MODULE
"""
def sleep(seconds: float) -> float: ...
async def sleep_async(seconds: float) -> float: ...
async def asleep(seconds: float) -> float:
"""Alias for sleep_async"""
...
def read_text(path: FsPathLike) -> str: ...
def read_bytes(path: FsPathLike) -> bytes: ...
def write_text(path: FsPathLike, data: str) -> None: ...
def write_bytes(path: FsPathLike, data: bytes) -> None: ...
class Regex:
def __init__(
self,
pattern: str,
*,
case_insensitive: bool = False,
crlf: bool = False,
dot_matches_new_line: bool = False,
ignore_whitespace: bool = False,
line_terminator: str | None = None,
multi_line: bool = False,
octal: bool = False,
size_limit: int | None = None,
swap_greed: bool = False,
unicode: bool = False,
) -> None: ...
def __str__(self) -> str: ...
def __repr__(self) -> str: ...
def is_match(self, string: str) -> bool: ...
def which(cmd: str, path: None | str = None) -> str | None: ...
def which_all(cmd: str, path: None | str = None) -> list[str]: ...
def which_re(regex: Regex, path: None | str = None) -> list[str]: ...
def camel_case(string: str) -> str: ...
def kebab_case(string: str) -> str: ...
def pascal_case(string: str) -> str: ...
def shouty_kebab_case(string: str) -> str: ...
def shouty_snake_case(string: str) -> str: ...
def snake_case(string: str) -> str: ...
def snek_case(string: str) -> str: ...
def title_case(string: str) -> str: ...
def train_case(string: str) -> str: ...
class Glob:
"""globset::Glob wrapper"""
def __init__(
self,
pattern: str,
/,
*,
case_insensitive: bool | None = None,
literal_separator: bool | None = None,
backslash_escape: bool | None = None,
) -> None: ...
def regex(self) -> str: ...
def is_match(self, path: FsPathLike) -> bool: ...
def __call__(self, path: FsPathLike) -> bool: ...
def __invert__(self) -> Glob: ...
def __str__(self) -> str: ...
def __repr__(self) -> str: ...
def globset(self) -> GlobSet: ...
def globster(self) -> Globster: ...
class GlobSet:
"""globset::GlobSet wrapper"""
def __init__(
self,
patterns: list[str],
/,
*,
case_insensitive: bool | None = None,
literal_separator: bool | None = None,
backslash_escape: bool | None = None,
) -> None: ...
def is_empty(self) -> bool: ...
def is_match(self, path: str) -> bool: ...
def matches(self, path: str) -> list[int]: ...
def __call__(self, path: str) -> bool: ...
def __invert__(self) -> GlobSet: ...
def __str__(self) -> str: ...
def __repr__(self) -> str: ...
def globster(self) -> Globster: ...
class Globster:
"""Globster is a matcher with claws!
Note: The north american `Globster` is similar to the european `Globset`
but allows for negative patterns (prefixed with '!')
"""
def __init__(
self,
patterns: list[str],
/,
*,
case_insensitive: bool | None = None,
literal_separator: bool | None = None,
backslash_escape: bool | None = None,
) -> None: ...
def is_empty(self) -> bool: ...
def is_match(self, path: FsPathLike) -> bool: ...
def __call__(self, path: FsPathLike) -> bool: ...
def __invert__(self) -> GlobSet: ...
def __str__(self) -> str: ...
def __repr__(self) -> str: ...
def glob(
pattern: str,
/,
*,
case_insensitive: bool | None = None,
literal_separator: bool | None = None,
backslash_escape: bool | None = None,
) -> Glob: ...
def globster(
patterns: list[str] | tuple[str, ...],
/,
*,
case_insensitive: bool | None = None,
literal_separator: bool | None = None,
backslash_escape: bool | None = None,
) -> Globster: ...
class WalkdirGen:
"""walkdir::Walkdir iterable wrapper"""
files: bool
dirs: bool
def __next__(self) -> str: ...
def __iter__(self) -> t.Iterator[str]: ...
def collect(self) -> list[str]: ...
def walkdir(
path: FsPathLike | None = None,
*,
files: bool = True,
dirs: bool = True,
contents_first: bool = False,
min_depth: int = 0,
max_depth: int | None = None,
follow_links: bool = False,
same_file_system: bool = False,
glob: Glob | GlobSet | Globster | t.Sequence[str] | str | None = None,
) -> WalkdirGen: ...
def is_same_file(a: PathLike[str], b: PathLike[str]) -> bool: ...
def shplit(s: str) -> list[str]:
"""shlex::split wrapper much like python's stdlib shlex.split but faster"""
...
class JsonParseKwargs(t.TypedDict, total=False):
allow_inf_nan: bool
"""Allow parsing of `Infinity`, `-Infinity`, `NaN` ~ default: True"""
cache_mode: t.Literal[True, False, "all", "keys", "none"]
"""Cache mode for JSON parsing ~ default: `all` """
partial_mode: t.Literal[True, False, "off", "on", "trailing-strings"]
"""Partial mode for JSON parsing ~ default: False"""
catch_duplicate_keys: bool
"""Catch duplicate keys in JSON objects ~ default: False"""
float_mode: t.Literal["float", "decimal", "lossless-float"] | bool
"""Mode for parsing JSON floats ~ default: False"""
def parse_json(
data: bytes | str,
/,
**kwargs: te.Unpack[JsonParseKwargs],
) -> JsonValue: ...
def parse_json_bytes(
data: bytes,
/,
**kwargs: te.Unpack[JsonParseKwargs],
) -> JsonValue: ...
def parse_json_str(
data: str,
/,
**kwargs: te.Unpack[JsonParseKwargs],
) -> JsonValue: ...
def jiter_cache_clear() -> None: ...
def jiter_cache_usage() -> int: ...
def fmt_nbytes(nbytes: int) -> str: ...
def unindent(string: str) -> str: ...
def unindent_bytes(string: bytes) -> bytes: ...
class FnvHasher:
name: t.Literal["fnv1a"]
def __init__(self, input: bytes | None = None) -> None: ...
def update(self, input: bytes) -> None: ...
def digest(self) -> int: ...
def hexdigest(self) -> str: ...
def copy(self) -> FnvHasher: ...
def __str__(self) -> str: ...
def __repr__(self) -> str: ...
def fnv1a(input: bytes) -> FnvHasher: ...
def brotli_encode(
input: bytes, quality: int = 11, magic_number: bool = False
) -> bytes: ...
def brotli_decode(input: bytes) -> bytes: ...
def brotli(
input: bytes, quality: int = 11, magic_number: bool = False
) -> bytes:
"""Alias for brotli_encode"""
def bzip2_encode(input: bytes, quality: int = 9) -> bytes: ...
def bzip2_decode(input: bytes) -> bytes: ...
def bzip2(input: bytes, quality: int = 9) -> bytes:
"""Alias for bzip2_encode"""
def gzip_encode(input: bytes, quality: int = 9) -> bytes: ...
def gzip_decode(input: bytes) -> bytes: ...
def gzip(input: bytes, quality: int = 9) -> bytes:
"""Alias for gzip_encode"""
def gunzip(input: bytes) -> bytes:
"""Alias for gzip_decode"""
def zstd_encode(input: bytes, level: int = 3) -> bytes: ...
def zstd(input: bytes, level: int = 3) -> bytes:
"""Alias for zstd_encode"""
def zstd_decode(input: bytes) -> bytes: ...
SqlfmtParamValue = str | int | float | bool
TSqlfmtParamValue_co = t.TypeVar(
"TSqlfmtParamValue_co", bound=SqlfmtParamValue, covariant=True
)
SqlfmtParamsLike = (
dict[str, TSqlfmtParamValue_co]
| t.Sequence[tuple[str, TSqlfmtParamValue_co]]
| t.Sequence[TSqlfmtParamValue_co]
)
class SqlfmtQueryParams:
def __init__(
self, params: SqlfmtParamsLike[TSqlfmtParamValue_co]
) -> None: ...
def __str__(self) -> str: ...
def __repr__(self) -> str: ...
def sqlfmt_params(
params: SqlfmtParamsLike[TSqlfmtParamValue_co] | SqlfmtQueryParams,
) -> SqlfmtQueryParams: ...
def sqlfmt(
sql: str,
params: SqlfmtParamsLike[TSqlfmtParamValue_co]
| SqlfmtQueryParams
| None = None,
*,
indent: int = 2,
uppercase: bool | None = True,
lines_between_statements: int = 1,
) -> str: ...
class URL:
def __init__(
self, url: str, *, params: dict[str, str] | None = None
) -> None: ...
@classmethod
def parse(cls, url: str) -> URL: ...
@classmethod
def parse_with_params(cls, url: str, params: dict[str, str]) -> URL: ...
@classmethod
def from_directory_path(cls, path: str) -> URL: ...
def __str__(self) -> str: ...
def __repr__(self) -> str: ...
def __eq__(self, other: object) -> bool: ...
def __ge__(self, other: URL) -> bool: ...
def __gt__(self, other: URL) -> bool: ...
def __hash__(self) -> int: ...
def __le__(self, other: URL) -> bool: ...
def __lt__(self, other: URL) -> bool: ...
def __ne__(self, other: object) -> bool: ...
def __rtruediv__(self, relative: str) -> URL: ...
def __truediv__(self, relative: str) -> URL: ...
@property
def authority(self) -> str: ...
@property
def fragment(self) -> str | None: ...
@property
def host(self) -> str | None: ...
@property
def host_str(self) -> str | None: ...
@property
def netloc(self) -> str: ...
@property
def password(self) -> str | None: ...
@property
def path(self) -> str: ...
@property
def path_segments(self) -> tuple[str, ...]: ...
@property
def port(self) -> int | None: ...
@property
def port_or_known_default(self) -> int | None: ...
@property
def query(self) -> str | None: ...
@property
def query_pairs(self) -> list[tuple[str, str]]: ...
@property
def scheme(self) -> str: ...
@property
def username(self) -> str: ...
def has_authority(self) -> bool: ...
def has_host(self) -> bool: ...
def is_special(self) -> bool: ...
def join(self, *parts: str) -> URL: ...
def to_filepath(self) -> str: ...
def set_fragment(self, fragment: str) -> None: ...
def set_host(self, host: str) -> None: ...
def set_ip_host(self, host: str) -> None: ...
def set_password(self, password: str) -> None: ...
def set_path(self, path: str) -> None: ...
def set_port(self, port: int) -> None: ...
def set_query(self, query: str) -> None: ...
def set_scheme(self, scheme: str) -> None: ...
def set_username(self, username: str) -> None: ...
def socket_addrs(self) -> None: ...
ry.JSON
"""ry.ryo3.JSON"""
from typing import Literal
JsonPrimitive = None | bool | int | float | str
JsonValue = (
JsonPrimitive
| dict[str, JsonPrimitive | JsonValue]
| list[JsonPrimitive | JsonValue]
)
def parse_json(
data: bytes | str,
/,
*,
allow_inf_nan: bool = True,
cache_mode: Literal[True, False, "all", "keys", "none"] = "all",
partial_mode: Literal[True, False, "off", "on", "trailing-strings"] = False,
catch_duplicate_keys: bool = False,
float_mode: Literal["float", "decimal", "lossless-float"] | bool = False,
) -> JsonValue: ...
def parse_json_bytes(
data: bytes,
/,
*,
allow_inf_nan: bool = True,
cache_mode: Literal[True, False, "all", "keys", "none"] = "all",
partial_mode: Literal[True, False, "off", "on", "trailing-strings"] = False,
catch_duplicate_keys: bool = False,
float_mode: Literal["float", "decimal", "lossless-float"] | bool = False,
) -> JsonValue: ...
def parse_json_str(
data: str,
/,
*,
allow_inf_nan: bool = True,
cache_mode: Literal[True, False, "all", "keys", "none"] = "all",
partial_mode: Literal[True, False, "off", "on", "trailing-strings"] = False,
catch_duplicate_keys: bool = False,
float_mode: Literal["float", "decimal", "lossless-float"] | bool = False,
) -> JsonValue: ...
def jiter_cache_clear() -> None: ...
def jiter_cache_usage() -> int: ...
ry._bytes
import sys
from typing import overload
if sys.version_info >= (3, 12):
from collections.abc import Buffer
else:
from typing_extensions import Buffer
class Bytes(Buffer):
"""
A buffer implementing the Python buffer protocol, allowing zero-copy access
to underlying Rust memory.
You can pass this to `memoryview` for a zero-copy view into the underlying
data or to `bytes` to copy the underlying data into a Python `bytes`.
Many methods from the Python `bytes` class are implemented on this,
"""
def __init__(self, buf: Buffer = b"") -> None:
"""Construct a new Bytes object.
This will be a zero-copy view on the Python byte slice.
"""
def __add__(self, other: Buffer) -> Bytes: ...
def __buffer__(self, flags: int) -> memoryview[int]: ...
def __contains__(self, other: Buffer) -> bool: ...
def __eq__(self, other: object) -> bool: ...
@overload
def __getitem__(self, other: int) -> int: ...
@overload
def __getitem__(self, other: slice) -> Bytes: ...
def __mul__(self, other: Buffer) -> int: ...
def __len__(self) -> int: ...
def __repr__(self) -> str: ...
def removeprefix(self, prefix: Buffer, /) -> Bytes:
"""
If the binary data starts with the prefix string, return `bytes[len(prefix):]`.
Otherwise, return the original binary data.
"""
def removesuffix(self, suffix: Buffer, /) -> Bytes:
"""
If the binary data ends with the suffix string and that suffix is not empty,
return `bytes[:-len(suffix)]`. Otherwise, return the original binary data.
"""
def isalnum(self) -> bool:
"""
Return `True` if all bytes in the sequence are alphabetical ASCII characters or
ASCII decimal digits and the sequence is not empty, `False` otherwise.
Alphabetic ASCII characters are those byte values in the sequence
`b'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'`. ASCII decimal digits
are those byte values in the sequence `b'0123456789'`.
"""
def isalpha(self) -> bool:
"""
Return `True` if all bytes in the sequence are alphabetic ASCII characters and
the sequence is not empty, `False` otherwise.
Alphabetic ASCII characters are those byte values in the sequence
`b'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'`.
"""
def isascii(self) -> bool:
"""
Return `True` if the sequence is empty or all bytes in the sequence are ASCII,
`False` otherwise.
ASCII bytes are in the range `0-0x7F`.
"""
def isdigit(self) -> bool:
"""
Return `True` if all bytes in the sequence are ASCII decimal digits and the
sequence is not empty, `False` otherwise.
ASCII decimal digits are those byte values in the sequence `b'0123456789'`.
"""
def islower(self) -> bool:
"""
Return `True` if there is at least one lowercase ASCII character in the sequence
and no uppercase ASCII characters, `False` otherwise.
"""
def isspace(self) -> bool:
"""
Return `True` if all bytes in the sequence are ASCII whitespace and the sequence
is not empty, `False` otherwise.
ASCII whitespace characters are those byte values
in the sequence `b' \t\n\r\x0b\f'` (space, tab, newline, carriage return,
vertical tab, form feed).
"""
def isupper(self) -> bool:
"""
Return `True` if there is at least one uppercase alphabetic ASCII character in
the sequence and no lowercase ASCII characters, `False` otherwise.
"""
def lower(self) -> Bytes:
"""
Return a copy of the sequence with all the uppercase ASCII characters converted
to their corresponding lowercase counterpart.
"""
def upper(self) -> Bytes:
"""
Return a copy of the sequence with all the lowercase ASCII characters converted
to their corresponding uppercase counterpart.
"""
def to_bytes(self) -> bytes:
"""Copy this buffer's contents into a Python `bytes` object."""
def decode(self, encoding: str = "utf-8", errors: str = "strict") -> str:
"""Decode the binary data using the given encoding."""
def hex(
self, sep: str | None = None, bytes_per_sep: int | None = None
) -> str:
"""Return a hexadecimal representation of the binary data."""
@classmethod
def fromhex(cls, hexstr: str) -> Bytes:
"""Construct a `Bytes` object from a hexadecimal string."""
ry._dev
"""ry.ryo3.dev"""
from __future__ import annotations
import typing as t
def run(
*args: str | list[str],
capture_output: bool = True,
input: bytes | None = None,
) -> t.Any: ...
def anystr_noop(s: t.AnyStr) -> t.AnyStr: ...
def string_noop(s: str) -> str: ...
def bytes_noop(s: bytes) -> bytes: ...
ry._jiff
"""jiff types"""
import datetime as pydt
import typing as t
import typing_extensions as te
from ry._types import (
DateTimeTypedDict,
DateTypedDict,
TimeSpanTypedDict,
TimeTypedDict,
)
from . import Duration
JIFF_UNIT_STRING = t.Literal[
"year",
"month",
"week",
"day",
"hour",
"minute",
"second",
"millisecond",
"microsecond",
"nanosecond",
]
JIFF_ROUND_MODE_STRING = t.Literal[
"ceil",
"floor",
"expand",
"trunc",
"half_ceil",
"half_floor",
"half_expand",
"half_trunc",
"half_even",
]
JIFF_WEEKDAY_STRING = t.Literal[
"monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"
]
JIFF_WEEKDAY_INT = t.Literal[
1,
2,
3,
4,
5,
6,
7,
]
class Date:
MIN: Date
MAX: Date
ZERO: Date
def __init__(self, year: int, month: int, day: int) -> None: ...
def string(self) -> str: ...
def __str__(self) -> str: ...
def __repr__(self) -> str: ...
def to_pydate(self) -> pydt.date: ...
@classmethod
def from_pydate(cls: type[Date], date: pydt.date) -> Date: ...
@property
def year(self) -> int: ...
@property
def month(self) -> int: ...
@property
def day(self) -> int: ...
@property
def weekday(self) -> int: ...
@classmethod
def from_iso_week_date(
cls: type[Date], year: int, week: int, weekday: int
) -> Date: ...
@classmethod
def today(cls: type[Date]) -> Date: ...
@classmethod
def strptime(cls: type[Date], format: str, string: str) -> Date: ...
def strftime(self, format: str) -> str: ...
def __add__(self, other: TimeSpan | SignedDuration | Duration) -> Date: ...
def __iadd__(self, other: TimeSpan | SignedDuration | Duration) -> Date: ...
@t.overload
def __sub__(self, other: Date) -> TimeSpan: ...
@t.overload
def __sub__(self, other: TimeSpan | SignedDuration | Duration) -> Date: ...
@t.overload
def __isub__(self, other: Date) -> TimeSpan: ...
@t.overload
def __isub__(self, other: TimeSpan | SignedDuration | Duration) -> Date: ...
def at(
self, hour: int, minute: int, second: int, nanosecond: int
) -> DateTime: ...
def asdict(self) -> DateTypedDict: ...
def astuple(self) -> tuple[int, int, int]: ...
def checked_add(
self, other: TimeSpan | SignedDuration | Duration
) -> Date: ...
def day_of_year(self) -> int: ...
def day_of_year_no_leap(self) -> int | None: ...
def days_in_month(self) -> int: ...
def days_in_year(self) -> int: ...
def duration_since(self, other: Date) -> Date: ...
def duration_until(self, other: Date) -> Date: ...
def era_year(self) -> tuple[int, t.Literal["BCE", "CE"]]: ...
def first_of_month(self) -> Date: ...
def first_of_year(self) -> Date: ...
def iso_week_date(self) -> ISOWeekDate: ...
def in_leap_year(self) -> bool: ...
def in_tz(self, tz: str) -> ZonedDateTime: ...
def intz(self, tz: str) -> ZonedDateTime: ...
def last_of_month(self) -> Date: ...
def last_of_year(self) -> Date: ...
def nth_weekday(
self, nth: int, weekday: JIFF_WEEKDAY_STRING | JIFF_WEEKDAY_INT
) -> Date: ...
def nth_weekday_of_month(
self, nth: int, weekday: JIFF_WEEKDAY_STRING | JIFF_WEEKDAY_INT
) -> Date: ...
def saturating_add(
self, other: TimeSpan | SignedDuration | Duration
) -> Date: ...
def saturating_sub(
self, other: TimeSpan | SignedDuration | Duration
) -> Date: ...
def series(self, span: TimeSpan) -> t.Iterator[Date]: ...
def to_datetime(self, time: Time) -> DateTime: ...
def tomorrow(self) -> Date: ...
def yesterday(self) -> Date: ...
def _since(self, other: DateDifference) -> TimeSpan: ...
def _until(self, other: DateDifference) -> TimeSpan: ...
def since(
self,
other: Date | DateTime | ZonedDateTime,
*,
smallest: JIFF_UNIT_STRING | None = None,
largest: JIFF_UNIT_STRING | None = None,
mode: JIFF_ROUND_MODE_STRING | None = None,
increment: int | None = None,
) -> TimeSpan: ...
def until(
self,
other: Date | DateTime | ZonedDateTime,
*,
smallest: JIFF_UNIT_STRING | None = None,
largest: JIFF_UNIT_STRING | None = None,
mode: JIFF_ROUND_MODE_STRING | None = None,
increment: int | None = None,
) -> TimeSpan: ...
@t.overload
def checked_sub(self, other: Date) -> TimeSpan: ...
@t.overload
def checked_sub(
self, other: TimeSpan | SignedDuration | Duration
) -> Date: ...
class DateDifference:
def __init__(
self,
date: Date,
*,
smallest: JIFF_UNIT_STRING | None = None,
largest: JIFF_UNIT_STRING | None = None,
mode: JIFF_ROUND_MODE_STRING | None = None,
increment: int | None = None,
) -> None: ...
def __str__(self) -> str: ...
def __repr__(self) -> str: ...
def smallest(self, unit: JIFF_UNIT_STRING) -> DateDifference: ...
def largest(self, unit: JIFF_UNIT_STRING) -> DateDifference: ...
def mode(self, mode: JIFF_ROUND_MODE_STRING) -> DateDifference: ...
def increment(self, increment: int) -> DateDifference: ...
class Time:
MIN: Time
MAX: Time
def __init__(
self,
hour: int = 0,
minute: int = 0,
second: int = 0,
nanosecond: int = 0,
) -> None: ...
def string(self) -> str: ...
def __str__(self) -> str: ...
def __repr__(self) -> str: ...
def __add__(self, other: TimeSpan | SignedDuration | Duration) -> Time: ...
def __iadd__(self, other: TimeSpan | SignedDuration | Duration) -> Time: ...
@t.overload
def __sub__(self, other: Time) -> TimeSpan: ...
@t.overload
def __sub__(self, other: TimeSpan | SignedDuration | Duration) -> Time: ...
@t.overload
def __isub__(self, other: Time) -> TimeSpan: ...
@t.overload
def __isub__(self, other: TimeSpan | SignedDuration | Duration) -> Time: ...
@classmethod
def strptime(cls: type[Time], format: str, string: str) -> Time: ...
def strftime(self, format: str) -> str: ...
def to_pytime(self) -> pydt.time: ...
@classmethod
def from_pytime(cls: type[Time], t: pydt.time) -> Time: ...
@classmethod
def midnight(cls: type[Time]) -> Time: ...
@classmethod
def now(cls: type[Time]) -> Time: ...
@classmethod
def parse(cls: type[Time], s: str) -> Time: ...
@property
def hour(self) -> int: ...
@property
def minute(self) -> int: ...
@property
def second(self) -> int: ...
@property
def millisecond(self) -> int: ...
@property
def microsecond(self) -> int: ...
@property
def nanosecond(self) -> int: ...
@property
def subsec_nanosecond(self) -> None: ...
def astuple(self) -> tuple[int, int, int, int]: ...
def asdict(self) -> TimeTypedDict: ...
def series(self, span: TimeSpan) -> t.Iterator[Time]: ...
def checked_add(
self, other: TimeSpan | SignedDuration | Duration
) -> Time: ...
@t.overload
def checked_sub(self, other: Time) -> TimeSpan: ...
@t.overload
def checked_sub(
self, other: TimeSpan | SignedDuration | Duration
) -> Time: ...
def saturating_add(
self, other: TimeSpan | SignedDuration | Duration
) -> Time: ...
def saturating_sub(
self, other: TimeSpan | SignedDuration | Duration
) -> Time: ...
def wrapping_add(
self, other: TimeSpan | SignedDuration | Duration
) -> Time: ...
def wrapping_sub(
self, other: TimeSpan | SignedDuration | Duration
) -> Time: ...
def on(self, year: int, month: int, day: int) -> DateTime: ...
def duration_until(self, other: Time) -> SignedDuration: ...
def duration_since(self, other: Time) -> SignedDuration: ...
def round(
self,
smallest: JIFF_UNIT_STRING | None = None,
mode: JIFF_ROUND_MODE_STRING | None = None,
increment: int | None = None,
) -> Time: ...
def to_datetime(self, d: Date) -> DateTime: ...
def _since(self, other: TimeDifference) -> TimeSpan: ...
def _until(self, other: TimeDifference) -> TimeSpan: ...
def since(
self,
other: Time | DateTime | ZonedDateTime,
*,
smallest: JIFF_UNIT_STRING | None = None,
largest: JIFF_UNIT_STRING | None = None,
mode: JIFF_ROUND_MODE_STRING | None = None,
increment: int | None = None,
) -> TimeSpan: ...
def until(
self,
other: Time | DateTime | ZonedDateTime,
*,
smallest: JIFF_UNIT_STRING | None = None,
largest: JIFF_UNIT_STRING | None = None,
mode: JIFF_ROUND_MODE_STRING | None = None,
increment: int | None = None,
) -> TimeSpan: ...
class TimeDifference:
def __init__(
self,
date: Time,
*,
smallest: JIFF_UNIT_STRING | None = None,
largest: JIFF_UNIT_STRING | None = None,
mode: JIFF_ROUND_MODE_STRING | None = None,
increment: int | None = None,
) -> None: ...
def __str__(self) -> str: ...
def __repr__(self) -> str: ...
def smallest(self, unit: JIFF_UNIT_STRING) -> TimeDifference: ...
def largest(self, unit: JIFF_UNIT_STRING) -> TimeDifference: ...
def mode(self, mode: JIFF_ROUND_MODE_STRING) -> TimeDifference: ...
def increment(self, increment: int) -> TimeDifference: ...
class DateTime:
MIN: DateTime
MAX: DateTime
ZERO: DateTime
def __init__(
self,
year: int,
month: int,
day: int,
hour: int = 0,
minute: int = 0,
second: int = 0,
nanosecond: int = 0,
) -> None: ...
def __str__(self) -> str: ...
def string(self) -> str: ...
def strftime(self, format: str) -> str: ...
@classmethod
def strptime(cls: type[DateTime], format: str, string: str) -> DateTime: ...
@classmethod
def parse(cls: type[DateTime], s: str) -> DateTime: ...
@classmethod
def from_pydatetime(cls: type[DateTime], dt: pydt.datetime) -> DateTime: ...
def to_pydatetime(self) -> pydt.datetime: ...
@classmethod
def now(cls: type[DateTime]) -> DateTime: ...
@classmethod
def from_parts(cls: type[DateTime], date: Date, time: Time) -> DateTime: ...
def __repr__(self) -> str: ...
def __add__(
self, other: TimeSpan | SignedDuration | Duration
) -> DateTime: ...
def __iadd__(
self, other: TimeSpan | SignedDuration | Duration
) -> DateTime: ...
@t.overload
def __sub__(self, other: DateTime) -> TimeSpan: ...
@t.overload
def __sub__(
self, other: TimeSpan | SignedDuration | Duration
) -> DateTime: ...
@t.overload
def __isub__(self, other: DateTime) -> TimeSpan: ...
@t.overload
def __isub__(
self, other: TimeSpan | SignedDuration | Duration
) -> DateTime: ...
def checked_add(
self, other: TimeSpan | SignedDuration | Duration
) -> DateTime: ...
def saturating_add(
self, other: TimeSpan | SignedDuration | Duration
) -> DateTime: ...
def in_tz(self, tz: str) -> ZonedDateTime: ...
def intz(self, tz: str) -> ZonedDateTime: ...
def iso_week_date(self) -> tuple[int, int, int]: ...
def date(self) -> Date: ...
def time(self) -> Time: ...
def series(self, span: TimeSpan) -> t.Iterator[DateTime]: ...
def asdict(self) -> DateTimeTypedDict: ...
def round(self, options: JIFF_UNIT_STRING | DateTimeRound) -> DateTime: ...
def yesterday(self) -> DateTime: ...
@t.overload
def checked_sub(self, other: DateTime) -> TimeSpan: ...
@t.overload
def checked_sub(
self, other: TimeSpan | SignedDuration | Duration
) -> DateTime: ...
@t.overload
def saturating_sub(self, other: DateTime) -> TimeSpan: ...
@t.overload
def saturating_sub(
self, other: TimeSpan | SignedDuration | Duration
) -> DateTime: ...
@property
def year(self) -> int: ...
@property
def month(self) -> int: ...
@property
def day(self) -> int: ...
@property
def hour(self) -> int: ...
@property
def minute(self) -> int: ...
@property
def second(self) -> int: ...
@property
def millisecond(self) -> int: ...
@property
def microsecond(self) -> int: ...
@property
def nanosecond(self) -> int: ...
@property
def subsec_nanosecond(self) -> int: ...
@property
def weekday(self) -> int: ...
def first_of_month(self) -> DateTime: ...
def first_of_year(self) -> DateTime: ...
def day_of_year(self) -> int: ...
def day_of_year_no_leap(self) -> int | None: ...
def days_in_month(self) -> int: ...
def days_in_year(self) -> int: ...
def era_year(self) -> tuple[int, t.Literal["BCE", "CE"]]: ...
def duration_since(self, other: DateTime) -> SignedDuration: ...
def duration_until(self, other: DateTime) -> SignedDuration: ...
def in_leap_year(self) -> bool: ...
def end_of_day(self) -> DateTime: ...
def nth_weekday(
self, nth: int, weekday: JIFF_WEEKDAY_STRING | JIFF_WEEKDAY_INT
) -> DateTime: ...
def nth_weekday_of_month(
self, nth: int, weekday: JIFF_WEEKDAY_STRING | JIFF_WEEKDAY_INT
) -> DateTime: ...
def last_of_month(self) -> DateTime: ...
def last_of_year(self) -> DateTime: ...
def start_of_day(self) -> DateTime: ...
def tomorrow(self) -> DateTime: ...
def to_zoned(self, tz: TimeZone) -> ZonedDateTime: ...
def _since(self, other: DateTimeDifference) -> TimeSpan: ...
def _until(self, other: DateTimeDifference) -> TimeSpan: ...
def since(
self,
other: Date | Time | DateTime | ZonedDateTime,
*,
smallest: JIFF_UNIT_STRING | None = None,
largest: JIFF_UNIT_STRING | None = None,
mode: JIFF_ROUND_MODE_STRING | None = None,
increment: int | None = None,
) -> TimeSpan: ...
def until(
self,
other: Date | Time | DateTime | ZonedDateTime,
*,
smallest: JIFF_UNIT_STRING | None = None,
largest: JIFF_UNIT_STRING | None = None,
mode: JIFF_ROUND_MODE_STRING | None = None,
increment: int | None = None,
) -> TimeSpan: ...
class DateTimeDifference:
def __init__(
self,
date: DateTime,
*,
smallest: JIFF_UNIT_STRING | None = None,
largest: JIFF_UNIT_STRING | None = None,
mode: JIFF_ROUND_MODE_STRING | None = None,
increment: int | None = None,
) -> None: ...
def __str__(self) -> str: ...
def __repr__(self) -> str: ...
def smallest(self, unit: JIFF_UNIT_STRING) -> DateTimeDifference: ...
def largest(self, unit: JIFF_UNIT_STRING) -> DateTimeDifference: ...
def mode(self, mode: JIFF_ROUND_MODE_STRING) -> DateTimeDifference: ...
def increment(self, increment: int) -> DateTimeDifference: ...
class TimeZone:
def __init__(self, name: str) -> None: ...
def __eq__(self, other: object) -> bool: ...
def __str__(self) -> str: ...
def __repr__(self) -> str: ...
def to_pytzinfo(self) -> pydt.tzinfo: ...
@classmethod
def from_pytzinfo(cls: type[TimeZone], tz: pydt.tzinfo) -> TimeZone: ...
@property
def name(self) -> str: ...
@classmethod
def fixed(cls: type[TimeZone], offset: Offset) -> TimeZone: ...
@classmethod
def get(cls: type[TimeZone], name: str) -> TimeZone: ...
@classmethod
def posix(cls: type[TimeZone], name: str) -> TimeZone: ...
@classmethod
def system(cls: type[TimeZone]) -> TimeZone: ...
@classmethod
def try_system(cls: type[TimeZone]) -> TimeZone: ...
@classmethod
def tzif(cls: type[TimeZone], name: str, data: bytes) -> TimeZone: ...
@classmethod
def utc(cls: type[TimeZone]) -> TimeZone: ...
def iana_name(self) -> str | None: ...
def to_datetime(self, dt: Timestamp) -> DateTime: ...
def to_offset(self, timestamp: Timestamp) -> tuple[Offset, bool, str]: ...
def to_timestamp(self, dt: DateTime) -> Timestamp: ...
def to_zoned(self, other: DateTime) -> ZonedDateTime: ...
def to_ambiguous_timestamp(self) -> t.NoReturn: ...
def to_ambiguous_zoned(self) -> t.NoReturn: ...
class SignedDuration:
MIN: SignedDuration
MAX: SignedDuration
ZERO: SignedDuration
def __init__(self, secs: int = 0, nanos: int = 0) -> None: ...
def __hash__(self) -> int: ...
def __mul__(self, other: int) -> SignedDuration: ...
def __rmul__(self, other: int) -> SignedDuration: ...
def __eq__(self, other: object) -> bool: ...
def __ne__(self, other: object) -> bool: ...
def __lt__(self, other: object) -> bool: ...
def __le__(self, other: object) -> bool: ...
def __gt__(self, other: object) -> bool: ...
def __ge__(self, other: object) -> bool: ...
def __neg__(self) -> SignedDuration: ...
def __add__(self, other: SignedDuration) -> SignedDuration: ...
def __abs__(self) -> SignedDuration: ...
def __div__(self, other: int) -> SignedDuration: ...
def abs(self) -> SignedDuration: ...
def unsigned_abs(self) -> Duration: ...
def __richcmp__(
self, other: SignedDuration | pydt.timedelta, op: int
) -> bool: ...
def __str__(self) -> str: ...
def string(self, human: bool = False) -> str: ...
@classmethod
def from_pytimedelta(
cls: type[SignedDuration], td: pydt.timedelta
) -> SignedDuration: ...
def to_pytimedelta(self) -> pydt.timedelta: ...
@classmethod
def parse(cls: type[SignedDuration], s: str) -> SignedDuration: ...
@classmethod
def from_hours(cls: type[SignedDuration], n: int) -> SignedDuration: ...
@classmethod
def from_micros(cls: type[SignedDuration], n: int) -> SignedDuration: ...
@classmethod
def from_millis(cls: type[SignedDuration], n: int) -> SignedDuration: ...
@classmethod
def from_mins(cls: type[SignedDuration], n: int) -> SignedDuration: ...
@classmethod
def from_nanos(cls: type[SignedDuration], n: int) -> SignedDuration: ...
@classmethod
def from_secs(cls: type[SignedDuration], n: int) -> SignedDuration: ...
@classmethod
def from_secs_f32(
cls: type[SignedDuration], n: float
) -> SignedDuration: ...
@classmethod
def from_secs_f64(
cls: type[SignedDuration], n: float
) -> SignedDuration: ...
@classmethod
def try_from_secs_f32(
cls: type[SignedDuration], n: float
) -> SignedDuration: ...
@classmethod
def try_from_secs_f64(
cls: type[SignedDuration], n: float
) -> SignedDuration: ...
@property
def is_negative(self) -> bool: ...
@property
def is_zero(self) -> bool: ...
@property
def secs(self) -> int: ...
@property
def nanos(self) -> int: ...
@property
def days(self) -> int: ...
@property
def seconds(self) -> int: ...
@property
def microseconds(self) -> int: ...
def as_hours(self) -> int: ...
def as_micros(self) -> int: ...
def as_millis(self) -> int: ...
def as_millis_f32(self) -> float: ...
def as_millis_f64(self) -> float: ...
def as_mins(self) -> int: ...
def as_nanos(self) -> int: ...
def as_secs(self) -> int: ...
def as_secs_f32(self) -> float: ...
def as_secs_f64(self) -> float: ...
def checked_add(self, other: SignedDuration) -> SignedDuration | None: ...
def checked_div(self, other: int) -> SignedDuration | None: ...
def checked_mul(self, other: int) -> SignedDuration | None: ...
def checked_neg(self) -> SignedDuration | None: ...
def checked_sub(self, other: SignedDuration) -> SignedDuration | None: ...
def div_duration_f32(self, other: SignedDuration) -> float: ...
def div_duration_f64(self, other: SignedDuration) -> float: ...
def div_f32(self, other: int) -> float: ...
def div_f64(self, other: int) -> float: ...
def is_positive(self) -> bool: ...
def mul_f32(self, other: int) -> SignedDuration: ...
def mul_f64(self, other: int) -> SignedDuration: ...
def saturating_add(self, other: SignedDuration) -> SignedDuration: ...
def saturating_mul(self, other: int) -> SignedDuration: ...
def saturating_sub(self, other: SignedDuration) -> SignedDuration: ...
def signum(self) -> t.Literal[-1, 0, 1]: ...
def subsec_micros(self) -> int: ...
def subsec_millis(self) -> int: ...
def subsec_nanos(self) -> int: ...
def to_timespan(self) -> TimeSpan: ...
_TimeSpanArithmeticSingle = TimeSpan | Duration | SignedDuration
_TimeSpanArithmeticTuple = tuple[
_TimeSpanArithmeticSingle, ZonedDateTime | Date | DateTime
]
TimeSpanArithmetic = _TimeSpanArithmeticSingle | _TimeSpanArithmeticTuple
class TimeSpan:
def __init__(
self,
years: int = 0,
months: int = 0,
weeks: int = 0,
days: int = 0,
hours: int = 0,
minutes: int = 0,
seconds: int = 0,
milliseconds: int = 0,
microseconds: int = 0,
nanoseconds: int = 0,
) -> None: ...
def string(self, human: bool = False) -> str: ...
def __str__(self) -> str: ...
def __repr__(self) -> str: ...
def repr_full(self) -> str: ...
@classmethod
def from_pytimedelta(cls, td: pydt.timedelta) -> TimeSpan: ...
def to_pytimedelta(self) -> pydt.timedelta: ...
@classmethod
def parse(cls, s: str) -> TimeSpan: ...
@property
def is_positive(self) -> bool: ...
@property
def is_negative(self) -> bool: ...
@property
def is_zero(self) -> bool: ...
@property
def years(self) -> int: ...
@property
def months(self) -> int: ...
@property
def weeks(self) -> int: ...
@property
def days(self) -> int: ...
@property
def hours(self) -> int: ...
@property
def minutes(self) -> int: ...
@property
def seconds(self) -> int: ...
@property
def milliseconds(self) -> int: ...
@property
def microseconds(self) -> int: ...
@property
def nanoseconds(self) -> int: ...
def __add__(
self,
val: TimeSpanArithmetic,
) -> te.Self: ...
def __sub__(
self,
val: TimeSpanArithmetic,
) -> te.Self: ...
def __mul__(self, other: int) -> te.Self: ...
def __neg__(self) -> te.Self: ...
def __abs__(self) -> te.Self: ...
def __invert__(self) -> te.Self: ...
def __eq__(self, other: object) -> bool: ...
def __ge__(self, other: TimeSpan) -> bool: ...
def __gt__(self, other: TimeSpan) -> bool: ...
def __le__(self, other: TimeSpan) -> bool: ...
def __lt__(self, other: TimeSpan) -> bool: ...
def __ne__(self, other: object) -> bool: ...
def __rmul__(self, other: TimeSpan) -> bool: ...
def __hash__(self) -> int: ...
def abs(self) -> te.Self: ...
def asdict(self) -> TimeSpanTypedDict: ...
def checked_add(self, val: TimeSpanArithmetic) -> te.Self: ...
def checked_mul(self, other: int) -> te.Self: ...
def checked_sub(self, val: TimeSpanArithmetic) -> te.Self: ...
def compare(
self,
other: TimeSpan,
relative: ZonedDateTime | DateTime | Date | None = None,
) -> int: ...
def negate(self) -> te.Self: ...
def replace(
self,
years: int | None = None,
months: int | None = None,
weeks: int | None = None,
days: int | None = None,
hours: int | None = None,
minutes: int | None = None,
seconds: int | None = None,
milliseconds: int | None = None,
microseconds: int | None = None,
nanoseconds: int | None = None,
) -> te.Self: ...
def round(
self,
smallest: JIFF_UNIT_STRING,
increment: int = 1,
*,
relative: ZonedDateTime | Date | DateTime | None = None,
largest: JIFF_UNIT_STRING | None = None,
mode: JIFF_ROUND_MODE_STRING | None = None,
) -> te.Self: ...
def signum(self) -> t.Literal[-1, 0, 1]: ...
def to_signed_duration(
self, relative: ZonedDateTime | Date | DateTime
) -> SignedDuration: ...
def total(
self,
unit: JIFF_UNIT_STRING,
relative: ZonedDateTime | Date | DateTime | None = None,
) -> int: ...
def total_seconds(self) -> int: ...
def try_years(self, years: int) -> te.Self: ...
def try_months(self, months: int) -> te.Self: ...
def try_weeks(self, weeks: int) -> te.Self: ...
def try_days(self, days: int) -> te.Self: ...
def try_hours(self, hours: int) -> te.Self: ...
def try_minutes(self, minutes: int) -> te.Self: ...
def try_seconds(self, seconds: int) -> te.Self: ...
def try_milliseconds(self, milliseconds: int) -> te.Self: ...
def try_microseconds(self, microseconds: int) -> te.Self: ...
def try_nanoseconds(self, nanoseconds: int) -> te.Self: ...
def _years(self, years: int) -> te.Self: ...
def _months(self, months: int) -> te.Self: ...
def _weeks(self, weeks: int) -> te.Self: ...
def _days(self, days: int) -> te.Self: ...
def _hours(self, hours: int) -> te.Self: ...
def _minutes(self, minutes: int) -> te.Self: ...
def _seconds(self, seconds: int) -> te.Self: ...
def _milliseconds(self, milliseconds: int) -> te.Self: ...
def _microseconds(self, microseconds: int) -> te.Self: ...
def _nanoseconds(self, nanoseconds: int) -> te.Self: ...
class Timestamp:
"""
A representation of a timestamp with second and nanosecond precision.
"""
MIN: Timestamp
MAX: Timestamp
UNIX_EPOCH: Timestamp
def __init__(
self, second: int | None = None, nanosecond: int | None = None
) -> None: ...
@classmethod
def now(cls) -> Timestamp: ...
@classmethod
def parse(cls, s: str) -> Timestamp: ...
@classmethod
def from_millisecond(cls, millisecond: int) -> Timestamp: ...
@classmethod
def from_microsecond(cls, microsecond: int) -> Timestamp: ...
@classmethod
def from_nanosecond(cls, nanosecond: int) -> Timestamp: ...
@classmethod
def from_second(cls, second: int) -> Timestamp: ...
def __str__(self) -> str: ...
def __repr__(self) -> str: ...
def __add__(
self, other: TimeSpan | SignedDuration | Duration
) -> te.Self: ...
def __eq__(self, other: object) -> bool: ...
def __ge__(self, other: Timestamp) -> bool: ...
def __gt__(self, other: Timestamp) -> bool: ...
def __iadd__(
self, other: TimeSpan | SignedDuration | Duration
) -> te.Self: ...
def __le__(self, other: Timestamp) -> bool: ...
def __lt__(self, other: Timestamp) -> bool: ...
def __ne__(self, other: object) -> bool: ...
def __richcmp__(self, other: Timestamp, op: int) -> bool: ...
@t.overload
def __isub__(self, other: Timestamp) -> TimeSpan: ...
@t.overload
def __isub__(
self, other: TimeSpan | SignedDuration | Duration
) -> te.Self: ...
@t.overload
def __sub__(self, other: Timestamp) -> TimeSpan: ...
@t.overload
def __sub__(
self, other: TimeSpan | SignedDuration | Duration
) -> te.Self: ...
def strftime(self, format: str) -> str: ...
@classmethod
def strptime(cls, format: str, input: str) -> Timestamp: ...
def as_microsecond(self) -> int: ...
def as_millisecond(self) -> int: ...
def as_nanosecond(self) -> int: ...
def as_second(self) -> int: ...
def checked_add(
self, other: TimeSpan | SignedDuration | Duration
) -> Timestamp: ...
@t.overload
def checked_sub(self, other: Timestamp) -> TimeSpan: ...
@t.overload
def checked_sub(
self, other: TimeSpan | SignedDuration | Duration
) -> Timestamp: ...
def display_with_offset(self, offset: Offset) -> str: ...
def in_tz(self, tz: str) -> ZonedDateTime: ...
def intz(self, tz: str) -> ZonedDateTime:
"""Deprecated ~ use `in_tz`"""
def is_zero(self) -> bool: ...
def saturating_add(
self, other: TimeSpan | SignedDuration | Duration
) -> Timestamp: ...
def saturating_sub(
self, other: TimeSpan | SignedDuration | Duration
) -> Timestamp: ...
def series(self, span: TimeSpan) -> t.Iterator[Timestamp]: ...
def signum(self) -> t.Literal[-1, 0, 1]: ...
def string(self) -> str: ...
def subsec_microsecond(self) -> int: ...
def subsec_millisecond(self) -> int: ...
def subsec_nanosecond(self) -> int: ...
def to_zoned(self, time_zone: TimeZone) -> ZonedDateTime: ...
def _since(self, other: TimestampDifference) -> TimeSpan: ...
def _until(self, other: TimestampDifference) -> TimeSpan: ...
def since(
self,
other: Timestamp | ZonedDateTime,
*,
smallest: JIFF_UNIT_STRING | None = None,
largest: JIFF_UNIT_STRING | None = None,
mode: JIFF_ROUND_MODE_STRING | None = None,
increment: int | None = None,
) -> TimeSpan: ...
def until(
self,
other: Timestamp | ZonedDateTime,
*,
smallest: JIFF_UNIT_STRING | None = None,
largest: JIFF_UNIT_STRING | None = None,
mode: JIFF_ROUND_MODE_STRING | None = None,
increment: int | None = None,
) -> TimeSpan: ...
def duration_since(self, other: Timestamp) -> SignedDuration: ...
def duration_until(self, other: Timestamp) -> SignedDuration: ...
def round(
self,
unit: JIFF_UNIT_STRING | None = None,
mode: JIFF_ROUND_MODE_STRING | None = None,
increment: int | None = None,
) -> Timestamp: ...
def _round(self, options: TimestampRound) -> Timestamp: ...
class TimestampDifference:
def __init__(
self,
date: Timestamp,
*,
smallest: JIFF_UNIT_STRING | None = None,
largest: JIFF_UNIT_STRING | None = None,
mode: JIFF_ROUND_MODE_STRING | None = None,
increment: int | None = None,
) -> None: ...
def __str__(self) -> str: ...
def __repr__(self) -> str: ...
def smallest(self, unit: JIFF_UNIT_STRING) -> TimestampDifference: ...
def largest(self, unit: JIFF_UNIT_STRING) -> TimestampDifference: ...
def mode(self, mode: JIFF_ROUND_MODE_STRING) -> TimestampDifference: ...
def increment(self, increment: int) -> TimestampDifference: ...
class ZonedDateTime:
def __init__(self, timestamp: Timestamp, time_zone: TimeZone) -> None: ...
@classmethod
def from_pydatetime(
cls: type[ZonedDateTime], dt: pydt.datetime
) -> ZonedDateTime: ...
def to_pydatetime(self) -> pydt.datetime: ...
@classmethod
def now(
cls: type[ZonedDateTime], tz: str | None = None
) -> ZonedDateTime: ...
@classmethod
def utcnow(cls: type[ZonedDateTime]) -> ZonedDateTime: ...
@classmethod
def parse(cls: type[ZonedDateTime], s: str) -> ZonedDateTime: ...
@classmethod
def from_rfc2822(cls: type[ZonedDateTime], s: str) -> ZonedDateTime: ...
@classmethod
def strptime(
cls: type[ZonedDateTime], format: str, input: str
) -> ZonedDateTime: ...
def strftime(self, format: str) -> str: ...
@property
def year(self) -> int: ...
@property
def month(self) -> int: ...
@property
def day(self) -> int: ...
@property
def hour(self) -> int: ...
@property
def minute(self) -> int: ...
@property
def second(self) -> int: ...
@property
def millisecond(self) -> int: ...
@property
def microsecond(self) -> int: ...
@property
def nanosecond(self) -> int: ...
@property
def subsec_nanosecond(self) -> int: ...
@property
def weekday(self) -> int: ...
def __str__(self) -> str: ...
def string(self) -> str: ...
def __add__(
self, other: TimeSpan | SignedDuration | Duration
) -> te.Self: ...
def __eq__(self, other: object) -> bool: ...
def __ge__(self, other: ZonedDateTime) -> bool: ...
def __gt__(self, other: ZonedDateTime) -> bool: ...
def __hash__(self) -> int: ...
def __iadd__(
self, other: TimeSpan | SignedDuration | Duration
) -> te.Self: ...
def __le__(self, other: ZonedDateTime) -> bool: ...
def __lt__(self, other: ZonedDateTime) -> bool: ...
def __ne__(self, other: object) -> bool: ...
def __richcmp__(self, other: ZonedDateTime, op: int) -> bool: ...
@t.overload
def __isub__(self, other: ZonedDateTime) -> TimeSpan: ...
@t.overload
def __isub__(
self, other: TimeSpan | SignedDuration | Duration
) -> te.Self: ...
@t.overload
def __sub__(self, other: ZonedDateTime) -> TimeSpan: ...
@t.overload
def __sub__(
self, other: TimeSpan | SignedDuration | Duration
) -> te.Self: ...
def astimezone(self, tz: str) -> ZonedDateTime: ...
def checked_add(
self, other: TimeSpan | SignedDuration | Duration
) -> te.Self: ...
@t.overload
def checked_sub(self, other: ZonedDateTime) -> TimeSpan: ...
@t.overload
def checked_sub(
self, other: TimeSpan | SignedDuration | Duration
) -> te.Self: ...
def date(self) -> Date: ...
def datetime(self) -> DateTime: ...
def iso_week_date(self) -> ISOWeekDate: ...
def day_of_year(self) -> int: ...
def day_of_year_no_leap(self) -> int | None: ...
def days_in_month(self) -> int: ...
def days_in_year(self) -> int: ...
def duration_since(self, other: ZonedDateTime) -> SignedDuration: ...
def duration_until(self, other: ZonedDateTime) -> SignedDuration: ...
def end_of_day(self) -> ZonedDateTime: ...
def era_year(self) -> tuple[int, t.Literal["CE", "BCE"]]: ...
def first_of_month(self) -> ZonedDateTime: ...
def first_of_year(self) -> ZonedDateTime: ...
def in_leap_year(self) -> bool: ...
def in_tz(self, tz: str) -> te.Self: ...
def intz(self, tz: str) -> te.Self: ...
def inutc(self) -> ZonedDateTime: ...
def last_of_month(self) -> ZonedDateTime: ...
def last_of_year(self) -> ZonedDateTime: ...
def nth_weekday(
self, nth: int, weekday: JIFF_WEEKDAY_STRING | JIFF_WEEKDAY_INT
) -> Date: ...
def nth_weekday_of_month(
self, nth: int, weekday: JIFF_WEEKDAY_STRING | JIFF_WEEKDAY_INT
) -> Date: ...
def offset(self) -> Offset: ...
def round(self, options: JIFF_UNIT_STRING | DateTimeRound) -> te.Self: ...
def saturating_add(
self, other: TimeSpan | SignedDuration | Duration
) -> te.Self: ...
@t.overload
def saturating_sub(self, other: ZonedDateTime) -> TimeSpan: ...
@t.overload
def saturating_sub(
self, other: TimeSpan | SignedDuration | Duration
) -> te.Self: ...
def start_of_day(self) -> ZonedDateTime: ...
def time(self) -> Time: ...
def time_zone(self) -> TimeZone: ...
def timestamp(self) -> Timestamp: ...
def timezone(self) -> TimeZone: ...
def to_rfc2822(self) -> str: ...
def tomorrow(self) -> ZonedDateTime: ...
def with_time_zone(self, tz: TimeZone) -> ZonedDateTime: ...
def yesterday(self) -> ZonedDateTime: ...
def since(
self,
other: ZonedDateTime,
*,
smallest: JIFF_UNIT_STRING | None = None,
largest: JIFF_UNIT_STRING | None = None,
mode: JIFF_ROUND_MODE_STRING | None = None,
increment: int | None = None,
) -> TimeSpan: ...
def until(
self,
other: ZonedDateTime,
*,
smallest: JIFF_UNIT_STRING | None = None,
largest: JIFF_UNIT_STRING | None = None,
mode: JIFF_ROUND_MODE_STRING | None = None,
increment: int | None = None,
) -> TimeSpan: ...
class ZonedDateTimeDifference:
def __init__(
self,
date: ZonedDateTime,
*,
smallest: JIFF_UNIT_STRING | None = None,
largest: JIFF_UNIT_STRING | None = None,
mode: JIFF_ROUND_MODE_STRING | None = None,
increment: int | None = None,
) -> None: ...
def __str__(self) -> str: ...
def __repr__(self) -> str: ...
def smallest(self, unit: JIFF_UNIT_STRING) -> ZonedDateTimeDifference: ...
def largest(self, unit: JIFF_UNIT_STRING) -> ZonedDateTimeDifference: ...
def mode(self, mode: JIFF_ROUND_MODE_STRING) -> ZonedDateTimeDifference: ...
def increment(self, increment: int) -> ZonedDateTimeDifference: ...
class ISOWeekDate:
MIN: ISOWeekDate
MAX: ISOWeekDate
ZERO: ISOWeekDate
def __init__(
self,
year: int,
week: int,
weekday: JIFF_WEEKDAY_INT | JIFF_WEEKDAY_STRING,
) -> None: ...
def __eq__(self, other: object) -> bool: ...
def __ne__(self, other: object) -> bool: ...
def __lt__(self, other: ISOWeekDate) -> bool: ...
def __le__(self, other: ISOWeekDate) -> bool: ...
def __gt__(self, other: ISOWeekDate) -> bool: ...
def __ge__(self, other: ISOWeekDate) -> bool: ...
def __hash__(self) -> int: ...
def __repr__(self) -> str: ...
@classmethod
def from_date(cls: type[ISOWeekDate], date: Date) -> ISOWeekDate: ...
@classmethod
def today(cls: type[ISOWeekDate]) -> ISOWeekDate: ...
@property
def year(self) -> int: ...
@property
def week(self) -> int: ...
@property
def weekday(self) -> JIFF_WEEKDAY_INT: ...
def date(self) -> Date: ...
class TimestampRound:
def __init__(
self,
smallest: JIFF_UNIT_STRING | None = None,
mode: JIFF_ROUND_MODE_STRING | None = None,
increment: int = 1,
) -> None: ...
def __str__(self) -> str: ...
def __repr__(self) -> str: ...
def __eq__(self, other: object) -> bool: ...
def mode(self, mode: JIFF_ROUND_MODE_STRING) -> TimestampRound: ...
def smallest(self, smallest: JIFF_UNIT_STRING) -> TimestampRound: ...
def increment(self, increment: int) -> TimestampRound: ...
def _smallest(self) -> JIFF_UNIT_STRING: ...
def _mode(self) -> JIFF_ROUND_MODE_STRING: ...
def _increment(self) -> int: ...
def replace(
self,
smallest: JIFF_UNIT_STRING | None,
mode: JIFF_ROUND_MODE_STRING | None,
increment: int | None,
) -> TimestampRound: ...
class DateTimeRound:
def __init__(
self,
smallest: JIFF_UNIT_STRING | None = None,
mode: JIFF_ROUND_MODE_STRING | None = None,
increment: int = 1,
) -> None: ...
def __str__(self) -> str: ...
def __repr__(self) -> str: ...
def __eq__(self, other: object) -> bool: ...
def mode(self, mode: JIFF_ROUND_MODE_STRING) -> DateTimeRound: ...
def smallest(self, smallest: JIFF_UNIT_STRING) -> DateTimeRound: ...
def increment(self, increment: int) -> DateTimeRound: ...
def _smallest(self) -> JIFF_UNIT_STRING: ...
def _mode(self) -> JIFF_ROUND_MODE_STRING: ...
def _increment(self) -> int: ...
def replace(
self,
smallest: JIFF_UNIT_STRING | None,
mode: JIFF_ROUND_MODE_STRING | None,
increment: int | None,
) -> DateTimeRound: ...
class Offset:
MIN: Offset
MAX: Offset
UTC: Offset
ZERO: Offset
def __init__(
self, hours: int | None = None, seconds: int | None = None
) -> None: ...
def string(self) -> str: ...
def __str__(self) -> str: ...
def __repr__(self) -> str: ...
def __neg__(self) -> Offset: ...
def __eq__(self, other: object) -> bool: ...
def __ne__(self, other: object) -> bool: ...
def __lt__(self, other: Offset) -> bool: ...
def __le__(self, other: Offset) -> bool: ...
def __gt__(self, other: Offset) -> bool: ...
def __ge__(self, other: Offset) -> bool: ...
def __hash__(self) -> int: ...
@property
def seconds(self) -> int: ...
@property
def is_negative(self) -> bool: ...
@property
def is_positive(self) -> bool: ...
@classmethod
def utc(cls: type[Offset]) -> Offset: ...
@classmethod
def from_hours(cls: type[Offset], hours: int) -> Offset: ...
@classmethod
def from_seconds(cls: type[Offset], seconds: int) -> Offset: ...
def to_datetime(self, timestamp: Timestamp) -> DateTime: ...
def to_timestamp(self, datetime: DateTime) -> Timestamp: ...
def to_timezone(self) -> TimeZone: ...
def checked_add(
self, other: Duration | SignedDuration | TimeSpan
) -> Offset: ...
def checked_sub(
self, other: Duration | SignedDuration | TimeSpan
) -> Offset: ...
def duration_since(self, other: Offset) -> SignedDuration: ...
def duration_until(self, other: Offset) -> SignedDuration: ...
def negate(self) -> Offset: ...
def saturating_add(
self, other: Duration | SignedDuration | TimeSpan
) -> Offset: ...
def saturating_sub(
self, other: Duration | SignedDuration | TimeSpan
) -> Offset: ...
def since(self, other: Offset) -> TimeSpan: ...
def until(self, other: Offset) -> TimeSpan: ...
def date(year: int, month: int, day: int) -> Date: ...
def time(
hour: int = 0, minute: int = 0, second: int = 0, nanosecond: int = 0
) -> Time: ...
def datetime(
year: int,
month: int,
day: int,
hour: int = 0,
minute: int = 0,
second: int = 0,
nanosecond: int = 0,
) -> DateTime: ...
def timespan(
*,
years: int = 0,
months: int = 0,
weeks: int = 0,
days: int = 0,
hours: int = 0,
minutes: int = 0,
seconds: int = 0,
milliseconds: int = 0,
microseconds: int = 0,
nanoseconds: int = 0,
unchecked: bool = False,
) -> TimeSpan: ...
def offset(hours: int) -> Offset: ...
ry.dirs
def audio() -> str | None: ...
def audio_dir() -> str | None: ...
def cache() -> str | None: ...
def cache_dir() -> str | None: ...
def config() -> str | None: ...
def config_dir() -> str | None: ...
def config_local() -> str | None: ...
def config_local_dir() -> str | None: ...
def data() -> str | None: ...
def data_dir() -> str | None: ...
def data_local() -> str | None: ...
def data_local_dir() -> str | None: ...
def desktop() -> str | None: ...
def desktop_dir() -> str | None: ...
def document() -> str | None: ...
def document_dir() -> str | None: ...
def download() -> str | None: ...
def download_dir() -> str | None: ...
def executable() -> str | None: ...
def executable_dir() -> str | None: ...
def font() -> str | None: ...
def font_dir() -> str | None: ...
def home() -> str | None: ...
def home_dir() -> str | None: ...
def picture() -> str | None: ...
def picture_dir() -> str | None: ...
def preference() -> str | None: ...
def preference_dir() -> str | None: ...
def public() -> str | None: ...
def public_dir() -> str | None: ...
def runtime() -> str | None: ...
def runtime_dir() -> str | None: ...
def state() -> str | None: ...
def state_dir() -> str | None: ...
def template() -> str | None: ...
def template_dir() -> str | None: ...
def video() -> str | None: ...
def video_dir() -> str | None: ...
ry.http
class Headers:
"""python-ryo3-http `http::HeadersMap` wrapper"""
def __init__(self, headers: dict[str, str]) -> None: ...
def __str__(self) -> str: ...
def __repr__(self) -> str: ...
def __dbg__(self) -> str: ...
def __len__(self) -> int: ...
def __getitem__(self, key: str) -> str: ...
def __setitem__(self, key: str, value: str) -> None: ...
def __delitem__(self, key: str) -> None: ...
def __contains__(self, key: str) -> bool: ...
def __or__(self, other: Headers | dict[str, str]) -> Headers: ...
def append(self, key: str, value: str) -> None: ...
def get(self, key: str) -> str | None: ...
def get_all(self, key: str) -> list[str]: ...
def keys_len(self) -> int: ...
def len(self) -> int: ...
def remove(self, key: str) -> None: ...
def clear(self) -> None: ...
def pop(self, key: str) -> str: ...
def keys(self) -> list[str]: ...
def update(self, headers: Headers | dict[str, str]) -> None: ...
class HttpStatus:
def __init__(self, code: int) -> None: ...
def __int__(self) -> int: ...
def __bool__(self) -> bool: ...
def __str__(self) -> str: ...
def __repr__(self) -> str: ...
def __hash__(self) -> int: ...
def __eq__(self, other: object) -> bool: ...
def __ne__(self, other: object) -> bool: ...
def __lt__(self, other: HttpStatus | int) -> bool: ...
def __le__(self, other: HttpStatus | int) -> bool: ...
def __gt__(self, other: HttpStatus | int) -> bool: ...
def __ge__(self, other: HttpStatus | int) -> bool: ...
def reason(self) -> str: ...
def is_informational(self) -> bool: ...
def is_success(self) -> bool: ...
def is_redirect(self) -> bool: ...
def is_client_error(self) -> bool: ...
def is_server_error(self) -> bool: ...
def is_ok(self) -> bool: ...
@property
def ok(self) -> bool: ...
CONTINUE: HttpStatus
SWITCHING_PROTOCOLS: HttpStatus
PROCESSING: HttpStatus
OK: HttpStatus
CREATED: HttpStatus
ACCEPTED: HttpStatus
NON_AUTHORITATIVE_INFORMATION: (
HttpStatus
)
NO_CONTENT: HttpStatus
RESET_CONTENT: HttpStatus
PARTIAL_CONTENT: HttpStatus
MULTI_STATUS: HttpStatus
ALREADY_REPORTED: HttpStatus
IM_USED: HttpStatus
MULTIPLE_CHOICES: HttpStatus
MOVED_PERMANENTLY: HttpStatus
FOUND: HttpStatus
SEE_OTHER: HttpStatus
NOT_MODIFIED: HttpStatus
USE_PROXY: HttpStatus
TEMPORARY_REDIRECT: HttpStatus
PERMANENT_REDIRECT: HttpStatus
BAD_REQUEST: HttpStatus
UNAUTHORIZED: HttpStatus
PAYMENT_REQUIRED: HttpStatus
FORBIDDEN: HttpStatus
NOT_FOUND: HttpStatus
METHOD_NOT_ALLOWED: HttpStatus
NOT_ACCEPTABLE: HttpStatus
PROXY_AUTHENTICATION_REQUIRED: (
HttpStatus
)
REQUEST_TIMEOUT: HttpStatus
CONFLICT: HttpStatus
GONE: HttpStatus
LENGTH_REQUIRED: HttpStatus
PRECONDITION_FAILED: HttpStatus
PAYLOAD_TOO_LARGE: HttpStatus
URI_TOO_LONG: HttpStatus
UNSUPPORTED_MEDIA_TYPE: HttpStatus
RANGE_NOT_SATISFIABLE: HttpStatus
EXPECTATION_FAILED: HttpStatus
IM_A_TEAPOT: HttpStatus
MISDIRECTED_REQUEST: HttpStatus
UNPROCESSABLE_ENTITY: HttpStatus
LOCKED: HttpStatus
FAILED_DEPENDENCY: HttpStatus
TOO_EARLY: HttpStatus
UPGRADE_REQUIRED: HttpStatus
PRECONDITION_REQUIRED: HttpStatus
TOO_MANY_REQUESTS: HttpStatus
REQUEST_HEADER_FIELDS_TOO_LARGE: (
HttpStatus
)
UNAVAILABLE_FOR_LEGAL_REASONS: (
HttpStatus
)
INTERNAL_SERVER_ERROR: HttpStatus
NOT_IMPLEMENTED: HttpStatus
BAD_GATEWAY: HttpStatus
SERVICE_UNAVAILABLE: HttpStatus
GATEWAY_TIMEOUT: HttpStatus
HTTP_VERSION_NOT_SUPPORTED: HttpStatus
VARIANT_ALSO_NEGOTIATES: HttpStatus
INSUFFICIENT_STORAGE: HttpStatus
LOOP_DETECTED: HttpStatus
NOT_EXTENDED: HttpStatus
NETWORK_AUTHENTICATION_REQUIRED: (
HttpStatus
)
ry.reqwest
import typing as t
import ry
if t.TYPE_CHECKING:
from ry import Duration, Headers
class HttpClient:
def __init__(
self,
*,
headers: dict[str, str] | None = None,
user_agent: str | None = None,
timeout: Duration | None = None,
connect_timeout: Duration | None = None,
read_timeout: Duration | None = None,
gzip: bool = True,
brotli: bool = True,
deflate: bool = True,
) -> None: ...
async def get(
self, url: str, *, headers: dict[str, str] | None = None
) -> Response: ...
async def post(
self,
url: str,
*,
body: bytes | None = None,
headers: dict[str, str] | None = None,
) -> Response: ...
async def put(
self,
url: str,
*,
body: bytes | None = None,
headers: dict[str, str] | None = None,
) -> Response: ...
async def delete(
self, url: str, *, headers: dict[str, str] | None = None
) -> Response: ...
async def patch(
self,
url: str,
*,
body: bytes | None = None,
headers: dict[str, str] | None = None,
) -> Response: ...
async def head(
self, url: str, *, headers: dict[str, str] | None = None
) -> Response: ...
async def fetch(
self,
url: str,
*,
method: str = "GET",
body: bytes | None = None,
headers: dict[str, str] | None = None,
) -> Response: ...
class ReqwestError(Exception):
def __init__(self, *args: t.Any, **kwargs: t.Any) -> None: ...
def __str__(self) -> str: ...
def __repr__(self) -> str: ...
def __dbg__(self) -> str: ...
class Response:
status_code: int
@property
def headers(self) -> Headers: ...
async def text(self) -> str: ...
async def json(self) -> t.Any: ...
async def bytes(self) -> ry.Bytes: ...
def bytes_stream(self) -> ResponseStream: ...
class ResponseStream:
def __aiter__(self) -> ResponseStream: ...
async def __anext__(self) -> ry.Bytes: ...
async def fetch(
url: str,
*,
client: HttpClient | None = None,
method: str = "GET",
body: bytes | None = None,
headers: dict[str, str] | None = None,
) -> Response: ...
ry.xxhash
from __future__ import annotations
import typing as t
@t.final
class Xxh32:
name: t.Literal["xxh32"]
def __init__(self, input: bytes = ..., seed: int | None = ...) -> None: ...
def update(self, input: bytes) -> None: ...
def digest(self) -> bytes: ...
def hexdigest(self) -> str: ...
def intdigest(self) -> int: ...
def copy(self) -> Xxh32: ...
def reset(self, seed: int | None = ...) -> None: ...
@property
def seed(self) -> int: ...
@t.final
class Xxh64:
name: t.Literal["xxh64"]
def __init__(self, input: bytes = ..., seed: int | None = ...) -> None: ...
def update(self, input: bytes) -> None: ...
def digest(self) -> bytes: ...
def hexdigest(self) -> str: ...
def intdigest(self) -> int: ...
def copy(self) -> Xxh32: ...
def reset(self, seed: int | None = ...) -> None: ...
@property
def seed(self) -> int: ...
@t.final
class Xxh3:
name: t.Literal["xxh3"]
def __init__(
self,
input: bytes = ...,
seed: int | None = ...,
secret: bytes | None = ...,
) -> None: ...
def update(self, input: bytes) -> None: ...
def digest(self) -> bytes: ...
def hexdigest(self) -> str: ...
def intdigest(self) -> int: ...
@property
def seed(self) -> int: ...
def digest128(self) -> bytes: ...
def hexdigest128(self) -> str: ...
def intdigest128(self) -> int: ...
def copy(self) -> Xxh3: ...
def reset(self) -> None: ...
def xxh32(input: bytes | None = None, seed: int | None = None) -> Xxh32: ...
def xxh64(input: bytes | None = None, seed: int | None = None) -> Xxh64: ...
def xxh3(
input: bytes | None = None,
seed: int | None = None,
secret: bytes | None = None,
) -> Xxh3: ...
def xxh32_digest(input: bytes, seed: int | None = None) -> bytes: ...
def xxh32_hexdigest(input: bytes, seed: int | None = None) -> str: ...
def xxh32_intdigest(input: bytes, seed: int | None = None) -> int: ...
def xxh64_digest(input: bytes, seed: int | None = None) -> bytes: ...
def xxh64_hexdigest(input: bytes, seed: int | None = None) -> str: ...
def xxh64_intdigest(input: bytes, seed: int | None = None) -> int: ...
def xxh128_digest(input: bytes, seed: int | None = None) -> bytes: ...
def xxh128_hexdigest(input: bytes, seed: int | None = None) -> str: ...
def xxh128_intdigest(input: bytes, seed: int | None = None) -> int: ...
def xxh3_64_digest(input: bytes, seed: int | None = None) -> bytes: ...
def xxh3_64_intdigest(input: bytes, seed: int | None = None) -> int: ...
def xxh3_64_hexdigest(input: bytes, seed: int | None = None) -> str: ...
def xxh3_digest(input: bytes, seed: int | None = None) -> bytes: ...
def xxh3_intdigest(input: bytes, seed: int | None = None) -> int: ...
def xxh3_hexdigest(input: bytes, seed: int | None = None) -> str: ...
def xxh3_128_digest(input: bytes, seed: int | None = None) -> bytes: ...
def xxh3_128_intdigest(input: bytes, seed: int | None = None) -> int: ...
def xxh3_128_hexdigest(input: bytes, seed: int | None = None) -> str: ...
DEV
just
is used to run tasks- Do not use the phrase
blazing fast
or any emojis in any PRs or issues or
docs - type annotations are required
ruff
used for formatting and linting
SEE ALSO