Commit fb390ba1 authored by Aziz Berkay Yesilyurt's avatar Aziz Berkay Yesilyurt
Browse files

enable typing

Showing with 10 additions and 6 deletions
+10 -6
......@@ -224,19 +224,19 @@ class PodAPI:
def oauth2get_access_token(
self,
platform: str,
) -> Any:
) -> Dict:
return self.post(
"oauth2/access_token",
{"platform": platform},
).json()
def oauth2authorize(self, *, platform: str, code: str, redirect_uri: str) -> Any:
def oauth2authorize(self, *, platform: str, code: str, redirect_uri: str) -> Dict[str, str]:
return self.post(
"oauth2/authorize",
{"platform": platform, "authCode": code, "redirectUri": redirect_uri},
).json()
def oauth2get_authorization_url(self, platform: str, scopes: str, redirect_uri: str) -> Any:
def oauth2get_authorization_url(self, platform: str, scopes: str, redirect_uri: str) -> Dict:
return self.post(
"oauth2/auth_url",
{
......
......@@ -6,6 +6,7 @@ from typing import Any, Dict, List, Optional, Type, TypeVar, Union
import numpy as np
from loguru import logger
from typing_extensions import Unpack
from pymemri.data.schema.itembase import ItemBase
......@@ -117,7 +118,7 @@ class PodClient:
return self._upload_image(photo.data, asyncFlag=asyncFlag)
def add_to_schema(self, *items: List[Union[object, type]]):
def add_to_schema(self, *items: Unpack[Union[Type[ItemBase], ItemBase]]):
create_items = []
for item in items:
if not (isinstance(item, ItemBase) or issubclass(item, ItemBase)):
......@@ -628,7 +629,7 @@ class PodClient:
oauth_token_secret=oauth_token_secret,
)
def oauth2_authorize(self, *, platform, code, redirect_uri):
def oauth2_authorize(self, *, platform, code, redirect_uri) -> str:
try:
return self.api.oauth2authorize(
code=code, platform=platform, redirect_uri=redirect_uri
......@@ -637,7 +638,7 @@ class PodClient:
logger.error(e)
return None
def get_oauth2_authorization_url(self, platform, scopes, redirect_uri):
def get_oauth2_authorization_url(self, platform, scopes, redirect_uri) -> str:
try:
return self.api.oauth2get_authorization_url(platform, scopes, redirect_uri)
except PodError as e:
......
......@@ -53,3 +53,6 @@ console_scripts =
plugin_from_template = pymemri.template.formatter:plugin_from_template
create_plugin_config = pymemri.template.config:create_plugin_config
simulate_oauth1_flow = pymemri.plugin.cli:simulate_oauth1_flow
[options.package_data]
{name} = py.typed
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment