query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
r"""``BrickworkVertex`` constructor, used to instantiate a ``BrickworkVertex`` object. This class describes the vertices on the brickwork graph in UBQC. It stores parameters including positions, rotation encryption angles, flipping encryption angles, commands, and measurement outcomes of every vertices on the graph. Th...
def __init__(self, position): if not isinstance(position, Tuple): raise Error.ArgumentError(f"Invalid position ({position}) with the type: `{type(position)}`!\n" "Only `Tuple` is supported as the type of vertex position.", M...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(\n self,\n front_left_vertex,\n front_right_vertex,\n back_left_vertex,\n back_right_vertex,\n strength,\n ):\n\n self.front_left_vertex = front_left_vertex\n self.front_right_vertex = front_right_vertex\n self.back_left_vertex = back_l...
[ "0.6088341", "0.60382336", "0.6020477", "0.5986267", "0.58028316", "0.5740777", "0.5723874", "0.56970114", "0.5695373", "0.56863564", "0.5641895", "0.55746686", "0.55693597", "0.55650014", "0.5542146", "0.55408955", "0.5518685", "0.5486055", "0.54857635", "0.5483729", "0.5480...
0.59337527
4
r"""Set the rotation encryption angle.
def set_rotation_encryption_angle(self, angle: float = 0.0): if not isinstance(angle, float): raise Error.ArgumentError(f"Invalid rotation encryption angle ({angle}) with the type: `{type(angle)}`!\n" "Only `float` is supported as the type of rotation encryption...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_rotation(self, angle):\n self._rotation = angle\n self._reset_slot_bounds()", "def set_angle(self, angle=0.0):\n self.angle = angle", "def setAngle(self,angle = 2.5):\n pass", "def set_angle(self, angle_key: Union[EKT, str], v: float): # -> None:\n ...", "def setA...
[ "0.76821864", "0.7664807", "0.7623878", "0.7573403", "0.73777705", "0.7322487", "0.7282922", "0.72192645", "0.7204377", "0.7188211", "0.7136866", "0.7116", "0.70408934", "0.6965605", "0.6953462", "0.68693155", "0.6801654", "0.6785144", "0.6744302", "0.6738195", "0.6714269", ...
0.7831832
0
r"""Get the rotation encryption angle.
def get_rotation_encryption_angle(self): return self.__rotation_encryption_angle
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rotation_angle(self):\n return self.container['rotation_angle']", "def get_angle(self):\n return self.__angle", "def get_rotation_angle(self, image):\n \n # TODO: Make real functionality\n return 0", "def getAngle(self):\n return self.articulateEncoder.getDistanc...
[ "0.8083041", "0.77014714", "0.7632532", "0.7602805", "0.757247", "0.757247", "0.757247", "0.7519369", "0.7491308", "0.74265724", "0.7328161", "0.7316984", "0.7316984", "0.7304388", "0.7233309", "0.7233309", "0.7233309", "0.7233309", "0.7233309", "0.7233309", "0.7233309", "0...
0.8862042
0
r"""Set the flipping encryption angle.
def set_flipping_encryption_angle(self, angle: float = 0.0): if not isinstance(angle, float): raise Error.ArgumentError(f"Invalid flipping encryption angle ({angle}) with the type: `{type(angle)}`!\n" "Only `float` is supported as the type of flipping encryption...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_flip(self, val):\n self.flip = val", "def get_flipping_encryption_angle(self):\n return self.__flipping_encryption_angle", "def change_angle(self, new_angle):\r\n self.angle = new_angle", "def setAngle(self,angle = 2.5):\n pass", "def set_angle(self, angle_key: Union[EKT...
[ "0.687286", "0.6716123", "0.6335325", "0.631911", "0.62229604", "0.6197563", "0.61540425", "0.61160064", "0.6096172", "0.6092029", "0.6060821", "0.59996134", "0.5961152", "0.5952882", "0.59395134", "0.5930168", "0.59186363", "0.58813536", "0.5878858", "0.5869153", "0.5830182"...
0.7819768
0
r"""Get the flipping encryption angle.
def get_flipping_encryption_angle(self): return self.__flipping_encryption_angle
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def angle(self) -> int:", "def dec(self):\n return self.dec_angle", "def get_rotation_encryption_angle(self):\n return self.__rotation_encryption_angle", "def angle(self):\n return 0", "def do_altangle(self):\n nave = 10000\n x, y, z, angle = cbp.phidget.main(nave)\n ...
[ "0.69854754", "0.69019073", "0.6742186", "0.67042106", "0.6651489", "0.66482645", "0.6533207", "0.64979774", "0.64979774", "0.64979774", "0.64794314", "0.6459664", "0.6430557", "0.6385531", "0.6371917", "0.6272651", "0.62631196", "0.6236495", "0.6236495", "0.6233523", "0.6155...
0.86466706
0
r"""Record the commands executed on this vertex.
def record_commands(self, which_command): name: str = which_command.name if not {name}.issubset(['M', 'X', 'Z', 'S']): raise Error.ArgumentError(f"Invalid command name: ({name})!\n" "Only 'M', 'X', 'Z' and 'S' are supported as the " ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cmd(self):", "def commands():", "def getCommands(self):", "def command(self):\n raise NotImplementedError", "def send_command(self):\n self.connection.sendline(self.command_string)", "def commands():\n pass", "def commands():\n pass", "def commands():\n pass", "def comman...
[ "0.61793786", "0.6094067", "0.602336", "0.6007731", "0.5964867", "0.5957468", "0.5957468", "0.5957468", "0.5957468", "0.5948331", "0.58627695", "0.5849966", "0.5788477", "0.57847494", "0.5781361", "0.57724094", "0.5720134", "0.570017", "0.5694064", "0.56798655", "0.5619725", ...
0.7000344
0
r"""Get the commands executed on this vertex.
def get_commands(self): return self.__commands
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_commands(self):\r\n return self._commands", "def get_commands(self):\n return self._commands", "def get_commands(self):\n return list(self.commands.values())", "def getCommands(self):", "def getCommands(self):\n\n return self.__commands", "def commands(self) -> typing....
[ "0.8018566", "0.7907294", "0.7752495", "0.77423847", "0.77380425", "0.75126904", "0.7499979", "0.74929905", "0.7490005", "0.7472985", "0.7385021", "0.7361146", "0.72839993", "0.72475225", "0.7137789", "0.7110128", "0.7070801", "0.7060199", "0.70554346", "0.70365673", "0.69661...
0.78590924
2
r"""Record the measurement outcome of this vertex.
def record_outcome(self, outcome: int): self.__outcome = outcome if abs(self.__flipping_encryption_angle - 0) < eps else (outcome + 1) % 2
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def record_v(self, to_file=None):\n if (not hasattr(self.vertex, \"record_v\")\n or not callable(self.vertex.record_v)):\n raise Exception(\"Vertex does not support recording of potential\")\n\n self.vertex.record_v()\n self.recordVFile = to_file", "def record(self,...
[ "0.59300834", "0.5847309", "0.58176243", "0.5779906", "0.57313776", "0.5729821", "0.56864166", "0.5646127", "0.563766", "0.56119275", "0.55702245", "0.555043", "0.55296355", "0.55114", "0.550018", "0.54850644", "0.5423996", "0.5393706", "0.53919315", "0.5378228", "0.53728217"...
0.524817
35
r"""Get the decrypted measurement outcome of this vertex.
def get_outcome(self): return self.__outcome
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_ciphertext(self):\n return b64decode(self.cipherblock[\"ciphertext\"])", "def voltage(self):\n return self.outputValue()", "def getDec(self):\n return self._dec", "def fetch(self):\n return read_voltage()", "def _get_encryption_level(self):\n return self._...
[ "0.60639423", "0.57167095", "0.56900346", "0.5583803", "0.5582433", "0.5533282", "0.5532581", "0.5525212", "0.5522186", "0.54954034", "0.5487863", "0.54571486", "0.5429217", "0.54235405", "0.541906", "0.54111814", "0.5393627", "0.5369409", "0.5369409", "0.53515196", "0.534944...
0.5212479
41
r"""``PlatformClient`` constructor, used to instantiate a ``PlatformClient`` object. This class contains methods for the client to communicate with server according to the UBQC protocol. In theory, quantum states are transmitted through the quantum channel. And classical messages are transmitted through the classical c...
def __init__(self, shots: int, program: PBProgram): self.ws_opened = threading.Event() self.__shots = shots self.__shot_finished = [False for _ in range(self.__shots)] self.__shot_inboxes = [Queue() for _ in range(self.__shots)] self.__bar = None self.__ws_conn = None ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args, **kwargs):\n self.driver = importutils.import_module(CONF.network_driver)\n\n self.q_conn = quantum_connection.QuantumClientConnection()\n self.m_conn = melange_connection.MelangeConnection()\n self.a_conn = aiclib_connection.AICLibConnection()\n\n # NOT...
[ "0.6342144", "0.58726734", "0.5861861", "0.58163327", "0.5774407", "0.5766261", "0.5758673", "0.5735032", "0.5712267", "0.56664306", "0.5645599", "0.5571515", "0.5569316", "0.5564569", "0.55444485", "0.5540637", "0.5513083", "0.55036163", "0.5475406", "0.5472663", "0.5464094"...
0.0
-1
r"""Extract the shape (width and depth) of the brickwork graph.
def __extract_graph_shape(self): circuit = UbqcClient.pb_to_circuit(self.program) bw_pattern = transpile_to_brickwork(circuit) # Get shape input_ = bw_pattern.input_ c_out, q_out = bw_pattern.output_ output_ = c_out + q_out width = len(input_) depth = out...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shape(self):\n return self._shape", "def shape(self):\n for component in ('x', 'y', 'z', 'r', 't'):\n arr = getattr(self, component)\n if arr is not None:\n return arr.shape\n return ()", "def shape(self):\r\n return self._shape", "def get_shap...
[ "0.6799083", "0.6759419", "0.6680564", "0.6645674", "0.66435516", "0.65854514", "0.6585352", "0.6585352", "0.6560133", "0.6560133", "0.65037256", "0.65037256", "0.6470245", "0.6441111", "0.64236134", "0.640771", "0.6388143", "0.6370989", "0.63567615", "0.63567615", "0.6356761...
0.8227789
0
r"""Open the 'websocket' connection.
def on_open(self, ws): self.__bar = tqdm(range(0, self.__shots), desc='shots computing...', unit=' shot') self.__ws_conn = ws self.ws_opened.set()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def open(self):\n try:\n self.error_count = 0\n self.conn_thread = Thread(target=self.connect, name='Websocket Connection')\n self.conn_thread.start()\n except Exception as e:\n self.conn_thread.join()\n self.on_error(self.ws, \"Error from openni...
[ "0.7575077", "0.73601925", "0.7334897", "0.73174983", "0.7165801", "0.70880973", "0.69390947", "0.6892908", "0.68075347", "0.67549366", "0.67503077", "0.6748261", "0.670959", "0.6692424", "0.66411555", "0.6621456", "0.66006243", "0.659602", "0.65929836", "0.65263945", "0.6518...
0.0
-1
r"""Prepare to authenticate the message.
def on_phase_auth_message(self, buf): msg = self.__nanojsonrpc_unpack(buf) method = msg['method'] if method == 'auth': self.__ws_conn.send(self.__nanojsonrpc_pack('auth', [self.secret])) elif method == 'ready': self.phase_auth = False else: sel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authenticate(credentials):", "def authenticate(self):\n self.connection.authenticate()", "def authenticate(self, msg=\"\"):\n if self.request.user:\n return True\n else:\n templating = self.server.templating # save current templating settings\n templat...
[ "0.63763523", "0.62912625", "0.6207896", "0.61782616", "0.61199945", "0.61193687", "0.60731936", "0.5901951", "0.588204", "0.5876871", "0.5734717", "0.5734571", "0.57253844", "0.57035595", "0.5699994", "0.569827", "0.5683479", "0.5678432", "0.5671801", "0.56671405", "0.564265...
0.5371201
42
r"""Prepare to transmit the message.
def on_message(self, ws, buf): if self.phase_auth: self.on_phase_auth_message(buf) return msg = self.__nanojsonrpc_unpack(buf) shot = msg['shot'] if shot < 0: # Authenticate self.__ws_conn.send(self.__nanojsonrpc_pack('auth')) el...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transmit(self, message):\n pass", "def transmit(self, message):\n\n\t\t#Keep track of number of Hello packets sent\n\t\tif message == 'Hello?':\n\t\t\tself.missingCount += 1\n\n\t\t#Packetiser message and inform server of new data\n\t\tself.txData = self.packetiser.pack(message)\n\t\tself.txEvt.set()"...
[ "0.70574665", "0.6412184", "0.6266821", "0.6185934", "0.61014724", "0.6049674", "0.6049674", "0.6049674", "0.6014842", "0.5878029", "0.58322394", "0.5828571", "0.5822655", "0.5822655", "0.5822655", "0.5815162", "0.57819587", "0.57681763", "0.5728949", "0.5724343", "0.5712695"...
0.0
-1
r"""Forward the message in a queue to the websocket connection.
def on_queue(self): self.ws_opened.wait() while self.wsapp.keep_running: try: msg = self.shot_outbox.get(timeout=0.001) except: continue action = msg['action'] payload = msg['payload'] if action == 'remote': ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_msg(self, my_queue, my_msg):", "async def sender(self):\n out = await self.output_queue.get()\n if not out.ready():\n logger.info(\">>> Requeuing {}\".format(out))\n await self.output_queue.put(out)\n await asyncio.sleep(0.05)\n return\n i...
[ "0.69701046", "0.6704135", "0.6627016", "0.6454446", "0.64295876", "0.63990647", "0.62528056", "0.6207997", "0.61894566", "0.6187304", "0.6187184", "0.6153876", "0.61518985", "0.6099904", "0.60990864", "0.60902596", "0.6090177", "0.6079498", "0.6078065", "0.6034401", "0.60204...
0.0
-1
r"""Close the websocket connection.
def on_close(self, ws, code, reason): self.wsapp.keep_running = False if not self.ws_opened.is_set(): self.ws_opened.set()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close(self) -> None:\n if self.websocket:\n self.websocket.stop()", "def close(self) -> None:\n _LOGGER.info('Shutting down connections to deCONZ.')\n if self.websocket:\n self.websocket.stop()", "async def close(self):\n await self._ws.close()\n pri...
[ "0.82686013", "0.7933651", "0.7698873", "0.7587314", "0.75302136", "0.7504887", "0.75026125", "0.7472136", "0.74413806", "0.7424967", "0.74112785", "0.73001915", "0.72993577", "0.72989756", "0.72845757", "0.7276639", "0.7242707", "0.7239804", "0.7239804", "0.7239804", "0.7239...
0.0
-1
r"""Unpack the 'jsonrpc'. If it returns 'None', it means that this package is not a valid 'nanojsonrpc'.
def __nanojsonrpc_unpack(self, msg): try: pack = json.loads(msg) if 'method' not in pack: return None else: return pack except: traceback.print_exc() return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _to_jsonrpc_obj(self, jsonrpcstr):\n return jsonrpc.JsonRpcData.parse(jsonrpcstr)", "def unpack(self, obj):\n if obj is None:\n return\n try:\n return json.loads(obj)\n except Exception:\n return obj", "def deserialize(self, data: bytes) -> Tuple...
[ "0.5803789", "0.50273216", "0.4961875", "0.49459934", "0.49096018", "0.481428", "0.4790738", "0.47715878", "0.46917126", "0.4691092", "0.46623343", "0.46461037", "0.46326864", "0.46255264", "0.46226034", "0.45934814", "0.45853156", "0.45608473", "0.4556774", "0.45548433", "0....
0.7680492
0
r"""Build the computational task and wait until the server is ready.
def wait_for_server_ready(self, params): hub_client = QTask() hub_client.createBlindTask('ubqc', params) ret = hub_client.waitBlindTask(1) if ret is None: return False path, secret = ret self.entry = f"{blindCompAddr}/{path}" self.secret = secret ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_task():\n get_results_from_message_queue()\n test_all_servers_connection()", "def startworking():\r\n #In the future have the manager program or from the website implement this arguments to a route\r\n #the program will download the file from the website\r\n global exe_name\r\n global...
[ "0.6432607", "0.6246477", "0.62429965", "0.61020225", "0.6083216", "0.599574", "0.59782434", "0.59643835", "0.5950119", "0.59165597", "0.590544", "0.5857419", "0.58165723", "0.5816266", "0.5778847", "0.57639843", "0.5758075", "0.5744319", "0.57404524", "0.57332975", "0.573329...
0.65602463
0
r"""``UbqcClient`` constructor, used to instantiate a ``UbqcClient`` object.
def __init__(self, shots, inbox, outbox, program): self.__circuit = None # circuit self.__client_knowledge = {} # client knowledge self.__bw_pattern = None # brickwork pattern self.__width: int = None # width self.__depth: int = None # depth self.__shots: int = shots...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, username=None, password=None):\n self._username = username\n self._password = password\n self._suds_client = None", "def __init__(self, *args, **kwargs):\n super(Client, self).__init__(role='c', *args, **kwargs)\n\n # Internal variables\n self._bulksiz...
[ "0.64064485", "0.61211264", "0.6111138", "0.61024517", "0.60419583", "0.6017709", "0.5969972", "0.59334594", "0.5915201", "0.5881248", "0.5852288", "0.58279806", "0.5811933", "0.5786972", "0.57707137", "0.5737535", "0.57292044", "0.5691234", "0.56801814", "0.5668075", "0.5667...
0.0
-1
r"""Send back the action and payload messages.
def send_back(self, action, payload): self.outbox.put({ 'action': action, 'payload': payload })
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_actions(self, actions):\n pass", "def send(self):\n if not self._actions:\n return\n\n res = self.post('send', actions=json.dumps(self._actions))\n\n # post did not throw an error, return results merged into queue.\n actions = self._actions\n self._ac...
[ "0.6587271", "0.6376593", "0.6189893", "0.606109", "0.59913003", "0.598595", "0.59647", "0.58982563", "0.589088", "0.5882102", "0.5869955", "0.5846862", "0.5741166", "0.5741166", "0.5728023", "0.56684166", "0.5653193", "0.5647907", "0.56305677", "0.5621749", "0.56120807", "...
0.7895519
0
r"""Wait for the incoming messages.
def wait_for_messages(self): msg = self.inbox.get() return msg
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wait_till_read_out():\n\n\trespond = send_command('waitreadout')", "def _execute(self):\n LOG.info(\"Waiting for a message...\")", "def wait(self):\n self.stream.read_until(\"\\n\", self._on_read)", "def wait_for_any_message(self, timeout=None):\n self._wait_in_process_loop(lambda: (...
[ "0.75152576", "0.75116485", "0.7372496", "0.7296998", "0.72883314", "0.728428", "0.72457576", "0.7167598", "0.7167598", "0.71118486", "0.7099668", "0.70121753", "0.7011023", "0.70003015", "0.696153", "0.69598466", "0.6919302", "0.6915254", "0.6890879", "0.6857204", "0.6857204...
0.73769754
2
r"""Send the shape and states to the server. Send the brickwork graph shape (width and depth) and the prepared single qubit states to the server as initializations.
def send_shape_and_states(self): self.commit() _init_ = PBUbpcInitState() _init_.width = self.__width _init_.depth = self.__depth for vec in self.__states: vec_buf = numpyMatrixToProtobufMatrix(vec) _init_.vector.append(vec_buf) init_stateBuf: b...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self):\n # Wait for the 'shot' message ready\n self.wait_for_messages()\n # Send the initial states to the server\n self.send_shape_and_states()\n # Wait for the 'method' message ready\n self.wait_for_messages()\n\n # Send the measurement angles to the serve...
[ "0.6251751", "0.59237385", "0.5545095", "0.55293036", "0.5435947", "0.5407777", "0.538332", "0.53825194", "0.5329985", "0.5329985", "0.5231303", "0.52039856", "0.5177441", "0.51554495", "0.5147407", "0.5136584", "0.5127621", "0.5127243", "0.5127018", "0.5119841", "0.51165813"...
0.757424
0
r"""Send the angles in bulks during each sample. These bulks are set according to the circuit width. After sending the angles, this method is waiting to receive the measurement outcomes from the server.
def send_angle_bulks(self, col): # The client calculates the encrypted angles and sends them in columns to the server positions = [(row, col) for row in range(self.__width)] # To obtain the angles, the client firstly calculates the adaptive angles according to the measurement pattern # T...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sendAngles(initial_points):\r\n global client\r\n data=\"\"\r\n j=0\r\n for i in initial_points:\r\n data=data+str(i)\r\n j=j+1\r\n if j!=8:\r\n data=data+','\r\n data=data.encode('ascii') #utf 8\r\n client.send(data)\r\n GPIO.output(laserPin, False)", "de...
[ "0.6074328", "0.56332767", "0.5486066", "0.5418358", "0.53618", "0.5360894", "0.53299695", "0.52647793", "0.5242403", "0.5127472", "0.5093138", "0.5071435", "0.5064532", "0.5063558", "0.5051008", "0.5043908", "0.50359464", "0.50271934", "0.5015845", "0.49971628", "0.49935338"...
0.63659155
0
r"""Run the quantum circuit following UBQC protocol.
def run(self): # Wait for the 'shot' message ready self.wait_for_messages() # Send the initial states to the server self.send_shape_and_states() # Wait for the 'method' message ready self.wait_for_messages() # Send the measurement angles to the server for...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_IBMQ(self):\n self.operator, var_form, opt = self.generate_VQE_args()\n\n nqbits = self.operator.num_qubits\n IBMQ.load_accounts()\n backend = self.find_least_busy(nqbits)\n\n quantum_instance = QuantumInstance(backend=backend)\n vqe = VQE(self.operator, var_form, opt) \n\n self.result...
[ "0.6692483", "0.6602786", "0.64251745", "0.6241114", "0.61576855", "0.60820866", "0.60292405", "0.6005721", "0.5968612", "0.59638023", "0.5855902", "0.58258253", "0.58116895", "0.57386124", "0.5733682", "0.57278323", "0.5687337", "0.5685503", "0.5663549", "0.56573504", "0.564...
0.0
-1
r"""Commit the quantum circuit program. The client commits the program and send shape and states to the server as initializations.
def commit(self): # Translate ``PBProgram`` into ``Circuit`` self.__circuit = self.pb_to_circuit(self.program) # Extract the graph shape and measurement pattern self.__map_to_graph() # Randomly generate a quantum state for each vertex on the graph self.__states = self.p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def commitfunction(self, options=None):\r\n self.commitvalidation()\r\n\r\n self.rdmc.ui.printer(\"Committing changes...\\n\")\r\n\r\n if options:\r\n if options.biospassword:\r\n self.rdmc.app.current_client.bios_password = options.biospassword\r\n try:\r\n ...
[ "0.5821248", "0.57690954", "0.56880146", "0.55607253", "0.55180085", "0.5473794", "0.5459814", "0.5459814", "0.5459814", "0.5459814", "0.5459814", "0.544512", "0.5425148", "0.54205984", "0.54001385", "0.53741693", "0.53659123", "0.5359183", "0.5357696", "0.53435636", "0.53407...
0.63489425
0
r"""Translate ``PBProgram`` into the ``Circuit`` class.
def pb_to_circuit(program: PBProgram): pbCircuit = program.body.circuit # Obtain the circuit width bit_idxes = set() for gate in pbCircuit: bit_idxes.update(gate.qRegList) width = max(bit_idxes) + 1 if width <= 0: raise Error.ArgumentError(f"Inval...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def buildProtocol(self, addr):\n return CQCProtocol(self)", "def create_circuit(self, circuit, database, str_obj, current_date):\r\n if self._circuit_type in (HC, DHW):\r\n return Circuit(self._connector, circuit[ID],\r\n database, str_obj, self._circuit_type,\r...
[ "0.56618744", "0.5331011", "0.5187735", "0.5137056", "0.50497925", "0.49721202", "0.4945648", "0.49432555", "0.48914114", "0.4850682", "0.4831941", "0.4802609", "0.4758475", "0.47125328", "0.47111407", "0.47082394", "0.4704771", "0.4680674", "0.4656181", "0.4637845", "0.46318...
0.74321634
0
r"""Map the measurement pattern to the brickwork graph.
def __map_to_graph(self): self.__bw_pattern = transpile_to_brickwork(self.__circuit) # Get the shape input_ = self.__bw_pattern.input_ c_out, q_out = self.__bw_pattern.output_ output_ = c_out + q_out self.__width = len(input_) self.__depth = output_[0][1] - input...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_band_maps(self):\n band_maps = []\n source_band_index = 1\n target_band_index = self.starting_target_band\n for band in self.image['bands']:\n band_maps.append({\n 'source': source_band_index,\n 'target': target_band_index\n ...
[ "0.5506858", "0.5360557", "0.5343412", "0.52346903", "0.51700467", "0.5120323", "0.5095809", "0.5073153", "0.5030257", "0.5019325", "0.49883944", "0.4987375", "0.49652192", "0.4945309", "0.4940075", "0.4940075", "0.4939405", "0.49284822", "0.49075362", "0.48590413", "0.485637...
0.67906564
0
r"""Prepare the single qubit quantum states. Randomly generate a single qubit quantum state on each vertex. The rotation angle encryption method is implemented in this step. Record the corresponding rotation encryption angles for later calculations.
def prepare_states(self): # Prepare random states multiple_quarter_pi = [(i * pi) / 4 for i in range(8)] zero_or_pi = [0, pi] states = [] for pos in self.__client_knowledge.keys(): rand_ang = random.choice(multiple_quarter_pi).item() rand_flip = random.cho...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def state_prepare(q: List[QRegStorage], i: int):\n\n RX(0.1)(q[i])\n RZ(0.4)(q[i + 1])\n CX(q[i], q[i + 1])\n RY(0.8)(q[i])\n RZ(1.2)(q[i])", "def initQ(self,states,actions):\r\n \r\n Q = {}\r\n \r\n for a in actions:\r\n for s in states:\r\n Q...
[ "0.6429633", "0.58192724", "0.5809514", "0.5754595", "0.5748031", "0.5742176", "0.5703359", "0.5695111", "0.567054", "0.56625265", "0.5618352", "0.55774224", "0.5503754", "0.5472713", "0.54547924", "0.54502994", "0.54490477", "0.54437107", "0.5413868", "0.54038066", "0.540079...
0.7020206
0
r"""Calculate and encrypt the angles. Calculate measurement angles of the tagged vertices. Encode the angles with rotation and flipping encryption method to protect the information.
def calculate_and_encrypt_angles(self, positions: List): angles = [] for pos in positions: vertex = self.__client_knowledge[pos] cmds = vertex.get_commands() for cmd in cmds: if cmd.name == 'M': # Calculate the adaptive angle ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _angle(u, v, w, d='+'):\n vu = np.arctan2(u[1] - v[1], u[0] - v[0])\n vw = np.arctan2(w[1] - v[1], w[0] - v[0])\n phi = vw - vu\n if phi < 0:\n phi += 2 * np.pi\n if d == '-':\n phi = 2 * np.pi - phi\n return np.round(phi, 6)", "def to_angles(self) -> np.ndarray:\n phi ...
[ "0.5641576", "0.5632437", "0.55941254", "0.55205256", "0.54950446", "0.54852414", "0.5463608", "0.5442967", "0.5426747", "0.5424956", "0.5418363", "0.54174584", "0.53968275", "0.538745", "0.5375999", "0.5370995", "0.537096", "0.53513694", "0.53448325", "0.53343356", "0.533317...
0.64447457
0
r"""Decrypt the measurement outcomes and record them on the corresponding vertices.
def decrypt_outcomes(self, positions: List[Tuple], outcomes: List[int]): for idx in range(len(positions)): # Decrypt and record the measurement outcome pos = positions[idx] self.__client_knowledge[pos].record_outcome(outcomes[idx])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decrypt(self, data):", "def record_outcome(self, outcome: int):\n self.__outcome = outcome if abs(self.__flipping_encryption_angle - 0) < eps else (outcome + 1) % 2", "def do_android_decryption(self):\r\n self.aes_decryption_key = self.extract_aes_key()\r\n self.decrypt_device_file()\r...
[ "0.5672642", "0.5539064", "0.55196214", "0.5416165", "0.5363684", "0.53419197", "0.5320847", "0.5291316", "0.52534115", "0.51761323", "0.5121203", "0.51132315", "0.51014394", "0.5088454", "0.50398886", "0.5021111", "0.4992184", "0.49677727", "0.49600363", "0.49541685", "0.493...
0.655149
0
r"""Obtain the result as classical output equivalent to the circuit model.
def get_classical_output(self): # If the input is a pattern, return the bit string equivalent to the result in circuit model if self.__circuit is not None: c_out, q_out = self.__bw_pattern.output_ # Obtain the string # Mark the classical outputs with their measuremen...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def output(self):\r\n self.logic ( )\r\n return self.output", "def compute_output(self):\n x, y = self.input_nodes\n print(x.name, y.name)\n self.output_value = backend.dot(x.output_value, y.output_value)\n return self.output_value", "def output(self):\r\n return self.r...
[ "0.6670716", "0.66471785", "0.6574949", "0.652932", "0.6307297", "0.62847286", "0.6278421", "0.6181299", "0.61508435", "0.612818", "0.6055076", "0.60399354", "0.600359", "0.59883446", "0.59669024", "0.5932735", "0.5919565", "0.5910614", "0.5910614", "0.5897741", "0.58919996",...
0.7678445
0
Set TCP keepalive on an open socket. It activates after 30 second (after_idle_sec) of idleness, then sends a keepalive ping once every 10 seconds (interval_sec), and closes the connection after 5 failed ping (max_fails).
def _activate_keepalive(self, s, after_idle_sec=30, interval_sec=10, max_fails=5): s.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1) s.setsockopt(socket.IPPROTO_TCP, socket.TCP_KEEPIDLE, after_idle_sec) s.setsockopt(socket.IPPROTO_TCP, socket.TCP_KEEPINTVL, inte...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _set_tcp_keepalive(sock, opts):\n if hasattr(socket, \"SO_KEEPALIVE\"):\n if opts.get(\"tcp_keepalive\", False):\n sock.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1)\n if hasattr(socket, \"SOL_TCP\"):\n if hasattr(socket, \"TCP_KEEPIDLE\"):\n ...
[ "0.65047723", "0.64213765", "0.64208114", "0.6031349", "0.59054095", "0.58553547", "0.561841", "0.5611427", "0.55305564", "0.5500599", "0.5431652", "0.52326274", "0.5216221", "0.51850253", "0.5074396", "0.50631684", "0.5034353", "0.49896207", "0.4922601", "0.4910667", "0.4899...
0.7825976
0
Converts a binary mask to COCO polygon representation
def binary_mask_to_polygon(binary_mask, tolerance=0): polygons = [] # pad mask to close contours of shapes which start and end at an edge padded_binary_mask = np.pad( binary_mask, pad_width=1, mode='constant', constant_values=0) contours = measure.find_contours(padded_binary_mask, 0.5) conto...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def binary_mask_to_polygon(binary_mask, tolerance=0):\r\n\r\n polygons = []\r\n if isinstance(binary_mask, torch.Tensor):\r\n binary_mask = binary_mask.cpu().numpy()\r\n # pad mask to close contours of shapes which start and end at an edge\r\n padded_binary_mask = np.pad(binary_mask, pad_width=1...
[ "0.76045674", "0.7403101", "0.6444963", "0.62063557", "0.62018925", "0.6156219", "0.6043893", "0.6030549", "0.59756887", "0.5958031", "0.59226185", "0.581272", "0.5771442", "0.5689792", "0.5671032", "0.5671032", "0.56008244", "0.5586868", "0.553344", "0.5520956", "0.55073845"...
0.73896223
2
Create a new SFVolGroup object. This object is only meant to be constructed by the appropriate factory function in SFCluster
def __init__(self, volgroup, mvip, username, password): for key, value in volgroup.items(): setattr(self, key, value) self.ID = volgroup["volumeAccessGroupID"] self.mvip = mvip self.username = username self.password = password
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def createVolumeGroup(self, pvs, name):\n vg = {}\n vg['command'] = 'create:volgroup'\n vg['extentSize'] = EXTENT_SIZE\n vg['pvs'] = pvs\n vg['name'] = name\n\n return vg", "def create_volume(self, vol_name, sg_name, size, cap_unit):\n try:\n if self.mo...
[ "0.6859043", "0.6346634", "0.5994237", "0.598094", "0.59720606", "0.59669703", "0.5892937", "0.5843691", "0.5770946", "0.5758503", "0.57349765", "0.57219297", "0.5627996", "0.5618954", "0.56165206", "0.5610524", "0.5547294", "0.5509706", "0.550003", "0.54806405", "0.5408596",...
0.58753496
7
Decorator to refresh the attributes of this object from the cluster
def __refresh(fn): def wrapper(self, *args, **kwargs): #mylog.debug("Refreshing volgroup object") self = libsfcluster.SFCluster(self.mvip, self.username, self.password).FindVolumeAccessGroup(volgroupID=self.ID) fn(self, *args, **kwargs) return wrapper
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reload(self):\n cluster_kubeconfig = self.ocp.cluster_kubeconfig\n self.data = self.get()\n self.__init__(**self.data)\n self.ocp.cluster_kubeconfig = cluster_kubeconfig", "def refresh(self, context=None):\n current = self.__class__.get_by_uuid(self._context,\n ...
[ "0.6651182", "0.6539693", "0.60500574", "0.594723", "0.5853314", "0.5848761", "0.5823456", "0.5813434", "0.5813434", "0.58003443", "0.5795833", "0.578611", "0.5770367", "0.57532066", "0.57424927", "0.5734065", "0.5721706", "0.5698518", "0.5685617", "0.5673639", "0.56710464", ...
0.58187425
7
Add a list of initiators to the group
def AddInitiators(self, initiatorList): # Append the IQNs to the existing list full_iqn_list = self.initiators for iqn in initiatorList: if iqn.lower() in full_iqn_list: mylog.debug(iqn + " is already in group " + self.name) else: full_iqn_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _add_init_walkers(self, init_walkers_grp, init_walkers):\n\n # add the initial walkers to the group by essentially making\n # new trajectories here that will only have one frame\n for walker_idx, walker in enumerate(init_walkers):\n walker_grp = init_walkers_grp.create_group(str...
[ "0.6401538", "0.6272343", "0.60600626", "0.58041793", "0.5789351", "0.56194365", "0.5617065", "0.5616975", "0.56085956", "0.5479124", "0.54735637", "0.54340476", "0.539979", "0.5384303", "0.53667593", "0.53654844", "0.5350756", "0.53321654", "0.53161263", "0.5315354", "0.5315...
0.6818665
0
Remove a list of initiators from the group
def RemoveInitiators(self, initiatorList): # Append the IQNs to the existing list full_iqn_list = self.initiators for iqn in initiatorList: if iqn.lower() in full_iqn_list: full_iqn_list.remove(iqn) else: mylog.debug(iqn + " is already not ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clear_Groups(self):\n\n\t\tself.__groups[:] = []", "def remove_all(self):\n self.initial = None\n self.contour = None\n self.control_points = []", "def remove_functional_groups(pct_C1A, pct_E1A, pct_H1A, atom_list):\n carboxyl_map = get_carboxyl_map(atom_list)\n epoxy_map = get_e...
[ "0.5837479", "0.5836093", "0.57362354", "0.5716028", "0.5688496", "0.5629168", "0.55928546", "0.5570317", "0.5550455", "0.5475205", "0.5469125", "0.5352654", "0.53408444", "0.5338788", "0.5317058", "0.53153366", "0.53083235", "0.52959347", "0.5294338", "0.5292525", "0.5281974...
0.70759916
0
Add a list of volumes to the group
def AddVolumes(self, volumeIDList): volume_ids = self.volumes for vol_id in volumeIDList: if vol_id not in volume_ids: volume_ids.append(vol_id) else: mylog.debug("volumeID " + str(vol_id) + " is already in group") # Add the requested volu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def volumes(self):", "def add_volume(self, volume: 'Volume'):\n self.volumes.append(volume)", "def part_volumes_to_part_groups(prefix=None):\r\n \r\n if prefix == None:\r\n prefix = \"part\"\r\n V = cubit.get_entities(\"volume\")\r\n for vid in V:\r\n cubit.cmd(f\"create group '{prefix}_{v...
[ "0.68015206", "0.67666084", "0.6716646", "0.6319991", "0.6299033", "0.62065214", "0.6198266", "0.61014825", "0.60651654", "0.5899944", "0.5883432", "0.58666766", "0.58539766", "0.58322966", "0.58215463", "0.5802459", "0.57540566", "0.5698188", "0.5658451", "0.5650305", "0.564...
0.7598522
0
Remove a list of volumes from the group
def RemoveVolumes(self, volumeIDList): volume_ids = self.volumes for vol_id in volumeIDList: if vol_id in volume_ids: volume_ids.remove(vol_id) else: mylog.debug("volumeID " + str(vol_id) + " is already not in group") # Remove the requeste...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete(self):\n for lv in self.logical_volumes:\n self.delete_lv(lv_name=lv)\n\n super().delete()", "def delete_volumes(volumes):\n if type(volumes) is not list:\n volumes = [volumes]\n for volume in volumes:\n command = 'cinder delete %s' % volume['id']\n ...
[ "0.69334394", "0.6926036", "0.6154756", "0.6030102", "0.59953517", "0.59704024", "0.59559363", "0.5938539", "0.5913568", "0.5806803", "0.5803843", "0.57413715", "0.573327", "0.57215476", "0.57006043", "0.56896573", "0.5638064", "0.5632837", "0.5630152", "0.56282383", "0.56273...
0.74104863
0
get dict of GA release versions with download url (version,url)
def GetVersions(url, requestedProduct, requestedVersion): dictValidReleasesSorted = {} response = requests.get(url) if response.status_code == 200: jsonResult = response.json() jVersions = jsonResult[requestedProduct]["versions"] dictValidReleases = {} # do not want pre-relea...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def downloads_per_version(package):\n downloads = {}\n for release in package['files']:\n downloads[release['version']] = release['ndownloads']\n return downloads", "def get_release_info(self, version):\r\n try:\r\n return self._detail[\"releases\"][version]\r\n except Ke...
[ "0.7447856", "0.64105517", "0.64060634", "0.62913716", "0.6216165", "0.6138824", "0.6128678", "0.6063825", "0.6026366", "0.589802", "0.58748233", "0.5865873", "0.58320105", "0.58302414", "0.5803629", "0.5781473", "0.5780344", "0.5748138", "0.5747969", "0.5731726", "0.57004255...
0.6663025
1
Unzip file and place in tools path location
def Unzip(fullPath,installDirectory, quietMode): with zipfile.ZipFile(fullPath, 'r') as zip: # TODO - check zipfile contents for file number; # should always be 1 binary file unless Hashicorp jumps the shark on the build extractedFile = zip.namelist()[0] if not quietMode: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_file(self):\n# path_destination = os.path.join(\n# self.root, self.resources.replace(\".zip\", \"\"))\n# os.makedirs(path_destination, exist_ok=True)\n shutil.unpack_archive(os.path.join(\n self.root, self.resources), self.root)\n os.remove(os.path.j...
[ "0.7175593", "0.7026838", "0.65908647", "0.65779877", "0.6511851", "0.65061855", "0.6499671", "0.64713776", "0.64547163", "0.64211804", "0.639963", "0.6390034", "0.63806355", "0.6378695", "0.63628846", "0.6319436", "0.6306669", "0.62717295", "0.625002", "0.6240565", "0.618420...
0.0
-1
Download/save the file from Hashicorp servers
def DownloadFile(url, theFile, quietMode): # open in binary mode with open(theFile, "wb") as file: if not quietMode: print("[-] - Downloading -> [{0}] ...".format(url)) response = requests.get(url) if not quietMode: print("[-] - Saving -> [{0}] ...".format(theFile...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download(self):\n if not self.url:\n raise RuntimeError(self.tips)\n\n download_file_name = os.path.join(\n self.raw_path, os.path.splitext(os.path.basename(self.url))[0]\n )\n file_format = self.url.split(\".\")[-1]\n if \"amazon\" in self.url:\n ...
[ "0.70229673", "0.7015695", "0.6869978", "0.6869978", "0.6789402", "0.6764522", "0.6742779", "0.67168826", "0.6691781", "0.6691781", "0.66749865", "0.6669041", "0.665759", "0.663912", "0.6630074", "0.66226", "0.66212684", "0.66026944", "0.6592424", "0.65783405", "0.6571606", ...
0.0
-1
Prompt user to confirm and continue
def PromptQuestion(requestedProduct, downloadLocation): question = "\n {0} selected!!: Are you sure you wish to download the latest " \ "version of '{0}' to {1} ?: ".format(requestedProduct.upper(), downloadLocation) return question
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def proceed():\n c_print(\"********** PROCEED? **********\")\n # capture user input\n confirm = input(\" \" * 36 + \"(y/n) \")\n # quit script if not confirmed\n if confirm.lower() != \"y\":\n c_print(\"******* EXITING SCRIPT *******\")\n print(\"~\" * 80)\n exit()\n else:\n ...
[ "0.81404096", "0.8056257", "0.78641266", "0.7791346", "0.7753211", "0.77322024", "0.7696624", "0.7656787", "0.76471394", "0.75979346", "0.7578723", "0.75774556", "0.7561479", "0.7513822", "0.7495262", "0.742327", "0.74147403", "0.7407127", "0.73764414", "0.72797966", "0.72749...
0.0
-1
Clean up old zip file, etc after download
def Clean(theZipFile,quietMode): previousZip = Path(theZipFile) if previousZip.is_file(): previousZip.unlink() if not quietMode: print("[-] - Cleaning up (Deleting zipfile) -> [{0}]".format(theZipFile))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cleanup(self):\n files = self.nlst()\n latest = self.latest_filename\n for filename in files:\n if filename != latest:\n result = self.delete(filename)\n logger.info(f\"Deleted old export from FTP: {result}\")", "def cleanupInstall(self):\n\n ...
[ "0.7252758", "0.71965414", "0.70687383", "0.69717675", "0.69169086", "0.6908488", "0.68638", "0.68604535", "0.6780086", "0.67412084", "0.6645921", "0.6626688", "0.66024625", "0.65323806", "0.64941484", "0.64697456", "0.64423615", "0.64231163", "0.64205164", "0.6420439", "0.63...
0.63192433
21
Initializes member variables for the Card class. Cards are always face down when initalized.
def __init__(self, rank="", suit=""): self.suit = suit self.rank = rank self.face_up = False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n self._cards = []", "def initialize(self):\n cards = [Card(rank, suit) for suit in self._suits\n for rank in self._ranks]\n self.setAllCards(cards)", "def __init__(self):\n self._cards = []\n #Add a single card for each ...
[ "0.7484046", "0.74129635", "0.7325669", "0.7215223", "0.7200183", "0.7123802", "0.710829", "0.70926225", "0.6987787", "0.69128215", "0.68976945", "0.6872139", "0.6829894", "0.6719145", "0.6666004", "0.6665512", "0.6626556", "0.6603939", "0.6577921", "0.6566819", "0.6530178", ...
0.5953589
69
Sets the member variable face_up to True.
def turn_face_up(self): self.face_up = True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flip_faceup(self):\r\n self.faceup = True", "def flip(self):\n \n if self.faceup:\n self.faceup = False\n else:\n self.faceup = True", "def turn_face_down(self):\n self.face_up = False", "def face(self):\n\n return self.faceup", "def up(se...
[ "0.83173066", "0.72682965", "0.7141126", "0.65644455", "0.63498414", "0.6339938", "0.6237461", "0.6210182", "0.6168868", "0.60779077", "0.60777", "0.60500467", "0.59910303", "0.5962508", "0.5962508", "0.5899924", "0.585252", "0.5829014", "0.5814699", "0.58134353", "0.57899606...
0.8423325
0
Sets the member variable face_up to False.
def turn_face_down(self): self.face_up = False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flip_faceup(self):\r\n self.faceup = True", "def turn_face_up(self):\n self.face_up = True", "def flip(self):\n \n if self.faceup:\n self.faceup = False\n else:\n self.faceup = True", "def flip(self):\n if self.is_face_up:\n arcad...
[ "0.81712955", "0.8131525", "0.75644344", "0.628328", "0.6176913", "0.59822255", "0.58682317", "0.5854141", "0.5831294", "0.5784406", "0.5768511", "0.57619876", "0.57578415", "0.5747011", "0.5703665", "0.5695586", "0.56886363", "0.56871235", "0.5653114", "0.56398124", "0.55468...
0.7950313
2
print representation. If Card is face down print "XX", if face up print a string concatenation of the Card's rank and suit.
def __str__(self): if not self.face_up: return "XX" else: return self.rank + self.suit
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n #Create dictionary for face cards\n translate = {11:'Jack', 12:'Queen', 13:'King', 14: 'Ace'}\n r = self._rank\n #check for face card\n if r in [11, 12, 13, 14]:\n myrank = translate[r]\n else:\n myrank = str(r)\n return my...
[ "0.7931429", "0.7738406", "0.75782883", "0.756145", "0.7500392", "0.7440657", "0.741524", "0.7385243", "0.7335026", "0.7335026", "0.729739", "0.72929245", "0.7251104", "0.72448933", "0.7239434", "0.7191585", "0.71403146", "0.7100049", "0.7093703", "0.7082051", "0.70583767", ...
0.7741225
1
Represent each Card as a concatenation of its rank and suit.
def __repr__(self): return self.rank + self.suit
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return str(self.rank) + \" of \" + self.suit", "def ascii_version_of_card(*cards):\n\n # we will use this to prints the appropriate icons for each card\n name_to_symbol = {\n 'Spades': '♠',\n 'Diamonds': '♦',\n 'Hearts': '♥',\n 'Clubs': '♣',\n ...
[ "0.71933305", "0.71600074", "0.71444017", "0.7140631", "0.70260257", "0.70260257", "0.6997441", "0.69622666", "0.6956081", "0.69310045", "0.69288784", "0.6914523", "0.67576605", "0.6716822", "0.66366667", "0.6612663", "0.6599204", "0.6593373", "0.6528129", "0.65071744", "0.65...
0.7598367
0
Cards are == when one Card has the same rank or suit of another Card instance.
def __eq__(self, other_card): if self.rank == other_card.rank or self.suit == other_card.suit: return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, card2):\n return self.suit == card2.suit and self.rank == card2.rank", "def __eq__(self, other: Card) -> bool:\n return compare_map[self.number] == compare_map[other.number]", "def __eq__(self, other):\n if isinstance(other, Card):\n return self.color == other.color and...
[ "0.87093216", "0.78906995", "0.77700496", "0.74245775", "0.7407949", "0.7117948", "0.7053784", "0.70236933", "0.6877931", "0.687404", "0.68026626", "0.6787577", "0.6734536", "0.6732668", "0.6705773", "0.66778344", "0.6657151", "0.6649128", "0.6634081", "0.6603406", "0.6591542...
0.8623669
1
Initialize a new instance of the MalpediaApiClient. Optionally, login data for your useraccount on Malpedia can be provided. This can either be your username/password combination or an apitoken.
def __init__(self, username=None, password=None, apitoken=None): self.__credentials = None self.__headers = {} if apitoken: self.authenticate_by_token(apitoken) if username and password: self.authenticate(username, password)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n self.__client = Client(verify_ssl_cert=True)\n self.__headers = {'Content-Type': 'application/json'}\n self.login()", "def __init__(self,\n identifier=None,\n password=None,\n silent=False):\n self.data_source = Res...
[ "0.6078029", "0.60188925", "0.59386134", "0.58862054", "0.5881831", "0.5866019", "0.5863781", "0.5857012", "0.584912", "0.58312166", "0.57963276", "0.5779763", "0.5771254", "0.5763184", "0.5688634", "0.5668931", "0.5654642", "0.56512344", "0.56465346", "0.5640244", "0.560855"...
0.6360503
0
Set apitoken for authentication
def authenticate_by_token(self, apitoken): self.__headers.update({'Authorization': 'APIToken {}'.format(apitoken)})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setAPIToken(self, APIToken):\n if APIToken == '':\n raise ValueError('WaPOR API ERROR: APIToken must be provided!')\n\n print('WaPOR API: Loading sign-in...')\n\n Token = self._query_accessToken(APIToken)\n if Token is None:\n sys.exit('WaPOR API ERROR: The dat...
[ "0.6807034", "0.67766017", "0.67592937", "0.67153287", "0.67153287", "0.6612932", "0.6571726", "0.6528972", "0.6482451", "0.63543105", "0.6310855", "0.6297687", "0.62971735", "0.62858135", "0.6276428", "0.62476665", "0.62433904", "0.62388486", "0.62260574", "0.6212664", "0.61...
0.70078623
0
List all family IDs. This is a helper command to enable follow up commands family data.
def list_families(self): return self.__make_api_call('list/families')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def family_ids(self):\n\n return self._family_ids", "def get_families(self):\n return self.__make_api_call('get/families')", "def show_families():\n print(f\"--- {request}\")\n print(f\"--- {user_session}\")\n # Set context by owner and the data selections\n u_context = UserContext(us...
[ "0.6774071", "0.62483513", "0.59472007", "0.5878266", "0.5858103", "0.5792659", "0.56311923", "0.55710286", "0.5554745", "0.5547099", "0.55317545", "0.55209243", "0.5483229", "0.5455072", "0.54524887", "0.54416937", "0.5433553", "0.5347597", "0.53431815", "0.53423405", "0.533...
0.6817886
0
List all actor IDs. This is a helper command to enable follow commands involving actor data.
def list_actors(self): return self.__make_api_call('list/actors')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def actor():\n return Actor.all()", "def getFollowerIDs(self, screen_name):\n follower_ids = []\n for follower_id in tweepy.Cursor(self.api.followers_ids,id=screen_name).items():\n print follower_id\n follower_ids.append(follower_id)\n return follower_ids", "def ge...
[ "0.6330772", "0.60661715", "0.59983206", "0.5870146", "0.5630447", "0.5615068", "0.56049055", "0.55922025", "0.5560878", "0.55533475", "0.55090666", "0.54921997", "0.54482245", "0.54454273", "0.5393306", "0.5381572", "0.5305462", "0.52967626", "0.528451", "0.528451", "0.52689...
0.59308964
3
Provide a list of all nonzero ApiVector fingerprints that are currently on Malpedia.
def list_apiscout(self): return self.__make_api_call('list/apiscout')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_known_cars():\n return list(_FINGERPRINTS.keys())", "def unique_detector_names() :\n return experiment_info.unique_detector_names()", "def get_fingerprints(self, jid: JID) -> List[str]:\n return []", "def get_hostfingerprint_list(self):\n return self.hostfingerprint", "def _minima...
[ "0.6142905", "0.5826964", "0.55856013", "0.5570759", "0.5496185", "0.54602873", "0.5381113", "0.5364234", "0.53534406", "0.5333407", "0.5298899", "0.5271181", "0.52519834", "0.5199419", "0.5158899", "0.51572573", "0.51572573", "0.51572573", "0.5129372", "0.50391215", "0.50375...
0.0
-1
Provide a list of all nonzero ApiVector fingerprints that are currently on Malpedia (in CSV format compatible with ApiScout).
def list_apiscout_csv(self, destination): res = self.__make_api_call('list/apiscout/csv', raw=True) with open(destination, "wb") as csvfile: csvfile.write(res)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unique_detector_names() :\n return experiment_info.unique_detector_names()", "def all_known_cars():\n return list(_FINGERPRINTS.keys())", "def getFuList(self):\n if self._fupardict:\n return self._fupardict.keys()\n buf = self._parent.Xeprbuf(10000)\n self.aqGetExpFuList...
[ "0.56042737", "0.5470635", "0.5441076", "0.5397244", "0.53901196", "0.52048314", "0.517772", "0.5177368", "0.51327276", "0.501926", "0.49465406", "0.49165004", "0.48824444", "0.4878042", "0.4809037", "0.47909322", "0.4752923", "0.47506872", "0.47444046", "0.47417414", "0.4727...
0.0
-1
Provide all YARA rules with given TLP.
def get_yara_aggregated(self, tlp, destination="malpedia.yar"): res = self.__make_api_call('get/yara/{}/raw'.format(tlp), raw=True) with open(destination, "wb") as csvfile: csvfile.write(res)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allYandPred(self):\n y = []\n pred = []\n with open(self.inputfile) as fin:\n for line in fin:\n arr = line.strip().split()\n label, feat = int(arr[1]), int(arr[2])\n self.allimgs.append(arr[0])\n y.append(label)\n ...
[ "0.54461503", "0.5429618", "0.52900475", "0.52810663", "0.5213302", "0.5163835", "0.50459915", "0.50163436", "0.4955932", "0.49436328", "0.4925221", "0.48838505", "0.4840158", "0.48313227", "0.47985813", "0.4792932", "0.47920418", "0.47768962", "0.47157928", "0.47107077", "0....
0.4551863
56
Provide a list of all samples known for a family, including their packed status and version, if available.
def list_samples(self, family_id): return self.__make_api_call('list/samples/{}'.format(family_id))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fixture_lims_samples(lims_family: dict) -> List[dict]:\n return lims_family[\"samples\"]", "def samples(self):\n if self._samples:\n return self._samples\n if SAMPLE_DF_KEY not in self or self[SAMPLE_DF_KEY] is None:\n _LOGGER.debug(\"No samples are defined\")\n ...
[ "0.6974945", "0.6088159", "0.60842144", "0.6034202", "0.5925121", "0.58618534", "0.5810834", "0.57882965", "0.57660747", "0.57252336", "0.571923", "0.57102716", "0.5656722", "0.5647571", "0.56275845", "0.5617002", "0.5613116", "0.5583079", "0.55587715", "0.554309", "0.5540035...
0.75340974
0
Provide a list of all YARA rules in malpedia for all families. Output may vary depending on access level (public = white, registration = green, amber).
def list_yara(self): return self.__make_api_call('list/yara')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_rules(self):\n rules = []\n for item in self.name:\n rules.append(item)\n return rules", "def list_resolver_rules(MaxResults=None, NextToken=None, Filters=None):\n pass", "def extract_rule_names(self):\n if self.scanner == YARA:\n return sorted({resu...
[ "0.5911991", "0.5764709", "0.56198305", "0.5612531", "0.55756503", "0.55582595", "0.54848284", "0.53947675", "0.53947675", "0.5348109", "0.5331859", "0.53015596", "0.53011817", "0.5287661", "0.52752787", "0.52749115", "0.525196", "0.5213265", "0.5204044", "0.5177486", "0.5152...
0.5508231
6
Provide meta data for a single family, as identified by .
def get_family(self, family_id): return self.__make_api_call('get/family/{}'.format(family_id))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def family(self):", "def _derive_extra_metadata(self, extra_metadata):\n extra_metadata['platform']['Family'] = extra_metadata['platform']['Platform Family Name']\n\n # Add platform number if derivable from file\n if self.__class__ is not SAFESentinel1:\n extra_metadata['platform'...
[ "0.71859586", "0.6245424", "0.6213412", "0.6206237", "0.6206237", "0.6206237", "0.59569013", "0.59015465", "0.5895057", "0.58883077", "0.58830196", "0.5860638", "0.58425367", "0.5790275", "0.5790275", "0.57778466", "0.57778466", "0.5728727", "0.5714534", "0.57003844", "0.5683...
0.55367625
24
Provide meta data for all families.
def get_families(self): return self.__make_api_call('get/families')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def meta_data(self) -> Dict:\n pass", "def meta(self):\n raise NotImplementedError", "def metadata(self) -> dict:\n meta = {}\n meta['name'] = self.name\n meta['id'] = self.id\n meta['family'] = self.family\n \n meta['ptd_type'] = []\n meta['pos'] ...
[ "0.6646211", "0.6501652", "0.6369382", "0.629078", "0.6156518", "0.60993683", "0.60993683", "0.6098226", "0.6030041", "0.6010506", "0.5995242", "0.5957212", "0.59402955", "0.5933139", "0.5905969", "0.58956134", "0.58886343", "0.5875718", "0.58740646", "0.58583397", "0.5847009...
0.0
-1
Provide the sample alongside potentially existing unpacked or dumped files.
def get_sample_raw(self, sha256): return self.__make_api_call('get/sample/{}/raw'.format(sha256))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gather_sample(self, my_file, collector=None):\n\n pass", "def fixture_sample_single() -> dict:\n _sample = {\n \"fastq\": \"<( zcat read_R1.fastq.gz )\",\n \"single_end\": True,\n \"sample_id\": \"single\",\n }\n return _sample", "def sample_file(self) -> str:\n ...
[ "0.68707526", "0.6829538", "0.6607541", "0.6578802", "0.6576575", "0.6576575", "0.6469721", "0.6467219", "0.64310724", "0.64007074", "0.6295704", "0.6247639", "0.62461025", "0.62083584", "0.6201831", "0.6178764", "0.61310655", "0.6101893", "0.607964", "0.6068747", "0.60339355...
0.0
-1
Provide the sample alongside potentially existing unpacked or dumped files.
def get_sample_zip(self, sha256): return self.__make_api_call('get/sample/{}/zip'.format(sha256))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gather_sample(self, my_file, collector=None):\n\n pass", "def fixture_sample_single() -> dict:\n _sample = {\n \"fastq\": \"<( zcat read_R1.fastq.gz )\",\n \"single_end\": True,\n \"sample_id\": \"single\",\n }\n return _sample", "def sample_file(self) -> str:\n ...
[ "0.68707526", "0.6829538", "0.6607541", "0.6578802", "0.6576575", "0.6576575", "0.6469721", "0.6467219", "0.64310724", "0.64007074", "0.6295704", "0.6247639", "0.62461025", "0.62083584", "0.6201831", "0.6178764", "0.61310655", "0.6101893", "0.607964", "0.6068747", "0.60339355...
0.0
-1
Provide the YARA rules for a given . Output may vary depending on access level (public = white, registration = green, amber).
def get_yara(self, family_id): return self.__make_api_call('get/yara/{}'.format(family_id))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rules(self):\n self.rule1 = min(self.location_is_lessDemand, self.area_is_small, self.unfunishing)\n self.rule2 = min(self.location_is_lessDemand, max(self.area_is_small, self.area_is_average), self.access_is_good)\n self.rule3 = min(self.location_is_veryHighDemand, self.area_is_average, s...
[ "0.6341058", "0.6103424", "0.61024994", "0.60954773", "0.6042175", "0.60192376", "0.6003736", "0.592177", "0.59126264", "0.5835577", "0.5800065", "0.5783991", "0.576128", "0.566734", "0.5641633", "0.56240404", "0.5571147", "0.5550959", "0.5519951", "0.5519951", "0.5470088", ...
0.0
-1
Provide the meta information for a given .
def get_actor(self, actor_id): return self.__make_api_call('get/actor/{}'.format(actor_id))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def meta_data(self) -> Dict:\n pass", "def GetMetadata(self):\n return self.dict['meta']", "def metadata(self): # -> None:\n ...", "def meta(self):\n raise NotImplementedError", "def meta(self):\r\n url = '{0}/{1}'.format(self.get_url(), 'meta')\r\n\r\n return http.Req...
[ "0.76444584", "0.760026", "0.75602335", "0.7553809", "0.73650616", "0.7323788", "0.7215075", "0.7142274", "0.7096916", "0.70328754", "0.70030457", "0.69850206", "0.69815016", "0.6943503", "0.69380397", "0.69124985", "0.6887921", "0.68779063", "0.6854675", "0.68352467", "0.683...
0.0
-1
A current view of Malpedia in the MISP galaxy cluster format.
def get_misp(self): return self.__make_api_call('get/misp')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __repr__(self):\n return (\n f'GalaxyCluster {self.unique_id}: '\n f'(ra={self.ra}, dec={self.dec}) at z={self.z}'\n f'\\n> with columns: {self._str_colnames()}'\n f'\\n> {len(self.galcat)} source galaxies'\n )", "def _repr_html_(self):\n r...
[ "0.58133703", "0.5466079", "0.5418778", "0.539123", "0.53521734", "0.5336888", "0.5314621", "0.530695", "0.5208018", "0.5172302", "0.5172302", "0.5135471", "0.51331973", "0.50452673", "0.50452673", "0.49922687", "0.4972823", "0.49474725", "0.49255514", "0.49248463", "0.491943...
0.0
-1
Obtain the current version of Malpedia (commit number and date).
def get_version(self): return self.__make_api_call('get/version')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_version():\n return about.get_version()", "def get_version():\n return \"0.0.1 (prerelease prototype)\"", "def get_version():\n click.echo(get_current_version_number())", "def version():\n\n version = None\n output = gitopen(['--version'])\n m = re.search(br\" version ([\\d\\.A-Za-z...
[ "0.7095701", "0.69473", "0.68888533", "0.6847067", "0.67933977", "0.66306746", "0.65989923", "0.65872085", "0.65570694", "0.6496848", "0.64594525", "0.64443284", "0.64330006", "0.6411051", "0.63817596", "0.6341258", "0.6341018", "0.6337988", "0.63172936", "0.6314721", "0.6310...
0.6394497
14
Provide all YARA rules with a version newer than a specific date. Intended for users intending regular automated updates. Output may vary depending on access level (public = white, registration = green, amber).
def get_yara_after(self, date): return self.__make_api_call('get/yara/after/{}'.format(date))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rules_newer_versions(self) -> Sequence[str]:\n return pulumi.get(self, \"rules_newer_versions\")", "def _get_version_rules(self, vuln_versions):\n rules = []\n regex_op = \"[0-9a-zA-Z\\\\_\\\\.\\\\-]+\"\n regex_vr = \"[<>=*]+\"\n \"\"\"For all the vulnerable versions inform...
[ "0.67787915", "0.56644213", "0.56599724", "0.53567743", "0.5341471", "0.53063697", "0.5306083", "0.52441305", "0.51761657", "0.51660573", "0.5132444", "0.50677586", "0.5036338", "0.50333166", "0.50234985", "0.5020694", "0.50026554", "0.49944454", "0.49531358", "0.49381644", "...
0.52974
7
Provide a list of all family names and associated synonyms where a part () of the name is matched.
def find_family(self, needle): return self.__make_api_call('find/family/{}'.format(needle))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def synonyms(self) -> List[str]:\n return self._synonyms", "def synonyms(self) -> List[str]:\n return pulumi.get(self, \"synonyms\")", "def synonyms(self):\n\n return [synonym[\"name\"] for synonym in self._get_synonym_json()]", "def meronym(self, sense=0):\n s = self._synset(self...
[ "0.66182274", "0.6549298", "0.6404428", "0.62275285", "0.6101176", "0.6088979", "0.6073007", "0.6065136", "0.6034959", "0.6003668", "0.5935894", "0.5904555", "0.587843", "0.5876234", "0.58277345", "0.58247507", "0.5815244", "0.5800844", "0.5781378", "0.5740546", "0.5733903", ...
0.0
-1
Provide a list of all actor names and associated synonyms where a part () of the name is matched.
def find_actor(self, needle): return self.__make_api_call('find/actor/{}'.format(needle))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def synonyms(self) -> List[str]:\n return pulumi.get(self, \"synonyms\")", "def synonyms(self) -> List[str]:\n return self._synonyms", "def synonyms(self):\n\n return [synonym[\"name\"] for synonym in self._get_synonym_json()]", "def meronym(self, sense=0):\n s = self._synset(self...
[ "0.6527947", "0.65211254", "0.651884", "0.6113911", "0.6082905", "0.60813695", "0.60452896", "0.5920498", "0.584144", "0.58412504", "0.58122736", "0.58122736", "0.5761412", "0.57555765", "0.57524866", "0.5715289", "0.5702175", "0.56958455", "0.5687499", "0.5677409", "0.561465...
0.0
-1
Have a binary scanned against all YARA rules currently contained in Malpedia. The format of is TBD.
def scan_binary(self, filepath): with open(filepath, "rb") as input_file: return self.__make_api_call('scan/binary', files={'input_file': input_file}, method='POST')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_analyze_with_Y(self):\n\n seq = 'ATGTCGTTCTGCAGCTTCTTCGGGGGCGAGGTTTTCCAGAATCACTTTGAACCTGGCGTT'\n stdseq = 'ATGTCGTTCTGCAGCTTCTTCGGGGGCGAGGTTTTCCAGAATCACTTTGAACCTGGCGTT'\n\n status = analyze(seq, stdseq)\n self.assertEqual(status, Y(stdseq=stdseq, aa_pm=0))\n self.assertE...
[ "0.5620655", "0.5387301", "0.5129913", "0.512941", "0.5054348", "0.5037983", "0.49995366", "0.49161977", "0.48715588", "0.4850702", "0.48425296", "0.48131478", "0.48104408", "0.47790748", "0.4759093", "0.4730187", "0.4718613", "0.46866262", "0.46837497", "0.46767145", "0.4669...
0.0
-1
Have a YARA rule used to scan against all samples (packed, unpacked, dumped) currently contained in Malpedia. The format of is TBD.
def scan_yara(self, filepath, family_id=None): url = 'scan/yara/{}'.format(family_id) if family_id else 'scan/yara' with open(filepath, "rb") as input_file: return self.__make_api_call(url, data=input_file.read(), method='POST')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_analyze_with_Y(self):\n\n seq = 'ATGTCGTTCTGCAGCTTCTTCGGGGGCGAGGTTTTCCAGAATCACTTTGAACCTGGCGTT'\n stdseq = 'ATGTCGTTCTGCAGCTTCTTCGGGGGCGAGGTTTTCCAGAATCACTTTGAACCTGGCGTT'\n\n status = analyze(seq, stdseq)\n self.assertEqual(status, Y(stdseq=stdseq, aa_pm=0))\n self.assertE...
[ "0.56053114", "0.525358", "0.51412535", "0.5111226", "0.50872636", "0.5085077", "0.5055727", "0.50074846", "0.49713635", "0.49609047", "0.49309465", "0.4924716", "0.49172622", "0.4869633", "0.4831663", "0.48081318", "0.48031607", "0.4792333", "0.4782876", "0.47755772", "0.477...
0.0
-1
Recursively templateexpand a json dict against itself or other context. The context for string expansion is the json dict itself by default, updated by extra_context, if supplied.
def ExpandJsonTemplate(json_data, extra_context=None, use_self=True): if use_self: context = dict(json_data) else: context = {} if extra_context: context.update(extra_context) def RecursiveExpand(obj): if isinstance(obj, list): return [RecursiveExpand(x) for ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def json_leaf_subst(exp, substitutions):\n def do_subst(e):\n return json_leaf_subst(e, substitutions)\n if isinstance(exp, dict):\n return {do_subst(k): do_subst(v) for k, v in exp.items()}\n elif isinstance(exp, list):\n return [do_subst(e) for e in exp]\n elif exp in substitutio...
[ "0.6263145", "0.55062026", "0.54617023", "0.53140074", "0.52904445", "0.5242427", "0.5238454", "0.521097", "0.52007663", "0.5114993", "0.5110396", "0.5087918", "0.50575686", "0.501296", "0.49815476", "0.4947743", "0.4945792", "0.4896503", "0.48905617", "0.4872648", "0.4816023...
0.8101806
0
Load strategy class from source code.
def load_strategy_class(self): path2 = Path(__file__).parent.parent.joinpath("strategies") self.load_strategy_class_from_folder(path2, "vnpy.app.cta_strategy.strategies")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_strategy_class_from_module(self, module_name: str):\n try:\n module = importlib.import_module(module_name)\n\n for name in dir(module):\n value = getattr(module, name)\n if (isinstance(value, type) and issubclass(value, CtaTemplate) and value is n...
[ "0.6564425", "0.6439322", "0.6280344", "0.62121594", "0.6048729", "0.59623754", "0.59397036", "0.58810794", "0.58753276", "0.58429927", "0.5803895", "0.5726347", "0.57133424", "0.56495696", "0.56377566", "0.56054056", "0.56054056", "0.56054056", "0.56054056", "0.55943185", "0...
0.80725014
0
Load strategy class from certain folder.
def load_strategy_class_from_folder(self, path: Path, module_name: str = ""): for dirpath, dirnames, filenames in os.walk(str(path)): for filename in filenames: if filename.endswith(".py"): strategy_module_name = ".".join( [module_name, fil...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_strategy_class(self):\n path2 = Path(__file__).parent.parent.joinpath(\"strategies\")\n self.load_strategy_class_from_folder(path2, \"vnpy.app.cta_strategy.strategies\")", "def _load(self, directory):\n pass", "def load_tactic(dpath, basedir):\n obj = utils.load_class(dpath, ba...
[ "0.8572109", "0.6336423", "0.62573045", "0.60844946", "0.5959619", "0.5954883", "0.59303445", "0.59303445", "0.5923612", "0.5815755", "0.5802761", "0.58019274", "0.57982206", "0.57422316", "0.5610737", "0.55739915", "0.5502566", "0.5482146", "0.5476485", "0.54692924", "0.5466...
0.7651413
1
Load strategy class from module file.
def load_strategy_class_from_module(self, module_name: str): try: module = importlib.import_module(module_name) for name in dir(module): value = getattr(module, name) if (isinstance(value, type) and issubclass(value, CtaTemplate) and value is not CtaTempl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_strategy_class(self):\n path2 = Path(__file__).parent.parent.joinpath(\"strategies\")\n self.load_strategy_class_from_folder(path2, \"vnpy.app.cta_strategy.strategies\")", "def load_strategy_class_from_folder(self, path: Path, module_name: str = \"\"):\n for dirpath, dirnames, filen...
[ "0.81998193", "0.71635723", "0.63292944", "0.6267503", "0.62557054", "0.6214737", "0.61812496", "0.6143429", "0.6064527", "0.60596937", "0.6052271", "0.6039287", "0.5998328", "0.5950787", "0.5950787", "0.5950787", "0.5950599", "0.59185237", "0.5903587", "0.5886092", "0.587768...
0.7205787
1
Retrieves authentication string from string or file.
def get_auth_string(auth_or_path): if ":" in auth_or_path: return auth_or_path try: with open(auth_or_path) as stream: content = stream.read() content = content.strip() if ":" in content: return content except FileNotFoundError: pas...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_auth_string(self):", "def _auth():\n with open('api-credentials.txt', 'r') as f:\n lines = f.read().splitlines()\n credentials = lines[0] + ':' + lines[1]\n return 'Basic ' + base64.b64encode(credentials.encode()).decode()", "def get_basic_auth(user=\"\", key=\"\"):\n s = user + \":...
[ "0.7317391", "0.6477555", "0.64539844", "0.6413232", "0.6413232", "0.633992", "0.63181716", "0.6291578", "0.62228745", "0.61477184", "0.6102186", "0.60440284", "0.6034179", "0.6001892", "0.60002124", "0.5978378", "0.5917228", "0.58746547", "0.5870686", "0.5843792", "0.5775289...
0.7740775
1
Generates an identifier unique to a new session.
def new_case_id(): return uuid.uuid4().hex
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_session_id():\n return utils.get_32bit_random_num()", "def unique_id() -> str:", "def id_generator():\r\n new_id = uuid.uuid4()\r\n return new_id.hex", "def session_uuid(): \r\n yield uuid.uuid4()", "def makeid(cls):\n return str(uuid.uuid4().hex)", "def generate_id...
[ "0.7988505", "0.776236", "0.7611132", "0.76054776", "0.7565407", "0.7547023", "0.7424277", "0.74214417", "0.7405034", "0.73913175", "0.7387", "0.7363607", "0.7345015", "0.73429114", "0.7328924", "0.72961736", "0.7276789", "0.7268049", "0.7265281", "0.7265281", "0.7245251", ...
0.69744265
59
Parses command line arguments.
def parse_args(): parser = argparse.ArgumentParser() parser.add_argument("auth", help="authentication string for Infermedica API: " "APP_ID:APP_KEY or path to file containing it.") parser.add_argument("--model", help="use non-stand...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_arguments(args):", "def process_command_line_arguments() -> Namespace:\n\n parser = build_parser()\n arguments = parser.parse_args()\n\n return arguments", "def parse_args():\n parser = argparse.ArgumentParser(\n description=\"Reads datapacket pcds, interpolates quaternions and gen...
[ "0.82454896", "0.76635003", "0.7550699", "0.7482471", "0.7473767", "0.7456357", "0.73882806", "0.73869324", "0.7355088", "0.7350514", "0.73487467", "0.7345888", "0.73044825", "0.72833323", "0.7269705", "0.726155", "0.72491395", "0.72444355", "0.7242896", "0.7213438", "0.72113...
0.0
-1
fields is a list of dictionaries n = Title v = Value If inline is not set then the default value will be false [
def embed(ctx=None, title=None, description=None, fields=None, customFooter=False, customThumbnail=None, customColor=None, image=None): e = discord.Embed(title=title, description=description) if customColor is None: e.color = color() else: e.color = color(customColor) if fields != ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_fields(*fields):\n\n fields = filter( lambda x: x, fields )\n target_len = max( len(name) for name, value in fields ) + 2\n for name, value in fields:\n line = name + ':' + \" \" * (target_len - len(name))\n if type(value) == bool:\n line += color_text(\"Yes\", 'green') i...
[ "0.6858707", "0.6282722", "0.6031383", "0.601127", "0.5745954", "0.5673672", "0.55752605", "0.5518123", "0.5498236", "0.5472325", "0.5458866", "0.5447564", "0.5432698", "0.5428647", "0.54239047", "0.5394897", "0.5366877", "0.5355397", "0.534703", "0.5339801", "0.5296225", "...
0.0
-1
goes to the first page
async def first_page(self): await self.show_page(1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def go_to_first_page(self, payload):\n await self.show_page(0)", "def get_first_page(self):\n return 1", "def first_page(self):\n if self._start == 0:\n raise ValueError('Already at the first page.')\n self._start = 0", "def test_first_page_passes(self):\n\n ...
[ "0.8262319", "0.77821577", "0.7702882", "0.72091836", "0.7135327", "0.69205546", "0.6817158", "0.65184915", "0.64742994", "0.64742994", "0.6417681", "0.63743246", "0.62692386", "0.62685406", "0.62576616", "0.6254293", "0.6248977", "0.6227804", "0.62091523", "0.6182544", "0.61...
0.8312497
0
goes to the last page
async def last_page(self): await self.show_page(self.maximum_pages)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __goToLastPage(self):\n try:\n self.currenturi = self.currenturi = self.currenturi.rsplit('/',1)[0] + '/' +self.soup.find('div', 'pagination_container vt_pagination_container').findAll('a', text=re.compile ('^\\d+$'))[-1].parent['href']\n self.__setSoupForCurrentUri()\n exce...
[ "0.8439283", "0.8390649", "0.80599296", "0.79243046", "0.7530241", "0.72976875", "0.7275147", "0.72627306", "0.7245464", "0.7040021", "0.6996322", "0.68695444", "0.6714402", "0.66751236", "0.66365254", "0.6597807", "0.6488389", "0.6474677", "0.63010544", "0.6226056", "0.62149...
0.75669277
4
goes to the next page
async def next_page(self): await self.checked_show_page(self.current_page + 1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def page_next(self):\n if self._pos >= self._npages - 1:\n # exit if we are already at the end\n self.page_quit()\n else:\n self._pos += 1\n self._display()", "def page_next(self):\n if self._npos >= self._npages - 1:\n # exit if we are ...
[ "0.77977556", "0.7740631", "0.770163", "0.7695761", "0.76865476", "0.7636571", "0.7601572", "0.754302", "0.74219704", "0.7409429", "0.73759663", "0.7173831", "0.71300894", "0.70486206", "0.70486206", "0.7034142", "0.69195825", "0.6886133", "0.6867094", "0.677051", "0.67591655...
0.78053415
0
goes to the previous page
async def previous_page(self): await self.checked_show_page(self.current_page - 1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def goToPrevLink():\n if wikiPageStackTrace[-2].getUrl() != \"\":\n oldpage = wikiPageStackTrace[-2]\n print(\"going back to \", oldpage.getUrl())\n titleStackTrace.append(oldpage.getTitle())\n urlStackTrace.append(oldpage.getUrl())\n del wikiPageStackTrace[-1]\n update...
[ "0.82448536", "0.78836346", "0.7694317", "0.7625073", "0.7552749", "0.7430316", "0.7419049", "0.74046093", "0.73494124", "0.73279506", "0.7291041", "0.726867", "0.72345847", "0.715785", "0.715785", "0.7150545", "0.7150545", "0.71310234", "0.7116425", "0.7109296", "0.7104777",...
0.8048292
1
lets you type a page number to go to
async def numbered_page(self): # noinspection PyListCreation to_delete = [] to_delete.append( await self.channel.send('What page do you want to go to?') ) def message_check(m): return m.author == self.author and \ self.channel == m.chan...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_pageNumber_activate(self, widget, data=None):\n self.page = int(self.pageNumber.get_text())\n self.part = 1\n self.refresh()", "def get_page(self, num):\n return num + 10", "def goto(n):\n n = int('{}'.format(n))\n get_controller().step_to(n)", "def _forward_page_...
[ "0.6710253", "0.66187215", "0.6216608", "0.61689013", "0.6016617", "0.6010857", "0.60059696", "0.59877837", "0.5977124", "0.59645295", "0.59190327", "0.59131986", "0.59092486", "0.5812977", "0.5790829", "0.5787006", "0.57731044", "0.57117885", "0.57075876", "0.56960624", "0.5...
0.57491446
17
stops the interactive pagination session
async def stop_pages(self): await self.message.delete() self.paginating = False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stopPaging(self):\n self._stillPaging = 0", "def __stopScrolling(self):\n self.__view.inputWidget().releaseMouse()\n QApplication.restoreOverrideCursor()\n \n self.__indicator.hide()\n self.__indicator.setParent(None)\n self.__scroller.stopScrolling()", "def...
[ "0.7443031", "0.6542925", "0.65421", "0.63108504", "0.62598443", "0.6253554", "0.6253554", "0.62461007", "0.6245877", "0.6241", "0.62232953", "0.62232953", "0.61937237", "0.61552423", "0.6136211", "0.6136211", "0.6136211", "0.6136211", "0.6136211", "0.6136211", "0.6136211", ...
0.7571803
0
Actually paginate the entries and run the interactive loop if necessary.
async def paginate(self): first_page = self.show_page(1, first=True) if not self.paginating: await first_page else: # allow us to react to reactions right away if we're paginating self.bot.loop.create_task(first_page) while self.paginating: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def paginated(self) -> global___Snippet.Paginated:", "def add_paging(self):\n self.paged = True", "def page_through(app_id, app_secret):\n has_next_page = True\n in_date_range = True\n \n #we only want to keep the articles that were returned from the NYtimes api, so this creates a list of ta...
[ "0.66705674", "0.6074725", "0.60746646", "0.59982675", "0.59860325", "0.5983739", "0.5964314", "0.5834423", "0.57778174", "0.576857", "0.5762051", "0.5739264", "0.5709043", "0.56838477", "0.5648242", "0.56165755", "0.5558618", "0.5558618", "0.5558491", "0.5547392", "0.5532461...
0.5847611
7
Downloads the dataset in compressed format. This function does not return anything
def download_compressed_dataset(url): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _download_and_uncompress_dataset(dataset_dir):\n filename = _DATA_URL.split('/')[-1]\n filepath = os.path.join(dataset_dir, filename)\n\n if not os.path.exists(filepath):\n def _progress(count, block_size, total_size):\n sys.stdout.write('\\r>> Downloading %s %.1f%%' % (\n filename, float(c...
[ "0.7406725", "0.70859474", "0.7018932", "0.68021536", "0.67304015", "0.6579586", "0.65106225", "0.6479735", "0.6475977", "0.6422988", "0.6409934", "0.6400974", "0.63962024", "0.63925934", "0.63781285", "0.6347889", "0.6322267", "0.6320342", "0.6314137", "0.6310004", "0.630669...
0.8312236
0
Prepare the dataset form the download file. This function takes the filepath of the download file and prepares the data
def prepare_dataset(fpath): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prepare_data(self) -> None:\n if (self.root).is_dir():\n logger.info(\"Found the dataset.\")\n else:\n download_and_extract(self.root, DOWNLOAD_INFO)", "def prep_data(dataset_config=None):\n \n\n data_struct = DataStruct(dataset_config)\n\n data_name = data_st...
[ "0.6945789", "0.64754957", "0.64664316", "0.64090407", "0.6365517", "0.63464", "0.63419765", "0.6305324", "0.61647195", "0.6158651", "0.61167526", "0.61118156", "0.6107789", "0.60439557", "0.6039679", "0.5992119", "0.5987985", "0.5978328", "0.5968726", "0.596167", "0.594318",...
0.73216677
0
List all sources of data with the respective label.
def find_sources(data_dir, mode='training', shuffle=True): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def source(self) -> list:\n sources = self.source_control.list_sources()\n sources_list = [source['label'] for source in sources]\n return sources_list", "def show_sources_all():\n response = requests.get(SOURCE_URL)\n json = response.json()\n for source in json['sources']:\n ...
[ "0.74967957", "0.6991222", "0.65865266", "0.6443878", "0.64088494", "0.6384779", "0.6371104", "0.63703126", "0.636327", "0.63227934", "0.6153459", "0.6135095", "0.60773766", "0.60670674", "0.6028108", "0.5960829", "0.59365886", "0.59365886", "0.58884454", "0.58707875", "0.586...
0.54870063
44
Input function required by the estimator API.
def input_fn(sources, train, params): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def input_fn(self, params, mode=tf.estimator.ModeKeys.TRAIN):\n raise NotImplementedError()", "def input(self):\r\n pass", "def input(self):", "def get_input(self):\n pass", "def d_input(self):\n pass", "def function(self):\n raise NotImplementedError", "def __call__(self...
[ "0.77349585", "0.6916878", "0.69068515", "0.68756145", "0.6638857", "0.6516163", "0.6494907", "0.640696", "0.6349731", "0.6341642", "0.6330353", "0.63056", "0.62826806", "0.6271576", "0.6271576", "0.6271576", "0.62439513", "0.62178624", "0.6207046", "0.6186181", "0.61725086",...
0.6866463
4
Return the directory of data files.
def data_dir(): return os.path.join(os.path.dirname(os.path.abspath(__file__)), 'data')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def data_directory(self):\n\n return self.get_raw(\"data_directory\")", "def data_dir(self) -> Path:\n return self._data_dir", "def get_data_dir(self):\n return self.data_dir", "def data_dir(self):\n return self._data_dir", "def data_dir(self):\n return self._data_dir", ...
[ "0.86678046", "0.8487896", "0.8462572", "0.84176695", "0.84176695", "0.84165275", "0.83920074", "0.83725977", "0.8331892", "0.82320046", "0.82109785", "0.8151315", "0.8066355", "0.8062088", "0.8061976", "0.8047895", "0.80455387", "0.8033556", "0.8001184", "0.79925346", "0.798...
0.87103015
0
Generate a temporary output directory to write output files.
def tmp_dir(data_dir): tmp_dir = os.path.join(data_dir, 'manorm_tmp_output') yield tmp_dir shutil.rmtree(tmp_dir)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _make_output_directory(self):\n fs = self._filesystem\n output_filename = fs.join(self._root_output_dir, self._test_name)\n fs.maybe_make_directory(fs.dirname(output_filename))", "def _temp_dir(self):\n tmp_dir = os.path.join(self.output_dir, self.config.find_tune[\"run_dir\"])\n ...
[ "0.8012859", "0.7708361", "0.7655735", "0.7649225", "0.7598235", "0.7554436", "0.73869026", "0.73377657", "0.73069316", "0.7198202", "0.7197807", "0.7158701", "0.7156091", "0.71190786", "0.70785725", "0.70646274", "0.70065814", "0.69970906", "0.69798034", "0.6963388", "0.6954...
0.6970156
19
plots figure 3B bottom
def plot_figure3B_bottom(ax, ylim, cmap, vlim=None): try: hdf = h5py.File('data_figure3Bbottom.hdf5', 'r') except IOError: print "requires 'data_figure3Bbottom.hdf5'. please run calculate_figure_data.py first." exit(1) # get data bg_vel = hdf['bg_velocity'].value fg_pos_flies...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n self.fig = pl.figure(1,figsize=(8,6), dpi=80 , frameon = True , facecolor = '0.75' , edgecolor = 'w')\n self.fig.add_subplot(111 , axisbg = 'w' , projection = 'rectilinear') #if you want to add axes on particular place: fig.add_axes([0.15, 0.1, 0.7, 0.3]) where -> [begin , bottom to st...
[ "0.68612796", "0.67786276", "0.6636007", "0.6598781", "0.6531974", "0.6504919", "0.6497813", "0.64932674", "0.6419343", "0.64041936", "0.6398153", "0.6379358", "0.63652635", "0.6326156", "0.6320478", "0.6314096", "0.63059264", "0.6303612", "0.62922794", "0.62611026", "0.62487...
0.62643206
19
Combines list into a string of the form item1, item2, and item 3
def comma_code(items): item_len = len(items) if item_len == 0: return '' elif item_len == 1: return items[0] return ', '.join(items[:-1]) + ', and ' + items[-1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def join_list(items: Iterable[str]) -> str:\n\n return ITEM_SEPARATOR.join(items)", "def list_str(lis):\r\n as_str = \"\"\r\n for item in lis:\r\n as_str += \" \" + str(item) + \",\"\r\n return as_str[:-1]", "def concatenate_items(items, conjunction='and'):\n text = ''\n if not items:\...
[ "0.79991424", "0.7775448", "0.75652117", "0.7435386", "0.72728205", "0.7271365", "0.72299993", "0.722568", "0.70819163", "0.7036277", "0.70145047", "0.70130634", "0.6990181", "0.69315577", "0.6876183", "0.68205476", "0.6816648", "0.67916524", "0.6769555", "0.67605346", "0.673...
0.6674709
24
This function takes the raw data and makes a more Python readable version.
def jsonCreator(raw_data): tweets_data = [] tweets_file = open(raw_data, "r") for line in tweets_file: try: tweet = json.loads(line) tweets_data.append(tweet) except: continue return tweets_data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_data(self, data):", "def format_raw_data(data, indent=2*'\\t'):\n strings = [' '.join([('%.2x' % ord(x)) for x in data[i:i + DGTL_Decoder.__raw_data_chunk]])\n for i in xrange(0, len(data), DGTL_Decoder.__raw_data_chunk)]\n return ('\\n' + indent).join(strings)", "def...
[ "0.7038048", "0.6837282", "0.678953", "0.65402806", "0.6293626", "0.6276131", "0.6231553", "0.6218485", "0.6145432", "0.605537", "0.60196686", "0.5986771", "0.5941555", "0.5933756", "0.588085", "0.5876098", "0.5870848", "0.5821988", "0.5818326", "0.5749553", "0.5733696", "0...
0.0
-1
Creates the panda data frame, most used data structure in pandas library.
def pandaData(): tweets = pd.DataFrame() return tweets
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def data_frame_creator(self):\n\n return pd.DataFrame()", "def create_pandas_dataframe(data, index, columns):\n return pd.DataFrame(data, index, columns)", "def create_dataframe(self):\n\n df = pd.DataFrame({'date': [],\n 'RUN': [],\n 'CLONE'...
[ "0.8023077", "0.7953962", "0.78953695", "0.7846201", "0.759213", "0.7355288", "0.7336989", "0.72801214", "0.7210116", "0.716412", "0.7145604", "0.7142345", "0.7048866", "0.7023634", "0.69795084", "0.69743806", "0.69485706", "0.69205153", "0.690943", "0.6907212", "0.69056517",...
0.67090774
38
Finds a tweet with a certain word\phrases in it.
def word_finder(word, text): word = word.lower() text = str(text).lower() match = re.search(word, text) if match: return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def two_word_finder(word1,word2,text):\r\n word1 = word1.lower()\r\n word2 = word2.lower()\r\n text = str(text).lower()\r\n if word1 and word2 in text:\r\n return True #return text to see specific tweets\r\n return False", "def search(self, word):", "def search(words):\n newlist = [w f...
[ "0.75000566", "0.6938451", "0.6763792", "0.6508075", "0.64643604", "0.6290919", "0.6194796", "0.6155909", "0.6119662", "0.6023498", "0.60174304", "0.6015797", "0.6011457", "0.6005525", "0.59818673", "0.59804076", "0.59554833", "0.5953384", "0.59531426", "0.5951937", "0.595056...
0.6194678
7
Finds a tweet with a two certain words\phrases in it.
def two_word_finder(word1,word2,text): word1 = word1.lower() word2 = word2.lower() text = str(text).lower() if word1 and word2 in text: return True #return text to see specific tweets return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_find_word2(self):\n self.assertEqual(find_word2('GREEN'), [(1, 1), (1, 1), (0, 9)])\n self.assertEqual(find_word2('ABSENT'), [])\n self.assertEqual(find_word2('PW'), [(1, 7), (3, 7), (0, 8)])", "def find_matches(id1, id2, adj_list_ids, adj_list_words):\n\n # combine words from tw...
[ "0.66810614", "0.6470443", "0.64452493", "0.6327239", "0.6325929", "0.62813", "0.6242157", "0.6022817", "0.5993105", "0.59915686", "0.5970261", "0.59592956", "0.5947485", "0.5912819", "0.59032536", "0.5885848", "0.5885848", "0.58524436", "0.5829877", "0.58000016", "0.5756215"...
0.8225031
0
convert all items in array to dotdict
def list_to_dotdict(array): if isinstance(array, list): result = [] for item in array: try: _dotdict = dotdict(item) except Exception as e: raise e result.append(_dotdict) return result return array
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rec_to_dict(arr):\n\n return dict(zip(arr.dtype.names, arr))", "def to_dotdict(data):\n\n if isinstance(data, dict):\n\n return dotdict(data)\n elif isinstance(data, list):\n return list_to_dotdict(data)", "def todict(self):\n return dict(self.array)", "def array_to_dict(sel...
[ "0.66079587", "0.6452924", "0.64230466", "0.6418053", "0.6131111", "0.61046916", "0.59780544", "0.5972151", "0.5918459", "0.5807685", "0.573434", "0.56638986", "0.5656732", "0.5625367", "0.56216025", "0.5572649", "0.55410963", "0.55249137", "0.54466385", "0.54345655", "0.5380...
0.7825808
0