Skip to content

Commit

Permalink
Added noqa exception for FLY002 - alternatives are not great:
Browse files Browse the repository at this point in the history
  - f-strings don't really help (it would be a mess)
  - triple quotes preserve indentation
  - backslash at end of string for continuation is nasty and requires
	manually adding \n newlines
  • Loading branch information
ukmo-ccbunney committed Nov 19, 2024
1 parent f7281a5 commit d57a90c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions cf_units/_udunits2_parser/compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def fixup_antlr_imports(antlr_file_path: Path, contents: str) -> str:
if antlr_file_path.name == "XPathLexer.py":
contents = contents.replace(
"from antlr4 import *",
"\n".join(
"\n".join( # noqa: FLY002
[
"from antlr4.Lexer import Lexer",
"from antlr4.atn.ATNDeserializer import ATNDeserializer",
Expand All @@ -92,7 +92,7 @@ def fixup_antlr_imports(antlr_file_path: Path, contents: str) -> str:
"from antlr4 import CommonTokenStream, DFA, "
"PredictionContextCache, "
"Lexer, LexerATNSimulator, ParserRuleContext, TerminalNode",
"\n".join(
"\n".join( # noqa: FLY002
[
"from antlr4.Lexer import Lexer",
"from antlr4.CommonTokenStream import CommonTokenStream",
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ ignore = [
"F405", # Use of name from wildcard import
# "FBT002", # boolean-default-value-positional-argument
"FIX002", # Line contains TODO, consider resolving the issue
"FLY002", # Consider f-string instead of string join
# "FLY002", # Consider f-string instead of string join
"INP001", # part of an implicit namespace package. Add an `__init__.py`.
"N801", # invalid-class-name
"N802", # invalid-function-name
Expand Down

0 comments on commit d57a90c

Please sign in to comment.