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

Method _write_constant

tools/python-3.11.9-amd64/Lib/ast.py:1250–1262  ·  view source on GitHub ↗
(self, value)

Source from the content-addressed store, hash-verified

1248 self._write_str_avoiding_backslashes(node.value, quote_types=_MULTI_QUOTES)
1249
1250 def _write_constant(self, value):
1251 if isinstance(value, (float, complex)):
1252 # Substitute overflowing decimal literal for AST infinities,
1253 # and inf - inf for NaNs.
1254 self.write(
1255 repr(value)
1256 .replace("inf", _INFSTR)
1257 .replace("nan", f"({_INFSTR}-{_INFSTR})")
1258 )
1259 elif self._avoid_backslashes and isinstance(value, str):
1260 self._write_str_avoiding_backslashes(value)
1261 else:
1262 self.write(repr(value))
1263
1264 def visit_Constant(self, node):
1265 value = node.value

Callers 2

visit_ConstantMethod · 0.95
visit_MatchSingletonMethod · 0.95

Calls 3

writeMethod · 0.95
replaceMethod · 0.45

Tested by

no test coverage detected