这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mycli/clitoolbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def get_toolbar_tokens() -> list[tuple[str, str]]:
result = [("class:bottom-toolbar", " ")]

if mycli.multi_line:
delimiter = special.get_current_delimiter() # type: ignore
delimiter = special.get_current_delimiter()
result.append((
"class:bottom-toolbar",
" ({} [{}] will end the line) ".format("Semi-colon" if delimiter == ";" else "Delimiter", delimiter),
Expand Down
44 changes: 23 additions & 21 deletions mycli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,7 @@ def show_suggestion_tip() -> bool:
# mutating if any one of the component statements is mutating
mutating = False

def output_res(res, start):
def output_res(res: Generator[tuple], start: float) -> None:
nonlocal mutating
result_count = 0
for title, cur, headers, status in res:
Expand All @@ -717,7 +717,10 @@ def output_res(res, start):
break

if self.auto_vertical_output:
max_width = self.prompt_app.output.get_size().columns
if self.prompt_app is not None:
max_width = self.prompt_app.output.get_size().columns
else:
max_width = DEFAULT_WIDTH
else:
max_width = None

Expand Down Expand Up @@ -749,7 +752,6 @@ def output_res(res, start):
start = time()
result_count += 1
mutating = mutating or is_mutating(status)
return

def one_iteration(text: str | None = None) -> None:
if text is None:
Expand Down Expand Up @@ -1336,7 +1338,7 @@ def cli(
init_command,
charset,
password_file,
):
) -> None:
"""A MySQL terminal client with auto-completion and syntax highlighting.

\b
Expand Down Expand Up @@ -1428,28 +1430,28 @@ def cli(
else:
dsn_params = {}

if dsn_params.get('ssl'):
ssl_enable = ssl_enable or (dsn_params.get('ssl')[0].lower() == 'true')
if dsn_params.get('ssl_ca'):
ssl_ca = ssl_ca or dsn_params.get('ssl_ca')[0]
if params := dsn_params.get('ssl'):
ssl_enable = ssl_enable or (params[0].lower() == 'true')
if params := dsn_params.get('ssl_ca'):
ssl_ca = ssl_ca or params[0]
ssl_enable = True
if dsn_params.get('ssl_capath'):
ssl_capath = ssl_capath or dsn_params.get('ssl_capath')[0]
if params := dsn_params.get('ssl_capath'):
ssl_capath = ssl_capath or params[0]
ssl_enable = True
if dsn_params.get('ssl_cert'):
ssl_cert = ssl_cert or dsn_params.get('ssl_cert')[0]
if params := dsn_params.get('ssl_cert'):
ssl_cert = ssl_cert or params[0]
ssl_enable = True
if dsn_params.get('ssl_key'):
ssl_key = ssl_key or dsn_params.get('ssl_key')[0]
if params := dsn_params.get('ssl_key'):
ssl_key = ssl_key or params[0]
ssl_enable = True
if dsn_params.get('ssl_cipher'):
ssl_cipher = ssl_cipher or dsn_params.get('ssl_cipher')[0]
if params := dsn_params.get('ssl_cipher'):
ssl_cipher = ssl_cipher or params[0]
ssl_enable = True
if dsn_params.get('tls_version'):
tls_version = tls_version or dsn_params.get('tls_version')[0]
if params := dsn_params.get('tls_version'):
tls_version = tls_version or params[0]
ssl_enable = True
if dsn_params.get('ssl_verify_server_cert'):
ssl_verify_server_cert = ssl_verify_server_cert or (dsn_params.get('ssl_verify_server_cert')[0].lower() == 'true')
if params := dsn_params.get('ssl_verify_server_cert'):
ssl_verify_server_cert = ssl_verify_server_cert or (params[0].lower() == 'true')
ssl_enable = True

ssl = {
Expand Down Expand Up @@ -1477,7 +1479,7 @@ def cli(

ssh_key_filename = ssh_key_filename and os.path.expanduser(ssh_key_filename)
# Merge init-commands: global, DSN-specific, then CLI
init_cmds = []
init_cmds: list[str] = []
# 1) Global init-commands
global_section = mycli.config.get("init-commands", {})
for _, val in global_section.items():
Expand Down
2 changes: 1 addition & 1 deletion mycli/packages/shortcuts.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

from mycli.sqlexecute import SQLExecute # type: ignore
from mycli.sqlexecute import SQLExecute


def server_date(sqlexecute: SQLExecute, quoted: bool = False) -> str:
Expand Down