Skip to content

Commit

Permalink
Reorder to_table() and to_json() methods
Browse files Browse the repository at this point in the history
  • Loading branch information
agriyakhetarpal committed Sep 16, 2024
1 parent a90b612 commit 4876f29
Showing 1 changed file with 19 additions and 20 deletions.
39 changes: 19 additions & 20 deletions pyodide_build/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,6 @@ class MetadataView:
pyodide_build: dict[str, str | None]
compatible: bool

@classmethod
def to_json(cls, views: list["MetadataView"]) -> None:
result = json.dumps(
{
"environments": [
{
"version": view.version,
"python": view.python,
"emscripten": view.emscripten,
"pyodide_build": view.pyodide_build,
"compatible": view.compatible,
}
for view in views
]
},
indent=2,
)
print(result)

@classmethod
def to_table(cls, views: list["MetadataView"]) -> None:
columns = [
Expand Down Expand Up @@ -89,5 +70,23 @@ def to_table(cls, views: list["MetadataView"]) -> None:
vertical + vertical.join(f" {cell} " for cell in row) + vertical
)
table.append(bottom_border)

print("\n".join(table))

@classmethod
def to_json(cls, views: list["MetadataView"]) -> None:
result = json.dumps(
{
"environments": [
{
"version": view.version,
"python": view.python,
"emscripten": view.emscripten,
"pyodide_build": view.pyodide_build,
"compatible": view.compatible,
}
for view in views
]
},
indent=2,
)
print(result)

0 comments on commit 4876f29

Please sign in to comment.