MCPcopy Create free account
hub / github.com/getsentry/sentry / visit_Assign

Method visit_Assign

tools/flake8_plugin.py:886–906  ·  view source on GitHub ↗
(self, node: ast.Assign)

Source from the content-addressed store, hash-verified

884 self._function_depth -= 1
885
886 def visit_Assign(self, node: ast.Assign) -> None:
887 if self._input_stack:
888 ctx = self._input_stack[-1]
889 for target in node.targets:
890 if not isinstance(target, ast.Name):
891 continue
892 if ctx.is_query(node.value):
893 ctx.query_locals.add(target.id)
894 elif ctx.is_body(node.value):
895 ctx.body_locals.add(target.id)
896 if (
897 _is_tests_path(self.filename)
898 and self._function_depth == 0
899 and len(node.targets) == 1
900 and isinstance(node.targets[0], ast.Name)
901 and isinstance(node.value, ast.Call)
902 ):
903 y = _wall_clock_year_from_datetime_call(node.value)
904 if y is not None and y >= self._s015_year:
905 self.errors.append((node.lineno, node.col_offset, self._s015_msg))
906 self.generic_visit(node)
907
908 def _check_S021(self, node: ast.FunctionDef | ast.AsyncFunctionDef) -> None:
909 annot = _extract_response_annotation_Ts(node.returns)

Callers

nothing calls this directly

Calls 7

_is_tests_pathFunction · 0.85
is_queryMethod · 0.80
is_bodyMethod · 0.80
addMethod · 0.65
appendMethod · 0.65
generic_visitMethod · 0.45

Tested by

no test coverage detected