Context manager that temporarily sets the process umask.
(umask)
| 722 | if hasattr(os, "umask"): |
| 723 | @contextlib.contextmanager |
| 724 | def temp_umask(umask): |
| 725 | """Context manager that temporarily sets the process umask.""" |
| 726 | oldmask = os.umask(umask) |
| 727 | try: |
| 728 | yield |
| 729 | finally: |
| 730 | os.umask(oldmask) |
| 731 | else: |
| 732 | @contextlib.contextmanager |
| 733 | def temp_umask(umask): |
no outgoing calls
searching dependent graphs…