mirror of
https://github.com/Alex38Lyon/Synthese-PSM_LARRA.git
synced 2026-06-01 13:59:13 +00:00
Compare commits
2 Commits
bd4480072e
...
385d2bca7c
| Author | SHA1 | Date | |
|---|---|---|---|
| 385d2bca7c | |||
| 7f93cb8511 |
+1
-1
Submodule Data updated: 3c713353c3...e13350dd1a
BIN
Binary file not shown.
+93
@@ -0,0 +1,93 @@
|
|||||||
|
2026-01-09 09:45:02,910 - INFO - *************************************************************************************************************************
|
||||||
|
2026-01-09 09:45:02,911 - INFO - * Calcul des statistiques par entrées d'une BD Therion *
|
||||||
|
2026-01-09 09:45:02,911 - INFO - * Script pythStat par : alexandre.pont@yahoo.fr *
|
||||||
|
2026-01-09 09:45:02,911 - INFO - * Version : 2026.01.09 *
|
||||||
|
2026-01-09 09:45:02,911 - INFO - * Fichier source : ~\Synthese-PSM_LARRA\Outputs\database_Synthese-PSM_LARRA.sql *
|
||||||
|
2026-01-09 09:45:02,913 - INFO - * Dossier destination : ~\Synthese-PSM_LARRA\Outputs\Stats_database_Synthese-PSM_LARRA_2026-01-09 *
|
||||||
|
2026-01-09 09:45:02,913 - INFO - * Date : 2026-01-09 09:44:59 *
|
||||||
|
2026-01-09 09:45:02,913 - INFO - * *
|
||||||
|
2026-01-09 09:45:02,913 - INFO - *************************************************************************************************************************
|
||||||
|
2026-01-09 09:45:02,914 - INFO - Phase 5: Écriture des statistiques dans fichier ~\Outputs\Stats_database_Synthese-PSM_LARRA_2026-01-09\database_Synthese-PSM_LARRA_stats
|
||||||
|
2026-01-09 09:46:26,234 - INFO - Table des STATION, entrée et fix nbre: 193
|
||||||
|
2026-01-09 09:47:41,830 - INFO - Phase 6: Fin de traitement en 02(m)42(s), résultats enregistrés dans ~\Outputs\Stats_database_Synthese-PSM_LARRA_2026-01-09\database_Synthese-PSM_LARRA_stats
|
||||||
|
2026-01-09 10:19:59,707 - INFO - ***********************************************************************************************************************
|
||||||
|
2026-01-09 10:19:59,707 - INFO - * Calcul des statistiques par entrées d'une BD Therion *
|
||||||
|
2026-01-09 10:19:59,708 - INFO - * Script pythStat par : alexandre.pont@yahoo.fr *
|
||||||
|
2026-01-09 10:19:59,708 - INFO - * Version : 2026.01.09 *
|
||||||
|
2026-01-09 10:19:59,708 - INFO - * Fichier source : ~\Synthese-PSM_LARRA\Outputs\database_Synthese-PSM_LARRA.sql *
|
||||||
|
2026-01-09 10:19:59,708 - INFO - * Dossier destination : ~\Synthese-PSM_LARRA\Outputs\Stats_database_Synthese-PSM_LARRA_2026-01-09 *
|
||||||
|
2026-01-09 10:19:59,708 - INFO - * Date : 2026-01-09 10:19:46 *
|
||||||
|
2026-01-09 10:19:59,709 - INFO - * *
|
||||||
|
2026-01-09 10:19:59,709 - INFO - ***********************************************************************************************************************
|
||||||
|
2026-01-09 10:19:59,710 - INFO - Phase 5: Écriture des statistiques dans fichier ~\Outputs\Stats_database_Synthese-PSM_LARRA_2026-01-09\database_Synthese-PSM_LARRA_stats
|
||||||
|
2026-01-09 10:21:21,576 - INFO - Table des STATION, entrée et fix nbre: 193
|
||||||
|
2026-01-09 10:22:30,700 - INFO - Phase 6: Fin de traitement en 02(m)43(s), résultats enregistrés dans ~\Outputs\Stats_database_Synthese-PSM_LARRA_2026-01-09\database_Synthese-PSM_LARRA_stats
|
||||||
|
2026-01-09 10:24:45,769 - INFO - ***********************************************************************************************************************
|
||||||
|
2026-01-09 10:24:45,770 - INFO - * Calcul des statistiques par entrées d'une BD Therion *
|
||||||
|
2026-01-09 10:24:45,770 - INFO - * Script pythStat par : alexandre.pont@yahoo.fr *
|
||||||
|
2026-01-09 10:24:45,770 - INFO - * Version : 2026.01.09 *
|
||||||
|
2026-01-09 10:24:45,770 - INFO - * Fichier source : ~\Synthese-PSM_LARRA\Outputs\database_Synthese-PSM_LARRA.sql *
|
||||||
|
2026-01-09 10:24:45,770 - INFO - * Dossier destination : ~\Synthese-PSM_LARRA\Outputs\Stats_database_Synthese-PSM_LARRA_2026-01-09 *
|
||||||
|
2026-01-09 10:24:45,771 - INFO - * Date : 2026-01-09 10:24:42 *
|
||||||
|
2026-01-09 10:24:45,771 - INFO - * *
|
||||||
|
2026-01-09 10:24:45,771 - INFO - ***********************************************************************************************************************
|
||||||
|
2026-01-09 10:24:45,772 - INFO - Phase 1: Importation de la base de données Therion ~\Synthese-PSM_LARRA\Outputs\database_Synthese-PSM_LARRA.sql dans: ~\Outputs\Stats_database_Synthese-PSM_LARRA_2026-01-09\database_Synthese-PSM_LARRA_stats.db
|
||||||
|
2026-01-09 11:02:25,463 - INFO - Phase 2: Création des nouvelles tables, indexation
|
||||||
|
2026-01-09 11:02:26,776 - INFO - Jonction de SHOT equates nbre: 2572
|
||||||
|
2026-01-09 11:04:43,650 - WARNING - Table des SHOT, visée(s) bloquante(s), même départ et arrivée, longueur nulle supprimée(s) nbre: 1688
|
||||||
|
2026-01-09 11:04:43,863 - WARNING - Table des SHOT, visées en double à traiter à la source : [(1637, None, 2.77)], [(1647, None, 2.77)], station crée : 67391, long. en double : 2.77 m
|
||||||
|
2026-01-09 11:04:44,056 - WARNING - Table des SHOT, visées en double à traiter à la source : [(9824, 'srf', 8.76)], [(14684, 'srf', 8.73)], station crée : 67394, long. en double : 11.50 m
|
||||||
|
2026-01-09 11:04:44,423 - WARNING - Table des SHOT, visées en double à traiter à la source : [(51351, None, 17.6)], [(51469, None, 18.0)], station crée : 67400, long. en double : 29.50 m
|
||||||
|
2026-01-09 11:04:44,482 - WARNING - Table des SHOT, visées en double à traiter à la source : [(51407, None, 6.5)], [(51441, None, 10.0)], station crée : 67401, long. en double : 39.50 m
|
||||||
|
2026-01-09 11:04:44,495 - INFO - Table des SHOT, visées dupliquées traités nbre: 11
|
||||||
|
2026-01-09 11:04:44,843 - INFO - Création de l'index des tables principales et optimisation de la mémoire
|
||||||
|
2026-01-09 11:04:45,006 - INFO - Marquage des visées et des stations d'habillage nbre: 19045
|
||||||
|
2026-01-09 11:05:54,650 - INFO - Table des STATION, entrée et fix nbre: 193
|
||||||
|
2026-01-09 11:05:54,654 - INFO - Phase 3: Remplissage des tables d'après les 193 entrée(s)
|
||||||
|
2026-01-09 11:05:57,725 - INFO - Phase 4: Remplissage des tables d'après les séries vides jonctionnées aux 193 entrée(s)
|
||||||
|
on 1423: 2026-01-09 11:06:16,743 - INFO - Jonction à la Station_ID: 49336 entre les entrées 49457 et 49328
|
||||||
|
on 3315: 2026-01-09 11:06:37,223 - INFO - Jonction à la Station_ID: 229 entre les entrées 218 et 834
|
||||||
|
on 3343: 2026-01-09 11:06:37,890 - INFO - Jonction à la Station_ID: 3525 entre les entrées 3455 et 3525
|
||||||
|
on 6314: 2026-01-09 11:07:11,828 - INFO - Jonction à la Station_ID: 1666 entre les entrées 1613 et 2784
|
||||||
|
on 9044: 2026-01-09 11:08:18,581 - INFO - Jonction à la Station_ID: 3348 entre les entrées 3358 et 3397
|
||||||
|
on 9999: 2026-01-09 11:08:44,186 - INFO - Jonction à la Station_ID: 40146 entre les entrées 38328 et 39667
|
||||||
|
on 12262: 2026-01-09 11:09:32,307 - INFO - Jonction à la Station_ID: 47397 entre les entrées 48105 et 47361
|
||||||
|
on 12737: 2026-01-09 11:09:40,587 - INFO - Jonction à la Station_ID: 9041 entre les entrées 10902 et 8905
|
||||||
|
on 15193: 2026-01-09 11:10:39,570 - INFO - Jonction à la Station_ID: 12059 entre les entrées 10902 et 12987
|
||||||
|
on 16399: 2026-01-09 11:11:02,917 - INFO - Jonction à la Station_ID: 9337 entre les entrées 14852 et 10902
|
||||||
|
on 16399: 2026-01-09 11:11:02,925 - INFO - Jonction à la Station_ID: 9337 entre les entrées 14852 et 10902
|
||||||
|
on 16453: 2026-01-09 11:11:04,608 - INFO - Jonction à la Station_ID: 9547 entre les entrées 9884 et 9366
|
||||||
|
on 17153: 2026-01-09 11:11:24,074 - INFO - Jonction à la Station_ID: 49863 entre les entrées 48105 et 49804
|
||||||
|
on 17700: 2026-01-09 11:11:34,566 - INFO - Jonction à la Station_ID: 12777 entre les entrées 10902 et 14852
|
||||||
|
on 17701: 2026-01-09 11:11:34,763 - INFO - Jonction à la Station_ID: 9338 entre les entrées 10902 et 14852
|
||||||
|
on 17701: 2026-01-09 11:11:34,805 - INFO - Jonction à la Station_ID: 12777 entre les entrées 10902 et 14852
|
||||||
|
on 18840: 2026-01-09 11:12:56,589 - INFO - Jonction à la Station_ID: 12771 entre les entrées 14852 et 9366
|
||||||
|
on 18914: 2026-01-09 11:12:59,081 - INFO - Jonction à la Station_ID: 17222 entre les entrées 16774 et 10902
|
||||||
|
on 21020: 2026-01-09 11:14:16,661 - INFO - Jonction à la Station_ID: 15570 entre les entrées 8905 et 9366
|
||||||
|
on 23018: 2026-01-09 11:15:08,149 - INFO - Jonction à la Station_ID: 15611 entre les entrées 9366 et 8905
|
||||||
|
on 23099: 2026-01-09 11:15:11,736 - INFO - Jonction à la Station_ID: 15557 entre les entrées 8905 et 9366
|
||||||
|
on 23104: 2026-01-09 11:15:11,799 - INFO - Jonction à la Station_ID: 9477 entre les entrées 8905 et 14852
|
||||||
|
on 23106: 2026-01-09 11:15:12,005 - INFO - Jonction à la Station_ID: 9834 entre les entrées 14852 et 11338
|
||||||
|
on 23950: 2026-01-09 11:15:35,190 - INFO - Jonction à la Station_ID: 47028 entre les entrées 49090 et 48105
|
||||||
|
on 24942: 2026-01-09 11:15:56,520 - INFO - Jonction à la Station_ID: 16242 entre les entrées 15665 et 14852
|
||||||
|
on 25665: 2026-01-09 11:16:17,092 - INFO - Jonction à la Station_ID: 16259 entre les entrées 10902 et 14852
|
||||||
|
on 28197: 2026-01-09 11:17:13,274 - INFO - Jonction à la Station_ID: 9522 entre les entrées 16789 et 9366
|
||||||
|
on 28370: 2026-01-09 11:17:19,650 - INFO - Jonction à la Station_ID: 44663 entre les entrées 49457 et 43629
|
||||||
|
on 29811: 2026-01-09 11:17:52,590 - INFO - Jonction à la Station_ID: 44815 entre les entrées 48105 et 49457
|
||||||
|
on 30890: 2026-01-09 11:18:15,149 - INFO - Jonction à la Station_ID: 16483 entre les entrées 15665 et 10902
|
||||||
|
on 31336: 2026-01-09 11:18:28,033 - INFO - Jonction à la Station_ID: 17453 entre les entrées 19538 et 17667
|
||||||
|
on 31834: 2026-01-09 11:18:37,801 - INFO - Jonction à la Station_ID: 25261 entre les entrées 27454 et 24729
|
||||||
|
2026-01-09 11:23:00,092 - INFO - Intégrations des visées orphelines (entre 2 stations existantes) nbre: 338
|
||||||
|
2026-01-09 11:23:04,529 - INFO - Réseau: 1, entrées jonctionnées: 10, [11338, 14852, 8905, 9366, 10902, 15665, 9884, 16789, 12987, 16774]
|
||||||
|
2026-01-09 11:23:04,611 - INFO - Réseau: 2, entrées jonctionnées: 2, [3397, 3358]
|
||||||
|
2026-01-09 11:23:04,914 - INFO - Réseau: 3, entrées jonctionnées: 7, [43629, 49457, 48105, 49328, 47361, 49090, 49804]
|
||||||
|
2026-01-09 11:23:04,995 - INFO - Réseau: 4, entrées jonctionnées: 2, [1613, 2784]
|
||||||
|
2026-01-09 11:23:05,087 - INFO - Réseau: 5, entrées jonctionnées: 2, [3455, 3525]
|
||||||
|
2026-01-09 11:23:05,236 - INFO - Réseau: 6, entrées jonctionnées: 2, [24729, 27454]
|
||||||
|
2026-01-09 11:23:05,388 - INFO - Réseau: 7, entrées jonctionnées: 2, [834, 218]
|
||||||
|
2026-01-09 11:23:05,486 - INFO - Réseau: 8, entrées jonctionnées: 2, [38328, 39667]
|
||||||
|
2026-01-09 11:23:05,589 - INFO - Réseau: 9, entrées jonctionnées: 2, [17667, 19538]
|
||||||
|
2026-01-09 11:23:05,590 - WARNING - Phase 4: Fin du remplissage des tables, attention 82 station(s) non comptabilisé(s)
|
||||||
|
2026-01-09 11:23:05,713 - INFO - Phase 5: Écriture des statistiques dans fichier ~\Outputs\Stats_database_Synthese-PSM_LARRA_2026-01-09\database_Synthese-PSM_LARRA_stats
|
||||||
|
2026-01-09 11:25:20,502 - INFO - Table des STATION, entrée et fix nbre: 193
|
||||||
|
2026-01-09 11:27:11,770 - WARNING - Phase 6: Fin de traitement en 01(h)02(m)28(s), avec 1 erreur(s), résultats enregistrés dans ~\Outputs\Stats_database_Synthese-PSM_LARRA_2026-01-09\database_Synthese-PSM_LARRA_stats
|
||||||
BIN
Binary file not shown.
+11
-11
@@ -1,13 +1,13 @@
|
|||||||
*************************************************************************************************************************
|
***********************************************************************************************************************
|
||||||
* Calcul des statistiques par entrées d'une BD Therion *
|
* Calcul des statistiques par entrées d'une BD Therion *
|
||||||
* Script pythStat par alexandre.pont@yahoo.fr *
|
* Script pythStat par : alexandre.pont@yahoo.fr *
|
||||||
* Version : 2026.01.09 *
|
* Version : 2026.01.09 *
|
||||||
* Fichier source : ~\Synthese-PSM_LARRA\Outputs\database_Synthese-PSM_LARRA.sql *
|
* Fichier source : ~\Synthese-PSM_LARRA\Outputs\database_Synthese-PSM_LARRA.sql *
|
||||||
* Dossier destination : ~\Synthese-PSM_LARRA\Outputs\stat_database_Synthese-PSM_LARRA_2026-01-08 *
|
* Dossier destination : ~\Synthese-PSM_LARRA\Outputs\Stats_database_Synthese-PSM_LARRA_2026-01-09 *
|
||||||
* Date : 2026-01-08 23:45:03 *
|
* Date : 2026-01-09 10:24:42 *
|
||||||
* Durée calcul: 02(m)28(s) sans erreur *
|
* Durée calcul : 01(h)02(m)28(s) avec erreur(s): 1 *
|
||||||
*************************************************************************************************************************
|
***********************************************************************************************************************
|
||||||
**Développement total centerline:** 340754.54 13027.78 10574.75 - - Dev.(m), Dupl.(m), Surf.(m)
|
**Développement total centerline (m):** développement: 340754.54 , dupliqué: 13027.78 , surface: 10574.75
|
||||||
Attention, 82 station(s) non comptabilisée(s) et raccordée(s)
|
Attention, 82 station(s) non comptabilisée(s) et raccordée(s)
|
||||||
|
|
||||||
Développement total par réseaux
|
Développement total par réseaux
|
||||||
@@ -179,7 +179,7 @@ Développement total par réseaux
|
|||||||
UT683_4758 1 0.00 0.00 0.00 20.00 2 LT346_80 2000.00 LT346_80 2000.00
|
UT683_4758 1 0.00 0.00 0.00 20.00 2 LT346_80 2000.00 LT346_80 2000.00
|
||||||
Entrée(s) sans topographie 8 0.00 537.00 0.00 0.00 0 LT345_79 1500.0 SC_3 2037.00
|
Entrée(s) sans topographie 8 0.00 537.00 0.00 0.00 0 LT345_79 1500.0 SC_3 2037.00
|
||||||
|
|
||||||
Développement total topographié par année(s)**
|
Développement total topographié par année(s)
|
||||||
Année Dev.(m) Cumul (m) Dupl.(m) Cumul (m) Surf.(m) Cumul (m)
|
Année Dev.(m) Cumul (m) Dupl.(m) Cumul (m) Surf.(m) Cumul (m)
|
||||||
1950 1724.74 1724.74 0.00 0.00 0.00 0.00
|
1950 1724.74 1724.74 0.00 0.00 0.00 0.00
|
||||||
1971 2627.02 4351.76 116.43 116.43 0.00 0.00
|
1971 2627.02 4351.76 116.43 116.43 0.00 0.00
|
||||||
|
+12
-8
@@ -1,14 +1,16 @@
|
|||||||
--------------
|
--------------
|
||||||
# Calcul des statistiques par entrées d'une BD Therion
|
# Calcul des statistiques par entrées d'une BD Therion
|
||||||
- ** Script pythStat par alexandre.pont@yahoo.fr**
|
- Script pythStat par : alexandre.pont@yahoo.fr
|
||||||
- ** Version : 2026.01.09**
|
- Version : 2026.01.09
|
||||||
- ** Fichier source : ~\Synthese-PSM_LARRA\Outputs\database_Synthese-PSM_LARRA.sql**
|
- Fichier source : ~\Synthese-PSM_LARRA\Outputs\database_Synthese-PSM_LARRA.sql
|
||||||
- ** Dossier destination : ~\Synthese-PSM_LARRA\Outputs\stat_database_Synthese-PSM_LARRA_2026-01-08**
|
- Dossier destination : ~\Synthese-PSM_LARRA\Outputs\Stats_database_Synthese-PSM_LARRA_2026-01-09
|
||||||
- ** Date : 2026-01-08 23:45:03**
|
- Date : 2026-01-09 10:24:42
|
||||||
- ** Durée calcul : 02(m)28(s) sans erreur**
|
- Durée calcul : 01(h)02(m)28(s)!! avec erreur(s): 1
|
||||||
--------------
|
--------------
|
||||||
**Développement total des centerlines (m):** , Développement: '340754.54', Dupliqué: '13027.78', Surface: '10574.75'
|
|
||||||
!!Attention, 82 station(s) non comptabilisée(s) et raccordée(s)
|
**Développement total des centerlines (m):** développement: `340754.54`, dupliqué: `13027.78`, surface: `10574.75`
|
||||||
|
!!Attention, `82` station(s) non comptabilisée(s) et raccordée(s)
|
||||||
|
|
||||||
|
|
||||||
--------------
|
--------------
|
||||||
**Développement total par réseaux**
|
**Développement total par réseaux**
|
||||||
@@ -239,3 +241,5 @@
|
|||||||
| 2023 | 6343.27 | 327354.72 | 1180.34 | 12377.13 | 79.70 | 10279.50 |
|
| 2023 | 6343.27 | 327354.72 | 1180.34 | 12377.13 | 79.70 | 10279.50 |
|
||||||
| 2024 | 7703.88 | 335058.60 | 547.76 | 12924.89 | 144.72 | 10424.22 |
|
| 2024 | 7703.88 | 335058.60 | 547.76 | 12924.89 | 144.72 | 10424.22 |
|
||||||
| 2025 | 5695.94 | 340754.54 | 102.89 | 13027.78 | 150.53 | 10574.75 |
|
| 2025 | 5695.94 | 340754.54 | 102.89 | 13027.78 | 150.53 | 10574.75 |
|
||||||
|
|
||||||
|
--------------
|
||||||
BIN
Binary file not shown.
BIN
Binary file not shown.
+5
@@ -2,15 +2,18 @@
|
|||||||
"cSpell.words": [
|
"cSpell.words": [
|
||||||
"annee",
|
"annee",
|
||||||
"annees",
|
"annees",
|
||||||
|
"ansi",
|
||||||
"arrivee",
|
"arrivee",
|
||||||
"axhline",
|
"axhline",
|
||||||
"barplot",
|
"barplot",
|
||||||
|
"centerlines",
|
||||||
"CENTRELINE",
|
"CENTRELINE",
|
||||||
"Criou",
|
"Criou",
|
||||||
"cumsum",
|
"cumsum",
|
||||||
"dupl",
|
"dupl",
|
||||||
"Dupl",
|
"Dupl",
|
||||||
"duree",
|
"duree",
|
||||||
|
"ENDC",
|
||||||
"entetes",
|
"entetes",
|
||||||
"executemany",
|
"executemany",
|
||||||
"Explo",
|
"Explo",
|
||||||
@@ -38,12 +41,14 @@
|
|||||||
"results",
|
"results",
|
||||||
"serie",
|
"serie",
|
||||||
"Serie",
|
"Serie",
|
||||||
|
"sinfo",
|
||||||
"sommeplot",
|
"sommeplot",
|
||||||
"sommesys",
|
"sommesys",
|
||||||
"Sornin",
|
"Sornin",
|
||||||
"sqlite",
|
"sqlite",
|
||||||
"suprimmees",
|
"suprimmees",
|
||||||
"tempplot",
|
"tempplot",
|
||||||
|
"thconfig",
|
||||||
"therion",
|
"therion",
|
||||||
"topographié",
|
"topographié",
|
||||||
"topographiée",
|
"topographiée",
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,239 @@
|
|||||||
|
"""
|
||||||
|
!#############################################################################################
|
||||||
|
# #
|
||||||
|
# general_fonctions.py for pythStat.py #
|
||||||
|
# #
|
||||||
|
!#############################################################################################
|
||||||
|
|
||||||
|
Alex 2026 01 09
|
||||||
|
|
||||||
|
"""
|
||||||
|
import os, logging, sys, re, unicodedata
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
log = logging.getLogger("Logger")
|
||||||
|
|
||||||
|
#################################################################################################
|
||||||
|
# Couleurs ANSI par niveau de log
|
||||||
|
#################################################################################################
|
||||||
|
COLOR_CODES = {
|
||||||
|
logging.DEBUG: "\033[94m", # Bleu
|
||||||
|
logging.INFO: "\033[92m", # Vert
|
||||||
|
logging.WARNING: "\033[95m", # MAGENTA
|
||||||
|
logging.ERROR: "\033[91m", # Rouge
|
||||||
|
logging.CRITICAL: "\033[1;91m", # Rouge vif
|
||||||
|
}
|
||||||
|
RESET = "\033[0m"
|
||||||
|
|
||||||
|
#################################################################################################
|
||||||
|
# Codes de couleur ANSI
|
||||||
|
class Colors:
|
||||||
|
BLACK = '\033[90m'
|
||||||
|
RED = '\033[91m'
|
||||||
|
GREEN = '\033[92m'
|
||||||
|
YELLOW = '\033[93m'
|
||||||
|
BLUE = '\033[94m'
|
||||||
|
MAGENTA = '\033[95m'
|
||||||
|
CYAN = '\033[96m'
|
||||||
|
WHITE = '\033[97m'
|
||||||
|
|
||||||
|
ERROR = '\033[91m'
|
||||||
|
WARNING = '\033[95m'
|
||||||
|
HEADER = '\033[1;94m'
|
||||||
|
DEBUG = '\033[94m' # Bleu
|
||||||
|
INFO = '\033[92m' # Vert
|
||||||
|
CRITICAL = '\033[1;91m', # Rouge vif
|
||||||
|
|
||||||
|
ENDC = '\033[0m'
|
||||||
|
BOLD = '\033[1m'
|
||||||
|
UNDERLINE = '\033[4m'
|
||||||
|
|
||||||
|
#################################################################################################
|
||||||
|
# Coloration des messages d'aide d'arg #
|
||||||
|
#################################################################################################
|
||||||
|
def colored_help(parser):
|
||||||
|
"""
|
||||||
|
Affiche l'aide colorée pour les arguments de la ligne de commande.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
parser (argparse.ArgumentParser): Le parseur d'arguments.
|
||||||
|
Returns:
|
||||||
|
None
|
||||||
|
|
||||||
|
"""
|
||||||
|
# Captures the help output
|
||||||
|
help_text = parser.format_help()
|
||||||
|
|
||||||
|
# Coloration des différentes parties
|
||||||
|
colored_help_text = help_text.replace(
|
||||||
|
'usage:', f'{Colors.ERROR}usage:{Colors.ENDC}'
|
||||||
|
).replace(
|
||||||
|
'options:', f'{Colors.GREEN}options:{Colors.ENDC}'
|
||||||
|
).replace('positional arguments:', f'{Colors.BLUE}positional arguments:{Colors.ENDC}'
|
||||||
|
).replace(', --help', f'{Colors.BLUE}, --help:{Colors.ENDC}'
|
||||||
|
).replace('elp:', f'{Colors.BLUE}elp{Colors.ENDC}')
|
||||||
|
|
||||||
|
# Surligner les arguments
|
||||||
|
# for action in parser._actions:
|
||||||
|
# if action.option_strings:
|
||||||
|
# # Colorer les options (--xyz)
|
||||||
|
# for opt in action.option_strings:
|
||||||
|
# colored_help_text = colored_help_text.replace(opt, f'{Colors.BLUE}{opt}{Colors.ENDC}').replace('--help', f'{Colors.BLUE}--help:{Colors.ENDC}')
|
||||||
|
|
||||||
|
# Imprimer le texte coloré
|
||||||
|
print(colored_help_text)
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
#################################################################################################
|
||||||
|
# Mise au format des noms #
|
||||||
|
#################################################################################################
|
||||||
|
def sanitize_filename(thName):
|
||||||
|
"""
|
||||||
|
Cleans a string to make it compatible with filenames on Windows, Linux, and macOS.
|
||||||
|
Replaces special and accented characters with compatible characters.
|
||||||
|
Replaces parentheses with underscores and enforces proper casing.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
thName (str): The filename to clean.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
str: The cleaned and compatible string.
|
||||||
|
|
||||||
|
"""
|
||||||
|
# Unicode normalization to replace accented characters with their non-accented equivalents
|
||||||
|
thName = unicodedata.normalize('NFKD', thName).encode('ASCII', 'ignore').decode('ASCII')
|
||||||
|
|
||||||
|
# Replace parentheses with underscores
|
||||||
|
thName = thName.replace('(', '_').replace(')', '_')
|
||||||
|
|
||||||
|
# Replace illegal characters with an underscore
|
||||||
|
thName = re.sub(r'[<>:"/\\|?*\']', '_', thName) # Illegal on Windows
|
||||||
|
thName = re.sub(r'\s+', '_', thName) # Spaces to underscores
|
||||||
|
thName = re.sub(r'[^a-zA-Z0-9._-]', '_', thName) # Keep only allowed chars
|
||||||
|
|
||||||
|
# Convert to lowercase, then capitalize the first letter
|
||||||
|
# thName = thName.lower().capitalize()
|
||||||
|
# thName = thName.capitalize()
|
||||||
|
|
||||||
|
# Suppression des underscores en début et fin
|
||||||
|
thName = thName.strip('_')
|
||||||
|
|
||||||
|
return thName or "default_filename" # Avoid empty result
|
||||||
|
|
||||||
|
#################################################################################################
|
||||||
|
# Supprime les codes ANSI (pour l'écriture dans les fichiers)
|
||||||
|
#################################################################################################
|
||||||
|
def strip_ansi_codes(text):
|
||||||
|
ansi_escape = re.compile(r'\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])')
|
||||||
|
return ansi_escape.sub('', text)
|
||||||
|
|
||||||
|
#################################################################################################
|
||||||
|
# Formatter pour la console avec couleurs
|
||||||
|
#################################################################################################
|
||||||
|
class ConsoleFormatter(logging.Formatter):
|
||||||
|
def format(self, record):
|
||||||
|
color = COLOR_CODES.get(record.levelno, "")
|
||||||
|
message = super().format(record)
|
||||||
|
return f"{color}{message}{RESET}"
|
||||||
|
|
||||||
|
#################################################################################################
|
||||||
|
# Formatter pour le fichier avec "!!!" sur les erreurs
|
||||||
|
#################################################################################################
|
||||||
|
class FileFormatter(logging.Formatter):
|
||||||
|
def format(self, record):
|
||||||
|
clean_msg = strip_ansi_codes(record.getMessage())
|
||||||
|
prefix = "!!! " if record.levelno >= logging.ERROR else ""
|
||||||
|
record_copy = logging.LogRecord(
|
||||||
|
name=record.name,
|
||||||
|
level=record.levelno,
|
||||||
|
pathname=record.pathname,
|
||||||
|
lineno=record.lineno,
|
||||||
|
msg=f"{prefix}{clean_msg}",
|
||||||
|
args=(),
|
||||||
|
exc_info=record.exc_info,
|
||||||
|
func=record.funcName,
|
||||||
|
sinfo=record.stack_info
|
||||||
|
)
|
||||||
|
return super().format(record_copy)
|
||||||
|
|
||||||
|
#################################################################################################
|
||||||
|
# Fonction de configuration du logger
|
||||||
|
#################################################################################################
|
||||||
|
def setup_logger(logfile="app.log", debug_log=False):
|
||||||
|
logger = logging.getLogger("Logger")
|
||||||
|
logger.setLevel(logging.DEBUG)
|
||||||
|
logger.handlers.clear()
|
||||||
|
|
||||||
|
min_level = logging.DEBUG if debug_log else logging.INFO
|
||||||
|
|
||||||
|
# Console stderr handler — affichage à l'écran avec couleurs
|
||||||
|
stderr_handler = logging.StreamHandler(sys.stderr)
|
||||||
|
stderr_handler.setLevel(min_level)
|
||||||
|
stderr_formatter = ConsoleFormatter("%(levelname)s: %(message)s") # <-- Ta classe personnalisée
|
||||||
|
stderr_handler.setFormatter(stderr_formatter)
|
||||||
|
logger.addHandler(stderr_handler)
|
||||||
|
|
||||||
|
# File handler — fichier de log
|
||||||
|
file_handler = logging.FileHandler(logfile, encoding="utf-8")
|
||||||
|
file_handler.setLevel(min_level)
|
||||||
|
file_formatter = FileFormatter("%(asctime)s - %(levelname)s - %(message)s") # <-- Ta classe personnalisée
|
||||||
|
file_handler.setFormatter(file_formatter)
|
||||||
|
logger.addHandler(file_handler)
|
||||||
|
|
||||||
|
return logger
|
||||||
|
|
||||||
|
#################################################################################################
|
||||||
|
# fonction pour réduire l'affichage des chemins long #
|
||||||
|
#################################################################################################
|
||||||
|
def safe_relpath(path, base_dir=None, max_depth=3, max_name_len=50, prefix="~"):
|
||||||
|
"""
|
||||||
|
Retourne un chemin lisible et sûr pour affichage (logs / UI).
|
||||||
|
|
||||||
|
- Compatible Windows / Linux / macOS
|
||||||
|
- Tronque la profondeur du chemin
|
||||||
|
- Tronque le nom de fichier si trop long
|
||||||
|
- Ne lève jamais d'exception
|
||||||
|
"""
|
||||||
|
|
||||||
|
try:
|
||||||
|
path = Path(path).expanduser().resolve()
|
||||||
|
except Exception:
|
||||||
|
return str(path)
|
||||||
|
|
||||||
|
try:
|
||||||
|
base = Path(base_dir).expanduser().resolve() if base_dir else Path.cwd().resolve()
|
||||||
|
except Exception:
|
||||||
|
base = None
|
||||||
|
|
||||||
|
name = path.name or str(path)
|
||||||
|
if len(name) > max_name_len:
|
||||||
|
stem = path.stem[: max(1, max_name_len - 6)]
|
||||||
|
name = f"{stem}...{path.suffix}"
|
||||||
|
|
||||||
|
try:
|
||||||
|
if base:
|
||||||
|
rel = path.relative_to(base)
|
||||||
|
parts = list(rel.parts)
|
||||||
|
else:
|
||||||
|
raise ValueError
|
||||||
|
except Exception:
|
||||||
|
parts = list(path.parts)
|
||||||
|
|
||||||
|
if not parts:
|
||||||
|
parts = ["."]
|
||||||
|
|
||||||
|
if isinstance(max_depth, int) and max_depth > 0 and len(parts) > max_depth:
|
||||||
|
parts = parts[-max_depth:]
|
||||||
|
parts.insert(0, prefix)
|
||||||
|
|
||||||
|
if parts and parts[-1] not in (".", os.sep):
|
||||||
|
parts[-1] = name
|
||||||
|
|
||||||
|
try:
|
||||||
|
return os.path.join(*parts)
|
||||||
|
except Exception:
|
||||||
|
return name
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
"""
|
||||||
|
!#############################################################################################!
|
||||||
|
|
||||||
|
global_data.py for pythStat.py
|
||||||
|
|
||||||
|
!#############################################################################################!
|
||||||
|
"""
|
||||||
|
|
||||||
|
Version = "2026.01.09"
|
||||||
|
|
||||||
|
#################################################################################################
|
||||||
|
|
||||||
|
error_count = 0 # Compteur d'erreurs
|
||||||
|
debug_log = False
|
||||||
@@ -4,5 +4,10 @@
|
|||||||
"path": "."
|
"path": "."
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"settings": {}
|
"settings": {
|
||||||
|
"cSpell.words": [
|
||||||
|
"ansi",
|
||||||
|
"ENDC"
|
||||||
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+196
-263
File diff suppressed because it is too large
Load Diff
@@ -279,7 +279,7 @@ export model -enable all -o Outputs/Synthese-PSM_LARRA.kml
|
|||||||
# export des statistiques de l'ensemble de la cavité
|
# export des statistiques de l'ensemble de la cavité
|
||||||
# Attention, les points de départ et d'arrivée de chaque centreline correspondent
|
# Attention, les points de départ et d'arrivée de chaque centreline correspondent
|
||||||
# au second point et à l'avant dernier point de la série.
|
# au second point et à l'avant dernier point de la série.
|
||||||
export database -fmt sql -o Outputs/database_Synthese-PSM_LARRA.sql
|
export database -fmt sql -o Outputs/DB_Synthese-PSM_LARRA.sql
|
||||||
|
|
||||||
# Export des fichiers ESRI
|
# Export des fichiers ESRI
|
||||||
export map -proj plan -fmt esri -o Outputs/SHP/ -enc UTF-8
|
export map -proj plan -fmt esri -o Outputs/SHP/ -enc UTF-8
|
||||||
|
|||||||
Reference in New Issue
Block a user