Skip to content

Remove unnecessary f-string prefixes from static strings - #113

Merged
marota merged 1 commit into
feat/pypsa-eur-network-scriptsfrom
claude/fix-fstring-placeholders-BMh5N
Apr 23, 2026
Merged

marota merged 1 commit into
feat/pypsa-eur-network-scriptsfrom
claude/fix-fstring-placeholders-BMh5N

Conversation

@marota

@marota marota commented Apr 23, 2026

Copy link
Copy Markdown
Collaborator

This PR removes the f prefix from f-strings that don't contain any variable interpolations, improving code clarity and following Python best practices.

Key changes made:

  • Removed f prefix from 4 static string literals in logging and print statements across multiple scripts:
    • scripts/pypsa_eur/add_limits_and_overloads.py: 2 occurrences
    • scripts/pypsa_eur/add_detailed_topology.py: 1 occurrence
    • scripts/pypsa_eur/convert_pypsa_to_xiidm.py: 1 occurrence
  • Added missing import sys statement in scripts/pypsa_eur/verify_detailed_topology.py

Implementation details:
These changes convert unnecessary f-strings (which have no placeholders) to regular strings. While functionally equivalent, this improves code readability and reduces unnecessary overhead. The import addition ensures all required modules are properly declared.

https://claude.ai/code/session_016ovnGnHPKUJ9jxdgiZRCec

Resolves ruff F541 on four f-strings without placeholders in the PyPSA-EUR
helper scripts, and adds the missing `import sys` in verify_detailed_topology
(F821) so its final `sys.exit` works.

https://claude.ai/code/session_016ovnGnHPKUJ9jxdgiZRCec
@marota
marota merged commit 4cbf00a into feat/pypsa-eur-network-scripts Apr 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants