files.new_contents: # See https://pre-commit.com for more information
  # See https://pre-commit.com/hooks.html for more hooks
  repos:
    - repo: https://github.com/pre-commit/mirrors-autopep8
      rev: 'v1.5.7'
      hooks:
        - id: autopep8
          args:
            - --recursive
            - --in-place
            - --aggressive
            - --aggressive
            - --hang-closing
            - --max-line-length=99
  
    - repo: https://github.com/PyCQA/isort
      rev: "5.8.0"
      hooks:
        - id: isort
  
    - repo: https://github.com/pycqa/flake8
      rev: "4.0.1"
      hooks:
        - id: flake8
          args:
            - --max-line-length=99
          files: >
            (?x)^(
              examples/.*|
              tests/.*|
              tmt/.*
            )$
  
    - repo: https://github.com/pre-commit/pre-commit-hooks
      rev: "v3.4.0"
      hooks:
        - id: end-of-file-fixer
        - id: mixed-line-ending
        - id: trailing-whitespace
  
  [... the rest is omitted ...]
files.new_path: .pre-commit-config.yaml
files.old_contents: # See https://pre-commit.com for more information
  # See https://pre-commit.com/hooks.html for more hooks
  repos:
    - repo: https://github.com/pre-commit/mirrors-autopep8
      rev: 'v1.5.7'
      hooks:
        - id: autopep8
          args:
            - --recursive
            - --in-place
            - --aggressive
            - --aggressive
            - --hang-closing
            - --max-line-length=99
  
    - repo: https://github.com/PyCQA/isort
      rev: "5.8.0"
      hooks:
        - id: isort
  
    - repo: https://github.com/pycqa/flake8
      rev: "4.0.1"
      hooks:
        - id: flake8
          args:
            - --max-line-length=99
          files: >
            (?x)^(
              examples/.*|
              tests/.*|
              tmt/.*
            )$
  
    - repo: https://github.com/pre-commit/pre-commit-hooks
      rev: "v3.4.0"
      hooks:
        - id: end-of-file-fixer
        - id: mixed-line-ending
        - id: trailing-whitespace
  
  [... the rest is omitted ...]
files.old_path: .pre-commit-config.yaml
files.new_contents: # coding: utf-8
  
  """ Command line interface for the Test Management Tool """
  
  import collections
  import dataclasses
  import os
  import subprocess
  import sys
  from typing import TYPE_CHECKING, Any, Callable, List, Optional, Set
  
  import click
  import fmf
  from click import echo, style
  from fmf.utils import listed
  
  import tmt
  import tmt.convert
  import tmt.export
  import tmt.identifier
  import tmt.options
  import tmt.plugins
  import tmt.steps
  import tmt.templates
  import tmt.utils
  
  if TYPE_CHECKING:
      import tmt.steps.discover
      import tmt.steps.execute
  
  # Explore available plugins (need to detect all supported methods first)
  tmt.plugins.explore()
  
  # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  #  Click Context Object Container
  # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  
  
  @dataclasses.dataclass
  class ContextObject:
      """ Click Context Object Container """
      common: tmt.utils.Common
      fmf_context: tmt.utils.FmfContextType
      steps: Set[tmt.steps.Step]
      tree: tmt.Tree
      clean: Optional[tmt.Clean] = None
      run: Optional[tmt.Run] = None
  
  
  # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  
  [... the rest is omitted ...]
files.new_path: tmt/cli.py
files.old_contents: # coding: utf-8
  
  """ Command line interface for the Test Management Tool """
  
  import collections
  import dataclasses
  import os
  import subprocess
  import sys
  from typing import TYPE_CHECKING, Any, Callable, List, Optional, Set
  
  import click
  import fmf
  from click import echo, style
  from fmf.utils import listed
  
  import tmt
  import tmt.convert
  import tmt.export
  import tmt.identifier
  import tmt.options
  import tmt.plugins
  import tmt.steps
  import tmt.templates
  import tmt.utils
  
  if TYPE_CHECKING:
      import tmt.steps.discover
      import tmt.steps.execute
  
  # Explore available plugins (need to detect all supported methods first)
  tmt.plugins.explore()
  
  # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  #  Click Context Object Container
  # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  
  
  @dataclasses.dataclass
  class ContextObject:
      """ Click Context Object Container """
      common: tmt.utils.Common
      fmf_context: tmt.utils.FmfContextType
      steps: Set[tmt.steps.Step]
      tree: tmt.Tree
      clean: Optional[tmt.Clean] = None
      run: Optional[tmt.Run] = None
  
  
  # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  
  [... the rest is omitted ...]
files.old_path: tmt/cli.py
files.new_contents: # coding: utf-8
  
  """ Export metadata into nitrate """
  
  
  import email.utils
  import os
  import re
  import traceback
  import types
  import xmlrpc.client
  from functools import lru_cache
  from typing import Any, Dict, Generator, List, Optional, Tuple, Union, cast
  
  import fmf
  from click import echo, secho, style
  
  import tmt
  import tmt.utils
  from tmt.convert import SYSTEM_OTHER, add_link
  from tmt.identifier import ID_KEY, add_uuid_if_not_defined
  from tmt.utils import ConvertError, check_git_url, markdown_to_html
  
  bugzilla: Optional[types.ModuleType] = None
  gssapi: Optional[types.ModuleType] = None
  nitrate: Optional[types.ModuleType] = None
  
  PolarionException: Any = None
  PolarionTestCase: Any = None
  PolarionWorkItem: Any = None
  
  DEFAULT_PRODUCT: Any = None
  
  SectionsReturnType = Tuple[str, str, str, str]
  HeadingsType = List[List[Union[int, str]]]
  SectionsHeadingsType = Dict[str, HeadingsType]
  
  log = fmf.utils.Logging('tmt').logger
  
  WARNING = """
  Test case has been migrated to git. Any changes made here might be overw
  
  [... the rest is omitted ...]
files.new_path: tmt/export.py
files.old_contents: # coding: utf-8
  
  """ Export metadata into nitrate """
  
  
  import email.utils
  import os
  import re
  import traceback
  import types
  import xmlrpc.client
  from functools import lru_cache
  from typing import Any, Dict, Generator, List, Optional, Tuple, Union, cast
  
  import fmf
  from click import echo, secho, style
  
  import tmt
  import tmt.utils
  from tmt.convert import SYSTEM_OTHER, add_link
  from tmt.identifier import ID_KEY, add_uuid_if_not_defined
  from tmt.utils import ConvertError, check_git_url, markdown_to_html
  
  bugzilla: Optional[types.ModuleType] = None
  gssapi: Optional[types.ModuleType] = None
  nitrate: Optional[types.ModuleType] = None
  
  PolarionException: Any = None
  PolarionTestCase: Any = None
  PolarionWorkItem: Any = None
  
  DEFAULT_PRODUCT: Any = None
  
  SectionsReturnType = Tuple[str, str, str, str]
  HeadingsType = List[List[Union[int, str]]]
  SectionsHeadingsType = Dict[str, HeadingsType]
  
  log = fmf.utils.Logging('tmt').logger
  
  WARNING = """
  Test case has been migrated to git. Any changes made here might be overw
  
  [... the rest is omitted ...]
files.old_path: tmt/export.py
files.new_contents: import tmt
  import tmt.steps
  import tmt.steps.finish
  import tmt.steps.prepare.ansible
  from tmt.steps.prepare.ansible import PrepareAnsible
  
  
  @tmt.steps.provides_method('ansible')
  class FinishAnsible(tmt.steps.finish.FinishPlugin, PrepareAnsible):
      """
      Perform finishing tasks using ansible
  
      Single playbook config:
  
          finish:
              how: ansible
              playbook: ansible/packages.yml
  
      Multiple playbooks config:
  
          finish:
              how: ansible
              playbook:
                - playbook/one.yml
                - playbook/two.yml
                - playbook/three.yml
  
      The playbook path should be relative to the metadata tree root.
      Use 'order' attribute to select in which order finishing tasks
      should happen if there are multiple configs. Default order is '50'.
      """
  
      _data_class = tmt.steps.prepare.ansible.PrepareAnsibleData
  
      # Assigning class methods seems to cause trouble to mypy
      # See also: https://github.com/python/mypy/issues/6700
      base_command = tmt.steps.finish.FinishPlugin.base_command  # type: ignore[assignment]
  
  
  [... the rest is omitted ...]
files.new_path: tmt/steps/finish/ansible.py
files.old_contents: import tmt
  import tmt.steps
  import tmt.steps.finish
  import tmt.steps.prepare.ansible
  from tmt.steps.prepare.ansible import PrepareAnsible
  
  
  @tmt.steps.provides_method('ansible')
  class FinishAnsible(tmt.steps.finish.FinishPlugin, PrepareAnsible):
      """
      Perform finishing tasks using ansible
  
      Single playbook config:
  
          finish:
              how: ansible
              playbook: ansible/packages.yml
  
      Multiple playbooks config:
  
          finish:
              how: ansible
              playbook:
                - playbook/one.yml
                - playbook/two.yml
                - playbook/three.yml
  
      The playbook path should be relative to the metadata tree root.
      Use 'order' attribute to select in which order finishing tasks
      should happen if there are multiple configs. Default order is '50'.
      """
  
      _data_class = tmt.steps.prepare.ansible.PrepareAnsibleData
  
      # Assigning class methods seems to cause trouble to mypy
      # See also: https://github.com/python/mypy/issues/6700
      base_command = tmt.steps.finish.FinishPlugin.base_command  # type: ignore
  
  
  [... the rest is omitted ...]
files.old_path: tmt/steps/finish/ansible.py
files.new_contents: # coding: utf-8
  
  import dataclasses
  import datetime
  import os
  import platform
  import re
  import time
  import types
  from typing import Any, List, Optional, cast
  
  import click
  import requests
  
  import tmt
  import tmt.steps
  import tmt.steps.provision
  import tmt.utils
  from tmt.utils import WORKDIR_ROOT, ProvisionError, retry_session
  
  libvirt: Optional[types.ModuleType] = None
  testcloud: Optional[types.ModuleType] = None
  
  
  def import_testcloud() -> None:
      """
      Import testcloud module only when needed
  
      Until we have a separate package for each plugin.
      """
      global testcloud
      global libvirt
      try:
          import libvirt
          import testcloud.image
          import testcloud.instance
          import testcloud.util
      except ImportError:
          raise ProvisionError(
              "Install 'testcloud' to provision using this method.")
  
  
  # Testcloud cache to our tmt's workdir root
  TESTCLOUD_DATA = os.path.join(WORKDIR_ROOT, 'testcloud')
  TESTCLOUD_IMAGES = os.path.join(TESTCLOUD_DATA, 'images')
  
  # Userdata for cloud-init
  USER_DATA = """#cloud-config
  chpasswd:
    list: |
      {user_name}:
  
  [... the rest is omitted ...]
files.new_path: tmt/steps/provision/testcloud.py
files.old_contents: # coding: utf-8
  
  import dataclasses
  import datetime
  import os
  import platform
  import re
  import time
  import types
  from typing import Any, List, Optional, cast
  
  import click
  import requests
  
  import tmt
  import tmt.steps
  import tmt.steps.provision
  import tmt.utils
  from tmt.utils import WORKDIR_ROOT, ProvisionError, retry_session
  
  libvirt: Optional[types.ModuleType] = None
  testcloud: Optional[types.ModuleType] = None
  
  
  def import_testcloud() -> None:
      """
      Import testcloud module only when needed
  
      Until we have a separate package for each plugin.
      """
      global testcloud
      global libvirt
      try:
          import libvirt
          import testcloud.image
          import testcloud.instance
          import testcloud.util
      except ImportError:
          raise ProvisionError(
              "Install 'testcloud' to provision using this method.")
  
  
  # Testcloud cache to our tmt's workdir root
  TESTCLOUD_DATA = os.path.join(WORKDIR_ROOT, 'testcloud')
  TESTCLOUD_IMAGES = os.path.join(TESTCLOUD_DATA, 'images')
  
  # Userdata for cloud-init
  USER_DATA = """#cloud-config
  chpasswd:
    list: |
      {user_name}:
  
  [... the rest is omitted ...]
files.old_path: tmt/steps/provision/testcloud.py
files.new_contents: import dataclasses
  import os
  import types
  from typing import Any, List, Optional, cast, overload
  
  import click
  
  import tmt
  import tmt.options
  import tmt.steps
  import tmt.steps.report
  
  DEFAULT_NAME = "junit.xml"
  
  junit_xml: Optional[types.ModuleType] = None
  
  # Thanks to import burried in a function, we don't get the regular missing annotations
  # but "name ... is not defined". Define a special type to follow the test suite instance
  # around, and if junit_xml ever gets annotations, we can replace it with provided type.
  JunitTestSuite = Any
  
  
  def import_junit_xml() -> None:
      """
      Import junit_xml module only when needed
  
      Until we have a separate package for each plugin.
      """
      global junit_xml
      try:
          import junit_xml
      except ImportError:
          raise tmt.utils.ReportError(
              "Missing 'junit-xml', fixable by 'pip install tmt[report-junit]'.")
  
  
  @overload
  def duration_to_seconds(duration: str) -> int: pass
  
  
  @overload
  def duration_to_seconds(duration: None) -> None: pass
  
  
  def duration_to_seconds(duration: Optional[str]) -> Optional
  
  [... the rest is omitted ...]
files.new_path: tmt/steps/report/junit.py
files.old_contents: import dataclasses
  import os
  import types
  from typing import Any, List, Optional, cast, overload
  
  import click
  
  import tmt
  import tmt.options
  import tmt.steps
  import tmt.steps.report
  
  DEFAULT_NAME = "junit.xml"
  
  junit_xml: Optional[types.ModuleType] = None
  
  # Thanks to import burried in a function, we don't get the regular missing annotations
  # but "name ... is not defined". Define a special type to follow the test suite instance
  # around, and if junit_xml ever gets annotations, we can replace it with provided type.
  JunitTestSuite = Any
  
  
  def import_junit_xml() -> None:
      """
      Import junit_xml module only when needed
  
      Until we have a separate package for each plugin.
      """
      global junit_xml
      try:
          import junit_xml
      except ImportError:
          raise tmt.utils.ReportError(
              "Missing 'junit-xml', fixable by 'pip install tmt[report-junit]'.")
  
  
  @overload
  def duration_to_seconds(duration: str) -> int: pass
  
  
  @overload
  def duration_to_seconds(duration: None) -> None: pass
  
  
  def duration_to_seconds(duration: Optional[str]) -> Optional
  
  [... the rest is omitted ...]
files.old_path: tmt/steps/report/junit.py
files.new_contents: 
  """ Test Metadata Utilities """
  
  import contextlib
  import copy
  import dataclasses
  import datetime
  import functools
  import glob
  import io
  import os
  import pprint
  import re
  import shlex
  import shutil
  import subprocess
  import sys
  import time
  import unicodedata
  from collections import OrderedDict
  from functools import lru_cache
  from pathlib import Path
  from threading import Thread
  from typing import (IO, TYPE_CHECKING, Any, Callable, Dict, Generator,
                      Iterable, List, NamedTuple, Optional, Pattern, Tuple, Type,
                      TypeVar, Union, cast, overload)
  
  import click
  import fmf
  import jsonschema
  import pkg_resources
  import requests
  import requests.adapters
  import requests.packages.urllib3.util.retry
  import urllib3.exceptions
  from click import echo, style, wrap_text
  from ruamel.yaml import YAML, scalarstring
  from ruamel.yaml.comments import CommentedMap
  
  if sys.version_info >= (3, 8):
      from typing import Literal, Protocol
  else:
      from typing_extensions import Literal, Protocol
  
  
  if TYPE_CHECKING:
      import tmt.base
      import tmt.steps
  
  log = fmf.utils.Logging('tmt').logger
  
  # Default workdir root and
  
  [... the rest is omitted ...]
files.new_path: tmt/utils.py
files.old_contents: 
  """ Test Metadata Utilities """
  
  import contextlib
  import copy
  import dataclasses
  import datetime
  import functools
  import glob
  import io
  import os
  import pprint
  import re
  import shlex
  import shutil
  import subprocess
  import sys
  import time
  import unicodedata
  from collections import OrderedDict
  from functools import lru_cache
  from pathlib import Path
  from threading import Thread
  from typing import (IO, TYPE_CHECKING, Any, Callable, Dict, Generator,
                      Iterable, List, NamedTuple, Optional, Pattern, Tuple, Type,
                      TypeVar, Union, cast, overload)
  
  import click
  import fmf
  import jsonschema
  import pkg_resources
  import requests
  import requests.adapters
  import requests.packages.urllib3.util.retry
  import urllib3.exceptions
  from click import echo, style, wrap_text
  from ruamel.yaml import YAML, scalarstring
  from ruamel.yaml.comments import CommentedMap
  
  if sys.version_info >= (3, 8):
      from typing import Literal, Protocol
  else:
      from typing_extensions import Literal, Protocol
  
  
  if TYPE_CHECKING:
      import tmt.base
      import tmt.steps
  
  log = fmf.utils.Logging('tmt').logger
  
  # Default workdir root and
  
  [... the rest is omitted ...]
files.old_path: tmt/utils.py