Skip to content

Instantly share code, notes, and snippets.

@terrdavis
terrdavis / xlrd_protected.py
Last active May 30, 2022 09:53
Open an xls file using xlrd even if it has protected sheets.
# based on: https://stackoverflow.com/a/52290873/9560908
import contextlib
import tempfile
import msoffcrypto
import xlrd
@contextlib.contextmanager
@terrdavis
terrdavis / beartype.py
Last active May 22, 2020 08:07 — forked from leycec/beartype.py
`@beartype` Decorator and Unit Test Suite Thereof
#!/usr/bin/env python3
'''
`@beartype` decorator, implementing a rudimentary subset of PEP 484-style type
checking based on Python 3.x function annotations.
See Also
----------
https://stackoverflow.com/a/37961120/2809027
Stackoverflow answer introducing the `@beartype` decorator.