query stringlengths 9 9.05k | document stringlengths 10 222k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 4 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
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 |
`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 |
Retrieves a layer based on either its name (unique) or index. Indices are based on order of horizontal graph traversal (bottomup). | def get_layer(self, name=None, index=None):
# TODO(fchollet): We could build a dictionary based on layer names
# since they are constant, but we have not done that yet.
if index is not None:
if len(self.layers) <= index:
raise ValueError('Was asked to retrieve layer at index ' + str(index) +
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_layer(model, layer_name=None, layer_idx=None):\n\n _validate_args(layer_name, layer_idx, layer=None)\n if layer_idx is not None:\n return model.layers[layer_idx]\n\n layer = [layer for layer in model.layers if layer_name in layer.name]\n if len(layer) > 1:\n print(warn_str + \"mul... | [
"0.7451492",
"0.6969869",
"0.68768555",
"0.6770075",
"0.65417993",
"0.64981186",
"0.6417856",
"0.64015406",
"0.6371185",
"0.6366386",
"0.63301843",
"0.62157345",
"0.61484885",
"0.6089707",
"0.60393846",
"0.60238993",
"0.59537786",
"0.59020376",
"0.5884721",
"0.57912713",
"0.5... | 0.8079192 | 0 |
Retrieve the network's updates. Will only include updates that are either unconditional, or conditional on inputs to this model (e.g. will not include updates that were created by layers of this model outside of the model). Effectively, `network.updates` behaves like `layer.updates`. | def updates(self):
if context.in_eager_mode():
return []
if not self.trainable and not self.stateful:
return []
updates = []
for layer in self.layers:
updates += layer.updates
# `updates` might contain irrelevant updates, so it needs to be filtered
# with respect to inputs t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def state_updates(self):\n state_updates = []\n for layer in self.layers:\n if getattr(layer, 'stateful', False):\n if hasattr(layer, 'updates'):\n state_updates += layer.updates\n return state_updates",
"def get_updates(self):\n\n\t\tda_cost = self.get_cost()\n\n\t\tweight_gradient... | [
"0.67009324",
"0.6332913",
"0.6213321",
"0.6131573",
"0.59924716",
"0.5910225",
"0.58402723",
"0.5834833",
"0.580465",
"0.5777845",
"0.5642365",
"0.56351185",
"0.5573368",
"0.55714744",
"0.5546164",
"0.5536157",
"0.5521792",
"0.5472434",
"0.5462437",
"0.5448215",
"0.5409123",... | 0.74391586 | 0 |
Retrieve the network's losses. Will only include losses that are either unconditional, or conditional on inputs to this model (e.g. will not include losses that depend on tensors that aren't inputs to this model). | def losses(self):
losses = []
for layer in self.layers:
losses += layer.losses
if context.in_eager_mode():
return losses
relevant_inputs = self.inputs or []
for i in range(1, len(self._inbound_nodes)):
inputs = self.get_input_at(i)
if isinstance(inputs, list):
releva... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def losses(self):\n # compute all kinds of losses \n\n # 1. Logits losses for classification \n\n # 2. regression loss for bbox \n\n return classification_loss, bbox_reg_loss",
"def get_losses(self):\n if self.loss is not None:\n return [self.loss]\n else:\n ... | [
"0.7554572",
"0.7521082",
"0.6706245",
"0.66327393",
"0.6568412",
"0.6431607",
"0.6358024",
"0.63523227",
"0.63476425",
"0.62977433",
"0.62977433",
"0.62793964",
"0.6258504",
"0.62469023",
"0.6212453",
"0.6212191",
"0.6188569",
"0.617553",
"0.617553",
"0.616311",
"0.6154914",... | 0.80897933 | 0 |
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 |
Loads all layer weights from a HDF5 save file. If `by_name` is False (default) weights are loaded based on the network's topology, meaning the architecture should be the same as when the weights were saved. Note that layers that don't have weights are not taken into account in the topological ordering, so adding or rem... | def load_weights(self, filepath, by_name=False):
if h5py is None:
raise ImportError('`load_weights` requires h5py.')
with h5py.File(filepath, 'r') as f:
if 'layer_names' not in f.attrs and 'model_weights' in f:
f = f['model_weights']
if by_name:
load_weights_from_hdf5_group_by_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_weights(self, filepath, by_name=False, exclude=None):\n\n if exclude:\n by_name = True\n\n if h5py is None:\n raise ImportError('`load_weights` requires h5py.')\n f = h5py.File(filepath, mode='r')\n if 'layer_names' not in f.attrs and 'model_weights' in f:... | [
"0.77666646",
"0.7640353",
"0.7537666",
"0.67017555",
"0.65264434",
"0.64799273",
"0.63887185",
"0.6366901",
"0.6157574",
"0.5986104",
"0.5866132",
"0.5698096",
"0.5360071",
"0.5323279",
"0.5293548",
"0.5216804",
"0.50810814",
"0.506642",
"0.49889043",
"0.49872407",
"0.498430... | 0.8069089 | 0 |
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 |
Converts layers weights from Keras 1 format to Keras 2. | def preprocess_weights_for_loading(layer,
weights,
original_keras_version=None,
original_backend=None):
if layer.__class__.__name__ == 'Bidirectional':
num_weights_per_layer = len(weights) // 2
forward_wei... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_weights2(net):\n\tfor m in net.modules():\n\t\tif isinstance(m, nn.Conv2d):\n\t\t\tnn.init.xavier_uniform_(m.weight)\n\t\t\tif m.bias is not None:\n\t\t\t\tnn.init.constant_(m.bias, 0)\n\t\t\t\n\t\telif isinstance(m, nn.BatchNorm2d):\n\t\t\tnn.init.constant_(m.weight, 1)\n\t\t\tnn.init.constant_(m.bias, 0... | [
"0.6203628",
"0.61930245",
"0.612963",
"0.5974079",
"0.5968323",
"0.5933419",
"0.59218013",
"0.577767",
"0.5749905",
"0.5710342",
"0.56769973",
"0.5662022",
"0.5621589",
"0.56125194",
"0.5564876",
"0.5558931",
"0.5555018",
"0.5540978",
"0.55320054",
"0.5530641",
"0.55190396",... | 0.6847917 | 0 |
Decorator that handles tuple/TensorShape conversion. Used in `compute_output_shape` and `build`. | def shape_type_conversion(fn):
def wrapper(instance, input_shape):
if input_shape is not None:
if isinstance(input_shape, list):
input_shape = [
tuple(tensor_shape.TensorShape(x).as_list()) for x in input_shape]
else:
input_shape = tuple(tensor_shape.TensorShape(input_shap... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def infer_shape_make_tuple(track, *args):\n sh = [await x['shape'] for x in args]\n return TupleShape(sh)",
"def wrap(func, *args, unsqueeze=False):\n\n # Convert input types where applicable\n args = list(args)\n for i, arg in enumerate(args):\n if type(arg) == np.ndarray:\n ... | [
"0.64385897",
"0.61577266",
"0.61547065",
"0.6123404",
"0.6027381",
"0.6014724",
"0.5868795",
"0.5852126",
"0.5830542",
"0.57883346",
"0.5783651",
"0.56933624",
"0.56317014",
"0.55889386",
"0.55715406",
"0.55495816",
"0.553933",
"0.5517297",
"0.5499581",
"0.54156256",
"0.5401... | 0.7243811 | 0 |
Builds a map of the graph of layers. This recursively updates the map `layer_indices`, the list `nodes_in_decreasing_depth` and the set `network_nodes`. | def build_map(tensor,
finished_nodes,
nodes_in_progress,
layer,
node_index,
tensor_index):
node = layer._inbound_nodes[node_index] # pylint: disable=protected-access
# Prevent cycles.
if node in nodes_in_progress:
raise ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _map_graph_network(inputs, outputs):\n # Network_nodes: set of nodes included in the graph of layers\n # (not all nodes included in the layers are relevant to the current graph).\n network_nodes = set() # ids of all nodes relevant to the Network\n nodes_depths = {} # dict {node: depth value}\n layers_de... | [
"0.7749785",
"0.58500004",
"0.58035445",
"0.57934177",
"0.5785982",
"0.57679087",
"0.5744957",
"0.5577869",
"0.5560324",
"0.5552233",
"0.55086184",
"0.5504372",
"0.54469365",
"0.5445193",
"0.54325163",
"0.5395003",
"0.5385376",
"0.53417903",
"0.5309939",
"0.5306035",
"0.52467... | 0.6577763 | 1 |
Function to Track Moisture Level Returns Moisture Value | def track_moisture_level():
try:
normal_level_init = 470
low_level_init = 560
global LIMIT_FLAG
sensor_read = sensorData.read_moisture()
generate_json.define_structure("moisture", sensor_read)
if sensor_read > low_level_init:
if LIMIT_FLAG != 3:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_moisture(self) -> int:\n return int(self.get_state(self.entity_ids['current_moisture']))",
"def moisture(self):\n if self.moisture_sensor is None:\n return None\n else:\n return self.moisture_sensor.percent",
"def maCruise(self):\n return .77",
"d... | [
"0.66716444",
"0.63705415",
"0.57610047",
"0.57574034",
"0.57160485",
"0.5705539",
"0.5647979",
"0.55928165",
"0.5576037",
"0.5556875",
"0.54964304",
"0.5485822",
"0.5459541",
"0.54503155",
"0.54245687",
"0.5390041",
"0.5365124",
"0.536031",
"0.53520393",
"0.53512824",
"0.534... | 0.7396042 | 0 |
explainerdashboard CLI tool. Used to launch an explainerdashboard from the commandline. \b explainerdashboard run Run explainerdashboard and start browser directly from command line. \b | def explainerdashboard_cli(ctx): | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cli():",
"def cli():",
"def cli():",
"def cli():",
"def cli():",
"def cli():",
"def cli():",
"def cli():",
"def cli():",
"def cli():",
"def cli():",
"def cli():",
"def cli():",
"def cli():",
"def cli():",
"def cli():",
"def cli():",
"def cli():",
"def cli():",
"def cli():"... | [
"0.6720353",
"0.6720353",
"0.6720353",
"0.6720353",
"0.6720353",
"0.6720353",
"0.6720353",
"0.6720353",
"0.6720353",
"0.6720353",
"0.6720353",
"0.6720353",
"0.6720353",
"0.6720353",
"0.6720353",
"0.6720353",
"0.6720353",
"0.6720353",
"0.6720353",
"0.6720353",
"0.6720353",
"... | 0.84108174 | 0 |
(file open for reading) > list of float Read and return list of grades in gradefile | def read_grades(gradefile):
#skip over header
line = gradefile.readline()
while line != '\n':
line = gradefile.readline()
#read the grades, accumlating them into a list.
grades = []
line = gradefile.readline()
while line != '':
#We have a string containing info for singl... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def populate_grades_list(file_object):\n email_list = []\n grade_list = []\n\n for line in file_object:\n tmp_list = line.split()\n email_list.append(tmp_list[0])\n grade_list.append(tmp_list[1::])\n\n for value_list in grade_list:\n for i, value in enumerate(value_list):\n ... | [
"0.703265",
"0.6650445",
"0.65691876",
"0.65250295",
"0.63102",
"0.62889344",
"0.62173235",
"0.6180634",
"0.6176317",
"0.6104537",
"0.60217613",
"0.6019209",
"0.5997103",
"0.5946862",
"0.5933064",
"0.5927422",
"0.5918964",
"0.59073734",
"0.5896533",
"0.588818",
"0.58771574",
... | 0.81548846 | 0 |
This function is automatically called when the task has completed (successfully or not). You implement finished() to do whatever followup stuff should happen after the task is complete. finished is always called from the main thread, so it's safe to do GUI operations and raise Python exceptions here. result is the retu... | def finished(self, result):
raise NotImplementedError("Subclasses mut override finished()") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def task_done(self) -> None:\n pass",
"def taskCompleted(self) -> None:\n ...",
"def taskCompleted(self) -> None:\n ...",
"def finished(self):",
"def finished(self):\r\n raise NotImplementedError",
"def finished(self):\n raise NotImplementedError()",
"def finished(sel... | [
"0.6918335",
"0.6911658",
"0.6911658",
"0.68672836",
"0.6820632",
"0.67570865",
"0.67491585",
"0.6728455",
"0.67025614",
"0.66183585",
"0.6411025",
"0.6394211",
"0.63900214",
"0.63749427",
"0.63749427",
"0.63746125",
"0.6339039",
"0.6332644",
"0.6322808",
"0.6296955",
"0.6296... | 0.7348429 | 0 |
Fetch license artifacts associated with the service model and search licensekeygroupUUID and entitlementpooluuid associated with the given att part number and nominal throughput in a request | def license_optim(request_json):
mdc_from_json(request_json)
req_id = request_json["requestInfo"]["requestId"]
model_name = request_json.get('placementInfo', {}).get('serviceInfo', {}).get('modelInfo', {}).get('modelName')
service_name = model_name
license_info = []
for demand in request_json... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_and_download_files(context):\n\n\n input_path = 'input/'\n if os.path.isdir(input_path):\n log.debug('Path already exists: ' + input_path)\n else:\n log.debug('Creating: ' + input_path)\n os.mkdir(input_path)\n\n fw = context.client\n\n if 'classification_measurement' i... | [
"0.54286665",
"0.5196006",
"0.5137875",
"0.4929878",
"0.47651935",
"0.4748385",
"0.47454703",
"0.4692453",
"0.46507284",
"0.4643923",
"0.4641228",
"0.4612098",
"0.4580337",
"0.45568007",
"0.45433447",
"0.4523338",
"0.4513945",
"0.45056123",
"0.4497337",
"0.44970152",
"0.44823... | 0.5655947 | 0 |
Set a random start point for a new snake and return its coordinates. | def get_new_snake():
global direction, snake, X_start, Y_start
X = [x for x in range(40, WINDOWWIDTH - 80, 20)] #multiplier list 20
Y = [y for y in range(40,WINDOWHEIGHT - 80, 20)]#multiplier list 20
X_start = random.choice(X)#random multiplier of 20
Y_start = random.choice(Y)#random multiplier of ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _random_start_position(self):\r\n self.position = np.array(random.choice(self.start_positions),\r\n dtype=np.int16)",
"def rand_start_pos(self):\n free_list = np.where(self.grid_map == self.empty_value)\n pos_idx = np.random.randint(free_list[0].shape[0])\... | [
"0.7055944",
"0.66870147",
"0.65640426",
"0.6366627",
"0.63529134",
"0.6328111",
"0.6247258",
"0.622765",
"0.62188524",
"0.61395854",
"0.61192894",
"0.6099123",
"0.60775715",
"0.6012391",
"0.59755707",
"0.5974625",
"0.5952304",
"0.59483",
"0.59292364",
"0.5928669",
"0.5922501... | 0.68626577 | 1 |
make a list of recent acis observation | def get_recent_obsid():
#
#--- extract a list of the last two weeks of acis observations
#
stop = time.strftime('%Y:%j:%H:%M:%S', time.gmtime())
stop = Chandra.Time.DateTime(stop).secs
start = stop - 86400 * 14
a_list = make_obsid_list(start, stop)
return a_list | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_observation(self):\n return []",
"def get_observation_list(self):\n return self.observations",
"def _get_obs(self):\n\n\n return OrderedDict(\n [\n (\"count\", self.count),\n (\"observation\", self.state.copy()),\n\n ]\n )... | [
"0.62627023",
"0.59185773",
"0.5808576",
"0.57445425",
"0.55848485",
"0.556348",
"0.5557747",
"0.55287105",
"0.5524823",
"0.5470817",
"0.5451663",
"0.54486525",
"0.5441415",
"0.5439831",
"0.5406885",
"0.5387726",
"0.5383874",
"0.5338046",
"0.53371894",
"0.5328252",
"0.5317614... | 0.7570609 | 0 |
compress older plots files | def zip_old_plot_file(a1=30, a2=60):
today = time.strftime('%Y:%j:%H:%M:%S', time.gmtime())
today = Chandra.Time.DateTime(today).secs
stop = today - 86400 * a1
start = today - 86400 * a2
a_list = make_obsid_list(start, stop)
for obsid in a_list:
cdir = plot_dir + 'Ind_Plots/acis... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clean_plots(request, save_figs):\n\n def fin():\n if save_figs is not None:\n plt.savefig(f\"{os.path.join(save_figs, request.node.name)}.png\")\n plt.close(\"all\")\n\n request.addfinalizer(fin)",
"def save_fig(ax_data, file_name):\n with open(file_name,'wb') as fid:\n ... | [
"0.606111",
"0.60254896",
"0.5936532",
"0.5899535",
"0.5893519",
"0.58660996",
"0.57554936",
"0.5748019",
"0.57389164",
"0.5674885",
"0.5673358",
"0.56440294",
"0.5628109",
"0.5620251",
"0.56082934",
"0.5570723",
"0.5566784",
"0.5559577",
"0.5559577",
"0.54967564",
"0.5490439... | 0.7255857 | 0 |
Evaluates the value of the cost function for given parameters by communicating with client. | def __call__(self, parameters) -> ValueEstimate:
# Encode params to json string
save_circuit_template_params(parameters, "current_optimization_params.json")
with open("current_optimization_params.json", "r") as f:
current_params_string = f.read()
# POST params to proxy
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def eval_cost(self, params, **kwargs):\n raise NotImplementedError",
"def evaluate_cost(self, msg):\n raise NotImplementedError()",
"def EvaluateFunction(self, p_float=..., p_float=..., p_float=...):\n ...",
"def _cost_method(self, *args, **kwargs):\n\n cost_val = 0.5 * np.linalg.... | [
"0.68833715",
"0.6552716",
"0.6414888",
"0.6136946",
"0.6054446",
"0.6020302",
"0.5953084",
"0.59045607",
"0.58985734",
"0.5881405",
"0.58281946",
"0.5827903",
"0.5775339",
"0.57697356",
"0.57682675",
"0.5752939",
"0.57292604",
"0.5696659",
"0.56805944",
"0.56728137",
"0.5629... | 0.6750966 | 1 |
Kills excel Background process inorder to fetch the active worksheet. This is dangerous and close all other excel sheets before using this function. | def kill_excel_bg():
excel_process = [
process for process in psutil.process_iter() if process.name() == "EXCEL.EXE"
]
for process in excel_process:
xl_files = [f.path for f in process.open_files() if ".xl" in f.path]
print(xl_files)
if len(xl_files) == 0:
process... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def CloseExcelFile(self):\r\n self.ss.close(False) # SaveChanges = False\r\n self.xl.Application.Quit()",
"def clean_up():\n if is_excel_running():\n # Prevents Excel from reopening\n # if it has been closed manually or never been opened\n for app in Apps():\n ... | [
"0.65055853",
"0.64582294",
"0.616265",
"0.5976525",
"0.5976525",
"0.5968671",
"0.591073",
"0.5901765",
"0.59010446",
"0.58406603",
"0.58245236",
"0.5819786",
"0.57964534",
"0.5766821",
"0.5750225",
"0.56709623",
"0.564577",
"0.56204385",
"0.5613505",
"0.5600134",
"0.5597092"... | 0.71074814 | 0 |
Connects to the current active excel workbook and return win32com client object. Using this function has known issues. | def connect_to_excel() -> w32:
xl = xl_app()
if xl.ActiveWorkbook is None:
kill_excel_bg()
xl = xl_app() # type: w32
logging.info(f"Connected to excel sheet {xl.ActiveWorkbook.Name}")
return (
xl
if check_jupyter_excel_connection(xl)
else Exception("Not conne... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def xl_app():\n # get the Excel application object from PyXLL and wrap it\n xl_window = get_active_object()\n xl_app = win32com.client.Dispatch(xl_window).Application\n # it's helpful to make sure the gen_py wrapper has been created\n # as otherwise things like constants and event handlers won't wor... | [
"0.6155974",
"0.61225194",
"0.5725281",
"0.5470277",
"0.5454899",
"0.5421767",
"0.53526795",
"0.5294494",
"0.5244303",
"0.52142185",
"0.5169555",
"0.5121356",
"0.5063958",
"0.5020426",
"0.49767986",
"0.495653",
"0.4915732",
"0.4904937",
"0.48884806",
"0.47731617",
"0.47678655... | 0.74729425 | 0 |
Load modules from the pyxll config file. Useful in a jupyter notebook environment | def load_modules_from_config(cfg: str):
pyxll_cfg = ConfigParser()
pyxll_cfg.read(cfg)
for path in pyxll_cfg["PYTHON"]["pythonpath"].split("\n"):
sys.path.append(path) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_modules_manually():\n #cmd_folder = os.path.realpath(os.path.abspath(os.path.split(inspect.getfile( inspect.currentframe() ))[0]))\n cmd_folder = '../myutils/'\n if cmd_folder not in sys.path:\n sys.path.insert(0, cmd_folder)\n #print sys.path",
"def load_modules(bot, config):\n fo... | [
"0.6194917",
"0.59518373",
"0.585345",
"0.5834126",
"0.5826517",
"0.57478696",
"0.5743501",
"0.57053727",
"0.5685117",
"0.5639987",
"0.56109077",
"0.5590987",
"0.550079",
"0.5492593",
"0.54770744",
"0.54672354",
"0.5466415",
"0.54228854",
"0.54109836",
"0.5384434",
"0.5383074... | 0.70186377 | 0 |
Register a callback for comm_close Will be called with the `data` of the close message. Call `on_close(None)` to disable an existing callback. | def on_close(self, callback):
self._close_callback = callback | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_on_channel_close_callback(self):\n logger.info('Adding channel close callback')\n self._channel.add_on_close_callback(self.on_channel_closed)",
"def add_on_channel_close_callback(self):\n self.logger.info('Adding channel close callback')\n self._channel.add_on_close_callback(s... | [
"0.66941077",
"0.6671357",
"0.65705276",
"0.65651107",
"0.6093962",
"0.6089108",
"0.60651124",
"0.6064921",
"0.6051649",
"0.59976",
"0.59700936",
"0.5883123",
"0.58765686",
"0.57918346",
"0.5536476",
"0.5441828",
"0.54223126",
"0.5419279",
"0.5379486",
"0.5379486",
"0.5379486... | 0.6788618 | 0 |
Handle a comm_close message | def handle_close(self, msg):
self.log.debug("handle_close[%s](%s)", self.comm_id, msg)
if self._close_callback:
self._close_callback(msg) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def handle_close(self):\n print(self.addr, \"bye\")\n self.close()",
"def msg_close(version = NATIVE_HEADER_VERSION, order=\"<\"):\n return message_no_reply(CLOSE, \"\", \"\", version, order)",
"def on_closing(event=None):\r\n my_msg.set(\"{quit}\")\r\n send()",
"def sendClose(self, co... | [
"0.6898485",
"0.68468136",
"0.6777746",
"0.6761843",
"0.6737819",
"0.6737819",
"0.6737819",
"0.6737819",
"0.66932285",
"0.66553104",
"0.66369873",
"0.66330224",
"0.6602895",
"0.65806466",
"0.65038866",
"0.64970094",
"0.6462982",
"0.64401937",
"0.6372569",
"0.6240193",
"0.6228... | 0.7536824 | 0 |
verifier si un element existe dans une list | def exist(self,list,a):
i = 0
for elem in list:
if (elem == a):
i=i+1
if (i>0):
return True
else:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_list_exists(this_list=[]):\n if isinstance(this_list, list) and len(this_list) > 0:\n return True\n else:\n return False",
"def _listContains(self, l, entry):\n for i in range(0, len(l)):\n if l[i] == entry:\n return True\n ret... | [
"0.73109335",
"0.71970487",
"0.7061737",
"0.7013981",
"0.67763895",
"0.66172284",
"0.65882987",
"0.6577764",
"0.6576582",
"0.65707767",
"0.6550222",
"0.65278035",
"0.6522197",
"0.65178317",
"0.6487218",
"0.6449266",
"0.64304125",
"0.63753456",
"0.6375052",
"0.63368744",
"0.63... | 0.7795414 | 0 |
Helper function to handle filtered items comma delimited string | def split_cmdline_filter_items(string):
filter_items = string.split(',')
return filter_items | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def comma_filter(value):\n return '{:,}'.format(value)",
"def comma_code(items):\n item_len = len(items)\n \n if item_len == 0:\n return ''\n elif item_len == 1:\n return items[0]\n\n return ', '.join(items[:-1]) + ', and ' + items[-1]",
"def sanitize_metrics_filter(metric_filte... | [
"0.6523944",
"0.6259372",
"0.61320263",
"0.6083365",
"0.6035963",
"0.59400517",
"0.58690673",
"0.5866547",
"0.5862891",
"0.5861083",
"0.5809238",
"0.57314897",
"0.5680077",
"0.56491226",
"0.56409234",
"0.5610342",
"0.560232",
"0.560232",
"0.5599939",
"0.557739",
"0.5575543",
... | 0.71210736 | 0 |
Method to parse commandline arguments of serving size and filter items | def parse_arguments():
global parser
parser = argparse.ArgumentParser(
description='Certainly this isn\'t how Food Network does it',
formatter_class=argparse.RawDescriptionHelpFormatter,
epilog=textwrap.dedent('''
Recipe List must appear as follows. **... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cmd_size(args):",
"def parse_args():\n\tglobal id_width\n\n\t# Parsing the args\n\targs = parser.parse_args()\n\n\t# Retrieving the args\n\tid_width = args.id_width",
"def parse_args():\n\n parser = argparse.ArgumentParser(description=\"Benchmark Thing WoT server\")\n parser = utils.extend_server_arg... | [
"0.6223562",
"0.6163945",
"0.60260504",
"0.5878589",
"0.5855476",
"0.58422273",
"0.5816425",
"0.5810505",
"0.58065313",
"0.5800577",
"0.5779477",
"0.5772803",
"0.5751752",
"0.5737089",
"0.5699368",
"0.5673736",
"0.56566215",
"0.56529987",
"0.56464386",
"0.5641782",
"0.5639594... | 0.66262203 | 0 |
Function to parse txt file of recipes and construct 2D list tokenizing each of the recipes metadata and ingredient content | def construct_list_of_recipes():
sub_list = []
with open(args.input_file, 'r') as f:
lines = [line if line == '\n' else line.rstrip('\n') for line in f]
recipes_list = []
for element in lines:
if element == '\n':
recipes_list.append(sub_list)
sub_list = []
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_foods(foods_txt):\n foods = []\n for line in foods_txt:\n ingredients_txt, allergens_txt = line.split(\" (contains \")\n ingredients = ingredients_txt.split()\n allergens = allergens_txt[:-1].split(\", \")\n\n foods.append((ingredients, allergens))\n\n return foods",
... | [
"0.6772814",
"0.6052774",
"0.59686327",
"0.5949775",
"0.589042",
"0.58483",
"0.5812816",
"0.5793555",
"0.57722795",
"0.5772054",
"0.57039815",
"0.56501746",
"0.5648882",
"0.5641128",
"0.5631791",
"0.562814",
"0.5627455",
"0.56138176",
"0.56124926",
"0.55846786",
"0.55565566",... | 0.7190229 | 0 |
Function to construct a new output_dict excluding recipes with filter_ingredients | def filter_output_dict(output_dict):
global filter_ingredients
if filter_ingredients:
filtered_dict = {k: v for k, v in
output_dict.iteritems() if
all(filter_item in v['ingredients']
for filter_item in filter_ingredients)}
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter():\n ingredient = request.args.get(\"ingredient\")\n if ingredient == None: # no ingredient parameter was included in the request\n return Response(\n \"{\\\"error\\\":\\\"ingredient parameter is required\\\"}\",\n status=400,\n mimetype=\"application/json\"... | [
"0.63625383",
"0.6360492",
"0.61961323",
"0.6113551",
"0.5905042",
"0.57337976",
"0.56699854",
"0.5645597",
"0.5505097",
"0.5494827",
"0.5426863",
"0.5423085",
"0.54064524",
"0.5354577",
"0.5350412",
"0.5335406",
"0.5281635",
"0.52562",
"0.5244354",
"0.52313745",
"0.5203894",... | 0.79188234 | 0 |
Iterate over the recipes and wrap them into a output dict | def construct_output_dict():
list_of_recipes = construct_list_of_recipes()
output_dict = {}
for recipe_list in list_of_recipes:
recipe_instance = construct_recipe_object(recipe_list)
recipe_dict = recipe_instance.construct_json_rep_obj()
for k, v in recipe_dict.iteritems():
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_recipe_details(recipe_links):\n cuisine_recipes = {}\n for r in recipe_links:\n recipe = {}\n recipe_link = r.a[\"href\"]\n print \"recipe link: \", recipe_link\n soup_recipe = get_recipe(recipe_link)\n if soup_recipe:\n recipe['r_link'] = recipe_link\n ... | [
"0.6307142",
"0.61831933",
"0.6126512",
"0.6043163",
"0.5846334",
"0.58092827",
"0.57821715",
"0.57819295",
"0.57662284",
"0.57036597",
"0.5619611",
"0.5571755",
"0.5534036",
"0.5516632",
"0.5495394",
"0.54889274",
"0.5431682",
"0.53547376",
"0.53475016",
"0.534165",
"0.53280... | 0.77564865 | 0 |
interest_param is a tuple containing a dict containing the satellite name, orbit parameters, and orbit classifications | def __init__(self, interest_param):
self.name, self.orbit_param, self.orbit_class, self.orbit_type = interest_param
# dict containing NEO, MEO, GEO,
# apogee, perigee, or elliptical
# inclination, period,
# and eccentricity | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def doParametersOfInterest(self):\n\n self.modelBuilder.doVar(\"Afb[0.6,-0.75,0.75]\");\n self.modelBuilder.doSet(\"POI\",\"Afb\")\n\n # ss templates\n self.modelBuilder.doVar(\"Dilu_ratio[1.0,0.0,10.0]\");\n self.modelBuilder.doVar(\"Rdy_mumu_ss[1.0,0.0,10.0]\");\n self.m... | [
"0.5597302",
"0.55475473",
"0.5455908",
"0.53832096",
"0.5357705",
"0.5349089",
"0.5325157",
"0.5322769",
"0.52929866",
"0.5284521",
"0.5183548",
"0.5170347",
"0.5084414",
"0.49903712",
"0.49777502",
"0.4952482",
"0.4888492",
"0.48553658",
"0.4845688",
"0.4829843",
"0.4828081... | 0.756182 | 0 |
Extend to encode random f and cr values onto each member of the population. | def __init__(self, *args, **kwargs):
super(jDE, self).__init__(*args, **kwargs)
for i in range(self.population.size):
self.population.members[i].f = 0.1 + 0.9 * numpy.random.rand()
self.population.members[i].cr = numpy.random.rand() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gen_values(self):",
"def _generate_raw_environments(self, num, seed):",
"def rand(self):\n raise NotImplementedError",
"def mutate(self):\n\n if len(self.genes) < 250:\n for g in self.genes:\n\n if MUTATION_CHANCE < random.random(): # random.random() gives float in... | [
"0.582015",
"0.5631153",
"0.55910796",
"0.5561565",
"0.553103",
"0.5508012",
"0.54818636",
"0.54791534",
"0.5465223",
"0.5457774",
"0.5436654",
"0.5425668",
"0.5397977",
"0.53881395",
"0.5383666",
"0.53655213",
"0.5344523",
"0.5330343",
"0.52958024",
"0.5286964",
"0.5282226",... | 0.63107413 | 0 |
Profiles a given cuda application using the command provided The profile data is returned as a dict of kernels with their metrics and the data for each call | def ProfileApp(command):
logging.info("Command to profile: {0}".format(" ".join(command)))
kernelMetrics = dict()
# get execution time first because for whatever reason
# we need a different nvprof command
# build the profiling command
profileCommand = ["nvprof", "--print-gpu-trace", "--csv"]... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _run_profile(self, profile: Tuple[str, List[int], int, float]) -> List[int]:\n # pylint: disable=unused-variable\n name, command, signals, delay = profile\n # pylint: enable=unused-variable\n\n # print(\"\\trunning profile: %s, command %s, %d, delay %0.02f\" %\n # (name, [\... | [
"0.5960219",
"0.58565557",
"0.5716736",
"0.5441635",
"0.53858054",
"0.5206173",
"0.5170805",
"0.51140755",
"0.50826657",
"0.5024006",
"0.5007603",
"0.49988145",
"0.49846023",
"0.4983805",
"0.49742296",
"0.4943996",
"0.48566967",
"0.48441958",
"0.48424977",
"0.4832195",
"0.483... | 0.8090687 | 0 |
Takes a set of metrics and adds a set of derived metrics A given set of throughput metrics will be converted to its equivalent counts using the duration given in statistics Metrics from combined metrics will then be summed together to generate a new combined metric | def generateDerivedMetrics(kernelMetrics, statistics, throughputMetrics = {}, countMetrics = {}, combinedMetrics = {}):
# combine single metrics
for combinedMetric in combinedMetrics:
for kernel in kernelMetrics:
logging.debug("Combining metrics for kernel {}".format(kernel))
#... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_stats(self):\n units = self.get_unit_map()\n for metric in self.raw_metrics:\n unit, metric_type = units.get(metric, (DEFAULT_UNIT, DEFAULT_TYPE))\n if metric_type == \"counter\":\n # Unit/Second\n unit = \"/\".join((unit, \"Second\"))\n ... | [
"0.67379445",
"0.6392101",
"0.6263343",
"0.6217148",
"0.6202033",
"0.6021694",
"0.5909661",
"0.588806",
"0.58644867",
"0.5835653",
"0.5708207",
"0.5707943",
"0.5697257",
"0.5673869",
"0.56496733",
"0.5629821",
"0.56219655",
"0.561071",
"0.561009",
"0.55759895",
"0.55577517",
... | 0.6852241 | 0 |
Generates roofline points from a set of kernel metrics The flops type is automatically selected to be the one with the highest throughput | def generateRooflinePoints(kernelMetrics):
rooflines = dict()
memRooflines = dict()
# one point for each kernel
# runs are averaged
for kernel in kernelMetrics:
logging.debug("Starting roofline generation for kernel {}".format(kernel))
# figure out which flops is highest
fl... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def roofline_plot():\n\n def attainable_performance(operational_intensity):\n return min(PEAK_PERFORMANCE, MEMORY_BANDWIDTH * operational_intensity)\n\n oi_values = np.logspace(-4, 12, 1000, base=2)\n perf_values = [attainable_performance(oi) for oi in oi_values]\n fig, ax = viz_utils.setup_figu... | [
"0.55515224",
"0.5260893",
"0.5233731",
"0.5168344",
"0.51133126",
"0.5103171",
"0.5094314",
"0.5086308",
"0.5072418",
"0.50661457",
"0.5039138",
"0.50162923",
"0.5015882",
"0.50045204",
"0.4940882",
"0.49120685",
"0.49088785",
"0.48621792",
"0.4859575",
"0.4826404",
"0.48225... | 0.81111413 | 0 |
Generates and aspen model based on kernel metrics counts will be based on profile data | def generateAspenModel(kernelMetrics, modelName=None, rooflines=None):
# metrics we care about and the mapping to aspen resources
aspenMetricsFlops = {"flop_count_dp" : "as dp",
"flop_count_sp" : "as sp"}
aspenMetricsMem = {"dram_read_bytes" : "loads",
"d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, dims, act = 'relu', random_seed = 201809, splitseed = 215, optimizer = Adam(),\n weights_dir = 'CarDEC Count Weights', n_features = 32, mode = 'HVG'):\n \n super(count_model, self).__init__()\n\n tf.keras.backend.clear_session()\n \n self.mode = mod... | [
"0.6197215",
"0.6179176",
"0.61233026",
"0.60849535",
"0.5975204",
"0.59584266",
"0.5925668",
"0.5914981",
"0.5912443",
"0.59088415",
"0.587874",
"0.583481",
"0.5832889",
"0.58285797",
"0.5824648",
"0.58075756",
"0.5796022",
"0.5794778",
"0.579187",
"0.57816434",
"0.57709134"... | 0.65697956 | 0 |
This function tries to cast the port to integer. If it's not possible, the initial string value is returned. | def valid_port(ctx, param, value):
try:
value = int(value)
except ValueError:
pass
return value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _grab_port(self):\r\n port = \"\"\r\n while self._char != -1 and self._char in \"0123456789\":\r\n port += self._char\r\n self._get_char()\r\n if len(port) == 0:\r\n self._error(\"port empty\")\r\n return int(port)",
"def convertInt(s):\n try:\n... | [
"0.7344312",
"0.64872056",
"0.64229685",
"0.63615555",
"0.63481104",
"0.6235894",
"0.62252676",
"0.6177295",
"0.61397123",
"0.61028975",
"0.60978687",
"0.60978687",
"0.60958785",
"0.6053488",
"0.6051167",
"0.59981614",
"0.5985547",
"0.59640247",
"0.59606385",
"0.59353215",
"0... | 0.6962645 | 1 |
This function creates the SQL query depending on the specified port and the like option. | def get_ports(port, like=False):
conn = sqlite3.connect(DATABASE_PATH)
cursor = conn.cursor()
where_field = "port" if isinstance(port, int) else "name"
where_value = "%{}%".format(port) if like else port
cursor.execute(BASE_SQL + where_field + " LIKE ?", (where_value,))
return cursor | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run(port, like):\n ports = get_ports(port, like)\n table = get_table(ports)\n print(table)",
"def query(self, query, request_type=None):\n\n #encode to UTF-8\n try: query = query.encode(\"utf-8\")\n except: query = query.decode('raw_unicode_escape').encode(\"utf-8\")\n\n lowercase_query ... | [
"0.5777958",
"0.54624337",
"0.54352665",
"0.5378882",
"0.5313509",
"0.53130084",
"0.5191155",
"0.51026887",
"0.50910205",
"0.50606954",
"0.5035756",
"0.50239843",
"0.5011402",
"0.50092334",
"0.5002485",
"0.49994776",
"0.4979458",
"0.49748883",
"0.49660277",
"0.49547812",
"0.4... | 0.6570871 | 0 |
This function returns a pretty table used to display the port results. | def get_table(ports):
table = PrettyTable(["Name", "Port", "Protocol", "Description"])
table.align["Name"] = "l"
table.align["Description"] = "l"
table.padding_width = 1
for p in ports:
table.add_row(p)
return table | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_table(ports):\n table = PrettyTable([\"Name\", \"Port\", \"Protocol\", \"Description\"])\n table.align[\"Name\"] = \"l\"\n table.align[\"Description\"] = \"l\"\n table.padding_width = 1\n\n for port in ports:\n table.add_row(port)\n\n return table",
"def pretty_display(self):\n\t... | [
"0.8009263",
"0.6580488",
"0.65752167",
"0.65355736",
"0.64888346",
"0.6466678",
"0.645486",
"0.64460754",
"0.6360644",
"0.628148",
"0.62409216",
"0.6148639",
"0.6144184",
"0.6138973",
"0.6137527",
"0.6128025",
"0.61141527",
"0.6105768",
"0.60711896",
"0.6041017",
"0.60379446... | 0.80720896 | 0 |
Return phase and composition. | def get_phase_and_composition(self):
data = self.data
total = data.sum()
if total <= 0.: raise RuntimeError(f"'{phase_names[self.phase]}' phase does not exist")
return self.phase, data / total | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getPhase(phase):",
"def phase(self):\n return self.__phase",
"def GetPhase(self):\n ...",
"def phase(self):\n return self.data",
"def phases(self):\r\n\r\n phase = tsa.cache_to_phase(self.cache, self.ij)\r\n\r\n return phase",
"def phase(self):\n pass",
"de... | [
"0.7307",
"0.7237978",
"0.71048236",
"0.7045281",
"0.698043",
"0.696836",
"0.67255837",
"0.6650661",
"0.66206443",
"0.66041034",
"0.65987706",
"0.65656793",
"0.6487877",
"0.644085",
"0.63621134",
"0.62020665",
"0.61857206",
"0.61857206",
"0.6132078",
"0.60938764",
"0.60899353... | 0.80427444 | 0 |
Iterate over phasedata pairs. | def __iter__(self):
return zip(self._phases, self.data) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def iteritems(self):\n\t\tself.filep.seek(self.start + 2048)\n\n\t\t# iterate until we hit the enddata marker\n\t\twhile self.filep.tell() < self.enddata - 1:\n\t\t\t# fetch the lengths of the key and value\n\t\t\t(klen, vlen) = unpack('<LL', self.filep.read(8))\n\n\t\t\t# yield the key and value as a tuple\n\t\t\... | [
"0.61923057",
"0.6127433",
"0.6024104",
"0.59248453",
"0.5864485",
"0.5809957",
"0.5752815",
"0.5745456",
"0.5745456",
"0.5681684",
"0.566154",
"0.56560236",
"0.56503946",
"0.5589269",
"0.5587654",
"0.55798745",
"0.5524056",
"0.55216944",
"0.5510899",
"0.54914224",
"0.5477888... | 0.6936464 | 0 |
Iterate over phasecomposition pairs. | def iter_composition(self):
array = self.data
total = array.sum() or 1.
return zip(self._phases, array/total) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __iter__(self):\n return zip(self._phases, self.data)",
"def iter_components(self):\n for iv in range(len(self._var_names)):\n yield self._var_names[iv], self._vals[iv]",
"def pairs(self) -> Iterator[tuple[str, list[CommandParser]]]:\n for module, cmds in self._registry[\"by... | [
"0.64725065",
"0.6385009",
"0.5799649",
"0.57750535",
"0.5743196",
"0.5727175",
"0.56926465",
"0.56606615",
"0.56315726",
"0.5597081",
"0.55758834",
"0.55486155",
"0.55393696",
"0.5531499",
"0.55149543",
"0.55137235",
"0.5492203",
"0.54808474",
"0.54808474",
"0.54404294",
"0.... | 0.71738464 | 0 |
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 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 |
Return a VolumetricFlowIndexer that references this object's molar data. | def by_volume(self, TP):
try:
vol = self._data_cache[TP]
except:
phases = self._phases
chemicals = self._chemicals
V = [i.V for i in chemicals]
size = chemicals.size
self._data_cache[TP] = \
vol = VolumetricFlowIndexer.from_data(
SparseArray.fr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def by_volume(self, TP):\n try:\n vol = self._data_cache['vol', TP]\n except:\n chemicals = self._chemicals\n V = [i.V for i in chemicals]\n phase = self._phase\n self._data_cache['vol', TP] = \\\n vol = ChemicalVolumetricFlowIndexer.from_data(\n SparseVec... | [
"0.5805949",
"0.56040126",
"0.54907763",
"0.5324066",
"0.531043",
"0.5271636",
"0.5215782",
"0.5140199",
"0.4976544",
"0.48717976",
"0.48590884",
"0.48520187",
"0.48088706",
"0.4799558",
"0.47949484",
"0.4783697",
"0.4777927",
"0.47577655",
"0.472059",
"0.472059",
"0.472059",... | 0.59221214 | 0 |
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 |
Check first task info without deletion. | def check_first_task(self, robot_id):
individual_buffer = self.all_buffers[robot_id]
return individual_buffer[-1] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_task(self): \n return self.buffer[0]",
"def is_task_stagnant(task):",
"def check_repeated_task(self, task):\n task_status = task in self.tasks_asked\n\n # append if never asked\n if task_status == False:\n self.tasks_asked.append(task)\n\n return t... | [
"0.64242387",
"0.62899816",
"0.6108197",
"0.60125405",
"0.60099566",
"0.600749",
"0.5769892",
"0.57686234",
"0.5767578",
"0.57550174",
"0.57092655",
"0.57058084",
"0.5655717",
"0.562933",
"0.56269735",
"0.5589191",
"0.55790395",
"0.55574554",
"0.5546012",
"0.5513527",
"0.5509... | 0.6405698 | 1 |
Returns last task in the individual robot buffer. Task is deleted. | def get_last_task(self, robot_id):
individual_buffer = self.all_buffers[robot_id]
data = individual_buffer[0]
individual_buffer = np.delete(individual_buffer, 0, 0)
self.all_buffers[robot_id] = individual_buffer
return data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_last_task(self):\n return self.get_task_by_index(-1)",
"def check_last_task(self, robot_id): \n individual_buffer = self.all_buffers[robot_id]\n return individual_buffer[0]",
"def get_task(self): \n task = self.buffer[0]\n self.buffer = np.delete(self.buffer, ... | [
"0.8099018",
"0.8088282",
"0.75244987",
"0.7495541",
"0.7351919",
"0.6741725",
"0.64481336",
"0.62854195",
"0.6222197",
"0.6192808",
"0.6151941",
"0.6148577",
"0.61086005",
"0.6056386",
"0.60546494",
"0.60426307",
"0.60120016",
"0.59644395",
"0.5953452",
"0.59488744",
"0.5934... | 0.83151853 | 0 |
Check last task info without deletion. | def check_last_task(self, robot_id):
individual_buffer = self.all_buffers[robot_id]
return individual_buffer[0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_repeated_task(self, task):\n task_status = task in self.tasks_asked\n\n # append if never asked\n if task_status == False:\n self.tasks_asked.append(task)\n\n return task_status",
"def check(self):\r\n boto.log.info('checking Task[%s]-now=%s, last=%s' % (se... | [
"0.6505494",
"0.63198066",
"0.6284595",
"0.62270695",
"0.6204559",
"0.616811",
"0.6058152",
"0.5923084",
"0.59140325",
"0.58929634",
"0.58916634",
"0.5885536",
"0.58843505",
"0.5878879",
"0.57961357",
"0.5782836",
"0.5762973",
"0.56852335",
"0.5684497",
"0.56831384",
"0.56799... | 0.6521614 | 0 |
Deletes task from robot's buffer by task id. | def delete_task_by_id(self, robot_id, task_id):
individual_buffer = self.all_buffers[robot_id]
task_ids = individual_buffer[:, 0]
task_idx = np.where(task_ids == task_id)
if task_idx[0].size == 0:
print("ERROR: Task was already deleted of was never in the buffer.")
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def cancel_and_delete_task(task_id: TaskId):",
"def delete(self, tube, task_id):\n cmd = tube.cmd('delete')\n args = (task_id,)\n\n return self.tnt.call(cmd, args)",
"async def delete(self, task_id):\n args = (task_id,)\n res = await self.conn.call(self.__funcs['delete'... | [
"0.7585024",
"0.7496407",
"0.74108887",
"0.73956794",
"0.7229599",
"0.7218389",
"0.71924615",
"0.71235603",
"0.7020509",
"0.6904965",
"0.6901098",
"0.6884655",
"0.6880657",
"0.68713504",
"0.684092",
"0.6819857",
"0.680542",
"0.6800942",
"0.6792769",
"0.6777958",
"0.67621386",... | 0.8852605 | 0 |
Prints the contents of all buffers. | def print_all_buffers(self):
for robot in range(self.no_robots):
print("Buffer for robot: " + str(robot) + ":")
print("Task ids: X, Y goal: Z orientation: Deadline:")
individual_buffer = self.all_buffers[robot]
if isinstance(individual_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dump(self):\n# self.partial_in=\"\"\n# for line in sys.stdin: \n# self.partial_in+=sys.stdin.read(1)\n sys.stdout = sys.__stdout__\n os.system('cls')\n for cb in self.buffers.values():\n cb.dump(sys.stdout)\n sys.stdout = self",
"def genout(self):\n... | [
"0.69893146",
"0.6602505",
"0.6553516",
"0.6457419",
"0.6448137",
"0.6313259",
"0.6308344",
"0.6298255",
"0.61893225",
"0.6152568",
"0.60924226",
"0.6045671",
"0.59879345",
"0.59661067",
"0.59442204",
"0.5944079",
"0.5938131",
"0.5934754",
"0.59188473",
"0.5822754",
"0.581618... | 0.702585 | 0 |
If all buffers are empty True is returned. | def are_buffers_empty(self):
i = 0
for i in range(self.no_robots):
if self.is_buffer_empty_for_robot(i) is True:
i += 1
else:
return False
if i >= self.no_robots:
return True
else:
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isBufferEmpty(self):\n return self.ecg_buffer.empty()",
"def is_buffer_empty(self): \n if self.buffer.shape == (0, 5):\n return True\n else:\n return False",
"def is_empty(self):\r\n return self.buff==[]",
"def is_full(self):\n return len(se... | [
"0.8016782",
"0.8015151",
"0.7889439",
"0.7832754",
"0.7832754",
"0.7832754",
"0.7832754",
"0.7737354",
"0.756818",
"0.7445005",
"0.7407083",
"0.73865944",
"0.72423756",
"0.7240853",
"0.7211857",
"0.7199953",
"0.7176888",
"0.7172532",
"0.7171493",
"0.71576613",
"0.71323526",
... | 0.81440246 | 0 |
Returns task from robot's individual buffer. Returned task has a deadline that ends before the argumented deadline. If there is no such task, current active task is returned. Task is not deleted from the buffer. | def check_task_by_deadline(self, robot_id, deadline):
individual_buffer = self.all_buffers[robot_id]
if individual_buffer.shape[0] == 1:
task = self.check_last_task(robot_id)
return task
elif individual_buffer.shape[0] == 0:
print("ERROR: buffer for ro... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_task(self): \n task = self.buffer[0]\n self.buffer = np.delete(self.buffer, 0, 0)\n return task",
"def get_task(self):\n return self.queue.get()",
"def get_first_task(self, robot_id): \n individual_buffer = self.all_buffers[robot_id]\n task = individ... | [
"0.6866474",
"0.6741945",
"0.63914305",
"0.6383624",
"0.6366651",
"0.6301874",
"0.6252061",
"0.62437046",
"0.616717",
"0.6128929",
"0.59898907",
"0.59782624",
"0.58996314",
"0.5898423",
"0.5898423",
"0.5898423",
"0.5898423",
"0.5898423",
"0.5896144",
"0.5887958",
"0.5851993",... | 0.75464046 | 0 |
Add task to buffer. | def add_task(self, task):
self.buffer = np.vstack((self.buffer, task))
return self.buffer | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add(self, task):\n pass",
"def register(self, task: Task) -> None:\n self._buffer.add(task.future)\n task.add_ready_callback(self._add)",
"def add_task(self, task):\n self.tasks.append(task)",
"def add_task(self, task):\n self.tasks.append(task)",
"def add_task(self, ... | [
"0.78761667",
"0.7841464",
"0.7740462",
"0.7740462",
"0.7740462",
"0.7740462",
"0.76750946",
"0.75938886",
"0.7581593",
"0.7580112",
"0.7267468",
"0.7236128",
"0.7230977",
"0.71906996",
"0.7155861",
"0.71452564",
"0.71336526",
"0.7082641",
"0.7055979",
"0.7027959",
"0.6919501... | 0.8252278 | 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 |
Creates a dictionary with ROS publisher objects used for publishing goals. | def create_set_goal_pubs(self):
pubs = {}
for i in range(self.no_robots):
pub_topic = '/robot_' + str(i) + '/move_base/goal'
# pub_name = 'send_goal_robot_' + str(i) # key
pub_name = str(i) # key
pubs[pub_name] = rospy.Publisher(pub_topic, MoveBase... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_hand_publishers(self):\n hand_pub = {}\n\n for joint in [\"FFJ0\", \"FFJ3\", \"FFJ4\",\n \"MFJ0\", \"MFJ3\", \"MFJ4\",\n \"RFJ0\", \"RFJ3\", \"RFJ4\",\n \"LFJ0\", \"LFJ3\", \"LFJ4\", \"LFJ5\",\n \"THJ1\", \... | [
"0.6675421",
"0.61638",
"0.60298526",
"0.6007344",
"0.5813939",
"0.57426506",
"0.55105156",
"0.539758",
"0.5318396",
"0.5313484",
"0.5274191",
"0.5245611",
"0.52223974",
"0.52129316",
"0.5200293",
"0.5195122",
"0.5172014",
"0.51601124",
"0.5127859",
"0.51266104",
"0.51221544"... | 0.7441343 | 0 |
Returns current robot occupancy. If robot isn't moving > 0, if robot is moving > 1. | def get_robot_occupancy(self):
occupancy = np.zeros(self.no_robots)
for i in range(self.no_robots):
status_topic = '/robot_' + str(i) + '/move_base/status'
msg = rospy.wait_for_message(status_topic, GoalStatusArray)
msg_list = msg.status_list
if ms... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_occupant(self):\n\t\treturn self.occupant",
"def get_occupant(self):\n\t\tpass",
"def get_occupancy(self):\n # Compute logo for current alignment\n logo = self.get_logo()\n # Compute occupancy denominator by summing number of occurriencies\n den = np.sum(logo, axis=0)\n ... | [
"0.64873034",
"0.64286363",
"0.6384329",
"0.5948018",
"0.58905077",
"0.5843008",
"0.5843008",
"0.5824435",
"0.5777446",
"0.57264864",
"0.57001376",
"0.5696047",
"0.5696047",
"0.56312907",
"0.56112075",
"0.56098473",
"0.5572753",
"0.553214",
"0.5531029",
"0.55245584",
"0.55160... | 0.8479907 | 0 |
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 |
Try to get available user to download. | def get_user(self):
user = None
while user is None:
user = self.use()
if user is None:
logging.info('Waiting for available user to download...')
time.sleep(5)
return user | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_one_user():",
"def available(self, request):\n username = request.query_params['username']\n resp_data = {}\n if User.objects.filter(username=username).exists():\n resp_data['available'] = False\n else:\n resp_data['available'] = True\n return Resp... | [
"0.60041994",
"0.5900717",
"0.57394034",
"0.5721573",
"0.56907725",
"0.56869805",
"0.56774336",
"0.5670875",
"0.5665978",
"0.55958027",
"0.5578879",
"0.55716324",
"0.55705893",
"0.55703914",
"0.5529979",
"0.55233115",
"0.5515475",
"0.5511456",
"0.55111885",
"0.5509604",
"0.54... | 0.7647943 | 0 |
set current session Appium. |oAppiumInfo=${AppInfo}| | def aisappium_set_driver_instance(self, oAppiumInfo):
self._cache.current = oAppiumInfo.driver | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def appium_init(self):\n desired_cups = {}\n desired_cups['platformName'] = 'Android'\n desired_cups['platformVersion'] = android_version\n desired_cups['deviceName'] = device_name\n desired_cups['appPackage'] = pkg_name\n desired_cups['appActivity'] = activity\n de... | [
"0.6601209",
"0.59317946",
"0.5883183",
"0.5697906",
"0.5663244",
"0.5568987",
"0.54523796",
"0.5425999",
"0.53608453",
"0.5313601",
"0.53051645",
"0.52826554",
"0.527116",
"0.5247173",
"0.5247173",
"0.52119833",
"0.5187687",
"0.5146341",
"0.51420695",
"0.5116347",
"0.5107598... | 0.60792583 | 1 |
Click element on mobile. |locator=xpath=//[="id123"]|oAppiumInfo=${AppInfo} | def aisappium_click_element(self, locator, oAppiumInfo=None):
self._info("Clicking mobile element '%s'." % locator)
if oAppiumInfo is not None:
self._element_find_atlas(locator, True, True, oAppiumInfo.driver).click()
else:
self._element_find(locator, True, True).click() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def select_app_launcher_app(self, app_name):\n locator = lex_locators[\"app_launcher\"][\"app_link\"].format(app_name)\n self.open_app_launcher()\n self.selenium.wait_until_page_contains_element(locator, timeout=30)\n self.selenium.set_focus_to_element(locator)\n elem = self.sele... | [
"0.60016996",
"0.57440853",
"0.562351",
"0.55657375",
"0.5446922",
"0.54291373",
"0.5427778",
"0.5360228",
"0.53453577",
"0.5330872",
"0.528335",
"0.52765787",
"0.5207358",
"0.5170354",
"0.5145716",
"0.51455855",
"0.51274836",
"0.51267576",
"0.5112077",
"0.5099592",
"0.509144... | 0.7645754 | 0 |
Clears the text field identified by `locator`. |locator=xpath=//[="id123"]|oAppiumInfo=${AppInfo} | def aisappium_clear_text(self, locator, oAppiumInfo=None):
self._info("Clear text field '%s'" % locator)
if oAppiumInfo is not None:
self._element_clear_text_by_locator_atlas(locator, oAppiumInfo.driver)
else:
self._element_clear_text_by_locator(locator) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clear_put_value(self, locator):\n time.sleep(2)\n element = self.driver.find_element(*locator)\n element.send_keys(Keys.CONTROL + 'a')\n element.send_keys(Keys.DELETE)",
"def aisappium_input_text(self, locator, text, oAppiumInfo=None):\n self._info(\"Typing text '%s' into t... | [
"0.63335514",
"0.5878214",
"0.58614963",
"0.5519412",
"0.5471537",
"0.5400341",
"0.5341203",
"0.52341026",
"0.51790804",
"0.5178161",
"0.5120839",
"0.51207596",
"0.5104932",
"0.50769293",
"0.50294954",
"0.50251377",
"0.5020689",
"0.5019543",
"0.5019147",
"0.49580956",
"0.4952... | 0.80684006 | 0 |
Types the given `text` into text field identified by `locator`. |locator=xpath=//[="id123"]|oAppiumInfo=${AppInfo} See `introduction` for details about locating elements. | def aisappium_input_text(self, locator, text, oAppiumInfo=None):
self._info("Typing text '%s' into text field '%s'" % (text, locator))
if oAppiumInfo is not None:
self._element_input_text_by_locator_atlas(locator, text, oAppiumInfo.driver)
else:
self._element_input_text_b... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def aisappium_input_password(self, locator, text, oAppiumInfo=None):\n self._info(\"Typing password into text field '%s'\" % locator)\n if oAppiumInfo is not None:\n self._element_input_text_by_locator_atlas(locator, text, oAppiumInfo.driver)\n else:\n self._element_input... | [
"0.64829",
"0.614725",
"0.58976835",
"0.5713828",
"0.5712613",
"0.5626021",
"0.5529641",
"0.5498303",
"0.5493129",
"0.53856707",
"0.5320436",
"0.5284056",
"0.5233346",
"0.5213037",
"0.5164269",
"0.51591915",
"0.51591915",
"0.5155974",
"0.509612",
"0.5091673",
"0.50354683",
... | 0.7982116 | 0 |
Types the given password into text field identified by `locator`. |locator=xpath=//[="id123"]|oAppiumInfo=${AppInfo} Difference between this keyword and `Input Text` is that this keyword does not log the given password. See `introduction` for details about locating elements. | def aisappium_input_password(self, locator, text, oAppiumInfo=None):
self._info("Typing password into text field '%s'" % locator)
if oAppiumInfo is not None:
self._element_input_text_by_locator_atlas(locator, text, oAppiumInfo.driver)
else:
self._element_input_text_by_loc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def aisappium_input_text(self, locator, text, oAppiumInfo=None):\n self._info(\"Typing text '%s' into text field '%s'\" % (text, locator))\n if oAppiumInfo is not None:\n self._element_input_text_by_locator_atlas(locator, text, oAppiumInfo.driver)\n else:\n self._element_... | [
"0.68370265",
"0.62763005",
"0.59110856",
"0.5762719",
"0.5711707",
"0.56723815",
"0.5642231",
"0.55876017",
"0.54255587",
"0.53628826",
"0.53597707",
"0.5320671",
"0.5320671",
"0.5320671",
"0.5320671",
"0.5320671",
"0.5320671",
"0.5320671",
"0.5320671",
"0.5320671",
"0.53206... | 0.84931135 | 0 |
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 |
Verifies that element identified with locator is disabled. Key attributes for arbitrary elements are `id` and `name`. See `introduction` for details about locating elements. | def aisappium_element_should_be_disabled(self, locator, loglevel='INFO', oAppiumInfo=None):
if oAppiumInfo is not None:
element = self._element_find_atlas(locator, True, True, oAppiumInfo.driver)
else:
element = self._element_find(locator, True, True)
if element.is_enable... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def field_is_not_read_only_xpath(driver, locator):\n elem = driver.find_element_by_xpath(locator)\n is_disabled = elem.get_attribute(\"disabled\")\n if is_disabled == 'true':\n log_to_file('Expected Read Only field to be enabled, but was still disabled', 'WARNING')\n return False\n else:\... | [
"0.67634267",
"0.6432889",
"0.6097619",
"0.5995026",
"0.5835357",
"0.5770251",
"0.57616735",
"0.5740132",
"0.573144",
"0.5729595",
"0.5673569",
"0.5664641",
"0.56613714",
"0.5625864",
"0.5620968",
"0.5611174",
"0.5512022",
"0.5500273",
"0.54792833",
"0.5465939",
"0.54287297",... | 0.77044797 | 0 |
Verifies that element identified with locator is enabled. Key attributes for arbitrary elements are `id` and `name`. See `introduction` for details about locating elements. | def aisappium_element_should_be_enabled(self, locator, loglevel='INFO', oAppiumInfo=None):
if oAppiumInfo is not None:
element = self._element_find_atlas(locator, True, True, oAppiumInfo.driver)
else:
element = self._element_find(locator, True, True)
if not element.is_ena... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def aisappium_element_should_be_disabled(self, locator, loglevel='INFO', oAppiumInfo=None):\n if oAppiumInfo is not None:\n element = self._element_find_atlas(locator, True, True, oAppiumInfo.driver)\n else:\n element = self._element_find(locator, True, True)\n if element... | [
"0.61864775",
"0.6149874",
"0.6101802",
"0.6066546",
"0.6007085",
"0.5998578",
"0.5989109",
"0.5887555",
"0.587811",
"0.58647937",
"0.57877517",
"0.5772594",
"0.57453614",
"0.5663663",
"0.5617136",
"0.55940014",
"0.55539906",
"0.54727566",
"0.541773",
"0.53922576",
"0.5383754... | 0.68271935 | 0 |
Verifies that element's name identified with locator is equal 'expected'. Key attributes for arbitrary elements are `id` and `name`. See `introduction` for details about locating elements. | def aisappium_element_name_should_be(self, locator, expected, oAppiumInfo=None):
if oAppiumInfo is not None:
element = self._element_find_atlas(locator, True, True, oAppiumInfo.driver)
else:
element = self._element_find(locator, True, True)
if expected != element.get_attr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assert_true_element_by_name(self):\n self.assertTrue(self.is_element_present(By.NAME, self.locator))",
"def test_is_an_element_name():\n for el in roentgen.elements['name']:\n assert(is_an_element(el))",
"def assert_equal_find_element_by_css_selector_attr_text(self):\n self.assertEq... | [
"0.7359056",
"0.6762324",
"0.60369396",
"0.5999753",
"0.59545654",
"0.565154",
"0.56473446",
"0.56425357",
"0.56333536",
"0.5630478",
"0.5625946",
"0.5557263",
"0.55410373",
"0.55222356",
"0.5500503",
"0.5445403",
"0.54440606",
"0.5409522",
"0.53976715",
"0.5382696",
"0.53806... | 0.7756563 | 0 |
Verifies that element's value identified with locator is equal 'expected'. Key attributes for arbitrary elements are `id` and `name`. See `introduction` for details about locating elements. | def aisappium_element_value_should_be(self, locator, expected, oAppiumInfo=None):
if oAppiumInfo is not None:
element = self._element_find_atlas(locator, True, True, oAppiumInfo.driver)
else:
element = self._element_find(locator, True, True)
if expected != element.get_att... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assert_equal_find_element_by_css_selector_attr_text(self):\n self.assertEqual(self.locator[0],\n self.driver.find_element_by_css_selector(\n self.locator[1]).get_attribute(self.locator[2]))",
"def verify_value(driver, locator, value, module, test, pa... | [
"0.6755333",
"0.64595973",
"0.64390033",
"0.6227078",
"0.6140919",
"0.6100266",
"0.6070944",
"0.5988728",
"0.5979792",
"0.5908615",
"0.5869544",
"0.5841395",
"0.57603246",
"0.57437897",
"0.5719058",
"0.5705366",
"0.5638438",
"0.5589582",
"0.55772203",
"0.5566957",
"0.5544057"... | 0.7265637 | 0 |
Verify that an attribute of an element matches the expected criteria. The element is identified by _locator_. See `introduction` for details about locating elements. If more than one element matches, the first element is selected. The _attr_name_ is the name of the attribute within the selected element. The _match_patt... | def aisappium_element_attribute_should_match(self, locator, attr_name, match_pattern, regexp=False,
oAppiumInfo=None):
if oAppiumInfo is not None:
elements = self._element_find_atlas(locator, False, True, oAppiumInfo.driver)
else:
ele... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_attribute(self):\n xp = XPathQuery(\"/foo[@attrib1]\")\n self.assertEqual(xp.matches(self.e), True)",
"def test_attributeWithValue(self):\n xp = XPathQuery(\"/foo[@attrib1='value1']\")\n self.assertEqual(xp.matches(self.e), 1)",
"def has_element(self, attrib_key, attrib_val... | [
"0.6057533",
"0.5604119",
"0.5601969",
"0.54801065",
"0.544838",
"0.54421836",
"0.540534",
"0.5361275",
"0.5326216",
"0.525746",
"0.5247057",
"0.5226185",
"0.51961404",
"0.50717026",
"0.5016522",
"0.4971332",
"0.4966717",
"0.49417576",
"0.4921396",
"0.49141058",
"0.48743615",... | 0.7767435 | 0 |
Sets the network connection Status. Android only. | def aisappium_set_network_connection_status(self, connectionStatus, oAppiumInfo=None):
if oAppiumInfo is not None:
driver = oAppiumInfo.driver
else:
driver = self._current_application()
return driver.set_network_connection(int(connectionStatus)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def change_status():\n if self.on:\n connect.SOCKET.sendall(bytes(\"OFF\\n\", \"utf-8\"))\n self.on = False\n else:\n connect.SOCKET.sendall(bytes(\"ON\\n\", \"utf-8\"))\n self.on = True",
"def SetConnectionStatus(self, state, info):\n self.connect... | [
"0.6762321",
"0.6707563",
"0.6549716",
"0.6297312",
"0.6239823",
"0.62142426",
"0.60997283",
"0.5929492",
"0.5929492",
"0.5929492",
"0.59281015",
"0.5899058",
"0.5855906",
"0.58518493",
"0.5836226",
"0.5801515",
"0.5731722",
"0.5730484",
"0.57180864",
"0.56975853",
"0.5677831... | 0.7377089 | 0 |
Return elements that match the search criteria The element is identified by _locator_. See `introduction` for details about locating elements. If the _first_element_ is set to 'True' then only the first matching element is returned. If the _fail_on_error_ is set to 'True' this keyword fails if the search return nothing... | def aisappium_get_elements(self, locator, first_element_only=False, fail_on_error=True, oAppiumInfo=None):
if oAppiumInfo is not None:
element = self._element_find_atlas(locator, first_element_only, fail_on_error, oAppiumInfo.driver)
else:
element = self._element_find(locator, fi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find(self, selector=\"*\", containing=None, clean=False, first=False,\n _encoding=None):\n\n # Convert a single containing into a list.\n if isinstance(containing, str):\n containing = [containing]\n if not isinstance(selector, str):\n raise TypeError(\"Ex... | [
"0.6258854",
"0.6246094",
"0.5891519",
"0.58794206",
"0.5748197",
"0.56835234",
"0.5626673",
"0.55710834",
"0.5544823",
"0.5541678",
"0.5529285",
"0.5511625",
"0.5486597",
"0.5482396",
"0.5468115",
"0.54622185",
"0.54425055",
"0.5405061",
"0.5363894",
"0.5330292",
"0.5313725"... | 0.662032 | 0 |
Integration test for crowdsource scenario. Alice is evaluator, others are trainers. | def test_crowdsource():
alice = CrowdsourceClient(
"Alice", alice_data, alice_targets, XORModel, F.mse_loss, 0, deploy=True)
bob = CrowdsourceClient(
"Bob", bob_data, bob_targets, XORModel, F.mse_loss, 1,
contract_address=alice.contract_address)
charlie = CrowdsourceClient(
"... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_integration1(self):\n self._test_integration(1)",
"def test_get_scenarios(self):\n pass",
"def test_get_scenario(self):\n pass",
"def test_create_scenario1(self):\n pass",
"def test_integration3(self):\n self._test_integration(3)",
"def test_cases():\n Cases... | [
"0.61749154",
"0.58339995",
"0.58300877",
"0.57939094",
"0.5758004",
"0.5741501",
"0.569589",
"0.5691282",
"0.56248826",
"0.56186783",
"0.55778545",
"0.5574797",
"0.55571",
"0.5537148",
"0.5529656",
"0.5519395",
"0.5519279",
"0.5517526",
"0.5515743",
"0.5509292",
"0.54952955"... | 0.6831406 | 0 |
r""" Perform an iterative procedure to find the optimal weights for K direct spectral estimators of DPSS tapered signals. | def _adaptive_weights(yk, eigvals, sides='onesided', max_iter=150):
from multitaper_spectral import mtm_cross_spectrum
K = len(eigvals)
if sides not in [ 'one_sided', 'two_sided' ]:
warnings.warn('Warning: strange input: sides', UserWarning)
if max_iter <= 0:
warnings.warn('Warning: strange input: iterations', ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate_weights():\n weights = {}\n\n\n # estimate run time of step 1 (fast sweep)\n f_range = sweeper_script.settings['stop'] - sweeper_script.settings['start']\n N_samples = sweeper_script.settings['samplecount']\n df = f_range / N_samples\n\n ... | [
"0.649906",
"0.6344058",
"0.6340718",
"0.6255578",
"0.62282306",
"0.62278086",
"0.61570895",
"0.610795",
"0.61020076",
"0.60339296",
"0.6010726",
"0.60035574",
"0.59758174",
"0.59527",
"0.5924075",
"0.59101695",
"0.5897155",
"0.5866766",
"0.586247",
"0.58438164",
"0.5808632",... | 0.6735738 | 0 |
Perform an inverse iteration to find the eigenvector corresponding to the given eigenvalue in a symmetric tridiagonal system. | def _tridi_inverse_iteration(d, e, w, x0=None, rtol=1e-6):
eig_diag = d - w
if x0 is None:
x0 = np.random.randn(len(d))
x_prev = np.zeros_like(x0)
norm_x = np.linalg.norm(x0)
# the eigenvector is unique up to sign change, so iterate
# until || |x^(n)| - |x^(n-1)| ||^2 < rtol
x0 /= norm_x
while np.linalg.norm(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def eigen_vector_i(self, i):\n return self._eig_vec[:,i]",
"def tridi_inverse_iteration(d, e, w, x0=None, rtol=1e-8):\r\n eig_diag = d - w\r\n if x0 is None:\r\n x0 = np.random.randn(len(d))\r\n x_prev = np.zeros_like(x0)\r\n norm_x = np.linalg.norm(x0)\r\n # the eigenvector is uniqu... | [
"0.67798924",
"0.6552502",
"0.6531488",
"0.6446713",
"0.6446481",
"0.6435577",
"0.6334942",
"0.633258",
"0.62987125",
"0.62801445",
"0.62752336",
"0.62600726",
"0.6252588",
"0.62425536",
"0.6231015",
"0.62025726",
"0.62013495",
"0.61938316",
"0.6188946",
"0.615885",
"0.614711... | 0.6665403 | 1 |
place the initial supply of the resource at the start of the game into the capacity_list | def initialize_supply(self):
unit_count = 0
for i in range(self.start_allocation[0 ] -1, self.start_allocation[1]):
for j in range(len(self.capacity_list[i][1])):
self.capacity_list[i][1][j] = 1
unit_count += 1
self.total_supply -= unit_count | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, capacity, initial):\n\t\tself.capacity = capacity\n\t\tself.amount = initial",
"def __init__(self, capacity, fillValue = None):\n \n self._items = list() \n self._fillValue = fillValue\n self._DEFAULT_CAPACITY = capacity\n self._logicalSize = 0 #as required b... | [
"0.6896693",
"0.64290607",
"0.64275193",
"0.63781327",
"0.62530994",
"0.6205055",
"0.6196022",
"0.6167869",
"0.61573017",
"0.6094401",
"0.607095",
"0.6011403",
"0.59734416",
"0.593883",
"0.591504",
"0.58808136",
"0.586092",
"0.5837047",
"0.581497",
"0.581497",
"0.5810729",
... | 0.77604085 | 0 |
checks the purchase and reduces the supply on the board returns tuple of number of units and total cost | def buy_resource(self, num_res):
check_pur = self.poss_purchases()
if num_res in check_pur.keys():
update_res = num_res
for bin in self.capacity_list:
for i, res in enumerate(bin[1]):
if res == 1 and update_res > 0:
bin[... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_total_supply() -> int:\n return total_supply",
"def test_check_cost():",
"def get_expected_cost(self):",
"def cost(inventory):\n return inventory.reduce(convert.get_cost)",
"def test_product_buy(self):\n result_buy = self.info_list.product_buy(\"соль 1 кг\", 5)\n self.assertEqua... | [
"0.6272567",
"0.61072993",
"0.6053516",
"0.60232884",
"0.5960245",
"0.59333795",
"0.5925038",
"0.5916389",
"0.586347",
"0.58519727",
"0.58213115",
"0.5808379",
"0.57883084",
"0.5784606",
"0.57784134",
"0.5758463",
"0.5739185",
"0.5714941",
"0.5692327",
"0.5655765",
"0.5642398... | 0.62564915 | 1 |
print list of resource currently on the board | def show_board(self):
print(self.capacity_list) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def printBoard(self):",
"def api_print_board(self):\n print(self.board)",
"def show_board(self):\n\n for s in self.board[1:-1]:\n print(''.join(x.symbol for x in s[1:-1]))",
"def _print_board(board):\r\n pass",
"def print_board(self):\n print(f'{self.name} BOARD:\\n')... | [
"0.68844163",
"0.68560594",
"0.6730749",
"0.6727542",
"0.67088443",
"0.66923815",
"0.66582954",
"0.665567",
"0.66136783",
"0.6547921",
"0.6542215",
"0.6513973",
"0.6429851",
"0.6402211",
"0.63863915",
"0.635641",
"0.63459575",
"0.634288",
"0.6329027",
"0.6325588",
"0.63046014... | 0.7192558 | 0 |
Returns PIL.Image objects for all the images in directory. If directory is not specified, uses current directory. Returns a 2tuple containing a list with a PIL.Image object for each image file in root_directory, and a list with a string filename for each image file in root_directory | def get_images(directory=None):
if directory == None:
directory = os.getcwd() # Use working directory if unspecified
image_list = [] # Initialize aggregaotrs
file_list = []
directory_list = os.listdir(directory) # Get list of files
for entry in directory_list:
abso... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_images(directory=None): #import from mask.py\n \n if directory == None:\n directory = os.getcwd() # Use working directory if unspecified\n \n image_list = [] # Initialize aggregaotrs\n file_list = []\n \n directory_list = os.listdir(directory) # Get list of files\n for en... | [
"0.8136434",
"0.80238104",
"0.76039886",
"0.745085",
"0.74299073",
"0.73820263",
"0.72008425",
"0.7091337",
"0.7078133",
"0.6998026",
"0.6991185",
"0.6929813",
"0.6901793",
"0.68704295",
"0.6862504",
"0.6842621",
"0.67554075",
"0.67550236",
"0.674418",
"0.67396843",
"0.669551... | 0.81507176 | 0 |
Assumes model was saved on GPU. Will load based off of cur_dev. | def load(self, path, cur_dev):
if cur_dev == 'cpu':
self.load_state_dict(torch.load(path, map_location=torch.device('cpu')))
else:
self.load_state_dict(torch.load(path))
self.to(torch.device("cuda")) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load(self):\n try:\n if self.model.is_cuda:\n self.model.load_state_dict(torch.load(os.path.join(self.save_path, \"save_point.pth\")))\n else:\n self.model.load_state_dict(torch.load(os.path.join(self.save_path, \\\n \"save_point... | [
"0.6873723",
"0.6652313",
"0.66168183",
"0.6520783",
"0.64138526",
"0.6399735",
"0.6352811",
"0.6347352",
"0.63034415",
"0.62348884",
"0.6229719",
"0.62251854",
"0.62218446",
"0.6182424",
"0.6153874",
"0.6088584",
"0.6076757",
"0.6065099",
"0.6064757",
"0.60603446",
"0.605686... | 0.7106072 | 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 one `Status` is less than another one. | def __lt__(self: "Status", other: "Status") -> bool:
self_type = type(self)
other_type = type(other)
both_not_in_progress = not self.in_progress and not other.in_progress
if both_not_in_progress and self_type is other_type:
return False
elif self_type is Failed:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __lt__(self, other):\n status = self.get_status()\n Ostatus = other.get_status()\n \n if status == Ostatus:\n return self.get_nickname() < other.get_nickname()\n \n if status == \"online\":\n return True\n elif status == \"away\" and Ostatu... | [
"0.6996155",
"0.67470247",
"0.6650936",
"0.6650936",
"0.6650936",
"0.66351974",
"0.66143465",
"0.6600206",
"0.6576387",
"0.6576387",
"0.65719974",
"0.6560425",
"0.6551801",
"0.6539531",
"0.6516321",
"0.6516321",
"0.6514021",
"0.65093094",
"0.6497051",
"0.6491132",
"0.6490221"... | 0.748035 | 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 `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 |
Creates a new `InProgress` status. If the given `progress` is not `0 100 progress. | def __init__(self: "InProgress", progress: int = 0) -> None:
self.progress = max(0, min(progress, 100)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def progress(self, progress: float):\n if progress is None:\n raise ValueError(\"Invalid value for `progress`, must not be `None`\") # noqa: E501\n \n self._progress = progress",
"def push_progress(self, status, object_id, progress):\n pass",
"def update_progress(self, p... | [
"0.63577783",
"0.6356068",
"0.6276104",
"0.625529",
"0.6140855",
"0.5771439",
"0.5700525",
"0.5700525",
"0.5654446",
"0.56454754",
"0.5644193",
"0.56381303",
"0.56319237",
"0.5591338",
"0.55786866",
"0.555182",
"0.5487537",
"0.54759014",
"0.5439351",
"0.54385674",
"0.5426031"... | 0.7329669 | 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 |
Disconnect the Google account of the current loggedin user. | def gdisconnect():
# Only disconnect the connected user.
access_token = login_session.get('access_token')
if access_token is None:
response = make_response(
json.dumps('Current user not connected.'), 401)
response.headers['Content-Type'] = 'application/json'
return respo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gdisconnect():\r\n # only disconnect a connected user\r\n credentials = login_session.get('credentials')\r\n if credentials is None:\r\n response = make_response(json.dumps(\r\n 'Current user not connected.'), 401)\r\n response.headers['Content-Type'] = 'application/json'\... | [
"0.7913717",
"0.7829547",
"0.7714489",
"0.7667014",
"0.76639616",
"0.76466906",
"0.75815266",
"0.7579596",
"0.75685894",
"0.74723876",
"0.7466163",
"0.7343223",
"0.72729737",
"0.7220345",
"0.6879733",
"0.65540224",
"0.65148944",
"0.6474869",
"0.64209366",
"0.628367",
"0.61803... | 0.7893552 | 1 |
Shortcut to get the flash scope from the view context. | def _flash(self):
return self.response.context[CONTEXT_VAR] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_current():\n return getattr(_request_store, 'context', None)",
"def get_scope(self, ):\n return self.attrs.get(self.AttributeNames.SCOPE, None)",
"def scope(self):\n return self._scope",
"def scope(self):\n return self._scope",
"def get_scope_read(self, view: str) -> str:\n ... | [
"0.5630328",
"0.55336535",
"0.54515636",
"0.54515636",
"0.535993",
"0.5351943",
"0.53239036",
"0.5320285",
"0.5200118",
"0.5198629",
"0.5180058",
"0.5162203",
"0.5162203",
"0.5159747",
"0.51287633",
"0.509993",
"0.509993",
"0.50981593",
"0.509058",
"0.50878936",
"0.50770384",... | 0.70502704 | 0 |
Flash scope shouldn't be stored in the session if there's no flash. | def test_session_state_for_unused_flash(self):
self.response = self.client.get(reverse(views.render_template))
self.assertFalse(_SESSION_KEY in self.client.session) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_session_state_for_used_flash(self):\n self.response = self.client.get(reverse(views.set_flash_var))\n self.response = self.client.get(reverse(views.render_template))\n self.assertTrue(_SESSION_KEY in self.client.session)\n\n # Flash scope should be removed from the session\n ... | [
"0.71783197",
"0.6143732",
"0.6092475",
"0.6072942",
"0.5673149",
"0.5556315",
"0.5392896",
"0.5371768",
"0.5344594",
"0.5288238",
"0.5274396",
"0.52371675",
"0.5140583",
"0.5140583",
"0.51296693",
"0.5043332",
"0.500041",
"0.49937376",
"0.49333295",
"0.4916233",
"0.4902425",... | 0.6303686 | 1 |
Flash scope should be removed from the session if there's no flash. | def test_session_state_for_used_flash(self):
self.response = self.client.get(reverse(views.set_flash_var))
self.response = self.client.get(reverse(views.render_template))
self.assertTrue(_SESSION_KEY in self.client.session)
# Flash scope should be removed from the session
self.r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_keep_lifecycle(self):\n self.response = self.client.get(reverse(views.set_flash_var))\n self.assertEqual('Message', self._flash()['message'])\n\n self.response = self.client.get(reverse(views.keep_var))\n self.assertEqual('Message', self._flash()['message'])\n\n # Flash ... | [
"0.60079455",
"0.59813166",
"0.5645087",
"0.5635631",
"0.55518097",
"0.5528965",
"0.5521264",
"0.548529",
"0.5476425",
"0.5468991",
"0.5454142",
"0.5405645",
"0.5397564",
"0.5381994",
"0.53716916",
"0.5347582",
"0.5346075",
"0.5346033",
"0.5322238",
"0.53199506",
"0.5278886",... | 0.6868987 | 0 |
Lowlevel processing of prosodic strings. | def _process_prosody(sonority):
assert 9 not in sonority[1:-1]
assert sonority[0] == sonority[-1] == 9
# create the output values
psequence = []
first = True # stores whether first syllable is currently being processed
for i in range(1, len(sonority) - 1):
# get a segment with context... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def preprocess(string):\r\n # string = [strQ2B(ch) for ch in string.strip()]\r\n # return ''.join(string)\r\n return string",
"def test_process_string():\n decode = StringProcessor()\n assert decode.process_string(\"ab\") == \"\"\n decode.output = \"\"\n\n assert decode.process_string(\"ab*\... | [
"0.63097847",
"0.6143286",
"0.5945406",
"0.58660376",
"0.5793575",
"0.5683354",
"0.5629431",
"0.5610261",
"0.5553382",
"0.5538807",
"0.5524956",
"0.55078727",
"0.54349685",
"0.54175425",
"0.5411978",
"0.5410777",
"0.5368676",
"0.5366849",
"0.536479",
"0.53452194",
"0.53289926... | 0.62622064 | 1 |
Convert a sequence in supposed IPA to the B(road)IPA of CLTS. Notes The mapping is not guaranteed to work as well as the more elaborate mapping with `pyclts`. | def bipa(sequence):
return [_token2clts(segment)[0] for segment in sequence] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def translate_sequence(rna_sequence, genetic_code):\n #Crate an empty list to store AA sequence:\n AA_list = []\n # Convert all rna_sequence to upper case:\n rna_sequence=rna_sequence.upper()\n # Convert all rna_sequence into a list:\n rna_list = list(rna_sequence)\n # This conditon will run i... | [
"0.5927967",
"0.59073716",
"0.57882273",
"0.5535857",
"0.54425794",
"0.5429711",
"0.5424817",
"0.5406879",
"0.5380455",
"0.53228873",
"0.5287982",
"0.5282211",
"0.52763784",
"0.52703464",
"0.5240813",
"0.5222085",
"0.5175288",
"0.5172747",
"0.5154597",
"0.5141814",
"0.5124684... | 0.75388896 | 0 |
Initializes standings object based on your league ID number and year Required arguments leagueId ID of ESPN league, get from standings page url seasonId Year | def __init__(self, leagueId, seasonId):
self.league_id = leagueId
self.season_id = seasonId
self.league_data = {'leagueId': self.league_id,
'seasonId': self.season_id,
'view': 'official'}
self.soup = self.make_soup(LeagueStandings.b... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, league):\n # Set basic attributes\n self.league = league\n league.season = self\n league.history.seasons.append(self)\n self.year = league.cosmos.year\n # Record name, league offices, and commissioner, since this could change later (i.e.,\n # we c... | [
"0.65982366",
"0.65470594",
"0.6177968",
"0.60476357",
"0.58978647",
"0.5896803",
"0.58631915",
"0.5856052",
"0.5768446",
"0.57641816",
"0.5709512",
"0.565424",
"0.5648739",
"0.5625175",
"0.5538045",
"0.5525612",
"0.5517583",
"0.5513361",
"0.54954636",
"0.54488313",
"0.542942... | 0.74785626 | 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.