本文整理汇总了Python中matplotlib.cbook._lock_path方法的典型用法代码示例。如果您正苦于以下问题:Python cbook._lock_path方法的具体用法?Python cbook._lock_path怎么用?Python cbook._lock_path使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类matplotlib.cbook
的用法示例。
在下文中一共展示了cbook._lock_path方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _rebuild
# 需要导入模块: from matplotlib import cbook [as 别名]
# 或者: from matplotlib.cbook import _lock_path [as 别名]
def _rebuild():
global fontManager
fontManager = FontManager()
with cbook._lock_path(_fmcache):
json_dump(fontManager, _fmcache)
_log.info("generated new fontManager")
示例2: make_dvi
# 需要导入模块: from matplotlib import cbook [as 别名]
# 或者: from matplotlib.cbook import _lock_path [as 别名]
def make_dvi(self, tex, fontsize):
"""
Generate a dvi file containing latex's layout of tex string.
Return the file name.
"""
if rcParams['text.latex.preview']:
return self.make_dvi_preview(tex, fontsize)
basefile = self.get_basefile(tex, fontsize)
dvifile = '%s.dvi' % basefile
if not os.path.exists(dvifile):
texfile = self.make_tex(tex, fontsize)
with cbook._lock_path(texfile):
self._run_checked_subprocess(
["latex", "-interaction=nonstopmode", "--halt-on-error",
texfile], tex)
for fname in glob.glob(basefile + '*'):
if not fname.endswith(('dvi', 'tex')):
try:
os.remove(fname)
except OSError:
pass
return dvifile
示例3: _rebuild
# 需要导入模块: from matplotlib import cbook [as 别名]
# 或者: from matplotlib.cbook import _lock_path [as 别名]
def _rebuild():
global fontManager
fontManager = FontManager()
if _fmcache:
with cbook._lock_path(_fmcache):
json_dump(fontManager, _fmcache)
_log.debug("generated new fontManager")