# Path: ml_collections/config_flags/config_flags.py
# FLAGS = flags.FLAGS
# _FIELD_TYPE_TO_PARSER = {
#     float: flags.FloatParser(),
#     bool: flags.BooleanParser(),
#     tuple: tuple_parser.TupleParser(),
#     int: flags.IntegerParser(),
#     str: flags.ArgumentParser()
# }
# _FIELD_TYPE_TO_SERIALIZER = {
#     t: flags.ArgumentSerializer()
#     for t in _FIELD_TYPE_TO_PARSER
# }
# _T = TypeVar('_T')
# class UnsupportedOperationError(flags.Error):
# class FlagOrderError(flags.Error):
# class UnparsedFlagError(flags.Error):
# class _TypedFlagHolder(flags.FlagHolder, Generic[_T]):
# class _DataclassParser(flags.ArgumentParser, Generic[_T]):
# class _IgnoreFileNotFoundAndCollectErrors:
#     class _ContextManager:
# class _ErrorConfig:
# class _ConfigFileParser(flags.ArgumentParser):
# class _InlineConfigParser(flags.ArgumentParser):
# class _ConfigFlag(flags.Flag):
# class _ConfigFieldParser(flags.ArgumentParser):
# def DEFINE_config_file(  # pylint: disable=g-bad-name
#     name: str,
#     default: Optional[str] = None,
#     help_string: str = 'path to config file.',
#     flag_values: flags.FlagValues = FLAGS,
#     lock_config: bool = True,
#     **kwargs) -> flags.FlagHolder:
# def DEFINE_config_dict(  # pylint: disable=g-bad-name
#     name: str,
#     config: ml_collections.ConfigDict,
#     help_string: str = 'ConfigDict instance.',
#     flag_values: flags.FlagValues = FLAGS,
#     lock_config: bool = True,
#     **kwargs) -> flags.FlagHolder:
#   def __init__(self, flag: flags.FlagHolder):
#   def value(self) -> _T:
#   def default(self) -> _T:
#   def name(self) -> str:
#   def __init__(self, name: str, dataclass_type: Type[_T]):
#   def parse(self, config: Any) -> _T:
#   def flag_type(self):
# def DEFINE_config_dataclass(  # pylint: disable=invalid-name
#     name: str,
#     config: _T,
#     help_string: str = 'Configuration object. Must be a dataclass.',
#     flag_values: flags.FlagValues = FLAGS,
#     **kwargs,
# ) -> _TypedFlagHolder[_T]:
# def get_config_filename(config_flag) -> str:  # pylint: disable=g-bad-name
# def get_override_values(config_flag) -> Dict[str, Any]:  # pylint: disable=g-bad-name
#   def __init__(self):
#   def Attempt(self, description, path):
#       def __enter__(self):
#       def __exit__(self, exc_type, exc_value, unused_traceback):
#   def ProcessAttemptException(self, exc_type, exc_value):
#   def DescribeAttempts(self):
# def _LoadConfigModule(name: str, path: str):
#   def __init__(self, error):
#   def __getattr__(self, attr):
#   def __setattr__(self, attr, value):
#   def __delattr__(self, attr):
#   def __getitem__(self, key):
#   def __setitem__(self, key, value):
#   def __delitem__(self, key):
#   def _ReportError(self):
# def _LockConfig(config):
#   def __init__(self, name, lock_config=True):
#   def parse(self, path):
#   def flag_type(self):
#   def __init__(self, name, lock_config=True):
#   def parse(self, config):
#   def flag_type(self):
#   def __init__(self, flag_values=FLAGS, **kwargs):
#   def _GetOverrides(self, argv):
#   def _FindConfigSpecified(self, argv):
#   def _IsConfigSpecified(self, argv):
#   def _set_default(self, default):
#   def _parse(self, argument):
#   def config_filename(self):
#   def override_values(self):
# def is_config_flag(flag):  # pylint: disable=g-bad-name
#   def __init__(
#       self,
#       parser: flags.ArgumentParser,
#       path: str,
#       config: ml_collections.ConfigDict,
#       override_values: MutableMapping[str, Any]):
#   def __getattr__(self, attr):
#   def parse(self, argument):  # pylint: disable=invalid-name
#   def flag_type(self) -> str:
#   def syntactic_help(self) -> str:
# 
# Path: ml_collections/config_flags/tests/mock_config.py
# class TestConfig(object):
#   def __init__(self):
#   def readonly_field(self):
#   def __repr__(self):
# def get_config():


import copy
import shlex
import sys
import ml_collections
from absl import flags
from absl.testing import absltest
from absl.testing import flagsaver
from absl.testing import parameterized
from ml_collections.config_flags import config_flags
from ml_collections.config_flags.tests import mock_config
      return

    for attribute in keys:
      if isinstance(get_val(config1, attribute), _CHECK_TYPES):
        self.assertEqual(get_val(config1, attribute),
                         get_val(config2, attribute))
      else:
        # Try to go deeper with comparison
        self.assert_subset_configs(get_val(config1, attribute),
                                   get_val(config2, attribute))

  def assert_equal_configs(self, config1, config2):
    """Checks if two configs are identical."""
    self.assert_subset_configs(config1, config2)
    self.assert_subset_configs(config2, config1)  # pylint: disable=arguments-out-of-order


class ConfigFileFlagTest(_ConfigFlagTestCase, parameterized.TestCase):
  """Tests config flags library."""

  @parameterized.named_parameters(*_DASH_PARAMETERS)
  def testLoading(self, config_flag):
    """Tests loading config from file."""

    values = _parse_flags('./program {}'.format(config_flag),
                          default='nonexisting.py')

    self.assertIn('test_config', values)

    self.assert_equal_configs(values.test_config,

# Path: ml_collections/config_flags/config_flags.py
# FLAGS = flags.FLAGS
# _FIELD_TYPE_TO_PARSER = {
#     float: flags.FloatParser(),
#     bool: flags.BooleanParser(),
#     tuple: tuple_parser.TupleParser(),
#     int: flags.IntegerParser(),
#     str: flags.ArgumentParser()
# }
# _FIELD_TYPE_TO_SERIALIZER = {
#     t: flags.ArgumentSerializer()
#     for t in _FIELD_TYPE_TO_PARSER
# }
# _T = TypeVar('_T')
# class UnsupportedOperationError(flags.Error):
# class FlagOrderError(flags.Error):
# class UnparsedFlagError(flags.Error):
# class _TypedFlagHolder(flags.FlagHolder, Generic[_T]):
# class _DataclassParser(flags.ArgumentParser, Generic[_T]):
# class _IgnoreFileNotFoundAndCollectErrors:
#     class _ContextManager:
# class _ErrorConfig:
# class _ConfigFileParser(flags.ArgumentParser):
# class _InlineConfigParser(flags.ArgumentParser):
# class _ConfigFlag(flags.Flag):
# class _ConfigFieldParser(flags.ArgumentParser):
# def DEFINE_config_file(  # pylint: disable=g-bad-name
#     name: str,
#     default: Optional[str] = None,
#     help_string: str = 'path to config file.',
#     flag_values: flags.FlagValues = FLAGS,
#     lock_config: bool = True,
#     **kwargs) -> flags.FlagHolder:
# def DEFINE_config_dict(  # pylint: disable=g-bad-name
#     name: str,
#     config: ml_collections.ConfigDict,
#     help_string: str = 'ConfigDict instance.',
#     flag_values: flags.FlagValues = FLAGS,
#     lock_config: bool = True,
#     **kwargs) -> flags.FlagHolder:
#   def __init__(self, flag: flags.FlagHolder):
#   def value(self) -> _T:
#   def default(self) -> _T:
#   def name(self) -> str:
#   def __init__(self, name: str, dataclass_type: Type[_T]):
#   def parse(self, config: Any) -> _T:
#   def flag_type(self):
# def DEFINE_config_dataclass(  # pylint: disable=invalid-name
#     name: str,
#     config: _T,
#     help_string: str = 'Configuration object. Must be a dataclass.',
#     flag_values: flags.FlagValues = FLAGS,
#     **kwargs,
# ) -> _TypedFlagHolder[_T]:
# def get_config_filename(config_flag) -> str:  # pylint: disable=g-bad-name
# def get_override_values(config_flag) -> Dict[str, Any]:  # pylint: disable=g-bad-name
#   def __init__(self):
#   def Attempt(self, description, path):
#       def __enter__(self):
#       def __exit__(self, exc_type, exc_value, unused_traceback):
#   def ProcessAttemptException(self, exc_type, exc_value):
#   def DescribeAttempts(self):
# def _LoadConfigModule(name: str, path: str):
#   def __init__(self, error):
#   def __getattr__(self, attr):
#   def __setattr__(self, attr, value):
#   def __delattr__(self, attr):
#   def __getitem__(self, key):
#   def __setitem__(self, key, value):
#   def __delitem__(self, key):
#   def _ReportError(self):
# def _LockConfig(config):
#   def __init__(self, name, lock_config=True):
#   def parse(self, path):
#   def flag_type(self):
#   def __init__(self, name, lock_config=True):
#   def parse(self, config):
#   def flag_type(self):
#   def __init__(self, flag_values=FLAGS, **kwargs):
#   def _GetOverrides(self, argv):
#   def _FindConfigSpecified(self, argv):
#   def _IsConfigSpecified(self, argv):
#   def _set_default(self, default):
#   def _parse(self, argument):
#   def config_filename(self):
#   def override_values(self):
# def is_config_flag(flag):  # pylint: disable=g-bad-name
#   def __init__(
#       self,
#       parser: flags.ArgumentParser,
#       path: str,
#       config: ml_collections.ConfigDict,
#       override_values: MutableMapping[str, Any]):
#   def __getattr__(self, attr):
#   def parse(self, argument):  # pylint: disable=invalid-name
#   def flag_type(self) -> str:
#   def syntactic_help(self) -> str:
# 
# Path: ml_collections/config_flags/tests/mock_config.py
# class TestConfig(object):
#   def __init__(self):
#   def readonly_field(self):
#   def __repr__(self):
# def get_config():


# Path: ml_collections/config_flags/tests/config_overriding_test.py
import copy
import shlex
import sys
import ml_collections
from absl import flags
from absl.testing import absltest
from absl.testing import flagsaver
from absl.testing import parameterized
from ml_collections.config_flags import config_flags
from ml_collections.config_flags.tests import mock_config

      return

    for attribute in keys:
      if isinstance(get_val(config1, attribute), _CHECK_TYPES):
        self.assertEqual(get_val(config1, attribute),
                         get_val(config2, attribute))
      else:
        # Try to go deeper with comparison
        self.assert_subset_configs(get_val(config1, attribute),
                                   get_val(config2, attribute))

  def assert_equal_configs(self, config1, config2):
    """Checks if two configs are identical."""
    self.assert_subset_configs(config1, config2)
    self.assert_subset_configs(config2, config1)  # pylint: disable=arguments-out-of-order


class ConfigFileFlagTest(_ConfigFlagTestCase, parameterized.TestCase):
  """Tests config flags library."""

  @parameterized.named_parameters(*_DASH_PARAMETERS)
  def testLoading(self, config_flag):
    """Tests loading config from file."""

    values = _parse_flags('./program {}'.format(config_flag),
                          default='nonexisting.py')

    self.assertIn('test_config', values)

    self.assert_equal_configs(values.test_config,

                              mock_config.get_config())