99import time
1010import urllib
1111from pathlib import Path
12- from typing import Optional , Union
1312from zipfile import ZipFile
1413
1514from parsons .etl import Table
@@ -64,7 +63,7 @@ def __init__(
6463 client_secret : str ,
6564 sftp_username : str ,
6665 sftp_password : str ,
67- client_audience : Optional [ str ] = None ,
66+ client_audience : str | None = None ,
6867 ) -> None :
6968 self .client_id = client_id
7069 self .client_secret = client_secret
@@ -78,7 +77,7 @@ def __init__(
7877 )
7978 self .sftp = SFTP ("t.catalist.us" , sftp_username , sftp_password , timeout = 7200 )
8079
81- def load_table_to_sftp (self , table : Table , input_subfolder : Optional [ str ] = None ) -> str :
80+ def load_table_to_sftp (self , table : Table , input_subfolder : str | None = None ) -> str :
8281 """Load table to Catalist sftp bucket as gzipped CSV for matching.
8382
8483 If input_subfolder is specific, the file will be uploaded to a subfolder of the
@@ -114,11 +113,11 @@ def match(
114113 self ,
115114 table : Table ,
116115 export : bool = False ,
117- description : Optional [ str ] = None ,
118- export_filename_suffix : Optional [ str ] = None ,
119- input_subfolder : Optional [ str ] = None ,
116+ description : str | None = None ,
117+ export_filename_suffix : str | None = None ,
118+ input_subfolder : str | None = None ,
120119 copy_to_sandbox : bool = False ,
121- static_values : Optional [ dict [str , Union [ str , int ]]] = None ,
120+ static_values : dict [str , str | int ] | None = None ,
122121 wait : int = 30 ,
123122 ) -> Table :
124123 """Load table to the Catalist Match API, returns matched table.
@@ -165,11 +164,11 @@ def upload(
165164 table : Table ,
166165 template_id : str = "48827" ,
167166 export : bool = False ,
168- description : Optional [ str ] = None ,
169- export_filename_suffix : Optional [ str ] = None ,
170- input_subfolder : Optional [ str ] = None ,
167+ description : str | None = None ,
168+ export_filename_suffix : str | None = None ,
169+ input_subfolder : str | None = None ,
171170 copy_to_sandbox : bool = False ,
172- static_values : Optional [ dict [str , Union [ str , int ]]] = None ,
171+ static_values : dict [str , str | int ] | None = None ,
173172 ) -> dict :
174173 """Load table to the Catalist Match API, returns response with job metadata.
175174
@@ -222,7 +221,7 @@ def upload(
222221 endpoint = "/" .join (endpoint_params )
223222
224223 # Assemble query parameters
225- query_params : dict [str , Union [ str , int ] ] = {"token" : self .connection .token ["access_token" ]}
224+ query_params : dict [str , str | int ] = {"token" : self .connection .token ["access_token" ]}
226225 if copy_to_sandbox :
227226 query_params ["copyToSandbox" ] = "true"
228227 if static_values :
@@ -242,10 +241,10 @@ def upload(
242241
243242 def action (
244243 self ,
245- file_ids : Union [ str , list [str ] ],
244+ file_ids : str | list [str ],
246245 match : bool = False ,
247246 export : bool = False ,
248- export_filename_suffix : Optional [ str ] = None ,
247+ export_filename_suffix : str | None = None ,
249248 copy_to_sandbox : bool = False ,
250249 ) -> list [dict ]:
251250 """Perform actions on existing files.
0 commit comments