Skip to content

Commit

Permalink
hxlm(#11), hxl-processing-specs (#14): created hxlm.core.model.hdp HD…
Browse files Browse the repository at this point in the history
…P class
  • Loading branch information
fititnt committed Mar 13, 2021
1 parent 819196d commit e516c56
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 0 deletions.
21 changes: 21 additions & 0 deletions hxlm/core/bin/hdpcli.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@
# get_urn_resolver_remote,
# HXLM_CONFIG_BASE
)

from hxlm.core.model.hdp import (
HDP
)

from hxlm.core.constant import (
HXLM_ROOT
)
Expand Down Expand Up @@ -153,6 +158,15 @@ def __init__(self):
self.EXIT_ERROR = 1
self.EXIT_SYNTAX = 2

def _exec_export_to_hxl_json_processing_specs(self,
hdp_entry_point: str) -> HDP:

hdp = HDP(hdp_entry_point=hdp_entry_point)

return hdp

# return self.EXIT_OK

def _exec_hdp_init(self, config_base: str = None,
data_base: str = None,
please: bool = None) -> int:
Expand Down Expand Up @@ -511,6 +525,13 @@ def execute_cli(self, args,
if 'debug' in args and args.debug:
print('DEBUG: CLI args [[', args, ']]')

if args.export_to_hxl_json_processing_specs:
hdp = self._exec_export_to_hxl_json_processing_specs(
hdp_entry_point=args.export_to_hxl_json_processing_specs
)
# print('export_to_hxl_json_processing_specs', hdp)
return str(hdp)

# TODO: 'Is AI just a bunch of if and else statements?'
if (args.hdp_init and (args.hdp_init_home or args.hdp_init_data)) or \
(args.hdp_init_home and (args.hdp_init
Expand Down
38 changes: 38 additions & 0 deletions hxlm/core/model/hdp.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
"""hxlm.core.model.hdp contains HDP class
This is used by the HDP Declarative Programming Command Line Interface
Copyleft 🄯 2021, Emerson Rocha (Etica.AI) <[email protected]>
License: Public Domain / BSD Zero Clause License
SPDX-License-Identifier: Unlicense OR 0BSD
"""


class HDP:
"""Class used by HDP Declarative Programming Command Line Interface
"""

def __init__(self, hdp_entry_point: str = None,
yml_string: str = None,
json_string: str = None
):
"""
Constructs all the necessary attributes for the HDPCLI object.
"""

if hdp_entry_point:
self._prepare_from_entry_point(hdp_entry_point)
if json_string:
self._prepare_from_json_string(json_string)
if yml_string:
self._prepare_from_entry_point(yml_string)

def _prepare_from_entry_point(self, hdp_entry_point):
pass

def _prepare_from_json_string(self, json_string):
pass

def _prepare_from_yml_string(self, hdp_yml_string):
pass
File renamed without changes.
4 changes: 4 additions & 0 deletions tests/manual-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ sudo snap install ngrok
./hxlm/core/bin/hdpcli.py --debug --hdp-init-data /tmp/hdp-test --please
./hxlm/core/bin/hdpcli.py --debug --hdp-init-data /tmp/hdp-test

### hdpcli --export-to-hxl-json-processing-specs ...............................

hdpcli --export-to-hxl-json-processing-specs tests/hxl-processing-specs/hxl-processing-specs-test-01.hdp.yml --debug


# https://raw.githubusercontent.com/HXLStandard/libhxl-python/master/profile/data/unhcr_popstats_export_persons_of_concern_all_data.hxl
### hxl2example ----------------------------------------------------------------
Expand Down

0 comments on commit e516c56

Please sign in to comment.