MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / _setoption

Function _setoption

tools/python-3.11.9-amd64/Lib/warnings.py:214–239  ·  view source on GitHub ↗
(arg)

Source from the content-addressed store, hash-verified

212
213# Helper for _processoptions()
214def _setoption(arg):
215 parts = arg.split(':')
216 if len(parts) > 5:
217 raise _OptionError("too many fields (max 5): %r" % (arg,))
218 while len(parts) < 5:
219 parts.append('')
220 action, message, category, module, lineno = [s.strip()
221 for s in parts]
222 action = _getaction(action)
223 category = _getcategory(category)
224 if message or module:
225 import re
226 if message:
227 message = re.escape(message)
228 if module:
229 module = re.escape(module) + r'\Z'
230 if lineno:
231 try:
232 lineno = int(lineno)
233 if lineno < 0:
234 raise ValueError
235 except (ValueError, OverflowError):
236 raise _OptionError("invalid lineno %r" % (lineno,)) from None
237 else:
238 lineno = 0
239 filterwarnings(action, message, category, module, lineno)
240
241# Helper for _setoption()
242def _getaction(action):

Callers 1

_processoptionsFunction · 0.85

Calls 8

_OptionErrorClass · 0.85
_getactionFunction · 0.85
_getcategoryFunction · 0.85
filterwarningsFunction · 0.85
stripMethod · 0.80
splitMethod · 0.45
appendMethod · 0.45
escapeMethod · 0.45

Tested by

no test coverage detected