Skip to content

Commit 35a282a

Browse files
authored
Add function to return session handle from nisync (ni#18)
Signed-off-by: wchung <[email protected]> - [x] This contribution adheres to [CONTRIBUTING.md](https://github.com/ni/nisync-python/blob/main/CONTRIBUTING.md). ### What does this Pull Request accomplish? Add a function that return read-only session handle. ### Why should this Pull Request be merged? Existing function that returning session object cannot fulfill NI-Digital use case. ### What testing has been done? PR Build [manual pytest] 1. Added and ran a new regression test for session_handle function. 2. Ran command "poetry run ni-python-styleguide lint" and "poetry run ni-python-styleguide fix" to correct the code format as one of the requirement in CONTRIBUTING.md. ![image](https://github.com/user-attachments/assets/2f80b625-1a85-4654-ab52-324a27218467) --------- Signed-off-by: wchung <[email protected]>
1 parent a3ad6db commit 35a282a

File tree

3 files changed

+216
-195
lines changed

3 files changed

+216
-195
lines changed

nisync/session.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -864,6 +864,10 @@ def time_references(self):
864864
def resource_name(self):
865865
return self._resource_name
866866

867+
@property
868+
def session_handle(self):
869+
return self._vi
870+
867871

868872
class TimeReference(object):
869873
def __init__(self, session):

templates/nisync/session.py.mako

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -649,6 +649,11 @@ class Session(_SessionBase):
649649
@property
650650
def resource_name(self):
651651
return self._resource_name
652+
653+
@property
654+
def session_handle(self):
655+
return self._vi
656+
652657
<%
653658
class_hierarchy = [
654659
('TimeReference', 'object'),

0 commit comments

Comments
 (0)