Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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),
)
def _visit_and_replace_children(self, visitor: CSTVisitorT) -> "While":
return While(
leading_lines=visit_sequence(
self, "leading_lines", self.leading_lines, visitor
),
whitespace_after_while=visit_required(
self, "whitespace_after_while", self.whitespace_after_while, visitor
),
test=visit_required(self, "test", self.test, 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),
)
def _visit_and_replace_children(self, visitor: CSTVisitorT) -> "Param":
return Param(
star=self.star,
whitespace_after_star=visit_required(
self, "whitespace_after_star", self.whitespace_after_star, visitor
),
name=visit_required(self, "name", self.name, visitor),
annotation=visit_optional(self, "annotation", self.annotation, visitor),
equal=visit_sentinel(self, "equal", self.equal, visitor),
default=visit_optional(self, "default", self.default, visitor),
comma=visit_sentinel(self, "comma", self.comma, visitor),
whitespace_after_param=visit_required(
self, "whitespace_after_param", self.whitespace_after_param, visitor
),
def _visit_and_replace_children(self, visitor: CSTVisitorT) -> "Raise":
return Raise(
whitespace_after_raise=visit_sentinel(
self, "whitespace_after_raise", self.whitespace_after_raise, visitor
),
exc=visit_optional(self, "exc", self.exc, visitor),
cause=visit_optional(self, "cause", self.cause, visitor),
semicolon=visit_sentinel(self, "semicolon", self.semicolon, visitor),
)
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),
)
def _visit_and_replace_children(self, visitor: CSTVisitorT) -> "Slice":
return Slice(
lower=visit_optional(self, "lower", self.lower, visitor),
first_colon=visit_required(self, "first_colon", self.first_colon, visitor),
upper=visit_optional(self, "upper", self.upper, visitor),
second_colon=visit_sentinel(
self, "second_colon", self.second_colon, visitor
),
step=visit_optional(self, "step", self.step, visitor),
)
def _visit_and_replace_children(self, visitor: CSTVisitorT) -> "ImportFrom":
names = self.names
return ImportFrom(
whitespace_after_from=visit_required(
self, "whitespace_after_from", self.whitespace_after_from, visitor
),
relative=visit_sequence(self, "relative", self.relative, visitor),
module=visit_optional(self, "module", self.module, visitor),
whitespace_before_import=visit_required(
self, "whitespace_before_import", self.whitespace_before_import, visitor
),
whitespace_after_import=visit_required(
self, "whitespace_after_import", self.whitespace_after_import, visitor
),
lpar=visit_optional(self, "lpar", self.lpar, visitor),
names=(
visit_required(self, "names", names, visitor)
if isinstance(names, ImportStar)
else visit_sequence(self, "names", names, visitor)
),
rpar=visit_optional(self, "rpar", self.rpar, visitor),
semicolon=visit_sentinel(self, "semicolon", self.semicolon, visitor),
)
def _visit_and_replace_children(self, visitor: CSTVisitorT) -> "Try":
return Try(
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),
handlers=visit_sequence(self, "handlers", self.handlers, visitor),
orelse=visit_optional(self, "orelse", self.orelse, visitor),
finalbody=visit_optional(self, "finalbody", self.finalbody, visitor),
)
def _visit_and_replace_children(self, visitor: CSTVisitorT) -> "ImportAlias":
return ImportAlias(
name=visit_required(self, "name", self.name, visitor),
asname=visit_optional(self, "asname", self.asname, visitor),
comma=visit_sentinel(self, "comma", self.comma, visitor),
)
def _visit_and_replace_children(self, visitor: CSTVisitorT) -> "Try":
return Try(
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),
handlers=visit_sequence(self, "handlers", self.handlers, visitor),
orelse=visit_optional(self, "orelse", self.orelse, visitor),
finalbody=visit_optional(self, "finalbody", self.finalbody, visitor),
)