01-arcadia.patch 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. --- contrib/python/hypothesis/py2/hypothesis/internal/reflection.py (index)
  2. +++ contrib/python/hypothesis/py2/hypothesis/internal/reflection.py (working tree)
  3. @@ -389,7 +389,7 @@ def extract_lambda_source(f):
  4. source_bytes = source.encode(encoding)
  5. source_bytes = source_bytes[lambda_ast.col_offset :].strip()
  6. source = source_bytes.decode(encoding)
  7. - except (OSError, TypeError):
  8. + except (OSError, TypeError, IOError):
  9. source = source[lambda_ast.col_offset :].strip()
  10. # This ValueError can be thrown in Python 3 if:
  11. --- contrib/python/hypothesis/py2/hypothesis/provisional.py (index)
  12. +++ contrib/python/hypothesis/py2/hypothesis/provisional.py (working tree)
  13. @@ -30,6 +30,8 @@ from __future__ import absolute_import, division, print_function
  14. import os.path
  15. import string
  16. +import importlib_resources
  17. +
  18. import hypothesis.internal.conjecture.utils as cu
  19. import hypothesis.strategies._internal.core as st
  20. from hypothesis.errors import InvalidArgument
  21. @@ -45,16 +47,7 @@ URL_SAFE_CHARACTERS = frozenset(string.ascii_letters + string.digits + "$-_.+!*'
  22. # This file is sourced from http://data.iana.org/TLD/tlds-alpha-by-domain.txt
  23. # The file contains additional information about the date that it was last updated.
  24. -try:
  25. - from importlib.resources import read_text # type: ignore
  26. -except ImportError:
  27. - # If we don't have importlib.resources (Python 3.7+) or the importlib_resources
  28. - # backport available, fall back to __file__ and hope we're on a filesystem.
  29. - f = os.path.join(os.path.dirname(__file__), "vendor", "tlds-alpha-by-domain.txt")
  30. - with open(f) as tld_file:
  31. - _tlds = tld_file.read().splitlines()
  32. -else: # pragma: no cover # new in Python 3.7
  33. - _tlds = read_text("hypothesis.vendor", "tlds-alpha-by-domain.txt").splitlines()
  34. +_tlds = importlib_resources.read_text("hypothesis.vendor", "tlds-alpha-by-domain.txt").splitlines()
  35. assert _tlds[0].startswith("#")
  36. TOP_LEVEL_DOMAINS = ["COM"] + sorted(_tlds[1:], key=len)