Skip to content

Commit 0498f70

Browse files
committed
fix: resolve deprecation warnings in click, ssl, and sqlalchemy
- click.MultiCommand -> click.Group in service.py and task.py (deprecated in Click 8.x, same API) - ssl.PROTOCOL_TLS -> ssl.PROTOCOL_TLS_SERVER in oauth/client.py (deprecated since Python 3.10, project requires 3.11+) - Table.exists()/drop()/create() -> inspector.has_table() with explicit bind in bulkdata/load.py (deprecated in SQLAlchemy 1.4)
1 parent 3d62076 commit 0498f70

4 files changed

Lines changed: 6 additions & 7 deletions

File tree

cumulusci/cli/service.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def service_list(runtime, plain, print_json):
6969
console.print(table)
7070

7171

72-
class ConnectServiceCommand(click.MultiCommand):
72+
class ConnectServiceCommand(click.Group):
7373
def _get_services_config(self, runtime):
7474
return (
7575
runtime.project_config.services

cumulusci/cli/task.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def task_info(runtime, task_name):
107107
click.echo(rst2ansi(doc))
108108

109109

110-
class RunTaskCommand(click.MultiCommand):
110+
class RunTaskCommand(click.Group):
111111
# options that are not task specific
112112
global_options = {
113113
"no-prompt": {

cumulusci/oauth/client.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,7 @@ def _create_httpd(self):
201201
keyfile = "key.pem"
202202
if not Path(certfile).is_file() or not Path(keyfile).is_file():
203203
create_key_and_self_signed_cert()
204-
# FIXME: Use ssl.PROTOCOL_TLS_SERVER after dropping 3.8 support
205-
ssl_context = ssl.SSLContext(protocol=ssl.PROTOCOL_TLS)
204+
ssl_context = ssl.SSLContext(protocol=ssl.PROTOCOL_TLS_SERVER)
206205
ssl_context.load_cert_chain(certfile, keyfile)
207206
httpd.socket = ssl_context.wrap_socket(
208207
httpd.socket,

cumulusci/tasks/bulkdata/load.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -750,9 +750,9 @@ def _initialize_id_table(self, should_reset_table):
750750
Column("id", Unicode(255), primary_key=True),
751751
Column("sf_id", Unicode(18)),
752752
)
753-
if id_table.exists():
754-
id_table.drop()
755-
id_table.create()
753+
if self.inspector.has_table(self.ID_TABLE_NAME):
754+
id_table.drop(self.metadata.bind)
755+
id_table.create(self.metadata.bind)
756756

757757
def _sqlite_load(self):
758758
"""Read a SQLite script and initialize the in-memory database."""

0 commit comments

Comments
 (0)