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 |
|---|---|---|---|---|---|---|---|---|---|
07bd535ffaddd2f29b980448d6aaf7ee0647126d9f1497cad738dc386628b092 | def get_env_config(env_name=None, config_file=None):
"Fetch an environment name and config object from the config.json file.\n If the name is None and there's only one environment, we'll select the\n first, otherwise we'll die to avoid ambiguity.\n\n :param config_file: a `file`-like object that contains t... | Fetch an environment name and config object from the config.json file.
If the name is None and there's only one environment, we'll select the
first, otherwise we'll die to avoid ambiguity.
:param config_file: a `file`-like object that contains the config.json
contents. If `None`, we look for a file... | streamparse/util.py | get_env_config | Parsely/streamparse | 1,050 | python | def get_env_config(env_name=None, config_file=None):
"Fetch an environment name and config object from the config.json file.\n If the name is None and there's only one environment, we'll select the\n first, otherwise we'll die to avoid ambiguity.\n\n :param config_file: a `file`-like object that contains t... | def get_env_config(env_name=None, config_file=None):
"Fetch an environment name and config object from the config.json file.\n If the name is None and there's only one environment, we'll select the\n first, otherwise we'll die to avoid ambiguity.\n\n :param config_file: a `file`-like object that contains t... |
84df8283add546f1b7f3787b5d32f237d74a3ff45d9c283685ba6efc92a18d5b | def get_nimbus_host_port(env_config):
"Get the Nimbus server's hostname and port from environment variables\n or from a streamparse project's config file.\n\n :param env_config: The project's parsed config.\n :type env_config: `dict`\n\n :returns: (host, port)\n "
env_config['nimbus'] = os.enviro... | Get the Nimbus server's hostname and port from environment variables
or from a streamparse project's config file.
:param env_config: The project's parsed config.
:type env_config: `dict`
:returns: (host, port) | streamparse/util.py | get_nimbus_host_port | Parsely/streamparse | 1,050 | python | def get_nimbus_host_port(env_config):
"Get the Nimbus server's hostname and port from environment variables\n or from a streamparse project's config file.\n\n :param env_config: The project's parsed config.\n :type env_config: `dict`\n\n :returns: (host, port)\n "
env_config['nimbus'] = os.enviro... | def get_nimbus_host_port(env_config):
"Get the Nimbus server's hostname and port from environment variables\n or from a streamparse project's config file.\n\n :param env_config: The project's parsed config.\n :type env_config: `dict`\n\n :returns: (host, port)\n "
env_config['nimbus'] = os.enviro... |
2a8d73384366383bbfc209e23f57738172a84a01d949689cb194992c69b313d8 | def get_nimbus_client(env_config=None, host=None, port=None, timeout=7000):
"Get a Thrift RPC client for Nimbus given project's config file.\n\n :param env_config: The project's parsed config.\n :type env_config: `dict`\n :param host: The host to use for Nimbus. If specified, `env_config` will\n ... | Get a Thrift RPC client for Nimbus given project's config file.
:param env_config: The project's parsed config.
:type env_config: `dict`
:param host: The host to use for Nimbus. If specified, `env_config` will
not be consulted.
:type host: `str`
:param port: The port to use for Nimbus. If specified, `en... | streamparse/util.py | get_nimbus_client | Parsely/streamparse | 1,050 | python | def get_nimbus_client(env_config=None, host=None, port=None, timeout=7000):
"Get a Thrift RPC client for Nimbus given project's config file.\n\n :param env_config: The project's parsed config.\n :type env_config: `dict`\n :param host: The host to use for Nimbus. If specified, `env_config` will\n ... | def get_nimbus_client(env_config=None, host=None, port=None, timeout=7000):
"Get a Thrift RPC client for Nimbus given project's config file.\n\n :param env_config: The project's parsed config.\n :type env_config: `dict`\n :param host: The host to use for Nimbus. If specified, `env_config` will\n ... |
679b2ddbae220a6100fb8e0ad924b5164bc72bcc0f5a3d1794eb872c07bd6c9a | def get_storm_workers(env_config):
"Retrieves list of workers, optionally from nimbus.\n\n This function will look up the list of current workers from nimbus if\n workers have not been defined in config.json.\n\n :param env_config: The project's parsed config.\n :type env_config: `dict`\n\n :returns:... | Retrieves list of workers, optionally from nimbus.
This function will look up the list of current workers from nimbus if
workers have not been defined in config.json.
:param env_config: The project's parsed config.
:type env_config: `dict`
:returns: List of workers | streamparse/util.py | get_storm_workers | Parsely/streamparse | 1,050 | python | def get_storm_workers(env_config):
"Retrieves list of workers, optionally from nimbus.\n\n This function will look up the list of current workers from nimbus if\n workers have not been defined in config.json.\n\n :param env_config: The project's parsed config.\n :type env_config: `dict`\n\n :returns:... | def get_storm_workers(env_config):
"Retrieves list of workers, optionally from nimbus.\n\n This function will look up the list of current workers from nimbus if\n workers have not been defined in config.json.\n\n :param env_config: The project's parsed config.\n :type env_config: `dict`\n\n :returns:... |
dcfc92d4c4c32033f96b70c74d6832d49b798a451e65e9ba3081e55e4ea33a35 | def get_nimbus_config(env_config):
"Retrieves a dict with all the config info stored in Nimbus\n\n :param env_config: The project's parsed config.\n :type env_config: `dict`\n\n :returns: dict of Nimbus settings\n "
nimbus_info = get_nimbus_host_port(env_config)
if (nimbus_info not in _nimbus_co... | Retrieves a dict with all the config info stored in Nimbus
:param env_config: The project's parsed config.
:type env_config: `dict`
:returns: dict of Nimbus settings | streamparse/util.py | get_nimbus_config | Parsely/streamparse | 1,050 | python | def get_nimbus_config(env_config):
"Retrieves a dict with all the config info stored in Nimbus\n\n :param env_config: The project's parsed config.\n :type env_config: `dict`\n\n :returns: dict of Nimbus settings\n "
nimbus_info = get_nimbus_host_port(env_config)
if (nimbus_info not in _nimbus_co... | def get_nimbus_config(env_config):
"Retrieves a dict with all the config info stored in Nimbus\n\n :param env_config: The project's parsed config.\n :type env_config: `dict`\n\n :returns: dict of Nimbus settings\n "
nimbus_info = get_nimbus_host_port(env_config)
if (nimbus_info not in _nimbus_co... |
e48e416217f4090077c7e23876969162b4b94b248209ed05df9531cddca640d2 | def is_ssh_for_nimbus(env_config):
'Check if we need to use SSH access to Nimbus or not.'
return env_config.get('use_ssh_for_nimbus', True) | Check if we need to use SSH access to Nimbus or not. | streamparse/util.py | is_ssh_for_nimbus | Parsely/streamparse | 1,050 | python | def is_ssh_for_nimbus(env_config):
return env_config.get('use_ssh_for_nimbus', True) | def is_ssh_for_nimbus(env_config):
return env_config.get('use_ssh_for_nimbus', True)<|docstring|>Check if we need to use SSH access to Nimbus or not.<|endoftext|> |
c136b8d16cc7fbad413bcabe2ed85fdf9e36af9aa491eb8db881006588997eb0 | def local_storm_version():
'Get the Storm version available on the users PATH.\n\n :returns: The Storm library available on the users PATH\n :rtype: pkg_resources.Version\n '
with hide('running'), settings(warn_only=True):
cmd = 'storm version'
res = local(cmd, capture=True)
if ... | Get the Storm version available on the users PATH.
:returns: The Storm library available on the users PATH
:rtype: pkg_resources.Version | streamparse/util.py | local_storm_version | Parsely/streamparse | 1,050 | python | def local_storm_version():
'Get the Storm version available on the users PATH.\n\n :returns: The Storm library available on the users PATH\n :rtype: pkg_resources.Version\n '
with hide('running'), settings(warn_only=True):
cmd = 'storm version'
res = local(cmd, capture=True)
if ... | def local_storm_version():
'Get the Storm version available on the users PATH.\n\n :returns: The Storm library available on the users PATH\n :rtype: pkg_resources.Version\n '
with hide('running'), settings(warn_only=True):
cmd = 'storm version'
res = local(cmd, capture=True)
if ... |
b7a342ed4538451e0f7223436dc4a4f66cb2161932eb3c94a573dce23dc17596 | def nimbus_storm_version(nimbus_client):
"Get the Storm version that Nimbus is reporting, if it's reporting it.\n\n :returns: Storm version that Nimbus is reporting, if it's reporting it.\n Will return `LegacyVersion('')` if it's not reporting anything.\n :rtype: pkg_resources.Version\n "
... | Get the Storm version that Nimbus is reporting, if it's reporting it.
:returns: Storm version that Nimbus is reporting, if it's reporting it.
Will return `LegacyVersion('')` if it's not reporting anything.
:rtype: pkg_resources.Version | streamparse/util.py | nimbus_storm_version | Parsely/streamparse | 1,050 | python | def nimbus_storm_version(nimbus_client):
"Get the Storm version that Nimbus is reporting, if it's reporting it.\n\n :returns: Storm version that Nimbus is reporting, if it's reporting it.\n Will return `LegacyVersion()` if it's not reporting anything.\n :rtype: pkg_resources.Version\n "
ve... | def nimbus_storm_version(nimbus_client):
"Get the Storm version that Nimbus is reporting, if it's reporting it.\n\n :returns: Storm version that Nimbus is reporting, if it's reporting it.\n Will return `LegacyVersion()` if it's not reporting anything.\n :rtype: pkg_resources.Version\n "
ve... |
d9f1883e2b8fb40bbea5887440bcc5ccaeec3a87cb8a1137b544256c9a4320cb | def storm_lib_version():
'Get the Storm library version being used by Leiningen.\n\n :returns: The Storm library version specified in project.clj\n :rtype: pkg_resources.Version\n '
with hide('running'), settings(warn_only=True):
cmd = 'lein deps :tree'
res = local(cmd, capture=True)
... | Get the Storm library version being used by Leiningen.
:returns: The Storm library version specified in project.clj
:rtype: pkg_resources.Version | streamparse/util.py | storm_lib_version | Parsely/streamparse | 1,050 | python | def storm_lib_version():
'Get the Storm library version being used by Leiningen.\n\n :returns: The Storm library version specified in project.clj\n :rtype: pkg_resources.Version\n '
with hide('running'), settings(warn_only=True):
cmd = 'lein deps :tree'
res = local(cmd, capture=True)
... | def storm_lib_version():
'Get the Storm library version being used by Leiningen.\n\n :returns: The Storm library version specified in project.clj\n :rtype: pkg_resources.Version\n '
with hide('running'), settings(warn_only=True):
cmd = 'lein deps :tree'
res = local(cmd, capture=True)
... |
1065b3c67e67e67fbdeb226b37947706c6c5543f77c7a78c981cd4b84ea68506 | def get_ui_jsons(env_name, api_paths, config_file=None):
"Take env_name as a string and api_paths that should\n be a list of strings like '/api/v1/topology/summary'\n "
(_, env_config) = get_env_config(env_name, config_file=config_file)
(host, _) = get_nimbus_host_port(env_config)
remote_ui_port =... | Take env_name as a string and api_paths that should
be a list of strings like '/api/v1/topology/summary' | streamparse/util.py | get_ui_jsons | Parsely/streamparse | 1,050 | python | def get_ui_jsons(env_name, api_paths, config_file=None):
"Take env_name as a string and api_paths that should\n be a list of strings like '/api/v1/topology/summary'\n "
(_, env_config) = get_env_config(env_name, config_file=config_file)
(host, _) = get_nimbus_host_port(env_config)
remote_ui_port =... | def get_ui_jsons(env_name, api_paths, config_file=None):
"Take env_name as a string and api_paths that should\n be a list of strings like '/api/v1/topology/summary'\n "
(_, env_config) = get_env_config(env_name, config_file=config_file)
(host, _) = get_nimbus_host_port(env_config)
remote_ui_port =... |
3fc05a2174cdafa7d157e5729390707928b516346371af1f1baf027e4d5db947 | def get_ui_json(env_name, api_path, config_file=None):
"Take env_name as a string and api_path that should\n be a string like '/api/v1/topology/summary'\n "
return get_ui_jsons(env_name, [api_path], config_file=config_file)[api_path] | Take env_name as a string and api_path that should
be a string like '/api/v1/topology/summary' | streamparse/util.py | get_ui_json | Parsely/streamparse | 1,050 | python | def get_ui_json(env_name, api_path, config_file=None):
"Take env_name as a string and api_path that should\n be a string like '/api/v1/topology/summary'\n "
return get_ui_jsons(env_name, [api_path], config_file=config_file)[api_path] | def get_ui_json(env_name, api_path, config_file=None):
"Take env_name as a string and api_path that should\n be a string like '/api/v1/topology/summary'\n "
return get_ui_jsons(env_name, [api_path], config_file=config_file)[api_path]<|docstring|>Take env_name as a string and api_path that should
be a stri... |
aa04ca3213571236b429913dc907913a2e192f0fcd1ff9c909e2fc914ad76575 | def prepare_topology():
'Prepare a topology for JAR creation'
resources_dir = join('_resources', 'resources')
if os.path.isdir(resources_dir):
shutil.rmtree(resources_dir)
if os.path.exists('src'):
shutil.copytree('src', resources_dir)
else:
raise FileNotFoundError('Your proj... | Prepare a topology for JAR creation | streamparse/util.py | prepare_topology | Parsely/streamparse | 1,050 | python | def prepare_topology():
resources_dir = join('_resources', 'resources')
if os.path.isdir(resources_dir):
shutil.rmtree(resources_dir)
if os.path.exists('src'):
shutil.copytree('src', resources_dir)
else:
raise FileNotFoundError('Your project must have a "src" directory.') | def prepare_topology():
resources_dir = join('_resources', 'resources')
if os.path.isdir(resources_dir):
shutil.rmtree(resources_dir)
if os.path.exists('src'):
shutil.copytree('src', resources_dir)
else:
raise FileNotFoundError('Your project must have a "src" directory.')<|d... |
5439731941e22fe7df5e65d92fd656e9624d5824b41f22fa7afd1608379e3a56 | def _get_file_names_command(path, patterns):
'Given a list of bash `find` patterns, return a string for the\n bash command that will find those pystorm log files\n '
if (path is None):
raise ValueError('path cannot be None')
patterns = "' -o -type f -wholename '".join(patterns)
return "cd ... | Given a list of bash `find` patterns, return a string for the
bash command that will find those pystorm log files | streamparse/util.py | _get_file_names_command | Parsely/streamparse | 1,050 | python | def _get_file_names_command(path, patterns):
'Given a list of bash `find` patterns, return a string for the\n bash command that will find those pystorm log files\n '
if (path is None):
raise ValueError('path cannot be None')
patterns = "' -o -type f -wholename '".join(patterns)
return "cd ... | def _get_file_names_command(path, patterns):
'Given a list of bash `find` patterns, return a string for the\n bash command that will find those pystorm log files\n '
if (path is None):
raise ValueError('path cannot be None')
patterns = "' -o -type f -wholename '".join(patterns)
return "cd ... |
56446b81f20426c25597888a38f6f8facf8bf1aec6dcc704112828f5ac83ca36 | def get_logfiles_cmd(topology_name=None, pattern=None, include_worker_logs=True, is_old_storm=False, include_all_artifacts=False):
'Returns a string representing a command to run on the Storm workers that\n will yield all of the logfiles for the given topology that meet the given\n pattern (if specified).\n ... | Returns a string representing a command to run on the Storm workers that
will yield all of the logfiles for the given topology that meet the given
pattern (if specified). | streamparse/util.py | get_logfiles_cmd | Parsely/streamparse | 1,050 | python | def get_logfiles_cmd(topology_name=None, pattern=None, include_worker_logs=True, is_old_storm=False, include_all_artifacts=False):
'Returns a string representing a command to run on the Storm workers that\n will yield all of the logfiles for the given topology that meet the given\n pattern (if specified).\n ... | def get_logfiles_cmd(topology_name=None, pattern=None, include_worker_logs=True, is_old_storm=False, include_all_artifacts=False):
'Returns a string representing a command to run on the Storm workers that\n will yield all of the logfiles for the given topology that meet the given\n pattern (if specified).\n ... |
9f2fcfc175bdacde4c560654707c3eff2e4eee39dcbf79fd415e515ca5091ab3 | def print_stats_table(header, data, columns, default_alignment='l', custom_alignment=None):
"Print out a list of dictionaries (or objects) as a table.\n\n If given a list of objects, will print out the contents of objects'\n `__dict__` attributes.\n\n :param header: Header that will be printed above table.... | Print out a list of dictionaries (or objects) as a table.
If given a list of objects, will print out the contents of objects'
`__dict__` attributes.
:param header: Header that will be printed above table.
:type header: `str`
:param data: List of dictionaries (or objects ) | streamparse/util.py | print_stats_table | Parsely/streamparse | 1,050 | python | def print_stats_table(header, data, columns, default_alignment='l', custom_alignment=None):
"Print out a list of dictionaries (or objects) as a table.\n\n If given a list of objects, will print out the contents of objects'\n `__dict__` attributes.\n\n :param header: Header that will be printed above table.... | def print_stats_table(header, data, columns, default_alignment='l', custom_alignment=None):
"Print out a list of dictionaries (or objects) as a table.\n\n If given a list of objects, will print out the contents of objects'\n `__dict__` attributes.\n\n :param header: Header that will be printed above table.... |
fc886b9fe77e2e09c5da7a6a77e6ac9ba6e4bfab6e75501d97ac90896f778dbb | def get_topology_from_file(topology_file):
'\n Given a filename for a topology, import the topology and return the class\n '
(topology_dir, mod_name) = os.path.split(topology_file)
mod_name = mod_name[:(- 3)]
sys.path.append(os.path.join(topology_dir, '..', 'src'))
sys.path.append(topology_dir... | Given a filename for a topology, import the topology and return the class | streamparse/util.py | get_topology_from_file | Parsely/streamparse | 1,050 | python | def get_topology_from_file(topology_file):
'\n \n '
(topology_dir, mod_name) = os.path.split(topology_file)
mod_name = mod_name[:(- 3)]
sys.path.append(os.path.join(topology_dir, '..', 'src'))
sys.path.append(topology_dir)
mod = importlib.import_module(mod_name)
for attr in mod.__dict_... | def get_topology_from_file(topology_file):
'\n \n '
(topology_dir, mod_name) = os.path.split(topology_file)
mod_name = mod_name[:(- 3)]
sys.path.append(os.path.join(topology_dir, '..', 'src'))
sys.path.append(topology_dir)
mod = importlib.import_module(mod_name)
for attr in mod.__dict_... |
8650b9861256c6fdfab9a529d43829a89eb2300453b69ce13d01a074c45b5469 | def set_topology_serializer(env_config, config, topology_class):
'Go through the components in a `Topology` and set the serializer.\n\n This is necessary because the `Topology` class has no information about the\n user-specified serializer, but it needs to be passed as an argument to\n ``streamparse_run``.... | Go through the components in a `Topology` and set the serializer.
This is necessary because the `Topology` class has no information about the
user-specified serializer, but it needs to be passed as an argument to
``streamparse_run``. | streamparse/util.py | set_topology_serializer | Parsely/streamparse | 1,050 | python | def set_topology_serializer(env_config, config, topology_class):
'Go through the components in a `Topology` and set the serializer.\n\n This is necessary because the `Topology` class has no information about the\n user-specified serializer, but it needs to be passed as an argument to\n ``streamparse_run``.... | def set_topology_serializer(env_config, config, topology_class):
'Go through the components in a `Topology` and set the serializer.\n\n This is necessary because the `Topology` class has no information about the\n user-specified serializer, but it needs to be passed as an argument to\n ``streamparse_run``.... |
6c0e3e35b83fdab3b093ab239b1c47878e9109b72da7ef08b86f0e3e424067fd | def _delete_chars(from_str, deletechars):
' Delete characters from string allowing for Python 2 / 3 difference\n '
try:
return from_str.translate(None, deletechars)
except TypeError:
return from_str.translate(str.maketrans('', '', deletechars)) | Delete characters from string allowing for Python 2 / 3 difference | heudiconv/heuristics/reproin.py | _delete_chars | tnnlab/heudiconv | 167 | python | def _delete_chars(from_str, deletechars):
' \n '
try:
return from_str.translate(None, deletechars)
except TypeError:
return from_str.translate(str.maketrans(, , deletechars)) | def _delete_chars(from_str, deletechars):
' \n '
try:
return from_str.translate(None, deletechars)
except TypeError:
return from_str.translate(str.maketrans(, , deletechars))<|docstring|>Delete characters from string allowing for Python 2 / 3 difference<|endoftext|> |
8f029f8bdc5dcced5c91b82ea50b215be07302a51f349d8366c2866531dca46a | def filter_dicom(dcmdata):
'Return True if a DICOM dataset should be filtered out, else False'
return (True if (dcmdata.StudyInstanceUID in dicoms2skip) else False) | Return True if a DICOM dataset should be filtered out, else False | heudiconv/heuristics/reproin.py | filter_dicom | tnnlab/heudiconv | 167 | python | def filter_dicom(dcmdata):
return (True if (dcmdata.StudyInstanceUID in dicoms2skip) else False) | def filter_dicom(dcmdata):
return (True if (dcmdata.StudyInstanceUID in dicoms2skip) else False)<|docstring|>Return True if a DICOM dataset should be filtered out, else False<|endoftext|> |
43fb73b01bcd4ff0f052166597df5164c5654c8734194f81c06e2b29bd46997f | def filter_files(fn):
'Return True if a file should be kept, else False.\n\n ATM reproin does not do any filtering. Override if you need to add some\n '
return True | Return True if a file should be kept, else False.
ATM reproin does not do any filtering. Override if you need to add some | heudiconv/heuristics/reproin.py | filter_files | tnnlab/heudiconv | 167 | python | def filter_files(fn):
'Return True if a file should be kept, else False.\n\n ATM reproin does not do any filtering. Override if you need to add some\n '
return True | def filter_files(fn):
'Return True if a file should be kept, else False.\n\n ATM reproin does not do any filtering. Override if you need to add some\n '
return True<|docstring|>Return True if a file should be kept, else False.
ATM reproin does not do any filtering. Override if you need to add some<|endof... |
97dd90c91c3449ccf9c15b1f2c9d0beabf3b314a49848df1bc283ac36c8b0c42 | def md5sum(string):
'Computes md5sum of as string'
if (not string):
return ''
m = hashlib.md5(string.encode())
return m.hexdigest() | Computes md5sum of as string | heudiconv/heuristics/reproin.py | md5sum | tnnlab/heudiconv | 167 | python | def md5sum(string):
if (not string):
return
m = hashlib.md5(string.encode())
return m.hexdigest() | def md5sum(string):
if (not string):
return
m = hashlib.md5(string.encode())
return m.hexdigest()<|docstring|>Computes md5sum of as string<|endoftext|> |
7f7b365cac8a335cacf1a1c39cc7c0c4b113ee8e3af486fa55c128be63babcc3 | def fix_canceled_runs(seqinfo):
'Function that adds cancelme_ to known bad runs which were forgotten\n '
if (not fix_accession2run):
return seqinfo
for (i, s) in enumerate(seqinfo):
accession_number = getattr(s, 'accession_number')
if (accession_number and (accession_number in fix... | Function that adds cancelme_ to known bad runs which were forgotten | heudiconv/heuristics/reproin.py | fix_canceled_runs | tnnlab/heudiconv | 167 | python | def fix_canceled_runs(seqinfo):
'\n '
if (not fix_accession2run):
return seqinfo
for (i, s) in enumerate(seqinfo):
accession_number = getattr(s, 'accession_number')
if (accession_number and (accession_number in fix_accession2run)):
lgr.info('Considering some runs possi... | def fix_canceled_runs(seqinfo):
'\n '
if (not fix_accession2run):
return seqinfo
for (i, s) in enumerate(seqinfo):
accession_number = getattr(s, 'accession_number')
if (accession_number and (accession_number in fix_accession2run)):
lgr.info('Considering some runs possi... |
47d33a60d9b927b46efcea58b99a060ba24a28a090e6a7ae3178cdf17f55a400 | def fix_dbic_protocol(seqinfo):
'Ad-hoc fixup for existing protocols.\n\n It will operate in 3 stages on `protocols2fix` records.\n 1. consider a record which has md5sum of study_description\n 2. apply all substitutions, where key is a regular expression which\n successfully searches (not necessarily... | Ad-hoc fixup for existing protocols.
It will operate in 3 stages on `protocols2fix` records.
1. consider a record which has md5sum of study_description
2. apply all substitutions, where key is a regular expression which
successfully searches (not necessarily matches, so anchor appropriately)
study_description
3.... | heudiconv/heuristics/reproin.py | fix_dbic_protocol | tnnlab/heudiconv | 167 | python | def fix_dbic_protocol(seqinfo):
'Ad-hoc fixup for existing protocols.\n\n It will operate in 3 stages on `protocols2fix` records.\n 1. consider a record which has md5sum of study_description\n 2. apply all substitutions, where key is a regular expression which\n successfully searches (not necessarily... | def fix_dbic_protocol(seqinfo):
'Ad-hoc fixup for existing protocols.\n\n It will operate in 3 stages on `protocols2fix` records.\n 1. consider a record which has md5sum of study_description\n 2. apply all substitutions, where key is a regular expression which\n successfully searches (not necessarily... |
26ae3ab8f828b8aa8c09ebdd9fddda99e467db775b66168e02fc001b2e192442 | def fix_seqinfo(seqinfo):
'Just a helper on top of both fixers\n '
seqinfo = fix_canceled_runs(seqinfo)
seqinfo = fix_dbic_protocol(seqinfo)
return seqinfo | Just a helper on top of both fixers | heudiconv/heuristics/reproin.py | fix_seqinfo | tnnlab/heudiconv | 167 | python | def fix_seqinfo(seqinfo):
'\n '
seqinfo = fix_canceled_runs(seqinfo)
seqinfo = fix_dbic_protocol(seqinfo)
return seqinfo | def fix_seqinfo(seqinfo):
'\n '
seqinfo = fix_canceled_runs(seqinfo)
seqinfo = fix_dbic_protocol(seqinfo)
return seqinfo<|docstring|>Just a helper on top of both fixers<|endoftext|> |
10eedc6f8cad597dedb1dcb5e2d644783ccc4b752f8dfc4b0271dce2c3c8ac61 | def ls(study_session, seqinfo):
'Additional ls output for a seqinfo'
return (' study hash: %s' % get_study_hash(seqinfo)) | Additional ls output for a seqinfo | heudiconv/heuristics/reproin.py | ls | tnnlab/heudiconv | 167 | python | def ls(study_session, seqinfo):
return (' study hash: %s' % get_study_hash(seqinfo)) | def ls(study_session, seqinfo):
return (' study hash: %s' % get_study_hash(seqinfo))<|docstring|>Additional ls output for a seqinfo<|endoftext|> |
01be1c10dc424f2f0e4420bbd3a9d5074b0633163b795a0f4fff6dc2fbce88e5 | @due.dcite(Doi('10.5281/zenodo.1207117'), path='heudiconv.heuristics.reproin', description='ReproIn heudiconv heuristic for turnkey conversion into BIDS')
def infotodict(seqinfo):
'Heuristic evaluator for determining which runs belong where\n\n allowed template fields - follow python string module:\n\n item: ... | Heuristic evaluator for determining which runs belong where
allowed template fields - follow python string module:
item: index within category
subject: participant id
seqitem: run number during scanning
subindex: sub index within group
session: scan index for longitudinal acq | heudiconv/heuristics/reproin.py | infotodict | tnnlab/heudiconv | 167 | python | @due.dcite(Doi('10.5281/zenodo.1207117'), path='heudiconv.heuristics.reproin', description='ReproIn heudiconv heuristic for turnkey conversion into BIDS')
def infotodict(seqinfo):
'Heuristic evaluator for determining which runs belong where\n\n allowed template fields - follow python string module:\n\n item: ... | @due.dcite(Doi('10.5281/zenodo.1207117'), path='heudiconv.heuristics.reproin', description='ReproIn heudiconv heuristic for turnkey conversion into BIDS')
def infotodict(seqinfo):
'Heuristic evaluator for determining which runs belong where\n\n allowed template fields - follow python string module:\n\n item: ... |
27de7e6ebc14157e39ebef63fffd72dd8e62438ab776beb5e18e8373667ebf20 | def get_dups_marked(info, per_series=True):
'\n\n Parameters\n ----------\n info\n per_series: bool\n If set to False, it would create growing index through all series. That\n could lead to non-desired effects if some "multi file" scans (such as\n fmap with magnitude{1,2} and phasediff) w... | Parameters
----------
info
per_series: bool
If set to False, it would create growing index through all series. That
could lead to non-desired effects if some "multi file" scans (such as
fmap with magnitude{1,2} and phasediff) would not be able to associate
multiple files for the same acquisition. By default (... | heudiconv/heuristics/reproin.py | get_dups_marked | tnnlab/heudiconv | 167 | python | def get_dups_marked(info, per_series=True):
'\n\n Parameters\n ----------\n info\n per_series: bool\n If set to False, it would create growing index through all series. That\n could lead to non-desired effects if some "multi file" scans (such as\n fmap with magnitude{1,2} and phasediff) w... | def get_dups_marked(info, per_series=True):
'\n\n Parameters\n ----------\n info\n per_series: bool\n If set to False, it would create growing index through all series. That\n could lead to non-desired effects if some "multi file" scans (such as\n fmap with magnitude{1,2} and phasediff) w... |
a266326b1ee43c07db969389ca04c753ef2c19b411aab64113b6a7d60f430dd7 | def get_unique(seqinfos, attr):
'Given a list of seqinfos, which must have come from a single study\n get specific attr, which must be unique across all of the entries\n\n If not -- fail!\n\n '
values = set((getattr(si, attr) for si in seqinfos))
assert (len(values) == 1)
return values.pop() | Given a list of seqinfos, which must have come from a single study
get specific attr, which must be unique across all of the entries
If not -- fail! | heudiconv/heuristics/reproin.py | get_unique | tnnlab/heudiconv | 167 | python | def get_unique(seqinfos, attr):
'Given a list of seqinfos, which must have come from a single study\n get specific attr, which must be unique across all of the entries\n\n If not -- fail!\n\n '
values = set((getattr(si, attr) for si in seqinfos))
assert (len(values) == 1)
return values.pop() | def get_unique(seqinfos, attr):
'Given a list of seqinfos, which must have come from a single study\n get specific attr, which must be unique across all of the entries\n\n If not -- fail!\n\n '
values = set((getattr(si, attr) for si in seqinfos))
assert (len(values) == 1)
return values.pop()<|d... |
cd83d90386b1603eb8e139a024747036964f0144a9d1950553734d503feecc65 | def sanitize_str(value):
'Remove illegal characters for BIDS from task/acq/etc..'
return _delete_chars(value, '#!@$%^&.,:;_-') | Remove illegal characters for BIDS from task/acq/etc.. | heudiconv/heuristics/reproin.py | sanitize_str | tnnlab/heudiconv | 167 | python | def sanitize_str(value):
return _delete_chars(value, '#!@$%^&.,:;_-') | def sanitize_str(value):
return _delete_chars(value, '#!@$%^&.,:;_-')<|docstring|>Remove illegal characters for BIDS from task/acq/etc..<|endoftext|> |
da23d8a5bb5d68d14902d865cb35fdd904ead9a42972f79e062c50c9d28fb892 | def parse_series_spec(series_spec):
'Parse protocol name according to our convention with minimal set of fixups\n '
series_spec = series_spec.replace('anat_T1w', 'anat-T1w')
series_spec = series_spec.replace('hardi_64', 'dwi_acq-hardi64')
series_spec = series_spec.replace('AAHead_Scout', 'anat-scout'... | Parse protocol name according to our convention with minimal set of fixups | heudiconv/heuristics/reproin.py | parse_series_spec | tnnlab/heudiconv | 167 | python | def parse_series_spec(series_spec):
'\n '
series_spec = series_spec.replace('anat_T1w', 'anat-T1w')
series_spec = series_spec.replace('hardi_64', 'dwi_acq-hardi64')
series_spec = series_spec.replace('AAHead_Scout', 'anat-scout')
series_spec = series_spec.strip(' ')
series_spec = re.sub('^[A-Z... | def parse_series_spec(series_spec):
'\n '
series_spec = series_spec.replace('anat_T1w', 'anat-T1w')
series_spec = series_spec.replace('hardi_64', 'dwi_acq-hardi64')
series_spec = series_spec.replace('AAHead_Scout', 'anat-scout')
series_spec = series_spec.strip(' ')
series_spec = re.sub('^[A-Z... |
55fc290a07e6f8bb89ced8a0522f8ea57cce2d2a5e1d6535029ab95cbc5f1177 | def fixup_subjectid(subjectid):
'Just in case someone managed to miss a zero or added an extra one'
subjectid = subjectid.lower()
reg = re.match('sid0*(\\d+)$', subjectid)
if (not reg):
return re.sub('[-_]', '', subjectid)
return ('sid%06d' % int(reg.groups()[0])) | Just in case someone managed to miss a zero or added an extra one | heudiconv/heuristics/reproin.py | fixup_subjectid | tnnlab/heudiconv | 167 | python | def fixup_subjectid(subjectid):
subjectid = subjectid.lower()
reg = re.match('sid0*(\\d+)$', subjectid)
if (not reg):
return re.sub('[-_]', , subjectid)
return ('sid%06d' % int(reg.groups()[0])) | def fixup_subjectid(subjectid):
subjectid = subjectid.lower()
reg = re.match('sid0*(\\d+)$', subjectid)
if (not reg):
return re.sub('[-_]', , subjectid)
return ('sid%06d' % int(reg.groups()[0]))<|docstring|>Just in case someone managed to miss a zero or added an extra one<|endoftext|> |
d00d9186ac8baa7951cec7b76c93a9e155759ff6580d1d7e62d9d943a01d5416 | def from_series_info(name):
'A little helper to provide _name-value if series_info knows it\n\n Returns None otherwise\n '
if series_info.get(name):
return ('%s-%s' % (name, series_info[name]))
else:
return None | A little helper to provide _name-value if series_info knows it
Returns None otherwise | heudiconv/heuristics/reproin.py | from_series_info | tnnlab/heudiconv | 167 | python | def from_series_info(name):
'A little helper to provide _name-value if series_info knows it\n\n Returns None otherwise\n '
if series_info.get(name):
return ('%s-%s' % (name, series_info[name]))
else:
return None | def from_series_info(name):
'A little helper to provide _name-value if series_info knows it\n\n Returns None otherwise\n '
if series_info.get(name):
return ('%s-%s' % (name, series_info[name]))
else:
return None<|docstring|>A little helper to provide _name-value if seri... |
a65261c987d65d1f39d01b35d5ca9e5a24eb086d0254f240296e007cb1efca90 | def model_wrapper(input_data: Dict[(str, Any)], model: 'BaseModel') -> 'BaseModel':
'\n Wrap input data in the given model, or return a controlled error\n '
if isinstance(input_data, dict):
try:
input_data = model(**input_data)
except ValidationError as exc:
raise I... | Wrap input data in the given model, or return a controlled error | qcengine/util.py | model_wrapper | dotsdl/QCEngine | 1 | python | def model_wrapper(input_data: Dict[(str, Any)], model: 'BaseModel') -> 'BaseModel':
'\n \n '
if isinstance(input_data, dict):
try:
input_data = model(**input_data)
except ValidationError as exc:
raise InputError(f'Error creating '{model.__name__}', data could not be... | def model_wrapper(input_data: Dict[(str, Any)], model: 'BaseModel') -> 'BaseModel':
'\n \n '
if isinstance(input_data, dict):
try:
input_data = model(**input_data)
except ValidationError as exc:
raise InputError(f'Error creating '{model.__name__}', data could not be... |
1ad1ba8cc3715416cd0ffee68c1490b5014d57a703ef431f383716e0d2e71912 | @contextmanager
def compute_wrapper(capture_output: bool=True, raise_error: bool=False) -> Dict[(str, Any)]:
'Wraps compute for timing, output capturing, and raise protection\n '
metadata = {'stdout': None, 'stderr': None, 'success': True, 'retries': 0}
comp_time = time.time()
new_stdout = io.StringI... | Wraps compute for timing, output capturing, and raise protection | qcengine/util.py | compute_wrapper | dotsdl/QCEngine | 1 | python | @contextmanager
def compute_wrapper(capture_output: bool=True, raise_error: bool=False) -> Dict[(str, Any)]:
'\n '
metadata = {'stdout': None, 'stderr': None, 'success': True, 'retries': 0}
comp_time = time.time()
new_stdout = io.StringIO()
new_stderr = io.StringIO()
if capture_output:
... | @contextmanager
def compute_wrapper(capture_output: bool=True, raise_error: bool=False) -> Dict[(str, Any)]:
'\n '
metadata = {'stdout': None, 'stderr': None, 'success': True, 'retries': 0}
comp_time = time.time()
new_stdout = io.StringIO()
new_stderr = io.StringIO()
if capture_output:
... |
5881183ff01f686fed97f15f0b2194b7cbb92957fe73c6cf7327ba6be0e0ef14 | def get_module_function(module: str, func_name: str, subpackage=None) -> Callable[(..., Any)]:
'Obtains a function from a given string\n\n Parameters\n ----------\n module : str\n The module to pull the function from\n func_name : str\n The name of the function to acquire, can be in a subp... | Obtains a function from a given string
Parameters
----------
module : str
The module to pull the function from
func_name : str
The name of the function to acquire, can be in a subpackage
subpackage : None, optional
Explicitly import a subpackage if required
Returns
-------
ret : function
The requested... | qcengine/util.py | get_module_function | dotsdl/QCEngine | 1 | python | def get_module_function(module: str, func_name: str, subpackage=None) -> Callable[(..., Any)]:
'Obtains a function from a given string\n\n Parameters\n ----------\n module : str\n The module to pull the function from\n func_name : str\n The name of the function to acquire, can be in a subp... | def get_module_function(module: str, func_name: str, subpackage=None) -> Callable[(..., Any)]:
'Obtains a function from a given string\n\n Parameters\n ----------\n module : str\n The module to pull the function from\n func_name : str\n The name of the function to acquire, can be in a subp... |
4dfdd141b782b15fcc05ec4c307d6e1fe7d71939931692a64a6f57efc6d02505 | def handle_output_metadata(output_data: Union[(Dict[(str, Any)], 'BaseModel')], metadata: Dict[(str, Any)], raise_error: bool=False, return_dict: bool=True) -> Union[(Dict[(str, Any)], 'BaseModel')]:
'\n Fuses general metadata and output together.\n\n Returns\n -------\n result : dict or pydantic.models... | Fuses general metadata and output together.
Returns
-------
result : dict or pydantic.models.Result
Output type depends on return_dict or a dict if an error was generated in model construction | qcengine/util.py | handle_output_metadata | dotsdl/QCEngine | 1 | python | def handle_output_metadata(output_data: Union[(Dict[(str, Any)], 'BaseModel')], metadata: Dict[(str, Any)], raise_error: bool=False, return_dict: bool=True) -> Union[(Dict[(str, Any)], 'BaseModel')]:
'\n Fuses general metadata and output together.\n\n Returns\n -------\n result : dict or pydantic.models... | def handle_output_metadata(output_data: Union[(Dict[(str, Any)], 'BaseModel')], metadata: Dict[(str, Any)], raise_error: bool=False, return_dict: bool=True) -> Union[(Dict[(str, Any)], 'BaseModel')]:
'\n Fuses general metadata and output together.\n\n Returns\n -------\n result : dict or pydantic.models... |
e471534a784361d51a9ccdc32fa4a064d0d0ffa31e985a6b82a649af8d6cd7bd | @contextmanager
def popen(args: List[str], append_prefix: bool=False, popen_kwargs: Optional[Dict[(str, Any)]]=None) -> Dict[(str, Any)]:
"\n Opens a background task\n\n Code and idea from dask.distributed's testing suite\n https://github.com/dask/distributed\n "
args = list(args)
if (popen_kwar... | Opens a background task
Code and idea from dask.distributed's testing suite
https://github.com/dask/distributed | qcengine/util.py | popen | dotsdl/QCEngine | 1 | python | @contextmanager
def popen(args: List[str], append_prefix: bool=False, popen_kwargs: Optional[Dict[(str, Any)]]=None) -> Dict[(str, Any)]:
"\n Opens a background task\n\n Code and idea from dask.distributed's testing suite\n https://github.com/dask/distributed\n "
args = list(args)
if (popen_kwar... | @contextmanager
def popen(args: List[str], append_prefix: bool=False, popen_kwargs: Optional[Dict[(str, Any)]]=None) -> Dict[(str, Any)]:
"\n Opens a background task\n\n Code and idea from dask.distributed's testing suite\n https://github.com/dask/distributed\n "
args = list(args)
if (popen_kwar... |
e070e9f0769a892f1533c14f426a0257761282cc38d11b6acddf3c459a4129e1 | @contextmanager
def environ_context(config: Optional['JobConfig']=None, env: Optional[Dict[(str, str)]]=None) -> Dict[(str, str)]:
'Temporarily set environment variables inside the context manager and\n fully restore previous environment afterwards.\n\n Parameters\n ----------\n config : Optional[JobCon... | Temporarily set environment variables inside the context manager and
fully restore previous environment afterwards.
Parameters
----------
config : Optional[JobConfig], optional
Automatically sets MKL/OMP num threads based off the input config.
env : Optional[Dict[str, str]], optional
A dictionary of environmen... | qcengine/util.py | environ_context | dotsdl/QCEngine | 1 | python | @contextmanager
def environ_context(config: Optional['JobConfig']=None, env: Optional[Dict[(str, str)]]=None) -> Dict[(str, str)]:
'Temporarily set environment variables inside the context manager and\n fully restore previous environment afterwards.\n\n Parameters\n ----------\n config : Optional[JobCon... | @contextmanager
def environ_context(config: Optional['JobConfig']=None, env: Optional[Dict[(str, str)]]=None) -> Dict[(str, str)]:
'Temporarily set environment variables inside the context manager and\n fully restore previous environment afterwards.\n\n Parameters\n ----------\n config : Optional[JobCon... |
08a3be62e5fca5f6633a114565d91beb6f9a58e8854d4923b09e6894f85c4c38 | def execute(command: List[str], infiles: Optional[Dict[(str, str)]]=None, outfiles: Optional[List[str]]=None, *, as_binary: Optional[List[str]]=None, scratch_name: Optional[str]=None, scratch_directory: Optional[str]=None, scratch_suffix: Optional[str]=None, scratch_messy: bool=False, scratch_exist_ok: bool=False, bloc... | Runs a process in the background until complete.
Returns True if exit code zero
Parameters
----------
command : list of str
infiles : Dict[str] = str
Input file names (names, not full paths) and contents.
to be written in scratch dir. May be {}.
outfiles : List[str] = None
Output file names to be collecte... | qcengine/util.py | execute | dotsdl/QCEngine | 1 | python | def execute(command: List[str], infiles: Optional[Dict[(str, str)]]=None, outfiles: Optional[List[str]]=None, *, as_binary: Optional[List[str]]=None, scratch_name: Optional[str]=None, scratch_directory: Optional[str]=None, scratch_suffix: Optional[str]=None, scratch_messy: bool=False, scratch_exist_ok: bool=False, bloc... | def execute(command: List[str], infiles: Optional[Dict[(str, str)]]=None, outfiles: Optional[List[str]]=None, *, as_binary: Optional[List[str]]=None, scratch_name: Optional[str]=None, scratch_directory: Optional[str]=None, scratch_suffix: Optional[str]=None, scratch_messy: bool=False, scratch_exist_ok: bool=False, bloc... |
cb8f5ef4b489ea2ab5c11bb3149fa6c6612c44bf072faa01507f8d0d6672b9d4 | @contextmanager
def temporary_directory(child: str=None, *, parent: str=None, suffix: str=None, messy: bool=False, exist_ok: bool=False) -> str:
'Create and cleanup a quarantined working directory with a parent scratch directory.\n\n Parameters\n ----------\n child : str, optional\n By default, `Non... | Create and cleanup a quarantined working directory with a parent scratch directory.
Parameters
----------
child : str, optional
By default, `None`, quarantine directory generated through
`tempfile.mdktemp` so guaranteed unique and safe. When specified,
quarantine directory has exactly `name`.
parent : str,... | qcengine/util.py | temporary_directory | dotsdl/QCEngine | 1 | python | @contextmanager
def temporary_directory(child: str=None, *, parent: str=None, suffix: str=None, messy: bool=False, exist_ok: bool=False) -> str:
'Create and cleanup a quarantined working directory with a parent scratch directory.\n\n Parameters\n ----------\n child : str, optional\n By default, `Non... | @contextmanager
def temporary_directory(child: str=None, *, parent: str=None, suffix: str=None, messy: bool=False, exist_ok: bool=False) -> str:
'Create and cleanup a quarantined working directory with a parent scratch directory.\n\n Parameters\n ----------\n child : str, optional\n By default, `Non... |
b8ec13e88d7c2d879f022c8f45d03bfefb61c11077d0d52d2d12c51960e30ff3 | @contextmanager
def disk_files(infiles: Dict[(str, Union[(str, bytes)])], outfiles: Dict[(str, None)], *, cwd: Optional[str]=None, as_binary: Optional[List[str]]=None) -> Dict[(str, Union[(str, bytes)])]:
'Write and collect files.\n\n Parameters\n ----------\n infiles : Dict[str] = str\n Input file ... | Write and collect files.
Parameters
----------
infiles : Dict[str] = str
Input file names (names, not full paths) and contents.
to be written in scratch dir. May be {}.
outfiles : Dict[str] = None
Output file names to be collected after execution into
values. May be {}.
cwd : str, optional
Director... | qcengine/util.py | disk_files | dotsdl/QCEngine | 1 | python | @contextmanager
def disk_files(infiles: Dict[(str, Union[(str, bytes)])], outfiles: Dict[(str, None)], *, cwd: Optional[str]=None, as_binary: Optional[List[str]]=None) -> Dict[(str, Union[(str, bytes)])]:
'Write and collect files.\n\n Parameters\n ----------\n infiles : Dict[str] = str\n Input file ... | @contextmanager
def disk_files(infiles: Dict[(str, Union[(str, bytes)])], outfiles: Dict[(str, None)], *, cwd: Optional[str]=None, as_binary: Optional[List[str]]=None) -> Dict[(str, Union[(str, bytes)])]:
'Write and collect files.\n\n Parameters\n ----------\n infiles : Dict[str] = str\n Input file ... |
32c8c02b92765e3b886a78956e262f194504e9f180fc4381ef1ea59a8bdf2fd5 | def test_max_colors(self):
' Tests both lookup and brute force methods with white (maximum) colors in ARGB_0565 and ARGB_4444 formats '
max_color_0565_brute = ColorConversionUtilities.read_bitmask_ARGB_color(65535, 5, 6, 5, 0)
max_color_4444_brute = ColorConversionUtilities.read_bitmask_ARGB_color(65535, 4,... | Tests both lookup and brute force methods with white (maximum) colors in ARGB_0565 and ARGB_4444 formats | tests/test_Utils_ColorConversion.py | test_max_colors | RainbowRedux/RainbowSixFileConverters | 6 | python | def test_max_colors(self):
' '
max_color_0565_brute = ColorConversionUtilities.read_bitmask_ARGB_color(65535, 5, 6, 5, 0)
max_color_4444_brute = ColorConversionUtilities.read_bitmask_ARGB_color(65535, 4, 4, 4, 4)
max_color_0565_lookup = ColorConversionUtilities.COLOR_LOOKUPS[ColorConversionUtilities.Co... | def test_max_colors(self):
' '
max_color_0565_brute = ColorConversionUtilities.read_bitmask_ARGB_color(65535, 5, 6, 5, 0)
max_color_4444_brute = ColorConversionUtilities.read_bitmask_ARGB_color(65535, 4, 4, 4, 4)
max_color_0565_lookup = ColorConversionUtilities.COLOR_LOOKUPS[ColorConversionUtilities.Co... |
015c3532aaec0baeef20417421db2623c9d8b076c93cfb676fe6a3891e325eff | def test_min_colors(self):
' Tests both lookup and brute force methods with black (minimum) colors in ARGB_0565 and ARGB_4444 formats '
min_color_0565_brute = ColorConversionUtilities.read_bitmask_ARGB_color(0, 5, 6, 5, 0)
min_color_4444_brute = ColorConversionUtilities.read_bitmask_ARGB_color(0, 4, 4, 4, 4... | Tests both lookup and brute force methods with black (minimum) colors in ARGB_0565 and ARGB_4444 formats | tests/test_Utils_ColorConversion.py | test_min_colors | RainbowRedux/RainbowSixFileConverters | 6 | python | def test_min_colors(self):
' '
min_color_0565_brute = ColorConversionUtilities.read_bitmask_ARGB_color(0, 5, 6, 5, 0)
min_color_4444_brute = ColorConversionUtilities.read_bitmask_ARGB_color(0, 4, 4, 4, 4)
min_color_0565_lookup = ColorConversionUtilities.COLOR_LOOKUPS[ColorConversionUtilities.ColorForma... | def test_min_colors(self):
' '
min_color_0565_brute = ColorConversionUtilities.read_bitmask_ARGB_color(0, 5, 6, 5, 0)
min_color_4444_brute = ColorConversionUtilities.read_bitmask_ARGB_color(0, 4, 4, 4, 4)
min_color_0565_lookup = ColorConversionUtilities.COLOR_LOOKUPS[ColorConversionUtilities.ColorForma... |
3d184577d6c47637e2096a5f5ceecf7e32e1d291faa39740ffc4157658ef1cec | def test_random_colors_ARGB_0565(self):
' Tests both lookup and brute force methods with random colors in ARGB_0565 format '
settings = load_settings(TEST_SETTINGS_FILE)
for _ in range(settings['random_color_test_count']):
random_color = random.randint(0, 65535)
random_color_0565_brute = Col... | Tests both lookup and brute force methods with random colors in ARGB_0565 format | tests/test_Utils_ColorConversion.py | test_random_colors_ARGB_0565 | RainbowRedux/RainbowSixFileConverters | 6 | python | def test_random_colors_ARGB_0565(self):
' '
settings = load_settings(TEST_SETTINGS_FILE)
for _ in range(settings['random_color_test_count']):
random_color = random.randint(0, 65535)
random_color_0565_brute = ColorConversionUtilities.read_bitmask_ARGB_color(random_color, 5, 6, 5, 0)
... | def test_random_colors_ARGB_0565(self):
' '
settings = load_settings(TEST_SETTINGS_FILE)
for _ in range(settings['random_color_test_count']):
random_color = random.randint(0, 65535)
random_color_0565_brute = ColorConversionUtilities.read_bitmask_ARGB_color(random_color, 5, 6, 5, 0)
... |
5c03bff23e31923452b840439037feab7204836ea68cd15f263d17939191c433 | def test_random_colors_ARGB_4444(self):
' Tests both lookup and brute force methods with random colors in ARGB_4444 format '
settings = load_settings(TEST_SETTINGS_FILE)
for _ in range(settings['random_color_test_count']):
random_color = random.randint(0, 65535)
random_color_4444_brute = Col... | Tests both lookup and brute force methods with random colors in ARGB_4444 format | tests/test_Utils_ColorConversion.py | test_random_colors_ARGB_4444 | RainbowRedux/RainbowSixFileConverters | 6 | python | def test_random_colors_ARGB_4444(self):
' '
settings = load_settings(TEST_SETTINGS_FILE)
for _ in range(settings['random_color_test_count']):
random_color = random.randint(0, 65535)
random_color_4444_brute = ColorConversionUtilities.read_bitmask_ARGB_color(random_color, 4, 4, 4, 4)
... | def test_random_colors_ARGB_4444(self):
' '
settings = load_settings(TEST_SETTINGS_FILE)
for _ in range(settings['random_color_test_count']):
random_color = random.randint(0, 65535)
random_color_4444_brute = ColorConversionUtilities.read_bitmask_ARGB_color(random_color, 4, 4, 4, 4)
... |
8798eb7385ff330c0110280a6bc6c6bf965ff3a470150350145b477d8f842a38 | @pytest.fixture
def app(request, mock_scheduler, mock_data_interface):
'Return an app\n '
test_app = create_app(static_folder=os.path.join(os.path.dirname(__file__), '..', 'fixtures', 'http'), template_folder=os.path.join(os.path.dirname(__file__), '..', 'fixtures', 'http'), data_interface=mock_data_interfac... | Return an app | tests/http_api/test_crud.py | app | nismod/smif | 28 | python | @pytest.fixture
def app(request, mock_scheduler, mock_data_interface):
'\n '
test_app = create_app(static_folder=os.path.join(os.path.dirname(__file__), '..', 'fixtures', 'http'), template_folder=os.path.join(os.path.dirname(__file__), '..', 'fixtures', 'http'), data_interface=mock_data_interface, scheduler=... | @pytest.fixture
def app(request, mock_scheduler, mock_data_interface):
'\n '
test_app = create_app(static_folder=os.path.join(os.path.dirname(__file__), '..', 'fixtures', 'http'), template_folder=os.path.join(os.path.dirname(__file__), '..', 'fixtures', 'http'), data_interface=mock_data_interface, scheduler=... |
4553a8251a3b605997016744968188d0dea0525ca961432df571e0c8cb7d1ba0 | @pytest.fixture
def app_fail(request, mock_scheduler, mock_data_interface):
'Return an app which will fail to find templates\n '
test_app = create_app(static_folder=os.path.join(os.path.dirname(__file__), '..', 'fixtures', '404'), template_folder=os.path.join(os.path.dirname(__file__), '..', 'fixtures', '404... | Return an app which will fail to find templates | tests/http_api/test_crud.py | app_fail | nismod/smif | 28 | python | @pytest.fixture
def app_fail(request, mock_scheduler, mock_data_interface):
'\n '
test_app = create_app(static_folder=os.path.join(os.path.dirname(__file__), '..', 'fixtures', '404'), template_folder=os.path.join(os.path.dirname(__file__), '..', 'fixtures', '404'), data_interface=mock_data_interface, schedul... | @pytest.fixture
def app_fail(request, mock_scheduler, mock_data_interface):
'\n '
test_app = create_app(static_folder=os.path.join(os.path.dirname(__file__), '..', 'fixtures', '404'), template_folder=os.path.join(os.path.dirname(__file__), '..', 'fixtures', '404'), data_interface=mock_data_interface, schedul... |
8b6542ae2b6d52df653944fcaada98a15737dce6ea8dbb70e21d6ba1a5ca8a73 | @pytest.fixture
def client(request, app):
'Return an API client\n '
test_client = app.test_client()
def teardown():
pass
request.addfinalizer(teardown)
return test_client | Return an API client | tests/http_api/test_crud.py | client | nismod/smif | 28 | python | @pytest.fixture
def client(request, app):
'\n '
test_client = app.test_client()
def teardown():
pass
request.addfinalizer(teardown)
return test_client | @pytest.fixture
def client(request, app):
'\n '
test_client = app.test_client()
def teardown():
pass
request.addfinalizer(teardown)
return test_client<|docstring|>Return an API client<|endoftext|> |
086172b22db18396bf95a4d6f52914f61c9dc0683170654a7808dbb594236500 | @pytest.fixture
def client_fail(request, app_fail):
'Return an API client which will fail on request for home page\n '
test_client = app_fail.test_client()
def teardown():
pass
request.addfinalizer(teardown)
return test_client | Return an API client which will fail on request for home page | tests/http_api/test_crud.py | client_fail | nismod/smif | 28 | python | @pytest.fixture
def client_fail(request, app_fail):
'\n '
test_client = app_fail.test_client()
def teardown():
pass
request.addfinalizer(teardown)
return test_client | @pytest.fixture
def client_fail(request, app_fail):
'\n '
test_client = app_fail.test_client()
def teardown():
pass
request.addfinalizer(teardown)
return test_client<|docstring|>Return an API client which will fail on request for home page<|endoftext|> |
926bfe167ec3f9ce27d99815b13df1f1fa2cc191d2f82debe2903ab39a159847 | def parse_json(response):
'Parse response data\n '
return json.loads(response.data.decode('utf-8')) | Parse response data | tests/http_api/test_crud.py | parse_json | nismod/smif | 28 | python | def parse_json(response):
'\n '
return json.loads(response.data.decode('utf-8')) | def parse_json(response):
'\n '
return json.loads(response.data.decode('utf-8'))<|docstring|>Parse response data<|endoftext|> |
cc18d36fa1f985164ef800db311c3aecf31afaa2bd60bc36d991c5fd8d40883a | def timestamp_serialiser(obj):
'Serialist datetime\n '
if isinstance(obj, datetime.datetime):
return obj.isoformat() | Serialist datetime | tests/http_api/test_crud.py | timestamp_serialiser | nismod/smif | 28 | python | def timestamp_serialiser(obj):
'\n '
if isinstance(obj, datetime.datetime):
return obj.isoformat() | def timestamp_serialiser(obj):
'\n '
if isinstance(obj, datetime.datetime):
return obj.isoformat()<|docstring|>Serialist datetime<|endoftext|> |
fb2d855b0190c9cad16e70cff6903ab0bb0da1136faf56dbb11303681bbe6559 | def test_hello(client):
'Start with a welcome message\n '
response = client.get('/')
assert ('Welcome to smif' in str(response.data)) | Start with a welcome message | tests/http_api/test_crud.py | test_hello | nismod/smif | 28 | python | def test_hello(client):
'\n '
response = client.get('/')
assert ('Welcome to smif' in str(response.data)) | def test_hello(client):
'\n '
response = client.get('/')
assert ('Welcome to smif' in str(response.data))<|docstring|>Start with a welcome message<|endoftext|> |
cf1226c4e26101ae3c0c3a1c13134aa30be0a81c3f6adb5d2c653a7790593b12 | def test_template_not_found(client_fail):
'Clear error if template not found\n '
response = client_fail.get('/')
assert ('Error: smif app template not found' in str(response.data)) | Clear error if template not found | tests/http_api/test_crud.py | test_template_not_found | nismod/smif | 28 | python | def test_template_not_found(client_fail):
'\n '
response = client_fail.get('/')
assert ('Error: smif app template not found' in str(response.data)) | def test_template_not_found(client_fail):
'\n '
response = client_fail.get('/')
assert ('Error: smif app template not found' in str(response.data))<|docstring|>Clear error if template not found<|endoftext|> |
5e90a4fb7bf817eae576aba795306056766127cc055a75a43a05683dd54b1210 | def test_get_smif(client):
'GET smif details\n '
response = client.get('/api/v1/smif/')
data = parse_json(response)
assert (data['data']['version'] == smif.__version__) | GET smif details | tests/http_api/test_crud.py | test_get_smif | nismod/smif | 28 | python | def test_get_smif(client):
'\n '
response = client.get('/api/v1/smif/')
data = parse_json(response)
assert (data['data']['version'] == smif.__version__) | def test_get_smif(client):
'\n '
response = client.get('/api/v1/smif/')
data = parse_json(response)
assert (data['data']['version'] == smif.__version__)<|docstring|>GET smif details<|endoftext|> |
be9de0c97dc2e7178f687e499e701347cfb5688672f483e48d03d53a6dc2bd32 | def test_get_smif_version(client):
'GET smif version\n '
response = client.get('/api/v1/smif/version')
data = parse_json(response)
assert (data['data'] == smif.__version__) | GET smif version | tests/http_api/test_crud.py | test_get_smif_version | nismod/smif | 28 | python | def test_get_smif_version(client):
'\n '
response = client.get('/api/v1/smif/version')
data = parse_json(response)
assert (data['data'] == smif.__version__) | def test_get_smif_version(client):
'\n '
response = client.get('/api/v1/smif/version')
data = parse_json(response)
assert (data['data'] == smif.__version__)<|docstring|>GET smif version<|endoftext|> |
36cdd9b6c9ebdb33988f5732713cfdfdc27252b5cd93c8d385cd33ecbab2328b | def test_model_runs(client, model_run):
'GET all model runs\n '
response = client.get('/api/v1/model_runs/')
assert (current_app.config.data_interface.read_model_runs.call_count == 1)
assert (response.status_code == 200)
data = parse_json(response)
assert (data['data'] == [model_run]) | GET all model runs | tests/http_api/test_crud.py | test_model_runs | nismod/smif | 28 | python | def test_model_runs(client, model_run):
'\n '
response = client.get('/api/v1/model_runs/')
assert (current_app.config.data_interface.read_model_runs.call_count == 1)
assert (response.status_code == 200)
data = parse_json(response)
assert (data['data'] == [model_run]) | def test_model_runs(client, model_run):
'\n '
response = client.get('/api/v1/model_runs/')
assert (current_app.config.data_interface.read_model_runs.call_count == 1)
assert (response.status_code == 200)
data = parse_json(response)
assert (data['data'] == [model_run])<|docstring|>GET all model... |
d9d487fac1406499798d86b83557704bf1ef3ec1218f5665d263f2c20377dbb6 | def test_model_runs_filtered_running(client, model_run):
'GET all model runs\n '
response = client.get('/api/v1/model_runs/?status=running')
assert (response.status_code == 200)
data = parse_json(response)
assert (data['data'] == [model_run]) | GET all model runs | tests/http_api/test_crud.py | test_model_runs_filtered_running | nismod/smif | 28 | python | def test_model_runs_filtered_running(client, model_run):
'\n '
response = client.get('/api/v1/model_runs/?status=running')
assert (response.status_code == 200)
data = parse_json(response)
assert (data['data'] == [model_run]) | def test_model_runs_filtered_running(client, model_run):
'\n '
response = client.get('/api/v1/model_runs/?status=running')
assert (response.status_code == 200)
data = parse_json(response)
assert (data['data'] == [model_run])<|docstring|>GET all model runs<|endoftext|> |
9409ba29687cf060de439e52917918557e0f9c2f1a64890f8b1739b425abad51 | def test_model_run(client, model_run):
'GET single model run\n '
name = model_run['name']
response = client.get('/api/v1/model_runs/{}'.format(name))
current_app.config.data_interface.read_model_run.assert_called_with(name)
assert (response.status_code == 200)
data = parse_json(response)
... | GET single model run | tests/http_api/test_crud.py | test_model_run | nismod/smif | 28 | python | def test_model_run(client, model_run):
'\n '
name = model_run['name']
response = client.get('/api/v1/model_runs/{}'.format(name))
current_app.config.data_interface.read_model_run.assert_called_with(name)
assert (response.status_code == 200)
data = parse_json(response)
assert (data['data']... | def test_model_run(client, model_run):
'\n '
name = model_run['name']
response = client.get('/api/v1/model_runs/{}'.format(name))
current_app.config.data_interface.read_model_run.assert_called_with(name)
assert (response.status_code == 200)
data = parse_json(response)
assert (data['data']... |
521000617a017aca60dcc838295dc1a539fddaebee819c675db53876bdaeb5ce | def test_model_run_missing(client):
'GET missing system-of-systems model run\n '
response = client.get('/api/v1/model_runs/does_not_exist')
data = parse_json(response)
assert (data['error']['SmifDataNotFoundError'] == ["model_run 'does_not_exist' not found"]) | GET missing system-of-systems model run | tests/http_api/test_crud.py | test_model_run_missing | nismod/smif | 28 | python | def test_model_run_missing(client):
'\n '
response = client.get('/api/v1/model_runs/does_not_exist')
data = parse_json(response)
assert (data['error']['SmifDataNotFoundError'] == ["model_run 'does_not_exist' not found"]) | def test_model_run_missing(client):
'\n '
response = client.get('/api/v1/model_runs/does_not_exist')
data = parse_json(response)
assert (data['error']['SmifDataNotFoundError'] == ["model_run 'does_not_exist' not found"])<|docstring|>GET missing system-of-systems model run<|endoftext|> |
72bb4aa9a7899381652f5b34420ed76c30af9547fd666632d377fec47e4b0d10 | def test_post_model_run(client, model_run):
'POST model run\n '
name = 'test_post_model_run'
model_run['name'] = name
send = serialise_json(model_run)
response = client.post('/api/v1/model_runs/', data=send, content_type='application/json')
current_app.config.data_interface.write_model_run.as... | POST model run | tests/http_api/test_crud.py | test_post_model_run | nismod/smif | 28 | python | def test_post_model_run(client, model_run):
'\n '
name = 'test_post_model_run'
model_run['name'] = name
send = serialise_json(model_run)
response = client.post('/api/v1/model_runs/', data=send, content_type='application/json')
current_app.config.data_interface.write_model_run.assert_called_wi... | def test_post_model_run(client, model_run):
'\n '
name = 'test_post_model_run'
model_run['name'] = name
send = serialise_json(model_run)
response = client.post('/api/v1/model_runs/', data=send, content_type='application/json')
current_app.config.data_interface.write_model_run.assert_called_wi... |
ee287d7ce65fc93cf4dc51176918f1739c5bec3c4476e3aac6081dd6465e96dd | def test_put_model_run(client, model_run):
'PUT model run\n '
send = serialise_json(model_run)
response = client.put(('/api/v1/model_runs/' + model_run['name']), data=send, content_type='application/json')
current_app.config.data_interface.update_model_run.assert_called_with(model_run['name'], model_... | PUT model run | tests/http_api/test_crud.py | test_put_model_run | nismod/smif | 28 | python | def test_put_model_run(client, model_run):
'\n '
send = serialise_json(model_run)
response = client.put(('/api/v1/model_runs/' + model_run['name']), data=send, content_type='application/json')
current_app.config.data_interface.update_model_run.assert_called_with(model_run['name'], model_run)
asse... | def test_put_model_run(client, model_run):
'\n '
send = serialise_json(model_run)
response = client.put(('/api/v1/model_runs/' + model_run['name']), data=send, content_type='application/json')
current_app.config.data_interface.update_model_run.assert_called_with(model_run['name'], model_run)
asse... |
3e4c32cf5d00a3033603a5a23716ccb1e4ef4e6cc32186d514485a74d9a14949 | def test_delete_model_run(client, model_run):
'DELETE model_run\n '
send = serialise_json(model_run)
response = client.delete(('/api/v1/model_runs/' + model_run['name']), data=send, content_type='application/json')
current_app.config.data_interface.delete_model_run.assert_called_with(model_run['name'... | DELETE model_run | tests/http_api/test_crud.py | test_delete_model_run | nismod/smif | 28 | python | def test_delete_model_run(client, model_run):
'\n '
send = serialise_json(model_run)
response = client.delete(('/api/v1/model_runs/' + model_run['name']), data=send, content_type='application/json')
current_app.config.data_interface.delete_model_run.assert_called_with(model_run['name'])
assert (r... | def test_delete_model_run(client, model_run):
'\n '
send = serialise_json(model_run)
response = client.delete(('/api/v1/model_runs/' + model_run['name']), data=send, content_type='application/json')
current_app.config.data_interface.delete_model_run.assert_called_with(model_run['name'])
assert (r... |
2ffb5809a1bea2c3caaeb132d4307dac3c775eee1f5e9504726c286bdb1c0cd6 | def test_start_model_run(client):
'POST model run START\n '
send = serialise_json({'args': {'verbosity': 0, 'warm_start': False, 'output_format': 'local_csv'}})
response = client.post('/api/v1/model_runs/20170918_energy_water/start', data=send, content_type='application/json')
call = current_app.conf... | POST model run START | tests/http_api/test_crud.py | test_start_model_run | nismod/smif | 28 | python | def test_start_model_run(client):
'\n '
send = serialise_json({'args': {'verbosity': 0, 'warm_start': False, 'output_format': 'local_csv'}})
response = client.post('/api/v1/model_runs/20170918_energy_water/start', data=send, content_type='application/json')
call = current_app.config.scheduler.add.cal... | def test_start_model_run(client):
'\n '
send = serialise_json({'args': {'verbosity': 0, 'warm_start': False, 'output_format': 'local_csv'}})
response = client.post('/api/v1/model_runs/20170918_energy_water/start', data=send, content_type='application/json')
call = current_app.config.scheduler.add.cal... |
10a0fa573e531e4d7af29258629619613472904ec206dd4107c53a97846051a0 | def test_kill_model_run(client):
'POST model run START\n '
response = client.post('/api/v1/model_runs/20170918_energy_water/kill', data={}, content_type='application/json')
data = parse_json(response)
assert (response.status_code == 201)
assert (data['message'] == 'success')
current_app.confi... | POST model run START | tests/http_api/test_crud.py | test_kill_model_run | nismod/smif | 28 | python | def test_kill_model_run(client):
'\n '
response = client.post('/api/v1/model_runs/20170918_energy_water/kill', data={}, content_type='application/json')
data = parse_json(response)
assert (response.status_code == 201)
assert (data['message'] == 'success')
current_app.config.scheduler.kill.ass... | def test_kill_model_run(client):
'\n '
response = client.post('/api/v1/model_runs/20170918_energy_water/kill', data={}, content_type='application/json')
data = parse_json(response)
assert (response.status_code == 201)
assert (data['message'] == 'success')
current_app.config.scheduler.kill.ass... |
7927074c684035c04762a64fab1c7b52e55d975337216934cacc9dc9da2b45f7 | def test_get_modelrun_status_modelrun_never_started(client):
'GET model run STATUS\n '
response = client.get('/api/v1/model_runs/model_never_started/status')
data = parse_json(response)
assert (response.status_code == 200)
assert (data['data']['status'] == 'unstarted') | GET model run STATUS | tests/http_api/test_crud.py | test_get_modelrun_status_modelrun_never_started | nismod/smif | 28 | python | def test_get_modelrun_status_modelrun_never_started(client):
'\n '
response = client.get('/api/v1/model_runs/model_never_started/status')
data = parse_json(response)
assert (response.status_code == 200)
assert (data['data']['status'] == 'unstarted') | def test_get_modelrun_status_modelrun_never_started(client):
'\n '
response = client.get('/api/v1/model_runs/model_never_started/status')
data = parse_json(response)
assert (response.status_code == 200)
assert (data['data']['status'] == 'unstarted')<|docstring|>GET model run STATUS<|endoftext|> |
ddc2966ce7195287da1952249de46f4540faa10b3140f221a03d4231f4553959 | def test_get_modelrun_status_modelrun_running(client):
'GET model run STATUS\n '
response = client.get('/api/v1/model_runs/model_started_and_running/status')
data = parse_json(response)
assert (response.status_code == 200)
assert (data['data']['status'] == 'running') | GET model run STATUS | tests/http_api/test_crud.py | test_get_modelrun_status_modelrun_running | nismod/smif | 28 | python | def test_get_modelrun_status_modelrun_running(client):
'\n '
response = client.get('/api/v1/model_runs/model_started_and_running/status')
data = parse_json(response)
assert (response.status_code == 200)
assert (data['data']['status'] == 'running') | def test_get_modelrun_status_modelrun_running(client):
'\n '
response = client.get('/api/v1/model_runs/model_started_and_running/status')
data = parse_json(response)
assert (response.status_code == 200)
assert (data['data']['status'] == 'running')<|docstring|>GET model run STATUS<|endoftext|> |
e4f181248b7d35bcc5bbbb36d991c6a71a0978659a8e1de16d0c56bd2b8b18cf | def test_get_modelrun_status_modelrun_done(client):
'GET model run STATUS\n '
response = client.get('/api/v1/model_runs/model_started_and_done/status')
data = parse_json(response)
assert (response.status_code == 200)
assert (data['data']['status'] == 'done') | GET model run STATUS | tests/http_api/test_crud.py | test_get_modelrun_status_modelrun_done | nismod/smif | 28 | python | def test_get_modelrun_status_modelrun_done(client):
'\n '
response = client.get('/api/v1/model_runs/model_started_and_done/status')
data = parse_json(response)
assert (response.status_code == 200)
assert (data['data']['status'] == 'done') | def test_get_modelrun_status_modelrun_done(client):
'\n '
response = client.get('/api/v1/model_runs/model_started_and_done/status')
data = parse_json(response)
assert (response.status_code == 200)
assert (data['data']['status'] == 'done')<|docstring|>GET model run STATUS<|endoftext|> |
085d33fffa4557d8a8fb09bc410447415e0706e49a2e50ea3001a9002502bafb | def test_get_sos_models(client, get_sos_model):
'GET all system-of-systems models\n '
response = client.get('/api/v1/sos_models/')
assert (current_app.config.data_interface.read_sos_models.called == 1)
assert (response.status_code == 200)
data = parse_json(response)
assert (data['data'] == [g... | GET all system-of-systems models | tests/http_api/test_crud.py | test_get_sos_models | nismod/smif | 28 | python | def test_get_sos_models(client, get_sos_model):
'\n '
response = client.get('/api/v1/sos_models/')
assert (current_app.config.data_interface.read_sos_models.called == 1)
assert (response.status_code == 200)
data = parse_json(response)
assert (data['data'] == [get_sos_model]) | def test_get_sos_models(client, get_sos_model):
'\n '
response = client.get('/api/v1/sos_models/')
assert (current_app.config.data_interface.read_sos_models.called == 1)
assert (response.status_code == 200)
data = parse_json(response)
assert (data['data'] == [get_sos_model])<|docstring|>GET a... |
f27f4680f3c93757b5257cd6eaebfc108d66839e667935b9d8b3e00bf7adcf1b | def test_get_sos_model(client, get_sos_model):
'GET single system-of-systems model\n '
name = get_sos_model['name']
response = client.get('/api/v1/sos_models/{}'.format(name))
current_app.config.data_interface.read_sos_model.assert_called_with(name)
assert (response.status_code == 200)
data =... | GET single system-of-systems model | tests/http_api/test_crud.py | test_get_sos_model | nismod/smif | 28 | python | def test_get_sos_model(client, get_sos_model):
'\n '
name = get_sos_model['name']
response = client.get('/api/v1/sos_models/{}'.format(name))
current_app.config.data_interface.read_sos_model.assert_called_with(name)
assert (response.status_code == 200)
data = parse_json(response)
assert (... | def test_get_sos_model(client, get_sos_model):
'\n '
name = get_sos_model['name']
response = client.get('/api/v1/sos_models/{}'.format(name))
current_app.config.data_interface.read_sos_model.assert_called_with(name)
assert (response.status_code == 200)
data = parse_json(response)
assert (... |
5b6c3cb2a7304f6a82d997222982faedce6611dec054f56cf7b1d2ac53eb14ef | def test_get_sos_model_missing(client):
'GET missing system-of-systems model\n '
response = client.get('/api/v1/sos_models/does_not_exist')
data = parse_json(response)
assert (data['error']['SmifDataNotFoundError'] == ["sos_model 'does_not_exist' not found"]) | GET missing system-of-systems model | tests/http_api/test_crud.py | test_get_sos_model_missing | nismod/smif | 28 | python | def test_get_sos_model_missing(client):
'\n '
response = client.get('/api/v1/sos_models/does_not_exist')
data = parse_json(response)
assert (data['error']['SmifDataNotFoundError'] == ["sos_model 'does_not_exist' not found"]) | def test_get_sos_model_missing(client):
'\n '
response = client.get('/api/v1/sos_models/does_not_exist')
data = parse_json(response)
assert (data['error']['SmifDataNotFoundError'] == ["sos_model 'does_not_exist' not found"])<|docstring|>GET missing system-of-systems model<|endoftext|> |
091cdfb844b7d8b741b0d2cfa88753ab33337e53f869bf8a26113698b21a97a3 | def test_post_sos_model(client, get_sos_model):
'POST system-of-systems model\n '
name = 'test_post_sos_model'
get_sos_model['name'] = name
send = serialise_json(get_sos_model)
response = client.post('/api/v1/sos_models/', data=send, content_type='application/json')
assert (current_app.config... | POST system-of-systems model | tests/http_api/test_crud.py | test_post_sos_model | nismod/smif | 28 | python | def test_post_sos_model(client, get_sos_model):
'\n '
name = 'test_post_sos_model'
get_sos_model['name'] = name
send = serialise_json(get_sos_model)
response = client.post('/api/v1/sos_models/', data=send, content_type='application/json')
assert (current_app.config.data_interface.write_sos_mo... | def test_post_sos_model(client, get_sos_model):
'\n '
name = 'test_post_sos_model'
get_sos_model['name'] = name
send = serialise_json(get_sos_model)
response = client.post('/api/v1/sos_models/', data=send, content_type='application/json')
assert (current_app.config.data_interface.write_sos_mo... |
f5de3514eade27d67da4ee62627a02d9166ee7a93b84d607c7447207c3a55403 | def test_put_sos_model(client, get_sos_model):
'PUT sos_model\n '
send = serialise_json(get_sos_model)
response = client.put(('/api/v1/sos_models/' + get_sos_model['name']), data=send, content_type='application/json')
current_app.config.data_interface.update_sos_model.assert_called_with(get_sos_model... | PUT sos_model | tests/http_api/test_crud.py | test_put_sos_model | nismod/smif | 28 | python | def test_put_sos_model(client, get_sos_model):
'\n '
send = serialise_json(get_sos_model)
response = client.put(('/api/v1/sos_models/' + get_sos_model['name']), data=send, content_type='application/json')
current_app.config.data_interface.update_sos_model.assert_called_with(get_sos_model['name'], get... | def test_put_sos_model(client, get_sos_model):
'\n '
send = serialise_json(get_sos_model)
response = client.put(('/api/v1/sos_models/' + get_sos_model['name']), data=send, content_type='application/json')
current_app.config.data_interface.update_sos_model.assert_called_with(get_sos_model['name'], get... |
fc23ff519798cebe15452a0f466a3fd3c3062c586e988a4b7917df400b7dc01b | def test_delete_sos_model(client, get_sos_model):
'DELETE sos_model\n '
send = serialise_json(get_sos_model)
response = client.delete(('/api/v1/sos_models/' + get_sos_model['name']), data=send, content_type='application/json')
current_app.config.data_interface.delete_sos_model.assert_called_with(get_... | DELETE sos_model | tests/http_api/test_crud.py | test_delete_sos_model | nismod/smif | 28 | python | def test_delete_sos_model(client, get_sos_model):
'\n '
send = serialise_json(get_sos_model)
response = client.delete(('/api/v1/sos_models/' + get_sos_model['name']), data=send, content_type='application/json')
current_app.config.data_interface.delete_sos_model.assert_called_with(get_sos_model['name'... | def test_delete_sos_model(client, get_sos_model):
'\n '
send = serialise_json(get_sos_model)
response = client.delete(('/api/v1/sos_models/' + get_sos_model['name']), data=send, content_type='application/json')
current_app.config.data_interface.delete_sos_model.assert_called_with(get_sos_model['name'... |
a31987ceb0e64a1cf0317db35028a6e663b04c94ab898a59abdb5520666d3a53 | def test_get_sector_models(client, get_sector_model):
'GET all model runs\n '
response = client.get('/api/v1/sector_models/')
assert (current_app.config.data_interface.read_models.called == 1)
assert (response.status_code == 200)
data = parse_json(response)
assert (data['data'] == [get_sector... | GET all model runs | tests/http_api/test_crud.py | test_get_sector_models | nismod/smif | 28 | python | def test_get_sector_models(client, get_sector_model):
'\n '
response = client.get('/api/v1/sector_models/')
assert (current_app.config.data_interface.read_models.called == 1)
assert (response.status_code == 200)
data = parse_json(response)
assert (data['data'] == [get_sector_model]) | def test_get_sector_models(client, get_sector_model):
'\n '
response = client.get('/api/v1/sector_models/')
assert (current_app.config.data_interface.read_models.called == 1)
assert (response.status_code == 200)
data = parse_json(response)
assert (data['data'] == [get_sector_model])<|docstrin... |
7e4bb18195e03f5958b6e67cedc56a8312a5d5e763921eaf6476ec03ffa1400f | def test_get_sector_model(client, get_sector_model):
'GET single model run\n '
name = get_sector_model['name']
response = client.get('/api/v1/sector_models/{}'.format(name))
current_app.config.data_interface.read_model.assert_called_with(name, skip_coords=True)
data = parse_json(response)
ass... | GET single model run | tests/http_api/test_crud.py | test_get_sector_model | nismod/smif | 28 | python | def test_get_sector_model(client, get_sector_model):
'\n '
name = get_sector_model['name']
response = client.get('/api/v1/sector_models/{}'.format(name))
current_app.config.data_interface.read_model.assert_called_with(name, skip_coords=True)
data = parse_json(response)
assert (data['data'] ==... | def test_get_sector_model(client, get_sector_model):
'\n '
name = get_sector_model['name']
response = client.get('/api/v1/sector_models/{}'.format(name))
current_app.config.data_interface.read_model.assert_called_with(name, skip_coords=True)
data = parse_json(response)
assert (data['data'] ==... |
72358c894db71650e09e00a70b77556fa7ebf057a8f2fcc35c4dc4c21f1bc12b | def test_get_sector_model_missing(client):
'GET missing model run\n '
response = client.get('/api/v1/sector_models/does_not_exist')
data = parse_json(response)
assert (data['error']['SmifDataNotFoundError'] == ["sector_model 'does_not_exist' not found"]) | GET missing model run | tests/http_api/test_crud.py | test_get_sector_model_missing | nismod/smif | 28 | python | def test_get_sector_model_missing(client):
'\n '
response = client.get('/api/v1/sector_models/does_not_exist')
data = parse_json(response)
assert (data['error']['SmifDataNotFoundError'] == ["sector_model 'does_not_exist' not found"]) | def test_get_sector_model_missing(client):
'\n '
response = client.get('/api/v1/sector_models/does_not_exist')
data = parse_json(response)
assert (data['error']['SmifDataNotFoundError'] == ["sector_model 'does_not_exist' not found"])<|docstring|>GET missing model run<|endoftext|> |
86858278b0d60211e9e801d8b932c8976bf30b3915aa998d75ae9836ce8501fe | def test_post_sector_model(client, get_sector_model):
'POST sector model\n '
name = 'test_post_sector_model'
get_sector_model['name'] = name
send = serialise_json(get_sector_model)
response = client.post('/api/v1/sector_models/', data=send, content_type='application/json')
current_app.config.... | POST sector model | tests/http_api/test_crud.py | test_post_sector_model | nismod/smif | 28 | python | def test_post_sector_model(client, get_sector_model):
'\n '
name = 'test_post_sector_model'
get_sector_model['name'] = name
send = serialise_json(get_sector_model)
response = client.post('/api/v1/sector_models/', data=send, content_type='application/json')
current_app.config.data_interface.wr... | def test_post_sector_model(client, get_sector_model):
'\n '
name = 'test_post_sector_model'
get_sector_model['name'] = name
send = serialise_json(get_sector_model)
response = client.post('/api/v1/sector_models/', data=send, content_type='application/json')
current_app.config.data_interface.wr... |
28589768d94fc85e821e56c89e7d7dffbe971f8f4de85f9dc0c9e670d185f662 | def test_put_sector_model(client, get_sector_model):
'PUT sector_model\n '
send = serialise_json(get_sector_model)
response = client.put(('/api/v1/sector_models/' + get_sector_model['name']), data=send, content_type='application/json')
current_app.config.data_interface.update_model.assert_called_with... | PUT sector_model | tests/http_api/test_crud.py | test_put_sector_model | nismod/smif | 28 | python | def test_put_sector_model(client, get_sector_model):
'\n '
send = serialise_json(get_sector_model)
response = client.put(('/api/v1/sector_models/' + get_sector_model['name']), data=send, content_type='application/json')
current_app.config.data_interface.update_model.assert_called_with(get_sector_mode... | def test_put_sector_model(client, get_sector_model):
'\n '
send = serialise_json(get_sector_model)
response = client.put(('/api/v1/sector_models/' + get_sector_model['name']), data=send, content_type='application/json')
current_app.config.data_interface.update_model.assert_called_with(get_sector_mode... |
0d8d0e91b4c6769833143a156950981ef659595a663ba01814bfbf77226b7f70 | def test_delete_sector_model(client, get_sector_model):
'DELETE sector_model\n '
send = serialise_json(get_sector_model)
response = client.delete(('/api/v1/sector_models/' + get_sector_model['name']), data=send, content_type='application/json')
current_app.config.data_interface.delete_model.assert_ca... | DELETE sector_model | tests/http_api/test_crud.py | test_delete_sector_model | nismod/smif | 28 | python | def test_delete_sector_model(client, get_sector_model):
'\n '
send = serialise_json(get_sector_model)
response = client.delete(('/api/v1/sector_models/' + get_sector_model['name']), data=send, content_type='application/json')
current_app.config.data_interface.delete_model.assert_called_with(get_secto... | def test_delete_sector_model(client, get_sector_model):
'\n '
send = serialise_json(get_sector_model)
response = client.delete(('/api/v1/sector_models/' + get_sector_model['name']), data=send, content_type='application/json')
current_app.config.data_interface.delete_model.assert_called_with(get_secto... |
a467f5bdee19029bb03272a966878d71006f4a4110e739f1b8ca7dad17ea5d24 | def test_get_scenarios(client, get_scenario):
'GET all scenarios\n '
response = client.get('/api/v1/scenarios/')
assert (current_app.config.data_interface.read_scenarios.called == 1)
assert (response.status_code == 200)
data = parse_json(response)
assert (data['data'] == [get_scenario]) | GET all scenarios | tests/http_api/test_crud.py | test_get_scenarios | nismod/smif | 28 | python | def test_get_scenarios(client, get_scenario):
'\n '
response = client.get('/api/v1/scenarios/')
assert (current_app.config.data_interface.read_scenarios.called == 1)
assert (response.status_code == 200)
data = parse_json(response)
assert (data['data'] == [get_scenario]) | def test_get_scenarios(client, get_scenario):
'\n '
response = client.get('/api/v1/scenarios/')
assert (current_app.config.data_interface.read_scenarios.called == 1)
assert (response.status_code == 200)
data = parse_json(response)
assert (data['data'] == [get_scenario])<|docstring|>GET all sc... |
858448b465d656c71482eb908002c639f12a7c1d930696c4b39778110d760af5 | def test_get_scenario(client, get_scenario):
'GET single system-of-systems model\n '
name = get_scenario['name']
response = client.get('/api/v1/scenarios/{}'.format(name))
current_app.config.data_interface.read_scenario.assert_called_with(name, skip_coords=True)
assert (response.status_code == 20... | GET single system-of-systems model | tests/http_api/test_crud.py | test_get_scenario | nismod/smif | 28 | python | def test_get_scenario(client, get_scenario):
'\n '
name = get_scenario['name']
response = client.get('/api/v1/scenarios/{}'.format(name))
current_app.config.data_interface.read_scenario.assert_called_with(name, skip_coords=True)
assert (response.status_code == 200)
data = parse_json(response)... | def test_get_scenario(client, get_scenario):
'\n '
name = get_scenario['name']
response = client.get('/api/v1/scenarios/{}'.format(name))
current_app.config.data_interface.read_scenario.assert_called_with(name, skip_coords=True)
assert (response.status_code == 200)
data = parse_json(response)... |
a666e2bb346b2707ae331c1aebb4bf584881f9fd97d640afd5fa90d6d611daf6 | def test_get_scenario_missing(client):
'GET missing system-of-systems model\n '
response = client.get('/api/v1/scenarios/does_not_exist')
data = parse_json(response)
assert (data['error']['SmifDataNotFoundError'] == ["scenario 'does_not_exist' not found"]) | GET missing system-of-systems model | tests/http_api/test_crud.py | test_get_scenario_missing | nismod/smif | 28 | python | def test_get_scenario_missing(client):
'\n '
response = client.get('/api/v1/scenarios/does_not_exist')
data = parse_json(response)
assert (data['error']['SmifDataNotFoundError'] == ["scenario 'does_not_exist' not found"]) | def test_get_scenario_missing(client):
'\n '
response = client.get('/api/v1/scenarios/does_not_exist')
data = parse_json(response)
assert (data['error']['SmifDataNotFoundError'] == ["scenario 'does_not_exist' not found"])<|docstring|>GET missing system-of-systems model<|endoftext|> |
a651542b1a893eba11762ddb006241ce919beaae5c0fa35c495199b61c30d48e | def test_post_scenario(client, get_scenario):
'POST system-of-systems model\n '
name = 'test_post_scenario'
get_scenario['name'] = name
send = serialise_json(get_scenario)
response = client.post('/api/v1/scenarios/', data=send, content_type='application/json')
current_app.config.data_interfac... | POST system-of-systems model | tests/http_api/test_crud.py | test_post_scenario | nismod/smif | 28 | python | def test_post_scenario(client, get_scenario):
'\n '
name = 'test_post_scenario'
get_scenario['name'] = name
send = serialise_json(get_scenario)
response = client.post('/api/v1/scenarios/', data=send, content_type='application/json')
current_app.config.data_interface.write_scenario.assert_call... | def test_post_scenario(client, get_scenario):
'\n '
name = 'test_post_scenario'
get_scenario['name'] = name
send = serialise_json(get_scenario)
response = client.post('/api/v1/scenarios/', data=send, content_type='application/json')
current_app.config.data_interface.write_scenario.assert_call... |
6ec5349828361975c5d9257912ae6f3dbefd91ecf67af9ffe12f401372c117fe | def test_delete_scenario(client, get_scenario):
'DELETE scenario\n '
send = serialise_json(get_scenario)
response = client.delete(('/api/v1/scenarios/' + get_scenario['name']), data=send, content_type='application/json')
current_app.config.data_interface.delete_scenario.assert_called_with(get_scenari... | DELETE scenario | tests/http_api/test_crud.py | test_delete_scenario | nismod/smif | 28 | python | def test_delete_scenario(client, get_scenario):
'\n '
send = serialise_json(get_scenario)
response = client.delete(('/api/v1/scenarios/' + get_scenario['name']), data=send, content_type='application/json')
current_app.config.data_interface.delete_scenario.assert_called_with(get_scenario['name'])
... | def test_delete_scenario(client, get_scenario):
'\n '
send = serialise_json(get_scenario)
response = client.delete(('/api/v1/scenarios/' + get_scenario['name']), data=send, content_type='application/json')
current_app.config.data_interface.delete_scenario.assert_called_with(get_scenario['name'])
... |
49c44d822757439932044ae22a3402de388927f03c474f1f63aac68f44ee3d29 | def test_put_scenario(client, get_scenario):
'PUT scenario\n '
send = serialise_json(get_scenario)
response = client.put(('/api/v1/scenarios/' + get_scenario['name']), data=send, content_type='application/json')
current_app.config.data_interface.update_scenario.assert_called_with(get_scenario['name']... | PUT scenario | tests/http_api/test_crud.py | test_put_scenario | nismod/smif | 28 | python | def test_put_scenario(client, get_scenario):
'\n '
send = serialise_json(get_scenario)
response = client.put(('/api/v1/scenarios/' + get_scenario['name']), data=send, content_type='application/json')
current_app.config.data_interface.update_scenario.assert_called_with(get_scenario['name'], get_scenar... | def test_put_scenario(client, get_scenario):
'\n '
send = serialise_json(get_scenario)
response = client.put(('/api/v1/scenarios/' + get_scenario['name']), data=send, content_type='application/json')
current_app.config.data_interface.update_scenario.assert_called_with(get_scenario['name'], get_scenar... |
019f56e41de22c6c3da268ec9e1080582926e270b692f2864e16ad5ad19175fd | def test_get_dimensions(client, get_dimension):
'GET all dimensions\n '
response = client.get('/api/v1/dimensions/')
assert (current_app.config.data_interface.read_dimensions.called == 1)
assert (response.status_code == 200)
data = parse_json(response)
assert (data['data'] == [get_dimension]) | GET all dimensions | tests/http_api/test_crud.py | test_get_dimensions | nismod/smif | 28 | python | def test_get_dimensions(client, get_dimension):
'\n '
response = client.get('/api/v1/dimensions/')
assert (current_app.config.data_interface.read_dimensions.called == 1)
assert (response.status_code == 200)
data = parse_json(response)
assert (data['data'] == [get_dimension]) | def test_get_dimensions(client, get_dimension):
'\n '
response = client.get('/api/v1/dimensions/')
assert (current_app.config.data_interface.read_dimensions.called == 1)
assert (response.status_code == 200)
data = parse_json(response)
assert (data['data'] == [get_dimension])<|docstring|>GET a... |
f011c0faac80387a5c15dea678eb6ed9ea15445bc963990394cf02d5a5c147cc | def test_get_dimension(client, get_dimension):
'GET single system-of-systems model\n '
name = get_dimension['name']
response = client.get('/api/v1/dimensions/{}'.format(name))
current_app.config.data_interface.read_dimension.assert_called_with(name, skip_coords=True)
assert (response.status_code ... | GET single system-of-systems model | tests/http_api/test_crud.py | test_get_dimension | nismod/smif | 28 | python | def test_get_dimension(client, get_dimension):
'\n '
name = get_dimension['name']
response = client.get('/api/v1/dimensions/{}'.format(name))
current_app.config.data_interface.read_dimension.assert_called_with(name, skip_coords=True)
assert (response.status_code == 200)
data = parse_json(resp... | def test_get_dimension(client, get_dimension):
'\n '
name = get_dimension['name']
response = client.get('/api/v1/dimensions/{}'.format(name))
current_app.config.data_interface.read_dimension.assert_called_with(name, skip_coords=True)
assert (response.status_code == 200)
data = parse_json(resp... |
d3e200c9012bcae249227cc7fffa01062c2bb2a72d0a18d27cc1c5f4f1083d80 | def test_get_dimension_missing(client):
'GET missing system-of-systems model\n '
response = client.get('/api/v1/dimensions/does_not_exist')
data = parse_json(response)
assert (data['error']['SmifDataNotFoundError'] == ["dimension 'does_not_exist' not found"]) | GET missing system-of-systems model | tests/http_api/test_crud.py | test_get_dimension_missing | nismod/smif | 28 | python | def test_get_dimension_missing(client):
'\n '
response = client.get('/api/v1/dimensions/does_not_exist')
data = parse_json(response)
assert (data['error']['SmifDataNotFoundError'] == ["dimension 'does_not_exist' not found"]) | def test_get_dimension_missing(client):
'\n '
response = client.get('/api/v1/dimensions/does_not_exist')
data = parse_json(response)
assert (data['error']['SmifDataNotFoundError'] == ["dimension 'does_not_exist' not found"])<|docstring|>GET missing system-of-systems model<|endoftext|> |
a1d68aeb2263da53ad82c1e5524fbc61d163f4da648e60cf6e0c4ff40dd12c35 | def test_post_dimension(client, get_dimension):
'POST system-of-systems model\n '
name = 'test_post_dimension'
get_dimension['name'] = name
send = serialise_json(get_dimension)
response = client.post('/api/v1/dimensions/', data=send, content_type='application/json')
current_app.config.data_in... | POST system-of-systems model | tests/http_api/test_crud.py | test_post_dimension | nismod/smif | 28 | python | def test_post_dimension(client, get_dimension):
'\n '
name = 'test_post_dimension'
get_dimension['name'] = name
send = serialise_json(get_dimension)
response = client.post('/api/v1/dimensions/', data=send, content_type='application/json')
current_app.config.data_interface.write_dimension.asse... | def test_post_dimension(client, get_dimension):
'\n '
name = 'test_post_dimension'
get_dimension['name'] = name
send = serialise_json(get_dimension)
response = client.post('/api/v1/dimensions/', data=send, content_type='application/json')
current_app.config.data_interface.write_dimension.asse... |
95653082d9b91a2e5f26174dfcaba5a92661a2dd0c10923fcff5875d55db9390 | def test_put_dimension(client, get_dimension):
'PUT dimension\n '
send = serialise_json(get_dimension)
response = client.put(('/api/v1/dimensions/' + get_dimension['name']), data=send, content_type='application/json')
current_app.config.data_interface.update_dimension.assert_called_with(get_dimension... | PUT dimension | tests/http_api/test_crud.py | test_put_dimension | nismod/smif | 28 | python | def test_put_dimension(client, get_dimension):
'\n '
send = serialise_json(get_dimension)
response = client.put(('/api/v1/dimensions/' + get_dimension['name']), data=send, content_type='application/json')
current_app.config.data_interface.update_dimension.assert_called_with(get_dimension['name'], get... | def test_put_dimension(client, get_dimension):
'\n '
send = serialise_json(get_dimension)
response = client.put(('/api/v1/dimensions/' + get_dimension['name']), data=send, content_type='application/json')
current_app.config.data_interface.update_dimension.assert_called_with(get_dimension['name'], get... |
817c100ec002d46842f344022b1eed3b61a1f64f81d0f6faee89ffa779ce1463 | def test_delete_dimension(client, get_dimension):
'DELETE dimension\n '
send = serialise_json(get_dimension)
response = client.delete(('/api/v1/dimensions/' + get_dimension['name']), data=send, content_type='application/json')
current_app.config.data_interface.delete_dimension.assert_called_with(get_... | DELETE dimension | tests/http_api/test_crud.py | test_delete_dimension | nismod/smif | 28 | python | def test_delete_dimension(client, get_dimension):
'\n '
send = serialise_json(get_dimension)
response = client.delete(('/api/v1/dimensions/' + get_dimension['name']), data=send, content_type='application/json')
current_app.config.data_interface.delete_dimension.assert_called_with(get_dimension['name'... | def test_delete_dimension(client, get_dimension):
'\n '
send = serialise_json(get_dimension)
response = client.delete(('/api/v1/dimensions/' + get_dimension['name']), data=send, content_type='application/json')
current_app.config.data_interface.delete_dimension.assert_called_with(get_dimension['name'... |
aa09c2d83b12e8377a40ef0fe93264d15fddbab629a8ff55eab330036bf93f28 | def get_fods(object, basis='pc-0', loc='FB', clean=True):
'Generate FOD positions using the PyCOM method.\n\n Reference: J. Comput. Chem. 40, 2843.\n\n Args:\n object: Atoms or SCF object.\n\n Keyword Args:\n basis (str): Basis set for the DFT calculation.\n loc (str): Localization met... | Generate FOD positions using the PyCOM method.
Reference: J. Comput. Chem. 40, 2843.
Args:
object: Atoms or SCF object.
Keyword Args:
basis (str): Basis set for the DFT calculation.
loc (str): Localization method (case insensitive).
clean (bool): Remove log files.
Returns:
ndarray: FOD positions... | eminus/addons/fods.py | get_fods | wangenau/eminus | 0 | python | def get_fods(object, basis='pc-0', loc='FB', clean=True):
'Generate FOD positions using the PyCOM method.\n\n Reference: J. Comput. Chem. 40, 2843.\n\n Args:\n object: Atoms or SCF object.\n\n Keyword Args:\n basis (str): Basis set for the DFT calculation.\n loc (str): Localization met... | def get_fods(object, basis='pc-0', loc='FB', clean=True):
'Generate FOD positions using the PyCOM method.\n\n Reference: J. Comput. Chem. 40, 2843.\n\n Args:\n object: Atoms or SCF object.\n\n Keyword Args:\n basis (str): Basis set for the DFT calculation.\n loc (str): Localization met... |
f62a37dd250509b6f7175789cc0891a3f13526f58ac635a0264b44380ae278d9 | def split_fods(atom, X):
'Split atom and FOD coordinates.\n\n Args:\n atom (list): Atom symbols.\n X (ndarray): Atom positions.\n\n Returns:\n tuple[list, ndarray, ndarray]: Atom types, the respective coordinates, and FOD positions.\n '
X_fod = []
for ia in range((len(X) - 1), ... | Split atom and FOD coordinates.
Args:
atom (list): Atom symbols.
X (ndarray): Atom positions.
Returns:
tuple[list, ndarray, ndarray]: Atom types, the respective coordinates, and FOD positions. | eminus/addons/fods.py | split_fods | wangenau/eminus | 0 | python | def split_fods(atom, X):
'Split atom and FOD coordinates.\n\n Args:\n atom (list): Atom symbols.\n X (ndarray): Atom positions.\n\n Returns:\n tuple[list, ndarray, ndarray]: Atom types, the respective coordinates, and FOD positions.\n '
X_fod = []
for ia in range((len(X) - 1), ... | def split_fods(atom, X):
'Split atom and FOD coordinates.\n\n Args:\n atom (list): Atom symbols.\n X (ndarray): Atom positions.\n\n Returns:\n tuple[list, ndarray, ndarray]: Atom types, the respective coordinates, and FOD positions.\n '
X_fod = []
for ia in range((len(X) - 1), ... |
b298af99963383d4da316ab26d7f7f1904030631fc84c5aec67de3f57c8aee33 | def remove_core_fods(object, fods):
'Remove core FODs from a set of FOD coordinates.\n\n Args:\n object: Atoms or SCF object.\n fods (ndarray): FOD positions.\n\n Returns:\n ndarray: Valence FOD positions.\n '
try:
atoms = object.atoms
except AttributeError:
ato... | Remove core FODs from a set of FOD coordinates.
Args:
object: Atoms or SCF object.
fods (ndarray): FOD positions.
Returns:
ndarray: Valence FOD positions. | eminus/addons/fods.py | remove_core_fods | wangenau/eminus | 0 | python | def remove_core_fods(object, fods):
'Remove core FODs from a set of FOD coordinates.\n\n Args:\n object: Atoms or SCF object.\n fods (ndarray): FOD positions.\n\n Returns:\n ndarray: Valence FOD positions.\n '
try:
atoms = object.atoms
except AttributeError:
ato... | def remove_core_fods(object, fods):
'Remove core FODs from a set of FOD coordinates.\n\n Args:\n object: Atoms or SCF object.\n fods (ndarray): FOD positions.\n\n Returns:\n ndarray: Valence FOD positions.\n '
try:
atoms = object.atoms
except AttributeError:
ato... |
74c1b5cee75f0332735acd83695343b21193a72ac459a5dd5ee760916d04fd63 | def _check_align(self, a):
'\n Check whether the alignments are legal.\n\n :param a: alignment to be checked\n :raise IndexError: if alignment is out of sentence boundary\n :rtype: boolean\n '
if (not all(((0 <= p[0] < len(self._words)) for p in a))):
raise IndexError(... | Check whether the alignments are legal.
:param a: alignment to be checked
:raise IndexError: if alignment is out of sentence boundary
:rtype: boolean | venv/lib/python2.7/site-packages/nltk/align/api.py | _check_align | sravani-m/Web-Application-Security-Framework | 3 | python | def _check_align(self, a):
'\n Check whether the alignments are legal.\n\n :param a: alignment to be checked\n :raise IndexError: if alignment is out of sentence boundary\n :rtype: boolean\n '
if (not all(((0 <= p[0] < len(self._words)) for p in a))):
raise IndexError(... | def _check_align(self, a):
'\n Check whether the alignments are legal.\n\n :param a: alignment to be checked\n :raise IndexError: if alignment is out of sentence boundary\n :rtype: boolean\n '
if (not all(((0 <= p[0] < len(self._words)) for p in a))):
raise IndexError(... |
5525e2ac3ec148423b283260a317d602809c3f3938311ec90a614c8df7c21f1f | def __repr__(self):
'\n Return a string representation for this ``AlignedSent``.\n\n :rtype: str\n '
words = ('[%s]' % ', '.join((("'%s'" % w) for w in self._words)))
mots = ('[%s]' % ', '.join((("'%s'" % w) for w in self._mots)))
return ('AlignedSent(%s, %s, %r)' % (words, mots, se... | Return a string representation for this ``AlignedSent``.
:rtype: str | venv/lib/python2.7/site-packages/nltk/align/api.py | __repr__ | sravani-m/Web-Application-Security-Framework | 3 | python | def __repr__(self):
'\n Return a string representation for this ``AlignedSent``.\n\n :rtype: str\n '
words = ('[%s]' % ', '.join((("'%s'" % w) for w in self._words)))
mots = ('[%s]' % ', '.join((("'%s'" % w) for w in self._mots)))
return ('AlignedSent(%s, %s, %r)' % (words, mots, se... | def __repr__(self):
'\n Return a string representation for this ``AlignedSent``.\n\n :rtype: str\n '
words = ('[%s]' % ', '.join((("'%s'" % w) for w in self._words)))
mots = ('[%s]' % ', '.join((("'%s'" % w) for w in self._mots)))
return ('AlignedSent(%s, %s, %r)' % (words, mots, se... |
8983f61c32c67dda723aadc2812f6dfb78be2d8701068902ea147fbd102c8fa4 | def __str__(self):
'\n Return a human-readable string representation for this ``AlignedSent``.\n\n :rtype: str\n '
source = (' '.join(self._words)[:20] + '...')
target = (' '.join(self._mots)[:20] + '...')
return ("<AlignedSent: '%s' -> '%s'>" % (source, target)) | Return a human-readable string representation for this ``AlignedSent``.
:rtype: str | venv/lib/python2.7/site-packages/nltk/align/api.py | __str__ | sravani-m/Web-Application-Security-Framework | 3 | python | def __str__(self):
'\n Return a human-readable string representation for this ``AlignedSent``.\n\n :rtype: str\n '
source = (' '.join(self._words)[:20] + '...')
target = (' '.join(self._mots)[:20] + '...')
return ("<AlignedSent: '%s' -> '%s'>" % (source, target)) | def __str__(self):
'\n Return a human-readable string representation for this ``AlignedSent``.\n\n :rtype: str\n '
source = (' '.join(self._words)[:20] + '...')
target = (' '.join(self._mots)[:20] + '...')
return ("<AlignedSent: '%s' -> '%s'>" % (source, target))<|docstring|>Return ... |
2b6cf8f2d05690d752719b6a0fdb5dd055c2e15b930e85324520d95261dcd164 | def invert(self):
'\n Return the aligned sentence pair, reversing the directionality\n\n :rtype: AlignedSent\n '
return AlignedSent(self._mots, self._words, self._alignment.invert()) | Return the aligned sentence pair, reversing the directionality
:rtype: AlignedSent | venv/lib/python2.7/site-packages/nltk/align/api.py | invert | sravani-m/Web-Application-Security-Framework | 3 | python | def invert(self):
'\n Return the aligned sentence pair, reversing the directionality\n\n :rtype: AlignedSent\n '
return AlignedSent(self._mots, self._words, self._alignment.invert()) | def invert(self):
'\n Return the aligned sentence pair, reversing the directionality\n\n :rtype: AlignedSent\n '
return AlignedSent(self._mots, self._words, self._alignment.invert())<|docstring|>Return the aligned sentence pair, reversing the directionality
:rtype: AlignedSent<|endoftext|> |
12be3a2a854b10fc6f8fb28a633eb43d29c69fb0e3e6eb49af1959b14d3671e0 | def precision(self, reference):
'\n Return the precision of an aligned sentence with respect to a\n "gold standard" reference ``AlignedSent``.\n\n :type reference: AlignedSent or Alignment\n :param reference: A "gold standard" reference aligned sentence.\n :rtype: float or None\n ... | Return the precision of an aligned sentence with respect to a
"gold standard" reference ``AlignedSent``.
:type reference: AlignedSent or Alignment
:param reference: A "gold standard" reference aligned sentence.
:rtype: float or None | venv/lib/python2.7/site-packages/nltk/align/api.py | precision | sravani-m/Web-Application-Security-Framework | 3 | python | def precision(self, reference):
'\n Return the precision of an aligned sentence with respect to a\n "gold standard" reference ``AlignedSent``.\n\n :type reference: AlignedSent or Alignment\n :param reference: A "gold standard" reference aligned sentence.\n :rtype: float or None\n ... | def precision(self, reference):
'\n Return the precision of an aligned sentence with respect to a\n "gold standard" reference ``AlignedSent``.\n\n :type reference: AlignedSent or Alignment\n :param reference: A "gold standard" reference aligned sentence.\n :rtype: float or None\n ... |
559c4742689fc8bded15ebdb6622808a5e43a2fb749a523946422eb151357c33 | def recall(self, reference):
'\n Return the recall of an aligned sentence with respect to a\n "gold standard" reference ``AlignedSent``.\n\n :type reference: AlignedSent or Alignment\n :param reference: A "gold standard" reference aligned sentence.\n :rtype: float or None\n ... | Return the recall of an aligned sentence with respect to a
"gold standard" reference ``AlignedSent``.
:type reference: AlignedSent or Alignment
:param reference: A "gold standard" reference aligned sentence.
:rtype: float or None | venv/lib/python2.7/site-packages/nltk/align/api.py | recall | sravani-m/Web-Application-Security-Framework | 3 | python | def recall(self, reference):
'\n Return the recall of an aligned sentence with respect to a\n "gold standard" reference ``AlignedSent``.\n\n :type reference: AlignedSent or Alignment\n :param reference: A "gold standard" reference aligned sentence.\n :rtype: float or None\n ... | def recall(self, reference):
'\n Return the recall of an aligned sentence with respect to a\n "gold standard" reference ``AlignedSent``.\n\n :type reference: AlignedSent or Alignment\n :param reference: A "gold standard" reference aligned sentence.\n :rtype: float or None\n ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.