Returns linguist args from model args.
164230
def get_translation_args(self, args):
        
        translation_args = []
        for arg in args:
            condition = self._get_linguist_condition(arg, transform=True)
            if condition:
                translation_args.append(condition)
        return translation_args
991765
def has_linguist_args(self, args):
        
        linguist_args = []
        for arg in args:
            condition = self._get_linguist_condition(arg)
            if condition:
                linguist_args.append(condition)
        return bool(linguist_args)
1312452
def get_args():
    
    parser = argparse.ArgumentParser("FashionMNIST")
    parser.add_argument("--batch_size", type=int, default=128, help="batch size")
    parser.add_argument("--optimizer", type=str, default="SGD", help="optimizer")
    parser.add_argument("--epochs", type=int, default=200, help="epoch limit")
    parser.add_argument(
        "--learning_rate", type=float, default=0.001, help="learning rate"
    )
    parser.add_argument("--cutout", action="store_true", default=False, help="use cutout")
    parser.add_argument("--cutout_length", type=int, default=8, help="cutout length")
    parser.add_argument(
        "--model_path", type=str, default="./", help="Path to save the destination model"
    )
    return parser.parse_args()
299871
def get_args(self, kwargs):
        """"""
        args = dict(self.LoggerArgs)
        args.update(kwargs)
        return args
146443
def argnames(self):
        
        # pylint: disable=no-member; github.com/pycqa/astroid/issues/291
        # args is in fact redefined later on by postinit. Can't be changed
        # to None due to a strong interaction between Lambda and FunctionDef.

        if self.args.args:  # maybe None with builtin functions
            names = _rec_get_names(self.args.args)
        else:
            names = []
        if self.args.vararg:
            names.append(self.args.vararg)
        if self.args.kwarg:
            names.append(self.args.kwarg)
        return names
591882
def getargs():
    from argparse import ArgumentParser
    '''
    
    '''
    parser = ArgumentParser(description='Answer yes or no to a question.')
    parser.add_argument("question", type=str, help="A question to ask.")
    return parser.parse_args()
181505
def get_languages_from_model(app_label, model_label):
        
        try:
            mod_lan = TransModelLanguage.objects.filter(model='{} - {}'.format(app_label, model_label)).get()
            languages = [lang.code for lang in mod_lan.languages.all()]
            return languages
        except TransModelLanguage.DoesNotExist:
            return []
396720
def parse_args():
    """"""

    parser = get_parser()

    if len(sys.argv) < 2:
        parser.print_help()
        warnings.warn('Too few arguments!', UserWarning)
        parser.exit(1)

    # parsing
    try:
        params = parser.parse_args()
    except Exception as exc:
        print(exc)
        raise ValueError('Unable to parse command-line arguments.')

    in_features_path = os.path.abspath(params.in_features_path)
    if not os.path.exists(in_features_path):
        raise IOError("Given features file doesn't exist.")

    groups_path = os.path.abspath(params.groups_path)
    if not os.path.exists(groups_path):
        raise IOError("Given groups file doesn't exist.")

    return in_features_path, groups_path, params.weight_method, params.num_bins, params.edge_range, \
           params.trim_outliers, params.trim_percentile, params.return_networkx_graph, params.out_weights_path
74423
def get_parser():
    """"""
    from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter
    parser = ArgumentParser(description=__doc__,
                            formatter_class=ArgumentDefaultsHelpFormatter)
    parser.add_argument("-m", "--model",
                        dest="model",
                        help="where is the model folder (with a info.yml)?",
                        metavar="FOLDER",
                        type=lambda x: utils.is_valid_folder(parser, x),
                        default=utils.default_model())
    return parser
827640
def get_args(self):
        
        return [
            self.task_cls.__module__,
            self.task_cls.__name__,
            self.encode_list(self.task_params),
            self.encode_list(self.branches),
            self.encode_bool(self.auto_retry),
            self.encode_list(self.dashboard_data),
        ]
76222
def parse_args():
    """"""
    parser = argparse.ArgumentParser(description='train an image classifier on mnist')
    parser.add_argument('--network', type=str, default='lenet',
                        help='the cnn to use (mlp | lenet | <path to network json file>')
    parser.add_argument('--caffe-loss', type=int, default=0,
                        help='Use CaffeLoss symbol')
    parser.add_argument('--caffe-data', action='store_true',
                        help='Use Caffe input-data layer only if specified')
    parser.add_argument('--data-dir', type=str, default='mnist/',
                        help='the input data directory')
    parser.add_argument('--gpus', type=str,
                        help='the gpus will be used, e.g "0,1,2,3"')
    parser.add_argument('--num-examples', type=int, default=60000,
                        help='the number of training examples')
    parser.add_argument('--batch-size', type=int, default=128,
                        help='the batch size')
    parser.add_argument('--lr', type=float, default=.1,
                        help='the initial learning rate')
    parser.add_argument('--model-prefix', type=str,
                        help='the prefix of the model to load/save')
    parser.add_argument('--save-model-prefix', type=str,
                        help='the prefix of the model to save')
    parser.add_argument('--num-epochs', type=int, default=10,
                        help='the number of training epochs')
    parser.add_argument('--load-epoch', type=int,
                        help="load the model on an epoch using the model-prefix")
    parser.add_argument('--kv-store', type=str, default='local',
                        help='the kvstore type')
    parser.add_argument('--lr-factor', type=float, default=1,
                        help='times the lr with a factor for every lr-factor-epoch epoch')
    parser.add_argument('--lr-factor-epoch', type=float, default=1,
                        help='the number of epoch to factor the lr, could be .5')
    return parser.parse_args()
1117121
def parse_args():
    """"""
    parser = argparse.ArgumentParser()
    parser.add_argument("font_path", help="Path to ttf font file or directory containing ttf files")
    parser.add_argument("--loss", help="'ctc' or 'warpctc' loss [Default 'ctc']", default='ctc')
    parser.add_argument("--cpu",
                        help="Number of CPUs for training [Default 8]. Ignored if --gpu is specified.",
                        type=int, default=8)
    parser.add_argument("--gpu", help="Number of GPUs for training [Default 0]", type=int)
    parser.add_argument("--num_proc", help="Number CAPTCHA generating processes [Default 4]", type=int, default=4)
    parser.add_argument("--prefix", help="Checkpoint prefix [Default 'ocr']", default='ocr')
    return parser.parse_args()
1344298
def getArguments(parser):
    ""
    args = parser.parse_args()
    
    # check mutual exlusive and reaquired arguments
    if args.lmodel and args.smodel:
        parser.error('only one of --load-model and --save-model can be supplied, as they decide on whether to apply the application or the training mode')
    if not args.lmodel and not args.smodel:
        parser.error('exactly one of --load-model or --save-model has to be supplied')
    
    # application mode
    if args.lmodel:
        if not os.path.isfile(args.lmodel):
            parser.error('the supplied model file {} does not exist'.format(args.lmodel))
        if not args.simages:
            parser.error('--save-images must be supplied when running the application mode')
    
    # training mode
    if args.smodel:
        if not args.landmarkp in ('L2', 'L3', 'L4'):
            args.landmarkp = sequenceOfIntegersGeAscendingStrict(args.landmarkp)
        if not 'auto' == args.stdspace:
            args.stdspace = sequenceOfIntegersGeAscendingStrict(args.stdspace)
        if not args.force and os.path.isfile(args.smodel):
            parser.error('the target model file {} already exists'.format(args.smodel))
        
    # others
    if args.simages:
        if not os.path.isdir(args.simages):
            parser.error('--save-images must be a valid directory')
    if args.masks and len(args.masks) != len(args.images):
        parser.error('the same number of masks must be passed to --masks as images have been supplied') 
    
    return args
1160036
def get_args_parser():
    """"""
    parser = argparse.ArgumentParser(
        description='Marabunta: Migrating ants for Odoo')
    parser.add_argument('--migration-file', '-f',
                        action=EnvDefault,
                        envvar='MARABUNTA_MIGRATION_FILE',
                        required=True,
                        help='The yaml file containing the migration steps')
    parser.add_argument('--database', '-d',
                        action=EnvDefault,
                        envvar='MARABUNTA_DATABASE',
                        required=True,
                        help="Odoo's database")
    parser.add_argument('--db-user', '-u',
                        action=EnvDefault,
                        envvar='MARABUNTA_DB_USER',
                        required=True,
                        help="Odoo's database user")
    parser.add_argument('--db-password', '-w',
                        action=EnvDefault,
                        envvar='MARABUNTA_DB_PASSWORD',
                        required=True,
                        help="Odoo's database password")
    parser.add_argument('--db-port', '-p',
                        default=os.environ.get('MARABUNTA_DB_PORT', 5432),
                        help="Odoo's database port")
    parser.add_argument('--db-host', '-H',
                        default=os.environ.get('MARABUNTA_DB_HOST',
                                               'localhost'),
                        help="Odoo's database host")
    parser.add_argument('--mode',
                        action=EnvDefault,
                        envvar='MARABUNTA_MODE',
                        required=False,
                        help="Specify the mode in which we run the migration,"
                             "such as 'demo' or 'prod'. Additional operations "
                             "of this mode will be executed after the main "
                             "operations and the addons list of this mode "
                             "will be merged with the main addons list.")
    parser.add_argument('--allow-serie',
                        action=BoolEnvDefault,
                        required=False,
                        envvar='MARABUNTA_ALLOW_SERIE',
                        help='Allow to run more than 1 version upgrade at a '
                             'time.')
    parser.add_argument('--force-version',
                        required=False,
                        default=os.environ.get('MARABUNTA_FORCE_VERSION'),
                        help='Force upgrade of a version, even if it has '
                             'already been applied.')

    group = parser.add_argument_group(
        title='Web',
        description='Configuration related to the internal web server, '
                    'used to publish a maintenance page during the migration.',
    )
    group.add_argument('--web-host',
                       required=False,
                       default=os.environ.get('MARABUNTA_WEB_HOST', '0.0.0.0'),
                       help='Host for the web server')
    group.add_argument('--web-port',
                       required=False,
                       default=os.environ.get('MARABUNTA_WEB_PORT', 8069),
                       help='Port for the web server')
    group.add_argument('--web-custom-html',
                       required=False,
                       default=os.environ.get(
                           'MARABUNTA_WEB_CUSTOM_HTML'
                       ),
                       help='Path to a custom html file to publish')
    return parser
724784
def get_model_string(model_name):
    
    setting_name = "LINGUIST_%s_MODEL" % model_name.upper().replace("_", "")
    class_path = getattr(settings, setting_name, None)
    if not class_path:
        return "linguist.%s" % model_name
    elif isinstance(class_path, basestring):
        parts = class_path.split(".")
        try:
            index = parts.index("models") - 1
        except ValueError:
            raise exceptions.ImproperlyConfigured(
                CLASS_PATH_ERROR % (setting_name, setting_name)
            )
        app_label, model_name = parts[index], parts[-1]
    else:
        try:
            class_path, app_label = class_path
            model_name = class_path.split(".")[-1]
        except:
            raise exceptions.ImproperlyConfigured(
                CLASS_PATH_ERROR % (setting_name, setting_name)
            )
    return "%s.%s" % (app_label, model_name)
914203
def get_args(args, kwargs, arg_names):
    '''
    '''
    n_args = len(arg_names)
    if len(args) + len(kwargs) > n_args:
        raise MoultScannerError('Too many arguments supplied. Expected: {}'.format(n_args))

    out_args = {}
    for i, a in enumerate(args):
        out_args[arg_names[i]] = a

    for a in arg_names:
        if a not in out_args:
            out_args[a] = None

    out_args.update(kwargs)
    return out_args
239732
def _get_func_args(func):
    """"""
    if isinstance(func, functools.partial):
        return _get_func_args(func.func)
    if inspect.isfunction(func) or inspect.ismethod(func):
        return list(inspect.getargspec(func).args)
    if callable(func):
        return list(inspect.getargspec(func.__call__).args)