python类cache_path()的实例源码

gutter_color.py 文件源码 项目:sublime-text-3-packages 作者: nickjj 项目源码 文件源码 阅读 34 收藏 0 点赞 0 评论 0
def clear_cache(force = False):
  """
  If the folder exists, and has more than 5MB of icons in the cache, delete
  it to clear all the icons then recreate it.
  """
  from os.path import getsize, join, isfile, exists
  from os import makedirs, listdir
  from sublime import cache_path
  from shutil import rmtree

  # The icon cache path
  icon_path = join(cache_path(), "GutterColor")

  # The maximum amount of space to take up
  limit = 5242880 # 5 MB

  if exists(icon_path):
    size = sum(getsize(join(icon_path, f)) for f in listdir(icon_path) if isfile(join(icon_path, f)))
    if force or (size > limit): rmtree(icon_path)

  if not exists(icon_path): makedirs(icon_path)
line.py 文件源码 项目:sublime-text-3-packages 作者: nickjj 项目源码 文件源码 阅读 34 收藏 0 点赞 0 评论 0
def icon_path(self):
    """Returns the absolute path to the icons"""
    return join(cache_path(), 'GutterColor', '%s.png' % self.color())
SwiftKitten.py 文件源码 项目:SwiftKitten 作者: johncsnyder 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def _get_cache_path(cls):
        """
        """
        return os.path.join(sublime.cache_path(), "SwiftKitten")
SwiftKitten.py 文件源码 项目:SwiftKitten 作者: johncsnyder 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def _save_framework_cache(cls):
        """
        """
        cache_path = cls._get_cache_path()

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

        framework_cache_path = os.path.join(cache_path, "frameworks.cache")

        with open(framework_cache_path, "wb") as f:
            pickle.dump(cls.framework_cache, f)
docphp.py 文件源码 项目:docphp 作者: garveen 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def getDocphpPath():
    return sublime.cache_path() + '/' + package_name + '/'
utils.py 文件源码 项目:SublimeGotoUsage 作者: syko 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def get_cache_dir():
    path = os.path.join(sublime.cache_path(), 'GotoUsage')
    if not os.path.exists(path):
        os.mkdir(path)
    return path
pytest_exec.py 文件源码 项目:PyTest 作者: kaste 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def get_report_file():
    path = os.path.join(sublime.cache_path(), 'PyTest')
    if not os.path.isdir(path):
        os.makedirs(path)
    return os.path.join(path, 'last-run.xml')
favorites.py 文件源码 项目:sublime-favorites 作者: oleg-shilo 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def panel_file():

    plugin_dir = ''

    if hasattr(sublime, 'cache_path'):
        plugin_dir = sublime.cache_path()
    else:
        plugin_dir = 'cache'
        plugin_dir = os.path.join(os.getcwd(), plugin_dir)

    data_dir = path.join(plugin_dir, panel_name)
    if not path.exists(data_dir):
        os.makedirs(data_dir)
    return path.join(data_dir, panel_name)
# -----------------
RemoteCpp.py 文件源码 项目:RemoteCpp 作者: ruibm 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def plugin_dir():
  return os.path.join(sublime.cache_path(), 'RemoteCpp')


问题


面经


文章

微信
公众号

扫码关注公众号