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
Verify the parent name.
def VerifyParentForGetHistory(organization, project, attribute='root cloud asset'): if organization is None and project is None: raise gcloud_exceptions.RequiredArgumentException( '--organization or --project', 'Should specify the organiz...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_parent(obj, parent_name):\n if obj.parent is None:\n return False\n if obj.parent.name is None:\n return False\n elif obj.parent.name == parent_name:\n return True\n else:\n return has_parent(obj.parent, parent_name)", "def clean_parent(self):\r\n data = sel...
[ "0.6971745", "0.66671616", "0.6659929", "0.66385084", "0.6593543", "0.65022653", "0.6481075", "0.6472918", "0.64529395", "0.6449775", "0.64379877", "0.6420261", "0.641911", "0.639148", "0.63750476", "0.6349837", "0.6343843", "0.6343843", "0.63341004", "0.63258344", "0.6258896...
0.0
-1
Verify the parent name.
def VerifyParentForAnalyzeIamPolicy(organization, folder, attribute='root cloud asset'): if organization is None and folder is None: raise gcloud_exceptions.RequiredArgumentException( '--organization or --folder', 'Should spec...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_parent(obj, parent_name):\n if obj.parent is None:\n return False\n if obj.parent.name is None:\n return False\n elif obj.parent.name == parent_name:\n return True\n else:\n return has_parent(obj.parent, parent_name)", "def clean_parent(self):\r\n data = sel...
[ "0.6970864", "0.6664934", "0.66571593", "0.66373706", "0.6593517", "0.6502202", "0.64805377", "0.6471936", "0.6451861", "0.6447965", "0.6437485", "0.6419076", "0.64187086", "0.6393244", "0.6373032", "0.6347423", "0.6342727", "0.6342727", "0.6333138", "0.6324744", "0.6259293",...
0.0
-1
Gets the parent name from organization Id or folder Id.
def GetParentNameForAnalyzeIamPolicy(organization, folder, attribute='root cloud asset'): VerifyParentForAnalyzeIamPolicy(organization, folder, attribute) if organization: return 'organizations/{0}'.format(organization) return 'folders/...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_parent(self, id_) -> str:\n return list(self._nodes[id_]['parents'].keys())[0]", "def get_parent(self, the_id: str) -> str:\n\n parents = self.parent_types[the_id]\n return parents[1] if len(parents) > 1 else ''", "def parent_id(self) -> str:\n return self._db_data.parent_id...
[ "0.7782075", "0.77427596", "0.7166749", "0.70399106", "0.7031675", "0.69821864", "0.69821864", "0.6976458", "0.6922654", "0.68994695", "0.6825173", "0.676997", "0.6745721", "0.6745721", "0.6745548", "0.66105735", "0.65837973", "0.6517638", "0.6464193", "0.6452549", "0.6410143...
0.66401935
15
Get the currently active ``Run``, or None if no such run exists.
def active_run(*args, **kwargs): return fluent.active_run(*args, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_run(self, id):\n if not id:\n return None\n \n query = \"SELECT * FROM task_history WHERE run_id='\"+str(id)+\"';\"\n \n cur = self.conn.cursor()\n cur.execute(query)\n self.conn.commit()\n run = cur.fetchone()\n \n if run:\...
[ "0.6719367", "0.667683", "0.66108143", "0.6297161", "0.62373465", "0.6203187", "0.6190535", "0.61315626", "0.60009605", "0.58781546", "0.5871005", "0.58470565", "0.58370906", "0.58346176", "0.5791633", "0.57868844", "0.5743999", "0.5713318", "0.5711502", "0.5677247", "0.56724...
0.0
-1
Create an iaxis DCM through x.
def C(i, x): if i == 1: return np.array([[1., 0., 0.], [0., cos(x), sin(x)], [0., -sin(x), cos(x)]]) elif i == 2: return np.array([[cos(x), 0., -sin(x)], [0., 1., 0.], ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __get_transformed_axis__(data, c, x):\n dx = data[c]\n dx -= x[0]\n dx /= x[-1] - x[0]\n dx *= x.shape[0]\n dx = np.round(x)\n return np.int32(dx)", "def generate_csd_space(xlims=[0.0,1.0], gdX=0.01):\n nx = (xlims[1] - xlims[0])/gdX\n space_X = np.linspace(xlims[0], xlims[1], nx)\n ...
[ "0.5812872", "0.57493705", "0.5624533", "0.5450614", "0.5312154", "0.5312154", "0.53001773", "0.5287388", "0.5283072", "0.52792096", "0.52753335", "0.52750856", "0.5271552", "0.52705085", "0.52615935", "0.525211", "0.52402693", "0.5233453", "0.520453", "0.5160011", "0.5140557...
0.55562156
3
Sets the fs_type of this V1FCVolumeSource.
def fs_type(self, fs_type): self._fs_type = fs_type
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def FS(self, FS):\n self._FS = FS", "def get_fs_type(self):\n\t\treturn call_sdk_function('PrlFsInfo_GetFsType', self.handle)", "def SetType(self, ct_type):\r\n\r\n self._type = ct_type", "def file_type(self, file_type):\n allowed_values = [undefined, undefined, undefined, ] # noqa: E50...
[ "0.5978828", "0.5939472", "0.58510375", "0.57924235", "0.57874686", "0.5742604", "0.5703257", "0.5682706", "0.5682706", "0.54996294", "0.5496657", "0.5426532", "0.5314042", "0.53105927", "0.5301814", "0.52805483", "0.5262645", "0.52338386", "0.5231952", "0.5222656", "0.522265...
0.83282614
0
Sets the target_wwns of this V1FCVolumeSource.
def target_wwns(self, target_wwns): self._target_wwns = target_wwns
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_wd(self, target_wd):\n raise NotImplementedError", "def setTarget(self, target):\n\n self._target = target", "def set_targets(self, targets: List[float]):\n self.targets = targets", "def target(self, target) :\n\t\ttry :\n\t\t\tself._target = target\n\t\texcept Exception as e:\n\...
[ "0.57057804", "0.54351145", "0.5320062", "0.52955776", "0.52955776", "0.5234816", "0.52083427", "0.52083427", "0.5198876", "0.5191384", "0.5187812", "0.5185973", "0.5140637", "0.5092823", "0.50640184", "0.50515693", "0.50376767", "0.5024764", "0.5023697", "0.50089866", "0.499...
0.8308933
0
Sets the wwids of this V1FCVolumeSource.
def wwids(self, wwids): self._wwids = wwids
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_weights(self, wts):\n\t\tself.wts = wts", "def setWeights(self, w):\n raise NotImplementedError", "def softwares(self, softwares):\n\n self._softwares = softwares", "def setWeights(self, weights):\n self._call_java('setWeights', weights)", "def target_wwns(self, target_wwns):\n...
[ "0.5411713", "0.5174884", "0.48501077", "0.48399842", "0.48100185", "0.48047268", "0.4759309", "0.4707706", "0.46796995", "0.46698153", "0.4651404", "0.4643313", "0.46204236", "0.46175826", "0.4613186", "0.45934936", "0.45877346", "0.4549931", "0.45461166", "0.45155916", "0.4...
0.72956747
0
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, V1FCVolumeSource): return False return self.to_dict() == other.to_dict()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False", "def __eq__(self, other):\n if i...
[ "0.8088132", "0.8088132", "0.8054589", "0.7982687", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", ...
0.0
-1
Returns true if both objects are not equal
def __ne__(self, other): if not isinstance(other, V1FCVolumeSource): return True return self.to_dict() != other.to_dict()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True", "def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)", "def __ne__(self, other) -> bool:\n return not self.__eq__(other)", "def __eq__(self, other):\n ...
[ "0.84568954", "0.83923674", "0.81447554", "0.81407183", "0.81326675", "0.80941343", "0.8092415", "0.8092415", "0.8092415", "0.8085536", "0.8085536", "0.8076502", "0.8076502", "0.8066026", "0.80427635", "0.80427635", "0.80427635", "0.80427635", "0.80427635", "0.80427635", "0.8...
0.0
-1
Initialize the Instrument object with instrument specific values.
def init(self): # Set the appropriate acknowledgements and references self.acknowledgements = mm_ace.acknowledgements() self.references = mm_ace.references(self.name) logger.info(self.acknowledgements) return
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, instrument, params=None):\n super(InstrumentsCandles, self).__init__(instrument)\n self.params = params", "def __init__(self, instrument):\n endpoint = self.ENDPOINT.format(instrument=instrument)\n super(Instruments, self).__init__(endpoint, method=self.METHOD)", ...
[ "0.7108219", "0.6918381", "0.66361827", "0.6596118", "0.65359944", "0.65112686", "0.645814", "0.6385697", "0.6344484", "0.63261163", "0.63202775", "0.63145226", "0.62796384", "0.61983144", "0.6133194", "0.6133194", "0.6133194", "0.6133194", "0.61211663", "0.6035945", "0.59957...
0.0
-1
Symmetrically normalize adjacency matrix.
def sym_adj(adj): adj = sp.coo_matrix(adj) rowsum = np.array(adj.sum(1)) d_inv_sqrt = np.power(rowsum, -0.5).flatten() d_inv_sqrt[np.isinf(d_inv_sqrt)] = 0. d_mat_inv_sqrt = sp.diags(d_inv_sqrt) return adj.dot(d_mat_inv_sqrt).transpose().dot(d_mat_inv_sqrt).astype(np.float32).todense()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize_adj(adj):\n\n rowsum = np.array(adj.sum(1))\n d_inv_sqrt = np.power(rowsum, -0.5).flatten()\n d_inv_sqrt[np.isinf(d_inv_sqrt)] = 0.\n d_mat_inv_sqrt = np.diag(d_inv_sqrt)\n return adj.dot(d_mat_inv_sqrt).transpose().dot(d_mat_inv_sqrt)", "def normalize_adj(adj):\n adj = sp.coo_mat...
[ "0.7884367", "0.76974994", "0.76974994", "0.76974994", "0.76974994", "0.76974994", "0.76974994", "0.76974994", "0.76974994", "0.76974994", "0.76909643", "0.75937736", "0.7565492", "0.7335031", "0.7303798", "0.72680664", "0.68839365", "0.68612736", "0.68591523", "0.6830935", "...
0.59541416
52
Shorthand to print to `stderr`.
def perror(message): print(message, file=sys.stderr)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def err_print(*args, **kwargs):\n print(*args, file=sys.stderr, **kwargs)", "def error(*args, **kwargs):\n print(*args, file=sys.stderr, **kwargs)", "def print_err(*args, **kwargs):\n print(*args, file=stderr, **kwargs)", "def printerr(*args, **kwargs):\n console_print(sys.stderr, *args, **kwargs...
[ "0.80375874", "0.7994828", "0.79872626", "0.79474694", "0.7902499", "0.7887973", "0.7768046", "0.76535475", "0.76256835", "0.7609135", "0.7524325", "0.7405375", "0.7403769", "0.7322523", "0.729962", "0.7099459", "0.7076431", "0.7076431", "0.7076431", "0.7076431", "0.7076431",...
0.715472
15
Image of an S2Ewthtype, either as type or sort. Type or sort, depending on `key_image`.
def s2ewthtype_image(node, key_image, _paren_if_fun, _paren_if_app): (key, image) = key_image # `image` is a function. assert key == t.S2EXP_NODE or key == t.S2EXP_SRT return image(node[0][key])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def s2e_image(node, for_type, paren_if_fun=False, paren_if_app=False):\n if for_type:\n key_image = (t.S2EXP_NODE, type_image)\n else:\n key_image = (t.S2EXP_SRT, sort_image)\n\n keys = list(node.keys())\n assert len(keys) == 1\n key = keys[0]\n sub_node = node[key]\n\n if key ==...
[ "0.6240164", "0.62248325", "0.62132835", "0.6153079", "0.60843897", "0.6084042", "0.60177356", "0.59771794", "0.58658", "0.57393914", "0.5686309", "0.56602865", "0.56523585", "0.5604048", "0.553815", "0.5518878", "0.5478991", "0.54258335", "0.53277385", "0.52966064", "0.52566...
0.7403787
0
Return a list of the words in the given text. This function should return model that is valid input to generate_text_uniform. A "word" here consists only of alphanumeric characters (no spaces).
def create_model_uniform(text: str) -> List[str]: return str.split(text)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_word_list(text):\n return re.findall('\\w+', text)", "def words(self, text):\n return re.findall(r'\\w+', text)", "def get_words(text):\n return re.compile('\\w+').findall(text)", "def txt_to_word_list(text):\r\n return [w for w in text.split()]", "def get_words(text):\n\n only_...
[ "0.76658475", "0.76548034", "0.7624054", "0.7539878", "0.73467", "0.732196", "0.71729606", "0.7162521", "0.71478117", "0.70422447", "0.70145655", "0.70145655", "0.7007211", "0.6955142", "0.6933722", "0.6929356", "0.68670547", "0.68633395", "0.67733085", "0.6754623", "0.675213...
0.6804504
18
Get the balance of a user.
def __balance__(self) -> float: with dataset.connect(database.get_db()) as db: # Find last bank transaction. statement = statement = f""" SELECT opening_balance, transaction_amount FROM bank WHERE author_id = {self.user.id} ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_user_balance(session, user_id):\n balance = session.query(User.funds).filter(User.phone_number == user_id).all()\n return balance[0][0]", "def get_account_balance(self, user_id, **kwargs):\n user = User.objects(user_id=user_id).first()\n print('Saldo actual del usuario: ', float(user....
[ "0.8467743", "0.7846682", "0.7679099", "0.7501112", "0.74764895", "0.74764895", "0.74698657", "0.7439111", "0.7420553", "0.7396117", "0.7365959", "0.7358523", "0.73010784", "0.72815967", "0.7272598", "0.72690654", "0.7249619", "0.7247512", "0.71552515", "0.71428496", "0.71363...
0.74417883
7
Subtract from a user's balance.
def subtract(self, amount: float, reason: str = "") -> "Bank": if amount == 0: # Pointless, do nothing. return 0 self.__record_ledger__(-amount, reason) self.balance -= amount return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def balance(self, ctx: commands.Context, user: discord.Member = None):\r\n if user is None:\r\n user = ctx.author\r\n\r\n bal = await bank.get_balance(user)\r\n currency = await bank.get_currency_name(ctx.guild)\r\n max_bal = await bank.get_max_balance(ctx.guild)\r\n ...
[ "0.7075836", "0.67462146", "0.6665875", "0.6598069", "0.65665424", "0.6514245", "0.64138657", "0.63684654", "0.6357797", "0.6331959", "0.63014555", "0.62946653", "0.6290872", "0.6290872", "0.6290872", "0.6279405", "0.6268345", "0.6268345", "0.62227154", "0.61861086", "0.61861...
0.6616883
3
Return bank owner's ID.
def id(self) -> int: return self.user.id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def owner_id(self) -> str:\n return pulumi.get(self, \"owner_id\")", "def owner_account_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"owner_account_id\")", "def owner_id(self) -> Optional[str]:\n return pulumi.get(self, \"owner_id\")", "def owner_id(self) -> str:\n r...
[ "0.7937787", "0.7835123", "0.768965", "0.76637477", "0.7534236", "0.7513479", "0.739807", "0.7028205", "0.6896461", "0.68459785", "0.68308526", "0.6690596", "0.6637532", "0.65897995", "0.65897995", "0.6586668", "0.64772516", "0.6471277", "0.64561534", "0.6439039", "0.642017",...
0.0
-1
Render and return a response for the index page
def index(): return render_template('index.html')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index():\n return render_template('index.html'), 200", "def index():\n\n return render_template(\"index.html\"), 200", "def index():\r\n return render_template('index.html')", "def index():\n return render_template('index.html')", "def index():\n # Render template\n re...
[ "0.87537163", "0.8734757", "0.86990386", "0.8687232", "0.8669351", "0.865531", "0.865531", "0.8587078", "0.8587078", "0.85864466", "0.8533138", "0.8533138", "0.8533138", "0.8533138", "0.8533138", "0.8533138", "0.8533138", "0.8533138", "0.8533138", "0.8533138", "0.8533138", ...
0.85139346
45
define the prior weight distribution as Normal of mean=0 and stddev=1
def prior(kernel_size, bias_size): #removed dtype=None, unused argument number = kernel_size + bias_size prior_model = keras.Sequential( [ tfp.layers.DistributionLambda( lambda t: tfp.distributions.MultivariateNormalDiag( loc=tf.zeros(number), scale_diag=t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _WeightInit(self, stddev):\n return init_ops.truncated_normal_initializer(stddev=stddev)", "def stdProbabilityNorm(self):\n return 1./factorial(self.alpha-1)", "def stdProbabilityNorm(self):\n return 0.5", "def normal_init(m, std=0.02):\n nn.init.normal_(m.weight, 0, std)\n if hasattr(m, '...
[ "0.7535688", "0.74445915", "0.72720885", "0.72552395", "0.7232473", "0.7187721", "0.69944406", "0.69675875", "0.6950132", "0.6943617", "0.69266343", "0.6916947", "0.6903026", "0.6901024", "0.68700665", "0.6867972", "0.674518", "0.66957855", "0.66808605", "0.6675005", "0.66399...
0.0
-1
Test that we raise if all glyph in the list do not exist.
def test_missing_glyph_list(tmpdir): path = "%s/dummy/font.ufo" % DATA_DIR out = str(tmpdir / basename(path)) + ".out" with pytest.raises(ACFontError): psautohint([path, '-o', out, '-g', 'FOO,BAR'])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_glyph_name_in_glyph_set(self, *names):\n if self.glyphNames_:\n for name in names:\n if name in self.glyphNames_:\n continue\n if name not in self.missing:\n self.missing[name] = self.cur_token_location_", "def test_c...
[ "0.7234395", "0.61054254", "0.6042614", "0.59862345", "0.5981548", "0.59557825", "0.59420097", "0.588472", "0.588472", "0.5841337", "0.5794836", "0.5726097", "0.5707886", "0.5707886", "0.5700919", "0.5700919", "0.5659442", "0.5652448", "0.5647823", "0.56136364", "0.55958986",...
0.6677484
1
Randomly adjusts hue. Makes sure the output image is still between 0 and 1.
def random_adjust_hue(image, max_delta=0.02): def _random_adjust_hue(image, max_delta): with tf.name_scope('RandomAdjustHue', values=[image]): image = tf.image.random_hue(image, max_delta) image = tf.clip_by_value(image, clip_value_min=0.0, clip_value_max=1.0) return imag...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def adjust_hue(image, delta):\r\n image[..., 0] = np.mod(image[..., 0] + delta * 180, 180)\r\n return image", "def random_color_distort(src, brightness_delta=32, contrast_low=0.5, contrast_high=1.5,\n saturation_low=0.5, saturation_high=1.5, hue_delta=18):\n\n def brightness(src, d...
[ "0.6698813", "0.66532713", "0.6619423", "0.65777075", "0.65287894", "0.6448051", "0.64125663", "0.63813", "0.6362785", "0.63354754", "0.6315596", "0.62928206", "0.61506385", "0.6129147", "0.6117146", "0.6098639", "0.60819864", "0.6077889", "0.60584915", "0.60569906", "0.60272...
0.742048
0
Randomly distorts color. Randomly distorts color using a combination of brightness, hue, contrast and saturation changes. Makes sure the output image is still between 0 and 1.
def random_distort_color(image, color_ordering=0): with tf.name_scope('RandomDistortColor', values=[image]): if color_ordering == 0: image = tf.image.random_brightness(image, max_delta=32. / 255.) image = tf.image.random_saturation(image, lower=0.5, upper=1.5) image = tf....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def random_color_distort(src, brightness_delta=32, contrast_low=0.5, contrast_high=1.5,\n saturation_low=0.5, saturation_high=1.5, hue_delta=18):\n\n def brightness(src, delta, p=0.5):\n \"\"\"Brightness distortion.\"\"\"\n if np.random.uniform(0, 1) > p:\n delta = np.random.uni...
[ "0.83407605", "0.70909065", "0.7066611", "0.69833535", "0.68047786", "0.6751169", "0.64966846", "0.64572704", "0.6393666", "0.6390526", "0.6389167", "0.6257692", "0.6209426", "0.6118559", "0.6045419", "0.6044938", "0.60421985", "0.6029736", "0.59194994", "0.5903636", "0.59025...
0.70877624
2
Filter out bounding boxes based on overlap with reference box [0, 0, 1, 1].
def bboxes_filter_overlap(labels, bboxes, threshold=0.3, scope=None): with tf.name_scope(scope, 'bboxes_filter', [labels, bboxes]): scores = bboxes_intersection(tf.constant([0, 0, 1, 1], bboxes.dtype), bboxes) mask = scores > threshold ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _filter_box_candidates(self, bboxes, labels):\n bbox_w = bboxes[:, 2] - bboxes[:, 0]\n bbox_h = bboxes[:, 3] - bboxes[:, 1]\n valid_inds = (bbox_w > self.min_bbox_size) & \\\n (bbox_h > self.min_bbox_size)\n valid_inds = np.nonzero(valid_inds)[0]\n return ...
[ "0.71711856", "0.70120054", "0.6995763", "0.69317335", "0.6904704", "0.6840584", "0.6824627", "0.67310613", "0.6658745", "0.66085005", "0.65990233", "0.65965545", "0.6593416", "0.65861106", "0.65328556", "0.64946675", "0.6486343", "0.646911", "0.645667", "0.64438975", "0.6443...
0.66897905
8
Accepts width, height (ints). Returns widthxheight grid with '.' as values.
def grid_maker(width, height): grid = [['.' for i in range(width)] for j in range(height)] return grid
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inner_grid(height, width, digit):\n grid = create_grid(height, width)\n for r in range(1, height - 1):\n for c in range(1, width - 1):\n grid[r][c] = digit\n return grid", "def create_grid(height, width):\n grid = []\n \n for r in range(height):\n row = [0] * width ...
[ "0.673675", "0.66852343", "0.65937024", "0.6570823", "0.6495752", "0.6483444", "0.6469815", "0.64483327", "0.64297074", "0.6329973", "0.6247965", "0.6234013", "0.62229836", "0.6218845", "0.62052065", "0.61917883", "0.6190757", "0.61753505", "0.6160231", "0.6132915", "0.611195...
0.78619915
0
Does the user have permission to change this object?
def has_change_permission(self, request, obj=None) -> bool: permission = super().has_change_permission(request, obj) if obj is not None: permission &= (obj.owner == request.user) or request.user.is_superuser return permission
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_change_permission(self, request, obj=None):\n return False", "def has_change_permission(self, request, obj=None):\n if obj is not None:\n return False\n return super().has_change_permission(request, obj)", "def has_change_permission(self, request, instance=None):\n ...
[ "0.83135056", "0.796322", "0.7936939", "0.7780505", "0.77375793", "0.7651158", "0.763335", "0.7607859", "0.758166", "0.75177544", "0.7468441", "0.7466604", "0.7428476", "0.74059796", "0.7341317", "0.7308103", "0.7297571", "0.7267848", "0.7254431", "0.7254304", "0.7240629", ...
0.7769302
4
Function to construct a dictionary of needed parameters for the source and blend
def calc_source_blend_params(params,log): source = photometry_classes.Star() source.fs_g = params['f_s_g'] source.sig_fs_g = params['sig_f_s_g'] (source.g, source.sig_g) = flux_to_mag_pylima(source.fs_g,source.sig_fs_g) source.fs_r = params['f_s_r'] source.sig_fs_r = params['sig_f_s_r'] (...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _getAttributes(self):\n self._params = {}\n if self.interp is not None:\n # Initialize interpolation function :\n self['x'] = np.arange(0, self.pixels, 1)\n self['y'] = np.arange(0, self.pixels, 1)\n # Define newaxis :\n self['xnew'] = np.ara...
[ "0.6123614", "0.6095503", "0.5878764", "0.58631754", "0.5834689", "0.57840544", "0.5771575", "0.576629", "0.57458633", "0.5720387", "0.56854796", "0.5619385", "0.557729", "0.5567191", "0.555161", "0.55226034", "0.55177516", "0.551183", "0.5510357", "0.55013597", "0.54996985",...
0.6665348
0
Function to convert magnitudes into flux units. Magnitude zeropoint is that used by pyLIMA.
def mag_to_flux_pylima(mag, mag_err): ZP = 27.40 flux = 10**( (mag - ZP) / -2.5 ) ferr = mag_err/(2.5*np.log10(np.e)) * flux return flux, ferr
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flux2Mag(flux, zeropoint=27.0):\n return -2.5 * np.log10(flux) + zeropoint", "def mag_to_flux(mag, mag_zp):\n return 10 ** (-0.4 * (mag - mag_zp))", "def _flux_unc_as_mags(fluxes, uncs):\n uncs_mag = np.empty(len(fluxes))\n\n # fluxes-uncs case\n indxs, = np.where(fluxes - uncs <= 0)\n if...
[ "0.749976", "0.73105425", "0.67144835", "0.6641556", "0.66387933", "0.6525458", "0.64769655", "0.6329454", "0.6298302", "0.6292132", "0.61986226", "0.6160247", "0.6094438", "0.60530114", "0.6042385", "0.59621245", "0.5910238", "0.5910054", "0.5894932", "0.5836976", "0.5811747...
0.55611235
49
Function to convert a given floating point value to a string, rounded to the given number of decimal places, and suffix with zero if the value rounds to fewer decimal places than expected
def convert_ndp(value,ndp): value = str(round(value,ndp)) dp = value.split('.')[-1] while len(dp) < ndp: value = value + '0' dp = value.split('.')[-1] return value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fround(val):\r\n if val==0:\r\n return \"0.0\"\r\n lval = math.log10(val)\r\n if lval < 0:\r\n lval -= 1\r\n rval = -int(lval) + 2\r\n if lval > 3:\r\n return str(int(round(val, rval)))\r\n return str(round(val, rval))", "def floatToStrWithDecimals(n: float) -> str:\n\n...
[ "0.77791756", "0.76723504", "0.7496394", "0.7473996", "0.74602914", "0.7322896", "0.72365445", "0.7120033", "0.70229053", "0.70229053", "0.69958997", "0.699494", "0.69812876", "0.6945331", "0.693564", "0.6907206", "0.6878701", "0.6878701", "0.68672186", "0.68336993", "0.67851...
0.0
-1
test initialization of ScipyOdeSolver
def test_init(self): # call function to test test_object = ScipyOdeSolver(integrator=self._integrator, **self._kwargs) assert test_object._solver is None assert test_object._solver_args == self._kwargs, 'unexpected additional arguments. Keep in mind None and {}.' assert test_obje...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_init(self):\n # setup test scenario\n _kwargs = {'nsteps': 5}\n # call function to test\n test_object = ScipyOdeIntSolver(**_kwargs)\n # verify the expected results\n assert test_object._solver_args == _kwargs, 'unexpected additional arguments. Keep the type in mi...
[ "0.80970603", "0.7623596", "0.6404012", "0.6244368", "0.62345624", "0.6225582", "0.6223145", "0.62131876", "0.6189504", "0.6107531", "0.61028105", "0.60981387", "0.60879326", "0.60712326", "0.60402554", "0.5983581", "0.59798837", "0.5978107", "0.59713274", "0.59667414", "0.59...
0.8293471
0
Get date of last model update.
def updated_at(self, request, format=None): updated_at = model_updated_at() if not updated_at: raise NotFound("unable to retrieve latest update") return Response({"updated_at": updated_at})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dt_last_update(self):\n return self.last_update", "def last_update(self):\n return self._last_update", "def last_update(self):\n return self._last_update", "def last_update_datetime(self):\n return datetime.strptime(self.last_update, \"%Y-%m-%d %H:%M:%S.%f\")", "def last_upd...
[ "0.81468487", "0.78191745", "0.78191745", "0.76979446", "0.76979446", "0.76656485", "0.7637578", "0.7560516", "0.75564885", "0.7518988", "0.7518988", "0.7514035", "0.750313", "0.74939936", "0.7488683", "0.74587584", "0.738158", "0.73390913", "0.7309557", "0.7212866", "0.72128...
0.0
-1
Sensitivity == Recall for positive class == True Positive Rate (TPR)
def sensitivity(self): return self.recall
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tpr(y_true, y_pred):\n return recall(y_true, y_pred)", "def sensitivity(\n targets: List[int], preds: List[float], threshold: float = 0.5\n) -> float:\n return recall(targets, preds, threshold)", "def true_positive_rate(y_true, y_pred):\n p = np.sum(y_true == 1)\n tp = np.sum((y_pred == y_tr...
[ "0.73765707", "0.6909939", "0.6847328", "0.6834903", "0.6827358", "0.679122", "0.67816097", "0.6779025", "0.6734615", "0.6729492", "0.6719824", "0.66894984", "0.66894984", "0.66894984", "0.66894984", "0.66894984", "0.66894984", "0.6671621", "0.6671621", "0.6671621", "0.667162...
0.7260516
1
Specificity == Recall for negative class == True Negative Rate (TNR)
def specificity(self): return self.tn / (self.tn + self.fp) if self.tn + self.fp > 0 else .0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tpr(y_true, y_pred):\n return recall(y_true, y_pred)", "def specificity_score(y_true, y_pred):\n tn, fp, _, _ = confusion_matrix(y_true = y_true,\n y_pred = y_pred).ravel()\n return tn/(tn + fp)", "def sensitivity(self):\n return self.recall", "def recall(y, model):\n\n\tTP, FP, TN, FN...
[ "0.6542485", "0.62172294", "0.6198692", "0.6178045", "0.6134543", "0.61217785", "0.6112487", "0.60828185", "0.6013489", "0.59993356", "0.5987059", "0.59639305", "0.5956821", "0.5937733", "0.59234333", "0.5914624", "0.5895619", "0.5877519", "0.5871471", "0.58496696", "0.583159...
0.6005623
9
If normalize=True, return fracture of misclassifications (y_true != y_pred). Else, return number of misclassifications.
def zero_one_loss(self, normalize=True): zero_one_loss = len((self.y_true - self.y_pred).nonzero()[0]) if normalize: zero_one_loss /= len(self.y_pred) return zero_one_loss
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def specificity(y_true, y_pred):\n\n cm = confusion_matrix(y_true, y_pred)\n return cm[0,0] / cm[0,:].sum()", "def get_percentage_false_class_for_resultset(results):\n count_success = 0\n count_correct_prediction = 0\n for result in results:\n if result[\"image_target\"] == result[\"predict...
[ "0.6834027", "0.6468277", "0.64431214", "0.641613", "0.6346094", "0.63054097", "0.6299627", "0.62912655", "0.62885886", "0.62706494", "0.6241315", "0.6231778", "0.6212264", "0.6206508", "0.61876756", "0.6175624", "0.6173592", "0.6153468", "0.6144407", "0.61412317", "0.6136116...
0.649688
1
Matthew's Correlation Coefficient = sqrt(P1 R1 P0 R0), ie. multiplication of geometric means of precision and recall for every class.
def mcc(self): tp = self.tp tn = self.tn fp = self.fp fn = self.fn return tp * tn / np.sqrt((tp + fp) * (tp + fn) * (tn + fp) * (tn + fn))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cramers_corrected_stat(confusion_matrix):\n chi2 = ss.chi2_contingency(confusion_matrix)[0]\n n = confusion_matrix.sum().sum()\n phi2 = chi2/n\n r,k = confusion_matrix.shape\n phi2corr = max(0, phi2 - ((k-1)*(r-1))/(n-1)) \n rcorr = r - ((r-1)**2)/(n-1)\n kcorr = k - ((k-1)**2)/(n-1)\n ...
[ "0.6675868", "0.6654933", "0.66156834", "0.6277341", "0.62697893", "0.6259764", "0.6224434", "0.6208741", "0.61981934", "0.6122937", "0.60562223", "0.60539615", "0.6048687", "0.6041884", "0.59984845", "0.5979102", "0.5958343", "0.5955607", "0.5920376", "0.591997", "0.5882642"...
0.6651753
2
Return the euclidean distance between the vectors 'x' and 'y'.
def euclidean_metric(x, y): if len(x) != len(y): raise ValueError("Incompatible dimensions.") return np.linalg.norm(x - y) # Or a slightly longer way: return np.sqrt(np.sum(np.subtract(x, y)**2)) # Or the longest/worst way: total = 0 for i in xrange(len(x)): term = x[i] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def euclidean_distance(x, y):\n return sqrt(sum(pow(a - b, 2) for a, b in zip(x, y)))", "def euclidean_distance(x, y):\n x1, y1 = x\n x2, y2 = y\n return sqrt((x1 - x2)**2 + (y1 - y2)**2)", "def euclidean_distance(x: np.ndarray, y: np.ndarray) -> float:\n distance_vector: np.ndarray = x - y\n ...
[ "0.8581612", "0.856618", "0.8505916", "0.84947085", "0.84711915", "0.8369592", "0.8315039", "0.8299614", "0.8277346", "0.8259492", "0.82235307", "0.81133443", "0.803702", "0.7974811", "0.7968354", "0.79371613", "0.7902702", "0.7880132", "0.7868129", "0.7853336", "0.78476536",...
0.80550975
12
Construct a KD Tree node containing 'data'. The left, right, and prev attributes are set in the constructor of BSTNode.
def __init__(self, data): if type(data) != np.ndarray: raise TypeError("A numpy array or a list is required.") BSTNode.__init__(self, data) self.axis = 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert(self, data):\n \n def _find_parent(current, node):\n \"\"\"Recursively descend through the tree to find the node that\n should be the parent of the new node. Do not allow for duplicates.\n \"\"\"\n \n if node == current:\n ...
[ "0.6991536", "0.6837276", "0.6792005", "0.6787726", "0.6772486", "0.67445564", "0.64986145", "0.6381475", "0.63781536", "0.6319161", "0.62575626", "0.62441975", "0.6178945", "0.61460155", "0.61107457", "0.6089009", "0.60106057", "0.6008295", "0.5980887", "0.598025", "0.595371...
0.6543667
6
Uses a blurred version of the input tensor to perform "adaptive thresholding", except it boosts or inhibits instead, since there's no threshold. When used on an edge_orientation_detector or stripe detector, this can brighten edges that are faint, but in dark or blurry parts of the mage. It will also dim edges that are ...
def regulate_tensor(input_tensor, blur_tensor, regulation_value, regulation_root=1.0 / 2.0, strides=(1, 1, 1, 1), padding='SAME' ): blurred_input = tf.nn.conv2d(input=input_tensor, filter=blur_ten...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def image_threshold(image, blur=5, blocksize=11, threshold=None, adaptive=False):\n # image_eq = cv.equalizeHist(image_resize)\n image_blur = cv.medianBlur(image, blur)\n if adaptive:\n image_thre = cv.adaptiveThreshold(image_blur, 255, cv.ADAPTIVE_THRESH_GAUSSIAN_C,\n ...
[ "0.6705004", "0.64273584", "0.6287692", "0.6285893", "0.61030835", "0.5976032", "0.59633434", "0.59179074", "0.59166205", "0.58686024", "0.58613783", "0.58067876", "0.57927775", "0.577745", "0.5749583", "0.5749189", "0.57344246", "0.57301855", "0.56846195", "0.565683", "0.564...
0.0
-1
2D gaussian mask should give the same result as MATLAB's fspecial('gaussian',[shape],[sigma])
def matlab_style_gauss2D(shape=(3,3),sigma=0.5): m,n = [(ss-1.)/2. for ss in shape] y,x = np.ogrid[-m:m+1,-n:n+1] h = np.exp( -(x*x + y*y) / (2.*sigma*sigma) ) h[ h < np.finfo(h.dtype).eps*h.max() ] = 0 sumh = h.sum() if sumh != 0: h /= sumh return h
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gaussian(size,sigma):\n a,b=np.ogrid[-size/2:size/2,-size/2:size/2]\n mask = a**2+b**2\n mask = np.exp(-mask.astype('float')/(2*float(sigma**2)))\n return mask", "def fspecial_gaussian(shape=(3, 3), sigma=0.5):\n m, n = [(ss - 1.) / 2. for ss in shape]\n y, x = np.ogrid[-m:m + 1, -n:n + 1]\...
[ "0.78298295", "0.7562447", "0.72262615", "0.7156081", "0.6948819", "0.68495923", "0.6787495", "0.67696434", "0.6715893", "0.6712144", "0.6687262", "0.6681933", "0.6675972", "0.66417176", "0.6611884", "0.65843153", "0.65664244", "0.6559194", "0.650544", "0.65041184", "0.648513...
0.6751125
8
Prefix is a string to be corrected. N is the maximum number of suggestions to return.
def autocorrect(self, prefix, N): def valid_edits(): letters, length = "abcdefghijklmnopqrstuvwxyz".upper(), len(prefix) yield from ( #add letter prefix[:i] + l + prefix[i:] for i in range(length+1) for l i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def neuronyms(input_str, k):\n n = len(input_str)\n result = []\n\n for length in range(k, n-k+1):\n for start in range (1, n - length):\n prefix = input_str[:start]\n suffix = input_str[(start+length):]\n res_str = prefix+str(length)+suffix\n result.appe...
[ "0.59214896", "0.5845191", "0.5781783", "0.57275796", "0.56218916", "0.5587917", "0.5567679", "0.55003136", "0.5457906", "0.5360151", "0.5347246", "0.5333247", "0.51826334", "0.51765376", "0.51651806", "0.5148544", "0.5114489", "0.5092106", "0.5069504", "0.5036377", "0.503573...
0.74329436
0
Testing if an empty Feed's to_dict behaves as expected.
def test_empty_feed_to_dict(self): expected = dict(feed=[]) feed = Feed() assert feed.to_dict() == expected
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_empty_feed_to_json(self):\n expected = '{\"feed\": []}'\n feed = Feed()\n assert feed.to_json() == expected", "def test_to_dict(self):\n\n class Person(Model):\n name = StringField()\n age = IntegralField(bounds = (0, None))\n siblings = ListF...
[ "0.7286628", "0.6306138", "0.6147728", "0.6085076", "0.6030236", "0.6020599", "0.59776336", "0.59496844", "0.5942206", "0.5891711", "0.584421", "0.5740076", "0.5644896", "0.56419814", "0.56403023", "0.56403023", "0.56403023", "0.5623869", "0.5614908", "0.55974066", "0.5594574...
0.8887722
0
Add a magnitude value to the mag table.
def add_mag(self, band, m, errm): if self.mag is None: names = ['BAND', 'MAG', 'MAG_ERR'] dtypes = [TABLES_SCHEMA['MAG'][name]['dtype'] for name in names] self.mag = Table(names=names, rows=[[band, m, errm]], dtype=dtypes, masked=True) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_mag(self, ra, dec, mag, mag_err, filt, mjd):\n \n pt = Table(names=self.__mag_colnames, \n data=[[ra],[dec],[mag],[mag_err],[filt],[mjd]])\n \n LightCurve.add_tables(self, pt)", "def add_Mag_Value(self, input):\n self.magflux = input", "def magnitude...
[ "0.73281246", "0.72576725", "0.7209636", "0.67425555", "0.67243344", "0.64906657", "0.6241515", "0.6122535", "0.60030633", "0.5874227", "0.5790341", "0.5733299", "0.56979436", "0.5664324", "0.56450087", "0.5555322", "0.5554078", "0.5535323", "0.54744095", "0.54577047", "0.545...
0.68618625
3
Gets the db_name of this DataComparisonViewSeries.
def db_name(self): return self._db_name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_name(self) -> str:\n return self.dbname", "def get_db_name(self):\n\t\treturn conf.db_name", "def database_name(self) -> str:\n return pulumi.get(self, \"database_name\")", "def getDatabaseName(self):\n return self._base.getDatabaseName()", "def getDatabaseName(self):\n ...
[ "0.7382984", "0.71715534", "0.71187735", "0.7101013", "0.70622605", "0.6974287", "0.68728095", "0.66000754", "0.65394896", "0.64934355", "0.6480922", "0.64536273", "0.6439797", "0.6425338", "0.6402414", "0.63960105", "0.63682497", "0.63577193", "0.63577193", "0.63282716", "0....
0.7617493
0
Sets the db_name of this DataComparisonViewSeries.
def db_name(self, db_name): self._db_name = db_name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def set_db_name_field(self, db_name_field):\n self.db_name_field = db_name_field", "def set_name(self, name, modify=False):\n assert not hasattr(self, \"_dbcnx\") # Must be done before any write ops.\n if name == self.db.get(\"name\"):\n return\n if not constants.NAM...
[ "0.71345747", "0.6528521", "0.619897", "0.6170134", "0.6091895", "0.6073515", "0.59303135", "0.5917222", "0.58886814", "0.5882192", "0.57869935", "0.57480305", "0.5691971", "0.56839836", "0.5666901", "0.5666901", "0.5648025", "0.55824363", "0.55642724", "0.5561375", "0.554339...
0.7715065
0
Gets the query of this DataComparisonViewSeries.
def query(self): return self._query
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def query(self):\n \n return self._query", "def getQuery(self):\n return self._query", "def query(self):\n return self.__query", "def query(self):\n return self.details[KEY_QUERY]", "def _get_query(self):\n\n endpoint = ENDPOINTS[self.sync_data.endpoint_index]\n ...
[ "0.7015593", "0.69879746", "0.6977874", "0.6912564", "0.68000424", "0.64849216", "0.64579654", "0.6355771", "0.6249482", "0.61530405", "0.60995746", "0.60608363", "0.6040059", "0.597995", "0.5891397", "0.5880802", "0.5876242", "0.5849232", "0.5846716", "0.5846716", "0.579728"...
0.69825613
3
Sets the host of this DataComparisonViewSeries.
def host(self, host): self._host = host
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def host(self, host):\n if host is None:\n raise ValueError(\"Invalid value for `host`, must not be `None`\")\n\n self._host = host", "def Host(self, h):\r\n\r\n self.host = h\r\n return self", "def host(self, host: str):\n\n self._host = host", "def host(self, h...
[ "0.658437", "0.63947016", "0.62381077", "0.6224523", "0.6116356", "0.5977164", "0.5956971", "0.5897918", "0.5897918", "0.587505", "0.5738361", "0.5738361", "0.57100856", "0.56626105", "0.5651834", "0.55388063", "0.5532677", "0.5532677", "0.54895324", "0.54895324", "0.53642064...
0.6636628
2
find difference in days between two dates in format YYYYMMDD
def dates_diff(date2, date1): d2 = datetime.datetime.strptime(date2, '%Y-%m-%d').date() d1 = datetime.datetime.strptime(date1, '%Y-%m-%d').date() return (d2 - d1).days
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def diff_dates(date1, date2):\n\n return abs(date2 - date1).days", "def difference_in_days(y1,m1,d1, y2,m2,d2):\n date1 = date(y1,m1,d1)\n date2 = date(y2,m2,d2)\n return abs(date2 - date1)", "def days_between(self, d1, d2):\n self.is_not_used()\n try:\n d1 = self.format_da...
[ "0.83919436", "0.77456963", "0.762012", "0.7521651", "0.7509029", "0.74992144", "0.7373743", "0.70983493", "0.7091247", "0.7035548", "0.69674397", "0.6934707", "0.6909548", "0.69010127", "0.6872274", "0.6785714", "0.67335755", "0.66883916", "0.6635921", "0.6619084", "0.661760...
0.81366277
1
Only admin can review story
def test_review_story_restrict_to_only_admin(self): self.client.post('/api/stories', headers={'token': user_token}, data=json.dumps(story1)) res = self.client.put('/api/stories/1/review', headers={'token': user_token}, data=json.dumps({ 'status': 'Approved' })) result = json....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_user_can_change_not_author(self):\n self.assertFalse(self.story.user_can_change(self.user2))", "def test_user_can_change_admin(self):\n self.assertTrue(self.story.user_can_change(self.admin_user))", "def can_modify(article):\n return authenticated() and article.adder_id == session['us...
[ "0.66325384", "0.65592504", "0.6403234", "0.6373382", "0.63636655", "0.632945", "0.63272446", "0.6281198", "0.6268817", "0.62612724", "0.62580127", "0.6228061", "0.6190261", "0.618594", "0.6161414", "0.6161414", "0.61550725", "0.61499006", "0.6138184", "0.60889876", "0.608685...
0.84144396
0
Reverse the specified axis directions.
def reverse_axis(self, x: bool, y: bool, z: bool) -> None: current_directions = self.i2c.read(self.Register.AXIS_MAP_SIGN, 1)[0] if x: current_directions |= (1 << 2) else: current_directions &= ~(1 << 2) if y: current_directions |= (1 << 1) els...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reverse(self):\n self.left_motor.reverse()\n self.right_motor.reverse()", "def move_reverse(self, speed):\n\t\t# You should modify the bias of 4 wheels depending on your hardware.\n\t\tself._front_left_wheel.clockwise_rotate(speed + LEFT_FR_BIAS + LEFT_RIGHT_BIAS)\n\t\tself._front_right_wheel.a...
[ "0.65726304", "0.6537739", "0.6431789", "0.64169574", "0.6324468", "0.6249376", "0.6192049", "0.6143278", "0.6143278", "0.6088696", "0.59875935", "0.5986616", "0.5986539", "0.5979762", "0.5958174", "0.5943273", "0.5941754", "0.5929439", "0.5923644", "0.59128803", "0.58859324"...
0.7721019
0
Returns dataset records index for a given dataset id The dataset info is stored in two elasticsearch indices. The main index where all datasets definition are stored and an specific dataset index for data records. This function calculates the corresponding dataset records index for a given dataset id.
def dataset_records_index(dataset_id: str) -> str: return DATASETS_RECORDS_INDEX_NAME.format(dataset_id)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def id_to_index(self, id):\n raise NotImplementedError", "def id_to_local_index(self, id):\n raise NotImplementedError", "def find_index_with_document(document_id): \n client, index_name = connection_es()\n res = client.search(index = index_name+\"*\")\n\n for record in res['hits']['h...
[ "0.5957523", "0.5783832", "0.571519", "0.5693084", "0.5659861", "0.5606792", "0.5578864", "0.5478477", "0.5458815", "0.538822", "0.5344541", "0.5331411", "0.53035897", "0.5291753", "0.5272479", "0.5262516", "0.52181613", "0.5204666", "0.51908666", "0.5185456", "0.51659465", ...
0.7688621
0
Finds a dataset by name
def find_by_name(self, name: str, owner: Optional[str]) -> Optional[DatasetDB]: dataset = DatasetDB(name=name, owner=owner, task=TaskType.text_classification) document = self._es.get_document_by_id( index=DATASETS_INDEX_NAME, doc_id=dataset.id ) if not document: #...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dataset_by_name(name):\n return _datasets[name.lower()]", "def get_by_name(self, name: str) -> Optional[\"Dataset\"]:\n raise NotImplementedError", "def find_dataset_using_name(dataset_name):\n\tdataset_filename = \"data.\" + dataset_name + \"_dataset\"\n\tdatasetlib = importlib.import_module(dat...
[ "0.8315046", "0.78612006", "0.7656871", "0.76313376", "0.7596329", "0.7557096", "0.7557096", "0.7557096", "0.7304355", "0.72841144", "0.7221243", "0.71844554", "0.7091887", "0.70574844", "0.70395064", "0.6923077", "0.6923077", "0.68659073", "0.68367636", "0.68367636", "0.6812...
0.7266562
10
close the connection on destruction
def __del__(self): self.sock.shutdown(socket.SHUT_RDWR) self.sock.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close(self): \n\t\tself.connection = None", "def close(self): \n self.connection.close()", "def _close_connection(self):\n if self.connection:\n self.connection.destroy()\n self.connection = None", "def close(self):\n self.connection = None", "def close(self):...
[ "0.829934", "0.8239212", "0.8224784", "0.8180476", "0.816377", "0.81573224", "0.8086401", "0.80557156", "0.8050782", "0.8018552", "0.8018552", "0.7987147", "0.7973549", "0.7973549", "0.7973549", "0.7973549", "0.7973549", "0.7973549", "0.7973549", "0.7967071", "0.79364413", ...
0.0
-1
Get a duplicated an orderSource by id Returns a duplicated orderSource identified by the specified id. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response.
def get_duplicate_order_source_by_id(self, order_source_id, **kwargs): all_params = ['order_source_id'] all_params.append('callback') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_order_source_by_id(self, order_source_id, **kwargs):\n\n all_params = ['order_source_id']\n all_params.append('callback')\n\n params = locals()\n for key, val in iteritems(params['kwargs']):\n if key not in all_params:\n raise TypeError(\n ...
[ "0.66745776", "0.5517342", "0.52478254", "0.5221883", "0.5098154", "0.50221986", "0.5011595", "0.49596417", "0.49518993", "0.49217278", "0.48122165", "0.48106334", "0.4796126", "0.4796126", "0.47762358", "0.4775734", "0.46240535", "0.45958412", "0.45636833", "0.45395464", "0....
0.8174212
0
Get an orderSource by id Returns the orderSource identified by the specified id. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response.
def get_order_source_by_id(self, order_source_id, **kwargs): all_params = ['order_source_id'] all_params.append('callback') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def retrieve_source(self, id, **kwargs):\n kwargs['_return_http_data_only'] = True\n if kwargs.get('callback'):\n return self.retrieve_source_with_http_info(id, **kwargs)\n else:\n (data) = self.retrieve_source_with_http_info(id, **kwargs)\n return data", "de...
[ "0.7140801", "0.615545", "0.550196", "0.54477537", "0.540144", "0.5393389", "0.5299431", "0.52896816", "0.51840806", "0.51412636", "0.5048842", "0.5035559", "0.50302464", "0.49424887", "0.49166688", "0.4843133", "0.48154768", "0.4772977", "0.4703831", "0.46779385", "0.4669708...
0.7147534
0
Update an orderSource Updates an existing orderSource using the specified data. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response.
def update_order_source(self, body, **kwargs): all_params = ['body'] all_params.append('callback') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argume...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_source(self, id, **kwargs):\n kwargs['_return_http_data_only'] = True\n if kwargs.get('callback'):\n return self.update_source_with_http_info(id, **kwargs)\n else:\n (data) = self.update_source_with_http_info(id, **kwargs)\n return data", "def upda...
[ "0.71573055", "0.5993753", "0.5870925", "0.55949724", "0.543207", "0.5273428", "0.5209868", "0.52072215", "0.51247984", "0.5100473", "0.5095568", "0.5090743", "0.49511385", "0.49097335", "0.48962596", "0.48806354", "0.48650104", "0.4835693", "0.48043844", "0.4793257", "0.4754...
0.667457
1
Resets the sampling distribution to its initial state.
def reset(self): self.st = segment_tree.SegmentTreeSampler(self.n, np.ones(self.n) * self.reg, self.random_state)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset(self):\n # Sample random state from initial state distribution\n self._cur_state = self._sample_state(self._mdp.I)\n self._prev_state = self._cur_state", "def reset(self) -> None:\n self._rng = random.default_rng(self.seed)", "def reset(self):\n\n self.scaler = None...
[ "0.8138001", "0.7383074", "0.7305408", "0.72891945", "0.72319645", "0.72319645", "0.72319645", "0.72319645", "0.72319645", "0.72319645", "0.72319645", "0.72319645", "0.72319645", "0.72319645", "0.72319645", "0.71908796", "0.71828336", "0.706526", "0.70501596", "0.6940053", "0...
0.740369
1
Return the TensorBay dataset ID.
def dataset_id(self) -> str: return self._dataset_id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_dataset_id(self) -> int:\n return self.dataset_id", "def dataset_id(self) -> str:\n return pulumi.get(self, \"dataset_id\")", "def dataset_id(self) -> str:\n return pulumi.get(self, \"dataset_id\")", "def dataset_id(self) -> str:\n return pulumi.get(self, \"dataset_id\")",...
[ "0.7654164", "0.76146555", "0.76146555", "0.76146555", "0.74554205", "0.7189322", "0.7109422", "0.6466518", "0.6372178", "0.63105994", "0.6289424", "0.62080204", "0.6205634", "0.6171636", "0.6157744", "0.6016064", "0.59797025", "0.5950912", "0.5935619", "0.5921152", "0.588000...
0.7521779
4
Create the tag for a commit.
def create_tag(self, name: str, revision: Optional[str] = None) -> None: if not revision: self._status.check_authority_for_commit() revision = self._status.commit_id post_data: Dict[str, Any] = {"commit": revision, "name": name} self._client.open_api_do("POST", "tags", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_tag(tag, directory=None):\n execute_command('git tag {0}'.format(tag), shell=True, cwd=directory)", "def createTag(self, authenticationToken, tag):\r\n pass", "def _create_tag_message(commits: List[git.objects.commit.Commit],\n tag: semantic_version.Version) -> str:\...
[ "0.69922817", "0.6541272", "0.64632326", "0.64579797", "0.6395882", "0.6382432", "0.6374895", "0.6246311", "0.6019642", "0.6014438", "0.5927673", "0.592331", "0.59022206", "0.586923", "0.5859174", "0.5837791", "0.5830196", "0.58115965", "0.58014315", "0.5798078", "0.5756393",...
0.65079796
2
Test that a ``DatasetSparseArray`` can be valueinitialized from any Scipy sparse array or matrix.
def test_value_init(self, sp_in): dset_sp = DatasetSparseArray(sp_in) assert dset_sp.info["type_id"] == "sparse_array" assert dset_sp.info["py_type"] == f"scipy.sparse.{type(sp_in).__qualname__}" assert dset_sp.sparse_array_class is type(sp_in) sp_out = dset_sp.get_value() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_check_sparse(self):\n x, x_rand, s = self.create_testdata()\n task = mmRDTR()\n #check that a dense array x is passed thru unchanged\n check = task.check_sparse(x)\n self.assertEqual(np.all(check==x),True)\n #check that a sparse matrix s is converted to a numpy ar...
[ "0.7118118", "0.66917944", "0.667415", "0.66453356", "0.6608166", "0.6524533", "0.65137887", "0.6513757", "0.6392806", "0.63385946", "0.6295052", "0.61761546", "0.6168989", "0.61542964", "0.6119205", "0.61092794", "0.6096328", "0.6076661", "0.6062966", "0.60532755", "0.597598...
0.7380421
0
Test that a ``DatasetSparseArray`` is correctly bindinitialized.
def test_bind_init(self, sp_in): bind = DatasetSparseArray(sp_in).bind dset_sp = DatasetSparseArray(bind=bind) assert dset_sp.info["type_id"] == "sparse_array" assert dset_sp.info["py_type"] == f"scipy.sparse.{type(sp_in).__qualname__}" assert dset_sp.sparse_array_class is typ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_value_init(self, sp_in):\n\n dset_sp = DatasetSparseArray(sp_in)\n\n assert dset_sp.info[\"type_id\"] == \"sparse_array\"\n assert dset_sp.info[\"py_type\"] == f\"scipy.sparse.{type(sp_in).__qualname__}\"\n assert dset_sp.sparse_array_class is type(sp_in)\n\n sp_out = ds...
[ "0.65316635", "0.6366145", "0.6008172", "0.5721807", "0.5670536", "0.56609863", "0.56609863", "0.5634005", "0.56091774", "0.55947524", "0.55246085", "0.5432445", "0.53849155", "0.53728503", "0.53639317", "0.5355728", "0.53400546", "0.53393406", "0.5327039", "0.53094894", "0.5...
0.80727464
0
Formats a yaml template.
def format_yaml(yaml, **kwargs): template = _YamlTemplate(yaml) try: return template.substitute(flatten(kwargs or {}, reducer='dot')) except KeyError as e: raise RuntimeError( 'Unknown placeholder: {}'.format(e.args[0])) from e
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_yaml(template, config):\n formatted = template\n for k, v in config.items():\n formatted = formatted.replace('${%s}' % k, v)\n return formatted", "def user_create_yaml(self):\n pass", "def format_yaml(self,query_results):\n results=query_results.data\n factory=fa...
[ "0.75154", "0.6408589", "0.63374305", "0.60574484", "0.60236526", "0.5820675", "0.5723422", "0.57128394", "0.56727976", "0.5636376", "0.5549241", "0.5502198", "0.5487231", "0.5474436", "0.5458711", "0.5455569", "0.5455398", "0.54478973", "0.5446734", "0.5438602", "0.54193604"...
0.73730516
1
Create a super user of the system, requiring Email and password.
def createsuperuser(): email = prompt('User E-Mail') email_confirm = prompt('Confirm E-Mail') if not email == email_confirm: sys.exit('\nCould not create user: E-Mail did not match') if not EMAIL_REGEX.match(email): sys.exit('\nCould not create user: Invalid E-Mail addresss') pas...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_superuser(self, email, password, **extra_fields):\n return self.create_user(email, password, is_staff=True,\n is_superuser=True, **extra_fields)", "def create_superuser(self, email, password, **extra_fields):\n extra_fields.setdefault('is_staff', True)\n ...
[ "0.8160329", "0.81196326", "0.81131476", "0.80929947", "0.8092059", "0.8080631", "0.8066219", "0.8066219", "0.8066219", "0.8036268", "0.8031962", "0.8010611", "0.8004735", "0.79972184", "0.7988099", "0.7980699", "0.79716736", "0.79564136", "0.7942371", "0.7941538", "0.7926197...
0.85160816
0
Constructor for Thompson Sampling Agent on 10 armed test bed
def __init__(self, bandits: List[Bandit]): self.bandits = bandits # mu_pri and var_pri are hypermaterers for prior distribution self.mu_pri = np.zeros(len(self.bandits)) # 5 for each self.var_pri = np.ones(len(self.bandits))*5 # mu and var are hyperparameters for posterior distri...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n\n #call super class's __init__ method\n super(TRiseSampler, self).__init__(name=\"trise\", observed=False)", "def __init__(self):\n Sampler.__init__(self)\n self._registeredIdentifiers = set() # tracks job identifiers used for this adaptive sampler and its inheritors\n ...
[ "0.6751709", "0.658563", "0.65591943", "0.6425104", "0.63007", "0.6160114", "0.6113387", "0.60899556", "0.6040868", "0.6028223", "0.60256225", "0.6022297", "0.60169363", "0.60123956", "0.6004781", "0.5999516", "0.598555", "0.597509", "0.59633285", "0.595142", "0.59439987", ...
0.6115237
6
Extract target_building's meters from the raw data, returning the pd.dataframe which is merged with the 'left join'.
def load_meters_from_buliding(self, target_building, meters_name=[], sample_rate = '1min'): if self.df is None: self.read_data_from_csv() if len(meters_name) < 1 : meters_name = self.meter_name.keys() if 'main' in meters_name: meters_name.remove(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def select_target_data(self, buildings, target_meters=None, threshold=70, sample_rate = '1min'):\n buildings_meters_state = {}\n \n for target_building in buildings:\n self.load_meters_from_buliding(target_building, target_meters, sample_rate)\n \n meters_state...
[ "0.6477615", "0.5791794", "0.5687256", "0.5658846", "0.5552154", "0.5372592", "0.5324957", "0.52998376", "0.5289855", "0.5171098", "0.50778997", "0.50562704", "0.50456136", "0.5039701", "0.5031804", "0.50130314", "0.49842077", "0.49717695", "0.49383754", "0.49293375", "0.4919...
0.66276956
0
Extract meters state from the preprocessed data for each building, returning the pd.dataframe which recorded the meter state for each recorded timestamp.
def meters_state_of_buliding(self, target_building, target_appliances, threshold=70): if target_building not in self.buliding_df.keys(): return meters_state = self.buliding_df[target_building] meters_state = meters_state[[ meter for meter in target_appliances if mete...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def select_target_data(self, buildings, target_meters=None, threshold=70, sample_rate = '1min'):\n buildings_meters_state = {}\n \n for target_building in buildings:\n self.load_meters_from_buliding(target_building, target_meters, sample_rate)\n \n meters_state...
[ "0.61991143", "0.6169256", "0.6016267", "0.5697586", "0.55761045", "0.54360944", "0.5310689", "0.5230262", "0.5211392", "0.51898843", "0.51616734", "0.51127845", "0.51039374", "0.50756645", "0.5044868", "0.5042241", "0.5026856", "0.50211847", "0.4965201", "0.49641198", "0.496...
0.5529322
5
If input_parameter is None, initializing parameters to compute all the buildings and meters.
def init_parameters(self, buildings, target_meters): if self.df is None: self.read_data_from_csv() if buildings is None: buildings = self.find_all_houses().tolist() if target_meters is None: target_meters = self.meter_name.keys() return ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, parameter_dictionary):\n super().__init__(parameter_dictionary)\n\n self.model_string = \"gauss\"\n model_dictionary = self._get_model_dict(__class__.default_parameters)\n\n # wake expansion parameters\n self.ka = model_dictionary[\"ka\"]\n self.kb = mod...
[ "0.60635704", "0.60559714", "0.60168946", "0.593495", "0.59347636", "0.5854408", "0.58299834", "0.5813046", "0.5715866", "0.57052034", "0.56394523", "0.5636921", "0.55865467", "0.55853254", "0.5567117", "0.55548424", "0.5520965", "0.55183446", "0.5508205", "0.5505194", "0.550...
0.68082404
0
Computes distance measure between vectors x and y. Returns float.
def distance(self, x, y): return distance.hamming(x, y)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def euclidean_distance(x: np.ndarray, y: np.ndarray) -> float:\n distance_vector: np.ndarray = x - y\n distance = compute_norm(distance_vector)\n return distance", "def euclidean_distance(x: np.ndarray, y: np.ndarray) -> float:\n\n distance = np.linalg.norm(x - y)\n\n return distance", "def dist...
[ "0.7941278", "0.79141444", "0.7868368", "0.7859733", "0.78261393", "0.77186346", "0.75772005", "0.7556413", "0.7523928", "0.7482404", "0.74487174", "0.74302036", "0.74176687", "0.7389026", "0.7385474", "0.73753023", "0.7319479", "0.73171717", "0.7284823", "0.72683793", "0.725...
0.0
-1
Calculate the great circle distance between two points on the earth (specified in decimal degrees)
def haversine(lon1, lat1, lon2, lat2): # 经度1,纬度1,经度2,纬度2 # 将十进制度数转化为弧度 lon1, lat1, lon2, lat2 = map(radians, [lon1, lat1, lon2, lat2]) # haversine公式 dlon = lon2 - lon1 dlat = lat2 - lat1 a = sin(dlat/2)**2 + cos(lat1) * cos(lat2) * sin(dlon/2)**2 c = 2 * asin(sqrt(a)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def great_circle(lat_1, long_1, lat_2, long_2):\n long_1 = m.radians(long_1)\n lat_1 = m.radians(lat_1)\n long_2 = m.radians(long_2)\n lat_2 = m.radians(lat_2)\n\n d = 2 * 6367.45 * m.asin(\n m.sqrt(haversine(lat_2 - lat_1)\n + m.cos(lat_1)*m.cos(lat_2) *\n haversine(long...
[ "0.81450045", "0.7863265", "0.76322985", "0.76064754", "0.75978696", "0.75965863", "0.75944835", "0.75720793", "0.75630087", "0.7555095", "0.7528691", "0.7517629", "0.7492963", "0.7467739", "0.7452678", "0.7434477", "0.73914117", "0.7357736", "0.73484355", "0.73318124", "0.73...
0.0
-1
Access screen height as a property to ensure it's updated if resized.
def max_line(self): return self.screen.getmaxyx()[0] - 2 # Account for header size
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def height(self):\n return(self.SCREEN_H)", "def screen_height(self):\n # type: () -> int\n return self._screen_height", "def winfo_screenheight(self):\n return self.height", "def height(self):\n _, ymin, _, ymax = self.viewport\n return self.parent.window_size[1] * ...
[ "0.8004458", "0.7843561", "0.78138995", "0.7216422", "0.7196278", "0.71808416", "0.7109853", "0.70496696", "0.69640553", "0.69538856", "0.69409454", "0.69409454", "0.69409454", "0.68782556", "0.68697953", "0.68697953", "0.68697953", "0.68697953", "0.685613", "0.6816238", "0.6...
0.0
-1
Return Curses base color based on the current mode.
def base_color(self): return curses.color_pair(3) if self.cycling else curses.color_pair(1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def baseColor( self ):\n return self._baseColor", "def highlight_color(self):\n return curses.color_pair(4) if self.cycling else curses.color_pair(2)", "def GetBaseColour():\r\n\r\n if wx.Platform == \"__WXMAC__\":\r\n\r\n if hasattr(wx, 'MacThemeColour'):\r\n base_colour = w...
[ "0.71427923", "0.6759934", "0.66861814", "0.6678203", "0.6666445", "0.6527217", "0.6471461", "0.6416465", "0.6383323", "0.633613", "0.6326545", "0.6304626", "0.62441", "0.62441", "0.6187136", "0.61589766", "0.6137757", "0.6134373", "0.6117964", "0.6117532", "0.6116213", "0....
0.8273159
0
View function for home page of site.
def index(request): # Generate counts of some of the main objects num_books = Book.objects.all().count() # The 'all()' is implied by default. num_authors = Author.objects.count() user = request.user.username if request.user.is_authenticated else None context = { 'num_books': num_book...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def home(request):\n\treturn render(request, \"compta/home.html\")", "def home_page(request):\r\n return render(request, 'ez_main/home_page.html')", "def home(request):\r\n return render(request, 'home.html')", "def homepage(request):\n\treturn render(request, 'core/homepage.html')", "def homepage(req...
[ "0.8493426", "0.84268916", "0.83415145", "0.83306193", "0.82976943", "0.8295291", "0.8276345", "0.82545686", "0.82155704", "0.8132563", "0.81246215", "0.81224865", "0.8121264", "0.81049734", "0.8098485", "0.80935514", "0.80935514", "0.80935514", "0.80935514", "0.80935514", "0...
0.0
-1
Load the training data from the data folder and return two DataFrames
def get_training_data(): X = pd.read_csv('../data/train_values.csv').set_index('sequence_id') y = pd.read_csv('../data/train_labels.csv').set_index('sequence_id') return X, y
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def data_import(path):\n train_path = os.path.join(path, \"train.csv\")\n test_path = os.path.join(path, \"test.csv\")\n df_train = pd.read_csv(train_path)\n df_test = pd.read_csv(test_path)\n return df_train, df_test", "def load_training_data(\n self,\n train_data_file=\"datasets/tr...
[ "0.7577721", "0.7517273", "0.7484757", "0.7349378", "0.7227922", "0.71295494", "0.7128832", "0.712066", "0.712066", "0.7039344", "0.7015691", "0.69965154", "0.6935641", "0.69085544", "0.68927777", "0.6867774", "0.68577343", "0.67952585", "0.6779639", "0.6773743", "0.6747562",...
0.7144724
5
Get list of all possible nlength sequences of genes
def get_subs(n): from itertools import product return [''.join(sub) for sub in product('CATGN', repeat=n)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_ngrams(seq, n):\n return", "def get_ngrams(sequence, n):\n length = len(sequence)\n #if only require 1-gram, then we need to add one START and one END to the sequence. \n if n==1 or n==2:\n sequence=[\"START\"]*n+sequence+[\"STOP\"]\n end = n+1 #end i means that when n==1, we n...
[ "0.7104906", "0.68662745", "0.6678237", "0.66410476", "0.6510222", "0.6496182", "0.6486512", "0.64513314", "0.6444254", "0.63689685", "0.6366082", "0.6337199", "0.632188", "0.63135207", "0.62938046", "0.6244213", "0.6188728", "0.61687493", "0.6158821", "0.6150293", "0.6137198...
0.6776302
2
Split lines into wikitext2 to their sentences.
def pre_process(filename, check=True): ntokens = 0 if check: lines = [] for line in codecs.open(filename, "r", "utf-8"): # lines += line.replace("\n","").split() + ["<eos>"] lines += line.split() + ["<eos>"] ntokens = len(lines) lines = [] for line in codecs.open(filename, "r", "utf-8")...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split(text):\n doc = nlp(text)\n sentences = [x.text_with_ws for x in doc.sents]\n return sentences", "def calculate_texts(self) -> None:\n texts = []\n for text in self.texts:\n paragraphs = list(filter(lambda x: x != \"\", text.split(\"\\n\\n\")))\n ...
[ "0.69482213", "0.6577601", "0.65741044", "0.6476077", "0.64626634", "0.6400792", "0.63365096", "0.632405", "0.63068426", "0.6287871", "0.62121373", "0.62022114", "0.6157193", "0.6136608", "0.6102106", "0.6099402", "0.60595083", "0.60595083", "0.6030395", "0.6025512", "0.59701...
0.0
-1
returns a length len(INDICES) list whose jth element is the (first, e.g.\ lexicographically or smallest) mostcommon value from ATTRIB_COLUMN among unique (because no one gets more than one vote) rows determined by the jth row in INDICES.
def majority_vote(indices, df_training, attrib_column): return [stats.mode(df_training.iloc[np.unique(indices_row), attrib_column])[0][0] for indices_row in indices]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_marginal_indexes(actions, mode):\n vi = []\n for v in range(actions[mode].max()+1):\n vals = actions[actions[mode] == v].index.values\n if len(vals) > 0:\n vi.append(vals)\n else:\n vi.append(np.array([0]))\n return vi", "def get_top_att(self, n):\n ...
[ "0.5833364", "0.5741786", "0.5536045", "0.54278946", "0.5310463", "0.5299209", "0.52765346", "0.52683556", "0.52677053", "0.52677053", "0.52677053", "0.5226811", "0.52187836", "0.52187836", "0.52187836", "0.52139425", "0.52023846", "0.5183269", "0.51782835", "0.517298", "0.51...
0.6332359
0
Return a timestamp with microsecond precision.
def _timestamp(): moment = time.time() moment_us = repr(moment).split(".")[1] return time.strftime("%Y-%m-%d-%H-%M-%S-{}".format(moment_us), time.gmtime(moment))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def utc_millisecond_timestamp():\n return __date_to_millisecond_ts(utc())", "def microsecond(self):\n return self._microsecond", "def timestamp(self):\n if self._tzinfo is None:\n s = self._mktime()\n return s + self.microsecond / 1e6\n else:\n return (s...
[ "0.76595306", "0.75434005", "0.7481002", "0.737568", "0.7223046", "0.7208152", "0.7090928", "0.7089517", "0.7027383", "0.7015748", "0.69863594", "0.6901419", "0.68994206", "0.68180865", "0.6816717", "0.6731788", "0.67178917", "0.67129755", "0.6699801", "0.66186666", "0.661841...
0.6232639
50
Evaluate the model and make a prediction.
def predict(self, x: Entry): return self.slope * x.value + self.bias
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluate(self):\n\n\t\t## We should be evaluating on dev dataset as well, so commenting x_test\n\t\t#self.model_score = self.model.evaluate(self.x_test, self.y_test_oh, batch_size=2048)\n\t\tself.model_score = self.model.evaluate(self.x_dev, self.y_dev_oh, batch_size=2048)\n\t\tprint(\"%s score = %f\\n\" %(sel...
[ "0.7676017", "0.74822396", "0.7477749", "0.7364436", "0.73371303", "0.72652864", "0.7170599", "0.71572405", "0.7120425", "0.70977616", "0.70938724", "0.7084463", "0.7075303", "0.70229924", "0.7011029", "0.7007757", "0.7001403", "0.7001342", "0.6960402", "0.69440264", "0.69391...
0.0
-1
Return the set of metrics that are acceptable for regression.
def get_acceptable_regression_metrics(): # it's fairly straightforward for regression since # we do not have to check the labels acceptable_metrics = (REGRESSION_ONLY_METRICS | UNWEIGHTED_KAPPA_METRICS | WEIGHTED_KAPPA_METRICS | ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def supported_metrics(cls) -> List[str]:\n ...", "def _monitor_metrics(self):\n metrics = [\"loss\"]\n try:\n m = U.metrics_from_model(self.model)\n if isinstance(m, list):\n metrics.extend(m)\n except:\n pass\n if self.val_data i...
[ "0.697393", "0.66539055", "0.6568593", "0.6405544", "0.63548934", "0.63467276", "0.6341897", "0.6278197", "0.6242459", "0.6242459", "0.6242107", "0.6221714", "0.6182754", "0.6182181", "0.6172678", "0.61106926", "0.6110528", "0.6102661", "0.61013585", "0.60983175", "0.60909194...
0.81436664
0
Converts sorters to the django query order strings.
def _convert_order_terms(self, sorters): return [sorter.get_order_term() for sorter in sorters]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ordering(self, qs):\n request = self.request\n # Number of columns that are used in sorting\n try:\n i_sorting_cols = int(request.REQUEST.get('iSortingCols', 0))\n except ValueError:\n i_sorting_cols = 0\n\n order = []\n order_columns = self.get_o...
[ "0.6665474", "0.639891", "0.6340162", "0.6293899", "0.6150529", "0.60750437", "0.60260576", "0.6013711", "0.6005273", "0.58384484", "0.5771817", "0.57442737", "0.5740367", "0.5683475", "0.56816757", "0.56795305", "0.5643241", "0.5640281", "0.56199616", "0.5605828", "0.559324"...
0.6101713
5
Update queryset for extra sorter class (it is used for annotations before ordering)
def _update_queryset(self, qs, sorters): for sorter in sorters: qs = sorter.update_queryset(qs) return qs
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_sort(self, qs):\n return qs", "def pre_sort(self, qs):\n return qs", "def sortby(self):\n ...", "def order_queryset(self, queryset):\n if ordering := self.request.query_params.get(\"ordering\"):\n order_by = []\n regex = re.compile(r\"-?annotations__...
[ "0.7250172", "0.7132091", "0.6484185", "0.6311653", "0.62217927", "0.6180804", "0.6146311", "0.59585875", "0.5931064", "0.5886492", "0.5839148", "0.58161145", "0.57928807", "0.5742389", "0.57231367", "0.5705997", "0.5653658", "0.5650678", "0.5582579", "0.5498918", "0.54802436...
0.6778813
2
Calculate reaction rate constant inclusing diffusion effects.
def collins_kimball(k_tst, k_diff): return k_tst * k_diff / (k_tst + k_diff)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reaction_rate (self):\n raise NotImplementedError('Subclass must implement this method')", "def _calculate_r0(net):\n\n r0 = 0\n for reaction in net.reactions:\n t = reaction.rate(net.species)\n r0 += t\n\n return r0", "def rate(self):\n return self....
[ "0.6966348", "0.6823358", "0.63816404", "0.63374317", "0.63204414", "0.6136079", "0.60044575", "0.60017985", "0.5948192", "0.59415853", "0.5932096", "0.58575094", "0.5834925", "0.58057594", "0.5760089", "0.57573336", "0.5718501", "0.57164806", "0.5679746", "0.5628383", "0.557...
0.0
-1
r"""Calculate a reaction rate constant. This function uses the `EyringEvansPolanyi equation
def eyring( delta_freeenergy: Union[float, np.ndarray], # noqa: UP007 molecularity: Optional[int] = None, # noqa: UP007 temperature: Union[float, np.ndarray] = 298.15, # noqa: UP007 pressure: float = constants.atm, volume: Optional[float] = None, # noqa: UP007 ): temperature = np.asarray(tem...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reaction_rate (self):\n raise NotImplementedError('Subclass must implement this method')", "def effective_strain_rate(self):\n epi = self.strain_rate_tensor()\n ep_xx = epi[0,0]\n ep_yy = epi[1,1]\n ep_zz = epi[2,2]\n ep_xy = epi[0,1]\n ep_xz = epi[0,2]\n ep_yz = epi[1,2]...
[ "0.6360081", "0.63287747", "0.62651944", "0.6129641", "0.61094403", "0.60787314", "0.6059931", "0.6017328", "0.59845537", "0.5969471", "0.59435564", "0.59226596", "0.5917354", "0.58982956", "0.58970124", "0.5896137", "0.5895523", "0.58705884", "0.5834656", "0.58201593", "0.57...
0.0
-1
Read the input data file and return a data frame.
def get_df(data): df = pd.read_csv( data, encoding="utf-8", header=None, delimiter="\t", names=["id", "label", "text"], ) sys.stderr.write(f"The input data frame {data} size is {df.shape}\n") return df
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self) -> pd.DataFrame:\n with open(self.file_path, 'r') as in_file:\n headers = in_file.readline()\n headers = headers.replace(\"\\n\", \"\")\n\n if ',' in headers:\n headers = headers.split(',')\n else:\n headers = headers.sp...
[ "0.745393", "0.7193568", "0.71637547", "0.7155248", "0.71304816", "0.7059386", "0.7020053", "0.6999039", "0.6996797", "0.6996797", "0.6996797", "0.698032", "0.6930869", "0.6930869", "0.692229", "0.690407", "0.6856842", "0.68268734", "0.68033123", "0.67920876", "0.6769724", ...
0.6811363
18
Get the value of the given environment variable.
def get_envvar(name, silent=False): value = os.environ.get(name) if value is None: if not silent: raise RuntimeError( 'The environment variable %r is not set ' 'and as such configuration could not be ' 'loaded. Set this variable and make it ' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetEnvVariable(name):\n return os.environ.get(name)", "def getenv(self, var):\n return os.environ[var]", "def windows_get_env_value(var_name: str) -> str:\n if var_name in os.environ.keys():\n return os.environ[var_name]", "def env(var):\n return os.environ[var]", "def get_value(...
[ "0.81464124", "0.7950638", "0.7950252", "0.7920914", "0.7892677", "0.78566206", "0.7793647", "0.7745307", "0.772453", "0.76915824", "0.75823706", "0.75542206", "0.7497144", "0.745181", "0.73981893", "0.7317889", "0.731279", "0.7299501", "0.7284751", "0.7282047", "0.72308666",...
0.7300421
17
Returns A mapping from strings to values containing the initialization parameters for the controller associated with this physical simulation.
def get_controller_parameters(self) -> PhyPropMapping: return {var: getattr(self, var) for var in self._controller_params}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getInitParams(self):\n paramDict = Distribution.getInitParams(self)\n paramDict['mapping'] = self.mapping\n paramDict['values'] = self.values\n return paramDict", "def _get_controller_parameters(self):\n pass", "def _get_constructor_parameters(self) -> Dict[str, Any]:\n return dic...
[ "0.72483146", "0.66985035", "0.66974086", "0.6586048", "0.6524451", "0.64770216", "0.6437648", "0.64374644", "0.64374644", "0.6424768", "0.6386846", "0.63735485", "0.63255435", "0.62887394", "0.62735695", "0.62735695", "0.62478906", "0.6169202", "0.61437416", "0.60869884", "0...
0.737053
0
A helper function to import all the datasets for the project from the input directory parameter. Parameter _________
def importAllDatasets(directory): head_index = findIndex(temp_list, "Gaze") point_index = findIndex(temp_list, "Point") grab_index = findIndex(temp_list, "Grab") pos_index = findIndex(temp_list, "Position") head_data = pd.read_csv(temp_list[head_index]) if head_index != None else None point_dat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def package_datasets(ds_all, dirname=''):\n ds_all = copy.deepcopy(ds_all)\n assert dirname != '', \"dirname required\"\n package_dataset(ds_all['ds_train_um'], dirname=join('.', dirname, 'train'))\n package_dataset(ds_all['ds_valid_um'], dirname=join('.', dirname, 'valid'))\n package_dataset(ds_all...
[ "0.69808424", "0.695065", "0.6812897", "0.6691963", "0.6660903", "0.6643285", "0.6524402", "0.64754254", "0.6382236", "0.63721246", "0.63625026", "0.6355825", "0.63429916", "0.6341335", "0.6336302", "0.63194597", "0.6306186", "0.6295077", "0.62773883", "0.62660724", "0.622818...
0.6905445
2
Another three node linked list.
def l2(): head = l2 = ListNode(2) l2.next = ListNode(4) l2.next.next = ListNode(5) return head
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def l1():\n head = l1 = ListNode(3)\n l1.next = ListNode(4)\n l1.next.next = ListNode(5)\n return head", "def addNodeFront(node, head, tail) :\n if head is None :\n head = node\n tail = node\n return (head, tail)\n head.prev = node\n node.next = head\n head = node\n ...
[ "0.65765566", "0.6000067", "0.59785616", "0.59561443", "0.5893145", "0.58622193", "0.58505946", "0.5849079", "0.5820683", "0.57885146", "0.5779832", "0.5724317", "0.5713365", "0.5700533", "0.5682733", "0.5682733", "0.5682733", "0.5682733", "0.5682733", "0.5659888", "0.5658591...
0.64034545
1
Overloads the `==` operator for local equal check.
def __eq__(self, other: Any) -> bool: if isinstance(other, Device): return self.device_type == other.device_type and self.device_id == other.device_id elif isinstance(other, torch.device): return self.device_type == other.type and self.device_id == other.index else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def equals(x, y):\n return x == y", "def exact(cls, lhs, rhs):\n return lhs == rhs", "def is_equal(self, a, b):\n return a == b", "def __eq__(self,*args):\r\n pass", "def __eq__(self,*args):\r\n pass", "def __eq__(self,*args):\r\n pass", "def __eq__(self,*args):\r\n pass", "def _...
[ "0.7062835", "0.6952132", "0.6883287", "0.68506676", "0.68506676", "0.68506676", "0.68506676", "0.68506676", "0.68506676", "0.68506676", "0.68506676", "0.68506676", "0.68506676", "0.68506676", "0.68506676", "0.68506676", "0.68506676", "0.68506676", "0.68506676", "0.68506676", ...
0.0
-1
Return the percept that the agent sees at this point. (Implement this.)
def percept(self, agent): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def last_percept(self):\n return self.percept", "def percept2(self, agent):\n percepts = [self.time_step]\n for thing in self.things_near(agent.location):\n if isinstance(thing, Gold):\n if agent.location == thing.location:\n percepts.append('Gold')\n...
[ "0.6822079", "0.6512735", "0.64660245", "0.6405829", "0.63911444", "0.63249385", "0.63024384", "0.61707556", "0.6164799", "0.6146392", "0.6146392", "0.61018026", "0.60399216", "0.60248184", "0.6016909", "0.5995408", "0.59270793", "0.5897789", "0.5878415", "0.5833503", "0.5833...
0.66518855
1
Agents start in either location at random.
def default_location(self, thing): return random.choice([loc_A, loc_B])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def randomly_spawn_mothership(self) -> None:\n return", "def _random_start_position(self):\r\n self.position = np.array(random.choice(self.start_positions),\r\n dtype=np.int16)", "def _generate_random_agent(self):\n\n new_random_agent = list(self._all_waypoi...
[ "0.66071594", "0.6512685", "0.6483386", "0.6323551", "0.6265858", "0.6249397", "0.62378234", "0.6218298", "0.62176305", "0.6216443", "0.62076163", "0.6160278", "0.6154073", "0.6123747", "0.61096185", "0.607421", "0.6071444", "0.60190046", "0.601662", "0.6010751", "0.59919596"...
0.59202003
28
The derivative has the same form for x and y so only one is needed, this only changes when calling the interaction on the algotyhm, for all isotrope interactions this should still hold.
def dLJverlet(x,r2,R1,R2): rc = (2**(1/6))*((R1+R2)/(2)) sig_int = (R1+R2)/(2) #JV: This is the sigma of the interaction (in the system units). We don't need to divide by sigma because we are already working with reduced units #JV: Because we are working on reduced units (from the values of the Argon g...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def derivative_given_y(self, y):\n raise NotImplementedError()", "def derivative_given_y(self, y):\n return 1", "def derivative(xi, x, y):\n yi = ((xi-x[1])+(xi-x[2]))/((x[0]-x[1])*(x[0]-x[2])) * y[0]\\\n +((xi-x[0])+(xi-x[2]))/((x[1]-x[0])*(x[1]-x[2])) * y[1]\\\n +((xi-x[0])+(xi...
[ "0.7210092", "0.6948717", "0.67539525", "0.6523836", "0.65163624", "0.645394", "0.6453281", "0.6428581", "0.6399269", "0.63833857", "0.63309765", "0.6323026", "0.63169026", "0.63043684", "0.62473893", "0.6219046", "0.61980313", "0.6155972", "0.6131681", "0.61113036", "0.61003...
0.0
-1
Equality assertion for CommentNode
def assertEqualComment(first: ParserNode, second: ParserNode) -> None: # pragma: no cover assert isinstance(first, interfaces.CommentNode) assert isinstance(second, interfaces.CommentNode) if not isPass(first.comment) and not isPass(second.comment): assert first.comment == second.comment
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n if not isinstance(other, Comment):\n return False\n\n return self.__dict__ == other.__dict__", "def __eq__(self, other):\n if not isinstance(other, Comment):\n return False\n\n return self.to_dict() == other.to_dict()", "def __ne__(se...
[ "0.6982715", "0.69108146", "0.66965055", "0.66513157", "0.64996", "0.64953125", "0.6480128", "0.6340201", "0.6317523", "0.62518746", "0.60762715", "0.6029382", "0.60280293", "0.6007427", "0.5988873", "0.59468126", "0.5908967", "0.5883563", "0.58822143", "0.5851084", "0.584059...
0.7792464
0
Checks that the two lists of file paths match. This assertion allows for wildcard paths.
def assertEqualPathsList(first: Iterable[str], second: Iterable[str]) -> None: # pragma: no cover if any(isPass(path) for path in first): return if any(isPass(path) for path in second): return for fpath in first: assert any(fnmatch.fnmatch(fpath, spath) for spath in second) for ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def matches_glob_list(path, glob_list):\n for glob in glob_list:\n try:\n if PurePath(path).match(glob):\n return True\n except TypeError:\n pass\n return False", "def glob_match(f1, f2):\n if f1.find(\"*\") >= 0:\n if fnmatch.fnmatch(f2,...
[ "0.69976825", "0.68894887", "0.64639604", "0.6331798", "0.63193065", "0.62651986", "0.6234028", "0.61807734", "0.61674404", "0.6128511", "0.61145985", "0.6108269", "0.6031447", "0.60193944", "0.59990156", "0.59972805", "0.5990389", "0.5990389", "0.5983395", "0.5973372", "0.59...
0.81323534
0
Return item id used for authorization.
def get_permission_id(self): return self.blog_id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def item_id(self):\n return self._item_id", "def get_itemId(self):\n return self.metadata['itemId']", "def get_id(self, item):\n return self.exist_products.get(hash(item['title']))", "def GetId(self,item):\r\n id = self.item_itemId.get(item)\r\n if id: return id\r\n ...
[ "0.7963188", "0.76412046", "0.7358729", "0.72905487", "0.7229871", "0.71402735", "0.70712554", "0.6790998", "0.6789634", "0.67702025", "0.6769965", "0.6753716", "0.67529756", "0.66911846", "0.66588473", "0.6656373", "0.6656373", "0.6656373", "0.6656373", "0.6656373", "0.66563...
0.0
-1
Add headers to both force latest IE rendering engine or Chrome Frame, and also to cache the rendered page for 10 minutes.
def add_header(r): r.headers["Cache-Control"] = "no-cache, no-store, must-revalidate" r.headers["Pragma"] = "no-cache" r.headers["Expires"] = "0" r.headers['Cache-Control'] = 'public, max-age=0' return r
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_header(response):\n response.headers['X-UA-Compatible'] = 'IE=Edge,chrome=1'\n response.headers['Cache-Control'] = 'public, max-age=60'\n return response", "def add_header(response):\n response.headers['X-UA-Compatible'] = 'IE=Edge,chrome=1'\n response.headers['Cache-Control'] = 'public, m...
[ "0.82238686", "0.8223043", "0.8223043", "0.8223043", "0.8223043", "0.81963", "0.81638503", "0.81638503", "0.81638503", "0.81638503", "0.81638503", "0.81638503", "0.81638503", "0.81638503", "0.81638503", "0.81638503", "0.81638503", "0.81638503", "0.81638503", "0.81638503", "0....
0.7128429
59
Returns the first true value in the iterable. If no true value is found, returns default If pred is not None, returns the first item for which pred(item) is true.
def first_true(iterable, default=False, pred=None): return next(filter(pred, iterable), default)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def first_true(cls, iterable, default=None, pred=None):\n # first_true([a,b,c], x) --> a or b or c or x\n # first_true([a,b], x, f) --> a if f(a) else b if f(b) else x\n return next(filter(pred, iterable), default)", "def first(iterable: Iterable[T1], predicate: Callable[[T1], bool]) -> Unio...
[ "0.8485681", "0.72869545", "0.7259466", "0.6930554", "0.6791842", "0.66228175", "0.6255117", "0.6208943", "0.6179913", "0.6179678", "0.6057198", "0.5967699", "0.5936815", "0.5906825", "0.58812314", "0.5740605", "0.5740605", "0.5665444", "0.5649892", "0.56421405", "0.55865467"...
0.87013286
0
Get the environment setting. Return the default, or raise an exception if none supplied
def get_env_setting(setting, default=None): try: return environ[setting] except KeyError: if default: return default else: error_msg = "Set the %s env variable" % setting raise StandardError(error_msg)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_env_setting(setting, default=None):\n try:\n return environ[setting]\n except KeyError:\n error_msg = \"ERROR: %s is not set, using default: %s\" % (setting, default)\n print >>stderr, error_msg\n if default is None:\n raise ImproperlyConfigured(error_msg)\n ...
[ "0.83227926", "0.82357234", "0.7687636", "0.7603961", "0.7569115", "0.75486636", "0.7546476", "0.75022733", "0.7484439", "0.7482208", "0.7363875", "0.731481", "0.7269699", "0.7254709", "0.70029926", "0.69895214", "0.6976632", "0.696119", "0.6932693", "0.69048655", "0.6890133"...
0.82482874
1
Load the frontend_practices table from the openprescribing application into BigQuery
def load_ccgs_from_pg(dataset='hscic'): def transform(row): if row[4]: row[4] = "%s 00:00:00" % row[4] if row[5]: row[5] = "%s 00:00:00" % row[5] return row load_data_from_pg( dataset, 'ccgs', 'frontend_pct', CCG_SCHEMA, cols=[x.name for x in CCG_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _process_bigquery():\n config_path = os.path.join(app.app.config['DATASET_CONFIG_DIR'],\n 'bigquery.json')\n table_names = []\n participant_id_column = ''\n sample_id_column = ''\n sample_file_columns = []\n if os.path.isfile(config_path):\n bigquery_confi...
[ "0.60128117", "0.5860961", "0.56180906", "0.5571115", "0.5441921", "0.54228115", "0.5276107", "0.51979786", "0.5159187", "0.5155167", "0.51455545", "0.51303464", "0.50782734", "0.50751024", "0.5072922", "0.50645095", "0.50643027", "0.50410616", "0.5027827", "0.50229484", "0.5...
0.0
-1
Test whether n is prime or not.
def prime(n: int) -> bool: if len(divisors(n)) > 2 or n < 1: return False else: return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isprime(n):\r\n\treturn is_prime(n)", "def isprime(n):\n\treturn is_prime(n)", "def is_prime(n):\n return mr_prime(n)", "def if_prime(cls, n):\n\n if (n <= 1):\n return False\n if (n <= 3):\n return True\n\n if (n % 2 == 0 or n % 3 == 0):\n return ...
[ "0.86130923", "0.8571599", "0.8377603", "0.8316889", "0.83056736", "0.82962877", "0.8290128", "0.8285108", "0.82701975", "0.8262557", "0.8252294", "0.8250923", "0.8231443", "0.8226564", "0.82231003", "0.82197267", "0.82184625", "0.82130325", "0.821277", "0.8199987", "0.819977...
0.817307
24
Drops the block of the right color at the top of the highest block at the current position
def drop(self, color): if self.__get_pixel_color(self.size - 1) is not None: raise Exception("Can't place a block there, already full") for z in range(self.size - 1, -1, -1): if self.__get_pixel_color(z) is not None: return self.place(color, z + 1) # If ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def erase_block(self):\n self.blocks[self.editor_cursor_position[1]][self.editor_cursor_position[0]] = '0'", "def ground(pos, mainColor= wPink, secondColor=wPurple):\n mc.setBlocks(pos.x, pos.y-1,pos.z,pos.x+3, pos.y-1,pos.z, wool, secondColor)\n \n i = 1\n #mc.setBlock(pos.x-1, pos.y-1,pos.z+...
[ "0.6349657", "0.6067524", "0.6036325", "0.5892078", "0.5802571", "0.57995355", "0.5757077", "0.5747382", "0.5740542", "0.57388455", "0.5708859", "0.56466293", "0.56367856", "0.56363815", "0.56327593", "0.56169754", "0.5600635", "0.5582666", "0.5564119", "0.5540102", "0.553730...
0.70701075
0