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
Simple check to see if ship is alive.
def is_ship_alive(ship): # If and when flag systems become advanced enough **FUN** things can # be applied to make this check more hilarious. return ship.attributes.hull > 0 # though it can't be < 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_active_ship(self):\n if self.mark in (constants.ACTIVE_SHIP_MARK, constants.HIT_SHIP_MARK):\n return True\n return False", "def is_alive(self):\r\n return self._health_points > 0", "def has_destroyed_ship(self):\n if self.mark == constants.DEAD_SHIP_MARK:\n ...
[ "0.6839061", "0.681146", "0.67993784", "0.6782072", "0.67508996", "0.66351205", "0.66189015", "0.6511874", "0.64910436", "0.64686906", "0.64646935", "0.642008", "0.63614523", "0.63314337", "0.6327019", "0.6312717", "0.6312717", "0.62822807", "0.6282211", "0.6261865", "0.62574...
0.837805
0
Retuns a dict of applied debufs calculated from ship schema as well as ship attributes. Source is ShipSchema target_in is a Ship
def grab_debuffs(source, target_in): inactive = {} sensor_str = target_in.schema.sensor_strength target = target_in # I'm sure there's a list comprehension thing that could be used # to clean this up but I have no idea what if source.target_painter: if target.debuffs.get('inactive', {})....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def applyDemapping(self):\n pass", "def _prepare_wsdl_objects(self):\r\n # This is the primary data structure for processShipment requests.\r\n self.RequestedShipment = self.client.factory.create('RequestedShipment')\r\n self.RequestedShipment.ShipTimestamp = datetime.now()\r\n ...
[ "0.51468414", "0.49034572", "0.48398834", "0.46795273", "0.4662075", "0.4631789", "0.46312076", "0.45897087", "0.45664695", "0.456442", "0.45553985", "0.45532733", "0.45330125", "0.45192343", "0.45020705", "0.44990775", "0.44931084", "0.44801822", "0.44693604", "0.44470948", ...
0.5982001
0
Do a ship attack. Apply the attacker's schema onto the victim_ship as an attack and return a new Ship object as the result.
def ship_attack(attacker_ship, victim_ship): if not is_ship_alive(victim_ship): # save us some time, it should be the same dead ship. return victim_ship if attacker_ship.debuffs.get('active', {}).get('ECM', 0) != 0: # attacker is jammed can't attack or apply debuffs return vict...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def attack(self, ship_id, target_id):\n\n # Perfom attack\n attack_string = \"SELECT ATTACK(\" + str(ship_id) + \",\" + str(target_id) + \");\"\n self.conn_cur.execute(attack_string)\n print(\"[>] Attack ordered\")", "async def ship(self, ctx):\r\n if ctx.invoked_subcommand:\r\...
[ "0.63745105", "0.6163089", "0.58282447", "0.5585567", "0.5562952", "0.55624014", "0.5535219", "0.55243814", "0.54973793", "0.54929805", "0.5486585", "0.54694176", "0.54549104", "0.54502255", "0.54286504", "0.53765404", "0.53377175", "0.5325363", "0.53097075", "0.53005075", "0...
0.8006786
0
Prune an AttackResult of dead ships and restore shields/armor. Returns the pruned fleet and a count of ships.
def prune_fleet(attack_result): fleet = [] count = {} damage_taken = 0 for ship in attack_result.damaged_fleet: if not ship.attributes.hull > 0: continue updated_debuffs = {} if ship.debuffs.get('inactive'): updated_debuffs['active'] = ship.debuffs.get(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prune(i):\n\n return {'return':1, 'error':'pruning is not yet supported in this scenario'}", "def shotResult(self, shot, hit, sunk):\r\n logging.debug(\"shot result: %s, hit: %d, sunk: %d\" % (shot, hit, sunk))\r\n coordinates = self.mapToCoordinates(shot)\r\n # If a ship was sunk, re...
[ "0.5561936", "0.5344232", "0.53410536", "0.5192044", "0.5077295", "0.5063083", "0.48270184", "0.48230124", "0.47465178", "0.4734545", "0.47291708", "0.47186533", "0.47097787", "0.47008774", "0.4662555", "0.4640912", "0.45646325", "0.45516455", "0.45428136", "0.45397002", "0.4...
0.7504378
0
returns two sub_fleets of logi ships that can rep
def logi_subfleet(input_fleet): logi_shield = [] logi_armor = [] for ship in input_fleet: if ship.debuffs.get('active', {}).get('ECM', 0) != 0: # can't target to apply repairs continue if ship.schema.remote_shield: logi_shield.append(ship) if ship.sche...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def identify_leaflets(u, time_ts):\n z = u.select_atoms(\"all\").center_of_geometry()[2]\n COM_z= np.array([0,0,z]) #defines the global midplane position along z\n x, y, z = u.trajectory.ts.triclinic_dimensions[0][0], u.trajectory.ts.triclinic_dimensions[1][1], u.trajectory.ts.triclinic_dimensions[2][2]\...
[ "0.5300184", "0.5250862", "0.51943374", "0.51919323", "0.5189181", "0.51509565", "0.51450646", "0.5133695", "0.50850374", "0.50747246", "0.5057867", "0.50438046", "0.50374115", "0.49930647", "0.49882522", "0.49689162", "0.49681103", "0.4944618", "0.49221566", "0.49176106", "0...
0.6534113
0
Have logistics ships do their job and repair other ships in the fleet
def repair_fleet(input_fleet): logistics = logi_subfleet(input_fleet) logi_shield = logistics[0] logi_armor = logistics[1] if (logi_shield == []) and (logi_armor == []): return input_fleet damaged_shield = [] # I have a bad feeling that this function won't last longer # than a sing...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setRepairCost(self):\n # first take into account the ship hull which is based on internal structure points\n ratio = 1.0 - (self.currentISP/self.myShipHull.maxISP)\n CR = int(self.myShipHull.costCR*ratio)\n AL = int(self.myShipHull.costAL*ratio)\n EC = int(self.myShipHull.cos...
[ "0.5930879", "0.5863779", "0.57753193", "0.5753428", "0.57386357", "0.5526721", "0.55054635", "0.55008", "0.5500748", "0.5494932", "0.546939", "0.54649055", "0.54603255", "0.54305845", "0.53782254", "0.53775287", "0.537016", "0.5368123", "0.5361142", "0.5358692", "0.53522205"...
0.6613623
0
Do a round of fleet attack calculation. Send an attack from fleet_a to fleet_b. Appends the hit_by attribute on the victim ship in fleet_b for each ship in fleet_a.
def fleet_attack(fleet_a, fleet_b): # if fleet b is empty if not fleet_b.ships: return AttackResult(fleet_a, fleet_b.ships, 0, 0) result = [] result.extend(fleet_b.ships) shots = 0 damage = 0 for ship in fleet_a.ships: firing = True # I kind of wanted to do apply a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def attackProcess(attack: \"Attack\", attacker: \"PlayerCharacter or Monster\", enemies: list, targetID: int):\n hits, target, ail = 1, [targetID], None\n damageRange, critChance, critMultiplier = (95, 105), 0.1, 2\n if (attack.special):\n hits = attack.special[\"HITS\"] if \"HITS\" in attack.speci...
[ "0.60258305", "0.60165286", "0.577939", "0.57730585", "0.5709429", "0.56922036", "0.5672939", "0.5672074", "0.55671364", "0.5562653", "0.55410975", "0.55286217", "0.5495966", "0.5487881", "0.54545265", "0.5454132", "0.5442472", "0.54392415", "0.54080606", "0.5401669", "0.5399...
0.8034907
0
Add to parent sizer
def addToParent(self): self.parent.GetSizer().Add(self.fieldLabel, 0, wx.ALIGN_CENTER_VERTICAL) self.parent.GetSizer().Add(self.textInput, 0, wx.ALIGN_CENTER_VERTICAL) self.parent.GetSizer().Add(self.browseButton, 0, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def define_panel_structure(self):\n w, h = self.parent.GetSize()\n self.vbox = wx.BoxSizer(wx.VERTICAL)\n self.sizer1 = wx.BoxSizer(wx.VERTICAL)\n self.sizer1.SetMinSize(wx.Size(w/13, h*2/5))\n\n self.sizer2 = wx.BoxSizer(wx.VERTICAL)\n self.sizer3 = wx.FlexGridSizer(9, 2,...
[ "0.6672837", "0.6568293", "0.6552376", "0.6522674", "0.6505356", "0.64641863", "0.63336146", "0.6324919", "0.63058704", "0.63002443", "0.62514997", "0.62473154", "0.62327355", "0.62290937", "0.62225306", "0.62148315", "0.6183548", "0.61329734", "0.6131153", "0.61168426", "0.6...
0.84043133
0
Switch editability and appearance of FASTQ File 2 field when single vs. pariedend is toggled; retain field value
def switchPairedEnd(self, event): fastq2Input = self.fieldPanel.fieldDict["FASTQ File 2"].textInput if not self.isPairedEnd.GetValue(): fastq2Input.SetEditable(False) fastq2Input.SetBackgroundColour("Gray") else: fastq2Input.SetEditable(True) fastq...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dummy():\n\t\t\tself.edit = True", "def mode(self, value):\r\n if value != self._mode:\r\n if str(value).lower() == 'edit':\r\n if self._mode == 'read':\r\n self.stop_reading()\r\n self._mode = 'edit'\r\n self.start_editing()\r...
[ "0.55069035", "0.5396944", "0.5391092", "0.5272707", "0.52606595", "0.52601504", "0.5225841", "0.5222947", "0.52203196", "0.511186", "0.5101689", "0.5090988", "0.5075948", "0.5052736", "0.5030019", "0.502454", "0.502454", "0.5020773", "0.49935284", "0.49918583", "0.49735838",...
0.57336855
0
Performs grid search over the 'max_depth' parameter for a decision tree regressor trained on the input data [X, y].
def fit_model(X, y): # Create cross-validation sets from the training data cv_sets = ShuffleSplit(X.shape[0], n_iter = 10, test_size = 0.20, random_state = 0) # TODO: Create a decision tree regressor object regressor = DecisionTreeRegressor() # TODO: Create a dictionary for the parameter 'max...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fit_model(X, y):\n \n # Create cross-validation sets from the training data\n cv_sets = ShuffleSplit(X.shape[0], n_iter = 10, test_size = 0.20, random_state = 0)\n\n # TODO: Create a decision tree regressor object\n regressor = DecisionTreeRegressor()\n\n # TODO: Create a dictionary for the p...
[ "0.67980987", "0.66172105", "0.65978587", "0.65800935", "0.65561897", "0.631222", "0.62315816", "0.6225854", "0.61309487", "0.61251706", "0.611348", "0.6111289", "0.60862434", "0.6064237", "0.60150397", "0.59969234", "0.5980468", "0.5931946", "0.5909273", "0.58972806", "0.584...
0.66434807
1
Takes two joints, calculates their twist in the given axis and applies half of that to a third joint created and situated halfway between the two. Returns the halfway joint.
def jointWithHalfwayTwist( joint1, joint2, twistAxisJoint1, twistAxisJoint2, twistAxisHalfwayJoint, staticParent, side, name, ): DEBUG_MODE = mc.getAttr("C_top_CTL.debugMode") joint1Twist = extractTwist(joint1, staticParent, alignXwith=twistAxisJoint1) joint2Twist = extractT...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_middle_joint(joint_a: Joint2D, joint_b: Joint2D) -> Joint2D:\n if not joint_a.is_set or not joint_b.is_set:\n return None\n visibility: JointVisibility\n if joint_a.visibility == JointVisibility.VISIBLE and joint_b.visibility == JointVisibility.VISIBLE:\n visibility = JointVisibility...
[ "0.6397894", "0.56013185", "0.5574211", "0.52858114", "0.5266635", "0.5262734", "0.52240235", "0.521539", "0.5211685", "0.51769495", "0.51769495", "0.51769495", "0.5131182", "0.5125029", "0.5123657", "0.510242", "0.5098752", "0.5045738", "0.5007345", "0.49932578", "0.48576176...
0.7974958
0
This function reads data from data_dir, computes unigram and bigram counts, and writes the result to fn_LM
def lm_train(data_dir, language, fn_LM): # TODO: Implement Function language_model, unigram, bigram = {}, {}, {} CKP = "WEAREDELETINGEND" pre_w = CKP for root, dirs, files in os.walk(data_dir, topdown=False): for name in files: if name.endswith(language): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_data(dataset='school'):\n\n assert isinstance(dataset, str)\n assert dataset == 'school' or dataset == 'industry'\n\n if dataset == 'school':\n # get the directory where all the raw files live\n folder_name = os.path.join('raw_data')\n\n # create a connection to a database...
[ "0.6518553", "0.61742276", "0.6110321", "0.604399", "0.59324086", "0.585607", "0.58267784", "0.58010006", "0.5793473", "0.5790179", "0.5745888", "0.57244843", "0.5710381", "0.5694431", "0.5688212", "0.5660611", "0.5612696", "0.5603853", "0.5601317", "0.5573375", "0.5571343", ...
0.64257634
1
given a suit level, return a randomlychosen suit type
def getRandomSuitType(level, rng=random): return random.randint(max(level-4, 1 ), min(level, 8))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getType(level):\n randomId = random.randint(1, WEIGHT[level])\n return getByWeight(POSSIBLE_TYPES[level], randomId)[0]", "def newSuitRandom(self, level=None, dept=None):\n self.type = \"s\"\n \n if (level==None):\n # pick a random level\n level = random.choice...
[ "0.7307858", "0.6784387", "0.6472308", "0.6047623", "0.5934308", "0.5930655", "0.5903228", "0.58808076", "0.5854137", "0.5804418", "0.5800761", "0.5798168", "0.57925266", "0.57892275", "0.5758339", "0.5641209", "0.55593765", "0.5542848", "0.55204415", "0.55143005", "0.5498445...
0.8403278
0
given a suit dept, return a randomlychosen suit
def getRandomSuitByDept(dept): deptNumber = suitDepts.index(dept) return suitHeadTypes[(suitsPerDept*deptNumber) + random.randint(0,7)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def newSuitRandom(self, level=None, dept=None):\n self.type = \"s\"\n \n if (level==None):\n # pick a random level\n level = random.choice(range(1, len(suitsPerLevel)))\n else:\n # make sure supplied one is valid\n if (level < 0 or level > len...
[ "0.65703523", "0.6453951", "0.61674947", "0.5999949", "0.5996299", "0.59388167", "0.59388167", "0.59147394", "0.5825292", "0.5789068", "0.5740937", "0.5738603", "0.5733749", "0.5726429", "0.5706574", "0.5657428", "0.56372666", "0.56262004", "0.5561202", "0.55532664", "0.55432...
0.83675534
0
__init__(self, string=None, string=None, string()=None, float=None, float=None, float=None) SuitDNA contructor see class comment for usage
def __init__(self, str=None, type=None, dna=None, r=None, b=None, g=None): # have they passed in a stringified DNA object? if (str != None): self.makeFromNetString(str) # have they specified what type of DNA? elif (type != None): if (type == 's'): # Suit ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, string: str) -> None:\r\n self.string = string", "def __init__(self, str):\n pass", "def __init__(self, string: str):\r\n self.string = string", "def __init__(self, string):\n self.string = string", "def __init__(self, string1, string2):\r\n self.s1 = s...
[ "0.7519552", "0.7490143", "0.74121714", "0.72624123", "0.719935", "0.7049769", "0.69954866", "0.69600487", "0.6951192", "0.6897257", "0.6864333", "0.6851937", "0.68244463", "0.6816455", "0.67051125", "0.66898197", "0.6688291", "0.6637555", "0.6633587", "0.66274184", "0.658987...
0.80845577
0
__defaultSuit(self) Make a default suit dna
def __defaultSuit(self): self.type = 's' self.name = 'ds' self.dept = getSuitDept(self.name) self.body = getSuitBodyType(self.name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generateSuit(self):\n\n dna = self.style\n self.headParts = []\n \n # most heads do not need different poly color or texture\n self.headColor = None\n self.headTexture = None\n\n # For suit death animation\n self.loseActor = None\n\n # Have we beco...
[ "0.6376532", "0.6292391", "0.6100267", "0.6061811", "0.5997699", "0.5899158", "0.58275074", "0.5755263", "0.5753592", "0.574594", "0.5744466", "0.5744466", "0.57278645", "0.5710891", "0.5627545", "0.56171495", "0.55842984", "0.5571154", "0.5559893", "0.55349827", "0.548771", ...
0.70614636
0
newSuit(self, string=None) If no suit name specified, set the dna for the default suit else set the dna for suit specified by the given string.
def newSuit(self, name=None): if (name == None): self.__defaultSuit() else: self.type = "s" self.name = name self.dept = getSuitDept(self.name) self.body = getSuitBodyType(self.name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setSuit(self, arg):\n self.suit = arg", "def newSuitRandom(self, level=None, dept=None):\n self.type = \"s\"\n \n if (level==None):\n # pick a random level\n level = random.choice(range(1, len(suitsPerLevel)))\n else:\n # make sure supplied ...
[ "0.7313212", "0.6467576", "0.62465173", "0.61532485", "0.59628093", "0.5835095", "0.57968396", "0.5792082", "0.57377803", "0.5718486", "0.558604", "0.55668974", "0.55435693", "0.5533753", "0.5517", "0.5446849", "0.5363286", "0.52949613", "0.5271129", "0.52599317", "0.5204993"...
0.7894401
0
newSuitRandom(self, int=None, string=None) Generate dna for a random suit of random level (unless level is specified) and random dept (again, unless specified)
def newSuitRandom(self, level=None, dept=None): self.type = "s" if (level==None): # pick a random level level = random.choice(range(1, len(suitsPerLevel))) else: # make sure supplied one is valid if (level < 0 or level > len(suitsPerLevel)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getRandomSuitByDept(dept):\n deptNumber = suitDepts.index(dept)\n return suitHeadTypes[(suitsPerDept*deptNumber) + random.randint(0,7)]", "def getRandomSuitType(level, rng=random):\n return random.randint(max(level-4, 1 ), min(level, 8))", "def generateSuit(self):\n\n dna = self.style\n ...
[ "0.6739003", "0.63491505", "0.6346807", "0.6021886", "0.59443873", "0.55800176", "0.55677444", "0.5540135", "0.5426991", "0.5367549", "0.534586", "0.5284533", "0.5258295", "0.52446234", "0.52258986", "0.51450855", "0.51438296", "0.5115795", "0.50942296", "0.50907975", "0.5085...
0.80776584
0
newGoon(self, type) Return the dna for the goon of this name. If no name is given return the default goon.
def newGoon(self, name = None): if type == None: self.__defaultGoon() else: self.type = 'g' if (name in goonTypes): self.name = name else: notify.error("unknown goon type: ", name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __defaultGoon(self):\n self.type = 'g'\n self.name = goonTypes[0]", "def create_goat(name):\n weight = random.randint(50, 100)\n insult_damage = 250 - weight\n\n return Goat(name, weight, insult_damage)", "def create_new(user, type):\n # make the game's name from the username ...
[ "0.6785037", "0.546052", "0.5096904", "0.48480737", "0.483798", "0.47854578", "0.47825745", "0.47135353", "0.4710598", "0.4680586", "0.46629733", "0.46575782", "0.46275118", "0.46145898", "0.45800537", "0.45746323", "0.45367986", "0.44890764", "0.4485057", "0.44714516", "0.44...
0.80305916
0
getType(self) Return which type of actor this dna represents.
def getType(self): if (self.type == 's'): #suit type type = "suit" elif (self.type == 'b'): #boss type type = "boss" else: notify.error("Invalid DNA type: ", self.type) return type
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_type(self):\n return self.__animal_type", "def getType(self,):\n\t\treturn self.type;", "def getType(self):\n return self.type_", "def getType(self):\n return self.tipo", "def get_type(self):\n return self.type", "def get_type(self):\n return self.type", "def ...
[ "0.6910517", "0.66695154", "0.6614324", "0.6612874", "0.6590619", "0.6590619", "0.6584954", "0.6531742", "0.65230954", "0.65230954", "0.64523363", "0.64400464", "0.64396113", "0.63819426", "0.63387024", "0.6311867", "0.6297006", "0.62708443", "0.62708443", "0.62708443", "0.62...
0.6902624
1
Create the NN architecture for the model.
def make_architecture(self): self.arch = simple_mlp(num_inputs=self.p.model.num_inputs, num_outputs=self.p.model.num_outputs, params=self.p.model.arch)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __build_nn_architecture(self, dim_Y, hidden_dimensions):\n Y = tf.placeholder(tf.float32, shape=[None, dim_Y])\n config = tf.placeholder(tf.float32, shape=[None, len(self.knob_cols)])\n placeholders = [config, Y]\n weights, biases, outputs = self.__make_fc_layers(\n Y, di...
[ "0.6931534", "0.6809934", "0.68078566", "0.6782664", "0.66872704", "0.664639", "0.66331774", "0.6631876", "0.6626347", "0.662352", "0.66155624", "0.6589648", "0.6511705", "0.6507855", "0.65065247", "0.65033305", "0.65004957", "0.64995795", "0.6498532", "0.649333", "0.6475253"...
0.6956943
0
Get a list of the trainable variables of the model.
def get_trainable_vars(self): return self.arch.variables
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trainable_variables(self):\n return [v for p in self.parameters for v in p.trainable_variables]\n # TODO: look for variables NOT in parameters too\n # so users can mix-n-match tf.Variables and pf.Parameters in modules", "def get_trainable_vars(self):\n params = tf.get_collection(t...
[ "0.84106857", "0.83313924", "0.81297374", "0.8062774", "0.8009906", "0.79164755", "0.78840417", "0.78840417", "0.77977896", "0.776468", "0.764058", "0.7587395", "0.7582669", "0.7574112", "0.75313574", "0.74282765", "0.74051094", "0.73525757", "0.73479426", "0.7243529", "0.715...
0.85341656
0
Create the NN inputs and outputs from the raw data batch. All preprocessing should go here.
def create_nn_inputs_and_outputs(self, raw_data, is_training=None): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _data_generation(self, batch_data):\n # Initialization\n batch_x = []\n batch_y = defaultdict(list)\n\n for ind, item_data in batch_data.iterrows():\n img_path = os.path.join(self.img_dir, \"images\", \"rgb\", item_data[\"name\"])\n img = cv2.imread(img_path)\n...
[ "0.7129326", "0.70223063", "0.67975307", "0.6750643", "0.6719033", "0.6655029", "0.66221905", "0.6578788", "0.65655535", "0.65651923", "0.65253466", "0.6502075", "0.6481", "0.64290243", "0.64089125", "0.63664615", "0.6348927", "0.6345519", "0.63391393", "0.63386357", "0.63381...
0.7471495
0
Predict the NN output to a given input with an optional post processing function applied. By default there is no post processing function applied.
def predict_nn_output_with_postprocessing(self, data, is_training=None): return self.predict_nn_output(data, is_training=is_training)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def postprocess(self, predicted_output, original_input=None, stats=None,\n **kwargs):\n pass", "def predict(cls, input):\n clf = cls.get_model()\n print('input=')\n print(input)\n return clf.predict(input)", "def predict(self, input):\n self._check_predict...
[ "0.74953467", "0.6944069", "0.6914523", "0.6895919", "0.6817196", "0.6773555", "0.66581625", "0.6644804", "0.658489", "0.6554196", "0.6533122", "0.65079343", "0.64995223", "0.6448712", "0.64395005", "0.6436754", "0.64344525", "0.6433544", "0.64260775", "0.6422547", "0.6421049...
0.702765
1
Initialize the processing functions if required.
def make_processing_functions(self): return
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n super(PreProcess, self).__init__()", "def start_processing(self):", "def processing(self):\n pass", "def pre_process(self):\n pass", "def pre_process(self):\n pass", "def pre_process(self):\n pass", "def pre_process(self):\n pass", "def ...
[ "0.70847285", "0.7062628", "0.68721354", "0.678277", "0.678277", "0.678277", "0.678277", "0.678277", "0.67819107", "0.67819107", "0.67819107", "0.67819107", "0.6600772", "0.6582693", "0.65758836", "0.65758836", "0.65758836", "0.656548", "0.6536202", "0.6529718", "0.64623195",...
0.74492455
0
This is for formatting the mocked XML db so it doesn't have whitespace between elements
def format_db(self) -> None: with open(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'basedb.xml'), 'r') as f: base = f.read() parser = etree.XMLParser(remove_blank_text=True) elem = etree.XML(base, parser=parser) print(etree.tostring(elem)) with open(os....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_xml(self,query_results):\n results=query_results.data\n factory=factory_xml()\n dump=factory.dumps({'data':results})\n print(dump)\n # TODO return output for this\n return \"\"", "def pretty(self, ugly):\n document_root = html.fromstring(ugly.replace(\"...
[ "0.62864196", "0.6201535", "0.6043612", "0.5896035", "0.586521", "0.5857547", "0.5820109", "0.58011836", "0.58009124", "0.5786097", "0.5784542", "0.57391334", "0.57345587", "0.57136893", "0.5711331", "0.56895375", "0.56852734", "0.5657838", "0.5657838", "0.5597483", "0.557688...
0.67950517
0
Parses the passed CQL to its AST interpretation.
def parse(cql, geometry_factory=values.Geometry, bbox_factory=values.BBox, time_factory=values.Time, duration_factory=values.Duration): parser = CQLParser( geometry_factory, bbox_factory, time_factory, duration_factory ) return parser.parse(cql)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse (self, line):\n result = self.program.parseString (line)\n return TranQL_AST (result.asList (), self.backplane)", "def _parse_query(queryStr):\n mainNode = LogicNode.LogicNode()\n queryStr = queryStr.replace(' ','')\n \n logicList, myOPList = _break_query(queryStr)\n\n #con...
[ "0.58895606", "0.57057863", "0.56418145", "0.55481654", "0.55474126", "0.55023235", "0.546047", "0.5436743", "0.53506774", "0.5330532", "0.527017", "0.52011335", "0.5159251", "0.5153012", "0.5139536", "0.51354825", "0.51157004", "0.5107618", "0.51008326", "0.50841093", "0.505...
0.575761
1
For example if rhs = NP PP VP PP and i = 1 Y = NP|PP.VP.PP
def cnf_create_variable(cls, rhs, i): Y = rhs[0] for j in range(1, len(rhs)): Y += "|" if j == i else "." Y += rhs[j] return Y
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solve(self, niter):\n E = self.list_PDE[0]\n I = self.list_PDE[1]\n\n # ...\n un = E.unknown\n unew = I.unknown\n\n# un.set(E.rhs)\n # ...\n\n # ...\n for i in range(0,niter):\n\n rhs = E.dot(un)\n I.solve(rhs)\n\n ...
[ "0.53018636", "0.52735037", "0.51238054", "0.51233166", "0.509058", "0.50599", "0.50515157", "0.50270224", "0.5022389", "0.5022313", "0.5008866", "0.49446106", "0.49446106", "0.4942155", "0.49405557", "0.49405557", "0.4932317", "0.493225", "0.49266124", "0.4902244", "0.489494...
0.57618374
0
Generates a derivation tree from a given symbol
def gentree(self, symbol): ### YOUR CODE HERE tree = "(" + symbol + " " expansion = self.random_expansion(symbol) for s in expansion: if self.is_terminal(s): tree += " " + s else: tree += " " + self.gentree(s) tree +...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_nltk_tree(derivation):\n\td = defaultdict(None, ((r.lhs, r.rhs) for r in derivation))\n\t\n\tdef make_tree(lhs):\n\t\treturn Tree(lhs[1:-1], (child if child not in d else make_tree(child) for child in d[lhs]))\n\t\n\treturn make_tree(derivation[0].lhs)", "def _generate_symbols(self):\n\n def infi...
[ "0.6174034", "0.55376786", "0.5499916", "0.5445262", "0.543626", "0.541449", "0.5383441", "0.5328308", "0.53203636", "0.51875055", "0.51821685", "0.5163745", "0.5157359", "0.5145705", "0.5145705", "0.51012564", "0.51011044", "0.5071863", "0.50636643", "0.5062886", "0.5062548"...
0.72751546
0
Generates a random RHS for symbol, in proportion to the weights.
def random_expansion(self, symbol): p = random.random() * self._sums[symbol] for r,w in self._rules[symbol]: p = p - w if p < 0: return r return r
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gen_random(self, symbol):\n sentence = ''\n\n # select one production of this symbol randomly\n rand_prod = random.choice(self.prod[symbol])\n\n for sym in rand_prod:\n # for non-terminals, recurse\n if sym in self.prod:\n sentence += self.gen_ra...
[ "0.63471293", "0.63471293", "0.6312487", "0.61062807", "0.567048", "0.5630162", "0.56234425", "0.56147295", "0.5518496", "0.547622", "0.54472303", "0.54299116", "0.5377022", "0.5372573", "0.53721", "0.53119326", "0.5300821", "0.52945656", "0.5288835", "0.5252365", "0.51992303...
0.66594
0
This method actually calculates the distance between two dataObjects x and y @ In, x, dict, dictionary containing data of x @ In, y, dict, dictionary containing data of y @ In, kwargs, dictionary of parameters characteristic of each metric (e.g., weights) @ Out, value, float, distance between x and y
def distance(self,x,y,**kwargs): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dist(self, X, Y):\n raise NotImplementedError", "def distance(cls,config_1, config_2):\n\t\tsorted_data_1 = (config_1.data).sort_values('item')\n\t\tsorted_data_2 = (config_2.data).sort_values('item')\n\t\tdr = sorted_data_1 - sorted_data_2\n\t\treturn np.linalg.norm(dr)", "def _object_distance(self...
[ "0.63655305", "0.619821", "0.6133352", "0.6053624", "0.60079056", "0.5969734", "0.59655607", "0.5963594", "0.5939548", "0.5907634", "0.5889515", "0.5881176", "0.5879568", "0.5849304", "0.5818335", "0.5793706", "0.57791084", "0.57691634", "0.57636994", "0.5756228", "0.57536715...
0.67990667
0
Module to support character map dictitonary creation through method call/cli
def create_charmap_dictionary(input_data='nltk', file_path=None, logger=None): data_list = fetch_word_list(input_data, file_path, logger) # Fetch the dictionary dict_file_path = fetch_dictionary_information() # Creating and Persisting the dictionary create_dictionary(data_list, dict_file_path, Cha...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def characterMap(*args, mapAttr: Union[List[AnyStr, AnyStr], bool]=None, mapMethod: AnyStr=\"\",\n mapNode: Union[List[AnyStr, AnyStr], bool]=None, mapping: Union[AnyStr,\n bool]=\"\", proposedMapping: bool=True, unmapAttr: List[AnyStr, AnyStr]=None,\n unmapNode: Lis...
[ "0.66168797", "0.6250095", "0.6143978", "0.6052082", "0.60175717", "0.59666604", "0.5935286", "0.5879597", "0.58725536", "0.5870071", "0.58494705", "0.5778568", "0.576966", "0.57580245", "0.573546", "0.57334536", "0.5724794", "0.57233286", "0.5705634", "0.5702371", "0.5656642...
0.65464324
1
Creates and returns a new experiment
def create_experiment(self): experiment = wandb.init( name=self._name, dir=self._dir, project=self._project, anonymous=self._anonymous, reinit=True, id=self._id, resume='allow', tags=self._tags, entity=self._entity ) wandb.run.save() return experiment
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def newExperiment(self):\n experiment = Experiment()\n newtitle = 'Untitled ' + self.getNextUntitled()\n experimentFrame = SequenceFrame(self, experiment, True, newtitle)\n experiment.setInteractionParameters(parentFrame=experimentFrame,\n graphManagerC...
[ "0.774684", "0.747934", "0.71140873", "0.70667434", "0.6640509", "0.6581526", "0.6425558", "0.6267551", "0.6248015", "0.6246302", "0.62397176", "0.62354517", "0.6230354", "0.6190863", "0.6185172", "0.6167529", "0.6046012", "0.60445315", "0.6039644", "0.6034598", "0.5895343", ...
0.8028181
0
Returns the experiment (creates a new if it doesn't exist).
def experiment(self) -> Run: if self._experiment is None: self._experiment = self.create_experiment() return self._experiment
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_experiment_if_needed(tr):\n exp = tr.getExperiment(EXPERIMENT_ID)\n if None == exp:\n create_project_if_needed(tr)\n exp = tr.createNewExperiment(EXPERIMENT_ID, 'DEFAULT_EXPERIMENT')\n \n return exp", "def _create_or_get_experiment(self) -> tensorboard_experiment.TensorboardExperiment:\n ...
[ "0.76704925", "0.76153374", "0.75573057", "0.65904474", "0.6551087", "0.6395997", "0.63456196", "0.62912023", "0.62196255", "0.6201164", "0.6178463", "0.60508275", "0.6033537", "0.5936399", "0.5911104", "0.5865398", "0.5859849", "0.5850404", "0.5813495", "0.577709", "0.575331...
0.77858293
0
Helper function used to log images relevant for depth estimation
def log_depth(self, *args, **kwargs): def log(prefix_idx, batch, output): self._metrics.update(log_rgb('rgb', prefix_idx, batch)) self._metrics.update(log_inv_depth('inv_depth', prefix_idx, output)) if 'depth' in batch: self._metrics.update(log_depth('depth', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize_logdepth(self, img):\n N, C, H, W = img.shape\n init_logdepth = torch.log((torch.ones([N, 1, H//8, W//8]) * 10).to(img.device))\n return init_logdepth", "def log_depth(key, prefix, batch, i=0):\n depth = batch[key] if is_dict(batch) else batch\n inv_depth = 1. / depth[i]...
[ "0.7643748", "0.7296057", "0.6877128", "0.674729", "0.61429644", "0.60275924", "0.6017061", "0.57927984", "0.57824785", "0.57798666", "0.5757562", "0.5716247", "0.5670636", "0.56667364", "0.56531334", "0.56490546", "0.5647961", "0.55725884", "0.5568498", "0.5540843", "0.55373...
0.7589858
1
Converts an RGB image from a batch for logging
def log_rgb(key, prefix, batch, i=0): rgb = batch[key] if is_dict(batch) else batch return prep_image(prefix, key, rgb[i])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _process_img_rgb(self, sensor_data):\n img = np.array(sensor_data.raw_data).reshape((self.img_y, self.img_x, 4))\n img = img[:, :, :3] # sensor is actualy rgba, we dont need alpha values\n self.rgb = img # need to scale rgb values to be {0,1}", "def convert_img(self):\r\n self.im...
[ "0.6475304", "0.6469919", "0.64637935", "0.645138", "0.6367865", "0.6271657", "0.62185705", "0.6191131", "0.6187576", "0.61796093", "0.6159423", "0.61530393", "0.61378866", "0.61356324", "0.61079", "0.60913336", "0.6057672", "0.60492706", "0.6012415", "0.60101914", "0.5994969...
0.70915926
0
Converts a depth map from a batch for logging
def log_depth(key, prefix, batch, i=0): depth = batch[key] if is_dict(batch) else batch inv_depth = 1. / depth[i] inv_depth[depth[i] == 0] = 0 return prep_image(prefix, key, viz_inv_depth(inv_depth, filter_zeros=True))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_inv_depth(key, prefix, batch, i=0):\n inv_depth = batch[key] if is_dict(batch) else batch\n return prep_image(prefix, key,\n viz_inv_depth(inv_depth[i]))", "def log_depth(self, *args, **kwargs):\n def log(prefix_idx, batch, output):\n self._metrics.update(log_...
[ "0.58780605", "0.5548015", "0.53888106", "0.51866895", "0.5170084", "0.5133522", "0.5121852", "0.5108031", "0.50356174", "0.50267744", "0.50150466", "0.5001036", "0.5001036", "0.49767113", "0.49648798", "0.49506435", "0.49364814", "0.49341828", "0.4916705", "0.48958632", "0.4...
0.5958137
0
Converts an inverse depth map from a batch for logging
def log_inv_depth(key, prefix, batch, i=0): inv_depth = batch[key] if is_dict(batch) else batch return prep_image(prefix, key, viz_inv_depth(inv_depth[i]))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_depth(key, prefix, batch, i=0):\n depth = batch[key] if is_dict(batch) else batch\n inv_depth = 1. / depth[i]\n inv_depth[depth[i] == 0] = 0\n return prep_image(prefix, key,\n viz_inv_depth(inv_depth, filter_zeros=True))", "def write_inverse_depth_map(image, file_path, ex...
[ "0.59822905", "0.5791571", "0.51514494", "0.51122326", "0.509865", "0.50426596", "0.50254935", "0.4973072", "0.49718568", "0.4916046", "0.48951873", "0.4881606", "0.48719892", "0.48446918", "0.48341897", "0.48219758", "0.47637826", "0.47586027", "0.4755292", "0.47381264", "0....
0.6514702
0
Finds the best answer with the maximum start_prob end_prob from a single passage
def find_best_answer_for_passage(start_probs, end_probs, passage_len=None, max_a_len=None): if passage_len is None: passage_len = len(start_probs) else: passage_len = min(len(start_probs), passage_len) best_start, best_end, max_prob = -1, -1, 0 # 从头扫描passage for start_idx in range(pa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_best_answer_for_passage(self, start_probs, end_probs, passage_len=None):\n if passage_len is None:\n passage_len = len(start_probs)\n else:\n passage_len = min(len(start_probs), passage_len)\n best_start, best_end, max_prob = -1, -1, 0\n for start_idx in r...
[ "0.7866687", "0.7866687", "0.7866687", "0.7768496", "0.7720297", "0.7219845", "0.64046806", "0.6106677", "0.601194", "0.5919084", "0.58928174", "0.5877695", "0.5868372", "0.58644277", "0.5846555", "0.58459836", "0.581599", "0.5814314", "0.5791704", "0.5777586", "0.5774878", ...
0.7945608
0
Initialize and configure HTTP requests client for selected service.
def _init_http_client(service_id=None, opts=None): if service_id: opts = _get_trs_opts(service_id) http_client = RequestsClient() http_client.set_api_key(host=opts['host'], api_key=opts['auth'], param_in='header') return http_client
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def client_setup(self):\n self.client = Client()", "def service_client_initialization(self) -> global___Snippet.ClientInitialization:", "def init_services(self):\n service_prefix = rospy.get_name() + \"/\"\n\n self._request_components_serv = rospy.Service(service_prefix +\n ...
[ "0.6556433", "0.6479576", "0.6254698", "0.6180333", "0.61727947", "0.60712326", "0.60697883", "0.6066717", "0.6013214", "0.5993691", "0.5987068", "0.59165025", "0.5898763", "0.5882512", "0.58356065", "0.5819745", "0.58107084", "0.57838666", "0.5772795", "0.5745186", "0.573535...
0.7385413
0
Initializes an Auction object.
def __init__(self, bidders, item, starting_price): self._bidders = bidders self._item = item self._starting_price = starting_price self._auctioneer = Auctioneer(self._bidders, self._starting_price)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, bidders):\n self._bidders = bidders\n self._auctioneer = Auctioneer()\n for bidder in bidders:\n self._auctioneer.register_bidder(bidder)", "def __init__(self):\n # initialize a bird to default values.\n self.set_instance_vars()\n\n # random...
[ "0.7127663", "0.59414953", "0.5881936", "0.5755307", "0.5739896", "0.57036835", "0.56706196", "0.5669046", "0.564352", "0.5629307", "0.5609366", "0.55943024", "0.5567828", "0.5548785", "0.5543186", "0.55417174", "0.55395174", "0.55394804", "0.55312926", "0.55249894", "0.54939...
0.77544427
0
Update the highest current bid price and highest bidder, and start a new bid in turn.
def update_bid(self, bid_price, bidder): bidder_info = "Starting Bid" if self.current_bidder is not None: bidder_info = self.current_bidder.name print(f"{bidder.name} bidded {bid_price} in response to " f"{bidder_info}'s bid of {self.current_bid}!") self._highes...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_new_bids(self):\n for bidder in self._bidders:\n if bidder != self._highest_current_bidder:\n bid_price = bidder(self)\n if bid_price > self.current_bid:\n self.update_bid(bid_price, bidder)", "def __call__(self, auctioneer):\n c...
[ "0.76948225", "0.71081954", "0.6990548", "0.6877376", "0.65179425", "0.64295304", "0.6409783", "0.6381218", "0.63722646", "0.63671064", "0.6231732", "0.6220337", "0.6163523", "0.61532944", "0.6153215", "0.6127924", "0.612362", "0.612141", "0.6088627", "0.60751355", "0.6066820...
0.8030035
0
Start a new bid by notifying all bidders except for the current highest bidder.
def start_new_bids(self): for bidder in self._bidders: if bidder != self._highest_current_bidder: bid_price = bidder(self) if bid_price > self.current_bid: self.update_bid(bid_price, bidder)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _notify_bidders(self):\n for bidder in self.bidders:\n if self._highest_bidder is not bidder:\n bidder(self)", "def update_bid(self, bid_price, bidder):\n bidder_info = \"Starting Bid\"\n if self.current_bidder is not None:\n bidder_info = self.curren...
[ "0.76667464", "0.70480293", "0.6914005", "0.68995726", "0.68361366", "0.6301355", "0.6248292", "0.6209812", "0.59769714", "0.5908579", "0.5856304", "0.58485705", "0.57853603", "0.5785337", "0.57704514", "0.5765794", "0.5730838", "0.5688434", "0.5658419", "0.56391245", "0.5623...
0.8549534
0
Places a new bid with the auctioneer, after checking the budget and probability, and updates the its highest bid price.
def __call__(self, auctioneer): curr_bid = auctioneer.current_bid bid_price = curr_bid * self._bid_increase_perc if bid_price <= self._budget and self.get_bid_probability() > 0.3: self._highest_bid = bid_price return bid_price return 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __call__(self, auctioneer):\n possible_bid = self.bid_increase_perc * auctioneer.get_highest_bid()\n if possible_bid < self.budget and random.random() <= self.bid_probability:\n self.highest_bid = possible_bid\n auctioneer.accept_bid(possible_bid, self)", "def update_bid(s...
[ "0.7359436", "0.7274053", "0.6913858", "0.67545766", "0.6722162", "0.67057824", "0.66291445", "0.6527617", "0.6495116", "0.64774", "0.6460271", "0.6435784", "0.6391496", "0.63777846", "0.6374897", "0.63485", "0.63382643", "0.62670904", "0.61914796", "0.6161915", "0.61413974",...
0.7351189
1
Map a point to bitvector corresponding to the bin that contains it.
def pt2bv(self, point: float, tol=0.0): index = self.pt2index(point, tol) return int2bv(index, self.num_bits)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pt2bv(self, point: float, nbits: int, tol=0.0):\n assert isinstance(nbits, int)\n\n if self.periodic:\n point = self._wrap(point)\n\n index = self.pt2index(point, nbits, alignleft=True)\n\n if self.periodic:\n index = bintogray(index)\n\n return int2bv(i...
[ "0.65505666", "0.62339324", "0.61689186", "0.61579394", "0.5941974", "0.577782", "0.57645077", "0.5728357", "0.57117677", "0.5679318", "0.56495726", "0.5640364", "0.5601922", "0.55837655", "0.5542495", "0.5530292", "0.55136764", "0.55078244", "0.5478354", "0.54094404", "0.540...
0.62397605
1
Filters data source by attackpattern which extracts all ATT&CK Techniques
def get_all_techniques(src, source_name, tactic=None): filters = [ Filter("type", "=", "attack-pattern"), Filter("external_references.source_name", "=", source_name), ] if tactic: filters.append(Filter('kill_chain_phases.phase_name', '=', tactic)) results = src.query(filters) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_attacks(self):\n if self.character_data is None: raise Exception('You must call get_character() first.')\n attacks = AttackList()\n for rownum in range(32, 37): # sht1, R32:R36\n a = self.parse_attack(f\"R{rownum}\", f\"Y{rownum}\", f\"AC{rownum}\")\n if a is not...
[ "0.58939004", "0.5737528", "0.5615179", "0.5229348", "0.5224679", "0.517443", "0.51688015", "0.51529956", "0.5152915", "0.508803", "0.5082562", "0.50247383", "0.49744886", "0.49597573", "0.49027795", "0.48535258", "0.48477742", "0.484585", "0.48340026", "0.48129362", "0.48044...
0.6240708
0
Filters data source by id and type
def filter_by_type_and_id(src, object_type, object_id, source_name): filters = [ Filter("type", "=", object_type), Filter("id", "=", object_id), Filter("external_references.source_name", "=", source_name), ] results = src.query(filters) return remove_deprecated(results)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def type_filter(self, items, types=None):", "def filter():\n return get_filter_data(db, MyTable)", "def getFilter(self, type: int) -> int:\n ...", "def queryComponent(type=None, filter=None, all=0):", "def setFilter(self, type: int, filter: int) -> None:\n ...", "def _queryset(self):\n ...
[ "0.62249887", "0.6125699", "0.5959919", "0.59006166", "0.5866805", "0.5855361", "0.58373797", "0.5796159", "0.5720629", "0.5631447", "0.5546659", "0.55391353", "0.54849786", "0.544099", "0.54384834", "0.5430543", "0.54268044", "0.54237473", "0.54139996", "0.53850543", "0.5384...
0.71838677
0
Grab external id from STIX2 object
def grab_external_id(stix_object, source_name): for external_reference in stix_object.get("external_references", []): if external_reference.get("source_name") == source_name: return external_reference["external_id"]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getID():", "def external_id(self):\n return self._external_id", "def external_id(self):\n return self._external_id", "def external_id(self) -> str:\n return self._search_in_properties(ATTR_GUID)", "def _get_id(self):\n return self.__id", "def _get_id(self):\n return self.__...
[ "0.7213034", "0.6921125", "0.6921125", "0.6892648", "0.6789885", "0.6789885", "0.6789885", "0.6789885", "0.6789885", "0.6789885", "0.6789885", "0.6789885", "0.6789885", "0.6789885", "0.6789885", "0.6789885", "0.6789885", "0.6789885", "0.6789885", "0.6789885", "0.6789885", "...
0.73292816
0
Will remove any revoked or deprecated objects from queries made to the data source
def remove_deprecated(stix_objects): # Note we use .get() because the property may not be present in the JSON data. The default is False # if the property is not set. return list( filter( lambda x: x.get("x_mitre_deprecated", False) is False and x.get("revoked", False) is False, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cleanup(self):\n for attribute in self._all_db_field_names:\n delattr(self, attribute)", "def removeOldItems(self):\n pass", "def removeAllAuthorQueries(self):\n self.queries[\"au\"] = []", "def __del__( self ):\n self.suggest = None", "def clear_all():\n bpy.o...
[ "0.6076073", "0.60455686", "0.5940847", "0.5905437", "0.5897772", "0.5883721", "0.58831394", "0.58805746", "0.58350784", "0.5833581", "0.5811592", "0.5790624", "0.5769547", "0.5760821", "0.57461804", "0.5743045", "0.57234216", "0.57165384", "0.56995255", "0.5682328", "0.56620...
0.63916993
0
Delete an existing permission prototype.
def delete(self, orgname, prototypeid): permission = AdministerOrganizationPermission(orgname) if permission.can() or allow_if_superuser(): try: org = model.organization.get_organization(orgname) except model.InvalidOrganizationException: raise Not...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delPermission(self,request):\n request.needAuthType(request.ADMIN)\n request.checkArgs(\"admin_username\",\"perm_name\")\n request.getAuthNameObj().canDo(\"CHANGE ADMIN PERMISSIONS\")\n perm_actions.getActionManager().deletePermission(request[\"admin_username\"],request[\"perm_name\...
[ "0.6827197", "0.66862005", "0.659881", "0.65230477", "0.65230477", "0.646424", "0.64429355", "0.63791865", "0.63530916", "0.6287685", "0.6172409", "0.6105014", "0.60984206", "0.60943866", "0.6086517", "0.60558784", "0.6052115", "0.6029361", "0.6029361", "0.60224426", "0.59884...
0.722242
0
Main handler for E1.33 RDMnet Broker PDUs. Switches the handler based on the broker vector as defined in RDMNet.vectors.
def handle(self, data): #Check broker vector if data[26:28] == vectors.vector_broker_connect: #Ignore - we won't receive this pass elif data[26:28] == vectors.vector_broker_connect_reply: broker_connect_reply(self, data) elif data[26:28] == vectors.vector_broker_client_entry_upd...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cmd_handler():\n context = zmq.Context()\n\n # socket to receive commands (a subscription to ELECTION_CODE channel)\n cmd_socket = context.socket(zmq.SUB)\n cmd_socket.connect (\"tcp://%s:5556\" % SERVER_HOST)\n topicfilter = \"politiche2013\"\n cmd_socket.setsockopt(zmq.SUBSCRIBE, topicfilte...
[ "0.49078333", "0.4829333", "0.48277026", "0.47992027", "0.47933322", "0.47687837", "0.4746706", "0.47352654", "0.4731634", "0.47203356", "0.47171083", "0.47066343", "0.47066054", "0.46950972", "0.46920297", "0.46743438", "0.46586895", "0.46553066", "0.46516642", "0.46420616", ...
0.6763343
0
Handles the broker_connect_reply vector.
def broker_connect_reply(self, data): print("Broker Connected") #IDEA: Does this need a handler?
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_connect( client, userdata, flag, rc ):\n if ( rc == 0 ):\n client.connected_flag = True\n logging.info( \"Connected to Broker! Returned code: %s\\n\" %rc )\n else:\n logging.info( \"Failed to connect. Returned code: %s\\n\" %rc )", "def on_connect(client, userdata, flags, rc):\n...
[ "0.6805167", "0.6756231", "0.65706706", "0.6557591", "0.64862204", "0.6413016", "0.6339159", "0.6326638", "0.6306249", "0.6281397", "0.6276359", "0.62564665", "0.62263525", "0.62061703", "0.6196047", "0.6153697", "0.6039485", "0.60392964", "0.6034572", "0.6034509", "0.6002229...
0.8081546
0
Handles the broker_null (heartbeat) vector.
def broker_null(self, data): print("Heartbeat") #TODO: Reset heartbeat timer or something like that
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_heartbeatDisabled(self):\n self.assertIdentical(self.client._heartbeat, None)\n self.client.heartbeatInterval = None\n self.client.irc_RPL_WELCOME(\"foo\", [])\n self.assertIdentical(self.client._heartbeat, None)", "async def test_no_hb(self):\n await self.async_setup(...
[ "0.6420823", "0.6321774", "0.61724615", "0.6141801", "0.5943835", "0.58810097", "0.5825168", "0.5786837", "0.5780912", "0.5759003", "0.5757982", "0.5544405", "0.5520948", "0.55042756", "0.5489392", "0.54513276", "0.53915894", "0.53852165", "0.5378298", "0.5370567", "0.5349701...
0.8189953
0
Loads an image file located in the textures directory and specified by the given filename, adds it to the texture atlas and returns the resulting texture.
def atlas_load(filename): t = pyglet.image.load(os.path.join('textures','ground.png')) tex = atlas.add(t) return tex
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_texture(filename, x, y):\r\n return arcade.load_texture(filename, x * 64, y * 64, width=64, height=64)", "def get_texture(filename, x, y):\r\n return arcade.load_texture(filename, x * 64, y * 64, width=64, height=64)", "def pyglet_load_texture(filename):\n if filename not in _texture_cache:\n ...
[ "0.7355153", "0.7355153", "0.7321094", "0.72893155", "0.70116144", "0.6984934", "0.6651579", "0.66392565", "0.65995747", "0.65986806", "0.6520663", "0.651482", "0.6505206", "0.650468", "0.6459404", "0.64453685", "0.63930887", "0.63930887", "0.6361619", "0.63534695", "0.632894...
0.84045476
0
Return a config template compatible with `self.get_dag`.
def get_config_template(self) -> cconfig.Config:
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_configuration_template(self):\n return CONFIG_TEMPLATE", "def template(self):\n return self.conf.get(\"template\", None)", "def get_config_template(self) -> cconfig.Config:\n config = cconfig.get_config_from_nested_dict(\n {\n # Load prices.\n ...
[ "0.7734905", "0.64811367", "0.633051", "0.6230356", "0.6221458", "0.60827804", "0.6058915", "0.6045339", "0.60350055", "0.6005433", "0.5878349", "0.5854585", "0.58518726", "0.5746682", "0.5732547", "0.56697077", "0.5667335", "0.5651152", "0.5630838", "0.5630113", "0.5630113",...
0.789908
0
Methods supported by the DAG.
def methods(self) -> List[str]: # TODO(*): Consider make this an abstractmethod. return ["fit", "predict"]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Methods(self):\n pass", "def operation(self):\n pass", "def logic(self):\r\n raise NotImplementedError", "def __call__(self):\n raise NotImplementedError", "def support(self):", "def __call__(self):\n raise NotImplementedError()", "def list_operations():", "def act...
[ "0.69769377", "0.62206185", "0.6162944", "0.61213434", "0.60997015", "0.6088534", "0.6045146", "0.5939904", "0.58923805", "0.58923805", "0.58923805", "0.5846375", "0.5846375", "0.5817597", "0.58033043", "0.58033043", "0.5748754", "0.5736851", "0.5692549", "0.5692549", "0.5692...
0.6499702
1
Returns a list of sequences generated after each sequence in the given list is extended by one move.
def extend_sequences(grid: Grid, sequences: List[Tuple[GridItem]]) -> List[Tuple[GridItem, GridItem]]: new_sequences = [] for seq in sequences: last_move = seq[-1] next_moves = get_available_locations_after_knight_move(grid=grid, start_location=last_move) valid_moves = [m for m in next_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sequence(f, lst: list) -> list:\n ret = []\n for ele in lst:\n ret.append(f(ele))\n return ret", "def powerset(seq):\n if len(seq) <= 1:\n yield seq\n yield []\n else:\n for item in powerset(seq[1:]):\n #if(len(item) <= historyLength):\n yield ...
[ "0.5965177", "0.5915697", "0.5732751", "0.5644921", "0.55675316", "0.5564079", "0.5517316", "0.5490573", "0.54512227", "0.54403704", "0.5415469", "0.5398975", "0.5380598", "0.53642553", "0.53642553", "0.53642553", "0.5360058", "0.5356185", "0.5345112", "0.53448826", "0.534290...
0.74457675
0
get the tensor_map in convparam
def get_tensor_map(self): return self.TENSOR_MAP
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_conv_params(onnx_node): # type: (NodeWrapper) -> Dict\n pad_h, pad_w, pad_d = get_pads(onnx_node)\n str_h, str_w, str_d = get_strides(onnx_node)\n dil_h, dil_w, dil_d = get_dilations(onnx_node)\n\n return {'pad_d': pad_d, 'pad_h': pad_h, 'pad_w': pad_w,\n 'str_d': str_d, 'str_h': st...
[ "0.5842259", "0.5709502", "0.5680009", "0.5587352", "0.55218583", "0.5460249", "0.5421158", "0.53964925", "0.5389318", "0.5386611", "0.5325121", "0.5324465", "0.5322488", "0.53063095", "0.52951103", "0.5279549", "0.5275696", "0.52493656", "0.52406365", "0.52308154", "0.522688...
0.7354422
0
calculate use load2d or not
def get_load2d_flag(stride, pads, shape_filter_ncdhw): l0a_load2d_flag = False _, _, filter_d, filter_h, filter_w = shape_filter_ncdhw if list(pads) == [0, 0, 0, 0, 0, 0] and list(stride) == [1, 1, 1] and \ [filter_d, filter_h, filter_w] == [1, 1, 1]: l0a_load2d_flag = True ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_2D(self):\n\t\tif self.have_fastas is False:\n\t\t\tself._extract_fastas_from_fast5()\n\t\t\tself.have_fastas = True\n\n\t\tif self.fastas.get('twodirections') is not None:\n\t\t\treturn True\n\t\treturn False", "def is_2d(self) -> bool:\n return self.layers == 1 and self.times == 1", "def load_...
[ "0.59968", "0.5807401", "0.5683507", "0.56548643", "0.56510717", "0.5464333", "0.5458171", "0.54465735", "0.5418206", "0.51752484", "0.5159705", "0.5088343", "0.5078498", "0.50650716", "0.5057588", "0.5038635", "0.50372064", "0.50201005", "0.5016905", "0.50127065", "0.5012502...
0.5962665
1
calculate whether to do cyclebuffer
def get_cyclebuffer_flag(tiling, shape_w, w_dtype, channel_c1, stride_d, l0a_load2d_flag): cyclebuffer_flag = False filter_d = shape_w[1] cyc_size = 0 if tiling["AL1_shape"]: cyc_size = int(tiling["AL1_shape"][0] * tiling["AL1_shape"][-1] // \ (sha...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bufferCnt():\n if(reset == 1):\n bufferCounter.next = 0\n else:\n if(decimationRatio > 0):\n if(bufferCounter == (decimationRatio-1)):\n bufferCounter.next = 0\n else:\n bufferCounter.next = bufferCounter + ...
[ "0.62354237", "0.6167542", "0.60744864", "0.57951045", "0.5743538", "0.57254344", "0.5711473", "0.5657359", "0.56122756", "0.560523", "0.5596053", "0.55851465", "0.5558708", "0.5508317", "0.54462546", "0.5436161", "0.5432882", "0.5430316", "0.5429422", "0.5427371", "0.5421956...
0.664291
0
Try to turn this intermediate slice into a simple slice.
def try_simple(self) -> TemplatedFileSlice: # Yield anything simple if len(self.slice_buffer) == 1: return TemplatedFileSlice( self.slice_buffer[0].slice_type, self.source_slice, self.templated_slice, ) else: rai...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize_slice(s):\n start, stop, step = s.start, s.stop, s.step\n if start is None:\n start = 0\n if step is None:\n step = 1\n if start < 0 or step < 0 or stop is not None and stop < 0:\n raise NotImplementedError()\n return slice(start, stop, step)", "def _squeeze_outp...
[ "0.5900503", "0.5862751", "0.5738463", "0.55914533", "0.55789346", "0.55429035", "0.5472963", "0.54674244", "0.5416002", "0.53848034", "0.5354021", "0.53395027", "0.5322496", "0.5312454", "0.52895004", "0.5288406", "0.5276869", "0.5270192", "0.5258482", "0.52542", "0.5219282"...
0.6114106
0
Coalesce this whole slice into a single one. Brutally.
def coalesce(self) -> TemplatedFileSlice: return TemplatedFileSlice( PythonTemplater._coalesce_types(self.slice_buffer), self.source_slice, self.templated_slice, )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def concat_all(self):\n return self.merge(1)", "def reduce(self):\n return self.crop(*self.ink_offsets)", "def trim(self):\n for i in range(len(self)):\n if self[i] != TRIT_ZERO:\n return self.__class__(self[i:])\n return self.__class__([])", "def coalesc...
[ "0.5401775", "0.5277561", "0.5086095", "0.50274026", "0.50246334", "0.50178045", "0.49937516", "0.49930096", "0.49813202", "0.49351832", "0.4933961", "0.49174333", "0.49125135", "0.4882212", "0.48642638", "0.48623437", "0.485516", "0.48501262", "0.48427582", "0.48148936", "0....
0.6366621
0
Get the templating context from the config.
def get_context(self, fname=None, config=None, **kw) -> Dict: # TODO: The config loading should be done outside the templater code. Here # is a silly place. if config: # This is now a nested section loaded_context = ( config.get_section((self.templater_sel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_config_template(self) -> cconfig.Config:", "def template(self):\n return self.conf.get(\"template\", None)", "def get_configuration_template(self):\n return CONFIG_TEMPLATE", "def _get_template(self):\n try:\n template_path = current_app.config.get('REPORT_TEMPLATE_PAT...
[ "0.6642714", "0.655239", "0.6421497", "0.6352441", "0.6218333", "0.6215532", "0.61932576", "0.6177962", "0.6148456", "0.61415637", "0.6009486", "0.6005946", "0.60049796", "0.5993308", "0.5898885", "0.5872836", "0.5868123", "0.57998323", "0.57919914", "0.5783467", "0.5747005",...
0.6646712
0
Process a string and return a TemplatedFile. Note that the arguments are enforced as keywords because Templaters can have differences in their `process` method signature. A Templater that only supports reading from a file
def process( self, *, in_str: str, fname: str, config=None, formatter=None ) -> Tuple[Optional[TemplatedFile], list]: live_context = self.get_context(fname=fname, config=config) def render_func(raw_str: str) -> str: """Render the string using the captured live_context.""" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_tempita(fromfile):\n if not fromfile.endswith('.in'):\n raise ValueError(\"Unexpected extension: %s\" % fromfile)\n\n from_filename = tempita.Template.from_filename\n template = from_filename(fromfile,\n encoding=sys.getdefaultencoding()) \n\n content =...
[ "0.5927083", "0.56477994", "0.55647224", "0.55600524", "0.5467592", "0.54649943", "0.5419041", "0.5384643", "0.53826547", "0.53702974", "0.5355691", "0.5342357", "0.53400964", "0.53350306", "0.53298324", "0.53285354", "0.53225774", "0.5254582", "0.5218274", "0.5201841", "0.51...
0.69850135
0
Render the string using the captured live_context.
def render_func(raw_str: str) -> str: try: rendered_str = raw_str.format(**live_context) except KeyError as err: raise SQLTemplaterError( "Failure in Python templating: {}. Have you configured your " "variables? https://docs...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render(self, context=None):\n # Make the complete context we'll use.\n render_context = dict(self.context)\n if context:\n render_context.update(context)\n return self._render_function(render_context, self._do_dots)", "def render(self, context=None, **kwargs):\n ...
[ "0.69836193", "0.68735003", "0.6787299", "0.67825687", "0.6738566", "0.6700272", "0.661129", "0.65616435", "0.6328541", "0.63152844", "0.630689", "0.6260807", "0.6237929", "0.6229906", "0.62219316", "0.6219127", "0.6191939", "0.61817104", "0.6133662", "0.6131802", "0.60987324...
0.6909697
1
Identify a wrapped query (e.g. dbt test) and handle it. If unwrap_wrapped is true, we trim the wrapping from the templated file. If unwrap_wrapped is false, we add a slice at start and end.
def _check_for_wrapped( cls, slices: List[TemplatedFileSlice], templated_str: str, unwrap_wrapped: bool = True, ) -> Tuple[List[TemplatedFileSlice], str]: if not slices: # If there are no slices, return return slices, templated_str first_slice ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def seek_wrapped_response(response):\n if needs_seek_wrapper(response):\n wrapper_class = get_seek_wrapper_class(response)\n response = wrapper_class(response)\n assert hasattr(response, \"get_data\")\n return response", "def wrap(wrapper, wrapped):\r\n if decorator:\r\n return d...
[ "0.49452978", "0.48612124", "0.47095355", "0.46167728", "0.45950076", "0.44793484", "0.44774923", "0.44728556", "0.44670466", "0.44417948", "0.4398652", "0.43606308", "0.4299542", "0.4229209", "0.41998908", "0.41764316", "0.41017067", "0.4099885", "0.40825513", "0.4081274", "...
0.6258488
0
Sort a dict of occurrences into a sorted list of tuples.
def _sorted_occurrence_tuples( occurrences: Dict[str, List[int]] ) -> List[Tuple[str, int]]: return sorted( ((raw, idx) for raw in occurrences.keys() for idx in occurrences[raw]), # Sort first by position, then by lexical (for stability) key=lambda x: (x[1], x[0])...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valuesort(dic):\n lis = []\n for x,y in sorted(dic.items(), key = lambda x: x[0]):\n lis.append(y)\n return lis", "def sortedItems (dict):\n items = dict.items ()\n items.sort ()\n return items", "def sorted_items(dictionary):\n keys = sorted_keys(dictionary)\n return [(key, ...
[ "0.6824904", "0.67114776", "0.66520023", "0.6546612", "0.6503543", "0.6479024", "0.63947487", "0.6355869", "0.6347286", "0.6336696", "0.63290507", "0.6175744", "0.6135268", "0.6108238", "0.6054066", "0.60446596", "0.60157686", "0.5984473", "0.59450066", "0.59163105", "0.58915...
0.8592085
0
Slice a templated python string into token tuples.
def _slice_template(cls, in_str: str) -> Iterator[RawFileSlice]: fmt = Formatter() in_idx = 0 for literal_text, field_name, format_spec, conversion in fmt.parse(in_str): if literal_text: escape_chars = cls._sorted_occurrence_tuples( cls._substring_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_template(string):\n count = 0\n list1 = []\n for character in string:\n count = count + 1\n if character == \"{\":\n end = string.find(\"}\", count)\n s_strg = string[count:end]\n list1.append(s_strg)\n string = string.replace(s_strg, \"\...
[ "0.65736866", "0.58334595", "0.56713414", "0.56178546", "0.5483555", "0.54321796", "0.54271394", "0.54172796", "0.5351732", "0.53294754", "0.53263843", "0.5303379", "0.53032297", "0.5268373", "0.5268199", "0.52608883", "0.5210669", "0.5207403", "0.52012086", "0.51890486", "0....
0.61800796
1
Split a sliced file on its invariant literals. We prioritise the _longest_ invariants first as they are more likely to the the anchors.
def _split_invariants( cls, raw_sliced: List[RawFileSlice], literals: List[str], raw_occurrences: Dict[str, List[int]], templated_occurrences: Dict[str, List[int]], templated_str: str, ) -> Iterator[IntermediateFileSlice]: # Calculate invariants invari...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _parse_slices_V4X(par, parfile):\n logger = logging.getLogger('raw2nii')\n par.slices = np.loadtxt(parfile, dtype=par.fields, ndmin=1).view(\n np.recarray)\n if not par.slices.shape:\n logger.warning('par.slices has wrong shape: {0}, reshaping...'.format(\n par.slices.shape))\...
[ "0.524216", "0.5237646", "0.5200308", "0.5173667", "0.5161768", "0.5133536", "0.5130054", "0.5080635", "0.5067358", "0.5009248", "0.5004314", "0.49693444", "0.49494553", "0.49459115", "0.49309915", "0.49090266", "0.48889005", "0.4881744", "0.48761076", "0.4875591", "0.4874181...
0.63437146
0
Filter a dict of occurrences to just those within a slice.
def _filter_occurrences( file_slice: slice, occurrences: Dict[str, List[int]] ) -> Dict[str, List[int]]: filtered = { key: [ pos for pos in occurrences[key] if pos >= file_slice.start and pos < file_slice.stop ] for ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _filter_dict(src_dict, key_set):\n for k in set(src_dict.keys()) - key_set:\n src_dict.pop(k)", "def filter(self, dict):\n for (pos, hashKey) in enumerate(self._sequence):\n for (key, value) in dict.items():\n data = self.dictionary[hashKey]\n \n ...
[ "0.6243578", "0.6126197", "0.60437065", "0.6037379", "0.59448564", "0.5802446", "0.574578", "0.5740564", "0.562094", "0.558148", "0.5568815", "0.55339736", "0.54904217", "0.5432098", "0.54097915", "0.5405255", "0.54017603", "0.5372058", "0.5365594", "0.5335989", "0.53254646",...
0.76616806
0
Coalesce to the priority type.
def _coalesce_types(elems: List[RawFileSlice]) -> str: # Make a set of types types = {elem.slice_type for elem in elems} # Replace block types with templated for typ in list(types): if typ.startswith("block_"): # pragma: no cover types.remove(typ) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def priority(self) -> Optional[pulumi.Input[int]]:\n return pulumi.get(self, \"priority\")", "def priority(self) -> Optional[pulumi.Input[int]]:\n return pulumi.get(self, \"priority\")", "def priority(self) -> Optional[pulumi.Input[int]]:\n return pulumi.get(self, \"priority\")", "def pr...
[ "0.55081207", "0.55081207", "0.55081207", "0.55081207", "0.5424133", "0.5424133", "0.52954113", "0.5254724", "0.52483356", "0.5167933", "0.513947", "0.513947", "0.51096404", "0.51039976", "0.50904125", "0.5054504", "0.50502354", "0.5046902", "0.5041106", "0.5041106", "0.50411...
0.59744644
0
seq_s should be the SPLIT_WORD numericalized LongTensor of the table header as prepared by torchtext. returns an encoding for each column.
def forward(self, seq_s): # s = flat sequence length with split index specifying columns # c = num columns # e = generic embedding index seq_se = self.embedding(seq_s) ends = torch.nonzero(seq_s == self.split_idx).detach().cpu().numpy() ends = ends.ravel() begins ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sequence_encoding(sequence, str_to_idx):\n sequence_of_indexes = [str_to_idx[element] for element in sequence]\n return torch.tensor(sequence_of_indexes, dtype=torch.long)", "def encode(self, seq):", "def preprocess_inde(self, sequence, src_seq):\r\n sequence = sequence + [len(src_seq) - 1] # ...
[ "0.59209955", "0.5831743", "0.5704292", "0.53375316", "0.5320972", "0.5315586", "0.52949077", "0.52725834", "0.5228374", "0.52224743", "0.5216837", "0.52083576", "0.5152976", "0.51369214", "0.5132268", "0.5088853", "0.50790846", "0.5073857", "0.5070658", "0.50571066", "0.5053...
0.5894392
1
configures the tags for Browser.
def configureTags (self): self.window.tag_config("a", foreground = "blue", underline=1) ## self.window.tag_bind('a', '<Button-1>') self.window.tag_config('u', underline=1) self.window.tag_config('center', justify = CENTER) self.window.tag_config('right', justify = RIGHT)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_tags(self, tags):\n self.tags = []\n for tag in [t.strip() for t in tags.split(', ')]:\n self.tags.append(Tag(title=tag))", "def tags(self, tags):\n self._tags = tags", "def tags(self, tags):\n self._tags = tags", "def tags(self, tags):\n self._tags = tag...
[ "0.6117148", "0.60522455", "0.60522455", "0.60522455", "0.6035021", "0.59993976", "0.58339137", "0.58339137", "0.58339137", "0.58339137", "0.58339137", "0.58339137", "0.58339137", "0.58339137", "0.58339137", "0.58339137", "0.5738235", "0.5668656", "0.5642948", "0.55699265", "...
0.66270024
0
Check if a given database field uses the specified requirement (IS_IN_SET, IS_INT_IN_RANGE, etc)
def uses_requirement(requirement, field): if hasattr(field.requires, "other") or requirement in str(field.requires): if hasattr(field.requires, "other"): if requirement in str(field.requires.other): return True elif requirement in str(field.requires): return ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __contains__(self, fieldname):\r\n return fieldname in self._by_name", "def is_satisfied_by(self, val):", "def validate_field(self, field_name, val):\r\n return self._columns[field_name].validate(val)", "def meets_condition(db_type: str):\n\t\t...", "def has_field(self, field):\n r...
[ "0.60376304", "0.5919285", "0.58795536", "0.567989", "0.5652115", "0.56278825", "0.56228006", "0.5615847", "0.5604347", "0.55712175", "0.5563445", "0.55473024", "0.5543306", "0.55398965", "0.54767895", "0.5463972", "0.54571825", "0.54200375", "0.5408383", "0.5388112", "0.5375...
0.60459614
0
Generates the XML for bindings for the specified database field.
def generate_bindings(table, fieldname, ref): field = table[fieldname] if "IS_NOT_EMPTY" in str(field.requires): required = "true()" else: required = "false()" if field.type == "string": _type = "string" elif field.type == "double": _type = "decimal" # Collect d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_field(self, obj, field):\n self.indent(3)\n internal_type = field.get_internal_type()\n attrs = {\n \"id\": field.name,\n \"resname\": field.name,\n \"restype\": \"x-%s\" % internal_type,\n \"translate\": \"no\",\n }\n if int...
[ "0.51324844", "0.5021097", "0.49734625", "0.49549443", "0.49504086", "0.48747706", "0.48024175", "0.4762428", "0.47509494", "0.4701753", "0.46935064", "0.46842983", "0.46515197", "0.46492082", "0.46147546", "0.45945397", "0.4587353", "0.45828503", "0.456589", "0.45481017", "0...
0.67106235
0
Generates the controllers XML for the database table field.
def generate_controllers(table, fieldname, ref): itext_list = [] # Internationalization controllers_list = [] field = table[fieldname] itext_list.append(TAG["text"](TAG["value"](field.label), _id=ref + ":label")) itext_list.append(TAG["text"](TAG["value"](field.co...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_database_structure(self):\n self.analyze()\n items = []\n for model in get_models():\n names = []\n # for f, m in model._meta.get_fields_with_model():\n for f in model._meta.concrete_fields:\n names.append(f.name)\n items.appe...
[ "0.5743829", "0.5610774", "0.53923154", "0.53896207", "0.5376662", "0.5206844", "0.51948583", "0.51400673", "0.51099074", "0.5098264", "0.5076762", "0.5040793", "0.5001984", "0.49836108", "0.49685377", "0.49446303", "0.49439874", "0.4882328", "0.48636183", "0.4854416", "0.482...
0.6145393
0
Returns the data in the given node as a comma separated string
def csvdata(nodelist): data = "" for subnode in nodelist: if (subnode.nodeType == subnode.ELEMENT_NODE): try: data = data + "," + subnode.childNodes[0].data except: data = data+ "," return data[1:] + "\n"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def serialize(node: \"BSTNode\") -> str:\n return \",\".join([str(n.value) for n in node.pre_order(node)])", "def serialize(self, root: TreeNode) -> str:\n l = []\n def preOrder(root):\n if not root:\n l.append(\"n\")\n return\n \n ...
[ "0.7087546", "0.6680242", "0.6581247", "0.6502628", "0.6498398", "0.6468021", "0.6468021", "0.64449257", "0.64045906", "0.6355283", "0.63466597", "0.6319253", "0.62720066", "0.6266068", "0.62208503", "0.6189422", "0.6165274", "0.61460996", "0.61397684", "0.6113649", "0.609450...
0.74499404
0
Converts the XML to a CSV compatible with the import_from_csv_file of web2py
def importxml(db, xmlinput): from io import StringIO import xml.dom.minidom try: doc = xml.dom.minidom.parseString(xmlinput) except: raise Exception("XML parse error") parent = doc.childNodes[0].tagName csvout = csvheader(parent, doc.childNodes[0].childNodes) for subnode i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_document(as_xml, as_csv):\n tree = ET.parse(as_xml)\n lists = xml_to_list(tree.getroot())\n list_to_csv(lists, as_csv)\n # raise NotImplementedError()\n pass", "def main(_):\n # Create an XML data frame, which represents the CSV format\n xml_df = xml_to_df(FLAGS.xml_input)\n p...
[ "0.719838", "0.6283045", "0.6056802", "0.58050364", "0.5779635", "0.5538607", "0.55362105", "0.55022055", "0.53960824", "0.53098905", "0.52894545", "0.5255599", "0.5254887", "0.52478755", "0.52187836", "0.520438", "0.51912326", "0.50982046", "0.5090235", "0.50881046", "0.5079...
0.6532117
1
Generates a list of Xforms based on database tables for ODK Collect
def formList(): # Test statements #xml = TAG.forms(*[TAG.form(getName("Name"), _url = "http://" + request.env.http_host + URL(c="static", "current.xml"))]) #xml = TAG.forms(*[TAG.form(getName(t), _url = "http://" + request.env.http_host + URL(f="create", args=t)) for t in db.tables()]) # List of a cou...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_database_structure(self):\n self.analyze()\n items = []\n for model in get_models():\n names = []\n # for f, m in model._meta.get_fields_with_model():\n for f in model._meta.concrete_fields:\n names.append(f.name)\n items.appe...
[ "0.60708666", "0.5933062", "0.58400077", "0.58069515", "0.5780451", "0.5715516", "0.56346416", "0.5558381", "0.5558356", "0.5539602", "0.5522121", "0.5520515", "0.5495285", "0.5466316", "0.54533815", "0.5424293", "0.5421275", "0.54120165", "0.5378106", "0.5377502", "0.5348039...
0.7299134
0
Allows for submission of Xforms by ODK Collect
def submission(): # @ToDo: Something better than this crude check if not auth.s3_logged_in(): auth.permission.fail() from io import StringIO import cgi from lxml import etree source = request.post_vars.get("xml_submission_file", None) if isinstance(source, cgi.FieldStorage): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _process(self):\n self.output[\"data\"] = get_form_data(self.kwargs[\"collect\"].ona_scan_form_pk)", "def submit(self):\n dispatcher.utter_template('utter_submit',tracker) \n\n return []", "def _process(self):\n self.kwargs[\"collect\"].process_scan_form_data(self.kwargs[\"da...
[ "0.59187806", "0.5598443", "0.5489215", "0.54702854", "0.5443186", "0.5383968", "0.5342925", "0.53137535", "0.52982044", "0.52976686", "0.525981", "0.5217262", "0.52168053", "0.5213274", "0.52030575", "0.5193835", "0.515993", "0.5155663", "0.5132392", "0.51256025", "0.5122868...
0.6170719
0
Change the state of the application and get the new interface (if given). Set up graphics for the new state if required. change_state(int, Menu/Game) > void
def change_state(self, state, interface=None): self._state = state if interface != None: self._interface = interface if self._state == config.GS_LOADING: # Background with loading text self._background = self._pygame.Surface(self...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def switch_state():\n\tDmg.OpenWindow()", "def change_game_state(self, state):\n self._game_state = state", "def change_state(self,state):\n if self.__currentState:\n self.__currentState.stop()\n \n try:\n idler=self[state]\n except KeyError:\n ra...
[ "0.7050286", "0.6612606", "0.65058714", "0.63392484", "0.63129956", "0.62236893", "0.61817735", "0.6146427", "0.61306596", "0.60629934", "0.603809", "0.60011053", "0.59226644", "0.587366", "0.58690506", "0.5850535", "0.5846707", "0.5840944", "0.5836028", "0.58341086", "0.5809...
0.75940174
0
Tokenizes the expression expr [str] The expression to tokenize
def tokenize_expr(self, expr: str) -> str: # Output Variable # For now, this is equivilent to expr out = expr for token in self.tokens.keys(): # Lets add a backslash between every character # Of the token token = [f"\{tok}" for tok in token] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tokenize(expr):\n expr = expr.replace(' ', '')\n tokens = []\n for split in re.split('(\\d+)', expr):\n if not split:\n continue\n if split.isdigit():\n tokens.append(split)\n else:\n # Further split each non-digit char into a separate token.\n ...
[ "0.75079197", "0.7386661", "0.7295711", "0.7217942", "0.6998575", "0.6960825", "0.6816012", "0.6706804", "0.6481053", "0.6405954", "0.63643384", "0.6303651", "0.6269678", "0.6227337", "0.61861414", "0.60674804", "0.6053421", "0.6049003", "0.60423625", "0.6013347", "0.59996897...
0.8063435
0
Converts infix algebra to prefix algebra. expr [str] The input expression
def infix_to_prefix(self, expr: str) -> str: # Reverse expr expr = reversed(expr) # Convert expr to list expr = list(expr) # Reverse all parantheses for i, e in enumerate(expr): if e == "(": expr[i] = ")" elif e == ")": ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_prefix_expression(cls, expression):\n\t\tlogger.info(f\"in the calculate prefix expression {expression}\")\n\t\telements = expression.split()\n\t\tstack = []\n\t\tfor e in reversed(elements):\n\t\t\tif e.isdigit():\n\t\t\t\tstack.append(int(e))\n\t\t\telse:\n\t\t\t\t# this is an operator\n\t\t\t\tif ...
[ "0.664578", "0.6562387", "0.6492114", "0.6489635", "0.64423674", "0.64218444", "0.6409474", "0.6332373", "0.6211638", "0.614548", "0.5933642", "0.5890488", "0.58857906", "0.5869483", "0.58240837", "0.5795316", "0.5790727", "0.57855725", "0.57208693", "0.57087123", "0.56760514...
0.7931066
0
Converts prefix math to a treelib tree. expr [str] The input expression This MUST be delimeted by some form of delimeter delimeter [str] = None This is the character that the infix algebra is delimeted by. None means whitespace name [str] = "base" The name of the root node of the tree
def prefix_to_tree(self, expr: str, delimeter: str = None, node_name: str = "base") -> Tree: # Create a tree tree = Tree() # Convert the expression to a deque expr_deque = deque(expr.split(delimeter)) # Create a base node base_node = tree.create_node(node_name,0) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def infix_to_tree(self, expr: str, delimeter: str = None, node_name: str = \"base\") -> Tree:\n\n # Convert expr to prefix\n prefix = self.infix_to_prefix(expr)\n\n # Return prefix_to_tree of this expr\n return self.prefix_to_tree(prefix, delimeter, node_name)", "def expression_tree(p...
[ "0.7715366", "0.67280793", "0.65973467", "0.64595115", "0.6448311", "0.6393375", "0.6392054", "0.6252216", "0.624449", "0.6188115", "0.61600244", "0.61458254", "0.6134043", "0.6066507", "0.60213506", "0.601809", "0.59797966", "0.5881889", "0.5871866", "0.5860093", "0.58431166...
0.7808633
0
Converts post math to a treelib tree. expr [str] The input expression This MUST be delimeted by some form of delimeter delimeter [str] = None This is the character that the infix algebra is delimeted by. None means whitespace name [str] = "base" The name of the root node of the tree
def infix_to_tree(self, expr: str, delimeter: str = None, node_name: str = "base") -> Tree: # Convert expr to prefix prefix = self.infix_to_prefix(expr) # Return prefix_to_tree of this expr return self.prefix_to_tree(prefix, delimeter, node_name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def expression_tree(postfix:str) -> Node:\n stack = deque()\n for ch in postfix:\n if ch not in {'+', '-', '*', '/', '^'}:\n stack.append(Node(ch))\n else:\n middle_node = Node(ch)\n right_node = stack.pop()\n left_node = stack.pop()\n midd...
[ "0.70245045", "0.6755103", "0.6589187", "0.6536003", "0.6478088", "0.64490044", "0.6426963", "0.6353692", "0.63382196", "0.6335063", "0.6225691", "0.62140906", "0.6152632", "0.6150837", "0.61400163", "0.61078393", "0.60474217", "0.5985852", "0.59360087", "0.59222984", "0.5899...
0.7315091
0
Optimizes a tree_list. tree_list [list[list[list]]] The input list
def optimize_tree_list(self, tree_list: list[list[list]], namespace: str = "base") -> list[list[list]]: # First lets take all constant values and insert them into a dictionary # For later reference const_values: dict = {} # For every expression for expr in tree_list[0]: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_tree(self, tree):\n g_list_val, g_list_h = self._build_graph(tree) # return theano variable of each node\n list_val = self._traversal_tree(tree) #\n f = theano.function(g_list_val, g_list_h, allow_input_downcast=True)\n result = f(*list_val)\n return result", "def i...
[ "0.59876835", "0.594672", "0.57908875", "0.5681702", "0.56396526", "0.5574034", "0.5511045", "0.5471316", "0.5444111", "0.5424639", "0.54222614", "0.5358958", "0.5356983", "0.53115654", "0.52961224", "0.5284055", "0.524744", "0.51969385", "0.5188095", "0.5159153", "0.51522285...
0.60253185
0
Parse the expr to a result expr [str] Input expression namespace [str] The namespace to use for creating variables
def parse(self, expr: str, namespace: str = "base") -> ParseResult: # Convert infix to tree tree = self.infix_to_tree(expr) # Convert tree to list tree_list = self._tree_to_list(tree, tree[0], [[],[]], namespace) if self.optimize: # If we should optimize, do that n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def xpath_eval(self,expr,namespaces=None):\n ctxt = common_doc.xpathNewContext()\n ctxt.setContextNode(self.xmlnode)\n ctxt.xpathRegisterNs(\"ns\",to_utf8(self.ns))\n if namespaces:\n for prefix,uri in namespaces.items():\n ctxt.xpathRegisterNs(prefix,uri)\n ...
[ "0.61528134", "0.61281157", "0.5924604", "0.5881553", "0.58039707", "0.576479", "0.5757676", "0.55888534", "0.5516364", "0.5505239", "0.5476539", "0.54384905", "0.5405206", "0.5385077", "0.5360978", "0.53540486", "0.5341787", "0.53394437", "0.53353316", "0.5310859", "0.529810...
0.6848307
0
Test case for create_ban
def test_create_ban(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_ban(self):\n pass", "def test_create_boat(self):\n pass", "def test_update_ban(self):\n pass", "def test_client_bank_account_create(self):\n pass", "async def test_ban(self, ctx):\n try:\n pass\n except Exception as e:\n await zb....
[ "0.7810486", "0.744329", "0.7376355", "0.73099834", "0.7082355", "0.6714869", "0.6360827", "0.6339139", "0.6319347", "0.6274971", "0.62729955", "0.6147931", "0.6144743", "0.6074654", "0.6027571", "0.59911287", "0.59785664", "0.59393436", "0.5910287", "0.585156", "0.5827595", ...
0.94138044
0
Test case for exclude_ip_ban
def test_exclude_ip_ban(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_check_ip_on_whitelist_false(self):\n\n ip_name = 'f11.my.com'\n\n result = check_ip_on_whitelist(ip_name, self.pattern_ip)\n\n self.assertFalse(result)", "def _is_ignored_ip_address():\n ignore_ip_addresses = current_app.config['SPLIT_IGNORE_IP_ADDRESSES']\n return request.rem...
[ "0.71386534", "0.66987395", "0.66532993", "0.6447362", "0.6398273", "0.63738966", "0.63004494", "0.6292208", "0.62821907", "0.6199681", "0.6194927", "0.6101934", "0.6098432", "0.60615784", "0.6039741", "0.6021818", "0.5980562", "0.5960367", "0.5951294", "0.5940183", "0.594018...
0.9508575
0
Test case for expire_ban
def test_expire_ban(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_buff_expiration(self):\n sess = self.sess\n battle = self.battle\n\n # For the buff to work, alice needs to own this region\n battle.region.owner = self.alice.team\n sess.commit()\n\n s1 = battle.create_skirmish(self.alice, 30) # Attack 30 infantry\n s1.re...
[ "0.67981315", "0.6759206", "0.6632504", "0.65504766", "0.6431898", "0.6342339", "0.634183", "0.6252975", "0.62519646", "0.6243109", "0.6232897", "0.62309736", "0.6217284", "0.62163883", "0.6151685", "0.6083812", "0.60827917", "0.60717374", "0.60515493", "0.6041882", "0.604139...
0.92313063
0
Test case for get_ban
def test_get_ban(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_ban(self):\n pass", "def test_get_bans(self):\n pass", "def test_update_ban(self):\n pass", "async def test_ban(self, ctx):\n try:\n pass\n except Exception as e:\n await zb.bot_errors(ctx,sp.format(e))", "def test_get_boat(self):\n ...
[ "0.7934899", "0.7560778", "0.75315344", "0.7478688", "0.7169812", "0.66973203", "0.6488742", "0.628112", "0.6273042", "0.62508875", "0.621656", "0.6197768", "0.6180028", "0.6118127", "0.6111247", "0.61067003", "0.6090702", "0.60592026", "0.6037157", "0.6023306", "0.59936166",...
0.9343103
0
Test case for get_bans
def test_get_bans(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_ban(self):\n pass", "def picks_bans(self):\n return self._get(\"picks_bans\")", "async def bans(self, ctx):\n try:\n bans = await self.bot.get_bans(ctx.message.server)\n except discord.Forbidden:\n await self.bot.say('I do not have the proper permi...
[ "0.73320645", "0.6631506", "0.6593202", "0.63917816", "0.6374964", "0.6136155", "0.5878708", "0.58491915", "0.5733379", "0.5717928", "0.55639094", "0.55420303", "0.5537492", "0.5527646", "0.55273575", "0.55270016", "0.55161464", "0.5501496", "0.54678315", "0.5442", "0.539503"...
0.9237584
0
Test case for update_ban
def test_update_ban(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_ban(self):\n pass", "def test_client_bank_account_update(self):\n pass", "def test_create_ban(self):\n pass", "def test_client_bank_account_partial_update(self):\n pass", "def test_update_case(self):\n pass", "async def test_ban(self, ctx):\n try:\n ...
[ "0.747467", "0.7402786", "0.73821723", "0.70825243", "0.7044597", "0.6922596", "0.68621254", "0.68621254", "0.68621254", "0.6657297", "0.6654699", "0.6645976", "0.6643652", "0.65744525", "0.65656424", "0.6499742", "0.64742446", "0.6414317", "0.63866854", "0.63115025", "0.6297...
0.9402504
0
check if image is rgb only accept rgb image when building train set
def is_RGB(self,img_path): image=Image.open(img_path) image=np.asarray(image) if(len(image.shape)<3): return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_rgb(im):\n if(im.ndim == 3):\n return True\n else:\n return False", "def is_rgb(img: np.ndarray) -> bool:\n\n return len(img.shape) >= 1 and img.shape[-1] == 3", "def rgb(self) -> bool:\n return self.image_shape[2] == 3", "def needs_to_convert_to_RGB(ds: \"Dataset\") -> b...
[ "0.75897574", "0.7488315", "0.7052029", "0.6925399", "0.67762756", "0.6470295", "0.6423139", "0.64042914", "0.63852924", "0.6360768", "0.63093615", "0.6304243", "0.6286628", "0.62787783", "0.6255236", "0.62297255", "0.6175592", "0.6144822", "0.6069844", "0.6052767", "0.605276...
0.7507989
1
save resized image to destination path
def resize_image(self, filename, size=(299,299,3)): path = join(self.source_dir, filename) img = Image.open(path) img = img.resize(size) img.save(join(self.dest_dir, filename), 'JPEG', optimize=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_resized_image(image, resolution: float, image_name: str):\n\tfilename: str = join(join(base_directory, str(resolution) + 'x'),\n\t image_name)\n\tprint(image_name)\n\tprint(join(base_directory, str(resolution)))\n\tprint(filename)\n\tcv.imwrite(filename, image)", "def save_image(file...
[ "0.7488314", "0.7191767", "0.70728296", "0.7070124", "0.7017978", "0.6922164", "0.683112", "0.68174756", "0.6797947", "0.67390186", "0.66977775", "0.6649409", "0.66468054", "0.66089374", "0.6605409", "0.6579254", "0.6573319", "0.6563482", "0.6540469", "0.65261775", "0.6511922...
0.71940863
1
Return the text regexp representation If `strict` is True, than in case of construction error is detected, an exception should be raised. Otherwise, the object is expected to return a string (but it is not expected to be a correct regex).
def get_regex(self, strict=True): _ctx = construction.Context(strict=strict) return self._get_regex(_ctx)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def native_(s, encoding='latin-1', errors='strict'):\n if isinstance(s, text_type):\n return s\n return str(s, encoding, errors)", "def testRepr(self):\n class MyMessage(messages.Message):\n integer_value = messages.IntegerField(1)\n string_value = messages.S...
[ "0.50434977", "0.501044", "0.4994349", "0.47964302", "0.47934306", "0.47846913", "0.47820777", "0.47719625", "0.47615808", "0.4703309", "0.46865788", "0.4636157", "0.4624951", "0.46173662", "0.46116278", "0.45866558", "0.45821938", "0.458205", "0.4560157", "0.4551272", "0.451...
0.6614548
0
Return compiled regex object.
def get_compiled(self, flags=0): return re.compile(self.get_regex(), flags)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _compile_regex(self, regex, flags=re.MULTILINE):\n pattern = None\n try:\n pattern = re.compile(pattern=regex, flags=flags)\n except Exception as e:\n self.logger.error(msg=\"Error while compiling regex '{}'. Exception: {}\".format(regex, repr(e)))\n return pat...
[ "0.79393154", "0.7792749", "0.72855145", "0.7246459", "0.70375204", "0.69674236", "0.69412583", "0.6914002", "0.6816616", "0.67996293", "0.67352915", "0.66826206", "0.6633896", "0.6618748", "0.6583748", "0.6567384", "0.6550467", "0.6505155", "0.64413214", "0.6430474", "0.6382...
0.83702576
0
Escape given text string.
def escape(self, text, escape_chars): _bs = "\\" # backslash is always escaped text = text.replace(_bs, _bs * 2) for _el in escape_chars: assert _el != _bs, "Backslash has been already escaped" text = text.replace(_el, _bs + _el) return text
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def escape_string(text):\n return escape(text)", "def escape(text: str) -> str:\n\n def replace(match_obj):\n \"\"\"\n Returns the match text prefixed with backslash\n\n :param re.match match_obj: The match.\n\n :rtype: str\n \"\"\"\n re...
[ "0.89560854", "0.7974048", "0.79566103", "0.785096", "0.7724007", "0.7685131", "0.7672704", "0.7554683", "0.7523155", "0.74855196", "0.74448323", "0.74037313", "0.7403602", "0.7393462", "0.7378999", "0.73349875", "0.7332059", "0.73040986", "0.7195168", "0.71884024", "0.718840...
0.82099736
1
Usual epsilon greedy strategy except that we no longer explore when at the critical states
def epsilon_greedy(Q, epsilon, state): random_number = random.random() if (random_number < epsilon) and (state not in critical_states): return env.action_space.sample() else: return np.argmax(Q[state])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def choose_epsilon_greedy(self, state: Tuple[int, ...], valid_actions: Tuple[int, ...]) -> int:\n if random.random() < self.__epsilon:\n return self.choose_uniform(valid_actions)\n return self.choose_greedy(state, valid_actions)", "def _epsilon_greedy(self, info_state, legal_actions, eps...
[ "0.7247167", "0.71348417", "0.6951912", "0.66348785", "0.6629807", "0.6614084", "0.66078675", "0.6606423", "0.658864", "0.65883434", "0.65834403", "0.6478085", "0.64635545", "0.6427835", "0.640714", "0.6367727", "0.6367194", "0.63604486", "0.6355197", "0.6332208", "0.63215446...
0.72349364
1
Computes the checksum of a list of bytes and appends it
def addChecksum(bytes_list): checksum = 0 for elem in bytes_list: checksum += elem checksum = int(checksum % 256) return bytes_list.append(checksum)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checksumoflist(l):\n x = 0\n for _ in range(len(l)):\n x += int(l[_])\n return x", "def checksum(data):\n total = sum([ord(x) for x in data])\n return total & 0xff", "def calc_checksum(content: bytes) -> bytes:\r\n\r\n check_a = 0\r\n check_b = 0\r\n\r\n for char in content:\...
[ "0.698614", "0.67910814", "0.6678678", "0.64332306", "0.6351939", "0.6331968", "0.62236536", "0.62141246", "0.61644614", "0.6163579", "0.6159416", "0.6146003", "0.6107644", "0.60840875", "0.6057806", "0.60426325", "0.60361356", "0.6020594", "0.6002731", "0.5949215", "0.592912...
0.86006635
0