How to use free method in keyboard

Best Python code snippet using keyboard

core.py

Source:core.py Github

copy

Full Screen

1#!/usr/bin/env python2# stdlib imports3import os4import logging5import glob6# third party7from obspy.core.stream import read8from obspy import read_inventory9# local imports10from gmprocess.stationtrace import StationTrace11from gmprocess.stationstream import StationStream12from gmprocess.io.seedname import get_channel_name, is_channel_north13IGNORE_FORMATS = ['KNET']14# Bureau of Reclamation has provided a table of location codes with15# associated descriptions. We are using this primarily to determine whether16# or not the sensor is free field. You may notice that the17# "Down Hole Free Field"18# code we have marked as *not* free field, since borehole sensors do not match19# our definition of "free field".20RE_NETWORK = {21 '10': {'description': 'Free field (rock) in vicinity of crest/toe area', 'free_field': True},22 '11': {'description': 'Free field (Left Abutment) either crest or toe', 'free_field': True},23 '12': {'description': 'Free field (Right Abutment) either crest or toe', 'free_field': True},24 '13': {'description': 'Free field (water) (Towards Left Abutment)', 'free_field': False},25 '14': {'description': 'Free field (water) (Towards Right Abutment)', 'free_field': False},26 '20': {'description': 'Toe (center)', 'free_field': False},27 '21': {'description': 'Toe (Left Abutment)', 'free_field': False},28 '22': {'description': 'Toe (Right Abutment)', 'free_field': False},29 '23': {'description': 'Toe (Towards Left Abutment)', 'free_field': False},30 '24': {'description': 'Toe (Towards Right Abutment)', 'free_field': False},31 '30': {'description': 'Crest (center)', 'free_field': False},32 '31': {'description': 'Crest (Left Abutment)', 'free_field': False},33 '32': {'description': 'Crest (Right Abutment)', 'free_field': False},34 '33': {'description': 'Crest (Towards Left Abutment)', 'free_field': False},35 '34': {'description': 'Crest (Towards Right Abutment)', 'free_field': False},36 '40': {'description': 'Foundation (center)', 'free_field': False},37 '41': {'description': 'Foundation (Left Abutment)', 'free_field': False},38 '42': {'description': 'Foundation (Right Abutment)', 'free_field': False},39 '43': {'description': 'Foundation (Towards Left Abutment)', 'free_field': False},40 '44': {'description': 'Foundation (Towards Right Abutment)', 'free_field': False},41 '50': {'description': 'Body (center)', 'free_field': False},42 '51': {'description': 'Body (Left Abutment)', 'free_field': False},43 '52': {'description': 'Body (Right Abutment)', 'free_field': False},44 '53': {'description': 'Body (Towards Left Abutment)', 'free_field': False},45 '54': {'description': 'Body (Towards Right Abutment)', 'free_field': False},46 '60': {'description': 'Down Hole Upper Body', 'free_field': False},47 '61': {'description': 'Down Hole Mid Body', 'free_field': False},48 '62': {'description': 'Down Hole Foundation', 'free_field': False},49 '63': {'description': 'Down Hole Free Field', 'free_field': False},50}51LOCATION_CODES = {'RE': RE_NETWORK}52def _get_station_file(filename, stream):53 filebase, fname = os.path.split(filename)54 network = stream[0].stats.network55 station = stream[0].stats.station56 pattern = '%s.%s.xml' % (network, station)57 xmlfiles = glob.glob(os.path.join(filebase, pattern))58 if len(xmlfiles) != 1:59 return 'None'60 xmlfile = xmlfiles[0]61 return xmlfile62def is_fdsn(filename):63 """Check to see if file is a format supported by Obspy (not KNET).64 Args:65 filename (str): Path to possible Obspy format.66 Returns:67 bool: True if obspy supported, otherwise False.68 """69 logging.debug("Checking if format is Obspy.")70 if not os.path.isfile(filename):71 return False72 try:73 stream = read(filename)74 if stream[0].stats._format in IGNORE_FORMATS:75 return False76 xmlfile = _get_station_file(filename, stream)77 if not os.path.isfile(xmlfile):78 return False79 return True80 except Exception:81 return False82 return False83def read_fdsn(filename):84 """Read Obspy data file (SAC, MiniSEED, etc).85 Args:86 filename (str):87 Path to data file.88 kwargs (ref):89 Other arguments will be ignored.90 Returns:91 Stream: StationStream object.92 """93 logging.debug("Starting read_fdsn.")94 if not is_fdsn(filename):95 raise Exception('%s is not a valid Obspy file format.' % filename)96 streams = []97 tstream = read(filename)98 xmlfile = _get_station_file(filename, tstream)99 inventory = read_inventory(xmlfile)100 traces = []101 for ttrace in tstream:102 trace = StationTrace(data=ttrace.data,103 header=ttrace.stats,104 inventory=inventory)105 location = ttrace.stats.location106 trace.stats.channel = get_channel_name(107 trace.stats.sampling_rate,108 trace.stats.channel[1] == 'N',109 inventory.get_orientation(trace.id)['dip'] in [90, -90] or110 trace.stats.channel[2] == 'Z',111 is_channel_north(inventory.get_orientation(trace.id)['azimuth']))112 if trace.stats.location == '':113 trace.stats.location = '--'114 network = ttrace.stats.network115 if network in LOCATION_CODES:116 codes = LOCATION_CODES[network]117 if location in codes:118 sdict = codes[location]119 if sdict['free_field']:120 trace.stats.standard.structure_type = 'free_field'121 else:122 trace.stats.standard.structure_type = sdict['description']123 head, tail = os.path.split(filename)124 trace.stats['standard']['source_file'] = tail or os.path.basename(head)125 traces.append(trace)126 stream = StationStream(traces=traces)127 streams.append(stream)...

Full Screen

Full Screen

free_time_table.py

Source:free_time_table.py Github

copy

Full Screen

1from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger2from django.contrib.auth.decorators import login_required3from plxk.api.datetime_normalizers import date_to_json4import json5from edms.models import Document6from plxk.api.try_except import try_except7from plxk.api.convert_to_local_time import convert_to_localtime8# При True у списках відображаться документи, які знаходяться в режимі тестування.9from django.conf import settings10testing = settings.STAS_DEBUG11@login_required(login_url='login')12@try_except13def get_free_times_table(request, page):14 free_time_docs = Document.objects.filter(document_type__meta_doc_type_id=1).filter(is_active=1)15 if not testing:16 free_time_docs = free_time_docs.filter(testing=False)17 free_time_docs = table_filter(free_time_docs, json.loads(request.POST['filtering']))18 free_time_docs = table_sort(free_time_docs, request.POST['sort_name'], request.POST['sort_direction'])19 paginator = Paginator(free_time_docs, 20)20 try:21 free_time_docs_page = paginator.page(int(page) + 1)22 except PageNotAnInteger:23 free_time_docs_page = paginator.page(1)24 except EmptyPage:25 free_time_docs_page = paginator.page(1)26 free_time_docs = [{27 'id': free_time.pk,28 'author': free_time.employee_seat.employee.pip,29 'employee': get_employee(free_time),30 'out': get_datetime(free_time, 'out'),31 'in': get_datetime(free_time, 'in'),32 'purpose': get_purpose(free_time),33 'doc_type': free_time.doc_type_version.description if free_time.doc_type_version else '',34 } for free_time in free_time_docs_page.object_list]35 return {'rows': free_time_docs, 'pagesCount': paginator.num_pages}36@try_except37def get_datetime(free_time_doc, type):38 if free_time_doc.document_type_id == 15:39 range = free_time_doc.foyer_ranges.all()40 if range:41 if type == 'out':42 return convert_to_localtime(range[0].out_datetime, 'datetime') if range[0].out_datetime else ''43 else:44 return convert_to_localtime(range[0].in_datetime, 'datetime') if range[0].in_datetime else ''45 else: # free_time_doc.document_type_id == 146 day = free_time_doc.days.all()47 if day:48 return date_to_json(day[0].day)49 return ''50@try_except51def get_purpose(free_time_doc):52 text = free_time_doc.texts.all()53 if text:54 return text[0].text55 return ''56@try_except57def get_employee(free_time_doc):58 employee = free_time_doc.employees.all()59 if employee:60 return employee[0].employee.pip + ' (' + employee[0].employee.tab_number + ')'61 return ''62@try_except63def table_sort(query_set, column, direction):64 if column:65 if direction == 'asc':66 direction = ''67 else:68 direction = '-'69 if column == 'datetime':70 column = 'datetimes__datetime'71 elif column == 'purpose':72 column = 'texts__text'73 elif column == 'author':74 column = 'employee_seat__employee__pip'75 query_set = query_set.order_by(direction + column)76 else:77 query_set = query_set.order_by('-id')78 return query_set79@try_except80def table_filter(query_set, filtering):81 for filter in filtering:82 if filter['columnName'] == 'author':83 query_set = query_set.filter(employee_seat__employee__pip__icontains=filter['value'])84 elif filter['columnName'] == 'employee':85 query_set = query_set.filter(employees__employee__pip__icontains=filter['value']) | \86 query_set.filter(employees__employee__tab_number__icontains=filter['value'])87 elif filter['columnName'] == 'purpose':88 query_set = query_set.filter(texts__text__icontains=filter['value'])89 elif filter['columnName'] == 'doc_type':90 query_set = query_set.filter(doc_type_version__description__icontains=filter['value'])...

Full Screen

Full Screen

Test_Runner.py

Source:Test_Runner.py Github

copy

Full Screen

1"""Automation Test Runner Script23Test_Runner script : This will run all the test sequentially"""45__author__ = 'Vinit Nayak'6__version__ = '0.5.2'7__maintainer__ = 'Vinit Nayak'8__email__ = 'vinitnayak87@berkeley.edu'9__status__ = 'Testing'10__summary__ = __doc__11__description__ = 'automation Test Runner Script'1213import subprocess14import os15from constants import *16from lib import populate_report, clean_up_before_test, get_diagnostic_info, populate_test_categories17from ResultFile_Write import *1819START_TIME = TEST_TIME2021# clean up before starting the tests : always safe22clean_up_before_test()2324Result_File = open(FINAL_RESULT_FILE, 'w') # opening file for output25Test_Decsription = "Regression Test Suite - MP3 Store Automation"26Total_test_cases_run = 02728#Diagnostic_Information = get_diagnostic_info()29Diagnostic_Information = "CS 169 Test Suite"3031# Write starting info to HTML result file32write_HeaderInfo(Result_File, TEST_DESCRIPTION, TEST_TIME)3334for filename in os.listdir(TEST_DIRECTORY):35 if filename.find('tc') >= 0 and filename.find('py') >= 0:36 print filename37 basename, extension = filename.split('.')38 if basename != 'conf' or basename != 'lib' or basename != 'testconfiguration' and extension == 'py':39 LogFile = open(RESULT_FILE, APPEND) # opening file for output40 LogFile.write("\n======================================\n"+basename+"\n======================================\n")41 LogFile.close42 print "\n======================================\n"+basename+"\n======================================\n"43 Total_test_cases_run = Total_test_cases_run + 144 proc = subprocess.Popen(['python', filename])45 proc.wait()46 47END_TIME = TEST_TIME4849#get the test results from the result file50infile = open(RESULT_LOG_PATH, 'r')51test_fails, test_passes, test_not_executed, total_unit_test, result_html_code = populate_report(infile, Result_File)5253"""54Get number of tests run for the following categories from the result log file:55Buy In Place, Purchase Free, Purchase Paid, 56Track Detail Page Free, Track Detail Page Paid,57Album Detail Page Free, Album Detail Page Paid,58Artist Detail Page Free, Artist Detail Page Paid,59Gifting Free, Gifting Paid, Wishlist Free, 60Wishlist Paid, New User Free,61New User Paid, Element Inspection62"""63Buy_In_Place, Purchase_Free, Purchase_Paid, Track_Detail_Page_Free, Track_Detail_Page_Paid, Album_Detail_Page_Free, Album_Detail_Page_Paid, Artist_Detail_Page_Free, Artist_Detail_Page_Paid, Gifting_Free, Gifting_Paid, Wishlist_Free, Wishlist_Paid, New_User_Free, New_User_Paid, Element_Inspection = populate_test_categories(infile)6465# write all log to final report file 6667write_Results(Buy_In_Place, Total_test_cases_run, Diagnostic_Information, Result_File, test_fails, test_passes, test_not_executed, total_unit_test, Purchase_Free, Purchase_Paid, Track_Detail_Page_Free, Track_Detail_Page_Paid, Album_Detail_Page_Free, Album_Detail_Page_Paid, Artist_Detail_Page_Free, Artist_Detail_Page_Paid, Gifting_Free, Gifting_Paid, Wishlist_Free, Wishlist_Paid, New_User_Free, New_User_Paid, Element_Inspection)68# write_Results(Buy_In_Place, Total_test_cases_run, Result_File, test_fails, test_passes, test_not_executed, total_unit_test, Purchase_Free, Purchase_Paid, Track_Detail_Page_Free, Track_Detail_Page_Paid, Album_Detail_Page_Free, Album_Detail_Page_Paid, Artist_Detail_Page_Free, Artist_Detail_Page_Paid, Gifting_Free, Gifting_Paid, Wishlist_Free, Wishlist_Paid, New_User_Free, New_User_Paid, Element_Inspection)69Result_File = open(FINAL_RESULT_FILE, APPEND)70Result_File.flush()71Result_File.write(result_html_code)72Result_File.write("<br>Test Started :"+START_TIME+"<br>Test Ended :"+END_TIME+"<br>")73Result_File.write("</body><html>")74infile.close75Result_File.close ...

Full Screen

Full Screen

icon-loader.ts

Source:icon-loader.ts Github

copy

Full Screen

1import { faSort } from '@fortawesome/free-solid-svg-icons/faSort';2import { faEye } from '@fortawesome/free-solid-svg-icons/faEye';3import { faSync } from '@fortawesome/free-solid-svg-icons/faSync';4import { faBan } from '@fortawesome/free-solid-svg-icons/faBan';5import { faTrash } from '@fortawesome/free-solid-svg-icons/faTrash';6import { faArrowLeft } from '@fortawesome/free-solid-svg-icons/faArrowLeft';7import { faSave } from '@fortawesome/free-solid-svg-icons/faSave';8import { faPlus } from '@fortawesome/free-solid-svg-icons/faPlus';9import { faPencilAlt } from '@fortawesome/free-solid-svg-icons/faPencilAlt';10import { faUser } from '@fortawesome/free-solid-svg-icons/faUser';11import { faHdd } from '@fortawesome/free-solid-svg-icons/faHdd';12import { faTachometerAlt } from '@fortawesome/free-solid-svg-icons/faTachometerAlt';13import { faHeart } from '@fortawesome/free-solid-svg-icons/faHeart';14import { faList } from '@fortawesome/free-solid-svg-icons/faList';15import { faTasks } from '@fortawesome/free-solid-svg-icons/faTasks';16import { faBook } from '@fortawesome/free-solid-svg-icons/faBook';17import { faLock } from '@fortawesome/free-solid-svg-icons/faLock';18import { faSignInAlt } from '@fortawesome/free-solid-svg-icons/faSignInAlt';19import { faSignOutAlt } from '@fortawesome/free-solid-svg-icons/faSignOutAlt';20import { faThList } from '@fortawesome/free-solid-svg-icons/faThList';21import { faUserPlus } from '@fortawesome/free-solid-svg-icons/faUserPlus';22import { faWrench } from '@fortawesome/free-solid-svg-icons/faWrench';23import { faAsterisk } from '@fortawesome/free-solid-svg-icons/faAsterisk';24import { faFlag } from '@fortawesome/free-solid-svg-icons/faFlag';25import { faBell } from '@fortawesome/free-solid-svg-icons/faBell';26import { faHome } from '@fortawesome/free-solid-svg-icons/faHome';27import { faTimesCircle } from '@fortawesome/free-solid-svg-icons/faTimesCircle';28import { faSearch } from '@fortawesome/free-solid-svg-icons/faSearch';29import { faRoad } from '@fortawesome/free-solid-svg-icons/faRoad';30import { faCloud } from '@fortawesome/free-solid-svg-icons/faCloud';31import { library } from '@fortawesome/fontawesome-svg-core';32export const loadIcons = () => {33 library.add(34 faSort,35 faEye,36 faSync,37 faBan,38 faTrash,39 faArrowLeft,40 faSave,41 faPlus,42 faPencilAlt,43 faUser,44 faTachometerAlt,45 faHeart,46 faList,47 faTasks,48 faBook,49 faHdd,50 faLock,51 faSignInAlt,52 faSignOutAlt,53 faWrench,54 faThList,55 faUserPlus,56 faAsterisk,57 faFlag,58 faBell,59 faHome,60 faRoad,61 faCloud,62 faTimesCircle,63 faSearch64 );...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run keyboard automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful