_id
stringlengths
2
7
title
stringlengths
1
88
partition
stringclasses
3 values
text
stringlengths
75
19.8k
language
stringclasses
1 value
meta_information
dict
q229300
MatrixClient.login_with_password
train
def login_with_password(self, username, password, limit=10): """Deprecated. Use ``login`` with ``sync=True``. Login to the homeserver. Args: username (str): Account username password (str): Account password limit (int): Deprecated. How many messages to retur...
python
{ "resource": "" }
q229301
MatrixClient.login
train
def login(self, username, password, limit=10, sync=True, device_id=None): """Login to the homeserver. Args: username (str): Account username password (str): Account password limit (int): Deprecated. How many messages to return when syncing. This will ...
python
{ "resource": "" }
q229302
MatrixClient.create_room
train
def create_room(self, alias=None, is_public=False, invitees=None): """ Create a new room on the homeserver. Args: alias (str): The canonical_alias of the room. is_public (bool): The public/private visibility of the room. invitees (str[]): A set of user ids to invite...
python
{ "resource": "" }
q229303
MatrixClient.add_listener
train
def add_listener(self, callback, event_type=None): """ Add a listener that will send a callback when the client recieves an event. Args: callback (func(roomchunk)): Callback called when an event arrives. event_type (str): The event_type to filter for. Returns: ...
python
{ "resource": "" }
q229304
MatrixClient.add_presence_listener
train
def add_presence_listener(self, callback): """ Add a presence listener that will send a callback when the client receives a presence update. Args: callback (func(roomchunk)): Callback called when a presence update arrives. Returns: uuid.UUID: Unique id of the li...
python
{ "resource": "" }
q229305
MatrixClient.listen_forever
train
def listen_forever(self, timeout_ms=30000, exception_handler=None, bad_sync_timeout=5): """ Keep listening for events forever. Args: timeout_ms (int): How long to poll the Home Server for before retrying. exception_handler (func(exception)):...
python
{ "resource": "" }
q229306
MatrixClient.start_listener_thread
train
def start_listener_thread(self, timeout_ms=30000, exception_handler=None): """ Start a listener thread to listen for events in the background. Args: timeout (int): How long to poll the Home Server for before retrying. exception_handler (func(exception)): Optional ...
python
{ "resource": "" }
q229307
MatrixClient.stop_listener_thread
train
def stop_listener_thread(self): """ Stop listener thread running in the background """ if self.sync_thread: self.should_listen = False self.sync_thread.join() self.sync_thread = None
python
{ "resource": "" }
q229308
MatrixClient.upload
train
def upload(self, content, content_type, filename=None): """ Upload content to the home server and recieve a MXC url. Args: content (bytes): The data of the content. content_type (str): The mimetype of the content. filename (str): Optional. Filename of the content. ...
python
{ "resource": "" }
q229309
MatrixClient.remove_room_alias
train
def remove_room_alias(self, room_alias): """Remove mapping of an alias Args: room_alias(str): The alias to be removed. Returns: bool: True if the alias is removed, False otherwise. """ try: self.api.remove_room_alias(room_alias) r...
python
{ "resource": "" }
q229310
OlmDevice.upload_identity_keys
train
def upload_identity_keys(self): """Uploads this device's identity keys to HS. This device must be the one used when logging in. """ device_keys = { 'user_id': self.user_id, 'device_id': self.device_id, 'algorithms': self._algorithms, 'keys...
python
{ "resource": "" }
q229311
OlmDevice.upload_one_time_keys
train
def upload_one_time_keys(self, force_update=False): """Uploads new one-time keys to the HS, if needed. Args: force_update (bool): Fetch the number of one-time keys currently on the HS before uploading, even if we already know one. In most cases this should no...
python
{ "resource": "" }
q229312
OlmDevice.update_one_time_key_counts
train
def update_one_time_key_counts(self, counts): """Update data on one-time keys count and upload new ones if necessary. Args: counts (dict): Counts of keys currently on the HS for each key type. """ self.one_time_keys_manager.server_counts = counts if self.one_time_key...
python
{ "resource": "" }
q229313
OlmDevice.sign_json
train
def sign_json(self, json): """Signs a JSON object. NOTE: The object is modified in-place and the return value can be ignored. As specified, this is done by encoding the JSON object without ``signatures`` or keys grouped as ``unsigned``, using canonical encoding. Args: ...
python
{ "resource": "" }
q229314
OlmDevice.verify_json
train
def verify_json(self, json, user_key, user_id, device_id): """Verifies a signed key object's signature. The object must have a 'signatures' key associated with an object of the form `user_id: {key_id: signature}`. Args: json (dict): The JSON object to verify. us...
python
{ "resource": "" }
q229315
User.get_display_name
train
def get_display_name(self, room=None): """Get this user's display name. Args: room (Room): Optional. When specified, return the display name of the user in this room. Returns: The display name. Defaults to the user ID if not set. """ if r...
python
{ "resource": "" }
q229316
User.set_display_name
train
def set_display_name(self, display_name): """ Set this users display name. Args: display_name (str): Display Name """ self.displayname = display_name return self.api.set_display_name(self.user_id, display_name)
python
{ "resource": "" }
q229317
Encryption.prepare_encrypted_request
train
def prepare_encrypted_request(self, session, endpoint, message): """ Creates a prepared request to send to the server with an encrypted message and correct headers :param session: The handle of the session to prepare requests with :param endpoint: The endpoint/server to prepare ...
python
{ "resource": "" }
q229318
Encryption.parse_encrypted_response
train
def parse_encrypted_response(self, response): """ Takes in the encrypted response from the server and decrypts it :param response: The response that needs to be decrytped :return: The unencrypted message from the server """ content_type = response.headers['Content-Type']...
python
{ "resource": "" }
q229319
Protocol.open_shell
train
def open_shell(self, i_stream='stdin', o_stream='stdout stderr', working_directory=None, env_vars=None, noprofile=False, codepage=437, lifetime=None, idle_timeout=None): """ Create a Shell on the destination host @param string i_stream: Which input stream to...
python
{ "resource": "" }
q229320
Protocol.close_shell
train
def close_shell(self, shell_id): """ Close the shell @param string shell_id: The shell id on the remote machine. See #open_shell @returns This should have more error checking but it just returns true for now. @rtype bool """ message_id = uuid.uui...
python
{ "resource": "" }
q229321
Protocol.run_command
train
def run_command( self, shell_id, command, arguments=(), console_mode_stdin=True, skip_cmd_shell=False): """ Run a command on a machine with an open shell @param string shell_id: The shell id on the remote machine. See #open_shell @param string command: Th...
python
{ "resource": "" }
q229322
Protocol.get_command_output
train
def get_command_output(self, shell_id, command_id): """ Get the Output of the given shell and command @param string shell_id: The shell id on the remote machine. See #open_shell @param string command_id: The command id on the remote machine. See #run_command #@r...
python
{ "resource": "" }
q229323
Session.run_ps
train
def run_ps(self, script): """base64 encodes a Powershell script and executes the powershell encoded script command """ # must use utf16 little endian on windows encoded_ps = b64encode(script.encode('utf_16_le')).decode('ascii') rs = self.run_cmd('powershell -encodedcomman...
python
{ "resource": "" }
q229324
Session._clean_error_msg
train
def _clean_error_msg(self, msg): """converts a Powershell CLIXML message to a more human readable string """ # TODO prepare unit test, beautify code # if the msg does not start with this, return it as is if msg.startswith(b"#< CLIXML\r\n"): # for proper xml, we need t...
python
{ "resource": "" }
q229325
Session._strip_namespace
train
def _strip_namespace(self, xml): """strips any namespaces from an xml string""" p = re.compile(b"xmlns=*[\"\"][^\"\"]*[\"\"]") allmatches = p.finditer(xml) for match in allmatches: xml = xml.replace(match.group(), b"") return xml
python
{ "resource": "" }
q229326
return_handler
train
def return_handler(module_logger, first_is_session=True): """Decorator for VISA library classes. """ def _outer(visa_library_method): def _inner(self, session, *args, **kwargs): ret_value = visa_library_method(*args, **kwargs) module_logger.debug('%s%s -> %r', ...
python
{ "resource": "" }
q229327
list_backends
train
def list_backends(): """Return installed backends. Backends are installed python packages named pyvisa-<something> where <something> is the name of the backend. :rtype: list """ return ['ni'] + [name for (loader, name, ispkg) in pkgutil.iter_modules() if name.startswith('p...
python
{ "resource": "" }
q229328
get_wrapper_class
train
def get_wrapper_class(backend_name): """Return the WRAPPER_CLASS for a given backend. :rtype: pyvisa.highlevel.VisaLibraryBase """ try: return _WRAPPERS[backend_name] except KeyError: if backend_name == 'ni': from .ctwrapper import NIVisaLibrary _WRAPPERS['ni...
python
{ "resource": "" }
q229329
open_visa_library
train
def open_visa_library(specification): """Helper function to create a VISA library wrapper. In general, you should not use the function directly. The VISA library wrapper will be created automatically when you create a ResourceManager object. """ if not specification: logger.debug('No visa ...
python
{ "resource": "" }
q229330
VisaLibraryBase.get_last_status_in_session
train
def get_last_status_in_session(self, session): """Last status in session. Helper function to be called by resources properties. """ try: return self._last_status_in_session[session] except KeyError: raise errors.Error('The session %r does not seem to be v...
python
{ "resource": "" }
q229331
VisaLibraryBase.ignore_warning
train
def ignore_warning(self, session, *warnings_constants): """A session dependent context for ignoring warnings :param session: Unique logical identifier to a session. :param warnings_constants: constants identifying the warnings to ignore. """ self._ignore_warning_in_session[sessi...
python
{ "resource": "" }
q229332
VisaLibraryBase.uninstall_all_visa_handlers
train
def uninstall_all_visa_handlers(self, session): """Uninstalls all previously installed handlers for a particular session. :param session: Unique logical identifier to a session. If None, operates on all sessions. """ if session is not None: self.__uninstall_all_handlers_hel...
python
{ "resource": "" }
q229333
VisaLibraryBase.write_memory
train
def write_memory(self, session, space, offset, data, width, extended=False): """Write in an 8-bit, 16-bit, 32-bit, 64-bit value to the specified memory space and offset. Corresponds to viOut* functions of the VISA library. :param session: Unique logical identifier to a session. :param ...
python
{ "resource": "" }
q229334
VisaLibraryBase.peek
train
def peek(self, session, address, width): """Read an 8, 16, 32, or 64-bit value from the specified address. Corresponds to viPeek* functions of the VISA library. :param session: Unique logical identifier to a session. :param address: Source address to read the value. :param widt...
python
{ "resource": "" }
q229335
VisaLibraryBase.poke
train
def poke(self, session, address, width, data): """Writes an 8, 16, 32, or 64-bit value from the specified address. Corresponds to viPoke* functions of the VISA library. :param session: Unique logical identifier to a session. :param address: Source address to read the value. :pa...
python
{ "resource": "" }
q229336
ResourceManager.close
train
def close(self): """Close the resource manager session. """ try: logger.debug('Closing ResourceManager (session: %s)', self.session) # Cleanly close all resources when closing the manager. for resource in self._created_resources: resource.close...
python
{ "resource": "" }
q229337
ResourceManager.list_resources_info
train
def list_resources_info(self, query='?*::INSTR'): """Returns a dictionary mapping resource names to resource extended information of all connected devices matching query. For details of the VISA Resource Regular Expression syntax used in query, refer to list_resources(). :param...
python
{ "resource": "" }
q229338
ResourceManager.open_bare_resource
train
def open_bare_resource(self, resource_name, access_mode=constants.AccessModes.no_lock, open_timeout=constants.VI_TMO_IMMEDIATE): """Open the specified resource without wrapping into a class :param resource_name: name or alias of the resource to open. ...
python
{ "resource": "" }
q229339
ResourceManager.open_resource
train
def open_resource(self, resource_name, access_mode=constants.AccessModes.no_lock, open_timeout=constants.VI_TMO_IMMEDIATE, resource_pyclass=None, **kwargs): """Return an instrument for the resource name. :param reso...
python
{ "resource": "" }
q229340
register_subclass
train
def register_subclass(cls): """Register a subclass for a given interface type and resource class. """ key = cls.interface_type, cls.resource_class if key in _SUBCLASSES: raise ValueError('Class already registered for %s and %s' % key) _SUBCLASSES[(cls.interface_type, cls.resource_class)] ...
python
{ "resource": "" }
q229341
InvalidResourceName.bad_syntax
train
def bad_syntax(cls, syntax, resource_name, ex=None): """Exception used when the resource name cannot be parsed. """ if ex: msg = "The syntax is '%s' (%s)." % (syntax, ex) else: msg = "The syntax is '%s'." % syntax msg = "Could not parse '%s'. %s" % (reso...
python
{ "resource": "" }
q229342
InvalidResourceName.rc_notfound
train
def rc_notfound(cls, interface_type, resource_name=None): """Exception used when no resource class is provided and no default is found. """ msg = "Resource class for %s not provided and default not found." % interface_type if resource_name: msg = "Could not parse '%s'. %s" ...
python
{ "resource": "" }
q229343
ResourceName.from_string
train
def from_string(cls, resource_name): """Parse a resource name and return a ResourceName :type resource_name: str :rtype: ResourceName :raises InvalidResourceName: if the resource name is invalid. """ # TODO Remote VISA uname = resource_name.upper() for...
python
{ "resource": "" }
q229344
set_user_handle_type
train
def set_user_handle_type(library, user_handle): """Set the type of the user handle to install and uninstall handler signature. :param library: the visa library wrapped by ctypes. :param user_handle: use None for a void_p """ # Actually, it's not necessary to change ViHndlr *globally*. However, ...
python
{ "resource": "" }
q229345
set_signature
train
def set_signature(library, function_name, argtypes, restype, errcheck): """Set the signature of single function in a library. :param library: ctypes wrapped library. :type library: ctypes.WinDLL or ctypes.CDLL :param function_name: name of the function as appears in the header file. :type function_...
python
{ "resource": "" }
q229346
assert_interrupt_signal
train
def assert_interrupt_signal(library, session, mode, status_id): """Asserts the specified interrupt or signal. Corresponds to viAssertIntrSignal function of the VISA library. :param library: the visa library wrapped by ctypes. :param session: Unique logical identifier to a session. :param mode: How...
python
{ "resource": "" }
q229347
discard_events
train
def discard_events(library, session, event_type, mechanism): """Discards event occurrences for specified event types and mechanisms in a session. Corresponds to viDiscardEvents function of the VISA library. :param library: the visa library wrapped by ctypes. :param session: Unique logical identifier t...
python
{ "resource": "" }
q229348
enable_event
train
def enable_event(library, session, event_type, mechanism, context=None): """Enable event occurrences for specified event types and mechanisms in a session. Corresponds to viEnableEvent function of the VISA library. :param library: the visa library wrapped by ctypes. :param session: Unique logical iden...
python
{ "resource": "" }
q229349
find_resources
train
def find_resources(library, session, query): """Queries a VISA system to locate the resources associated with a specified interface. Corresponds to viFindRsrc function of the VISA library. :param library: the visa library wrapped by ctypes. :param session: Unique logical identifier to a session (unuse...
python
{ "resource": "" }
q229350
gpib_command
train
def gpib_command(library, session, data): """Write GPIB command bytes on the bus. Corresponds to viGpibCommand function of the VISA library. :param library: the visa library wrapped by ctypes. :param session: Unique logical identifier to a session. :param data: data tor write. :type data: byte...
python
{ "resource": "" }
q229351
in_8
train
def in_8(library, session, space, offset, extended=False): """Reads in an 8-bit value from the specified memory space and offset. Corresponds to viIn8* function of the VISA library. :param library: the visa library wrapped by ctypes. :param session: Unique logical identifier to a session. :param s...
python
{ "resource": "" }
q229352
in_16
train
def in_16(library, session, space, offset, extended=False): """Reads in an 16-bit value from the specified memory space and offset. Corresponds to viIn16* function of the VISA library. :param library: the visa library wrapped by ctypes. :param session: Unique logical identifier to a session. :para...
python
{ "resource": "" }
q229353
in_32
train
def in_32(library, session, space, offset, extended=False): """Reads in an 32-bit value from the specified memory space and offset. Corresponds to viIn32* function of the VISA library. :param library: the visa library wrapped by ctypes. :param session: Unique logical identifier to a session. :para...
python
{ "resource": "" }
q229354
in_64
train
def in_64(library, session, space, offset, extended=False): """Reads in an 64-bit value from the specified memory space and offset. Corresponds to viIn64* function of the VISA library. :param library: the visa library wrapped by ctypes. :param session: Unique logical identifier to a session. :para...
python
{ "resource": "" }
q229355
map_trigger
train
def map_trigger(library, session, trigger_source, trigger_destination, mode): """Map the specified trigger source line to the specified destination line. Corresponds to viMapTrigger function of the VISA library. :param library: the visa library wrapped by ctypes. :param session: Unique logical identif...
python
{ "resource": "" }
q229356
memory_allocation
train
def memory_allocation(library, session, size, extended=False): """Allocates memory from a resource's memory region. Corresponds to viMemAlloc* functions of the VISA library. :param library: the visa library wrapped by ctypes. :param session: Unique logical identifier to a session. :param size: Spe...
python
{ "resource": "" }
q229357
move_asynchronously
train
def move_asynchronously(library, session, source_space, source_offset, source_width, destination_space, destination_offset, destination_width, length): """Moves a block of data asynchronously. Corresponds to viMoveAsync function of the VISA library. :param l...
python
{ "resource": "" }
q229358
move_in_8
train
def move_in_8(library, session, space, offset, length, extended=False): """Moves an 8-bit block of data from the specified address space and offset to local memory. Corresponds to viMoveIn8* functions of the VISA library. :param library: the visa library wrapped by ctypes. :param session: Unique logic...
python
{ "resource": "" }
q229359
move_in_16
train
def move_in_16(library, session, space, offset, length, extended=False): """Moves an 16-bit block of data from the specified address space and offset to local memory. Corresponds to viMoveIn16* functions of the VISA library. :param library: the visa library wrapped by ctypes. :param session: Unique lo...
python
{ "resource": "" }
q229360
move_in_32
train
def move_in_32(library, session, space, offset, length, extended=False): """Moves an 32-bit block of data from the specified address space and offset to local memory. Corresponds to viMoveIn32* functions of the VISA library. :param library: the visa library wrapped by ctypes. :param session: Unique lo...
python
{ "resource": "" }
q229361
move_in_64
train
def move_in_64(library, session, space, offset, length, extended=False): """Moves an 64-bit block of data from the specified address space and offset to local memory. Corresponds to viMoveIn64* functions of the VISA library. :param library: the visa library wrapped by ctypes. :param session: Unique lo...
python
{ "resource": "" }
q229362
move_out_16
train
def move_out_16(library, session, space, offset, length, data, extended=False): """Moves an 16-bit block of data from local memory to the specified address space and offset. Corresponds to viMoveOut16* functions of the VISA library. :param library: the visa library wrapped by ctypes. :param session: U...
python
{ "resource": "" }
q229363
move_out_32
train
def move_out_32(library, session, space, offset, length, data, extended=False): """Moves an 32-bit block of data from local memory to the specified address space and offset. Corresponds to viMoveOut32* functions of the VISA library. :param library: the visa library wrapped by ctypes. :param session: U...
python
{ "resource": "" }
q229364
move_out_64
train
def move_out_64(library, session, space, offset, length, data, extended=False): """Moves an 64-bit block of data from local memory to the specified address space and offset. Corresponds to viMoveOut64* functions of the VISA library. :param library: the visa library wrapped by ctypes. :param session: U...
python
{ "resource": "" }
q229365
open_default_resource_manager
train
def open_default_resource_manager(library): """This function returns a session to the Default Resource Manager resource. Corresponds to viOpenDefaultRM function of the VISA library. :param library: the visa library wrapped by ctypes. :return: Unique logical identifier to a Default Resource Manager ses...
python
{ "resource": "" }
q229366
out_8
train
def out_8(library, session, space, offset, data, extended=False): """Write in an 8-bit value from the specified memory space and offset. Corresponds to viOut8* functions of the VISA library. :param library: the visa library wrapped by ctypes. :param session: Unique logical identifier to a session. ...
python
{ "resource": "" }
q229367
out_16
train
def out_16(library, session, space, offset, data, extended=False): """Write in an 16-bit value from the specified memory space and offset. Corresponds to viOut16* functions of the VISA library. :param library: the visa library wrapped by ctypes. :param session: Unique logical identifier to a session. ...
python
{ "resource": "" }
q229368
out_32
train
def out_32(library, session, space, offset, data, extended=False): """Write in an 32-bit value from the specified memory space and offset. Corresponds to viOut32* functions of the VISA library. :param library: the visa library wrapped by ctypes. :param session: Unique logical identifier to a session. ...
python
{ "resource": "" }
q229369
out_64
train
def out_64(library, session, space, offset, data, extended=False): """Write in an 64-bit value from the specified memory space and offset. Corresponds to viOut64* functions of the VISA library. :param library: the visa library wrapped by ctypes. :param session: Unique logical identifier to a session. ...
python
{ "resource": "" }
q229370
parse_resource
train
def parse_resource(library, session, resource_name): """Parse a resource string to get the interface information. Corresponds to viParseRsrc function of the VISA library. :param library: the visa library wrapped by ctypes. :param session: Resource Manager session (should always be the Default Resource...
python
{ "resource": "" }
q229371
peek
train
def peek(library, session, address, width): """Read an 8, 16 or 32-bit value from the specified address. Corresponds to viPeek* functions of the VISA library. :param library: the visa library wrapped by ctypes. :param session: Unique logical identifier to a session. :param address: Source address ...
python
{ "resource": "" }
q229372
peek_8
train
def peek_8(library, session, address): """Read an 8-bit value from the specified address. Corresponds to viPeek8 function of the VISA library. :param library: the visa library wrapped by ctypes. :param session: Unique logical identifier to a session. :param address: Source address to read the valu...
python
{ "resource": "" }
q229373
peek_16
train
def peek_16(library, session, address): """Read an 16-bit value from the specified address. Corresponds to viPeek16 function of the VISA library. :param library: the visa library wrapped by ctypes. :param session: Unique logical identifier to a session. :param address: Source address to read the v...
python
{ "resource": "" }
q229374
peek_32
train
def peek_32(library, session, address): """Read an 32-bit value from the specified address. Corresponds to viPeek32 function of the VISA library. :param library: the visa library wrapped by ctypes. :param session: Unique logical identifier to a session. :param address: Source address to read the v...
python
{ "resource": "" }
q229375
peek_64
train
def peek_64(library, session, address): """Read an 64-bit value from the specified address. Corresponds to viPeek64 function of the VISA library. :param library: the visa library wrapped by ctypes. :param session: Unique logical identifier to a session. :param address: Source address to read the v...
python
{ "resource": "" }
q229376
poke
train
def poke(library, session, address, width, data): """Writes an 8, 16 or 32-bit value from the specified address. Corresponds to viPoke* functions of the VISA library. :param library: the visa library wrapped by ctypes. :param session: Unique logical identifier to a session. :param address: Source ...
python
{ "resource": "" }
q229377
poke_8
train
def poke_8(library, session, address, data): """Write an 8-bit value from the specified address. Corresponds to viPoke8 function of the VISA library. :param library: the visa library wrapped by ctypes. :param session: Unique logical identifier to a session. :param address: Source address to read t...
python
{ "resource": "" }
q229378
poke_16
train
def poke_16(library, session, address, data): """Write an 16-bit value from the specified address. Corresponds to viPoke16 function of the VISA library. :param library: the visa library wrapped by ctypes. :param session: Unique logical identifier to a session. :param address: Source address to rea...
python
{ "resource": "" }
q229379
poke_32
train
def poke_32(library, session, address, data): """Write an 32-bit value from the specified address. Corresponds to viPoke32 function of the VISA library. :param library: the visa library wrapped by ctypes. :param session: Unique logical identifier to a session. :param address: Source address to rea...
python
{ "resource": "" }
q229380
poke_64
train
def poke_64(library, session, address, data): """Write an 64-bit value from the specified address. Corresponds to viPoke64 function of the VISA library. :param library: the visa library wrapped by ctypes. :param session: Unique logical identifier to a session. :param address: Source address to rea...
python
{ "resource": "" }
q229381
read_asynchronously
train
def read_asynchronously(library, session, count): """Reads data from device or interface asynchronously. Corresponds to viReadAsync function of the VISA library. :param library: the visa library wrapped by ctypes. :param session: Unique logical identifier to a session. :param count: Number of byte...
python
{ "resource": "" }
q229382
read_stb
train
def read_stb(library, session): """Reads a status byte of the service request. Corresponds to viReadSTB function of the VISA library. :param library: the visa library wrapped by ctypes. :param session: Unique logical identifier to a session. :return: Service request status byte, return value of th...
python
{ "resource": "" }
q229383
read_to_file
train
def read_to_file(library, session, filename, count): """Read data synchronously, and store the transferred data in a file. Corresponds to viReadToFile function of the VISA library. :param library: the visa library wrapped by ctypes. :param session: Unique logical identifier to a session. :param fi...
python
{ "resource": "" }
q229384
status_description
train
def status_description(library, session, status): """Returns a user-readable description of the status code passed to the operation. Corresponds to viStatusDesc function of the VISA library. :param library: the visa library wrapped by ctypes. :param session: Unique logical identifier to a session. ...
python
{ "resource": "" }
q229385
terminate
train
def terminate(library, session, degree, job_id): """Requests a VISA session to terminate normal execution of an operation. Corresponds to viTerminate function of the VISA library. :param library: the visa library wrapped by ctypes. :param session: Unique logical identifier to a session. :param deg...
python
{ "resource": "" }
q229386
unmap_trigger
train
def unmap_trigger(library, session, trigger_source, trigger_destination): """Undo a previous map from the specified trigger source line to the specified destination line. Corresponds to viUnmapTrigger function of the VISA library. :param library: the visa library wrapped by ctypes. :param session: Uni...
python
{ "resource": "" }
q229387
usb_control_in
train
def usb_control_in(library, session, request_type_bitmap_field, request_id, request_value, index, length=0): """Performs a USB control pipe transfer from the device. Corresponds to viUsbControlIn function of the VISA library. :param library: the visa library wrapped by ctypes. :para...
python
{ "resource": "" }
q229388
usb_control_out
train
def usb_control_out(library, session, request_type_bitmap_field, request_id, request_value, index, data=""): """Performs a USB control pipe transfer to the device. Corresponds to viUsbControlOut function of the VISA library. :param library: the visa library wrapped by ctypes. :para...
python
{ "resource": "" }
q229389
wait_on_event
train
def wait_on_event(library, session, in_event_type, timeout): """Waits for an occurrence of the specified event for a given session. Corresponds to viWaitOnEvent function of the VISA library. :param library: the visa library wrapped by ctypes. :param session: Unique logical identifier to a session. ...
python
{ "resource": "" }
q229390
write_asynchronously
train
def write_asynchronously(library, session, data): """Writes data to device or interface asynchronously. Corresponds to viWriteAsync function of the VISA library. :param library: the visa library wrapped by ctypes. :param session: Unique logical identifier to a session. :param data: data to be writ...
python
{ "resource": "" }
q229391
write_from_file
train
def write_from_file(library, session, filename, count): """Take data from a file and write it out synchronously. Corresponds to viWriteFromFile function of the VISA library. :param library: the visa library wrapped by ctypes. :param session: Unique logical identifier to a session. :param filename:...
python
{ "resource": "" }
q229392
Attribute.in_resource
train
def in_resource(cls, session_type): """Returns True if the attribute is part of a given session type. The session_type is a tuple with the interface type and resource_class :type session_type: (constants.InterfaceType, str) :rtype: bool """ if cls.resources is AllSessio...
python
{ "resource": "" }
q229393
VisaShell.do_list
train
def do_list(self, args): """List all connected resources.""" try: resources = self.resource_manager.list_resources_info() except Exception as e: print(e) else: self.resources = [] for ndx, (resource_name, value) in enumerate(resources.item...
python
{ "resource": "" }
q229394
VisaShell.do_close
train
def do_close(self, args): """Close resource in use.""" if not self.current: print('There are no resources in use. Use the command "open".') return try: self.current.close() except Exception as e: print(e) else: print('...
python
{ "resource": "" }
q229395
VisaShell.do_read
train
def do_read(self, args): """Receive from the resource in use.""" if not self.current: print('There are no resources in use. Use the command "open".') return try: print(self.current.read()) except Exception as e: print(e)
python
{ "resource": "" }
q229396
VisaShell.do_attr
train
def do_attr(self, args): """Get or set the state for a visa attribute. List all attributes: attr Get an attribute state: attr <name> Set an attribute state: attr <name> <state> """ if not self.current: print('There ar...
python
{ "resource": "" }
q229397
VisaShell.do_exit
train
def do_exit(self, arg): """Exit the shell session.""" if self.current: self.current.close() self.resource_manager.close() del self.resource_manager return True
python
{ "resource": "" }
q229398
Resource.resource_info
train
def resource_info(self): """Get the extended information of this resource. :param resource_name: Unique symbolic name of a resource. :rtype: :class:`pyvisa.highlevel.ResourceInfo` """ return self.visalib.parse_resource_extended(self._resource_manager.session, self.resource_name...
python
{ "resource": "" }
q229399
Resource.interface_type
train
def interface_type(self): """The interface type of the resource as a number. """ return self.visalib.parse_resource(self._resource_manager.session, self.resource_name)[0].interface_type
python
{ "resource": "" }