MCPcopy
hub / github.com/python/mypy / set_line

Method set_line

mypy/nodes.py:100–126  ·  view source on GitHub ↗

If target is a node, pull line (and column) information into this node. If column is specified, this will override any column information coming from a node.

(
        self,
        target: Context | int,
        column: int | None = None,
        end_line: int | None = None,
        end_column: int | None = None,
    )

Source from the content-addressed store, hash-verified

98 self.end_column: int | None = None
99
100 def set_line(
101 self,
102 target: Context | int,
103 column: int | None = None,
104 end_line: int | None = None,
105 end_column: int | None = None,
106 ) -> None:
107 """If target is a node, pull line (and column) information
108 into this node. If column is specified, this will override any column
109 information coming from a node.
110 """
111 if isinstance(target, int):
112 self.line = target
113 else:
114 self.line = target.line
115 self.column = target.column
116 self.end_line = target.end_line
117 self.end_column = target.end_column
118
119 if column is not None:
120 self.column = column
121
122 if end_line is not None:
123 self.end_line = end_line
124
125 if end_column is not None:
126 self.end_column = end_column
127
128
129if TYPE_CHECKING:

Calls 1

isinstanceFunction · 0.85

Tested by

no test coverage detected