mirror of
https://github.com/Alex38Lyon/Synthese-PSM_LARRA.git
synced 2026-11-30 04:08:35 +00:00
Debug
This commit is contained in:
1 parent
4dcb52ad42
commit
77e3006826
63 files changed
+100249
-2699
No files matched your search
+2
@@ -11,8 +11,10 @@
|
||||
"outputfolder",
|
||||
"outputspath",
|
||||
"pathshp",
|
||||
"qgis",
|
||||
"Qgis",
|
||||
"shapefiles",
|
||||
"TETE",
|
||||
"thconfig",
|
||||
"therion",
|
||||
"TYPEFCR"
|
||||
|
||||
Binary file not shown.
@@ -1,13 +0,0 @@
|
||||
PROJCS["ED_1950_UTM_Zone_30N",
|
||||
GEOGCS["GCS_European_1950",
|
||||
DATUM["D_European_1950",
|
||||
SPHEROID["International_1924",6378388.0,297.0]],
|
||||
PRIMEM["Greenwich",0.0],
|
||||
UNIT["Degree",0.0174532925199433]],
|
||||
PROJECTION["Transverse_Mercator"],
|
||||
PARAMETER["False_Easting",500000.0],
|
||||
PARAMETER["False_Northing",0.0],
|
||||
PARAMETER["Central_Meridian",-3.0],
|
||||
PARAMETER["Scale_Factor",0.9996],
|
||||
PARAMETER["Latitude_Of_Origin",0.0],
|
||||
UNIT["Meter",1.0]]
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,13 +0,0 @@
|
||||
PROJCS["ED_1950_UTM_Zone_30N",
|
||||
GEOGCS["GCS_European_1950",
|
||||
DATUM["D_European_1950",
|
||||
SPHEROID["International_1924",6378388.0,297.0]],
|
||||
PRIMEM["Greenwich",0.0],
|
||||
UNIT["Degree",0.0174532925199433]],
|
||||
PROJECTION["Transverse_Mercator"],
|
||||
PARAMETER["False_Easting",500000.0],
|
||||
PARAMETER["False_Northing",0.0],
|
||||
PARAMETER["Central_Meridian",-3.0],
|
||||
PARAMETER["Scale_Factor",0.9996],
|
||||
PARAMETER["Latitude_Of_Origin",0.0],
|
||||
UNIT["Meter",1.0]]
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,13 +0,0 @@
|
||||
PROJCS["ED_1950_UTM_Zone_30N",
|
||||
GEOGCS["GCS_European_1950",
|
||||
DATUM["D_European_1950",
|
||||
SPHEROID["International_1924",6378388.0,297.0]],
|
||||
PRIMEM["Greenwich",0.0],
|
||||
UNIT["Degree",0.0174532925199433]],
|
||||
PROJECTION["Transverse_Mercator"],
|
||||
PARAMETER["False_Easting",500000.0],
|
||||
PARAMETER["False_Northing",0.0],
|
||||
PARAMETER["Central_Meridian",-3.0],
|
||||
PARAMETER["Scale_Factor",0.9996],
|
||||
PARAMETER["Latitude_Of_Origin",0.0],
|
||||
UNIT["Meter",1.0]]
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,13 +0,0 @@
|
||||
PROJCS["ED_1950_UTM_Zone_30N",
|
||||
GEOGCS["GCS_European_1950",
|
||||
DATUM["D_European_1950",
|
||||
SPHEROID["International_1924",6378388.0,297.0]],
|
||||
PRIMEM["Greenwich",0.0],
|
||||
UNIT["Degree",0.0174532925199433]],
|
||||
PROJECTION["Transverse_Mercator"],
|
||||
PARAMETER["False_Easting",500000.0],
|
||||
PARAMETER["False_Northing",0.0],
|
||||
PARAMETER["Central_Meridian",-3.0],
|
||||
PARAMETER["Scale_Factor",0.9996],
|
||||
PARAMETER["Latitude_Of_Origin",0.0],
|
||||
UNIT["Meter",1.0]]
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,13 +0,0 @@
|
||||
PROJCS["ED_1950_UTM_Zone_30N",
|
||||
GEOGCS["GCS_European_1950",
|
||||
DATUM["D_European_1950",
|
||||
SPHEROID["International_1924",6378388.0,297.0]],
|
||||
PRIMEM["Greenwich",0.0],
|
||||
UNIT["Degree",0.0174532925199433]],
|
||||
PROJECTION["Transverse_Mercator"],
|
||||
PARAMETER["False_Easting",500000.0],
|
||||
PARAMETER["False_Northing",0.0],
|
||||
PARAMETER["Central_Meridian",-3.0],
|
||||
PARAMETER["Scale_Factor",0.9996],
|
||||
PARAMETER["Latitude_Of_Origin",0.0],
|
||||
UNIT["Meter",1.0]]
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,13 +0,0 @@
|
||||
PROJCS["ED_1950_UTM_Zone_30N",
|
||||
GEOGCS["GCS_European_1950",
|
||||
DATUM["D_European_1950",
|
||||
SPHEROID["International_1924",6378388.0,297.0]],
|
||||
PRIMEM["Greenwich",0.0],
|
||||
UNIT["Degree",0.0174532925199433]],
|
||||
PROJECTION["Transverse_Mercator"],
|
||||
PARAMETER["False_Easting",500000.0],
|
||||
PARAMETER["False_Northing",0.0],
|
||||
PARAMETER["Central_Meridian",-3.0],
|
||||
PARAMETER["Scale_Factor",0.9996],
|
||||
PARAMETER["Latitude_Of_Origin",0.0],
|
||||
UNIT["Meter",1.0]]
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,13 +0,0 @@
|
||||
PROJCS["ED_1950_UTM_Zone_30N",
|
||||
GEOGCS["GCS_European_1950",
|
||||
DATUM["D_European_1950",
|
||||
SPHEROID["International_1924",6378388.0,297.0]],
|
||||
PRIMEM["Greenwich",0.0],
|
||||
UNIT["Degree",0.0174532925199433]],
|
||||
PROJECTION["Transverse_Mercator"],
|
||||
PARAMETER["False_Easting",500000.0],
|
||||
PARAMETER["False_Northing",0.0],
|
||||
PARAMETER["Central_Meridian",-3.0],
|
||||
PARAMETER["Scale_Factor",0.9996],
|
||||
PARAMETER["Latitude_Of_Origin",0.0],
|
||||
UNIT["Meter",1.0]]
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -5,10 +5,15 @@
|
||||
!# #
|
||||
!#############################################################################################
|
||||
|
||||
Alex 2026 08 30
|
||||
Alex 2026 10 25
|
||||
|
||||
"""
|
||||
import os, logging, sys, re, unicodedata
|
||||
|
||||
import logging
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
import unicodedata
|
||||
from pathlib import Path
|
||||
|
||||
log = logging.getLogger("Logger")
|
||||
@@ -17,37 +22,40 @@ 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.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'
|
||||
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;90m\033[41m"
|
||||
HEADER2 = "\033[1;37m\033[41m"
|
||||
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 #
|
||||
@@ -60,18 +68,19 @@ def colored_help(parser):
|
||||
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.ERROR}Options:{Colors.ENDC}').replace(
|
||||
'--option', f'{Colors.GREEN}--option{Colors.ENDC}').replace(
|
||||
'-h, --help', f'{Colors.GREEN}-h, --help{Colors.ENDC}').replace(
|
||||
'positional arguments:', f'{Colors.BLUE}positional arguments:{Colors.ENDC}')
|
||||
colored_help_text = (
|
||||
help_text.replace("usage:", f"{Colors.ERROR}Usage:{Colors.ENDC}")
|
||||
.replace("options:", f"{Colors.ERROR}Options:{Colors.ENDC}")
|
||||
.replace("--option", f"{Colors.GREEN}--option{Colors.ENDC}")
|
||||
.replace("-h, --help", f"{Colors.GREEN}-h, --help{Colors.ENDC}")
|
||||
.replace("positional arguments:", f"{Colors.BLUE}positional arguments:{Colors.ENDC}")
|
||||
)
|
||||
|
||||
# Surligner les arguments
|
||||
# for action in parser._actions:
|
||||
@@ -79,11 +88,12 @@ def colored_help(parser):
|
||||
# # 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 #
|
||||
#################################################################################################
|
||||
@@ -98,34 +108,36 @@ def sanitize_filename(thName):
|
||||
|
||||
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')
|
||||
thName = unicodedata.normalize("NFKD", thName).encode("ASCII", "ignore").decode("ASCII")
|
||||
|
||||
# Replace parentheses with underscores
|
||||
thName = thName.replace('(', '_').replace(')', '_')
|
||||
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
|
||||
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('_')
|
||||
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)
|
||||
ansi_escape = re.compile(r"\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])")
|
||||
return ansi_escape.sub("", text)
|
||||
|
||||
|
||||
#################################################################################################
|
||||
# Formatter pour la console avec couleurs #
|
||||
@@ -136,6 +148,7 @@ class ConsoleFormatter(logging.Formatter):
|
||||
message = super().format(record)
|
||||
return f"{color}{message}{RESET}"
|
||||
|
||||
|
||||
#################################################################################################
|
||||
# Formatter pour le fichier avec "!!!" sur les erreurs #
|
||||
#################################################################################################
|
||||
@@ -152,10 +165,11 @@ class FileFormatter(logging.Formatter):
|
||||
args=(),
|
||||
exc_info=record.exc_info,
|
||||
func=record.funcName,
|
||||
sinfo=record.stack_info
|
||||
sinfo=record.stack_info,
|
||||
)
|
||||
return super().format(record_copy)
|
||||
|
||||
|
||||
|
||||
#################################################################################################
|
||||
# Fonction de configuration du logger #
|
||||
#################################################################################################
|
||||
@@ -163,9 +177,9 @@ 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)
|
||||
@@ -179,9 +193,10 @@ def setup_logger(logfile="app.log", debug_log=False):
|
||||
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 #
|
||||
#################################################################################################
|
||||
@@ -197,12 +212,12 @@ def safe_relpath(path, base_dir=None, max_depth=3, max_name_len=50, prefix="~"):
|
||||
|
||||
try:
|
||||
path = Path(path).expanduser().resolve()
|
||||
except Exception:
|
||||
except Exception: # noqa: BLE001
|
||||
return str(path)
|
||||
|
||||
try:
|
||||
base = Path(base_dir).expanduser().resolve() if base_dir else Path.cwd().resolve()
|
||||
except Exception:
|
||||
except Exception: # noqa: BLE001
|
||||
base = None
|
||||
|
||||
name = path.name or str(path)
|
||||
@@ -216,7 +231,7 @@ def safe_relpath(path, base_dir=None, max_depth=3, max_name_len=50, prefix="~"):
|
||||
parts = list(rel.parts)
|
||||
else:
|
||||
raise ValueError
|
||||
except Exception:
|
||||
except Exception: # noqa: BLE001
|
||||
parts = list(path.parts)
|
||||
|
||||
if not parts:
|
||||
@@ -231,9 +246,5 @@ def safe_relpath(path, base_dir=None, max_depth=3, max_name_len=50, prefix="~"):
|
||||
|
||||
try:
|
||||
return os.path.join(*parts)
|
||||
except Exception:
|
||||
except Exception: # noqa: BLE001
|
||||
return name
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,25 +1,26 @@
|
||||
"""
|
||||
!#############################################################################################
|
||||
!# #
|
||||
!# global_data.py for pyThtoQgis.py #
|
||||
!# #
|
||||
!#############################################################################################
|
||||
#################################################################################################
|
||||
!# #
|
||||
!# global_data.py for pyThtoQgis.py #
|
||||
!# #
|
||||
#################################################################################################
|
||||
|
||||
"""
|
||||
|
||||
#################################################################################################
|
||||
Version = "2026.08.31"
|
||||
Version = "2026.10.26"
|
||||
#################################################################################################
|
||||
|
||||
pathshp = ".\\Inputs\\"
|
||||
pathshp = ".\\Temp_qgis\\"
|
||||
|
||||
outputfolder ="QGis_GPKG_Files"
|
||||
outputspath = ".\\outputfolder"
|
||||
outputfolder = "QGis_GPKG_Files"
|
||||
outputspath = ".\\Temp_qgis\\QGis_GPKG_Files\\"
|
||||
|
||||
file_log = "pyThtoQgis.log"
|
||||
output_log = ".\\" + file_log
|
||||
|
||||
errorCount = 0
|
||||
geometryErrors = []
|
||||
geometryWarning = []
|
||||
|
||||
debug_log = False
|
||||
debug_log = False
|
||||
@@ -12,7 +12,9 @@
|
||||
"Ggis",
|
||||
"multipartie",
|
||||
"outputfolder",
|
||||
"qgis",
|
||||
"Qgis",
|
||||
"TETE",
|
||||
"TYPEFCR"
|
||||
]
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
+649
-2308
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,6 @@
|
||||
|
||||
[tool.ruff]
|
||||
line-length = 170
|
||||
|
||||
[tool.ruff.format]
|
||||
skip-magic-trailing-comma = true
|
||||
Reference in new issue
Block a user