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
adds vertex too the graph
def add_vertex(self, vertex): if isinstance(vertex, Vertex): self.vertices.append(vertex) return raise TypeError('Is not vertex instance!')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_vertex(self):\n self.visited_node += [False]\n self.V = self.V + 1\n self.adjacency_list.append(list())", "def add_vertex(self, vertex):\n raise NotImplementedError", "def add_vertex(self, vertex):\n self.vertices.append(vertex)\n self.vertex_edge[vertex] = []"...
[ "0.8444718", "0.8405795", "0.84027016", "0.8347319", "0.82984567", "0.82984567", "0.82692504", "0.82684076", "0.8250854", "0.81163555", "0.80030453", "0.7990306", "0.7977892", "0.79580307", "0.7952869", "0.79448366", "0.7936896", "0.78862435", "0.7868379", "0.78374404", "0.78...
0.7745594
23
Take file path as string; return text as string. Takes a string that is a file path, opens the file, and turns the file's contents as one string of text.
def open_and_read_file(file_path): text_data = open(file_path).read() # print text_data return text_data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def open_and_read_file(file_path):\n\n # your code goes here\n text_file = open(file_path)\n text_string= text_file.read()\n text_file.close()\n return text_string", "def open_and_read_file(file_path):\n\n text_file = open(file_path)\n full_text = text_file.read()\n\n return full_text", ...
[ "0.8069566", "0.80472016", "0.80135524", "0.7991375", "0.79214585", "0.78647935", "0.7799252", "0.7659128", "0.76146865", "0.76076645", "0.7570766", "0.7539353", "0.75301206", "0.7503912", "0.7502816", "0.7499204", "0.7412249", "0.7370771", "0.7363133", "0.7328614", "0.729271...
0.7678853
7
Get price to buy this item.
def buy_cost(self): return self._manager.get_buy_price(self.name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def BuyingPrice(self):\n return self.buying_rice", "def get_price(self):\n return self._price", "def buy_and_pay(self):\n return self.price", "def get_price(self):\n if self.price is None:\n price = self.data['pizza'][self.item_type][self.size]\n for topping ...
[ "0.7788926", "0.77589", "0.7727518", "0.76948696", "0.76717347", "0.76717347", "0.76717347", "0.7596192", "0.7549002", "0.7534036", "0.7481051", "0.74360794", "0.74360794", "0.7435107", "0.7391166", "0.7391166", "0.73820263", "0.73068106", "0.7280886", "0.72712225", "0.724865...
0.76701343
7
Get price when selling this item.
def sell_cost(self): return self._manager.get_sell_price(self.name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_price(self):\n return self.sale_price if self.sale_price else self.price", "def get_price(self):\n return self._price", "def get_price(self):\n return self.price", "def get_price(self):\n return self.price", "def get_price(self):\n return self.price", "def getPr...
[ "0.84096724", "0.8157844", "0.8141777", "0.8141777", "0.8141777", "0.80575365", "0.8051656", "0.7904067", "0.7898591", "0.7898591", "0.7883795", "0.7846364", "0.7842789", "0.7596818", "0.7568281", "0.75026655", "0.75026655", "0.74983364", "0.74777", "0.7455367", "0.7359848", ...
0.7923166
7
Get the emoji of this item.
def emoji(self): return self._manager.get_emoji(self.name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_emoji(self, icon):\n emojis = self.config['emojis']\n emoji = emojis.get(icon, '')\n return emoji", "async def getemoji(self, ctx):\n pass", "def get_config_emoji(self, emoji_name: str) -> str:\n return attrgetter(emoji_name)(self.emoji_config)", "def get_emojis(sel...
[ "0.78616476", "0.77742195", "0.6391496", "0.6307427", "0.62452817", "0.61824423", "0.61820036", "0.61667085", "0.61630625", "0.6133574", "0.60895675", "0.5997785", "0.5996648", "0.5990553", "0.59367865", "0.5897511", "0.58497304", "0.58145326", "0.57835275", "0.56658226", "0....
0.90333986
0
Constructor. Any message fields that are implicitly/explicitly set to None will be assigned a default value. The recommend use is keyword arguments as this is more robust to future message changes. You cannot mix inorder arguments and keyword arguments.
def __init__(self, *args, **kwds): if args or kwds: super(ClassifiedObjects, self).__init__(*args, **kwds) #message fields cannot be None, assign default values for those that are if self.objects is None: self.objects = [] else: self.objects = []
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args, **kwds):\n if args or kwds:\n super(KomodoSpeechRecCommand, self).__init__(*args, **kwds)\n #message fields cannot be None, assign default values for those that are\n if self.header is None:\n self.header = std_msgs.msg.Header()\n if self.cmd is None:\n ...
[ "0.7793662", "0.77196157", "0.77196157", "0.7686238", "0.76254946", "0.75628465", "0.74394315", "0.7416354", "0.7351268", "0.73070264", "0.7279533", "0.72366595", "0.7227191", "0.72235173", "0.72235173", "0.7218113", "0.72106457", "0.72106457", "0.72106457", "0.72106457", "0....
0.0
-1
Return True if the user is authenticated.
def is_authenticated(self): return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_authenticated(self):\n return self.user is not None and self.state == AuthenticationOptions.authenticated", "def is_authenticated(self):\n return bool(get_auth_token())", "def is_authenticated(self) -> bool:\n return self._authenticated", "def is_authenticated(self):\r\n re...
[ "0.8739372", "0.87086535", "0.8613915", "0.8609252", "0.8580474", "0.8580474", "0.8580474", "0.8580474", "0.8580474", "0.8580474", "0.8580474", "0.8580474", "0.8580474", "0.8580474", "0.8580474", "0.8580474", "0.8580474", "0.8578436", "0.83723366", "0.83587176", "0.8258534", ...
0.86574197
3
False, as anonymous users aren't supported.
def is_anonymous(self): return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_anonymous():\n return False", "def is_anonymous(self):\r\n return False", "def is_anonymous(self):\n return False", "def is_anonymous_access_allowed(self):\n return self._is_anonymous_access_allowed", "def is_authenticated(self):\n return False", "def _is_anonymous_u...
[ "0.85624325", "0.83800477", "0.82456774", "0.7815806", "0.7576082", "0.72904116", "0.72619915", "0.72347337", "0.72347337", "0.72347337", "0.72347337", "0.72347337", "0.72347337", "0.72347337", "0.72338396", "0.715833", "0.7106215", "0.70944613", "0.70567185", "0.70209265", "...
0.8360155
6
open a file and display a proper message if incorrect file is inputted.
def open_file(): the_file = input ("Enter a file name: ") while True: try: fp = open (the_file, "r") return fp except FileNotFoundError: the_file = input ("Error. Enter a file name: ")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_valid_file(self, file):\n\n try:\n _ = open(f\"{file}\")\n except FileNotFoundError:\n raise ValueError", "def prompt_open(file_name, file_mode):\n\n\tif file_mode.lower() != \"r\" and file_mode.lower() != \"w\":\n\t\tprint(\"That is not a mode the file can be opene...
[ "0.7382491", "0.70617163", "0.70443636", "0.6935527", "0.68922913", "0.68867695", "0.68250906", "0.68225944", "0.67925835", "0.6721196", "0.67040074", "0.6605736", "0.6552743", "0.6544528", "0.64975846", "0.64570063", "0.64364135", "0.6373022", "0.6362295", "0.6349402", "0.63...
0.68974507
4
Sets random (1 keep_prob) nonzero elements of slice_x to zero.
def SparseDropout(slice_x, keep_prob=0.5): # import random # slice_x = 1 # flat_slice_x = numpy.matrix.flatten(slice_x) # idx = list(numpy.nonzero(flat_slice_x)[0]) # rd_idx = random.sample(idx, int((1 - keep_prob)*len(idx))) # flat_slice_x[rd_idx] = 0 # slice_x = flat_slice_x.reshape(slice_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dropout_sparse(x, keep_prob, num_nonzero_elems):\n noise_shape = [num_nonzero_elems]\n random_tensor = keep_prob\n random_tensor += tf.random_uniform(noise_shape)\n dropout_mask = tf.cast(tf.floor(random_tensor), dtype=tf.bool)\n pre_out = tf.sparse_retain(x, dropout_mask)\n return pre_out * ...
[ "0.63452965", "0.62373203", "0.62373203", "0.5863316", "0.5744854", "0.56227636", "0.5612455", "0.5591266", "0.55888885", "0.55743915", "0.5544756", "0.55352646", "0.55349386", "0.5508473", "0.54892147", "0.54475033", "0.54287535", "0.5426796", "0.5418241", "0.54018444", "0.5...
0.73417073
0
From a tensor x, runs the neural network forward to compute outputs. This essentially instantiates the network and all its parameters.
def BuildInferenceNetwork(x, l2_reg_val, is_training): global EMBEDDING_VAR EMBEDDING_VAR = None # ** TASK 4: Move and set appropriately. ## Build layers starting from input. net = x l2_reg = tf.contrib.layers.l2_regularizer(l2_reg_val) ## First Layer # net = FirstLayer(net, l2_reg_val, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_network(self, x):\n # We have the input vector x, this is the first layer in our nn\n a = x\n\n # So we need to run the neural network now. We are going to make\n # things extra explicit by having the z term. Clearly super\n # inefficient\n for w, b in zip(self.w...
[ "0.7747022", "0.77336675", "0.7675856", "0.7596354", "0.7530203", "0.7504729", "0.7474954", "0.7449125", "0.7415465", "0.741023", "0.7303538", "0.7285528", "0.727394", "0.72209597", "0.71734416", "0.7147754", "0.71463287", "0.7108381", "0.70947474", "0.7094198", "0.7082441", ...
0.0
-1
initialize the attribute of the map
def __init__(self, level): self.level = level self.my_map = {} self.my_level = [] self.my_grid = []
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n self.map = {}", "def __init__(self):\n self._map = {}", "def __init__(self):\n self.map = [None] * 103", "def __init__(self):\n self.map = {}\n self.array = []", "def __init__(self):\n self.map = defaultdict(list)", "def __init__(self):\n ...
[ "0.8075173", "0.8061089", "0.78378844", "0.7582555", "0.7534846", "0.7434436", "0.7375907", "0.73702496", "0.73572737", "0.7320073", "0.7286295", "0.7247302", "0.7151283", "0.71485656", "0.71343875", "0.7084251", "0.7016321", "0.6973245", "0.6954308", "0.695053", "0.695053", ...
0.66604584
38
Generate a random symmetric key with given size.
def sym_key_gen(pairing_group=None, sym_key_size=None, debug=0): # If sym_key_size is not defined, set a default value if sym_key_size is None: sym_key_size = SYM_KEY_DEFAULT_SIZE # Clamp the size between SYM_KEY_MIN_SIZE and the system maximum possible value size = clamp(sym_key_size, SYM_KEY...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_key(self, size):\n key = bytearray()\n for i in range(0,size):\n random_byte = ord(os.urandom(1))\n key.append(random_byte)\n return key", "def get_random_secret_key(cls, size=None):\n if not size:\n size = cls.default_secret_key_size\n ...
[ "0.79545754", "0.788748", "0.7747764", "0.7616106", "0.75312024", "0.7529824", "0.74700505", "0.7436757", "0.7419578", "0.74123704", "0.72242755", "0.7217371", "0.7141223", "0.71307844", "0.7052735", "0.6982266", "0.69097155", "0.6898361", "0.6785584", "0.67626256", "0.676177...
0.78664654
2
Generate a random string with given size.
def random_string_gen(pairing_group=None, length=SEED_LENGTH): # Generate a random element of the pairing group rand_pg_elem = random_pairing_group_elem_gen(pairing_group) # Convert the random element in a string with the given length rand_str = objectToBytes(rand_pg_elem, pairing_group)[: length] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stringGen(size, chars=string.ascii_uppercase + string.digits):\n\treturn ''.join(random.choice(chars) for _ in range(size))", "def _random_string(self, size, chars=None):\n return ''.join(random.choice(chars or _DEFAULT_CHARS) for _ in range(size))", "def _rand_str(size=16):\n return \"\".join(random...
[ "0.87644494", "0.864866", "0.84250087", "0.8099983", "0.80610657", "0.784757", "0.76667666", "0.76261526", "0.75850564", "0.7565436", "0.752308", "0.7520658", "0.7514772", "0.75115484", "0.75075257", "0.7506279", "0.7485633", "0.74670976", "0.7459207", "0.74537855", "0.743792...
0.0
-1
Generate a random element from the given pairing group.
def random_pairing_group_elem_gen(pairing_group=None, pg_set=GT): # Return a random element from the given pairing group and set return pairing_group.random(pg_set)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def random_string_gen(pairing_group=None, length=SEED_LENGTH):\n\n # Generate a random element of the pairing group\n rand_pg_elem = random_pairing_group_elem_gen(pairing_group)\n\n # Convert the random element in a string with the given length\n rand_str = objectToBytes(rand_pg_elem, pairing_group)[: ...
[ "0.69339037", "0.6668763", "0.62934494", "0.60605305", "0.5986728", "0.58927256", "0.5842107", "0.58335215", "0.58083904", "0.5756185", "0.5709528", "0.5708916", "0.5704505", "0.56164783", "0.56153893", "0.55131954", "0.5415819", "0.5386208", "0.533812", "0.5324448", "0.53054...
0.85345453
0
Get an existing Runtime resource's state with the given name, id, and optional extra properties used to qualify the lookup.
def get(resource_name: str, id: pulumi.Input[str], opts: Optional[pulumi.ResourceOptions] = None) -> 'Runtime': opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id)) __props__ = RuntimeArgs.__new__(RuntimeArgs) __props__.__dict__["access_config"] = No...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(resource_name: str,\n id: pulumi.Input[str],\n opts: Optional[pulumi.ResourceOptions] = None,\n add_on: Optional[pulumi.Input[pulumi.InputType['InstanceAddOnArgs']]] = None,\n arn: Optional[pulumi.Input[str]] = None,\n availability_zone: Optional[pulum...
[ "0.61469924", "0.6119183", "0.5933335", "0.5819983", "0.5802223", "0.5796686", "0.57714593", "0.57314664", "0.57167375", "0.5688295", "0.56843406", "0.56354964", "0.56179106", "0.5609089", "0.55905837", "0.55734164", "0.55668724", "0.55083007", "0.5502008", "0.5473166", "0.54...
0.6589929
0
Property to provide reference to `PortCollection` instance It is calculated once when it is queried for the first time. On refresh, this property is reset.
def ports(self): return port.PortCollection( self._conn, utils.get_sub_resource_path_by(self, "Ports"), redfish_version=self.redfish_version, )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getPortRef(self):\n return _libsbml.SBaseRef_getPortRef(self)", "def port_list(self):\n return self._port_list", "def collection(self):\n return self._collection", "def get_ports(cls):\n return cls._open_ports.copy()", "def collection(cls):\n if not cls.__collection__...
[ "0.6220771", "0.61412764", "0.60318017", "0.59465426", "0.59415406", "0.5808966", "0.5728327", "0.56310153", "0.5627968", "0.5615953", "0.5521545", "0.5469814", "0.543152", "0.5387131", "0.53818184", "0.5371247", "0.5370043", "0.53431445", "0.5343124", "0.5338001", "0.5325961...
0.63826317
0
Retrieves the language configured by the user, if exists. Otherwise, None is returned.
def get_language(chat_id): db_connection = DatabaseConnection() language = db_connection.get_setting(chat_id=chat_id, setting=LANGUAGE_SETTING) db_connection.close() return language
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_language(self):\n return self.language if self.language is not None else get_language()", "def get_language():\n try:\n from leaves.middleware import request_context\n return request_context.language\n except:\n return get_site().preferences.default_language", "def req...
[ "0.75887626", "0.7586554", "0.7475023", "0.7389983", "0.7363159", "0.7244168", "0.72148573", "0.71807873", "0.71666616", "0.7155831", "0.7140388", "0.7112066", "0.7084873", "0.7073846", "0.70355695", "0.70284", "0.7016381", "0.70155895", "0.6993815", "0.69412315", "0.6907178"...
0.7001583
18
Uniformly quantize signed fraction aNum with nBits
def QuantizeUniform(aNum, nBits): #Notes: #The overload level of the quantizer should be 1.0 ### YOUR CODE STARTS HERE ### if nBits <= 0: return 0 sign = np.sign(aNum) if sign >= 0: s = 0 else: s = 1 if abs(aNum) >= 1: code = 2**(nBits - 1) - 1 else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def DequantizeUniform(aQuantizedNum, nBits):\n\n ### YOUR CODE STARTS HERE ###\n if nBits <=0:\n return 0\n s = aQuantizedNum & (1 << (nBits - 1))\n code = aQuantizedNum & (2**(nBits - 1) - 1)\n if s == 0:\n sign = 1\n else:\n sign = -1\n aNum = sign * 2 * code / (2**nBits...
[ "0.7401248", "0.7163131", "0.6802652", "0.6404014", "0.5919182", "0.5714187", "0.5708791", "0.5670395", "0.5670395", "0.5670395", "0.55189186", "0.5518517", "0.5457139", "0.53899515", "0.5374549", "0.5366362", "0.5328331", "0.52972776", "0.52843785", "0.5225345", "0.52218074"...
0.8345808
0
Uniformly quantize vector aNumberVec of signed fractions with nBits
def vQuantizeUniform(aNumVec, nBits): #Notes: #Make sure to vectorize properly your function as specified in the homework instructions ### YOUR CODE STARTS HERE ### aNumVec = np.array(aNumVec) s = np.zeros_like(aNumVec) s[aNumVec < 0] = 1 << (nBits - 1) aQuantizedNumVec = (((2**nBits - 1) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def QuantizeUniform(aNum, nBits):\n #Notes:\n #The overload level of the quantizer should be 1.0\n\n ### YOUR CODE STARTS HERE ###\n if nBits <= 0:\n return 0\n sign = np.sign(aNum)\n if sign >= 0:\n s = 0\n else:\n s = 1\n if abs(aNum) >= 1:\n code = 2**(nBits -...
[ "0.75380635", "0.7447481", "0.64969194", "0.61334693", "0.6113759", "0.6013399", "0.6013399", "0.6013399", "0.56369984", "0.5565536", "0.55539924", "0.55484617", "0.55102545", "0.5499145", "0.53789806", "0.5354152", "0.52551186", "0.5179625", "0.51599663", "0.5154718", "0.513...
0.81190175
0
Uniformly dequantizes vector of nBitslong numbers aQuantizedNumVec into vector of signed fractions
def vDequantizeUniform(aQuantizedNumVec, nBits): ### YOUR CODE STARTS HERE ### s = np.bitwise_and(aQuantizedNumVec, (1 << (nBits - 1))) code = np.bitwise_and(aQuantizedNumVec, (2**(nBits - 1) - 1)) sign = np.ones_like(aQuantizedNumVec) sign[s != 0] = -1 aNumVec = sign * 2 * (code) / (2**nBits -...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vQuantizeUniform(aNumVec, nBits):\n\n #Notes:\n #Make sure to vectorize properly your function as specified in the homework instructions\n\n ### YOUR CODE STARTS HERE ###\n aNumVec = np.array(aNumVec)\n s = np.zeros_like(aNumVec)\n s[aNumVec < 0] = 1 << (nBits - 1)\n aQuantizedNumVec = (((...
[ "0.75793844", "0.6592048", "0.6582723", "0.6582267", "0.5916759", "0.5916759", "0.5916759", "0.5903204", "0.58303916", "0.5735278", "0.5533699", "0.5486912", "0.5435441", "0.53270835", "0.53244984", "0.5314287", "0.52911234", "0.5271867", "0.5223066", "0.52208275", "0.5198853...
0.78378516
0
Return a vector of block floatingpoint mantissas for a vector of signed fractions aNum given nScaleBits scale bits and nMantBits mantissa bits
def vMantissa(aNumVec, scale, nScaleBits=3, nMantBits=5): mantissaVec = np.zeros_like( aNumVec, dtype=int) # REMOVE THIS LINE WHEN YOUR FUNCTION IS DONE ### YOUR CODE STARTS HERE ### R = 2**nScaleBits - 1 + nMantBits s_code = vQuantizeUniform(aNumVec, R) s = np.bitwise_and(s_code, (1 << (...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def MantissaFP(aNum, scale, nScaleBits=3, nMantBits=5):\n\n ### YOUR CODE STARTS HERE ###\n R = 2**nScaleBits - 1 + nMantBits\n s_code = QuantizeUniform(aNum, R)\n s = s_code & (1 << (R - 1))\n if s > 0:\n s = 1 << (nMantBits - 1)\n code = s_code & (2**(R - 1) - 1)\n if scale == (2**nSc...
[ "0.65804106", "0.6379092", "0.618169", "0.5864033", "0.5829088", "0.5695252", "0.5488365", "0.54235023", "0.5298082", "0.5257493", "0.5190911", "0.51132226", "0.5090658", "0.506084", "0.5045761", "0.4959086", "0.49319673", "0.48925415", "0.48851487", "0.48830506", "0.48645854...
0.7475438
0
Returns a resource as an opened readonly file.
def GetParanoidResourceAsFile(path: str, mode: str = 'r') -> IO[Union[bytes, str]]: path = os.path.join(_ROOT_DIR, path) if os.path.isdir(path): raise IOError('Resource "{}" is not a file'.format(path)) if not os.path.isfile(path): raise IOError( 'Resource "{}" not fo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def open_resource(self, resource):\n # type: (Text) -> BinaryIO\n # This deliberately raises FileNotFoundError instead of\n # NotImplementedError so that if this method is accidentally called,\n # it'll still do the right thing.\n raise FileNotFoundError", "def open(self, mode=...
[ "0.7322835", "0.69880754", "0.6986098", "0.6976041", "0.6816771", "0.671124", "0.6550181", "0.6499995", "0.638515", "0.6382157", "0.6364226", "0.6333034", "0.63047963", "0.626805", "0.6247022", "0.61815065", "0.61724323", "0.616165", "0.61374074", "0.61374074", "0.60757095", ...
0.74961764
0
Determine the appropriate image pull policy. 1. If they specified an image pull policy, use that. 2. If they did not specify an image pull policy and gave us the "latest" tag, use ImagePullPolicy.always. 3. If they did not specify an image pull policy and did not specify a tag, use ImagePullPolicy.always. 4. If they di...
def _determine_image_pull_policy(self) -> ImagePullPolicy: if not self.image_pull_policy: _, tag = self._get_image_and_tag() if tag == "latest" or not tag: return ImagePullPolicy.ALWAYS return ImagePullPolicy.IF_NOT_PRESENT return self.image_pull_polic...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def image_pull_policy(self) -> Optional[str]:\n return pulumi.get(self, \"image_pull_policy\")", "def image_pull_policy(self) -> Optional[str]:\n return pulumi.get(self, \"image_pull_policy\")", "def image_pull_policy(self) -> Optional[str]:\n return pulumi.get(self, \"image_pull_policy\")...
[ "0.7680345", "0.7680345", "0.7680345", "0.7680345", "0.7680345", "0.7680345", "0.7680345", "0.7680345", "0.7680345", "0.7680345", "0.7680345", "0.7680345", "0.7680345", "0.7680345", "0.7680345", "0.7680345", "0.7680345", "0.7680345", "0.7680345", "0.7680345", "0.7680345", "...
0.91271913
0
Decide whether we need to pull the Docker image.
def _should_pull_image(self, docker_client: "DockerClient") -> bool: image_pull_policy = self._determine_image_pull_policy() if image_pull_policy is ImagePullPolicy.ALWAYS: return True elif image_pull_policy is ImagePullPolicy.NEVER: return False elif image_pull_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def image_needs_building(image):\n d = docker_client()\n\n # first, check for locally built image\n try:\n d.images.get(image)\n except docker.errors.ImageNotFound:\n # image not found, check registry\n pass\n else:\n # it exists locally, no need to check remote\n ...
[ "0.72855663", "0.7073853", "0.7034321", "0.68046755", "0.6724731", "0.6669374", "0.6616838", "0.6528014", "0.6513476", "0.65002537", "0.6464864", "0.6406037", "0.628647", "0.6284329", "0.6167629", "0.61272234", "0.610379", "0.60721314", "0.60565597", "0.60461646", "0.6024801"...
0.7767488
0
Check if the pack display name already exists in our repo
def _is_pack_display_name_already_exist(self, pack_metadata_data): new_pack_folder_name = list(pack_metadata_data.keys())[0] new_pack_name = pack_metadata_data[new_pack_folder_name]['name'] for pack_folder_name, pack_data in self.packs_set.items(): if new_pack_name == pack_data['name...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_display_name(self):\r\n def verify_name(source_usage_key, parent_usage_key, expected_name, display_name=None):\r\n usage_key = self._duplicate_item(parent_usage_key, source_usage_key, display_name)\r\n duplicated_item = self.get_item_from_modulestore(usage_key, draft=True)\r\n...
[ "0.6091241", "0.59843665", "0.59629154", "0.5913777", "0.58595043", "0.57335746", "0.5722619", "0.5704986", "0.57015085", "0.5690082", "0.5654398", "0.564949", "0.5649438", "0.5646435", "0.5627498", "0.5616643", "0.56079346", "0.5600368", "0.5577692", "0.5565692", "0.5520019"...
0.80072975
0
Check whether there exist a base such that n in base `base` == 111...111 (length's 1s)
def findLengthBase(length, n): start, end = 0, n/2 while start <= end: mid = (start + end) / 2 target = getAnsofBase(length, mid) if target == n: return mid elif target < n: start = mid + 1 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checkBase(base, n):\n current = 1\n while current < n:\n current = current * base + 1\n return current == n", "def check_base(base, coin):\n value = coin_value_in_base(base, coin)\n if value % 2 == 0:\n return 2\n if value % 3 == 0:\n ret...
[ "0.85788065", "0.70242506", "0.6668405", "0.6562793", "0.64900804", "0.63446283", "0.6284576", "0.62742144", "0.6196663", "0.6180231", "0.6116432", "0.60802114", "0.6074326", "0.6066515", "0.606186", "0.6025786", "0.59839606", "0.5983852", "0.5957524", "0.5931271", "0.5926058...
0.61627847
10
Returns the tensor added with additional momentum for wd m_t = \mu m_{t1} + wd x_t x_{t+1} = x_t \eta_t (tensor + \mu m_t + wd x_t)
def decompress(self, tensor, ctx, *args, **kwargs): if "x" not in kwargs: raise ValueError("x is missing") x = kwargs["x"].astype(tensor.dtype, copy=False) if not self.inited: self.cache = nd.zeros_like(tensor) if size(tensor.shape) >= self.thresh...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_momentum_with_augmentation(self):\n tf.reset_default_graph()\n\n v = tf.Variable([1., 2., 3.])\n obj = tf.reduce_sum(tf.pow(v, 2))\n v1, obj1 = vectorize_model([v], obj, augment=1)\n\n iterations = 5\n lr = .5\n mu = tf.Variable(.5, name='mu')\n\n\n ...
[ "0.613672", "0.6003356", "0.5933865", "0.58793056", "0.5841538", "0.58211637", "0.5808446", "0.5749313", "0.57060695", "0.5698245", "0.5692665", "0.56129307", "0.5583626", "0.55690455", "0.5566305", "0.55588174", "0.5555108", "0.5551135", "0.5496667", "0.5489064", "0.54667974...
0.0
-1
Load an image from file into a numpy array. Puts image into numpy array to feed into tensorflow graph. Note that by convention we put it into a numpy array with shape (height, width, channels), where channels=3 for RGB.
def load_image_into_numpy_array(path): return np.array(Image.open(path))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_image_into_numpy_array(path):\n img_data = tf.io.gfile.GFile(path, 'rb').read()\n image = Image.open(BytesIO(img_data))\n (im_width, im_height) = image.size\n return np.array(image.getdata()).reshape(\n (im_height, im_width, 3)).astype(np.uint8)", "def load_image_into_numpy_array(path...
[ "0.78659564", "0.771784", "0.7717185", "0.7704105", "0.77009773", "0.7624171", "0.7611585", "0.75013953", "0.74523175", "0.7431118", "0.74028707", "0.734838", "0.7312722", "0.7295734", "0.72744113", "0.72401977", "0.7219901", "0.7203454", "0.7185667", "0.71833575", "0.7165899...
0.7774965
1
Return Aspera Transfer Service node information for given bucket
def node(*,bucket, endpoint, key, crn, auth=IBM_CLOUD_OAUTH_URL): # Get bearer token to access COS S3 API # payload to generate auth token token_req_data = { 'grant_type' :'urn:ibm:params:oauth:grant-type:apikey', 'response_type':'cloud_iam', 'apikey' :key } response = requ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_bucket(self, bucket):\n msg = \"get_bucket not implemented\"\n raise NotImplementedError(msg)", "def get_amazon_adj_cls_from_s3(s3_resource, bucket_name, prefix='') -> dict:\n amzn_filename = \"AMZN.json\"\n complete_path = os.path.join(prefix, amzn_filename)\n json_object = s3_res...
[ "0.5623176", "0.53254324", "0.5290579", "0.5289345", "0.5274373", "0.5260527", "0.5251037", "0.52126426", "0.5211076", "0.5192825", "0.51645", "0.515651", "0.51565063", "0.5140081", "0.5140081", "0.5131845", "0.5122541", "0.512182", "0.5119491", "0.5109655", "0.51077616", "...
0.66997683
0
Attach a coroutine to a monitoring thread for stuffing queue `q` with data read from `target`. The tuple `target` is composed of two values, `id` and `pipe`. Yields a list of (thread, coro) tuples given the arguments provided. Each thread will read from `pipe`, and stuff the value combined with `id` into `q`.
def monitorPipe(q, target, *more, **options): def stuff(q, *key): while True: item = (yield), q.put(key + item) return for id, pipe in itertools.chain([target], more): res, name = stuff(q, id), "{:s}<{!r}>".format(options.get('name', '...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def monitorGenerator(q, target, *more, **options):\n def stuff(q, *key):\n while True:\n item = (yield),\n q.put(key + item)\n return\n\n for id, reader in itertools.chain([target], more):\n res, name = stuff(q, id), \"{:s}<{!r}>\".forma...
[ "0.65488005", "0.54855794", "0.5198099", "0.49150455", "0.4912112", "0.47664896", "0.4715111", "0.4708374", "0.4698035", "0.4689704", "0.46680576", "0.464266", "0.46359387", "0.46285915", "0.45735642", "0.4566663", "0.45528147", "0.44816008", "0.44668475", "0.44575405", "0.44...
0.69313043
0
Attach a coroutine to a monitoring thread for stuffing queue `q` with data read from `target`. The tuple `target` is composed of two values, `id` and `generator`. Yields a list of (thread, coro) tuples given the arguments provided. Each thread will consume `generator`, and stuff the result paired with `id` into `q`.
def monitorGenerator(q, target, *more, **options): def stuff(q, *key): while True: item = (yield), q.put(key + item) return for id, reader in itertools.chain([target], more): res, name = stuff(q, id), "{:s}<{!r}>".format(options.get('...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def monitorPipe(q, target, *more, **options):\n def stuff(q, *key):\n while True:\n item = (yield),\n q.put(key + item)\n return\n\n for id, pipe in itertools.chain([target], more):\n res, name = stuff(q, id), \"{:s}<{!r}>\".format(option...
[ "0.5881391", "0.54499245", "0.5363189", "0.5211062", "0.51840115", "0.5179112", "0.5071801", "0.5027035", "0.4930978", "0.48643714", "0.48388058", "0.47967118", "0.4781813", "0.47808462", "0.4771118", "0.47345364", "0.46976393", "0.46976393", "0.46761405", "0.46368486", "0.46...
0.6865526
0
get HTTP protocol for this runner(http/https)
def get_protocol(self): if self.ssl: return "https" else: return "http"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_protocol():\n if https():\n protocol = 'https'\n else:\n protocol = 'http'\n return protocol", "def get_http_protocol(self):\n if self.cfg.ssl:\n return \"https\"\n else:\n return \"http\"", "def protocol(self):\n return 'https' if self....
[ "0.8355054", "0.8135704", "0.76927936", "0.76775056", "0.7626505", "0.7321442", "0.73162", "0.7147021", "0.7130778", "0.711457", "0.7011963", "0.70066833", "0.6964446", "0.68816876", "0.68764377", "0.68527645", "0.6851765", "0.6843912", "0.68263346", "0.68263346", "0.68263346...
0.8068154
2
Returns an array of world coordinates corresponding to pixels in an image. Adapted for the 2D case from spectral_cube.SpectralCube.world()
def worldgrid(hdu, wcs=None, origin=0, returnorder='radec', returnunit=None): try: wcs = WCS(hdu) except AttributeError: #It's ok, if hdu is a data ndarray. pass inds = np.ogrid[[slice(0,s) for s in hdu.shape]] inds = np.broadcast_arrays(*inds) inds = inds[::-1] # numpy -> w...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_world_coords(self):\n # get pixel cordinates\n (H, W, _) = self.shape\n i, j = numpy.indices((H, W), dtype=numpy.float32)\n\n # Rescale to UV coordinates. u is to the right, v is up.\n u = rescale(0, W - 1, -1, 1, j)\n v = rescale(0, H - 1, 1, -1, i)\n\n # B...
[ "0.72380054", "0.68137664", "0.6728338", "0.6672521", "0.6620517", "0.6538133", "0.6507414", "0.6450702", "0.6379971", "0.6364275", "0.6350794", "0.6327752", "0.62466383", "0.6237556", "0.6159524", "0.6152793", "0.6128024", "0.6106772", "0.60939497", "0.6073277", "0.6059502",...
0.0
-1
Extract item price per unit from the price string.
def _extract_price_and_unit(self, price_str: str) -> tuple: # fetch the digits from the price string price = float(extract_required_data(data_str=price_str, req_type=r'[+-]?([0-9]+([.][0-9]*)?|[.][0-9]+)')[0]) # fetch the unit unit = price_str[price_str.index('/') + 1:] # if a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_price(item):\n return float(item[1])", "def extract_price(lastPrice):\n \n price = 0\n priceDetails = lastPrice.replace('$','').replace(',','').replace('+','').replace('s','').split()\n for item in priceDetails:\n if item.isdigit():\n price = int(int(item)/100000)*100000\...
[ "0.64475125", "0.6215617", "0.6100732", "0.6005726", "0.57466054", "0.56392485", "0.56257594", "0.55564195", "0.55209595", "0.5501572", "0.54974926", "0.5484069", "0.5480785", "0.54760844", "0.54721606", "0.5463977", "0.5409911", "0.54031014", "0.5391348", "0.53784597", "0.53...
0.7152894
0
E.g. 'this1234' The below regex does this but it doesn't work 100% of the time and it is slower. Hence this Python function. to get rid of tokens with numbers and letters in it myRegEx3 = re.compile(r'((\d+[az]+\d+)|([az]+\d+[az]+)|([az]+\d+)|(\d+[az]+))') text = myRegEx3.sub(REPLACEMENT_STRING, text)
def remove_tokens_with_letters_and_numbers(text_list): for i in range(len(text_list)): t = text_list[i] if any(c.isdigit() for c in t) and any(c.isalpha() for c in t): text_list[i] = REPLACEMENT_STRING return text_list
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_numbers(text):\n return regex.sub(\"\\d+\", ' NUM', text)", "def remove_numbers(text):\n return re.sub(r'\\d+', '',text)", "def cleanup(text):\n\n\tRE_D = re.compile('\\d')\n\n\ttokens = text.split()\n\tnew_tokens = list()\n\tfor t in tokens:\n\t\tif RE_D.search(t):\n\t\t\tcontinue\n\t\tfor p i...
[ "0.6672429", "0.6412588", "0.6375995", "0.63362825", "0.6274023", "0.6241622", "0.6184696", "0.6170781", "0.61674196", "0.61640763", "0.61163414", "0.6088173", "0.6087956", "0.6087557", "0.6027075", "0.60064405", "0.5964309", "0.59475195", "0.59036934", "0.5860516", "0.586051...
0.6695888
0
Function to add a cyclic point to an array and a corresponding coordinate.
def xr_add_cyclic(da, coord): from cartopy.util import add_cyclic_point cyclic_data, cyclic_coord = add_cyclic_point(da.values, coord=da[coord]) coords = da.coords.to_dataset() coords[coord] = cyclic_coord return xr.DataArray( cyclic_data, dims=da.dims, coords=coords.coords...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_cyclic_point(data, coord=None, axis=-1):\n \n if coord is not None:\n if coord.ndim != 1:\n raise ValueError('The coordinate must be 1-dimensional.')\n if len(coord) != data.shape[axis]:\n raise ValueError('The length of the coordinate does not match '\n ...
[ "0.6949585", "0.5871634", "0.56250876", "0.56245863", "0.53680825", "0.52665937", "0.5259814", "0.51648694", "0.51493454", "0.5129978", "0.51185113", "0.51174545", "0.51043606", "0.5085872", "0.5072608", "0.5052472", "0.5040922", "0.50313723", "0.5029428", "0.50198156", "0.50...
0.71211916
0
Utility function to clean tweet text by removing links, special characters using simple regex statements.
def clean_tweet(tweet): return ' '.join(re.sub("(@[A-Za-z0-9]+)|([^0-9A-Za-z \t])|(\w+://\S+)", " ", tweet).split())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_tweet(tweet):\n\n pattern = r'http\\S+|pic.\\S+|@[a-zA-Z0-9_]+|#[a-zA-Z0-9_]+|[‘’“”’–—…]|\\xa0'\n return re.sub(pattern, '', tweet)", "def tweet_cleaner(text, unescape=True, remove_html_tags=True, accented_chars=True,\r\n contractions=True, special_chars=True, expand_hash=True, r...
[ "0.8035162", "0.8011612", "0.7933544", "0.79298425", "0.7880287", "0.7745769", "0.7718409", "0.7683514", "0.7630937", "0.7559695", "0.7559695", "0.7540147", "0.75358033", "0.75032693", "0.7438139", "0.7409144", "0.73814404", "0.73638856", "0.7320942", "0.731223", "0.72741675"...
0.73817146
16
Test import from YAML.
async def test_import_from_yaml(opp) -> None: with _patch_version(), _patch_status(), _patch_history(), _patch_async_setup_entry(): assert await async_setup_component(opp, DOMAIN, {DOMAIN: YAML_CONFIG}) await opp.async_block_till_done() entries = opp.config_entries.async_entries(DOMAIN) ass...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_from_yaml_file(self, use_c_lib_yaml: bool) -> None:\n try:\n config.parsers.yaml.use_c_lib_yaml = use_c_lib_yaml\n reference = self.EXAMPLE_ENTRY_DICT.copy()\n entries = YAMLParser().parse(self.EXAMPLE_YAML_FILE)\n entry = list(entries.values())[0]\n ...
[ "0.70118076", "0.66641", "0.6659601", "0.6658547", "0.6612789", "0.6610641", "0.660824", "0.65661377", "0.65568405", "0.6520295", "0.65021116", "0.6439392", "0.6394045", "0.6388575", "0.6357634", "0.63221705", "0.63156605", "0.6310238", "0.6288595", "0.62792903", "0.62476426"...
0.7455825
0
Get a gene's Sequence Location.
def add_location(self, seqid, gene, params, sr): location = dict() aliases = self.get_aliases(sr, seqid) sequence_id = [a for a in aliases if a.startswith('ga4gh')][0] if gene.start != '.' and gene.end != '.' and sequence_id: if 0 <= gene.start <= gene.end: s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def genomic_location(self):\n\n return self._genomic_location", "def get_seq(self):\n \n dna_seq = self.gene.polymer.get_subseq(\n start=self.gene.start, end=self.gene.end, strand=self.gene.strand)\n \n return dna_seq.transcribe()", "def get_location(self):\n\t\tre...
[ "0.7217966", "0.647355", "0.62306577", "0.6112255", "0.6076938", "0.6061421", "0.6039757", "0.60208005", "0.598255", "0.59814274", "0.5976361", "0.5931187", "0.5922956", "0.58719134", "0.58719134", "0.5857815", "0.5855759", "0.584477", "0.5806592", "0.57912606", "0.57912606",...
0.6103598
4
Constructor for Node Class
def __init__(self, data, next_node=None): self.data = data self.next_node = next_node
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, nodes=None):\r\n self.nodes = nodes", "def __init__(self):\n self.root = Node('')", "def __init__(self):\n self.root = self.Node(None)", "def __init__(self):\n self.root = Node(\"\")", "def __init__(self):\n self.root = Node(\"\")", "def __init__(self...
[ "0.8323962", "0.8198392", "0.81425285", "0.81388295", "0.81388295", "0.8120421", "0.8108986", "0.810856", "0.80740577", "0.80740577", "0.80740577", "0.803897", "0.80147475", "0.7966673", "0.79309756", "0.79057264", "0.7847091", "0.7831318", "0.7769417", "0.7768376", "0.770202...
0.0
-1
For day orders we need to know when the next trading day happens if the order is placed after hours. Note that if offhours on a trading day, this will return the current trading day schedule anyhow.
def get_next_trading_day_schedule(reference_day: dt): reference_day = reference_day.date() schedule = get_trading_calendar(reference_day, reference_day) while schedule.empty: reference_day += timedelta(days=1) schedule = get_trading_calendar(reference_day, reference_day) return schedule
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_next_day(self):\n pass", "def _deadline_same_day(self) -> pd.Timestamp:\n # Get the workshift on the deadline\n workshift = self._get_departure_shift()\n\n # Departure was on duty, see if there is enough time to meet deadline\n if (\n self._departure_on_duty(...
[ "0.6125209", "0.59765595", "0.5878528", "0.5801993", "0.57783014", "0.5750449", "0.56939876", "0.5498133", "0.54838073", "0.54372036", "0.5408098", "0.5399187", "0.53890896", "0.5376385", "0.53362894", "0.53362894", "0.5319347", "0.5316079", "0.53141373", "0.53093064", "0.529...
0.6540972
0
the timestamp should be datetime formatted
def append_price_data_to_balance_histories(df: pd.DataFrame) -> pd.DataFrame: # Resample balances over the desired time interval within each symbol min_time = datetime_to_posix(df["timestamp"].min()) max_time = datetime_to_posix(df["timestamp"].max()) # Now add price data symbols = df["symbol"].uniq...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _format_ts(cls, timestamp):\n return localtime(timestamp).strftime('%Y-%m-%d %H:%M:%S')", "def get_timestamp():\n return time.strftime('%Y-%m-%d %H:%M:%S')", "def format_datetime(timestamp):\n return f\"<!date^{int(timestamp)}^{{date_pretty}} at {{time}}| >\"", "def timestamp():\n ...
[ "0.7509756", "0.713666", "0.7113582", "0.70886105", "0.70729905", "0.70729905", "0.70729905", "0.70367235", "0.6992828", "0.6971369", "0.69609815", "0.6856161", "0.6827783", "0.68263173", "0.68179387", "0.6812128", "0.67826307", "0.6766939", "0.6766335", "0.67624027", "0.6750...
0.0
-1
We call the inputs "logits" they could either be unnormalized logits or normalized log probabilities. A logsoftmax operation is a constant shifting of the entire logit vector, so taking an argmax over either one gives the same result.
def get_best_span(span_start_logits: torch.Tensor, span_end_logits: torch.Tensor) -> torch.Tensor: if span_start_logits.dim() != 2 or span_end_logits.dim() != 2: raise ValueError("Input shapes must be (batch_size, passage_length)") batch_size, passage_length = span_start_logits.size()...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_softmax_nd(logits, axes=(-1,)):\n logits -= tf.reduce_max(logits, axis=axes, keepdims=True)\n return logits - tf.reduce_logsumexp(logits, axis=axes, keepdims=True)", "def softmax_ndarray(logits: jnp.DeviceArray) -> jnp.DeviceArray:\n assert len(logits.shape) == 2\n # Normalise for better stabilit...
[ "0.81361735", "0.77413785", "0.75261986", "0.7461867", "0.7258162", "0.72551626", "0.72385305", "0.72290224", "0.7225503", "0.7154177", "0.7129063", "0.7050817", "0.7036618", "0.7020163", "0.7014661", "0.7002737", "0.698886", "0.69497144", "0.6945793", "0.69446397", "0.691262...
0.0
-1
Gets the derived full path to the corresponding GEONIS media directory.
def get_media_dir(self): dir_path = _paths.concat(self._gnbase, _DIRNAME_GNMEDIA) if not _os.path.isdir(dir_path): raise OSError('GEONIS media directory {!r} does not exist'.format(dir_path)) return dir_path
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_media_directory():\n\treturn _paths[_MEDIA_DIRECTORY_KEY]", "def media_path(self):\n return self._path", "def upload_dir(self):\n return os.path.join(settings.MEDIA_ROOT,self.upload_dir_rel())", "def full_path(self):\n return os.path.join(settings.MEDIA_ROOT, self.path)", "def ...
[ "0.8044539", "0.7514279", "0.7484346", "0.71663207", "0.71625715", "0.7048592", "0.7022829", "0.69864434", "0.684286", "0.6803938", "0.6779157", "0.67627776", "0.67337865", "0.673368", "0.6733095", "0.6727921", "0.66552734", "0.66134197", "0.6598069", "0.6594394", "0.6584736"...
0.8425708
0
Gets the derived full path to the corresponding GEONIS project directory.
def get_project_dir(self): dir_path = _paths.concat(self._gnbase, _DIRNAME_PROJECT) if not _os.path.isdir(dir_path): raise OSError('GEONIS project directory {!r} does not exist'.format(dir_path)) return dir_path
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_project_dir(self):\n return os.path.expanduser(\n self.sqlfluff_config.get_section(\n (self.templater_selector, self.name, \"project_dir\")\n )\n or os.getcwd()\n )", "def get_project_path():\n file_path = os.path.abspath(__file__)\n ro...
[ "0.7700384", "0.76850027", "0.74923736", "0.7484761", "0.7484761", "0.7479941", "0.7401504", "0.7390808", "0.7390808", "0.7390808", "0.7390808", "0.7390085", "0.73787683", "0.7369601", "0.7364579", "0.735369", "0.7345871", "0.7342462", "0.7339368", "0.73167926", "0.7300992", ...
0.789615
0
ID of the instance.
def instance_id(self) -> pulumi.Input[str]: return pulumi.get(self, "instance_id")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def instance_id(self) -> str:\n return pulumi.get(self, \"instance_id\")", "def get_instance_id(self):\n return self.instance_id", "def instance_identifier(self):\n return self._instance_identifier", "def instance_id(self) -> pulumi.Input[int]:\n return pulumi.get(self, \"instance...
[ "0.8925194", "0.87622464", "0.85667896", "0.8537502", "0.8537502", "0.8537502", "0.85131055", "0.85131055", "0.85131055", "0.8502583", "0.84513944", "0.84513944", "0.84513944", "0.84513944", "0.84513944", "0.84513944", "0.81948787", "0.81948787", "0.81948787", "0.8157864", "0...
0.82717943
20
ID of the instance.
def instance_id(self) -> Optional[pulumi.Input[str]]: return pulumi.get(self, "instance_id")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def instance_id(self) -> str:\n return pulumi.get(self, \"instance_id\")", "def get_instance_id(self):\n return self.instance_id", "def instance_identifier(self):\n return self._instance_identifier", "def instance_id(self) -> pulumi.Input[int]:\n return pulumi.get(self, \"instance...
[ "0.8925194", "0.87622464", "0.85667896", "0.8537502", "0.8537502", "0.8537502", "0.85131055", "0.85131055", "0.85131055", "0.8502583", "0.84513944", "0.84513944", "0.84513944", "0.84513944", "0.84513944", "0.84513944", "0.82717943", "0.82717943", "0.82717943", "0.82717943", "...
0.8020279
34
ID of the instance.
def instance_id(self) -> pulumi.Output[str]: return pulumi.get(self, "instance_id")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def instance_id(self) -> str:\n return pulumi.get(self, \"instance_id\")", "def get_instance_id(self):\n return self.instance_id", "def instance_identifier(self):\n return self._instance_identifier", "def instance_id(self) -> pulumi.Input[int]:\n return pulumi.get(self, \"instance...
[ "0.8925194", "0.87622464", "0.85667896", "0.8537502", "0.8537502", "0.8537502", "0.85131055", "0.85131055", "0.85131055", "0.8502583", "0.82717943", "0.82717943", "0.82717943", "0.82717943", "0.82717943", "0.82717943", "0.81948787", "0.81948787", "0.81948787", "0.8157864", "0...
0.84513944
14
Accepts the given booking, setting all other bookings which conflict with it to 'blocked'. Can only be done if the period has been confirmed already, the occasion is not yet full and the given booking doesn't conflict with another accepted booking.
def accept_booking(self, booking): if not booking.period.confirmed: raise RuntimeError("The period has not yet been confirmed") if booking.occasion.full: raise RuntimeError("The occasion is already full") if booking.state not in ('open', 'denied'): raise Ru...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cancel_booking(self, booking,\n score_function=booking_order, cascade=False):\n\n if not booking.period.confirmed:\n raise RuntimeError(\"The period has not yet been confirmed\")\n\n # if the booking wasn't accepted or if we don't cascade, this is quick\n i...
[ "0.7013325", "0.6884903", "0.62716293", "0.6144269", "0.60374665", "0.5994366", "0.59835166", "0.58297235", "0.5720832", "0.5471302", "0.53829145", "0.53646696", "0.5327799", "0.53027505", "0.529604", "0.5245571", "0.5218103", "0.5210356", "0.51780117", "0.51361835", "0.51282...
0.8480601
0
Loads a JSON file into memory
def get_throughput_json(filename): with open(filename) as json_data: d = json.load(json_data) json_data.close() return d
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load(self):\n if not self.exist:\n self.create()\n\n with open(self.file_path, encoding=Config.ENCODING) as file:\n self.data = json.load(file)", "def load_json_data(filepath):\n with open(filepath,'r') as f:\n return json.load(f)", "def load_json(file_name):\n...
[ "0.7974128", "0.79315126", "0.7864893", "0.7860884", "0.78564554", "0.7800175", "0.7770005", "0.776393", "0.77530205", "0.7739106", "0.7739084", "0.7713328", "0.7684932", "0.76811403", "0.76543534", "0.76543534", "0.7650413", "0.76480424", "0.7635118", "0.7606405", "0.7606228...
0.0
-1
Returns whether `module` is present. If `load` is true, it will try to load it via modprobe.
def module_present(module, load=True): with open('/proc/modules', 'r') as modules_file: if module.replace('-','_') in modules_file.read(): return True cmd = '/sbin/modprobe {}{}'.format('' if load else '-n ', module) if os.system(cmd) != 0: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_loaded_module(self, module_name):\n\n for (module, ea, name, ord) in self.rt_import_table.values():\n if module == module_name:\n return True\n return False", "def module_present(self, module_name):\n # Check input.\n if not isinstance(module_name,...
[ "0.7274769", "0.70609707", "0.69695807", "0.6880551", "0.6790271", "0.67132676", "0.67110115", "0.6694735", "0.6636025", "0.6562486", "0.640688", "0.6406384", "0.64021516", "0.636701", "0.634541", "0.61813766", "0.6163316", "0.615707", "0.6119738", "0.60877174", "0.60771763",...
0.8248716
0
Return an ISO 8601 formatted date string, required for certain DAV properties.
def iso8601_date(ts=None): ts = _get_gmtime_compatible_timestamp(ts) return _time.strftime('%Y-%m-%dT%H:%M:%SZ', _time.gmtime(ts))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def serialize_iso(attr):\n if not attr:\n return None\n if isinstance(attr, str):\n attr = isodate.parse_datetime(attr)\n try:\n utc = attr.utctimetuple()\n if utc.tm_year > 9999 or utc.tm_year < 1:\n raise OverflowError(\"Hit max or min date\")\n\n date = \"{...
[ "0.69235355", "0.6867402", "0.6818976", "0.67274433", "0.6675843", "0.666839", "0.66432905", "0.66225064", "0.66004705", "0.6576711", "0.652074", "0.6461477", "0.6441474", "0.64020145", "0.63871855", "0.63561344", "0.6347938", "0.6318171", "0.6283317", "0.626199", "0.62367797...
0.616927
24
Return an RFC 850 formatted date string.
def rfc850_date(ts=None): ts = _get_gmtime_compatible_timestamp(ts) year, month, day, hh, mm, ss, wd, _y, _z = _time.gmtime(ts) return "%s, %02d-%3s-%2s %02d:%02d:%02d GMT" % ( weekday_full[wd], day, monthname[month], str(year)[2:], hh, mm, ss )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rfc3999(date):\n if not date: return ''\n date = date + datetime.timedelta(seconds = -time.timezone)\n if time.daylight:\n date += datetime.timedelta(seconds = time.altzone)\n return date.strftime('%m-%d-%YT%H:%M:%SZ')", "def format_date(self, data):\r\n if self.datetime_formatting ...
[ "0.7075359", "0.6790325", "0.642026", "0.62310165", "0.6188913", "0.6179628", "0.6129327", "0.60607964", "0.6057016", "0.60511744", "0.6033971", "0.60184777", "0.60027575", "0.5995689", "0.5951697", "0.594865", "0.59321964", "0.5894319", "0.5892966", "0.5858815", "0.58510095"...
0.66324264
2
Return an RFC 1123 format date string, required for use in HTTP Date headers per the HTTP 1.1 spec.
def rfc1123_date(ts=None): ts = _get_gmtime_compatible_timestamp(ts) year, month, day, hh, mm, ss, wd, _y, _z = _time.gmtime(ts) return "%s, %02d %3s %4d %02d:%02d:%02d GMT" % ( weekday_abbr[wd], day, monthname[month], year, hh, mm, ss)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rfc3999(date):\n if not date: return ''\n date = date + datetime.timedelta(seconds = -time.timezone)\n if time.daylight:\n date += datetime.timedelta(seconds = time.altzone)\n return date.strftime('%m-%d-%YT%H:%M:%SZ')", "def _build_date_header_string(self, date_value):\n if isinsta...
[ "0.73326534", "0.7030384", "0.6976017", "0.68513876", "0.67082113", "0.657729", "0.64939576", "0.6430455", "0.64260566", "0.64258265", "0.63655615", "0.6317552", "0.6260831", "0.61307395", "0.6119839", "0.6099984", "0.60956436", "0.6070927", "0.6035394", "0.6030387", "0.60301...
0.6958105
3
Name of the group record used for ports, if any. The ports for any objects that share the same nonnull `group` tag are combined into a single record pair (`in` and `out`).
def group(): yield None, 'port grouping is determined by the global default.' yield False, 'ports are not grouped in an additional record.' yield (re.compile(r'[a-zA-Z][a-zA-Z0-9_]*'), 'ports are grouped in a record with the specified name.')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def group_name(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"group_name\")", "def group_name(self):\n return \"device-%s\" % self.id", "def group_name(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"group_name\")", "def group_name(self) -> Optional[...
[ "0.6546739", "0.6429449", "0.635649", "0.635649", "0.6354341", "0.6354341", "0.6354341", "0.63412905", "0.63399744", "0.63399744", "0.62672305", "0.6265234", "0.6221932", "0.621877", "0.6214033", "0.6186336", "0.61653405", "0.6146482", "0.614096", "0.61068565", "0.61068565", ...
0.702704
0
Create a DBConfiguration object from a yaml load Dict
def from_yaml(input_yaml: Dict) -> "DBConfiguration": return DBConfiguration(input_yaml["dialect"], input_yaml["host"], input_yaml["port"], input_yaml["username"], input_yaml["password"], ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_yaml(cls, b):\n return cls.from_dict(yaml.safe_load(b))", "def get_cfg_from_yaml(self):\n try:\n with open(self.parsed_cfg_path, 'r') as cfg_yaml:\n self.from_yaml_cfg_dict = yaml.load(cfg_yaml)\n except Exception as exc:\n print(exc)\n ...
[ "0.70168144", "0.6950649", "0.6793412", "0.6710868", "0.66283596", "0.6588615", "0.65656644", "0.6527645", "0.65187174", "0.65069497", "0.6459364", "0.6424761", "0.6405298", "0.64035547", "0.63735574", "0.62730026", "0.6265249", "0.6264448", "0.6248786", "0.6248786", "0.62487...
0.8315956
0
Create a DBRevision object from a yaml load Dict
def from_yaml(input_yaml: Dict) -> "DBRevision": return DBRevision(input_yaml["revision_name"], set(input_yaml.get("dependencies")), input_yaml["sql_text"], input_yaml["active"], input_yaml.get("description")...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_yaml(cls, b):\n return cls.from_dict(yaml.safe_load(b))", "def yaml_template(revision_name: str, dependencies: Set[str]) -> \"DBRevision\":\n return DBRevision(revision_name,\n dependencies,\n None,\n True,\n ...
[ "0.67141503", "0.66767925", "0.60892856", "0.60803556", "0.5861723", "0.5841985", "0.5833997", "0.57829887", "0.57828957", "0.573936", "0.5664287", "0.56504065", "0.56428665", "0.5634385", "0.56216234", "0.5609062", "0.55649364", "0.55053824", "0.5498698", "0.5479515", "0.546...
0.837023
0
Search for the first element with `data` matching `key`. Return the element or `None` if not found. Takes O(n) time.
def find(self, key): if self.head is None: return itr = self.head while itr: if itr.data == key: return itr.data itr = itr.next return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def first(data, key):\n for i in data:\n if key(i):\n return i\n return None", "def search(self, key):\n\n current = self.head\n\n while current:\n if current.data == key:\n return current\n else:\n current ...
[ "0.8227987", "0.7607714", "0.7480663", "0.72660404", "0.720704", "0.7060305", "0.6999197", "0.68385273", "0.6723457", "0.67219436", "0.67048424", "0.6697743", "0.6666844", "0.66327524", "0.6626988", "0.6626988", "0.65661174", "0.6546852", "0.64998317", "0.6478796", "0.6470042...
0.7911974
1
Add pytest CLI options
def pytest_addoption(parser): parser.addoption("--cases", help="Test cases to run")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pytest_addoption(parser):\n parser.addoption(\"-c\", action=\"store\", help=\" -c <test config file>\")", "def pytest_addoption(parser):\n add_cli_options(parser)", "def pytest_addoption(parser):\n parser.addoption(\"--run-flaky\", action=\"store_true\",\n help=\"runs flaky tes...
[ "0.80551434", "0.8042567", "0.78780663", "0.7752311", "0.77387285", "0.7667462", "0.7513156", "0.75112337", "0.7423324", "0.74208003", "0.73977596", "0.73914987", "0.73678404", "0.73671764", "0.7363313", "0.73434097", "0.73320854", "0.73088574", "0.72919685", "0.7284647", "0....
0.7826385
3
Returns the area of the polygon based on the so called shoelace formula.
def area(self): return 0.5*np.abs(np.dot(self.x,np.roll(self.y,1))-np.dot(self.y,np.roll(self.x,1)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def area(self):\n if len(self.exterior) < 3:\n raise Exception(\"Cannot compute the polygon's area because it contains less than three points.\")\n poly = self.to_shapely_polygon()\n return poly.area", "def polygon_area(ppath): # pragma: no cover\n v_ = ppath.vertices\n if ...
[ "0.79819864", "0.76831514", "0.7598293", "0.743863", "0.7413525", "0.7392227", "0.7345028", "0.73080844", "0.7282416", "0.72758895", "0.72432745", "0.72177577", "0.7200448", "0.71823096", "0.7159851", "0.7093095", "0.70922005", "0.7064506", "0.7057619", "0.69985825", "0.69968...
0.68996567
27
Check if this rule has defaults for a given rule.
def provides_defaults_for(self, rule): return not self.is_build_only and \ self.endpoint == rule.endpoint and self != rule and \ self.arguments == rule.arguments
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_default_value(self):\n return self.default is not None", "def has_default_value(self, name):\n return self.get_attribute_schema(name).has_default_value", "def has_default(self):\r\n return self.default is not None", "def use_defaults(self) -> Optional[pulumi.Input[bool]]:\n ...
[ "0.6333101", "0.61539197", "0.6116146", "0.60596484", "0.60596484", "0.60254383", "0.6014319", "0.6014319", "0.597295", "0.5939267", "0.5906067", "0.5906067", "0.5906067", "0.58937526", "0.5893476", "0.5883367", "0.585599", "0.5847275", "0.57923967", "0.5787634", "0.57582885"...
0.7428769
0
Create a remote resource from this instance.
def claim_messages(cls, session, claim): url = cls._get_url({'queue_name': claim.queue_name}) headers = {'Client-ID': claim.client_id} params = {'limit': claim.limit} if claim.limit else None body = [] try: resp = session.post(url, endpoint_filter=cls.service, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_remote(self, name: str, url: str, **kwargs: Any) -> Remote:\n return Remote.create(self, name, url, **kwargs)", "def create_resource(self, **kwargs):\n results = self.api.action.resource_create(**kwargs)\n # TODO: use `results` rather than re-download, using an isolation layer to ...
[ "0.6997501", "0.6764199", "0.6608829", "0.6342341", "0.6059206", "0.60024816", "0.59422565", "0.59315217", "0.5917065", "0.5904616", "0.5880331", "0.58677787", "0.5837186", "0.5768227", "0.57088333", "0.56948733", "0.56938636", "0.56754684", "0.5659072", "0.56500465", "0.5639...
0.0
-1
Return True if string is made of allowed charcters for smiles.
def looks_like_a_smiles(self): regexp = r"^([^J][0-9BCOHNSOPIFKcons@+\-\[\]\(\)\\\/%=#$,.~&!|Si|Se|Br|Mg|Na|Cl|Al]{3,})$" return re.search(regexp, self.dirty) is not None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_allowed_on_small_struni(*args):\n return _ida_hexrays.is_allowed_on_small_struni(*args)", "def is_white(string):\r\n result = False\r\n for char in string:\r\n if char == 'w' :\r\n result = True\r\n return result", "def __contains_nonascii_characters(string):\n for c i...
[ "0.6723629", "0.671042", "0.66803426", "0.66395503", "0.6529103", "0.65150034", "0.64474446", "0.6403687", "0.6403687", "0.6403687", "0.63986194", "0.63838154", "0.63381654", "0.62848425", "0.6282326", "0.62666124", "0.62564385", "0.624242", "0.623541", "0.6220491", "0.621765...
0.68844736
0
Creates the value of the lorentzian at distance r with center at a and scale b and renormalizes to 1
def lorentzian(self, r, a, b): l = 1/(np.pi*b*(((r-a)**2/b**2)+1)) norm = 1/(np.pi*b) l /= norm return l
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def levinson(r, b):\n\n n = len(b)\n y = zeros((n,))\n x = zeros((n,))\n \n # normalize the system so that the T matrix has diagonal of ones\n r_0 = r/r[0]\n b_0 = b/r[0]\n \n if n == 1:\n return b_0\n \n y[0] = -r_0[1]\n x[0] = b_0[0]\n beta = 1\n alpha = -r_0[1]\n...
[ "0.64700633", "0.6090648", "0.60472655", "0.6012052", "0.59192675", "0.58912617", "0.5877831", "0.58638227", "0.5849042", "0.5805682", "0.5727029", "0.56968594", "0.5684305", "0.5664976", "0.56246024", "0.56158864", "0.5563176", "0.55576074", "0.55342174", "0.55316", "0.55270...
0.78081995
0
Return the location of the temporary directory in which we store things related to a run but that can be safely deleted.
def get_tmp_dir(): tmp_dir = os.path.join(get_mturk_dir(), 'tmp') if not os.path.exists(tmp_dir): os.mkdir(tmp_dir) return tmp_dir
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def temp_directory(self):\n\n return self.get_raw(\"temp_directory\")", "def get_temp_dir():\n return settings.FILE_STORE_TEMP_DIR", "def get_temp_dir():\n return tempfile.mkdtemp()", "def getSystemTmpDir():\n return os.path.join(Configurations.getProjectRootDir(), TEMP_DIR_NAME)", ...
[ "0.825432", "0.80100983", "0.7872716", "0.7863628", "0.78332573", "0.7817399", "0.7762852", "0.7688491", "0.76788217", "0.766028", "0.76227605", "0.76040727", "0.7590756", "0.7530716", "0.75265735", "0.74708563", "0.7468497", "0.7448364", "0.7441954", "0.7405685", "0.7367661"...
0.747178
15
Set the status of this agent on the task.
def set_status(self, status): # TODO log to db self.status = status
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setstatus(self, status):\n with self.lock:\n self.status = status", "def set_status(self, status):\n self.status = status", "def set_status(self, status):\n self.status = status", "def set_status(self, status):\n self.status = status", "def agent_status(self, agen...
[ "0.7647256", "0.75680494", "0.75680494", "0.75680494", "0.7467842", "0.74642026", "0.73636323", "0.73636323", "0.73636323", "0.73636323", "0.73636323", "0.73636323", "0.73636323", "0.7323192", "0.7323192", "0.7323192", "0.7323192", "0.7323192", "0.7323192", "0.7323192", "0.73...
0.71824527
36
Return True if the assignment is in a final status that can no longer be acted on.
def is_final(self): return ( self.status == self.STATUS_DISCONNECT or self.status == self.STATUS_DONE or self.status == self.STATUS_PARTNER_DISCONNECT or self.status == self.STATUS_PARTNER_DISCONNECT_EARLY or self.status == self.STATUS_RETURNED ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_final(self, state: ODState) -> bool:\n return self.grid.is_final(state.agents)", "def is_not_final(cls, state):\n return state in cls._not_final_states", "def IsFinal(self):\n return self.state in FINAL_TEST_RUN_STATES", "def is_final(state: 'JobState') -> bool:\n return state ...
[ "0.7246178", "0.716305", "0.71433055", "0.69905204", "0.6947677", "0.68985885", "0.68903303", "0.67809916", "0.6766007", "0.6690647", "0.6690074", "0.6623093", "0.6605266", "0.65458655", "0.64443874", "0.63726306", "0.6356214", "0.6350434", "0.6340939", "0.6299074", "0.629881...
0.6966343
4
Return the experiment config version compatible with this installation of Triage
def configversion(self, args): print(CONFIG_VERSION)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def config_version(self) -> str:\n return pulumi.get(self, \"config_version\")", "def config_version(self) -> str:\n return pulumi.get(self, \"config_version\")", "def config_version(self) -> str:\n return pulumi.get(self, \"config_version\")", "def config_version(self) -> str:\n ...
[ "0.74907726", "0.74907726", "0.74907726", "0.74907726", "0.74907726", "0.6866356", "0.68655413", "0.6805797", "0.6773871", "0.6639495", "0.6408697", "0.63408", "0.62696123", "0.61683077", "0.6152713", "0.6148893", "0.612454", "0.612454", "0.612454", "0.612454", "0.6117604", ...
0.57922477
84
Controller for the app home page.
def home(request): context = { } return render(request, 'hydraviewer/home.html', context)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def home():\n payload = manager.get_payload()\n return render_template('index.html', payload=payload)", "def home():\n\n\treturn render_template('index.html', title='Home Page',\n\t\t\t\t\t\t year=datetime.now().year)", "def home(self, *args, **kwargs):\n pass", "def home(request):\n\treturn r...
[ "0.78027886", "0.7685395", "0.7654384", "0.7584396", "0.7558254", "0.7547364", "0.7488385", "0.7459023", "0.7447416", "0.73899287", "0.7388719", "0.7388719", "0.7388719", "0.7388719", "0.7388719", "0.7388719", "0.7388719", "0.7388719", "0.7388719", "0.7388719", "0.7383182", ...
0.0
-1
Controller for the app home page.
def usecases(request): context = { } return render(request, 'hydraviewer/usecases.html', context)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def home():\n payload = manager.get_payload()\n return render_template('index.html', payload=payload)", "def home():\n\n\treturn render_template('index.html', title='Home Page',\n\t\t\t\t\t\t year=datetime.now().year)", "def home(self, *args, **kwargs):\n pass", "def home(request):\n\treturn r...
[ "0.78027886", "0.7685395", "0.7654384", "0.7584396", "0.7558254", "0.7547364", "0.7488385", "0.7459023", "0.7447416", "0.73899287", "0.7388719", "0.7388719", "0.7388719", "0.7388719", "0.7388719", "0.7388719", "0.7388719", "0.7388719", "0.7388719", "0.7388719", "0.7383182", ...
0.0
-1
Controller for the app home page.
def mapviewer(request): precip_layer1 = geeutils.getPrecipMap(accumulation=1) precip_layer3 = geeutils.getPrecipMap(accumulation=3) precip_layer7 = geeutils.getPrecipMap(accumulation=7) #flood_viir = 'None' #geeutils.getfloodMap(snsr='atms') #flood_sentinel = geeutils.getfloodMap("sentinel1","2010-...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def home():\n payload = manager.get_payload()\n return render_template('index.html', payload=payload)", "def home():\n\n\treturn render_template('index.html', title='Home Page',\n\t\t\t\t\t\t year=datetime.now().year)", "def home(self, *args, **kwargs):\n pass", "def home(request):\n\treturn r...
[ "0.78027886", "0.7685395", "0.7654384", "0.7584396", "0.7558254", "0.7547364", "0.7488385", "0.7459023", "0.7447416", "0.73899287", "0.7388719", "0.7388719", "0.7388719", "0.7388719", "0.7388719", "0.7388719", "0.7388719", "0.7388719", "0.7388719", "0.7388719", "0.7383182", ...
0.0
-1
Controller for the app home page.
def historical(request): mekongBuffer = ee.FeatureCollection('ft:1LEGeqwlBCAlN61ie5ol24NdUDqB1MgpFR_sJNWQJ'); mekongRegion = mekongBuffer.geometry(); region = ee.Geometry.Rectangle([-180,-90,180,90]) algorithm_selection = SelectInput( # display_text='Select Surface Water Algorithm:', n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def home():\n payload = manager.get_payload()\n return render_template('index.html', payload=payload)", "def home():\n\n\treturn render_template('index.html', title='Home Page',\n\t\t\t\t\t\t year=datetime.now().year)", "def home(self, *args, **kwargs):\n pass", "def home(request):\n\treturn r...
[ "0.78027886", "0.7685395", "0.7654384", "0.7584396", "0.7558254", "0.7547364", "0.7488385", "0.7459023", "0.7447416", "0.73899287", "0.7388719", "0.7388719", "0.7388719", "0.7388719", "0.7388719", "0.7388719", "0.7388719", "0.7388719", "0.7388719", "0.7388719", "0.7383182", ...
0.0
-1
Return key for dict
def key (self): return self.variable
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_key(dict, key):\n return dict.get(key, None)", "def get_key(dic, value):\r\n for k, v in dic.items():\r\n if v == value:\r\n return k", "def key(key):\n return key", "def key_from_val(dictionary: dict, value) -> str:\r\n\r\n val = None\r\n for key, val in dictiona...
[ "0.77175856", "0.69530046", "0.69450796", "0.69015986", "0.6877197", "0.6828644", "0.6808029", "0.6782415", "0.6781178", "0.6773684", "0.67409676", "0.6673376", "0.66587687", "0.66458476", "0.6601152", "0.6593133", "0.65463436", "0.6527178", "0.6521564", "0.6512513", "0.65100...
0.0
-1
Set custom log settings.
def log_settings(config): LOGGER.propagate = False formatter = ViseronLogFormat(config.logging) handler = logging.StreamHandler() handler.setFormatter(formatter) handler.addFilter(DuplicateFilter()) LOGGER.addHandler(handler) LOGGER.setLevel(LOG_LEVELS[config.logging.level]) logging.get...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def logger_settings(self):\n LOG_CONFIG['root']['handlers'].append(self.logmode)\n flask_log = logging.getLogger(DEFAULT_NAME_FLASK_LOGGER)\n flask_log.setLevel(logging.ERROR)\n dictConfig(LOG_CONFIG)\n self.logger = logging.getLogger()", "def _configure_logging(self):\n ...
[ "0.69529897", "0.6796838", "0.6767013", "0.6719694", "0.6667604", "0.6621305", "0.6614643", "0.6595632", "0.6589087", "0.6536293", "0.6528216", "0.649685", "0.64786464", "0.64642733", "0.6457597", "0.64455074", "0.6388474", "0.63775516", "0.6377179", "0.637025", "0.6358136", ...
0.6717485
4
Move element k down the tree to the correct position
def heapdown(h, k): #put this value in the correct place v = h[k] while 2 * k < len(h): #assign j to be the left child j = 2 * k #is there a child to the right if j + 1 < len(h): #is the left child smaller than the right child if h[j] < h[j+1]: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_up(g,k): # g: graph; k: coefficient\n for i,_ in path(g): #i: node address\n if (i%k)!=0:\n move_up_node(g,i,k)", "def move_up_node(g,i,k): # i: node address of null element, k: coefficient\n d = i%k*k #d: address of dependent node coindexed with i\n # co-index stored in 'cta...
[ "0.7223279", "0.69461274", "0.68330145", "0.6830601", "0.6465141", "0.63776904", "0.63292354", "0.63292354", "0.63206685", "0.627855", "0.61892325", "0.6114724", "0.6114377", "0.6109737", "0.6101239", "0.60990566", "0.6094799", "0.6089622", "0.6083856", "0.60824436", "0.60784...
0.6107309
14
Retrieve the last time the worker participated from this cycle.
def last_participation(self, worker_id: str, model_id: str, version: str) -> int: _cycle_sequences = self._cycles.get((model_id, version), None) if _cycle_sequences: for i in range(len(_cycle_sequences)): if _cycle_sequences[i].contains(worker_id): return...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getLastWorker(self):\n return self.entries[-1]", "def get_last_time(self):\n \n return self._last", "def get_last(self):\n self.accumulated_time_last = pg.time.get_ticks() - self.start_time_last\n return self.accumulated_time_last", "def __last_time(self):\n if s...
[ "0.77495235", "0.722143", "0.7086354", "0.7072478", "0.7041851", "0.6889408", "0.6870741", "0.68063897", "0.6728249", "0.67196304", "0.66973317", "0.6649735", "0.6578695", "0.6571195", "0.65584624", "0.65311253", "0.65146923", "0.643714", "0.64352417", "0.6418109", "0.6412421...
0.5974517
98
create some storage to save intermediate evaluation results.
def set_storage(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cache(self):\n self.cached_mu = self.mu.eval()\n self.cached_var = self.var.eval()\n self.cached_count = self.count.eval()", "def store_results(self, bp_nr, fold_nr, pair_nr,\n filters, patterns, variances,\n train_feature, test_feature,\n ...
[ "0.6071861", "0.60285664", "0.58810955", "0.5779076", "0.5767951", "0.573722", "0.5728918", "0.5707881", "0.57048905", "0.56514263", "0.5611355", "0.5610169", "0.5605866", "0.559926", "0.55869025", "0.5533734", "0.5502532", "0.5492322", "0.5482421", "0.5482421", "0.5478899", ...
0.0
-1
Calculate the great circle distance between two points on the earth
def haversine(lon1, lat1, lon2, lat2): # convert decimal degrees to radians lon1, lat1, lon2, lat2 = map(radians, [lon1, lat1, lon2, lat2]) # haversine formula dlon = lon2 - lon1 dlat = lat2 - lat1 a = sin(dlat/2)**2 + cos(lat1) * cos(lat2) * sin(dlon/2)**2 c = 2 * asin(sqrt(a)) # R...
{ "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.81048185", "0.7980438", "0.77738404", "0.77190346", "0.77009726", "0.7677096", "0.75824994", "0.7574361", "0.755715", "0.75211954", "0.7480703", "0.7449132", "0.744196", "0.743406", "0.73854387", "0.7385329", "0.7331761", "0.73114425", "0.73041326", "0.72964984", "0.727581...
0.0
-1
Retrieve and store the cases database in CSV format.
def cases(*, url=CASES_URL, force=False, out=None): cases = load_cases(cases_url=url, force=force) if out is not None: cases.to_csv(out) else: cases.to_csv(sys.stdout)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dbtocsv():\n connection = sqlite3.connect(\"sensordata.db\")\n cursor = connection.cursor()\n cursor.execute(\"Select * from sensordata\")\n roadstationdata = cursor.fetchall()\n\n with open('roadstationdata.csv', 'w') as f:\n writer = csv.writer(f)\n wr...
[ "0.65343475", "0.64799255", "0.6229885", "0.6207663", "0.61385757", "0.6104932", "0.60673493", "0.6039975", "0.60059625", "0.6001518", "0.59902215", "0.5981683", "0.5946757", "0.590416", "0.58871007", "0.58785015", "0.5865777", "0.5856129", "0.58457637", "0.58450556", "0.5844...
0.67144644
0
This function checks whether all pieces on the board are destroyed. If so, it returns True.
def check_game_over(self): for piece in self.pieces: if not piece.destroyed: return False print("Signal.END") return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def still_valid(self,board) -> bool:\r\n\r\n # Return False if any of the pieces are outside the board.\r\n if self.y_pos not in range(len(board)) or self.x_pos not in range(len(board)):\r\n return False\r\n if self.y_pos + self.y_dir not in range(len(board)) or self.x_pos + self.x_...
[ "0.7387439", "0.7258", "0.6930585", "0.6730134", "0.6692998", "0.65636677", "0.6529618", "0.65152705", "0.65116924", "0.65005404", "0.64984405", "0.64984405", "0.64869416", "0.6484904", "0.64812905", "0.6479675", "0.64736754", "0.64576894", "0.64576894", "0.6454149", "0.64474...
0.7846059
0
Ensures that routes are set properly on items.
def test_route(self): # Set a global route for all items self.site.route(r"(.*)", lambda match, item: "{}/index.html".format(os.path.splitext(match.group(1))[0])) # Override the index item's route self.site.route(r"index.html", lambda match, item: "index.html") self.assertEqual...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_list_namespaced_route(self):\n pass", "def add_routes(self):\n pass", "def add_route(self, item):\n self._routes[item.route] = item\n self.httpd.route(item.route, method=\"GET\", callback=item.get)\n self.httpd.route(item.route, method=\"POST\", callback=item.post)\n...
[ "0.5813446", "0.5792718", "0.5762917", "0.5683235", "0.5637586", "0.55117834", "0.54992807", "0.5451582", "0.54440534", "0.54202", "0.54181635", "0.5397874", "0.5381951", "0.5373028", "0.5359224", "0.5316996", "0.53145516", "0.5282493", "0.5268813", "0.52407074", "0.52378756"...
0.6213184
0
Some stocks listed in stock are listed in portfolio. Others are missing. Multiple transactions per single stock
def test_stock_quantity_own_part(self): self.portfolio = './app/test/payloads/port_own_part.json' self.stock = ['ETH', 'BTC'] self.stock_url = 'https://min-api.cryptocompare.com/data/pricemultifull?fsyms=ETH&tsyms=USD' expected_data = {'ETH': 1.108, 'BTC': 0} #Run stock_quantit...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def portfolio():\n #Query transactions by user id\n trans = Transactions.query.filter_by(owner=session['user_id']).all()\n \n #Create list of comanies user owns stock in\n companies = []\n for t in trans:\n if t.symbol not in companies:\n companie...
[ "0.7620809", "0.7248839", "0.6849632", "0.6562564", "0.6562076", "0.6461358", "0.6438366", "0.64130855", "0.6259088", "0.6247397", "0.62372506", "0.61870474", "0.6179533", "0.61487496", "0.61401904", "0.6132828", "0.6131834", "0.6099311", "0.60937095", "0.6081602", "0.6074353...
0.575598
52
Some stocks listed in stock are listed in portfolio. Others are missing. Multiple transactions per single stock
def test_purchase_value_own_part(self): self.portfolio = './app/test/payloads/port_own_part.json' self.stock = ['ETH', 'BTC'] self.stock_url = 'https://min-api.cryptocompare.com/data/pricemultifull?fsyms=ETH&tsyms=USD' expected_data = {'ETH': 998.4599999999999, 'BTC': 0} #Run p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def portfolio():\n #Query transactions by user id\n trans = Transactions.query.filter_by(owner=session['user_id']).all()\n \n #Create list of comanies user owns stock in\n companies = []\n for t in trans:\n if t.symbol not in companies:\n companie...
[ "0.7620842", "0.72482824", "0.68496", "0.65639114", "0.65622467", "0.6462813", "0.64398503", "0.64126956", "0.6258585", "0.62488544", "0.62369317", "0.6186526", "0.6179932", "0.61470026", "0.613973", "0.61322874", "0.613119", "0.61001414", "0.6094114", "0.6080713", "0.6074241...
0.0
-1
A wrapper around the environmental variable ``CUDA_VISIBLE_DEVICES``.
def CUDA_VISIBLE_DEVICES(self): return self._CUDA_VISIBLE_DEVICES
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_gpu(gpus):\n os.environ[\"CUDA_DEVICE_ORDER\"] = \"PCI_BUS_ID\"\n os.environ[\"CUDA_VISIBLE_DEVICES\"] = gpus", "def setup_device(n_gpus: int) -> object:\n if n_gpus >= 1 and torch.cuda.is_available():\n LOG.info('\\n CUDA is available! using GPU...')\n return torch.device('cuda')\...
[ "0.6651148", "0.65356845", "0.64506143", "0.6438943", "0.64353836", "0.6404075", "0.63323855", "0.6197687", "0.6193647", "0.6144602", "0.6126489", "0.6108876", "0.6102214", "0.60661966", "0.6031319", "0.5971092", "0.5926554", "0.59110445", "0.5894841", "0.5866065", "0.5862494...
0.746266
0
Extract string before character c from w
def getsubString(w, c): count = 0 for x in w: if x == c: break count=count+1 return w[:count]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_word(w):\n return ''.join(c for c in w if c.isalpha()).lower()", "def extractRef(c: Cmdr, s: str) -> str:\n i = s.find('<<')\n j = s.find('>>')\n if -1 < i < j:\n return s\n i = s.find('@<')\n j = s.find('@>')\n if -1 < i < j:\n return s\n return ''", "def kwextrac...
[ "0.5899428", "0.56812567", "0.56247586", "0.5505634", "0.5490504", "0.5490116", "0.54792416", "0.5456825", "0.5446404", "0.5443767", "0.5417875", "0.53756875", "0.5319617", "0.52909213", "0.5272238", "0.5237109", "0.5227983", "0.5200136", "0.51951736", "0.51902264", "0.518172...
0.7660314
0
Given a field name, get the field class name
def get_field_class_name(field): return field.capitalize() + "Field"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def class_for_field(self, fieldname):\n base_class = 'field'\n error_class = ' error'\n if not fieldname in self.error_mapping:\n if fieldname in self.errors:\n base_class += error_class\n return base_class\n\n for error_name in self.error_mapping[fi...
[ "0.6911975", "0.64001805", "0.6398967", "0.633878", "0.6332958", "0.62591106", "0.61923623", "0.6088692", "0.60466313", "0.60342956", "0.6033608", "0.6017334", "0.6005898", "0.60052407", "0.5993169", "0.5959907", "0.5945562", "0.5931756", "0.59028786", "0.58911484", "0.586688...
0.8636729
0
Checks whether a result is a dataclass.
def _check_dataclass(self) -> PossibleResult[T]: if is_dataclass(self.constructor): if not isinstance(self.obj, Mapping): raise DeserializeError( Mapping, self.obj, self.new_depth, self.key ) parameters = inspect.signature(self.construc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_dataclass_instance(obj: Any) -> bool:\n return dataclasses.is_dataclass(obj) and not isinstance(obj, type)", "def _is_dataclass_instance(obj):\n return hasattr(type(obj), '__dataclass_fields__')", "def _is_user_class(obj):\n type_dict = type(obj).__dict__\n is_user_class = '_pandas_type' in ...
[ "0.7057761", "0.69761187", "0.67004293", "0.65474546", "0.6465183", "0.64485246", "0.62863547", "0.6099032", "0.6009287", "0.5941256", "0.5940203", "0.589898", "0.5888937", "0.587944", "0.58144903", "0.58112144", "0.5802233", "0.5801073", "0.5767627", "0.57391346", "0.5739134...
0.70465857
1
Check if a type is a Union.
def _is_union(typeval: Type) -> bool: return get_origin(typeval) is Union
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_union(type_):\n if not is_class(type_):\n return False\n decl = class_traits.get_declaration(type_)\n return decl.class_type == class_declaration.CLASS_TYPES.UNION", "def is_Union(tp):\n if tp is Union:\n return True\n try:\n # Python 3.6\n return tp.__origin__ i...
[ "0.85660684", "0.8565367", "0.8402205", "0.8028145", "0.76783395", "0.7580995", "0.7298121", "0.70287675", "0.7008213", "0.68816227", "0.67422485", "0.608914", "0.6011332", "0.59631306", "0.58728856", "0.5829557", "0.582753", "0.57970834", "0.5793196", "0.5769379", "0.5765471...
0.86151093
0
Reads a specific type of JS file to JSON JS file defines one variable to be interpreted as JSON
def read_js(filename): with open(filename, 'r') as f: js_text = f.readlines()[0] # JS should all be on a single line equal_sign_index = js_text.index('=') # JSON text should be available after this index in a JS file js_text = js_text[equal_sign_index + 1:] # + 1 for space return ujso...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_json(filename) :\n result = json.load(open(filename,'r'))\n return result", "def _json_probe(srcfile):\n return json.loads(__run(srcfile))", "def _localloadjson(path: str) -> JSONType:\n with open(path, encoding=\"utf-8\") as fh:\n return json.load(fh)", "def load_json_file(i):\n...
[ "0.6508193", "0.64012164", "0.62945783", "0.6218412", "0.6208759", "0.6118356", "0.6103969", "0.6063499", "0.6041166", "0.6040826", "0.60223895", "0.60210633", "0.60185677", "0.6016211", "0.6013139", "0.59991294", "0.59793466", "0.596746", "0.596746", "0.59659636", "0.5957714...
0.6597865
0
Returns a string representation of dividend income
def dividend_to_str(stock, dividend, shares): return (' - ' + stock + ' paid out ' + '${:.2f}'.format(float(dividend)) + ' dividend per share, and you have ' + str(shares) + ' shares\n')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shares_to_str(dic1, income):\n result = ''\n for ticker in dic1:\n if dic1[ticker][0] != 0:\n result += (' - ' + str(dic1[ticker][0]) + ' shares of ' + ticker\n + ' at ' + '${:.2f}'.format(dic1[ticker][1]) +\n ' per share\\n')\n result +...
[ "0.64843905", "0.6136027", "0.58907175", "0.57183564", "0.5707262", "0.56968904", "0.5613735", "0.5582156", "0.5574088", "0.5568627", "0.5552067", "0.5545448", "0.5536089", "0.5524955", "0.5503959", "0.5495276", "0.54841036", "0.5466637", "0.5442036", "0.542455", "0.5397603",...
0.72639894
0
convert valid testsuite dict to pytest folder with testcases
def make_testsuite(testsuite: Dict) -> NoReturn: # validate testsuite format load_testsuite(testsuite) testsuite_config = testsuite["config"] testsuite_path = testsuite_config["path"] testsuite_variables = convert_variables( testsuite_config.get("variables", {}), testsuite_path ) l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dir_tests():\n return abspath('tests')", "def get_test_case_filenames(program, test_case):\n\n filenames = {}\n for f in INFO[program].test_cases[test_case]:\n filenames[f] = os.path.join(INFO[program].base_folder, test_case, f)\n\n return filenames", "def _get_tests(directory, assignmen...
[ "0.60683304", "0.60443807", "0.59628564", "0.5885669", "0.5881416", "0.58308464", "0.58022887", "0.5694754", "0.5686286", "0.56685966", "0.56206757", "0.55897623", "0.5559843", "0.55591345", "0.5534002", "0.55283433", "0.54916483", "0.5477565", "0.547463", "0.5448648", "0.544...
0.65523076
0
make testcase(s) with testcase/testsuite/folder absolute path generated pytest file path will be cached in pytest_files_made_cache_mapping
def __make(tests_path: Text) -> NoReturn: logger.info(f"make path: {tests_path}") test_files = [] if os.path.isdir(tests_path): files_list = load_folder_files(tests_path) test_files.extend(files_list) elif os.path.isfile(tests_path): test_files.append(tests_path) else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_testcase(testcase: Dict, dir_path: Text = None) -> Text:\n # ensure compatibility with testcase format v2\n testcase = ensure_testcase_v3(testcase)\n\n # validate testcase format\n load_testcase(testcase)\n\n testcase_abs_path = __ensure_absolute(testcase[\"config\"][\"path\"])\n logger....
[ "0.7222579", "0.6562629", "0.6490684", "0.6393903", "0.63728976", "0.6322652", "0.63134784", "0.6291773", "0.6256355", "0.6218034", "0.61481386", "0.6139067", "0.6083945", "0.6062174", "0.60449606", "0.60444933", "0.60270125", "0.59900326", "0.59731054", "0.5964343", "0.59407...
0.7288697
0
Compute the derivative of the objective function
def objective_grad(self, wb, X, y): N, D = X.shape w = wb[:-1] b = wb[-1] loss_grad = np.zeros(D+1) # grad wrt regularization loss_grad[-1] = 2 * self.reg_param * (b - self.b0) # grad_b loss_grad[:-1] = 2 * self.reg_param * (w - self.w0) # grad_w ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def derivative(func: Callable, x: float, delta: float) -> float:\n return (func(x + delta) - func(x - delta)) / (2.0 * delta)", "def derivative ( fun , x , h = 0 , I = 2 , err = False ) :\n\n func = lambda x : float ( fun ( x ) )\n \n ## get the function value at the given point \n f0 = func(x)\n...
[ "0.69911724", "0.691882", "0.6865966", "0.6861917", "0.68610233", "0.68349284", "0.67812246", "0.678024", "0.6747806", "0.67396474", "0.6739106", "0.6738369", "0.6709931", "0.66989005", "0.6681462", "0.6681462", "0.6653894", "0.66343796", "0.66186374", "0.66110957", "0.660268...
0.0
-1
returns one row of zeros of width "width"... You might use this in your createBoard(width, height) function
def createOneRow(width): row = [] for col in range(width): row += [0] return row
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def createOneRow(width):\r\n row = []\r\n for col in range(width):\r\n row += [0]\r\n return row\r\n #return [0 for x in range(width)]\r", "def createOneRow(width):\r\n row = []\r\n for col in range(width):\r\n row += [0]\r\n return row", "def create_board_matrix(self, height...
[ "0.7897214", "0.76322377", "0.74122894", "0.73387074", "0.73309314", "0.7312711", "0.72746456", "0.7131121", "0.7085155", "0.70722806", "0.69984984", "0.6952593", "0.6948051", "0.6857729", "0.6818919", "0.6660613", "0.66547304", "0.6651483", "0.6631478", "0.6618711", "0.66142...
0.75919735
3
returns a new 2D list of height rows and width columns, all data elements are 0
def createBoard(width, height): A = [] for row in range(height): A += [createOneRow(width)] return A
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_grid(self):\n return [[0] * self.width for _ in range(self.height)]", "def create_empty_grid(width, height):\n return [[None] * width for _ in range(height)]", "def create_grid(height, width):\n grid = []\n \n for r in range(height):\n row = [0] * width # a row containi...
[ "0.7328616", "0.69756913", "0.69377214", "0.68976855", "0.6865992", "0.6715472", "0.6702557", "0.6699912", "0.6697123", "0.66303676", "0.6534077", "0.6473939", "0.6450783", "0.6440367", "0.64397436", "0.64374244", "0.643012", "0.6410294", "0.6396347", "0.6396347", "0.63643754...
0.6065528
47
Creates an empty board and then modifies it so that it has a diagonal strip of "on" cells. But do that only in the interior of the 2D array.
def diagonalize(width, height): A = createBoard(width, height) for row in range(1, height - 1): for col in range(1, width - 1): if row == col: A[row][col] = 1 else: A[row][col] = 0 return A
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_board(self, ):\n for r in range(self.boardSize):\n for c in range(self.boardSize): # avoid redundant calculation by adding neighbors \"behind\" current cell\n new_cell = Cell(r, c)\n self.board[r][c] = new_cell\n if c > 0: # add left neighbo...
[ "0.7026158", "0.6755896", "0.6665872", "0.66275674", "0.65990025", "0.6595689", "0.65949774", "0.65606874", "0.6549269", "0.65408915", "0.6504629", "0.6472458", "0.64530075", "0.64311695", "0.6387999", "0.6359941", "0.63562095", "0.63562095", "0.6348001", "0.6347839", "0.6293...
0.63781583
15
returns a 2D array that has all live cellswith a value of 1except for a onecell wide border of empty cells around the 2D array
def innerCells(w, h): A = createBoard(w, h) for row in range(1, h-1): for col in range(1, w-1): if row == h-1: A[row][col] = 0 elif col == w-1: A[row][col] = 0 else: A[row][col] = 1 return A
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def empty_cells(state):\r\n cells = []\r\n for x, row in enumerate(state):\r\n for y, cell in enumerate(row):\r\n if cell == 0:\r\n cells.append([x, y])\r\n\r\n return cells", "def empty_cells(state):\n cells = []\n\n for i, row in enumerate(state):\n for j,...
[ "0.70756274", "0.70644706", "0.68764913", "0.684926", "0.670845", "0.66711664", "0.66543275", "0.6649778", "0.6620564", "0.65546125", "0.644375", "0.6333183", "0.62948114", "0.62629914", "0.62027365", "0.62024534", "0.61777204", "0.61059844", "0.59475476", "0.59472984", "0.59...
0.5782983
33
Represent geographies as a `pd.DataFrame`. Arguments
def to_df(self, columns=None) -> pd.DataFrame: return create_dataframe( data=super().to_list(), columns=columns, default_columns=DEFAULT_COLUMNS, logger_description="Geographies", )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_frame(self):\n return gpd.GeoDataFrame(\n data=self.tree_ids,\n geometry=self.to_geom(),\n crs=self.crs,\n columns=['id'],\n )", "def convert_to_geopandas(df):\n df['geometry'] = [Point(xy) for xy in zip(df.latitude, df.longitude)]\n crs = {'...
[ "0.71205604", "0.710612", "0.70885205", "0.69439054", "0.68327457", "0.68232316", "0.6779965", "0.675445", "0.6727426", "0.6691453", "0.666764", "0.6462968", "0.6435619", "0.6409666", "0.63836014", "0.6356381", "0.6319355", "0.62900496", "0.6270308", "0.6202135", "0.61856127"...
0.74561036
0
This command determines the number of days in a month
def daysInMonth(month,year): if (month == 2): if (isLeapYear(year)): return 29 else: return 28 elif (month in [1, 3, 5, 7, 8, 10, 12]): return 31 else: return 30
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def days_of_month(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['DayArgs']]]]:\n return pulumi.get(self, \"days_of_month\")", "def days_per_month(leap=False):\n\n ndays = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]\n if leap:\n ndays[1]+= 1\n return ndays", "def days_of_month...
[ "0.74041927", "0.7237302", "0.7223566", "0.72001404", "0.71655154", "0.71174055", "0.70184904", "0.699754", "0.69810164", "0.68410474", "0.6821801", "0.6803278", "0.6802093", "0.67983294", "0.67983294", "0.66744345", "0.66452545", "0.65939045", "0.65776926", "0.64826375", "0....
0.63150996
28