Restructured labthings
This commit is contained in:
parent
206dd521ec
commit
a8a3cafa97
39 changed files with 275 additions and 269 deletions
|
|
@ -41,26 +41,6 @@ def bottom_level_name(obj):
|
|||
return obj.__name__.split(".")[-1]
|
||||
|
||||
|
||||
def description_from_view(view_class):
|
||||
methods = []
|
||||
for method_key in ["get", "post", "put", "delete"]:
|
||||
if hasattr(view_class, method_key):
|
||||
methods.append(method_key.upper())
|
||||
brief_description = get_docstring(view_class).partition("\n")[0].strip()
|
||||
|
||||
d = {"methods": methods, "description": brief_description}
|
||||
|
||||
return d
|
||||
|
||||
|
||||
def get_docstring(obj):
|
||||
ds = obj.__doc__
|
||||
if ds:
|
||||
return ds.strip()
|
||||
else:
|
||||
return ""
|
||||
|
||||
|
||||
def camel_to_snake(name):
|
||||
s1 = re.sub("(.)([A-Z][a-z]+)", r"\1_\2", name)
|
||||
return re.sub("([a-z0-9])([A-Z])", r"\1_\2", s1).lower()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue