project_name
stringlengths
6
104
file_name
stringlengths
4
89
full_name
stringlengths
1
102
func_name
stringlengths
1
85
docstring
stringlengths
13
836
docstring_tokens
listlengths
4
122
code
stringlengths
23
39.7k
code_tokens
stringlengths
29
44.6k
url
int64
3
986k
google-research/tensor2robot
train_eval_test.py
TrainEvalTest.test_train_eval_model
test_train_eval_model
Tests that a simple model trains and exported models are valid.
[ "Tests", "that", "a", "simple", "model", "trains", "and", "exported", "models", "are", "valid." ]
def test_train_eval_model(self): gin.bind_parameter('tf.estimator.RunConfig.save_checkpoints_steps', 100) model_dir = self.create_tempdir().full_path mock_t2r_model = mocks.MockT2RModel(preprocessor_cls=noop_preprocessor.NoOpPreprocessor) mock_input_generator_train = mocks.MockInputGenerator(batch_size=...
['def', 'test_train_eval_model(self):', "gin.bind_parameter('tf.estimator.RunConfig.save_checkpoints_steps',", '100)', 'model_dir', '=', 'self.create_tempdir().full_path', 'mock_t2r_model', '=', 'mocks.MockT2RModel(preprocessor_cls=noop_preprocessor.NoOpPreprocessor)', 'mock_input_generator_train', '=', 'mocks.MockInpu...
908,524
google-research/tensor2robot
train_eval_test.py
TrainEvalTest.test_freezing_some_variables
test_freezing_some_variables
Tests we can freeze training for parts of the network.
[ "Tests", "we", "can", "freeze", "training", "for", "parts", "of", "the", "network." ]
def test_freezing_some_variables(self): def freeze_biases(var): return 'bias' not in var.name gin.bind_parameter('tf.estimator.RunConfig.save_checkpoints_steps', 100) gin.bind_parameter('create_train_op.filter_trainables_fn', freeze_biases) model_dir = self.create_tempdir().full_path mock_t...
['def', 'test_freezing_some_variables(self):', 'def', 'freeze_biases(var):', 'return', "'bias'", 'not', 'in', 'var.name', "gin.bind_parameter('tf.estimator.RunConfig.save_checkpoints_steps',", '100)', "gin.bind_parameter('create_train_op.filter_trainables_fn',", 'freeze_biases)', 'model_dir', '=', 'self.create_tempdir(...
908,527
google-research/tensor2robot
train_eval_test_utils.py
assert_output_files
assert_output_files
Verify that the expected output files are generated.
[ "Verify", "that", "the", "expected", "output", "files", "are", "generated." ]
def assert_output_files(test_case, model_dir, expected_output_filename_patterns=None): if expected_output_filename_patterns is None: expected_output_filename_patterns = DEFAULT_TRAIN_FILENAME_PATTERNS + DEFAULT_EVAL_FILENAME_PATTERNS for pattern in expected_output_filename_patterns: filename_pat...
['def', 'assert_output_files(test_case,', 'model_dir,', 'expected_output_filename_patterns=None):', 'if', 'expected_output_filename_patterns', 'is', 'None:', 'expected_output_filename_patterns', '=', 'DEFAULT_TRAIN_FILENAME_PATTERNS', '+', 'DEFAULT_EVAL_FILENAME_PATTERNS', 'for', 'pattern', 'in', 'expected_output_filen...
908,528
Hourout/tensorcv
_image_ops.py
RandomTranspose
RandomTranspose
Transpose image(s) by swapping the height and width dimension.
[ "Transpose", "image(s)", "by", "swapping", "the", "height", "and", "width", "dimension." ]
def RandomTranspose(image, random=True, seed=None): assert isinstance(random, bool), 'random should be bool type.' if random: r = tf.random.uniform([2], 0, 1, seed=seed) image = tf.case([(tf.less(r[0], r[1]), lambda : tf.image.transpose_image(image))], default=lambda : image) else: i...
['def', 'RandomTranspose(image,', 'random=True,', 'seed=None):', 'assert', 'isinstance(random,', 'bool),', "'random", 'should', 'be', 'bool', "type.'", 'if', 'random:', 'r', '=', 'tf.random.uniform([2],', '0,', '1,', 'seed=seed)', 'image', '=', 'tf.case([(tf.less(r[0],', 'r[1]),', 'lambda', ':', 'tf.image.transpose_ima...
908,549
Hourout/tensorcv
_losses.py
hard_sigmoid_cross_entropy
hard_sigmoid_cross_entropy
Computes hard sigmoid cross entropy given `logits`.
[ "Computes", "hard", "sigmoid", "cross", "entropy", "given", "`logits`." ]
def hard_sigmoid_cross_entropy(labels, logits, from_logits=False): if from_logits: output = K.hard_sigmoid(logist) epsilon_ = tf.convert_to_tensor(K.epsilon(), output.dtype.base_dtype) output = tf.clip_by_value(output, epsilon_, 1 - epsilon_) a = tf.math.subtract(labels, tf.math.multiply(-1, tf....
['def', 'hard_sigmoid_cross_entropy(labels,', 'logits,', 'from_logits=False):', 'if', 'from_logits:', 'output', '=', 'K.hard_sigmoid(logist)', 'epsilon_', '=', 'tf.convert_to_tensor(K.epsilon(),', 'output.dtype.base_dtype)', 'output', '=', 'tf.clip_by_value(output,', 'epsilon_,', '1', '-', 'epsilon_)', 'a', '=', 'tf.ma...
908,560
guoguo12/tensorflow-fcwta
models.py
FullyConnectedWTA.step
step
Run a step of the model, feeding the given inputs.
[ "Run", "a", "step", "of", "the", "model,", "feeding", "the", "given", "inputs." ]
def step(self, session, input, forward_only=False): if input.shape[0] != self.batch_size: raise ValueError('Input batch size must equal the batch_size provided in the constructor, {} != {}.'.format(input.shape[0], self.batch_size)) if input.shape[1] != self.input_dim: raise ValueError('Dimension...
['def', 'step(self,', 'session,', 'input,', 'forward_only=False):', 'if', 'input.shape[0]', '!=', 'self.batch_size:', 'raise', "ValueError('Input", 'batch', 'size', 'must', 'equal', 'the', 'batch_size', 'provided', 'in', 'the', 'constructor,', '{}', '!=', "{}.'.format(input.shape[0],", 'self.batch_size))', 'if', 'input...
908,617
guoguo12/tensorflow-fcwta
util.py
timestamp
timestamp
Returns the current time as a string.
[ "Returns", "the", "current", "time", "as", "a", "string." ]
def timestamp(format='%Y_%m_%d_%H_%M_%S'): return datetime.datetime.now().strftime(format)
['def', "timestamp(format='%Y_%m_%d_%H_%M_%S'):", 'return', 'datetime.datetime.now().strftime(format)']
908,620
guoguo12/tensorflow-fcwta
util.py
plot_dictionary
plot_dictionary
Plots the code dictionary.
[ "Plots", "the", "code", "dictionary." ]
def plot_dictionary(dictionary, shape, num_shown=20, row_length=10): rows = num_shown / row_length for (i, image) in enumerate(dictionary[:num_shown]): plt.subplot(rows, row_length, i + 1) plt.axis('off') plt.imshow(image.reshape(shape), cmap=plt.cm.gray) plt.show()
['def', 'plot_dictionary(dictionary,', 'shape,', 'num_shown=20,', 'row_length=10):', 'rows', '=', 'num_shown', '/', 'row_length', 'for', '(i,', 'image)', 'in', 'enumerate(dictionary[:num_shown]):', 'plt.subplot(rows,', 'row_length,', 'i', '+', '1)', "plt.axis('off')", 'plt.imshow(image.reshape(shape),', 'cmap=plt.cm.gr...
908,621
guoguo12/tensorflow-fcwta
util.py
plot_reconstruction
plot_reconstruction
Plots reconstructed images below the ground truth images.
[ "Plots", "reconstructed", "images", "below", "the", "ground", "truth", "images." ]
def plot_reconstruction(truth, reconstructed, shape, num_shown=10): for (i, image) in enumerate(truth[:num_shown]): plt.subplot(2, num_shown, i + 1) plt.axis('off') plt.imshow(image.reshape(shape), cmap=plt.cm.gray) for (i, image) in enumerate(reconstructed[:num_shown]): plt.subp...
['def', 'plot_reconstruction(truth,', 'reconstructed,', 'shape,', 'num_shown=10):', 'for', '(i,', 'image)', 'in', 'enumerate(truth[:num_shown]):', 'plt.subplot(2,', 'num_shown,', 'i', '+', '1)', "plt.axis('off')", 'plt.imshow(image.reshape(shape),', 'cmap=plt.cm.gray)', 'for', '(i,', 'image)', 'in', 'enumerate(reconstr...
908,622
guoguo12/tensorflow-fcwta
util.py
plot_tsne
plot_tsne
Plots a t-SNE visualization of the given data.
[ "Plots", "a", "t-SNE", "visualization", "of", "the", "given", "data." ]
def plot_tsne(X, labels): if X.shape[1] > 50: X = sklearn.decomposition.PCA(50).fit_transform(X) X = sklearn.manifold.TSNE(learning_rate=200).fit_transform(X) plt.scatter(X[:, 0], X[:, 1], c=labels, cmap=plt.cm.viridis) plt.show()
['def', 'plot_tsne(X,', 'labels):', 'if', 'X.shape[1]', '>', '50:', 'X', '=', 'sklearn.decomposition.PCA(50).fit_transform(X)', 'X', '=', 'sklearn.manifold.TSNE(learning_rate=200).fit_transform(X)', 'plt.scatter(X[:,', '0],', 'X[:,', '1],', 'c=labels,', 'cmap=plt.cm.viridis)', 'plt.show()']
908,623
guoguo12/tensorflow-fcwta
util.py
svm_acc
svm_acc
Trains and evaluates a linear SVM with the given data and C value.
[ "Trains", "and", "evaluates", "a", "linear", "SVM", "with", "the", "given", "data", "and", "C", "value." ]
def svm_acc(X_train, y_train, X_test, y_test, C): clf = sklearn.svm.LinearSVC(C=C, random_state=1) clf.fit(X_train, y_train) y_pred = clf.predict(X_test) return (accuracy_score(y_test, y_pred), confusion_matrix(y_test, y_pred))
['def', 'svm_acc(X_train,', 'y_train,', 'X_test,', 'y_test,', 'C):', 'clf', '=', 'sklearn.svm.LinearSVC(C=C,', 'random_state=1)', 'clf.fit(X_train,', 'y_train)', 'y_pred', '=', 'clf.predict(X_test)', 'return', '(accuracy_score(y_test,', 'y_pred),', 'confusion_matrix(y_test,', 'y_pred))']
908,624
chansoopark98/Tensorflow-Keras-Semantic-
augment_data.py
ImageAugmentationLoader.plot_images
plot_images
Image and mask plotting on screen function.
[ "Image", "and", "mask", "plotting", "on", "screen", "function." ]
def plot_images(self, rgb: np.ndarray, mask: np.ndarray): rows = 1 cols = 3 if len(mask.shape) == 2: mask = np.expand_dims(mask, axis=-1) rgb = rgb.astype(np.uint8) mask = mask.astype(np.uint8) fig = plt.figure() ax0 = fig.add_subplot(rows, cols, 1) ax0.imshow(rgb) ax0.set_ti...
['def', 'plot_images(self,', 'rgb:', 'np.ndarray,', 'mask:', 'np.ndarray):', 'rows', '=', '1', 'cols', '=', '3', 'if', 'len(mask.shape)', '==', '2:', 'mask', '=', 'np.expand_dims(mask,', 'axis=-1)', 'rgb', '=', 'rgb.astype(np.uint8)', 'mask', '=', 'mask.astype(np.uint8)', 'fig', '=', 'plt.figure()', 'ax0', '=', 'fig.ad...
908,675
chansoopark98/Tensorflow-Keras-Semantic-
EfficientNetV2.py
batchnorm_with_activation
batchnorm_with_activation
Performs a batch normalization followed by an activation.
[ "Performs", "a", "batch", "normalization", "followed", "by", "an", "activation." ]
def batchnorm_with_activation(inputs, activation='swish', use_torch_eps=False, name=''): bn_axis = 1 if K.image_data_format() == 'channels_first' else -1 nn = BatchNormalization(axis=bn_axis, momentum=BATCH_NORM_DECAY, epsilon=TORCH_BATCH_NORM_EPSILON if use_torch_eps else BATCH_NORM_EPSILON, name=name + 'bn')(...
['def', 'batchnorm_with_activation(inputs,', "activation='swish',", 'use_torch_eps=False,', "name=''):", 'bn_axis', '=', '1', 'if', 'K.image_data_format()', '==', "'channels_first'", 'else', '-1', 'nn', '=', 'BatchNormalization(axis=bn_axis,', 'momentum=BATCH_NORM_DECAY,', 'epsilon=TORCH_BATCH_NORM_EPSILON', 'if', 'use...
908,685
chansoopark98/Tensorflow-Keras-Semantic-
load_semantic_datasets.py
SemanticGenerator.preprocess_valid
preprocess_valid
This is a data processing mapping function to be used in the validation step during training.
[ "This", "is", "a", "data", "processing", "mapping", "function", "to", "be", "used", "in", "the", "validation", "step", "during", "training." ]
def preprocess_valid(self, sample: dict) -> Union[tf.Tensor, tf.Tensor]: (img, labels) = self.prepare_data(sample) img = tf.image.resize(img, size=(self.image_size[0], self.image_size[1]), method=tf.image.ResizeMethod.BILINEAR) labels = tf.image.resize(labels, size=(self.image_size[0], self.image_size[1]), ...
['def', 'preprocess_valid(self,', 'sample:', 'dict)', '->', 'Union[tf.Tensor,', 'tf.Tensor]:', '(img,', 'labels)', '=', 'self.prepare_data(sample)', 'img', '=', 'tf.image.resize(img,', 'size=(self.image_size[0],', 'self.image_size[1]),', 'method=tf.image.ResizeMethod.BILINEAR)', 'labels', '=', 'tf.image.resize(labels,'...
908,691
Hironsan/tensorflow-nlp-examples
char_lstm.py
save_text
save_text
Save text line by line.
[ "Save", "text", "line", "by", "line." ]
def save_text(lines, filename): with open(filename, 'w') as f: f.write('\n'.join(lines))
['def', 'save_text(lines,', 'filename):', 'with', 'open(filename,', "'w')", 'as', 'f:', "f.write('\\n'.join(lines))"]
908,706
Hironsan/tensorflow-nlp-examples
char_lstm.py
generate_text
generate_text
Generate a sequence of characters.
[ "Generate", "a", "sequence", "of", "characters." ]
def generate_text(model, char2id, id2char, seed_text, maxlen=10, iter=20): encoded = [char2id[char] for char in seed_text] for _ in range(iter): x = pad_sequences([encoded], maxlen=maxlen, truncating='pre') y = model.predict_classes(x, verbose=0) encoded.append(y[0]) decoded = [id2ch...
['def', 'generate_text(model,', 'char2id,', 'id2char,', 'seed_text,', 'maxlen=10,', 'iter=20):', 'encoded', '=', '[char2id[char]', 'for', 'char', 'in', 'seed_text]', 'for', '_', 'in', 'range(iter):', 'x', '=', 'pad_sequences([encoded],', 'maxlen=maxlen,', "truncating='pre')", 'y', '=', 'model.predict_classes(x,', 'verb...
908,707
thien/stereo.vision
functions.py
computePlanarThreshold
computePlanarThreshold
Discards points on the disparity where it is not within the plane.
[ "Discards", "points", "on", "the", "disparity", "where", "it", "is", "not", "within", "the", "plane." ]
def computePlanarThreshold(points, differences, threshold=0.01): new_points = [] for i in range(len(points)): if differences[i] < threshold: new_points.append(points[i]) return new_points
['def', 'computePlanarThreshold(points,', 'differences,', 'threshold=0.01):', 'new_points', '=', '[]', 'for', 'i', 'in', 'range(len(points)):', 'if', 'differences[i]', '<', 'threshold:', 'new_points.append(points[i])', 'return', 'new_points']
908,719
lingyunwu14/STFT
inference.py
STFTFCOSPostProcessor.forward
forward
Returns: results (List[Instances]): a list of #images elements.
[ "Returns:", "results", "(List[Instances]):", "a", "list", "of", "#images", "elements." ]
def forward(self, shifts, box_cls, box_center, stft_box_cls, stft_box_delta, stft_based_box, image_sizes): results = [] box_cls = [permute_to_N_HWA_K(x, self.num_classes) for x in box_cls] box_center = [permute_to_N_HWA_K(x, 1) for x in box_center] stft_box_cls = [permute_to_N_HWA_K(x, self.num_classes)...
['def', 'forward(self,', 'shifts,', 'box_cls,', 'box_center,', 'stft_box_cls,', 'stft_box_delta,', 'stft_based_box,', 'image_sizes):', 'results', '=', '[]', 'box_cls', '=', '[permute_to_N_HWA_K(x,', 'self.num_classes)', 'for', 'x', 'in', 'box_cls]', 'box_center', '=', '[permute_to_N_HWA_K(x,', '1)', 'for', 'x', 'in', '...
908,792
Leci37/stocks-prediction-Machine-learning-RealTime-TensorFlow
LTSM_WindowGenerator.py
WindowGenerator.example
example
Get and cache an example batch of `inputs, labels` for plotting.
[ "Get", "and", "cache", "an", "example", "batch", "of", "`inputs,", "labels`", "for", "plotting." ]
def example(self): result = getattr(self, '_example', None) if result is None: result = next(iter(self.train)) self._example = result return result
['def', 'example(self):', 'result', '=', 'getattr(self,', "'_example',", 'None)', 'if', 'result', 'is', 'None:', 'result', '=', 'next(iter(self.train))', 'self._example', '=', 'result', 'return', 'result']
908,968
2729StormRobotics/StormCV2017
grip.py
GripPipeline.process
process
Runs the pipeline and sets all outputs to new values.
[ "Runs", "the", "pipeline", "and", "sets", "all", "outputs", "to", "new", "values." ]
def process(self, source0): self.__desaturate_input = source0 self.desaturate_output = self.__desaturate(self.__desaturate_input)
['def', 'process(self,', 'source0):', 'self.__desaturate_input', '=', 'source0', 'self.desaturate_output', '=', 'self.__desaturate(self.__desaturate_input)']
908,976
meidachen/STPLS3D
test_builtin_casters.py
test_unicode_conversion
test_unicode_conversion
Tests unicode conversion and error reporting.
[ "Tests", "unicode", "conversion", "and", "error", "reporting." ]
def test_unicode_conversion(): assert m.good_utf8_string() == u'Say utf8âÂ\x80½ ðÂ\x9fÂ\x8eÂ\x82 ðÂ\x9dÂ\x90Â\x80' assert m.good_utf16_string() == u'bâÂ\x80½ðÂ\x9fÂ\x8eÂ\x82ðÂ\x9dÂ\x90Â\x80z' assert m.good_utf32_string() == u'aðÂ\x9dÂ\x90Â\x80ðÂ\x9fÂ\x8eÂ\x82âÂ\x80½z' assert m.good_wchar_str...
['def', 'test_unicode_conversion():', 'assert', 'm.good_utf8_string()', '==', "u'Say", 'utf8âÂ\\x80½', 'ðÂ\\x9fÂ\\x8eÂ\\x82', "ðÂ\\x9dÂ\\x90Â\\x80'", 'assert', 'm.good_utf16_string()', '==', "u'bâÂ\\x80½ðÂ\\x9fÂ\\x8eÂ\\x82ðÂ\\x9dÂ\\x90Â\\x80z'", 'assert', 'm.good_utf32_string()', '==', "u'aðÂ\\x9dÂ\\x90Â\\x80Ã...
909,009
meidachen/STPLS3D
test_builtin_casters.py
test_bool_caster
test_bool_caster
Test bool caster implicit conversions.
[ "Test", "bool", "caster", "implicit", "conversions." ]
def test_bool_caster(): (convert, noconvert) = (m.bool_passthrough, m.bool_passthrough_noconvert) def require_implicit(v): pytest.raises(TypeError, noconvert, v) def cant_convert(v): pytest.raises(TypeError, convert, v) assert convert(True) is True assert convert(False) is False ...
['def', 'test_bool_caster():', '(convert,', 'noconvert)', '=', '(m.bool_passthrough,', 'm.bool_passthrough_noconvert)', 'def', 'require_implicit(v):', 'pytest.raises(TypeError,', 'noconvert,', 'v)', 'def', 'cant_convert(v):', 'pytest.raises(TypeError,', 'convert,', 'v)', 'assert', 'convert(True)', 'is', 'True', 'assert...
909,018
meidachen/STPLS3D
test_copy_move.py
test_move_and_copy_casts
test_move_and_copy_casts
Cast some values in C++ via custom type casters and count the number of moves/copies.
[ "Cast", "some", "values", "in", "C++", "via", "custom", "type", "casters", "and", "count", "the", "number", "of", "moves/copies." ]
def test_move_and_copy_casts(): cstats = m.move_and_copy_cstats() (c_m, c_mc, c_c) = (cstats['MoveOnlyInt'], cstats['MoveOrCopyInt'], cstats['CopyOnlyInt']) assert m.move_and_copy_casts(3) == 18 assert c_m.copy_assignments + c_m.copy_constructions == 0 assert c_m.move_assignments == 2 assert c_m...
['def', 'test_move_and_copy_casts():', 'cstats', '=', 'm.move_and_copy_cstats()', '(c_m,', 'c_mc,', 'c_c)', '=', "(cstats['MoveOnlyInt'],", "cstats['MoveOrCopyInt'],", "cstats['CopyOnlyInt'])", 'assert', 'm.move_and_copy_casts(3)', '==', '18', 'assert', 'c_m.copy_assignments', '+', 'c_m.copy_constructions', '==', '0', ...
909,028
meidachen/STPLS3D
test_copy_move.py
test_move_and_copy_loads
test_move_and_copy_loads
Call some functions that load arguments via custom type casters and count the number of moves/copies.
[ "Call", "some", "functions", "that", "load", "arguments", "via", "custom", "type", "casters", "and", "count", "the", "number", "of", "moves/copies." ]
def test_move_and_copy_loads(): cstats = m.move_and_copy_cstats() (c_m, c_mc, c_c) = (cstats['MoveOnlyInt'], cstats['MoveOrCopyInt'], cstats['CopyOnlyInt']) assert m.move_only(10) == 10 assert m.move_or_copy(11) == 11 assert m.copy_only(12) == 12 assert m.move_pair((13, 14)) == 27 assert m.m...
['def', 'test_move_and_copy_loads():', 'cstats', '=', 'm.move_and_copy_cstats()', '(c_m,', 'c_mc,', 'c_c)', '=', "(cstats['MoveOnlyInt'],", "cstats['MoveOrCopyInt'],", "cstats['CopyOnlyInt'])", 'assert', 'm.move_only(10)', '==', '10', 'assert', 'm.move_or_copy(11)', '==', '11', 'assert', 'm.copy_only(12)', '==', '12', ...
909,029
meidachen/STPLS3D
test_methods_and_attributes.py
test_custom_caster_destruction
test_custom_caster_destruction
Tests that returning a pointer to a type that gets converted with a custom type caster gets destroyed when the function has py::return_value_policy::take_ownership policy applied.
[ "Tests", "that", "returning", "a", "pointer", "to", "a", "type", "that", "gets", "converted", "with", "a", "custom", "type", "caster", "gets", "destroyed", "when", "the", "function", "has", "py::return_value_policy::take_ownership", "policy", "applied." ]
def test_custom_caster_destruction(): cstats = m.destruction_tester_cstats() z = m.custom_caster_no_destroy() assert cstats.alive() == 1 and cstats.default_constructions == 1 assert z z = m.custom_caster_destroy() assert z assert cstats.default_constructions == 2 z = m.custom_caster_dest...
['def', 'test_custom_caster_destruction():', 'cstats', '=', 'm.destruction_tester_cstats()', 'z', '=', 'm.custom_caster_no_destroy()', 'assert', 'cstats.alive()', '==', '1', 'and', 'cstats.default_constructions', '==', '1', 'assert', 'z', 'z', '=', 'm.custom_caster_destroy()', 'assert', 'z', 'assert', 'cstats.default_c...
909,067
meidachen/STPLS3D
test_pytypes.py
test_implicit_casting
test_implicit_casting
Tests implicit casting when assigning or appending to dicts and lists.
[ "Tests", "implicit", "casting", "when", "assigning", "or", "appending", "to", "dicts", "and", "lists." ]
def test_implicit_casting(): z = m.get_implicit_casting() assert z['d'] == {'char*_i1': 'abc', 'char*_i2': 'abc', 'char*_e': 'abc', 'char*_p': 'abc', 'str_i1': 'str', 'str_i2': 'str1', 'str_e': 'str2', 'str_p': 'str3', 'int_i1': 42, 'int_i2': 42, 'int_e': 43, 'int_p': 44} assert z['l'] == [3, 6, 9, 12, 15]
['def', 'test_implicit_casting():', 'z', '=', 'm.get_implicit_casting()', 'assert', "z['d']", '==', "{'char*_i1':", "'abc',", "'char*_i2':", "'abc',", "'char*_e':", "'abc',", "'char*_p':", "'abc',", "'str_i1':", "'str',", "'str_i2':", "'str1',", "'str_e':", "'str2',", "'str_p':", "'str3',", "'int_i1':", '42,', "'int_i2...
909,079
meidachen/STPLS3D
cindex.py
SourceLocation.from_position
from_position
Retrieve the source location associated with a given file/line/column in a particular translation unit.
[ "Retrieve", "the", "source", "location", "associated", "with", "a", "given", "file/line/column", "in", "a", "particular", "translation", "unit." ]
def from_position(tu, file, line, column): return conf.lib.clang_getLocation(tu, file, line, column)
['def', 'from_position(tu,', 'file,', 'line,', 'column):', 'return', 'conf.lib.clang_getLocation(tu,', 'file,', 'line,', 'column)']
909,096
meidachen/STPLS3D
cindex.py
SourceLocation.line
line
Get the line represented by this source location.
[ "Get", "the", "line", "represented", "by", "this", "source", "location." ]
def line(self): return self._get_instantiation()[1]
['def', 'line(self):', 'return', 'self._get_instantiation()[1]']
909,099
meidachen/STPLS3D
cindex.py
SourceLocation.column
column
Get the column represented by this source location.
[ "Get", "the", "column", "represented", "by", "this", "source", "location." ]
def column(self): return self._get_instantiation()[2]
['def', 'column(self):', 'return', 'self._get_instantiation()[2]']
909,100
meidachen/STPLS3D
cindex.py
SourceRange.end
end
Return a SourceLocation representing the last character within a source range.
[ "Return", "a", "SourceLocation", "representing", "the", "last", "character", "within", "a", "source", "range." ]
def end(self): return conf.lib.clang_getRangeEnd(self)
['def', 'end(self):', 'return', 'conf.lib.clang_getRangeEnd(self)']
909,103
meidachen/STPLS3D
cindex.py
Diagnostic.category_number
category_number
The category number for this diagnostic or 0 if unavailable.
[ "The", "category", "number", "for", "this", "diagnostic", "or", "0", "if", "unavailable." ]
def category_number(self): return conf.lib.clang_getDiagnosticCategory(self)
['def', 'category_number(self):', 'return', 'conf.lib.clang_getDiagnosticCategory(self)']
909,104
meidachen/STPLS3D
cindex.py
Diagnostic.category_name
category_name
The string name of the category for this diagnostic.
[ "The", "string", "name", "of", "the", "category", "for", "this", "diagnostic." ]
def category_name(self): return conf.lib.clang_getDiagnosticCategoryText(self)
['def', 'category_name(self):', 'return', 'conf.lib.clang_getDiagnosticCategoryText(self)']
909,105
meidachen/STPLS3D
cindex.py
Diagnostic.option
option
The command-line option that enables this diagnostic.
[ "The", "command-line", "option", "that", "enables", "this", "diagnostic." ]
def option(self): return conf.lib.clang_getDiagnosticOption(self, None)
['def', 'option(self):', 'return', 'conf.lib.clang_getDiagnosticOption(self,', 'None)']
909,106
meidachen/STPLS3D
cindex.py
Diagnostic.disable_option
disable_option
The command-line option that disables this diagnostic.
[ "The", "command-line", "option", "that", "disables", "this", "diagnostic." ]
def disable_option(self): disable = _CXString() conf.lib.clang_getDiagnosticOption(self, byref(disable)) return conf.lib.clang_getCString(disable)
['def', 'disable_option(self):', 'disable', '=', '_CXString()', 'conf.lib.clang_getDiagnosticOption(self,', 'byref(disable))', 'return', 'conf.lib.clang_getCString(disable)']
909,107
meidachen/STPLS3D
cindex.py
TokenKind.from_value
from_value
Obtain a registered TokenKind instance from its value.
[ "Obtain", "a", "registered", "TokenKind", "instance", "from", "its", "value." ]
def from_value(value): result = TokenKind._value_map.get(value, None) if result is None: raise ValueError('Unknown TokenKind: %d' % value) return result
['def', 'from_value(value):', 'result', '=', 'TokenKind._value_map.get(value,', 'None)', 'if', 'result', 'is', 'None:', 'raise', "ValueError('Unknown", 'TokenKind:', "%d'", '%', 'value)', 'return', 'result']
909,109
meidachen/STPLS3D
cindex.py
BaseEnumeration.name
name
Get the enumeration name of this cursor kind.
[ "Get", "the", "enumeration", "name", "of", "this", "cursor", "kind." ]
def name(self): if self._name_map is None: self._name_map = {} for (key, value) in list(self.__class__.__dict__.items()): if isinstance(value, self.__class__): self._name_map[value] = key return self._name_map[self]
['def', 'name(self):', 'if', 'self._name_map', 'is', 'None:', 'self._name_map', '=', '{}', 'for', '(key,', 'value)', 'in', 'list(self.__class__.__dict__.items()):', 'if', 'isinstance(value,', 'self.__class__):', 'self._name_map[value]', '=', 'key', 'return', 'self._name_map[self]']
909,111
meidachen/STPLS3D
cindex.py
CursorKind.is_reference
is_reference
Test if this is a reference kind.
[ "Test", "if", "this", "is", "a", "reference", "kind." ]
def is_reference(self): return conf.lib.clang_isReference(self)
['def', 'is_reference(self):', 'return', 'conf.lib.clang_isReference(self)']
909,114
meidachen/STPLS3D
cindex.py
CursorKind.is_attribute
is_attribute
Test if this is an attribute kind.
[ "Test", "if", "this", "is", "an", "attribute", "kind." ]
def is_attribute(self): return conf.lib.clang_isAttribute(self)
['def', 'is_attribute(self):', 'return', 'conf.lib.clang_isAttribute(self)']
909,117
meidachen/STPLS3D
cindex.py
CursorKind.is_invalid
is_invalid
Test if this is an invalid kind.
[ "Test", "if", "this", "is", "an", "invalid", "kind." ]
def is_invalid(self): return conf.lib.clang_isInvalid(self)
['def', 'is_invalid(self):', 'return', 'conf.lib.clang_isInvalid(self)']
909,118
meidachen/STPLS3D
cindex.py
CursorKind.is_translation_unit
is_translation_unit
Test if this is a translation unit kind.
[ "Test", "if", "this", "is", "a", "translation", "unit", "kind." ]
def is_translation_unit(self): return conf.lib.clang_isTranslationUnit(self)
['def', 'is_translation_unit(self):', 'return', 'conf.lib.clang_isTranslationUnit(self)']
909,119
meidachen/STPLS3D
cindex.py
CursorKind.is_preprocessing
is_preprocessing
Test if this is a preprocessing kind.
[ "Test", "if", "this", "is", "a", "preprocessing", "kind." ]
def is_preprocessing(self): return conf.lib.clang_isPreprocessing(self)
['def', 'is_preprocessing(self):', 'return', 'conf.lib.clang_isPreprocessing(self)']
909,120
meidachen/STPLS3D
cindex.py
Cursor.is_definition
is_definition
Returns true if the declaration pointed at by the cursor is also a definition of that entity.
[ "Returns", "true", "if", "the", "declaration", "pointed", "at", "by", "the", "cursor", "is", "also", "a", "definition", "of", "that", "entity." ]
def is_definition(self): return conf.lib.clang_isCursorDefinition(self)
['def', 'is_definition(self):', 'return', 'conf.lib.clang_isCursorDefinition(self)']
909,122
meidachen/STPLS3D
cindex.py
Cursor.is_const_method
is_const_method
Returns True if the cursor refers to a C++ member function or member function template that is declared 'const'.
[ "Returns", "True", "if", "the", "cursor", "refers", "to", "a", "C++", "member", "function", "or", "member", "function", "template", "that", "is", "declared", "'const'." ]
def is_const_method(self): return conf.lib.clang_CXXMethod_isConst(self)
['def', 'is_const_method(self):', 'return', 'conf.lib.clang_CXXMethod_isConst(self)']
909,123
meidachen/STPLS3D
cindex.py
Cursor.is_converting_constructor
is_converting_constructor
Returns True if the cursor refers to a C++ converting constructor.
[ "Returns", "True", "if", "the", "cursor", "refers", "to", "a", "C++", "converting", "constructor." ]
def is_converting_constructor(self): return conf.lib.clang_CXXConstructor_isConvertingConstructor(self)
['def', 'is_converting_constructor(self):', 'return', 'conf.lib.clang_CXXConstructor_isConvertingConstructor(self)']
909,124
meidachen/STPLS3D
cindex.py
Cursor.is_copy_constructor
is_copy_constructor
Returns True if the cursor refers to a C++ copy constructor.
[ "Returns", "True", "if", "the", "cursor", "refers", "to", "a", "C++", "copy", "constructor." ]
def is_copy_constructor(self): return conf.lib.clang_CXXConstructor_isCopyConstructor(self)
['def', 'is_copy_constructor(self):', 'return', 'conf.lib.clang_CXXConstructor_isCopyConstructor(self)']
909,125
meidachen/STPLS3D
cindex.py
Cursor.is_default_method
is_default_method
Returns True if the cursor refers to a C++ member function or member function template that is declared '= default'.
[ "Returns", "True", "if", "the", "cursor", "refers", "to", "a", "C++", "member", "function", "or", "member", "function", "template", "that", "is", "declared", "'=", "default'." ]
def is_default_method(self): return conf.lib.clang_CXXMethod_isDefaulted(self)
['def', 'is_default_method(self):', 'return', 'conf.lib.clang_CXXMethod_isDefaulted(self)']
909,128
meidachen/STPLS3D
cindex.py
Cursor.is_mutable_field
is_mutable_field
Returns True if the cursor refers to a C++ field that is declared 'mutable'.
[ "Returns", "True", "if", "the", "cursor", "refers", "to", "a", "C++", "field", "that", "is", "declared", "'mutable'." ]
def is_mutable_field(self): return conf.lib.clang_CXXField_isMutable(self)
['def', 'is_mutable_field(self):', 'return', 'conf.lib.clang_CXXField_isMutable(self)']
909,129
meidachen/STPLS3D
cindex.py
Cursor.is_static_method
is_static_method
Returns True if the cursor refers to a C++ member function or member function template that is declared 'static'.
[ "Returns", "True", "if", "the", "cursor", "refers", "to", "a", "C++", "member", "function", "or", "member", "function", "template", "that", "is", "declared", "'static'." ]
def is_static_method(self): return conf.lib.clang_CXXMethod_isStatic(self)
['def', 'is_static_method(self):', 'return', 'conf.lib.clang_CXXMethod_isStatic(self)']
909,131
meidachen/STPLS3D
cindex.py
Cursor.is_virtual_method
is_virtual_method
Returns True if the cursor refers to a C++ member function or member function template that is declared 'virtual'.
[ "Returns", "True", "if", "the", "cursor", "refers", "to", "a", "C++", "member", "function", "or", "member", "function", "template", "that", "is", "declared", "'virtual'." ]
def is_virtual_method(self): return conf.lib.clang_CXXMethod_isVirtual(self)
['def', 'is_virtual_method(self):', 'return', 'conf.lib.clang_CXXMethod_isVirtual(self)']
909,132
meidachen/STPLS3D
cindex.py
Cursor.kind
kind
Return the kind of this cursor.
[ "Return", "the", "kind", "of", "this", "cursor." ]
def kind(self): return CursorKind.from_id(self._kind_id)
['def', 'kind(self):', 'return', 'CursorKind.from_id(self._kind_id)']
909,135
meidachen/STPLS3D
cindex.py
Cursor.mangled_name
mangled_name
Return the mangled name for the entity referenced by this cursor.
[ "Return", "the", "mangled", "name", "for", "the", "entity", "referenced", "by", "this", "cursor." ]
def mangled_name(self): if not hasattr(self, '_mangled_name'): self._mangled_name = conf.lib.clang_Cursor_getMangling(self) return self._mangled_name
['def', 'mangled_name(self):', 'if', 'not', 'hasattr(self,', "'_mangled_name'):", 'self._mangled_name', '=', 'conf.lib.clang_Cursor_getMangling(self)', 'return', 'self._mangled_name']
909,138
meidachen/STPLS3D
cindex.py
Cursor.type
type
Retrieve the Type (if any) of the entity pointed at by the cursor.
[ "Retrieve", "the", "Type", "(if", "any)", "of", "the", "entity", "pointed", "at", "by", "the", "cursor." ]
def type(self): if not hasattr(self, '_type'): self._type = conf.lib.clang_getCursorType(self) return self._type
['def', 'type(self):', 'if', 'not', 'hasattr(self,', "'_type'):", 'self._type', '=', 'conf.lib.clang_getCursorType(self)', 'return', 'self._type']
909,143
meidachen/STPLS3D
cindex.py
Cursor.result_type
result_type
Retrieve the Type of the result for this Cursor.
[ "Retrieve", "the", "Type", "of", "the", "result", "for", "this", "Cursor." ]
def result_type(self): if not hasattr(self, '_result_type'): self._result_type = conf.lib.clang_getResultType(self.type) return self._result_type
['def', 'result_type(self):', 'if', 'not', 'hasattr(self,', "'_result_type'):", 'self._result_type', '=', 'conf.lib.clang_getResultType(self.type)', 'return', 'self._result_type']
909,145
meidachen/STPLS3D
cindex.py
Cursor.enum_value
enum_value
Return the value of an enum constant.
[ "Return", "the", "value", "of", "an", "enum", "constant." ]
def enum_value(self): if not hasattr(self, '_enum_value'): assert self.kind == CursorKind.ENUM_CONSTANT_DECL underlying_type = self.type if underlying_type.kind == TypeKind.ENUM: underlying_type = underlying_type.get_declaration().enum_type if underlying_type.kind in (Typ...
['def', 'enum_value(self):', 'if', 'not', 'hasattr(self,', "'_enum_value'):", 'assert', 'self.kind', '==', 'CursorKind.ENUM_CONSTANT_DECL', 'underlying_type', '=', 'self.type', 'if', 'underlying_type.kind', '==', 'TypeKind.ENUM:', 'underlying_type', '=', 'underlying_type.get_declaration().enum_type', 'if', 'underlying_...
909,148
meidachen/STPLS3D
cindex.py
Cursor.objc_type_encoding
objc_type_encoding
Return the Objective-C type encoding as a str.
[ "Return", "the", "Objective-C", "type", "encoding", "as", "a", "str." ]
def objc_type_encoding(self): if not hasattr(self, '_objc_type_encoding'): self._objc_type_encoding = conf.lib.clang_getDeclObjCTypeEncoding(self) return self._objc_type_encoding
['def', 'objc_type_encoding(self):', 'if', 'not', 'hasattr(self,', "'_objc_type_encoding'):", 'self._objc_type_encoding', '=', 'conf.lib.clang_getDeclObjCTypeEncoding(self)', 'return', 'self._objc_type_encoding']
909,149
meidachen/STPLS3D
cindex.py
Cursor.referenced
referenced
For a cursor that is a reference, returns a cursor representing the entity that it references.
[ "For", "a", "cursor", "that", "is", "a", "reference,", "returns", "a", "cursor", "representing", "the", "entity", "that", "it", "references." ]
def referenced(self): if not hasattr(self, '_referenced'): self._referenced = conf.lib.clang_getCursorReferenced(self) return self._referenced
['def', 'referenced(self):', 'if', 'not', 'hasattr(self,', "'_referenced'):", 'self._referenced', '=', 'conf.lib.clang_getCursorReferenced(self)', 'return', 'self._referenced']
909,154
meidachen/STPLS3D
cindex.py
Cursor.get_arguments
get_arguments
Return an iterator for accessing the arguments of this cursor.
[ "Return", "an", "iterator", "for", "accessing", "the", "arguments", "of", "this", "cursor." ]
def get_arguments(self): num_args = conf.lib.clang_Cursor_getNumArguments(self) for i in range(0, num_args): yield conf.lib.clang_Cursor_getArgument(self, i)
['def', 'get_arguments(self):', 'num_args', '=', 'conf.lib.clang_Cursor_getNumArguments(self)', 'for', 'i', 'in', 'range(0,', 'num_args):', 'yield', 'conf.lib.clang_Cursor_getArgument(self,', 'i)']
909,157
meidachen/STPLS3D
cindex.py
Cursor.get_num_template_arguments
get_num_template_arguments
Returns the number of template args associated with this cursor.
[ "Returns", "the", "number", "of", "template", "args", "associated", "with", "this", "cursor." ]
def get_num_template_arguments(self): return conf.lib.clang_Cursor_getNumTemplateArguments(self)
['def', 'get_num_template_arguments(self):', 'return', 'conf.lib.clang_Cursor_getNumTemplateArguments(self)']
909,158
meidachen/STPLS3D
cindex.py
Cursor.get_template_argument_kind
get_template_argument_kind
Returns the TemplateArgumentKind for the indicated template argument.
[ "Returns", "the", "TemplateArgumentKind", "for", "the", "indicated", "template", "argument." ]
def get_template_argument_kind(self, num): return conf.lib.clang_Cursor_getTemplateArgumentKind(self, num)
['def', 'get_template_argument_kind(self,', 'num):', 'return', 'conf.lib.clang_Cursor_getTemplateArgumentKind(self,', 'num)']
909,159
meidachen/STPLS3D
cindex.py
Cursor.get_template_argument_type
get_template_argument_type
Returns the CXType for the indicated template argument.
[ "Returns", "the", "CXType", "for", "the", "indicated", "template", "argument." ]
def get_template_argument_type(self, num): return conf.lib.clang_Cursor_getTemplateArgumentType(self, num)
['def', 'get_template_argument_type(self,', 'num):', 'return', 'conf.lib.clang_Cursor_getTemplateArgumentType(self,', 'num)']
909,160
meidachen/STPLS3D
cindex.py
Cursor.get_children
get_children
Return an iterator for accessing the children of this cursor.
[ "Return", "an", "iterator", "for", "accessing", "the", "children", "of", "this", "cursor." ]
def get_children(self): def visitor(child, parent, children): assert child != conf.lib.clang_getNullCursor() child._tu = self._tu children.append(child) return 1 children = [] conf.lib.clang_visitChildren(self, callbacks['cursor_visit'](visitor), children) return iter(ch...
['def', 'get_children(self):', 'def', 'visitor(child,', 'parent,', 'children):', 'assert', 'child', '!=', 'conf.lib.clang_getNullCursor()', 'child._tu', '=', 'self._tu', 'children.append(child)', 'return', '1', 'children', '=', '[]', 'conf.lib.clang_visitChildren(self,', "callbacks['cursor_visit'](visitor),", 'children...
909,163
meidachen/STPLS3D
cindex.py
Cursor.get_field_offsetof
get_field_offsetof
Returns the offsetof the FIELD_DECL pointed by this Cursor.
[ "Returns", "the", "offsetof", "the", "FIELD_DECL", "pointed", "by", "this", "Cursor." ]
def get_field_offsetof(self): return conf.lib.clang_Cursor_getOffsetOfField(self)
['def', 'get_field_offsetof(self):', 'return', 'conf.lib.clang_Cursor_getOffsetOfField(self)']
909,166
meidachen/STPLS3D
cindex.py
Cursor.is_anonymous
is_anonymous
Check if the record is anonymous.
[ "Check", "if", "the", "record", "is", "anonymous." ]
def is_anonymous(self): if self.kind == CursorKind.FIELD_DECL: return self.type.get_declaration().is_anonymous() return conf.lib.clang_Cursor_isAnonymous(self)
['def', 'is_anonymous(self):', 'if', 'self.kind', '==', 'CursorKind.FIELD_DECL:', 'return', 'self.type.get_declaration().is_anonymous()', 'return', 'conf.lib.clang_Cursor_isAnonymous(self)']
909,167
meidachen/STPLS3D
cindex.py
StorageClass.name
name
Get the enumeration name of this storage class.
[ "Get", "the", "enumeration", "name", "of", "this", "storage", "class." ]
def name(self): if self._name_map is None: self._name_map = {} for (key, value) in list(StorageClass.__dict__.items()): if isinstance(value, StorageClass): self._name_map[value] = key return self._name_map[self]
['def', 'name(self):', 'if', 'self._name_map', 'is', 'None:', 'self._name_map', '=', '{}', 'for', '(key,', 'value)', 'in', 'list(StorageClass.__dict__.items()):', 'if', 'isinstance(value,', 'StorageClass):', 'self._name_map[value]', '=', 'key', 'return', 'self._name_map[self]']
909,170
meidachen/STPLS3D
cindex.py
Type.is_pod
is_pod
Determine whether this Type represents plain old data (POD).
[ "Determine", "whether", "this", "Type", "represents", "plain", "old", "data", "(POD)." ]
def is_pod(self): return conf.lib.clang_isPODType(self)
['def', 'is_pod(self):', 'return', 'conf.lib.clang_isPODType(self)']
909,182
meidachen/STPLS3D
cindex.py
Type.get_pointee
get_pointee
For pointer types, returns the type of the pointee.
[ "For", "pointer", "types,", "returns", "the", "type", "of", "the", "pointee." ]
def get_pointee(self): return conf.lib.clang_getPointeeType(self)
['def', 'get_pointee(self):', 'return', 'conf.lib.clang_getPointeeType(self)']
909,183
meidachen/STPLS3D
cindex.py
Type.get_array_size
get_array_size
Retrieve the size of the constant array.
[ "Retrieve", "the", "size", "of", "the", "constant", "array." ]
def get_array_size(self): return conf.lib.clang_getArraySize(self)
['def', 'get_array_size(self):', 'return', 'conf.lib.clang_getArraySize(self)']
909,187
meidachen/STPLS3D
cindex.py
Type.get_named_type
get_named_type
Retrieve the type named by the qualified-id.
[ "Retrieve", "the", "type", "named", "by", "the", "qualified-id." ]
def get_named_type(self): return conf.lib.clang_Type_getNamedType(self)
['def', 'get_named_type(self):', 'return', 'conf.lib.clang_Type_getNamedType(self)']
909,189
meidachen/STPLS3D
cindex.py
Type.get_size
get_size
Retrieve the size of the record.
[ "Retrieve", "the", "size", "of", "the", "record." ]
def get_size(self): return conf.lib.clang_Type_getSizeOf(self)
['def', 'get_size(self):', 'return', 'conf.lib.clang_Type_getSizeOf(self)']
909,191
meidachen/STPLS3D
cindex.py
Type.get_ref_qualifier
get_ref_qualifier
Retrieve the ref-qualifier of the type.
[ "Retrieve", "the", "ref-qualifier", "of", "the", "type." ]
def get_ref_qualifier(self): return RefQualifierKind.from_id(conf.lib.clang_Type_getCXXRefQualifier(self))
['def', 'get_ref_qualifier(self):', 'return', 'RefQualifierKind.from_id(conf.lib.clang_Type_getCXXRefQualifier(self))']
909,193
meidachen/STPLS3D
cindex.py
Type.get_fields
get_fields
Return an iterator for accessing the fields of this type.
[ "Return", "an", "iterator", "for", "accessing", "the", "fields", "of", "this", "type." ]
def get_fields(self): def visitor(field, children): assert field != conf.lib.clang_getNullCursor() field._tu = self._tu fields.append(field) return 1 fields = [] conf.lib.clang_Type_visitFields(self, callbacks['fields_visit'](visitor), fields) return iter(fields)
['def', 'get_fields(self):', 'def', 'visitor(field,', 'children):', 'assert', 'field', '!=', 'conf.lib.clang_getNullCursor()', 'field._tu', '=', 'self._tu', 'fields.append(field)', 'return', '1', 'fields', '=', '[]', 'conf.lib.clang_Type_visitFields(self,', "callbacks['fields_visit'](visitor),", 'fields)', 'return', 'i...
909,194
meidachen/STPLS3D
cindex.py
Index.read
read
Load a TranslationUnit from the given AST file.
[ "Load", "a", "TranslationUnit", "from", "the", "given", "AST", "file." ]
def read(self, path): return TranslationUnit.from_ast_file(path, self)
['def', 'read(self,', 'path):', 'return', 'TranslationUnit.from_ast_file(path,', 'self)']
909,197
meidachen/STPLS3D
cindex.py
TranslationUnit.cursor
cursor
Retrieve the cursor that represents the given translation unit.
[ "Retrieve", "the", "cursor", "that", "represents", "the", "given", "translation", "unit." ]
def cursor(self): return conf.lib.clang_getTranslationUnitCursor(self)
['def', 'cursor(self):', 'return', 'conf.lib.clang_getTranslationUnitCursor(self)']
909,200
meidachen/STPLS3D
cindex.py
TranslationUnit.spelling
spelling
Get the original translation unit source file name.
[ "Get", "the", "original", "translation", "unit", "source", "file", "name." ]
def spelling(self): return conf.lib.clang_getTranslationUnitSpelling(self)
['def', 'spelling(self):', 'return', 'conf.lib.clang_getTranslationUnitSpelling(self)']
909,201
meidachen/STPLS3D
cindex.py
TranslationUnit.get_file
get_file
Obtain a File from this translation unit.
[ "Obtain", "a", "File", "from", "this", "translation", "unit." ]
def get_file(self, filename): return File.from_name(self, filename)
['def', 'get_file(self,', 'filename):', 'return', 'File.from_name(self,', 'filename)']
909,203
meidachen/STPLS3D
cindex.py
TranslationUnit.diagnostics
diagnostics
Return an iterable (and indexable) object containing the diagnostics.
[ "Return", "an", "iterable", "(and", "indexable)", "object", "containing", "the", "diagnostics." ]
def diagnostics(self): class DiagIterator: def __init__(self, tu): self.tu = tu def __len__(self): return int(conf.lib.clang_getNumDiagnostics(self.tu)) def __getitem__(self, key): diag = conf.lib.clang_getDiagnostic(self.tu, key) if not di...
['def', 'diagnostics(self):', 'class', 'DiagIterator:', 'def', '__init__(self,', 'tu):', 'self.tu', '=', 'tu', 'def', '__len__(self):', 'return', 'int(conf.lib.clang_getNumDiagnostics(self.tu))', 'def', '__getitem__(self,', 'key):', 'diag', '=', 'conf.lib.clang_getDiagnostic(self.tu,', 'key)', 'if', 'not', 'diag:', 'ra...
909,206
meidachen/STPLS3D
cindex.py
File.from_name
from_name
Retrieve a file handle within the given translation unit.
[ "Retrieve", "a", "file", "handle", "within", "the", "given", "translation", "unit." ]
def from_name(translation_unit, file_name): return File(conf.lib.clang_getFile(translation_unit, file_name))
['def', 'from_name(translation_unit,', 'file_name):', 'return', 'File(conf.lib.clang_getFile(translation_unit,', 'file_name))']
909,211
meidachen/STPLS3D
cindex.py
File.name
name
Return the complete file and path name of the file.
[ "Return", "the", "complete", "file", "and", "path", "name", "of", "the", "file." ]
def name(self): return conf.lib.clang_getCString(conf.lib.clang_getFileName(self))
['def', 'name(self):', 'return', 'conf.lib.clang_getCString(conf.lib.clang_getFileName(self))']
909,212
meidachen/STPLS3D
cindex.py
File.time
time
Return the last modification time of the file.
[ "Return", "the", "last", "modification", "time", "of", "the", "file." ]
def time(self): return conf.lib.clang_getFileTime(self)
['def', 'time(self):', 'return', 'conf.lib.clang_getFileTime(self)']
909,213
meidachen/STPLS3D
cindex.py
FileInclusion.is_input_file
is_input_file
True if the included file is the input file.
[ "True", "if", "the", "included", "file", "is", "the", "input", "file." ]
def is_input_file(self): return self.depth == 0
['def', 'is_input_file(self):', 'return', 'self.depth', '==', '0']
909,214
meidachen/STPLS3D
cindex.py
CompilationDatabase.getAllCompileCommands
getAllCompileCommands
Get an iterable object providing all the CompileCommands available from the database.
[ "Get", "an", "iterable", "object", "providing", "all", "the", "CompileCommands", "available", "from", "the", "database." ]
def getAllCompileCommands(self): return conf.lib.clang_CompilationDatabase_getAllCompileCommands(self)
['def', 'getAllCompileCommands(self):', 'return', 'conf.lib.clang_CompilationDatabase_getAllCompileCommands(self)']
909,220
meidachen/STPLS3D
cindex.py
Token.kind
kind
Obtain the TokenKind of the current token.
[ "Obtain", "the", "TokenKind", "of", "the", "current", "token." ]
def kind(self): return TokenKind.from_value(conf.lib.clang_getTokenKind(self))
['def', 'kind(self):', 'return', 'TokenKind.from_value(conf.lib.clang_getTokenKind(self))']
909,222
meidachen/STPLS3D
cindex.py
Token.location
location
The SourceLocation this Token occurs at.
[ "The", "SourceLocation", "this", "Token", "occurs", "at." ]
def location(self): return conf.lib.clang_getTokenLocation(self._tu, self)
['def', 'location(self):', 'return', 'conf.lib.clang_getTokenLocation(self._tu,', 'self)']
909,223
meidachen/STPLS3D
cindex.py
Token.extent
extent
The SourceRange this Token occupies.
[ "The", "SourceRange", "this", "Token", "occupies." ]
def extent(self): return conf.lib.clang_getTokenExtent(self._tu, self)
['def', 'extent(self):', 'return', 'conf.lib.clang_getTokenExtent(self._tu,', 'self)']
909,224
meidachen/STPLS3D
cindex.py
Token.cursor
cursor
The Cursor this Token corresponds to.
[ "The", "Cursor", "this", "Token", "corresponds", "to." ]
def cursor(self): cursor = Cursor() conf.lib.clang_annotateTokens(self._tu, byref(self), 1, byref(cursor)) return cursor
['def', 'cursor(self):', 'cursor', '=', 'Cursor()', 'conf.lib.clang_annotateTokens(self._tu,', 'byref(self),', '1,', 'byref(cursor))', 'return', 'cursor']
909,225
meidachen/STPLS3D
common.py
PointCloudDataset.augmentation_transform
augmentation_transform
Implementation of an augmentation transform for point clouds.
[ "Implementation", "of", "an", "augmentation", "transform", "for", "point", "clouds." ]
def augmentation_transform(self, points, normals=None, verbose=False): R = np.eye(points.shape[1]) if points.shape[1] == 3: if self.config.augment_rotation == 'vertical': theta = np.random.rand() * 2 * np.pi (c, s) = (np.cos(theta), np.sin(theta)) R = np.array([[c, -s...
['def', 'augmentation_transform(self,', 'points,', 'normals=None,', 'verbose=False):', 'R', '=', 'np.eye(points.shape[1])', 'if', 'points.shape[1]', '==', '3:', 'if', 'self.config.augment_rotation', '==', "'vertical':", 'theta', '=', 'np.random.rand()', '*', '2', '*', 'np.pi', '(c,', 's)', '=', '(np.cos(theta),', 'np.s...
909,236
pengli09/str2vec
util.py
init_We
init_We
Initialize word embedding matrix.
[ "Initialize", "word", "embedding", "matrix." ]
def init_We(emb_size, vcb_size, r=0.05, return_row_vector=True): if return_row_vector: return rand(emb_size * vcb_size) * 2 * r - r else: return rand(emb_size, vcb_size) * 2 * r - r
['def', 'init_We(emb_size,', 'vcb_size,', 'r=0.05,', 'return_row_vector=True):', 'if', 'return_row_vector:', 'return', 'rand(emb_size', '*', 'vcb_size)', '*', '2', '*', 'r', '-', 'r', 'else:', 'return', 'rand(emb_size,', 'vcb_size)', '*', '2', '*', 'r', '-', 'r']
909,328
hrafnskogr/straceGAN
websocket_server.py
WebSocketHandler.send_text
send_text
Important: Fragmented(=continuation) messages are not supported since their usage cases are limited - when we don't know the payload length.
[ "Important:", "Fragmented(=continuation)", "messages", "are", "not", "supported", "since", "their", "usage", "cases", "are", "limited", "-", "when", "we", "don't", "know", "the", "payload", "length." ]
def send_text(self, message, opcode=OPCODE_TEXT): if isinstance(message, bytes): message = try_decode_UTF8(message) if not message: logger.warning("Can't send message, message is not valid UTF-8") return False elif sys.version_info < (3, 0) and (isinstance(message, str) o...
['def', 'send_text(self,', 'message,', 'opcode=OPCODE_TEXT):', 'if', 'isinstance(message,', 'bytes):', 'message', '=', 'try_decode_UTF8(message)', 'if', 'not', 'message:', 'logger.warning("Can\'t', 'send', 'message,', 'message', 'is', 'not', 'valid', 'UTF-8")', 'return', 'False', 'elif', 'sys.version_info', '<', '(3,',...
909,329
xavialex/Streamlit-TF-Real-Time-Object-
main.py
visualize_results
visualize_results
Returns the resulting image after being passed to the model.
[ "Returns", "the", "resulting", "image", "after", "being", "passed", "to", "the", "model." ]
def visualize_results(image, output_dict, category_index): vis_util.visualize_boxes_and_labels_on_image_array(image, output_dict['detection_boxes'], output_dict['detection_classes'], output_dict['detection_scores'], category_index, instance_masks=output_dict.get('detection_masks'), use_normalized_coordinates=True, ...
['def', 'visualize_results(image,', 'output_dict,', 'category_index):', 'vis_util.visualize_boxes_and_labels_on_image_array(image,', "output_dict['detection_boxes'],", "output_dict['detection_classes'],", "output_dict['detection_scores'],", 'category_index,', "instance_masks=output_dict.get('detection_masks'),", 'use_n...
909,344
exiawsh/StreamPETR
nuscenes_dataset.py
invert_matrix_egopose_numpy
invert_matrix_egopose_numpy
Compute the inverse transformation of a 4x4 egopose numpy matrix.
[ "Compute", "the", "inverse", "transformation", "of", "a", "4x4", "egopose", "numpy", "matrix." ]
def invert_matrix_egopose_numpy(egopose): inverse_matrix = np.zeros((4, 4), dtype=np.float32) rotation = egopose[:3, :3] translation = egopose[:3, 3] inverse_matrix[:3, :3] = rotation.T inverse_matrix[:3, 3] = -np.dot(rotation.T, translation) inverse_matrix[3, 3] = 1.0 return inverse_matrix
['def', 'invert_matrix_egopose_numpy(egopose):', 'inverse_matrix', '=', 'np.zeros((4,', '4),', 'dtype=np.float32)', 'rotation', '=', 'egopose[:3,', ':3]', 'translation', '=', 'egopose[:3,', '3]', 'inverse_matrix[:3,', ':3]', '=', 'rotation.T', 'inverse_matrix[:3,', '3]', '=', '-np.dot(rotation.T,', 'translation)', 'inv...
910,032
damnOblivious/student-teacher-transfer-learning
utils.py
weights_init
weights_init
Add your favourite weight initializations.
[ "Add", "your", "favourite", "weight", "initializations." ]
def weights_init(model, opt): for m in model.modules(): if isinstance(m, nn.Conv2d): m.weight.data = nn.init.kaiming_normal(m.weight.data, mode='fan_out') if m.bias is not None: nn.init.constant(m.bias, 0) elif isinstance(m, nn.BatchNorm2d): if m.a...
['def', 'weights_init(model,', 'opt):', 'for', 'm', 'in', 'model.modules():', 'if', 'isinstance(m,', 'nn.Conv2d):', 'm.weight.data', '=', 'nn.init.kaiming_normal(m.weight.data,', "mode='fan_out')", 'if', 'm.bias', 'is', 'not', 'None:', 'nn.init.constant(m.bias,', '0)', 'elif', 'isinstance(m,', 'nn.BatchNorm2d):', 'if',...
910,295
andreabac3/study-transfer-learning-covid-19
specifity.py
Specificity.compute
compute
Computes the specificity score based on inputs passed in to ``update`` previously.
[ "Computes", "the", "specificity", "score", "based", "on", "inputs", "passed", "in", "to", "``update``", "previously." ]
def compute(self) -> Tensor: (tp, fp, tn, fn) = self._get_final_stats() return _specificity_compute(tp, fp, tn, fn, self.average, self.mdmc_reduce)
['def', 'compute(self)', '->', 'Tensor:', '(tp,', 'fp,', 'tn,', 'fn)', '=', 'self._get_final_stats()', 'return', '_specificity_compute(tp,', 'fp,', 'tn,', 'fn,', 'self.average,', 'self.mdmc_reduce)']
910,310
vbrodrigues/style-transfer-udacity-deep-
style_transfer.py
load_image
load_image
Load in and transform an image, making sure the image is <= 400 pixels in the x-y dims.
[ "Load", "in", "and", "transform", "an", "image,", "making", "sure", "the", "image", "is", "<=", "400", "pixels", "in", "the", "x-y", "dims." ]
def load_image(img_path, max_size=600, shape=None): image = Image.open(img_path).convert('RGB') if max(image.size) > max_size: size = max_size else: size = max(image.size) if shape is not None: size = shape in_transform = transforms.Compose([transforms.Resize(size), transform...
['def', 'load_image(img_path,', 'max_size=600,', 'shape=None):', 'image', '=', "Image.open(img_path).convert('RGB')", 'if', 'max(image.size)', '>', 'max_size:', 'size', '=', 'max_size', 'else:', 'size', '=', 'max(image.size)', 'if', 'shape', 'is', 'not', 'None:', 'size', '=', 'shape', 'in_transform', '=', 'transforms.C...
910,328
HKUST-KnowComp/SubeventWriter
bertscore.py
BERTScore.add_batch
add_batch
Add a batch of predictions and references for the metric's stack.
[ "Add", "a", "batch", "of", "predictions", "and", "references", "for", "the", "metric's", "stack." ]
def add_batch(self, predictions=None, references=None, **kwargs): if references is not None: references = [[ref] if isinstance(ref, str) else ref for ref in references] super().add_batch(predictions=predictions, references=references, **kwargs)
['def', 'add_batch(self,', 'predictions=None,', 'references=None,', '**kwargs):', 'if', 'references', 'is', 'not', 'None:', 'references', '=', '[[ref]', 'if', 'isinstance(ref,', 'str)', 'else', 'ref', 'for', 'ref', 'in', 'references]', 'super().add_batch(predictions=predictions,', 'references=references,', '**kwargs)']
910,404
HKUST-KnowComp/SubeventWriter
bertscore.py
BERTScore.add
add
Add one prediction and reference for the metric's stack.
[ "Add", "one", "prediction", "and", "reference", "for", "the", "metric's", "stack." ]
def add(self, prediction=None, reference=None, **kwargs): if isinstance(reference, str): reference = [reference] super().add(prediction=prediction, reference=reference, **kwargs)
['def', 'add(self,', 'prediction=None,', 'reference=None,', '**kwargs):', 'if', 'isinstance(reference,', 'str):', 'reference', '=', '[reference]', 'super().add(prediction=prediction,', 'reference=reference,', '**kwargs)']
910,405
surajsubramanian/SudokuSolver
sudoku_solver.py
boxFinder
boxFinder
Here we find the four corners of the sudoku inside the image.
[ "Here", "we", "find", "the", "four", "corners", "of", "the", "sudoku", "inside", "the", "image." ]
def boxFinder(image, out): final = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) (contours, h) = cv2.findContours(out.copy(), cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE) contours = sorted(contours, key=cv2.contourArea, reverse=True) polygon = contours[0] (bottom_right, _) = max(enumerate([pt[0][0] + pt[0]...
['def', 'boxFinder(image,', 'out):', 'final', '=', 'cv2.cvtColor(image,', 'cv2.COLOR_BGR2GRAY)', '(contours,', 'h)', '=', 'cv2.findContours(out.copy(),', 'cv2.RETR_EXTERNAL,', 'cv2.CHAIN_APPROX_SIMPLE)', 'contours', '=', 'sorted(contours,', 'key=cv2.contourArea,', 'reverse=True)', 'polygon', '=', 'contours[0]', '(botto...
910,426
LucasAlegre/sumo-rl
setup.py
get_version
get_version
Gets the mo-gymnasium version.
[ "Gets", "the", "mo-gymnasium", "version." ]
def get_version(): path = CWD / 'sumo_rl' / '__init__.py' content = path.read_text() for line in content.splitlines(): if line.startswith('__version__'): return line.strip().split()[-1].strip().strip('"') raise RuntimeError('bad version data in __init__.py')
['def', 'get_version():', 'path', '=', 'CWD', '/', "'sumo_rl'", '/', "'__init__.py'", 'content', '=', 'path.read_text()', 'for', 'line', 'in', 'content.splitlines():', 'if', "line.startswith('__version__'):", 'return', 'line.strip().split()[-1].strip().strip(\'"\')', 'raise', "RuntimeError('bad", 'version', 'data', 'in...
910,439
LucasAlegre/sumo-rl
ql_agent.py
QLAgent.act
act
Choose action based on Q-table.
[ "Choose", "action", "based", "on", "Q-table." ]
def act(self): self.action = self.exploration.choose(self.q_table, self.state, self.action_space) return self.action
['def', 'act(self):', 'self.action', '=', 'self.exploration.choose(self.q_table,', 'self.state,', 'self.action_space)', 'return', 'self.action']
910,441
LucasAlegre/sumo-rl
env.py
SumoEnvironment.sim_step
sim_step
Return current simulation second on SUMO.
[ "Return", "current", "simulation", "second", "on", "SUMO." ]
def sim_step(self) -> float: return self.sumo.simulation.getTime()
['def', 'sim_step(self)', '->', 'float:', 'return', 'self.sumo.simulation.getTime()']
910,444
LucasAlegre/sumo-rl
env.py
SumoEnvironment.observation_spaces
observation_spaces
Return the observation space of a traffic signal.
[ "Return", "the", "observation", "space", "of", "a", "traffic", "signal." ]
def observation_spaces(self, ts_id: str): return self.traffic_signals[ts_id].observation_space
['def', 'observation_spaces(self,', 'ts_id:', 'str):', 'return', 'self.traffic_signals[ts_id].observation_space']
910,448