body_hash
stringlengths
64
64
body
stringlengths
23
109k
docstring
stringlengths
1
57k
path
stringlengths
4
198
name
stringlengths
1
115
repository_name
stringlengths
7
111
repository_stars
float64
0
191k
lang
stringclasses
1 value
body_without_docstring
stringlengths
14
108k
unified
stringlengths
45
133k
33b6685811457203cdd8630691d5d8cd584de65725341c057ff83685b0ca1e35
def create_backup(name): "\n Backup an IIS Configuration on the System.\n\n .. versionadded:: 2017.7.0\n\n .. note::\n Backups are stored in the ``$env:Windir\\System32\\inetsrv\\backup``\n folder.\n\n Args:\n name (str): The name to give the backup\n\n Returns:\n bool: True if successful, otherwise False\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' win_iis.create_backup good_config_20170209\n " if (name in list_backups()): raise CommandExecutionError('Backup already present: {}'.format(name)) ps_cmd = ['Backup-WebConfiguration', '-Name', "'{}'".format(name)] cmd_ret = _srvmgr(ps_cmd) if (cmd_ret['retcode'] != 0): msg = 'Unable to backup web configuration: {}\nError: {}'.format(name, cmd_ret['stderr']) raise CommandExecutionError(msg) return (name in list_backups())
Backup an IIS Configuration on the System. .. versionadded:: 2017.7.0 .. note:: Backups are stored in the ``$env:Windir\System32\inetsrv\backup`` folder. Args: name (str): The name to give the backup Returns: bool: True if successful, otherwise False CLI Example: .. code-block:: bash salt '*' win_iis.create_backup good_config_20170209
salt/modules/win_iis.py
create_backup
Flowdalic/salt
9,425
python
def create_backup(name): "\n Backup an IIS Configuration on the System.\n\n .. versionadded:: 2017.7.0\n\n .. note::\n Backups are stored in the ``$env:Windir\\System32\\inetsrv\\backup``\n folder.\n\n Args:\n name (str): The name to give the backup\n\n Returns:\n bool: True if successful, otherwise False\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' win_iis.create_backup good_config_20170209\n " if (name in list_backups()): raise CommandExecutionError('Backup already present: {}'.format(name)) ps_cmd = ['Backup-WebConfiguration', '-Name', "'{}'".format(name)] cmd_ret = _srvmgr(ps_cmd) if (cmd_ret['retcode'] != 0): msg = 'Unable to backup web configuration: {}\nError: {}'.format(name, cmd_ret['stderr']) raise CommandExecutionError(msg) return (name in list_backups())
def create_backup(name): "\n Backup an IIS Configuration on the System.\n\n .. versionadded:: 2017.7.0\n\n .. note::\n Backups are stored in the ``$env:Windir\\System32\\inetsrv\\backup``\n folder.\n\n Args:\n name (str): The name to give the backup\n\n Returns:\n bool: True if successful, otherwise False\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' win_iis.create_backup good_config_20170209\n " if (name in list_backups()): raise CommandExecutionError('Backup already present: {}'.format(name)) ps_cmd = ['Backup-WebConfiguration', '-Name', "'{}'".format(name)] cmd_ret = _srvmgr(ps_cmd) if (cmd_ret['retcode'] != 0): msg = 'Unable to backup web configuration: {}\nError: {}'.format(name, cmd_ret['stderr']) raise CommandExecutionError(msg) return (name in list_backups())<|docstring|>Backup an IIS Configuration on the System. .. versionadded:: 2017.7.0 .. note:: Backups are stored in the ``$env:Windir\System32\inetsrv\backup`` folder. Args: name (str): The name to give the backup Returns: bool: True if successful, otherwise False CLI Example: .. code-block:: bash salt '*' win_iis.create_backup good_config_20170209<|endoftext|>
e701cacd77dce44d931b1ab78be844f4a902532472fe78f59c885c6406ab524d
def remove_backup(name): "\n Remove an IIS Configuration backup from the System.\n\n .. versionadded:: 2017.7.0\n\n Args:\n name (str): The name of the backup to remove\n\n Returns:\n bool: True if successful, otherwise False\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' win_iis.remove_backup backup_20170209\n " if (name not in list_backups()): log.debug('Backup already removed: %s', name) return True ps_cmd = ['Remove-WebConfigurationBackup', '-Name', "'{}'".format(name)] cmd_ret = _srvmgr(ps_cmd) if (cmd_ret['retcode'] != 0): msg = 'Unable to remove web configuration: {}\nError: {}'.format(name, cmd_ret['stderr']) raise CommandExecutionError(msg) return (name not in list_backups())
Remove an IIS Configuration backup from the System. .. versionadded:: 2017.7.0 Args: name (str): The name of the backup to remove Returns: bool: True if successful, otherwise False CLI Example: .. code-block:: bash salt '*' win_iis.remove_backup backup_20170209
salt/modules/win_iis.py
remove_backup
Flowdalic/salt
9,425
python
def remove_backup(name): "\n Remove an IIS Configuration backup from the System.\n\n .. versionadded:: 2017.7.0\n\n Args:\n name (str): The name of the backup to remove\n\n Returns:\n bool: True if successful, otherwise False\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' win_iis.remove_backup backup_20170209\n " if (name not in list_backups()): log.debug('Backup already removed: %s', name) return True ps_cmd = ['Remove-WebConfigurationBackup', '-Name', "'{}'".format(name)] cmd_ret = _srvmgr(ps_cmd) if (cmd_ret['retcode'] != 0): msg = 'Unable to remove web configuration: {}\nError: {}'.format(name, cmd_ret['stderr']) raise CommandExecutionError(msg) return (name not in list_backups())
def remove_backup(name): "\n Remove an IIS Configuration backup from the System.\n\n .. versionadded:: 2017.7.0\n\n Args:\n name (str): The name of the backup to remove\n\n Returns:\n bool: True if successful, otherwise False\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' win_iis.remove_backup backup_20170209\n " if (name not in list_backups()): log.debug('Backup already removed: %s', name) return True ps_cmd = ['Remove-WebConfigurationBackup', '-Name', "'{}'".format(name)] cmd_ret = _srvmgr(ps_cmd) if (cmd_ret['retcode'] != 0): msg = 'Unable to remove web configuration: {}\nError: {}'.format(name, cmd_ret['stderr']) raise CommandExecutionError(msg) return (name not in list_backups())<|docstring|>Remove an IIS Configuration backup from the System. .. versionadded:: 2017.7.0 Args: name (str): The name of the backup to remove Returns: bool: True if successful, otherwise False CLI Example: .. code-block:: bash salt '*' win_iis.remove_backup backup_20170209<|endoftext|>
8a0ee573dc39012d487403418f33ca2a6c372070b5bb4df3fc9a6ad04bda00c0
def list_worker_processes(apppool): "\n Returns a list of worker processes that correspond to the passed\n application pool.\n\n .. versionadded:: 2017.7.0\n\n Args:\n apppool (str): The application pool to query\n\n Returns:\n dict: A dictionary of worker processes with their process IDs\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' win_iis.list_worker_processes 'My App Pool'\n " ps_cmd = ['Get-ChildItem', "'IIS:\\AppPools\\{}\\WorkerProcesses'".format(apppool)] cmd_ret = _srvmgr(cmd=ps_cmd, return_json=True) try: items = salt.utils.json.loads(cmd_ret['stdout'], strict=False) except ValueError: raise CommandExecutionError('Unable to parse return data as Json.') ret = dict() for item in items: ret[item['processId']] = item['appPoolName'] if (not ret): log.warning('No backups found in output: %s', cmd_ret) return ret
Returns a list of worker processes that correspond to the passed application pool. .. versionadded:: 2017.7.0 Args: apppool (str): The application pool to query Returns: dict: A dictionary of worker processes with their process IDs CLI Example: .. code-block:: bash salt '*' win_iis.list_worker_processes 'My App Pool'
salt/modules/win_iis.py
list_worker_processes
Flowdalic/salt
9,425
python
def list_worker_processes(apppool): "\n Returns a list of worker processes that correspond to the passed\n application pool.\n\n .. versionadded:: 2017.7.0\n\n Args:\n apppool (str): The application pool to query\n\n Returns:\n dict: A dictionary of worker processes with their process IDs\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' win_iis.list_worker_processes 'My App Pool'\n " ps_cmd = ['Get-ChildItem', "'IIS:\\AppPools\\{}\\WorkerProcesses'".format(apppool)] cmd_ret = _srvmgr(cmd=ps_cmd, return_json=True) try: items = salt.utils.json.loads(cmd_ret['stdout'], strict=False) except ValueError: raise CommandExecutionError('Unable to parse return data as Json.') ret = dict() for item in items: ret[item['processId']] = item['appPoolName'] if (not ret): log.warning('No backups found in output: %s', cmd_ret) return ret
def list_worker_processes(apppool): "\n Returns a list of worker processes that correspond to the passed\n application pool.\n\n .. versionadded:: 2017.7.0\n\n Args:\n apppool (str): The application pool to query\n\n Returns:\n dict: A dictionary of worker processes with their process IDs\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' win_iis.list_worker_processes 'My App Pool'\n " ps_cmd = ['Get-ChildItem', "'IIS:\\AppPools\\{}\\WorkerProcesses'".format(apppool)] cmd_ret = _srvmgr(cmd=ps_cmd, return_json=True) try: items = salt.utils.json.loads(cmd_ret['stdout'], strict=False) except ValueError: raise CommandExecutionError('Unable to parse return data as Json.') ret = dict() for item in items: ret[item['processId']] = item['appPoolName'] if (not ret): log.warning('No backups found in output: %s', cmd_ret) return ret<|docstring|>Returns a list of worker processes that correspond to the passed application pool. .. versionadded:: 2017.7.0 Args: apppool (str): The application pool to query Returns: dict: A dictionary of worker processes with their process IDs CLI Example: .. code-block:: bash salt '*' win_iis.list_worker_processes 'My App Pool'<|endoftext|>
cd4c9efa02eff2df8223bf2b324ce8e3a0f6f7c97f3330a21c2be98f8a15fed3
def get_webapp_settings(name, site, settings): '\n .. versionadded:: 2017.7.0\n\n Get the value of the setting for the IIS web application.\n\n .. note::\n Params are case sensitive\n\n :param str name: The name of the IIS web application.\n :param str site: The site name contains the web application.\n Example: Default Web Site\n :param str settings: A dictionary of the setting names and their values.\n Available settings: physicalPath, applicationPool, userName, password\n Returns:\n dict: A dictionary of the provided settings and their values.\n\n CLI Example:\n\n .. code-block:: bash\n\n salt \'*\' win_iis.get_webapp_settings name=\'app0\' site=\'Default Web Site\'\n settings="[\'physicalPath\',\'applicationPool\']"\n ' ret = dict() pscmd = list() availableSettings = ('physicalPath', 'applicationPool', 'userName', 'password') if (not settings): log.warning('No settings provided') return ret pscmd.append('$Settings = @{};') for setting in settings: if (setting in availableSettings): if ((setting == 'userName') or (setting == 'password')): pscmd.append(' $Property = Get-WebConfigurationProperty -Filter "system.applicationHost/sites/site[@name=\'{}\']/application[@path=\'/{}\']/virtualDirectory[@path=\'/\']"'.format(site, name)) pscmd.append(' -Name "{}" -ErrorAction Stop | select Value;'.format(setting)) pscmd.append(' $Property = $Property | Select-Object -ExpandProperty Value;') pscmd.append(" $Settings['{}'] = [String] $Property;".format(setting)) pscmd.append(' $Property = $Null;') if ((setting == 'physicalPath') or (setting == 'applicationPool')): pscmd.append(' $Property = (get-webapplication {}).{};'.format(name, setting)) pscmd.append(" $Settings['{}'] = [String] $Property;".format(setting)) pscmd.append(' $Property = $Null;') else: availSetStr = ', '.join(availableSettings) message = ((('Unexpected setting:' + setting) + '. Available settings are: ') + availSetStr) raise SaltInvocationError(message) pscmd.append(' $Settings') cmd_ret = _srvmgr(cmd=''.join(pscmd), return_json=True) try: items = salt.utils.json.loads(cmd_ret['stdout'], strict=False) if isinstance(items, list): ret.update(items[0]) else: ret.update(items) except ValueError: log.error('Unable to parse return data as Json.') if (None in ret.values()): message = 'Some values are empty - please validate site and web application names. Some commands are case sensitive' raise SaltInvocationError(message) return ret
.. versionadded:: 2017.7.0 Get the value of the setting for the IIS web application. .. note:: Params are case sensitive :param str name: The name of the IIS web application. :param str site: The site name contains the web application. Example: Default Web Site :param str settings: A dictionary of the setting names and their values. Available settings: physicalPath, applicationPool, userName, password Returns: dict: A dictionary of the provided settings and their values. CLI Example: .. code-block:: bash salt '*' win_iis.get_webapp_settings name='app0' site='Default Web Site' settings="['physicalPath','applicationPool']"
salt/modules/win_iis.py
get_webapp_settings
Flowdalic/salt
9,425
python
def get_webapp_settings(name, site, settings): '\n .. versionadded:: 2017.7.0\n\n Get the value of the setting for the IIS web application.\n\n .. note::\n Params are case sensitive\n\n :param str name: The name of the IIS web application.\n :param str site: The site name contains the web application.\n Example: Default Web Site\n :param str settings: A dictionary of the setting names and their values.\n Available settings: physicalPath, applicationPool, userName, password\n Returns:\n dict: A dictionary of the provided settings and their values.\n\n CLI Example:\n\n .. code-block:: bash\n\n salt \'*\' win_iis.get_webapp_settings name=\'app0\' site=\'Default Web Site\'\n settings="[\'physicalPath\',\'applicationPool\']"\n ' ret = dict() pscmd = list() availableSettings = ('physicalPath', 'applicationPool', 'userName', 'password') if (not settings): log.warning('No settings provided') return ret pscmd.append('$Settings = @{};') for setting in settings: if (setting in availableSettings): if ((setting == 'userName') or (setting == 'password')): pscmd.append(' $Property = Get-WebConfigurationProperty -Filter "system.applicationHost/sites/site[@name=\'{}\']/application[@path=\'/{}\']/virtualDirectory[@path=\'/\']"'.format(site, name)) pscmd.append(' -Name "{}" -ErrorAction Stop | select Value;'.format(setting)) pscmd.append(' $Property = $Property | Select-Object -ExpandProperty Value;') pscmd.append(" $Settings['{}'] = [String] $Property;".format(setting)) pscmd.append(' $Property = $Null;') if ((setting == 'physicalPath') or (setting == 'applicationPool')): pscmd.append(' $Property = (get-webapplication {}).{};'.format(name, setting)) pscmd.append(" $Settings['{}'] = [String] $Property;".format(setting)) pscmd.append(' $Property = $Null;') else: availSetStr = ', '.join(availableSettings) message = ((('Unexpected setting:' + setting) + '. Available settings are: ') + availSetStr) raise SaltInvocationError(message) pscmd.append(' $Settings') cmd_ret = _srvmgr(cmd=.join(pscmd), return_json=True) try: items = salt.utils.json.loads(cmd_ret['stdout'], strict=False) if isinstance(items, list): ret.update(items[0]) else: ret.update(items) except ValueError: log.error('Unable to parse return data as Json.') if (None in ret.values()): message = 'Some values are empty - please validate site and web application names. Some commands are case sensitive' raise SaltInvocationError(message) return ret
def get_webapp_settings(name, site, settings): '\n .. versionadded:: 2017.7.0\n\n Get the value of the setting for the IIS web application.\n\n .. note::\n Params are case sensitive\n\n :param str name: The name of the IIS web application.\n :param str site: The site name contains the web application.\n Example: Default Web Site\n :param str settings: A dictionary of the setting names and their values.\n Available settings: physicalPath, applicationPool, userName, password\n Returns:\n dict: A dictionary of the provided settings and their values.\n\n CLI Example:\n\n .. code-block:: bash\n\n salt \'*\' win_iis.get_webapp_settings name=\'app0\' site=\'Default Web Site\'\n settings="[\'physicalPath\',\'applicationPool\']"\n ' ret = dict() pscmd = list() availableSettings = ('physicalPath', 'applicationPool', 'userName', 'password') if (not settings): log.warning('No settings provided') return ret pscmd.append('$Settings = @{};') for setting in settings: if (setting in availableSettings): if ((setting == 'userName') or (setting == 'password')): pscmd.append(' $Property = Get-WebConfigurationProperty -Filter "system.applicationHost/sites/site[@name=\'{}\']/application[@path=\'/{}\']/virtualDirectory[@path=\'/\']"'.format(site, name)) pscmd.append(' -Name "{}" -ErrorAction Stop | select Value;'.format(setting)) pscmd.append(' $Property = $Property | Select-Object -ExpandProperty Value;') pscmd.append(" $Settings['{}'] = [String] $Property;".format(setting)) pscmd.append(' $Property = $Null;') if ((setting == 'physicalPath') or (setting == 'applicationPool')): pscmd.append(' $Property = (get-webapplication {}).{};'.format(name, setting)) pscmd.append(" $Settings['{}'] = [String] $Property;".format(setting)) pscmd.append(' $Property = $Null;') else: availSetStr = ', '.join(availableSettings) message = ((('Unexpected setting:' + setting) + '. Available settings are: ') + availSetStr) raise SaltInvocationError(message) pscmd.append(' $Settings') cmd_ret = _srvmgr(cmd=.join(pscmd), return_json=True) try: items = salt.utils.json.loads(cmd_ret['stdout'], strict=False) if isinstance(items, list): ret.update(items[0]) else: ret.update(items) except ValueError: log.error('Unable to parse return data as Json.') if (None in ret.values()): message = 'Some values are empty - please validate site and web application names. Some commands are case sensitive' raise SaltInvocationError(message) return ret<|docstring|>.. versionadded:: 2017.7.0 Get the value of the setting for the IIS web application. .. note:: Params are case sensitive :param str name: The name of the IIS web application. :param str site: The site name contains the web application. Example: Default Web Site :param str settings: A dictionary of the setting names and their values. Available settings: physicalPath, applicationPool, userName, password Returns: dict: A dictionary of the provided settings and their values. CLI Example: .. code-block:: bash salt '*' win_iis.get_webapp_settings name='app0' site='Default Web Site' settings="['physicalPath','applicationPool']"<|endoftext|>
1787b6985dda7144f379ea52963dda2e7e51b2e8789819983cee9d05817e6266
def set_webapp_settings(name, site, settings): '\n .. versionadded:: 2017.7.0\n\n Configure an IIS application.\n\n .. note::\n This function only configures an existing app. Params are case\n sensitive.\n\n :param str name: The IIS application.\n :param str site: The IIS site name.\n :param str settings: A dictionary of the setting names and their values.\n - physicalPath: The physical path of the webapp.\n - applicationPool: The application pool for the webapp.\n - userName: "connectAs" user\n - password: "connectAs" password for user\n :return: A boolean representing whether all changes succeeded.\n :rtype: bool\n\n CLI Example:\n\n .. code-block:: bash\n\n salt \'*\' win_iis.set_webapp_settings name=\'app0\' site=\'site0\' settings="{\'physicalPath\': \'C:\\site0\', \'apppool\': \'site0\'}"\n ' pscmd = list() current_apps = list_apps(site) current_sites = list_sites() availableSettings = ('physicalPath', 'applicationPool', 'userName', 'password') if (name not in current_apps): msg = (('Application' + name) + "doesn't exist") raise SaltInvocationError(msg) if (site not in current_sites): msg = (('Site' + site) + "doesn't exist") raise SaltInvocationError(msg) if (not settings): msg = 'No settings provided' raise SaltInvocationError(msg) for setting in settings.keys(): if (setting in availableSettings): settings[setting] = str(settings[setting]) else: availSetStr = ', '.join(availableSettings) log.error('Unexpected setting: %s ', setting) log.error('Available settings: %s', availSetStr) msg = ((('Unexpected setting:' + setting) + ' Available settings:') + availSetStr) raise SaltInvocationError(msg) current_settings = get_webapp_settings(name=name, site=site, settings=settings.keys()) if (settings == current_settings): log.warning('Settings already contain the provided values.') return True for setting in settings: try: complex(settings[setting]) value = settings[setting] except ValueError: value = "'{}'".format(settings[setting]) if ((setting == 'userName') or (setting == 'password')): pscmd.append(' Set-WebConfigurationProperty -Filter "system.applicationHost/sites/site[@name=\'{}\']/application[@path=\'/{}\']/virtualDirectory[@path=\'/\']"'.format(site, name)) pscmd.append(' -Name "{}" -Value {};'.format(setting, value)) if ((setting == 'physicalPath') or (setting == 'applicationPool')): pscmd.append(' Set-ItemProperty "IIS:\\Sites\\{}\\{}" -Name {} -Value {};'.format(site, name, setting, value)) if (setting == 'physicalPath'): if (not os.path.isdir(settings[setting])): msg = ('Path is not present: ' + settings[setting]) raise SaltInvocationError(msg) cmd_ret = _srvmgr(pscmd) if (cmd_ret['retcode'] != 0): msg = 'Unable to set settings for web application {}'.format(name) raise SaltInvocationError(msg) new_settings = get_webapp_settings(name=name, site=site, settings=settings.keys()) failed_settings = dict() for setting in settings: if (str(settings[setting]) != str(new_settings[setting])): failed_settings[setting] = settings[setting] if failed_settings: log.error('Failed to change settings: %s', failed_settings) return False log.debug('Settings configured successfully: %s', list(settings)) return True
.. versionadded:: 2017.7.0 Configure an IIS application. .. note:: This function only configures an existing app. Params are case sensitive. :param str name: The IIS application. :param str site: The IIS site name. :param str settings: A dictionary of the setting names and their values. - physicalPath: The physical path of the webapp. - applicationPool: The application pool for the webapp. - userName: "connectAs" user - password: "connectAs" password for user :return: A boolean representing whether all changes succeeded. :rtype: bool CLI Example: .. code-block:: bash salt '*' win_iis.set_webapp_settings name='app0' site='site0' settings="{'physicalPath': 'C:\site0', 'apppool': 'site0'}"
salt/modules/win_iis.py
set_webapp_settings
Flowdalic/salt
9,425
python
def set_webapp_settings(name, site, settings): '\n .. versionadded:: 2017.7.0\n\n Configure an IIS application.\n\n .. note::\n This function only configures an existing app. Params are case\n sensitive.\n\n :param str name: The IIS application.\n :param str site: The IIS site name.\n :param str settings: A dictionary of the setting names and their values.\n - physicalPath: The physical path of the webapp.\n - applicationPool: The application pool for the webapp.\n - userName: "connectAs" user\n - password: "connectAs" password for user\n :return: A boolean representing whether all changes succeeded.\n :rtype: bool\n\n CLI Example:\n\n .. code-block:: bash\n\n salt \'*\' win_iis.set_webapp_settings name=\'app0\' site=\'site0\' settings="{\'physicalPath\': \'C:\\site0\', \'apppool\': \'site0\'}"\n ' pscmd = list() current_apps = list_apps(site) current_sites = list_sites() availableSettings = ('physicalPath', 'applicationPool', 'userName', 'password') if (name not in current_apps): msg = (('Application' + name) + "doesn't exist") raise SaltInvocationError(msg) if (site not in current_sites): msg = (('Site' + site) + "doesn't exist") raise SaltInvocationError(msg) if (not settings): msg = 'No settings provided' raise SaltInvocationError(msg) for setting in settings.keys(): if (setting in availableSettings): settings[setting] = str(settings[setting]) else: availSetStr = ', '.join(availableSettings) log.error('Unexpected setting: %s ', setting) log.error('Available settings: %s', availSetStr) msg = ((('Unexpected setting:' + setting) + ' Available settings:') + availSetStr) raise SaltInvocationError(msg) current_settings = get_webapp_settings(name=name, site=site, settings=settings.keys()) if (settings == current_settings): log.warning('Settings already contain the provided values.') return True for setting in settings: try: complex(settings[setting]) value = settings[setting] except ValueError: value = "'{}'".format(settings[setting]) if ((setting == 'userName') or (setting == 'password')): pscmd.append(' Set-WebConfigurationProperty -Filter "system.applicationHost/sites/site[@name=\'{}\']/application[@path=\'/{}\']/virtualDirectory[@path=\'/\']"'.format(site, name)) pscmd.append(' -Name "{}" -Value {};'.format(setting, value)) if ((setting == 'physicalPath') or (setting == 'applicationPool')): pscmd.append(' Set-ItemProperty "IIS:\\Sites\\{}\\{}" -Name {} -Value {};'.format(site, name, setting, value)) if (setting == 'physicalPath'): if (not os.path.isdir(settings[setting])): msg = ('Path is not present: ' + settings[setting]) raise SaltInvocationError(msg) cmd_ret = _srvmgr(pscmd) if (cmd_ret['retcode'] != 0): msg = 'Unable to set settings for web application {}'.format(name) raise SaltInvocationError(msg) new_settings = get_webapp_settings(name=name, site=site, settings=settings.keys()) failed_settings = dict() for setting in settings: if (str(settings[setting]) != str(new_settings[setting])): failed_settings[setting] = settings[setting] if failed_settings: log.error('Failed to change settings: %s', failed_settings) return False log.debug('Settings configured successfully: %s', list(settings)) return True
def set_webapp_settings(name, site, settings): '\n .. versionadded:: 2017.7.0\n\n Configure an IIS application.\n\n .. note::\n This function only configures an existing app. Params are case\n sensitive.\n\n :param str name: The IIS application.\n :param str site: The IIS site name.\n :param str settings: A dictionary of the setting names and their values.\n - physicalPath: The physical path of the webapp.\n - applicationPool: The application pool for the webapp.\n - userName: "connectAs" user\n - password: "connectAs" password for user\n :return: A boolean representing whether all changes succeeded.\n :rtype: bool\n\n CLI Example:\n\n .. code-block:: bash\n\n salt \'*\' win_iis.set_webapp_settings name=\'app0\' site=\'site0\' settings="{\'physicalPath\': \'C:\\site0\', \'apppool\': \'site0\'}"\n ' pscmd = list() current_apps = list_apps(site) current_sites = list_sites() availableSettings = ('physicalPath', 'applicationPool', 'userName', 'password') if (name not in current_apps): msg = (('Application' + name) + "doesn't exist") raise SaltInvocationError(msg) if (site not in current_sites): msg = (('Site' + site) + "doesn't exist") raise SaltInvocationError(msg) if (not settings): msg = 'No settings provided' raise SaltInvocationError(msg) for setting in settings.keys(): if (setting in availableSettings): settings[setting] = str(settings[setting]) else: availSetStr = ', '.join(availableSettings) log.error('Unexpected setting: %s ', setting) log.error('Available settings: %s', availSetStr) msg = ((('Unexpected setting:' + setting) + ' Available settings:') + availSetStr) raise SaltInvocationError(msg) current_settings = get_webapp_settings(name=name, site=site, settings=settings.keys()) if (settings == current_settings): log.warning('Settings already contain the provided values.') return True for setting in settings: try: complex(settings[setting]) value = settings[setting] except ValueError: value = "'{}'".format(settings[setting]) if ((setting == 'userName') or (setting == 'password')): pscmd.append(' Set-WebConfigurationProperty -Filter "system.applicationHost/sites/site[@name=\'{}\']/application[@path=\'/{}\']/virtualDirectory[@path=\'/\']"'.format(site, name)) pscmd.append(' -Name "{}" -Value {};'.format(setting, value)) if ((setting == 'physicalPath') or (setting == 'applicationPool')): pscmd.append(' Set-ItemProperty "IIS:\\Sites\\{}\\{}" -Name {} -Value {};'.format(site, name, setting, value)) if (setting == 'physicalPath'): if (not os.path.isdir(settings[setting])): msg = ('Path is not present: ' + settings[setting]) raise SaltInvocationError(msg) cmd_ret = _srvmgr(pscmd) if (cmd_ret['retcode'] != 0): msg = 'Unable to set settings for web application {}'.format(name) raise SaltInvocationError(msg) new_settings = get_webapp_settings(name=name, site=site, settings=settings.keys()) failed_settings = dict() for setting in settings: if (str(settings[setting]) != str(new_settings[setting])): failed_settings[setting] = settings[setting] if failed_settings: log.error('Failed to change settings: %s', failed_settings) return False log.debug('Settings configured successfully: %s', list(settings)) return True<|docstring|>.. versionadded:: 2017.7.0 Configure an IIS application. .. note:: This function only configures an existing app. Params are case sensitive. :param str name: The IIS application. :param str site: The IIS site name. :param str settings: A dictionary of the setting names and their values. - physicalPath: The physical path of the webapp. - applicationPool: The application pool for the webapp. - userName: "connectAs" user - password: "connectAs" password for user :return: A boolean representing whether all changes succeeded. :rtype: bool CLI Example: .. code-block:: bash salt '*' win_iis.set_webapp_settings name='app0' site='site0' settings="{'physicalPath': 'C:\site0', 'apppool': 'site0'}"<|endoftext|>
49a22eb59b36fa9cdcd31be196c07ac874339fb68296f3ba7158bd06a869b675
def get_webconfiguration_settings(name, settings): '\n Get the webconfiguration settings for the IIS PSPath.\n\n Args:\n name (str): The PSPath of the IIS webconfiguration settings.\n settings (list): A list of dictionaries containing setting name and filter.\n\n Returns:\n dict: A list of dictionaries containing setting name, filter and value.\n\n CLI Example:\n\n .. code-block:: bash\n\n salt \'*\' win_iis.get_webconfiguration_settings name=\'IIS:\\\' settings="[{\'name\': \'enabled\', \'filter\': \'system.webServer/security/authentication/anonymousAuthentication\'}]"\n ' ret = {} ps_cmd = ['$Settings = New-Object System.Collections.ArrayList;'] ps_cmd_validate = [] settings = _prepare_settings(name, settings) if (not settings): log.warning('No settings provided') return ret for setting in settings: ps_cmd_validate.extend(['Get-WebConfigurationProperty', '-PSPath', "'{}'".format(name), '-Filter', "'{}'".format(setting['filter']), '-Name', "'{}'".format(setting['name']), '-ErrorAction', 'Stop', '|', 'Out-Null;']) ps_cmd.append("$Property = Get-WebConfigurationProperty -PSPath '{}'".format(name)) ps_cmd.append("-Name '{}' -Filter '{}' -ErrorAction Stop;".format(setting['name'], setting['filter'])) if (setting['name'].split('.')[(- 1)] == 'Collection'): if ('value' in setting): ps_cmd.append('$Property = $Property | select -Property {} ;'.format(','.join(list(setting['value'][0].keys())))) ps_cmd.append("$Settings.add(@{{filter='{0}';name='{1}';value=[System.Collections.ArrayList] @($Property)}})| Out-Null;".format(setting['filter'], setting['name'])) else: ps_cmd.append('if (([String]::IsNullOrEmpty($Property) -eq $False) -and') ps_cmd.append("($Property.GetType()).Name -eq 'ConfigurationAttribute') {") ps_cmd.append('$Property = $Property | Select-Object') ps_cmd.append('-ExpandProperty Value };') ps_cmd.append("$Settings.add(@{{filter='{0}';name='{1}';value=[String] $Property}})| Out-Null;".format(setting['filter'], setting['name'])) ps_cmd.append('$Property = $Null;') cmd_ret = _srvmgr(cmd=ps_cmd_validate, return_json=True) if (cmd_ret['retcode'] != 0): message = 'One or more invalid property names were specified for the provided container.' raise SaltInvocationError(message) ps_cmd.append('$Settings') cmd_ret = _srvmgr(cmd=ps_cmd, return_json=True) try: ret = salt.utils.json.loads(cmd_ret['stdout'], strict=False) except ValueError: raise CommandExecutionError('Unable to parse return data as Json.') return ret
Get the webconfiguration settings for the IIS PSPath. Args: name (str): The PSPath of the IIS webconfiguration settings. settings (list): A list of dictionaries containing setting name and filter. Returns: dict: A list of dictionaries containing setting name, filter and value. CLI Example: .. code-block:: bash salt '*' win_iis.get_webconfiguration_settings name='IIS:\' settings="[{'name': 'enabled', 'filter': 'system.webServer/security/authentication/anonymousAuthentication'}]"
salt/modules/win_iis.py
get_webconfiguration_settings
Flowdalic/salt
9,425
python
def get_webconfiguration_settings(name, settings): '\n Get the webconfiguration settings for the IIS PSPath.\n\n Args:\n name (str): The PSPath of the IIS webconfiguration settings.\n settings (list): A list of dictionaries containing setting name and filter.\n\n Returns:\n dict: A list of dictionaries containing setting name, filter and value.\n\n CLI Example:\n\n .. code-block:: bash\n\n salt \'*\' win_iis.get_webconfiguration_settings name=\'IIS:\\\' settings="[{\'name\': \'enabled\', \'filter\': \'system.webServer/security/authentication/anonymousAuthentication\'}]"\n ' ret = {} ps_cmd = ['$Settings = New-Object System.Collections.ArrayList;'] ps_cmd_validate = [] settings = _prepare_settings(name, settings) if (not settings): log.warning('No settings provided') return ret for setting in settings: ps_cmd_validate.extend(['Get-WebConfigurationProperty', '-PSPath', "'{}'".format(name), '-Filter', "'{}'".format(setting['filter']), '-Name', "'{}'".format(setting['name']), '-ErrorAction', 'Stop', '|', 'Out-Null;']) ps_cmd.append("$Property = Get-WebConfigurationProperty -PSPath '{}'".format(name)) ps_cmd.append("-Name '{}' -Filter '{}' -ErrorAction Stop;".format(setting['name'], setting['filter'])) if (setting['name'].split('.')[(- 1)] == 'Collection'): if ('value' in setting): ps_cmd.append('$Property = $Property | select -Property {} ;'.format(','.join(list(setting['value'][0].keys())))) ps_cmd.append("$Settings.add(@{{filter='{0}';name='{1}';value=[System.Collections.ArrayList] @($Property)}})| Out-Null;".format(setting['filter'], setting['name'])) else: ps_cmd.append('if (([String]::IsNullOrEmpty($Property) -eq $False) -and') ps_cmd.append("($Property.GetType()).Name -eq 'ConfigurationAttribute') {") ps_cmd.append('$Property = $Property | Select-Object') ps_cmd.append('-ExpandProperty Value };') ps_cmd.append("$Settings.add(@{{filter='{0}';name='{1}';value=[String] $Property}})| Out-Null;".format(setting['filter'], setting['name'])) ps_cmd.append('$Property = $Null;') cmd_ret = _srvmgr(cmd=ps_cmd_validate, return_json=True) if (cmd_ret['retcode'] != 0): message = 'One or more invalid property names were specified for the provided container.' raise SaltInvocationError(message) ps_cmd.append('$Settings') cmd_ret = _srvmgr(cmd=ps_cmd, return_json=True) try: ret = salt.utils.json.loads(cmd_ret['stdout'], strict=False) except ValueError: raise CommandExecutionError('Unable to parse return data as Json.') return ret
def get_webconfiguration_settings(name, settings): '\n Get the webconfiguration settings for the IIS PSPath.\n\n Args:\n name (str): The PSPath of the IIS webconfiguration settings.\n settings (list): A list of dictionaries containing setting name and filter.\n\n Returns:\n dict: A list of dictionaries containing setting name, filter and value.\n\n CLI Example:\n\n .. code-block:: bash\n\n salt \'*\' win_iis.get_webconfiguration_settings name=\'IIS:\\\' settings="[{\'name\': \'enabled\', \'filter\': \'system.webServer/security/authentication/anonymousAuthentication\'}]"\n ' ret = {} ps_cmd = ['$Settings = New-Object System.Collections.ArrayList;'] ps_cmd_validate = [] settings = _prepare_settings(name, settings) if (not settings): log.warning('No settings provided') return ret for setting in settings: ps_cmd_validate.extend(['Get-WebConfigurationProperty', '-PSPath', "'{}'".format(name), '-Filter', "'{}'".format(setting['filter']), '-Name', "'{}'".format(setting['name']), '-ErrorAction', 'Stop', '|', 'Out-Null;']) ps_cmd.append("$Property = Get-WebConfigurationProperty -PSPath '{}'".format(name)) ps_cmd.append("-Name '{}' -Filter '{}' -ErrorAction Stop;".format(setting['name'], setting['filter'])) if (setting['name'].split('.')[(- 1)] == 'Collection'): if ('value' in setting): ps_cmd.append('$Property = $Property | select -Property {} ;'.format(','.join(list(setting['value'][0].keys())))) ps_cmd.append("$Settings.add(@{{filter='{0}';name='{1}';value=[System.Collections.ArrayList] @($Property)}})| Out-Null;".format(setting['filter'], setting['name'])) else: ps_cmd.append('if (([String]::IsNullOrEmpty($Property) -eq $False) -and') ps_cmd.append("($Property.GetType()).Name -eq 'ConfigurationAttribute') {") ps_cmd.append('$Property = $Property | Select-Object') ps_cmd.append('-ExpandProperty Value };') ps_cmd.append("$Settings.add(@{{filter='{0}';name='{1}';value=[String] $Property}})| Out-Null;".format(setting['filter'], setting['name'])) ps_cmd.append('$Property = $Null;') cmd_ret = _srvmgr(cmd=ps_cmd_validate, return_json=True) if (cmd_ret['retcode'] != 0): message = 'One or more invalid property names were specified for the provided container.' raise SaltInvocationError(message) ps_cmd.append('$Settings') cmd_ret = _srvmgr(cmd=ps_cmd, return_json=True) try: ret = salt.utils.json.loads(cmd_ret['stdout'], strict=False) except ValueError: raise CommandExecutionError('Unable to parse return data as Json.') return ret<|docstring|>Get the webconfiguration settings for the IIS PSPath. Args: name (str): The PSPath of the IIS webconfiguration settings. settings (list): A list of dictionaries containing setting name and filter. Returns: dict: A list of dictionaries containing setting name, filter and value. CLI Example: .. code-block:: bash salt '*' win_iis.get_webconfiguration_settings name='IIS:\' settings="[{'name': 'enabled', 'filter': 'system.webServer/security/authentication/anonymousAuthentication'}]"<|endoftext|>
96e292faf7bf66b95037b12746dc65da73e9efb85a51c6f95e9023251f6792b3
def set_webconfiguration_settings(name, settings): '\n Set the value of the setting for an IIS container.\n\n Args:\n name (str): The PSPath of the IIS webconfiguration settings.\n settings (list): A list of dictionaries containing setting name, filter and value.\n\n Returns:\n bool: True if successful, otherwise False\n\n CLI Example:\n\n .. code-block:: bash\n\n salt \'*\' win_iis.set_webconfiguration_settings name=\'IIS:\\\' settings="[{\'name\': \'enabled\', \'filter\': \'system.webServer/security/authentication/anonymousAuthentication\', \'value\': False}]"\n ' ps_cmd = [] settings = _prepare_settings(name, settings) if (not settings): log.warning('No settings provided') return False for (idx, setting) in enumerate(settings): if (setting['name'].split('.')[(- 1)] != 'Collection'): settings[idx]['value'] = str(setting['value']) current_settings = get_webconfiguration_settings(name=name, settings=settings) if (settings == current_settings): log.debug('Settings already contain the provided values.') return True for setting in settings: if (setting['name'].split('.')[(- 1)] != 'Collection'): try: complex(setting['value']) value = setting['value'] except ValueError: value = "'{}'".format(setting['value']) else: configelement_list = [] for value_item in setting['value']: configelement_construct = [] for (key, value) in value_item.items(): configelement_construct.append("{}='{}'".format(key, value)) configelement_list.append((('@{' + ';'.join(configelement_construct)) + '}')) value = ','.join(configelement_list) ps_cmd.extend(['Set-WebConfigurationProperty', '-PSPath', "'{}'".format(name), '-Filter', "'{}'".format(setting['filter']), '-Name', "'{}'".format(setting['name']), '-Value', '{};'.format(value)]) cmd_ret = _srvmgr(ps_cmd) if (cmd_ret['retcode'] != 0): msg = 'Unable to set settings for {}'.format(name) raise CommandExecutionError(msg) new_settings = get_webconfiguration_settings(name=name, settings=settings) failed_settings = [] for (idx, setting) in enumerate(settings): is_collection = (setting['name'].split('.')[(- 1)] == 'Collection') if (((not is_collection) and (str(setting['value']) != str(new_settings[idx]['value']))) or (is_collection and (list(map(dict, setting['value'])) != list(map(dict, new_settings[idx]['value']))))): failed_settings.append(setting) if failed_settings: log.error('Failed to change settings: %s', failed_settings) return False log.debug('Settings configured successfully: %s', settings) return True
Set the value of the setting for an IIS container. Args: name (str): The PSPath of the IIS webconfiguration settings. settings (list): A list of dictionaries containing setting name, filter and value. Returns: bool: True if successful, otherwise False CLI Example: .. code-block:: bash salt '*' win_iis.set_webconfiguration_settings name='IIS:\' settings="[{'name': 'enabled', 'filter': 'system.webServer/security/authentication/anonymousAuthentication', 'value': False}]"
salt/modules/win_iis.py
set_webconfiguration_settings
Flowdalic/salt
9,425
python
def set_webconfiguration_settings(name, settings): '\n Set the value of the setting for an IIS container.\n\n Args:\n name (str): The PSPath of the IIS webconfiguration settings.\n settings (list): A list of dictionaries containing setting name, filter and value.\n\n Returns:\n bool: True if successful, otherwise False\n\n CLI Example:\n\n .. code-block:: bash\n\n salt \'*\' win_iis.set_webconfiguration_settings name=\'IIS:\\\' settings="[{\'name\': \'enabled\', \'filter\': \'system.webServer/security/authentication/anonymousAuthentication\', \'value\': False}]"\n ' ps_cmd = [] settings = _prepare_settings(name, settings) if (not settings): log.warning('No settings provided') return False for (idx, setting) in enumerate(settings): if (setting['name'].split('.')[(- 1)] != 'Collection'): settings[idx]['value'] = str(setting['value']) current_settings = get_webconfiguration_settings(name=name, settings=settings) if (settings == current_settings): log.debug('Settings already contain the provided values.') return True for setting in settings: if (setting['name'].split('.')[(- 1)] != 'Collection'): try: complex(setting['value']) value = setting['value'] except ValueError: value = "'{}'".format(setting['value']) else: configelement_list = [] for value_item in setting['value']: configelement_construct = [] for (key, value) in value_item.items(): configelement_construct.append("{}='{}'".format(key, value)) configelement_list.append((('@{' + ';'.join(configelement_construct)) + '}')) value = ','.join(configelement_list) ps_cmd.extend(['Set-WebConfigurationProperty', '-PSPath', "'{}'".format(name), '-Filter', "'{}'".format(setting['filter']), '-Name', "'{}'".format(setting['name']), '-Value', '{};'.format(value)]) cmd_ret = _srvmgr(ps_cmd) if (cmd_ret['retcode'] != 0): msg = 'Unable to set settings for {}'.format(name) raise CommandExecutionError(msg) new_settings = get_webconfiguration_settings(name=name, settings=settings) failed_settings = [] for (idx, setting) in enumerate(settings): is_collection = (setting['name'].split('.')[(- 1)] == 'Collection') if (((not is_collection) and (str(setting['value']) != str(new_settings[idx]['value']))) or (is_collection and (list(map(dict, setting['value'])) != list(map(dict, new_settings[idx]['value']))))): failed_settings.append(setting) if failed_settings: log.error('Failed to change settings: %s', failed_settings) return False log.debug('Settings configured successfully: %s', settings) return True
def set_webconfiguration_settings(name, settings): '\n Set the value of the setting for an IIS container.\n\n Args:\n name (str): The PSPath of the IIS webconfiguration settings.\n settings (list): A list of dictionaries containing setting name, filter and value.\n\n Returns:\n bool: True if successful, otherwise False\n\n CLI Example:\n\n .. code-block:: bash\n\n salt \'*\' win_iis.set_webconfiguration_settings name=\'IIS:\\\' settings="[{\'name\': \'enabled\', \'filter\': \'system.webServer/security/authentication/anonymousAuthentication\', \'value\': False}]"\n ' ps_cmd = [] settings = _prepare_settings(name, settings) if (not settings): log.warning('No settings provided') return False for (idx, setting) in enumerate(settings): if (setting['name'].split('.')[(- 1)] != 'Collection'): settings[idx]['value'] = str(setting['value']) current_settings = get_webconfiguration_settings(name=name, settings=settings) if (settings == current_settings): log.debug('Settings already contain the provided values.') return True for setting in settings: if (setting['name'].split('.')[(- 1)] != 'Collection'): try: complex(setting['value']) value = setting['value'] except ValueError: value = "'{}'".format(setting['value']) else: configelement_list = [] for value_item in setting['value']: configelement_construct = [] for (key, value) in value_item.items(): configelement_construct.append("{}='{}'".format(key, value)) configelement_list.append((('@{' + ';'.join(configelement_construct)) + '}')) value = ','.join(configelement_list) ps_cmd.extend(['Set-WebConfigurationProperty', '-PSPath', "'{}'".format(name), '-Filter', "'{}'".format(setting['filter']), '-Name', "'{}'".format(setting['name']), '-Value', '{};'.format(value)]) cmd_ret = _srvmgr(ps_cmd) if (cmd_ret['retcode'] != 0): msg = 'Unable to set settings for {}'.format(name) raise CommandExecutionError(msg) new_settings = get_webconfiguration_settings(name=name, settings=settings) failed_settings = [] for (idx, setting) in enumerate(settings): is_collection = (setting['name'].split('.')[(- 1)] == 'Collection') if (((not is_collection) and (str(setting['value']) != str(new_settings[idx]['value']))) or (is_collection and (list(map(dict, setting['value'])) != list(map(dict, new_settings[idx]['value']))))): failed_settings.append(setting) if failed_settings: log.error('Failed to change settings: %s', failed_settings) return False log.debug('Settings configured successfully: %s', settings) return True<|docstring|>Set the value of the setting for an IIS container. Args: name (str): The PSPath of the IIS webconfiguration settings. settings (list): A list of dictionaries containing setting name, filter and value. Returns: bool: True if successful, otherwise False CLI Example: .. code-block:: bash salt '*' win_iis.set_webconfiguration_settings name='IIS:\' settings="[{'name': 'enabled', 'filter': 'system.webServer/security/authentication/anonymousAuthentication', 'value': False}]"<|endoftext|>
e3288d0fee7c4f691dad2f5d02906050605261465127584852054b9b9ff21bd1
def test_setup(self): '\n Test that everything was set-up properly during init\n ' self.assertEqual(self.fitter.h5_main, self.h5_main) self.assertFalse(self.fitter._verbose) self.assertEqual(self.fitter._start_pos, 0) self.assertEqual(self.fitter._end_pos, self.h5_main.shape[0]) self.assertIsNotNone(self.fitter._maxCpus) if (self.fitter._maxCpus > 1): self.assertTrue(self.fitter._parallel) else: self.assertFalse(self.fitter._parallel) self.assertIsNotNone(self.fitter._maxMemoryMB) self.assertIsNotNone(self.fitter._maxDataChunk) self.assertIsNotNone(self.fitter._max_pos_per_read)
Test that everything was set-up properly during init
tests/analysis/test_fitter.py
test_setup
TommasoCostanzo/pycroscopy
1
python
def test_setup(self): '\n \n ' self.assertEqual(self.fitter.h5_main, self.h5_main) self.assertFalse(self.fitter._verbose) self.assertEqual(self.fitter._start_pos, 0) self.assertEqual(self.fitter._end_pos, self.h5_main.shape[0]) self.assertIsNotNone(self.fitter._maxCpus) if (self.fitter._maxCpus > 1): self.assertTrue(self.fitter._parallel) else: self.assertFalse(self.fitter._parallel) self.assertIsNotNone(self.fitter._maxMemoryMB) self.assertIsNotNone(self.fitter._maxDataChunk) self.assertIsNotNone(self.fitter._max_pos_per_read)
def test_setup(self): '\n \n ' self.assertEqual(self.fitter.h5_main, self.h5_main) self.assertFalse(self.fitter._verbose) self.assertEqual(self.fitter._start_pos, 0) self.assertEqual(self.fitter._end_pos, self.h5_main.shape[0]) self.assertIsNotNone(self.fitter._maxCpus) if (self.fitter._maxCpus > 1): self.assertTrue(self.fitter._parallel) else: self.assertFalse(self.fitter._parallel) self.assertIsNotNone(self.fitter._maxMemoryMB) self.assertIsNotNone(self.fitter._maxDataChunk) self.assertIsNotNone(self.fitter._max_pos_per_read)<|docstring|>Test that everything was set-up properly during init<|endoftext|>
5f4fbb48848881fa6aac44d70065b0fa4712376e9f5c9d853df12d63c6ac8cfb
def prepare(doc): 'Pre-filter.' pass
Pre-filter.
src/panvimwiki/filter/convert_taskwiki.py
prepare
jfishe/vimwiki_docx
0
python
def prepare(doc): pass
def prepare(doc): pass<|docstring|>Pre-filter.<|endoftext|>
c2a70dd8d1d0b364090bb15cdc20afee7a003dc04ac7d8bcdf47ea859c19a627
def action(elem, doc): 'Remove empty headings from Vimwiki file.' if isinstance(elem.pf.ListItem): elem.walk(start2done1) if (isinstance(elem, pf.BulletList) or isinstance(elem, pf.OrderedList)): elem.replace_keyword('[S]', pf.Span(classes=['done1'])) elem.replace_keyword('[-]', pf.Span(classes=['doneX'])) return elem return None
Remove empty headings from Vimwiki file.
src/panvimwiki/filter/convert_taskwiki.py
action
jfishe/vimwiki_docx
0
python
def action(elem, doc): if isinstance(elem.pf.ListItem): elem.walk(start2done1) if (isinstance(elem, pf.BulletList) or isinstance(elem, pf.OrderedList)): elem.replace_keyword('[S]', pf.Span(classes=['done1'])) elem.replace_keyword('[-]', pf.Span(classes=['doneX'])) return elem return None
def action(elem, doc): if isinstance(elem.pf.ListItem): elem.walk(start2done1) if (isinstance(elem, pf.BulletList) or isinstance(elem, pf.OrderedList)): elem.replace_keyword('[S]', pf.Span(classes=['done1'])) elem.replace_keyword('[-]', pf.Span(classes=['doneX'])) return elem return None<|docstring|>Remove empty headings from Vimwiki file.<|endoftext|>
f6932d88f030e9638e7ec2b07a9c694e4861ee9aab71a94e9ee8a87eb01f1ee0
def start2done1(elem, doc): 'TODO: Docstring for start2done1.\n\n Parameters\n ----------\n elem : TODO\n doc : TODO\n\n Returns\n -------\n TODO\n\n ' if (isinstance(elem, pf.Span) and ('done0' in elem.classes)): pf.debug(elem.ancestor(2)) elem.container.clear() pf.debug(elem.ancestor(2)) return []
TODO: Docstring for start2done1. Parameters ---------- elem : TODO doc : TODO Returns ------- TODO
src/panvimwiki/filter/convert_taskwiki.py
start2done1
jfishe/vimwiki_docx
0
python
def start2done1(elem, doc): 'TODO: Docstring for start2done1.\n\n Parameters\n ----------\n elem : TODO\n doc : TODO\n\n Returns\n -------\n TODO\n\n ' if (isinstance(elem, pf.Span) and ('done0' in elem.classes)): pf.debug(elem.ancestor(2)) elem.container.clear() pf.debug(elem.ancestor(2)) return []
def start2done1(elem, doc): 'TODO: Docstring for start2done1.\n\n Parameters\n ----------\n elem : TODO\n doc : TODO\n\n Returns\n -------\n TODO\n\n ' if (isinstance(elem, pf.Span) and ('done0' in elem.classes)): pf.debug(elem.ancestor(2)) elem.container.clear() pf.debug(elem.ancestor(2)) return []<|docstring|>TODO: Docstring for start2done1. Parameters ---------- elem : TODO doc : TODO Returns ------- TODO<|endoftext|>
be5958782e903695232ee4d99ab9cf25e847bc083d6b3d612321c4a48f87bc38
def finalize(doc): 'Post-filter.' pass
Post-filter.
src/panvimwiki/filter/convert_taskwiki.py
finalize
jfishe/vimwiki_docx
0
python
def finalize(doc): pass
def finalize(doc): pass<|docstring|>Post-filter.<|endoftext|>
883a8ad16fe1d87fdf94be6cc9138bb25ba17ce24e982359d1c1db4a28bdf6c0
def main(doc=None): 'Remove empty headings from Vimwiki file.\n\n Pandoc filter using panflute\n ' newdoc = pf.load() for i in range(5): newdoc = pf.run_filter(action, prepare=prepare, finalize=finalize, doc=newdoc) return pf.dump(newdoc)
Remove empty headings from Vimwiki file. Pandoc filter using panflute
src/panvimwiki/filter/convert_taskwiki.py
main
jfishe/vimwiki_docx
0
python
def main(doc=None): 'Remove empty headings from Vimwiki file.\n\n Pandoc filter using panflute\n ' newdoc = pf.load() for i in range(5): newdoc = pf.run_filter(action, prepare=prepare, finalize=finalize, doc=newdoc) return pf.dump(newdoc)
def main(doc=None): 'Remove empty headings from Vimwiki file.\n\n Pandoc filter using panflute\n ' newdoc = pf.load() for i in range(5): newdoc = pf.run_filter(action, prepare=prepare, finalize=finalize, doc=newdoc) return pf.dump(newdoc)<|docstring|>Remove empty headings from Vimwiki file. Pandoc filter using panflute<|endoftext|>
918e7c27187d4f8e1fac70e89146467203024a05b976d407bd538c391e81dc04
def get_load_balancer_backend_address_pool(backend_address_pool_name: Optional[str]=None, load_balancer_name: Optional[str]=None, resource_group_name: Optional[str]=None, opts: Optional[pulumi.InvokeOptions]=None) -> AwaitableGetLoadBalancerBackendAddressPoolResult: '\n Pool of backend IP addresses.\n\n\n :param str backend_address_pool_name: The name of the backend address pool.\n :param str load_balancer_name: The name of the load balancer.\n :param str resource_group_name: The name of the resource group.\n ' __args__ = dict() __args__['backendAddressPoolName'] = backend_address_pool_name __args__['loadBalancerName'] = load_balancer_name __args__['resourceGroupName'] = resource_group_name if (opts is None): opts = pulumi.InvokeOptions() if (opts.version is None): opts.version = _utilities.get_version() __ret__ = pulumi.runtime.invoke('azure-nextgen:network/v20200601:getLoadBalancerBackendAddressPool', __args__, opts=opts, typ=GetLoadBalancerBackendAddressPoolResult).value return AwaitableGetLoadBalancerBackendAddressPoolResult(backend_ip_configurations=__ret__.backend_ip_configurations, etag=__ret__.etag, id=__ret__.id, load_balancer_backend_addresses=__ret__.load_balancer_backend_addresses, load_balancing_rules=__ret__.load_balancing_rules, name=__ret__.name, outbound_rule=__ret__.outbound_rule, outbound_rules=__ret__.outbound_rules, provisioning_state=__ret__.provisioning_state, type=__ret__.type)
Pool of backend IP addresses. :param str backend_address_pool_name: The name of the backend address pool. :param str load_balancer_name: The name of the load balancer. :param str resource_group_name: The name of the resource group.
sdk/python/pulumi_azure_nextgen/network/v20200601/get_load_balancer_backend_address_pool.py
get_load_balancer_backend_address_pool
pulumi/pulumi-azure-nextgen
31
python
def get_load_balancer_backend_address_pool(backend_address_pool_name: Optional[str]=None, load_balancer_name: Optional[str]=None, resource_group_name: Optional[str]=None, opts: Optional[pulumi.InvokeOptions]=None) -> AwaitableGetLoadBalancerBackendAddressPoolResult: '\n Pool of backend IP addresses.\n\n\n :param str backend_address_pool_name: The name of the backend address pool.\n :param str load_balancer_name: The name of the load balancer.\n :param str resource_group_name: The name of the resource group.\n ' __args__ = dict() __args__['backendAddressPoolName'] = backend_address_pool_name __args__['loadBalancerName'] = load_balancer_name __args__['resourceGroupName'] = resource_group_name if (opts is None): opts = pulumi.InvokeOptions() if (opts.version is None): opts.version = _utilities.get_version() __ret__ = pulumi.runtime.invoke('azure-nextgen:network/v20200601:getLoadBalancerBackendAddressPool', __args__, opts=opts, typ=GetLoadBalancerBackendAddressPoolResult).value return AwaitableGetLoadBalancerBackendAddressPoolResult(backend_ip_configurations=__ret__.backend_ip_configurations, etag=__ret__.etag, id=__ret__.id, load_balancer_backend_addresses=__ret__.load_balancer_backend_addresses, load_balancing_rules=__ret__.load_balancing_rules, name=__ret__.name, outbound_rule=__ret__.outbound_rule, outbound_rules=__ret__.outbound_rules, provisioning_state=__ret__.provisioning_state, type=__ret__.type)
def get_load_balancer_backend_address_pool(backend_address_pool_name: Optional[str]=None, load_balancer_name: Optional[str]=None, resource_group_name: Optional[str]=None, opts: Optional[pulumi.InvokeOptions]=None) -> AwaitableGetLoadBalancerBackendAddressPoolResult: '\n Pool of backend IP addresses.\n\n\n :param str backend_address_pool_name: The name of the backend address pool.\n :param str load_balancer_name: The name of the load balancer.\n :param str resource_group_name: The name of the resource group.\n ' __args__ = dict() __args__['backendAddressPoolName'] = backend_address_pool_name __args__['loadBalancerName'] = load_balancer_name __args__['resourceGroupName'] = resource_group_name if (opts is None): opts = pulumi.InvokeOptions() if (opts.version is None): opts.version = _utilities.get_version() __ret__ = pulumi.runtime.invoke('azure-nextgen:network/v20200601:getLoadBalancerBackendAddressPool', __args__, opts=opts, typ=GetLoadBalancerBackendAddressPoolResult).value return AwaitableGetLoadBalancerBackendAddressPoolResult(backend_ip_configurations=__ret__.backend_ip_configurations, etag=__ret__.etag, id=__ret__.id, load_balancer_backend_addresses=__ret__.load_balancer_backend_addresses, load_balancing_rules=__ret__.load_balancing_rules, name=__ret__.name, outbound_rule=__ret__.outbound_rule, outbound_rules=__ret__.outbound_rules, provisioning_state=__ret__.provisioning_state, type=__ret__.type)<|docstring|>Pool of backend IP addresses. :param str backend_address_pool_name: The name of the backend address pool. :param str load_balancer_name: The name of the load balancer. :param str resource_group_name: The name of the resource group.<|endoftext|>
aa20b1ecaddcb53c06b9820bebeae7b1e680bc96df72fe03f361dde7375e1844
@property @pulumi.getter(name='backendIPConfigurations') def backend_ip_configurations(self) -> Sequence['outputs.NetworkInterfaceIPConfigurationResponse']: '\n An array of references to IP addresses defined in network interfaces.\n ' return pulumi.get(self, 'backend_ip_configurations')
An array of references to IP addresses defined in network interfaces.
sdk/python/pulumi_azure_nextgen/network/v20200601/get_load_balancer_backend_address_pool.py
backend_ip_configurations
pulumi/pulumi-azure-nextgen
31
python
@property @pulumi.getter(name='backendIPConfigurations') def backend_ip_configurations(self) -> Sequence['outputs.NetworkInterfaceIPConfigurationResponse']: '\n \n ' return pulumi.get(self, 'backend_ip_configurations')
@property @pulumi.getter(name='backendIPConfigurations') def backend_ip_configurations(self) -> Sequence['outputs.NetworkInterfaceIPConfigurationResponse']: '\n \n ' return pulumi.get(self, 'backend_ip_configurations')<|docstring|>An array of references to IP addresses defined in network interfaces.<|endoftext|>
b5810601c3efae7609393eb33eaf46c896545081b2442360a3c06bafb7e8675c
@property @pulumi.getter def etag(self) -> str: '\n A unique read-only string that changes whenever the resource is updated.\n ' return pulumi.get(self, 'etag')
A unique read-only string that changes whenever the resource is updated.
sdk/python/pulumi_azure_nextgen/network/v20200601/get_load_balancer_backend_address_pool.py
etag
pulumi/pulumi-azure-nextgen
31
python
@property @pulumi.getter def etag(self) -> str: '\n \n ' return pulumi.get(self, 'etag')
@property @pulumi.getter def etag(self) -> str: '\n \n ' return pulumi.get(self, 'etag')<|docstring|>A unique read-only string that changes whenever the resource is updated.<|endoftext|>
a15ac1a8ae5700d6b8ffb0e54eac3235e98c6ed2ba2616e0d33a0e31e3e3b1a3
@property @pulumi.getter def id(self) -> Optional[str]: '\n Resource ID.\n ' return pulumi.get(self, 'id')
Resource ID.
sdk/python/pulumi_azure_nextgen/network/v20200601/get_load_balancer_backend_address_pool.py
id
pulumi/pulumi-azure-nextgen
31
python
@property @pulumi.getter def id(self) -> Optional[str]: '\n \n ' return pulumi.get(self, 'id')
@property @pulumi.getter def id(self) -> Optional[str]: '\n \n ' return pulumi.get(self, 'id')<|docstring|>Resource ID.<|endoftext|>
25583edb4bbe6f30313b509e007a811f1e701945a260c7403a8f589949f2fbad
@property @pulumi.getter(name='loadBalancerBackendAddresses') def load_balancer_backend_addresses(self) -> Optional[Sequence['outputs.LoadBalancerBackendAddressResponse']]: '\n An array of backend addresses.\n ' return pulumi.get(self, 'load_balancer_backend_addresses')
An array of backend addresses.
sdk/python/pulumi_azure_nextgen/network/v20200601/get_load_balancer_backend_address_pool.py
load_balancer_backend_addresses
pulumi/pulumi-azure-nextgen
31
python
@property @pulumi.getter(name='loadBalancerBackendAddresses') def load_balancer_backend_addresses(self) -> Optional[Sequence['outputs.LoadBalancerBackendAddressResponse']]: '\n \n ' return pulumi.get(self, 'load_balancer_backend_addresses')
@property @pulumi.getter(name='loadBalancerBackendAddresses') def load_balancer_backend_addresses(self) -> Optional[Sequence['outputs.LoadBalancerBackendAddressResponse']]: '\n \n ' return pulumi.get(self, 'load_balancer_backend_addresses')<|docstring|>An array of backend addresses.<|endoftext|>
fe9bb98852639b59f829056f53099bc5c9a29017aa22423b4c65ec959a7f6dae
@property @pulumi.getter(name='loadBalancingRules') def load_balancing_rules(self) -> Sequence['outputs.SubResourceResponse']: '\n An array of references to load balancing rules that use this backend address pool.\n ' return pulumi.get(self, 'load_balancing_rules')
An array of references to load balancing rules that use this backend address pool.
sdk/python/pulumi_azure_nextgen/network/v20200601/get_load_balancer_backend_address_pool.py
load_balancing_rules
pulumi/pulumi-azure-nextgen
31
python
@property @pulumi.getter(name='loadBalancingRules') def load_balancing_rules(self) -> Sequence['outputs.SubResourceResponse']: '\n \n ' return pulumi.get(self, 'load_balancing_rules')
@property @pulumi.getter(name='loadBalancingRules') def load_balancing_rules(self) -> Sequence['outputs.SubResourceResponse']: '\n \n ' return pulumi.get(self, 'load_balancing_rules')<|docstring|>An array of references to load balancing rules that use this backend address pool.<|endoftext|>
b9fb42ed534599bf9d6f97556d4b374eb5b93ceedf2793b9b2778cdb845bb74d
@property @pulumi.getter def name(self) -> Optional[str]: '\n The name of the resource that is unique within the set of backend address pools used by the load balancer. This name can be used to access the resource.\n ' return pulumi.get(self, 'name')
The name of the resource that is unique within the set of backend address pools used by the load balancer. This name can be used to access the resource.
sdk/python/pulumi_azure_nextgen/network/v20200601/get_load_balancer_backend_address_pool.py
name
pulumi/pulumi-azure-nextgen
31
python
@property @pulumi.getter def name(self) -> Optional[str]: '\n \n ' return pulumi.get(self, 'name')
@property @pulumi.getter def name(self) -> Optional[str]: '\n \n ' return pulumi.get(self, 'name')<|docstring|>The name of the resource that is unique within the set of backend address pools used by the load balancer. This name can be used to access the resource.<|endoftext|>
82bf53d238a083629b63997f6ee2b6dd3cd786d79d70dd279472b5edd7b9e95f
@property @pulumi.getter(name='outboundRule') def outbound_rule(self) -> 'outputs.SubResourceResponse': '\n A reference to an outbound rule that uses this backend address pool.\n ' return pulumi.get(self, 'outbound_rule')
A reference to an outbound rule that uses this backend address pool.
sdk/python/pulumi_azure_nextgen/network/v20200601/get_load_balancer_backend_address_pool.py
outbound_rule
pulumi/pulumi-azure-nextgen
31
python
@property @pulumi.getter(name='outboundRule') def outbound_rule(self) -> 'outputs.SubResourceResponse': '\n \n ' return pulumi.get(self, 'outbound_rule')
@property @pulumi.getter(name='outboundRule') def outbound_rule(self) -> 'outputs.SubResourceResponse': '\n \n ' return pulumi.get(self, 'outbound_rule')<|docstring|>A reference to an outbound rule that uses this backend address pool.<|endoftext|>
dd44bd08b177bd9b846f99569992b9b69e6beb9cbf646063e1cec22283776369
@property @pulumi.getter(name='outboundRules') def outbound_rules(self) -> Sequence['outputs.SubResourceResponse']: '\n An array of references to outbound rules that use this backend address pool.\n ' return pulumi.get(self, 'outbound_rules')
An array of references to outbound rules that use this backend address pool.
sdk/python/pulumi_azure_nextgen/network/v20200601/get_load_balancer_backend_address_pool.py
outbound_rules
pulumi/pulumi-azure-nextgen
31
python
@property @pulumi.getter(name='outboundRules') def outbound_rules(self) -> Sequence['outputs.SubResourceResponse']: '\n \n ' return pulumi.get(self, 'outbound_rules')
@property @pulumi.getter(name='outboundRules') def outbound_rules(self) -> Sequence['outputs.SubResourceResponse']: '\n \n ' return pulumi.get(self, 'outbound_rules')<|docstring|>An array of references to outbound rules that use this backend address pool.<|endoftext|>
cc8cd3c927f4ac5e936a852a24ad6cb2a515507885b4354970bd27d86c2102bc
@property @pulumi.getter(name='provisioningState') def provisioning_state(self) -> str: '\n The provisioning state of the backend address pool resource.\n ' return pulumi.get(self, 'provisioning_state')
The provisioning state of the backend address pool resource.
sdk/python/pulumi_azure_nextgen/network/v20200601/get_load_balancer_backend_address_pool.py
provisioning_state
pulumi/pulumi-azure-nextgen
31
python
@property @pulumi.getter(name='provisioningState') def provisioning_state(self) -> str: '\n \n ' return pulumi.get(self, 'provisioning_state')
@property @pulumi.getter(name='provisioningState') def provisioning_state(self) -> str: '\n \n ' return pulumi.get(self, 'provisioning_state')<|docstring|>The provisioning state of the backend address pool resource.<|endoftext|>
b17c8b7a7f1a81a42d3c4d8cd481de478772fcc55e8b242f3f3f1faa60dd8130
@property @pulumi.getter def type(self) -> str: '\n Type of the resource.\n ' return pulumi.get(self, 'type')
Type of the resource.
sdk/python/pulumi_azure_nextgen/network/v20200601/get_load_balancer_backend_address_pool.py
type
pulumi/pulumi-azure-nextgen
31
python
@property @pulumi.getter def type(self) -> str: '\n \n ' return pulumi.get(self, 'type')
@property @pulumi.getter def type(self) -> str: '\n \n ' return pulumi.get(self, 'type')<|docstring|>Type of the resource.<|endoftext|>
06d469449094f6e772f72c77303a7bea9578f85b8ed0d2190cd08cfdadd28444
def token_features(tk): ' very basic feature extraction. ' w = tk.form (yield ('word=' + w)) (yield ('simplified=' + re.sub('[0-9]', '0', re.sub('[^a-zA-Z0-9()\\.\\,]', '', w.lower())))) for c in re.findall('[^a-zA-Z0-9]', w): (yield ('contains(%r)' % c))
very basic feature extraction.
crf/example.py
token_features
Xiaolin8991/crf
348
python
def token_features(tk): ' ' w = tk.form (yield ('word=' + w)) (yield ('simplified=' + re.sub('[0-9]', '0', re.sub('[^a-zA-Z0-9()\\.\\,]', , w.lower())))) for c in re.findall('[^a-zA-Z0-9]', w): (yield ('contains(%r)' % c))
def token_features(tk): ' ' w = tk.form (yield ('word=' + w)) (yield ('simplified=' + re.sub('[0-9]', '0', re.sub('[^a-zA-Z0-9()\\.\\,]', , w.lower())))) for c in re.findall('[^a-zA-Z0-9]', w): (yield ('contains(%r)' % c))<|docstring|>very basic feature extraction.<|endoftext|>
ff5638f15a734909496e843f38101792b2215d44f6ba5abfe890f16241bbfdfb
def preprocessing(s): ' Run instance thru feature extraction. ' s[0].add(['first-token']) s[(- 1)].add(['last-token']) for tk in s: tk.add(token_features(tk)) if 1: for t in range(1, len(s)): s[t].add(((f + '@-1') for f in token_features(s[(t - 1)]))) for t in range((len(s) - 1)): s[t].add(((f + '@+1') for f in token_features(s[(t + 1)]))) return s
Run instance thru feature extraction.
crf/example.py
preprocessing
Xiaolin8991/crf
348
python
def preprocessing(s): ' ' s[0].add(['first-token']) s[(- 1)].add(['last-token']) for tk in s: tk.add(token_features(tk)) if 1: for t in range(1, len(s)): s[t].add(((f + '@-1') for f in token_features(s[(t - 1)]))) for t in range((len(s) - 1)): s[t].add(((f + '@+1') for f in token_features(s[(t + 1)]))) return s
def preprocessing(s): ' ' s[0].add(['first-token']) s[(- 1)].add(['last-token']) for tk in s: tk.add(token_features(tk)) if 1: for t in range(1, len(s)): s[t].add(((f + '@-1') for f in token_features(s[(t - 1)]))) for t in range((len(s) - 1)): s[t].add(((f + '@+1') for f in token_features(s[(t + 1)]))) return s<|docstring|>Run instance thru feature extraction.<|endoftext|>
632685f86fdd4ccd568845e3be519944f148ee58c355ecc3bed99b0853def472
def as_dict(data: typing.Any) -> typing.Any: 'Encodes input data in readiness for downstream processing.\n \n ' return encode(data)
Encodes input data in readiness for downstream processing.
stests/core/utils/encoder.py
as_dict
dwerner/stests
4
python
def as_dict(data: typing.Any) -> typing.Any: '\n \n ' return encode(data)
def as_dict(data: typing.Any) -> typing.Any: '\n \n ' return encode(data)<|docstring|>Encodes input data in readiness for downstream processing.<|endoftext|>
3a20aa417ffa821a090e2499a3d6c58ab3142f9533f0771d85b46069ddd1e0f2
def as_json(data: typing.Any) -> str: 'Encodes input data as JSON.\n \n ' return json.dumps(encode(data), indent=4).encode('utf-8')
Encodes input data as JSON.
stests/core/utils/encoder.py
as_json
dwerner/stests
4
python
def as_json(data: typing.Any) -> str: '\n \n ' return json.dumps(encode(data), indent=4).encode('utf-8')
def as_json(data: typing.Any) -> str: '\n \n ' return json.dumps(encode(data), indent=4).encode('utf-8')<|docstring|>Encodes input data as JSON.<|endoftext|>
5a72f2f0d0b66efb5a2aee17c5c0b1147ba4fd928e1287c8cffeb9557cecf394
def from_dict(obj: typing.Any) -> typing.Any: 'Encodes input data in readiness for downstream processing.\n \n ' return decode(obj)
Encodes input data in readiness for downstream processing.
stests/core/utils/encoder.py
from_dict
dwerner/stests
4
python
def from_dict(obj: typing.Any) -> typing.Any: '\n \n ' return decode(obj)
def from_dict(obj: typing.Any) -> typing.Any: '\n \n ' return decode(obj)<|docstring|>Encodes input data in readiness for downstream processing.<|endoftext|>
8ba081acd2d904c4aa24428bd658b2936e87ad3a729eaedca57e6952e1dbf47e
def from_json(as_json: str) -> typing.Any: 'Encodes input data as JSON.\n \n ' return decode(json.loads(as_json))
Encodes input data as JSON.
stests/core/utils/encoder.py
from_json
dwerner/stests
4
python
def from_json(as_json: str) -> typing.Any: '\n \n ' return decode(json.loads(as_json))
def from_json(as_json: str) -> typing.Any: '\n \n ' return decode(json.loads(as_json))<|docstring|>Encodes input data as JSON.<|endoftext|>
462b1811a0d81a6a1cb1825431dabee237469efa7d4a6c9c79328e5215bcad35
def clone(data: typing.Any) -> typing.Any: 'Returns a clone of a data class.\n \n ' return from_dict(as_dict(data))
Returns a clone of a data class.
stests/core/utils/encoder.py
clone
dwerner/stests
4
python
def clone(data: typing.Any) -> typing.Any: '\n \n ' return from_dict(as_dict(data))
def clone(data: typing.Any) -> typing.Any: '\n \n ' return from_dict(as_dict(data))<|docstring|>Returns a clone of a data class.<|endoftext|>
ec4599433d2b8ab64efe089993af1e999c147c16d63f0afef35be2027dff6824
def decode(obj: typing.Any) -> typing.Any: 'Decodes previously encoded information.\n \n ' if isinstance(obj, PRIMITIVES): return obj if isinstance(obj, tuple): return tuple(map(decode, obj)) if isinstance(obj, list): return list(map(decode, obj)) if (isinstance(obj, dict) and ('_type_key' in obj)): return _decode_dclass(obj) if isinstance(obj, dict): return {k: decode(v) for (k, v) in obj.items()} if (isinstance(obj, str) and (obj in ENUM_VALUE_MAP)): return ENUM_VALUE_MAP[obj] return obj
Decodes previously encoded information.
stests/core/utils/encoder.py
decode
dwerner/stests
4
python
def decode(obj: typing.Any) -> typing.Any: '\n \n ' if isinstance(obj, PRIMITIVES): return obj if isinstance(obj, tuple): return tuple(map(decode, obj)) if isinstance(obj, list): return list(map(decode, obj)) if (isinstance(obj, dict) and ('_type_key' in obj)): return _decode_dclass(obj) if isinstance(obj, dict): return {k: decode(v) for (k, v) in obj.items()} if (isinstance(obj, str) and (obj in ENUM_VALUE_MAP)): return ENUM_VALUE_MAP[obj] return obj
def decode(obj: typing.Any) -> typing.Any: '\n \n ' if isinstance(obj, PRIMITIVES): return obj if isinstance(obj, tuple): return tuple(map(decode, obj)) if isinstance(obj, list): return list(map(decode, obj)) if (isinstance(obj, dict) and ('_type_key' in obj)): return _decode_dclass(obj) if isinstance(obj, dict): return {k: decode(v) for (k, v) in obj.items()} if (isinstance(obj, str) and (obj in ENUM_VALUE_MAP)): return ENUM_VALUE_MAP[obj] return obj<|docstring|>Decodes previously encoded information.<|endoftext|>
c6189d1f5ce251364c00997ec32de7bdc6680adfd3de80dacb18191c9ef17d1f
def _decode_dclass(obj): 'Decodes a registered data class instance.\n \n ' dcls = DCLASS_MAP[obj['_type_key']] for field in dataclasses.fields(dcls): if (field.name not in obj): continue field_value = obj[field.name] if isinstance(field_value, type(None)): continue field_type = _get_field_type(field) if (field_type is datetime.datetime): obj[field.name] = datetime.datetime.fromtimestamp(field_value) elif (field.type in ENUM_TYPE_SET): obj[field.name] = field.type[obj[field.name]] elif (field_type in DCLASS_SET): obj[field.name] = _decode_dclass(obj[field.name]) else: obj[field.name] = decode(obj[field.name]) del obj['_type_key'] return dcls(**obj)
Decodes a registered data class instance.
stests/core/utils/encoder.py
_decode_dclass
dwerner/stests
4
python
def _decode_dclass(obj): '\n \n ' dcls = DCLASS_MAP[obj['_type_key']] for field in dataclasses.fields(dcls): if (field.name not in obj): continue field_value = obj[field.name] if isinstance(field_value, type(None)): continue field_type = _get_field_type(field) if (field_type is datetime.datetime): obj[field.name] = datetime.datetime.fromtimestamp(field_value) elif (field.type in ENUM_TYPE_SET): obj[field.name] = field.type[obj[field.name]] elif (field_type in DCLASS_SET): obj[field.name] = _decode_dclass(obj[field.name]) else: obj[field.name] = decode(obj[field.name]) del obj['_type_key'] return dcls(**obj)
def _decode_dclass(obj): '\n \n ' dcls = DCLASS_MAP[obj['_type_key']] for field in dataclasses.fields(dcls): if (field.name not in obj): continue field_value = obj[field.name] if isinstance(field_value, type(None)): continue field_type = _get_field_type(field) if (field_type is datetime.datetime): obj[field.name] = datetime.datetime.fromtimestamp(field_value) elif (field.type in ENUM_TYPE_SET): obj[field.name] = field.type[obj[field.name]] elif (field_type in DCLASS_SET): obj[field.name] = _decode_dclass(obj[field.name]) else: obj[field.name] = decode(obj[field.name]) del obj['_type_key'] return dcls(**obj)<|docstring|>Decodes a registered data class instance.<|endoftext|>
1846b17015fd9b0e98ed8f428a2855eacb966b7148d91ffd86e7fe28dbfd6369
def _get_field_type(field): 'Returns a dataclass field type.\n \n ' if (typing_inspect.get_origin(field.type) is typing.Union): type_args = typing_inspect.get_args(field.type) for type_arg in [i for i in type_args if (i not in (type(None),))]: return type_arg else: return field.type
Returns a dataclass field type.
stests/core/utils/encoder.py
_get_field_type
dwerner/stests
4
python
def _get_field_type(field): '\n \n ' if (typing_inspect.get_origin(field.type) is typing.Union): type_args = typing_inspect.get_args(field.type) for type_arg in [i for i in type_args if (i not in (type(None),))]: return type_arg else: return field.type
def _get_field_type(field): '\n \n ' if (typing_inspect.get_origin(field.type) is typing.Union): type_args = typing_inspect.get_args(field.type) for type_arg in [i for i in type_args if (i not in (type(None),))]: return type_arg else: return field.type<|docstring|>Returns a dataclass field type.<|endoftext|>
f81b98d72cf4cd1299f3bbf1e3758a6477d8992d7e724a16386ed1911c18a3db
def encode(data: typing.Any, requires_decoding=True) -> typing.Any: 'Encodes input data in readiness for downstream processing.\n \n ' if isinstance(data, PRIMITIVES): return data if isinstance(data, datetime.datetime): return data.timestamp() if isinstance(data, dict): return {k: encode(v, requires_decoding) for (k, v) in data.items()} if isinstance(data, tuple): return tuple(map((lambda i: encode(i, requires_decoding)), data)) if isinstance(data, list): return list(map((lambda i: encode(i, requires_decoding)), data)) if (type(data) in DCLASS_SET): return _encode_dclass(data, dataclasses.asdict(data), requires_decoding) if (type(data) in ENUM_TYPE_SET): return data.name log_event(EventType.CORE_ENCODING_FAILURE, f'unrecognized data type: {data}') return data
Encodes input data in readiness for downstream processing.
stests/core/utils/encoder.py
encode
dwerner/stests
4
python
def encode(data: typing.Any, requires_decoding=True) -> typing.Any: '\n \n ' if isinstance(data, PRIMITIVES): return data if isinstance(data, datetime.datetime): return data.timestamp() if isinstance(data, dict): return {k: encode(v, requires_decoding) for (k, v) in data.items()} if isinstance(data, tuple): return tuple(map((lambda i: encode(i, requires_decoding)), data)) if isinstance(data, list): return list(map((lambda i: encode(i, requires_decoding)), data)) if (type(data) in DCLASS_SET): return _encode_dclass(data, dataclasses.asdict(data), requires_decoding) if (type(data) in ENUM_TYPE_SET): return data.name log_event(EventType.CORE_ENCODING_FAILURE, f'unrecognized data type: {data}') return data
def encode(data: typing.Any, requires_decoding=True) -> typing.Any: '\n \n ' if isinstance(data, PRIMITIVES): return data if isinstance(data, datetime.datetime): return data.timestamp() if isinstance(data, dict): return {k: encode(v, requires_decoding) for (k, v) in data.items()} if isinstance(data, tuple): return tuple(map((lambda i: encode(i, requires_decoding)), data)) if isinstance(data, list): return list(map((lambda i: encode(i, requires_decoding)), data)) if (type(data) in DCLASS_SET): return _encode_dclass(data, dataclasses.asdict(data), requires_decoding) if (type(data) in ENUM_TYPE_SET): return data.name log_event(EventType.CORE_ENCODING_FAILURE, f'unrecognized data type: {data}') return data<|docstring|>Encodes input data in readiness for downstream processing.<|endoftext|>
9b956b60c80addaed562a7d3dffb7b19a71fd622a1e817050ebd74eb8f96fe6b
def _encode_dclass(data, obj, requires_decoding): 'Encodes a data class that has been previously registered with the encoder.\n \n ' if requires_decoding: obj['_type_key'] = f'{data.__module__}.{data.__class__.__name__}' fields = [i for i in dir(data) if ((i in obj) and (not i.startswith('_')))] fields_dcls = [i for i in fields if (type(getattr(data, i)) in DCLASS_SET)] for field in fields_dcls: _encode_dclass(getattr(data, field), obj[field], requires_decoding) return encode(obj, requires_decoding)
Encodes a data class that has been previously registered with the encoder.
stests/core/utils/encoder.py
_encode_dclass
dwerner/stests
4
python
def _encode_dclass(data, obj, requires_decoding): '\n \n ' if requires_decoding: obj['_type_key'] = f'{data.__module__}.{data.__class__.__name__}' fields = [i for i in dir(data) if ((i in obj) and (not i.startswith('_')))] fields_dcls = [i for i in fields if (type(getattr(data, i)) in DCLASS_SET)] for field in fields_dcls: _encode_dclass(getattr(data, field), obj[field], requires_decoding) return encode(obj, requires_decoding)
def _encode_dclass(data, obj, requires_decoding): '\n \n ' if requires_decoding: obj['_type_key'] = f'{data.__module__}.{data.__class__.__name__}' fields = [i for i in dir(data) if ((i in obj) and (not i.startswith('_')))] fields_dcls = [i for i in fields if (type(getattr(data, i)) in DCLASS_SET)] for field in fields_dcls: _encode_dclass(getattr(data, field), obj[field], requires_decoding) return encode(obj, requires_decoding)<|docstring|>Encodes a data class that has been previously registered with the encoder.<|endoftext|>
758149aa9be39843ed06dbfcf0c1d69a33c88b4b50cad7e7c782337dca97f884
def register_type(cls): 'Workflows need to extend the typeset so as to ensure that arguments are decoded/encoded correctly.\n \n ' global ENUM_TYPE_SET global DCLASS_SET if issubclass(cls, (enum.Enum, enum.Flag)): ENUM_TYPE_SET = (ENUM_TYPE_SET | {cls}) for i in cls: ENUM_VALUE_MAP[str(i)] = i else: DCLASS_MAP[f'{cls.__module__}.{cls.__name__}'] = cls DCLASS_SET = (DCLASS_SET | {cls})
Workflows need to extend the typeset so as to ensure that arguments are decoded/encoded correctly.
stests/core/utils/encoder.py
register_type
dwerner/stests
4
python
def register_type(cls): '\n \n ' global ENUM_TYPE_SET global DCLASS_SET if issubclass(cls, (enum.Enum, enum.Flag)): ENUM_TYPE_SET = (ENUM_TYPE_SET | {cls}) for i in cls: ENUM_VALUE_MAP[str(i)] = i else: DCLASS_MAP[f'{cls.__module__}.{cls.__name__}'] = cls DCLASS_SET = (DCLASS_SET | {cls})
def register_type(cls): '\n \n ' global ENUM_TYPE_SET global DCLASS_SET if issubclass(cls, (enum.Enum, enum.Flag)): ENUM_TYPE_SET = (ENUM_TYPE_SET | {cls}) for i in cls: ENUM_VALUE_MAP[str(i)] = i else: DCLASS_MAP[f'{cls.__module__}.{cls.__name__}'] = cls DCLASS_SET = (DCLASS_SET | {cls})<|docstring|>Workflows need to extend the typeset so as to ensure that arguments are decoded/encoded correctly.<|endoftext|>
e03a0cf5d6b8800cca0bd0b68a68a80f8fd739e8c947f7250c1d331c8fad7e45
def initialise(): 'Register set of non-core types that require encoding/decoding.\n \n ' global IS_INITIALISED if IS_INITIALISED: return from stests.generators.wg_100.args import Arguments register_type(Arguments) from stests.generators.wg_101.args import Arguments register_type(Arguments) from stests.generators.wg_110.args import Arguments register_type(Arguments) from stests.generators.wg_111.args import Arguments register_type(Arguments) from stests.generators.wg_200.args import Arguments register_type(Arguments) from stests.generators.wg_201.args import Arguments register_type(Arguments) from stests.generators.wg_210.args import Arguments register_type(Arguments) from stests.generators.wg_211.args import Arguments register_type(Arguments) IS_INITIALISED = True
Register set of non-core types that require encoding/decoding.
stests/core/utils/encoder.py
initialise
dwerner/stests
4
python
def initialise(): '\n \n ' global IS_INITIALISED if IS_INITIALISED: return from stests.generators.wg_100.args import Arguments register_type(Arguments) from stests.generators.wg_101.args import Arguments register_type(Arguments) from stests.generators.wg_110.args import Arguments register_type(Arguments) from stests.generators.wg_111.args import Arguments register_type(Arguments) from stests.generators.wg_200.args import Arguments register_type(Arguments) from stests.generators.wg_201.args import Arguments register_type(Arguments) from stests.generators.wg_210.args import Arguments register_type(Arguments) from stests.generators.wg_211.args import Arguments register_type(Arguments) IS_INITIALISED = True
def initialise(): '\n \n ' global IS_INITIALISED if IS_INITIALISED: return from stests.generators.wg_100.args import Arguments register_type(Arguments) from stests.generators.wg_101.args import Arguments register_type(Arguments) from stests.generators.wg_110.args import Arguments register_type(Arguments) from stests.generators.wg_111.args import Arguments register_type(Arguments) from stests.generators.wg_200.args import Arguments register_type(Arguments) from stests.generators.wg_201.args import Arguments register_type(Arguments) from stests.generators.wg_210.args import Arguments register_type(Arguments) from stests.generators.wg_211.args import Arguments register_type(Arguments) IS_INITIALISED = True<|docstring|>Register set of non-core types that require encoding/decoding.<|endoftext|>
c5819d46753f50e83ad3a49dd94c172821e193150211782b382ec334fa2023c3
def test_version_create(): '\n Test we can create version object\n ' versions = ['4.21.7.1M', '4.20.24F-2GB', 'blablabla'] for v in versions: assert (v == EOSVersion(v).version)
Test we can create version object
test/eos/test_versions.py
test_version_create
mundruid/napalm
1,752
python
def test_version_create(): '\n \n ' versions = ['4.21.7.1M', '4.20.24F-2GB', 'blablabla'] for v in versions: assert (v == EOSVersion(v).version)
def test_version_create(): '\n \n ' versions = ['4.21.7.1M', '4.20.24F-2GB', 'blablabla'] for v in versions: assert (v == EOSVersion(v).version)<|docstring|>Test we can create version object<|endoftext|>
03312a6cd54564ba9ae5859e21f59ae5fc19373185bb72c5701e01f60f34b026
def test_version_comparisons(): '\n Test version comparison\n ' old_version = '4.21.7.1M' new_verion = '4.23.0F' assert (EOSVersion(old_version) < EOSVersion(new_verion)) assert (EOSVersion(new_verion) > EOSVersion(old_version)) assert (EOSVersion(old_version) <= EOSVersion(new_verion)) assert (EOSVersion(new_verion) >= EOSVersion(old_version)) assert (not (EOSVersion(old_version) < EOSVersion(old_version))) assert (EOSVersion(old_version) == EOSVersion(old_version)) assert (EOSVersion(old_version) <= EOSVersion(old_version))
Test version comparison
test/eos/test_versions.py
test_version_comparisons
mundruid/napalm
1,752
python
def test_version_comparisons(): '\n \n ' old_version = '4.21.7.1M' new_verion = '4.23.0F' assert (EOSVersion(old_version) < EOSVersion(new_verion)) assert (EOSVersion(new_verion) > EOSVersion(old_version)) assert (EOSVersion(old_version) <= EOSVersion(new_verion)) assert (EOSVersion(new_verion) >= EOSVersion(old_version)) assert (not (EOSVersion(old_version) < EOSVersion(old_version))) assert (EOSVersion(old_version) == EOSVersion(old_version)) assert (EOSVersion(old_version) <= EOSVersion(old_version))
def test_version_comparisons(): '\n \n ' old_version = '4.21.7.1M' new_verion = '4.23.0F' assert (EOSVersion(old_version) < EOSVersion(new_verion)) assert (EOSVersion(new_verion) > EOSVersion(old_version)) assert (EOSVersion(old_version) <= EOSVersion(new_verion)) assert (EOSVersion(new_verion) >= EOSVersion(old_version)) assert (not (EOSVersion(old_version) < EOSVersion(old_version))) assert (EOSVersion(old_version) == EOSVersion(old_version)) assert (EOSVersion(old_version) <= EOSVersion(old_version))<|docstring|>Test version comparison<|endoftext|>
1b4a966d48a840521fa24cac7c5de295831d14dfe63dbf2434546d531317f239
def __init__(self, data_dir, input_n, output_n, skip_rate, actions=None, split=0): '\n :param path_to_data:\n :param actions:\n :param input_n:\n :param output_n:\n :param dct_used:\n :param split: 0 train, 1 testing, 2 validation\n :param sample_rate:\n ' self.path_to_data = os.path.join(data_dir, 'h3.6m\\dataset') self.split = split self.in_n = input_n self.out_n = output_n self.sample_rate = 2 self.p3d = {} self.data_idx = [] seq_len = (self.in_n + self.out_n) subs = np.array([[1, 6, 7, 8, 9], [11], [5]]) if (actions is None): acts = ['walking', 'eating', 'smoking', 'discussion', 'directions', 'greeting', 'phoning', 'posing', 'purchases', 'sitting', 'sittingdown', 'takingphoto', 'waiting', 'walkingdog', 'walkingtogether'] else: acts = actions joint_name = ['Hips', 'RightUpLeg', 'RightLeg', 'RightFoot', 'RightToeBase', 'Site', 'LeftUpLeg', 'LeftLeg', 'LeftFoot', 'LeftToeBase', 'Site', 'Spine', 'Spine1', 'Neck', 'Head', 'Site', 'LeftShoulder', 'LeftArm', 'LeftForeArm', 'LeftHand', 'LeftHandThumb', 'Site', 'L_Wrist_End', 'Site', 'RightShoulder', 'RightArm', 'RightForeArm', 'RightHand', 'RightHandThumb', 'Site', 'R_Wrist_End', 'Site'] subs = subs[split] key = 0 for subj in subs: for action_idx in np.arange(len(acts)): action = acts[action_idx] if (self.split <= 1): for subact in [1, 2]: print('Reading subject {0}, action {1}, subaction {2}'.format(subj, action, subact)) filename = '{0}/S{1}/{2}_{3}.txt'.format(self.path_to_data, subj, action, subact) the_sequence = data_utils.readCSVasFloat(filename) (n, d) = the_sequence.shape even_list = range(0, n, self.sample_rate) num_frames = len(even_list) the_sequence = np.array(the_sequence[(even_list, :)]) the_sequence = torch.from_numpy(the_sequence).float().cuda() the_sequence[(:, 0:6)] = 0 p3d = data_utils.expmap2xyz_torch(the_sequence) self.p3d[key] = p3d.view(num_frames, (- 1)).cpu().data.numpy() valid_frames = np.arange(0, ((num_frames - seq_len) + 1), skip_rate) tmp_data_idx_1 = ([key] * len(valid_frames)) tmp_data_idx_2 = list(valid_frames) self.data_idx.extend(zip(tmp_data_idx_1, tmp_data_idx_2)) key += 1 else: print('Reading subject {0}, action {1}, subaction {2}'.format(subj, action, 1)) filename = '{0}/S{1}/{2}_{3}.txt'.format(self.path_to_data, subj, action, 1) the_sequence1 = data_utils.readCSVasFloat(filename) (n, d) = the_sequence1.shape even_list = range(0, n, self.sample_rate) num_frames1 = len(even_list) the_sequence1 = np.array(the_sequence1[(even_list, :)]) the_seq1 = torch.from_numpy(the_sequence1).float().cuda() the_seq1[(:, 0:6)] = 0 p3d1 = data_utils.expmap2xyz_torch(the_seq1) self.p3d[key] = p3d1.view(num_frames1, (- 1)).cpu().data.numpy() print('Reading subject {0}, action {1}, subaction {2}'.format(subj, action, 2)) filename = '{0}/S{1}/{2}_{3}.txt'.format(self.path_to_data, subj, action, 2) the_sequence2 = data_utils.readCSVasFloat(filename) (n, d) = the_sequence2.shape even_list = range(0, n, self.sample_rate) num_frames2 = len(even_list) the_sequence2 = np.array(the_sequence2[(even_list, :)]) the_seq2 = torch.from_numpy(the_sequence2).float().cuda() the_seq2[(:, 0:6)] = 0 p3d2 = data_utils.expmap2xyz_torch(the_seq2) self.p3d[(key + 1)] = p3d2.view(num_frames2, (- 1)).cpu().data.numpy() (fs_sel1, fs_sel2) = data_utils.find_indices_256(num_frames1, num_frames2, seq_len, input_n=self.in_n) valid_frames = fs_sel1[(:, 0)] tmp_data_idx_1 = ([key] * len(valid_frames)) tmp_data_idx_2 = list(valid_frames) self.data_idx.extend(zip(tmp_data_idx_1, tmp_data_idx_2)) valid_frames = fs_sel2[(:, 0)] tmp_data_idx_1 = ([(key + 1)] * len(valid_frames)) tmp_data_idx_2 = list(valid_frames) self.data_idx.extend(zip(tmp_data_idx_1, tmp_data_idx_2)) key += 2 joint_to_ignore = np.array([0, 1, 6, 11, 16, 20, 23, 24, 28, 31]) dimensions_to_ignore = np.concatenate(((joint_to_ignore * 3), ((joint_to_ignore * 3) + 1), ((joint_to_ignore * 3) + 2))) self.dimensions_to_use = np.setdiff1d(np.arange(96), dimensions_to_ignore)
:param path_to_data: :param actions: :param input_n: :param output_n: :param dct_used: :param split: 0 train, 1 testing, 2 validation :param sample_rate:
utils/h36motion3d.py
__init__
theodoriss/STSGCN
25
python
def __init__(self, data_dir, input_n, output_n, skip_rate, actions=None, split=0): '\n :param path_to_data:\n :param actions:\n :param input_n:\n :param output_n:\n :param dct_used:\n :param split: 0 train, 1 testing, 2 validation\n :param sample_rate:\n ' self.path_to_data = os.path.join(data_dir, 'h3.6m\\dataset') self.split = split self.in_n = input_n self.out_n = output_n self.sample_rate = 2 self.p3d = {} self.data_idx = [] seq_len = (self.in_n + self.out_n) subs = np.array([[1, 6, 7, 8, 9], [11], [5]]) if (actions is None): acts = ['walking', 'eating', 'smoking', 'discussion', 'directions', 'greeting', 'phoning', 'posing', 'purchases', 'sitting', 'sittingdown', 'takingphoto', 'waiting', 'walkingdog', 'walkingtogether'] else: acts = actions joint_name = ['Hips', 'RightUpLeg', 'RightLeg', 'RightFoot', 'RightToeBase', 'Site', 'LeftUpLeg', 'LeftLeg', 'LeftFoot', 'LeftToeBase', 'Site', 'Spine', 'Spine1', 'Neck', 'Head', 'Site', 'LeftShoulder', 'LeftArm', 'LeftForeArm', 'LeftHand', 'LeftHandThumb', 'Site', 'L_Wrist_End', 'Site', 'RightShoulder', 'RightArm', 'RightForeArm', 'RightHand', 'RightHandThumb', 'Site', 'R_Wrist_End', 'Site'] subs = subs[split] key = 0 for subj in subs: for action_idx in np.arange(len(acts)): action = acts[action_idx] if (self.split <= 1): for subact in [1, 2]: print('Reading subject {0}, action {1}, subaction {2}'.format(subj, action, subact)) filename = '{0}/S{1}/{2}_{3}.txt'.format(self.path_to_data, subj, action, subact) the_sequence = data_utils.readCSVasFloat(filename) (n, d) = the_sequence.shape even_list = range(0, n, self.sample_rate) num_frames = len(even_list) the_sequence = np.array(the_sequence[(even_list, :)]) the_sequence = torch.from_numpy(the_sequence).float().cuda() the_sequence[(:, 0:6)] = 0 p3d = data_utils.expmap2xyz_torch(the_sequence) self.p3d[key] = p3d.view(num_frames, (- 1)).cpu().data.numpy() valid_frames = np.arange(0, ((num_frames - seq_len) + 1), skip_rate) tmp_data_idx_1 = ([key] * len(valid_frames)) tmp_data_idx_2 = list(valid_frames) self.data_idx.extend(zip(tmp_data_idx_1, tmp_data_idx_2)) key += 1 else: print('Reading subject {0}, action {1}, subaction {2}'.format(subj, action, 1)) filename = '{0}/S{1}/{2}_{3}.txt'.format(self.path_to_data, subj, action, 1) the_sequence1 = data_utils.readCSVasFloat(filename) (n, d) = the_sequence1.shape even_list = range(0, n, self.sample_rate) num_frames1 = len(even_list) the_sequence1 = np.array(the_sequence1[(even_list, :)]) the_seq1 = torch.from_numpy(the_sequence1).float().cuda() the_seq1[(:, 0:6)] = 0 p3d1 = data_utils.expmap2xyz_torch(the_seq1) self.p3d[key] = p3d1.view(num_frames1, (- 1)).cpu().data.numpy() print('Reading subject {0}, action {1}, subaction {2}'.format(subj, action, 2)) filename = '{0}/S{1}/{2}_{3}.txt'.format(self.path_to_data, subj, action, 2) the_sequence2 = data_utils.readCSVasFloat(filename) (n, d) = the_sequence2.shape even_list = range(0, n, self.sample_rate) num_frames2 = len(even_list) the_sequence2 = np.array(the_sequence2[(even_list, :)]) the_seq2 = torch.from_numpy(the_sequence2).float().cuda() the_seq2[(:, 0:6)] = 0 p3d2 = data_utils.expmap2xyz_torch(the_seq2) self.p3d[(key + 1)] = p3d2.view(num_frames2, (- 1)).cpu().data.numpy() (fs_sel1, fs_sel2) = data_utils.find_indices_256(num_frames1, num_frames2, seq_len, input_n=self.in_n) valid_frames = fs_sel1[(:, 0)] tmp_data_idx_1 = ([key] * len(valid_frames)) tmp_data_idx_2 = list(valid_frames) self.data_idx.extend(zip(tmp_data_idx_1, tmp_data_idx_2)) valid_frames = fs_sel2[(:, 0)] tmp_data_idx_1 = ([(key + 1)] * len(valid_frames)) tmp_data_idx_2 = list(valid_frames) self.data_idx.extend(zip(tmp_data_idx_1, tmp_data_idx_2)) key += 2 joint_to_ignore = np.array([0, 1, 6, 11, 16, 20, 23, 24, 28, 31]) dimensions_to_ignore = np.concatenate(((joint_to_ignore * 3), ((joint_to_ignore * 3) + 1), ((joint_to_ignore * 3) + 2))) self.dimensions_to_use = np.setdiff1d(np.arange(96), dimensions_to_ignore)
def __init__(self, data_dir, input_n, output_n, skip_rate, actions=None, split=0): '\n :param path_to_data:\n :param actions:\n :param input_n:\n :param output_n:\n :param dct_used:\n :param split: 0 train, 1 testing, 2 validation\n :param sample_rate:\n ' self.path_to_data = os.path.join(data_dir, 'h3.6m\\dataset') self.split = split self.in_n = input_n self.out_n = output_n self.sample_rate = 2 self.p3d = {} self.data_idx = [] seq_len = (self.in_n + self.out_n) subs = np.array([[1, 6, 7, 8, 9], [11], [5]]) if (actions is None): acts = ['walking', 'eating', 'smoking', 'discussion', 'directions', 'greeting', 'phoning', 'posing', 'purchases', 'sitting', 'sittingdown', 'takingphoto', 'waiting', 'walkingdog', 'walkingtogether'] else: acts = actions joint_name = ['Hips', 'RightUpLeg', 'RightLeg', 'RightFoot', 'RightToeBase', 'Site', 'LeftUpLeg', 'LeftLeg', 'LeftFoot', 'LeftToeBase', 'Site', 'Spine', 'Spine1', 'Neck', 'Head', 'Site', 'LeftShoulder', 'LeftArm', 'LeftForeArm', 'LeftHand', 'LeftHandThumb', 'Site', 'L_Wrist_End', 'Site', 'RightShoulder', 'RightArm', 'RightForeArm', 'RightHand', 'RightHandThumb', 'Site', 'R_Wrist_End', 'Site'] subs = subs[split] key = 0 for subj in subs: for action_idx in np.arange(len(acts)): action = acts[action_idx] if (self.split <= 1): for subact in [1, 2]: print('Reading subject {0}, action {1}, subaction {2}'.format(subj, action, subact)) filename = '{0}/S{1}/{2}_{3}.txt'.format(self.path_to_data, subj, action, subact) the_sequence = data_utils.readCSVasFloat(filename) (n, d) = the_sequence.shape even_list = range(0, n, self.sample_rate) num_frames = len(even_list) the_sequence = np.array(the_sequence[(even_list, :)]) the_sequence = torch.from_numpy(the_sequence).float().cuda() the_sequence[(:, 0:6)] = 0 p3d = data_utils.expmap2xyz_torch(the_sequence) self.p3d[key] = p3d.view(num_frames, (- 1)).cpu().data.numpy() valid_frames = np.arange(0, ((num_frames - seq_len) + 1), skip_rate) tmp_data_idx_1 = ([key] * len(valid_frames)) tmp_data_idx_2 = list(valid_frames) self.data_idx.extend(zip(tmp_data_idx_1, tmp_data_idx_2)) key += 1 else: print('Reading subject {0}, action {1}, subaction {2}'.format(subj, action, 1)) filename = '{0}/S{1}/{2}_{3}.txt'.format(self.path_to_data, subj, action, 1) the_sequence1 = data_utils.readCSVasFloat(filename) (n, d) = the_sequence1.shape even_list = range(0, n, self.sample_rate) num_frames1 = len(even_list) the_sequence1 = np.array(the_sequence1[(even_list, :)]) the_seq1 = torch.from_numpy(the_sequence1).float().cuda() the_seq1[(:, 0:6)] = 0 p3d1 = data_utils.expmap2xyz_torch(the_seq1) self.p3d[key] = p3d1.view(num_frames1, (- 1)).cpu().data.numpy() print('Reading subject {0}, action {1}, subaction {2}'.format(subj, action, 2)) filename = '{0}/S{1}/{2}_{3}.txt'.format(self.path_to_data, subj, action, 2) the_sequence2 = data_utils.readCSVasFloat(filename) (n, d) = the_sequence2.shape even_list = range(0, n, self.sample_rate) num_frames2 = len(even_list) the_sequence2 = np.array(the_sequence2[(even_list, :)]) the_seq2 = torch.from_numpy(the_sequence2).float().cuda() the_seq2[(:, 0:6)] = 0 p3d2 = data_utils.expmap2xyz_torch(the_seq2) self.p3d[(key + 1)] = p3d2.view(num_frames2, (- 1)).cpu().data.numpy() (fs_sel1, fs_sel2) = data_utils.find_indices_256(num_frames1, num_frames2, seq_len, input_n=self.in_n) valid_frames = fs_sel1[(:, 0)] tmp_data_idx_1 = ([key] * len(valid_frames)) tmp_data_idx_2 = list(valid_frames) self.data_idx.extend(zip(tmp_data_idx_1, tmp_data_idx_2)) valid_frames = fs_sel2[(:, 0)] tmp_data_idx_1 = ([(key + 1)] * len(valid_frames)) tmp_data_idx_2 = list(valid_frames) self.data_idx.extend(zip(tmp_data_idx_1, tmp_data_idx_2)) key += 2 joint_to_ignore = np.array([0, 1, 6, 11, 16, 20, 23, 24, 28, 31]) dimensions_to_ignore = np.concatenate(((joint_to_ignore * 3), ((joint_to_ignore * 3) + 1), ((joint_to_ignore * 3) + 2))) self.dimensions_to_use = np.setdiff1d(np.arange(96), dimensions_to_ignore)<|docstring|>:param path_to_data: :param actions: :param input_n: :param output_n: :param dct_used: :param split: 0 train, 1 testing, 2 validation :param sample_rate:<|endoftext|>
6ffbdf43230bf598aff16533ac9df8c9dd79f0e097b6d4670a6052b4dd0ca9c8
def timings_report(n=10): "\n Returns the timings report, which is an overview of where finmag's runtime is spent.\n\n By default, it will show the 10 functions where the most runtime has been spent.\n This number can be changed by passing an integer to this function.\n\n Usage:\n import finmag\n print finmag.timings_report()\n\n " from aeon import timer return timer.report(n)
Returns the timings report, which is an overview of where finmag's runtime is spent. By default, it will show the 10 functions where the most runtime has been spent. This number can be changed by passing an integer to this function. Usage: import finmag print finmag.timings_report()
src/finmag/init.py
timings_report
davidcortesortuno/finmag
10
python
def timings_report(n=10): "\n Returns the timings report, which is an overview of where finmag's runtime is spent.\n\n By default, it will show the 10 functions where the most runtime has been spent.\n This number can be changed by passing an integer to this function.\n\n Usage:\n import finmag\n print finmag.timings_report()\n\n " from aeon import timer return timer.report(n)
def timings_report(n=10): "\n Returns the timings report, which is an overview of where finmag's runtime is spent.\n\n By default, it will show the 10 functions where the most runtime has been spent.\n This number can be changed by passing an integer to this function.\n\n Usage:\n import finmag\n print finmag.timings_report()\n\n " from aeon import timer return timer.report(n)<|docstring|>Returns the timings report, which is an overview of where finmag's runtime is spent. By default, it will show the 10 functions where the most runtime has been spent. This number can be changed by passing an integer to this function. Usage: import finmag print finmag.timings_report()<|endoftext|>
abdc9e998b9bd743e622057f549ef991ad9a397e79e21b44e9d810d8841e90b6
def KA(feat1, feat2, remove_mean=True): '\n feat1, feat2: n x d\n ' if remove_mean: feat1 -= np.mean(feat1, axis=0, keepdims=1) feat2 -= np.mean(feat2, axis=0, keepdims=1) norm12 = (norm(feat1.T.dot(feat2)) ** 2) norm11 = norm(feat1.T.dot(feat1)) norm22 = norm(feat2.T.dot(feat2)) return (norm12 / (norm11 * norm22))
feat1, feat2: n x d
vision/admin_computes_agent_sim.py
KA
baidu-research/task_space
10
python
def KA(feat1, feat2, remove_mean=True): '\n \n ' if remove_mean: feat1 -= np.mean(feat1, axis=0, keepdims=1) feat2 -= np.mean(feat2, axis=0, keepdims=1) norm12 = (norm(feat1.T.dot(feat2)) ** 2) norm11 = norm(feat1.T.dot(feat1)) norm22 = norm(feat2.T.dot(feat2)) return (norm12 / (norm11 * norm22))
def KA(feat1, feat2, remove_mean=True): '\n \n ' if remove_mean: feat1 -= np.mean(feat1, axis=0, keepdims=1) feat2 -= np.mean(feat2, axis=0, keepdims=1) norm12 = (norm(feat1.T.dot(feat2)) ** 2) norm11 = norm(feat1.T.dot(feat1)) norm22 = norm(feat2.T.dot(feat2)) return (norm12 / (norm11 * norm22))<|docstring|>feat1, feat2: n x d<|endoftext|>
a81331d44b6fc6009de64466527b268d4544e449745b0ffdf94d5ee0aefccc4f
def createWaitableTimer(securityAttributes=None, manualReset=False, name=None): "Wrapper to the kernel32 CreateWaitableTimer function.\n\tConsult https://msdn.microsoft.com/en-us/library/windows/desktop/ms682492.aspx for Microsoft's documentation.\n\tIn contrast with the original function, this wrapper assumes the following defaults.\n\t@param securityAttributes: Defaults to C{None};\n\t\tThe timer object gets a default security descriptor and the handle cannot be inherited.\n\t\tThe ACLs in the default security descriptor for a timer come from the primary or impersonation token of the creator.\n\t@type securityAttributes: pointer to L{SECURITY_ATTRIBUTES}\n\t@param manualReset: Defaults to C{False} which means the timer is a synchronization timer.\n\t\tIf C{True}, the timer is a manual-reset notification timer.\n\t@type manualReset: bool\n\t@param name: Defaults to C{None}, the timer object is created without a name.\n\t@type name: str\n\t" res = kernel32.CreateWaitableTimerW(securityAttributes, manualReset, name) if (res == 0): raise ctypes.WinError() return res
Wrapper to the kernel32 CreateWaitableTimer function. Consult https://msdn.microsoft.com/en-us/library/windows/desktop/ms682492.aspx for Microsoft's documentation. In contrast with the original function, this wrapper assumes the following defaults. @param securityAttributes: Defaults to C{None}; The timer object gets a default security descriptor and the handle cannot be inherited. The ACLs in the default security descriptor for a timer come from the primary or impersonation token of the creator. @type securityAttributes: pointer to L{SECURITY_ATTRIBUTES} @param manualReset: Defaults to C{False} which means the timer is a synchronization timer. If C{True}, the timer is a manual-reset notification timer. @type manualReset: bool @param name: Defaults to C{None}, the timer object is created without a name. @type name: str
source/winKernel.py
createWaitableTimer
lukaszgo1/nvda
1,592
python
def createWaitableTimer(securityAttributes=None, manualReset=False, name=None): "Wrapper to the kernel32 CreateWaitableTimer function.\n\tConsult https://msdn.microsoft.com/en-us/library/windows/desktop/ms682492.aspx for Microsoft's documentation.\n\tIn contrast with the original function, this wrapper assumes the following defaults.\n\t@param securityAttributes: Defaults to C{None};\n\t\tThe timer object gets a default security descriptor and the handle cannot be inherited.\n\t\tThe ACLs in the default security descriptor for a timer come from the primary or impersonation token of the creator.\n\t@type securityAttributes: pointer to L{SECURITY_ATTRIBUTES}\n\t@param manualReset: Defaults to C{False} which means the timer is a synchronization timer.\n\t\tIf C{True}, the timer is a manual-reset notification timer.\n\t@type manualReset: bool\n\t@param name: Defaults to C{None}, the timer object is created without a name.\n\t@type name: str\n\t" res = kernel32.CreateWaitableTimerW(securityAttributes, manualReset, name) if (res == 0): raise ctypes.WinError() return res
def createWaitableTimer(securityAttributes=None, manualReset=False, name=None): "Wrapper to the kernel32 CreateWaitableTimer function.\n\tConsult https://msdn.microsoft.com/en-us/library/windows/desktop/ms682492.aspx for Microsoft's documentation.\n\tIn contrast with the original function, this wrapper assumes the following defaults.\n\t@param securityAttributes: Defaults to C{None};\n\t\tThe timer object gets a default security descriptor and the handle cannot be inherited.\n\t\tThe ACLs in the default security descriptor for a timer come from the primary or impersonation token of the creator.\n\t@type securityAttributes: pointer to L{SECURITY_ATTRIBUTES}\n\t@param manualReset: Defaults to C{False} which means the timer is a synchronization timer.\n\t\tIf C{True}, the timer is a manual-reset notification timer.\n\t@type manualReset: bool\n\t@param name: Defaults to C{None}, the timer object is created without a name.\n\t@type name: str\n\t" res = kernel32.CreateWaitableTimerW(securityAttributes, manualReset, name) if (res == 0): raise ctypes.WinError() return res<|docstring|>Wrapper to the kernel32 CreateWaitableTimer function. Consult https://msdn.microsoft.com/en-us/library/windows/desktop/ms682492.aspx for Microsoft's documentation. In contrast with the original function, this wrapper assumes the following defaults. @param securityAttributes: Defaults to C{None}; The timer object gets a default security descriptor and the handle cannot be inherited. The ACLs in the default security descriptor for a timer come from the primary or impersonation token of the creator. @type securityAttributes: pointer to L{SECURITY_ATTRIBUTES} @param manualReset: Defaults to C{False} which means the timer is a synchronization timer. If C{True}, the timer is a manual-reset notification timer. @type manualReset: bool @param name: Defaults to C{None}, the timer object is created without a name. @type name: str<|endoftext|>
2df0c7cef5c89b67ab10b7c3010b3ce33b0833af42f3dc370e83b3aa1401f7c1
def setWaitableTimer(handle, dueTime, period=0, completionRoutine=None, arg=None, resume=False): "Wrapper to the kernel32 SETWaitableTimer function.\n\tConsult https://msdn.microsoft.com/en-us/library/windows/desktop/ms686289.aspx for Microsoft's documentation.\n\t@param handle: A handle to the timer object.\n\t@type handle: int\n\t@param dueTime: Relative time (in miliseconds).\n\t\tNote that the original function requires relative time to be supplied as a negative nanoseconds value.\n\t@type dueTime: int\n\t@param period: Defaults to 0, timer is only executed once.\n\t\tValue should be supplied in miliseconds.\n\t@type period: int\n\t@param completionRoutine: The function to be executed when the timer elapses.\n\t@type completionRoutine: L{PAPCFUNC}\n\t@param arg: Defaults to C{None}; a pointer to a structure that is passed to the completion routine.\n\t@type arg: L{ctypes.c_void_p}\n\t@param resume: Defaults to C{False}; the system is not restored.\n\t\tIf this parameter is TRUE, restores a system in suspended power conservation mode \n\t\twhen the timer state is set to signaled.\n\t@type resume: bool\n\t" res = kernel32.SetWaitableTimer(handle, byref(LARGE_INTEGER((dueTime * (- 10000)))), period, completionRoutine, arg, resume) if (res == 0): raise ctypes.WinError() return True
Wrapper to the kernel32 SETWaitableTimer function. Consult https://msdn.microsoft.com/en-us/library/windows/desktop/ms686289.aspx for Microsoft's documentation. @param handle: A handle to the timer object. @type handle: int @param dueTime: Relative time (in miliseconds). Note that the original function requires relative time to be supplied as a negative nanoseconds value. @type dueTime: int @param period: Defaults to 0, timer is only executed once. Value should be supplied in miliseconds. @type period: int @param completionRoutine: The function to be executed when the timer elapses. @type completionRoutine: L{PAPCFUNC} @param arg: Defaults to C{None}; a pointer to a structure that is passed to the completion routine. @type arg: L{ctypes.c_void_p} @param resume: Defaults to C{False}; the system is not restored. If this parameter is TRUE, restores a system in suspended power conservation mode when the timer state is set to signaled. @type resume: bool
source/winKernel.py
setWaitableTimer
lukaszgo1/nvda
1,592
python
def setWaitableTimer(handle, dueTime, period=0, completionRoutine=None, arg=None, resume=False): "Wrapper to the kernel32 SETWaitableTimer function.\n\tConsult https://msdn.microsoft.com/en-us/library/windows/desktop/ms686289.aspx for Microsoft's documentation.\n\t@param handle: A handle to the timer object.\n\t@type handle: int\n\t@param dueTime: Relative time (in miliseconds).\n\t\tNote that the original function requires relative time to be supplied as a negative nanoseconds value.\n\t@type dueTime: int\n\t@param period: Defaults to 0, timer is only executed once.\n\t\tValue should be supplied in miliseconds.\n\t@type period: int\n\t@param completionRoutine: The function to be executed when the timer elapses.\n\t@type completionRoutine: L{PAPCFUNC}\n\t@param arg: Defaults to C{None}; a pointer to a structure that is passed to the completion routine.\n\t@type arg: L{ctypes.c_void_p}\n\t@param resume: Defaults to C{False}; the system is not restored.\n\t\tIf this parameter is TRUE, restores a system in suspended power conservation mode \n\t\twhen the timer state is set to signaled.\n\t@type resume: bool\n\t" res = kernel32.SetWaitableTimer(handle, byref(LARGE_INTEGER((dueTime * (- 10000)))), period, completionRoutine, arg, resume) if (res == 0): raise ctypes.WinError() return True
def setWaitableTimer(handle, dueTime, period=0, completionRoutine=None, arg=None, resume=False): "Wrapper to the kernel32 SETWaitableTimer function.\n\tConsult https://msdn.microsoft.com/en-us/library/windows/desktop/ms686289.aspx for Microsoft's documentation.\n\t@param handle: A handle to the timer object.\n\t@type handle: int\n\t@param dueTime: Relative time (in miliseconds).\n\t\tNote that the original function requires relative time to be supplied as a negative nanoseconds value.\n\t@type dueTime: int\n\t@param period: Defaults to 0, timer is only executed once.\n\t\tValue should be supplied in miliseconds.\n\t@type period: int\n\t@param completionRoutine: The function to be executed when the timer elapses.\n\t@type completionRoutine: L{PAPCFUNC}\n\t@param arg: Defaults to C{None}; a pointer to a structure that is passed to the completion routine.\n\t@type arg: L{ctypes.c_void_p}\n\t@param resume: Defaults to C{False}; the system is not restored.\n\t\tIf this parameter is TRUE, restores a system in suspended power conservation mode \n\t\twhen the timer state is set to signaled.\n\t@type resume: bool\n\t" res = kernel32.SetWaitableTimer(handle, byref(LARGE_INTEGER((dueTime * (- 10000)))), period, completionRoutine, arg, resume) if (res == 0): raise ctypes.WinError() return True<|docstring|>Wrapper to the kernel32 SETWaitableTimer function. Consult https://msdn.microsoft.com/en-us/library/windows/desktop/ms686289.aspx for Microsoft's documentation. @param handle: A handle to the timer object. @type handle: int @param dueTime: Relative time (in miliseconds). Note that the original function requires relative time to be supplied as a negative nanoseconds value. @type dueTime: int @param period: Defaults to 0, timer is only executed once. Value should be supplied in miliseconds. @type period: int @param completionRoutine: The function to be executed when the timer elapses. @type completionRoutine: L{PAPCFUNC} @param arg: Defaults to C{None}; a pointer to a structure that is passed to the completion routine. @type arg: L{ctypes.c_void_p} @param resume: Defaults to C{False}; the system is not restored. If this parameter is TRUE, restores a system in suspended power conservation mode when the timer state is set to signaled. @type resume: bool<|endoftext|>
7ece88a11a00a1129a699107950be3f883bc4e23bc617100aa67fa29ff507478
def time_tToFileTime(time_tToConvert: float) -> FILETIME: 'Converts time_t as returned from `time.time` to a FILETIME structure.\n\tBased on a code snipped from:\n\thttps://docs.microsoft.com/en-us/windows/win32/sysinfo/converting-a-time-t-value-to-a-file-time\n\t' timeAsFileTime = FILETIME() res = ((int(time_tToConvert) * 10000000) + 116444736000000000) timeAsFileTime.dwLowDateTime = res timeAsFileTime.dwHighDateTime = (res >> 32) return timeAsFileTime
Converts time_t as returned from `time.time` to a FILETIME structure. Based on a code snipped from: https://docs.microsoft.com/en-us/windows/win32/sysinfo/converting-a-time-t-value-to-a-file-time
source/winKernel.py
time_tToFileTime
lukaszgo1/nvda
1,592
python
def time_tToFileTime(time_tToConvert: float) -> FILETIME: 'Converts time_t as returned from `time.time` to a FILETIME structure.\n\tBased on a code snipped from:\n\thttps://docs.microsoft.com/en-us/windows/win32/sysinfo/converting-a-time-t-value-to-a-file-time\n\t' timeAsFileTime = FILETIME() res = ((int(time_tToConvert) * 10000000) + 116444736000000000) timeAsFileTime.dwLowDateTime = res timeAsFileTime.dwHighDateTime = (res >> 32) return timeAsFileTime
def time_tToFileTime(time_tToConvert: float) -> FILETIME: 'Converts time_t as returned from `time.time` to a FILETIME structure.\n\tBased on a code snipped from:\n\thttps://docs.microsoft.com/en-us/windows/win32/sysinfo/converting-a-time-t-value-to-a-file-time\n\t' timeAsFileTime = FILETIME() res = ((int(time_tToConvert) * 10000000) + 116444736000000000) timeAsFileTime.dwLowDateTime = res timeAsFileTime.dwHighDateTime = (res >> 32) return timeAsFileTime<|docstring|>Converts time_t as returned from `time.time` to a FILETIME structure. Based on a code snipped from: https://docs.microsoft.com/en-us/windows/win32/sysinfo/converting-a-time-t-value-to-a-file-time<|endoftext|>
5e54d4d64dfd1adbd0e287fd750de1b628afb62abb80487d105c438fdc851939
def SystemTimeToTzSpecificLocalTime(lpTimeZoneInformation: Union[(TIME_ZONE_INFORMATION, None)], lpUniversalTime: SYSTEMTIME, lpLocalTime: SYSTEMTIME) -> None: 'Wrapper for `SystemTimeToTzSpecificLocalTime` from kernel32.\n\t:param lpTimeZoneInformation: Either TIME_ZONE_INFORMATION containing info about the desired time zone\n\tor `None` when the current time zone as configured in Windows settings should be used.\n\t:param lpUniversalTime: SYSTEMTIME structure containing time in UTC wwhich you wish to convert.\n\t: param lpLocalTime: A SYSTEMTIME structure in which time converted to the desired time zone would be placed.\n\t:raises WinError\n\t' if (lpTimeZoneInformation is not None): lpTimeZoneInformation = byref(lpTimeZoneInformation) if (kernel32.SystemTimeToTzSpecificLocalTime(lpTimeZoneInformation, byref(lpUniversalTime), byref(lpLocalTime)) == 0): raise WinError()
Wrapper for `SystemTimeToTzSpecificLocalTime` from kernel32. :param lpTimeZoneInformation: Either TIME_ZONE_INFORMATION containing info about the desired time zone or `None` when the current time zone as configured in Windows settings should be used. :param lpUniversalTime: SYSTEMTIME structure containing time in UTC wwhich you wish to convert. : param lpLocalTime: A SYSTEMTIME structure in which time converted to the desired time zone would be placed. :raises WinError
source/winKernel.py
SystemTimeToTzSpecificLocalTime
lukaszgo1/nvda
1,592
python
def SystemTimeToTzSpecificLocalTime(lpTimeZoneInformation: Union[(TIME_ZONE_INFORMATION, None)], lpUniversalTime: SYSTEMTIME, lpLocalTime: SYSTEMTIME) -> None: 'Wrapper for `SystemTimeToTzSpecificLocalTime` from kernel32.\n\t:param lpTimeZoneInformation: Either TIME_ZONE_INFORMATION containing info about the desired time zone\n\tor `None` when the current time zone as configured in Windows settings should be used.\n\t:param lpUniversalTime: SYSTEMTIME structure containing time in UTC wwhich you wish to convert.\n\t: param lpLocalTime: A SYSTEMTIME structure in which time converted to the desired time zone would be placed.\n\t:raises WinError\n\t' if (lpTimeZoneInformation is not None): lpTimeZoneInformation = byref(lpTimeZoneInformation) if (kernel32.SystemTimeToTzSpecificLocalTime(lpTimeZoneInformation, byref(lpUniversalTime), byref(lpLocalTime)) == 0): raise WinError()
def SystemTimeToTzSpecificLocalTime(lpTimeZoneInformation: Union[(TIME_ZONE_INFORMATION, None)], lpUniversalTime: SYSTEMTIME, lpLocalTime: SYSTEMTIME) -> None: 'Wrapper for `SystemTimeToTzSpecificLocalTime` from kernel32.\n\t:param lpTimeZoneInformation: Either TIME_ZONE_INFORMATION containing info about the desired time zone\n\tor `None` when the current time zone as configured in Windows settings should be used.\n\t:param lpUniversalTime: SYSTEMTIME structure containing time in UTC wwhich you wish to convert.\n\t: param lpLocalTime: A SYSTEMTIME structure in which time converted to the desired time zone would be placed.\n\t:raises WinError\n\t' if (lpTimeZoneInformation is not None): lpTimeZoneInformation = byref(lpTimeZoneInformation) if (kernel32.SystemTimeToTzSpecificLocalTime(lpTimeZoneInformation, byref(lpUniversalTime), byref(lpLocalTime)) == 0): raise WinError()<|docstring|>Wrapper for `SystemTimeToTzSpecificLocalTime` from kernel32. :param lpTimeZoneInformation: Either TIME_ZONE_INFORMATION containing info about the desired time zone or `None` when the current time zone as configured in Windows settings should be used. :param lpUniversalTime: SYSTEMTIME structure containing time in UTC wwhich you wish to convert. : param lpLocalTime: A SYSTEMTIME structure in which time converted to the desired time zone would be placed. :raises WinError<|endoftext|>
3ddb0461150795264c6c780bb1441fb5c1cdbd6f15b275526353a521eaec6a84
def __init__(self, h, autoFree=True): '\n\t\t@param h: the raw Windows HGLOBAL handle\n\t\t@param autoFree: True by default, the handle will automatically be freed with GlobalFree \n\t\twhen this object goes out of scope.\n\t\t' super(HGLOBAL, self).__init__(h) self._autoFree = autoFree
@param h: the raw Windows HGLOBAL handle @param autoFree: True by default, the handle will automatically be freed with GlobalFree when this object goes out of scope.
source/winKernel.py
__init__
lukaszgo1/nvda
1,592
python
def __init__(self, h, autoFree=True): '\n\t\t@param h: the raw Windows HGLOBAL handle\n\t\t@param autoFree: True by default, the handle will automatically be freed with GlobalFree \n\t\twhen this object goes out of scope.\n\t\t' super(HGLOBAL, self).__init__(h) self._autoFree = autoFree
def __init__(self, h, autoFree=True): '\n\t\t@param h: the raw Windows HGLOBAL handle\n\t\t@param autoFree: True by default, the handle will automatically be freed with GlobalFree \n\t\twhen this object goes out of scope.\n\t\t' super(HGLOBAL, self).__init__(h) self._autoFree = autoFree<|docstring|>@param h: the raw Windows HGLOBAL handle @param autoFree: True by default, the handle will automatically be freed with GlobalFree when this object goes out of scope.<|endoftext|>
d5eed194a1d709475b08f1b8c75d0895f754b312f2ebabb42b15df05c88c54b7
@classmethod def alloc(cls, flags, size): '\n\t\tAllocates global memory with GlobalAlloc\n\t\tproviding it as an instance of this class.\n\t\tThis method Takes the same arguments as GlobalAlloc.\n\t\t' h = windll.kernel32.GlobalAlloc(flags, size) return cls(h)
Allocates global memory with GlobalAlloc providing it as an instance of this class. This method Takes the same arguments as GlobalAlloc.
source/winKernel.py
alloc
lukaszgo1/nvda
1,592
python
@classmethod def alloc(cls, flags, size): '\n\t\tAllocates global memory with GlobalAlloc\n\t\tproviding it as an instance of this class.\n\t\tThis method Takes the same arguments as GlobalAlloc.\n\t\t' h = windll.kernel32.GlobalAlloc(flags, size) return cls(h)
@classmethod def alloc(cls, flags, size): '\n\t\tAllocates global memory with GlobalAlloc\n\t\tproviding it as an instance of this class.\n\t\tThis method Takes the same arguments as GlobalAlloc.\n\t\t' h = windll.kernel32.GlobalAlloc(flags, size) return cls(h)<|docstring|>Allocates global memory with GlobalAlloc providing it as an instance of this class. This method Takes the same arguments as GlobalAlloc.<|endoftext|>
da6173db7a1ef32734ffa48e89cdce47285fe34243a4836474d7ec30a63ddef4
@contextlib.contextmanager def lock(self): "\n\t\tUsed as a context manager,\n\t\tThis method locks the global memory with GlobalLock,\n\t\tproviding the usable memory address to the body of the 'with' statement.\n\t\tWhen the body completes, GlobalUnlock is automatically called.\n\t\t" try: (yield windll.kernel32.GlobalLock(self)) finally: windll.kernel32.GlobalUnlock(self)
Used as a context manager, This method locks the global memory with GlobalLock, providing the usable memory address to the body of the 'with' statement. When the body completes, GlobalUnlock is automatically called.
source/winKernel.py
lock
lukaszgo1/nvda
1,592
python
@contextlib.contextmanager def lock(self): "\n\t\tUsed as a context manager,\n\t\tThis method locks the global memory with GlobalLock,\n\t\tproviding the usable memory address to the body of the 'with' statement.\n\t\tWhen the body completes, GlobalUnlock is automatically called.\n\t\t" try: (yield windll.kernel32.GlobalLock(self)) finally: windll.kernel32.GlobalUnlock(self)
@contextlib.contextmanager def lock(self): "\n\t\tUsed as a context manager,\n\t\tThis method locks the global memory with GlobalLock,\n\t\tproviding the usable memory address to the body of the 'with' statement.\n\t\tWhen the body completes, GlobalUnlock is automatically called.\n\t\t" try: (yield windll.kernel32.GlobalLock(self)) finally: windll.kernel32.GlobalUnlock(self)<|docstring|>Used as a context manager, This method locks the global memory with GlobalLock, providing the usable memory address to the body of the 'with' statement. When the body completes, GlobalUnlock is automatically called.<|endoftext|>
41e94af91cdb6303ca9b026da033a8a6b3f15153cdb5ef318e9307f6e351e4ca
def forget(self): '\n\t\tSets this HGLOBAL value to NULL, forgetting the existing value.\n\t\tNecessary if you pass this HGLOBAL to an API that takes ownership and therefore will handle freeing itself.\n\t\t' self.value = None
Sets this HGLOBAL value to NULL, forgetting the existing value. Necessary if you pass this HGLOBAL to an API that takes ownership and therefore will handle freeing itself.
source/winKernel.py
forget
lukaszgo1/nvda
1,592
python
def forget(self): '\n\t\tSets this HGLOBAL value to NULL, forgetting the existing value.\n\t\tNecessary if you pass this HGLOBAL to an API that takes ownership and therefore will handle freeing itself.\n\t\t' self.value = None
def forget(self): '\n\t\tSets this HGLOBAL value to NULL, forgetting the existing value.\n\t\tNecessary if you pass this HGLOBAL to an API that takes ownership and therefore will handle freeing itself.\n\t\t' self.value = None<|docstring|>Sets this HGLOBAL value to NULL, forgetting the existing value. Necessary if you pass this HGLOBAL to an API that takes ownership and therefore will handle freeing itself.<|endoftext|>
851b9f5c0a528093ec671ead1b8b8433a8c919dea72c8bdfbd6c920d47558d38
def __init__(self, ingest_repository: IIngestRepository, transfer_ready_queue_publisher: ITransferReadyQueuePublisher, process_ready_queue_publisher: IProcessReadyQueuePublisher, ingest_status_api_client: IIngestStatusApiClient) -> None: '\n :param ingest_repository: an implementation of IIngestRepository\n :type ingest_repository: IIngestRepository\n :param transfer_ready_queue_publisher: an implementation of ITransferReadyQueuePublisher\n :type transfer_ready_queue_publisher: ITransferReadyQueuePublisher\n :param process_ready_queue_publisher: an implementation of IProcessReadyQueuePublisher\n :type process_ready_queue_publisher: IProcessReadyQueuePublisher\n :param ingest_status_api_client: an implementation of IIngestStatusApiClient\n :type ingest_status_api_client: IIngestStatusApiClient\n ' self.__ingest_repository = ingest_repository self.__transfer_ready_queue_publisher = transfer_ready_queue_publisher self.__process_ready_queue_publisher = process_ready_queue_publisher self.__ingest_status_api_client = ingest_status_api_client
:param ingest_repository: an implementation of IIngestRepository :type ingest_repository: IIngestRepository :param transfer_ready_queue_publisher: an implementation of ITransferReadyQueuePublisher :type transfer_ready_queue_publisher: ITransferReadyQueuePublisher :param process_ready_queue_publisher: an implementation of IProcessReadyQueuePublisher :type process_ready_queue_publisher: IProcessReadyQueuePublisher :param ingest_status_api_client: an implementation of IIngestStatusApiClient :type ingest_status_api_client: IIngestStatusApiClient
app/ingest/domain/services/ingest_service.py
__init__
GPortas/import-management-service
0
python
def __init__(self, ingest_repository: IIngestRepository, transfer_ready_queue_publisher: ITransferReadyQueuePublisher, process_ready_queue_publisher: IProcessReadyQueuePublisher, ingest_status_api_client: IIngestStatusApiClient) -> None: '\n :param ingest_repository: an implementation of IIngestRepository\n :type ingest_repository: IIngestRepository\n :param transfer_ready_queue_publisher: an implementation of ITransferReadyQueuePublisher\n :type transfer_ready_queue_publisher: ITransferReadyQueuePublisher\n :param process_ready_queue_publisher: an implementation of IProcessReadyQueuePublisher\n :type process_ready_queue_publisher: IProcessReadyQueuePublisher\n :param ingest_status_api_client: an implementation of IIngestStatusApiClient\n :type ingest_status_api_client: IIngestStatusApiClient\n ' self.__ingest_repository = ingest_repository self.__transfer_ready_queue_publisher = transfer_ready_queue_publisher self.__process_ready_queue_publisher = process_ready_queue_publisher self.__ingest_status_api_client = ingest_status_api_client
def __init__(self, ingest_repository: IIngestRepository, transfer_ready_queue_publisher: ITransferReadyQueuePublisher, process_ready_queue_publisher: IProcessReadyQueuePublisher, ingest_status_api_client: IIngestStatusApiClient) -> None: '\n :param ingest_repository: an implementation of IIngestRepository\n :type ingest_repository: IIngestRepository\n :param transfer_ready_queue_publisher: an implementation of ITransferReadyQueuePublisher\n :type transfer_ready_queue_publisher: ITransferReadyQueuePublisher\n :param process_ready_queue_publisher: an implementation of IProcessReadyQueuePublisher\n :type process_ready_queue_publisher: IProcessReadyQueuePublisher\n :param ingest_status_api_client: an implementation of IIngestStatusApiClient\n :type ingest_status_api_client: IIngestStatusApiClient\n ' self.__ingest_repository = ingest_repository self.__transfer_ready_queue_publisher = transfer_ready_queue_publisher self.__process_ready_queue_publisher = process_ready_queue_publisher self.__ingest_status_api_client = ingest_status_api_client<|docstring|>:param ingest_repository: an implementation of IIngestRepository :type ingest_repository: IIngestRepository :param transfer_ready_queue_publisher: an implementation of ITransferReadyQueuePublisher :type transfer_ready_queue_publisher: ITransferReadyQueuePublisher :param process_ready_queue_publisher: an implementation of IProcessReadyQueuePublisher :type process_ready_queue_publisher: IProcessReadyQueuePublisher :param ingest_status_api_client: an implementation of IIngestStatusApiClient :type ingest_status_api_client: IIngestStatusApiClient<|endoftext|>
89433c1349f8aa35cc7ca8e29c064ba266dd72959605f68af1e7b153294ebf8b
def get_ingest_by_package_id(self, ingest_package_id: str) -> Ingest: '\n Retrieves an ingest by calling the ingest repository.\n\n :param ingest_package_id: Ingest package id\n :type ingest_package_id: str\n\n :raises GetIngestByPackageIdException\n ' try: ingest = self.__ingest_repository.get_by_package_id(ingest_package_id) if (ingest is None): raise GetIngestByPackageIdException(ingest_package_id, f'No ingest found for package id {ingest_package_id}') return ingest except IngestQueryException as iqe: raise GetIngestByPackageIdException(ingest_package_id, str(iqe))
Retrieves an ingest by calling the ingest repository. :param ingest_package_id: Ingest package id :type ingest_package_id: str :raises GetIngestByPackageIdException
app/ingest/domain/services/ingest_service.py
get_ingest_by_package_id
GPortas/import-management-service
0
python
def get_ingest_by_package_id(self, ingest_package_id: str) -> Ingest: '\n Retrieves an ingest by calling the ingest repository.\n\n :param ingest_package_id: Ingest package id\n :type ingest_package_id: str\n\n :raises GetIngestByPackageIdException\n ' try: ingest = self.__ingest_repository.get_by_package_id(ingest_package_id) if (ingest is None): raise GetIngestByPackageIdException(ingest_package_id, f'No ingest found for package id {ingest_package_id}') return ingest except IngestQueryException as iqe: raise GetIngestByPackageIdException(ingest_package_id, str(iqe))
def get_ingest_by_package_id(self, ingest_package_id: str) -> Ingest: '\n Retrieves an ingest by calling the ingest repository.\n\n :param ingest_package_id: Ingest package id\n :type ingest_package_id: str\n\n :raises GetIngestByPackageIdException\n ' try: ingest = self.__ingest_repository.get_by_package_id(ingest_package_id) if (ingest is None): raise GetIngestByPackageIdException(ingest_package_id, f'No ingest found for package id {ingest_package_id}') return ingest except IngestQueryException as iqe: raise GetIngestByPackageIdException(ingest_package_id, str(iqe))<|docstring|>Retrieves an ingest by calling the ingest repository. :param ingest_package_id: Ingest package id :type ingest_package_id: str :raises GetIngestByPackageIdException<|endoftext|>
59cd362d5a81a72e55659a726da855259dc17e587dbe3029af3e1a5c646ea921
def transfer_ingest(self, ingest: Ingest) -> None: '\n Initiates an ingest transfer by calling transfer ready queue publisher and by updating\n its status.\n\n :param ingest: Ingest to transfer\n :type ingest: Ingest\n\n :raises TransferIngestException\n ' ingest.status = IngestStatus.pending_transfer_to_dropbox try: self.__transfer_ready_queue_publisher.publish_message(ingest) self.__ingest_repository.save(ingest) except (MqException, IngestSaveException) as e: raise TransferIngestException(ingest.package_id, str(e))
Initiates an ingest transfer by calling transfer ready queue publisher and by updating its status. :param ingest: Ingest to transfer :type ingest: Ingest :raises TransferIngestException
app/ingest/domain/services/ingest_service.py
transfer_ingest
GPortas/import-management-service
0
python
def transfer_ingest(self, ingest: Ingest) -> None: '\n Initiates an ingest transfer by calling transfer ready queue publisher and by updating\n its status.\n\n :param ingest: Ingest to transfer\n :type ingest: Ingest\n\n :raises TransferIngestException\n ' ingest.status = IngestStatus.pending_transfer_to_dropbox try: self.__transfer_ready_queue_publisher.publish_message(ingest) self.__ingest_repository.save(ingest) except (MqException, IngestSaveException) as e: raise TransferIngestException(ingest.package_id, str(e))
def transfer_ingest(self, ingest: Ingest) -> None: '\n Initiates an ingest transfer by calling transfer ready queue publisher and by updating\n its status.\n\n :param ingest: Ingest to transfer\n :type ingest: Ingest\n\n :raises TransferIngestException\n ' ingest.status = IngestStatus.pending_transfer_to_dropbox try: self.__transfer_ready_queue_publisher.publish_message(ingest) self.__ingest_repository.save(ingest) except (MqException, IngestSaveException) as e: raise TransferIngestException(ingest.package_id, str(e))<|docstring|>Initiates an ingest transfer by calling transfer ready queue publisher and by updating its status. :param ingest: Ingest to transfer :type ingest: Ingest :raises TransferIngestException<|endoftext|>
439a239f505042c5b6938958b6621a70f6915a0942cedaf693bca2250e80ea49
def set_ingest_as_transferred(self, ingest: Ingest) -> None: '\n Sets an ingest as transferred by updating and reporting its status.\n\n :param ingest: Ingest to set as transferred\n :type ingest: Ingest\n\n :raises SetIngestAsTransferredException\n ' ingest.status = IngestStatus.transferred_to_dropbox_successful try: self.__ingest_repository.save(ingest) self.__ingest_status_api_client.report_status(ingest) except (IngestSaveException, ReportStatusApiClientException) as e: raise SetIngestAsTransferredException(ingest.package_id, str(e))
Sets an ingest as transferred by updating and reporting its status. :param ingest: Ingest to set as transferred :type ingest: Ingest :raises SetIngestAsTransferredException
app/ingest/domain/services/ingest_service.py
set_ingest_as_transferred
GPortas/import-management-service
0
python
def set_ingest_as_transferred(self, ingest: Ingest) -> None: '\n Sets an ingest as transferred by updating and reporting its status.\n\n :param ingest: Ingest to set as transferred\n :type ingest: Ingest\n\n :raises SetIngestAsTransferredException\n ' ingest.status = IngestStatus.transferred_to_dropbox_successful try: self.__ingest_repository.save(ingest) self.__ingest_status_api_client.report_status(ingest) except (IngestSaveException, ReportStatusApiClientException) as e: raise SetIngestAsTransferredException(ingest.package_id, str(e))
def set_ingest_as_transferred(self, ingest: Ingest) -> None: '\n Sets an ingest as transferred by updating and reporting its status.\n\n :param ingest: Ingest to set as transferred\n :type ingest: Ingest\n\n :raises SetIngestAsTransferredException\n ' ingest.status = IngestStatus.transferred_to_dropbox_successful try: self.__ingest_repository.save(ingest) self.__ingest_status_api_client.report_status(ingest) except (IngestSaveException, ReportStatusApiClientException) as e: raise SetIngestAsTransferredException(ingest.package_id, str(e))<|docstring|>Sets an ingest as transferred by updating and reporting its status. :param ingest: Ingest to set as transferred :type ingest: Ingest :raises SetIngestAsTransferredException<|endoftext|>
131686f01bd53dd743a5b846ade30ad6787b160dd8cc3360f5953cda863e3295
def set_ingest_as_transferred_failed(self, ingest: Ingest) -> None: '\n Sets an ingest as transferred failed by updating and reporting its status.\n\n :param ingest: Ingest to report and update as transferred failed\n :type ingest: Ingest\n\n :raises SetIngestAsTransferredFailedException\n ' ingest.status = IngestStatus.transferred_to_dropbox_failed try: self.__ingest_repository.save(ingest) self.__ingest_status_api_client.report_status(ingest) except (IngestSaveException, ReportStatusApiClientException) as e: raise SetIngestAsTransferredFailedException(ingest.package_id, str(e))
Sets an ingest as transferred failed by updating and reporting its status. :param ingest: Ingest to report and update as transferred failed :type ingest: Ingest :raises SetIngestAsTransferredFailedException
app/ingest/domain/services/ingest_service.py
set_ingest_as_transferred_failed
GPortas/import-management-service
0
python
def set_ingest_as_transferred_failed(self, ingest: Ingest) -> None: '\n Sets an ingest as transferred failed by updating and reporting its status.\n\n :param ingest: Ingest to report and update as transferred failed\n :type ingest: Ingest\n\n :raises SetIngestAsTransferredFailedException\n ' ingest.status = IngestStatus.transferred_to_dropbox_failed try: self.__ingest_repository.save(ingest) self.__ingest_status_api_client.report_status(ingest) except (IngestSaveException, ReportStatusApiClientException) as e: raise SetIngestAsTransferredFailedException(ingest.package_id, str(e))
def set_ingest_as_transferred_failed(self, ingest: Ingest) -> None: '\n Sets an ingest as transferred failed by updating and reporting its status.\n\n :param ingest: Ingest to report and update as transferred failed\n :type ingest: Ingest\n\n :raises SetIngestAsTransferredFailedException\n ' ingest.status = IngestStatus.transferred_to_dropbox_failed try: self.__ingest_repository.save(ingest) self.__ingest_status_api_client.report_status(ingest) except (IngestSaveException, ReportStatusApiClientException) as e: raise SetIngestAsTransferredFailedException(ingest.package_id, str(e))<|docstring|>Sets an ingest as transferred failed by updating and reporting its status. :param ingest: Ingest to report and update as transferred failed :type ingest: Ingest :raises SetIngestAsTransferredFailedException<|endoftext|>
22faee9adfbe9a5c1e8a0ac59d97baa4ddb194f28c222a2a62ea0b2ca37dcb5d
def process_ingest(self, ingest: Ingest) -> None: '\n Initiates an ingest process by calling process ready queue publisher and by updating\n and reporting its status.\n\n :param ingest: Ingest to process\n :type ingest: Ingest\n\n :raises ProcessIngestException\n ' ingest.status = IngestStatus.processing_batch_ingest try: self.__process_ready_queue_publisher.publish_message(ingest) self.__ingest_repository.save(ingest) self.__ingest_status_api_client.report_status(ingest) except (MqException, IngestSaveException, ReportStatusApiClientException) as e: raise ProcessIngestException(ingest.package_id, str(e))
Initiates an ingest process by calling process ready queue publisher and by updating and reporting its status. :param ingest: Ingest to process :type ingest: Ingest :raises ProcessIngestException
app/ingest/domain/services/ingest_service.py
process_ingest
GPortas/import-management-service
0
python
def process_ingest(self, ingest: Ingest) -> None: '\n Initiates an ingest process by calling process ready queue publisher and by updating\n and reporting its status.\n\n :param ingest: Ingest to process\n :type ingest: Ingest\n\n :raises ProcessIngestException\n ' ingest.status = IngestStatus.processing_batch_ingest try: self.__process_ready_queue_publisher.publish_message(ingest) self.__ingest_repository.save(ingest) self.__ingest_status_api_client.report_status(ingest) except (MqException, IngestSaveException, ReportStatusApiClientException) as e: raise ProcessIngestException(ingest.package_id, str(e))
def process_ingest(self, ingest: Ingest) -> None: '\n Initiates an ingest process by calling process ready queue publisher and by updating\n and reporting its status.\n\n :param ingest: Ingest to process\n :type ingest: Ingest\n\n :raises ProcessIngestException\n ' ingest.status = IngestStatus.processing_batch_ingest try: self.__process_ready_queue_publisher.publish_message(ingest) self.__ingest_repository.save(ingest) self.__ingest_status_api_client.report_status(ingest) except (MqException, IngestSaveException, ReportStatusApiClientException) as e: raise ProcessIngestException(ingest.package_id, str(e))<|docstring|>Initiates an ingest process by calling process ready queue publisher and by updating and reporting its status. :param ingest: Ingest to process :type ingest: Ingest :raises ProcessIngestException<|endoftext|>
79497be9838b9868e0e59cfcdab7472e4ef4e61119b09a2d5e3598104ca0a9db
def set_ingest_as_processed(self, ingest: Ingest, drs_url: str) -> None: '\n Sets an ingest as processed by updating its DRS URL and by updating and reporting its status.\n\n :param ingest: Ingest to report and update as processed\n :type ingest: Ingest\n :param drs_url: DRS URL of the processed object\n :type drs_url: str\n\n :raises SetIngestAsProcessedException\n ' ingest.status = IngestStatus.batch_ingest_successful ingest.drs_url = drs_url try: self.__ingest_repository.save(ingest) self.__ingest_status_api_client.report_status(ingest) except (IngestSaveException, ReportStatusApiClientException) as e: raise SetIngestAsProcessedException(ingest.package_id, str(e))
Sets an ingest as processed by updating its DRS URL and by updating and reporting its status. :param ingest: Ingest to report and update as processed :type ingest: Ingest :param drs_url: DRS URL of the processed object :type drs_url: str :raises SetIngestAsProcessedException
app/ingest/domain/services/ingest_service.py
set_ingest_as_processed
GPortas/import-management-service
0
python
def set_ingest_as_processed(self, ingest: Ingest, drs_url: str) -> None: '\n Sets an ingest as processed by updating its DRS URL and by updating and reporting its status.\n\n :param ingest: Ingest to report and update as processed\n :type ingest: Ingest\n :param drs_url: DRS URL of the processed object\n :type drs_url: str\n\n :raises SetIngestAsProcessedException\n ' ingest.status = IngestStatus.batch_ingest_successful ingest.drs_url = drs_url try: self.__ingest_repository.save(ingest) self.__ingest_status_api_client.report_status(ingest) except (IngestSaveException, ReportStatusApiClientException) as e: raise SetIngestAsProcessedException(ingest.package_id, str(e))
def set_ingest_as_processed(self, ingest: Ingest, drs_url: str) -> None: '\n Sets an ingest as processed by updating its DRS URL and by updating and reporting its status.\n\n :param ingest: Ingest to report and update as processed\n :type ingest: Ingest\n :param drs_url: DRS URL of the processed object\n :type drs_url: str\n\n :raises SetIngestAsProcessedException\n ' ingest.status = IngestStatus.batch_ingest_successful ingest.drs_url = drs_url try: self.__ingest_repository.save(ingest) self.__ingest_status_api_client.report_status(ingest) except (IngestSaveException, ReportStatusApiClientException) as e: raise SetIngestAsProcessedException(ingest.package_id, str(e))<|docstring|>Sets an ingest as processed by updating its DRS URL and by updating and reporting its status. :param ingest: Ingest to report and update as processed :type ingest: Ingest :param drs_url: DRS URL of the processed object :type drs_url: str :raises SetIngestAsProcessedException<|endoftext|>
910ee3ec8fe4bc7147d1bd9187c33c91507a672305084318ca44904f44594d41
def set_ingest_as_processed_failed(self, ingest: Ingest) -> None: '\n Sets an ingest as processed failed by updating and reporting its status.\n\n :param ingest: Ingest to report and update as processed failed\n :type ingest: Ingest\n\n :raises SetIngestAsProcessedFailedException\n ' ingest.status = IngestStatus.batch_ingest_failed try: self.__ingest_repository.save(ingest) self.__ingest_status_api_client.report_status(ingest) except (IngestSaveException, ReportStatusApiClientException) as e: raise SetIngestAsProcessedFailedException(ingest.package_id, str(e))
Sets an ingest as processed failed by updating and reporting its status. :param ingest: Ingest to report and update as processed failed :type ingest: Ingest :raises SetIngestAsProcessedFailedException
app/ingest/domain/services/ingest_service.py
set_ingest_as_processed_failed
GPortas/import-management-service
0
python
def set_ingest_as_processed_failed(self, ingest: Ingest) -> None: '\n Sets an ingest as processed failed by updating and reporting its status.\n\n :param ingest: Ingest to report and update as processed failed\n :type ingest: Ingest\n\n :raises SetIngestAsProcessedFailedException\n ' ingest.status = IngestStatus.batch_ingest_failed try: self.__ingest_repository.save(ingest) self.__ingest_status_api_client.report_status(ingest) except (IngestSaveException, ReportStatusApiClientException) as e: raise SetIngestAsProcessedFailedException(ingest.package_id, str(e))
def set_ingest_as_processed_failed(self, ingest: Ingest) -> None: '\n Sets an ingest as processed failed by updating and reporting its status.\n\n :param ingest: Ingest to report and update as processed failed\n :type ingest: Ingest\n\n :raises SetIngestAsProcessedFailedException\n ' ingest.status = IngestStatus.batch_ingest_failed try: self.__ingest_repository.save(ingest) self.__ingest_status_api_client.report_status(ingest) except (IngestSaveException, ReportStatusApiClientException) as e: raise SetIngestAsProcessedFailedException(ingest.package_id, str(e))<|docstring|>Sets an ingest as processed failed by updating and reporting its status. :param ingest: Ingest to report and update as processed failed :type ingest: Ingest :raises SetIngestAsProcessedFailedException<|endoftext|>
94aee756701460a612fa3d7c8ce41c8ebc8249947f9a0d6b76e744fc0c044b08
def _checkMasLong(self, maDf): '\n check if Mas is long\n @maDf: DF of MAs\n ' maColumns = [('ma%s' % x) for x in self._longMas] maDf = maDf[maColumns] nbr = DyStockDataUtility.getMasLong(maDf, self._longMaDiff) if (self._longMasDays[0] <= nbr <= self._longMasDays[1]): return (True, nbr) return (False, nbr)
check if Mas is long @maDf: DF of MAs
Stock/Select/Strategy/Cta/DySS_MasLong.py
_checkMasLong
emaiqi/DevilYuan
135
python
def _checkMasLong(self, maDf): '\n check if Mas is long\n @maDf: DF of MAs\n ' maColumns = [('ma%s' % x) for x in self._longMas] maDf = maDf[maColumns] nbr = DyStockDataUtility.getMasLong(maDf, self._longMaDiff) if (self._longMasDays[0] <= nbr <= self._longMasDays[1]): return (True, nbr) return (False, nbr)
def _checkMasLong(self, maDf): '\n check if Mas is long\n @maDf: DF of MAs\n ' maColumns = [('ma%s' % x) for x in self._longMas] maDf = maDf[maColumns] nbr = DyStockDataUtility.getMasLong(maDf, self._longMaDiff) if (self._longMasDays[0] <= nbr <= self._longMasDays[1]): return (True, nbr) return (False, nbr)<|docstring|>check if Mas is long @maDf: DF of MAs<|endoftext|>
6d84f9bf984c6b60a5900410ee060263036b3d9c7d11ab9d7c11e5236809328b
def districts_in_range(district_plan, min_target, max_target): '\n :param district_plan: an iterable of Districts\n :param min_target: the minimum value for the population\n :param max_target: the maximum value for the population\n :return: the number of districts with populations in range\n (min_target <= population <= max_target)\n ' num_districts_in_range = 0 is_district_plan(district_plan) for district in district_plan: population = district.population is_int_pop(district) if (min_target <= population <= max_target): num_districts_in_range += 1 return num_districts_in_range
:param district_plan: an iterable of Districts :param min_target: the minimum value for the population :param max_target: the maximum value for the population :return: the number of districts with populations in range (min_target <= population <= max_target)
src/libdistrict/equal_population.py
districts_in_range
PlanScore/libdistrict
2
python
def districts_in_range(district_plan, min_target, max_target): '\n :param district_plan: an iterable of Districts\n :param min_target: the minimum value for the population\n :param max_target: the maximum value for the population\n :return: the number of districts with populations in range\n (min_target <= population <= max_target)\n ' num_districts_in_range = 0 is_district_plan(district_plan) for district in district_plan: population = district.population is_int_pop(district) if (min_target <= population <= max_target): num_districts_in_range += 1 return num_districts_in_range
def districts_in_range(district_plan, min_target, max_target): '\n :param district_plan: an iterable of Districts\n :param min_target: the minimum value for the population\n :param max_target: the maximum value for the population\n :return: the number of districts with populations in range\n (min_target <= population <= max_target)\n ' num_districts_in_range = 0 is_district_plan(district_plan) for district in district_plan: population = district.population is_int_pop(district) if (min_target <= population <= max_target): num_districts_in_range += 1 return num_districts_in_range<|docstring|>:param district_plan: an iterable of Districts :param min_target: the minimum value for the population :param max_target: the maximum value for the population :return: the number of districts with populations in range (min_target <= population <= max_target)<|endoftext|>
72584c7958a103cc1e0edadc252643e3de9ec720392d95bcbb427d980cfa71b5
def districts_in_percent_deviation(district_plan, percent_deviation): '\n :param district_plan: an iterable of Districts\n :param percent_deviation: the acceptable deviation percentage\n :return: the number of districts with populations\n that are with the percent_deviation range\n ' num_districts_in_percent_deviation = 0 num_districts = 0 total_pop = 0 is_district_plan(district_plan) for district in district_plan: num_districts += 1 is_int_pop(district) total_pop += district.population average_pop = (total_pop / num_districts) max_dev = ((percent_deviation / 100) * average_pop) for district in district_plan: if ((average_pop - max_dev) <= district.population <= (average_pop + max_dev)): num_districts_in_percent_deviation += 1 return num_districts_in_percent_deviation
:param district_plan: an iterable of Districts :param percent_deviation: the acceptable deviation percentage :return: the number of districts with populations that are with the percent_deviation range
src/libdistrict/equal_population.py
districts_in_percent_deviation
PlanScore/libdistrict
2
python
def districts_in_percent_deviation(district_plan, percent_deviation): '\n :param district_plan: an iterable of Districts\n :param percent_deviation: the acceptable deviation percentage\n :return: the number of districts with populations\n that are with the percent_deviation range\n ' num_districts_in_percent_deviation = 0 num_districts = 0 total_pop = 0 is_district_plan(district_plan) for district in district_plan: num_districts += 1 is_int_pop(district) total_pop += district.population average_pop = (total_pop / num_districts) max_dev = ((percent_deviation / 100) * average_pop) for district in district_plan: if ((average_pop - max_dev) <= district.population <= (average_pop + max_dev)): num_districts_in_percent_deviation += 1 return num_districts_in_percent_deviation
def districts_in_percent_deviation(district_plan, percent_deviation): '\n :param district_plan: an iterable of Districts\n :param percent_deviation: the acceptable deviation percentage\n :return: the number of districts with populations\n that are with the percent_deviation range\n ' num_districts_in_percent_deviation = 0 num_districts = 0 total_pop = 0 is_district_plan(district_plan) for district in district_plan: num_districts += 1 is_int_pop(district) total_pop += district.population average_pop = (total_pop / num_districts) max_dev = ((percent_deviation / 100) * average_pop) for district in district_plan: if ((average_pop - max_dev) <= district.population <= (average_pop + max_dev)): num_districts_in_percent_deviation += 1 return num_districts_in_percent_deviation<|docstring|>:param district_plan: an iterable of Districts :param percent_deviation: the acceptable deviation percentage :return: the number of districts with populations that are with the percent_deviation range<|endoftext|>
ca85a4f5ce96eead5000f24c0690a836abbcc0932b2275a17405d1477fe13db4
def __init__(self, key: Key, context: Context, actions: Sequence[Action]) -> None: "Instantiate Interaction.\n\n Args\n context: Features describing the interaction's context. Will be `None` for multi-armed bandit simulations.\n actions: Features describing available actions in the interaction.\n key : A unique key assigned to this interaction.\n " assert actions, 'At least one action must be provided to interact' self._key = key self._context = context self._actions = actions
Instantiate Interaction. Args context: Features describing the interaction's context. Will be `None` for multi-armed bandit simulations. actions: Features describing available actions in the interaction. key : A unique key assigned to this interaction.
coba/simulations/core.py
__init__
zmhammedi/coba
0
python
def __init__(self, key: Key, context: Context, actions: Sequence[Action]) -> None: "Instantiate Interaction.\n\n Args\n context: Features describing the interaction's context. Will be `None` for multi-armed bandit simulations.\n actions: Features describing available actions in the interaction.\n key : A unique key assigned to this interaction.\n " assert actions, 'At least one action must be provided to interact' self._key = key self._context = context self._actions = actions
def __init__(self, key: Key, context: Context, actions: Sequence[Action]) -> None: "Instantiate Interaction.\n\n Args\n context: Features describing the interaction's context. Will be `None` for multi-armed bandit simulations.\n actions: Features describing available actions in the interaction.\n key : A unique key assigned to this interaction.\n " assert actions, 'At least one action must be provided to interact' self._key = key self._context = context self._actions = actions<|docstring|>Instantiate Interaction. Args context: Features describing the interaction's context. Will be `None` for multi-armed bandit simulations. actions: Features describing available actions in the interaction. key : A unique key assigned to this interaction.<|endoftext|>
90aa8946eab5afea0ea7ef4886eb965ccad7eaaf6a8bfba5d97746cda45f9c35
@property def key(self) -> Key: 'A unique key identifying the interaction.' return self._key
A unique key identifying the interaction.
coba/simulations/core.py
key
zmhammedi/coba
0
python
@property def key(self) -> Key: return self._key
@property def key(self) -> Key: return self._key<|docstring|>A unique key identifying the interaction.<|endoftext|>
33051acf080d7b6d850c050e1a1f8891fee0e4d4c81034902a86faf5bdb7fc65
@property def context(self) -> Optional[Context]: "The interaction's context description." if ((self._context is None) or (not isinstance(self._context, collections.Sequence))): return self._context if ((len(self._context) == 2) and isinstance(self._context[0], tuple) and isinstance(self._context[1], tuple)): return dict(zip(self._context[0], self._context[1])) return self._context
The interaction's context description.
coba/simulations/core.py
context
zmhammedi/coba
0
python
@property def context(self) -> Optional[Context]: if ((self._context is None) or (not isinstance(self._context, collections.Sequence))): return self._context if ((len(self._context) == 2) and isinstance(self._context[0], tuple) and isinstance(self._context[1], tuple)): return dict(zip(self._context[0], self._context[1])) return self._context
@property def context(self) -> Optional[Context]: if ((self._context is None) or (not isinstance(self._context, collections.Sequence))): return self._context if ((len(self._context) == 2) and isinstance(self._context[0], tuple) and isinstance(self._context[1], tuple)): return dict(zip(self._context[0], self._context[1])) return self._context<|docstring|>The interaction's context description.<|endoftext|>
90533b9773b32fc0dc198b1e507a09ec6eac00dcc90ff6af3e1d7d29429a3c08
@property def actions(self) -> Sequence[Action]: "The interaction's available actions." actions = [] for action in self._actions: if (not isinstance(action, collections.Sequence)): actions.append(action) elif ((len(action) == 2) and isinstance(action[0], tuple) and isinstance(action[1], tuple)): actions.append(dict(zip(action[0], action[1]))) elif isinstance(action, str): actions.append(action) else: actions.append(action) return actions
The interaction's available actions.
coba/simulations/core.py
actions
zmhammedi/coba
0
python
@property def actions(self) -> Sequence[Action]: actions = [] for action in self._actions: if (not isinstance(action, collections.Sequence)): actions.append(action) elif ((len(action) == 2) and isinstance(action[0], tuple) and isinstance(action[1], tuple)): actions.append(dict(zip(action[0], action[1]))) elif isinstance(action, str): actions.append(action) else: actions.append(action) return actions
@property def actions(self) -> Sequence[Action]: actions = [] for action in self._actions: if (not isinstance(action, collections.Sequence)): actions.append(action) elif ((len(action) == 2) and isinstance(action[0], tuple) and isinstance(action[1], tuple)): actions.append(dict(zip(action[0], action[1]))) elif isinstance(action, str): actions.append(action) else: actions.append(action) return actions<|docstring|>The interaction's available actions.<|endoftext|>
d9889c9f2334c11414e7cfa0fec3a53da3c0470e56d6c8dee64b1c69051bd32d
@property @abstractmethod def interactions(self) -> Sequence[Interaction]: 'The sequence of interactions in a simulation.\n\n Remarks:\n Interactions should always be re-iterable. So long as interactions is a Sequence \n this will always be the case. If interactions is changed to Iterable in the future\n then it will be possible for it to only allow enumeration one time and care will need\n to be taken.\n ' ...
The sequence of interactions in a simulation. Remarks: Interactions should always be re-iterable. So long as interactions is a Sequence this will always be the case. If interactions is changed to Iterable in the future then it will be possible for it to only allow enumeration one time and care will need to be taken.
coba/simulations/core.py
interactions
zmhammedi/coba
0
python
@property @abstractmethod def interactions(self) -> Sequence[Interaction]: 'The sequence of interactions in a simulation.\n\n Remarks:\n Interactions should always be re-iterable. So long as interactions is a Sequence \n this will always be the case. If interactions is changed to Iterable in the future\n then it will be possible for it to only allow enumeration one time and care will need\n to be taken.\n ' ...
@property @abstractmethod def interactions(self) -> Sequence[Interaction]: 'The sequence of interactions in a simulation.\n\n Remarks:\n Interactions should always be re-iterable. So long as interactions is a Sequence \n this will always be the case. If interactions is changed to Iterable in the future\n then it will be possible for it to only allow enumeration one time and care will need\n to be taken.\n ' ...<|docstring|>The sequence of interactions in a simulation. Remarks: Interactions should always be re-iterable. So long as interactions is a Sequence this will always be the case. If interactions is changed to Iterable in the future then it will be possible for it to only allow enumeration one time and care will need to be taken.<|endoftext|>
7f5cf44b586e8d2aa95ef408551ec5f797ec0d08a3e3569fd35f06a7e8a20f48
@property @abstractmethod def reward(self) -> Reward: 'The reward object which can observe rewards for pairs of actions and interaction keys.' ...
The reward object which can observe rewards for pairs of actions and interaction keys.
coba/simulations/core.py
reward
zmhammedi/coba
0
python
@property @abstractmethod def reward(self) -> Reward: ...
@property @abstractmethod def reward(self) -> Reward: ...<|docstring|>The reward object which can observe rewards for pairs of actions and interaction keys.<|endoftext|>
b6eac6fa74abea394edfe34547df7c229da876a20dad04997be95a79c707aec4
def __init__(self, interactions: Sequence[Interaction], reward: Reward) -> None: 'Instantiate a MemorySimulation.\n\n Args:\n interactions: The sequence of interactions in this simulation.\n reward: The reward object to observe in this simulation.\n ' self._interactions = interactions self._reward = reward
Instantiate a MemorySimulation. Args: interactions: The sequence of interactions in this simulation. reward: The reward object to observe in this simulation.
coba/simulations/core.py
__init__
zmhammedi/coba
0
python
def __init__(self, interactions: Sequence[Interaction], reward: Reward) -> None: 'Instantiate a MemorySimulation.\n\n Args:\n interactions: The sequence of interactions in this simulation.\n reward: The reward object to observe in this simulation.\n ' self._interactions = interactions self._reward = reward
def __init__(self, interactions: Sequence[Interaction], reward: Reward) -> None: 'Instantiate a MemorySimulation.\n\n Args:\n interactions: The sequence of interactions in this simulation.\n reward: The reward object to observe in this simulation.\n ' self._interactions = interactions self._reward = reward<|docstring|>Instantiate a MemorySimulation. Args: interactions: The sequence of interactions in this simulation. reward: The reward object to observe in this simulation.<|endoftext|>
ff903ce11e5af2787b232fc96e49a33b9121de0dc2aa2900b03f40e19435fa81
@property def interactions(self) -> Sequence[Interaction]: 'The interactions in this simulation.\n\n Remarks:\n See the Simulation base class for more information.\n ' return self._interactions
The interactions in this simulation. Remarks: See the Simulation base class for more information.
coba/simulations/core.py
interactions
zmhammedi/coba
0
python
@property def interactions(self) -> Sequence[Interaction]: 'The interactions in this simulation.\n\n Remarks:\n See the Simulation base class for more information.\n ' return self._interactions
@property def interactions(self) -> Sequence[Interaction]: 'The interactions in this simulation.\n\n Remarks:\n See the Simulation base class for more information.\n ' return self._interactions<|docstring|>The interactions in this simulation. Remarks: See the Simulation base class for more information.<|endoftext|>
1a5cd1850c3fb5b9374e56d56c7d07e2c75e93fdc12e0eb997b991cc7c629058
@property def reward(self) -> Reward: 'The reward object which can observe rewards for pairs of actions and interaction keys.' return self._reward
The reward object which can observe rewards for pairs of actions and interaction keys.
coba/simulations/core.py
reward
zmhammedi/coba
0
python
@property def reward(self) -> Reward: return self._reward
@property def reward(self) -> Reward: return self._reward<|docstring|>The reward object which can observe rewards for pairs of actions and interaction keys.<|endoftext|>
7a4602d166f4790813e70a6146758f316877aa57b621e5a2f70d28d56f3d53e7
def __init__(self, features: Sequence[Any], labels: Union[(Sequence[Action], Sequence[Sequence[Action]])]) -> None: 'Instantiate a ClassificationSimulation.\n\n Args:\n features: The collection of features used for the original classifier problem.\n labels: The collection of labels assigned to each observation of features.\n ' assert (len(features) == len(labels)), 'Mismatched lengths of features and labels' if (isinstance(labels[0], collections.Sequence) and (not isinstance(labels[0], str))): labels_flat = list(chain.from_iterable(labels)) else: labels_flat = labels action_set = list(sorted(set(labels_flat), key=(lambda l: labels_flat.index(l)))) interactions = [Interaction(i, context, action_set) for (i, context) in enumerate(features)] reward = ClassificationReward(list(enumerate(labels))) super().__init__(interactions, reward)
Instantiate a ClassificationSimulation. Args: features: The collection of features used for the original classifier problem. labels: The collection of labels assigned to each observation of features.
coba/simulations/core.py
__init__
zmhammedi/coba
0
python
def __init__(self, features: Sequence[Any], labels: Union[(Sequence[Action], Sequence[Sequence[Action]])]) -> None: 'Instantiate a ClassificationSimulation.\n\n Args:\n features: The collection of features used for the original classifier problem.\n labels: The collection of labels assigned to each observation of features.\n ' assert (len(features) == len(labels)), 'Mismatched lengths of features and labels' if (isinstance(labels[0], collections.Sequence) and (not isinstance(labels[0], str))): labels_flat = list(chain.from_iterable(labels)) else: labels_flat = labels action_set = list(sorted(set(labels_flat), key=(lambda l: labels_flat.index(l)))) interactions = [Interaction(i, context, action_set) for (i, context) in enumerate(features)] reward = ClassificationReward(list(enumerate(labels))) super().__init__(interactions, reward)
def __init__(self, features: Sequence[Any], labels: Union[(Sequence[Action], Sequence[Sequence[Action]])]) -> None: 'Instantiate a ClassificationSimulation.\n\n Args:\n features: The collection of features used for the original classifier problem.\n labels: The collection of labels assigned to each observation of features.\n ' assert (len(features) == len(labels)), 'Mismatched lengths of features and labels' if (isinstance(labels[0], collections.Sequence) and (not isinstance(labels[0], str))): labels_flat = list(chain.from_iterable(labels)) else: labels_flat = labels action_set = list(sorted(set(labels_flat), key=(lambda l: labels_flat.index(l)))) interactions = [Interaction(i, context, action_set) for (i, context) in enumerate(features)] reward = ClassificationReward(list(enumerate(labels))) super().__init__(interactions, reward)<|docstring|>Instantiate a ClassificationSimulation. Args: features: The collection of features used for the original classifier problem. labels: The collection of labels assigned to each observation of features.<|endoftext|>
1c0183d7b71ec1ee3d7255b3a464d55fc62619de50c2cef10801cc46465bcf52
def __init__(self, n_interactions: int, context: Callable[([int], Context)], actions: Callable[([int, Context], Sequence[Action])], reward: Callable[([int, Context, Action], float)]) -> None: 'Instantiate a LambdaSimulation.\n\n Args:\n n_interactions: How many interactions the LambdaSimulation should have.\n context: A function that should return a context given an index in `range(n_interactions)`.\n actions: A function that should return all valid actions for a given index and context.\n reward: A function that should return the reward for the index, context and action.\n ' interaction_tuples: List[Tuple[(Key, Context, Sequence[Action])]] = [] reward_tuples: List[Tuple[(Key, Action, float)]] = [] for i in range(n_interactions): _context = context(i) _actions = actions(i, _context) _rewards = [reward(i, _context, _action) for _action in _actions] interaction_tuples.append((i, _context, _actions)) reward_tuples.extend(zip(repeat(i), _actions, _rewards)) self._interactions = [Interaction(key, context, actions) for (key, context, actions) in interaction_tuples] self._reward = MemoryReward(reward_tuples) self._simulation = MemorySimulation(self._interactions, self._reward)
Instantiate a LambdaSimulation. Args: n_interactions: How many interactions the LambdaSimulation should have. context: A function that should return a context given an index in `range(n_interactions)`. actions: A function that should return all valid actions for a given index and context. reward: A function that should return the reward for the index, context and action.
coba/simulations/core.py
__init__
zmhammedi/coba
0
python
def __init__(self, n_interactions: int, context: Callable[([int], Context)], actions: Callable[([int, Context], Sequence[Action])], reward: Callable[([int, Context, Action], float)]) -> None: 'Instantiate a LambdaSimulation.\n\n Args:\n n_interactions: How many interactions the LambdaSimulation should have.\n context: A function that should return a context given an index in `range(n_interactions)`.\n actions: A function that should return all valid actions for a given index and context.\n reward: A function that should return the reward for the index, context and action.\n ' interaction_tuples: List[Tuple[(Key, Context, Sequence[Action])]] = [] reward_tuples: List[Tuple[(Key, Action, float)]] = [] for i in range(n_interactions): _context = context(i) _actions = actions(i, _context) _rewards = [reward(i, _context, _action) for _action in _actions] interaction_tuples.append((i, _context, _actions)) reward_tuples.extend(zip(repeat(i), _actions, _rewards)) self._interactions = [Interaction(key, context, actions) for (key, context, actions) in interaction_tuples] self._reward = MemoryReward(reward_tuples) self._simulation = MemorySimulation(self._interactions, self._reward)
def __init__(self, n_interactions: int, context: Callable[([int], Context)], actions: Callable[([int, Context], Sequence[Action])], reward: Callable[([int, Context, Action], float)]) -> None: 'Instantiate a LambdaSimulation.\n\n Args:\n n_interactions: How many interactions the LambdaSimulation should have.\n context: A function that should return a context given an index in `range(n_interactions)`.\n actions: A function that should return all valid actions for a given index and context.\n reward: A function that should return the reward for the index, context and action.\n ' interaction_tuples: List[Tuple[(Key, Context, Sequence[Action])]] = [] reward_tuples: List[Tuple[(Key, Action, float)]] = [] for i in range(n_interactions): _context = context(i) _actions = actions(i, _context) _rewards = [reward(i, _context, _action) for _action in _actions] interaction_tuples.append((i, _context, _actions)) reward_tuples.extend(zip(repeat(i), _actions, _rewards)) self._interactions = [Interaction(key, context, actions) for (key, context, actions) in interaction_tuples] self._reward = MemoryReward(reward_tuples) self._simulation = MemorySimulation(self._interactions, self._reward)<|docstring|>Instantiate a LambdaSimulation. Args: n_interactions: How many interactions the LambdaSimulation should have. context: A function that should return a context given an index in `range(n_interactions)`. actions: A function that should return all valid actions for a given index and context. reward: A function that should return the reward for the index, context and action.<|endoftext|>
fec69e109b2fa3528887b138a2502a64ccf49dc4a191f97ab9b1eb3bb4983f68
def __init__(self, type='HEAT_FLUX', name=None, contact_type=None, displacement_type=None, force_type=None, strain_type=None, stress_type=None, velocity_type=None, acceleration_type=None, temperature_type=None, heat_flux_type=None, local_vars_configuration=None): 'OneOfSolidResultControlSolutionFields - a model defined in OpenAPI' if (local_vars_configuration is None): local_vars_configuration = Configuration() self.local_vars_configuration = local_vars_configuration self._type = None self._name = None self._contact_type = None self._displacement_type = None self._force_type = None self._strain_type = None self._stress_type = None self._velocity_type = None self._acceleration_type = None self._temperature_type = None self._heat_flux_type = None self.discriminator = 'type' self.type = type if (name is not None): self.name = name if (contact_type is not None): self.contact_type = contact_type if (displacement_type is not None): self.displacement_type = displacement_type if (force_type is not None): self.force_type = force_type if (strain_type is not None): self.strain_type = strain_type if (stress_type is not None): self.stress_type = stress_type if (velocity_type is not None): self.velocity_type = velocity_type if (acceleration_type is not None): self.acceleration_type = acceleration_type if (temperature_type is not None): self.temperature_type = temperature_type if (heat_flux_type is not None): self.heat_flux_type = heat_flux_type
OneOfSolidResultControlSolutionFields - a model defined in OpenAPI
simscale_sdk/models/one_of_solid_result_control_solution_fields.py
__init__
slainesimscale/simscale-python-sdk
8
python
def __init__(self, type='HEAT_FLUX', name=None, contact_type=None, displacement_type=None, force_type=None, strain_type=None, stress_type=None, velocity_type=None, acceleration_type=None, temperature_type=None, heat_flux_type=None, local_vars_configuration=None): if (local_vars_configuration is None): local_vars_configuration = Configuration() self.local_vars_configuration = local_vars_configuration self._type = None self._name = None self._contact_type = None self._displacement_type = None self._force_type = None self._strain_type = None self._stress_type = None self._velocity_type = None self._acceleration_type = None self._temperature_type = None self._heat_flux_type = None self.discriminator = 'type' self.type = type if (name is not None): self.name = name if (contact_type is not None): self.contact_type = contact_type if (displacement_type is not None): self.displacement_type = displacement_type if (force_type is not None): self.force_type = force_type if (strain_type is not None): self.strain_type = strain_type if (stress_type is not None): self.stress_type = stress_type if (velocity_type is not None): self.velocity_type = velocity_type if (acceleration_type is not None): self.acceleration_type = acceleration_type if (temperature_type is not None): self.temperature_type = temperature_type if (heat_flux_type is not None): self.heat_flux_type = heat_flux_type
def __init__(self, type='HEAT_FLUX', name=None, contact_type=None, displacement_type=None, force_type=None, strain_type=None, stress_type=None, velocity_type=None, acceleration_type=None, temperature_type=None, heat_flux_type=None, local_vars_configuration=None): if (local_vars_configuration is None): local_vars_configuration = Configuration() self.local_vars_configuration = local_vars_configuration self._type = None self._name = None self._contact_type = None self._displacement_type = None self._force_type = None self._strain_type = None self._stress_type = None self._velocity_type = None self._acceleration_type = None self._temperature_type = None self._heat_flux_type = None self.discriminator = 'type' self.type = type if (name is not None): self.name = name if (contact_type is not None): self.contact_type = contact_type if (displacement_type is not None): self.displacement_type = displacement_type if (force_type is not None): self.force_type = force_type if (strain_type is not None): self.strain_type = strain_type if (stress_type is not None): self.stress_type = stress_type if (velocity_type is not None): self.velocity_type = velocity_type if (acceleration_type is not None): self.acceleration_type = acceleration_type if (temperature_type is not None): self.temperature_type = temperature_type if (heat_flux_type is not None): self.heat_flux_type = heat_flux_type<|docstring|>OneOfSolidResultControlSolutionFields - a model defined in OpenAPI<|endoftext|>
ac69f9cde4b4b2eb4adf5d798fdf15b0f7bcede970ec97828f181923b1810430
@property def type(self): 'Gets the type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n\n Schema name: HeatFluxResultControlItem # noqa: E501\n\n :return: The type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n :rtype: str\n ' return self._type
Gets the type of this OneOfSolidResultControlSolutionFields. # noqa: E501 Schema name: HeatFluxResultControlItem # noqa: E501 :return: The type of this OneOfSolidResultControlSolutionFields. # noqa: E501 :rtype: str
simscale_sdk/models/one_of_solid_result_control_solution_fields.py
type
slainesimscale/simscale-python-sdk
8
python
@property def type(self): 'Gets the type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n\n Schema name: HeatFluxResultControlItem # noqa: E501\n\n :return: The type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n :rtype: str\n ' return self._type
@property def type(self): 'Gets the type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n\n Schema name: HeatFluxResultControlItem # noqa: E501\n\n :return: The type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n :rtype: str\n ' return self._type<|docstring|>Gets the type of this OneOfSolidResultControlSolutionFields. # noqa: E501 Schema name: HeatFluxResultControlItem # noqa: E501 :return: The type of this OneOfSolidResultControlSolutionFields. # noqa: E501 :rtype: str<|endoftext|>
8a397e1a6c932c15af4adfc1a6890806bfbbd1b6afd9205ef5699cc888eca526
@type.setter def type(self, type): 'Sets the type of this OneOfSolidResultControlSolutionFields.\n\n Schema name: HeatFluxResultControlItem # noqa: E501\n\n :param type: The type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n :type: str\n ' if (self.local_vars_configuration.client_side_validation and (type is None)): raise ValueError('Invalid value for `type`, must not be `None`') self._type = type
Sets the type of this OneOfSolidResultControlSolutionFields. Schema name: HeatFluxResultControlItem # noqa: E501 :param type: The type of this OneOfSolidResultControlSolutionFields. # noqa: E501 :type: str
simscale_sdk/models/one_of_solid_result_control_solution_fields.py
type
slainesimscale/simscale-python-sdk
8
python
@type.setter def type(self, type): 'Sets the type of this OneOfSolidResultControlSolutionFields.\n\n Schema name: HeatFluxResultControlItem # noqa: E501\n\n :param type: The type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n :type: str\n ' if (self.local_vars_configuration.client_side_validation and (type is None)): raise ValueError('Invalid value for `type`, must not be `None`') self._type = type
@type.setter def type(self, type): 'Sets the type of this OneOfSolidResultControlSolutionFields.\n\n Schema name: HeatFluxResultControlItem # noqa: E501\n\n :param type: The type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n :type: str\n ' if (self.local_vars_configuration.client_side_validation and (type is None)): raise ValueError('Invalid value for `type`, must not be `None`') self._type = type<|docstring|>Sets the type of this OneOfSolidResultControlSolutionFields. Schema name: HeatFluxResultControlItem # noqa: E501 :param type: The type of this OneOfSolidResultControlSolutionFields. # noqa: E501 :type: str<|endoftext|>
00185d3f5c38fbc7d06e70b35ae277100693295ef16d82bc145838e485b29248
@property def name(self): 'Gets the name of this OneOfSolidResultControlSolutionFields. # noqa: E501\n\n\n :return: The name of this OneOfSolidResultControlSolutionFields. # noqa: E501\n :rtype: str\n ' return self._name
Gets the name of this OneOfSolidResultControlSolutionFields. # noqa: E501 :return: The name of this OneOfSolidResultControlSolutionFields. # noqa: E501 :rtype: str
simscale_sdk/models/one_of_solid_result_control_solution_fields.py
name
slainesimscale/simscale-python-sdk
8
python
@property def name(self): 'Gets the name of this OneOfSolidResultControlSolutionFields. # noqa: E501\n\n\n :return: The name of this OneOfSolidResultControlSolutionFields. # noqa: E501\n :rtype: str\n ' return self._name
@property def name(self): 'Gets the name of this OneOfSolidResultControlSolutionFields. # noqa: E501\n\n\n :return: The name of this OneOfSolidResultControlSolutionFields. # noqa: E501\n :rtype: str\n ' return self._name<|docstring|>Gets the name of this OneOfSolidResultControlSolutionFields. # noqa: E501 :return: The name of this OneOfSolidResultControlSolutionFields. # noqa: E501 :rtype: str<|endoftext|>
45de250f2eec18469adbd4efbff534cf887156d98b12b5796910370cc58fdc6a
@name.setter def name(self, name): 'Sets the name of this OneOfSolidResultControlSolutionFields.\n\n\n :param name: The name of this OneOfSolidResultControlSolutionFields. # noqa: E501\n :type: str\n ' self._name = name
Sets the name of this OneOfSolidResultControlSolutionFields. :param name: The name of this OneOfSolidResultControlSolutionFields. # noqa: E501 :type: str
simscale_sdk/models/one_of_solid_result_control_solution_fields.py
name
slainesimscale/simscale-python-sdk
8
python
@name.setter def name(self, name): 'Sets the name of this OneOfSolidResultControlSolutionFields.\n\n\n :param name: The name of this OneOfSolidResultControlSolutionFields. # noqa: E501\n :type: str\n ' self._name = name
@name.setter def name(self, name): 'Sets the name of this OneOfSolidResultControlSolutionFields.\n\n\n :param name: The name of this OneOfSolidResultControlSolutionFields. # noqa: E501\n :type: str\n ' self._name = name<|docstring|>Sets the name of this OneOfSolidResultControlSolutionFields. :param name: The name of this OneOfSolidResultControlSolutionFields. # noqa: E501 :type: str<|endoftext|>
df5db46abc9765a62861b52a8d318b0e0e85af3e79823e86cd67bf3c90ea374d
@property def contact_type(self): 'Gets the contact_type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n\n\n :return: The contact_type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n :rtype: str\n ' return self._contact_type
Gets the contact_type of this OneOfSolidResultControlSolutionFields. # noqa: E501 :return: The contact_type of this OneOfSolidResultControlSolutionFields. # noqa: E501 :rtype: str
simscale_sdk/models/one_of_solid_result_control_solution_fields.py
contact_type
slainesimscale/simscale-python-sdk
8
python
@property def contact_type(self): 'Gets the contact_type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n\n\n :return: The contact_type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n :rtype: str\n ' return self._contact_type
@property def contact_type(self): 'Gets the contact_type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n\n\n :return: The contact_type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n :rtype: str\n ' return self._contact_type<|docstring|>Gets the contact_type of this OneOfSolidResultControlSolutionFields. # noqa: E501 :return: The contact_type of this OneOfSolidResultControlSolutionFields. # noqa: E501 :rtype: str<|endoftext|>
00c897a4c2b9f0cae3e9ec317a715120d3c3e264b0ff5e1c23456a1dfc578918
@contact_type.setter def contact_type(self, contact_type): 'Sets the contact_type of this OneOfSolidResultControlSolutionFields.\n\n\n :param contact_type: The contact_type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n :type: str\n ' allowed_values = ['PRESSURE', 'STATE'] if (self.local_vars_configuration.client_side_validation and (contact_type not in allowed_values)): raise ValueError('Invalid value for `contact_type` ({0}), must be one of {1}'.format(contact_type, allowed_values)) self._contact_type = contact_type
Sets the contact_type of this OneOfSolidResultControlSolutionFields. :param contact_type: The contact_type of this OneOfSolidResultControlSolutionFields. # noqa: E501 :type: str
simscale_sdk/models/one_of_solid_result_control_solution_fields.py
contact_type
slainesimscale/simscale-python-sdk
8
python
@contact_type.setter def contact_type(self, contact_type): 'Sets the contact_type of this OneOfSolidResultControlSolutionFields.\n\n\n :param contact_type: The contact_type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n :type: str\n ' allowed_values = ['PRESSURE', 'STATE'] if (self.local_vars_configuration.client_side_validation and (contact_type not in allowed_values)): raise ValueError('Invalid value for `contact_type` ({0}), must be one of {1}'.format(contact_type, allowed_values)) self._contact_type = contact_type
@contact_type.setter def contact_type(self, contact_type): 'Sets the contact_type of this OneOfSolidResultControlSolutionFields.\n\n\n :param contact_type: The contact_type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n :type: str\n ' allowed_values = ['PRESSURE', 'STATE'] if (self.local_vars_configuration.client_side_validation and (contact_type not in allowed_values)): raise ValueError('Invalid value for `contact_type` ({0}), must be one of {1}'.format(contact_type, allowed_values)) self._contact_type = contact_type<|docstring|>Sets the contact_type of this OneOfSolidResultControlSolutionFields. :param contact_type: The contact_type of this OneOfSolidResultControlSolutionFields. # noqa: E501 :type: str<|endoftext|>
bdf152bcc0de12d79e31415e2f6d8f0a898e979fbc268a6d01dcbf37d1b5b008
@property def displacement_type(self): 'Gets the displacement_type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n\n\n :return: The displacement_type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n :rtype: GlobalDisplacementType\n ' return self._displacement_type
Gets the displacement_type of this OneOfSolidResultControlSolutionFields. # noqa: E501 :return: The displacement_type of this OneOfSolidResultControlSolutionFields. # noqa: E501 :rtype: GlobalDisplacementType
simscale_sdk/models/one_of_solid_result_control_solution_fields.py
displacement_type
slainesimscale/simscale-python-sdk
8
python
@property def displacement_type(self): 'Gets the displacement_type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n\n\n :return: The displacement_type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n :rtype: GlobalDisplacementType\n ' return self._displacement_type
@property def displacement_type(self): 'Gets the displacement_type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n\n\n :return: The displacement_type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n :rtype: GlobalDisplacementType\n ' return self._displacement_type<|docstring|>Gets the displacement_type of this OneOfSolidResultControlSolutionFields. # noqa: E501 :return: The displacement_type of this OneOfSolidResultControlSolutionFields. # noqa: E501 :rtype: GlobalDisplacementType<|endoftext|>
543c66cb8eb9040a6a9091971f984432a867febabdae1b237c81185eb664e368
@displacement_type.setter def displacement_type(self, displacement_type): 'Sets the displacement_type of this OneOfSolidResultControlSolutionFields.\n\n\n :param displacement_type: The displacement_type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n :type: GlobalDisplacementType\n ' self._displacement_type = displacement_type
Sets the displacement_type of this OneOfSolidResultControlSolutionFields. :param displacement_type: The displacement_type of this OneOfSolidResultControlSolutionFields. # noqa: E501 :type: GlobalDisplacementType
simscale_sdk/models/one_of_solid_result_control_solution_fields.py
displacement_type
slainesimscale/simscale-python-sdk
8
python
@displacement_type.setter def displacement_type(self, displacement_type): 'Sets the displacement_type of this OneOfSolidResultControlSolutionFields.\n\n\n :param displacement_type: The displacement_type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n :type: GlobalDisplacementType\n ' self._displacement_type = displacement_type
@displacement_type.setter def displacement_type(self, displacement_type): 'Sets the displacement_type of this OneOfSolidResultControlSolutionFields.\n\n\n :param displacement_type: The displacement_type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n :type: GlobalDisplacementType\n ' self._displacement_type = displacement_type<|docstring|>Sets the displacement_type of this OneOfSolidResultControlSolutionFields. :param displacement_type: The displacement_type of this OneOfSolidResultControlSolutionFields. # noqa: E501 :type: GlobalDisplacementType<|endoftext|>
41dd4eb09061086669fa7a5948a3b1f26dfba7b7aa5992938b627618f5a62e20
@property def force_type(self): 'Gets the force_type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n\n\n :return: The force_type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n :rtype: OneOfForceResultControlItemForceType\n ' return self._force_type
Gets the force_type of this OneOfSolidResultControlSolutionFields. # noqa: E501 :return: The force_type of this OneOfSolidResultControlSolutionFields. # noqa: E501 :rtype: OneOfForceResultControlItemForceType
simscale_sdk/models/one_of_solid_result_control_solution_fields.py
force_type
slainesimscale/simscale-python-sdk
8
python
@property def force_type(self): 'Gets the force_type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n\n\n :return: The force_type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n :rtype: OneOfForceResultControlItemForceType\n ' return self._force_type
@property def force_type(self): 'Gets the force_type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n\n\n :return: The force_type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n :rtype: OneOfForceResultControlItemForceType\n ' return self._force_type<|docstring|>Gets the force_type of this OneOfSolidResultControlSolutionFields. # noqa: E501 :return: The force_type of this OneOfSolidResultControlSolutionFields. # noqa: E501 :rtype: OneOfForceResultControlItemForceType<|endoftext|>
9b5ea2c4ae28a21d2f84fc07477e3a50a5ea359743be9f3f9696ad59857a648b
@force_type.setter def force_type(self, force_type): 'Sets the force_type of this OneOfSolidResultControlSolutionFields.\n\n\n :param force_type: The force_type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n :type: OneOfForceResultControlItemForceType\n ' self._force_type = force_type
Sets the force_type of this OneOfSolidResultControlSolutionFields. :param force_type: The force_type of this OneOfSolidResultControlSolutionFields. # noqa: E501 :type: OneOfForceResultControlItemForceType
simscale_sdk/models/one_of_solid_result_control_solution_fields.py
force_type
slainesimscale/simscale-python-sdk
8
python
@force_type.setter def force_type(self, force_type): 'Sets the force_type of this OneOfSolidResultControlSolutionFields.\n\n\n :param force_type: The force_type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n :type: OneOfForceResultControlItemForceType\n ' self._force_type = force_type
@force_type.setter def force_type(self, force_type): 'Sets the force_type of this OneOfSolidResultControlSolutionFields.\n\n\n :param force_type: The force_type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n :type: OneOfForceResultControlItemForceType\n ' self._force_type = force_type<|docstring|>Sets the force_type of this OneOfSolidResultControlSolutionFields. :param force_type: The force_type of this OneOfSolidResultControlSolutionFields. # noqa: E501 :type: OneOfForceResultControlItemForceType<|endoftext|>
42882fa7978b16d4553643e047ae572dd1955a8168ac8d9c14f2b26f7999569c
@property def strain_type(self): 'Gets the strain_type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n\n\n :return: The strain_type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n :rtype: OneOfStrainResultControlItemStrainType\n ' return self._strain_type
Gets the strain_type of this OneOfSolidResultControlSolutionFields. # noqa: E501 :return: The strain_type of this OneOfSolidResultControlSolutionFields. # noqa: E501 :rtype: OneOfStrainResultControlItemStrainType
simscale_sdk/models/one_of_solid_result_control_solution_fields.py
strain_type
slainesimscale/simscale-python-sdk
8
python
@property def strain_type(self): 'Gets the strain_type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n\n\n :return: The strain_type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n :rtype: OneOfStrainResultControlItemStrainType\n ' return self._strain_type
@property def strain_type(self): 'Gets the strain_type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n\n\n :return: The strain_type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n :rtype: OneOfStrainResultControlItemStrainType\n ' return self._strain_type<|docstring|>Gets the strain_type of this OneOfSolidResultControlSolutionFields. # noqa: E501 :return: The strain_type of this OneOfSolidResultControlSolutionFields. # noqa: E501 :rtype: OneOfStrainResultControlItemStrainType<|endoftext|>
49910dc3c7f17ae4e14af10d4828ca4e6cf21918cc06ec8b0feb092bee742c83
@strain_type.setter def strain_type(self, strain_type): 'Sets the strain_type of this OneOfSolidResultControlSolutionFields.\n\n\n :param strain_type: The strain_type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n :type: OneOfStrainResultControlItemStrainType\n ' self._strain_type = strain_type
Sets the strain_type of this OneOfSolidResultControlSolutionFields. :param strain_type: The strain_type of this OneOfSolidResultControlSolutionFields. # noqa: E501 :type: OneOfStrainResultControlItemStrainType
simscale_sdk/models/one_of_solid_result_control_solution_fields.py
strain_type
slainesimscale/simscale-python-sdk
8
python
@strain_type.setter def strain_type(self, strain_type): 'Sets the strain_type of this OneOfSolidResultControlSolutionFields.\n\n\n :param strain_type: The strain_type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n :type: OneOfStrainResultControlItemStrainType\n ' self._strain_type = strain_type
@strain_type.setter def strain_type(self, strain_type): 'Sets the strain_type of this OneOfSolidResultControlSolutionFields.\n\n\n :param strain_type: The strain_type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n :type: OneOfStrainResultControlItemStrainType\n ' self._strain_type = strain_type<|docstring|>Sets the strain_type of this OneOfSolidResultControlSolutionFields. :param strain_type: The strain_type of this OneOfSolidResultControlSolutionFields. # noqa: E501 :type: OneOfStrainResultControlItemStrainType<|endoftext|>
15488107211b8b19d775c766bceb9dbbe210999bc72cca5fe748589467da8057
@property def stress_type(self): 'Gets the stress_type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n\n\n :return: The stress_type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n :rtype: OneOfStressResultControlItemStressType\n ' return self._stress_type
Gets the stress_type of this OneOfSolidResultControlSolutionFields. # noqa: E501 :return: The stress_type of this OneOfSolidResultControlSolutionFields. # noqa: E501 :rtype: OneOfStressResultControlItemStressType
simscale_sdk/models/one_of_solid_result_control_solution_fields.py
stress_type
slainesimscale/simscale-python-sdk
8
python
@property def stress_type(self): 'Gets the stress_type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n\n\n :return: The stress_type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n :rtype: OneOfStressResultControlItemStressType\n ' return self._stress_type
@property def stress_type(self): 'Gets the stress_type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n\n\n :return: The stress_type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n :rtype: OneOfStressResultControlItemStressType\n ' return self._stress_type<|docstring|>Gets the stress_type of this OneOfSolidResultControlSolutionFields. # noqa: E501 :return: The stress_type of this OneOfSolidResultControlSolutionFields. # noqa: E501 :rtype: OneOfStressResultControlItemStressType<|endoftext|>
3fc12a4de0b9ebdcbfdef01ddf0ab2b7bcc53414962d6e2db323b13773be6dda
@stress_type.setter def stress_type(self, stress_type): 'Sets the stress_type of this OneOfSolidResultControlSolutionFields.\n\n\n :param stress_type: The stress_type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n :type: OneOfStressResultControlItemStressType\n ' self._stress_type = stress_type
Sets the stress_type of this OneOfSolidResultControlSolutionFields. :param stress_type: The stress_type of this OneOfSolidResultControlSolutionFields. # noqa: E501 :type: OneOfStressResultControlItemStressType
simscale_sdk/models/one_of_solid_result_control_solution_fields.py
stress_type
slainesimscale/simscale-python-sdk
8
python
@stress_type.setter def stress_type(self, stress_type): 'Sets the stress_type of this OneOfSolidResultControlSolutionFields.\n\n\n :param stress_type: The stress_type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n :type: OneOfStressResultControlItemStressType\n ' self._stress_type = stress_type
@stress_type.setter def stress_type(self, stress_type): 'Sets the stress_type of this OneOfSolidResultControlSolutionFields.\n\n\n :param stress_type: The stress_type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n :type: OneOfStressResultControlItemStressType\n ' self._stress_type = stress_type<|docstring|>Sets the stress_type of this OneOfSolidResultControlSolutionFields. :param stress_type: The stress_type of this OneOfSolidResultControlSolutionFields. # noqa: E501 :type: OneOfStressResultControlItemStressType<|endoftext|>
9373c904a7f385caa00fe8ea6fa112bdb8acdd4b8eae3f075a7dedf5cbefa6c6
@property def velocity_type(self): 'Gets the velocity_type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n\n\n :return: The velocity_type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n :rtype: GlobalVelocityType\n ' return self._velocity_type
Gets the velocity_type of this OneOfSolidResultControlSolutionFields. # noqa: E501 :return: The velocity_type of this OneOfSolidResultControlSolutionFields. # noqa: E501 :rtype: GlobalVelocityType
simscale_sdk/models/one_of_solid_result_control_solution_fields.py
velocity_type
slainesimscale/simscale-python-sdk
8
python
@property def velocity_type(self): 'Gets the velocity_type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n\n\n :return: The velocity_type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n :rtype: GlobalVelocityType\n ' return self._velocity_type
@property def velocity_type(self): 'Gets the velocity_type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n\n\n :return: The velocity_type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n :rtype: GlobalVelocityType\n ' return self._velocity_type<|docstring|>Gets the velocity_type of this OneOfSolidResultControlSolutionFields. # noqa: E501 :return: The velocity_type of this OneOfSolidResultControlSolutionFields. # noqa: E501 :rtype: GlobalVelocityType<|endoftext|>
0b5235225e4902e0460519715fb19d24294b59e33e12b89842d44d938a0bbee6
@velocity_type.setter def velocity_type(self, velocity_type): 'Sets the velocity_type of this OneOfSolidResultControlSolutionFields.\n\n\n :param velocity_type: The velocity_type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n :type: GlobalVelocityType\n ' self._velocity_type = velocity_type
Sets the velocity_type of this OneOfSolidResultControlSolutionFields. :param velocity_type: The velocity_type of this OneOfSolidResultControlSolutionFields. # noqa: E501 :type: GlobalVelocityType
simscale_sdk/models/one_of_solid_result_control_solution_fields.py
velocity_type
slainesimscale/simscale-python-sdk
8
python
@velocity_type.setter def velocity_type(self, velocity_type): 'Sets the velocity_type of this OneOfSolidResultControlSolutionFields.\n\n\n :param velocity_type: The velocity_type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n :type: GlobalVelocityType\n ' self._velocity_type = velocity_type
@velocity_type.setter def velocity_type(self, velocity_type): 'Sets the velocity_type of this OneOfSolidResultControlSolutionFields.\n\n\n :param velocity_type: The velocity_type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n :type: GlobalVelocityType\n ' self._velocity_type = velocity_type<|docstring|>Sets the velocity_type of this OneOfSolidResultControlSolutionFields. :param velocity_type: The velocity_type of this OneOfSolidResultControlSolutionFields. # noqa: E501 :type: GlobalVelocityType<|endoftext|>
76f1cc086d2f08dea8416e4b13f034b6cdc5931b7d3748c644ad9343d2bf1b84
@property def acceleration_type(self): 'Gets the acceleration_type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n\n\n :return: The acceleration_type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n :rtype: GlobalAccelerationType\n ' return self._acceleration_type
Gets the acceleration_type of this OneOfSolidResultControlSolutionFields. # noqa: E501 :return: The acceleration_type of this OneOfSolidResultControlSolutionFields. # noqa: E501 :rtype: GlobalAccelerationType
simscale_sdk/models/one_of_solid_result_control_solution_fields.py
acceleration_type
slainesimscale/simscale-python-sdk
8
python
@property def acceleration_type(self): 'Gets the acceleration_type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n\n\n :return: The acceleration_type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n :rtype: GlobalAccelerationType\n ' return self._acceleration_type
@property def acceleration_type(self): 'Gets the acceleration_type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n\n\n :return: The acceleration_type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n :rtype: GlobalAccelerationType\n ' return self._acceleration_type<|docstring|>Gets the acceleration_type of this OneOfSolidResultControlSolutionFields. # noqa: E501 :return: The acceleration_type of this OneOfSolidResultControlSolutionFields. # noqa: E501 :rtype: GlobalAccelerationType<|endoftext|>
3185fbb9614292c5243c3bff177485a66d687fc0011afb5ffce573fc2e7fb989
@acceleration_type.setter def acceleration_type(self, acceleration_type): 'Sets the acceleration_type of this OneOfSolidResultControlSolutionFields.\n\n\n :param acceleration_type: The acceleration_type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n :type: GlobalAccelerationType\n ' self._acceleration_type = acceleration_type
Sets the acceleration_type of this OneOfSolidResultControlSolutionFields. :param acceleration_type: The acceleration_type of this OneOfSolidResultControlSolutionFields. # noqa: E501 :type: GlobalAccelerationType
simscale_sdk/models/one_of_solid_result_control_solution_fields.py
acceleration_type
slainesimscale/simscale-python-sdk
8
python
@acceleration_type.setter def acceleration_type(self, acceleration_type): 'Sets the acceleration_type of this OneOfSolidResultControlSolutionFields.\n\n\n :param acceleration_type: The acceleration_type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n :type: GlobalAccelerationType\n ' self._acceleration_type = acceleration_type
@acceleration_type.setter def acceleration_type(self, acceleration_type): 'Sets the acceleration_type of this OneOfSolidResultControlSolutionFields.\n\n\n :param acceleration_type: The acceleration_type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n :type: GlobalAccelerationType\n ' self._acceleration_type = acceleration_type<|docstring|>Sets the acceleration_type of this OneOfSolidResultControlSolutionFields. :param acceleration_type: The acceleration_type of this OneOfSolidResultControlSolutionFields. # noqa: E501 :type: GlobalAccelerationType<|endoftext|>
78ee82e497bdc5c1ebb9c8351232acdc01f7b5aec41994f76ce3820dfc15a0a4
@property def temperature_type(self): 'Gets the temperature_type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n\n\n :return: The temperature_type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n :rtype: str\n ' return self._temperature_type
Gets the temperature_type of this OneOfSolidResultControlSolutionFields. # noqa: E501 :return: The temperature_type of this OneOfSolidResultControlSolutionFields. # noqa: E501 :rtype: str
simscale_sdk/models/one_of_solid_result_control_solution_fields.py
temperature_type
slainesimscale/simscale-python-sdk
8
python
@property def temperature_type(self): 'Gets the temperature_type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n\n\n :return: The temperature_type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n :rtype: str\n ' return self._temperature_type
@property def temperature_type(self): 'Gets the temperature_type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n\n\n :return: The temperature_type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n :rtype: str\n ' return self._temperature_type<|docstring|>Gets the temperature_type of this OneOfSolidResultControlSolutionFields. # noqa: E501 :return: The temperature_type of this OneOfSolidResultControlSolutionFields. # noqa: E501 :rtype: str<|endoftext|>
707cce77ea195ad44a044051573eb2fe594310dc6052474ccc9f45d5f4336032
@temperature_type.setter def temperature_type(self, temperature_type): 'Sets the temperature_type of this OneOfSolidResultControlSolutionFields.\n\n\n :param temperature_type: The temperature_type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n :type: str\n ' allowed_values = ['FIELD'] if (self.local_vars_configuration.client_side_validation and (temperature_type not in allowed_values)): raise ValueError('Invalid value for `temperature_type` ({0}), must be one of {1}'.format(temperature_type, allowed_values)) self._temperature_type = temperature_type
Sets the temperature_type of this OneOfSolidResultControlSolutionFields. :param temperature_type: The temperature_type of this OneOfSolidResultControlSolutionFields. # noqa: E501 :type: str
simscale_sdk/models/one_of_solid_result_control_solution_fields.py
temperature_type
slainesimscale/simscale-python-sdk
8
python
@temperature_type.setter def temperature_type(self, temperature_type): 'Sets the temperature_type of this OneOfSolidResultControlSolutionFields.\n\n\n :param temperature_type: The temperature_type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n :type: str\n ' allowed_values = ['FIELD'] if (self.local_vars_configuration.client_side_validation and (temperature_type not in allowed_values)): raise ValueError('Invalid value for `temperature_type` ({0}), must be one of {1}'.format(temperature_type, allowed_values)) self._temperature_type = temperature_type
@temperature_type.setter def temperature_type(self, temperature_type): 'Sets the temperature_type of this OneOfSolidResultControlSolutionFields.\n\n\n :param temperature_type: The temperature_type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n :type: str\n ' allowed_values = ['FIELD'] if (self.local_vars_configuration.client_side_validation and (temperature_type not in allowed_values)): raise ValueError('Invalid value for `temperature_type` ({0}), must be one of {1}'.format(temperature_type, allowed_values)) self._temperature_type = temperature_type<|docstring|>Sets the temperature_type of this OneOfSolidResultControlSolutionFields. :param temperature_type: The temperature_type of this OneOfSolidResultControlSolutionFields. # noqa: E501 :type: str<|endoftext|>
ede0f681d3afacf6f6e04ba941ad6b380cc513436c18714d257f77aa8da025af
@property def heat_flux_type(self): 'Gets the heat_flux_type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n\n\n :return: The heat_flux_type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n :rtype: str\n ' return self._heat_flux_type
Gets the heat_flux_type of this OneOfSolidResultControlSolutionFields. # noqa: E501 :return: The heat_flux_type of this OneOfSolidResultControlSolutionFields. # noqa: E501 :rtype: str
simscale_sdk/models/one_of_solid_result_control_solution_fields.py
heat_flux_type
slainesimscale/simscale-python-sdk
8
python
@property def heat_flux_type(self): 'Gets the heat_flux_type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n\n\n :return: The heat_flux_type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n :rtype: str\n ' return self._heat_flux_type
@property def heat_flux_type(self): 'Gets the heat_flux_type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n\n\n :return: The heat_flux_type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n :rtype: str\n ' return self._heat_flux_type<|docstring|>Gets the heat_flux_type of this OneOfSolidResultControlSolutionFields. # noqa: E501 :return: The heat_flux_type of this OneOfSolidResultControlSolutionFields. # noqa: E501 :rtype: str<|endoftext|>
62d1fbee29eb8bef748e0c25a216559d382c9cba7c84830c00c4ab06d233acdf
@heat_flux_type.setter def heat_flux_type(self, heat_flux_type): 'Sets the heat_flux_type of this OneOfSolidResultControlSolutionFields.\n\n\n :param heat_flux_type: The heat_flux_type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n :type: str\n ' allowed_values = ['FIELD'] if (self.local_vars_configuration.client_side_validation and (heat_flux_type not in allowed_values)): raise ValueError('Invalid value for `heat_flux_type` ({0}), must be one of {1}'.format(heat_flux_type, allowed_values)) self._heat_flux_type = heat_flux_type
Sets the heat_flux_type of this OneOfSolidResultControlSolutionFields. :param heat_flux_type: The heat_flux_type of this OneOfSolidResultControlSolutionFields. # noqa: E501 :type: str
simscale_sdk/models/one_of_solid_result_control_solution_fields.py
heat_flux_type
slainesimscale/simscale-python-sdk
8
python
@heat_flux_type.setter def heat_flux_type(self, heat_flux_type): 'Sets the heat_flux_type of this OneOfSolidResultControlSolutionFields.\n\n\n :param heat_flux_type: The heat_flux_type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n :type: str\n ' allowed_values = ['FIELD'] if (self.local_vars_configuration.client_side_validation and (heat_flux_type not in allowed_values)): raise ValueError('Invalid value for `heat_flux_type` ({0}), must be one of {1}'.format(heat_flux_type, allowed_values)) self._heat_flux_type = heat_flux_type
@heat_flux_type.setter def heat_flux_type(self, heat_flux_type): 'Sets the heat_flux_type of this OneOfSolidResultControlSolutionFields.\n\n\n :param heat_flux_type: The heat_flux_type of this OneOfSolidResultControlSolutionFields. # noqa: E501\n :type: str\n ' allowed_values = ['FIELD'] if (self.local_vars_configuration.client_side_validation and (heat_flux_type not in allowed_values)): raise ValueError('Invalid value for `heat_flux_type` ({0}), must be one of {1}'.format(heat_flux_type, allowed_values)) self._heat_flux_type = heat_flux_type<|docstring|>Sets the heat_flux_type of this OneOfSolidResultControlSolutionFields. :param heat_flux_type: The heat_flux_type of this OneOfSolidResultControlSolutionFields. # noqa: E501 :type: str<|endoftext|>
7b48288c005191afa8eb3cc9d403e4a3390878b5ab4f4bb2f8261a725c9b85f2
def get_real_child_model(self, data): 'Returns the real base class specified by the discriminator' discriminator_key = self.attribute_map[self.discriminator] discriminator_value = data[discriminator_key] return self.discriminator_value_class_map.get(discriminator_value)
Returns the real base class specified by the discriminator
simscale_sdk/models/one_of_solid_result_control_solution_fields.py
get_real_child_model
slainesimscale/simscale-python-sdk
8
python
def get_real_child_model(self, data): discriminator_key = self.attribute_map[self.discriminator] discriminator_value = data[discriminator_key] return self.discriminator_value_class_map.get(discriminator_value)
def get_real_child_model(self, data): discriminator_key = self.attribute_map[self.discriminator] discriminator_value = data[discriminator_key] return self.discriminator_value_class_map.get(discriminator_value)<|docstring|>Returns the real base class specified by the discriminator<|endoftext|>
5a4e41bb6a0def746593298cb605df98f1366e957c4ca89b12010ea7db707963
def to_dict(self): 'Returns the model properties as a dict' result = {} for (attr, _) in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): result[attr] = list(map((lambda x: (x.to_dict() if hasattr(x, 'to_dict') else x)), value)) elif hasattr(value, 'to_dict'): result[attr] = value.to_dict() elif isinstance(value, dict): result[attr] = dict(map((lambda item: ((item[0], item[1].to_dict()) if hasattr(item[1], 'to_dict') else item)), value.items())) else: result[attr] = value return result
Returns the model properties as a dict
simscale_sdk/models/one_of_solid_result_control_solution_fields.py
to_dict
slainesimscale/simscale-python-sdk
8
python
def to_dict(self): result = {} for (attr, _) in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): result[attr] = list(map((lambda x: (x.to_dict() if hasattr(x, 'to_dict') else x)), value)) elif hasattr(value, 'to_dict'): result[attr] = value.to_dict() elif isinstance(value, dict): result[attr] = dict(map((lambda item: ((item[0], item[1].to_dict()) if hasattr(item[1], 'to_dict') else item)), value.items())) else: result[attr] = value return result
def to_dict(self): result = {} for (attr, _) in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): result[attr] = list(map((lambda x: (x.to_dict() if hasattr(x, 'to_dict') else x)), value)) elif hasattr(value, 'to_dict'): result[attr] = value.to_dict() elif isinstance(value, dict): result[attr] = dict(map((lambda item: ((item[0], item[1].to_dict()) if hasattr(item[1], 'to_dict') else item)), value.items())) else: result[attr] = value return result<|docstring|>Returns the model properties as a dict<|endoftext|>
cbb19eaa2fc8a113d9e32f924ef280a7e97563f8915f94f65dab438997af2e99
def to_str(self): 'Returns the string representation of the model' return pprint.pformat(self.to_dict())
Returns the string representation of the model
simscale_sdk/models/one_of_solid_result_control_solution_fields.py
to_str
slainesimscale/simscale-python-sdk
8
python
def to_str(self): return pprint.pformat(self.to_dict())
def to_str(self): return pprint.pformat(self.to_dict())<|docstring|>Returns the string representation of the model<|endoftext|>
772243a2c2b3261a9b954d07aaf295e3c1242a579a495e2d6a5679c677861703
def __repr__(self): 'For `print` and `pprint`' return self.to_str()
For `print` and `pprint`
simscale_sdk/models/one_of_solid_result_control_solution_fields.py
__repr__
slainesimscale/simscale-python-sdk
8
python
def __repr__(self): return self.to_str()
def __repr__(self): return self.to_str()<|docstring|>For `print` and `pprint`<|endoftext|>