From c257bd5949917469ba327ddae2ff34a31d49ac9a Mon Sep 17 00:00:00 2001 From: Anthony Romaniello <66272872+aromanielloNTIA@users.noreply.github.com> Date: Tue, 30 Apr 2024 11:14:49 -0600 Subject: [PATCH] Update pre-commit hooks, clean up LICENSE markdown, Python 3.12 support (#20) * Better formatting for LICENSE.md * No longer exclude LICENSE.md from markdownlint * Update all pre-commit hooks and run on all files * Use py38-plus pyupgrade flag * Include up to Python 3.12 as supported --- .pre-commit-config.yaml | 14 +++++++------- LICENSE.md | 35 ++++++++++++++++++++++++++++------- pyproject.toml | 2 ++ src/rsa_api/rsa_api.py | 3 ++- tests/test_rsa_api.py | 1 + 5 files changed, 40 insertions(+), 15 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b318137..824a318 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,7 +2,7 @@ default_language_version: python: python3.8 repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 + rev: v4.5.0 hooks: - id: check-ast types: [file, python] @@ -16,25 +16,25 @@ repos: - id: end-of-file-fixer - id: trailing-whitespace - repo: https://github.com/asottile/pyupgrade - rev: v3.3.1 + rev: v3.15.2 hooks: - id: pyupgrade - args: ["--py3-plus"] + args: ["--py38-plus"] - repo: https://github.com/pycqa/isort - rev: 5.12.0 + rev: 5.13.2 hooks: - id: isort name: isort (python) types: [file, python] args: ["--profile", "black", "--filter-files", "--gitignore"] - repo: https://github.com/psf/black - rev: 23.3.0 + rev: 24.4.2 hooks: - id: black types: [file, python] - repo: https://github.com/igorshubovych/markdownlint-cli - rev: v0.33.0 + rev: v0.40.0 hooks: - id: markdownlint types: [file, markdown] - exclude: GitHubRepoPublicReleaseApproval.md|LICENSE.md + exclude: GitHubRepoPublicReleaseApproval.md diff --git a/LICENSE.md b/LICENSE.md index fd7fe11..add8ca7 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,13 +1,34 @@ -SOFTWARE DISCLAIMER / RELEASE +# SOFTWARE DISCLAIMER / RELEASE -This software was developed by employees of the National Telecommunications and Information Administration (NTIA), an agency of the Federal Government and is provided to you as a public service. Pursuant to Title 15 United States Code Section 105, works of NTIA employees are not subject to copyright protection within the United States. +This software was developed by employees of the National Telecommunications and Information +Administration (NTIA), an agency of the Federal Government and is provided to you +as a public service. Pursuant to Title 15 United States Code Section 105, works +of NTIA employees are not subject to copyright protection within the United States. -The software is provided by NTIA “AS IS.” NTIA MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NTIA does not warrant or make any representations regarding the use of the software or the results thereof, including but not limited to the correctness, accuracy, reliability or usefulness of the software. +The software is provided by NTIA “AS IS.” NTIA MAKES NO WARRANTY OF ANY KIND, EXPRESS, +IMPLIED OR STATUTORY, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NTIA does +not warrant or make any representations regarding the use of the software or the +results thereof, including but not limited to the correctness, accuracy, reliability +or usefulness of the software. -To the extent that NTIA holds rights in countries other than the United States, you are hereby granted the non-exclusive irrevocable and unconditional right to print, publish, prepare derivative works and distribute the NTIA software, in any medium, or authorize others to do so on your behalf, on a royalty-free basis throughout the World. +To the extent that NTIA holds rights in countries other than the United States, +you are hereby granted the non-exclusive irrevocable and unconditional right to +print, publish, prepare derivative works and distribute the NTIA software, in any +medium, or authorize others to do so on your behalf, on a royalty-free basis throughout +the World. -You may improve, modify, and create derivative works of the software or any portion of the software, and you may copy and distribute such modifications or works. Modified works should carry a notice stating that you changed the software and should note the date and nature of any such change. +You may improve, modify, and create derivative works of the software or any portion +of the software, and you may copy and distribute such modifications or works. Modified +works should carry a notice stating that you changed the software and should note +the date and nature of any such change. -You are solely responsible for determining the appropriateness of using and distributing the software and you assume all risks associated with its use, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and the unavailability or interruption of operation. This software is not intended to be used in any situation where a failure could cause risk of injury or damage to property. +You are solely responsible for determining the appropriateness of using and distributing +the software and you assume all risks associated with its use, including but not +limited to the risks and costs of program errors, compliance with applicable laws, +damage to or loss of data, programs or equipment, and the unavailability or interruption +of operation. This software is not intended to be used in any situation where a failure +could cause risk of injury or damage to property. -Please provide appropriate acknowledgments of NTIA’s creation of the software in any copies or derivative works of this software. +Please provide appropriate acknowledgments of NTIA’s creation of the software in +any copies or derivative works of this software. diff --git a/pyproject.toml b/pyproject.toml index 56b3fb6..1f57a49 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,6 +34,8 @@ classifiers = [ "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", ] dependencies = [ diff --git a/src/rsa_api/rsa_api.py b/src/rsa_api/rsa_api.py index 1724337..0231f90 100644 --- a/src/rsa_api/rsa_api.py +++ b/src/rsa_api/rsa_api.py @@ -3,6 +3,7 @@ Refer to the RSA API Programming Reference Manual for details on any functions implemented from this module. """ + import logging import tempfile from ctypes import * @@ -143,7 +144,7 @@ class _IQStreamIQInfo(Structure): # "IQSTRMIQINFO" in RSA_API.h class RSAError(Exception): def __init__(self, err_txt=""): self.err_txt = err_txt - err = "RSA Error: {}".format(self.err_txt) + err = f"RSA Error: {self.err_txt}" super().__init__(err) diff --git a/tests/test_rsa_api.py b/tests/test_rsa_api.py index 990d143..1d79e7b 100644 --- a/tests/test_rsa_api.py +++ b/tests/test_rsa_api.py @@ -2,6 +2,7 @@ This is a test for the entire API Wrapper. It requires a compatible RSA device to be connected. """ + import unittest from os import environ, mkdir from os.path import isdir