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
Starts the mapper running.
def run(self, batch_size=20): logging.info('%s: Starting.'% (self.__class__.__name__)) deferred.defer(self._continue, None, batch_size, _queue=self.QUEUE)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mapping_runner(self):\n if not isinstance(self.model_source, str):\n raise ValueError(\"Tried to initialize mapping without a model\")\n \n import keras\n sys.stdout.flush()\n keras.backend.clear_session()\n sys.stdout.flush()\n \n # Load model...
[ "0.6613853", "0.62579364", "0.618436", "0.6152869", "0.61080784", "0.61009556", "0.6084085", "0.59981084", "0.59877867", "0.59877867", "0.59610146", "0.5931825", "0.5931825", "0.5931825", "0.5931825", "0.5931825", "0.5931825", "0.5931825", "0.5931825", "0.5907525", "0.5907525...
0.0
-1
Writes updates and deletes entities in a batch.
def _batch_write(self): if self.to_put: db.put(self.to_put) self.to_put = [] if self.to_delete: db.delete(self.to_delete) self.to_delete = []
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_batch(self, batch):\n for item in batch:\n self.write_buffer.buffer(item)\n key = self.write_buffer.get_key_from_item(item)\n if self.write_buffer.should_write_buffer(key):\n self._write_current_buffer_for_group_key(key)\n self.increment_w...
[ "0.70008594", "0.68892026", "0.666511", "0.65495664", "0.65008634", "0.6464048", "0.635089", "0.63451797", "0.6307946", "0.6263735", "0.6218856", "0.6178519", "0.61136186", "0.5940264", "0.59256804", "0.5848141", "0.5847394", "0.5837007", "0.5814465", "0.5783356", "0.5769271"...
0.76341254
0
Adds Card entities for the given ids, with the given parent. Adds in batches and requeues itself.
def create_cards(card_ids, box_key): if len(card_ids) == 0: return BATCH_SIZE = 20 batch = card_ids[:BATCH_SIZE] logging.info("Adding cards for %s (%d remaining). Batch: %s"%(box_key,len(card_ids),batch)) for id_tuple in batch: key = '-'.join([str(p) for p in id_tuple]) card ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add(self, fetchables, depth=1):\n if fetchables:\n if isinstance(fetchables, collections.Sequence):\n for fetchable in fetchables:\n self.add(fetchable, depth)\n else:\n log.debug(\"Adding to queue: %s (depth=%s)\", fetchables, depth...
[ "0.5433942", "0.54215556", "0.5285374", "0.52513355", "0.523385", "0.5209448", "0.52048165", "0.5192483", "0.50542176", "0.50103396", "0.49839032", "0.49836466", "0.49792188", "0.49381772", "0.49187857", "0.48608288", "0.48197132", "0.48139533", "0.48101467", "0.4797596", "0....
0.6199333
0
Make sure the incoming dict is a valid rower data frame, so the out coming data is consistent. Check the validity of the incoming dict fields, make sure all the required fields exists, and the value of each key is in the corresponded data type or format. So the data consumers is guaranteed that the out coming data is i...
def _check_dict_validity(self, incoming_dict: dict): # check key error # check value error for key in incoming_dict.keys(): # check invalid key. if key not in self.all_valid_keys: raise IncomingRowerDictInvalidKeyError("Incoming rower data dict has unknow...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_required_fields(dataframe):\n\n if dataframe is None:\n raise ValueError(\"It was not provided a valid Dataframe.\")", "def _validate_row(self, row):\n\n # assume value.\n is_valid = True\n\n # test if each field in @row has the correct data type.\n tests = []\n...
[ "0.6217236", "0.61962247", "0.61173457", "0.611672", "0.6115982", "0.60280246", "0.6014561", "0.58647096", "0.58622396", "0.5823101", "0.5781498", "0.5753542", "0.5747231", "0.57242537", "0.57188284", "0.57178247", "0.57135326", "0.56972915", "0.56814194", "0.56690544", "0.56...
0.7237003
0
Checks for possible block usage
def _process_blocks(self, file_path: str, task: Any, prefix: str = "") -> None: if not task or not isinstance(task, dict): return if ResourceType.BLOCK in task and isinstance(task[ResourceType.BLOCK], list): prefix += f"{ResourceType.BLOCK}." # with each nested level an extra ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_block(self, block):\n pass", "def test_block_bad_signature(self):\n pass", "def test_34(self):\n assert 'False' == Api.requestBlock('test-34')", "def test_33(self):\n assert 'False' == Api.requestBlock('test-33')", "def test_27(self):\n assert 'False' == Api.req...
[ "0.808542", "0.72105557", "0.71034944", "0.70969397", "0.70593655", "0.7056486", "0.7028962", "0.70249146", "0.7018172", "0.70164615", "0.7012231", "0.7010266", "0.70017815", "0.6986933", "0.6983828", "0.6977036", "0.6968673", "0.69680357", "0.69669354", "0.69659835", "0.6963...
0.0
-1
Parses an HTTP Error from the Google API and returns the error message.
def _get_error_message_from_httperror(err): json_error = json.loads(str(err.content.decode())) return json_error.get('error', {}).get('message', '')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getError(self):\n \n return self.resp[\"error\"]", "def read_tapis_http_error(http_error_object):\n h = http_error_object\n # extract HTTP response code\n code = -1\n try:\n code = h.response.status_code\n assert isinstance(code, int)\n except Exception:\n # ...
[ "0.6838421", "0.6793689", "0.6636548", "0.6565121", "0.64546394", "0.63964623", "0.63945633", "0.6299346", "0.62722117", "0.6216416", "0.6203617", "0.61820084", "0.6117928", "0.61079687", "0.61059207", "0.6047966", "0.60429734", "0.60072476", "0.60060865", "0.5990251", "0.597...
0.73818463
0
Subscribes an email address to a mailing list. If the email address is already subscribed, silently pass.
def insert_user_into_group_pass_if_already_member(domain, group, email): logger = logging.getLogger(__name__) try: insert_email_into_g_suite_group(domain, group, email) except HttpError as err: error_message = _get_error_message_from_httperror(err) if 'Member already exists' in err...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_email_confirmed(request, email_address: EmailAddress, **kwargs):\n dillo.tasks.profile.update_mailing_list_subscription(email_address.email, True)", "def on_email_email_changed(\n request, user, from_email_address: EmailAddress, to_email_address, **kwargs\n):\n if from_email_address:\n dil...
[ "0.69370914", "0.6759706", "0.6639899", "0.6568794", "0.62072796", "0.6184732", "0.61347497", "0.60822016", "0.5982756", "0.58909076", "0.58030117", "0.5796153", "0.5788895", "0.57734257", "0.5713769", "0.5691321", "0.56819636", "0.55669725", "0.556098", "0.55557525", "0.5498...
0.49725592
58
Unsubscribes an email address from a mailing list. If the email address is not already subscribed, silently pass.
def remove_user_from_group_pass_if_not_subscribed(domain, group, email): logger = logging.getLogger(__name__) try: remove_g_suite_user_from_group(domain, group, email) except HttpError as err: error_message = _get_error_message_from_httperror(err) if 'Resource Not Found' in error_m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unsubscribe():\n from alot.helper import mailto_to_envelope\n from alot.buffers import EnvelopeBuffer\n msg = ui.current_buffer.get_selected_message()\n e = msg.get_email()\n uheader = e['List-Unsubscribe']\n dtheader = e.get('Delivered-To', None)\n\n if uheader is not None:\n M = r...
[ "0.7467778", "0.72191095", "0.6811772", "0.67880744", "0.6641054", "0.64415497", "0.63897353", "0.63324094", "0.625045", "0.625045", "0.625045", "0.625045", "0.625045", "0.62458956", "0.6242577", "0.6224399", "0.6172933", "0.6144571", "0.61089915", "0.6081831", "0.6077142", ...
0.58041567
31
Build the computation graph, return the output node
def __call__(self, x): if self.dropout > 0: x = ht.dropout_op(x, 1 - self.dropout) x = ht.matmul_op(x, self.weight) msg = x + ht.broadcastto_op(self.bias, x) x = ht.csrmm_op(self.mp, msg) if self.activation == "relu": x = ht.relu_op(x) elif self.ac...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _build_computation_graph(self):\n raise NotImplementedError", "def build_graph(self):\n raise NotImplementedError", "def build_graph(self):\n pass", "def buildGraph(self):\n return None", "def _build_graph(self):\n pass", "def build_graph(self):\n for node in...
[ "0.72172254", "0.704165", "0.6999011", "0.6913066", "0.6877705", "0.6737147", "0.662222", "0.6615539", "0.6576762", "0.6520698", "0.6517888", "0.648856", "0.64696854", "0.6465103", "0.6455041", "0.64113694", "0.64087135", "0.6398976", "0.63989556", "0.63750744", "0.6353289", ...
0.0
-1
Build the computation graph, return the output node
def __call__(self, x): feat = x if self.dropout > 0: x = ht.dropout_op(x, 1 - self.dropout) x = ht.csrmm_op(self.mp, x) x = ht.matmul_op(x, self.weight) x = x + ht.broadcastto_op(self.bias, x) if self.activation == "relu": x = ht.relu_op(x) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _build_computation_graph(self):\n raise NotImplementedError", "def build_graph(self):\n raise NotImplementedError", "def build_graph(self):\n pass", "def buildGraph(self):\n return None", "def _build_graph(self):\n pass", "def build_graph(self):\n for node in...
[ "0.72172254", "0.704165", "0.6999011", "0.6913066", "0.6877705", "0.6737147", "0.662222", "0.6615539", "0.6576762", "0.6520698", "0.6517888", "0.648856", "0.64696854", "0.6465103", "0.6455041", "0.64113694", "0.64087135", "0.6398976", "0.63989556", "0.63750744", "0.6353289", ...
0.0
-1
if verbose is true the sent and received packets will be logged
def set_verbose(self, verbose): for srv in self._servers: srv.set_verbose(verbose)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _verbose(self,text):\n if self.verbose:\n print(text)", "def dump_log(ip, verbose=False):\n # Force ip to str (if eg. ip == ipaddress class)\n ip = str(ip)\n\n # Getting Auth Key\n s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n s.connect((ip, TCP_PORT_AUTH))\n s.s...
[ "0.6167796", "0.61467767", "0.61310583", "0.6070049", "0.599235", "0.5943046", "0.589048", "0.58812475", "0.57667005", "0.5764465", "0.5732333", "0.5729725", "0.5729725", "0.5729055", "0.5725137", "0.5719303", "0.57181394", "0.5714126", "0.5711648", "0.56992906", "0.5690126",...
0.53879285
49
should initialize the main thread of the server. You don't need it here
def _make_thread(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def server_init(self):\n if not self._web_interface_thread.isAlive():\n # spawn the web interface.\n self._web_interface_thread.start()", "def server_init(self):\n if not self.web_interface_thread.isAlive():\n # spawn the web interface.\n self.web_interfa...
[ "0.8224732", "0.8218813", "0.7669874", "0.74018985", "0.7333204", "0.7261345", "0.7261345", "0.710369", "0.7080451", "0.70341665", "0.7016472", "0.69951105", "0.69719356", "0.6933797", "0.6919559", "0.69078505", "0.6906411", "0.6899949", "0.68462825", "0.6778167", "0.67698073...
0.0
-1
Returns an instance of a Query subclass implementing the MAC layer protocol
def _make_query(self): raise NotImplementedError()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_query(self):\n return self.query_class(self)", "def get_query():\n return CiscoVlanIftableRelationshipQuery", "def query(self):\n return Query(self)", "def query(cls):\n query_class = cls.query_class\n return query_class(orm_class=cls)", "def new_query(self):\n ...
[ "0.6719992", "0.667957", "0.66540724", "0.6493347", "0.6461686", "0.64402145", "0.6185825", "0.6172097", "0.61685354", "0.60220456", "0.6017618", "0.5990623", "0.5901759", "0.5806757", "0.57421726", "0.5722068", "0.5688207", "0.56843066", "0.56815976", "0.56604075", "0.565171...
0.6559923
3
Start the server. It will handle request
def start(self): for srv in self._servers: srv.start()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start(self) -> None:\n app = web.Application()\n app.add_routes([web.post(\"/\", self._handle_request)])\n self._runner = web.AppRunner(app)\n\n self._startup_event = threading.Event()\n self._server_loop = asyncio.new_event_loop()\n t = threading.Thread(target=self._r...
[ "0.80455565", "0.7983014", "0.7983014", "0.7919697", "0.7848062", "0.7725936", "0.77071244", "0.76837444", "0.755793", "0.7446294", "0.7410821", "0.7387185", "0.7384289", "0.7346765", "0.7296192", "0.7292896", "0.72889", "0.7257424", "0.72474587", "0.7215941", "0.7186009", ...
0.0
-1
stop the server. It doesn't handle request anymore
def stop(self): for srv in self._servers: srv.stop()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stop():\n server = current_server()\n server.stop()", "def stop() -> None:\n global _server\n if _server:\n try:\n _server.shutdown()\n except Exception:\n pass", "def stop(self, *args):\n # logging.debug(\"Stopping....\")\n self.has_been_stoppe...
[ "0.8435296", "0.82294583", "0.82037157", "0.8201173", "0.8189419", "0.8163885", "0.80451286", "0.79614633", "0.78773195", "0.78655547", "0.78072685", "0.77873844", "0.7766594", "0.7754294", "0.77284724", "0.77231205", "0.7703101", "0.76528144", "0.76436967", "0.76292753", "0....
0.0
-1
This function is called automatically by the SocketServer
def handle(self): # self.request is the TCP socket connected to the client # read the incoming command request = self.request.recv(1024).strip() # write to the queue waiting to be processed by the server INPUT_QUEUE.put(request) # wait for the server answer in the o...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def server():", "def server():", "def do_socket_logic():\n pass", "def connectionMade(self):", "def Server(self) -> Socket:", "def on_server_start(self):\n raise NotImplementedError", "def on_server_start(self, server):\n pass", "def after_send(self):", "def ServerSyncReceived(self...
[ "0.7508453", "0.7508453", "0.72132784", "0.71054894", "0.70783806", "0.68694836", "0.68604726", "0.6789811", "0.6658022", "0.6600622", "0.64889765", "0.64858854", "0.6446918", "0.6445496", "0.64048785", "0.63079715", "0.6291949", "0.6289826", "0.62861466", "0.6251142", "0.623...
0.0
-1
run the server and wait that it returns
def run(self): self.rpc_server.serve_forever(0.5)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self):\n self._server = self._get_server()\n self._server.serve_forever()", "def run(self):\n self.__server.serve_forever()", "def run():\n server = current_server()\n server._auto_stop = True\n return start()", "def run(self):\n self.__rpc_server.run()", "def m...
[ "0.7389395", "0.7237915", "0.72022533", "0.7041745", "0.7013421", "0.69024694", "0.6892635", "0.6891861", "0.68075854", "0.68056464", "0.6782797", "0.6745265", "0.6696141", "0.66879743", "0.66873586", "0.66545063", "0.6602608", "0.6602608", "0.65958893", "0.65953624", "0.6585...
0.7507121
0
force the socket server to exit
def close(self): try: self.rpc_server.shutdown() self.join(1.0) except Exception: LOGGER.warning("An error occurred while closing RPC interface")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def server_close(self):\n\t\tself.socket.close()", "def server_exit():\n return", "def exit(self):\n self._status = \"\"\n self._sock.settimeout(1.0)\n self._sock.sendto(bytes(\"bla\", \"utf-8\"), (self._cfg.host, self._cfg.port))", "def exit(s_socket):\r\n s_socket.send(\"\")", ...
[ "0.7984393", "0.7898972", "0.7716949", "0.76290375", "0.76139414", "0.7602799", "0.7559701", "0.7553095", "0.75294524", "0.752781", "0.7482219", "0.7415964", "0.739169", "0.73783654", "0.73598665", "0.73078346", "0.72906005", "0.7285503", "0.7278782", "0.7272383", "0.72687703...
0.0
-1
test if there is something to read on the console
def _check_console_input(self): if os.name == "nt": if 0 == ctypes.windll.Kernel32.WaitForSingleObject(self.console_handle, 500): return True elif os.name == "posix": (inputready, abcd, efgh) = select.select([sys.stdin], [], [], 0.5) if len(i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_interactive():\n\n return sys.stdin.isatty()", "def hastty():\n try:\n return sys.stdin and sys.stdin.isatty()\n except Exception: # pragma: no cover\n return False # i.e. no isatty method?", "def chk_stdin(self):\t# check keyboard input\n\t\tdr, dw, de = select([sys.stdin], [],...
[ "0.67703044", "0.6668972", "0.6553596", "0.64391434", "0.64319617", "0.63720024", "0.6358427", "0.63391805", "0.61975825", "0.6152854", "0.6141509", "0.6141509", "0.60947686", "0.6083325", "0.6058859", "0.60456157", "0.60350746", "0.5998256", "0.59890354", "0.5987575", "0.597...
0.7178151
0
read from the console, transfer to the server and write the answer
def run(self): while self._go.isSet(): #while app is running if self._check_console_input(): #if something to read on the console cmd = sys.stdin.readline() #read it self.inq.put(cmd) #dispatch it tpo the server response = self.outq.get(timeout=2....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_command(self, data):\n try:\n self.write(data)\n reply = self.read_line()\n \n if reply == \"{}\":\n pass\n else:\n print \"send_command: received bad reply %s\" % (reply)\n sys.exit(1)\n excep...
[ "0.6864386", "0.6665979", "0.6607433", "0.6399282", "0.6332425", "0.63022834", "0.6229169", "0.61992306", "0.6194718", "0.6157062", "0.6156837", "0.6120637", "0.61120206", "0.6109998", "0.6108802", "0.60982066", "0.608361", "0.60783035", "0.60692763", "0.60670555", "0.6063523...
0.70131034
0
add a custom command
def add_command(self, name, fct): self.cmds[name] = fct
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add(self, name, command):", "def custom(self, command):\n self.command.append(command)\n return self", "def add_command(self, command):\n self.command.extend(command)", "def additional_command(self):\n pass", "def addCommand(function, command, description, usage = None, minA...
[ "0.84777814", "0.8207641", "0.79712236", "0.7883204", "0.77547246", "0.7743336", "0.76763064", "0.75891477", "0.7531351", "0.7500253", "0.7410895", "0.74082583", "0.7375008", "0.73666376", "0.7344369", "0.73362553", "0.73289585", "0.7235806", "0.72175014", "0.7207916", "0.718...
0.7766356
4
declare a hook function by its name. It must be installed by an install hook command
def declare_hook(self, fct_name, fct): self._hooks_fct[fct_name] = fct
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hook(self, name):\r\n def wrapper(func):\r\n self.hooks.add(name, func)\r\n return func\r\n return wrapper", "def _do_install_hook(self, args):\r\n hook_name = args[1]\r\n fct_name = args[2]\r\n hooks.install_hook(hook_name, self._hooks_fct[fct_name])"...
[ "0.75208604", "0.74992293", "0.7125039", "0.7032469", "0.68332726", "0.6767832", "0.6745549", "0.6641949", "0.6549269", "0.6544802", "0.6539794", "0.6493673", "0.6455547", "0.640969", "0.636993", "0.6339469", "0.6207344", "0.62000906", "0.6188418", "0.6178408", "0.6156353", ...
0.70780766
3
convert a tuple to a string
def _tuple_to_str(self, the_tuple): ret = "" for item in the_tuple: ret += (" " + str(item)) return ret[1:]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _tupstr(tuple_):\n return ', '.join(list(map(str, tuple_)))", "def tupleStrFormat(tupl):\n string = \"this is a tuple (\"\n for element in tupl:\n string += str(element) + \", \"\n string += \")\"\n return string", "def str_tuple(item):\n return \"{}:{}\".format(item[0], item[1])",...
[ "0.8968813", "0.8027702", "0.7950681", "0.78714865", "0.7861424", "0.7818346", "0.780113", "0.7644711", "0.74937075", "0.7376981", "0.7257783", "0.7226776", "0.7204182", "0.7195983", "0.71484184", "0.7052116", "0.6914404", "0.68726766", "0.67629915", "0.6719136", "0.66418886"...
0.8546605
1
execute the add_slave command
def _do_add_slave(self, args): bus_type = args[1] slave_id = int(args[2]) if bus_type == 'rtu': self.server._servers[0].add_slave(slave_id) elif bus_type == 'tcp': self.server._servers[1].add_slave(slave_id) return "{0}".format(slave_id)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def onSlave(self):", "def add_slave(self, widget):\n self._slaves.add(widget)\n widget[tkc.STATE] = self._get_slaves_state()", "def connect_subproc():\n return factory.connect_subproc([sys.executable, \"-u\", SERVER_FILE, \"-q\", \"-m\", \"stdio\"], \n SlaveService)", "def getSlave(na...
[ "0.66664743", "0.6366341", "0.62082016", "0.6190436", "0.6048615", "0.6037338", "0.5986998", "0.59091246", "0.59048486", "0.573768", "0.56949824", "0.5680297", "0.5538369", "0.5517972", "0.54603016", "0.54316896", "0.5403584", "0.53891146", "0.53774834", "0.5355592", "0.53412...
0.72399515
0
execute the has_slave command
def _do_has_slave(self, args): bus_type = args[1] slave_id = int(args[2]) try: if bus_type == 'rtu': self.server._servers[0].get_slave(slave_id) elif bus_type == 'tcp': self.server._servers[1].get_slave(slave_id) except Exce...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def slaveConnected(slaveName):", "def slave_status():\n run_mysql_command(\"SHOW SLAVE STATUS\\G;\")", "def onSlave(self):", "def query_slave(self, slave_name=\"\"):\n\t\t#using the bus template find the location of the slave folders\n\n\t\t#see if the name matches up to any of the files\n\t\t#\"name\".v ...
[ "0.7264953", "0.68657476", "0.6751939", "0.67488265", "0.65639305", "0.63759196", "0.6268738", "0.5960661", "0.5858432", "0.5852638", "0.5848737", "0.58346575", "0.5781598", "0.5757251", "0.5695663", "0.56429327", "0.5631435", "0.56145155", "0.56121534", "0.5608739", "0.55915...
0.7234994
1
execute the remove_slave command
def _do_remove_slave(self, args): bus_type = args[1] slave_id = int(args[2]) if bus_type == 'rtu': self.server._servers[0].remove_slave(slave_id) elif bus_type == 'tcp': self.server._servers[1].remove_slave(slave_id) return ""
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _do_remove_block(self, args):\r\n bus_type = args[1]\r\n slave_id = int(args[2])\r\n name = args[3]\r\n if bus_type == 'rtu':\r\n slave = self.server._servers[0].get_slave(slave_id)\r\n elif bus_type == 'tcp':\r\n slave = self.server._servers[1].get_slav...
[ "0.645421", "0.6409547", "0.6328437", "0.62247264", "0.6103352", "0.6079856", "0.5915689", "0.58712333", "0.58550864", "0.5795309", "0.57882065", "0.5786015", "0.56886345", "0.5667349", "0.56095004", "0.55818015", "0.5518671", "0.551404", "0.5513143", "0.5506423", "0.5499367"...
0.758631
0
execute the remove_slave command
def _do_remove_all_slaves(self, args): bus_type = args[1] if bus_type == 'rtu': self.server._servers[0].remove_all_slaves() elif bus_type == 'tcp': self.server._servers[1].remove_all_slaves() return ""
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _do_remove_slave(self, args):\r\n bus_type = args[1]\r\n slave_id = int(args[2])\r\n if bus_type == 'rtu':\r\n self.server._servers[0].remove_slave(slave_id)\r\n elif bus_type == 'tcp':\r\n self.server._servers[1].remove_slave(slave_id)\r\n return \"\"",...
[ "0.75859696", "0.6454993", "0.6331691", "0.62227625", "0.6102306", "0.6080039", "0.591498", "0.5871398", "0.5855805", "0.579703", "0.5790313", "0.57880354", "0.56902444", "0.5667686", "0.5609197", "0.55841833", "0.55213577", "0.55143905", "0.55125976", "0.5509416", "0.5499143...
0.640991
2
execute the add_block command
def _do_add_block(self, args): bus_type = args[1] slave_id = int(args[2]) name = args[3] block_type = int(args[4]) starting_address = int(args[5]) length = int(args[6]) if bus_type == 'rtu': slave = self.server._servers[0].get_slave(slave_id) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def add_block(\n self,\n position: typing.Tuple[int, int, int],\n block_name: typing.Union[str, typing.Any],\n immediate=True,\n block_update=True,\n block_update_self=True,\n lazy_setup: typing.Callable[[typing.Any], None] = None,\n check_build_range=T...
[ "0.65428215", "0.637844", "0.6291531", "0.62718385", "0.62567204", "0.6255184", "0.6248362", "0.62457955", "0.62122875", "0.6192997", "0.6187441", "0.61778", "0.6176169", "0.61067283", "0.6066772", "0.60516053", "0.6045066", "0.6039789", "0.6039594", "0.6026823", "0.60244447"...
0.71566474
0
execute the remove_block command
def _do_remove_block(self, args): bus_type = args[1] slave_id = int(args[2]) name = args[3] if bus_type == 'rtu': slave = self.server._servers[0].get_slave(slave_id) elif bus_type == 'tcp': slave = self.server._servers[1].get_slave(slave_id) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_block(self, block):\n raise NotImplementedError()", "async def remove_block(\n self,\n position: typing.Union[\n typing.Tuple[int, int, int],\n typing.Any,\n ],\n immediate: bool = True,\n block_update: bool = True,\n block_update_...
[ "0.7275056", "0.71058", "0.7038019", "0.6806753", "0.6744042", "0.6390654", "0.6365233", "0.62796766", "0.6235635", "0.6175417", "0.6071809", "0.60490525", "0.60421735", "0.59872586", "0.5936501", "0.5895922", "0.5890499", "0.5844823", "0.5836963", "0.5827584", "0.57998425", ...
0.75226086
0
execute the remove_all_blocks command
def _do_remove_all_blocks(self, args): bus_type = args[1] slave_id = int(args[2]) if bus_type == 'rtu': slave = self.server._servers[0].get_slave(slave_id) elif bus_type == 'tcp': slave = self.server._servers[1].get_slave(slave_id) slave.remove_all_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_blocks(draft):\n for symbol in draft.Blocks:\n if symbol.Name in blocks_to_delete:\n print(\"[-] %s, \\tdeleted\" % symbol.Name)\n symbol.delete()\n\n # for ball in draft.ActiveSheet.Balloons:\n if draft.Balloons:\n for ball in draft.Balloons:\n if...
[ "0.64979184", "0.64848286", "0.62811196", "0.6276664", "0.6214501", "0.61948407", "0.6133304", "0.60413116", "0.5981843", "0.5847182", "0.5838975", "0.58206236", "0.58180887", "0.5778389", "0.57099503", "0.570558", "0.56985164", "0.5684649", "0.5678892", "0.5661721", "0.56431...
0.720971
0
execute the set_values command
def _do_set_values(self, args): bus_type = args[1] slave_id = int(args[2]) name = args[3] address = int(args[4]) values = [] for val in args[5:]: values.append(int(val)) if bus_type == 'rtu': slave = self.server._servers[0].get_sla...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setValues(self):\n pass", "def setValues(self):\n pass", "def setValues(self):\n pass", "def setValues(self):\n pass", "def setValues(self):\n pass", "def setValues(self):\n pass", "def _setVals(self, *args, **kwargs):\n pass", "def _handler_comman...
[ "0.6792693", "0.6792693", "0.6792693", "0.6792693", "0.6792693", "0.6792693", "0.66181505", "0.6392363", "0.63843226", "0.6289433", "0.6254226", "0.6184798", "0.61723644", "0.61695176", "0.60782146", "0.60753417", "0.60616684", "0.60443455", "0.60417485", "0.6041675", "0.6040...
0.64454114
7
execute the get_values command
def _do_get_values(self, args): bus_type = args[1] slave_id = int(args[2]) name = args[3] address = int(args[4]) length = int(args[5]) if bus_type == 'rtu': slave = self.server._servers[0].get_slave(slave_id) elif bus_type == 'tcp': ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetValues(self):\n ...", "def GetValues(self):\n ...", "def GetValues(self):", "def cli(ctx):\n return ctx.gi.cannedvalues.get_values()", "def execute():", "def handle(self, rsm_ctx):\n rsm_ctx.log('info', 'Executing \"list\" operation for get usage ...')\n\n runtime_pr...
[ "0.64411694", "0.64411694", "0.63603795", "0.63521314", "0.6046805", "0.5897361", "0.58769673", "0.5819099", "0.58130467", "0.5808448", "0.57892984", "0.57892984", "0.57892984", "0.57892984", "0.57187206", "0.5678759", "0.5631098", "0.56012404", "0.5589896", "0.55613226", "0....
0.5755564
14
install a function as a hook
def _do_install_hook(self, args): hook_name = args[1] fct_name = args[2] hooks.install_hook(hook_name, self._hooks_fct[fct_name])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hook(callback):\n hooks.append(callback)", "def hook(self, name):\r\n def wrapper(func):\r\n self.hooks.add(name, func)\r\n return func\r\n return wrapper", "def install_hook(hook_id, proc):\n handle = user32.SetWindowsHookExA(hook_id, proc, None, 0)\n if not hand...
[ "0.71828526", "0.69452894", "0.6812174", "0.6810592", "0.6807268", "0.6787101", "0.6680161", "0.6601569", "0.65442866", "0.6482846", "0.6470736", "0.6468058", "0.6451436", "0.63961804", "0.63879573", "0.6370445", "0.6350216", "0.6326162", "0.6303307", "0.63018394", "0.6298826...
0.80193776
0
uninstall a function as a hook. If no function is given, uninstall all functions
def _do_uninstall_hook(self, args): hook_name = args[1] try: hooks.uninstall_hook(hook_name) except KeyError as exception: LOGGER.error(str(exception))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def uninstall_hook(handle):\n if handle:\n user32.UnhookWindowsHookEx(handle)", "def _uninstall(package_name, remove_all, app_id, cli, app):\n\n package_manager = _get_package_manager()\n err = package.uninstall(\n package_manager, package_name, remove_all, app_id, cli, app)\n if err is...
[ "0.69406205", "0.65433", "0.6514345", "0.6452318", "0.631227", "0.618152", "0.618152", "0.6086222", "0.6082233", "0.60555613", "0.6052477", "0.6052156", "0.60201836", "0.6006638", "0.60027117", "0.5980151", "0.5978945", "0.59783494", "0.5975453", "0.5919139", "0.58928365", ...
0.73846674
0
change the verbosity of the server
def _do_set_verbose(self, args): verbose = int(args[1]) self.server.set_verbose(verbose) return "%d" % verbose
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verbosity(v):\n assert v in [0,1,2] # debug, warn, info\n GLOBAL['VERBOSITY'] = v", "def set_verbosity():\n\n\tif conf.verbose is None:\n\t\tconf.verbose = 1\n\n\tconf.verbose = int(conf.verbose)\n\n\tif conf.verbose == 0:\n\t\tlogger.setLevel(logging.ERROR)\n\telif conf.verbose == 1:\n\t\tlogger.se...
[ "0.7681478", "0.72215545", "0.71093506", "0.6939538", "0.6873078", "0.676105", "0.67317533", "0.6667096", "0.6627816", "0.65958714", "0.6590193", "0.65867203", "0.65688455", "0.6464963", "0.6452119", "0.6382751", "0.63656926", "0.6328291", "0.63164514", "0.6315265", "0.630789...
0.7388952
1
almostforever loop in charge of listening for command and executing it
def _handle(self): while True: cmd = self.inq.get() args = cmd.strip('\r\n').split(' ') if cmd.find('quit') == 0: self.outq.put('bye-bye\r\n') break elif args[0] in self.cmds: try: answer...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self):\n self.cmdloop()", "def Listen(self):\n while True:\n time.sleep(1)", "def run(self):\n self.connect()\n self.run_forever()", "def run(self):\n while True:\n self.command = input(\"> cmd >>> \")\n self.invoker.run(self.command...
[ "0.7263554", "0.7148153", "0.7033267", "0.7008529", "0.6933037", "0.68997264", "0.689191", "0.6821746", "0.67580086", "0.67326045", "0.672564", "0.66789603", "0.6661458", "0.6648982", "0.66209096", "0.66112405", "0.6604945", "0.6604396", "0.6601895", "0.65820444", "0.6565108"...
0.0
-1
Get the current version or exit the process.
def version_or_exit(path): with cd(path): versioning_file = join(os.curdir, 'versioning.py') try: get_version = run_command(versioning_file) if get_version.returncode: abort(colors.red('versioning.py') + ' returned an error.') else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_version():\n click.echo(get_current_version_number())", "def get_current_version(self):\n current_version = self.get_version(self.get_module_and_path(self._main_dir))\n return current_version", "def latest_version(self) -> AwesomeVersion | None:\n return self.sys_updater.version...
[ "0.781276", "0.7021756", "0.69878983", "0.6981611", "0.6781809", "0.67792046", "0.67674327", "0.67511374", "0.67059594", "0.6689565", "0.66695756", "0.66640997", "0.66595495", "0.6645535", "0.6642224", "0.6629286", "0.6607862", "0.6600906", "0.6595271", "0.6594787", "0.656329...
0.707849
1
Roll back the tagging that was just done and inform the user. >>> rollback('not_a_tag')
def rollback(tag): done = run_command(['git', 'tag', '-d', tag]) if done.returncode: echo.bold(colors.red(str(done))) sys.exit(done.returncode) echo.cyan('Done:', done.stdout.strip())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rollback(self):\n pass", "def rollback(self):\n self._rollback = True", "def rollback(self):\n raise NotImplementedError", "def rollback(self):\n raise TransactionRollback('rollback called outside of transaction')", "def rollback(self, stage, enodes, exception):", "def rol...
[ "0.76122165", "0.75165194", "0.74412733", "0.72169214", "0.71961904", "0.7160262", "0.70686543", "0.70201325", "0.70071846", "0.70071536", "0.70067024", "0.69872856", "0.6894638", "0.6878397", "0.6830433", "0.67013144", "0.6643999", "0.66095114", "0.66077113", "0.66047925", "...
0.8277594
0
Do a release step, possibly rolling back the tagging. >>> do_release_step('true', 'rollback_tag')
def do_release_step(command, tag, no_rollback=None): echo.cyan('running:', command) published = run_command(command) if published.returncode: echo.bold(colors.red('Failed:')) echo.yellow(published.stderr) echo.white(published.stdout) if no_rollback: echo.cyan(no_r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def release_command(project_path=None, noop=None):\n\n if not sys.version_info.major == 3:\n noop or abort(colors.bold(\n 'Releases are only compatible with both Python2 and Python3 if done via Python3. Aborting since this is Python2.'\n ))\n\n auto_version = version_or_exit(project_...
[ "0.6151928", "0.6130211", "0.6007178", "0.59868795", "0.58979225", "0.5823386", "0.5756305", "0.5547832", "0.5530814", "0.5437972", "0.5422568", "0.53532875", "0.53283924", "0.5260167", "0.5257902", "0.52491486", "0.5245861", "0.5234293", "0.5214079", "0.5172153", "0.5157206"...
0.7707624
0
A proposed way to release with versioning.
def release_command(project_path=None, noop=None): if not sys.version_info.major == 3: noop or abort(colors.bold( 'Releases are only compatible with both Python2 and Python3 if done via Python3. Aborting since this is Python2.' )) auto_version = version_or_exit(project_path) i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def publish_release(ctx):\n rel = _get_release()\n rel.update_release(rel.title, rel.raw_data[\"body\"], draft=False)", "def util_sign_release():\n os.chdir(REPO_PATH)\n dr = DebRepo()\n keyname = dr.read_keyname()\n out, err = dr.sign_release(keyname)\n print(out)\n print(err)", "def t...
[ "0.67993665", "0.6707474", "0.66985923", "0.6687874", "0.66721624", "0.65258163", "0.6516733", "0.645792", "0.64505965", "0.64209384", "0.63859695", "0.63254875", "0.63192844", "0.63131243", "0.6306063", "0.6298463", "0.6294964", "0.6291105", "0.62897235", "0.6286265", "0.626...
0.66860896
4
about about page not fully designed
def about(request): context = {} return render(request, 'store/about.html', context)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_about(self):\n render_about_window()", "def on_about(self, event):\n pass", "def about():\n return render_template('about.html', title='About')", "def about():\n\n return render_template('about_page.html', title='About')", "def about_page(request):\r\n return render(request...
[ "0.81471705", "0.774489", "0.76973206", "0.7627653", "0.75630844", "0.75003463", "0.7499308", "0.7405088", "0.73876166", "0.73860353", "0.7378438", "0.736227", "0.7333406", "0.729723", "0.72963274", "0.7288211", "0.72665966", "0.72650564", "0.72650564", "0.72650564", "0.72650...
0.6894653
83
menu menu page logic. displaying all the products in our DB
def menu(request): cart = cartData(request) cart_items = cart['cart_items'] # order = cart['order'] # items = cart['items'] # Get all our object products = BobaProduct.objects.all() # Dictionary to hold our products context = {"products": products, "cart_items": cart_items} return re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __products_menu(self):\n log.debug(\"Displaying __products_menu\")\n # Get the products list from the db\n products = self.session.query(db.Product).filter_by(deleted=False).all()\n # Create a list of product names\n product_names = [product.name for product in products]\n ...
[ "0.73752975", "0.724429", "0.69932497", "0.6988591", "0.6971659", "0.692478", "0.69133264", "0.688549", "0.673323", "0.6712486", "0.66611415", "0.6580116", "0.6567587", "0.6560556", "0.6493791", "0.64319545", "0.6419612", "0.63676864", "0.6316506", "0.62987536", "0.6239047", ...
0.7492175
0
updateItem When users click on the up or down arrow, the item quantity updates
def updateItem(request): # Getting the data when you add to cart. Body of JSON data = json.loads(request.body) # Getting values we sent to body as JSON. prodID and Action productId = data['prodId'] action = data['action'] # Get curr customer customer = request.user.customer product = Bo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_item(self, table, item):", "def update_quantity(item: dict, new_qty):\n qty = item.get('quantity')\n if isinstance(qty, dict):\n item['quantity']['value'] = new_qty\n else:\n item['quantity'] = new_qty", "def getitem(self):\n self.inventory += 1", "def updateItem(self...
[ "0.7238084", "0.6676294", "0.6630097", "0.6506693", "0.64071", "0.63922894", "0.63809747", "0.63738674", "0.63213277", "0.63149995", "0.6271377", "0.6253388", "0.62310386", "0.61985815", "0.61676186", "0.6138603", "0.61175585", "0.61047894", "0.6103208", "0.60880166", "0.6047...
0.6653981
2
login Checks if user is logged in. authenticating the username and password with our DB
def loginUser(request): # If logged in, won't be able to acces /register path # user redirected back to home store page if request.user.is_authenticated: return redirect('store') else: if request.method == 'POST': username = request.POST['username'] password = re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def login():", "def login():", "def do_login_login():\n print(inspect.stack()[1][3])\n print(request.form)\n query = select([User]).where(and_(User.columns.email == request.form['email'],User.columns.password==request.form['password'] ))\n ResultProxy = connection.execute(query)\n ResultSet = Re...
[ "0.8057768", "0.8057768", "0.77485305", "0.7635567", "0.758823", "0.75047237", "0.749717", "0.7494013", "0.7489449", "0.7477708", "0.74765", "0.7418551", "0.73965025", "0.7365224", "0.7345344", "0.7301027", "0.72792137", "0.7273613", "0.7271766", "0.7261007", "0.72414416", ...
0.0
-1
Logout Users logging out logic
def logoutUser(request): logout(request) return redirect('login')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def logout_user():\n pass", "def logout():", "def log_out_user(self):\n flask_login.logout_user()", "def logout(self):\n pass", "def logout(self):", "def logout(self):\n with self.client.post(\"/logout\", catch_response=True) as response:\n for r_hist in respons...
[ "0.8471796", "0.8462372", "0.8341381", "0.830757", "0.8290482", "0.8192538", "0.8181734", "0.8145092", "0.813599", "0.8031157", "0.8007361", "0.7865614", "0.7851435", "0.7833405", "0.7817967", "0.7797834", "0.776156", "0.776156", "0.77442855", "0.77254885", "0.77233475", "0...
0.7676299
24
register Users can register an account. When users finish registering, it will send a signal (signal.py) and save the information to the Customer model also. The customer model will be added to the Group model designed for customers. Customer group have limited access.
def register(request): # If logged in, won't be able to acces /register path # user redirected back to home store page if request.user.is_authenticated: return redirect('store') else: form = RegisterUserForm() if request.method == 'POST': form = RegisterUserForm(requ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register(self, data: NewCustomerData):\n\n # TODO: check if mail address already exist in YOUR database\n # if UserCheck:\n # Return False\n\n # TODO: First add new user / customer data to YOUR database\n new_user_id = str(uuid.uuid4())\n new_customer_id = str(uuid.u...
[ "0.66814893", "0.6333076", "0.6214655", "0.61272776", "0.61253995", "0.6043345", "0.60100293", "0.599151", "0.5989476", "0.5951472", "0.5948392", "0.5930037", "0.59141916", "0.58658", "0.58605176", "0.58476645", "0.58301413", "0.5824196", "0.581", "0.58018017", "0.57890606", ...
0.0
-1
guestChat If the user is not authenticated, they will be redirected to this site where they can input a guest name and enter the chatbox
def guestChat(request): form = GuestChat() if request.method == "POST": form = GuestChat(request.POST) if form.is_valid(): guestName = form.cleaned_data.get('guest_name') return render(request, 'chat/room.html', {"guestName": guestName}) context = {"form"...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def chat():\n username = request.cookies.get('username')\n\n if username != None and username != \"\":\n return r.renderContent('chat.html', name=username)\n return redirect('/login')", "def chat():\n name = session.get('name', '')\n room = session.get('room', '')\n if name == '' or room == '...
[ "0.7034232", "0.6945806", "0.6945806", "0.6945806", "0.62233275", "0.6180299", "0.60441524", "0.60381275", "0.603254", "0.5890163", "0.58691007", "0.57892066", "0.57755506", "0.5752947", "0.5749893", "0.57432944", "0.57223237", "0.57203776", "0.5709425", "0.5697157", "0.56930...
0.7114216
0
room Room where users can chat with each other!
def room(request): cart = cartData(request) cart_items = cart['cart_items'] # order = cart['order'] # items = cart['items'] # Get all our object products = BobaProduct.objects.all() # Dictionary to hold our products context = {"products": products, "cart_items": cart_items} return...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def joined(message):\n #room = session.get('room')\n room='abc'\n join_room(room)\n #emit('status', {'msg': session.get('name') + ' has entered the room.' + message['msg']}, room=room)\n emit('status', {'msg': 'Yao has entered the room.'}, room=room)\n #emit('status', {'msg': 'Yao has entered the...
[ "0.69065624", "0.6581072", "0.65549517", "0.64790493", "0.64674", "0.64595354", "0.64175236", "0.6400316", "0.6383287", "0.63572484", "0.63449323", "0.6282892", "0.62755597", "0.62302303", "0.6223572", "0.6223572", "0.6223572", "0.6205707", "0.62002337", "0.617828", "0.616806...
0.0
-1
create a histogram with k clusters
def find_histogram(clt): numLabels = np.arange(0, len(np.unique(clt.labels_)) + 1) (hist, _) = np.histogram(clt.labels_, bins=numLabels) hist = hist.astype("float") hist /= hist.sum() return hist
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _cluster_into_bins(eval_data, ref_data, num_clusters):\r\n\r\n cluster_data = np.vstack([eval_data, ref_data])\r\n kmeans = sklearn.cluster.MiniBatchKMeans(n_clusters=num_clusters, n_init=10)\r\n labels = kmeans.fit(cluster_data).labels_\r\n\r\n eval_labels = labels[:len(eval_data)]\r\n ref_labe...
[ "0.6827185", "0.66105485", "0.6588582", "0.65809286", "0.65499175", "0.64803886", "0.64568484", "0.6423207", "0.64217985", "0.64207876", "0.6369518", "0.63385165", "0.6335345", "0.6318504", "0.6299519", "0.62819403", "0.62726754", "0.62273693", "0.61965", "0.6196029", "0.6186...
0.0
-1
helper function. converts polar coordinates to cartesian coordinates
def polar2cartesian(phi, r): phi_radians = radians(phi) x = r*cos(phi_radians) y = r*sin(phi_radians) return x, y
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def polar2cartesian(polar):\n polar = np.array(polar).squeeze()\n r, azimuth = polar\n x = r * np.cos(azimuth)\n y = r * np.sin(azimuth)\n return np.array([x, y])", "def cartesian2polar(cartesian):\n cartesian = np.array(cartesian).squeeze()\n x, y = cartesian\n r = np.linalg.norm([x, y])...
[ "0.82244575", "0.8105141", "0.80088353", "0.7923384", "0.79149836", "0.78879607", "0.7887872", "0.7817563", "0.77453053", "0.75973773", "0.7490389", "0.74608546", "0.7458191", "0.7444722", "0.7359827", "0.73200595", "0.7263952", "0.72617006", "0.72519535", "0.7247891", "0.720...
0.78640485
7
helper function. converts cartesian to polar coordinates
def cartesian2polar(x, y): r = (x**2+y**2)**.5 phi = atan2(y, x) return phi, r
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cartesian2polar(cartesian):\n cartesian = np.array(cartesian).squeeze()\n x, y = cartesian\n r = np.linalg.norm([x, y])\n azimuth = np.arctan2(y, x)\n return np.array([r, azimuth])", "def cartesianToPolar(x,y):\n r = np.sqrt(x**2 + y**2)\n theta = np.arctan2(y,x)\n\n return r,theta", ...
[ "0.85255504", "0.83104247", "0.8125831", "0.8120185", "0.7928597", "0.78929526", "0.78735673", "0.78572035", "0.7814459", "0.77634734", "0.77590376", "0.76726127", "0.76157874", "0.7592172", "0.75634295", "0.7409552", "0.7374779", "0.73126763", "0.7266417", "0.720853", "0.718...
0.82151556
2
Returns the projection of the BinaryStateSequences using DAG functionality
def find_approx(self, gamma): if self.jumps != []: # first we divide the jumps of the BSS into subarrays in each of which the subsequent jumps are closer to each other than \gamma jump_seq_list = identify_jump_subseq(self.jumps, gamma) # jumps will store all jumps of the proj...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_sequence(self):\n queue = [self.root]\n seq_k = []\n seq_v = []\n\n while queue:\n res = queue.pop(0)\n seq_k.append(res.key)\n seq_v.append(res.payload)\n if res.hasLeftChild():\n queue.append(res.leftChild)\n ...
[ "0.5732363", "0.5603699", "0.55623233", "0.5354654", "0.5266046", "0.5237453", "0.52372754", "0.5195425", "0.5162185", "0.5151733", "0.51412714", "0.51389015", "0.5124121", "0.5077115", "0.5061368", "0.50194114", "0.4984614", "0.49810973", "0.49608457", "0.49366307", "0.49213...
0.47216684
56
Starts up the game by creating an instance of it and running it. main() > None
def main(): game = RiichiMahjongApp() game.run()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n g = Game(800, 600)\n g.start()", "def main():\n g = DemoGame(800, 600)\n g.start()", "def main():\r\n gameclass = data.game.GameClass()\r\n gameclass.main_loop()", "def main():\n if \"cli\" in sys.argv:\n run_cli_game()\n else:\n run_gui_game()", "def mai...
[ "0.85635036", "0.81876785", "0.80455476", "0.78687423", "0.77845705", "0.7681315", "0.7620199", "0.7465425", "0.739541", "0.7386681", "0.7336826", "0.73127043", "0.72832006", "0.7261894", "0.72405136", "0.72397304", "0.7217755", "0.71836495", "0.7147536", "0.71364313", "0.713...
0.7948774
3
Saves the canvas as the desired output format in an output directory (default = outputPlots)
def makeSavePaths(title, *fileFormats, outputdir="outputPlots"): if not os.path.exists(outputdir): os.makedirs(outputdir) return [outputdir + "/" + title + fileFormat for fileFormat in fileFormats]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_plot(self):\r\n\t\t# Generate the plot\r\n\t\tself.generate_plot()\r\n\t\t# Create save directory\r\n\t\tdirectory = self.dir + '/%s/' % str(int(self.universe.init_time))\r\n\t\tif not path_exists(directory):\r\n\t\t\tmakedirs(directory)\r\n\t\t# Save image file\r\n\t\tself.fig.savefig(directory+str(self....
[ "0.73099494", "0.7072037", "0.70680714", "0.6982794", "0.69216484", "0.6858064", "0.6825694", "0.66896456", "0.66870093", "0.6677782", "0.6676616", "0.66535544", "0.6621202", "0.6598774", "0.65736574", "0.65736574", "0.6550163", "0.6550006", "0.6543479", "0.65289", "0.6524749...
0.0
-1
Computes the (exact or approximate) Wasserstein distance of order 1 or 2 between empirical distributions
def wass_distance(X, Y, order=2, type='exact'): if order == 2: M = ot.dist(X, Y) elif order == 1: M = ot.dist(X, Y, metric='euclidean') else: raise Exception("Order should be 1 or 2.") a = np.ones((X.shape[0],))/X.shape[0] b = np.ones((Y.shape[0],))/Y.shape[0] if type == ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wasserstein_distance(x, y, w=None, safe=True, normalize=True):\n if w is None:\n w = np.arange(x.shape[0])\n weights = np.diff(w)\n if normalize:\n x = x/np.sum(x)\n y = y/np.sum(y)\n if safe:\n assert (x.shape == y.shape == w.shape)\n np.testing.assert_almost_equ...
[ "0.7298485", "0.6762211", "0.67613786", "0.674721", "0.6696056", "0.66809154", "0.65337074", "0.63913155", "0.630053", "0.62047976", "0.61921614", "0.6189109", "0.61251026", "0.61149657", "0.60849", "0.6079637", "0.6072966", "0.60678524", "0.60678524", "0.6064711", "0.5981236...
0.6123327
13
Computes the Wasserstein distance of order 2 between two Gaussian distributions
def wass_gaussians(mu1, mu2, Sigma1, Sigma2): d = mu1.shape[0] if d == 1: w2 = (mu1 - mu2)**2 + (np.sqrt(Sigma1) - np.sqrt(Sigma2))**2 else: prodSigmas = Sigma2**(1/2)*Sigma1*Sigma2**(1/2) w2 = np.linalg.norm(mu1 - mu2)**2 + np.trace(Sigma1 + Sigma2 - 2*(prodSigmas)**(1/2)) retur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_distribution_distance(freqs1, freqs2):\n A = np.array([freqs1, freqs2])\n p_value = calculate_chi_square_p_value(A)\n return 1 - p_value", "def distributions_EMD(d1, d2):\n return ss.wasserstein_distance(d1.get_probs(), d2.get_probs()) / len(d1.get_probs())", "def dist_sph(w1, w2):\n ...
[ "0.6888003", "0.6883681", "0.67507505", "0.6649754", "0.6564868", "0.65519416", "0.6545447", "0.6508782", "0.6508671", "0.6506747", "0.64647543", "0.64203846", "0.639461", "0.6382358", "0.6368685", "0.6355784", "0.6326227", "0.62741095", "0.6272526", "0.6272526", "0.62541515"...
0.7291682
0
Computes the SlicedWasserstein distance between empirical distributions
def sw_distance(X, Y, n_montecarlo=1, L=100, p=2): X = np.stack([X] * n_montecarlo) M, N, d = X.shape order = p # Project data theta = np.random.randn(M, L, d) theta = theta / (np.sqrt((theta ** 2).sum(axis=2)))[:, :, None] # Normalize theta = np.transpose(theta, (0, 2, 1)) xproj = np.m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _sliced_wasserstein(a, b, random_sampling_count, random_projection_dim):\n s = array_ops.shape(a)\n means = []\n for _ in range(random_sampling_count):\n # Random projection matrix.\n proj = random_ops.random_normal(\n [array_ops.shape(a)[1], random_projection_dim])\n proj *= math_ops.rsqrt(...
[ "0.73132163", "0.69209224", "0.6595377", "0.6508837", "0.64674246", "0.6182006", "0.6136217", "0.60961664", "0.60670584", "0.599721", "0.5941015", "0.592132", "0.58674234", "0.5859064", "0.5859064", "0.5853676", "0.58326715", "0.5797358", "0.57752645", "0.5769444", "0.5740603...
0.0
-1
Computes the SlicedWasserstein distance of order 2 between two Gaussian distributions
def sw_gaussians(mu1, mu2, Sigma1, Sigma2, n_proj=100): d = mu1.shape[0] # Project data thetas = np.random.randn(n_proj, d) thetas = thetas / (np.sqrt((thetas ** 2).sum(axis=1)))[:, None] # Normalize proj_mu1 = thetas @ mu1 proj_mu2 = thetas @ mu2 sw2 = 0 for l in range(n_proj): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _sliced_wasserstein(a, b, random_sampling_count, random_projection_dim):\n s = array_ops.shape(a)\n means = []\n for _ in range(random_sampling_count):\n # Random projection matrix.\n proj = random_ops.random_normal(\n [array_ops.shape(a)[1], random_projection_dim])\n proj *= math_ops.rsqrt(...
[ "0.6943489", "0.6770129", "0.6687574", "0.6623814", "0.6613027", "0.64795405", "0.6437049", "0.64363605", "0.6361409", "0.6361409", "0.6353854", "0.6274701", "0.6268197", "0.62616664", "0.62546533", "0.6212448", "0.6202427", "0.618078", "0.6178968", "0.61769336", "0.61652464"...
0.572933
70
Computes the Hilbert distance of order p
def hilbert_distance(X, Y, p=2): # We consider N_X = N_Y xordered = X[HilbertCode_caller.hilbert_order_(X.T)] yordered = Y[HilbertCode_caller.hilbert_order_(Y.T)] hilbert_dist = (np.abs(xordered - yordered) ** p).sum() hilbert_dist /= X.shape[0] hilbert_dist = hilbert_dist ** (1/p) return hi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def HammingDistance(p, q):\r\n if len(p) != len(q):\r\n return -1\r\n dist = 0\r\n #zip(AB,CD) gives (('A','C'),('B','D'))\r\n for first, second in zip(p, q):\r\n if first != second:\r\n dist = dist + 1\r\n return dist", "def ham_dist(p, q):\n count = 0\n for i in ra...
[ "0.6240977", "0.6224513", "0.6224513", "0.62134373", "0.61977607", "0.61486363", "0.60876817", "0.608004", "0.5990324", "0.59267354", "0.5843678", "0.580374", "0.5779593", "0.57608706", "0.56451637", "0.56375206", "0.563657", "0.5633568", "0.5630969", "0.5597321", "0.5574527"...
0.80400836
0
Computes the swapping distance
def swap_distance(X, Y, n_sweeps=10000, tol=1e-8, p=2): # We consider N_X = N_Y if p == 2: M = ot.dist(X, Y) # Cost matrix o1 = HilbertCode_caller.hilbert_order_(X.T) o2 = HilbertCode_caller.hilbert_order_(Y.T) permutation = o2[np.argsort(o1)] total_cost = list(map(lambda k: M[k, permut...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def switch_distance(pair_1, pair_2):\r\n\th1_1=pair_1[0]\r\n\th2_1=pair_2[0]\r\n\th2_2=pair_2[1]\r\n\tcnt_1=0\r\n\tcnt_2=0\r\n\t# print h2_1, h1_1\r\n\tfor i in xrange(0,len(pair_1[0])):\r\n\t\tif h2_1[i]!=h1_1[i]:\r\n\t\t\th2_1, h2_2=switch(h2_1, h2_2, i)\r\n\t\t\t# print h2_1, h2_2, i\r\n\t\t\tcnt_1+=1\r\n\tprin...
[ "0.6582465", "0.6532841", "0.63852835", "0.63033766", "0.6189577", "0.6141517", "0.60874605", "0.6075062", "0.60507214", "0.5982342", "0.59569436", "0.59408253", "0.59205955", "0.5896892", "0.5882448", "0.58802503", "0.5877402", "0.58580816", "0.5843558", "0.58246493", "0.581...
0.69632035
0
Cleans passed string to either return a valid SVGRGBHEXnotation or an empty string.
def cleanup_passed_color_value(s): reo = re.compile('[0-9a-f]') cannotBeCleaned = '' if s[0] == '#' and len(s) in [4,7] and reo.match(s[1:]): return s if s in colorNamesAndCodes: col = colorNamesAndCodes[s] if reo.match(col[1:]): return col else: r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_hex(text): \n return re.sub(r'&.*?;', r'', text)", "def clean_xml_string(s):\n return VALID_XML_CHARS_REGEX.sub(\"\", s)", "def clean_str(string):\n #just return string if already cleaned\n return string", "def stripColor(self, s):\n return _stripColorRe.sub('', s)", "def clea...
[ "0.60601455", "0.59946215", "0.59191805", "0.58995914", "0.581662", "0.5805634", "0.5798346", "0.5726138", "0.57169926", "0.5714296", "0.5709046", "0.5709046", "0.57067734", "0.56963587", "0.56107944", "0.5573957", "0.5571539", "0.5549539", "0.55424464", "0.5520134", "0.55162...
0.60755706
0
Prints usage information for this script.
def print_usage_info_screen(): print "" print "Usage: " print " ./generateButtons.py 'background-color' 'foreground-color'" print "" print "Examples: " print " ./generateButtons.py '#123456' '#ededed'" print " ./generateButtons.py 'red' 'white'" print " ./generateButtons.py '#123' 'p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_usage_command(self):\n print self.get_usage_command()", "def print_usage_command(self):\n print self.get_usage_command()", "def display_usage():\n print >> sys.stderr, __doc__", "def usage() :\n\n print usage.__doc__", "def print_usage():\r\n print(\"USAGE: python[3] pso.py [<...
[ "0.83552647", "0.83552647", "0.82969576", "0.820929", "0.81355053", "0.8083975", "0.7995658", "0.7995658", "0.78864413", "0.7830462", "0.7828616", "0.78017956", "0.77941793", "0.7784692", "0.7750403", "0.7727278", "0.7726475", "0.772244", "0.77223516", "0.77191854", "0.768068...
0.68501264
79
Prints debugging information when the script encounters an illegal color.
def print_illegal_color_format_screen( enteredBGColor, enteredFGColor, convertedBGColor, convertedFGColor ): print "" print "Error: are the passed in colors valid?" print " - passed in background-color '" + enteredBGColor + "' was converted to '" + convertedBGColor + "'." print " - passed in foregroun...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_err(*vargs, **kwargs):\n _do_print_color(*vargs, colorcode = 31, **kwargs)", "def print_warn(*vargs, **kwargs):\n _do_print_color(*vargs, colorcode = 33, **kwargs)", "def error_debug(input):\n print(\"\\033[1;31;40m{}\\033[0m\".format(input))", "def print_debug(*vargs, **kwargs):\n _do_...
[ "0.68145615", "0.6723713", "0.66837156", "0.64507365", "0.6412046", "0.64085376", "0.6315633", "0.6304557", "0.62818974", "0.61877924", "0.6137318", "0.6117421", "0.6116814", "0.6102645", "0.60926074", "0.6007336", "0.60038733", "0.59981924", "0.5976492", "0.5952483", "0.5877...
0.7021701
0
clean the data and return a cleaned data frame
def clean_data(): pd.set_option('display.max_columns', None) try: df = pd.read_csv('test1/movie.csv') except FileNotFoundError: df = pd.read_csv('movie.csv') df.drop(labels=["actor_3_facebook_likes", "actor_2_name", "actor_1_facebook_likes", "actor_1_name", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean(df):", "def cleaning (data):", "def full_clean():\n response_to_df_csv()\n dirty_data = pd.read_csv(\"./data/dirty_data.csv\")\n cleaned_data = dirty_data\n cleaned_data = drop_cols(cleaned_data)\n cleaned_data = lowercase_columns(cleaned_data)\n cleaned_data = make_numeric(cleaned_...
[ "0.8244901", "0.7523232", "0.74992603", "0.7492469", "0.72462", "0.71312463", "0.71093094", "0.70707947", "0.70557094", "0.6971841", "0.6931588", "0.6926689", "0.6919778", "0.69048214", "0.69015914", "0.68859094", "0.6883334", "0.6849267", "0.68437093", "0.6843559", "0.683384...
0.6978202
9
test some other ML diagram here
def other(): df = clean_data() # splits each item in the column and returns the first split item df["genres"] = df["genres"].apply(lambda x: x.split("|")[0]) print(df.tail())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_machine_learning():", "def test_visualize_recipe_nutrition(self):\n pass", "def test_predictor():", "def generate(self, diagram):", "def test(self, training_set, original_test_set, imitation_test_set ):\n\n plt.figure()\n\n training_axis = np.arange(len(training_set))\n ...
[ "0.68151563", "0.6623575", "0.6595899", "0.622909", "0.61528623", "0.6117836", "0.611043", "0.6069808", "0.6029971", "0.60299647", "0.5984303", "0.59809804", "0.5969215", "0.59662265", "0.5943415", "0.5939578", "0.5924961", "0.5924961", "0.590812", "0.5893653", "0.58805376", ...
0.0
-1
take in the csv, clean the data, fit the data to a model and then return the parameters
def process_data(self): y = self.df['gross'] x = self.df['imdb_score'] # plt.scatter(x, y, color='blue', label="data") # plt.xlabel("imdb_score") # plt.ylabel("gross") # need to fit an exponential data set popt, pcov = curve_fit(func, x, y) # popt is par...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_data(csv_filename,train_min_class_count,test_split=0.2,val_split=0.2):\n args = get_arguments(csv_filename)\n args_train, args_test, args_val = args_train_test_val_split(args,train_min_class_count=train_min_class_count)\n\n X_train = get_train_data(args_train)\n X_val = get_train_data(args_val)...
[ "0.61301714", "0.6037841", "0.6029579", "0.601778", "0.5993052", "0.5963778", "0.5914807", "0.5818441", "0.58000886", "0.57944095", "0.57944095", "0.57944095", "0.57944095", "0.57944095", "0.57944095", "0.57944095", "0.57944095", "0.57944095", "0.57944095", "0.5778151", "0.57...
0.0
-1
gets the required parameters and returns the predicted gross value according to this
def prediction(self, score: float): data = self.process_data() paramters = data["param"] return {"pred": func(score, paramters[0], paramters[1], paramters[2]), "acc": data["acc"]}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def predict(self):\n return self.test_fn(self.gX, self.hX, self.sym_g, self.sym_h)", "def pred_single_gp(x_train, y_train, x_pred):\n y_mean = np.mean(y_train[~np.isnan(y_train)])\n y_std = np.std(y_train[~np.isnan(y_train)])\n if y_std == 0:\n # print('ystd 0', y_train)\n y_std = 1...
[ "0.63689655", "0.6348335", "0.63181317", "0.63162464", "0.62561154", "0.61540014", "0.61188585", "0.6083624", "0.6055862", "0.6042661", "0.6034719", "0.602211", "0.6021944", "0.599269", "0.5991141", "0.59707075", "0.59636915", "0.5944294", "0.59309316", "0.59275913", "0.59209...
0.0
-1
This method is called in the operation subclass so that common functionality to every node can be encapsulated here
def visit_node(self, node: OnnxNode, network: Network): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def operation(self):\n pass", "def __init__(self, node_def, op, message, error_code):\n ...", "def __call__(self):\n raise NotImplementedError", "def visit_Node(self, node):\n pass", "def __call__(self):\r\n raise NotImplementedError('override me')", "def __call__(self)...
[ "0.7115668", "0.67683554", "0.6766268", "0.6704312", "0.6518418", "0.64676535", "0.6427891", "0.6401355", "0.6397816", "0.6367081", "0.6367081", "0.63517505", "0.63336504", "0.6327483", "0.6316461", "0.6304907", "0.627999", "0.62670976", "0.6250636", "0.624658", "0.624658", ...
0.5657108
65
This method is called after all initializers have been called
def visit_initializer_end(self, network: Network): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _post_init(self):\n pass", "def _post_init(self) -> None:\n return", "def _afterInit(self):\n pass", "def post_init(self):\n\t\tpass", "def initialize(self):\n\t\tpass", "def initialize(self):\n pass # pragma: no cover", "def initialize(self):\n pass", "d...
[ "0.87068164", "0.8584318", "0.8528649", "0.85262597", "0.8058062", "0.8049961", "0.8018161", "0.8018161", "0.8018161", "0.8018161", "0.8018161", "0.8016092", "0.7998056", "0.7998056", "0.7987975", "0.79272634", "0.79272634", "0.79272634", "0.79272634", "0.79272634", "0.792726...
0.0
-1
This method gets called after all nodes from a graph have been called
def visit_graph_end(self, network: Network): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def populate_graph(self):", "def graph(self):\n ...", "def update(self):\r\n self.g = self.create_graph()", "def start_new_graph(self):\n self.nodes = {}\n self.reset_graph()", "def reset_graph(self):\n raise NotImplementedError", "def reset_graph(self):\n self.n...
[ "0.74905396", "0.7148104", "0.6984706", "0.68826205", "0.68644756", "0.6763155", "0.6727105", "0.6716352", "0.6698041", "0.6698041", "0.66482913", "0.6610529", "0.6565146", "0.6565146", "0.64927524", "0.6466672", "0.6437642", "0.64366686", "0.63978916", "0.6397721", "0.639124...
0.6597933
12
Prediction form for the group stage
def view_ko_prediction_form(request, match_type_slug): if not request.user.is_authenticated(): return view_auth_page(request) lu = get_username(request) try: match_type = MatchType.objects.get(slug=match_type_slug) lu.update({ 'match_type' : match_type }) except MatchTy...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post(self):\n result = {'status': 'error'}\n\n args = input_parser.parse_args()\n input_data = args['image'].read()\n image = self.model_wrapper._read_image(input_data)\n preds = self.model_wrapper._predict(image)\n\n # Modify this code if the schema is changed\n ...
[ "0.6390648", "0.63465226", "0.63032836", "0.6290905", "0.62192", "0.61832285", "0.6166468", "0.6138859", "0.6128712", "0.61129534", "0.6096768", "0.60830706", "0.6040627", "0.6023762", "0.60222316", "0.6002425", "0.5999782", "0.5999782", "0.5995713", "0.5980324", "0.5966459",...
0.0
-1
Compile markdown symbols to HTML
def article_pre_save(**kwargs): instance = kwargs['instance'] instance.html_content = markdown.markdown(instance.content)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def htmlForMarkdown(md):\n return mdProcessor.convert(md)", "def markdown(value):\n return Markup(md(value))", "def pc_md_to_html(data_list):\n pcrenderer = PanelCodeRenderer()\n markdown = mistune.Markdown(renderer=pcrenderer)\n label = '<p style=\"font-size:x-small\"><em>panelcode: markdown pr...
[ "0.7018305", "0.697028", "0.6744978", "0.6730778", "0.6726009", "0.66564685", "0.6593691", "0.65215397", "0.6481484", "0.6464072", "0.6419949", "0.6413331", "0.6404054", "0.6398502", "0.63718665", "0.6319527", "0.6293597", "0.62930626", "0.6278275", "0.62718016", "0.62643903"...
0.0
-1
Make sure that the expectation op fails gracefully on bad inputs.
def test_simulate_expectation_inputs(self): n_qubits = 5 batch_size = 5 symbol_names = ['alpha'] qubits = cirq.GridQubit.rect(1, n_qubits) circuit_batch, resolver_batch = \ util.random_symbol_circuit_resolver_batch( qubits, symbol_names, batch_size) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_raises_error_on_wrong_input():\n with pytest.raises(TypeError, match=\"Metric arg need to be an instance of a .*\"):\n MetricTracker([1, 2, 3])\n\n with pytest.raises(ValueError, match=\"Argument `maximize` should either be a single bool or list of bool\"):\n MetricTracker(MeanAbsolute...
[ "0.65614593", "0.64592403", "0.6457229", "0.645442", "0.6453814", "0.64008075", "0.6395661", "0.63745135", "0.6370712", "0.6367925", "0.63453233", "0.634067", "0.6331833", "0.6330174", "0.6308518", "0.62896866", "0.62859917", "0.62823266", "0.62727153", "0.62596434", "0.62458...
0.61035883
35
Make sure the state op fails gracefully on bad inputs.
def test_simulate_state_inputs(self): n_qubits = 5 batch_size = 5 symbol_names = ['alpha'] qubits = cirq.GridQubit.rect(1, n_qubits) circuit_batch, resolver_batch = \ util.random_symbol_circuit_resolver_batch( qubits, symbol_names, batch_size) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_invalid_input_prop(self):\n with pytest.raises(ValueError):\n State(\n substance=\"water\", x=Q_(0.5, \"dimensionless\"), bad_prop=Q_(101325, \"Pa\")\n )", "def state_failsafe_validate(cfg, app, win, events):", "def test_block_bad_state(self):\n pass"...
[ "0.6982454", "0.6934663", "0.67690164", "0.66727185", "0.66650814", "0.6510444", "0.647176", "0.644179", "0.64068556", "0.64049226", "0.63916975", "0.6366071", "0.63633895", "0.6316357", "0.62653124", "0.62633586", "0.6259136", "0.6209813", "0.6181207", "0.61663026", "0.61567...
0.56856894
66
If a tfq_simulate op is asked to simulate states given circuits acting on different numbers of qubits, the op should return a tensor padded with zeros up to the size of the largest circuit. The padding should be physically correct, such that samples taken from the padded states still match samples taken from the origin...
def test_simulate_state_output_padding(self, all_n_qubits): circuit_batch = [] for n_qubits in all_n_qubits: qubits = cirq.GridQubit.rect(1, n_qubits) circuit_batch += util.random_circuit_resolver_batch(qubits, 1)[0] tfq_results = tfq_simulate_ops.tfq_simulate_state( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_sampling_output_padding(self, all_n_qubits, n_samples):\n op = tfq_simulate_ops.tfq_simulate_samples\n circuits = []\n expected_outputs = []\n for n_qubits in all_n_qubits:\n this_expected_output = np.zeros((n_samples, max(all_n_qubits)))\n this_expected_o...
[ "0.6290017", "0.5681582", "0.5681582", "0.5676849", "0.5593831", "0.5576278", "0.5497892", "0.5487373", "0.5466293", "0.540858", "0.54031944", "0.539102", "0.5358094", "0.5357061", "0.5343899", "0.5330886", "0.5322747", "0.52873987", "0.52870905", "0.5285144", "0.52784127", ...
0.7703024
0
Make sure the sample op fails gracefully on bad inputs.
def test_simulate_samples_inputs(self): n_qubits = 5 batch_size = 5 num_samples = 10 symbol_names = ['alpha'] qubits = cirq.GridQubit.rect(1, n_qubits) circuit_batch, resolver_batch = \ util.random_symbol_circuit_resolver_batch( qubits, symbol_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_random_small_sample_error(self):\n with self.assertRaises(ValueError):\n random_small_sample([], 1e7)", "def test_sample_from_extra_bounds_bad(self):\n dim = Real(\"yolo\", \"norm\", 0, 2, low=-2, high=+2, shape=(4, 4))\n with pytest.raises(ValueError) as exc:\n ...
[ "0.72781783", "0.6841818", "0.6653669", "0.66234344", "0.65907013", "0.64723974", "0.63860774", "0.63681394", "0.6317701", "0.62852955", "0.6244701", "0.62419516", "0.622258", "0.62001383", "0.6180754", "0.61651886", "0.61302197", "0.60953456", "0.6055983", "0.6055983", "0.60...
0.0
-1
Check that the sampling ops pad outputs correctly
def test_sampling_output_padding(self, all_n_qubits, n_samples): op = tfq_simulate_ops.tfq_simulate_samples circuits = [] expected_outputs = [] for n_qubits in all_n_qubits: this_expected_output = np.zeros((n_samples, max(all_n_qubits))) this_expected_output[:, ma...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _is_padding_necessary(self, signal: np.array) -> bool:\n if len(signal) < self.number_expected_samples:\n return True\n else:\n return False", "def test_pad():\n x = randtool(\"float\", -10, 10, [3, 2, 1, 2])\n pad = [1, 1, 2, 3]\n mode = \"constant\"\n value =...
[ "0.6232269", "0.6190101", "0.6067233", "0.5857253", "0.5819368", "0.58028764", "0.57961124", "0.57630396", "0.5727364", "0.5590215", "0.55863315", "0.55732685", "0.5556439", "0.55498695", "0.554983", "0.55409205", "0.5534093", "0.55317795", "0.55132616", "0.55058515", "0.5488...
0.6402059
0
Make sure sampled expectation op fails gracefully on bad inputs.
def test_simulate_sampled_expectation_inputs(self): n_qubits = 5 batch_size = 5 symbol_names = ['alpha'] qubits = cirq.GridQubit.rect(1, n_qubits) circuit_batch, resolver_batch = \ util.random_symbol_circuit_resolver_batch( qubits, symbol_names, batch_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_random_small_sample_error(self):\n with self.assertRaises(ValueError):\n random_small_sample([], 1e7)", "def test_sample_from_extra_bounds_bad(self):\n dim = Real(\"yolo\", \"norm\", 0, 2, low=-2, high=+2, shape=(4, 4))\n with pytest.raises(ValueError) as exc:\n ...
[ "0.6784728", "0.6667808", "0.66351414", "0.6584482", "0.6507048", "0.6338948", "0.6314239", "0.62703097", "0.62640667", "0.6229271", "0.61787623", "0.6171872", "0.6037188", "0.603438", "0.60249716", "0.6006203", "0.600324", "0.5995496", "0.59675896", "0.5958809", "0.59465736"...
0.66165364
3
Tests all three ops for the different types.
def test_symbol_values_type(self, symbol_type): qubit = cirq.GridQubit(0, 0) circuits = util.convert_to_tensor([cirq.Circuit(cirq.H(qubit))]) symbol_names = ['symbol'] symbol_values = tf.convert_to_tensor([[1]], dtype=symbol_type) pauli_sums = util.random_pauli_sums([qubit], 3, 1...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_op_apply_types(self) -> None:\n\n op_add_1 = OpLambda(func=lambda x: x + 1, func_reverse=lambda x: x - 1)\n op_mul_2 = OpLambda(func=lambda x: x * 2, func_reverse=lambda x: x // 2)\n op_mul_4 = OpLambda(func=lambda x: x * 4, func_reverse=lambda x: x // 4)\n\n sample_dict = NDic...
[ "0.66203", "0.6282011", "0.61622036", "0.6124541", "0.6120239", "0.60630786", "0.6031349", "0.6017407", "0.6004671", "0.6000418", "0.5978728", "0.5952556", "0.59229213", "0.59140134", "0.58633196", "0.58627594", "0.5856105", "0.5850051", "0.58347875", "0.5815664", "0.580747",...
0.0
-1
Find an optimal parameters array to minimize a function.
def minimize(self, func, grad, x0, args=()): learning_rate = self._learning_rate best_x = x = x0 best_value = func(x, *args) iters_without_improve = 0 for iteration in range(self._max_iterations): gradient = grad(x, *args) # If absolute values of all par...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def minimize(self):\n self.normalize()\n p0s = self.spacedvals(method='random')\n if self.n_spots > 1:\n opts = self.multifit(p0s)\n else:\n opts = self.singlefit(p0s)\n self.yf = [self.solve(theta) for theta in opts]\n self.bestps = opts\n ret...
[ "0.6809129", "0.6636033", "0.65912414", "0.6565482", "0.6447696", "0.6275673", "0.6275673", "0.6275673", "0.6095264", "0.6045554", "0.60183436", "0.60029584", "0.5991476", "0.5964307", "0.59349644", "0.59189326", "0.58949566", "0.58886385", "0.5873067", "0.5856888", "0.584556...
0.5933653
15
Applies a Butterworth bandpass filter to data Replaces lightcurve data with new filtered, edgecropped data.
def bandpass_filter(self, pmin=0.5, pmax=100, cadence=None, edge=2000, zero_fill=False): if cadence is None: try: cadence = self.cadence except AttributeError: pass x, y, yerr = bandpass_filter(self._x_full, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _butter_bandpass_filter(self, data: np.ndarray, lowcut: float, highcut: float, fs: float, order: int = 5):\n b, a = self._butter_bandpass(lowcut, highcut, fs, order=order)\n y = lfilter(b, a, data)\n return y", "def butter_bandpass_filter(data, lowcut, highcut, fs, order=5, axis=0): ...
[ "0.77169484", "0.72997564", "0.7049716", "0.6907623", "0.6853431", "0.6753613", "0.6733196", "0.6650709", "0.6634325", "0.6617508", "0.65312976", "0.651587", "0.64669514", "0.64305925", "0.6425288", "0.63893855", "0.63805264", "0.6351457", "0.6310354", "0.6302797", "0.6300918...
0.59687346
36
Filters with pmax = pmax, then returns ACF up to lag=2pmax
def acf(self, pmin=0.1, pmax=100, filter=True, smooth=None): if filter: if self._x_full is None: self._get_data() x, y, yerr = bandpass_filter(self._x_full, self._y_full, self._yerr_full, z...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filtermax(f, maxfiltsize=10):\n # Maximum filter to ignore deeper fluxes of absorption lines\n f_maxfilt = maximum_filter1d(f, size=maxfiltsize)\n # Find points selected by maximum filter\n idxmax = np.array([i for i in range(len(f)) if f[i]-f_maxfilt[i] == 0.])\n\n return f_maxfilt, idxmax", ...
[ "0.640111", "0.6367097", "0.601031", "0.59510344", "0.5618925", "0.5606653", "0.559591", "0.558996", "0.5538971", "0.5526352", "0.55090195", "0.548699", "0.544709", "0.54098743", "0.53953207", "0.5331262", "0.53100777", "0.53039634", "0.5268913", "0.5264958", "0.5259795", "...
0.5955692
3
Returns best guess of prot from ACF, and height of peak Just pick first peak.
def acf_prot(self, pmin=0.1, pmax=100, delta=0.01, lookahead=30, peak_to_trough=True, maxpeaks=1, plot=False, ax=None, fig_kwargs=None, savefig_filename=None): lags, ac = self.acf(pmin=pmin, pmax=pmax, smooth=pmax/10) # make sure lookahead isn't too long if pmax is sma...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_chimes(self):\n while True:\n self.recursion += 1\n if self.recursion > 10:\n self.exit_status = \"Recursion limit reached\"\n return None\n\n peaks, peaks_meta_data = find_peaks(self.amplitude, height=self.height,\n ...
[ "0.6515955", "0.6419468", "0.63782084", "0.620905", "0.61406106", "0.61376834", "0.6083314", "0.5996022", "0.59908646", "0.59794223", "0.59150815", "0.5905579", "0.5863548", "0.5851025", "0.5850193", "0.58073854", "0.580671", "0.575892", "0.5715282", "0.5693668", "0.5689746",...
0.6102276
6
Returns new subLightCurve, choosing ndays with maximum RMS variation
def best_sublc(self, ndays, npoints=600, chunksize=300, flat_order=3, **kwargs): x_full = self.x_full y_full = self.y_full N = len(x_full) cadence = np.median(x_full[1:] - x_full[:-1]) window = int(ndays / cadence) stepsize = window//50 i1 = 0...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_sigma_high_low(rate, dt=1 * units.ns, time_window_high_low=5 * units.ns):\n def obj(sigma):\n return get_high_low_rate(sigma, dt=dt, time_window_high_low=time_window_high_low) - rate\n res = opt.brentq(obj, 0, 10)\n return res", "def lCurve(self): \n\n # ---------------------------...
[ "0.5439135", "0.52744055", "0.5117991", "0.5101039", "0.5043701", "0.5000911", "0.49971765", "0.49746352", "0.4958558", "0.49205273", "0.48910326", "0.48699352", "0.48592845", "0.48264438", "0.48117554", "0.48070383", "0.48056588", "0.4789352", "0.47843328", "0.47834954", "0....
0.65983933
0
Returns rms flux variability between t0 and t1
def chunk_rms(self, t0, t1, nsigma=5): m = (self.x_full >= t0) & (self.x_full <= t1) if m.sum()==0: return np.nan x = self.x_full[m].copy() y = self.y_full[m].copy() yerr = self.yerr_full[m].copy() x, y, yerr = sigma_clip(x, y, yerr, nsigma) p = np.p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def RMS_flux(self):\n return np.sqrt(np.mean(self.flux ** 2))", "def model(self, t):\n flux = np.zeros_like(t)\n dt = np.abs(self.timefrommidtransit(t))\n start, finish = self.traits['T23'] / 2.0, self.traits['T14'] / 2.0\n depth = self.traits['D']\n\n i = dt <= start\n ...
[ "0.63068056", "0.6251638", "0.6128982", "0.6101877", "0.6002558", "0.5990072", "0.5965916", "0.593897", "0.5852692", "0.5813409", "0.578144", "0.5773638", "0.5751428", "0.5749255", "0.57401186", "0.57195985", "0.5708891", "0.5690835", "0.5684721", "0.56803524", "0.56584257", ...
0.5591492
26
Positive Test case with dates before first payday.
def __data_set_is_payday_positive_00_01_02_03(cls): _pay_cycle_object = pay_cycle_object() date_to_check = date_class(2018,1,12) cls.TEST_DATA_SET.append((_pay_cycle_object, date_to_check, True)) date_to_check = date_class(2018,2,23) cls.TEST_DATA_SET.append(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_is_payday_positive0(self):\n date_to_check = date_class(2018,1,12)\n is_payday = self.pay_cycle.is_payday(date_to_check)\n assert is_payday == True\n\n date_to_check = date_class(2018,2,23)\n is_payday = self.pay_cycle.is_payday(date_to_check)\n assert is_payday =...
[ "0.74207973", "0.73883677", "0.7292206", "0.7290917", "0.70799834", "0.7019063", "0.70113236", "0.6954623", "0.6931503", "0.6889858", "0.68890244", "0.6842413", "0.68220115", "0.67883486", "0.6740385", "0.6541513", "0.65143013", "0.6491585", "0.6474867", "0.6471996", "0.64278...
0.64109486
23
Positive Test case with date 2 weeks after first payday.
def __data_set_is_payday_positive_04(cls): _pay_cycle_object = pay_cycle_object() date_to_check = date_class(2019,2,8) cls.TEST_DATA_SET.append((_pay_cycle_object, date_to_check, True))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_is_payday_positive6(self):\n # Overriding first_payday\n self.first_payday = date_class(2020,12,24)\n date_to_check = date_class(2021,1,8)\n is_payday = self.pay_cycle.is_payday(date_to_check)\n assert is_payday == True", "def test_is_payday_positive2(self):\n d...
[ "0.7539625", "0.7482885", "0.7465673", "0.7162016", "0.7123166", "0.71197635", "0.70642054", "0.7047313", "0.69728893", "0.69039553", "0.6822936", "0.6712217", "0.6697963", "0.6628792", "0.65651023", "0.6534707", "0.6510961", "0.6496037", "0.640606", "0.6368542", "0.63646543"...
0.62723905
24
Positive Test case with dates in the same year as first payday.
def __data_set_is_payday_positive_05_06_07(cls): _pay_cycle_object = pay_cycle_object() date_to_check = date_class(2019,11,1) cls.TEST_DATA_SET.append((_pay_cycle_object, date_to_check, True)) date_to_check = date_class(2019,11,29) cls.TEST_DATA_SET.append((_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_is_payday_positive0(self):\n date_to_check = date_class(2018,1,12)\n is_payday = self.pay_cycle.is_payday(date_to_check)\n assert is_payday == True\n\n date_to_check = date_class(2018,2,23)\n is_payday = self.pay_cycle.is_payday(date_to_check)\n assert is_payday =...
[ "0.73192036", "0.7276888", "0.72550654", "0.7203657", "0.7190556", "0.71698797", "0.68810266", "0.68322164", "0.6798601", "0.6795517", "0.6758669", "0.6740891", "0.6733801", "0.67189986", "0.6660078", "0.66458595", "0.66357374", "0.6609684", "0.6607032", "0.6575893", "0.65355...
0.57279634
80
Positive Test case with dates greater than first payday's year.
def __data_set_is_payday_positive_08_09_10(cls): _pay_cycle_object = pay_cycle_object() date_to_check = date_class(2020,1,10) cls.TEST_DATA_SET.append((_pay_cycle_object, date_to_check, True)) date_to_check = date_class(2020,1,24) cls.TEST_DATA_SET.append((_p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_is_payday_positive2(self):\n date_to_check = date_class(2019,11,1)\n is_payday = self.pay_cycle.is_payday(date_to_check)\n assert is_payday == True\n\n date_to_check = date_class(2019,11,29)\n is_payday = self.pay_cycle.is_payday(date_to_check)\n assert is_payday ...
[ "0.692383", "0.6911209", "0.68879914", "0.6868417", "0.68614626", "0.6850404", "0.6831489", "0.6808233", "0.67766726", "0.6738485", "0.67109317", "0.67006254", "0.66569364", "0.6614096", "0.6584265", "0.6530775", "0.6530758", "0.6509002", "0.64837325", "0.64783204", "0.646801...
0.58530676
72
Positive Test case with dates on Thursday as paydays because Friday was a holiday.
def __data_set_is_payday_positive_11_12_13(cls): _pay_cycle_object = pay_cycle_object() date_to_check = date_class(2020,12,24) cls.TEST_DATA_SET.append((_pay_cycle_object, date_to_check, True)) date_to_check = date_class(2021,12,23) cls.TEST_DATA_SET.append((...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_friday(self):\n date = datetime.date(1984, 5, 4)\n self.assertEqual(date.isoweekday(), 5)\n start_date, end_date = get_weekspan(date)\n self.assertEqual(start_date.isoweekday(), 1)\n self.assertEqual(end_date.isoweekday(), 7)\n self.assertTrue(start_date.toordinal...
[ "0.73703", "0.7253308", "0.72039264", "0.7186046", "0.7167305", "0.7136741", "0.70508504", "0.7019132", "0.6994101", "0.6965898", "0.6860333", "0.6847465", "0.68418443", "0.6838443", "0.6835033", "0.68341553", "0.6791112", "0.6767049", "0.6741465", "0.67385554", "0.673382", ...
0.0
-1
Positive Test case with first payday as Thursday.
def __data_set_is_payday_positive_14_15(cls): _pay_cycle_object = pay_cycle_object() _pay_cycle_object.first_payday = date_class(2020,12,24) date_to_check = date_class(2021,1,8) cls.TEST_DATA_SET.append((_pay_cycle_object, date_to_check, True)) date_to_check...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_thursday(self):\n date = datetime.date(1989, 5, 4)\n self.assertEqual(date.isoweekday(), 4)\n start_date, end_date = get_weekspan(date)\n self.assertEqual(start_date.isoweekday(), 1)\n self.assertEqual(end_date.isoweekday(), 7)\n self.assertTrue(start_date.toordin...
[ "0.7239444", "0.69547564", "0.6586524", "0.6376277", "0.6339567", "0.6329432", "0.6320629", "0.63106525", "0.63039917", "0.6295603", "0.6290875", "0.6279654", "0.6266728", "0.6264213", "0.6257024", "0.6249627", "0.62472874", "0.62315047", "0.6228479", "0.6220446", "0.6219426"...
0.0
-1
Negative Test case with dates less than first payday.
def __data_set_is_payday_negative_16_17_18(cls): _pay_cycle_object = pay_cycle_object() date_to_check = date_class(2019,1,24) # The day before first payday cls.TEST_DATA_SET.append((_pay_cycle_object, date_to_check, False)) date_to_check = date_class(2018,12,27) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_is_payday_negative1(self):\n date_to_check = date_class(2020,12,25)\n is_payday = self.pay_cycle.is_payday(date_to_check)\n assert is_payday == False\n\n date_to_check = date_class(2021,12,24)\n is_payday = self.pay_cycle.is_payday(date_to_check)\n assert is_payda...
[ "0.7441717", "0.7211149", "0.71916157", "0.70453197", "0.69393003", "0.6832643", "0.672878", "0.66848457", "0.6667145", "0.66138947", "0.65113306", "0.6495606", "0.6451041", "0.6382947", "0.635958", "0.63578784", "0.6292854", "0.62871826", "0.6220569", "0.61864704", "0.618133...
0.65659785
10
Negative Test case with dates as holidays.
def __data_set_is_payday_negative_19_20_21(cls): _pay_cycle_object = pay_cycle_object() date_to_check = date_class(2020,12,25) # Christmas cls.TEST_DATA_SET.append((_pay_cycle_object, date_to_check, False)) date_to_check = date_class(2021,12,24) cls.TEST_DATA...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_non_holidays(self):\n # January 2nd was not public holiday between 2012 and 2017\n self.assertNotIn(date(2013, 1, 2), self.holidays)\n self.assertNotIn(date(2014, 1, 2), self.holidays)\n self.assertNotIn(date(2015, 1, 2), self.holidays)\n self.assertNotIn(date(2016, 1, 2...
[ "0.779504", "0.73691523", "0.72286654", "0.67183", "0.66527766", "0.6636426", "0.65799487", "0.6547076", "0.6546462", "0.6545383", "0.6477775", "0.6447516", "0.6444255", "0.6366996", "0.62766814", "0.62688833", "0.62644833", "0.6260839", "0.6253269", "0.6246883", "0.62329143"...
0.5506617
78
Negative Test case with dates in between biweekly paydays.
def __data_set_is_payday_negative_22_23_24(cls): _pay_cycle_object = pay_cycle_object() date_to_check = date_class(2018,11,23) cls.TEST_DATA_SET.append((_pay_cycle_object, date_to_check, False)) date_to_check = date_class(2019,1,18) cls.TEST_DATA_SET.append((...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_is_payday_negative2(self):\n date_to_check = date_class(2018,11,23)\n is_payday = self.pay_cycle.is_payday(date_to_check)\n assert is_payday == False\n\n date_to_check = date_class(2019,1,18)\n is_payday = self.pay_cycle.is_payday(date_to_check)\n assert is_payday...
[ "0.77591026", "0.77172005", "0.7587672", "0.7122841", "0.7116144", "0.69571435", "0.67868346", "0.6785853", "0.67141473", "0.6693559", "0.66907525", "0.6637664", "0.6631187", "0.6629418", "0.6625676", "0.65981656", "0.65893835", "0.6579529", "0.65614206", "0.6496932", "0.6477...
0.64175355
22
Positive Test case to check if there were 3 paydays in October, 2020. (2nd, 16th, 30th)
def test_is_payday_positive_25(self): expected_count = 3 expected_paydays = [ date_class(2020,10,2), date_class(2020,10,16), date_class(2020,10,30) ] curr_date = date_class(2020,10,1) end_date = date_class(2020,10,31) paydays = [] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_is_payday_positive3(self):\n date_to_check = date_class(2020,1,10)\n is_payday = self.pay_cycle.is_payday(date_to_check)\n assert is_payday == True\n\n date_to_check = date_class(2020,1,24)\n is_payday = self.pay_cycle.is_payday(date_to_check)\n assert is_payday =...
[ "0.7962415", "0.7660604", "0.75990057", "0.72413564", "0.7203788", "0.7192511", "0.7128882", "0.71244246", "0.71063817", "0.6838344", "0.66635793", "0.64048415", "0.6277141", "0.6263335", "0.6208021", "0.6203467", "0.61989784", "0.6180826", "0.6155544", "0.6143891", "0.612484...
0.7588782
3
Pick an agent at random, step it, bump counts.
def step(self): self.agents[random.randint(self.get_agent_count())].step() self.steps += 1 self.time += 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def step(self):\n\t\tnumpy.random.shuffle(self.agents_list)\n\t\tfor agent in self.agents_list:\n\t\t\tagent.produce()\n\t\tfor agent in self.agents_list:\n\t\t\tagent.charge()\n\t\tfor agent in self.agents_list:\n\t\t\tif agent.strategy == 0: \n\t\t\t\tagent.retribute()\n\t\tfor agent in self.agents_list:\n\t\t\t...
[ "0.6958311", "0.67038995", "0.66255635", "0.6525697", "0.63827926", "0.6380983", "0.6380704", "0.63505244", "0.63434833", "0.6333988", "0.6211217", "0.6080819", "0.600359", "0.5950171", "0.59233344", "0.59233344", "0.5905067", "0.5897467", "0.58860046", "0.58852065", "0.58824...
0.757041
0
Create a cell, in the given state, at the given row, col position. The row and col is specified in the agent_id tuple.
def __init__(self, agent_id, model, spill_size): super().__init__(agent_id, model) self._row = agent_id[0] self._col = agent_id[1] self._spill_size = spill_size self._grains = 0 self._spilling = False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_cell(self,row_number,cell_number):\n cell = Cell(self)\n cell.x = cell_number * self.cell_width\n cell.y = row_number * self.cell_width\n cell.rect.x = cell.x\n cell.rect.y = cell.y\n return cell", "def createCell(self, space):\n\t\tself.createCellEntity(spac...
[ "0.6323678", "0.62748826", "0.62136805", "0.6137301", "0.60689855", "0.5929521", "0.57356286", "0.564392", "0.5603956", "0.55719745", "0.5542847", "0.5537822", "0.55244803", "0.55106634", "0.549848", "0.5494516", "0.54151225", "0.54066885", "0.5371405", "0.5331192", "0.532986...
0.55085486
14
Return cell's grain capacity.
def spill_size(self): return self._spill_size
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def grains(self):\n grain_weight = self.mass * kilograms_to_grains\n return grain_weight", "def capacity(self):\n return self._cap", "def capacity(self):\n return self._capacity", "def capacity(self):\n return self._capacity", "def get_num_slots(self):\n # Your...
[ "0.7046494", "0.69036347", "0.68392074", "0.6838048", "0.6710075", "0.66955405", "0.6617645", "0.66160345", "0.66096526", "0.6588656", "0.6579947", "0.65774447", "0.6559882", "0.6546683", "0.6508029", "0.6501165", "0.6490674", "0.6448921", "0.6448921", "0.6448921", "0.6448921...
0.61053264
44
Return cell's current grain count.
def grains(self): return self._grains
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_cellcount(self):\n self.cellcount += 1\n return self.cellcount - 1", "def get_num_gear(self):\n return self.__num_gear_collected", "def grains(self):\n grain_weight = self.mass * kilograms_to_grains\n return grain_weight", "def count_one_round(self):\n\t\tself.round...
[ "0.7057873", "0.648636", "0.646209", "0.6397058", "0.6289343", "0.6270671", "0.62479115", "0.6233076", "0.61440885", "0.61245924", "0.6100009", "0.6080734", "0.60760593", "0.60708094", "0.6045701", "0.6045701", "0.6042038", "0.60402495", "0.604009", "0.6019038", "0.59589773",...
0.56605184
94
Return agent's spilling state.
def spilling(self): return self._spilling
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getPacmanState( self ):\n return self.data.agentStates[0].copy()", "def get_agent_state(self):\n return self.world_state", "def get_state(self):\n\t\treturn Job(SDK.PrlVm_GetState(self.handle)[0])", "def get_state(self):\n return self.env.sim.get_state()", "def get_tools_state(self...
[ "0.5813141", "0.57949114", "0.5761483", "0.5691754", "0.5646033", "0.562968", "0.5607904", "0.5590146", "0.557208", "0.5541229", "0.5484805", "0.54764456", "0.54454887", "0.54454887", "0.54454887", "0.54454887", "0.54454887", "0.54454887", "0.54454887", "0.54454887", "0.54454...
0.705317
0