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
66e80e171c43c4f68e0ff277
train
class
class DeploymentOperation(Model): """Deployment operation information. Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Full deployment operation ID. :vartype id: str :ivar operation_id: Deployment operation ID. :vartype operation_id: str ...
class DeploymentOperation(Model):
"""Deployment operation information. Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Full deployment operation ID. :vartype id: str :ivar operation_id: Deployment operation ID. :vartype operation_id: str :param properties: Deployment pr...
# Licensed under the MIT License. See License.txt in the project root for # license information. # # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # --------------------------------------------------------------------------...
67
67
225
5
61
SUSE/azure-sdk-for-python
azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/models/deployment_operation.py
Python
DeploymentOperation
DeploymentOperation
15
44
15
15
d44419ac86173072b1393aaf4dd28bba846eaf90
bigcode/the-stack
train
ef379484348ecc671a3320a5
train
class
class KeyEvent: """ Stores information of keyboard input event. Attributes: wnd -- Windows object of the event key -- key code returned by curses. """ KEY_TRANSLATE = { curses.KEY_BACKSPACE:'\x7f' } def __init__(self, wnd, key, no_trailing_char): """ ...
class KeyEvent:
""" Stores information of keyboard input event. Attributes: wnd -- Windows object of the event key -- key code returned by curses. """ KEY_TRANSLATE = { curses.KEY_BACKSPACE:'\x7f' } def __init__(self, wnd, key, no_trailing_char): """ Augume...
RESSED", curses.BUTTON4_RELEASED: "BUTTON4_RELEASED", curses.BUTTON4_TRIPLE_CLICKED: "BUTTON4_TRIPLE_CLICKED", curses.BUTTON_ALT: "BUTTON_ALT", curses.BUTTON_CTRL: "BUTTON_CTRL", curses.BUTTON_SHIFT: "BUTTON_SHIFT", } class KeyEvent:
64
64
203
4
60
atsuoishimoto/kaaedit
kaa/cui/keydef.py
Python
KeyEvent
KeyEvent
33
62
33
33
7da4fb7960f24050789f2e951ea1a22df9874d8f
bigcode/the-stack
train
3587b5b26c0a5b525cc9332f
train
function
def init(): # Experimental code to get keycode from cap name for i in range(512, 1024): name = str(curses.keyname(i), 'utf-8', 'replace') if name in CAPNAME_TO_KEY: KEYNAME_TO_CODE[CAPNAME_TO_KEY[name]] = i CAPNAME_TO_CODE[name] = i reg_code = KAA_KEYCODE_FROM # ...
def init(): # Experimental code to get keycode from cap name
for i in range(512, 1024): name = str(curses.keyname(i), 'utf-8', 'replace') if name in CAPNAME_TO_KEY: KEYNAME_TO_CODE[CAPNAME_TO_KEY[name]] = i CAPNAME_TO_CODE[name] = i reg_code = KAA_KEYCODE_FROM # register ESC + seq registered_seqs = set() for name, keyc...
b', curses.KEY_DOWN], b'\x1b\x1b[C': ['\x1b', curses.KEY_RIGHT], b'\x1b\x1b[D': ['\x1b', curses.KEY_LEFT], } REGISTERD_SEQUENCE = {} def init(): # Experimental code to get keycode from cap name
69
69
233
15
54
atsuoishimoto/kaaedit
kaa/cui/keydef.py
Python
init
init
289
313
289
290
25399a8e492000532c07b76b07e50833c67c2b9d
bigcode/the-stack
train
dde59501a30a276e7d9cf9a5
train
class
class MouseEvent: """ Stores information of mouse input event. Attributes: wnd -- Windows object of the event x, y -- Event coordinates code -- Type of event shift -- True if shift key was pressed ctrl -- True if control key was pressed alt -- True if alt key...
class MouseEvent:
""" Stores information of mouse input event. Attributes: wnd -- Windows object of the event x, y -- Event coordinates code -- Type of event shift -- True if shift key was pressed ctrl -- True if control key was pressed alt -- True if alt key was pressed "...
Windows object of the event key -- key code returned by curses. """ self.wnd = wnd self.key = self.KEY_TRANSLATE.get(key, key) self.no_trailing_char = no_trailing_char def __repr__(self): c = self.key if isinstance(self.key, int) else ord(self.key) nam...
125
125
418
4
121
atsuoishimoto/kaaedit
kaa/cui/keydef.py
Python
MouseEvent
MouseEvent
65
122
65
65
b3335b7e9b85d73039ab2fed99b1a66171a3b74a
bigcode/the-stack
train
6338550dea8706dd20bcb728
train
function
def keyfromname(key, ctrl, shift): return KEYNAME_TO_CODE.get((ctrl, shift, key))
def keyfromname(key, ctrl, shift):
return KEYNAME_TO_CODE.get((ctrl, shift, key))
, up): curses.KEY_SR, (0, 1, down): curses.KEY_SF, (0, 1, pagedown): curses.KEY_SNEXT, (0, 1, pageup): curses.KEY_SPREVIOUS, } def keyfromname(key, ctrl, shift):
64
64
24
10
54
atsuoishimoto/kaaedit
kaa/cui/keydef.py
Python
keyfromname
keyfromname
228
229
228
228
f55a872b5a073f641055fa6a040bd9bc50c32359
bigcode/the-stack
train
b82882cf10d82e6b89ba7918
train
function
def convert_registered_key(key): if key in REGISTERD_SEQUENCE: return REGISTERD_SEQUENCE[key] else: return [key]
def convert_registered_key(key):
if key in REGISTERD_SEQUENCE: return REGISTERD_SEQUENCE[key] else: return [key]
, (0, 1, pagedown): curses.KEY_SNEXT, (0, 1, pageup): curses.KEY_SPREVIOUS, } def keyfromname(key, ctrl, shift): return KEYNAME_TO_CODE.get((ctrl, shift, key)) def convert_registered_key(key):
64
64
29
6
58
atsuoishimoto/kaaedit
kaa/cui/keydef.py
Python
convert_registered_key
convert_registered_key
231
235
231
231
4a9ea9d35b12aef59f7af04184e29341290181e7
bigcode/the-stack
train
f896304c208e75e181adcba0
train
class
class TestIntegerField(unittest.TestCase): def test_deserialize(self): b = bytes([0x96, 0x01]) f = Integer(1) f.unmarshall(b) self.assertEqual(150, f.data) b = bytes([0b10101100, 0b00000010]) f.unmarshall(b) self.assertEqual(300, f.data) b = bytes([...
class TestIntegerField(unittest.TestCase):
def test_deserialize(self): b = bytes([0x96, 0x01]) f = Integer(1) f.unmarshall(b) self.assertEqual(150, f.data) b = bytes([0b10101100, 0b00000010]) f.unmarshall(b) self.assertEqual(300, f.data) b = bytes([0xfa, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x...
import unittest from simple.gRPC.Fields import Integer class TestIntegerField(unittest.TestCase):
19
90
301
8
10
shuttl-io/simple-grpc
tests/Grpc_test/Fields_test/IntegerField_test.py
Python
TestIntegerField
TestIntegerField
4
32
4
5
99cd41d7f44b163d0a0d9fa6f5ce1fed6d395bc7
bigcode/the-stack
train
108de53d887d2e4f531be845
train
function
def main(): '''Entry-point function for the simplewallet transaction processor.''' setup_loggers() try: # Register the transaction handler and start it. LOGGER.info("1") dd = sys.argv[2] LOGGER.info(dd) processor = TransactionProcessor(url=dd) LOGGER.info("Cre...
def main():
'''Entry-point function for the simplewallet transaction processor.''' setup_loggers() try: # Register the transaction handler and start it. LOGGER.info("1") dd = sys.argv[2] LOGGER.info(dd) processor = TransactionProcessor(url=dd) LOGGER.info("Create TP") ...
_wallet_address(self, from_key): return _hash(FAMILY_NAME.encode('utf-8'))[0:6] + _hash(from_key.encode('utf-8'))[0:64] def setup_loggers(): logging.basicConfig() logging.getLogger().setLevel(logging.DEBUG) def main():
64
64
144
3
61
Damenus/blockchain-hybridcloud
examples/simple.py
Python
main
main
184
207
184
184
90d35f2d306bad404a1dde32da8d276242cd57d5
bigcode/the-stack
train
6058ea50ad8b1e6006e6d5d9
train
class
class SimpleWalletTransactionHandler(TransactionHandler): ''' Transaction Processor class for the simplewallet transaction family. This with the validator using the accept/get/set functions. It implements functions to deposit, withdraw, and transfer money. ''' def __init__(self, namespace_pref...
class SimpleWalletTransactionHandler(TransactionHandler):
''' Transaction Processor class for the simplewallet transaction family. This with the validator using the accept/get/set functions. It implements functions to deposit, withdraw, and transfer money. ''' def __init__(self, namespace_prefix): self._namespace_prefix = namespace_prefix ...
in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either...
256
256
1,146
8
248
Damenus/blockchain-hybridcloud
examples/simple.py
Python
SimpleWalletTransactionHandler
SimpleWalletTransactionHandler
41
176
41
41
fc356079f75caa6a3b475b4e5590f41f15aaa2a5
bigcode/the-stack
train
d9290811f7b35f4bdf74c293
train
function
def _hash(data): '''Compute the SHA-512 hash and return the result as hex characters.''' return hashlib.sha512(data).hexdigest()
def _hash(data):
'''Compute the SHA-512 hash and return the result as hex characters.''' return hashlib.sha512(data).hexdigest()
sawtooth_sdk.processor.handler import TransactionHandler from sawtooth_sdk.processor.exceptions import InvalidTransaction from sawtooth_sdk.processor.exceptions import InternalError from sawtooth_sdk.processor.core import TransactionProcessor LOGGER = logging.getLogger(__name__) FAMILY_NAME = "simplewallet" def _has...
64
64
32
5
59
Damenus/blockchain-hybridcloud
examples/simple.py
Python
_hash
_hash
32
34
32
32
d5a535f2c079b241967461aac8581a47f575b0d3
bigcode/the-stack
train
92f2b7ff71dbb6658b1fbc6f
train
function
def setup_loggers(): logging.basicConfig() logging.getLogger().setLevel(logging.DEBUG)
def setup_loggers():
logging.basicConfig() logging.getLogger().setLevel(logging.DEBUG)
8') context.set_state({wallet_to_address: state_data}) def _get_wallet_address(self, from_key): return _hash(FAMILY_NAME.encode('utf-8'))[0:6] + _hash(from_key.encode('utf-8'))[0:64] def setup_loggers():
64
64
20
5
59
Damenus/blockchain-hybridcloud
examples/simple.py
Python
setup_loggers
setup_loggers
179
181
179
179
d08322b6c3867a637d3fe72bec7c62b930a3023c
bigcode/the-stack
train
43e5625399a2d55965600cf2
train
function
def process_file(w, filepath): with open(filepath, "r") as r: content = "\n".join(r.readlines()) for match in re.finditer(PATTERN, content): typename = match.group(1) w.write("\n") w.write("func New{}(\n".format(typename)) start = match.end() + 1 ...
def process_file(w, filepath):
with open(filepath, "r") as r: content = "\n".join(r.readlines()) for match in re.finditer(PATTERN, content): typename = match.group(1) w.write("\n") w.write("func New{}(\n".format(typename)) start = match.end() + 1 end = start + content[st...
#!/usr/bin/env python3 import os import re import sys PATTERN = re.compile(r"type (\w+) struct {") def process_file(w, filepath):
36
81
272
7
29
vutting4221/bandchain
chain/scripts/protoconstructorgen.py
Python
process_file
process_file
12
36
12
12
5724487c36c8448ca6256592512ed9403454297e
bigcode/the-stack
train
b71595790625a5ce6a573ec3
train
function
def main(path): with open(os.path.join(path, "constructors.go"), "w") as w: w.write("// Code generated by protoconstructorgen.py. DO NOT EDIT.\n") w.write("package {}\n".format(os.path.basename(path))) w.write("\n") w.write('import github_com_cosmos_cosmos_sdk_types "github.com/cosmo...
def main(path):
with open(os.path.join(path, "constructors.go"), "w") as w: w.write("// Code generated by protoconstructorgen.py. DO NOT EDIT.\n") w.write("package {}\n".format(os.path.basename(path))) w.write("\n") w.write('import github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/typ...
{{\n".format(typename)) for (key, _) in members: w.write("\t\t{}:{} {},\n".format(key, " " * (max_key_length - len(key)), key)) w.write("\t}\n") w.write("}\n") def main(path):
64
64
125
4
60
vutting4221/bandchain
chain/scripts/protoconstructorgen.py
Python
main
main
39
49
39
39
bbdff6190321baafc0982c24d07dee0a11a1936e
bigcode/the-stack
train
57b8b8e5972a0b2cf109f920
train
function
def iter_force_field_files(directory, extensions=FORCE_FIELD_PARSERS.keys()): """ Returns a generator over the path of all the force field files in the directory. """ return itertools.chain(*( glob(os.path.join(str(directory), '*' + extension)) for extension in extensions ))
def iter_force_field_files(directory, extensions=FORCE_FIELD_PARSERS.keys()):
""" Returns a generator over the path of all the force field files in the directory. """ return itertools.chain(*( glob(os.path.join(str(directory), '*' + extension)) for extension in extensions ))
(path) else: force_fields[name].read_from(path) except IOError: msg = 'An error occured while reading the force field in "{}".' raise IOError(msg.format(path)) return force_fields def iter_force_field_files(directory, extensions=FORCE_...
64
64
64
17
46
MMSB-MOBI/vermouth-martinize
vermouth/forcefield.py
Python
iter_force_field_files
iter_force_field_files
180
187
180
180
008e442b4922ea63d49687d324caed7d39b069f7
bigcode/the-stack
train
90ce977be2bc8772badcd631
train
function
def find_force_fields(directory, force_fields=None): """ Read all the force fields in the given directory. A force field is defined as a directory that contains at least one RTP file. The name of the force field is the base name of the directory. If the force field argument is not ``None``, then i...
def find_force_fields(directory, force_fields=None):
""" Read all the force fields in the given directory. A force field is defined as a directory that contains at least one RTP file. The name of the force field is the base name of the directory. If the force field argument is not ``None``, then it must be a dictionary with force field names as ...
property def features(self): """ List the features declared by the links. Returns ------- set """ return set(feature for link in self.links for feature in link.features) def has_feature(self, feature): """ Test if a feature is declared by...
110
110
369
10
99
MMSB-MOBI/vermouth-martinize
vermouth/forcefield.py
Python
find_force_fields
find_force_fields
131
177
131
131
8875993d767b980df37a332c25cae77b2a993d30
bigcode/the-stack
train
b2f95c597697285eed8df4ca
train
class
class ForceField: """ Description of a force field. A force field can be created empty or read from a directory. In any case, a force field must be named. If read from a directory, the base name of the directory is used as force field name, unless the `name` attribute is provided. If the force ...
class ForceField:
""" Description of a force field. A force field can be created empty or read from a directory. In any case, a force field must be named. If read from a directory, the base name of the directory is used as force field name, unless the `name` attribute is provided. If the force field is created e...
governing permissions and # limitations under the License. """ Provides a class used to describe a forcefield and all associated data. """ import itertools from glob import glob import os from .file_writer import open from .gmx.rtp import read_rtp from .ffinput import read_ff from .citation_parser import read_bib fr...
155
156
523
4
151
MMSB-MOBI/vermouth-martinize
vermouth/forcefield.py
Python
ForceField
ForceField
36
128
36
36
64510614f3084efd114f86e323277ff81ea3f1c5
bigcode/the-stack
train
e382d6fbabf059447e1147d2
train
function
def get_native_force_field(name): """ Get a force field from the distributed library knowing its name. Parameters ---------- name: str The name of the requested force field. Returns ------- ForceField Raises ------ KeyError There is no force field with the ...
def get_native_force_field(name):
""" Get a force field from the distributed library knowing its name. Parameters ---------- name: str The name of the requested force field. Returns ------- ForceField Raises ------ KeyError There is no force field with the requested name in the distributed ...
_field_files(directory, extensions=FORCE_FIELD_PARSERS.keys()): """ Returns a generator over the path of all the force field files in the directory. """ return itertools.chain(*( glob(os.path.join(str(directory), '*' + extension)) for extension in extensions )) def get_native_force_f...
68
69
230
7
61
MMSB-MOBI/vermouth-martinize
vermouth/forcefield.py
Python
get_native_force_field
get_native_force_field
190
220
190
190
a56cf8bfa1f16b0f16fc7a6fce4f76efd922f810
bigcode/the-stack
train
30ff8322ff9cd68c0750f1bd
train
function
def isin(element, test_elements, assume_unique=False, invert=False): """ Calculates `element in test_elements`, broadcasting over `element` only. Returns a boolean array of the same shape as `element` that is True where an element of `element` is in `test_elements` and False otherwise. Parameters ...
def isin(element, test_elements, assume_unique=False, invert=False):
""" Calculates `element in test_elements`, broadcasting over `element` only. Returns a boolean array of the same shape as `element` that is True where an element of `element` is in `test_elements` and False otherwise. Parameters ---------- element : array_like Input tensor. test...
test_elements_chunk = test_elements.chunks[0] out_chunks = [] for c in in_tensor.chunks: chunk_op = op.copy().reset_key() out_chunk = chunk_op.new_chunk([c, test_elements_chunk], shape=c.shape, index=c.index, order=out_tensor.order) ...
222
222
743
14
208
zebivy/mars
mars/tensor/base/isin.py
Python
isin
isin
105
189
105
105
23ac511a7bb636411fce5ed98711ce4ad1f6d603
bigcode/the-stack
train
58423937410e7ce7d255f5d1
train
class
class TensorIsIn(TensorOperand, TensorOperandMixin): _op_type_ = OperandDef.ISIN _element = KeyField('element') _test_elements = KeyField('test_elements') _assume_unique = BoolField('assume_unique') _invert = BoolField('invert') def __init__(self, assume_unique=None, invert=None, dtype=None, *...
class TensorIsIn(TensorOperand, TensorOperandMixin):
_op_type_ = OperandDef.ISIN _element = KeyField('element') _test_elements = KeyField('test_elements') _assume_unique = BoolField('assume_unique') _invert = BoolField('invert') def __init__(self, assume_unique=None, invert=None, dtype=None, **kw): dtype = np.dtype(bool) if dtype is None...
-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the Licens...
169
169
566
12
156
zebivy/mars
mars/tensor/base/isin.py
Python
TensorIsIn
TensorIsIn
30
102
30
30
635bb5cd4eb74c8e5fc50d46e1494277ffab34ed
bigcode/the-stack
train
4c9883af64180770162fbc05
train
function
def CurrentSourceInfoMetadata(op_type=None, op_name=None, skip_frames=1): """Helper for use in source mapping that returns an OpMetadata object.""" full_filename, lineno = inspect.stack()[skip_frames][1:3] filename = os.path.basename(full_filename) return OpMetadata( op_type=op_type, op_name=op_name...
def CurrentSourceInfoMetadata(op_type=None, op_name=None, skip_frames=1):
"""Helper for use in source mapping that returns an OpMetadata object.""" full_filename, lineno = inspect.stack()[skip_frames][1:3] filename = os.path.basename(full_filename) return OpMetadata( op_type=op_type, op_name=op_name, source_file=filename, source_line=lineno)
op_type='', op_name='', source_file='', source_line=0): self.op_type = op_type self.op_name = op_name self.source_file = source_file self.source_line = source_line def CurrentSourceInfoMetadata(op_type=None, op_name=None, skip_frames=1):
64
64
91
18
45
jzoker/tensorflow
tensorflow/compiler/xla/python/xla_client.py
Python
CurrentSourceInfoMetadata
CurrentSourceInfoMetadata
160
168
160
160
d7421ef082ab4e4cf1e0105f9c68ca53f0c021a3
bigcode/the-stack
train
842f8b6d89443578f0b884fd
train
class
class ReplicaGroup(object): """Python representation of a xla.ReplicaGroup protobuf.""" __slots__ = ('replica_ids',) def __init__(self): self.replica_ids = []
class ReplicaGroup(object):
"""Python representation of a xla.ReplicaGroup protobuf.""" __slots__ = ('replica_ids',) def __init__(self): self.replica_ids = []
'inserted_window_dims', 'scatter_dims_to_operand_dims', 'index_vector_dim') def __init__(self): self.update_window_dims = [] self.inserted_window_dims = [] self.scatter_dims_to_operand_dims = [] self.index_vector_dim = 0 class ReplicaGroup(object):
64
64
44
5
58
jzoker/tensorflow
tensorflow/compiler/xla/python/xla_client.py
Python
ReplicaGroup
ReplicaGroup
643
648
643
643
27cfa73d1fa8d6fe0c68bde43950430d0299c27f
bigcode/the-stack
train
339fb8ceb361e6f3dfe75e18
train
function
def make_padding_config( padding_config: Union[PaddingConfig, Sequence[Tuple[int, int, int]]] ) -> PaddingConfig: """Create PaddingConfig proto from list of triples of integers. Args: padding_config: either a PaddingConfig or a list of integer triples (edge_padding_low, edge_padding_high, interior_pa...
def make_padding_config( padding_config: Union[PaddingConfig, Sequence[Tuple[int, int, int]]] ) -> PaddingConfig:
"""Create PaddingConfig proto from list of triples of integers. Args: padding_config: either a PaddingConfig or a list of integer triples (edge_padding_low, edge_padding_high, interior_padding) representing the configuration of the padding operation. Returns: A `PaddingConfig` object. """ ...
"""Python representation of a xla.PaddingConfig protobuf.""" __slots__ = ('dimensions',) def __init__(self): self.dimensions = [] def make_padding_config( padding_config: Union[PaddingConfig, Sequence[Tuple[int, int, int]]] ) -> PaddingConfig:
63
64
181
29
34
jzoker/tensorflow
tensorflow/compiler/xla/python/xla_client.py
Python
make_padding_config
make_padding_config
446
468
446
448
41f36954d33cac7647d66d7b46fc1b874917a61c
bigcode/the-stack
train
3120bf2a1c7415b9bc3f8930
train
function
def make_replica_groups(replica_groups): if replica_groups is None: replica_groups_protos = [] # special value for XLA API else: replica_groups = list(replica_groups) replica_groups_protos = [ _make_replica_group_proto(group) for group in replica_groups ] return replica_groups_protos
def make_replica_groups(replica_groups):
if replica_groups is None: replica_groups_protos = [] # special value for XLA API else: replica_groups = list(replica_groups) replica_groups_protos = [ _make_replica_group_proto(group) for group in replica_groups ] return replica_groups_protos
_ids',) def __init__(self): self.replica_ids = [] def _make_replica_group_proto(replica_group): replica_group_proto = ReplicaGroup() replica_group_proto.replica_ids.extend(replica_group) return replica_group_proto def make_replica_groups(replica_groups):
64
64
75
9
54
jzoker/tensorflow
tensorflow/compiler/xla/python/xla_client.py
Python
make_replica_groups
make_replica_groups
657
665
657
657
084bf38ea99b8af83612487caa8459e130e9beee
bigcode/the-stack
train
a6d7b9760011d200fae4efc5
train
class
class ConvolutionDimensionNumbers(object): """Python representation of a xla.ConvolutionDimensionNumbers protobuf.""" __slots__ = ('input_batch_dimension', 'input_feature_dimension', 'input_spatial_dimensions', 'kernel_input_feature_dimension', 'kernel_output_feature_dimension', 'kerne...
class ConvolutionDimensionNumbers(object):
"""Python representation of a xla.ConvolutionDimensionNumbers protobuf.""" __slots__ = ('input_batch_dimension', 'input_feature_dimension', 'input_spatial_dimensions', 'kernel_input_feature_dimension', 'kernel_output_feature_dimension', 'kernel_spatial_dimensions', 'outp...
ing_dimensions.extend(lhs_contract) dot_dims_proto.rhs_contracting_dimensions.extend(rhs_contract) dot_dims_proto.lhs_batch_dimensions.extend(lhs_batch) dot_dims_proto.rhs_batch_dimensions.extend(rhs_batch) return dot_dims_proto else: return dimension_numbers class ConvolutionDimensionNumbers(obje...
64
64
167
7
56
jzoker/tensorflow
tensorflow/compiler/xla/python/xla_client.py
Python
ConvolutionDimensionNumbers
ConvolutionDimensionNumbers
511
528
511
511
9f499404227e8a36bfe5407691994c8997108dbd
bigcode/the-stack
train
bc2da51cb461a815787be862
train
function
def shape_from_pyval(pyval): """Returns a Shape that describes a tuple-tree of Numpy arrays.""" def convert(pyval): if isinstance(pyval, tuple): return Shape.tuple_shape(tuple(convert(elt) for elt in pyval)) else: return Shape.array_shape(pyval.dtype, np.shape(pyval)) return convert(pyval)
def shape_from_pyval(pyval):
"""Returns a Shape that describes a tuple-tree of Numpy arrays.""" def convert(pyval): if isinstance(pyval, tuple): return Shape.tuple_shape(tuple(convert(elt) for elt in pyval)) else: return Shape.array_shape(pyval.dtype, np.shape(pyval)) return convert(pyval)
C++ object that duck types like the following class. class ProgramShape(object): def __init__(self, parameter_shapes, result_shape): def parameter_shapes(self) -> [Shape]: def result_shape(self) -> Shape: def __repr__(self): """ def shape_from_pyval(pyval):
64
64
77
8
56
jzoker/tensorflow
tensorflow/compiler/xla/python/xla_client.py
Python
shape_from_pyval
shape_from_pyval
269
278
269
269
3a59af4a23cbc64eafe1be45cdabd8412d811b12
bigcode/the-stack
train
a0c25cddd4bfe830da3e09f7
train
class
class OpSharding(object): """Python representation of a xla.OpSharding protobuf.""" __slots__ = ('type', 'tile_assignment_dimensions', 'tile_assignment_devices', 'tuple_shardings') Type = _xla.OpSharding_Type def __init__(self): self.type = self.Type.REPLICATED self.tile_assignment_dime...
class OpSharding(object):
"""Python representation of a xla.OpSharding protobuf.""" __slots__ = ('type', 'tile_assignment_dimensions', 'tile_assignment_devices', 'tuple_shardings') Type = _xla.OpSharding_Type def __init__(self): self.type = self.Type.REPLICATED self.tile_assignment_dimensions = [] self.tile_...
i: rhs_spec.index(lhs_spec[i]))) dimension_numbers.output_spatial_dimensions.extend( sorted((i for i, c in enumerate(out_spec) if c not in {'N', 'C'}), key=lambda i: rhs_spec.index(out_spec[i]))) return dimension_numbers class OpSharding(object):
64
64
95
6
57
jzoker/tensorflow
tensorflow/compiler/xla/python/xla_client.py
Python
OpSharding
OpSharding
595
606
595
595
7e000fa5515ac72be427f78108ff778eadcf2da4
bigcode/the-stack
train
a7af3f5aa4cdcdb350be8189
train
class
class PrecisionConfig(object): """Python representation of a xla.PrecisionConfig protobuf.""" __slots__ = ('operand_precision',) Precision = _xla.PrecisionConfig_Precision def __init__(self): self.operand_precision = []
class PrecisionConfig(object):
"""Python representation of a xla.PrecisionConfig protobuf.""" __slots__ = ('operand_precision',) Precision = _xla.PrecisionConfig_Precision def __init__(self): self.operand_precision = []
'tuple_shardings') Type = _xla.OpSharding_Type def __init__(self): self.type = self.Type.REPLICATED self.tile_assignment_dimensions = [] self.tile_assignment_devices = [] self.tuple_shardings = [] class PrecisionConfig(object):
63
64
57
5
58
jzoker/tensorflow
tensorflow/compiler/xla/python/xla_client.py
Python
PrecisionConfig
PrecisionConfig
609
616
609
609
4aecd4ed657761871a262ad69e28cfc618d9461b
bigcode/the-stack
train
6eb53112186d44ee302240ad
train
class
class GatherDimensionNumbers(object): """Python representation of a xla.GatherDimensionNumbers protobuf.""" __slots__ = ('offset_dims', 'collapsed_slice_dims', 'start_index_map', 'index_vector_dim') def __init__(self): self.offset_dims = [] self.collapsed_slice_dims = [] self.start_ind...
class GatherDimensionNumbers(object):
"""Python representation of a xla.GatherDimensionNumbers protobuf.""" __slots__ = ('offset_dims', 'collapsed_slice_dims', 'start_index_map', 'index_vector_dim') def __init__(self): self.offset_dims = [] self.collapsed_slice_dims = [] self.start_index_map = [] self.index_vector_dim ...
class PrecisionConfig(object): """Python representation of a xla.PrecisionConfig protobuf.""" __slots__ = ('operand_precision',) Precision = _xla.PrecisionConfig_Precision def __init__(self): self.operand_precision = [] class GatherDimensionNumbers(object):
63
64
82
6
57
jzoker/tensorflow
tensorflow/compiler/xla/python/xla_client.py
Python
GatherDimensionNumbers
GatherDimensionNumbers
619
628
619
619
93afd9dbd410be5d8724756ff541075d61b96e10
bigcode/the-stack
train
20139c3e382d9280424d1e0d
train
class
class OpMetadata(object): """Python representation of a xla.OpMetadata protobuf.""" __slots__ = ('op_type', 'op_name', 'source_file', 'source_line') def __init__(self, op_type='', op_name='', source_file='', source_line=0): self.op_type = op_type self.op_name = op_name self.source_file = source_file ...
class OpMetadata(object):
"""Python representation of a xla.OpMetadata protobuf.""" __slots__ = ('op_type', 'op_name', 'source_file', 'source_line') def __init__(self, op_type='', op_name='', source_file='', source_line=0): self.op_type = op_type self.op_name = op_name self.source_file = source_file self.source_line = sou...
A LocalBackend object. """ backends = _get_local_backends() if name is not None: try: return backends[name] except KeyError: raise RuntimeError('Unknown backend {}'.format(name)) return list(backends.values())[-1] class OpMetadata(object):
64
64
91
5
59
jzoker/tensorflow
tensorflow/compiler/xla/python/xla_client.py
Python
OpMetadata
OpMetadata
149
157
149
149
a7ffdb01f7eb20a895b50b152e46fb1e9aca4f55
bigcode/the-stack
train
d1b73c0a00022aacdc2b3ec2
train
function
def execute_with_python_values_replicated(executable, arguments, backend): """Execute on many replicas with Python values as arguments and output. Arguments: executable: the program to run. arguments: a list of lists of Python values indexed by `[replica][arg_num]` to pass as inputs. backend: the...
def execute_with_python_values_replicated(executable, arguments, backend):
"""Execute on many replicas with Python values as arguments and output. Arguments: executable: the program to run. arguments: a list of lists of Python values indexed by `[replica][arg_num]` to pass as inputs. backend: the backend we are targeting. Returns: A list of python values, one per...
def put(arg): return backend.buffer_from_pyval(arg, device=executable.local_devices()[0]) arguments = [put(arg) for arg in arguments] outputs = executable.execute(arguments) return [x.to_py() for x in outputs] def execute_with_python_values_replicated(executable, arguments, backend):
69
69
231
15
54
jzoker/tensorflow
tensorflow/compiler/xla/python/xla_client.py
Python
execute_with_python_values_replicated
execute_with_python_values_replicated
341
367
341
341
e996295e9e431b0fab4141d931bc8f07c32bee67
bigcode/the-stack
train
887109b63b4129abf44ac0ea
train
function
def register_local_backend_factory(name, factory): _local_backend_factories[name] = factory
def register_local_backend_factory(name, factory):
_local_backend_factories[name] = factory
# Backend factories, keyed by user-visible name, in increasing priority order. _local_backend_factories = collections.OrderedDict([ ('interpreter', _interpreter_backend_factory), ('cpu', _cpu_backend_factory), ('gpu', _gpu_backend_factory), ]) def register_local_backend_factory(name, factory):
64
64
20
9
55
jzoker/tensorflow
tensorflow/compiler/xla/python/xla_client.py
Python
register_local_backend_factory
register_local_backend_factory
98
99
98
98
d0fa2928db69abb4a5ee9f1aade5e01eadf49e89
bigcode/the-stack
train
d41b5f3dbc0653d31dbf4e09
train
class
class ScatterDimensionNumbers(object): """Python representation of a xla.ScatterDimensionNumbers protobuf.""" __slots__ = ('update_window_dims', 'inserted_window_dims', 'scatter_dims_to_operand_dims', 'index_vector_dim') def __init__(self): self.update_window_dims = [] self.inserted_window...
class ScatterDimensionNumbers(object):
"""Python representation of a xla.ScatterDimensionNumbers protobuf.""" __slots__ = ('update_window_dims', 'inserted_window_dims', 'scatter_dims_to_operand_dims', 'index_vector_dim') def __init__(self): self.update_window_dims = [] self.inserted_window_dims = [] self.scatter_dims_to_ope...
= ('offset_dims', 'collapsed_slice_dims', 'start_index_map', 'index_vector_dim') def __init__(self): self.offset_dims = [] self.collapsed_slice_dims = [] self.start_index_map = [] self.index_vector_dim = 0 class ScatterDimensionNumbers(object):
64
64
89
6
57
jzoker/tensorflow
tensorflow/compiler/xla/python/xla_client.py
Python
ScatterDimensionNumbers
ScatterDimensionNumbers
631
640
631
631
01e65c2404fc30a8946209039977e4c0763f9537
bigcode/the-stack
train
c55a191a69b5ea45167f0978
train
function
def window_padding_type_to_pad_values(padding_type, lhs_dims, rhs_dims, window_strides): """Maps PaddingType or string to pad values (list of pairs of ints).""" if not isinstance(padding_type, (str, PaddingType)): msg = 'padding_type must be str or PaddingType, got {}.' ...
def window_padding_type_to_pad_values(padding_type, lhs_dims, rhs_dims, window_strides):
"""Maps PaddingType or string to pad values (list of pairs of ints).""" if not isinstance(padding_type, (str, PaddingType)): msg = 'padding_type must be str or PaddingType, got {}.' raise TypeError(msg.format(type(padding_type))) if isinstance(padding_type, str): if padding_type.upper() == 'VALID': ...
_args in arguments: arg_buffers.append(flat_arg_buffers[:len(replica_args)]) flat_arg_buffers = flat_arg_buffers[len(replica_args):] return [[x.to_py() for x in xs] for xs in executable.execute_on_local_devices(arg_buffers)] class PaddingType(enum.Enum): VALID = 1 SAME = 2 def windo...
97
97
325
22
74
jzoker/tensorflow
tensorflow/compiler/xla/python/xla_client.py
Python
window_padding_type_to_pad_values
window_padding_type_to_pad_values
375
403
375
376
f5e1db26e3f3088bf5e305aa79ae7e8aa23766bd
bigcode/the-stack
train
88960610674bc09b7cb4a5bc
train
function
def _get_local_backends(): """Instantiates all known local backends.""" global _local_backends if _local_backends is not None: return _local_backends _local_backends = collections.OrderedDict() for name, factory in _local_backend_factories.items(): logging.vlog(2, "Initializing backend '%s'" % name) ...
def _get_local_backends():
"""Instantiates all known local backends.""" global _local_backends if _local_backends is not None: return _local_backends _local_backends = collections.OrderedDict() for name, factory in _local_backend_factories.items(): logging.vlog(2, "Initializing backend '%s'" % name) try: backend = fa...
([ ('interpreter', _interpreter_backend_factory), ('cpu', _cpu_backend_factory), ('gpu', _gpu_backend_factory), ]) def register_local_backend_factory(name, factory): _local_backend_factories[name] = factory _local_backends = None def _get_local_backends():
64
64
163
7
56
jzoker/tensorflow
tensorflow/compiler/xla/python/xla_client.py
Python
_get_local_backends
_get_local_backends
105
125
105
105
7fd74be9db0d3da706abad5091c24d26ea62d284
bigcode/the-stack
train
cf112bcab767e75561565053
train
class
class PaddingConfigDimension(object): """Python representation of a xla.PaddingConfigDimension protobuf.""" __slots__ = ('edge_padding_low', 'edge_padding_high', 'interior_padding') def __init__(self): self.edge_padding_low = 0 self.edge_padding_high = 0 self.interior_padding = 0
class PaddingConfigDimension(object):
"""Python representation of a xla.PaddingConfigDimension protobuf.""" __slots__ = ('edge_padding_low', 'edge_padding_high', 'interior_padding') def __init__(self): self.edge_padding_low = 0 self.edge_padding_high = 0 self.interior_padding = 0
PyCapsule object containing the function pointer. platform: the target platform. """ _xla.register_custom_call_target(name, fn, xla_platform_names[platform]) # Deprecated. Use register_custom_call_target instead. register_cpu_custom_call_target = register_custom_call_target class PaddingConfigDimension(objec...
64
64
73
6
57
jzoker/tensorflow
tensorflow/compiler/xla/python/xla_client.py
Python
PaddingConfigDimension
PaddingConfigDimension
428
435
428
428
d08f7c92a6337700c993a9475974af1881246267
bigcode/the-stack
train
149692175b4f82c1e6f0024d
train
function
def _make_replica_group_proto(replica_group): replica_group_proto = ReplicaGroup() replica_group_proto.replica_ids.extend(replica_group) return replica_group_proto
def _make_replica_group_proto(replica_group):
replica_group_proto = ReplicaGroup() replica_group_proto.replica_ids.extend(replica_group) return replica_group_proto
self.index_vector_dim = 0 class ReplicaGroup(object): """Python representation of a xla.ReplicaGroup protobuf.""" __slots__ = ('replica_ids',) def __init__(self): self.replica_ids = [] def _make_replica_group_proto(replica_group):
63
64
37
11
52
jzoker/tensorflow
tensorflow/compiler/xla/python/xla_client.py
Python
_make_replica_group_proto
_make_replica_group_proto
651
654
651
651
0f53f7a9f012fac46093501e9d8a71995d5ea93e
bigcode/the-stack
train
2660f15b8e9c7155e8f0ada6
train
function
def _gpu_backend_factory(distributed_client=None, node_id=0): """Returns a GPU backend. BFC allocator is used by default.""" allocator = os.getenv('XLA_PYTHON_CLIENT_ALLOCATOR', 'default').lower() memory_fraction = os.getenv('XLA_PYTHON_CLIENT_MEM_FRACTION') preallocate = os.getenv('XLA_PYTHON_CLIENT_PREALLOCAT...
def _gpu_backend_factory(distributed_client=None, node_id=0):
"""Returns a GPU backend. BFC allocator is used by default.""" allocator = os.getenv('XLA_PYTHON_CLIENT_ALLOCATOR', 'default').lower() memory_fraction = os.getenv('XLA_PYTHON_CLIENT_MEM_FRACTION') preallocate = os.getenv('XLA_PYTHON_CLIENT_PREALLOCATE') if allocator not in ('default', 'platform', 'bfc'): ...
xla.ops profiler = _xla.profiler xla_platform_names = { 'cpu': 'Host', 'gpu': 'CUDA', } def _interpreter_backend_factory(): return _xla.get_interpreter_client() def _cpu_backend_factory(): return _xla.get_cpu_client(asynchronous=True) def _gpu_backend_factory(distributed_client=None, node_id=0):
84
84
281
15
69
jzoker/tensorflow
tensorflow/compiler/xla/python/xla_client.py
Python
_gpu_backend_factory
_gpu_backend_factory
63
87
63
63
ee29ddc8a6c219b7da9468b384a6513e53b3d20d
bigcode/the-stack
train
c7387df36108b43d410a1998
train
class
class PaddingType(enum.Enum): VALID = 1 SAME = 2
class PaddingType(enum.Enum):
VALID = 1 SAME = 2
replica_args in arguments: arg_buffers.append(flat_arg_buffers[:len(replica_args)]) flat_arg_buffers = flat_arg_buffers[len(replica_args):] return [[x.to_py() for x in xs] for xs in executable.execute_on_local_devices(arg_buffers)] class PaddingType(enum.Enum):
63
64
18
6
57
jzoker/tensorflow
tensorflow/compiler/xla/python/xla_client.py
Python
PaddingType
PaddingType
370
372
370
370
ce6f62724e7b905977b5fa3caec01badc36c1d6d
bigcode/the-stack
train
27ec09b1532403cb058d44c5
train
function
def dtype_to_etype(dtype): """Convenience function for reading DTYPE_TO_XLA_ELEMENT_TYPE.""" return DTYPE_TO_XLA_ELEMENT_TYPE[str(np.dtype(dtype))]
def dtype_to_etype(dtype):
"""Convenience function for reading DTYPE_TO_XLA_ELEMENT_TYPE.""" return DTYPE_TO_XLA_ELEMENT_TYPE[str(np.dtype(dtype))]
/numpy/issues/7242). Thus, # when keying by dtype in this dict, we use the string form of dtypes. DTYPE_TO_XLA_ELEMENT_TYPE = { str(dt): et for et, dt in XLA_ELEMENT_TYPE_TO_DTYPE.items() } def dtype_to_etype(dtype):
64
64
36
7
57
jzoker/tensorflow
tensorflow/compiler/xla/python/xla_client.py
Python
dtype_to_etype
dtype_to_etype
203
205
203
203
b1257bdaf2f9b8e1b9c8a328fff8f7dbcc1c9533
bigcode/the-stack
train
4f29345ad46bd67b6e9b6b47
train
function
def get_local_backend(name=None): """Returns a local backend. Args: name: the backend name. If `None`, a default local backend is returned, typically `gpu` if one is present, or `cpu` if not. If a string, the named backend is returned or an exception raised. Returns: A LocalBackend object. ...
def get_local_backend(name=None):
"""Returns a local backend. Args: name: the backend name. If `None`, a default local backend is returned, typically `gpu` if one is present, or `cpu` if not. If a string, the named backend is returned or an exception raised. Returns: A LocalBackend object. """ backends = _get_local_backe...
CPU to initialize successfully. raise else: # If the backend isn't built into the binary, or if it has no devices, # we expect a RuntimeError. continue _local_backends[name] = backend return _local_backends def get_local_backend(name=None):
64
64
131
7
56
jzoker/tensorflow
tensorflow/compiler/xla/python/xla_client.py
Python
get_local_backend
get_local_backend
128
146
128
128
b47522a3715ad5f5d322196e94f872b007328f7e
bigcode/the-stack
train
b89719cc9891393831397d52
train
function
def make_convolution_dimension_numbers( dimension_numbers: Union[None, ConvolutionDimensionNumbers, Tuple[str, str, str]], num_spatial_dimensions: int) -> ConvolutionDimensionNumbers: """Builds a ConvolutionDimensionNumbers object from a sp...
def make_convolution_dimension_numbers( dimension_numbers: Union[None, ConvolutionDimensionNumbers, Tuple[str, str, str]], num_spatial_dimensions: int) -> ConvolutionDimensionNumbers:
"""Builds a ConvolutionDimensionNumbers object from a specification. Args: dimension_numbers: optional, either a ConvolutionDimensionNumbers object or a tuple (lhs_spec, rhs_spec, out_spec). Each element is a string of length N+2 identifying by position: (1) batch dimensions in lhs, rhs, and ...
(rhs_batch) return dot_dims_proto else: return dimension_numbers class ConvolutionDimensionNumbers(object): """Python representation of a xla.ConvolutionDimensionNumbers protobuf.""" __slots__ = ('input_batch_dimension', 'input_feature_dimension', 'input_spatial_dimensions', 'kernel_input...
226
227
758
42
184
jzoker/tensorflow
tensorflow/compiler/xla/python/xla_client.py
Python
make_convolution_dimension_numbers
make_convolution_dimension_numbers
531
592
531
534
d3264f164e217b16427e1a8a81db5762aa6234c5
bigcode/the-stack
train
734c2c4efdc41d8e52e2c320
train
function
def make_dot_dimension_numbers( dimension_numbers: Union[DotDimensionNumbers, Tuple[Tuple[List[int], List[int]], Tuple[List[int], List[int]]]] ) -> DotDimensionNumbers: """Builds a DotDimensionNumbers object from a specification. Args: dimensi...
def make_dot_dimension_numbers( dimension_numbers: Union[DotDimensionNumbers, Tuple[Tuple[List[int], List[int]], Tuple[List[int], List[int]]]] ) -> DotDimensionNumbers:
"""Builds a DotDimensionNumbers object from a specification. Args: dimension_numbers: either a `DotDimensionNumbers` or a nested tuple `((lhs_contract, rhs_contract), (lhs_batch, rhs_batch))` of lists of integers representing the dimensions to treat as contracting dimensions and batch dimensi...
= [] self.rhs_contracting_dimensions = [] self.lhs_batch_dimensions = [] self.rhs_batch_dimensions = [] def make_dot_dimension_numbers( dimension_numbers: Union[DotDimensionNumbers, Tuple[Tuple[List[int], List[int]], Tuple[List[int], List[...
68
69
232
41
27
jzoker/tensorflow
tensorflow/compiler/xla/python/xla_client.py
Python
make_dot_dimension_numbers
make_dot_dimension_numbers
483
508
483
487
0870b650f63cf56af1a5eba7ae9265159c47bcfe
bigcode/the-stack
train
098452f145673ffd7b3904df
train
function
def _interpreter_backend_factory(): return _xla.get_interpreter_client()
def _interpreter_backend_factory():
return _xla.get_interpreter_client()
Pylint has false positives for type annotations. # pylint: disable=invalid-sequence-index ops = _xla.ops profiler = _xla.profiler xla_platform_names = { 'cpu': 'Host', 'gpu': 'CUDA', } def _interpreter_backend_factory():
64
64
17
7
57
jzoker/tensorflow
tensorflow/compiler/xla/python/xla_client.py
Python
_interpreter_backend_factory
_interpreter_backend_factory
55
56
55
55
4313f21b300b5bcc0ed9b1d3f1007bc60bd756b8
bigcode/the-stack
train
70af0db4dc7f6eada1d534db
train
function
def register_custom_call_target(name, fn, platform='cpu'): """Registers a custom call target. Args: name: bytes containing the name of the function. fn: a PyCapsule object containing the function pointer. platform: the target platform. """ _xla.register_custom_call_target(name, fn, xla_platform_nam...
def register_custom_call_target(name, fn, platform='cpu'):
"""Registers a custom call target. Args: name: bytes containing the name of the function. fn: a PyCapsule object containing the function pointer. platform: the target platform. """ _xla.register_custom_call_target(name, fn, xla_platform_names[platform])
)) XlaBuilder = _xla.XlaBuilder XlaComputation = _xla.XlaComputation FftType = _xla.FftType Buffer = _xla.Buffer Executable = _xla.Executable def register_custom_call_target(name, fn, platform='cpu'):
64
64
76
13
50
jzoker/tensorflow
tensorflow/compiler/xla/python/xla_client.py
Python
register_custom_call_target
register_custom_call_target
413
421
413
413
3f25d6e3ef8777fa16214ec4a407d42eefa2581c
bigcode/the-stack
train
6a8e6ddbea6d449cb0e1718d
train
class
class PaddingConfig(object): """Python representation of a xla.PaddingConfig protobuf.""" __slots__ = ('dimensions',) def __init__(self): self.dimensions = []
class PaddingConfig(object):
"""Python representation of a xla.PaddingConfig protobuf.""" __slots__ = ('dimensions',) def __init__(self): self.dimensions = []
.PaddingConfigDimension protobuf.""" __slots__ = ('edge_padding_low', 'edge_padding_high', 'interior_padding') def __init__(self): self.edge_padding_low = 0 self.edge_padding_high = 0 self.interior_padding = 0 class PaddingConfig(object):
64
64
39
5
58
jzoker/tensorflow
tensorflow/compiler/xla/python/xla_client.py
Python
PaddingConfig
PaddingConfig
438
443
438
438
9aca6c59d035bebc3fc47a937d93ed1750615eea
bigcode/the-stack
train
5fd684f940a69657e794f6a7
train
function
def _cpu_backend_factory(): return _xla.get_cpu_client(asynchronous=True)
def _cpu_backend_factory():
return _xla.get_cpu_client(asynchronous=True)
-sequence-index ops = _xla.ops profiler = _xla.profiler xla_platform_names = { 'cpu': 'Host', 'gpu': 'CUDA', } def _interpreter_backend_factory(): return _xla.get_interpreter_client() def _cpu_backend_factory():
64
64
18
6
58
jzoker/tensorflow
tensorflow/compiler/xla/python/xla_client.py
Python
_cpu_backend_factory
_cpu_backend_factory
59
60
59
59
55eb103c8e4f5ca0c9c7a66e248d071579795824
bigcode/the-stack
train
ca1eac1fa9ee3481b62ce53f
train
function
def execute_with_python_values(executable, arguments, backend): """Execute on one replica with Python values as arguments and output.""" def put(arg): return backend.buffer_from_pyval(arg, device=executable.local_devices()[0]) arguments = [put(arg) for arg in arguments] outputs = executable.execute(argume...
def execute_with_python_values(executable, arguments, backend):
"""Execute on one replica with Python values as arguments and output.""" def put(arg): return backend.buffer_from_pyval(arg, device=executable.local_devices()[0]) arguments = [put(arg) for arg in arguments] outputs = executable.execute(arguments) return [x.to_py() for x in outputs]
If a shallow sequence of arguments was passed in for `arguments`, then # the sole, zero'th device's output is returned instead, as a Buffer. # """ # # There are different implementations of Executable for different backends. def execute_with_python_values(executable, arguments, backend):
64
64
80
12
52
jzoker/tensorflow
tensorflow/compiler/xla/python/xla_client.py
Python
execute_with_python_values
execute_with_python_values
330
338
330
330
0c256e051d4eb640a72edab5fa923a3a73f3c51b
bigcode/the-stack
train
c80e887ae63f4a7dd9b4c13f
train
class
class DotDimensionNumbers(object): """Python representation of a xla.DotDimensionNumbers protobuf.""" __slots__ = ('lhs_contracting_dimensions', 'rhs_contracting_dimensions', 'lhs_batch_dimensions', 'rhs_batch_dimensions') def __init__(self): self.lhs_contracting_dimensions = [] self.rhs_c...
class DotDimensionNumbers(object):
"""Python representation of a xla.DotDimensionNumbers protobuf.""" __slots__ = ('lhs_contracting_dimensions', 'rhs_contracting_dimensions', 'lhs_batch_dimensions', 'rhs_batch_dimensions') def __init__(self): self.lhs_contracting_dimensions = [] self.rhs_contracting_dimensions = [] self...
PaddingConfig() for lo, hi, interior in triples: dimension = PaddingConfigDimension() dimension.edge_padding_low = lo dimension.edge_padding_high = hi dimension.interior_padding = interior padding_config.dimensions.append(dimension) return padding_config class DotDimensionNumbers(ob...
64
64
88
6
57
jzoker/tensorflow
tensorflow/compiler/xla/python/xla_client.py
Python
DotDimensionNumbers
DotDimensionNumbers
471
480
471
471
119d806c8d581ea3ee9e397afe66ab85b2bfb556
bigcode/the-stack
train
d5c1124d3656620f7bd1b5b9
train
class
class TestAuthUsersExtended(unittest.TestCase): """AuthUsersExtended unit test stubs""" def setUp(self): pass def tearDown(self): pass def testAuthUsersExtended(self): """Test AuthUsersExtended""" # FIXME: construct object with mandatory attributes with example values ...
class TestAuthUsersExtended(unittest.TestCase):
"""AuthUsersExtended unit test stubs""" def setUp(self): pass def tearDown(self): pass def testAuthUsersExtended(self): """Test AuthUsersExtended""" # FIXME: construct object with mandatory attributes with example values # model = isi_sdk_8_1_1.models.auth_user...
import absolute_import import unittest import isi_sdk_8_1_1 from isi_sdk_8_1_1.models.auth_users_extended import AuthUsersExtended # noqa: E501 from isi_sdk_8_1_1.rest import ApiException class TestAuthUsersExtended(unittest.TestCase):
64
64
95
9
54
mohitjain97/isilon_sdk_python
isi_sdk_8_1_1/test/test_auth_users_extended.py
Python
TestAuthUsersExtended
TestAuthUsersExtended
23
36
23
23
8d5cec92d8ef60efdc30dc7b2c15e09c1b2a1738
bigcode/the-stack
train
05cbf9151e873765336e7f78
train
class
class MPNNs2s(nn.Module): r"""MPNN from "Neural Message Passing for Quantum Chemistry" for regression and classification on graphs. Source: https://github.com/pyg-team/pytorch_geometric/blob/master/examples/qm9_nn_conv.py Arguments: in_channels (int): Size for the input node features. o...
class MPNNs2s(nn.Module):
r"""MPNN from "Neural Message Passing for Quantum Chemistry" for regression and classification on graphs. Source: https://github.com/pyg-team/pytorch_geometric/blob/master/examples/qm9_nn_conv.py Arguments: in_channels (int): Size for the input node features. out_channels (int): dimensi...
import torch import torch.nn as nn import torch.nn.functional as F from torch_geometric.data import Data from torch_geometric.data.batch import Batch from torch.nn import GRU, Linear, ReLU, Sequential from torch_geometric.nn import NNConv, Set2Set class MPNNs2s(nn.Module):
69
134
449
9
59
alibaba/FederatedScope
federatedscope/gfl/model/mpnn.py
Python
MPNNs2s
MPNNs2s
12
59
12
12
d0b93bc64f6ade0245a6014e4135728c468a2bd0
bigcode/the-stack
train
d9abdcdcfadb6d1014081ffd
train
class
class LockTimeout(Exception): pass
class LockTimeout(Exception):
pass
import logging import os import time import stat log = logging.getLogger(__name__) class LockTimeout(Exception):
25
64
8
5
20
ank-forked/readthedocs.org
readthedocs/vcs_support/utils.py
Python
LockTimeout
LockTimeout
9
10
9
9
518f3351cc509bdb982a60e46b75ab108a62d164
bigcode/the-stack
train
5eb4cc22bb256c34d0e69ee8
train
class
class Lock(object): """ A simple file based lock with timeout On entering the context, it will try to aquire the lock. If timeout passes, it just gets the lock anyway. If we're in the same thread as the one holding this lock, ignore the lock. """ def __init__(self, project, version, timeo...
class Lock(object):
""" A simple file based lock with timeout On entering the context, it will try to aquire the lock. If timeout passes, it just gets the lock anyway. If we're in the same thread as the one holding this lock, ignore the lock. """ def __init__(self, project, version, timeout=5, polling_interv...
import logging import os import time import stat log = logging.getLogger(__name__) class LockTimeout(Exception): pass class Lock(object):
32
121
405
4
27
ank-forked/readthedocs.org
readthedocs/vcs_support/utils.py
Python
Lock
Lock
13
57
13
13
dd43a01423d907cd274dca2e3f6dd504a0a03289
bigcode/the-stack
train
742525e59826281fff21c036
train
class
class NonBlockingLock(object): """ Instead of waiting for a lock, depending on the lock file age, either acquire it immediately or throw LockTimeout :param project: Project being built :param version: Version to build :param max_lock_age: If file lock is older than this, forcibly acquire. ...
class NonBlockingLock(object):
""" Instead of waiting for a lock, depending on the lock file age, either acquire it immediately or throw LockTimeout :param project: Project being built :param version: Version to build :param max_lock_age: If file lock is older than this, forcibly acquire. None means never force "...
.name, timesince, self.timeout)) open(self.fpath, 'w').close() log.info("Lock (%s): Lock aquired" % self.name) def __exit__(self, exc, value, tb): try: log.info("Lock (%s): Releasing" % self.name) os.remove(self.fpath) except: log.error("Lock (%s)...
105
105
351
6
99
ank-forked/readthedocs.org
readthedocs/vcs_support/utils.py
Python
NonBlockingLock
NonBlockingLock
60
97
60
60
198c5c6135b02c2f059d4a97fac0d94e593d1ddb
bigcode/the-stack
train
e898115e34c9523d69796de5
train
class
class AssetALBListenerRule(ALBListenerRuleResource, BaseLR): action_target_group_arn = tg.AssetALBTargetGroup.get_output_attr('arn') condition_values = [PATH_PREFIX + "asset*"]
class AssetALBListenerRule(ALBListenerRuleResource, BaseLR):
action_target_group_arn = tg.AssetALBTargetGroup.get_output_attr('arn') condition_values = [PATH_PREFIX + "asset*"]
class StatisticsALBListenerRule(ALBListenerRuleResource, BaseLR): action_target_group_arn = tg.StatisticsALBTargetGroup.get_output_attr('arn') condition_values = [PATH_PREFIX + "statistics*"] class AssetALBListenerRule(ALBListenerRuleResource, BaseLR):
63
64
46
15
48
Diffblue-benchmarks/pacbot
installer/resources/pacbot_app/alb_listener_rules.py
Python
AssetALBListenerRule
AssetALBListenerRule
48
50
48
48
e020fb3b41b62eccab5539e2b4287d4867af76eb
bigcode/the-stack
train
3403002afd9c388b99a0d119
train
class
class ComplianceALBListenerRule(ALBListenerRuleResource, BaseLR): action_target_group_arn = tg.ComplianceALBTargetGroup.get_output_attr('arn') condition_values = [PATH_PREFIX + "compliance*"]
class ComplianceALBListenerRule(ALBListenerRuleResource, BaseLR):
action_target_group_arn = tg.ComplianceALBTargetGroup.get_output_attr('arn') condition_values = [PATH_PREFIX + "compliance*"]
"] class AdminALBListenerRule(ALBListenerRuleResource, BaseLR): action_target_group_arn = tg.AdminALBTargetGroup.get_output_attr('arn') condition_values = [PATH_PREFIX + "admin*"] class ComplianceALBListenerRule(ALBListenerRuleResource, BaseLR):
63
64
48
15
48
Diffblue-benchmarks/pacbot
installer/resources/pacbot_app/alb_listener_rules.py
Python
ComplianceALBListenerRule
ComplianceALBListenerRule
33
35
33
33
094d88ce6d6be1a1a8b3579b1865dbb5855ddfe7
bigcode/the-stack
train
6d885ee7e131c9f6cd7aa549
train
class
class ApplicationLoadBalancerListener(ALBListenerResource): load_balancer_arn = ApplicationLoadBalancer.get_output_attr('arn') port = 80 protocol = "HTTP" default_action_target_group_arn = tg.NginxALBTargetGroup.get_output_attr('arn') default_action_type = "forward"
class ApplicationLoadBalancerListener(ALBListenerResource):
load_balancer_arn = ApplicationLoadBalancer.get_output_attr('arn') port = 80 protocol = "HTTP" default_action_target_group_arn = tg.NginxALBTargetGroup.get_output_attr('arn') default_action_type = "forward"
from core.terraform.resources.aws.load_balancer import ALBListenerResource, ALBListenerRuleResource from resources.pacbot_app.alb import ApplicationLoadBalancer from resources.pacbot_app import alb_target_groups as tg PATH_PREFIX = '/api/' class ApplicationLoadBalancerListener(ALBListenerResource):
63
64
68
10
53
Diffblue-benchmarks/pacbot
installer/resources/pacbot_app/alb_listener_rules.py
Python
ApplicationLoadBalancerListener
ApplicationLoadBalancerListener
9
14
9
9
c63c598e9a38b2ad41c02f1fcd06d01967400435
bigcode/the-stack
train
96ce0262487e107fb9f4c377
train
class
class ConfigALBListenerRule(ALBListenerRuleResource, BaseLR): action_target_group_arn = tg.ConfigALBTargetGroup.get_output_attr('arn') condition_values = [PATH_PREFIX + "config*"]
class ConfigALBListenerRule(ALBListenerRuleResource, BaseLR):
action_target_group_arn = tg.ConfigALBTargetGroup.get_output_attr('arn') condition_values = [PATH_PREFIX + "config*"]
Group.get_output_attr('arn') default_action_type = "forward" class BaseLR: listener_arn = ApplicationLoadBalancerListener.get_output_attr('arn') action_type = "forward" condition_field = "path-pattern" class ConfigALBListenerRule(ALBListenerRuleResource, BaseLR):
64
64
46
15
49
Diffblue-benchmarks/pacbot
installer/resources/pacbot_app/alb_listener_rules.py
Python
ConfigALBListenerRule
ConfigALBListenerRule
23
25
23
23
e4ce81586eb70988fbfc079b773ad8656c16d368
bigcode/the-stack
train
07f46bedbcac517a6590d2db
train
class
class StatisticsALBListenerRule(ALBListenerRuleResource, BaseLR): action_target_group_arn = tg.StatisticsALBTargetGroup.get_output_attr('arn') condition_values = [PATH_PREFIX + "statistics*"]
class StatisticsALBListenerRule(ALBListenerRuleResource, BaseLR):
action_target_group_arn = tg.StatisticsALBTargetGroup.get_output_attr('arn') condition_values = [PATH_PREFIX + "statistics*"]
class NotificationsALBListenerRule(ALBListenerRuleResource, BaseLR): action_target_group_arn = tg.NotificationsALBTargetGroup.get_output_attr('arn') condition_values = [PATH_PREFIX + "notifications*"] class StatisticsALBListenerRule(ALBListenerRuleResource, BaseLR):
63
64
47
15
48
Diffblue-benchmarks/pacbot
installer/resources/pacbot_app/alb_listener_rules.py
Python
StatisticsALBListenerRule
StatisticsALBListenerRule
43
45
43
43
a2a5ba429a570229b60611e1ba57d002e9ebd097
bigcode/the-stack
train
dfed8c18d09a456f12ffdaa3
train
class
class BaseLR: listener_arn = ApplicationLoadBalancerListener.get_output_attr('arn') action_type = "forward" condition_field = "path-pattern"
class BaseLR:
listener_arn = ApplicationLoadBalancerListener.get_output_attr('arn') action_type = "forward" condition_field = "path-pattern"
Resource): load_balancer_arn = ApplicationLoadBalancer.get_output_attr('arn') port = 80 protocol = "HTTP" default_action_target_group_arn = tg.NginxALBTargetGroup.get_output_attr('arn') default_action_type = "forward" class BaseLR:
64
64
34
4
60
Diffblue-benchmarks/pacbot
installer/resources/pacbot_app/alb_listener_rules.py
Python
BaseLR
BaseLR
17
20
17
17
55d7bb105d1b7eab8a01dabcd3cbd8c582834d5a
bigcode/the-stack
train
41e4f4c5288e6fd373fe8717
train
class
class AdminALBListenerRule(ALBListenerRuleResource, BaseLR): action_target_group_arn = tg.AdminALBTargetGroup.get_output_attr('arn') condition_values = [PATH_PREFIX + "admin*"]
class AdminALBListenerRule(ALBListenerRuleResource, BaseLR):
action_target_group_arn = tg.AdminALBTargetGroup.get_output_attr('arn') condition_values = [PATH_PREFIX + "admin*"]
-pattern" class ConfigALBListenerRule(ALBListenerRuleResource, BaseLR): action_target_group_arn = tg.ConfigALBTargetGroup.get_output_attr('arn') condition_values = [PATH_PREFIX + "config*"] class AdminALBListenerRule(ALBListenerRuleResource, BaseLR):
63
64
46
15
48
Diffblue-benchmarks/pacbot
installer/resources/pacbot_app/alb_listener_rules.py
Python
AdminALBListenerRule
AdminALBListenerRule
28
30
28
28
8658b758e2627117a320f024b6732712686c4b95
bigcode/the-stack
train
452df05d6908cfe178a7948d
train
class
class NotificationsALBListenerRule(ALBListenerRuleResource, BaseLR): action_target_group_arn = tg.NotificationsALBTargetGroup.get_output_attr('arn') condition_values = [PATH_PREFIX + "notifications*"]
class NotificationsALBListenerRule(ALBListenerRuleResource, BaseLR):
action_target_group_arn = tg.NotificationsALBTargetGroup.get_output_attr('arn') condition_values = [PATH_PREFIX + "notifications*"]
class ComplianceALBListenerRule(ALBListenerRuleResource, BaseLR): action_target_group_arn = tg.ComplianceALBTargetGroup.get_output_attr('arn') condition_values = [PATH_PREFIX + "compliance*"] class NotificationsALBListenerRule(ALBListenerRuleResource, BaseLR):
63
64
47
15
48
Diffblue-benchmarks/pacbot
installer/resources/pacbot_app/alb_listener_rules.py
Python
NotificationsALBListenerRule
NotificationsALBListenerRule
38
40
38
38
36684e927d2288216cb598fa693ec10a22e46fee
bigcode/the-stack
train
fe89f14fe735900bc5274e9f
train
class
class AuthALBListenerRule(ALBListenerRuleResource, BaseLR): action_target_group_arn = tg.AuthALBTargetGroup.get_output_attr('arn') condition_values = [PATH_PREFIX + "auth*"]
class AuthALBListenerRule(ALBListenerRuleResource, BaseLR):
action_target_group_arn = tg.AuthALBTargetGroup.get_output_attr('arn') condition_values = [PATH_PREFIX + "auth*"]
"] class AssetALBListenerRule(ALBListenerRuleResource, BaseLR): action_target_group_arn = tg.AssetALBTargetGroup.get_output_attr('arn') condition_values = [PATH_PREFIX + "asset*"] class AuthALBListenerRule(ALBListenerRuleResource, BaseLR):
63
64
46
15
48
Diffblue-benchmarks/pacbot
installer/resources/pacbot_app/alb_listener_rules.py
Python
AuthALBListenerRule
AuthALBListenerRule
53
55
53
53
d7a80b58ee5182bc5553a9319819bf4d9185200e
bigcode/the-stack
train
65a410234a15e279c6dbe53f
train
class
class Resource(abc.ABC): """Represents a single resource in GCP.""" _project_id: str def __init__(self, project_id): self._project_id = project_id def __str__(self): return self.full_path def __hash__(self): return self.full_path.__hash__() def __eq__(self, other): if self.__class__ == o...
class Resource(abc.ABC):
"""Represents a single resource in GCP.""" _project_id: str def __init__(self, project_id): self._project_id = project_id def __str__(self): return self.full_path def __hash__(self): return self.full_path.__hash__() def __eq__(self, other): if self.__class__ == other.__class__: ret...
ions): return False # Match labels. if self.labels: if not labels: return False for label_set in self.labels: if all(labels.get(k) == v for k, v in label_set.items()): break else: return False # Everything matched. return True class Resource(...
77
77
258
7
69
schweikert/gcp-doctor
gcpdiag/models.py
Python
Resource
Resource
122
163
122
122
d47a7dff9d3c5d0f75af4a7b8494eb49d72733d0
bigcode/the-stack
train
6d0b03eab3770e472652f939
train
class
@dataclasses.dataclass class Context: """List of resource groups / scopes that should be analyzed.""" # project_id of project that is being analyzed, mandatory project_id: str # list of GCP regions (e.g.: 'us-central1') regions: Optional[List[str]] # list of "label sets" that must match. labels: Optional[...
@dataclasses.dataclass class Context:
"""List of resource groups / scopes that should be analyzed.""" # project_id of project that is being analyzed, mandatory project_id: str # list of GCP regions (e.g.: 'us-central1') regions: Optional[List[str]] # list of "label sets" that must match. labels: Optional[List[Mapping[str, str]]] # the sele...
# Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
214
215
719
8
206
schweikert/gcp-doctor
gcpdiag/models.py
Python
Context
Context
29
119
29
30
90bace0205b7275c22e2a96c993a459c4a701200
bigcode/the-stack
train
d5b51a5e00d416716bd87d64
train
function
def _mapping_str(mapping: Mapping[str, str]) -> str: return ','.join(f'{k}={v}' for k, v in sorted(mapping.items()))
def _mapping_str(mapping: Mapping[str, str]) -> str:
return ','.join(f'{k}={v}' for k, v in sorted(mapping.items()))
# limitations under the License. # Lint as: python3 """Data structures representing generic objects in GCP.""" import abc import dataclasses from typing import Iterable, List, Mapping, Optional from gcpdiag import utils def _mapping_str(mapping: Mapping[str, str]) -> str:
64
64
35
14
49
schweikert/gcp-doctor
gcpdiag/models.py
Python
_mapping_str
_mapping_str
25
26
25
25
6aee38d2a87d5c7daf63c3de56ced435bf6311d0
bigcode/the-stack
train
58094d9317bf0b56652c8838
train
class
class TestSubDagOperator(unittest.TestCase): def setUp(self): clear_db_runs() self.dag_run_running = DagRun() self.dag_run_running.state = State.RUNNING self.dag_run_success = DagRun() self.dag_run_success.state = State.SUCCESS self.dag_run_failed = DagRun() ...
class TestSubDagOperator(unittest.TestCase):
def setUp(self): clear_db_runs() self.dag_run_running = DagRun() self.dag_run_running.state = State.RUNNING self.dag_run_success = DagRun() self.dag_run_success.state = State.SUCCESS self.dag_run_failed = DagRun() self.dag_run_failed.state = State.FAILED ...
"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIE...
256
256
2,332
9
247
IGIT-CN/airflow
tests/operators/test_subdag_operator.py
Python
TestSubDagOperator
TestSubDagOperator
43
304
43
44
febcc64f0f538592d4c7b107452808bd57e64d9d
bigcode/the-stack
train
f8469e2340b38bb55c94a8e6
train
function
def __append_to_doc(methods): global __doc__ __doc__ += ("\n.. csv-table::\n" " :class: contentstable\n" " :widths: 33, 33, 33\n" " :delim: |\n\n") h = (len(methods)+2)//3 # Reorders the list of methods for horizontal reading, the only one Sphinx understands reordered_methods =...
def __append_to_doc(methods):
global __doc__ __doc__ += ("\n.. csv-table::\n" " :class: contentstable\n" " :widths: 33, 33, 33\n" " :delim: |\n\n") h = (len(methods)+2)//3 # Reorders the list of methods for horizontal reading, the only one Sphinx understands reordered_methods = [0]*3*h for i, m in enume...
and in exchange the doc contains a table of width 3 with # all methods listed, so that the reading order is Column1, then # Column2, then Column3. Doing this by hand is hell with Sphinx when # you need to insert a new method inside of the list ! def __append_to_doc(methods):
70
70
234
8
62
robertwb/sage
src/sage/graphs/graph_generators.py
Python
__append_to_doc
__append_to_doc
31
51
31
31
c67d7d26b5e3baceb8012955996e5b85fa428dcc
bigcode/the-stack
train
4eaff2d3e8d1941cbc1b88be
train
function
def canaug_traverse_vert(g, aut_gens, max_verts, property, dig=False, loops=False, implementation='c_graph', sparse=True): """ Main function for exhaustive generation. Recursive traversal of a canonically generated tree of isomorph free (di)graphs satisfying a given property. INPUT: - ``g`` ...
def canaug_traverse_vert(g, aut_gens, max_verts, property, dig=False, loops=False, implementation='c_graph', sparse=True):
""" Main function for exhaustive generation. Recursive traversal of a canonically generated tree of isomorph free (di)graphs satisfying a given property. INPUT: - ``g`` - current position on the tree. - ``aut_gens`` - list of generators of Aut(g), in list notation. - ``max...
Graph) RandomTreePowerlaw = staticmethod(sage.graphs.generators.random.RandomTreePowerlaw) RandomTree = staticmethod(sage.graphs.generators.random.RandomTree) RandomTriangulation = staticmethod(sage.graphs.generators.random.RandomTriangulation) #####################################...
256
256
1,195
32
224
robertwb/sage
src/sage/graphs/graph_generators.py
Python
canaug_traverse_vert
canaug_traverse_vert
2,095
2,248
2,095
2,095
d049291b99f2a44dfc79cbd2db011e6d010d3815
bigcode/the-stack
train
7eb06bbf64921678dead7cee
train
class
class GraphGenerators(): r""" A class consisting of constructors for several common graphs, as well as orderly generation of isomorphism class representatives. See the :mod:`module's help <sage.graphs.graph_generators>` for a list of supported constructors. A list of all graphs and graph struct...
class GraphGenerators():
r""" A class consisting of constructors for several common graphs, as well as orderly generation of isomorphism class representatives. See the :mod:`module's help <sage.graphs.graph_generators>` for a list of supported constructors. A list of all graphs and graph structures (other than isomorph...
(2012-02-10): new RandomGNP generator - David Coudert (2012-08-02): added chessboard graphs: Queen, King, Knight, Bishop, and Rook graphs - Nico Van Cleemput (2013-05-26): added fullerenes - Nico Van Cleemput (2013-07-01): added benzenoids - Birk Eisermann (2013-07-29): new section 'intersection graphs', added...
256
256
18,079
4
251
robertwb/sage
src/sage/graphs/graph_generators.py
Python
GraphGenerators
GraphGenerators
410
2,093
410
410
1c1b0763a13c8076dbaf59135aa81f5752454186
bigcode/the-stack
train
d0285f94dda14f2b6d4a61f9
train
function
def canaug_traverse_edge(g, aut_gens, property, dig=False, loops=False, implementation='c_graph', sparse=True): """ Main function for exhaustive generation. Recursive traversal of a canonically generated tree of isomorph free graphs satisfying a given property. INPUT: - ``g`` - current posit...
def canaug_traverse_edge(g, aut_gens, property, dig=False, loops=False, implementation='c_graph', sparse=True):
""" Main function for exhaustive generation. Recursive traversal of a canonically generated tree of isomorph free graphs satisfying a given property. INPUT: - ``g`` - current position on the tree. - ``aut_gens`` - list of generators of Aut(g), in list notation. - ``propert...
3:: sage: from sage.graphs.graph_generators import check_aut sage: list( check_aut( [ [0, 3, 2, 1], [1, 0, 3, 2], [2, 1, 0, 3] ], 2, 3)) [[1, 0, 3, 2], [1, 2, 3, 0]] """ from copy import copy perm = list(range(n + 1)) seen_perms = [perm] unchecked_perms = [perm] while l...
256
256
1,498
28
227
robertwb/sage
src/sage/graphs/graph_generators.py
Python
canaug_traverse_edge
canaug_traverse_edge
2,286
2,451
2,286
2,286
ea7c5627a125e44fb07e29cda75cd7fed375c2ac
bigcode/the-stack
train
8df634936766136b1194194d
train
function
def check_aut(aut_gens, cut_vert, n): """ Helper function for exhaustive generation. At the start, check_aut is given a set of generators for the automorphism group, aut_gens. We already know we are looking for an element of the auto- morphism group that sends cut_vert to n, and check_aut gener...
def check_aut(aut_gens, cut_vert, n):
""" Helper function for exhaustive generation. At the start, check_aut is given a set of generators for the automorphism group, aut_gens. We already know we are looking for an element of the auto- morphism group that sends cut_vert to n, and check_aut generates these for the canaug_traverse fun...
, implementation=implementation, sparse=sparse): yield a else: for possibility in check_aut(z_aut_gens, cut_vert, n): if m_z.relabel(dict(enumerate(possibility)), check_input=False, inplace=False) == g: for a...
114
114
381
13
100
robertwb/sage
src/sage/graphs/graph_generators.py
Python
check_aut
check_aut
2,250
2,284
2,250
2,250
a01c2eb94c583460677d3f6ec989bddb20a77623
bigcode/the-stack
train
b705663d310a3332559bcfa0
train
function
def check_aut_edge(aut_gens, cut_edge, i, j, n, dig=False): """ Helper function for exhaustive generation. At the start, check_aut_edge is given a set of generators for the automorphism group, aut_gens. We already know we are looking for an element of the auto- morphism group that sends cut_edge to...
def check_aut_edge(aut_gens, cut_edge, i, j, n, dig=False):
""" Helper function for exhaustive generation. At the start, check_aut_edge is given a set of generators for the automorphism group, aut_gens. We already know we are looking for an element of the auto- morphism group that sends cut_edge to {i, j}, and check_aut generates these for the canaug_tr...
ens, property, dig=dig, loops=loops, implementation=implementation, sparse=sparse): yield a else: for possibility in check_aut_edge(z_aut_gens, cut_edge, i, j, n, dig=dig): if m_z.relabel(possibility, inplace=False) == g: for a ...
130
130
435
21
108
robertwb/sage
src/sage/graphs/graph_generators.py
Python
check_aut_edge
check_aut_edge
2,453
2,490
2,453
2,453
ab6cbea5931e4a2958d7c3b485f9caa62b449fc9
bigcode/the-stack
train
b59e76000a1825b1ec8414f5
train
class
class McState(AutomatonState): def __init__(self, state_id, output): super().__init__(state_id) self.output = output # transitions is a list of tuples (Node(output), probability) self.transitions = list()
class McState(AutomatonState):
def __init__(self, state_id, output): super().__init__(state_id) self.output = output # transitions is a list of tuples (Node(output), probability) self.transitions = list()
import random from aalpy.base import Automaton, AutomatonState class McState(AutomatonState):
23
64
54
8
14
icezyclon/AALpy
aalpy/automata/MarkovChain.py
Python
McState
McState
6
11
6
6
289cdcfed510bbccda910d64ec722aa84e2858d9
bigcode/the-stack
train
b46faeb5982d4c109e3174fd
train
class
class MarkovChain(Automaton): """Markov Decision Process.""" def __init__(self, initial_state, states: list): super().__init__(initial_state, states) def reset_to_initial(self): self.current_state = self.initial_state def step(self, letter=None): """Next step is determined bas...
class MarkovChain(Automaton):
"""Markov Decision Process.""" def __init__(self, initial_state, states: list): super().__init__(initial_state, states) def reset_to_initial(self): self.current_state = self.initial_state def step(self, letter=None): """Next step is determined based on transition probabilities...
import random from aalpy.base import Automaton, AutomatonState class McState(AutomatonState): def __init__(self, state_id, output): super().__init__(state_id) self.output = output # transitions is a list of tuples (Node(output), probability) self.transitions = list() class MarkovC...
77
81
272
8
69
icezyclon/AALpy
aalpy/automata/MarkovChain.py
Python
MarkovChain
MarkovChain
14
61
14
14
4213a150bdd1b10cd1ea68a89ff19970f78c579e
bigcode/the-stack
train
76f6eea0064b12c6c4640ae2
train
class
class AttentionRCNN(nn.Module): """ Main class for Generalized R-CNN. Currently supports boxes and masks. It consists of three main parts: - backbone - rpn - heads: takes the features + the proposals from the RPN and computes detections / masks from it. """ def __init__(self, cf...
class AttentionRCNN(nn.Module):
""" Main class for Generalized R-CNN. Currently supports boxes and masks. It consists of three main parts: - backbone - rpn - heads: takes the features + the proposals from the RPN and computes detections / masks from it. """ def __init__(self, cfg): self._device = torch...
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. """ Implements the Generalized R-CNN framework """ import torch from torch import nn import torch.nn.functional as F from torch.nn.functional import cosine_similarity from maskrcnn_benchmark.structures.image_list import to_image_list from ..back...
106
256
1,751
7
98
zhaobaiyu/maskrcnn-benchmark
maskrcnn_benchmark/modeling/detector/attention_rcnn.py
Python
AttentionRCNN
AttentionRCNN
18
158
18
18
1bd83e7035c31307b4536e92c76186b84c9387c5
bigcode/the-stack
train
9bfb3bd5a3c7720c008e8395
train
function
def home(request): return render(request, 'generalhome.html')
def home(request):
return render(request, 'generalhome.html')
from django.shortcuts import render, redirect from django.contrib.auth import authenticate, login, logout from .forms import RegistrationForm from django.contrib import messages def logoutpage(request): logout(request) return redirect('login') def home(request):
51
64
14
4
47
davidiweala/Precision-agriculture-project
public/views.py
Python
home
home
11
12
11
11
4783e4c1fbdf33c22fd9d007704026a0509d4be5
bigcode/the-stack
train
73ca3b84f8fd7d36bcf4bbf0
train
function
def shop(request): return render(request, 'shop.html')
def shop(request):
return render(request, 'shop.html')
.get('username') messages.success(request, 'Your account has been created successfully' + username) return redirect('userlogin') context = {'form': form} return render(request, 'generalregister.html', context) def cart(request): return render(request, 'cart.html') def shop(reques...
64
64
13
4
60
davidiweala/Precision-agriculture-project
public/views.py
Python
shop
shop
48
49
48
48
8a4ea8c545d8aad87df272e632b3a98930313cd3
bigcode/the-stack
train
8b26a0c9bdadc656790bdb0d
train
function
def logoutpage(request): logout(request) return redirect('login')
def logoutpage(request):
logout(request) return redirect('login')
from django.shortcuts import render, redirect from django.contrib.auth import authenticate, login, logout from .forms import RegistrationForm from django.contrib import messages def logoutpage(request):
37
64
15
5
31
davidiweala/Precision-agriculture-project
public/views.py
Python
logoutpage
logoutpage
7
9
7
7
1325731394e274476dfe2b5d36150f1591eba6be
bigcode/the-stack
train
07e13cfb48eecc5fe274c666
train
function
def cart(request): return render(request, 'cart.html')
def cart(request):
return render(request, 'cart.html')
.is_valid(): form.save() username = form.cleaned_data.get('username') messages.success(request, 'Your account has been created successfully' + username) return redirect('userlogin') context = {'form': form} return render(request, 'generalregister.html', context)...
64
64
13
4
60
davidiweala/Precision-agriculture-project
public/views.py
Python
cart
cart
44
45
44
44
9df75a6c54d9e8a856f282d6df10eae276760d14
bigcode/the-stack
train
852eac63cad0b8d365b1ee4b
train
function
def userlogin(request): if request.method == 'POST': username = request.POST.get('username') password = request.POST.get('password') user = authenticate(request, username=username, password=password) if user is not None: login(request, user) return redirect(...
def userlogin(request):
if request.method == 'POST': username = request.POST.get('username') password = request.POST.get('password') user = authenticate(request, username=username, password=password) if user is not None: login(request, user) return redirect('cart') else: ...
.shortcuts import render, redirect from django.contrib.auth import authenticate, login, logout from .forms import RegistrationForm from django.contrib import messages def logoutpage(request): logout(request) return redirect('login') def home(request): return render(request, 'generalhome.html') def userlo...
64
64
86
5
59
davidiweala/Precision-agriculture-project
public/views.py
Python
userlogin
userlogin
14
26
14
14
dc7fe5926a3b7ec835736beb035dd89ecff32533
bigcode/the-stack
train
9a0f616120c4885cc3fa32a7
train
function
def register(request): form = RegistrationForm() if request.POST: form = RegistrationForm(request.POST) if form.is_valid(): form.save() username = form.cleaned_data.get('username') messages.success(request, 'Your account has been created successfully' + userna...
def register(request):
form = RegistrationForm() if request.POST: form = RegistrationForm(request.POST) if form.is_valid(): form.save() username = form.cleaned_data.get('username') messages.success(request, 'Your account has been created successfully' + username) return ...
.POST.get('password') user = authenticate(request, username=username, password=password) if user is not None: login(request, user) return redirect('cart') else: messages.info(request, 'Invalid Details') return render(request, 'generallogin.html') def reg...
64
64
86
4
60
davidiweala/Precision-agriculture-project
public/views.py
Python
register
register
29
41
29
29
a81ee50c713c9b619c008e61413c72fa312ab994
bigcode/the-stack
train
2bc39731bde6cf26ac1bc54e
train
function
def register_view(klass, name, base_name=None): entry = {'class': klass, 'name': name} if base_name is not None: entry['base_name'] = base_name all_views.append(entry)
def register_view(klass, name, base_name=None):
entry = {'class': klass, 'name': name} if base_name is not None: entry['base_name'] = base_name all_views.append(entry)
from django.conf import settings from django.utils import timezone import django_filters from modeltranslation.translator import NotRegistered, translator from rest_framework import serializers all_views = [] def register_view(klass, name, base_name=None):
49
64
49
12
37
suutari-ai/respa
resources/api/base.py
Python
register_view
register_view
10
14
10
10
e8f8ce2c0a50c4ca02af279e3beb9d3ec61851a7
bigcode/the-stack
train
93d3261f8352223b960d35c0
train
class
class DRFFilterBooleanWidget(django_filters.widgets.BooleanWidget): """ Without this Django complains about missing render method when DRF renders HTML version of API. """ def render(self, *args, **kwargs): return None
class DRFFilterBooleanWidget(django_filters.widgets.BooleanWidget):
""" Without this Django complains about missing render method when DRF renders HTML version of API. """ def render(self, *args, **kwargs): return None
resentation(value) class NullableDateTimeField(serializers.DateTimeField): def to_representation(self, value): if not value: return None else: value = timezone.localtime(value) return super().to_representation(value) class DRFFilterBooleanWidget(django_filters.widg...
64
64
50
13
51
suutari-ai/respa
resources/api/base.py
Python
DRFFilterBooleanWidget
DRFFilterBooleanWidget
82
87
82
82
ab2a6cd02cefd87e346dfadbe523af2d925ccc9c
bigcode/the-stack
train
bfb3ded0c37639d2cdd28584
train
class
class TranslatedModelSerializer(serializers.ModelSerializer): def __init__(self, *args, **kwargs): super(TranslatedModelSerializer, self).__init__(*args, **kwargs) model = self.Meta.model try: trans_opts = translator.get_options_for_model(model) except NotRegistered: ...
class TranslatedModelSerializer(serializers.ModelSerializer):
def __init__(self, *args, **kwargs): super(TranslatedModelSerializer, self).__init__(*args, **kwargs) model = self.Meta.model try: trans_opts = translator.get_options_for_model(model) except NotRegistered: self.translated_fields = [] return ...
rest_framework import serializers all_views = [] def register_view(klass, name, base_name=None): entry = {'class': klass, 'name': name} if base_name is not None: entry['base_name'] = base_name all_views.append(entry) LANGUAGES = [x[0] for x in settings.LANGUAGES] class TranslatedModelSerialize...
86
86
289
9
77
suutari-ai/respa
resources/api/base.py
Python
TranslatedModelSerializer
TranslatedModelSerializer
20
59
20
21
074642f8959d1b0bcf0676e6cb3f8b666f3ef878
bigcode/the-stack
train
f8c114196e14a8a17bd95211
train
class
class NullableTimeField(serializers.TimeField): def to_representation(self, value): if not value: return None else: value = timezone.localtime(value) return super().to_representation(value)
class NullableTimeField(serializers.TimeField):
def to_representation(self, value): if not value: return None else: value = timezone.localtime(value) return super().to_representation(value)
, None) if val in (None, ""): continue d[lang] = val # If no text provided, leave the field as null d = (d or None) ret[field_name] = d return ret class NullableTimeField(serializers.TimeField):
64
64
46
8
55
suutari-ai/respa
resources/api/base.py
Python
NullableTimeField
NullableTimeField
62
69
62
63
6077b0ffd48ec3f811314a3281bba53d071d2b93
bigcode/the-stack
train
31a53f4448c89e687c803d2f
train
class
class NullableDateTimeField(serializers.DateTimeField): def to_representation(self, value): if not value: return None else: value = timezone.localtime(value) return super().to_representation(value)
class NullableDateTimeField(serializers.DateTimeField):
def to_representation(self, value): if not value: return None else: value = timezone.localtime(value) return super().to_representation(value)
] = d return ret class NullableTimeField(serializers.TimeField): def to_representation(self, value): if not value: return None else: value = timezone.localtime(value) return super().to_representation(value) class NullableDateTimeField(serializers.DateTimeF...
64
64
48
10
54
suutari-ai/respa
resources/api/base.py
Python
NullableDateTimeField
NullableDateTimeField
72
79
72
73
d2eb6a79cbf9191f59f15f34c9f7c1cfa5a3b022
bigcode/the-stack
train
df76ca8360d8698fe61ca609
train
class
class VirtualMachineInstanceView(Model): """The instance view of a virtual machine. :param platform_update_domain: Specifies the update domain of the virtual machine. :type platform_update_domain: int :param platform_fault_domain: Specifies the fault domain of the virtual machine. :type p...
class VirtualMachineInstanceView(Model):
"""The instance view of a virtual machine. :param platform_update_domain: Specifies the update domain of the virtual machine. :type platform_update_domain: int :param platform_fault_domain: Specifies the fault domain of the virtual machine. :type platform_fault_domain: int :param rdp_...
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # # Code generated by Microsoft (R) AutoRest Code Generator. # Changes ...
90
223
746
7
82
v-Ajnava/azure-sdk-for-python
azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/models/virtual_machine_instance_view.py
Python
VirtualMachineInstanceView
VirtualMachineInstanceView
15
72
15
15
96e9cbe7732f65e728766d660eb26dae8060a6fc
bigcode/the-stack
train
82aea9d285ad374b79c759c4
train
function
def solution(plaintext): outputcode='' brailledots = { 'a':'100000','b':'110000', 'c': '100100','d':'100110','e':'100010','f':'110100','g':'110110','h':'110010','i':'010100','j':'010110', 'k':'101000','l':'111000','m':'101100','n':'101110','o':'101010','p':'111100','q':'111110','r':'111010','s':'011100','t'...
def solution(plaintext):
outputcode='' brailledots = { 'a':'100000','b':'110000', 'c': '100100','d':'100110','e':'100010','f':'110100','g':'110110','h':'110010','i':'010100','j':'010110', 'k':'101000','l':'111000','m':'101100','n':'101110','o':'101010','p':'111100','q':'111110','r':'111010','s':'011100','t':'011110','u':'101001', ...
def solution(plaintext):
5
70
236
5
0
joshidhawal/Google-Foobar-Challenge
foobar1.py
Python
solution
solution
1
15
1
1
e63695a510139eb0e9f50cdfe4a013ae2e7e4793
bigcode/the-stack
train
c6d5bdd45eedb1f51698bb0a
train
class
class SubscriptionModelAdminTest(TestCase): def setUp(self): Subscription.objects.create( name='Regis da Silva', cpf='71124336656', email='regis@example.com', phone='11-91234-5678') self.model_admin = SubscriptionModelAdmin(Subscription, admin.site) ...
class SubscriptionModelAdminTest(TestCase):
def setUp(self): Subscription.objects.create( name='Regis da Silva', cpf='71124336656', email='regis@example.com', phone='11-91234-5678') self.model_admin = SubscriptionModelAdmin(Subscription, admin.site) def test_has_action(self): ''' Ac...
from unittest.mock import Mock from django.test import TestCase from eventex.subscriptions.admin import SubscriptionModelAdmin, Subscription, admin class SubscriptionModelAdminTest(TestCase):
36
74
247
8
27
rg3915/wttd2
eventex/subscriptions/tests/test_admin.py
Python
SubscriptionModelAdminTest
SubscriptionModelAdminTest
6
42
6
7
1a668137fc35e5940d88abb76daf36fc5d139ad5
bigcode/the-stack
train
245422a346b159266dec630f
train
function
def test_check_condition_position(): pc = posChecker(stft_pic_path) blocking_position_range = { 'covered_x_min': 0.12, 'covered_y_min': 0.1, 'covered_x_max': 0.24, 'covered_y_max': 0.2, 'y1_min': pc.y_height*0.5, 'y2_max': pc.y_height*0.85 } output = pc._check_condition_position(blocking_p...
def test_check_condition_position():
pc = posChecker(stft_pic_path) blocking_position_range = { 'covered_x_min': 0.12, 'covered_y_min': 0.1, 'covered_x_max': 0.24, 'covered_y_max': 0.2, 'y1_min': pc.y_height*0.5, 'y2_max': pc.y_height*0.85 } output = pc._check_condition_position(blocking_position_range, (x2-x1)/pc.x_width, (y2...
= posChecker(stft_pic_path) output = pc._get_cut_covered_position(x1, y1, x2, y2) assert type(output) == tuple assert output == ((x2-x1)/pc.x_width,(y2-y1)/pc.y_height) def test_check_condition_position():
64
64
190
6
58
GVSCAL/faursound_core
test/test_posChecker.py
Python
test_check_condition_position
test_check_condition_position
22
38
22
22
77a9ca5ee4c02b593a5360d04b7cbdd6b48113ca
bigcode/the-stack
train
4259e4863accb02c9df1d24f
train
function
def test_get_cut_covered_position(): pc = posChecker(stft_pic_path) output = pc._get_cut_covered_position(x1, y1, x2, y2) assert type(output) == tuple assert output == ((x2-x1)/pc.x_width,(y2-y1)/pc.y_height)
def test_get_cut_covered_position():
pc = posChecker(stft_pic_path) output = pc._get_cut_covered_position(x1, y1, x2, y2) assert type(output) == tuple assert output == ((x2-x1)/pc.x_width,(y2-y1)/pc.y_height)
6202-PC1_2402749_20210201_052215_11ACF9023_750N - Down.jpg') x1 = float(174) y1 = float(510) x2 = float(300) y2 = float(622) def test_get_cut_covered_position():
64
64
67
8
56
GVSCAL/faursound_core
test/test_posChecker.py
Python
test_get_cut_covered_position
test_get_cut_covered_position
15
19
15
15
0b0da6d8ad7fc656475dc222d66b34860512f5b5
bigcode/the-stack
train
fbe7946801850688e500b4b0
train
function
def test_check_pos_bench(): pc = posChecker(stft_pic_path) x1 = float(427) y1 = float(727) x2 = float(466) y2 = float(747) covered_position = pc._get_cut_covered_position(x1, y1, x2, y2) output = pc._check_pos_bench(covered_position[0], covered_position[1], x1, y1, x2, y2) assert type(output) == str...
def test_check_pos_bench():
pc = posChecker(stft_pic_path) x1 = float(427) y1 = float(727) x2 = float(466) y2 = float(747) covered_position = pc._get_cut_covered_position(x1, y1, x2, y2) output = pc._check_pos_bench(covered_position[0], covered_position[1], x1, y1, x2, y2) assert type(output) == str and output == 'pos_OK' o...
, y2, 'blocking') assert type(output) == str and output == 'pos_OK' output = pc._check_detection_position(x1, y1, x2, y2, 'hooting') assert type(output) == str and output == 'pos_NOK' def test_check_pos_bench():
63
64
161
7
56
GVSCAL/faursound_core
test/test_posChecker.py
Python
test_check_pos_bench
test_check_pos_bench
54
67
54
54
5a3ebcf349bbbc72f6e6f13959c00b3dc6006651
bigcode/the-stack
train
f6fc48e7080749a3c756bbd2
train
function
def test_check_detection_position(): pc = posChecker(stft_pic_path) with pytest.raises(ValueError, match=r'label is not inside of pre-defined list for position checker'): pc._check_detection_position(x1, y1, x2, y2, 'hoot') output = pc._check_detection_position(x1, y1, x2, y2, 'blocking') assert type(out...
def test_check_detection_position():
pc = posChecker(stft_pic_path) with pytest.raises(ValueError, match=r'label is not inside of pre-defined list for position checker'): pc._check_detection_position(x1, y1, x2, y2, 'hoot') output = pc._check_detection_position(x1, y1, x2, y2, 'blocking') assert type(output) == str and output == 'pos_OK' ...
1, y2) assert output == True output = pc._check_condition_position(blocking_position_range, ((x2*0.75)-x1)/pc.x_width, (y2-y1)/pc.y_height, y1, y2) assert output == False def test_check_detection_position():
64
64
127
6
57
GVSCAL/faursound_core
test/test_posChecker.py
Python
test_check_detection_position
test_check_detection_position
41
51
41
41
ce7abc06988650c18d9e544b124cf49f6b37c5e6
bigcode/the-stack
train
9ed729fe65b8edd506276c3e
train
class
class RegistrationSettingsProxy(EventSettingsProxy): """Store per-event registration settings.""" def get_participant_list_columns(self, event, form=None): if form is None: # Columns when forms are merged return self.get(event, 'participant_list_columns') else: ...
class RegistrationSettingsProxy(EventSettingsProxy):
"""Store per-event registration settings.""" def get_participant_list_columns(self, event, form=None): if form is None: # Columns when forms are merged return self.get(event, 'participant_list_columns') else: try: # The int values are automati...
'left_margin': 1.6, 'right_margin': 0.4, 'margin_columns': 1.0, 'margin_rows': 0.0, 'page_size': PageSize.A4, 'page_orientation': PageOrientation.portrait, 'dashed_border': True, 'page_layout': None } BADGE_SETTING_CONVERTERS = { 'page_orientation': EnumConverter(PageOrientation), ...
114
114
383
8
106
pedroo21/indico
indico/modules/events/registration/settings.py
Python
RegistrationSettingsProxy
RegistrationSettingsProxy
33
72
33
33
6823e986dc36d25043e07ca75ac8376de2ff4fd6
bigcode/the-stack
train
1a7dc1f5e96b9a97667a3236
train
function
def _train_cli(cfg, is_cli_call=True): data = cfg['data'] download = cfg['download'] root = cfg['root'] if root and is_cli_call: root = fix_input_path(root) input_dir = cfg['input_dir'] if input_dir and is_cli_call: input_dir = fix_input_path(input_dir) if 'seed' in cfg.k...
def _train_cli(cfg, is_cli_call=True):
data = cfg['data'] download = cfg['download'] root = cfg['root'] if root and is_cli_call: root = fix_input_path(root) input_dir = cfg['input_dir'] if input_dir and is_cli_call: input_dir = fix_input_path(input_dir) if 'seed' in cfg.keys(): seed = cfg['seed'] ...
# -*- coding: utf-8 -*- """**Lightly Train:** Train a self-supervised model from the command-line. This module contains the entrypoint for the **lightly-train** command-line interface. """ # Copyright (c) 2020. Lightly AG and its affiliates. # All Rights Reserved import hydra import torch import torch.nn as nn impor...
206
240
801
11
194
busycalibrating/lightly
lightly/cli/train_cli.py
Python
_train_cli
_train_cli
32
131
32
33
546d9cc3c1e280c5b71e8bd391fc7e03e3409620
bigcode/the-stack
train
3a2665de12f7b1d8a5bc05d1
train
function
@hydra.main(config_path="config", config_name="config") def train_cli(cfg): """Train a self-supervised model from the command-line. Args: cfg: The default configs are loaded from the config file. To overwrite them please see the section on the config file (.config.c...
@hydra.main(config_path="config", config_name="config") def train_cli(cfg):
"""Train a self-supervised model from the command-line. Args: cfg: The default configs are loaded from the config file. To overwrite them please see the section on the config file (.config.config.yaml). Command-Line Args: input_dir: Path...
encoder.init_checkpoint_callback(**cfg['checkpoint_callback']) encoder = encoder.train_embedding(**cfg['trainer']) print('Best model is stored at: %s' % (encoder.checkpoint)) return encoder.checkpoint @hydra.main(config_path="config", config_name="config") def train_cli(cfg):
64
64
178
19
44
busycalibrating/lightly
lightly/cli/train_cli.py
Python
train_cli
train_cli
134
159
134
135
750dbe8665b4c53f098a6ceb5b789e0bfe73e222
bigcode/the-stack
train
b09c14da5fbdd0031166109e
train
function
def entry(): train_cli()
def entry():
train_cli()
train model with batches of size 128 >>> lightly-train input_dir=data/ loader.batch_size=128 >>> >>> # train model for 10 epochs >>> lightly-train input_dir=data/ trainer.max_epochs=10 """ return _train_cli(cfg) def entry():
64
64
7
3
61
busycalibrating/lightly
lightly/cli/train_cli.py
Python
entry
entry
162
163
162
162
50e3bf660e93dc10ef75a058b2307a89392078b9
bigcode/the-stack
train
cea3e67b1386684324888e52
train
class
class TestNode(P2PInterface): def __init__(self): super().__init__() self.last_sendcmpct = [] self.block_announced = False # Store the hashes of blocks we've seen announced. # This is for synchronizing the p2p message traffic, # so we can eg wait until a particular bl...
class TestNode(P2PInterface):
def __init__(self): super().__init__() self.last_sendcmpct = [] self.block_announced = False # Store the hashes of blocks we've seen announced. # This is for synchronizing the p2p message traffic, # so we can eg wait until a particular block is announced. self...
#!/usr/bin/env python3 # Copyright (c) 2016 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """CompactBlocksTest -- test compact blocks (BIP 152, without segwit support, version 1) """ from test_framew...
146
189
632
8
138
ingenierobinario/IngenieroBinarioCoin
test/functional/p2p-compactblocks.py
Python
TestNode
TestNode
15
86
15
15
0cbc6c5f743036b9d5079ba2e4ed69a490467f23
bigcode/the-stack
train
6c323e7e9033d354befa6cf4
train
class
class CompactBlocksTest(BitcoinTestFramework): def set_test_params(self): self.setup_clean_chain = True # both nodes has the same version self.num_nodes = 2 self.extra_args = [["-txindex"]] * 2 self.utxos = [] def build_block_on_tip(self, node): height = node.get...
class CompactBlocksTest(BitcoinTestFramework):
def set_test_params(self): self.setup_clean_chain = True # both nodes has the same version self.num_nodes = 2 self.extra_args = [["-txindex"]] * 2 self.utxos = [] def build_block_on_tip(self, node): height = node.getblockcount() tip = node.getbestblockhas...
_for_blocks(self, new_blocks): headers_message = msg_headers() headers_message.headers = [CBlockHeader(b) for b in new_blocks] self.send_message(headers_message) def request_headers_and_sync(self, locator, hashstop=0): self.clear_block_announcement() self.get_headers(locator...
256
256
7,645
9
247
ingenierobinario/IngenieroBinarioCoin
test/functional/p2p-compactblocks.py
Python
CompactBlocksTest
CompactBlocksTest
88
791
88
88
b4d61b89a5b346d1a6a5977e90610b4d1b4cf8ba
bigcode/the-stack
train
d372f3fc96f92666cdc42af4
train
class
class MySQLBrowserProvider(DAVProvider): def __init__(self, host, user, passwd, db): super(MySQLBrowserProvider, self).__init__() self._host = host self._user = user self._passwd = passwd self._db = db self._count_initConnection = 0 def __repr__(self): re...
class MySQLBrowserProvider(DAVProvider):
def __init__(self, host, user, passwd, db): super(MySQLBrowserProvider, self).__init__() self._host = host self._user = user self._passwd = passwd self._db = db self._count_initConnection = 0 def __repr__(self): return "%s for db '%s' on '%s' (user: '%s')...
other properties are considered *dead*, and are handled using the associated property manager, if one is present. """ # Return table field as property tableName, primKey = self.provider._split_path(self.path) if primKey is not None: ns, localName = util.split_name...
255
256
2,023
9
246
Scottpedia/seafdav
wsgidav/samples/mysql_dav_provider.py
Python
MySQLBrowserProvider
MySQLBrowserProvider
310
606
310
310
2ce5b0ce30a06220810a2863d9db24f3c9910beb
bigcode/the-stack
train