Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Dec 2, 2024
1 parent cc280cb commit e8fad85
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/schema/src/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
IJCadOptions
} from './_interface/jcad';

export const CURRENT_SCHEMA_VERSION = "3.0.0";
export const CURRENT_SCHEMA_VERSION = '3.0.0';

export interface IDict<T = any> {
[key: string]: T;
Expand Down
12 changes: 10 additions & 2 deletions python/jupytercad_core/jupytercad_core/jcad_ydoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,13 @@ def get(self) -> str:
meta = self._ymetadata.to_py()
outputs = self._youtputs.to_py()
return json.dumps(
dict(schemaVersion=CURRENT_SCHEMA_VERSION, objects=objects, options=options, metadata=meta, outputs=outputs),
dict(
schemaVersion=CURRENT_SCHEMA_VERSION,
objects=objects,
options=options,
metadata=meta,
outputs=outputs,
),
indent=2,
sort_keys=True,
)
Expand All @@ -46,7 +52,9 @@ def set(self, value: str) -> None:
valueDict = json.loads(value)

# Assuming file version 3.0.0 if the version is not specified
file_version = valueDict["schemaVersion"] if "schemaVersion" in valueDict else "3.0.0"
file_version = (
valueDict["schemaVersion"] if "schemaVersion" in valueDict else "3.0.0"
)
if file_version != CURRENT_SCHEMA_VERSION:
raise ValueError(f"Cannot load file version {file_version}")

Expand Down
3 changes: 1 addition & 2 deletions python/jupytercad_core/src/jcadplugin/plugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,7 @@ const activate = (
...model,
format: 'text',
size: undefined,
content:
`{\n\t"schemaVersion": "${CURRENT_SCHEMA_VERSION}",\n\t"objects": [],\n\t"options": {},\n\t"metadata": {},\n\t"outputs": {}}`
content: `{\n\t"schemaVersion": "${CURRENT_SCHEMA_VERSION}",\n\t"objects": [],\n\t"options": {},\n\t"metadata": {},\n\t"outputs": {}}`
});

// Open the newly created file with the 'Editor'
Expand Down

0 comments on commit e8fad85

Please sign in to comment.