query stringlengths 10 2k | document stringlengths 20 51.2k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
Set ip addresses of all interfaces. | def set_ip_adresses(self):
# unfold a config tree for the current suffix, if any
for interface, details in self.interfaces.items():
for k, v in details.items():
if k == 'address':
ip, prefix = address_to_ip_prefix(v)
self.interfaces[int... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ips(self, ips):\n\n self._ips = ips",
"def set_all(self, host_names, ip_address):\n for host_name in host_names:\n self.set_one(host_name, ip_address)",
"def ipv4_interface_setup(self):\n\n for i in self._nodes.items():\n node = i[1]\n\n # Show the curr... | [
"0.72794324",
"0.661401",
"0.65779203",
"0.6340851",
"0.6324031",
"0.63150054",
"0.61869067",
"0.617959",
"0.61534643",
"0.6090856",
"0.6058395",
"0.600056",
"0.5943",
"0.5909638",
"0.5908889",
"0.5886598",
"0.58724004",
"0.58520234",
"0.58423156",
"0.5806767",
"0.5795594",
... | 0.74871445 | 0 |
Convert cleartext passwords to hashes. | def set_passwords(self, passwords):
self.passwords = {}
for user_name in passwords:
self.passwords[user_name] = sha512_crypt.hash(
passwords[user_name], rounds=5000) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_hashed_password(cleartext,salt=None):\n \n if not salt:\n salt = make_salt(5)\n return \"%s|%s\" % (salt,hashlib.sha256(salt + cleartext).hexdigest())",
"def hashPassword(passwd):\r\n \r\n return hashlib.sha224(passwd).hexdigest()",
"def hash_password(password):\n password_m... | [
"0.64620596",
"0.6350122",
"0.6167972",
"0.61424506",
"0.61300105",
"0.6050829",
"0.60071373",
"0.5981714",
"0.59550655",
"0.5933693",
"0.5925999",
"0.59192073",
"0.5893572",
"0.58825845",
"0.58750767",
"0.58422095",
"0.58400726",
"0.58395344",
"0.5762056",
"0.57604545",
"0.5... | 0.52401 | 89 |
List of vertices connected to this vertex by an edge | def adjacent(self):
result = set([v for e in self.edges for v in [e.v1, e.v2]])
result.remove(self)
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edge_vertices(edge):\n return [edge.vertex1, edge.vertex2]",
"def vertices(self):\n return list(self._graph)",
"def vertices(self):\n return list(self.__graph.values())",
"def vertices(self):\r\n return self.adjacent.keys()",
"def vertices(self):\r\n return list(self.__gr... | [
"0.8272381",
"0.7858069",
"0.7810121",
"0.7772743",
"0.7646536",
"0.76268965",
"0.76268965",
"0.76268965",
"0.76123166",
"0.75862026",
"0.757623",
"0.7554468",
"0.7473847",
"0.745408",
"0.74512976",
"0.73953646",
"0.7389122",
"0.7343603",
"0.72664386",
"0.72188765",
"0.719352... | 0.0 | -1 |
Require that user is a designated study admin or site admin. | def _requireStudyAdmin(self, user):
studyAdminsGroup = self.model('group').findOne({'name': 'Study Administrators'})
if not studyAdminsGroup or studyAdminsGroup['_id'] not in user['groups']:
if not user.get('admin', False):
raise AccessException(
'Only mem... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_admin():\n\tif not current_user.is_admin:\n\t\tabort(403)",
"def check_admin():\r\n if not current_user.is_admin:\r\n abort(403)",
"def validate_admin(self, request):\n\n self.validate_login(request)\n\n if request.session['id'] not in self.admins:\n handler.logHelp... | [
"0.69412476",
"0.68771887",
"0.6837426",
"0.6823092",
"0.6823092",
"0.6561765",
"0.6527417",
"0.65214103",
"0.6505473",
"0.649122",
"0.6457141",
"0.64561474",
"0.6453968",
"0.64320403",
"0.6393753",
"0.63883823",
"0.6383777",
"0.63770217",
"0.6367018",
"0.6363484",
"0.6358560... | 0.8191438 | 0 |
Calculate the cloud extinction coefficient. | def extinction(pyrat):
# Load parameters for that molecular species (in future pyrat.cond.names for condensate species)
species = 'H2O'
pyrat.haze.cloudBenneke.readVP(species) # do this outside once in beginning of code and call it??
# Fill in Cloud Base Pressure and Temperature
pyrat.haze.cloudB... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def eci(self):\n num_ext_terms = len(self._subspace.external_terms) # check for extra terms\n coefs = self.coefs[:-num_ext_terms] if num_ext_terms else self.coefs[:]\n eci = coefs.copy()\n eci = eci / self._subspace.function_total_multiplicities\n return eci",
"def coefficient... | [
"0.7149274",
"0.65993494",
"0.6291095",
"0.62119853",
"0.6193127",
"0.61900055",
"0.61709505",
"0.6137167",
"0.5946744",
"0.5933875",
"0.5930877",
"0.59269124",
"0.58806264",
"0.58571476",
"0.5846454",
"0.5844694",
"0.5844406",
"0.58261174",
"0.5812757",
"0.5804072",
"0.58026... | 0.6572554 | 2 |
Build and return a data loader. | def get_loader(domains,image_dir, crop_size=178, image_size=128,
batch_size=16, mode='train', num_workers=1):
transform = []
if mode == 'train':
transform.extend([T.ColorJitter(brightness=0.2, contrast=0.1, saturation=0.2, hue=0.1), T.RandomHorizontalFlip()])
# transform.append(T.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_loader(data, json, batch_size, shuffle, num_workers):\n dataset = FinNumDataset(data, json)\n\n data_loader = torch.utils.data.DataLoader(dataset=dataset,\n batch_size=batch_size,\n shuffle=shuffle,\n ... | [
"0.74889874",
"0.73519504",
"0.711431",
"0.70320064",
"0.6991118",
"0.6990211",
"0.6968911",
"0.6925782",
"0.69233835",
"0.6864498",
"0.68342435",
"0.6819947",
"0.68127316",
"0.6809393",
"0.68059325",
"0.6692377",
"0.6691707",
"0.6687672",
"0.66781133",
"0.66521686",
"0.66456... | 0.5900254 | 92 |
Adds a weight variable to the layer. | def add_weight(self,
name,
shape,
dtype=None,
initializer=None,
regularizer=None,
trainable=True,
constraint=None):
if dtype is None:
dtype = K.floatx()
weight = self.add_variable(name, s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_weight(self, weight, layer_name, tag):\n if tag != 'bias' and tag != 'wmat':\n raise Exception('tag must be bias or wmat')\n cxnlib.CXNNetSetWeight(self.handle,\n weight.ctypes.data_as(ctypes.POINTER(ctypes.c_float)),\n we... | [
"0.65926033",
"0.6463909",
"0.64615434",
"0.64615434",
"0.64615434",
"0.6434855",
"0.64340943",
"0.6415618",
"0.64081067",
"0.64048344",
"0.63897765",
"0.6330229",
"0.63140184",
"0.63023055",
"0.629226",
"0.6286121",
"0.6258184",
"0.62510973",
"0.6248951",
"0.6238682",
"0.623... | 0.75557965 | 0 |
Retrieves the input mask tensor(s) of a layer at a given node. | def get_input_mask_at(self, node_index):
inputs = self.get_input_at(node_index)
if isinstance(inputs, list):
return [getattr(x, '_keras_mask', None) for x in inputs]
else:
return getattr(inputs, '_keras_mask', None) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_input_masks(nx_node, nx_graph):\n input_edges = list(nx_graph.in_edges(nx_node['key']))\n input_masks = [nx_graph.nodes[input_node]['output_mask'] for input_node, _ in input_edges]\n return input_masks",
"def get_input_masks(nx_node, nx_graph):\n input_edges = list(nx_graph.in_edges(nx_node[\... | [
"0.7356327",
"0.7356168",
"0.70601845",
"0.686372",
"0.6512168",
"0.6421162",
"0.6359002",
"0.6270404",
"0.61987",
"0.6198212",
"0.6178",
"0.6079104",
"0.60541415",
"0.6017263",
"0.5996643",
"0.5978338",
"0.5978338",
"0.59334666",
"0.59316564",
"0.5927264",
"0.5876722",
"0.... | 0.78300685 | 0 |
Retrieves the output mask tensor(s) of a layer at a given node. | def get_output_mask_at(self, node_index):
output = self.get_output_at(node_index)
if isinstance(output, list):
return [getattr(x, '_keras_mask', None) for x in output]
else:
return getattr(output, '_keras_mask', None) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def output_mask(self):\n output = self.output\n if isinstance(output, list):\n return [getattr(x, '_keras_mask', None) for x in output]\n else:\n return getattr(output, '_keras_mask', None)",
"def get_input_mask_at(self, node_index):\n inputs = self.get_input_at(node_index)\n if isinstan... | [
"0.70013404",
"0.67517936",
"0.6399421",
"0.6388399",
"0.6365272",
"0.62206274",
"0.5890313",
"0.58897936",
"0.58688754",
"0.584128",
"0.58091635",
"0.578257",
"0.57217216",
"0.56831867",
"0.5655766",
"0.5625976",
"0.56219614",
"0.5602559",
"0.5580995",
"0.5553757",
"0.552901... | 0.80216116 | 0 |
Retrieves the input mask tensor(s) of a layer. Only applicable if the layer has exactly one inbound node, i.e. if it is connected to one incoming layer. | def input_mask(self):
inputs = self.input
if isinstance(inputs, list):
return [getattr(x, '_keras_mask', None) for x in inputs]
else:
return getattr(inputs, '_keras_mask', None) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_input_mask_at(self, node_index):\n inputs = self.get_input_at(node_index)\n if isinstance(inputs, list):\n return [getattr(x, '_keras_mask', None) for x in inputs]\n else:\n return getattr(inputs, '_keras_mask', None)",
"def get_input_masks(nx_node, nx_graph):\n input_edges = list(n... | [
"0.756858",
"0.72555685",
"0.7244732",
"0.66529214",
"0.6584047",
"0.6530159",
"0.6530159",
"0.6504658",
"0.64577276",
"0.64186",
"0.6376844",
"0.6373097",
"0.63566697",
"0.6205893",
"0.62017626",
"0.6168873",
"0.6005357",
"0.5990894",
"0.5963304",
"0.5865473",
"0.5858816",
... | 0.7356791 | 1 |
Retrieves the output mask tensor(s) of a layer. Only applicable if the layer has exactly one inbound node, i.e. if it is connected to one incoming layer. | def output_mask(self):
output = self.output
if isinstance(output, list):
return [getattr(x, '_keras_mask', None) for x in output]
else:
return getattr(output, '_keras_mask', None) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_output_mask_at(self, node_index):\n output = self.get_output_at(node_index)\n if isinstance(output, list):\n return [getattr(x, '_keras_mask', None) for x in output]\n else:\n return getattr(output, '_keras_mask', None)",
"def get_input_mask_at(self, node_index):\n inputs = self.get... | [
"0.7671821",
"0.6720139",
"0.65809995",
"0.65300184",
"0.6510303",
"0.64391583",
"0.6428725",
"0.62786055",
"0.6275386",
"0.62514156",
"0.61698884",
"0.61698884",
"0.61586946",
"0.6113361",
"0.6086056",
"0.5989577",
"0.59421456",
"0.59397596",
"0.5927023",
"0.5896852",
"0.587... | 0.7369137 | 1 |
Sets the weights of the layer, from Numpy arrays. | def set_weights(self, weights):
params = self.weights
if len(params) != len(weights):
raise ValueError('You called `set_weights(weights)` on layer "' +
self.name + '" with a weight list of length ' +
str(len(weights)) + ', but the layer was expecting ' +
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_weights(self, weights):\r\n self.weights = weights.reshape(self.output_size, self.input_size+1)",
"def set_weights(self, weights):\n tuples = []\n for layer in self.layers:\n num_param = len(layer.weights)\n layer_weights = weights[:num_param]\n for sw, w in zip(layer.weights... | [
"0.7939213",
"0.76549596",
"0.7447757",
"0.7297645",
"0.7215251",
"0.7192775",
"0.70850027",
"0.7009088",
"0.6989203",
"0.6947884",
"0.6938243",
"0.6860822",
"0.6829523",
"0.67454785",
"0.67409074",
"0.6710564",
"0.6692454",
"0.6654997",
"0.6654997",
"0.6638417",
"0.66098976"... | 0.73278475 | 3 |
Returns the config of the layer. A layer config is a Python dictionary (serializable) containing the configuration of a layer. The same layer can be reinstantiated later (without its trained weights) from this configuration. The config of a layer does not include connectivity information, nor the layer class name. Thes... | def get_config(self):
config = {'name': self.name, 'trainable': self.trainable}
if hasattr(self, '_batch_input_shape'):
config['batch_input_shape'] = self._batch_input_shape
if hasattr(self, 'dtype'):
config['dtype'] = self.dtype
return config | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_config(self):\n layer_config = {\n \"anchors\": self._anchors, \n \"classes\": self._classes,\n \"ignore_thresh\": self._ignore_thresh, \n \"truth_thresh\": self._truth_thresh, \n \"iou_thresh\": self._iou_thresh, \n ... | [
"0.72673035",
"0.72012126",
"0.6789678",
"0.67547184",
"0.66388977",
"0.66388977",
"0.658269",
"0.658269",
"0.65324825",
"0.64539546",
"0.6428902",
"0.64264953",
"0.6415268",
"0.6414017",
"0.6406986",
"0.63376063",
"0.63349324",
"0.63167036",
"0.6304725",
"0.6304725",
"0.6267... | 0.67386943 | 4 |
`Input()` is used to instantiate a Keras tensor. A Keras tensor is a tensor object from the underlying backend (Theano or TensorFlow), which we augment with certain attributes that allow us to build a Keras model just by knowing the inputs and outputs of the model. For instance, if a, b and c are Keras tensors, | def Input( # pylint: disable=invalid-name
shape=None,
batch_size=None,
name=None,
dtype=None,
sparse=False,
tensor=None,
**kwargs):
if 'batch_shape' in kwargs:
batch_shape = kwargs.pop('batch_shape')
if shape and batch_shape:
raise ValueError('Only provide the shape OR '
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_tensor_from_input(self, input_data: Dict[str, Any],\n **kwargs) -> torch.Tensor:\n raise NotImplementedError",
"def inputs(self) -> 'Input':\n return self.Input",
"def identity_model(input_shape=image_input_shape, weights=None, classes=None,\n ... | [
"0.6742256",
"0.6606137",
"0.65783495",
"0.649664",
"0.63277364",
"0.6327408",
"0.6239031",
"0.6163693",
"0.6142171",
"0.61120164",
"0.60526484",
"0.5993728",
"0.5975712",
"0.59637946",
"0.59475744",
"0.5926236",
"0.59232926",
"0.5898539",
"0.5879682",
"0.587486",
"0.5870248"... | 0.6835913 | 0 |
Returns the `updates` from all layers that are stateful. This is useful for separating training updates and state updates, e.g. when we need to update a layer's internal state during prediction. | def state_updates(self):
state_updates = []
for layer in self.layers:
if getattr(layer, 'stateful', False):
if hasattr(layer, 'updates'):
state_updates += layer.updates
return state_updates | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def updates(self):\r\n return list(self.state_updates)",
"def updates(self):\n if context.in_eager_mode():\n return []\n\n if not self.trainable and not self.stateful:\n return []\n\n updates = []\n for layer in self.layers:\n updates += layer.updates\n\n # `updates` might co... | [
"0.7581514",
"0.75490224",
"0.63087124",
"0.6013626",
"0.5863231",
"0.58500093",
"0.5648043",
"0.55675226",
"0.55363774",
"0.5518336",
"0.55056685",
"0.5496777",
"0.544374",
"0.5442008",
"0.54091793",
"0.5371852",
"0.5368774",
"0.53402925",
"0.53316826",
"0.53155684",
"0.5299... | 0.8816369 | 0 |
Sets the weights of the model. | def set_weights(self, weights):
tuples = []
for layer in self.layers:
num_param = len(layer.weights)
layer_weights = weights[:num_param]
for sw, w in zip(layer.weights, layer_weights):
tuples.append((sw, w))
weights = weights[num_param:]
K.batch_set_value(tuples) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_weights(self, weights):\n self.model.set_weights(weights)",
"def set_weights(self, weights):\r\n self.weights = weights",
"def set_weights(self, weights):\n self._weights = weights\n self.normalize_weights() ########################added\n #self.get_weights()",
"d... | [
"0.90260047",
"0.8717205",
"0.8483707",
"0.8425384",
"0.84224135",
"0.8285557",
"0.8230762",
"0.8218673",
"0.8064147",
"0.79532063",
"0.7927303",
"0.78084373",
"0.7761238",
"0.7715509",
"0.7696608",
"0.7670099",
"0.76613754",
"0.76613754",
"0.758918",
"0.75792164",
"0.7572149... | 0.79791397 | 9 |
Gets the network's input specs. | def input_spec(self):
# If not a graph network, can't assume anything.
if not self._is_graph_network:
return None
specs = []
for layer in self._input_layers:
if layer.input_spec is None:
specs.append(None)
else:
if not isinstance(layer.input_spec, list):
rais... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_input_specs(cls):\n specs = InputData.parameterInputFactory('Dispatcher', ordered=False, baseNode=None)\n # TODO specific for pyomo dispatcher\n return specs",
"def get_input_spec(self):\r\n return self.input_spec",
"def get_input_specs(cls):\n input_specs = InputData.parameterInputF... | [
"0.72373915",
"0.7223589",
"0.65798616",
"0.61967623",
"0.61767274",
"0.6171686",
"0.6164346",
"0.615488",
"0.61117357",
"0.61117357",
"0.606532",
"0.60281813",
"0.6026815",
"0.5994371",
"0.5980121",
"0.59641206",
"0.59398377",
"0.5933163",
"0.59111977",
"0.59111977",
"0.5911... | 0.7786096 | 0 |
Instantiates a Model from its config (output of `get_config()`). | def from_config(cls, config, custom_objects=None):
# Layer instances created during
# the graph reconstruction process
created_layers = {}
# Dictionary mapping layer instances to
# node data that specifies a layer call.
# It acts as a queue that maintains any unprocessed
# layer call until ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_model(config_obj: Union[ModelConfig, dict], random_seed: int = default_random_seed) -> BaseModel:\n if isinstance(config_obj, dict):\n config_obj = ModelConfig.from_dict(config_obj)\n model_type = get_from_registry(config_obj.model_type, model_type_registry)\n return mode... | [
"0.72787476",
"0.7183577",
"0.71657026",
"0.69921994",
"0.6895726",
"0.6853983",
"0.68149745",
"0.6768359",
"0.6768359",
"0.6735476",
"0.6674764",
"0.66665363",
"0.66469353",
"0.6646541",
"0.662587",
"0.6591255",
"0.6547453",
"0.6528897",
"0.64976126",
"0.6495488",
"0.6492451... | 0.0 | -1 |
Returns a JSON string containing the network configuration. To load a network from a JSON save file, use `keras.models.model_from_json(json_string, custom_objects={})`. | def to_json(self, **kwargs):
if not self._is_graph_network:
raise NotImplementedError
def get_json_type(obj):
# If obj is any numpy type
if type(obj).__module__ == np.__name__:
return obj.item()
# If obj is a python 'type'
if type(obj).__name__ == type.__name__:
r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_config(network, filename):\n with open(filename, \"wt\") as my_file:\n my_file.write(network.to_json())\n return None",
"def load_network(file_name):\n with open(file_name) as file:\n data = json.load(file)\n\n cost_fn = getattr(sys.modules[__name__], data[\"cost_func\"])\n ... | [
"0.6274934",
"0.6163578",
"0.6156433",
"0.6108377",
"0.6100293",
"0.6095509",
"0.59524125",
"0.593517",
"0.59179795",
"0.5894862",
"0.5893687",
"0.5891758",
"0.58499247",
"0.5719799",
"0.5684551",
"0.5684551",
"0.5666706",
"0.5662442",
"0.5588125",
"0.5571106",
"0.5545788",
... | 0.6523721 | 0 |
Returns the list of input tensors necessary to compute `tensor`. Output will always be a list of tensors (potentially with 1 element). | def get_source_inputs(tensor, layer=None, node_index=None):
if not hasattr(tensor, '_keras_history'):
return tensor
if layer is None or node_index:
layer, node_index, _ = tensor._keras_history
if not layer._inbound_nodes:
return [tensor]
else:
node = layer._inbound_nodes[node_index]
if not ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tensor_list(self) -> List[\"NmTensor\"]:\n # Get the right output dictionary.\n d = self._manual_outputs if len(self._manual_outputs) > 0 else self._default_outputs\n\n output_tensor_list = []\n # Get tensors by acessing the producer-ports.\n for k, v in d.items():\n ... | [
"0.67549485",
"0.6570103",
"0.6545245",
"0.64817333",
"0.6465132",
"0.6455797",
"0.63641167",
"0.6112972",
"0.6110776",
"0.60301006",
"0.6023867",
"0.6018743",
"0.6014307",
"0.5977601",
"0.5966194",
"0.59441453",
"0.5907508",
"0.5889415",
"0.5858512",
"0.5828894",
"0.5811696"... | 0.67650205 | 0 |
Convert string to unix time stamp if not. Currently handles %d%m%Y Consider using something more convenient like the arrow library. | def convert_datetime(t):
try:
if isinstance(t, str):
converted = datetime.strptime(t, '%d-%m-%Y')
# to get time in seconds:
t = int(time.mktime(converted.timetuple()))
return t
except Exception as e:
print(e)
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unix_time(date_string):\n length = len(date_string)\n if length == 10:\n date_format = '%Y-%m-%d'\n elif length == 7:\n date_format = '%Y-%m'\n elif length == 4:\n date_format = '%Y'\n else:\n return None\n return str(calendar.timegm(time.strptime(date_string, date... | [
"0.75648856",
"0.72032964",
"0.70789725",
"0.7065812",
"0.69459844",
"0.68879074",
"0.6863103",
"0.6834736",
"0.6732058",
"0.67318225",
"0.66324526",
"0.66284597",
"0.6610965",
"0.6604012",
"0.6543867",
"0.65076596",
"0.6441952",
"0.6434903",
"0.6434473",
"0.641492",
"0.64133... | 0.6206223 | 33 |
Return a ChemicalMassFlowIndexer that references this object's molar data. | def by_mass(self):
try:
mass = self._data_cache['mass']
except:
chemicals = self.chemicals
self._data_cache['mass'] = mass = \
ChemicalMassFlowIndexer.from_data(
SparseVector.from_dict(
MassFlowDict(self.data.dct, chemicals.MW),
chemica... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def by_mass(self):\n try:\n mass = self._data_cache['mass']\n except:\n chemicals = self.chemicals\n size = chemicals.size\n MW = chemicals.MW\n self._data_cache['mass'] = mass = \\\n MassFlowIndexer.from_data(\n SparseArray.from_rows([\n Sp... | [
"0.56176096",
"0.5561553",
"0.5336587",
"0.5316509",
"0.52759135",
"0.5150848",
"0.5141311",
"0.5130907",
"0.5127069",
"0.50799567",
"0.4900331",
"0.4872749",
"0.48726016",
"0.48726016",
"0.48714966",
"0.48510545",
"0.47927132",
"0.47504795",
"0.47504795",
"0.47504795",
"0.47... | 0.5627419 | 0 |
Return a MassFlowIndexer that references this object's molar data. | def by_mass(self):
try:
mass = self._data_cache['mass']
except:
chemicals = self.chemicals
size = chemicals.size
MW = chemicals.MW
self._data_cache['mass'] = mass = \
MassFlowIndexer.from_data(
SparseArray.from_rows([
SparseVector.from_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_index(self):\n return self.index",
"def get_index(self):\n return self.index",
"def index(self):\n return self._index",
"def index(self):\n return self._index",
"def index(self):\n return self._index",
"def index(self):\n return self._index",
"def index... | [
"0.5643225",
"0.5643225",
"0.5465154",
"0.5465154",
"0.5465154",
"0.5465154",
"0.5465154",
"0.5465154",
"0.5465154",
"0.5465154",
"0.5465154",
"0.5465154",
"0.5465154",
"0.543632",
"0.5403994",
"0.5380274",
"0.53714454",
"0.53582114",
"0.53511673",
"0.525902",
"0.52517986",
... | 0.514635 | 28 |
Return a ChemicalVolumetricFlowIndexer that references this object's molar data. | def by_volume(self, TP):
try:
vol = self._data_cache['vol', TP]
except:
chemicals = self._chemicals
V = [i.V for i in chemicals]
phase = self._phase
self._data_cache['vol', TP] = \
vol = ChemicalVolumetricFlowIndexer.from_data(
SparseVector.from_dict(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def by_volume(self, TP):\n try:\n vol = self._data_cache[TP]\n except:\n phases = self._phases\n chemicals = self._chemicals\n V = [i.V for i in chemicals]\n size = chemicals.size\n self._data_cache[TP] = \\\n vol = VolumetricFlowIndexer.from_data(\n ... | [
"0.5716781",
"0.5351351",
"0.5267331",
"0.52465904",
"0.5042801",
"0.50214684",
"0.4959102",
"0.4895627",
"0.48869613",
"0.47211167",
"0.4713881",
"0.47011477",
"0.46425217",
"0.4640899",
"0.46223387",
"0.4618841",
"0.45911646",
"0.45791003",
"0.4566672",
"0.454923",
"0.45467... | 0.57009274 | 1 |
Returns first task in the individual robot buffer. Task is deleted. | def get_first_task(self, robot_id):
individual_buffer = self.all_buffers[robot_id]
task = individual_buffer[-1]
individual_buffer = np.delete(individual_buffer, -1, 0)
self.all_buffers[robot_id] = individual_buffer
return task | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_first_task(self, robot_id): \n individual_buffer = self.all_buffers[robot_id]\n return individual_buffer[-1]",
"def get_task(self): \n task = self.buffer[0]\n self.buffer = np.delete(self.buffer, 0, 0)\n return task",
"def get_last_task(self, robot_id)... | [
"0.80448747",
"0.7857006",
"0.7391221",
"0.7325314",
"0.7287126",
"0.6595893",
"0.65539056",
"0.6505673",
"0.64575756",
"0.63990015",
"0.6366266",
"0.63554853",
"0.6327331",
"0.6190272",
"0.6144666",
"0.61099964",
"0.6075297",
"0.58957654",
"0.58957654",
"0.58465374",
"0.5834... | 0.8743162 | 0 |
Returns first task from buffer. Task is deleted. | def get_task(self):
task = self.buffer[0]
self.buffer = np.delete(self.buffer, 0, 0)
return task | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_first_task(self, robot_id): \n individual_buffer = self.all_buffers[robot_id]\n task = individual_buffer[-1]\n individual_buffer = np.delete(individual_buffer, -1, 0)\n self.all_buffers[robot_id] = individual_buffer\n return task",
"def first(self) -> Task:\n ... | [
"0.8032802",
"0.75806236",
"0.72843575",
"0.6869653",
"0.66180354",
"0.6592223",
"0.6541647",
"0.6520322",
"0.6501034",
"0.6446639",
"0.6446639",
"0.64158726",
"0.63821",
"0.6381821",
"0.63805944",
"0.63433826",
"0.6270199",
"0.6243697",
"0.62245923",
"0.62143934",
"0.6198715... | 0.77799547 | 1 |
Returns first task from buffer, without deletion. | def check_task(self):
return self.buffer[0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_first_task(self, robot_id): \n individual_buffer = self.all_buffers[robot_id]\n task = individual_buffer[-1]\n individual_buffer = np.delete(individual_buffer, -1, 0)\n self.all_buffers[robot_id] = individual_buffer\n return task",
"def get_task(self): \n ... | [
"0.8101873",
"0.7679657",
"0.749619",
"0.7480524",
"0.66501075",
"0.65765035",
"0.65535176",
"0.6550029",
"0.65141577",
"0.6503107",
"0.6466393",
"0.6466393",
"0.6356803",
"0.6345803",
"0.6271068",
"0.6247934",
"0.62476796",
"0.6222678",
"0.62128675",
"0.6205022",
"0.61794114... | 0.6920058 | 4 |
Sets goal for a robot according to it's id. | def set_goal(self, robot_id, task, pub_msg):
pub_names = self.goal_pubs.keys()
pub_objs = self.goal_pubs.values()
for i in range(len(pub_names)):
if robot_id == int(pub_names[i]):
Goal = MoveBaseActionGoal()
Goal.header.stamp = rospy.Time.now()... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_goal(self, goal):\n self._pid_lock.acquire() # Acquire Lock\n self._goal = goal\n self._pid_lock.release() # Release Lock",
"def set_goal(self, **kwargs):\n return self.env.set_goal(**kwargs)",
"def set_goal(self, goal: GoalType) -> None:\n ... | [
"0.67443836",
"0.66931903",
"0.65935475",
"0.6387873",
"0.638348",
"0.6232021",
"0.61506414",
"0.5951643",
"0.5907818",
"0.5769154",
"0.5733853",
"0.56343824",
"0.56246096",
"0.55113935",
"0.54608816",
"0.544337",
"0.5394208",
"0.53780353",
"0.5371298",
"0.5362727",
"0.533171... | 0.711858 | 0 |
Returns a tuple which contains arrays current robot positions. | def get_robot_poses(self):
x_poses = np.array([])
y_poses = np.array([])
for i in range(self.no_robots):
odom_topic = '/robot_' + str(i) + '/odom'
msg = rospy.wait_for_message(odom_topic, Odometry)
x_pos = msg.pose.pose.position.x
y_pos = m... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _robot_jpos_getter(self):\n return np.array(self.env._joint_positions)",
"def _get_original_observation(self) -> Tuple[float, np.ndarray]:\n toe_position = np.array(\n self._robot.foot_positions(), dtype=self._dtype).flatten()\n\n return self._robot.timestamp, toe_position",
"def motor_... | [
"0.6968624",
"0.68802893",
"0.6811756",
"0.6726954",
"0.6720621",
"0.67198586",
"0.670981",
"0.6704924",
"0.6702041",
"0.668437",
"0.66836894",
"0.66658777",
"0.6644644",
"0.65984565",
"0.658718",
"0.65806645",
"0.6567708",
"0.65654165",
"0.6547335",
"0.6516807",
"0.64918536"... | 0.67214 | 4 |
Create a ray from on origion and direction. | def __init__(self, origin, direction):
self.origin = np.array(origin)
self.direction = np.array(direction) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_ray(self, img_point):\n # TODO A5 copy your implementation from A4\n i = img_point[0]\n j = img_point[1]\n dist_vector = self.target - self.eye\n proj_dist = np.linalg.norm(dist_vector)\n height = 2 * proj_dist * np.tan(self.vfov / 2.0)\n width = self.a... | [
"0.6726092",
"0.64626384",
"0.6159115",
"0.60877067",
"0.59894574",
"0.5926523",
"0.5823216",
"0.5804998",
"0.58022004",
"0.56870705",
"0.56365895",
"0.56004274",
"0.55765533",
"0.55624056",
"0.5557121",
"0.5549887",
"0.5541107",
"0.5537301",
"0.54712886",
"0.54691535",
"0.54... | 0.5487515 | 18 |
Retrieve string representation of Atomic User. | def __repr__(self):
return 'AtomicUser({}, released={})'.format(self.username, self._released) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return str(self.user)",
"def __str__(self):\n return str(self.user)",
"def __str__(self):\n return str(self.user)",
"def __str__(self):\n return str(self.user)",
"def __str__(self):\n return str(self.user)",
"def __str__(self):\r\n return str... | [
"0.7453103",
"0.7453103",
"0.7453103",
"0.7453103",
"0.7453103",
"0.7382493",
"0.72445124",
"0.7227403",
"0.7111447",
"0.7111447",
"0.7111447",
"0.7111447",
"0.69991374",
"0.6992166",
"0.69912004",
"0.6980349",
"0.69732285",
"0.6931813",
"0.6916879",
"0.69160384",
"0.68891644... | 0.68784946 | 21 |
Hides the software keyboard on the device. (optional) In iOS, use `key_name` to press a particular key, ex. `Done`. In Android, no parameters are used. | def aisappium_hide_keyboard(self, oAppiumInfo=None, key_name=None):
if oAppiumInfo is not None:
driver = oAppiumInfo.driver
else:
driver = self._current_application()
driver.hide_keyboard(key_name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hide_keyboard(\n self, key_name: Optional[str] = None, key: Optional[str] = None, strategy: Optional[str] = None\n ) -> 'WebDriver':\n ext_name = 'mobile: hideKeyboard'\n try:\n self.assert_extension_exists(ext_name).execute_script(\n ext_name, {**({'keys': [ke... | [
"0.77006596",
"0.6021652",
"0.54935855",
"0.54915965",
"0.5446831",
"0.5446831",
"0.54330564",
"0.54146785",
"0.5396251",
"0.5385671",
"0.5385671",
"0.5351623",
"0.5299294",
"0.5295987",
"0.5239104",
"0.51872176",
"0.5186777",
"0.51774293",
"0.51689065",
"0.51521283",
"0.5151... | 0.7916305 | 0 |
Initializes a Status, but is actually unused. Instead you should | def __init__(self: "Status") -> None:
raise NotImplementedError(
"Please instantiate one of the `Status` "
"subclasses:\n"
"\n\t- `Failed`"
"\n\t- `NotStarted`"
"\n\t- `InProgress(progress)`"
"\n\t- `Succeeded`"
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(__self__, *,\n status: Optional[str] = None):\n if status is None:\n status = 'disabled'\n if status is not None:\n pulumi.set(__self__, \"status\", status)",
"def __init__(__self__, *,\n status: Optional[str] = None,\n ... | [
"0.7733864",
"0.7512126",
"0.75076115",
"0.740955",
"0.7241169",
"0.7056067",
"0.70380515",
"0.7006886",
"0.6964561",
"0.69371766",
"0.69135594",
"0.69135594",
"0.69135594",
"0.69135594",
"0.69135594",
"0.69135594",
"0.69135594",
"0.69052196",
"0.68986386",
"0.6813976",
"0.68... | 0.81595194 | 0 |
Determines if two status are equal. Two statues are considered equal if they are of the same Status type; if both `Status`es are `InProgress`, then their progress values must compare equal also. | def __eq__(self: "Status", other: "Status") -> bool: # type: ignore
self_type = type(self)
other_type = type(other)
if self_type is InProgress and other_type is InProgress:
return self.progress == other.progress # type: ignore
else:
return self_type == other_ty... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n if not isinstance(other, ResultStatus):\n return False\n\n return self.__dict__ == other.__dict__",
"def __eq__(self, other):\n if not isinstance(other, PrecisEngineTaskStatusProgress):\n return False\n\n return self.__dict__ == other._... | [
"0.73409915",
"0.71478164",
"0.68326336",
"0.68325627",
"0.6828575",
"0.6799611",
"0.67651767",
"0.6650099",
"0.663792",
"0.66026837",
"0.6585347",
"0.6560694",
"0.6519736",
"0.64620346",
"0.6334076",
"0.62699586",
"0.6169474",
"0.61421174",
"0.6139374",
"0.6112142",
"0.60678... | 0.81159604 | 0 |
Determines if this `Status` is in progress or not. This is different from a comparison to an `InProgress` because said comparison would require both `Status` to have the same `progress` values (if they are both indeed `InProgress`), while this method returns true for any `InProgress` progress value. | def in_progress(self: "Status") -> bool:
return isinstance(self, InProgress) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self: \"Status\", other: \"Status\") -> bool: # type: ignore\n self_type = type(self)\n other_type = type(other)\n\n if self_type is InProgress and other_type is InProgress:\n return self.progress == other.progress # type: ignore\n else:\n return self_... | [
"0.6593676",
"0.6345074",
"0.6344414",
"0.6344414",
"0.6344414",
"0.6344414",
"0.6319323",
"0.62467813",
"0.5986506",
"0.5957657",
"0.5918512",
"0.58473325",
"0.5845322",
"0.5829266",
"0.58214915",
"0.58043075",
"0.5737248",
"0.5733746",
"0.5689461",
"0.5687277",
"0.5666091",... | 0.78564006 | 0 |
Returns the string representation of this `Failure` `Status`. | def __repr__(self: "Failed") -> str:
return "Failed()" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return \"\\n\\n\".join(self.failures)",
"def __str__(self):\n error_message = \"({0})\\n\"\\\n \"Reason: {1}\\n\".format(self.status, self.reason)\n if self.headers:\n error_message += \"HTTP response headers: {0}\\n\".format(self.header... | [
"0.77257514",
"0.72499794",
"0.7242197",
"0.7242197",
"0.7242197",
"0.7242197",
"0.71567136",
"0.70649564",
"0.7063384",
"0.7063384",
"0.7063384",
"0.7052249",
"0.7034818",
"0.6982446",
"0.6970621",
"0.6963669",
"0.69426847",
"0.6931515",
"0.68622786",
"0.6855707",
"0.6794591... | 0.7053334 | 11 |
Returns the string representation of this `NotStarted` `Status`. | def __repr__(self: "NotStarted") -> str:
return "NotStarted()" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_status_as_string(self):\n if self.downloaded == 0:\n return \"[Starting... ]\"\n return \"[%s, %s, %s]\" % self.get_status()",
"def get_status_string(self, instance):\n return instance.get_status_string()",
"def __str__(self):\n\n return self.status_text",
"def ... | [
"0.77509296",
"0.72206014",
"0.6962406",
"0.69475144",
"0.69259286",
"0.692106",
"0.692106",
"0.692106",
"0.6907531",
"0.69062734",
"0.68426645",
"0.68326247",
"0.6829954",
"0.68250954",
"0.68156147",
"0.6750187",
"0.6736905",
"0.6733693",
"0.6731404",
"0.6716653",
"0.6716653... | 0.78173107 | 0 |
Returns the string representation of this `InProgress` `Status`. | def __repr__(self: "InProgress") -> str:
return f"InProgress({self.progress})" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_status_as_string(self):\n if self.downloaded == 0:\n return \"[Starting... ]\"\n return \"[%s, %s, %s]\" % self.get_status()",
"def __str__(self):\n sb = ''\n sb += '\\nInterfaceStatus [ ' + self.interface_name + ' ]\\n'\n sb += '\\tLinkState : ' + str... | [
"0.7800333",
"0.7232849",
"0.7208602",
"0.70328575",
"0.680751",
"0.68061364",
"0.6797123",
"0.6787951",
"0.6785813",
"0.6751872",
"0.6751872",
"0.6751872",
"0.6749815",
"0.6749815",
"0.6749815",
"0.6749815",
"0.6749815",
"0.6749815",
"0.67199665",
"0.6706302",
"0.670496",
... | 0.8420762 | 0 |
Returns the string representation of this `Succeeded` `Status`. | def __repr__(self: "Succeeded") -> str:
return "Succeeded()" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def success_message(cls):\n return f'Successfully performed \"{cls.display_name.lower()}\"'",
"def get_status_as_string(self):\n if self.downloaded == 0:\n return \"[Starting... ]\"\n return \"[%s, %s, %s]\" % self.get_status()",
"def status_message(self) -> pulumi.Output[str]:\... | [
"0.6830981",
"0.67693746",
"0.6734282",
"0.66141194",
"0.65933067",
"0.6506182",
"0.6493938",
"0.64815587",
"0.6469697",
"0.64494514",
"0.64494514",
"0.64494514",
"0.6377693",
"0.6371968",
"0.6348982",
"0.6348982",
"0.63412035",
"0.634012",
"0.63318545",
"0.63318545",
"0.6331... | 0.8132395 | 0 |
Gets HTML standings table | def get_standings(self):
self.standings = self.soup.find('table', id='standingsTable') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def standings(self):\r\n headers = {\"Content-type\": \"application/x-www-form-urlencoded\", \"Accept\": \"text/plain\",\r\n \"User-Agent\": user_agent}\r\n req = self.session.get('http://' + self.domain + '/standings.phtml', headers=headers).content\r\n soup = BeautifulSoup(... | [
"0.75585085",
"0.69713396",
"0.6739402",
"0.641833",
"0.6333908",
"0.63318825",
"0.62906903",
"0.6253942",
"0.6233505",
"0.62233174",
"0.6205858",
"0.6203317",
"0.61881346",
"0.61482185",
"0.6146875",
"0.6112345",
"0.6097109",
"0.60647565",
"0.6005432",
"0.5987025",
"0.598594... | 0.755721 | 1 |
Gets HTML cumulative stats table | def get_stats(self):
self.stats = self.soup.find('table', id='statsTable') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _repr_html_(self):\n\n html = [css(\"table\")]\n with self.connection as db:\n for n in db.execute(\"SELECT * FROM cache\"):\n html.append(\"<table class='climetlab'>\")\n html.append(\"<td><td colspan='2'>%s</td></tr>\" % (n[\"path\"],))\n\n ... | [
"0.6796021",
"0.63996667",
"0.6175595",
"0.61329174",
"0.6100673",
"0.6094698",
"0.6058827",
"0.60511935",
"0.60229",
"0.5993624",
"0.5987919",
"0.59840375",
"0.59793216",
"0.595735",
"0.5949419",
"0.5934658",
"0.5930337",
"0.59065324",
"0.5865028",
"0.58387583",
"0.58330786"... | 0.6549288 | 1 |
Gets the end_action of this SubscriptionSuspensionCreate. When the suspension reaches the planned end date the end action will be carried out. This action is only executed when the suspension is ended automatically based on the end date. | def end_action(self):
return self._end_action | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def end_action(self, end_action):\n if end_action is None:\n raise ValueError(\"Invalid value for `end_action`, must not be `None`\")\n\n self._end_action = end_action",
"def planned_end_date(self):\n return self._planned_end_date",
"def end(self):\n # type: () -> datetim... | [
"0.6143122",
"0.5793038",
"0.5673183",
"0.55080134",
"0.5461245",
"0.5461245",
"0.5461245",
"0.545847",
"0.54330206",
"0.54330206",
"0.5424896",
"0.5364844",
"0.5364844",
"0.53592825",
"0.5262286",
"0.5255115",
"0.5213438",
"0.5212324",
"0.51485586",
"0.5137694",
"0.51369447"... | 0.6580785 | 0 |
Gets the planned_end_date of this SubscriptionSuspensionCreate. The planned end date of the suspension identifies the date on which the suspension will be ended automatically. | def planned_end_date(self):
return self._planned_end_date | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def planned_end_date(self, planned_end_date):\n if planned_end_date is None:\n raise ValueError(\"Invalid value for `planned_end_date`, must not be `None`\")\n\n self._planned_end_date = planned_end_date",
"def planned_termination_date(self):\n return self._planned_termination_dat... | [
"0.67940325",
"0.6618622",
"0.6293864",
"0.6293864",
"0.6230565",
"0.6230565",
"0.6213361",
"0.6213361",
"0.6213361",
"0.6192062",
"0.6126461",
"0.6047898",
"0.6047435",
"0.6009267",
"0.5971236",
"0.596319",
"0.5941742",
"0.59058607",
"0.58910954",
"0.58020884",
"0.58003604",... | 0.791573 | 0 |
Sets the planned_end_date of this SubscriptionSuspensionCreate. The planned end date of the suspension identifies the date on which the suspension will be ended automatically. | def planned_end_date(self, planned_end_date):
if planned_end_date is None:
raise ValueError("Invalid value for `planned_end_date`, must not be `None`")
self._planned_end_date = planned_end_date | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_statement_end_date(self, end_date):\n end_date_to_set = None\n if end_date != \"\":\n end_date_to_set = end_date\n else:\n end_date_to_set = self.get_date(last_day_of_last_month=True)\n self.set_value_into_input_field(self.statement_end_date_locator, end_da... | [
"0.67294335",
"0.6711568",
"0.65507555",
"0.6507257",
"0.64512366",
"0.6432217",
"0.6432217",
"0.6432217",
"0.6432217",
"0.6432217",
"0.6432217",
"0.6432217",
"0.6432217",
"0.6384521",
"0.6304877",
"0.6233103",
"0.6215956",
"0.6067937",
"0.59753764",
"0.5912095",
"0.5822383",... | 0.81324995 | 0 |
Gets the subscription of this SubscriptionSuspensionCreate. | def subscription(self):
return self._subscription | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subscription(self):\r\n return SubscriptionResource(self)",
"def get_subscription(self):\n if not hasattr(self, '_subscription'):\n self._subscription = self.admin.subscriptions.select_related('plan').get_overlapping(\n self.admin_id, DateRange(self.period, self.period... | [
"0.77255374",
"0.7343765",
"0.73032916",
"0.6958841",
"0.6958841",
"0.6877708",
"0.6694096",
"0.6613965",
"0.65510744",
"0.6282433",
"0.62387437",
"0.623199",
"0.6186334",
"0.61782557",
"0.608304",
"0.60731006",
"0.6012119",
"0.6002306",
"0.5984357",
"0.59093326",
"0.58866084... | 0.76275134 | 2 |
Sets the subscription of this SubscriptionSuspensionCreate. | def subscription(self, subscription):
if subscription is None:
raise ValueError("Invalid value for `subscription`, must not be `None`")
self._subscription = subscription | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subscription(self, subscription):\n\n self._subscription = subscription",
"def subscription_id(self, subscription_id):\n\n self._subscription_id = subscription_id",
"def subscription_id(self, subscription_id):\n\n self._subscription_id = subscription_id",
"def subscription_id(self, s... | [
"0.73514724",
"0.65007716",
"0.65007716",
"0.65007716",
"0.6084177",
"0.6023973",
"0.60062104",
"0.5801773",
"0.57880664",
"0.55934745",
"0.5577292",
"0.5570897",
"0.5563788",
"0.54974383",
"0.54484826",
"0.54439104",
"0.54293483",
"0.5423903",
"0.5307691",
"0.5285355",
"0.52... | 0.71707314 | 1 |
Get inputs from CVPR2018 training datasets. | def get_inputs(images_path, gt_images_path, height, width, batch_size):
# Make a queue of file names including all the images files in
# the CVPR2018 dataset directories
train_images = tf.convert_to_tensor(glob.glob(images_path), dtype=tf.string)
train_gt_images = tf.convert_to_tensor(glob.glob(gt_imag... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_inputs_train():\n x = tf.constant(extract_pandas_data(x_train))\n y = tf.constant(y_train.values)\n return x, y",
"def get_train_inputs(self, example):\n return example",
"def get_input_datasets(cfg):\n input_data = mlr.get_input_data(cfg,\n ... | [
"0.7267262",
"0.6862792",
"0.6677757",
"0.6624153",
"0.64922464",
"0.64844185",
"0.64419776",
"0.6424611",
"0.6408966",
"0.6385917",
"0.6360107",
"0.63272244",
"0.6323961",
"0.6319925",
"0.6315343",
"0.6307562",
"0.62912107",
"0.6275365",
"0.62569296",
"0.62291443",
"0.622914... | 0.5937353 | 79 |
returns a list of legal moves for the not occupied cell | def legalMoves(self):
moves = []
indexOfZero = self.tiles.index(0)
if indexOfZero == 0:
moves.append('Down')
moves.append('Right')
elif indexOfZero == 1:
moves.append('Down')
moves.append('Left')
moves.append('Right')
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def legalMoves(self):\n return [c for c in range(self.getWidth()) if len([r for r in range(self.getHeight()) if self.cell[c][r]==EMPTY])>0 ]",
"def get_legal_moves(self):\n # for each square in the castle figure out if an moves can occur from it.\n moves = []\n allowed = [self.turn]\n... | [
"0.81730956",
"0.80705214",
"0.7954835",
"0.7814239",
"0.77602655",
"0.7739612",
"0.7704667",
"0.76881146",
"0.7617998",
"0.7595666",
"0.758092",
"0.7550935",
"0.74787974",
"0.745382",
"0.74527174",
"0.7448315",
"0.74417365",
"0.7420594",
"0.7418684",
"0.741776",
"0.74003756"... | 0.79470205 | 3 |
returns the state with the smallest value | def pop_smallest(self):
values = [item[0] for item in self.items] #list of the values
#values = L[:]
heapq.heapify(values)
smallest = heapq.heappop(values)#not forgetting heapq.heapify(values)
#directly writing t = heapq.heappop([4,2,4]) would result in t = 4
i = self.ge... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def state_min(self) -> float:\n raise NotImplementedError",
"def min_value(gameState):\n if terminal_test(gameState): return 1\n return min( max_value(gameState.forecast_move(move)) for move in gameState.get_legal_moves() )",
"def min_value(self, state, min_alpha, min_beta, min_depth):\r\n ... | [
"0.80452305",
"0.7468442",
"0.7205939",
"0.69580483",
"0.68440306",
"0.6790122",
"0.6790122",
"0.6736419",
"0.6714985",
"0.6705703",
"0.66881603",
"0.6682412",
"0.6682401",
"0.6672303",
"0.66520995",
"0.66473675",
"0.66272545",
"0.6601216",
"0.6587398",
"0.6544434",
"0.653136... | 0.0 | -1 |
Returns true if (r,c) is on board, false otherwise. | def is_on_board(self, r, c):
return 0 <= r <= 7 and 0 <= c <= 7 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_on_board(x: int, y: int) -> bool:\n return x >= 0 and x < BOARDWIDTH and y < BOARDHEIGHT",
"def inBoard(self, row, col):\n return 0 <= row < self.rows and 0 <= col < self.cols",
"def on_board(self, pos):\n i, j = pos\n return 0 <= i < COLS and 0 <= j < ROWS",
"def has_win(self,... | [
"0.7762859",
"0.75517225",
"0.75112927",
"0.74653816",
"0.7369882",
"0.73649544",
"0.73205835",
"0.7095848",
"0.70651495",
"0.70537746",
"0.70246136",
"0.7009773",
"0.6989529",
"0.6960644",
"0.6959121",
"0.6956892",
"0.69516766",
"0.6949291",
"0.691275",
"0.6909919",
"0.69020... | 0.90845925 | 0 |
Returns the color value of self_color's opponent. | def get_opponent_color(self, self_color):
return abs(self_color - 1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_opponent_color(self, mycolor):\n if mycolor == ChessGame.BLACK:\n return ChessGame.WHITE\n elif mycolor == ChessGame.WHITE:\n return ChessGame.BLACK\n else:\n raise NotImplementedError()",
"def player(self):\n return self._color",
"def getTur... | [
"0.75106376",
"0.74137187",
"0.7160636",
"0.7123983",
"0.69804937",
"0.6936204",
"0.6918651",
"0.6908823",
"0.6872566",
"0.6858778",
"0.684322",
"0.684322",
"0.684322",
"0.684322",
"0.6842772",
"0.6800654",
"0.6800654",
"0.6766684",
"0.66826147",
"0.6656713",
"0.6648412",
"... | 0.8906139 | 0 |
Returns all moves self_color could make on the given board. | def find_possible_moves(self, board, self_color):
possible_moves = []
delta = [(0,-1), (-1,-1), (-1,0), (-1,1), (0,1), (1,1), (1,0), (1,-1)]
for r in range(len(board)):
for c in range(len(board[r])):
if board[r][c] == self_color:
for i in r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_possible_moves(self):\r\n moves = []\r\n for i in range(8):\r\n for j in range(8):\r\n color = self.board[i][j][0]\r\n if (color == 'b' and not self.turn_white) or (color == 'w' and self.turn_white):\r\n p_type = self.board[i][j]... | [
"0.7883645",
"0.767973",
"0.75464517",
"0.7480288",
"0.74703455",
"0.7433279",
"0.73575103",
"0.7273743",
"0.72572374",
"0.7243118",
"0.723341",
"0.71530664",
"0.7130875",
"0.71287894",
"0.7128543",
"0.7122341",
"0.7116005",
"0.7108686",
"0.70947456",
"0.7019704",
"0.7010493"... | 0.84355676 | 0 |
Visualize RGB image and labeled annotations with predicted annotations by the model. A visual aid function to determine how the model is performing | def visualize(original, s, m, l, s_pred, m_pred, l_pred):
fig = plt.figure(figsize=(20, 10))
plt.subplot(1,7,1)
plt.title('Original image')
plt.imshow(original)
plt.subplot(1,7,2)
plt.title('S image')
plt.imshow(s)
plt.subplot(1,7,3)
plt.title('S Pred image')
plt.imshow(s_pred)
plt.subplot(1,7,4)
plt.titl... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def predict(self):\n self.canv.update()\n ps = self.canv.postscript(colormode='mono')\n img = Image.open(io.BytesIO(ps.encode('utf-8')))\n img.save('result.png')\n x = Predict.transform_image(self)\n \n #prediction with multivariate regre... | [
"0.72029877",
"0.7191202",
"0.7151924",
"0.71277094",
"0.7096412",
"0.6998695",
"0.6995695",
"0.69935",
"0.6973984",
"0.69456923",
"0.69168067",
"0.6891744",
"0.6878313",
"0.68615746",
"0.6814774",
"0.68074894",
"0.676327",
"0.67550087",
"0.67531246",
"0.6724136",
"0.6683504"... | 0.6858227 | 14 |
Selects the next shot to take. Returns A shot of the form LetterNumber. | def selectShot(self):
raise NotImplementedError("Subclass needs to implement this") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nextLetter(self):\r\n self.filterPossibleWords()\r\n \r\n letterCount = len(self.unusedLetters) * [0]\r\n\r\n # Count the number of words each letters appears in\r\n for word in self.wordList:\r\n for i in range(len(self.unusedLetters)):\r\n # Don't... | [
"0.63195527",
"0.62941086",
"0.61875874",
"0.6057448",
"0.6051097",
"0.58360916",
"0.5768136",
"0.57184166",
"0.569278",
"0.5673297",
"0.5642426",
"0.5557488",
"0.55453634",
"0.5520847",
"0.5490991",
"0.54806745",
"0.5470225",
"0.5425621",
"0.5401744",
"0.53676975",
"0.530976... | 0.50230753 | 48 |
The size of the world communicator. | def world_size(self):
return self._wsize | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def world_size() -> int:\n return dist.get_world_size() if dist.is_initialized() else 1",
"def get_world_size() -> int:\n return collective.get_world_size()",
"def size():\n return int(os.environ['WORLD_SIZE'])",
"def get_world_size():\n if not torch.distributed.is_available():\n return 1\... | [
"0.8183484",
"0.8161533",
"0.7968778",
"0.7838551",
"0.7544292",
"0.75160927",
"0.7281078",
"0.72509223",
"0.7210917",
"0.7210917",
"0.7210917",
"0.7210812",
"0.72054684",
"0.7197497",
"0.71910495",
"0.71712273",
"0.7170887",
"0.7160263",
"0.7158934",
"0.71567965",
"0.7153045... | 0.81939703 | 0 |
The group containing this process. | def group(self):
return self._group | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_group(self):\n return self._group",
"def get_group(self):\n\t\treturn self.variables.get('group')",
"def group(self):\n if iswin32:\n raise NotImplementedError(\"XXX win32\")\n import grp\n\n entry = error.checked_call(grp.getgrgid, self.gid) # type:ignore[attr-d... | [
"0.83660746",
"0.80787057",
"0.80396575",
"0.7910646",
"0.78766567",
"0.78262997",
"0.77977085",
"0.7738597",
"0.7725764",
"0.7723853",
"0.77220726",
"0.76527077",
"0.76197624",
"0.76055884",
"0.76055884",
"0.76055884",
"0.7604678",
"0.75694543",
"0.74642473",
"0.74582726",
"... | 0.84294987 | 2 |
The size of the group containing this process. | def group_size(self):
return self._gsize | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def queue_size(self):\n return len(self.groups)",
"def group_size_dist(self):\n return self.group_sizes() / self.group_sizes().sum()",
"def getGroupSize(Id):\r\n return \"Number of groups\"",
"def size(self):\n return self.size_number",
"def group_sizes(self):\n return se... | [
"0.7482762",
"0.7292368",
"0.7252224",
"0.7235323",
"0.72331035",
"0.71471894",
"0.7062642",
"0.6934623",
"0.68790656",
"0.68790656",
"0.68790656",
"0.68790656",
"0.68790656",
"0.68790656",
"0.68790656",
"0.68790656",
"0.68790656",
"0.68790656",
"0.68790656",
"0.68790656",
"0... | 0.8637419 | 0 |
The communicator shared by processes within this group. | def comm_group(self):
return self._gcomm | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def comm(self):\n return self._comm",
"def get_comm(self):\n return self.comm",
"def object_communicator():\n comm = MPI.COMM_WORLD",
"def parent(self):\n return self._mpis.comm",
"def get_comm() -> Communication:\n return __default_comm",
"def shared(self):\n return sel... | [
"0.7563568",
"0.7487465",
"0.7086892",
"0.69438076",
"0.67658746",
"0.6197723",
"0.6191338",
"0.6111699",
"0.60897946",
"0.60864025",
"0.5912348",
"0.5875417",
"0.5834571",
"0.57805294",
"0.5730069",
"0.5687822",
"0.56246746",
"0.55881655",
"0.55529815",
"0.55375487",
"0.5537... | 0.74839085 | 2 |
Distribute indivisible blocks of items between groups. Given some contiguous blocks of items which cannot be subdivided, distribute these blocks to the specified number of groups in a way which minimizes the maximum total items given to any group. Optionally weight the blocks by a power of their size when computing the... | def distribute_discrete(sizes, groups, pow=1.0):
chunks = np.array(sizes, dtype=np.int64)
weights = np.power(chunks.astype(np.float64), pow)
max_per_proc = float(distribute_partition(weights.astype(np.int64), groups))
target = np.sum(weights) / groups
dist = []
off = 0
curweight = 0.0
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def distribute_uniform(totalsize, groups):\n ret = []\n for i in range(groups):\n myn = totalsize // groups\n off = 0\n leftover = totalsize % groups\n if ( i < leftover ):\n myn = myn + 1\n off = i * myn\n else:\n off = ((myn + 1) * leftove... | [
"0.689245",
"0.61154896",
"0.5870437",
"0.5869391",
"0.58351797",
"0.58224726",
"0.57872975",
"0.57095844",
"0.5696942",
"0.56960577",
"0.56809574",
"0.5656975",
"0.5649476",
"0.5628034",
"0.5624336",
"0.56135494",
"0.56011015",
"0.55793",
"0.5571817",
"0.5562723",
"0.5553862... | 0.7222635 | 0 |
Clear the dictionary of all observations, so that they can be garbage collected. | def clear(self):
for ob in self.obs:
ob.clear()
return | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clear():\n global d\n for key in d.keys():\n del d[key]",
"def clear(self):\n self._map = {}",
"def removeAll(self):\n self.pDict.clear()",
"def clear(self):\n for key in self.__data.keys():\n del self.__data[key]",
"def clear(self) -> None:\n self.da... | [
"0.7594992",
"0.7561573",
"0.7496599",
"0.74812955",
"0.74641746",
"0.7425582",
"0.7419749",
"0.732634",
"0.73161453",
"0.7262515",
"0.7202341",
"0.716923",
"0.7110474",
"0.7099835",
"0.70748186",
"0.7032782",
"0.7024013",
"0.70146656",
"0.7006932",
"0.69972134",
"0.6991908",... | 0.73072124 | 9 |
Restore weight. Full or partial depending on `only_backbone`. | def get_state_dict(net, pt_model, only_backbone=False):
strict = False if only_backbone else True
state_dict = torch.load(pt_model)
# create new OrderedDict that does not contain `module.`
new_state_dict = OrderedDict()
for k, v in state_dict.items():
head = k[:7]
if head == 'module.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def restore(self):\n self.weight = self._backup_weight",
"def reset_weights(self):\n self.policy_backbone.reset_weights()\n self.value_backbone.reset_weights()\n self.action_head.reset_weights()\n self.critic_head.reset_weights()",
"def restore_network(net, pt_model, only_bac... | [
"0.6937308",
"0.65461177",
"0.6132463",
"0.60327536",
"0.5945514",
"0.5839336",
"0.5760216",
"0.55564004",
"0.5513939",
"0.54683304",
"0.5432421",
"0.54305696",
"0.5413771",
"0.5335398",
"0.5296406",
"0.52838504",
"0.52414125",
"0.5234425",
"0.52273256",
"0.5211897",
"0.52041... | 0.0 | -1 |
Restore weight. Full or partial depending on `only_backbone`. | def restore_network(net, pt_model, only_backbone=False):
strict = False if only_backbone else True
state_dict = torch.load(pt_model)
# create new OrderedDict that does not contain `module.`
new_state_dict = OrderedDict()
for k, v in state_dict.items():
head = k[:7]
if head == 'module... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def restore(self):\n self.weight = self._backup_weight",
"def reset_weights(self):\n self.policy_backbone.reset_weights()\n self.value_backbone.reset_weights()\n self.action_head.reset_weights()\n self.critic_head.reset_weights()",
"def restore(self):\n self.u = self.u... | [
"0.6935928",
"0.6545287",
"0.6032289",
"0.59438264",
"0.58387244",
"0.5758846",
"0.55549663",
"0.5514295",
"0.54672194",
"0.5430779",
"0.5430014",
"0.54129845",
"0.5334053",
"0.52967894",
"0.5283779",
"0.5241541",
"0.52337617",
"0.52278304",
"0.5210166",
"0.520315",
"0.520071... | 0.6132382 | 2 |
Returns a dictionary with changed, new and missing files/folders | def get_diff(self):
folders, files_data = self.get_root_data()
missing_files, added_files, moved_files = self.get_files_diff(files_data)
missing_folders, added_folders = self.get_folders_diff(folders)
if any([missing_folders, added_folders, missing_files, added_files, moved_files]):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def file_changes(self):\n new = []\n changed = []\n deleted = []\n parent = self.parent_tag\n # Loop through the files and find the ones that have changed\n for relative_path, file_dict in self.checksum[\"files\"].items():\n if relative_path not in parent[\"file... | [
"0.7588312",
"0.74022776",
"0.7129245",
"0.6865932",
"0.6752932",
"0.6674316",
"0.6663881",
"0.6631898",
"0.644851",
"0.6409367",
"0.638209",
"0.63302857",
"0.62664694",
"0.6260313",
"0.6179993",
"0.61568844",
"0.6145319",
"0.61397666",
"0.6132889",
"0.61106265",
"0.6086687",... | 0.6853338 | 4 |
get top k largest elements from each corressponding rows of matrix | def get_top_k(matrix,k):
assert k <= matrix.shape[1]
col_inds = np.argpartition(matrix, -k)[:,-k:].flatten()
row_inds = np.repeat(range(matrix.shape[0]),k)
vals = matrix[row_inds, col_inds]
return vals, col_inds | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch_top_k(vect, mat, k):\n resultant = np.dot(mat, vect)\n arglist = np.argsort(resultant)\n arglist = arglist[-1:(-1 - k):-1]\n return arglist, resultant",
"def top_k(m, k):\n ml = m.tolil()\n ms = [_top_k(d, r, k) for d, r in zip(ml.data, ml.rows)]\n return zip(*ms)",
"def get_tops... | [
"0.78078854",
"0.7482105",
"0.7286839",
"0.71473676",
"0.7088986",
"0.6973559",
"0.6957784",
"0.6926557",
"0.68686914",
"0.68671626",
"0.6864181",
"0.6754134",
"0.66880155",
"0.6621688",
"0.65671676",
"0.6561875",
"0.65489244",
"0.6497595",
"0.646024",
"0.6455032",
"0.6449004... | 0.76114184 | 1 |
Computes the average precision at k. This function computes the average prescision at k between two lists of items. | def apk(actual, predicted, k=10):
if len(predicted)>k:
predicted = predicted[:k]
score = 0.0
num_hits = 0.0
for i,p in enumerate(predicted):
if p in actual and p not in predicted[:i]:
num_hits += 1.0
score += num_hits / (i+1.0)
if not actual:
return... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def precision_at_k(r, k):\n assert k >= 1\n r = np.asarray(r)[:k] != 0\n if r.size != k:\n raise ValueError('Relevance score length < k')\n return np.mean(r)",
"def precision_at_k(r, k):\n assert k >= 1\n r = np.asarray(r)[:k] != 0\n if r.size != k:\n raise ValueError('Relevance sco... | [
"0.7475594",
"0.74314404",
"0.7328193",
"0.7280659",
"0.7271064",
"0.7129832",
"0.7087148",
"0.6987466",
"0.69284856",
"0.6889254",
"0.68219167",
"0.6814678",
"0.68059695",
"0.6796172",
"0.6774947",
"0.6767025",
"0.6767025",
"0.676344",
"0.66914594",
"0.6675632",
"0.66103244"... | 0.6199515 | 35 |
Plot a similarity matrix between a list of clusterings, using the provided scoring function. | def plot_sim_matrix(
clusterings: list, scoring: Callable[[object, object], object]
) -> object:
forDF = []
for c in clusterings:
cID = c.get_description()
for c2 in clusterings:
c2ID = c2.get_description()
forDF.append([cID, c2ID, scoring(c, c2).score])
df = pd.D... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _plot_results(results, labels, score):\n \n labels_dict = {k: i for i, k in enumerate(labels)}\n rmin, rmax = min(results)[0], max(results)[0]\n to_color = lambda x : 0.8 * (x - rmax) / (rmin - rmax) + 0.5\n\n result_matrix = np.zeros((8, len(labels_dict)))\n labels_dict = {k: i for i, k in e... | [
"0.6115021",
"0.59878033",
"0.59782255",
"0.5956138",
"0.59467465",
"0.5874676",
"0.586053",
"0.5834884",
"0.57424116",
"0.573193",
"0.5709266",
"0.56929475",
"0.5670776",
"0.5646054",
"0.5634125",
"0.5631307",
"0.5604918",
"0.5588165",
"0.55874056",
"0.5565134",
"0.5547118",... | 0.8091768 | 0 |
Get the height of the board. | def get_grid_height(self):
# replace with your code
return self.grid_height | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def height(self):\n return self.board.shape[0]",
"def getHeight(self):\n return self.height",
"def getHeight(self):\n return self.height",
"def getHeight(self):\n return self._height",
"def get_grid_height(self):\n return self._height",
"def get_grid_height(self):\n ... | [
"0.85060894",
"0.7825432",
"0.7825432",
"0.7789064",
"0.7786957",
"0.7786957",
"0.7765075",
"0.7765075",
"0.7765075",
"0.7765075",
"0.7763559",
"0.77604455",
"0.77573603",
"0.7754367",
"0.7740941",
"0.77368295",
"0.77191436",
"0.769409",
"0.7691176",
"0.7691176",
"0.7691176",... | 0.0 | -1 |
Time series duration (time spanned between first and last samples). | def duration(self) -> float:
return self.delta_t * len(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_duration(self):\n return float(self.time.iloc[-1] - self.time.iloc[0])",
"def duration(self):\n window_length = self.window_length\n if self.window_length is None:\n warnings.warn(\n \"spectrogram must have window_length attribute to\"\n \" ac... | [
"0.7205457",
"0.70140684",
"0.69876695",
"0.69097906",
"0.6883939",
"0.677676",
"0.67140543",
"0.6694812",
"0.6688604",
"0.6688483",
"0.6683589",
"0.667029",
"0.6637328",
"0.66236484",
"0.6620921",
"0.65494865",
"0.6497941",
"0.647708",
"0.64703447",
"0.6454488",
"0.64423347"... | 0.7003732 | 3 |
Time series duration (time spanned between first and last samples). | def duration(self) -> float:
return self.delta_t * len(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_duration(self):\n return float(self.time.iloc[-1] - self.time.iloc[0])",
"def duration(self):\n window_length = self.window_length\n if self.window_length is None:\n warnings.warn(\n \"spectrogram must have window_length attribute to\"\n \" ac... | [
"0.72015804",
"0.7011242",
"0.6984564",
"0.6906823",
"0.68812025",
"0.67743665",
"0.6713681",
"0.6691161",
"0.66863567",
"0.66846263",
"0.6680764",
"0.6671724",
"0.66349936",
"0.6619939",
"0.6617675",
"0.6545728",
"0.6494419",
"0.64732885",
"0.646652",
"0.64511067",
"0.643892... | 0.6999877 | 2 |
Get an output/input variable. Function is used if you want to specify display units. | def get_val(self, name, units=None, indices=None):
val = self[name]
if indices is not None:
val = val[indices]
if units is not None:
base_units = self._get_units(name)
simp_units = simplify_unit(units)
if base_units is None:
msg ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_output(self, **kwargs):\n with tf.variable_scope(self.layer_scope):\n return self.out",
"def get(self, var):\n s = self.eval('{0}'.format(var))\n return self.strip_answer(s)",
"def inputValue(self):\n return self.variable",
"def get_variable(x):\n return x.cu... | [
"0.6313262",
"0.6246995",
"0.62253517",
"0.61326206",
"0.6081935",
"0.60364264",
"0.594145",
"0.5939748",
"0.58996",
"0.58824784",
"0.5849499",
"0.5840954",
"0.57539034",
"0.5748721",
"0.574705",
"0.57247704",
"0.56805587",
"0.56805587",
"0.56805587",
"0.56805587",
"0.5680558... | 0.52811015 | 80 |
Get string representation of the dictionary. Returns str String representation of the dictionary. | def __str__(self):
return super().__str__() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def string(self):\n return str(self._dict)",
"def get_dict_str(d: dict) -> str:\n\treturn str({str(u): str(v) for u, v in d.items()})",
"def _to_string(self) -> str:\n\n string_list = []\n for key, value in self.__dict__.items():\n if isinstance(value, dict):\n st... | [
"0.8241083",
"0.80709076",
"0.7950939",
"0.7942495",
"0.7751422",
"0.7477203",
"0.73927605",
"0.72659415",
"0.7258123",
"0.72534037",
"0.72534037",
"0.72510195",
"0.7212478",
"0.7199826",
"0.7199826",
"0.7199826",
"0.7199826",
"0.7199826",
"0.7199826",
"0.7199826",
"0.7199826... | 0.0 | -1 |
Returns a JSON response, transforming 'context' to make the payload. | def render_to_json_response(self, context, **response_kwargs):
return JsonResponse(
self.get_data(context),
**response_kwargs
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render_to_response(self, context):\n return self.get_json_response(self.convert_context_to_json(context))",
"def render_to_response(self, context):\n\t\treturn self.get_json_response(self.convert_context_to_json(context))",
"def render_to_json_response(self, context, **response_kwargs):\n ret... | [
"0.78977495",
"0.7823578",
"0.7677376",
"0.7677376",
"0.75612307",
"0.75064063",
"0.73827815",
"0.73660845",
"0.7348188",
"0.7347794",
"0.7309422",
"0.71299183",
"0.69418925",
"0.6891294",
"0.6723761",
"0.66297185",
"0.66297185",
"0.66297185",
"0.66297185",
"0.66244376",
"0.6... | 0.74123037 | 8 |
Yield successive nsized chunks from l. | def chunks(l, n):
for i in range(0, len(l), n):
yield l[i:i + n] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _chunk(self, l, n):\n for i in range(0, len(l) + 1, n):\n yield l[i:i + n]",
"def chunks(self, l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]",
"def __chunks(l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]",
"def get_chunks(self, ... | [
"0.80373776",
"0.7923372",
"0.7921526",
"0.78832066",
"0.78758025",
"0.78139895",
"0.77639675",
"0.7753964",
"0.7742553",
"0.7730092",
"0.7727218",
"0.7723365",
"0.7701169",
"0.76873696",
"0.76873696",
"0.7662493",
"0.765539",
"0.7654256",
"0.7654256",
"0.76442516",
"0.764425... | 0.7447232 | 80 |
Getting the date of 7 days later from current day. | def next_seven_day(self):
today = datetime.date.today()
week_next = today + datetime.timedelta(days=7)
return week_next.strftime('%Y-%m-%d') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_week_date():\n return timezone.now()+timezone.timedelta(days=6)",
"def get_prev_weekday(x: Optional[Date] = None) -> Date:\n ## Get the day:\n x = x or get_today()\n\n ## Define the offset:\n offset = max(1, (x.weekday() + 6) % 7 - 3)\n\n ## Compute the day and return:\n return x - T... | [
"0.69482285",
"0.67034215",
"0.6692377",
"0.66036826",
"0.6488771",
"0.6337313",
"0.63113797",
"0.6233774",
"0.61356586",
"0.61312723",
"0.6130495",
"0.6126569",
"0.6113718",
"0.60930926",
"0.6027795",
"0.5993995",
"0.5991983",
"0.5979135",
"0.59749365",
"0.59516615",
"0.5949... | 0.7539515 | 0 |
Return the name of the sensor. | def name(self):
return f"{self._name} {SENSOR_TYPES[self.sensor][0]}" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name(self):\n return self._sensor.name",
"def get_sensor_name(self):\n return self.data[1]",
"def name(self):\n return self.device.device_data[self.device_id]['name'] + \\\n f' {self._sensor_type}'",
"def name(self):\n return f\"{self._name} {self._sensor_name}\"",
... | [
"0.91896784",
"0.9168378",
"0.890185",
"0.8511273",
"0.8479953",
"0.844435",
"0.8299758",
"0.8186503",
"0.8105667",
"0.8079737",
"0.8066149",
"0.8049647",
"0.7700968",
"0.7612295",
"0.7611456",
"0.7600605",
"0.7600605",
"0.7600605",
"0.75392073",
"0.75166553",
"0.7467876",
... | 0.8770976 | 3 |
Return the device class of the sensor. | def device_class(self):
return SENSOR_TYPES[self.sensor][3].get("device_class") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def device_class(self):\n return self.sensor_type[\"class\"]",
"def device_class(self):\n return self._sensor_type",
"def device_class(self):\r\n return self._sensor_cfg[3]",
"def device_class(self):\r\n return self._sensor_cfg[3]",
"def device_class(self) -> str | None:\n ... | [
"0.93628424",
"0.9240069",
"0.9161452",
"0.9161452",
"0.9156968",
"0.90412056",
"0.90412056",
"0.8956785",
"0.89529496",
"0.8950599",
"0.8919914",
"0.871994",
"0.8717259",
"0.87069035",
"0.8660478",
"0.8652474",
"0.83961546",
"0.83828783",
"0.8380708",
"0.8380708",
"0.8380708... | 0.92430294 | 1 |
Return the unit of measurement of this entity, if any. | def unit_of_measurement(self):
return SENSOR_TYPES[self.sensor][1] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unit_of_measurement(self):\n return self._metadata[1]",
"def unit_of_measurement(self):\n return self._unit",
"def unit_of_measurement(self):\n return self._unit",
"def unit_of_measurement(self):\n return self._unit",
"def unit_of_measurement(self):\n return self._uni... | [
"0.8566332",
"0.8478179",
"0.8478179",
"0.8478179",
"0.8478179",
"0.8478179",
"0.8478179",
"0.8478179",
"0.847429",
"0.845459",
"0.845459",
"0.845459",
"0.845459",
"0.845459",
"0.845459",
"0.845459",
"0.845459",
"0.845459",
"0.845459",
"0.845459",
"0.845459",
"0.845459",
... | 0.8000371 | 42 |
Returns the next sleep interval in seconds. If no further sleep attempts should be performed the value returned is None. | def seconds (self):
if self.counter == self.times:
return None
self.counter += 1
return random.uniform(self.lower, self.upper) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sleep(self) -> Optional[pulumi.Input[int]]:\n return pulumi.get(self, \"sleep\")",
"def sleep(self) -> Optional[pulumi.Input[int]]:\n return pulumi.get(self, \"sleep\")",
"def next_interval(self):\n return (datetime.datetime.now() + self.delay).replace(microsecond=0)",
"def ensure_sl... | [
"0.7222652",
"0.7222652",
"0.70968723",
"0.70901555",
"0.7039953",
"0.6901923",
"0.6879436",
"0.68229544",
"0.66707706",
"0.66455203",
"0.6412441",
"0.6289085",
"0.6282749",
"0.6229707",
"0.6218756",
"0.62151235",
"0.6207184",
"0.6180594",
"0.61757016",
"0.61680317",
"0.61680... | 0.6198291 | 17 |
Opens a new database connection if there is none yet for the current application context. | def get_db():
if not hasattr(g, 'pg_db'):
g.pg_db = connect_db()
return g.pg_db | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def db_open():\n if not hasattr(g, 'sqlite_db'):\n g.sqlite_db = db_connect()\n return g.sqlite_db",
"def open_database(self):\n if self._conn is None:\n self._conn = sqlite3.connect(self._db_path)",
"def open_db(db_name: str = DB_NAME) -> DBConnection:\n return sqlite3.connec... | [
"0.7738785",
"0.7583889",
"0.73186874",
"0.71708626",
"0.70241374",
"0.6968058",
"0.69567364",
"0.69516224",
"0.6898437",
"0.6844457",
"0.6830317",
"0.6819776",
"0.6807468",
"0.6796977",
"0.67702866",
"0.6763331",
"0.6752875",
"0.6748848",
"0.673314",
"0.67014456",
"0.6688856... | 0.0 | -1 |
Closes the database automatically when the application context ends. | def close_db(error):
debug("Disconnecting from DB.")
if hasattr(g, 'pg_db'):
g.pg_db.close() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close_db():\n if \"db\" in context:\n context[\"db\"].close()",
"def close(self):\n self.db.close()",
"def close(self):\n\t\tself.db.close()",
"def close(self):\n self.__database__.close()",
"def close_db_connection(cls):\n db.close()",
"def close(self):\n if get... | [
"0.8569676",
"0.817915",
"0.81751734",
"0.81128985",
"0.80931515",
"0.793562",
"0.793562",
"0.793562",
"0.79125035",
"0.7864896",
"0.7833894",
"0.77752376",
"0.77703786",
"0.77672607",
"0.77528685",
"0.7733411",
"0.7687718",
"0.7593544",
"0.7586014",
"0.75848496",
"0.7579474"... | 0.0 | -1 |
Parse TF Computational Graph File (.pb) | def parse(cls, model_path: str, **kwargs):
onnx_utils = import_module(
"mindinsight.mindconverter.graph_based_converter.third_party_graph.onnx_utils")
convert_tf_graph_to_onnx = getattr(onnx_utils, "convert_tf_graph_to_onnx")
tf_input_nodes = kwargs.get('input_nodes')
tf_outp... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_graph_def(filename):\n input_graph_def = tf.GraphDef()\n with gfile.FastGFile(filename, 'rb') as file:\n data = file.read()\n input_graph_def.ParseFromString(data)\n return input_graph_def",
"def create_graph():\n with tf.gfile.FastGFile(os.path.join(\n config['inference']['... | [
"0.6512595",
"0.6466581",
"0.64091164",
"0.64091164",
"0.6329022",
"0.63216543",
"0.62478006",
"0.622534",
"0.621449",
"0.61759865",
"0.61635953",
"0.6104488",
"0.6078579",
"0.6076614",
"0.60714185",
"0.60586137",
"0.60578436",
"0.6044496",
"0.601899",
"0.60164595",
"0.596488... | 0.0 | -1 |
Assert that actual_list and expected_list are almost equal. ie. assertAlmostEqual(actual_elem, expected_elem) in each list. | def assertListAlmostEqual(self, actual_list, expected_list):
self.assertTrue(len(actual_list) == len(expected_list))
for i in xrange(len(actual_list)):
self.assertAlmostEqual(actual_list[i], expected_list[i]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assertListAlmostEqual(self, list1, list2):\n for i, j in zip(list1, list2):\n rounded_i, rounded_j = self.round_values(i, j)\n self.assertAlmostEqual(rounded_i, rounded_j)",
"def assertTuplesAlmostEqual(self, actual, expected):\n try:\n for a, e in exactZip(actual, expe... | [
"0.83103",
"0.81242037",
"0.7785256",
"0.73372203",
"0.732838",
"0.72245044",
"0.7105452",
"0.70458096",
"0.69843453",
"0.6927921",
"0.68653214",
"0.68061745",
"0.6747581",
"0.6736418",
"0.67044675",
"0.66939676",
"0.66726786",
"0.6670484",
"0.6584054",
"0.657256",
"0.6550882... | 0.936699 | 0 |
Sample from a standard Gaussian. | def sample_prior(size):
return torch.randn(size) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gaussianOneSample(self, mu=0., sig=1., size=1):\n\n thisSample = np.random.normal(mu, sig, size)\n\n return thisSample",
"def gauss_sample(mean, covariance):\n\n return None",
"def gauss_sample(num, stdev):\n sample = np.random.normal(0, stdev, num)\n sample = sample.round().astype(i... | [
"0.7639077",
"0.7585075",
"0.7277233",
"0.7132591",
"0.7116924",
"0.702253",
"0.69590986",
"0.6945768",
"0.6935672",
"0.69349754",
"0.688025",
"0.6842542",
"0.682901",
"0.681657",
"0.67541856",
"0.6752032",
"0.6744213",
"0.6704407",
"0.6698665",
"0.66596806",
"0.6624584",
"... | 0.0 | -1 |
Mocks the Terra instance before a request is made. | def mock_terra():
terra = Terra("soju-0013", "")
terra.lcd.request_middlewares.append(lcd_request_test_middleware)
return terra | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def default_setup(self, mocker):\n # pylama: ignore=W0201\n session_cls = mocker.patch.object(requests, 'Session')\n self.session = mocker.MagicMock()\n self.session.__enter__.return_value = self.session\n session_cls.return_value = self.session\n\n self.response = mocker.... | [
"0.6782043",
"0.6592813",
"0.6565687",
"0.6544803",
"0.65013963",
"0.64377755",
"0.63736105",
"0.6317969",
"0.62460375",
"0.6238057",
"0.6181688",
"0.61687994",
"0.61482024",
"0.6130161",
"0.6127421",
"0.6127421",
"0.6127421",
"0.6083885",
"0.60798734",
"0.60511017",
"0.60322... | 0.7425829 | 0 |
Dump the fileinfos to a JSON file. | def dump_to_json(fileinfos, out):
jsonarray = json.dumps(fileinfos)
json_filename = "all_elements_used.json"
text_file = open(os.path.join(out,out_dir_name,json_filename), "w")
text_file.write(jsonarray)
text_file.close()
stdout.write("... "+json_filename+" created\n") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def SaveJSON(self, filename):\n data = {\n 'files': self._files,\n 'ebuilds': self._ebuilds,\n }\n json.dump(data, open(filename, 'w'))",
"def _dumpJson(self, data, file):\n name, ext = os.path.splitext(file)\n tempFile = \"{0}.tmp\".format(name)\n with open(tempFile, ... | [
"0.69172674",
"0.66837215",
"0.66653365",
"0.66187596",
"0.65824217",
"0.6502465",
"0.6499544",
"0.64916843",
"0.64843327",
"0.64843327",
"0.6442699",
"0.6432443",
"0.6427955",
"0.64231676",
"0.6397462",
"0.6368988",
"0.63653654",
"0.6357841",
"0.63443846",
"0.6318794",
"0.63... | 0.7570784 | 0 |
Reduce the number of colors of an Image object It takes a PIL image object and tries to reduce the total number of colors, converting it to an indexed color (mode P) image. If the input image is in mode 1, it cannot be further reduced, so it's returned back with no changes. | def do_reduce_colors(img: Image.Image,
max_colors: int) -> Tuple[Image.Image, int, int]:
orig_mode = img.mode
if orig_mode == "1":
return img, 2, 2
colors = img.getcolors()
if colors:
orig_colors = len(colors)
else:
orig_colors = 0
# Intermediate c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reduce_color(image):\n\n # http://stackoverflow.com/questions/5906693/how-to-reduce-the-number-of-colors-in-an-image-with-opencv-in-python\n w, h, _ = image.shape\n for row in xrange(h-1):\n for col in xrange(w-1):\n #pi = row * w * 3 + col * 3\n pixel = image[col][row]\n ... | [
"0.7646288",
"0.6199736",
"0.6088131",
"0.6087488",
"0.60827786",
"0.6039727",
"0.58463526",
"0.58313364",
"0.5830371",
"0.5783675",
"0.5783629",
"0.57750285",
"0.57423425",
"0.5721086",
"0.5709663",
"0.57042706",
"0.56973356",
"0.5687904",
"0.56869465",
"0.56319326",
"0.5605... | 0.71109265 | 1 |
Test retrieving a list of recipes | def test_retrieve_recipes(self):
sample_quizz()
sample_quizz()
res = self.client.get(QUIZZES_URL)
quizzes = Quizz.objects.all()
serializer = QuizzSerializer(quizzes, many=True)
self.assertEqual(res.status_code, status.HTTP_200_OK)
self.assertEqual(res.data, seri... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_recipe_information_bulk(self):\n pass",
"def test_retrieve_recipes(self):\n sample_recipe(name=\"Avocado toast\")\n sample_recipe(name='Baklava')\n\n res = self.client.get(RECIPES_URL)\n\n recipes = Recipe.objects.all()\n serializer = RecipeSerializer(recipe... | [
"0.81033486",
"0.79853475",
"0.79804796",
"0.79704607",
"0.7895004",
"0.78925663",
"0.78374314",
"0.76769125",
"0.767323",
"0.73952913",
"0.73141986",
"0.72933966",
"0.7182399",
"0.71717864",
"0.7072997",
"0.70101357",
"0.6926858",
"0.6895275",
"0.689",
"0.6882748",
"0.687709... | 0.74180543 | 9 |
Test fetching unknown credential. | def test_mdb_get_unknown_credential(self):
res = self.mdb.get_credential(1234567890)
self.assertEqual(res, None) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_creds_not_found():\n assert_equal(find_credentials({'foo': 'bar'}), (None, None))",
"def test_getcredentials_failed_netrc(netrc):\n netrc.side_effect = FileNotFoundError(\"\")\n server = KasServer()\n assert not server._username\n assert not server._password",
"def test_... | [
"0.68713856",
"0.6636915",
"0.64731884",
"0.63755894",
"0.63538057",
"0.63538057",
"0.63509166",
"0.63429207",
"0.6336358",
"0.63246906",
"0.6319021",
"0.6315944",
"0.6310986",
"0.62921965",
"0.6276207",
"0.627014",
"0.6215178",
"0.6157719",
"0.61278623",
"0.61278623",
"0.610... | 0.77316827 | 0 |
r""" Cast the floatingpoint `params` to `jax.numpy.bfloat16`. This returns a new `params` tree and does not cast the `params` in place. This method can be used on TPU to explicitly convert the model parameters to bfloat16 precision to do full halfprecision training or to save weights in bfloat16 for inference in order ... | def to_bf16(self, params: Union[Dict, FrozenDict], mask: Any = None):
return self._cast_floating_to(params, jnp.bfloat16, mask) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_fp16(self, params: Union[Dict, FrozenDict], mask: Any = None):\n return self._cast_floating_to(params, jnp.float16, mask)",
"def cast_parameters_to_bf16(place, program, scope=None, to_bf16_var_names=None):\n all_parameters = []\n for block in program.blocks:\n all_parameters.extend(blo... | [
"0.7070078",
"0.69352823",
"0.65822524",
"0.5615649",
"0.5578388",
"0.5462372",
"0.53054917",
"0.530453",
"0.52218384",
"0.51704764",
"0.5153915",
"0.51356757",
"0.51211435",
"0.50357515",
"0.5008127",
"0.4879392",
"0.485458",
"0.48361912",
"0.48303774",
"0.47836018",
"0.4773... | 0.75039154 | 0 |
r""" Cast the floatingpoint `parmas` to `jax.numpy.float32`. This method can be used to explicitly convert the model parameters to fp32 precision. This returns a new `params` tree and does not cast the `params` in place. | def to_fp32(self, params: Union[Dict, FrozenDict], mask: Any = None):
return self._cast_floating_to(params, jnp.float32, mask) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _cast_floating_to(self, params: Union[Dict, FrozenDict], dtype: jnp.dtype, mask: Any = None) -> Any:\n\n # taken from https://github.com/deepmind/jmp/blob/3a8318abc3292be38582794dbf7b094e6583b192/jmp/_src/policy.py#L27\n def conditional_cast(param):\n if isinstance(param, jnp.ndarray) ... | [
"0.5991893",
"0.597532",
"0.58963186",
"0.5659163",
"0.5620524",
"0.55966693",
"0.55932355",
"0.54186344",
"0.53701866",
"0.53546476",
"0.53410137",
"0.531362",
"0.52842003",
"0.527955",
"0.5197702",
"0.5188624",
"0.51253825",
"0.51162386",
"0.5039107",
"0.50123215",
"0.49999... | 0.73091394 | 0 |
r""" Cast the floatingpoint `parmas` to `jax.numpy.float16`. This returns a new `params` tree and does not cast the `params` in place. This method can be used on GPU to explicitly convert the model parameters to float16 precision to do full halfprecision training or to save weights in float16 for inference in order to ... | def to_fp16(self, params: Union[Dict, FrozenDict], mask: Any = None):
return self._cast_floating_to(params, jnp.float16, mask) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_bf16(self, params: Union[Dict, FrozenDict], mask: Any = None):\n return self._cast_floating_to(params, jnp.bfloat16, mask)",
"def cast_parameters_to_bf16(place, program, scope=None, to_bf16_var_names=None):\n all_parameters = []\n for block in program.blocks:\n all_parameters.extend(bl... | [
"0.64355737",
"0.62667245",
"0.56928766",
"0.5585037",
"0.5519305",
"0.5508482",
"0.54957175",
"0.5233368",
"0.5187701",
"0.5149924",
"0.50876534",
"0.5062732",
"0.5032946",
"0.49982625",
"0.49486592",
"0.49486592",
"0.49486592",
"0.49480826",
"0.49480826",
"0.49480826",
"0.4... | 0.71142125 | 0 |
r""" Instantiate a pretrained flax model from a pretrained model configuration. The warning Weights from XXX not initialized from pretrained model means that the weights of XXX do not come pretrained with the rest of the model. It is up to you to train those weights with a downstream finetuning task. The warning Weight... | def from_pretrained(
cls,
pretrained_model_name_or_path: Union[str, os.PathLike],
dtype: jnp.dtype = jnp.float32,
*model_args,
config: Optional[Union[PretrainedConfig, str, os.PathLike]] = None,
cache_dir: Optional[Union[str, os.PathLike]] = None,
ignore_mismatche... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_pretrained(cls, config_file, state_dict, *inputs, **kwargs):\r\n config = cls.load_config(config_file)\r\n # Instantiate model.\r\n model = cls(config, *inputs, **kwargs)\r\n model = load_pretrained_weight(model, state_dict)\r\n return model",
"def init_weights(self):\... | [
"0.6820001",
"0.62767684",
"0.62506396",
"0.62185687",
"0.6192511",
"0.614228",
"0.6111336",
"0.60905266",
"0.60545886",
"0.60467744",
"0.6019336",
"0.5966975",
"0.5944274",
"0.5930402",
"0.5927002",
"0.5861318",
"0.5821811",
"0.5769202",
"0.5768657",
"0.5742877",
"0.57265836... | 0.55109394 | 42 |
Path to the test database with improper files. | def db_path_with_improper_files():
return os.path.join(_here, 'fixtures/databases/db-improper/database') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def db_python_only():\n return os.path.join(_here, 'fixtures/databases/db-python-only/database')",
"def get_test_database_path() -> str:\n test_suite_dir = os.path.abspath(os.path.dirname(__file__))\n return os.path.join(test_suite_dir, \"testDb.sqlite\")",
"def db_small_path():\n return os.path.jo... | [
"0.75037533",
"0.7484556",
"0.7308964",
"0.72868377",
"0.7141627",
"0.70591956",
"0.68684435",
"0.68129104",
"0.65792465",
"0.65683746",
"0.6477624",
"0.64596736",
"0.64382106",
"0.6410621",
"0.63923675",
"0.63674766",
"0.63598526",
"0.635115",
"0.63402563",
"0.63394076",
"0.... | 0.8216641 | 0 |
Return a mocked Discovered Bridge. | def get_discovered_bridge(bridge_id="aabbccddeeff", host="1.2.3.4", supports_v2=False):
return Mock(host=host, id=bridge_id, supports_v2=supports_v2) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mock_bridge(hass):\n return create_mock_bridge()",
"def create_mock_bridge():\n bridge = Mock(\n available=True,\n allow_unreachable=False,\n allow_groups=False,\n api=Mock(),\n spec=hue.HueBridge\n )\n bridge.mock_requests = []\n # We're using a deque so we ... | [
"0.7372151",
"0.73244363",
"0.6197295",
"0.6095032",
"0.57564074",
"0.56794703",
"0.56739575",
"0.5600137",
"0.5596264",
"0.5588057",
"0.54905665",
"0.54791147",
"0.5407656",
"0.5389388",
"0.53728324",
"0.5369918",
"0.5355989",
"0.5288491",
"0.5288298",
"0.5277364",
"0.527159... | 0.78755337 | 0 |
Test importing a host without an existing config file. | async def test_import_with_no_config(
hass: HomeAssistant, aioclient_mock: AiohttpClientMocker
) -> None:
create_mock_api_discovery(aioclient_mock, [("0.0.0.0", "1234")])
result = await hass.config_entries.flow.async_init(
const.DOMAIN,
context={"source": config_entries.SOURCE_IMPORT},
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testGetHostConfig_notExist(self):\n config_path = GetTestFilePath('valid/config.yaml')\n pool = lab_config.LabConfigPool(\n lab_config.LocalFileEnumerator(config_path, lab_config.IsYaml))\n pool.LoadConfigs()\n host = pool.GetHostConfig('not_exist')\n self.assertIsNone(host)",
"def test... | [
"0.7486923",
"0.73199266",
"0.69715554",
"0.67518836",
"0.6733899",
"0.6723282",
"0.6707462",
"0.66263425",
"0.66069835",
"0.659221",
"0.6592164",
"0.6432057",
"0.63454133",
"0.6198976",
"0.61682737",
"0.61464214",
"0.61435616",
"0.6100188",
"0.60956734",
"0.6071169",
"0.6047... | 0.62430507 | 13 |
Test if a import flow aborts if host is already configured. | async def test_bridge_import_already_configured(hass: HomeAssistant) -> None:
MockConfigEntry(
domain="hue", unique_id="aabbccddeeff", data={"host": "0.0.0.0"}
).add_to_hass(hass)
result = await hass.config_entries.flow.async_init(
const.DOMAIN,
context={"source": config_entries.SOU... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def test_import_invalid(hass):\n mocked_device = _create_mocked_device(True)\n _create_mock_config_entry(hass)\n\n with _patch_config_flow_device(mocked_device):\n result = await hass.config_entries.flow.async_init(\n DOMAIN, context={\"source\": SOURCE_IMPORT}, data=CONF_DATA\n ... | [
"0.6846267",
"0.67945606",
"0.6132794",
"0.5934261",
"0.5898055",
"0.58723956",
"0.58543247",
"0.58285713",
"0.57864153",
"0.57167464",
"0.5695838",
"0.55883914",
"0.55393064",
"0.55341303",
"0.5517239",
"0.55155265",
"0.5478801",
"0.5468256",
"0.5461019",
"0.5435308",
"0.541... | 0.6221543 | 2 |
Generate the full PDS path for a given HRSC data file | def generatePdsPath(filePrefix):
# File prefix looks like this: hHXXX_DDDD_SSS
fileType = '.img'
# Extract the run number --> HXXX
runNum = filePrefix[1:5]
filename = filePrefix + fileType
baseUrl = "http://pds-geosciences.wustl.edu/mex/mex-m-hrsc-5-refdr-mapprojected-v2/me... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getDataPath():\n\treturn \"..\" + os.sep + \"data\" + os.sep",
"def get_data_path():\n return os.getcwd() + \"/data/\"",
"def get_path(data_path):\n\treturn os.path.dirname(os.path.realpath(__file__)) + os.sep + data_path",
"def pathFromCompetition(competition):\n config = Config()\n ret = Path... | [
"0.6609946",
"0.6476409",
"0.6458018",
"0.6431442",
"0.6423816",
"0.6364348",
"0.63640827",
"0.6339666",
"0.632974",
"0.62803036",
"0.6274267",
"0.62587535",
"0.6227221",
"0.61917484",
"0.6113514",
"0.60960364",
"0.60952705",
"0.6090089",
"0.6077048",
"0.607591",
"0.60563326"... | 0.71917576 | 0 |
Numpy version of vplane_2_vparam | def np_vplane_2_vparam(vplane):
vparam = np.cross(
vplane,
np.stack([-vplane[...,1], vplane[...,0], np.zeros_like(vplane[...,0])], axis=-1),
axis=-1)
return vparam[..., :2] / vparam[..., [2]] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def np_vparam_2_vplane(vparam):\n d = np.linalg.norm(vparam, ord=2, axis=-1, keepdims=True)\n a = vparam[..., [0]] / d\n b = vparam[..., [1]] / d\n neg_sign = (a < 0)\n a[neg_sign] = -a[neg_sign]\n b[neg_sign] = -b[neg_sign]\n c = -(a * vparam[..., [0]] + b * vparam[..., [1]])\n vplane = np... | [
"0.8257363",
"0.63768786",
"0.59504795",
"0.5945344",
"0.5901103",
"0.58194584",
"0.57758623",
"0.5767143",
"0.57617015",
"0.5703245",
"0.56223404",
"0.5606822",
"0.5601651",
"0.5597385",
"0.5542641",
"0.55421805",
"0.55402094",
"0.5523554",
"0.5511729",
"0.55012995",
"0.5484... | 0.8056421 | 1 |
Numpy version of vparam_2_vplane | def np_vparam_2_vplane(vparam):
d = np.linalg.norm(vparam, ord=2, axis=-1, keepdims=True)
a = vparam[..., [0]] / d
b = vparam[..., [1]] / d
neg_sign = (a < 0)
a[neg_sign] = -a[neg_sign]
b[neg_sign] = -b[neg_sign]
c = -(a * vparam[..., [0]] + b * vparam[..., [1]])
vplane = np.concatenate(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def np_vplane_2_vparam(vplane):\n vparam = np.cross(\n vplane,\n np.stack([-vplane[...,1], vplane[...,0], np.zeros_like(vplane[...,0])], axis=-1),\n axis=-1)\n return vparam[..., :2] / vparam[..., [2]]",
"def plane_point_side_v3(p: np.ndarray, v: np.ndarray) -> Any:\n return p[:3].d... | [
"0.81128526",
"0.63427055",
"0.58030635",
"0.57959634",
"0.5778007",
"0.5763449",
"0.5689331",
"0.56818783",
"0.56719047",
"0.56514084",
"0.56460345",
"0.5639332",
"0.5572977",
"0.5532811",
"0.5504314",
"0.5495645",
"0.54833466",
"0.54692966",
"0.54263157",
"0.5412707",
"0.53... | 0.8370257 | 0 |
Tests that NewickEventFactory without arg raises ValueError. | def test_no_arg(self):
self.assertRaises(ValueError, NewickEventFactory) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_create_event_model_missing_creator(self):\n with self.assertRaises(ValidationError):\n e = Event(title=self.TITLE)\n e.save()",
"def test_atevent_disabled(self):\n from plone.api.exc import InvalidParameterError\n with self.assertRaises(InvalidParameterError):\... | [
"0.6419645",
"0.6396346",
"0.6311455",
"0.6303136",
"0.628506",
"0.6277325",
"0.61772805",
"0.6125845",
"0.61118144",
"0.6111505",
"0.6089412",
"0.6066073",
"0.6054844",
"0.60529006",
"0.60401094",
"0.60319936",
"0.60121155",
"0.60074675",
"0.5997193",
"0.5990431",
"0.5982735... | 0.929328 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.