@@ -48,32 +48,36 @@ def __init__(self):
4848 self ._cached_topics_list = []
4949 self ._cached_topic_type = {}
5050
51- self .adapter_internal = adapter .internal .InternalPages (
52- get_topic_type = self .get_topic_type ,
53- get_topics_list = self .get_topics_list )
54- self .adapter_unknown = adapter .internal .UnknownPages (
55- get_topic_type = self .get_topic_type ,
56- get_topics_list = self .get_topics_list )
51+ self ._adapter = {
52+ "internal" : adapter .internal .InternalPages (
53+ get_topic_type = self .get_topic_type ,
54+ get_topics_list = self .get_topics_list ),
55+ "unknown" : adapter .internal .UnknownPages (
56+ get_topic_type = self .get_topic_type ,
57+ get_topics_list = self .get_topics_list ),
58+ "tldr" : adapter .cmd .Tldr (),
59+ "cheat" : adapter .cmd .Cheat (),
60+ "fosdem" : adapter .cmd .Fosdem (),
61+ "translation" : adapter .cmd .Translation (),
62+ }
5763
5864 self ._topic_list = {
5965 "late.nz" : adapter .latenz .get_list (),
60- "internal" : self .adapter_internal .get_list (),
61- "tldr" : adapter .cmd .get_tldr_list (),
62- "cheat" : adapter .cmd .get_cheat_list (),
6366 "cheat.sheets" : adapter .cheat_sheets .get_list (),
6467 "cheat.sheets dir" : adapter .cheat_sheets .get_dirs_list (),
6568 "learnxiny" : get_learnxiny_list (),
6669 }
70+ for key , obj in self ._adapter .items ():
71+ self ._topic_list [key ] = obj .get_list ()
6772
6873 self ._topic_found = {
6974 "late.nz" : adapter .latenz .is_found ,
70- "internal" : self .adapter_internal .is_found ,
71- "tldr" : adapter .cmd .tldr_is_found ,
72- "cheat" : adapter .cmd .cheat_is_found ,
7375 "cheat.sheets" : adapter .cheat_sheets .is_found ,
7476 "cheat.sheets dir" : adapter .cheat_sheets .is_dir_found ,
7577 "learnxiny" : is_valid_learnxy ,
7678 }
79+ for key , obj in self ._adapter .items ():
80+ self ._topic_found [key ] = obj .is_found
7781
7882# topic_type, function_getter
7983# should be replaced with a decorator
@@ -82,13 +86,14 @@ def __init__(self):
8286 ("late.nz" , adapter .latenz .get_answer ),
8387 ("cheat.sheets" , adapter .cheat_sheets .get_page ),
8488 ("cheat.sheets dir" , adapter .cheat_sheets .get_dir ),
85- ("tldr" , adapter .cmd .get_tldr ),
86- ("internal" , self .adapter_internal .get_page ),
87- ("cheat" , adapter .cmd .get_cheat ),
8889 ("learnxiny" , get_learnxiny ),
89- ("translation" , adapter .cmd .get_translation ),
9090 ("question" , adapter .question .get_page ),
91- ("unknown" , self .adapter_unknown .get_page ),
91+ ("fosdem" , self ._adapter ["fosdem" ].get_page ),
92+ ("tldr" , self ._adapter ["tldr" ].get_page ),
93+ ("internal" , self ._adapter ["internal" ].get_page ),
94+ ("cheat" , self ._adapter ["cheat" ].get_page ),
95+ ("translation" , self ._adapter ["translation" ].get_page ),
96+ ("unknown" , self ._adapter ["unknown" ].get_page ),
9297 )
9398# pylint: enable=bad-whitespace
9499
@@ -138,7 +143,7 @@ def __get_topic_type(topic):
138143 if self ._topic_found ['cheat.sheets dir' ](topic ):
139144 return "cheat.sheets dir"
140145
141- for source in ['cheat.sheets' , 'cheat' , 'tldr' , 'late.nz' ]:
146+ for source in ['cheat.sheets' , 'cheat' , 'tldr' , 'late.nz' , 'fosdem' ]:
142147 if self ._topic_found [source ](topic ):
143148 return source
144149
0 commit comments