MCPcopy Create free account
hub / github.com/diffgram/diffgram / new

Method new

shared/database/labels/label.py:27–42  ·  view source on GitHub ↗
(session,
            add_to_session = True,
            flush_session = True,
            name = None)

Source from the content-addressed store, hash-verified

25
26 @staticmethod
27 def new(session,
28 add_to_session = True,
29 flush_session = True,
30 name = None):
31
32 label = session.query(Label).filter(
33 Label.name == name
34 ).first()
35
36 if not label:
37 label = Label(name = name)
38 if add_to_session:
39 session.add(label)
40 if flush_session:
41 session.flush()
42 return label
43
44
45 def serialize(self):

Callers

nothing calls this directly

Calls 2

LabelClass · 0.85
addMethod · 0.45

Tested by

no test coverage detected