Skip to content

Commit

Permalink
fix docs
Browse files Browse the repository at this point in the history
  • Loading branch information
jessekrubin committed Feb 26, 2025
1 parent c6b50aa commit 4caa06b
Show file tree
Hide file tree
Showing 2 changed files with 122 additions and 92 deletions.
107 changes: 61 additions & 46 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,13 @@ ___
```python
"""ry api ~ type annotations"""

from __future__ import annotations

import datetime as pydt
import typing as t
from os import PathLike
from pathlib import Path

import typing_extensions as te

from ry._types import Buffer

from . import http as http
Expand Down Expand Up @@ -143,6 +143,13 @@ 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 ._jiter import JsonParseKwargs as JsonParseKwargs
from ._jiter import JsonPrimitive as JsonPrimitive
from ._jiter import JsonValue as JsonValue
from ._jiter import json_cache_clear as json_cache_clear
from ._jiter import json_cache_usage as json_cache_usage
from ._jiter import parse_json as parse_json
from ._jiter import parse_json_bytes as parse_json_bytes
from ._size import SizeFormatter as SizeFormatter
from ._size import fmt_size as fmt_size
from ._size import parse_size as parse_size
Expand All @@ -167,12 +174,6 @@ __description__: str
# =============================================================================
# TYPE ALIASES
# =============================================================================
JsonPrimitive = None | bool | int | float | str
JsonValue = (
JsonPrimitive
| dict[str, JsonPrimitive | JsonValue]
| list[JsonPrimitive | JsonValue]
)

# =============================================================================
# STD
Expand Down Expand Up @@ -374,12 +375,14 @@ class FsPath:
def __truediv__(self, other: PathLike[str] | str) -> FsPath: ...
def __rtruediv__(self, other: PathLike[str] | str) -> FsPath: ...
def to_pathlib(self) -> Path: ...
def read(self) -> Bytes: ...
def read_text(self) -> str: ...
def read_bytes(self) -> bytes: ...
def absolute(self) -> FsPath: ...
def resolve(self) -> FsPath: ...
def write(self, data: Buffer | bytes) -> None: ...
def write_bytes(self, data: Buffer | bytes) -> None: ...
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: ...
Expand Down Expand Up @@ -746,43 +749,6 @@ def shplit(s: str) -> list[str]:
...


# =============================================================================
# JSON
# =============================================================================


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: ...


# =============================================================================
# FORMATTING
# =============================================================================
Expand Down Expand Up @@ -2655,6 +2621,55 @@ def timespan(
) -> TimeSpan: ...
def offset(hours: int) -> Offset: ...

```
## `ry._jiter`

```python
from __future__ import annotations

import typing as t

import typing_extensions as te

from ry._types import Buffer

# =============================================================================
# JSON
# =============================================================================
JsonPrimitive = None | bool | int | float | str
JsonValue = (
JsonPrimitive
| dict[str, JsonPrimitive | JsonValue]
| list[JsonPrimitive | JsonValue]
)


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: Buffer | bytes | str,
/,
**kwargs: te.Unpack[JsonParseKwargs],
) -> JsonValue: ...
def parse_json_bytes(
data: bytes,
/,
**kwargs: te.Unpack[JsonParseKwargs],
) -> JsonValue: ...
def json_cache_clear() -> None: ...
def json_cache_usage() -> int: ...

```
## `ry._size`

Expand Down
107 changes: 61 additions & 46 deletions docs/src/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
```python
"""ry api ~ type annotations"""

from __future__ import annotations

import datetime as pydt
import typing as t
from os import PathLike
from pathlib import Path

import typing_extensions as te

from ry._types import Buffer

from . import http as http
Expand Down Expand Up @@ -39,6 +39,13 @@ 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 ._jiter import JsonParseKwargs as JsonParseKwargs
from ._jiter import JsonPrimitive as JsonPrimitive
from ._jiter import JsonValue as JsonValue
from ._jiter import json_cache_clear as json_cache_clear
from ._jiter import json_cache_usage as json_cache_usage
from ._jiter import parse_json as parse_json
from ._jiter import parse_json_bytes as parse_json_bytes
from ._size import SizeFormatter as SizeFormatter
from ._size import fmt_size as fmt_size
from ._size import parse_size as parse_size
Expand All @@ -63,12 +70,6 @@ __description__: str
# =============================================================================
# TYPE ALIASES
# =============================================================================
JsonPrimitive = None | bool | int | float | str
JsonValue = (
JsonPrimitive
| dict[str, JsonPrimitive | JsonValue]
| list[JsonPrimitive | JsonValue]
)

# =============================================================================
# STD
Expand Down Expand Up @@ -270,12 +271,14 @@ class FsPath:
def __truediv__(self, other: PathLike[str] | str) -> FsPath: ...
def __rtruediv__(self, other: PathLike[str] | str) -> FsPath: ...
def to_pathlib(self) -> Path: ...
def read(self) -> Bytes: ...
def read_text(self) -> str: ...
def read_bytes(self) -> bytes: ...
def absolute(self) -> FsPath: ...
def resolve(self) -> FsPath: ...
def write(self, data: Buffer | bytes) -> None: ...
def write_bytes(self, data: Buffer | bytes) -> None: ...
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: ...
Expand Down Expand Up @@ -642,43 +645,6 @@ def shplit(s: str) -> list[str]:
...


# =============================================================================
# JSON
# =============================================================================


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: ...


# =============================================================================
# FORMATTING
# =============================================================================
Expand Down Expand Up @@ -2551,6 +2517,55 @@ def timespan(
) -> TimeSpan: ...
def offset(hours: int) -> Offset: ...

```
## `ry._jiter`

```python
from __future__ import annotations

import typing as t

import typing_extensions as te

from ry._types import Buffer

# =============================================================================
# JSON
# =============================================================================
JsonPrimitive = None | bool | int | float | str
JsonValue = (
JsonPrimitive
| dict[str, JsonPrimitive | JsonValue]
| list[JsonPrimitive | JsonValue]
)


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: Buffer | bytes | str,
/,
**kwargs: te.Unpack[JsonParseKwargs],
) -> JsonValue: ...
def parse_json_bytes(
data: bytes,
/,
**kwargs: te.Unpack[JsonParseKwargs],
) -> JsonValue: ...
def json_cache_clear() -> None: ...
def json_cache_usage() -> int: ...

```
## `ry._size`

Expand Down

0 comments on commit 4caa06b

Please sign in to comment.