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 |
|---|---|---|---|---|---|---|
Lazily register aggregate root entities as they are yielded by the iterable. | def _register_iter(self, iterable):
for aggregate_root_entity in iterable:
self._track(aggregate_root_entity)
self._intern(aggregate_root_entity)
yield aggregate_root_entity | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _register(self, aggregate_root_entity):\n if not isinstance(aggregate_root_entity, self._aggregate_root_entity_class()):\n raise TypeError(\"{!r} is not of type {} therefore cannot be store in a {}\"\n .format(aggregate_root_entity, self._aggregate_root_entity_class... | [
"0.63130754",
"0.60614014",
"0.59806603",
"0.5934126",
"0.5915763",
"0.5909096",
"0.5894328",
"0.5859315",
"0.58264387",
"0.5809056",
"0.5741137",
"0.5738972",
"0.57183206",
"0.56957173",
"0.56778264",
"0.561123",
"0.56023943",
"0.5597782",
"0.55625147",
"0.55021703",
"0.5498... | 0.8712843 | 0 |
Save all pending changes from tracked aggregates into the persistent eventstore. | def save_changes(self):
change_events = self._transient_event_queue.separate_out(self.is_from_tracked_aggregate)
for event in change_events:
self._persistent_event_store.append(event) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def saveAll(self, event=None):\n self.s.end()",
"def flush(self):\n self.save()\n for obs in self.observation_set.all():\n obs.flush();",
"def save(self, event_stream: List[DomainEvent], aggregate_root_id: str):\n\n \"\"\" overwriting the event stream is not ok \"\"\"... | [
"0.6874553",
"0.63277054",
"0.6269933",
"0.61518925",
"0.61511207",
"0.6101591",
"0.6036419",
"0.5988059",
"0.5949367",
"0.5917159",
"0.58930194",
"0.5871131",
"0.58382297",
"0.5813014",
"0.58026534",
"0.57893187",
"0.5785584",
"0.574921",
"0.5748524",
"0.57327044",
"0.572578... | 0.8218231 | 0 |
Obtain an aggregate by aggregate root entity ID. | def _aggregate_with_id(self, entity_id):
try:
entity = self._instance(entity_id)
except ValueError:
entity = self._load_aggregate_with_id(entity_id)
self._register(entity)
return entity | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def aggregate(self, agpath):\n return data.Aggregate(self, agpath)",
"def load(self, aggregate_root_id: str):\n raise NotImplementedError('Every repository must have an load method.')",
"def _get_full_aggregate(self,\n instance: models.Model,\n ... | [
"0.64862907",
"0.602317",
"0.55756664",
"0.5573993",
"0.5437499",
"0.5332272",
"0.5325919",
"0.5284718",
"0.52684903",
"0.52564347",
"0.521178",
"0.52116036",
"0.52116036",
"0.52116036",
"0.5122449",
"0.50652647",
"0.5036824",
"0.50247365",
"0.49847212",
"0.49812022",
"0.4975... | 0.7186072 | 0 |
A set of IDs for aggregates managed by this repository which have not been discarded. | def _extant_aggregate_ids(self):
events = chain(
self._persistent_event_store,
filter(self.is_from_tracked_aggregate, self._transient_event_queue))
return extant_persisted_aggregate_ids(events, self._aggregate_root_entity_class) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _persisted_aggregates(self, aggregate_ids=None):\n aggregate_ids = set(aggregate_ids) if aggregate_ids is not None else self._extant_aggregate_ids()\n persisted_entity_ids = aggregate_ids.difference(self._instantiated_ids())\n return self._load_aggregates_with_ids(persisted_entity_ids)",
... | [
"0.626336",
"0.6241536",
"0.6196094",
"0.617768",
"0.6158783",
"0.61520046",
"0.6139966",
"0.61024576",
"0.60693914",
"0.6003579",
"0.5943484",
"0.5917557",
"0.5890295",
"0.5887773",
"0.58694875",
"0.5868544",
"0.58400965",
"0.58400965",
"0.5835411",
"0.5756231",
"0.5730896",... | 0.6847186 | 0 |
Decorator that added idempotency key processing logic to a view. | def require_idempotency_key(view_func):
@wraps(view_func)
def wrapped_view(*args, **kwargs):
# args can contain either (HttpRequest,) or (ViewSet, HttpRequest).
view_set, request = args if len(args) > 1 else (None, *args)
# If a method in SAFE_METHODS just return a response.
if... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def api_key_required(func):\n\t@wraps(func)\n\tdef decorated_view(*args, **kwargs):\n\t\treturn func(*args,**kwargs)\n\treturn decorated_view",
"def manipulative(function):\n @functools.wraps(function)\n def marked(self, *args, **kwargs):\n self.session.mark_manipulative([self.key] if hasattr(self, ... | [
"0.65538377",
"0.60099995",
"0.5886012",
"0.55957586",
"0.5564601",
"0.55555874",
"0.55474406",
"0.5454455",
"0.54204446",
"0.5417398",
"0.5344656",
"0.534291",
"0.5315597",
"0.5308435",
"0.52835524",
"0.5283243",
"0.5276676",
"0.5223224",
"0.51900303",
"0.51898897",
"0.51864... | 0.7475548 | 0 |
Constructs data regarding labels to be fed to the model. The resultant model data can possibly contain one or both of the keys [`label_action_name`, `label_action_text`] but will definitely contain the `label` key. `label_action_` will contain the sequence, sentence and mask features for corresponding labels and `label... | def _assemble_label_data(
self, attribute_data: Data, domain: Domain
) -> RasaModelData:
label_data = RasaModelData()
label_data.add_data(attribute_data, key_prefix=f"{LABEL_KEY}_")
label_data.add_lengths(
f"{LABEL}_{ACTION_TEXT}",
SEQUENCE_LENGTH,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _create_label_data(\n self,\n training_data: \"TrainingData\",\n label_id_dict: Dict[Text, int],\n attribute: Text,\n ) -> \"SessionDataType\":\n\n # Collect one example for each label\n labels_idx_example = []\n for label_name, idx in label_id_dict.items():\... | [
"0.63809144",
"0.6255888",
"0.6199803",
"0.6131158",
"0.6065041",
"0.6064807",
"0.60307",
"0.6029416",
"0.602556",
"0.60010827",
"0.5991813",
"0.59754205",
"0.59728646",
"0.5949336",
"0.5948533",
"0.5946974",
"0.59452814",
"0.5914314",
"0.58943677",
"0.5868118",
"0.58675945",... | 0.67797244 | 0 |
Filters out the list of trackers which should not be used for training. | def _get_trackers_for_training(
trackers: List[TrackerWithCachedStates],
) -> List[TrackerWithCachedStates]:
# By default, we train on all available trackers.
return trackers | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filterduplicates(client, repeatfactor, tracks): # {{{1\n trackstofilter = client.playlist()\n if len(trackstofilter) < repeatfactor:\n repeatfactor = len(trackstofilter)\n trackstofilter = trackstofilter[-repeatfactor : -1]\n return [t for t in tracks if not t[1]['file'] in trackstofilter]",
"de... | [
"0.582376",
"0.5782622",
"0.5729195",
"0.5623313",
"0.56115806",
"0.5579064",
"0.5547851",
"0.54678303",
"0.5451969",
"0.54394054",
"0.54235125",
"0.5365223",
"0.5362807",
"0.53606004",
"0.5312667",
"0.52957827",
"0.52803254",
"0.527003",
"0.5226352",
"0.5221089",
"0.5210202"... | 0.66072863 | 0 |
Persists model's utility attributes like model weights, etc. | def persist_model_utilities(self, model_path: Path) -> None:
model_filename = self._metadata_filename()
rasa.utils.io.json_pickle(
model_path / f"{model_filename}.priority.pkl", self.priority
)
rasa.utils.io.pickle_dump(
model_path / f"{model_filename}.meta.pkl", ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _save(self):\n for attrib in self.attribs:\n setattr(self, attrib, getattr(self.obj, attrib))",
"def save_model(self):\n pass",
"def save_model(self):\r\n jeff = self.name + '_words'\r\n f = open(jeff, 'w')\r\n f.write(str(self.words))\r\n f.close()\r\n ... | [
"0.6227181",
"0.60620934",
"0.60294247",
"0.60267735",
"0.59857696",
"0.5937814",
"0.59068686",
"0.58973426",
"0.5887841",
"0.58811957",
"0.5874724",
"0.58660245",
"0.5830758",
"0.58219177",
"0.57765204",
"0.5774643",
"0.57661456",
"0.570737",
"0.57017636",
"0.5693476",
"0.56... | 0.646969 | 0 |
Prepares feature processing layers for sentence/sequencelevel features. Distinguishes between label features and other features, not applying input dropout to the label ones. | def _prepare_input_layers(
self,
attribute_name: Text,
attribute_signature: Dict[Text, List[FeatureSignature]],
is_label_attribute: bool = False,
) -> None:
# Disable input dropout in the config to be used if this is a label attribute.
if is_label_attribute:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _preprocess(self, features, labels):\n with tf.variable_scope('preprocess'):\n with tf.variable_scope('image'):\n features['image_orig'] = features['image']\n image = tf.image.convert_image_dtype(features['image_orig'],\n dtype=tf.float32)\n ... | [
"0.69295466",
"0.6483784",
"0.63460076",
"0.6109631",
"0.60992074",
"0.60830235",
"0.6049522",
"0.60157263",
"0.59498656",
"0.5916046",
"0.58773404",
"0.5860252",
"0.58540595",
"0.57909906",
"0.5782207",
"0.5763886",
"0.5735246",
"0.57137746",
"0.5677478",
"0.5673067",
"0.564... | 0.65997046 | 1 |
Create Ffnn encoding layer used just before combining all dialogue features. | def _prepare_encoding_layers(self, name: Text) -> None:
# create encoding layers only for the features which should be encoded;
if name not in SENTENCE_FEATURES_TO_ENCODE + LABEL_FEATURES_TO_ENCODE:
return
# check that there are SENTENCE features for the attribute name in data
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ResNet18_FPN():\n return FPN(BasicBlock, [2, 2, 2, 2])",
"def stack_fc_layers(self, embedding):\n for hid_layer_index, hid_width in enumerate(self.hps.hid_widths, start=1):\n hid_layer_id = \"fc{}\".format(hid_layer_index)\n # Add hidden layer\n embedding = snt.Line... | [
"0.59051806",
"0.5812008",
"0.5646092",
"0.55884403",
"0.5407039",
"0.5347434",
"0.5329573",
"0.5308371",
"0.52979565",
"0.5262869",
"0.5208671",
"0.5203288",
"0.518843",
"0.5165848",
"0.5163469",
"0.51527315",
"0.5120998",
"0.51082456",
"0.5084984",
"0.50726366",
"0.50719935... | 0.60444176 | 0 |
Returns dummy outputs for fake features of a given attribute. Needs to match the outputs of `_encode_real_features_per_attribute` in shape but these outputs will be filled with zeros. | def _encode_fake_features_per_attribute(
self, tf_batch_data: Dict[Text, Dict[Text, List[tf.Tensor]]], attribute: Text
) -> Tuple[tf.Tensor, tf.Tensor, tf.Tensor]:
# we need to create real zero tensors with appropriate batch and dialogue dim
# because they are passed to dialogue transformer
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _encode_real_features_per_attribute(\n self, tf_batch_data: Dict[Text, Dict[Text, List[tf.Tensor]]], attribute: Text\n ) -> Tuple[tf.Tensor, tf.Tensor, tf.Tensor]:\n # simulate None with empty tensor of zeros\n text_output = tf.zeros((0,))\n text_sequence_lengths = tf.zeros((0,))... | [
"0.587372",
"0.5797445",
"0.576873",
"0.5565397",
"0.5370014",
"0.53538173",
"0.5337671",
"0.5238035",
"0.52018607",
"0.52018607",
"0.5196231",
"0.51418465",
"0.5113956",
"0.5092495",
"0.50854206",
"0.50819504",
"0.5080352",
"0.50598264",
"0.50205827",
"0.50076437",
"0.499448... | 0.65818167 | 0 |
Transform attribute features back to original shape. | def _convert_to_original_shape(
attribute_features: tf.Tensor,
tf_batch_data: Dict[Text, Dict[Text, List[tf.Tensor]]],
attribute: Text,
) -> tf.Tensor:
# in order to convert the attribute features with shape
# (combined batch-size and dialogue length x 1 x units)
# to... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _scale_features(self, features):\n assert isinstance(features, np.ndarray), \"Input is not a numpy array!\"\n\n return self.scaler.transform(features.reshape(1, -1))",
"def transform(self, data, attr):\n data['point'] = torch.from_numpy(data['point'])\n data['feat'] = torch.from_n... | [
"0.6315303",
"0.6261348",
"0.61837447",
"0.6082442",
"0.6080309",
"0.5897296",
"0.5893695",
"0.5841158",
"0.5838216",
"0.58333164",
"0.5826695",
"0.58231807",
"0.57957655",
"0.5775941",
"0.57753253",
"0.57684076",
"0.5755802",
"0.5755802",
"0.5737896",
"0.57243645",
"0.572091... | 0.64016074 | 0 |
Encodes batch data. Combines intent and text and action name and action text if both are present. | def _process_batch_data(
self, tf_batch_data: Dict[Text, Dict[Text, List[tf.Tensor]]]
) -> Tuple[tf.Tensor, Optional[tf.Tensor], Optional[tf.Tensor]]:
# encode each attribute present in tf_batch_data
text_output = None
text_sequence_lengths = None
batch_encoded = {}
f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encode(batch, tokenizer):\n return tokenizer.batch_encode_plus(batch['sentence'], padding='max_length')",
"def __call__(\n self, data_batch: Dict[str, List[str]]\n ) -> Tuple[\n BatchEncoding,\n List[Dict[str, Union[int, str]]],\n List[SquadExample],\n List[SquadFeatu... | [
"0.5812564",
"0.57255256",
"0.5528758",
"0.5521924",
"0.5521924",
"0.54412633",
"0.5408598",
"0.52338",
"0.5196475",
"0.51125795",
"0.50439006",
"0.5042097",
"0.5039555",
"0.5026467",
"0.49971974",
"0.4960177",
"0.49545312",
"0.49537224",
"0.4953697",
"0.4952628",
"0.49509415... | 0.6363296 | 0 |
Test that the DAG can be loaded from a DAG bag. | def test_dag_load(self):
with ObservatoryEnvironment().create():
dag_file = os.path.join(module_file_path("academic_observatory_workflows.dags"), "unpaywall_telescope.py")
self.assert_dag_load("unpaywall", dag_file) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_dag_load(self):\n\n with ObservatoryEnvironment().create():\n dag_file = os.path.join(module_file_path(\"academic_observatory_workflows.dags\"), \"openalex_telescope.py\")\n self.assert_dag_load(\"openalex\", dag_file)",
"def test_dag_loads(self):\n self.assertEqual(F... | [
"0.7385436",
"0.71135604",
"0.7110756",
"0.6724345",
"0.6162052",
"0.6110341",
"0.6085278",
"0.60069627",
"0.5982009",
"0.57431567",
"0.5735573",
"0.57125735",
"0.5702912",
"0.5669966",
"0.56557333",
"0.56340045",
"0.5584368",
"0.557622",
"0.5550951",
"0.553458",
"0.55253327"... | 0.7223948 | 1 |
Parameterize bounding boxes with respect to anchors. Namely, (y,x,h,w)>(ty,tx,th,tw). | def param_bbox(bboxes, anchors):
bboxes = np.array(bboxes, np.float32)
anchors = np.array(anchors, np.float32)
tyx = (bboxes[:, :2] - anchors[:, :2]) / anchors[:, 2:]
thw = np.log(bboxes[:, 2:] / anchors[:, 2:])
t = np.concatenate((tyx, thw), axis=1)
return t | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __call__(self, loc, scores, anchors, img_size):\n anchors = bbox.loc2bbox(anchor)",
"def xywh_xyxy(boxes):\n bbox = np.zeros(boxes.shape)\n bbox[:, 0] = boxes[:, 0] \n bbox[:, 1] = boxes[:, 1] \n bbox[:, 2] = boxes[:, 0] + 1 * boxes[:, 2]\n bbox[:, 3] = boxes[:, 1] + 1 * boxes[:, 3]\n ... | [
"0.7079935",
"0.6789713",
"0.65681434",
"0.6469251",
"0.6254045",
"0.62500405",
"0.6196701",
"0.61934334",
"0.6183325",
"0.61690676",
"0.61612844",
"0.613867",
"0.6136252",
"0.61226267",
"0.61135674",
"0.61123616",
"0.6107818",
"0.6079668",
"0.6065356",
"0.60578364",
"0.60495... | 0.69789153 | 1 |
Unparameterize bounding boxes with respect to anchors. Namely, (ty,tx,th,tw)>(y,x,h,w). | def unparam_bbox(t, anchors, max_shape=None):
t = np.array(t, np.float32)
anchors = np.array(anchors, np.float32)
yx = t[:, :2] * anchors[:, 2:] + anchors[:, :2]
hw = np.exp(t[:, 2:]) * anchors[:, 2:]
bboxes = np.concatenate((yx, hw), axis=1)
if max_shape != None:
bboxes = rectify_bbo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bbox_transform_inv(bbox):\n with tf.variable_scope('bbox_transform_inv') as scope:\n xmin = bbox[..., 0]\n ymin = bbox[..., 1]\n xmax = bbox[..., 2]\n ymax = bbox[..., 3]\n w = xmax - xmin + 1.0\n h = ymax - ymin + 1.0\n out_box = np.stack(\n [xmin + 0.5*w, ymin + 0.5*h, w, h],\n ... | [
"0.65151864",
"0.6448961",
"0.6441325",
"0.64217514",
"0.6378641",
"0.6352084",
"0.6197559",
"0.61599165",
"0.61406326",
"0.6111988",
"0.60997486",
"0.60890275",
"0.6063085",
"0.6047759",
"0.6045166",
"0.60417753",
"0.59831274",
"0.5976186",
"0.5973511",
"0.59560215",
"0.5952... | 0.7801747 | 0 |
Map bounding boxes in old image shape to their counterparts in new image shape. | def convert_bbox(bboxes, old_shape, new_shape):
bboxes = np.array(bboxes, np.float32)
if bboxes.shape[0] == 0:
return bboxes
oh, ow = old_shape
nh, nw = new_shape
bboxes[:, 0] = bboxes[:, 0] * nh / oh
bboxes[:, 1] = bboxes[:, 1] * nw / ow
bboxes[:, 2] = bboxes[:, 2] * nh / oh
b... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_bounding_box(old_shape, new_shape, row):\n # First index specifies rows of image, second index columns.\n # This means first index is y and second x\n scale_factor = new_shape[0] / old_shape[0]\n offset = (new_shape[1] - old_shape[1] * scale_factor)/2\n\n # May end up a little off-center\... | [
"0.7477527",
"0.68143463",
"0.6739359",
"0.6597438",
"0.6442463",
"0.64015967",
"0.6345242",
"0.62468106",
"0.6223599",
"0.6106933",
"0.6054487",
"0.60216993",
"0.60213155",
"0.593495",
"0.5909381",
"0.5888657",
"0.5888657",
"0.5861662",
"0.5829333",
"0.5829333",
"0.5824078",... | 0.7284216 | 1 |
Enlarge bounding boxes by the given factor (without changing their centers). | def expand_bbox(bboxes, max_shape, factor=1.5):
bboxes = np.array(bboxes, np.float32)
n = bboxes.shape[0]
if n == 0:
return bboxes
H = bboxes[:, 2] * factor
W = bboxes[:, 3] * factor
Y = bboxes[:, 0] - bboxes[:, 2] * (factor * 0.5 - 0.5)
X = bboxes[:, 1] - bboxes[:, 3] * (factor * 0... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resize_to_box(im, size):\n #mx = np.max(im.shape[:2])\n\n factors = [size[i]/im.shape[i] for i in range(2)]\n\n f = np.min(factors)\n if f < 1.0:\n return resize_with_factor_new(im, f)\n else:\n return im",
"def expand_boxes(boxes, scale):\n w_half = (boxes[:, 2] - box... | [
"0.6589286",
"0.6390398",
"0.63020176",
"0.627091",
"0.61904466",
"0.61847234",
"0.61352766",
"0.6132406",
"0.6007678",
"0.60033876",
"0.60017043",
"0.59644324",
"0.59606093",
"0.5915594",
"0.5887303",
"0.5867812",
"0.5867812",
"0.5864122",
"0.5853104",
"0.58528006",
"0.58093... | 0.66979355 | 0 |
Get the labels of the anchors. Each anchor can be labeled as positive (1), negative (0) or ambiguous (1). Truncated anchors are always labeled as ambiguous. | def label_anchors(anchors, anchor_is_untruncated, gt_classes, gt_bboxes, background_id, iou_low_threshold=0.41, iou_high_threshold=0.61):
n = anchors.shape[0]
k = gt_bboxes.shape[0]
# Compute the IoUs of the anchors and ground truth boxes
tiled_anchors = np.tile(np.expand_dims(anchors, 1), (1, k, 1... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def numpy_select_label_anchors_minmax(_ground_truths, \n _anchors, \n _positive_threshold = 0.7, \n _negative_threshold = 0.3,\n _n_targets= 128):\n \n # Prune a... | [
"0.6365366",
"0.6272056",
"0.6209516",
"0.6093799",
"0.60793006",
"0.6043222",
"0.59958136",
"0.5949583",
"0.5946504",
"0.58993435",
"0.5892367",
"0.58494216",
"0.57686114",
"0.5767941",
"0.576532",
"0.5765271",
"0.5716308",
"0.5708897",
"0.57004285",
"0.5694463",
"0.5694382"... | 0.6824482 | 0 |
Return a list of handles for visible windows with a given process name | def getMainWindowHandles(process_name, expect_one=False):
# find all processes with process_name
pids = []
for process in psutil.process_iter():
if process.name() == process_name:
pids.append(process.pid)
# find all window handles with process_name
whandles = []
def windowF... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_hwnds(pid):\n def callback(hwnd, hwnds):\n if win32gui.IsWindowVisible(hwnd) and win32gui.IsWindowEnabled(hwnd):\n _, found_pid = win32process.GetWindowThreadProcessId(hwnd)\n if found_pid == pid:\n hwnds.append(hwnd)\n return True\n hwnds = []\n ... | [
"0.7882355",
"0.74707407",
"0.68533087",
"0.68462783",
"0.6585412",
"0.65552914",
"0.6511142",
"0.6476083",
"0.64665645",
"0.64158076",
"0.6220887",
"0.62179965",
"0.6139772",
"0.61389536",
"0.6114521",
"0.59757996",
"0.59497213",
"0.59147716",
"0.5892488",
"0.5787817",
"0.55... | 0.74966705 | 1 |
Get a discord channel given channel id | async def get_channel(self, channel_id):
channel = await self.client.fetch_channel(channel_id)
return channel | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_channel(self, channel_id):\n uri = 'channels/' + channel_id\n return self.make_request(uri)",
"def get_channel(self, channel_id):\n try:\n return self[channel_id]\n except KeyError:\n raise ChannelNotFoundError(\"Channel {} not found\".format(channel_id))",
"de... | [
"0.8683317",
"0.82664853",
"0.8244116",
"0.77520853",
"0.7731785",
"0.7628041",
"0.7377388",
"0.7376629",
"0.731581",
"0.7271431",
"0.70557",
"0.7045037",
"0.68866545",
"0.68850803",
"0.68683636",
"0.6843198",
"0.6786997",
"0.6763132",
"0.6759558",
"0.6735168",
"0.6725157",
... | 0.86089706 | 1 |
Set discord channel topic | async def set_channel_topic(self, channel_topic, workspace_entity: WorkspaceEntity):
await self.client.login(os.environ['DISCORD_BOT_TOKEN'], bot=self.is_bot)
try:
channel = await self.get_channel(workspace_entity.generated_channel_id)
await channel.edit(topic=channel_topic)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def topic(self, channel, topic=None):\n if topic:\n channel += ' :' + topic\n self.send_line('TOPIC %s' % channel)",
"def topic(self, channel, new_topic=None):\n if new_topic is None:\n time.sleep(1)\n self.s.send(\"TOPIC %s\\n\" % channel)\n logge... | [
"0.78130007",
"0.7372703",
"0.70083445",
"0.6957028",
"0.6779081",
"0.6719136",
"0.6646406",
"0.6603524",
"0.6588784",
"0.6577933",
"0.65143585",
"0.6472604",
"0.64440817",
"0.6392307",
"0.6212289",
"0.6121125",
"0.6107234",
"0.60491633",
"0.6034453",
"0.6033108",
"0.6015926"... | 0.76062524 | 1 |
Default to getting project channel id associated to the discord invite. If workspace id does match invite guild id then we fetch guild channel and select project channel id that belongs to workspace | async def select_project_channel_id(self, workspace: WorkspaceEntity, **kwargs):
channel_id = ""
invite_code = kwargs["invite_url"].rsplit("/", 1)[1]
invite = self.http_client.get(
f'{self.api_endpoint}/invites/{invite_code}', self.headers)
# invite could be invalid
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def get_project_channel_name(self, workspace: WorkspaceEntity):\n await self.client.login(os.environ['DISCORD_BOT_TOKEN'], bot=self.is_bot)\n channel_name = \"\"\n try:\n channel = await self.get_channel(workspace.project_channel_id)\n except HTTPException as error:\n ... | [
"0.5926791",
"0.5877593",
"0.5625703",
"0.55938035",
"0.55938035",
"0.55938035",
"0.55938035",
"0.5570502",
"0.5564298",
"0.5544257",
"0.5543905",
"0.55271715",
"0.55019116",
"0.55002284",
"0.5465911",
"0.54634124",
"0.5453106",
"0.5411919",
"0.5381866",
"0.5350541",
"0.53374... | 0.85108703 | 0 |
select channel id with most message activity within last 30 days | async def select_channel(self, channels: [abc.GuildChannel], workspace: WorkspaceEntity) -> str:
text_channels = []
max_messages = -1
max_messages_channel = ''
for channel in channels:
if isinstance(channel, TextChannel):
# skip generated channel from being se... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_messages(cls, max, since=None):\n logging.getLogger('app').debug('Inside Database.get_last_n_messages')\n \n with cls.__get_connection() as cnx:\n return cnx.fetch_all(\"\"\"\n select\n m.message_id,\n m.message_text,\n ... | [
"0.562538",
"0.5601993",
"0.5466625",
"0.54432464",
"0.5381745",
"0.5358702",
"0.53061396",
"0.5294843",
"0.52904063",
"0.52788347",
"0.5263861",
"0.5220234",
"0.5187253",
"0.51716506",
"0.51274705",
"0.5115105",
"0.50410354",
"0.50409",
"0.5033649",
"0.50318",
"0.5029663",
... | 0.61677015 | 0 |
Gets an amount to rotate. | def __get_rotation_amount(self) -> int:
min_rotate_angle = -10
max_rotate_angle = 10
if self.current_angle <= min_rotate_angle:
rotation_amount = 5 + randint(0, 7)
elif self.current_angle >= max_rotate_angle:
rotation_amount = -5 - randint(0, 7)
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def angle(self) -> int:",
"def rotation_rate(self) -> int:\n return self._rotation_rate",
"def get_angle(self) -> NumberType:\n return self._angle",
"def rotation_angle(self):\n return self.container['rotation_angle']",
"def get_angle(n):\n return n % 360 if n > 360 else (n * 180) /... | [
"0.6747645",
"0.6724292",
"0.6570374",
"0.6547653",
"0.6504691",
"0.6413458",
"0.6402973",
"0.63765687",
"0.6352698",
"0.6303226",
"0.629455",
"0.6278951",
"0.6257527",
"0.623377",
"0.6233484",
"0.6233484",
"0.62223095",
"0.6206932",
"0.6192877",
"0.6192748",
"0.6174866",
"... | 0.7240605 | 0 |
Performs a positive reaction. Chooses a random number from 0 to 4 and plays reaction that is tied to that number. | def react_positively(self) -> None:
positive_reactions = [
Triggers.MajorWin,
Triggers.CodeLabHappy,
Triggers.CodeLabYes,
Triggers.CodeLabAmazed,
Triggers.CodeLabCelebrate
]
num = randint(0, 4)
if num == 0:
self.spe... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def react_negatively(self) -> None:\n\n negative_reactions = [\n Triggers.MajorFail,\n Triggers.CubeMovedUpset,\n Triggers.CodeLabUnhappy,\n Triggers.PounceFail,\n Triggers.CodeLabBored\n ]\n num = randint(0, 4)\n if num == 0:\n ... | [
"0.6905896",
"0.6231512",
"0.62157935",
"0.6211258",
"0.61658084",
"0.61590034",
"0.60850656",
"0.6050908",
"0.6033337",
"0.6005656",
"0.5986243",
"0.595127",
"0.5939949",
"0.5912327",
"0.5898589",
"0.5895938",
"0.58722883",
"0.58597785",
"0.58351046",
"0.57990456",
"0.577905... | 0.7328073 | 0 |
Performs a negative reaction. Chooses a random number from 0 to 4 and plays reaction that is tied to that number. | def react_negatively(self) -> None:
negative_reactions = [
Triggers.MajorFail,
Triggers.CubeMovedUpset,
Triggers.CodeLabUnhappy,
Triggers.PounceFail,
Triggers.CodeLabBored
]
num = randint(0, 4)
if num == 0:
self.__p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def react_positively(self) -> None:\n positive_reactions = [\n Triggers.MajorWin,\n Triggers.CodeLabHappy,\n Triggers.CodeLabYes,\n Triggers.CodeLabAmazed,\n Triggers.CodeLabCelebrate\n ]\n\n num = randint(0, 4)\n if num == 0:\n ... | [
"0.6683079",
"0.61137176",
"0.60331506",
"0.593703",
"0.591474",
"0.5886511",
"0.5886511",
"0.5786441",
"0.5680501",
"0.56767386",
"0.56580144",
"0.5644133",
"0.5632372",
"0.5621879",
"0.56003094",
"0.55962235",
"0.55849737",
"0.55822545",
"0.55530477",
"0.55407363",
"0.55339... | 0.7776603 | 0 |
Evaluate performance of prediction labels compared to ground truth. Args text_tar N length numpy array with integers for ground truth labels text_pred N length numpy array with integers for predicted labels tokenizer Determines the granularity level of the evaluation. None or '' characterwise evaluation r'\w' wordwise ... | def generate_token_arrays(
text,
text_tar,
text_pred,
tokenizer=None,
expand_predictions=True,
split_true_entities=True,
ignore_value=None
):
# split text for token evaluation
if isinstance(tokenizer, stanfordnlp.pipeline.core.Pipeline):
doc = tokenizer(text)
# extrac... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def predict(self, texts: List[ParsedText]) -> List[ParsedText]:\n self.model.eval()\n texts = copy.deepcopy(texts)\n\n batches = DataLoader(texts=texts,\n batch_size=self.batch_size,\n vocabulary=self.vocabulary,\n ... | [
"0.6047719",
"0.5638497",
"0.56321526",
"0.56077355",
"0.54930854",
"0.5477739",
"0.54771405",
"0.54673374",
"0.5426912",
"0.5415126",
"0.539227",
"0.53759074",
"0.5339519",
"0.5265813",
"0.52645946",
"0.5215363",
"0.52048546",
"0.5183925",
"0.51813215",
"0.51679975",
"0.5154... | 0.6754063 | 0 |
Existing analysis setups. Returns list of str List of all analysis setups in the design. | def existing_analysis_sweeps(self):
setup_list = self.existing_analysis_setups
sweep_list = []
s_type = self.solution_type
for el in setup_list:
sweep_list.append(el + " : " + s_type)
return sweep_list | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_setup_names(self):\n self.setup_names = list(self._optimetrics.GetSetupNames())\n return self.setup_names.copy()",
"def all_present_experiments(self):\n return _yield_subdir_names(self.exp_configs)",
"def get_analysis_list(self):\n analysys_list = []\n\n analysis_type... | [
"0.64489913",
"0.59564406",
"0.5901408",
"0.5773123",
"0.56467426",
"0.5641863",
"0.56104463",
"0.5600671",
"0.55147064",
"0.5445727",
"0.53945076",
"0.5340589",
"0.5334018",
"0.5283071",
"0.52054447",
"0.51864237",
"0.51725304",
"0.5147676",
"0.5140388",
"0.5132928",
"0.5071... | 0.7540443 | 0 |
Assign openings to a list of faces. | def assign_openings(self, air_faces):
boundary_name = generate_unique_name("Opening")
self.modeler.create_face_list(air_faces, "boundary_faces")
props = {}
air_faces = self.modeler._convert_list_to_ids(air_faces)
props["Faces"] = air_faces
props["Temperature"] = "Ambient... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def faces(self, f):\n self._faces = f",
"def react_to_faces(faces):\n if (len(faces) == 1):\n # Get the location of the face (one of six positions)\n face_loc = get_location(faces[0].bbox, vision.VIDEO_SIZE)\n # Set the Raspimon pose\n if face_loc is not None:\n sense.set_pixels(VOLT_P... | [
"0.6327592",
"0.58146024",
"0.5767662",
"0.5692748",
"0.559544",
"0.5340516",
"0.52958256",
"0.51952136",
"0.51952136",
"0.51705986",
"0.51682824",
"0.51266086",
"0.5123751",
"0.5064268",
"0.50287205",
"0.49778315",
"0.49571183",
"0.49558103",
"0.49528244",
"0.48971468",
"0.4... | 0.6439192 | 0 |
Assign twoway coupling to a setup. | def assign_2way_coupling(
self, setup_name=None, number_of_iterations=2, continue_ipk_iterations=True, ipk_iterations_per_coupling=20
):
if not setup_name:
if self.setups:
setup_name = self.setups[0].name
else:
self.logger.glb.error("No setup i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup(bot):\n\tbot.add_cog(Wallet(bot))",
"def setup_method(self, method):\n self.opp = get_test_open_peer_power()",
"def setup_method(self, method):\n self.opp = get_test_open_peer_power()",
"def _setup(self):\n if self._setup:\n return\n\n GPIO.setmode(GPIO.BCM)\n... | [
"0.5399899",
"0.5323412",
"0.5323412",
"0.5253211",
"0.52444965",
"0.5201379",
"0.51057905",
"0.50686455",
"0.50656474",
"0.501346",
"0.50123507",
"0.49991336",
"0.4993155",
"0.4975337",
"0.4950018",
"0.49387175",
"0.49261895",
"0.49247813",
"0.49237633",
"0.4914572",
"0.4902... | 0.6021909 | 0 |
Create a source block for an object. | def create_source_block(
self, object_name, input_power, assign_material=True, material_name="Ceramic_material", use_object_for_name=True
):
if assign_material:
if isinstance(object_name, list):
for el in object_name:
self.modeler.primitives[el].materi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make(self, *args):\n return _uhd_swig.usrp_source_sptr_make(self, *args)",
"def to_basic_block(self):\n return _uhd_swig.usrp_source_sptr_to_basic_block(self)",
"def make(self, *args, **kwargs):\n return _uhd_swig.amsg_source_sptr_make(self, *args, **kwargs)",
"def create_xblock(usag... | [
"0.60064274",
"0.59292537",
"0.5904522",
"0.57898647",
"0.57289743",
"0.57095134",
"0.57095134",
"0.57032955",
"0.56916565",
"0.56502146",
"0.56428325",
"0.5628184",
"0.5577237",
"0.5540185",
"0.5510298",
"0.54880905",
"0.54696864",
"0.54547685",
"0.5451283",
"0.54358476",
"0... | 0.6881297 | 0 |
Create a source power for a face. | def create_source_power(
self,
face_id,
input_power="0W",
thermal_condtion="Total Power",
surface_heat="0irrad_W_per_m2",
temperature="AmbientTemp",
radiate=False,
source_name=None,
):
if not source_name:
source_name = generate_uniq... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pibooth_setup_picture_factory(cfg, opt_index, factory):",
"def from_power(cls,angle=3.5*u.deg,npixel=256,seed=None,space=\"real\",powerTT=None,callback=\"camb_dimensionless\",lmax=3500):\n\n\t\t#Random seed\n\t\tif seed is not None:\n\t\t\tnp.random.seed(seed)\n\n\t\t#CMB lensing routines \n\t\tqlens = Lens(... | [
"0.522439",
"0.5068676",
"0.4991486",
"0.49730086",
"0.49581286",
"0.49581286",
"0.49515656",
"0.4913044",
"0.49089262",
"0.49089262",
"0.49024868",
"0.4891229",
"0.48829314",
"0.48530835",
"0.48487434",
"0.4815359",
"0.47930324",
"0.4772436",
"0.47723085",
"0.47723085",
"0.4... | 0.75060856 | 0 |
Assign a surface monitor. | def assign_surface_monitor(self, face_name, monitor_type="Temperature", monitor_name=None):
if not monitor_name:
monitor_name = generate_unique_name("Monitor")
oModule = self.odesign.GetModule("Monitor")
oModule.AssignFaceMonitor(["NAME:" + monitor_name, "Quantities:=", [monitor_type... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_monitor(w_card):\n\n # standard name for the monitor interfaces\n mon_id = \"mon{}\".format(w_card.phy)\n\n if mon_id not in pyw.winterfaces():\n # this monitor interface is not set\n # then create a new one\n m_card = pyw.devadd(w_card, mon_id, 'monitor')\n\n # remove ... | [
"0.6523592",
"0.5750645",
"0.5728828",
"0.5510032",
"0.5482783",
"0.53967303",
"0.53698003",
"0.53622407",
"0.5345819",
"0.5341474",
"0.5330829",
"0.52313554",
"0.5227685",
"0.51497513",
"0.51342726",
"0.51198417",
"0.5113416",
"0.5048145",
"0.5045597",
"0.50428575",
"0.50274... | 0.7559201 | 0 |
Create and assign a point monitor. | def assign_point_monitor(self, point_position, monitor_type="Temperature", monitor_name=None):
point_name = generate_unique_name("Point")
self.modeler.oeditor.CreatePoint(
[
"NAME:PointParameters",
"PointX:=",
self.modeler.primitives._arg_with_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_temp_point_monitor(self, point_name, point_coord=[0, 0, 0]):\n arg1 = [\n \"NAME:PointParameters\",\n \"PointX:=\",\n point_coord[0],\n \"PointY:=\",\n point_coord[1],\n \"PointZ:=\",\n point_coord[2],\n ]\n\n ... | [
"0.6372603",
"0.6200222",
"0.580837",
"0.5445098",
"0.52815735",
"0.52128863",
"0.5191275",
"0.51420385",
"0.51420385",
"0.51281756",
"0.50980604",
"0.50772643",
"0.50596046",
"0.50411236",
"0.5038489",
"0.5030054",
"0.5010821",
"0.5006753",
"0.50021386",
"0.49810976",
"0.496... | 0.768234 | 0 |
Assign block power to components based on a CSV file from Sherlock. | def assign_block_from_sherlock_file(self, csv_name):
with open(csv_name) as csvfile:
csv_input = csv.reader(csvfile)
component_header = next(csv_input)
data = list(csv_input)
k = 0
component_data = {}
for el in component_header:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def loadSpinFile(self, fileName):\r\n\r\n def getSpin(position, lines):\r\n \"\"\"Searches lines(a list of the lines found in the spin file) for\r\n a certain atom and returns the spin associated with it, or None if\r\n the atom is not in the list of lines.\"\"\"\r\n ... | [
"0.5574659",
"0.5482745",
"0.5295822",
"0.5105875",
"0.50926346",
"0.50793165",
"0.50631624",
"0.50418556",
"0.5041332",
"0.50294137",
"0.5015528",
"0.501201",
"0.50081575",
"0.5005499",
"0.50045425",
"0.4995501",
"0.49886698",
"0.49570045",
"0.49364844",
"0.4930663",
"0.4910... | 0.8128566 | 0 |
Find the top location of the layout given a gravity. | def find_top(self, gravityDir):
dirs = ["-X", "+X", "-Y", "+Y", "-Z", "+Z"]
for dir in dirs:
argsval = ["NAME:" + dir + " Padding Data", "Value:=", "0"]
args = [
"NAME:AllTabs",
[
"NAME:Geometry3DCmdTab",
["N... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_attach_point_top(self):\n return self.mapToGlobal(self.rect().center()) # Default behavior",
"def layout_y(self):\n return self.floris.farm.layout_y",
"def getAbsoluteTop(self):\n return self.canvas.getAbsoluteTop()",
"def get_pos(self):\n return self.rect.midtop",
"def... | [
"0.6077535",
"0.58963525",
"0.569579",
"0.5691413",
"0.5642173",
"0.56312567",
"0.561799",
"0.55809474",
"0.5538494",
"0.55331993",
"0.55230623",
"0.55064404",
"0.54865223",
"0.5485295",
"0.5485295",
"0.54806125",
"0.5469844",
"0.5455447",
"0.54471344",
"0.54401165",
"0.54249... | 0.721522 | 0 |
Create a parametric heat sink. | def create_parametric_fin_heat_sink(
self,
hs_height=100,
hs_width=100,
hs_basethick=10,
pitch=20,
thick=10,
length=40,
height=40,
draftangle=0,
patternangle=10,
separation=5,
symmetric=True,
symmetric_separation=20,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __create_sample_data__(npts = 20):\n\t#data function\n\tdef wavy(x, y):\n\t\treturn np.sin(0.2*np.pi*x)*np.cos(0.4*np.pi*y)\n\t\n\t#make grid\n\txs = np.linspace(0, 2*20, 2*npts + 1)\n\tys = np.linspace(0, 20, npts + 1)\n\t(xgrid, ygrid) = np.meshgrid(xs, ys)\n\tzgrid = wavy(xgrid, ygrid)\n\t\n\treturn (xgrid,... | [
"0.50172657",
"0.49718136",
"0.4941488",
"0.49096906",
"0.48746008",
"0.4873063",
"0.48712033",
"0.48473215",
"0.4844691",
"0.48285213",
"0.47861546",
"0.47523043",
"0.4722584",
"0.47122666",
"0.47119308",
"0.4706176",
"0.46936378",
"0.4685253",
"0.4681379",
"0.46753737",
"0.... | 0.64573586 | 0 |
Map EM losses to an Icepak design. | def assign_em_losses(
self,
designname="HFSSDesign1",
setupname="Setup1",
sweepname="LastAdaptive",
map_frequency=None,
surface_objects=[],
source_project_name=None,
paramlist=[],
object_list=[],
):
self.logger.glb.info("Mapping HFSS EM... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _makeimap(self):\n self.map_['source'] = 'GOES'\n self.map_['provider'] = 'NOAA'\n self.map_['instrument'] = 'SUVI'\n self.map_['physobs'] = 'flux'",
"def from_enmap(emap):\n\n new_map = so_map()\n hdulist = emap.wcs.to_fits()\n header = hdulist[0].header\n new_map.pix... | [
"0.5513762",
"0.52220994",
"0.52134484",
"0.5205543",
"0.5147694",
"0.51088357",
"0.5089761",
"0.49859834",
"0.49765942",
"0.49747527",
"0.49704683",
"0.4957417",
"0.49562743",
"0.49562743",
"0.49485725",
"0.49353972",
"0.49210435",
"0.48988274",
"0.48841476",
"0.4865084",
"0... | 0.67965555 | 0 |
Unite the files created by a fields summary for the variations. | def UniteFieldsSummaryReports(self, savedir, proj_icepak):
newfilename = os.path.join(savedir, proj_icepak + "_HTCAndTemp.csv")
newfilelines = []
headerwriten = False
filetoremove = []
# first variation
i = 0
filename = os.path.join(savedir, proj_icepak + "_HTCAnd... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_set_reduce_fields_automatically_when_only_files_specified():\n\n files = ['Unihan_Readings.txt', 'Unihan_Variants.txt']\n\n options = {'input_files': files}\n\n b = process.Packager(options)\n\n results = process.get_fields(process.filter_manifest(files))\n expected = b.options['fields']\n\... | [
"0.6138094",
"0.61131877",
"0.58164036",
"0.5275635",
"0.52627516",
"0.5150861",
"0.51374656",
"0.50474006",
"0.5045591",
"0.49486035",
"0.4945565",
"0.48872384",
"0.4884592",
"0.48613265",
"0.48549768",
"0.48328787",
"0.48041835",
"0.48029533",
"0.48023853",
"0.47989404",
"0... | 0.6775532 | 0 |
Create a PCB component in Icepak that is linked to an HFSS 3D Layout object. | def create_ipk_3dcomponent_pcb(
self,
compName,
setupLinkInfo,
solutionFreq,
resolution,
PCB_CS="Global",
rad="Nothing",
extenttype="Bounding Box",
outlinepolygon="",
powerin="0W",
custom_x_resolution=None,
custom_y_resoluti... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_pcb_from_3dlayout(\n self,\n component_name,\n project_name,\n design_name,\n resolution=2,\n extenttype=\"Bounding Box\",\n outlinepolygon=\"\",\n close_linked_project_after_import=True,\n custom_x_resolution=None,\n custom_y_resolut... | [
"0.722886",
"0.6006457",
"0.5916641",
"0.5631487",
"0.55857074",
"0.5567293",
"0.5479314",
"0.547198",
"0.5281856",
"0.52459306",
"0.52106047",
"0.5193295",
"0.5190418",
"0.5168565",
"0.51664287",
"0.51517653",
"0.5136186",
"0.5127592",
"0.5125972",
"0.51216894",
"0.51168144"... | 0.7250074 | 0 |
Create a PCB component in Icepak that is linked to an HFSS 3D Layout object linking only to the geometry file. | def create_pcb_from_3dlayout(
self,
component_name,
project_name,
design_name,
resolution=2,
extenttype="Bounding Box",
outlinepolygon="",
close_linked_project_after_import=True,
custom_x_resolution=None,
custom_y_resolution=None,
):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_ipk_3dcomponent_pcb(\n self,\n compName,\n setupLinkInfo,\n solutionFreq,\n resolution,\n PCB_CS=\"Global\",\n rad=\"Nothing\",\n extenttype=\"Bounding Box\",\n outlinepolygon=\"\",\n powerin=\"0W\",\n custom_x_resolution=None,... | [
"0.71606755",
"0.60618496",
"0.5981655",
"0.56415284",
"0.5577579",
"0.5565353",
"0.5536651",
"0.54877406",
"0.54286206",
"0.54191357",
"0.53995544",
"0.53853345",
"0.53833777",
"0.53343934",
"0.53200406",
"0.53013456",
"0.5293416",
"0.52651024",
"0.5246153",
"0.5235362",
"0.... | 0.74508125 | 0 |
Copy a group from another design. | def copyGroupFrom(self, groupName, sourceDesign, sourceProject=None, sourceProjectPath=None):
oName = self.project_name
if sourceProject == oName or sourceProject is None:
oSrcProject = self._desktop.GetActiveProject()
else:
self._desktop.OpenProject(sourceProjectPath)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def copy_group(self):\n dd = self.destination_directory\n sg = self.source_group\n dg = self.destination_group\n\n data = {\n 'description': sg.description,\n 'name': sg.name,\n 'status': sg.status,\n }\n\n # If this Group already exists, w... | [
"0.6744914",
"0.6737628",
"0.65842587",
"0.64991206",
"0.6265472",
"0.6035223",
"0.5887279",
"0.5776485",
"0.5767557",
"0.5695418",
"0.5676896",
"0.5611046",
"0.5533167",
"0.55331063",
"0.5526371",
"0.5520259",
"0.5512979",
"0.5510256",
"0.5470082",
"0.5459582",
"0.5455663",
... | 0.7448452 | 0 |
Export the 3D model. | def export3DModel(self, fileName, filePath, fileFormat=".step", object_list=[], removed_objects=[]):
if not object_list:
allObjects = self.modeler.primitives.object_names
if removed_objects:
for rem in removed_objects:
allObjects.remove(rem)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def export_model(self, output_model_dir):\n logger.info(\"Exporting model to directory : {}\".format(output_model_dir))\n self.model.export(output_model_dir=output_model_dir)",
"def create_e3d_file(self,path='./'):\n dt=0.606*self.model_parameters['dh']/np.max(self.velocity_model['vp']) # dt... | [
"0.64824575",
"0.6474481",
"0.64248276",
"0.63080794",
"0.6297194",
"0.62525713",
"0.6229305",
"0.6211556",
"0.61593837",
"0.6107157",
"0.6102703",
"0.60517895",
"0.60356396",
"0.60192573",
"0.6001406",
"0.5998077",
"0.5985993",
"0.5985118",
"0.59555966",
"0.59447503",
"0.588... | 0.69140553 | 0 |
Delete the EM losses boundary. | def delete_em_losses(self, bound_name):
self.oboundary.DeleteBoundaries([bound_name])
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def die(self):\n self.pjs.bombermen.remove(self)\n for block in self.physics.blocks[self.stype]:\n if block == self.rects[0]:\n self.physics.blocks[self.stype].remove(block)",
"def eraseLastSeg(self):\n self.can.delete(self.segs.pop().getGraphicObject())",
"def cl... | [
"0.6453558",
"0.618556",
"0.6140863",
"0.6094852",
"0.6082206",
"0.6014098",
"0.59995145",
"0.5951281",
"0.5936723",
"0.57956755",
"0.57941866",
"0.57794243",
"0.5707698",
"0.5691199",
"0.56879765",
"0.5686631",
"0.56787246",
"0.56636286",
"0.56636286",
"0.5652219",
"0.565171... | 0.63696367 | 1 |
Delete a PCB component. | def delete_pcb_component(self, comp_name):
arg = ["NAME:Selections", "Selections:=", comp_name]
self.modeler.oeditor.Delete(arg)
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delcomponent(self,\n context=[],\n componentid=None):\n if componentid == None:\n raise ValueError, \"delcomponent: componentid is None\"\n return jsoncall.do_call(\"delcomponent\", {'modelname':self.modelname,\\\n ... | [
"0.66529816",
"0.65597695",
"0.64037114",
"0.62848693",
"0.6156556",
"0.6069828",
"0.6047589",
"0.602334",
"0.5979555",
"0.59127647",
"0.590122",
"0.58975464",
"0.58932763",
"0.5750576",
"0.5735574",
"0.56635535",
"0.56628716",
"0.56628716",
"0.5650871",
"0.56496924",
"0.5638... | 0.68637323 | 0 |
sendTCP_raw_singe same as sendTCP_raw but for single message | def sendTCP_raw_single(m,ip,port):
s=socket.socket()
s.settimeout(1)
s.connect((ip,port))
s.send(m.data)
#print ("RetVal: %s" % s.recv(1000))
return s.recv(1000) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sendRaw(self, msg, echo = False):\n\n sent = self.__sock.send(msg)\n if sent > 0 and echo:\n print \"Sent: %s\"%msg,",
"async def send_raw(self, raw_message : str):\n await self._connection.send_raw(raw_message)",
"async def send_raw(self, data: bytes) -> None:\n awai... | [
"0.711327",
"0.67403096",
"0.6615937",
"0.65647995",
"0.6527725",
"0.6427289",
"0.63520473",
"0.6343768",
"0.63324654",
"0.63252115",
"0.62935925",
"0.626896",
"0.6267537",
"0.6251001",
"0.6248931",
"0.6226685",
"0.6206426",
"0.61644304",
"0.6148088",
"0.6148088",
"0.6143113"... | 0.74798274 | 0 |
sendTCP_raw_bytes same as sendTCP_raw_singe but for raw bytes | def sendTCP_raw_bytes(data,ip,port):
s=socket.socket()
s.settimeout(3)
s.connect((ip,port))
s.send(data)
#print ("RetVal: %s" % s.recv(1000))
return s.recv(1000) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_bytes(self, data: bytes) -> None:",
"async def send_raw(self, data: bytes) -> None:\n await self.socket.sendall(data)",
"def send(self, data: bytes):",
"def send_bytes(self, bytearray):\r\n try:\r\n self.socket.send(bytearray)\r\n except:\r\n # print(\"Sock... | [
"0.73878384",
"0.72343266",
"0.68756074",
"0.67705405",
"0.67532486",
"0.65822387",
"0.6581286",
"0.65647763",
"0.65512145",
"0.6451417",
"0.6440612",
"0.6440612",
"0.6415889",
"0.63881886",
"0.63653135",
"0.6315379",
"0.62951326",
"0.62764776",
"0.62761664",
"0.622699",
"0.6... | 0.7612792 | 0 |
This function gets a sample pcap file and puts random bytes inside the all fields. Then sends it to the server. It returns all possible error messages in list. | def createErrorMsgs(messages, ip, port):
rspList = list()
for m in messages.values():
randomBS = copy.copy(m)
randomBS_arr = bytearray(randomBS.data)
for idx,bytInt in enumerate(randomBS_arr):
randomBS_arr[idx] = random.randint(0,255)
randomBS = bytes(randomBS_arr)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_and_store_pcap(file_name):\r\n file = open(file_name, \"rb\")\r\n global_header = file.read(24).hex()\r\n byte = file.read(16)\r\n packets = []\r\n bytes = []\r\n sizes = []\r\n while byte:\r\n packet_header = byte.hex()\r\n # parse the size for each packet\r\n si... | [
"0.56992763",
"0.5480785",
"0.5442786",
"0.53123915",
"0.52554893",
"0.5206114",
"0.5205962",
"0.5205437",
"0.5184168",
"0.5165345",
"0.5143179",
"0.5138992",
"0.51319814",
"0.5131829",
"0.509969",
"0.5086289",
"0.5083775",
"0.5062206",
"0.5027553",
"0.5012516",
"0.5002637",
... | 0.5758332 | 0 |
diff_msg modify one field to value and get the difference with the original return False if timeout or the ratio of change | def diff_msg(sym,fi,val,ip,port):
orig=sym.getValues()[0]
try:
respOrig=sendTCP_raw_bytes(orig,ip,port)
except socket.timeout:
return False
msg=b''
for i in range(len(sym.fields)):
msg+=sym.fields[i].getValues()[0] if fi!=i else val
try:
original = str(orig).part... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_diff(self,game,wanted_diff,wanted_starting_time=''):\n return True",
"def _diff(self, param, diff):\n pass",
"def check_compare_decrease(out_fields):\n change = out_fields[CHANGE_FLD]\n expected_change = -25.00\n check_compare(change, expected_change)\n check_float_value(cha... | [
"0.59433705",
"0.58866566",
"0.5741213",
"0.57070243",
"0.56107557",
"0.5602087",
"0.55542886",
"0.55195427",
"0.5489824",
"0.53829694",
"0.53829694",
"0.5382785",
"0.53190625",
"0.53040767",
"0.5303886",
"0.5302495",
"0.52817154",
"0.5278376",
"0.52559036",
"0.5226828",
"0.5... | 0.7136184 | 0 |
takes list of blacklist urls | def load_blacklists(self, blacklist_urls: List[str]) -> Set[str]:
items: Set[str] = set()
sets = []
for url in blacklist_urls:
fname = f'/tmp/{hashlib.md5(url.encode()).hexdigest()}-blacklist'
# Download if necessary
if not os.path.exists(fname):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def handle_weblists(bot, ievent):\n ievent.reply(\"whitelist: %s blacklist: %s\" % (cfg.get('whitelist'), \\\ncfg.get('blacklist')))",
"def find_target_urls(url_list):\n candidate_urls = []\n \n #iterate through urls\n for url in get_urls(get_clean_text(message_list)):\n #skip any urls from... | [
"0.67311",
"0.67156696",
"0.66505307",
"0.6576072",
"0.6518747",
"0.6418503",
"0.6418085",
"0.63344425",
"0.6133395",
"0.60442084",
"0.5939",
"0.59096384",
"0.5879145",
"0.5876669",
"0.5847612",
"0.5847537",
"0.5801166",
"0.5793875",
"0.57607865",
"0.5706794",
"0.56880635",
... | 0.6910591 | 0 |
Runs a transformation that is specified as a dict of checksums, such as returned by highlevel.Transformer.get_transformation_dict | def run_transformation_dict(transformation_dict, result_callback=None):
# TODO: add type annotation and all kinds of validation...
from .. import database_sink
transformation_buffer = tf_get_buffer(transformation_dict)
transformation = calculate_checksum(transformation_buffer)
cache_buffer(transfor... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def run_transformation_dict_async(transformation_dict):\n # TODO: add type annotation and all kinds of validation...\n transformation_buffer = tf_get_buffer(transformation_dict)\n transformation = calculate_checksum(transformation_buffer)\n cache_buffer(transformation, transformation_buffer)\n ... | [
"0.6176635",
"0.58770233",
"0.5642491",
"0.5400571",
"0.53724617",
"0.53604096",
"0.53584576",
"0.5241145",
"0.5201133",
"0.5098775",
"0.5077724",
"0.50566465",
"0.5045827",
"0.5000128",
"0.49946854",
"0.49663246",
"0.49579343",
"0.4930994",
"0.48909107",
"0.48407468",
"0.483... | 0.65600985 | 0 |
Runs a transformation that is specified as a dict of checksums, such as returned by highlevel.Transformer.get_transformation_dict | async def run_transformation_dict_async(transformation_dict):
# TODO: add type annotation and all kinds of validation...
transformation_buffer = tf_get_buffer(transformation_dict)
transformation = calculate_checksum(transformation_buffer)
cache_buffer(transformation, transformation_buffer)
increfed ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_transformation_dict(transformation_dict, result_callback=None):\n # TODO: add type annotation and all kinds of validation...\n from .. import database_sink\n\n transformation_buffer = tf_get_buffer(transformation_dict)\n transformation = calculate_checksum(transformation_buffer)\n cache_buff... | [
"0.65600985",
"0.58770233",
"0.5642491",
"0.5400571",
"0.53724617",
"0.53604096",
"0.53584576",
"0.5241145",
"0.5201133",
"0.5098775",
"0.5077724",
"0.50566465",
"0.5045827",
"0.5000128",
"0.49946854",
"0.49663246",
"0.49579343",
"0.4930994",
"0.48909107",
"0.48407468",
"0.48... | 0.6176635 | 1 |
Wraps a function in an asynchronous imperative transformer Asynchronous imperative transformers can be called and awaited as normal async functions, but the source code of the function and the arguments are converted into a Seamless transformation. | def transformer_async(func, **kwargs):
result = Transformer(func, is_async=True, **kwargs)
update_wrapper(result, func)
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def awaitify(\n function: Union[Callable[..., T], Callable[..., Awaitable[T]]]\n) -> Callable[..., Awaitable[T]]:\n if iscoroutinefunction(function):\n return function\n else:\n return Awaitify(function)",
"def transformer(func, **kwargs):\n result = Transformer(func, is_async=False, **... | [
"0.7207748",
"0.7180752",
"0.662931",
"0.6521321",
"0.6519227",
"0.64941007",
"0.64194334",
"0.6393317",
"0.63527554",
"0.63411",
"0.63243544",
"0.6189952",
"0.6173813",
"0.6163481",
"0.616196",
"0.61088103",
"0.60895604",
"0.6084321",
"0.6061671",
"0.60611814",
"0.60355884",... | 0.7630319 | 0 |
Downloads the associated SLD file for a given GeoNode layer The current implementation goes to the layer's detail page and follows the link to the GeoServer's REST API endpoint. It needs the username and password, because by default GeoServer restricts read access to those. It returns the raw content of the SLD file in... | def get_style(layer, url, username=None, password=None):
# Get the style json information from GeoServer's REST API
if ':' in layer['name']:
name = layer['name'].split(':')[1]
else:
name = layer['name']
style_raw_url = urlparse.urljoin(url, '/geoserver/styles/' + name + '.sld')
req... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_district_file(state=48, district=7, leg_body='US-REP'):\r\n\r\n district_file = get_district_geojson_filename(\r\n state=state, district=district, leg_body=leg_body)\r\n geojson_path = 'static/geojson/' \r\n state = \"{0:0>2}\".format(state)\r\n district = \"{0:0>2}\".format(district... | [
"0.51435786",
"0.5060452",
"0.5042644",
"0.50079465",
"0.50066674",
"0.4934583",
"0.4906796",
"0.48551863",
"0.48342174",
"0.48276514",
"0.48184407",
"0.47778517",
"0.4752442",
"0.4740819",
"0.47388965",
"0.4708768",
"0.4708768",
"0.4708768",
"0.4708768",
"0.4708768",
"0.4708... | 0.5460917 | 0 |
Find approved Local Group for User based on Affiliations and Roles | def find_local_group_by_user(user):
"""Find affiliation for approved group with non-empty roles"""
if hasattr(user, 'localgroupprofile'):
local_group_profile = user.localgroupprofile
# TODO: support multiple group affiliations?
local_group_affiliation = LocalGroupAffiliation.objects.fil... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def approve_me_group(message):\n users = hf.get_users()\n sender_id = message._get_user_id()\n\n for user in users:\n if user[\"id\"] == sender_id:\n if (user[\"approval_level\"] == \"unapproved\"):\n message.reply(Strings['APPROVE_ME_REQUEST'])\n else:\n ... | [
"0.56001335",
"0.5562444",
"0.5394826",
"0.5330982",
"0.5330448",
"0.52975655",
"0.52975655",
"0.52913195",
"0.5282262",
"0.52379805",
"0.52347904",
"0.5206128",
"0.5173483",
"0.5135821",
"0.5120979",
"0.5120678",
"0.51147497",
"0.5096916",
"0.50951266",
"0.5092302",
"0.50867... | 0.7091184 | 0 |
Get Affiliation for Local Group, otherwise None | def get_affiliation_for_local_group(self, local_group):
affiliation = self.localgroupaffiliation_set.filter(
local_group=local_group
).first()
return affiliation | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_local_group_by_user(user):\n\n \"\"\"Find affiliation for approved group with non-empty roles\"\"\"\n if hasattr(user, 'localgroupprofile'):\n local_group_profile = user.localgroupprofile\n # TODO: support multiple group affiliations?\n local_group_affiliation = LocalGroupAffili... | [
"0.63540494",
"0.56002915",
"0.53682905",
"0.5253615",
"0.5183216",
"0.5118596",
"0.5111766",
"0.5097221",
"0.50937724",
"0.5056007",
"0.5025186",
"0.50088257",
"0.49927133",
"0.49780655",
"0.49780655",
"0.49780655",
"0.49780655",
"0.49780655",
"0.49780655",
"0.4931689",
"0.4... | 0.7823385 | 0 |
Get Affiliations for Local Group Role | def get_affiliations_for_local_group_role_id(self, local_group_role_id):
affiliations = self.localgroupaffiliation_set.filter(
local_group_roles=local_group_role_id
)
return affiliations | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_affiliation_for_local_group(self, local_group):\n affiliation = self.localgroupaffiliation_set.filter(\n local_group=local_group\n ).first()\n return affiliation",
"def getRoles(self):",
"def get_granted_roles(self):",
"def get_roles(role):",
"def getRoleInfo(self, r... | [
"0.6443044",
"0.5803436",
"0.56780136",
"0.5676261",
"0.55866474",
"0.5524369",
"0.5498116",
"0.54259",
"0.54050255",
"0.537135",
"0.53391683",
"0.5308558",
"0.5215137",
"0.5186496",
"0.51822263",
"0.51781356",
"0.514466",
"0.5111531",
"0.50909424",
"0.5088191",
"0.5073385",
... | 0.7087874 | 0 |
Verify if user has all permissions for local group | def has_permissions_for_local_group(self, local_group, permissions):
for permission in permissions:
if not self.has_permission_for_local_group(
local_group,
permission
):
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_call_permission_for_local_group(user, local_group, permission):\n\n \"\"\"Check Feature Access and Local Group Permissions\"\"\"\n if hasattr(user, 'localgroupprofile'):\n local_group_profile = user.localgroupprofile\n if has_call_feature_access_for_local_group(local_group):\n ... | [
"0.72938764",
"0.7188845",
"0.7178073",
"0.7147893",
"0.7076484",
"0.70290804",
"0.69174296",
"0.68604577",
"0.6854978",
"0.68198705",
"0.68117577",
"0.68110144",
"0.67625076",
"0.6760685",
"0.67337173",
"0.6719916",
"0.67017484",
"0.6683048",
"0.66474944",
"0.6646154",
"0.66... | 0.7626319 | 0 |
Get the temperature and humidity readings from the DHT22 | def get_temp():
count = 0
while True:
# Temp
output = subprocess.check_output(
["/home/andy/python/bitbucket/pitemp/Adafruit_DHT", "2302", "4"])
count += 1
print ("Attempt %s: %s") % (count, output)
temp_match = re.search("Temp =\s+([0-9.]+)", output)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getDHT():\n dht_humidity, cels = Adafruit_DHT.read(DHT_TYPE, DHT_PIN)\n if cels and dht_humidity:\n dht_temp = cels_fahr(cels)\n else:\n checkDebug(\"*** Unable to get DHT values! ***\")\n dht_temp = 0\n dht_humidity = 0\n return dht_temp, dht_humidity",
"def getReadin... | [
"0.80469584",
"0.7289412",
"0.7213233",
"0.71664774",
"0.7082346",
"0.7033855",
"0.70154285",
"0.6909565",
"0.69016886",
"0.68563807",
"0.67824906",
"0.6751205",
"0.6674529",
"0.66686547",
"0.6618873",
"0.6603632",
"0.65937096",
"0.659243",
"0.6579795",
"0.657381",
"0.6572413... | 0.7513158 | 1 |
Returns the current running version of the NarrativeMethodStore. | def ver(self, context=None):
return self._client.call_method(
'NarrativeMethodStore.ver',
[], self._service_ver, context) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_current_version(self):\n raise NotImplementedError(\"get_current_version is not implemented\")",
"def get_current_version(self) -> str:\n raise NotImplementedError()",
"def version(self):\n return self.get_current_version()",
"def get_current_version(self):\n current_v... | [
"0.6512809",
"0.63084924",
"0.61486477",
"0.6109447",
"0.60974246",
"0.60258347",
"0.6008531",
"0.5985272",
"0.59202164",
"0.588994",
"0.5848776",
"0.5826109",
"0.581803",
"0.5815346",
"0.57916784",
"0.5784185",
"0.5784185",
"0.57801336",
"0.5741982",
"0.5714112",
"0.56952345... | 0.67785263 | 0 |
Turn dictionary into a table definition for insert / update | def get_table_def(dict_in, db_in):
meta = MetaData(db_in)
val_mapping = {
'pressure': Integer,
'temperature': Float,
'humidity': Float,
'battery': Integer,
'colorTemperature': Integer,
}
val_type = val_mapping.get(dict_in['name'], String)
table... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_table_insert_command_from_dict(table, dict):\n sql = 'INSERT OR REPLACE INTO ' + table\n sql += ' ('\n sql += ','.join(dict.keys())\n sql += ') VALUES ('\n sql += ','.join(map(wrap_with_strings, dict.values()))\n sql += ');'\n return sql",
"def insertFromDict(table, dict):\n sql =... | [
"0.7155662",
"0.71258026",
"0.6667329",
"0.65658313",
"0.6420979",
"0.6384658",
"0.6334637",
"0.6307397",
"0.6301272",
"0.62599754",
"0.6255697",
"0.62162805",
"0.61943555",
"0.6179605",
"0.61544657",
"0.615358",
"0.61356205",
"0.6111473",
"0.6109597",
"0.6108918",
"0.6085554... | 0.74472284 | 0 |
Return the ideal heavy outputs dictionary. | def heavy_outputs(self):
return self._heavy_outputs | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def outputs(self):\n\t\treturn {k: v * self.throughput for k, v in self.per_process_outputs.items()}",
"def _get_output_dictionary(self):\n\n return_dictionary = {}\n\n for output_path in self.provided_outputs:\n return_dictionary[output_path.full_path] = self.get_value(output_path)\n\n ... | [
"0.71540225",
"0.66443044",
"0.6476039",
"0.63870174",
"0.63750595",
"0.62371063",
"0.61654824",
"0.5891897",
"0.58325523",
"0.5820708",
"0.5816429",
"0.5775973",
"0.5712373",
"0.5689303",
"0.5686148",
"0.5658862",
"0.56549037",
"0.56337756",
"0.5616627",
"0.55943936",
"0.558... | 0.74387336 | 0 |
Return the number of heavy output counts as measured. | def heavy_output_counts(self):
return self._heavy_output_counts | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_total_n_cpu(self) -> int:",
"def get_num_measured_outputs(self):\n i = 0\n for o in self.outputs:\n if o.is_measured_output():\n i += 1\n return i",
"def get_load_factor(self):\n # Your code here\n return self.count/len(self.data)",
"def co... | [
"0.71255594",
"0.69156873",
"0.691443",
"0.6907816",
"0.6891827",
"0.6658858",
"0.6616153",
"0.65334684",
"0.64919555",
"0.64853454",
"0.6436298",
"0.6350555",
"0.6333117",
"0.63138413",
"0.62498355",
"0.6235761",
"0.62287235",
"0.6218069",
"0.62089247",
"0.6206654",
"0.62056... | 0.86212903 | 0 |
Return the heavy output probability ideally. | def heavy_output_prob_ideal(self):
return self._heavy_output_prob_ideal | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def heavy_output_counts(self):\n return self._heavy_output_counts",
"def calculate_probability(self):\n return 0",
"def get_raw_probability(self):\n\t\tproba = RunOrder.BASE_SUCCESS_PROBABILITY\n\t\tproba += (self.additional_percents + self.hidden_percents) * 10\n\t\treturn proba",
"def _sample... | [
"0.6726189",
"0.6637995",
"0.65333253",
"0.6518991",
"0.64057547",
"0.62862617",
"0.62339973",
"0.62322354",
"0.6227328",
"0.621576",
"0.62151796",
"0.6209667",
"0.6204549",
"0.61985916",
"0.6196905",
"0.60965973",
"0.60711235",
"0.6070062",
"0.604483",
"0.6011984",
"0.598720... | 0.82184976 | 0 |
Add the ideal results and convert to the heavy outputs. Assume the result is from 'statevector_simulator' | def add_statevectors(self, new_statevector_result):
if new_statevector_result is None:
return
if not isinstance(new_statevector_result, list):
new_statevector_result = [new_statevector_result]
for result in new_statevector_result:
for qvcirc in result.resul... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def optimize(self):\n self.vbe_step()\n self.compute_responsibilities()\n self.compute_sufficient_stats()\n self.vbmstep()",
"def run_step_blackbox_optimizer(config,\n current_input,\n blackbox_optimizer,\n ... | [
"0.63052976",
"0.6089504",
"0.60357183",
"0.6035258",
"0.6003312",
"0.5961215",
"0.5948271",
"0.58839226",
"0.5879852",
"0.58772993",
"0.5877175",
"0.5877175",
"0.5875996",
"0.58399993",
"0.5806366",
"0.58054745",
"0.57685876",
"0.5761752",
"0.5757717",
"0.5743019",
"0.574125... | 0.715707 | 0 |
Add a new result. Re calculate fit | def add_data(self, new_backend_result, rerun_fit=True):
if new_backend_result is None:
return
if not isinstance(new_backend_result, list):
new_backend_result = [new_backend_result]
for result in new_backend_result:
self._result_list.append(result)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_result(params, new_result):\r\n ret = load_results(params)\r\n ret[\"evaluations\"].append(new_result)\r\n for m in params.metrics:\r\n if m not in ret[\"best_results\"] or \\\r\n new_result['result'][m] > ret['best_results'][m]['result'][m]:\r\n ret[\"best_results... | [
"0.6892044",
"0.67279345",
"0.6616967",
"0.64829034",
"0.63191",
"0.63128453",
"0.6259763",
"0.62043417",
"0.6196137",
"0.61875445",
"0.61663514",
"0.61645406",
"0.61546844",
"0.6143772",
"0.6133166",
"0.6111425",
"0.60890394",
"0.6085135",
"0.6066645",
"0.60634667",
"0.60536... | 0.7006938 | 0 |
Make a count dictionary for each unique circuit from all the results. Calculate the heavy output probability. | def calc_data(self):
circ_counts = {}
for trialidx in range(self._ntrials):
for _, depth in enumerate(self._depths):
circ_name = 'qv_depth_%d_trial_%d' % (depth, trialidx)
# get the counts form ALL executed circuits
count_list = []
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculates_results_stats(results_dic): \n # Creates empty dictionary for results_stats_dic\n results_stats_dic = dict()\n \n # Sets all counters to initial values of zero so that they can \n # be incremented while processing through the images in results_dic \n results_stats_dic['n_dog... | [
"0.61174583",
"0.5979128",
"0.59502864",
"0.59438497",
"0.588107",
"0.5872179",
"0.5854523",
"0.5853185",
"0.5838517",
"0.582985",
"0.5792049",
"0.5788493",
"0.5747312",
"0.57070863",
"0.5683165",
"0.56690836",
"0.5651664",
"0.56500936",
"0.5638528",
"0.56252235",
"0.5620967"... | 0.7440842 | 0 |
Convert the heavy outputs in the different trials into mean and error for plotting. Here we assume the error is due to a binomial distribution. Error (standard deviation) for binomial distribution is sqrt(np(1p)), where n is the number of trials (self._ntrials) and p is the success probability (self._ydata[0][depthidx]... | def calc_statistics(self):
self._ydata = np.zeros([4, len(self._depths)], dtype=float)
exp_vals = np.zeros(self._ntrials, dtype=float)
ideal_vals = np.zeros(self._ntrials, dtype=float)
for depthidx, depth in enumerate(self._depths):
exp_shots = 0
for trialidx... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_average(self, error=None):\n\n nbjobs = len(self)\n if not nbjobs:\n return\n max_xsec = max(one.xsec for one in self)\n min_xsec = min(one.xsec for one in self)\n self.axsec = sum([one.axsec for one in self]) / nbjobs\n self.xsec = sum([one.xsec for... | [
"0.5766995",
"0.56980366",
"0.5663932",
"0.5614797",
"0.5601893",
"0.5589843",
"0.55717117",
"0.54917",
"0.5472309",
"0.5471716",
"0.54600525",
"0.5459562",
"0.54394954",
"0.5420097",
"0.54192245",
"0.5417687",
"0.54014593",
"0.53909767",
"0.5388067",
"0.53818923",
"0.5379945... | 0.57208174 | 1 |
Return whether each depth was successful (> 2/3 with confidence level > 0.977 corresponding to z_value = 2) and the confidence level. | def qv_success(self):
success_list = []
confidence_level_threshold = self.calc_confidence_level(z_value=2)
for depth_ind, _ in enumerate(self._depths):
success_list.append([False, 0.0])
hmean = self._ydata[0][depth_ind]
sigma = self._ydata[1][depth_ind]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calc_confidence_level(self, z_value):\n\n confidence_level = 0.5 * (1 + math.erf(z_value/2**0.5))\n\n return confidence_level",
"def test_depth_known(our_bsts):\n assert our_bsts[0].depth() == our_bsts[1]",
"def depth_check(self, depth):\r\n if depth >= self.ply:\r\n retu... | [
"0.63002855",
"0.59713274",
"0.56828445",
"0.5625449",
"0.5499978",
"0.53820795",
"0.5372017",
"0.53469354",
"0.5323189",
"0.5317821",
"0.52830386",
"0.52818173",
"0.52780604",
"0.52708024",
"0.52566534",
"0.520605",
"0.5182075",
"0.5137559",
"0.5129822",
"0.5129321",
"0.5120... | 0.7041239 | 0 |
Calculate z value using mean and sigma. | def calc_z_value(self, mean, sigma):
if sigma == 0:
# assign a small value for sigma if sigma = 0
sigma = 1e-10
warnings.warn('Standard deviation sigma should not be zero.')
z_value = (mean - 2/3) / sigma
return z_value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zvalue(value, sigma, mu):\n return (value - mu) / sigma",
"def st(self, sigma, z):\n \n aa = self.params[0]\n a = self.params[1]\n p = self.params[2]\n delta_c = self.params[3]\n \n return aa * sqrt(2.e0*a/pi) * (delta_c/sigma) * exp( (-a*delta_c*delta_c) / (2.e0*sigma*sigma) )*(1.e0 ... | [
"0.8171789",
"0.7375456",
"0.72756827",
"0.7109719",
"0.7064882",
"0.70063514",
"0.6902822",
"0.6774692",
"0.6765704",
"0.6713272",
"0.6691268",
"0.66450894",
"0.66226393",
"0.6510892",
"0.6501101",
"0.6431476",
"0.64067405",
"0.63954693",
"0.6350348",
"0.63368845",
"0.630019... | 0.8530953 | 0 |
Calculate confidence level using z value. Accumulative probability for standard normal distribution in [z, +infinity] is 1/2 (1 + erf(z/sqrt(2))), where z = (X mu)/sigma = (hmean 2/3)/sigma | def calc_confidence_level(self, z_value):
confidence_level = 0.5 * (1 + math.erf(z_value/2**0.5))
return confidence_level | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def z_score(num, mean, std_dev):\n\treturn (num - mean) / std_dev",
"def ztest(x, sigma, mu0, tail=\"both\"):\n z = (np.mean(x) - mu0) / (sigma * np.sqrt(len(x)))\n if tail == \"both\":\n return 1 - gaussian_cdf(abs(z))\n elif tail == \"lower\":\n return 1 - gaussian_cdf(-z)\n elif tail... | [
"0.715361",
"0.6694587",
"0.66217506",
"0.65117896",
"0.64892626",
"0.64612925",
"0.6436323",
"0.63603866",
"0.63508487",
"0.63461494",
"0.6304591",
"0.6231899",
"0.6225367",
"0.6213088",
"0.618859",
"0.6163113",
"0.6139677",
"0.6118483",
"0.6117616",
"0.6099324",
"0.6080637"... | 0.780776 | 0 |
Return a list of median probabilities. | def _median_probabilities(self, distributions):
medians = []
for dist in distributions:
values = np.array(list(dist.values()))
medians.append(float(np.real(np.median(values))))
return medians | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_median(numlist):\n return np.median(numlist)",
"def samples_median(samples):\n return [np.median(s) for s in samples.T]",
"def samples_median(samples):\n return [np.median(s) for s in samples.T]",
"def test_median():\n\tnt.assert_equal(median([1]),1)\n\tnt.assert_equal(median([36,1]),37/2)\n... | [
"0.73932344",
"0.72494096",
"0.72494096",
"0.710843",
"0.7065595",
"0.703823",
"0.6990909",
"0.69747156",
"0.68316686",
"0.6797866",
"0.6795603",
"0.67906797",
"0.67541087",
"0.6665891",
"0.664005",
"0.66362786",
"0.66300714",
"0.6621718",
"0.66211194",
"0.6590604",
"0.657295... | 0.8528012 | 0 |
Public slot to appand text to the "stderr" tab. txt text to be appended (string) | def appendToStderr(self, txt):
added = self.__logViewer.appendToStderr(txt)
if added:
self.__ui.showLogViewer() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def appendToStderr(self, txt):\n if self.__filterMessage(txt, isErrorMessage=True):\n return False\n \n self.__appendText(txt, isErrorMessage=True)\n QApplication.processEvents()\n return True",
"def write(self, text):\n text = text.rstrip()\n self.fh.w... | [
"0.7090004",
"0.6849034",
"0.66713625",
"0.6516882",
"0.64910644",
"0.6442643",
"0.6423258",
"0.63393724",
"0.6339147",
"0.6331438",
"0.6298789",
"0.6186379",
"0.61783814",
"0.6166383",
"0.6135533",
"0.6119889",
"0.6112705",
"0.61096954",
"0.6097498",
"0.60961694",
"0.6094443... | 0.7113195 | 0 |
Public slot to handle a change of the preferences. | def preferencesChanged(self):
self.__logViewer.preferencesChanged() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def preferencesChanged(self):\n # do nothing\n pass",
"def on_preference(self, widget, data=None):\n print \"This feature will be implemented soon\"",
"def settings_changed(self, name, value):\n return",
"def on_preferences(self, evt):\n # Passing `self` sets the main windo... | [
"0.836825",
"0.696788",
"0.69385743",
"0.6643918",
"0.66390264",
"0.6639006",
"0.662247",
"0.63510144",
"0.62935555",
"0.6276403",
"0.5999134",
"0.595508",
"0.59206355",
"0.58903795",
"0.5876009",
"0.5861567",
"0.5837277",
"0.58289695",
"0.5823236",
"0.5754941",
"0.5744263",
... | 0.74983895 | 1 |
Public method to display the search widget. txt text to be shown in the combo (string) | def showFind(self, txt=""):
self.__searchWidget.showFind(txt) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search_btn_clicked(self, widget, data=None):\n # Method to handle search here.\n search_text = self.get_text(\"txt_search\")\n print search_text",
"def show(self, txt=\"\"):\n if self.project and self.project.isOpen():\n self.projectButton.setEnabled(True)\n else... | [
"0.7130795",
"0.67692786",
"0.66564894",
"0.6606529",
"0.6601016",
"0.6525232",
"0.64659023",
"0.62841177",
"0.62814045",
"0.62212634",
"0.62060475",
"0.61433583",
"0.6109773",
"0.6086807",
"0.6080016",
"0.60007834",
"0.5988855",
"0.5972837",
"0.5971392",
"0.5954917",
"0.5953... | 0.74640363 | 0 |
Private slot to show the context menu. coord the position of the mouse pointer (QPoint) | def __handleShowContextMenu(self, coord):
coord = self.mapToGlobal(coord)
self.__menu.popup(coord) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def aboutToShowContextMenuEvent(self):\n\t\tpass",
"def contextMenuEvent(self, event):\n menu = QMenu()\n self.action_options.add_to_context_menu(menu)\n menu.exec_(event.globalPos()) # show menu at mouse position",
"def _contextMenu(self, pos):\n # Create the context menu\n ... | [
"0.75065196",
"0.7436941",
"0.72276735",
"0.7113408",
"0.6953456",
"0.6902781",
"0.67719257",
"0.67107254",
"0.6703465",
"0.66487324",
"0.6640975",
"0.66332203",
"0.660269",
"0.65667784",
"0.6547808",
"0.65213984",
"0.6477128",
"0.64716405",
"0.64531463",
"0.6429861",
"0.6425... | 0.77717066 | 0 |
Private method to append text to the end. txt text to insert (string) isErrorMessage flag indicating to insert error text (boolean) | def __appendText(self, txt, isErrorMessage=False):
tc = self.textCursor()
tc.movePosition(QTextCursor.End)
self.setTextCursor(tc)
if isErrorMessage:
self.setCurrentCharFormat(self.cErrorFormat)
else:
self.setCurrentCharFormat(self.cNormalFormat)
se... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def insert_text(self, text):\n self.str += text",
"def appendToStderr(self, txt):\n if self.__filterMessage(txt, isErrorMessage=True):\n return False\n \n self.__appendText(txt, isErrorMessage=True)\n QApplication.processEvents()\n return True",
"def appendT... | [
"0.6722547",
"0.66592216",
"0.6510563",
"0.64271134",
"0.64247394",
"0.63934827",
"0.6375307",
"0.63571197",
"0.62390053",
"0.61722606",
"0.6146331",
"0.61434925",
"0.6101763",
"0.6097587",
"0.60783285",
"0.60442173",
"0.60272783",
"0.6019607",
"0.6007922",
"0.5957822",
"0.59... | 0.8345409 | 0 |
Private method to filter messages. message message to be checked (string) isErrorMessage flag indicating to check an error message (boolean) flag indicating that the message should be filtered out (boolean) | def __filterMessage(self, message, isErrorMessage=False):
message = Utilities.filterAnsiSequences(message)
if isErrorMessage:
filters = self.__stderrFilter + self.__stdxxxFilter
else:
filters = self.__stdoutFilter + self.__stdxxxFilter
for msgFilter in fi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_filter_messages_non_message(self):\n pass",
"def test_filter_messages(self):\n pass",
"def filter_msg(filter_id, message_event):\n\n # Get Filter dictionary from database\n filter_dict = MessageFilter.get_filter(filter_id)\n if filter_dict == False:\n logg... | [
"0.7443896",
"0.7188733",
"0.6862448",
"0.6229173",
"0.6100408",
"0.6090096",
"0.60198677",
"0.60012406",
"0.5910933",
"0.5826428",
"0.5755305",
"0.5703322",
"0.5652608",
"0.54677546",
"0.5449713",
"0.54274654",
"0.54244184",
"0.5418442",
"0.5385313",
"0.5383934",
"0.53787565... | 0.7593951 | 0 |
Public slot to appand text to the "stderr" tab. txt text to be appended (string) flag indicating text was appended (boolean) | def appendToStderr(self, txt):
if self.__filterMessage(txt, isErrorMessage=True):
return False
self.__appendText(txt, isErrorMessage=True)
QApplication.processEvents()
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def appendToStderr(self, txt):\n added = self.__logViewer.appendToStderr(txt)\n if added:\n self.__ui.showLogViewer()",
"def appendToStdout(self, txt):\n if self.__filterMessage(txt, isErrorMessage=False):\n return False\n \n self.__appendText(txt, isError... | [
"0.7131635",
"0.69916844",
"0.65884924",
"0.6549952",
"0.64397687",
"0.63425803",
"0.6304723",
"0.62501556",
"0.6219554",
"0.62107515",
"0.61767924",
"0.61755544",
"0.6130405",
"0.612813",
"0.60715383",
"0.60263234",
"0.60234535",
"0.5950326",
"0.5940821",
"0.5916329",
"0.590... | 0.748794 | 0 |
Public method to search the next occurrence of the given text. txt text to search for str caseSensitive flag indicating to perform a case sensitive search bool wholeWord flag indicating to search for whole words only bool regexp flag indicating a regular expression search bool | def searchNext(self, txt, caseSensitive, wholeWord, regexp):
self.__lastSearch = (txt, caseSensitive, wholeWord, regexp)
flags = QTextDocument.FindFlags()
if caseSensitive:
flags |= QTextDocument.FindCaseSensitively
if wholeWord:
flags |= QTextDocument.FindWholeWo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search(self, word):",
"def searchPrev(self, txt, caseSensitive, wholeWord, regexp):\n self.__lastSearch = (txt, caseSensitive, wholeWord, regexp)\n flags = QTextDocument.FindFlags(QTextDocument.FindBackward)\n if caseSensitive:\n flags |= QTextDocument.FindCaseSensitively\n ... | [
"0.72954684",
"0.7041482",
"0.69674814",
"0.68977845",
"0.67025536",
"0.67025536",
"0.6673565",
"0.6507456",
"0.64674175",
"0.6399412",
"0.6399412",
"0.6386298",
"0.6366086",
"0.6335018",
"0.62625635",
"0.62615824",
"0.6250894",
"0.61997473",
"0.6198586",
"0.6180251",
"0.6164... | 0.8265198 | 0 |
Public method to search the previous occurrence of the given text. txt text to search for str caseSensitive flag indicating to perform a case sensitive search bool wholeWord flag indicating to search for whole words only bool regexp flag indicating a regular expression search bool | def searchPrev(self, txt, caseSensitive, wholeWord, regexp):
self.__lastSearch = (txt, caseSensitive, wholeWord, regexp)
flags = QTextDocument.FindFlags(QTextDocument.FindBackward)
if caseSensitive:
flags |= QTextDocument.FindCaseSensitively
if wholeWord:
flags |=... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def searchNext(self, txt, caseSensitive, wholeWord, regexp):\n self.__lastSearch = (txt, caseSensitive, wholeWord, regexp)\n flags = QTextDocument.FindFlags()\n if caseSensitive:\n flags |= QTextDocument.FindCaseSensitively\n if wholeWord:\n flags |= QTextDocument.... | [
"0.7309876",
"0.6953325",
"0.6770723",
"0.6280625",
"0.6257286",
"0.61789984",
"0.6094383",
"0.6067818",
"0.60331005",
"0.60331005",
"0.5976145",
"0.5943898",
"0.5943898",
"0.5899375",
"0.5889473",
"0.5876788",
"0.58638805",
"0.5851523",
"0.5833547",
"0.58262193",
"0.5814099"... | 0.8197999 | 0 |
Return a callback that sets the player's choice. | def create_callback(throw, rand=False):
obj = self
r = rand
def wrapped(widget):
"""Set the player's throw."""
if r:
obj.player_choice = random.choice(list(evilrps.Throws))
else:
# print(widget, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def SelectPlayer(self):\n\n player = input(data['player'])\n if player == \"1\":\n return 0\n elif player == \"2\":\n return 1\n else:\n return 'invalid'",
"def choose(self, choice):\n if self.available(choice):\n self.select(choice)"... | [
"0.608662",
"0.5984766",
"0.5920916",
"0.584878",
"0.56991035",
"0.5676789",
"0.5674178",
"0.56540287",
"0.5653703",
"0.5614996",
"0.5610299",
"0.5587594",
"0.5587594",
"0.55697864",
"0.5551329",
"0.5529739",
"0.55192184",
"0.5471437",
"0.5465435",
"0.54512185",
"0.5445069",
... | 0.5996838 | 1 |
Set the player's throw. | def wrapped(widget):
if r:
obj.player_choice = random.choice(list(evilrps.Throws))
else:
# print(widget, 'throw', throw)
obj.player_choice = throw
obj.advance() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def throw(self, currentplayer):\n\t\tif self.roll_speed < 2000:\n\t\t\tself.roll()\n\t\t\tpygame.time.set_timer(STOP_DIE, self.roll_speed)\n\t\t\tself.roll_speed = round(self.roll_speed**1.53)\n\t\telse:\n\t\t\t# Die is still. Call roll one last time and set the number\n\t\t\tprint(\"die is still\")\n\t\t\tself.nu... | [
"0.65709543",
"0.601663",
"0.5953763",
"0.5794381",
"0.5505258",
"0.5496749",
"0.5469549",
"0.5466819",
"0.54637325",
"0.5406805",
"0.5403799",
"0.53923684",
"0.5384944",
"0.5324972",
"0.52134234",
"0.51807",
"0.51762146",
"0.5167459",
"0.51670873",
"0.51628953",
"0.51511955"... | 0.6507764 | 1 |
The display names for the layout, keyed by locale. | def get_display_names(self):
return self.display_names | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unit_display_names(self) -> localedata.LocaleDataDict:\n return self._data['unit_display_names']",
"def __addDisplayNames(self, tree):\n \n display = self.__getStore(self.__data, \"display\")\n \n for key in [\"languages\", \"scripts\", \"territories\", \"variants\", \"keys... | [
"0.65902203",
"0.63141036",
"0.59343654",
"0.5896136",
"0.5887964",
"0.571129",
"0.5668694",
"0.5665444",
"0.56587344",
"0.5622306",
"0.5622306",
"0.5622306",
"0.5532029",
"0.5532029",
"0.5532029",
"0.5532029",
"0.5532029",
"0.5532029",
"0.5532029",
"0.5532029",
"0.5532029",
... | 0.68131506 | 0 |
Dead keys present, keyed by layer code. | def get_dead_keys(self):
return self.dead_keys | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _KeyMissing(side):\n return 'Key missing from %s' % side",
"def __missing__(self, key):\n global MISSING\n MISSING = key # For debugging - save name of missing key\n return INVALID",
"def check_keys(self):",
"def nonull_dict(self):\n return {k: v for k, v in self.dict.items(... | [
"0.6184343",
"0.6163819",
"0.60199106",
"0.59758276",
"0.5957718",
"0.5918987",
"0.590742",
"0.5805495",
"0.57982516",
"0.57472",
"0.56828254",
"0.56575924",
"0.55706435",
"0.5555966",
"0.5551071",
"0.55498147",
"0.553602",
"0.5524895",
"0.5492279",
"0.5481055",
"0.5466095",
... | 0.7085765 | 0 |
The items to be shown when a key is longpressed. Values are space separated in one string. | def get_longpress(self):
return self.longpress | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def display_menu(self):\n return ', '.join(menu.name for menu in self.menu.all()[:3])",
"def large_list_display(keyval: str, record: dict, title: str):\n if keyval in record:\n if len(record[keyval]):\n res = \", \".join(t[\"value\"].title() for t in record[keyval])\n res =... | [
"0.5640079",
"0.5445398",
"0.54022485",
"0.53781897",
"0.5216053",
"0.51973593",
"0.51728255",
"0.5163935",
"0.51503533",
"0.51231754",
"0.5043115",
"0.5041491",
"0.5036622",
"0.50175095",
"0.5008519",
"0.49813303",
"0.4977073",
"0.49757114",
"0.49716103",
"0.49562913",
"0.49... | 0.57792985 | 0 |
Minimum SDK can be specified for a specific layout | def get_minimum_sdk(self):
return self.minimum_sdk | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patch_sdk():",
"def patch_sdk():",
"def patch_sdk():",
"def LayoutExtension_getDefaultVersion():\n return _libsbml.LayoutExtension_getDefaultVersion()",
"def getDefaultVersion():\n return _libsbml.LayoutExtension_getDefaultVersion()",
"def _is_supported_version(cls, sdk: WindowsSDK) -> bool:\... | [
"0.5549726",
"0.5549726",
"0.5549726",
"0.5302558",
"0.5261856",
"0.5232488",
"0.51780313",
"0.51780313",
"0.5163853",
"0.5131185",
"0.5089466",
"0.5065264",
"0.5031135",
"0.50159204",
"0.49809512",
"0.49809512",
"0.49733624",
"0.49484175",
"0.49484143",
"0.49197415",
"0.4899... | 0.6702781 | 0 |
Returns a list of perunit prices for each resource. | def get_price_list(self):
# Fetch the resource info then get a copy of it
self._res_man.collect_resource_info()
res_list = self._res_man.get_resource_info()
# Pack the price response!
price_response = PriceResponse()
for res in res_list:
price = res.post_price... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_prices(self):\n pass",
"def get_prices(self):\n price = self.get_price()\n if price:\n return [price]\n return []",
"def pricing_tiers(self):\n return self._pricing_tiers",
"def dishlist_prices(n: list) -> list:\r\n return [dish.price for dish in n]",
... | [
"0.6714753",
"0.6411341",
"0.5797565",
"0.5681848",
"0.5652119",
"0.55678576",
"0.5514863",
"0.54805094",
"0.54659945",
"0.54233706",
"0.54232615",
"0.5406653",
"0.53926927",
"0.53788614",
"0.53477395",
"0.5330629",
"0.52775955",
"0.52491933",
"0.5243184",
"0.5242636",
"0.523... | 0.66409034 | 1 |
Returns the current price of the given bundle. | def _compute_bundle_price(self, bundle):
details = ''
# 1. Build a mapping from resource-specific info to price
res_to_price_map = self._res_man.get_res_to_price_mapping()
if self._use_price_token and bundle.has_price_token():
# Use token if enabled & provided. If token has e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def price(self) -> float:\n if self.product:\n price = self.product.prices.filter(active=True).first()\n return int(price.unit_amount / 100)\n return -1",
"def get_product_price(product):\n return latest_product_version(product).price",
"def get_price(self):\r\n re... | [
"0.69588786",
"0.67926645",
"0.6792079",
"0.67808473",
"0.67808473",
"0.67808473",
"0.6713399",
"0.6700769",
"0.66505605",
"0.6636159",
"0.66124856",
"0.65355116",
"0.65275353",
"0.65275353",
"0.6403931",
"0.63826656",
"0.63824165",
"0.6373656",
"0.63707584",
"0.63482493",
"0... | 0.77867067 | 0 |
Returns True if the bundle is feasible, otherwise False. If False, a reason for infeasibility is returned as well. Feasibility pertains to | def _bundle_is_feasible(self, bundle):
is_feasible = True
reason = ''
# 1. Build a mapping from resource-specific info to resource record
res_to_record_mapping = self._res_man.get_res_to_record_mapping()
# 2. Check feasibility of zones
zones = bundle.copy_zones()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_feasible(self, reaction: RetroReaction) -> bool:\n feasible, _ = self.feasibility(reaction)\n return feasible",
"def check_flag(self):\r\n # Loop over each checking result to see if it is feasible or not\r\n self.flag = True\r\n for key in self.is_feasible.keys():\r\n ... | [
"0.6595232",
"0.647888",
"0.6157761",
"0.6096559",
"0.5975216",
"0.5878665",
"0.584841",
"0.5840081",
"0.58008516",
"0.5754537",
"0.57277006",
"0.5725054",
"0.5685567",
"0.5676987",
"0.5675551",
"0.5673959",
"0.5664556",
"0.5614692",
"0.5601372",
"0.5601372",
"0.5593105",
"... | 0.6935166 | 0 |
Updates resource usage levels as a result of accepting the given bundle. | def _accept_bundle(self, bundle):
duration = bundle.duration
supply_cost = 0
# 1. Build a mapping from resource-specific info to resource record
res_to_record_mapping = self._res_man.get_res_to_record_mapping()
# 2. Add usage for zones
zones = bundle.copy_zones()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_resources(self, action, change):\n # Currently we only track total number of resources gained.\n if change.type is ChangeType.LOSS:\n return\n # The type of change should be ChangeType.GAIN if it is not ChangeType.LOSS.\n assert change.type == ChangeType.GAIN\n ... | [
"0.5329043",
"0.51712257",
"0.5116945",
"0.5046905",
"0.5043918",
"0.49968824",
"0.49490806",
"0.49222466",
"0.4785849",
"0.4771061",
"0.47685286",
"0.47432888",
"0.4739252",
"0.47347093",
"0.47280532",
"0.46981636",
"0.46888036",
"0.4668939",
"0.46645257",
"0.46629402",
"0.4... | 0.68926334 | 0 |
Return the list of valid public keys of the said user. Must be authenticated to access. Access from everyone. | def get_keys(user_id):
db_conn = sqlite3.connect(db_path)
db = db_conn.cursor()
keys = []
try:
for row in db.execute("SELECT public_key FROM public_keys WHERE username=? AND status=?", [user_id, PK_STATUS_OK]):
keys.append({"public": row[0]})
db_conn.close()
except sqlit... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_public_keys():\n return public_keys",
"def get_keys(self):\n return list(self.public_keys.keys())",
"def get_public_keys(self):\n return self.control_connection.call('get_agents_publickeys')",
"def list_user_keys(self):\n return AlgoliaUtils_request(self.headers, self.read_hos... | [
"0.75384676",
"0.73028004",
"0.6946655",
"0.6916864",
"0.68987983",
"0.6813009",
"0.67889047",
"0.6687356",
"0.6545935",
"0.6528826",
"0.64058113",
"0.63240856",
"0.6302718",
"0.62851524",
"0.62485427",
"0.6236034",
"0.62176347",
"0.6172782",
"0.6122093",
"0.6115551",
"0.6075... | 0.7573916 | 0 |
Return the list IPs of the said user. Must be authenticated to access. Access only from said user. | def get_endpoints(user_id):
db_conn = sqlite3.connect(db_path)
db = db_conn.cursor()
ips = []
try:
for row in db.execute("SELECT ip FROM ips WHERE username=?", [user_id]):
ips.append({"address": row[0]})
db_conn.close()
except sqlite3.IntegrityError:
db_conn.clos... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_ip_list(uid):\r\n session = tables.get_session()\r\n res = []\r\n if session is None:\r\n return res\r\n try:\r\n ip_table = IpAddrs()\r\n res.extend(ip_table.get_ips_by_uid(uid, session))\r\n except SQLAlchemyError as err:\r\n LOGGER.error('Get user ip list fail... | [
"0.795319",
"0.666011",
"0.6497928",
"0.6403793",
"0.63878393",
"0.63719064",
"0.63704145",
"0.6297277",
"0.62290305",
"0.6214081",
"0.62139285",
"0.61943746",
"0.6181467",
"0.6174886",
"0.61484414",
"0.6107543",
"0.59926903",
"0.59848166",
"0.5971071",
"0.59601325",
"0.59520... | 0.7062204 | 1 |
Update the list of public IPs. Must be authenticated to access. Access only from said user. | def update_endpoints(user_id):
if not request.json:
abort(400)
new_ips = request.json["ips"]
db_conn = sqlite3.connect(db_path)
db = db_conn.cursor()
db_ips = []
try:
for row in db.execute("SELECT ip FROM ips WHERE username=?;", [user_id]):
db_ips.append(row[0])
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_public_ips(self, available=False):\n raise NotImplementedError",
"def ips(self, ips):\n\n self._ips = ips",
"def _get_public_ips(self, ec2_ids):\n public_ips = []\n\n for ec2_id in ec2_ids:\n while True:\n response = self.ec2_client.describe_instan... | [
"0.61807686",
"0.5956417",
"0.58494085",
"0.5769545",
"0.5759603",
"0.57557684",
"0.57165754",
"0.5652518",
"0.5611022",
"0.5555582",
"0.550084",
"0.54947275",
"0.5474508",
"0.54668987",
"0.5459335",
"0.5434339",
"0.53766274",
"0.53693134",
"0.5358921",
"0.5346657",
"0.531700... | 0.6376176 | 0 |
Extract problem number and language from filename. | def parse_filename(f):
problem = f[2:5]
extension = f.split('.')[-1]
if extension not in langs.keys():
# if the extension isn't in our list we don't care about the file
return (None, None)
return (problem, extension) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_language_from_file_name(filename: str) -> str:\n return Path(filename).resolve().with_suffix(\"\").name",
"def get_language(fn):\n # FIXME - this expects the fn to be '.../XX/LC_MESSAGES/messages.po'\n return fn.split(os.sep)[-3]",
"def guess_problem(self, path):\n problem, ext = os.pat... | [
"0.65099007",
"0.6477955",
"0.5991345",
"0.5938866",
"0.592048",
"0.5904813",
"0.5881841",
"0.586952",
"0.58304256",
"0.5703422",
"0.570281",
"0.56935406",
"0.56826293",
"0.5662054",
"0.56574833",
"0.5641236",
"0.5618889",
"0.5614232",
"0.5544081",
"0.5519197",
"0.5504639",
... | 0.727911 | 0 |
Creates a type of Student based on the type. | def getStudent(self, studentType, name, year, args):
# studentType is either "member" or "officer"
# args is the list of arguments for that type of student
if studentType.lower() == "member":
student = Member(name, year)
# args[0] is number of events attended
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_student_and_isa(schema: Dict[Any, Any]) -> ISA:\n student = User.get_user_by_email(schema[\"client\"][\"email\"])\n if not student:\n student = Student.create_user(**schema[\"client\"])\n schema.pop(\"client\")\n schema[\"student_id\"] = student.id\n\n isa = ISA.create_isa(**schema... | [
"0.6547995",
"0.6182564",
"0.5940756",
"0.5895027",
"0.5793554",
"0.57386863",
"0.5712727",
"0.566294",
"0.56127495",
"0.5601429",
"0.5539315",
"0.5526455",
"0.5522167",
"0.544809",
"0.5425604",
"0.5386397",
"0.5375305",
"0.5346075",
"0.533195",
"0.5305634",
"0.5300623",
"0... | 0.64118683 | 1 |
get_data_from_file returns data from a file, given a path. | def get_data_from_file(self, path):
data = None
if not path:
raise RedisUpdateException("Failed to provide a path")
try:
with open(path, 'r') as _file:
data = _file.read()
print("Retrieved data from {}".format(path))
except Excepti... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_data_from_file(filepath):\n with open(filepath) as f:\n return f.read()",
"def read_file(path):\n assert_is_string(path)\n f = open(path, \"r\")\n data = f.read()\n f.close()\n return data",
"def load_data(filepath):\n with open(filepath, 'r') as f:\n data = f.read()\... | [
"0.8003186",
"0.757911",
"0.7487064",
"0.7271406",
"0.72710305",
"0.7209962",
"0.7185837",
"0.716335",
"0.71389616",
"0.7106145",
"0.7102851",
"0.70604414",
"0.7031526",
"0.7019637",
"0.69653034",
"0.68595344",
"0.6819222",
"0.6815672",
"0.68082505",
"0.6782052",
"0.67758113"... | 0.7735694 | 1 |
check the given soup for the given URL | def check_href(url, soup):
# pdb.set_trace()
ret_vals = []
href = soup.find_all("a")
for link in href:
if url in link.get("href"):
ret_vals.append(link.get("href").split(url)[1])
return list(set(ret_vals)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_url(soup):\r\n \"\"\"criteria: any(s in a[\"title\"] for s in ('新增', '確診', '肺炎')\"\"\"\r\n url_list = []\r\n for a in soup.find_all('a', {\"href\": re.compile(\"typeid=9$\")}):\r\n if any(s in a[\"title\"] for s in ('新增', '確診', '肺炎')):\r\n url = \"https://www.cdc.gov.tw\" + a['hr... | [
"0.66171163",
"0.6528606",
"0.6515215",
"0.65107447",
"0.64629287",
"0.6438142",
"0.64015216",
"0.63977945",
"0.6395195",
"0.6379726",
"0.63796556",
"0.63583046",
"0.6352542",
"0.6324256",
"0.6231188",
"0.6229653",
"0.6197432",
"0.6152754",
"0.6152524",
"0.6151828",
"0.614191... | 0.7073773 | 0 |
computes log probability of target in Gaussian with given parameters | def gaussian_log_p(params_out, x_target, dim):
mean_x, cov_x = params_out
x_diff = x_target - mean_x
x_square = tf.reduce_sum((x_diff / cov_x) * x_diff, axis=[1])
log_x_exp = -0.5 * x_square
log_cov_x_det = tf.reduce_sum(tf.log(cov_x), axis=[1])
log_x_norm = -0.5 * (dim * tf.log(2 * np.pi) + log... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def log_gaussian_likelihood(x, mu, log_std):\n log_gaussian_prob = -0.5 * (((x - mu) / (tf.exp(log_std) + EPS)) ** 2 - log_std - 0.5 * np.log(2 * np.pi))\n return tf.reduce_sum(log_gaussian_prob, axis=1)",
"def log_prob(self):",
"def log_prob(target_distribution, x0, xs, accepteds):\n return np.mean([... | [
"0.74791056",
"0.7415539",
"0.73810035",
"0.737954",
"0.71995723",
"0.71843565",
"0.7128425",
"0.7069776",
"0.7023565",
"0.70144814",
"0.7014303",
"0.701235",
"0.6959458",
"0.6924743",
"0.6915048",
"0.68896127",
"0.6878826",
"0.68766814",
"0.68624735",
"0.6858382",
"0.6854947... | 0.78899825 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.