Skip to content

Commit 5601e16

Browse files
committed
make format
1 parent c83d722 commit 5601e16

3 files changed

Lines changed: 59 additions & 33 deletions

File tree

fastly_compute/config_store.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,4 +66,3 @@ def __contains__(self, key: str) -> bool:
6666
if not isinstance(key, str):
6767
raise KeyError("Key must be a str")
6868
return self.get(key) is not None
69-

fastly_compute/wsgi.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,9 @@ def __call__(self):
206206
"""
207207
return self
208208

209-
def handle(self, request: _wit_http_req.Request, body: _wit_async_io.Pollable) -> None:
209+
def handle(
210+
self, request: _wit_http_req.Request, body: _wit_async_io.Pollable
211+
) -> None:
210212
"""Handle incoming HTTP requests by serving them through the WSGI app."""
211213
# Wrap the raw WIT export-boundary resources into _bindings wrapper
212214
# types before passing them to the rest of the SDK.

scripts/generate_bindings/generation.py

Lines changed: 56 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@
3131
@dataclass
3232
class ExtraImport:
3333
"""A single import line to emit at the top of a generated module."""
34-
module: str # e.g. "wit_world.imports.http_types"
35-
name: str # e.g. "HttpVersion"
34+
35+
module: str # e.g. "wit_world.imports.http_types"
36+
name: str # e.g. "HttpVersion"
3637

3738

3839
def _all_type_refs(interface: Interface) -> list[Type]:
@@ -111,15 +112,19 @@ def _extra_imports_for_interface(interface: Interface) -> list[ExtraImport]:
111112
seen_names.add(type_name)
112113

113114
if isinstance(t, Resource):
114-
imports.append(ExtraImport(
115-
module=f"fastly_compute._bindings.{owner_module}",
116-
name=type_name,
117-
))
115+
imports.append(
116+
ExtraImport(
117+
module=f"fastly_compute._bindings.{owner_module}",
118+
name=type_name,
119+
)
120+
)
118121
elif isinstance(t, Enum | Variant | Flags):
119-
imports.append(ExtraImport(
120-
module=f"wit_world.imports.{owner_module}",
121-
name=type_name,
122-
))
122+
imports.append(
123+
ExtraImport(
124+
module=f"wit_world.imports.{owner_module}",
125+
name=type_name,
126+
)
127+
)
123128

124129
return sorted(imports, key=lambda i: (i.module, i.name))
125130

@@ -241,25 +246,23 @@ def generate_binding_module(interface: Interface, env: Environment) -> str:
241246
module_docstring = interface.docstring(indent=0) or ""
242247
reexports = _reexports_for_interface(interface)
243248
extra_imports = _extra_imports_for_interface(interface)
244-
public_names = _public_names(records, resources_and_methods, freestanding, reexports, extra_imports)
249+
public_names = _public_names(
250+
records, resources_and_methods, freestanding, reexports, extra_imports
251+
)
245252

246253
needs_resource = bool(resources_and_methods)
247-
needs_decorator = (
248-
any(f.raises_errors() for _, methods in resources_and_methods for f in methods)
249-
or any(f.raises_errors() for f in freestanding)
250-
)
251-
needs_self = (
252-
any(
253-
f.return_annotation(r) == "Self"
254-
for r, methods in resources_and_methods
255-
for f in methods
256-
if f.kind() == "static"
257-
)
258-
or any(
259-
f.kind() == "constructor"
260-
for _, methods in resources_and_methods
261-
for f in methods
262-
)
254+
needs_decorator = any(
255+
f.raises_errors() for _, methods in resources_and_methods for f in methods
256+
) or any(f.raises_errors() for f in freestanding)
257+
needs_self = any(
258+
f.return_annotation(r) == "Self"
259+
for r, methods in resources_and_methods
260+
for f in methods
261+
if f.kind() == "static"
262+
) or any(
263+
f.kind() == "constructor"
264+
for _, methods in resources_and_methods
265+
for f in methods
263266
)
264267

265268
template = env.get_template("bindings_module.py.jinja")
@@ -285,17 +288,39 @@ def _format(code: str, filename: str) -> str:
285288
"""
286289
# Fix import order first (isort equivalent).
287290
result = run(
288-
["uv", "run", "--extra", "dev", "ruff", "check", "--fix", "--exit-zero",
289-
"--select", "I", "--stdin-filename", filename, "-"],
291+
[
292+
"uv",
293+
"run",
294+
"--extra",
295+
"dev",
296+
"ruff",
297+
"check",
298+
"--fix",
299+
"--exit-zero",
300+
"--select",
301+
"I",
302+
"--stdin-filename",
303+
filename,
304+
"-",
305+
],
290306
input=code,
291307
capture_output=True,
292308
text=True,
293309
)
294310
code = result.stdout or code
295311
# Then format.
296312
result = run(
297-
["uv", "run", "--extra", "dev", "ruff", "format",
298-
"--stdin-filename", filename, "-"],
313+
[
314+
"uv",
315+
"run",
316+
"--extra",
317+
"dev",
318+
"ruff",
319+
"format",
320+
"--stdin-filename",
321+
filename,
322+
"-",
323+
],
299324
input=code,
300325
capture_output=True,
301326
text=True,

0 commit comments

Comments
 (0)