Skip to content

Commit b569d44

Browse files
committed
linting
1 parent 2a2a3a3 commit b569d44

File tree

2 files changed

+24
-25
lines changed

2 files changed

+24
-25
lines changed

codeflash/code_utils/code_extractor.py

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -444,28 +444,28 @@ def resolve_star_import(module_name: str, project_root: Path) -> set[str]:
444444

445445
if all_names is not None:
446446
return set(all_names)
447-
else:
448-
public_names = set()
449-
for node in tree.body:
450-
if isinstance(node, (ast.FunctionDef, ast.AsyncFunctionDef, ast.ClassDef)):
451-
if not node.name.startswith("_"):
452-
public_names.add(node.name)
453-
elif isinstance(node, ast.Assign):
454-
for target in node.targets:
455-
if isinstance(target, ast.Name) and not target.id.startswith("_"):
456-
public_names.add(target.id)
457-
elif isinstance(node, ast.AnnAssign):
458-
if isinstance(node.target, ast.Name) and not node.target.id.startswith("_"):
459-
public_names.add(node.target.id)
460-
elif isinstance(node, ast.Import) or (
461-
isinstance(node, ast.ImportFrom) and not any(alias.name == "*" for alias in node.names)
462-
):
463-
for alias in node.names:
464-
name = alias.asname or alias.name
465-
if not name.startswith("_"):
466-
public_names.add(name)
467447

468-
return public_names
448+
public_names = set()
449+
for node in tree.body:
450+
if isinstance(node, (ast.FunctionDef, ast.AsyncFunctionDef, ast.ClassDef)):
451+
if not node.name.startswith("_"):
452+
public_names.add(node.name)
453+
elif isinstance(node, ast.Assign):
454+
for target in node.targets:
455+
if isinstance(target, ast.Name) and not target.id.startswith("_"):
456+
public_names.add(target.id)
457+
elif isinstance(node, ast.AnnAssign):
458+
if isinstance(node.target, ast.Name) and not node.target.id.startswith("_"):
459+
public_names.add(node.target.id)
460+
elif isinstance(node, ast.Import) or (
461+
isinstance(node, ast.ImportFrom) and not any(alias.name == "*" for alias in node.names)
462+
):
463+
for alias in node.names:
464+
name = alias.asname or alias.name
465+
if not name.startswith("_"):
466+
public_names.add(name)
467+
468+
return public_names # noqa: TRY300
469469

470470
except Exception as e:
471471
logger.warning(f"Error resolving star import for {module_name}: {e}")

codeflash/code_utils/codeflash_wrap_decorator.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,14 @@
1313
import dill as pickle
1414

1515

16-
class VerificationType(str, Enum): # moved from codeflash/verification/codeflash_capture.py
16+
class VerificationType(str, Enum): # moved from codeflash/verification/codeflash_capture.py
1717
FUNCTION_CALL = (
1818
"function_call" # Correctness verification for a test function, checks input values and output values)
1919
)
2020
INIT_STATE_FTO = "init_state_fto" # Correctness verification for fto class instance attributes after init
2121
INIT_STATE_HELPER = "init_state_helper" # Correctness verification for helper class instance attributes after init
2222

2323

24-
2524
F = TypeVar("F", bound=Callable[..., Any])
2625

2726

@@ -131,9 +130,9 @@ async def async_wrapper(*args: Any, **kwargs: Any) -> Any: # noqa: ANN401
131130
exception = None
132131
gc.disable()
133132
try:
134-
ret = func(*args, **kwargs) # coroutine creation has some overhead, though it is very small
133+
ret = func(*args, **kwargs) # coroutine creation has some overhead, though it is very small
135134
counter = time.perf_counter_ns()
136-
return_value = await ret # let's measure the actual execution time of the code
135+
return_value = await ret # let's measure the actual execution time of the code
137136
codeflash_duration = time.perf_counter_ns() - counter
138137
except Exception as e:
139138
codeflash_duration = time.perf_counter_ns() - counter

0 commit comments

Comments
 (0)