This repository has been archived by the owner on Jan 17, 2025. It is now read-only.
forked from atlanhq/atlan-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2069bfd
commit bbeedb4
Showing
73 changed files
with
2,174 additions
and
1,875 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
[mypy] | ||
plugins = pydantic.mypy |
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,39 @@ | ||
import inspect | ||
from enum import Enum | ||
from pathlib import Path | ||
|
||
import pyatlan.model.enums | ||
from pyatlan.generator.class_generator import get_type, get_type_defs | ||
|
||
PARENT = Path(__file__).parent | ||
HEADER = """# SPDX-License-Identifier: Apache-2.0 | ||
# Copyright 2022 Atlan Pte. Ltd. | ||
# Based on original code from https://github.com/apache/atlas (under Apache-2.0 license) | ||
from datetime import datetime | ||
from enum import Enum | ||
""" | ||
WARNING = """# ************************************** | ||
# CODE BELOW IS GENERATED NOT MODIFY ** | ||
# ************************************** | ||
""" | ||
|
||
type_defs = get_type_defs() | ||
enum_def_names = {get_type(enum_def.name) for enum_def in type_defs.enum_defs} | ||
enums_by_name = { | ||
cls_name: cls_obj | ||
for cls_name, cls_obj in inspect.getmembers(pyatlan.model.enums) | ||
if inspect.isclass(cls_obj) and issubclass(cls_obj, Enum) and cls_name != "Enum" | ||
} | ||
all_enum_names = set(enums_by_name.keys()) | ||
generated_enum_names = sorted(enum_def_names.intersection(all_enum_names)) | ||
manual_enum_names = sorted(all_enum_names.difference(enum_def_names)) | ||
with (PARENT / "generated").open("w") as output: | ||
output.write(HEADER) | ||
for name in manual_enum_names: | ||
source = inspect.getsource(enums_by_name[name]) | ||
output.write(source) | ||
output.write(WARNING) | ||
for name in generated_enum_names: | ||
source = inspect.getsource(enums_by_name[name]) | ||
output.write(source) |
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
Oops, something went wrong.