MCPcopy Index your code
hub / github.com/tensorpack/tensorpack / log_deprecated

Function log_deprecated

tensorpack/utils/develop.py:82–109  ·  view source on GitHub ↗

Log deprecation warning. Args: name (str): name of the deprecated item. text (str, optional): information about the deprecation. eos (str, optional): end of service date such as "YYYY-MM-DD". max_num_warnings (int, optional): the maximum number of times to p

(name="", text="", eos="", max_num_warnings=None)

Source from the content-addressed store, hash-verified

80
81
82def log_deprecated(name="", text="", eos="", max_num_warnings=None):
83 """
84 Log deprecation warning.
85
86 Args:
87 name (str): name of the deprecated item.
88 text (str, optional): information about the deprecation.
89 eos (str, optional): end of service date such as "YYYY-MM-DD".
90 max_num_warnings (int, optional): the maximum number of times to print this warning
91 """
92 assert name or text
93 if eos:
94 eos = "after " + datetime(*map(int, eos.split("-"))).strftime("%d %b")
95 if name:
96 if eos:
97 warn_msg = "%s will be deprecated %s. %s" % (name, eos, text)
98 else:
99 warn_msg = "%s was deprecated. %s" % (name, text)
100 else:
101 warn_msg = text
102 if eos:
103 warn_msg += " Legacy period ends %s" % eos
104
105 if max_num_warnings is not None:
106 if _DEPRECATED_LOG_NUM[warn_msg] >= max_num_warnings:
107 return
108 _DEPRECATED_LOG_NUM[warn_msg] += 1
109 logger.warn("[Deprecated] " + warn_msg)
110
111
112def deprecated(text="", eos="", max_num_warnings=None):

Callers 6

new_funcFunction · 0.85
__init__Method · 0.85
__init__Method · 0.85
PReLUFunction · 0.85
BNReLUFunction · 0.85
InstanceNormFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected