Example #1
0
    def load(self):
        config = Config()
        short_options = "hdvo:f:b:a:e:p:m:u:l:c:x:w:s:z:r:n:idvo:tdvo"
        long_options = ["help", "debug", "verbose", "output=", "filtersdir=",
                        "pkgsfilter=", "axi=", "dde=", "popconindex=",
                        "popcondir=", "indexmode=", "clustersdir=",
                        "kmedoids=", "maxpopcon=", "weight=", "strategy=",
                        "profile_size=", "profiling=", "neighbors=", "init",
                        "train"]
        try:
            opts, args = getopt.getopt(sys.argv[1:], short_options,
                                       long_options)
            self.options = opts
        except getopt.GetoptError as error:
            config.set_logger()
            logging.error("Bad syntax: %s" % str(error))
            self.usage()
            sys.exit()

        for o, p in opts:
            if o in ("-h", "--help"):
                self.usage()
                sys.exit()
            elif o in ("-d", "--debug"):
                config.debug = 1
            elif o in ("-v", "--verbose"):
                config.verbose = 1
            elif o in ("-o", "--output"):
                config.output = p
            elif o in ("-f", "--filtersdir"):
                config.filters_dir = p
            elif o in ("-b", "--pkgsfilter"):
                config.pkgs_filter = p
            elif o in ("-a", "--axi"):
                config.axi = p
            elif o in ("-e", "--dde"):
                config.dde_url = p
            elif o in ("-p", "--popconindex"):
                config.popcon_index = p
            elif o in ("-m", "--popcondir"):
                config.popcon_dir = p
            elif o in ("-u", "--index_mode"):
                config.index_mode = p
            elif o in ("-l", "--clustersdir"):
                config.clusters_dir = p
            elif o in ("-c", "--kmedoids"):
                config.k_medoids = int(p)
            elif o in ("-x", "--max_popcon"):
                config.max_popcon = int(p)
            elif o in ("-w", "--weight"):
                config.weight = p
            elif o in ("-s", "--strategy"):
                config.strategy = p
            elif o in ("-z", "--profile_size"):
                config.profile_size = int(p)
            elif o in ("-z", "--profiling"):
                config.profiling = p
            elif o in ("-n", "--neighbors"):
                config.k_neighbors = int(p)
            elif o in ("-i", "--init"):
                continue
            elif o in ("-t", "--train"):
                continue
            else:
                assert False, "unhandled option"
Example #2
0
    def load(self):
        config = Config()
        short_options = "hdvo:f:b:a:e:p:m:u:l:c:x:w:s:z:r:n:idvo:tdvo"
        long_options = [
            "help", "debug", "verbose", "output=", "filtersdir=",
            "pkgsfilter=", "axi=", "dde=", "popconindex=", "popcondir=",
            "indexmode=", "clustersdir=", "kmedoids=", "maxpopcon=", "weight=",
            "strategy=", "profile_size=", "profiling=", "neighbors=", "init",
            "train"
        ]
        try:
            opts, args = getopt.getopt(sys.argv[1:], short_options,
                                       long_options)
            self.options = opts
        except getopt.GetoptError as error:
            config.set_logger()
            logging.error("Bad syntax: %s" % str(error))
            self.usage()
            sys.exit()

        for o, p in opts:
            if o in ("-h", "--help"):
                self.usage()
                sys.exit()
            elif o in ("-d", "--debug"):
                config.debug = 1
            elif o in ("-v", "--verbose"):
                config.verbose = 1
            elif o in ("-o", "--output"):
                config.output = p
            elif o in ("-f", "--filtersdir"):
                config.filters_dir = p
            elif o in ("-b", "--pkgsfilter"):
                config.pkgs_filter = p
            elif o in ("-a", "--axi"):
                config.axi = p
            elif o in ("-e", "--dde"):
                config.dde_url = p
            elif o in ("-p", "--popconindex"):
                config.popcon_index = p
            elif o in ("-m", "--popcondir"):
                config.popcon_dir = p
            elif o in ("-u", "--index_mode"):
                config.index_mode = p
            elif o in ("-l", "--clustersdir"):
                config.clusters_dir = p
            elif o in ("-c", "--kmedoids"):
                config.k_medoids = int(p)
            elif o in ("-x", "--max_popcon"):
                config.max_popcon = int(p)
            elif o in ("-w", "--weight"):
                config.weight = p
            elif o in ("-s", "--strategy"):
                config.strategy = p
            elif o in ("-z", "--profile_size"):
                config.profile_size = int(p)
            elif o in ("-z", "--profiling"):
                config.profiling = p
            elif o in ("-n", "--neighbors"):
                config.k_neighbors = int(p)
            elif o in ("-i", "--init"):
                continue
            elif o in ("-t", "--train"):
                continue
            else:
                assert False, "unhandled option"