query
stringlengths
10
2k
document
stringlengths
20
51.2k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Parses a filename as JSON input if defined
def _opt_json_file(filename): if filename: return json.load(argparse.FileType('r')(filename))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_json_format(file_path=None):\n is_file_res = check_is_file(file_path)\n if is_file_res['result']:\n with open(file_path) as f:\n if f.readline().strip().startswith('['):\n return generate_response(result='jsonl')\n return generate_response(result='json')\...
[ "0.7190588", "0.7058445", "0.6981694", "0.6922724", "0.68893164", "0.68880457", "0.6873549", "0.6856333", "0.6842093", "0.68391657", "0.6836407", "0.6825383", "0.68027085", "0.68027085", "0.6798139", "0.67974734", "0.67851484", "0.6778595", "0.6724558", "0.6724558", "0.672242...
0.7366011
0
Give the corresponding logging level.
def python_logging_level(self) -> int: return LOG_LEVEL_LEVELNOS[self]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_logging_level(self, level):\n if str(level) == '1':\n self.logging_level = logging.DEBUG\n elif str(level) == '2':\n self.logging_level = logging.INFO\n elif str(level) == '3':\n self.logging_level = logging.WARNING\n elif str(level) == '4':\n ...
[ "0.7845966", "0.7598013", "0.7552829", "0.75023395", "0.74545974", "0.7323541", "0.73147726", "0.7282415", "0.7210917", "0.71825945", "0.7182565", "0.71802825", "0.7166571", "0.71509683", "0.7149153", "0.7148295", "0.7096045", "0.7071683", "0.707", "0.7058769", "0.70473856", ...
0.7274602
8
Given a Python logging level, return a LogLevel.
def from_python_logging_level(cls, levelno: int) -> LogLevel: return LEVELNO_LOG_LEVELS[levelno]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _level(self, level):\r\n\r\n level_t = type(level)\r\n if level_t == int: return level\r\n if level == None: return level\r\n if level == \"SILENT\": return log.SILENT\r\n if hasattr(logging, \"_checkLevel\"):\r\n return logging._checkLevel(level)\r\n return...
[ "0.77111614", "0.7692279", "0.7558193", "0.749243", "0.740236", "0.7353849", "0.7348146", "0.729589", "0.724141", "0.69670093", "0.68330157", "0.67956847", "0.6749456", "0.6689545", "0.6676535", "0.666777", "0.66674024", "0.6664883", "0.66346383", "0.6624134", "0.6589808", ...
0.7720952
0
Verify that the cache control headers are present on API responses.
def test_cache_control_headers_on_apis(flask_app): rv = flask_app.get('api/v1/') headers = rv.headers assert headers.get('Cache-Control') == 'no-cache, no-store, must-revalidate, max-age=0' assert headers.get('Pragma') == 'no-cache'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_not_modified_headers(self):\n\n def get_response(req):\n resp = self.client.get(req.path_info)\n resp[\"Date\"] = \"Sat, 12 Feb 2011 17:35:44 GMT\"\n resp[\"Last-Modified\"] = \"Sat, 12 Feb 2011 17:35:44 GMT\"\n resp[\"Expires\"] = \"Sun, 13 Feb 2011 17:3...
[ "0.6885791", "0.6595886", "0.65348315", "0.6520465", "0.65036803", "0.6495498", "0.6412265", "0.6411063", "0.6411063", "0.6404717", "0.6350422", "0.63402855", "0.6335022", "0.6328439", "0.62628126", "0.6172767", "0.6160368", "0.6087549", "0.6071685", "0.60676056", "0.60676056...
0.7650483
0
Returns True if will increase its population due to growth this turn. Emphasize No Growth must be off for the city, and its food rate plus storage must reach the growth threshold.
def willGrowThisTurn(city): if city.getFood() + city.foodDifference(True) < city.growthThreshold(): return False return not avoidingGrowth(city) # advc: Don't hardcode emphasize id 5
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def willShrinkThisTurn(city):\n\treturn city.getPopulation() > 1 and city.getFood() + city.foodDifference(True) < 0", "def forage(self):\n if self._energy < self._forage_cost:\n return\n\n cell = self._env.get_cell(self._i, self._j)\n if cell.get_newly() > 0:\n cell.sto...
[ "0.6702547", "0.59477", "0.5925461", "0.5861566", "0.5825342", "0.580091", "0.5793314", "0.57741785", "0.5763016", "0.5744566", "0.57377255", "0.5709721", "0.5659166", "0.5632455", "0.5590818", "0.5559872", "0.55541503", "0.5532391", "0.552273", "0.5463308", "0.54612565", "...
0.7715431
0
Returns True if will decrease its population due to starvation this turn. It must have at least two population, and its food rate plus storage must be negative.
def willShrinkThisTurn(city): return city.getPopulation() > 1 and city.getFood() + city.foodDifference(True) < 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def starve(self):\n # maybe push condition to caller\n if self.food.get() < self.population.get(): \n self.population.set(self.food.get())\n if self.population.get() <= 0:\n self.die()", "def spendFuelToSurvive(self):\n fuelNeeded = self.getLightUpkeep()\n ...
[ "0.6977275", "0.6079694", "0.6018382", "0.59834313", "0.59466046", "0.5864266", "0.5752883", "0.5751008", "0.57310224", "0.57294136", "0.5712498", "0.5675734", "0.56734043", "0.566928", "0.5651869", "0.563425", "0.56197655", "0.5619209", "0.55592465", "0.55406314", "0.5507202...
0.6292981
1
Construct a new status wrapper. Any message fields that are implicitly/explicitly set to None will be assigned a default value. The recommend use is keyword arguments as this is more robust to future message changes. You cannot mix inorder arguments and keyword arguments.
def __init__(self, *args, **kwds): DiagnosticStatus.__init__(self, *args, **kwds)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args, **kwds):\n if args or kwds:\n super(LIMITS_STATUS, self).__init__(*args, **kwds)\n #message fields cannot be None, assign default values for those that are\n if self.sysid is None:\n self.sysid = 0\n if self.compid is None:\n self.compid = 0\n if ...
[ "0.684265", "0.65814245", "0.6480022", "0.6423024", "0.6360247", "0.6255045", "0.62451994", "0.62273735", "0.6145772", "0.6142561", "0.61339164", "0.6118723", "0.610914", "0.60687244", "0.6057446", "0.6039682", "0.6033274", "0.5999025", "0.59855646", "0.5964455", "0.5934977",...
0.56906265
43
Return the state that results from executing the given action in the given state. The action must be one of self.actions(state).
def result(self, state, action): (i,j,k) = action res = [[0 for a in range(size)] for b in range(size)] for a in range(size): for b in range(size): res[a][b] = state[a][b] res[i][j] = k #ppSudokuMat(state) return res
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def result(self, state, action):\n return self.actions(state)\n\n raise NotImplementedError", "def get_action(self, state):\n assert np.shape(state) == (self._state_dim,)\n\n ### PROBLEM 2\n ### YOUR CODE HERE\n # raise NotImplementedError\n best_action = self._se...
[ "0.7369812", "0.7348725", "0.73350006", "0.71478784", "0.7146907", "0.71056104", "0.71002215", "0.7076511", "0.7066087", "0.7032321", "0.701135", "0.6993305", "0.6951506", "0.6951506", "0.69442964", "0.69377923", "0.69179934", "0.68960506", "0.6882755", "0.68595606", "0.68593...
0.0
-1
Helper for returning distance to goal.
def goalDiff(state): xdiff = state.goalX - state.posX ydiff = state.goalY - state.posY return (xdiff, ydiff)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def heuristic(current, goal):\r\n distance = getDistance(current, goal)\r\n return distance", "def heuristic(current, goal):\r\n\r\n return Vector2.fromCell(current).distanceTo(Vector2.fromCell(goal))", "def heuristic(current, goal):\r\n # First tried manhattan distance but wasn't good enough so di...
[ "0.7783541", "0.74132764", "0.7288889", "0.7231355", "0.70529634", "0.7025223", "0.7009095", "0.7001289", "0.6997794", "0.68776804", "0.6870852", "0.68436265", "0.6817217", "0.68031317", "0.6795243", "0.67868495", "0.6752016", "0.6713067", "0.6695165", "0.6677795", "0.6647956...
0.0
-1
Initializes the belief uniformly.
def _init_belief(self): belief = [] for i in range(self._num_goals): belief.append(1.0 / self._num_goals) self._last_belief_over_history = np.copy(belief) return belief
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def HELPER_init_belief(self):\n return util.initBelief(self.num_answer_choices, self.num_difficulty_bins)", "def init_weights(self) -> None:\n self.fc.bias.data.fill_(0)\n self.fc.weight.data.uniform_(-0.1, 0.1)", "def init_bn(bn):\n bn.bias.data.fill_(0.0)\n bn.weight.data.fill_(1.0...
[ "0.7228302", "0.7071791", "0.706506", "0.7001467", "0.7001467", "0.7001467", "0.6985747", "0.6882064", "0.6749407", "0.6706279", "0.6706279", "0.66864306", "0.66864306", "0.66864306", "0.6586147", "0.65196776", "0.6393212", "0.6341668", "0.6327737", "0.6303675", "0.6293543", ...
0.6726458
9
Gets the rm at which potential energy is minimized.
def get_min_rm(distance_file, rm_range, step_size, potential_function): return min((i[1],i[0]) for i in vary_across_rm(distance_file, rm_range, step_size, potential_function))[1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_minerror(self):\n\n return self.sigma_w - self.rsq_y", "def get_rm(self):\n if isinstance(self.value, list):\n return [np.sqrt(x+self.epsilon) for x in self.value]\n else:\n return np.sqrt(self.value + self.epsilon)", "def rmin(self) -> float:\n return ...
[ "0.64892364", "0.62648654", "0.6134338", "0.61149186", "0.61000466", "0.6090825", "0.60301477", "0.5950917", "0.5930887", "0.5897609", "0.58279794", "0.5826735", "0.58164823", "0.58157897", "0.58122784", "0.58122784", "0.57988274", "0.57645017", "0.5762818", "0.57538426", "0....
0.6008481
7
This function returns the coordinates of cells in this board
def cell_list(self): lst_of_idx = [] height = self.__height width = self.__width for i in range(width): for j in range(height): lst_of_idx.append((i,j)) lst_of_idx.append((3,7)) return lst_of_idx
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getCellpos(self, event):\n e = event.widget\n cx, cy = cart(e.canvasx(event.x), e.canvasy(event.y))\n cellx = int(cx) // self.cell_width\n celly = int(cy) // self.cell_height\n return cellx, celly", "def cells(self):\n \"\"\"\n Note that we use the convent...
[ "0.7689818", "0.7660733", "0.7648026", "0.7507228", "0.74988246", "0.74943453", "0.7492628", "0.7356236", "0.72789025", "0.72179455", "0.7211815", "0.7189287", "0.70929384", "0.70033747", "0.69757473", "0.6963083", "0.695712", "0.69227946", "0.69225657", "0.6897904", "0.68745...
0.70812225
13
goes thru, and splits them up first based upon control.sortedopers and then by control.punctuation.
def tokenize(self, rawt): def createtokens(rawt): for oper in self.control.sortedopers: if oper in rawt: par = rawt.partition(oper) return createtokens(par[0]) + [par[1]] + createtokens(par[2]) for punc in se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _run_split_on_punc(self, text):\n chars = list(text)\n i = 0\n start_new_word = True\n output = []\n while i < len(chars):\n char = chars[i]\n if _is_punctuation(char):\n output.append([char])\n start_new_word = True\n ...
[ "0.6949754", "0.6949754", "0.67116207", "0.64471555", "0.6245651", "0.6156375", "0.60209125", "0.5910002", "0.5891079", "0.5885574", "0.58683366", "0.58606374", "0.5760105", "0.57302904", "0.572807", "0.5694573", "0.5687017", "0.5656508", "0.56277657", "0.5582149", "0.5578604...
0.64774764
3
Forward an image `x` through the network and return the asked output features.
def forward(self, x, out_feat_keys=None): out_feat_keys, max_out_feat = self._parse_out_keys_arg(out_feat_keys) out_feats = [None] * len(out_feat_keys) feat = x for f in range(max_out_feat + 1): feat = self._feature_blocks[f](feat) key = self.all_feat_names[f] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forward(self, x):\n out = self.features(x)\n out = self.avgpool(out)\n out = torch.flatten(out, 1)\n out = self.classifier(out)\n return out", "def forward(self, x):\n out = self.features(x)\n out = self.avgpool(out)\n out = torch.flatten(out, 1)\n ...
[ "0.79543626", "0.79543626", "0.7921048", "0.7826605", "0.7826605", "0.78036726", "0.7754568", "0.7752055", "0.7681245", "0.7667731", "0.76606286", "0.7658891", "0.7651967", "0.7639721", "0.76221377", "0.7604389", "0.7601088", "0.75286305", "0.7448573", "0.74120766", "0.739286...
0.6949278
85
Get character based on obtained probabilities
def get_top_char(probas, char_size, top_n=5): p = np.squeeze(probas) p[np.argsort(p)[:-top_n]] = 0.0 p = p / np.sum(p) ch_id = np.random.choice(char_size, 1, p=p)[0] return ch_id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def characters(probabilities):\n # argmax for the most likely character\n return [id2char(c) for c in np.argmax(probabilities, 1)]", "def characters(probabilities):\n return [id2char(c) for c in np.argmax(probabilities, 1)]", "def characters(probabilities):\n return [id2char(c) for c in np.argmax(p...
[ "0.77240396", "0.77090925", "0.77090925", "0.69370705", "0.6716226", "0.6506996", "0.6454763", "0.63475823", "0.6252956", "0.6195221", "0.616316", "0.6152097", "0.6152097", "0.61373156", "0.61366266", "0.61254954", "0.6093399", "0.6053022", "0.60249555", "0.60223824", "0.5994...
0.5350126
99
Concatenate a threepart domain name (as returned by a callback function) into a properlyescaped full domain name. Note that callback functions already escape strings where necessary.
def DNSServiceConstructFullName( service = None, regtype = _NO_DEFAULT, domain = _NO_DEFAULT, ): _NO_DEFAULT.check(regtype) _NO_DEFAULT.check(domain) _global_lock.acquire() try: fullName = _DNSServiceConstructFullName(service, regtype, domain) finally: _global_lock...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fqdn_f(x: Text) -> Tuple[Text, Text]:\n return \"fqdn\", x.lower()", "def generate_domainname():\n domainname = ''.join(generate_string(10, valid_domain_name_chars))\n domain = random.choice(['com', 'co.il', 'info'])\n return domainname+'.'+domain", "def replace_domain(address, old_domain, new_...
[ "0.579058", "0.57158256", "0.569366", "0.5582298", "0.55213106", "0.5488719", "0.54768974", "0.5469123", "0.54314345", "0.5381453", "0.53669304", "0.5267431", "0.52416444", "0.5229544", "0.52146995", "0.5194224", "0.515769", "0.5105822", "0.5105482", "0.5096741", "0.5065527",...
0.4683645
68
Given a string data containing the wire representation of a DNS TXT record, parse it and return a TXTRecord instance. The strict parameter is passed to the TXTRecord constructor.
def parse(cls, data, strict=False): txt = cls(strict=strict) while data: length = ord(data[0]) item = data[1:length+1].split('=', 1) # Add the item only if the name is non-empty and there are # no existing items with the same name if item[0]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fromString(cls, s):\n try:\n lines = s.splitlines()\n assert len(lines) > 1\n assert lines[0][0] == cls.DELIMITER\n name = lines[0][1:]\n sequence = \"\".join(lines[1:])\n return FastaRecord(name, sequence)\n except AssertionError:...
[ "0.576211", "0.57462007", "0.57333636", "0.5639418", "0.5458294", "0.5452302", "0.5380177", "0.5366627", "0.5292089", "0.5283829", "0.52309436", "0.52254903", "0.5194745", "0.5181893", "0.51478106", "0.5023238", "0.5016136", "0.5008382", "0.4947916", "0.4938744", "0.49315515"...
0.5661803
3
Returns list of plant_families that are in the database
def get_plant_families(db_path: str) -> List[PlantFamily]: families: List[PlantFamily] = [] conn: Connection = sqlite3.connect(path.join(db_path, 'company_data.db')) cur: Cursor = conn.cursor() for row in cur.execute('SELECT family_name, meta_data FROM plant_families'): families.append(PlantFami...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_families(self):\n return self.__make_api_call('list/families')", "def get_families(self):\n return self.__make_api_call('get/families')", "def get_families(self):\n # Implemented from template for\n # osid.resource.BinLookupSession.get_bins_template\n # NOTE: This im...
[ "0.70376325", "0.68771815", "0.649332", "0.6456533", "0.6126698", "0.6110612", "0.6110612", "0.58231896", "0.5761903", "0.57604086", "0.5590513", "0.5575529", "0.5533464", "0.5522717", "0.5515892", "0.55083907", "0.54434687", "0.54138833", "0.5378203", "0.53750706", "0.533853...
0.7899756
0
Stack k last frames. This is to let the NN able to extract information about velocity and acceleration. Also normalizes observation ([01] instead of [0 255]) for faster converges
def __init__(self, env, k): gym.Wrapper.__init__(self, env) self.k = k self.frames = deque([], maxlen=self.k) shp = env.observation_space.shape self.observation_space = spaces.Box(low=0, high=1, shape=(shp[0], shp[1], shp[2] * self.k), dtype=np.float32)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initHistoryFeature(obs,k):\n tmpObs = np.array(obs)\n placeholder = np.zeros(k*(tmpObs.shape[0]-1))\n return np.concatenate(tmpObs,placeholder)", "def kstep(model, data, Ydata, k):\n Yprime_next = []\n Ydata_next = []\n \n kMSE_list = np.zeros(k)\n SE_list = np.zeros(k)\n \n for...
[ "0.57230365", "0.57161605", "0.56722915", "0.55845463", "0.5560999", "0.5560999", "0.54862326", "0.5456455", "0.5438975", "0.5425319", "0.5424394", "0.5394935", "0.5382802", "0.53641886", "0.53586626", "0.5343464", "0.5338666", "0.53319466", "0.5327975", "0.5324611", "0.53219...
0.52710766
30
Factory that returns forms's timezone
def _get_tz(): return 'UTC'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tz_factory(factory):\n global _get_tz\n _get_tz = factory\n return factory", "def timezone():\n \n pass", "def timezone():\n\n return time.timezone", "def tz(self, tz):\n return timezones.maybe_get_tz('dateutil/' + tz)", "def get_timezone():\n return dates.get_timezone(_get_t...
[ "0.7335644", "0.7201873", "0.6705535", "0.66649455", "0.6600651", "0.6488011", "0.6447184", "0.63849664", "0.63581806", "0.63052094", "0.6252396", "0.624516", "0.6244501", "0.62305444", "0.6219654", "0.620208", "0.61846966", "0.61810404", "0.6157026", "0.61453116", "0.6110742...
0.6681488
3
Decorator which defines a factory function which set forms timezone. If not defined tz 'UTC' is used
def tz_factory(factory): global _get_tz _get_tz = factory return factory
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def timezone():\n \n pass", "def _get_tz():\n return 'UTC'", "def mock_timezone(tzname):\n # TODO(sergiyb): Also mock other common libraries, e.g. time, pytz.reference.\n def decorator(func):\n @functools.wraps(func)\n def wrapper(*args, **kwargs):\n with mock.patch('tzlocal.get_localzone'...
[ "0.7166869", "0.6995067", "0.66358006", "0.6598638", "0.6436628", "0.6253276", "0.6215615", "0.61999375", "0.6160603", "0.61381525", "0.61249715", "0.61249715", "0.612108", "0.6098649", "0.60775745", "0.6076494", "0.60028136", "0.5965247", "0.5956084", "0.59175795", "0.591568...
0.7823408
0
Build a ``babel.Timezone`` based on tz factory
def get_timezone(): return dates.get_timezone(_get_tz())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tz_factory(factory):\n global _get_tz\n _get_tz = factory\n return factory", "def tz(self, tz: float) -> 'Component':\n return self.translate(tz=tz)", "def as_timezone(self, tz):\n offset = tz_to_offset(tz)\n if TIMEZONES.get(tz, {}).get('dst') and is_dst(self):\n o...
[ "0.73326164", "0.61978465", "0.6145552", "0.60301566", "0.5894376", "0.58643407", "0.5539801", "0.54120415", "0.5406521", "0.5371443", "0.5369396", "0.5360257", "0.5347005", "0.53447115", "0.53317535", "0.53300035", "0.52566326", "0.5217423", "0.5213026", "0.5210082", "0.5183...
0.52397394
17
Returns the "first" item (highest priority item) in the Heap.
def first(self) -> Optional[T]: if len(self.entry_finder) == 0: return None for (_, _, (item,)) in self.priority_queue: if item is not None: return cast(T, item) return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def peek_first(self):\n if len(self._heap) == 0:\n return None\n else:\n return self._heap[0]", "def front(self):\n if self.size() < 1:\n return None\n else:\n # TODO: Return min item from heap, if any\n ...", "def peek(self):\n...
[ "0.7964933", "0.79603666", "0.78633803", "0.7838847", "0.77423954", "0.75647235", "0.7455747", "0.74212134", "0.7407793", "0.74055934", "0.7385108", "0.7370275", "0.7367165", "0.7355167", "0.73547816", "0.7347671", "0.7325154", "0.7325154", "0.73226243", "0.7308709", "0.72314...
0.73219556
19
Generator that iterates over all elements in the heap in priority order.
def heapsort(self) -> Generator[T, None, None]: h = [e for e in self.priority_queue] while h: entry = heapq.heappop(h)[-1][0] if entry is not None: yield cast(T, entry)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _heapify(self):\n for _ in range(len(self.elements)):\n for i in range(len(self.elements)-1, 0, -1):\n parentPosition = (i-1)/2 # defaults to int i.e. 7/2=3, and 6/2=3\n if parentPosition < 0:\n parentPosition = 0\n \n ...
[ "0.67655194", "0.6595669", "0.65570503", "0.65567213", "0.6536598", "0.6403625", "0.62331057", "0.6201248", "0.61415046", "0.612329", "0.61011565", "0.6072633", "0.60685575", "0.60631377", "0.5979491", "0.5971522", "0.59535086", "0.5946701", "0.5940976", "0.59213686", "0.5894...
0.80215645
0
Adds room to model
def AddRoom(self, room): self._rooms[room.Id] = room
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_room(self, room):\n self.rooms.append(room)", "def add_room(self, room):\n self.rooms[room.name] = room", "def _add_room(self, room_model):\r\n\r\n # Create a new TargetItem and set the model\r\n room_item = RoomItem()\r\n room_item.setModel(room_model)\r\n\r\n ...
[ "0.8265612", "0.81725705", "0.7564469", "0.73918706", "0.7357069", "0.7229495", "0.7205803", "0.71070576", "0.67696506", "0.6705405", "0.65507334", "0.65129554", "0.6510755", "0.6482115", "0.64757055", "0.64752436", "0.6401691", "0.6368586", "0.63273513", "0.62819463", "0.625...
0.78233236
2
Sets statusOn equals to False.
def set_Off(self): if not(self._locked): self.__dict__['statusOn']=False self._undo_action() else: self._log.info('The JobProperty %s is blocked', self.__name__)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def turn_off(self, **kwargs):\n self._is_on = False", "def off(self):\n self._set_state(on=False)", "def off_all(self):\n self._set_status(\"off\", \"11111111\")", "def turn_off(self, **kwargs):\n set_sonoff_state(self._host, \"off\")\n self._state = False", "def turn_off...
[ "0.7135843", "0.68836266", "0.6765003", "0.67543983", "0.65233386", "0.6487704", "0.6460713", "0.63838583", "0.63497865", "0.6323305", "0.632033", "0.625696", "0.62202233", "0.62187016", "0.6212751", "0.6201081", "0.61803925", "0.61763275", "0.6172446", "0.61639386", "0.61384...
0.74730825
0
Gets the value of the job property. This is the recommended way top retrieve the actual value of the job property. For boolean properties it gives the and(statusOn,StoredValue). For the rest of the properties it gives the StoredValue if the statusOn==True otherwise it gives None.
def get_Value(self): obj_p=object.__getattribute__(self, 'StoredValue') if isinstance(obj_p, type(True)): return obj_p & self.statusOn else: if self.statusOn: return obj_p else: self._log.warning('You are attempting to ac...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_property_value(self, property, db):\n if property == 'resultTime':\n return self.get_time()\n elif property == 'wallTime':\n return self.wallTime\n elif property == 'cost':\n return self.cost\n ...
[ "0.6302479", "0.6026945", "0.59872216", "0.58689666", "0.5855045", "0.57365096", "0.57329965", "0.5702613", "0.5659757", "0.56478876", "0.5635477", "0.55784446", "0.5542826", "0.55354476", "0.55309963", "0.55305606", "0.55126375", "0.5503784", "0.5503084", "0.54995644", "0.54...
0.8133427
0
Calculate the Intersection of Unions (IoUs) between bounding boxes. IoU is calculated as a ratio of area of the intersection and area of the union.
def bboxes_iou(bboxes_a, bboxes_b, xyxy=True, GIoU=False, DIoU=False, CIoU=False): if bboxes_a.shape[1] != 4 or bboxes_b.shape[1] != 4: raise IndexError if xyxy: # intersection top left tl = torch.max(bboxes_a[:, None, :2], bboxes_b[:, :2]) # intersection bottom right br...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc_iou(bbox1, bbox2):\n area_1 = (bbox1[2] - bbox1[0] + 1) * (bbox1[3] - bbox1[1])\n area_2 = (bbox2[2] - bbox2[0] + 1) * (bbox2[3] - bbox2[1])\n\n inter_x1 = torch.max(torch.cat([bbox1.new([bbox1[0]]), bbox1.new([bbox2[0]])]))\n inter_x2 = torch.max(torch.cat([bbox1.new([bbox1[1]]), bbox1.new([b...
[ "0.79872537", "0.7904173", "0.79039973", "0.7898763", "0.78695333", "0.78695333", "0.7727755", "0.7727755", "0.7727755", "0.77209467", "0.77167207", "0.76941663", "0.76416737", "0.7631423", "0.7629693", "0.7627523", "0.7616645", "0.7585931", "0.75609267", "0.7557686", "0.7557...
0.66388124
71
Convert [x1 y1 w h] box format to [x1 y1 x2 y2] format.
def xywh_to_xyxy(xywh): if isinstance(xywh, (list, tuple)): # Single box given as a list of coordinates assert len(xywh) == 4 x1, y1 = xywh[0], xywh[1] x2 = x1 + np.maximum(0., xywh[2] - 1.) y2 = y1 + np.maximum(0., xywh[3] - 1.) return (x1, y1, x2, y2) elif ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert(size, box):\n # TODO rewrite box to be [TL, BR] coordinates\n #pdb.set_trace()\n dw = 1./size[0]\n dh = 1./size[1]\n x = (box[0] + box[1])/2.0\n y = (box[2] + box[3])/2.0\n w = box[1] - box[0]\n h = box[3] - box[2]\n x = x*dw\n w = w*dw\n y = y*dh\n h = h*dh\n ret...
[ "0.76093835", "0.67424166", "0.65372974", "0.6512192", "0.6320221", "0.6294971", "0.623377", "0.6197299", "0.61471826", "0.6145354", "0.6129146", "0.60886025", "0.6086466", "0.6073584", "0.60302734", "0.60167366", "0.6005303", "0.59874636", "0.5986261", "0.59779567", "0.59705...
0.55248386
52
Convert [x1 y1 x2 y2] box format to [x1 y1 w h] format.
def xyxy_to_xywh(xyxy): if isinstance(xyxy, (list, tuple)): # Single box given as a list of coordinates assert len(xyxy) == 4 x1, y1 = xyxy[0], xyxy[1] w = xyxy[2] - x1 + 1 h = xyxy[3] - y1 + 1 return (x1, y1, w, h) elif isinstance(xyxy, np.ndarray): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert(size, box):\n # TODO rewrite box to be [TL, BR] coordinates\n #pdb.set_trace()\n dw = 1./size[0]\n dh = 1./size[1]\n x = (box[0] + box[1])/2.0\n y = (box[2] + box[3])/2.0\n w = box[1] - box[0]\n h = box[3] - box[2]\n x = x*dw\n w = w*dw\n y = y*dh\n h = h*dh\n ret...
[ "0.7493445", "0.6645303", "0.6451777", "0.63866377", "0.62981594", "0.6287364", "0.62560284", "0.6184535", "0.6157402", "0.609429", "0.60423505", "0.60333294", "0.6030784", "0.6009568", "0.5948914", "0.59447986", "0.59187365", "0.5873447", "0.5864347", "0.5845283", "0.5827957...
0.56052285
43
Clip an array of boxes to an image with the given height and width.
def clip_boxes_to_image(boxes, height, width): boxes[:, [0, 2]] = np.minimum(width - 1., np.maximum(0., boxes[:, [0, 2]])) boxes[:, [1, 3]] = np.minimum(height - 1., np.maximum(0., boxes[:, [1, 3]])) return boxes
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clip_boxes_to_image(boxes, size):\r\n height, width = size\r\n boxes[..., 0::2] = boxes[..., 0::2].clip(min=0, max=width)\r\n boxes[..., 1::2] = boxes[..., 1::2].clip(min=0, max=height)\r\n return boxes", "def clip_boxes(boxes, im_shape):\n if not hasattr(boxes, 'data'):\n boxes_ = boxe...
[ "0.7930213", "0.71642065", "0.7157049", "0.7068828", "0.7068828", "0.7053042", "0.7047885", "0.7038332", "0.68544185", "0.68544185", "0.6759667", "0.6707022", "0.66381145", "0.6490886", "0.64325047", "0.6364525", "0.62653816", "0.6245244", "0.61927474", "0.61774343", "0.61361...
0.8180427
0
Calculates the Levenshtein distance between two strings
def is_words_similar(string, model): if fuzz.ratio(string, model, score_cutoff=75): return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def distance(str1, str2):\n return levenshtein.normalized_distance(str1, str2)", "def levenshtein(str1, str2, normalise=False):\n\ttmp = Levenshtein.distance(str1, str2)\n\tif(normalise) and (len(str1) + len(str2)): tmp /= max(len(str1), len(str2))\n\treturn tmp", "def levenshtein_distance(s1,s2):\n\n\t\tif...
[ "0.8663069", "0.84566987", "0.8441458", "0.83961475", "0.8191135", "0.81100285", "0.8106957", "0.80886304", "0.80729777", "0.80697304", "0.79668826", "0.78683186", "0.7808162", "0.77761495", "0.77700204", "0.7765748", "0.77393323", "0.7650862", "0.76215154", "0.76085764", "0....
0.0
-1
Generates the Y vector from points X.
def generate_y(self, test=False): if not test: for i, point in enumerate(self.X): self.Y[i] = self.classify(point) else: for i, point in enumerate(self.test_X): self.test_Y[i] = self.classify(point)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def y(self, x):\n return x", "def get_y(self, x):\n p, y = self.get_p_y(x)\n return y", "def getXy():\n \n y=np.linspace(0.1,1,10)\n X=np.zeros((10,10))\n for i in range(0,10):\n for j in range(0,10):\n X[i,j]=i*10+j\n print(X,y)\n return X,y", "def X...
[ "0.64308333", "0.638409", "0.6256046", "0.60801065", "0.6074927", "0.6042255", "0.59547955", "0.5937029", "0.5900137", "0.58605266", "0.5854708", "0.58354926", "0.5832814", "0.583193", "0.57635045", "0.57621306", "0.57583106", "0.5745714", "0.57012534", "0.5677769", "0.567349...
0.5480009
34
Returns the error of the given hypothesis.
def error(self, in_sample=True): if in_sample: error = 0.0 for i, point in enumerate(self.X): if self.Y[i] != self.rbf_classify(point): error += 1 return error / 100 else: error = 0.0 for i, point in enumerat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_error(self):\n p = self._get_sub_text('error')\n if not p:\n return None\n else:\n try:\n return float(p)\n except ValueError:\n return None", "def error(self,pt,eta):\n return self._data[self.__ptBin(pt)][self.__etaB...
[ "0.66931295", "0.66551715", "0.64083123", "0.6318372", "0.62591666", "0.6146152", "0.61063695", "0.60970056", "0.60806316", "0.6043458", "0.5987833", "0.5976677", "0.59461737", "0.5924883", "0.59146845", "0.59139884", "0.5888946", "0.58709157", "0.5856832", "0.58337945", "0.5...
0.0
-1
returns the log of the prominence of the peak at a given index in a given dataset. peak prominence gives high values to relatively isolated peaks and low values to peaks that are in the "foothills" of large peaks.
def calculate_peak_prominence(data, index): current_peak = data[index] # ignore values at either end of the dataset or values that are not local maxima if ( index == 0 or index == len(data) - 1 or data[index - 1] > current_peak or data[index + 1] > current_peak or (d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def logpeak(x, p=default()):\n model = p[0] - p[1]*(x**2)\n return model", "def get_peakiness(spot_data):\n return spot_data[3] / np.mean((spot_data[5], spot_data[6]))", "def getPeakValue( self ):\n nCurrentMax = max( self.data.max(), -self.data.min() )\n return float(nCurrentMax) / ...
[ "0.6779745", "0.64888996", "0.62792605", "0.6174243", "0.6159863", "0.6152748", "0.61148065", "0.60468173", "0.597135", "0.59401566", "0.59293765", "0.59228134", "0.59181315", "0.58829546", "0.5867922", "0.58614624", "0.5861337", "0.5850922", "0.5821434", "0.5806238", "0.5772...
0.8172085
0
Apply sorts to a provided query.
def apply_sorts(self, query, sorts, convert_key_names_func=str): if len(query.column_descriptions) == 1: record_class = query.column_descriptions[0]["expr"] order_bys = self._get_order_bys( record_class, sorts, convert_key_names_func) for order_by in order_bys...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sort_query(query, *args):\n\n return QuerySorter()(query, *args)", "def lookup_sort(self, query, varenv):\n\n if ':sort' in query:\n sortkey = ':sort'\n elif '@sort' in query and query.is_root:\n sortkey = '@sort'\n else:\n # no sort in the query!\n return\n\n # save what t...
[ "0.7787852", "0.6589063", "0.65048265", "0.6235164", "0.6207403", "0.6187592", "0.60097635", "0.592081", "0.58499545", "0.5755368", "0.5752864", "0.5750036", "0.5676236", "0.5673594", "0.5665517", "0.56491965", "0.5630837", "0.5617829", "0.56021595", "0.556399", "0.5539355", ...
0.76461285
1
L{SecureUserAPI.create} raises a L{PermissionDeniedError} if it's invoked by a L{User} with the L{Role.ANONYMOUS}.
def testCreateIsDenied(self): values = [(u'user', u'secret', u'User', u'user@example.com')] error = self.assertRaises(PermissionDeniedError, self.users.create, values) self.assertEqual(self.user.username, error.username) self.assertEqual([(u'user', Opera...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create(self, request, *args, **kwargs):\n user = request.user\n if user.is_authenticated and not user.has_perm(\"users.add_user\"):\n self.permission_denied(request, message=_(\"You cannot create users.\"))\n return super().create(request, *args, **kwargs)", "def test_if_not_c...
[ "0.77370703", "0.732014", "0.69453704", "0.6829697", "0.68215775", "0.6680312", "0.6636721", "0.66285187", "0.66210103", "0.65855336", "0.65805453", "0.6562975", "0.6555461", "0.65524065", "0.6552074", "0.65371704", "0.65260243", "0.6510231", "0.6476615", "0.6476301", "0.6470...
0.0
-1
L{SecureUserAPI.create} raises a L{PermissionDeniedError} if it's invoked by a L{User} with the L{Role.USER}.
def testCreateIsDenied(self): values = [(u'user', u'secret', u'User', u'user@example.com')] error = self.assertRaises(PermissionDeniedError, self.users.create, values) self.assertEqual(self.user.username, error.username) self.assertEqual([(u'user', Opera...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create(self, request, *args, **kwargs):\n user = request.user\n if user.is_authenticated and not user.has_perm(\"users.add_user\"):\n self.permission_denied(request, message=_(\"You cannot create users.\"))\n return super().create(request, *args, **kwargs)", "def create_user(s...
[ "0.7944635", "0.731403", "0.7178864", "0.7119077", "0.7109094", "0.7085829", "0.7063584", "0.7047725", "0.69826317", "0.6932389", "0.692569", "0.69214225", "0.6915812", "0.69155264", "0.69155264", "0.69155264", "0.69155264", "0.69155264", "0.69155264", "0.69155264", "0.681913...
0.0
-1
L{SecureUserAPI.create} can always be invoked by a L{User} with the L{Role.SUPERUSER}.
def testCreateIsAllowed(self): self.users.create([(u'user', u'secret', u'User', u'user@example.com')]) user = getUser(u'user') self.assertEqual(u'user', user.username)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_user(self):\n return User.objects.create_user(**self.user_data)", "def create():\n api_request = apireq.APIRequest(request, 'client_schema')\n if api_request.is_invalid():\n return api_request.error_text, 400\n return user_management.create_user(api_json['username'])", "def cr...
[ "0.7738748", "0.7680209", "0.7605155", "0.7473295", "0.74495834", "0.73832417", "0.73117036", "0.728563", "0.72688586", "0.7244189", "0.7234759", "0.72316164", "0.72273016", "0.72196084", "0.72171485", "0.7213316", "0.72071", "0.7206706", "0.7206706", "0.7206706", "0.7200236"...
0.0
-1
Set the Global Variables If User provides different values, override defaults This function returns the AWS account number
def set_global_vars(): global_vars = {"status": False} try: global_vars["Owner"] = "Mystique" global_vars["Environment"] = "Prod" global_vars["aws_region"] = "us-east-1" global_vars["tag_name"] = "serverless_cloudwatch...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_account_id():\n STORED_ID[\"account_id\"] = CONFIG_DATA['account_id']\n STORED_ID[\"member_id\"] = CONFIG_DATA['member_id']", "def default_account(web3):\n return web3.eth.defaultAccount", "def load_aws_account_id() -> str:\n client: STSClient = fetch_boto3_client(\"sts\")\n retu...
[ "0.64502424", "0.6106148", "0.6029233", "0.6002272", "0.58274907", "0.5778558", "0.57072854", "0.56870157", "0.56578416", "0.5656671", "0.5623636", "0.56060654", "0.5587832", "0.5584605", "0.5584605", "0.5584605", "0.55814046", "0.55814046", "0.556388", "0.5556879", "0.555687...
0.5317204
70
Generates a string of the format "YYYY MM DD" from the given datetime, uses the delimited passed
def gen_ymd(t,d) -> str: ymd = ( str(t.year) + d + str(t.month) + d + str(t.day) ) return ymd
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_datetime_to_string(dt):\n\treturn '{0}-{1}-{2}'.format(dt.year, dt.month, dt.day)", "def convert_datetime_to_string(dt):\n\treturn '{0}-{1}-{2}'.format(dt.year, dt.month, dt.day)", "def datetime_to_str(datetime_obj: Union[dt.datetime, dt.date] = dt.datetime.now(), sep: str = DATE_SEPARATOR) -> str:...
[ "0.70336896", "0.70336896", "0.68291247", "0.6590661", "0.6491152", "0.6483691", "0.6430354", "0.6304501", "0.6292394", "0.6270327", "0.6265955", "0.6255096", "0.62481016", "0.6229309", "0.62091726", "0.6194473", "0.61601675", "0.6137004", "0.6068528", "0.6067855", "0.6008972...
0.6025751
20
Create a set of overlapping character ngrams. Only full length character ngrams are created, that is the first character ngram is the first `char_ngram` characters from text, no padding is applied. Each ngram is spaced exactly one character apart.
def get_shingles(text, char_ngram=5): return set(text[head:head + char_ngram] for head in range(0, len(text) - char_ngram))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ngrams(text, n):\n return chain(*[ngrams_(text, i) for i in range(n + 1)])", "def word2ngrams(text, n=3):\n return [text[i:i+n] for i in range(len(text)-n+1)]", "def extract_n_grams(string, n, overlap=0, unique=True):\n if n > len(string):\n return [] \n\n n_grams = []\n step = n -...
[ "0.6861325", "0.68203634", "0.6805727", "0.6793382", "0.6729687", "0.6642758", "0.66361755", "0.65498006", "0.65344286", "0.6428326", "0.6416319", "0.64105225", "0.6405475", "0.6396969", "0.6366237", "0.6366237", "0.63559246", "0.63555974", "0.6347982", "0.63360286", "0.63334...
0.6098354
39
Initialize the transition parameters. The parameters will be initialized randomly from a uniform distribution between 0.1 and 0.1.
def reset_parameters(self, init_transitions) -> None: nn.init.uniform_(self.start_transitions, -0.1, 0.1) nn.init.uniform_(self.end_transitions, -0.1, 0.1) if not init_transitions: nn.init.uniform_(self.transitions, -0.1, 0.1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_parameters(self) -> None:\n nn.init.uniform_(self.start_transitions, -0.1, 0.1)\n nn.init.uniform_(self.end_transitions, -0.1, 0.1)\n nn.init.uniform_(self.transitions, -0.1, 0.1)", "def reset_parameters(self) -> None:\n nn.init.uniform_(self.start_transitions, -0.1, 0.1)\n ...
[ "0.7375393", "0.7375393", "0.7069153", "0.69542855", "0.6894123", "0.6883311", "0.6880576", "0.67688316", "0.67493856", "0.66428995", "0.65684617", "0.6533901", "0.65207654", "0.64776736", "0.64766234", "0.6445545", "0.6443556", "0.6441427", "0.6432912", "0.64311343", "0.6412...
0.7343688
2
Given a potential artist name, return a fully populated Artist object or None if not found Includes top tracks First checks the local database for a match and searches Spotify otherwise
def query_artist(self, artist_name): # Check if the artist is in the database try: a = Artist.objects.get(searched_name = artist_name) return ArtistObject(searched_name=artist_name, db_model=a) # If the artist isn't in the database, search Spotify except Artist.D...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search_for_artist_top_tracks(name):\n\tartist_id = search_for_artist(name)\n\ttoken = get_token()\n\tif artist_id and token:\n\t\theaders = {\"Content-Type\": \"application/json\", \"Authorization\": \"Bearer \" + token}\n\t\toptions = {'country': 'TR'}\n\t\tresponse = requests.get(\n\t\t\t'https://api.spotify...
[ "0.724598", "0.72398084", "0.7203718", "0.7147361", "0.7066119", "0.6815739", "0.6652512", "0.6606571", "0.6554571", "0.6535177", "0.6398923", "0.62590986", "0.62523365", "0.624418", "0.62367195", "0.62217927", "0.62111866", "0.616223", "0.6161543", "0.61484575", "0.61140645"...
0.7890815
0
Return top N tracks by one artist
def find_top_tracks(self, artist, N=10): tracklist = [] try: result = self.sp.artist_top_tracks(artist) except ConnectionError as e: print ("ERROR: connection pool is closed; searching Spotify for top tracks for this artist: " + artist) result = self.sp.artist...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_top_tracks(artist, limit):\n\n l = []\n for track in _lastfm.get_artist(artist).get_top_tracks(limit=limit):\n track = track.item\n l.append({\"artist\": track.get_artist().get_name(), \"title\": track.get_title()})\n \n return l", "def get_artists_most_played(session_):\n #...
[ "0.75897723", "0.7345259", "0.71940255", "0.7166976", "0.7037446", "0.6978553", "0.6969301", "0.68938833", "0.6661266", "0.65071857", "0.6462922", "0.6380554", "0.62887114", "0.626923", "0.62375045", "0.6152787", "0.60554606", "0.6029835", "0.6024866", "0.60211205", "0.594220...
0.7737359
0
compute the log sum exp, to avoid the situation of add to inf values
def _logaddexp(a, b, mask): output = torch.zeros_like(a) # find the mask to output b when a contain -inf values out_put_b_mask = torch.isinf(a) & (a < 0) # find the mask to output a when b contain -inf values out_put_a_mask = torch.isinf(b) & (b < 0) # in order not to take the padded number int...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_sum_exp(self, x):\n b = numpy.max(x[(x<sys.maxsize)]) # ignore inf values\n\n s = b + numpy.log(numpy.sum(numpy.exp(x-b)))\n\n return s", "def logSumExp(ns):\n mx = np.max(ns)\n ds = ns - mx\n sumOfExp = np.exp(ds).sum()\n return mx + np.log(sumOfExp)", "def log_sum_e...
[ "0.82338077", "0.8016978", "0.7982886", "0.7976028", "0.793767", "0.793767", "0.7926441", "0.7915624", "0.77903396", "0.77846116", "0.7721805", "0.76739764", "0.74662775", "0.74378175", "0.74378175", "0.74366343", "0.7416536", "0.7413639", "0.7366377", "0.7242731", "0.7081820...
0.0
-1
Constructs the optimizer and learning rate scheduler based on ``self.optimizer_params`` and ``self.lr_scheduler_params``. If weight decay is specified, it will be applied only to convolutional layer weights.
def configure_optimizers(self) -> Tuple[List[optim.Optimizer], List[optim.lr_scheduler._LRScheduler]]: if ( ("weight_decay" in self.optimizer_params) and (self.optimizer_params["weight_decay"] != 0) and self.exclude_bn_bias ): defaults = copy(self.optimize...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def configure_optimizers(self):\n no_decay = [\"bias\", \"LayerNorm.weight\"]\n optimizer_grouped_parameters = [\n {\n \"params\": [p for n, p in self.model.named_parameters() if not any(nd in n for nd in no_decay)],\n \"weight_decay\": self.args.weight_decay,...
[ "0.79011065", "0.7584084", "0.733709", "0.7293629", "0.72257257", "0.7219247", "0.7144577", "0.7016383", "0.69844764", "0.6968011", "0.69401735", "0.68342435", "0.68171877", "0.67790586", "0.6773473", "0.67549115", "0.675206", "0.6720569", "0.6720569", "0.67168665", "0.671625...
0.7485579
2
Determines whether or not this route should be registered with the app,
def should_register(self, app: FlaskUnchained) -> bool: if self.only_if in {None, _missing}: return True elif callable(self.only_if): return self.only_if(app) return bool(self.only_if)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def use_routes(self) -> Optional[pulumi.Input[bool]]:\n return pulumi.get(self, \"use_routes\")", "def requires_route(self) -> bool:\n return self.goal.is_specific()", "def register_route(self, route, app):\n assert route not in self.routes\n self.routes[route] = app", "def available(self...
[ "0.6618112", "0.63656676", "0.6234784", "0.61937547", "0.61844283", "0.60276264", "0.5842834", "0.5832673", "0.5813399", "0.5729311", "0.5706028", "0.56915474", "0.5685411", "0.56671345", "0.5639625", "0.562695", "0.5610029", "0.5610029", "0.55238324", "0.5514791", "0.5504905...
0.67621577
0
Whether or not this route is for a resource member route.
def is_member(self) -> bool: if self._is_member is _missing: return False return self._is_member
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_member(cls, attr):\n return cls._attributes[attr].kind == ResourceAttributeKinds.MEMBER", "def is_resource(cls, attr):\n return cls._attributes[attr].kind \\\n in [ResourceAttributeKinds.MEMBER,\n ResourceAttributeKinds.COLLECTION]", "def is_member(self, n...
[ "0.7223114", "0.6775421", "0.6428491", "0.64025867", "0.61827683", "0.61206573", "0.6095836", "0.60821104", "0.60820603", "0.6077299", "0.59269667", "0.5916018", "0.5911063", "0.5828096", "0.5825174", "0.58234465", "0.5819571", "0.581266", "0.577274", "0.5754997", "0.5753207"...
0.66634417
2
The (partial) url rule for this route.
def rule(self) -> str: if self._rule: return self._rule return self._make_rule(member_param=self._member_param, unique_member_param=self._unique_member_param)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def full_rule(self) -> str:\n rule = self.rule\n return join(self.bp_prefix, rule, trailing_slash=rule.endswith('/'))", "def endpoint_forwarding_rule(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"endpoint_forwarding_rule\")", "def href(self, request) -> str:\n return requ...
[ "0.66126394", "0.61974275", "0.6035501", "0.5887732", "0.5877782", "0.57828206", "0.5763287", "0.574582", "0.574175", "0.5741488", "0.5708751", "0.57007563", "0.5646991", "0.5637542", "0.56331754", "0.55892926", "0.5579169", "0.5579169", "0.5579169", "0.55583715", "0.55495983...
0.5884112
4
Plot model predictions and losses.
def visualize(self): self.aggregator.plot_loss() self.save_figure()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_predictions(self):\n\n plt.title(\"Targets vs. Predictions\")\n plt.plot(self.T, label=\"Targets\")\n plt.plot(self.Y, label=\"Predictions\")\n plt.xlabel(\"Sample number\")\n plt.legend()\n plt.show()", "def plot_observations():\n plt.plot(history.history['l...
[ "0.77474886", "0.75721526", "0.7559613", "0.73312813", "0.7242141", "0.7238941", "0.71976334", "0.71642756", "0.714301", "0.7094806", "0.7051112", "0.7035576", "0.70319396", "0.70254916", "0.69706696", "0.6932716", "0.69057506", "0.686508", "0.6864638", "0.6835604", "0.683257...
0.6548008
54
Create a layer with Layer(number of neurons, activation function)
def __init__(self, number_of_neurons: int, activation_function, inputs=None): self.uid = None self.number_of_neurons = number_of_neurons self.activation_function = activation_function self.inputs = inputs self.shape = None self.data_shape = None self.weights = Non...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_layer(prev, n, activation):\n\n kernel_ini = tf.contrib.layers.variance_scaling_initializer(mode=\"FAN_AVG\")\n layer = tf.layers.Dense(units=n, activation=activation,\n kernel_initializer=kernel_ini, name='layer')\n\n return layer(prev)", "def add_layer(inputs, in_...
[ "0.7691791", "0.7508901", "0.7289891", "0.71445364", "0.71290463", "0.6984684", "0.6941692", "0.68824774", "0.68740064", "0.6840648", "0.68213063", "0.6798573", "0.6793914", "0.67731655", "0.6747035", "0.6723698", "0.671334", "0.67112803", "0.66663253", "0.6635905", "0.662806...
0.61632246
100
Convert snake_case to CamelCase
def snake_to_camel(name): return "".join([piece.capitalize() for piece in name.split("_")])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def snake_to_camel_case(snake_str: str) -> str:\n\n words = snake_str.strip(\"_\").split(\"_\")\n return words[0] + \"\".join(word[:1].upper() + word[1:] for word in words[1:])", "def snake_to_camel_case(value):\n words = value.strip(\"_\").split(\"_\")\n return words[0].lower() + \"\".join([word.cap...
[ "0.8475393", "0.8431845", "0.8246983", "0.82342875", "0.82156813", "0.813772", "0.811967", "0.811967", "0.8094278", "0.80872136", "0.80825305", "0.80633247", "0.8036516", "0.79394835", "0.7929874", "0.79061925", "0.7868794", "0.782465", "0.78136355", "0.7811608", "0.7790257",...
0.8110667
8
Sets the sender of this SMS.
def sender(self, sender): self._sender = sender
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sender(self, sender: str):\n if sender is None:\n raise ValueError(\"Invalid value for `sender`, must not be `None`\") # noqa: E501\n\n self._sender = sender", "def sender(self, sender: Address) -> None:\n enforce(\n isinstance(sender, str), f\"Sender must be strin...
[ "0.812976", "0.791269", "0.7116226", "0.6632324", "0.63864696", "0.6310532", "0.59443784", "0.59071565", "0.5755121", "0.57034737", "0.56887907", "0.56476104", "0.5644962", "0.5626896", "0.5529737", "0.54866284", "0.5329032", "0.5329032", "0.53159183", "0.53066236", "0.520634...
0.67740583
3
Sets the udh of this SMS.
def udh(self, udh): self._udh = udh
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_husb_id(self, h, line_number=0):\n self.husb_id = h\n self._husb_id_line = line_number", "def _ctrl_hum_set(self, osrs_h):\n data = osrs_h & 0x7\n self._bus.write_byte_data(self.addr, self.CTRL_HUM,\n data)", "def h(self, h):\n\n self....
[ "0.55118376", "0.5458981", "0.54250246", "0.5295987", "0.5192501", "0.51368546", "0.5133382", "0.5058383", "0.5058383", "0.5015915", "0.50094515", "0.49992454", "0.4968347", "0.49148625", "0.48919505", "0.48853025", "0.4839073", "0.4839073", "0.48241588", "0.4814084", "0.4809...
0.8540887
0
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, SMS): return False return self.to_dict() == other.to_dict()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False", "def __eq__(self, other):\n if i...
[ "0.8088132", "0.8088132", "0.8054589", "0.7982687", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", ...
0.0
-1
Returns true if both objects are not equal
def __ne__(self, other): if not isinstance(other, SMS): return True return self.to_dict() != other.to_dict()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True", "def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)", "def __ne__(self, other) -> bool:\n return not self.__eq__(other)", "def __eq__(self, other):\n ...
[ "0.8457179", "0.8393067", "0.81457263", "0.8140635", "0.8133462", "0.8094992", "0.8093376", "0.8093376", "0.8093376", "0.80863357", "0.80863357", "0.8077303", "0.8077303", "0.8066831", "0.8043635", "0.8043635", "0.8043635", "0.8043635", "0.8043635", "0.8043635", "0.8043635", ...
0.0
-1
Set up the button from a config entry.
async def async_setup_entry( hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback, ) -> None: coordinator: YaleDataUpdateCoordinator = hass.data[DOMAIN][entry.entry_id][ COORDINATOR ] async_add_entities( [YalePanicButton(coordinator, description) for...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_pickConfigButton(self, cfg_t, button):\n\n ctxt = \"\"\n cfg_iter = self.cbox[cfg_t].get_active_iter()\n\n # cfg_iter points to user choice? ...\n if cfg_iter != None:\n model = self.cbox[cfg_t].get_model()\n cfgname = model[cfg_iter][0]\n\n # ... or ...
[ "0.62137634", "0.5963681", "0.5958622", "0.5958622", "0.5883172", "0.58403033", "0.57625777", "0.5759956", "0.5726768", "0.5722457", "0.55959624", "0.5590502", "0.55874527", "0.55457693", "0.5544001", "0.5538917", "0.5522453", "0.55111575", "0.5491177", "0.5483059", "0.547645...
0.51909494
60
Truncates the names of the leaf nodes. This is a VariantFinderspecific change, as the self.tree object will alway contain the full node names.
def truncate_names(self, truncation): self.update_tree_data(truncation=truncation) # Update leaf names in relevant variables: new_leaves = [name[:truncation] for name in self.tree.get_named_leaves()] trans = dict((old_name, new_name) for old_name,new_name in zip(self.leaves, new_leaves))...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_named_leaves(self):\n names = [node.name for node in self.leaves]\n return sorted(names)", "def update_tree_data(self, truncation=None):\n if truncation == None:\n truncation = int(self.display_options['sizes']['max_variant_name_length'])\n newick_tree_data = self.t...
[ "0.62963", "0.61702365", "0.61521846", "0.5894041", "0.5651285", "0.56452096", "0.55572474", "0.5530849", "0.5530675", "0.5471478", "0.54623216", "0.54526156", "0.54261523", "0.5360796", "0.534782", "0.53472435", "0.5308604", "0.5304566", "0.52784055", "0.52427554", "0.523804...
0.7373135
0
Calculate mean squared displacement of time series
def calculate_msd(self, ensemble=False): print('Calculating MSD...', end='', flush=True) start = timer.time() self.msd = timeseries.msd(self.z_interpolated.T[..., np.newaxis], 0, ensemble=ensemble, nt=self.nt).T print('Done in %.3f seconds' % (timer.time() - start))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_mean_square_displacement(self):\n # compute the current_positions by adding the number of crossings of the system\n current_positions = self.positions + self.crossings\n # get the dx vector between the current position and the initial positions for all particles\n dx = curre...
[ "0.6826504", "0.6235161", "0.6185731", "0.60750204", "0.6034088", "0.59872353", "0.59701866", "0.59130394", "0.586807", "0.58674055", "0.5866566", "0.5835154", "0.5824567", "0.5824407", "0.5823633", "0.58216155", "0.579659", "0.5789406", "0.57846105", "0.5775794", "0.5765212"...
0.0
-1
Rupture area, which is None for a PointRupture. Could potentially put in a default value based on magnitude.
def getArea(self): return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def area(self) -> float:\n raise NotImplementedError", "def area(self):\n return math.pi * self._r ** 2", "def getSurfaceArea(self) -> float:\n return self.area()", "def area(self):\n raise NotImplementedError", "def area(self):\n return _property_op(arctern.ST_Area, self...
[ "0.66038907", "0.6332793", "0.61329716", "0.61145014", "0.60976326", "0.6089185", "0.6071646", "0.6068442", "0.60481757", "0.60481757", "0.60314196", "0.602495", "0.60080856", "0.59929395", "0.59865564", "0.59781015", "0.59718335", "0.59379256", "0.5936248", "0.5908892", "0.5...
0.61690694
2
Return this vector rotated clockwise by an angle in degrees.
def rotate(self, angle): radians = angle*pi/180 return Vector(self.x*cos(radians) - self.y*sin(radians), self.x*sin(radians) + self.y*cos(radians))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rotatedBy(self, angle):\n\t\tx, y = self.x, self.y\n\t\tc, s = cos(angle), sin(angle)\n\t\treturn Vector((c * x) - (s * y), (s * x) + (c * y))", "def rotate(self, angle):\n perp = Vec2D(-self[1], self[0])\n angle = angle * math.pi / 180.0\n c, s = math.cos(angle), math.sin(angle)\n ...
[ "0.8089718", "0.7863476", "0.772329", "0.7589371", "0.7317626", "0.7316414", "0.72647196", "0.7162674", "0.7149069", "0.7090272", "0.70366764", "0.70071363", "0.6990825", "0.6973066", "0.695855", "0.6909231", "0.68779105", "0.68095434", "0.6792884", "0.67925197", "0.6788614",...
0.8170549
0
Return a unit vector in the given direction.
def unit(direction): return Vector(0, -1).rotate(direction)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def direction(self):\n len = self.length()\n if len == 0.0:\n uvec = pos.Pos(np.transpose(np.array([0, 0, 0])))\n else:\n uvec = pos.Pos(np.transpose(np.array([(self.end.x - self.start.x) / len,\n (self.end.y - self.start.y...
[ "0.7460649", "0.7378068", "0.72194254", "0.7213787", "0.71965986", "0.71385056", "0.7136587", "0.7128137", "0.7128137", "0.7128137", "0.7110969", "0.7110969", "0.7110969", "0.7110969", "0.7110969", "0.7110969", "0.7110969", "0.7110969", "0.7110969", "0.7110969", "0.7110969", ...
0.8102602
0
Parse episode from an list of episodes by season
def parse_episode (self, episode, genres=None): mpaa = '' if episode.get('maturity', None) is not None: if episode['maturity'].get('board', None) is not None and episode['maturity'].get('value', None) is not None: mpaa = str(episode['maturity'].get('board', '').encode('utf-8'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_episodes_by_season (self, response_data):\n episodes = {}\n raw_episodes = response_data['value']['videos']\n for episode_id in raw_episodes:\n if self._is_size_key(key=episode_id) == False:\n if (raw_episodes[episode_id]['summary']['type'] == 'episode'):\n ...
[ "0.7611015", "0.7244009", "0.71469927", "0.6858938", "0.68174666", "0.6802185", "0.67631245", "0.67087924", "0.6705892", "0.67018354", "0.6698908", "0.6666066", "0.6583698", "0.6438356", "0.6416491", "0.6415305", "0.6392148", "0.6353288", "0.63249874", "0.63196313", "0.630446...
0.5937342
41
Initialize the hidden state for bidirectional/lstm model as random small numbers.
def init_hidden(self, batch=constants.BATCH_SIZE): return (Variable(torch.randn(constants.NUM_LAYERS * constants.NUM_DIRECTIONS, batch, self.hidden_dim)), Variable(torch.randn(constants.NUM_LAYERS * constants.NUM_DIRECTIONS, batch, self.hidden_dim)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_hidden(self, batch_size, device):\n if self.mode == 'LSTM':\n return (torch.ones((1+self.bidirectional , batch_size, self.hidden_dim), device=device),\n torch.ones((1+self.bidirectional, batch_size, self.hidden_dim), device=device))\n else:\n return t...
[ "0.7446548", "0.74166644", "0.7220354", "0.70916295", "0.70797807", "0.70143545", "0.70143545", "0.69337404", "0.69337404", "0.68302864", "0.68149316", "0.6795311", "0.66392297", "0.66317123", "0.6606904", "0.6605669", "0.6547069", "0.6547069", "0.6547069", "0.6547069", "0.65...
0.59939116
69
Get current user profile Params
def get(self, request): current_user = request.user user_profile = self.serializer_class(current_user.profile) return Response({ "message": PROFILE_MSGS['MY_PROFILE'], "profile": user_profile.data }, status=status.HTTP_200_OK)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_params(self):\n \n return self.params[self.profile]", "def get_user_profile(self):\n return self.request('get', 'id/users')", "def get_profile(self):\n endpoint = '/profile'\n return self.get_request(endpoint)", "def get_user_profile(self):\n return self.use...
[ "0.74933076", "0.73340845", "0.69584715", "0.69421613", "0.68457913", "0.67181665", "0.65826696", "0.6570047", "0.65520227", "0.6551527", "0.6546236", "0.65113515", "0.65113515", "0.6463729", "0.64153445", "0.6374431", "0.6342729", "0.62829864", "0.62816703", "0.6267531", "0....
0.65547776
8
Perform sigmoid correction on an image. pixel = 2551/(1+exp(gain(cutoffv/255))) Values in the range gain=(5, 20) and cutoff=(0.25, 0.75) seem to be sensible.
def enhance_contrast_sigmoid(self, cutoff=0.5, gain=10, p=None): if self._max_aug_nums>0: if self._nums>self._max_aug_nums: return self self._nums += 1 if p is None: p = self._p self.image = enhance_contrast_sigmoid(self.image, cutoff, gain, p)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hard_sigmoid(x):\n x = (0.2 * x) + 0.5\n x = F.threshold(-x, -1, -1)\n x = F.threshold(-x, 0, 0)\n return x", "def sigmoid(values, gain, shift):\n import numpy as np\n\n tiny = 0.000000001\n\n # Make sure argument is a numpy array\n if type(values) != np.ndarray:\n values = np....
[ "0.70195735", "0.7011871", "0.65268934", "0.6512203", "0.65120065", "0.64965075", "0.64965075", "0.64965075", "0.64965075", "0.64965075", "0.64965075", "0.6488432", "0.64873695", "0.64822894", "0.64782315", "0.64686084", "0.6466029", "0.64544266", "0.6452752", "0.6443432", "0...
0.680063
2
Adjust image sharpness. This class can be used to adjust the sharpness of an image. An enhancement factor of 0.0 gives a blurred image, a factor of 1.0 gives the original image, and a factor of 2.0 gives a sharpened image.
def enhance_sharpness(self, delta, p=None): if self._max_aug_nums>0: if self._nums>self._max_aug_nums: return self self._nums += 1 if p is None: p = self._p self.image = enhance_sharpness(self.image, delta, p) return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sharpen(image_path, factor=3):\n BasicTransform.convert_image(image_path)\n\n with Image.open(image_path) as img:\n filter = ImageEnhance.Sharpness(img)\n new_image = filter.enhance(factor)\n new_image.save(image_path)", "def apply_sharpening_on(image):\n # C...
[ "0.7351135", "0.6859915", "0.65243554", "0.65190333", "0.65041846", "0.65000826", "0.63921803", "0.629966", "0.61586726", "0.6110031", "0.60780835", "0.6064257", "0.6024624", "0.6020745", "0.60116106", "0.5989832", "0.5969529", "0.59548235", "0.5941057", "0.58676296", "0.5820...
0.63954014
6
Tests that pathlib methods works as expected.
def test_github_path_purepath(): p = github_api.GithubPath('/tensorflow/datasets/tree/master/') sub_p = p / 'some_folder' assert isinstance(sub_p, github_api.GithubPath) assert str(p) == '/tensorflow/datasets/tree/master' assert p == github_api.GithubPath.from_repo('tensorflow/datasets')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_path(self, fs_path, fs):\n assert fs.path == fs_path", "def test_pathlib_obj(self):\n \"\"\"\n We do this because pygame functions internally use pg_EncodeString\n to decode the filenames passed to them. So if we test that here, we\n can safely assume that all those fu...
[ "0.745262", "0.7374792", "0.7266706", "0.72556955", "0.7166322", "0.7114414", "0.7095042", "0.7048179", "0.70108753", "0.7005602", "0.7004231", "0.6994965", "0.69171345", "0.68927926", "0.6884964", "0.6879854", "0.68597764", "0.6851849", "0.68459594", "0.68440497", "0.6839228...
0.6734798
25
returns the string with the most amount of cosonants in the list
def most_consonants(words): cos = [[len(x)-num_vowels(x),x] for x in words] best_pair = max(cos) return best_pair[1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def most_reducible(wordlist):\n\n\t# We create a memo for reducible words since is_reducible is \n\t# recursive. The keys are the words and the values are the \n\t# number of characters\n\tglobal reducible_words\n\treducible_words = dict()\n\treducible_words['a'], reducible_words['i'] = 1, 1\n\t\n\tword_dict = to_...
[ "0.6753775", "0.65857285", "0.6520767", "0.64088506", "0.6314893", "0.625792", "0.62460244", "0.6241554", "0.6236402", "0.62010914", "0.61505383", "0.6131142", "0.6130229", "0.6110834", "0.60224414", "0.59929377", "0.59578854", "0.59573406", "0.5955048", "0.5948155", "0.59328...
0.68849385
0
Wraps visdom's scatter function.
def plot_scatter(X, Y=None, legend=None, title='', xlabel='', ylabel='', markersize=5): global vis opts = dict(title=title, xlabel=xlabel, ylabel=ylabel, markersize=markersize, legend=legend) win = vis.scatter(X, Y, opts=opts) return win
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scatter(args):\n prism.scatter.run(\n input_fp=args.input,\n output_fp=args.output,\n width=args.width,\n height=args.height,\n scale=args.scale,\n font_family=args.font_family,\n )", "def scatter(self, dim, index, src):\n result = self.clone()\n ...
[ "0.66823995", "0.66597074", "0.6406691", "0.64020175", "0.62254107", "0.6219547", "0.621756", "0.61643404", "0.6032304", "0.6029318", "0.59743047", "0.5960084", "0.5926076", "0.59157056", "0.5915084", "0.58860296", "0.5847357", "0.5839786", "0.58290386", "0.5823565", "0.58086...
0.6612612
2
Plots the average metrics for train or validation.
def plot_average_metrics(metrics, epoch, handle_dict, train_val): avg_elbo, avg_cond_log_like, avg_kl = metrics update_trace(np.array([-avg_elbo]), np.array([epoch]).astype(int), win=handle_dict['elbo'], name=train_val) update_trace(np.array([-avg_cond_log_like]), np.array([epoch]).astype(int), win=handle_d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_observations():\n plt.plot(history.history['loss'], label='training_loss')\n plt.plot(history.history['val_loss'], label='val_loss ')\n plt.xlabel('Epoch')\n plt.ylabel('Loss')\n plt.show()\n\n plt.plot(history.history['acc'], label='accuracy')\n plt.plot(history.history['val_acc'], l...
[ "0.73530304", "0.73163515", "0.7297184", "0.727384", "0.7250502", "0.72106844", "0.7138556", "0.7082378", "0.7028162", "0.6938152", "0.69381255", "0.69316524", "0.6921423", "0.6913473", "0.6913304", "0.691253", "0.68904334", "0.6884158", "0.6865041", "0.6858754", "0.6854673",...
0.7003849
9
Determine purchasability class of reaction. Class I All components purchasable. Class II A substrate not purchasable, A product is purchasable. Class III A substrate purchasable, A product not purchasable. Class IIII A substrate not purchasable, A product not purchasable.
def get_purchasability_class(self): self.p_class = 1 r_purch = [] p_purch = [] for m in self.components: # Ignore compounds that are common solvents or salts. if m.name in KEGG_IDs_to_ignore(): purchasability = True else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def class_uc(x):\r\n if Class(x) == \"G\" :\r\n return 1\r\n else :\r\n if Class(x) == \"I\" :\r\n return 2\r\n else :\r\n return 0", "def calc_class(stock):\n if 'M' in stock['Cap']:\n val = float(stock['Cap'].replace('M', \"\"))\n if val >= 250:\n stock['Class'] = 'Small'\n ...
[ "0.56287736", "0.5612209", "0.5515218", "0.54006594", "0.5366005", "0.5320185", "0.5296911", "0.524776", "0.5202506", "0.51126087", "0.51083016", "0.50990933", "0.5096517", "0.5072674", "0.50664383", "0.506554", "0.5011854", "0.50107545", "0.50040853", "0.49884465", "0.496321...
0.82978255
0
Verify that a pylintrc file with ignores will work.
def test_pylintrc_ignore(testdir): rcfile = testdir.makefile('rc', """ [MASTER] ignore = test_pylintrc_ignore.py """) testdir.makepyfile("""import sys""") result = testdir.runpytest( '--pylint', '--pylint-rcfile={0}'.format(rcfile.strpath) ) assert 'collected 0 items' in result.stdout.str()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_ignores(self, tmpdir):\n from pytest_flake8 import Ignorer\n ignores = [\"E203\", \"b/?.py E204 W205\", \"z.py ALL\", \"*.py E300\"]\n ign = Ignorer(ignores)\n assert ign(tmpdir.join(\"a/b/x.py\")) == \"E203 E204 W205 E300\".split()\n assert ign(tmpdir.join(\"a/y.py\")) ...
[ "0.6660005", "0.65271", "0.65220445", "0.65069795", "0.647737", "0.64352024", "0.6418844", "0.6398018", "0.6337415", "0.63184345", "0.62890404", "0.6280407", "0.6254679", "0.62285435", "0.62222445", "0.6191297", "0.61861604", "0.6169513", "0.61429274", "0.61065453", "0.607658...
0.8053008
0
Find if any of the necessary columns is missing.
def missing_cnames(keys, id_info, n1, n2): missing = [] if 'A1' not in keys: missing.append('A1') if 'A2' not in keys: missing.append('A2') if 'FREQ' not in keys: missing.append('FREQ') if 'PVAL' not in keys: missing.append...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_missing_columns(self, df: pd.DataFrame) -> None:\n if any([c not in df.columns for c in REQUIRED_COLUMNS]):\n raise ValueError(\"Missing columns in dataset.\"\n f\"Columns: {df.columns}\"\n f\"Required: {REQUIRED_COLUMNS}\")", "...
[ "0.7822811", "0.7422394", "0.7312158", "0.71731734", "0.71572804", "0.7135493", "0.71284467", "0.71168804", "0.70076966", "0.6978213", "0.69319355", "0.69158", "0.6911932", "0.69074", "0.68276256", "0.67562926", "0.6752936", "0.6716362", "0.6716142", "0.6690497", "0.6653387",...
0.0
-1
Helper function to convert the GPS coordinates stored in the EXIF to degress in float format Credit should be provided to Shadab Zafar; see his GitHub at
def convert_to_degress(coords): deg_num, deg_denom = coords[0] d = float(deg_num) / float(deg_denom) min_num, min_denom = coords[1] m = float(min_num) / float(min_denom) try: sec_num, sec_denom = coords[2] s = float(sec_num) / float(sec_denom) except: s = 0 return d +...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gpgga_convert(line):\r\n gps = line.strip().split(',')\r\n #check data\r\n if gps[6] == '0' :\r\n return\r\n fix = ''\r\n if gps[6] == '1':\r\n fix = 'GPS fix'\r\n elif gps[6] == '2':\r\n fix = 'DGPS fix'\r\n elif gps[6] == '4':\r\n fix = 'RTK Fix coordinate (ce...
[ "0.6519064", "0.62566316", "0.623028", "0.62016505", "0.6142473", "0.6097619", "0.6086657", "0.60509866", "0.60309225", "0.58306843", "0.5818007", "0.5792472", "0.57810926", "0.5772296", "0.5742953", "0.5655785", "0.56552273", "0.5654406", "0.5640235", "0.5617369", "0.5602711...
0.6291264
1
Convert scaled cartesian(pixel) coordinates to meters.
def cart_to_meter(self, cart): return cart*(1/self.scale)*149.6e9
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _scale_coord_to_meters(coord, unit):\n if unit == 'cm':\n return np.divide(coord, 100.)\n elif unit == 'mm':\n return np.divide(coord, 1000.)\n else:\n return coord", "def get_meters_to_pixels_coefficient():\n return 1/get_pixels_to_meters_coefficient()", "def get_pixels_to...
[ "0.75752723", "0.6885372", "0.6661794", "0.6323358", "0.6304097", "0.62288845", "0.61410064", "0.6107134", "0.6104705", "0.6100342", "0.60742164", "0.6067959", "0.6066549", "0.6030294", "0.6021496", "0.6005743", "0.5973274", "0.59663224", "0.5918063", "0.59044176", "0.5903014...
0.5551626
66
Get the euclidean distance from the first object to the second object.
def distance(self, second_object): # r = (dx^2+dy^2)^1/2 point_1, point_2 = self.xy, second_object.xy delta_x, delta_y = self.sub(point_1, point_2)[:] squared_sum = pow(delta_x, 2) + pow(delta_y, 2) return math.sqrt(squared_sum)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _object_distance(self, object1, object2):\n return np.linalg.norm(np.array(object1) - np.array(object2))", "def EuclideanDistance( self, a, b ):\n return sqrt( self.EuclideanDistanceSq(a,b) )", "def euclidean(self, other):\n return linalg.norm([self.x - other.x, self.y - other.y])", ...
[ "0.8218753", "0.7764905", "0.77611756", "0.7723633", "0.7679719", "0.76154447", "0.76110363", "0.75457853", "0.7543906", "0.754331", "0.75339997", "0.7530204", "0.75205284", "0.7509254", "0.74918556", "0.74917275", "0.74909556", "0.7483586", "0.74787", "0.747429", "0.74679035...
0.770385
4
Get the euclidean distance from the first object to the second object. Where A,B are the objects and C is the origin.
def polar_distance(self, second_object): # (r1^2 + r2^2 -2r1r2cos(theta2-theta1))^1/2 r1, r2 = self.r, second_object.r theta1, theta2 = self.theta, second_object.theta return math.sqrt(pow(r1, 2)+pow(r2, 2)-(2*r1*r2*math.cos(theta1-theta2)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def distance(self, c1, c2):\r\n x = (c2.x - c1.x) ** 2\r\n y = (c2.y - c1.y) ** 2\r\n d = int(round(math.sqrt(x + y)))\r\n return d", "def EuclideanDistance( self, a, b ):\n return sqrt( self.EuclideanDistanceSq(a,b) )", "def _object_distance(self, object1, object2):\n ...
[ "0.72549933", "0.7158382", "0.71512574", "0.7064052", "0.70221317", "0.6985068", "0.69299626", "0.6923879", "0.6895317", "0.6862013", "0.68605095", "0.6843013", "0.6806993", "0.6798918", "0.6778593", "0.6778197", "0.6759996", "0.6752403", "0.67480534", "0.67451084", "0.672808...
0.0
-1
Convert dict values whether the MassObject is a Star or Planet.
def convert_by_type(self): if isinstance(self, Star): self.name = self.hostname # https://stackoverflow.com/questions/11637293/iterate-over-object-attributes-in-python # returns list in alphabetical order star_attr_list = list(filter(lambda attr: attr.startswith('...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def type_object(self, json):\n json_prop = _utils.json_prop_finder(json)\n d = {k: (self.switcher(v)) for k, v in json_prop.items()}\n return d", "def _filter_from_dict(cls, nm, val):\n #Any necessary filtering place here.\n return val", "def coerce_type(cls, obj, typedef=Non...
[ "0.5116889", "0.47760916", "0.47492072", "0.4715691", "0.4676936", "0.46023944", "0.45936465", "0.4556103", "0.45482776", "0.45353255", "0.45342618", "0.45180166", "0.44865373", "0.4481617", "0.44474557", "0.44325104", "0.4429706", "0.44235143", "0.43934855", "0.4381878", "0....
0.5944538
0
Pad and/or crop arrays to the target_shape.
def to_shape(arr, target_shape, constant_values=0): # pad padded = pad(arr, target_shape) # crop if padded.shape != target_shape: cropped = crop(padded, target_shape) else: cropped = padded return cropped
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def crop_and_pad(data, offset, crop_shape, target_shape=None):\n # Spatial dimensions only. All vars in zyx.\n shape = np.array(data.shape[1:])\n crop_shape = np.array(crop_shape)\n offset = np.array(offset[::-1])\n\n start = shape // 2 - crop_shape // 2 + offset\n end = start + crop_shape\n\n ...
[ "0.75617516", "0.70995224", "0.6884246", "0.6737726", "0.66584015", "0.65415853", "0.64242727", "0.63552386", "0.6346563", "0.6314466", "0.6273246", "0.6270005", "0.62194616", "0.6076012", "0.6064961", "0.60194033", "0.60142475", "0.6005179", "0.5884903", "0.5869745", "0.5800...
0.68782663
3
Returns the name of the frame.
def __str__(self): return self.name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_frame_name(self, frame):\n if isinstance(frame, str):\n name = frame\n frame_obj = None\n else:\n name = frame.name\n frame_obj = frame\n return name, frame_obj", "def current_frame(self) -> str:\n return self.frames[self.frame]", ...
[ "0.8369688", "0.7333218", "0.71754104", "0.7110992", "0.7103778", "0.70316106", "0.7027147", "0.70113933", "0.70037264", "0.69918036", "0.69820625", "0.6979119", "0.6970999", "0.6970999", "0.6963851", "0.6963851", "0.6963851", "0.6928259", "0.6928259", "0.6928259", "0.6928259...
0.0
-1
Angular velocity from time differentiating the DCM.
def _w_diff_dcm(self, otherframe): dcm2diff = self.dcm(otherframe) diffed = dcm2diff.diff(dynamicsymbols._t) angvelmat = diffed * dcm2diff.T w1 = trigsimp(expand(angvelmat[7]), recursive=True) w2 = trigsimp(expand(angvelmat[2]), recursive=True) w3 = trigsimp(expand(angvel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_velocity(self):\n return self.momentum/self.mass", "def v(self):\n\n # TODO This translation formula works, but needs simplified.\n\n # PWM duration can go from 0 to 4095 with 4095 representing max rpm\n# print(\"MuleBot.v MuleBot.dcMotorPWMDurationLeft:\", MuleBot.dcMotorPWMDurati...
[ "0.74199235", "0.6834787", "0.68338704", "0.67636055", "0.6746827", "0.6737451", "0.6729522", "0.66017", "0.6597965", "0.6597965", "0.655545", "0.655545", "0.6520254", "0.65160376", "0.6490917", "0.645098", "0.64358526", "0.6412211", "0.64033484", "0.64019823", "0.6352831", ...
0.0
-1
The basis Vector for the ReferenceFrame, in the x direction.
def x(self): return self._x
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def xvec(self):\n return self._xvec", "def xvec(self):\n return np.array([self.x, self.y])", "def vec_x(self):\t\r\n if self.ox != 0:\r\n ov = self.ox\r\n lv = self.self.lx + self.ox\r\n else:\r\n ov = self.dx / 2\r\n lv = self.lx\r\n\r\n ...
[ "0.7242801", "0.6769814", "0.6713066", "0.65755904", "0.65521055", "0.6546732", "0.6546732", "0.6546732", "0.6546732", "0.6546732", "0.6546732", "0.6546732", "0.6546732", "0.6546732", "0.6546732", "0.6546732", "0.65263635", "0.6486227", "0.64393926", "0.63983124", "0.63919467...
0.6527042
25
Dot product of two vectors. Returns a scalar, the dot product of the two Vectors
def __and__(self, other): if isinstance(other, Dyadic): return NotImplemented if isinstance(other, (int, type(Zero()))): if (other == 0): return 0 self._check_vector(other) out = 0 for i, v1 in enumerate(self.args): for j, v2 i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dot(a, b):\n\n if len(a) != len(b):\n raise Exception(\"Input vectors must be of same length, not %d and %d\" % (len(a), len(b)))\n\n return float(sum([a[i] * b[i] for i in range(len(a))]))", "def vector_dot(v1,v2):\n return (v1.x * v2.x) + (v1.y * v2.y) + (v1.z * v2.z)", "def d...
[ "0.8819876", "0.87070405", "0.8691697", "0.8616885", "0.85060126", "0.8501166", "0.8447608", "0.84206825", "0.83897597", "0.83206546", "0.8295195", "0.8284663", "0.82804775", "0.82742095", "0.82440645", "0.8190228", "0.8184029", "0.81687754", "0.81475747", "0.8125825", "0.808...
0.0
-1
Tests for equality. It is very import to note that this is only as good as the SymPy equality test; False does not always mean they are not equivalent Vectors. If other is 0, and self is empty, returns True. If other is 0 and self is not empty, returns False. If none of the above, only accepts other as a Vector.
def __eq__(self, other): if isinstance(other, (int, type(Zero()))): if other == 0: if self.args == []: return True else: return False frame = self.args[0][1] for v in frame: if expand((self - other)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n if not isinstance(other, Vector):\n return False\n elif len(self) != len(other):\n return False\n else:\n for i, element in enumerate(self):\n if element != other[i]:\n return False\n return Tr...
[ "0.80085003", "0.7977445", "0.776991", "0.7744191", "0.7563931", "0.74838436", "0.7351986", "0.7316408", "0.7289261", "0.7263071", "0.7252504", "0.72154444", "0.71717554", "0.71571594", "0.7148751", "0.71311533", "0.7118212", "0.7107681", "0.70838404", "0.7074995", "0.703818"...
0.75882626
4
Outer product between two Vectors. A rank increasing operation, which returns a Dyadic from two Vectors
def __or__(self, other): if isinstance(other, (int, type(Zero()))): if (other == 0): return 0 ol = 0 for i, v in enumerate(self.args): for i2, v2 in enumerate(other.args): # it looks this way because if we are in the same frame and ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _outer(a, b):\n a_flat = torch.reshape(a, [-1])\n b_flat = torch.reshape(b, [-1])\n a_mul = torch.unsqueeze(a_flat, dim=-1)\n b_mul = torch.unsqueeze(b_flat, dim=0)\n return a_mul * b_mul", "def outer_product(u: Vector3D, v: Vector3D):\n cx = u.y * v.z - u.z * v.y\n cy = u.z * v.x - u.x ...
[ "0.7183821", "0.7093083", "0.70254904", "0.7010022", "0.69274276", "0.69010556", "0.6791887", "0.67537594", "0.67448515", "0.66924965", "0.6679322", "0.66614926", "0.6650136", "0.6640677", "0.66362613", "0.6635032", "0.6634201", "0.663162", "0.6620782", "0.66176736", "0.65932...
0.0
-1
Outer product between two Vectors. A rank increasing operation, which returns a Dyadic from two Vectors
def __ror__(self, other): if isinstance(other, (int, type(Zero()))): if (other == 0): return 0 ol = 0 for i, v in enumerate(other.args): for i2, v2 in enumerate(self.args): # it looks this way because if we are in the same frame and ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _outer(a, b):\n a_flat = torch.reshape(a, [-1])\n b_flat = torch.reshape(b, [-1])\n a_mul = torch.unsqueeze(a_flat, dim=-1)\n b_mul = torch.unsqueeze(b_flat, dim=0)\n return a_mul * b_mul", "def outer_product(u: Vector3D, v: Vector3D):\n cx = u.y * v.z - u.z * v.y\n cy = u.z * v.x - u.x ...
[ "0.7183821", "0.7093083", "0.70254904", "0.7010022", "0.69274276", "0.69010556", "0.6791887", "0.67537594", "0.67448515", "0.66924965", "0.6679322", "0.66614926", "0.6650136", "0.6640677", "0.66362613", "0.6635032", "0.6634201", "0.663162", "0.6620782", "0.66176736", "0.65932...
0.0
-1
The cross product operator for two Vectors. Returns a Vector, expressed in the same ReferenceFrames as self.
def __xor__(self, other): if isinstance(other, Dyadic): return NotImplemented if isinstance(other, (int, type(Zero()))): if (other == 0): return self * 0 self._check_vector(other) def _det(mat): """This is needed as a little method fo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cross_product(v1, v2):\n return cg3d_vector.CG3dVector(\n v1[1] * v2[2] - v2[1] * v1[2],\n v1[2] * v2[0] - v2[2] * v1[0],\n v1[0] * v2[1] - v2[0] * v1[1]\n )", "def vec_cross(a,b):\r\n return [a[1] * b[2] - a[2] * b[1],\r\n a[2] * b[0] - a[0] * b[2],\r\n a[0] * b...
[ "0.8022938", "0.7648134", "0.76453465", "0.76379716", "0.7629677", "0.7593697", "0.7508802", "0.74952036", "0.7380531", "0.7368932", "0.73678005", "0.73607415", "0.73172784", "0.7301514", "0.72707945", "0.72682405", "0.7258329", "0.717449", "0.70939696", "0.70936835", "0.6976...
0.0
-1
Takes the partial derivative, with respect to a value, in a frame. Returns a Vector.
def diff(self, wrt, otherframe): wrt = sympify(wrt) self._check_frame(otherframe) outvec = 0 for i,v in enumerate(self.args): if v[1] == otherframe: outvec += Vector([(v[0].diff(wrt), otherframe)]) else: if otherframe.dcm(v[1]).dif...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def partial_derivative(f, x, i, epsilon = 1e-10):\n x_ = np.copy(x).astype(np.float64)\n x_[i] = x_[i] + epsilon\n value = (f(x_) - f(x)) / epsilon\n\n return value", "def partial_derivative(self, parameter_location):\n self.decrement_parameter(parameter_location)\n cost_minus = self.ev...
[ "0.6235845", "0.61193913", "0.60853386", "0.60321593", "0.6001975", "0.59817106", "0.58814836", "0.58276063", "0.5806664", "0.5769111", "0.5747946", "0.57321984", "0.57231957", "0.569028", "0.5655643", "0.5654672", "0.56244695", "0.55859864", "0.55858517", "0.5581309", "0.555...
0.57373166
11
Get an item's actions
async def get(self): identifier = self.data["id"] item = self.core.item_manager.items.get(identifier) if not item: return self.error( ERROR_ITEM_NOT_FOUND, f"No item found with identifier {identifier}", status_code=404) return self.json(data=l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_actions(self):\n return self.__actions", "def _get_actions(self):\n return self.__actions", "def _get_actions(self):\n return self.__actions", "def actions(self):\n\n return self._actions.getSlice(0)", "def actions(self):\n\n return self._actions.getSlice(0)", "def get_act...
[ "0.771191", "0.771191", "0.771191", "0.7564696", "0.7564696", "0.75126946", "0.7511395", "0.747851", "0.74079055", "0.7407572", "0.73455685", "0.73108536", "0.7241769", "0.7194355", "0.71205", "0.7096199", "0.7051991", "0.70357805", "0.70316327", "0.70104027", "0.69959944", ...
0.71455306
14
Display warning message if any visible field is over 10 characters
def checkFieldMappings(self, param): field_mappings = param.value over_fields = [] fields_warning = ('The following visible field name(s) are' + ' over 10 characters and will be shortened' + ' automatically by ArcGIS: ') for idx, val in e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def longer_than_9(value):\n if len(value) < 10:\n raise forms.ValidationError('must be 10 characters or longer')", "def maximum():\n if len(a_variable.get()) > MAX_CHARACTERS:\n messagebox.showwarning(title=\"Max Characters Exceeded!\",\n message=\"Please enter n...
[ "0.67056227", "0.64707416", "0.6428869", "0.6280038", "0.6277701", "0.62682676", "0.62303287", "0.61498153", "0.6140683", "0.6083782", "0.60633796", "0.6007124", "0.59852815", "0.5978114", "0.597788", "0.59609306", "0.5920768", "0.5894185", "0.58880126", "0.5877196", "0.58591...
0.68496585
0
Returns the value to which the specified key is mapped, or 1 if this map contains no mapping for the key
def get(self, key: int) -> int: index = key % self.size if self.table[index].value is None: return -1 p = self.table[index] while p: if p.key == key: return p.value p = p.next return -1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(self, key: int) -> int:\n if key not in self.map:\n return -1\n return self.map[key]", "def get(self, key: int) -> int:\n if key in self.hashmap.keys():return self.hashmap[key]\n else:return -1", "def get(self, key: int) -> int:\n sh = key % 37\n if ...
[ "0.800388", "0.79098475", "0.762993", "0.75650334", "0.7556994", "0.7529803", "0.75259614", "0.7493149", "0.73738897", "0.7294419", "0.72940016", "0.72216845", "0.72175443", "0.7181078", "0.71774393", "0.71633786", "0.69289523", "0.67850846", "0.6757027", "0.6734023", "0.6612...
0.6980779
16
Get a list of all vertices of odd degree
def get_odd_vertices(adj_dict): return [i for i in adj_dict.keys() if len(adj_dict[i]) % 2]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_odd_degree_vertices(graph):\n odd_degree_vertices = set()\n for index, row in enumerate(graph):\n if len(np.nonzero(row)[0]) % 2 != 0:\n odd_degree_vertices.add(index)\n return odd_degree_vertices", "def _get_odd_degree_vertices(graph):\n odd_degree_vertices = set()\n fo...
[ "0.7936769", "0.7936769", "0.68447375", "0.68404067", "0.6682904", "0.6609355", "0.6450921", "0.6448852", "0.6432562", "0.6414457", "0.6359105", "0.63163435", "0.6303917", "0.62948227", "0.6271524", "0.6264688", "0.62631893", "0.6249163", "0.6233775", "0.6188853", "0.6185776"...
0.7429046
2
Tears Down temporary directory.
def tearDown(self): if 'turbinia-test-tmp' in self.tmp_dir: shutil.rmtree(self.tmp_dir)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tearDown(self):\n \tshutil.rmtree(self.tempdir)", "def teardown(self):\n os.chdir(self.cwd)\n try:\n shutil.rmtree(self.t)\n except (OSError, IOError):\n pass", "def teardown(cls):\n os.chdir(cls.cwd)\n try:\n shutil.rmtree(cls.t)\n ...
[ "0.7408111", "0.73649615", "0.729093", "0.7284201", "0.72573054", "0.7156851", "0.7132619", "0.7132619", "0.7124247", "0.7102784", "0.70977116", "0.7094485", "0.7072223", "0.7069847", "0.7042424", "0.70178497", "0.6974536", "0.697444", "0.69596314", "0.69573385", "0.69140303"...
0.72303295
5
Mock all setup requests.
def mock_all(aioclient_mock): aioclient_mock.post("http://127.0.0.1/homeassistant/options", json={"result": "ok"}) aioclient_mock.get("http://127.0.0.1/supervisor/ping", json={"result": "ok"}) aioclient_mock.post("http://127.0.0.1/supervisor/options", json={"result": "ok"}) aioclient_mock.get( "...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setUp(self):\n self.hass = get_test_home_assistant()\n with requests_mock.Mocker() as mock_req:\n self.setup_api(MOCK_DATA, mock_req)\n self.addCleanup(self.hass.stop)", "def setUp(self):\n util.create_mocks()", "def setUp(self):\n util.create_mocks()", "def ...
[ "0.76195717", "0.75635254", "0.75635254", "0.75635254", "0.75635254", "0.75635254", "0.75635254", "0.7529264", "0.7515509", "0.739931", "0.7307985", "0.7300536", "0.72621953", "0.7132087", "0.7106198", "0.71028906", "0.7035394", "0.7033378", "0.7011945", "0.69968194", "0.6985...
0.0
-1
Trims geo hash precision.
def trim_geo_hash_precision(hashed_values, precision=9): return hashed_values.map(lambda z: z[:precision])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trim_hash(info_hash):\n if len(info_hash) == 40:\n return info_hash.decode(\"hex\")\n if len(info_hash) != 20:\n raise TrackerRequestException(\"Infohash not equal to 20 digits\", info_hash)\n return info_hash", "def _drop_float_precision(dict_obj, point):\n for keyword in dict_obj....
[ "0.6078657", "0.5753723", "0.56945646", "0.5564992", "0.5555545", "0.52409023", "0.5236711", "0.51736164", "0.5101692", "0.5101692", "0.50819415", "0.50115305", "0.5008651", "0.49142992", "0.48787796", "0.48226616", "0.47997087", "0.4771842", "0.47706035", "0.47568038", "0.47...
0.7879478
0
Filters out rare points. All points with occurrences <= threshold_pct is considerd as rare points. All rare points are replaced by pd.NaN
def filter_out_rare_points(points, threshold_pct=0.5): c = Counter(points) total = sum(c.values()) l = [] for p in points: v = c[p] if v/total * 100 <= threshold_pct: l.append(np.nan) else: l.append(p) return l
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _remove_non_informative_rows(self, df, threshold):\n df_tmp = pd.DataFrame()\n n_features = len(df.columns)\n # calculating ratio of rows that have more than \"ratio\" missing values\n df_tmp['ratio'] = df.apply(lambda row: row.isnull().sum()/n_features, axis='columns')\n\n #...
[ "0.62121165", "0.61778045", "0.58903354", "0.58715844", "0.581941", "0.5791742", "0.57808405", "0.5721365", "0.5705087", "0.5701252", "0.56888807", "0.5667603", "0.5644269", "0.5619091", "0.55940944", "0.5568954", "0.5567465", "0.5541601", "0.54963857", "0.54700625", "0.54503...
0.77344453
0
Rolls a number between 1 and 5 and then maps it to an area of the body for the hit
def shotFinder(self, targetArray): # Roll a d5 and then map the result to the targetArray. # Return the value from the target array and remove it from the current character's targetArray value in the db # Roll random number result = random.randint(0,5) # Get part of body based ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def roll(self, ctx, upper_bound=20 #type: int\r\n ):\r\n msg = random.randint(1,int(upper_bound))\r\n if msg == upper_bound:\r\n msg = \"***Critical Hit!*** \" + str(msg)\r\n elif msg == 1:\r\n msg = \"***Critical Fail!*** \" + str(msg)\r\n\r\n ...
[ "0.59989065", "0.5804073", "0.56641084", "0.5646826", "0.5646826", "0.5645203", "0.56361014", "0.5609528", "0.5605427", "0.559421", "0.55779797", "0.5561967", "0.55037475", "0.5492188", "0.5480399", "0.54688543", "0.545357", "0.54532135", "0.54532135", "0.54532135", "0.545321...
0.5193124
50
Implements the PyTorch nn.Module abstract method to compute the output of a neural network given an input In this case it computes the value of a given state
def forward(self, state): x = F.relu(self.linear1(state)) x = F.relu(self.linear2(x)) x = self.linear3(x) return x
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forward(self, state):\n\n # forward propagate through hidden layers\n x = self.leakyrelu(self.linear1(state))\n x = self.leakyrelu(self.linear2(x))\n\n # compute outputs from output layer\n meanX = torch.sigmoid(self.mean_linearX(x)).reshape(-1,1,self.output_size)\n ...
[ "0.7208016", "0.700478", "0.6901941", "0.68438697", "0.6832191", "0.68148136", "0.6802235", "0.6733467", "0.67268056", "0.66938263", "0.66779804", "0.6658126", "0.6648659", "0.66425574", "0.66417456", "0.66405815", "0.6624771", "0.660121", "0.65799737", "0.65686315", "0.65673...
0.6542313
24