MCPcopy
hub / github.com/slackapi/python-slack-sdk / show_deprecation_warning_if_any

Function show_deprecation_warning_if_any

slack_sdk/web/deprecation.py:18–53  ·  view source on GitHub ↗

Prints a warning if the given method is deprecated

(method_name: str)

Source from the content-addressed store, hash-verified

16
17
18def show_deprecation_warning_if_any(method_name: str):
19 """Prints a warning if the given method is deprecated"""
20
21 skip_deprecation = os.environ.get("SLACKCLIENT_SKIP_DEPRECATION") # for unit tests etc.
22 if skip_deprecation:
23 return
24 if not method_name:
25 return
26
27 # 2020/01 conversations API deprecation
28 matched_prefixes = [prefix for prefix in deprecated_method_prefixes_2020_01 if method_name.startswith(prefix)]
29 if len(matched_prefixes) > 0:
30 message = (
31 f"{method_name} is deprecated. Please use the Conversations API instead. "
32 "For more info, go to "
33 "https://docs.slack.dev/changelog/2020-01-deprecating-antecedents-to-the-conversations-api/"
34 )
35 warnings.warn(message)
36
37 # 2023/07 stars API deprecation
38 matched_prefixes = [prefix for prefix in deprecated_method_prefixes_2023_07 if method_name.startswith(prefix)]
39 if len(matched_prefixes) > 0:
40 message = (
41 f"{method_name} is deprecated. For more info, go to "
42 "https://docs.slack.dev/changelog/2023-07-its-later-already-for-stars-and-reminders/"
43 )
44 warnings.warn(message)
45
46 # 2024/09 workflow steps API deprecation
47 matched_prefixes = [prefix for prefix in deprecated_method_prefixes_2024_09 if method_name.startswith(prefix)]
48 if len(matched_prefixes) > 0:
49 message = (
50 f"{method_name} is deprecated. For more info, go to "
51 "https://docs.slack.dev/changelog/2023-08-workflow-steps-from-apps-step-back/"
52 )
53 warnings.warn(message)

Callers 3

api_callMethod · 0.85
api_callMethod · 0.85
api_callMethod · 0.85

Calls 1

getMethod · 0.45

Tested by

no test coverage detected