Context manager for auth database connections.
(self)
| 111 | |
| 112 | @contextmanager |
| 113 | def _get_auth_conn(self): |
| 114 | """Context manager for auth database connections.""" |
| 115 | conn = None |
| 116 | try: |
| 117 | conn = sqlite3.connect(self.auth_db_path, check_same_thread=False) |
| 118 | conn.row_factory = sqlite3.Row |
| 119 | yield conn |
| 120 | except Exception: |
| 121 | if conn: |
| 122 | conn.rollback() |
| 123 | raise |
| 124 | finally: |
| 125 | if conn: |
| 126 | conn.close() |
| 127 | |
| 128 | # ========================================================================= |
| 129 | # HARDWARE FINGERPRINT |
no test coverage detected