in client/statistics_collectors.py [0:0]
def visit_Assign(self, node: cst.Assign) -> None:
if self.in_function_definition():
return
implicitly_annotated_literal = False
if isinstance(node.value, cst.BaseNumber) or isinstance(
node.value, cst.BaseString
):
implicitly_annotated_literal = True
implicitly_annotated_value = False
if isinstance(node.value, cst.Name) or isinstance(node.value, cst.Call):
# An over-approximation of global values that do not need an explicit
# annotation. Erring on the side of reporting these as annotated to
# avoid showing false positives to users.
implicitly_annotated_value = True
code_range = self._code_range(node)
if self.in_class_definition():
is_annotated = implicitly_annotated_literal or implicitly_annotated_value
self.attributes.append(AnnotationInfo(node, is_annotated, code_range))
else:
is_annotated = implicitly_annotated_literal or implicitly_annotated_value
self.globals.append(AnnotationInfo(node, is_annotated, code_range))