jetpytools 1.7.2__tar.gz → 1.7.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of jetpytools might be problematic. Click here for more details.

Files changed (34) hide show
  1. {jetpytools-1.7.2 → jetpytools-1.7.3}/PKG-INFO +1 -1
  2. {jetpytools-1.7.2 → jetpytools-1.7.3}/jetpytools/_metadata.py +1 -1
  3. {jetpytools-1.7.2 → jetpytools-1.7.3}/jetpytools/types/generic.py +1 -1
  4. {jetpytools-1.7.2 → jetpytools-1.7.3}/jetpytools/types/utils.py +26 -13
  5. {jetpytools-1.7.2 → jetpytools-1.7.3}/jetpytools/utils/file.py +2 -1
  6. {jetpytools-1.7.2 → jetpytools-1.7.3}/.gitignore +0 -0
  7. {jetpytools-1.7.2 → jetpytools-1.7.3}/LICENSE +0 -0
  8. {jetpytools-1.7.2 → jetpytools-1.7.3}/README.md +0 -0
  9. {jetpytools-1.7.2 → jetpytools-1.7.3}/jetpytools/__init__.py +0 -0
  10. {jetpytools-1.7.2 → jetpytools-1.7.3}/jetpytools/enums/__init__.py +0 -0
  11. {jetpytools-1.7.2 → jetpytools-1.7.3}/jetpytools/enums/base.py +0 -0
  12. {jetpytools-1.7.2 → jetpytools-1.7.3}/jetpytools/enums/other.py +0 -0
  13. {jetpytools-1.7.2 → jetpytools-1.7.3}/jetpytools/exceptions/__init__.py +0 -0
  14. {jetpytools-1.7.2 → jetpytools-1.7.3}/jetpytools/exceptions/base.py +0 -0
  15. {jetpytools-1.7.2 → jetpytools-1.7.3}/jetpytools/exceptions/enum.py +0 -0
  16. {jetpytools-1.7.2 → jetpytools-1.7.3}/jetpytools/exceptions/file.py +0 -0
  17. {jetpytools-1.7.2 → jetpytools-1.7.3}/jetpytools/exceptions/generic.py +0 -0
  18. {jetpytools-1.7.2 → jetpytools-1.7.3}/jetpytools/exceptions/module.py +0 -0
  19. {jetpytools-1.7.2 → jetpytools-1.7.3}/jetpytools/functions/__init__.py +0 -0
  20. {jetpytools-1.7.2 → jetpytools-1.7.3}/jetpytools/functions/funcs.py +0 -0
  21. {jetpytools-1.7.2 → jetpytools-1.7.3}/jetpytools/functions/normalize.py +0 -0
  22. {jetpytools-1.7.2 → jetpytools-1.7.3}/jetpytools/functions/other.py +0 -0
  23. {jetpytools-1.7.2 → jetpytools-1.7.3}/jetpytools/py.typed +0 -0
  24. {jetpytools-1.7.2 → jetpytools-1.7.3}/jetpytools/types/__init__.py +0 -0
  25. {jetpytools-1.7.2 → jetpytools-1.7.3}/jetpytools/types/builtins.py +0 -0
  26. {jetpytools-1.7.2 → jetpytools-1.7.3}/jetpytools/types/check.py +0 -0
  27. {jetpytools-1.7.2 → jetpytools-1.7.3}/jetpytools/types/file.py +0 -0
  28. {jetpytools-1.7.2 → jetpytools-1.7.3}/jetpytools/types/funcs.py +0 -0
  29. {jetpytools-1.7.2 → jetpytools-1.7.3}/jetpytools/types/supports.py +0 -0
  30. {jetpytools-1.7.2 → jetpytools-1.7.3}/jetpytools/utils/__init__.py +0 -0
  31. {jetpytools-1.7.2 → jetpytools-1.7.3}/jetpytools/utils/funcs.py +0 -0
  32. {jetpytools-1.7.2 → jetpytools-1.7.3}/jetpytools/utils/math.py +0 -0
  33. {jetpytools-1.7.2 → jetpytools-1.7.3}/jetpytools/utils/ranges.py +0 -0
  34. {jetpytools-1.7.2 → jetpytools-1.7.3}/pyproject.toml +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: jetpytools
3
- Version: 1.7.2
3
+ Version: 1.7.3
4
4
  Summary: Collection of stuff that's useful in general python programming
5
5
  Project-URL: Source Code, https://github.com/Jaded-Encoding-Thaumaturgy/jetpytools
6
6
  Project-URL: Contact, https://discord.gg/XTpc6Fa9eB
@@ -1,6 +1,6 @@
1
1
  """Collection of stuff that's useful in general python programming"""
2
2
 
3
- __version__ = "1.7.2"
3
+ __version__ = "1.7.3"
4
4
 
5
5
  __author_name__, __author_email__ = "Jaded Encoding Thaumaturgy", "jaded.encoding.thaumaturgy@gmail.com"
6
6
  __maintainer_name__, __maintainer_email__ = __author_name__, __author_email__
@@ -6,7 +6,7 @@ from typing import Any, Callable, Literal, TypeAlias, Union
6
6
  from .builtins import F, SingleOrArr, SingleOrArrOpt
7
7
  from .supports import SupportsString
8
8
 
9
- __all__ = ["MISSING", "DataType", "FuncExcept", "MissingT", "PassthroughC", "StrArr", "StrArrOpt"]
9
+ __all__ = ["MISSING", "DataType", "FuncExcept", "FuncExceptT", "MissingT", "PassthroughC", "StrArr", "StrArrOpt"]
10
10
 
11
11
 
12
12
  class _MissingType(Enum):
@@ -23,7 +23,7 @@ from typing import (
23
23
  overload,
24
24
  )
25
25
 
26
- from typing_extensions import Self, deprecated
26
+ from typing_extensions import Self, TypeVar, deprecated
27
27
 
28
28
  from .builtins import F0, F1, P0, P1, R0, R1, T0, KwargsT, P, R, R0_co, R1_co, R_co, T, T0_co, T1_co, T_co
29
29
 
@@ -43,9 +43,9 @@ __all__ = [
43
43
  # ruff: noqa: N801
44
44
 
45
45
 
46
- class copy_signature(Generic[F0]):
46
+ def copy_signature(target: F0, /) -> Callable[[Callable[..., Any]], F0]:
47
47
  """
48
- Type util to copy the signature of one function to another function.
48
+ Utility function to copy the signature of one function to another one.
49
49
 
50
50
  Especially useful for passthrough functions.
51
51
 
@@ -71,12 +71,11 @@ class copy_signature(Generic[F0]):
71
71
  # another thing
72
72
  """
73
73
 
74
- def __init__(self, target: F0) -> None:
75
- """Copy the signature of ``target``."""
76
-
77
- def __call__(self, wrapped: Callable[..., Any]) -> F0:
74
+ def decorator(wrapped: Callable[..., Any]) -> F0:
78
75
  return cast(F0, wrapped)
79
76
 
77
+ return decorator
78
+
80
79
 
81
80
  class injected_self_func(Protocol[T_co, P, R_co]):
82
81
  @overload
@@ -517,7 +516,10 @@ class classproperty(classproperty_base[T, R_co]):
517
516
  del cache[name]
518
517
 
519
518
 
520
- class cachedproperty(property, Generic[R_co]):
519
+ _T_cc = TypeVar("_T_cc", default=Any)
520
+
521
+
522
+ class cachedproperty(property, Generic[R_co, _T_cc]):
521
523
  """
522
524
  Wrapper for a one-time get property, that will be cached.
523
525
 
@@ -539,16 +541,16 @@ class cachedproperty(property, Generic[R_co]):
539
541
  def __init__(
540
542
  self,
541
543
  fget: Callable[[Any], R_co],
542
- fset: Callable[[Any, Any], None] | None = None,
544
+ fset: Callable[[Any, _T_cc], None] | None = None,
543
545
  fdel: Callable[[Any], None] | None = None,
544
546
  doc: str | None = None,
545
547
  ) -> None: ...
546
548
 
547
- def getter(self, fget: Callable[..., R_co]) -> cachedproperty[R_co]: ...
549
+ def getter(self, fget: Callable[..., R_co]) -> cachedproperty[R_co, _T_cc]: ...
548
550
 
549
- def setter(self, fset: Callable[[Any, Any], None]) -> cachedproperty[R_co]: ...
551
+ def setter(self, fset: Callable[[Any, _T_cc], None]) -> cachedproperty[R_co, _T_cc]: ...
550
552
 
551
- def deleter(self, fdel: Callable[..., None]) -> cachedproperty[R_co]: ...
553
+ def deleter(self, fdel: Callable[..., None]) -> cachedproperty[R_co, _T_cc]: ...
552
554
 
553
555
  if sys.version_info < (3, 13):
554
556
 
@@ -573,7 +575,7 @@ class cachedproperty(property, Generic[R_co]):
573
575
  cache[self.__name__] = value
574
576
  return value
575
577
 
576
- def __set__(self, instance: Any, value: Any) -> None:
578
+ def __set__(self, instance: Any, value: _T_cc) -> None:
577
579
  if self.__name__ in (cache := instance.__dict__.setdefault(self.cache_key, {})):
578
580
  del cache[self.__name__]
579
581
 
@@ -605,6 +607,17 @@ class cachedproperty(property, Generic[R_co]):
605
607
  with suppress(KeyError):
606
608
  del cache[name]
607
609
 
610
+ @classmethod
611
+ def update_cache(cls, obj: object, name: str, value: Any) -> None:
612
+ """
613
+ Update cached property of an object instance.
614
+
615
+ :param obj: The object whose cache should be updated.
616
+ :param names: Property name to update.
617
+ :param value: The value to assign.
618
+ """
619
+ obj.__dict__.setdefault(cls.cache_key, {})[name] = value
620
+
608
621
 
609
622
  class KwargsNotNone(KwargsT):
610
623
  """Remove all None objects from this kwargs dict."""
@@ -48,7 +48,8 @@ def get_script_path() -> SPath:
48
48
  import __main__
49
49
 
50
50
  try:
51
- return SPath(__main__.__file__)
51
+ path = SPath(__main__.__file__)
52
+ return path if path.exists() else SPath.cwd()
52
53
  except AttributeError:
53
54
  return SPath.cwd()
54
55
 
File without changes
File without changes
File without changes
File without changes