• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python sublime.cache_path函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中sublime.cache_path函数的典型用法代码示例。如果您正苦于以下问题:Python cache_path函数的具体用法?Python cache_path怎么用?Python cache_path使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了cache_path函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: clean_cache

def clean_cache():
    """Delete cache"""
    for fl in os.listdir(sublime.cache_path() + os.path.sep + 'Xkcd'):
        try:
            os.remove(sublime.cache_path() + os.path.sep + 'Xkcd' + os.path.sep + fl)
        except OSError as e:
            raise IOError('Could not remove previous files.')
开发者ID:davidyen1124,项目名称:xkcd,代码行数:7,代码来源:xkcd.py


示例2: run

 def run(self, edit):
     decoder = json.JSONDecoder()
     platform = sublime.platform()
     if platform == 'linux' or platform == 'osx':
         path = sublime.cache_path() + '/CodeIniter/config.json'
     else:
         path = sublime.cache_path() + '\CodeIniter\config.json'
     fobj = open(path, 'r')
     s = fobj.read()
     db = decoder.decode(s)
     file_name = self.view.file_name()
     index = int(file_name.rfind('.')) + 1
     file_type = file_name[index:]
     fobj.close()
     self.view.insert(edit, 0, db[file_type])
开发者ID:arpitgogia,项目名称:ST-Code-Initer,代码行数:15,代码来源:CodeIniter.py


示例3: on_load_async

 def on_load_async(self, view):
     platform = sublime.platform()
     path = sublime.cache_path()
     if platform == 'linux' or platform == 'osx':
         path = path + '/CodeIniter'
     else:
         path = path + '\CodeIniter'
     if os.path.exists(path):
         print()
     else:
         os.makedirs(path)
     if platform == 'linux' or platform == 'osx':
         path = path + '/config.json'
     else:
         path = path + '\config.json'
     if os.path.isfile(path):
         print()
     else:
         fobj = open(path, 'w')
         data = {}
         data['cpp'] = '#include <iostream>\nusing namespace std\nint main() {\n}'
         data['java'] = 'import java.util.*;\nimport java.io.*;\nclass {\npublic static void main(String[] args) {\n}'
         data['py'] = 'import os'
         fobj.write(json.dumps(data))
         fobj.close()
开发者ID:arpitgogia,项目名称:ST-Code-Initer,代码行数:25,代码来源:CodeIniter.py


示例4: cache_bibsonomy

def cache_bibsonomy():
    settings = tools.load_settings("LaTeXing", cache={"bibsonomy": 24}, bibsonomy=False)

    if not settings["bibsonomy"] or not "bibsonomy" in settings["cache"] or not settings["cache"]["bibsonomy"]:
        if os.path.exists(os.path.join(sublime.cache_path(), "LaTeXing", "bibsonomy.cache")):
            CACHE.clear_cache("bibsonomy.cache", False)
        return

    # Get BibsonomyFile
    f = BibsonomyFile()

    bibsonomy_data = CACHE.get_cache_data("bibsonomy.cache")
    if CACHE.is_cache_outdated("bibsonomy.cache", settings["cache"]["bibsonomy"]):
        f.run(cache=False, save=True)
        if f.status == "Error":
            log.error("error while caching")
            # CACHE.clear_cache("bibsonomy.cache", True)
        elif f.status == "Ok":
            bibsonomy_data = f.data
            CACHE.set_cache_data("bibsonomy.cache", bibsonomy_data, True)
    else:
        log.debug("up to date")

        # Rebuild Keys
        for item in bibsonomy_data["cites"]:
            item["cite_key"] = f.build_cite_key(item)

        # Set the new cache
        CACHE.set_cache_data("bibsonomy.cache", bibsonomy_data, True)
开发者ID:LaTeXing,项目名称:LaTeXing,代码行数:29,代码来源:cache.py


示例5: _get_cache

def _get_cache():
    if _ST3:
        cache_path = os.path.normpath(
            os.path.join(sublime.cache_path(), "LaTeXTools"))
    else:
        cache_path = os.path.normpath(
            os.path.join(sublime.packages_path(), "User"))

    pkg_cache_file = os.path.normpath(
        os.path.join(cache_path, 'pkg_cache.cache'
                     if _ST3 else 'latextools_pkg_cache.cache'))

    cache = None
    if not os.path.exists(pkg_cache_file):
        gen_cache = sublime.ok_cancel_dialog(
            "Cache files for installed packages, "
            "classes and bibliographystyles do not exists, "
            "would you like to generate it? After generating complete, "
            "please re-run this completion action!"
        )

        if gen_cache:
            sublime.active_window().run_command("latex_gen_pkg_cache")
    else:
        with open(pkg_cache_file) as f:
            cache = json.load(f)
    return cache
开发者ID:pantheras,项目名称:LaTeXTools,代码行数:27,代码来源:latex_input_completions.py


示例6: cache_zotero

def cache_zotero():
    settings = tools.load_settings("LaTeXing", cache={"zotero": 24}, zotero=False)

    if not settings["zotero"] or not "zotero" in settings["cache"] or not settings["cache"]["zotero"]:
        if os.path.exists(os.path.join(sublime.cache_path(), "LaTeXing", "zotero.cache")):
            CACHE.clear_cache("zotero.cache", False)
        return

    # Get ZoteroFile
    f = ZoteroFile()

    zotero_data = CACHE.get_cache_data("zotero.cache")
    if CACHE.is_cache_outdated("zotero.cache", settings["cache"]["zotero"]):
        f.run(cache=False, save=True)
        if f.status == "Error":
            log.error("error while caching")
            # CACHE.clear_cache("zotero.cache", True)
        elif f.status == "Ok":
            zotero_data = f.data
            CACHE.set_cache_data("zotero.cache", zotero_data, True)
    else:
        log.debug("rebuild cite_key")
        # Rebuild Keys
        for item in zotero_data["cites"]:
            item["cite_key"] = f.build_cite_key(item)

        # Set the new cache
        CACHE.set_cache_data("zotero.cache", zotero_data, True)
开发者ID:LaTeXing,项目名称:LaTeXing,代码行数:28,代码来源:cache.py


示例7: plugin_loaded

def plugin_loaded():
    """Called directly from sublime on plugin load."""
    try:
        os.makedirs(sublime.cache_path() + os.path.sep + 'Xkcd')
    except OSError as e:
        if e.errno != errno.EEXIST:
            raise IOError('Error encountered during file creation.')
开发者ID:davidyen1124,项目名称:xkcd,代码行数:7,代码来源:xkcd.py


示例8: cache_mendeley

def cache_mendeley():
    settings = tools.load_settings("LaTeXing", cache={"mendeley": 24}, mendeley=False)

    if not settings["mendeley"] or not "mendeley" in settings["cache"] or not settings["cache"]["mendeley"]:
        if os.path.exists(os.path.join(sublime.cache_path(), "LaTeXing", "mendeley.cache")):
            CACHE.clear_cache("mendeley.cache", False)
        return

    # Get MendeleyFile
    f = MendeleyFile()

    # Get Cache data an rebuild cahce if necessary
    mendeley_data = CACHE.get_cache_data("mendeley.cache")
    if CACHE.is_cache_outdated("mendeley.cache", settings["cache"]["mendeley"]):
        f = MendeleyFile()
        f.run(cache=False, save=True)
        if f.status == "Error":
            log.error("error while caching")
            # CACHE.clear_cache("mendeley.cache", True)
        elif f.status == "Ok":
            mendeley_data = f.data
            CACHE.set_cache_data("mendeley.cache", mendeley_data, True)
    else:
        log.debug("up to date")

        # Rebuild Keys
        for item in mendeley_data["cites"]:
            item["cite_key"] = f.build_cite_key(item)

        # Set the new cache
        CACHE.set_cache_data("mendeley.cache", mendeley_data, True)
开发者ID:LaTeXing,项目名称:LaTeXing,代码行数:31,代码来源:cache.py


示例9: clean

def clean():
    dir_path = os.path.join(sublime.packages_path(), "LaTeXing3")
    if os.path.isdir(dir_path):
        sublime.message_dialog("Please remove your old LaTeXing installation. Close Sublime Text and delete the following directory: %s!" % dir_path)

    file_path = os.path.join(sublime.installed_packages_path(), "LaTeXing3.sublime-package")
    if os.path.isfile(file_path):
        sublime.message_dialog("Please remove your old LaTeXing installation. Close Sublime Text and delete the following file: %s!" % file_path)

    dir_path = os.path.join(sublime.cache_path(), "LaTeXing3")
    if os.path.isdir(dir_path):
        shutil.rmtree(dir_path)

    dir_path = os.path.join(sublime.cache_path(), "LaTeXing ST3")
    if os.path.isdir(dir_path):
        shutil.rmtree(dir_path)
开发者ID:LaTeXing,项目名称:LaTeXing,代码行数:16,代码来源:startup.py


示例10: install_languages_async

def install_languages_async():
    plugin_dir = os.path.dirname(os.path.dirname(__file__))

    for language in ['HTML']:
        # See if our version of the language already exists in Packages
        src_dir = os.path.join(plugin_dir, language)
        version_file = os.path.join(src_dir, 'sublimelinter.version')

        if os.path.isdir(src_dir) and os.path.isfile(version_file):
            with open(version_file, encoding='utf8') as f:
                my_version = int(f.read().strip())

            dest_dir = os.path.join(sublime.packages_path(), language)
            version_file = os.path.join(dest_dir, 'sublimelinter.version')

            if os.path.isdir(dest_dir):
                if os.path.isfile(version_file):
                    with open(version_file, encoding='utf8') as f:
                        try:
                            other_version = int(f.read().strip())
                        except ValueError:
                            other_version = 0

                    copy = my_version > other_version
                else:
                    copy = sublime.ok_cancel_dialog(
                        'An existing {} language package exists, '.format(language) +
                        'and SublimeLinter wants to overwrite it with its version. ' +
                        'Is that okay?')

                if copy:
                    try:
                        shutil.rmtree(dest_dir)
                    except OSError as ex:
                        from . import persist
                        persist.printf(
                            'could not remove existing {} language package: {}'
                            .format(language, str(ex))
                        )
                        copy = False
            else:
                copy = True

            if copy:
                from . import persist

                try:
                    cached = os.path.join(sublime.cache_path(), language)

                    if os.path.isdir(cached):
                        shutil.rmtree(cached)

                    shutil.copytree(src_dir, dest_dir)
                    persist.printf('copied {} language package'.format(language))
                except OSError as ex:
                    persist.printf(
                        'could not copy {} language package: {}'
                        .format(language, str(ex))
                    )
开发者ID:davgit,项目名称:SublimeLinter3,代码行数:59,代码来源:util.py


示例11: save

 def save():
     for file_name in mode if mode else CACHE_NAMES:
         if file_name in self.cache_data:
             str_json = sublime.encode_value(self.cache_data[file_name])
             with open(os.path.join(sublime.cache_path(), "LaTeXing", file_name), 'w', encoding="utf-8") as f:
                 log.trace("%s", f)
                 f.write(str_json)
             log.info("%s (%s)" % (file_name, tools.size_of_string(str_json)))
开发者ID:LaTeXing,项目名称:LaTeXing,代码行数:8,代码来源:cache.py


示例12: run

   def run(self):
      plugin_helpers.DebugLogMessage("--> " + __name__ + ": " + type(self).__name__ + "." + sys._getframe().f_code.co_name)

      # sublime.active_window().run_command("new_window")
      # sublime.active_window().run_command("wam_project_init")

      print(sublime.cache_path())

      plugin_helpers.DebugLogMessage("<-- " + __name__ + ": " + type(self).__name__ + "." + sys._getframe().f_code.co_name)
开发者ID:MphasisWyde,项目名称:eWamSublimeAdaptor,代码行数:9,代码来源:wam_new_env.py


示例13: plugin_loaded

def plugin_loaded():
    try:
        cache_dir = os.path.join(sublime.cache_path(), 'Zip Browser')
    except:
        cache_dir = os.path.join(sublime.packages_path(), '..', 'Cache', 'Zip Browser')

    if os.path.exists(cache_dir):
        shutil.rmtree(cache_dir)

    cleanup_temp_dir()
开发者ID:psistorma,项目名称:PrivateSublimeSettings,代码行数:10,代码来源:Zip+Browser.py


示例14: get_cache_dir

def get_cache_dir(*name):
	try:
		p = os.path.join(sublime.cache_path(), PLUGIN_NAME, *name)
	except:
		p = os.path.normpath(os.path.join(sublime.packages_path(), '..', PLUGIN_NAME, *name))

	if not os.path.exists(p):
		os.makedirs(p)

	return p
开发者ID:randy3k,项目名称:SublimePluginUnitTestHarness,代码行数:10,代码来源:test_main.py


示例15: _global_cache_path

def _global_cache_path():
    # For ST3, put the cache files in cache dir
    # and for ST2, put it in the user packages dir
    if _ST3:
        cache_path = os.path.join(sublime.cache_path(), "LaTeXTools")
    else:
        cache_path = os.path.join(sublime.packages_path(),
                                  "User",
                                  ST2_GLOBAL_CACHE_FOLDER)
    return os.path.normpath(cache_path)
开发者ID:aleth,项目名称:LaTeXTools,代码行数:10,代码来源:cache.py


示例16: plugin_loaded

 def plugin_loaded(self):
     print("Plugin loaded!")
     self.settings = sublime.load_settings("ccomplete")
     cachepath = sublime.cache_path() + "/ccomplete_cache"
     if not os.path.exists(cachepath):
         os.mkdir(cachepath)
     self.cc = CComplete(self.settings.get('cache', 500), cachepath)
     self.currentfile = None
     self.ready = False
     self.extensions = self.settings.get("extensions", ["c", "cpp", "cxx", "h", "hpp", "hxx"])
     self.load_matching = self.settings.get("load_matching", True)
     self.init = True
开发者ID:roycyt,项目名称:CComplete,代码行数:12,代码来源:ccomplete_plugin.py


示例17: clear_cache

 def clear_cache(self, file_name, soft):
     if soft and file_name in self.cache_data:
         file_json = self.get_cache(file_name)
         file_json["rtime"] = "01.01.2000T00:00:00"
         self.set_cache(file_name, file_json)
     else:
         file_path = os.path.join(sublime.cache_path(), "LaTeXing", file_name)
         if os.path.isfile(file_path):
             os.remove(file_path)
         if file_name in self.cache_data:
             self.cache_data.pop(file_name)
     log.info("%s (%s)" % (file_name, "soft" if soft else "hard"))
开发者ID:LaTeXing,项目名称:LaTeXing,代码行数:12,代码来源:cache.py


示例18: init_settings

def init_settings():
	global encoding_cache, TMP_DIR, CACHE_ROOT
	if ST3:
		CACHE_ROOT = os.path.join(sublime.cache_path(), 'ConvertToUTF8')
	else:
		CACHE_ROOT = os.path.join(sublime.packages_path(), 'User')
	TMP_DIR = os.path.join(CACHE_ROOT, 'c2u_tmp')
	if not os.path.exists(TMP_DIR):
		os.makedirs(TMP_DIR)
	encoding_cache = EncodingCache()
	get_settings()
	sublime.load_settings('ConvertToUTF8.sublime-settings').add_on_change('get_settings', get_settings)
开发者ID:seanliang,项目名称:ConvertToUTF8,代码行数:12,代码来源:ConvertToUTF8.py


示例19: get_cache_bin

 def get_cache_bin(self, bin):
     """
     Returns a cache bin. If the bin doesn't exist, it is created.
     """
     cache_bin_name = hashlib.sha224(bin.encode("utf-8")).hexdigest()
     sublime_cache_path = sublime.cache_path()
     cache_bin = sublime_cache_path + "/" + "sublime-drush" + "/" + cache_bin_name
     if os.path.isdir(cache_bin) is False:
         print("Bin not found. Created new cache bin: %s" % cache_bin)
         os.makedirs(cache_bin)
     else:
         print('Returning cache bin for "%s"' % bin)
     return cache_bin
开发者ID:kostajh,项目名称:subDrush,代码行数:13,代码来源:drush.py


示例20: _generate_package_cache

def _generate_package_cache():
    installed_tex_items = _get_files_matching_extensions(
        _get_tex_searchpath('tex'),
        ['sty', 'cls']
    )

    installed_bst = _get_files_matching_extensions(
        _get_tex_searchpath('bst'),
        ['bst']
    )

    # create the cache object
    pkg_cache = {
        'pkg': installed_tex_items['sty'],
        'bst': installed_bst['bst'],
        'cls': installed_tex_items['cls']
    }

    # For ST3, put the cache files in cache dir
    # and for ST2, put it in the user packages dir
    # and change the name
    if _ST3:
        cache_path = os.path.normpath(
            os.path.join(
                sublime.cache_path(),
                "LaTeXTools"
            ))
    else:
        cache_path = os.path.normpath(
            os.path.join(
                sublime.packages_path(),
                "User"
            ))

    if not os.path.exists(cache_path):
        os.makedirs(cache_path)

    pkg_cache_file = os.path.normpath(
        os.path.join(cache_path, 'pkg_cache.cache' if _ST3 else 'latextools_pkg_cache.cache'))

    with open(pkg_cache_file, 'w+') as f:
        json.dump(pkg_cache, f)

    sublime.set_timeout(
        partial(
            sublime.status_message,
            'Finished generating LaTeX package cache'
        ),
        0
    )
开发者ID:SublimeText,项目名称:LaTeXTools,代码行数:50,代码来源:latex_installed_packages.py



注:本文中的sublime.cache_path函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python sublime.decode_value函数代码示例发布时间:2022-05-27
下一篇:
Python sublime.arch函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap