コード例 #1
0
ファイル: test_dynamicimport.py プロジェクト: iamjabour/smurf
    def test_dimport(self):
        """
        Test if dimport can import an existent class
        """
        p = dimport('eri.utils', 'ParseDom')

        # can statiate an object
        self.assert_(None != p)
コード例 #2
0
ファイル: corpus.py プロジェクト: iamjabour/smurf
    def __proof(self, name=False):
        """
        Create a proof instance and value with the needed proof

        @param conf: Dictionary with key metric
        @param eri: name of projet (default 'eri')
        """
        if name:
            return  dimport('eri', name)
        else:
            return TablesProof()
コード例 #3
0
ファイル: configurator.py プロジェクト: iamjabour/smurf
    def _create_marker(self, conf, eri):
        """
        Create a marker instace

        @param conf: Dictionary with key metric and value with the needed marker
        @param eri: name of projet (default 'eri')
        """
        if "marker" in conf:
            marker = dimport(eri, conf["marker"])
            return marker
        else:
            raise SystemExit, "Dont found marker in config file"
コード例 #4
0
ファイル: configurator.py プロジェクト: iamjabour/smurf
    def _create_metric(self, conf, eri="eri"):
        """
        Create a metric instance and value with the needed metric

        @param conf: Dictionary with key metric
        @param eri: name of projet (default 'eri')
        """
        if "metric" in conf:
            metric = dimport(eri, conf["metric"])
            return metric
        else:
            raise SystemExit, "Dont found metric in config file"
コード例 #5
0
ファイル: corpus.py プロジェクト: iamjabour/smurf
 def __parser(self, name=False):
     if name:
         return dimport('eri', name)
     else:
         return ParseDom()
コード例 #6
0
ファイル: benchmark.py プロジェクト: iamjabour/smurf
    (opt, args) = parser.parse_args()

    if len(sys.argv) < 3:
        raise SystemExit(parser.print_help())

    output = None

    if opt.output == 'stdout':
        output = sys.stdout
    else:
        output = open(opt.output, 'w')

    if opt.names:
        names = True
    else:
        names = False
    # importando o extrator dinamicamente
    m, c = args[0].split('.')
    extractor = dimport("eri.extractors.%s" % m.lower(), c)
    print 'benchmark'
    b = Benchmark(args[1], opt.config, [extractor], limit= opt.limit, output=output, pfilenames = names, initial= opt.init)

    if opt.verbose:
        b.process(debug=True)
    else:
        b.process()
    b.pprint()