jetpytools 1.2.6__tar.gz → 1.2.8__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 (38) hide show
  1. {jetpytools-1.2.6 → jetpytools-1.2.8}/PKG-INFO +3 -2
  2. {jetpytools-1.2.6 → jetpytools-1.2.8}/jetpytools/_metadata.py +1 -1
  3. {jetpytools-1.2.6 → jetpytools-1.2.8}/jetpytools/enums/base.py +5 -1
  4. {jetpytools-1.2.6 → jetpytools-1.2.8}/jetpytools/exceptions/generic.py +2 -2
  5. {jetpytools-1.2.6 → jetpytools-1.2.8}/jetpytools/types/builtins.py +9 -2
  6. {jetpytools-1.2.6 → jetpytools-1.2.8}/jetpytools/types/utils.py +23 -9
  7. {jetpytools-1.2.6 → jetpytools-1.2.8}/jetpytools.egg-info/PKG-INFO +3 -2
  8. {jetpytools-1.2.6 → jetpytools-1.2.8}/LICENSE +0 -0
  9. {jetpytools-1.2.6 → jetpytools-1.2.8}/README.md +0 -0
  10. {jetpytools-1.2.6 → jetpytools-1.2.8}/jetpytools/__init__.py +0 -0
  11. {jetpytools-1.2.6 → jetpytools-1.2.8}/jetpytools/enums/__init__.py +0 -0
  12. {jetpytools-1.2.6 → jetpytools-1.2.8}/jetpytools/enums/other.py +0 -0
  13. {jetpytools-1.2.6 → jetpytools-1.2.8}/jetpytools/exceptions/__init__.py +0 -0
  14. {jetpytools-1.2.6 → jetpytools-1.2.8}/jetpytools/exceptions/base.py +0 -0
  15. {jetpytools-1.2.6 → jetpytools-1.2.8}/jetpytools/exceptions/enum.py +0 -0
  16. {jetpytools-1.2.6 → jetpytools-1.2.8}/jetpytools/exceptions/file.py +0 -0
  17. {jetpytools-1.2.6 → jetpytools-1.2.8}/jetpytools/exceptions/module.py +0 -0
  18. {jetpytools-1.2.6 → jetpytools-1.2.8}/jetpytools/functions/__init__.py +0 -0
  19. {jetpytools-1.2.6 → jetpytools-1.2.8}/jetpytools/functions/funcs.py +0 -0
  20. {jetpytools-1.2.6 → jetpytools-1.2.8}/jetpytools/functions/normalize.py +0 -0
  21. {jetpytools-1.2.6 → jetpytools-1.2.8}/jetpytools/functions/other.py +0 -0
  22. {jetpytools-1.2.6 → jetpytools-1.2.8}/jetpytools/py.typed +0 -0
  23. {jetpytools-1.2.6 → jetpytools-1.2.8}/jetpytools/types/__init__.py +0 -0
  24. {jetpytools-1.2.6 → jetpytools-1.2.8}/jetpytools/types/check.py +0 -0
  25. {jetpytools-1.2.6 → jetpytools-1.2.8}/jetpytools/types/file.py +0 -0
  26. {jetpytools-1.2.6 → jetpytools-1.2.8}/jetpytools/types/funcs.py +0 -0
  27. {jetpytools-1.2.6 → jetpytools-1.2.8}/jetpytools/types/generic.py +0 -0
  28. {jetpytools-1.2.6 → jetpytools-1.2.8}/jetpytools/types/supports.py +0 -0
  29. {jetpytools-1.2.6 → jetpytools-1.2.8}/jetpytools/utils/__init__.py +0 -0
  30. {jetpytools-1.2.6 → jetpytools-1.2.8}/jetpytools/utils/file.py +0 -0
  31. {jetpytools-1.2.6 → jetpytools-1.2.8}/jetpytools/utils/funcs.py +0 -0
  32. {jetpytools-1.2.6 → jetpytools-1.2.8}/jetpytools/utils/math.py +0 -0
  33. {jetpytools-1.2.6 → jetpytools-1.2.8}/jetpytools/utils/ranges.py +0 -0
  34. {jetpytools-1.2.6 → jetpytools-1.2.8}/jetpytools.egg-info/SOURCES.txt +0 -0
  35. {jetpytools-1.2.6 → jetpytools-1.2.8}/jetpytools.egg-info/dependency_links.txt +0 -0
  36. {jetpytools-1.2.6 → jetpytools-1.2.8}/jetpytools.egg-info/top_level.txt +0 -0
  37. {jetpytools-1.2.6 → jetpytools-1.2.8}/setup.cfg +0 -0
  38. {jetpytools-1.2.6 → jetpytools-1.2.8}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: jetpytools
3
- Version: 1.2.6
3
+ Version: 1.2.8
4
4
  Summary: Collection of stuff that's useful in general python programming
5
5
  Author: Jaded Encoding Thaumaturgy
6
6
  Author-email: jaded.encoding.thaumaturgy@gmail.com
@@ -23,6 +23,7 @@ Dynamic: author-email
23
23
  Dynamic: classifier
24
24
  Dynamic: description
25
25
  Dynamic: description-content-type
26
+ Dynamic: license-file
26
27
  Dynamic: maintainer
27
28
  Dynamic: maintainer-email
28
29
  Dynamic: project-url
@@ -1,6 +1,6 @@
1
1
  """Collection of stuff that's useful in general python programming"""
2
2
 
3
- __version__ = '1.2.6'
3
+ __version__ = '1.2.8'
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__
@@ -1,7 +1,7 @@
1
1
  from __future__ import annotations
2
2
 
3
3
  from enum import Enum
4
- from typing import Any
4
+ from typing import Any, TypeVar
5
5
 
6
6
  from typing_extensions import Self
7
7
 
@@ -9,6 +9,7 @@ from ..exceptions import CustomValueError, NotFoundEnumValue
9
9
  from ..types import FuncExceptT
10
10
 
11
11
  __all__ = [
12
+ 'SelfEnum',
12
13
  'CustomEnum', 'CustomIntEnum', 'CustomStrEnum'
13
14
  ]
14
15
 
@@ -74,3 +75,6 @@ class CustomStrEnum(str, CustomEnum):
74
75
  """Base class for custom str enums."""
75
76
 
76
77
  value: str
78
+
79
+
80
+ SelfEnum = TypeVar('SelfEnum', bound=CustomEnum)
@@ -28,7 +28,7 @@ class MismatchError(CustomValueError):
28
28
  super().__init__(message, func, reason, **kwargs, reduced_items=iter(self._reduce(items)))
29
29
 
30
30
  @classmethod
31
- def check(cls, func: FuncExceptT, *items: Any, **kwargs: Any) -> None:
31
+ def check(cls, func: FuncExceptT, /, *items: Any, **kwargs: Any) -> None:
32
32
  if len(cls._reduce(items)) != 1:
33
33
  raise cls(func, items, **kwargs)
34
34
 
@@ -40,6 +40,6 @@ class MismatchRefError(MismatchError):
40
40
  super().__init__(func, [base, ref], message, **kwargs)
41
41
 
42
42
  @classmethod
43
- def check(cls, func: FuncExceptT, *items: Any, **kwargs: Any) -> None:
43
+ def check(cls, func: FuncExceptT, /, *items: Any, **kwargs: Any) -> None:
44
44
  if len(cls._reduce(items)) != 1:
45
45
  raise cls(func, *items, **kwargs)
@@ -8,7 +8,7 @@ __all__ = [
8
8
  'F', 'F0', 'F1', 'F2',
9
9
 
10
10
  'P', 'P0', 'P1', 'P2',
11
- 'R', 'R0', 'R1', 'R2', 'R_contra',
11
+ 'R', 'R0', 'R1', 'R2', 'R_co', 'R0_co', 'R_contra',
12
12
 
13
13
  'Nb',
14
14
 
@@ -20,9 +20,13 @@ __all__ = [
20
20
  'SimpleByteData', 'SimpleByteDataArray',
21
21
  'ByteData',
22
22
 
23
- 'KwargsT'
23
+ 'KwargsT',
24
+
25
+ 'Self'
24
26
  ]
25
27
 
28
+ Self = TypeVar('Self')
29
+
26
30
  Nb = TypeVar('Nb', float, int)
27
31
 
28
32
  T = TypeVar('T')
@@ -45,6 +49,9 @@ R0 = TypeVar('R0')
45
49
  R1 = TypeVar('R1')
46
50
  R2 = TypeVar('R2')
47
51
 
52
+ R_co = TypeVar('R_co', covariant=True)
53
+ R0_co = TypeVar('R0_co', covariant=True)
54
+
48
55
  T_contra = TypeVar('T_contra', contravariant=True)
49
56
  R_contra = TypeVar('R_contra', contravariant=True)
50
57
 
@@ -8,8 +8,9 @@ from typing import (
8
8
  TYPE_CHECKING, Any, Callable, Concatenate, Generator, Generic, Iterable, Iterator, Mapping,
9
9
  NoReturn, Protocol, Sequence, TypeVar, cast, overload
10
10
  )
11
+ from typing_extensions import Self
11
12
 
12
- from .builtins import F0, F1, P0, P1, R0, R1, T0, T1, T2, KwargsT, P, R, T
13
+ from .builtins import F0, F1, P0, P1, R0, R1, T0, T1, T2, KwargsT, P, R, R_co, R0_co, T
13
14
 
14
15
  __all__ = [
15
16
  'copy_signature',
@@ -508,7 +509,7 @@ class classproperty(Generic[P, R, T, T0, P0]):
508
509
  return self.fget.__name__
509
510
 
510
511
 
511
- class cachedproperty(property, Generic[P, R, T, T0, P0]):
512
+ class cachedproperty(property, Generic[P, R_co, T, T0, P0]):
512
513
  """
513
514
  Wrapper for a one-time get property, that will be cached.
514
515
 
@@ -537,21 +538,29 @@ class cachedproperty(property, Generic[P, R, T, T0, P0]):
537
538
 
538
539
  if TYPE_CHECKING:
539
540
  def __init__(
540
- self, fget: Callable[P, R], fset: Callable[[T, T0], None] | None = None,
541
+ self, fget: Callable[P, R_co], fset: Callable[[T, T0], None] | None = None,
541
542
  fdel: Callable[P0, None] | None = None, doc: str | None = None,
542
543
  ) -> None:
543
544
  ...
544
545
 
545
- def getter(self, __fget: Callable[P1, R1]) -> cachedproperty[P1, R1, T, T0, P0]:
546
+ def getter(self, __fget: Callable[P1, R0_co]) -> cachedproperty[P1, R0_co, T, T0, P0]:
546
547
  ...
547
548
 
548
- def setter(self, __fset: Callable[[T1, T2], None]) -> cachedproperty[P, R, T1, T2, P0]:
549
+ def setter(self, __fset: Callable[[T1, T2], None]) -> cachedproperty[P, R_co, T1, T2, P0]:
549
550
  ...
550
551
 
551
- def deleter(self, __fdel: Callable[P1, None]) -> cachedproperty[P, R, T, T0, P1]:
552
+ def deleter(self, __fdel: Callable[P1, None]) -> cachedproperty[P, R_co, T, T0, P1]:
552
553
  ...
553
554
 
554
- def __get__(self, __obj: Any, __type: type | None = None) -> R:
555
+ @overload
556
+ def __get__(self, __obj: None, __type: type | None = None) -> Self:
557
+ ...
558
+
559
+ @overload
560
+ def __get__(self, __obj: object, __type: type | None = None) -> R_co:
561
+ ...
562
+
563
+ def __get__(self, __obj: Any, __type: type | None = None) -> Any:
555
564
  if isinstance(self.fget, classproperty):
556
565
  function = partial(self.fget.__get__, __obj, __type) # type: ignore
557
566
  __obj = __type
@@ -562,14 +571,19 @@ class cachedproperty(property, Generic[P, R, T, T0, P0]):
562
571
  cache = getattr(__obj, cachedproperty.cache_key)
563
572
  name = self.fget.__name__
564
573
  else:
565
- function = self.fget.__get__(__obj, __type) # type: ignore
574
+ assert self.fget
575
+ function = self.fget.__get__(__obj, __type)
566
576
  cache = __obj.__dict__.get(cachedproperty.cache_key)
567
577
  name = function.__name__
568
578
 
569
579
  if name not in cache:
570
580
  cache[name] = function()
571
581
 
572
- return cache[name] # type: ignore
582
+ return cache[name]
583
+
584
+ if TYPE_CHECKING:
585
+ def __set__(self, obj: Any, value: R_co, /) -> None: # type: ignore[misc]
586
+ ...
573
587
 
574
588
 
575
589
  class KwargsNotNone(KwargsT):
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: jetpytools
3
- Version: 1.2.6
3
+ Version: 1.2.8
4
4
  Summary: Collection of stuff that's useful in general python programming
5
5
  Author: Jaded Encoding Thaumaturgy
6
6
  Author-email: jaded.encoding.thaumaturgy@gmail.com
@@ -23,6 +23,7 @@ Dynamic: author-email
23
23
  Dynamic: classifier
24
24
  Dynamic: description
25
25
  Dynamic: description-content-type
26
+ Dynamic: license-file
26
27
  Dynamic: maintainer
27
28
  Dynamic: maintainer-email
28
29
  Dynamic: project-url
File without changes
File without changes
File without changes
File without changes