moved basesnippet and paragraph to snippet.py

This commit is contained in:
2021-05-31 21:25:02 +02:00
parent a1856a68e5
commit b44101b394
3 changed files with 32 additions and 33 deletions

View File

@ -1,5 +1,5 @@
from .scicat import SciCat
from .scilog import SciLog
from .scilog import Basesnippet, Paragraph
from .snippet import Basesnippet, Paragraph

View File

@ -3,42 +3,11 @@ from __future__ import annotations
from .authclient import AuthMixin, AuthError, HEADER_JSON
from .mkfilt import make_filter
from .httpclient import HttpClient
from .snippet import Snippet
from .snippet import Snippet, Basesnippet
from typing import TypeVar, Union, List, Type, get_type_hints
import functools
class Basesnippet(Snippet):
def __init__(self):
super().__init__()
self.set_properties(
id=str,
parentId=str,
ownerGroup=str,
accessGroups=list,
snippetType=str,
isPrivate=bool,
createdAt=str,
createdBy=str,
updatedAt=str,
updateBy=str,
subsnippets=List[type(Basesnippet)],
tags=List[str],
dashboardName=str,
files=str,
location=str,
defaultOrder=int,
linkType=str,
versionable=bool,
deleted=bool)
class Paragraph(Basesnippet):
def __init__(self):
super().__init__()
self.set_properties(textcontent=str, isMessage=str)
class SciLogRestAPI(HttpClient):
def __init__(self, url):

View File

@ -64,6 +64,36 @@ class Snippet(dict):
return cls.from_dict(response)
class Basesnippet(Snippet):
def __init__(self):
super().__init__()
self.set_properties(
id=str,
parentId=str,
ownerGroup=str,
accessGroups=list,
snippetType=str,
isPrivate=bool,
createdAt=str,
createdBy=str,
updatedAt=str,
updateBy=str,
subsnippets=list,
tags=list,
dashboardName=str,
files=str,
location=str,
defaultOrder=int,
linkType=str,
versionable=bool,
deleted=bool)
class Paragraph(Basesnippet):
def __init__(self):
super().__init__()
self.set_properties(textcontent=str, isMessage=str)
if __name__ == "__main__":