fix(raw): _format_args sostituisce {year} anche su path normalizzati Path - #461
Merged
Conversation
…Path
Regressione: _normalize_paths converte args.path (local_file) in PosixPath;
il placeholder {year} non veniva sostituito su valori Path, quindi i seed
locali con {year} nel path fallivano. Ora sostituito anche su Path.
Test: +2 (path con {year} sostituito, path senza {year} invariato).
CI: mypy falliva — formatted non tipizzato inferiva url come Path, poi assegnazione str e Path+str. Ora formatted: dict[str, Any] e base_url = str(formatted['url']) prima del suffix.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tipo
root fix —
_format_argsnon sostituiva{year}sui path normalizzati aPosixPath.Problema reale
_normalize_pathsconverteraw.sources[].args.path(tipolocal_file) inPosixPath._format_argsgestiva la sostituzione di{year}solo su valoristr— i pathPathcon placeholder restavano non sostituiti, facendo fallire i seed locali con{year}nel percorso.Contratto riusato/sostituito
{year}→str(year)già esistente per le stringhe (replace, nonstr.format, per non confliggere con{}di SPARQL).if isinstance(v, str)ora gestisce anchePath.Implementazione
toolkit/raw/_fetch_utils.pyPathin_format_args: sostituisce{year}sustr(v), ri-costruiscePath; path senza placeholder restituito invariato (stesso tipo)tests/test_raw_run_format_args.py{year}sostituito, path senza{year}invariatoVerifica
Path("/repo/_local/seed/dati/{year}/ETA_{year}.CSV")→Path(".../dati/2024/ETA_2024.CSV"); path senza placeholder →Pathinvariato.Rischio residuo
Nessuno — fix mirato a un tipo di valore (
Path) del branch esistente.Follow-up
Nessuno obbligatorio.