mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 22:13:26 +00:00
zerver/lib: Use python 3 syntax for typing.
Split by tabbott from a larger commit; this covers a batch of files with no open PRs touching them.
This commit is contained in:
@@ -6,16 +6,13 @@ import sqlalchemy
|
||||
# This is a Pool that doesn't close connections. Therefore it can be used with
|
||||
# existing Django database connections.
|
||||
class NonClosingPool(sqlalchemy.pool.NullPool):
|
||||
def status(self):
|
||||
# type: () -> str
|
||||
def status(self) -> str:
|
||||
return "NonClosingPool"
|
||||
|
||||
def _do_return_conn(self, conn):
|
||||
# type: (sqlalchemy.engine.base.Connection) -> None
|
||||
def _do_return_conn(self, conn: sqlalchemy.engine.base.Connection) -> None:
|
||||
pass
|
||||
|
||||
def recreate(self):
|
||||
# type: () -> NonClosingPool
|
||||
def recreate(self) -> 'NonClosingPool':
|
||||
return self.__class__(creator=self._creator,
|
||||
recycle=self._recycle,
|
||||
use_threadlocal=self._use_threadlocal,
|
||||
@@ -25,12 +22,10 @@ class NonClosingPool(sqlalchemy.pool.NullPool):
|
||||
_dispatch=self.dispatch)
|
||||
|
||||
sqlalchemy_engine = None
|
||||
def get_sqlalchemy_connection():
|
||||
# type: () -> sqlalchemy.engine.base.Connection
|
||||
def get_sqlalchemy_connection() -> sqlalchemy.engine.base.Connection:
|
||||
global sqlalchemy_engine
|
||||
if sqlalchemy_engine is None:
|
||||
def get_dj_conn():
|
||||
# type: () -> TimeTrackingConnection
|
||||
def get_dj_conn() -> TimeTrackingConnection:
|
||||
connection.ensure_connection()
|
||||
return connection.connection
|
||||
sqlalchemy_engine = sqlalchemy.create_engine('postgresql://',
|
||||
|
||||
Reference in New Issue
Block a user