hfijdZddlZddlmZ ddlmZn#e$r ddlmZYnwxYwGddZdS)z> > c3   )::a%%a( (0111rneedler c||j|z dz ||}|dkr|S||zS)zReverse find needle from startr)rrrfind)rr$r poss rr'zFileBuffer.rfindsGjje+a/77==fEE "99Js{rc|jS)z Size of file)rrs rsizezFileBuffer.size%s zrc8|jdS)z Close fileN)r closer*s rr-zFileBuffer.close)s rr buffersizeoffsetc\tj|j||S)zread that uses pread)rr r rrr.r/s rrzFileBuffer._read/s&8DL//11:vFF Frc|j5|j||j|cdddS#1swxYwYdS)aread with a lock This lock is necessary as after a fork, the different processes will share the same file table entry, even if we dup the fd, and as such the same offsets. There does not appear to be a way to duplicate the file table entry and we cannot re-open based on the original path as that file may have replaced with another or unlinked. N)rr seekreadr1s rrzFileBuffer._read6s 5 5 !!&)))|((44 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5s4A  A A )rN)__name__ __module__ __qualname____doc__strrrrr!r#bytesr'r+r-rrrrrrr s3""      2uUCZ02222E##cwr75 GC G G G G G G G G 5C 5 5 5 5 5 5 5 5rr) r8rtypingrmultiprocessingr ImportError threadingrr;rrr@sBB $$$$$$$55555555555555555555s  ##