MCPcopy Index your code
hub / github.com/python/mypy / create_non_ext_info

Method create_non_ext_info

mypyc/irbuild/classdef.py:369–381  ·  view source on GitHub ↗

Set up a NonExtClassInfo to track dataclass attributes. In addition to setting up a normal extension class for dataclasses, we also collect its class attributes like a non-extension class so that we can hand them to the dataclass decorator.

(self)

Source from the content-addressed store, hash-verified

367 self.non_ext = self.create_non_ext_info()
368
369 def create_non_ext_info(self) -> NonExtClassInfo:
370 """Set up a NonExtClassInfo to track dataclass attributes.
371
372 In addition to setting up a normal extension class for dataclasses,
373 we also collect its class attributes like a non-extension class so
374 that we can hand them to the dataclass decorator.
375 """
376 return NonExtClassInfo(
377 self.builder.call_c(dict_new_op, [], self.cdef.line),
378 self.builder.add(TupleSet([], self.cdef.line)),
379 self.builder.call_c(dict_new_op, [], self.cdef.line),
380 self.builder.add(LoadAddress(type_object_op.type, type_object_op.src, self.cdef.line)),
381 )
382
383 def skip_attr_default(self, name: str, stmt: AssignmentStmt) -> bool:
384 return stmt.type is not None

Callers 1

__init__Method · 0.95

Calls 5

NonExtClassInfoClass · 0.90
TupleSetClass · 0.90
LoadAddressClass · 0.90
call_cMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected