MCPcopy Index your code
hub / github.com/diffgram/diffgram / new

Method new

shared/database/annotation/instance_template.py:77–108  ·  view source on GitHub ↗
(session,
            project,
            name: str,
            instance_list,
            add_to_session: bool = True,
            member_created = None,
            reference_width = None,
            mode = '1_click',
            reference_height = None,
            flush_session: bool = True)

Source from the content-addressed store, hash-verified

75
76 @staticmethod
77 def new(session,
78 project,
79 name: str,
80 instance_list,
81 add_to_session: bool = True,
82 member_created = None,
83 reference_width = None,
84 mode = '1_click',
85 reference_height = None,
86 flush_session: bool = True):
87
88 instance_template = InstanceTemplate(
89 project_id = project.id,
90 name = name,
91 member_created_id = member_created.id,
92 reference_height = reference_height,
93 mode = mode,
94 reference_width = reference_width,
95 )
96 if add_to_session:
97 session.add(instance_template)
98 if flush_session:
99 session.flush()
100
101 for instance in instance_list:
102 rel = InstanceTemplateRelation(
103 instance_id = instance.id,
104 instance_template_id = instance_template.id
105 )
106 session.add(rel)
107
108 return instance_template
109
110 def get_instance_list(self, session):
111 rels_list = session.query(InstanceTemplateRelation).filter(

Callers

nothing calls this directly

Calls 3

InstanceTemplateClass · 0.85
addMethod · 0.45

Tested by

no test coverage detected