Skip to content

Commit

Permalink
improve label docs string
Browse files Browse the repository at this point in the history
  • Loading branch information
chuongmep committed May 14, 2024
1 parent ade6b62 commit 6f4bbcc
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions APSToolkitPython/src/aps_toolkit/Auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def auth2leg(self) -> Token:
result = Token(self.access_token, self.token_type, self.expires_in)
return result

def auth3leg(self, callback_url=None, scopes=None) -> Token:
def auth3leg(self, callback_url: str = None, scopes: str = None) -> Token:
"""
This method is used to authenticate a user using the 3-legged OAuth flow.
https://aps.autodesk.com/en/docs/oauth/v2/tutorials/get-3-legged-token/
Expand Down Expand Up @@ -219,7 +219,7 @@ def generate_code_challenge(code_verifier):
code_challenge = base64.urlsafe_b64encode(sha256).rstrip(b'=')
return code_challenge.decode()

def refresh_new_token(self, old_refresh_token) -> Token:
def refresh_new_token(self, old_refresh_token: str) -> Token:
Host = "https://developer.api.autodesk.com"
url = "/authentication/v2/token"

Expand Down
4 changes: 2 additions & 2 deletions APSToolkitPython/src/aps_toolkit/AuthGoogleColab.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class AuthGoogleColab(Auth):
def __init__(self, client_id: Optional[str] = None, client_secret: Optional[str] = None):
super().__init__(client_id, client_secret)

def auth3leg(self, callback_url=None, scopes=None) -> Token:
def auth3leg(self, callback_url: str = None, scopes: str = None) -> Token:
if not scopes:
scopes = 'data:read data:write data:create data:search bucket:create bucket:read bucket:update bucket:delete code:all'
if not callback_url:
Expand Down Expand Up @@ -56,7 +56,7 @@ def auth3leg(self, callback_url=None, scopes=None) -> Token:
refresh_token=response_json.get('refresh_token')
)

def auth3legPkce(self, clientId=None, callback_url=None, scopes=None) -> Token:
def auth3legPkce(self, clientId: str = None, callback_url: str = None, scopes: str = None) -> Token:
"""
This method is used to authenticate a user using the 3-legged OAuth PKCE flow.
https://aps.autodesk.com/blog/new-application-types
Expand Down
6 changes: 3 additions & 3 deletions APSToolkitPython/src/aps_toolkit/Bucket.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class PublicKey(Enum):


class Bucket:
def __init__(self, token: Token, region="US"):
def __init__(self, token: Token, region: str = "US"):
self.token = token
self.region = region
self.host = "https://developer.api.autodesk.com/oss/v2/buckets"
Expand Down Expand Up @@ -160,7 +160,7 @@ def delete_object(self, bucket_name: str, object_name: str) -> dict:
raise Exception(response.content)
return response.content

def download_object(self, bucket_name: str, object_name: str, file_path: str) -> None:
def download_object(self, bucket_name: str, object_name: str, file_path: str) -> bool:
"""
Downloads an object from a specified bucket in the Autodesk OSS API.
Expand All @@ -186,4 +186,4 @@ def download_object(self, bucket_name: str, object_name: str, file_path: str) ->
with open(file_path, "wb") as file:
file.write(response.content)
file.close()
return None
return True
3 changes: 2 additions & 1 deletion APSToolkitPython/src/aps_toolkit/DbReader.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@
from .Auth import Auth
import pandas as pd
import sqlite3
from .Token import Token


class DbReader:
def __init__(self, urn, token=None):
def __init__(self, urn: str, token: Token = None):
self.urn = urn
if token is None:
auth = Auth()
Expand Down

0 comments on commit 6f4bbcc

Please sign in to comment.