MCPcopy Index your code
hub / github.com/LawRefBook/Laws / create_law

Method create_law

scripts/database.py:92–111  ·  view source on GitHub ↗
(self, name: str, category: Category, level: str, publish_at: str = None, id=None)

Source from the content-addressed store, hash-verified

90 Law.delete_by_id(id)
91
92 def create_law(self, name: str, category: Category, level: str, publish_at: str = None, id=None) -> Law:
93 try:
94 params = {
95 "name": name,
96 }
97 if publish_at:
98 params["publish"] = publish_at
99 return Law.get(**params)
100 except Law.DoesNotExist:
101 pass
102 params = {
103 "name": name,
104 "category_id": category.id,
105 "level": level,
106 }
107 if publish_at:
108 params["publish"] = publish_at
109 if id:
110 params["id"] = id
111 return Law.create(**params)
112
113
114def get_laws():

Callers 1

update_databaseFunction · 0.80

Calls 1

getMethod · 0.80

Tested by

no test coverage detected