Skip to content

Commit

Permalink
added deepfreeze, register, unregister to __init__.pyi (resolves #99)
Browse files Browse the repository at this point in the history
  • Loading branch information
Marco-Sulla committed May 5, 2024
1 parent 66259cd commit ebc3e1e
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion src/frozendict/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
from __future__ import annotations

from typing import TypeVar, overload, Optional, Union
from typing import (
TypeVar,
overload,
Optional,
Union,
Any,
Dict,
Callable,
)

from collections.abc import Hashable

try:
from typing import Mapping, Iterable, Iterator, Tuple, Type
Expand Down Expand Up @@ -91,3 +101,23 @@ class FreezeError(Exception): pass


class FreezeWarning(UserWarning): pass

# PyCharm complains about returning Hashable, because
# it's not subscriptable
def deepfreeze(
o: Any,
custom_converters: Optional[Dict[Any, Callable[[Any], Hashable]]] = None,
custom_inverse_converters: Optional[Dict[Any, Callable[[Any], Any]]] = None
) -> Any: ...

def register(
to_convert: Any,
converter: Callable[[Any], Any],
*,
inverse: bool = False
) -> None: ...

def unregister(
type: Any,
inverse: bool = False
) -> None: ...

0 comments on commit ebc3e1e

Please sign in to comment.