-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into 289_csm_interp_time_range
- Loading branch information
Showing
176 changed files
with
2,595 additions
and
2,455 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
from pathlib import Path | ||
|
||
import yaml | ||
|
||
from weldx.asdf.types import _legacy_tag_from_new_tag | ||
from weldx.asdf.util import get_converter_for_tag | ||
|
||
|
||
def update_manifest( | ||
search_dir: str = "../../schemas", | ||
out: str = "../../manifests/weldx-1.0.0.yaml", | ||
): | ||
"""Create manifest file from existing schemas.""" | ||
# read existing manifest | ||
manifest = yaml.load( | ||
Path(out).read_text(), | ||
Loader=yaml.SafeLoader, | ||
) | ||
|
||
# keep only ASDF schema mappings | ||
manifest["tags"] = [ | ||
mapping | ||
for mapping in manifest["tags"] | ||
if mapping["schema_uri"].startswith("http://stsci.edu/schemas") | ||
] | ||
|
||
schemas = Path(search_dir).rglob("*.yaml") | ||
|
||
for schema in schemas: | ||
content = yaml.load( | ||
schema.read_text(), | ||
Loader=yaml.SafeLoader, | ||
) | ||
if "id" in content: # should be schema file | ||
uri: str = content["id"] | ||
tag = uri.replace("/schemas/", "/tags/") | ||
if get_converter_for_tag(tag): # check if converter is implemented | ||
manifest["tags"].append(dict(tag_uri=tag, schema_uri=uri)) | ||
manifest["tags"].append( | ||
dict(tag_uri=_legacy_tag_from_new_tag(tag), schema_uri=uri) | ||
) # legacy_tag | ||
else: | ||
print(f"No converter for URI: {schema}") | ||
|
||
with open(Path(out), "w") as outfile: | ||
outfile.write("%YAML 1.1\n---\n") | ||
yaml.dump( | ||
manifest, | ||
outfile, | ||
default_flow_style=False, | ||
sort_keys=False, | ||
) | ||
outfile.write("...\n") | ||
|
||
|
||
if __name__ == "__main__": | ||
update_manifest() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.