(file, h=None)
| 14 | #-------------------------# |
| 15 | |
| 16 | def what(file, h=None): |
| 17 | f = None |
| 18 | try: |
| 19 | if h is None: |
| 20 | if isinstance(file, (str, PathLike)): |
| 21 | f = open(file, 'rb') |
| 22 | h = f.read(32) |
| 23 | else: |
| 24 | location = file.tell() |
| 25 | h = file.read(32) |
| 26 | file.seek(location) |
| 27 | for tf in tests: |
| 28 | res = tf(h, f) |
| 29 | if res: |
| 30 | return res |
| 31 | finally: |
| 32 | if f: f.close() |
| 33 | return None |
| 34 | |
| 35 | |
| 36 | #---------------------------------# |