# Path: rebasehelper/cli.py
# class CLI:
#     """ Class for processing data from commandline """
# 
#     @staticmethod
#     def build_parser(available_choices_only=False):
#         parser = CustomArgumentParser(description=PROGRAM_DESCRIPTION,
#                                       formatter_class=CustomHelpFormatter)
# 
#         group = None
#         current_group = 0
#         for option in traverse_options(OPTIONS + plugin_manager.get_options()):
#             available_choices = option.pop("available_choices", option.get("choices"))
#             if available_choices_only:
#                 option["choices"] = available_choices
# 
#             option_kwargs = dict(option)
#             for key in ("group", "default", "name"):
#                 if key in option_kwargs:
#                     del option_kwargs[key]
# 
#             if "group" in option:
#                 if not group or current_group != option["group"]:
#                     current_group = option["group"]
#                     group = parser.add_mutually_exclusive_group()
#                 actions_container = group
#             else:
#                 actions_container = parser
# 
#             # default is set to SUPPRESS to prevent arguments which were not specified on command line from being
#             # added to namespace. This allows rebase-helper to determine which arguments are used with their
#             # default value. This is later used for merging CLI arguments with config.
#             actions_container.add_argument(*option["name"], action=CustomAction, default=argparse.SUPPRESS,
#                                            actual_default=option.get("default"), **option_kwargs)
# 
#         return parser
# 
#     def __init__(self, args=None):
#         """parse arguments"""
#         if args is None:
#             args = sys.argv[1:]
#         # sanitize builder options to prevent ArgumentParser from processing them
#         for opt in ['--builder-options', '--srpm-builder-options']:
#             try:
#                 i = args.index(opt)
#                 args[i:i+2] = ['='.join(args[i:i+2])]
#             except ValueError:
#                 continue
#         self.parser = CLI.build_parser(available_choices_only=True)
#         self.args = self.parser.parse_args(args)
# 
#     def __getattr__(self, name):
#         try:
#             return getattr(self.args, name)
#         except AttributeError:
#             return object.__getattribute__(self, name)
# 
# Path: rebasehelper/constants.py
# ENCODING: str = locale.getpreferredencoding()
# 
# Path: rebasehelper/archive.py
# class Archive:
#     """Class representing an archive with sources"""
# 
#     def __init__(self, filename):
#         self._filename = filename
#         self._archive_type = None
# 
#         for archive_type in archive_types.values():
#             if archive_type.match(self._filename):
#                 self._archive_type = archive_type
# 
#         if self._archive_type is None:
#             raise NotImplementedError('Unsupported archive type')
# 
#     def extract_archive(self, path):
#         """
#         Extracts the archive into the given path
# 
#         :param path: Path where to extract the archive to.
#         """
#         logger.verbose('Extracting %s to %s', self._filename, path)
# 
#         try:
#             archive = self._archive_type.open(self._filename)
#         except (EOFError, tarfile.ReadError, lzma.LZMAError) as e:
#             raise IOError(str(e)) from e
# 
#         try:
#             self._archive_type.extract(archive, self._filename, path)
#         finally:
#             archive.close()
# 
#     @classmethod
#     def get_supported_archives(cls):
#         return archive_types.keys()


import re
import sys
from rebasehelper.cli import CLI
from rebasehelper.constants import ENCODING
from rebasehelper.archive import Archive
#
# This tool helps you rebase your package to the latest version
# Copyright (C) 2013-2019 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Authors: Petr Hráček <phracek@redhat.com>
#          Tomáš Hozza <thozza@redhat.com>
#          Nikola Forró <nforro@redhat.com>
#          František Nečas <fifinecas@seznam.cz>




class Completion:

    @staticmethod
    def extensions():

# Path: rebasehelper/cli.py
# class CLI:
#     """ Class for processing data from commandline """
# 
#     @staticmethod
#     def build_parser(available_choices_only=False):
#         parser = CustomArgumentParser(description=PROGRAM_DESCRIPTION,
#                                       formatter_class=CustomHelpFormatter)
# 
#         group = None
#         current_group = 0
#         for option in traverse_options(OPTIONS + plugin_manager.get_options()):
#             available_choices = option.pop("available_choices", option.get("choices"))
#             if available_choices_only:
#                 option["choices"] = available_choices
# 
#             option_kwargs = dict(option)
#             for key in ("group", "default", "name"):
#                 if key in option_kwargs:
#                     del option_kwargs[key]
# 
#             if "group" in option:
#                 if not group or current_group != option["group"]:
#                     current_group = option["group"]
#                     group = parser.add_mutually_exclusive_group()
#                 actions_container = group
#             else:
#                 actions_container = parser
# 
#             # default is set to SUPPRESS to prevent arguments which were not specified on command line from being
#             # added to namespace. This allows rebase-helper to determine which arguments are used with their
#             # default value. This is later used for merging CLI arguments with config.
#             actions_container.add_argument(*option["name"], action=CustomAction, default=argparse.SUPPRESS,
#                                            actual_default=option.get("default"), **option_kwargs)
# 
#         return parser
# 
#     def __init__(self, args=None):
#         """parse arguments"""
#         if args is None:
#             args = sys.argv[1:]
#         # sanitize builder options to prevent ArgumentParser from processing them
#         for opt in ['--builder-options', '--srpm-builder-options']:
#             try:
#                 i = args.index(opt)
#                 args[i:i+2] = ['='.join(args[i:i+2])]
#             except ValueError:
#                 continue
#         self.parser = CLI.build_parser(available_choices_only=True)
#         self.args = self.parser.parse_args(args)
# 
#     def __getattr__(self, name):
#         try:
#             return getattr(self.args, name)
#         except AttributeError:
#             return object.__getattribute__(self, name)
# 
# Path: rebasehelper/constants.py
# ENCODING: str = locale.getpreferredencoding()
# 
# Path: rebasehelper/archive.py
# class Archive:
#     """Class representing an archive with sources"""
# 
#     def __init__(self, filename):
#         self._filename = filename
#         self._archive_type = None
# 
#         for archive_type in archive_types.values():
#             if archive_type.match(self._filename):
#                 self._archive_type = archive_type
# 
#         if self._archive_type is None:
#             raise NotImplementedError('Unsupported archive type')
# 
#     def extract_archive(self, path):
#         """
#         Extracts the archive into the given path
# 
#         :param path: Path where to extract the archive to.
#         """
#         logger.verbose('Extracting %s to %s', self._filename, path)
# 
#         try:
#             archive = self._archive_type.open(self._filename)
#         except (EOFError, tarfile.ReadError, lzma.LZMAError) as e:
#             raise IOError(str(e)) from e
# 
#         try:
#             self._archive_type.extract(archive, self._filename, path)
#         finally:
#             archive.close()
# 
#     @classmethod
#     def get_supported_archives(cls):
#         return archive_types.keys()


# Path: rebasehelper/completion.py
import re
import sys
from rebasehelper.cli import CLI
from rebasehelper.constants import ENCODING
from rebasehelper.archive import Archive

#
# This tool helps you rebase your package to the latest version
# Copyright (C) 2013-2019 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Authors: Petr Hráček <phracek@redhat.com>
#          Tomáš Hozza <thozza@redhat.com>
#          Nikola Forró <nforro@redhat.com>
#          František Nečas <fifinecas@seznam.cz>




class Completion:

    @staticmethod
    def extensions():

        archives = Archive.get_supported_archives()