Skip to content

Commit 48f4374

Browse files
committed
handwritten: Fix D415 First line should end with a period, question mark, or exclamation point
1 parent a223b1e commit 48f4374

29 files changed

+215
-359
lines changed

src/handwritten/_install_daqmx.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ def _get_driver_details(
223223

224224

225225
def _install_daqmx_driver_windows_core(download_url: str) -> None:
226-
"""Download and launch NI-DAQmx Driver installation in an interactive mode"""
226+
"""Download and launch NI-DAQmx Driver installation in an interactive mode."""
227227
_validate_download_url(download_url)
228228
try:
229229
with _multi_access_temp_file() as temp_file:
@@ -249,7 +249,7 @@ def _install_daqmx_driver_windows_core(download_url: str) -> None:
249249

250250

251251
def _install_daqmx_driver_linux_core(download_url: str, release: str) -> None:
252-
"""Download NI Linux Device Drivers and install NI-DAQmx on Linux OS"""
252+
"""Download NI Linux Device Drivers and install NI-DAQmx on Linux OS."""
253253
if sys.platform.startswith("linux"):
254254
_validate_download_url(download_url)
255255
try:
@@ -313,7 +313,7 @@ def _validate_download_url(download_url: str) -> None:
313313

314314

315315
def _ask_user_confirmation(user_message: str) -> bool:
316-
"""Prompt for user confirmation"""
316+
"""Prompt for user confirmation."""
317317
while True:
318318
response = input(user_message + " (yes/no): ").strip().lower()
319319
if response in ["yes", "y"]:

src/handwritten/_lib.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,7 @@ def _setter(self, val):
5656

5757

5858
class CtypesByteString:
59-
"""Custom argtype that automatically converts unicode strings to encoding
60-
used by the DAQmx C API DLL in Python 3."""
59+
"""Custom argtype that automatically converts unicode strings to encoding used by the C API."""
6160

6261
@classmethod
6362
def from_param(cls, param):
@@ -70,8 +69,7 @@ def from_param(cls, param):
7069

7170

7271
def wrapped_ndpointer(*args, **kwargs):
73-
"""Specifies an ndpointer type that wraps numpy.ctypeslib.ndpointer and
74-
allows a value of None to be passed to an argument of that type.
72+
"""Wraps numpy.ctypeslib.ndpointer in order to allow passing None.
7573
7674
Taken from http://stackoverflow.com/questions/32120178
7775
"""

src/handwritten/errors.py

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,7 @@ class DaqNotSupportedError(Error):
2828

2929

3030
class DaqFunctionNotSupportedError(Error):
31-
"""Error raised when a specific function isn't supported by the installed
32-
version of the NI-DAQmx driver.
33-
"""
31+
"""Error raised when a specific function isn't supported by the installed NI-DAQmx driver."""
3432

3533
pass
3634

@@ -40,7 +38,7 @@ class DaqError(Error):
4038

4139
def __init__(self, message, error_code, task_name=""):
4240
"""Initialize a new DaqError.
43-
41+
4442
Args:
4543
message (string): Specifies the error message.
4644
error_code (int): Specifies the NI-DAQmx error code.
@@ -72,19 +70,16 @@ def error_code(self):
7270

7371
@property
7472
def error_type(self):
75-
""":class:`nidaqmx.error_codes.DAQmxErrors`: Specifies the NI-DAQmx
76-
error type."""
73+
""":class:`nidaqmx.error_codes.DAQmxErrors`: Specifies the NI-DAQmx error type."""
7774
return self._error_type
7875

7976

8077
class DaqReadError(DaqError):
81-
"""Error raised by DAQmx write method that includes the amount of data that was
82-
read.
83-
"""
78+
"""Error raised by DAQmx write method that includes the amount of data that was read."""
8479

8580
def __init__(self, message, error_code, samps_per_chan_read, task_name=""):
8681
"""Initialize a new DaqReadError.
87-
82+
8883
Args:
8984
message (string): Specifies the error message.
9085
error_code (int): Specifies the NI-DAQmx error code.
@@ -100,13 +95,11 @@ def samps_per_chan_read(self):
10095

10196

10297
class DaqWriteError(DaqError):
103-
"""Error raised by DAQmx write method that includes the amount of data that was
104-
written.
105-
"""
98+
"""Error raised by DAQmx write method that includes the amount of data that was written."""
10699

107100
def __init__(self, message, error_code, samps_per_chan_written, task_name=""):
108101
"""Initialize a new DaqWriteError.
109-
102+
110103
Args:
111104
message (string): Specifies the error message.
112105
error_code (int): Specifies the NI-DAQmx error code.
@@ -127,7 +120,7 @@ class DaqWarning(Warning):
127120

128121
def __init__(self, message, error_code):
129122
"""Initialize a new DaqWarning.
130-
123+
131124
Args:
132125
message (string): Specifies the warning message.
133126
error_code (int): Specifies the NI-DAQmx error code.
@@ -148,8 +141,7 @@ def error_code(self):
148141

149142
@property
150143
def error_type(self):
151-
""":class:`nidaqmx.error_codes.DAQmxWarnings`: Specifies the NI-DAQmx
152-
error type."""
144+
""":class:`nidaqmx.error_codes.DAQmxWarnings`: Specifies the NI-DAQmx error type."""
153145
return self._error_type
154146

155147

@@ -191,7 +183,7 @@ def is_array_buffer_too_small(error_code):
191183

192184

193185
class RpcError(Error):
194-
"""An error specific to sessions to the NI gRPC Device Server"""
186+
"""An error specific to sessions to the NI gRPC Device Server."""
195187

196188
def __init__(self, rpc_code, description):
197189
"""Initialize a new RpcError."""

src/handwritten/grpc_session_options.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def __init__(
5656
initialization_behavior=SessionInitializationBehavior.AUTO,
5757
):
5858
"""Initialize a new GrpcSessionOptions.
59-
59+
6060
Args:
6161
grpc_channel (grpc.Channel): Specifies the channel to the NI gRPC Device Server.
6262
session_name (str): User-specified name that identifies the driver session on the NI gRPC Device

src/handwritten/stream_readers/_analog_multi_channel_reader.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,12 @@
1111

1212

1313
class AnalogMultiChannelReader(ChannelReaderBase):
14-
"""Reads samples from one or more analog input channels in an NI-DAQmx
15-
task.
16-
"""
14+
"""Reads samples from one or more analog input channels in an NI-DAQmx task."""
1715

1816
def read_many_sample(
1917
self, data, number_of_samples_per_channel=READ_ALL_AVAILABLE, timeout=10.0
2018
):
21-
"""Reads one or more floating-point samples from one or more analog
22-
input channels in a task.
19+
"""Reads one or more floating-point samples from one or more analog input channels in a task.
2320
2421
This read method accepts a preallocated NumPy array to hold the
2522
samples requested, which can be advantageous for performance and
@@ -105,8 +102,7 @@ def read_many_sample(
105102
return samps_per_chan_read
106103

107104
def read_one_sample(self, data, timeout=10):
108-
"""Reads a single floating-point sample from one or more analog
109-
input channels in a task.
105+
"""Reads a single floating-point sample from one or more analog input channels in a task.
110106
111107
This read method accepts a preallocated NumPy array to hold the
112108
samples requested, which can be advantageous for performance and
@@ -149,8 +145,7 @@ def read_waveforms(
149145
reallocation_policy: ReallocationPolicy = ReallocationPolicy.TO_GROW,
150146
timeout: int = 10,
151147
) -> int:
152-
"""Reads one or more floating-point samples from one or more analog
153-
input channels into a list of waveforms.
148+
"""Reads one or more floating-point samples from one or more analog input channels into a list of waveforms.
154149
155150
This read method optionally accepts a preallocated list of waveforms to hold
156151
the samples requested, which can be advantageous for performance and

src/handwritten/stream_readers/_analog_single_channel_reader.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,12 @@
1111

1212

1313
class AnalogSingleChannelReader(ChannelReaderBase):
14-
"""Reads samples from an analog input channel in an NI-DAQmx task.
15-
"""
14+
"""Reads samples from an analog input channel in an NI-DAQmx task."""
1615

1716
def read_many_sample(
1817
self, data, number_of_samples_per_channel=READ_ALL_AVAILABLE, timeout=10.0
1918
):
20-
"""Reads one or more floating-point samples from a single analog
21-
input channel in a task.
19+
"""Reads one or more floating-point samples from a single analog input channel in a task.
2220
2321
This read method accepts a preallocated NumPy array to hold the
2422
samples requested, which can be advantageous for performance and
@@ -91,8 +89,7 @@ def read_many_sample(
9189
return samps_per_chan_read
9290

9391
def read_one_sample(self, timeout=10):
94-
"""Reads a single floating-point sample from a single analog input
95-
channel in a task.
92+
"""Reads a single floating-point sample from a single analog input channel in a task.
9693
9794
Args:
9895
timeout (Optional[float]): Specifies the amount of time in
@@ -120,8 +117,7 @@ def read_waveform(
120117
reallocation_policy: ReallocationPolicy = ReallocationPolicy.TO_GROW,
121118
timeout: int = 10,
122119
) -> int:
123-
"""Reads one or more floating-point samples from a single analog
124-
input channel into a waveform.
120+
"""Reads one or more floating-point samples from a single analog input channel into a waveform.
125121
126122
This read method optionally accepts a preallocated waveform to hold
127123
the samples requested, which can be advantageous for performance and

src/handwritten/stream_readers/_analog_unscaled_reader.py

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,10 @@
55

66

77
class AnalogUnscaledReader(ChannelReaderBase):
8-
"""Reads unscaled samples from one or more analog input channels in an
9-
NI-DAQmx task.
10-
"""
8+
"""Reads unscaled samples from one or more analog input channels in an NI-DAQmx task."""
119

1210
def read_int16(self, data, number_of_samples_per_channel=READ_ALL_AVAILABLE, timeout=10.0):
13-
"""Reads one or more unscaled 16-bit integer samples from one or
14-
more analog input channels in a task.
11+
"""Reads one or more unscaled 16-bit integer samples from one or more analog input channels in a task.
1512
1613
This read method accepts a preallocated NumPy array to hold the
1714
samples requested, which can be advantageous for performance and
@@ -97,8 +94,7 @@ def read_int16(self, data, number_of_samples_per_channel=READ_ALL_AVAILABLE, tim
9794
return samps_per_chan_read
9895

9996
def read_int32(self, data, number_of_samples_per_channel=READ_ALL_AVAILABLE, timeout=10.0):
100-
"""Reads one or more unscaled 32-bit integer samples from one or
101-
more analog input channels in a task.
97+
"""Reads one or more unscaled 32-bit integer samples from one or more analog input channels in a task.
10298
10399
This read method accepts a preallocated NumPy array to hold the
104100
samples requested, which can be advantageous for performance and
@@ -184,8 +180,7 @@ def read_int32(self, data, number_of_samples_per_channel=READ_ALL_AVAILABLE, tim
184180
return samps_per_chan_read
185181

186182
def read_uint16(self, data, number_of_samples_per_channel=READ_ALL_AVAILABLE, timeout=10.0):
187-
"""Reads one or more unscaled 16-bit unsigned integer samples from
188-
one or more analog input channels in a task.
183+
"""Reads one or more unscaled 16-bit unsigned integer samples from one or more analog input channels in a task.
189184
190185
This read method accepts a preallocated NumPy array to hold the
191186
samples requested, which can be advantageous for performance and
@@ -271,8 +266,7 @@ def read_uint16(self, data, number_of_samples_per_channel=READ_ALL_AVAILABLE, ti
271266
return samps_per_chan_read
272267

273268
def read_uint32(self, data, number_of_samples_per_channel=READ_ALL_AVAILABLE, timeout=10.0):
274-
"""Reads one or more unscaled unsigned 32-bit integer samples from
275-
one or more analog input channels in a task.
269+
"""Reads one or more unscaled unsigned 32-bit integer samples from one or more analog input channels in a task.
276270
277271
This read method accepts a preallocated NumPy array to hold the
278272
samples requested, which can be advantageous for performance and

src/handwritten/stream_readers/_channel_reader_base.py

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,11 @@
55

66

77
class ChannelReaderBase:
8-
"""Defines base class for all NI-DAQmx stream readers.
9-
"""
8+
"""Defines base class for all NI-DAQmx stream readers."""
109

1110
def __init__(self, task_in_stream):
1211
"""Initialize a new ChannelReaderBase.
13-
12+
1413
Args:
1514
task_in_stream: Specifies the input stream associated with
1615
an NI-DAQmx task from which to read samples.
@@ -24,12 +23,12 @@ def __init__(self, task_in_stream):
2423

2524
@property
2625
def verify_array_shape(self):
27-
"""bool: Indicates whether the size and shape of the user-defined
28-
NumPy arrays passed to read methods are verified. Defaults
29-
to True when this object is instantiated.
26+
"""bool: Specifies whether to verify the shape of NumPy arrays.
27+
28+
Defaults to True when this object is instantiated.
3029
31-
Setting this property to True may marginally adversely
32-
impact the performance of read methods.
30+
Setting this property to True may marginally adversely
31+
impact the performance of read methods.
3332
"""
3433
return self._verify_array_shape
3534

@@ -38,7 +37,9 @@ def verify_array_shape(self, val):
3837
self._verify_array_shape = val
3938

4039
def _verify_array(self, data, number_of_samples_per_channel, is_many_chan, is_many_samp):
41-
"""Verifies that the shape of the specified NumPy array can be used
40+
"""Verify the shape of a NumPy array.
41+
42+
Verifies that the shape of the specified NumPy array can be used
4243
to read multiple samples from the current task which contains
4344
one or more channels, if the "verify_array_shape" property is
4445
set to True.
@@ -82,7 +83,9 @@ def _verify_array(self, data, number_of_samples_per_channel, is_many_chan, is_ma
8283
)
8384

8485
def _verify_array_digital_lines(self, data, is_many_chan, is_many_line):
85-
"""Verifies that the shape of the specified NumPy array can be used
86+
"""Verify the shape of a NumPy array of digital lines.
87+
88+
Verifies that the shape of the specified NumPy array can be used
8689
to read samples from the current task which contains one or more
8790
channels that have one or more digital lines per channel, if the
8891
"verify_array_shape" property is set to True.

0 commit comments

Comments
 (0)