def seek(self, pos, whence=os.SEEK_SET):
if self.closed:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if whence == os.SEEK_SET:<EOL><INDENT>self.position = min(max(pos, <NUM_LIT:0>), self.size)<EOL><DEDENT>elif whence == os.SEEK_CUR:<EOL><INDENT>if pos < <NUM_LIT:0>:<EOL><INDENT>self.position = max(self.position + pos, <NUM_LIT:0>)<EOL><DEDENT>else:<EOL><INDENT>self.position = min(self.position + pos, self.size)<EOL><DEDENT><DEDENT>elif whence == os.SEEK_END:<EOL><INDENT>self.position = max(min(self.size + pos, self.size), <NUM_LIT:0>)<EOL><DEDENT>else:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>self.buffer = b"<STR_LIT>"<EOL>self.fileobj.seek(self.position)<EOL>
Seek to a position in the file.