-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDEVS.py
More file actions
92 lines (79 loc) · 2.87 KB
/
DEVS.py
File metadata and controls
92 lines (79 loc) · 2.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
from devs.tester import Tester
from devs.shower import Shower
from devs.arcanum import Arcanum
from devs.logos import Logos
from devs.nebula import Nebula
from devs.aleph import Aleph
from devs.via import Via
from devs.veritas import Veritas
from devs.vita import Vita
from vniversvs.vniversvs import VNIVERSVS
class DEVS(dict):
"""
DEVS is the "absoulute" class that creates
and handles everything in the project
"""
def __init__( self, **kwargs ):
for key in kwargs.keys():
self[key] = kwargs[key]
if 'initialization_data' in kwargs.keys():
for key in kwargs['initialization_data'].keys():
self[key] = kwargs['initialization_data'][key]
self.pop("initialization_data", None)
self.aleph = Aleph()
__getattr__ = dict.__getitem__
__setattr__ = dict.__setitem__
__delattr__ = dict.__delitem__
def make_object_metadata( self, object ):
object.vniversvs = self.vniversvs
object.devs = self
object.via = Via()
object.veritas = Veritas()
object.vita = Vita()
def fiat( self ):
self.fiat_vniversvs()
self.fiat_tester()
self.fiat_logos()
def fiat_vniversvs( self ):
self.vniversvs = VNIVERSVS(
initialization_data = self.aleph.vniversvs
)
self.vniversvs.devs = self
print('vniversvs created')
return self.vniversvs
def fiat_tester( self ):
self.tester = Tester()
self.make_object_metadata( self.tester )
print('tester created')
return self.tester
def fiat_logos( self ):
self.logos = Logos()
self.make_object_metadata( self.logos )
print('logos created')
self.fiat_commands()
print('commands created')
return self.logos
def fiat_nebula( self ):
self.nebula = Nebula()
self.make_object_metadata( self.nebula )
print('nebula created')
return self.nebula
def run_logos( self ):
self.logos.next_command = ''
while self.logos.next_command != 'q':
self.logos.next_command = input("type a command: ")
self.logos.parsed_command = self.logos.parse_commands( self.logos.next_command )
self.logos.execute_command( self.logos.current_command )
self.vniversvs.update()
print('bye bye')
def fiat_commands( self ):
with open('devs/logos.py') as tmp:
tmp = tmp.read().split('\n')
for line in tmp:
if 'def command_' in line and '#' not in line:
command_name = line[8:]
command_name = command_name.split('(')[0]
command_key = command_name[8:]
# print('command_name', command_name)
self.logos.commands[command_key] = getattr(self.logos, command_name)
#