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 |
|---|---|---|---|---|---|---|
Tests that the WebSocket communicator class works at a basic level. | async def test_websocket_communicator():
communicator = WebsocketCommunicator(SimpleWebsocketApp(), "/testws/")
# Test connection
connected, subprotocol = await communicator.connect()
assert connected
assert subprotocol is None
# Test sending text
await communicator.send_to(text_data="hello"... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_websocket_mechanics():\n transport = StringTransportWithDisconnection()\n service = hey_joe.WebSocketService(\"127.0.0.1\", 9000)\n protocol = service.buildProtocol(service._hey_joe_addr)\n protocol.transport = transport\n transport.protocol = protocol\n protocol.connectionMade()\n da... | [
"0.7846597",
"0.7782754",
"0.7449037",
"0.66974014",
"0.66103566",
"0.6532051",
"0.63701004",
"0.6330387",
"0.63042706",
"0.6287134",
"0.6279004",
"0.6273059",
"0.6245802",
"0.61889595",
"0.6154037",
"0.61453146",
"0.6130062",
"0.6119931",
"0.61080533",
"0.60784763",
"0.60631... | 0.83282965 | 0 |
Tests that the WebSocket communicator class works with the URLRoute application. | async def test_websocket_application():
application = URLRouter([path("testws/<str:message>/", KwargsWebSocketApp())])
communicator = WebsocketCommunicator(application, "/testws/test/")
connected, subprotocol = await communicator.connect()
# Test connection
assert connected
assert subprotocol is... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def test_websocket_communicator():\n communicator = WebsocketCommunicator(SimpleWebsocketApp(), \"/testws/\")\n # Test connection\n connected, subprotocol = await communicator.connect()\n assert connected\n assert subprotocol is None\n # Test sending text\n await communicator.send_to(tex... | [
"0.74799246",
"0.69562495",
"0.6856",
"0.6772796",
"0.6195489",
"0.60123605",
"0.59520346",
"0.5951708",
"0.5910753",
"0.5896098",
"0.58734983",
"0.5846708",
"0.5844705",
"0.58186597",
"0.5810855",
"0.5798235",
"0.5792869",
"0.5788756",
"0.5783835",
"0.5745958",
"0.5707827",
... | 0.78718007 | 0 |
Tests that disconnect() still works after a timeout. | async def test_timeout_disconnect():
communicator = WebsocketCommunicator(ErrorWebsocketApp(), "/testws/")
# Test connection
connected, subprotocol = await communicator.connect()
assert connected
assert subprotocol is None
# Test sending text (will error internally)
await communicator.send_t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wait_for_disconnection(timeout):\n global connected \n\n total_time = 0\n while connected and total_time < timeout:\n time.sleep(1)\n total_time += 1\n\n if connected:\n raise RuntimeError('Could not disconnect to MQTT bridge.')",
"def test_timeout_not_exceeded():\n connec... | [
"0.78407294",
"0.73595107",
"0.717897",
"0.70403147",
"0.6920722",
"0.6884152",
"0.6845338",
"0.6841184",
"0.68190217",
"0.6794173",
"0.675233",
"0.6711425",
"0.6709462",
"0.6705394",
"0.66643804",
"0.65993977",
"0.6574384",
"0.6543",
"0.65393233",
"0.65103346",
"0.65068454",... | 0.767423 | 1 |
Tests ASGI specification for the the connection scope. | async def test_connection_scope(path):
communicator = WebsocketCommunicator(ConnectionScopeValidator(), path)
connected, _ = await communicator.connect()
assert connected
await communicator.disconnect() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_check_connection(self):\n self.assertIsNotNone(app.check_connection())",
"def test_verify_connection_to_a_device():",
"def test_connection(self) -> None:\n test_connection_fn = get_test_connection_fn(self.service_connection)\n test_connection_fn(self.engine)",
"def test_connecti... | [
"0.58111703",
"0.5525358",
"0.52389884",
"0.52332205",
"0.5195364",
"0.5187229",
"0.5174704",
"0.5150601",
"0.5117487",
"0.5117487",
"0.5073024",
"0.50426185",
"0.5040893",
"0.5038699",
"0.5036132",
"0.50341666",
"0.5029843",
"0.5022746",
"0.5022064",
"0.50202715",
"0.5012794... | 0.55602294 | 1 |
Get the technology from the input parameter or raise an assertion. | def get_tech(self, tech_opt: Optional[hammer_tech.HammerTechnology]) -> hammer_tech.HammerTechnology:
self.assertTrue(tech_opt is not None, "Technology must be loaded")
assert tech_opt is not None # type checking
return tech_opt | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prompt_tech_selection(technologies=config.TECHNOLOGIES):\n print(\"Select technology number for probability analysis from:\")\n for i, tech in enumerate(technologies):\n print(f\"{i + 1}. {tech}\")\n print(\"Insert technology number for probability analysis:\")\n\n user_input = input()\n ... | [
"0.6023759",
"0.5464613",
"0.5463168",
"0.5173738",
"0.51033074",
"0.5091311",
"0.50702155",
"0.50702155",
"0.50493973",
"0.49941805",
"0.4976313",
"0.49679276",
"0.49453804",
"0.4924592",
"0.49119473",
"0.48850465",
"0.48406115",
"0.4835359",
"0.48227042",
"0.48027518",
"0.4... | 0.62498176 | 0 |
From tensorflow tutorial translate.py Read data from source and target files and put into buckets. | def read_data(source_path, target_path, opt):
data_set = [[] for _ in _buckets]
with tf.gfile.GFile(source_path, mode="r") as source_file:
with tf.gfile.GFile(target_path, mode="r") as target_file:
source, target = source_file.readline(), target_file.readline()
counte... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_data(self, source_path, target_path, max_size=None):\n data_set = [[] for _ in self._buckets]\n with tf.gfile.GFile(source_path, mode=\"r\") as source_file:\n with tf.gfile.GFile(target_path, mode=\"r\") as target_file:\n source, target = source_file.readline(), target_file.readline()\n ... | [
"0.6159113",
"0.6144334",
"0.6119013",
"0.5942282",
"0.5904216",
"0.5904216",
"0.58788633",
"0.58681214",
"0.58392465",
"0.57144594",
"0.5707089",
"0.57064843",
"0.56887674",
"0.5666588",
"0.566462",
"0.56432396",
"0.5624541",
"0.5604782",
"0.5595587",
"0.5592698",
"0.5590409... | 0.6769663 | 0 |
Return tensors key in a checkpoint file. | def tensors_key_in_file(file_name):
try:
reader = pywrap_tensorflow.NewCheckpointReader(file_name)
return reader.get_variable_to_shape_map()
except Exception as e: # pylint: disable=broad-except
print(str(e))
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_checkpoint_name(self):\n dataset_basename = Path(self._train_dataset_path).resolve().stem\n filename = \"model_cpt_{}.pkl\".format(dataset_basename)\n return filename",
"def extract_tensors_from_checkpoint_file(filename, output_folder='weights'):\n if not os.path.exists(output_fo... | [
"0.6321986",
"0.61520535",
"0.60719407",
"0.60323656",
"0.59575856",
"0.59575856",
"0.57548565",
"0.5717163",
"0.56795484",
"0.56717527",
"0.56662726",
"0.5645352",
"0.56302303",
"0.5622158",
"0.5619802",
"0.56147474",
"0.5597586",
"0.5597361",
"0.5580631",
"0.55673265",
"0.5... | 0.79168284 | 0 |
Rounds a tensor whose values are in [0,1] to a tensor with values in {0, 1}, using the straight through estimator for the gradient. | def one_hot_round(x):
g = tf.get_default_graph()
with g.gradient_override_map({"Log": "Identity"}):
x = tf.log(x)
x = 1e4 * x
with g.gradient_override_map({"Identity": "CustomGrad"}):
x = tf.identity(x, name="Identity")
with g.gradient_override_map({"Softmax": "Identity"}):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_gradient_to_tensor(x):\n return x",
"def _clip_0to1_warn(tensor_0to1):\n msg = \"Some values outside [0, 1], so clipping happened\"\n if isinstance(tensor_0to1, tf.Tensor):\n if tf.reduce_min(tensor_0to1) < 0 or tf.reduce_max(tensor_0to1) > 1:\n logger.debug(msg)\n ... | [
"0.66395307",
"0.61258894",
"0.6092261",
"0.60424596",
"0.60015225",
"0.59311134",
"0.5871849",
"0.5848265",
"0.5844342",
"0.58283174",
"0.58186597",
"0.58166295",
"0.5793238",
"0.5784018",
"0.56837785",
"0.56308585",
"0.56247044",
"0.5623522",
"0.5560255",
"0.5516721",
"0.54... | 0.6213325 | 1 |
Return True if the second interval is narrower than the first. | def does_interval_narrow((x1, y1), (x2, y2)):
assert y1 >= x1 and y2 >= x2
# Sometimes there is no variation in a dataset (more likely for steady iter
# than steady perf, for obvious reasons). So, we check for special cases,
# rather than causing a divide by zero.
diff1, diff2 = y1 - x1, y2 - x2
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def upper_contains_interval(self, other):\n if not self.contains_interval(other):\n return False\n for (i, j) in other.increasing_cover_relations():\n if not self.le(i, j):\n return False\n return True",
"def lower_contains_interval(self, other):\n ... | [
"0.71195525",
"0.6998995",
"0.6808771",
"0.65044904",
"0.6462511",
"0.6452753",
"0.64096844",
"0.6377316",
"0.6281591",
"0.6258684",
"0.62200356",
"0.62079585",
"0.6189003",
"0.61696327",
"0.616167",
"0.616167",
"0.6147845",
"0.61393744",
"0.6087529",
"0.6058126",
"0.60126305... | 0.7070427 | 1 |
Return True if all pexecs in a detailed classification dict are 'flat'. | def all_flat(classifications):
return (classifications['warmup'] == 0 and classifications['slowdown'] == 0
and classifications['no steady state'] == 0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_nss(classifications):\n\n return (classifications['warmup'] == 0 and classifications['slowdown'] == 0 and\n classifications['flat'] == 0)",
"def is_flat(self):\n if self.master:\n return self.master.is_flat\n\n return len(self.levels) == 1",
"def _does_output_dict... | [
"0.64189386",
"0.6099652",
"0.5653035",
"0.5645218",
"0.5541662",
"0.55211973",
"0.5498203",
"0.54206103",
"0.5418852",
"0.5369031",
"0.5346824",
"0.53216255",
"0.53109074",
"0.5303364",
"0.52783906",
"0.52543324",
"0.5206162",
"0.51986194",
"0.51589507",
"0.51538527",
"0.514... | 0.7308069 | 0 |
Return True if all pexecs in a detailed classification dict are 'no steady state'. | def all_nss(classifications):
return (classifications['warmup'] == 0 and classifications['slowdown'] == 0 and
classifications['flat'] == 0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def any_nss(classifications):\n\n return classifications['no steady state'] > 0",
"def all_flat(classifications):\n\n return (classifications['warmup'] == 0 and classifications['slowdown'] == 0\n and classifications['no steady state'] == 0)",
"def all_is_stopped(self):\r\n return all(no... | [
"0.762411",
"0.6539862",
"0.62332046",
"0.6231461",
"0.60690296",
"0.6060528",
"0.6052441",
"0.60428137",
"0.5957794",
"0.59479433",
"0.59453076",
"0.5896173",
"0.58896697",
"0.5853992",
"0.58524144",
"0.58216655",
"0.5814278",
"0.5814082",
"0.57616687",
"0.57366985",
"0.5729... | 0.670616 | 1 |
Return True if any pexec in a detailed classification dict is 'no steady state'. | def any_nss(classifications):
return classifications['no steady state'] > 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_nss(classifications):\n\n return (classifications['warmup'] == 0 and classifications['slowdown'] == 0 and\n classifications['flat'] == 0)",
"def all_flat(classifications):\n\n return (classifications['warmup'] == 0 and classifications['slowdown'] == 0\n and classifications['no... | [
"0.6504176",
"0.6281875",
"0.6127798",
"0.6064117",
"0.6001149",
"0.5946058",
"0.59368294",
"0.5900736",
"0.58576006",
"0.58486515",
"0.5843609",
"0.58285344",
"0.5816433",
"0.57958907",
"0.57880586",
"0.5783659",
"0.57649934",
"0.5759076",
"0.5750961",
"0.5743338",
"0.573075... | 0.76184374 | 0 |
Colour a table cell containing `text` according to `result`. | def colour_tex_cell(result, text):
assert result in (None, SAME, DIFFERENT, BETTER, WORSE)
if not text or result is None or result == SAME:
return text
if result == BETTER:
colour = 'lightgreen'
elif result == WORSE:
colour = 'lightred'
else:
colour = 'lightyellow'
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def latex_table(result, *, decimal_places=3, label=None):\n if label is None:\n label = 'tbl:stat_results'\n\n table_df = result.rankdf\n columns = table_df.columns.to_list()\n if result.omnibus != 'bayes' and result.pvalue >= result.alpha or \\\n result.omnibus == 'bayes' and len({'smalle... | [
"0.5974759",
"0.5886782",
"0.5820046",
"0.5692719",
"0.56553537",
"0.56553537",
"0.56374013",
"0.5632839",
"0.56304127",
"0.5601775",
"0.55602145",
"0.5496696",
"0.5455084",
"0.5416211",
"0.5411811",
"0.53656775",
"0.5358235",
"0.53356147",
"0.52915835",
"0.52891475",
"0.5271... | 0.8541455 | 0 |
Ensures invalid etypes are properly handled. | def test_etype__invalid(self):
for etype in ("SyntaxError", self):
self.assertRaises(TypeError, encode_string, "test", etype=etype) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _check(self, event):\n\n if self._type is None:\n if isinstance(event, Event):\n self._type = Event\n elif isinstance(event, TimeRangeEvent):\n self._type = TimeRangeEvent\n elif isinstance(event, IndexedEvent):\n self._type =... | [
"0.66437286",
"0.6566971",
"0.6563316",
"0.6551922",
"0.65134436",
"0.65087134",
"0.6320895",
"0.62911564",
"0.6279213",
"0.6250947",
"0.6138868",
"0.6125723",
"0.6123481",
"0.6116759",
"0.6116543",
"0.6082712",
"0.60820127",
"0.60807395",
"0.6070679",
"0.60660994",
"0.606301... | 0.68799794 | 0 |
Test loading string representation of pathlib object | def test_pathlib_obj(self):
"""
We do this because pygame functions internally use pg_EncodeString
to decode the filenames passed to them. So if we test that here, we
can safely assume that all those functions do not have any issues
with pathlib objects
"""
encode... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_io_path_string(args, string):\n assert deepr.io.Path(*args) == string",
"def test_load_object_from_string():\n tests = (\n (\"string.Template\", string.Template),\n (\"os.path.basename\", os.path.basename),\n (\"string.ascii_letters\", string.ascii_letters)\n )\n for tes... | [
"0.70114046",
"0.6876652",
"0.6799704",
"0.65859205",
"0.64987415",
"0.6477539",
"0.62674135",
"0.62572706",
"0.62309676",
"0.61869305",
"0.6163377",
"0.6155035",
"0.6131661",
"0.61111164",
"0.6104322",
"0.60720736",
"0.60311",
"0.60006696",
"0.5984394",
"0.5980255",
"0.59762... | 0.72583085 | 0 |
render the import/export javascript file | def script():
return Response(
response=render_template("import_export/js/import_export.js", _=_),
status=200,
mimetype="application/javascript"
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render(self, template_name, **kwargs):\n currentUser = self.current_user\n from_workspace_str = self.get_argument(\"from_workspace\", default=\"0\", strip=False)\n from_workspace = from_workspace_str == \"1\"\n html = self.render_string(template_name, currentUser=currentUser, from_w... | [
"0.6167185",
"0.6154173",
"0.60817784",
"0.60218716",
"0.59784114",
"0.59563017",
"0.59087896",
"0.57637805",
"0.57602006",
"0.57420504",
"0.5695008",
"0.56937677",
"0.56675875",
"0.5664169",
"0.5638337",
"0.56312585",
"0.56294453",
"0.56294453",
"0.55932593",
"0.5566368",
"0... | 0.7921806 | 0 |
Returns a copy of the node with the given index | def get(self, index):
return self._get_node(index) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_node(self, index):\r\n\t\tself._validate_index(index)\r\n\t\treturn self._traverse(lambda i, list: i < index)[\"node\"]",
"def get_node_from_index(self, index):\n curr = self.head\n for i in range(index):\n curr = curr.next\n return curr",
"def __get_node_at_index(self,... | [
"0.7616269",
"0.7232934",
"0.71364945",
"0.70198333",
"0.6986329",
"0.6804352",
"0.6797259",
"0.6706304",
"0.658737",
"0.64859843",
"0.64811987",
"0.64797294",
"0.64729995",
"0.6287638",
"0.62809855",
"0.6233351",
"0.6221923",
"0.6216859",
"0.61666846",
"0.6135014",
"0.612960... | 0.7483562 | 1 |
Adds a set of objects from the provided iterable to the dataset. Currently not implemented. | def add(self, iterable):
raise NotImplementedError() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extend(self, iterable):\n for item in iterable:\n self.append(item)",
"def from_iterable(self, iterable):\n raise NotImplementedError()",
"def add_to_dataset(self, dataset: Dataset):\n pass",
"def feed(self, iterable):\n self._iterable_data = iterable",
"def updat... | [
"0.65204495",
"0.6134052",
"0.60924757",
"0.60708517",
"0.5978771",
"0.5959357",
"0.57974565",
"0.578167",
"0.57700753",
"0.57527435",
"0.57477325",
"0.5730567",
"0.566769",
"0.56396884",
"0.5621166",
"0.5618412",
"0.56023794",
"0.5589368",
"0.5515248",
"0.55086917",
"0.55040... | 0.7301536 | 0 |
Updates a set of nodes from the provided iterable. Takes the indexes of the nodes and searches inside the dataset for those nodes objects. If the node exists, they are replaced in the dataset. If any node doesn't exist, it will raise an exception. | def update(self, iterable):
self._update_nodes(iterable) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nodes(self, nodes):\n global g_npoints\n for osmid, tags, (lng, lat) in nodes:\n if 'name' in tags:\n\n # Build a synthetic value by copying the tags and\n # adding osmid, latitude and longitude.\n valobj = tags.copy()\n valob... | [
"0.58827835",
"0.5808615",
"0.5802761",
"0.57497984",
"0.5679489",
"0.56087077",
"0.55330145",
"0.5497105",
"0.5273835",
"0.5261004",
"0.52054685",
"0.5193305",
"0.51713765",
"0.51593435",
"0.5153561",
"0.51482296",
"0.5137183",
"0.5136382",
"0.51119363",
"0.51111335",
"0.509... | 0.73282754 | 0 |
iChecks if an object with the given index already exists in the dataset. Not implemented. | def has(self, index):
raise NotImplementedError() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def does_exist(self, index):\n if index in self.map:\n return True\n return False",
"def index_already_there(index, given_list):\n\n # check if ID already exists\n already_there = False\n if len(given_list)>0:\n for item in given_list:\n if isinstance(item, Aut... | [
"0.72053653",
"0.68886566",
"0.68200356",
"0.6744042",
"0.6561915",
"0.6465965",
"0.64123803",
"0.6375393",
"0.633934",
"0.6336595",
"0.63253903",
"0.62738514",
"0.62136644",
"0.6205282",
"0.6204067",
"0.6186927",
"0.6171195",
"0.6118378",
"0.60891455",
"0.60656756",
"0.60626... | 0.72622806 | 0 |
Checks if the specified CUDSItem type is present in the dataset. Not implemented | def has_type(self, item_type):
raise NotImplementedError() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isItem(obType,iType):\n if iType == 'sword':\n return isinstance(obType,Sword)\n elif iType == 'axe':\n return isinstance(obType,Axe)\n elif iType == 'shield':\n return isinstance(obType,Shield)\n elif iType == 'helmet':\n return isinstance(obType,Helmet)\n else:\n ... | [
"0.6467208",
"0.61455256",
"0.60780257",
"0.59629107",
"0.5940694",
"0.5837311",
"0.5824662",
"0.58161813",
"0.58148843",
"0.5806451",
"0.56988704",
"0.5637628",
"0.56192416",
"0.5614679",
"0.55849755",
"0.55843544",
"0.5539382",
"0.5523895",
"0.55153126",
"0.55153126",
"0.55... | 0.6932288 | 0 |
Are we running on a VServer kernel? | def is_vserver_kernel():
kinfo = commands.getoutput('/bin/uname -a').split()[2]
return '-vs' in kinfo | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isSciServerComputeEnvironment():\n if os.path.isfile(\"/home/idies/keystone.token\"):\n return True\n else:\n return False",
"def check_kernel_module(params) -> None:\n if os.system(\"lsmod | grep v4l2loopback >/dev/null 2>&1\") == 0:\n print(\"Kernel module is loaded\")\n el... | [
"0.6689495",
"0.6602406",
"0.6553521",
"0.641664",
"0.6373455",
"0.6271882",
"0.6218671",
"0.6188064",
"0.6062841",
"0.6044155",
"0.6043717",
"0.6036163",
"0.6016631",
"0.6012034",
"0.5959603",
"0.59194005",
"0.59043866",
"0.5896147",
"0.58894026",
"0.5883332",
"0.58699244",
... | 0.89541066 | 0 |
Return a dictionary of vservers | def list_vservers():
result = {}
for file in os.listdir(cfg.ETC_VSERVERS):
cfgdir = os.path.join(cfg.ETC_VSERVERS, file)
if not os.path.isdir(cfgdir) or file.startswith('.'):
# not a config
continue
result[file] = get_vserver_config(file)
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_servers(self) -> dict:\n uri = f\"{self.uri}/servers\"\n\n response = self.request(uri=uri)\n return response.json()",
"def Servers(self, server=None):\n if server:\n self.current = server\n return \"successful\"\n\n servers = []\n for x in ... | [
"0.7352239",
"0.7282404",
"0.7184813",
"0.697873",
"0.6960942",
"0.68710923",
"0.6865843",
"0.68524814",
"0.68086815",
"0.6701965",
"0.6662488",
"0.6521723",
"0.6439914",
"0.63775307",
"0.63775307",
"0.63775307",
"0.63421816",
"0.63234454",
"0.6279091",
"0.62464374",
"0.61990... | 0.8184559 | 0 |
Guess which device is the one mounting our vservers partition | def guess_vserver_device():
s = commands.getoutput('/bin/mount | /bin/grep tagxid | /usr/bin/head -n 1')
device = s.split()[0]
return device | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def device_mounted(uuid):\n out, err = run_cmd(['lsblk', '-o', 'NAME,UUID,MOUNTPOINT', '--json'])\n\n blockdevices = json.loads(out)['blockdevices']\n\n for blkdevice in blockdevices:\n if key_exists('children', blkdevice):\n for child in blkdevice['children']:\n if key_ex... | [
"0.6876384",
"0.6801844",
"0.66325295",
"0.65783376",
"0.65406734",
"0.6474661",
"0.6420638",
"0.63174933",
"0.62728816",
"0.6239825",
"0.62079614",
"0.61849874",
"0.6155534",
"0.6153934",
"0.61532813",
"0.61322194",
"0.612219",
"0.60985214",
"0.609616",
"0.6091616",
"0.60912... | 0.84565496 | 0 |
Sets the ext2 immutableunlink flag. This is the special flag that only exists in a vserver kernel. | def set_file_immutable_unlink(path):
return vserver.set_file_attr(path, {'immutable':True, 'iunlink':True}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_file_immutable_unlink(path):\n\n x = vserver.get_file_attr(path)\n return x.has_key('iunlink') and x.has_key('immutable') and x['iunlink'] and x['immutable']",
"def overwrite_symlinks ( self ):\n return self.value & self.OV_SYM",
"def overwrite_dead_symlinks ( self ):\n return self.value... | [
"0.5847848",
"0.552702",
"0.53902984",
"0.5253726",
"0.52431434",
"0.5163943",
"0.5161925",
"0.5075767",
"0.49458966",
"0.48523644",
"0.4844695",
"0.48224574",
"0.48209757",
"0.48124784",
"0.4758531",
"0.4688199",
"0.46819502",
"0.46580064",
"0.46395344",
"0.46045637",
"0.458... | 0.7327351 | 0 |
Set xid of a file | def set_file_xid(path, xid):
vserver.set_file_xid(path, xid) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_volume_id_xattr(brick_path, volume_id):\n\n volume_id_bytes = uuid.UUID(volume_id).bytes\n try:\n xattr.set(brick_path, VOLUME_ID_XATTR_NAME,\n volume_id_bytes, xattr.XATTR_CREATE)\n except FileExistsError:\n pass\n except OSError as err:\n logging.error(lo... | [
"0.5662452",
"0.55343395",
"0.5443812",
"0.5432355",
"0.5369828",
"0.5324251",
"0.5299807",
"0.52932453",
"0.51923215",
"0.51657623",
"0.5136849",
"0.5119622",
"0.51094586",
"0.5106055",
"0.5082697",
"0.5073019",
"0.5071046",
"0.50520164",
"0.503836",
"0.50319314",
"0.5003676... | 0.8936207 | 0 |
Unify destination and source | def unify(src, dst):
# NOTE: at this point it is assumed files are unifiable
# get a temp file name
dir = os.path.split(src)[0]
tmp_handle, tmp_path = tempfile.mkstemp(dir=dir)
os.close(tmp_handle)
# rename the destination, in case we need to back out
os.rename(dst, tmp_path)
# link ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transcode(self, src: Path, dest: Path) -> None:\n pass",
"def Destination(self) -> _n_0_t_1:",
"def merge_nffgs (cls, target, new, log=logging.getLogger(\"UNION\")):\n # Copy Infras\n target = cls._copy_node_type_with_flowrules(new.infras, target, log)\n # Copy NFs\n target = cls._copy_n... | [
"0.5788504",
"0.54459536",
"0.5254994",
"0.52429515",
"0.5198044",
"0.5182756",
"0.5174946",
"0.5134778",
"0.508335",
"0.50743324",
"0.5069214",
"0.5024761",
"0.50240916",
"0.50172657",
"0.50108767",
"0.4999183",
"0.49957353",
"0.49585512",
"0.49463287",
"0.49201974",
"0.4919... | 0.6137023 | 0 |
Find segment and lambda from the arc length | def segment_lambda_from_arc_length(self, arc_length):
remaining_arc_length = arc_length
for segment_index, segment in enumerate(self.segments):
remaining_arc_length -= segment.length
if remaining_arc_length <= 0:
break
segment_arc_length = remaining_arc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def objective_function(lam, segment_means, segment_lengths):\n return (segment_lengths*np.power(np.sin(segment_means*np.pi/lam), 2)).sum( )",
"def segmentarc(c,u1,u2):\n\n pol1=samplearc(c,u1,polar=True)\n pol2=samplearc(c,u2,polar=True)\n sr= (c[1][3] == -2)\n if sr:\n return arc(pol1[0],p... | [
"0.6356441",
"0.5997855",
"0.597145",
"0.5960235",
"0.5844665",
"0.58139837",
"0.5801239",
"0.5682488",
"0.5677143",
"0.5643005",
"0.5625016",
"0.5617323",
"0.55745757",
"0.556204",
"0.55479735",
"0.5539863",
"0.5483387",
"0.54685843",
"0.5466805",
"0.54569274",
"0.54532564",... | 0.800567 | 0 |
Search constant by its name. The closest match is returned. | def search(self, name):
name = name.lower().strip()
exact_names = get_close_matches(name, self.possible_names, n=1)
if not exact_names:
return None
else:
exact_name = exact_names[0]
id = self.df_possible_names[self.df_possible_names['name'] == exact_n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lookup(name):",
"def lookup(name):",
"def find_byname(self, name):\n name = name.lower()\n try:\n return self.__byname[name]\n except KeyError:\n raise BadColor(name)",
"def find_by_name(self, name):\n return self.get(name)",
"def _get_const(self, const... | [
"0.6072154",
"0.6072154",
"0.60156816",
"0.592155",
"0.58955944",
"0.58886564",
"0.5822494",
"0.5804724",
"0.5804724",
"0.5804724",
"0.5798877",
"0.56406164",
"0.5612671",
"0.56105244",
"0.5587432",
"0.55825955",
"0.55278957",
"0.5512749",
"0.54923326",
"0.5491526",
"0.548551... | 0.61740345 | 0 |
Based on the offsets, construct a twodimensional numpy array representing the kernel for this footprint Returns | def kernel(self):
# Create a blank kernel the appropriate size
kernel = np.zeros((self.n_rows, self.n_cols), dtype=np.int)
# Iterate through the offsets, turning on the correct pixels
for offset in self.offsets:
row, col = offset
if np.all(offset == self.index):... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def buildKernel(self):\n\t\tkernel = list()\n\n\t\tif not self.spreadsheet_transposed:\t\t\t# If the spreadsheet is NOT transposed, i.e., the spreadsheet contains rows, transpose it so it contains columns\n\t\t\tself.transpose(1)\n\n\t\t# CALL THESE JUST ONCE BEFORE LOOP(S)\n\t\tappend = kernel.append\n\t\tlower ... | [
"0.57892334",
"0.5782892",
"0.57671285",
"0.5674213",
"0.55685824",
"0.5534629",
"0.5477897",
"0.5409036",
"0.5408241",
"0.53832936",
"0.5356599",
"0.5349643",
"0.53486323",
"0.53453076",
"0.5311754",
"0.53017473",
"0.5292515",
"0.5290548",
"0.525641",
"0.5239975",
"0.523346"... | 0.7332352 | 0 |
Parse a footprint file and return the set of all footprints | def parse(self, fp_file):
# Open the footprint file and read in all the lines
fp_fh = open(fp_file, 'r')
all_lines = fp_fh.readlines()
fp_fh.close()
# Regular expression to match footprint specification starting lines
fp_start = re.compile(r'^[A-Za-z0-9_]+\s+\d+\s+\d+\s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_footprint(self, fpname, start=True):\n logging.debug(\"get_footprint entered\")\n container_name = \"%s-metadata\" % fpname\n container = cf.get_container(container_name)\n index = container.get_object(\"index.json\")\n config = json.loads(index.fetch())\n fp = Foo... | [
"0.5866562",
"0.5567609",
"0.54892546",
"0.5445921",
"0.5369671",
"0.5356533",
"0.53186464",
"0.5311345",
"0.52697444",
"0.5261056",
"0.52503717",
"0.52503717",
"0.5242614",
"0.5193498",
"0.51700485",
"0.5036119",
"0.50025606",
"0.49922583",
"0.4991537",
"0.49863127",
"0.4983... | 0.6827772 | 0 |
Take action according to current dts state to transition application into the corresponding application state | def on_dts_state_change(self, state):
switch = {
rwdts.State.CONFIG: rwdts.State.INIT,
rwdts.State.INIT: rwdts.State.REGN_COMPLETE,
rwdts.State.REGN_COMPLETE: rwdts.State.RUN,
}
handlers = {
rwdts.State.INIT: self.init,
rwdts.State.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def state_processing_do(cfg, app, win, events):",
"def take_action(self, state):",
"def on_dts_state_change(self, state):\n\n switch = {\n rwdts.State.CONFIG: rwdts.State.INIT,\n rwdts.State.INIT: rwdts.State.REGN_COMPLETE,\n rwdts.State.REGN_COMPLETE: rwdts.State.RUN,\n... | [
"0.6751231",
"0.6737018",
"0.6700702",
"0.6605854",
"0.6595549",
"0.658307",
"0.65382284",
"0.65367454",
"0.6437536",
"0.63870806",
"0.6221867",
"0.6211691",
"0.61672914",
"0.6142612",
"0.6118229",
"0.61118853",
"0.61093575",
"0.60944104",
"0.6057256",
"0.60279703",
"0.601613... | 0.7129392 | 0 |
Creates the file geodatabase that will be used to store the enhanced layers | def create_enhancement_gdb(parent_folder):
parent_folder = Path(parent_folder)
gdb_path = parent_folder / GDB_NAME
if gdb_path.exists():
print(f'{GDB_NAME} exists. deleting and recreating with fresh data')
arcpy.management.Delete(str(gdb_path))
print('creating file geodatabase')
s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_to_geojson(self, topology_map, filename):",
"def __make_geo(self):\n # gmsh freecad_part.iges -o out_iges.geo -0\n fname_list = self.__fname.split('.')\n geo_file = fname_list[0]+'.geo'\n runstr = \"%s %s -o %s -0\" % (environment.GMSH, self.__fname, geo_file)\n print(... | [
"0.64140755",
"0.62641823",
"0.6202165",
"0.6116424",
"0.6059185",
"0.605222",
"0.60107714",
"0.6001577",
"0.59744686",
"0.5947402",
"0.59291834",
"0.59198564",
"0.5875213",
"0.58689123",
"0.586807",
"0.5847253",
"0.5775815",
"0.576099",
"0.5756685",
"0.57533234",
"0.5750134"... | 0.6561444 | 0 |
Adds the enhancement layers to the file geodatabase | def add_enhancement_layers(output_gdb):
print('adding enhancement layers')
start = default_timer()
maps = Path(__file__).parent.parent.parent / 'maps'
workspace = (maps / 'opensgid.agrc.utah.gov.sde').resolve()
with arcpy.EnvManager(workspace=str(workspace)):
for layer in enhancement_layer... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process(self):\n\n\n index = self.dlg.ui.layerCombo.currentIndex() \n if index < 0: \n # it may occur if there's no layer in the combo/legend \n pass\n else: \n layer = self.dlg.ui.layerCombo.itemData(index) \n # layer = QgsVectorLayer(self.fileName,... | [
"0.6242796",
"0.6171505",
"0.6038743",
"0.6015532",
"0.6013308",
"0.5967948",
"0.5967948",
"0.59050596",
"0.5812263",
"0.572223",
"0.5687848",
"0.5656908",
"0.56274486",
"0.558292",
"0.55808306",
"0.55644083",
"0.5520251",
"0.55125964",
"0.5510303",
"0.5506899",
"0.54786783",... | 0.7073421 | 0 |
Flatten read groups according to an indexed cmp.h5 file. | def __repackDataArrays(cH5, format, log):
SORTED = "Sorted"
alnGroups = [x for x in cH5[format.ALN_GROUP_PATH]]
pulseDatasets = [cH5[x].keys() for x in alnGroups]
uPulseDatasets = reduce(lambda x,y: set.union(set(x), set(y)), pulseDatasets)
if (not all(map(lambda x : set(x) == uPulseDatasets, pulse... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_input_files(self):\r\n\r\n for input_file in self.list_of_input_files:\r\n input_file.read_header_of_file()\r\n self.list_of_header_objects.extend(input_file.list_of_header_objects)\r\n self.list_of_header_objects_without_ID.extend(input_file.list_of_header_objects_... | [
"0.5790298",
"0.5706621",
"0.5651303",
"0.5650416",
"0.5556937",
"0.5497559",
"0.5408219",
"0.5405184",
"0.53944117",
"0.5373808",
"0.53133386",
"0.53133386",
"0.5290846",
"0.524528",
"0.5235157",
"0.5212565",
"0.5196734",
"0.5195698",
"0.5185513",
"0.5112509",
"0.5105471",
... | 0.5941377 | 0 |
This routine takes a cmp.h5 file and sorts the AlignmentIndex table adding two additional columns for fast access. In addition, a new toplevel attribute is added to the indicate that the file has been sorted, as well as a table to indicate the blocks of the alignment index associated with each reference group. | def sortCmpH5(inFile, outFile, deep, jobs, log):
success = False;
if (outFile):
log.msg("Copying: " + inFile + " to " + outFile)
shutil.copyfile(inFile, outFile)
inFile = outFile
try:
cH5 = H5.File(inFile, 'a')
format = CmpH5Format(cH5)
log.msg("Read cmp... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __repackDataArrays(cH5, format, log):\n SORTED = \"Sorted\"\n\n alnGroups = [x for x in cH5[format.ALN_GROUP_PATH]]\n pulseDatasets = [cH5[x].keys() for x in alnGroups]\n uPulseDatasets = reduce(lambda x,y: set.union(set(x), set(y)), pulseDatasets)\n if (not all(map(lambda x : set(x) == uPulseDa... | [
"0.55134934",
"0.53409845",
"0.53297716",
"0.50277156",
"0.50138175",
"0.4991076",
"0.4968862",
"0.49614686",
"0.492482",
"0.4923372",
"0.49045694",
"0.4895542",
"0.48519513",
"0.48511022",
"0.48192042",
"0.47813064",
"0.4764669",
"0.4728297",
"0.47002685",
"0.46721634",
"0.4... | 0.7361019 | 0 |
Should return status information with no project data. | def test_get_status_no_project(
get_internal_project: MagicMock,
step_writer_serialize: MagicMock,
):
get_internal_project.return_value = None
response = statuses.get_status(0, force=True)
assert response['success'], """
Expect the status process to be successful.
"""
a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_status_python_api(self):\n report = status.status()\n self.assertIn('Project information', str(report))\n self.assertIn(project_dir(), str(report))\n self.assertFalse(report.was_deployed)\n self.assertTrue(report.uncompressed_size > 10**7) # 10MB",
"async def status(... | [
"0.7062062",
"0.6955698",
"0.6765042",
"0.6761634",
"0.6694345",
"0.6653898",
"0.6605495",
"0.65974104",
"0.65974104",
"0.65960467",
"0.6593949",
"0.6593949",
"0.6568908",
"0.6535913",
"0.65292674",
"0.6528121",
"0.65251493",
"0.6522301",
"0.648856",
"0.6470435",
"0.645198",
... | 0.7271994 | 0 |
Ensure example ocrd_logging.conf is valid and produces desired record format | def test_configured_dateformat(logging_conf, capsys):
# arrange
with pushd_popd(logging_conf):
initLogging()
test_logger = getLogger('')
# act
test_logger.info("test logger initialized")
log_info_output = capsys.readouterr().out
must_not_match = r"^\d{4}-\d{2}-... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format(self, record: logging.LogRecord = None) -> str:\n # s = super().format(record)\n s = None\n e = {}\n e['id'] = uuid.uuid4().hex\n e['message'] = record.getMessage()\n # log.warning('record.message: %r', record.getMessage())\n # log.warning('record.args: %... | [
"0.61247694",
"0.56258816",
"0.5604205",
"0.55428743",
"0.5539881",
"0.5504873",
"0.5454354",
"0.54076785",
"0.53922457",
"0.5357771",
"0.5357529",
"0.53487986",
"0.53433096",
"0.5335043",
"0.5319915",
"0.53160775",
"0.5311373",
"0.530777",
"0.5292488",
"0.52874076",
"0.52751... | 0.60165334 | 1 |
Ensure example ocrd_logging.conf is valid and contains logger tensorflow | def test_configured_tensorflow_logger_present(logging_conf, capsys):
# arrange
os.chdir(logging_conf)
initLogging()
logger_under_test = getLogger('tensorflow')
# act info
logger_under_test.info("tensorflow logger initialized")
log_info_output = capsys.readouterr().out
assert not log_in... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_logs():\n tf.logging.set_verbosity(FLAGS.log)",
"def config_logging():\n logging.basicConfig(level=logging.INFO)\n logging.getLogger('deepcomp').setLevel(logging.WARNING)\n logging.getLogger('deepcomp.main').setLevel(logging.INFO)\n logging.getLogger('deepcomp.util.simulation').setLevel(lo... | [
"0.7317415",
"0.6729568",
"0.6290572",
"0.6253883",
"0.61873686",
"0.60374576",
"0.6021027",
"0.59775656",
"0.5958162",
"0.5950759",
"0.5835538",
"0.573996",
"0.57241184",
"0.56963664",
"0.56697506",
"0.56005454",
"0.5597732",
"0.557887",
"0.5544783",
"0.55210435",
"0.5499468... | 0.7387382 | 0 |
Ensure example ocrd_logging.conf is valid and contains logger shapely.geos | def test_configured_shapely_logger_present(logging_conf, capsys):
# arrange
os.chdir(logging_conf)
initLogging()
logger_under_test = getLogger('shapely.geos')
# act info
logger_under_test.info("shapely.geos logger initialized")
log_info_output = capsys.readouterr().out
assert not log_i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def config_logging():\n logging.basicConfig(level=logging.INFO)\n logging.getLogger('deepcomp').setLevel(logging.WARNING)\n logging.getLogger('deepcomp.main').setLevel(logging.INFO)\n logging.getLogger('deepcomp.util.simulation').setLevel(logging.INFO)\n # logging.getLogger('deepcomp.env.entities.us... | [
"0.5421752",
"0.5411647",
"0.5296225",
"0.52910674",
"0.5221983",
"0.51778865",
"0.51645786",
"0.5151804",
"0.5149572",
"0.50914043",
"0.5089477",
"0.50567675",
"0.505617",
"0.50507236",
"0.5037281",
"0.4995355",
"0.49911967",
"0.49799386",
"0.4974236",
"0.49687424",
"0.49468... | 0.7113788 | 0 |
Reads the pw.x input/output files, returning an ase.Atoms object. | def read_qe(qefile, task):
fileobj = open(qefile)
lines = fileobj.readlines()
fileobj.close()
if task == "PW_INP": # Reading a pw.x input file
for i, line in enumerate(lines):
if "nat" in line:
# Reading the number of atoms in the cell
if "," in line.split... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def open_input_files(self):\n self.dictionaryFile = open(self.dictionaryFile, 'r', encoding=self.encoding)\n\n if self.annotationFile :\n self.annotationFile = open(self.annotationFile, 'r', encoding=self.encoding)\n elif self.annotationFile is None:\n try:\n ... | [
"0.56746763",
"0.5525272",
"0.54529303",
"0.53594357",
"0.53447163",
"0.5335019",
"0.53095865",
"0.529924",
"0.5252906",
"0.5216417",
"0.5196917",
"0.51829803",
"0.51693296",
"0.51688325",
"0.515373",
"0.50732607",
"0.50245553",
"0.5018795",
"0.50005084",
"0.4992571",
"0.4991... | 0.5702517 | 0 |
Generate and return the addrssing array for given number of orbitals no and number of electron ne | def addressing_array(ne,no):
assert no >= ne and ne >= 0
if ne == 0: return None
Z = np.zeros(shape=(ne,no), dtype=np.int)
for k in range(1,ne):
for l in range(k,no-ne+k+1):
for m in range(no-l+1, no-k+1):
#Z[k-1][l-1] += binom(m, ne-k) - binom(m-1, ne-k-1)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_array( n ):",
"def generateArray(nEdge):\n oArray = np.zeros([nEdge**2, nEdge**2])\n \n for i in range(nEdge**2):\n for j in range(nEdge**2):\n if j == i+nEdge or j == i-nEdge or j == i+1 and i % nEdge != nEdge-1 or j == i-1 and i % nEdge != 0: # sweet...\n oA... | [
"0.6723271",
"0.5943838",
"0.59421366",
"0.5716851",
"0.5713172",
"0.566636",
"0.5636631",
"0.55930614",
"0.55477744",
"0.5502962",
"0.54706025",
"0.54706025",
"0.546624",
"0.5452541",
"0.5452433",
"0.54471254",
"0.5444344",
"0.5428794",
"0.54272497",
"0.54253453",
"0.5418641... | 0.7176256 | 0 |
Generate and return the deaddrssing array for an addressing array | def de_addressing_array(Z):
assert len(Z.shape) == 2
if(Z.shape[0] == 1): return Z.copy()
Zd = np.zeros(Z.shape, dtype=np.int)
Zd[-1] = Z[-1]
for i in range(-2,-Z.shape[0]-1,-1):
Zd[i] = np.roll(Zd[i+1],-1)+Z[i]
return Zd | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def de_addressing_single_graph(addr, Z, Zd=None):\n assert isinstance(addr,int) or isinstance(addr,np.int64)\n assert addr > 0 \n if Zd is None:\n Zd = de_addressing_array(Z)\n else:\n assert Z.shape == Zd.shape\n\n config = ['0']*Z.shape[1]\n \n io_search = [Z.shape[1]-Z.shape[0... | [
"0.5873289",
"0.5474926",
"0.54507506",
"0.52846265",
"0.52447987",
"0.52046627",
"0.5095125",
"0.5066161",
"0.5056345",
"0.5021794",
"0.49854723",
"0.49656612",
"0.49561545",
"0.495085",
"0.49330428",
"0.49301577",
"0.4925466",
"0.49226546",
"0.491053",
"0.49093813",
"0.4903... | 0.6131671 | 0 |
deaddressing address within single CASlike graph (with all possible combinations of electron occupying orbitals) | def de_addressing_single_graph(addr, Z, Zd=None):
assert isinstance(addr,int) or isinstance(addr,np.int64)
assert addr > 0
if Zd is None:
Zd = de_addressing_array(Z)
else:
assert Z.shape == Zd.shape
config = ['0']*Z.shape[1]
io_search = [Z.shape[1]-Z.shape[0], -1] # great ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clear_address(self): #DONE\n for component_name in self.__keys:\n self.address[component_name] = Component(component_name, '')",
"def zeroDummyChargesAndRemovePerturbations( intop, outtop):\n\n #Read input topology\n file = open( intop, 'r')\n text = file.readlines()\n file.clos... | [
"0.5886454",
"0.5803556",
"0.562617",
"0.5535065",
"0.5366548",
"0.53337306",
"0.5244049",
"0.5202031",
"0.5202031",
"0.51880914",
"0.5185494",
"0.5183584",
"0.5166946",
"0.5153038",
"0.51476645",
"0.5141583",
"0.5110948",
"0.50909764",
"0.50766593",
"0.5074373",
"0.50672466"... | 0.64487314 | 0 |
date = string of the form "YYMMDD" race_number = int, race number within the day | def get_race_data(date, race_number):
rec_times = get_recording_times(date)
boats = get_competitors(date, race_number)
filetime = rec_times[race_number - 1]
script_dir = os.getcwd() +"/{}/data/".format(APP_NAME)
res = {}
for val in boats + MARKS:
rel_path = "/{}/csv/{}-NAV-{}.csv".forma... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_another_date(date,mat,treasury_data,num):\r\n \r\n new_date = date.split('/')\r\n new_date[1] = str(int(new_date[1]) + num)\r\n if len(new_date[1]) == 1:\r\n new_date[1] = '0' + new_date[1]\r\n new_date = '/'.join(new_date)\r\n rf = nan_check(treasury_data,new_date,mat)\r\n\r\n ... | [
"0.5601017",
"0.538078",
"0.5323524",
"0.5304801",
"0.5268378",
"0.52659726",
"0.5235562",
"0.5210521",
"0.5171646",
"0.51213443",
"0.50949985",
"0.50940204",
"0.50483525",
"0.5045083",
"0.49893248",
"0.49773556",
"0.4972385",
"0.49702844",
"0.496112",
"0.4953251",
"0.4931512... | 0.62926924 | 0 |
This function uses linear interpolation to convert the inputs to an array of size new_length. | def interpolate(signal, new_length):
assert len(signal) > 1 and len(signal[0]) > 1
current_length = len(signal)
signal = np.array(signal).T
new_signal = []
x_array = get_x_array(current_length, new_length)
for l in range(len(signal)):
fp = signal[l]
xp = list(range(current_lengt... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def interp_data(X, X_len, restore=False, interp_kind='linear'):\n \n [T, N, V] = X.shape\n X_new = np.zeros_like(X)\n \n # restore original lengths\n if restore:\n for n in range(N):\n t = np.linspace(start=0, stop=X_len[n], num=T)\n t_new = np.linspace(start=0, stop=... | [
"0.67860705",
"0.63969696",
"0.6252995",
"0.59114856",
"0.57541865",
"0.57360965",
"0.5698424",
"0.5479085",
"0.54045284",
"0.54009944",
"0.5396296",
"0.5376491",
"0.5349612",
"0.53353363",
"0.5321927",
"0.5298455",
"0.52952784",
"0.5291103",
"0.5283552",
"0.5258536",
"0.5257... | 0.7710788 | 0 |
Create a heatmap visualization using Sentence Transformer embeddings and topics generated | def heatmap_visualization(embeddings, topics, top_n_words, width = 800, height = 800):
topics_list = topics
topics_lookup = {topic:i for i, topic in enumerate(topics_list)}
indices = np.array([topics_lookup[topic] for topic in topics_list])
embeddings = embeddings[indices]
distance_matrix = cosine_s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def visualize(list_of_words, embeddings, embedding_dimension=300, n_components=2):\n num_word = len(list_of_words)\n\n # put embeddings in a numpy matrix\n e_matrix = np.zeros((num_word, embedding_dimension))\n for idx, w in enumerate(list_of_words):\n vec = embeddings[w]\n e_matrix[idx] ... | [
"0.6645494",
"0.65269583",
"0.65047324",
"0.63373846",
"0.60334504",
"0.6014752",
"0.5994297",
"0.5945729",
"0.5942926",
"0.59293383",
"0.5916091",
"0.5856042",
"0.5846567",
"0.58297455",
"0.5828563",
"0.57539093",
"0.57154465",
"0.57135415",
"0.5709719",
"0.5680284",
"0.5643... | 0.75989 | 0 |
Get the keywords for a given instrument service | def instrument_keywords(instrument, caom=False):
# Retrieve one dataset to get header keywords
if not caom:
filter_to_add = {'program': '01440'}
else:
filter_to_add = {'proposal_id': '01440'}
sample = instrument_inventory(instrument, return_data=True, caom=caom,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_keywords(self):\r\n\t\treturn list(self.keyword_headlines().keys())",
"def getKeywords(self):\n return",
"def extract_keywords(self):\n keywords = [] \n for keyword in self.watsonLanguageModel['keywords'][:self.entitySizeLimit]: \n keywords.append(keyword['text'])\n ... | [
"0.65107113",
"0.64828",
"0.628101",
"0.6270534",
"0.61889553",
"0.6185659",
"0.61726505",
"0.6163511",
"0.6155647",
"0.6101469",
"0.60840654",
"0.6047909",
"0.60435694",
"0.602255",
"0.60207516",
"0.60160863",
"0.60146767",
"0.5983546",
"0.59235275",
"0.59021145",
"0.5883501... | 0.67527914 | 0 |
Gather a full inventory of all JWST data in each instrument service by instrument/dtype | def jwst_inventory(instruments=JWST_INSTRUMENT_NAMES,
dataproducts=['image', 'spectrum', 'cube'],
caom=False, plot=False, output_dir=None):
if output_dir is None:
output_dir = os.path.join(get_config()['outputs'], 'mast_utils')
ensure_dir_exists(output_dir)
log... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def instrument_inventory(instrument, dataproduct=JWST_DATAPRODUCTS,\n add_filters=None, add_requests=None,\n caom=False, return_data=False):\n filters = []\n\n # Make sure the dataproduct is a list\n if isinstance(dataproduct, str):\n dataproduct = [d... | [
"0.5672592",
"0.54592437",
"0.5444577",
"0.5359065",
"0.5323915",
"0.53188086",
"0.52937615",
"0.52812755",
"0.5262909",
"0.5262079",
"0.5224234",
"0.5200513",
"0.51611054",
"0.51553863",
"0.51291746",
"0.5123049",
"0.51190096",
"0.5114757",
"0.50967467",
"0.50829613",
"0.506... | 0.6388415 | 0 |
Use ``astroquery`` to search MAST for data for given observation templates over a given time range | def mast_query(instrument, templates, start_date, end_date, aperture=None, detector=None, filter_name=None,
pupil=None, grating=None, readpattern=None, lamp=None):
# If a single template name is input as a string, put it in a list
if isinstance(templates, str):
templates = [templates]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mast_query(instrument, templates, start_date, end_date, aperture=None, detector=None, filter_name=None,\n pupil=None, grating=None, readpattern=None, lamp=None):\n\n # If a single template name is input as a string, put it in a list\n if isinstance(templates, str):\n templates = [tem... | [
"0.6469005",
"0.59941757",
"0.58276594",
"0.5816321",
"0.57672024",
"0.5684908",
"0.5486107",
"0.5409615",
"0.53760725",
"0.5335272",
"0.5206296",
"0.5124651",
"0.5117202",
"0.50859195",
"0.5022982",
"0.49461192",
"0.49307558",
"0.49058333",
"0.49038935",
"0.49021292",
"0.489... | 0.64565796 | 1 |
Use ``astroquery`` to search MAST for data for given observation templates over a given time range for MIRI. MIRI is different than the other instruments in that (to find full frame flats and darks at least) you need to use the detector name rather than the aperture name. There is no full frame aperture name for the MR... | def mast_query_miri(detector, aperture, templates, start_date, end_date):
# If a single template name is input as a string, put it in a list
if isinstance(templates, str):
templates = [templates]
instrument = 'MIRI'
# instrument_inventory does not allow list inputs to
# the added_filters ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mast_query_miri(detector, aperture, templates, start_date, end_date):\n\n # If a single template name is input as a string, put it in a list\n if isinstance(templates, str):\n templates = [templates]\n\n instrument = 'MIRI'\n\n # monitor_mast.instrument_inventory does not allow list inputs t... | [
"0.67127746",
"0.6544781",
"0.6482917",
"0.54654044",
"0.4971219",
"0.47823855",
"0.4728935",
"0.4724179",
"0.47057292",
"0.46989232",
"0.4694788",
"0.46890303",
"0.46710855",
"0.46325603",
"0.46291268",
"0.45913666",
"0.45602924",
"0.45551792",
"0.4548396",
"0.4541785",
"0.4... | 0.6745049 | 0 |
Check the rules for validity, including any nested match condition definitions. The return of this function will be a cache ready structure which can be quickly fed to | def check_rules(self):
conditions = ('element', 'name', 'type')
metric = set(['type', 'value'])
elements = {}
for rule in self.rules:
if not isinstance(rule, dict):
self.fail(msg='Rule format is not type dict: %s, type: %s'
% (rule... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check(self):\n badCachePath = list()\n badCacheNode = list()\n cacheIn = getCacheInfoFromMaya()\n cacheInScene = cacheIn.getCacheFromScene()\n # get the templates\n\n if not TYPE == 'MULTI':\n cacheWorkTemplate = self.parent.app.get_template_by_name(\n ... | [
"0.6127918",
"0.588684",
"0.57237864",
"0.56862295",
"0.5672103",
"0.56623393",
"0.56317854",
"0.562719",
"0.55981314",
"0.55974495",
"0.55924094",
"0.55740637",
"0.55494255",
"0.54783195",
"0.5325147",
"0.5314797",
"0.53073996",
"0.5303276",
"0.52971905",
"0.5293184",
"0.528... | 0.7232059 | 0 |
GET /orgunittypes/ without auth or app id should result in a 200 empty response | def test_org_unit_types_list_without_auth_or_app_id(self):
response = self.client.get("/api/orgunittypes/")
self.assertJSONResponse(response, 200)
self.assertValidOrgUnitTypeListData(response.json(), 0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_org_unit_types_retrieve_without_auth_or_app_id(self):\n\n response = self.client.get(f\"/api/orgunittypes/{self.org_unit_type_1.id}/\")\n self.assertJSONResponse(response, 404)",
"def test_org_unit_types_retrieve_ok(self):\n\n self.client.force_authenticate(self.jane)\n respo... | [
"0.87519795",
"0.7420495",
"0.69041955",
"0.6516785",
"0.61798966",
"0.6130988",
"0.61043733",
"0.61042553",
"0.60826296",
"0.5991248",
"0.5978981",
"0.596227",
"0.59595525",
"0.5948186",
"0.5926202",
"0.58903813",
"0.5885066",
"0.5870741",
"0.5850269",
"0.58145046",
"0.57778... | 0.7984175 | 1 |
GET /orgunittypes// without auth or app id should result in a 200 empty response | def test_org_unit_types_retrieve_without_auth_or_app_id(self):
response = self.client.get(f"/api/orgunittypes/{self.org_unit_type_1.id}/")
self.assertJSONResponse(response, 404) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_org_unit_types_list_without_auth_or_app_id(self):\n\n response = self.client.get(\"/api/orgunittypes/\")\n self.assertJSONResponse(response, 200)\n self.assertValidOrgUnitTypeListData(response.json(), 0)",
"def test_org_unit_types_retrieve_ok(self):\n\n self.client.force_auth... | [
"0.7917087",
"0.7496427",
"0.68529516",
"0.6351911",
"0.6267484",
"0.6165139",
"0.61551106",
"0.59798086",
"0.59788877",
"0.5970946",
"0.59020483",
"0.5862904",
"0.5849123",
"0.5816277",
"0.57916224",
"0.5763007",
"0.5753423",
"0.5751714",
"0.5744749",
"0.57144815",
"0.571267... | 0.872766 | 0 |
GET /orgunittypes// happy path | def test_org_unit_types_retrieve_ok(self):
self.client.force_authenticate(self.jane)
response = self.client.get(f"/api/orgunittypes/{self.org_unit_type_1.id}/")
self.assertJSONResponse(response, 200)
self.assertValidOrgUnitTypeData(response.json()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_org_unit_types_retrieve_without_auth_or_app_id(self):\n\n response = self.client.get(f\"/api/orgunittypes/{self.org_unit_type_1.id}/\")\n self.assertJSONResponse(response, 404)",
"def test_org_unit_types_list_without_auth_or_app_id(self):\n\n response = self.client.get(\"/api/orguni... | [
"0.7792861",
"0.72541755",
"0.63437",
"0.6303301",
"0.61904985",
"0.61263895",
"0.5961862",
"0.586442",
"0.58567333",
"0.5689228",
"0.56090295",
"0.5603361",
"0.5594071",
"0.5578902",
"0.5567101",
"0.55152357",
"0.5498025",
"0.5488951",
"0.5402279",
"0.5397972",
"0.5380087",
... | 0.73408705 | 1 |
Get from db all cars with filer (is_reserved, is_published), extract 2 list values and zip them for formmenu | def get_and_zip_car_values(value1: str, value2: str) -> List[Tuple, ]:
cars_query_set = Car.objects.filter(is_reserved=False, is_published=True)
qs_values1 = cars_query_set.values_list(value1, flat=True)
qs_values2 = cars_query_set.values_list(value2, flat=True)
return list(zip(qs_values1, qs_valu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter_cars():\n session_id = request.args.get('session-id', None)\n user_id = request.args.get('user-id', None)\n current_year = get_current_year()\n brands_list = get_car_brands_list()\n car_types_list = get_car_types_list()\n car_n_seats_list = get_car_n_seats_list()\n fuel_list = get_f... | [
"0.59139043",
"0.5275359",
"0.5208677",
"0.52046597",
"0.5132771",
"0.51059645",
"0.5088419",
"0.50416356",
"0.5035081",
"0.50345224",
"0.5026754",
"0.5013709",
"0.49633855",
"0.49483165",
"0.49418488",
"0.49372485",
"0.49370825",
"0.49300706",
"0.49290493",
"0.4928514",
"0.4... | 0.5281945 | 1 |
Print listing info for given bucket_listing_ref. | def _PrintInfoAboutBucketListingRef(self, bucket_listing_ref):
obj = bucket_listing_ref.root_object
url_str = bucket_listing_ref.url_string
if (obj.metadata and
S3_DELETE_MARKER_GUID in obj.metadata.additionalProperties):
size_string = '0'
num_bytes = 0
num_objs = 0
url_str +... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _PrintInfoAboutBucketListingRef(self, bucket_listing_ref):\n uri = bucket_listing_ref.GetUri()\n obj = bucket_listing_ref.GetKey()\n uri_str = UriStrForObj(uri, obj, self.all_versions)\n\n if isinstance(obj, DeleteMarker):\n size_string = '0'\n numobjs = 0\n numbytes = 0\n else:\n... | [
"0.8071702",
"0.6915365",
"0.56834304",
"0.54459304",
"0.527316",
"0.5243719",
"0.5163612",
"0.51487136",
"0.51138014",
"0.5074873",
"0.5045974",
"0.5032961",
"0.50194407",
"0.50099623",
"0.50000405",
"0.49758828",
"0.49732974",
"0.4955691",
"0.48896468",
"0.48770925",
"0.482... | 0.80964077 | 0 |
Determine whether the given build is finished, based on its start and end times. Returns True iff the start and end times are not None and are not zero. | def IsBuildFinished(build_info):
return build_info['times'][0] and build_info['times'][1] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def complete(self):\r\n if self.scheduler_launch_time == INVALID_TIME:\r\n print \"Missing task scheduler launch time\"\r\n return False\r\n if self.node_monitor_launch_time == INVALID_TIME:\r\n\t print \"Missing task node monitor launch time\"\r\n\t return False\r\n\tif self.comp... | [
"0.6405658",
"0.62911445",
"0.6218361",
"0.6188667",
"0.61575705",
"0.61352825",
"0.61137336",
"0.61005664",
"0.6089724",
"0.60658604",
"0.6050027",
"0.6027763",
"0.60148925",
"0.60060155",
"0.5993446",
"0.5992444",
"0.5982855",
"0.59664655",
"0.59600496",
"0.59443325",
"0.59... | 0.75829697 | 0 |
Returns a dictionary containing information about the last finished build for the given builder. | def GetLastFinishedBuildInfo(builder_name, cached_builds):
cached_builds.sort(reverse=True)
for build_num in cached_builds:
build_info = GetBuildInfo(builder_name, build_num)
if IsBuildFinished(build_info):
return build_info
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getLastFinishedBuild():",
"def buildFinished(builderName, build, results):",
"def jenkins_last_build_sha():\n job_url = os.getenv('JOB_URL')\n job_json_url = \"{0}/api/json\".format(job_url)\n response = urllib.urlopen(job_json_url)\n job_data = json.loads(response.read())\n\n ... | [
"0.6950488",
"0.6725383",
"0.6226573",
"0.62182194",
"0.62095404",
"0.6201227",
"0.6110529",
"0.6029254",
"0.5919321",
"0.5867296",
"0.58318764",
"0.5745262",
"0.5694155",
"0.5687479",
"0.5677963",
"0.56628907",
"0.5619865",
"0.5617072",
"0.56155324",
"0.56118274",
"0.5604188... | 0.72532725 | 0 |
A function to read an XML file and then convert to a dictionary to make parsing easier | def read_file(fileName):
xmlFile = open(fileName, 'r', encoding='utf-8')
xmlContent = xmlFile.read()
dictContent = xmltodict.parse(xmlContent)
return dictContent | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def xml2dict( xml, sanitize=True, prefix=None):\n \n \n #Decode to avert parsing errors as some software dump large text\n #fields into the file that occasionally contain erronious chars\n xml=xml.decode('utf-8', errors='ignore')\n\n \n return etree2dict(etree.fromstring(xml), sanitize, prefix)"... | [
"0.7479079",
"0.71192545",
"0.69931227",
"0.69553673",
"0.6850332",
"0.672218",
"0.67144936",
"0.6698712",
"0.6642276",
"0.6575471",
"0.6524247",
"0.6508081",
"0.6447169",
"0.63734305",
"0.6324186",
"0.6318186",
"0.6306462",
"0.6299448",
"0.62580466",
"0.624849",
"0.6233274",... | 0.76096016 | 0 |
A function to retrieve the download link from feed.xml | def parse_xml():
fileXml = read_file('feed.xml')
doc = fileXml['response']['result']['doc'][0]
for string in doc['str']:
if string['@name'] == "download_link":
downloadLink = string['#text']
else:
logging.error('Download link not found')
return dow... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_xml_link(self, content):\n xml_link_list = content.xpath('.//a[contains(text(), \"Download CVRF\")]/@href')\n return xml_link_list[0] if xml_link_list else ''",
"def feed_link(self):\n return self.url.replace(\"http://\", \"feed://\")",
"def find_download_url(self):\n devpag... | [
"0.73582906",
"0.73199165",
"0.6675213",
"0.661293",
"0.6469607",
"0.6456378",
"0.6414975",
"0.6413918",
"0.63510025",
"0.63173676",
"0.62882024",
"0.6274512",
"0.6215606",
"0.61808395",
"0.61504894",
"0.6037488",
"0.6018359",
"0.5999268",
"0.59937847",
"0.5976878",
"0.594622... | 0.7890617 | 0 |
Process and return selected confounds from the confounds file | def _select_confounds(confounds_file, selected_confounds):
import pandas as pd
import numpy as np
import re
confounds_df = pd.read_csv(confounds_file, sep='\t', na_values='n/a')
# regular expression to capture confounds specified at the command line
confound_expr = re.compile(r"|".join(selected... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _select_confounds(confounds_file, selected_confounds):\n import pandas as pd\n import numpy as np\n confounds_df = pd.read_csv(confounds_file, sep='\\t', na_values='n/a')\n\n # fill the first value of FramewiseDisplacement with the mean.\n if 'FramewiseDisplacement' in selected_confounds:\n ... | [
"0.61706024",
"0.5782029",
"0.5781219",
"0.5617498",
"0.55832267",
"0.5558523",
"0.5510468",
"0.5485635",
"0.54848325",
"0.5472947",
"0.54597986",
"0.54544747",
"0.5445958",
"0.54365206",
"0.5391506",
"0.5335902",
"0.5331923",
"0.53286815",
"0.5294547",
"0.5281388",
"0.527861... | 0.6506794 | 0 |
Enable or disable an automation. | async def handle_action(**kwargs):
name = kwargs[NAME]
automation = automations[name]
enabled = kwargs.get(ENABLED, not automation.enabled)
if enabled:
automation.enable()
else:
automation.disable() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enable_robot(self):\n self._franka_robot_enable_interface.enable()",
"def enable(self):\n self.switch.enable()\n self._enabled = True",
"def setEnabled(*args):",
"def setEnabled(*args):",
"def setEnabled(*args):",
"def setEnabled(*args):",
"def setEnabled(*args):",
"def setEn... | [
"0.6430565",
"0.6251902",
"0.6182447",
"0.6182447",
"0.6182447",
"0.6182447",
"0.6182447",
"0.6182447",
"0.6182447",
"0.6182447",
"0.6182447",
"0.6182447",
"0.6182447",
"0.61437875",
"0.60605943",
"0.60283965",
"0.6020686",
"0.60121447",
"0.60121447",
"0.60075396",
"0.5997046... | 0.7085226 | 0 |
Process automations from config. | def _process_automations(center, config):
automations = center.data.setdefault(DATA_AUTOMATIONS, {})
conf = config[CONF_AUTOMATIONS]
for block in conf:
name = block[CONF_NAME]
_LOGGER.debug("Setting up automation %s", name)
action_sequence = _get_actions(center, block[CONF_ACTION])
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run(self, config):\n print(config) \n allfiles = os.listdir(os.path.abspath(config.strategy_dir))\n fsl = FileStrategyLoader()\n data_proxy = DataProxy(os.path.abspath(config.data_bundle_path))\n\n for elt in allfiles:\n source = fsl.load(os.path.join(os.pat... | [
"0.5915989",
"0.57050055",
"0.5595145",
"0.55544823",
"0.5431619",
"0.54138607",
"0.5387365",
"0.53721994",
"0.5331338",
"0.5331166",
"0.5325053",
"0.5276957",
"0.52756196",
"0.52403224",
"0.52227205",
"0.51847076",
"0.51810914",
"0.516543",
"0.51480204",
"0.5147645",
"0.5146... | 0.754887 | 0 |
Check if a rendered template string equals true. If value is not a string, return value as is. | def template_check(value):
if isinstance(value, str):
return value.lower() == "true"
return value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def istemplate(self, t):\n if isinstance(t, basestring):\n return t in self.template_types\n if isinstance(t, Sequence):\n return self.istemplate(t[0])\n return False",
"def rendered(template):\r\n def was_rendered(client, response, testcase):\r\n testcase.ass... | [
"0.6250817",
"0.60778534",
"0.5892008",
"0.58815795",
"0.5803603",
"0.57395256",
"0.5707433",
"0.5706601",
"0.5693218",
"0.56170267",
"0.559942",
"0.5567522",
"0.5546675",
"0.5541611",
"0.5508809",
"0.5506034",
"0.54965776",
"0.5469456",
"0.5459912",
"0.5458411",
"0.5408485",... | 0.7978751 | 0 |
Execute action with optional template variables. | async def __call__(self, variables=None):
try:
rendered = self.render(variables)
except TemplateError:
return
await self._center.actions.call(self.action_type, self.action_id, **rendered) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def execute(self, template, arguments):\n raise NotImplementedError()",
"def _exec(self, bound_names, args, kw):\n if not kw.has_key('args'):\n kw['args'] = args\n bound_names['options'] = kw\n\n try:\n response = self.REQUEST.RESPONSE\n if not respons... | [
"0.65602064",
"0.6004491",
"0.5758974",
"0.57550913",
"0.5742978",
"0.5735274",
"0.5675892",
"0.5617769",
"0.5552262",
"0.5446842",
"0.53879195",
"0.53858256",
"0.53348625",
"0.5310462",
"0.52651095",
"0.5263948",
"0.5204135",
"0.5199733",
"0.51838106",
"0.51776236",
"0.51739... | 0.645316 | 1 |
Changes format of input list containing off times, from a list of lists each containing a date, time, time, to a list of lists containing a date time, date time, both in python datetime type. | def change_format_from_input_to_datetime(list_d_t_t):
data_output = []
for row in list_d_t_t:
data_output.append([datetime.datetime.strptime(row[0] + " " + row[1], "%Y-%m-%d %H:%M:%S"),
datetime.datetime.strptime(row[0] + " " + row[2], "%Y-%m-%d %H:%M:%S")])
return data... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_datetime_objs(list_of_dates):\n datetime_list = []\n for date in list_of_dates:\n date_obj = datetime.datetime.strptime(date, '%d.%m.%Y')\n datetime_list.append(date_obj)\n return datetime_list",
"def transform_datetimes(data: Any) -> Any:\n\n if isinstance(data, (datetime, ... | [
"0.68654925",
"0.6364029",
"0.6288465",
"0.6227218",
"0.61437434",
"0.6142871",
"0.613928",
"0.6085872",
"0.60412186",
"0.603738",
"0.6029125",
"0.5884584",
"0.5877612",
"0.5870479",
"0.5870479",
"0.5825199",
"0.5822282",
"0.5790319",
"0.57827866",
"0.57587385",
"0.5704423",
... | 0.76990885 | 0 |
Puts off rows where they pass over midnight, into one row. Input and output lists are both datetime, datetime in python datetime type. | def collapse_same_day_off(list_dt_dt):
collapsed_list = []
list_iter = iter(list_dt_dt)
# read the first row
previous = next(list_iter)
collapsed_list.append(previous)
count_rows_skipped = 0
for row in list_iter:
skipped = False
while previous[1] + datetime.timedelta(sec... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_to_on_off(list_dt_dt):\n output_list = []\n\n list_iter = iter(list_dt_dt)\n\n # put the first row in the output_list - this is always off\n first_row = next(list_iter)\n\n previous_time_off_start = first_row[0]\n previous_time_off_end = first_row[1]\n\n output_list.append([previou... | [
"0.66998094",
"0.6304331",
"0.61806256",
"0.58870286",
"0.57944787",
"0.55871457",
"0.5483632",
"0.54579526",
"0.54344267",
"0.54013824",
"0.538505",
"0.5298067",
"0.5266252",
"0.52572805",
"0.52250934",
"0.5209212",
"0.51978683",
"0.51877314",
"0.51250887",
"0.5117869",
"0.5... | 0.6841505 | 0 |
If an off row has the same start and end times and these are the same minute, we are assuming that the pump was off for the entire minute, rather than just the one second. This function adds 59 seconds to the end time so that the off row can be a period of time. | def correct_off_seconds_same_minute(pump_log):
output = []
for row in pump_log:
if row[0].second == 0 and row[0] == row[1]:
row[1] = row[1] + datetime.timedelta(seconds=59)
output.append([row[0], row[1]])
else:
output.append([row[0], row[1]])
return outp... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def end(self):\r\n hours = self.length // 60\r\n minutes = self.length % 60\r\n return time(self.start.hour + hours, self.start.minute + minutes)",
"def slot_to_minutes(agent_df):\r\n slot_range = []\r\n if agent_df.loc[0, 'slot'] == 1:\r\n # transform data to datetime type\r\n ... | [
"0.5721518",
"0.5668022",
"0.5517619",
"0.5450871",
"0.5441275",
"0.53296214",
"0.5272305",
"0.52626455",
"0.52481425",
"0.52328664",
"0.5228038",
"0.5195841",
"0.51707065",
"0.51669097",
"0.51657283",
"0.5163028",
"0.516239",
"0.51542234",
"0.5150698",
"0.51391387",
"0.51253... | 0.734887 | 0 |
Convert the list of off times to a list containing the off and now on periods, which are deduced from the off times. This should be the list after it has been collapsed. Output list will contain a status, on or off. | def process_to_on_off(list_dt_dt):
output_list = []
list_iter = iter(list_dt_dt)
# put the first row in the output_list - this is always off
first_row = next(list_iter)
previous_time_off_start = first_row[0]
previous_time_off_end = first_row[1]
output_list.append([previous_time_off_start... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_on_off(self):\n self.laser_off = []\n self.laser_on = []\n\n self.laser_off.append(\n (0+self.time_to_number(self.skip['bcg_start']), self.starts[0]-self.time_to_number(self.skip['bcg_end'])))\n\n for i in range(len(self.starts)-1):\n self.laser_off.appe... | [
"0.5942776",
"0.58838075",
"0.5232749",
"0.5215545",
"0.50533724",
"0.5045575",
"0.50441617",
"0.50100267",
"0.49974123",
"0.4977477",
"0.49657625",
"0.4947541",
"0.488322",
"0.48574734",
"0.48308867",
"0.48288673",
"0.4811619",
"0.4808722",
"0.48032254",
"0.47492984",
"0.474... | 0.7695517 | 0 |
Process the input csv file to produce an output list of time periods with a status of on or off. | def process_file(input_file):
off_periods = read_file_to_list(input_file)
off_periods_datetime = change_format_from_input_to_datetime(off_periods)
off_periods_collapsed = collapse_same_day_off(off_periods_datetime)
off_periods_corrected_seconds = correct_off_seconds_same_minute(off_periods_collapsed)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_to_on_off(list_dt_dt):\n output_list = []\n\n list_iter = iter(list_dt_dt)\n\n # put the first row in the output_list - this is always off\n first_row = next(list_iter)\n\n previous_time_off_start = first_row[0]\n previous_time_off_end = first_row[1]\n\n output_list.append([previou... | [
"0.6698595",
"0.5520094",
"0.5451281",
"0.5388884",
"0.536817",
"0.5339501",
"0.5300859",
"0.52115446",
"0.51432174",
"0.514289",
"0.5124492",
"0.50918764",
"0.5023291",
"0.5003093",
"0.49918348",
"0.49545363",
"0.4941512",
"0.49003172",
"0.4881266",
"0.4874062",
"0.48702222"... | 0.6542926 | 1 |
This method will print the heading information of the members of group 18, the title of this course, along with semester and year, and the title of week three's programming assignment. | def print_header_information():
print "Elijah Molloy"
print "70-510 - Spring 1 - 2018"
print "PROGRAMMING ASSIGNMENT #4\n" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_header():\n print('------------------------------------')\n print(' Lesson04')\n print(' Kata Fourteen Assignment')\n print('------------------------------------\\n')",
"def print_header():\n print(\"STEM Center Temperature Project\")\n print(\"Shaotong Wen\")",
"def... | [
"0.7039332",
"0.62078536",
"0.60422736",
"0.5965967",
"0.5958112",
"0.5806778",
"0.5797754",
"0.57782066",
"0.5766599",
"0.5753323",
"0.5745631",
"0.5722423",
"0.57161885",
"0.56356025",
"0.558236",
"0.55608714",
"0.5559516",
"0.5542765",
"0.55308205",
"0.5530809",
"0.5524493... | 0.71069974 | 0 |
This method will set self.number_of_instances to the input specified by the user If the user doesnt enter a number or if the number is negative or not an int, and error will be thrown and the user will be asked to reenter the number. | def get_number_of_instances_from_user(self):
try:
# The int interpretation of the user input
temp = int(raw_input("Enter the number of car instances: "))
# If input is > 0
if temp > 0:
self.number_of_instances = temp
# If input is <= 0
else:
print "Number has to be an int greater than 0. P... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_number_of_players(self):\n self.number_of_players = pyip.inputInt(\n prompt='\\nEnter number of players (1 to 4):\\n', min=1, max=4)",
"def set_n_players(self):\n complain = \"\"\n while True:\n clear_output()\n try:\n self.n_players... | [
"0.6286596",
"0.61300814",
"0.5885444",
"0.57405233",
"0.5687931",
"0.5566794",
"0.55506754",
"0.55488014",
"0.55104107",
"0.54313415",
"0.54311657",
"0.54236937",
"0.54060286",
"0.53843457",
"0.5356864",
"0.53514093",
"0.52968943",
"0.528328",
"0.52659225",
"0.52459586",
"0.... | 0.7943315 | 0 |
Compiles and returns a dataframe with input for each of the specified number_of_instances | def compile_dataframe(self, number_of_instances):
# Variables for the data frame
data = []
# For each of the specified number of instances
for number in range(number_of_instances):
# Get data from the user
self.data.loc[number] = self.get_car_input_from_user() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_dataset():\n num_list = 10\n return [generate_list() for _ in range(num_list)]",
"def helper_create_data(n=500):\n N1 = list(np.random.exponential(3, n))\n N2 = list(np.random.normal(2, 2, n))\n N3 = list(np.random.normal(10, 3, n))\n N4 = list(np.random.exponential(2, n))\n C1 ... | [
"0.60682607",
"0.6000115",
"0.58080703",
"0.5716536",
"0.5665801",
"0.5645823",
"0.5636072",
"0.56239635",
"0.5602098",
"0.5531795",
"0.5514396",
"0.550714",
"0.547298",
"0.5462713",
"0.54411817",
"0.5430322",
"0.5430288",
"0.5413692",
"0.5409732",
"0.53901285",
"0.5381617",
... | 0.7950988 | 0 |
This method will continue to run until the user has successfuly entered 4 terms split by a ',' | def get_car_input_from_user(self):
try:
# Attempt to get user input, strip, and split into a list
temp = raw_input("\nEnter the make,model,type,rating: ").replace(" ", "").split(",")
# If there are 4 terms
if temp.__len__() == 4:
return temp
# Else the user needs to re-enter input correctly
el... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_sales_data():\n while True:\n print('Please enter sales data from the most recent market!')\n print('Data should consist of six numbers, separated by commas...')\n print('e.g. 10,20,30,40,50,60\\n')\n\n data_str = input('Enter your data here:\\n')\n sales_data = data_s... | [
"0.56607115",
"0.56371963",
"0.53423494",
"0.53248596",
"0.5301347",
"0.52931064",
"0.5275839",
"0.52748215",
"0.52649623",
"0.52616566",
"0.52293533",
"0.51931274",
"0.5176906",
"0.51173997",
"0.509534",
"0.50897014",
"0.5081257",
"0.5060472",
"0.4997369",
"0.49845353",
"0.4... | 0.6273915 | 0 |
Performs some statistical analysis of the information found in the dataframe | def analysis_of_dataframe(self, dataframe):
types = self.data.type.unique()
ratings = self.data.rating.unique()
print ""
# First analysis section
for rating in ratings:
percentage = format(self.data.rating.value_counts()[rating] / len(self.data.index), '.6f')
# Print probability data
print "Prob(r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def general_analysis(df):\n pass",
"def runStats(df):\n\tpass",
"def station_stats(df):",
"def do_statistics(df):\n length = len(df.index)\n df['estimated_sigma'] = [None] * length\n df['spot_price_using_estimation'] = [None] * length\n df['gap'] = [None] * length",
"def compute_statisti... | [
"0.79612815",
"0.7178537",
"0.7086904",
"0.68993396",
"0.66873556",
"0.6610612",
"0.65365547",
"0.65040934",
"0.62480193",
"0.6213112",
"0.6210634",
"0.61685586",
"0.6149655",
"0.61491674",
"0.6144531",
"0.61268765",
"0.6116363",
"0.61131746",
"0.6101653",
"0.6100367",
"0.608... | 0.73050517 | 1 |
Creates a new blog in _posts directory | def new_blog(blog, template):
path = '/'.join([POSTS, blog])
with open(path, 'w') as blg:
blg.write(template) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create():\n if request.method == 'POST':\n title = request.form['title']\n body = request.form['body']\n error = None\n\n if not title:\n error = 'Title is required.'\n\n if error is not None:\n flash(error)\n else:\n db = get_db()\n... | [
"0.6864638",
"0.67479",
"0.67477804",
"0.66002166",
"0.65436834",
"0.6527184",
"0.65090704",
"0.6486694",
"0.6477859",
"0.64658713",
"0.64590126",
"0.6427123",
"0.6339905",
"0.62365043",
"0.6236258",
"0.62283397",
"0.6222947",
"0.6198487",
"0.61887515",
"0.618649",
"0.6181178... | 0.7886004 | 0 |
This function gets a Formula which is in CNF and converts it into the DIMACSFormat so we can print it and we can pass it into Minisat to get the models of the given Formula. | def convertDIMACS(formula : Formula):
# Check the given Formula and based on what it is, print an Error or the DIMACS-Format
# This is to prevent Errors which can occur because the parsing of the atom can
# be out of Index and a Exception can get triggered.
if formula.top:
print("This is a tau... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main(formula : Formula):\n resCur() # Make sure the current counter is reseted to 0, because there can be special cases\n\n # At first parse the current formula and check if it a valid formula\n # ========================================================================================\n formula = ... | [
"0.72071767",
"0.6069457",
"0.6053993",
"0.5989677",
"0.56506276",
"0.5648253",
"0.5573189",
"0.55700403",
"0.5544513",
"0.54296607",
"0.54076314",
"0.5396811",
"0.5271507",
"0.5266738",
"0.52613264",
"0.52567655",
"0.52565664",
"0.5246221",
"0.5188609",
"0.51594937",
"0.5149... | 0.74347985 | 0 |
This function unites all the previous functions and prints out the DIMACS Format of an given Formula. | def main(formula : Formula):
resCur() # Make sure the current counter is reseted to 0, because there can be special cases
# At first parse the current formula and check if it a valid formula
# ========================================================================================
formula = parseFormu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convertDIMACS(formula : Formula):\n\n # Check the given Formula and based on what it is, print an Error or the DIMACS-Format\n # This is to prevent Errors which can occur because the parsing of the atom can\n # be out of Index and a Exception can get triggered.\n\n if formula.top:\n print(\"... | [
"0.72212255",
"0.60647696",
"0.53968775",
"0.5389918",
"0.52991533",
"0.52421236",
"0.51841915",
"0.5159153",
"0.50158346",
"0.49602193",
"0.49505815",
"0.49318668",
"0.48916543",
"0.48824206",
"0.48762527",
"0.48557943",
"0.48551357",
"0.48545882",
"0.48536608",
"0.48478547",
... | 0.7172136 | 1 |
Flip numpy array horizontally and/or vertically | def img_add_flip(arr, flip_horiz = True, flip_vert = False):
assert len(arr.shape) == 3, "'arr' input array must be three dimensional"
arr_copy = arr.copy()
if flip_horiz:
arr_copy = np.fliplr(arr_copy)
if flip_vert:
arr_copy = np.flipud(arr_copy)
return arr_copy | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vflip(img):\n if not _is_numpy(img):\n raise TypeError('img should be Numpy Image. Got {}'.format(type(img)))\n\n return np.flipud(img)",
"def flip(h):\n return np.flip(h)",
"def flip(h):\n return np.flip(h)",
"def vflip_array_deterministic(data):\n return np.concatenate([data... | [
"0.71666247",
"0.7134084",
"0.7134084",
"0.7129038",
"0.7072765",
"0.69930446",
"0.69550395",
"0.69093156",
"0.6853822",
"0.6837572",
"0.6734704",
"0.6720314",
"0.6680329",
"0.66293496",
"0.6604589",
"0.6576701",
"0.6528048",
"0.65114206",
"0.64984024",
"0.64876574",
"0.64712... | 0.7301195 | 0 |
Add horizontal stripe of randomly colored pixels within a 3d numpy array | def img_add_stripe_noise(arr, stripe_perc = 0.05, stripe_direction = 'h'):
assert len(arr.shape) == 3, "'arr' input array must be three dimensional"
assert stripe_direction in ['h', 'v'], "'stripe_direction' parameter must be 'v' or 'h'"
arr_copy = arr.copy()
noise = np.random.randint(np.max(arr), s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def slice_array():\n img = Image.open(\"flamingo.jpg\")\n image_as_array = np.array(img)\n width, height, depth = image_as_array.shape\n\n red_channel = image_as_array[:, :, 0]\n green_channel = image_as_array[:, :, 1]\n blue_channel = image_as_array[:, :, 2]\n\n top_left_corner = image_as_arr... | [
"0.634921",
"0.62790304",
"0.60071754",
"0.5766169",
"0.57275593",
"0.5699818",
"0.56754977",
"0.56370384",
"0.5598986",
"0.5544902",
"0.55061835",
"0.54984426",
"0.5471248",
"0.54204136",
"0.54203206",
"0.540413",
"0.5392354",
"0.53628814",
"0.5337484",
"0.53317845",
"0.5304... | 0.6739599 | 0 |
Parse the given dataset into a DataFrame and drop the columns accordingly. In addition, the label columns will be parsed and validated as well. | def _read_dataset_as_dataframe(
dataset: DatasetType,
label_columns: Union[str, List[str]] = None,
drop_columns: Union[str, List[str], int, List[int]] = None,
) -> Tuple[pd.DataFrame, List[str]]:
# Turn the `drop labels` into a list if given:
if drop_columns is not None:
if not isinstance(dr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _clean_dataset(df: pd.DataFrame) -> pd.DataFrame:\n df = df.loc[:, ~df.columns.str.contains(\"^Unnamed\")]\n df = df.dropna()\n return df",
"def transform(self, dataset, labels):\n print(f\"Dropping {len(self.deficient)} deficient features...\")\n dataset.drop(columns=self.deficient, i... | [
"0.66092855",
"0.6472746",
"0.62625635",
"0.61191875",
"0.6031672",
"0.6025959",
"0.59485346",
"0.5911475",
"0.5885213",
"0.58196014",
"0.581817",
"0.5814042",
"0.5748394",
"0.5745733",
"0.57405776",
"0.56543994",
"0.5654154",
"0.56294173",
"0.561429",
"0.55831367",
"0.557800... | 0.6961004 | 0 |
Set default label column names and validate given names to prepare the result set a concatenation of the inputs (x) and the model predictions (y_pred). | def _prepare_result_set(
x: pd.DataFrame, label_columns: List[str], y_pred: np.ndarray
) -> pd.DataFrame:
# Prepare default target columns names if not provided:
prediction_columns_amount = 1 if len(y_pred.shape) == 1 else y_pred.shape[1]
if len(label_columns) == 0:
# Add default label column na... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def evaluate_model(model, X_test, Y_test, category_names):\n\n Y_pred = pd.DataFrame(model.predict(X_test))\n Y_pred.columns = category_names\n Y_test = pd.DataFrame(Y_test)\n Y_test.columns = category_names\n\n for column in category_names:\n print('** {} **'.format(column).upper())\n ... | [
"0.576585",
"0.5566098",
"0.55384445",
"0.55384445",
"0.5531306",
"0.54761285",
"0.5462114",
"0.5454754",
"0.54474485",
"0.54443496",
"0.5436144",
"0.54187196",
"0.5388893",
"0.53796446",
"0.5345547",
"0.5336667",
"0.52563757",
"0.52419126",
"0.52219874",
"0.5219421",
"0.5216... | 0.7112756 | 0 |
Get the sample set statistics either from the given sample set or the statistics logged with the model while favoring the given sample set. | def _get_sample_set_statistics(
sample_set: DatasetType = None, model_artifact_feature_stats: dict = None
) -> dict:
# Check if a sample set was provided:
if sample_set is None:
# Check if the model was logged with a sample set:
if model_artifact_feature_stats is None:
raise mlru... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetSampleDistribution(self) :\r\n\t\ttry :\r\n\t\t\tSetList = self.SQLCMDs['SetList']\r\n\t\t\tSetIDs = [0,]*len(SetList)\r\n\t\t\tSetDistr = [0,]*len(SetList)\r\n\t\t\tfor ii,setname in enumerate(SetList) :\r\n\t\t\t\tself.DB_Cursor.execute(self.SQLCMDs['SelectSetID'],(setname,))\r\n\t\t\t\tSetIDs[ii] = self.... | [
"0.59484947",
"0.5920105",
"0.58307093",
"0.5754928",
"0.5754928",
"0.57124466",
"0.567356",
"0.5630148",
"0.5600303",
"0.5487813",
"0.5465591",
"0.5446476",
"0.54414093",
"0.54169345",
"0.5349506",
"0.5282865",
"0.5235726",
"0.52054214",
"0.519758",
"0.51861936",
"0.5179934"... | 0.78901225 | 0 |
Perform drift analysis, producing the drift table artifact for logging post prediction. | def _perform_drift_analysis(
sample_set_statistics: dict,
inputs: pd.DataFrame,
drift_threshold: float,
possible_drift_threshold: float,
inf_capping: float,
) -> Tuple[Artifact, Artifact, dict]:
# Calculate the input's statistics:
inputs_statistics = calculate_inputs_statistics(
samp... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run(self):\n # Convert the dataset, index: Recovered, column: log10(Susceptible)\n sr_df = self.sr_df.copy()\n sr_df[self.S] = np.log10(sr_df[self.S].astype(np.float64))\n df = sr_df.pivot_table(index=self.R, values=self.S, aggfunc=\"last\")\n # Convert index to serial number... | [
"0.595709",
"0.59046817",
"0.5893518",
"0.5707812",
"0.57028294",
"0.567945",
"0.564081",
"0.55932635",
"0.5576979",
"0.55751115",
"0.5561943",
"0.5495777",
"0.5486984",
"0.5481335",
"0.54761827",
"0.5470525",
"0.545568",
"0.5441236",
"0.5434746",
"0.5429757",
"0.540092",
"... | 0.61704874 | 0 |
Perform a prediction on a given dataset with the given model. Can perform drift analysis between the sample set statistics stored in the model to the current input data. The drift rule is the value perfeature mean of the TVD and Hellinger scores according to the thresholds configures here. | def infer(
context: mlrun.MLClientCtx,
model: str,
dataset: DatasetType,
drop_columns: Union[str, List[str], int, List[int]] = None,
label_columns: Union[str, List[str]] = None,
log_result_set: bool = True,
result_set_name: str = "prediction",
batch_id: str = None,
perform_drift_anal... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def predict(self, model, x_test):\n pass",
"def predict(data, model_predict):\n # Execute any steps you need to do before scoring\n\n # This method makes predictions against the raw, deserialized model\n #predictions = model_predict(data)\n\n data.to_csv(\"/opt/code/chemprop_folder/for_scoring... | [
"0.6358765",
"0.62582546",
"0.6226131",
"0.6189818",
"0.6043333",
"0.60198283",
"0.6013514",
"0.6009691",
"0.6007771",
"0.5970836",
"0.5933922",
"0.59321326",
"0.58611965",
"0.58581024",
"0.58296174",
"0.58277106",
"0.5824785",
"0.5810545",
"0.58077455",
"0.5745046",
"0.57348... | 0.691889 | 0 |
applies rolling mean and delayed returns to each dataframe in the list | def applyRollMeanDelayedReturns(datasets, delta):
for dataset in datasets:
columns = dataset.columns
adjclose = columns[-2]
returns = columns[-1]
for n in delta:
addFeatures(dataset, adjclose, returns, n)
return datasets | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_rolling_mean(df, window):\n # return pd.rolling_mean(values, window=window)\n rolling_df=pd.DataFrame(index=df.index)\n for sym in df.columns:\n df_tmp= pd.Series.rolling(df[sym],window=window).mean().to_frame() # to_frame converts series to a data frame\n rolling_df=rolling_df.join(... | [
"0.62971514",
"0.6015346",
"0.59492964",
"0.592736",
"0.5869358",
"0.5827889",
"0.5819424",
"0.5752174",
"0.5696008",
"0.56799597",
"0.56679505",
"0.56592315",
"0.5649104",
"0.5620702",
"0.5599412",
"0.5545161",
"0.55284816",
"0.5486915",
"0.5468352",
"0.54458827",
"0.5424606... | 0.7195473 | 0 |
apply time lag to return columns selected according to delta. Days to lag are contained in the lags list passed as argument. Returns a NaN free dataset obtained cutting the lagged dataset at head and tail | def applyTimeLag(dataset, lags, delta):
# need to shift the y value back a day so we're predicting
# next day price, rather than today!
dataset.Return_Out = dataset.Return_Out.shift(-1)
maxLag = max(lags)
columns = dataset.columns[::(2*max(delta)-1)]
for column in columns:
for... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lagged_features(df, lags):\n df_list = []\n for lag in lags:\n df_shifted = df.shift(lag)\n df_shifted.columns = [x + \"_lag\" + str(lag) for x in df_shifted.columns]\n df_list.append(df_shifted)\n fea = pd.concat(df_list, axis=1)\n return fea",
"def lagger(\n dataset:pd.D... | [
"0.6808244",
"0.6593414",
"0.6301454",
"0.6232491",
"0.618436",
"0.6087152",
"0.59517294",
"0.57472193",
"0.57472193",
"0.5693447",
"0.5590369",
"0.5418525",
"0.5396093",
"0.5297099",
"0.5253656",
"0.5201201",
"0.5199955",
"0.51596856",
"0.51339316",
"0.5116295",
"0.5027889",... | 0.73529947 | 0 |
Calc pvalues for coef estimates | def calc_p_val(x_train: np.ndarray, weights: np.ndarray, intercept: float) -> Tuple[np.ndarray, np.ndarray]:
coef_ = np.concatenate([weights, [intercept]])
x_train = np.concatenate([x_train, np.ones((x_train.shape[0], 1))], axis=1)
prob_ = 1 / (1 + np.exp(-np.dot(x_train, coef_)))
prob_ = prob_ * (1 - p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def logit_pvalue(model, x, verbose=False):\n probs = model.predict_proba(x)\n n_datapoints = probs.shape[0]\n n_feautures = len(model.coef_[0]) + 1\n coeffs = np.hstack([model.intercept_.reshape(-1, 1), model.coef_])\n x_full = np.matrix(np.insert(np.array(x), 0, 1, axis=1))\n pvals = []\n err... | [
"0.69047546",
"0.6686758",
"0.6678706",
"0.6584823",
"0.64450246",
"0.6422793",
"0.64085597",
"0.6387613",
"0.63414556",
"0.62037027",
"0.61048937",
"0.6087783",
"0.6030533",
"0.6030533",
"0.6007318",
"0.59993994",
"0.59742576",
"0.59694886",
"0.59454364",
"0.59172463",
"0.59... | 0.7143521 | 0 |
Add warmup decay to a learning rate schedule. | def __init__(
self,
lr_schedule: tf.keras.optimizers.schedules.LearningRateSchedule,
warmup_steps: int,
**kwargs):
super(WarmupDecaySchedule, self).__init__()
self._lr_schedule = lr_schedule
self._warmup_steps = warmup_steps | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def adjust_learning_rate(optimizer, epoch, lr, schedule, gamma, num_gpus=1, warmup=5):\n if epoch in schedule:\n lr *= gamma\n if num_gpus > 1 and epoch < warmup:\n param_lr = lr * (epoch + 1) / warmup\n else:\n param_lr = lr\n for param_group in optimizer.param... | [
"0.7005632",
"0.6841199",
"0.67021495",
"0.668435",
"0.66736406",
"0.66736406",
"0.66681194",
"0.66065794",
"0.6517671",
"0.6463484",
"0.63832265",
"0.6369079",
"0.63663036",
"0.63535094",
"0.6343438",
"0.6340109",
"0.6324249",
"0.63002986",
"0.6272357",
"0.62689996",
"0.6240... | 0.72938305 | 0 |
Add multiple favorites to cart | def add_favorites(request):
try:
db_logger.info("DEBUT cart/add_favorites")
data: dict = json.loads(request.body) # get json body
# get cart
cart: Cart = Cart(request)
db_logger.info(f"cart => {cart}")
# adding articles to cart
for item in data:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def favorite(self):\n url = \"https://api.imgur.com/3/album/{0}/favorite\".format(self.id)\n return self._imgur._send_request(url, needs_auth=True, method=\"POST\")",
"def add_to_fav(request, q_id):\n if request.method == 'POST':\n Quotes.objects.add_to_user_fav(request.session['id'], q_i... | [
"0.62442267",
"0.6193544",
"0.6075221",
"0.6014542",
"0.5980497",
"0.5974541",
"0.5969162",
"0.59569997",
"0.59424376",
"0.59181875",
"0.5879195",
"0.5875623",
"0.587539",
"0.5869575",
"0.58253115",
"0.58151233",
"0.5814777",
"0.58070767",
"0.5789645",
"0.5786962",
"0.5716183... | 0.72269887 | 0 |
Show documentation about organizationCount | def organization_count_doc_template_values(url_root):
required_query_parameter_list = [
{
'name': 'api_key',
'value': 'string (from post, cookie, or get (in that order))', # boolean, integer, long, string
'description': 'The unique key provided to any org... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_public_narrative_count():\n client_workspace = MongoClient(mongoDB_metrics_connection+to_workspace)\n db_workspace = client_workspace.workspace\n public_narrative_count = db_workspace.workspaceACLs.find({\"user\" : \"*\"}).count()\n return public_narrative_count;",
"def display_count():\n ... | [
"0.6653277",
"0.65414995",
"0.6185439",
"0.61053",
"0.60954654",
"0.6062773",
"0.60012287",
"0.59246296",
"0.59246296",
"0.59246296",
"0.59246296",
"0.5917317",
"0.58938795",
"0.58929",
"0.58307874",
"0.5827262",
"0.5823044",
"0.5806844",
"0.57916033",
"0.5779324",
"0.5744545... | 0.6554118 | 1 |
CatalogInventoryDataStockItemInterface a model defined in Swagger | def __init__(self, item_id=None, product_id=None, stock_id=None, qty=None, is_in_stock=None, is_qty_decimal=None, show_default_notification_message=None, use_config_min_qty=None, min_qty=None, use_config_min_sale_qty=None, min_sale_qty=None, use_config_max_sale_qty=None, max_sale_qty=None, use_config_backorders=None, b... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __getitem__(self, item):\n return self.get_data(stock=item)",
"def test_put_stock(self):\n body = StockProduct()\n response = self.client.open(\n '/omogollo2/ServerAPI/1.0.0/stock/{productId}'.format(product_id=56),\n method='PUT',\n data=json.dumps(body)... | [
"0.57443273",
"0.5675039",
"0.5566507",
"0.55040306",
"0.54687744",
"0.54646724",
"0.5391064",
"0.53758407",
"0.5336137",
"0.5325175",
"0.5324901",
"0.5318489",
"0.5282336",
"0.52499646",
"0.52499646",
"0.52388936",
"0.52093613",
"0.5167882",
"0.5158624",
"0.51466215",
"0.514... | 0.688116 | 0 |
Gets the item_id of this CatalogInventoryDataStockItemInterface. | def item_id(self):
return self._item_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stock_id(self):\n return self._stock_id",
"def order_item_id(self):\n return self._order_item_id",
"def get_itemId(self):\n return self.metadata['itemId']",
"def GetId(self,item):\r\n id = self.item_itemId.get(item)\r\n if id: return id\r\n #--Else get a new item... | [
"0.70481545",
"0.6394949",
"0.63537437",
"0.6227357",
"0.62106854",
"0.60527754",
"0.6039887",
"0.6038565",
"0.5804342",
"0.58005244",
"0.57790655",
"0.57663375",
"0.57582194",
"0.5614914",
"0.5595436",
"0.5580783",
"0.5571571",
"0.55464786",
"0.5525368",
"0.5523973",
"0.5514... | 0.71998966 | 0 |
Sets the product_id of this CatalogInventoryDataStockItemInterface. | def product_id(self, product_id):
self._product_id = product_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def product_id(self, product_id):\n self._product_id = product_id",
"def product_id(self, product_id):\n if product_id is None:\n raise ValueError(\"Invalid value for `product_id`, must not be `None`\") # noqa: E501\n\n self._product_id = product_id",
"def onchange_product_id(s... | [
"0.74669313",
"0.6953989",
"0.63725036",
"0.62200963",
"0.61829567",
"0.61829567",
"0.60424674",
"0.6032829",
"0.6020754",
"0.5992049",
"0.5854644",
"0.5817941",
"0.5766708",
"0.5766708",
"0.57373655",
"0.57351923",
"0.57351923",
"0.57351923",
"0.57351923",
"0.5708441",
"0.56... | 0.7531318 | 1 |
Gets the stock_id of this CatalogInventoryDataStockItemInterface. Stock identifier | def stock_id(self):
return self._stock_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def C_stock(self):\n return self._C_stock",
"def Q_stock(self):\n return self._Q_stock",
"def stock_id(self, stock_id):\n\n self._stock_id = stock_id",
"def get_data(self, stock=None):\n if stock is None:\n return self.stock_data\n else:\n return self.... | [
"0.6304016",
"0.5931868",
"0.5908567",
"0.5864356",
"0.58624685",
"0.58015144",
"0.5726443",
"0.5688612",
"0.5661271",
"0.5576225",
"0.55732775",
"0.5564717",
"0.55576533",
"0.55437297",
"0.5526674",
"0.54739916",
"0.5455767",
"0.5455087",
"0.5450355",
"0.54257244",
"0.539785... | 0.8470072 | 0 |
Sets the stock_id of this CatalogInventoryDataStockItemInterface. Stock identifier | def stock_id(self, stock_id):
self._stock_id = stock_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stock_id(self):\n return self._stock_id",
"def update_stock(self, productid, new_stock):\n\n cur.execute(\"\"\"UPDATE catalogue SET stock = ? WHERE productid = ? AND vendorname = ?\"\"\",\n (new_stock, productid, self.vendorname))",
"def in_stock(self, in_stock):\n\n ... | [
"0.71381825",
"0.631002",
"0.6084863",
"0.57983726",
"0.5775996",
"0.564319",
"0.554806",
"0.55253655",
"0.5441028",
"0.5424963",
"0.5389306",
"0.5385689",
"0.5335661",
"0.5324169",
"0.5208776",
"0.5177415",
"0.5172001",
"0.51447386",
"0.50023913",
"0.49898294",
"0.49841952",... | 0.8315286 | 0 |
Gets the is_in_stock of this CatalogInventoryDataStockItemInterface. Stock Availability | def is_in_stock(self):
return self._is_in_stock | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_in_stock(self, is_in_stock):\n if is_in_stock is None:\n raise ValueError(\"Invalid value for `is_in_stock`, must not be `None`\")\n\n self._is_in_stock = is_in_stock",
"def get_stock_availability(self, ingredient: str) -> int:\n return self.inventory_availability.get(ingre... | [
"0.73722935",
"0.7302909",
"0.6854444",
"0.6708101",
"0.6665655",
"0.66597736",
"0.66574126",
"0.65677315",
"0.6536677",
"0.6278739",
"0.62087494",
"0.6157041",
"0.6139962",
"0.611659",
"0.6100452",
"0.60479337",
"0.60232437",
"0.5953882",
"0.59485924",
"0.59171706",
"0.57750... | 0.82110953 | 0 |
Sets the is_in_stock of this CatalogInventoryDataStockItemInterface. Stock Availability | def is_in_stock(self, is_in_stock):
if is_in_stock is None:
raise ValueError("Invalid value for `is_in_stock`, must not be `None`")
self._is_in_stock = is_in_stock | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def in_stock(self, in_stock):\n\n self._in_stock = in_stock",
"def is_in_stock(self):\n return self._is_in_stock",
"def get_stock_availability(self, ingredient: str) -> int:\n return self.inventory_availability.get(ingredient, 0)",
"def stock_id(self, stock_id):\n\n self._stock_id... | [
"0.84412104",
"0.6835351",
"0.58217704",
"0.5664463",
"0.5609132",
"0.5587455",
"0.55353945",
"0.5432565",
"0.53933406",
"0.5369717",
"0.5356668",
"0.5339389",
"0.531997",
"0.53141505",
"0.53077096",
"0.53025264",
"0.5287501",
"0.52039045",
"0.5155199",
"0.5152905",
"0.508977... | 0.84844214 | 0 |
Gets the is_qty_decimal of this CatalogInventoryDataStockItemInterface. | def is_qty_decimal(self):
return self._is_qty_decimal | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_qty_decimal(self, is_qty_decimal):\n if is_qty_decimal is None:\n raise ValueError(\"Invalid value for `is_qty_decimal`, must not be `None`\")\n\n self._is_qty_decimal = is_qty_decimal",
"def _qty_precision(self) -> int:\n return selectors.get_exchange(self.exchange).vars['... | [
"0.6803456",
"0.6142749",
"0.6049621",
"0.6049621",
"0.6049621",
"0.6004174",
"0.59924054",
"0.5894872",
"0.5580495",
"0.5558818",
"0.54297346",
"0.540402",
"0.5363313",
"0.53370917",
"0.5286558",
"0.5284881",
"0.52810407",
"0.5275285",
"0.52329177",
"0.522704",
"0.51969975",... | 0.7810372 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.