Skip to content

Commit bb9cace

Browse files
committed
Changed filesystem project structure to reflect more common approach
1 parent b0be867 commit bb9cace

33 files changed

+72
-59
lines changed

ActionNode.py renamed to contextshell/ActionNode.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
from Node import Node
2-
from NodePath import NodePath
1+
from contextshell.NodePath import NodePath
2+
from contextshell.Node import Node
33

44

55
class ActionNode(Node):
File renamed without changes.

CommandInterpreter.py renamed to contextshell/CommandInterpreter.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
from Command import Command
2-
from NodePath import NodePath
3-
from Session import Session
1+
from contextshell.Command import Command
2+
from contextshell.Session import Session
3+
4+
from contextshell.NodePath import NodePath
45

56

67
class CommandInterpreter:

CommandParser.py renamed to contextshell/CommandParser.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from Command import Command
1+
from contextshell.Command import Command
22

33

44
def tokenize(text: str) -> [str]:
File renamed without changes.

NodePath.py renamed to contextshell/NodePath.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def create_path(root, path):
3232
return root
3333
node = root.get_node(name=path[0])
3434
if node is None:
35-
from Node import Node # TODO: move to the header when Node2 replaces Node
35+
from contextshell.Node import Node # TODO: move to the header when Node2 replaces Node
3636
node = Node()
3737
root.append(node, path[0])
3838
return NodePath.create_path(node, path[1:])

Session.py renamed to contextshell/Session.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from NodePath import NodePath
1+
from contextshell.NodePath import NodePath
22

33

44
class Session:

Shell.py renamed to contextshell/Shell.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
from Session import *
2-
from NodePath import *
3-
from CommandParser import CommandParser
4-
from CommandInterpreter import CommandInterpreter
1+
from contextshell.CommandInterpreter import CommandInterpreter
2+
from contextshell.CommandParser import CommandParser
3+
from contextshell.Session import *
4+
5+
from contextshell.NodePath import *
56

67

78
class Shell:

TreeRoot.py renamed to contextshell/TreeRoot.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
from Session import Session
2-
from actions.BasicActions import *
1+
from contextshell.Session import Session
2+
3+
from contextshell.actions.BasicActions import *
34

45

56
class TreeRoot(Session):
File renamed without changes.

actions/BasicActions.py renamed to contextshell/actions/BasicActions.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from ActionNode import *
1+
from contextshell.ActionNode import *
22

33

44
class GetAction(ActionNode):
File renamed without changes.

repl.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
#!/usr/bin/python3
2-
from TreeRoot import *
3-
from Shell import *
42
import readline
53

4+
from TreeRoot import *
5+
6+
from contextshell.Shell import *
67

78
if __name__ == '__main__':
89
tree = TreeRoot()

script.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
#!/usr/bin/python3
2+
import sys
3+
24
from TreeRoot import *
3-
from Shell import *
45

5-
import sys
6+
from contextshell.Shell import *
67

78
if len(sys.argv) < 2:
89
raise ValueError('Script requires single argument')
File renamed without changes.
File renamed without changes.

tests/ActionNodeTests.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import unittest
2+
from contextshell.NodePath import NodePath
23

3-
from ActionNode import *
4-
from NodePath import NodePath
4+
from contextshell.ActionNode import *
55

66

77
def sum_function(target: Node, number: int):

tests/CommandInterpreterTests.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import unittest
2-
from CommandInterpreter import CommandInterpreter
3-
from Command import Command
4-
from TreeRoot import TreeRoot
2+
3+
from contextshell.Command import Command
4+
from contextshell.TreeRoot import TreeRoot
5+
from contextshell.CommandInterpreter import CommandInterpreter
56

67

78
class CommandInterpreterTests(unittest.TestCase):

tests/CommandParserTests.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import unittest
2-
from CommandParser import CommandParser
3-
from Command import Command
2+
3+
from contextshell.Command import Command
4+
from contextshell.CommandParser import CommandParser
45

56

67
class CommandTokenizerTests(unittest.TestCase):
78
def tok_test(self, text: str, expected_tokens: list):
8-
from CommandParser import tokenize
9+
from contextshell.CommandParser import tokenize
910
self.assertListEqual(expected_tokens, tokenize(text))
1011

1112
def test_empty(self):

tests/CommandTests.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import unittest
2-
from Command import Command
2+
3+
from contextshell.Command import Command
34

45

56
class CommandTests(unittest.TestCase):

tests/NodePathTests.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
from NodePath import *
2-
from Node import *
3-
41
import unittest
52

3+
from contextshell.NodePath import *
4+
from contextshell.Node import *
5+
66

77
class NodePathTests(unittest.TestCase):
88
def test_empty(self):

tests/NodeTests.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import unittest
2-
from Node import Node
2+
3+
from contextshell.Node import Node
34

45

56
class ValueTests(unittest.TestCase):

tests/ShellTests.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import unittest
2-
from Shell import *
3-
from TreeRoot import TreeRoot
2+
3+
from contextshell.TreeRoot import TreeRoot
4+
5+
from contextshell.Shell import *
46

57

68
class ShellTests(unittest.TestCase):

tests/TemporarySession.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
from Node import Node
2-
from Session import *
1+
from contextshell.Session import *
2+
from contextshell.Node import Node
33

44

55
class TemporarySession(Session):

tests/TemporarySessionTests.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import unittest
22

3-
from TreeRoot import TreeRoot
43
from TemporarySession import *
4+
from contextshell.TreeRoot import TreeRoot
55

66

77
class TemporarySessionTests(unittest.TestCase):

tests/TreeRootTests.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import unittest
22

3-
from TreeRoot import TreeRoot
4-
from NodePath import NodePath
3+
from contextshell.NodePath import NodePath
4+
from contextshell.TreeRoot import TreeRoot
55

66

77
class SessionTests(unittest.TestCase):
@@ -107,13 +107,13 @@ def test_install_action_none(self):
107107
self.tree.install_action(None)
108108

109109
def test_install_action(self):
110-
from ActionNode import ActionNode
110+
from contextshell.ActionNode import ActionNode
111111
action = ActionNode('act', lambda x: x)
112112
self.tree.install_action(action)
113113
self.assertIsNotNone(TreeRoot._find_action(self.tree.root, 'act'))
114114

115115
def test_install_action_nested(self):
116-
from ActionNode import ActionNode
116+
from contextshell.ActionNode import ActionNode
117117
action = ActionNode('foo.bar', lambda x: x)
118118
self.tree.install_action(action)
119119
self.assertIsNotNone(TreeRoot._find_action(self.tree.root, 'foo.bar'))

tests/action_tests/CreateActionTests.py renamed to tests/actions/CreateActionTests.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import unittest
22

3-
from Node import Node
4-
from NodePath import NodePath
5-
from actions.BasicActions import CreateAction
3+
from contextshell.NodePath import NodePath
4+
from contextshell.actions.BasicActions import CreateAction
5+
from contextshell.Node import Node
66

77

88
class CreateActionTests(unittest.TestCase):

tests/action_tests/ExistsActionTests.py renamed to tests/actions/ExistsActionTests.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import unittest
22

3-
from Node import Node
4-
from NodePath import NodePath
5-
from actions.BasicActions import ExistsAction
3+
from contextshell.NodePath import NodePath
4+
from contextshell.actions.BasicActions import ExistsAction
5+
from contextshell.Node import Node
66

77

88
class ExistsActionTests(unittest.TestCase):

tests/action_tests/GetActionTests.py renamed to tests/actions/GetActionTests.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import unittest
22

3-
from Node import Node
4-
from NodePath import NodePath
5-
from actions.BasicActions import GetAction
3+
from contextshell.NodePath import NodePath
4+
from contextshell.actions.BasicActions import GetAction
5+
from contextshell.Node import Node
66

77

88
class GetActionTests(unittest.TestCase):

tests/action_tests/ListActionTests.py renamed to tests/actions/ListActionTests.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import unittest
22

3-
from Node import Node
4-
from NodePath import NodePath
5-
from actions.BasicActions import ListAction
3+
from contextshell.NodePath import NodePath
4+
from contextshell.actions.BasicActions import ListAction
5+
from contextshell.Node import Node
66

77

88
class ListActionTests(unittest.TestCase):

tests/action_tests/RemoveActionTests.py renamed to tests/actions/RemoveActionTests.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import unittest
22

3-
from Node import Node
4-
from NodePath import NodePath
5-
from actions.BasicActions import RemoveAction
3+
from contextshell.NodePath import NodePath
4+
from contextshell.actions.BasicActions import RemoveAction
5+
6+
from contextshell.Node import Node
67

78

89
class RemoveActionTests(unittest.TestCase):

tests/action_tests/SetActionTests.py renamed to tests/actions/SetActionTests.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import unittest
22

3-
from Node import Node
4-
from NodePath import NodePath
5-
from actions.BasicActions import SetAction
3+
from contextshell.NodePath import NodePath
4+
from contextshell.actions.BasicActions import SetAction
5+
6+
from contextshell.Node import Node
67

78

89
class SetActionTests(unittest.TestCase):
File renamed without changes.

0 commit comments

Comments
 (0)