MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / open_file

Method open_file

tools/python-3.11.9-amd64/Lib/urllib/request.py:1998–2005  ·  view source on GitHub ↗

Use local file or FTP depending on form of URL.

(self, url)

Source from the content-addressed store, hash-verified

1996 return self._open_generic_http(self._https_connection, url, data)
1997
1998 def open_file(self, url):
1999 """Use local file or FTP depending on form of URL."""
2000 if not isinstance(url, str):
2001 raise URLError('file error: proxy support for file protocol currently not implemented')
2002 if url[:2] == '//' and url[2:3] != '/' and url[2:12].lower() != 'localhost/':
2003 raise ValueError("file:// scheme is supported only on localhost")
2004 else:
2005 return self.open_local_file(url)
2006
2007 def open_local_file(self, url):
2008 """Use local file."""

Callers

nothing calls this directly

Calls 3

open_local_fileMethod · 0.95
URLErrorClass · 0.90
lowerMethod · 0.45

Tested by

no test coverage detected