Пример #1
0
 def collection_lines_as_indent(self,
                                lines: List[str],
                                topic: TopicElement,
                                indent=''):
     lines.append(indent + topic.getTitle())
     indent += ' ' * 4
     for i in topic.getSubTopics():
         self.collection_lines_as_indent(lines, i, indent)
Пример #2
0
 def collect_topic_to_dirs(self, topic: TopicElement,
                           parent_dir) -> List[TopicDir]:
     """将主题收集为目录名"""
     current_dir = os.path.join(parent_dir, topic.getTitle())
     dirs = [TopicDir(topic, current_dir)]
     for topic in topic.getSubTopics():
         dirs.extend(self.collect_topic_to_dirs(topic, current_dir))
     return dirs
 def get_response_container(
         self, topic_element: TopicElement) -> ResponseContainer:
     _topic_elements = topic_element.getSubTopics()
     if _topic_elements:
         _topics = [topic.getTitle() for topic in _topic_elements]
     else:
         _topics = []
     _response_container = ResponseContainer(_topics)
     return _response_container