Skip to content

Commit 7709d2b

Browse files
committed
handwritten: nps acknowledge-existing-violations --aggressive
1 parent 6c4914c commit 7709d2b

34 files changed

+242
-178
lines changed

src/handwritten/__init__.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
DaqWarning,
88
DaqWriteError,
99
)
10-
from nidaqmx.grpc_session_options import *
10+
from nidaqmx.grpc_session_options import * # noqa: F403 - 'from nidaqmx.grpc_session_options import *' used; unable to detect undefined names (auto-generated noqa)
1111
from nidaqmx.scale import Scale
1212
from nidaqmx.task import Task
1313
from nidaqmx.types import CtrFreq, CtrTick, CtrTime
@@ -19,7 +19,13 @@
1919

2020
__version__ = version(__name__)
2121

22-
__all__ = ["errors", "scale", "stream_readers", "stream_writers", "task"]
22+
__all__ = [ # noqa: F405 - 'errors' may be undefined, or defined from star imports: nidaqmx.grpc_session_options (auto-generated noqa)
23+
"errors",
24+
"scale",
25+
"stream_readers",
26+
"stream_writers",
27+
"task",
28+
]
2329

2430
# Do not add a null logging handler. If the application has not configured logging, the
2531
# default behavior is to log warnings and errors to stderr.

src/handwritten/__main__.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,14 @@
1717
count=True,
1818
help="Enable verbose logging. Repeat to increase verbosity.",
1919
)
20-
def main(verbosity: int) -> None:
20+
def main( # noqa: D103 - Missing docstring in public function (auto-generated noqa)
21+
verbosity: int,
22+
) -> None:
2123
_configure_logging(verbosity)
2224

2325

2426
@main.command()
25-
def installdriver():
27+
def installdriver(): # noqa: D103 - Missing docstring in public function (auto-generated noqa)
2628
_install_daqmx.installdriver()
2729

2830

src/handwritten/_grpc_time.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
_EPOCH_1970 = ht_datetime(1970, 1, 1, tzinfo=timezone.utc)
2121

2222

23-
def convert_time_to_timestamp(
23+
def convert_time_to_timestamp( # noqa: D103 - Missing docstring in public function (auto-generated noqa)
2424
dt: std_datetime | ht_datetime, ts: GrpcTimestamp | None = None
2525
) -> GrpcTimestamp:
2626
seconds_since_1970 = 0
@@ -45,7 +45,9 @@ def convert_time_to_timestamp(
4545
return ts
4646

4747

48-
def convert_timestamp_to_time(ts: GrpcTimestamp, tzinfo: dt_tzinfo | None = None) -> ht_datetime:
48+
def convert_timestamp_to_time( # noqa: D103 - Missing docstring in public function (auto-generated noqa)
49+
ts: GrpcTimestamp, tzinfo: dt_tzinfo | None = None
50+
) -> ht_datetime:
4951
total_nanos = ts.ToNanoseconds()
5052
seconds, nanos = divmod(total_nanos, _NS_PER_S)
5153
# Convert the nanoseconds to yoctoseconds.

src/handwritten/_install_daqmx.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ def _load_data(
176176
Traceback (most recent call last):
177177
click.exceptions.ClickException: Unsupported os 'macOS'
178178
179-
"""
179+
""" # noqa: W505 - doc line too long (159 > 100 characters) (auto-generated noqa)
180180
try:
181181
if platform == "Windows":
182182
metadata = json.loads(json_data).get("Windows", [])

src/handwritten/_lib.py

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@
3636
)
3737

3838

39-
class c_bool32(ctypes.c_uint):
39+
class c_bool32( # noqa: N801 - class name 'c_bool32' should use CapWords convention (auto-generated noqa)
40+
ctypes.c_uint
41+
):
4042
"""Specifies a custom ctypes data type to represent 32-bit booleans."""
4143

4244
# typeshed specifies that _SimpleCData[_T].value is an instance variable with type _T, so
@@ -58,7 +60,9 @@ class CtypesByteString:
5860
"""Custom argtype that automatically converts unicode strings to encoding used by the C API."""
5961

6062
@classmethod
61-
def from_param(cls, param):
63+
def from_param( # noqa: D102 - Missing docstring in public method (auto-generated noqa)
64+
cls, param
65+
):
6266
if isinstance(param, str):
6367
param = param.encode(lib_importer.encoding)
6468
return ctypes.c_char_p(param)
@@ -94,7 +98,9 @@ def __init__(self, library):
9498
self._library = library
9599
self._lib_lock = threading.Lock()
96100

97-
def __getattr__(self, function):
101+
def __getattr__( # noqa: D105 - Missing docstring in magic method (auto-generated noqa)
102+
self, function
103+
):
98104
try:
99105
cfunc = getattr(self._library, function)
100106
if not hasattr(cfunc, "arglock"):
@@ -141,27 +147,31 @@ def __init__(self):
141147
self._encoding = None
142148

143149
@property
144-
def windll(self):
150+
def windll(self): # noqa: D102 - Missing docstring in public method (auto-generated noqa)
145151
if self._windll is None:
146152
self._import_lib()
147153
return self._windll
148154

149155
@property
150-
def cdll(self):
156+
def cdll(self): # noqa: D102 - Missing docstring in public method (auto-generated noqa)
151157
if self._cdll is None:
152158
self._import_lib()
153159
return self._cdll
154160

155161
@property
156-
def task_handle(self) -> type:
162+
def task_handle( # noqa: D102 - Missing docstring in public method (auto-generated noqa)
163+
self,
164+
) -> type:
157165
return TaskHandle
158166

159167
@property
160-
def cal_handle(self) -> type:
168+
def cal_handle( # noqa: D102 - Missing docstring in public method (auto-generated noqa)
169+
self,
170+
) -> type:
161171
return CalHandle
162172

163173
@property
164-
def encoding(self):
174+
def encoding(self): # noqa: D102 - Missing docstring in public method (auto-generated noqa)
165175
if self._encoding is None:
166176
self._import_lib()
167177
return self._encoding

src/handwritten/_lib_time.py

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010

1111

1212
@functools.total_ordering
13-
class AbsoluteTime(ctypes.Structure):
13+
class AbsoluteTime( # noqa: D101 - Missing docstring in public class (auto-generated noqa)
14+
ctypes.Structure
15+
):
1416
# Please visit ni.com/info and enter the Info Code NI_BTF for detailed information.
1517
# The summary is:
1618
# * lsb - positive fractions (2^-64) of a second
@@ -33,7 +35,9 @@ class AbsoluteTime(ctypes.Structure):
3335
_EPOCH_1904 = ht_datetime(1904, 1, 1, tzinfo=timezone.utc)
3436

3537
@classmethod
36-
def from_datetime(cls, dt: std_datetime | ht_datetime) -> AbsoluteTime:
38+
def from_datetime( # noqa: D102 - Missing docstring in public method (auto-generated noqa)
39+
cls, dt: std_datetime | ht_datetime
40+
) -> AbsoluteTime:
3741
seconds_since_1904 = 0
3842

3943
# Convert the subseconds.
@@ -51,7 +55,9 @@ def from_datetime(cls, dt: std_datetime | ht_datetime) -> AbsoluteTime:
5155

5256
return AbsoluteTime(lsb=lsb, msb=seconds_since_1904)
5357

54-
def to_datetime(self, tzinfo: dt_tzinfo | None = None) -> ht_datetime:
58+
def to_datetime( # noqa: D102 - Missing docstring in public method (auto-generated noqa)
59+
self, tzinfo: dt_tzinfo | None = None
60+
) -> ht_datetime:
5561
total_yoctoseconds = int(
5662
round(AbsoluteTime._YS_PER_S * self.lsb / AbsoluteTime._NUM_SUBSECONDS)
5763
)
@@ -62,13 +68,19 @@ def to_datetime(self, tzinfo: dt_tzinfo | None = None) -> ht_datetime:
6268
)
6369
return _convert_to_desired_timezone(dt, tzinfo)
6470

65-
def __str__(self) -> str:
71+
def __str__( # noqa: D105 - Missing docstring in magic method (auto-generated noqa)
72+
self,
73+
) -> str:
6674
return f"AbsoluteTime(lsb=0x{self.lsb:x}, msb=0x{self.msb:x})"
6775

68-
def __eq__(self, other) -> bool:
76+
def __eq__( # noqa: D105 - Missing docstring in magic method (auto-generated noqa)
77+
self, other
78+
) -> bool:
6979
return self.msb == other.msb and self.lsb == other.lsb
7080

71-
def __lt__(self, other) -> bool:
81+
def __lt__( # noqa: D105 - Missing docstring in magic method (auto-generated noqa)
82+
self, other
83+
) -> bool:
7284
if self.msb == other.msb:
7385
return self.lsb < other.lsb
7486
else:

src/handwritten/_linux_installation_commands.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def _get_version_rhel(dist_version: str) -> str:
6060

6161

6262
@dataclass
63-
class DistroInfo:
63+
class DistroInfo: # noqa: D101 - Missing docstring in public class (auto-generated noqa)
6464
get_distro_version: Callable[[str], str]
6565
get_daqmx_version: list[str]
6666
install_commands: list[list[str]]

src/handwritten/_time.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def _convert_to_desired_timezone(
2525
desired_expected_time = tzinfo.fromutc(localized_time)
2626
return desired_expected_time
2727

28-
# if the tzinfo passed in is a timedelta function, then we don't need to consider daylight savings
28+
# if the tzinfo passed in is a timedelta function, then we don't need to consider daylight savings # noqa: W505 - doc line too long (102 > 100 characters) (auto-generated noqa)
2929
elif tzinfo.utcoffset(None) is not None:
3030
current_time_utc = ht_datetime.now(timezone.utc)
3131
desired_timezone_offset = current_time_utc.astimezone(tz=tzinfo).utcoffset()

src/handwritten/errors.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def __init__(self, message, error_code, task_name=""):
4242
Args:
4343
message (string): Specifies the error message.
4444
error_code (int): Specifies the NI-DAQmx error code.
45-
"""
45+
""" # noqa: D417 - Missing argument descriptions in the docstring (auto-generated noqa)
4646
self._error_code = int(error_code)
4747

4848
try:
@@ -57,7 +57,7 @@ def __init__(self, message, error_code, task_name=""):
5757
if task_name:
5858
message = f"{message}\n\nTask Name: {task_name}"
5959

60-
# We do not know where the error description came from, so we add the status code if it is not already in the message
60+
# We do not know where the error description came from, so we add the status code if it is not already in the message # noqa: W505 - doc line too long (125 > 100 characters) (auto-generated noqa)
6161
if str(self._error_code) not in message:
6262
message = f"{message}\n\nStatus Code: {self._error_code}"
6363

@@ -83,7 +83,7 @@ def __init__(self, message, error_code, samps_per_chan_read, task_name=""):
8383
Args:
8484
message (string): Specifies the error message.
8585
error_code (int): Specifies the NI-DAQmx error code.
86-
"""
86+
""" # noqa: D417 - Missing argument descriptions in the docstring (auto-generated noqa)
8787
super().__init__(message, error_code, task_name)
8888

8989
self._samps_per_chan_read = samps_per_chan_read
@@ -104,7 +104,7 @@ def __init__(self, message, error_code, samps_per_chan_written, task_name=""):
104104
message (string): Specifies the error message.
105105
error_code (int): Specifies the NI-DAQmx error code.
106106
samps_per_chan_written (int): Specifies the number of samples written.
107-
"""
107+
""" # noqa: D417 - Missing argument descriptions in the docstring (auto-generated noqa)
108108
super().__init__(message, error_code, task_name)
109109

110110
self._samps_per_chan_written = samps_per_chan_written

src/handwritten/grpc_session_options.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111

1212
# This constant specifies the gRPC package and service used by this API.
13-
# Customers can pass this value to the MeasurementLink discovery service to resolve the server instance that provides this interface.
13+
# Customers can pass this value to the MeasurementLink discovery service to resolve the server instance that provides this interface. # noqa: W505 - doc line too long (133 > 100 characters) (auto-generated noqa)
1414
GRPC_SERVICE_INTERFACE_NAME = "nidaqmx_grpc.NiDAQmx"
1515

1616
# This constant specifies the API license key required by the NI gRPC Device Server that comes with
@@ -29,21 +29,21 @@ class SessionInitializationBehavior(IntEnum):
2929
When using the Session as a context manager and the context exits, the behavior depends on what happened when the constructor
3030
was called. If it resulted in a new session being initialized on the NI gRPC Device Server, then it will automatically close the
3131
server session. If it instead attached to an existing session, then it will detach from the server session and leave it open.
32-
"""
32+
""" # noqa: W505 - doc line too long (123 > 100 characters) (auto-generated noqa)
3333
INITIALIZE_SERVER_SESSION = 1
3434
r"""
3535
Require the NI gRPC Device Server to initialize a new session with the specified name.
3636
Note:
3737
When using the Session as a context manager and the context exits, it will automatically close the
3838
server session.
39-
"""
39+
""" # noqa: W505 - doc line too long (102 > 100 characters) (auto-generated noqa)
4040
ATTACH_TO_SERVER_SESSION = 2
4141
r"""
4242
Require the NI gRPC Device Server to attach to an existing session with the specified name.
4343
Note:
4444
When using the Session as a context manager and the context exits, it will detach from the server session
4545
and leave it open.
46-
"""
46+
""" # noqa: W505 - doc line too long (109 > 100 characters) (auto-generated noqa)
4747

4848

4949
class GrpcSessionOptions:
@@ -70,7 +70,7 @@ def __init__(
7070
initialization_behavior (enum): Specifies whether it is acceptable to initialize a new
7171
session or attach to an existing one, or if only one of the behaviors is desired.
7272
The driver session exists on the NI gRPC Device Server.
73-
"""
73+
""" # noqa: W505 - doc line too long (108 > 100 characters) (auto-generated noqa)
7474
self.grpc_channel = grpc_channel
7575
self.session_name = session_name
7676
self.api_key = api_key

0 commit comments

Comments
 (0)