query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Resets all made selection, returning to initial state
def reset_selections(): return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Reset_Selection(self):\r\n #if previous selection\r\n if( self.selected != 0 ):\r\n self.canvas_one.delete( self.selected ) #remove bounding rectangle\r\n #return chosen node to branch_color\r\n self.canvas_one.itemconfig( self.selected_ls.line_handle , fill = self.br...
[ "0.79201347", "0.77571887", "0.7379118", "0.7340211", "0.73181266", "0.721911", "0.7197248", "0.7190832", "0.71431947", "0.71210617", "0.7112716", "0.7112716", "0.7112716", "0.7112716", "0.7075982", "0.70753473", "0.70753473", "0.70753473", "0.70569086", "0.70569086", "0.7054...
0.79584837
0
Returs a list of all pandigital primes up to ``n``.
def pandigital_primes(n=10000000): pri = [x for x in primes(n) if is_pandigital(x)] return pri
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_primes(n):\n\n return list(primes_sieve(n))", "def primes(n):\n return [i for i in xrange(1, n + 1) if mr_prime(i)]", "def get_n_primes(n):\n\n primes = [' ']\n num = 2\n while len(primes) < n + 1:\n if is_prime(num):\n primes.append(num)\n num += 1\n return p...
[ "0.8037789", "0.79828346", "0.78280413", "0.7799131", "0.7784345", "0.77557623", "0.7705573", "0.7680708", "0.75602317", "0.75260603", "0.75113", "0.74893403", "0.7445755", "0.74427813", "0.74221474", "0.7414387", "0.739986", "0.736477", "0.7353285", "0.7333225", "0.73293346"...
0.83678913
0
JS's Array.prototype.splice var x = [1, 2, 3], y = x.splice(0, 2, 1337); eq x = [1, 2, 3] x, y = splice(x, 0, 2, 1337)
def splice(l, a, b, c): return l[:a] + [c] + l[a + b:], l[a:a + b]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_slice_delslice_forbidden(self):\n global setVal\n class foo:\n def __delslice__(self, i, j, value):\n global setVal\n setVal = i, j, value\n def __delitem__(self, index):\n global setVal\n setVal = index\n\n ...
[ "0.59674096", "0.5881125", "0.55306304", "0.54376376", "0.54055613", "0.5403059", "0.54028875", "0.53743917", "0.5366488", "0.53132486", "0.5307077", "0.53044724", "0.52966225", "0.5289427", "0.52652615", "0.5255296", "0.5226818", "0.5218034", "0.5171859", "0.5168979", "0.514...
0.5637859
2
Create an inspection object in the database.
def create_db_entry( site: str, inspection_date: str, inspection_time: str, inspection_status: str, inspectors: Tuple[str], ) -> None: db_filename = "twdft.db" db_path = os.path.join(TWDFT_DATA_DIR, db_filename) with sqlite3.connect(db_path) as conn: c = conn.cursor() sit...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create(cls, **kwargs):\r\n return cls().fill(**kwargs).save()", "def create(self, validated_data):\n return Inspection.objects.create(**validated_data)", "def create(self, validated_data):\n return Inspection.objects.create(**validated_data)", "def create(self):\n db.session.a...
[ "0.612162", "0.6118972", "0.6118972", "0.59497267", "0.59281623", "0.59279877", "0.592378", "0.58934027", "0.58934027", "0.58934027", "0.5875716", "0.5853732", "0.58511215", "0.5849336", "0.5849336", "0.5849336", "0.58289343", "0.5801251", "0.57989466", "0.57930285", "0.57917...
0.55336237
44
takes a list of (site_name, last_inspection, frequence_target) tuples and converts t[x] into a date and t[2] into an integer.
def clean_inspection_freq_data( data: list, sortkey: str, limit: int, filter: str ) -> tuple: SORT_KEYS = {"last_inspection": 1, "freq_target": 2, "days_since": 4, "along": 5} errors = [] out = [] for t in data: frequency_target = int(t[2]) days_in_freq = days_in_frequency_target(fr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tuples_to_int(monthly_delays: List[tuple]) -> List[int]:\n \n # We use a while loop to convert the strings into ints by removing the \n # columns from the strings, converting it to an int so it values can easily \n # be represented in an histogram.\n \n i = 0\n x_month = []\n monthly_de...
[ "0.5316364", "0.5282863", "0.5136857", "0.5032344", "0.49827", "0.49503598", "0.49287194", "0.4905288", "0.48643428", "0.48643428", "0.48643428", "0.48643428", "0.48643428", "0.48575798", "0.48554844", "0.48295164", "0.48253977", "0.48138842", "0.48131186", "0.48113915", "0.4...
0.43406487
77
Provide data for how a single site fairs in terms of inspection frequency.
def get_inspection_periods_all_sites(db_name, team: str) -> List[Any]: db_file = os.path.join(TWDFT_DATA_DIR, db_name) try: conn = sqlite3.connect(db_file) except FileNotFoundError: raise c = conn.cursor() if not team: c.execute("SELECT name, last_inspection, freq_target, cou...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetFrequency(self):\n ...", "def get_frequency(self):\r\n # print '*********in get freq'\r\n self.cntr.run('FREQ 1')\r\n f_0_ = self.cntr.get_measurements(1)\r\n self.f_0 = f_0_[0]\r\n self.cntr.run('FREQ 2')\r\n f_rep_ = self.cntr.get_measurements(1)\r\n ...
[ "0.63384324", "0.5985715", "0.5973865", "0.5812917", "0.5773013", "0.5743981", "0.56931645", "0.5671091", "0.5668804", "0.5559377", "0.5556281", "0.55512464", "0.5541836", "0.5507248", "0.5456006", "0.5434145", "0.5429975", "0.54174757", "0.538981", "0.536638", "0.5366002", ...
0.0
-1
Provide data for how a single site fairs in terms of inspection frequency.
def get_inspection_periods(db_name, site_name) -> tuple: db_file = os.path.join(TWDFT_DATA_DIR, db_name) try: conn = sqlite3.connect(db_file) except FileNotFoundError: raise c = conn.cursor() c.execute( "SELECT last_inspection, frequency_target FROM inspections WHERE site_nam...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetFrequency(self):\n ...", "def get_frequency(self):\r\n # print '*********in get freq'\r\n self.cntr.run('FREQ 1')\r\n f_0_ = self.cntr.get_measurements(1)\r\n self.f_0 = f_0_[0]\r\n self.cntr.run('FREQ 2')\r\n f_rep_ = self.cntr.get_measurements(1)\r\n ...
[ "0.6338375", "0.5985675", "0.59748757", "0.5812841", "0.57741714", "0.5742843", "0.56931466", "0.5671954", "0.5669691", "0.5559972", "0.5557436", "0.55514413", "0.5541102", "0.55074346", "0.54549533", "0.5434869", "0.54308754", "0.5417162", "0.5389595", "0.5366782", "0.536638...
0.0
-1
Initial db file set up.
def initial_db_setup() -> None: db_filename = "twdft.db" db_path = os.path.join(TWDFT_DATA_DIR, db_filename) csv_filename = "sites.csv" csv_path = os.path.join(TWDFT_DATA_DIR, csv_filename) db_is_new = not os.path.exists(db_path) sites_csv = os.path.join(TWDFT_DATA_DIR, csv_filename) if db_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_database(self):\n self.db.setup_database()", "def init_db():\n # with current_app.open_resource(\"schema.sql\") as f:\n # db.executescript(f.read().decode(\"utf8\"))\n print(\"初始化数据库脚本文件!!!\")", "def init_db():\n # Open connection to the database\n conn = sqlite3.connect(DB_...
[ "0.7942862", "0.78805405", "0.7878592", "0.78518283", "0.78422886", "0.7784696", "0.7672406", "0.7652456", "0.76153195", "0.7613362", "0.7613184", "0.7613184", "0.76114565", "0.7611178", "0.7593318", "0.75878555", "0.75564945", "0.75385445", "0.7522865", "0.7514568", "0.74900...
0.0
-1
Returns number in a frequence period. e.g. in Mallard, frequence period may be 12, 6, 18, etc to represent the numbner of months between inspections ideally. We are simply converting that to days.
def days_in_frequency_target(target: int) -> int: return int((target / 12) * 365)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def max_days(self):\n month_lengths = [31, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31, 29]\n days_years = 365.24 * (self.number // 12)\n days_months = np.sum(month_lengths[:self.number % 12])\n days_frac = days_years + days_months + self.days\n return int(np.ceil(days_frac))", "def...
[ "0.6482177", "0.64352334", "0.6295345", "0.6227996", "0.61479616", "0.60491973", "0.6031794", "0.60306615", "0.59559757", "0.591495", "0.5900473", "0.58404934", "0.58152664", "0.57966536", "0.57343847", "0.5714527", "0.57018095", "0.5693959", "0.5693922", "0.56685394", "0.564...
0.64305484
2
Retrieve the local code for a device using the EufyHome account's username and password.
def get_local_code(username: str, password: str, ip_address: str): client_id = 'eufyhome-app' client_secret = 'GQCpr9dSp3uQpsOMgJ4xQ' login_payload = {'client_id': client_id, 'client_Secret': client_secret, 'email': username, 'password': password} login_request = requests.post("https://home-api.eufylif...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_address():\n ret = subprocess.getoutput([\"swift auth\"])\n ret = ret.split(\"\\n\")[0]\n ret = ret.split(\"=\")[1]\n return ret", "def query_device_credential(self, device_code):\n raise NotImplementedError()", "def get_device_data():\n user = input('Username: ')...
[ "0.58795834", "0.5864797", "0.5834147", "0.57331693", "0.55483615", "0.5507485", "0.54629534", "0.54514444", "0.54253983", "0.54025495", "0.53247046", "0.53159016", "0.5302662", "0.5299826", "0.5280781", "0.5280781", "0.52279246", "0.52222973", "0.52222973", "0.51973945", "0....
0.7983226
0
Encrypt data using the Eufy AES key and IV. Handles padding to a 16 byte interval.
def _encrypt(data): cipher = AES.new(bytes(_AES_KEY), AES.MODE_CBC, bytes(_AES_IV)) # Pad to 16 bytes for AES CBC for i in range(16 - (len(data) % 16)): data += b'\0' return cipher.encrypt(data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encryptData(self, key, iv, data, align = True):\r\n\t\tif((len(data) % self.align) != 0 and align):\r\n\t\t\treturn AES.new(key, AES.MODE_CBC, iv).encrypt(data + (\"\\x00\" * (self.align - (len(data) % self.align))))\r\n\t\telse:\r\n\t\t\treturn AES.new(key, AES.MODE_CBC, iv).encrypt(data)", "def encrypt(dat...
[ "0.6828749", "0.67845535", "0.673316", "0.6700717", "0.6700098", "0.66566104", "0.6576784", "0.65596473", "0.6475029", "0.6362078", "0.6355538", "0.6347096", "0.6343566", "0.6307382", "0.62541276", "0.62478405", "0.62115437", "0.61893487", "0.6187919", "0.61566067", "0.615564...
0.71610576
0
Decrypt data using the Eufy AES key and IV.
def _decrypt(data): cipher = AES.new(bytes(_AES_KEY), AES.MODE_CBC, bytes(_AES_IV)) return cipher.decrypt(data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decrypt(data, key, iv):\n decryptor = AES.new(key, AES.MODE_CBC, iv=iv)\n return decryptor.decrypt(data)", "def decrypt_aes256(data, key, iv):\n decryptor = AES.new(key, AES.MODE_CBC, iv)\n return decryptor.decrypt(data)", "def decrypt_data ( aes_key, data ) :\n decoded_data = decode_data( da...
[ "0.7924128", "0.78425676", "0.7664806", "0.74264634", "0.7377018", "0.7376", "0.7275788", "0.72678125", "0.7236161", "0.7196816", "0.71716803", "0.7147415", "0.70604056", "0.70229", "0.7021497", "0.6991652", "0.69814116", "0.6971508", "0.69714355", "0.696959", "0.6913354", ...
0.7760098
2
Compile the given mode and command into the bytes data sent to the RoboVac.
def _build_robovac_command(mode, command): mcu_ota_header_0xa5 = 0xA5 cmd_data = (mode.value + command.value) return bytes([mcu_ota_header_0xa5, mode.value, command.value, cmd_data, 0xFA])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def binary_compile_cmd(self):\n ld = self.nvcc_options_json[\"ld\"]\n objcopy = self.nvcc_options_json[\"objcopy\"]\n cmd = \" \".join([ld, \"-r -b binary -o {target} {src}\"])\n # Support models with >2GB constants on Linux only\n if is_linux():\n cmd += (\n ...
[ "0.6167799", "0.5937154", "0.59241605", "0.59028786", "0.5817669", "0.579884", "0.57838464", "0.5774759", "0.5737887", "0.570226", "0.56056356", "0.55847764", "0.55546546", "0.5552185", "0.54988945", "0.5478312", "0.5477653", "0.5468052", "0.5432817", "0.54185456", "0.5405838...
0.71921897
0
Parse a decrypted response into a Protobuf Local Server Message
def _parse_local_server_message_from_decrypted_response(decrypted_response): # First 2 bytes indicate length of the actual data length = struct.unpack("<H", decrypted_response[0:2])[0] protobuf_data = decrypted_response[2:length + 2] message = LocalServerInfo_pb2.LocalServerMessage() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _parse_reply(self, msg_list): #{\n logger = self.logger\n\n if len(msg_list) < 4 or msg_list[0] != b'|':\n logger.error('bad reply: %r' % msg_list)\n return None\n\n msg_type = msg_list[2]\n data = msg_list[3:]\n result = None\n srv_id = ...
[ "0.6336118", "0.6241895", "0.6204218", "0.61142474", "0.61068696", "0.6064688", "0.60642505", "0.60597825", "0.605668", "0.6025478", "0.5981453", "0.5966325", "0.59572643", "0.5868557", "0.5867732", "0.5841865", "0.5841581", "0.58406657", "0.5827033", "0.58100164", "0.5783654...
0.80403924
0
Connect to the RoboVac at the given IP and port
def connect(self) -> None: self.s.connect((self.ip, self.port))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connect(self,ip,port):\n return self.network.connect(ip,port)", "def connect(self, host, port):\n pass", "def connect(self, ip: str, port: Optional[int] = None, version: Optional[str] = None,\n auth: Optional[Dict[str, str]] = None) -> None:\n api_version = 'v1' if versi...
[ "0.75759465", "0.7364749", "0.70157295", "0.6879106", "0.6812376", "0.6685011", "0.6621741", "0.65947074", "0.65727746", "0.65677226", "0.6513837", "0.65092593", "0.64508873", "0.63925874", "0.63672566", "0.63608134", "0.6346984", "0.6343776", "0.63339895", "0.6304929", "0.62...
0.7225088
2
Attempt to disconnect from the RoboVac. This will fail and log an error if no connection exists
def disconnect(self) -> None: try: self.s.close() except OSError as e: logging.exception(e)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disconnect(self):\n _error = None\n try:\n self.connection.shutdown()\n except Exception as e:\n log.error(e, exc_info=True)\n _error = 'disconnect error: %s' % e\n finally:\n if _error is not None and config.DEBUG_TO_CONSOLE:\n ...
[ "0.74058264", "0.7299365", "0.7143484", "0.71145785", "0.707467", "0.70231867", "0.6785303", "0.67456067", "0.6729992", "0.6712706", "0.6712316", "0.67109543", "0.6683176", "0.66676694", "0.6664143", "0.66519916", "0.6644275", "0.6620717", "0.66202325", "0.6599069", "0.658928...
0.6742653
8
Get the status of the RoboVac device (battery level, mode, charging, etc).
def get_status(self) -> RobovacStatus: message = self._build_get_device_status_user_data_message() robovac_response = self._send_packet(message, True) received_status_bytes = robovac_response.c.usr_data received_status_ints = [x for x in received_status_bytes] return RobovacStat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _do_get_status(self):\n logging.info(__name__ + ' : Get status of the device.')\n result = self._execute('X')\n usage = {\n 0: \"Channel not in use\",\n 1: \"Channel used for Nitrogen level\",\n 2: \"Channel used for Helium Level (Normal pulsed operation)\"...
[ "0.7337816", "0.7083738", "0.6949301", "0.69253254", "0.6892618", "0.67979217", "0.6779467", "0.6734082", "0.6590052", "0.65739864", "0.6554852", "0.6528611", "0.6488979", "0.6386227", "0.6384382", "0.6353202", "0.6342102", "0.63400286", "0.62900186", "0.62873715", "0.6286426...
0.80862015
0
Tell the RoboVac to start its autoclean programme.
def start_auto_clean(self): command = _build_robovac_command(RobovacModes.WORK, RobovacCommands.AUTO_CLEAN) message = self._build_command_user_data_message(command) self._send_packet(message, False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run():\r\n autostartup()", "def manual_start(self):\n self.manual_seqnum = 0\n return self.send(\"app_rc_start\")", "def execute(self):\n\t\tself.drivetrain.bad_auto_drive()\n\t\tself.drivetrain.stop_robot()", "def start():\n # Have the car begin at a stop\n rc.drive.stop()\n # ...
[ "0.6365878", "0.6246379", "0.60141903", "0.59858924", "0.59144974", "0.58120424", "0.5807724", "0.577712", "0.57759285", "0.57748395", "0.5772731", "0.5752366", "0.5745088", "0.57284355", "0.57284355", "0.57284355", "0.57284355", "0.57233566", "0.5711464", "0.5709139", "0.568...
0.6807182
0
Tell the RoboVac to start its spotclean programme.
def start_spot_clean(self): command = _build_robovac_command(RobovacModes.WORK, RobovacCommands.SPOT_CLEAN) message = self._build_command_user_data_message(command) self._send_packet(message, False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def runmain():\n\n if roboapps.Unchecked():\n roboapps.Exit()\n else:\n AddDeleteObjectsScript()", "def start_auto_clean(self):\n command = _build_robovac_command(RobovacModes.WORK, RobovacCommands.AUTO_CLEAN)\n message = self._build_command_user_data_message(command)\n\n ...
[ "0.59675306", "0.59310967", "0.5914191", "0.5898601", "0.58888316", "0.5851248", "0.5851248", "0.5851248", "0.5851248", "0.5819597", "0.57119226", "0.57067347", "0.57007897", "0.56571686", "0.56343114", "0.562878", "0.5624732", "0.5615956", "0.56120574", "0.55993724", "0.5591...
0.6891785
0
Tell the RoboVac to start its edgeclean programme.
def start_edge_clean(self): command = _build_robovac_command(RobovacModes.WORK, RobovacCommands.EDGE_CLEAN) message = self._build_command_user_data_message(command) self._send_packet(message, False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def runmain():\n\n if roboapps.Unchecked():\n roboapps.Exit()\n else:\n AddDeleteObjectsScript()", "def _commitSuicide(self):\n\n # Kill multicast and zeroconf.\n self.multicast.kill()\n self.zeroconf.kill()\n\n # Stop us from running any further.\n self.ali...
[ "0.6004148", "0.5909393", "0.5895026", "0.5822715", "0.5812425", "0.58039004", "0.5768682", "0.57507056", "0.5685349", "0.5663432", "0.56619793", "0.548184", "0.54683137", "0.5454407", "0.5450739", "0.5444596", "0.543697", "0.5409681", "0.53943235", "0.5380903", "0.53745776",...
0.77722454
0
Tell the RoboVac to clean a single room.
def start_single_room_clean(self): command = _build_robovac_command(RobovacModes.WORK, RobovacCommands.SINGLE_ROOM_CLEAN) message = self._build_command_user_data_message(command) self._send_packet(message, False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def clear(self, ctx):\n if ctx.message.author.top_role.name.lower() == 'officer':\n with SQLCursor(self.db) as cur:\n cur.execute('UPDATE govt_info SET officer = Null;')\n await ctx.message.channel.send(\n 'Successfully cleared all officers f...
[ "0.5906659", "0.59003526", "0.5829769", "0.57369155", "0.55835515", "0.5559878", "0.55521303", "0.54984415", "0.54916006", "0.542621", "0.542105", "0.5406405", "0.5371466", "0.5371127", "0.5288914", "0.52766216", "0.52469695", "0.5244343", "0.5212713", "0.520392", "0.520318",...
0.6597308
0
Tell the RoboVac to stop cleaning. The RoboVac will not return to its charging base.
def stop(self): command = _build_robovac_command(RobovacModes.WORK, RobovacCommands.STOP_CLEAN) message = self._build_command_user_data_message(command) self._send_packet(message, False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stopclean(self):\n raise Exception(\"Not implemented\")", "def stop(self):\r\n self.terminating = True", "def stop(self):\n print(\"Stopping accessory.\")", "def stop(self):\n self._current_mc_goal = None\n self._mc_goals = []\n self._position_control_client.canc...
[ "0.7290178", "0.69505924", "0.69007415", "0.67673147", "0.674806", "0.67433226", "0.67431015", "0.67431015", "0.67406785", "0.67222804", "0.67222804", "0.67222804", "0.67222804", "0.67222804", "0.6720151", "0.671741", "0.66967374", "0.6682695", "0.667672", "0.6624697", "0.662...
0.8032583
0
Tell the RoboVac to return to its charging base.
def go_home(self): command = _build_robovac_command(RobovacModes.WORK, RobovacCommands.GO_HOME) message = self._build_command_user_data_message(command) self._send_packet(message, False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def charge(self):\n self.battery.charge_level = 100\n print(\"The vehicle is fully charged.\")", "async def async_return_to_base(self, **kwargs: Any) -> None:\n await self._vacuum_bot.execute_command(Charge())", "def recharge(self):\n self.battery=self.full\n return self", ...
[ "0.6801657", "0.6714208", "0.64262426", "0.63765514", "0.63765514", "0.5897675", "0.57484204", "0.57067245", "0.5694416", "0.56131494", "0.5578027", "0.5577325", "0.5441217", "0.5410672", "0.54040366", "0.5395606", "0.53622544", "0.5350399", "0.5347923", "0.52892745", "0.5279...
0.49490553
69
Start the 'find me' mode. The RoboVac will repeatedly play a chime.
def start_find_me(self): command = _build_robovac_command(RobovacModes.FIND_ME, RobovacCommands.START_RING) message = self._build_command_user_data_message(command) self._send_packet(message, False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n global repeat\n regime = collect()\n start = int(raw_input(\"Which line of the exercise script would you like to begin with? \")) - 1\n regime = regime[start:]\n say(\"Ready?\")\n time.sleep(1)\n for exercise in regime:\n coach(exercise[:-1])\n while repeat:\n ...
[ "0.59182197", "0.5831545", "0.5824273", "0.5812982", "0.581012", "0.579923", "0.5789638", "0.572785", "0.5726542", "0.57101417", "0.56072944", "0.5601628", "0.55859745", "0.555688", "0.55301493", "0.54577565", "0.5447385", "0.5443759", "0.54365546", "0.5422701", "0.54151183",...
0.7234999
0
Stop the 'find me' mode.
def stop_find_me(self): command = _build_robovac_command(RobovacModes.FIND_ME, RobovacCommands.STOP_RING) message = self._build_command_user_data_message(command) self._send_packet(message, False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __stopSearch(self):\n self.__cancelSearch = True", "def stop_searching(self):\n self.searching = False\n self.receive_msg(\"No one is online :(\", keyboard=True)", "def continue_search( self ):\n return True;", "def stop(self):\n self._should_run = False", "def stop(self)...
[ "0.6852051", "0.65245056", "0.6441062", "0.60047376", "0.59559894", "0.59457433", "0.59007186", "0.58754736", "0.57997805", "0.5778056", "0.5762534", "0.57422465", "0.5702933", "0.5702933", "0.5696768", "0.56846666", "0.56741786", "0.5640267", "0.5640267", "0.56264794", "0.56...
0.7103667
0
Tell the RoboVac to use the standard fan speed.
def use_normal_speed(self): command = _build_robovac_command(RobovacModes.SET_SPEED, RobovacCommands.SLOW_SPEED) message = self._build_command_user_data_message(command) self._send_packet(message, False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_fan_speed(self, value):\n self.parent.fancoolers.set_speed(value)", "async def async_set_speed(self, value) -> None:\n await self.write_attributes_safe({\"fan_mode\": value})", "def set_speed():\n pass", "def setspeed(speed):\n if speed is None:\n click.echo(\"speed value i...
[ "0.76779467", "0.736443", "0.7363512", "0.7304039", "0.70294833", "0.70021176", "0.70012236", "0.6961615", "0.6888173", "0.686537", "0.67941016", "0.6766449", "0.67494905", "0.6713837", "0.6685503", "0.6615061", "0.66007936", "0.65657735", "0.65587157", "0.65497774", "0.65066...
0.74292755
1
Tell the RoboVac to use the maximum possible fan speed.
def use_max_speed(self): command = _build_robovac_command(RobovacModes.SET_SPEED, RobovacCommands.FAST_SPEED) message = self._build_command_user_data_message(command) self._send_packet(message, False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_max_speed(self, value):\n if self.mot_type == 'ims':\n return self.put_par(\"max_speed\",value)\n elif self.mot_type == 'xps8p':\n print \"asked to set the max speed to %f but max speed is read only for %s motors\\n\" % (value,mot_type)\n else:\n return self.put_par(\"max_speed\",va...
[ "0.74900687", "0.7249712", "0.7098766", "0.7085992", "0.7081822", "0.70329684", "0.7032855", "0.698288", "0.6789867", "0.6753174", "0.674114", "0.6709674", "0.6582785", "0.65548813", "0.65360487", "0.65114", "0.6508013", "0.647743", "0.63822633", "0.6367871", "0.6339305", "...
0.797232
0
Tell the RoboVac to move forward without vacuuming.
def go_forward(self): command = _build_robovac_command(RobovacModes.GO_FORWARD, RobovacCommands.MOVE) message = self._build_command_user_data_message(command) self._send_packet(message, False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_forward():\n pass", "def forward( self ):\n self._has_change = True\n print( \"Forward\" )", "def drive_forward(self):\n print(f\"{self.make.title()} is now driving forward.\")", "def moveForward(self):\n if self.onGround:\n self.vx = 4", "def go_backward(...
[ "0.69637424", "0.690487", "0.6864352", "0.6808601", "0.6727196", "0.6538748", "0.65017474", "0.64020467", "0.63450474", "0.6310254", "0.6196319", "0.6166948", "0.6153368", "0.61513495", "0.6137633", "0.61126256", "0.6086981", "0.60860014", "0.60540205", "0.6053337", "0.604309...
0.7456065
0
Tell the RoboVac to move backward without vacuuming.
def go_backward(self): command = _build_robovac_command(RobovacModes.GO_BACKWARD, RobovacCommands.MOVE) message = self._build_command_user_data_message(command) self._send_packet(message, False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_back(self):\n\n # slowly drive backwards\n self.velocity = -1 * const.Driving.CAUTIOUS_VELOCITY\n self.angle = const.Driving.NEUTRAL_STEERING_ANGLE\n\n # drive as long there is enough space to the next vehicle or obstacle\n gap = self.formation.calc_gap()\n self.s...
[ "0.7490403", "0.7196898", "0.7087098", "0.70502883", "0.69173604", "0.6865075", "0.6826124", "0.68211675", "0.6742248", "0.6675336", "0.6658164", "0.665498", "0.66415536", "0.66358215", "0.6597827", "0.6591449", "0.6572632", "0.6572632", "0.6572632", "0.65611684", "0.6511425"...
0.8243355
0
Tell the RoboVac to turn left without vacuuming.
def go_left(self): command = _build_robovac_command(RobovacModes.GO_LEFT, RobovacCommands.MOVE) message = self._build_command_user_data_message(command) self._send_packet(message, False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def turn_left(self):\n pass", "def turn_left(self):\n temp = self.direction[0]\n self.direction[0] = self.direction[1]\n self.direction[1] = -temp", "def turn_left(): #py:turn_left\n RUR._turn_left_()", "def do_left_turn(robot_name):\n global current_direction_index\n\n ...
[ "0.7898152", "0.7493305", "0.7311259", "0.70578676", "0.7055431", "0.70288837", "0.70254827", "0.69394284", "0.692184", "0.6902282", "0.68978935", "0.6850267", "0.68196297", "0.68056685", "0.6805268", "0.6805268", "0.6784195", "0.662146", "0.6527624", "0.64925176", "0.6428156...
0.78428185
1
Tell the RoboVac to turn right without vacuuming.
def go_right(self): command = _build_robovac_command(RobovacModes.GO_RIGHT, RobovacCommands.MOVE) message = self._build_command_user_data_message(command) self._send_packet(message, False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def turn_right(self):\n pass", "def turn_right(self):\n temp = self.direction[0]\n self.direction[0] = -self.direction[1]\n self.direction[1] = temp", "def rightTurn(self):\n #print('rightTurn\\r')\n #self.linearVector = Vector3(x=0.0, y=0.0, z=0.0)\n #self.ang...
[ "0.74713826", "0.6848282", "0.663373", "0.6517492", "0.63592947", "0.6337446", "0.6301318", "0.62907267", "0.62155974", "0.614369", "0.6089513", "0.6063729", "0.6042315", "0.6024011", "0.6018741", "0.601695", "0.6016896", "0.599335", "0.59697616", "0.5962759", "0.59334576", ...
0.71917444
1
Build the Protobuf message in which a given command will be sent.
def _build_command_user_data_message(self, command_payload) -> LocalServerInfo_pb2.LocalServerMessage: magic_number = self._get_magic_number() message = LocalServerInfo_pb2.LocalServerMessage() message.magic_num = magic_number message.localcode = self.local_code message.c.type = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_command_packet(self, command):\n packet = bytearray()\n # All option fields are 0\n packet.append(0)\n packet.append(0)\n packet.append(0)\n packet.append(command)\n return packet", "def build_message(cmd, data):\r\n\tif len(cmd) > CMD_FIELD_LENGTH or le...
[ "0.71574074", "0.7114962", "0.6861346", "0.6615219", "0.6598012", "0.65700155", "0.6392708", "0.63584316", "0.62669665", "0.6201957", "0.6152096", "0.609622", "0.60625875", "0.5913056", "0.590917", "0.59075266", "0.58499444", "0.58485013", "0.58368444", "0.5827621", "0.582166...
0.6367882
7
Build the Protobuf message to get the RoboVac's status.
def _build_get_device_status_user_data_message(self) -> LocalServerInfo_pb2.LocalServerMessage: magic_number = self._get_magic_number() message = LocalServerInfo_pb2.LocalServerMessage() message.localcode = self.local_code message.magic_num = magic_number message.c.type = 1 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getStatus(self, request, context):\n \n statusDrone = str(self.vehicle.system_status).rpartition(':')[2]\n\t \n return droneconnect_pb2.Status(status = statusDrone)", "def get_status(self) -> RobovacStatus:\n message = self._build_get_device_status_user_data_message()\n ...
[ "0.66486037", "0.6455113", "0.645125", "0.6440243", "0.58253676", "0.57237756", "0.5650072", "0.5634936", "0.55846244", "0.55592996", "0.5547875", "0.554475", "0.5527915", "0.55217296", "0.55016834", "0.5484239", "0.54809505", "0.54705775", "0.5444915", "0.5437128", "0.543316...
0.5854824
4
Send a ping packet and parse the response in order to retrieve the next magic number.
def _get_magic_number(self) -> int: ping = LocalServerInfo_pb2.LocalServerMessage() ping.localcode = self.local_code ping.magic_num = random.randrange(3000000) ping.a.type = 0 pong = self._send_packet(ping, True) return pong.magic_num + 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ping():\n return ping_response()", "def ping():\n return ping_response()", "def ping():\n return ping_response()", "def ping():\n return ping_response()", "def send_one_ping(self, current_socket):\n from struct import pack\n from sys import byteorder\n\n def calculate_c...
[ "0.6946966", "0.6946966", "0.6946966", "0.6946966", "0.6777358", "0.65786713", "0.65653193", "0.65452516", "0.6543392", "0.6515125", "0.64483476", "0.64037144", "0.6374881", "0.6370669", "0.6353282", "0.6351793", "0.62780064", "0.6257879", "0.6247741", "0.6244579", "0.6244173...
0.585368
46
Send a packet to the RoboVac. This method handles all the required encryption. Will attempt to reconnect to the RoboVac if sending a packet fails.
def _send_packet(self, packet: LocalServerInfo_pb2.LocalServerMessage, receive: True) -> Union[None, LocalServerInfo_pb2.LocalServerMessage]: raw_packet_data = packet.SerializeToString() encrypted_packet_data = _encrypt(raw_packet_data) try: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _send_packet(self, packet: bytes):\n self._transport.sendto(packet, self._caddr)", "def send_packet(self, pk):\n try:\n self.out_queue.put(pk, True, 2)\n except queue.Full:\n if self.link_error_callback:\n self.link_error_callback('RadioDriver: Could ...
[ "0.64176506", "0.63706136", "0.6224615", "0.6196162", "0.6173141", "0.6123173", "0.6081629", "0.6043275", "0.5993913", "0.59894913", "0.59562594", "0.59385705", "0.58800924", "0.58748245", "0.5874205", "0.58084327", "0.5799395", "0.57993656", "0.57781637", "0.5766678", "0.575...
0.6370769
1
Mark token as revoked. Any futher use will be prohibited
async def revoke_token(self, token: str, audience: str) -> None: ts = datetime.datetime.utcnow() if token in self.revoked_tokens: return None exp = datetime.datetime.fromtimestamp(get_exp_from_jwt(token, audience)) msg = { "token": token, "ts": ts.isof...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def revoke_token(self, request: Request, token: str) -> None:\n token_record = ...\n token_record.revoked = True\n token_record.save()", "def _check_token_is_revoked(self, jti: str) -> None:\n redis = self._conn_redis()\n entry = redis.get(jti)\n if entry and entry...
[ "0.7645683", "0.72017646", "0.69608617", "0.68647873", "0.6853826", "0.684368", "0.669052", "0.6648324", "0.66042507", "0.6603621", "0.6569389", "0.6490145", "0.64201844", "0.6412793", "0.640162", "0.63951135", "0.6387365", "0.6341848", "0.62859935", "0.6222544", "0.6222079",...
0.64807594
12
Check if token is revoked
def is_revoked(self, token: str) -> bool: return token in self.revoked_tokens
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_token_is_revoked(self, jti: str) -> None:\n redis = self._conn_redis()\n entry = redis.get(jti)\n if entry and entry == 'true':\n raise HTTPException(status_code=401,detail=\"Token has been revoked\")", "def is_token_revoked(decoded_token):\n jti = decoded_token['jti...
[ "0.85325533", "0.83196324", "0.81468725", "0.73686993", "0.6955454", "0.69062203", "0.69048154", "0.6787738", "0.6749311", "0.6746789", "0.6666206", "0.66284657", "0.6612462", "0.65676683", "0.6503612", "0.6446665", "0.64310426", "0.64228463", "0.641565", "0.6403295", "0.6384...
0.8320756
1
Sets the edges of this tree.
def set_edges(self, edges): assert len(edges) == self._num_edges self._tree_grid = make_tree(edges)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_edges(self, edges):\n self._tree.set_edges(edges)\n self._program = make_propagation_program(self._tree.tree_grid)", "def edges(self, edges):\n\n self._edges = edges", "def edges(self, e):\n self._edges = e", "def set_edges(self, edges):\n if (not isinstance(edges, ...
[ "0.82975215", "0.80445296", "0.7617749", "0.75694954", "0.69215083", "0.65117955", "0.65005696", "0.64635426", "0.63808835", "0.6289433", "0.6289433", "0.6232497", "0.62297255", "0.6196837", "0.61252075", "0.6041478", "0.6040774", "0.5979283", "0.5967948", "0.5943518", "0.593...
0.8505694
0
Array of (edge, vertex, vertex) triples defining the tree graph.
def tree_grid(self): return self._tree_grid
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_tree(edges):\n assert all(isinstance(edge, tuple) for edge in edges)\n edges = [tuple(sorted(edge)) for edge in edges]\n edges.sort()\n E = len(edges)\n grid = np.zeros([3, E], np.int32)\n for e, (v1, v2) in enumerate(edges):\n grid[:, e] = [e, v1, v2]\n return grid", "def ge...
[ "0.63880444", "0.6312002", "0.5951068", "0.5895804", "0.58206326", "0.58114845", "0.5742374", "0.571935", "0.5695219", "0.5693169", "0.56821394", "0.5662787", "0.56528", "0.564055", "0.5636772", "0.5633108", "0.5626143", "0.55983305", "0.55933076", "0.55809563", "0.5557511", ...
0.0
-1
Array of (edge,vertex,vertex) triples defining a complete graph.
def complete_grid(self): if self._complete_grid is None: self._complete_grid = make_complete_graph(self._num_vertices) return self._complete_grid
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def triples():", "def __generate_edges(self):\n edges = []\n for vertex in self.__graph_dict:\n for neighbour in self.__graph_dict[vertex]:\n edges.append({vertex, neighbour})\n return edges", "def vertices(self):\n return list(self._graph)", "def _get_fu...
[ "0.64511985", "0.6225497", "0.6089669", "0.6078127", "0.60043365", "0.59672356", "0.596369", "0.5945314", "0.5939956", "0.5932643", "0.5906602", "0.59002495", "0.5886755", "0.58684015", "0.585408", "0.5850255", "0.5802243", "0.5795049", "0.5792363", "0.5789071", "0.57879347",...
0.0
-1
Garbage collect temporary cached data structures.
def gc(self): self._complete_grid = None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _clean_cache(self):\n del self._cache\n self._cache = {}", "def clear_cache():\n global custom_memory, custom_hit, custom_miss\n custom_memory = {}\n custom_hit = 0\n custom_miss = 0\n return", "def cache_clear():\r\n with lock:\r\n for value in cache.values():\r\n ...
[ "0.75611293", "0.7506769", "0.7456756", "0.7451159", "0.74220824", "0.7409501", "0.7403236", "0.7331312", "0.7221713", "0.72049856", "0.7132152", "0.70808667", "0.707946", "0.70699096", "0.70602983", "0.7050341", "0.70425427", "0.7030892", "0.7029039", "0.6989614", "0.6982142...
0.0
-1
Find the edge index k of an unsorted pair of vertices (v1, v2).
def find_complete_edge(v1, v2): if v2 < v1: v1, v2 = v2, v1 return v1 + v2 * (v2 - 1) // 2
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def two_dim_index(self, k):\n ind_x = k % self.nx\n ind_y = (k - ind_x) / self.nx\n return (int(ind_y), int(ind_x))", "def getEdge(self, v1, v2):\n for e in self.edges:\n if (e.pvt, e.nvt) in [(v1, v2), (v2, v1)]:\n return e\n raise ValueError('No edge...
[ "0.66483355", "0.6608459", "0.64309686", "0.6145893", "0.61388123", "0.6077408", "0.6057086", "0.60037565", "0.59473336", "0.59444743", "0.5886797", "0.5873775", "0.5865623", "0.5845568", "0.57920057", "0.5746733", "0.57430965", "0.5738476", "0.5703548", "0.5690219", "0.56695...
0.6436228
2
Constructs a complete graph.
def make_complete_graph(num_vertices): V = num_vertices K = V * (V - 1) // 2 grid = np.zeros([3, K], np.int32) k = 0 for v2 in range(V): for v1 in range(v2): grid[:, k] = [k, v1, v2] k += 1 return grid
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _build_graph(self):\n pass", "def build_graph(self):\n pass", "def _construct_graph(self):\n raise NotImplementedError", "def build_graph(self):\n raise NotImplementedError", "def build_graph(self):\n self.__create_placeholders()\n self.__create_encoder()\n ...
[ "0.8243703", "0.8220362", "0.8075778", "0.7945168", "0.77881736", "0.76044726", "0.7493432", "0.7488559", "0.7272074", "0.7236761", "0.7100136", "0.7074048", "0.70662844", "0.7053757", "0.7029144", "0.7010218", "0.69307905", "0.68976355", "0.68897104", "0.6879398", "0.6845137...
0.0
-1
Constructs a tree graph from a set of (vertex,vertex) pairs.
def make_tree(edges): assert all(isinstance(edge, tuple) for edge in edges) edges = [tuple(sorted(edge)) for edge in edges] edges.sort() E = len(edges) grid = np.zeros([3, E], np.int32) for e, (v1, v2) in enumerate(edges): grid[:, e] = [e, v1, v2] return grid
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load(toks):\r\n graph = nx.Graph()\r\n\r\n for tok in toks:\r\n graph.add_node(tok['id'])\r\n\r\n for tok in toks:\r\n if 'governor' in tok:\r\n governor = tok['governor']\r\n dependant = tok['id']\r\n graph.add_edge(governor, dependant)\r\n return gra...
[ "0.59180105", "0.58985835", "0.58713233", "0.58263594", "0.5791507", "0.57706535", "0.5677988", "0.5671343", "0.5637893", "0.563196", "0.56312704", "0.56293726", "0.5624009", "0.5598651", "0.559182", "0.5581349", "0.55724466", "0.55438673", "0.5537198", "0.5536354", "0.553585...
0.5867547
3
Finds a maximally central vertex in a tree graph.
def find_center_of_tree(grid): E = grid.shape[1] V = 1 + E neighbors = [set() for _ in range(V)] for e, v1, v2 in grid.T: neighbors[v1].add(v2) neighbors[v2].add(v1) queue = deque() for v in reversed(range(V)): if len(neighbors[v]) <= 1: queue.append(v) wh...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def min_neighbor_node(g):\r\n return min(g.degree_iter(),key = lambda item:item[1])[0]", "def cohighest_root(self):\n return self.highest_root().associated_coroot()", "def _findMinNode(self, s):\n\n minNode = None\n minVal = self.inf\n for vertex in s:\n if self.di...
[ "0.6647326", "0.6523116", "0.6422185", "0.62768847", "0.6153244", "0.60349756", "0.60230196", "0.6022751", "0.5991634", "0.5989239", "0.59609544", "0.59592426", "0.5956262", "0.5906908", "0.5906767", "0.58962667", "0.58876103", "0.5872867", "0.58724487", "0.58300596", "0.5814...
0.63813335
3
Makes an efficient schedule for message passing on a tree.
def make_propagation_schedule(grid, root=None): if root is None: root = find_center_of_tree(grid) E = grid.shape[1] V = 1 + E neighbors = [set() for _ in range(V)] edge_dict = {} for e, v1, v2 in grid.T: neighbors[v1].add(v2) neighbors[v2].add(v1) edge_dict[v1, v2...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def algo_schedule():\n\talgo(node.id, node)\n\treactor.callLater(STEP_TIME, algo_schedule)", "def run(self):\n\n # keep track of counter\n counter = 0\n\n while self.queue:\n\n # print depth of tree every 10000 steps\n if counter % 10000 == 0:\n print(len...
[ "0.6145357", "0.5590652", "0.5394166", "0.5393599", "0.538951", "0.53780746", "0.53780746", "0.5376024", "0.53468835", "0.5345341", "0.5336988", "0.5289542", "0.5259551", "0.5243181", "0.52406275", "0.52231073", "0.5221868", "0.52196497", "0.51684105", "0.51681745", "0.514325...
0.5650114
1
Build a mutable spanning tree.
def __init__(self, grid, edges): E = len(edges) V = 1 + E K = V * (V - 1) // 2 assert grid.shape == (3, K) self.VEK = (V, E, K) self.grid = grid self.k2e = {} self.e2k = {} self.neighbors = [set() for _ in range(V)] for e, (v1, v2) in enume...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build():\n # root = TreeNode(5)\n # root.left = TreeNode(2)\n # root.right = TreeNode(7)\n # return root\n\n \"\"\"\n 5\n / \\\n 2 6\n / \\\n 1 3\n [5,2,1,3,6]\n \"\"\"\n _5 = TreeNode(5)\n _2 = TreeNode(2)\n _6 = TreeN...
[ "0.6845418", "0.6604123", "0.6500077", "0.6477746", "0.61472994", "0.6116219", "0.60032874", "0.5968627", "0.5952704", "0.58884835", "0.5878747", "0.58494556", "0.58253396", "0.5782762", "0.57099587", "0.56886274", "0.5673703", "0.5672738", "0.56644195", "0.5639138", "0.56309...
0.0
-1
Remove edge at position e from tree and update data structures.
def remove_edge(self, e): assert len(self.e2k) == self.VEK[1] assert len(self.k2e) == self.VEK[1] neighbors = self.neighbors components = self.components k = self.e2k.pop(e) self.k2e.pop(k) v1, v2 = self.grid[1:, k] neighbors[v1].remove(v2) neighbo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_edge(self, edge: Edge) -> Edge:", "def remove_edge(self, edge):\n if self.get_edge(edge):\n del self[edge[0]][edge[1]]\n del self[edge[1]][edge[0]]", "def _del(self, handle=\"\", node=\"\", edge=\"\", subg=\"\"):\n head, tail = '', ''\n if edge:\n ...
[ "0.71544826", "0.6813152", "0.6589992", "0.6541133", "0.64621186", "0.6431649", "0.6385933", "0.6373629", "0.63383347", "0.62092847", "0.62010515", "0.6177546", "0.61467075", "0.6116178", "0.6074385", "0.60594064", "0.6028453", "0.5965395", "0.5951493", "0.584998", "0.5843794...
0.7103287
1
Add edge k at location e and update data structures.
def add_edge(self, e, k): assert len(self.e2k) == self.VEK[1] - 1 assert len(self.k2e) == self.VEK[1] - 1 v1, v2 = self.grid[1:, k] assert self.components[v1] != self.components[v2] self.k2e[k] = e self.e2k[e] = k self.neighbors[v1].add(v2) self.neighbors[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_edge(self, e):\n v, w = e\n self[v][w] = e\n self[w][v] = e", "def add_edge(self, e):\n a, b = e\n self[a][b] = e\n self[b][a] = e", "def addEdge(self, e):\n v = e.either()\n w = e.other(v)\n self._validateVertex(v)\n self._validateVertex(w)\n se...
[ "0.75295997", "0.7464711", "0.6864501", "0.6483626", "0.62846744", "0.6208539", "0.6208539", "0.6100469", "0.6099873", "0.60953695", "0.608646", "0.6033433", "0.6003985", "0.5998347", "0.59671044", "0.5966964", "0.5939195", "0.5916484", "0.5904478", "0.58792466", "0.58771837"...
0.8439938
0
Sample a random spanning tree of a dense weighted graph using MCMC. This uses Gibbs sampling on edges. Consider E undirected edges that can move around a graph of V=1+E vertices. The edges are constrained so that no two edges can span the same pair of vertices and so that the edges must form a spanning tree. To Gibbs s...
def sample_tree(grid, edge_logits, edges, steps=1): logger.debug('sample_tree sampling a random spanning tree') COUNTERS.sample_tree_calls += 1 if len(edges) <= 1: return edges tree = MutableTree(grid, edges) V, E, K = tree.VEK for step in range(steps): for e in range(E): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def random_sample(G):\n E = collections.defaultdict(list) # to store the new sampled preference list\n for student in G.A:\n pref_list = G.E[student]\n E[student] = pref_list[:] # store the pref list of student in E\n for elective in pref_list:\n E[elective].append(student)\...
[ "0.6734483", "0.6609522", "0.6599776", "0.65759814", "0.64373255", "0.6393696", "0.6348071", "0.6322246", "0.62644666", "0.62157667", "0.62151515", "0.60374993", "0.59690386", "0.59388816", "0.5910111", "0.5908384", "0.58963275", "0.5890668", "0.5856513", "0.5833557", "0.5810...
0.7124525
0
Run lint checking on code.
def lint(): run('python3 -m pylint --load-plugins pylint_django api', warn=True, echo=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lint(ctx):\r\n print('Running linting...')\r\n ctx.run('pylint metrics')", "def lint():\n load_env_vars('dev')\n from tools.static_code_analysis import Lint\n pylint = Lint()\n score = pylint.run_test()\n pylint.create_badge(score)", "def commands_lint():\n lint()", "def lint(...
[ "0.79439723", "0.7824875", "0.75859296", "0.75569093", "0.7511233", "0.75109684", "0.73450893", "0.7270493", "0.7183549", "0.71542555", "0.7118254", "0.6990978", "0.69814986", "0.69713223", "0.6969975", "0.69523567", "0.68663615", "0.6837187", "0.6774124", "0.6758779", "0.674...
0.7435878
6
Tests GET method on google authenticator
def test_read_ga(self): url = reverse('admin_google_authenticator') data = { } self.client.force_authenticate(user=self.admin) response = self.client.get(url, data) self.assertEqual(response.status_code, status.HTTP_405_METHOD_NOT_ALLOWED)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_0040_registration_get(self):\n response = self.fetch(\n '/registration', method=\"GET\", follow_redirects=False\n )\n self.assertEqual(response.code, 200)", "def test_get_main_route_auth():\n set_token(client, \"user0011\")\n\n response = client.get(url)\n assert...
[ "0.692226", "0.6907537", "0.69011676", "0.684241", "0.68108356", "0.6698029", "0.6575124", "0.6575124", "0.6561964", "0.6536934", "0.65270597", "0.6493965", "0.6480874", "0.6480874", "0.6438329", "0.63903564", "0.63852197", "0.63834625", "0.63834625", "0.63336784", "0.6310726...
0.75863326
0
Tests PUT method on google authenticator
def test_update_ga(self): url = reverse('admin_google_authenticator') data = { } self.client.force_authenticate(user=self.admin) response = self.client.put(url, data) self.assertEqual(response.status_code, status.HTTP_405_METHOD_NOT_ALLOWED)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_PUT(self):\n if not self.url:\n return\n response = self.client.put(self.url, {}, format='json')\n self.assertIn(response.status_code, [status.HTTP_405_METHOD_NOT_ALLOWED,\n status.HTTP_401_UNAUTHORIZED])", "def test_put_method(...
[ "0.75060594", "0.74279714", "0.7279392", "0.7239791", "0.71154946", "0.7027044", "0.6975747", "0.6921709", "0.68776083", "0.68717974", "0.6840171", "0.6779103", "0.6754017", "0.6685355", "0.6685355", "0.6670062", "0.6611915", "0.6585054", "0.6574342", "0.6565525", "0.65529203...
0.74890983
1
Tests POST method on google authenticator
def test_create_ga(self): url = reverse('admin_google_authenticator') data = { } self.client.force_authenticate(user=self.admin) response = self.client.post(url, data) self.assertEqual(response.status_code, status.HTTP_405_METHOD_NOT_ALLOWED)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_0050_registration_post_1(self):\n response = self.fetch(\n '/registration', method=\"POST\", follow_redirects=False,\n body=urlencode({'name':'anoop', 'email':'pqr@example.com',\n 'password':'openlabs', 'confirm_password':'wrong'}\n )\n )\n ...
[ "0.71235955", "0.69123614", "0.68825096", "0.6866466", "0.68049127", "0.67935437", "0.6757084", "0.667855", "0.6642896", "0.66332465", "0.6562463", "0.6533614", "0.65188736", "0.64831114", "0.6460359", "0.6424149", "0.64141566", "0.6398847", "0.6398251", "0.6341648", "0.63391...
0.71679026
0
Tests DELETE method on ga
def test_delete_ga_success(self): url = reverse('admin_google_authenticator') data = { 'google_authenticator_id': self.ga.id } self.client.force_authenticate(user=self.admin) response = self.client.delete(url, data) self.assertEqual(response.status_code, s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_delete_ga_failure_no_ga_id(self):\n\n url = reverse('admin_google_authenticator')\n\n data = {\n }\n\n self.client.force_authenticate(user=self.admin)\n response = self.client.delete(url, data)\n\n self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST...
[ "0.74533355", "0.74531674", "0.729482", "0.72684443", "0.71412563", "0.71195805", "0.70700145", "0.70583594", "0.7056277", "0.705242", "0.7046736", "0.70302683", "0.7002286", "0.70003724", "0.6999319", "0.6964371", "0.69378275", "0.6937535", "0.6917787", "0.6901689", "0.69014...
0.73161227
2
Tests DELETE method on ga without being an admin
def test_delete_ga_failure_no_admin(self): url = reverse('admin_google_authenticator') data = { 'google_authenticator_id': self.ga.id } self.client.force_authenticate(user=self.test_user_obj) response = self.client.delete(url, data) self.assertEqual(respon...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_delete_ga_failure_no_ga_id(self):\n\n url = reverse('admin_google_authenticator')\n\n data = {\n }\n\n self.client.force_authenticate(user=self.admin)\n response = self.client.delete(url, data)\n\n self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST...
[ "0.78405344", "0.7798382", "0.7431772", "0.73222965", "0.73197466", "0.7210531", "0.71509945", "0.71504116", "0.71398807", "0.71240693", "0.71109575", "0.7097844", "0.7097153", "0.70948076", "0.705479", "0.70487773", "0.7041551", "0.70338", "0.700916", "0.6971044", "0.6954457...
0.80400723
0
Tests DELETE method on ga without a ga id
def test_delete_ga_failure_no_ga_id(self): url = reverse('admin_google_authenticator') data = { } self.client.force_authenticate(user=self.admin) response = self.client.delete(url, data) self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_delete_ga_failure_ga_id_not_exist(self):\n\n url = reverse('admin_google_authenticator')\n\n data = {\n 'google_authenticator_id': '499d3c84-e8ae-4a6b-a4c2-43c79beb069a'\n }\n\n self.client.force_authenticate(user=self.admin)\n response = self.client.delete(ur...
[ "0.75935537", "0.73303866", "0.72282845", "0.7068529", "0.6912258", "0.67213583", "0.6707342", "0.6631806", "0.66277874", "0.6619722", "0.66181743", "0.65358365", "0.6516876", "0.6516742", "0.6514221", "0.6489775", "0.6468499", "0.64639056", "0.6462968", "0.64613545", "0.6457...
0.7927357
0
Tests DELETE method on ga with a ga id that does not exist
def test_delete_ga_failure_ga_id_not_exist(self): url = reverse('admin_google_authenticator') data = { 'google_authenticator_id': '499d3c84-e8ae-4a6b-a4c2-43c79beb069a' } self.client.force_authenticate(user=self.admin) response = self.client.delete(url, data) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_delete_ga_failure_no_ga_id(self):\n\n url = reverse('admin_google_authenticator')\n\n data = {\n }\n\n self.client.force_authenticate(user=self.admin)\n response = self.client.delete(url, data)\n\n self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST...
[ "0.7988406", "0.71753716", "0.7135444", "0.6940979", "0.67862177", "0.67631596", "0.67527014", "0.67248595", "0.6668205", "0.65559757", "0.655533", "0.65383536", "0.65380216", "0.65101993", "0.6438291", "0.64287865", "0.64131516", "0.63993865", "0.6388697", "0.6383335", "0.63...
0.7812305
1
Convert a quaternion into euler angles (roll, pitch, yaw) roll is rotation around x in radians (counterclockwise) pitch is rotation around y in radians (counterclockwise) yaw is rotation around z in radians (counterclockwise)
def euler_from_quaternion(x, y, z, w): t0 = +2.0 * (w * x + y * z) t1 = +1.0 - 2.0 * (x * x + y * y) roll_x = math.atan2(t0, t1) t2 = +2.0 * (w * y - z * x) t2 = +1.0 if t2 > +1.0 else t2 t2 = -1.0 if t2 < -1.0 else t2 pitch_y = math.asin(t2) t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def euler_from_quaternion(self, quaternion):\n x = quaternion.x\n y = quaternion.y\n z = quaternion.z\n w = quaternion.w\n\n sinr_cosp = 2 * (w * x + y * z)\n cosr_cosp = 1 - 2 * (x * x + y * y)\n roll = np.arctan2(sinr_cosp, cosr_cosp)\n\n sinp = 2 * (w * y ...
[ "0.8658502", "0.8394331", "0.8320644", "0.82789195", "0.82181174", "0.81303775", "0.8088952", "0.80464375", "0.7996021", "0.7938749", "0.7929835", "0.7912955", "0.78689206", "0.7632398", "0.74772036", "0.7472176", "0.7432922", "0.7294737", "0.7286224", "0.7286224", "0.7265650...
0.8440425
1
Genetic Algorithm Series 2 Mutation Kata
def mutate(chromosome, p): code = {'0':'1', '1':'0'} return ''.join(code[num] if random() < p else num for num in chromosome)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mutation(self, base_offsprings, model_features_count) :", "def test_mutation2(self):\n genotype = '0|0|2|0|0|2|0|0 1|0|0|1|1|0|0|0 0|1|0|0|0|0|2|1--1 7'\n search_space = {'dil_conv_3x3', 'dil_conv_5x5', 'dil_conv_7x7',\n 'skip_connect', 'clinc_3x3', 'clinc_7x7', 'avg_p...
[ "0.6683951", "0.659747", "0.6590178", "0.65144646", "0.6501323", "0.64317846", "0.6423198", "0.6347183", "0.62459177", "0.61871547", "0.61618143", "0.6135696", "0.61283547", "0.6067908", "0.6061816", "0.60515577", "0.6042713", "0.60300183", "0.6026941", "0.60208184", "0.60128...
0.0
-1
Create / get S3 bucket for tests
def s3_bucket(s3_resource, s3_client, account_id, boto_session): region_name = boto_session.region_name bucket_name = f"amazon-braket-sdk-integ-tests-{account_id}" bucket = s3_resource.Bucket(bucket_name) try: # Determine if bucket exists s3_client.head_bucket(Bucket=bucket_name) e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_bucket(self):\n pass", "def mock_s3_bucket():\n with moto.mock_s3():\n bucket_name = \"mock-bucket\"\n my_config = Config(region_name=\"us-east-1\")\n s3_client = boto3.client(\"s3\", config=my_config)\n s3_client.create_bucket(Bucket=bucket_name)\n yi...
[ "0.7903016", "0.7897161", "0.78822505", "0.78671503", "0.76673317", "0.76400506", "0.76379246", "0.746405", "0.74143255", "0.73914135", "0.73775566", "0.7376731", "0.7319354", "0.73147637", "0.7291668", "0.72262007", "0.7194341", "0.7152316", "0.7140391", "0.70995533", "0.708...
0.7979803
0
Returns the module path of the test, e.g. integ_tests/test_simulator_quantum_task
def s3_prefix(): # current test path, e.g. ... # test/integ_tests/test_simulator_quantum_task.py::test_simulator_quantum_task (setup) current_test_path = os.environ.get("PYTEST_CURRENT_TEST") # strip off the filename extension and test/ return current_test_path.rsplit(".py")[0].replace("test/", ""...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_tests_directory() -> str:\n module_file_path = os.path.abspath(__file__)\n return os.path.dirname(module_file_path)", "def get_test_path():\n path, name = os.path.split(__file__)\n return os.path.join(path,\"..\", 'test-data')", "def test():\n return os.path.dirname(__file__)", "def te...
[ "0.78093123", "0.7635861", "0.74251395", "0.7400401", "0.73989546", "0.7383977", "0.72226346", "0.71984273", "0.7129021", "0.711519", "0.7034605", "0.69752324", "0.69719654", "0.6909714", "0.6781431", "0.6727347", "0.67246187", "0.67236024", "0.6715504", "0.6674065", "0.66175...
0.0
-1
Create a dictionary with file attributes for FUSE.
def create_file_attributes(permissions, time, size): return { 'st_mode': (stat.S_IFREG | permissions), 'st_ctime': time, 'st_mtime': time, 'st_atime': time, 'st_size': size, 'st_uid': os.getuid(), 'st_gid': os.getgid(), 'st_nlink': 1 }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_file_hash_dict(cls, file, file_path):\n\n file_info = {}\n file_info['path'] = file_path\n file_info['hash'] = cls.get_256_hash_from_file(file_path)\n file_info['type'] = 'file'\n file_info['name'] = file\n file_info['perm'] = stat.S_IMODE(os.lstat(file_path).st...
[ "0.6876256", "0.6477355", "0.642789", "0.63974553", "0.6374335", "0.636785", "0.63562584", "0.6264039", "0.62063867", "0.61930203", "0.6149867", "0.61277133", "0.60900444", "0.6011493", "0.59660053", "0.59634185", "0.5940534", "0.5900107", "0.58942765", "0.5891259", "0.588044...
0.7342417
0
Create a dictionary with directory attributes for FUSE.
def create_directory_attributes(time): return { 'st_mode': (stat.S_IFDIR | 0o555), 'st_ctime': time, 'st_mtime': time, 'st_atime': time, 'st_uid': os.getuid(), 'st_gid': os.getgid(), 'st_nlink': 2 }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_filesystem_can_get_attributes_of_directory(self):\n time.time = MagicMock(return_value=time.time())\n self.index.photos_directory_exists = MagicMock(return_value=True)\n self.index.photos_unique_domains = MagicMock(\n return_value=['example.com']\n )\n self.in...
[ "0.65125257", "0.63955706", "0.622794", "0.61981", "0.5993693", "0.59099", "0.5832498", "0.58114654", "0.57562417", "0.57512605", "0.5694966", "0.562954", "0.5596386", "0.5554438", "0.5540832", "0.5540053", "0.55319875", "0.5529663", "0.5522666", "0.5500827", "0.54975873", ...
0.7701529
0
Initialize representation of GitLab entity.
def __init__(self, type, path, attributes, objects={}): self.type = type self.path = path self.attributes = attributes self.objects = objects
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, entity):\n self.entity = entity\n self.entityId = entity.id\n self.graph = entity.graph", "def __init__(self):\n self.id = \"Entity\"\n self.collidable = True", "def _from_raw_entity(cls, *args, **kwargs):\n args = list(*args)\n kwargs = dict...
[ "0.618951", "0.58844995", "0.58707464", "0.5808424", "0.57953954", "0.57892805", "0.57714236", "0.57607937", "0.5750298", "0.5735577", "0.5648388", "0.5612872", "0.55959785", "0.55893284", "0.55888414", "0.556057", "0.5520397", "0.5514096", "0.54946595", "0.5476402", "0.54602...
0.0
-1
Initialize the file system resolver.
def __init__(self, cache, userProjects, tagRefs, commitTimes): self.cache = cache self.userProjects = userProjects self.tagRefs = tagRefs self.commitTimes = commitTimes self.initTime = time.time()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, resolver_context, path_spec):\n super(FATFileSystem, self).__init__(resolver_context, path_spec)\n self._file_object = None\n self._fsfat_volume = None\n self._root_directory_identifier = None", "def Init(self):\n # First iteration over all the files in root searching for symlin...
[ "0.66651976", "0.6454042", "0.6405603", "0.6320611", "0.61738366", "0.60796", "0.6059691", "0.60032433", "0.5938865", "0.5936926", "0.59035516", "0.5886037", "0.5838677", "0.5831634", "0.57965046", "0.5789152", "0.57848793", "0.5781777", "0.57721424", "0.572982", "0.57222754"...
0.0
-1
Try to resolve a path as the root of GitLab.
def resolve_root(self, path): if path == '/': return Entity( EntityType.ROOT, path, create_directory_attributes(self.initTime) ) else: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resolve(self, path=''):\n path = self._sep.join([self.root] + path.split('/'))\n return realpath(path)", "def get_root_path(path):\n if not path:\n path = __opts__.get(\"lxc.root_path\", DEFAULT_PATH)\n return path", "def tree_resolveRoot():\n nonlocal str_rootDir\n ...
[ "0.6627316", "0.65395856", "0.6411151", "0.6311288", "0.6179841", "0.6124331", "0.6040856", "0.6008679", "0.59778094", "0.5957935", "0.593507", "0.58837634", "0.5880615", "0.5872995", "0.5865999", "0.58497477", "0.58220285", "0.58143073", "0.5784655", "0.5780079", "0.5760934"...
0.5864452
15
Try to resolve a path as the root of a project, group or user.
def resolve_tree(self, path): try: node = self.cache.get_tree(self.userProjects)[path] if type(node) is gitlab.v4.objects.Group: # Groups API does not return a creation time return Entity( EntityType.GROUP, path, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resolve(self, path=''):\n path = self._sep.join([self.root] + path.split('/'))\n return realpath(path)", "def resolvePath_(cls, path):\r\n try:\r\n fsref, isFolder, wasAliased = FSResolveAliasFile(os.path.realpath(path), 1)\r\n return os.path.abspath(fsref.as_pathna...
[ "0.690271", "0.6536511", "0.63718057", "0.63490874", "0.6301866", "0.62900126", "0.6237765", "0.61903673", "0.61896497", "0.6180588", "0.6035004", "0.60347724", "0.6028328", "0.59886265", "0.59836733", "0.59700334", "0.5952076", "0.5937991", "0.5922994", "0.59141296", "0.5866...
0.5268292
96
Try to resolve a path as something within a project.
def resolve_project_prefix(self, path): for nodePath, node in self.cache.get_tree(self.userProjects).items(): if type(node) is gitlab.v4.objects.Project and path.startswith(nodePath): remainingPath = pathlib.Path(path).relative_to(pathlib.Path(nodePath)) return node,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resolve(self, path=''):\n path = self._sep.join([self.root] + path.split('/'))\n return realpath(path)", "def resolve(name):\n arg = Path(name)\n return str(arg.resolve())", "def resolve_path(self, path):\n if path:\n if path[0] == '/':\n #zope objects c...
[ "0.6934809", "0.6887386", "0.6778996", "0.676396", "0.6690466", "0.64114004", "0.6330802", "0.6270743", "0.6252713", "0.6207397", "0.61828643", "0.61801094", "0.6173589", "0.6131582", "0.60505766", "0.59710646", "0.59427816", "0.59411895", "0.59350175", "0.5914711", "0.591217...
0.65733105
5
Try to resolve a path as something within a ref of a project.
def resolve_ref_prefix(self, path): project, remainingPath = self.resolve_project_prefix(path) if not project: return None, None, None for ref in self.cache.list_project_refs(project, self.tagRefs): try: treePath = remainingPath.relative_to(pathlib.Path(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resolve_ref(ref):\n if ref == DIRTY:\n return ref\n try:\n return git_rev_parse(ref)\n except CommandFailure:\n for remote in git_remote():\n try:\n return git_rev_parse('{remote}/{ref}'.format(**locals()))\n except CommandFailure:\n ...
[ "0.7151219", "0.694133", "0.69117504", "0.6790696", "0.6727154", "0.67200303", "0.66987157", "0.6604326", "0.64834887", "0.64398366", "0.6264806", "0.6253427", "0.6241761", "0.6132966", "0.60928077", "0.6074949", "0.6051343", "0.60149103", "0.5935395", "0.59204805", "0.590934...
0.69918907
1
Try to resolve a path as a level within a hierarchical ref. Hierarchical refs are refs with path separators in the name, e.g. "feature/abc". These are represented as subdirectories.
def resolve_partial_ref_prefix(self, path): project, remainingPath = self.resolve_project_prefix(path) if not project: return None, None, None refPrefix = remainingPath.as_posix() + '/' # Resolve to most recently created reference for accurate directory dates refs ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resolve_ref_hierarchy(self, path):\n\n project, ref, refPrefix = self.resolve_partial_ref_prefix(path)\n if not ref:\n return None\n\n refTime = iso8601.parse_date(ref.commit['committed_date']).timestamp()\n\n return Entity(\n EntityType.REF_LEVEL,\n ...
[ "0.7083054", "0.63171655", "0.6166925", "0.6088653", "0.60575944", "0.60505044", "0.5844372", "0.5776457", "0.5743886", "0.57406354", "0.5682527", "0.56766284", "0.562611", "0.55301744", "0.5519565", "0.54597354", "0.5437064", "0.5421615", "0.5392106", "0.53883", "0.5365276",...
0.56345916
12
Try to resolve a path as the root of a ref.
def resolve_ref(self, path): project, ref, remainingPath = self.resolve_ref_prefix(path) if not ref or remainingPath.as_posix() != '.': return None refTime = iso8601.parse_date(ref.commit['committed_date']).timestamp() return Entity( EntityType.REPOSITORY_DIR, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resolve(self, path=''):\n path = self._sep.join([self.root] + path.split('/'))\n return realpath(path)", "def resolvePath_(cls, path):\r\n try:\r\n fsref, isFolder, wasAliased = FSResolveAliasFile(os.path.realpath(path), 1)\r\n return os.path.abspath(fsref.as_pathna...
[ "0.7158143", "0.68397033", "0.676219", "0.67599744", "0.67315334", "0.6719798", "0.67155963", "0.6660632", "0.6504497", "0.62912154", "0.62896556", "0.62786454", "0.6272115", "0.61823636", "0.61473644", "0.61236966", "0.6055172", "0.6030336", "0.6001333", "0.59940606", "0.597...
0.6833471
2
Try to resolve a path as a level within a hierarchical ref.
def resolve_ref_hierarchy(self, path): project, ref, refPrefix = self.resolve_partial_ref_prefix(path) if not ref: return None refTime = iso8601.parse_date(ref.commit['committed_date']).timestamp() return Entity( EntityType.REF_LEVEL, path, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resolve_path(self, path):\n if path:\n if path[0] == '/':\n #zope objects case\n try: return self.unrestrictedTraverse(path)\n except: pass\n else:\n #aliss (python) objects case\n try: return self.get...
[ "0.68845683", "0.6494105", "0.64544624", "0.611602", "0.60794085", "0.60687786", "0.58192456", "0.57265294", "0.5710625", "0.5643911", "0.5628097", "0.5625242", "0.5588643", "0.5578107", "0.5544796", "0.54888475", "0.54879767", "0.5432573", "0.5405383", "0.54042643", "0.53942...
0.71775824
0
Look up the metadata of a file or directory within a repository.
def get_entry_properties(self, project, ref, path): parentDir = os.path.dirname(path) targetEntry = os.path.basename(path) for entry in self.cache.get_repository_tree(project, ref, parentDir): if entry['name'] == targetEntry: return entry
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_metadata_dir(cube, image):\n return find_subdir(cube, image, 'metadata')", "def resolve_repository_entry(self, path):\n\n project, ref, remainingPath = self.resolve_ref_prefix(path)\n if not ref or remainingPath.as_posix() == '.':\n return None\n\n # List parent direct...
[ "0.6102338", "0.60847425", "0.6036308", "0.602743", "0.60198724", "0.5919105", "0.5852067", "0.5826634", "0.5822364", "0.5773433", "0.5750003", "0.5734359", "0.57308424", "0.5725022", "0.57172215", "0.5717111", "0.5690545", "0.564716", "0.5642018", "0.56113255", "0.5608384", ...
0.563605
19
Try to resolve a path as a file or directory within a repository.
def resolve_repository_entry(self, path): project, ref, remainingPath = self.resolve_ref_prefix(path) if not ref or remainingPath.as_posix() == '.': return None # List parent directory to retrieve entry attributes entry = self.get_entry_properties(project, ref, remainingPat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resolve_path(self, path):\n\n return (\n self.resolve_root(path) or\n self.resolve_tree(path) or\n self.resolve_ref(path) or\n self.resolve_ref_hierarchy(path) or\n self.resolve_repository_entry(path)\n )", "def resolve_ref(self, path):\n\n...
[ "0.68616205", "0.68089205", "0.67671317", "0.67423475", "0.6646243", "0.6432447", "0.6429983", "0.6377379", "0.6271489", "0.62465775", "0.62411714", "0.61927146", "0.61853814", "0.61749536", "0.6146664", "0.61309797", "0.6083962", "0.6030374", "0.602124", "0.5964621", "0.5959...
0.63734597
8
Try to resolve path within the file system to an entity in GitLab. Possible entities are the GitLab root, a user, a group, a project, a ref, a level within a hierarchical ref, a file/directory within a repository.
def resolve_path(self, path): return ( self.resolve_root(path) or self.resolve_tree(path) or self.resolve_ref(path) or self.resolve_ref_hierarchy(path) or self.resolve_repository_entry(path) )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resolve_ref(self, path):\n\n project, ref, remainingPath = self.resolve_ref_prefix(path)\n if not ref or remainingPath.as_posix() != '.':\n return None\n\n refTime = iso8601.parse_date(ref.commit['committed_date']).timestamp()\n\n return Entity(\n EntityType.RE...
[ "0.6733887", "0.64819473", "0.6213757", "0.6091954", "0.602784", "0.5898667", "0.56925225", "0.5669906", "0.5537425", "0.5517365", "0.5503569", "0.54642767", "0.5407319", "0.5407319", "0.54026914", "0.54006654", "0.5364596", "0.5275467", "0.52693933", "0.5257743", "0.5219513"...
0.5172114
23
List the contents of the GitLab root or a group.
def list_group_members(self, entity): members = [] for nodePath, node in self.cache.get_tree(self.userProjects).items(): if nodePath.startswith(entity.path): # Check if node is a direct child distance = len(pathlib.Path(nodePath).relative_to(pathlib.Path(ent...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_(ctx: click.Context, repository_path):\n root_commands.cmd_list(ctx.obj, repository_path)", "def list_contents(self):\n return self.client._perform_json(\n \"GET\", \"/projects/%s/managedfolders/%s/contents\" % (self.project_key, self.odb_id))", "def ls():", "def do_list(cs,...
[ "0.6478454", "0.6235852", "0.61887836", "0.6117999", "0.6080297", "0.6012697", "0.60123533", "0.59908193", "0.5955391", "0.59314483", "0.59058386", "0.5902762", "0.57658863", "0.57290226", "0.5685083", "0.56776917", "0.5621663", "0.55823565", "0.5523122", "0.5485514", "0.5473...
0.54168254
27
List the first level of refs of a project. If the project contains hierarchical refs then only the first level of those is returned. For example, a repository containing the branches "master", "feature/abc" and "feature/def" will have this function return the list ["master", "feature"].
def list_project_refs(self, entity): refs = [] for ref in self.cache.list_project_refs(entity.objects['project'], self.tagRefs): # If ref name is hierarchical then only return first level if '/' in ref.name: refs.append(ref.name.split('/')[0]) else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_project_ref_hierarchy(self, entity):\n\n refs = []\n\n for ref in self.cache.list_project_refs(entity.objects['project'], self.tagRefs):\n if ref.name.startswith(entity.objects['refPrefix']):\n remainingRefName = pathlib.Path(ref.name).relative_to(pathlib.Path(entit...
[ "0.71141195", "0.6230946", "0.6007423", "0.5812723", "0.57256657", "0.56375396", "0.5635291", "0.5497794", "0.54817456", "0.5463489", "0.54529834", "0.5440121", "0.5424686", "0.54045993", "0.53898203", "0.5383756", "0.53767204", "0.5367718", "0.53592324", "0.53535324", "0.535...
0.7210496
0
List next level in a ref hierarchy. For example, if the repository has the branches "feature/abc" and "feature/foo/bar" and the entity represents the hierarchy "feature", then this function will return the list ["abc", "foo"].
def list_project_ref_hierarchy(self, entity): refs = [] for ref in self.cache.list_project_refs(entity.objects['project'], self.tagRefs): if ref.name.startswith(entity.objects['refPrefix']): remainingRefName = pathlib.Path(ref.name).relative_to(pathlib.Path(entity.objects['...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def branches(tree):\n\n return tree[1:]", "def branches(tree):\n return tree[1:]", "def build_path(start, end):\n a = hierarchy.index(start)\n b = hierarchy.index(end)\n if a == b:\n return []\n elif a < b:\n return hierarchy[a + 1...
[ "0.628577", "0.628163", "0.5824929", "0.5799567", "0.5672311", "0.5668305", "0.5644412", "0.5544443", "0.55360305", "0.5526298", "0.5518737", "0.55093133", "0.55090725", "0.5469575", "0.5450401", "0.54025507", "0.5400553", "0.5378465", "0.53740335", "0.5371568", "0.5359254", ...
0.6108173
2
List the files and directories in a repository subdirectory.
def list_repository_directory(self, entity): members = [] # There is no directory object if this is the repository root path = '' if 'directory' in entity.objects: path = entity.objects['directory']['path'] for entry in self.cache.get_repository_tree(entity.objects...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_dir(self, path):", "def listdir(self, subdir=''):\n\n try:\n subdir = subdir.decode()\n except AttributeError:\n pass\n subdir = subdir.rstrip('\\\\')\n # cmd = '\"%s\" \"%s\" 0 ' % (self.ndc_path, self.filename)\n cmd = [\n self.ndc_pa...
[ "0.72475857", "0.6898686", "0.679878", "0.6662444", "0.6644059", "0.6518236", "0.650587", "0.65055865", "0.6437218", "0.6381191", "0.63552994", "0.6319831", "0.6308276", "0.6297127", "0.6295903", "0.6278944", "0.62660915", "0.62306625", "0.62177086", "0.61986166", "0.6197154"...
0.7076131
1
List the files and directories contained within an entity.
def list_members(self, entity): if entity.type in (EntityType.ROOT, EntityType.GROUP, EntityType.USER): return self.list_group_members(entity) elif entity.type == EntityType.PROJECT: return self.list_project_refs(entity) elif entity.type == EntityType.REF_LEVEL: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_repository_directory(self, entity):\n\n members = []\n\n # There is no directory object if this is the repository root\n path = ''\n if 'directory' in entity.objects:\n path = entity.objects['directory']['path']\n\n for entry in self.cache.get_repository_tree(...
[ "0.6931735", "0.64941585", "0.6350983", "0.62931013", "0.62610745", "0.6127575", "0.59631383", "0.596008", "0.5944727", "0.58492106", "0.57940483", "0.5714732", "0.5675481", "0.56426316", "0.56156147", "0.55765754", "0.5528876", "0.5527516", "0.54939073", "0.5470683", "0.5466...
0.59459406
8
Read the contents of a file within a repository.
def read_file(self, entity): return self.cache.read_file( entity.objects['project'], entity.objects['ref'], entity.objects['file']['path'] )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read(path, repo=None, rev=None, remote=None, mode=\"r\", encoding=None):\n with open(\n path, repo=repo, rev=rev, remote=remote, mode=mode, encoding=encoding\n ) as fd:\n return fd.read()", "def read_remote_file(org, repo, filename):\n import fsspec\n fs = fsspec.filesystem('github'...
[ "0.7463273", "0.73486316", "0.67677706", "0.67227525", "0.67103326", "0.66863436", "0.6624134", "0.6614854", "0.6582675", "0.6582608", "0.65781784", "0.6578013", "0.6500588", "0.64815813", "0.6477911", "0.64673215", "0.6418968", "0.6413917", "0.6413364", "0.64011514", "0.6396...
0.65776736
12
finds vocabulary of most common words
def build_vocab(vocab_size, text_vector): vocab = Counter() for text in text_vector: for word in text.split(' '): vocab[word.lower()]+=1 vocab = dict(vocab.most_common(vocab_size)) return vocab
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def most_common_words(visual_fld, num_visualize):\n words = open(os.path.join(visual_fld, 'vocab.tsv'), 'r').readlines()[:num_visualize]\n words = [word for word in words]\n file = open(os.path.join(visual_fld, 'vocab_' + str(num_visualize) + '.tsv'), 'w')\n for word in words:\n file.write(word)...
[ "0.775419", "0.77309126", "0.74182653", "0.7409785", "0.7284831", "0.7149859", "0.71251553", "0.7120683", "0.7119584", "0.70991653", "0.6979212", "0.69507486", "0.69414645", "0.6915469", "0.69110715", "0.690816", "0.68818724", "0.6862488", "0.6845334", "0.68444467", "0.684331...
0.69118845
14
maps words to indexes and indexes to words
def build_idx(vocab): word2index = {} index2word = {} word2index['PAD'] = 0 index2word[0] = 'PAD' word2index['UNK'] = 1 index2word[1] = 'UNK' for i,word in enumerate(vocab): word2index[word.lower()] = i+2 index2word[i+2] = word.lower() return word2index, index2word
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index_words(self, tokens):\n for token in tokens:\n self.index_word(token)", "def assign_index(self):\n\n i = 0\n for word in self.words:\n self.index[word] = i\n i += 1", "def makewordindex(wordset):\n indexmap = {}\n sortwords = sorted(list(word...
[ "0.7252914", "0.70432985", "0.701575", "0.6997091", "0.69807357", "0.6950359", "0.6769931", "0.6704171", "0.66719717", "0.6648976", "0.66482", "0.66081357", "0.65770143", "0.65029114", "0.6498602", "0.6467073", "0.6453668", "0.63865435", "0.63435173", "0.6322079", "0.63152295...
0.66767716
8
creates a dictionary mapping words to vectors from a file in glove format.
def load_glove(path): with open(path) as f: glove = {} for line in f.readlines(): values = line.split() word = values[0] vector = np.array(values[1:], dtype='float32') glove[word] = vector return glove
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_glove_vectors(filename, vocab):\n dct = {}\n vectors = array.array('d')\n current_idx = 0\n with open(filename, \"r\", encoding=\"utf-8\") as f:\n for _, line in enumerate(f):\n tokens = line.split(\" \")\n word = tokens[0]\n entries = tokens[1:]\n ...
[ "0.7872066", "0.7822317", "0.7803402", "0.773668", "0.76653683", "0.76456594", "0.7515433", "0.74748117", "0.74432373", "0.7349376", "0.73245424", "0.7257778", "0.71403354", "0.69980514", "0.6923961", "0.6913827", "0.68911874", "0.6850241", "0.6782222", "0.6778973", "0.676920...
0.78527766
2
creates matrix of weights for initializing model
def build_weights_matrix(vectors, custom_vectors, index2word, size = 200): weights_matrix = np.zeros((len(index2word), size)) words_found = 0 words_found_custom = 0 for i, word in index2word.items(): try: weights_matrix[i] = vectors[index2word[i]] words_found += 1 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_weight_matrices(self):\n rad = 1 / np.sqrt(self.no_of_in_nodes)\n X = truncated_normal(mean=0, \n sd=1, \n low=-rad, \n upp=rad)\n self.wih = X.rvs((self.no_of_hidden_nodes, \n ...
[ "0.7649499", "0.7611768", "0.7506169", "0.7479169", "0.7474342", "0.7461102", "0.73930156", "0.7358004", "0.7313795", "0.7313795", "0.7313795", "0.7183413", "0.7164924", "0.7148157", "0.7132788", "0.71249264", "0.71110785", "0.7056451", "0.7042973", "0.7035369", "0.70333064",...
0.0
-1
Generates a neural network, loads in the neural network the pretrained weights and returns it
def load_trained_net(mal): model_root = os.path.join(os.getcwd(), 'data', 'models') model = load_model(os.path.join(model_root, 'model_' + mal + '.h5')) return model
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_neural_network():\n network_input = keras.layers.Input((NETWORK_INPUT_SIZE,))\n network_layer = keras.layers.Dense(100, kernel_initializer='random_uniform', activation='tanh')(network_input)\n network_layer = keras.layers.Dense(100, kernel_initializer='random_uniform', activation='tanh')(networ...
[ "0.72211665", "0.6989545", "0.691787", "0.68599683", "0.6806396", "0.67911756", "0.673781", "0.67262", "0.67232573", "0.6720266", "0.6650897", "0.6609338", "0.6548752", "0.65487474", "0.64965564", "0.6478279", "0.6458644", "0.6434097", "0.6420369", "0.63694394", "0.6340657", ...
0.59846586
76
serialize 8puzzle as a list
def serialize(self): out_list = [[0, 0, 0], [0, 0, 0], [0, 0, 0]] for num, (i, j) in self.num_to_pos.items(): out_list[i][j] = num return out_list
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_puzzle(self):\n return [[str(self.puzzle[i][j]) for j in range(len(self.puzzle[0]))] for i in range(len(self.puzzle))]", "def to_serialized_squares(self):\n squares = []\n for lst in self.squares:\n for square in lst:\n if square.piece is not None:\n ...
[ "0.7210576", "0.6539963", "0.64236814", "0.6023961", "0.58657527", "0.57082915", "0.57016265", "0.56858224", "0.5656728", "0.5629069", "0.56288236", "0.5575809", "0.5530928", "0.54482836", "0.5439512", "0.5424969", "0.54230714", "0.54221", "0.54170394", "0.54147243", "0.53749...
0.64490455
2
parses list into dictionary
def parse_string(self, matrix): for idx, row in enumerate(matrix): for idy, item in enumerate(row): self.o_pos_to_num[(idx, idy)] = item self.pos_to_num[(idx, idy)] = item self.o_num_to_pos[item] = (idx, idy) self.num_to_pos[item] = (id...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _to_dict(self, data_list):\n data_dict = dict(pair.split('=') for pair in data_list)\n return data_dict", "def list_to_dict(l):\n d={}\n for index, item in enumerate(l[::2]):\n key=item\n value=l[index*2+1]\n if isinstance(value, list) and value!=[]:\n d[ke...
[ "0.7523799", "0.7392252", "0.737996", "0.7369746", "0.73022676", "0.7256729", "0.71957433", "0.7081124", "0.70589614", "0.68366456", "0.67842054", "0.67557216", "0.67407894", "0.6731518", "0.6729844", "0.6662784", "0.6661105", "0.66404027", "0.6587015", "0.6587", "0.6570602",...
0.0
-1
returns to start state
def __originate__(self): self.pos_to_num = deepcopy(self.o_pos_to_num) self.num_to_pos = deepcopy(self.o_num_to_pos)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getStartState(self):\n \n pass", "def get_start_state(self):\r\n util.raiseNotDefined()", "def getStartState(self):\r\n util.raiseNotDefined()", "def getStartState(self):\n util.raiseNotDefined()", "def getStartState(self):\n util.raiseNotDefined()", "def getStartState...
[ "0.8029065", "0.76474124", "0.76469773", "0.76025265", "0.76025265", "0.76025265", "0.76025265", "0.76025265", "0.76025265", "0.76025265", "0.76025265", "0.76025265", "0.74527085", "0.739843", "0.7343516", "0.7343516", "0.7239736", "0.7239736", "0.7239736", "0.7239736", "0.72...
0.0
-1
get position of given number
def __getpos__(self, num): return self.num_to_pos[num]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_position(self, number):\n for rowidx, row in enumerate(self.numbers):\n for colidx, num in enumerate(row):\n if num == number:\n return rowidx, colidx", "def find_next_number(line, pos=0):\n m = number_re.search(line[pos:])\n if m:\n span =...
[ "0.7684351", "0.7131418", "0.700196", "0.69044185", "0.6890738", "0.67569715", "0.6752947", "0.66520596", "0.66395706", "0.66072875", "0.65305483", "0.6527862", "0.6512868", "0.6511938", "0.64501953", "0.6410245", "0.64076304", "0.6384556", "0.6376679", "0.6374092", "0.635429...
0.8127358
0
get number of given position
def __getnum__(self, i, j): return self.pos_to_num[(i, j)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index(self, pos):\n for i, n in enumerate(self):\n if i == pos: return n\n raise Exception('Index out of bounds.')", "def __getpos__(self, num):\n return self.num_to_pos[num]", "def index_from_position_tuple(self, position):\n x = self.base_values.index(position[0])\n...
[ "0.71495557", "0.69940645", "0.68391985", "0.68316877", "0.6732671", "0.6732671", "0.6732671", "0.6710861", "0.6685918", "0.6596105", "0.65753883", "0.6539336", "0.6538594", "0.6503329", "0.6484679", "0.6478622", "0.6478622", "0.6475727", "0.6465286", "0.64546746", "0.6451935...
0.6618465
9
check whether it is a position or number
def __getitem__(self, ids): if isinstance(ids, tuple): return self.__getnum__(ids[0], ids[1]) elif isinstance(ids, int): return self.__getpos__(ids) else: raise RuntimeError("No such indexing exist")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _is_pos_int(number: int) -> bool:\n return type(number) == int and number >= 0", "def _is_valid_position(self, position):\n if type(position) is not int:\n raise TypeError\n\n if position > 9 or position < 1:\n raise ValueError\n\n #confirm position is open\n ...
[ "0.7454772", "0.70766246", "0.70479846", "0.7018222", "0.7017301", "0.6955626", "0.68349755", "0.681943", "0.6815421", "0.67872006", "0.678655", "0.6683896", "0.66751856", "0.662978", "0.6567331", "0.65461534", "0.6511649", "0.6509801", "0.64916897", "0.6488052", "0.6485889",...
0.0
-1
check whether two puzzles are same
def __eq__(self, p_object): if any([self[i] != p_object[i] for i in range(9)]): return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_not_repeat_combination(self):\n self.assertTrue(\"-Yao Ming Zydrunas Ilgauskas\", show_players_sumheigh_is_input(177))\n self.assertFalse(show_players_sumheigh_is_input(177), \"-Zydrunas Ilgauskas Yao Ming\")", "def testEquality(self):\n pass", "def test_shuffle():\n ...
[ "0.6587429", "0.65687144", "0.6512989", "0.6475317", "0.6438711", "0.642848", "0.6350298", "0.63349354", "0.63321745", "0.6326709", "0.63148427", "0.6299561", "0.6268951", "0.6265781", "0.6244889", "0.62402105", "0.62148035", "0.61950046", "0.6176016", "0.61597943", "0.612642...
0.0
-1
stringfy the puzzles current state
def __str__(self): outstr = "" for i in range(3): for j in range(3): outstr += str(self.pos_to_num[(i, j)]) + " " outstr = outstr[:-1] outstr += "\n" outstr += "\n" return outstr
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def expected_rubbish(self):", "def gen_solve_to_text(self):\n\n count = 0\n self.url = \"scramble: \\n\"\n for move in self.scramble.split():\n self.url += \"{} \".format(move)\n self.url += \"\\n\\nsolve:\\n\"\n\n for move in self.solve_stats:\n if self.c...
[ "0.58802515", "0.5804887", "0.56980556", "0.5681657", "0.5680751", "0.56128657", "0.55399585", "0.5490973", "0.5449967", "0.54456043", "0.54443526", "0.54291534", "0.54219836", "0.54038286", "0.53878576", "0.5365584", "0.5350794", "0.53495085", "0.5334257", "0.53250957", "0.5...
0.0
-1
for calculating the manhattan distance
def calc_manhattan(self, p_object): total = sum([self.manhattan(self[num], p_object[num]) for num in sorted(self.num_to_pos)[1:]]) return total
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_manhattan_dist(state):", "def manhattan_distance(x, y):\n return abs(x) + abs(y)", "def manhattan(self):\n distance = 0\n for i in range(3):\n for j in range(3):\n if self.plateau[i][j] != 0:\n x, y = divmod(self.plateau[i][j]-1, 3)\n ...
[ "0.8330407", "0.8171054", "0.81170785", "0.80762315", "0.79278284", "0.78889275", "0.78721213", "0.7867139", "0.7859445", "0.78317213", "0.78230524", "0.7797991", "0.778056", "0.7692627", "0.7649791", "0.7639458", "0.76113653", "0.7609364", "0.7578994", "0.75564617", "0.75064...
0.7242305
33
obtain the cells for change
def get_near_ones(self): near_ones = [] z_i, z_j = self[0] for i, j in [(-1, 0), (0, -1), (1, 0), (0, 1)]: try: near_ones.append(self[(z_i+i, z_j+j)]) except KeyError: pass return near_ones
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_cells(self):\n raise NotImplementedError", "def cells(self):\n return self.container['cells']", "def on_tableWidget_mesures_cellChanged(self, row, column):\n# print(\"row {} column {}\".format(row, column))\n if column not in [4, 5, 7]:\n try:\n \n ...
[ "0.6759809", "0.6349441", "0.6135768", "0.6130935", "0.60429335", "0.60389924", "0.6032569", "0.60288227", "0.6012943", "0.59234416", "0.5911008", "0.59031785", "0.58899987", "0.5889714", "0.5836065", "0.58013815", "0.5782117", "0.5743886", "0.57251555", "0.5714142", "0.56869...
0.0
-1
function which change cells
def change(self, num): if self.manhattan(self[0], self[num]) != 1: raise RuntimeError( "Numbers {} {} in positions {} {} can't change".format(0, num, self[0], self[num])) z_i, z_j = self[0] n_i, n_j = self[num] self.pos_to_num[(z_i, z_j)] = num self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_cell_change(self, x, y):\n self.cells[x][y] = 1 if not self.cells[x][y] else 0", "def set_cell(self, x, y, val):\n pass", "def set_cell(self, x, y, val):\n pass", "def change_cell(self, event):\n try:\n (x, y) = self.get_id_from_coor(event.x, event.y)\n ...
[ "0.6896934", "0.6808124", "0.6808124", "0.65829647", "0.64646584", "0.6426838", "0.6295545", "0.62578285", "0.62558246", "0.623808", "0.623025", "0.6221029", "0.6152693", "0.61430186", "0.61128366", "0.6098462", "0.60698485", "0.60682225", "0.6063222", "0.6062826", "0.5999686...
0.0
-1
function which expand current node
def branchize(self): near_ones = self.get_near_ones() if self.current_branch["g_score"] == 31: return for item in near_ones: if self.current_branch.get("move") and self.current_branch["move"] == item: continue self.change(item) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def expand(self, node):\n node.expand(self.selPolicy)", "def expand(node):\n if node.isTerminal():\n return node\n\n # Get the next unexplored state\n nextState = node.exploreChildNode()\n\n # If all states are already explored, recurse\n if nextState is not None:\n return nex...
[ "0.70458555", "0.67316216", "0.67251015", "0.6556932", "0.6524738", "0.64522743", "0.64522743", "0.644607", "0.64240474", "0.6396013", "0.6383837", "0.63266814", "0.6272784", "0.61302495", "0.5999739", "0.59971374", "0.5968651", "0.59000254", "0.58616674", "0.5841025", "0.583...
0.0
-1
decides which way to go
def next_move(self): self.branchize() try: _, new_branch = self.score_scheme.pop(0) except IndexError: return False move_list = [new_branch["move"]] parent = new_branch["parent"] while True: try: move_list.append(paren...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decide():", "def _choose_best_option(self):", "def decide_next_move(self):\n pass", "def _prior_teach(self):\n pass", "def think(self):\n pass", "def forward_pass(self):", "def my_strategy(self):\r\n if len(self.lift.lift_register) is 0:\r\n self.default()\r\n...
[ "0.618759", "0.59138227", "0.5755123", "0.5690553", "0.5622554", "0.5560853", "0.5506792", "0.5445275", "0.5367836", "0.5367305", "0.5294983", "0.52933806", "0.51783335", "0.51768243", "0.51585877", "0.5158308", "0.5150566", "0.51486456", "0.51008224", "0.50948304", "0.506858...
0.0
-1