PyUtilsToolsKit 1.0.0__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.
PyUtils/boundList.py ADDED
@@ -0,0 +1,14 @@
1
+ class BoundList(list):
2
+
3
+ def __init__(self, iterable, maxLength):
4
+ super().__init__(iterable)
5
+
6
+ self.maxLength = maxLength
7
+
8
+ def append(self, object):
9
+
10
+ if len(self) + 1 <= self.maxLength:
11
+ return super().append(object)
12
+
13
+ else:
14
+ raise OverflowError(f"La list§e est pleine")
PyUtils/typedList.py ADDED
@@ -0,0 +1,12 @@
1
+ class TypedList(list):
2
+
3
+ def __init__(self, iterable, accepted_type: type):
4
+ super().__init__(iterable)
5
+
6
+ self.accepted_type = accepted_type
7
+
8
+ def append(self, object):
9
+ if not isinstance(object, self.accepted_type):
10
+ raise TypeError(f"Le type de l'objet ne correspond pas au type de liste")
11
+
12
+ return super().append(object)
@@ -0,0 +1,4 @@
1
+ Metadata-Version: 2.4
2
+ Name: PyUtilsToolsKit
3
+ Version: 1.0.0
4
+ Summary: Propose des classes qui permettent de contrôler des objets
@@ -0,0 +1,6 @@
1
+ PyUtils/boundList.py,sha256=TNUOI_sMO1s1e02wMAamF4eSgRtoDAsqSurcplV7T5A,343
2
+ PyUtils/typedList.py,sha256=UcAxVJX0SKGh3OTyrMDk7_bJQzJZAdOlp4jXp8IXHEQ,379
3
+ pyutilstoolskit-1.0.0.dist-info/METADATA,sha256=NybRcAKuUoMGgJCkzq2dcaw0jPWD308ROJK9aDvDJGk,132
4
+ pyutilstoolskit-1.0.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
5
+ pyutilstoolskit-1.0.0.dist-info/top_level.txt,sha256=URCWkDl7nA5MW2T0wpnladuvQ1U8yu3wXN6cyQzAtOA,8
6
+ pyutilstoolskit-1.0.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.2.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1 @@
1
+ PyUtils