MCPcopy Create free account
hub / github.com/astral-sh/ruff / new

Method new

crates/ruff_python_formatter/src/context.rs:37–55  ·  view source on GitHub ↗
(
        options: PyFormatOptions,
        contents: &'a str,
        comments: Comments<'a>,
        trivia: &'a TriviaRanges,
        tokens: &'a Tokens,
    )

Source from the content-addressed store, hash-verified

35
36impl<'a> PyFormatContext<'a> {
37 pub(crate) fn new(
38 options: PyFormatOptions,
39 contents: &'a str,
40 comments: Comments<'a>,
41 trivia: &'a TriviaRanges,
42 tokens: &'a Tokens,
43 ) -> Self {
44 Self {
45 options,
46 contents,
47 comments,
48 trivia,
49 tokens,
50 node_level: NodeLevel::TopLevel(TopLevelStatementPosition::Other),
51 indent_level: IndentLevel::new(0),
52 docstring: None,
53 interpolated_string_state: InterpolatedStringState::Outside,
54 }
55 }
56
57 pub(crate) fn source(&self) -> &'a str {
58 self.contents

Callers

nothing calls this directly

Calls 8

node_levelMethod · 0.80
set_node_levelMethod · 0.80
indent_levelMethod · 0.80
set_indent_levelMethod · 0.80
context_mutMethod · 0.45
state_mutMethod · 0.45

Tested by

no test coverage detected