MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / _open_file_or_url

Function _open_file_or_url

lib/matplotlib/__init__.py:864–878  ·  view source on GitHub ↗
(fname)

Source from the content-addressed store, hash-verified

862
863@contextlib.contextmanager
864def _open_file_or_url(fname):
865 if (isinstance(fname, str)
866 and fname.startswith(('http://', 'https://', 'ftp://', 'file:'))):
867 import urllib.request
868 ssl_ctx = _get_ssl_context()
869 if ssl_ctx is None:
870 _log.debug(
871 "Could not get certifi ssl context, https may not work."
872 )
873 with urllib.request.urlopen(fname, context=ssl_ctx) as f:
874 yield (line.decode('utf-8') for line in f)
875 else:
876 fname = os.path.expanduser(fname)
877 with open(fname, encoding='utf-8') as f:
878 yield f
879
880
881def _rc_params_in_file(fname, transform=lambda x: x, fail_on_error=False):

Callers 1

_rc_params_in_fileFunction · 0.85

Calls 1

_get_ssl_contextFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…