hddlZddlZddlZddlmZddlmZddlmZddlm Z ddlm Z ddlm Z ddlm Z e e d ejfZGd d ejZGd d ZGdd ZGddZdS)N)Path)Any)Iterator)Optional)Sequence)Tuple)Unionrc@eZdZUdZdZeeed<dfd ZxZ S)Threadz)Custom thread class to capture exceptionsN exceptionreturnc tdS#t$r}||_Yd}~dSd}~wwxYwN)superrun Exceptionr )selfexc __class__s /srv/buildsys-work-dir/castor/build_node/builder-2/WGSG1/unpkd_srcs/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/pytest_subprocess/utils.pyrz Thread.runsO ! GGKKMMMMM ! ! ! DNNNNNNN !s % A<A)r N) __name__ __module__ __qualname____doc__r rr__annotations__r __classcell__)rs@rr r sZ33%)Ix ")))!!!!!!!!!!r ceZdZdZdZdeeeeffdZ de de fdZ de fdZedd d ede fd Zd edeefd ZedeededeefdZdefdZdefdZdefdZdS)CommandzCommand definition class.commandct|tr"t|d}t|ttfst dtd|D|_t|jD]Q\}}t|tr7t| |trtdRdS)N z2Command can be only of type string, list or tuple.c3vK|]4}t|tjrtj|n|V5dSr isinstanceosPathLikefspath.0cs r z#Command.__init__..)sP3 3 BCJq"+66 =BIaLLLA3 3 3 3 3 3 rz%Cannot use `Any()` one after another.) r%strtuplesplitlist TypeErrorr enumerater_get_next_command_elemAttributeError)rr i command_elems r__init__zCommand.__init__ s gs # # 0GMM#..//G'D%=11 RPQQ Q-23 3 GN3 3 3 . .  "+4z"Command.__eq__..7sB   BCJq"+66 =BIaLLLA   rcng|]2}t|tjrtj|n|3Sr;r$r)s rr<z"Command.__eq__..:s5WWWAjBK&@&@GbilllaWWWrTFr) r%r-r/r r2rr3_are_thresholds_oklen_get_next_matching_elem_indexpop)rr8 norm_command norm_otherr5r6next_command_elemnext_matching_elems r__eq__zCommand.__eq__3s eS ! ! %KK$$E  GK|   XWQVWWW  % %4!*>!+<+< +L+L 55,M:!##rc*t|jSr)iterr rs r__iter__zCommand.__iter__ZDL!!!rr6rvaluecV|j ||jkrdS|j ||jkrdSdS)NFT)maxmin)r6rLs rr>zCommand._are_thresholds_ok]s=   'EL4D,D,D5   'EL4D,D,D5trindexcF |j|dzS#t$rYdSwxYw)N)r IndexError)rrPs rr3zCommand._get_next_command_elemes: < * *   44 s   elemcVtfdt|DdS)Nc3.K|]\}}|k |VdSrr;)r*r5 other_elemrTs rr,z8Command._get_next_matching_elem_index..ps1 K K=1j 8J8JQ8J8J8J8J K Kr)nextr2)r8rTs `rr@z%Command._get_next_matching_elem_indexks8 K K K KIe$4$4 K K KT   rc*t|jSr)hashr rIs r__hash__zCommand.__hash__srKrc*t|jSrr-r rIs r__repr__zCommand.__repr__v4<   rc*t|jSrr]rIs r__str__zCommand.__str__yr_rN)rrrr __slots__r rARGUMENTr-r7AnyTypeboolrFrrJ staticmethodintr>rr3r@r[r^rar;rrrrs{##INx)3./NNNN&%$G%$%$%$%$%$N"(""""st\CHX4F  ! )1 #   \ "#""""!#!!!!!!!!!!!rrc^eZdZdZddddeedeeddfdZdefdZdefd Z dS) rzWildcard definition class.N)rOrNrOrNr cT||||krtd||_||_dS)Nzmin cannot be greater than max)r4rOrN)rrOrNs rr7z Any.__init__s4 ?s399 !ABB B"%"%rc@|jjd|jd|jdS)Nz (min=z, max=))rrrOrNrIs rraz Any.__str__s*.)LLLLLLLLrc t|Sr)r-rIs rr^z Any.__repr__s4yyr) rrrrrrgr7r-rar^r;rrrr}s$$/3$&&&x}&(3-&SW&&&& MMMMM#rcJeZdZdZdeddfdZdefdZdedefdZ de fd Z dS) Programz7Specifies the name of the final program to be executed.programr Nc||_dSr)ro)rros rr7zProgram.__init__s # rc0|jjd|jdS)N(rk)rrrorIs rr^zProgram.__repr__s .)==DL====rr8ct|trt|j|jkrdSt jdrtj dd tj D]k}t|j t|j|j krdSldS)NTwinPATHEXTF)r%r-rnamerosysplatform startswithr&environgetr/pathseplower with_suffix)rr8exts rrFzProgram.__eq__s eS ! ! $E{{4<//t|&&u-- $:>>)R88>>rzJJ$$CU (..00 --99#>>CIIKKLL $ttLurc*t|jSr)rZrorIs rr[zProgram.__hash__rKr) rrrrr-r7r^rdrerFrgr[r;rrrnrnsAA$$$$$$>#>>>> G     "#""""""rrn)r&rx threadingpathlibrtypingrrdrrrrr r-r'rcr rrnr;rrrsl !!!!!! eR[( ) ! ! ! ! !Y  ! ! !_!_!_!_!_!_!_!_!D         """"""""""r