|
| 1 | +from frost_sta_client.odata_codegen.generator import generate_from_url |
| 2 | + |
| 3 | +def write_part_of_init(path): |
| 4 | + str = """from frost_sta_client import model |
| 5 | +from frost_sta_client import dao |
| 6 | +from frost_sta_client import query |
| 7 | +from frost_sta_client import service |
| 8 | +
|
| 9 | +import jsonpickle |
| 10 | +
|
| 11 | +jsonpickle.load_backend('demjson3', 'encode', 'decode', 'JSONDecodeError') |
| 12 | +jsonpickle.set_preferred_backend('demjson3') |
| 13 | +jsonpickle.set_decoder_options("demjson3", decode_float=float) |
| 14 | +
|
| 15 | +from .__version__ import (__title__, __version__, __license__, __author__, __contact__, __url__, |
| 16 | + __description__, __copyright__) |
| 17 | +""" |
| 18 | + with open(path, 'w', encoding='utf-8') as file: |
| 19 | + file.write(str) |
| 20 | + |
| 21 | +def write_full_init(path): |
| 22 | + str = """from frost_sta_client import model |
| 23 | +from frost_sta_client import dao |
| 24 | +from frost_sta_client import query |
| 25 | +from frost_sta_client import service |
| 26 | +
|
| 27 | +from frost_sta_client.model.actuator import Actuator |
| 28 | +from frost_sta_client.model.datastream import Datastream |
| 29 | +from frost_sta_client.model.entity import Entity |
| 30 | +from frost_sta_client.model.feature_of_interest import FeatureOfInterest |
| 31 | +from frost_sta_client.model.historical_location import HistoricalLocation |
| 32 | +from frost_sta_client.model.location import Location |
| 33 | +from frost_sta_client.model.multi_datastream import MultiDatastream |
| 34 | +from frost_sta_client.model.observation import Observation |
| 35 | +from frost_sta_client.model.observedproperty import ObservedProperty |
| 36 | +from frost_sta_client.model.sensor import Sensor |
| 37 | +from frost_sta_client.model.task import Task |
| 38 | +from frost_sta_client.model.tasking_capability import TaskingCapability |
| 39 | +from frost_sta_client.model.thing import Thing |
| 40 | +from frost_sta_client.model.ext.unitofmeasurement import UnitOfMeasurement |
| 41 | +from frost_sta_client.service.sensorthingsservice import SensorThingsService |
| 42 | +from frost_sta_client.service.auth_handler import AuthHandler |
| 43 | +from frost_sta_client.model.ext.entity_type import EntityTypes |
| 44 | +from frost_sta_client.model.ext.entity_list import EntityList |
| 45 | +from frost_sta_client.model.ext.data_array_value import DataArrayValue |
| 46 | +from frost_sta_client.model.ext.data_array_document import DataArrayDocument |
| 47 | +
|
| 48 | +import jsonpickle |
| 49 | +
|
| 50 | +jsonpickle.load_backend('demjson3', 'encode', 'decode', 'JSONDecodeError') |
| 51 | +jsonpickle.set_preferred_backend('demjson3') |
| 52 | +jsonpickle.set_decoder_options("demjson3", decode_float=float) |
| 53 | +
|
| 54 | +from .__version__ import (__title__, __version__, __license__, __author__, __contact__, __url__, |
| 55 | + __description__, __copyright__) |
| 56 | +""" |
| 57 | + with open(path, 'w', encoding='utf-8') as file: |
| 58 | + file.write(str) |
| 59 | + |
| 60 | +def main(argv: Optional[List[str]] = None) -> int: |
| 61 | + init_path="frost_sta_client/__init__.py" |
| 62 | + write_part_of_init(init_path) |
| 63 | + generate_from_url(args.url, args.out, args.module, auth=auth) |
| 64 | + write_full_init(init_path) |
| 65 | + return 0 |
| 66 | + |
| 67 | +if __name__ == '__main__': |
| 68 | + raise SystemExit(main()) |
0 commit comments