Merge pull request #35 from specklesystems/izzy/3.6-compat
fix: remove annotations for py 3.6 compatibility
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import List, Optional
|
||||
from pydantic import BaseModel
|
||||
from speckle.transports.sqlite import SQLiteTransport
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
# filename: stream_schema.json
|
||||
# timestamp: 2020-11-17T14:33:13+00:00
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import datetime
|
||||
from typing import Any, Dict, List, Optional
|
||||
|
||||
@@ -64,12 +62,6 @@ class Branches(BaseModel):
|
||||
items: List[Branch] = []
|
||||
|
||||
|
||||
class Streams(BaseModel):
|
||||
totalCount: Optional[int]
|
||||
cursor: Optional[datetime]
|
||||
items: List[Stream] = []
|
||||
|
||||
|
||||
class Stream(BaseModel):
|
||||
id: Optional[str]
|
||||
name: Optional[str]
|
||||
@@ -89,6 +81,12 @@ class Stream(BaseModel):
|
||||
return self.__repr__()
|
||||
|
||||
|
||||
class Streams(BaseModel):
|
||||
totalCount: Optional[int]
|
||||
cursor: Optional[datetime]
|
||||
items: List[Stream] = []
|
||||
|
||||
|
||||
class User(BaseModel):
|
||||
id: Optional[str]
|
||||
email: Optional[str]
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from pydantic import BaseModel
|
||||
from pydantic.main import Extra
|
||||
from typing import Dict, List, Optional, Any
|
||||
@@ -100,7 +98,7 @@ class Base(BaseModel):
|
||||
serializer.write_transports = [MemoryTransport()]
|
||||
return serializer.traverse_base(self)[0]
|
||||
|
||||
def _count_descendants(self, base: Base, parsed: List) -> int:
|
||||
def _count_descendants(self, base: "Base", parsed: List) -> int:
|
||||
if base in parsed:
|
||||
return 0
|
||||
parsed.append(base)
|
||||
@@ -119,20 +117,20 @@ class Base(BaseModel):
|
||||
count = 0
|
||||
if obj == None:
|
||||
return count
|
||||
if isinstance(obj, Base):
|
||||
if isinstance(obj, "Base"):
|
||||
count += 1
|
||||
count += self._count_descendants(obj, parsed)
|
||||
return count
|
||||
elif isinstance(obj, list):
|
||||
for item in obj:
|
||||
if isinstance(item, Base):
|
||||
if isinstance(item, "Base"):
|
||||
count += 1
|
||||
count += self._count_descendants(item, parsed)
|
||||
else:
|
||||
count += self._handle_object_count(item, parsed)
|
||||
elif isinstance(obj, dict):
|
||||
for _, value in obj.items():
|
||||
if isinstance(value, Base):
|
||||
if isinstance(value, "Base"):
|
||||
count += 1
|
||||
count += self._count_descendants(value, parsed)
|
||||
else:
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import List, Optional
|
||||
|
||||
from .base import Base
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import List, Optional
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
Reference in New Issue
Block a user