How to use __is_valid method in webdriver_manager

Best Python code snippet using webdriver_manager

Cuedepend.py

Source:Cuedepend.py Github

copy

Full Screen

...43ERR_INVALID_ON_FRAME = "Error, a dependency of this type requries a valid frame name to depend on. See -on-frame."44ERR_INVALID_ER_JOB = "Error, a dependency of this type requires a valid job name to depend on. See -job."45ERR_INVALID_ER_LAYER = "Error, a dependency of this type requires a valid layer name to depend on. See -layer."46ERR_INVALID_ER_FRAME = "Error, a dependency of this type requries a valid frame name to depend on. See -frame."47def __is_valid(value, error):48 """A couple sanity checks before. The gRpc library takes49 care of everything else"""50 if not value:51 raise ValueError(error)52 if isinstance(value, str) and len(value) < 1:53 raise ValueError(error)54def createDepend(type, job, layer, frame, onjob, onlayer, onframe):55 """Creates a new dependency of the specified type.56 @type type: string57 @param type: The type of dependency58 @type job: string59 @param job: The name of the dependant job60 @type layer: string61 @param layer: The name of the dependant layer62 @type frame: int63 @param frame: The dependant frame number64 @type onjob: string65 @param onjob: the name of the job to depend on66 @type onlayer: string67 @param onlayer: the name of the layer to depend on68 @type onframe: int69 @param onframe: the number of the frame to depend on70 @rtype: Depend71 @return: The newly created dependency"""72 if not onjob and not onlayer and not onframe:73 raise ValueError("You must specify something to depend on, see -on-job, -on-layer, -on-frame")74 if not onjob:75 logger.debug("assuming internal depend")76 onjob = job77 if type in ("HardDepend", "hd"):78 depend = createHardDepend(job, onjob)79 elif type in ("JobOnJob","joj"):80 depend = createJobOnJobDepend(job, onjob)81 elif type in ("JobOnLayer","jol"):82 depend = createJobOnLayerDepend(job, onjob, onlayer)83 elif type in ("JobOnFrame","jof"):84 depend = createJobOnFrameDepend(job, onjob, onlayer, onframe)85 elif type in ("LayerOnJob","loj"):86 depend = createLayerOnJobDepend(job, layer, onjob)87 elif type in ("LayerOnLayer","lol"):88 depend = createLayerOnLayerDepend(job, layer, onjob, onlayer)89 elif type in ("LayerOnFrame","lof"):90 depend = createLayerOnFrameDepend(job, layer, onjob, onlayer, onframe)91 elif type in ("FrameOnJob","foj"):92 depend = createFrameOnJobDepend(job, layer, frame, onjob)93 elif type in ("FrameOnLayer","fol"):94 depend = createFrameOnLayerDepend(job, layer, frame, onjob, onlayer)95 elif type in ("FrameOnFrame","fof"):96 depend = createFrameOnFrameDepend(job, layer, frame, onjob, onlayer, onframe)97 elif type in ("FrameByFrame","fbf"):98 depend = createFrameByFrameDepend(job, layer, onjob, onlayer)99 elif type in ("LayerOnSimFrame","los"):100 depend = createLayerOnSimFrameDepend(job, layer, onjob, onlayer, onframe)101 else:102 raise Exception("invalid dependency type: %s" % (type))103 return depend104def createHardDepend(job, onjob):105 """Creates a frame by frame dependency for all non-preprocess/refshow layers106 (Hard Depend)107 @type job: string108 @param job: the name of the dependant job109 @type onjob: string110 @param onjob: the name of the job to depend on111 @rtype: list<Depend>112 @return: the created dependency"""113 __is_valid(job, ERR_INVALID_ER_JOB)114 __is_valid(onjob, ERR_INVALID_ON_JOB)115 depends = []116 logger.debug("creating hard depend from %s to %s" % (job, onjob))117 onLayers = opencue.api.findJob(onjob).getLayers()118 for depend_er_layer in opencue.api.findJob(job).getLayers():119 for depend_on_layer in onLayers:120 if depend_er_layer.data.type == depend_on_layer.data.type:121 depends.append(depend_er_layer.createFrameByFrameDependency(depend_on_layer,122 False))123 return depends124def createJobOnJobDepend(job, onjob):125 """Creates a job on job dependency.126 (Soft Depend)127 @type job: string128 @param job: the name of the dependant job129 @type onjob: string130 @param onjob: the name of the job to depend on131 @rtype: Depend132 @return: the created dependency"""133 __is_valid(job, ERR_INVALID_ER_JOB)134 __is_valid(onjob, ERR_INVALID_ON_JOB)135 logger.debug("creating joj depend from %s to %s" % (job, onjob))136 depend_er_job = opencue.api.findJob(job)137 return depend_er_job.createDependencyOnJob(opencue.api.findJob(onjob))138def createJobOnLayerDepend(job, onjob, onlayer):139 """Creates a job on layer dependency140 @type job: string141 @param job: the name of the dependant job142 @type onjob: string143 @param onjob: the name of the job to depend on144 @type onlayer: string145 @param onlayer: the name of the layer to depend on146 @rtype: Depend147 @return: the created dependency"""148 __is_valid(job, ERR_INVALID_ER_JOB)149 __is_valid(onjob, ERR_INVALID_ON_JOB)150 __is_valid(onlayer, ERR_INVALID_ON_LAYER)151 logger.debug("creating jol depend from %s to %s/%s" % (job, onjob, onlayer))152 depend_er_job = opencue.api.findJob(job)153 depend_on_layer = opencue.api.findLayer(onjob, onlayer)154 return depend_er_job.createDependencyOnLayer(depend_on_layer)155def createJobOnFrameDepend(job, onjob, onlayer, onframe):156 """Creates a job on frame dependency157 @type job: string158 @param job: the name of the dependant job159 @type onjob: string160 @param onjob: the name of the job to depend on161 @type onlayer: string162 @param onlayer: the name of the layer to depend on163 @type onframe: int164 @param onframe: the number of the frame to depend on165 @rtype: Depend166 @return: the created dependency"""167 __is_valid(job, ERR_INVALID_ER_JOB)168 __is_valid(onjob, ERR_INVALID_ER_JOB)169 __is_valid(onlayer, ERR_INVALID_ON_LAYER)170 __is_valid(onframe, ERR_INVALID_ON_FRAME)171 logger.debug("creating jof depend from %s to %s/%s-%04d"172 % (job, onjob, onlayer, onframe))173 depend_er_job = opencue.findJob(job)174 depend_on_frame = opencue.findFrame(onjob, onlayer, onframe)175 return depend_er_job.createDependencyOnFrame(depend_on_frame)176def createLayerOnJobDepend(job, layer, onjob):177 """Creates a layer on job dependency178 @type job: string179 @param job: the name of the dependant job180 @type layer: string181 @param layer: the name of the dependant layer182 @type onjob: string183 @param onjob: the name of the job to depend on184 @rtype: Depend185 @return: the created dependency"""186 __is_valid(job, ERR_INVALID_ER_JOB)187 __is_valid(layer, ERR_INVALID_ER_LAYER)188 __is_valid(onjob, ERR_INVALID_ON_JOB)189 logger.debug("creating loj depend from %s/%s to %s" % (job, layer, onjob))190 depend_er_layer = opencue.api.findLayer(job, layer)191 return depend_er_layer.createDependencyOnJob(opencue.api.findJob(onjob))192def createLayerOnLayerDepend(job, layer, onjob, onlayer):193 """Creates a layer on layer dependency194 @type job: string195 @param job: the name of the dependant job196 @type layer: string197 @param layer: the name of the dependant layer198 @type onjob: string199 @param onjob: the name of the job to depend on200 @type onlayer: string201 @param onlayer: the name of the layer to depend on202 @rtype: Depend203 @return: the created dependency"""204 __is_valid(job, ERR_INVALID_ER_JOB)205 __is_valid(layer, ERR_INVALID_ER_LAYER)206 __is_valid(onjob, ERR_INVALID_ON_JOB)207 __is_valid(onlayer, ERR_INVALID_ON_LAYER)208 logger.debug("creating lol depend from %s/%s to %s/%s"209 % (job, layer, onjob, onlayer))210 depend_er_layer = opencue.api.findLayer(job,layer)211 depend_on_layer = opencue.api.findLayer(onjob, onlayer)212 return depend_er_layer.createDependencyOnLayer(depend_on_layer)213def createLayerOnFrameDepend(job, layer, onjob, onlayer, onframe):214 """Creates a layer on frame dependency215 @type job: string216 @param job: the name of the dependant job217 @type layer: string218 @param layer: the name of the dependant layer219 @type onjob: string220 @param onjob: the name of the job to depend on221 @type onlayer: string222 @param onlayer: the name of the layer to depend on223 @type onframe: int224 @param onframe: the number of the frame to depend on225 @rtype: Depend226 @return: the created dependency"""227 __is_valid(job, ERR_INVALID_ER_JOB)228 __is_valid(layer, ERR_INVALID_ER_LAYER)229 __is_valid(onjob, ERR_INVALID_ON_JOB)230 __is_valid(onlayer, ERR_INVALID_ON_LAYER)231 __is_valid(onframe, ERR_INVALID_ON_FRAME)232 logger.debug("creating lof depend from %s/%s to %s/%s-%04d"233 % (job, layer, onjob, onlayer, onframe))234 depend_er_layer = opencue.api.findLayer(job,layer)235 depend_on_frame = opencue.api.findFrame(onjob, onlayer, onframe)236 return depend_er_layer.createDependencyOnFrame(depend_on_frame)237def createFrameOnJobDepend(job, layer, frame, onjob):238 """Creates a frame on job dependency239 @type job: string240 @param job: the name of the dependant job241 @type layer: string242 @param layer: the name of the dependant layer243 @type frame: int244 @param frame: the number of the dependant frame245 @type onjob: string246 @param onjob: the name of the job to depend on247 @rtype: Depend248 @return: the created dependency"""249 __is_valid(job, ERR_INVALID_ER_JOB)250 __is_valid(layer, ERR_INVALID_ER_LAYER)251 __is_valid(frame, ERR_INVALID_ER_FRAME)252 __is_valid(onjob, ERR_INVALID_ON_JOB)253 logger.debug("creating foj depend from %s/%s-%04d to %s"254 % (job, layer, frame, onjob))255 depend_er_frame = opencue.api.findFrame(job, layer, frame)256 depend_on_job = opencue.api.findJob(onjob)257 return depend_er_frame.createDependencyOnJob(depend_on_job)258def createFrameOnLayerDepend(job, layer, frame, onjob, onlayer):259 """Creates a frame on layer dependency260 @type job: string261 @param job: the name of the dependant job262 @type layer: string263 @param layer: the name of the dependant layer264 @type frame: int265 @param frame: the number of the dependant frame266 @type onjob: string267 @param onjob: the name of the job to depend on268 @type onlayer: string269 @param onlayer: the name of the layer to depend on270 @rtype: Depend271 @return: the created dependency"""272 __is_valid(job, ERR_INVALID_ER_JOB)273 __is_valid(layer, ERR_INVALID_ER_LAYER)274 __is_valid(frame, ERR_INVALID_ER_FRAME)275 __is_valid(onjob, ERR_INVALID_ON_JOB)276 __is_valid(onlayer, ERR_INVALID_ON_LAYER)277 logger.debug("creating fol depend from %s/%s-%04d to %s/%s"278 % (job, layer, frame, onjob, onlayer))279 depend_er_frame = opencue.api.findFrame(job, layer, frame)280 depend_on_layer = opencue.api.findLayer(onjob, onlayer)281 return depend_er_frame.createDependencyOnLayer(depend_on_layer)282def createFrameOnFrameDepend(job, layer, frame, onjob, onlayer, onframe):283 """Creates a frame on frame dependency284 @type job: string285 @param job: the name of the dependant job286 @type layer: string287 @param layer: the name of the dependant layer288 @type frame: int289 @param frame: the number of the dependant frame290 @type onjob: string291 @param onjob: the name of the job to depend on292 @type onlayer: string293 @param onlayer: the name of the layer to depend on294 @type onframe: int295 @param onframe: the number of the frame to depend on296 @rtype: Depend297 @return: the created dependency"""298 __is_valid(job, ERR_INVALID_ER_JOB)299 __is_valid(layer, ERR_INVALID_ER_LAYER)300 __is_valid(frame, ERR_INVALID_ER_FRAME)301 __is_valid(onjob, ERR_INVALID_ON_JOB)302 __is_valid(onlayer, ERR_INVALID_ON_LAYER)303 __is_valid(onframe, ERR_INVALID_ON_FRAME)304 logger.debug("creating fof depend from %s/%s-%04d to %s/%s-%04d"305 % (job, layer, frame, onjob, onlayer,onframe))306 depend_er_frame = opencue.api.findFrame(job, layer, frame)307 depend_on_frame = opencue.api.findFrame(onjob, onlayer, onframe)308 return depend_er_frame.createDependencyOnFrame(depend_on_frame)309def createFrameByFrameDepend(job, layer, onjob, onlayer):310 """Creates a frame by frame dependency311 @type job: string312 @param job: the name of the dependant job313 @type layer: string314 @param layer: the name of the dependant layer315 @type onjob: string316 @param onjob: the name of the job to depend on317 @type onlayer: string318 @param onlayer: the name of the layer to depend on319 @rtype: Depend320 @return: the created dependency"""321 __is_valid(job, ERR_INVALID_ER_JOB)322 __is_valid(layer, ERR_INVALID_ER_LAYER)323 __is_valid(onjob, ERR_INVALID_ON_JOB)324 __is_valid(onlayer, ERR_INVALID_ON_LAYER)325 logger.debug("creating fbf depend from %s/%s to %s/%s"326 % (job, layer, onjob, onlayer))327 depend_er_layer = opencue.api.findLayer(job, layer)328 depend_on_layer = opencue.api.findLayer(onjob, onlayer)329 return depend_er_layer.createFrameByFrameDependency(depend_on_layer, False)330def createLayerOnSimFrameDepend(job, layer, onjob, onlayer, onframe):331 """Creates a layer on sim frame dependency332 @type job: string333 @param job: the name of the dependant job334 @type layer: string335 @param layer: the name of the dependant layer336 @type onjob: string337 @param onjob: the name of the job to depend on338 @type onlayer: string339 @param onlayer: the name of the layer to depend on340 @type onframe: int341 @param onframe: the number of the frame to depend on342 @rtype: Depend343 @return: the created dependency"""344 __is_valid(job, ERR_INVALID_ER_JOB)345 __is_valid(layer, ERR_INVALID_ER_LAYER)346 __is_valid(onjob, ERR_INVALID_ON_JOB)347 __is_valid(onlayer, ERR_INVALID_ON_LAYER)348 __is_valid(onframe, ERR_INVALID_ON_FRAME)349 logger.debug("creating los depend from %s/%s to %s/%s-%04d"350 % (job, layer, onjob, onlayer, onframe))351 depend_er_layer = opencue.api.findLayer(job,layer)352 depend_on_frame = opencue.api.findFrame(onjob, onlayer, onframe)353 # if createSimDependencyOnFrame existed, we would use it here:354 #return depend_er_layer.createSimDependencyOnFrame(depend_on_frame)355 depends = []356 for depend_er_frame in depend_er_layer.getFrames():357 depends.append(depend_er_frame.createDependencyOnFrame(depend_on_frame))358 return depends359def dropDepend(id):360 """deactivates a dependency by GUID361 @type id: string362 @param id: the GUID of the dependency"""...

Full Screen

Full Screen

Link.py

Source:Link.py Github

copy

Full Screen

1from AmazonASINMatcher import Region2from AmazonASINMatcher import Check_Url3from AmazonASINMatcher import Check_pattern4import re5class Link:6 def __init__(self, link_string):7 self.__link_string = link_string8 self.__is_valid = False9 self.__market_place = ''10 self.__id = ''11 self.__id_type = ''12# region get methods13 def get_valid(self):14 return self.__is_valid15 def get_market_place(self):16 return self.__market_place17 def get_id(self):18 return self.__id19 def get_id_type(self):20 return self.__id_type21# end region22# region set methods23 def __set_is_valid(self):24 self.__is_valid = Check_pattern.check_url_pattern(self.__link_string) and Check_Url.check_url(self.__link_string)25 def __set_market_place(self):26 if self.__is_valid:27 try:28 link_list = self.__link_string.split('/')29 region_string = link_list[2]30 self.__market_place = Region.region_dict[region_string.split('.')[-1].upper()]31 except:32 self.__market_place = ''33 def __set_id(self):34 if self.__is_valid:35 try:36 link_list = self.__link_string.split('/')37 if 'dp' in link_list:38 self.__id = link_list[link_list.index('dp') + 1]39 elif 'gp' in link_list:40 self.__id = link_list[link_list.index('gp') + 2]41 else:42 self.__id = link_list[link_list.index('d') + 3]43 except:44 self. __id = ''45 # depends on product id46 def __set_id_type(self):47 if self.__is_valid and self.__id != '':48 prod_id = self.__id49 try:50 if (len(prod_id) == 10 or len(prod_id) == 13) and re.match(r'[0-9]+', prod_id):51 self.__id_type = "ISBN"52 elif len(prod_id) == 10 and re.match(r'[A-Z0-9]', prod_id):53 self.__id_type = "ASIN"54 except:55 self.__id_type = ''56 def set_details(self):57 self.__set_is_valid()58 self.__set_market_place()59 self.__set_id()60 self.__set_id_type()...

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 webdriver_manager 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