-
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.
Merge pull request #3 from Palani-SN/psn-max_cnf_parser
Psn max cnf parser
- Loading branch information
Showing
109 changed files
with
3,240 additions
and
318 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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"subclasses": { | ||
"aa": "loosely_coupled/a/aa/aa.json", | ||
"ab": "loosely_coupled/a/ab/ab.json" | ||
} | ||
} |
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,51 @@ | ||
from py4cli.maximal import cnf_parser | ||
|
||
try: | ||
from .aa.aa import AA | ||
from .ab.ab import AB | ||
except: | ||
from aa.aa import AA | ||
from ab.ab import AB | ||
|
||
class A(cnf_parser): | ||
|
||
# Path of files aa & ab to be passed in as arguments | ||
def subclasses(self, aa:str, ab:str): | ||
""" | ||
a.yml: | ||
subclasses: | ||
aa: aa.yml | ||
ab: ab.yml | ||
a.json: | ||
{ | ||
"subclasses": { | ||
"aa": "aa.json", | ||
"ab": "ab.json" | ||
} | ||
} | ||
cmds: | ||
1. python <__file__> a.yml | ||
2. python <__file__> a.json | ||
""" | ||
results = {} | ||
results["ret_aa"] = AA(aa).returned | ||
results["ret_ab"] = AB(ab).returned | ||
return results | ||
|
||
if __name__ == '__main__': | ||
|
||
import sys | ||
import json | ||
|
||
print(sys.argv) | ||
obj = A() | ||
print("") | ||
if obj.returned: | ||
out_dict = obj.returned.copy() | ||
print(json.dumps(out_dict, indent=2, sort_keys=False), type(obj.returned)) | ||
else: | ||
print(obj.returned, type(obj.returned)) |
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,4 @@ | ||
|
||
subclasses: | ||
aa: loosely_coupled/a/aa/aa.yml | ||
ab: loosely_coupled/a/ab/ab.yml |
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,24 @@ | ||
{ | ||
"sub_func": { | ||
"aaa": { | ||
"k1": "v1", | ||
"k2": "v2", | ||
"k3": "v3" | ||
}, | ||
"aab": { | ||
"k1": "v1", | ||
"k2": "v2", | ||
"k3": "v3" | ||
}, | ||
"aac": { | ||
"k1": "v1", | ||
"k2": "v2", | ||
"k3": "v3" | ||
}, | ||
"aad": { | ||
"k1": "v1", | ||
"k2": "v2", | ||
"k3": "v3" | ||
} | ||
} | ||
} |
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,66 @@ | ||
from py4cli.maximal import cnf_parser | ||
|
||
class AA(cnf_parser): | ||
|
||
# params aaa, aab, aac, aad to be passed in as arguments | ||
def sub_func(self, aaa:dict, aab:dict, aac:dict, aad:dict): | ||
""" | ||
aa.yml: | ||
sub_func: | ||
aaa: { "k1": "v1", "k2": "v2", "k3": "v3" } | ||
aab: { "k1": "v1", "k2": "v2", "k3": "v3" } | ||
aac: { "k1": "v1", "k2": "v2", "k3": "v3" } | ||
aad: { "k1": "v1", "k2": "v2", "k3": "v3" } | ||
aa.json: | ||
{ | ||
"subfunc": { | ||
"aaa": { | ||
"k1": "v1", | ||
"k2": "v2", | ||
"k3": "v3" | ||
}, | ||
"aab": { | ||
"k1": "v1", | ||
"k2": "v2", | ||
"k3": "v3" | ||
}, | ||
"aac": { | ||
"k1": "v1", | ||
"k2": "v2", | ||
"k3": "v3" | ||
}, | ||
"aad": { | ||
"k1": "v1", | ||
"k2": "v2", | ||
"k3": "v3" | ||
} | ||
} | ||
} | ||
cmds: | ||
1. python <__file__> aa.yml | ||
2. python <__file__> aa.json | ||
""" | ||
results = {} | ||
results["ret_aaa"] = aaa | ||
results["ret_aab"] = aab | ||
results["ret_aac"] = aac | ||
results["ret_aad"] = aad | ||
return results | ||
|
||
if __name__ == '__main__': | ||
|
||
import sys | ||
import json | ||
|
||
print(sys.argv) | ||
obj = AA() | ||
print("") | ||
if obj.returned: | ||
out_dict = obj.returned.copy() | ||
print(json.dumps(out_dict, indent=2, sort_keys=False), type(obj.returned)) | ||
else: | ||
print(obj.returned, type(obj.returned)) |
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,5 @@ | ||
sub_func: | ||
aaa: { "k1": "v1", "k2": "v2", "k3": "v3" } | ||
aab: { "k1": "v1", "k2": "v2", "k3": "v3" } | ||
aac: { "k1": "v1", "k2": "v2", "k3": "v3" } | ||
aad: { "k1": "v1", "k2": "v2", "k3": "v3" } |
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,24 @@ | ||
{ | ||
"sub_func": { | ||
"aba": { | ||
"k1": "v1", | ||
"k2": "v2", | ||
"k3": "v3" | ||
}, | ||
"abb": { | ||
"k1": "v1", | ||
"k2": "v2", | ||
"k3": "v3" | ||
}, | ||
"abc": { | ||
"k1": "v1", | ||
"k2": "v2", | ||
"k3": "v3" | ||
}, | ||
"abd": { | ||
"k1": "v1", | ||
"k2": "v2", | ||
"k3": "v3" | ||
} | ||
} | ||
} |
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,66 @@ | ||
from py4cli.maximal import cnf_parser | ||
|
||
class AB(cnf_parser): | ||
|
||
# params aba, abb, abc, abd to be passed in as arguments | ||
def sub_func(self, aba:dict, abb:dict, abc:dict, abd:dict): | ||
""" | ||
ab.yml: | ||
sub_func: | ||
aba: { "k1": "v1", "k2": "v2", "k3": "v3" } | ||
abb: { "k1": "v1", "k2": "v2", "k3": "v3" } | ||
abc: { "k1": "v1", "k2": "v2", "k3": "v3" } | ||
abd: { "k1": "v1", "k2": "v2", "k3": "v3" } | ||
ab.json: | ||
{ | ||
"subfunc": { | ||
"aba": { | ||
"k1": "v1", | ||
"k2": "v2", | ||
"k3": "v3" | ||
}, | ||
"abb": { | ||
"k1": "v1", | ||
"k2": "v2", | ||
"k3": "v3" | ||
}, | ||
"abc": { | ||
"k1": "v1", | ||
"k2": "v2", | ||
"k3": "v3" | ||
}, | ||
"abd": { | ||
"k1": "v1", | ||
"k2": "v2", | ||
"k3": "v3" | ||
} | ||
} | ||
} | ||
cmds: | ||
1. python <__file__> ab.yml | ||
2. python <__file__> ab.json | ||
""" | ||
results = {} | ||
results["ret_aba"] = aba | ||
results["ret_abb"] = abb | ||
results["ret_abc"] = abc | ||
results["ret_abd"] = abd | ||
return results | ||
|
||
if __name__ == '__main__': | ||
|
||
import sys | ||
import json | ||
|
||
print(sys.argv) | ||
obj = AB() | ||
print("") | ||
if obj.returned: | ||
out_dict = obj.returned.copy() | ||
print(json.dumps(out_dict, indent=2, sort_keys=False), type(obj.returned)) | ||
else: | ||
print(obj.returned, type(obj.returned)) |
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,5 @@ | ||
sub_func: | ||
aba: {'k1': 'v1', 'k2': 'v2', 'k3': 'v3'} | ||
abb: {'k1': 'v1', 'k2': 'v2', 'k3': 'v3'} | ||
abc: {'k1': 'v1', 'k2': 'v2', 'k3': 'v3'} | ||
abd: {'k1': 'v1', 'k2': 'v2', 'k3': 'v3'} |
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,6 @@ | ||
{ | ||
"subclasses": { | ||
"ba": "loosely_coupled/b/ba/ba.json", | ||
"bb": "loosely_coupled/b/bb/bb.json" | ||
} | ||
} |
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,51 @@ | ||
from py4cli.maximal import cnf_parser | ||
|
||
try: | ||
from .ba.ba import BA | ||
from .bb.bb import BB | ||
except: | ||
from ba.ba import BA | ||
from bb.bb import BB | ||
|
||
class B(cnf_parser): | ||
|
||
# Path of files ba & bb to be passed in as arguments | ||
def subclasses(self, ba:str, bb:str): | ||
""" | ||
b.yml: | ||
subclasses: | ||
ba: ba.yml | ||
bb: bb.yml | ||
b.json: | ||
{ | ||
"subclasses": { | ||
"ba": "ba.json", | ||
"bb": "bb.json" | ||
} | ||
} | ||
cmds: | ||
1. python <__file__> b.yml | ||
2. python <__file__> b.json | ||
""" | ||
results = {} | ||
results["ret_ba"] = BA(ba).returned | ||
results["ret_bb"] = BB(bb).returned | ||
return results | ||
|
||
if __name__ == '__main__': | ||
|
||
import sys | ||
import json | ||
|
||
print(sys.argv) | ||
obj = B() | ||
print("") | ||
if obj.returned: | ||
out_dict = obj.returned.copy() | ||
print(json.dumps(out_dict, indent=2, sort_keys=False), type(obj.returned)) | ||
else: | ||
print(obj.returned, type(obj.returned)) |
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,4 @@ | ||
|
||
subclasses: | ||
ba: loosely_coupled/b/ba/ba.yml | ||
bb: loosely_coupled/b/bb/bb.yml |
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,24 @@ | ||
{ | ||
"sub_func": { | ||
"baa": { | ||
"k1": "v1", | ||
"k2": "v2", | ||
"k3": "v3" | ||
}, | ||
"bab": { | ||
"k1": "v1", | ||
"k2": "v2", | ||
"k3": "v3" | ||
}, | ||
"bac": { | ||
"k1": "v1", | ||
"k2": "v2", | ||
"k3": "v3" | ||
}, | ||
"bad": { | ||
"k1": "v1", | ||
"k2": "v2", | ||
"k3": "v3" | ||
} | ||
} | ||
} |
Oops, something went wrong.