glasskit
Advanced tools
| Metadata-Version: 1.0 | ||
| Name: glasskit | ||
| Version: 3.11.5 | ||
| Version: 3.11.6 | ||
| Summary: a micro webframework based on flask and pymongo | ||
@@ -5,0 +5,0 @@ Home-page: https://gitlab.com/viert/glasskit |
+27
-16
@@ -1,2 +0,2 @@ | ||
| from typing import Any, List, Union, Dict, Type | ||
| from typing import TypeVar, Generic, Callable, Optional, List, Iterator, Any, Union, Dict | ||
| from time import sleep | ||
@@ -17,2 +17,3 @@ from datetime import datetime | ||
| MONGO_RETRY_SLEEP = 3 # 3 seconds | ||
| T = TypeVar("T") | ||
@@ -25,3 +26,3 @@ | ||
| @staticmethod | ||
| def has(_key) -> bool: | ||
| def has(_key: str) -> bool: | ||
| return False | ||
@@ -34,7 +35,7 @@ | ||
| @staticmethod | ||
| def get(_key) -> Any: | ||
| def get(_key: str) -> Any: | ||
| return None | ||
| @staticmethod | ||
| def delete(_key) -> bool: | ||
| def delete(_key: str) -> bool: | ||
| return False | ||
@@ -69,4 +70,4 @@ | ||
| class ObjectsCursor: | ||
| def __init__(self, cursor, ctor, shard_id=None): | ||
| class ObjectsCursor(Generic[T]): | ||
| def __init__(self, cursor: Cursor, ctor: Callable[..., T], shard_id: Optional[str] = None): | ||
| self.ctor = ctor | ||
@@ -76,18 +77,18 @@ self.cursor = cursor | ||
| def all(self) -> List['StorableModel']: | ||
| def all(self) -> List[T]: | ||
| return list(self) | ||
| def limit(self, *args, **kwargs) -> 'ObjectsCursor': | ||
| def limit(self, *args, **kwargs) -> 'ObjectsCursor[T]': | ||
| self.cursor.limit(*args, **kwargs) | ||
| return self | ||
| def skip(self, *args, **kwargs) -> 'ObjectsCursor': | ||
| def skip(self, *args, **kwargs) -> 'ObjectsCursor[T]': | ||
| self.cursor.skip(*args, **kwargs) | ||
| return self | ||
| def sort(self, *args, **kwargs) -> 'ObjectsCursor': | ||
| def sort(self, *args, **kwargs) -> 'ObjectsCursor[T]': | ||
| self.cursor.sort(*args, **kwargs) | ||
| return self | ||
| def __iter__(self): | ||
| def __iter__(self) -> Iterator[T]: | ||
| for item in self.cursor: | ||
@@ -99,3 +100,3 @@ if self._shard_id: | ||
| def __getitem__(self, item): | ||
| def __getitem__(self, item) -> T: | ||
| attrs = self.cursor.__getitem__(item) | ||
@@ -166,3 +167,6 @@ if self._shard_id: | ||
| @intercept_pymongo_errors | ||
| def get_obj(self, ctor: Type['StorableModel'], collection: str, query: Dict) -> Union['StorableModel', None]: | ||
| def get_obj(self, | ||
| ctor: Callable[..., 'StorableModel'], | ||
| collection: str, | ||
| query: Union[str, Dict]) -> Union['StorableModel', None]: | ||
| if not isinstance(query, dict): | ||
@@ -192,3 +196,7 @@ try: | ||
| @intercept_pymongo_errors | ||
| def get_objs(self, ctor: Type['StorableModel'], collection: str, query: Dict, **kwargs) -> ObjectsCursor: | ||
| def get_objs(self, | ||
| ctor: Callable[..., 'StorableModel'], | ||
| collection: str, | ||
| query: Dict, | ||
| **kwargs) -> ObjectsCursor: | ||
| if self._session: | ||
@@ -200,3 +208,6 @@ kwargs["session"] = self._session | ||
| @intercept_pymongo_errors | ||
| def get_objs_projected(self, collection: str, query: Dict, projection: Dict, **kwargs) -> Cursor: | ||
| def get_objs_projected(self, | ||
| collection: str, | ||
| query: Dict, | ||
| projection: Dict, **kwargs) -> Cursor: | ||
| if self._session: | ||
@@ -219,3 +230,3 @@ kwargs["session"] = self._session | ||
| def get_objs_by_field_in(self, | ||
| ctor: Type['StorableModel'], | ||
| ctor: Callable[..., 'StorableModel'], | ||
| collection: str, | ||
@@ -222,0 +233,0 @@ field: str, |
+1
-1
| Metadata-Version: 1.0 | ||
| Name: glasskit | ||
| Version: 3.11.5 | ||
| Version: 3.11.6 | ||
| Summary: a micro webframework based on flask and pymongo | ||
@@ -5,0 +5,0 @@ Home-page: https://gitlab.com/viert/glasskit |
+1
-1
@@ -6,3 +6,3 @@ from setuptools import setup, find_packages | ||
| name="glasskit", | ||
| version="3.11.5", | ||
| version="3.11.6", | ||
| description="a micro webframework based on flask and pymongo", | ||
@@ -9,0 +9,0 @@ url="https://gitlab.com/viert/glasskit", |
Alert delta unavailable
Currently unable to show alert delta for PyPI packages.
164251
0.23%3996
0.28%