query
stringlengths
9
9.05k
document
stringlengths
10
222k
metadata
dict
negatives
listlengths
30
30
negative_scores
listlengths
30
30
document_score
stringlengths
4
10
document_rank
stringclasses
2 values
Encodes an unsigned 32 bit integer.
def encode_u32(value: int) -> bytes: return int_to_le_bytes(value, NUMERIC_CONSTRAINTS[CLTypeKey.U32].LENGTH, False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encode32(x):\n while x < 0:\n x = x + 2**32 # Convert 2's complement negative numbers to unsigned\n assert((x >> 32) == 0) # Must be a 32bit quantity\n x = pack(x, 32, 'little', False) # Convert to little endian\n\n s = \"\"\n for b in x:\n s += '{:02x}'.format(b) # Convert l...
[ "0.72886485", "0.725134", "0.7215473", "0.71979535", "0.7137827", "0.7022656", "0.6956605", "0.69430447", "0.691968", "0.6665251", "0.6593908", "0.6573443", "0.65679795", "0.6546468", "0.6501861", "0.64995223", "0.6489284", "0.63497615", "0.6335349", "0.6288146", "0.62744594"...
0.764139
0
Encodes an unsigned 64 bit integer.
def encode_u64(value: int) -> bytes: return int_to_le_bytes(value, NUMERIC_CONSTRAINTS[CLTypeKey.U64].LENGTH, False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encode_i64(value: int) -> bytes:\n return int_to_le_bytes(value, NUMERIC_CONSTRAINTS[CLTypeKey.I64].LENGTH, True)", "def pack_ssh_uint64(i):\n if not isinstance(i, int):\n raise TypeError(\"Must be an int\")\n elif i.bit_length() > 64:\n raise ValueError(\"Must be a 64bit value.\")\n\n...
[ "0.7195093", "0.71726847", "0.7013398", "0.7013398", "0.67956394", "0.6587401", "0.65525234", "0.65354306", "0.6412215", "0.63429224", "0.6282969", "0.62307477", "0.62105554", "0.6060791", "0.60438156", "0.60275346", "0.60194147", "0.59864676", "0.594548", "0.5938131", "0.591...
0.7753789
0
Encodes an unsigned 128 bit integer.
def encode_u128(value: int) -> bytes: for type_key in (CLTypeKey.U8, CLTypeKey.U32, CLTypeKey.U64, CLTypeKey.U128): if is_within_range(type_key, value): break else: raise ValueError("Invalid U128: max size exceeded") as_bytes = int_to_le_bytes_trimmed(value, NUMERIC_CONSTRAINTS[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encode_u64(value: int) -> bytes:\n return int_to_le_bytes(value, NUMERIC_CONSTRAINTS[CLTypeKey.U64].LENGTH, False)", "def encode_varint(value):\n return \"\".join(encode_varint_stream([value]))", "def encode_uvarint(value):\n if not isinstance(value, int):\n raise TypeError(\"UVarInt encode...
[ "0.67247826", "0.62792957", "0.6220136", "0.6185008", "0.61084676", "0.61022055", "0.60967785", "0.60928565", "0.6073401", "0.6052443", "0.59807116", "0.59631443", "0.59004295", "0.58981365", "0.58726484", "0.5858631", "0.5835191", "0.58170867", "0.5783609", "0.5783609", "0.5...
0.7613545
0
Encodes an unsigned 256 bit integer.
def encode_u256(value: int) -> bytes: for type_key in (CLTypeKey.U8, CLTypeKey.U32, CLTypeKey.U64, CLTypeKey.U128, CLTypeKey.U256): if is_within_range(type_key, value): break else: raise ValueError("Invalid U256: max size exceeded") as_bytes = int_to_le_bytes_trimmed(value, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encode_int(v):\n if v < 240:\n return chr(v)\n elif v <= 2287:\n v -= 240\n d, m = divmod(v, 256)\n return chr(241 + d) + chr(m)\n elif v <= 67823:\n v -= 2288\n d, m = divmod(v, 256)\n return '\\xf9' + chr(d) + chr(m)\n elif v <= 16777215:\n ...
[ "0.64157325", "0.6330101", "0.6202689", "0.6161866", "0.614205", "0.61340094", "0.6094049", "0.5977668", "0.5955054", "0.5948855", "0.5923433", "0.58729017", "0.58054245", "0.57921547", "0.57809037", "0.5763508", "0.5760439", "0.5753819", "0.57178915", "0.5659287", "0.5655602...
0.68769276
0
Encodes an unsigned 512 bit integer.
def encode_u512(value: int): for type_key in (CLTypeKey.U8, CLTypeKey.U32, CLTypeKey.U64, CLTypeKey.U128, CLTypeKey.U256, CLTypeKey.U512): if is_within_range(type_key, value): break else: raise ValueError("Invalid U512: max size exceeded") as_bytes = int_to_le_bytes_trimmed(valu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pack(cls, le_unsigned_int, size):\n output = bytes()\n for i in range(size):\n output += chr((le_unsigned_int >> (i*8)) & 0xFF)\n return output", "def encode(x):\n i = int(16384 * x)\n return Struct('h').pack(i)", "def encode(x):\n i = int(16384 * x)\n return Str...
[ "0.5873435", "0.58695847", "0.5858977", "0.5855968", "0.5822624", "0.57660556", "0.57323843", "0.57323843", "0.571813", "0.5700974", "0.56993073", "0.55935234", "0.55502033", "0.55311394", "0.55279845", "0.5521459", "0.55198777", "0.55005956", "0.5469042", "0.54624766", "0.54...
0.7516844
0
Encodes an unforgeable reference.
def encode_uref(value: UnforgeableReference): return encode_byte_array( value.address + bytes([value.access_rights.value]) )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def serialized(self):\n return self.reference().Encode()", "def referent_to_bytes(referent):\n return pickle.dumps({\n 'left': referent.left_ref.address,\n 'key': referent.key,\n 'value': referent.value_ref.address,\n 'right': referent.right_ref.address,\n ...
[ "0.66613716", "0.6584899", "0.6220363", "0.6179027", "0.5992149", "0.59751904", "0.57061726", "0.57031065", "0.5697596", "0.5679578", "0.5673937", "0.5620627", "0.56036913", "0.56022084", "0.5562155", "0.555714", "0.5532753", "0.55263", "0.5441353", "0.54402125", "0.54366344"...
0.72808284
0
Encodes an unbound vector.
def encode_vector_of_t(value: list): return encode_u32(len(value)) + bytes([i for j in value for i in j])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set(self, incoming_vector):\n self.vector = incoming_vector", "def pack(self, v):\n\n raise NotImplementedError()", "def AsVector(self) -> BaseVector:", "def numpy_vector(self):\n pass", "def string_vector(self):\n pass", "def vector_encode(\n self,\n vec...
[ "0.5720606", "0.5701397", "0.5666214", "0.5618383", "0.5591653", "0.55679303", "0.55449677", "0.54932636", "0.54932636", "0.5440479", "0.53978693", "0.53654957", "0.53654957", "0.53256994", "0.52867776", "0.52717173", "0.52632886", "0.5229636", "0.52284455", "0.52229667", "0....
0.5809411
0
Encodes a CL value as an array of bytes.
def encode(value: CLValue) -> bytes: encoder = ENCODERS[value.cl_type.typeof] if value.cl_type.typeof in {CLTypeKey.LIST, CLTypeKey.OPTION}: return encoder( value.parsed, ENCODERS[value.cl_type.inner_type.typeof] ) else: return encoder(value.parsed)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encode_cl_value(entity: CLValue) -> bytes:\n return encode_u8_array(encode(entity)) + \\\n encode_cl_type(entity.cl_type)", "def encode_byte_array(value: bytes) -> bytes:\n return bytes([]) if isinstance(value, type(None)) else value", "def encode_u8_array(value: typing.List[int]) -> bytes:...
[ "0.80400646", "0.6756032", "0.66851157", "0.6526213", "0.6483099", "0.6478355", "0.64550173", "0.6420467", "0.63479835", "0.6342857", "0.6283099", "0.62726825", "0.6240129", "0.62060696", "0.61659396", "0.61244345", "0.6115372", "0.60785586", "0.6072759", "0.60595536", "0.605...
0.70583427
1
Scan the table for pokemon entries.
def do_scan(self, arg): results = self._table.scan() for item in results["Items"]: self._print(_pretty(item))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _scan_table(self, uri):\n cmd = 'kiji scan {kiji_uri}/{uri} --max-versions=10'.format(\n kiji_uri=self.kiji_uri,\n uri=uri)\n self._run_kiji_job(cmd)", "def do_query(self, pokemon):\n results = self._table.query(\n Select=\"ALL_ATTRIBUTES\",\n ...
[ "0.5683141", "0.558966", "0.5549232", "0.5401239", "0.53482014", "0.5303958", "0.52679497", "0.5127434", "0.5018827", "0.50139594", "0.50137395", "0.4976138", "0.49126193", "0.49076045", "0.48788702", "0.48550475", "0.4853392", "0.48391113", "0.4830526", "0.482869", "0.482260...
0.5784176
0
Query for a pokemon.
def do_query(self, pokemon): results = self._table.query( Select="ALL_ATTRIBUTES", KeyConditionExpression="Pokemon = :pokemon AND #index > :index", ExpressionAttributeNames={ "#index": "Index", }, ExpressionAttributeValues={ ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(self, args):\n return PokemonType.query.offset(args['offset']).limit(args['limit'])", "async def pokedex(ctx, pokemon_id: int):\n return await get_pokedex(ctx, ctx.message.author, pokemon_id)", "def select_pokemon(api_handler: APIHandler) -> str:\n\n print(\"\\nIf you are unsure of wha...
[ "0.6666059", "0.6489324", "0.642", "0.6053843", "0.6046099", "0.6024216", "0.5862654", "0.58375335", "0.550972", "0.5508771", "0.547151", "0.5458341", "0.54355794", "0.5417588", "0.53290474", "0.53264743", "0.5285909", "0.52421963", "0.5241512", "0.5229527", "0.52151614", "...
0.67079425
0
Activate/use this frame buffer.
def activate(self): # Send command self._glir.command('FRAMEBUFFER', self._id, True) # Associate canvas now canvas = get_current_canvas() if canvas is not None: canvas.context.glir.associate(self.glir)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __enter__(self):\n gl.glBindFramebuffer(gl.GL_FRAMEBUFFER, self.fbo)", "def _activate(self):\n self.active = True", "def activate(self):\n pass", "def activate(self):\n self.active = True", "def activate(self):\n self.active = True", "def activate(self):\n su...
[ "0.6884632", "0.64608234", "0.6419033", "0.6397252", "0.6397252", "0.6388576", "0.6374048", "0.62790084", "0.6276786", "0.62499106", "0.6216664", "0.6117702", "0.6055899", "0.59238225", "0.5855787", "0.58531976", "0.58493555", "0.58187395", "0.581343", "0.5796315", "0.576492"...
0.77879
0
Stop using this frame buffer, the previous framebuffer will be made active.
def deactivate(self): self._glir.command('FRAMEBUFFER', self._id, False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stop(self):\n self.running = False\n self.cam.stop()\n self.amplifier.stop()\n pass", "def stop(self):\n self.config(image=None)\n self.frames = None", "def stop(self):\n self.m_stop = True\n self.m_canvas.clear()", "def _end(self):\r\n opengles....
[ "0.69113904", "0.66878927", "0.6663434", "0.6641638", "0.66265297", "0.65973", "0.6594678", "0.6573312", "0.6511818", "0.64422673", "0.6411242", "0.6370697", "0.63614994", "0.6342015", "0.6338102", "0.6285088", "0.62227774", "0.62160593", "0.6212581", "0.6187287", "0.61667997...
0.7854266
0
The shape of the Texture/RenderBuffer attached to this FrameBuffer
def shape(self): if self.color_buffer is not None: return self.color_buffer.shape[:2] # in case its a texture if self.depth_buffer is not None: return self.depth_buffer.shape[:2] if self.stencil_buffer is not None: return self.stencil_buffer.shape[:2] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def frame_shape(self):\n pass", "def shape(self):\r\n return self._shape", "def shape(self):\n return self._image_shape", "def shape(self):\n return self.pos.shape", "def shape(self):\n return self._shape", "def shape(self):\n return self._shape", "def shape(se...
[ "0.74768364", "0.7112881", "0.7106565", "0.7060217", "0.7042314", "0.7042314", "0.69565254", "0.69436175", "0.69436175", "0.69436175", "0.6931108", "0.69003874", "0.69003874", "0.67865", "0.6771799", "0.6752058", "0.6604211", "0.66004777", "0.6598261", "0.65654314", "0.656406...
0.8388341
0
Resize all attached buffers with the given shape
def resize(self, shape): # Check if not (isinstance(shape, tuple) and len(shape) == 2): raise ValueError('RenderBuffer shape must be a 2-element tuple') # Resize our buffers for buf in (self.color_buffer, self.depth_buffer, self.stencil_buffer): if buf is None: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resize(self, shape, format=None):\n \n if not self._resizeable:\n raise RuntimeError(\"RenderBuffer is not resizeable\")\n # Check shape\n if not (isinstance(shape, tuple) and len(shape) in (2, 3)):\n raise ValueError('RenderBuffer shape must be a 2/3 element t...
[ "0.7019093", "0.64875543", "0.5995855", "0.5930017", "0.5886244", "0.5835629", "0.5785793", "0.56491905", "0.5631491", "0.5619519", "0.55384696", "0.54987407", "0.54685205", "0.5415116", "0.539896", "0.53775597", "0.53600186", "0.53213084", "0.53137493", "0.5279695", "0.52757...
0.7925462
0
Create and set alist of lists of the selected height >>> create_map(4) >>> len(STATUS['game_grid']) 16
def create_map(grid_size): STATUS['game_grid'] = [] # Could be a tuple? STATUS['grid_size'] = grid_size x_coord = 1 y_coord = 1 grid_size_counter = grid_size * grid_size while grid_size_counter: STATUS['game_grid'].append([x_coord, y_coord]) x_coord += 1 if x_coord == gr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_map(self, size, random_data = False):\n heightmap = []\n\n if random_data:\n # random noise background\n for x in range(size):\n heightmap.append([])\n for y in range(size):\n heightmap[-1].append(random.random())\n else:\n # black background\n for x in ...
[ "0.7093781", "0.6567834", "0.6528855", "0.6404791", "0.63314074", "0.6200038", "0.59949356", "0.5994863", "0.59197414", "0.5882415", "0.5882351", "0.57981294", "0.5763643", "0.57630986", "0.57600474", "0.5750908", "0.5731406", "0.5713816", "0.5679049", "0.56710327", "0.562790...
0.7396893
0
Returns the locations dict.
def get_locations(): return STATUS['locations']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def locations(self):\n return self.data.get(\"locations\", [])", "def locations(self):\n return self.__locations", "def locations(self):\n return self.__locations", "def locations(self):\n return self.__locations", "def locations(self):\n return self.__locations", "def ...
[ "0.8075259", "0.7831491", "0.7831491", "0.7831491", "0.7831491", "0.7831491", "0.7831491", "0.7831491", "0.7747918", "0.76711875", "0.7626648", "0.7451175", "0.7447394", "0.7424276", "0.73024064", "0.720597", "0.7152279", "0.7133786", "0.70140207", "0.68961644", "0.68885356",...
0.7895748
1
Randomly set the locations of the weapon and the monster
def set_locations(): STATUS['locations']['monster'][0] = generate_random_coord(STATUS['grid_size']) STATUS['locations']['monster'][1] = generate_random_coord(STATUS['grid_size']) STATUS['locations']['weapon'][0] = generate_random_coord(STATUS['grid_size']) STATUS['locations']['weapon'][1] = generate_ran...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_locations():\n player, door, monster = sample(CELLS, k=3)\n\n return player, door, monster", "def update(self):\n if self.x<0:\n self.x = 0\n\n if self.y <0:\n self.y = 0\n\n if bool(randint(0, 1))==True:\n if self.walker == True:\n ...
[ "0.6855584", "0.6609411", "0.66025347", "0.6539156", "0.64360493", "0.64003134", "0.6356856", "0.63307375", "0.63178194", "0.6258105", "0.62560153", "0.6109641", "0.60700095", "0.6062425", "0.60453594", "0.60025656", "0.5992538", "0.5974971", "0.5969052", "0.5944016", "0.5909...
0.76891726
0
Collect the player's choice of dungeon size.
def get_dungeon_size(): size = input("Choose the size of the dungeon... (4 - 24)\n>") size = int(size) while size < 4 or size > 24: print("Pick a number between four and 24.") size = input("Choose the size of the dungeon... (4 - 24)\n>") size = int(size) return size
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_size():\n opt = ['regular', 'small', 'large']\n inp = option_menu(opt, 'Widget size:')\n OPTIONS['size'] = opt[inp]\n add_to_collected('size', opt[inp])\n return", "def get_engine_size():\n possibilities = [d for d in GraphParameters.double_range(1.2, 4.2, 0.2)]\n return choi...
[ "0.57886624", "0.5653622", "0.54760903", "0.54727834", "0.54602027", "0.54168105", "0.5393714", "0.5349144", "0.5334254", "0.53328866", "0.53325", "0.53292716", "0.5307205", "0.5294575", "0.528933", "0.52810735", "0.519648", "0.5192753", "0.5178161", "0.517806", "0.5170445", ...
0.7161197
0
Check if the player has touched the monster and either killed it, been hurt or lost the game >>> STATUS['locations']['player'] = [3, 4] >>> STATUS['locations']['monster'] = [3, 4] >>> STATUS['weapon'] = 'unarmed' >>> STATUS['hp'] = 10 >>> monster_check() 'The monster caught you! You barely manage to escape...'
def monster_check(): player = get_locations()['player'] monster = get_locations()['monster'] if player == monster: if STATUS['weapon'] == 'armed': print("You killed the monster with the sword!") play_again() else: if STATUS['hp'] > 0: STATU...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def weapon_check():\n if get_locations()['player'] == get_locations()['weapon']:\n STATUS['weapon'] = 'armed'\n STATUS['locations']['weapon'] = None\n print(\"You found the weapon! Now go and kill the monster!\")", "def check_win(game, pokemon_locations):\n #traverse game\n for i in...
[ "0.70010614", "0.5522709", "0.5499785", "0.547328", "0.5438807", "0.53925914", "0.53428733", "0.5306675", "0.52989304", "0.52741206", "0.5228915", "0.5226442", "0.5213393", "0.5210838", "0.51944816", "0.5128692", "0.5110065", "0.50963044", "0.50926024", "0.5080858", "0.505217...
0.7880096
0
Check if the player has found the weapon >>> STATUS['locations']['player'] = [3, 4] >>> STATUS['locations']['weapon'] = [3, 4] >>> weapon_check() You found the weapon! Now go and kill the monster!
def weapon_check(): if get_locations()['player'] == get_locations()['weapon']: STATUS['weapon'] = 'armed' STATUS['locations']['weapon'] = None print("You found the weapon! Now go and kill the monster!")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def monster_check():\n player = get_locations()['player']\n monster = get_locations()['monster']\n if player == monster:\n if STATUS['weapon'] == 'armed':\n print(\"You killed the monster with the sword!\")\n play_again()\n else:\n if STATUS['hp'] > 0:\n ...
[ "0.61640704", "0.60326904", "0.59005004", "0.5819001", "0.57254213", "0.5720197", "0.570945", "0.57054585", "0.56836873", "0.56035006", "0.55163914", "0.54949635", "0.5467829", "0.5420488", "0.5420408", "0.5394797", "0.5366917", "0.5349058", "0.53217506", "0.5314512", "0.5304...
0.8238046
0
Convert the actual move keys into legible text >>> moves = ['W', 'A', 'D'] >>> parse_moves(moves) ['UP', 'LEFT', 'RIGHT']
def parse_moves(moves): possible_moves = [] for move in moves: if move == 'W': possible_moves.append('UP') elif move == 'D': possible_moves.append('RIGHT') elif move == 'S': possible_moves.append('DOWN') elif move == 'A': possible_m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _parse_input(moves: str) -> List[Line]:\n\n h_lines = []\n start = 0\n\n for i in range(SIZE):\n line_data = __parse_line(moves.replace(\"_\", EMPTY), start)\n h_lines.append(Line(line_data))\n start += SIZE\n\n return h_lines", "def legal_moves(self):\n moves = \"\"\n...
[ "0.6385989", "0.63023835", "0.62772", "0.62246627", "0.6162428", "0.61574715", "0.6096724", "0.60505533", "0.58874184", "0.58559346", "0.5847235", "0.5820029", "0.5742878", "0.5719385", "0.56743056", "0.5668487", "0.5664525", "0.5596751", "0.5519752", "0.5517055", "0.5512935"...
0.82111627
0
Computes the Roemer timing delay about the Solar System Barycentre at the position the Earth, given a set of ecliptic coordinates for a given pulsar.
def roemer_delay(epoch, ecl_latitude, ecl_longitude, ephemeris='de432s'): # before computing anythin, set the ephemeris context to be value # supplied at the function call. solar_system_ephemeris.set(ephemeris) time = Time(epoch, format='mjd') # now comoute the required position vectors. r_ea...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parallax_delay(epoch, ecl_latitude, ecl_longitude, distance, ephemeris='de432s'):\n\n # before computing anythin, set the ephemeris context to be value \n # supplied at the function call.\n solar_system_ephemeris.set(ephemeris)\n time = Time(epoch, format='mjd')\n distance *= u.kpc\n\n # now ...
[ "0.5554977", "0.5348617", "0.5046386", "0.5046206", "0.5007916", "0.500626", "0.4969994", "0.48907512", "0.48882952", "0.48624808", "0.48186463", "0.4805963", "0.47780162", "0.4764729", "0.4762683", "0.47602814", "0.4755826", "0.47450498", "0.47412974", "0.47189882", "0.47044...
0.7156942
0
Computes the annualparallax timing delay for the Earth, given a set of ecliptic coordinates and distance measure.
def parallax_delay(epoch, ecl_latitude, ecl_longitude, distance, ephemeris='de432s'): # before computing anythin, set the ephemeris context to be value # supplied at the function call. solar_system_ephemeris.set(ephemeris) time = Time(epoch, format='mjd') distance *= u.kpc # now comoute the r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def roemer_delay(epoch, ecl_latitude, ecl_longitude, ephemeris='de432s'):\n\n # before computing anythin, set the ephemeris context to be value \n # supplied at the function call.\n solar_system_ephemeris.set(ephemeris)\n time = Time(epoch, format='mjd')\n\n # now comoute the required position vecto...
[ "0.61157155", "0.5630978", "0.5408858", "0.5384893", "0.5252539", "0.51986593", "0.51492536", "0.5134964", "0.5126877", "0.5054521", "0.5017954", "0.49676532", "0.4965754", "0.49308276", "0.49159193", "0.48958883", "0.4893844", "0.48758546", "0.48727933", "0.48572224", "0.484...
0.7445342
0
Convert value or signal from binary encoding to gray encoding
def binToGray(sigOrVal) -> RtlSignalBase: return (sigOrVal >> 1) ^ sigOrVal #width = sigOrVal._dtype.bit_length() #return Concat(sigOrVal[width - 1], # sigOrVal[width - 1:0] ^ sigOrVal[width:1])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def binary_to_gray(self, num):\n return num ^ (num >> 1)", "def greyScaleConversion(frame):\n return cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)", "def togray(self,value):\n (red,green,blue) = self.unpack_value(value)\n \n gray = []\n for i in xrange(1024):\n graypx...
[ "0.69384724", "0.6919446", "0.67322373", "0.6464974", "0.6464974", "0.6464974", "0.6464974", "0.646182", "0.64119315", "0.6334561", "0.62963915", "0.6294455", "0.62827575", "0.62647945", "0.6262057", "0.62189204", "0.6215959", "0.62003857", "0.61992514", "0.6199115", "0.61929...
0.722535
0
This function calculates a GMM from a dataset
def gmm(X, k): mix = sklearn.mixture.GaussianMixture(n_components=k).fit(X) pi = mix.weights_ m = mix.means_ S = mix.covariances_ clss = mix.predict(X) bic = mix.bic(X) return pi, m, S, clss, bic
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eachDigitGMM(data, cfg):\r\n\r\n models = {}\r\n for j in range(len(data)):\r\n train_set = data[j][0]\r\n for i in range(1, len(data[j])):\r\n train_set = np.concatenate((train_set, data[j][i]), axis=0)\r\n\r\n estimator = GaussianMixture(n_components=cfg['components'], m...
[ "0.68765885", "0.68309706", "0.6759905", "0.66226405", "0.64129776", "0.6384017", "0.633351", "0.61683834", "0.6143927", "0.61398685", "0.6112504", "0.61005163", "0.6090207", "0.6065511", "0.6008494", "0.595639", "0.5955234", "0.5939379", "0.59257996", "0.59252787", "0.590501...
0.688509
0
tests that only assignment clauses can be added to queries
def test_add_assignment_type_checking(self): stmt = AssignmentStatement('table', []) with self.assertRaises(StatementException): stmt.add_assignment_clause('x=5')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_add_assignment_type_checking(self):\r\n stmt = AssignmentStatement('table', [])\r\n with self.assertRaises(StatementException):\r\n stmt.add_assignment_clause('x=5')", "def test_partial_update_creation(self):\r\n ctx = {}\r\n col = columns.Set(columns.Integer, db_f...
[ "0.70730805", "0.66742545", "0.62559247", "0.61682945", "0.61108774", "0.6087436", "0.60765576", "0.60760725", "0.6071067", "0.6057692", "0.604524", "0.60279125", "0.6004606", "0.59442437", "0.5887836", "0.58807665", "0.57822204", "0.5766065", "0.5739063", "0.57014644", "0.56...
0.70374787
1
Computes a Time Weighted Risk parcel. Normalizes the timestamps and returns the TWR parcel.
def twr(begin_ts, ts, current_ts): begin_diff = ts - begin_ts diff = current_ts - begin_ts if diff == 0: normalized = 1 else: normalized = Decimal(begin_diff) / Decimal(diff) twr = 1 / (1 + Decimal.exp(Decimal(-12) * normalized + Decimal(2) + ((1 - Metric...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_rate(timestamps):\n return (timestamps[1, 1] - timestamps[0, 1]) / (timestamps[1, 0])", "def getWeightTime(self, index):\r\n\t\treturn None", "def calculate_weights():\n weights = {}\n\n\n # estimate run time of step 1 (fast sweep)\n f_range = sweeper_script.settings...
[ "0.58197564", "0.5640949", "0.5545172", "0.5513621", "0.53732556", "0.5342089", "0.5282598", "0.52537495", "0.52108", "0.52107525", "0.5172931", "0.5170472", "0.51578027", "0.5156773", "0.5146917", "0.51403886", "0.5131785", "0.5123639", "0.5122184", "0.51192313", "0.51132095...
0.6031708
0
Computes the TWR sum from a list. By receiving a list, computes the TWR sum, by giving the begin timestamp and the most current timestamp.
def list_twr(seq, begin_ts, current_ts): twr_sum = 0 for ts in seq: twr_sum += Metrics.twr(begin_ts, ts, current_ts) return twr_sum
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def timeseries_list_sum(data, series_list, field_spec):\n return TimeSeries.timeseries_list_reduce(data, series_list, Event.sum, field_spec)", "def sum_list(input_list: List[float]) -> float:\n return sum(input_list)", "def sum_list(input_list: List[float]) -> float:\n return sum(input_list)", "...
[ "0.6691948", "0.6003712", "0.6003712", "0.59604466", "0.58896303", "0.58382636", "0.5824063", "0.58063376", "0.57830393", "0.5779064", "0.5690456", "0.5618762", "0.5601863", "0.55999744", "0.55644107", "0.5531432", "0.5530116", "0.55146486", "0.55116576", "0.55043775", "0.550...
0.6939775
0
Computes the defect probability for every child
def compute_defect_probability(self): self.defect_prob = self.defect_probability() for file_analytics in self.files_analytics.values(): file_analytics.compute_defect_probability()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def caculate_prob(self):\n t_H = self.tree.depth()\n t_h = 1\n while(t_h <= t_H):\n t_hnodes = self.get_h(t_h)\n t_sum = 0\n t_hpro = []\n t_cpro = []\n for t_n in t_hnodes:\n t_sum = self.tree.get_node(t_n).data[0] + t_sum\...
[ "0.6381905", "0.6177454", "0.6074082", "0.6028286", "0.59427", "0.5935064", "0.59331375", "0.5873684", "0.5782974", "0.577143", "0.5706628", "0.5704525", "0.5687962", "0.56712", "0.56625974", "0.5659836", "0.5653012", "0.56150997", "0.5595295", "0.55919814", "0.5586295", "0...
0.65876067
0
Converts repository analytics to a dict. It traverses child analytics to convert and adds some information useful for the Sunburst chart.
def to_dict(self): children = [f_metrics.to_dict(f_path) for f_path, f_metrics in self.files_analytics.items()] metrics = { "name": "root", "children": children } return metrics
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _deep_asdict(self):\n return {\n \"metadata\": self.metadata,\n \"artifacts\": {k: a._asdict() for (k, a) in self.artifacts.items()},\n }", "def get_additional_data(self, object, object_type):\n data = {\"ancestors\": [], \"linked_agents\": []}\n if self.cart...
[ "0.6109232", "0.5631503", "0.5495704", "0.5420957", "0.54078454", "0.54078454", "0.5383412", "0.5382311", "0.5380602", "0.53730506", "0.5369197", "0.53442144", "0.53333604", "0.53149676", "0.53149676", "0.53149676", "0.53149676", "0.53149676", "0.5308921", "0.5303608", "0.528...
0.6072782
1
Checks if key is a recognised bound name or percentage
def is_valid_descriptor(key): return key in Bounds.standard_bound_names or Bounds.parse_pct(key) is not None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _is_bound(self, binding_to_typ, binding_to, bound_typ, bound):\n typ, _, name_str = self.combined_typ(binding_to_typ, bound_typ)\n found = self.get(\"/{0}/{1}\".format(typ, binding_to), content_type=self.content_type(typ))\n if found[\"errorcode\"] != 0:\n raise BadNetScaler(\"F...
[ "0.61346734", "0.6060483", "0.5910799", "0.5731334", "0.57285905", "0.56713325", "0.5527861", "0.54906493", "0.54604447", "0.54386085", "0.54308355", "0.54028946", "0.53682166", "0.5290997", "0.528399", "0.5237463", "0.5205109", "0.5204676", "0.5180429", "0.51778346", "0.5171...
0.6966016
0
This function gets the maximum number from the user and generates a list from 2 to that maximum number
def list_nums(): max_num = int(input("What is the maximum number you would like to use?")) num_list = [] for x in range(2, max_num + 1): num_list.append(x) return num_list
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def max_num(num_list):\n\n return max(num_list)", "def max(self, num_list):\n try:\n max = int(num_list[0])\n\n for number in num_list:\n try:\n if number > max:\n max = number\n except Exception as e:\n ...
[ "0.7038315", "0.69182515", "0.6910753", "0.6728843", "0.6695187", "0.6674081", "0.6654841", "0.66235155", "0.6555738", "0.6523734", "0.6517468", "0.644002", "0.6439733", "0.6425647", "0.63329935", "0.6315242", "0.6312202", "0.6298572", "0.62096673", "0.6199164", "0.61914283",...
0.79686606
0
This function loops through the list from 2 to the maximum number and finds the prime numbers and eliminates the numbers that are not prime numbers (multiples of the prime numbers).
def prime_list(num_list): primes = [] while len(num_list) > 0: num = num_list[0] primes.append(num_list[0]) for x in num_list: if x % num == 0: num_list.remove(x) return primes
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def primes(n_max: int = 100) -> List[int]:\n if n_max < 2:\n raise ValueError\n\n t = list(range(2, n_max + 1))\n for i in t:\n for j in (k for k in t if k > i):\n if j % i == 0:\n t.remove(j)\n\n return sorted(t)", "def eratosthenes(n):\n assert n>1 ...
[ "0.76467264", "0.7480511", "0.72448826", "0.721026", "0.719072", "0.7153808", "0.7047006", "0.7016084", "0.6988918", "0.69195104", "0.6913694", "0.69100827", "0.6906256", "0.68897516", "0.68802565", "0.6809658", "0.68091094", "0.6808911", "0.67977667", "0.67977107", "0.670416...
0.7740884
0
Writes a monit configuration file for a daemonized service.
def create_daemon_config(watch, start_cmd, stop_cmd, pidfile, max_memory=None): with open(TEMPLATE_LOCATION) as template: output = template.read() output = output.format( process_name=watch, match_clause='PIDFILE "{}"'.format(pidfile), group=watch, start_line=start_cmd, stop_line=stop_cmd) if m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_configuration_file(self, content):\n with open(self.configuration_file_path, 'w') as configuration_file:\n configuration_file.write(content)", "def write(self, fn):\n with open(fn, 'w') as f:\n self.config.write(f)", "def write_config_file(self):\n for opt, ...
[ "0.62355626", "0.59795225", "0.5954661", "0.5950016", "0.59475577", "0.58894753", "0.58731115", "0.5778259", "0.5775533", "0.5769326", "0.57201576", "0.5675519", "0.56637293", "0.560618", "0.56018037", "0.55503327", "0.5540918", "0.5535353", "0.5534749", "0.5523457", "0.55013...
0.6577286
0
Sets some global OpenGL states.
def setOpenGLState(self): # Enable transparency. pyglet.gl.glBlendFunc(pyglet.gl.GL_SRC_ALPHA, pyglet.gl.GL_ONE_MINUS_SRC_ALPHA) pyglet.gl.glEnable(pyglet.gl.GL_BLEND)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_gl_state(self, preset=None, **kwargs):\n self._vshare.gl_state = kwargs\n self._vshare.gl_state['preset'] = preset", "def InitGL(self):\r\n glClearColor(0.0,0.0,0.0,0.0); # set clear color to black\r\n glEnable(GL_TEXTURE_2D)\r\n self.SetupView()\r\n return", "...
[ "0.68894047", "0.6707013", "0.6640391", "0.65681756", "0.6510993", "0.6508422", "0.64655805", "0.64257646", "0.64006275", "0.6397179", "0.6372946", "0.6346737", "0.6322963", "0.6237542", "0.6140337", "0.6090492", "0.6051832", "0.6036248", "0.60289234", "0.6015167", "0.6003285...
0.74525124
0
Gets the group to the corresponding index. Return group 0 if it is too small, self. layers if two big and otherwise just take the integer value. A higher value means that it will be drawn on top of the other layers. Very powerful to sort 2D stuff in the OpenGL window.
def getGroup(self, index): index = int(index) if index < 0: return self.top_group1 elif index > (self.layers - 1): index = (self.layers - 1) return self.groups[index]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_group_index(self, index):\n\n g_index = 0\n for group in self.groups:\n if group[0] == index:\n g_index = group[1]\n break\n return g_index", "def get_group(self, group, intg):\n return self.data[intg, group, :, :]", "def get_grp(sel...
[ "0.7299663", "0.6803372", "0.6751827", "0.66083413", "0.6592914", "0.64778405", "0.64778405", "0.63199955", "0.6268836", "0.6253445", "0.6225704", "0.6191531", "0.61575013", "0.61476666", "0.6085364", "0.6054542", "0.60518205", "0.6045446", "0.60138434", "0.5997305", "0.59852...
0.82062745
0
Using ordered groups enables using sorted vertex list in one single batch which then renders as efficiently as possible.
def _createdOrderedGroups(self): self.groups = [] for _i in xrange(self.layers): self.groups.append(pyglet.graphics.OrderedGroup(_i)) # Create one top level group. Useful for dialog boxes and other stuff # that goes over everything else. self.top_group1 = pyglet.graph...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_vertex_list(self):\n raise NotImplementedError('_create_vertex_list must be defined in '\n 'order to use group or batch properties')", "def color_groups(groups, colors, data_color_order):\r\n group_num = -1\r\n for g in natsort(groups):\r\n if g no...
[ "0.626928", "0.6021028", "0.5863599", "0.5732147", "0.5633804", "0.55477464", "0.55318826", "0.54416966", "0.5425984", "0.5393342", "0.5393342", "0.5388773", "0.5357766", "0.5324135", "0.5278931", "0.52723694", "0.52552176", "0.52191985", "0.52187985", "0.5214604", "0.5194093...
0.6213963
1
Deletes the box, the frame and pops the top handlers from the stack.
def delete_and_pop_handlers(): self.zoom_box.delete() self.zoom_frame.delete() self.zoom_box = None # Popping handlers. # XXX: Are these always the right handlers?? self.win.window.pop_handlers() # Return to the default cursor. ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def removeFrame(self, frame):\n for widget in frame.winfo_children():\n widget.destroy()\n\n frame.pack_forget()", "def clearFrame(self, event=None):\n for widget in self.winfo_children():\n widget.destroy()\n del self.tiles[:]", "def destroy (self,event=None):...
[ "0.666649", "0.6581805", "0.6319164", "0.6292763", "0.62892294", "0.6245954", "0.6137436", "0.6089994", "0.60827976", "0.60810876", "0.60749674", "0.607431", "0.6069407", "0.60341984", "0.6016177", "0.6002285", "0.5981334", "0.5981334", "0.5976471", "0.5932667", "0.5923135", ...
0.7659404
0
Create an interactive Altair heatmap of parameter correlations with user defined x and y parameters. The xy selection will be highlighted in pink.
def altair_heatmap(corr_matrix: pd.DataFrame, x_selection: str = None, y_selection: str = None) -> alt.Chart: pair = alt.selection_single(fields=["x", "y"], clear=False, name="pair") chart = alt.Chart(corr_matrix.round(2)).mark_rect(tooltip=True).encode( x=alt.X('x', title=None), y=alt.Y('y', ti...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def heatmap(\n df: pd.DataFrame, figsize: tuple = (10, 10), scale: float = 1.4\n) -> sns.heatmap:\n\n # keep only quantitative features\n df = create_quanti_df(df)\n print(f\"Number of quantitaive columns: {df.shape[1]}\")\n # calcaulate features correlations\n corr = df.corr() * 100\n # creat...
[ "0.61710703", "0.60806066", "0.60755086", "0.5960964", "0.59540606", "0.58401346", "0.5730593", "0.55769676", "0.5487266", "0.54616016", "0.54573727", "0.5429252", "0.5384936", "0.5365286", "0.5349578", "0.5335637", "0.5331853", "0.5325546", "0.5318727", "0.5309564", "0.52978...
0.70760053
0
Create an interactive Altair scatter plot with user defined x and y parameters as well as an optional third parameter used for marker color gradient.
def altair_scatter(dataset: pd.DataFrame, x_selection: str, y_selection: str, color_selection: str) -> alt.Chart: # use set to handle edge case of duplicated axes or 'Date' selection tooltip = list(set(['Date', x_selection, y_selection, color_selection])) if color_selection == '<select>': tooltip.r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scatter_template(df, met, xaxy, cato):\n scatter_args = {'plot_height' : 625,\n 'plot_width' : 950,\n 'tools' : ['pan, wheel_zoom', 'reset', 'save'],\n 'active_scroll' : 'wheel_zoom'}\n \n tooltips = [(met, '@' + met)]\n ...
[ "0.64089113", "0.61883754", "0.60258687", "0.6019215", "0.5915197", "0.5907998", "0.58968526", "0.5841837", "0.5807483", "0.5796659", "0.57940745", "0.57929", "0.5716721", "0.56908995", "0.56854343", "0.56824404", "0.5675817", "0.56473476", "0.56262374", "0.5616481", "0.56161...
0.7190396
0
Create a Plotly heatmap of parameter correlations.
def plotly_heatmap(corr_matrix: pd.DataFrame) -> go.Figure: title = "Metrics Summary: Pearson's Correlation" data = [go.Heatmap(x=corr_matrix.columns, y=corr_matrix.index, z=corr_matrix, colorscale='Blues', colorbar=dict...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_heat(df):\n plt.figure(figsize=(12,8))\n sns.heatmap(df.corr(), cmap='RdYlBu', annot=True, center=0)", "def plot_correlations(X, netvars, colorbar = False):\n \n C = np.corrcoef(X, rowvar = False) * 100\n C[np.abs(C) < 0.5] = 0 # round near zero to 0\n\n N = np.ceil(C.shape[0]/3)\n ...
[ "0.6909577", "0.68649435", "0.6844709", "0.6777025", "0.6702091", "0.669412", "0.66085446", "0.6520804", "0.64065796", "0.639606", "0.6281151", "0.6272222", "0.623027", "0.6209702", "0.6194018", "0.61810535", "0.61311805", "0.6115224", "0.60990345", "0.60729307", "0.6068563",...
0.732941
0
Create a multiline timeseries Plotly plot. Plot both the x and y selection variables.
def plotly_line(dataset: pd.DataFrame, x_selection: str, y_selection: str, date_col: str = 'Date') -> go.Figure: fig = make_subplots(specs=[[{"secondary_y": True}]]) fig.add_trace( go.Scatter(x=dataset.loc[:, date_col], y=dataset.loc[:, x_selection], mode='lines+mar...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def line_plot(self,\n x: str,\n y: List[str],\n x_label: str,\n y_label: str,\n title: str='Line Plot',\n range_slider: bool=False,\n **kwargs) -> Figure:\n df_long = pd.melt(self.df, id_va...
[ "0.6256598", "0.6159256", "0.6138826", "0.60169536", "0.5984332", "0.59465176", "0.5941775", "0.59012586", "0.5898426", "0.5893808", "0.5874194", "0.5821261", "0.5750937", "0.57185304", "0.5663952", "0.5648347", "0.5647548", "0.56213003", "0.56126016", "0.5590559", "0.5574659...
0.72775215
0
Gets the parameters required to align the shape to the given shape using the weight matrix w. This applies a scaling, transformation and rotation to each point in the shape to align it as closely as possible to the shape. This relies on some linear algebra which we use numpy to solve. [ X2 Y2 W 0][ax] [X1] [ Y2 X2 0 W]...
def get_alignment_params(self, s, w): X1 = s.__get_X(w) X2 = self.__get_X(w) Y1 = s.__get_Y(w) Y2 = self.__get_Y(w) Z = self.__get_Z(w) W = sum(w) C1 = self.__get_C1(w, s) C2 = self.__get_C2(w, s) a = np.array([[ X2, -Y2, W, 0], ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_alignment_params(self, s, w):\n\n X1 = s.__get_X(w)\n X2 = self.__get_X(w)\n Y1 = s.__get_Y(w)\n Y2 = self.__get_Y(w)\n Z = self.__get_Z(w)\n W = sum(w)\n C1 = self.__get_C1(w, s)\n C2 = self.__get_C2(w, s)\n\n a = np.array([[ X2, -Y2, W, 0],\n [ Y2, X2, 0,...
[ "0.7380673", "0.61158115", "0.566551", "0.5520522", "0.54707575", "0.5458659", "0.5204423", "0.5116767", "0.5108609", "0.5104482", "0.5082043", "0.5067365", "0.505401", "0.5038199", "0.50292134", "0.50123125", "0.49914813", "0.49709666", "0.49393025", "0.4919629", "0.49102864...
0.7357543
1
Determine if this is the vert in an open edge that should not have a post
def vert_is_open(v, front, left, right, prop): if prop.open_side == "LEFT": if v in left.verts and v not in front.verts: return True elif prop.open_side == "RIGHT": if v in right.verts and v not in front.verts: return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_edge(self, v, w):\n return self.op_norm(v[0], w[0]) == (v[1] + w[1]) and (self.variant.is_bipartite() or v != w)", "def is_closed(self):\n # In Open Cascade, unlinked (open) edges can be identified\n # as they appear in the edges iterator when ignore_orientation=False\n # but a...
[ "0.6577792", "0.65098494", "0.6507211", "0.64180267", "0.6417849", "0.6377712", "0.63526595", "0.6351077", "0.63391054", "0.62962776", "0.62881887", "0.625048", "0.6244916", "0.62438977", "0.6213483", "0.61897594", "0.6179836", "0.61250985", "0.6122007", "0.6101966", "0.60872...
0.71227276
0
Obtain string representation of the Interface Status object.
def __str__(self): sb = '' sb += '\nInterfaceStatus [ ' + self.interface_name + ' ]\n' sb += '\tLinkState : ' + str(self.InterfaceState.enumval(self.link)) + '\n' sb += '\tLineProtoState : ' + str(self.InterfaceState.enumval(self.lineproto)) + '\n' return sb
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n struct_repr = \", \".join([\n \"was_available_once: \" + str(self.was_available_once),\n \"is_available: \" + str(self.is_available),\n \"signal_strength_percent: \" + str(self.signal_strength_percent)\n ])\n\n return f\...
[ "0.753813", "0.75120044", "0.74452037", "0.7416838", "0.7120765", "0.7041113", "0.70339936", "0.6861584", "0.68476593", "0.68476593", "0.68476593", "0.68324053", "0.6831681", "0.68259335", "0.6778136", "0.6778136", "0.6778136", "0.6778136", "0.6778136", "0.6778136", "0.677813...
0.8487201
0
Generates the id for the entity if not present and save it to the data store
def save(self): if not self.id: self.id = uuid4() DataStore.add_instance(self)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getid_saveifneeded(self):\n #if (not hasattr(self,'id') or self.id == None):\n if (self.id == None):\n self.save()\n return self.id", "def _create_entity(self, model_name, entity):\n model_pool = self.pool.get(model_name)\n prepared_entity = self._prepare_entity(...
[ "0.7322928", "0.66846615", "0.6662025", "0.6589492", "0.6448306", "0.6434934", "0.6416527", "0.64008415", "0.6357453", "0.62876993", "0.61731076", "0.61415225", "0.6083579", "0.6083579", "0.60798424", "0.607412", "0.60522956", "0.6051202", "0.60401165", "0.60401165", "0.60401...
0.71690565
1
Use numpy operations to add padding around an image in numpy format (an array of rank 3 so 3 channels) in order to create a square image. Function saves the newly padded image to a new file in the output directory specified. Args
def pad_image(np_img, new_img_file): h, w, c = np_img.shape side_len = max(h, w) # Create our square "palette" or area upon which the image data is placed # Make it kinda grey (e.g. a palette of all > 1) new_np_img = np.ones(side_len * side_len * c).reshape(side_len, side_len, c) * 100 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_padding(self):\n\n image_padded, mask, self.pad_to_right, self.pad_to_bottom = gen_padded_image_and_mask (os.path.join('utils_dfn/temp', self.file_name_with_ext),\n self.new_height, self.new_width)\n cv2.imwrite(os.path.jo...
[ "0.7163466", "0.70793253", "0.69999886", "0.6953302", "0.68738616", "0.66779923", "0.6492946", "0.64165115", "0.638567", "0.6313891", "0.63054013", "0.6226343", "0.62002826", "0.61975175", "0.6154118", "0.6127924", "0.6125802", "0.61033076", "0.6095514", "0.6042184", "0.60329...
0.71760786
0
Loops through all image in given input directory. Reads each file in a try/except block in the instance the file is not an image (it is then skipped). Calls a function to add padding to square up the image and saves it to a new file.
def main(): # Just grab all files - we'll use try/except to filter images = glob.glob(os.path.join(args.input_dir, '*.*')) if not os.path.exists(args.output_dir): os.makedirs(args.output_dir) for img_file in images: print(img_file) try: np_img = plt.imread(img_file) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_images():\n create_dirs()\n for root, dirs, files in os.walk(IN):\n for name in files:\n if name[0] == '.':\n continue\n process_image(name)", "def pad_images(_input_image_paths : list[str], _output_image_dir : str, \\\n _pad_colour : tuple[int,int,int]) -> None:\n for ima...
[ "0.68486595", "0.6777415", "0.67667794", "0.6543742", "0.65098476", "0.6379235", "0.6335461", "0.6221266", "0.6213797", "0.62034637", "0.61726856", "0.6065895", "0.59882486", "0.5960843", "0.5895261", "0.58786464", "0.5844843", "0.5838677", "0.5831205", "0.5830881", "0.579168...
0.67812526
1
tests each password against all dictionary words
def testPassword(cryptPass, dictionaryFile): #salt = cryptPass[0:2] salt = crypt.mksalt(crypt.METHOD_SHA512) # Updated for SHA512 encrypted passwords dictFile = open(dictionaryFile, 'r') for word in dictFile.readlines(): word = word.strip('\n') cryptWord = crypt.crypt(word, salt) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_password_dictionary(value):\r\n password_max_edit_distance = getattr(settings, \"PASSWORD_DICTIONARY_EDIT_DISTANCE_THRESHOLD\", None)\r\n password_dictionary = getattr(settings, \"PASSWORD_DICTIONARY\", None)\r\n\r\n if password_max_edit_distance and password_dictionary:\r\n for word i...
[ "0.6740092", "0.6704475", "0.6633288", "0.6449307", "0.64459676", "0.64433205", "0.63548094", "0.6251596", "0.6218266", "0.62045294", "0.6109094", "0.6072312", "0.60589075", "0.6032293", "0.59890413", "0.59684634", "0.5951856", "0.59438515", "0.5941984", "0.5939988", "0.59235...
0.69393873
0
Get a coordinate box from a map.
def bounding_box_from_map(map_car): shape, wcs = map_car.data.geometry return enmap.box(shape, wcs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_box_from_xml(bounds):\n return bounds['@maxlat'], bounds['@minlat'], bounds['@maxlon'], bounds['@minlon'],", "def get_grid_box(self, lon, lat):\n lon_1d = self.lon_arr[1,:]\n lat_1d = self.lat_arr[:,1]\n box_number_x = self._ret_box_position(lon_1d, lon)\n box_number_y = se...
[ "0.6343539", "0.62984586", "0.6088024", "0.5940011", "0.58484155", "0.5809148", "0.574483", "0.57401186", "0.57032806", "0.56887144", "0.5670047", "0.56506366", "0.5638249", "0.55707836", "0.5557778", "0.55481535", "0.5539294", "0.5528144", "0.55278516", "0.5517178", "0.55063...
0.7182905
0
Get a ``so_map`` from an enmap (pixell format).
def from_enmap(emap): new_map = so_map() hdulist = emap.wcs.to_fits() header = hdulist[0].header new_map.pixel = header["CTYPE1"][-3:] try: new_map.ncomp = header["NAXIS3"] except: new_map.ncomp = 1 new_map.data = emap.copy() new_map.nside = None new_map.geometry = n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_mapping(self, ksf: str) -> InfoResMapping:\n irm = self.InfoResMapping(self, ksf)\n return irm", "def get_maps(ra,dec,x,release='y1',nside=4096,map=False,nested=False):\n\n if release=='y1':\n xx=config.map_name_y1.get(x,None)\n elif release=='sv':\n xx=config.map_name_sv.ge...
[ "0.5838891", "0.5802592", "0.5767715", "0.5754976", "0.57361346", "0.5715926", "0.5649444", "0.5645604", "0.5544831", "0.54390484", "0.5402486", "0.5338239", "0.53021646", "0.5300985", "0.53005576", "0.5295477", "0.5294932", "0.52403086", "0.5223802", "0.5187996", "0.5186366"...
0.77984154
0
Project a HEALPIX ``so_map`` into a CAR ``so_map``. The projection will be done in harmonic space, you can specify a lmax to choose a range of multipoles considered in the projection. If the coordinate of the map and the template differ, a rotation will be performed.
def healpix2car(healpix_map, template, lmax=None): project = template.copy() if healpix_map.coordinate is None or template.coordinate is None: rot = None elif healpix_map.coordinate == template.coordinate: rot = None else: print( "will rotate from %s to %s coordinat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def car2car(map_car, template):\n\n project = template.copy()\n project.data = enmap.project(map_car.data, template.data.shape, template.data.wcs)\n return project", "def full_sky_car_template(ncomp, res):\n\n if ncomp == 3:\n pre = (3,)\n else:\n pre = ()\n\n res = res * np.pi / ...
[ "0.62465584", "0.61897796", "0.6148334", "0.60519737", "0.5796089", "0.5683442", "0.55798924", "0.5549435", "0.5510425", "0.5425356", "0.54142284", "0.53824645", "0.53739816", "0.53146225", "0.5313463", "0.53123355", "0.5276464", "0.52373236", "0.5165405", "0.51412636", "0.51...
0.71958137
0
Create a ``so_map`` template with healpix pixellisation.
def healpix_template(ncomp, nside, coordinate=None): temp = so_map() if ncomp == 3: temp.data = np.zeros((3, 12 * nside ** 2)) else: temp.data = np.zeros((12 * nside ** 2)) temp.pixel = "HEALPIX" temp.ncomp = ncomp temp.nside = nside temp.geometry = "healpix geometry" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def img_map(ts):\n image_map = \"\"\n texdata = bpy.data.textures[ts.texture]\n if ts.mapping == \"FLAT\":\n image_map = \"map_type 0 \"\n elif ts.mapping == \"SPHERE\":\n image_map = \"map_type 1 \"\n elif ts.mapping == \"TUBE\":\n image_map = \"map_type 2 \"\n\n # map_type ...
[ "0.6446161", "0.63297945", "0.6250836", "0.62155044", "0.6133133", "0.60804296", "0.60684234", "0.6037345", "0.6029174", "0.59851664", "0.5901497", "0.5815047", "0.58129793", "0.57822037", "0.5748131", "0.57432", "0.5742158", "0.5683685", "0.5679443", "0.56793857", "0.5664227...
0.7511484
0
Create a ``so_map`` template with CAR pixellisation in equ coordinates.
def car_template(ncomp, ra0, ra1, dec0, dec1, res): if ncomp == 3: pre = (3,) else: pre = () box = get_box(ra0, ra1, dec0, dec1) res = res * np.pi / (180 * 60) temp = so_map() shape, wcs = enmap.geometry(box, res=res, pre=pre) temp.data = enmap.zeros(shape, wcs=wcs, dtype=N...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def full_sky_car_template(ncomp, res):\n\n if ncomp == 3:\n pre = (3,)\n else:\n pre = ()\n\n res = res * np.pi / (180 * 60)\n temp = so_map()\n shape, wcs = enmap.fullsky_geometry(res=res, dims=pre)\n temp.data = enmap.zeros(shape, wcs=wcs, dtype=None)\n temp.pixel = \"CAR\"\n ...
[ "0.7092504", "0.624178", "0.6062229", "0.60067743", "0.60056037", "0.59929526", "0.59806406", "0.59373343", "0.58820444", "0.58586305", "0.58467436", "0.5818731", "0.58151853", "0.580253", "0.5790168", "0.5751554", "0.57337195", "0.57300246", "0.5711361", "0.57064474", "0.569...
0.7491607
0
Create a ``so_map`` full sky template with CAR pixellisation in equ coordinates.
def full_sky_car_template(ncomp, res): if ncomp == 3: pre = (3,) else: pre = () res = res * np.pi / (180 * 60) temp = so_map() shape, wcs = enmap.fullsky_geometry(res=res, dims=pre) temp.data = enmap.zeros(shape, wcs=wcs, dtype=None) temp.pixel = "CAR" temp.nside = None...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def car_template(ncomp, ra0, ra1, dec0, dec1, res):\n\n if ncomp == 3:\n pre = (3,)\n else:\n pre = ()\n\n box = get_box(ra0, ra1, dec0, dec1)\n res = res * np.pi / (180 * 60)\n temp = so_map()\n shape, wcs = enmap.geometry(box, res=res, pre=pre)\n temp.data = enmap.zeros(shape, ...
[ "0.70237994", "0.6482532", "0.62306195", "0.60275185", "0.6013005", "0.6009001", "0.5996721", "0.5964458", "0.5878865", "0.58556527", "0.5789583", "0.5725151", "0.5698993", "0.56416595", "0.56395066", "0.5635527", "0.5603634", "0.5577458", "0.5557027", "0.5549513", "0.5540601...
0.76588386
0
Generate a white noise realisation corresponding to the template pixellisation
def white_noise(template, rms_uKarcmin_T, rms_uKarcmin_pol=None): noise = template.copy() rad_to_arcmin = 60 * 180 / np.pi if noise.pixel == "HEALPIX": nside = noise.nside pixArea = hp.pixelfunc.nside2pixarea(nside) * rad_to_arcmin ** 2 if noise.pixel == "CAR": pixArea = noise.d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addNoise (image,noise_type=\"gauss\",var = .01):\n row,col,ch= image.shape\n if noise_type == \"gauss\": \n mean = 0.0\n #var = 0.001\n sigma = var**0.5\n gauss = np.array(image.shape)\n gauss = np.random.normal(mean,sigma,(row,col,ch))\n gauss = gauss.resh...
[ "0.6830951", "0.68191826", "0.68060017", "0.67968553", "0.67393875", "0.66496176", "0.6636686", "0.6629443", "0.6597888", "0.6574772", "0.65418935", "0.651444", "0.64691764", "0.6367669", "0.63487864", "0.63426185", "0.6333377", "0.63038576", "0.62977463", "0.62879515", "0.62...
0.76963437
0
Generate a point source mask in a binary template
def generate_source_mask(binary, coordinates, point_source_radius_arcmin): mask = binary.copy() if mask.pixel == "HEALPIX": vectors = hp.ang2vec(np.pi / 2.0 - coordinates[0], 2 * np.pi - coordinates[1]) for vec in vectors: disc = hp.query_disc(mask.nside, vec, point_source_radius_ar...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __generate_mask(self):\n mask = np.concatenate([np.ones(len(self.fixed[0])),\n np.zeros(self.num_points),\n np.ones(len(self.fixed[1]))])\n return mask", "def get_sample_mask(self):", "def _source_mask(self, ilens):\n x_mask...
[ "0.63777316", "0.6096258", "0.6018228", "0.5813379", "0.57795286", "0.5770789", "0.57182443", "0.56754243", "0.5647728", "0.5596895", "0.5565386", "0.5550046", "0.5538296", "0.5527444", "0.55175686", "0.54572797", "0.5456611", "0.541923", "0.54050887", "0.53724253", "0.537080...
0.7030319
0
Subtract monopole and dipole from a ``enmap`` object.
def subtract_mono_dipole(emap, mask=None, healpix=True, bunch=24, return_values=False): map_cleaned = emap.copy() if healpix: map_masked = hp.ma(emap) if mask is not None: map_masked.mask = mask < 1 mono, dipole = hp.fit_dipole(map_masked) npix = len(emap) nsi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subtract(self, m): \n f = m.negate()\n return self.add(f)", "def sub(self, other):\n result = self.copy()\n for char, qty in other.chars.items():\n result.chars[char] -= qty\n result.surface = \"\"\n return result", "def __sub__(self,other):\n sel...
[ "0.5995349", "0.55155694", "0.544554", "0.5347694", "0.5312308", "0.52861506", "0.5198829", "0.5182257", "0.5180678", "0.5175526", "0.51617116", "0.51372707", "0.51221365", "0.51200897", "0.5112411", "0.510882", "0.5105839", "0.5062891", "0.5028578", "0.50185025", "0.500606",...
0.5651223
1
Returns the food positions
def calculateFoodPositions(self, state): foodPos = [9999999] * state.getNumFood() if(state.getNumFood() > 0): # minDistance = 900000 # pacmanPosition = state.getPacmanPosition() counter = 0 for i in range(state.data.layout.width): for j in ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def food_pos(self) -> Tuple[int, int]:\n return self._food_pos", "def getFoodPosition(self, gameState):\n #if actions == None: return self.getStartState()\n x,y= self.getStartState()\n cost = 0\n for (x,y) in gameState.getFood():\n # Check figure out the next state a...
[ "0.7618684", "0.71818566", "0.64731205", "0.6437753", "0.63060147", "0.6232791", "0.6173358", "0.6130454", "0.61208814", "0.6061098", "0.6004248", "0.5989968", "0.59725857", "0.5961217", "0.5961217", "0.58746785", "0.5854675", "0.5846138", "0.5842626", "0.5842626", "0.5838038...
0.7976577
0
Apply trained model to forecast the data
def forecast(self, model, idx_rows=None, replace=True): if idx_rows is None: idx_rows = range(self.X.shape[0]) forecastedY = model.predict(self.X[idx_rows, :]) if forecastedY.ndim == 1: forecastedY = forecastedY[:, None] # ravel forecasts and, if replace=True, i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def _forecast_single(\n self,\n model: Prophet\n ) -> pd.DataFrame:\n future = model.make_future_dataframe(self._periods, 'H', False)\n return model.predict(future)", "def train(self, training_data):\n # load and preprocess\n super(Forecast, self).train(training...
[ "0.7045639", "0.6931388", "0.6902844", "0.67578995", "0.66395664", "0.6611622", "0.6609518", "0.6558646", "0.6526664", "0.6518628", "0.65107995", "0.64946663", "0.6492411", "0.64266914", "0.63993824", "0.6273114", "0.62575406", "0.6249836", "0.6216236", "0.62106144", "0.62084...
0.69334894
1
Computes flat indices of forecasts and optionally replaces old forecast values new ones
def add_forecasts(self, frc, idx_rows, replace): # Infer ts flat indices from matrix structure idx_flat = [0] * self.nts for i in self.y_idx: idx_flat[i] = _ravel_idx(self.idxY[i][idx_rows, :], len(self.forecasts[i]))#self.n_hist_points[i], self.n_req_points[i], self.X.shape[0]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_idx_forecast(idx_start, ar_iteration, forecast_cycle, output_k):\n return idx_start + (forecast_cycle * ar_iteration) + output_k", "def forecast(self, model, idx_rows=None, replace=True):\n if idx_rows is None:\n idx_rows = range(self.X.shape[0])\n\n forecastedY = model.predic...
[ "0.57796293", "0.56699914", "0.5437042", "0.5328668", "0.5328668", "0.5270658", "0.526765", "0.52639335", "0.52148795", "0.5198681", "0.51832485", "0.51768935", "0.51708347", "0.5147862", "0.4942046", "0.4940923", "0.49173886", "0.49129942", "0.49102375", "0.4901522", "0.4897...
0.66871035
0
Finds indices of the forecast that should be used to calculate errors
def _frc_indices_for_errors(self, idx_frc=None, idx_rows=None, y_idx=None, idx_original=None): idx = [0] * self.nts if idx_frc is None: if idx_rows is None: for i in y_idx: idx[i] = range(self.n_hist_points[i], len(self.forecasts[i])) else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_prediction_indices(self):\r\n if self.full_df['Dates'][0] > self.full_df['Dates'][len(self.full_df) - 1]:\r\n self.full_df = self.full_df[::-1]\r\n self.full_df.reset_index(inplace=True)\r\n self.full_df.drop('index', axis=1, inplace=True)\r\n date_condition = ((self....
[ "0.6393", "0.61760634", "0.58953345", "0.58511937", "0.57655096", "0.5689469", "0.55490583", "0.5535982", "0.5535562", "0.55272746", "0.54961437", "0.5477939", "0.5471337", "0.5466704", "0.5449711", "0.54494894", "0.53899306", "0.53884476", "0.53828347", "0.5364695", "0.53504...
0.6498885
0
Truncates time series, leaving n_hist + n_req n_rows points from the beginning
def truncate(ts_struct, n_hist, n_req, n_rows): ts = ts_struct.s n_points = n_hist + n_req*n_rows ts = ts[:n_points] ts_struct = TsMiniStruct(ts, ts_struct.norm_div, ts_struct.norm_subt, ts_struct.name, ts_struct.index[:n_points]) return ts_struct
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def truncate_data(self, width):\n times_from_mid = self.time - self.midtime\n idxs = np.abs(times_from_mid) < 0.5 * width * self.duration\n self.time = self.time[idxs]\n self.flux = self.flux[idxs]", "def truncate(self, trunc):\n\n self.nusList = self.nusList[0:trunc]\n ...
[ "0.58632416", "0.5664364", "0.55314773", "0.54320675", "0.5393752", "0.53714186", "0.53255016", "0.522421", "0.5213404", "0.5182394", "0.5178818", "0.51638", "0.5140029", "0.5119951", "0.511511", "0.51118606", "0.51026016", "0.50600785", "0.5057184", "0.5055176", "0.5055049",...
0.69433457
0
Checks that all x time entries preceed corresponding y time entries
def check_time(y, x): check = [] # y stores earliest time for Y in each row, x stores latest time for X in each row. These two must not overlap for ty, tx in product(y, x): check.append(np.all(ty > tx)) return np.all(check)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_intervals_differ((x1, y1), (x2, y2)):\n\n assert y1 >= x1 and y2 >= x2\n return y1 < x2 or y2 < x1", "def time_overlap(d1, d2):\n gt1, gt2, vt1, vt2 = parse_date(d1[\"t1\"]), parse_date(d1[\"t2\"]), parse_date(d2[\"t1\"]), parse_date(d2[\"t2\"])\n return (gt1 != vt2) and (vt1 != gt2) and (gt1 ...
[ "0.631521", "0.6129645", "0.5881331", "0.5828752", "0.5822267", "0.5815593", "0.5789772", "0.57773244", "0.5765758", "0.5748518", "0.5739452", "0.5719782", "0.57163876", "0.568787", "0.5682637", "0.5674616", "0.5669513", "0.5636059", "0.56223434", "0.5612643", "0.5609467", ...
0.76476735
0
Class decorator that makes inherited math ops infectious by reconstructing results (probably horribly inefficient...).
def infectious_math(cls): for prp in [ "__add__", "__radd__", "__sub__", "__rsub__", "__mul__", "__rmul__", "__matmul__", "__rmatmul__", "__truediv__", "__rtruediv__", "__floordiv__", "__rfloordiv__", "__mod__", "__rmod__", "__divmod__", "__rdivmod__", "__pow__", "__rpow__", "_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __rpow__(self, ???):", "def __pow__(self, ???):", "def __rmul__(self, *args, **kwargs):\n return self.__mul__(*args, **kwargs)", "def __div__(self,that):\n return self.__opExpand2(that, np.divide)", "def __pow__(self,*args):\r\n pass", "def __mul__(self, other: '__class__') -> '__class__':", ...
[ "0.654417", "0.650182", "0.6449434", "0.6415313", "0.63021845", "0.62901634", "0.62376845", "0.6147322", "0.6125321", "0.6113538", "0.6113538", "0.6113538", "0.6113538", "0.6113538", "0.6113538", "0.6113538", "0.6113538", "0.6113538", "0.6113538", "0.6113538", "0.6113538", ...
0.7602947
0
A class decorator that scoops up AbstractValueRange class properties in order to create .validate and .abstract methods for the class. Note that properties added after the class is defined aren't counted. Each AbstractValueRange found is is also replaced with a class instance constructed from it.
def abstractable(cls): cls._ranges = [] for prp in dir(cls): a = getattr(cls, prp) if isinstance(a, AbstractValueRange): cls._ranges.append((prp, a)) setattr(cls, prp, cls(a.val)) cls._ranges = sorted(cls._ranges, key=lambda nr: nr[1].mn) @classmethod def validate(cls, val): ovn = mi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(\n self, low=None, high=None, exclude_low=False, exclude_high=False\n ):\n vtype = type(high)\n if (low is not None) and (vtype is not float):\n vtype = type(low)\n if vtype not in RangeTypes:\n raise TraitError(\n \"TraitRange can on...
[ "0.58539844", "0.5823019", "0.5704437", "0.56726223", "0.5595497", "0.5497923", "0.5497923", "0.5497923", "0.5497923", "0.5449984", "0.54466105", "0.54331356", "0.5409009", "0.5322483", "0.5308604", "0.5299312", "0.529273", "0.5256234", "0.5252356", "0.5231222", "0.52031356",...
0.7320309
0
reverse hash names and correct types of input params
def prepare_request_params( request_params: Dict, model_id: Text, model_data: Dict ) -> Dict: request_params = correct_types(request_params, model_data["columns_data"]) if model_data["hashed_indexes"]: request_params = reverse_hash_names(model_id, request_params) return request_params
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_hash_params():\n assert (\n hash_params(\n {\n \"name\": \"my-name\",\n \"labels\": {\n \"label1\": \"label\",\n },\n }\n )\n == \"1c67a2e8dd405725a4cdf7b58fed3e948aed135ac25c494a3b336c83a72ac0c8\...
[ "0.62760264", "0.5646153", "0.55614465", "0.5492248", "0.5427994", "0.5372844", "0.52636063", "0.52626055", "0.5222975", "0.5219779", "0.51973754", "0.5185801", "0.516581", "0.512964", "0.51196593", "0.51129556", "0.5112896", "0.5097767", "0.5097569", "0.5094152", "0.5086655"...
0.6062235
1
read preset yaml file
def read_yaml(preset_file: Text) -> Dict: with open(preset_file, "r") as preset_file: return yaml.safe_load(preset_file)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _read(self, preset_type):\n logger.debug('read presets for %s', self._device.name)\n with self._file_open_rlock(preset_type) as f:\n f.seek(0)\n return yaml.full_load(f) or {}", "def read_config(name):\n import yaml\n fname=get_config_file(name)\n #print(\"reading...
[ "0.76676106", "0.6564957", "0.6506614", "0.6506614", "0.64934397", "0.64816904", "0.6461866", "0.6452692", "0.6411916", "0.6383461", "0.63687843", "0.63218427", "0.61141515", "0.6046386", "0.6034851", "0.5995024", "0.5992918", "0.5972923", "0.5967604", "0.5958729", "0.5956925...
0.77185076
0
get preset by id
def get_preset_by_id(preset_id: Text): presets = get_presets()["presets"] for preset in presets: if preset_id == preset["id"]: return preset
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_preset(cls, preset_name):\n try:\n return FormatPreset.objects.get(id=preset_name)\n except FormatPreset.DoesNotExist:\n return None", "def get_preset(self, filename):\r\n\r\n raise NotImplementedError", "def from_id(self, id_):\n return next((season fo...
[ "0.7009468", "0.62349856", "0.6047001", "0.5926799", "0.59213954", "0.5910554", "0.58274746", "0.5822877", "0.5805151", "0.5799155", "0.5735652", "0.57321256", "0.5723291", "0.5723291", "0.5719522", "0.56552696", "0.5629674", "0.56137663", "0.5599995", "0.55942243", "0.557743...
0.86576116
1
get presets data from yml configs from presets folder
def load_presets(): presets = [] if not os.path.isdir(cfg.presets_folder): if os.path.isfile(cfg.presets_folder): logger.error(f"Presets folder is file. Must be a path to folder") logger.info(f"Presets folder not found. Create new folder.") os.makedirs(cfg.presets_folder) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_presets():\n if not cfg.presets or (\n cfg.presets.get(\"loaded_at\")\n and cfg.presets[\"loaded_at\"] < os.path.getmtime(cfg.presets_folder)\n ):\n cfg.presets = {\"presets\": load_presets(), \"loaded_at\": time.time()}\n\n return cfg.presets", "def LoadConfig(path):\n con...
[ "0.66394365", "0.66266036", "0.66151726", "0.63532203", "0.62444675", "0.59600735", "0.58206534", "0.5796542", "0.5772314", "0.5722974", "0.5652827", "0.5648507", "0.5566529", "0.5548587", "0.55386937", "0.55286855", "0.55171806", "0.55162925", "0.55146533", "0.54359055", "0....
0.7563528
1
create _id dict for row based on several fields
def get_obj_id_from_row(model_data: Dict, row: Dict) -> Dict: result = {} if not model_data.get("identity"): # if our tbale does not have unique or primary keys key_fields = row else: key_fields = model_data["identity"] if "_id" in key_fields: del key_fields["_id"] fo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_obj_id_from_query(id_row: Text) -> Dict:\n pairs = id_row.split(\",\")\n _id = {}\n for pair in pairs:\n key, value = pair.split(\"=\")\n _id[key] = value\n return _id", "def get_incident_id(row):\n additional_fields = row.get('additional_fields')\n generated = row.get...
[ "0.6771289", "0.67671764", "0.6173762", "0.61207986", "0.6114771", "0.6064955", "0.6017081", "0.59817713", "0.5963316", "0.59334695", "0.5878823", "0.5865779", "0.58142", "0.5810064", "0.5763406", "0.57617784", "0.57531255", "0.5714731", "0.56796074", "0.56796074", "0.5679607...
0.70345235
0
create query str based on _id
def create_obj_id_for_query(id_dict: Dict) -> Text: return ",".join([f"{key}={value}" for key, value in id_dict.items()])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def genQrelStr(queryId, docId, relGrade):\n return f'{queryId} 0 {docId} {relGrade}'", "def __str__(self):\n \n return \"#%s %s %s [%s]\" % (self.dbid, self.title, self.query, self.group)", "def __generateQuery(self, query):\n if query == None:\n return [\"1=1\"]\n eli...
[ "0.6416852", "0.6328235", "0.6172556", "0.60275567", "0.5993954", "0.5990584", "0.59516644", "0.59291416", "0.5917684", "0.5917641", "0.58963823", "0.5875909", "0.5871031", "0.58258325", "0.5776352", "0.57414544", "0.57262623", "0.5670333", "0.5664306", "0.56517816", "0.56415...
0.6772837
0
reverse _id dict from query str
def extract_obj_id_from_query(id_row: Text) -> Dict: pairs = id_row.split(",") _id = {} for pair in pairs: key, value = pair.split("=") _id[key] = value return _id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_obj_id_for_query(id_dict: Dict) -> Text:\n return \",\".join([f\"{key}={value}\" for key, value in id_dict.items()])", "def parse_id(string):\n return string.split('/')[-1]", "def index_by_rev_id(s):\n return (json.loads(s)['rev_id'], s)", "def _decode_resource_id(self, resource_id):\n ...
[ "0.6230033", "0.58969265", "0.5697617", "0.5612472", "0.5609126", "0.5583113", "0.5568748", "0.54684997", "0.5412347", "0.5382011", "0.5380551", "0.53675485", "0.5355391", "0.5340996", "0.53367853", "0.53340584", "0.5315308", "0.5306769", "0.53009224", "0.53009135", "0.529650...
0.6731998
0
This method checks that the message payload keys matches the required (specified) keys
def check_message_payload(dequeued_item): key_array = ["dateTime", "payload", "messageType"] # Note that the "ttl" key (and others) may be present but its not checked here! for key in key_array: if key not in dequeued_item.keys(): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_notification_message(message, fields):\n fields_set = set(fields)\n msg_fields_set = set(message.keys())\n\n return fields_set == msg_fields_set", "def validate_various_custom_payloads(self, statement):\n\n # Simple key value\n custom_payload = {'test': b'test_return'}\n ...
[ "0.64858764", "0.6466055", "0.6358601", "0.63462335", "0.6340785", "0.62963104", "0.6154411", "0.6140847", "0.6125382", "0.61224735", "0.60394204", "0.60306793", "0.5949499", "0.594162", "0.5902508", "0.58859366", "0.58705306", "0.5841058", "0.58276576", "0.58138263", "0.5789...
0.65588474
0
The spatial filter does a filtering of the ont collection based on the asset called this_asset.
def spatial_filter(self, cell): if self.cell_time_event: # Only append outages on assets for the cells that have events if not g_config.IS_DEPLOYED: print "An interesting time event has occurred in this cell..." for this_ont in cell['onts']: ev...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def spatial(self):", "def spatialFilter(input_shp,aoi,output_shp):\n inDataSource = driver.Open(input_shp, 0)\n inlayer = inDataSource.GetLayer()\n\n # create the data source\n outdata_source = driver.CreateDataSource(output_shp)\n # create the spatial reference, WGS84\n srs = osr.SpatialReference()\n srs...
[ "0.5826863", "0.58125466", "0.56897855", "0.56300753", "0.5622053", "0.53925353", "0.5270239", "0.5219331", "0.5218549", "0.5213778", "0.52093184", "0.5187526", "0.5186989", "0.5175209", "0.5143669", "0.506433", "0.50636363", "0.5056489", "0.50431526", "0.50428337", "0.503483...
0.66909134
0
Computes a GUID based on the lat lon and time value
def compute_cell_guid(payload, resolution): # query_guid = payload["query_guid"] this_lat = payload["latitude"] this_lon = payload["longitude"] # utility = payload["company"] outage_test_time = payload["outageTime"] # circuit_id = payload["circuitID"] # asset_id =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unique_id(self):\n return '{}-{}-{}'.format(self._latitude, self._longitude, self._type)", "def unique_id(self):\n return '{}-{}-{}'.format(self.airly.latitude, self.airly.longitude,\n self.type)", "def guid():\n return _guid64()", "def create_id(uid, begi...
[ "0.67834556", "0.64428973", "0.63727576", "0.63132733", "0.6305452", "0.62614495", "0.60846955", "0.60316205", "0.58425534", "0.58296394", "0.5826276", "0.57543415", "0.5753323", "0.57486445", "0.57385695", "0.57323784", "0.57281345", "0.5715902", "0.56485146", "0.56035817", ...
0.6624928
1
Builds a cell and stores it in local shared memory
def build_new_cell(self, this_cell_guid, this_items_payload, ttl): self.my_local_logger.debug("BUILDING_CELL %d, %s" % (self.cell_count, this_cell_guid)) t0 = time.time() # Step 3) Query the API and find all utility assets within the region of interest cell = self.get_data_in_cell_area(t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_cell(self, cid):\n self.cells[cid] = Cell()", "def create_cells(self):\n if self.do_run:\n \n self.del_cells()\n \n if self.id == 0: print \"creating cells\"\n \n for n in range(self.n_celltypes): \n self.ce...
[ "0.61095965", "0.61084694", "0.58352333", "0.57928437", "0.5674827", "0.56573546", "0.55723375", "0.55125356", "0.55007905", "0.5465683", "0.5377128", "0.5363753", "0.53556055", "0.5289123", "0.5284729", "0.52729017", "0.5207175", "0.52052426", "0.5189066", "0.51578134", "0.5...
0.6591228
0
This method grooms the outages by looking at the internal shared queue and pulling off the items that are ready to be processed. The shared queue is passed between processes contains the cell data along with processing state for each cell.
def groom_outages(self): ####################################################### # This is the general flow for the groom process # When the queue is hit then it will have the start and end times along with the various parameters # needed for the outage event calculation. # When ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def populatereadyqueue():\n readyQueue.put(Process(\"P1\", time(0, 0, 1), time(0, 0, 4)))\n readyQueue.put(Process(\"P2\", time(0, 0, 2), time(0, 0, 6)))\n readyQueue.put(Process(\"P3\", time(0, 0, 3), time(0, 0, 2)))", "def process_incoming_rabbit_mq(self):\n self.groomer_state = \"3:PROCESS QUE...
[ "0.6099746", "0.58620554", "0.5811855", "0.5680897", "0.56594044", "0.5552448", "0.55368364", "0.5503642", "0.54968864", "0.5495344", "0.5491691", "0.54516405", "0.5426601", "0.5417718", "0.5406959", "0.54008645", "0.53938526", "0.5372387", "0.53682196", "0.53610307", "0.5351...
0.68159086
0
Triggers a Utility wide grooming process by setting up a ttl of 1 and injecting it into the Rabbit MQ bus. When called, the outage test location is calculated by starting in the center of the geographic location using the current time for outage detection. All utilities in the utility dictionary will be groomed when th...
def utility_groom(self, utility_name="ALL", location=None, ttl=g_config.TTL_MAX): # TODO: The best approach here is to trigger the outage groom at the center of the last alarm. # trigger_time = arrow.get("2015-01-09T19:42:33.689-0400").timestamp*1000 trigger_date = arrow.utcnow().to('US/Eastern'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def groom_outages(self):\n #######################################################\n # This is the general flow for the groom process\n # When the queue is hit then it will have the start and end times along with the various parameters\n # needed for the outage event calculation.\n ...
[ "0.55593807", "0.49345917", "0.4925677", "0.4925677", "0.4878284", "0.48351443", "0.48202014", "0.4816385", "0.4758889", "0.4738374", "0.4718828", "0.46661833", "0.46393028", "0.4590486", "0.4574641", "0.4569493", "0.45668426", "0.4551932", "0.4538091", "0.45294482", "0.45263...
0.6945617
0
Read the camera 2 calibration matrix from a text file
def read_kitti_calib(filename): with open(filename) as f: for line in f: data = line.split(' ') if data[0] == 'P2:': calib_P2 = np.array([float(x) for x in data[1:13]]) calib_P2 = calib_P2.reshape(3, 4) return _extend_matrix(calib_P2) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_kitti_Tr_velo_to_cam(filename):\n\n with open(filename) as f:\n for line in f:\n data = line.split(' ')\n if data[0] == 'Tr_velo_to_cam:':\n calib = np.array([float(x) for x in data[1:13]])\n calib = calib.reshape(3, 4)\n return ...
[ "0.7400191", "0.71928585", "0.66431284", "0.66192037", "0.655748", "0.6374748", "0.6367067", "0.62838167", "0.6255781", "0.6255781", "0.62304705", "0.6170307", "0.61261237", "0.60908675", "0.6080702", "0.6077515", "0.60668534", "0.60243523", "0.601593", "0.59559715", "0.59524...
0.73130816
1
Read the camera 2 calibration matrix from a text file
def read_kitti_Tr_velo_to_cam(filename): with open(filename) as f: for line in f: data = line.split(' ') if data[0] == 'Tr_velo_to_cam:': calib = np.array([float(x) for x in data[1:13]]) calib = calib.reshape(3, 4) return _extend_matri...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_kitti_calib(filename):\n\n with open(filename) as f:\n for line in f:\n data = line.split(' ')\n if data[0] == 'P2:':\n calib_P2 = np.array([float(x) for x in data[1:13]])\n calib_P2 = calib_P2.reshape(3, 4)\n return _extend_matr...
[ "0.7313037", "0.7194318", "0.66452456", "0.66209966", "0.6558806", "0.63764954", "0.6368903", "0.628567", "0.6257737", "0.6257737", "0.6230621", "0.61706847", "0.61258227", "0.60915226", "0.6082214", "0.60794824", "0.60680056", "0.60255766", "0.60172117", "0.5958149", "0.5952...
0.7400218
0
Return the sum of all deployed scripts' exit_status
def sum_exit_status(self): return sum([sd.exit_status for sd in self.node.script_deployments])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def determine_exit_code(self) -> int:", "def get_exit_code(self):", "def exit_status(self):\n return self._exit_status", "def test_deploy_exit_code(deploy_result: Result) -> None:\n assert deploy_result.exit_code == 0", "def exit_code(self):\n return self._process.exitcode", "def test_de...
[ "0.6701062", "0.6684518", "0.65652764", "0.63504815", "0.633231", "0.6305768", "0.6271129", "0.6197706", "0.61636066", "0.6009579", "0.5938462", "0.569016", "0.5683547", "0.5678397", "0.5585153", "0.5580278", "0.55369", "0.55267185", "0.54895616", "0.5468069", "0.5436683", ...
0.89746463
0
Check for presence of template indicator and if found, perform variable substition on script based on template type, returning script.
def substitute(script, submap): match = config.TEMPLATE_RE.search(script) if match: template_type = match.groupdict()['type'] try: return config.TEMPLATE_TYPEMAP[template_type](script, submap) except KeyError: logger.error('Unsupported template type: %s' % templa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def materialize(template, substitutions):\n\n script_str = template\n for param, value in substitutions.items():\n script_str = re.sub(param, str(value), script_str)\n\n return script_str", "def test_starting_template(checker):\n contents = labeled.contents(label=\"template\")\n _ = tomllib...
[ "0.5955056", "0.56082845", "0.5503071", "0.53630507", "0.5323912", "0.5315474", "0.5254942", "0.52262276", "0.5194685", "0.51565975", "0.512844", "0.5126433", "0.5123111", "0.5096525", "0.50762796", "0.5056655", "0.5052811", "0.504477", "0.50420177", "0.5032586", "0.5024523",...
0.65964556
0
Return a ScriptDeployment from script with possible template substitutions.
def script_deployment(path, script, submap=None): if submap is None: submap = {} script = substitute(script, submap) return libcloud.compute.deployment.ScriptDeployment(script, path)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def materialize(template, substitutions):\n\n script_str = template\n for param, value in substitutions.items():\n script_str = re.sub(param, str(value), script_str)\n\n return script_str", "def resolve_deployment(self, args, context, info):\n params = {\n 'id': self.deployment_...
[ "0.5676176", "0.5357426", "0.52369016", "0.51911056", "0.5185563", "0.515868", "0.5134302", "0.5037434", "0.5012536", "0.49986196", "0.4988495", "0.497901", "0.49477336", "0.49463597", "0.49423224", "0.48193878", "0.4816743", "0.4800821", "0.478773", "0.4757937", "0.47303745"...
0.73499775
0
Merge list of tuples into dict amap, and optionally load source as value
def merge(items, amap, load=False): for target, source in items: if amap.get(target): logger.warn('overwriting {0}'.format(target)) if load: amap[target] = open(source).read() else: amap[target] = source
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _merge(acc: Dict[str, str], cur: Any) -> Dict[str, str]:\n parsed = _parse_feature(cur)\n acc[\"timestamp\"] = parsed[\"timestamp\"]\n acc[\"lat\"] = parsed[\"lat\"]\n acc[\"lon\"] = parsed[\"lon\"]\n key = parsed[\"property\"]\n val = parsed[\"value\"]\n\n acc[key] = val\n\n return acc...
[ "0.5376596", "0.53008795", "0.52162904", "0.5176841", "0.5100513", "0.5100351", "0.50874263", "0.5063674", "0.5049875", "0.5026738", "0.49969262", "0.49399683", "0.49338087", "0.49284425", "0.49189544", "0.4899509", "0.48898506", "0.48689896", "0.4861313", "0.485226", "0.4838...
0.66235095
0
Merge list of 'key=val' strings into dict amap, warning of duplicate keys
def merge_keyvals_into_map(keyvals, amap): for kv in keyvals: k,v = kv.split('=') if k in amap: logger.warn('overwriting {0} with {1}'.format(k, v)) amap[k] = v
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _assoc_list_to_map(lst):\n d = {}\n for run_id, metric in lst:\n d[run_id] = d[run_id] + [metric] if run_id in d else [metric]\n return d", "def parse_mappings(mapping_list, unique_values=True, unique_keys=True):\n mappings = {}\n for mapping in mapping_list:\n mapping = mapping....
[ "0.69449663", "0.6501158", "0.63420725", "0.6331959", "0.629784", "0.60582787", "0.6026354", "0.6023992", "0.60174733", "0.59499186", "0.5932536", "0.5912598", "0.5894253", "0.588187", "0.58701086", "0.58252645", "0.5817025", "0.5804706", "0.5799321", "0.5760761", "0.5759711"...
0.65878403
1
Initialize a node deployment. If name is not given, it will generate a random name using prefix. The node name is added to the global substitution map, which is used to parameterize templates in scripts containing the form {variable_name}. The list of bundle names is concatenated with any globally common bundle names f...
def __init__(self, name=None, bundles=[], pubkey=config.DEFAULT_PUBKEY, prefix=config.DEFAULT_NAME_PREFIX, image_name=config.DEFAULT_IMAGE_NAME, subvars=[]): self.name = name or prefix + config.random_str() config.SUBMAP['node_name'] = self.name config.SUBMAP['...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_node(self, **kwargs):\n default = \"ubuntu.precise\"\n template = {\"name\":\"ubuntu\", \"args\":[]}\n if 'image' not in kwargs:\n kwargs['image'] = default\n \n for image in self.list_images():\n if image.name == kwargs['image']:\n ...
[ "0.60860056", "0.60206056", "0.5808691", "0.57451814", "0.55979425", "0.54672474", "0.5438797", "0.5254181", "0.5234824", "0.52239263", "0.52154297", "0.51312876", "0.5126072", "0.5076695", "0.5062484", "0.5062105", "0.50581455", "0.5012466", "0.50034547", "0.49995098", "0.49...
0.716755
0
Use driver to deploy node, with optional ability to specify location id and size id. First, obtain location object from driver. Next, get the size. Then, get the image. Finally, deploy node, and return NodeProxy.
def deploy(self, driver, location_id=config.DEFAULT_LOCATION_ID, size=config.DEFAULT_SIZE): logger.debug('deploying node %s using driver %s' % (self.name, driver)) args = {'name': self.name} if hasattr(config, 'SSH_KEY_NAME'): args['ex_keyname'] = config.SSH_KEY_NAM...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_node(config, args):\n log = logging.getLogger('kraftwerk.create-node')\n \n if 'pubkey' in config:\n pubkey_paths = [config[\"pubkey\"]]\n else:\n pubkey_paths = [os.path.join(os.environ['HOME'], '.ssh', f) for f \\\n in ['id_rsa.pub', 'id_dsa.pub']]\n\n for path ...
[ "0.5938131", "0.557614", "0.5524653", "0.5473491", "0.5434808", "0.5308815", "0.5255935", "0.5188889", "0.50843686", "0.5061554", "0.5042752", "0.5014111", "0.5014111", "0.5014111", "0.4946615", "0.49386856", "0.4896898", "0.48905832", "0.48619375", "0.48349527", "0.48253033"...
0.7511876
0
Return an image from a list of images. If the name is an exact match, return the last exactly matching image. Otherwise, sort images by 'natural' order, using decoratesortundecorate, and return the largest.
def image_from_name(name, images): prefixed_images = [i for i in images if i.name.startswith(name)] if name in [i.name for i in prefixed_images]: return [i for i in prefixed_images if i.name == name][-1] decorated = sorted( [(int(re.search('\d+', i.name).group(0)), i) for i in prefixed_im...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def image(images):\n return images[0]", "def get_image_index(name: str):\n base_name = os.path.basename(name)\n nums = pattern.findall(base_name)\n if len(nums) != num_count:\n raise BaseException(f\"can't exact index from the string: {name}\")\n return float(nums[num_so...
[ "0.6076155", "0.59245753", "0.56301457", "0.5629401", "0.5586894", "0.5545739", "0.5491441", "0.5455302", "0.54403675", "0.5406762", "0.53983486", "0.5376005", "0.53574514", "0.5324784", "0.5322303", "0.5318322", "0.53036374", "0.528725", "0.52821183", "0.5232356", "0.5197757...
0.70781
0
Destroy all nodes matching specified name
def destroy_by_name(name, driver): matches = [node for node in list_nodes(driver) if node.name == name] if len(matches) == 0: logger.warn('no node named %s' % name) return False else: return all([node.destroy() for node in matches])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy_nodes(\n self,\n name,\n ):\n pass", "def destroyNodes(self):\r\n for nt in self.listNodes.keys(): \t# for all kind of nodes...\r\n for node in self.listNodes[nt]: \t# for all nodes of type <nt>\r\n if node.graphObject_: ...
[ "0.89183813", "0.7518412", "0.73511475", "0.6996712", "0.68823797", "0.6851875", "0.6709151", "0.6574549", "0.64798856", "0.64717954", "0.64107287", "0.6372367", "0.6318771", "0.63186085", "0.6313595", "0.6286503", "0.6286077", "0.62713856", "0.6254984", "0.6247449", "0.61719...
0.7676843
1
Extract image from page
def extract_image(page_html, family_url, folder): image_extractor = Extractor(page_html, family_url) for url in image_extractor.get_image_table(): image_page_url = urljoin(family_url, url) # print(image_page_url) imres = requests.get(image_page_url) image_page_extractor = Extract...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_image(self):\n try:\n self.image = self.soup.find(class_=\"recipe-header-image\").find(\"img\").get(\"src\", \"\")\n except Exception:\n current_app.logger.error(f\"Could not extract image: {traceback.format_exc()}\")\n self.image = \"\"", "def extract_image...
[ "0.65915406", "0.64927757", "0.6479507", "0.641657", "0.63931274", "0.6373676", "0.6345552", "0.632446", "0.6250066", "0.62194246", "0.61836123", "0.6158441", "0.6157862", "0.61467785", "0.6128931", "0.61279196", "0.6108338", "0.6041427", "0.603528", "0.5975284", "0.5954612",...
0.7246679
0
add name in text (string) into defaultdict self.adj; Two consecutive words starting with capital letters is considered as a name
def count_name(text, adj): for x in re.finditer(r'[A-Z][a-z]*[\s][A-Z][a-z]*',text): adj[x.group()] += 1 return
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add(self, name):\n\n # no need to add first_name while adding full_name\n name_list = name.strip().split()[1:]\n name_list.append(name)\n for item in set(name_list):\n node = self.root\n # check for every char in word, i.e. check whether is it in trie\n ...
[ "0.6107998", "0.5619115", "0.54476684", "0.5408273", "0.53480464", "0.5332775", "0.53054017", "0.5290365", "0.5239127", "0.5233279", "0.5188589", "0.5183721", "0.5102933", "0.5065198", "0.50336486", "0.5007787", "0.50033927", "0.4989637", "0.49813262", "0.49702996", "0.496964...
0.6899974
0
Build query filter json object from the list of filter tuples.
def _build_query_filters(self, query: dict, filters: list) -> dict: for filter_tuple in filters: if not isinstance(filter_tuple, tuple) or len(filter_tuple) != 3: LOG.error("polling_filters tuple %s : invalid format or does not contain 3 elements - skipping this filter", filter_tupl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_query_structure(self):\n query_list = list()\n filter_list = list()\n for key, val in self.q_dict.items():\n if key in self.es_query_keys:\n query_list.append(\n {\"match\": {\".\".join(key.split(\"_\")): val[0]}})\n elif key in...
[ "0.67231256", "0.64408636", "0.64268565", "0.6204562", "0.61957335", "0.61688477", "0.6138038", "0.6080542", "0.6037035", "0.5981354", "0.5940816", "0.5940771", "0.5939902", "0.5939902", "0.5930962", "0.59123373", "0.5898921", "0.58890784", "0.58752644", "0.5870992", "0.58703...
0.76720446
0
Create a url to link back to the endpoint entity
def make_linkback_url(self, entity_id: str, linkback_url : str = LINKBACK_URL) -> str: return urljoin(self.endpoint_url, linkback_url.format(organization_name=self.organization_name, target_id=entity_id))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_url(self, endpoint):\n api = r'(?P<resource_name>%s)/(?P<endpoint>%s)%s$' % (\n self._meta.resource_name, endpoint, trailing_slash())\n endpoint = endpoint.replace('/', '_')\n return url(api, self.wrap_view(endpoint), name='api_%s' % endpoint)", "def _make_url(self):\n ...
[ "0.70204717", "0.7010034", "0.70085686", "0.6981102", "0.6861092", "0.6779086", "0.6771032", "0.67419726", "0.6704068", "0.6667154", "0.6653281", "0.6647118", "0.6622358", "0.6622358", "0.66155237", "0.66101986", "0.65838134", "0.6573324", "0.6555827", "0.6554094", "0.6536521...
0.7048812
0
Create a base URL string for Randori
def get_randori_base_url(self) -> str: return urljoin(self.endpoint_url, self.organization_name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_random_url(self):\n return self._base_url % random.randrange(self._random_create_start, \n self._random_create_end)", "def create_url(self):\n self.base_url = self.base + self.strs[jpn.path_latest]", "def url_maker():\n chars = string.ascii_lowercase + string.ascii_u...
[ "0.74060994", "0.73347884", "0.69653344", "0.68627286", "0.68294466", "0.68157744", "0.6751232", "0.67082554", "0.66753846", "0.6669701", "0.66656274", "0.66619396", "0.66507816", "0.664724", "0.6636139", "0.66246015", "0.6614606", "0.6611075", "0.66022575", "0.65838593", "0....
0.7939046
0
Update the Randori target impact_score field in Randori
def update_target_impact_score(self, target_id: str, impact_score: str) -> dict: data = { "data": {"impact_score": impact_score}, "q": { "condition": "OR", "rules": [ { "id": "table.id", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_score():\n pass", "def test_update_impact_level(self):\n pass", "def applyEffect(self, user, target, environment):\n pkmn = self.getEffectedPokemon(user, target)\n self.affectPkmn(pkmn)", "def update(self, state, action, nextState, reward):\n \"*** YOUR CODE HERE...
[ "0.62133485", "0.5913106", "0.5904542", "0.577858", "0.57466686", "0.5701552", "0.56685454", "0.5642025", "0.55856603", "0.5564629", "0.5564629", "0.5557118", "0.55539006", "0.5551903", "0.55226016", "0.55052036", "0.54928756", "0.5490252", "0.5482003", "0.54716885", "0.54523...
0.7459569
0
Update the Randori target status field in Randori
def update_target_status(self, target_id: str, status: str) -> dict: status_data = { "data": {"status": status}, "q": { "condition": "OR", "rules": [ { "id": "table.id", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _updateStatus(self, result):\n\n if result.status is not None:\n # status was explicitly set\n self.target.localStatus = result.status\n if self.target.present and self.target.created is None:\n self.target.created = self.configSpec.operation not in [\n ...
[ "0.65340257", "0.621567", "0.60055655", "0.58696693", "0.5846075", "0.57160985", "0.56930256", "0.5688609", "0.56666493", "0.56626266", "0.5623839", "0.56038815", "0.55953866", "0.5553282", "0.5549852", "0.549124", "0.5471832", "0.54681176", "0.5463689", "0.5374228", "0.53711...
0.6707593
0
Call Randori endpoint to get the paths data for target from Randori.
def get_paths(self, target_id: str) -> dict: params = { 'terminal': target_id } url = self._get_uri(GET_PATHS_URI.format(api_version=self.api_version)) response = self.rc.execute("GET", url=url, params=par...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_paths(self, target, use_edges=False, downwards=None):\n raise NotImplementedError()", "def _path_request (self, paths):\n headers = {\n 'Content-Type': 'application/json',\n 'Accept': 'application/json, text/javascript, */*',\n }\n\n data = json.dumps({\n...
[ "0.59887326", "0.5557664", "0.55168045", "0.52768487", "0.52723897", "0.5226366", "0.5209093", "0.51812863", "0.51447207", "0.5119309", "0.51035863", "0.50633556", "0.5027665", "0.50258744", "0.50172734", "0.50055444", "0.5003824", "0.49922523", "0.49858424", "0.49694756", "0...
0.58727896
1
Get ``verify`` parameter from app config. Value can be set in the [fn_my_app] section
def _get_verify_ssl(app_configs: dict): # start checking the app specific settings verify = app_configs.get("verify") # because verify can be either a boolean or a path, # we need to check if it is a string with a boolean # value first then, and only then, we convert it to a bool # NOTE: that ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verify(self) -> Optional[pulumi.Input[bool]]:\n return pulumi.get(self, \"verify\")", "def verify(self) -> pulumi.Output[Optional[bool]]:\n return pulumi.get(self, \"verify\")", "def __get_verify_mode(self):\n ...", "def get_config_verify(self,\n raw_response...
[ "0.59601855", "0.57779735", "0.57575667", "0.56036246", "0.5532416", "0.55147356", "0.54316854", "0.5391469", "0.5352174", "0.5283743", "0.5209203", "0.5200793", "0.51914763", "0.51698387", "0.5161429", "0.51327753", "0.5109644", "0.50775284", "0.5064769", "0.5042957", "0.504...
0.71091086
0
Create tomb from modules If modules install add topmost package containing this module.
def FromModules (cls, modules = None): tomb = cls () if modules: for module in modules: tomb.Add (module) else: tomb.Add (__package__ or __name__.partition ('.') [0]) return tomb
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_modules_toc_file(master_package, modules, opts, name='modules'):\n text = format_heading(1, '%s Modules' % opts.header)\n text += '.. toctree::\\n'\n text += ' :maxdepth: %s\\n\\n' % opts.maxdepth\n\n modules.sort()\n prev_module = ''\n for module in modules:\n # look if the m...
[ "0.62644976", "0.6228506", "0.6160964", "0.6028777", "0.5958937", "0.58448386", "0.5753952", "0.5728624", "0.54660445", "0.54345536", "0.5416097", "0.5385732", "0.5384827", "0.53781", "0.53490126", "0.5315421", "0.53149194", "0.53080183", "0.530459", "0.52494943", "0.52450925...
0.6270195
0