uid
stringlengths
24
24
split
stringclasses
1 value
category
stringclasses
2 values
content
stringlengths
5
482k
signature
stringlengths
1
14k
suffix
stringlengths
1
482k
prefix
stringlengths
9
14k
prefix_token_count
int64
3
5.01k
prefix_token_budget
int64
64
256
element_token_count
int64
1
292k
signature_token_count
int64
1
5.01k
prefix_context_token_count
int64
0
255
repo
stringlengths
7
112
path
stringlengths
4
208
language
stringclasses
1 value
name
stringlengths
1
218
qualname
stringlengths
1
218
start_line
int64
1
26.7k
end_line
int64
1
26.7k
signature_start_line
int64
1
26.7k
signature_end_line
int64
1
26.7k
source_hash
stringlengths
40
40
source_dataset
stringclasses
1 value
source_split
stringclasses
1 value
a9588f936949c9c11ce29088
train
function
def flatten(attrs, inputs, cls): """Flattens the input array into a 2-D array by collapsing the higher dimensions.""" #Mxnet does not have axis support. By default uses axis=1 if 'axis' in attrs and attrs['axis'] != 1: raise RuntimeError("Flatten operator only supports axis=1") new_attrs = trans...
def flatten(attrs, inputs, cls):
"""Flattens the input array into a 2-D array by collapsing the higher dimensions.""" #Mxnet does not have axis support. By default uses axis=1 if 'axis' in attrs and attrs['axis'] != 1: raise RuntimeError("Flatten operator only supports axis=1") new_attrs = translation_utils._remove_attributes(a...
num_outputs=1, squeeze_axis=1) for i in axes[1:]: mxnet_op = symbol.split(mxnet_op, axis=i-1, num_outputs=1, squeeze_axis=1) return mxnet_op, new_attrs, inputs def flatten(attrs, inputs, cls):
64
64
98
8
55
eeqmcc/SNIPER-mxnet
python/mxnet/contrib/onnx/_import/op_translations.py
Python
flatten
flatten
358
364
358
358
dd8eaf591f7a22dc073b7a380190ccd5a7411356
bigcode/the-stack
train
b5a1a9d8913b7d3acb4b74a0
train
function
def exponent(attrs, inputs, cls): """Elementwise exponent of input array.""" return 'exp', attrs, inputs
def exponent(attrs, inputs, cls):
"""Elementwise exponent of input array.""" return 'exp', attrs, inputs
ponent':'exp'}) if 'broadcast' in attrs and attrs['broadcast'] == 1: new_attrs = translation_utils._remove_attributes(new_attrs, ['broadcast']) return 'broadcast_power', new_attrs, inputs return 'pow', new_attrs, inputs def exponent(attrs, inputs, cls):
64
64
26
8
55
eeqmcc/SNIPER-mxnet
python/mxnet/contrib/onnx/_import/op_translations.py
Python
exponent
exponent
383
385
383
383
af4e819662893ebdc777fad4524be8da2528b923
bigcode/the-stack
train
24b64c63263a62ac0cf2ac9c
train
function
def argmin(attrs, inputs, cls): """Returns indices of the minimum values along an axis.""" return 'argmin', attrs, inputs
def argmin(attrs, inputs, cls):
"""Returns indices of the minimum values along an axis.""" return 'argmin', attrs, inputs
): """Elementwise sum of arrays""" return 'add_n', attrs, inputs # Sorting and Searching def argmax(attrs, inputs, cls): """Returns indices of the maximum values along an axis""" return 'argmax', attrs, inputs def argmin(attrs, inputs, cls):
64
64
31
9
54
eeqmcc/SNIPER-mxnet
python/mxnet/contrib/onnx/_import/op_translations.py
Python
argmin
argmin
91
93
91
91
b602b7f33dc43f38b3783f4a5e136751c6c85042
bigcode/the-stack
train
8283dd425bd27e0f42414cb4
train
function
def reduce_min(attrs, inputs, cls): """Reduce the array along a given axis by mean value""" new_attrs = translation_utils._fix_attribute_names(attrs, {'axes':'axis'}) return 'min', new_attrs, inputs
def reduce_min(attrs, inputs, cls):
"""Reduce the array along a given axis by mean value""" new_attrs = translation_utils._fix_attribute_names(attrs, {'axes':'axis'}) return 'min', new_attrs, inputs
', new_attrs, inputs def reduce_mean(attrs, inputs, cls): """Reduce the array along a given axis by mean value""" new_attrs = translation_utils._fix_attribute_names(attrs, {'axes':'axis'}) return 'mean', new_attrs, inputs def reduce_min(attrs, inputs, cls):
64
64
49
9
54
eeqmcc/SNIPER-mxnet
python/mxnet/contrib/onnx/_import/op_translations.py
Python
reduce_min
reduce_min
402
405
402
402
44b892aa7c2a1cf05f46878cd1496da6aeb3e238
bigcode/the-stack
train
218c364454b204d1a020951c
train
function
def transpose(attrs, inputs, cls): """Transpose the input array.""" new_attrs = translation_utils._fix_attribute_names(attrs, {'perm' : 'axes'}) return 'transpose', new_attrs, inputs
def transpose(attrs, inputs, cls):
"""Transpose the input array.""" new_attrs = translation_utils._fix_attribute_names(attrs, {'perm' : 'axes'}) return 'transpose', new_attrs, inputs
[0]) if len(axes) > 1: for i, axis in enumerate(axes): slice_op = symbol.slice_axis(slice_op, axis=axis, begin=begin[i], end=end[i]) return slice_op, new_attrs, inputs def transpose(attrs, inputs, cls):
64
64
45
8
55
eeqmcc/SNIPER-mxnet
python/mxnet/contrib/onnx/_import/op_translations.py
Python
transpose
transpose
339
343
339
339
2fe6e1f17f6fc0860fe8db41e63851935ecedd6a
bigcode/the-stack
train
63389b094c63f7e1d9791eb6
train
function
def relu(attrs, inputs, cls): """Computes rectified linear function.""" return 'relu', attrs, inputs
def relu(attrs, inputs, cls):
"""Computes rectified linear function.""" return 'relu', attrs, inputs
_names(attrs, {'axis': 'dim'}) return 'concat', new_attrs, inputs # Basic neural network functions def sigmoid(attrs, inputs, cls): """Computes elementwise sigmoid of the input array""" return 'sigmoid', attrs, inputs def relu(attrs, inputs, cls):
64
64
27
9
54
eeqmcc/SNIPER-mxnet
python/mxnet/contrib/onnx/_import/op_translations.py
Python
relu
relu
149
151
149
149
8ff05d4dd4f97becc0fdd82e1f31e32d4df74fb5
bigcode/the-stack
train
00cabe6f49ea1cf13311a4bd
train
function
def multiply(attrs, inputs, cls): """Multiply two tensors""" new_attr = {} if 'broadcast' in attrs and attrs['broadcast'] == 1: op_value = translation_utils._fix_bias_shape('broadcast_mul', inputs, cls) return op_value, new_attr, inputs return 'elemwise_mul', new_attr, inputs
def multiply(attrs, inputs, cls):
"""Multiply two tensors""" new_attr = {} if 'broadcast' in attrs and attrs['broadcast'] == 1: op_value = translation_utils._fix_bias_shape('broadcast_mul', inputs, cls) return op_value, new_attr, inputs return 'elemwise_mul', new_attr, inputs
, inputs, cls): """Subtracting two tensors""" new_attr = {} if 'broadcast' in attrs and attrs['broadcast'] == 1: return 'broadcast_sub', new_attr, inputs return 'elemwise_sub', new_attr, inputs def multiply(attrs, inputs, cls):
64
64
75
8
55
eeqmcc/SNIPER-mxnet
python/mxnet/contrib/onnx/_import/op_translations.py
Python
multiply
multiply
58
64
58
58
7ec9477fe8e49007a7f2f1a69f7edb9e465eb6ea
bigcode/the-stack
train
3847e022e86956a9d7b3c039
train
function
def random_uniform(attrs, inputs, cls): """Draw random samples from a uniform distribtuion.""" new_attr = translation_utils._remove_attributes(attrs, ['seed']) return 'random_uniform', new_attr, inputs
def random_uniform(attrs, inputs, cls):
"""Draw random samples from a uniform distribtuion.""" new_attr = translation_utils._remove_attributes(attrs, ['seed']) return 'random_uniform', new_attr, inputs
-access from . import translation_utils from .... import symbol # Method definitions for the callable objects mapped in the import_helper module def identity(attrs, inputs, cls): """Returns the identity function of the the input.""" return 'identity', attrs, inputs def random_uniform(attrs, inputs, cls):
64
64
46
9
54
eeqmcc/SNIPER-mxnet
python/mxnet/contrib/onnx/_import/op_translations.py
Python
random_uniform
random_uniform
30
33
30
30
ab136ad3e0513be118c4bb6406900880d15a5d91
bigcode/the-stack
train
df4e0649f5e1b3584665f94f
train
function
def negative(attrs, inputs, cls): """Negation of every element in a tensor""" return 'negative', attrs, inputs
def negative(attrs, inputs, cls):
"""Negation of every element in a tensor""" return 'negative', attrs, inputs
'] == 1: return 'broadcast_div', new_attr, inputs return 'elemwise_div', new_attr, inputs def absolute(attrs, inputs, cls): """Returns element-wise absolute value of the input.""" return 'abs', attrs, inputs def negative(attrs, inputs, cls):
64
64
28
8
55
eeqmcc/SNIPER-mxnet
python/mxnet/contrib/onnx/_import/op_translations.py
Python
negative
negative
77
79
77
77
93e4b72b37ca79ee7d30dfd513372aad3ee212e3
bigcode/the-stack
train
cc41dd947e4143b31f405d25
train
function
def avg_pooling(attrs, inputs, cls): """ Average pooling""" new_attrs = translation_utils._fix_attribute_names(attrs, {'kernel_shape': 'kernel', 'strides': 'stride', ...
def avg_pooling(attrs, inputs, cls):
""" Average pooling""" new_attrs = translation_utils._fix_attribute_names(attrs, {'kernel_shape': 'kernel', 'strides': 'stride', 'pads': 'pad', ...
new_attrs, inputs def reduce_prod(attrs, inputs, cls): """Reduce the array along a given axis by mean value""" new_attrs = translation_utils._fix_attribute_names(attrs, {'axes':'axis'}) return 'prod', new_attrs, inputs def avg_pooling(attrs, inputs, cls):
64
64
105
10
53
eeqmcc/SNIPER-mxnet
python/mxnet/contrib/onnx/_import/op_translations.py
Python
avg_pooling
avg_pooling
417
429
417
417
a764f88998b3e7b18bf18de7ee51921eb3e6f6d9
bigcode/the-stack
train
73907ed55f498d78157b0f98
train
function
def matrix_multiplication(attrs, inputs, cls): """Performs general matrix multiplication""" return 'linalg_gemm2', attrs, inputs
def matrix_multiplication(attrs, inputs, cls):
"""Performs general matrix multiplication""" return 'linalg_gemm2', attrs, inputs
(attrs, {'pads' : 'pad_width', 'value' : 'constant_value' }) new_attrs['pad_width'] = translation_utils._pad_sequence_fix(new_attrs.get('pad_width')) return 'pad', new_attrs, inputs def ...
64
64
32
11
52
eeqmcc/SNIPER-mxnet
python/mxnet/contrib/onnx/_import/op_translations.py
Python
matrix_multiplication
matrix_multiplication
161
163
161
161
77d5976c61b8a4bb7a2386e52bfb4c68ca3f3e3d
bigcode/the-stack
train
b9776106bfc93a1cb9784272
train
function
def subtract(attrs, inputs, cls): """Subtracting two tensors""" new_attr = {} if 'broadcast' in attrs and attrs['broadcast'] == 1: return 'broadcast_sub', new_attr, inputs return 'elemwise_sub', new_attr, inputs
def subtract(attrs, inputs, cls):
"""Subtracting two tensors""" new_attr = {} if 'broadcast' in attrs and attrs['broadcast'] == 1: return 'broadcast_sub', new_attr, inputs return 'elemwise_sub', new_attr, inputs
if 'broadcast' in attrs and attrs['broadcast'] == 1: op_value = translation_utils._fix_bias_shape('broadcast_add', inputs, cls) return op_value, new_attr, inputs return 'elemwise_add', new_attr, inputs def subtract(attrs, inputs, cls):
64
64
59
8
55
eeqmcc/SNIPER-mxnet
python/mxnet/contrib/onnx/_import/op_translations.py
Python
subtract
subtract
50
55
50
50
4e824dc20ca3ba01df26839456eecf9531faadae
bigcode/the-stack
train
420d31b95b1d3aae551fe6cf
train
function
def max_pooling(attrs, inputs, cls): """ Average pooling""" new_attrs = translation_utils._fix_attribute_names(attrs, {'kernel_shape': 'kernel', 'strides': 'stride', ...
def max_pooling(attrs, inputs, cls):
""" Average pooling""" new_attrs = translation_utils._fix_attribute_names(attrs, {'kernel_shape': 'kernel', 'strides': 'stride', 'pads': 'pad', ...
}) new_attrs = translation_utils._add_extra_attributes(new_attrs, {'pooling_convention': 'valid' }) new_op = translation_utils._fix_pooling('avg', inputs, new_attrs) return new_op, new_attrs, in...
64
64
105
10
53
eeqmcc/SNIPER-mxnet
python/mxnet/contrib/onnx/_import/op_translations.py
Python
max_pooling
max_pooling
432
445
432
432
11e4a32b1c0831bf470ab297d103e22a6b0a6898
bigcode/the-stack
train
f3fd1d4f6a2d7af756584844
train
function
def add(attrs, inputs, cls): """Adding two tensors""" new_attr = {} if 'broadcast' in attrs and attrs['broadcast'] == 1: op_value = translation_utils._fix_bias_shape('broadcast_add', inputs, cls) return op_value, new_attr, inputs return 'elemwise_add', new_attr, inputs
def add(attrs, inputs, cls):
"""Adding two tensors""" new_attr = {} if 'broadcast' in attrs and attrs['broadcast'] == 1: op_value = translation_utils._fix_bias_shape('broadcast_add', inputs, cls) return op_value, new_attr, inputs return 'elemwise_add', new_attr, inputs
random samples from a Gaussian distribution.""" new_attr = translation_utils._remove_attributes(attrs, ['seed']) new_attr = translation_utils._fix_attribute_names(new_attr, {'mean' : 'loc'}) return 'random_uniform', new_attr, inputs # Arithmetic Operations def add(attrs, inputs, cls):
64
64
75
8
55
eeqmcc/SNIPER-mxnet
python/mxnet/contrib/onnx/_import/op_translations.py
Python
add
add
42
48
42
42
a40a18f6e06f299b578dd5c1402225bb72667989
bigcode/the-stack
train
d38cbc0b171f64b038fa20d5
train
function
def add_n(attrs, inputs, cls): """Elementwise sum of arrays""" return 'add_n', attrs, inputs
def add_n(attrs, inputs, cls):
"""Elementwise sum of arrays""" return 'add_n', attrs, inputs
absolute(attrs, inputs, cls): """Returns element-wise absolute value of the input.""" return 'abs', attrs, inputs def negative(attrs, inputs, cls): """Negation of every element in a tensor""" return 'negative', attrs, inputs def add_n(attrs, inputs, cls):
64
64
27
9
54
eeqmcc/SNIPER-mxnet
python/mxnet/contrib/onnx/_import/op_translations.py
Python
add_n
add_n
81
83
81
81
62169a06401a8c95c2ed59b3a5215d23a664e54e
bigcode/the-stack
train
5c565f4914fe5378f3325f2c
train
function
def reciprocal(attrs, inputs, cls): """Returns the reciprocal of the argument, element-wise.""" return 'reciprocal', attrs, inputs
def reciprocal(attrs, inputs, cls):
"""Returns the reciprocal of the argument, element-wise.""" return 'reciprocal', attrs, inputs
if 'axis' in attrs and attrs['axis'] != 1: raise RuntimeError("Flatten operator only supports axis=1") new_attrs = translation_utils._remove_attributes(attrs, ['axis']) return 'Flatten', new_attrs, inputs #Powers def reciprocal(attrs, inputs, cls):
64
64
31
8
55
eeqmcc/SNIPER-mxnet
python/mxnet/contrib/onnx/_import/op_translations.py
Python
reciprocal
reciprocal
367
369
367
367
d9ddac4ca286feb0581b0abc615ef566c1ce3225
bigcode/the-stack
train
b4b304ea8c5717e6637f7523
train
function
def leaky_relu(attrs, inputs, cls): """Leaky Relu function""" if 'alpha' in attrs: new_attrs = translation_utils._fix_attribute_names(attrs, {'alpha' : 'slope'}) else: new_attrs = translation_utils._add_extra_attributes(attrs, {'slope': 0.01}) return 'LeakyReLU', new_attrs, inputs
def leaky_relu(attrs, inputs, cls):
"""Leaky Relu function""" if 'alpha' in attrs: new_attrs = translation_utils._fix_attribute_names(attrs, {'alpha' : 'slope'}) else: new_attrs = translation_utils._add_extra_attributes(attrs, {'slope': 0.01}) return 'LeakyReLU', new_attrs, inputs
nn_off': 1}) # in test mode "fix_gamma" should be unset. new_attrs['fix_gamma'] = 0 if new_attrs['fix_gamma'] == 1 else 1 return 'BatchNorm', new_attrs, inputs def leaky_relu(attrs, inputs, cls):
64
64
83
10
53
eeqmcc/SNIPER-mxnet
python/mxnet/contrib/onnx/_import/op_translations.py
Python
leaky_relu
leaky_relu
178
184
178
178
d0f8b31e06eb80f230ca752308490e9f311f9eb6
bigcode/the-stack
train
8bf2fb4efeb8a0ba5aae2e2c
train
function
def random_normal(attrs, inputs, cls): """Draw random samples from a Gaussian distribution.""" new_attr = translation_utils._remove_attributes(attrs, ['seed']) new_attr = translation_utils._fix_attribute_names(new_attr, {'mean' : 'loc'}) return 'random_uniform', new_attr, inputs
def random_normal(attrs, inputs, cls):
"""Draw random samples from a Gaussian distribution.""" new_attr = translation_utils._remove_attributes(attrs, ['seed']) new_attr = translation_utils._fix_attribute_names(new_attr, {'mean' : 'loc'}) return 'random_uniform', new_attr, inputs
return 'identity', attrs, inputs def random_uniform(attrs, inputs, cls): """Draw random samples from a uniform distribtuion.""" new_attr = translation_utils._remove_attributes(attrs, ['seed']) return 'random_uniform', new_attr, inputs def random_normal(attrs, inputs, cls):
64
64
64
9
54
eeqmcc/SNIPER-mxnet
python/mxnet/contrib/onnx/_import/op_translations.py
Python
random_normal
random_normal
35
39
35
35
57bf6f9d3e37f5e5fdfd813bc7f62be2c10e1618
bigcode/the-stack
train
7e12bde83d5cb98664ec2ad2
train
function
def identity(attrs, inputs, cls): """Returns the identity function of the the input.""" return 'identity', attrs, inputs
def identity(attrs, inputs, cls):
"""Returns the identity function of the the input.""" return 'identity', attrs, inputs
: utf-8 """ Module for translating ONNX operators into Mxnet operatoes""" # pylint: disable=unused-argument,protected-access from . import translation_utils from .... import symbol # Method definitions for the callable objects mapped in the import_helper module def identity(attrs, inputs, cls):
64
64
28
8
55
eeqmcc/SNIPER-mxnet
python/mxnet/contrib/onnx/_import/op_translations.py
Python
identity
identity
26
28
26
26
e27c06f4df43f1319588a70da23372fc3e60c9c0
bigcode/the-stack
train
685d2c254a4440c08c7599ee
train
function
def deconv(attrs, inputs, cls): """Compute N-D convolution on (N+2)-D input.""" new_attrs = translation_utils._fix_attribute_names(attrs, {'kernel_shape' : 'kernel', 'strides' : 'stride', ...
def deconv(attrs, inputs, cls):
"""Compute N-D convolution on (N+2)-D input.""" new_attrs = translation_utils._fix_attribute_names(attrs, {'kernel_shape' : 'kernel', 'strides' : 'stride', 'pads': 'pad', ...
' : 1}) new_attrs = translation_utils._fix_bias('Convolution', new_attrs, len(inputs)) new_attrs = translation_utils._fix_channels('Convolution', new_attrs, inputs, cls) return 'Convolution', new_attrs, inputs def deconv(attrs, inputs, cls):
64
64
151
9
54
eeqmcc/SNIPER-mxnet
python/mxnet/contrib/onnx/_import/op_translations.py
Python
deconv
deconv
221
233
221
221
183a587cf715501df8790524f8cdd562a2646108
bigcode/the-stack
train
ebfd7123428d25c7ba8bddfc
train
function
def reduce_prod(attrs, inputs, cls): """Reduce the array along a given axis by mean value""" new_attrs = translation_utils._fix_attribute_names(attrs, {'axes':'axis'}) return 'prod', new_attrs, inputs
def reduce_prod(attrs, inputs, cls):
"""Reduce the array along a given axis by mean value""" new_attrs = translation_utils._fix_attribute_names(attrs, {'axes':'axis'}) return 'prod', new_attrs, inputs
', new_attrs, inputs def reduce_sum(attrs, inputs, cls): """Reduce the array along a given axis by mean value""" new_attrs = translation_utils._fix_attribute_names(attrs, {'axes':'axis'}) return 'sum', new_attrs, inputs def reduce_prod(attrs, inputs, cls):
64
64
49
9
54
eeqmcc/SNIPER-mxnet
python/mxnet/contrib/onnx/_import/op_translations.py
Python
reduce_prod
reduce_prod
412
415
412
412
4a6525395bc9951a86249e3ef843c211d76c1c5b
bigcode/the-stack
train
028005d85ea1c9806688a580
train
function
def floor(attrs, inputs, cls): """ Calculate floor value for input """ return 'floor', attrs, inputs
def floor(attrs, inputs, cls):
""" Calculate floor value for input """ return 'floor', attrs, inputs
inputs, cls): """Returns the hyperbolic tangent of the input array.""" return 'tanh', attrs, inputs # Rounding def ceil(attrs, inputs, cls): """ Calculate ceil value for input """ return 'ceil', attrs, inputs def floor(attrs, inputs, cls):
64
64
25
8
55
eeqmcc/SNIPER-mxnet
python/mxnet/contrib/onnx/_import/op_translations.py
Python
floor
floor
133
135
133
133
6c79f18502333b83d7fcd82b9ac7d7f2ea189b14
bigcode/the-stack
train
f2c074d983a944bdbdbfd706
train
function
def fully_connected(attrs, inputs, cls): """Applies a linear transformation: Y=XWT+b.""" new_attrs = translation_utils._remove_attributes(attrs, ['axis']) new_attrs = translation_utils._fix_bias('FullyConnected', new_attrs, len(inputs)) new_attrs = translation_utils._fix_channels('FullyConnected', new...
def fully_connected(attrs, inputs, cls):
"""Applies a linear transformation: Y=XWT+b.""" new_attrs = translation_utils._remove_attributes(attrs, ['axis']) new_attrs = translation_utils._fix_bias('FullyConnected', new_attrs, len(inputs)) new_attrs = translation_utils._fix_channels('FullyConnected', new_attrs, inputs, cls) return 'FullyCo...
1}) new_attrs = translation_utils._fix_bias('Deconvolution', new_attrs, len(inputs)) new_attrs = translation_utils._fix_channels('Deconvolution', new_attrs, inputs, cls) return 'Convolution', new_attrs, inputs def fully_connected(attrs, inputs, cls):
64
64
86
9
54
eeqmcc/SNIPER-mxnet
python/mxnet/contrib/onnx/_import/op_translations.py
Python
fully_connected
fully_connected
236
244
236
236
abb1f3cd9281e65aa728b0e09a24cd7c142c398d
bigcode/the-stack
train
a50262d86c42bec7c95345f8
train
function
def _prelu(attrs, inputs, cls): """PRelu function""" new_attrs = translation_utils._add_extra_attributes(attrs, {'act_type': 'prelu'}) return 'LeakyReLU', new_attrs, inputs
def _prelu(attrs, inputs, cls):
"""PRelu function""" new_attrs = translation_utils._add_extra_attributes(attrs, {'act_type': 'prelu'}) return 'LeakyReLU', new_attrs, inputs
new_attrs = translation_utils._add_extra_attributes(attrs, {'slope': 1.0}) new_attrs = translation_utils._add_extra_attributes(new_attrs, {'act_type': 'elu'}) return 'LeakyReLU', new_attrs, inputs def _prelu(attrs, inputs, cls):
64
64
50
10
53
eeqmcc/SNIPER-mxnet
python/mxnet/contrib/onnx/_import/op_translations.py
Python
_prelu
_prelu
195
198
195
195
1c9a768ff81d69db170e5281b16276ef94d1f3e4
bigcode/the-stack
train
2599598da971972ff0f86eb4
train
function
def power(attrs, inputs, cls): """Returns element-wise result of base element raised to powers from exp element.""" new_attrs = translation_utils._fix_attribute_names(attrs, {'exponent':'exp'}) if 'broadcast' in attrs and attrs['broadcast'] == 1: new_attrs = translation_utils._remove_attributes(new_...
def power(attrs, inputs, cls):
"""Returns element-wise result of base element raised to powers from exp element.""" new_attrs = translation_utils._fix_attribute_names(attrs, {'exponent':'exp'}) if 'broadcast' in attrs and attrs['broadcast'] == 1: new_attrs = translation_utils._remove_attributes(new_attrs, ['broadcast']) r...
cls): """Returns the reciprocal of the argument, element-wise.""" return 'reciprocal', attrs, inputs def squareroot(attrs, inputs, cls): """Returns element-wise square-root value of the input.""" return 'sqrt', attrs, inputs def power(attrs, inputs, cls):
64
64
94
8
55
eeqmcc/SNIPER-mxnet
python/mxnet/contrib/onnx/_import/op_translations.py
Python
power
power
375
381
375
375
6e0aba13a78637014221473a851498dcad431dc8
bigcode/the-stack
train
09d41f600a8279c8846433e2
train
function
def linalg_gemm(attrs, inputs, cls): """Performs general matrix multiplication and accumulation""" trans_a = 0 trans_b = 0 alpha = 1 beta = 1 if 'transA' in attrs: trans_a = attrs['transA'] if 'transB' in attrs: trans_b = attrs['transB'] if 'alpha' in attrs: alpha...
def linalg_gemm(attrs, inputs, cls):
"""Performs general matrix multiplication and accumulation""" trans_a = 0 trans_b = 0 alpha = 1 beta = 1 if 'transA' in attrs: trans_a = attrs['transA'] if 'transB' in attrs: trans_b = attrs['transB'] if 'alpha' in attrs: alpha = attrs['alpha'] if 'beta' in at...
, cls): """Performs avg pooling on the input.""" new_attrs = translation_utils._add_extra_attributes(attrs, {'global_pool': True, 'kernel': (1, 1), 'pool_type': 'avg'}) return 'Poo...
70
70
235
11
58
eeqmcc/SNIPER-mxnet
python/mxnet/contrib/onnx/_import/op_translations.py
Python
linalg_gemm
linalg_gemm
263
285
263
263
1f0addd4de1023e936b93b69e9d682662b2ffa66
bigcode/the-stack
train
0c4eb9b103a0612cab69ce93
train
function
def global_maxpooling(attrs, inputs, cls): """Performs max pooling on the input.""" new_attrs = translation_utils._add_extra_attributes(attrs, {'global_pool': True, 'kernel': (1, 1), '...
def global_maxpooling(attrs, inputs, cls):
"""Performs max pooling on the input.""" new_attrs = translation_utils._add_extra_attributes(attrs, {'global_pool': True, 'kernel': (1, 1), 'pool_type': 'max'}) return 'Pooling', n...
['axis']) new_attrs = translation_utils._fix_bias('FullyConnected', new_attrs, len(inputs)) new_attrs = translation_utils._fix_channels('FullyConnected', new_attrs, inputs, cls) return 'FullyConnected', new_attrs, inputs def global_maxpooling(attrs, inputs, cls):
64
64
67
11
52
eeqmcc/SNIPER-mxnet
python/mxnet/contrib/onnx/_import/op_translations.py
Python
global_maxpooling
global_maxpooling
247
252
247
247
0725c84d3e31ca8e2e37a540bd52b3f2c817b998
bigcode/the-stack
train
25de2cab0f888c5d604538fc
train
function
def batch_norm(attrs, inputs, cls): """Batch normalization.""" new_attrs = translation_utils._fix_attribute_names(attrs, {'epsilon' : 'eps', 'is_test':'fix_gamma'}) new_attrs = translation_utils._remove_attributes(new_attrs, ...
def batch_norm(attrs, inputs, cls):
"""Batch normalization.""" new_attrs = translation_utils._fix_attribute_names(attrs, {'epsilon' : 'eps', 'is_test':'fix_gamma'}) new_attrs = translation_utils._remove_attributes(new_attrs, ['s...
translation_utils._pad_sequence_fix(new_attrs.get('pad_width')) return 'pad', new_attrs, inputs def matrix_multiplication(attrs, inputs, cls): """Performs general matrix multiplication""" return 'linalg_gemm2', attrs, inputs def batch_norm(attrs, inputs, cls):
64
64
133
9
54
eeqmcc/SNIPER-mxnet
python/mxnet/contrib/onnx/_import/op_translations.py
Python
batch_norm
batch_norm
165
175
165
165
9349f5fe4640d50970c459152ea8fb497c3bd18b
bigcode/the-stack
train
bb548688aafb3c7707f0daf4
train
function
def absolute(attrs, inputs, cls): """Returns element-wise absolute value of the input.""" return 'abs', attrs, inputs
def absolute(attrs, inputs, cls):
"""Returns element-wise absolute value of the input.""" return 'abs', attrs, inputs
(attrs, inputs, cls): """Divide two tensors""" new_attr = {} if 'broadcast' in attrs and attrs['broadcast'] == 1: return 'broadcast_div', new_attr, inputs return 'elemwise_div', new_attr, inputs def absolute(attrs, inputs, cls):
64
64
28
8
55
eeqmcc/SNIPER-mxnet
python/mxnet/contrib/onnx/_import/op_translations.py
Python
absolute
absolute
73
75
73
73
ba6ef5391d1f4d24e78545e2f77ed3c6fdc3a4de
bigcode/the-stack
train
eb1450a39aac33d40e5c42c4
train
function
def reshape(attrs, inputs, cls): """Reshape the given array by the shape attribute.""" return 'reshape', attrs, inputs
def reshape(attrs, inputs, cls):
"""Reshape the given array by the shape attribute.""" return 'reshape', attrs, inputs
ratio': 'p'}) new_attrs = translation_utils._remove_attributes(new_attrs, ['is_test']) new_attrs = translation_utils._add_extra_attributes(new_attrs, {'mode': mode}) return 'Dropout', new_attrs, inputs # Changing shape and type. def reshape(attrs, inputs, cls):
64
64
29
8
56
eeqmcc/SNIPER-mxnet
python/mxnet/contrib/onnx/_import/op_translations.py
Python
reshape
reshape
306
308
306
306
179f9d34e570240cecacb3430522f9bee1b825e1
bigcode/the-stack
train
d2d676738f925219d65ba916
train
function
def squeeze(attrs, inputs, cls): """Remove single-dimensional entries from the shape of a tensor.""" # MXNet doesnt have a squeeze operator. # Using "split" to perform similar operation. new_attrs = translation_utils._fix_attribute_names(attrs, {'ax...
def squeeze(attrs, inputs, cls):
"""Remove single-dimensional entries from the shape of a tensor.""" # MXNet doesnt have a squeeze operator. # Using "split" to perform similar operation. new_attrs = translation_utils._fix_attribute_names(attrs, {'axes' : 'axis'}) axes = new_att...
]) return slice_op, new_attrs, inputs def transpose(attrs, inputs, cls): """Transpose the input array.""" new_attrs = translation_utils._fix_attribute_names(attrs, {'perm' : 'axes'}) return 'transpose', new_attrs, inputs def squeeze(attrs, inputs, ...
64
64
144
8
55
eeqmcc/SNIPER-mxnet
python/mxnet/contrib/onnx/_import/op_translations.py
Python
squeeze
squeeze
345
355
345
345
362291012c865cde669e8773a793efb4e6b319d0
bigcode/the-stack
train
dd1c99cc5c8a5b83f80a4877
train
function
def cast(attrs, inputs, cls): """ Cast input to a given dtype""" new_attrs = translation_utils._fix_attribute_names(attrs, {'to' : 'dtype'}) new_attrs['dtype'] = new_attrs['dtype'].lower() return 'cast', new_attrs, inputs
def cast(attrs, inputs, cls):
""" Cast input to a given dtype""" new_attrs = translation_utils._fix_attribute_names(attrs, {'to' : 'dtype'}) new_attrs['dtype'] = new_attrs['dtype'].lower() return 'cast', new_attrs, inputs
_extra_attributes(new_attrs, {'mode': mode}) return 'Dropout', new_attrs, inputs # Changing shape and type. def reshape(attrs, inputs, cls): """Reshape the given array by the shape attribute.""" return 'reshape', attrs, inputs def cast(attrs, inputs, cls):
64
64
60
8
55
eeqmcc/SNIPER-mxnet
python/mxnet/contrib/onnx/_import/op_translations.py
Python
cast
cast
310
314
310
310
575a97cd439a83a23cef6b0489459d2f1372b309
bigcode/the-stack
train
ab28a456e2b0ed678159ecff
train
function
def tanh(attrs, inputs, cls): """Returns the hyperbolic tangent of the input array.""" return 'tanh', attrs, inputs
def tanh(attrs, inputs, cls):
"""Returns the hyperbolic tangent of the input array.""" return 'tanh', attrs, inputs
[1]) for op_input in inputs[2:]: mxnet_op = symbol.minimum(mxnet_op, op_input) else: mxnet_op = inputs[0] return mxnet_op, attrs, inputs #Hyperbolic functions def tanh(attrs, inputs, cls):
64
64
32
9
54
eeqmcc/SNIPER-mxnet
python/mxnet/contrib/onnx/_import/op_translations.py
Python
tanh
tanh
124
126
124
124
7b312fdc2e28b78d4cfcf9ab114bb8dc05b3003a
bigcode/the-stack
train
f3d656b0acef3508bcc0e782
train
function
def ceil(attrs, inputs, cls): """ Calculate ceil value for input """ return 'ceil', attrs, inputs
def ceil(attrs, inputs, cls):
""" Calculate ceil value for input """ return 'ceil', attrs, inputs
inputs[0] return mxnet_op, attrs, inputs #Hyperbolic functions def tanh(attrs, inputs, cls): """Returns the hyperbolic tangent of the input array.""" return 'tanh', attrs, inputs # Rounding def ceil(attrs, inputs, cls):
64
64
25
8
55
eeqmcc/SNIPER-mxnet
python/mxnet/contrib/onnx/_import/op_translations.py
Python
ceil
ceil
129
131
129
129
b91a6a9d5d32214b68d5423701178f36e774da5a
bigcode/the-stack
train
7bd1848a91411c6ae573013e
train
function
def argmax(attrs, inputs, cls): """Returns indices of the maximum values along an axis""" return 'argmax', attrs, inputs
def argmax(attrs, inputs, cls):
"""Returns indices of the maximum values along an axis""" return 'argmax', attrs, inputs
, cls): """Negation of every element in a tensor""" return 'negative', attrs, inputs def add_n(attrs, inputs, cls): """Elementwise sum of arrays""" return 'add_n', attrs, inputs # Sorting and Searching def argmax(attrs, inputs, cls):
64
64
31
9
54
eeqmcc/SNIPER-mxnet
python/mxnet/contrib/onnx/_import/op_translations.py
Python
argmax
argmax
86
88
86
86
c7bcbe7c9f2297fb3decaa3cc131dac993b0c925
bigcode/the-stack
train
c47e5924d8e4f67800786062
train
function
def global_avgpooling(attrs, inputs, cls): """Performs avg pooling on the input.""" new_attrs = translation_utils._add_extra_attributes(attrs, {'global_pool': True, 'kernel': (1, 1), '...
def global_avgpooling(attrs, inputs, cls):
"""Performs avg pooling on the input.""" new_attrs = translation_utils._add_extra_attributes(attrs, {'global_pool': True, 'kernel': (1, 1), 'pool_type': 'avg'}) return 'Pooling', n...
forms max pooling on the input.""" new_attrs = translation_utils._add_extra_attributes(attrs, {'global_pool': True, 'kernel': (1, 1), 'pool_type': 'max'}) return 'Pooling', new_attrs, ...
64
64
67
11
52
eeqmcc/SNIPER-mxnet
python/mxnet/contrib/onnx/_import/op_translations.py
Python
global_avgpooling
global_avgpooling
255
260
255
255
388a2011b3c90c0e50749a011d5cabf106379c81
bigcode/the-stack
train
8028ce85bc8d3fdbfad59f63
train
function
def minimum(attrs, inputs, cls): """Elementwise minimum of arrays.""" # MXNet minimum compares only two symbols at a time. # ONNX can send more than two to compare. # Breaking into multiple mxnet ops to compare two symbols at a time if len(inputs) > 1: mxnet_op = symbol.minimum(inputs[0], in...
def minimum(attrs, inputs, cls):
"""Elementwise minimum of arrays.""" # MXNet minimum compares only two symbols at a time. # ONNX can send more than two to compare. # Breaking into multiple mxnet ops to compare two symbols at a time if len(inputs) > 1: mxnet_op = symbol.minimum(inputs[0], inputs[1]) for op_input in ...
symbol.maximum(inputs[0], inputs[1]) for op_input in inputs[2:]: mxnet_op = symbol.maximum(mxnet_op, op_input) else: mxnet_op = inputs[0] return mxnet_op, attrs, inputs def minimum(attrs, inputs, cls):
64
64
127
8
55
eeqmcc/SNIPER-mxnet
python/mxnet/contrib/onnx/_import/op_translations.py
Python
minimum
minimum
110
121
110
110
8bab2dcbf1bfeeb08ddca55fc217343ae5f85d38
bigcode/the-stack
train
74b517ad87ad1ffb2ed3b309
train
function
def sigmoid(attrs, inputs, cls): """Computes elementwise sigmoid of the input array""" return 'sigmoid', attrs, inputs
def sigmoid(attrs, inputs, cls):
"""Computes elementwise sigmoid of the input array""" return 'sigmoid', attrs, inputs
ing def concat(attrs, inputs, cls): """ Joins input arrays along a given axis. """ new_attrs = translation_utils._fix_attribute_names(attrs, {'axis': 'dim'}) return 'concat', new_attrs, inputs # Basic neural network functions def sigmoid(attrs, inputs, cls):
64
64
30
8
55
eeqmcc/SNIPER-mxnet
python/mxnet/contrib/onnx/_import/op_translations.py
Python
sigmoid
sigmoid
145
147
145
145
2294a5349173b09da6a27103f810d210e83584cf
bigcode/the-stack
train
ba79d8fcfec2598dfd4683e0
train
function
def conv(attrs, inputs, cls): """Compute N-D convolution on (N+2)-D input.""" new_attrs = translation_utils._fix_attribute_names(attrs, {'kernel_shape' : 'kernel', 'strides' : 'stride', ...
def conv(attrs, inputs, cls):
"""Compute N-D convolution on (N+2)-D input.""" new_attrs = translation_utils._fix_attribute_names(attrs, {'kernel_shape' : 'kernel', 'strides' : 'stride', 'pads': 'pad', ...
new_attrs, inputs def softmax(attrs, inputs, cls): """Softmax function.""" if 'axis' not in attrs: attrs = translation_utils._add_extra_attributes(attrs, {'axis': 1}) return 'softmax', attrs, inputs def conv(attrs, inputs, cls):
64
64
148
8
55
eeqmcc/SNIPER-mxnet
python/mxnet/contrib/onnx/_import/op_translations.py
Python
conv
conv
206
218
206
206
d5c62447d80dc580142ec3fc715b09c5030538bf
bigcode/the-stack
train
ac6ebbe7a9767b4296405d8e
train
function
def _elu(attrs, inputs, cls): """Elu function""" if 'alpha' in attrs: new_attrs = translation_utils._fix_attribute_names(attrs, {'alpha' : 'slope'}) else: new_attrs = translation_utils._add_extra_attributes(attrs, {'slope': 1.0}) new_attrs = translation_utils._add_extra_attributes(new_at...
def _elu(attrs, inputs, cls):
"""Elu function""" if 'alpha' in attrs: new_attrs = translation_utils._fix_attribute_names(attrs, {'alpha' : 'slope'}) else: new_attrs = translation_utils._add_extra_attributes(attrs, {'slope': 1.0}) new_attrs = translation_utils._add_extra_attributes(new_attrs, {'act_type': 'elu'}) ...
_attrs = translation_utils._fix_attribute_names(attrs, {'alpha' : 'slope'}) else: new_attrs = translation_utils._add_extra_attributes(attrs, {'slope': 0.01}) return 'LeakyReLU', new_attrs, inputs def _elu(attrs, inputs, cls):
64
64
100
9
54
eeqmcc/SNIPER-mxnet
python/mxnet/contrib/onnx/_import/op_translations.py
Python
_elu
_elu
186
193
186
186
9de023a7df051f4d51f603a663628d02a3386e01
bigcode/the-stack
train
556e8e29d531b0f646995b09
train
function
def dropout(attrs, inputs, cls): """Dropout Regularization.""" mode = 'training' if attrs['is_test'] == 0: mode = 'always' new_attrs = translation_utils._fix_attribute_names(attrs, {'ratio': 'p'}) new_attrs = translation_utils._remove_at...
def dropout(attrs, inputs, cls):
"""Dropout Regularization.""" mode = 'training' if attrs['is_test'] == 0: mode = 'always' new_attrs = translation_utils._fix_attribute_names(attrs, {'ratio': 'p'}) new_attrs = translation_utils._remove_attributes(new_attrs, ['is_test']) ...
local_response_norm(attrs, inputs, cls): """Local Response Normalization.""" new_attrs = translation_utils._fix_attribute_names(attrs, {'bias': 'knorm', 'size' : 'nsize'}) return 'LRN', new_attrs,...
64
64
102
8
55
eeqmcc/SNIPER-mxnet
python/mxnet/contrib/onnx/_import/op_translations.py
Python
dropout
dropout
294
303
294
294
0a99b16f05acfc2867ead4ae8fe79863e4779e98
bigcode/the-stack
train
2df69e3e21d12c29a070001f
train
function
def split(attrs, inputs, cls): """Splits an array along a particular axis into multiple sub-arrays.""" new_attrs = translation_utils._fix_attribute_names(attrs, {'split' : 'num_outputs'}) return 'split', new_attrs, inputs
def split(attrs, inputs, cls):
"""Splits an array along a particular axis into multiple sub-arrays.""" new_attrs = translation_utils._fix_attribute_names(attrs, {'split' : 'num_outputs'}) return 'split', new_attrs, inputs
inputs, cls): """ Cast input to a given dtype""" new_attrs = translation_utils._fix_attribute_names(attrs, {'to' : 'dtype'}) new_attrs['dtype'] = new_attrs['dtype'].lower() return 'cast', new_attrs, inputs def split(attrs, inputs, cls):
64
64
55
8
55
eeqmcc/SNIPER-mxnet
python/mxnet/contrib/onnx/_import/op_translations.py
Python
split
split
316
320
316
316
c12ac64afdcae13f3330de7dca23de881158c489
bigcode/the-stack
train
5229af29d2ce8b085022dbff
train
function
def reduce_mean(attrs, inputs, cls): """Reduce the array along a given axis by mean value""" new_attrs = translation_utils._fix_attribute_names(attrs, {'axes':'axis'}) return 'mean', new_attrs, inputs
def reduce_mean(attrs, inputs, cls):
"""Reduce the array along a given axis by mean value""" new_attrs = translation_utils._fix_attribute_names(attrs, {'axes':'axis'}) return 'mean', new_attrs, inputs
inputs # Reduce Functions def reduce_max(attrs, inputs, cls): """Reduce the array along a given axis by maximum value""" new_attrs = translation_utils._fix_attribute_names(attrs, {'axes':'axis'}) return 'max', new_attrs, inputs def reduce_mean(attrs, inputs, cls):
64
64
49
9
54
eeqmcc/SNIPER-mxnet
python/mxnet/contrib/onnx/_import/op_translations.py
Python
reduce_mean
reduce_mean
397
400
397
397
ec4c854005cde7505579a446532882493f763841
bigcode/the-stack
train
cd43470c4259fb2c621fc5e0
train
function
def softmax(attrs, inputs, cls): """Softmax function.""" if 'axis' not in attrs: attrs = translation_utils._add_extra_attributes(attrs, {'axis': 1}) return 'softmax', attrs, inputs
def softmax(attrs, inputs, cls):
"""Softmax function.""" if 'axis' not in attrs: attrs = translation_utils._add_extra_attributes(attrs, {'axis': 1}) return 'softmax', attrs, inputs
new_attrs, inputs def _prelu(attrs, inputs, cls): """PRelu function""" new_attrs = translation_utils._add_extra_attributes(attrs, {'act_type': 'prelu'}) return 'LeakyReLU', new_attrs, inputs def softmax(attrs, inputs, cls):
64
64
51
9
54
eeqmcc/SNIPER-mxnet
python/mxnet/contrib/onnx/_import/op_translations.py
Python
softmax
softmax
200
204
200
200
4f590aa8ed3970b144a3249332b0600aa4cb55e4
bigcode/the-stack
train
d57463e4cb3476bda8350a96
train
function
def reduce_sum(attrs, inputs, cls): """Reduce the array along a given axis by mean value""" new_attrs = translation_utils._fix_attribute_names(attrs, {'axes':'axis'}) return 'sum', new_attrs, inputs
def reduce_sum(attrs, inputs, cls):
"""Reduce the array along a given axis by mean value""" new_attrs = translation_utils._fix_attribute_names(attrs, {'axes':'axis'}) return 'sum', new_attrs, inputs
', new_attrs, inputs def reduce_min(attrs, inputs, cls): """Reduce the array along a given axis by mean value""" new_attrs = translation_utils._fix_attribute_names(attrs, {'axes':'axis'}) return 'min', new_attrs, inputs def reduce_sum(attrs, inputs, cls):
64
64
49
9
54
eeqmcc/SNIPER-mxnet
python/mxnet/contrib/onnx/_import/op_translations.py
Python
reduce_sum
reduce_sum
407
410
407
407
259744d5ce1dda2b1bf37ea1e07d0d8d435d4230
bigcode/the-stack
train
5bca778c6e7e3150a364b35c
train
function
def pad(attrs, inputs, cls): """ Add padding to input tensor""" new_attrs = translation_utils._fix_attribute_names(attrs, {'pads' : 'pad_width', 'value' : 'constant_value' }) new_att...
def pad(attrs, inputs, cls):
""" Add padding to input tensor""" new_attrs = translation_utils._fix_attribute_names(attrs, {'pads' : 'pad_width', 'value' : 'constant_value' }) new_attrs['pad_width'] = translation...
sigmoid(attrs, inputs, cls): """Computes elementwise sigmoid of the input array""" return 'sigmoid', attrs, inputs def relu(attrs, inputs, cls): """Computes rectified linear function.""" return 'relu', attrs, inputs def pad(attrs, inputs, cls):
64
64
79
8
55
eeqmcc/SNIPER-mxnet
python/mxnet/contrib/onnx/_import/op_translations.py
Python
pad
pad
153
159
153
153
19ffae0e5f5eaadd6092bddec42d1d7c0922293a
bigcode/the-stack
train
9600870038a219490618d4ba
train
function
def squareroot(attrs, inputs, cls): """Returns element-wise square-root value of the input.""" return 'sqrt', attrs, inputs
def squareroot(attrs, inputs, cls):
"""Returns element-wise square-root value of the input.""" return 'sqrt', attrs, inputs
_utils._remove_attributes(attrs, ['axis']) return 'Flatten', new_attrs, inputs #Powers def reciprocal(attrs, inputs, cls): """Returns the reciprocal of the argument, element-wise.""" return 'reciprocal', attrs, inputs def squareroot(attrs, inputs, cls):
64
64
31
10
53
eeqmcc/SNIPER-mxnet
python/mxnet/contrib/onnx/_import/op_translations.py
Python
squareroot
squareroot
371
373
371
371
e57ba73b8b54aa97ece400c4973aa5d54e95fe87
bigcode/the-stack
train
571c4133f321779e904ffbdd
train
class
class StatusException(with_metaclass(StatusType, Status, Exception)): u"""This class represents a small HTTP Response message for error handling purposes""" @property def headers(self): return self._headers @property def body(self): if not hasattr(self, '_body'): from httoop.messages.body import Body ...
class StatusException(with_metaclass(StatusType, Status, Exception)):
u"""This class represents a small HTTP Response message for error handling purposes""" @property def headers(self): return self._headers @property def body(self): if not hasattr(self, '_body'): from httoop.messages.body import Body self._body = Body(mimetype='application/json') self._body.data = s...
'ServerErrorStatus' else: raise RuntimeError('A HTTP Status code can not be greater than 599 or lower than 100') if code and not any(scls == base.__name__ for base in bases): raise RuntimeError('%s must inherit from %s' % (name, scls)) reason = REASONS.get(code, ('', '')) dict_.setdefault('reason', rea...
138
139
465
13
125
spaceone/httoop
httoop/status/types.py
Python
StatusException
StatusException
37
123
37
37
99cc76e244a0ed26854b09308587f8ae9f27ddbf
bigcode/the-stack
train
cb36b02b05efd1856a8d8764
train
class
class StatusType(HTTPSemantic): def __new__(cls, name, bases, dict_): code = int(dict_.get('code', 0)) if 99 < code < 200: scls = 'InformationalStatus' elif code < 300: scls = 'SuccessStatus' elif code < 400: scls = 'RedirectStatus' elif code < 500: scls = 'ClientErrorStatus' elif code < 600: ...
class StatusType(HTTPSemantic):
def __new__(cls, name, bases, dict_): code = int(dict_.get('code', 0)) if 99 < code < 200: scls = 'InformationalStatus' elif code < 300: scls = 'SuccessStatus' elif code < 400: scls = 'RedirectStatus' elif code < 500: scls = 'ClientErrorStatus' elif code < 600: scls = 'ServerErrorStatus' e...
-*- coding: utf-8 -*- """HTTP status codes .. seealso:: :rfc:`2616#section-10`""" from httoop.meta import HTTPSemantic from httoop.six import with_metaclass from httoop.status.status import REASONS, Status class StatusType(HTTPSemantic):
70
70
235
8
61
spaceone/httoop
httoop/status/types.py
Python
StatusType
StatusType
11
34
11
12
f8c5c04414e4aca168e9141198f617189c425c51
bigcode/the-stack
train
0a7b7c61eeaf6178e5d8d335
train
function
def _to_json(dct): """convert keys to str, py2 and py3""" if isinstance(dct, dict): return {str(key).replace(' ',''):dct[key] for key in dct} return dct
def _to_json(dct):
"""convert keys to str, py2 and py3""" if isinstance(dct, dict): return {str(key).replace(' ',''):dct[key] for key in dct} return dct
import json # Author: Chris Petrich # Date: Apr 2018 # massively reduced version of the original version # maintaining original interface of save() def _to_json(dct):
42
64
53
7
35
cpetrich/q-learning-car
src/save_load.py
Python
_to_json
_to_json
9
13
9
9
63646022e4b24feacc8e44f23c7a9b4b7d34c245
bigcode/the-stack
train
545713c54316aa49696d1948
train
function
def load(filename): # remove .py and add .json filename = filename[:-3] if filename.lower().endswith('.py') else filename filename = filename if filename.lower().endswith('.json') else filename+'.json' with open(filename) as f: data=json.load(f) return {'data':{key:_from_json(data[key]) for ...
def load(filename): # remove .py and add .json
filename = filename[:-3] if filename.lower().endswith('.py') else filename filename = filename if filename.lower().endswith('.json') else filename+'.json' with open(filename) as f: data=json.load(f) return {'data':{key:_from_json(data[key]) for key in data}}
().endswith('.json') else filename+'.json' with open(filename,'w') as f: json.dump({outer_key:_to_json(data_dict[outer_key]) for outer_key in data_dict}, f, separators=(',', ':')) def load(filename): # remove .py and add .json
64
64
83
14
50
cpetrich/q-learning-car
src/save_load.py
Python
load
load
37
43
37
38
fb9f65a828132941b4e7c4ebac671ff1fecf86f9
bigcode/the-stack
train
6a4c877921070ef9762f8651
train
function
def _str2inttuple(s): """parse string as tuple of integers""" return tuple([int(v) for v in s.split('(',1)[1].split(')',1)[0].split(',')])
def _str2inttuple(s):
"""parse string as tuple of integers""" return tuple([int(v) for v in s.split('(',1)[1].split(')',1)[0].split(',')])
of save() def _to_json(dct): """convert keys to str, py2 and py3""" if isinstance(dct, dict): return {str(key).replace(' ',''):dct[key] for key in dct} return dct def _str2inttuple(s):
64
64
46
8
55
cpetrich/q-learning-car
src/save_load.py
Python
_str2inttuple
_str2inttuple
15
17
15
15
b37b3d2a4009cef4babaa98d066a6d397f55ade7
bigcode/the-stack
train
f91ab067454d9c5db5283fe7
train
function
def _from_json(dct): """convert string keys back to tuples""" if not isinstance(dct, dict): return dct for key in dct: break if isinstance(key, str) and key.startswith('('): return {_str2inttuple(key): dct[key] for key in dct} return dct
def _from_json(dct):
"""convert string keys back to tuples""" if not isinstance(dct, dict): return dct for key in dct: break if isinstance(key, str) and key.startswith('('): return {_str2inttuple(key): dct[key] for key in dct} return dct
for key in dct} return dct def _str2inttuple(s): """parse string as tuple of integers""" return tuple([int(v) for v in s.split('(',1)[1].split(')',1)[0].split(',')]) def _from_json(dct):
64
64
76
7
57
cpetrich/q-learning-car
src/save_load.py
Python
_from_json
_from_json
19
26
19
19
379bda12faa67f6528c9216174170e1075ffc8a3
bigcode/the-stack
train
adfa805f9801bef6b1c86b1f
train
function
def save(filename, head_module, data_dict): """Outputs only data_dict""" # NB: zipping this up could reduce space to 30%. # remove .py and add .json filename = filename[:-3] if filename.lower().endswith('.py') else filename filename = filename if filename.lower().endswith('.json') else filename+'.js...
def save(filename, head_module, data_dict):
"""Outputs only data_dict""" # NB: zipping this up could reduce space to 30%. # remove .py and add .json filename = filename[:-3] if filename.lower().endswith('.py') else filename filename = filename if filename.lower().endswith('.json') else filename+'.json' with open(filename,'w') as f: ...
, dict): return dct for key in dct: break if isinstance(key, str) and key.startswith('('): return {_str2inttuple(key): dct[key] for key in dct} return dct def save(filename, head_module, data_dict):
64
64
118
10
53
cpetrich/q-learning-car
src/save_load.py
Python
save
save
28
35
28
28
1bb6577366b973c7f82a0f68032a998c65de8b3b
bigcode/the-stack
train
10339e65767881ce725223f4
train
class
class DeleteNotificationTopicV1Admin(Operation): """delete topic information by topic name (deleteNotificationTopicV1Admin) Required permission : `ADMIN:NAMESPACE:{namespace}:NOTIFICATION [DELETE]` with scope `social` delete topic information by topic name. topic should be alphabets, no special char ...
class DeleteNotificationTopicV1Admin(Operation):
"""delete topic information by topic name (deleteNotificationTopicV1Admin) Required permission : `ADMIN:NAMESPACE:{namespace}:NOTIFICATION [DELETE]` with scope `social` delete topic information by topic name. topic should be alphabets, no special char except underscore, uppercase and no spacing. for ...
2021 AccelByte Inc. All Rights Reserved. # This is licensed software from AccelByte Inc, for limitations # and restrictions contact your company contract manager. # # Code generated. DO NOT EDIT! # template file: justice_py_sdk_codegen/__main__.py # pylint: disable=duplicate-code # pylint: disable=line-too-long # p...
256
256
1,461
9
246
AccelByte/accelbyte-python-sdk
accelbyte_py_sdk/api/lobby/operations/notification/delete_notification_top_00eb0a.py
Python
DeleteNotificationTopicV1Admin
DeleteNotificationTopicV1Admin
35
257
35
35
cf6bd80e4052e8ed84d5157981568a092df4b40e
bigcode/the-stack
train
d3fbf1b223d7b95259dd2b3a
train
class
class V1NodeSelectorTerm(object): """NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech Do not edit the class manually. """ """ Attributes: openapi_types (dict): The key is attribute name and the value is attribute typ...
class V1NodeSelectorTerm(object):
"""NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech Do not edit the class manually. """ """ Attributes: openapi_types (dict): The key is attribute name and the value is attribute type. attribute_map (dict): The...
# coding: utf-8 """ Kubernetes No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 OpenAPI spec version: release-1.16 Generated by: https://openapi-generator.tech """ import pprint import re # noqa: F401 import six class V1NodeS...
86
256
926
8
77
L3T/python
kubernetes/client/models/v1_node_selector_term.py
Python
V1NodeSelectorTerm
V1NodeSelectorTerm
19
142
19
19
ab496609005508e7a5fa96a45c62c45e232f8b52
bigcode/the-stack
train
d91ae7b3b4f5777efaa43a7b
train
function
def encrypt_output(data_bytes: bytes) -> str: """ Encrypts data using DAP public key (GPG) """ encrypted_data = CONFIG.GPG.encrypt(data_bytes, recipients=CONFIG.RECIPIENTS, always_trust=True) if encrypted_data.ok: logger.info("Successfully encrypted output") else: logger.error(...
def encrypt_output(data_bytes: bytes) -> str:
""" Encrypts data using DAP public key (GPG) """ encrypted_data = CONFIG.GPG.encrypt(data_bytes, recipients=CONFIG.RECIPIENTS, always_trust=True) if encrypted_data.ok: logger.info("Successfully encrypted output") else: logger.error("Failed to encrypt output") logger.err...
import structlog from app import CONFIG logger = structlog.get_logger() def encrypt_output(data_bytes: bytes) -> str:
27
64
94
11
16
dan-obrien/sdx-deliver
app/encrypt.py
Python
encrypt_output
encrypt_output
7
20
7
7
a96cbf1cebf22e9c3b3c590e82ff1967ab9d650c
bigcode/the-stack
train
0d24014af9fefa76f0076485
train
class
class Device(JsonObject, CRUD): _schemapath = '/schema/devices.json' PATHS = { 'create': '/inventory/devices', 'delete': '/inventory/devices/{}', 'list': '/inventory/devices', 'search': '/inventory/resources', 'update': '/inventory/devices/{}', 'view_by_agent': ...
class Device(JsonObject, CRUD):
_schemapath = '/schema/devices.json' PATHS = { 'create': '/inventory/devices', 'delete': '/inventory/devices/{}', 'list': '/inventory/devices', 'search': '/inventory/resources', 'update': '/inventory/devices/{}', 'view_by_agent': '/inventory/devices/{}/byagentkey...
import json from serverdensity.wrapper.jsonobject import JsonObject from serverdensity.wrapper.crud import CRUD class Device(JsonObject, CRUD):
29
68
228
7
21
serverdensity/sd-python-wrapper
serverdensity/wrapper/device.py
Python
Device
Device
6
30
6
7
1cbf16140df5fed89c42b0aad6f2d50a245198d3
bigcode/the-stack
train
911315bb3161acf68d55cd4f
train
class
class YaraMachoGenerator: """ Mach-O Yara signature object """ __mm = None __sig = None __const_strings = [] __symbol_table_strings = [] __rulename = "" __dyld_count = 0 def __init__(self, filename, samplename='', meta=None, tag='', include_filename=False): """ Object in...
class YaraMachoGenerator:
""" Mach-O Yara signature object """ __mm = None __sig = None __const_strings = [] __symbol_table_strings = [] __rulename = "" __dyld_count = 0 def __init__(self, filename, samplename='', meta=None, tag='', include_filename=False): """ Object init """ fname = os....
""" An abstraction to create a Yara signature based on a provided Mach-O file. This class parses the file and extract the necessary values, as well as populates the signature object. This uses the yara_signature class to hold and create the signature. """ import macholib.MachO import struct import os import re import ...
90
256
5,554
7
82
c4pr1c3/data_hacking
data_hacking/yara_signature/yara_macho_generator.py
Python
YaraMachoGenerator
YaraMachoGenerator
16
414
16
16
aa117a864776f3a8e121dca3ed242e3d54f7e791
bigcode/the-stack
train
dd841ad92f009a5a0d2b7b2e
train
class
class ReadKey(Edge): __name__ = "Read Key" timestamp: int value: Optional[str] def __init__(self) -> None: super().__init__()
class ReadKey(Edge):
__name__ = "Read Key" timestamp: int value: Optional[str] def __init__(self) -> None: super().__init__()
def __init__(self) -> None: super().__init__() class CreatedKey(Edge): __name__ = "Created Key" timestamp: int value: Optional[str] def __init__(self) -> None: super().__init__() class ReadKey(Edge):
63
64
41
6
58
limkokhian/beagle
beagle/edges/registry.py
Python
ReadKey
ReadKey
25
32
25
25
2f43dd83ac80346fef059b76e4a41bbc90fdcb26
bigcode/the-stack
train
973543eb656a2ed596efedb5
train
class
class DeletedKey(Edge): __name__ = "Deleted Key" timestamp: int value: Optional[str] def __init__(self) -> None: super().__init__()
class DeletedKey(Edge):
__name__ = "Deleted Key" timestamp: int value: Optional[str] def __init__(self) -> None: super().__init__()
def __init__(self) -> None: super().__init__() class DeletedValue(Edge): __name__ = "Deleted Value" timestamp: int value: Optional[str] def __init__(self) -> None: super().__init__() class DeletedKey(Edge):
63
64
41
6
58
limkokhian/beagle
beagle/edges/registry.py
Python
DeletedKey
DeletedKey
45
52
45
45
e67b972b663ce7f7a3c3035ff57ea9bf376c1306
bigcode/the-stack
train
9a69b99992162bf36cdb4e8c
train
class
class CreatedKey(Edge): __name__ = "Created Key" timestamp: int value: Optional[str] def __init__(self) -> None: super().__init__()
class CreatedKey(Edge):
__name__ = "Created Key" timestamp: int value: Optional[str] def __init__(self) -> None: super().__init__()
from beagle.edges import Edge from typing import Optional class ChangedValue(Edge): __name__ = "Changed Value" value: Optional[str] timestamp: int def __init__(self) -> None: super().__init__() class CreatedKey(Edge):
59
64
41
6
54
limkokhian/beagle
beagle/edges/registry.py
Python
CreatedKey
CreatedKey
15
22
15
15
c15276c68b58a740ff0187ab6d97257a18bcb1b7
bigcode/the-stack
train
37c353a0d171c5966a1021c9
train
class
class DeletedValue(Edge): __name__ = "Deleted Value" timestamp: int value: Optional[str] def __init__(self) -> None: super().__init__()
class DeletedValue(Edge):
__name__ = "Deleted Value" timestamp: int value: Optional[str] def __init__(self) -> None: super().__init__()
def __init__(self) -> None: super().__init__() class ReadKey(Edge): __name__ = "Read Key" timestamp: int value: Optional[str] def __init__(self) -> None: super().__init__() class DeletedValue(Edge):
63
64
41
6
58
limkokhian/beagle
beagle/edges/registry.py
Python
DeletedValue
DeletedValue
35
42
35
35
b2e679a1c107470d01cb7189be1de280778026ef
bigcode/the-stack
train
46f5ee44de3abbd691f296a4
train
class
class ChangedValue(Edge): __name__ = "Changed Value" value: Optional[str] timestamp: int def __init__(self) -> None: super().__init__()
class ChangedValue(Edge):
__name__ = "Changed Value" value: Optional[str] timestamp: int def __init__(self) -> None: super().__init__()
from beagle.edges import Edge from typing import Optional class ChangedValue(Edge):
18
64
41
6
11
limkokhian/beagle
beagle/edges/registry.py
Python
ChangedValue
ChangedValue
5
12
5
5
520fd8623d51645b5f2eaa189cc9d98ef7929a4d
bigcode/the-stack
train
5db8536ac2c3567113240acc
train
class
class _ListComp(node_classes.NodeNG): """Class representing an :class:`ast.ListComp` node. >>> node = astroid.extract_node('[thing for thing in things if thing]') >>> node <ListComp l.1 at 0x7f23b2e418d0> """ _astroid_fields = ("elt", "generators") elt = None """The element that forms ...
class _ListComp(node_classes.NodeNG):
"""Class representing an :class:`ast.ListComp` node. >>> node = astroid.extract_node('[thing for thing in things if thing]') >>> node <ListComp l.1 at 0x7f23b2e418d0> """ _astroid_fields = ("elt", "generators") elt = None """The element that forms the output of the expression. :ty...
def bool_value(self, context=None): """Determine the boolean value of this node. :returns: The boolean value of this node. For a :class:`SetComp` this is always :class:`Uninferable`. :rtype: Uninferable """ return util.Uninferable def get_children(self): ...
93
93
312
9
83
ChegeDaniella/Pitches
virtual/lib/python3.6/site-packages/astroid/scoped_nodes.py
Python
_ListComp
_ListComp
1,001
1,045
1,001
1,001
efbff57597c693f27ab90dd6c1d7493b7b492c76
bigcode/the-stack
train
feff647ef3db852292c59581
train
class
class ListComp(_ListComp, ComprehensionScope): """Class representing an :class:`ast.ListComp` node. >>> node = astroid.extract_node('[thing for thing in things if thing]') >>> node <ListComp l.1 at 0x7f23b2e418d0> """ _other_other_fields = ("locals",) def __init__(self, lineno=None, col_o...
class ListComp(_ListComp, ComprehensionScope):
"""Class representing an :class:`ast.ListComp` node. >>> node = astroid.extract_node('[thing for thing in things if thing]') >>> node <ListComp l.1 at 0x7f23b2e418d0> """ _other_other_fields = ("locals",) def __init__(self, lineno=None, col_offset=None, parent=None): self.locals =...
:class:`ListComp` this is always :class:`Uninferable`. :rtype: Uninferable """ return util.Uninferable def get_children(self): yield self.elt yield from self.generators class ListComp(_ListComp, ComprehensionScope):
64
64
149
12
51
ChegeDaniella/Pitches
virtual/lib/python3.6/site-packages/astroid/scoped_nodes.py
Python
ListComp
ListComp
1,048
1,065
1,048
1,048
6019ea3629c32c0e5c3d6f733ce25484623b3e65
bigcode/the-stack
train
666dc9d6ee8013c7d9842a56
train
class
class Module(LocalsDictNodeNG): """Class representing an :class:`ast.Module` node. >>> node = astroid.extract_node('import astroid') >>> node <Import l.1 at 0x7f23b2e4e5c0> >>> node.parent <Module l.0 at 0x7f23b2e4eda0> """ _astroid_fields = ("body",) fromlineno = 0 """The fir...
class Module(LocalsDictNodeNG):
"""Class representing an :class:`ast.Module` node. >>> node = astroid.extract_node('import astroid') >>> node <Import l.1 at 0x7f23b2e4e5c0> >>> node.parent <Module l.0 at 0x7f23b2e4eda0> """ _astroid_fields = ("body",) fromlineno = 0 """The first line that this node appears o...
defined locals. :rtype: iterable(str) """ return iter(self.keys()) def keys(self): """The names of locals defined in this scoped node. :returns: The names of the defined locals. :rtype: list(str) """ return list(self.locals.keys()) def values(s...
256
256
2,987
9
246
ChegeDaniella/Pitches
virtual/lib/python3.6/site-packages/astroid/scoped_nodes.py
Python
Module
Module
307
758
307
307
9d3649971d7509032f4aa4b1489db1ef661a2aef
bigcode/the-stack
train
c5c1e8baab69cebdf5c9b491
train
class
class SetComp(ComprehensionScope): """Class representing an :class:`ast.SetComp` node. >>> node = astroid.extract_node('{thing for thing in things if thing}') >>> node <SetComp l.1 at 0x7f23b2e41898> """ _astroid_fields = ("elt", "generators") _other_other_fields = ("locals",) elt = No...
class SetComp(ComprehensionScope):
"""Class representing an :class:`ast.SetComp` node. >>> node = astroid.extract_node('{thing for thing in things if thing}') >>> node <SetComp l.1 at 0x7f23b2e41898> """ _astroid_fields = ("elt", "generators") _other_other_fields = ("locals",) elt = None """The element that forms th...
:type generators: list(Comprehension) or None """ self.key = key self.value = value if generators is None: self.generators = [] else: self.generators = generators def bool_value(self, context=None): """Determine the boolean value of this node...
147
147
491
9
137
ChegeDaniella/Pitches
virtual/lib/python3.6/site-packages/astroid/scoped_nodes.py
Python
SetComp
SetComp
930
998
930
930
e2f9624a1e2d6c071c85797fee5824b38811da30
bigcode/the-stack
train
db1899f0049c70ff5c919f63
train
function
def _is_metaclass(klass, seen=None): """ Return if the given class can be used as a metaclass. """ if klass.name == "type": return True if seen is None: seen = set() for base in klass.bases: try: for baseobj in base.infer(): baseobj_name = base...
def _is_metaclass(klass, seen=None):
""" Return if the given class can be used as a metaclass. """ if klass.name == "type": return True if seen is None: seen = set() for base in klass.bases: try: for baseobj in base.infer(): baseobj_name = baseobj.qname() if baseob...
all argument names""" if names is None: names = [] for arg in args: if isinstance(arg, node_classes.Tuple): _rec_get_names(arg.elts, names) else: names.append(arg.name) return names def _is_metaclass(klass, seen=None):
64
64
199
11
52
ChegeDaniella/Pitches
virtual/lib/python3.6/site-packages/astroid/scoped_nodes.py
Python
_is_metaclass
_is_metaclass
1,789
1,820
1,789
1,789
1b269f283bb13a833583514a171ed71c00acb9f4
bigcode/the-stack
train
11ef72736452904d28cb6cbd
train
function
def _rec_get_names(args, names=None): """return a list of all argument names""" if names is None: names = [] for arg in args: if isinstance(arg, node_classes.Tuple): _rec_get_names(arg.elts, names) else: names.append(arg.name) return names
def _rec_get_names(args, names=None):
"""return a list of all argument names""" if names is None: names = [] for arg in args: if isinstance(arg, node_classes.Tuple): _rec_get_names(arg.elts, names) else: names.append(arg.name) return names
<AsyncFunctionDef.func l.2 at 0x7f23b2e416d8> >>> node.body[0] <AsyncFor l.3 at 0x7f23b2e417b8> """ def _rec_get_names(args, names=None):
63
64
69
10
53
ChegeDaniella/Pitches
virtual/lib/python3.6/site-packages/astroid/scoped_nodes.py
Python
_rec_get_names
_rec_get_names
1,777
1,786
1,777
1,777
db0be44b83cea4dbe42d109bd992e269e36f0ce5
bigcode/the-stack
train
8c6e1aa154f2466b3a1516cd
train
class
class GeneratorExp(ComprehensionScope): """Class representing an :class:`ast.GeneratorExp` node. >>> node = astroid.extract_node('(thing for thing in things if thing)') >>> node <GeneratorExp l.1 at 0x7f23b2e4e400> """ _astroid_fields = ("elt", "generators") _other_other_fields = ("locals"...
class GeneratorExp(ComprehensionScope):
"""Class representing an :class:`ast.GeneratorExp` node. >>> node = astroid.extract_node('(thing for thing in things if thing)') >>> node <GeneratorExp l.1 at 0x7f23b2e4e400> """ _astroid_fields = ("elt", "generators") _other_other_fields = ("locals",) elt = None """The element tha...
` this is always ``True``. :rtype: bool """ return True def get_children(self): yield from self.body class ComprehensionScope(LocalsDictNodeNG): """Scoping for different types of comprehensions.""" def frame(self): """The first parent frame node. A frame ...
145
145
486
9
135
ChegeDaniella/Pitches
virtual/lib/python3.6/site-packages/astroid/scoped_nodes.py
Python
GeneratorExp
GeneratorExp
778
846
778
778
58459f33ae6d412b64993503b4fa3efed233b375
bigcode/the-stack
train
f8a92ffd6012ce8bab19a851
train
function
def builtin_lookup(name): """lookup a name into the builtin module return the list of matching statements and the astroid for the builtin module """ builtin_astroid = MANAGER.ast_from_module(builtins) if name == "__dict__": return builtin_astroid, () try: stmts = builtin_astr...
def builtin_lookup(name):
"""lookup a name into the builtin module return the list of matching statements and the astroid for the builtin module """ builtin_astroid = MANAGER.ast_from_module(builtins) if name == "__dict__": return builtin_astroid, () try: stmts = builtin_astroid.locals[name] excep...
if n.type == "classmethod": return bases.BoundMethod(n, klass) if n.type == "property": return n if n.type != "staticmethod": return bases.UnboundMethod(n) return n MANAGER = manager.AstroidManager() def builtin_lookup(name):
64
64
95
5
59
ChegeDaniella/Pitches
virtual/lib/python3.6/site-packages/astroid/scoped_nodes.py
Python
builtin_lookup
builtin_lookup
133
145
133
133
efa37aaee8c11b3fc23c2b6b15157ddd6c744391
bigcode/the-stack
train
75371aed77a0a7a8dbf7f67d
train
class
class Lambda(mixins.FilterStmtsMixin, LocalsDictNodeNG): """Class representing an :class:`ast.Lambda` node. >>> node = astroid.extract_node('lambda arg: arg + 1') >>> node <Lambda.<lambda> l.1 at 0x7f23b2e41518> """ _astroid_fields = ("args", "body") _other_other_fields = ("locals",) n...
class Lambda(mixins.FilterStmtsMixin, LocalsDictNodeNG):
"""Class representing an :class:`ast.Lambda` node. >>> node = astroid.extract_node('lambda arg: arg + 1') >>> node <Lambda.<lambda> l.1 at 0x7f23b2e41518> """ _astroid_fields = ("args", "body") _other_other_fields = ("locals",) name = "<lambda>" is_lambda = True def implicit_p...
isinstance(node, FunctionDef): return None if not node.parent: return None try: result = next(node.infer_call_result(node.parent)) except exceptions.InferenceError: return None if isinstance(result, bases.Instance): result = result._proxied if isinstance(resu...
256
256
1,303
16
239
ChegeDaniella/Pitches
virtual/lib/python3.6/site-packages/astroid/scoped_nodes.py
Python
Lambda
Lambda
1,105
1,283
1,105
1,105
93cc7522b3ae7b05c5eb5f73a5a028fd7193e4f4
bigcode/the-stack
train
91de40ab39e8194f650cdd67
train
function
def clean_duplicates_mro(sequences, cls, context): for sequence in sequences: names = [ (node.lineno, node.qname()) if node.name else None for node in sequence ] last_index = dict(map(reversed, enumerate(names))) if names and names[0] is not None and last_index[names[0]] ...
def clean_duplicates_mro(sequences, cls, context):
for sequence in sequences: names = [ (node.lineno, node.qname()) if node.name else None for node in sequence ] last_index = dict(map(reversed, enumerate(names))) if names and names[0] is not None and last_index[names[0]] != 0: raise exceptions.DuplicateBasesEr...
=sequences, cls=cls, context=context, ) result.append(candidate) # remove the chosen candidate for seq in sequences: if seq[0] == candidate: del seq[0] return None def clean_duplicates_mro(sequences, cls, context):
64
64
162
12
51
ChegeDaniella/Pitches
virtual/lib/python3.6/site-packages/astroid/scoped_nodes.py
Python
clean_duplicates_mro
clean_duplicates_mro
99
116
99
99
a196a61070bce6836854795cb31fad8a62c0a164
bigcode/the-stack
train
12a3701ffc609f76f025efb6
train
function
def get_wrapping_class(node): """Get the class that wraps the given node. We consider that a class wraps a node if the class is a parent for the said node. :returns: The class that wraps the given node :rtype: ClassDef or None """ klass = node.frame() while klass is not None and not i...
def get_wrapping_class(node):
"""Get the class that wraps the given node. We consider that a class wraps a node if the class is a parent for the said node. :returns: The class that wraps the given node :rtype: ClassDef or None """ klass = node.frame() while klass is not None and not isinstance(klass, ClassDef): ...
(klass): # don't propagate it if the current class # can't be a metaclass continue klass._type = base.type break if klass._type is None: klass._type = "class" return klass._type def get_wrapping_class(node):
64
64
110
7
56
ChegeDaniella/Pitches
virtual/lib/python3.6/site-packages/astroid/scoped_nodes.py
Python
get_wrapping_class
get_wrapping_class
1,857
1,873
1,857
1,857
9c4320529c55e08fa3da2a2316ca900f9c2fad2f
bigcode/the-stack
train
35a303265c64fe64ee2830e5
train
class
class AsyncFunctionDef(FunctionDef): """Class representing an :class:`ast.FunctionDef` node. A :class:`AsyncFunctionDef` is an asynchronous function created with the `async` keyword. >>> node = astroid.extract_node(''' async def func(things): async for thing in things: print(th...
class AsyncFunctionDef(FunctionDef):
"""Class representing an :class:`ast.FunctionDef` node. A :class:`AsyncFunctionDef` is an asynchronous function created with the `async` keyword. >>> node = astroid.extract_node(''' async def func(things): async for thing in things: print(thing) ''') >>> node <Async...
be able to look it up in the current scope # when `__class__` is being used. frame = self.parent.frame() if isinstance(frame, ClassDef): return self, [frame] return super().scope_lookup(node, name, offset) class AsyncFunctionDef(FunctionDef):
64
64
133
7
57
ChegeDaniella/Pitches
virtual/lib/python3.6/site-packages/astroid/scoped_nodes.py
Python
AsyncFunctionDef
AsyncFunctionDef
1,759
1,774
1,759
1,759
c9e2a5931049fa0570d488f9a3b32418808d3948
bigcode/the-stack
train
cfe8fdf9f295b004d4fde079
train
function
def _infer_decorator_callchain(node): """Detect decorator call chaining and see if the end result is a static or a classmethod. """ if not isinstance(node, FunctionDef): return None if not node.parent: return None try: result = next(node.infer_call_result(node.parent)) ...
def _infer_decorator_callchain(node):
"""Detect decorator call chaining and see if the end result is a static or a classmethod. """ if not isinstance(node, FunctionDef): return None if not node.parent: return None try: result = next(node.infer_call_result(node.parent)) except exceptions.InferenceError: ...
("locals",) def __init__(self, lineno=None, col_offset=None, parent=None): self.locals = {} """A map of the name of a local variable to the node defining it. :type: dict(str, NodeNG) """ super(ListComp, self).__init__(lineno, col_offset, parent) def _infer_decorator_callc...
82
82
276
9
73
ChegeDaniella/Pitches
virtual/lib/python3.6/site-packages/astroid/scoped_nodes.py
Python
_infer_decorator_callchain
_infer_decorator_callchain
1,068
1,102
1,068
1,068
7069e0800bbcb7cea9cce6d997b55afd765d2ca7
bigcode/the-stack
train
a96f495dfc04654254ab62c0
train
class
class FunctionDef(mixins.MultiLineBlockMixin, node_classes.Statement, Lambda): """Class representing an :class:`ast.FunctionDef`. >>> node = astroid.extract_node(''' ... def my_func(arg): ... return arg + 1 ... ''') >>> node <FunctionDef.my_func l.2 at 0x7f23b2e71e10> """ _astr...
class FunctionDef(mixins.MultiLineBlockMixin, node_classes.Statement, Lambda):
"""Class representing an :class:`ast.FunctionDef`. >>> node = astroid.extract_node(''' ... def my_func(arg): ... return arg + 1 ... ''') >>> node <FunctionDef.my_func l.2 at 0x7f23b2e71e10> """ _astroid_fields = ("decorators", "args", "returns", "body") _multi_line_block_fi...
the scope where it has been found (locals, globals or builtin). :rtype: tuple(str, list(NodeNG)) """ # pylint: disable=no-member; github.com/pycqa/astroid/issues/291 # args is in fact redefined later on by postinit. Can't be changed # to None due to a strong interact...
256
256
3,316
17
238
ChegeDaniella/Pitches
virtual/lib/python3.6/site-packages/astroid/scoped_nodes.py
Python
FunctionDef
FunctionDef
1,286
1,756
1,286
1,286
c82d4d4a5502b0027505304cc2e4e9827cbbe213
bigcode/the-stack
train
d872cd772e4453ce41bdb6ef
train
function
def _c3_merge(sequences, cls, context): """Merges MROs in *sequences* to a single MRO using the C3 algorithm. Adapted from http://www.python.org/download/releases/2.3/mro/. """ result = [] while True: sequences = [s for s in sequences if s] # purge empty sequences if not sequences...
def _c3_merge(sequences, cls, context):
"""Merges MROs in *sequences* to a single MRO using the C3 algorithm. Adapted from http://www.python.org/download/releases/2.3/mro/. """ result = [] while True: sequences = [s for s in sequences if s] # purge empty sequences if not sequences: return result for ...
ins.__name__ ITER_METHODS = ("__iter__", "__getitem__") EXCEPTION_BASE_CLASSES = frozenset({"Exception", "BaseException"}) objects = util.lazy_import("objects") BUILTIN_DESCRIPTORS = frozenset( {"classmethod", "staticmethod", "builtins.classmethod", "builtins.staticmethod"} ) def _c3_merge(sequences, cls, context):...
82
82
276
12
70
ChegeDaniella/Pitches
virtual/lib/python3.6/site-packages/astroid/scoped_nodes.py
Python
_c3_merge
_c3_merge
61
96
61
61
15fe6efc0769730222c2cd2cfccd026b974cb8e6
bigcode/the-stack
train
6a8fd001ad96111941f986ba
train
class
class LocalsDictNodeNG(node_classes.LookupMixIn, node_classes.NodeNG): """ this class provides locals handling common to Module, FunctionDef and ClassDef nodes, including a dict like interface for direct access to locals information """ # attributes below are set by the builder module or by raw fac...
class LocalsDictNodeNG(node_classes.LookupMixIn, node_classes.NodeNG):
""" this class provides locals handling common to Module, FunctionDef and ClassDef nodes, including a dict like interface for direct access to locals information """ # attributes below are set by the builder module or by raw factories locals = {} """A map of the name of a local variable to...
=cls, context=context, ) yield [ node for i, (node, name) in enumerate(zip(sequence, names)) if name is None or last_index[name] == i ] def function_to_method(n, klass): if isinstance(n, FunctionDef): if n.type == "classmethod...
256
256
1,132
17
238
ChegeDaniella/Pitches
virtual/lib/python3.6/site-packages/astroid/scoped_nodes.py
Python
LocalsDictNodeNG
LocalsDictNodeNG
149
304
149
149
ae77e9638eec478a48562c132823aa2e63006079
bigcode/the-stack
train
a41396716b4a1cce8bffc477
train
function
def _class_type(klass, ancestors=None): """return a ClassDef node type to differ metaclass and exception from 'regular' classes """ # XXX we have to store ancestors in case we have an ancestor loop if klass._type is not None: return klass._type if _is_metaclass(klass): klass._typ...
def _class_type(klass, ancestors=None):
"""return a ClassDef node type to differ metaclass and exception from 'regular' classes """ # XXX we have to store ancestors in case we have an ancestor loop if klass._type is not None: return klass._type if _is_metaclass(klass): klass._type = "metaclass" elif klass.name.ends...
if baseobj is klass: continue if not isinstance(baseobj, ClassDef): continue if baseobj._type == "metaclass": return True if _is_metaclass(baseobj, seen): return True ...
78
78
263
10
67
ChegeDaniella/Pitches
virtual/lib/python3.6/site-packages/astroid/scoped_nodes.py
Python
_class_type
_class_type
1,823
1,854
1,823
1,823
33d1fd8d067679649ad89217e3fb20ce09368fb2
bigcode/the-stack
train
f2fc37bc72c9b92ea602f43b
train
class
class DictComp(ComprehensionScope): """Class representing an :class:`ast.DictComp` node. >>> node = astroid.extract_node('{k:v for k, v in things if k > v}') >>> node <DictComp l.1 at 0x7f23b2e41d68> """ _astroid_fields = ("key", "value", "generators") _other_other_fields = ("locals",) ...
class DictComp(ComprehensionScope):
"""Class representing an :class:`ast.DictComp` node. >>> node = astroid.extract_node('{k:v for k, v in things if k > v}') >>> node <DictComp l.1 at 0x7f23b2e41d68> """ _astroid_fields = ("key", "value", "generators") _other_other_fields = ("locals",) key = None """What produces the...
element that forms the output of the expression. :type elt: NodeNG or None :param generators: The generators that are looped through. :type generators: list(Comprehension) or None """ self.elt = elt if generators is None: self.generators = [] else: ...
163
163
546
9
153
ChegeDaniella/Pitches
virtual/lib/python3.6/site-packages/astroid/scoped_nodes.py
Python
DictComp
DictComp
849
927
849
849
2166d898569774ecda7c94662c687d2488e86611
bigcode/the-stack
train
979d019c6739e3c86fbc985a
train
function
def function_to_method(n, klass): if isinstance(n, FunctionDef): if n.type == "classmethod": return bases.BoundMethod(n, klass) if n.type == "property": return n if n.type != "staticmethod": return bases.UnboundMethod(n) return n
def function_to_method(n, klass):
if isinstance(n, FunctionDef): if n.type == "classmethod": return bases.BoundMethod(n, klass) if n.type == "property": return n if n.type != "staticmethod": return bases.UnboundMethod(n) return n
mros=sequences, cls=cls, context=context, ) yield [ node for i, (node, name) in enumerate(zip(sequence, names)) if name is None or last_index[name] == i ] def function_to_method(n, klass):
63
64
66
8
55
ChegeDaniella/Pitches
virtual/lib/python3.6/site-packages/astroid/scoped_nodes.py
Python
function_to_method
function_to_method
119
127
119
119
99efe69baea74fa60ccb8b4dd76bbca15fa3025c
bigcode/the-stack
train
2cbb205e6abc6f7943db7d25
train
class
class ComprehensionScope(LocalsDictNodeNG): """Scoping for different types of comprehensions.""" def frame(self): """The first parent frame node. A frame node is a :class:`Module`, :class:`FunctionDef`, or :class:`ClassDef`. :returns: The first parent frame node. :rtyp...
class ComprehensionScope(LocalsDictNodeNG):
"""Scoping for different types of comprehensions.""" def frame(self): """The first parent frame node. A frame node is a :class:`Module`, :class:`FunctionDef`, or :class:`ClassDef`. :returns: The first parent frame node. :rtype: Module or FunctionDef or ClassDef ...
node. :returns: The boolean value of this node. For a :class:`Module` this is always ``True``. :rtype: bool """ return True def get_children(self): yield from self.body class ComprehensionScope(LocalsDictNodeNG):
64
64
104
12
51
ChegeDaniella/Pitches
virtual/lib/python3.6/site-packages/astroid/scoped_nodes.py
Python
ComprehensionScope
ComprehensionScope
761
775
761
761
85eca3c11665b9ead5d8bd0149cafbee284cfc8a
bigcode/the-stack
train
f1e4ba3bd2e68879faddcf86
train
class
class ClassDef(mixins.FilterStmtsMixin, LocalsDictNodeNG, node_classes.Statement): """Class representing an :class:`ast.ClassDef` node. >>> node = astroid.extract_node(''' class Thing: def my_meth(self, arg): return arg + self.offset ''') >>> node <ClassDef.Thing l.2 at 0x7f...
class ClassDef(mixins.FilterStmtsMixin, LocalsDictNodeNG, node_classes.Statement):
"""Class representing an :class:`ast.ClassDef` node. >>> node = astroid.extract_node(''' class Thing: def my_meth(self, arg): return arg + self.offset ''') >>> node <ClassDef.Thing l.2 at 0x7f23b2e9e748> """ # some of the attributes below are set by the builder modu...
have found no type klass._type = "class" return "class" ancestors.add(klass_name) for base in klass.ancestors(recurs=False): name = _class_type(base, ancestors) if name != "class": if name == "metaclass" and not _is_metaclass(klass): ...
256
256
7,775
21
234
ChegeDaniella/Pitches
virtual/lib/python3.6/site-packages/astroid/scoped_nodes.py
Python
ClassDef
ClassDef
1,876
2,927
1,876
1,876
5e00ad0aabee4537e7eae03dfbd789fc265cb709
bigcode/the-stack
train
036517c00d0b5304946920ea
train
class
class Generative(object): def __init__(self, config): self.config = DotDict(config['args']) self.observer = Observer({'storage': self.config['results_location'], 'group': self.config['task_name'], 'log': self.config['log']}) de...
class Generative(object):
def __init__(self, config): self.config = DotDict(config['args']) self.observer = Observer({'storage': self.config['results_location'], 'group': self.config['task_name'], 'log': self.config['log']}) def execute(self, model_conf...
# Copyright (c) 2020 Graphcore Ltd. All rights reserved. """ Generic functionality for generative modelling experiments """ import os import sys from functools import partial from pathlib import Path import numpy as np # Necessary for parsing dtypes import tensorflow as tf # Necessary for parsing dtypes from m...
210
256
1,692
5
205
payoto/graphcore_examples
applications/tensorflow/contrastive_divergence_vae/experiments/generative.py
Python
Generative
Generative
29
197
29
29
732a21a881317fc8485ffda1253544fe42cc8785
bigcode/the-stack
train
a18113391bfaeb92dc27f8dc
train
function
def _detect_objc_or_objcpp_compiler(env: 'Environment', for_machine: MachineChoice, objc: bool) -> 'Compiler': popen_exceptions: T.Dict[str, T.Union[Exception, str]] = {} compilers, ccache, exe_wrap = _get_compilers(env, 'objc' if objc else 'objcpp', for_machine) is_cross = env.is_cross_build(for_machine) ...
def _detect_objc_or_objcpp_compiler(env: 'Environment', for_machine: MachineChoice, objc: bool) -> 'Compiler':
popen_exceptions: T.Dict[str, T.Union[Exception, str]] = {} compilers, ccache, exe_wrap = _get_compilers(env, 'objc' if objc else 'objcpp', for_machine) is_cross = env.is_cross_build(for_machine) info = env.machines[for_machine] comp: T.Union[T.Type[ObjCCompiler], T.Type[ObjCPPCompiler]] for co...
return cls( compiler, version, for_machine, is_cross, info, exe_wrap, full_version=full_version, linker=linker) _handle_exceptions(popen_exceptions, compilers) raise EnvironmentException('Unreachable code (exception to make mypy happy)') def detect_objc_...
169
169
565
29
140
johan-boule/meson
mesonbuild/compilers/detect.py
Python
_detect_objc_or_objcpp_compiler
_detect_objc_or_objcpp_compiler
798
847
798
798
949eda91efb69624ec11c0a3eececc693ca57790
bigcode/the-stack
train
6c65f73476ed7bf8b473de8d
train
function
def detect_cuda_compiler(env: 'Environment', for_machine: MachineChoice) -> Compiler: popen_exceptions = {} is_cross = env.is_cross_build(for_machine) compilers, ccache, exe_wrap = _get_compilers(env, 'cuda', for_machine) info = env.machines[for_machine] for compiler in compilers: arg = '--v...
def detect_cuda_compiler(env: 'Environment', for_machine: MachineChoice) -> Compiler:
popen_exceptions = {} is_cross = env.is_cross_build(for_machine) compilers, ccache, exe_wrap = _get_compilers(env, 'cuda', for_machine) info = env.machines[for_machine] for compiler in compilers: arg = '--version' try: p, out, err = Popen_safe(compiler + [arg]) ex...
compiler, version, for_machine, is_cross, info, exe_wrap, full_version=full_version, linker=linker) _handle_exceptions(popen_exceptions, compilers) raise EnvironmentException(f'Unknown compiler {compilers}') def detect_c_compiler(env: 'Environment', for_machine: MachineChoice) -> Compiler: ...
143
143
478
19
124
johan-boule/meson
mesonbuild/compilers/detect.py
Python
detect_cuda_compiler
detect_cuda_compiler
634
667
634
634
840d0da4223bcd2290e2e32c79ebf8caddbc228d
bigcode/the-stack
train
f490a04d0870c4a05c341eaf
train
function
def _get_compilers(env: 'Environment', lang: str, for_machine: MachineChoice) -> T.Tuple[T.List[T.List[str]], T.List[str], T.Optional['ExternalProgram']]: ''' The list of compilers is detected in the exact same way for C, C++, ObjC, ObjC++, Fortran, CS so consolidate it here. ''' value = env.lookup_...
def _get_compilers(env: 'Environment', lang: str, for_machine: MachineChoice) -> T.Tuple[T.List[T.List[str]], T.List[str], T.Optional['ExternalProgram']]:
''' The list of compilers is detected in the exact same way for C, C++, ObjC, ObjC++, Fortran, CS so consolidate it here. ''' value = env.lookup_binary_entry(for_machine, lang) if value is not None: comp, ccache = BinaryTable.parse_entry(value) # Return value has to be a list of ...
.for_machine == for_machine env.coredata.process_new_compiler(lang, comp, env) return comp # Helpers # ======= def _get_compilers(env: 'Environment', lang: str, for_machine: MachineChoice) -> T.Tuple[T.List[T.List[str]], T.List[str], T.Optional['ExternalProgram']]:
70
71
238
40
30
johan-boule/meson
mesonbuild/compilers/detect.py
Python
_get_compilers
_get_compilers
229
250
229
229
48cf72e5b1b698698bbbbb7309fd29ead0980cd6
bigcode/the-stack
train
eb420c8356d88fda25410b40
train
function
def _get_clang_compiler_defines(compiler: T.List[str]) -> T.Dict[str, str]: """ Get the list of Clang pre-processor defines """ args = compiler + ['-E', '-dM', '-'] p, output, error = Popen_safe(args, write='', stdin=subprocess.PIPE) if p.returncode != 0: raise EnvironmentException('Unab...
def _get_clang_compiler_defines(compiler: T.List[str]) -> T.Dict[str, str]:
""" Get the list of Clang pre-processor defines """ args = compiler + ['-E', '-dM', '-'] p, output, error = Popen_safe(args, write='', stdin=subprocess.PIPE) if p.returncode != 0: raise EnvironmentException('Unable to get clang pre-processor defines:\n' + output + error) defines: T.D...
len(rest) == 1: defines[rest[0]] = '' if len(rest) == 2: defines[rest[0]] = rest[1] return defines def _get_clang_compiler_defines(compiler: T.List[str]) -> T.Dict[str, str]:
64
64
196
23
40
johan-boule/meson
mesonbuild/compilers/detect.py
Python
_get_clang_compiler_defines
_get_clang_compiler_defines
1,191
1,210
1,191
1,191
e18d06e31858055f71c1a13fbc216358f8757bd1
bigcode/the-stack
train
d6f52327521a4424a73da7b6
train
function
def detect_vala_compiler(env: 'Environment', for_machine: MachineChoice) -> Compiler: exelist = env.lookup_binary_entry(for_machine, 'vala') is_cross = env.is_cross_build(for_machine) info = env.machines[for_machine] if exelist is None: # TODO support fallback exelist = [defaults['vala']...
def detect_vala_compiler(env: 'Environment', for_machine: MachineChoice) -> Compiler:
exelist = env.lookup_binary_entry(for_machine, 'vala') is_cross = env.is_cross_build(for_machine) info = env.machines[for_machine] if exelist is None: # TODO support fallback exelist = [defaults['vala'][0]] try: p, out = Popen_safe(exelist + ['--version'])[0:2] except OS...
(comp, version, for_machine, info, is_cross=is_cross) _handle_exceptions(popen_exceptions, compilers) raise EnvironmentException('Unreachable code (exception to make mypy happy)') def detect_vala_compiler(env: 'Environment', for_machine: MachineChoice) -> Compiler:
63
64
205
20
44
johan-boule/meson
mesonbuild/compilers/detect.py
Python
detect_vala_compiler
detect_vala_compiler
918
935
918
918
907ec0a316105d6a7be8185337377f0279d4a092
bigcode/the-stack
train
1b190bf747327d355580ef09
train
function
def compiler_from_language(env: 'Environment', lang: str, for_machine: MachineChoice) -> T.Optional[Compiler]: lang_map: T.Dict[str, T.Callable[['Environment', MachineChoice], Compiler]] = { 'c': detect_c_compiler, 'cpp': detect_cpp_compiler, 'objc': detect_objc_compiler, 'cuda': det...
def compiler_from_language(env: 'Environment', lang: str, for_machine: MachineChoice) -> T.Optional[Compiler]:
lang_map: T.Dict[str, T.Callable[['Environment', MachineChoice], Compiler]] = { 'c': detect_c_compiler, 'cpp': detect_cpp_compiler, 'objc': detect_objc_compiler, 'cuda': detect_cuda_compiler, 'objcpp': detect_objcpp_compiler, 'java': detect_java_compiler, 'cs'...
llvm-lib'] defaults['cuda_static_linker'] = ['nvlink'] defaults['gcc_static_linker'] = ['gcc-ar'] defaults['clang_static_linker'] = ['llvm-ar'] def compiler_from_language(env: 'Environment', lang: str, for_machine: MachineChoice) -> T.Optional[Compiler]:
64
64
195
25
39
johan-boule/meson
mesonbuild/compilers/detect.py
Python
compiler_from_language
compiler_from_language
200
216
200
200
2c9bebcb8bbc20e3893c98903d61dae7d8baa2c7
bigcode/the-stack
train
1f41f6ad6d059f4b63b6e327
train
function
def detect_c_compiler(env: 'Environment', for_machine: MachineChoice) -> Compiler: return _detect_c_or_cpp_compiler(env, 'c', for_machine)
def detect_c_compiler(env: 'Environment', for_machine: MachineChoice) -> Compiler:
return _detect_c_or_cpp_compiler(env, 'c', for_machine)
is_cross, info, exe_wrap, full_version=full_version, linker=linker) _handle_exceptions(popen_exceptions, compilers) raise EnvironmentException(f'Unknown compiler {compilers}') def detect_c_compiler(env: 'Environment', for_machine: MachineChoice) -> Compiler:
64
64
36
19
45
johan-boule/meson
mesonbuild/compilers/detect.py
Python
detect_c_compiler
detect_c_compiler
628
629
628
628
2fa799384f86b30bf74e8c8beab1b5c27bcd247d
bigcode/the-stack
train
96d43d9505459adad22ab5e9
train
function
def detect_cython_compiler(env: 'Environment', for_machine: MachineChoice) -> Compiler: """Search for a cython compiler.""" compilers, _, _ = _get_compilers(env, 'cython', for_machine) is_cross = env.is_cross_build(for_machine) info = env.machines[for_machine] popen_exceptions: T.Dict[str, Exceptio...
def detect_cython_compiler(env: 'Environment', for_machine: MachineChoice) -> Compiler:
"""Search for a cython compiler.""" compilers, _, _ = _get_compilers(env, 'cython', for_machine) is_cross = env.is_cross_build(for_machine) info = env.machines[for_machine] popen_exceptions: T.Dict[str, Exception] = {} for comp in compilers: try: err = Popen_safe(comp + ['-V...
for_machine, env) return cls(comp, version, for_machine, info) _handle_exceptions(popen_exceptions, compilers) raise EnvironmentException('Unreachable code (exception to make mypy happy)') def detect_cython_compiler(env: 'Environment', for_machine: MachineChoice) -> Compiler:
66
67
226
20
47
johan-boule/meson
mesonbuild/compilers/detect.py
Python
detect_cython_compiler
detect_cython_compiler
896
916
896
896
414b7bfc56cbec0927ad4da2138cbfafb53c1e46
bigcode/the-stack
train
55fb4f9ac39ec02392ec25dc
train
function
def detect_cs_compiler(env: 'Environment', for_machine: MachineChoice) -> Compiler: compilers, ccache, exe_wrap = _get_compilers(env, 'cs', for_machine) popen_exceptions = {} info = env.machines[for_machine] for comp in compilers: try: p, out, err = Popen_safe(comp + ['--version']) ...
def detect_cs_compiler(env: 'Environment', for_machine: MachineChoice) -> Compiler:
compilers, ccache, exe_wrap = _get_compilers(env, 'cs', for_machine) popen_exceptions = {} info = env.machines[for_machine] for comp in compilers: try: p, out, err = Popen_safe(comp + ['--version']) except OSError as e: popen_exceptions[' '.join(comp + ['--version...
env.coredata.add_lang_args(comp_class.language, comp_class, for_machine, env) return comp_class(exelist, version, for_machine, info) raise EnvironmentException('Unknown compiler "' + ' '.join(exelist) + '"') def detect_cs_compiler(env: 'Environment', for_machine: MachineChoice) -> Compiler:
70
70
234
19
51
johan-boule/meson
mesonbuild/compilers/detect.py
Python
detect_cs_compiler
detect_cs_compiler
871
894
871
871
223997593f6fa889a7e33ca28e18c14f36c4904d
bigcode/the-stack
train
8c8fe7ef56294c2402f27e26
train
function
def detect_fortran_compiler(env: 'Environment', for_machine: MachineChoice) -> Compiler: popen_exceptions: T.Dict[str, T.Union[Exception, str]] = {} compilers, ccache, exe_wrap = _get_compilers(env, 'fortran', for_machine) is_cross = env.is_cross_build(for_machine) info = env.machines[for_machine] c...
def detect_fortran_compiler(env: 'Environment', for_machine: MachineChoice) -> Compiler:
popen_exceptions: T.Dict[str, T.Union[Exception, str]] = {} compilers, ccache, exe_wrap = _get_compilers(env, 'fortran', for_machine) is_cross = env.is_cross_build(for_machine) info = env.machines[for_machine] cls: T.Type[FortranCompiler] for compiler in compilers: for arg in ['--version...
.130" after "V". # The patch version number is occasionally important; For # instance, on Linux, # - CUDA Toolkit 8.0.44 requires NVIDIA Driver 367.48 # - CUDA Toolkit 8.0.61 requires NVIDIA Driver 375.26 # Luckily, the "V" also makes it very simple to extract # the...
256
256
1,275
20
236
johan-boule/meson
mesonbuild/compilers/detect.py
Python
detect_fortran_compiler
detect_fortran_compiler
669
790
669
669
332ad595fd82c90f6dbbb93b602883903c484e1b
bigcode/the-stack
train
bb5d889671aa589250110f93
train
function
def detect_java_compiler(env: 'Environment', for_machine: MachineChoice) -> Compiler: exelist = env.lookup_binary_entry(for_machine, 'java') info = env.machines[for_machine] if exelist is None: # TODO support fallback exelist = [defaults['java'][0]] try: p, out, err = Popen_safe...
def detect_java_compiler(env: 'Environment', for_machine: MachineChoice) -> Compiler:
exelist = env.lookup_binary_entry(for_machine, 'java') info = env.machines[for_machine] if exelist is None: # TODO support fallback exelist = [defaults['java'][0]] try: p, out, err = Popen_safe(exelist + ['-version']) except OSError: raise EnvironmentException('Could...
, version, for_machine, is_cross, info, exe_wrap, linker=linker, defines=defines) _handle_exceptions(popen_exceptions, compilers) raise EnvironmentException('Unreachable code (exception to make mypy happy)') def detect_java_compiler(env: 'Environment', for_machine: MachineChoice) -> Compiler:
72
73
246
19
54
johan-boule/meson
mesonbuild/compilers/detect.py
Python
detect_java_compiler
detect_java_compiler
849
869
849
849
7dab8dac0b91ee443b5488ded5aa204dedbeb565
bigcode/the-stack
train
a180dfa11c1c34da711982e5
train
function
def _handle_exceptions( exceptions: T.Mapping[str, T.Union[Exception, str]], binaries: T.List[T.List[str]], bintype: str = 'compiler' ) -> T.NoReturn: errmsg = f'Unknown {bintype}(s): {binaries}' if exceptions: errmsg += '\nThe following exception(s) were encountered:' ...
def _handle_exceptions( exceptions: T.Mapping[str, T.Union[Exception, str]], binaries: T.List[T.List[str]], bintype: str = 'compiler' ) -> T.NoReturn:
errmsg = f'Unknown {bintype}(s): {binaries}' if exceptions: errmsg += '\nThe following exception(s) were encountered:' for c, e in exceptions.items(): errmsg += f'\nRunning "{c}" gave "{e}"' raise EnvironmentException(errmsg)
env.get_exe_wrapper() return compilers, ccache, exe_wrap def _handle_exceptions( exceptions: T.Mapping[str, T.Union[Exception, str]], binaries: T.List[T.List[str]], bintype: str = 'compiler' ) -> T.NoReturn:
64
64
113
47
16
johan-boule/meson
mesonbuild/compilers/detect.py
Python
_handle_exceptions
_handle_exceptions
252
262
252
256
d850345e4576351b3252b98ff7d5b97016bdb756
bigcode/the-stack
train
3695c5e1dce318122dd4c287
train
function
def detect_rust_compiler(env: 'Environment', for_machine: MachineChoice) -> RustCompiler: popen_exceptions = {} # type: T.Dict[str, Exception] compilers, _, exe_wrap = _get_compilers(env, 'rust', for_machine) is_cross = env.is_cross_build(for_machine) info = env.machines[for_machine] cc = detect_c...
def detect_rust_compiler(env: 'Environment', for_machine: MachineChoice) -> RustCompiler:
popen_exceptions = {} # type: T.Dict[str, Exception] compilers, _, exe_wrap = _get_compilers(env, 'rust', for_machine) is_cross = env.is_cross_build(for_machine) info = env.machines[for_machine] cc = detect_c_compiler(env, for_machine) is_link_exe = isinstance(cc.linker, VisualStudioLikeLinker...
_handle_exceptions(popen_exceptions, compilers) raise EnvironmentException('Unreachable code (exception to make mypy happy)') def detect_vala_compiler(env: 'Environment', for_machine: MachineChoice) -> Compiler: exelist = env.lookup_binary_entry(for_machine, 'vala') is_cross = env.is_cross_build(for_ma...
256
256
1,024
21
235
johan-boule/meson
mesonbuild/compilers/detect.py
Python
detect_rust_compiler
detect_rust_compiler
937
1,029
937
937
0a9596470765d568c4f0b115124856da7aa0d771
bigcode/the-stack
train
fd4229d1310c5abb2668f83c
train
function
def detect_cpp_compiler(env: 'Environment', for_machine: MachineChoice) -> Compiler: return _detect_c_or_cpp_compiler(env, 'cpp', for_machine)
def detect_cpp_compiler(env: 'Environment', for_machine: MachineChoice) -> Compiler:
return _detect_c_or_cpp_compiler(env, 'cpp', for_machine)
Exception(f'Unknown compiler {compilers}') def detect_c_compiler(env: 'Environment', for_machine: MachineChoice) -> Compiler: return _detect_c_or_cpp_compiler(env, 'c', for_machine) def detect_cpp_compiler(env: 'Environment', for_machine: MachineChoice) -> Compiler:
64
64
36
19
45
johan-boule/meson
mesonbuild/compilers/detect.py
Python
detect_cpp_compiler
detect_cpp_compiler
631
632
631
631
2a5fe24cec1ea707d18bbbdeb447914d90f92479
bigcode/the-stack
train