query
stringlengths
9
9.05k
document
stringlengths
10
222k
metadata
dict
negatives
listlengths
30
30
negative_scores
listlengths
30
30
document_score
stringlengths
4
10
document_rank
stringclasses
2 values
This method clears the IOManager instance currently active, if any
def clear_IOM(): global _iom_instance if _iom_instance: _iom_instance.stop() if threading.current_thread() != _iom_instance: _iom_instance.join() _iom_instance = None _IOManager.restore_signal_handlers()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clear(self):\n # Orphan all objects\n for obj in self.uow:\n state(obj).session = None\n self.uow.clear()\n self.imap.clear()", "def reset(self):\n self.destroy()\n self.open()", "def close(self):\n self._available = False\n self._io_manage...
[ "0.67583764", "0.6700083", "0.66260433", "0.6534188", "0.64129114", "0.6411327", "0.6398604", "0.6225837", "0.6192987", "0.61438346", "0.61311615", "0.6116497", "0.61151767", "0.6108931", "0.6102664", "0.6092479", "0.60895723", "0.6066649", "0.60661376", "0.6043499", "0.60384...
0.7886593
0
This handler will stop the IOManager on interpreter exit. It will set the shutdown flag to True and run clear_IOM.
def __atexit_handler(): global _iom_shutdown _iom_shutdown = True clear_IOM()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shutdown_manager(self):\n # pylint: disable=E1101\n self.shutdown() # type: ignore\n # pylint: enable=E1101", "def exit_handler(self):\n self.logger.debug(\n \"Starting script shutdown in the class \" +\n self.__class__.__name__\n )\n\n # Clean...
[ "0.6671942", "0.6663697", "0.6621949", "0.6565478", "0.6563746", "0.6546713", "0.65447253", "0.6509654", "0.6466096", "0.6458403", "0.64495385", "0.64292604", "0.64199954", "0.6417803", "0.6410902", "0.6401739", "0.6390104", "0.638613", "0.63592774", "0.63264143", "0.63257796...
0.8109695
0
This method can be registered as a signal handler and will terminate the IOManager thread on the signal and call the original signal handler.
def signal_handler(cls, signum, frame): global _iom_instance # Find name of signal signame = str(signum) for key in signal.__dict__.keys(): if key.startswith("SIG") and getattr(signal, key) == signum: signame = key break try: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def signal_handler(signum, frame):\n main.CLOSE = True", "def _signal_handler(*_: typing.Any) -> None:\n shutdown_event.set()", "def signal(self):\n self.mainloop().signal()", "def sigint_handler(signal, frame):\n rclpy.shutdown()\n if prev_sigint_handler is not None:\n prev_sigint_...
[ "0.7207195", "0.7170434", "0.7115355", "0.7054465", "0.7031309", "0.70231557", "0.70108473", "0.6952786", "0.6932358", "0.6926428", "0.68975925", "0.6876757", "0.68614537", "0.6856073", "0.68490416", "0.6838871", "0.6832425", "0.6823985", "0.68018293", "0.6773629", "0.6724269...
0.7621493
0
This method is the main thread of the IOManager. It polls all active IOWrappers and calls their read and write handlers when data can be read or written. It will also try to connect any unconnected IOWrappers that have been registered.
def _run(self): global _iom_instance self.__logger.info("IOManager started") timeout = 0 while self.__running: # Poll for events if self.__et: self.__poll_et() else: self.__poll_lt() # Perform IOWrapper chec...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n\n super(_IOManager, self).__init__()\n self.__poll = iopoll.IOPoll()\n self.__et = self.__poll.set_edge_triggered(True)\n self.__wrappers = {}\n self.__disconnected_wrappers = []\n self.__running = True\n\n self.__wrapper_lock = threading.RLock...
[ "0.72020644", "0.6404343", "0.6323055", "0.613848", "0.5930006", "0.5890055", "0.57467985", "0.5727425", "0.56816876", "0.5658827", "0.5594921", "0.55433446", "0.5537435", "0.5534609", "0.5534609", "0.55324864", "0.55123097", "0.5511399", "0.5455873", "0.54299587", "0.5427040...
0.7329676
0
After polling and updating of the ready lists has completed the function iterates over the file descriptors ready for reading and writing. The _handle_read and _handle_write of each file descriptor wrapper will be called roundrobin in a loop, for as long as the current tick lasts. If the file descriptors become nonread...
def __perform_io_et(self, max_time): # Perform IO on ready file descriptors start = time.time() while time.time() < start + max_time: if not self.__read_list and not self.__write_list: break # Handle file descriptors ready for reading read_fds...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _poll(self):\n if self.selector.get_map(): # Pray it doesn't block\n # We can block as long as we want if theres no tasks to process till we're done\n # We want our currently ready files\n if not self._tasks or self._queue:\n if self._timers:\n ...
[ "0.59377813", "0.59214854", "0.55150586", "0.5487273", "0.53215456", "0.5306082", "0.5305153", "0.52936137", "0.5274444", "0.5273521", "0.5254349", "0.5227428", "0.52225745", "0.521662", "0.5181105", "0.5173039", "0.51649815", "0.5164472", "0.5151223", "0.5100448", "0.5085929...
0.6719054
0
This method checks if the fd is the wakeup pipe, and if so, reads the data from that pipe.
def __check_wakeup(self, fd, num): if fd == self.__wakeup_read: if num == 1: # Was woken up, count savings. self.__last_tick_end # if the time the poll would have ended if it was # not awoken by the wakeup pipe. self.__saved_time += sel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read(self):\n if self.alive:\n with self._register_poll():\n with _unblock_read(self._proc):\n return self._yield_ready_read()\n else:\n raise ProcessIsDeadError('Can not read. The process is already dead.')", "def handle_fd_wakeup(self, f...
[ "0.6059474", "0.5925316", "0.584181", "0.57787955", "0.5770543", "0.5589297", "0.5565441", "0.5561058", "0.55366427", "0.5456041", "0.5398647", "0.5317475", "0.5312273", "0.5296096", "0.52547514", "0.5235931", "0.5193808", "0.5187531", "0.51835066", "0.5122953", "0.50859684",...
0.6730117
0
This method calls the handle_loop function of each wrapper, once every true tick. This should be at the frequency of the ticker, about 10 times per second.
def __handle_loop(self): with self.__wrapper_lock: for wrapper in self.__wrappers.values(): self.__wrap_function(wrapper, "_handle_loop")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _handle_loop(self):\n pass", "def loop(self):\n pass", "def tick(self):\n for method in self.on_ticker:\n getattr(self, method)()", "def loop(self):\n while True:\n delay_until_next = self.tick()\n if not delay_until_next:\n brea...
[ "0.64973104", "0.64548576", "0.64116734", "0.63547313", "0.6350633", "0.62593937", "0.6253672", "0.6138138", "0.6093034", "0.60708076", "0.6063108", "0.6000306", "0.5996489", "0.5970046", "0.5959777", "0.595509", "0.5947199", "0.58936435", "0.58918947", "0.5885203", "0.587622...
0.73193914
0
This method is called whenever an exception has occured in any of the wrappers functions. It outputs the message and removes the wrapper from the IOManager.
def __handle_exception(self, wrapper, method, exception): # First print the normal exception output #traceback.print_exc() self.__logger.critical("Exception raised in %s in IOWrapper %s. " \ "Removing IOWrapper from IOManager. The " \ ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_expt(self):\r\n self._perform_on_error_handling()", "def __cleanup(self):\n wrappers = copy.copy(self.__wrappers)\n\n num = len(wrappers)\n for fd in wrappers:\n wrappers[fd].close()\n\n self.__wrappers = {}\n self.__disconnected_wrappers = []\n ...
[ "0.5796533", "0.5781985", "0.57516783", "0.57218486", "0.56933635", "0.5625278", "0.5609338", "0.5575694", "0.5547018", "0.554088", "0.55381966", "0.552271", "0.552271", "0.55152225", "0.5510325", "0.5500664", "0.54709405", "0.542822", "0.54094625", "0.54007", "0.5381929", ...
0.7543375
0
Helper method for the main thread. Attempt to connect unconnected wrappers
def __attempt_wrappers(self): with self.__wrapper_lock: sock_list = self.__disconnected_wrappers for wrapper in sock_list: if not self.__wrap_function(wrapper, "connected"): self.__wrap_function(wrapper, "_handle_attempt")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n self.try_to_connect()", "def reconnect(self):\n raise NotImplementedError()", "def reconnect(self):\n\t\t# TODO: Make sure the remote devices are actually found?\n\t\tself.setup()\n\t\tself.patch()", "def reconnecting(self) -> bool:", "def connect_thread():\n return f...
[ "0.64431804", "0.62675923", "0.62119734", "0.6136976", "0.60975665", "0.6084777", "0.60635346", "0.60544574", "0.59910864", "0.59895176", "0.5947471", "0.5933719", "0.5890628", "0.5878055", "0.5876207", "0.5851456", "0.58358234", "0.58204126", "0.57915825", "0.57911247", "0.5...
0.6719007
0
Check if there are any registered IOWrappers, and if not, stop running after 30 seconds. Also stop if the parent thread ended to make sure the interpreter does not keep running just for the IOManager.
def __check_stop(self): if not self.__parent_thread.is_alive(): global _iom_shutdown self.__logger.info("Parent thread ended. Stopping IOManager.") _iom_shutdown = True self.__running = False if not self.__wrappers and not self.__disconnected_wrappers and...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _run(self):\n global _iom_instance\n self.__logger.info(\"IOManager started\")\n timeout = 0\n while self.__running:\n # Poll for events\n if self.__et:\n self.__poll_et()\n else:\n self.__poll_lt()\n\n # Perf...
[ "0.6366383", "0.57110745", "0.5528167", "0.54710895", "0.5455402", "0.54529166", "0.5441537", "0.5420318", "0.54132575", "0.5391293", "0.53664964", "0.53484637", "0.5341384", "0.53394556", "0.5324404", "0.5323673", "0.529864", "0.5285029", "0.5271595", "0.5261558", "0.5254184...
0.78956103
0
This method will close all open file descriptor wrappers, and clean up the lists of the IOManager.
def __cleanup(self): wrappers = copy.copy(self.__wrappers) num = len(wrappers) for fd in wrappers: wrappers[fd].close() self.__wrappers = {} self.__disconnected_wrappers = [] self.__logger.info("Closed %d IOWrappers" % num) os.close(self.__wakeup_rea...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __del__(self):\n for handle in self._filehandles:\n handle.close()", "def _close(self):\n for fd in self._fds:\n try:\n os.close(fd)\n except:\n pass", "def close(self):\n for m in self._mappers:\n m.close()\n ...
[ "0.7514108", "0.7498143", "0.732576", "0.72181565", "0.7003081", "0.6941212", "0.69345033", "0.6913506", "0.689964", "0.68566614", "0.68230253", "0.67590755", "0.67090476", "0.66836107", "0.6683077", "0.66567516", "0.66393477", "0.663894", "0.66197586", "0.6617457", "0.649656...
0.8179671
0
This method validates the wrapper to be an instance of the IOWrapper base class, making sure it implements the required methods. It will raise an exception if the wrapper is invalid.
def __validate_wrapper(self, wrapper): if not isinstance(wrapper, IOWrapper): raise Exception("Only subclasses of IOWrapper should be registered in the IOManager")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __handle_exception(self, wrapper, method, exception):\n # First print the normal exception output\n #traceback.print_exc()\n\n self.__logger.critical(\"Exception raised in %s in IOWrapper %s. \" \\\n \"Removing IOWrapper from IOManager. The \" \\\n ...
[ "0.5546093", "0.54604685", "0.5411889", "0.5309438", "0.5097935", "0.5074125", "0.50426716", "0.5028937", "0.5028663", "0.50056034", "0.5000518", "0.49766174", "0.49689043", "0.49568233", "0.49489707", "0.49489707", "0.4896973", "0.48923403", "0.48844403", "0.4847181", "0.482...
0.8688556
0
Register a connected file descriptor wrapper
def register(self, wrapper): self.__validate_wrapper(wrapper) fd = self.__wrap_function(wrapper, "fileno") if not type(fd) is type(0): self.__logger.error("Cannot register IOWrapper with file descriptor %s" % repr(fd)) return False with self.__wrapper_lock: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register(self, fd):\n if fd not in self._fds:\n self._fds.append(fd)", "def add_descriptor(self, descriptor):", "def attach_filedescriptor(self, filedesc):\n self._filedescriptor = filedesc", "async def register(self, fd: FileDescriptor, events: EPOLL,\n cb:...
[ "0.64342827", "0.62055624", "0.6110365", "0.6007258", "0.5854498", "0.5718946", "0.56768453", "0.5648945", "0.5648945", "0.5624154", "0.56074166", "0.55798113", "0.5561913", "0.55372834", "0.5466594", "0.5397645", "0.53729844", "0.5352667", "0.53021127", "0.52466935", "0.5202...
0.73034364
0
Register a disconnected file descriptor wrapper that needs its _attempt method to be called at a regular interval.
def register_unconnected(self, wrapper): self.__validate_wrapper(wrapper) with self.__wrapper_lock: self.__logger.debug("Registering disconnected IOWrapper") self.__disconnected_wrappers.append(wrapper) return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register(self, wrapper):\n self.__validate_wrapper(wrapper)\n fd = self.__wrap_function(wrapper, \"fileno\")\n if not type(fd) is type(0):\n self.__logger.error(\"Cannot register IOWrapper with file descriptor %s\" % repr(fd))\n return False\n with self.__wrapp...
[ "0.59026706", "0.55204797", "0.5341881", "0.5245475", "0.52327204", "0.52327204", "0.5181297", "0.51777464", "0.50116295", "0.5001589", "0.49905667", "0.48477736", "0.48344794", "0.4818529", "0.48130843", "0.4807283", "0.48045424", "0.4798308", "0.4786231", "0.4742031", "0.47...
0.56404316
1
Unregister a file descriptor wrapper, usually because it has been disconnected or closed.
def unregister(self, wrapper): self.__validate_wrapper(wrapper) found = False fd = self.__wrap_function(wrapper, "fileno") if not type(fd) is type(0): self.__logger.error("Cannot unregister IOWrapper with file descriptor %s" % repr(fd)) return False with ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unregister(self, fd):\n self.poller.unregister(fd)", "def unregister(self, fd):\n self.poller.unregister(fd)", "def unregister(self, fd):\n if fd in self._fds:\n self._fds.remove(fd)", "def remove_descriptor(self, fileno):\n self.listeners[READ].pop(fileno, None)\n ...
[ "0.72940564", "0.72940564", "0.70253867", "0.66749716", "0.6640618", "0.64988714", "0.6204748", "0.6200317", "0.6153142", "0.6145244", "0.6072479", "0.6006315", "0.5988268", "0.59799767", "0.5932645", "0.5908495", "0.58961105", "0.5864231", "0.5809946", "0.57125515", "0.56913...
0.79327255
0
Unregister an unconnected file descriptor wrapper, usually because it has succesfully opened/connected or because it is no longer needed.
def unregister_unconnected(self, wrapper): self.__validate_wrapper(wrapper) with self.__wrapper_lock: if wrapper in self.__disconnected_wrappers: self.__disconnected_wrappers.remove(wrapper) return True else: self.__logger.warning("...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unregister(self, wrapper):\n self.__validate_wrapper(wrapper)\n found = False\n fd = self.__wrap_function(wrapper, \"fileno\")\n if not type(fd) is type(0):\n self.__logger.error(\"Cannot unregister IOWrapper with file descriptor %s\" % repr(fd))\n return False...
[ "0.7516931", "0.6932183", "0.6932183", "0.6672085", "0.6633065", "0.6464714", "0.6444078", "0.6234741", "0.61665344", "0.61642176", "0.6150731", "0.6091415", "0.6089481", "0.601867", "0.60160476", "0.5773837", "0.5757351", "0.5747841", "0.5737379", "0.57177335", "0.5711948", ...
0.73670936
1
Marks the file descriptor as writable in the poller
def set_writable(self, wrapper, writable): self.__validate_wrapper(wrapper) fd = self.__wrap_function(wrapper, "fileno") if type(fd) is type(0): self.__wakeup() with self.__poll_lock: try: self.__poll.modify(fd, True, writable, True) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def writable(name):", "def writable(self):\n ...", "def writable(path):", "def set_data_writable(self):\n pass", "def writable(self):\n return True", "def make_writeable(filename):\n if sys.platform.startswith('java'):\n # On Jython there is no os.access()\n ...
[ "0.6926017", "0.68552274", "0.65640175", "0.628673", "0.6203078", "0.61750156", "0.61536247", "0.6150798", "0.6146159", "0.60953534", "0.6092632", "0.6038486", "0.5971263", "0.59446305", "0.58429897", "0.5816304", "0.56790227", "0.56523734", "0.5646463", "0.5605246", "0.56032...
0.7544291
0
Stop the IOManager. This will set the running flag to false, which should terminate the IOManager thread in a short timespan.
def stop(self): self.__running = False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stop(self):\n self._run = False\n self.IA.stop()", "def stop(self):\n self._running = False", "def stop(self):\n self._running = False", "def stop(self) -> None:\n self._running = False", "def stop(self):\n with self._lock:\n self._running.clear()\n ...
[ "0.7407258", "0.73312134", "0.73312134", "0.7321287", "0.72551525", "0.7187192", "0.7187192", "0.7187192", "0.7187192", "0.7187192", "0.71809447", "0.713626", "0.713626", "0.711165", "0.70648855", "0.70051324", "0.7004732", "0.6987879", "0.6959247", "0.6959247", "0.6959247", ...
0.7348014
1
This method will be called whenever the file descriptor is readable.
def _handle_read(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_read(self):\n pass", "def on_readable(self):\n data = self.read(2048)\n if len(data) == 0:\n self.mark_down()\n if self.response is None:\n return\n else:\n self.response.on_connection_down(self)\n retur...
[ "0.73387545", "0.69494987", "0.6500824", "0.6464955", "0.63102823", "0.6290031", "0.62537575", "0.6229785", "0.61987466", "0.6165211", "0.6161047", "0.61076564", "0.60857755", "0.6050972", "0.60345066", "0.6018789", "0.6007374", "0.59776145", "0.5973924", "0.59695303", "0.596...
0.708658
1
render the blocks that make up the audit report
def render_report(blocks): for block in blocks: render_block( ( block[0], # signature block[1], # line number block[2], # line ) )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render_block(data):\n\tsnippet = data[2] \n\ttitle = data[0]['name']\n\tdescription = data[0]['description']\n\tblock_type = data[0]['type']\n\t\n\n\t# change the panel outline for\n\t# warnings and detections\n\tblock_border = 'yellow' if block_type == 'warning' else 'red1'\n\n\tcode_snippet = Syntax(\n\t\t\t...
[ "0.62289196", "0.5903791", "0.5720958", "0.5665011", "0.5582263", "0.5578783", "0.5555787", "0.5538801", "0.55341536", "0.5489891", "0.54667926", "0.54592144", "0.5451408", "0.5437162", "0.54213434", "0.54210407", "0.54027796", "0.5376064", "0.53752387", "0.5314603", "0.53117...
0.7140696
0
Send a message to all contributors of the given campaign.
def message_contributors(request, campaign_id, form_class=messageforms.ComposeForm, template_name='messages/compose.html', success_url=None): campaign = get_object_or_404(Campaign.visible_objects, pk=campaign_id, artist__user_profile__user=request.user, is_approved=True) form = form_class() if request.me...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_mass_messages(self, recipient_list, sender, message=\"\", subject=\"\"):\n try:\n for s in recipient_list:\n self.send_message(to=s, sender=sender, message=message, subject=subject)\n except TypeError:\n return -1\n return 1", "def send(self):\n ...
[ "0.59895015", "0.5723126", "0.55414027", "0.5496166", "0.54702157", "0.5385357", "0.5354316", "0.53353274", "0.5331929", "0.53257227", "0.5290182", "0.52430385", "0.52145374", "0.52112824", "0.51320004", "0.5124197", "0.5091597", "0.50726116", "0.50437075", "0.5014694", "0.50...
0.64192283
0
Show campaign summaries of logged in artist under the given category.
def list_artist_campaigns(request, category): # Sanity check if category not in ('unsubmitted', 'pending-approval', 'approved-upcoming', 'active', 'expired'): raise Http404 artist = request.user.get_profile().artist category = category.replace('-', '_') # DRY: Call template tag for the...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def view(request, category):\r\n return render(request, 'categories/view.html', {\r\n 'title': category.name,\r\n 'category': category,\r\n 'articles': Article.objects.select_related('author','author__profile','category').filter(category=category, status=Article.PUBLISHED),\r\n })", "d...
[ "0.57856625", "0.5675397", "0.56653684", "0.55892456", "0.5370637", "0.5199555", "0.51664764", "0.51587814", "0.50789976", "0.50553215", "0.5020364", "0.5019221", "0.49870524", "0.49827644", "0.49658126", "0.49644506", "0.4948786", "0.49370286", "0.49153695", "0.48407295", "0...
0.7150761
0
Process a PayPal or Google Checkout based contribution.
def contribute_by_payment_mode(request, campaign_id, payment_mode, template='campaign/campaign_contribution_form_%s.html'): campaign = get_object_or_404(Campaign.objects.active(), pk=campaign_id) payment_option = campaign.artist.get_merchant_account(payment_mode) if not payment_option: raise Htt...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def paypal_notification(request, payment_mode='paypal'):\r\n try:\r\n data = request.POST\r\n _log.debug(\"PayPal IPN data: %s\", repr(data))\r\n\r\n if not paypal.verify_ipn_request(request):\r\n return HttpResponse()\r\n\r\n if data.get('payment_status', None) != \"Compl...
[ "0.6142225", "0.58493024", "0.58211684", "0.5619037", "0.5387988", "0.53015286", "0.52222437", "0.5161513", "0.5132129", "0.51251936", "0.5114004", "0.5054638", "0.50287324", "0.5019555", "0.50136614", "0.49825796", "0.49805087", "0.4972348", "0.49634263", "0.49543017", "0.49...
0.58965725
1
Process a PayPal or Google Checkout based anonymous contribution.
def anon_contribute_by_payment_mode(request, campaign_id, payment_mode, template='campaign/campaign_contribution_form_%s_anon.html'): campaign = get_object_or_404(Campaign.objects.active(), pk=campaign_id) payment_option = campaign.artist.get_merchant_account(payment_mode) if not payment_option: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def paypal_notification(request, payment_mode='paypal'):\r\n try:\r\n data = request.POST\r\n _log.debug(\"PayPal IPN data: %s\", repr(data))\r\n\r\n if not paypal.verify_ipn_request(request):\r\n return HttpResponse()\r\n\r\n if data.get('payment_status', None) != \"Compl...
[ "0.6373298", "0.5703084", "0.5503658", "0.5475027", "0.5220315", "0.5134288", "0.51226735", "0.505278", "0.4990776", "0.493464", "0.49269527", "0.48673046", "0.4841768", "0.4832216", "0.48186994", "0.48010457", "0.47885463", "0.4726758", "0.47251117", "0.47234315", "0.4698482...
0.596364
1
Redeem a campaign ticket.
def redeem_ticket(request, template='campaign/redeem_ticket.html'): ticket_code = request.session.get('open_ticket_code', None) try: del request.session['open_ticket_code'] except KeyError: pass if request.POST or ticket_code: data = request.POST.copy() if ticket_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transfer_ticket(self, ticket_id):\n ticket = self.zendesk.get_ticket(ticket_id)\n subject = ticket[\"ticket\"][\"subject\"]\n status = ticket[\"ticket\"][\"status\"]\n description = ticket[\"ticket\"][\"description\"]\n if ticket[\"ticket\"][\"assignee_id\"] is not None:\n ...
[ "0.56641316", "0.5631388", "0.5553566", "0.5517005", "0.54539233", "0.5423735", "0.53499913", "0.534691", "0.52912635", "0.528025", "0.5250913", "0.52281886", "0.5220547", "0.5217796", "0.5214232", "0.5193973", "0.5187849", "0.51704186", "0.5169197", "0.51427704", "0.5139206"...
0.68725705
0
Process a return from PayPal's or Google's payment screen and redirect to the campaign's detail view. ``inv_id`` is the id of a``PendingContribution``. ``success_code`` is 1 or 0 for successful or cancelled payments respectively.
def payment_return(request, campaign_id, inv_id, success_code, payment_mode): campaign = get_object_or_404(Campaign, pk=campaign_id) if int(success_code) == 1: request.user.message_set.create(message=_('Thank you for your contribution.')) else: # User cancelled payment. request...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_success_request(self) -> HttpResponse: # noqa: C901\n request = self.request\n logger.debug(\n \"Handling Bambora user return request, params: {}.\".format(request.GET)\n )\n\n order_number, _timestamp = request.GET.get(\"ORDER_NUMBER\", \"-\").split(\"-\")\n ...
[ "0.5307607", "0.5205897", "0.5190838", "0.51417315", "0.50907296", "0.499538", "0.4893905", "0.48899612", "0.48739493", "0.48201224", "0.4802943", "0.4783593", "0.4728882", "0.47266012", "0.45329785", "0.45301113", "0.4483462", "0.44707704", "0.44324645", "0.4429951", "0.4421...
0.70670295
0
Receive PayPal IPN (Instant Payment Notification.)
def paypal_notification(request, payment_mode='paypal'): try: data = request.POST _log.debug("PayPal IPN data: %s", repr(data)) if not paypal.verify_ipn_request(request): return HttpResponse() if data.get('payment_status', None) != "Completed": # Do...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verify_ipn(data):\n data = dict(data)\n data['cmd'] = '_notify-validate'\n resp = requests.post(app.config['PAYPAL']['endpoint'], data=data)\n if resp.text == 'VERIFIED':\n return True\n return False", "def google_notification(request, payment_mode='google'):\r\n # ack_xml = '''<noti...
[ "0.6576129", "0.6399067", "0.57707894", "0.57616985", "0.5696024", "0.55341643", "0.51714045", "0.50293285", "0.5019871", "0.5008682", "0.49326146", "0.48892364", "0.4883548", "0.48674527", "0.4850678", "0.4834348", "0.4818443", "0.47996423", "0.47809997", "0.47706395", "0.47...
0.6606561
0
Receive notification of a campaign payment completed via Google Checkout.
def google_notification(request, payment_mode='google'): # ack_xml = '''<notification-acknowledgment xmlns="http://checkout.google.com/schema/2" serial-number="%s"/>\n\n''' ack_html = '''_type=notification-acknowledgment&serial-number=%s\n\n''' processed_response = None try: data = request....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def awaiting_payment(self):", "def collect_payment():\n\n # 1. Get required arguments\n args = Eg014Controller.get_args()\n try:\n # 2. Call the worker method\n results = Eg014Controller.worker(args)\n except ApiException as err:\n return process_error(err)\n\n # 3. Render suc...
[ "0.63564783", "0.62235355", "0.6013158", "0.57708764", "0.55319244", "0.551384", "0.55091786", "0.54820347", "0.54349434", "0.5395289", "0.5389404", "0.5342692", "0.5317579", "0.53085405", "0.5292847", "0.527213", "0.52671003", "0.52018356", "0.5181457", "0.51404744", "0.5083...
0.66050917
0
Return the lowest cost path, starting from start state,
def lowest_cost_search(start, successors, is_goal, action_cost): explored = set() frontier = [ [start] ] if is_goal(start): return frontier[0] while frontier: path = frontier.pop(0) state1 = final_state(path) if is_goal(state1): return path explored.ad...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lowest_cost_search(start, successors, is_goal, action_cost):\r\n # your code here\r\n explored = set()\r\n frontier = [ [start] ]\r\n while frontier:\r\n path = frontier.pop(0)\r\n state1 = final_state(path)\r\n if is_goal(state1):\r\n return path\r\n explored...
[ "0.79001284", "0.7815893", "0.75089973", "0.7477071", "0.73168325", "0.73155445", "0.7228358", "0.70762277", "0.70678824", "0.69976723", "0.69821614", "0.6907217", "0.6877946", "0.6854953", "0.6824021", "0.6787544", "0.67676026", "0.67614686", "0.67411", "0.67290896", "0.6712...
0.7975087
0
String representation for a string to value map
def _reprOfStringToValueMap (stringMap : Map) -> String: entrySeparator = u"§" entryTemplate = "%s: %s" keyList = sorted(list(stringMap.keys())) result = "" for key in keyList: value = stringMap[key] result += (iif(result == "", "", entrySeparator) + entryTe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valueToString():", "def str_dict(d):\n return \", \".join(\"%s=%s\" % (k, d[k]) for k in d)", "def __str__(self):\n return '({0},{1})'.format(self.key, self.value)", "def __str__(self):\n return '(' + str(self.key) + ': ' + str(self.value) + ')'", "def __str__(self):\n return '(...
[ "0.6723412", "0.66615885", "0.6657132", "0.66348654", "0.66348654", "0.65340376", "0.65042675", "0.6488888", "0.647782", "0.6375239", "0.63170457", "0.63118005", "0.63005364", "0.62862843", "0.62133026", "0.61995703", "0.6197091", "0.6170143", "0.6162775", "0.6158538", "0.614...
0.7466139
0
Returns string representation of associated identifier value for ; if not found in current key to value map, the identifier itself is returned
def _findIdentifierValue (self, identifier : String) -> String: Logging.trace(">>: %s", identifier) cls = self.__class__ if identifier not in self._keyToValueMap: # leave identifier as is (it might be some value name like # wahr or false Logging.traceError("...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _ident(self):\n key_values = [unicode(self.db_key[k]) for k in self.db_key]\n return \"Position (\" + ', '.join(key_values) + \")\"", "def get_identifier_string(self):\n return self.identifier", "def __str__(self):\n return '(' + str(self.key) + ': ' + str(self.value) + ')'", ...
[ "0.5909048", "0.58781356", "0.5796385", "0.5796385", "0.57949334", "0.5659293", "0.5657731", "0.5601299", "0.5601299", "0.5600478", "0.5569756", "0.5562239", "0.55307454", "0.55261767", "0.551171", "0.550825", "0.54956865", "0.5493071", "0.5491545", "0.54761845", "0.54655385"...
0.6844378
0
Merges continuation lines in into single cumulated line and replaces continuations by empty lines (to preserve line
def _mergeContinuationLines (cls, lineList : StringList): Logging.trace(">>") cumulatedLine = "" markerLength = len(cls._continuationMarker) lineListLength = len(lineList) for i, originalLine in enumerate(lineList): currentLine = originalLine.strip() l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_line_continuations(code):\n # pat = r\"('.*)(\\.\\.\\.)(.*')\"\n # code = re.sub(pat, r\"\\g<1>\\g<3>\", code, flags=re.MULTILINE)\n\n pat = r\"^([^%'\\\"\\n]*)(\\.\\.\\..*\\n)\"\n code = re.sub(pat, r\"\\g<1>\", code, flags=re.MULTILINE)\n return code", "def evaluate_line_continuations...
[ "0.632266", "0.62321156", "0.57464445", "0.53904647", "0.53602", "0.52938676", "0.52780247", "0.52217114", "0.5165691", "0.51586413", "0.51507574", "0.5148912", "0.5105856", "0.50744593", "0.50576735", "0.50505483", "0.50486463", "0.5046026", "0.5037575", "0.50359184", "0.503...
0.71371007
0
Sets list of search paths to .
def setSearchPaths (cls, searchPathList : StringList): Logging.trace(">>: %r", searchPathList) cls._searchPathList = ["."] + searchPathList Logging.trace("<<")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_paths(self, paths):\n self.paths = paths", "def set_paths(self, paths):\n self._paths = paths\n self._paths_set = True", "def SetPythonPaths(self):\n _knownPaths = site._init_pathinfo()\n for name, value, junk in self._marchConfig():\n if isinstance(value, ...
[ "0.68462783", "0.6627446", "0.65913725", "0.65353215", "0.6467541", "0.64639115", "0.63712513", "0.63694894", "0.63314074", "0.6320922", "0.631195", "0.6294908", "0.6247503", "0.622521", "0.61129904", "0.59953964", "0.5986615", "0.59491456", "0.5936939", "0.5894814", "0.58811...
0.82994115
0
Update one or more items for this employee. Specifying an empty value will clear it for that employee.
def update_employee(emp_id, key=None, value=None, items=None): if items is None: if key is None or value is None: return {"Error": "At least one key/value pair is required"} items = {key: value} elif isinstance(items, str): items = salt.utils.yaml.safe_load(items) xml_it...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(self, items: Mapping[Any, Any]) -> None:\n self.extend(list(items.values()))\n return", "def update(self, *items):\n for item in items:\n self.add(item)", "def update_item(self, id: str, user: User, **kwargs) -> None:", "def update_items(self, request, *a, **kw):\n ...
[ "0.62127465", "0.61989135", "0.6134278", "0.6095077", "0.60757583", "0.60266775", "0.5949175", "0.5913471", "0.5824841", "0.5775372", "0.5750113", "0.57272786", "0.57065195", "0.56633925", "0.56531554", "0.5622812", "0.56077135", "0.56035596", "0.5586695", "0.55599886", "0.54...
0.6439496
0
Show all meta data fields for this company.
def list_meta_fields(): ret = {} status, result = _query(action="meta", command="fields") root = ET.fromstring(result) for field in root: field_id = None field_ret = {"name": field.text} for item in field.items(): field_ret[item[0]] = item[1] if item[0] ==...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_fields(self):\n fields = []\n for f in self._meta.fields:\n\n fname = f.name \n # resolve picklists/choices, with get_xyz_display() function\n get_choice = 'get_'+fname+'_display'\n if hasattr( self, get_choice):\n value = ...
[ "0.63180304", "0.6235449", "0.59543186", "0.5739981", "0.5733114", "0.5728143", "0.5680151", "0.5634569", "0.5624671", "0.5574427", "0.55651516", "0.5556688", "0.55432194", "0.55249697", "0.54736274", "0.54564404", "0.54484874", "0.5447442", "0.5430577", "0.5414239", "0.54125...
0.6288093
1
\brief Stop the write flush timer.
def stopTimer(self): log.debug("SwitchDB: stopping flush timer") self.__flush_timer.stop() self.flushWrites()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stopWrite(self):\n\n self.dowrite = False", "def stop_timer(self):\n self.end_time = datetime.now()", "def stop_timer(self):\n self.log.info(\"{} timer stopped ({} seconds)\".format(self.name, self.interval))\n self.start_event.clear()\n # self.count = self.interval / sel...
[ "0.7037228", "0.6424918", "0.62180656", "0.6174741", "0.60519195", "0.6048231", "0.60435826", "0.60333914", "0.5959563", "0.5948373", "0.59198564", "0.5895208", "0.5839709", "0.580128", "0.5790531", "0.57885194", "0.5749805", "0.5743604", "0.57333773", "0.57209086", "0.570342...
0.8155102
0
Decorator for registering a rule with the rule factory.
def register_rule(factory_func=None): def decorator(cls): if factory_func is None: RuleFactory.register_rule(cls) else: RuleFactory.register_rule(lambda: factory_func(cls)) return cls return decorator
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register_rule(cls, rule_func):\n cls._rules_factories.append(rule_func)", "def register_rule(pattern: matcher.Pattern) -> Callable[..., rules.Rule]:\n\n def register(handler: Callable[..., Any]) -> rules.Rule:\n return rules.make_rule(pattern, handler)\n\n return register", "def add_rule(self, ...
[ "0.8259463", "0.7652915", "0.66059923", "0.65928054", "0.6551904", "0.65204674", "0.64615387", "0.64417386", "0.64297867", "0.64228624", "0.6336922", "0.6239316", "0.6231074", "0.6194358", "0.6129349", "0.6121821", "0.6108161", "0.6086128", "0.59606814", "0.59476435", "0.5836...
0.83662206
0
Returns an instantiated list of each rule that has been registered.
def get_rules(cls) -> list: return [factory() for factory in cls._rules_factories]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_rules(self):\n rules = []\n for item in self.rule:\n rules.append(item)\n return rules", "def get_rules(self):\n rules = []\n for item in self.name:\n rules.append(item)\n return rules", "def getListOfRules(self):\n return self.mode...
[ "0.81854767", "0.8028653", "0.7681446", "0.747593", "0.7188627", "0.7024562", "0.6993731", "0.69882214", "0.67589486", "0.6748225", "0.67445904", "0.67356396", "0.6722869", "0.6689858", "0.6678105", "0.6660337", "0.6650291", "0.65893424", "0.6547568", "0.6512674", "0.6477749"...
0.81147885
1
Utility function used by the register_rule decorator to register a lambda/function to instantiate a rule.
def register_rule(cls, rule_func): cls._rules_factories.append(rule_func)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register_rule(factory_func=None):\n def decorator(cls):\n if factory_func is None:\n RuleFactory.register_rule(cls)\n else:\n RuleFactory.register_rule(lambda: factory_func(cls))\n\n return cls\n return decorator", "def register_rule(pattern: matcher.Pattern) ...
[ "0.734958", "0.7176785", "0.63173115", "0.57214266", "0.5599516", "0.55994016", "0.55857486", "0.5585293", "0.5575238", "0.5558575", "0.5531269", "0.5498299", "0.5496348", "0.54958177", "0.54734015", "0.54484636", "0.54439145", "0.5400797", "0.5344353", "0.5344353", "0.534435...
0.7451927
0
>>> test_time_signature('bwv66.6.xml', 'different_time.mxl') False >>> test_time_signature('bwv66.6.mxl', 'different_dynamics.mxl') True >>> test_time_signature('bwv66.6.mxl', 'different_key.mxl') True >>> test_time_signature('bwv66.6.mxl', 'different_time2.mxl', 5) False >>> test_time_signature('bwv66.6.mxl', 'differe...
def test_time_signature(score1, score2, measure = 0, part = 0): diff = ScoreDiff(score1, score2, path) return diff.have_same_time_signature(measure, part)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_signature_verification(self):\n curdir = os.path.dirname(os.path.abspath(__file__))\n keydir = os.path.join(curdir, \"data\", \"ima_keys\")\n\n lines = SIGNATURES.split('\\n')\n\n # empty keyring\n keyring = ima_file_signatures.ImaKeyring()\n self.assertTrue(ima.p...
[ "0.6361225", "0.5938662", "0.5742003", "0.56398404", "0.56322205", "0.5614221", "0.5570382", "0.5565186", "0.5562696", "0.5562569", "0.5561084", "0.5537023", "0.5530048", "0.5530048", "0.550574", "0.5453776", "0.5438577", "0.5410554", "0.5371119", "0.5326065", "0.52840763", ...
0.6932904
0
>>> test_clef('bwv66.6.mxl', 'different_clef.mxl') False >>> test_clef('bwv66.6.mxl', 'different_time.mxl') True >>> test_clef('bwv66.6.mxl', 'different_pitches.mxl') True >>> test_clef('bwv66.6.mxl', 'different_clef2.mxl', 1) False >>> test_clef('bwv66.6.mxl', 'different_clef3.mxl', 2) False >>> test_clef('bwv66.6.mxl...
def test_clef(score1, score2, measure = 0, part = 0): diff = ScoreDiff(score1, score2, path) return diff.have_same_clef_markings(measure, part)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tests_truth():\n circ_m = ccxtest(4)\n print(circ_m)\n circ_m = crootnxtest(4)\n print(circ_m)\n circ_m = oracletest(4)\n print(circ_m)\n circ_m = ccx_otest(4)\n print(circ_m)", "def _consonance_test(self, testfunc, param=None):\n n = list(self.notes)\n while len(n) > 1:...
[ "0.5843581", "0.5775546", "0.5584157", "0.5578372", "0.5539811", "0.544524", "0.5414274", "0.5412933", "0.53988796", "0.5382359", "0.53114665", "0.5242615", "0.5241555", "0.5241493", "0.5239952", "0.5205264", "0.5201015", "0.51927865", "0.5182268", "0.5157461", "0.51572466", ...
0.6404271
0
>>> test_pitches('bwv66.6.mxl', 'different_pitches.mxl') False >>> test_pitches('bwv66.6.mxl', 'different_pitches2.mxl', 1) False >>> test_pitches('bwv66.6.mxl', 'different_pitches2.mxl', 2) False >>> test_pitches('bwv66.6.mxl', 'different_dynamics.mxl') True >>> test_pitches('bwv66.6.mxl', 'different_key.mxl') True >>...
def test_pitches(score1, score2, measure = 0, part = 0): diff = ScoreDiff(score1, score2, path) return diff.have_same_pitches(measure, part)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_random_note_pitch(common_scales, all_pitches):\n\n for key, scales in common_scales.items():\n note = random_note_pitch(scales)\n assert note in all_pitches\n assert isinstance(note, (int, str)) is True", "def test_true_false_cases(file_with_true_and_false_value, result, inp):\n ...
[ "0.57925975", "0.5436552", "0.5393471", "0.53561616", "0.53336096", "0.53189737", "0.517428", "0.50872374", "0.5070097", "0.5059205", "0.5006668", "0.4995654", "0.49777004", "0.49690577", "0.4963465", "0.49614137", "0.49481976", "0.49456045", "0.4936992", "0.49341315", "0.492...
0.66385114
0
>>> test_ornaments('bwv66.6.mxl', 'different_ornaments.mxl') False >>> test_ornaments('bwv66.6.mxl', 'different_ornaments2.mxl') False >>> test_ornaments('bwv66.6.mxl', 'different_ornaments3.mxl') False >>> test_ornaments('bwv66.6.mxl', 'different_pitches.mxl') True >>> test_ornaments('bwv66.6.mxl', 'different_key.mxl'...
def test_ornaments(score1, score2, measure = 0, part = 0): diff = ScoreDiff(score1, score2, path) return diff.have_same_ornaments(measure, part)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_match_nones():\r\n runmatch(lcode_nones)", "def ensemble_annoj_exists(ensemble):\n\n\tensemble = str(ensemble)\n\tensemble = ensemble.strip('Ens')\n\tresult = path.isfile('/var/www/html/annoj_private/CEMBA/browser/fetchers/mc_cemba/mc_single_merged_mCG_cluster_mCHmCG_lv_npc50_k30_1_Ens'+str(ensemble)...
[ "0.5523054", "0.5063729", "0.49874783", "0.49115068", "0.48974282", "0.48964244", "0.48904523", "0.48893464", "0.48683524", "0.48556218", "0.48508865", "0.48504823", "0.4835649", "0.48253495", "0.48235333", "0.4821645", "0.48186624", "0.48185313", "0.48053995", "0.4797268", "...
0.6441692
0
>>> test_accidentals('bwv66.6.mxl', 'different_accidentals.mxl') False >>> test_accidentals('bwv66.6.mxl', 'different_ornaments.mxl') True >>> test_accidentals('bwv66.6.mxl', 'bwv66.6.mxl') True >>> test_accidentals('bwv66.6.mxl', 'different_accidentals2.mxl', 1) False >>> test_accidentals('bwv66.6.mxl', 'different_acc...
def test_accidentals(score1, score2, measure = 0, part = 0): diff = ScoreDiff(score1, score2, path) return diff.have_same_accidentals(measure, part)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def given_test_cases(self):\n self.assertTrue(anagram_finder(\"listen\", \"silent\"))\n self.assertTrue(anagram_finder(\"triangle\", \"integral\"))\n self.assertFalse(anagram_finder(\"apple\", \"pabble\"))", "def test_check_validity(resident_names, hospital_names, capacities, seed):\n\n _...
[ "0.59301686", "0.55262876", "0.5454933", "0.5408776", "0.5360736", "0.52889955", "0.5265647", "0.52480555", "0.52306783", "0.51918554", "0.5188172", "0.5188172", "0.5185943", "0.5185736", "0.5171561", "0.5156619", "0.51435447", "0.51403385", "0.5136119", "0.5135964", "0.51198...
0.57314533
1
>>> test_stem_directions('bwv66.6.mxl', 'different_stems.mxl') False >>> test_stem_directions('bwv66.6.mxl', 'different_stems2.mxl', 1) False >>> test_stem_directions('bwv66.6.mxl', 'different_stems3.mxl', 4) False >>> test_stem_directions('bwv66.6.mxl', 'different_ornaments.mxl') True >>> test_stem_directions('bwv66.6...
def test_stem_directions(score1, score2, measure = 0, part = 0): diff = ScoreDiff(score1, score2, path) return diff.have_same_stem_directions(measure, part)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_stemming():\n normalizer = TextNormalizer(stem=True, lemmatize=False)\n assert normalizer.transform([[\"running\"]])[\"corpus\"][0] == [\"run\"]", "def test_1(self):\r\n\r\n max_flexion_len = 3\r\n\r\n result_1 = list(stemmer.gen_simplest_stemmer(\"слово\", max_flexion_len))\r\n ...
[ "0.6692664", "0.624442", "0.60175544", "0.60047394", "0.59410924", "0.5930666", "0.59121484", "0.58245426", "0.560271", "0.5552443", "0.54929966", "0.54354376", "0.5396129", "0.53951675", "0.5383812", "0.5341282", "0.53087145", "0.52382666", "0.52240324", "0.5221061", "0.5160...
0.7251379
0
>>> test_spanners('bwv66.6.mxl', 'different_phrasing.mxl') False >>> test_spanners('bwv66.6.mxl', 'different_ornaments.mxl') False >>> test_spanners('bwv66.6.mxl', 'different_pitches.mxl') True >>> test_spanners('bwv66.6.mxl', 'scriabin_opus_2_no1.mxl') True >>> test_spanners('bwv66.6.mxl', 'scriabin_opus_8_no5.mxl') T...
def test_spanners(score1, score2, measure = 0, part = 0): diff = ScoreDiff(score1, score2, path) return diff.have_same_spanners(measure, part)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_env_rules_cause_matching_span_to_be_sampled():\n with override_global_config(dict(_sampling_rules='[{\"service\":\"test_service\",\"name\":\"test_name\"}]')):\n sampling_rules = get_span_sampling_rules()\n assert sampling_rules[0]._service_matcher.pattern == \"test_service\"\n asse...
[ "0.5340157", "0.51737", "0.507743", "0.50210464", "0.4951721", "0.49203345", "0.48373163", "0.4762639", "0.4744961", "0.47269493", "0.47077292", "0.46728623", "0.466654", "0.4652557", "0.46401304", "0.4631468", "0.4625303", "0.4613554", "0.46055642", "0.46029666", "0.4597388"...
0.6647752
0
>>> test_articulations('bwv66.6.mxl', 'different_articulations.mxl') False >>> test_articulations('bwv66.6.mxl', 'different_ornaments.mxl') True >>> test_articulations('bwv66.6.mxl', 'different_pitches.mxl') True >>> test_articulations('scriabin_opus_2_no1.mxl', 'bwv66.6.mxl') True >>> test_articulations('scriabin_opus...
def test_articulations(score1, score2, measure = 0, part = 0): diff = ScoreDiff(score1, score2, path) return diff.have_same_articulations(measure, part)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_variational():\n # iris\n #pres = \"Test pour le data set Iris (facile, classique)\"\n #test_from_func_variational(pres, 15, 10, 3, True, Iris)\n\n # breast cancer\n pres = \"Test pour le data set Breast Cancer (facile, classique)\"\n test_from_func_variational(pres, 15, 10, 3, True, Bre...
[ "0.551927", "0.55119956", "0.5459723", "0.5439813", "0.5362803", "0.53410804", "0.53354734", "0.5287916", "0.5287916", "0.5285058", "0.5218113", "0.51794463", "0.5179227", "0.51770556", "0.5171885", "0.51688933", "0.51557285", "0.514981", "0.51109475", "0.51107997", "0.509594...
0.66323584
0
Determines whether a piece of software meets 6.031 standards. Software meets 6.031 standards if it is safe from bugs, ready for change, and easy to understand.
def is_code_good(safe_from_bugs, ready_for_change, easy_to_understand): pass # your code here!
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_version_2_6() -> bool:\n v = get_version()\n if v[1] != \"singularity\" and v[1] != \"singularity-ce\":\n return False\n return v[0][0] == 2 and v[0][1] == 6", "def check_supported_features(self):", "def eligible(CGPA:float, Year:int, program:str) -> bool:\n return CGPA >= 2 and Year ...
[ "0.6226087", "0.6051725", "0.5854076", "0.58402455", "0.58168775", "0.5793419", "0.5768285", "0.57435614", "0.57337004", "0.57026315", "0.56996334", "0.5698729", "0.5671816", "0.56634545", "0.5659834", "0.5626873", "0.5620132", "0.55883926", "0.5572107", "0.55642295", "0.5551...
0.6084589
1
Computes the length of the recurring cycle in the decimal representation of the rational number 1/d if any, 0 otherwise
def cycle_length(d): if not isinstance(d, int) or d <= 0: raise ValueError("cycle_length(d): d must be a positive integer") rlist = [] qlist_len = 0 remainder = 1 while remainder: remainder = remainder % d if remainder in rlist: return qlist_len - rlist.index(rema...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lenOfRec(denom):\n d = denom\n n = 1 #numerator\n count = 0\n while n!=0:\n n = n*10 % d\n count += 1\n if n == 1:\n break\n \n return count", "def get_length_repeating_decimals(num, den):\n # When we use longhand divison for the fraction we find that ...
[ "0.7235305", "0.7039432", "0.65656936", "0.64102966", "0.62604904", "0.6176775", "0.6016356", "0.60072213", "0.5950206", "0.5911741", "0.58723277", "0.58633614", "0.57687944", "0.5754934", "0.5731501", "0.5682944", "0.56633145", "0.563831", "0.55833185", "0.55670255", "0.5565...
0.734951
0
Parses restaurant name and ratings from file and adds it to a dictionary.
def process_file(file_name): restaurant_ratings = {} # open file, iterate line by line restaurant_file = open(file_name) # split by colon, returns a list for line in restaurant_file: restaurant_name, restaurant_rating = line.rstrip().split(":") restaurant_ratings[restaurant...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def return_restaurant_rating_dictionary(filename):\n\n the_file = open(filename)\n\n for line in the_file:\n line = line.rstrip()\n ratings = line.split(\":\")\n\n restaurant_name = ratings[0]\n rating = ratings[1]\n restaurant_ratings[restaurant_name] = rating\n\n retur...
[ "0.8203267", "0.8107739", "0.81040096", "0.80869764", "0.8024982", "0.8008177", "0.77576977", "0.6952371", "0.66929567", "0.6518673", "0.64702773", "0.63175005", "0.6137714", "0.61332256", "0.6118705", "0.6059968", "0.6051205", "0.6029567", "0.598272", "0.59775275", "0.597714...
0.8216074
0
Prompts user for restaurant & rating, adds to dictionary.
def add_restaurant_rating(restaurant_ratings): user_restaurant = raw_input("Enter a restaurant name: ") user_rating = int(raw_input("Enter a restaurant rating between 1-5: ")) # prompt user for new restaurant and rating, add to dictionary restaurant_ratings[user_restaurant] = user_rating return r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def adds_user_ratings(restaurant_ratings_dictionary):\n while True:\n add_restaurant = input(\"Would you like to add a restaurant review? Type Y or N\\n> \").lower()\n if add_restaurant == \"n\":\n print(\"n\")\n break\n elif add_restaurant == \"y\":\n print...
[ "0.78467345", "0.744267", "0.71459824", "0.71104604", "0.6941335", "0.69223744", "0.6828657", "0.6637511", "0.64718455", "0.64450294", "0.6160519", "0.60316193", "0.594381", "0.5925114", "0.58915067", "0.5874964", "0.5837635", "0.5719949", "0.5660157", "0.5600644", "0.559366"...
0.8107513
0
Create DataFrame including rating 5 for all watched movies and split to row each movie_id by user
def _normalize_dataset(self): new_data = [] columns = ['user_id', 'movie_id', 'rating'] for line in self.data_file['users']: movies_by_user = [ {'user_id': line['user_id'], 'movie_id': movie_id, 'rating': 5} for movie_id in line['movies'] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def movielens_20m_to_df(ratings_file, movies_file):\n ratings_names = ['user_id', 'movie_id', 'rating', 'unix_timestamp']\n ratings_delim = ','\n\n movies_names = [ 'movie_id', 'movie_title', 'genres']\n movies_delim = ','\n encoding = 'utf-8'\n engine = 'python'\n\n ratings_df = pd.read_csv(r...
[ "0.7226439", "0.6808683", "0.66778433", "0.65288967", "0.6355954", "0.63107824", "0.62635416", "0.62023175", "0.6157416", "0.6135076", "0.6127724", "0.61078817", "0.610165", "0.60978687", "0.60910624", "0.60819", "0.60430026", "0.6031244", "0.6009129", "0.6004356", "0.5994962...
0.71923757
1
Read a normalized dataset and create a sparse matrix containing the ratings
def _get_sparse_data(self): data = self._normalize_dataset() n_users = data.user_id.unique().shape[0] n_movies = data.movie_id.unique().shape[0] ratings = np.zeros((n_users, n_movies)) for row in data.itertuples(): ratings[row[1]-1, row[2]-1] = row[3] retur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_data(filename):\n # read in triples of itemID/userID/playcount from the input dataset\n data = pandas.read_table(filename,\n usecols=[0, 1, 2],\n header=0,\n delimiter=',')\n\n # map each userID and itemID to a un...
[ "0.67880994", "0.6689617", "0.6406892", "0.63348025", "0.63336885", "0.6284135", "0.6262106", "0.6207071", "0.61706823", "0.6128356", "0.61157274", "0.6012887", "0.60104775", "0.5936172", "0.58552825", "0.5835682", "0.5825443", "0.5810967", "0.57736486", "0.5751358", "0.57505...
0.7752622
0
Return a list of k recommended movies
def _get_top_k_movies(self, similarity, movie_id, k): return [ self._get_movies()[str(x+1)] for x in np.argsort(similarity[movie_id-1,:])[:-k-1:-1] ]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_similar_movies(movie_title, k=500, show_distance=False):\n movie_id = ratings.tconst_gender[ratings.primaryTitle == movie_title].unique()[0]\n\n neighbour_ids = []\n \n movie_ind = movie_mapper[movie_id]\n movie_vec = X[movie_ind]\n k+=1\n \n \n if isinstance(movie_vec, (np.ndar...
[ "0.6969492", "0.6910933", "0.6792513", "0.6524257", "0.64092964", "0.63887626", "0.63844305", "0.6354006", "0.6342225", "0.62963384", "0.61361873", "0.6134131", "0.61273575", "0.6064123", "0.60433394", "0.6024817", "0.6016986", "0.5957066", "0.5895713", "0.58880854", "0.58761...
0.69542474
1
Check the folder contains the three mandatory files with extension .shp, .dbf,.dbf Also check there is only 1 shapefile and this is a polygon type
def check_shapefile(folder): ''' Value | Shape Type 0 | Null Shape 1 | Point 3 | PolyLine 5 | Polygon 8 | MultiPoint 11 | PointZ 13 | PolyLineZ 15 | PolygonZ 18 | MultiPointZ 21 | PointM 23 | PolyLineM 25 | PolygonM 28 | MultiPointM 31 | MultiPatch ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validFiles(self, files):\n for myfile in files:\n if not ( ( myfile.get_uri_scheme() == 'file' ) or \\\n ( myfile.get_uri_scheme() == 'smb' ) ):\n return False\n elif ( not myfile.get_mime_type() in self.oootypes ) and \\\n ( not myfile....
[ "0.61982626", "0.61947924", "0.6175953", "0.6119851", "0.6091015", "0.59931964", "0.59807795", "0.58886826", "0.5863063", "0.5850182", "0.5840579", "0.58361673", "0.5823537", "0.5823537", "0.5823537", "0.5808097", "0.5795179", "0.5784716", "0.5771951", "0.5764534", "0.5762427...
0.839037
0
Check the user input for a point, if inside USA, if OK add it to the database Crop nummber to 4 digits, define the marker size based on the bigger number of digits
def upload_point(x, y, label=""): conn = None cur = None try: # check the point is inside the usa, both point and states must be WGS84 conn = utils.pgconnect(**settings.DEFAULT_CONNECTION) cur = conn.cursor() #if the point is inside this will return (True,) otherwise None ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_latitude(self):\n lLatitude = self.cleaned_data['latitude']\n if lLatitude:\n lValue = lLatitude.strip()\n if lValue:\n lRegEx = re.compile(CO_ORD_REGEX)\n if lRegEx.match(lValue) == None:\n raise forms.ValidationError(\...
[ "0.56233335", "0.55526364", "0.5320986", "0.5181115", "0.51509035", "0.51473725", "0.5142715", "0.5123412", "0.50627816", "0.5056026", "0.505146", "0.49788797", "0.49679402", "0.48976582", "0.48737523", "0.4873513", "0.48673427", "0.48661628", "0.48638946", "0.48234263", "0.4...
0.6816568
0
Return the epsg code for a shapefile
def get_epsg(path): dataset = None layer = None srs = None try: driver = ogr.GetDriverByName('ESRI Shapefile') dataset = driver.Open(path, 0) # 0 means read-only layer = dataset.GetLayer() srs = layer.GetSpatialRef() #Set EPSG authority info if possible. ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _epsg(self):\n info = self._info['coordinateSystem']['wkt'].rsplit('\"EPSG\",', 1)[-1]\n return int(re.findall(r\"\\d+\", info)[0])", "def s2_epsg_code(self):\n ul, lr = self.ul_lr\n epsg_old = self.epsg\n if epsg_old != 4326:\n lon, lat = ImageIO.transform_point...
[ "0.607808", "0.6057351", "0.5858668", "0.57926476", "0.5748241", "0.56743056", "0.5667732", "0.5608399", "0.5567314", "0.552981", "0.5460044", "0.5319938", "0.53048986", "0.5285746", "0.5281998", "0.52689594", "0.52610826", "0.5208903", "0.5187333", "0.5187333", "0.5178785", ...
0.7115192
0
reproject a vector file (only the first layer!) (it does not save the dataset to disk)
def reproject_vector( path, epsg_from=None, epsg_to=None): if not epsg_to: raise Exception("please, specify the output EPSG codes") inDataSet = None outDataSet = None inFeature = None outFeature = None outLayer = None try: driver = ogr.GetDriverByName('ESRI Shapefile') in...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reprojectAndSaveNewRaster(inFilepath,outFilepath,to_EPSG):\r\n from osgeo import gdal\r\n input_raster = gdal.Open(inFilepath)\r\n EPSG_string = \"EPSG:\"+str(to_EPSG)\r\n ras = gdal.Warp(outFilepath,input_raster,dstSRS=EPSG_string)\r\n del ras", "def reprojectAndSaveNewShapefile(inFilepath,ou...
[ "0.62399775", "0.6226501", "0.58857656", "0.58182466", "0.56765485", "0.56583333", "0.5608022", "0.5603202", "0.56001997", "0.5566788", "0.5521875", "0.5514971", "0.5509281", "0.5441147", "0.54357195", "0.54265714", "0.54211587", "0.54107004", "0.54107004", "0.5363864", "0.53...
0.6866187
0
Return html class fragment for the marker size
def get_class_size(size): s = 'fa-lg' if size == 1: s = 'fa-lg' elif size == 2: s = 'fa-2x' elif size == 3: s = 'fa-3x' elif size == 4: s = 'fa-4x' elif size == 5: s = 'fa-5x' return s
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_marker_size(self, marker_id: int) -> int:\n if marker_id in range(0, 40):\n # WALL_MARKER\n return 250\n else:\n return 100", "def marker_size(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"marker_size\")", "def marker_size(self) ...
[ "0.60135067", "0.58254164", "0.58254164", "0.58254164", "0.5667613", "0.56253487", "0.56235933", "0.561359", "0.556173", "0.55141217", "0.5447288", "0.5412233", "0.5396221", "0.5358953", "0.5335299", "0.52983207", "0.5272478", "0.5263561", "0.5260405", "0.5251097", "0.5245471...
0.66643053
0
Download geojson from the database
def get_geojson(): # check the file was already downloaded global GEOJSON if GEOJSON: return GEOJSON conn = None cur = None try: conn = utils.pgconnect(**settings.DEFAULT_CONNECTION) cur = conn.cursor() cur.execute( """SELECT row_to_json(fc) FROM ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_allpoints_geojson():\n\n # check the file was already downloaded\n global GEOJSON\n if GEOJSON: return GEOJSON\n\n conn = None\n cur = None\n try:\n\n conn = utils.pgconnect(**settings.DEFAULT_CONNECTION)\n cur = conn.cursor()\n cur.execute( \"\"\"SELECT row_to_jso...
[ "0.7075735", "0.6992949", "0.6549768", "0.64688873", "0.63209444", "0.62644655", "0.6259451", "0.6221336", "0.61216295", "0.6098716", "0.60747683", "0.6071885", "0.6071885", "0.6039488", "0.59665906", "0.5948892", "0.5944469", "0.58469725", "0.58332884", "0.58315897", "0.5820...
0.7378575
0
Download geojson from the database
def get_allpoints_geojson(): # check the file was already downloaded global GEOJSON if GEOJSON: return GEOJSON conn = None cur = None try: conn = utils.pgconnect(**settings.DEFAULT_CONNECTION) cur = conn.cursor() cur.execute( """SELECT row_to_json(fc) FROM ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_geojson():\n\n # check the file was already downloaded\n global GEOJSON\n if GEOJSON: return GEOJSON\n\n conn = None\n cur = None\n try:\n\n conn = utils.pgconnect(**settings.DEFAULT_CONNECTION)\n cur = conn.cursor()\n cur.execute( \"\"\"SELECT row_to_json(fc) FROM...
[ "0.7378575", "0.6992949", "0.6549768", "0.64688873", "0.63209444", "0.62644655", "0.6259451", "0.6221336", "0.61216295", "0.6098716", "0.60747683", "0.6071885", "0.6071885", "0.6039488", "0.59665906", "0.5948892", "0.5944469", "0.58469725", "0.58332884", "0.58315897", "0.5820...
0.7075735
1
Add a geojson layer to the map
def add_geojson(map, geojson, style_function, name='states' ): folium.GeoJson( geojson, name=name, style_function=style_function ).add_to(map)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def geojson(self, feature_id):\n lat, lon = self.lat_lon\n return {\n 'type': 'Feature',\n 'id': feature_id,\n 'geometry': {\n 'type': 'Point',\n 'coordinates': (lon, lat),\n },\n }", "def add_layer(self, layer):\n ...
[ "0.6588062", "0.6515679", "0.63336873", "0.629631", "0.6243965", "0.62241894", "0.621897", "0.6132847", "0.6105182", "0.60940987", "0.60355663", "0.6014956", "0.60060114", "0.59752184", "0.595699", "0.5950891", "0.5879442", "0.5840097", "0.5835999", "0.57998115", "0.57890666"...
0.81856084
0
Predicts the matrix using the covariates in self.covs_mat with the updated coefficients stored in self.alpha.
def predict_mat(self): mat = self.covs_mat.dot(self.alpha) return mat.reshape(self.shape)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_params(self, mat):\n assert mat.shape == self.shape\n vec = mat.reshape(mat.size)\n self.alpha = np.linalg.solve(self.covs_mat.T.dot(self.covs_mat),\n self.covs_mat.T.dot(vec))", "def predict_mat(self):\n return self.u.dot(self.v.T)", "...
[ "0.6490651", "0.60074425", "0.6004628", "0.599036", "0.58364904", "0.57246894", "0.57134897", "0.570626", "0.56881577", "0.5673695", "0.56713176", "0.56486166", "0.5626255", "0.5538134", "0.54957855", "0.5484796", "0.54656494", "0.54615617", "0.5460596", "0.54546833", "0.5441...
0.73345226
0
Gives the full predicted matrix based on the low rank u and v.
def predict_mat(self): return self.u.dot(self.v.T)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_low_rank_matrix( self, u, s, v, rank ):\n u_approx = u[ :, :rank ]\n s_approx = s[ :rank ]\n sum_taken_percent = np.sum( s_approx ) / float( np.sum( s ) )\n s_approx = np.diag( np.array( s_approx ) )\n v_approx = v[ :rank, : ]\n return [ u_approx.dot( s_approx ...
[ "0.68731123", "0.6112549", "0.60515124", "0.60183614", "0.5982911", "0.5939187", "0.58090305", "0.57974684", "0.578775", "0.574525", "0.5728702", "0.5567461", "0.5479815", "0.54721326", "0.54661137", "0.5449834", "0.54436517", "0.541722", "0.54135686", "0.5375098", "0.5369013...
0.7002625
0
Updates the low rank structure of self.u and self.v based on the `mat` input. Performs singular value decomposition on the matrix and selects the last `self.rank` entries.
def update_params(self, mat): assert mat.shape == self.shape a, s, b = np.linalg.svd(mat, full_matrices=False) self.u = a[:, :self.rank]*s[:self.rank] self.v = b.T[:, :self.rank]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_optimal_low_rank_matrix( self, orig_similarity_matrix, orig_rank, u, s, v, singular_reduction ):\n '''rank_list = list()\n sum_singular_values = list()\n for rank in range( 0, orig_rank ):\n compute_result = self.compute_low_rank_matrix( u, s, v, rank + 1 )\n ran...
[ "0.6372859", "0.55725044", "0.55620676", "0.55460334", "0.5260916", "0.5249304", "0.51922536", "0.5169905", "0.51028615", "0.5082861", "0.5073029", "0.50590885", "0.5045953", "0.49488217", "0.49206302", "0.49198195", "0.49189126", "0.49091235", "0.4873962", "0.4863568", "0.48...
0.7536742
0
Test getting an analysis when it exists in the database.
def test_get_analysis_with_id(analysis_store: MockStore): # GIVEN a store with an analysis existing_analysis: Analysis = analysis_store.get_query(table=Analysis).first() # WHEN accessing it by ID analysis: Analysis = analysis_store.get_analysis_with_id(analysis_id=existing_analysis.id) # THEN it s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_analysis_with_id_when_missing(analysis_store: MockStore):\n # GIVEN an id that doesn't exist\n missing_analysis_id = 12312423534\n\n # WHEN accessing the analysis\n analysis: Analysis = analysis_store.get_analysis_with_id(analysis_id=missing_analysis_id)\n\n # THEN it should return None...
[ "0.67521673", "0.64993656", "0.6392804", "0.6276373", "0.62410223", "0.62198424", "0.61320305", "0.6044973", "0.60429484", "0.6037851", "0.60214347", "0.600699", "0.59700125", "0.5969135", "0.593259", "0.5906568", "0.5866727", "0.5863172", "0.5861047", "0.5857293", "0.584378"...
0.6659734
1
Test getting an analysis when it does not exist in the database.
def test_get_analysis_with_id_when_missing(analysis_store: MockStore): # GIVEN an id that doesn't exist missing_analysis_id = 12312423534 # WHEN accessing the analysis analysis: Analysis = analysis_store.get_analysis_with_id(analysis_id=missing_analysis_id) # THEN it should return None assert ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_no_one_in_db(self):\n q = self.generate_query('view_manager_report', ())\n res = self.execute_query(q)\n expected = []\n assert len(res) == 0, f'There is suppose to be an empty summary {res}'\n assert res == expected, f'The result is suppose to be empty {res}'", "def t...
[ "0.6867313", "0.6787145", "0.64357316", "0.6329981", "0.62323785", "0.6220911", "0.6134222", "0.6128569", "0.6122037", "0.60938495", "0.60938495", "0.6075478", "0.60506773", "0.6032781", "0.6021422", "0.6012929", "0.60125285", "0.60118175", "0.60108805", "0.6007062", "0.59906...
0.7349075
0
Test getting the number of failed jobs per category since a supplied date from the database.
def test_get_nr_jobs_with_status_per_category(job_store: MockStore, timestamp_yesterday: datetime): # GIVEN a database with jobs # WHEN querying for failed users failed_jobs: List[Dict[str, Union[str, int]]] = job_store.get_nr_jobs_with_status_per_category( since_when=timestamp_yesterday, status=Tr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_error_category(self):\n\n error = error_test_utils.create_error(category='DATA')\n job = job_test_utils.create_job(error=error)\n\n url = '/%s/jobs/?error_category=%s' % (self.api, error.category)\n response = self.client.generic('GET', url)\n self.assertEqual(response.s...
[ "0.5813953", "0.5470477", "0.5436561", "0.5431106", "0.5430519", "0.5358405", "0.5351436", "0.5340761", "0.5265007", "0.52533865", "0.52142894", "0.51785016", "0.512772", "0.50592387", "0.50564986", "0.5048593", "0.50406694", "0.5030915", "0.5024704", "0.5023085", "0.50163347...
0.7530706
0
Test getting a user from the database.
def test_get_user(user_store: MockStore, user_email: str): # GIVEN a database with a user # WHEN querying for a user user: User = user_store.get_user(email=user_email) # THEN it should be returned assert user.email == user_email
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testGetUser(self):\n UserAPI().create([(u'user', u'secret', u'User', u'user@example.com')])\n user = getUser(u'user')\n self.store.commit()\n with login(u'fluiddb', self.admin.objectID, self.transact) as session:\n result = yield self.facade.getUser(session, u'user')\n ...
[ "0.80467415", "0.8015131", "0.7970524", "0.7857167", "0.782778", "0.77688056", "0.77514106", "0.77355975", "0.7696272", "0.76695734", "0.76617557", "0.7623411", "0.7619199", "0.75815994", "0.75701547", "0.7553964", "0.750348", "0.7497086", "0.74873877", "0.7464809", "0.746417...
0.80435
1
Test getting an archived user from the database.
def test_get_user_including_archived(user_store: MockStore, archived_user_email: str): # GIVEN a database with an archived user # WHEN querying for a user user: User = user_store.get_user(email=archived_user_email, exclude_archived=False) # THEN it should be returned assert user.email == archived_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_user_including_archive_false(user_store: MockStore, archived_user_email: str):\n # GIVEN a database with an archived user\n\n # WHEN querying for a user\n user: User = user_store.get_user(email=archived_user_email, exclude_archived=True)\n\n # THEN no user should be returned\n assert no...
[ "0.7456595", "0.738311", "0.65067285", "0.6436026", "0.63516873", "0.62399125", "0.6210579", "0.62046766", "0.617632", "0.61279947", "0.61279947", "0.6096413", "0.60939574", "0.6072748", "0.5998641", "0.59969604", "0.5986697", "0.59809977", "0.59688866", "0.596384", "0.595570...
0.81311107
0
Test getting an archived user from the database.
def test_get_user_including_archive_false(user_store: MockStore, archived_user_email: str): # GIVEN a database with an archived user # WHEN querying for a user user: User = user_store.get_user(email=archived_user_email, exclude_archived=True) # THEN no user should be returned assert not user
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_user_including_archived(user_store: MockStore, archived_user_email: str):\n # GIVEN a database with an archived user\n\n # WHEN querying for a user\n user: User = user_store.get_user(email=archived_user_email, exclude_archived=False)\n\n # THEN it should be returned\n assert user.email ...
[ "0.81330764", "0.7385193", "0.65025973", "0.6442499", "0.63574994", "0.6246142", "0.62167716", "0.62109834", "0.61833704", "0.6133558", "0.6133558", "0.61013573", "0.6095947", "0.60781145", "0.6004548", "0.6003449", "0.59916866", "0.5984867", "0.5974582", "0.5968191", "0.5961...
0.7458577
1
Test getting a user with username and email which are archived.
def test_get_users_including_archived(user_store: MockStore, user_email: str, username: str): # GIVEN a database with a user and an archived user StoreHelpers.add_user( name=username, email="old.user@magnolia.com", store=user_store, is_archived=True ) # WHEN getting users users: List[User] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_user_including_archived(user_store: MockStore, archived_user_email: str):\n # GIVEN a database with an archived user\n\n # WHEN querying for a user\n user: User = user_store.get_user(email=archived_user_email, exclude_archived=False)\n\n # THEN it should be returned\n assert user.email ...
[ "0.81211317", "0.7514452", "0.64037925", "0.63772064", "0.6226215", "0.6220526", "0.6183159", "0.6143586", "0.610818", "0.6024082", "0.60225403", "0.60225403", "0.60071534", "0.59874976", "0.59364957", "0.5935404", "0.58854514", "0.5874671", "0.5873215", "0.5843584", "0.58432...
0.7878071
1
add to the running total grade given a certain kind of assignment and weight
def assignment(kind, grade, weight=1): global running_total global total_weight global total_grade if kind not in running_total: running_total[kind] = grade total_grade[kind] = 0 total_weight[kind] = 0 if weight > 1: grade *= weight total_grade[kind] += grade ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_weighted_total(self):\r\n self.weighted_setup()\r\n self.submit_question_answer('H1P1', {'2_1': 'Correct', '2_2': 'Correct'})\r\n self.submit_question_answer('FinalQuestion', {'2_1': 'Correct', '2_2': 'Correct'})\r\n self.check_grade_percent(1.0)", "def update_weight(self,ctr...
[ "0.67640436", "0.6405597", "0.6375525", "0.6192439", "0.61887383", "0.6149335", "0.61008453", "0.60683244", "0.6066493", "0.60514957", "0.6017797", "0.59676933", "0.5939823", "0.58858883", "0.5883962", "0.58807987", "0.5871791", "0.5829333", "0.5798484", "0.57823825", "0.5780...
0.81458527
0
Decode a 6digit hexadecimal color code. Return (R, G, B).
def decode_color_code(color): try: if len(color) != 6: raise ValueError color = int(color, 16) except ValueError: sys.exit("Invalid command line color argument.") return (color >> 16, (color >> 8) & 0xff, color & 0xff)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parseColor(c):\n if c in baseColors:\n return baseColors[c]\n if len(c) == 6:\n return tuple(map(lambda x: int(x, 16), (c[:2], c[2:4], c[4:])))\n if len(c) == 3:\n return tuple(map(lambda x: 16*int(x, 16), c))\n raise ValueError(\"Can't find color '{}'\".format(c))", "def col...
[ "0.70379555", "0.69850445", "0.68155867", "0.6667215", "0.6667215", "0.6579798", "0.65655094", "0.65628827", "0.6547301", "0.6505032", "0.65026057", "0.6496214", "0.64522505", "0.63568914", "0.6349273", "0.6349273", "0.6349273", "0.6349273", "0.6297138", "0.6291906", "0.62521...
0.79295737
0
Get the start address and size of CHR data in the file. Return (address, size).
def get_CHR_data_position(handle): # raw CHR data? fileSize = handle.seek(0, 2) if fileSize > 0 and fileSize % 256 == 0: return (0, fileSize) # iNES ROM file? try: iNESInfo = ineslib.parse_iNES_header(handle) except ineslib.iNESError as error: sys.exit( "The...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __get_file_chunk(self, buf=1000):\n data = self.file.read(buf)\n return data, len(data)", "def chars(count):\n\n global offset\n\n bytes=midifile[offset:offset+count]\n offset+=count\n return bytes", "def get_file_size(file_path):\n with open(file_path, 'rb') as infile:\n infi...
[ "0.59651583", "0.5834163", "0.57600224", "0.5742578", "0.5647145", "0.56113386", "0.5561132", "0.55449986", "0.5497243", "0.5456488", "0.54542714", "0.5425964", "0.5419218", "0.5419066", "0.5395858", "0.5369064", "0.5361087", "0.5349149", "0.5306322", "0.5299539", "0.52817094...
0.7074004
0
Create frequent candidate 1itemset C1 by scaning data set.
def create_C1(data_set): C1 = set() for t in data_set: for item in t: item_set = frozenset([item]) C1.add(item_set) return C1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_C1(data_set):\n C1 = set()\n for t in data_set:\n for item in t:\n item_set = frozenset([item])\n C1.add(item_set)\n return C1", "def fit(self, filePath):\n # Initialize some variables to hold the tmp result\n transListSet = self.getTransListSet(fil...
[ "0.6886297", "0.624703", "0.6201147", "0.5755", "0.56995976", "0.5535812", "0.5463", "0.5460324", "0.54472184", "0.5409043", "0.53956145", "0.5346798", "0.5327546", "0.53055555", "0.53005487", "0.52838606", "0.5277245", "0.5261409", "0.5238653", "0.52295136", "0.5222313", "...
0.6865995
1
Judge whether a frequent candidate kitemset satisfy Apriori property.
def is_apriori(Ck_item, Lksub1): for item in Ck_item: sub_Ck = Ck_item - frozenset([item]) if sub_Ck not in Lksub1: return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_apriori(Ck_item, Lksub1):\n for item in Ck_item:\n sub_Ck = Ck_item - frozenset([item])\n if sub_Ck not in Lksub1:\n return False\n return True", "def runApriori(data_iter, minSupport, minConfidence):\n itemSet, transactionList = getItemSetTransactionList(data_iter)\n...
[ "0.66959405", "0.60583735", "0.59899515", "0.5980171", "0.59638375", "0.5880278", "0.57959944", "0.57608527", "0.57316625", "0.5725965", "0.5725422", "0.5713746", "0.5713466", "0.57089907", "0.5668989", "0.563154", "0.5604906", "0.55982333", "0.5576207", "0.5572789", "0.55670...
0.666684
1
Create Ck, a set which contains all all frequent candidate kitemsets by Lk1's own connection operation.
def create_Ck(Lksub1, k): Ck = set() len_Lksub1 = len(Lksub1) list_Lksub1 = list(Lksub1) for i in range(len_Lksub1): for j in range(1, len_Lksub1): l1 = list(list_Lksub1[i]) l2 = list(list_Lksub1[j]) l1.sort() l2.sort() if l1[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_Ck(Lksub1, k):\n Ck = set()\n len_Lksub1 = len(Lksub1)\n Lksub = list(Lksub1)\n for i in range(len_Lksub1):\n for j in range(1, len_Lksub1):\n l1 = list(Lksub[i])\n l2 = list(Lksub[j])\n l1.sort()\n l2.sort()\n if l1[0:k-2] == l2[...
[ "0.7030224", "0.6693347", "0.6450786", "0.6290387", "0.6284536", "0.6245179", "0.6236539", "0.6200779", "0.6141162", "0.6107893", "0.60948", "0.59961575", "0.5984875", "0.5919703", "0.5880751", "0.5827621", "0.576909", "0.57687354", "0.5766544", "0.5685266", "0.5683019", "0...
0.70728934
0
adds windtunnel box to an ax
def draw_windtunnel_border(ax): x_min = 0 x_max = 1 z_min = 0 z_max = 0.254 y_min = -0.127 y_max = 0.127 draw_rectangular_prism(ax, x_min, x_max, y_min, y_max, z_min, z_max) plt.draw()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_box(self):\n self.scenes[self.current_scene].add_object(Box())\n self.redraw()", "def add_box(self, box):\n mz_from = box.from_mz\n mz_to = box.to_mz\n rt_from = box.from_rt\n rt_to = box.to_rt\n self.boxes_mz.addi(mz_from, mz_to, box)\n self.boxes_...
[ "0.58353895", "0.5790107", "0.57524234", "0.5593443", "0.5475752", "0.53979737", "0.53805476", "0.53432196", "0.5318134", "0.53155285", "0.52366716", "0.5194952", "0.51729375", "0.5148649", "0.51383233", "0.51253414", "0.5115568", "0.5114796", "0.5070012", "0.5055591", "0.504...
0.6089721
0
adds heaters to an ax
def draw_heaters(ax, windtunnel): draw_heater(ax, windtunnel.heater_l) draw_heater(ax, windtunnel.heater_r)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_heat_map(self, ax=None, block=True):\n plt.figure()\n ax = sns.heatmap(data=self.data, fmt=\"\", cmap='RdYlGn', linewidths=0.3, ax=ax)\n ax.invert_yaxis()\n ax.set(xlabel='Books index', ylabel='Books values over iterations', title='Heat map for the prediction result'\n ...
[ "0.6191286", "0.5851744", "0.5804792", "0.5803193", "0.5751369", "0.575062", "0.57083535", "0.56923664", "0.56552476", "0.5585687", "0.5582017", "0.5570664", "0.553861", "0.55253464", "0.5523711", "0.55133945", "0.54960084", "0.54917896", "0.5479611", "0.5449382", "0.5418402"...
0.65778947
0
draw a generic rectangular prism
def draw_rectangular_prism(ax, x_min, x_max, y_min, y_max, z_min, z_max): alpha = 1 back = Rectangle((y_min, z_min), y_max - y_min, z_max, alpha=alpha, fill=None, linestyle='dotted') ax.add_patch(back) art3d.pathpatch_2d_to_3d(back, z=x_min, zdir="x") front = Rectangle((y_min, z_min), y_max - y_min...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw(self):\n pt = self.getPoint() # Centre of prism\n\n # Form top,left,right corners\n top = Vector2d(pt.z, pt.y + self.height/2)\n d = self.height*math.tan(self.angle/2)\n left = Vector2d(pt.z - d , pt.y - self.height/2)\n right = Vector2d(pt.z + d, pt.y...
[ "0.72910595", "0.6515819", "0.6209327", "0.6186026", "0.6058665", "0.60284466", "0.5912263", "0.589943", "0.5896657", "0.5882874", "0.585008", "0.58448476", "0.5837638", "0.5797427", "0.5788786", "0.5786838", "0.5756717", "0.5756544", "0.57435954", "0.5728075", "0.57125056", ...
0.68564206
1
Plot a quiverplot of the gradient
def plot_plume_gradient(plume, ax, thresh, skipevery = 6): # TODO: plot inside windtunnel as in draw_bool_plume filtered = plume.data[plume.data.gradient_norm > thresh] if skipevery != 0: filtered = filtered[::skipevery] ax.quiver(filtered.x, filtered.y, filtered.z, filtered.gradient_x, filtered....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def quick_quiver():\n plt.quiver(x,y,u,v,sig2noise_ratio, scale=50,color='b')\n plt.gca().invert_yaxis()\n plt.gca().set_aspect(1)\n plt.plot(x.flat[xymask],y.flat[xymask],'rx')\n plt.colorbar(orientation='horizontal')", "def plot_vf(velocities):\n n = np.shape(velocities)[0]\n u = velocitie...
[ "0.65154076", "0.63556695", "0.61553794", "0.61197305", "0.6090479", "0.586303", "0.58170414", "0.56765515", "0.56476736", "0.5598726", "0.5560891", "0.5547584", "0.553222", "0.54735816", "0.54416955", "0.53720146", "0.5366105", "0.5361912", "0.53352004", "0.5322029", "0.5320...
0.6441448
1
Periodic correlation, implemented using np.correlate. x and y must be real sequences with the same length.
def periodic_corr_np(x, y): # # src: https://stackoverflow.com/questions/28284257/circular-cross-correlation-python # circular cross correlation python # # return np.correlate(x, np.hstack((y[1:], y)), mode='valid')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def periodic_corr(x, y):\r\n return np.fft.ifft(np.fft.fft(x) * np.fft.fft(y).conj()).real", "def xcorr(x, y, maxlag=None):\n xl = x.size\n yl = y.size\n if xl != yl:\n raise ValueError('x and y must be equal length')\n\n if maxlag is None:\n maxlag = xl - 1\n else:\n maxla...
[ "0.79519504", "0.75662684", "0.74097294", "0.73958045", "0.73598063", "0.7300638", "0.7269215", "0.7267762", "0.72383136", "0.72049016", "0.71835554", "0.7174526", "0.7106051", "0.70750237", "0.69332325", "0.69196165", "0.69098467", "0.68443376", "0.67585266", "0.67496026", "...
0.8327699
0
Handles the mouse being moved in the 'normal' state. Prints the data space position of the current mouse position.
def normal_mouse_move(self, event): plot = self.component if plot is not None: if isinstance(plot, BaseXYPlot): ndx = plot.map_index((event.x, event.y), index_only = True) x = plot.index.get_data()[ndx] y = plot.value.get_data()[ndx] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mouse_move_callback(self, event):\n # TODO drag and drop figuriek\n print(\"moving at \", event.x + self.offset_x, event.y + self.offset_y)", "def report_mouse_position(x_pos=0, y_pos=0):\n print('x-axis:', x_pos, ' Y-axis: ', y_pos, flush=True)", "def mousePositionRaw(self):", "def mous...
[ "0.6891763", "0.6877345", "0.68201053", "0.68201053", "0.6619768", "0.6596764", "0.6543408", "0.6506254", "0.63932467", "0.63913417", "0.6375399", "0.6339471", "0.6308581", "0.62776256", "0.6249573", "0.61815065", "0.61815065", "0.61744684", "0.61577696", "0.6157739", "0.6156...
0.74333996
0
Parse a date string and convert to a naive ``datetime`` object in UTC
def parse(date_string: str): # parse the date string date = dateutil.parser.parse(date_string) # convert to UTC if containing time-zone information # then drop the timezone information to prevent unsupported errors if date.tzinfo: date = date.astimezone(dateutil.tz.UTC).replace(tzinfo=None) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _parse_date(s):\n return parse(s).astimezone(pytz.utc)", "def parse_datetime(datestr):\r\n try:\r\n return dateutil.parser.parse(datestr).replace(tzinfo=utc)\r\n except ValueError:\r\n raise DashboardError(_(\"Unable to parse date: \") + datestr)", "def parse_datetime(date_string):\n...
[ "0.7907816", "0.78428483", "0.76955104", "0.7673007", "0.7471216", "0.74361444", "0.7354086", "0.73491085", "0.7290312", "0.7242", "0.7239528", "0.7228141", "0.7222079", "0.717494", "0.7138004", "0.7137841", "0.7119581", "0.7117855", "0.71016157", "0.70935977", "0.7070508", ...
0.8083489
0
Split a date string into units and epoch
def split_date_string(date_string: str): try: units,_,epoch = date_string.split(None, 2) except ValueError: raise ValueError(f'Invalid format: {date_string}') else: return (units.lower(), parse(epoch))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_date_string(date_string: str):\n # try parsing the original date string as a date\n try:\n epoch = parse(date_string)\n except ValueError:\n pass\n else:\n # return the epoch (as list)\n return (datetime_to_list(epoch), 0.0)\n # split the date string into units ...
[ "0.7257494", "0.7253272", "0.67156667", "0.64704216", "0.63837385", "0.6196135", "0.6182121", "0.60728586", "0.6071914", "0.60442466", "0.6017566", "0.60019803", "0.5955302", "0.588226", "0.58331114", "0.58295196", "0.5822171", "0.5812971", "0.58089995", "0.57947624", "0.5778...
0.78031945
0
Convert a ``datetime`` object into a list
def datetime_to_list(date): return [date.year, date.month, date.day, date.hour, date.minute, date.second]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_datetime_objs(list_of_dates):\n datetime_list = []\n for date in list_of_dates:\n date_obj = datetime.datetime.strptime(date, '%d.%m.%Y')\n datetime_list.append(date_obj)\n return datetime_list", "def deconstruct_datetime(self, date: datetime) -> List[int]:\n year, month...
[ "0.72302264", "0.708684", "0.70127237", "0.6490613", "0.6426555", "0.6377876", "0.6265655", "0.62604266", "0.62300515", "0.616861", "0.6105871", "0.6052892", "0.6040023", "0.6040023", "0.6040023", "0.6040023", "0.60229015", "0.60185957", "0.6013034", "0.5994853", "0.5991498",...
0.85056525
0
Convert a ``numpy`` ``datetime`` array to seconds since ``epoch``
def convert_datetime( date: float | np.ndarray, epoch: str | tuple | list | np.datetime64 = _unix_epoch ): # convert epoch to datetime variables if isinstance(epoch, (tuple, list)): epoch = np.datetime64(datetime.datetime(*epoch)) elif isinstance(epoch, str): epoch = np.d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ts_to_epoch_seconds(t) -> float:\n return t.astype(int) / 1e9", "def epoch2datetime(t):\n return datetime.fromtimestamp(t/1000.0)", "def seconds_since_epoch(date_time, epoch=None):\n return microseconds_since_epoch(date_time) / 10.0**6", "def epoch_seconds(date):\n td = date - epoch\n retu...
[ "0.7118472", "0.7046606", "0.6772909", "0.66768813", "0.66768813", "0.6676594", "0.6578405", "0.65100276", "0.6425068", "0.6245704", "0.6234241", "0.6234241", "0.6190503", "0.61882025", "0.6174044", "0.5989631", "0.5972627", "0.59568745", "0.59374034", "0.5933194", "0.5920487...
0.720014
0
Convert delta time from seconds since ``epoch1`` to time since ``epoch2``
def convert_delta_time( delta_time: np.ndarray, epoch1: str | tuple | list | np.datetime64 | None = None, epoch2: str | tuple | list | np.datetime64 | None = None, scale: float = 1.0 ): # convert epochs to datetime variables if isinstance(epoch1, (tuple, list)): epoch...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def epoch2time(time):\n\tvalue = datetime.datetime.fromtimestamp(time)\n\tNormal = value.strftime('%Y-%m-%d %H:%M:%S')\n\tprint(normal)\n\treturn normal", "def pcr_delta_time_ms(pcr_t1, pcr_t2, offset = 0):\n return float(pcr_t2-pcr_t1)/90000.0 + offset", "def to_deltatime(self,\n epoch: str | tu...
[ "0.6507025", "0.6423904", "0.6152986", "0.60294515", "0.5935391", "0.5886159", "0.58696276", "0.585755", "0.58195716", "0.58072734", "0.5757571", "0.5749442", "0.56640947", "0.5653533", "0.56484276", "0.56360996", "0.56360996", "0.5627376", "0.5626698", "0.55913216", "0.55352...
0.73310125
0
Calculates the sum of a polynomial function of time
def polynomial_sum(self, coefficients: list | np.ndarray, t: np.ndarray): # convert time to array if importing a single value t = np.atleast_1d(t) return np.sum([c * (t ** i) for i, c in enumerate(coefficients)], axis=0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def polynomial(a, x):\n\n sum = 0\n\n for i in range(len(a)):\n sum += a[i] * x**i\n return sum", "def evaluate_poly(poly: Sequence[float], x: float) -> float:\n return sum(c * (x**i) for i, c in enumerate(poly))", "def evaluate_poly(poly, x):\n exp = 0\n total = 0\n for coef in pol...
[ "0.69386065", "0.6748726", "0.65859747", "0.657982", "0.6418515", "0.63866585", "0.6333331", "0.6205636", "0.61954945", "0.61891437", "0.61560464", "0.61277664", "0.6109031", "0.60706145", "0.60396737", "0.6031695", "0.60197645", "0.6016289", "0.59671974", "0.5960084", "0.593...
0.7166109
0
Earth Rotation Angle (ERA) in degrees
def era(self): # earth rotation angle using Universal Time J = self.MJD - 51544.5 fraction = np.mod(J, self.turn) theta = np.mod(0.7790572732640 + 0.00273781191135448*J, self.turn) return self.turndeg*np.mod(theta + fraction, self.turn)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_attitude_angle(self):\n return np.arctan(np.pi * (1 - self.eccentricity_ratio ** 2) / (4 * self.eccentricity_ratio))", "def _altaz_rotation(self, jd):\n R_lon = rot_z(- self.longitude.radians - jd.gast * TAU / 24.0)\n return einsum('ij...,jk...,kl...->il...', self.R_lat, R_lon,...
[ "0.674512", "0.6602822", "0.65989155", "0.6557351", "0.64846647", "0.6468571", "0.64416575", "0.6428505", "0.64205354", "0.6386489", "0.63785654", "0.63539183", "0.63338894", "0.6282171", "0.6258052", "0.6255307", "0.62220407", "0.6206311", "0.6206153", "0.6204205", "0.618560...
0.83793527
0
Greenwich Hour Angle (GHA) in degrees
def gha(self): return np.mod(self.gmst*self.turndeg + self.turndeg*self.T*self.century + self.turndeg/2.0, self.turndeg)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hpa(self):\n return HPAngle(gon2hp(self.gon_angle))", "def get_local_hour_angle(self):\n LHA = self.Calculations.local_hour_angle(self.Longitude, self.right_ascension)\n self.LHA = LHA\n return LHA", "def getH(self):\n\t\thAngle = (math.atan2(self.y,self.x))/(2*math.pi)\n\t\tif ...
[ "0.6866496", "0.68414015", "0.67737657", "0.66491437", "0.6601375", "0.65256166", "0.640311", "0.63629305", "0.6301536", "0.6282773", "0.62634754", "0.62258744", "0.61544293", "0.6149261", "0.61482656", "0.60767734", "0.60743266", "0.6058337", "0.60410094", "0.60410094", "0.6...
0.75936776
0
Greenwich Mean Sidereal Time (GMST) in fractions of day
def gmst(self): GMST = np.array([24110.54841, 8640184.812866, 9.3104e-2, -6.2e-6]) # convert from seconds to fractions of day return np.mod(self.polynomial_sum(GMST, self.T)/self.day, self.turn)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc_GMST(self, date):\n jd = self.julian_date(date)\n T = (jd - 2451545.0)/36525.0\n gmstdeg = 280.46061837+(360.98564736629*(jd-2451545.0))+(0.000387933*T*T)-(T*T*T/38710000.0)\n gmst = ephem.degrees(gmstdeg*np.pi/180.0)\n return gmst", "def MJD2GMST(MJD):\n # GMST = 2...
[ "0.75275975", "0.7122444", "0.70665514", "0.6129707", "0.602409", "0.57152545", "0.566555", "0.55894446", "0.5582507", "0.55749035", "0.5572051", "0.5566701", "0.5546085", "0.55289936", "0.5466619", "0.5463478", "0.53989863", "0.53863674", "0.53379256", "0.5330827", "0.530122...
0.7240699
1
Dynamic Time (TT) as Julian Days
def tt(self): return self.MJD + self.tt_ut1 + 2400000.5
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_julian_date(cls, year, month, day, tp='miladi'):\n cal = Calverter()\n if tp == 'miladi':\n return cal.gregorian_to_jd(year, month, day)\n return cal.jalali_to_jd(year, month, day)", "def JulianDay(self):\n a = (14 - self._month) // 12\n y = self._year + 4800...
[ "0.65697944", "0.644693", "0.6362859", "0.635199", "0.63276625", "0.6300114", "0.6296536", "0.62951887", "0.6267511", "0.62593186", "0.62149376", "0.60694706", "0.6047973", "0.6033596", "0.6023847", "0.6016421", "0.60082954", "0.5991778", "0.59857446", "0.59478116", "0.594044...
0.64475
1
Counts the number of leap seconds between a given GPS time and UTC
def count_leap_seconds( GPS_Time: np.ndarray | float, truncate: bool = True ): # get the valid leap seconds leaps = get_leap_seconds(truncate=truncate) # number of leap seconds prior to GPS_Time n_leaps = np.zeros_like(GPS_Time,dtype=np.float64) for i,leap in enumerate(leaps): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def utctoweekseconds(utc, leapseconds=18):\n datetimeformat = \"%Y-%m-%d %H:%M:%S\"\n epoch = datetime.datetime.strptime(\"1980-01-06 00:00:00\", datetimeformat)\n tdiff = utc - epoch + datetime.timedelta(seconds=leapseconds)\n gpsweek = tdiff.days // 7\n gpsdays = tdiff.days - 7 * gpsweek\n gpss...
[ "0.65216655", "0.5833346", "0.57278067", "0.56890005", "0.56728673", "0.5596442", "0.5512546", "0.54993033", "0.53895235", "0.53806776", "0.5326265", "0.5325846", "0.52866095", "0.52589804", "0.51825666", "0.51720935", "0.5155383", "0.5153672", "0.511898", "0.51158345", "0.50...
0.714384
0
Gets a list of GPS times for when leap seconds occurred
def get_leap_seconds(truncate: bool = True): leap_secs = pyTMD.utilities.get_data_path(['data','leap-seconds.list']) # find line with file expiration as delta time with leap_secs.open(mode='r', encoding='utf8') as fid: secs, = [re.findall(r'\d+',i).pop() for i in fid.read().splitlines() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_leap_seconds(truncate: bool = True):\n leap_secs = icesat2_toolkit.utilities.get_data_path(['data','leap-seconds.list'])\n # find line with file expiration as delta time\n with leap_secs.open(mode='r', encoding='utf8') as fid:\n secs, = [re.findall(r'\\d+',i).pop() for i in fid.read().split...
[ "0.6766767", "0.63627315", "0.62256587", "0.6170549", "0.6149021", "0.6144678", "0.6141739", "0.6091225", "0.5989345", "0.59563494", "0.59563494", "0.59563494", "0.5944765", "0.5895257", "0.5883905", "0.5882115", "0.5879913", "0.5851446", "0.5811208", "0.57886726", "0.5767137...
0.66635275
1
Appends merged delta time file with values from latest BulletinA file
def append_delta_time(verbose: bool = False, mode: oct = 0o775): # append to merged file merged_file = pyTMD.utilities.get_data_path(['data','merged_deltat.data']) fid = merged_file.open(mode='a', encoding='utf8') logging.info(str(merged_file)) file_format = ' {0:4.0f} {1:2.0f} {2:2.0f} {3:7.4f}' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def merge_delta_time(\n username: str | None = None,\n password: str | None = None,\n verbose: bool = False,\n mode: oct = 0o775\n ):\n # retrieve history delta time files\n pull_deltat_file('historic_deltat.data',\n username=username, password=password,\n verbose...
[ "0.7121708", "0.6431268", "0.61592096", "0.60849315", "0.5973292", "0.5875328", "0.5809496", "0.5783088", "0.5770004", "0.5732891", "0.5731816", "0.57240766", "0.5704416", "0.5630994", "0.55934423", "0.55868226", "0.55500346", "0.5529764", "0.54655296", "0.5397741", "0.538316...
0.7002459
1
Attempt to connects to the IERS server and the CDDIS Earthdata server to download and merge BulletinA files Reads the IERS BulletinA files and calculates the daily delta times Servers and Mirrors
def merge_bulletin_a_files( username: str | None = None, password: str | None = None, verbose: bool = False, mode: oct = 0o775 ): # if complete: replace previous version of file LOCAL = pyTMD.utilities.get_data_path(['data','iers_deltat.data']) COPY = pyTMD.utilities.get_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n # the url for african daily and global daily\n african_dialy_url = \"https://data.chc.ucsb.edu/products/CHIRPS-2.0/africa_daily/tifs/p25/\"\n global_daily_url = \"https://data.chc.ucsb.edu/products/CHIRPS-2.0/global_daily/tifs/p25/\"\n\n\n each_year_list = GetRasterYears(url=african_dial...
[ "0.6011542", "0.5969287", "0.58123285", "0.5759039", "0.57266366", "0.57164097", "0.570907", "0.55923307", "0.5591778", "0.54952574", "0.5478434", "0.5473248", "0.5473054", "0.5455511", "0.5453085", "0.54324836", "0.5404204", "0.5393854", "0.5364291", "0.5353479", "0.5330724"...
0.6489078
0
Read a weekly IERS BulletinA file and calculate the delta times (TT UT1)
def read_iers_bulletin_a(fileID): # read contents from input file object file_contents = fileID.read().decode('utf8').splitlines() # parse header text to find time offsets # TT-TAI TT_TAI = 0 # TAI-UTC TAI_UTC = 0 # counts the number of lines in the header count = 0 HEADER = Fal...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def iers_delta_time(\n daily_file: str | pathlib.Path,\n timeout: int | None = 120,\n verbose: bool = False,\n mode: oct = 0o775\n ):\n # open output daily delta time file\n daily_file = pathlib.Path(daily_file).expanduser().absolute()\n fid = daily_file.open(mode='w', encod...
[ "0.5857724", "0.576605", "0.5764671", "0.56473726", "0.55392706", "0.5518946", "0.55164355", "0.5499296", "0.5458036", "0.54435945", "0.5402892", "0.53991205", "0.53944993", "0.53934467", "0.5388948", "0.53689307", "0.53484637", "0.53417957", "0.53347313", "0.5307582", "0.530...
0.7188088
0
Reads a MD5 checksum file and returns hashes as a dictionary.
def readmd5_sum_file(path): with open(path, "r") as f: hashes = {} while True: line = f.readline() if not line: break h, name = line.rstrip().split(' ', 1) hashes[name] = h return hashes
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_md5_lookup(filename):\n lookup = {}\n\n with open(filename) as f:\n for row in f:\n (md5, sha256) = row.strip().split(\",\")\n lookup[md5] = sha256\n\n return lookup", "def data_checksum(self, node):\n cmd = f\"find {RedpandaService.DATA_DIR} -type f -exec md5...
[ "0.6960468", "0.6812591", "0.6801497", "0.6614257", "0.6598387", "0.6572755", "0.65507716", "0.6542189", "0.6502235", "0.64885104", "0.6479202", "0.646785", "0.6450681", "0.6447718", "0.64337075", "0.640807", "0.6402168", "0.63971865", "0.6393921", "0.6386618", "0.63784134", ...
0.8217127
0