How to use the libcst._nodes.internal.visit_required function in libcst

To help you get started, we’ve selected a few libcst examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Instagram / LibCST / libcst / _nodes / statement.py View on Github external
def _visit_and_replace_children(self, visitor: CSTVisitorT) -> "AnnAssign":
        return AnnAssign(
            target=visit_required(self, "target", self.target, visitor),
            annotation=visit_required(self, "annotation", self.annotation, visitor),
            equal=visit_sentinel(self, "equal", self.equal, visitor),
            value=visit_optional(self, "value", self.value, visitor),
            semicolon=visit_sentinel(self, "semicolon", self.semicolon, visitor),
        )
github Instagram / LibCST / libcst / _nodes / statement.py View on Github external
def _visit_and_replace_children(self, visitor: CSTVisitorT) -> "Finally":
        return Finally(
            leading_lines=visit_sequence(
                self, "leading_lines", self.leading_lines, visitor
            ),
            whitespace_before_colon=visit_required(
                self, "whitespace_before_colon", self.whitespace_before_colon, visitor
            ),
            body=visit_required(self, "body", self.body, visitor),
        )
github Instagram / LibCST / libcst / _nodes / expression.py View on Github external
def _visit_and_replace_children(self, visitor: CSTVisitorT) -> "Lambda":
        return Lambda(
            lpar=visit_sequence(self, "lpar", self.lpar, visitor),
            whitespace_after_lambda=visit_sentinel(
                self, "whitespace_after_lambda", self.whitespace_after_lambda, visitor
            ),
            params=visit_required(self, "params", self.params, visitor),
            colon=visit_required(self, "colon", self.colon, visitor),
            body=visit_required(self, "body", self.body, visitor),
            rpar=visit_sequence(self, "rpar", self.rpar, visitor),
        )
github Instagram / LibCST / libcst / _nodes / expression.py View on Github external
def _visit_and_replace_children(
        self, visitor: CSTVisitorT
    ) -> "FormattedStringExpression":
        format_spec = self.format_spec
        return FormattedStringExpression(
            whitespace_before_expression=visit_required(
                self,
                "whitespace_before_expression",
                self.whitespace_before_expression,
                visitor,
            ),
            expression=visit_required(self, "expression", self.expression, visitor),
            whitespace_after_expression=visit_required(
                self,
                "whitespace_after_expression",
                self.whitespace_after_expression,
                visitor,
            ),
            conversion=self.conversion,
            format_spec=(
                visit_sequence(self, "format_spec", format_spec, visitor)
                if format_spec is not None
                else None
            ),
github Instagram / LibCST / libcst / _nodes / statement.py View on Github external
def _visit_and_replace_children(self, visitor: CSTVisitorT) -> "Decorator":
        return Decorator(
            leading_lines=visit_sequence(
                self, "leading_lines", self.leading_lines, visitor
            ),
            whitespace_after_at=visit_required(
                self, "whitespace_after_at", self.whitespace_after_at, visitor
            ),
            decorator=visit_required(self, "decorator", self.decorator, visitor),
            trailing_whitespace=visit_required(
                self, "trailing_whitespace", self.trailing_whitespace, visitor
            ),
github Instagram / LibCST / libcst / _nodes / statement.py View on Github external
decorators=visit_sequence(self, "decorators", self.decorators, visitor),
            lines_after_decorators=visit_sequence(
                self, "lines_after_decorators", self.lines_after_decorators, visitor
            ),
            whitespace_after_class=visit_required(
                self, "whitespace_after_class", self.whitespace_after_class, visitor
            ),
            name=visit_required(self, "name", self.name, visitor),
            whitespace_after_name=visit_required(
                self, "whitespace_after_name", self.whitespace_after_name, visitor
            ),
            lpar=visit_sentinel(self, "lpar", self.lpar, visitor),
            bases=visit_sequence(self, "bases", self.bases, visitor),
            keywords=visit_sequence(self, "keywords", self.keywords, visitor),
            rpar=visit_sentinel(self, "rpar", self.rpar, visitor),
            whitespace_before_colon=visit_required(
                self, "whitespace_before_colon", self.whitespace_before_colon, visitor
            ),
            body=visit_required(self, "body", self.body, visitor),
        )
github Instagram / LibCST / libcst / _nodes / expression.py View on Github external
def _visit_and_replace_children(self, visitor: CSTVisitorT) -> "List":
        return List(
            lpar=visit_sequence(self, "lpar", self.lpar, visitor),
            lbracket=visit_required(self, "lbracket", self.lbracket, visitor),
            elements=visit_sequence(self, "elements", self.elements, visitor),
            rbracket=visit_required(self, "rbracket", self.rbracket, visitor),
            rpar=visit_sequence(self, "rpar", self.rpar, visitor),
        )
github Instagram / LibCST / libcst / _nodes / whitespace.py View on Github external
def _visit_and_replace_children(self, visitor: CSTVisitorT) -> "EmptyLine":
        return EmptyLine(
            indent=self.indent,
            whitespace=visit_required(self, "whitespace", self.whitespace, visitor),
            comment=visit_optional(self, "comment", self.comment, visitor),
            newline=visit_required(self, "newline", self.newline, visitor),
        )
github Instagram / LibCST / libcst / _nodes / statement.py View on Github external
),
            asynchronous=visit_optional(
                self, "asynchronous", self.asynchronous, visitor
            ),
            whitespace_after_for=visit_required(
                self, "whitespace_after_for", self.whitespace_after_for, visitor
            ),
            target=visit_required(self, "target", self.target, visitor),
            whitespace_before_in=visit_required(
                self, "whitespace_before_in", self.whitespace_before_in, visitor
            ),
            whitespace_after_in=visit_required(
                self, "whitespace_after_in", self.whitespace_after_in, visitor
            ),
            iter=visit_required(self, "iter", self.iter, visitor),
            whitespace_before_colon=visit_required(
                self, "whitespace_before_colon", self.whitespace_before_colon, visitor
            ),
            body=visit_required(self, "body", self.body, visitor),
            orelse=visit_optional(self, "orelse", self.orelse, visitor),
        )
github Instagram / LibCST / libcst / _nodes / expression.py View on Github external
def _visit_and_replace_children(self, visitor: CSTVisitorT) -> "Attribute":
        return Attribute(
            lpar=visit_sequence(self, "lpar", self.lpar, visitor),
            value=visit_required(self, "value", self.value, visitor),
            dot=visit_required(self, "dot", self.dot, visitor),
            attr=visit_required(self, "attr", self.attr, visitor),
            rpar=visit_sequence(self, "rpar", self.rpar, visitor),
        )