@@ -2049,6 +2049,10 @@ def summarise_total_vs_bad_and_warnings(total: int, bad: int, warns: List[warnin
2049
2049
console .print ("[yellow]There are two cases that are legitimate deprecation warnings though:[/]" )
2050
2050
console .print ("[yellow] 1) when you deprecate whole module or class and replace it in provider[/]" )
2051
2051
console .print ("[yellow] 2) when 3rd-party module generates Deprecation and you cannot upgrade it[/]" )
2052
+ console .print (
2053
+ "[yellow] 3) when many 3rd-party module generates same Deprecation warning that "
2054
+ "comes from another common library[/]"
2055
+ )
2052
2056
console .print ()
2053
2057
console .print (
2054
2058
"[yellow]In case 1), add the deprecation message to "
@@ -2058,6 +2062,10 @@ def summarise_total_vs_bad_and_warnings(total: int, bad: int, warns: List[warnin
2058
2062
"[yellow]In case 2), add the deprecation message together with module it generates to "
2059
2063
"the KNOWN_DEPRECATED_MESSAGES in prepare_provider_packages.py[/]"
2060
2064
)
2065
+ console .print (
2066
+ "[yellow]In case 3), add the deprecation message to "
2067
+ "the KNOWN_COMMON_DEPRECATED_MESSAGES in prepare_provider_packages.py[/]"
2068
+ )
2061
2069
console .print ()
2062
2070
raise_error = True
2063
2071
else :
@@ -2102,7 +2110,6 @@ def summarise_total_vs_bad_and_warnings(total: int, bad: int, warns: List[warnin
2102
2110
("dns.hash module will be removed in future versions. Please use hashlib instead." , "dns" ),
2103
2111
("PKCS#7 support in pyOpenSSL is deprecated. You should use the APIs in cryptography." , "eventlet" ),
2104
2112
("PKCS#12 support in pyOpenSSL is deprecated. You should use the APIs in cryptography." , "eventlet" ),
2105
- ("distutils Version classes are deprecated. Use packaging.version instead." , "eventlet" ),
2106
2113
(
2107
2114
"the imp module is deprecated in favour of importlib; see the module's documentation"
2108
2115
" for alternative uses" ,
@@ -2116,7 +2123,10 @@ def summarise_total_vs_bad_and_warnings(total: int, bad: int, warns: List[warnin
2116
2123
),
2117
2124
("SelectableGroups dict interface is deprecated. Use select." , "kombu" ),
2118
2125
("The module cloudant is now deprecated. The replacement is ibmcloudant." , "cloudant" ),
2119
- ("distutils Version classes are deprecated. Use packaging.version instead." , "dask" ),
2126
+ }
2127
+
2128
+ KNOWN_COMMON_DEPRECATED_MESSAGES : Set [str ] = {
2129
+ "distutils Version classes are deprecated. Use packaging.version instead."
2120
2130
}
2121
2131
2122
2132
# The set of warning messages generated by direct importing of some deprecated modules. We should only
@@ -2184,6 +2194,14 @@ def filter_direct_importlib_warning(warn: warnings.WarningMessage) -> bool:
2184
2194
return True
2185
2195
2186
2196
2197
+ def filter_known_common_deprecated_messages (warn : warnings .WarningMessage ) -> bool :
2198
+ msg_string = str (warn .message ).replace ("\n " , " " )
2199
+ for m in KNOWN_COMMON_DEPRECATED_MESSAGES :
2200
+ if msg_string == m :
2201
+ return False
2202
+ return True
2203
+
2204
+
2187
2205
@cli .command ()
2188
2206
def verify_provider_classes ():
2189
2207
"""Verifies names for all provider classes."""
@@ -2205,6 +2223,7 @@ def verify_provider_classes():
2205
2223
bad += inc_bad
2206
2224
warns = list (filter (filter_known_warnings , warns ))
2207
2225
warns = list (filter (filter_direct_importlib_warning , warns ))
2226
+ warns = list (filter (filter_known_common_deprecated_messages , warns ))
2208
2227
if not summarise_total_vs_bad_and_warnings (total , bad , warns ):
2209
2228
sys .exit (1 )
2210
2229
0 commit comments