jetpytools 1.2.6__py3-none-any.whl → 1.2.8__py3-none-any.whl

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.

jetpytools/_metadata.py CHANGED
@@ -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__
jetpytools/enums/base.py CHANGED
@@ -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
 
jetpytools/types/utils.py CHANGED
@@ -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
@@ -1,34 +1,34 @@
1
1
  jetpytools/__init__.py,sha256=FSVZdj69oy4mBXd6OXiRHrUhaSc4Exo1pQHBlXycV98,214
2
- jetpytools/_metadata.py,sha256=gPE9uEfY35fkXX2o9N0QVQe3EPMGwGEeJgu4ZK5CPmk,414
2
+ jetpytools/_metadata.py,sha256=dHrH7etfneDpwolPNtKsiYRP2pispFzW4GiV141azFs,414
3
3
  jetpytools/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  jetpytools/enums/__init__.py,sha256=5n6Cu8Yb9N6hIa_YTsyy_s0cCgCnh0vDb-NyXK2RwV0,81
5
- jetpytools/enums/base.py,sha256=m3jJ6rJwDm4vp2-qMsuRH-Ll2mQDXA-wkmhw4xaafTM,2003
5
+ jetpytools/enums/base.py,sha256=BbePlmj__Vqc7gzhrbZBFnrQcC9WNBjtiBYoXpgVNOA,2079
6
6
  jetpytools/enums/other.py,sha256=DerFtmdjNK41ZxSYt601vHV5yzvZHPfTKNDlj-FjHm8,1346
7
7
  jetpytools/exceptions/__init__.py,sha256=g8GT0XqcNuHFHgQGSRj6a_X1kBiBQGP05soYNbEIN_Q,205
8
8
  jetpytools/exceptions/base.py,sha256=ESwC7H8iCQW9DGMGmaoFwIiid98tE1e6sATjOH_7Duc,6370
9
9
  jetpytools/exceptions/enum.py,sha256=9YoWwEfyd9k7NwanAqtXbhJaJQAnjRKqsAO73cDvcpA,223
10
10
  jetpytools/exceptions/file.py,sha256=QwhUFAoG3NsFFYuPe5O_I6K969CzlrTCv3RTrfzx8B0,1107
11
- jetpytools/exceptions/generic.py,sha256=z6wHUNEAZvn258DA629SLNzE-cPJAJ7GuiJnsDZl93I,1476
11
+ jetpytools/exceptions/generic.py,sha256=kMj5lR3ifHk3uNhpxN6Lu4Am0vi7E6TfQezkZulqhaQ,1482
12
12
  jetpytools/exceptions/module.py,sha256=drkcpa8hcE7Ee20N15j3qsX_grl8a3Jjv10XJ3xtDmE,1207
13
13
  jetpytools/functions/__init__.py,sha256=CeDfQrPCYqjiXyCoZ6jcbfM2d7KmRM11lBSxUK2wl4g,127
14
14
  jetpytools/functions/funcs.py,sha256=EMoJ_h2tl8Cgr1PXAsmRvgaOY5YL7AiEnGGo3-H76tk,3797
15
15
  jetpytools/functions/normalize.py,sha256=2BACok7TAN5ldANyYrbGhUpOkj84siApAYy6ndlhUfI,6316
16
16
  jetpytools/functions/other.py,sha256=TRz91spvdYJUh9vKe3Kuw6xZfSEJvrQs1mZVg7SyYmY,413
17
17
  jetpytools/types/__init__.py,sha256=yDT-PYTTzH6DyHsQcKvOy1jrCPmUQRKrjCM3apd0kNw,294
18
- jetpytools/types/builtins.py,sha256=5OVGnyDxdW9iqmrAVntg2nM79HKQKEPJC-JgcBJIDug,1673
18
+ jetpytools/types/builtins.py,sha256=1Z_NF9InJ2IngI7ljvjRKz5xEyi4mseH6hj1BPRFCio,1808
19
19
  jetpytools/types/check.py,sha256=Ivf_JkVLG9OgiKXYjq-8azoROLjJvhNNqPq_KDIiOkI,971
20
20
  jetpytools/types/file.py,sha256=j46SCbdhus2wtxddAGSCn6V4nJdWWwpnAfW1K3P3ewg,6205
21
21
  jetpytools/types/funcs.py,sha256=9qONnDWdpqvRj7vL3W9BLwWeGyQipXQgxOaPjqpQ1M4,3119
22
22
  jetpytools/types/generic.py,sha256=sAyBwGVG5FZ-6HVpfRuczov_6zQ_Uyoi0QWnR2iMm9Q,1128
23
23
  jetpytools/types/supports.py,sha256=--VZ-iCUiv-a6K8n-H8-6hSxHjrvdYg9mCLhr_lRplo,3051
24
- jetpytools/types/utils.py,sha256=jydXIAfthXjYXiOsGT-JcPrMe4vhrTYCYfYrWjl0mT4,22183
24
+ jetpytools/types/utils.py,sha256=3MaUnjezgTy4VjCstD4jNRMOoZX2Q_T1G6L55su5VhU,22570
25
25
  jetpytools/utils/__init__.py,sha256=v5Bkl43-OBWlXx9OWpZoGH-QMaYNsPIi4vfuhC13ZLI,163
26
26
  jetpytools/utils/file.py,sha256=9GhMGJ5D7CpvUFnvnwPFMloYTeIX-AJ7aKYKdoJQ374,10455
27
27
  jetpytools/utils/funcs.py,sha256=ZuLz63kveBY1CLlBexEqmrQiGC67dY4gaXdNU3CeBMw,898
28
28
  jetpytools/utils/math.py,sha256=lNTriLtTXgqN82DVSXJ5KUbhsWgxXoJ5eNGIZ0-_r_c,3335
29
29
  jetpytools/utils/ranges.py,sha256=dL3WG235Pz9sk5su8A0VdwVf_oSt6obR7R_JNwLyCjQ,2572
30
- jetpytools-1.2.6.dist-info/LICENSE,sha256=l0PN-qDtXcgOB5aXP_nSUsvCK5V3o9pQCGsTzyZhKL0,1071
31
- jetpytools-1.2.6.dist-info/METADATA,sha256=aU5HcS_7kGbkQeQv1jFm9ucoX90NnqiIZhRfFVkUGU8,1399
32
- jetpytools-1.2.6.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
33
- jetpytools-1.2.6.dist-info/top_level.txt,sha256=Iy4HjIta33ADJxN9Nyt5t5jRIfotEkZkQcOSw4eG8Cs,11
34
- jetpytools-1.2.6.dist-info/RECORD,,
30
+ jetpytools-1.2.8.dist-info/licenses/LICENSE,sha256=l0PN-qDtXcgOB5aXP_nSUsvCK5V3o9pQCGsTzyZhKL0,1071
31
+ jetpytools-1.2.8.dist-info/METADATA,sha256=0gAb1-G5YYAXQSSU2glTyAIFc68PNhaHN3U6RQXiIMo,1421
32
+ jetpytools-1.2.8.dist-info/WHEEL,sha256=1tXe9gY0PYatrMPMDd6jXqjfpz_B-Wqm32CPfRC58XU,91
33
+ jetpytools-1.2.8.dist-info/top_level.txt,sha256=Iy4HjIta33ADJxN9Nyt5t5jRIfotEkZkQcOSw4eG8Cs,11
34
+ jetpytools-1.2.8.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (76.0.0)
2
+ Generator: setuptools (77.0.3)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5