
try:
    from typing import *
    import typing
except:
    # The backwards compatibility stubs must live in another module lest
    # mypy complains.
    from typing_stubs import * # type: ignore


####################################################
# Backwards compatibility shims
#
# N.B. mypy appears to typecheck as though the "then" clause of if structures
# is taken. We exploit this below.

# TextIO is missing on some older Pythons.
if 'TextIO' in globals():
    TextIO = typing.TextIO
else:
    TextIO = None # type: ignore


####################################################
# Testsuite-specific types

WayName = NewType("WayName", str)
TestName = NewType("TestName", str)
OutputNormalizer = Callable[[str], str]
IssueNumber = NewType("IssueNumber", int)

# Used by perf_notes
GitHash = NewType("GitHash", str)
GitRef = NewType("GitRef", str)
TestEnv = NewType("TestEnv", str)
MetricName = NewType("MetricName", str)

try:
    from typing import *
    import typing
except:
    # The backwards compatibility stubs must live in another module lest
    # mypy complains.
    from typing_stubs import * # type: ignore


####################################################
# Backwards compatibility shims
#
# N.B. mypy appears to typecheck as though the "then" clause of if structures
# is taken. We exploit this below.

# TextIO is missing on some older Pythons.
if 'TextIO' not in globals():
    try:
        TextIO = typing.TextIO
    except ImportError:
        TextIO = None # type: ignore
else:
    TextIO = None # type: ignore


####################################################
# Testsuite-specific types

WayName = NewType("WayName", str)
TestName = NewType("TestName", str)
OutputNormalizer = Callable[[str], str]
IssueNumber = NewType("IssueNumber", int)

# Used by perf_notes
GitHash = NewType("GitHash", str)
GitRef = NewType("GitRef", str)
TestEnv = NewType("TestEnv", str)
MetricName = NewType("MetricName", str)
Simplify Python <3.5 fallback for TextIO
testsuite: Simplify Python <3.5 fallback for TextIO

(cherry picked from commit d092d8598694c23bc07cdcc504dff52fa5f33be1)

  
  try:
      from typing import *
      import typing
  except:
      # The backwards compatibility stubs must live in another module lest
      # mypy complains.
      from typing_stubs import * # type: ignore
  
  
  ####################################################
  # Backwards compatibility shims
  #
  # N.B. mypy appears to typecheck as though the "then" clause of if structures
  # is taken. We exploit this below.
  
  # TextIO is missing on some older Pythons.
- if 'TextIO' in globals():
+ if 'TextIO' not in globals():
+     try:
-     TextIO = typing.TextIO
+         TextIO = typing.TextIO
+     except ImportError:
+         TextIO = None # type: ignore
  else:
      TextIO = None # type: ignore
  
  
  ####################################################
  # Testsuite-specific types
  
  WayName = NewType("WayName", str)
  TestName = NewType("TestName", str)
  OutputNormalizer = Callable[[str], str]
  IssueNumber = NewType("IssueNumber", int)
  
  # Used by perf_notes
  GitHash = NewType("GitHash", str)
  GitRef = NewType("GitRef", str)
  TestEnv = NewType("TestEnv", str)
  MetricName = NewType("MetricName", str)
Simplify Python <3.5 fallback for TextIO
## Code Before:

try:
    from typing import *
    import typing
except:
    # The backwards compatibility stubs must live in another module lest
    # mypy complains.
    from typing_stubs import * # type: ignore


####################################################
# Backwards compatibility shims
#
# N.B. mypy appears to typecheck as though the "then" clause of if structures
# is taken. We exploit this below.

# TextIO is missing on some older Pythons.
if 'TextIO' in globals():
    TextIO = typing.TextIO
else:
    TextIO = None # type: ignore


####################################################
# Testsuite-specific types

WayName = NewType("WayName", str)
TestName = NewType("TestName", str)
OutputNormalizer = Callable[[str], str]
IssueNumber = NewType("IssueNumber", int)

# Used by perf_notes
GitHash = NewType("GitHash", str)
GitRef = NewType("GitRef", str)
TestEnv = NewType("TestEnv", str)
MetricName = NewType("MetricName", str)
## Instruction:
Simplify Python <3.5 fallback for TextIO
## Code After:

try:
    from typing import *
    import typing
except:
    # The backwards compatibility stubs must live in another module lest
    # mypy complains.
    from typing_stubs import * # type: ignore


####################################################
# Backwards compatibility shims
#
# N.B. mypy appears to typecheck as though the "then" clause of if structures
# is taken. We exploit this below.

# TextIO is missing on some older Pythons.
if 'TextIO' not in globals():
    try:
        TextIO = typing.TextIO
    except ImportError:
        TextIO = None # type: ignore
else:
    TextIO = None # type: ignore


####################################################
# Testsuite-specific types

WayName = NewType("WayName", str)
TestName = NewType("TestName", str)
OutputNormalizer = Callable[[str], str]
IssueNumber = NewType("IssueNumber", int)

# Used by perf_notes
GitHash = NewType("GitHash", str)
GitRef = NewType("GitRef", str)
TestEnv = NewType("TestEnv", str)
MetricName = NewType("MetricName", str)