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
Determine whether or not Daylight Savings Time (DST)
def is_dst (): x = datetime(datetime.now().year, 1, 1, 0, 0, 0, tzinfo=pytz.timezone(timezonename)) # Jan 1 of this year y = datetime.now(pytz.timezone(timezonename)) # if DST is in effect, their offsets will be different return not (y.utcoffset() == x.utcoffset())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_dst(now):\n dst_start_date = datetime.datetime(now.year, 4, 1)\n dst_end_date = datetime.datetime(now.year, 11, 1)\n dston = dst_start_date - datetime.timedelta(days=dst_start_date.weekday() + 1)\n dstoff = dst_end_date - datetime.timedelta(days=dst_end_date.weekday() + 1)\n\n if dston <= now...
[ "0.6935293", "0.6616067", "0.6516993", "0.6215939", "0.61475027", "0.6123925", "0.57812285", "0.5767174", "0.57259715", "0.57187515", "0.56875944", "0.5667125", "0.56590027", "0.5591161", "0.55905336", "0.55732495", "0.55648273", "0.5506323", "0.54255176", "0.5410302", "0.539...
0.754301
0
A net assigning constant bool values to blobs. It is mainly used for initializing condition blobs, for example, in multitask learning, we need to access reader_done blobs before reader_net run. In that case, the reader_done blobs must be initialized.
def BoolNet(*blobs_with_bool_value): blobs_with_bool_value = _MakeList(blobs_with_bool_value) bool_net = core.Net('bool_net') for blob, bool_value in blobs_with_bool_value: out_blob = bool_net.ConstantFill( [], [blob], shape=[], value=bool_value, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __bool__(self):\n raise RuntimeError(\"Cannot evaluate BinarySharedTensors to boolean values\")", "def __nonzero__(self):\n raise RuntimeError(\"Cannot evaluate BinarySharedTensors to boolean values\")", "def If(name, condition_blob_or_net,\n true_nets_or_steps, false_nets_or_steps=None...
[ "0.5771537", "0.54652345", "0.5392687", "0.5326567", "0.53260136", "0.52974963", "0.52414554", "0.52361125", "0.5201264", "0.51780605", "0.5144533", "0.50938475", "0.50740165", "0.50350565", "0.5027271", "0.5027144", "0.50090903", "0.49893484", "0.4953541", "0.49460164", "0.4...
0.69811255
0
Not of a condition blob or net
def NotNet(condition_blob_or_net): if isinstance(condition_blob_or_net, core.Net): condition_blob = GetConditionBlobFromNet(condition_blob_or_net) else: condition_blob = condition_blob_or_net not_net = core.Net('not_net') out_blob = not_net.Not(condition_blob) not_net.AddExternalOut...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_logical_not(g, op, block):\n\n ipt0 = g.get_node(op.input(\"X\")[0])\n op_func = get_relay_op(op.type)\n out = op_func(ipt0)\n g.add_node(op.output(\"Out\")[0], out)", "def logical_not(data):\n return _make.logical_not(data)", "def IfNot(name, condition_blob_or_net,\n true_n...
[ "0.723407", "0.7098168", "0.69059664", "0.6734983", "0.66537726", "0.64472175", "0.63899624", "0.6384127", "0.6364295", "0.628092", "0.62590545", "0.6240886", "0.6185649", "0.61785704", "0.61516595", "0.612806", "0.61026055", "0.60728234", "0.6053589", "0.6053589", "0.6053589...
0.80821294
0
Make a condition net that copies the condition_blob
def _CopyConditionBlobNet(condition_blob): condition_net = core.Net('copy_condition_blob_net') out_blob = condition_net.Copy(condition_blob) condition_net.AddExternalOutput(out_blob) return condition_net, out_blob
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetConditionBlobFromNet(condition_net):\n assert len(condition_net.Proto().external_output) > 0, (\n \"Condition net %s must has at least one external output\" %\n condition_net.Proto.name)\n # we need to use a blob reference here instead of a string\n # otherwise, it will add another na...
[ "0.6311419", "0.598059", "0.55204374", "0.5506626", "0.54877675", "0.54877675", "0.53708017", "0.5334193", "0.52935266", "0.5274574", "0.52732855", "0.52340955", "0.5222657", "0.51855874", "0.5176256", "0.5155975", "0.5052813", "0.49915636", "0.49732947", "0.49615398", "0.496...
0.8338465
0
Merge multi condition nets into a single condition nets.
def MergeConditionNets(name, condition_nets, relation): if not isinstance(condition_nets, list): return condition_nets if len(condition_nets) <= 1: return condition_nets[0] if condition_nets else None merged_net = core.Net(name) for i in range(len(condition_nets)): net_proto = c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def CombineConditions(name, condition_nets, relation):\n if not condition_nets:\n return None\n if not isinstance(condition_nets, list):\n raise ValueError('condition_nets must be a list of nets.')\n\n if len(condition_nets) == 1:\n condition_blob = GetConditionBlobFromNet(condition_n...
[ "0.71528655", "0.56211823", "0.5510489", "0.5381569", "0.52618486", "0.5187926", "0.51214164", "0.5068874", "0.49224412", "0.48375675", "0.48238546", "0.48217678", "0.48199722", "0.48125067", "0.4770679", "0.4765997", "0.4754698", "0.47423172", "0.47075891", "0.47068083", "0....
0.7686325
0
Combine conditions of multi nets into a single condition nets. Unlike MergeConditionNets, the actual body of condition_nets is not copied into the combine condition net. One example is about multi readers. Each reader net has a reader_done condition. When we want to check whether all readers are done, we can use this f...
def CombineConditions(name, condition_nets, relation): if not condition_nets: return None if not isinstance(condition_nets, list): raise ValueError('condition_nets must be a list of nets.') if len(condition_nets) == 1: condition_blob = GetConditionBlobFromNet(condition_nets[0]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def MergeConditionNets(name, condition_nets, relation):\n if not isinstance(condition_nets, list):\n return condition_nets\n if len(condition_nets) <= 1:\n return condition_nets[0] if condition_nets else None\n\n merged_net = core.Net(name)\n for i in range(len(condition_nets)):\n ...
[ "0.7624063", "0.55943316", "0.54562604", "0.5378349", "0.5304795", "0.53004134", "0.5258702", "0.51748735", "0.5158123", "0.51136285", "0.4949369", "0.49080285", "0.4888869", "0.48692665", "0.48304552", "0.480443", "0.47744024", "0.47574097", "0.4734627", "0.4730543", "0.4715...
0.77654374
0
Execute nets_or_steps once if condition_blob_or_net evaluates as true. If condition_blob_or_net is Net, the condition is its last external_output that must be a single bool. And this net will be executed before nets_or_steps so as to get the condition.
def _RunOnceIf(name, condition_blob_or_net, nets_or_steps): condition_not_net, stop_blob = NotNet(condition_blob_or_net) if isinstance(condition_blob_or_net, core.Net): nets_or_steps = _PrependNets( nets_or_steps, condition_blob_or_net, condition_not_net) else: nets_or_steps = _P...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def If(name, condition_blob_or_net,\n true_nets_or_steps, false_nets_or_steps=None):\n if not false_nets_or_steps:\n return _RunOnceIf(name + '/If',\n condition_blob_or_net, true_nets_or_steps)\n\n if isinstance(condition_blob_or_net, core.Net):\n condition_blob =...
[ "0.73675174", "0.7273347", "0.618141", "0.6055985", "0.6055583", "0.60114014", "0.597435", "0.5808215", "0.5723723", "0.5427139", "0.5357205", "0.5280723", "0.5143077", "0.51206553", "0.5060851", "0.50121224", "0.49887446", "0.49628964", "0.49568167", "0.49241686", "0.4904748...
0.78484195
0
Similar to _RunOnceIf() but Execute nets_or_steps once if condition_blob_or_net evaluates as false.
def _RunOnceIfNot(name, condition_blob_or_net, nets_or_steps): if isinstance(condition_blob_or_net, core.Net): condition_blob = GetConditionBlobFromNet(condition_blob_or_net) nets_or_steps = _PrependNets(nets_or_steps, condition_blob_or_net) else: copy_net, condition_blob = _CopyConditio...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _RunOnceIf(name, condition_blob_or_net, nets_or_steps):\n condition_not_net, stop_blob = NotNet(condition_blob_or_net)\n if isinstance(condition_blob_or_net, core.Net):\n nets_or_steps = _PrependNets(\n nets_or_steps, condition_blob_or_net, condition_not_net)\n else:\n nets_or...
[ "0.89142805", "0.744468", "0.66873306", "0.59861183", "0.5724799", "0.548251", "0.5452459", "0.542559", "0.52460366", "0.51889366", "0.5183879", "0.517955", "0.51714003", "0.5156899", "0.5055725", "0.505106", "0.4996994", "0.49611074", "0.49061406", "0.48697808", "0.48664936"...
0.8592025
1
Execute nets_or_steps iter_num times.
def For(name, nets_or_steps, iter_num): init_net = core.Net('init-net') iter_cnt = init_net.CreateCounter([], init_count=iter_num) iter_net = core.Net('For-iter') iter_done = iter_net.CountDown([iter_cnt]) for_step = core.scoped_execution_step( _get_next_step_name('For-inner', name), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self):\n count = self.neuron_count\n for i in range(0, count):\n self.run(i)", "def step_through_generations(self, num_steps):\n for island in self._islands:\n for _ in range(num_steps):\n island.execute_generational_step()\n self.archipela...
[ "0.68562824", "0.6105768", "0.6041068", "0.6020368", "0.6004475", "0.5930315", "0.5829216", "0.5829216", "0.5829216", "0.5829216", "0.5805606", "0.5708621", "0.5672995", "0.5591503", "0.5589253", "0.5589253", "0.55789065", "0.5522847", "0.5498539", "0.54596704", "0.54588664",...
0.6945695
0
condition_blob_or_net is first evaluated or executed. If the condition is true, true_nets_or_steps is then executed, otherwise, false_nets_or_steps is executed. If condition_blob_or_net is Net, the condition is its last external_output that must be a single bool. And this Net will be executred before both true/false_ne...
def If(name, condition_blob_or_net, true_nets_or_steps, false_nets_or_steps=None): if not false_nets_or_steps: return _RunOnceIf(name + '/If', condition_blob_or_net, true_nets_or_steps) if isinstance(condition_blob_or_net, core.Net): condition_blob = GetConditio...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _RunOnceIf(name, condition_blob_or_net, nets_or_steps):\n condition_not_net, stop_blob = NotNet(condition_blob_or_net)\n if isinstance(condition_blob_or_net, core.Net):\n nets_or_steps = _PrependNets(\n nets_or_steps, condition_blob_or_net, condition_not_net)\n else:\n nets_or...
[ "0.6926337", "0.66777575", "0.6479896", "0.6441377", "0.63872135", "0.62191385", "0.61840606", "0.61413604", "0.60844344", "0.58048606", "0.57220614", "0.5701439", "0.56119406", "0.55962175", "0.5581129", "0.55714786", "0.542765", "0.5419177", "0.5397936", "0.5374643", "0.537...
0.7729884
0
Get common friends between a user and friends of friends
def get_common_friends(user, friends, friends_of_friends, data): common_friends_list = {} friends_set = set(friends) for friend_of_friend in list(set(friends_of_friends)): if int(friend_of_friend) != user and friend_of_friend not in friends: friend_of_friend_list = get_friends(friend_of_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def common_friends(self, user):\n\n self_friend_ids = set(self.friends.keys()) if self.friends else set()\n other_friend_ids = set(user.fb_profile.friends.keys()) if user.fb_profile.friends else set()\n\n common_friend_ids = self_friend_ids.intersection(other_friend_ids)\n\n return comm...
[ "0.83076835", "0.79299134", "0.7002032", "0.6910199", "0.68386674", "0.68090963", "0.67361", "0.67336357", "0.6733494", "0.6692971", "0.66458225", "0.6522563", "0.6408325", "0.6280719", "0.6243145", "0.6216083", "0.6179447", "0.6145441", "0.61390674", "0.6134037", "0.61039096...
0.8066148
1
Get top 4 friends for a given user
def get_top_friends(common_friends_list): n = 4 top_n_users = [] top_scores = sorted(common_friends_list, reverse=True) for score in top_scores: top_n_users.append(sorted(common_friends_list[score])) top_n_users = sum(top_n_users, []) return top_n_users[:n]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_friend_with_most_friends(friendships, users=users):\n user_friends = defaultdict(set)\n for u, f in friendships:\n user_friends[u].add(f)\n user_friends[f].add(u)\n res = sorted(user_friends.items(), key=lambda x: -len(x[1]))\n return users[res[0][0]], [users[id] for id in res[0][...
[ "0.6958357", "0.69005066", "0.64544016", "0.63902384", "0.63118404", "0.6075729", "0.60013187", "0.5947723", "0.5944622", "0.5923256", "0.59082407", "0.5878896", "0.58714277", "0.5868388", "0.58375114", "0.5760233", "0.5754294", "0.57503206", "0.57412446", "0.57057273", "0.56...
0.756815
0
Update a dict with config values read from the given TOML config file.
def _update_config_dict(self, config_fpath: str, config_dict: Optional[dict[str, Any]] = None) -> dict[str, Any]: if config_dict is None: to_update = {} else: to_update = deepcopy(config_dict) with open(config_fpath, 'rb') as f: to_update.update(tomli.load(f))...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(self, config_dict):\r\n self._update(config_dict, allow_new_keys=True)", "def update_tempest_conf_file(conf_file, rconfig):\n with open(TEMPEST_CONF_YAML) as yfile:\n conf_yaml = yaml.safe_load(yfile)\n if conf_yaml:\n sections = rconfig.sections()\n for section in conf_y...
[ "0.65730196", "0.6557965", "0.65447694", "0.6525869", "0.6483303", "0.646921", "0.6353974", "0.63318324", "0.632594", "0.6308811", "0.6299034", "0.6297985", "0.6278395", "0.62590736", "0.62476975", "0.6238274", "0.6215915", "0.62124205", "0.616134", "0.61547375", "0.61363965"...
0.712006
0
Delete all feeds for the given profile and matching the given title, URL and category.
def delete_feeds(self, feed_url: Optional[str] = WILDCARD, feed_title: Optional[str] = WILDCARD, category: Optional[str] = WILDCARD) -> int: feedlist = self.feedlist return feedlist.remove_feeds(feed_title, feed_url, category)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_feed(request, feed_id):\n\n __time_update(request.user)\n\n try:\n Feed.objects.get(id=feed_id, user=request.user).delete()\n except:\n pass\n\n return redirect('/feeds')", "def delete_feeds_in_folder(folder: Folder) -> None:\n for child in folder.children:\n ...
[ "0.5824804", "0.5633305", "0.5528597", "0.5527715", "0.53017414", "0.5272596", "0.50685567", "0.49680397", "0.4911695", "0.48375058", "0.4809733", "0.4808965", "0.47934234", "0.47929263", "0.47893107", "0.47627655", "0.47411543", "0.46981162", "0.4697087", "0.46683466", "0.46...
0.69476587
0
Set the OPML file for the profile, replacing the existing one if it exists.
def set_opml_file(self, fpath: str, sync: bool = True): shutil.copy(fpath, self.opml_file) self._feedlist = None if sync: self.sync_reader()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_profile(file_path, profile):\r\n try:\r\n xSettings = XmlWriterSettings()\r\n xSettings.Indent = True\r\n with XmlWriter.Create(file_path, xSettings) as writer:\r\n profile.save_to_xml(writer)\r\n except Exception, ex:\r\n MessageBox.Show(\"An error occured wri...
[ "0.59720385", "0.5946612", "0.5884504", "0.5634158", "0.5600494", "0.5560542", "0.5529731", "0.5501653", "0.54939026", "0.5429731", "0.54051363", "0.53021175", "0.52917933", "0.5277601", "0.52422714", "0.5233047", "0.52157325", "0.5215528", "0.51722664", "0.51341355", "0.5065...
0.64602375
0
Mark entries as read.
def mark_read(self, entries: Optional[list[Entry]] = None): with make_reader(self.reader_db_file) as reader: if entries is None: entries = reader.get_entries(read=False) for e in entries: reader.mark_entry_as_read(e)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mark_as_read(entry):\n if has_been_read(entry):\n return\n title = entry.title\n date = date_parser.parse(entry.updated)\n READLIST.append(str(date.timestamp()) + '|' + title)\n save_datfile()", "def register_read(self):\n self._reads_since_check += 1", "def trigger_mark_all_re...
[ "0.7864971", "0.72718954", "0.7265275", "0.71472174", "0.70415294", "0.6794396", "0.67838854", "0.66119766", "0.6548277", "0.65389913", "0.6329891", "0.6271186", "0.6197877", "0.6144356", "0.6007796", "0.5986957", "0.59641165", "0.5938737", "0.5920633", "0.5896191", "0.584047...
0.77640504
1
getSphereRadius(self) This method can be overwritten by an inheritor.
def getSphereRadius(self): return 1.5
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Radius(self, *args):\n return _Bnd.Bnd_Sphere_Radius(self, *args)", "def getRadius(self):\n return self.__radius", "def getRadius(self):\n return self.radius", "def get_radius(self):\n return self.__radius", "def get_radius(self):\n return self.radius", "def get_rad...
[ "0.79568285", "0.75595754", "0.7555072", "0.7485369", "0.7459385", "0.7459385", "0.7442136", "0.74327374", "0.73727214", "0.73186463", "0.73132515", "0.73111546", "0.72903955", "0.72903955", "0.72903955", "0.72903955", "0.72903955", "0.7226708", "0.719505", "0.713818", "0.712...
0.8433614
0
this task moves the cannon
def __localCannonMoveTask(self, task): pos = self.cannonPosition # these are used to determine if the cannon actually moved oldRot = pos[0] oldAng = pos[1] # cannon rotation rotVel = 0 if self.leftPressed: rotVel += CANNON_ROTATION_VEL if sel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def movement(self):", "def __fireCannonTask(self, task):\n launchTime = task.fireTime\n avId = task.avId\n\n assert(self.notify.debug(\"FIRING CANNON FOR AVATAR \" + str(avId)))\n\n if self.toonHead == None or (not self.boss.state == 'BattleTwo'):\n #hopefully fix crash 188...
[ "0.67301077", "0.651839", "0.6470558", "0.6445525", "0.6328161", "0.63108706", "0.6294696", "0.62725765", "0.6225932", "0.61884284", "0.61884284", "0.61802477", "0.6180178", "0.6174534", "0.6173917", "0.6164551", "0.6159964", "0.6149018", "0.6144942", "0.61444473", "0.6137266...
0.7765644
0
spawn a task sequence to shoot the cannon, fly the avatar through the air, handle the toon's landing
def __fireCannonTask(self, task): launchTime = task.fireTime avId = task.avId assert(self.notify.debug("FIRING CANNON FOR AVATAR " + str(avId))) if self.toonHead == None or (not self.boss.state == 'BattleTwo'): #hopefully fix crash 18821 return Task.done ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shoot(self):\n if self.gun_interface:\n self.gun_interface.prepare_fire()", "def start_shooting(agent):\n agent.step = Step.Shooting\n target = shooting_target(agent)\n speed = get_speed(agent, target)\n agent.drive.target = target\n agent.drive.speed = speed", "def spawn(d...
[ "0.6202411", "0.6163606", "0.60756814", "0.5945586", "0.59288013", "0.5911339", "0.58665675", "0.5766796", "0.57037824", "0.5692699", "0.5680294", "0.56542546", "0.5564807", "0.5558105", "0.5552209", "0.5551958", "0.55440086", "0.551518", "0.5500324", "0.5498018", "0.5474682"...
0.7359727
0
__calcToonImpact(self, waterTower) calculate the result of the toon's trajectory check if the toon will land in the water, hit the tower, or hit the ground returns time of impact, what toon hits
def __calcToonImpact(self, trajectory): assert self.notify.debug('__calcToonImpact') # calculate when the toon will hit the ground # (assume absolute lowest point of terrain is above GROUND_PLANE_MIN) t_groundImpact = trajectory.checkCollisionWithGround(GROUND_PLANE_MIN) if t_g...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def water_uptake_campbell(self, soil):\r\n daily_ref_evap_transp = soil.daily_ref_evap_transp\r\n root_hydr_cond = np.zeros(soil.total_layers)\r\n shoot_hydr_cond = np.zeros(soil.total_layers)\r\n plant_hydr_cond = np.zeros(soil.total_layers)\r\n root_activity = np.zeros(soil.tot...
[ "0.5689208", "0.5538323", "0.5492031", "0.5375044", "0.5371269", "0.5357118", "0.5343329", "0.5285835", "0.5229035", "0.51972085", "0.51867586", "0.5160002", "0.5135931", "0.5113904", "0.5032317", "0.4969959", "0.49520725", "0.49326545", "0.49000394", "0.4879735", "0.48748448...
0.76691276
0
Apply the second law of mecanics to the angles.
def applySecondLaw(self): g=self.gravity a0=self.angles[0].acceleration
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def applySecondLawForTwo(self):\n g=self.gravity\n m1,m2=self.masses\n l1,l2=self.lengths\n p1,v1=[a[0] for a in self.angles[0][:2]]\n p2,v2=[a[0] for a in self.angles[1][:2]]\n\n num=-g*(2*m1+m2)*math.sin(p1)-m2*g*math.sin(p1-2*p2)\\\n -2*math.sin(p1-p2)*m2*(v2...
[ "0.7240377", "0.57308495", "0.5414197", "0.5365908", "0.53156704", "0.52927196", "0.52172405", "0.51269877", "0.51179254", "0.50871927", "0.5074496", "0.50741136", "0.50741136", "0.50567716", "0.5004356", "0.4996506", "0.4986346", "0.4946795", "0.49317724", "0.49115378", "0.4...
0.71805036
1
Update the angles physically.
def updateAngles(self, dt): for angle in self.angles: angle.update(dt)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_angles(self):\n joint_values = []\n for i in self.joint_names:\n joint_values.append(self.joint_angles[i])\n \n try:\n answer = self.update_arm_angles(joint_values)\n except rospy.ServiceException as e:\n rospy.logwarn('Service call fai...
[ "0.7082642", "0.6694676", "0.6682709", "0.6670118", "0.6645015", "0.65735483", "0.6539625", "0.6503754", "0.64982635", "0.64879644", "0.6466207", "0.6416143", "0.64029855", "0.6376906", "0.63590896", "0.6312553", "0.6304773", "0.62470764", "0.62445027", "0.6215055", "0.619879...
0.78928244
0
Create a random pendulum.
def random(cls, n=2): return cls(Pendulum.random(n=2))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pendulum(pos):\n\n def x_dot(x, y):\n return y\n\n def y_dot(x, y):\n return -np.sin(x)\n\n return np.array([x_dot(pos[0], pos[1]), y_dot(pos[0], pos[1])])", "def __init__(self, pendulum, name=\"Pendulum\", dt=0.01):\n super().__init__(name=name)\n self.pendulum = pendulu...
[ "0.6564568", "0.63007843", "0.6046844", "0.6038102", "0.5854131", "0.5800048", "0.5750576", "0.5750576", "0.5750576", "0.5750576", "0.5750576", "0.57442427", "0.57232606", "0.5718222", "0.5685477", "0.56323427", "0.56277716", "0.56033", "0.5564258", "0.5465922", "0.54217327",...
0.6816523
0
Create a pendulum manager using the pendulum.
def __init__(self, pendulum, name="Pendulum", dt=0.01): super().__init__(name=name) self.pendulum = pendulum self.dt = dt
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_pendulum_example(duration=1.0, playback=True, show=True):\n\n builder = DiagramBuilder()\n plant, scene_graph = AddMultibodyPlantSceneGraph(builder, 0.0)\n parser = Parser(plant)\n parser.AddModelFromFile(FindResourceOrThrow(\n \"drake/examples/pendulum/Pendulum.urdf\")\n )\n plant...
[ "0.5572172", "0.5564887", "0.5278047", "0.52359414", "0.52278715", "0.5187613", "0.5168771", "0.5145004", "0.5140956", "0.51336116", "0.5036661", "0.5008107", "0.49763557", "0.49757063", "0.49223414", "0.49202704", "0.488684", "0.48858172", "0.4875343", "0.48744062", "0.48677...
0.6602725
0
Given an application name, returns the id of that application
def get_id(self, app_name): _id = [] apps = [app for app in self.applications.response if app.name == app_name] if len(apps) > 0: return apps[0].id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def application_id(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"application_id\")", "def application_id(self) -> Optional[str]:\n return pulumi.get(self, \"application_id\")", "def app_id(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"app_id\")", "def app_id(self):\n ...
[ "0.7562458", "0.75303864", "0.75129336", "0.750311", "0.74893665", "0.7445866", "0.74088424", "0.7377183", "0.737653", "0.737653", "0.737653", "0.73112774", "0.7233204", "0.72292113", "0.7191645", "0.70348936", "0.6946744", "0.68375003", "0.68212605", "0.6800069", "0.6758608"...
0.8555952
0
Creates policy tags list object using policy scope in self
def policy_tags(self): return self.client.policy.getPolicyTags()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extend_tag_policy_with_hdfs(policy):\n if get_resource_type(policy) != \"tag\":\n raise AttributeError(\"Policy does not have resource type tag. Policy: {}\".format(policy[\"name\"]))\n policy_template_tag = copy.deepcopy(policy)\n if \"policyItems\" in policy:\n policy_template_tag[\"po...
[ "0.57659364", "0.5557271", "0.55302596", "0.54121256", "0.5300492", "0.50835073", "0.5067732", "0.505009", "0.5020911", "0.49841553", "0.49700204", "0.49651203", "0.494583", "0.49399063", "0.49257648", "0.4919358", "0.48868096", "0.48542804", "0.48540357", "0.4851833", "0.484...
0.59002554
0
Given an application name, get that applications relevance level
def app_relevance(self, app_name): for p in self.policy_list.response: apps = [app for app in p.resource.applications if app.appName == app_name] if len(apps) > 0: print("Found application {} in {} policy".format(app_name, p.actionProperty.relevanceLevel)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_relevance(self, app_name, target_relevance):\n # Check that target relevance is valid\n valid_relevance = [\"Business-Relevant\", \"Default\", \"Business-Irrelevant\"]\n if target_relevance not in valid_relevance:\n raise ValueError(\"Invalid relevance\")\n\n # Find...
[ "0.5443409", "0.53804815", "0.5297572", "0.5284335", "0.5284119", "0.5243036", "0.5136495", "0.5121875", "0.50834924", "0.5069716", "0.5021208", "0.50045514", "0.50018895", "0.49229807", "0.49013633", "0.4898913", "0.48835105", "0.48552275", "0.48535874", "0.4843333", "0.4831...
0.85490304
0
Finds the PolicyApplication object for the app name
def find_app(self, app_name): self._app = None for p in self.policy_list.response: apps = [app for app in p.resource.applications if app.appName == app_name] if len(apps) > 0: return apps[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_application_by_name(self, application_name):\n try:\n applications = self.get_applications()\n\n if applications.total_count <= 0:\n return None\n\n for application in applications.items:\n\n if application.application_name == applicatio...
[ "0.7732624", "0.69482297", "0.6727604", "0.67139983", "0.670491", "0.64687383", "0.63145083", "0.6288519", "0.6225315", "0.61759794", "0.6173872", "0.61317444", "0.61171967", "0.6102927", "0.6099135", "0.6072275", "0.60207444", "0.6019222", "0.5970426", "0.5968419", "0.594321...
0.86286134
0
Resets the relevance level for an application to the target level for the Policy object self
def reset_relevance(self, app_name, target_relevance): # Check that target relevance is valid valid_relevance = ["Business-Relevant", "Default", "Business-Irrelevant"] if target_relevance not in valid_relevance: raise ValueError("Invalid relevance") # Find the PolicyApplicat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def app_relevance(self, app_name):\n for p in self.policy_list.response:\n apps = [app for app in p.resource.applications if app.appName == app_name]\n if len(apps) > 0:\n print(\"Found application {} in {} policy\".format(app_name, p.actionProperty.relevanceLevel))\n ...
[ "0.5594951", "0.54969305", "0.5444808", "0.52919674", "0.52654", "0.51858056", "0.5173985", "0.5129117", "0.50610816", "0.5053173", "0.5049669", "0.5049669", "0.5030381", "0.5014958", "0.49996772", "0.49872863", "0.4978505", "0.4970231", "0.49572632", "0.4933648", "0.49063694...
0.7266994
0
Updates the policy list in APIC EM through PUT request. Must execute reset_relevance to make changes to object first
def update_apic(self): return self.client.policy.update(policyList=self.policy_list.response)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_policy(self, *args, **kwargs):\r\n pass", "def update_policy(self):\n pass", "def put(self):\n coll_policy_id = views_helper.get_request_value(self.request, \"coll_policy_id\", \"BODY\")\n name = views_helper.get_request_value(self.request, \"coll_policy_name\", \"BODY\")...
[ "0.6709654", "0.64733785", "0.6198873", "0.61548156", "0.57368577", "0.56582487", "0.56307983", "0.56163615", "0.5608646", "0.55927926", "0.5544801", "0.547473", "0.54129666", "0.54065937", "0.54047453", "0.53995174", "0.5331519", "0.5312514", "0.5286032", "0.5232486", "0.521...
0.7257577
0
Returns main dataset for objective task
def get_main_dataset(self) -> pd.DataFrame: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_dataset(self):\n return", "def get_dataset(args):\n\n if args['experiment']['dataset'] == Dataset.mindsets:\n xs, ys, cs = make_mindsets(mindset_sizes=args['dataset']['mindset_sizes'],\n nb_questions=args['dataset']['nb_questions'],\n ...
[ "0.6340243", "0.62394583", "0.6127781", "0.5898281", "0.5844141", "0.5811546", "0.5774687", "0.57384896", "0.57343227", "0.5732533", "0.5727184", "0.5666297", "0.56520146", "0.5642181", "0.56286436", "0.5628482", "0.5623867", "0.560981", "0.5571464", "0.55700386", "0.5532945"...
0.6838314
0
Returns the base model for main task and optionally adversarial defense branch
def get_base_model(self) -> torch.nn.Module: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_model_class(model_name, task_name):\n if task_name == 'rocstories':\n return OpenAIGPTDoubleHeadsModel if model_name == 'openai-gpt' else GPT2DoubleHeadsModel\n else:\n return OpenAIGPTLMHeadModel if model_name == 'openai-gpt' else GPT2LMHeadModel", "def model(\n self,\n ) -> Un...
[ "0.62072647", "0.60157454", "0.5675031", "0.5624439", "0.56151766", "0.55856323", "0.5567792", "0.5545755", "0.5514103", "0.55038637", "0.550079", "0.5497984", "0.54922676", "0.5481514", "0.5476642", "0.5466707", "0.5466362", "0.54570955", "0.5447391", "0.5439189", "0.5438547...
0.634604
0
Returns a list of optimizers corresponding to the adversaries
def get_oracle_adversary_optimizers( self, adversaries: List[torch.nn.Module], mode: str ) -> List[torch.optim.Optimizer]: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def configure_optimizers(self) -> Union[Optimizer, List[Optimizer]]:\n optimizers = []\n\n for modality in range(self.num_modalities):\n optimizers.append(\n torch.optim.Adam(\n list(self.unimodal_encoder[modality].parameters())\n + list...
[ "0.7251083", "0.6875782", "0.6770029", "0.6555687", "0.6550437", "0.64720374", "0.64490086", "0.6418673", "0.6409711", "0.6387858", "0.6313365", "0.62868917", "0.6283588", "0.6182085", "0.61477345", "0.6135649", "0.6127766", "0.61269724", "0.61237437", "0.6120173", "0.6113001...
0.77951735
0
Returns the optimizer corresponding to the task model
def get_task_optimizer(self) -> torch.optim.Optimizer: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_optimizer(self):\n raise NotImplementedError", "def get_optimizer(model):\n optimizer = optim.Adam(model.parameters(), lr=0.001, betas=(0.5, 0.999))\n return optimizer", "def optimizer(self):\n return self._optimizer", "def get_optimizer(args, model: torch.nn.Module):\n return...
[ "0.76700234", "0.7577644", "0.73444307", "0.7105193", "0.7072981", "0.7061312", "0.69659466", "0.693067", "0.6903654", "0.68924415", "0.67964715", "0.6715774", "0.66913575", "0.66694355", "0.66452295", "0.6603657", "0.6600693", "0.658666", "0.65843916", "0.6572727", "0.656210...
0.8302514
0
Returns the numebr of adversaries
def num_adversaries(self) -> int: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def num_links(self):\n count=0.0\n for cluster in self.clusters:\n if self.clusters[cluster] == self.clusters[cluster].antecessor:\n numberofmembers=self.clusters[cluster].number_of_members\n count+=numberofmembers\n return count", "def len(self):\n start = self.head\...
[ "0.73838484", "0.6949291", "0.6922274", "0.6897272", "0.685758", "0.6795353", "0.6759663", "0.6748077", "0.6742445", "0.67133677", "0.668863", "0.66841257", "0.66533107", "0.66496074", "0.6630829", "0.6630114", "0.66257524", "0.6624353", "0.6620948", "0.6605383", "0.66014236"...
0.7596054
0
Returns a list of adversary names, in the same order as the model and optimizer method
def get_ordered_adversary_names(self) -> List[str]: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_oracle_adversary_optimizers(\n self, adversaries: List[torch.nn.Module], mode: str\n ) -> List[torch.optim.Optimizer]:\n pass", "def get_activation_names(model: onnx_pb.ModelProto) -> List[str]:\n activation_names = get_graph_intermediate_activations(model.graph)\n activati...
[ "0.6453177", "0.6279718", "0.6021705", "0.5897697", "0.58731526", "0.57706594", "0.5710517", "0.56733173", "0.56366974", "0.56260926", "0.55321854", "0.5524921", "0.55152845", "0.5499061", "0.5493515", "0.5483933", "0.546663", "0.5459514", "0.5443661", "0.5434785", "0.540687"...
0.6817677
0
Train a task, then evaluate adversary performance
def train_task_with_adversary( self, mode: str, dirname: str, refresh=True, progress=None, task=None, adv_tasks=[], ): if refresh: self.base_model = self.get_base_model() optimizer_task = self.get_task_optimizer() optimize...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train_on_tasks(config):\n seed = config['seed']\n torch.manual_seed(seed)\n torch.cuda.manual_seed_all(seed)\n np.random.seed(seed)\n random.seed(seed)\n\n tasks = config.pop('tasks')\n\n task_vis_params = config.pop('vis_params')\n\n # all_stats = []\n transfer_matrix = defaultdict(...
[ "0.6915205", "0.6898409", "0.688173", "0.6795528", "0.6718781", "0.67183656", "0.6718148", "0.6687305", "0.66696817", "0.66321677", "0.6596657", "0.65957975", "0.6590686", "0.6578005", "0.6565626", "0.6522425", "0.6522425", "0.6488063", "0.6488063", "0.6488063", "0.6488063", ...
0.7004801
0
Parse atom feed for youtube video data.
def parse_atom_playlist_data(xml): feed = gdata.youtube.YouTubePlaylistVideoFeedFromString(xml) type, id = feed.id.text.split(':', 3)[2:] if type == 'user': id = id.replace(':', '/') seen = [] videos = [] for entry in feed.entry: video = _get_atom_video_data(entry, id) if...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _parse_feed(self,feed): \n meta=[]\n for entry in feed:\n item_meta=self._parse_entry(entry)\n item_meta['video-id']='0'\n meta.append(item_meta)\n self._logger.info('%s videos were founded and parsed at Megavideo',len(meta)) \n return meta", "d...
[ "0.6996982", "0.6802243", "0.63156843", "0.626175", "0.624998", "0.624998", "0.6189903", "0.6082588", "0.60212564", "0.59324557", "0.58641934", "0.58641934", "0.5814339", "0.5801153", "0.5761655", "0.57320297", "0.56887573", "0.56656975", "0.5654149", "0.5636025", "0.56295586...
0.71766186
0
Extract data from youtube video json record and return Video model.
def _get_video_data(youtube_data, playlist=None): def get_category(categories): for category in categories: if category['scheme'].endswith('categories.cat'): return category['$t'] # TODO: map category media = youtube_data['media$group'] video = Video( source_vid...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def retrieve_video(cls, player_data: dict):\n\n return InnerTubeVideo.from_player(player_data)", "def from_youtube(cls, video_data, event):\n self = cls(event)\n\n metadata = self.metadata\n\n metadata['title'] = self.__calculate_title(video_data)\n self.filename = self.__calcu...
[ "0.685507", "0.67769206", "0.673421", "0.6608301", "0.6580121", "0.6580121", "0.6501579", "0.63600385", "0.62736505", "0.62736505", "0.6157241", "0.6120329", "0.60920286", "0.59955454", "0.59614617", "0.594108", "0.5931253", "0.5926817", "0.59098226", "0.58660525", "0.5821469...
0.721468
0
Check for matches that make the path deeper.
def search_down(line, pattern_tree, pattern_path, result_tree, result_path): pattern_node = traverse(pattern_tree, pattern_path) if callable(pattern_node): pattern_node(traverse(result_tree, result_path), line) return True for pattern in pattern_node.keys(): match = pattern.match(lin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_matches__root_relative(self):\n path_rule1 = gitignore_parser(\"a/*/z\")[0]\n self.assertTrue(\n path_rule1.is_root_relative\n )\n \"It matches a path that is root relative\"\n self.assertTrue(\n path_rule1.matches(CPath(\"a/b/z\"))\n )\n ...
[ "0.63398206", "0.5996367", "0.59574354", "0.59574354", "0.5873093", "0.581271", "0.57354295", "0.57282454", "0.56260335", "0.56068087", "0.56042767", "0.5569123", "0.55508095", "0.5545671", "0.5545302", "0.55442303", "0.55180913", "0.550756", "0.54997504", "0.54969937", "0.54...
0.60384774
1
Parse formatted_file according to pattern_tree and return result_tree.
def parsec(formatted_file, pattern_tree): pattern_path = [] result_tree = {} result_path = [] for line in formatted_file: search(line, pattern_tree, pattern_path, result_tree, result_path) return result_tree
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_file(file: CodeFile, config: dict):\n path = os.path.join(file.dir, f'{file.name}.{file.extension}')\n print(path)\n file_gen = (line for line in open(path))\n for line in file_gen:\n parse.apply_patterns(line.strip(), config['patterns'], file)", "def parse_tsp_file(file):\n # def...
[ "0.622701", "0.60060585", "0.5874076", "0.58095723", "0.5805007", "0.5720404", "0.5715918", "0.5675692", "0.5653078", "0.56460464", "0.5615729", "0.55772895", "0.55523974", "0.5533864", "0.5516646", "0.5502276", "0.5469485", "0.5466266", "0.5452186", "0.5427296", "0.5395021",...
0.74127203
0
Creates a ogr geometry from a wkt ou wkb.
def create_ogr_geom(geom) -> ogr.Geometry: if isinstance(geom, ogr.Geometry): return geom # Converte os tipos para diferentes situações (python 2.7). # if isinstance(geom, str): # geom = str(geom) # elif isinstance(geom, unicode): # geom = str(geom) try: ogr_geom = o...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fromfile(file_h):\n # If given a file name, get a real handle.\n if isinstance(file_h, str):\n with open(file_h, \"rb\") as file_h:\n buf = file_h.read()\n else:\n buf = file_h.read()\n\n # If we get WKB need to wrap in memoryview(), so run through regexes.\n if isinstan...
[ "0.6555847", "0.64324313", "0.62576693", "0.61126995", "0.60266364", "0.58980834", "0.58812046", "0.5869397", "0.5868392", "0.5806408", "0.5798085", "0.5727022", "0.5685899", "0.5613248", "0.5575141", "0.55483526", "0.55452156", "0.5513422", "0.5506148", "0.54213506", "0.5391...
0.74475837
0
Creates an OSR transform from epsg codes.
def create_osr_transform(src_epsg: int, dst_epsg: int): src_srs = osr.SpatialReference() src_srs.ImportFromEPSG(src_epsg) dst_srs = osr.SpatialReference() dst_srs.ImportFromEPSG(dst_epsg) return osr.CoordinateTransformation(src_srs, dst_srs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def makeTransformations(epsg1, epsg2):\n sr1 = osr.SpatialReference()\n sr1.ImportFromEPSG(epsg1)\n preventGdal3axisSwap(sr1)\n sr2 = osr.SpatialReference()\n sr2.ImportFromEPSG(epsg2)\n preventGdal3axisSwap(sr2)\n tr1to2 = osr.CoordinateTransformation(sr1, sr2)\n tr2to1 = osr.CoordinateTra...
[ "0.6183302", "0.60319245", "0.5800851", "0.5239183", "0.52131534", "0.5128466", "0.50922954", "0.50729734", "0.499788", "0.4930251", "0.48939618", "0.4828638", "0.48010585", "0.48008323", "0.47834936", "0.47655264", "0.47149742", "0.4709354", "0.46838078", "0.46815968", "0.46...
0.65736836
0
Return the date of the livestock sale.
def get_sale_date(tr): text = tr.span.get_text() sale_date = dateutil.parser.parse(text).date() if sale_date > date.today(): sale_date = sale_date.replace(year=(sale_date.year - 1)) if sale_date==date.today(): sale_date = None return sale_date
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_date(self):\n return self.date", "def get_date(self):\n return self.date", "def get_date(self):\n return self.date", "def get_date(self):\n return self.date", "def get_date(data):\r\n data = json.loads(data)\r\n dates = data.get(\"ReceiptData\", {\"orderDate\": []}...
[ "0.62873405", "0.62873405", "0.62873405", "0.62873405", "0.62641156", "0.60765684", "0.6073249", "0.5977158", "0.59747446", "0.5972382", "0.5943602", "0.5930417", "0.59158534", "0.58997124", "0.5864014", "0.5847128", "0.58424413", "0.5838532", "0.5838532", "0.5838532", "0.580...
0.7018784
0
Set up an auxiliary camera floater, which is parented to the vehicle. Every frame base.cam's position will be set to the camera floater's.
def attach_camera_floater(self): camera_behind = 8 camera_above = 3 self.camera_floater = NodePath("camera_floater") self.camera_floater.reparent_to(self.vehicleNP) self.camera_floater.set_y(-camera_behind) self.camera_floater.set_z(camera_above)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_camera(self) -> None:\n self.world.camera.update(\n cam_base_pos=(0, -3, 0),\n cam_dist=1.2*self.world.env_dim,\n cam_yaw=0,\n cam_pitch=-60\n )", "def setupCamera(self) :\n\t\tbase.disableMouse()\n\t\tbase.camera.setPos(self.avatarNP.getPos())\...
[ "0.75920063", "0.7547525", "0.74088115", "0.7006333", "0.68600714", "0.66652673", "0.65736806", "0.6508047", "0.6463104", "0.6244895", "0.6131402", "0.6081765", "0.6068499", "0.6064493", "0.6058915", "0.6012992", "0.5995592", "0.59945875", "0.5990719", "0.59668475", "0.595506...
0.79818153
0
Puts a stack of boxes at a distance in front of the vehicle. The boxes will not necessarily spawn above the terrain and will not be cleaned up.
def drop_boxes(self): model = loader.load_model('models/box.egg') model.set_pos(-0.5, -0.5, -0.5) model.flatten_light() shape = BulletBoxShape(LVector3(0.5, 0.5, 0.5)) ahead = self.vehicleNP.get_pos() + self.vehicle.get_forward_vector()*15 for i in range(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _place_objs(self, (screen_width, screen_height)):\n for x_pos in xrange(0, screen_width, self.itter_width):\n self.objects.put(Grass((x_pos, 0), self.width, self.height))", "def box_spots(stack, spot_data, max_mult=1.3, halfwidth_xy=15, \n halfwidth_z=8, linewidth=3, shadows=Tr...
[ "0.5720454", "0.5693573", "0.566866", "0.5641426", "0.5612867", "0.56064284", "0.55920374", "0.5569882", "0.554632", "0.5531407", "0.546692", "0.5408555", "0.5351429", "0.52971566", "0.528211", "0.5272804", "0.52632314", "0.525047", "0.52372515", "0.5222008", "0.52175945", ...
0.6539503
0
Query elevation for xy_pos if present, else for vehicle position. No xy_pos means verbose mode.
def query_elevation(self, xy_pos=None): query_pos = xy_pos or self.vehicleNP.get_pos() """ This method is accurate and may be useful for placing objects on the terrain surface. """ result = self.world.ray_test_closest( LPoint3(query_pos.x, query_pos.y,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_position():\n pos = get_position(date, lng, lat)\n assert np.isclose(pos['azimuth'], -2.5003175907168385)\n assert np.isclose(pos['altitude'], -0.7000406838781611)", "def _xyz_to_xy(\n self, xyz: np.ndarray, directions: bool = False, return_depth: bool = False\n ) -> Union[np.ndar...
[ "0.5978723", "0.5599393", "0.5565155", "0.5446557", "0.5395697", "0.53757083", "0.5335215", "0.530598", "0.53046256", "0.52628493", "0.5190286", "0.51530385", "0.5126687", "0.512333", "0.51208735", "0.51208735", "0.507535", "0.5057532", "0.50442374", "0.5042764", "0.5034105",...
0.7291514
0
Returns the score for a word. Assumes the word is a valid word. The score for a word is the sum of the points for letters in the word, multiplied by the length of the word, PLUS 50 points if all n letters are used on the first turn. Letters are scored as in Scrabble; A is worth 1, B is worth 3, C is worth 3, D is worth...
def getWordScore(word, n): score = 0 for letter in word: score += SCRABBLE_LETTER_VALUES[letter] score *= len(word) if len(word) == n: score += 50 return score
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getWordScore(word, n):\n score = 0\n\n for letters in word:\n if letters in SCRABBLE_LETTER_VALUES:\n score += SCRABBLE_LETTER_VALUES[letters]\n\n if len(word) == n:\n return (score * len(word)) + 50\n else:\n return score * len(word)", "def get_word_score(word, n=...
[ "0.83742183", "0.8292779", "0.8219575", "0.8051406", "0.80405915", "0.7843182", "0.7649459", "0.76360023", "0.7609491", "0.7585377", "0.7408382", "0.72049356", "0.7016833", "0.7013364", "0.6928556", "0.6781", "0.6754458", "0.6753728", "0.67235804", "0.6674011", "0.66671145", ...
0.8417652
0
Get the value of the ParameterSetting belonging to the Parameter.
def get_value(self, instance): try: return ParameterSetting.objects.get( base_parameter=instance, project=self.context.get("view").kwargs.get("project"), ).raw_value except ParameterSetting.DoesNotExist: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_parameter_value(self, parameter_name):\n if parameter_name in self.description[\"config\"][\"values\"].keys():\n return self.description[\"config\"][\"values\"][parameter_name][\"value\"]\n else:\n return \"No such parameter\"", "def get_setting_value(self, title, sett...
[ "0.75089955", "0.72683305", "0.719738", "0.7082149", "0.6969672", "0.66878647", "0.66652334", "0.66424656", "0.6629938", "0.6611464", "0.65800935", "0.65537184", "0.654167", "0.64994437", "0.6398343", "0.635788", "0.6313034", "0.6302036", "0.6298701", "0.62826157", "0.6194984...
0.7832906
0
Get choices corresponding to Choice parameter.
def get_choices(self, instance): if instance.type == BaseParameter.CHOICE_TYPE: return [ x.value for x in instance.get_typed_parameter().get_available_choices() ] else: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_choices(self):\n raise NotImplementedError()", "def get_choices(self):\n raise NotImplementedError()", "def choices(self):\n return self.__class__.get_setting_choices(self.key, **self.get_kwargs())", "def choices(self):\n return tuple(self._choices)", "def get_choices(cl...
[ "0.73449856", "0.73449856", "0.7286427", "0.72812116", "0.7238539", "0.7023777", "0.69930464", "0.6933792", "0.6919745", "0.6847725", "0.6815731", "0.6761577", "0.6735966", "0.6717294", "0.66043776", "0.6505848", "0.6486108", "0.64524007", "0.6411936", "0.6320837", "0.6315684...
0.81025434
0
Get all FileSettings belonging to the InputTemplate.
def get_files(self, instance): return [ x.file.id for x in FileSetting.objects.filter( input_template=instance, file__project=self.context.get("view").kwargs.get("project"), ) ]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def settings(self):\n return [\n self.input_type,\n self.input_object_name,\n self.image_name,\n self.objects_name,\n self.object_extension,\n self.file_name_method,\n self.file_image_name,\n self.wants_file_name_suffix,...
[ "0.5851698", "0.58501804", "0.5725187", "0.5703882", "0.5649764", "0.5625224", "0.56050867", "0.55772173", "0.557585", "0.55255944", "0.55156815", "0.54827774", "0.5475032", "0.54567057", "0.54023623", "0.5388221", "0.53682894", "0.535844", "0.5349751", "0.53424305", "0.53363...
0.6864402
0
define the way to calculate the next move depending of the number of nonfree tokens on the board. For the Early Game, if the sum of pieces is lower than a constant, then we are looking into a bloomtable containing a list of wellknown Opening Move. If one is find, we are playing this move. For the MidGame, we are doing ...
def moveManager(self): (nb1,nb2) = self._board.get_nb_pieces() val = 0 alphaBeta_instance = AlphaBeta() # Early-Game: Check opening move in a custom bloom filter if(nb1+nb2 < MoveManager.__AI_OPENING_MOVE_VALUE__()): print("Check if ", Ut...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_next_moves(board, player):\r\n\r\n if player == 'hare':\r\n moves = []\r\n next_moves = []\r\n\r\n (row_from, col_from) = get_hare_positions(board)\r\n moves = possible_moves_list(row_from, col_from)\r\n\r\n for move in moves:\r\n row_to = move[0]\r\n ...
[ "0.69938403", "0.6930841", "0.6770444", "0.6742756", "0.67040116", "0.6683225", "0.66160494", "0.6575988", "0.6574038", "0.655996", "0.65349084", "0.65157354", "0.648711", "0.6473924", "0.6434746", "0.64260626", "0.6419971", "0.6407045", "0.6395168", "0.63820344", "0.6381643"...
0.7039494
0
The form for making a new repo is just the folder name
def newrepo(): form = AddRepoForm() if form.validate_on_submit(): # make the directory for this package os.mkdir(DATA + form.name.data) flash('Repo created successfully') # redirect to the login page return redirect(url_for('home.dashboard')) # load registration t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def repo_new(request):\n if request.method != 'POST':\n form = RepoForm()\n return respond(request, 'repo_new.html', {'form': form})\n form = RepoForm(request.POST)\n errors = form.errors\n if not errors:\n try:\n repo = models.Repository(\n name=form.cleaned_data.get('name'),\n url...
[ "0.759942", "0.72188056", "0.6910177", "0.67934567", "0.6586503", "0.6529314", "0.6414904", "0.627418", "0.6112879", "0.60732305", "0.60414016", "0.59483486", "0.59297585", "0.5928644", "0.59174573", "0.5912091", "0.5892824", "0.5847227", "0.583788", "0.5826008", "0.58244026"...
0.8134814
0
The form for making or editing a new package
def modifypackage(folder, package): form = AddPackageForm() # if it's not "add", we should try to load an existing package if package != "add": INFO_PATH = DATA + folder + "/packages/" + package + "/info.json" # try to open the file try: with open(INFO_PATH, "r") as inp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def makeform(self, error=\"\"):\n from MoinMoin.widget.dialog import Dialog\n _ = self.request.getText\n\n error = u'<p class=\"error\">%s</p>\\n' % error\n\n d = {\n 'error': error,\n 'action': self.__class__.__name__,\n 'pagename': wikiutil.escape(self...
[ "0.68534577", "0.6593105", "0.63994825", "0.61999804", "0.61159647", "0.6002441", "0.590251", "0.58948135", "0.5858313", "0.5791874", "0.57633007", "0.5749893", "0.56256306", "0.561566", "0.5553536", "0.55526215", "0.5545174", "0.5533078", "0.5514363", "0.5485054", "0.5477189...
0.68763834
0
Get the default parameters for calling OpenAI API.
def _default_params(self) -> Dict[str, Any]: normal_params = { "temperature": self.temperature, "max_tokens": self.max_tokens, "top_p": self.top_p, "frequency_penalty": self.frequency_penalty, "presence_penalty": self.presence_penalty, "n":...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _default_params(self) -> dict[str, Any]:\n return {\n \"max_tokens\": self.max_tokens,\n \"temperature\": self.temperature,\n \"top_p\": self.top_p,\n \"logprobs\": self.logprobs,\n \"echo\": self.echo,\n \"stop_sequences\": self.stop_seq...
[ "0.71612984", "0.707773", "0.69043803", "0.6872207", "0.67472076", "0.6599628", "0.6569862", "0.6552991", "0.6527479", "0.65231425", "0.6480655", "0.6475621", "0.641627", "0.6405847", "0.6369289", "0.63675296", "0.63425535", "0.6336978", "0.6334155", "0.6325188", "0.63180715"...
0.71159047
1
Get the sub prompts for llm call.
def get_sub_prompts( self, params: Dict[str, Any], prompts: List[str], stop: Optional[List[str]] = None, ) -> List[List[str]]: if stop is not None: if "stop" in params: raise ValueError("`stop` found in both the input and default params.") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lsextpool(self, args: str = \"\") -> List[str]:\n\n lsextpool_cmd = f\"{self.base_cmd} lsextpool {args}\"\n lsextpool_out = runsub.cmd(lsextpool_cmd)\n\n return lsextpool_out", "def get_prompts(self):\n if self._prompts is None:\n # Start execution to be able to get pro...
[ "0.5468637", "0.5429491", "0.5375993", "0.5307989", "0.52551895", "0.52098393", "0.51782316", "0.5167043", "0.51568854", "0.5155437", "0.51492095", "0.51247305", "0.5108709", "0.5095183", "0.50680804", "0.50588465", "0.5058681", "0.50190747", "0.50107807", "0.49788684", "0.49...
0.5452484
1
Create the LLMResult from the choices and prompts.
def create_llm_result( self, choices: Any, prompts: List[str], token_usage: Dict[str, int] ) -> LLMResult: generations = [] for i, _ in enumerate(prompts): sub_choices = choices[i * self.n : (i + 1) * self.n] generations.append( [ G...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _generate(\n self, prompts: List[str], stop: Optional[List[str]] = None\n ) -> LLMResult:\n # TODO: write a unit test for this\n params = self._invocation_params\n sub_prompts = self.get_sub_prompts(params, prompts, stop)\n choices = []\n token_usage: Dict[str, int]...
[ "0.6397324", "0.57876986", "0.54976946", "0.5190049", "0.5146507", "0.5096952", "0.5096451", "0.50889546", "0.5031042", "0.5002041", "0.49887374", "0.49850288", "0.4971008", "0.49664414", "0.49606085", "0.4919369", "0.4900151", "0.4865371", "0.48202756", "0.48174003", "0.4808...
0.8199748
0
Prepare the params for streaming.
def prep_streaming_params(self, stop: Optional[List[str]] = None) -> Dict[str, Any]: params = self._invocation_params # if params["best_of"] != 1: # raise ValueError("OpenAI only supports best_of == 1 for streaming") if stop is not None: if "stop" in params: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prepare(params, samples):\r\n return", "def _prepare_param_dict(self, params_dict):\n return params_dict", "def prepare_stream_args():\n with open(CONFIG_FILE, \"r\") as f:\n return SourceZendeskSupport.convert_config2stream_args(json.loads(f.read()))", "def init_params(self):...
[ "0.6285804", "0.6179889", "0.61766064", "0.6107633", "0.6086736", "0.6074146", "0.60659444", "0.6018273", "0.60175127", "0.59996736", "0.5936187", "0.5932782", "0.59301716", "0.5898218", "0.5865089", "0.5843671", "0.5841831", "0.5839852", "0.58366954", "0.58295035", "0.582351...
0.6642335
0
Calculate num tokens with tiktoken package.
def get_num_tokens(self, text: str) -> int: # tiktoken NOT supported for Python 3.8 or below if sys.version_info[1] <= 8: return super().get_num_tokens(text) try: import tiktoken except ImportError: raise ValueError( "Could not import t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def num_tokens(self, index):\r\n raise NotImplementedError", "def get_token_count():\r\n tokens = cache.get('tokens-number')\r\n\r\n if tokens is None:\r\n tokens = 0\r\n tweets = mongo_coll_tweets.find({}, {'text': 1})\r\n for tweet in tweets:\r\n if 'full_text' in t...
[ "0.74586385", "0.7430695", "0.73907465", "0.73281527", "0.73029184", "0.7270528", "0.71803015", "0.7110559", "0.7015355", "0.696445", "0.69527596", "0.6866695", "0.6843034", "0.6825062", "0.68032503", "0.6776779", "0.67091084", "0.670128", "0.66119254", "0.65244555", "0.65244...
0.76334184
0
Calculate the maximum number of tokens possible to generate for a prompt.
def max_tokens_for_prompt(self, prompt: str) -> int: num_tokens = self.get_num_tokens(prompt) # get max context size for model by name max_size = self.modelname_to_contextsize(self.model_name) return max_size - num_tokens
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _ensure_token_limit(self, prompt: Union[str, List[Dict[str, str]]]) -> Union[str, List[Dict[str, str]]]:\n return self.model_invocation_layer._ensure_token_limit(prompt=prompt)", "def token_length(self):\n return 32", "def length(self):\n return len(self.tokens)", "def num_tokens(self, i...
[ "0.6558024", "0.6252478", "0.6161205", "0.6102598", "0.5933351", "0.593217", "0.5908406", "0.58827394", "0.58744806", "0.5792451", "0.57583874", "0.5740858", "0.57305473", "0.568128", "0.568128", "0.5602474", "0.5593359", "0.556781", "0.55656433", "0.55546653", "0.5554541", ...
0.83333635
0
Helper method to detach a volume. Ignores 404 responses if the volume or server do not exist, or the volume is already detached from the server.
def _detach_volume(self, server, volume): try: volume = self.volumes_client.show_volume(volume['id'])['volume'] # Check the status. You can only detach an in-use volume, otherwise # the compute API will return a 400 response. if volume['status'] == 'in-use': ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def detach_volume(self):\n\n # Choose the volume\n volume_id = self._choose_among_used_volumes()\n\n # Cancel\n if not volume_id:\n print 'Operation cancelled'\n return\n\n # Detach the volume\n print '# Detaching volume \"%s\"!' % volume_id\n ...
[ "0.77605224", "0.7735926", "0.76312494", "0.7523276", "0.7514017", "0.7498628", "0.7406569", "0.7353636", "0.7299192", "0.7263973", "0.72356236", "0.7172049", "0.7163158", "0.71148235", "0.7018011", "0.6951357", "0.6935038", "0.6640765", "0.65838003", "0.65471566", "0.6521541...
0.82503486
1
Return the next `batch_size` examples from this data set. Tuples of (sample, label, sequence_length)
def next_batch(self, batch_size): start = self._index_in_epoch self._index_in_epoch += batch_size if self._index_in_epoch > self._num_examples: self._epochs_completed += 1 start = 0 self._index_in_epoch = batch_size end = self._index_in_epoch r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next(self, batch_size=np.inf):\n if self.batch_id == len(self.data):\n self.batch_id = 0\n # shuffle the data each pass over it.\n rng_state = np.random.get_state()\n np.random.shuffle(self.data)\n np.random.set_state(rng_state)\n np.rand...
[ "0.8054152", "0.8034586", "0.80246186", "0.8003304", "0.7827558", "0.7827558", "0.7813337", "0.7750487", "0.7649882", "0.7615508", "0.7542339", "0.7542001", "0.7542001", "0.74987084", "0.747032", "0.74332136", "0.74332136", "0.7395083", "0.73910135", "0.7347075", "0.7282319",...
0.8179942
0
Insert cast op and rename args of input and output.
def _insert_cast_op(block, op, idx, src_dtype, dest_dtype): num_cast_ops = 0 for in_name in op.input_names: if src_dtype == core.VarDesc.VarType.FP32 and op.type in [ 'batch_norm', 'fused_bn_add_activation', 'layer_norm', ]: if in_name not in {'X'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_cast(g, op, block):\n\n dtype = op.attr(\"out_dtype\")\n dtype = _convert_dtype_value(dtype)\n x = g.get_node(op.input(\"X\")[0])\n out = _op.cast(x, dtype=dtype)\n g.add_node(op.output(\"Out\")[0], out)", "def cast_op(input_tensor, output_dtype, op):\n in_tensor = input_tensor\n ...
[ "0.67216504", "0.66069067", "0.64513105", "0.6387404", "0.63272613", "0.6298362", "0.62975526", "0.6274401", "0.61844367", "0.6171313", "0.61684424", "0.615723", "0.6139537", "0.61372286", "0.61083025", "0.6107911", "0.6107109", "0.6102779", "0.6085921", "0.60786223", "0.6072...
0.72358775
0
Traverse all ops in the whole model and set their inputs and outputs to the bf16 data type. This function will do some special processing for the batch normalization, which will keep the batchnorm's computations in FP32.
def cast_model_to_bf16( program, startup_prog=None, amp_lists=None, use_bf16_guard=True ): if amp_lists is None: amp_lists = AutoMixedPrecisionListsBF16() global_block = program.global_block() keep_fp32_ops = set() to_bf16_var_names = set() to_bf16_pre_cast_ops = set() origin_ops = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rewrite_program_bf16(main_prog, amp_lists=None):\n if amp_lists is None:\n amp_lists = AutoMixedPrecisionListsBF16()\n block = main_prog.global_block()\n ops = block.ops\n bf16_op_set = set()\n fp32_op_set = set()\n for op in ops:\n # NOTE(zhiqiu): 'create_py_reader' and 'read' ...
[ "0.59343565", "0.5696173", "0.56877506", "0.56662005", "0.5634881", "0.5605247", "0.5547926", "0.5545048", "0.55273813", "0.55251825", "0.55021274", "0.54703397", "0.54672885", "0.5432333", "0.54186636", "0.5399988", "0.5361455", "0.5347413", "0.5339187", "0.5330843", "0.5321...
0.6544584
0
Traverse all parameters in the whole model and set them to the BF16 data type. Whereas, this function will keep parameters of batchnorms in FP32.
def cast_parameters_to_bf16(place, program, scope=None, to_bf16_var_names=None): all_parameters = [] for block in program.blocks: all_parameters.extend(block.all_parameters()) bf16_var_names = to_bf16_var_names if to_bf16_var_names else set() var_scope = scope if scope else global_scope() f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cast_model_to_bf16(\n program, startup_prog=None, amp_lists=None, use_bf16_guard=True\n):\n\n if amp_lists is None:\n amp_lists = AutoMixedPrecisionListsBF16()\n global_block = program.global_block()\n keep_fp32_ops = set()\n to_bf16_var_names = set()\n to_bf16_pre_cast_ops = set()\n ...
[ "0.60312504", "0.57601553", "0.5743127", "0.5645088", "0.55539745", "0.55119455", "0.54794186", "0.5475536", "0.5465643", "0.5441647", "0.5434912", "0.5378484", "0.5308274", "0.5288728", "0.52547413", "0.52483827", "0.52178866", "0.5213998", "0.51729196", "0.5171667", "0.5166...
0.6724887
0
Traverse all ops in current block and insert cast op according to which set current op belongs to. 1. When an op belongs to the fp32 list, add it to fp32 set 2. When an op belongs to the bf16 list, add it to bf16 set 3. When an op belongs to the gray list. If one of its inputs is the output of fp32 set op or fp32 list ...
def rewrite_program_bf16(main_prog, amp_lists=None): if amp_lists is None: amp_lists = AutoMixedPrecisionListsBF16() block = main_prog.global_block() ops = block.ops bf16_op_set = set() fp32_op_set = set() for op in ops: # NOTE(zhiqiu): 'create_py_reader' and 'read' is used in no...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _insert_cast_op(block, op, idx, src_dtype, dest_dtype):\n num_cast_ops = 0\n\n for in_name in op.input_names:\n if src_dtype == core.VarDesc.VarType.FP32 and op.type in [\n 'batch_norm',\n 'fused_bn_add_activation',\n 'layer_norm',\n ]:\n if in_na...
[ "0.5986941", "0.5345781", "0.50550604", "0.50224423", "0.49386212", "0.49130124", "0.48984283", "0.48448527", "0.4844003", "0.4807992", "0.47203198", "0.4695277", "0.46807593", "0.4680646", "0.46645293", "0.4658239", "0.46564254", "0.46249658", "0.46233487", "0.46200734", "0....
0.5659136
1
Tests the get_user_info function when the admin field is False.
def test_get_user_info_not_admin(self): cookie_value = self.get_cookie_value(EMAIL, NICKNAME, False) http_cookie = 'one=two; %s=%s; three=four' % (COOKIE_NAME, cookie_value) email, admin, user_id = login.get_user_info(http_cookie, cookie_name=COOKIE_NAME) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validateUser(self,admin):\n \n res=admin.helper.getOneUser(self.name)\n if res == False:\n return True\n else:\n return False", "def test_is_admin_user(self):\n admin = User.objects.get(email='testadminuser@test.com')\n self.assertEqual(admin.is_sta...
[ "0.6896076", "0.6887528", "0.6798139", "0.67940813", "0.6712394", "0.6679977", "0.6638127", "0.6596083", "0.6589716", "0.658818", "0.6582883", "0.6567789", "0.65620404", "0.6507496", "0.6487471", "0.6432266", "0.6428761", "0.6415647", "0.6392807", "0.6362695", "0.6350299", ...
0.70198023
0
Tests the get_user_info function when the cookie is not present.
def test_get_user_info_does_not_exist(self): http_cookie = 'one=two; three=four' email, admin, user_id = login.get_user_info(http_cookie, cookie_name=COOKIE_NAME) self.assertEqual('', email) self.assertFalse(admin)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_user_info_bad_cookie(self):\n cookie_name = 'SinaRot/g/get' # seen in the wild\n cookie_value = 'blah'\n\n http_cookie = '%s=%s' % (cookie_name, cookie_value)\n email, admin, user_id = login.get_user_info(http_cookie,\n cookie_name=cookie_nam...
[ "0.778568", "0.7594508", "0.74815637", "0.7362035", "0.71058303", "0.6611488", "0.65400225", "0.6519692", "0.63125616", "0.62384826", "0.62365174", "0.62211776", "0.6220822", "0.6138519", "0.6127081", "0.60946923", "0.6092158", "0.60266984", "0.600559", "0.60003364", "0.59825...
0.800495
0
Tests the get_user_info function when the cookie is malformed.
def test_get_user_info_bad_cookie(self): cookie_name = 'SinaRot/g/get' # seen in the wild cookie_value = 'blah' http_cookie = '%s=%s' % (cookie_name, cookie_value) email, admin, user_id = login.get_user_info(http_cookie, cookie_name=cookie_name) sel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_user_info_invalid_email(self):\n cookie_value = self.get_cookie_value('foo', NICKNAME, False)\n cookie_value = 'foo:True:%s' % USER_ID\n\n http_cookie = 'one=two; %s=%s; three=four' % (COOKIE_NAME, cookie_value)\n email, admin, user_id = login.get_user_info(http_cookie,\n ...
[ "0.7557894", "0.73333246", "0.718411", "0.7049878", "0.70026827", "0.6794958", "0.66552", "0.6526702", "0.6183039", "0.609506", "0.5989368", "0.5857151", "0.5767471", "0.5705453", "0.5697672", "0.5684999", "0.5651755", "0.56388474", "0.5612185", "0.56108147", "0.5593429", "...
0.80617523
0
Tests the set_user_info_cookie function.
def test_set_user_info_cookie(self): cookie_value = '%s:True:%s' % (EMAIL, USER_ID) expected_result = '%s="%s"; Path=/' % (COOKIE_NAME, cookie_value) result = login._set_user_info_cookie(EMAIL, True, cookie_name=COOKIE_NAME) self.assertEqual(expected_result, result)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_user_info_admin(self):\n cookie_value = self.get_cookie_value(EMAIL, NICKNAME, True)\n\n http_cookie = 'one=two; %s=%s; three=four' % (COOKIE_NAME, cookie_value)\n email, admin, _ = login.get_user_info(http_cookie,\n cookie_name=COOKIE_NAME)\n\n sel...
[ "0.7465738", "0.73171055", "0.71470404", "0.70675415", "0.70003855", "0.6837453", "0.6804365", "0.6745344", "0.66793257", "0.64978814", "0.6480554", "0.6386114", "0.62692356", "0.61945754", "0.61465645", "0.61114883", "0.60961574", "0.60338813", "0.60336995", "0.6025644", "0....
0.85541683
0
Tests the clear_user_info_cookie function.
def test_clear_user_info_cookie(self): expected_result = '%s=; Max-Age=0; Path=/' % COOKIE_NAME result = login._clear_user_info_cookie(cookie_name=COOKIE_NAME) self.assertEqual(expected_result, result)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_set_user_info_cookie(self):\n cookie_value = '%s:True:%s' % (EMAIL, USER_ID)\n expected_result = '%s=\"%s\"; Path=/' % (COOKIE_NAME, cookie_value)\n\n result = login._set_user_info_cookie(EMAIL, True, cookie_name=COOKIE_NAME)\n\n self.assertEqual(expected_result, result)", "def test_get_user...
[ "0.70172316", "0.6578652", "0.6339256", "0.62934077", "0.627828", "0.62343764", "0.6204967", "0.61942613", "0.61849505", "0.6027062", "0.6020225", "0.59772444", "0.5938291", "0.5897037", "0.5892975", "0.58435065", "0.58370316", "0.58233786", "0.5809988", "0.58092993", "0.5762...
0.8547594
0
Tests when logging out with and without continue URL.
def test_logout(self): host = 'foo.com:1234' path_info = '/_ah/login' cookie_dict = {'dev_appserver_login': '%s:False:%s' % (EMAIL, USER_ID)} action = 'Logout' set_email = '' set_admin = False continue_url = '' expected_set = login._clear_user_info_cookie().strip() # No continue UR...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_logout(self):\n\n result = self.client.get(\"/logout_process\",follow_redirects=True)\n self.assertIn(b'Login:',result.data)", "def test_logout(self):\n # Logging in voluntarily the quick way:\n resp = self.app.get('/login_handler?login=manager&password=managepass',\n ...
[ "0.7164941", "0.710064", "0.7062619", "0.698387", "0.6868517", "0.6811599", "0.66777515", "0.66603315", "0.665929", "0.66504025", "0.6647427", "0.6645609", "0.6603426", "0.66024506", "0.6600632", "0.6595756", "0.6591716", "0.6579013", "0.6575186", "0.6558428", "0.654774", "...
0.7705148
0
Return the database connection details for a vector map
def vector_db(map, **args): s = read_command('v.db.connect', quiet=True, flags='g', map=map, sep=';', **args) result = {} for l in s.splitlines(): f = l.split(';') if len(f) != 5: continue if '/' in f[0]: f1 = f[0].split('/') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vector_layer_db(map, layer):\n try:\n f = vector_db(map)[int(layer)]\n except KeyError:\n fatal(_(\"Database connection not defined for layer %s\") % layer)\n\n return f", "def get_db_info(self):\n db_info = {}\n db_info[\"Mongo Server Info\"] = self.db_cl...
[ "0.6728333", "0.6167872", "0.6140984", "0.5975545", "0.5972618", "0.5968142", "0.59272885", "0.5887671", "0.58562994", "0.57875735", "0.576466", "0.5736338", "0.56681925", "0.56378514", "0.5620944", "0.5607499", "0.56057924", "0.5583696", "0.5568372", "0.5522539", "0.5487557"...
0.73193103
0
Return the database connection details for a vector map layer. If db connection for given layer is not defined, fatal() is called.
def vector_layer_db(map, layer): try: f = vector_db(map)[int(layer)] except KeyError: fatal(_("Database connection not defined for layer %s") % layer) return f
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vector_db(map, **args):\n s = read_command('v.db.connect', quiet=True, flags='g', map=map, sep=';',\n **args)\n result = {}\n\n for l in s.splitlines():\n f = l.split(';')\n if len(f) != 5:\n continue\n\n if '/' in f[0]:\n f1 = f[0].split(...
[ "0.63650244", "0.60656923", "0.5968097", "0.5827446", "0.56253266", "0.5623336", "0.52861947", "0.5241663", "0.50769496", "0.5070063", "0.50416213", "0.5035084", "0.5033774", "0.5033768", "0.5028671", "0.5028671", "0.5005215", "0.50005823", "0.49974817", "0.4989511", "0.49801...
0.770133
0
Return a dictionary (or a list) of the columns for the database table connected to a vector map (interface to `v.info c`).
def vector_columns(map, layer=None, getDict=True, **args): s = read_command('v.info', flags='c', map=map, layer=layer, quiet=True, **args) if getDict: result = dict() else: result = list() i = 0 for line in s.splitlines(): ctype, cname = line.split('|') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vector_db_select(map, layer=1, **kwargs):\n try:\n key = vector_db(map=map)[layer]['key']\n except KeyError:\n error(_('Missing layer %(layer)d in vector map <%(map)s>') % \\\n {'layer': layer, 'map': map})\n return {'columns': [], 'values': {}}\n\n include_key = True...
[ "0.6866819", "0.68628967", "0.68555385", "0.6731974", "0.6362408", "0.63537395", "0.63537395", "0.6347482", "0.6334725", "0.6308606", "0.6261577", "0.62283343", "0.62030613", "0.61895454", "0.6096952", "0.60794806", "0.6019655", "0.6011484", "0.6011484", "0.6011484", "0.60114...
0.7809157
0
Set the command history for a vector map to the command used to invoke the script (interface to `v.support`).
def vector_history(map, replace=False): run_command('v.support', map=map, cmdhist=os.environ['CMDLINE'], flags='h' if replace else None)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def history(command):\n namespace = app.main(command)\n assert namespace.command == 'h' or namespace.command == \"history\"", "def history_save_handler(self) -> None:\n from montreal_forced_aligner.utils import get_mfa_version\n\n history_data = {\n \"command\": \" \".join(sys.argv...
[ "0.6055581", "0.5793097", "0.5436618", "0.5430122", "0.538002", "0.537816", "0.53104174", "0.5301154", "0.52810115", "0.52616614", "0.52060163", "0.518939", "0.5173294", "0.5148406", "0.51425093", "0.51333576", "0.51257485", "0.51156217", "0.510414", "0.50873554", "0.5031669"...
0.7879129
0
Return information about a vector map (interface to `v.info t`).
def vector_info_topo(map, layer=1): s = read_command('v.info', flags='t', layer=layer, map=map) ret = parse_key_val(s, val_type=int) if 'map3d' in ret: ret['map3d'] = bool(ret['map3d']) return ret
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vector_info(map, layer=1):\n\n s = read_command('v.info', flags='get', layer=layer, map=map)\n\n kv = parse_key_val(s)\n for k in ['north', 'south', 'east', 'west', 'top', 'bottom']:\n kv[k] = float(kv[k])\n for k in ['level', 'num_dblinks']:\n kv[k] = int(kv[k])\n for k in ['nodes...
[ "0.84344417", "0.690896", "0.5936289", "0.5867027", "0.5699102", "0.5468153", "0.5444948", "0.5421548", "0.539735", "0.53934944", "0.535143", "0.53453827", "0.53377384", "0.53242826", "0.5301765", "0.5275477", "0.5275477", "0.52589434", "0.52558213", "0.523169", "0.52302694",...
0.7991985
1
Return information about a vector map (interface to
def vector_info(map, layer=1): s = read_command('v.info', flags='get', layer=layer, map=map) kv = parse_key_val(s) for k in ['north', 'south', 'east', 'west', 'top', 'bottom']: kv[k] = float(kv[k]) for k in ['level', 'num_dblinks']: kv[k] = int(kv[k]) for k in ['nodes', 'points', '...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vector_info_topo(map, layer=1):\n s = read_command('v.info', flags='t', layer=layer, map=map)\n ret = parse_key_val(s, val_type=int)\n if 'map3d' in ret:\n ret['map3d'] = bool(ret['map3d'])\n\n return ret", "def vector_columns(map, layer=None, getDict=True, **args):\n s = read_command('...
[ "0.72805065", "0.70105565", "0.6274218", "0.61559004", "0.61559004", "0.6129509", "0.5764387", "0.57279146", "0.55868554", "0.5581735", "0.55444247", "0.554363", "0.5542295", "0.5481654", "0.54465663", "0.5442275", "0.54209965", "0.5419874", "0.5405915", "0.5405482", "0.54010...
0.7856227
0
Get attribute data of selected vector map layer. Function returns list of columns and dictionary of values ordered by
def vector_db_select(map, layer=1, **kwargs): try: key = vector_db(map=map)[layer]['key'] except KeyError: error(_('Missing layer %(layer)d in vector map <%(map)s>') % \ {'layer': layer, 'map': map}) return {'columns': [], 'values': {}} include_key = True if 'colum...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vector_columns(map, layer=None, getDict=True, **args):\n s = read_command('v.info', flags='c', map=map, layer=layer, quiet=True,\n **args)\n if getDict:\n result = dict()\n else:\n result = list()\n i = 0\n for line in s.splitlines():\n ctype, cname = lin...
[ "0.70887035", "0.6079504", "0.5681097", "0.5672406", "0.56585836", "0.56253177", "0.56170803", "0.56136495", "0.5545272", "0.5528222", "0.5503018", "0.54790473", "0.5456059", "0.5455243", "0.5455243", "0.5452499", "0.5441699", "0.54203355", "0.541309", "0.5404888", "0.5388636...
0.61481166
1
Returns boolean value indicating whether worker is qualified or not.
def check_worker_qualified(conn, workerId): query = "SELECT qualified FROM workers WHERE worker_id = '{}'".format(workerId) result = conn.execute(query).fetchall() return (len(result) != 0) and bool(result[0][0])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_worker_thread():\n try:\n return worker_thread_data.is_worker_thread\n except AttributeError:\n return False", "def _is_working():\n global _worker\n return _worker is not None and _worker.is_alive()", "def _in_multi_worker_mode(self):\n return False", "def enabled(self) -...
[ "0.681578", "0.68015456", "0.6114835", "0.6076708", "0.6049261", "0.60308766", "0.60308766", "0.60308766", "0.5960439", "0.58858544", "0.58520836", "0.5835419", "0.5825732", "0.5807578", "0.5696778", "0.5655905", "0.5597184", "0.5589834", "0.55825716", "0.55738634", "0.553469...
0.78638095
0
Adds new worker to SQL db. Returns true if done successfully.
def add_new_worker(conn, workerId): query = "INSERT INTO workers VALUES('{}', 0)".format(workerId) conn.execute(query) conn.commit() return True;
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ensure_worker_exists(self, worker_id: str) -> None:\n with self.table_access_condition:\n conn = self._get_connection()\n c = conn.cursor()\n c.execute(\n \"\"\"\n INSERT OR IGNORE INTO workers(\n worker_id,\n ...
[ "0.6600049", "0.6558536", "0.6125583", "0.59552467", "0.58621776", "0.5689361", "0.5667357", "0.5608594", "0.54899776", "0.5477754", "0.5475615", "0.5475214", "0.54091495", "0.5393265", "0.53846884", "0.53792304", "0.53704506", "0.53600335", "0.53595126", "0.53384167", "0.530...
0.7815695
0
Given a worker ID, returns the list of complete videos.
def completed_video_ids(conn, workerId): query = "SELECT video_id FROM completed_tasks WHERE worker_id = '{}'".format(workerId) return [idx[0] for idx in conn.execute(query).fetchall()]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetch_videos():\n channels = get_channels_from_file()\n\n channels_request = service.channels().list(\n part='id, contentDetails',\n forUsername=channels[0]['channelUsername'] # first channel for now\n )\n\n video_list = []\n\n channels_response = channels_request.execute()\n f...
[ "0.64324135", "0.6404538", "0.63301456", "0.62131315", "0.62121916", "0.62092173", "0.6180134", "0.6140385", "0.6056108", "0.599062", "0.59834105", "0.59540695", "0.5953698", "0.5905531", "0.58825696", "0.58664787", "0.5861952", "0.5811146", "0.5762809", "0.5732411", "0.57311...
0.75101554
0
Returns the (videoId, videoURL, validation) tupple of next video to watch. ID should be a validation ID if in validation stage.
def get_next_video(conn, workerId): if not is_returning_worker(conn, workerId): print("NEW USER!! Inserting...") add_new_worker(conn, workerId) query = """ SELECT a.video_id as 'video_id', b.video_url as 'video_url', b.validation as 'validation' FROM comp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_yt_link_by_id(video_id):\n info = InnerTube().player(video_id)\n det = info.get(\"videoDetails\", None)\n title = det.get(\"title\", None) if det else None\n streaming_data = info.get(\"streamingData\", None)\n fmts = streaming_data.get(\"formats\", None) if streaming_dat...
[ "0.6004582", "0.59744906", "0.5914354", "0.57522917", "0.57521725", "0.57287997", "0.5725258", "0.5690348", "0.5616249", "0.56080306", "0.5565972", "0.5512131", "0.5492475", "0.5487603", "0.54622173", "0.54593164", "0.54349834", "0.539288", "0.53913605", "0.5386695", "0.53842...
0.6418092
0
Fixes UserProfile objects that incorrectly had a bot_owner set
def migrate_fix_invalid_bot_owner_values( apps: StateApps, schema_editor: BaseDatabaseSchemaEditor ) -> None: UserProfile = apps.get_model("zerver", "UserProfile") UserProfile.objects.filter(is_bot=False).exclude(bot_owner=None).update(bot_owner=None)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_change_profile_changes_user(self):\n user = self.users[0]\n user.username = 'newname'\n profile = user.profile\n user.profile.save()\n self.assertEquals(user.username, profile.user.username)", "def test_replace_user(self):\n pass", "def test_change_username_ch...
[ "0.575531", "0.5695581", "0.5573173", "0.5493372", "0.544834", "0.54394704", "0.5421058", "0.53760815", "0.53622055", "0.5342337", "0.5339565", "0.52951276", "0.5291878", "0.5287942", "0.5251818", "0.52509475", "0.5244521", "0.5237462", "0.52357984", "0.5221591", "0.52181053"...
0.81626135
0
Returns true if all the characters of plaintext are ASCII compliant (ie are in the ASCII table).
def check_ascii_compliance(plaintext: bytes) -> bool: return all(c < 128 for c in plaintext)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_ascii_chars(text):\n is_ascii = True\n try:\n text.encode(encoding='utf-8').decode('ascii')\n except UnicodeDecodeError:\n is_ascii = False\n return is_ascii", "def is_ascii(token):\n\n printable = set(string.printable)\n\n for char in token:\n if char not in printab...
[ "0.7351027", "0.7327451", "0.7245277", "0.7204565", "0.7204565", "0.71251774", "0.70652556", "0.6871941", "0.671387", "0.6627192", "0.6606743", "0.65446645", "0.6458096", "0.6426706", "0.64079714", "0.6195913", "0.6182703", "0.61412185", "0.6124865", "0.6106221", "0.60982805"...
0.83825934
0
Decrypts the ciphertext via AES CBC Mode and checks if all characters are ASCII.
def decryptor(byte_string: bytes, IV: bytes, key: bytes) -> bool: decrypted_string = AES_CBC_decrypt(byte_string, IV, key) print(len(decrypted_string), decrypted_string) if not check_ascii_compliance(decrypted_string): raise Exception(decrypted_string)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decrypt_cbc(key, ciphertext):\n\tmessage = ''\n\tfor i in range(0, len(ciphertext)/16 - 1):\n\t\tiv = ciphertext[i*16:(i+1)*16]\n\t\tinputblock = ciphertext[(i+1)*16:(i+2)*16]\n\t\tcipher = AES.new(key, AES.MODE_CBC, iv)\n\t\tmessage +=cipher.decrypt(inputblock)\n\tif ord(message[-1]) <=16:\n\t\tmessage = mess...
[ "0.7099032", "0.69915605", "0.6912133", "0.69060373", "0.6869057", "0.681659", "0.6808399", "0.6776291", "0.6741373", "0.65237653", "0.6506243", "0.6500546", "0.6469134", "0.6443094", "0.6436065", "0.64310837", "0.6304923", "0.628039", "0.6278703", "0.6277368", "0.62605304", ...
0.7573102
0
Initialize 'ref' with all zeros, ref tensor should be uninitialized. If already initialized, you will get ValueError. This op is intended to save memory during initialization.
def zero_initializer(ref, use_locking=True, name="zero_initializer"): loader.load_op_library( resource_loader.get_path_to_datafile("_variable_ops.so")) return gen_variable_ops.zero_initializer(ref, name=name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def DefaultValue(self):\n return tf.zeros(self.shape, dtype=self.dtype)", "def DefaultValue(self):\n return tf.zeros(self.shape, dtype=self.dtype)", "def resetDataRef(self, is_train):\n self.data_ref = 0", "def test_set_mat_to_zero(self):\n self.init()\n set_to_zero_by_ref(self.ff6...
[ "0.59268457", "0.59268457", "0.5816813", "0.565309", "0.5617504", "0.55825675", "0.55707854", "0.5561487", "0.5524925", "0.54330224", "0.54095167", "0.5403954", "0.54024076", "0.5357347", "0.53501093", "0.53265244", "0.52999145", "0.5279869", "0.5273931", "0.5263101", "0.5246...
0.6309964
0
Verifies that a global step tensor is valid or gets one if None is given. If `global_step_tensor` is not None, check that it is a valid global step tensor (using `assert_global_step`). Otherwise find a global step tensor using `get_global_step` and return it.
def assert_or_get_global_step(graph=None, global_step_tensor=None): if global_step_tensor is None: # Get the global step tensor the same way the supervisor would. global_step_tensor = get_global_step(graph) else: assert_global_step(global_step_tensor) return global_step_tensor
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_or_create_global_step(graph=None):\n return training_util.get_or_create_global_step(graph)", "def setup_global_step(self):\n\t\tglobal_step = tf.Variable(\n\t\t\t\tinitial_value=0,\n\t\t\t\tname=\"global_step\",\n\t\t\t\ttrainable=False,\n\t\t\t\tcollections=[tf.GraphKeys.GLOBAL_STEP, tf.GraphKeys.GLOBA...
[ "0.62051755", "0.5995752", "0.59815496", "0.5945893", "0.5860798", "0.54220504", "0.5386554", "0.5344831", "0.52651757", "0.52639997", "0.52639997", "0.5098114", "0.50768673", "0.5062724", "0.4836744", "0.48171672", "0.47616675", "0.46459627", "0.4614636", "0.4590887", "0.452...
0.86099654
0
Create global step tensor in graph. This API is deprecated. Use core framework training version instead.
def create_global_step(graph=None): return training_util.create_global_step(graph)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_global_step(self):\n self.global_step = tf.train.get_or_create_global_step()", "def build_global_step(self):\n self.global_step = tf.contrib.framework.create_global_step()", "def _create_global_step(self, graph):\n return _create_global_step(graph)", "def setup_global_step(self):\n glob...
[ "0.8028369", "0.7957682", "0.7794688", "0.7721747", "0.7471551", "0.7460138", "0.72171533", "0.6547985", "0.6352512", "0.6260544", "0.6236476", "0.6165788", "0.6086418", "0.604183", "0.60279", "0.6023157", "0.5987593", "0.59641963", "0.5963719", "0.59503496", "0.5949343", "...
0.8196353
0
Create a variable with a value and add it to `GraphKeys.LOCAL_VARIABLES`.
def local_variable(initial_value, validate_shape=True, name=None, use_resource=None): return variable_scope.variable( initial_value, trainable=False, collections=[ops.GraphKeys.LOCAL_VARIABLES], validate_shape=validate_shape, use_resourc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_embedding_variable(self, name, initial_value):\n if name not in self._tls._embed_variables:\n embed_var = tf.Variable(\n initial_value,\n name=name + str(threading.get_ident()),\n shape=(None, None),\n dtype=tf.float32,\n ...
[ "0.6494083", "0.6411489", "0.64073545", "0.63730663", "0.6278127", "0.62588215", "0.6255319", "0.62234885", "0.6126168", "0.6126168", "0.6119956", "0.61105245", "0.60072553", "0.5958282", "0.5918667", "0.5897518", "0.5867681", "0.57880676", "0.57880676", "0.5781109", "0.57636...
0.66381794
0
Create a variable with a value and add it to `GraphKeys.GLOBAL_VARIABLES`.
def global_variable(initial_value, validate_shape=True, name=None, use_resource=None): return variable_scope.variable( initial_value, trainable=False, collections=[ops.GraphKeys.GLOBAL_VARIABLES], validate_shape=validate_shape, use_re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def emit_global_variable(self, name, binding, typ, ivalue):\n size, alignment = self.data_layout(typ)\n ir_var = ir.Variable(name, binding, size, alignment, value=ivalue)\n self.builder.module.add_variable(ir_var)\n return ir_var", "def addVariable(self, name, value, save = False):\r\...
[ "0.6742282", "0.6631009", "0.66254735", "0.6590293", "0.65760887", "0.6527663", "0.6456853", "0.6455515", "0.6336512", "0.63278055", "0.6323061", "0.63203585", "0.62595564", "0.6205533", "0.61972564", "0.618037", "0.6172824", "0.61355054", "0.60625285", "0.6054448", "0.601123...
0.7206453
0
Adds a variable to the `GraphKeys.MODEL_VARIABLES` collection.
def add_model_variable(var): if var not in ops.get_collection(ops.GraphKeys.MODEL_VARIABLES): ops.add_to_collection(ops.GraphKeys.MODEL_VARIABLES, var)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_variable(self, name, var):\n self.variables.append(_3ds_named_variable(name, var))", "def add_variable(self, name, var):\n self.variables.append(_3ds_named_variable(name, var))", "def add_variable(self, variable):\n self.variables.append(variable)", "def add_variable(self, var):\...
[ "0.6889913", "0.6889913", "0.67037183", "0.67030597", "0.667306", "0.66068846", "0.64225525", "0.6380908", "0.6310279", "0.6283835", "0.62624043", "0.6235285", "0.6161782", "0.60932153", "0.6046209", "0.59172356", "0.58616495", "0.58549076", "0.58199143", "0.5705129", "0.5675...
0.83408505
0
Gets the list of variables, filtered by scope and/or suffix.
def get_variables(scope=None, suffix=None, collection=ops.GraphKeys.GLOBAL_VARIABLES): if isinstance(scope, variable_scope.VariableScope): scope = scope.name if suffix is not None: if ':' not in suffix: suffix += ':' scope = (scope or '') + '.*' + suffix return ops.get_collecti...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_variables_by_suffix(suffix, scope=None):\n return get_variables(scope=scope, suffix=suffix)", "def vars(self, scope: str = '') -> VarCollection:\n return self.__wrapped__.vars(scope=scope)", "def get_vars_by_prefix(self, prefix):\n\n t_vars = tf.global_variables()\n return [var fo...
[ "0.7807971", "0.7135843", "0.7124688", "0.7069396", "0.7029748", "0.68707967", "0.6811423", "0.6780924", "0.67694354", "0.6661847", "0.6593601", "0.65763617", "0.64618665", "0.64023626", "0.6369196", "0.6364975", "0.6359857", "0.6333704", "0.63267547", "0.63213676", "0.630687...
0.7720821
1
Gets the list of model variables, filtered by scope and/or suffix.
def get_model_variables(scope=None, suffix=None): return get_variables(scope, suffix, ops.GraphKeys.MODEL_VARIABLES)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_vars(scope=''):\n return [x for x in tf.trainable_variables() if scope in x.name]", "def get_variables_by_suffix(suffix, scope=None):\n return get_variables(scope=scope, suffix=suffix)", "def get_variables(scope=None, suffix=None,\n collection=ops.GraphKeys.GLOBAL_VARIABLES):\n if i...
[ "0.7322999", "0.7263353", "0.7148944", "0.6973614", "0.68849725", "0.68298435", "0.6811995", "0.67827094", "0.67236155", "0.6673829", "0.66443145", "0.64663595", "0.64436364", "0.6428099", "0.6425308", "0.6422452", "0.64095706", "0.63515556", "0.6343175", "0.63409114", "0.633...
0.7651817
0
Gets the list of local variables, filtered by scope and/or suffix.
def get_local_variables(scope=None, suffix=None): return get_variables(scope, suffix, ops.GraphKeys.LOCAL_VARIABLES)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_vars(scope=''):\n return [x for x in tf.trainable_variables() if scope in x.name]", "def get_variables(scope=None, suffix=None,\n collection=ops.GraphKeys.GLOBAL_VARIABLES):\n if isinstance(scope, variable_scope.VariableScope):\n scope = scope.name\n if suffix is not None:\n if ...
[ "0.6875429", "0.6824919", "0.67630106", "0.66059744", "0.65536577", "0.6468472", "0.6430241", "0.6300913", "0.62455904", "0.62303483", "0.61487556", "0.61461043", "0.6144172", "0.61348397", "0.6104915", "0.6091263", "0.608885", "0.6044582", "0.60349077", "0.6014716", "0.60085...
0.7953546
0
Gets the list of trainable variables, filtered by scope and/or suffix.
def get_trainable_variables(scope=None, suffix=None): return get_variables(scope, suffix, ops.GraphKeys.TRAINABLE_VARIABLES)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_vars(scope=''):\n return [x for x in tf.trainable_variables() if scope in x.name]", "def _get_variables_to_train():\n if FLAGS.trainable_scopes is None:\n return tf.trainable_variables()\n else:\n scopes = [scope.strip() for scope in FLAGS.trainable_scopes.split(',')]\n\n variables_to_train = [...
[ "0.78808016", "0.75817424", "0.7568647", "0.75665385", "0.75665385", "0.73803556", "0.73149925", "0.7256115", "0.72557074", "0.7138855", "0.7028941", "0.69406384", "0.6830125", "0.6721636", "0.66265166", "0.66203827", "0.6610239", "0.6607596", "0.65703636", "0.64747226", "0.6...
0.8058095
0
Gets the list of variables that end with the given suffix.
def get_variables_by_suffix(suffix, scope=None): return get_variables(scope=scope, suffix=suffix)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_files(suffix):\n lst = os.listdir(\".\")\n return filter(lambda x: x.endswith(suffix), lst)", "def suffix(self):\n return self[\"suffix\"]", "def suffix(self):\n return self[\"suffix\"]", "def ends_with(strn, suffix):\n return strn.endswith(suffix)", "def get_variables(scope=...
[ "0.57985854", "0.5758867", "0.5758867", "0.5738691", "0.57285994", "0.57257175", "0.5674938", "0.56073433", "0.55960876", "0.5585065", "0.5577938", "0.55548906", "0.5553235", "0.5546447", "0.55234176", "0.5510119", "0.5484863", "0.5478595", "0.54667115", "0.5464406", "0.53634...
0.7658006
0
Gets the variable uniquely identified by that var_op_name.
def get_unique_variable(var_op_name): candidates = get_variables(scope=var_op_name) if not candidates: raise ValueError('Couldn\'t find variable %s' % var_op_name) for candidate in candidates: if candidate.op.name == var_op_name: return candidate raise ValueError('Variable %s does not uniquely id...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_variable_full_name(var):\n if var._save_slice_info:\n return var._save_slice_info.full_name\n else:\n return var.op.name", "def getVariable(self, varName):\n return self[varName]", "def get_variable(self, variable_name):\n with self._graph.as_default():\n return self._sess.run(se...
[ "0.69655627", "0.69297177", "0.6911601", "0.6757873", "0.6693021", "0.6597839", "0.65952724", "0.65255713", "0.6506564", "0.64767635", "0.6471176", "0.64057124", "0.6334545", "0.6314667", "0.6314667", "0.6314667", "0.6268666", "0.6260737", "0.62277144", "0.6216826", "0.618533...
0.86668247
0
Returns a function that assigns specific variables from the given values. This function provides a mechanism for performing assignment of variables to values in a way that does not fill the graph with large assignment values.
def assign_from_values_fn(var_names_to_values): assign_op, feed_dict = assign_from_values(var_names_to_values) def callback(session): return session.run(assign_op, feed_dict) return callback
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assign_from_values(var_names_to_values):\n feed_dict = {}\n assign_ops = []\n\n for var_name in var_names_to_values:\n var_value = var_names_to_values[var_name]\n var = ops.get_collection(ops.GraphKeys.GLOBAL_VARIABLES, var_name)\n if not var:\n raise ValueError('Variable %s wasn\\'t found' % ...
[ "0.73443466", "0.6365359", "0.6179025", "0.6154356", "0.5936981", "0.59304094", "0.58964217", "0.5821731", "0.5743009", "0.57262677", "0.5716132", "0.5709189", "0.5613906", "0.5570331", "0.5526211", "0.5515063", "0.54958785", "0.54799235", "0.5431684", "0.5413729", "0.5406247...
0.8058195
0
Returns the full name of a variable. For normal Variables, this is the same as the var.op.name. For sliced or PartitionedVariables, this name is the same for all the slices/partitions. In both cases, this is normally the name used in a checkpoint file.
def get_variable_full_name(var): if var._save_slice_info: return var._save_slice_info.full_name else: return var.op.name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name(self):\n return '{} {} {}'.format(self.var_period, self.var_type,\n self.var_detail)", "def labelit(self, varname):\n \n if not varname:\n return \"\"\n return self.vardict[varname].VariableLabel or varname", "def get_variable_name...
[ "0.76107323", "0.6607253", "0.6521163", "0.65070003", "0.63736784", "0.6300248", "0.6267636", "0.6220207", "0.6217287", "0.6146693", "0.6146177", "0.6087799", "0.60862386", "0.6077998", "0.6058842", "0.6058842", "0.6058842", "0.6009955", "0.597595", "0.59660846", "0.5939349",...
0.8665525
0