MCPcopy
hub / github.com/python-attrs/attrs / _eval_snippets

Method _eval_snippets

src/attr/_make.py:778–794  ·  view source on GitHub ↗

Evaluate any registered snippets in one go.

(self)

Source from the content-addressed store, hash-verified

776 return f"<_ClassBuilder(cls={self._cls.__name__})>"
777
778 def _eval_snippets(self) -> None:
779 """
780 Evaluate any registered snippets in one go.
781 """
782 script = "\n".join([snippet[0] for snippet in self._script_snippets])
783 globs = {}
784 for _, snippet_globs, _ in self._script_snippets:
785 globs.update(snippet_globs)
786
787 locs = _linecache_and_compile(
788 script,
789 _generate_unique_filename(self._cls, "methods"),
790 globs,
791 )
792
793 for _, _, hook in self._script_snippets:
794 hook(self._cls_dict, locs)
795
796 def build_class(self):
797 """

Callers 1

build_classMethod · 0.95

Calls 2

_linecache_and_compileFunction · 0.85

Tested by

no test coverage detected