body stringlengths 26 98.2k | body_hash int64 -9,222,864,604,528,158,000 9,221,803,474B | docstring stringlengths 1 16.8k | path stringlengths 5 230 | name stringlengths 1 96 | repository_name stringlengths 7 89 | lang stringclasses 1
value | body_without_docstring stringlengths 20 98.2k |
|---|---|---|---|---|---|---|---|
def get(path, name):
'\n Args:\n path (string): Directory where the entry point is located.\n name (string): Name of the entry point file.\n\n Returns:\n (_EntryPointType): The type of the entry point.\n '
if name.endswith('.sh'):
return _EntryPointType.COMMAND
elif ('s... | -4,104,312,754,512,531,000 | Args:
path (string): Directory where the entry point is located.
name (string): Name of the entry point file.
Returns:
(_EntryPointType): The type of the entry point. | src/sagemaker_training/_entry_point_type.py | get | ChaiBapchya/sagemaker-training-toolk | python | def get(path, name):
'\n Args:\n path (string): Directory where the entry point is located.\n name (string): Name of the entry point file.\n\n Returns:\n (_EntryPointType): The type of the entry point.\n '
if name.endswith('.sh'):
return _EntryPointType.COMMAND
elif ('s... |
def test_tf_linear_interp1d_map(self):
'Tests TF linear interpolation mapping to a single number.'
def graph_fn():
tf_x = tf.constant([0.0, 0.5, 1.0])
tf_y = tf.constant([0.5, 0.5, 0.5])
new_x = tf.constant([0.0, 0.25, 0.5, 0.75, 1.0])
tf_map_outputs = calibration_builder._tf_li... | -7,720,452,319,569,558,000 | Tests TF linear interpolation mapping to a single number. | research/object_detection/builders/calibration_builder_test.py | test_tf_linear_interp1d_map | zhaowt96/models | python | def test_tf_linear_interp1d_map(self):
def graph_fn():
tf_x = tf.constant([0.0, 0.5, 1.0])
tf_y = tf.constant([0.5, 0.5, 0.5])
new_x = tf.constant([0.0, 0.25, 0.5, 0.75, 1.0])
tf_map_outputs = calibration_builder._tf_linear_interp1d(new_x, tf_x, tf_y)
return tf_map_outp... |
def test_tf_linear_interp1d_interpolate(self):
'Tests TF 1d linear interpolation not mapping to a single number.'
def graph_fn():
tf_x = tf.constant([0.0, 0.5, 1.0])
tf_y = tf.constant([0.6, 0.7, 1.0])
new_x = tf.constant([0.0, 0.25, 0.5, 0.75, 1.0])
tf_interpolate_outputs = cal... | -1,378,826,018,398,115,600 | Tests TF 1d linear interpolation not mapping to a single number. | research/object_detection/builders/calibration_builder_test.py | test_tf_linear_interp1d_interpolate | zhaowt96/models | python | def test_tf_linear_interp1d_interpolate(self):
def graph_fn():
tf_x = tf.constant([0.0, 0.5, 1.0])
tf_y = tf.constant([0.6, 0.7, 1.0])
new_x = tf.constant([0.0, 0.25, 0.5, 0.75, 1.0])
tf_interpolate_outputs = calibration_builder._tf_linear_interp1d(new_x, tf_x, tf_y)
re... |
@staticmethod
def _get_scipy_interp1d(new_x, x, y):
'Helper performing 1d linear interpolation using SciPy.'
interpolation1d_fn = interpolate.interp1d(x, y)
return interpolation1d_fn(new_x) | -4,444,101,741,602,493,400 | Helper performing 1d linear interpolation using SciPy. | research/object_detection/builders/calibration_builder_test.py | _get_scipy_interp1d | zhaowt96/models | python | @staticmethod
def _get_scipy_interp1d(new_x, x, y):
interpolation1d_fn = interpolate.interp1d(x, y)
return interpolation1d_fn(new_x) |
def _get_tf_interp1d(self, new_x, x, y):
'Helper performing 1d linear interpolation using Tensorflow.'
def graph_fn():
tf_interp_outputs = calibration_builder._tf_linear_interp1d(tf.convert_to_tensor(new_x, dtype=tf.float32), tf.convert_to_tensor(x, dtype=tf.float32), tf.convert_to_tensor(y, dtype=tf.f... | 6,076,830,241,423,907,000 | Helper performing 1d linear interpolation using Tensorflow. | research/object_detection/builders/calibration_builder_test.py | _get_tf_interp1d | zhaowt96/models | python | def _get_tf_interp1d(self, new_x, x, y):
def graph_fn():
tf_interp_outputs = calibration_builder._tf_linear_interp1d(tf.convert_to_tensor(new_x, dtype=tf.float32), tf.convert_to_tensor(x, dtype=tf.float32), tf.convert_to_tensor(y, dtype=tf.float32))
return tf_interp_outputs
np_tf_interp_ou... |
def test_tf_linear_interp1d_against_scipy_map(self):
'Tests parity of TF linear interpolation with SciPy for simple mapping.'
length = 10
np_x = np.linspace(0, 1, length)
np_y_map = np.repeat(0.5, length)
test_data_np = np.linspace(0, 1, (length * 10))
scipy_map_outputs = self._get_scipy_interp1... | 8,143,699,188,412,991,000 | Tests parity of TF linear interpolation with SciPy for simple mapping. | research/object_detection/builders/calibration_builder_test.py | test_tf_linear_interp1d_against_scipy_map | zhaowt96/models | python | def test_tf_linear_interp1d_against_scipy_map(self):
length = 10
np_x = np.linspace(0, 1, length)
np_y_map = np.repeat(0.5, length)
test_data_np = np.linspace(0, 1, (length * 10))
scipy_map_outputs = self._get_scipy_interp1d(test_data_np, np_x, np_y_map)
np_tf_map_outputs = self._get_tf_int... |
def test_tf_linear_interp1d_against_scipy_interpolate(self):
'Tests parity of TF linear interpolation with SciPy.'
length = 10
np_x = np.linspace(0, 1, length)
np_y_interp = np.linspace(0.5, 1, length)
test_data_np = np.linspace(0, 1, (length * 10))
scipy_interp_outputs = self._get_scipy_interp1... | 5,465,063,855,331,998,000 | Tests parity of TF linear interpolation with SciPy. | research/object_detection/builders/calibration_builder_test.py | test_tf_linear_interp1d_against_scipy_interpolate | zhaowt96/models | python | def test_tf_linear_interp1d_against_scipy_interpolate(self):
length = 10
np_x = np.linspace(0, 1, length)
np_y_interp = np.linspace(0.5, 1, length)
test_data_np = np.linspace(0, 1, (length * 10))
scipy_interp_outputs = self._get_scipy_interp1d(test_data_np, np_x, np_y_interp)
np_tf_interp_o... |
@staticmethod
def _add_function_approximation_to_calibration_proto(calibration_proto, x_array, y_array, class_id):
'Adds a function approximation to calibration proto for a class id.'
if (class_id is not None):
function_approximation = calibration_proto.class_id_function_approximations.class_id_xy_pairs... | 385,374,581,038,189,440 | Adds a function approximation to calibration proto for a class id. | research/object_detection/builders/calibration_builder_test.py | _add_function_approximation_to_calibration_proto | zhaowt96/models | python | @staticmethod
def _add_function_approximation_to_calibration_proto(calibration_proto, x_array, y_array, class_id):
if (class_id is not None):
function_approximation = calibration_proto.class_id_function_approximations.class_id_xy_pairs_map[class_id]
else:
function_approximation = calibratio... |
def test_class_agnostic_function_approximation(self):
'Tests that calibration produces correct class-agnostic values.'
class_agnostic_x = np.asarray([0.0, 0.5, 1.0])
class_agnostic_y = np.asarray([0.0, 0.25, 0.75])
calibration_config = calibration_pb2.CalibrationConfig()
self._add_function_approxima... | 529,330,399,351,468,800 | Tests that calibration produces correct class-agnostic values. | research/object_detection/builders/calibration_builder_test.py | test_class_agnostic_function_approximation | zhaowt96/models | python | def test_class_agnostic_function_approximation(self):
class_agnostic_x = np.asarray([0.0, 0.5, 1.0])
class_agnostic_y = np.asarray([0.0, 0.25, 0.75])
calibration_config = calibration_pb2.CalibrationConfig()
self._add_function_approximation_to_calibration_proto(calibration_config, class_agnostic_x, ... |
def test_multiclass_function_approximations(self):
'Tests that calibration produces correct multiclass values.'
class_0_x = np.asarray([0.0, 0.5, 1.0])
class_0_y = np.asarray([0.5, 0.5, 0.5])
calibration_config = calibration_pb2.CalibrationConfig()
self._add_function_approximation_to_calibration_pro... | 9,125,179,593,091,703,000 | Tests that calibration produces correct multiclass values. | research/object_detection/builders/calibration_builder_test.py | test_multiclass_function_approximations | zhaowt96/models | python | def test_multiclass_function_approximations(self):
class_0_x = np.asarray([0.0, 0.5, 1.0])
class_0_y = np.asarray([0.5, 0.5, 0.5])
calibration_config = calibration_pb2.CalibrationConfig()
self._add_function_approximation_to_calibration_proto(calibration_config, class_0_x, class_0_y, class_id=0)
... |
def test_temperature_scaling(self):
'Tests that calibration produces correct temperature scaling values.'
calibration_config = calibration_pb2.CalibrationConfig()
calibration_config.temperature_scaling_calibration.scaler = 2.0
def graph_fn():
calibration_fn = calibration_builder.build(calibrati... | 7,285,490,984,036,249,000 | Tests that calibration produces correct temperature scaling values. | research/object_detection/builders/calibration_builder_test.py | test_temperature_scaling | zhaowt96/models | python | def test_temperature_scaling(self):
calibration_config = calibration_pb2.CalibrationConfig()
calibration_config.temperature_scaling_calibration.scaler = 2.0
def graph_fn():
calibration_fn = calibration_builder.build(calibration_config)
class_predictions_with_background = tf.constant([[... |
def test_skips_class_when_calibration_parameters_not_present(self):
'Tests that graph fails when parameters not present for all classes.'
class_0_x = np.asarray([0.0, 0.5, 1.0])
class_0_y = np.asarray([0.5, 0.5, 0.5])
calibration_config = calibration_pb2.CalibrationConfig()
self._add_function_approx... | 643,980,486,263,068,900 | Tests that graph fails when parameters not present for all classes. | research/object_detection/builders/calibration_builder_test.py | test_skips_class_when_calibration_parameters_not_present | zhaowt96/models | python | def test_skips_class_when_calibration_parameters_not_present(self):
class_0_x = np.asarray([0.0, 0.5, 1.0])
class_0_y = np.asarray([0.5, 0.5, 0.5])
calibration_config = calibration_pb2.CalibrationConfig()
self._add_function_approximation_to_calibration_proto(calibration_config, class_0_x, class_0_y... |
def cluster_and_sort(x, max_clusters, min_cluster_size):
'\n :param x: object representations (X x Features)\n :param max_clusters:\n :param min_cluster_size:\n :return: List[cluster], Hierarchical dendrogram of splits.\n '
logger.debug(f'Looking for an appropriate number of clusters,min_cluster_... | -1,275,711,226,123,318,000 | :param x: object representations (X x Features)
:param max_clusters:
:param min_cluster_size:
:return: List[cluster], Hierarchical dendrogram of splits. | pysrc/papers/analysis/topics.py | cluster_and_sort | JetBrains-Research/pubtrends | python | def cluster_and_sort(x, max_clusters, min_cluster_size):
'\n :param x: object representations (X x Features)\n :param max_clusters:\n :param min_cluster_size:\n :return: List[cluster], Hierarchical dendrogram of splits.\n '
logger.debug(f'Looking for an appropriate number of clusters,min_cluster_... |
def get_topics_description(df, comps, corpus, corpus_tokens, corpus_counts, n_words, ignore_comp=None):
"\n Get words from abstracts that describe the components the best way\n using closest to the 'ideal' frequency vector - [0, ..., 0, 1, 0, ..., 0] in tokens of cosine distance\n "
logger.debug(f'Gene... | 8,841,790,934,862,806,000 | Get words from abstracts that describe the components the best way
using closest to the 'ideal' frequency vector - [0, ..., 0, 1, 0, ..., 0] in tokens of cosine distance | pysrc/papers/analysis/topics.py | get_topics_description | JetBrains-Research/pubtrends | python | def get_topics_description(df, comps, corpus, corpus_tokens, corpus_counts, n_words, ignore_comp=None):
"\n Get words from abstracts that describe the components the best way\n using closest to the 'ideal' frequency vector - [0, ..., 0, 1, 0, ..., 0] in tokens of cosine distance\n "
logger.debug(f'Gene... |
def _get_topics_description_cosine(comps, corpus_tokens, corpus_counts, n_words, ignore_comp=None):
"\n Select words with the frequency vector that is the closest to the 'ideal' frequency vector\n ([0, ..., 0, 1, 0, ..., 0]) in tokens of cosine distance\n "
logger.debug('Compute average tokens counts p... | 3,370,905,416,881,422,000 | Select words with the frequency vector that is the closest to the 'ideal' frequency vector
([0, ..., 0, 1, 0, ..., 0]) in tokens of cosine distance | pysrc/papers/analysis/topics.py | _get_topics_description_cosine | JetBrains-Research/pubtrends | python | def _get_topics_description_cosine(comps, corpus_tokens, corpus_counts, n_words, ignore_comp=None):
"\n Select words with the frequency vector that is the closest to the 'ideal' frequency vector\n ([0, ..., 0, 1, 0, ..., 0]) in tokens of cosine distance\n "
logger.debug('Compute average tokens counts p... |
def test_params_deprecation_view_markers():
' Tests whether use of deprecated keyword parameters of view_markers\n raise corrrect warnings.\n '
deprecated_params = {'coords': 'marker_coords', 'colors': 'marker_color'}
deprecation_msg = 'The parameter "{}" will be removed in 0.6.0 release of Nilearn. P... | -5,101,782,481,197,769,000 | Tests whether use of deprecated keyword parameters of view_markers
raise corrrect warnings. | nilearn/plotting/tests/test_html_connectome.py | test_params_deprecation_view_markers | JohannesWiesner/nilearn | python | def test_params_deprecation_view_markers():
' Tests whether use of deprecated keyword parameters of view_markers\n raise corrrect warnings.\n '
deprecated_params = {'coords': 'marker_coords', 'colors': 'marker_color'}
deprecation_msg = 'The parameter "{}" will be removed in 0.6.0 release of Nilearn. P... |
def L2NormLoss_test(gt, out, frame_ids):
'\n gt: B, 66, 25\n '
t_3d = np.zeros(len(frame_ids))
(batch_size, features, seq_len) = gt.shape
gt = gt.permute(0, 2, 1).contiguous().view(batch_size, seq_len, (- 1), 3)
out = out.permute(0, 2, 1).contiguous().view(batch_size, seq_len, (- 1), 3)
fo... | -2,572,087,974,684,275,000 | gt: B, 66, 25 | run/cmu_runner.py | L2NormLoss_test | Droliven/MSRGCN | python | def L2NormLoss_test(gt, out, frame_ids):
'\n \n '
t_3d = np.zeros(len(frame_ids))
(batch_size, features, seq_len) = gt.shape
gt = gt.permute(0, 2, 1).contiguous().view(batch_size, seq_len, (- 1), 3)
out = out.permute(0, 2, 1).contiguous().view(batch_size, seq_len, (- 1), 3)
for k in np.ara... |
def L2NormLoss_train(gt, out):
'\n # (batch size,feature dim, seq len)\n 等同于 mpjpe_error_p3d()\n '
(batch_size, _, seq_len) = gt.shape
gt = gt.view(batch_size, (- 1), 3, seq_len).permute(0, 3, 1, 2).contiguous()
out = out.view(batch_size, (- 1), 3, seq_len).permute(0, 3, 1, 2).contiguous()
... | 3,562,557,728,237,097,000 | # (batch size,feature dim, seq len)
等同于 mpjpe_error_p3d() | run/cmu_runner.py | L2NormLoss_train | Droliven/MSRGCN | python | def L2NormLoss_train(gt, out):
'\n # (batch size,feature dim, seq len)\n 等同于 mpjpe_error_p3d()\n '
(batch_size, _, seq_len) = gt.shape
gt = gt.view(batch_size, (- 1), 3, seq_len).permute(0, 3, 1, 2).contiguous()
out = out.view(batch_size, (- 1), 3, seq_len).permute(0, 3, 1, 2).contiguous()
... |
def parse_command_args(args):
'\n This parses the arguments and returns a tuple containing:\n\n (args, command, command_args)\n\n For example, "--config=bar start --with=baz" would return:\n\n ([\'--config=bar\'], \'start\', [\'--with=baz\'])\n '
index = None
for (arg_i, arg) in enumerate(arg... | 987,570,457,215,449,000 | This parses the arguments and returns a tuple containing:
(args, command, command_args)
For example, "--config=bar start --with=baz" would return:
(['--config=bar'], 'start', ['--with=baz']) | nautobot/core/runner/runner.py | parse_command_args | Joezeppe/nautobot | python | def parse_command_args(args):
'\n This parses the arguments and returns a tuple containing:\n\n (args, command, command_args)\n\n For example, "--config=bar start --with=baz" would return:\n\n ([\'--config=bar\'], \'start\', [\'--with=baz\'])\n '
index = None
for (arg_i, arg) in enumerate(arg... |
def configure_app(config_path=None, project=None, default_config_path=None, default_settings=None, settings_initializer=None, settings_envvar=None, initializer=None, allow_extras=True, config_module_name=None, runner_name=None, on_configure=None):
'\n :param project: should represent the canonical name for the p... | 9,219,377,544,592,713,000 | :param project: should represent the canonical name for the project, generally
the same name it assigned in distutils.
:param default_config_path: the default location for the configuration file.
:param default_settings: default settings to load (think inheritence).
:param settings_initializer: a callback function ... | nautobot/core/runner/runner.py | configure_app | Joezeppe/nautobot | python | def configure_app(config_path=None, project=None, default_config_path=None, default_settings=None, settings_initializer=None, settings_envvar=None, initializer=None, allow_extras=True, config_module_name=None, runner_name=None, on_configure=None):
'\n :param project: should represent the canonical name for the p... |
def read_data_file(fp):
' Reading the raw data from a file of NeMo format\n For more info about the data format, refer to the\n `text_normalization doc <https://github.com/NVIDIA/NeMo/blob/main/docs/source/nlp/text_normalization.rst>`.\n '
(insts, w_words, s_words, classes) = ([], [], [], [])
with ... | 720,673,658,514,461,300 | Reading the raw data from a file of NeMo format
For more info about the data format, refer to the
`text_normalization doc <https://github.com/NVIDIA/NeMo/blob/main/docs/source/nlp/text_normalization.rst>`. | nemo/collections/nlp/data/text_normalization/utils.py | read_data_file | JMichaelStringer/NeMo | python | def read_data_file(fp):
' Reading the raw data from a file of NeMo format\n For more info about the data format, refer to the\n `text_normalization doc <https://github.com/NVIDIA/NeMo/blob/main/docs/source/nlp/text_normalization.rst>`.\n '
(insts, w_words, s_words, classes) = ([], [], [], [])
with ... |
def normalize_str(input_str, lang):
' Normalize an input string '
input_str_tokens = basic_tokenize(input_str.strip().lower(), lang)
input_str = ' '.join(input_str_tokens)
input_str = input_str.replace(' ', ' ')
return input_str | -1,371,477,686,936,655,400 | Normalize an input string | nemo/collections/nlp/data/text_normalization/utils.py | normalize_str | JMichaelStringer/NeMo | python | def normalize_str(input_str, lang):
' '
input_str_tokens = basic_tokenize(input_str.strip().lower(), lang)
input_str = ' '.join(input_str_tokens)
input_str = input_str.replace(' ', ' ')
return input_str |
def remove_puncts(input_str):
' Remove punctuations from an input string '
return input_str.translate(str.maketrans('', '', string.punctuation)) | 8,084,838,030,692,354,000 | Remove punctuations from an input string | nemo/collections/nlp/data/text_normalization/utils.py | remove_puncts | JMichaelStringer/NeMo | python | def remove_puncts(input_str):
' '
return input_str.translate(str.maketrans(, , string.punctuation)) |
def basic_tokenize(input_str, lang):
'\n The function is used to do some basic tokenization\n\n Args:\n input_str: The input string\n lang: Language of the input string\n Return: a list of tokens of the input string\n '
if (lang == constants.ENGLISH):
return word_tokenize(input... | 7,466,873,734,542,841,000 | The function is used to do some basic tokenization
Args:
input_str: The input string
lang: Language of the input string
Return: a list of tokens of the input string | nemo/collections/nlp/data/text_normalization/utils.py | basic_tokenize | JMichaelStringer/NeMo | python | def basic_tokenize(input_str, lang):
'\n The function is used to do some basic tokenization\n\n Args:\n input_str: The input string\n lang: Language of the input string\n Return: a list of tokens of the input string\n '
if (lang == constants.ENGLISH):
return word_tokenize(input... |
def _hexify(data, chunksize=_hex_chunksize):
'Convert a binary string into its hex encoding, broken up into chunks\n of I{chunksize} characters separated by a space.\n\n @param data: the binary string\n @type data: string\n @param chunksize: the chunk size. Default is L{dns.rdata._hex_chunksize}\n @... | 789,127,965,654,570,200 | Convert a binary string into its hex encoding, broken up into chunks
of I{chunksize} characters separated by a space.
@param data: the binary string
@type data: string
@param chunksize: the chunk size. Default is L{dns.rdata._hex_chunksize}
@rtype: string | gcloud/google-cloud-sdk/.install/.backup/lib/third_party/dns/rdata.py | _hexify | bopopescu/JobSniperRails | python | def _hexify(data, chunksize=_hex_chunksize):
'Convert a binary string into its hex encoding, broken up into chunks\n of I{chunksize} characters separated by a space.\n\n @param data: the binary string\n @type data: string\n @param chunksize: the chunk size. Default is L{dns.rdata._hex_chunksize}\n @... |
def _base64ify(data, chunksize=_base64_chunksize):
'Convert a binary string into its base64 encoding, broken up into chunks\n of I{chunksize} characters separated by a space.\n\n @param data: the binary string\n @type data: string\n @param chunksize: the chunk size. Default is\n L{dns.rdata._base64_... | 5,784,675,050,316,418,000 | Convert a binary string into its base64 encoding, broken up into chunks
of I{chunksize} characters separated by a space.
@param data: the binary string
@type data: string
@param chunksize: the chunk size. Default is
L{dns.rdata._base64_chunksize}
@rtype: string | gcloud/google-cloud-sdk/.install/.backup/lib/third_party/dns/rdata.py | _base64ify | bopopescu/JobSniperRails | python | def _base64ify(data, chunksize=_base64_chunksize):
'Convert a binary string into its base64 encoding, broken up into chunks\n of I{chunksize} characters separated by a space.\n\n @param data: the binary string\n @type data: string\n @param chunksize: the chunk size. Default is\n L{dns.rdata._base64_... |
def _escapify(qstring):
'Escape the characters in a quoted string which need it.\n\n @param qstring: the string\n @type qstring: string\n @returns: the escaped string\n @rtype: string\n '
if isinstance(qstring, text_type):
qstring = qstring.encode()
if (not isinstance(qstring, bytearr... | -5,175,706,632,374,009,000 | Escape the characters in a quoted string which need it.
@param qstring: the string
@type qstring: string
@returns: the escaped string
@rtype: string | gcloud/google-cloud-sdk/.install/.backup/lib/third_party/dns/rdata.py | _escapify | bopopescu/JobSniperRails | python | def _escapify(qstring):
'Escape the characters in a quoted string which need it.\n\n @param qstring: the string\n @type qstring: string\n @returns: the escaped string\n @rtype: string\n '
if isinstance(qstring, text_type):
qstring = qstring.encode()
if (not isinstance(qstring, bytearr... |
def _truncate_bitmap(what):
"Determine the index of greatest byte that isn't all zeros, and\n return the bitmap that contains all the bytes less than that index.\n\n @param what: a string of octets representing a bitmap.\n @type what: string\n @rtype: string\n "
for i in xrange((len(what) - 1), (... | -8,228,799,384,945,972,000 | Determine the index of greatest byte that isn't all zeros, and
return the bitmap that contains all the bytes less than that index.
@param what: a string of octets representing a bitmap.
@type what: string
@rtype: string | gcloud/google-cloud-sdk/.install/.backup/lib/third_party/dns/rdata.py | _truncate_bitmap | bopopescu/JobSniperRails | python | def _truncate_bitmap(what):
"Determine the index of greatest byte that isn't all zeros, and\n return the bitmap that contains all the bytes less than that index.\n\n @param what: a string of octets representing a bitmap.\n @type what: string\n @rtype: string\n "
for i in xrange((len(what) - 1), (... |
def from_text(rdclass, rdtype, tok, origin=None, relativize=True):
'Build an rdata object from text format.\n\n This function attempts to dynamically load a class which\n implements the specified rdata class and type. If there is no\n class-and-type-specific implementation, the GenericRdata class\n is ... | 8,269,539,008,425,469,000 | Build an rdata object from text format.
This function attempts to dynamically load a class which
implements the specified rdata class and type. If there is no
class-and-type-specific implementation, the GenericRdata class
is used.
Once a class is chosen, its from_text() class method is called
with the parameters to ... | gcloud/google-cloud-sdk/.install/.backup/lib/third_party/dns/rdata.py | from_text | bopopescu/JobSniperRails | python | def from_text(rdclass, rdtype, tok, origin=None, relativize=True):
'Build an rdata object from text format.\n\n This function attempts to dynamically load a class which\n implements the specified rdata class and type. If there is no\n class-and-type-specific implementation, the GenericRdata class\n is ... |
def from_wire(rdclass, rdtype, wire, current, rdlen, origin=None):
'Build an rdata object from wire format\n\n This function attempts to dynamically load a class which\n implements the specified rdata class and type. If there is no\n class-and-type-specific implementation, the GenericRdata class\n is u... | -6,306,272,264,640,259,000 | Build an rdata object from wire format
This function attempts to dynamically load a class which
implements the specified rdata class and type. If there is no
class-and-type-specific implementation, the GenericRdata class
is used.
Once a class is chosen, its from_wire() class method is called
with the parameters to t... | gcloud/google-cloud-sdk/.install/.backup/lib/third_party/dns/rdata.py | from_wire | bopopescu/JobSniperRails | python | def from_wire(rdclass, rdtype, wire, current, rdlen, origin=None):
'Build an rdata object from wire format\n\n This function attempts to dynamically load a class which\n implements the specified rdata class and type. If there is no\n class-and-type-specific implementation, the GenericRdata class\n is u... |
def __init__(self, rdclass, rdtype):
'Initialize an rdata.\n @param rdclass: The rdata class\n @type rdclass: int\n @param rdtype: The rdata type\n @type rdtype: int\n '
self.rdclass = rdclass
self.rdtype = rdtype | 5,392,004,270,510,241,000 | Initialize an rdata.
@param rdclass: The rdata class
@type rdclass: int
@param rdtype: The rdata type
@type rdtype: int | gcloud/google-cloud-sdk/.install/.backup/lib/third_party/dns/rdata.py | __init__ | bopopescu/JobSniperRails | python | def __init__(self, rdclass, rdtype):
'Initialize an rdata.\n @param rdclass: The rdata class\n @type rdclass: int\n @param rdtype: The rdata type\n @type rdtype: int\n '
self.rdclass = rdclass
self.rdtype = rdtype |
def covers(self):
'DNS SIG/RRSIG rdatas apply to a specific type; this type is\n returned by the covers() function. If the rdata type is not\n SIG or RRSIG, dns.rdatatype.NONE is returned. This is useful when\n creating rdatasets, allowing the rdataset to contain only RRSIGs\n of a par... | -3,506,249,151,304,646,000 | DNS SIG/RRSIG rdatas apply to a specific type; this type is
returned by the covers() function. If the rdata type is not
SIG or RRSIG, dns.rdatatype.NONE is returned. This is useful when
creating rdatasets, allowing the rdataset to contain only RRSIGs
of a particular type, e.g. RRSIG(NS).
@rtype: int | gcloud/google-cloud-sdk/.install/.backup/lib/third_party/dns/rdata.py | covers | bopopescu/JobSniperRails | python | def covers(self):
'DNS SIG/RRSIG rdatas apply to a specific type; this type is\n returned by the covers() function. If the rdata type is not\n SIG or RRSIG, dns.rdatatype.NONE is returned. This is useful when\n creating rdatasets, allowing the rdataset to contain only RRSIGs\n of a par... |
def extended_rdatatype(self):
'Return a 32-bit type value, the least significant 16 bits of\n which are the ordinary DNS type, and the upper 16 bits of which are\n the "covered" type, if any.\n @rtype: int\n '
return ((self.covers() << 16) | self.rdtype) | 5,964,719,601,966,584,000 | Return a 32-bit type value, the least significant 16 bits of
which are the ordinary DNS type, and the upper 16 bits of which are
the "covered" type, if any.
@rtype: int | gcloud/google-cloud-sdk/.install/.backup/lib/third_party/dns/rdata.py | extended_rdatatype | bopopescu/JobSniperRails | python | def extended_rdatatype(self):
'Return a 32-bit type value, the least significant 16 bits of\n which are the ordinary DNS type, and the upper 16 bits of which are\n the "covered" type, if any.\n @rtype: int\n '
return ((self.covers() << 16) | self.rdtype) |
def to_text(self, origin=None, relativize=True, **kw):
'Convert an rdata to text format.\n @rtype: string\n '
raise NotImplementedError | -1,293,614,360,225,144,300 | Convert an rdata to text format.
@rtype: string | gcloud/google-cloud-sdk/.install/.backup/lib/third_party/dns/rdata.py | to_text | bopopescu/JobSniperRails | python | def to_text(self, origin=None, relativize=True, **kw):
'Convert an rdata to text format.\n @rtype: string\n '
raise NotImplementedError |
def to_wire(self, file, compress=None, origin=None):
'Convert an rdata to wire format.\n @rtype: string\n '
raise NotImplementedError | -891,095,099,515,168,300 | Convert an rdata to wire format.
@rtype: string | gcloud/google-cloud-sdk/.install/.backup/lib/third_party/dns/rdata.py | to_wire | bopopescu/JobSniperRails | python | def to_wire(self, file, compress=None, origin=None):
'Convert an rdata to wire format.\n @rtype: string\n '
raise NotImplementedError |
def to_digestable(self, origin=None):
'Convert rdata to a format suitable for digesting in hashes. This\n is also the DNSSEC canonical form.'
f = BytesIO()
self.to_wire(f, None, origin)
return f.getvalue() | 8,274,505,152,368,702,000 | Convert rdata to a format suitable for digesting in hashes. This
is also the DNSSEC canonical form. | gcloud/google-cloud-sdk/.install/.backup/lib/third_party/dns/rdata.py | to_digestable | bopopescu/JobSniperRails | python | def to_digestable(self, origin=None):
'Convert rdata to a format suitable for digesting in hashes. This\n is also the DNSSEC canonical form.'
f = BytesIO()
self.to_wire(f, None, origin)
return f.getvalue() |
def validate(self):
"Check that the current contents of the rdata's fields are\n valid. If you change an rdata by assigning to its fields,\n it is a good idea to call validate() when you are done making\n changes.\n "
dns.rdata.from_text(self.rdclass, self.rdtype, self.to_text()) | 6,729,846,158,027,398,000 | Check that the current contents of the rdata's fields are
valid. If you change an rdata by assigning to its fields,
it is a good idea to call validate() when you are done making
changes. | gcloud/google-cloud-sdk/.install/.backup/lib/third_party/dns/rdata.py | validate | bopopescu/JobSniperRails | python | def validate(self):
"Check that the current contents of the rdata's fields are\n valid. If you change an rdata by assigning to its fields,\n it is a good idea to call validate() when you are done making\n changes.\n "
dns.rdata.from_text(self.rdclass, self.rdtype, self.to_text()) |
def _cmp(self, other):
'Compare an rdata with another rdata of the same rdtype and\n rdclass. Return < 0 if self < other in the DNSSEC ordering,\n 0 if self == other, and > 0 if self > other.\n '
our = self.to_digestable(dns.name.root)
their = other.to_digestable(dns.name.root)
if ... | -7,287,323,378,498,873,000 | Compare an rdata with another rdata of the same rdtype and
rdclass. Return < 0 if self < other in the DNSSEC ordering,
0 if self == other, and > 0 if self > other. | gcloud/google-cloud-sdk/.install/.backup/lib/third_party/dns/rdata.py | _cmp | bopopescu/JobSniperRails | python | def _cmp(self, other):
'Compare an rdata with another rdata of the same rdtype and\n rdclass. Return < 0 if self < other in the DNSSEC ordering,\n 0 if self == other, and > 0 if self > other.\n '
our = self.to_digestable(dns.name.root)
their = other.to_digestable(dns.name.root)
if ... |
@classmethod
def from_text(cls, rdclass, rdtype, tok, origin=None, relativize=True):
'Build an rdata object from text format.\n\n @param rdclass: The rdata class\n @type rdclass: int\n @param rdtype: The rdata type\n @type rdtype: int\n @param tok: The tokenizer\n @type tok... | 7,968,069,574,541,789,000 | Build an rdata object from text format.
@param rdclass: The rdata class
@type rdclass: int
@param rdtype: The rdata type
@type rdtype: int
@param tok: The tokenizer
@type tok: dns.tokenizer.Tokenizer
@param origin: The origin to use for relative names
@type origin: dns.name.Name
@param relativize: should names be rela... | gcloud/google-cloud-sdk/.install/.backup/lib/third_party/dns/rdata.py | from_text | bopopescu/JobSniperRails | python | @classmethod
def from_text(cls, rdclass, rdtype, tok, origin=None, relativize=True):
'Build an rdata object from text format.\n\n @param rdclass: The rdata class\n @type rdclass: int\n @param rdtype: The rdata type\n @type rdtype: int\n @param tok: The tokenizer\n @type tok... |
@classmethod
def from_wire(cls, rdclass, rdtype, wire, current, rdlen, origin=None):
'Build an rdata object from wire format\n\n @param rdclass: The rdata class\n @type rdclass: int\n @param rdtype: The rdata type\n @type rdtype: int\n @param wire: The wire-format message\n ... | 6,276,165,160,507,597,000 | Build an rdata object from wire format
@param rdclass: The rdata class
@type rdclass: int
@param rdtype: The rdata type
@type rdtype: int
@param wire: The wire-format message
@type wire: string
@param current: The offset in wire of the beginning of the rdata.
@type current: int
@param rdlen: The length of the wire-for... | gcloud/google-cloud-sdk/.install/.backup/lib/third_party/dns/rdata.py | from_wire | bopopescu/JobSniperRails | python | @classmethod
def from_wire(cls, rdclass, rdtype, wire, current, rdlen, origin=None):
'Build an rdata object from wire format\n\n @param rdclass: The rdata class\n @type rdclass: int\n @param rdtype: The rdata type\n @type rdtype: int\n @param wire: The wire-format message\n ... |
def choose_relativity(self, origin=None, relativize=True):
'Convert any domain names in the rdata to the specified\n relativization.\n '
pass | -780,963,153,621,007,400 | Convert any domain names in the rdata to the specified
relativization. | gcloud/google-cloud-sdk/.install/.backup/lib/third_party/dns/rdata.py | choose_relativity | bopopescu/JobSniperRails | python | def choose_relativity(self, origin=None, relativize=True):
'Convert any domain names in the rdata to the specified\n relativization.\n '
pass |
def get_dicom_info_from_description(dicom_object, return_extra=False, sop_class_name='UNKNOWN'):
'\n Attempts to return some information from a DICOM\n This is typically used for naming converted NIFTI files\n\n Args:\n dicom_object (pydicom.dataset.FileDataset): The DICOM object\n return_ext... | -8,754,313,118,472,001,000 | Attempts to return some information from a DICOM
This is typically used for naming converted NIFTI files
Args:
dicom_object (pydicom.dataset.FileDataset): The DICOM object
return_extra (bool, optional): return information that is usually not required
Returns:
info (str): Some extracted information | platipy/dicom/io/crawl.py | get_dicom_info_from_description | RadiotherapyAI/platipy | python | def get_dicom_info_from_description(dicom_object, return_extra=False, sop_class_name='UNKNOWN'):
'\n Attempts to return some information from a DICOM\n This is typically used for naming converted NIFTI files\n\n Args:\n dicom_object (pydicom.dataset.FileDataset): The DICOM object\n return_ext... |
def safe_sort_dicom_image_list(dicom_image_list):
'\n Sorts a list of DICOM image files based on a DICOM tag value.\n This is a much safer method than reading SliceLocation.\n It takes mandatory DICOM fields (Image Position [Patient]) and (Image Orientation [Patient]).\n The list of DICOM files is sorte... | -7,740,010,041,485,456,000 | Sorts a list of DICOM image files based on a DICOM tag value.
This is a much safer method than reading SliceLocation.
It takes mandatory DICOM fields (Image Position [Patient]) and (Image Orientation [Patient]).
The list of DICOM files is sorted by projecting the image position onto the axis normal to the
place defined... | platipy/dicom/io/crawl.py | safe_sort_dicom_image_list | RadiotherapyAI/platipy | python | def safe_sort_dicom_image_list(dicom_image_list):
'\n Sorts a list of DICOM image files based on a DICOM tag value.\n This is a much safer method than reading SliceLocation.\n It takes mandatory DICOM fields (Image Position [Patient]) and (Image Orientation [Patient]).\n The list of DICOM files is sorte... |
def fix_missing_data(contour_data_list):
'\n Fixes missing points in contouring using simple linear interpolation\n\n\n Args:\n contour_data_list (list): The contour data for each slice\n\n Returns:\n contour_data (numpy array): Interpolated contour data\n '
contour_data = np.array(con... | -7,673,489,679,004,548,000 | Fixes missing points in contouring using simple linear interpolation
Args:
contour_data_list (list): The contour data for each slice
Returns:
contour_data (numpy array): Interpolated contour data | platipy/dicom/io/crawl.py | fix_missing_data | RadiotherapyAI/platipy | python | def fix_missing_data(contour_data_list):
'\n Fixes missing points in contouring using simple linear interpolation\n\n\n Args:\n contour_data_list (list): The contour data for each slice\n\n Returns:\n contour_data (numpy array): Interpolated contour data\n '
contour_data = np.array(con... |
def transform_point_set_from_dicom_struct(image, dicom_struct, spacing_override=False):
'\n This function is used to generate a binary mask from a set of vertices.\n This allows us to convert from DICOM-RTStruct format to any imaging format.\n\n Args:\n image ([SimpleITK.Image]): The image, used to ... | 2,426,919,697,974,402,600 | This function is used to generate a binary mask from a set of vertices.
This allows us to convert from DICOM-RTStruct format to any imaging format.
Args:
image ([SimpleITK.Image]): The image, used to copy imaging information
(e.g. resolution, spacing)
dicom_struct ([pydicom.Dataset]): The DICOM-RTStruc... | platipy/dicom/io/crawl.py | transform_point_set_from_dicom_struct | RadiotherapyAI/platipy | python | def transform_point_set_from_dicom_struct(image, dicom_struct, spacing_override=False):
'\n This function is used to generate a binary mask from a set of vertices.\n This allows us to convert from DICOM-RTStruct format to any imaging format.\n\n Args:\n image ([SimpleITK.Image]): The image, used to ... |
def process_dicom_file_list(dicom_file_list, parent_sorting_field='PatientName', verbose=False):
'\n Organise the DICOM files by the series UID\n '
dicom_series_dict_parent = {}
for (i, dicom_file) in enumerate(sorted(dicom_file_list)):
if (verbose is True):
logger.debug(f' Sortin... | 1,907,774,043,911,735,000 | Organise the DICOM files by the series UID | platipy/dicom/io/crawl.py | process_dicom_file_list | RadiotherapyAI/platipy | python | def process_dicom_file_list(dicom_file_list, parent_sorting_field='PatientName', verbose=False):
'\n \n '
dicom_series_dict_parent = {}
for (i, dicom_file) in enumerate(sorted(dicom_file_list)):
if (verbose is True):
logger.debug(f' Sorting file {i}')
dicom_file = dicom_fi... |
def write_output_data_to_disk(output_data_dict, output_directory='./', output_file_suffix='.nii.gz', overwrite_existing_files=False):
'\n Write output to disk\n '
if (output_data_dict is None):
return
filename_fields = [i for i in output_data_dict.keys() if (i != 'parent_sorting_data')]
pa... | 7,902,782,233,313,389,000 | Write output to disk | platipy/dicom/io/crawl.py | write_output_data_to_disk | RadiotherapyAI/platipy | python | def write_output_data_to_disk(output_data_dict, output_directory='./', output_file_suffix='.nii.gz', overwrite_existing_files=False):
'\n \n '
if (output_data_dict is None):
return
filename_fields = [i for i in output_data_dict.keys() if (i != 'parent_sorting_data')]
parent_sorting_data = ... |
def add_authorized_key(cluster: Cluster, public_key_path: Path) -> None:
'\n Add an authorized key to all nodes in the given cluster.\n '
nodes = {*cluster.masters, *cluster.agents, *cluster.public_agents}
for node in nodes:
node.run(args=['echo', '', '>>', '/root/.ssh/authorized_keys'], shell... | -8,120,650,113,289,150,000 | Add an authorized key to all nodes in the given cluster. | src/dcos_e2e_cli/common/credentials.py | add_authorized_key | dcos/dcos-e2e | python | def add_authorized_key(cluster: Cluster, public_key_path: Path) -> None:
'\n \n '
nodes = {*cluster.masters, *cluster.agents, *cluster.public_agents}
for node in nodes:
node.run(args=['echo', , '>>', '/root/.ssh/authorized_keys'], shell=True)
node.run(args=['echo', public_key_path.read... |
def _convert_auto_ivc_to_conn_name(conns_dict, name):
'\n Convert name of auto_ivc val to promoted input name.\n\n Parameters\n ----------\n conns_dict : dict\n Dictionary of global connections.\n name : str\n Name of auto_ivc to be found.\n\n Returns\n -------\n str\n P... | -3,850,278,917,985,354,000 | Convert name of auto_ivc val to promoted input name.
Parameters
----------
conns_dict : dict
Dictionary of global connections.
name : str
Name of auto_ivc to be found.
Returns
-------
str
Promoted input name. | openmdao/utils/general_utils.py | _convert_auto_ivc_to_conn_name | DKilkenny/OpenMDAO | python | def _convert_auto_ivc_to_conn_name(conns_dict, name):
'\n Convert name of auto_ivc val to promoted input name.\n\n Parameters\n ----------\n conns_dict : dict\n Dictionary of global connections.\n name : str\n Name of auto_ivc to be found.\n\n Returns\n -------\n str\n P... |
def ignore_errors(flag=None):
'\n Disable certain errors that will prevent setup from completing.\n\n Parameters\n ----------\n flag : bool or None\n If not None, set the value of _ignore_errors to this value.\n\n Returns\n -------\n bool\n The current value of _ignore_errors.\n ... | -2,966,108,365,804,464,000 | Disable certain errors that will prevent setup from completing.
Parameters
----------
flag : bool or None
If not None, set the value of _ignore_errors to this value.
Returns
-------
bool
The current value of _ignore_errors. | openmdao/utils/general_utils.py | ignore_errors | DKilkenny/OpenMDAO | python | def ignore_errors(flag=None):
'\n Disable certain errors that will prevent setup from completing.\n\n Parameters\n ----------\n flag : bool or None\n If not None, set the value of _ignore_errors to this value.\n\n Returns\n -------\n bool\n The current value of _ignore_errors.\n ... |
def conditional_error(msg, exc=RuntimeError, category=UserWarning, err=None):
'\n Raise an exception or issue a warning, depending on the value of _ignore_errors.\n\n Parameters\n ----------\n msg : str\n The error/warning message.\n exc : Exception class\n This exception class is used ... | 4,533,055,769,744,363,500 | Raise an exception or issue a warning, depending on the value of _ignore_errors.
Parameters
----------
msg : str
The error/warning message.
exc : Exception class
This exception class is used to create the exception to be raised.
category : warning class
This category is the class of warning to be issued.
e... | openmdao/utils/general_utils.py | conditional_error | DKilkenny/OpenMDAO | python | def conditional_error(msg, exc=RuntimeError, category=UserWarning, err=None):
'\n Raise an exception or issue a warning, depending on the value of _ignore_errors.\n\n Parameters\n ----------\n msg : str\n The error/warning message.\n exc : Exception class\n This exception class is used ... |
@contextmanager
def ignore_errors_context(flag=True):
'\n Set ignore_errors to the given flag in this context.\n\n Parameters\n ----------\n flag : bool\n If not None, set ignore_errors to this value.\n\n Yields\n ------\n None\n '
save = ignore_errors()
ignore_errors(flag)
... | 3,398,623,984,247,056,000 | Set ignore_errors to the given flag in this context.
Parameters
----------
flag : bool
If not None, set ignore_errors to this value.
Yields
------
None | openmdao/utils/general_utils.py | ignore_errors_context | DKilkenny/OpenMDAO | python | @contextmanager
def ignore_errors_context(flag=True):
'\n Set ignore_errors to the given flag in this context.\n\n Parameters\n ----------\n flag : bool\n If not None, set ignore_errors to this value.\n\n Yields\n ------\n None\n '
save = ignore_errors()
ignore_errors(flag)
... |
def simple_warning(msg, category=UserWarning, stacklevel=2):
'\n Display a simple warning message without the annoying extra line showing the warning call.\n\n Parameters\n ----------\n msg : str\n The warning message.\n category : class\n The warning class.\n stacklevel : int\n ... | -5,676,018,800,505,285,000 | Display a simple warning message without the annoying extra line showing the warning call.
Parameters
----------
msg : str
The warning message.
category : class
The warning class.
stacklevel : int
Number of levels up the stack to identify as the warning location. | openmdao/utils/general_utils.py | simple_warning | DKilkenny/OpenMDAO | python | def simple_warning(msg, category=UserWarning, stacklevel=2):
'\n Display a simple warning message without the annoying extra line showing the warning call.\n\n Parameters\n ----------\n msg : str\n The warning message.\n category : class\n The warning class.\n stacklevel : int\n ... |
def ensure_compatible(name, value, shape=None, indices=None):
'\n Make value compatible with the specified shape or the shape of indices.\n\n Parameters\n ----------\n name : str\n The name of the value.\n value : float or list or tuple or ndarray or Iterable\n The value of a variable.\... | -7,353,129,919,173,986,000 | Make value compatible with the specified shape or the shape of indices.
Parameters
----------
name : str
The name of the value.
value : float or list or tuple or ndarray or Iterable
The value of a variable.
shape : int or tuple or list or None
The expected or desired shape of the value.
indices : Indexer o... | openmdao/utils/general_utils.py | ensure_compatible | DKilkenny/OpenMDAO | python | def ensure_compatible(name, value, shape=None, indices=None):
'\n Make value compatible with the specified shape or the shape of indices.\n\n Parameters\n ----------\n name : str\n The name of the value.\n value : float or list or tuple or ndarray or Iterable\n The value of a variable.\... |
def determine_adder_scaler(ref0, ref, adder, scaler):
'\n Determine proper values of adder and scaler based on user arguments.\n\n Adder and Scaler are used internally because the transformation is\n slightly more efficient.\n\n Parameters\n ----------\n ref0 : float or ndarray, optional\n ... | -8,816,729,246,448,999,000 | Determine proper values of adder and scaler based on user arguments.
Adder and Scaler are used internally because the transformation is
slightly more efficient.
Parameters
----------
ref0 : float or ndarray, optional
Value of response variable that scales to 0.0 in the driver.
ref : float or ndarray, optional
... | openmdao/utils/general_utils.py | determine_adder_scaler | DKilkenny/OpenMDAO | python | def determine_adder_scaler(ref0, ref, adder, scaler):
'\n Determine proper values of adder and scaler based on user arguments.\n\n Adder and Scaler are used internally because the transformation is\n slightly more efficient.\n\n Parameters\n ----------\n ref0 : float or ndarray, optional\n ... |
def set_pyoptsparse_opt(optname, fallback=True):
"\n For testing, sets the pyoptsparse optimizer using the given optimizer name.\n\n This may be modified based on the value of OPENMDAO_FORCE_PYOPTSPARSE_OPT.\n This can be used on systems that have SNOPT installed to force them to use\n SLSQP in order to... | -5,513,538,858,391,290,000 | For testing, sets the pyoptsparse optimizer using the given optimizer name.
This may be modified based on the value of OPENMDAO_FORCE_PYOPTSPARSE_OPT.
This can be used on systems that have SNOPT installed to force them to use
SLSQP in order to mimic our test machines on travis and appveyor.
Parameters
----------
optn... | openmdao/utils/general_utils.py | set_pyoptsparse_opt | DKilkenny/OpenMDAO | python | def set_pyoptsparse_opt(optname, fallback=True):
"\n For testing, sets the pyoptsparse optimizer using the given optimizer name.\n\n This may be modified based on the value of OPENMDAO_FORCE_PYOPTSPARSE_OPT.\n This can be used on systems that have SNOPT installed to force them to use\n SLSQP in order to... |
def format_as_float_or_array(name, values, val_if_none=0.0, flatten=False):
'\n Format array option values.\n\n Checks that the given array values are either None, float, or an iterable\n of numeric values. On output all iterables of numeric values are\n converted to a flat np.ndarray. If values is scal... | -1,012,974,045,651,745,500 | Format array option values.
Checks that the given array values are either None, float, or an iterable
of numeric values. On output all iterables of numeric values are
converted to a flat np.ndarray. If values is scalar, it is converted
to float.
Parameters
----------
name : str
The path of the variable relative t... | openmdao/utils/general_utils.py | format_as_float_or_array | DKilkenny/OpenMDAO | python | def format_as_float_or_array(name, values, val_if_none=0.0, flatten=False):
'\n Format array option values.\n\n Checks that the given array values are either None, float, or an iterable\n of numeric values. On output all iterables of numeric values are\n converted to a flat np.ndarray. If values is scal... |
def all_ancestors(pathname, delim='.'):
'\n Return a generator of pathnames of the starting object and all of its parents.\n\n Pathnames are ordered from longest to shortest.\n\n Parameters\n ----------\n pathname : str\n Pathname of starting object.\n delim : str\n Delimiter used to... | -3,061,827,664,611,178,000 | Return a generator of pathnames of the starting object and all of its parents.
Pathnames are ordered from longest to shortest.
Parameters
----------
pathname : str
Pathname of starting object.
delim : str
Delimiter used to split the name.
Yields
------
str | openmdao/utils/general_utils.py | all_ancestors | DKilkenny/OpenMDAO | python | def all_ancestors(pathname, delim='.'):
'\n Return a generator of pathnames of the starting object and all of its parents.\n\n Pathnames are ordered from longest to shortest.\n\n Parameters\n ----------\n pathname : str\n Pathname of starting object.\n delim : str\n Delimiter used to... |
def find_matches(pattern, var_list):
'\n Return list of variable names that match given pattern.\n\n Parameters\n ----------\n pattern : str\n Glob pattern or variable name.\n var_list : list of str\n List of variable names to search for pattern.\n\n Returns\n -------\n list\n ... | 7,818,583,003,261,877,000 | Return list of variable names that match given pattern.
Parameters
----------
pattern : str
Glob pattern or variable name.
var_list : list of str
List of variable names to search for pattern.
Returns
-------
list
Variable names that match pattern. | openmdao/utils/general_utils.py | find_matches | DKilkenny/OpenMDAO | python | def find_matches(pattern, var_list):
'\n Return list of variable names that match given pattern.\n\n Parameters\n ----------\n pattern : str\n Glob pattern or variable name.\n var_list : list of str\n List of variable names to search for pattern.\n\n Returns\n -------\n list\n ... |
def pad_name(name, pad_num=10, quotes=False):
'\n Pad a string so that they all line up when stacked.\n\n Parameters\n ----------\n name : str\n The string to pad.\n pad_num : int\n The number of total spaces the string should take up.\n quotes : bool\n If name should be quote... | -1,679,614,277,903,369,500 | Pad a string so that they all line up when stacked.
Parameters
----------
name : str
The string to pad.
pad_num : int
The number of total spaces the string should take up.
quotes : bool
If name should be quoted.
Returns
-------
str
Padded string. | openmdao/utils/general_utils.py | pad_name | DKilkenny/OpenMDAO | python | def pad_name(name, pad_num=10, quotes=False):
'\n Pad a string so that they all line up when stacked.\n\n Parameters\n ----------\n name : str\n The string to pad.\n pad_num : int\n The number of total spaces the string should take up.\n quotes : bool\n If name should be quote... |
def run_model(prob, ignore_exception=False):
'\n Call `run_model` on problem and capture output.\n\n Parameters\n ----------\n prob : Problem\n An instance of Problem.\n ignore_exception : bool\n Set to True to ignore an exception of any kind.\n\n Returns\n -------\n string\n ... | 1,922,682,566,468,383,700 | Call `run_model` on problem and capture output.
Parameters
----------
prob : Problem
An instance of Problem.
ignore_exception : bool
Set to True to ignore an exception of any kind.
Returns
-------
string
Output from calling `run_model` on the Problem, captured from stdout. | openmdao/utils/general_utils.py | run_model | DKilkenny/OpenMDAO | python | def run_model(prob, ignore_exception=False):
'\n Call `run_model` on problem and capture output.\n\n Parameters\n ----------\n prob : Problem\n An instance of Problem.\n ignore_exception : bool\n Set to True to ignore an exception of any kind.\n\n Returns\n -------\n string\n ... |
def run_driver(prob):
'\n Call `run_driver` on problem and capture output.\n\n Parameters\n ----------\n prob : Problem\n An instance of Problem.\n\n Returns\n -------\n bool\n Failure flag; True if failed to converge, False is successful.\n string\n Output from calling ... | -7,239,618,793,923,645,000 | Call `run_driver` on problem and capture output.
Parameters
----------
prob : Problem
An instance of Problem.
Returns
-------
bool
Failure flag; True if failed to converge, False is successful.
string
Output from calling `run_driver` on the Problem, captured from stdout. | openmdao/utils/general_utils.py | run_driver | DKilkenny/OpenMDAO | python | def run_driver(prob):
'\n Call `run_driver` on problem and capture output.\n\n Parameters\n ----------\n prob : Problem\n An instance of Problem.\n\n Returns\n -------\n bool\n Failure flag; True if failed to converge, False is successful.\n string\n Output from calling ... |
@contextmanager
def printoptions(*args, **kwds):
'\n Context manager for setting numpy print options.\n\n Set print options for the scope of the `with` block, and restore the old\n options at the end. See `numpy.set_printoptions` for the full description of\n available options. If any invalid options ar... | 6,457,766,634,299,743,000 | Context manager for setting numpy print options.
Set print options for the scope of the `with` block, and restore the old
options at the end. See `numpy.set_printoptions` for the full description of
available options. If any invalid options are specified, they will be ignored.
>>> with printoptions(precision=2):
... ... | openmdao/utils/general_utils.py | printoptions | DKilkenny/OpenMDAO | python | @contextmanager
def printoptions(*args, **kwds):
'\n Context manager for setting numpy print options.\n\n Set print options for the scope of the `with` block, and restore the old\n options at the end. See `numpy.set_printoptions` for the full description of\n available options. If any invalid options ar... |
def do_nothing_context():
"\n Do nothing.\n\n Useful when you have a block of code that only requires a context manager sometimes,\n and you don't want to repeat the context managed block.\n\n Returns\n -------\n contextmanager\n A do nothing context manager.\n "
return contextmanage... | 7,486,286,516,754,432,000 | Do nothing.
Useful when you have a block of code that only requires a context manager sometimes,
and you don't want to repeat the context managed block.
Returns
-------
contextmanager
A do nothing context manager. | openmdao/utils/general_utils.py | do_nothing_context | DKilkenny/OpenMDAO | python | def do_nothing_context():
"\n Do nothing.\n\n Useful when you have a block of code that only requires a context manager sometimes,\n and you don't want to repeat the context managed block.\n\n Returns\n -------\n contextmanager\n A do nothing context manager.\n "
return contextmanage... |
def remove_whitespace(s, right=False, left=False):
'\n Remove white-space characters from the given string.\n\n If neither right nor left is specified (the default),\n then all white-space is removed.\n\n Parameters\n ----------\n s : str\n The string to be modified.\n right : bool\n ... | 6,533,136,798,250,963,000 | Remove white-space characters from the given string.
If neither right nor left is specified (the default),
then all white-space is removed.
Parameters
----------
s : str
The string to be modified.
right : bool
If True, remove white-space from the end of the string.
left : bool
If True, remove white-space ... | openmdao/utils/general_utils.py | remove_whitespace | DKilkenny/OpenMDAO | python | def remove_whitespace(s, right=False, left=False):
'\n Remove white-space characters from the given string.\n\n If neither right nor left is specified (the default),\n then all white-space is removed.\n\n Parameters\n ----------\n s : str\n The string to be modified.\n right : bool\n ... |
def str2valid_python_name(s):
'\n Translate a given string into a valid python variable name.\n\n Parameters\n ----------\n s : str\n The string to be translated.\n\n Returns\n -------\n str\n The valid python name string.\n '
return s.translate(_transtab) | 1,932,803,673,183,064,000 | Translate a given string into a valid python variable name.
Parameters
----------
s : str
The string to be translated.
Returns
-------
str
The valid python name string. | openmdao/utils/general_utils.py | str2valid_python_name | DKilkenny/OpenMDAO | python | def str2valid_python_name(s):
'\n Translate a given string into a valid python variable name.\n\n Parameters\n ----------\n s : str\n The string to be translated.\n\n Returns\n -------\n str\n The valid python name string.\n '
return s.translate(_transtab) |
def make_serializable(o):
"\n Recursively convert numpy types to native types for JSON serialization.\n\n This function should NOT be passed into json.dump or json.dumps as the 'default' arg.\n\n Parameters\n ----------\n o : object\n The object to be converted.\n\n Returns\n -------\n ... | -2,465,878,391,897,661,400 | Recursively convert numpy types to native types for JSON serialization.
This function should NOT be passed into json.dump or json.dumps as the 'default' arg.
Parameters
----------
o : object
The object to be converted.
Returns
-------
object
The converted object. | openmdao/utils/general_utils.py | make_serializable | DKilkenny/OpenMDAO | python | def make_serializable(o):
"\n Recursively convert numpy types to native types for JSON serialization.\n\n This function should NOT be passed into json.dump or json.dumps as the 'default' arg.\n\n Parameters\n ----------\n o : object\n The object to be converted.\n\n Returns\n -------\n ... |
def make_serializable_key(o):
"\n Recursively convert numpy types to native types for JSON serialization.\n\n This function is for making serizializable dictionary keys, so no containers.\n This function should NOT be passed into json.dump or json.dumps as the 'default' arg.\n\n Parameters\n --------... | -4,248,340,428,172,972,500 | Recursively convert numpy types to native types for JSON serialization.
This function is for making serizializable dictionary keys, so no containers.
This function should NOT be passed into json.dump or json.dumps as the 'default' arg.
Parameters
----------
o : object
The object to be converted.
Returns
-------
... | openmdao/utils/general_utils.py | make_serializable_key | DKilkenny/OpenMDAO | python | def make_serializable_key(o):
"\n Recursively convert numpy types to native types for JSON serialization.\n\n This function is for making serizializable dictionary keys, so no containers.\n This function should NOT be passed into json.dump or json.dumps as the 'default' arg.\n\n Parameters\n --------... |
def default_noraise(o):
"\n Try to convert some extra types during JSON serialization.\n\n This is intended to be passed to json.dump or json.dumps as the 'default' arg. It will\n attempt to convert values if possible, but if no conversion works, will return\n 'unserializable object (<type>)' instead o... | 1,492,094,519,533,654,000 | Try to convert some extra types during JSON serialization.
This is intended to be passed to json.dump or json.dumps as the 'default' arg. It will
attempt to convert values if possible, but if no conversion works, will return
'unserializable object (<type>)' instead of raising a TypeError.
Parameters
----------
o : o... | openmdao/utils/general_utils.py | default_noraise | DKilkenny/OpenMDAO | python | def default_noraise(o):
"\n Try to convert some extra types during JSON serialization.\n\n This is intended to be passed to json.dump or json.dumps as the 'default' arg. It will\n attempt to convert values if possible, but if no conversion works, will return\n 'unserializable object (<type>)' instead o... |
def make_set(str_data, name=None):
'\n Construct a set containing the specified character strings.\n\n Parameters\n ----------\n str_data : None, str, or list of strs\n Character string(s) to be included in the set.\n\n name : str, optional\n A name to be used in error messages.\n\n ... | 6,344,895,469,572,138,000 | Construct a set containing the specified character strings.
Parameters
----------
str_data : None, str, or list of strs
Character string(s) to be included in the set.
name : str, optional
A name to be used in error messages.
Returns
-------
set
A set of character strings. | openmdao/utils/general_utils.py | make_set | DKilkenny/OpenMDAO | python | def make_set(str_data, name=None):
'\n Construct a set containing the specified character strings.\n\n Parameters\n ----------\n str_data : None, str, or list of strs\n Character string(s) to be included in the set.\n\n name : str, optional\n A name to be used in error messages.\n\n ... |
def match_includes_excludes(name, includes=None, excludes=None):
'\n Check to see if the variable names pass through the includes and excludes filter.\n\n Parameters\n ----------\n name : str\n Name to be checked for match.\n includes : iter of str or None\n Glob patterns for name to in... | 2,588,734,518,395,102,000 | Check to see if the variable names pass through the includes and excludes filter.
Parameters
----------
name : str
Name to be checked for match.
includes : iter of str or None
Glob patterns for name to include in the filtering. None, the default, means
include all.
excludes : iter of str or None
Glob ... | openmdao/utils/general_utils.py | match_includes_excludes | DKilkenny/OpenMDAO | python | def match_includes_excludes(name, includes=None, excludes=None):
'\n Check to see if the variable names pass through the includes and excludes filter.\n\n Parameters\n ----------\n name : str\n Name to be checked for match.\n includes : iter of str or None\n Glob patterns for name to in... |
def match_prom_or_abs(name, prom_name, includes=None, excludes=None):
'\n Check to see if the variable names pass through the includes and excludes filter.\n\n Parameters\n ----------\n name : str\n Unpromoted variable name to be checked for match.\n prom_name : str\n Promoted variable ... | 1,778,470,870,226,834,700 | Check to see if the variable names pass through the includes and excludes filter.
Parameters
----------
name : str
Unpromoted variable name to be checked for match.
prom_name : str
Promoted variable name to be checked for match.
includes : iter of str or None
Glob patterns for name to include in the filter... | openmdao/utils/general_utils.py | match_prom_or_abs | DKilkenny/OpenMDAO | python | def match_prom_or_abs(name, prom_name, includes=None, excludes=None):
'\n Check to see if the variable names pass through the includes and excludes filter.\n\n Parameters\n ----------\n name : str\n Unpromoted variable name to be checked for match.\n prom_name : str\n Promoted variable ... |
def env_truthy(env_var):
"\n Return True if the given environment variable is 'truthy'.\n\n Parameters\n ----------\n env_var : str\n The name of the environment variable.\n\n Returns\n -------\n bool\n True if the specified environment variable is 'truthy'.\n "
return (os.... | 8,997,511,053,205,589,000 | Return True if the given environment variable is 'truthy'.
Parameters
----------
env_var : str
The name of the environment variable.
Returns
-------
bool
True if the specified environment variable is 'truthy'. | openmdao/utils/general_utils.py | env_truthy | DKilkenny/OpenMDAO | python | def env_truthy(env_var):
"\n Return True if the given environment variable is 'truthy'.\n\n Parameters\n ----------\n env_var : str\n The name of the environment variable.\n\n Returns\n -------\n bool\n True if the specified environment variable is 'truthy'.\n "
return (os.... |
def common_subpath(pathnames):
"\n Return the common dotted subpath found in all of the given dotted pathnames.\n\n Parameters\n ----------\n pathnames : iter of str\n Dotted pathnames of systems.\n\n Returns\n -------\n str\n Common dotted subpath. Returns '' if no common subpat... | -4,609,442,889,970,753,000 | Return the common dotted subpath found in all of the given dotted pathnames.
Parameters
----------
pathnames : iter of str
Dotted pathnames of systems.
Returns
-------
str
Common dotted subpath. Returns '' if no common subpath is found. | openmdao/utils/general_utils.py | common_subpath | DKilkenny/OpenMDAO | python | def common_subpath(pathnames):
"\n Return the common dotted subpath found in all of the given dotted pathnames.\n\n Parameters\n ----------\n pathnames : iter of str\n Dotted pathnames of systems.\n\n Returns\n -------\n str\n Common dotted subpath. Returns if no common subpath ... |
def _is_slicer_op(indices):
'\n Check if an indexer contains a slice or ellipsis operator.\n\n Parameters\n ----------\n indices : ndarray\n Indices to check.\n\n Returns\n -------\n bool\n Returns True if indices contains a colon or ellipsis operator.\n '
if isinstance(ind... | 5,967,391,470,871,776,000 | Check if an indexer contains a slice or ellipsis operator.
Parameters
----------
indices : ndarray
Indices to check.
Returns
-------
bool
Returns True if indices contains a colon or ellipsis operator. | openmdao/utils/general_utils.py | _is_slicer_op | DKilkenny/OpenMDAO | python | def _is_slicer_op(indices):
'\n Check if an indexer contains a slice or ellipsis operator.\n\n Parameters\n ----------\n indices : ndarray\n Indices to check.\n\n Returns\n -------\n bool\n Returns True if indices contains a colon or ellipsis operator.\n '
if isinstance(ind... |
def _slice_indices(slicer, arr_size, arr_shape):
'\n Return an index array based on a slice or slice tuple and the array size and shape.\n\n Parameters\n ----------\n slicer : slice or tuple containing slices\n Slice object to slice array\n arr_size : int\n Size of output array\n arr... | 5,302,177,245,538,873,000 | Return an index array based on a slice or slice tuple and the array size and shape.
Parameters
----------
slicer : slice or tuple containing slices
Slice object to slice array
arr_size : int
Size of output array
arr_shape : tuple
Tuple of output array shape
Returns
-------
array
Returns the sliced ind... | openmdao/utils/general_utils.py | _slice_indices | DKilkenny/OpenMDAO | python | def _slice_indices(slicer, arr_size, arr_shape):
'\n Return an index array based on a slice or slice tuple and the array size and shape.\n\n Parameters\n ----------\n slicer : slice or tuple containing slices\n Slice object to slice array\n arr_size : int\n Size of output array\n arr... |
def _prom2ivc_src_name_iter(prom_dict):
'\n Yield keys from prom_dict with promoted input names converted to ivc source names.\n\n Parameters\n ----------\n prom_dict : dict\n Original dict with some promoted paths.\n\n Yields\n ------\n str\n name\n '
for (name, meta) in p... | 690,393,987,370,168,600 | Yield keys from prom_dict with promoted input names converted to ivc source names.
Parameters
----------
prom_dict : dict
Original dict with some promoted paths.
Yields
------
str
name | openmdao/utils/general_utils.py | _prom2ivc_src_name_iter | DKilkenny/OpenMDAO | python | def _prom2ivc_src_name_iter(prom_dict):
'\n Yield keys from prom_dict with promoted input names converted to ivc source names.\n\n Parameters\n ----------\n prom_dict : dict\n Original dict with some promoted paths.\n\n Yields\n ------\n str\n name\n '
for (name, meta) in p... |
def _prom2ivc_src_item_iter(prom_dict):
'\n Yield items from prom_dict with promoted input names converted to ivc source names.\n\n The result is that all names are absolute.\n\n Parameters\n ----------\n prom_dict : dict\n Original dict with some promoted paths.\n\n Yields\n ------\n ... | 6,250,075,840,540,254,000 | Yield items from prom_dict with promoted input names converted to ivc source names.
The result is that all names are absolute.
Parameters
----------
prom_dict : dict
Original dict with some promoted paths.
Yields
------
tuple
name, metadata | openmdao/utils/general_utils.py | _prom2ivc_src_item_iter | DKilkenny/OpenMDAO | python | def _prom2ivc_src_item_iter(prom_dict):
'\n Yield items from prom_dict with promoted input names converted to ivc source names.\n\n The result is that all names are absolute.\n\n Parameters\n ----------\n prom_dict : dict\n Original dict with some promoted paths.\n\n Yields\n ------\n ... |
def _prom2ivc_src_dict(prom_dict):
'\n Convert a dictionary with promoted input names into one with ivc source names.\n\n Parameters\n ----------\n prom_dict : dict\n Original dict with some promoted paths.\n\n Returns\n -------\n dict\n New dict with ivc source pathnames.\n '
... | 1,931,912,990,526,470,100 | Convert a dictionary with promoted input names into one with ivc source names.
Parameters
----------
prom_dict : dict
Original dict with some promoted paths.
Returns
-------
dict
New dict with ivc source pathnames. | openmdao/utils/general_utils.py | _prom2ivc_src_dict | DKilkenny/OpenMDAO | python | def _prom2ivc_src_dict(prom_dict):
'\n Convert a dictionary with promoted input names into one with ivc source names.\n\n Parameters\n ----------\n prom_dict : dict\n Original dict with some promoted paths.\n\n Returns\n -------\n dict\n New dict with ivc source pathnames.\n '
... |
def convert_src_inds(parent_src_inds, parent_src_shape, my_src_inds, my_src_shape):
'\n Compute lower level src_indices based on parent src_indices.\n\n Parameters\n ----------\n parent_src_inds : ndarray\n Parent src_indices.\n parent_src_shape : tuple\n Shape of source expected by par... | 4,043,396,470,340,805,000 | Compute lower level src_indices based on parent src_indices.
Parameters
----------
parent_src_inds : ndarray
Parent src_indices.
parent_src_shape : tuple
Shape of source expected by parent.
my_src_inds : ndarray or fancy index
Src_indices at the current system level, before conversion.
my_src_shape : tuple... | openmdao/utils/general_utils.py | convert_src_inds | DKilkenny/OpenMDAO | python | def convert_src_inds(parent_src_inds, parent_src_shape, my_src_inds, my_src_shape):
'\n Compute lower level src_indices based on parent src_indices.\n\n Parameters\n ----------\n parent_src_inds : ndarray\n Parent src_indices.\n parent_src_shape : tuple\n Shape of source expected by par... |
def shape2tuple(shape):
'\n Return shape as a tuple.\n\n Parameters\n ----------\n shape : int or tuple\n The given shape.\n\n Returns\n -------\n tuple\n The shape as a tuple.\n '
if isinstance(shape, Number):
return (shape,)
elif (shape is None):
retur... | -5,092,143,027,922,796,000 | Return shape as a tuple.
Parameters
----------
shape : int or tuple
The given shape.
Returns
-------
tuple
The shape as a tuple. | openmdao/utils/general_utils.py | shape2tuple | DKilkenny/OpenMDAO | python | def shape2tuple(shape):
'\n Return shape as a tuple.\n\n Parameters\n ----------\n shape : int or tuple\n The given shape.\n\n Returns\n -------\n tuple\n The shape as a tuple.\n '
if isinstance(shape, Number):
return (shape,)
elif (shape is None):
retur... |
def get_connection_owner(system, tgt):
"\n Return (owner, promoted_src, promoted_tgt) for the given connected target.\n\n Note : this is not speedy. It's intended for use only in error messages.\n\n Parameters\n ----------\n system : System\n Any System. The search always goes from the model... | 1,633,914,159,028,749,300 | Return (owner, promoted_src, promoted_tgt) for the given connected target.
Note : this is not speedy. It's intended for use only in error messages.
Parameters
----------
system : System
Any System. The search always goes from the model level down.
tgt : str
Absolute pathname of the target variable.
Returns... | openmdao/utils/general_utils.py | get_connection_owner | DKilkenny/OpenMDAO | python | def get_connection_owner(system, tgt):
"\n Return (owner, promoted_src, promoted_tgt) for the given connected target.\n\n Note : this is not speedy. It's intended for use only in error messages.\n\n Parameters\n ----------\n system : System\n Any System. The search always goes from the model... |
def wing_dbg():
'\n Make import of wingdbstub contingent on value of WING_DBG environment variable.\n\n Also will import wingdbstub from the WINGHOME directory.\n '
if env_truthy('WING_DBG'):
import sys
import os
save = sys.path
new = (sys.path[:] + [os.environ['WINGHOME... | 8,914,793,370,689,681,000 | Make import of wingdbstub contingent on value of WING_DBG environment variable.
Also will import wingdbstub from the WINGHOME directory. | openmdao/utils/general_utils.py | wing_dbg | DKilkenny/OpenMDAO | python | def wing_dbg():
'\n Make import of wingdbstub contingent on value of WING_DBG environment variable.\n\n Also will import wingdbstub from the WINGHOME directory.\n '
if env_truthy('WING_DBG'):
import sys
import os
save = sys.path
new = (sys.path[:] + [os.environ['WINGHOME... |
def __contains__(self, name):
'\n Return if the named object is contained.\n\n Parameters\n ----------\n name : str\n Name of the object being looked up.\n\n Returns\n -------\n bool\n Always returns True.\n '
return True | -8,732,378,914,084,561,000 | Return if the named object is contained.
Parameters
----------
name : str
Name of the object being looked up.
Returns
-------
bool
Always returns True. | openmdao/utils/general_utils.py | __contains__ | DKilkenny/OpenMDAO | python | def __contains__(self, name):
'\n Return if the named object is contained.\n\n Parameters\n ----------\n name : str\n Name of the object being looked up.\n\n Returns\n -------\n bool\n Always returns True.\n '
return True |
def __init__(self, system, vname, use_vec_offset=True):
'\n Initialize the iterator.\n '
self._dist_size = 0
abs2meta = system._var_allprocs_abs2meta['output']
if (vname in abs2meta):
sizes = system._var_sizes['output']
slices = system._outputs.get_slice_dict()
else:
... | -7,698,128,074,785,812,000 | Initialize the iterator. | openmdao/utils/general_utils.py | __init__ | DKilkenny/OpenMDAO | python | def __init__(self, system, vname, use_vec_offset=True):
'\n \n '
self._dist_size = 0
abs2meta = system._var_allprocs_abs2meta['output']
if (vname in abs2meta):
sizes = system._var_sizes['output']
slices = system._outputs.get_slice_dict()
else:
abs2meta = system.... |
def _serial_iter(self):
'\n Iterate over a local non-distributed variable.\n\n Yields\n ------\n int\n Variable index.\n '
(yield from self._inds) | 3,925,686,889,734,001,700 | Iterate over a local non-distributed variable.
Yields
------
int
Variable index. | openmdao/utils/general_utils.py | _serial_iter | DKilkenny/OpenMDAO | python | def _serial_iter(self):
'\n Iterate over a local non-distributed variable.\n\n Yields\n ------\n int\n Variable index.\n '
(yield from self._inds) |
def _dist_iter(self):
'\n Iterate over a distributed variable.\n\n Yields\n ------\n int or None\n Variable index or None if index is not local to this rank.\n '
start = self._start
end = self._end
for i in range(self._dist_size):
if ((i >= start) an... | 3,273,171,553,087,816,700 | Iterate over a distributed variable.
Yields
------
int or None
Variable index or None if index is not local to this rank. | openmdao/utils/general_utils.py | _dist_iter | DKilkenny/OpenMDAO | python | def _dist_iter(self):
'\n Iterate over a distributed variable.\n\n Yields\n ------\n int or None\n Variable index or None if index is not local to this rank.\n '
start = self._start
end = self._end
for i in range(self._dist_size):
if ((i >= start) an... |
def __iter__(self):
'\n Return an iterator.\n\n Returns\n -------\n iterator\n An iterator over our indices.\n '
return self._iter() | 3,586,504,963,431,038,500 | Return an iterator.
Returns
-------
iterator
An iterator over our indices. | openmdao/utils/general_utils.py | __iter__ | DKilkenny/OpenMDAO | python | def __iter__(self):
'\n Return an iterator.\n\n Returns\n -------\n iterator\n An iterator over our indices.\n '
return self._iter() |
def create_network_interfaces(self, **kwargs):
'\n Create a new network interface\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please define a `callback` function\n to be invoked when receiving the response.\n >>> def callback_... | -8,308,409,485,413,751,000 | Create a new network interface
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callback_function(response):
>>> pprint(response)
>>>
>>> thread = api.create_network_interfaces(callba... | purity_fb/purity_fb_1dot3/apis/network_interfaces_api.py | create_network_interfaces | asun-ps/purity_fb_python_client | python | def create_network_interfaces(self, **kwargs):
'\n Create a new network interface\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please define a `callback` function\n to be invoked when receiving the response.\n >>> def callback_... |
def create_network_interfaces_with_http_info(self, **kwargs):
'\n Create a new network interface\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please define a `callback` function\n to be invoked when receiving the response.\n >>... | 6,628,856,100,416,965,000 | Create a new network interface
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callback_function(response):
>>> pprint(response)
>>>
>>> thread = api.create_network_interfaces_with_h... | purity_fb/purity_fb_1dot3/apis/network_interfaces_api.py | create_network_interfaces_with_http_info | asun-ps/purity_fb_python_client | python | def create_network_interfaces_with_http_info(self, **kwargs):
'\n Create a new network interface\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please define a `callback` function\n to be invoked when receiving the response.\n >>... |
def delete_network_interfaces(self, **kwargs):
'\n Delete a network interface\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please define a `callback` function\n to be invoked when receiving the response.\n >>> def callback_func... | -1,217,760,738,808,310,800 | Delete a network interface
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callback_function(response):
>>> pprint(response)
>>>
>>> thread = api.delete_network_interfaces(callback=c... | purity_fb/purity_fb_1dot3/apis/network_interfaces_api.py | delete_network_interfaces | asun-ps/purity_fb_python_client | python | def delete_network_interfaces(self, **kwargs):
'\n Delete a network interface\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please define a `callback` function\n to be invoked when receiving the response.\n >>> def callback_func... |
def delete_network_interfaces_with_http_info(self, **kwargs):
'\n Delete a network interface\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please define a `callback` function\n to be invoked when receiving the response.\n >>> de... | 6,066,101,161,732,652,000 | Delete a network interface
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callback_function(response):
>>> pprint(response)
>>>
>>> thread = api.delete_network_interfaces_with_http_... | purity_fb/purity_fb_1dot3/apis/network_interfaces_api.py | delete_network_interfaces_with_http_info | asun-ps/purity_fb_python_client | python | def delete_network_interfaces_with_http_info(self, **kwargs):
'\n Delete a network interface\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please define a `callback` function\n to be invoked when receiving the response.\n >>> de... |
def list_network_interfaces(self, **kwargs):
"\n List network interfaces\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please define a `callback` function\n to be invoked when receiving the response.\n >>> def callback_function(... | -5,871,237,290,454,569,000 | List network interfaces
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callback_function(response):
>>> pprint(response)
>>>
>>> thread = api.list_network_interfaces(callback=callba... | purity_fb/purity_fb_1dot3/apis/network_interfaces_api.py | list_network_interfaces | asun-ps/purity_fb_python_client | python | def list_network_interfaces(self, **kwargs):
"\n List network interfaces\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please define a `callback` function\n to be invoked when receiving the response.\n >>> def callback_function(... |
def list_network_interfaces_with_http_info(self, **kwargs):
"\n List network interfaces\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please define a `callback` function\n to be invoked when receiving the response.\n >>> def cal... | -8,858,434,167,035,889,000 | List network interfaces
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callback_function(response):
>>> pprint(response)
>>>
>>> thread = api.list_network_interfaces_with_http_info(... | purity_fb/purity_fb_1dot3/apis/network_interfaces_api.py | list_network_interfaces_with_http_info | asun-ps/purity_fb_python_client | python | def list_network_interfaces_with_http_info(self, **kwargs):
"\n List network interfaces\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please define a `callback` function\n to be invoked when receiving the response.\n >>> def cal... |
def update_network_interfaces(self, **kwargs):
'\n Update an existing network interface\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please define a `callback` function\n to be invoked when receiving the response.\n >>> def cal... | -8,657,946,211,867,635,000 | Update an existing network interface
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callback_function(response):
>>> pprint(response)
>>>
>>> thread = api.update_network_interfaces(... | purity_fb/purity_fb_1dot3/apis/network_interfaces_api.py | update_network_interfaces | asun-ps/purity_fb_python_client | python | def update_network_interfaces(self, **kwargs):
'\n Update an existing network interface\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please define a `callback` function\n to be invoked when receiving the response.\n >>> def cal... |
def update_network_interfaces_with_http_info(self, **kwargs):
'\n Update an existing network interface\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please define a `callback` function\n to be invoked when receiving the response.\n ... | -4,722,062,144,713,662,000 | Update an existing network interface
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callback_function(response):
>>> pprint(response)
>>>
>>> thread = api.update_network_interfaces_... | purity_fb/purity_fb_1dot3/apis/network_interfaces_api.py | update_network_interfaces_with_http_info | asun-ps/purity_fb_python_client | python | def update_network_interfaces_with_http_info(self, **kwargs):
'\n Update an existing network interface\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please define a `callback` function\n to be invoked when receiving the response.\n ... |
def main():
' Calls the other functions to test them. '
run_test_first_is_elsewhere_too() | -7,653,343,239,728,754,000 | Calls the other functions to test them. | src/m3_more_nested_loops_in_sequences.py | main | dalesil/19-MoreLoopsWithinLoops | python | def main():
' '
run_test_first_is_elsewhere_too() |
def run_test_largest_number():
' Tests the largest_number function. '
print()
print('-------------------------------------')
print('Testing the LARGEST_NUMBER function:')
print('-------------------------------------')
expected = 13
answer = largest_number([(3, 1, 4), (13, 10, 11, 7... | 7,014,046,524,202,184,000 | Tests the largest_number function. | src/m3_more_nested_loops_in_sequences.py | run_test_largest_number | dalesil/19-MoreLoopsWithinLoops | python | def run_test_largest_number():
' '
print()
print('-------------------------------------')
print('Testing the LARGEST_NUMBER function:')
print('-------------------------------------')
expected = 13
answer = largest_number([(3, 1, 4), (13, 10, 11, 7, 10), [1, 2, 3, 4]])
print('Expecte... |
def largest_number(seq_seq):
'\n Returns the largest number in the subsequences of the given\n sequence of sequences. Returns None if there are NO numbers\n in the subsequences.\n\n For example, if the given argument is:\n [(3, 1, 4),\n (13, 10, 11, 7, 10),\n [1, 2, 3, 4]]\n t... | -447,333,767,110,148,740 | Returns the largest number in the subsequences of the given
sequence of sequences. Returns None if there are NO numbers
in the subsequences.
For example, if the given argument is:
[(3, 1, 4),
(13, 10, 11, 7, 10),
[1, 2, 3, 4]]
then this function returns 13.
As another example, if the given argument is:... | src/m3_more_nested_loops_in_sequences.py | largest_number | dalesil/19-MoreLoopsWithinLoops | python | def largest_number(seq_seq):
'\n Returns the largest number in the subsequences of the given\n sequence of sequences. Returns None if there are NO numbers\n in the subsequences.\n\n For example, if the given argument is:\n [(3, 1, 4),\n (13, 10, 11, 7, 10),\n [1, 2, 3, 4]]\n t... |
def run_test_largest_negative_number():
' Tests the largest_negative_number function. '
print()
print('-------------------------------------------------')
print('Testing the LARGEST_NEGATIVE_NUMBER function:')
print('-------------------------------------------------')
expected = 11
... | 7,173,169,023,766,363,000 | Tests the largest_negative_number function. | src/m3_more_nested_loops_in_sequences.py | run_test_largest_negative_number | dalesil/19-MoreLoopsWithinLoops | python | def run_test_largest_negative_number():
' '
print()
print('-------------------------------------------------')
print('Testing the LARGEST_NEGATIVE_NUMBER function:')
print('-------------------------------------------------')
expected = 11
answer = largest_number([(3, 1, 4), ((- 13), 10,... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.