def scan_for_files(self): """ Scan for files """ files = [o for o in os.listdir( self.sys_path) if ( os.path.isfile(self.sys_path + '/' + o) and not os.path.islink(self.sys_path + '/' + o) ) ] for line in files: path = u'{folder}/{file}'.format(folder=self.path, file=line) node = Node.get_instance(path) self.__files.append(node)
def scan_for_folders(self): """ Scan for folders """ sub_folders = [o for o in os.listdir( self.sys_path) if ( os.path.isdir(self.sys_path + '/' + o) and not os.path.islink(self.sys_path + '/' + o) ) ] for line in sub_folders: path = u'{folder}/{node}'.format(folder=self.path, node=line) node = Node.get_instance(path) self.__folders.append(node)
def __placeExtraNodesForASensor(self, crtX, crtY): for _ in range(Constants.ENERGY_LEVELS + 1): # the energy levels + the exit node self.__nodeList.append(Node(crtX, crtY))
def size(self, value): """ Set size """ if isinstance(value,int) or isinstance(value,long): self.__size = Node.sizeof_fmt(value) else: self.__size = value
def __init__(self, values): """ Constructor """ Node.__init__(self, values) self.__parent = Node.get_instance(self.get_parent()) self.__size = values['size']
def __init__(self, values): """ Constructor """ Node.__init__(self, values) self.__parent = Node.get_instance(self.get_parent()) self.__files = [] self.__folders = []