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
normalize t to be between 01.
def norm01(t): return (t - t.min()) / (t.max() - t.min())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _normalizeTime(self, t : float) -> float:\n return (t - self.t0)/self.tau", "def _normalize(self, offset=0):\n if self.t.min() < offset:\n self.t += offset - abs(self.t.min())", "def normalize(value):\n while value > 1:\n value = value / 10\n return value", "def norm...
[ "0.6530671", "0.59769094", "0.57698345", "0.5489688", "0.5429698", "0.5372486", "0.5306889", "0.5291918", "0.5268114", "0.52401674", "0.5235778", "0.51539874", "0.51165205", "0.50964445", "0.50537765", "0.5053182", "0.5041003", "0.50015706", "0.49889874", "0.49814796", "0.497...
0.68293846
0
get the value of property _OptionTag
def OptionTag(self): if self.force_auto_sync: self.get('OptionTag') return self._OptionTag
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_option(self, option):\n\t\treturn self.options[option]", "def get_option(self, key):\n return self.options[key]", "def get_option_value(self, key):\n\n # Check the key.\n self.__assert_option(key)\n\n # Get and return the value.\n return self.__opt[key]", "def opt...
[ "0.76643753", "0.7441164", "0.71848017", "0.711313", "0.7098959", "0.70791", "0.697323", "0.69299203", "0.69019735", "0.68937755", "0.6854118", "0.6839032", "0.6743931", "0.6694785", "0.6664501", "0.6649305", "0.6596949", "0.64979947", "0.64952564", "0.6486472", "0.6455251", ...
0.7824744
0
get the value of property _OptionType
def OptionType(self): if self.force_auto_sync: self.get('OptionType') return self._OptionType
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_optypelist (self):\n return self.optypelist", "def get(cls,name,as_type = str):\n inst = cls.inst()\n if name in inst.options:\n return as_type(inst.options[name])\n else:\n raise OptionsError(\"No option with key '%s'\" % name)", "def get_option(self, ...
[ "0.7139042", "0.7017426", "0.69786566", "0.691904", "0.68830115", "0.68398196", "0.6790515", "0.6761649", "0.6756889", "0.6726643", "0.6633732", "0.6561593", "0.65568894", "0.6548281", "0.6516134", "0.64978933", "0.6447984", "0.64468277", "0.6431651", "0.6425788", "0.64173937...
0.7673644
0
get the value of property _EnableOptionValueList
def EnableOptionValueList(self): if self.force_auto_sync: self.get('EnableOptionValueList') return self._EnableOptionValueList
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_enable(self):\n return self.__enable", "def _get_enable(self):\n return self.__enable", "def get_options(self):\r\n return self._option_values", "def opt_in(self) -> List[str]:\n return self.raw_config.get(\"opt_in\", [])", "def enabled(self):\n return self._get('enabled')",...
[ "0.66386247", "0.66386247", "0.6318724", "0.6297604", "0.6227937", "0.6175078", "0.6048764", "0.59725267", "0.5880507", "0.5856401", "0.5833881", "0.58057815", "0.57837236", "0.5757622", "0.5733467", "0.5733467", "0.5733467", "0.5733467", "0.5733467", "0.5733467", "0.5733467"...
0.7976309
0
get the value of property _OptionValue
def OptionValue(self): if self.force_auto_sync: self.get('OptionValue') return self._OptionValue
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_value(self):\n return self._get_value(self.optionType, self.value, self.defaultValue)", "def opt_value(self):\n return self._opt_value", "def get_option_value(self, key):\n\n # Check the key.\n self.__assert_option(key)\n\n # Get and return the value.\n retur...
[ "0.8465208", "0.8307987", "0.79227275", "0.7682315", "0.76176697", "0.731295", "0.73093337", "0.72914714", "0.7086719", "0.7070561", "0.7053907", "0.69744587", "0.69639415", "0.69593424", "0.69489616", "0.694318", "0.694318", "0.694318", "0.6938944", "0.6936434", "0.6917253",...
0.83802
1
Performs a Binary Tree ORAM access memory address data to write (if None, previous data is preserved) data element matching
def query(self, addr, write_data=None): assert addr in range(self.capacity), "You're trying to read uninitialized memory !" assert addr in self.pos leaf_id = self.pos[addr] path = BinaryTree.path_to_leaf(leaf_id) res_data = None # <To be done by students> # walk t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def binary_search_tree_run():\n\n # no need for Tree object as the Tree itself is a concept; its made of connected nodes\n # nodes are the object; connections are self contained\n\n def binary_insert(root, node):\n if root is None:\n root = node\n else:\n if root.data >...
[ "0.5556747", "0.5393983", "0.53901476", "0.5385526", "0.51962507", "0.51683754", "0.51464057", "0.5080468", "0.50269496", "0.50267226", "0.50198025", "0.4908567", "0.4891974", "0.48763973", "0.48729366", "0.486247", "0.48537815", "0.48453426", "0.48417", "0.48306128", "0.4828...
0.5845753
0
save the Genetic Algorithm into a json
def save(self, path): individual = self.population.fittest_individual() order = [int(l) for l in individual.label_order] fitness = individual.fitness data = {'name': self.ds.name, 'num_labels': len(order), 'order': order, 'fitness': fitness...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_training(self):\n\n filename = str(hashlib.sha1(str(self.training_data).encode(\"utf-8\"))\n .hexdigest())\n path = \"./training/\" + filename + \".json\"\n\n data = {\n \"states\": self.states,\n \"transitions\": self.transitions,\n ...
[ "0.6580137", "0.632811", "0.6317854", "0.628328", "0.6278871", "0.62771904", "0.6252093", "0.62384933", "0.62343657", "0.6216233", "0.62082094", "0.6207485", "0.6179871", "0.6168719", "0.610157", "0.60899913", "0.60852903", "0.607742", "0.6063663", "0.6052514", "0.60479724", ...
0.7321865
0
Sends message to an active slack contact
def send_message(contact, message): try: print('5 seconds to navigate to slack app..') time.sleep(5) # Use JumpTo slack feature pyautogui.hotkey('command', 'k') time.sleep(1) # Enter contact name in search box, click enter pyautogui.typewrite(contact) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_slack(self, message):\n self.slack_client.api_call('chat.postMessage', channel=self.slack_channel, text=message, username=self.username, icon_emoji=self.slack_icon_emoji)\n print(\"Slack Notification sent\")", "def send_message(channel, message):\n slack_client = get_client()\n slack...
[ "0.7226719", "0.6917408", "0.67710316", "0.67614216", "0.6653717", "0.6648352", "0.6514535", "0.6485787", "0.642985", "0.64066726", "0.63881713", "0.6384492", "0.6381657", "0.63803583", "0.63524926", "0.6344655", "0.63304365", "0.6314276", "0.6289281", "0.62768304", "0.625049...
0.7876777
0
Retrieve a Future result from cache.
def get_result(uid): cache = caches[settings.FUTURES_CACHE_BACKEND] result = cache.get('futures:%s' % uid) if result is None: return # Clean this up even though we set a TTL. cache.delete('futures:%s' % uid) # TODO: how do we want to report/represent progress? One idea is to use a # ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_cache(self, key):\n return self.r.get(key)", "def get(self, key):\n # Initialize key variables\n result = self.cache.get(key)\n\n # Return\n return result", "def get(key):\n return Cache.cache_connector.get(key)", "def get_cache(self, key, silent=False):\n ...
[ "0.68724537", "0.6715902", "0.66135794", "0.6476808", "0.6433322", "0.6403093", "0.63915306", "0.633906", "0.63029224", "0.6285533", "0.6242095", "0.6237832", "0.6213704", "0.62010425", "0.6196196", "0.61822116", "0.61822116", "0.6163482", "0.6147964", "0.6147964", "0.6136778...
0.7234735
0
Convert blob into object.
def deserialize(self, blob): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deserialize(self, blob):\n return json.loads(blob)", "def deserialize(self, blob):\n return dill.loads(blob.encode('latin-1'))", "def __init__(self, blob=None):\n if blob is None:\n self.versionCode = '0'\n self.data = {}\n else:\n self.versionCo...
[ "0.7757806", "0.7556387", "0.7098431", "0.67379546", "0.66704726", "0.6652905", "0.650781", "0.64429957", "0.6378272", "0.6206061", "0.61997306", "0.61983216", "0.61241275", "0.599821", "0.5995584", "0.59458315", "0.5911514", "0.58972883", "0.58916146", "0.5889428", "0.586984...
0.8233422
0
Convert blob into object.
def deserialize(self, blob): return json.loads(blob)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deserialize(self, blob):\n pass", "def deserialize(self, blob):\n return dill.loads(blob.encode('latin-1'))", "def __init__(self, blob=None):\n if blob is None:\n self.versionCode = '0'\n self.data = {}\n else:\n self.versionCode = blob[0]\n ...
[ "0.8233422", "0.7556387", "0.7098431", "0.67379546", "0.66704726", "0.6652905", "0.650781", "0.64429957", "0.6378272", "0.6206061", "0.61997306", "0.61983216", "0.61241275", "0.599821", "0.5995584", "0.59458315", "0.5911514", "0.58972883", "0.58916146", "0.5889428", "0.586984...
0.7757806
1
Used by task runner to execute a Future. Manages FutureStat.
def execute(message): future = FUTURES_REGISTRY.get(message['name']) args = future.serializer.deserialize(message['args']) kwargs = future.serializer.deserialize(message['kwargs']) stat, _ = FutureStat.objects.get_or_create(name=future.name) stat.update(last_seen=timezone.now(),...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _future_work_():\n pass", "def handle_done(future):\n results[in_progress[future]] = future.result()\n del in_progress[future]", "def set_future(self, future):\r\n self._future = future", "async def _execute(self):", "def future(self, cancel):", "async def execute(self):", "...
[ "0.6888968", "0.6304254", "0.61763597", "0.6132656", "0.60283023", "0.5995837", "0.5947317", "0.58919317", "0.58394545", "0.58260125", "0.5825181", "0.5780844", "0.57695895", "0.57461673", "0.57250774", "0.5697026", "0.5691396", "0.5676503", "0.5648787", "0.5644823", "0.56448...
0.6529468
1
Computes the ClenshawCurtis quadrature using a fast FFT method. For details, see Fast Construction of the Fejer and ClenshawCurtis Quadrature Rules Jorg Waldvogel, 2005
def _clenshaw_curtis_weights(n): from scipy.fftpack import ifft N = np.arange(start=1, stop=n, step=2)[:, None] l = N.size m = n - l v0 = np.vstack([2. / N / (N-2), 1. / N[-1]] + [0] * m) v2 = -v0[:-1] - v0[:0:-1] g0 = -np.ones((n, 1)) g0[l] += n g0[m] += n g = g0 / (n ** 2 - ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def qft(self) -> None:\n random.seed(self.seed)\n self.__qft_input_state(self.circ_size)\n\n for i in range(self.circ_size):\n for j in range(i):\n self.cu1(math.pi / float(2 ** (i - j)), i, j)\n self.h(i)\n\n if self.meas: self.measure(self.qr, ...
[ "0.6262922", "0.6113048", "0.60953236", "0.5943964", "0.58702064", "0.5816622", "0.5752535", "0.5652025", "0.5631552", "0.55971867", "0.55886996", "0.55884075", "0.5466261", "0.54336625", "0.5424884", "0.53199375", "0.53148896", "0.53026307", "0.5300972", "0.5299915", "0.5284...
0.62822247
0
Ensure we get a proper response if no users remain in any retreats' wait_queue.
def test_notify_reached_end_of_wait_queue(self): # self.client.force_authenticate(user=self.admin) notification_count = WaitQueueNotification.objects.all().count() self.retreat.next_user_notified = 2 self.retreat.save() response = self.client.get( '/'.join([ ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_comm_reply(self):\n if len(self._pending_comms) == 0:\n return\n for comm in self._pending_comms.values():\n self._notify_comm_ready(comm)\n self.kernel.io_loop.call_later(1, self._check_comm_reply)", "def check_result(self):\n logger.info(\"Wait for r...
[ "0.61130875", "0.6039304", "0.59244114", "0.5913899", "0.588208", "0.58781064", "0.58417994", "0.58366", "0.57811236", "0.5774191", "0.57586026", "0.57327926", "0.5695353", "0.56841356", "0.56737846", "0.56732434", "0.56460106", "0.5636048", "0.5623682", "0.56083", "0.560197"...
0.65317005
0
Ensure we get a proper response if no reserved seats remain in any retreat.
def test_notify_no_reserved_seats(self): # self.client.force_authenticate(user=self.admin) self.retreat.reserved_seats = 0 self.retreat.save() response = self.client.get( '/'.join([ reverse('retreat:waitqueuenotification-list'), 'notify', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reserve_seat(self):\n try:\n # start a new transaction\n self.cnx.start_transaction()\n cur = self.cnx.cursor()\n\n # iterate through the rows of the result until\n # we find a seat that is open\n cur.execute(\"select seat, status from Fl...
[ "0.6454577", "0.6332415", "0.6033399", "0.5853223", "0.5820779", "0.5733287", "0.5720805", "0.56971556", "0.56907845", "0.56664836", "0.56573904", "0.5638787", "0.56153524", "0.5615351", "0.56049556", "0.5570438", "0.5567189", "0.55327773", "0.54075104", "0.5362599", "0.53588...
0.77503073
0
Ensure we get a proper response if the last notification is not older than 24h.
def test_notify_delay_not_elapsed(self): # self.client.force_authenticate(user=self.admin) self.wait_queue_notif = WaitQueueNotification.objects.create( user=self.user2, retreat=self.retreat, ) response = self.client.get( '/'.join([ r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_refill_response(self, sender, message, response):\n\t\tnow = datetime.datetime.now()\n\t\tmessage.datetime_responded = now\n\t\tmessage.save()\n\n\t\t# Switch on type of response\n\t\tif self.is_yes(response):\n\t\t\t# TODO(mgaba): Implement questions about weekly, monthly prescriptions. What's the rig...
[ "0.58912146", "0.5732701", "0.5623499", "0.556746", "0.55264175", "0.5491496", "0.5483685", "0.54583955", "0.54444766", "0.54045844", "0.54008085", "0.53932834", "0.5388202", "0.53661597", "0.5344242", "0.53286713", "0.53259075", "0.5318163", "0.52978617", "0.5292775", "0.528...
0.66393316
0
Returns the AWS object associated with a given option. The heuristics used are a bit lame. If the option name contains the word 'bucket' it is assumed to be an S3 bucket, if the name contains the word 'queue' it is assumed to be an SQS queue and if it contains the word 'domain' it is assumed to be a SimpleDB domain. If...
def get_obj(self, name): val = self.get(name) if not val: return None if name.find('queue') >= 0: obj = boto.lookup('sqs', val) if obj: obj.set_message_class(ServiceMessage) elif name.find('bucket') >= 0: obj = boto.lookup('...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_obj(self, name):\r\n val = self.get(name)\r\n if not val:\r\n return None\r\n if name.find('queue') >= 0:\r\n obj = boto.lookup('sqs', val)\r\n if obj:\r\n obj.set_message_class(ServiceMessage)\r\n elif name.find('bucket') >= 0:\r\...
[ "0.58912253", "0.58486414", "0.5757762", "0.5574576", "0.55492437", "0.55456036", "0.5534566", "0.54886997", "0.5484687", "0.5473932", "0.544958", "0.54217565", "0.5409297", "0.5395414", "0.53802234", "0.5373362", "0.5373362", "0.5337203", "0.5336473", "0.53285027", "0.532651...
0.589309
0
Creates jobspec for a task running under docker.
def create_docker_jobspec( name, dockerfile_dir, shell_command, environ={}, flake_retries=0, timeout_retries=0, copy_rel_path=None, timeout_seconds=30 * 60, ): environ = environ.copy() # the entire repo will be cloned if copy_rel_path is not set. if copy_rel_path: env...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_docker_jobspec(name, dockerfile_dir, shell_command, environ={},\n flake_retries=0, timeout_retries=0):\n environ = environ.copy()\n environ['RUN_COMMAND'] = shell_command\n\n docker_args=[]\n for k,v in environ.items():\n docker_args += ['-e', '%s=%s' % (k, v)]\n docker_env = {...
[ "0.7523468", "0.6776027", "0.6466281", "0.6186161", "0.6124764", "0.5934508", "0.58495784", "0.58449864", "0.5842895", "0.5810701", "0.5638853", "0.5637721", "0.56291455", "0.56092364", "0.5601901", "0.55982375", "0.55835104", "0.55802494", "0.55542225", "0.55525804", "0.5514...
0.72997814
1
Test converted qobj from PulseInstruction.
def test_drive_instruction(self): converter = InstructionToQobjConverter(PulseQobjInstruction, meas_level=2) command = SamplePulse(np.arange(0, 0.01), name='linear') instruction = command(self.device.q[0].drive) valid_qobj = PulseQobjInstruction( name='linear', c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_snapshot(self):\n cmd = Snapshot(name='label', snap_type='type')\n instruction = cmd << 10\n\n qobj = PulseQobjInstruction(name='snapshot', t0=10, label='label', type='type')\n converted_instruction = self.converter(qobj)\n\n self.assertEqual(converted_instruction.timesl...
[ "0.689976", "0.675845", "0.6518244", "0.63733286", "0.6341804", "0.631909", "0.627284", "0.6198067", "0.5946589", "0.57238764", "0.5561012", "0.5518498", "0.546876", "0.5455286", "0.5369873", "0.52833056", "0.51889277", "0.5157639", "0.5121232", "0.5084824", "0.5047927", "0...
0.6900312
0
Test converted qobj from FrameChangeInstruction.
def test_frame_change(self): converter = InstructionToQobjConverter(PulseQobjInstruction, meas_level=2) command = FrameChange(phase=0.1) instruction = command(self.device.q[0].drive) valid_qobj = PulseQobjInstruction( name='fc', ch='d0', t0=0, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_frame_change(self):\n cmd = FrameChange(phase=0.1)\n instruction = cmd(MeasureChannel(0))\n\n qobj = PulseQobjInstruction(name='fc', ch='m0', t0=0, phase=0.1)\n converted_instruction = self.converter(qobj)\n\n self.assertEqual(converted_instruction.timeslots, instruction...
[ "0.75813246", "0.63785017", "0.62059313", "0.6086637", "0.52776647", "0.51503825", "0.51384866", "0.50624365", "0.5033832", "0.5007927", "0.5002481", "0.49632302", "0.49567473", "0.49187988", "0.49148935", "0.48695683", "0.48613715", "0.47937822", "0.47854188", "0.47737223", ...
0.79752105
0
Test converted qobj from PersistentValueInstruction.
def test_persistent_value(self): converter = InstructionToQobjConverter(PulseQobjInstruction, meas_level=2) command = PersistentValue(value=0.1j) instruction = command(self.device.q[0].drive) valid_qobj = PulseQobjInstruction( name='pv', ch='d0', t0=0...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_persistent_value(self):\n cmd = PersistentValue(value=0.1j)\n instruction = cmd(ControlChannel(1))\n\n qobj = PulseQobjInstruction(name='pv', ch='u1', t0=0, val=0.1j)\n converted_instruction = self.converter(qobj)\n\n self.assertEqual(converted_instruction.timeslots, ins...
[ "0.7329873", "0.6444023", "0.5765868", "0.5738885", "0.56149787", "0.55620295", "0.55620295", "0.5548717", "0.5453347", "0.54344076", "0.5378047", "0.53298366", "0.53298366", "0.5258919", "0.5250404", "0.5219531", "0.52160466", "0.51942724", "0.51908135", "0.51711404", "0.515...
0.75137514
0
Test converted qobj from AcquireInstruction.
def test_acquire(self): converter = InstructionToQobjConverter(PulseQobjInstruction, meas_level=2) command = Acquire(duration=10) instruction = command(self.device.q, self.device.mem, self.device.c) valid_qobj = PulseQobjInstruction( name='acquire', t0=0, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_acquire(self):\n cmd = Acquire(10, Discriminator(name='test_disc', params={'test_params': 1.0}),\n Kernel(name='test_kern', params={'test_params': 'test'}))\n instruction = cmd(self.device.q, self.device.mem, self.device.c)\n\n qobj = PulseQobjInstruction(name='ac...
[ "0.6729992", "0.5732453", "0.561871", "0.5242867", "0.50789654", "0.4899668", "0.48603976", "0.4796922", "0.47758222", "0.4729228", "0.47176737", "0.46876898", "0.46627936", "0.4658221", "0.46457574", "0.46310484", "0.46070987", "0.45877326", "0.45692676", "0.45482612", "0.45...
0.719742
0
Test converted qobj from SnapShot.
def test_snapshot(self): converter = InstructionToQobjConverter(PulseQobjInstruction, meas_level=2) instruction = Snapshot(name='label', snap_type='type') valid_qobj = PulseQobjInstruction( name='snapshot', t0=0, label='label', type='type' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_snapshot(self):\n cmd = Snapshot(name='label', snap_type='type')\n instruction = cmd << 10\n\n qobj = PulseQobjInstruction(name='snapshot', t0=10, label='label', type='type')\n converted_instruction = self.converter(qobj)\n\n self.assertEqual(converted_instruction.timesl...
[ "0.6856363", "0.6134061", "0.5808499", "0.5700766", "0.51935315", "0.5171494", "0.51603234", "0.50645435", "0.5061707", "0.50531983", "0.5037737", "0.50366294", "0.4993365", "0.49440852", "0.4933204", "0.48999828", "0.4890323", "0.48891574", "0.48797712", "0.48390538", "0.483...
0.72039396
0
Test converted qobj from FrameChangeInstruction.
def test_frame_change(self): cmd = FrameChange(phase=0.1) instruction = cmd(MeasureChannel(0)) qobj = PulseQobjInstruction(name='fc', ch='m0', t0=0, phase=0.1) converted_instruction = self.converter(qobj) self.assertEqual(converted_instruction.timeslots, instruction.timeslots) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_frame_change(self):\n converter = InstructionToQobjConverter(PulseQobjInstruction, meas_level=2)\n command = FrameChange(phase=0.1)\n instruction = command(self.device.q[0].drive)\n\n valid_qobj = PulseQobjInstruction(\n name='fc',\n ch='d0',\n ...
[ "0.79752105", "0.63785017", "0.62059313", "0.6086637", "0.52776647", "0.51503825", "0.51384866", "0.50624365", "0.5033832", "0.5007927", "0.5002481", "0.49632302", "0.49567473", "0.49187988", "0.49148935", "0.48695683", "0.48613715", "0.47937822", "0.47854188", "0.47737223", ...
0.75813246
1
Test converted qobj from PersistentValueInstruction.
def test_persistent_value(self): cmd = PersistentValue(value=0.1j) instruction = cmd(ControlChannel(1)) qobj = PulseQobjInstruction(name='pv', ch='u1', t0=0, val=0.1j) converted_instruction = self.converter(qobj) self.assertEqual(converted_instruction.timeslots, instruction.tim...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_persistent_value(self):\n converter = InstructionToQobjConverter(PulseQobjInstruction, meas_level=2)\n command = PersistentValue(value=0.1j)\n instruction = command(self.device.q[0].drive)\n\n valid_qobj = PulseQobjInstruction(\n name='pv',\n ch='d0',\n ...
[ "0.7511518", "0.6443372", "0.57649875", "0.5739482", "0.56151587", "0.55642205", "0.55642205", "0.55494356", "0.5455996", "0.54355264", "0.5379217", "0.5332844", "0.5332844", "0.525935", "0.5251542", "0.5220238", "0.52167314", "0.51949877", "0.5192597", "0.5171715", "0.515778...
0.7328867
1
Test converted qobj from AcquireInstruction.
def test_acquire(self): cmd = Acquire(10, Discriminator(name='test_disc', params={'test_params': 1.0}), Kernel(name='test_kern', params={'test_params': 'test'})) instruction = cmd(self.device.q, self.device.mem, self.device.c) qobj = PulseQobjInstruction(name='acquire', t0...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_acquire(self):\n converter = InstructionToQobjConverter(PulseQobjInstruction, meas_level=2)\n command = Acquire(duration=10)\n instruction = command(self.device.q, self.device.mem, self.device.c)\n\n valid_qobj = PulseQobjInstruction(\n name='acquire',\n t...
[ "0.71983975", "0.57317847", "0.56178063", "0.52443725", "0.5079145", "0.48989752", "0.4860109", "0.4795884", "0.4774837", "0.47271016", "0.4718607", "0.4686652", "0.46627027", "0.46581757", "0.46452436", "0.4631556", "0.460887", "0.45873195", "0.45695648", "0.45465833", "0.45...
0.67308086
1
Test converted qobj from SnapShot.
def test_snapshot(self): cmd = Snapshot(name='label', snap_type='type') instruction = cmd << 10 qobj = PulseQobjInstruction(name='snapshot', t0=10, label='label', type='type') converted_instruction = self.converter(qobj) self.assertEqual(converted_instruction.timeslots, instruc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_snapshot(self):\n converter = InstructionToQobjConverter(PulseQobjInstruction, meas_level=2)\n instruction = Snapshot(name='label', snap_type='type')\n\n valid_qobj = PulseQobjInstruction(\n name='snapshot',\n t0=0,\n label='label',\n type='...
[ "0.72041285", "0.6133407", "0.5807326", "0.57031536", "0.5194901", "0.51717246", "0.5161391", "0.5065212", "0.5058851", "0.5055525", "0.5037107", "0.5035244", "0.49951681", "0.4944442", "0.49327865", "0.48997965", "0.48918876", "0.48891953", "0.48790804", "0.483845", "0.48361...
0.6856922
1
Test math expression sanitization.
def test_expression_sanitizer(self): self.assertFalse(_is_math_expr_safe('INSERT INTO students VALUES (?,?)')) self.assertFalse(_is_math_expr_safe('import math')) self.assertFalse(_is_math_expr_safe('complex')) self.assertFalse(_is_math_expr_safe('__import__("os").system("clear")')) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluator_side_effect(_, __, math_string):\r\n if math_string != '4':\r\n raise err", "def math_eval(value):\n \n # Allowed: decimals, arithmetic operators, scientific notation, whitespace, parentheses\n # Prevents expressions from polluting workspace\n t...
[ "0.7239947", "0.6887543", "0.6649022", "0.6410172", "0.63416415", "0.6220159", "0.6193132", "0.61664945", "0.6147086", "0.6126412", "0.60705733", "0.6023587", "0.59995294", "0.59831727", "0.5960313", "0.59534276", "0.59390754", "0.59285533", "0.5915914", "0.5915914", "0.59155...
0.82474905
0
Checks if the variables of the given object matched the type hints of init.
def validate_object_init_type_hint(obj: object, log_metadata_validation_failures: bool = True ) -> None: if not obj or not type(obj).__init__: return type_hint_dict = get_type_hints(type(obj).__init__) if not isinstance(type_hint_dict, dict)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_typevar(self) -> PossibleResult[T]:\n if _is_typevar(self.constructor): # type: ignore\n return Deserialize(\n obj=self.obj,\n constructor=(\n Union[self.constructor.__constraints__] # type: ignore\n if self.construc...
[ "0.66489416", "0.65589833", "0.63217974", "0.6215367", "0.59062654", "0.58377224", "0.5765429", "0.57636535", "0.5748772", "0.57119286", "0.5708683", "0.5702044", "0.5679074", "0.5615548", "0.5599792", "0.5585564", "0.55353487", "0.55098975", "0.5475249", "0.54732186", "0.545...
0.7588239
0
Validates if the given variable is a member of the given listtype object.
def validate_is_in(var: Any, var_name: str, list_type: Any, class_name: Optional[str] = None, log_metadata_validation_failures: bool = True) -> None: if var is None: return sorted_list_type = sorted(map(str, list_type)) if log_metadat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_valid(var, var_type, list_type=None):\n if not isinstance(var, var_type):\n raise AttributeError(f\"The given variable is not a {var_type}\")\n\n if var_type is list and list_type is not None:\n for element in var:\n _ = is_valid(element, list_type)\n\n return var", "def ...
[ "0.73846835", "0.65005076", "0.62683696", "0.62512094", "0.62082356", "0.61889094", "0.61249405", "0.60875076", "0.6024989", "0.59084857", "0.58963716", "0.5773816", "0.57135314", "0.5712079", "0.57031703", "0.56916565", "0.5684915", "0.56648713", "0.56605685", "0.5659977", "...
0.72369426
1
Compare the vocabulary of the lists with that of the training file.
def compare_vocab(list_vocab, train_vocab_file): train_vocab = set() with open(train_vocab_file, 'r', encoding='utf8') as fr: for line in fr: word, _ = line.split() train_vocab.add(word) print('List: {:,d}\nTrain: {:,d}'.format(len(list_vocab), len(train_vocab))) print(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train(self, testing = None):\n IFileList = []\n negWords = []\n posWords = []\n\n if not testing:\n for fFileObj in os.walk(\".\"):\n IFileList = fFileObj[2]\n print(IFileList)\n for file in IFileList[2:]:\n ...
[ "0.686627", "0.6602558", "0.6504168", "0.64598864", "0.6444675", "0.63868237", "0.63412094", "0.6259422", "0.6189803", "0.6178053", "0.6088677", "0.60641116", "0.6035738", "0.6029913", "0.59951013", "0.598567", "0.5949559", "0.5945253", "0.59170216", "0.5879834", "0.5866116",...
0.84489757
0
Devuelve la variable binaria convertida en entero.
def entero(self): return int("".join(self.binario), 2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def makeBinary(self):\r\n\t\tls = 5.12 #limite superior\r\n\t\tli = -5.12 #limite inferior\r\n\t\tt = 14 # total de binarios\r\n\t\t\r\n\t\tcadena_bits = \"\"\r\n\t\tfor i in self.values:\r\n\t\t\tentero = (int) ( ( ( i - li ) * ( 2 ** t ) ) / ( ls - li ) )\r\n\t\t\t#print entero\r\n\t\t\tcadena_bits += \"{0:b}\"....
[ "0.7097699", "0.64976174", "0.615099", "0.6104671", "0.60751104", "0.6028227", "0.594472", "0.59356296", "0.58741194", "0.58704334", "0.5867039", "0.5855991", "0.583143", "0.58180094", "0.5814162", "0.5785546", "0.5781619", "0.57359207", "0.57267827", "0.5706305", "0.56892043...
0.74473006
0
Adjust the DNS port and patch the UDP checksum within the given Ethernet frame
def patch(dns_frame: bytearray, pseudo_hdr: bytes, dport: int): # set destination port dns_frame[36] = (dport >> 8) & 0xFF dns_frame[37] = dport & 0xFF # reset checksum dns_frame[40] = 0x00 dns_frame[41] = 0x00 # calc new checksum ck = checksum(pseudo_hdr + dns_frame[34:]) if ck =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def adjust_checksum(self) -> None:\n self._csum = 0\n # TODO improve that (it's not really efficient)\n self._csum = socket.htons(ip_checksum(self.encode()[:20]))", "def tcp_fix_checksum(pkt: dpkt.ethernet.Ethernet) -> dpkt.ethernet.Ethernet:\n if isinstance(pkt, dpkt.ethernet.Ethernet):\...
[ "0.66806954", "0.6518221", "0.6231522", "0.6083158", "0.59640855", "0.5728047", "0.56512606", "0.5578806", "0.5443521", "0.5396677", "0.5391286", "0.5385165", "0.53682417", "0.53647906", "0.5355583", "0.53486603", "0.5348332", "0.53088486", "0.53042555", "0.5290809", "0.52868...
0.7363656
0
Returns a function that converts sequences to their DFT representations.
def get_dft_converter(**kwargs): return lambda sequence: fftpack.rfft(sequence)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def DFTscargle(times, signal,f0,fn,df):\n f0 = 0.\n #fn *= 2*np.pi\n #df *= 2*np.pi\n #-- initialize\n nfreq = int((fn-f0)/(df))\n print \"Nfreq=\",nfreq\n tzero = times[0]\n si = 1.\n lfreq = 2*nfreq+1\n mm = 2*nfreq\n ftrx = np.zeros(mm)\n ftix = np.zeros(mm)\n om = np.zero...
[ "0.6115121", "0.6007553", "0.5986863", "0.5864586", "0.5809967", "0.57914627", "0.57527554", "0.57159925", "0.5624137", "0.5620962", "0.56170213", "0.5566372", "0.5499192", "0.54166603", "0.5415121", "0.5408217", "0.5407865", "0.54073036", "0.54072976", "0.5400013", "0.539776...
0.7969142
0
Read the token and confirms if the user is identified by LTI
def is_lti_token(token): return ( token.payload and token.payload.get("context_id") and token.payload.get("consumer_site") and token.payload.get("user") and token.payload["user"].get("id") )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_token(token):\n return conn.hget('login:', token)", "def check_login(self):\n # read token first\n user_data = self.storage.get_user_data(self.user_id)\n if not \"token\" in user_data:\n sys.exit(\"SEPIA account: No user data found! Please generate a token first (pyth...
[ "0.6346393", "0.63008785", "0.61640364", "0.6117233", "0.5967749", "0.5962646", "0.59046984", "0.5896081", "0.58923686", "0.5870281", "0.58582604", "0.58150005", "0.5804471", "0.57891935", "0.57408506", "0.571633", "0.5700442", "0.56828153", "0.5674775", "0.5661292", "0.56547...
0.63788897
0
Get or create a livesession for an anonymous id
def get_livesession_from_anonymous_id(video_id, anonymous_id): video = Video.objects.get(pk=video_id) return LiveSession.objects.get_or_create(video=video, anonymous_id=anonymous_id)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_new_session():\n session = Session.objects.create(uuid=str(uuid4()), container_id=None)\n return session.id", "def create(id = None, expires=None):\n\n\t# Init the data\n\tdData = {}\n\n\t# If we have an expires time\n\tif expires:\n\t\tdData['__expire'] = expires\n\n\t# Create a new Session using...
[ "0.7245941", "0.7015235", "0.67147166", "0.66734475", "0.66606957", "0.6430051", "0.63500804", "0.63182265", "0.6308316", "0.6273787", "0.62397", "0.62304604", "0.62076575", "0.62020063", "0.61958426", "0.61953795", "0.6167554", "0.6165223", "0.61571944", "0.613772", "0.61113...
0.806553
0
If the is the first time we've seen a file ci/co it. Otherwise just track the ownership and perms from the tag .
def rcsBegin(self, file, owner, perms): rcsdir = os.path.join(os.path.dirname(file), 'RCS') rcsfile = '%s,v' % os.path.join(rcsdir, os.path.basename(file)) l = [] l.append('') if file not in self.rcsFiles: l.append('if [ ! -f %s ]; then' % rcsfile) l.append('\tif [ ! -f %s ]; then' % file) l.app...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def identify_file(self, file):", "def touched_files(self, parent):", "def file_stat(self, file_path):", "def author(self):\n\n for item in self.metadata:\n if item.tag.localname == \"creator\":\n if 'file-as' in item.tag:\n return item.tag['file-as']\n ...
[ "0.5790112", "0.54505527", "0.5424586", "0.54180145", "0.53446144", "0.5330999", "0.5295813", "0.525217", "0.5153683", "0.5146164", "0.5091745", "0.5077872", "0.503171", "0.49707654", "0.49677595", "0.4965859", "0.49599025", "0.49574524", "0.49545944", "0.495099", "0.4947335"...
0.6016552
0
Run the final ci/co of a . The ownership of both the file and rcs file are changed to match the last requested owner in the file tag. The perms of the file (not the file file) are also modified. The file is checked out locked, which is why we don't modify the perms of the RCS file itself.
def rcsEnd(self, file, owner, perms): rcsdir = os.path.join(os.path.dirname(file), 'RCS') rcsfile = '%s,v' % os.path.join(rcsdir, os.path.basename(file)) l = [] l.append('') l.append('if [ -f %s ]; then' % file) l.append('\techo "stack" | /opt/stack/bin/ci -q %s;' % file) l.append('\t/opt/stack/bin/rcs -...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rcsBegin(self, file, owner, perms):\n\t\t\n\t\trcsdir\t= os.path.join(os.path.dirname(file), 'RCS')\n\t\trcsfile = '%s,v' % os.path.join(rcsdir, os.path.basename(file))\n\t\tl\t= []\n\n\t\tl.append('')\n\n\t\tif file not in self.rcsFiles:\n\t\t\tl.append('if [ ! -f %s ]; then' % rcsfile)\n\t\t\tl.append('\\tif...
[ "0.7213633", "0.5437469", "0.5331553", "0.52410376", "0.5230401", "0.5201142", "0.5097769", "0.50664836", "0.5041782", "0.50389785", "0.5034299", "0.50319076", "0.49739888", "0.49032003", "0.48995325", "0.48850876", "0.48826876", "0.48803964", "0.48756692", "0.48726416", "0.4...
0.6825678
1
Function works in an interesting way. On solaris the post sections are executed in the installer environment rather than in the installed environment. So the way we do it is to write a script for every post section, with the correct interpreter and execute it with a chroot command.
def handle_post(self, node): attr = node.attributes # By default we always want to chroot, unless # otherwise specified if attr.getNamedItem((None, 'chroot')): chroot = attr.getNamedItem((None, 'chroot')).value else: chroot = 'yes' # By default, the interpreter is always /bin/sh, unless # otherwise...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _post_chroot_block(self):\n pass", "def test_post_hooks(self):\n os.makedirs('/tmp/localhost/pacha_post')\n touch_script = open('/tmp/localhost/pacha_post/bar.sh', 'w')\n touch_script.write('''touch /tmp/localhost/post_got_executed.txt''')\n touch_script.close()\n ru...
[ "0.6272155", "0.59366894", "0.58126336", "0.5763724", "0.57000697", "0.5526255", "0.55072355", "0.5439551", "0.5423869", "0.5335712", "0.5188959", "0.5180584", "0.5135002", "0.5103483", "0.50667036", "0.50561106", "0.5050141", "0.50271666", "0.49927554", "0.49574766", "0.4951...
0.79566574
0
Run a command in bluetoothctl prompt, return output as a list of lines.
def get_output(self, command, pause = 0): self.child.send(command + "\n") time.sleep(pause) start_failed = self.child.expect(["bluetooth", pexpect.EOF]) if start_failed: raise BluetoothctlError("Bluetoothctl failed after running " + command) return self.child.before...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def runCommand(command):\n p = subprocess.Popen(command, stdout=subprocess.PIPE, bufsize=1)\n for line in p.stdout:\n print (line.decode(\"utf-8\"),end=\"\") # the end=\"\" argument to print prevents unwanted newlines after each line\n p.wait()", "def getlist_command(chat, message, args):\n ...
[ "0.6305831", "0.6099946", "0.604878", "0.60336906", "0.6012386", "0.59710187", "0.59599155", "0.5954625", "0.5925991", "0.5912907", "0.58947915", "0.58914745", "0.58758724", "0.5866151", "0.5818205", "0.58112407", "0.58038276", "0.5802728", "0.57979625", "0.57927865", "0.5751...
0.76253545
0
Start bluetooth scanning process.
def start_scan(self): try: out = self.get_output("scan on") except BluetoothctlError, e: print(e) return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_scan(self):\n try:\n self.send(\"scan on\")\n except Exception as e:\n logger.error(e)", "def scan_bluetooth(self):\n nearby_devices = bluetooth.discover_devices(lookup_names=True)\n print(\"Found {} devices at {}\".format(len(nearby_devices), datetime....
[ "0.7092848", "0.68479425", "0.64671916", "0.6390373", "0.6266748", "0.6077641", "0.6003199", "0.59815305", "0.5912794", "0.5868289", "0.58520436", "0.58066916", "0.57317865", "0.5698279", "0.56773984", "0.56716573", "0.56680685", "0.5616653", "0.5609731", "0.56063515", "0.558...
0.7495556
0
Parse a string corresponding to a device.
def parse_device_info(self, info_string): device = {} block_list = ["[\x1b[0;", "removed"] string_valid = not any(keyword in info_string for keyword in block_list) if string_valid: try: device_position = info_string.index("Device") except ValueErr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_device_info(self, info_string):\n device = {}\n block_list = [\"[\\x1b[0;\", \"removed\"]\n if not any(keyword in info_string for keyword in block_list):\n try:\n device_position = info_string.index(\"Device\")\n except ValueError:\n ...
[ "0.6707264", "0.6204154", "0.6176039", "0.61102825", "0.5992855", "0.59308904", "0.58585906", "0.57680696", "0.5758738", "0.57073265", "0.55955905", "0.5541076", "0.55354714", "0.54773116", "0.5436058", "0.542499", "0.53935575", "0.53806365", "0.5356007", "0.53506947", "0.535...
0.6813659
0
Return a list of tuples of paired devices.
def get_paired_devices(self): try: out = self.get_output("paired-devices") except BluetoothctlError, e: print(e) return None else: paired_devices = [] for line in out: device = self.parse_device_info(line) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_paired_devices(self):\n paired_devices = []\n try:\n out = self.get_output(\"paired-devices\")\n except Exception as e:\n logger.error(e)\n else:\n for line in out:\n device = self.parse_device_info(line)\n if device...
[ "0.812513", "0.78109574", "0.7337254", "0.6834147", "0.67622757", "0.6692423", "0.64281565", "0.63363624", "0.63119304", "0.6240608", "0.61645985", "0.6120527", "0.6119616", "0.60917395", "0.6068279", "0.60650516", "0.59931505", "0.5968045", "0.5948541", "0.592934", "0.587328...
0.78402257
1
Get device info by mac address.
def get_device_info(self, mac_address): try: out = self.get_output("info " + mac_address) except BluetoothctlError, e: print(e) return None else: return out
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_device_info(self, mac_address):\n try:\n out = self.get_output(f\"info {mac_address}\")\n except Exception as e:\n logger.error(e)\n return False\n else:\n return out", "def get_device(mac, devices=None):\n print('get_device:', get_devic...
[ "0.769", "0.7082296", "0.6966937", "0.69449574", "0.6943276", "0.6911567", "0.6872214", "0.67432535", "0.6732496", "0.6725122", "0.6725122", "0.66256213", "0.6593817", "0.65429586", "0.6531629", "0.65302724", "0.6529621", "0.64123887", "0.6408423", "0.6404166", "0.63812584", ...
0.8082673
0
Try to pair with a device by mac address.
def pair(self, mac_address): try: out = self.get_output("pair " + mac_address, 4) except BluetoothctlError, e: print(e) return None else: res = self.child.expect(["Failed to pair", "Pairing successful", pexpect.EOF]) success = True if r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pair(self, mac_address):\n try:\n self.send(f\"pair {mac_address}\", 4)\n except Exception as e:\n logger.error(e)\n return False\n else:\n res = self.process.expect(\n [\"Failed to pair\", \"Pairing successful\", pexpect.EOF]\n ...
[ "0.67151827", "0.6655969", "0.63428193", "0.6220836", "0.6195098", "0.6172149", "0.6115346", "0.61111647", "0.6105027", "0.5971343", "0.5935482", "0.58689785", "0.5857552", "0.5855842", "0.57976127", "0.5792732", "0.5764141", "0.5739098", "0.5677834", "0.5651506", "0.56320584...
0.71372104
0
Remove paired device by mac address, return success of the operation.
def remove(self, mac_address): try: out = self.get_output("remove " + mac_address, 3) except BluetoothctlError, e: print(e) return None else: res = self.child.expect(["not available", "Device has been removed", pexpect.EOF]) success = T...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove(self, mac_address):\n try:\n self.send(f\"remove {mac_address}\", 3)\n except Exception as e:\n logger.error(e)\n return False\n else:\n res = self.process.expect(\n [\"not available\", \"Device has been removed\", pexpect.E...
[ "0.7634485", "0.7334873", "0.63603044", "0.6248708", "0.6161044", "0.6146335", "0.6106605", "0.60522795", "0.59887767", "0.59885037", "0.5946601", "0.5940285", "0.58711654", "0.58530766", "0.57264113", "0.57229906", "0.5719934", "0.5613164", "0.55504835", "0.5532032", "0.5523...
0.79714197
0
Try to connect to a device by mac address.
def connect(self, mac_address): try: out = self.get_output("connect " + mac_address, 2) except BluetoothctlError, e: print(e) return None else: res = self.child.expect(["Failed to connect", "Connection successful", pexpect.EOF]) success...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connect(self, mac_address):\n try:\n self.send(f\"connect {mac_address}\", 2)\n except Exception as e:\n logger.error(e)\n return False\n else:\n res = self.process.expect(\n [\"Failed to connect\", \"Connection successful\", pexpe...
[ "0.7052936", "0.64072686", "0.62837535", "0.62757814", "0.62096846", "0.61889285", "0.615501", "0.6152284", "0.6094024", "0.6003506", "0.60025847", "0.59659606", "0.59659606", "0.592772", "0.59165674", "0.58521163", "0.5851595", "0.57564664", "0.5743521", "0.5736578", "0.5728...
0.74681413
0
Try to disconnect to a device by mac address.
def disconnect(self, mac_address): try: out = self.get_output("disconnect " + mac_address, 2) except BluetoothctlError, e: print(e) return None else: res = self.child.expect(["Failed to disconnect", "Successful disconnected", pexpect.EOF]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disconnect(self, mac_address):\n try:\n self.send(f\"disconnect {mac_address}\", 2)\n except Exception as e:\n logger.error(e)\n return False\n else:\n res = self.process.expect(\n [\"Failed to disconnect\", \"Successful disconnect...
[ "0.72905093", "0.6612695", "0.6239376", "0.61527765", "0.6123669", "0.60564005", "0.58871853", "0.57359934", "0.5650733", "0.5646573", "0.5582152", "0.55693996", "0.55204797", "0.5518684", "0.5515754", "0.5513107", "0.54900265", "0.54477865", "0.5444234", "0.542085", "0.53971...
0.776825
0
Do one epoch for each loader.
def train_epoch(self): for loader in self.loaders: if self.epoch % loader.epoch_interval == 0: self.cycle_dataset(loader) self._stats_new_epoch() self._write_tensorboard() print('{}th epoch train / eval done!'.format(self.epoch))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_epoch(self):\n self.model_lr_scheduler.step()\n\n print(\"Training\")\n self.set_train()\n\n for batch_idx, inputs in enumerate(self.train_loader):\n\n before_op_time = time.time()\n\n outputs, losses = self.process_batch(inputs)\n\n self.model_o...
[ "0.73241246", "0.7216297", "0.7195416", "0.71913004", "0.71906275", "0.70557934", "0.6989848", "0.6907351", "0.6859708", "0.6803187", "0.6788353", "0.67847615", "0.67637986", "0.67313635", "0.6729705", "0.6719912", "0.67154664", "0.6705897", "0.66883653", "0.6682975", "0.6648...
0.79150045
0
An index generated by pd.date_range has the expected spacing.
def test_timestamp_spacing_date_range(times): assert_series_equal( time.spacing(times, times.freq), pd.Series(True, index=times) )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_sparse_index(self):\n freq = 'MS'\n index = pd.date_range(start=\"2000-1-1\", freq=\"B\", periods=1000)\n tl = formatter.TimestampLocator(plot_index, freq=freq)\n test = tl._process(0, 900)\n new_ind = index[test]\n assert np.all(new_ind.day < 5)\n\n freq =...
[ "0.594955", "0.57676065", "0.57454824", "0.56609684", "0.5629476", "0.5626083", "0.55236256", "0.5503637", "0.5435363", "0.54065204", "0.5398519", "0.5369331", "0.5366041", "0.5346253", "0.5321032", "0.5305558", "0.5295049", "0.5264819", "0.5261607", "0.526003", "0.52450097",...
0.66547287
0
An index with only one timestamp has uniform spacing.
def test_timestamp_spacing_one_timestamp(times): assert_series_equal( time.spacing(times[[0]], times.freq), pd.Series(True, index=[times[0]]) )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_sparse_index(self):\n freq = 'MS'\n index = pd.date_range(start=\"2000-1-1\", freq=\"B\", periods=1000)\n tl = formatter.TimestampLocator(plot_index, freq=freq)\n test = tl._process(0, 900)\n new_ind = index[test]\n assert np.all(new_ind.day < 5)\n\n freq =...
[ "0.64681643", "0.6342602", "0.6340846", "0.61548537", "0.60340834", "0.6008199", "0.5924016", "0.56919485", "0.5671281", "0.5635621", "0.5583707", "0.55394363", "0.5527227", "0.548327", "0.5462145", "0.5454662", "0.5436531", "0.5386402", "0.5379498", "0.53658646", "0.53625935...
0.67455506
0
Skip `test` if ruptures is not installed.
def requires_ruptures(test): try: import ruptures # noqa: F401 has_ruptures = True except ImportError: has_ruptures = False return pytest.mark.skipif( not has_ruptures, reason="requires ruptures")(test)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filterOneTest(self, test_name):\n super(VtsKernelLibcutilsTest, self).filterOneTest(test_name)\n asserts.skipIf(\n test_name.split('.')[0] not in self.include_test_suite,\n 'Test case not selected.')", "def test_skipif_true():\n pass", "def test_skipif_false():\n p...
[ "0.6191865", "0.6123576", "0.608334", "0.5740479", "0.57377243", "0.5705882", "0.56717676", "0.5663313", "0.565899", "0.5650826", "0.5636528", "0.56000453", "0.55690503", "0.5560123", "0.55511856", "0.55477595", "0.55304223", "0.55159414", "0.55079204", "0.54901505", "0.54873...
0.780723
0
Daytime mask with no timeshifts yields a series with 0s for shift amounts.
def test_shift_ruptures_no_shift(midday): shift_mask, shift_amounts = time.shifts_ruptures( midday, midday ) assert not shift_mask.any() assert_series_equal( shift_amounts, pd.Series(0, index=midday.index, dtype='int64'), check_names=False )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_shift_ruptures_positive_shift(midday):\n shifted = _shift_between(\n midday, 60,\n start='2020-01-01',\n end='2020-02-29'\n )\n expected_shift_mask = pd.Series(False, index=midday.index)\n expected_shift_mask['2020-01-01':'2020-02-29'] = True\n shift_mask, shift_amounts...
[ "0.5413044", "0.53567845", "0.52154255", "0.5206374", "0.515903", "0.5124693", "0.51111966", "0.5089773", "0.50881964", "0.50811815", "0.503392", "0.50215524", "0.50112206", "0.4967276", "0.49626356", "0.49582893", "0.49296075", "0.49126858", "0.49083635", "0.49074998", "0.49...
0.6690785
0
Given the spawn positions get ones that are the type of selected pairs, ahead they can be Straight Curve DistanceBased
def generate_pairs(number_of_pairs, spawn_positions, pair_type, distance=0.0): if pair_type == 'straight': check_pair = is_straight_ahead elif pair_type == 'curve' or pair_type == 'one_curve': check_pair = is_one_turn_ahead elif pair_type == 'navigation': check_pair = is_distance_ahe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __generate_spawn_points(self):\n while True:\n p1x = random.randint(0, self.width - 1)\n p1y = random.randint(0, self.height - 1)\n p2x, p2y = self.__mirror(p1x, p1y)\n d_sq = (p1x - p2x)**2 + (p1y - p2y)**2\n if d_sq >= (self.width / 2)**2:\n ...
[ "0.59790665", "0.5968366", "0.5875905", "0.5824687", "0.58201873", "0.5684496", "0.5637187", "0.56041944", "0.55682504", "0.55327755", "0.55320257", "0.5522359", "0.5514448", "0.54830074", "0.5463138", "0.54503596", "0.54396003", "0.54383564", "0.5436321", "0.5431436", "0.542...
0.69993526
0
Test correct login for registered user
def test_correct_login(self): self.app.post('/register', data=self.user_reg_details) res = self.app.post('/login', data=self.user_login_details) self.assertEqual(res.status_code, 200) self.assertIn("Successfully logged in", str(res.data))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_login_user(self):\n\n self.register_user()\n\n self.assertEqual(self.login_user().status_code, 200)\n self.assertTrue(self.login_user().json[\"data\"][0][\"token\"])", "def test_login_with_correct_authentication_success(self):\n user = {\n \"Email\": \"fyi@g.com\",...
[ "0.827607", "0.81713736", "0.81592965", "0.8144953", "0.81344694", "0.80899405", "0.8088521", "0.8086015", "0.80694526", "0.800745", "0.80054164", "0.8004858", "0.79772276", "0.7971725", "0.797167", "0.7966959", "0.7946471", "0.79292387", "0.7908827", "0.78976744", "0.7867406...
0.8336928
0
Test is shoppinglist page is accessible
def test_shoppinglist_page(self): # register and login a user self.app.post('/register', data=self.user_reg_details) self.app.post('/login', data=self.user_login_details) # send a GET request res = self.app.get('/shoppinglist') self.assertEqual(res.status_code, 200) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_if_app_gets_shoppinglists(self):\n li = self.client.get('/shoppinglists/?each_page=1&page_number=1',\n headers = {\n 'Content-Type':'application/json',\n 'x-access-token':self.tok})\n self.assertEqual(li...
[ "0.7428975", "0.7084209", "0.7035298", "0.70197076", "0.69481605", "0.69290113", "0.69099915", "0.6882921", "0.68554443", "0.67730737", "0.6761895", "0.6675825", "0.66674894", "0.66618204", "0.6641966", "0.6625305", "0.65766716", "0.6573319", "0.65303385", "0.649315", "0.6487...
0.7752606
0
Test is shoppinglist creation with special characters raises an error
def test_shoppinglist_creation_with_error(self): res = self.app.post( '/shoppinglist', data={'name': 'Easter!'}) self.assertEqual(res.status_code, 200) response = self.shopping_class_obj.create_list( 'Easter!', 'maina@gmail.com') self.assertIn("No special characte...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_shoppingitems_creation_with_error(self):\n # register and login a user\n self.app.post('/register', data=self.user_reg_details)\n self.app.post('/login', data=self.user_login_details)\n # create a shopping list\n self.shopping_class_obj.create_list(\n 'Easter'...
[ "0.72518134", "0.7118796", "0.67943096", "0.67224187", "0.66217214", "0.650822", "0.64958614", "0.62975234", "0.6295656", "0.6279566", "0.6245173", "0.62024266", "0.6167081", "0.6166962", "0.612024", "0.6111161", "0.6088459", "0.60492975", "0.60164624", "0.5997922", "0.596350...
0.7914195
0
Test is shoppinglist editing
def test_shoppinglist_editing(self): # register and login a user self.app.post('/register', data=self.user_reg_details) self.app.post('/login', data=self.user_login_details) # make a post request with the edit name and original name res = self.app.post( '/edit-list', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_shoppingitems_editing(self):\n # register and login a user\n self.app.post('/register', data=self.user_reg_details)\n self.app.post('/login', data=self.user_login_details)\n # create a shopping list\n self.shopping_class_obj.create_list(\n 'Easter', 'maina@gma...
[ "0.7142485", "0.6881593", "0.68504274", "0.6724935", "0.6602776", "0.6413522", "0.63346744", "0.62454563", "0.62228453", "0.61955893", "0.61802894", "0.61662936", "0.61566925", "0.6095673", "0.6068156", "0.6040662", "0.60400003", "0.60307026", "0.5990141", "0.59888154", "0.59...
0.7657615
0
Test is shoppinglist editing with error e.g. special characters in edits
def test_shoppinglist_editing_with_error(self): # create a shopping list self.shopping_class_obj.create_list( 'Christmass', 'maina@gmail.com') # send a post request to edit res = self.app.post( '/edit-list', data={'list_name_org': 'Christmass', 'list_name': 'Furni...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_shoppinglist_editing(self):\n # register and login a user\n self.app.post('/register', data=self.user_reg_details)\n self.app.post('/login', data=self.user_login_details)\n # make a post request with the edit name and original name\n res = self.app.post(\n '/e...
[ "0.68949574", "0.6468022", "0.6260505", "0.624346", "0.62379146", "0.618614", "0.61283493", "0.609851", "0.5998177", "0.5853037", "0.5843319", "0.58280045", "0.5810069", "0.57881504", "0.5780004", "0.57764167", "0.577073", "0.57681024", "0.5756715", "0.5752896", "0.57489693",...
0.8244922
0
Test is shoppinglist deletion
def test_shoppinglist_deletion(self): # register and login a user self.app.post('/register', data=self.user_reg_details) self.app.post('/login', data=self.user_login_details) # create a shopping list self.shopping_class_obj.create_list( 'Christmass', 'maina@gmail.com'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_app_can_delete_list(self):\n delete_list=self.client.delete('/shoppinglists/nikes',\n headers={\n 'Content-Type':'application/json',\n 'x-access-token':self.tok})\n se...
[ "0.78201336", "0.77301276", "0.7422067", "0.7245719", "0.72095746", "0.7186851", "0.7185405", "0.7147028", "0.70220554", "0.6984018", "0.69768786", "0.6974467", "0.68914396", "0.6859198", "0.68217814", "0.6805688", "0.680357", "0.6787179", "0.6769062", "0.67636764", "0.676085...
0.82475007
0
Test is shoppingitems page is accessible
def test_shoppingitems_page(self): # register and login a user self.app.post('/register', data=self.user_reg_details) self.app.post('/login', data=self.user_login_details) # send a GET request res = self.app.get('/shoppingitems/Easter') self.assertEqual(res.status_code, 2...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_shoppinglist_page(self):\n # register and login a user\n self.app.post('/register', data=self.user_reg_details)\n self.app.post('/login', data=self.user_login_details)\n # send a GET request\n res = self.app.get('/shoppinglist')\n self.assertEqual(res.status_code,...
[ "0.7563833", "0.70784", "0.6995761", "0.6849791", "0.6800137", "0.6797828", "0.67814416", "0.6730364", "0.6657221", "0.663558", "0.6627246", "0.6626104", "0.6626104", "0.66007507", "0.6593794", "0.6593091", "0.6576001", "0.655483", "0.6417026", "0.63924617", "0.6383639", "0...
0.77414215
0
Test is shoppingitems creation
def test_shoppingitems_creation(self): # register and login a user self.app.post('/register', data=self.user_reg_details) self.app.post('/login', data=self.user_login_details) # create a shopping list self.shopping_class_obj.create_list( 'Easter', 'maina@gmail.com') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_creating_shopping_item(create_shopping_item, create_user):\n owner = create_user\n shopping_item = create_shopping_item\n assert shopping_item.owner == owner", "def test_create_new_shopping_list(create_shopping_list):\n shopping_list = create_shopping_list\n assert shopping_list.items.val...
[ "0.7944456", "0.76545477", "0.76515514", "0.76266253", "0.758755", "0.7528566", "0.7506967", "0.735609", "0.72952664", "0.7291592", "0.72743565", "0.72186154", "0.7200288", "0.7121786", "0.7107907", "0.70988566", "0.7057549", "0.70503956", "0.70407397", "0.6959227", "0.693986...
0.8415024
0
Test is shoppingitems creation with special characters raises an error
def test_shoppingitems_creation_with_error(self): # register and login a user self.app.post('/register', data=self.user_reg_details) self.app.post('/login', data=self.user_login_details) # create a shopping list self.shopping_class_obj.create_list( 'Easter', 'maina@gm...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_shoppinglist_creation_with_error(self):\n res = self.app.post(\n '/shoppinglist', data={'name': 'Easter!'})\n self.assertEqual(res.status_code, 200)\n response = self.shopping_class_obj.create_list(\n 'Easter!', 'maina@gmail.com')\n self.assertIn(\"No spec...
[ "0.75265205", "0.74732584", "0.69962466", "0.69336724", "0.685219", "0.67232794", "0.6677641", "0.65856296", "0.6506702", "0.64734185", "0.64224136", "0.63782465", "0.6328122", "0.6280224", "0.62284166", "0.62242836", "0.6160709", "0.6154644", "0.6150757", "0.61482954", "0.61...
0.785362
0
Test is shoppingitems editing
def test_shoppingitems_editing(self): # register and login a user self.app.post('/register', data=self.user_reg_details) self.app.post('/login', data=self.user_login_details) # create a shopping list self.shopping_class_obj.create_list( 'Easter', 'maina@gmail.com') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_edit(self):\n\n\t\titem_id = mock_item()[0]\n\n\t\titem_data = {'title': 'Item Two', 'author': 'Author Two',\n\t\t\t'location': 'Location Two'}\n\t\tmodels.edit(item_id, item_data)\n\n\t\titem = models.item(item_id)\n\n\t\tself.assertEqual(item['title'], item_data['title'])\n\t\tself.assertEqual(item['aut...
[ "0.7577284", "0.7303445", "0.7072082", "0.6694879", "0.668274", "0.66312575", "0.6615748", "0.6615162", "0.6553158", "0.654305", "0.650996", "0.65065485", "0.64853364", "0.64710945", "0.64474714", "0.63705915", "0.63515574", "0.6270542", "0.62216604", "0.6204397", "0.61922646...
0.7942727
0
Test is shoppingitem deletion
def test_shoppingitem_deletion(self): # register and login a user self.app.post('/register', data=self.user_reg_details) self.app.post('/login', data=self.user_login_details) # create a shopping list self.shopping_class_obj.create_list( 'Christmass', 'maina@gmail.com'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_delete_item_using_delete(self):\n pass", "def test_vault_delete_vault_item(self):\n pass", "def test_deletehardwares_item(self):\n pass", "def test_delete(self):\n\n\t\titem_id = mock_item()[0]\n\t\tmodels.delete(item_id)\n\n\t\titem = models.item(item_id)\n\t\tself.assertIsNone...
[ "0.8204011", "0.76926327", "0.76833624", "0.76319945", "0.7618163", "0.753591", "0.7467858", "0.7439768", "0.73194355", "0.72906375", "0.72744656", "0.7256352", "0.72457665", "0.7220899", "0.7138473", "0.7106589", "0.7076576", "0.7075094", "0.70563465", "0.70153284", "0.70100...
0.82401156
0
Extracts failed steps and tests from failed_steps data structure.
def _GetStepsAndTests(failed_steps): failed_steps_and_tests = [] if not failed_steps: return failed_steps_and_tests for step_name, step in failed_steps.iteritems(): for test_name in step.get('tests', [None]): failed_steps_and_tests.append([step_name, test_name]) return sorted(failed_steps_and_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_failed_tests_info():\n global g_failed_testnames\n global g_failed_test_paths\n\n if os.path.isfile(g_temp_filename):\n console_file = open(g_temp_filename,'r') # open temp file that stored jenkins job console output\n try:\n for each_line in console_file: # go throu...
[ "0.72037315", "0.64003235", "0.6198099", "0.5970432", "0.5880666", "0.5859135", "0.57517266", "0.57517266", "0.57461715", "0.5730742", "0.5716427", "0.5699984", "0.56586796", "0.56076384", "0.5467316", "0.5463865", "0.5411931", "0.54047173", "0.54043406", "0.5398147", "0.5394...
0.75964946
0
Generates a list of suspected CLs with failures.
def GetSuspectedCLsWithFailures(heuristic_result): suspected_cls_with_failures = [] if not heuristic_result: return suspected_cls_with_failures # Iterates through the failures, tests, and suspected_cls, appending suspected # CLs and failures to the list. for failure in heuristic_result['failures']: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_diagnostic_checklist(\n self,\n diagnostics: Optional[ExpectationDiagnostics] = None,\n show_failed_tests: bool = False,\n ) -> str:\n\n if diagnostics is None:\n diagnostics = self.run_diagnostics()\n\n if show_failed_tests:\n for test in diagn...
[ "0.588854", "0.5820131", "0.57948744", "0.5694773", "0.5687759", "0.56868774", "0.56846195", "0.5610962", "0.55845404", "0.5568738", "0.55524933", "0.55365837", "0.55314153", "0.55259746", "0.54951835", "0.5494805", "0.54892945", "0.54875994", "0.5475087", "0.54555833", "0.54...
0.6479734
0
Initialize the simulation with n persons with radii radius. radius can be a single value or a sequence with n values. Any keyvalue pairs passed in the styles dictionary will be passed as arguments to Matplotlib's Circle patch constructor when drawing the persons.
def __init__(self, n, sick_init, social_dist, radius=0.01, styles=None, total_beds=10, box_length=1, recovery_time=1000): self.init_persons(n, sick_init, social_dist, radius, box_length, recovery_time, total_beds, styles) self.init_hospital(total_beds)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_persons(self, n, sick_init, social_dist, radius, box_length, recovery_time, total_beds, styles=None):\n\n try:\n iterator = iter(radius)\n assert n == len(radius)\n except TypeError:\n # r isn't iterable: turn it into a generator that returns the\n ...
[ "0.7467201", "0.626629", "0.6185292", "0.6172426", "0.6168489", "0.6152153", "0.6136236", "0.61244214", "0.6081683", "0.6071068", "0.60351974", "0.6024233", "0.5960272", "0.5952411", "0.59161466", "0.59151185", "0.5874764", "0.58521754", "0.58242655", "0.582324", "0.5799982",...
0.6991616
1
Initialize the n persons of the simulation. Positions and velocities are chosen randomly; radius can be a single value or a sequence with n values.
def init_persons(self, n, sick_init, social_dist, radius, box_length, recovery_time, total_beds, styles=None): try: iterator = iter(radius) assert n == len(radius) except TypeError: # r isn't iterable: turn it into a generator that returns the # same valu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, n, sick_init, social_dist, radius=0.01, styles=None, total_beds=10, box_length=1, recovery_time=1000):\n\n self.init_persons(n, sick_init, social_dist, radius, box_length, recovery_time, total_beds, styles)\n self.init_hospital(total_beds)", "def initialize_persons(self) -> None:...
[ "0.73620445", "0.7016858", "0.69249624", "0.66159797", "0.6610822", "0.6428549", "0.63188136", "0.6226563", "0.61894035", "0.6139727", "0.6075305", "0.60692835", "0.6063084", "0.6016469", "0.5993922", "0.59770715", "0.59407234", "0.592899", "0.5899445", "0.5897267", "0.588945...
0.8121867
0
Detect and handle any collisions between the persons.
def handle_collisions(self): def change_velocities(p1, p2): """ persons p1 and p2 have collided elastically: update their velocities. """ m1, m2 = p1.radius**2, p2.radius**2 M = m1 + m2 r1, r2 = p1.r, p2.r d = np....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_collision(self):", "def on_collision(self, other_sprite, game):\n pass", "def collision_check(self):\n return True", "def check_collide(self):\n for pizza in self.overlapping_sprites:\n pizza.handle_collide()", "def collide(self, other, extra=None):\n pass", ...
[ "0.693847", "0.67775935", "0.67643595", "0.6723312", "0.66732615", "0.6663878", "0.6656644", "0.66252255", "0.6614167", "0.66076744", "0.6534438", "0.6490485", "0.64816266", "0.64544713", "0.6413099", "0.6408372", "0.6398557", "0.6396426", "0.6393135", "0.6378474", "0.6351244...
0.7840713
0
Advance the animation by dt, returning the updated Circles list.
def advance_animation(self, dt): for i, p in enumerate(self.persons): p.advance(dt) self.circles[i].center = p.r if p.health == 1: self.circles[i].set_color('forestgreen') elif p.health == -1: p.recover_health(self.hospital) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def moveCirc(self):\n\t\tfor circle in self.circles:\n\t\t\tcircle.moveStep()", "def animate(self, frame):\r\n\r\n self.timer.set_text(str(frame.time + 1))\r\n\r\n # determine new and old objects\r\n pos_dict = {p.id: p.position for p in frame}\r\n prev_items = set(self.shapes.keys())...
[ "0.6104577", "0.57834786", "0.5370679", "0.53413665", "0.5337193", "0.5262116", "0.5212934", "0.5210476", "0.5190429", "0.51205254", "0.50886035", "0.5083409", "0.50755924", "0.5072486", "0.49877557", "0.49872863", "0.49760437", "0.49625248", "0.49174756", "0.48868337", "0.48...
0.7998515
0
Import a graph from dot and return the pydot graph
def graph_from_dot(dot_file): (graph, ) = pydot.graph_from_dot_file(str(dot_file)) return graph
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_dot(path):\n return nx.Graph(nx.drawing.nx_agraph.read_dot(path))", "def nx_graph_from_dot_file(dot_file_path):\n # this does not understand dot statements like X->Y,Z;\n # nx_graph = nx.nx_pydot.read_dot(dot_file_path)\n\n nodes, edges = DotTool.read_dot_file(dot_file_path)\n ...
[ "0.81785476", "0.74634564", "0.68435544", "0.68227565", "0.6812424", "0.67617255", "0.67579436", "0.66886854", "0.66499615", "0.66072476", "0.6543986", "0.65072197", "0.6498015", "0.64524126", "0.6419185", "0.6409947", "0.64046085", "0.62290287", "0.62141687", "0.62141687", "...
0.8337127
0
Extract nodes from a graph or subgraph
def extract_nodes(graph): return graph.get_nodes()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_subgraphs(graph):\n nodes_powerset = get_nodes_combinations(graph)\n #print(\"Doing\")\n #draw_graph(graph)\n subgraphs = []\n for nodes in nodes_powerset:\n subg = graph.subgraph(nodes)\n nodes = subg.nodes(data=True)\n if nx.is_weakly_connected(subg):\n subg...
[ "0.67818236", "0.6769079", "0.67279196", "0.6716732", "0.6495333", "0.6347348", "0.6309848", "0.6308805", "0.6305065", "0.6290197", "0.6286533", "0.6203041", "0.6200493", "0.6188385", "0.61736095", "0.6157508", "0.61509293", "0.61302936", "0.61242634", "0.6124174", "0.6120784...
0.8461386
0
Extract edges from a graph or subgraph
def extract_edges(graph): return graph.get_edges()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_edges(graph):\n edges = []\n\n # for each node in graph\n for node in graph:\n\n # for each neighbour node of a single node\n for neighbour in graph[node]:\n # if edge exists then append\n edges.append((node, neighbour))\n ...
[ "0.7304258", "0.7239456", "0.718095", "0.7091612", "0.7075197", "0.69585", "0.6954092", "0.69520867", "0.69215953", "0.69145983", "0.6905335", "0.68701786", "0.686967", "0.68694186", "0.6834669", "0.6800524", "0.6761796", "0.6710836", "0.6710358", "0.67097104", "0.6694627", ...
0.8485211
0
Update the node's attribute value.
def update_node(node, attribute, value): node.set(attribute, value) return
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setattr(self, node, attr, value):\n node.set(attr, value)", "def update_node(self, node):\n return node.update()", "def update_attr(self):\n\n # Retrieve all current values\n all_values = nx.get_node_attributes(self.G, 'value')\n\n new_values = {}\n\n # Loop over a...
[ "0.7324033", "0.6927763", "0.67732465", "0.6754612", "0.6717326", "0.6704152", "0.66555923", "0.66324836", "0.6607834", "0.6568018", "0.6545695", "0.65351236", "0.6492523", "0.64914244", "0.64336973", "0.6418807", "0.6400223", "0.63893753", "0.6329516", "0.631805", "0.6293387...
0.8126979
0
update recursivly the values of the bb found in the string. The first string is a node label
def update_bb_string(string, bb): match = re.search(r'<bb\\\ \d+\\>', string) if match == None: return string match_bb = int(re.search(r'\d+', match.group()).group()) if match_bb > bb: string = string.replace('<bb\ ' + str(match_bb), '<bb\ ' + str(match_bb + 1)) return stri...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_nodes(nodes, bb):\n \n for node in nodes:\n node.set(\"label\", update_bb_string(node.get_attributes()[\"label\"], bb))\n node.set_name(update_node_name(node.get_name(), bb))", "def rdf_update_labels(rdf, node):\n final_list = []\n for i in node.get_labels():\n # print...
[ "0.6005946", "0.58394676", "0.5547347", "0.5392496", "0.5356384", "0.53138846", "0.5207786", "0.5196954", "0.51949763", "0.5154856", "0.49764833", "0.49390763", "0.49058807", "0.4904439", "0.48864663", "0.48839214", "0.4838064", "0.4838054", "0.48342866", "0.47911355", "0.475...
0.6195684
0
Update the node_name if its bb is superior to the bb given
def update_node_name(node_name, bb): node_number = int(re.search(r'\d+', re.search(r'block_\d+', node_name).group()).group()) if bb < node_number: return node_name.replace('block_' + str(node_number), 'block_' + str(node_number+1)) return node_name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_nodes(nodes, bb):\n \n for node in nodes:\n node.set(\"label\", update_bb_string(node.get_attributes()[\"label\"], bb))\n node.set_name(update_node_name(node.get_name(), bb))", "def update_edges(subgraph, graph_name, bb):\n top_subgraph = get_top_parent(subgraph, graph_name)\n ...
[ "0.5870549", "0.57794714", "0.5668586", "0.5603168", "0.55162454", "0.55007994", "0.5437282", "0.53838784", "0.52949345", "0.5248087", "0.5215365", "0.5186336", "0.51311666", "0.50970185", "0.50913805", "0.50770426", "0.5071227", "0.50684965", "0.50604635", "0.5050924", "0.50...
0.7823142
0
Updates all the nodes whose bb are greater or equal to the bb given.
def update_nodes(nodes, bb): for node in nodes: node.set("label", update_bb_string(node.get_attributes()["label"], bb)) node.set_name(update_node_name(node.get_name(), bb))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_edges(subgraph, graph_name, bb):\n top_subgraph = get_top_parent(subgraph, graph_name)\n edges = extract_edges(top_subgraph)\n for edge in edges:\n if(edge.get_style() is not None):\n style = edge.get_style()\n if(edge.get_color() is not None):\n color = edge...
[ "0.6163093", "0.594918", "0.5757326", "0.53601015", "0.52970004", "0.5294817", "0.5243157", "0.5192671", "0.50755996", "0.50691277", "0.50389135", "0.50333357", "0.50276494", "0.50088555", "0.4975647", "0.49620822", "0.4912285", "0.49030748", "0.48854086", "0.48399827", "0.48...
0.6185121
0
Get the top parent in the arborescence of the graph after the root (graph_name)
def get_top_parent(subgraph, graph_name): global PARENTS if(subgraph.get_name() == graph_name): return None current = subgraph while(PARENTS[current.get_name()].get_name() != graph_name): current = PARENTS[current.get_name()] return current
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_top_parent(node):\n\n\ttop_node = cmds.listRelatives(node, p=True)\n\twhile top_node:\n\t\tnode = top_node[0]\n\t\ttop_node = cmds.listRelatives(node, p=True)\n\treturn node", "def get_parent(m_obj):\n fn_dag = oMa.MFnDagNode(m_obj)\n parent = fn_dag.parent(0)\n\n return parent", "def _parent(...
[ "0.790458", "0.69653594", "0.693914", "0.69232875", "0.6918259", "0.68931997", "0.68854564", "0.6859054", "0.684978", "0.68235576", "0.6809622", "0.67603946", "0.67267925", "0.6718496", "0.6707272", "0.66991097", "0.6691108", "0.66328573", "0.6603352", "0.6603352", "0.6603352...
0.80388516
0
Get the bb of a node_name
def get_bb(node_name): return int(re.search(r'\d+', re.search(r'block_\d+', node_name).group()).group())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def BB ( self ) :\n return self.__bb", "def BB ( self ) :\n return self.__bb", "def get_bb(self,bbname, mol = False):\n lines = self.mfp.get_bb(bbname)\n return lines", "def update_node_name(node_name, bb):\n node_number = int(re.search(r'\\d+', re.search(r'block_\\d+', node_na...
[ "0.66499287", "0.66499287", "0.6578319", "0.581693", "0.581363", "0.5779847", "0.55945545", "0.5552834", "0.5506352", "0.55034417", "0.54981905", "0.5404942", "0.5396745", "0.5337385", "0.5336068", "0.5300939", "0.52775645", "0.5273038", "0.5228449", "0.521782", "0.521583", ...
0.77513236
0
Update the node_name coming from an edge based on the node_number
def update_edge_node_name(node_name, node_number): return node_name.replace('block_' + str(node_number), 'block_' + str(node_number+1))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _generate_node_name(self):\r\n while 1:\r\n name = \"node\" + str(self._name_sequence)\r\n if name not in self.nodes.keys():\r\n break\r\n self._name_sequence += 1\r\n\r\n return name", "def get_node_name(self, node):\n raise NotImplemented...
[ "0.67319345", "0.65506136", "0.65412474", "0.6469875", "0.6457845", "0.6378959", "0.63714224", "0.634637", "0.63027287", "0.6301064", "0.62529254", "0.6247662", "0.6220426", "0.6122734", "0.6041335", "0.6016738", "0.59698576", "0.5935239", "0.5935239", "0.59346485", "0.590112...
0.8285547
0
Recreate the name of the subgraphs to write them in dot format
def recreate_subgraphs_name(): global SUBGRAPHS for (name, subgraph) in SUBGRAPHS.items(): subgraph.set_name("\"cluster_" + subgraph.get_name() + "\"")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dot_format(out, graph, name=\"digraph\"):\n\n out.write(\"digraph %s {\\n\" % name)\n for step, deps in each_step(graph):\n for dep in deps:\n out.write(\" \\\"%s\\\" -> \\\"%s\\\";\\n\" % (step, dep))\n\n out.write(\"}\\n\")", "def dot(self, name):\n nodes = \" \".join(\"_...
[ "0.6721667", "0.6559094", "0.6292541", "0.6277464", "0.6190809", "0.6097701", "0.60962105", "0.60695916", "0.6011946", "0.58700997", "0.58486986", "0.57998616", "0.5717391", "0.56959397", "0.56414515", "0.5637508", "0.56364864", "0.5632674", "0.56258225", "0.56256354", "0.559...
0.759614
0
Export the graph with its name and its format given
def export_graph(graph, name_file, format_export): im_name = ('{}.' + format_export).format('./' + name_file) if (format_export == "png"): graph.write_png(im_name) elif (format_export == "dot"): graph.write_dot(im_name) else: raise LookupError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def export_to_file(self, path, graph_format):\n try:\n logging.info(\"Saving RDF data to \" + str(path))\n with open(path, \"wb\") as out_file:\n out_file.write(self.g.serialize(format=graph_format, encoding=\"UTF-8\"))\n except Exception as e:\n loggin...
[ "0.71883935", "0.7021411", "0.70160556", "0.69428515", "0.68874854", "0.6877663", "0.68056834", "0.676145", "0.67338336", "0.6733325", "0.66793454", "0.6573491", "0.65170705", "0.64715695", "0.64098185", "0.6372013", "0.6362376", "0.63393945", "0.6336502", "0.63334435", "0.63...
0.8404999
0
Serialize a multibyte number.
def test_serialize_number(): num = 18178 assert [ 0b1000_0010, 0b1000_1110, 0b0000_0001 ] == list(UnsignedInt.to_bytes(num))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def serialize_number(n):\n return str(n)", "def _MP(number):\n if number == 0:\n return \"\\x00\\x00\\x00\\x00\"\n assert number > 0\n bn = long_to_bytes(number)\n if ord(bn[0]) & 128:\n bn = \"\\x00\" + bn\n return struct.pack(\">L\", len(bn)) + bn", "def utf8(num):\n # code...
[ "0.7286714", "0.61580974", "0.6150098", "0.60632354", "0.5984438", "0.5917858", "0.5876446", "0.5823355", "0.571057", "0.5692102", "0.5634073", "0.5628055", "0.5597029", "0.5571462", "0.5518949", "0.55142486", "0.5509726", "0.5503663", "0.5495191", "0.54871154", "0.5479122", ...
0.6482177
1
Deserialize a multibyte number.
def test_deserialize_number(): bytestring = bytes([ 0b_1010_0001, 0b_1100_1111, 0b_1000_0010, 0b_0100_0001 ]) assert 136357793 == UnsignedInt.read(bytestring)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decode(self, number: int) -> typing.Union[int, str]:\n return number", "def parse(cls, value: Union[str, int]) -> 'Unicode':\n return cls(value)", "def test_decoder(self):\n from sosbeacon.utils import number_decode\n\n encoded = 'b6'\n number = number_decode(encoded)\n ...
[ "0.60786426", "0.5694639", "0.5684392", "0.5618654", "0.5523354", "0.54951924", "0.5478825", "0.54429394", "0.54333234", "0.5406555", "0.5404439", "0.53951675", "0.53785276", "0.53625995", "0.53153265", "0.52572316", "0.5227916", "0.52247155", "0.5198231", "0.5182188", "0.517...
0.7016417
0
Serialize a list of strings.
def test_serialize_list(): assert bytes([ *UnsignedInt.to_bytes(3), # Number of values *String.to_bytes("Hello, world!"), *String.to_bytes("This is the middle value."), *String.to_bytes("Goodbye, world!") ]) == bytes(List(String).to_bytes([ "Hello, world!", "This...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _to_serialize_list(value):\n return [v.serialize() for v in value]", "def serialize_list(list_raw):\n list_serialized = []\n for value in list_raw:\n if isinstance(value, list):\n list_serialized.append(serialize_list(value))\n elif isinstance(value, dict):\n ...
[ "0.67442966", "0.671205", "0.671205", "0.65128034", "0.6490662", "0.64448583", "0.64432013", "0.6385174", "0.63692045", "0.63541377", "0.63541377", "0.6325592", "0.63179964", "0.6310226", "0.6278399", "0.62434316", "0.62434316", "0.6232802", "0.6202747", "0.6198885", "0.61863...
0.681501
0
Deserialize a list of unsigned integers.
def test_deserialize_list(): input = bytes([ *UnsignedInt.to_bytes(5), *UnsignedInt.to_bytes(1), *UnsignedInt.to_bytes(2), *UnsignedInt.to_bytes(3), *UnsignedInt.to_bytes(4), *UnsignedInt.to_bytes(5), ]) assert [1, 2, 3, 4, 5] == List(UnsignedInt).read(input)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unpack_uint64s(data: bytes) -> List[int]:\n if len(data) == 0:\n return []\n return list(x[0] for x in struct.iter_unpack(\">Q\", data))", "def decode_int_list(L):\n return [] if L == '[]' else [int(a) for a in L[1:-1].split(\",\")]", "def unpack_varint_list(data: bytes) -> List[int]:\n ...
[ "0.65520054", "0.6159012", "0.6125795", "0.6040686", "0.59501755", "0.592363", "0.5908489", "0.583652", "0.5818484", "0.58077693", "0.5784819", "0.5653859", "0.5623251", "0.56229055", "0.559387", "0.5584414", "0.558373", "0.5513211", "0.5490519", "0.54872656", "0.5472147", ...
0.78542393
0
Serialize and deserialize a list of booleans.
def test_roundtrip_list(): assert [True, False, True, False, True] == ( List(Boolean).read( List(Boolean).to_bytes( [True, False, True, False, True])) )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __convert_boolean_list(boolean_list):\n return ['0' if b else '1' for b in boolean_list]", "def get_list_of_bool2(self):\n pass", "def convertToByteArray(booleanArray: typing.List[bool]) -> typing.List[int]:\n ...", "def convertToBooleanArray(booleanArray: typing.List[bool]) -> typin...
[ "0.66206795", "0.6616324", "0.64915305", "0.64081734", "0.6229032", "0.6101908", "0.5978909", "0.59423906", "0.5920379", "0.58470297", "0.58314794", "0.5790201", "0.5750331", "0.57255846", "0.56945485", "0.5686229", "0.5679834", "0.5662652", "0.5634682", "0.55717903", "0.5550...
0.72815526
0
Serialize and deserialize signed integers.
def test_roundtrip_signed_int(): for num in (0, -0, -1, 2, -178, 300, -BIG_NUMBER, BIG_NUMBER): num2 = SignedInt.read(SignedInt.to_bytes(num)) assert num2 == num
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _pack_bytes_signed(byte_list):\n return int.from_bytes(byte_list, 'big', signed=True)", "def read_signed_integer(stream, size):\n\t\n\tvalue = 0\n\tif size > 0:\n\t\tfirst_byte = ord(stream.read(1))\n\t\tvalue = first_byte\n\t\tfor i in xrange(1, size):\n\t\t\tbyte = ord(stream.read(1))\n\t\t\tvalue = (va...
[ "0.62926906", "0.5894391", "0.58401656", "0.553837", "0.5525591", "0.5473513", "0.54169846", "0.5413734", "0.53676546", "0.5328632", "0.5305772", "0.53013545", "0.53005916", "0.5287086", "0.5287086", "0.5280611", "0.5263858", "0.5261265", "0.52336067", "0.51880723", "0.516665...
0.6768209
0
Serialize an optional boolean value.
def test_serialize_optional_boolean(): assert bytes([ *Boolean.to_bytes(True), *Boolean.to_bytes(False) ]) == bytes(Optional(Boolean).to_bytes(False)) assert bytes([ *Boolean.to_bytes(False) ]) == bytes(Optional(Boolean).to_bytes(None))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def writeBoolean(self, value: bool):\n self.writeByte(1 if value else 0)", "def write_boolean(self, boolean: bool) -> None:\n self.write(bytearray([bool(boolean)]))", "def default_numpy_bool_serializer(np_bool: np.bool_, **kwargs: Dict[str, Any]) -> bool:\n return np_bool.item()", "def _writ...
[ "0.695464", "0.6866647", "0.67705095", "0.67319375", "0.6724631", "0.6685881", "0.6625809", "0.65711594", "0.6552718", "0.65249294", "0.65092885", "0.65008473", "0.64786744", "0.6462064", "0.64485586", "0.6434441", "0.64318776", "0.64238155", "0.6419644", "0.6417161", "0.6384...
0.7823206
0
Deserialize an optional integer value.
def test_deserialize_optional_integer(): assert 15 == Optional(UnsignedInt).read(bytes([ *Boolean.to_bytes(True), *UnsignedInt.to_bytes(15) ])) assert None == Optional(UnsignedInt).read(bytes([ *Boolean.to_bytes(False) ]))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_int(value):\n try:\n return int(value)\n except (ValueError, TypeError):\n return None", "def _get_optional_int32(serialized_all_simple):\n holder = test_pb2.AllSimple()\n holder.ParseFromString(serialized_all_simple)\n return holder.optional_int32", "def value(self, value: Opt...
[ "0.6403401", "0.63977915", "0.6185092", "0.61017734", "0.60544384", "0.5992901", "0.5901395", "0.5861061", "0.58347374", "0.58105177", "0.5790001", "0.57270944", "0.566357", "0.5629136", "0.55924785", "0.5570536", "0.554523", "0.55319864", "0.5523835", "0.55176944", "0.550489...
0.7737031
0
Serialize and deserialize an optional string value.
def test_optional_string_roundtrip(): assert "Hello, world!" == Optional(String).read( Optional(String).to_bytes("Hello, world!") ) assert None == Optional(String).read( Optional(String).to_bytes(None) )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_optionalString(value):\n if not value:\n return None\n\n return value", "def string_value(self) -> typing.Optional[str]:\n return self._values.get('string_value')", "def convert(cls, value: Any) -> Optional[str]:\n # Can be optional\n if value is None:\n r...
[ "0.6567198", "0.615945", "0.6121745", "0.6092902", "0.6044499", "0.60099953", "0.5898233", "0.5832174", "0.5793168", "0.5782669", "0.5722062", "0.56881946", "0.56610614", "0.561879", "0.5601914", "0.5573427", "0.55238503", "0.55231345", "0.549616", "0.5479968", "0.5476716", ...
0.6797931
0
Given a mapping and a dictionary of data, serialize a Map into a stream of bytes.
def test_serialize_map(): Car = Map( MapEntrySpec(2, "colour", String), MapEntrySpec(1, "manufacturer", String), MapEntrySpec(3, "preowned", Boolean), MapEntrySpec(4, "miles_travelled", UnsignedInt) ) car_data = { "preowned": True, "manufacturer": "Ford", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dump(mapping, fp):\n fp.write(dumps(mapping))", "def encode_map(value: list) -> bytes:\n raise NotImplementedError()", "def _encode_dict(source: dict) -> bytes:\n result_data = b\"d\"\n\n for key, value in source.items():\n result_data += encode(key) + encode(value)\n\n return result_...
[ "0.61381286", "0.6012207", "0.58289415", "0.5741699", "0.55270636", "0.5522902", "0.5430392", "0.53804344", "0.5310919", "0.5293991", "0.5275386", "0.5256044", "0.5217211", "0.51977646", "0.51977646", "0.5188625", "0.51824516", "0.5174611", "0.5127088", "0.5096614", "0.508422...
0.66922426
0
Make sure that if values are missing from the input, the Map.to_bytes method complains.
def test_serialize_map_fails_with_missing_values(): Paint = Map( MapEntrySpec(2, "colour", String) ) with pytest.raises(ValueError): bytes(Paint.to_bytes({}))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encode_map(value: list) -> bytes:\n raise NotImplementedError()", "def test_check_map_var_len_not_specified(self):\r\n\r\n self.assertRaises(ValueError, check_map,\r\n self.valid_mapping_data_var_len_bcs)", "def test_serialize_map():\n Car = Map(\n MapEntrySpec(...
[ "0.6101353", "0.5754929", "0.5615507", "0.54910237", "0.5478462", "0.54649913", "0.53802454", "0.53762305", "0.5346325", "0.5326472", "0.5295458", "0.52919406", "0.5279317", "0.52775955", "0.52660966", "0.52269834", "0.5205596", "0.5201252", "0.5195053", "0.51595753", "0.5145...
0.7206455
0
Serialize and deserialize a map with nested values.
def test_roundtrip_nested_map(): Person = Map( MapEntrySpec(1, "name", String), MapEntrySpec(2, "age", UnsignedInt), "Person" ) Family = Map( MapEntrySpec(1, "mother", Person), MapEntrySpec(2, "father", Person), "Family" ) my_family = { "mothe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_map_deserialization(self):\r\n \r\n original = DeserializationTestModel.create(count=5, text='happy')\r\n nested = original.get_map()\r\n\r\n assert isinstance(nested, dict)\r\n assert nested['vertex'] == original\r\n assert nested['number'] == 5", "def _deseria...
[ "0.65670043", "0.63388926", "0.6310341", "0.5869626", "0.58094156", "0.56546545", "0.56546545", "0.5529231", "0.5513568", "0.54338574", "0.53642", "0.53532743", "0.5345577", "0.5269327", "0.5269158", "0.5269158", "0.51037747", "0.5092105", "0.5081182", "0.5073145", "0.5066694...
0.6463
1
Read a simple Map definition from lines.
def test_reading_simple_user_map_definition(): assert Map( MapEntrySpec(1, "name", String), MapEntrySpec(2, "age", UnsignedInt), MapEntrySpec(3, "hair_colour", String) ) == Map.from_lines([ "1. name: string", "2 age int", "3 :hair_colour (string)" ])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parseMetadataMap(lines):\r\n return MetadataMap(*parse_mapping_file_to_dict(lines))", "def parse_map(file):\n with open(FILE) as f:\n return Map([line[:-1] for line in f])", "def read_map(self):\r\n input = list(sys.stdin)\r\n self.size = int(input[0])\r\n self.map = i...
[ "0.71244884", "0.6968767", "0.68107665", "0.6634452", "0.634941", "0.63416344", "0.6302559", "0.6219783", "0.6167701", "0.6144906", "0.6115638", "0.610615", "0.6066938", "0.6049927", "0.60477847", "0.6016381", "0.6015475", "0.6011982", "0.59513766", "0.59328747", "0.5913818",...
0.72482777
0
Read a Map definition containing one List key.
def test_reading_user_map_definition_with_list(): assert Map( MapEntrySpec(1, "name", String), MapEntrySpec(2, "phones", List(String)) ) == Map.from_lines([ "1. name: string", "2. phones: list(string)" ])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_reading_user_map_definition_with_list_optional():\n assert Map(\n MapEntrySpec(1, \"name\", String),\n MapEntrySpec(2, \"maybesomephones\", Optional(List(String)))\n ) == Map.from_lines([\n \"1. name: string\",\n \"2. maybesomephones: optional(list string)\"\n ])", "...
[ "0.6032396", "0.58715016", "0.5822615", "0.5542326", "0.55089337", "0.5495896", "0.5488354", "0.5467694", "0.5419388", "0.5399856", "0.5342145", "0.5338954", "0.5315652", "0.53014565", "0.5265771", "0.5249377", "0.5241942", "0.5229545", "0.5225417", "0.52043796", "0.51956886"...
0.68474334
0
Read a Map definition containing one Optional key.
def test_reading_user_map_definition_with_optional(): assert Map( MapEntrySpec(1, "name", String), MapEntrySpec(2, "maybephone", Optional(String)) ) == Map.from_lines([ "1. name: string", "2. maybephone: optional(string)" ])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_reading_user_map_definition_with_list_optional():\n assert Map(\n MapEntrySpec(1, \"name\", String),\n MapEntrySpec(2, \"maybesomephones\", Optional(List(String)))\n ) == Map.from_lines([\n \"1. name: string\",\n \"2. maybesomephones: optional(list string)\"\n ])", "...
[ "0.62285095", "0.5996073", "0.5814024", "0.57151675", "0.5696247", "0.5571919", "0.55697805", "0.55614245", "0.5471802", "0.5471802", "0.5453024", "0.5428537", "0.5345117", "0.5318974", "0.531108", "0.53056556", "0.52869904", "0.5267242", "0.5164543", "0.51603025", "0.5152364...
0.69598836
0
Read a Map definition containing one optional list of values.
def test_reading_user_map_definition_with_list_optional(): assert Map( MapEntrySpec(1, "name", String), MapEntrySpec(2, "maybesomephones", Optional(List(String))) ) == Map.from_lines([ "1. name: string", "2. maybesomephones: optional(list string)" ])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_reading_user_map_definition_with_list():\n assert Map(\n MapEntrySpec(1, \"name\", String),\n MapEntrySpec(2, \"phones\", List(String))\n ) == Map.from_lines([\n \"1. name: string\",\n \"2. phones: list(string)\"\n ])", "def test_reading_user_map_definition_with_opti...
[ "0.69937927", "0.64103997", "0.59251124", "0.58146", "0.5645559", "0.5634665", "0.5533", "0.5508804", "0.5505748", "0.5500272", "0.54725784", "0.5363205", "0.53503984", "0.53423303", "0.5214117", "0.52050954", "0.5202695", "0.51900053", "0.5181386", "0.51526165", "0.5111027",...
0.7246774
0
Read a Map definition from a real file.
def test_reading_user_map_definition_from_file(): with open("tempfile.buf", "w") as f: f.write(""" 1. key : string 2. bpm : int """) with open("tempfile.buf") as f: assert Map( MapEntrySpec(1, "key", String), MapEntrySpec(2, "bpm", Unsigne...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_reading_nested_user_map_definition_from_file():\n with open(\"definitions/Person.buf\") as f:\n Person = Map.from_open_file(f)\n\n expected = Map(\n MapEntrySpec(1, \"name\", String),\n MapEntrySpec(2, \"members\", List(Person))\n )\n\n with open(\"definitions/Club.buf\") ...
[ "0.7505922", "0.7364504", "0.6827902", "0.68237305", "0.66845053", "0.66607344", "0.6638235", "0.6619044", "0.6619011", "0.65709263", "0.6550067", "0.65239376", "0.65013534", "0.6468353", "0.64619386", "0.64509207", "0.6450419", "0.64489275", "0.6435829", "0.6405746", "0.6346...
0.74864864
1