style: auto-fix linting issues
This commit is contained in:
parent
868a9d5d37
commit
76c605c6d9
1 changed files with 61 additions and 60 deletions
|
|
@ -35,61 +35,63 @@ from core.shared.testgen_models import (
|
|||
if TYPE_CHECKING:
|
||||
from aiservice.llm_models import LLM
|
||||
|
||||
_JS_RESERVED_WORDS = frozenset({
|
||||
"module",
|
||||
"exports",
|
||||
"require",
|
||||
"global",
|
||||
"process", # Node.js globals
|
||||
"prototype",
|
||||
"constructor",
|
||||
"__proto__", # Object properties
|
||||
"break",
|
||||
"case",
|
||||
"catch",
|
||||
"continue",
|
||||
"debugger",
|
||||
"default",
|
||||
"delete",
|
||||
"do",
|
||||
"else",
|
||||
"finally",
|
||||
"for",
|
||||
"function",
|
||||
"if",
|
||||
"in",
|
||||
"instanceof",
|
||||
"new",
|
||||
"return",
|
||||
"switch",
|
||||
"this",
|
||||
"throw",
|
||||
"try",
|
||||
"typeof",
|
||||
"var",
|
||||
"void",
|
||||
"while",
|
||||
"with",
|
||||
"class",
|
||||
"const",
|
||||
"enum",
|
||||
"export",
|
||||
"extends",
|
||||
"import",
|
||||
"super",
|
||||
"implements",
|
||||
"interface",
|
||||
"let",
|
||||
"package",
|
||||
"private",
|
||||
"protected",
|
||||
"public",
|
||||
"static",
|
||||
"yield",
|
||||
"null",
|
||||
"true",
|
||||
"false",
|
||||
})
|
||||
_JS_RESERVED_WORDS = frozenset(
|
||||
{
|
||||
"module",
|
||||
"exports",
|
||||
"require",
|
||||
"global",
|
||||
"process", # Node.js globals
|
||||
"prototype",
|
||||
"constructor",
|
||||
"__proto__", # Object properties
|
||||
"break",
|
||||
"case",
|
||||
"catch",
|
||||
"continue",
|
||||
"debugger",
|
||||
"default",
|
||||
"delete",
|
||||
"do",
|
||||
"else",
|
||||
"finally",
|
||||
"for",
|
||||
"function",
|
||||
"if",
|
||||
"in",
|
||||
"instanceof",
|
||||
"new",
|
||||
"return",
|
||||
"switch",
|
||||
"this",
|
||||
"throw",
|
||||
"try",
|
||||
"typeof",
|
||||
"var",
|
||||
"void",
|
||||
"while",
|
||||
"with",
|
||||
"class",
|
||||
"const",
|
||||
"enum",
|
||||
"export",
|
||||
"extends",
|
||||
"import",
|
||||
"super",
|
||||
"implements",
|
||||
"interface",
|
||||
"let",
|
||||
"package",
|
||||
"private",
|
||||
"protected",
|
||||
"public",
|
||||
"static",
|
||||
"yield",
|
||||
"null",
|
||||
"true",
|
||||
"false",
|
||||
}
|
||||
)
|
||||
|
||||
_DEFAULT_CLASS_PATTERN = re.compile(r"\bexport\s+default\s+class\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\b")
|
||||
|
||||
|
|
@ -183,7 +185,7 @@ def _detect_export_style(source_code: str, identifier: str) -> str | None:
|
|||
for match in _DEFAULT_CLASS_PATTERN.finditer(normalized):
|
||||
if match.group(1) == identifier:
|
||||
return "default"
|
||||
|
||||
|
||||
for match in _DEFAULT_FUNC_PATTERN.finditer(normalized):
|
||||
if match.group(1) == identifier:
|
||||
return "default"
|
||||
|
|
@ -192,20 +194,19 @@ def _detect_export_style(source_code: str, identifier: str) -> str | None:
|
|||
for match in _NAMED_CLASS_PATTERN.finditer(normalized):
|
||||
if match.group(1) == identifier:
|
||||
return "named"
|
||||
|
||||
|
||||
for match in _NAMED_FUNC_PATTERN.finditer(normalized):
|
||||
if match.group(1) == identifier:
|
||||
return "named"
|
||||
|
||||
|
||||
for match in _NAMED_CONST_PATTERN.finditer(normalized):
|
||||
if match.group(1) == identifier:
|
||||
return "named"
|
||||
|
||||
|
||||
for match in _NAMED_BRACES_PATTERN.finditer(normalized):
|
||||
if match.group(1) == identifier:
|
||||
return "named"
|
||||
|
||||
|
||||
return None
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue