コード例 #1
0
print(sys.version)
from config import Config


class ContextFilter(logging.Filter):
    def filter(self, record):
        if 'GET /socket.io/?EIO' in str(
                record) or 'POST /socket.io/?EIO' in str(record):
            return False
        else:
            return True


if Config.TEST_MODE:
    from testing import Test
    gogog = Test()
    gogog.start()

if __name__ == "__main__":
    from app import app
    from app.logconfig import handler
    logmehere = logging.getLogger('werkzeug')
    logmehere.addFilter(ContextFilter())
    logmehere.addHandler(handler)

    logging.getLogger('socketio').setLevel(logging.ERROR)
    logging.getLogger('engineio').setLevel(logging.ERROR)
    app.logger.error('bollocks')
    app.debug = True
    app.run(host='0.0.0.0',
            port=Config.PORT,
コード例 #2
0
 def print_commands(self, runpath='.'):
     test = Test(self.ymlfile, self.settings)
     test.print_commands(runpath)
コード例 #3
0
def main():
    my_test = Test("sampleGraph1.txt")
    my_test.do_everything()
コード例 #4
0
        torch.cuda.empty_cache()
        device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')
        print('device: {}'.format(device))
        train = Train(device)
        train.train_model(is_resume, epoch, file)

    if args.t:  # testing
        if args.f:
            file = args.f
        else:
            file = config.best_model

        torch.cuda.empty_cache()
        device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')
        print('device: {}'.format(device))
        test = Test(device)
        test.test_model(file)

    if args.e:  # rouge evaluation
        s_file = args.sf
        r_file = args.rf

        torch.cuda.empty_cache()
        device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')
        print('device: {}'.format(device))
        test = Evaluate(device)  # files to be pass here
        final = test.evaluate_summaries(config.s_summaries)

        # this gives size in kbs -- have to convert in bytes
    usage = resource.getrusage(resource.RUSAGE_SELF).ru_maxrss * 1024
    memory = get_size(usage)
コード例 #5
0
from testing import Test
from process_item_based import main_class
from process_profiles_item_based import processing

users_prefix = 'users/'
objects_prefix = 'objects/'

tmp = open(users_prefix + 'all.txt', 'r').read().split('\n')
tmp.remove('')
num_users = len(tmp)
tmp = open(objects_prefix + 'all.txt', 'r').read().split('\n')
tmp.remove('')
num_objects = len(tmp)
#use = Test(main_class(num_users, num_objects, 'generated_matrix.txt'))
use = Test(processing())
use.test_object.init_all_profiles()
for obj in use.test_object.objects:
    use.test_object.init_sims(obj)
max_sim = -500.
for i in use.test_object.sims:
    for j in use.test_object.sims[i]:
        if j > max_sim:
            max_sim = j
print(use.test_on_all())
コード例 #6
0
ファイル: strace.py プロジェクト: nushrathumaira/cs537-1
 def startexe(self, name, args, libs = None):
    path = self.project_path + "/" + name
    st_args = (["-o", self.project_path + "/" + name +".strace"] +
          [path] + args)
    print st_args
    return Test.startexe(self, "strace", st_args, libs, path="strace")
コード例 #7
0
ファイル: testcommand.py プロジェクト: gijskant/mcrl2-pmc
 def print_commands(self, runpath="."):
     test = Test(self.ymlfile, self.settings)
     test.print_commands(runpath)
コード例 #8
0
        ouedknissSelectors = selectorsJson.get('ouedkniss')
        jumiaSelectors = selectorsJson.get('jumia')
        hanoutDzSelectors = selectorsJson.get('hanoutDz')

    item.containerSelector = ouedknissSelectors['containerSelector']
    item.titleSelector = ouedknissSelectors['titleSelector']
    item.detailsLink = ouedknissSelectors['detailsLink']
    item.descriptionSelector = ouedknissSelectors['descriptionSelector']
    item.priceSelector = ouedknissSelectors['priceSelector']
    item.imageSelector = ouedknissSelectors['imageSelector']

    urls = [
        "https://www.ouedkniss.com/cosmetiques/1",
        "https://www.ouedkniss.com/telephones/1"
    ]
    test = Test(website, page, ouedKniss, item)
    data = test.start_consecutive(1, 3)
    #data = test.start_non_consecutive([1,3,4])
    #data = test.start_to_end(10)
    #data = test.start_with_urls(urls,ouedKniss)
    save = Save(data)
    save.to_json()
    save.to_csv()
    '''
    # jumia test
    website = WebSite('jumia','https://www.jumia.dz/','e-commerce web site')
    page = Page("https://www.jumia.dz/telephones-smartphones/")
    jumia = Jumia()
    item = Items()

    item.containerSelector = jumiaSelectors['containerSelector']
コード例 #9
0
from testing import Test
from process import main_class

users_prefix = 'users/'
objects_prefix = 'objects/'

tmp = open(users_prefix + 'all.txt', 'r').read().split('\n')
tmp.remove('')
num_users = len(tmp)
#print (num_users)
tmp = open(objects_prefix + 'all.txt', 'r').read().split('\n')
tmp.remove('')
num_objects = len(tmp)
#print (num_objects)
#use = main_class(num_users, num_objects, 'generated_matrix.txt')
use = Test(main_class(num_users, num_objects, 'generated_matrix.txt'))
print(use.test_on_all())
コード例 #10
0
 def print_commands(self, working_directory ='.', no_paths = False):
     test = Test(self.ymlfile, self.settings)
     test.print_commands(working_directory, no_paths)