Python matplotlib.cbook._lock_path() Examples

The following are 10 code examples of matplotlib.cbook._lock_path(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module matplotlib.cbook , or try the search function .
Example #1
Source File: font_manager.py    From Mastering-Elasticsearch-7.0 with MIT License 5 votes vote down vote up
def _rebuild():
    global fontManager
    fontManager = FontManager()
    with cbook._lock_path(_fmcache):
        json_dump(fontManager, _fmcache)
    _log.info("generated new fontManager") 
Example #2
Source File: texmanager.py    From Mastering-Elasticsearch-7.0 with MIT License 5 votes vote down vote up
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 
Example #3
Source File: font_manager.py    From GraphicDesignPatternByPython with MIT License 5 votes vote down vote up
def _rebuild():
        global fontManager

        fontManager = FontManager()

        if _fmcache:
            with cbook._lock_path(_fmcache):
                json_dump(fontManager, _fmcache)
        _log.debug("generated new fontManager") 
Example #4
Source File: texmanager.py    From GraphicDesignPatternByPython with MIT License 5 votes vote down vote up
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 
Example #5
Source File: font_manager.py    From python3_ios with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def _rebuild():
        global fontManager

        fontManager = FontManager()

        if _fmcache:
            with cbook._lock_path(_fmcache):
                json_dump(fontManager, _fmcache)
        _log.debug("generated new fontManager") 
Example #6
Source File: texmanager.py    From python3_ios with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
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 
Example #7
Source File: font_manager.py    From coffeegrindsize with MIT License 5 votes vote down vote up
def _rebuild():
        global fontManager

        fontManager = FontManager()

        if _fmcache:
            with cbook._lock_path(_fmcache):
                json_dump(fontManager, _fmcache)
        _log.debug("generated new fontManager") 
Example #8
Source File: texmanager.py    From coffeegrindsize with MIT License 5 votes vote down vote up
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 
Example #9
Source File: font_manager.py    From CogAlg with MIT License 5 votes vote down vote up
def _rebuild():
    global fontManager
    fontManager = FontManager()
    with cbook._lock_path(_fmcache):
        json_dump(fontManager, _fmcache)
    _log.info("generated new fontManager") 
Example #10
Source File: texmanager.py    From CogAlg with MIT License 5 votes vote down vote up
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