MCPcopy Index your code
hub / github.com/python/cpython / revert

Method revert

Lib/http/cookiejar.py:1805–1829  ·  view source on GitHub ↗

Clear all cookies and reload cookies from a saved file. Raises LoadError (or OSError) if reversion is not successful; the object's state will not be altered if this happens.

(self, filename=None,
               ignore_discard=False, ignore_expires=False)

Source from the content-addressed store, hash-verified

1803 self._really_load(f, filename, ignore_discard, ignore_expires)
1804
1805 def revert(self, filename=None,
1806 ignore_discard=False, ignore_expires=False):
1807 """Clear all cookies and reload cookies from a saved file.
1808
1809 Raises LoadError (or OSError) if reversion is not successful; the
1810 object's state will not be altered if this happens.
1811
1812 """
1813 if filename is None:
1814 if self.filename is not None: filename = self.filename
1815 else: raise ValueError(MISSING_FILENAME_TEXT)
1816
1817 self._cookies_lock.acquire()
1818 try:
1819
1820 old_state = copy.deepcopy(self._cookies)
1821 self._cookies = {}
1822 try:
1823 self.load(filename, ignore_discard, ignore_expires)
1824 except OSError:
1825 self._cookies = old_state
1826 raise
1827
1828 finally:
1829 self._cookies_lock.release()
1830
1831
1832def lwp_cookie_str(cookie):

Callers 1

test_missing_valueMethod · 0.80

Calls 3

loadMethod · 0.95
acquireMethod · 0.45
releaseMethod · 0.45

Tested by 1

test_missing_valueMethod · 0.64