@@ -64,14 +64,14 @@ def get_java_from_env():
6464
6565 Returns:
6666 tuple: (java_home, java_exe, javac_exe, found) where found is True if JAVA_HOME is set.
67+
6768 """
6869 java_home = os .environ .get ("JAVA_HOME" )
6970 if java_home and os .path .isdir (java_home ):
7071 java_exe = os .path .join (java_home , "bin" , "java" )
7172 javac_exe = os .path .join (java_home , "bin" , "javac" )
7273 return java_home , java_exe , javac_exe , True
73- else :
74- return "/path/to/java" , "/path/to/java/bin/java" , "/path/to/java/bin/javac" , False
74+ return "/path/to/java" , "/path/to/java/bin/java" , "/path/to/java/bin/javac" , False
7575
7676
7777def runSetup (download , insecure_ssl = False ):
@@ -80,7 +80,7 @@ def runSetup(download, insecure_ssl=False):
8080 print ("=" * 60 )
8181
8282 cwd = os .getcwd ()
83- parent , base = os .path .split (cwd )
83+ parent , _base = os .path .split (cwd )
8484 data_dir = os .path .join (parent , "data" )
8585 idx_dir = os .path .join (parent , "indices" )
8686
@@ -155,11 +155,11 @@ def runSetup(download, insecure_ssl=False):
155155
156156 print (f"\n [{ i } /{ len (DATA_FILES )} ] Processing: { local_filename } " )
157157 if os .path .exists (target_file ):
158- print (f " File already exists - skipping" )
158+ print (" File already exists - skipping" )
159159 else :
160160 print (f" Source URL: { url_source } " )
161161 print (f" Destination: { target_file } " )
162- print (f " Starting download (this might take a while)..." )
162+ print (" Starting download (this might take a while)..." )
163163 Downloader (url_source , target_file , insecure_ssl ).download ()
164164 print ()
165165 print (f" Download complete: { local_filename } " )
@@ -179,8 +179,8 @@ def runSetup(download, insecure_ssl=False):
179179 print (f" NAD zip file not found at { nad_zip } - skipping taxonomy generation" )
180180 else :
181181 print (f" Generating NAD taxonomy from { nad_zip } " )
182- print (f " This processes ~92M address records and may take several minutes..." )
183- from generateNADTaxonomies import generate_nad_taxonomy
182+ print (" This processes ~92M address records and may take several minutes..." )
183+ from generateNADTaxonomies import generate_nad_taxonomy # noqa: PLC0415 - conditional import, only needed when NAD data exists
184184
185185 generate_nad_taxonomy (parent )
186186 print (f" NAD taxonomy generation complete: { nad_taxonomy } " )
@@ -205,31 +205,31 @@ def __init__(self, url, target_path, insecure_ssl=False):
205205 Downloader .index = 0
206206
207207 def download (self ):
208- print (f " Configuring SSL context..." )
208+ print (" Configuring SSL context..." )
209209 # Handle SSL certificate configuration
210210 if self .__insecure_ssl :
211211 print (" Warning: Using insecure SSL context (certificate verification disabled)" )
212- ssl_context = ssl ._create_unverified_context ()
212+ ssl_context = ssl ._create_unverified_context () # noqa: S323 - intentional: user explicitly opted in via --insecure-ssl
213213 else :
214214 try :
215215 # Try to use certifi bundle if available
216- import certifi
216+ import certifi # noqa: PLC0415 - conditional import for optional dependency
217217
218- print (f " Using certifi SSL certificates" )
218+ print (" Using certifi SSL certificates" )
219219 ssl_context = ssl .create_default_context (cafile = certifi .where ())
220220 except ImportError :
221221 # Fall back to system certificates
222- print (f " Using system SSL certificates" )
222+ print (" Using system SSL certificates" )
223223 ssl_context = ssl .create_default_context ()
224224
225225 # Install SSL context
226- print (f " Setting up HTTP handler..." )
226+ print (" Setting up HTTP handler..." )
227227 https_handler = request .HTTPSHandler (context = ssl_context )
228228 opener = request .build_opener (https_handler )
229229 opener .addheaders = [("User-agent" , "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36" )]
230230 request .install_opener (opener )
231231
232- print (f " Initiating download..." )
232+ print (" Initiating download..." )
233233 try :
234234 request .urlretrieve (self .__url , self .__target_path , Downloader .reporthook )
235235 except ssl .SSLError as e :
0 commit comments