3737
3838
3939def _parse_version (version : str ) -> tuple [int , ...]:
40- """
41- Split the version string into a tuple of integers.
40+ """Split the version string into a tuple of integers.
4241
4342 >>> _parse_version("23.8.0")
4443 (23, 8, 0)
@@ -57,10 +56,7 @@ def _parse_version(version: str) -> tuple[int, ...]:
5756
5857
5958def _get_daqmx_installed_version () -> str | None :
60- """
61- Check for existing installation of NI-DAQmx.
62-
63- """
59+ """Check for existing installation of NI-DAQmx."""
6460 if sys .platform .startswith ("win" ):
6561 try :
6662 _logger .debug ("Reading the registry entries to get installed DAQmx version" )
@@ -130,10 +126,7 @@ def _get_daqmx_installed_version() -> str | None:
130126# Creating a temp file that we then close and yield - this is used to allow subprocesses to access
131127@contextlib .contextmanager
132128def _multi_access_temp_file (* , suffix : str = ".exe" , delete : bool = True ) -> Generator [str ]:
133- """
134- Context manager for creating a temporary file.
135-
136- """
129+ """Context manager for creating a temporary file."""
137130 try :
138131 temp_file = tempfile .NamedTemporaryFile (suffix = suffix , delete = False , mode = "w" )
139132 temp_file .close ()
@@ -161,8 +154,7 @@ def _multi_access_temp_file(*, suffix: str = ".exe", delete: bool = True) -> Gen
161154def _load_data (
162155 json_data : str , platform : str
163156) -> tuple [str | None , str | None , str | None , list [str ] | None ]:
164- """
165- Load data from JSON string and extract Windows metadata.
157+ """Load data from JSON string and extract Windows metadata.
166158
167159 >>> json_data = '{"Windows": [{"Location": "path/to/windows/driver", "Version": "24.0", "Release": "2024Q1", "supportedOS": ["Windows 11"]}], "Linux": []}'
168160 >>> _load_data(json_data, "Windows")
@@ -214,10 +206,7 @@ def _load_data(
214206def _get_driver_details (
215207 platform : str ,
216208) -> tuple [str | None , str | None , str | None , list [str ] | None ]:
217- """
218- Parse the JSON data and retrieve the download link and version information.
219-
220- """
209+ """Parse the JSON data and retrieve the download link and version information."""
221210 try :
222211 with pkg_resources .open_text (__package__ , METADATA_FILE ) as json_file :
223212 _logger .debug ("Opening the metadata file %s." , METADATA_FILE )
@@ -234,10 +223,7 @@ def _get_driver_details(
234223
235224
236225def _install_daqmx_driver_windows_core (download_url : str ) -> None :
237- """
238- Download and launch NI-DAQmx Driver installation in an interactive mode
239-
240- """
226+ """Download and launch NI-DAQmx Driver installation in an interactive mode"""
241227 _validate_download_url (download_url )
242228 try :
243229 with _multi_access_temp_file () as temp_file :
@@ -263,10 +249,7 @@ def _install_daqmx_driver_windows_core(download_url: str) -> None:
263249
264250
265251def _install_daqmx_driver_linux_core (download_url : str , release : str ) -> None :
266- """
267- Download NI Linux Device Drivers and install NI-DAQmx on Linux OS
268-
269- """
252+ """Download NI Linux Device Drivers and install NI-DAQmx on Linux OS"""
270253 if sys .platform .startswith ("linux" ):
271254 _validate_download_url (download_url )
272255 try :
@@ -330,10 +313,7 @@ def _validate_download_url(download_url: str) -> None:
330313
331314
332315def _ask_user_confirmation (user_message : str ) -> bool :
333- """
334- Prompt for user confirmation
335-
336- """
316+ """Prompt for user confirmation"""
337317 while True :
338318 response = input (user_message + " (yes/no): " ).strip ().lower ()
339319 if response in ["yes" , "y" ]:
@@ -349,10 +329,7 @@ def _upgrade_daqmx_user_confirmation(
349329 latest_version : str ,
350330 release : str ,
351331) -> bool :
352- """
353- Confirm with the user and return the user response.
354-
355- """
332+ """Confirm with the user and return the user response."""
356333 _logger .debug ("Entering _upgrade_daqmx_user_confirmation" )
357334 installed_parts = _parse_version (installed_version )
358335 latest_parts = _parse_version (latest_version )
@@ -371,21 +348,15 @@ def _fresh_install_daqmx_user_confirmation(
371348 latest_version : str ,
372349 release : str ,
373350) -> bool :
374- """
375- Confirm with the user and return the user response.
376-
377- """
351+ """Confirm with the user and return the user response."""
378352 _logger .debug ("Entering _fresh_install_daqmx_user_confirmation" )
379353 return _ask_user_confirmation (
380354 f"Latest NI-DAQmx version available is { latest_version } ({ release } ). Do you want to install?"
381355 )
382356
383357
384358def _is_distribution_supported () -> None :
385- """
386- Raises an exception if the linux distribution and its version are not supported.
387-
388- """
359+ """Raises an exception if the linux distribution and its version are not supported."""
389360 if sys .platform .startswith ("linux" ):
390361 dist_name = distro .id ()
391362 dist_version = distro .version ()
@@ -409,10 +380,7 @@ def _is_distribution_supported() -> None:
409380
410381
411382def _install_daqmx_driver ():
412- """
413- Install the NI-DAQmx driver.
414-
415- """
383+ """Install the NI-DAQmx driver."""
416384 if sys .platform .startswith ("win" ):
417385 _logger .info ("Windows platform detected" )
418386 platform = "Windows"
@@ -453,10 +421,7 @@ def _install_daqmx_driver():
453421
454422
455423def installdriver () -> None :
456- """
457- Download and launch NI-DAQmx Driver installation in an interactive mode.
458-
459- """
424+ """Download and launch NI-DAQmx Driver installation in an interactive mode."""
460425 try :
461426 _install_daqmx_driver ()
462427 except click .ClickException :
0 commit comments