def main():
    """test logic for when running this module as the primary one!"""

    ## pass the namespace you test again (your dev namespace or production)
    test_namespace = 'ibelyaev-dev'

    #search test case
    args = {'experimentID': '106', 'platformID':'84', 'metaboliteID':'4349', '_url': 'https://api.araport.org/community/v0.3', '_namespace': test_namespace}
    driver.search(args)
    
    # list test case
    args = {'experimentID': '106', 'platformID':'84', '_url': 'https://api.araport.org/community/v0.3', '_namespace': test_namespace}
    driver.list(args)
def test():
    testQuery = "AT5G01010"
    #testQuery = "AT2G01008"
    #testQuery = "AT3G01010"
    #testQuery = "AT4G00005"
    #testQuery = "AT5G01010"

    for i in range(0,5):
        start_time = time.time()
        print "Current date "  + time.strftime("%x")
        print "Current time " + time.strftime("%X")
        main.search(testQuery)
        print("--- %s seconds ---" % (time.time() - start_time))
        print(".")
        time.sleep(5)
def main():
    """test logic for when running this module as the primary one!"""

    ## pass the namespace you test again (your dev namespace or production)
    test_namespace = 'ibelyaev-dev'

    #search
    args = {'experimentID': '106', 'platformID':'100', '_url': 'https://api.araport.org/community/v0.3', '_namespace': test_namespace}
    driver.search(args)
    param_map = rb.build_param_map(args, 'search')
    log.info("Param Map:")
    log.info(param_map)

    # list
    args = {'experimentID': '106', '_url': 'https://api.araport.org/community/v0.3', '_namespace': test_namespace}
    driver.list(args)
Пример #4
0
def fetch(entries):
    global display

    info=list()
    for entry in entries:
        info.append(entry[1].get())
    age=int(info[0])
    pincodes=list()
    pincodes.append(info[1])
    num_days=int(info[2])
    try:
        display=main.search(age,pincodes,num_days)
        text_area.config(state='normal')
        if len(display)>0:
            text_area.delete("1.0",tk.END)
            for detail in display:
                s=f"Pincode: {detail['pincode']} \n Available on: {detail['given_date']} \n {detail['center_name']} \n {detail['block_name']} \n Price:  {detail['fee_type']} \n Availability :  {detail['availability']}\n"
                if detail['Vaccine']!='':
                    s+=f"Vaccine Type: {detail['Vaccine']}\n"
                text_area.insert(tk.INSERT,s)
        else:
            text_area.delete("1.0",tk.END)
            s="No Vaccine slots available."
            text_area.insert(tk.INSERT,s)
        text_area.config(state='disabled')
    except Exception:
        messagebox.showerror('Error','Check your connection')
Пример #5
0
def update_page(n_clicks, value, options):
    if (n_clicks != 0):
        results = main.search(value)
        noptions = options
        for i in results:
            noptions.append({"label": i, "value": i})
        print(noptions)
        return noptions, noptions[0]["label"]
Пример #6
0
def requestStock():
    text = request.form['sname']
    stockName = text.upper()
    print(stockName)
    if (search(stockName)):
        return displayStock(stockName)
    else:
        return predictStock(stockName)
Пример #7
0
def get_most_artists(USER_ID_INPUT):
    #user = '******'
    user = USER_ID_INPUT
    playlists = sp.user_playlists(user)

    # COUNT MOSTLY ACCURING ARTIST
    arts = []
    if (playlists['items'] == None):
        return ""
    for i, pla in enumerate(playlists['items']):
        pl_id = pla['id']
        artist_names = sp.playlist_items(playlist_id=pl_id,
                                         fields='items.track.artists.name',
                                         additional_types=['track'])['items']
        for artist in artist_names:
            if (artist['track'] == None):
                continue
            len_arts = len(artist['track']['artists'])
            for j in range(0, len_arts):
                arts.append(artist['track']['artists'][j]['name'])

    unsorted_count_songs = dict((x, arts.count(x)) for x in set(arts))
    sort_descending = dict(
        sorted(unsorted_count_songs.items(),
               key=operator.itemgetter(1),
               reverse=True))
    get_sum = sum(sort_descending.values())

    for key, val in sort_descending.items():
        sort_descending[key] = round((val * 100.0 / get_sum), 2)
    result = dict(itertools.islice(sort_descending.items(), 5))

    i = 1
    user_name = sp.user(user)['display_name']
    status = "Hey " + user_name + "! Here are your top 5 playlist-artists:\n"
    print(status)
    for key in result.keys():
        if i == 1:
            mk.search(key)
        status += str(i) + "-" + key + "- " + str(result[key]) + "%\n"
        i += 1
    return status
Пример #8
0
	def post(self):
		url = cgi.escape(self.request.get('url'))
		term = cgi.escape(self.request.get('term'))
		results = main.search(url, term)
		template_values = {
			'url':url,
			'term':term,
			'results':results
		}
		path = os.path.join(os.path.dirname(__file__), 'result.html')
		self.response.out.write(template.render(path, template_values))
Пример #9
0
def divide():
    form = UrlLink()
    morseCode = None
    if form.validate_on_submit():
        text = form.searchbox.data
        law = search(text)
        morseCode = convertToMorseCode(law)

    else:
        print("not here")

    return render_template('index.html', form=form, morsecode=morseCode)
Пример #10
0
def test_search(tree_path: str, value: int, result, my_exception):
    if my_exception is None:  # Revisar resultado
        try:
            return search(tree_path, value) == result
        except Exception as e:
            print(e)
            return False

    try:
        search(tree_path, value)
        return False
    except my_exception as e:
        if isinstance(my_exception, NotFoundValue):
            return tree_path == e.path
        elif isinstance(my_exception, InvalidTree):
            with open(tree_path) as file:
                tree = load(file)
            return tree["value"] == e.tree
        return True
    except Exception as e:
        print(e)
        return False
Пример #11
0
def submit_search():
    if request.method == "GET":
        user_input = request.args["search_bar"]
        urls = search(str(user_input))
    return render_template('img_search.html',
                           image_url0=assign_if_exist(0, urls),
                           image_url1=assign_if_exist(1, urls),
                           image_url2=assign_if_exist(2, urls),
                           image_url3=assign_if_exist(3, urls),
                           image_url4=assign_if_exist(4, urls),
                           image_url5=assign_if_exist(5, urls),
                           image_url6=assign_if_exist(6, urls),
                           image_url7=assign_if_exist(7, urls))
Пример #12
0
 def test_search2(self):
     args = 'to choose'
     res = json.loads(main.search(args))
     self.assertTrue('jobs' in res)
     if len(res['jobs']) > 0:
         self.assertTrue(
             re.search(args, json.dumps(res['jobs'][0]), re.IGNORECASE))
     elif len(res['courses']) > 0:
         self.assertTrue(
             re.search(args, json.dumps(res['courses'][0]), re.IGNORECASE))
     elif len(res['subjects']) > 0:
         self.assertTrue(
             re.search(args, json.dumps(res['subjects'][0]), re.IGNORECASE))
     else:
         self.assertTrue(False)
Пример #13
0
def get_frame():
    # 接收图片
    upload_file = request.files['file']
    print(upload_file)
    if upload_file:
        start = time.time()
        _, fc_feat, _ = predict(upload_file)
        logging.info(f"Predict cost time: {time.time()-start:0.2f}")
        start = time.time()
        res = search(images, fc_feat)
        logging.info(f"Search cost time: {time.time()-start:0.2f}")

        return flask.jsonify({'res': res})
    else:
        return "No File"
Пример #14
0
    def build_list(self):

        #set the dictionary values
        tool_dict = Toolbar.build_dict(self)

        #set the list based on dictionary values
        time1 = time.time()
        tool_list = main.search(tool_dict)
        time2 = time.time()
        print("Function return time: " + str(time2 - time1) + " s")

        print(tool_list)

        #send list back to the main function
        Screen.set_list(tool_list)
Пример #15
0
    def run_program(self, event):
        frame = SecondFrame()
        keyword = self.search_name.GetValue()

        if not keyword:
            box = wx.MessageDialog(None, 'Search Term Not Mentioned',
                                   'Ivalid Request', wx.OK)
            answer = box.ShowModal()
            box.Destroy()

        # getting files list from the file dialog
        files_list = []
        for file_path in self.fileCtrl:
            files_list.append(file_path.GetPath())
        files_list = filter(None, files_list)
        print
        files_list

        # getting folders list from the folder dialog
        folders_list = []
        for folder_path in self.folderCtrl:
            folders_list.append(folder_path.GetPath())
        folders_list = filter(None, folders_list)
        print
        folders_list

        # getting the files list from the folders given
        if folders_list:
            files_list = self.getFilesFromFolder(folders_list, files_list)

        # sending the data to main.py
        if files_list:
            files_with_word, freq = main.search(keyword, files_list)
            frame.get_results_from_search(files_with_word, freq)
            frame.Show()
        else:
            box = wx.MessageDialog(None, 'Files not mentioned',
                                   'Invalid Request', wx.OK)
            answer = box.ShowModal()
            box.Destroy()
Пример #16
0
    def run_program(self, event):
        frame = SecondFrame()
        keyword =  self.search_name.GetValue()

        if not keyword:
            box = wx.MessageDialog(None, 'Search Term Not Mentioned', 'Ivalid Request', wx.OK)
            answer = box.ShowModal()
            box.Destroy()

        #getting files list from the file dialog
        files_list = []
        for file_path in self.fileCtrl:
            files_list.append(file_path.GetPath())
        files_list = filter(None, files_list)
        print files_list

        #getting folders list from the folder dialog
        folders_list = []
        for folder_path in self.folderCtrl:
            folders_list.append(folder_path.GetPath())
        folders_list = filter(None, folders_list)
        print folders_list

        #getting the files list from the folders given
        if folders_list:
            files_list = self.getFilesFromFolder(folders_list, files_list)
        
        #sending the data to main.py
        if files_list:
            files_with_word, freq = main.search(keyword, files_list)
            frame.get_results_from_search(files_with_word, freq)
            frame.Show()
        else:
            box = wx.MessageDialog(None, 'Files not mentioned', 'Invalid Request', wx.OK)
            answer = box.ShowModal()
            box.Destroy()
Пример #17
0
import asyncio
from asyncio import ensure_future
from main import lucas, is_prime, search
from futures import twelve_digits_prime, monitor_future

# TASK - a subclass of Future which wraps a coroutine (wtf?)
# Task is-a Future
# Task has/contains a coroutine

# #1. Version with 'create_task' function

# loop = asyncio.get_event_loop()
# co_obj = search(lucas(), twelve_digits_prime)
# search_task = loop.create_task(co_obj)
# loop.create_task(monitor_future(search_task, 1))
# loop.run_until_complete(search_task)
# print(search_task.result())
# loop.close()

# #2. Version with 'ensure_future' function
if __name__ == '__main__':
    search_task = ensure_future(search(lucas(), twelve_digits_prime))
    monitor_task = ensure_future(monitor_future(search_task, 1))

    search_and_monitor_future = asyncio.gather(search_task, monitor_task)

    loop = asyncio.get_event_loop()
    loop.run_until_complete(search_and_monitor_future)
    print(search_task.result())
    loop.close()
Пример #18
0
def searchQuery(query):
	app.logger.debug("Query - " + query)
	#response.headers.add('content-type', "application/json")
	return (json.dumps(main.search(query)), 200, {'content-type': "application/json"})
Пример #19
0
def test_search():
    file = open('studentList.txt', 'r')
    output = main.search(str(102), file)
    assert print("Record Found\nRoll.No: 102\nName:Sunny") == output
    file.close()
Пример #20
0
 def test_one(self):
     assert search(sorted(["123","234","124"]), "12") == ["123","124"]
Пример #21
0
 def test_search1(self):
     args = 'please-return-no-results-8y56VS^VSd65sdE'
     res = main.search(args)
     self.assertTrue(len(res) > 0)
Пример #22
0
        while (len(self.opened.queue)):
            self.closed.add(current)
            current = self.opened.delete()
            self.maze.matrix[current.x][current.y] = 3
            self.walkTo(current)
            if (current.x == self.mazeEnd.x and current.y == self.mazeEnd.y):
                return self.getPath()


maze = m.main()
global w
w = m.wall()
global f
f = m.floor()
global s
s = m.search()
global p
p = m.path()

global wn

wn = turtle.Screen()
wn.bgcolor("black")
wn.screensize(1000, 1000)
wn.title("A STAR MAZE SOLVER")
for y in range(maze.row):
    for x in range(maze.col):
        character = maze.matrix[y][x]
        screen_x = -400 + (x * 24)
        screen_y = 400 - (y * 24)
Пример #23
0
def test_answer():
    assert (search([0, 1, 2], 1)) == solved_search([0, 1, 2], 1)
    assert (search([1, 2, 3], 2)) == solved_search([0, 1, 2], 2)
    assert (search([1, 2, 3], 3)) == solved_search([0, 1, 2], 3)
Пример #24
0
def search(**kwargs):
    '''Searches for a contact and returns one based on contact name'''
    click.echo(main.search(kwargs['name']))
Пример #25
0
 def test_search_5_some_result(self):
 	self.assertTrue(True)
 	searcher = search(generate_linear_sequence(), lambda vertex: vertex.value >= 5)
 	print([item for item in searcher])
Пример #26
0
 def test_search3(self):
     args = '\''
     res = main.search(args)
     self.assertTrue(args in res)
Пример #27
0
 def test_quickcheck(self,spisok, string):
     result = search(sorted(spisok),string)
     for i in result:
         assert (str(i)[:len(string)]==string)
     assert (len(result) <= 10)
Пример #28
0
 def test_two(self):
     assert search(sorted(["123", "234", "124","2355", "235341658","752","72","237589"]), "23") == ["234", "235341658","2355","237589"]
Пример #29
0
def test_search_element():
    file = open('studentList.txt', 'r')
    output = main.search(str(101), file)
    assert print("Record Found\nRoll.No: 101\nName:Harshitha") == output
    file.close()
Пример #30
0
async def scrape_record(site: Site, command: Command, term: SearchTerms, value):
    return search(site.value, command.value, term.value, value)
Пример #31
0
 def test_type_error(self):
     with pytest.raises(TypeError):
         search('ololo',123)
Пример #32
0
 def searchbt():
     site = str(searche1.get()).lower()
     user, passw = main.search(site)
     messagebox.showinfo("Success!", "Username is "+user+"\nPassword is "+passw)
     wins.destroy()
Пример #33
0
    print return_value[0]
    after_correction.append(return_value[0])
    time_p += return_value[1]

print '\ninput  : ', text
print '\noutput : ', ' '.join(after_correction)
print '\n\ntotal time for parallel ( without streams ) : ', time_p

after_correction = []

time_p = 0.0000

print '\n------- with CUDA streams -------'

for word in word_list:
    return_value = main.search(word)
    print return_value[0]
    after_correction.append(return_value[0])
    time_p += return_value[1]

print '\ninput  : ', text
print '\noutput : ', ' '.join(after_correction)
print '\n\ntotal time for parallel ( with streams ) : ', time_p

print '\n------- sequential program -------'

after_correction = []

ran = 0
start = time.time()
Пример #34
0
 def test_empty(self):
     assert search([],"1") == []
Пример #35
0
def search_image(image_name):
    stats = search(image_name)
    return jsonify(stats[:4])
Пример #36
0
def searchQuery(query):
    app.logger.debug("Query - " + query)
    #response.headers.add('content-type', "application/json")
    return (json.dumps(main.search(query)), 200, {
        'content-type': "application/json"
    })