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
Normal distribution upper confidence bound.
def normal_upper_confidence_bound(mean, stddev, exploration=0.01): dtype = dtype_util.common_dtype([mean, stddev]) mean = tf.convert_to_tensor(mean, dtype=dtype) stddev = tf.convert_to_tensor(stddev, dtype=dtype) return mean + exploration * stddev
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normal_upper_bound(probability: float, mu: float = 0, sigma: float = 1) -> float:\n return inverse_normal_cdf(probability, mu, sigma)", "def normal_upper_bound(probability: float,\n mu: float = 0,\n sigma: float = 1) -> float:\n return inverse_normal_cdf(prob...
[ "0.78890866", "0.7762559", "0.7672157", "0.7672157", "0.7672157", "0.7672157", "0.7672157", "0.7650126", "0.733106", "0.7062492", "0.6937367", "0.68465424", "0.66980326", "0.66980326", "0.6690994", "0.6661956", "0.6661956", "0.6628589", "0.66065615", "0.6594629", "0.6575422",...
0.7093311
9
Recreate a player from the converted dict.
def player_from_raw(data: Dict[str, Any]) -> andesite.Player: return build_from_raw(andesite.Player, data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_player(dct, player_name, place):\n dct.update({player_name: ['N/A'] * place})", "def decode_player(obj):\n player_dict = copy.deepcopy(obj)\n\n zones = ('hand', 'stockpile', 'clientele', 'vault', 'camp',\n 'revealed', 'prev_revealed', 'clients_given')\n\n for k in zones:\n ...
[ "0.5985478", "0.5958255", "0.58619446", "0.5637327", "0.5588873", "0.55067104", "0.5344198", "0.53193796", "0.52757215", "0.52573746", "0.52327466", "0.5214823", "0.51930976", "0.5180022", "0.51657265", "0.51657265", "0.51657265", "0.51657265", "0.51657265", "0.51657265", "0....
0.6593805
0
ID of the guild the player is for.
def guild_id(self) -> int: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def get_guild(self, workspace_id) -> Guild:\n guild = await self.client.fetch_guild(workspace_id)\n return guild", "def getID(self):\n return self.__clubDbID", "def get_player_id(self):\n return self.game.get_player_id()", "def get_player_id(self):\n\n return self.pla...
[ "0.6565341", "0.6551406", "0.6501672", "0.63115156", "0.6294973", "0.62474155", "0.6172682", "0.6123099", "0.6115734", "0.6113979", "0.6087302", "0.60729486", "0.6025033", "0.6004576", "0.59758824", "0.59622085", "0.59281063", "0.58960116", "0.58839184", "0.5858213", "0.58396...
0.8896399
0
Set the current player.
async def set_player(self, player: Optional[andesite.Player]) -> None: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_player(self, new_player):\n self.player = new_player", "def setCurrentPlayer(self):\n self.current_player = next(self.get_player_order_fn())", "def set_player(self, player):\n\n self._player = player", "def switch_player(self):\n self.player = Nim.other_player(self.player)...
[ "0.8161119", "0.8081071", "0.80300945", "0.74764556", "0.74496865", "0.7331589", "0.7142709", "0.68288815", "0.6709654", "0.6681947", "0.6494975", "0.64515156", "0.64227533", "0.639932", "0.6372522", "0.63118595", "0.63118595", "0.6310514", "0.63098925", "0.6298178", "0.62874...
0.78743666
3
Get the currently playing track.
async def get_track(self) -> Optional[str]: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def track(self):\n track_id = RPR.GetMediaItemTake_Track(self.id)\n return reapy.Track(track_id)", "async def get_now_playing(self) -> models.MediaItem: # FIXME: Maybe want to abstract MediaItem out\n return await self._pytheos.api.player.get_now_playing_media(self.id)", "def current_t...
[ "0.7227749", "0.70738524", "0.69759566", "0.69692236", "0.69311875", "0.68480384", "0.67908925", "0.6764343", "0.67546904", "0.6741011", "0.66894937", "0.665879", "0.66355926", "0.6615466", "0.66150486", "0.66149443", "0.6596855", "0.65687454", "0.6566484", "0.65569526", "0.6...
0.6788053
7
Convert the player state into a JSONserialisable dict. Use the classmethod `from_raw` to recreate a `PlayerState` using the returned data.
def to_raw(self) -> Dict[str, Any]: if self._player: raw_player = player_to_raw(self._player) else: raw_player = None if self._voice_server_update: raw_voice_server_update = voice_server_update_to_raw(self._voice_server_update) else: raw_v...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_state_json(self) -> Dict[str, Any]:\n return self.state_to_json()", "def to_json(self) -> Dict[str, Any]:\n return json.loads(self.get_state().to_json())", "def state_to_json(self) -> Dict[str, Any]:\n return self.rstate.to_json()", "def get_state(self):\n return {\n ...
[ "0.7115854", "0.6869605", "0.6858995", "0.66283935", "0.64958495", "0.64927536", "0.6430233", "0.642558", "0.63665795", "0.63351387", "0.62431335", "0.62391585", "0.6225019", "0.620804", "0.6172001", "0.61397386", "0.6037163", "0.5898714", "0.58871627", "0.5877527", "0.586113...
0.623264
12
Set a value in a nested object in root by item sequence.
def set_by_path(root, items, value): get_by_path(root, items[:-1])[items[-1]] = value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def put(self, item, value, set_doc):\n if item is None:\n raise Exception(\"call __setitem__ with None argument\")\n else:\n self.size += 1\n self.root = self.set(self.root, item, int(value), 0, set_doc)", "def set(self, path, value):\n pth = self._path[:]\n ...
[ "0.7220116", "0.6572795", "0.65141845", "0.6504848", "0.6418833", "0.64119226", "0.63725597", "0.6364336", "0.63441783", "0.6230382", "0.6224986", "0.6129438", "0.61212057", "0.61185116", "0.6096588", "0.60955817", "0.6079809", "0.60643834", "0.6047553", "0.60131806", "0.6007...
0.68911654
1
Compute the geographic area (in square meters) of every pixel in the data array provided.
def compute_grid_area(da): dϕ = np.radians((da["lat"][1] - da["lat"][0]).values) dλ = np.radians((da["lon"][1] - da["lon"][0]).values) dA = R ** 2 * np.abs(dϕ * dλ) * np.cos(np.radians(da["lat"])) areacella = dA * (0 * da + 1) return areacella / SQM_PER_HA
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_area(geo_data):\n return geo_data[\"geometry\"].area", "def area(self):\n return np.array([f.area() for f in self])", "def calculate_area(building, pixel_size=1):\n return len(building.points) * (pixel_size**2)", "def extract_area(self, pixel_geometry):\n\t\tarea = self.__dataset__.e...
[ "0.67239994", "0.64990187", "0.63126755", "0.6285519", "0.62659496", "0.62600255", "0.6257421", "0.6255886", "0.62127835", "0.6194535", "0.6164957", "0.61572504", "0.6141738", "0.61033225", "0.61003405", "0.60933846", "0.60916245", "0.6091594", "0.60729885", "0.60664797", "0....
0.60821897
18
Normalises words to lowercase and stems and lemmatizes it.
def normalise(word): word = word.lower() word = stemmer.stem_word(word) word = lemmatizer.lemmatize(word) return word
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalise(word):\n\t\tword = word.lower()\n\t\tword = lemmatizer.lemmatize(word)\n\t\t# word = stemmer.stem_word(word)\n\t\treturn word", "def _normalize(self, word):\n return self.lemmatize(word.lower())", "def normalise(word):\n\tword = word.lower()\n\t# word = stemmer.stem_word(word) #if we consi...
[ "0.80522954", "0.7810233", "0.7518118", "0.74736536", "0.7466765", "0.7211377", "0.7211377", "0.71893823", "0.7140793", "0.7126806", "0.70805144", "0.7058325", "0.6883196", "0.6880236", "0.68394816", "0.6808203", "0.6767005", "0.67662984", "0.6756388", "0.67530596", "0.673774...
0.79710925
1
Given two dicts, merge them into a new dict as a shallow copy.
def merge_two_dicts(x, y): z = x.copy() z.update(y) return z
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mergedict(x, y):\n z = x.copy()\n z.update(y)\n return z", "def merge_dicts(dict_a, dict_b):\n dict_c = dict_a.copy()\n dict_c.update(dict_b)\n return dict_c", "def merge_two_dicts(x, y):\n\tz = x.copy()\n\tz.update(y)\n\treturn z", "def merge_two_dicts(x, y):\r\...
[ "0.8501846", "0.84466875", "0.84402865", "0.84311867", "0.8428829", "0.83499664", "0.83499664", "0.83499664", "0.82086074", "0.81884646", "0.81880224", "0.81880224", "0.8082591", "0.799002", "0.7988879", "0.77437025", "0.77145404", "0.7666824", "0.76343286", "0.7631216", "0.7...
0.8383174
8
Load the pretrained ResNet152 and replace top fc layer.
def __init__(self, embed_size): super(EncoderCNN, self).__init__() resnet = models.resnet152(pretrained=True) modules = list(resnet.children())[:-1] # delete the last fc layer. self.resnet = nn.Sequential(*modules) self.linear = nn.Linear(resnet.fc.in_features, embed_size) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resnet152(pretrained=False, **kwargs):\n model = ResNet(Bottleneck, [3, 8, 36, 3], **kwargs)\n if pretrained:\n model.load_state_dict(model_zoo.load_url(model_urls['resnet152']))\n fc = transfer_fc(model.fc)\n model.fc = fc\n return model", "def resnet152(pretrained=False):\n model =...
[ "0.7173052", "0.6806408", "0.67975897", "0.67849594", "0.67489475", "0.67489475", "0.67489475", "0.67489475", "0.67324644", "0.6507087", "0.6507087", "0.64752775", "0.63904417", "0.62846625", "0.62234324", "0.61872536", "0.6139846", "0.61031175", "0.6084447", "0.60670197", "0...
0.0
-1
Sets the duty cycle for a given pwm pin
def duty(self, index, value=None, invert=False): raise NotImplementedError()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_duty_cycle(self, pin, dutycycle):\n raise NotImplementedError", "def set_pwm(self, duty_cycle):\n PWM.set_duty_cycle(self.pwm_pin, duty_cycle)", "def set_PWM_dutycycle(user_gpio, dutycycle):\n return _u2i(_pigpio_command(_control, _PI_CMD_PWM, user_gpio, dutycycle))", "def set_led(sel...
[ "0.8017969", "0.79765433", "0.73637307", "0.73127794", "0.72794235", "0.71954334", "0.69055986", "0.68803793", "0.67665154", "0.6711824", "0.6709129", "0.6702893", "0.662996", "0.6623714", "0.64086795", "0.62834936", "0.62673324", "0.6266835", "0.6262982", "0.6214931", "0.619...
0.55967426
51
Bad x_pts values in Rectangle should raise error.
def test_rectangle_validation_x_pts(self): for bad_x_pts in (1.2, Decimal(3), -1, 'hello'): self.assertRaises( ValueError, Rectangle, x_pts=bad_x_pts, y_pts=40, width_pts=100, height_pts=120, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_rectangle_validation_width_pts(self):\n for bad_width_pts in (1.2, Decimal(3), -1, 'hello'):\n self.assertRaises(\n ValueError,\n Rectangle,\n x_pts=10,\n y_pts=40,\n width_pts=bad_width_pts,\n heig...
[ "0.76121473", "0.7471551", "0.71438026", "0.71285534", "0.700506", "0.69217265", "0.690566", "0.6846208", "0.68286026", "0.6741739", "0.66597074", "0.64641076", "0.64544153", "0.64461464", "0.64368165", "0.64262223", "0.6375577", "0.63186926", "0.63015175", "0.6276635", "0.62...
0.8606928
0
Bad width_pts values in Rectangle should raise error.
def test_rectangle_validation_width_pts(self): for bad_width_pts in (1.2, Decimal(3), -1, 'hello'): self.assertRaises( ValueError, Rectangle, x_pts=10, y_pts=40, width_pts=bad_width_pts, height_pts=120, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_rectangle_validation_line_width_pts(self):\n for bad_line_width_pts in (1.2, Decimal(3), -1, 'hello'):\n self.assertRaises(\n ValueError,\n Rectangle,\n x_pts=10,\n y_pts=40,\n width_pts=100,\n heig...
[ "0.826341", "0.7695576", "0.7467558", "0.7388805", "0.7090293", "0.7025765", "0.69858956", "0.6954115", "0.6886466", "0.6809733", "0.67497337", "0.67350584", "0.66605884", "0.6639013", "0.66181296", "0.6446622", "0.6393169", "0.6366717", "0.6322232", "0.63024443", "0.6300844"...
0.867867
0
Load pretrain embedding from embedding_path
def load_pretrain_embedding(vocab, embed_size, embedding_path): model = KeyedVectors.load_word2vec_format(embedding_path) print('{} {}'.format(vocab.size(), embed_size)) for token, id in vocab.token2id.items(): if token in model: print('{} {}'.format(token, ' '.join(map(str, model[token...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_pretrained_embeddings(self, embedding_path):\n trained_embeddings = {}\n with open(embedding_path, 'r') as fin:\n for line in fin:\n contents = line.strip().split()\n token = contents[0]\n if token not in self.token2id:\n ...
[ "0.83851933", "0.8022761", "0.7967971", "0.75104725", "0.7356042", "0.73355716", "0.73013693", "0.7233546", "0.72129554", "0.704012", "0.6947509", "0.6934173", "0.6931675", "0.69144213", "0.69131625", "0.6801978", "0.67926615", "0.67625135", "0.6734187", "0.6732269", "0.67046...
0.8098588
1
Applies the binary operator elementwise on self and `other`. Given two structures of the same type, this function's job is to find corresponding pairs of elements within both structures, invoke `op` on each pair, and store the result in a corresponding location within a new structure. For example, to implement for a li...
def _apply_binary_op_elementwise( self: ConcreteStructuredMetricValue, other: ConcreteStructuredMetricValue, op: Callable[[float, float], float]) -> ConcreteStructuredMetricValue: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def binary_op(self, other):\n if (other is pstar\n or other is defaultpdict\n or other is frozenpset\n or other is pdict\n or other is plist\n or other is pset\n or other is ptuple\n ):\n if sys.version_info[0] < 3:\n name = op.__name__.replace('__', '...
[ "0.72542083", "0.7071522", "0.67241544", "0.66492856", "0.6399644", "0.6244016", "0.6203761", "0.62026745", "0.6135165", "0.6012099", "0.59789455", "0.5854918", "0.5846304", "0.58462644", "0.5836354", "0.58022803", "0.5797743", "0.57433593", "0.56871635", "0.5681461", "0.5625...
0.60483944
9
Returns the number of syllables in a CMU syllable string.
def num_syls(syls): return len([c for c in syls if c in ['0','1','2']])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def num_of_syllables(self, word):\n\n if word.lower() in self.cmu_dict:\n return len([phoneme for phoneme in self.cmu_dict[word.lower()][0]\n if phoneme[-1].isdigit()])\n # If word is unknown, assume 1 syllable/3 letters (average for English)\n else:\n ...
[ "0.7874941", "0.76152617", "0.7535013", "0.7435063", "0.73144597", "0.72565174", "0.72334653", "0.7074093", "0.704141", "0.70370847", "0.70336914", "0.7032525", "0.68680024", "0.6730484", "0.67279816", "0.66030407", "0.6575333", "0.6525462", "0.6206817", "0.61568224", "0.6040...
0.643138
18
View to show the register form.
def register(request): register_form = UserCreationForm() return render(request, 'metro_app/register.html', {'form': register_form})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_register_form():\n return render_template(\"register-form.html\")", "def register_form():\n\n return render_template(\"register.html\")", "def register_form():\n\n return render_template(\"register-form.html\")", "def registration_form():\n\n return render_template(\"/registration_form.h...
[ "0.82499194", "0.8249102", "0.82006705", "0.77152574", "0.7688426", "0.7603576", "0.74869686", "0.74200755", "0.73387915", "0.7313662", "0.72940564", "0.7224635", "0.7206933", "0.7184567", "0.71656907", "0.7151931", "0.71097904", "0.7102015", "0.7089146", "0.70660484", "0.705...
0.8150496
3
View to show the login form.
def login_view(request, login_error=False): login_form = LoginForm() context = { 'form': login_form, 'login_error': login_error, } return render(request, 'metro_app/login.html', context)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def login_form():\n\n return render_template(\"login_form.html\")", "def login():\n\n return render_template(\"login_form.html\")", "def get(self, request):\n form = LoginForm()\n context = {'form': form}\n return render(request, 'login.html', context)", "def display_loginpage():\...
[ "0.8040952", "0.8030783", "0.8021652", "0.77169514", "0.7716151", "0.77049774", "0.76490325", "0.76081496", "0.7576319", "0.7576319", "0.7545517", "0.7528079", "0.7477453", "0.7475224", "0.7465064", "0.74517506", "0.7430772", "0.7323334", "0.7308153", "0.7273397", "0.72679025...
0.75229144
12
Simple view to send the tutorial pdf to the user.
def tutorial(request): try: file_path = (settings.BASE_DIR + '/website_files/metropolis_tutorial.pdf') with open(file_path, 'rb') as f: response = HttpResponse(f, content_type='application/pdf') response['Content-Disposition'] = \ 'attachm...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vantechy(request):\n return FileResponse(open('/files/presentation.pdf', 'rb'))", "def generate_pdf(self):\n x = 100\n y = 100\n buffer = BytesIO()\n p = canvas.Canvas(buffer, pagesize=\"A4\")\n p.drawString(x, y, \"TO DO\")\n p.showPage()\n p.save()\n ...
[ "0.6588368", "0.6451209", "0.640698", "0.6326483", "0.6173198", "0.61058164", "0.6094422", "0.60768", "0.6065966", "0.59488285", "0.59171295", "0.59096575", "0.5812807", "0.57946324", "0.57906777", "0.5767496", "0.5765579", "0.5762387", "0.5762216", "0.57415116", "0.57289356"...
0.7865099
0
Get time formatted string for filenames.
def get_time(offset=0, with_second=True): today = datetime.datetime.now() - datetime.timedelta(seconds=offset) hour = str(today.hour) minute = str(today.minute) second = str(today.second) if with_second: return hour+'-'+minute+'-'+second else: return hour+'-'+minute
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getTimeToFileName(self):\n return self.sNow.strftime(\"%d-%m-%Y_%H-%M-%S\")", "def get_time_str(t):\r\n t = int(os.path.basename(t).split('.')[0])\r\n t_in_seconds = t / 1000\r\n ms = t % 1000\r\n time_str = time.strftime(\"%H:%M:%S\", time.localtime(t_in_seconds)) + \".\" + str(ms)\r\n return time_s...
[ "0.79162747", "0.77068114", "0.7396061", "0.72853833", "0.7098656", "0.70315593", "0.69150996", "0.6896584", "0.6816862", "0.6772872", "0.6726533", "0.6678515", "0.66381425", "0.6601334", "0.6556945", "0.64606667", "0.6446788", "0.6405249", "0.63947743", "0.6389193", "0.63752...
0.0
-1
Write dataframe into csv
def write_csv(data_frame, file_name): data_frame.coalesce(1).write \ .option('header', True).mode('overwrite') \ .save(f'outputs/{file_name}', format('csv'))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_tocsv(file_name, dataframe) :\n print(\"\\nSaved result to {}\\n\".format(file_name))\n dataframe.to_csv(file_name, mode='a', header=False,index=False)", "def save_df(data_frame, file_path):\r\n data_frame.to_csv(file_path)\r\n return None", "def write_csv(self):\n self.tableView.d...
[ "0.79074657", "0.7829002", "0.7824596", "0.78023225", "0.7793427", "0.77609843", "0.76459116", "0.7623478", "0.75945354", "0.7585702", "0.7569711", "0.7557535", "0.7545369", "0.75109977", "0.74789864", "0.7474551", "0.7377757", "0.73381555", "0.73088133", "0.72938526", "0.727...
0.7703188
6
The texture coordinates as an (N, 2) array of floats.
def texcoords(self): return self._texcoords
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getFloatArray2D(self) -> typing.List[typing.List[float]]:\n ...", "def coordinates(self):\n return np.array([[f.x, f.y] for f in self])", "def coords(self):\n return np.column_stack((self.x_coord_list, self.y_coord_list, self.z_coord_list))", "def convert_coords(self, coords):\n ...
[ "0.64712757", "0.6336339", "0.62435853", "0.624083", "0.6214205", "0.6164237", "0.61500317", "0.6138886", "0.610588", "0.60736877", "0.6045124", "0.59910476", "0.5953141", "0.5926862", "0.5924415", "0.5902371", "0.58768183", "0.58727086", "0.5868654", "0.5863764", "0.57926583...
0.6014617
12
Calculate the negative Levenshtein distance
def score( self, query_meta: Dict, old_match_scores: Dict, match_meta: Dict ) -> "np.ndarray": from Levenshtein import distance new_scores = [ ( match_id, -distance(query_meta['text'], match_meta[match_id]['text']), ) for m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def damerau_levenshtein_similarity(s1, s2):\n max_cost = max(len(s1), len(s2))\n\n if max_cost == 0:\n return 1.0\n\n return 1.0 - float(damerau_levenshtein_distance(s1, s2)) / max_cost", "def distance(str1, str2):\n return levenshtein.normalized_distance(str1, str2)", "def levenshtein_dista...
[ "0.7378068", "0.7116633", "0.71150064", "0.71104354", "0.70092446", "0.6998906", "0.6994253", "0.6947304", "0.682456", "0.67933464", "0.6761612", "0.6755038", "0.6748764", "0.6741169", "0.6727991", "0.6727991", "0.66243523", "0.6621512", "0.66049397", "0.65947527", "0.6535931...
0.0
-1
Retrieves appropriate figure file name.
def _get_plot_figure_name(self, output_folder=None, figure_name_appendix=""): if isinstance(output_folder, types.NoneType): # Sets up slices folder containing all euclidean times output_folder = os.path.join(self.output_folder_path, "slices") check_folder(output_folder, False, True) # Sets up euclidean ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_plotting_file_name(self):\n\t\treturn self.plotting_file_name", "def _getfilename(self):\n pass", "def get_file_name(self):\n return str(self.get_file())", "def make_figure_filename(self, ref, fname=None, fext='', fullpath=False):\n if not fname:\n fname = 'Chapter{}-F...
[ "0.7727675", "0.7301691", "0.71053356", "0.70466596", "0.7017463", "0.69359905", "0.6912477", "0.6898704", "0.68811244", "0.68077797", "0.6807766", "0.6799909", "0.6784805", "0.67776966", "0.67649823", "0.6758879", "0.6753873", "0.6721656", "0.6667691", "0.66297436", "0.66208...
0.7433505
1
Test that the monitoring endpoint returns something when no creds exist.
def test_google_service_account_monitor_none( client, app, encoded_jwt_service_accounts_access, monkeypatch ): encoded_creds_jwt = encoded_jwt_service_accounts_access["jwt"] test_file = None monkeypatch.setitem( config, "CIRRUS_CFG", {"GOOGLE_APPLICATION_CREDENTIALS": test_file} ) respo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_no_endpoint(self):\n self.os_fixture.v3_token.remove_service('monitoring')\n conn = self._get_conn()\n # Monasca is not in the service catalog\n self.assertRaises(\n ks_exc.catalog.EndpointNotFound, getattr, conn, 'monitoring'\n )", "def test_aiven_creds_exi...
[ "0.68448985", "0.6693848", "0.66610587", "0.65615463", "0.6538538", "0.64728713", "0.6472802", "0.6449334", "0.6424608", "0.640004", "0.6396394", "0.6383558", "0.63830626", "0.63807476", "0.6362253", "0.63564605", "0.63354224", "0.6331587", "0.6330722", "0.63237005", "0.63127...
0.5988989
62
Test that patching with no arg project_access successfully extends access for all projects the service account currently has access to.
def test_patch_service_account_no_project_change( client, app, db_session, encoded_jwt_service_accounts_access, register_user_service_account, user_can_manage_service_account_mock, valid_user_service_account_mock, revoke_user_service_account_from_google_mock, add_user_service_account...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_patch_service_account_remove_all_access(\n client,\n app,\n db_session,\n encoded_jwt_service_accounts_access,\n register_user_service_account,\n user_can_manage_service_account_mock,\n valid_user_service_account_mock,\n revoke_user_service_account_from_google_mock,\n add_user_s...
[ "0.68343496", "0.6786524", "0.66923004", "0.66494733", "0.6641669", "0.65332156", "0.6501268", "0.6463291", "0.6428576", "0.63720006", "0.63313645", "0.63235384", "0.6267822", "0.62597275", "0.61931896", "0.61674815", "0.60891813", "0.60821265", "0.60305977", "0.60061425", "0...
0.6996558
0
Test that patching with a valid expires_in successfully extends access, and patching with an invalid expires_in does not.
def test_patch_service_account_expires_in( client, app, db_session, encoded_jwt_service_accounts_access, register_user_service_account, user_can_manage_service_account_mock, valid_user_service_account_mock, revoke_user_service_account_from_google_mock, add_user_service_account_to_goo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_validate_expiration2(client):\n with client.application.app_context():\n pytest.skip(\"Not implemented\")", "async def test_invalid_token_expiry_in_config_entry(\n hass: HomeAssistant,\n component_setup: ComponentSetup,\n aioclient_mock: AiohttpClientMocker,\n) -> None:\n\n # The t...
[ "0.6844626", "0.6763873", "0.67584", "0.6650726", "0.6568256", "0.65523976", "0.65519077", "0.6548259", "0.643943", "0.6436103", "0.63885045", "0.63736486", "0.6289868", "0.62593085", "0.6205588", "0.61965007", "0.6141622", "0.61033314", "0.6096082", "0.6085035", "0.6081671",...
0.7942365
0
Test that patching with project_access as empty list successfully removes all projects the service account currently has access to.
def test_patch_service_account_remove_all_access( client, app, db_session, encoded_jwt_service_accounts_access, register_user_service_account, user_can_manage_service_account_mock, valid_user_service_account_mock, revoke_user_service_account_from_google_mock, add_user_service_account...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_remove_project(self):\n pass", "def test_remove_project_member(self):\n pass", "def test_remove_projects_from_group(client):\n group = client.remove_projects_from_group(\n TEAM_ID,\n GROUP_ID,\n [\"638597985c913f818559f3.17106287\",\n \"404021655ce68d0f36a...
[ "0.68499666", "0.66519874", "0.6617426", "0.6606463", "0.65932506", "0.65811473", "0.6541075", "0.6541075", "0.6515065", "0.6465444", "0.64080673", "0.63891673", "0.63891673", "0.6383259", "0.6366932", "0.63445747", "0.63123935", "0.6246273", "0.62419075", "0.6228392", "0.621...
0.7507203
0
Test that an invalid service account gives us the expected error structure
def test_invalid_service_account_dry_run_errors( cloud_manager, client, app, encoded_jwt_service_accounts_access, valid_service_account_patcher, db_session, ): valid_service_account_patcher[ "service_account_has_external_access" ].return_value = True encoded_creds_jwt = enc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_invalid_service_account_has_invalid_type(\n client,\n app,\n encoded_jwt_service_accounts_access,\n valid_service_account_patcher,\n valid_google_project_patcher,\n db_session,\n cloud_manager,\n):\n valid_service_account_patcher[\"is_valid_service_account_type\"].return_value = Fa...
[ "0.689817", "0.6696572", "0.65670174", "0.65628815", "0.6357861", "0.6324454", "0.6313304", "0.6311794", "0.6279392", "0.626623", "0.6258232", "0.6220433", "0.62158924", "0.62062615", "0.6195862", "0.6194676", "0.6193869", "0.6191958", "0.6188509", "0.6185368", "0.6178153", ...
0.6904281
0
Test that an invalid service account gives us the expected error structure
def test_invalid_service_account_has_external_access( client, app, encoded_jwt_service_accounts_access, valid_service_account_patcher, valid_google_project_patcher, db_session, cloud_manager, ): sa_patcher = valid_service_account_patcher proj_patcher = valid_google_project_patcher ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_invalid_service_account_dry_run_errors(\n cloud_manager,\n client,\n app,\n encoded_jwt_service_accounts_access,\n valid_service_account_patcher,\n db_session,\n):\n\n valid_service_account_patcher[\n \"service_account_has_external_access\"\n ].return_value = True\n\n enc...
[ "0.6904389", "0.6898219", "0.6696194", "0.65656", "0.6560998", "0.6357726", "0.63132715", "0.63129985", "0.627929", "0.6265447", "0.62582004", "0.622056", "0.62161285", "0.62073755", "0.61960596", "0.61947095", "0.61939555", "0.6191505", "0.618866", "0.61850935", "0.617801", ...
0.63247347
6
Test that an invalid service account gives us the expected error structure
def test_invalid_service_account_has_invalid_type( client, app, encoded_jwt_service_accounts_access, valid_service_account_patcher, valid_google_project_patcher, db_session, cloud_manager, ): valid_service_account_patcher["is_valid_service_account_type"].return_value = False encoded_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_invalid_service_account_dry_run_errors(\n cloud_manager,\n client,\n app,\n encoded_jwt_service_accounts_access,\n valid_service_account_patcher,\n db_session,\n):\n\n valid_service_account_patcher[\n \"service_account_has_external_access\"\n ].return_value = True\n\n enc...
[ "0.6905058", "0.6696591", "0.6566112", "0.6561027", "0.63567674", "0.6325365", "0.6313265", "0.6311932", "0.62797993", "0.6266244", "0.62572193", "0.62209386", "0.621513", "0.62061167", "0.61949414", "0.6193788", "0.619265", "0.6191609", "0.6189161", "0.6184653", "0.6178058",...
0.68985486
1
Test that an invalid service account gives us the expected error structure
def test_invalid_service_account_not_owned_by_project( client, app, encoded_jwt_service_accounts_access, valid_service_account_patcher, valid_google_project_patcher, db_session, cloud_manager, ): ( valid_service_account_patcher[ "is_service_account_from_google_project...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_invalid_service_account_dry_run_errors(\n cloud_manager,\n client,\n app,\n encoded_jwt_service_accounts_access,\n valid_service_account_patcher,\n db_session,\n):\n\n valid_service_account_patcher[\n \"service_account_has_external_access\"\n ].return_value = True\n\n enc...
[ "0.6905058", "0.68985486", "0.6696591", "0.6566112", "0.6561027", "0.63567674", "0.6325365", "0.6313265", "0.6311932", "0.6266244", "0.62572193", "0.62209386", "0.621513", "0.62061167", "0.61949414", "0.6193788", "0.619265", "0.6191609", "0.6189161", "0.6184653", "0.6178058",...
0.62797993
9
Test that an invalid service account gives us the expected error structure
def test_invalid_get_google_project_parent_org( client, app, encoded_jwt_service_accounts_access, valid_service_account_patcher, valid_google_project_patcher, db_session, cloud_manager, ): ( valid_google_project_patcher["get_google_project_parent_org"].return_value ) = "some-...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_invalid_service_account_dry_run_errors(\n cloud_manager,\n client,\n app,\n encoded_jwt_service_accounts_access,\n valid_service_account_patcher,\n db_session,\n):\n\n valid_service_account_patcher[\n \"service_account_has_external_access\"\n ].return_value = True\n\n enc...
[ "0.6904281", "0.689817", "0.6696572", "0.65670174", "0.65628815", "0.6357861", "0.6324454", "0.6313304", "0.6311794", "0.6279392", "0.626623", "0.6258232", "0.6220433", "0.62158924", "0.62062615", "0.6195862", "0.6194676", "0.6193869", "0.6191958", "0.6188509", "0.6185368", ...
0.0
-1
Test that an invalid service account gives us the expected error structure
def test_invalid_google_project_has_invalid_membership( client, app, encoded_jwt_service_accounts_access, valid_service_account_patcher, valid_google_project_patcher, db_session, cloud_manager, ): valid_google_project_patcher[ "get_google_project_valid_users_and_service_accounts"...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_invalid_service_account_dry_run_errors(\n cloud_manager,\n client,\n app,\n encoded_jwt_service_accounts_access,\n valid_service_account_patcher,\n db_session,\n):\n\n valid_service_account_patcher[\n \"service_account_has_external_access\"\n ].return_value = True\n\n enc...
[ "0.6905058", "0.68985486", "0.6696591", "0.6566112", "0.6561027", "0.63567674", "0.6325365", "0.6311932", "0.62797993", "0.6266244", "0.62572193", "0.62209386", "0.621513", "0.62061167", "0.61949414", "0.6193788", "0.619265", "0.6191609", "0.6189161", "0.6184653", "0.6178058"...
0.6313265
7
Test that an invalid service account gives us the expected error structure
def test_invalid_google_project_no_access( client, app, encoded_jwt_service_accounts_access, valid_service_account_patcher, valid_google_project_patcher, db_session, ): ( valid_google_project_patcher["do_all_users_have_access_to_project"].return_value ) = False ( vali...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_invalid_service_account_dry_run_errors(\n cloud_manager,\n client,\n app,\n encoded_jwt_service_accounts_access,\n valid_service_account_patcher,\n db_session,\n):\n\n valid_service_account_patcher[\n \"service_account_has_external_access\"\n ].return_value = True\n\n enc...
[ "0.6905058", "0.68985486", "0.6696591", "0.6566112", "0.6561027", "0.63567674", "0.6325365", "0.6313265", "0.6311932", "0.62797993", "0.6266244", "0.62572193", "0.62209386", "0.621513", "0.62061167", "0.61949414", "0.6193788", "0.619265", "0.6191609", "0.6189161", "0.6184653"...
0.5983134
50
Test that patching with new project_access returns 400 when more than SERVICE_ACCOUNT_LIMIT projects are trying to be registered.
def test_patch_service_account_invalid_limit( client, app, db_session, encoded_jwt_service_accounts_access, register_user_service_account, user_can_manage_service_account_mock, valid_user_service_account_mock, revoke_user_service_account_from_google_mock, add_user_service_account_to_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_patch_service_account_valid_limit(\n client,\n app,\n db_session,\n encoded_jwt_service_accounts_access,\n register_user_service_account,\n user_can_manage_service_account_mock,\n valid_user_service_account_mock,\n revoke_user_service_account_from_google_mock,\n add_user_service...
[ "0.7600064", "0.7224572", "0.7149081", "0.7032543", "0.64267856", "0.64059275", "0.64038706", "0.64000475", "0.6392031", "0.63518256", "0.6151241", "0.6047579", "0.60405266", "0.6016301", "0.59901816", "0.59893554", "0.5984884", "0.5976061", "0.5974901", "0.5969786", "0.59693...
0.75034636
1
Test that patching with new project_access returns 204 when SERVICE_ACCOUNT_LIMIT number of projects is registered.
def test_patch_service_account_valid_limit( client, app, db_session, encoded_jwt_service_accounts_access, register_user_service_account, user_can_manage_service_account_mock, valid_user_service_account_mock, revoke_user_service_account_from_google_mock, add_user_service_account_to_go...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_patch_service_account_invalid_limit(\n client,\n app,\n db_session,\n encoded_jwt_service_accounts_access,\n register_user_service_account,\n user_can_manage_service_account_mock,\n valid_user_service_account_mock,\n revoke_user_service_account_from_google_mock,\n add_user_servi...
[ "0.72340447", "0.7004186", "0.69104755", "0.67806137", "0.6774562", "0.672031", "0.6548633", "0.6537763", "0.6453169", "0.6444767", "0.6413648", "0.6412", "0.638041", "0.6376856", "0.63733137", "0.6349866", "0.63355863", "0.6319303", "0.6289333", "0.62101835", "0.62101835", ...
0.7553361
0
Check if the user is currently logged in.
def is_logged_in(session): if 'tid' in session: return {'success': 1, 'message': '你处于登录状态.', 'teamname': session['teamname'], 'is_zju_user': session['is_zju_user']} else: return {"success": 0, "message": "你并未处于登录状态."}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def logged_in(self):\n return self.auth.get_user_by_session() is not None", "def is_logged_in():\n return 'user' in session", "def logged_in(self):\n return self.user is not None", "def is_logged_in(self):\n return self.__is_logged_in", "def logged_in():\n\n if current_user.is_authen...
[ "0.8480989", "0.84540546", "0.8453164", "0.83175427", "0.8290946", "0.8279225", "0.8260952", "0.8199744", "0.8165357", "0.81256783", "0.81213623", "0.7959727", "0.7908527", "0.78553283", "0.7711912", "0.76587296", "0.75593746", "0.75580204", "0.75412875", "0.7511623", "0.7418...
0.0
-1
Generate a plot with ligo.skymap
def plot(self, **kwargs): from pesummary.gw.plots.plot import _ligo_skymap_plot_from_array return _ligo_skymap_plot_from_array(self, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mapSky(self):\n import aplpy\n\n # Plot with aplpy\n self.gc = aplpy.FITSFigure(self.image, figure=self.f, \n dimensions=[0,1], slices=[0,0], subplot=[0.1, 0.9, 0.9, 0.9])\n \n # Coordinate Grid\n if self.grid:\n self.gc.add_grid()\n se...
[ "0.70856637", "0.6800274", "0.6724281", "0.64922404", "0.6389971", "0.63442576", "0.6162564", "0.6145946", "0.6082385", "0.6033617", "0.60039073", "0.5978525", "0.5962616", "0.5946692", "0.5880587", "0.5846514", "0.57976735", "0.5786923", "0.5766727", "0.5759238", "0.57549024...
0.7669955
0
Helper function to load pretrained weights for ResNet101
def init_backbone(self, path): state_dict = torch.load(path) keys = list(state_dict) for key in keys: if key.startswith('layer'): idx = int(key[5]) new_key = 'layers.' + str(idx-1) + key[6:] state_dict[new_key] = state_dict.pop(key) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_pretrained_net_weights(net, ckpt_path):\n print(\"Loading Model: \", ckpt_path)\n print('')\n\n net.load_weights(ckpt_path).expect_partial()", "def init_weights(self):\n if isinstance(self.pretrained, str):\n logger = get_root_logger()\n logger.info(f'load model fro...
[ "0.77193826", "0.741576", "0.7229557", "0.71881914", "0.7172176", "0.7125903", "0.71044487", "0.7012189", "0.6997507", "0.6994857", "0.69792366", "0.6952357", "0.6945424", "0.6945424", "0.6945424", "0.6945424", "0.6939921", "0.6939088", "0.6898321", "0.6889005", "0.6858576", ...
0.0
-1
Update kwargs with defaults (if values are missing).
def update_with_defaults(**kwargs): # Update the defaults with the input values with open(DEFAULTS, "r") as f: defaults = json.load(f) return _update(kwargs, defaults)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _post_processing(\n kwargs, skip_translate, invalid\n): # pylint: disable=unused-argument\n # If any defaults were not expicitly passed, add them\n for item in DEFAULTS:\n if item not in kwargs:\n kwargs[item] = DEFAULTS[item]", "def initDefaults(self, kwargs):\n \n ...
[ "0.7846912", "0.77511454", "0.7580293", "0.73287034", "0.71713865", "0.6868064", "0.6825242", "0.6636466", "0.6516328", "0.643669", "0.63700694", "0.6359759", "0.6352986", "0.6352986", "0.63527024", "0.63460755", "0.63174254", "0.6274431", "0.6265867", "0.6243301", "0.6218715...
0.7345412
3
Attaches extra dict to this one and removes the chapter Updates the dictionary on ``config`` with values from any file found under a listing specified by ``attach_key``.
def attach_to_config_and_remove(config, attach_key): if attach_key in config: attach_value = list(config[attach_key]) for attach_value in attach_value: try: attach_path, attach_value = attach_value.rsplit("/", 1) except ValueError: attach_path ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unattach(self, construct):\n self._attachments = {\n k: a for k, a in self._attachments.items()\n if a.construct is not construct\n }", "def setAddAttachments(self,value):\n self.PDFreactorConfiguration.in1[\"addAttachments\"] = value", "def with_config_up...
[ "0.5332383", "0.528338", "0.5113345", "0.5014146", "0.50062656", "0.4908496", "0.48860383", "0.4870658", "0.48376876", "0.48376876", "0.48173526", "0.4791279", "0.47867778", "0.47746235", "0.47510237", "0.47321075", "0.47227973", "0.4721189", "0.47049043", "0.47049043", "0.46...
0.76906234
0
Given two dictionaries, merge them together preserving either first or last entries.
def priority_merge_dicts(first_config, second_config, priority="first"): if priority == "second": merged_dictionary = first_config to_merge = second_config elif priority == "first": merged_dictionary = second_config to_merge = first_config else: raise TypeError("Pleas...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def merge_dicts(x, y):\n z = x.copy()\n z.update(y)\n return z", "def merge_dicts(x, y):\n z = x.copy()\n z.update(y)\n return z", "def merge_dicts(x, y):\n z = x.copy()\n z.update(y)\n return z", "def merge_two_dicts(x, y):\n\tz = x.copy()\n\tz.update(y)\n\treturn z", "def merge...
[ "0.7648669", "0.7648669", "0.7648669", "0.75989664", "0.7538408", "0.75138146", "0.7493145", "0.7493145", "0.7493145", "0.7493145", "0.7493145", "0.7493145", "0.7493145", "0.7493145", "0.7366113", "0.733791", "0.7329595", "0.7240551", "0.7210743", "0.71515054", "0.71515054", ...
0.0
-1
Given any number of dicts, shallow copy and merge into a new dict, precedence goes to key value pairs in latter dicts. Note that this function only merges the first level. For deeper merging, use ``priority_merge_dicts``.
def merge_dicts(*dict_args): result = {} for dictionary in dict_args: result.update(dictionary) return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _merge_dicts(*args):\n return reduce(lambda d, s: d.update(s) or d, args)", "def _merge_dicts(*args):\n return reduce(lambda d, s: d.update(s) or d, args)", "def dict_merge(*dictionaries):\n\n merged_dict = {}\n\n def merge(source, defaults):\n source = copy.deepcopy(source)\n # Nes...
[ "0.739812", "0.7397716", "0.71180415", "0.7116548", "0.7033899", "0.7018301", "0.69937295", "0.69520086", "0.69488025", "0.6938856", "0.6916222", "0.6916222", "0.6916222", "0.6910138", "0.69005233", "0.68728405", "0.6838886", "0.6832296", "0.6803907", "0.67986315", "0.6765381...
0.70488554
7
Given a dictionary of ``all_set_variables``, which comes out of the function ``determine_set_variables_in_choose_block``, gives a list of task/variable dependencies to resolve in order to figure out the variable.
def find_one_independent_choose(all_set_variables): task_list = [] for key in all_set_variables: value = all_set_variables[key] choose_keywords = list(value) for choose_keyword in choose_keywords: set_vars = value[choose_keyword] task_list.append((key, choose_keyw...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def basic_find_one_independent_choose(all_set_variables):\n task_list = []\n for choose_keyword in list(all_set_variables):\n # for choose_keyword, set_vars in six.iteritems(value):\n task_list.append(choose_keyword)\n task_list = basic_add_more_important_tasks(\n choose_keywo...
[ "0.70380116", "0.59937835", "0.59806323", "0.59213656", "0.58643806", "0.57796067", "0.5760945", "0.57280356", "0.5700757", "0.5607655", "0.559186", "0.5563025", "0.5546844", "0.5483183", "0.54813606", "0.5477117", "0.5438602", "0.54104817", "0.5402217", "0.53980625", "0.5392...
0.7186792
0
Transforms a marked date string into a Date object
def marked_date_to_date_object(tree, rhs, config): if not tree[-1]: tree = tree[:-1] lhs = tree[-1] entry = rhs if isinstance(entry, Date): return entry if "${" in str(entry): return entry if isinstance(lhs, str) and lhs.endswith("date"): # if isinstance(entry, st...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _str_to_date(self, date):\n return datetools.date_parser(date)", "def string_to_date(string):\n params = string.strip().split('-')\n year = int(params[0])\n month = int(params[1])\n day = int(params[2])\n d = date(year, month, day)\n return d", "def string_t...
[ "0.77877414", "0.74274474", "0.71954894", "0.7129465", "0.7109297", "0.7106369", "0.7089867", "0.7045306", "0.7035711", "0.70278436", "0.6999961", "0.6995144", "0.69662476", "0.6955136", "0.69494283", "0.6920425", "0.69195336", "0.6899717", "0.68740535", "0.6869458", "0.68693...
0.0
-1
Return boolean indicating if ability is valid for this item.
def _validability(self, ability): return (isinstance(ability, AttributeAbility) or isinstance(ability, WeaponAbility))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_only_valid_allowed(self) -> bool:\n return self.get_allow_scope() is TxAllowScope.VALID", "def _validability(self, ability):\n return isinstance(ability, AttributeAbility)", "def is_allowed(self) -> bool:\n return self.effect == ALLOW_ACCESS", "def is_valid(self, user=None) -> boo...
[ "0.69379896", "0.6838782", "0.6631491", "0.6587008", "0.65152687", "0.64983654", "0.64902663", "0.64675134", "0.6442592", "0.639651", "0.639651", "0.6386417", "0.63565856", "0.63565856", "0.6331449", "0.62886983", "0.6264069", "0.62634146", "0.62634146", "0.6235094", "0.62317...
0.6863364
1
Return boolean indicating if ability is valid for this item.
def _validability(self, ability): return isinstance(ability, AttributeAbility)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_only_valid_allowed(self) -> bool:\n return self.get_allow_scope() is TxAllowScope.VALID", "def _validability(self, ability):\n return (isinstance(ability, AttributeAbility) or\n isinstance(ability, WeaponAbility))", "def is_allowed(self) -> bool:\n return self.effect ...
[ "0.69379294", "0.68637556", "0.66315377", "0.6586394", "0.6515965", "0.64991075", "0.6491279", "0.6468152", "0.644327", "0.6397093", "0.6397093", "0.63866085", "0.6357245", "0.6357245", "0.63314956", "0.6289691", "0.6264474", "0.62625605", "0.62625605", "0.6235811", "0.623264...
0.68391424
2
Returns the environment parameters for the Med, as a list of objects of type McaEnvironment. e = epics_med.get_environment()
def get_environment(self): return self.mcas[0].get_environment()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def container_environment(self):\n environment = []\n for name, value in sorted(self.environment.items()):\n environment.append({'name': name, 'value': value})\n return environment", "def environment(self) -> dict:\n return self._environment_info", "def environments(self)...
[ "0.6691955", "0.6253179", "0.62297547", "0.621383", "0.6186302", "0.6112306", "0.6057784", "0.6001361", "0.59995896", "0.5983868", "0.5947893", "0.5946714", "0.590523", "0.58821017", "0.5838222", "0.57682663", "0.5749436", "0.5726287", "0.5651339", "0.5640881", "0.55987793", ...
0.64912164
1
Generate RPN proposals on a single image.
def im_proposals(model, im): inputs, im_scale = _get_blobs(im, cfg.TEST.SCALE, cfg.TEST.MAX_SIZE) if cfg.PYTORCH_VERSION_LESS_THAN_040: inputs['data'] = [Variable(torch.from_numpy(inputs['data']), volatile=True)] inputs['im_info'] = [Variable(torch.from_numpy(inputs['im_info']), volatile=True)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_proposals_on_roidb(\n model, roidb, start_ind=None, end_ind=None, total_num_images=None\n):\n _t = Timer()\n num_images = len(roidb)\n roidb_boxes = [[] for _ in range(num_images)]\n roidb_scores = [[] for _ in range(num_images)]\n roidb_ids = [[] for _ in range(num_images)]\n if ...
[ "0.6702737", "0.6605184", "0.61329687", "0.5941359", "0.58198535", "0.58040917", "0.58040917", "0.56906956", "0.5684387", "0.55896634", "0.5557119", "0.5529369", "0.5478772", "0.54617244", "0.5457183", "0.54148024", "0.54080623", "0.5393022", "0.5386786", "0.53625625", "0.535...
0.6639114
1
Called to set the target value for this actuator. This method should be implemented by extending classes.
def set_value(self, desired_value: PhyPropType) -> None: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def target(self, value):\n self._target = value", "def target(self, target):\n self.__target = float(target)", "def target(self, target):\n\n self._target = target", "def target(self, target) :\n\t\ttry :\n\t\t\tself._target = target\n\t\texcept Exception as e:\n\t\t\traise e", "def ta...
[ "0.8375637", "0.8078069", "0.7452824", "0.7444554", "0.7444554", "0.7360871", "0.7237422", "0.72044134", "0.69927293", "0.6791219", "0.6647102", "0.6642431", "0.6571848", "0.6506232", "0.6494482", "0.6487949", "0.63029665", "0.6289626", "0.62819254", "0.62599444", "0.62599444...
0.0
-1
Return True if the user can fully access all the Superset datasources, False otherwise.
def can_access_all_datasources(self) -> bool: return self.can_access("all_datasource_access", "all_datasource_access")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_access_datasource(self, datasource: \"BaseDatasource\") -> bool:\n\n try:\n self.raise_for_access(datasource=datasource)\n except SupersetSecurityException:\n return False\n\n return True", "def can_access_all_databases(self) -> bool:\n\n return self.can_...
[ "0.754857", "0.68777937", "0.678029", "0.6472102", "0.6421323", "0.63908386", "0.62657887", "0.6194552", "0.60810125", "0.60652757", "0.60185593", "0.5958507", "0.59559655", "0.5935644", "0.5890944", "0.5834613", "0.5813536", "0.58091366", "0.5789949", "0.5787861", "0.5781307...
0.8072191
0
Return True if the user can fully access all the Superset databases, False otherwise.
def can_access_all_databases(self) -> bool: return self.can_access("all_database_access", "all_database_access")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_access_all_datasources(self) -> bool:\n\n return self.can_access(\"all_datasource_access\", \"all_datasource_access\")", "def can_access_database(self, database: \"Database\") -> bool:\n\n return (\n self.can_access_all_datasources()\n or self.can_access_all_databases(...
[ "0.7127522", "0.6801516", "0.6472921", "0.64595133", "0.6379699", "0.62858707", "0.6234549", "0.62225014", "0.61743486", "0.6113101", "0.60836333", "0.6060671", "0.6038624", "0.6006852", "0.60026973", "0.5957692", "0.5903371", "0.5899912", "0.5892185", "0.5878465", "0.5858192...
0.7800256
0
Return True if the user can fully access the Superset database, False otherwise. Note for Druid the database is akin to the Druid cluster.
def can_access_database(self, database: "Database") -> bool: return ( self.can_access_all_datasources() or self.can_access_all_databases() or self.can_access("database_access", database.perm) # type: ignore )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_access_datasource(self, datasource: \"BaseDatasource\") -> bool:\n\n try:\n self.raise_for_access(datasource=datasource)\n except SupersetSecurityException:\n return False\n\n return True", "def can_access_all_databases(self) -> bool:\n\n return self.can_...
[ "0.67803365", "0.66533995", "0.65089935", "0.64840806", "0.6474099", "0.64519167", "0.6427991", "0.64001834", "0.6311866", "0.6258315", "0.6247564", "0.61888003", "0.6170989", "0.6144467", "0.6127151", "0.6109898", "0.6109161", "0.6105587", "0.60978544", "0.6087498", "0.60786...
0.6578948
2
Return True if the user can fully access the schema associated with the Superset datasource, False otherwise. Note for Druid datasources the database and schema are akin to the Druid cluster and datasource name prefix respectively, i.e., [schema.]datasource.
def can_access_schema(self, datasource: "BaseDatasource") -> bool: return ( self.can_access_all_datasources() or self.can_access_database(datasource.database) or self.can_access("schema_access", datasource.schema_perm or "") )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_access_datasource(self, datasource: \"BaseDatasource\") -> bool:\n\n try:\n self.raise_for_access(datasource=datasource)\n except SupersetSecurityException:\n return False\n\n return True", "def can_access_all_datasources(self) -> bool:\n\n return self.ca...
[ "0.7426715", "0.6727493", "0.6119311", "0.6092506", "0.6075435", "0.6071309", "0.6041809", "0.5969313", "0.59309316", "0.57987684", "0.57668036", "0.57593215", "0.5683751", "0.5675731", "0.563789", "0.5628603", "0.5606758", "0.56006444", "0.5561773", "0.5539196", "0.55335766"...
0.7923462
0
Return True if the user can fully access of the Superset datasource, False otherwise.
def can_access_datasource(self, datasource: "BaseDatasource") -> bool: try: self.raise_for_access(datasource=datasource) except SupersetSecurityException: return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_access_all_datasources(self) -> bool:\n\n return self.can_access(\"all_datasource_access\", \"all_datasource_access\")", "def has_super_access():\n current_user = frappe.get_doc('User', frappe.session.user)\n roles = set([role.role for role in current_user.roles])\n return bool(roles & {'...
[ "0.7064326", "0.69305134", "0.68433803", "0.6633627", "0.6588669", "0.6527395", "0.64799976", "0.64741313", "0.64602995", "0.64597905", "0.64554846", "0.64479315", "0.64479315", "0.64479315", "0.64371294", "0.6399081", "0.63689107", "0.6361086", "0.63587433", "0.6348128", "0....
0.8152948
0
Return True if the FAB permission/view is accessible to only Admin users, False otherwise. Note readonly operations on read only model views are allowed only for admins.
def _is_admin_only(self, pvm: PermissionView) -> bool: if ( pvm.view_menu.name in self.READ_ONLY_MODEL_VIEWS and pvm.permission.name not in self.READ_ONLY_PERMISSION ): return True return ( pvm.view_menu.name in self.ADMIN_ONLY_VIEW_MENUS ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_accessible(self):\n return current_user.is_authenticated and current_user.role == 'admin'", "def is_accessible(self):\n return current_user.is_authenticated and current_user.role == 'admin'", "def has_permission(self, request, view):\n return request.user.group == 'admin'", "def i...
[ "0.793249", "0.793249", "0.7587915", "0.7581629", "0.7515263", "0.7485025", "0.7451487", "0.7410398", "0.7398674", "0.7398674", "0.7375834", "0.7340378", "0.73398924", "0.7312248", "0.7312248", "0.72944", "0.7275077", "0.7267237", "0.72607756", "0.7230003", "0.72218764", "0...
0.824212
0
Return True if the FAB permission/view is accessible to only Alpha users, False otherwise.
def _is_alpha_only(self, pvm: PermissionView) -> bool: if ( pvm.view_menu.name in self.GAMMA_READ_ONLY_MODEL_VIEWS and pvm.permission.name not in self.READ_ONLY_PERMISSION ): return True return ( pvm.view_menu.name in self.ALPHA_ONLY_VIEW_MENUS ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_permission(self, request):\n\t\treturn request.user.is_active", "def can_view(self, user):\n if self.applicant == user:\n return True\n elif user.has_perm('funding.view_all_applications'):\n # Fundihg commitee\n return True\n elif user.has_perm('fundi...
[ "0.7020945", "0.70204496", "0.6935658", "0.6935658", "0.6935658", "0.6874363", "0.6832895", "0.6832895", "0.68210196", "0.6783835", "0.67818725", "0.6693871", "0.6673857", "0.66715", "0.660288", "0.66028494", "0.6563406", "0.65598994", "0.6545394", "0.65099674", "0.65012175",...
0.7660051
0
Return True if the FAB permission/view is Admin user related, False otherwise.
def _is_admin_pvm(self, pvm: PermissionView) -> bool: return not self._is_user_defined_permission(pvm)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_main_admin(self):\n if self.user is None:\n return False\n return self.user.has_permission(\"admin\")", "def has_permission(self, request, view):\n return request.user.group == 'admin'", "def is_admin(self):\n if not self.current_user:\n return False\n ...
[ "0.80792654", "0.80129945", "0.7897604", "0.7892068", "0.7878989", "0.78612614", "0.7850107", "0.78476316", "0.7814975", "0.7788487", "0.77873605", "0.77331907", "0.7720956", "0.76653683", "0.765883", "0.7649033", "0.7633768", "0.7633768", "0.7517591", "0.74985504", "0.747151...
0.72603244
40
Return True if the FAB permission/view is Alpha user related, False otherwise.
def _is_alpha_pvm(self, pvm: PermissionView) -> bool: return not ( self._is_user_defined_permission(pvm) or self._is_admin_only(pvm) ) or self._is_accessible_to_all(pvm)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_view(self, user):\n if self.applicant == user:\n return True\n elif user.has_perm('funding.view_all_applications'):\n # Fundihg commitee\n return True\n elif user.has_perm('funding.make_application_decisions'):\n # Fundihg manager - should ha...
[ "0.7250079", "0.7202572", "0.71133286", "0.70378625", "0.70378625", "0.70378625", "0.6911132", "0.68236154", "0.6789261", "0.67628086", "0.6723416", "0.67172915", "0.66908056", "0.66796124", "0.6670232", "0.6653216", "0.6648423", "0.66314286", "0.66222113", "0.6621905", "0.66...
0.65054893
27
Return True if the FAB permission/view is Gamma user related, False otherwise.
def _is_gamma_pvm(self, pvm: PermissionView) -> bool: return not ( self._is_user_defined_permission(pvm) or self._is_admin_only(pvm) or self._is_alpha_only(pvm) ) or self._is_accessible_to_all(pvm)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_view(self, user):\n if self.applicant == user:\n return True\n elif user.has_perm('funding.view_all_applications'):\n # Fundihg commitee\n return True\n elif user.has_perm('funding.make_application_decisions'):\n # Fundihg manager - should ha...
[ "0.73850936", "0.7017729", "0.70060164", "0.6946101", "0.69190836", "0.6908332", "0.68950284", "0.68950284", "0.68950284", "0.6850305", "0.6845019", "0.6838445", "0.6833316", "0.68326306", "0.68184793", "0.68070275", "0.680568", "0.67765504", "0.6760965", "0.67078334", "0.669...
0.0
-1
Return True if the FAB permission/view is SQL Lab related, False otherwise.
def _is_sql_lab_pvm(self, pvm: PermissionView) -> bool: return (pvm.permission.name, pvm.view_menu.name) in self.SQLLAB_PERMISSION_VIEWS
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_view(self, user):\n if self.applicant == user:\n return True\n elif user.has_perm('funding.view_all_applications'):\n # Fundihg commitee\n return True\n elif user.has_perm('funding.make_application_decisions'):\n # Fundihg manager - should ha...
[ "0.63694215", "0.6233632", "0.6190304", "0.6145746", "0.61407423", "0.6129451", "0.6125046", "0.61048037", "0.6049055", "0.60343724", "0.6010733", "0.5951961", "0.5949348", "0.5949348", "0.5949348", "0.5948285", "0.59263694", "0.591418", "0.59132046", "0.58828306", "0.5880587...
0.73524785
0
Returns True if the current user is an owner of the resource, False otherwise.
def is_owner(self, resource: Model) -> bool: try: self.raise_for_ownership(resource) except SupersetSecurityException: return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_user_is_owner(self):\n return self._tag == 'user_is_owner'", "def is_owner(self):\n return self._is_owner", "def has_ownership(self):\n user = self.request.user\n object = self.get_object()\n if object.owned_by(user):\n return True\n else:\n ...
[ "0.83094203", "0.8131969", "0.81195354", "0.77969265", "0.7721983", "0.75817156", "0.7489782", "0.74565655", "0.741493", "0.73108214", "0.72358215", "0.7169734", "0.7097732", "0.7068887", "0.7025883", "0.6940199", "0.6930108", "0.69084525", "0.6819757", "0.67989254", "0.67891...
0.85620767
0
Returns True if the current user is an admin user, False otherwise.
def is_admin(self) -> bool: return current_app.config["AUTH_ROLE_ADMIN"] in [ role.name for role in self.get_user_roles() ]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_admin(self):\n if not self.current_user:\n return False\n else:\n return self.current_user in [\"1\"]", "def is_admin_user(self):\n if \"is_admin\" in self._properties and self.is_admin == 'YES':\n return True\n return False", "def is_current_...
[ "0.8944559", "0.8891833", "0.86725795", "0.85782367", "0.85728854", "0.8552579", "0.8506058", "0.8431097", "0.8420358", "0.84198123", "0.8352308", "0.83439034", "0.83247584", "0.8270186", "0.82437897", "0.8222653", "0.8220135", "0.8216427", "0.81702197", "0.81646407", "0.8148...
0.8247335
14
Tests that recipes are retrieved successfully
def test_retrieve_successsfully(self): create_sample_recipe(user=self.user) create_sample_recipe(user=self.user, title='Snack') recipes = Recipe.objects.all().order_by('-id') serializer = RecipeSerializer(recipes, many=True) res = self.client.get(RECIPE_URL) self.asser...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_recipe_information(self):\n pass", "def test_get_recipes(self):\n r1 = Recipes.objects.create(chef=self.user, name=\"Recipe 1\", draft=True)\n r2 = Recipes.objects.create(chef=self.user, name=\"Recipe 2\", draft=False)\n r3 = Recipes.objects.create(chef=self.user, name=\"...
[ "0.84092283", "0.8360212", "0.8319794", "0.82765", "0.82751995", "0.8159193", "0.808755", "0.803258", "0.78113395", "0.77841604", "0.7646488", "0.7593036", "0.7478468", "0.72876394", "0.7269571", "0.715844", "0.71182704", "0.7104246", "0.70809424", "0.70243734", "0.70171934",...
0.79924244
8
Tests that only recipes of request.user qre getting retrieved
def test_retrieving_limited_to_request_user(self): user2 = get_user_model().objects.create_user( email='waldek@wp.pl', password='correctpass' ) recipe1 = create_sample_recipe(user=self.user) create_sample_recipe(user=user2) recipe = Recipe.objects.filter...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_recipe_limited_to_user(self):\n user2 = get_user_model().objects.create_user(\n 'test@gmail.com',\n 'password3456',\n )\n sample_recipe(self.user)\n sample_recipe(user2)\n\n res = self.client.get(RECIPE_URL)\n\n recipes = Recipe.objects.filte...
[ "0.7961557", "0.79004866", "0.7792306", "0.7683372", "0.7618022", "0.70412415", "0.68859047", "0.6772726", "0.6735031", "0.66558", "0.6642236", "0.65935516", "0.65092427", "0.646942", "0.64547586", "0.6443937", "0.6430576", "0.63972926", "0.6379298", "0.6372795", "0.63636184"...
0.7800118
2
Testing creating Recipe with Ingredients
def test_creating_recipe_with_ingredients(self): ingredient1 = create_sample_ingredient(user=self.user, name="Paprika") ingredient2 = create_sample_ingredient(user=self.user, name="Salad") payload = { "title": "Green Salad", "time_minutes": 34, "price": 4.66,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_creating_recipe_with_ingredients(self):\n ingredient1 = sample_ingredients(user=self.user, name='Prawns')\n ingredient2 = sample_ingredients(user=self.user, name='Garlic')\n\n payload = {\n 'title': 'Avocado lime cheesecake',\n 'time_minutes': 20,\n 'p...
[ "0.81665295", "0.77382255", "0.75992715", "0.7583975", "0.7534787", "0.7438362", "0.7343557", "0.71762973", "0.70610416", "0.7056762", "0.6963039", "0.6961535", "0.6918407", "0.69143647", "0.68841475", "0.6877848", "0.68658704", "0.68567806", "0.68466324", "0.6846524", "0.678...
0.7598707
3
Testing an partial update with patch
def test_partial_recipe_update(self): recipe = create_sample_recipe(user=self.user) recipe.tags.add(create_sample_tag(user=self.user)) new_tag = create_sample_tag(user=self.user, name="Lourd") payload = { "title": "Russian Borsch", "time_minutes": 70, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_client_partial_update(self):\n pass", "def test_partial_update(self):\n\n action = ActionFactory.create(id=22)\n data = {\n 'name': 'Ação para Melhorar',\n 'institution': 'Vamos Ajudar',\n }\n self.assertNotEqual(action.name, data['name'])\n ...
[ "0.83799756", "0.8349655", "0.8327224", "0.82605416", "0.81651", "0.8009878", "0.78602445", "0.78432095", "0.76951593", "0.76365453", "0.761269", "0.7609901", "0.7597972", "0.7597232", "0.7588334", "0.7576012", "0.7565752", "0.7559041", "0.7552352", "0.7552352", "0.7552352", ...
0.7598125
12
Tests uploading an image to Recipe API
def test_upload_image_to_recipe(self): url = create_upload_image_url(self.recipe.id) with tempfile.NamedTemporaryFile(suffix='.jpg') as ntf: image = Image.new("RGB", (10, 10)) image.save(ntf, format='JPEG') ntf.seek(0) res = self.client.post(url, {'image'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_upload_image_to_recipe(self):\n url = image_upload_url(self.recipe.id)\n # we will create a temp file, write an image to it, then upload that file through the API endpoint\n with tempfile.NamedTemporaryFile(suffix = '.jpg') as ntf: # create a file in the system that we can write to (i...
[ "0.8960221", "0.8780842", "0.86200607", "0.85989183", "0.8050519", "0.794178", "0.7941261", "0.79309344", "0.7886174", "0.7871664", "0.7793937", "0.7616329", "0.7544675", "0.7457986", "0.7388273", "0.7323036", "0.73138124", "0.7199325", "0.7179207", "0.714652", "0.71454644", ...
0.8763793
2
Testing that only the recipes with ingredients are getting retrieved
def test_filtering_recipes_with_ingredients(self): recipe1 = create_sample_recipe(user=self.user, title="Chicken tikka") recipe2 = create_sample_recipe(user=self.user, title="Italian pasta") recipe3 = create_sample_recipe(user=self.user, title="Vegan dessert") ingredient1 = create_sampl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_search_recipes_by_ingredients(self):\n pass", "def test_get_recipe_ingredients_by_id(self):\n pass", "def test_filter_recipes_by_ingredients(self):\n recipe1 = sample_recipe(self.user, title='Waxy box')\n recipe2 = sample_recipe(self.user, title='Waxy noodle beans')\n ...
[ "0.84933215", "0.8399508", "0.8197711", "0.8137604", "0.8104396", "0.8090506", "0.7975766", "0.7960442", "0.78366363", "0.7774138", "0.77110815", "0.76930386", "0.766406", "0.76621395", "0.7656884", "0.76470417", "0.76383847", "0.7616604", "0.7606258", "0.75943995", "0.759147...
0.81495637
3
Interpolate two RGB colors in LAB space parameterized by y. Downweight by alpha.
def LABa_interpolation(t, c0, c1, alpha): # Slice off the alpha channel a_start, c0 = c0[3], c0[:3] a_final, c1 = c1[3], c1[:3] # Convert colors to LAB C = np.array([c0, c1]).astype(np.uint8).reshape((2, 1, 3)) c0, c1 = cv2.cvtColor(C, cv2.COLOR_RGB2LAB).reshape(2, 3) # Interpolate in LAB...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def linear_interpolation(left, right, alpha):\n\n return left + alpha * (right - left)", "def RGBa_interpolation(t, c0, c1, alpha):\n\n R = lerp(t, c0[0], c1[0])\n G = lerp(t, c0[1], c1[1])\n B = lerp(t, c0[2], c1[2])\n a = lerp(t, c0[3], c1[3]) * alpha\n return np.vstack([R, G, B, a]).T", "d...
[ "0.63499", "0.62552875", "0.60455686", "0.5940634", "0.5923471", "0.5856904", "0.5828723", "0.57418954", "0.571511", "0.56760997", "0.56162614", "0.55969036", "0.5589764", "0.5570903", "0.55444676", "0.5511401", "0.5428877", "0.54101646", "0.54097325", "0.5407598", "0.5401135...
0.63293034
1
Create an Activation. The annotations are loaded first. The variables are loaded second, and placed in front of the annotations in the chain of name resolutions. Values come before annotations.
def __init__( self, annotations: Optional[Mapping[str, Annotation]] = None, package: Optional[str] = None, vars: Optional[Context] = None, parent: Optional['Activation'] = None, ) -> None: logger.info( f"Activation(annotations={annotati...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nested_activation(\n self,\n annotations: Optional[Mapping[str, Annotation]] = None,\n vars: Optional[Context] = None\n ) -> 'Activation':\n new = Activation(\n annotations=annotations,\n vars=vars,\n parent=self,\n package=...
[ "0.6828798", "0.6044985", "0.6028036", "0.59205467", "0.577082", "0.5762592", "0.5617316", "0.553562", "0.5487198", "0.54838264", "0.5464347", "0.5369998", "0.53544027", "0.53536314", "0.53164524", "0.53157145", "0.52482265", "0.5226074", "0.5220225", "0.5199337", "0.5185547"...
0.67328596
1
Updates model in database.
async def update(self, connection: SQLConnectionInterface, model: Model, _global: Model = None): await self.validate(connection, model, ValidationTypes.UPDATE) await connection.execute(await self._update_stmt(), *await self._update_values(model))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def model_update(self, db):\n db.session.commit()", "def updateModel(self):\n pass", "def update_model(self):\n pass", "def update_model(self):\n pass # TODO: Implement this.", "def update(self):\n db.session.commit()", "def update(self):\n db.session.commit()",...
[ "0.85065174", "0.84193087", "0.8289453", "0.79455596", "0.7497917", "0.7497917", "0.7098775", "0.70952255", "0.7007544", "0.6988825", "0.687854", "0.6851497", "0.68328714", "0.6791609", "0.6783832", "0.678222", "0.67559946", "0.67503345", "0.67075163", "0.6680017", "0.6629060...
0.68743825
11
Returns itself as an iterator.
def __iter__(self) -> Generator: for k in self.raw.keys(): yield k
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __iter__(self):\n return self.next()", "def __iter__(self):\n return self._next()", "def __iter__(self):\n return self._next()", "def __iter__(self):\n return self._next()", "def __iter__(self) -> Iterator[T]:\n return self", "def __iter__(self):\n return ite...
[ "0.8487528", "0.8432813", "0.8432813", "0.8432813", "0.832554", "0.8318865", "0.8255044", "0.82042617", "0.8193425", "0.8152423", "0.81453", "0.81453", "0.81453", "0.81453", "0.81453", "0.81453", "0.81453", "0.81453", "0.81453", "0.81453", "0.81453", "0.81453", "0.81453",...
0.0
-1
Load parser from YAML
def from_yaml( cls, yml: str, defaults: Optional[bool]=False, path: Optional[str]=None, keys: Optional[str]=None) -> 'Parser': fname = Path(yml) if defaults: # load from 'ctwrap/defaults' database fname = Path(__file__)....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_yaml(cls, yml: str):\n\n return cls.from_dict(feast_yaml.yaml_loader(yml, load_single=True))", "def load(text: str, options: Dict[str, str]) -> object:\n raise LoaderMissingError(\"Yaml is not installed on the system\") from e", "def FromYAML(cls, source):\n\n # Late import to avo...
[ "0.71022826", "0.67978793", "0.67887676", "0.67714804", "0.6701634", "0.6686314", "0.6667934", "0.66112095", "0.6608108", "0.6585419", "0.6531039", "0.65202165", "0.6480292", "0.6422193", "0.6416445", "0.6399816", "0.6394038", "0.6389907", "0.6378236", "0.634576", "0.6337218"...
0.6948227
1
Convert Parser content to YAML string
def to_yaml(self): return yaml.dump(self.raw, Dumper=yaml.SafeDumper)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def yaml(self):\n return str(self.data)", "def yaml(self):\n raise NotImplementedError", "def to_content(cls, data: Mapping) -> str:\n cls._check_yaml()\n s = yaml.safe_dump(data, default_flow_style=False)\n s = '---\\n' + s\n return s", "def _get_yaml_content(self):...
[ "0.6390108", "0.62199044", "0.6157494", "0.61364645", "0.61144435", "0.6088283", "0.60768807", "0.59372264", "0.5918758", "0.5907062", "0.5877", "0.584156", "0.58363956", "0.57981336", "0.5741454", "0.57359016", "0.57358706", "0.57057935", "0.5693654", "0.5662944", "0.5634910...
0.6088201
6
Compute the average precision, given the recall and precision curves.
def compute_ap(recall, precision): # correct AP calculation # first append sentinel values at the end mrec = np.concatenate(([0.], recall, [1.])) mpre = np.concatenate(([0.], precision, [0.])) # compute the precision envelope for i in range(mpre.size - 1, 0, -1): mpre[i - 1] = np.maximu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_average_precision(precision, recall):\n # identical but faster version of new_precision[i] = old_precision[i:].max()\n precision = np.concatenate([[0.0], precision, [0.0]])\n for i in range(len(precision) - 1, 0, -1):\n precision[i - 1] = np.maximum(precision[i - 1], precision[i])\n\n ...
[ "0.83699304", "0.8134952", "0.7751859", "0.772469", "0.7717999", "0.7692292", "0.7690848", "0.76255214", "0.7557946", "0.7536621", "0.7475254", "0.7273635", "0.72493404", "0.72285324", "0.72105163", "0.720167", "0.718262", "0.716053", "0.7129075", "0.7086805", "0.7063225", ...
0.76486695
8
Acquire a webdriver instane. There is a limit of how many webdriver instances you can keep open at a time. You must call quit() to cleanup existing one to obtain new ones.
def create_local( options: Optional["ChromeOptions"] = None, timeout: Optional[float] = None, headless: bool = True, user_data_dir: Optional[str] = None, soup_maker: Optional[SoupMaker] = None, **kwargs, ) -> WebDriver: _acquire_queue(timeout) is_debug = os.getenv("debug_mode") if n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_webdriver_with_retry(self, *args, **kwargs):\n # Get selenium without referencing selenium.driver which doesn't exist yet\n selenium = self.builtin.get_library_instance(\"SeleniumLibrary\")\n for _ in range(12):\n try:\n return selenium.create_webdriver(*ar...
[ "0.68042904", "0.66420096", "0.653511", "0.63426596", "0.61694753", "0.6070703", "0.6064298", "0.6057939", "0.6040474", "0.60255724", "0.5972408", "0.586495", "0.5850373", "0.5818601", "0.5800776", "0.580066", "0.57886356", "0.5767748", "0.5747756", "0.5745905", "0.5681187", ...
0.0
-1
Converts a unix timestamp into a formatted string.
def timestamp2str(t, fmt='%Y-%m-%d %H:%M:%S.000'): return datetime.fromtimestamp(t).strftime(fmt)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unixtimestampformat(value):\n if value is None:\n return 0\n return int(calendar.timegm(value.timetuple()))", "def _format_ts(cls, timestamp):\n return localtime(timestamp).strftime('%Y-%m-%d %H:%M:%S')", "def format_timestamp(timestamp: float) -> str:\n\n dt = datetime.utcfromtimest...
[ "0.7431905", "0.72766477", "0.7264056", "0.7216555", "0.71867615", "0.71168596", "0.7113392", "0.70809925", "0.70173144", "0.69931626", "0.69734275", "0.68786246", "0.687289", "0.6841591", "0.6819474", "0.68190956", "0.68081063", "0.6758456", "0.6747471", "0.67172986", "0.669...
0.715085
6
Given an angle theta and a 3D vector rot_vector, this routine computes the rotation matrix corresponding to rotating theta radians about rot_vector.
def get_rotation_matrix(theta, rot_vector): ux = rot_vector[0] uy = rot_vector[1] uz = rot_vector[2] cost = np.cos(theta) sint = np.sin(theta) R = np.array([[cost+ux**2*(1-cost), ux*uy*(1-cost)-uz*sint, ux*uz*(1-cost)+uy*sint], [uy*ux*(1-cost)+uz*sint, cost+uy**2*(1-cost), uy...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Rotation(v, theta):\n\n v = np.array(v)\n if v.shape != (3,) or abs(v.dot(v) - 1.0) > 1e-8 or not np.all(np.isreal(v)):\n raise ValueError('Rotation vector v should be a 3D real unit vector.')\n\n return np.cos(theta/2) * Identity() - 1j * np.sin(theta/2) * (\n v[0] * PauliX() + v[1] * P...
[ "0.7448736", "0.72418207", "0.7162559", "0.71333", "0.71200484", "0.70005774", "0.6949066", "0.6919469", "0.68940914", "0.6867915", "0.68587196", "0.68523854", "0.6848423", "0.6844073", "0.6842051", "0.68300885", "0.6800857", "0.6799792", "0.6791354", "0.67856026", "0.6782298...
0.7902144
0
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, GetNasVolumeInstanceListRequest): return False return self.__dict__ == other.__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.80891633", "0.80891633", "0.8055254", "0.7983334", "0.7967544", "0.7967544", "0.7967544", "0.7967544", "0.7967544", "0.7967544", "0.7967544", "0.7967544", "0.7967544", "0.7967544", "0.7967544", "0.7967544", "0.7967544", "0.7967544", "0.7967544", "0.7967544", "0.7967544", ...
0.0
-1
Returns true if both objects are not equal
def __ne__(self, other): return not self == other
{ "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.845611", "0.8391477", "0.8144138", "0.81410587", "0.8132492", "0.8093973", "0.80920255", "0.80920255", "0.80920255", "0.8085325", "0.8085325", "0.8076365", "0.8076365", "0.8065748" ]
0.0
-1
Input n>=6, Returns a array of primes, 2 <= p < n
def primesfrom2to(n): sieve = np.ones(n//3 + (n%6==2), dtype=np.bool) for i in range(1,int(n**0.5)//3+1): if sieve[i]: k=3*i+1|1 sieve[ k*k//3 ::2*k] = False sieve[k*(k-2*(i&1)+4)//3::2*k] = False return np.r_[2,3,((3*np.nonzero(sieve)[0][1:]+1)|1)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_probable_prime(n: int) -> [int]:\n return [6*n-1, 6*n+1]", "def get_primes(n):\n\n return list(primes_sieve(n))", "def prime_array(number_of_primes) -> array:\n p = array('i',list(primes(number_of_primes)))\n return p", "def make_primes(n):\n out_list = []\n for i in range(2, n):\n ...
[ "0.7880622", "0.7843994", "0.77937675", "0.7649926", "0.76264685", "0.7519405", "0.7500455", "0.7485748", "0.7467109", "0.7457202", "0.7428247", "0.7409004", "0.73962754", "0.73793733", "0.73658156", "0.7363839", "0.7355883", "0.7350821", "0.73296374", "0.73018754", "0.729061...
0.72275823
28
Internal method to add a layer from top to bottom. The last layer added is considered as the substrate.
def _add_layer(self, layer, substrate=False, key=None): if key is None: key = self._key logger.debug("StSdAddLayer(key)") ilayer_ = self._lib.StSdGetNbLayers(key) logger.debug("StSdAddLayer(key, %i)", ilayer_) if not self._lib.StSdAddLayer(key, ilayer_): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def append_layer(self, *args, **kwargs) :\n \n self.insert_layer(len(self._layers), *args, **kwargs)", "def add_layer(self, layer):\n\t\tif self.root_layer is None:\n\t\t\ts = size()\n\t\t\tself.root_layer = Layer(Rect(0, 0, s[0], s[1]))\n\t\tself.root_layer.add_layer(layer)", "def append_or_upda...
[ "0.70978683", "0.6817616", "0.67674094", "0.6710097", "0.65542537", "0.65159607", "0.6477676", "0.6476947", "0.647685", "0.6389094", "0.6350186", "0.6221331", "0.6218596", "0.6167109", "0.60872436", "0.6053603", "0.59683657", "0.5900165", "0.5852659", "0.5843441", "0.5802745"...
0.5870731
18
Queries the custom_assets table using the filter query and returns a list of `CustomAsset`.
def _get_custom_assets(filter_query: CustomAssetsFilterQuery) -> list[CustomAsset]: query, bindings = filter_query.prepare() query = 'SELECT B.identifier, B.name, A.type as custom_asset_type, A.notes from custom_assets `A` JOIN assets `B` ON A.identifier = B.identifier ' + query # noqa: E501 wi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_custom_assets_and_limit_info(\n self,\n filter_query: CustomAssetsFilterQuery,\n ) -> tuple[list[CustomAsset], int, int]:\n entries = self._get_custom_assets(filter_query=filter_query)\n with GlobalDBHandler().conn.read_ctx() as cursor:\n query, bindings = ...
[ "0.6852846", "0.6409766", "0.63295543", "0.6081401", "0.6037802", "0.60246986", "0.58518445", "0.57140595", "0.5626971", "0.55721575", "0.5529977", "0.5493917", "0.5477715", "0.5393658", "0.5384111", "0.5360617", "0.52952313", "0.528451", "0.5247733", "0.5232182", "0.52260333...
0.8740742
0
Returns the area of a triangle, given the lengths of [Documentation String] its three sides.
def area_triangle_sss(side1, side2, side3): # Use Heron's formula semiperim = (side1 + side2 + side3) / 2.0 return math.sqrt(semiperim * (semiperim - side1) * (semiperim - side2) * (semiperim - side3))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def area_of_a_triangle(length_1, length_2, length_3):\r\n half_perimeter = (length_1 + length_2 + length_3) / 2\r\n area = (half_perimeter * (half_perimeter-length_1) * (half_perimeter-length_2) * (half_perimeter-length_3)) ** 0.5\r\n return area", "def triangle_area(side1: number, side2: number, side3:...
[ "0.7887451", "0.77204263", "0.7363862", "0.7297173", "0.72712195", "0.7231321", "0.7177031", "0.7100257", "0.70238197", "0.6974786", "0.69656867", "0.6943016", "0.693197", "0.68431", "0.68349993", "0.6824296", "0.68076867", "0.6796437", "0.67483777", "0.6671022", "0.6603135",...
0.70933914
8
Get name of queryset model.
def model_name(self): return self.get_queryset().model._meta.model_name # pylint: disable=protected-access
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def model_name(self):\n return self.get_queryset().model._meta.model_name", "def name(self) -> str: # pragma: no cover\n return self.model.__name__", "def model_name(self) -> str:\n return self._model_name", "def name(self) -> str:\n return self._model.name", "def get_model_nam...
[ "0.87962216", "0.78190523", "0.7695397", "0.75772166", "0.740174", "0.71361315", "0.7105807", "0.70705026", "0.6799893", "0.67296046", "0.6721088", "0.66905177", "0.6684375", "0.6629032", "0.6607246", "0.6580978", "0.6527137", "0.6527137", "0.64649224", "0.6450155", "0.642508...
0.87284875
1
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, UnchangeableParam): return False return self.__dict__ == other.__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): return not self == other
{ "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.8456082", "0.83912885", "0.81436425", "0.81406975", "0.8131807", "0.8093013", "0.80912536", "0.80912536", "0.80912536", "0.8084505", "0.8084505", "0.8075543", "0.8075543", "0.8065009" ]
0.0
-1
Get location of a client. This function provides output only when visualRF is configured in Aruba Central.
def get_client_location(self, conn, macaddr: str, offset=0, limit=100, units="FEET"): path = urlJoin(urls.CLIENT_LOCATION["GET_CLIENT_LOC"], macaddr) params = { "offset": offset, "limit": limit, "units": units } resp = conn.command(apiMethod="GET", api...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def location(self):\n self.manager.refresh_client()\n return self.content[\"location\"]", "def get_location(self):\n return self.request({\n \"path\": \"/\" + UUID + \"/location\"\n })", "def get_current_location(self):\n return self.enu_2_local()", "def get_loca...
[ "0.64253956", "0.62234074", "0.60571146", "0.59956497", "0.5945751", "0.5893038", "0.58810675", "0.58309054", "0.5815592", "0.5797352", "0.5797352", "0.5797352", "0.5797352", "0.5797352", "0.5797352", "0.5797352", "0.5797352", "0.5797352", "0.5797352", "0.5797352", "0.5797352...
0.6834944
0
Test removing config entry.
async def test_unload_entry(_, hass: HomeAssistant) -> None: mock_entry_data = { "device": "/dev/USB0", "model": "LUGCUH50", "device_number": "12345", } mock_entry = MockConfigEntry( domain="landisgyr_heat_meter", title="LUGCUH50", entry_id="987654321", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_config_remove(self):\n server = self.start_server(\"hello world\", 200)\n try:\n self.setup_dynamic()\n\n cfg_file = \"test.yml\"\n\n self.write_dyn_config(\n cfg_file, self.http_cfg(\"myid\", \"http://localhost:{}\".format(server.server_port))...
[ "0.71836895", "0.7137924", "0.7059716", "0.6969981", "0.6909608", "0.6823363", "0.6729874", "0.66853184", "0.66648275", "0.6650623", "0.66200984", "0.6596751", "0.65920293", "0.658432", "0.6571398", "0.6551854", "0.65233874", "0.6505362", "0.64727974", "0.6442029", "0.6433071...
0.6877691
5
Request to create a tag.
def _create_tag_request(): key = helpers.get('Tag.1.Key') value = helpers.get('Tag.1.Value') resource_id = helpers.get('ResourceId.1') if resource_id in current_app.config['RESOURCE_TYPE_MAP']: resource_type = current_app.config['RESOURCE_TYPE_MAP'][resource_id] else: errors.invali...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create(self, name, tag):\n\n\t\turl_json = urllib.urlencode({\"name\": name, \"tag\": tag})\n\t\treturn self._create(\"/tag?json_hash=%s\" % url_json, \"tag\")", "def create(self, params={}, **options):\n return self.client.post(\"/tags\", params, **options)", "def createTag(self, authenticationToke...
[ "0.7569088", "0.72632796", "0.6960752", "0.6890476", "0.6777973", "0.6524953", "0.64519566", "0.64480335", "0.64422315", "0.6416453", "0.64068717", "0.6357027", "0.633017", "0.6267046", "0.6129565", "0.61197954", "0.6116329", "0.60988665", "0.6094159", "0.60619885", "0.603669...
0.8123238
0
Load all images from image path as X_train
def load_images(self, image_path): X_train = [] # Load all files from the image path using Image.open. for i in recursive_list(image_path): # Open images as ??? img = Image.open(i) # Convert to NP array. img = np.asarray(img) # Append ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_data(path):\n\n\t# Create a list of all files ending in .jpg\n\tim_list = list_images(path, '.jpg')\n\n\t# Create labels\n\tlabels = [int(im_name.split('/')[-1][0]) for im_name in im_list]\n\tfeatures = []\n\n\t# Create features from the images\n\t# TOD.O: iterate over images paths\n\tfor im_path in im_li...
[ "0.74151284", "0.7194552", "0.7096649", "0.7082104", "0.70129186", "0.69666934", "0.6952079", "0.6949277", "0.69401526", "0.6924428", "0.6903488", "0.6902917", "0.6899793", "0.6884447", "0.68781334", "0.6865187", "0.68634284", "0.68587255", "0.6832114", "0.682724", "0.6804072...
0.8045259
0
Constructor for the InsuranceDataFireInsurance class
def __init__(self, insurance_policy_type_velue=None, fire_insurance_policy_extend_view=None, fire_insurance_policy_filter=None, id=None, selected_insurance_policy_has_been_changed=None, is_paymented=None, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, jsondict=None, strict=True):\n \n self.businessArrangement = None\n \"\"\" Additional provider contract number.\n Type `str`. \"\"\"\n \n self.claimResponse = None\n \"\"\" Adjudication results.\n Type `FHIRReference` (represented as `dict`...
[ "0.6185588", "0.6016089", "0.60109955", "0.60083526", "0.59310967", "0.59209204", "0.590706", "0.5905073", "0.58719486", "0.58163077", "0.5809647", "0.58051693", "0.57853025", "0.5781253", "0.57782036", "0.5749224", "0.5735569", "0.5734961", "0.57288504", "0.57085115", "0.570...
0.61751944
1
Creates an instance of this model from a dictionary
def from_dictionary(cls, dictionary): if dictionary is None: return None # Extract variables from the dictionary insurance_policy_type_velue = dictionary.get('insurancePolicyTypeVelue') fire_insurance_policy_extend_view = easybimehlanding.model...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_dictionary(cls,\n dictionary):\n if dictionary is None:\n return None\n\n # Extract variables from the dictionary\n id = dictionary.get('id')\n name = dictionary.get('name')\n mtype = dictionary.get('type')\n usage_bytes = diction...
[ "0.83181584", "0.8168118", "0.8168118", "0.8118749", "0.8089047", "0.79787344", "0.7949278", "0.79231393", "0.7898951", "0.78923255", "0.788838", "0.7882321", "0.7882212", "0.7876749", "0.78585315", "0.7836853", "0.7801407", "0.7801407", "0.7801407", "0.7801407", "0.7801407",...
0.0
-1
getReward, returns the fitness at the current time
def getReward(self): # def evaluateFitness(self): fitness = 0.0 distance = self.env.getDistance() speed = self.env.getSpeed() theta = self.env.getOrientation() ## implementation 101 timeBonus = (self.maxTime - self.t)/self.maxTime alpha = 1.0/((1+distance...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_reward(self):\n\t\t# returns the reward for current state\n\n\t\t#temporary line for testing:\n\t\t#return self.reward_idea() # also not working yet\n\n\t\tcost = self.cost_function()\n\t\tconstraints_violation = self.get_constraints_violation()\n\t\t#old_aug_cost = self.augmented_cost\n\t\t#new_aug_cost =...
[ "0.7781569", "0.7604521", "0.7438432", "0.73656917", "0.73326075", "0.72372353", "0.72190464", "0.7197928", "0.7192249", "0.7165035", "0.7124165", "0.71196544", "0.71171963", "0.70994604", "0.70446175", "0.7016198", "0.70125496", "0.7001389", "0.69614494", "0.69585294", "0.69...
0.834375
0
Generate a random string of fixed length
def randomString(stringLength=10): letters = string.ascii_lowercase return ''.join(random.choice(letters) for i in range(stringLength))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _generate_random_string(length: int):\n\tall_chars = string.ascii_letters + string.digits\n\treturn ''.join(random.choices(all_chars, k=length))", "def generate_random_string(length=6):\n n = int(length / 2 + 1)\n x = binascii.hexlify(os.urandom(n))\n s = x[:length]\n return s.decode(\"utf-8\")",...
[ "0.8678726", "0.85725635", "0.8546959", "0.852769", "0.85201234", "0.84315515", "0.84307504", "0.84138894", "0.84099346", "0.8388408", "0.8344307", "0.8342706", "0.83389807", "0.8332531", "0.83217525", "0.829651", "0.829245", "0.8281027", "0.8280717", "0.8279932", "0.8263646"...
0.7760928
98
Finds all prefixes in S
def prefixes(S): result = set() for s in S: for i in range(len(s) + 1): result.add(s[:i]) return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prefixes(s):\n if s:\n yield from prefixes(s[:-1])\n yield s", "def substrings(s):\n if s:\n yield from prefixes(s) # 获得当前s的所有prefix\n yield from substrings(s[1:])", "def prefixes(s):\r\n if s:\r\n yield from prefixes(s[:-1]) # First yield prefixes from s[:-1],...
[ "0.7125093", "0.69621664", "0.6904888", "0.65936416", "0.6545742", "0.65098804", "0.6449697", "0.64192736", "0.6399225", "0.6363056", "0.6340989", "0.63407046", "0.6311025", "0.6303771", "0.62922245", "0.62854314", "0.6268463", "0.62483203", "0.6211187", "0.61958575", "0.6130...
0.7698582
0
Given mean and stddev, sample an action, clip and return We assume Gaussian distribution of probability of selecting an action given a state
def action(self, args): mean, stddev = args dist = tfp.distributions.Normal(loc=mean, scale=stddev) action = dist.sample(1) action = K.clip(action, self.env.action_space.low[0], self.env.action_space.high[0]) return action
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sample(self, state):\n dist = self.action_distribution(state)\n raw_action = dist.rsample() # reparametrization trick\n\n # enforcing action bounds\n tanh_action = torch.tanh(raw_action) # prevent recomputation later.\n action = tanh_action * self.action_scale + self.action...
[ "0.69611585", "0.68375933", "0.68294376", "0.6751806", "0.65920633", "0.65787476", "0.6564911", "0.6540131", "0.650654", "0.6474562", "0.64572936", "0.6454303", "0.6290158", "0.6282513", "0.6245786", "0.6183869", "0.61581403", "0.6143466", "0.61434454", "0.61175233", "0.60719...
0.7227181
0