def get_js_library(self, pinyin): for extension in EXTENSION_MANAGER.get_all_extensions(): library = extension.get_js_library(pinyin) if library is not None: return library return None
def chinese_to_pinyin(self, chinese): for extension in EXTENSION_MANAGER.get_all_extensions(): __pinyin__ = extension.chinese_to_pinyin(chinese) if __pinyin__: return __pinyin__ else: # no match found, i.e. 'world' return chinese
def generate_js_link(self, js_names): links = [] for name in js_names: for extension in EXTENSION_MANAGER.get_all_extensions(): js_link = extension.get_js_link(name, jshost=self.jshost) if js_link: links.append(js_link) break return links
def read_file_contents_from_local(js_names): contents = [] for name in js_names: for extension in EXTENSION_MANAGER.get_all_extensions(): filecontent = extension.read_js_library(name) if filecontent: contents.append(filecontent) break return contents
def produce_require_configuration(self, dependencies): __dependencies__ = _ensure_echarts_is_in_the_front(dependencies) # if no nick name register, we treat the location as location.js require_conf_items = [] for name in __dependencies__: for extension in EXTENSION_MANAGER.get_all_extensions(): config_item = extension.produce_require_config_syntax( name, jshost=self.jshost, use_github=self.hosted_on_github) if config_item: require_conf_items.append(config_item) require_libraries = ["'%s'" % key for key in __dependencies__] return dict(config_items=require_conf_items, libraries=require_libraries)
def generate_js_link(self, js_names): # self.jshost 为 None 时应该使用远程 js # "https://pyecharts.github.io/assets/js" if not self.jshost: self.jshost = ONLINE_ASSETS_JS links = [] for name in js_names: for extension in EXTENSION_MANAGER.get_all_extensions(): js_link = extension.get_js_link(name, jshost=self.jshost) if js_link: links.append(js_link) break return links