Skip to content

Commit

Permalink
Black format
Browse files Browse the repository at this point in the history
  • Loading branch information
mmastrac committed Sep 26, 2024
1 parent e3827de commit 5d07fe9
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 91 deletions.
2 changes: 1 addition & 1 deletion edb/server/pgcon/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
pg_connect,
set_init_con_script_data,
SETUP_TEMP_TABLE_SCRIPT,
SETUP_CONFIG_CACHE_SCRIPT
SETUP_CONFIG_CACHE_SCRIPT,
)

__all__ = (
Expand Down
30 changes: 15 additions & 15 deletions edb/server/pgcon/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,29 +169,29 @@ def new(

class FeatureNotSupported(BackendError):
def __init__(self, message="feature not supported", **kwargs):
super().__init__(fields=_build_fields(
ERROR_FEATURE_NOT_SUPPORTED, message, **kwargs
))
super().__init__(
fields=_build_fields(ERROR_FEATURE_NOT_SUPPORTED, message, **kwargs)
)


class ProtocolViolation(BackendError):
def __init__(self, message="protocol violation", **kwargs):
super().__init__(fields=_build_fields(
ERROR_PROTOCOL_VIOLATION, message, **kwargs
))
super().__init__(
fields=_build_fields(ERROR_PROTOCOL_VIOLATION, message, **kwargs)
)


class CannotConnectNowError(BackendError):
def __init__(self, message="cannot connect now", **kwargs):
super().__init__(fields=_build_fields(
ERROR_CANNOT_CONNECT_NOW, message, **kwargs
))
super().__init__(
fields=_build_fields(ERROR_CANNOT_CONNECT_NOW, message, **kwargs)
)


class InvalidAuthSpec(BackendError):
def __init__(
self, message="invalid authorization specification", **kwargs
):
super().__init__(fields=_build_fields(
ERROR_INVALID_AUTHORIZATION_SPECIFICATION, message, **kwargs
))
def __init__(self, message="invalid authorization specification", **kwargs):
super().__init__(
fields=_build_fields(
ERROR_INVALID_AUTHORIZATION_SPECIFICATION, message, **kwargs
)
)
101 changes: 26 additions & 75 deletions edb/server/pgcon/pgcon.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -29,24 +29,14 @@ import asyncio
from edb.server import pgconnparams

class BackendError(Exception):
def get_field(self, field: str) -> str | None: ...
def code_is(self, code: str) -> bool: ...

def get_field(self, field: str) -> str | None:
...
class BackendConnectionError(BackendError): ...
class BackendPrivilegeError(BackendError): ...
class BackendCatalogNameError(BackendError): ...

def code_is(self, code: str) -> bool:
...

class BackendConnectionError(BackendError):
...

class BackendPrivilegeError(BackendError):
...

class BackendCatalogNameError(BackendError):
...

def set_init_con_script_data(cfg: list[dict[str, Any]]):
...
def set_init_con_script_data(cfg: list[dict[str, Any]]): ...

class PGConnection(asyncio.Protocol):

Expand All @@ -58,86 +48,47 @@ class PGConnection(asyncio.Protocol):
backend_secret: int
is_ssl: bool

def __init__(self, dbname):
...

async def close(self):
...

async def sql_execute(self, sql: bytes | tuple[bytes, ...]) -> None:
...

def __init__(self, dbname): ...
async def close(self): ...
async def sql_execute(self, sql: bytes | tuple[bytes, ...]) -> None: ...
async def sql_fetch(
self,
sql: bytes | tuple[bytes, ...],
*,
args: tuple[bytes, ...] | list[bytes] = (),
use_prep_stmt: bool = False,
state: Optional[bytes] = None,
) -> list[tuple[bytes, ...]]:
...

) -> list[tuple[bytes, ...]]: ...
async def sql_fetch_val(
self,
sql: bytes,
*,
args: tuple[bytes, ...] | list[bytes] = (),
use_prep_stmt: bool = False,
state: Optional[bytes] = None,
) -> bytes:
...

) -> bytes: ...
async def sql_fetch_col(
self,
sql: bytes,
*,
args: tuple[bytes, ...] | list[bytes] = (),
use_prep_stmt: bool = False,
state: Optional[bytes] = None,
) -> list[bytes]:
...

def terminate(self) -> None:
...

def add_log_listener(self, cb: Callable[[str, str], None]) -> None:
...

def get_server_parameter_status(self, parameter: str) -> Optional[str]:
...

def set_stmt_cache_size(self, size: int) -> None:
...

def set_server(self, server: object) -> None:
...

async def signal_sysevent(self, event: str, *, dbname: str) -> None:
...

def abort(self) -> None:
...

def is_healthy(self) -> bool:
...

async def listen_for_sysevent(self) -> None:
...

def mark_as_system_db(self) -> None:
...

def set_tenant(self, tenant: Any) -> None:
...

def is_cancelling(self) -> bool:
...

def start_pg_cancellation(self) -> None:
...

def finish_pg_cancellation(self) -> None:
...
) -> list[bytes]: ...
def terminate(self) -> None: ...
def add_log_listener(self, cb: Callable[[str, str], None]) -> None: ...
def get_server_parameter_status(self, parameter: str) -> Optional[str]: ...
def set_stmt_cache_size(self, size: int) -> None: ...
def set_server(self, server: object) -> None: ...
async def signal_sysevent(self, event: str, *, dbname: str) -> None: ...
def abort(self) -> None: ...
def is_healthy(self) -> bool: ...
async def listen_for_sysevent(self) -> None: ...
def mark_as_system_db(self) -> None: ...
def set_tenant(self, tenant: Any) -> None: ...
def is_cancelling(self) -> bool: ...
def start_pg_cancellation(self) -> None: ...
def finish_pg_cancellation(self) -> None: ...

SETUP_TEMP_TABLE_SCRIPT: str
SETUP_CONFIG_CACHE_SCRIPT: str

0 comments on commit 5d07fe9

Please sign in to comment.