()
| 261 | |
| 262 | |
| 263 | def is_admin_user(): |
| 264 | if sys.platform == 'win32': |
| 265 | # https://stackoverflow.com/questions/130763/request-uac-elevation-from-within-a-python-script/41930586#41930586 |
| 266 | import ctypes |
| 267 | try: |
| 268 | return ctypes.windll.shell32.IsUserAnAdmin() |
| 269 | except Exception: |
| 270 | return False |
| 271 | |
| 272 | # TODO(nom3ad): for sys.platform == 'linux', check capabilities for non-root users. (CAP_NET_ADMIN might be enough?) |
| 273 | return os.getuid() == 0 |
| 274 | |
| 275 | |
| 276 | def set_non_blocking_io(fd): |
no outgoing calls
no test coverage detected