Skip to content

Commit

Permalink
Refactor Task Internal Modules: Triggers (#546)
Browse files Browse the repository at this point in the history
* minor codegen fix

* update return type docs

* update functions metadata

* update metadata

* Refactor triggers

* add type hints

* modify docs
  • Loading branch information
charitylxy authored Mar 20, 2024
1 parent 2e0e590 commit d4d078b
Show file tree
Hide file tree
Showing 29 changed files with 74 additions and 105 deletions.
6 changes: 0 additions & 6 deletions docs/arm_start_trigger.rst

This file was deleted.

6 changes: 0 additions & 6 deletions docs/handshake_trigger.rst

This file was deleted.

6 changes: 0 additions & 6 deletions docs/pause_trigger.rst

This file was deleted.

6 changes: 0 additions & 6 deletions docs/reference_trigger.rst

This file was deleted.

6 changes: 0 additions & 6 deletions docs/start_trigger.rst

This file was deleted.

2 changes: 1 addition & 1 deletion docs/task.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ nidaqmx.task

task_channels
task_collections
triggers
task_triggering
7 changes: 7 additions & 0 deletions docs/task_triggering.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
nidaqmx.task.triggering
=======================

.. automodule:: nidaqmx.task.triggering
:members:
:show-inheritance:
:member-order: bysource
14 changes: 0 additions & 14 deletions docs/triggers.rst

This file was deleted.

Empty file.
Empty file.
7 changes: 3 additions & 4 deletions generated/nidaqmx/task/_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from nidaqmx.task._export_signals import ExportSignals
from nidaqmx.task._in_stream import InStream
from nidaqmx.task._timing import Timing
from nidaqmx._task_modules.triggers import Triggers
from nidaqmx.task.triggering._triggers import Triggers
from nidaqmx.task._out_stream import OutStream
from nidaqmx.task.collections._ai_channel_collection import (
AIChannelCollection)
Expand Down Expand Up @@ -255,10 +255,9 @@ def timing(self) -> Timing:
return self._timing

@property
def triggers(self):
def triggers(self) -> Triggers:
"""
:class:`nidaqmx._task_modules.triggers.Triggers`: Gets the trigger
configurations for the task.
Gets the trigger configurations for the task.
"""
return self._triggers

Expand Down
9 changes: 9 additions & 0 deletions generated/nidaqmx/task/triggering/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

from nidaqmx.task.triggering._triggers import Triggers
from nidaqmx.task.triggering._arm_start_trigger import ArmStartTrigger
from nidaqmx.task.triggering._handshake_trigger import HandshakeTrigger
from nidaqmx.task.triggering._pause_trigger import PauseTrigger
from nidaqmx.task.triggering._reference_trigger import ReferenceTrigger
from nidaqmx.task.triggering._start_trigger import StartTrigger

__all__ = ['Triggers', 'ArmStartTrigger', 'HandshakeTrigger', 'PauseTrigger', 'ReferenceTrigger', 'StartTrigger']
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Do not edit this file; it was automatically generated.

from nidaqmx._task_modules.triggering.arm_start_trigger import ArmStartTrigger
from nidaqmx._task_modules.triggering.handshake_trigger import HandshakeTrigger
from nidaqmx._task_modules.triggering.pause_trigger import PauseTrigger
from nidaqmx._task_modules.triggering.reference_trigger import ReferenceTrigger
from nidaqmx._task_modules.triggering.start_trigger import StartTrigger
from nidaqmx.task.triggering._arm_start_trigger import ArmStartTrigger
from nidaqmx.task.triggering._handshake_trigger import HandshakeTrigger
from nidaqmx.task.triggering._pause_trigger import PauseTrigger
from nidaqmx.task.triggering._reference_trigger import ReferenceTrigger
from nidaqmx.task.triggering._start_trigger import StartTrigger
from nidaqmx.constants import (
SyncType)

Expand All @@ -23,42 +23,37 @@ def __init__(self, task_handle, interpreter):
self._start_trigger = StartTrigger(self._handle, self._interpreter)

@property
def arm_start_trigger(self):
def arm_start_trigger(self) -> ArmStartTrigger:
"""
:class:`nidaqmx._task_modules.triggering.arm_start_trigger.ArmStartTrigger`:
Gets the arm start trigger configurations for the task.
Gets the arm start trigger configurations for the task.
"""
return self._arm_start_trigger

@property
def handshake_trigger(self):
def handshake_trigger(self) -> HandshakeTrigger:
"""
:class:`nidaqmx._task_modules.triggering.handshake_trigger.HandshakeTrigger`:
Gets the handshake trigger configurations for the task.
Gets the handshake trigger configurations for the task.
"""
return self._handshake_trigger

@property
def pause_trigger(self):
def pause_trigger(self) -> PauseTrigger:
"""
:class:`nidaqmx._task_modules.triggering.pause_trigger.PauseTrigger`:
Gets the pause trigger configurations for the task.
Gets the pause trigger configurations for the task.
"""
return self._pause_trigger

@property
def reference_trigger(self):
def reference_trigger(self) -> ReferenceTrigger:
"""
:class:`nidaqmx._task_modules.triggering.reference_trigger.ReferenceTrigger`:
Gets the reference trigger configurations for the task.
Gets the reference trigger configurations for the task.
"""
return self._reference_trigger

@property
def start_trigger(self):
def start_trigger(self) -> StartTrigger:
"""
:class:`nidaqmx._task_modules.triggering.start_trigger.StartTrigger`:
Gets the start trigger configurations for the task.
Gets the start trigger configurations for the task.
"""
return self._start_trigger

Expand Down
24 changes: 12 additions & 12 deletions src/codegen/metadata/script_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,24 +93,24 @@
"templateFile": "task\\_export_signals.py.mako",
},
{
"relativeOutputPath": "_task_modules\\triggering\\arm_start_trigger.py",
"templateFile": "_task_modules\\triggering\\arm_start_trigger.py.mako",
"relativeOutputPath": "task\\triggering\\_arm_start_trigger.py",
"templateFile": "task\\triggering\\_arm_start_trigger.py.mako",
},
{
"relativeOutputPath": "_task_modules\\triggering\\handshake_trigger.py",
"templateFile": "_task_modules\\triggering\\handshake_trigger.py.mako",
"relativeOutputPath": "task\\triggering\\_handshake_trigger.py",
"templateFile": "task\\triggering\\_handshake_trigger.py.mako",
},
{
"relativeOutputPath": "_task_modules\\triggering\\pause_trigger.py",
"templateFile": "_task_modules\\triggering\\pause_trigger.py.mako",
"relativeOutputPath": "task\\triggering\\_pause_trigger.py",
"templateFile": "task\\triggering\\_pause_trigger.py.mako",
},
{
"relativeOutputPath": "_task_modules\\triggering\\reference_trigger.py",
"templateFile": "_task_modules\\triggering\\reference_trigger.py.mako",
"relativeOutputPath": "task\\triggering\\_reference_trigger.py",
"templateFile": "task\\triggering\\_reference_trigger.py.mako",
},
{
"relativeOutputPath": "_task_modules\\triggering\\start_trigger.py",
"templateFile": "_task_modules\\triggering\\start_trigger.py.mako",
"relativeOutputPath": "task\\triggering\\_start_trigger.py",
"templateFile": "task\\triggering\\_start_trigger.py.mako",
},
{
"relativeOutputPath": "system\\system.py",
Expand All @@ -125,8 +125,8 @@
"templateFile": "system\\physical_channel.py.mako",
},
{
"relativeOutputPath": "_task_modules\\triggers.py",
"templateFile": "_task_modules\\triggers.py.mako",
"relativeOutputPath": "task\\triggering\\_triggers.py",
"templateFile": "task\\triggering\\_triggers.py.mako",
},
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
%>\
# Do not edit this file; it was automatically generated.

from nidaqmx._task_modules.triggering.arm_start_trigger import ArmStartTrigger
from nidaqmx._task_modules.triggering.handshake_trigger import HandshakeTrigger
from nidaqmx._task_modules.triggering.pause_trigger import PauseTrigger
from nidaqmx._task_modules.triggering.reference_trigger import ReferenceTrigger
from nidaqmx._task_modules.triggering.start_trigger import StartTrigger
from nidaqmx.task.triggering._arm_start_trigger import ArmStartTrigger
from nidaqmx.task.triggering._handshake_trigger import HandshakeTrigger
from nidaqmx.task.triggering._pause_trigger import PauseTrigger
from nidaqmx.task.triggering._reference_trigger import ReferenceTrigger
from nidaqmx.task.triggering._start_trigger import StartTrigger
%if enums_used:
from nidaqmx.constants import (
${', '.join([c for c in enums_used]) | wrap(4, 4)})
Expand All @@ -38,42 +38,37 @@ class Triggers:
self._start_trigger = StartTrigger(self._handle, self._interpreter)

@property
def arm_start_trigger(self):
def arm_start_trigger(self) -> ArmStartTrigger:
"""
:class:`nidaqmx._task_modules.triggering.arm_start_trigger.ArmStartTrigger`:
Gets the arm start trigger configurations for the task.
Gets the arm start trigger configurations for the task.
"""
return self._arm_start_trigger

@property
def handshake_trigger(self):
def handshake_trigger(self) -> HandshakeTrigger:
"""
:class:`nidaqmx._task_modules.triggering.handshake_trigger.HandshakeTrigger`:
Gets the handshake trigger configurations for the task.
Gets the handshake trigger configurations for the task.
"""
return self._handshake_trigger

@property
def pause_trigger(self):
def pause_trigger(self) -> PauseTrigger:
"""
:class:`nidaqmx._task_modules.triggering.pause_trigger.PauseTrigger`:
Gets the pause trigger configurations for the task.
Gets the pause trigger configurations for the task.
"""
return self._pause_trigger

@property
def reference_trigger(self):
def reference_trigger(self) -> ReferenceTrigger:
"""
:class:`nidaqmx._task_modules.triggering.reference_trigger.ReferenceTrigger`:
Gets the reference trigger configurations for the task.
Gets the reference trigger configurations for the task.
"""
return self._reference_trigger

@property
def start_trigger(self):
def start_trigger(self) -> StartTrigger:
"""
:class:`nidaqmx._task_modules.triggering.start_trigger.StartTrigger`:
Gets the start trigger configurations for the task.
Gets the start trigger configurations for the task.
"""
return self._start_trigger

Expand Down
Empty file.
Empty file.
7 changes: 3 additions & 4 deletions src/handwritten/task/_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from nidaqmx.task._export_signals import ExportSignals
from nidaqmx.task._in_stream import InStream
from nidaqmx.task._timing import Timing
from nidaqmx._task_modules.triggers import Triggers
from nidaqmx.task.triggering._triggers import Triggers
from nidaqmx.task._out_stream import OutStream
from nidaqmx.task.collections._ai_channel_collection import (
AIChannelCollection)
Expand Down Expand Up @@ -255,10 +255,9 @@ def timing(self) -> Timing:
return self._timing

@property
def triggers(self):
def triggers(self) -> Triggers:
"""
:class:`nidaqmx._task_modules.triggers.Triggers`: Gets the trigger
configurations for the task.
Gets the trigger configurations for the task.
"""
return self._triggers

Expand Down
9 changes: 9 additions & 0 deletions src/handwritten/task/triggering/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

from nidaqmx.task.triggering._triggers import Triggers
from nidaqmx.task.triggering._arm_start_trigger import ArmStartTrigger
from nidaqmx.task.triggering._handshake_trigger import HandshakeTrigger
from nidaqmx.task.triggering._pause_trigger import PauseTrigger
from nidaqmx.task.triggering._reference_trigger import ReferenceTrigger
from nidaqmx.task.triggering._start_trigger import StartTrigger

__all__ = ['Triggers', 'ArmStartTrigger', 'HandshakeTrigger', 'PauseTrigger', 'ReferenceTrigger', 'StartTrigger']

0 comments on commit d4d078b

Please sign in to comment.