Exemple #1
0
def main(args):
    try:
        FrontendConfiguration.parse_config(args)
    except InvalidPathException:
        print('Not a valid path to model or directory: "%s"!' %
              FrontendConfiguration.get_path())
        return
    # after all argument have been collected, start the actual processing
    process()
def main():
    """Returns the process exit code: 0 for success, > 0 for failure"""
    try:
        FrontendConfiguration.parse_config(sys.argv[1:])
    except InvalidPathException:
        print('Not a valid path to model or directory: "%s"!' % FrontendConfiguration.get_path())
        return 1
    # after all argument have been collected, start the actual processing
    return int(process())
Exemple #3
0
def main():
    """Returns the process exit code: 0 for success, > 0 for failure"""
    try:
        FrontendConfiguration.parse_config(sys.argv[1:])
    except InvalidPathException:
        print('Not a valid path to model or directory: "%s"!' %
              FrontendConfiguration.get_path())
        return 1
    # the default Python recursion limit is 1000, which might not be enough in practice when running an AST visitor on a deep tree, e.g. containing an automatically generated expression
    sys.setrecursionlimit(10000)
    # after all argument have been collected, start the actual processing
    return int(process())
Exemple #4
0
def main(args):
    try:
        FrontendConfiguration.config(args)
    except InvalidPathException:
        print('Not a valid path to model or directory: "%s"!' %
              FrontendConfiguration.get_path())
        return
    # init log dir
    create_report_dir()
    # The handed over parameters seem to be correct, proceed with the main routine
    init_predefined()
    # now proceed to parse all models
    compilation_units = list()
    for file in FrontendConfiguration.get_files():
        parsed_unit = ModelParser.parse_model(file)
        if parsed_unit is not None:
            compilation_units.append(parsed_unit)
    # generate a list of all neurons
    neurons = list()
    for compilationUnit in compilation_units:
        neurons.extend(compilationUnit.get_neuron_list())
    # check if across two files two neurons with same name have been defined
    CoCosManager.check_not_two_neurons_across_units(compilation_units)
    # now exclude those which are broken, i.e. have errors.
    if not FrontendConfiguration.is_dev():
        for neuron in neurons:
            if Logger.has_errors(neuron):
                code, message = Messages.get_neuron_contains_errors(
                    neuron.get_name())
                Logger.log_message(neuron=neuron,
                                   code=code,
                                   message=message,
                                   error_position=neuron.get_source_position(),
                                   log_level=LoggingLevel.INFO)
                neurons.remove(neuron)
    if not FrontendConfiguration.is_dry_run():
        analyse_and_generate_neurons(neurons)
        generate_nest_module_code(neurons)
    else:
        code, message = Messages.get_dry_run()
        Logger.log_message(neuron=None,
                           code=code,
                           message=message,
                           log_level=LoggingLevel.INFO)
    if FrontendConfiguration.store_log:
        store_log_to_file()
    return