from warnings import warn


def gan_args(parser):
    """This is a helper method of the method `parse_cmd_arguments` to add
    an argument group for options to configure the generator and discriminator
    network.

    .. deprecated:: 1.0
        Please use method :func:`main_net_args` and :func:`generator_args`
        instead.

    Args:
        parser: Object of class :class:`argparse.ArgumentParser`.

    Returns:
        The created argument group, in case more options should be added.
    """
    warn('Please use method "main_net_args" and "generator_args" instead.',
         DeprecationWarning)

    ### Training options.
    agroup = parser.add_argument_group('Generator and discriminator network ' +
                                       'options')
    for n, m in [('gen', 'generator'), ('dis', 'discriminator')]:
        agroup.add_argument('--%s_net_type' % n, type=str, default='fc',
                            help='Type of network to be used for the %s ' % m +
                                 'network. Default: %(default)s.',
                            choices=['fc'])
        agroup.add_argument('--%s_fc_arch' % n, type=str, default='100,100',
                            help='If using a "fc" %s network, this will ' % m +
                                 'specify the hidden layers. ' +
                                 'Default: %(default)s.')
        agroup.add_argument('--%s_net_act' % n, type=str, default='relu',
                            help='Activation function used in the %s network.' % m +
                                 'If "linear", no activation function is used. ' +
                                 'Default: %(default)s.',
                            choices=['linear', 'sigmoid', 'relu', 'elu'])
        agroup.add_argument('--%s_dropout_rate' % n, type=float, default=-1,
                            help='Use dropout in the %s with the given ' % m +
                                 'dropout probability (dropout is deactivated ' +
                                 'for a rate of -1). Default: %(default)s.')
        agroup.add_argument('--%s_batchnorm' % n, action='store_true',
                            help='Enable batchnorm in the %s.' % m)
        agroup.add_argument('--%s_specnorm' % n, action='store_true',
                            help='Enable spectral normalization in the %s.' % m)

    agroup.add_argument('--latent_dim', type=int, metavar='N', default=3,
                        help='Dimensionality of the latent vector (noise ' +
                             'input to the generator. Default: %(default)s.')
    agroup.add_argument('--latent_std', type=float, default=1.0,
                        help='Standard deviation of the latent space. ' +
                             'Default: %(default)s.')
    return agroup