Skip to content

Commit 84a5cf8

Browse files
committed
codegen, handwritten: Use tuple for empty __slots__
Work around python/mypy#10870 - Mypy complains when [] is used for __slots__ definition generated\nidaqmx\_base_interpreter.py:8: error: Need type annotation for "__slots__" (hint: "__slots__: List[<type>] = ...") [var-annotated] Signed-off-by: Brad Keryan <[email protected]>
1 parent 233833f commit 84a5cf8

30 files changed

+32
-32
lines changed

generated/nidaqmx/_base_interpreter.py

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

66
class BaseEventHandler(abc.ABC):
77
"""Interpreter-specific object that is returned from register_*_event()."""
8-
__slots__ = []
8+
__slots__ = ()
99

1010
@abc.abstractmethod
1111
def close(self) -> None:
@@ -21,7 +21,7 @@ class BaseInterpreter(abc.ABC):
2121
"""
2222
Contains signature of functions for all DAQmx APIs.
2323
"""
24-
__slots__ = []
24+
__slots__ = ()
2525

2626
@abc.abstractmethod
2727
def add_cdaq_sync_connection(self, port_list):

generated/nidaqmx/_library_interpreter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class LibraryInterpreter(BaseInterpreter):
3838
3939
"""
4040
# Do not add per-task state to the interpreter class.
41-
__slots__ = []
41+
__slots__ = ()
4242

4343
def __init__(self):
4444
pass

generated/nidaqmx/_task_modules/channels/ai_channel.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class AIChannel(Channel):
3232
"""
3333
Represents one or more analog input virtual channels and their properties.
3434
"""
35-
__slots__ = []
35+
__slots__ = ()
3636

3737
def __repr__(self):
3838
return f'AIChannel(name={self._name})'

generated/nidaqmx/_task_modules/channels/ao_channel.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class AOChannel(Channel):
1313
"""
1414
Represents one or more analog output virtual channels and their properties.
1515
"""
16-
__slots__ = []
16+
__slots__ = ()
1717

1818
def __repr__(self):
1919
return f'AOChannel(name={self._name})'

generated/nidaqmx/_task_modules/channels/ci_channel.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class CIChannel(Channel):
1515
"""
1616
Represents one or more counter input virtual channels and their properties.
1717
"""
18-
__slots__ = []
18+
__slots__ = ()
1919

2020
def __repr__(self):
2121
return f'CIChannel(name={self._name})'

generated/nidaqmx/_task_modules/channels/co_channel.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class COChannel(Channel):
1010
"""
1111
Represents one or more counter output virtual channels and their properties.
1212
"""
13-
__slots__ = []
13+
__slots__ = ()
1414

1515
def __repr__(self):
1616
return f'COChannel(name={self._name})'

generated/nidaqmx/_task_modules/channels/di_channel.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class DIChannel(Channel):
1010
"""
1111
Represents one or more digital input virtual channels and their properties.
1212
"""
13-
__slots__ = []
13+
__slots__ = ()
1414

1515
def __repr__(self):
1616
return f'DIChannel(name={self._name})'

generated/nidaqmx/_task_modules/channels/do_channel.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class DOChannel(Channel):
1010
"""
1111
Represents one or more digital output virtual channels and their properties.
1212
"""
13-
__slots__ = []
13+
__slots__ = ()
1414

1515
def __repr__(self):
1616
return f'DOChannel(name={self._name})'

generated/nidaqmx/scale.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,7 @@ class _ScaleAlternateConstructor(Scale):
531531
This is a private API used to instantiate a Scale with an existing interpreter.
532532
"""
533533
# Setting __slots__ avoids TypeError: __class__ assignment: 'Base' object layout differs from 'Derived'.
534-
__slots__ = []
534+
__slots__ = ()
535535

536536
def __init__(self, name, interpreter):
537537
"""

generated/nidaqmx/system/device.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1157,7 +1157,7 @@ class _DeviceAlternateConstructor(Device):
11571157
This is a private API used to instantiate a Device with an existing interpreter.
11581158
"""
11591159
# Setting __slots__ avoids TypeError: __class__ assignment: 'Base' object layout differs from 'Derived'.
1160-
__slots__ = []
1160+
__slots__ = ()
11611161

11621162
def __init__(self, name, interpreter):
11631163
"""

0 commit comments

Comments
 (0)