-
Notifications
You must be signed in to change notification settings - Fork 0
/
classes.py
36 lines (29 loc) · 1020 Bytes
/
classes.py
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
import copy
class Dir:
def __init__(self, name="", children=None, identifier=-1, opened=False):
self.children = []
self.children = children
self.name = name
self.identifier = identifier
self.opened = opened
def __str__(self):
return str(self.__dict__)
def __repr__(self):
return str(self.__dict__)
class SmallDir:
def __init__(self, name="", children=None, identifier=-1):
if children is None:
children = []
self.children = children
self.name = name
self.identifier = identifier
def from_dir(self, directory):
# function to import data from a Dir object
self.name = directory.name
self.identifier = directory.identifier
if directory.children is not None:
for child in directory.children:
self.children.append(copy.deepcopy(SmallDir().from_dir(child)))
else:
self.children = directory.children
return self