Return a new named %-formatting placeholder for expr. This creates a %-formatting placeholder for expr in the current formatting context, e.g. ``%(py0)s``. The placeholder and expr are placed in the current format context so that it can be used on the next call to .
(self, expr: ast.expr)
| 792 | return ast.Attribute(builtin_name, name, ast.Load()) |
| 793 | |
| 794 | def explanation_param(self, expr: ast.expr) -> str: |
| 795 | """Return a new named %-formatting placeholder for expr. |
| 796 | |
| 797 | This creates a %-formatting placeholder for expr in the |
| 798 | current formatting context, e.g. ``%(py0)s``. The placeholder |
| 799 | and expr are placed in the current format context so that it |
| 800 | can be used on the next call to .pop_format_context(). |
| 801 | """ |
| 802 | specifier = "py" + str(next(self.variable_counter)) |
| 803 | self.explanation_specifiers[specifier] = expr |
| 804 | return "%(" + specifier + ")s" |
| 805 | |
| 806 | def push_format_context(self) -> None: |
| 807 | """Create a new formatting context. |
no outgoing calls
no test coverage detected