205-djenu 1.0.0__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.
- 205_djenu-1.0.0/205_djenu.egg-info/PKG-INFO +83 -0
- 205_djenu-1.0.0/205_djenu.egg-info/SOURCES.txt +8 -0
- 205_djenu-1.0.0/205_djenu.egg-info/dependency_links.txt +1 -0
- 205_djenu-1.0.0/205_djenu.egg-info/top_level.txt +1 -0
- 205_djenu-1.0.0/PKG-INFO +83 -0
- 205_djenu-1.0.0/README.md +62 -0
- 205_djenu-1.0.0/mon_module/__init__.py +0 -0
- 205_djenu-1.0.0/mon_module/math_utilities.py +109 -0
- 205_djenu-1.0.0/setup.cfg +4 -0
- 205_djenu-1.0.0/setup.py +23 -0
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: 205_djenu
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Un package de mathématiques simples
|
|
5
|
+
Home-page: https://github.com/DJENU237/mon_module/
|
|
6
|
+
Author: djenu237
|
|
7
|
+
Author-email: juniordjenu@gmail.com
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Requires-Python: >=3.6
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
Dynamic: author
|
|
14
|
+
Dynamic: author-email
|
|
15
|
+
Dynamic: classifier
|
|
16
|
+
Dynamic: description
|
|
17
|
+
Dynamic: description-content-type
|
|
18
|
+
Dynamic: home-page
|
|
19
|
+
Dynamic: requires-python
|
|
20
|
+
Dynamic: summary
|
|
21
|
+
|
|
22
|
+
# Math Utils (`math_utils.py`)
|
|
23
|
+
|
|
24
|
+
Un module Python simple et léger fournissant des fonctions arithmétiques de base avec gestion des erreurs et typage statique.
|
|
25
|
+
|
|
26
|
+
## Fonctionnalités
|
|
27
|
+
|
|
28
|
+
* **Opérations de base :** Addition, soustraction, multiplication, division.
|
|
29
|
+
* **Opérations complémentaires :** Modulo, incrémentation et décrémentation.
|
|
30
|
+
* **Sécurité :** Protection intégrée contre la division et le modulo par zéro (`ValueError`).
|
|
31
|
+
* **Typage :** Support complet des entiers (`int`) et des nombres à virgule flottante (`float`).
|
|
32
|
+
|
|
33
|
+
## Installation
|
|
34
|
+
|
|
35
|
+
Aucune dépendance externe n'est requise. Copiez simplement le fichier `math_utils.py` dans le répertoire de votre projet.
|
|
36
|
+
|
|
37
|
+
## Utilisation
|
|
38
|
+
|
|
39
|
+
Importez les fonctions dont vous avez besoin dans votre script Python :
|
|
40
|
+
|
|
41
|
+
```python
|
|
42
|
+
from math_utils import (
|
|
43
|
+
addition,
|
|
44
|
+
soustraction,
|
|
45
|
+
division,
|
|
46
|
+
multiplication,
|
|
47
|
+
modulo,
|
|
48
|
+
incrementation,
|
|
49
|
+
decrementation,
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
# Exemples d'utilisation
|
|
53
|
+
print(addition(5, 3)) # Résultat : 8
|
|
54
|
+
print(soustraction(10, 4)) # Résultat : 6
|
|
55
|
+
print(multiplication(2.5, 4)) # Résultat : 10.0
|
|
56
|
+
print(division(10, 2)) # Résultat : 5.0
|
|
57
|
+
print(modulo(10, 3)) # Résultat : 1
|
|
58
|
+
print(incrementation(7)) # Résultat : 8
|
|
59
|
+
print(decrementation(7)) # Résultat : 6
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Gestion des erreurs
|
|
63
|
+
|
|
64
|
+
Les fonctions `division` et `modulo` lèvent une exception `ValueError` si le second argument est `0` :
|
|
65
|
+
|
|
66
|
+
```python
|
|
67
|
+
try:
|
|
68
|
+
division(10, 0)
|
|
69
|
+
except ValueError as e:
|
|
70
|
+
print(f"Erreur : {e}") # Affiche : Erreur : Division par zéro non permise
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Référence des fonctions
|
|
74
|
+
|
|
75
|
+
| Fonction | Paramètres | Description | Retour |
|
|
76
|
+
| :--- | :--- | :--- | :--- |
|
|
77
|
+
| `addition(a, b)` | `a`, `b` (`int \| float`) | Additionne `a` et `b`. | `a + b` |
|
|
78
|
+
| `soustraction(a, b)` | `a`, `b` (`int \| float`) | Soustrait `b` à `a`. | `a - b` |
|
|
79
|
+
| `multiplication(a, b)` | `a`, `b` (`int \| float`) | Multiplie `a` par `b`. | `a * b` |
|
|
80
|
+
| `division(a, b)` | `a`, `b` (`int \| float`) | Divise `a` par `b`. Lève `ValueError` si `b == 0`. | `a / b` |
|
|
81
|
+
| `modulo(a, b)` | `a`, `b` (`int \| float`) | Renvoie le reste de `a / b`. Lève `ValueError` si `b == 0`. | `a % b` |
|
|
82
|
+
| `incrementation(a)` | `a` (`int \| float`) | Ajoute `1` à `a`. | `a + 1` |
|
|
83
|
+
| `decrementation(a)` | `a` (`int \| float`) | Retire `1` à `a`. | `a - 1` |
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
mon_module
|
205_djenu-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: 205_djenu
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Un package de mathématiques simples
|
|
5
|
+
Home-page: https://github.com/DJENU237/mon_module/
|
|
6
|
+
Author: djenu237
|
|
7
|
+
Author-email: juniordjenu@gmail.com
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Requires-Python: >=3.6
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
Dynamic: author
|
|
14
|
+
Dynamic: author-email
|
|
15
|
+
Dynamic: classifier
|
|
16
|
+
Dynamic: description
|
|
17
|
+
Dynamic: description-content-type
|
|
18
|
+
Dynamic: home-page
|
|
19
|
+
Dynamic: requires-python
|
|
20
|
+
Dynamic: summary
|
|
21
|
+
|
|
22
|
+
# Math Utils (`math_utils.py`)
|
|
23
|
+
|
|
24
|
+
Un module Python simple et léger fournissant des fonctions arithmétiques de base avec gestion des erreurs et typage statique.
|
|
25
|
+
|
|
26
|
+
## Fonctionnalités
|
|
27
|
+
|
|
28
|
+
* **Opérations de base :** Addition, soustraction, multiplication, division.
|
|
29
|
+
* **Opérations complémentaires :** Modulo, incrémentation et décrémentation.
|
|
30
|
+
* **Sécurité :** Protection intégrée contre la division et le modulo par zéro (`ValueError`).
|
|
31
|
+
* **Typage :** Support complet des entiers (`int`) et des nombres à virgule flottante (`float`).
|
|
32
|
+
|
|
33
|
+
## Installation
|
|
34
|
+
|
|
35
|
+
Aucune dépendance externe n'est requise. Copiez simplement le fichier `math_utils.py` dans le répertoire de votre projet.
|
|
36
|
+
|
|
37
|
+
## Utilisation
|
|
38
|
+
|
|
39
|
+
Importez les fonctions dont vous avez besoin dans votre script Python :
|
|
40
|
+
|
|
41
|
+
```python
|
|
42
|
+
from math_utils import (
|
|
43
|
+
addition,
|
|
44
|
+
soustraction,
|
|
45
|
+
division,
|
|
46
|
+
multiplication,
|
|
47
|
+
modulo,
|
|
48
|
+
incrementation,
|
|
49
|
+
decrementation,
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
# Exemples d'utilisation
|
|
53
|
+
print(addition(5, 3)) # Résultat : 8
|
|
54
|
+
print(soustraction(10, 4)) # Résultat : 6
|
|
55
|
+
print(multiplication(2.5, 4)) # Résultat : 10.0
|
|
56
|
+
print(division(10, 2)) # Résultat : 5.0
|
|
57
|
+
print(modulo(10, 3)) # Résultat : 1
|
|
58
|
+
print(incrementation(7)) # Résultat : 8
|
|
59
|
+
print(decrementation(7)) # Résultat : 6
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Gestion des erreurs
|
|
63
|
+
|
|
64
|
+
Les fonctions `division` et `modulo` lèvent une exception `ValueError` si le second argument est `0` :
|
|
65
|
+
|
|
66
|
+
```python
|
|
67
|
+
try:
|
|
68
|
+
division(10, 0)
|
|
69
|
+
except ValueError as e:
|
|
70
|
+
print(f"Erreur : {e}") # Affiche : Erreur : Division par zéro non permise
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Référence des fonctions
|
|
74
|
+
|
|
75
|
+
| Fonction | Paramètres | Description | Retour |
|
|
76
|
+
| :--- | :--- | :--- | :--- |
|
|
77
|
+
| `addition(a, b)` | `a`, `b` (`int \| float`) | Additionne `a` et `b`. | `a + b` |
|
|
78
|
+
| `soustraction(a, b)` | `a`, `b` (`int \| float`) | Soustrait `b` à `a`. | `a - b` |
|
|
79
|
+
| `multiplication(a, b)` | `a`, `b` (`int \| float`) | Multiplie `a` par `b`. | `a * b` |
|
|
80
|
+
| `division(a, b)` | `a`, `b` (`int \| float`) | Divise `a` par `b`. Lève `ValueError` si `b == 0`. | `a / b` |
|
|
81
|
+
| `modulo(a, b)` | `a`, `b` (`int \| float`) | Renvoie le reste de `a / b`. Lève `ValueError` si `b == 0`. | `a % b` |
|
|
82
|
+
| `incrementation(a)` | `a` (`int \| float`) | Ajoute `1` à `a`. | `a + 1` |
|
|
83
|
+
| `decrementation(a)` | `a` (`int \| float`) | Retire `1` à `a`. | `a - 1` |
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Math Utils (`math_utils.py`)
|
|
2
|
+
|
|
3
|
+
Un module Python simple et léger fournissant des fonctions arithmétiques de base avec gestion des erreurs et typage statique.
|
|
4
|
+
|
|
5
|
+
## Fonctionnalités
|
|
6
|
+
|
|
7
|
+
* **Opérations de base :** Addition, soustraction, multiplication, division.
|
|
8
|
+
* **Opérations complémentaires :** Modulo, incrémentation et décrémentation.
|
|
9
|
+
* **Sécurité :** Protection intégrée contre la division et le modulo par zéro (`ValueError`).
|
|
10
|
+
* **Typage :** Support complet des entiers (`int`) et des nombres à virgule flottante (`float`).
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
Aucune dépendance externe n'est requise. Copiez simplement le fichier `math_utils.py` dans le répertoire de votre projet.
|
|
15
|
+
|
|
16
|
+
## Utilisation
|
|
17
|
+
|
|
18
|
+
Importez les fonctions dont vous avez besoin dans votre script Python :
|
|
19
|
+
|
|
20
|
+
```python
|
|
21
|
+
from math_utils import (
|
|
22
|
+
addition,
|
|
23
|
+
soustraction,
|
|
24
|
+
division,
|
|
25
|
+
multiplication,
|
|
26
|
+
modulo,
|
|
27
|
+
incrementation,
|
|
28
|
+
decrementation,
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
# Exemples d'utilisation
|
|
32
|
+
print(addition(5, 3)) # Résultat : 8
|
|
33
|
+
print(soustraction(10, 4)) # Résultat : 6
|
|
34
|
+
print(multiplication(2.5, 4)) # Résultat : 10.0
|
|
35
|
+
print(division(10, 2)) # Résultat : 5.0
|
|
36
|
+
print(modulo(10, 3)) # Résultat : 1
|
|
37
|
+
print(incrementation(7)) # Résultat : 8
|
|
38
|
+
print(decrementation(7)) # Résultat : 6
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Gestion des erreurs
|
|
42
|
+
|
|
43
|
+
Les fonctions `division` et `modulo` lèvent une exception `ValueError` si le second argument est `0` :
|
|
44
|
+
|
|
45
|
+
```python
|
|
46
|
+
try:
|
|
47
|
+
division(10, 0)
|
|
48
|
+
except ValueError as e:
|
|
49
|
+
print(f"Erreur : {e}") # Affiche : Erreur : Division par zéro non permise
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Référence des fonctions
|
|
53
|
+
|
|
54
|
+
| Fonction | Paramètres | Description | Retour |
|
|
55
|
+
| :--- | :--- | :--- | :--- |
|
|
56
|
+
| `addition(a, b)` | `a`, `b` (`int \| float`) | Additionne `a` et `b`. | `a + b` |
|
|
57
|
+
| `soustraction(a, b)` | `a`, `b` (`int \| float`) | Soustrait `b` à `a`. | `a - b` |
|
|
58
|
+
| `multiplication(a, b)` | `a`, `b` (`int \| float`) | Multiplie `a` par `b`. | `a * b` |
|
|
59
|
+
| `division(a, b)` | `a`, `b` (`int \| float`) | Divise `a` par `b`. Lève `ValueError` si `b == 0`. | `a / b` |
|
|
60
|
+
| `modulo(a, b)` | `a`, `b` (`int \| float`) | Renvoie le reste de `a / b`. Lève `ValueError` si `b == 0`. | `a % b` |
|
|
61
|
+
| `incrementation(a)` | `a` (`int \| float`) | Ajoute `1` à `a`. | `a + 1` |
|
|
62
|
+
| `decrementation(a)` | `a` (`int \| float`) | Retire `1` à `a`. | `a - 1` |
|
|
File without changes
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
from typing import Union
|
|
2
|
+
|
|
3
|
+
Number = Union[int, float]
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def addition(a: Number, b: Number) -> Number:
|
|
7
|
+
"""
|
|
8
|
+
Calcule la somme de deux nombres.
|
|
9
|
+
|
|
10
|
+
Args:
|
|
11
|
+
a (int | float): Le premier nombre.
|
|
12
|
+
b (int | float): Le deuxième nombre.
|
|
13
|
+
|
|
14
|
+
Returns:
|
|
15
|
+
int | float: La somme de a et b.
|
|
16
|
+
"""
|
|
17
|
+
return a + b
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def soustraction(a: Number, b: Number) -> Number:
|
|
21
|
+
"""
|
|
22
|
+
Calcule la différence entre deux nombres.
|
|
23
|
+
|
|
24
|
+
Args:
|
|
25
|
+
a (int | float): Le nombre de départ.
|
|
26
|
+
b (int | float): Le nombre à soustraire.
|
|
27
|
+
|
|
28
|
+
Returns:
|
|
29
|
+
int | float: Le résultat de a - b.
|
|
30
|
+
"""
|
|
31
|
+
return a - b
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def division(a: Number, b: Number) -> float:
|
|
35
|
+
"""
|
|
36
|
+
Effectue la division de deux nombres.
|
|
37
|
+
|
|
38
|
+
Args:
|
|
39
|
+
a (int | float): Le dividende.
|
|
40
|
+
b (int | float): Le diviseur.
|
|
41
|
+
|
|
42
|
+
Returns:
|
|
43
|
+
float: Le quotient de a par b.
|
|
44
|
+
|
|
45
|
+
Raises:
|
|
46
|
+
ValueError: Si b est égal à 0.
|
|
47
|
+
"""
|
|
48
|
+
if b == 0:
|
|
49
|
+
raise ValueError("Division par zéro non permise")
|
|
50
|
+
return a / b
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def multiplication(a: Number, b: Number) -> Number:
|
|
54
|
+
"""
|
|
55
|
+
Calcule le produit de deux nombres.
|
|
56
|
+
|
|
57
|
+
Args:
|
|
58
|
+
a (int | float): Le premier facteur.
|
|
59
|
+
b (int | float): Le deuxième facteur.
|
|
60
|
+
|
|
61
|
+
Returns:
|
|
62
|
+
int | float: Le produit de a et b.
|
|
63
|
+
"""
|
|
64
|
+
return a * b
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def modulo(a: Number, b: Number) -> Number:
|
|
68
|
+
"""
|
|
69
|
+
Calcule le reste de la division euclidienne de a par b.
|
|
70
|
+
|
|
71
|
+
Args:
|
|
72
|
+
a (int | float): Le dividende.
|
|
73
|
+
b (int | float): Le diviseur.
|
|
74
|
+
|
|
75
|
+
Returns:
|
|
76
|
+
int | float: Le reste de a % b.
|
|
77
|
+
|
|
78
|
+
Raises:
|
|
79
|
+
ValueError: Si b est égal à 0.
|
|
80
|
+
"""
|
|
81
|
+
if b == 0:
|
|
82
|
+
raise ValueError("Modulo par zéro non permis")
|
|
83
|
+
return a % b
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
def incrementation(a: Number) -> Number:
|
|
87
|
+
"""
|
|
88
|
+
Incrémente un nombre de 1.
|
|
89
|
+
|
|
90
|
+
Args:
|
|
91
|
+
a (int | float): Le nombre à incrémenter.
|
|
92
|
+
|
|
93
|
+
Returns:
|
|
94
|
+
int | float: La valeur de a + 1.
|
|
95
|
+
"""
|
|
96
|
+
return a + 1
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
def decrementation(a: Number) -> Number:
|
|
100
|
+
"""
|
|
101
|
+
Décrémente un nombre de 1.
|
|
102
|
+
|
|
103
|
+
Args:
|
|
104
|
+
a (int | float): Le nombre à décrémenter.
|
|
105
|
+
|
|
106
|
+
Returns:
|
|
107
|
+
int | float: La valeur de a - 1.
|
|
108
|
+
"""
|
|
109
|
+
return a - 1
|
205_djenu-1.0.0/setup.py
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
from setuptools import setup, find_packages
|
|
2
|
+
|
|
3
|
+
with open('README.md', encoding='utf-8') as f:
|
|
4
|
+
long_description = f.read()
|
|
5
|
+
|
|
6
|
+
setup(
|
|
7
|
+
name='205_djenu',
|
|
8
|
+
version='1.0.0',
|
|
9
|
+
packages=find_packages(),
|
|
10
|
+
description='Un package de mathématiques simples',
|
|
11
|
+
long_description=long_description,
|
|
12
|
+
long_description_content_type='text/markdown',
|
|
13
|
+
author='djenu237',
|
|
14
|
+
author_email='juniordjenu@gmail.com',
|
|
15
|
+
url='https://github.com/DJENU237/mon_module/',
|
|
16
|
+
classifiers=[
|
|
17
|
+
'Programming Language :: Python :: 3',
|
|
18
|
+
'License :: OSI Approved :: MIT License',
|
|
19
|
+
'Operating System :: OS Independent',
|
|
20
|
+
],
|
|
21
|
+
python_requires='>=3.6',
|
|
22
|
+
install_requires=[],
|
|
23
|
+
)
|