Skip to content

Commit bfd7e61

Browse files
committed
Remove with_ prefix in the builder
Signed-off-by: Rahul Krishna <[email protected]>
1 parent 94eef39 commit bfd7e61

File tree

4 files changed

+155
-174
lines changed

4 files changed

+155
-174
lines changed

codeanalyzer/core.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -287,11 +287,7 @@ def __exit__(self, exc_type, exc_val, exc_tb) -> None:
287287

288288
def analyze(self) -> PyApplication:
289289
"""Return the path to the CodeQL database."""
290-
return (
291-
PyApplication.builder()
292-
.with_symbol_table(self._build_symbol_table())
293-
.build()
294-
)
290+
return PyApplication.builder().symbol_table(self._build_symbol_table()).build()
295291

296292
def _compute_checksum(self, root: Path) -> str:
297293
"""Compute SHA256 checksum of all Python source files in a project directory. If somethings changes, the

codeanalyzer/schema/py_schema.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def builder(cls):
3333
Decorator that generates a builder class for a Pydantic models defined below.
3434
3535
It creates methods like:
36-
- with_<fieldname>(value)
36+
- <fieldname>(value)
3737
- build() to instantiate the model
3838
3939
It supports nested builder patterns and is mypy-compatible.
@@ -70,12 +70,12 @@ def method(self, value):
7070
setattr(self, f"_{f}", value)
7171
return self
7272

73-
method.__name__ = f"with_{f}"
73+
method.__name__ = f"{f}"
7474
method.__annotations__ = {"value": t, "return": builder_name}
7575
method.__doc__ = f"Set {f} ({t.__name__})"
7676
return method
7777

78-
namespace[f"with_{field}"] = make_method()
78+
namespace[f"{field}"] = make_method()
7979

8080
# Create a build method that constructs the model instance using the values set in the builder.
8181
def build(self):

codeanalyzer/semantic_analysis/codeql/codeql_loader.py

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
from pathlib import Path
44

55
import requests
6-
from tqdm import tqdm
7-
86
from codeanalyzer.utils import logger
97

108

@@ -45,22 +43,11 @@ def download_and_extract_codeql(cls, temp_dir: Path) -> Path:
4543
logger.info(f"Downloading CodeQL CLI from {download_url}")
4644
with requests.get(download_url, stream=True) as r:
4745
r.raise_for_status()
48-
total_size = int(r.headers.get("content-length", 0))
4946
block_size = 8192 # 8KB
5047

51-
with (
52-
open(archive_path, "wb") as f,
53-
tqdm(
54-
total=total_size,
55-
unit="B",
56-
unit_scale=True,
57-
unit_divisor=1024,
58-
desc="Downloading CodeQL",
59-
) as bar,
60-
):
48+
with open(archive_path, "wb") as f:
6149
for chunk in r.iter_content(chunk_size=block_size):
6250
f.write(chunk)
63-
bar.update(len(chunk))
6451

6552
extract_dir = temp_dir / filename.replace(".zip", "")
6653
extract_dir.mkdir(exist_ok=True)

0 commit comments

Comments
 (0)