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 |
|---|---|---|---|---|---|---|
Creates lists for rooms | def create_rooms():
# create empty list
chambers = []
# read csv file with rooms
with open("../data/zalen.csv", "rt") as csvfile:
# create csvfile
rooms = csv.reader(csvfile)
# iterate over rows
for row in rooms:
# extract text out of list
for text in row:
# split features
features = tex... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_room_list():\n room_list = []\n # 0\n room = Room(\n \"Patio. You are in a patio, it is surrounded by four long walls.\\n\\\n The south wall has a metal door.\",\n north = None,\n east = None,\n south = 2,\n west = None\n )\n room_list.append(room)\... | [
"0.78612775",
"0.7401134",
"0.7310438",
"0.72925186",
"0.7255505",
"0.71872556",
"0.71112496",
"0.69231975",
"0.68888897",
"0.68348444",
"0.6815808",
"0.67809373",
"0.6765381",
"0.67505515",
"0.6693738",
"0.6638784",
"0.65620273",
"0.6499126",
"0.6499126",
"0.64845103",
"0.64... | 0.7214344 | 5 |
Creates a list with students | def create_students():
# create empty list
student_list = []
# import student classces
student_list = create_student_class()
return student_list | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _create_students(self, num_students):\r\n return [self.create_student('robot%d' % i) for i in xrange(num_students)]",
"def make_students_list():\n students_data_list = generate_list_from_txt(\"students.txt\")\n students_list = extract_first_element(students_data_list)\n return students_list",... | [
"0.7745152",
"0.7651385",
"0.7401376",
"0.71513355",
"0.70380795",
"0.70029294",
"0.6829479",
"0.67328805",
"0.67180187",
"0.6694999",
"0.6692375",
"0.66772085",
"0.666242",
"0.66623324",
"0.66604805",
"0.66128814",
"0.64615536",
"0.6453344",
"0.6451012",
"0.6374588",
"0.6329... | 0.8256589 | 0 |
Prepare dictionary that represents schedule | def create_empty_schedule():
# create empty dictionary with all room-timelock combinations (roomlocks) as keys
roomlocks = list(range(0, 140))
schedule = dict.fromkeys(roomlocks)
return schedule | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_schedule_dict(state_data):\n\n times = np.array(list((zip(state_data['tstart'], state_data['tstop'])))).reshape((-1,))\n pitch = np.array(list((zip(state_data['pitch'], state_data['pitch'])))).reshape((-1,))\n roll = np.array(list((zip(state_data['off_nom_roll'], state_data['off_nom_roll'])))).res... | [
"0.7184708",
"0.71270216",
"0.6862534",
"0.6845834",
"0.6493",
"0.6412015",
"0.6295843",
"0.6152573",
"0.6042599",
"0.6027099",
"0.5902042",
"0.5900816",
"0.5900633",
"0.589502",
"0.5893605",
"0.5878575",
"0.5878575",
"0.586897",
"0.584919",
"0.58455867",
"0.5827547",
"0.58... | 0.64518183 | 5 |
Swaps roomlocks of 2 (random) courses | def swap_course(chambers, allcourses, student_list, schedule, course1 = None, activity1 = None, course2 = None, activity2 = None):
#* swap roomlock 2 (random) courses *#
# if specific course is not chosen
if course1 == None:
# choose random course from courselist
course1 = random.randint(0, len(allcourses) - ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def swap_course2(chambers, allcourses, student_list, schedule, roomlock1 = None, roomlock2 = None):\n\n\t#* swap roomlock 2 (random) courses *#\n\n\t# if specific activity is not chosen\n\tif roomlock1 == None:\n\t\t# chose random activity from schedule\n\t\t\troomlock1 = random.randint(0, len(schedule) - 1)\n\n\t... | [
"0.7765962",
"0.72392523",
"0.6555751",
"0.6316322",
"0.62035066",
"0.597391",
"0.5684663",
"0.5618999",
"0.5602784",
"0.55934566",
"0.55453897",
"0.55311406",
"0.5462399",
"0.5456227",
"0.5454935",
"0.53875643",
"0.5385624",
"0.52876556",
"0.5249359",
"0.5243026",
"0.5181878... | 0.77095574 | 1 |
Creates an intial population and returns the parents | def initial_population(amount):
population = []
scores = []
for i in range(amount):
timetable_info = []
score_info = []
# create a new random schedule
chambers, allcourses, student_list, schedule = create_schedule()
# add all information about this specific schedule
score_info.append(allcourses)
s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def select_parents(self, population):\n random.shuffle(population)\n return population",
"def make_parents(self):\r\n self.parents = []\r\n \r\n for loopindex in range(0, int(self.population_size * 0.6)):\r\n while True:\r\n if loopindex < int(self.pop... | [
"0.77673835",
"0.75192976",
"0.69933486",
"0.6961012",
"0.69397545",
"0.6842586",
"0.6719524",
"0.66722953",
"0.66668206",
"0.6638701",
"0.6605075",
"0.6519307",
"0.6501638",
"0.64927197",
"0.64678603",
"0.6441624",
"0.6361077",
"0.6356534",
"0.6340087",
"0.6322848",
"0.63011... | 0.5600679 | 94 |
Swaps roomlocks of 2 (random) courses | def swap_course2(chambers, allcourses, student_list, schedule, roomlock1 = None, roomlock2 = None):
#* swap roomlock 2 (random) courses *#
# if specific activity is not chosen
if roomlock1 == None:
# chose random activity from schedule
roomlock1 = random.randint(0, len(schedule) - 1)
# same
if roomlock2 ==... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def swap_course(chambers, allcourses, student_list, schedule, course1 = None, activity1 = None, course2 = None, activity2 = None):\n\n\t#* swap roomlock 2 (random) courses *#\n\n\t# if specific course is not chosen\n\tif course1 == None:\n\n\t\t# choose random course from courselist\n\t\tcourse1 = random.randint(0... | [
"0.7708698",
"0.7239419",
"0.65556955",
"0.63164467",
"0.6203988",
"0.5975702",
"0.5683306",
"0.56191695",
"0.5601216",
"0.5595645",
"0.55455333",
"0.55321777",
"0.5463059",
"0.5457011",
"0.5455547",
"0.5386996",
"0.53857696",
"0.5288003",
"0.5248843",
"0.524417",
"0.51821",
... | 0.77652556 | 0 |
Convert MAC address as text to binary | def mac_pton(s):
return binascii.unhexlify(s.replace(":", "")) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mac_aton(str):\n macbytes = [int(i, 16) for i in str.split(':')]\n return struct.pack('6B', *macbytes)",
"def mac_ntoa(mac):\n return '%.2x:%.2x:%.2x:%.2x:%.2x:%.2x' % tuple(map(ord, list(mac)))",
"def bytes_to_mac_str(buff):\n if len(buff) != DataDescription.B_SEQ_MAC_LEN:\n raise ... | [
"0.755393",
"0.737579",
"0.7051263",
"0.6880074",
"0.6865667",
"0.6838513",
"0.6820341",
"0.67308336",
"0.6585798",
"0.6578865",
"0.6569511",
"0.6569511",
"0.6569511",
"0.6569511",
"0.6490012",
"0.64107645",
"0.6352259",
"0.6314068",
"0.6274746",
"0.61971205",
"0.6173257",
... | 0.71789646 | 2 |
Convert MAC address as binary to text | def mac_ntop(binary):
x = b":".join(binascii.hexlify(binary)[i : i + 2] for i in range(0, 12, 2))
return str(x.decode("ascii")) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mac_ntoa(mac):\n return '%.2x:%.2x:%.2x:%.2x:%.2x:%.2x' % tuple(map(ord, list(mac)))",
"def get_mac_string():\n mac_int = getnode()\n mac_str = ':'.join((\"%012x\" % mac_int)[i:i + 2] for i in range(0, 12, 2))\n return mac_str",
"def bytes_to_mac_str(buff):\n if len(buff) != DataDescripti... | [
"0.7694354",
"0.734345",
"0.7315028",
"0.7247421",
"0.7226495",
"0.7147634",
"0.70992243",
"0.6946505",
"0.69215995",
"0.68953925",
"0.68953925",
"0.68953925",
"0.68953925",
"0.6813606",
"0.6689902",
"0.66344076",
"0.6630556",
"0.65933263",
"0.6514876",
"0.6511732",
"0.646405... | 0.7156266 | 5 |
Calculate the square's area | def area(self):
return self.__size ** 2 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def square_area(side):\n return side**2",
"def calculatearea(self):\r\n return self.width * self.height",
"def area(x, y):\n return x*y/2",
"def findArea(self):\n\n a, b = self.sides\n area = a * b\n print(f\"Are of rectangle is: {area}\")",
"def area(self):\n area ... | [
"0.8180065",
"0.7854952",
"0.78490144",
"0.7791911",
"0.7776777",
"0.7746308",
"0.77008075",
"0.7654788",
"0.76177776",
"0.7609416",
"0.75847775",
"0.75611585",
"0.7530824",
"0.753009",
"0.75173247",
"0.751225",
"0.7501089",
"0.7495724",
"0.7487936",
"0.7475768",
"0.74709356"... | 0.7316392 | 71 |
Returns a mapping from node tag name to node for each child node of the parameter. Note that if there are multiple children with the same tag, the last one will overwrite previous ones in the returned map. | def label_children(node: etree.Element) -> t.Mapping[str, etree.Element]:
return {child.tag: child for child in node} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def xml_children_as_dict(node):\n return dict((e.tag, e.text) for e in node)",
"def getChildMap(self) :\n return self.childrenMap",
"def nodes_names_map(self):\n return {nd.name: nd for nd in self.nodes}",
"def child_to_parent_dict(self,):\n\n self.ParentMap = dict((c, p) for p in self.tr... | [
"0.6460066",
"0.61043286",
"0.6043569",
"0.6034069",
"0.60262054",
"0.6023899",
"0.5942375",
"0.59339494",
"0.5930342",
"0.5904966",
"0.5840489",
"0.58310926",
"0.576763",
"0.5763387",
"0.5736841",
"0.5714391",
"0.5709196",
"0.5707675",
"0.5707272",
"0.56825244",
"0.5676164",... | 0.7628022 | 0 |
Applies a maxpool of input features. This ensures a more dense representation of features, which can be computationally efficient because of lower dimensionality. It also helps in capturing more important features. | def maxpool(X,kernel_shape,stride,*args,return_architecture = False):
if len(kernel_shape) == 2:
kernel_shape = torch.reshape(kernel_shape,(1,kernel_shape[0],kernel_shape[1]))
output_size1 = math.floor((X.shape[1] - kernel_shape[1])/(stride)) + 1
output_size2 = math.floor((X.shape[2] - kernel_shape[... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_pool(inputs):\n return tf.layers.max_pooling2d(\n inputs,\n pool_size=[2, 2],\n strides=[2, 2],\n padding='same',\n )",
"def max_pool(images, imgshp, maxpoolshp):\r\n N = numpy\r\n poolsize = N.int64(N.prod(maxpoolshp))\r\n\r\n # imgs... | [
"0.7255755",
"0.7038157",
"0.7037154",
"0.6909142",
"0.68308043",
"0.68176293",
"0.67974436",
"0.67644066",
"0.6739941",
"0.6704689",
"0.6672234",
"0.65636295",
"0.65562516",
"0.6546335",
"0.6528822",
"0.64766204",
"0.64616317",
"0.64616317",
"0.6444639",
"0.6430642",
"0.6381... | 0.589747 | 57 |
Simple softmax activation with enhanced stability | def softmax(y):
# y = y.squeeze()
epsilon = 0.001
y = y.detach().numpy()
y[y > 400] = 400 # For stability to prevent overflow
denominator = epsilon + sum(np.exp(y)) # Further stability to prevent overflow
numerator = np.exp(y)
softmax = numerator / denominator
return torch.Tensor(softmax... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def softmax(x):\n return np.exp(x) / np.sum(np.exp(x), axis=1, keepdims=True)",
"def softmax(x):\n \"\"\"\"\"\"\n return exp(x) / sum(exp(x), axis=0)",
"def softmax(x):\r\n output = np.exp(x)\r\n return output / np.sum(output, axis=1, keepdims=True)",
"def softmax(x): \n re... | [
"0.7496774",
"0.7491808",
"0.7477932",
"0.745179",
"0.74494547",
"0.7381552",
"0.7378061",
"0.7378061",
"0.7378061",
"0.7378061",
"0.7378061",
"0.7378061",
"0.7378061",
"0.7378061",
"0.7342358",
"0.73372644",
"0.73372644",
"0.7319728",
"0.73162705",
"0.73162705",
"0.729192",
... | 0.0 | -1 |
Applies a conv_batchnorm_relu layer on the input. The input is expected to be of shape (channels,width,height) | def conv_bn_relu(X,channels,stride,kernel_shape,padding,activation = 'sigmoid',initialize_weights = True,batchnorm = True,*args): # Refactoring conv_batchnorm_relu as one layer
if initialize_weights: # no of channels in kernel must be the same as that in the input image,
output_1,weights,X_im2col,im,ou... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _bn_relu(input):\n norm = BatchNormalization(axis=CHANNEL_AXIS)(input)\n return Activation(\"relu\")(norm)",
"def _bn_relu(input):\n norm = BatchNormalization(axis=CHANNEL_AXIS)(input)\n return Activation(\"relu\")(norm)",
"def _bn_relu(input):\r\n norm = BatchNormalization(axis=3)(input)\r\... | [
"0.7544851",
"0.7544851",
"0.7431144",
"0.72901523",
"0.7254086",
"0.717242",
"0.717242",
"0.7122106",
"0.7037521",
"0.6998685",
"0.69885784",
"0.69531804",
"0.69166845",
"0.6793073",
"0.6756596",
"0.671605",
"0.6691599",
"0.66906065",
"0.66906065",
"0.6684915",
"0.66385937",... | 0.7359023 | 3 |
Implementation of the Adam optimizer. This will return the running average of the mean and variance as well as the weight delta for updating parameters | def adam(g,beta_1,beta_2,m,v,t,lr):
if not isinstance(g,np.ndarray):
g = g.detach().numpy()
if not isinstance(m,np.ndarray):
m = m.detach().numpy()
if not isinstance(v,np.ndarray):
v = v.detach().numpy()
m = beta_1 * m + (1 - beta_1) * g
v = beta_2 * v + (1 - beta_2) * n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def step(self, closure=None):\n loss = None\n if closure is not None:\n loss = closure()\n for group in self.param_groups:\n for p in group['params']:\n if p.grad is None:\n continue\n grad = p.grad.data\n if... | [
"0.7055364",
"0.7048658",
"0.6961846",
"0.6636437",
"0.6618789",
"0.6601562",
"0.65832293",
"0.654588",
"0.65404624",
"0.6513651",
"0.6475529",
"0.64639866",
"0.6430684",
"0.63923466",
"0.6379025",
"0.6375366",
"0.6335626",
"0.632555",
"0.6275789",
"0.6254198",
"0.61983746",
... | 0.0 | -1 |
Initialising grad weights dictionary for each layer for the purpose of minibatch gradient descent | def zero_gradients(architecture):
grad_weights = {}
grad_bias = {}
# Initialising first and second moments for each gradient and bias matrix in each layer
m = {}
v = {}
for layer in range(len(architecture)):
weightsi = architecture['layer{}'.format(layer+1)][2]
biasi ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize_weights(self):\n # compute lmda.\n self.lmda = float(self.c)/float(self.N)\n # bias term. This should not get a regularization penalty.\n self.bias = {}\n # weight vector\n self.w = {}\n # lastW[j] = k, indicates that feature j was last updated at tim... | [
"0.69300973",
"0.6742267",
"0.66169405",
"0.659284",
"0.65581596",
"0.6541057",
"0.65214163",
"0.65181965",
"0.65103287",
"0.64910835",
"0.64890605",
"0.6479744",
"0.6462262",
"0.645236",
"0.6443289",
"0.6424518",
"0.6416552",
"0.64034224",
"0.6395258",
"0.6388599",
"0.636855... | 0.0 | -1 |
Given the gradients, this function updates weights using the chosen optimizer (Adam or SGD) | def update_weights(architecture,grad_weights,grad_bias,m,v,t,lr,optimizer="adam"):
for layer in range(len(architecture)):
if not (grad_weights['layer{}'.format(layer+1)] is None) and grad_bias['layer{}'.format(layer+1)] is not None:
grad_weightsi = grad_weights['layer{}'.format(layer+1)]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def optimize(self,gradients):\n\n for k in range(self.size):\n delta_weight = self.learningRate * gradients[k]\n full_change = delta_weight + self.momentum*self.last_change[k]\n self.weights[k] -= full_change\n self.last_change[k] = 1*gradients[k] #copy gradient m... | [
"0.7615294",
"0.74489164",
"0.74227506",
"0.73617655",
"0.733145",
"0.7311669",
"0.7239274",
"0.722948",
"0.7211416",
"0.7201807",
"0.71323997",
"0.7118863",
"0.7102021",
"0.7076012",
"0.70577985",
"0.7050655",
"0.70322204",
"0.70137715",
"0.7010193",
"0.6981598",
"0.69721115... | 0.76219994 | 0 |
Return the email address to satisfy FlaskLogin's requirements. | def get_id(self):
return self.id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def email(self) -> Optional[str]:\n return pulumi.get(self, \"email\")",
"def email(self) -> Optional[str]:\n return pulumi.get(self, \"email\")",
"def email(self) -> Optional[str]:\n return pulumi.get(self, \"email\")",
"def email(self) -> Optional[str]:\n return pulumi.get(self,... | [
"0.74636996",
"0.74636996",
"0.74636996",
"0.74636996",
"0.744493",
"0.744493",
"0.744493",
"0.7439936",
"0.7439936",
"0.7439936",
"0.7439936",
"0.7439936",
"0.7439936",
"0.7439936",
"0.7421634",
"0.72910833",
"0.7233626",
"0.7228416",
"0.72064245",
"0.7176058",
"0.71472573",... | 0.0 | -1 |
Initialize the ship and set its starting position. | def __init__(self, screen, ship_speed_factor):
self.ship_speed_factor = ship_speed_factor
self.screen = screen
# Load the ship image and get its rect.
self.image = pygame.image.load('./images/ship.bmp')
self.image = self.image.convert()
self.rect = self.image.get_rect()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self):\r\n global ship_image\r\n self.spaceshipgame = SpaceShipGame()\r\n self.spaceshipgame.init()\r\n pos = [1,1]\r\n vel = [1,1]\r\n angle = 0\r\n image = ship_image\r\n\r\n center = [1,1]\r\n size = 1\r\n info = ImageInfo(center, s... | [
"0.7156775",
"0.7156775",
"0.71117884",
"0.7104403",
"0.70625305",
"0.6991875",
"0.69255584",
"0.68944544",
"0.688422",
"0.6880826",
"0.68696547",
"0.6849714",
"0.68470556",
"0.68340504",
"0.6809345",
"0.6806218",
"0.67833537",
"0.6759838",
"0.6680851",
"0.66361636",
"0.66155... | 0.6683925 | 18 |
Compute softmax values for each sets of scores in x. | def softmax(x):
return np.exp(x) / np.sum(np.exp(x), axis=0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def softmax(self, scores):\n\n\n # for each sample, for each class ,caclulate\n # np.exp(scores) : still (n_samples, n_classes)\n\n # axis = 1\n # a00, a01, a02 as a sinlge one to perfrom np_sum\n # which is the same sample \n # sum_exp : still (n_samples, 1)\n\n # ... | [
"0.7796294",
"0.7760558",
"0.7759004",
"0.77567077",
"0.76577055",
"0.76577055",
"0.76577055",
"0.76577055",
"0.7585655",
"0.743143",
"0.7407772",
"0.73941606",
"0.7358175",
"0.73174125",
"0.72689486",
"0.72623265",
"0.72614294",
"0.7256868",
"0.723019",
"0.7214918",
"0.72017... | 0.6985568 | 86 |
Builds the model with given scaling factors, sets up optimizer and learning rate schedulers plus executes training and evaluation of the model. A checkpoint is created each epoch. Also the best model will be saved. | def grid_search(train_loader, val_loader, criterion, alpha, beta):
# Initializing training variables
best_acc = 0
all_losses = []
# Initializing log file
logfile = open('./model_compound_scaling/logfiles/logfile.txt', 'a+')
logfile.write('depth multiplier: {}, width multiplier: {}\n'.format(al... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fit(\n self,\n epochs,\n lr,\n mini_epochs,\n patience,\n model_name,\n gpus=1,\n workers=1,\n use_multiprocessing=False,\n verbose=2,\n max_queue_size=10,\n clipvalue=0,\n save_period=5,\n checkpoint_dir=\"/\",\n... | [
"0.70966077",
"0.6923572",
"0.68657726",
"0.68205684",
"0.6819302",
"0.6797251",
"0.67803794",
"0.6769261",
"0.6740324",
"0.6717742",
"0.67093253",
"0.6640144",
"0.65960515",
"0.6544053",
"0.65388143",
"0.65348136",
"0.6480014",
"0.64793617",
"0.64499766",
"0.64464337",
"0.64... | 0.0 | -1 |
Return polygon coordinates from area source element. | def _get_polygon(element):
polygon = element.find('%s/%s/%s/%s/%s' %
(NRML04_AREA_GEOMETRY, gml.GML_POLYGON,
gml.GML_EXTERIOR, gml.GML_LINEAR_RING,
gml.GML_POS_LIST)).text
polygon = gml._get_polygon_from_2DLinestring(polygon)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_polygon(areasrc):\n\n str = areasrc.geometry.wkt\n str = re.sub('POLYGON\\(\\(', '', str)\n str = re.sub('\\)\\)', '', str)\n aa = re.split('\\,', str)\n lons = []\n lats = []\n for str in aa:\n bb = re.split('\\s+', re.sub('^\\s+', '', str))\n lons.append(float(bb[0]))\... | [
"0.6878503",
"0.6720386",
"0.6508824",
"0.6448162",
"0.64302117",
"0.63747144",
"0.6359347",
"0.63009137",
"0.62981766",
"0.6252196",
"0.6229776",
"0.61082804",
"0.608465",
"0.6054674",
"0.59956473",
"0.597074",
"0.593738",
"0.59253395",
"0.5905957",
"0.5867216",
"0.58459276"... | 0.6497018 | 3 |
Append NRML 0.4 rupture aspect ratio. | def _append_rupt_aspect_ratio(element, rupt_aspect_ratio):
rar = etree.Element(NRML04_RUPT_ASPECT_RATIO)
rar.text = str(rupt_aspect_ratio)
element.append(rar) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def aspect_ratio(self):\n ar = (self._block[1] >> 2) & 0x03\n asp_ratio = ''\n\n if ar == 0x00:\n asp_ratio = '4:3 AR'\n elif ar == 0x01:\n asp_ratio = '16:9 AR'\n elif ar == 0x02:\n asp_ratio = '16:10 AR'\n elif ar == 0x03:\n asp_ratio = '15:9 AR'\n\n return asp_ratio",
... | [
"0.72204494",
"0.6930829",
"0.6145553",
"0.61392057",
"0.61110014",
"0.60201645",
"0.59601164",
"0.5947477",
"0.5947477",
"0.5905705",
"0.58838624",
"0.5812048",
"0.5752944",
"0.57470596",
"0.5681481",
"0.5657247",
"0.5653122",
"0.56221634",
"0.55957",
"0.5583546",
"0.5571397... | 0.7270869 | 0 |
Returns a dict representation of the Task, only includes a few attributes | def to_dict(self):
return dict(name=self.name, product=str(self.product),
source_code=self.source_code) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_task_info(self):\n\n print()\n employee_name = self.task.get_employee_name()\n task_name = self.task.get_task_name()\n mins = self.task.get_time_spent()\n notes = self.task.get_notes()\n date = self.task.get_date()\n\n task = {\n 'employee_name': ... | [
"0.7886997",
"0.7776561",
"0.76235783",
"0.75243306",
"0.72605354",
"0.68832064",
"0.68387127",
"0.669032",
"0.66797143",
"0.6642683",
"0.66357154",
"0.6624956",
"0.65192956",
"0.6500157",
"0.64861345",
"0.6427225",
"0.64229995",
"0.6420753",
"0.641781",
"0.63771826",
"0.6376... | 0.0 | -1 |
Test that the derivative is constant for linear values | def test_dot_constant_for_linear_values(name, ipset_linear):
_, y_dot = interpolation.interpolate_with_derivative(*ipset_linear, kind=name, **IPARGS.get(name, {}))
assert np.allclose(y_dot, y_dot.mean()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_adding_constant():\n a = fwd.Variable()\n assert equals((a+1).derivative_at(a, {a: 0.0}), 1.0)\n assert equals((1+a).derivative_at(a, {a: 0.0}), 1.0)",
"def test_subtracting_constant():\n a = fwd.Variable()\n assert equals((a-1).derivative_at(a, {a: 0.0}), 1.0)\n assert equals((1-a).d... | [
"0.6898832",
"0.685875",
"0.67385304",
"0.6627886",
"0.659027",
"0.64766955",
"0.63666826",
"0.61839104",
"0.6155851",
"0.6111213",
"0.605531",
"0.6039669",
"0.60019153",
"0.5988068",
"0.5977119",
"0.594931",
"0.5942649",
"0.59101087",
"0.5908608",
"0.5904329",
"0.5849621",
... | 0.6581577 | 5 |
Do not return anything, modify head inplace instead. | def reorderList(self, head: ListNode) -> None:
if not head:
return
len = 1
tmp = head
while tmp.next:
tmp = tmp.next
len += 1
if len <= 2:
return
tmp = head
for _ in range(len//2):
tmp = tmp.next
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def head(self, head):\n\n self._head = head",
"def move_to_head(self, node):\n if node is self.head:\n return\n value = node.value\n self.delete(node)\n self.add_to_head(value)",
"def _move_to_head(self, node):\n self._remove_node(node)\n self._add_no... | [
"0.7218526",
"0.6802109",
"0.6732775",
"0.6622557",
"0.65217346",
"0.6466963",
"0.64551795",
"0.63585746",
"0.63523316",
"0.63093",
"0.62923217",
"0.6231313",
"0.622523",
"0.62005043",
"0.62005043",
"0.62005043",
"0.62005043",
"0.6198878",
"0.6193791",
"0.61740905",
"0.614918... | 0.5739143 | 86 |
One forward pass, returns all necessary outputs to getting the losses or evaluation | def forward(self, *args, mode="train", **kwargs):
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def forward(self, x):\n output1, output2 = self.model(x)\n return output1, output2",
"def forward(self, inputs):\r\n #print (len(inputs))\r\n out = self.fc1(inputs)\r\n out = self.fc2(out)\r\n self.out = out\r\n return out\r\n #raise NotImplementedError('Im... | [
"0.7562277",
"0.741715",
"0.7181422",
"0.7123376",
"0.70972884",
"0.7086092",
"0.7073132",
"0.7041763",
"0.7037029",
"0.702812",
"0.7025107",
"0.7023581",
"0.7015795",
"0.69769984",
"0.69751114",
"0.69698113",
"0.69687414",
"0.696796",
"0.6955912",
"0.6952524",
"0.6948189",
... | 0.0 | -1 |
Update learning rates for all modifiers | def update_learning_rate(self, it):
self.scheduler.step()
for param_group in self.optimizer.param_groups:
v = param_group['lr']
self.tb_logger.add_scalar('train/lr', v, it) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __update(self, learning_rate):\n for layer in self.layers:\n layer.weights.set_value((layer.weights - learning_rate * layer.dW).eval())\n layer.biases.set_value((layer.biases - learning_rate * layer.db).eval())",
"def _update_learning_rate(self):\r\n\r\n self.n_steps += 1\... | [
"0.76727396",
"0.7208993",
"0.7205981",
"0.7189951",
"0.7177713",
"0.7177713",
"0.71575546",
"0.7132899",
"0.7087447",
"0.70507866",
"0.7005369",
"0.6815615",
"0.67162895",
"0.67096025",
"0.6709071",
"0.6709071",
"0.66752166",
"0.665268",
"0.6629523",
"0.6628419",
"0.66214806... | 0.62804294 | 37 |
basic test of making a Reference object and writing it | def test_construct_and_write_metadata(tmp_path):
prov = Provenance()
prov.start_activity("test")
prov.finish_activity()
prov_activity = prov.finished_activities[0]
reference = meta.Reference(
contact=meta.Contact(
name="Somebody", email="a@b.com", organization="CTA Consortium"
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testReferenceFeature(self):\n alist = [1]\n aref = alist \n alist.append(\"stasi\")\n self.assertEqual([1,\"stasi\"],aref)\n self.assertIs(aref,alist)",
"def make_reference(self):\n self.make_reference2()",
"def test_objref_log(self):\n dt = h5t.special_dtyp... | [
"0.7002616",
"0.699844",
"0.6835863",
"0.6805242",
"0.677898",
"0.67260915",
"0.6622117",
"0.6544108",
"0.63401926",
"0.63239473",
"0.6297716",
"0.62402374",
"0.615337",
"0.60901904",
"0.6059733",
"0.5989274",
"0.5989274",
"0.59616166",
"0.59488213",
"0.58804727",
"0.58664656... | 0.0 | -1 |
Calculate closest distance between text locatios. | def closest_distance(node_a, node_b):
min_distance = 999999
for loc_a in node_a.locations:
for loc_b in node_b.locations:
distance = abs(loc_a - loc_b)
if distance < min_distance:
min_distance = distance
return min_distance | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_dist(text1, text2, wv):\n t1 = lookup(text1, wv)\n t2 = lookup(text2, wv)\n dist = cos_sim(t1, t2)\n return dist",
"def _get_distance(a, b):\n return np.sqrt(np.sum((a - b) ** 2))",
"def getDistance(pos1, pos2):\r\n return ((pos1[0] - pos2[0]) ** 2 + (pos1[1] - pos... | [
"0.6502031",
"0.64668155",
"0.63840044",
"0.6381534",
"0.6293578",
"0.62862223",
"0.62667376",
"0.62639034",
"0.6245803",
"0.62424576",
"0.6186929",
"0.613746",
"0.6123262",
"0.61144817",
"0.61048514",
"0.6088064",
"0.6063522",
"0.60569715",
"0.6030201",
"0.60145307",
"0.6013... | 0.5781976 | 72 |
Initialize edges based on weight function(s). | def initialize_edges(graph, text_distance, term_embedding, embeddings):
# For each node check connection with other nodes.
for node_key in graph.nodes.keys():
for other_node_key in graph.nodes.keys():
weight = 0.0
node_a = graph.nodes[node_key]
node_b = graph.nodes[ot... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, edges, weights=None):\n \n # Initialize a default dictionary representing the edges and weights\n self._edges = collections.defaultdict(set)\n self._weights = collections.defaultdict(lambda: None)\n \n # Depending on whether or not weights were passed, c... | [
"0.7240901",
"0.7228488",
"0.71456856",
"0.71456856",
"0.7130452",
"0.7130452",
"0.7130452",
"0.709268",
"0.6997311",
"0.69763535",
"0.69003636",
"0.6875869",
"0.68441224",
"0.6796794",
"0.6779174",
"0.67563796",
"0.67430854",
"0.6738829",
"0.6701468",
"0.66936976",
"0.668707... | 0.6552248 | 33 |
return number of seconds necessary to advance UTC to TT. we aren't presently supporting dates prior to 1972 because fractional leap second handling is another thing. | def utc_to_tt_offset(time: dt.datetime) -> float:
if time.year < 1972:
raise ValueError("dates prior to 1972 are not currently supported")
# this includes the horrible fractional leap seconds prior to 1972
# and the base 32.184 s offset between TAI and TT
offset = 42.184
for threshold in LEA... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def total_seconds(td):\n return (td.microseconds + (td.seconds + td.days * 24 * 3600) * 10**6) / 10**6",
"def tt_utc_diff(jd_ut):\n prev_offset = None\n for start, offset in TAI_UTC_DIFF:\n if jd_ut < start:\n if prev_offset is None:\n t = jd_ut - JD_AT_1_JAN_2000 / DAYS... | [
"0.6930482",
"0.6922026",
"0.68787366",
"0.68285644",
"0.6744406",
"0.6735209",
"0.66996384",
"0.66784525",
"0.65576565",
"0.6504402",
"0.645737",
"0.6443351",
"0.6411192",
"0.6389988",
"0.63863105",
"0.6361231",
"0.63160324",
"0.628228",
"0.6277072",
"0.6235955",
"0.6235721"... | 0.6366384 | 15 |
returns top of queue | def pop_message(self):
app_process = sqlite3.connect('app_process::memory:', check_same_thread=False)
app_process_cursor = app_process.cursor()
app_process_cursor.execute("SELECT * FROM message_queue WHERE tstamp==(:first)", {"first":self.mq_first})
item = app_process_cursor.fetchone()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def top(self):\n return self.queue[0]",
"def top(self):\n with self.mutating:\n top = self.queue[0]\n return top",
"def top(self):\n self.move()\n return self.queue2[-1]",
"def top(self):\n try: return self._queue[0]\n except IndexError: return 0",
... | [
"0.8723121",
"0.86396456",
"0.85779846",
"0.85765296",
"0.8512995",
"0.8489804",
"0.8471067",
"0.84307843",
"0.8293698",
"0.80193186",
"0.794998",
"0.7819543",
"0.7819543",
"0.77343005",
"0.76884115",
"0.7673914",
"0.76736563",
"0.7670727",
"0.76616704",
"0.76474243",
"0.7647... | 0.0 | -1 |
recursively delete keys which are not in whitelist from dict | def delete_keys_from_dict(self, orig_dict, keys_whitelist):
for k in list(orig_dict.keys()):
if k not in keys_whitelist:
del orig_dict[k]
for v in orig_dict.values():
if isinstance(v, dict):
self.delete_keys_from_dict(v, keys_whitelist)
r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _filter_dict(src_dict, key_set):\n for k in set(src_dict.keys()) - key_set:\n src_dict.pop(k)",
"def drop_keys(d):\n if isinstance(d, dict):\n return {\n k: drop_keys(v)\n for k, v in d.items()\n if k not in [\"propNames\", \"package\"]\n and v ... | [
"0.6856295",
"0.68377435",
"0.6778026",
"0.66896665",
"0.66479087",
"0.65067303",
"0.6412215",
"0.64060175",
"0.6379368",
"0.6377117",
"0.637668",
"0.63585854",
"0.6313904",
"0.62321764",
"0.6227118",
"0.6196082",
"0.6195551",
"0.61785346",
"0.61675006",
"0.6138815",
"0.61277... | 0.7573473 | 0 |
Test that is_url_for declarations on one class are distinct from those on another class. | def test_class_has_url_for(self):
self.assertNotEqual(NamedDocument.url_for_endpoints, ScopedNamedDocument.url_for_endpoints) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_is_url(self):\n\n url = \"https://shadowrun.needs.management\"\n self.assertTrue(run(verification.is_url(url)))\n\n url = \"https:// www.google.com\"\n self.assertFalse(run(verification.is_url(url)))",
"def is_url(obj):\n try:\n result = urlparse(obj)\n retur... | [
"0.59825796",
"0.5940046",
"0.5919606",
"0.5890274",
"0.5873385",
"0.58620006",
"0.57634276",
"0.5741979",
"0.5730055",
"0.5716562",
"0.57139075",
"0.57051075",
"0.5698682",
"0.5665582",
"0.5641317",
"0.5610529",
"0.5575139",
"0.5564298",
"0.5554621",
"0.5537491",
"0.55332077... | 0.73218 | 0 |
Return the latest value in this series. | def latest(self):
return self.series.tail(1)[0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def latestValue(self):\n if len(self.values) > 0:\n return self.values[-1]\n else:\n return 0",
"def get_value(self):\n return self.last_value",
"def last_value(self):\n return self._last_value",
"def last_value(self):\n return self._value",
"def las... | [
"0.8410519",
"0.79116005",
"0.7865828",
"0.7830085",
"0.7564972",
"0.745795",
"0.7434323",
"0.7434323",
"0.7386836",
"0.7305879",
"0.72503465",
"0.7221665",
"0.72150016",
"0.7208824",
"0.71890277",
"0.703852",
"0.702002",
"0.69903666",
"0.69722044",
"0.6950126",
"0.69447047",... | 0.8702844 | 0 |
Convert an angle in radians into a quaternion _message_. | def angle_to_quaternion(angle):
return Quaternion(*tf.transformations.quaternion_from_euler(0, 0, angle)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def angle_to_quaternion(angle):\n\treturn Quaternion(*tf.transformations.quaternion_from_euler(0, 0, angle))",
"def quaternion_about_axis(angle, axis):\r\n q = numpy.array([0.0, axis[0], axis[1], axis[2]])\r\n qlen = vector_norm(q)\r\n if qlen > _EPS:\r\n q *= math.sin(angle/2.0) / qlen\r\n q[... | [
"0.7184424",
"0.6586116",
"0.65782166",
"0.6502942",
"0.64593834",
"0.63969165",
"0.63833195",
"0.6304824",
"0.62954307",
"0.62519157",
"0.62373656",
"0.6236086",
"0.609381",
"0.6089491",
"0.6088315",
"0.6080563",
"0.60768217",
"0.6070013",
"0.6065713",
"0.6061386",
"0.605858... | 0.70761853 | 1 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, NodeTypeElasticVolumeSpecs):
return False
return self.__dict__ == other.__dict__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.8457179",
"0.8393067",
"0.81457263",
"0.8140635",
"0.8133462",
"0.8094992",
"0.8093376",
"0.8093376",
"0.8093376",
"0.80863357",
"0.80863357",
"0.8077303",
"0.8077303",
"0.8066831"
] | 0.0 | -1 |
Returns True if linkedlist is cyclic | def is_cyclic(linked_list):
# if linked-list is empty
if not linked_list.head or not linked_list.head.next:
return False
visited=set()
current=linked_list.head
while current:
#if the node is already in visited set that mean linked-list is cyclic
if current.data in visited:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_cyclic(linked_list):\n # if linked-list is empty\n if not linked_list.head or not linked_list.head.next:\n return False\n\n slow = fast =linked_list.head\n \n while fast and fast.next:\n slow=slow.next #slow takes one step at a time\n fast= fast.next.next #fast takes two ... | [
"0.82857597",
"0.79582113",
"0.7786479",
"0.76969624",
"0.76272607",
"0.7581619",
"0.75750923",
"0.75621927",
"0.7509321",
"0.7492304",
"0.7411968",
"0.73725957",
"0.7304321",
"0.7271526",
"0.72672004",
"0.71242845",
"0.7100384",
"0.70694846",
"0.706597",
"0.6935207",
"0.6840... | 0.8114524 | 1 |
Returns True if linkedlist is cyclic | def is_cyclic(linked_list):
# if linked-list is empty
if not linked_list.head or not linked_list.head.next:
return False
slow = fast =linked_list.head
while fast and fast.next:
slow=slow.next #slow takes one step at a time
fast= fast.next.next #fast takes two step at a time... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_cyclic(linked_list):\n # if linked-list is empty\n if not linked_list.head or not linked_list.head.next:\n return False\n\n visited=set()\n current=linked_list.head\n\n while current:\n #if the node is already in visited set that mean linked-list is cyclic\n if current.d... | [
"0.8114524",
"0.79582113",
"0.7786479",
"0.76969624",
"0.76272607",
"0.7581619",
"0.75750923",
"0.75621927",
"0.7509321",
"0.7492304",
"0.7411968",
"0.73725957",
"0.7304321",
"0.7271526",
"0.72672004",
"0.71242845",
"0.7100384",
"0.70694846",
"0.706597",
"0.6935207",
"0.68403... | 0.82857597 | 0 |
Test the radix_sort function. | def test_radix(self):
integers = radix_sort(self.actual)
self.assertEqual(self.expected, integers) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_radix_sort():\n from radixsort import radixsort\n nums = [5, 3, 2, 7, 9, 4, 0, 1]\n assert radixsort(nums) == [0, 1, 2, 3, 4, 5, 7, 9]",
"def test_radix_sort_verbose():\n from radixsort import radixsort\n # test on 100 lists\n for i in range(100):\n # generate random length of l... | [
"0.8753928",
"0.80272275",
"0.7015981",
"0.6981579",
"0.67306805",
"0.67251253",
"0.6708736",
"0.6635044",
"0.66296977",
"0.66228664",
"0.6511154",
"0.6511154",
"0.6467761",
"0.6462981",
"0.6446105",
"0.64339566",
"0.63228947",
"0.627015",
"0.6259791",
"0.62233526",
"0.618855... | 0.84617704 | 1 |
Converts a string to a list of ints. | def stringToInts(string):
ints=[];
for char in string:
ints.append(charToInt(char));
return ints; | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_int_list(input_str):\n return [int(part) for part in input_str.split(\",\")]",
"def parse_string_to_listint(string):\n\tstring = string.split()\n\tlength = len(string)\n\tnewlist = []\n\tfirst = int (string[0])\n\tsecond = int (string[1])\n\tthird = int (string[2])\n\tforth = int (string[3])\n\tfift... | [
"0.81432605",
"0.8093059",
"0.7867134",
"0.78074944",
"0.7754062",
"0.77155924",
"0.7646192",
"0.76061463",
"0.75288945",
"0.7364147",
"0.73415273",
"0.7335448",
"0.73277694",
"0.73225194",
"0.7290918",
"0.72004265",
"0.7199279",
"0.7170711",
"0.71434283",
"0.71203357",
"0.70... | 0.76136655 | 7 |
Create a new column called `Split`, split the data into trainvaltest split and save them to `output_directory`. | def split_and_save_datasets(datasets, output_dir, val_size=0.1, test_size=0.1):
print('Splitting datasets...')
ensure_directory_exists(output_dir)
for dataset in datasets:
name = dataset.name()
if dataset.dataset_exists():
print(f'Dataset {name} is already split. Skipping...')
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def splitData(df, split):\n train = df.iloc[:int(len(df)*split)]\n test = df.iloc[int(len(df)*split):]\n \n return train, test",
"def split_data(input_df, output_df):\n return train_test_split(input_df, output_df, test_size=0.2, random_state=42,\n stratify=output_df)",
... | [
"0.6906549",
"0.6901513",
"0.6835606",
"0.6821647",
"0.6801417",
"0.6726146",
"0.6640298",
"0.66372555",
"0.66048867",
"0.65740645",
"0.6567868",
"0.6552622",
"0.6544721",
"0.65262765",
"0.6512012",
"0.6507401",
"0.6460772",
"0.64161533",
"0.6399278",
"0.6371944",
"0.631241",... | 0.60643977 | 52 |
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(JTCartesianControllerState, self).__init__(*args, **kwds)
#message fields cannot be None, assign default values for those that are
if self.header is None:
self.header = std_msgs.msg.Header()
if self.x is None:
self.x =... | {
"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.77950794",
"0.7720336",
"0.7720336",
"0.7686725",
"0.7626082",
"0.75635314",
"0.7439626",
"0.74171734",
"0.73522437",
"0.7308215",
"0.72808266",
"0.7238561",
"0.7227589",
"0.7224258",
"0.7224258",
"0.7219543",
"0.7211657",
"0.7211657",
"0.7211657",
"0.7211657",
"0.7211657"... | 0.0 | -1 |
Returns a formatted string containing the start date of the event with respect to the current locale and to the ``show_times`` setting. | def get_date_from_display(self) -> str:
return _date(
self.date_from,
"DATETIME_FORMAT" if self.settings.show_times else "DATE_FORMAT"
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start_date_text(self):\r\n i18n = self.runtime.service(self, \"i18n\")\r\n _ = i18n.ugettext\r\n strftime = i18n.strftime\r\n\r\n def try_parse_iso_8601(text):\r\n try:\r\n result = Date().from_json(text)\r\n if result is None:\r\n ... | [
"0.7131341",
"0.69635767",
"0.6604521",
"0.6604521",
"0.66030943",
"0.6584703",
"0.6512063",
"0.6344532",
"0.6337087",
"0.63150364",
"0.63097066",
"0.6249729",
"0.6200742",
"0.6146806",
"0.6134303",
"0.60933673",
"0.6075157",
"0.6045663",
"0.6045663",
"0.60321003",
"0.6025002... | 0.73349273 | 0 |
Returns a formatted string containing the start date of the event with respect to the current locale and to the ``show_times`` setting. Returns an empty string if ``show_date_to`` is ``False``. | def get_date_to_display(self) -> str:
if not self.settings.show_date_to:
return ""
return _date(
self.date_to,
"DATETIME_FORMAT" if self.settings.show_times else "DATE_FORMAT"
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_date_from_display(self) -> str:\n return _date(\n self.date_from,\n \"DATETIME_FORMAT\" if self.settings.show_times else \"DATE_FORMAT\"\n )",
"def start_date_text(self):\r\n i18n = self.runtime.service(self, \"i18n\")\r\n _ = i18n.ugettext\r\n str... | [
"0.75314003",
"0.61698425",
"0.6168201",
"0.61607456",
"0.6011269",
"0.5935802",
"0.57879746",
"0.57879746",
"0.5777352",
"0.56856716",
"0.5599108",
"0.5578707",
"0.55216694",
"0.55216694",
"0.5449624",
"0.54163945",
"0.54107505",
"0.52958435",
"0.5276258",
"0.5257653",
"0.52... | 0.75081867 | 1 |
This method is used to determine whether this Item is currently available for sale. | def check_quotas(self):
if self.properties.count() > 0: # NOQA
raise ValueError('Do not call this directly on items which have properties '
'but call this on their ItemVariation objects')
return min([q.availability() for q in self.quotas.all()]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def available(self) -> bool:\n return self._product and self._product.online",
"def available(self) -> bool:\n return self._product.online",
"def available(self) -> bool:\n return self._product.online",
"def available(self) -> bool:\n return pulumi.get(self, \"available\")",
"de... | [
"0.72324836",
"0.7027602",
"0.7027602",
"0.70158225",
"0.6879664",
"0.6842883",
"0.67713404",
"0.6720407",
"0.67135215",
"0.67135215",
"0.6683946",
"0.6683946",
"0.6683946",
"0.6683946",
"0.6683946",
"0.6664476",
"0.6649109",
"0.66463643",
"0.66380775",
"0.6608348",
"0.659744... | 0.0 | -1 |
Get the local task queues. | def _get_task_queues():
return _thread_data.__dict__.setdefault('task_queues', defaultdict(list)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_queue_list(self):\n return self.manager.get_queue_list()",
"def _get_queues(self):\n return self.__queues",
"def _get_queues(self):\n return self.__queues",
"def _get_queues(self):\n return self.__queues",
"def _get_queues(self):\n return self.__queues",
"def _get_queues(self):... | [
"0.7504683",
"0.7367488",
"0.7367488",
"0.7367488",
"0.7367488",
"0.7367488",
"0.7367488",
"0.7367488",
"0.7367488",
"0.7367488",
"0.73668957",
"0.7037355",
"0.6979956",
"0.6931894",
"0.6794612",
"0.66510695",
"0.64876384",
"0.6455231",
"0.63946617",
"0.6363944",
"0.62890834"... | 0.723063 | 11 |
Retrieves products which are in the product table. | def product_list(id):
db = get_db()
product_list = db.execute(
"SELECT product_id, product_name, quantity FROM product WHERE for_business = ? AND quantity > 0",
(id,),
).fetchall()
return product_list | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_products():\n products = app.session.query(models.Product).all()\n return products",
"def products(self):\n return list(Product.select())",
"def list_products(self):\n return self._make_get_request(self._urls['products'])",
"def get_all_products(self):\n\t\tpass",
"def get_p... | [
"0.71760863",
"0.7162592",
"0.7137824",
"0.7046695",
"0.6927646",
"0.684623",
"0.68116623",
"0.6808153",
"0.67466056",
"0.6745379",
"0.6716586",
"0.66852856",
"0.66484797",
"0.66199297",
"0.6615095",
"0.6604761",
"0.658257",
"0.658238",
"0.6526238",
"0.6517985",
"0.6448445",
... | 0.6420188 | 22 |
Used by the movement page to get the quantity of a product. | def getquantity(prd, loc):
db = get_db()
b_id = session.get("user_id")
qty = {}
if loc == "Products":
if prd != "None":
q = db.execute(
"SELECT quantity FROM product WHERE product_id = ? AND for_business = ?",
(prd, b_id,),
).fetch... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_product_qty(self, cr, uid, context=None):\n if context is None:\n context = {}\n return self.calc_qty(cr, uid, context['active_id'], context=context)",
"def quantity(self):\n return self._quantity",
"def qty(self):\n return self._qty",
"def qty(self):\n ... | [
"0.76257485",
"0.76112825",
"0.73950773",
"0.73950773",
"0.73950773",
"0.739446",
"0.736247",
"0.7319676",
"0.72150004",
"0.70647335",
"0.70375305",
"0.69283897",
"0.6592257",
"0.6553313",
"0.64841473",
"0.6482976",
"0.64609164",
"0.6435165",
"0.6407856",
"0.6403097",
"0.6400... | 0.71329355 | 9 |
Return a friendly HTTP greeting. | def get_symbol(symbol):
st = Stock(symbol)
return st.get_quote() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_greeting(name):\n\n greeting = (f\"Hello, {name.title()}. It's nice to meet you!\")\n return greeting",
"def welcome():\n return 'Welcome to Flask!'",
"def greeting_message(name):\n print('My name is ' + name)",
"def Welcome():\n return (\n f\"Welcome to the Surf's Up API!\... | [
"0.67861116",
"0.671909",
"0.67098147",
"0.6681713",
"0.6663591",
"0.663865",
"0.66334784",
"0.66282094",
"0.65564704",
"0.6537159",
"0.6478153",
"0.64774853",
"0.64703834",
"0.6464776",
"0.64439946",
"0.6435135",
"0.6401036",
"0.6400535",
"0.6375895",
"0.6375895",
"0.6367971... | 0.0 | -1 |
Creates a node that represents np.broadcast_to(node_A, node_B.shape). | def conv2d_broadcastto_op(node_A, node_B):
return Conv2d_BroadcastToOp()(node_A, node_B) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __call__(self, node_A):\r\n new_node = Op.__call__(self)\r\n new_node.inputs = [node_A]\r\n new_node.name = \"Oneslike[%s]\" % node_A.name\r\n return new_node",
"def convert_broadcast_to(node, **kwargs):\n name, input_nodes, attrs = get_inputs(node, kwargs)\n\n shape_list = ... | [
"0.6666761",
"0.6659025",
"0.654645",
"0.63538057",
"0.6327516",
"0.6319324",
"0.62949514",
"0.6266634",
"0.6178212",
"0.61454374",
"0.6051135",
"0.5936199",
"0.59056914",
"0.57944137",
"0.5778465",
"0.57575446",
"0.56963354",
"0.56923544",
"0.565333",
"0.5625701",
"0.5575835... | 0.77207065 | 0 |
Given `payoff_array` with ndim=M, return the payoff array with ndim=M1 fixing the last player's action to be `action`. | def reduce_last_player(payoff_array, action):
if isinstance(action, numbers.Integral): # pure action
return payoff_array.take(action, axis=-1)
else: # mixed action
return payoff_array.dot(action) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def payoff_vector(self, opponents_actions):\n def reduce_last_player(payoff_array, action):\n \"\"\"\n Given `payoff_array` with ndim=M, return the payoff array\n with ndim=M-1 fixing the last player's action to be `action`.\n\n \"\"\"\n if isinstance(a... | [
"0.61896527",
"0.57726955",
"0.5655154",
"0.534237",
"0.5307442",
"0.5270126",
"0.5082962",
"0.50820214",
"0.502772",
"0.4990429",
"0.4967821",
"0.4954014",
"0.49503568",
"0.4917324",
"0.4901366",
"0.48845673",
"0.48834804",
"0.48795328",
"0.4873013",
"0.47989064",
"0.4791833... | 0.802484 | 0 |
Return a list of actions that are strictly dominated by some mixed actions. | def dominated_actions(self, tol=None, method=None):
out = []
for action in range(self.num_actions):
if self.is_dominated(action, tol=tol, method=method):
out.append(action)
return out | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def final_actions(self):\n return set(filter(lambda x: not isinstance(x, Operator), self.behaviour()))",
"def getLegalActions(self, state):\n actions = [i for i in range(-5, 6)]\n for action in actions:\n if action > state[0] or action < -state[1]:\n actions.remove(... | [
"0.61810017",
"0.61473125",
"0.5949959",
"0.589096",
"0.587577",
"0.5787308",
"0.5774201",
"0.57722336",
"0.57545906",
"0.57241243",
"0.5702353",
"0.56992173",
"0.5688286",
"0.5673033",
"0.56673825",
"0.5666372",
"0.56426305",
"0.56363314",
"0.561346",
"0.5606041",
"0.5593412... | 0.7470228 | 0 |
Return chip time in required format. | def get_chip_time(start, end):
start_hour, start_min, start_sec = start.split(':')
end_hour, end_min, end_sec = end.split(':')
hour_diff = int(end_hour) - int(start_hour)
min_diff = int(end_min) - int(start_min)
sec_diff = int(end_sec) - int(start_sec)
total_diff = hour_diff * 60 * 60 + min_di... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_time(self):\n return \"%02u:%02u:%02u (%d)\" % self.rtc.datetime()[4:8]",
"def get_time(self):\n x = time.localtime()\n return ''.join([\n str(x[0]).rjust(4, '0'), '/', str(x[1]).rjust(2, '0'), '/',\n str(x[2]).rjust(2, '0'), ' ', str(x[3]).rjust(2, '0'), ':',\n... | [
"0.8068728",
"0.7735697",
"0.7542246",
"0.7542246",
"0.7466049",
"0.7461879",
"0.73698246",
"0.73347324",
"0.72966886",
"0.7271676",
"0.72571206",
"0.7216136",
"0.7210773",
"0.7186142",
"0.7175955",
"0.7165639",
"0.7149126",
"0.70763546",
"0.7057985",
"0.7012951",
"0.6984495"... | 0.7596016 | 2 |
Used to create a dense layer. | def dense(x, n1, n2, name):
with tf.variable_scope(name, reuse=None):
weights = tf.get_variable("weights", shape=[n1, n2],
initializer=tf.random_normal_initializer(mean=0., stddev=0.01))
bias = tf.get_variable("bias", shape=[n2], initializer=tf.constant_initializer(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dense(in_layer):\n return Dense(neurons,\n kernel_initializer=initializer())(in_layer)",
"def init_dense(self, layer):\n pass",
"def add_dense_layer(self, input_tensor, output_size, activation_fn=None,\n name = None):\n return ... | [
"0.76484036",
"0.76465064",
"0.76412284",
"0.7377716",
"0.73189133",
"0.7122971",
"0.692109",
"0.683266",
"0.67409086",
"0.67067945",
"0.66833633",
"0.65608716",
"0.6544221",
"0.6529006",
"0.6489199",
"0.6448582",
"0.6313288",
"0.6254297",
"0.62455183",
"0.6233911",
"0.621484... | 0.57410717 | 77 |
Return list of indexes with length 'size' in descending order [from best to worst] | def sel_best(fitness, size):
fitness_index = []
for i, _ in enumerate(fitness):
fitness_index.append(i)
sorted_fitness, sorted_index = extra.sort_lists(fitness, fitness_index, descending=True)
return [sorted_index[k] for k in range(size)] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sel_worst(fitness, size):\r\n fitness_index = []\r\n for i, _ in enumerate(fitness):\r\n fitness_index.append(i)\r\n sorted_fitness, sorted_index = extra.sort_lists(fitness, fitness_index, descending=False)\r\n return [sorted_index[k] for k in range(size)]",
"def _get_best_indexes(logits, ... | [
"0.7540718",
"0.6696156",
"0.6666932",
"0.6666932",
"0.6666932",
"0.6657952",
"0.6655765",
"0.6455048",
"0.6340084",
"0.5878087",
"0.5858202",
"0.57793754",
"0.5776097",
"0.5759967",
"0.567609",
"0.56121266",
"0.5564823",
"0.55271596",
"0.5523938",
"0.5498709",
"0.5490048",
... | 0.68256915 | 1 |
Return list of indexes with length 'size' in ascending order [from worst to best] | def sel_worst(fitness, size):
fitness_index = []
for i, _ in enumerate(fitness):
fitness_index.append(i)
sorted_fitness, sorted_index = extra.sort_lists(fitness, fitness_index, descending=False)
return [sorted_index[k] for k in range(size)] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sel_best(fitness, size):\r\n fitness_index = []\r\n for i, _ in enumerate(fitness):\r\n fitness_index.append(i)\r\n sorted_fitness, sorted_index = extra.sort_lists(fitness, fitness_index, descending=True)\r\n return [sorted_index[k] for k in range(size)]",
"def _get_best_indexes(logits, n_... | [
"0.7027825",
"0.6992243",
"0.6959604",
"0.6959604",
"0.6959604",
"0.6956015",
"0.6947875",
"0.67696637",
"0.6314496",
"0.6136038",
"0.6011622",
"0.5962963",
"0.59599835",
"0.5919544",
"0.5881155",
"0.5841831",
"0.5697509",
"0.56903493",
"0.56503266",
"0.5638059",
"0.561843",
... | 0.73476 | 0 |
Create a mock Frontier Silicon config entry. | def config_entry() -> MockConfigEntry:
return MockConfigEntry(
domain=DOMAIN,
unique_id="mock_radio_id",
data={CONF_WEBFSAPI_URL: "http://1.1.1.1:80/webfsapi", CONF_PIN: "1234"},
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mock_config_entry() -> MockConfigEntry:\n return MockConfigEntry(\n title=\"homeassistant.github\",\n domain=DOMAIN,\n data={CONF_TAILNET: \"homeassistant.github\", CONF_API_KEY: \"tskey-MOCK\"},\n unique_id=\"homeassistant.github\",\n )",
"def mock_config_entry() -> MockCon... | [
"0.7108559",
"0.7077577",
"0.68844694",
"0.67758596",
"0.6705947",
"0.65298116",
"0.64179355",
"0.6396702",
"0.61700094",
"0.6151815",
"0.6086461",
"0.60416204",
"0.60312986",
"0.6007247",
"0.5999427",
"0.5983245",
"0.5959966",
"0.5959883",
"0.59578097",
"0.59496754",
"0.5924... | 0.72320616 | 0 |
Tests if each value in df1 is less than or equal the corresponding value in df2. | def isLessEqual(df1, df2):
indices = list(set(df1.index).intersection(df2.index))
dff1 = df1.loc[indices, :]
dff2 = df2.loc[indices, :]
df = dff1 - dff2
df_tot = df.applymap(lambda v: v <= 0)
result = df_tot.sum().sum() == df.size
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def eq(df1, df2, precision=0.5) -> bool:\n return ((df1 - df2).abs() < precision).all()",
"def check_values_between_two_df(\n df1: pd.DataFrame,\n df1_filename: str,\n df1_id_to_check: str,\n df2: pd.DataFrame,\n df2_filename: str,\n df2_id_to_check: str,\n) -> tuple:\n errors = \"\"\n ... | [
"0.69443727",
"0.6741195",
"0.65760213",
"0.6500689",
"0.64823395",
"0.6424357",
"0.631269",
"0.626798",
"0.6211651",
"0.6206919",
"0.61776984",
"0.6177458",
"0.615301",
"0.6136578",
"0.6131348",
"0.6125575",
"0.6027715",
"0.6015171",
"0.6009877",
"0.5995311",
"0.5970432",
... | 0.76282096 | 0 |
Parse the activation function | def parse_nonlin(nonlin_key):
nonlin_map = dict(relu=tf.nn.relu,
leaky_relu=U.leaky_relu,
prelu=U.prelu,
elu=tf.nn.elu,
selu=U.selu,
tanh=tf.nn.tanh,
identity=tf.identity)
if nonli... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _activation(self,components,activation):\r\n \r\n if activation == \"ReLU\":\r\n components.append(nn.ReLU())\r\n elif activation == \"Sigmoid\":\r\n components.append(nn.Sigmoid())\r\n else:\r\n raise Exception(\"Invalid activation fn: \"+activation... | [
"0.6743499",
"0.66882205",
"0.6623978",
"0.6606778",
"0.65548074",
"0.65427893",
"0.65065235",
"0.6484246",
"0.645754",
"0.64434254",
"0.63390094",
"0.6314726",
"0.62277126",
"0.61801785",
"0.615945",
"0.61255455",
"0.6078174",
"0.6069059",
"0.6058174",
"0.6057722",
"0.604052... | 0.0 | -1 |
Stack the fullyconnected layers Note that according to the paper 'Parameter Space Noise for Exploration', layer normalization should only be used for the fullyconnected part of the network. | def stack_fc_layers(self, embedding):
for hid_layer_index, hid_width in enumerate(self.hps.hid_widths, start=1):
hid_layer_id = "fc{}".format(hid_layer_index)
# Add hidden layer
embedding = snt.Linear(output_size=hid_width, name=hid_layer_id,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stack(self):\n # Fetch the zeroth layer data, which is the original input\n \tdata = self.data_container[0]\n # Initialize network that will contain the stack\n \tself.init_stacked_net(data)\n # Add the weights layer by layer from the individual networks.\n \t# The weights contain... | [
"0.69056445",
"0.6279499",
"0.6076502",
"0.5987528",
"0.5942274",
"0.59197885",
"0.5919048",
"0.59139645",
"0.5906133",
"0.5894325",
"0.5890189",
"0.5882989",
"0.5821994",
"0.58091915",
"0.578582",
"0.5778693",
"0.576663",
"0.5766626",
"0.5763617",
"0.5753908",
"0.5743952",
... | 0.5398385 | 84 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, InstanceCreate):
return False
return self.__dict__ == other.__dict__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.845611",
"0.8391477",
"0.8144138",
"0.81410587",
"0.8132492",
"0.8093973",
"0.80920255",
"0.80920255",
"0.80920255",
"0.8085325",
"0.8085325",
"0.8076365",
"0.8076365",
"0.8065748"
] | 0.0 | -1 |
Reads and returns content from a file. Read file line by line and concatenate them | def read_from_file(filename):
with open(filename, 'r') as f:
lines = [line for line in f]
return "".join(lines) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_file(file_path):\n\n text = ''\n with open(file_path, 'r') as file:\n for line in file.readlines():\n text += line\n return text",
"def read_file(file_path):\n\n file_string = ''\n\n with open(file_path, 'r', newline='') as file:\n for line in ... | [
"0.70576936",
"0.70480853",
"0.69094455",
"0.68835706",
"0.6851682",
"0.6814471",
"0.675316",
"0.67309034",
"0.6658743",
"0.6614293",
"0.6605905",
"0.65617156",
"0.6528099",
"0.6523903",
"0.6517595",
"0.6508807",
"0.6494855",
"0.6461153",
"0.64544773",
"0.6446512",
"0.6443949... | 0.6378177 | 28 |
This method checks to see if the incoming C{SOM} object and the current one are equal. | def __eq__(self, other):
try:
if self.__title__ != other.getTitle():
return False
if self.__y_units__ != other.getYUnits():
return False
if self.__y_label__ != other.getYLabel():
return False
if self.__data_set_ty... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n if not isinstance(other, SMS):\n return False\n\n return self.to_dict() == other.to_dict()",
"def __eq__(self, other):\n if not isinstance(other, SendMmsRequest):\n return False\n\n return self.__dict__ == other.__dict__",
"def __eq__... | [
"0.6799237",
"0.6766977",
"0.65409577",
"0.6529021",
"0.6481254",
"0.6464786",
"0.6446741",
"0.63772464",
"0.63771963",
"0.6357874",
"0.6314697",
"0.62996596",
"0.629853",
"0.6283853",
"0.62426305",
"0.6231216",
"0.6222776",
"0.62164736",
"0.62100697",
"0.6208551",
"0.6205604... | 0.0 | -1 |
This method checks to see if the incoming C{SOM} object and the current one are not equal. | def __ne__(self, other):
return not self.__eq__(other) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other):\n if not isinstance(other, SMS):\n return True\n\n return self.to_dict() != other.to_dict()",
"def __ne__(self, other):\n if not isinstance(other, SolidSimulationControl):\n return True\n\n return self.to_dict() != other.to_dict()",
"de... | [
"0.72073424",
"0.6760201",
"0.67230237",
"0.66548544",
"0.6651343",
"0.6631241",
"0.653959",
"0.6532832",
"0.65041995",
"0.650279",
"0.65019786",
"0.6485212",
"0.648408",
"0.64627445",
"0.6444931",
"0.6439849",
"0.643268",
"0.63708925",
"0.6343264",
"0.63253146",
"0.6320866",... | 0.0 | -1 |
This method returns the axis index (starting from zero) according to the units requested. | def axisUnitsAt(self, units):
return self.__axis_units__.index(units) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def axis_index(self, key):\n for i, name in enumerate(self.axis_labels):\n if name == key:\n return i\n raise ValueError(f'Axis not found: {key}')",
"def i_index(self, coord):\n return coord + 1 if coord + 1 > self.dimensions - 1 else 0",
"def get_axis(self, axis)... | [
"0.7077374",
"0.6839654",
"0.6826188",
"0.6659438",
"0.658922",
"0.65456146",
"0.6489325",
"0.6420881",
"0.6358632",
"0.63059896",
"0.6296557",
"0.6280481",
"0.6249501",
"0.6176344",
"0.61601216",
"0.61466664",
"0.6131482",
"0.6107644",
"0.6103854",
"0.6101671",
"0.6060056",
... | 0.7851199 | 0 |
This method returns the independent axis units at the requested index. | def getAxisUnits(self, dim=0):
return self.__axis_units__[dim] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def axisUnitsAt(self, units):\n return self.__axis_units__.index(units)",
"def axis_units(self):\n return self._axis_units",
"def default_units(x, axis):\n return getattr(x, 'units', None)",
"def axis(ind):\n return ind % 15, ind // 15",
"def getAllAxisUnits(self):\n import c... | [
"0.7280665",
"0.67814726",
"0.6281341",
"0.60555446",
"0.60019284",
"0.5998678",
"0.5973304",
"0.5960795",
"0.59310365",
"0.5914087",
"0.58959544",
"0.58672315",
"0.58649457",
"0.5862845",
"0.5853847",
"0.5801113",
"0.57252026",
"0.5703387",
"0.5679284",
"0.5678495",
"0.56655... | 0.72826463 | 0 |
This method returns the dependent axis units. | def getYUnits(self):
return self.__y_units__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def axis_units(self):\n return self._axis_units",
"def getAxisUnits(self, dim=0): \n return self.__axis_units__[dim]",
"def unit_of_measurement(self):\n return self.var_units",
"def unit_of_measurement(self):\n return self._var_unit",
"def unit_of_measurement(self):\n ... | [
"0.8158286",
"0.80748844",
"0.7308062",
"0.69652015",
"0.69652015",
"0.68754274",
"0.68653375",
"0.6760091",
"0.6737389",
"0.6737389",
"0.66689086",
"0.66575116",
"0.6615102",
"0.65640587",
"0.65431285",
"0.65415883",
"0.65258855",
"0.6524156",
"0.65214235",
"0.6492006",
"0.6... | 0.68908787 | 5 |
Evaluates the Recall considering only the positions up to k | def recall_at_k(self, positions, k, num_samples):
return 1.0 * sum(i <= k for i in positions) / num_samples | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def recall(gt, pred, k):\n k = min(len(pred), k)\n return sum([int(pred[i] in gt) for i in range(k)]) / len(gt)",
"def get_recall(self, k=None):\n k = 1 if k is None else k\n recalls = []\n \n for query, answer in tqdm(zip(self.test_queries, self.results)):\n ... | [
"0.77255607",
"0.73972607",
"0.72423667",
"0.71741813",
"0.712174",
"0.7052004",
"0.7042011",
"0.70346326",
"0.6906476",
"0.68408525",
"0.68034136",
"0.67937416",
"0.6774128",
"0.6773185",
"0.66638553",
"0.66242826",
"0.66134137",
"0.6470345",
"0.6446569",
"0.63866365",
"0.63... | 0.8341324 | 0 |
Add a department to the database | def add_department():
check_admin()
add_department = True
form = DepartmentForm()
if form.validate_on_submit():
department = Department(name=form.name.data,
description=form.description.data)
try:
# add department to the database
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _insert_department(self):\n # Insert\n if db_department.idx_department_exists(1) is False:\n record = Department(\n code=general.encode(self.reserved),\n name=general.encode(self.reserved))\n database = db.Database()\n database.add(re... | [
"0.83917457",
"0.8117929",
"0.8051524",
"0.793637",
"0.78954226",
"0.73722005",
"0.67043567",
"0.65912306",
"0.65847",
"0.6556103",
"0.652952",
"0.6419693",
"0.6419693",
"0.6350818",
"0.629756",
"0.62789965",
"0.62106425",
"0.6005441",
"0.5967767",
"0.5939432",
"0.5909814",
... | 0.80200076 | 3 |
Returns whether this Task is cached or not. | def cached(self, args) -> bool:
return all([art.built for art in self.artifacts]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_cached(self):\n return False",
"def has_cache(self):\n try:\n cache = self.get_cache()\n return True\n except (KeyError, AttributeError):\n return False",
"def is_cached(self):\n if self.should_persist:\n # If our value is persistab... | [
"0.80735415",
"0.77579343",
"0.7723036",
"0.74244744",
"0.7222952",
"0.70983016",
"0.70923585",
"0.7008339",
"0.69545656",
"0.6893437",
"0.6879189",
"0.6814287",
"0.68024516",
"0.6711287",
"0.66985023",
"0.65845",
"0.65685356",
"0.65315366",
"0.65106106",
"0.6505485",
"0.6411... | 0.6252107 | 26 |
Constructor method. Takes in the API_KEY and checks for pagination | def __init__(self, api_key, query, query_base, version=None):
if not version:
version = 1
self.api_key = api_key
self.offset = constants.OFFSET
self.query = query
self.QUERY_URL = query_base
self.version = version | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, api_key=None):\n self.api_key = api_key",
"def __init__(self, api_key: str):\n self.api_key = api_key",
"def __init__(self, api_key):\r\n self.api_key = api_key",
"def __init__(self, api_key):\n self._api_key = api_key\n self._get_params = urllib.urlencod... | [
"0.7344335",
"0.72938865",
"0.7255271",
"0.70139146",
"0.6993064",
"0.6897074",
"0.68755317",
"0.68524563",
"0.6839125",
"0.6837949",
"0.67394197",
"0.6738792",
"0.6714845",
"0.66816974",
"0.66709036",
"0.66433716",
"0.66258657",
"0.6594246",
"0.65829545",
"0.6579209",
"0.655... | 0.6929771 | 5 |
Default Constructor for making object for api_key. | def __init__(self,
query,
api_key,
version=None):
if not version:
version = 1
PyBingSearch.__init__(self,
api_key=api_key,
query=query,
query_base=self... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, api_key=None):\n self.api_key = api_key",
"def __init__(self, api_key: str):\n self.api_key = api_key",
"def __init__(self, api_key):\r\n self.api_key = api_key",
"def __init__(self, key=None):\n self._key = key or os.environ['HERE_API_KEY']",
"def __init__(se... | [
"0.8742466",
"0.8703815",
"0.8605051",
"0.83497334",
"0.82548773",
"0.8029223",
"0.7863644",
"0.7863153",
"0.78603566",
"0.7784199",
"0.773615",
"0.7723763",
"0.7700769",
"0.7694201",
"0.7682376",
"0.7660426",
"0.7646975",
"0.7646176",
"0.7551285",
"0.753317",
"0.75245863",
... | 0.0 | -1 |
creates a square board based on the given board size | def create_board(board_size):
board = []
for i in range(board_size):
row = []
for j in range(board_size):
row.append('-')
board.append(row)
return board | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_chessboard(size=8):\n r1 = (WHITE + BLACK) * int((size / 2)) + \"\\n\"\n r2 = (BLACK + WHITE) * int((size / 2)) + \"\\n\"\n print((r1 + r2) * int((size / 2)))",
"def create_board(self, size):\n x = np.arange(0, size[0])\n y = np.arange(0, size[1])\n board = np.meshgrid(x,... | [
"0.7995761",
"0.790709",
"0.7600666",
"0.7598976",
"0.7494759",
"0.7443021",
"0.73594",
"0.7335968",
"0.7320766",
"0.72792345",
"0.71627986",
"0.71050584",
"0.7075894",
"0.70658535",
"0.69794375",
"0.6965641",
"0.6932644",
"0.6921889",
"0.68566453",
"0.6846962",
"0.6843766",
... | 0.7857048 | 2 |
Convert the serialized representation (a string representation of a list of strings) to a proper list. | def validate(cls, value):
if isinstance(value, str):
value = json.loads(value)
# For some reason the NetBox JSON export renders an ArrayField of integers as a list of strings,
# which makes Nautobot unhappy when it tries to import them. Try to fix it up if appropriate:
try:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _decode_as_serialized_example_list(self, serialized):\n return _decode_as_serialized_example_list(serialized)",
"def _convert_str_to_list(cls, v: Union[List[str], str]) -> List[str]:\n if isinstance(v, str):\n return v.split(\",\")\n return v # cov: ignore",
"def _to_serialize_... | [
"0.7495068",
"0.726814",
"0.7157261",
"0.6962899",
"0.6950877",
"0.69139576",
"0.6909117",
"0.68924606",
"0.6857784",
"0.68331903",
"0.6693741",
"0.66695076",
"0.6661835",
"0.666121",
"0.66278154",
"0.66080415",
"0.6501439",
"0.6493287",
"0.6490544",
"0.64656717",
"0.6452822"... | 0.0 | -1 |
Convert the JSON dictionary read from the JSON to create a Transect object | def parse_config(self, json_dict):
self.Checked = json_dict['Checked']
self.Files = json_dict['Files']
self.Notes = json_dict['Notes']
self.field_config = json_dict['field_config']
self.active_config = json_dict['active_config']
self.moving_bed_type = json_dict['moving_be... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build(http_client, video_id, captions_json):\n translation_languages = [\n {\n 'language': translation_language['languageName']['simpleText'],\n 'language_code': translation_language['languageCode'],\n } for translation_language in captions_json['trans... | [
"0.58459765",
"0.56957835",
"0.5579733",
"0.54493576",
"0.5416974",
"0.5406986",
"0.5322988",
"0.53040296",
"0.5289294",
"0.52866656",
"0.52866656",
"0.5273284",
"0.5271602",
"0.52619547",
"0.5252543",
"0.5249552",
"0.5234681",
"0.5232338",
"0.5231818",
"0.5212274",
"0.521224... | 0.0 | -1 |
check if the string is valid url or not. | def url_validator(url: str) -> bool:
import re
regex = re.compile(
r'^(?:http|ftp)s?://'
r'(?:(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\.)+(?:[A-Z]{2,6}\.?|[A-Z0-9-]{2,}\.?)|'
r'localhost|'
r'\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})'
r'(?::\d+)?'
r'(?:/?|[/?]\S+)$', re.I... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def IsValidURL(s):\n return RE_COMPLEX_URL.match(s)",
"def _is_url(string):\n return \"http\" in string",
"def is_url(string):\n try:\n urlparse(string)\n return True\n except:\n return False",
"def check_url(value):\n\n valid = validators.url(value)\n if valid != True:\n... | [
"0.83493805",
"0.829777",
"0.8290866",
"0.8185718",
"0.8159511",
"0.81511474",
"0.8051757",
"0.80110717",
"0.7957243",
"0.79107875",
"0.79100573",
"0.7890186",
"0.7862742",
"0.78447884",
"0.7835327",
"0.7827582",
"0.7820345",
"0.7815985",
"0.7785493",
"0.77805036",
"0.7776134... | 0.7788281 | 18 |
Sets the learning rate | def adjust_learning_rate(optimizer, epoch, config):
if config.cos:
lr_min = 0
lr_max = config.lr
lr = lr_min + 0.5 * (lr_max - lr_min) * (1 + math.cos(epoch / config.num_epochs * 3.1415926535))
else:
epoch = epoch + 1
if epoch <= 5:
lr = config.lr * epoch / 5
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_learning_rate(self, rate):\n self.SGD.set_learning_rate(rate)",
"def adjust_lr(self):\n learning_rate = self.params.base_lr * (1 - float(self.epoch) / self.params.num_epoch) ** self.params.power\n for param_group in self.opt.param_groups:\n param_group['lr'] = learning_rat... | [
"0.8623272",
"0.76981455",
"0.7697208",
"0.7697208",
"0.7636927",
"0.758479",
"0.7572249",
"0.7514606",
"0.7490861",
"0.74744666",
"0.74288964",
"0.7413075",
"0.739503",
"0.73916996",
"0.73894364",
"0.73817927",
"0.73783433",
"0.7377333",
"0.7363047",
"0.7362884",
"0.7362884"... | 0.0 | -1 |
Creates the message attribute based on the response. | def _process_message(self, response):
message = str()
try:
message = response.json()
except (simplejson.JSONDecodeError, ValueError) as e:
message = response.text
return message | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_response(command, metadata=None):\n resp = Message()\n resp.set_field(MessageKeys.response_key, command)\n if metadata is not None:\n for key, value in metadata.items():\n resp.set_field(key, value)\n return resp",
"def fromResponseObj(self, res):\... | [
"0.60377336",
"0.5895502",
"0.58826375",
"0.58530945",
"0.5830267",
"0.57759804",
"0.57572377",
"0.57217735",
"0.5692963",
"0.55894756",
"0.55728406",
"0.5554598",
"0.5532163",
"0.5499344",
"0.54886436",
"0.5465413",
"0.54603493",
"0.54582524",
"0.54222715",
"0.54056126",
"0.... | 0.5953219 | 1 |
Sets the symbol_code of this SymbolCandidate. | def symbol_code(self, symbol_code):
if self.local_vars_configuration.client_side_validation and symbol_code is None: # noqa: E501
raise ValueError("Invalid value for `symbol_code`, must not be `None`") # noqa: E501
self._symbol_code = symbol_code | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_symbol(self, symbol):\r\n self.symbol = symbol",
"def code(self, code):\n\n self._code = code",
"def symbol(self, symbol):\n\n self._symbol = symbol",
"def symbol(self, symbol):\n self._symbol = symbol",
"def code(self, code: str):\n\n self._code = code",
"def c... | [
"0.6762248",
"0.6558887",
"0.65057904",
"0.647104",
"0.6409073",
"0.6310283",
"0.6188744",
"0.60864574",
"0.6011036",
"0.6011036",
"0.59343654",
"0.5933789",
"0.59135896",
"0.58941424",
"0.5889174",
"0.5845236",
"0.5841956",
"0.5815513",
"0.5815513",
"0.5781468",
"0.5768931",... | 0.7600774 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, SymbolCandidate):
return False
return self.to_dict() == other.to_dict() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8089139",
"0.8089139",
"0.8054507",
"0.79827213",
"0.79669285",
"0.79669285",
"0.79669285",
"0.79669285",
"0.79669285",
"0.79669285",
"0.79669285",
"0.79669285",
"0.79669285",
"0.79669285",
"0.79669285",
"0.79669285",
"0.79669285",
"0.79669285",
"0.79669285",
"0.79669285",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
if not isinstance(other, SymbolCandidate):
return True
return self.to_dict() != other.to_dict() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.845611",
"0.8391477",
"0.8144138",
"0.81410587",
"0.8132492",
"0.8093973",
"0.80920255",
"0.80920255",
"0.80920255",
"0.8085325",
"0.8085325",
"0.8076365",
"0.8076365",
"0.8065748",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
... | 0.0 | -1 |
returns datestart_date in days | def date_to_days(self, date):
date = str_to_date(date)
return (date-self.start_date).days | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def DAYS(end_date, start_date):\n return (_make_datetime(end_date) - _make_datetime(start_date)).days",
"def DAYS(\n end_date: func_xltypes.XlDateTime,\n start_date: func_xltypes.XlDateTime\n) -> func_xltypes.XlNumber:\n\n days = end_date - start_date\n return days",
"def compute_days(star... | [
"0.74452615",
"0.7435405",
"0.7269126",
"0.7129492",
"0.6998247",
"0.6609907",
"0.64696336",
"0.64599645",
"0.64296323",
"0.64186394",
"0.64186394",
"0.63620853",
"0.6269298",
"0.6258548",
"0.6250662",
"0.6224007",
"0.62133455",
"0.61942935",
"0.61296016",
"0.6115954",
"0.609... | 0.70379543 | 4 |
r""" Superclass for vehicle kinematic models | def __init__(self, covar=None, speed_max=np.inf, accel_max=np.inf, x0=[0, 0, 0], dt=0.1,
control=None, seed=0, animation=None, verbose=False, plot=False, workspace=None,
polygon=None):
self._V = covar
self._dt = dt
if x0 is None:
x0 = np.zeros((3,),... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _setup_kinematics(self):\n self.kin = Kinematics(robot_name=self.robot_name,\n offset=self.offset,\n active_joint_names=self.get_actuated_joint_names(),\n base_name=\"\", \n eef_name=None,... | [
"0.6776493",
"0.5989094",
"0.59333044",
"0.59258103",
"0.5912606",
"0.5899394",
"0.5879838",
"0.5810087",
"0.5779373",
"0.57603896",
"0.5753042",
"0.57503027",
"0.57376975",
"0.5718553",
"0.5680851",
"0.56744605",
"0.56604666",
"0.56576127",
"0.56424695",
"0.56381726",
"0.563... | 0.0 | -1 |
Evaluate the acquisition function at point x2. | def eval(self, x, asscalar: bool = False):
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def evaluate(x,a,b,c,k1,k2,f1,f2):\n return a * np.sin(k1 * x - f1) + b * np.cos(k2 * x - f2) + c",
"def evaluate(self, X1, X2):\r\n raise NotImplementedError()",
"def eval(self, x):\n self.__check_input__(x)\n x1 = x[0]\n x2 = x[1]\n\n t = 1 / (8 * np.pi)\n s = 10\... | [
"0.66268396",
"0.62594754",
"0.62067944",
"0.6204449",
"0.62010074",
"0.6192244",
"0.6136045",
"0.61352307",
"0.6050135",
"0.6035992",
"0.5984323",
"0.59726536",
"0.5929253",
"0.5875225",
"0.58457315",
"0.58006036",
"0.57449436",
"0.57428414",
"0.57401896",
"0.57138294",
"0.5... | 0.0 | -1 |
Returns the state of the runner. | def get_state(self):
return {
"epoch": self.epoch,
"weights": self.model.get_weights(),
"optimizer_weights": self.model.optimizer.get_weights()
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def state(self):\n result = self.getResult()\n return result.state",
"def state(self) -> RunState:\n return self._async_scheduler.state",
"def return_state(self):\n\t\treturn self.state",
"def get_state(self):\n return self.state",
"def get_state(self):\n return self.sta... | [
"0.7453783",
"0.74372184",
"0.73520356",
"0.7281599",
"0.7281599",
"0.7224867",
"0.7222292",
"0.717699",
"0.71600735",
"0.7150481",
"0.71002704",
"0.71002704",
"0.71002704",
"0.71002704",
"0.71002704",
"0.70911217",
"0.7081832",
"0.7081832",
"0.7081832",
"0.7081832",
"0.70818... | 0.0 | -1 |
Adds an edge to the DNA graph, ensuring internal consistency. The parameters are decided by Addedgemutaion in Mutation.py | def add_edge(self,from_vertex_id, to_vertex_id, edge_type, edge_id):
# ‘EdgeProto‘ defines defaults for other attributes.
old_edge = 0
for old_edge_id in self.vertex[from_vertex_id].edge_out:
if self.edge[old_edge_id].type != 'skip_connection':
old_edge = old_edge_id... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def addEdge(self, e):\n v = e.either()\n w = e.other(v)\n self._validateVertex(v)\n self._validateVertex(w)\n self._adj[v].add(e)\n self._adj[w].add(e)\n self._E += 1",
"def add_edge(self, ed):\n self.edge.append(ed)\n self.update_node2edge()",
"def add_edge(self, e):\n ... | [
"0.8065523",
"0.78206015",
"0.76603293",
"0.7592885",
"0.75287724",
"0.7509822",
"0.75054026",
"0.7474146",
"0.74489087",
"0.74380153",
"0.7426118",
"0.7359986",
"0.7334075",
"0.73294",
"0.72735745",
"0.7266807",
"0.7212856",
"0.7209414",
"0.7196098",
"0.7187647",
"0.71612203... | 0.66164345 | 56 |
Removes candidate ngrams (w1, w2, ...) where fn(w1, w2, ...) evaluates to True. | def apply_ngram_filter(self, fn):
self._apply_filter(lambda ng, f: fn(*ng)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _apply_filter(self, fn=lambda ngram, freq: False):\n tmp_ngram = FreqDist()\n for ngram, freq in self.ngram_fd.items():\n if not fn(ngram, freq):\n tmp_ngram[ngram] = freq\n self.ngram_fd = tmp_ngram",
"def filter_ngram(gram, mode='any'):\n filtered = [filter... | [
"0.64064026",
"0.6303353",
"0.61998063",
"0.6183854",
"0.6064118",
"0.56299466",
"0.5586825",
"0.55768436",
"0.55135435",
"0.5494307",
"0.5439604",
"0.54166514",
"0.54082793",
"0.5406111",
"0.53745043",
"0.53483343",
"0.53462416",
"0.5325527",
"0.53063947",
"0.527616",
"0.526... | 0.6418857 | 0 |
Removes candidate ngrams (w1, w2, ...) where any of (fn(w1), fn(w2), ...) evaluates to True. | def apply_word_filter(self, fn):
self._apply_filter(lambda ng, f: any(fn(w) for w in ng)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _apply_filter(self, fn=lambda ngram, freq: False):\n tmp_ngram = FreqDist()\n for ngram, freq in self.ngram_fd.items():\n if not fn(ngram, freq):\n tmp_ngram[ngram] = freq\n self.ngram_fd = tmp_ngram",
"def filter_ngram(gram, mode='any'):\n filtered = [filter... | [
"0.6539081",
"0.647983",
"0.6367641",
"0.60508466",
"0.5864387",
"0.5747846",
"0.558654",
"0.55380565",
"0.5481948",
"0.53660595",
"0.536599",
"0.53564006",
"0.5345199",
"0.53380173",
"0.5310486",
"0.53046274",
"0.5244571",
"0.5122952",
"0.51200783",
"0.5114794",
"0.51072556"... | 0.61361116 | 3 |
Convert a console style definition in to dictionary >>> style("bold red on yellow") {fg="red", bg="yellow", bold=True} | def style(style_def):
if not style_def:
return {}
if isinstance(style_def, dict):
return style_def
colors = {"yellow", "magenta", "green", "cyan", "blue", "red", "black", "white"}
text_styles = {"bold", "underline", "dim", "reverse", "italic"}
style = {}
foreground = True
sty... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stylecrunch(stystr):\n return dict(pair.split(\":\") for pair in semicolons.findall(stystr))",
"def get_highlighted_style(feature):\r\n\r\n return {\"weight\": 3, \"color\": \"black\"}",
"def get_pygments_style_colors(\n style: Style, *, fallbacks: Dict[str, str]\n) -> Dict[str, str]:\n backgro... | [
"0.670434",
"0.6333383",
"0.62597114",
"0.62559277",
"0.6231482",
"0.6217498",
"0.61554664",
"0.6078599",
"0.5907675",
"0.5893134",
"0.58881134",
"0.588212",
"0.5854403",
"0.5825276",
"0.5782361",
"0.5760383",
"0.57275546",
"0.5723121",
"0.5711178",
"0.56827",
"0.5656543",
... | 0.7909697 | 0 |
updates attribute updated_at with current datetime | def save(self):
self.updated_at = datetime.now()
storage.save() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def updated_at(self, updated_at: \"datetime\"):\n self._attrs[\"updatedAt\"] = updated_at",
"def updated_at(self, updated_at: \"datetime\"):\n self._attrs[\"updatedAt\"] = updated_at",
"def updated_at(self, updated_at: \"datetime\"):\n self._attrs[\"updatedAt\"] = updated_at",
"def save(... | [
"0.79943717",
"0.79943717",
"0.79943717",
"0.7572639",
"0.7375303",
"0.73075455",
"0.73075455",
"0.73075455",
"0.73075455",
"0.73075455",
"0.73075455",
"0.73075455",
"0.73075455",
"0.73075455",
"0.73075455",
"0.71766967",
"0.71766967",
"0.71766967",
"0.70862526",
"0.70429164",
... | 0.0 | -1 |
Overload the == operator | def __eq__(self, other):
if isinstance(other, self.__class__):
return (self.index == other.index) and \
(self.inUse == other.inUse) and \
(self.type == other.type) and \
(self.previousBlock == other.previousBlock) and \
(sel... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self,*args):\r\n pass",
"def __eq__(self,*args):\r\n pass",
"def __eq__(self,*args):\r\n pass",
"def __eq__(self,*args):\r\n pass",
"def __eq__(self,*args):\r\n pass",
"def __eq__(self,*args):\r\n pass",
"def __eq__(self,*args):\r\n pass",
"def __eq__(self,*args):\r\n pass",
"def... | [
"0.8195402",
"0.8195402",
"0.8195402",
"0.8195402",
"0.8195402",
"0.8195402",
"0.8195402",
"0.8195402",
"0.8195402",
"0.8195402",
"0.8195402",
"0.8195402",
"0.8195402",
"0.8195402",
"0.8195402",
"0.8195402",
"0.8195402",
"0.8195402",
"0.8195402",
"0.8195402",
"0.81455725",
... | 0.0 | -1 |
Overload the != operator | def __ne__(self, other):
return not (self == other) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self,other):\n return not self == other",
"def __ne__(self,other):\n return not (self == other)",
"def __ne__(self, other):\n return not (self == other) # opposite of __eq__",
"def __ne__(self, rhs):\n return not self.__eq__(rhs)",
"def __ne__(self, other... | [
"0.8450266",
"0.8434181",
"0.84323186",
"0.83849907",
"0.83651286",
"0.835894",
"0.83410984",
"0.83377224",
"0.8336225",
"0.8335426",
"0.8335426",
"0.83323336",
"0.8332294",
"0.8332294",
"0.8331674",
"0.8331674",
"0.8331674",
"0.8331674",
"0.83269113",
"0.83269113",
"0.832691... | 0.0 | -1 |
Returns whether this is a string array | def is_string_array(self):
return self.type == Property.PropertyType.stringArray | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _is_string(data):\n return len(data) and isinstance(_to_ndarray(data).flat[0], str)",
"def _is_unicode(arr):\n if (isinstance(arr, str) or\n issubclass(numpy.asarray(arr).dtype.type, str)):\n return True\n return False",
"def is_array(self):\n return False",
"def is_arra... | [
"0.7596771",
"0.7394874",
"0.7375554",
"0.7188314",
"0.707607",
"0.70332986",
"0.69955224",
"0.68736714",
"0.68241423",
"0.6799083",
"0.6737211",
"0.66763693",
"0.6629048",
"0.66166043",
"0.66062343",
"0.66022825",
"0.65974313",
"0.6571035",
"0.65567243",
"0.65290815",
"0.644... | 0.8737185 | 0 |
Returns pandas dataframe read from table | def load_data(database_filepath):
engine = create_engine('sqlite:///'+database_filepath)
#reading table created in ETL part into pandas dataframe
df = pd.read_sql_table('DisasterResponse',engine)
#setting target variables X and Y
X = df['message'].astype(str)
Y = df.drop(['id', 'm... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def select_from_table(self, table_name):\n sql_str = \"SELECT * FROM {tb}\".format(tb=table_name)\n cur = self.conn.cursor()\n cur.execute(sql_str)\n names = [description[0] for description in cur.description]\n\n rows = cur.fetchall()\n\n df = pd.DataFrame(rows, columns =... | [
"0.7713695",
"0.77110654",
"0.75210553",
"0.74618894",
"0.73402584",
"0.7302775",
"0.71951824",
"0.7174342",
"0.7156873",
"0.7082689",
"0.7017794",
"0.7009743",
"0.70080036",
"0.70044076",
"0.6989976",
"0.6979917",
"0.69756496",
"0.6955611",
"0.6948097",
"0.69366634",
"0.6931... | 0.0 | -1 |
Function convert sentences into tokens, normalizes case,, strip trailing and preceding whitespaces and removes puntuations and stop words | def tokenize(text):
#regular expression to avoid pucntuations or any special character
tokenizer = nltk.RegexpTokenizer(r"\w+")
#tokenizing text
tokens = tokenizer.tokenize(text)
#initiating lemmatizer
lemmatizer = WordNetLemmatizer()
#iteratating through each token
c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def preprocess_sentence(raw):\r\n\t\r\n\t# raw = re.sub(r\"[\\x80-\\xff]\",\" \",raw)\r\n\t\r\n\traw = regex_punct.sub(' ',raw)\r\n\traw = raw.strip()\r\n\traw = raw.lower()\r\n\t\r\n\twords = nltk.word_tokenize(raw)\r\n\twords = [replace_punctuation(w) for w in words if not w in stopwords and len(w) > 1]\r\n\t\r\... | [
"0.73390895",
"0.7319071",
"0.7115878",
"0.7039337",
"0.7035414",
"0.7020504",
"0.6999928",
"0.697498",
"0.69727546",
"0.69724846",
"0.6957662",
"0.6939191",
"0.6902195",
"0.68842185",
"0.6861641",
"0.6859027",
"0.68574774",
"0.68458074",
"0.6834428",
"0.6834428",
"0.68319404... | 0.6674278 | 48 |
Get L{Tag} values that match the filtering criteria defined for this collection. | def values(self):
store = getMainStore()
tagIDs = self._getTagIDs()
where = self._getWhereClause(tagIDs)
return store.find((Tag, TagValue), *where) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_search_tag_values(self, tag_name):\n return self._ruleset[tag_name].keys()",
"def get_tags(self) -> Set[Text]:\r\n return {tag for tag in self.tags}",
"def tag_filters(self) -> typing.Optional[typing.Mapping[str,typing.Any]]:\n return self._values.get('tag_filters')",
"def tag_fi... | [
"0.6696752",
"0.6672744",
"0.66127056",
"0.66127056",
"0.6454556",
"0.63883793",
"0.636721",
"0.6313774",
"0.62909424",
"0.62718517",
"0.6267369",
"0.624273",
"0.6239966",
"0.62250704",
"0.6211067",
"0.6204095",
"0.6204095",
"0.6204095",
"0.6204095",
"0.6204095",
"0.6204095",... | 0.7082022 | 0 |
init the dictionary object | def init(sFileName, sDescription):
try:
with open(sFileName) as f:
my_dict = json.load(f)
except:
#assume there was an error, possibly the file does not exist
my_dict = {'descriptor':sDescription ,'measurements':[]}
with open (sFileName, 'w') a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\r\n self.dic={}",
"def __init__(self):\n self.dic = {}",
"def __init__(self):\n self.dic = {}",
"def __init__(self, dict):\n self.dict = dict",
"def __init__(self, dict):\n self.dict = dict",
"def __init__(self):\n self.dict = {}",
"def __in... | [
"0.82029593",
"0.8142897",
"0.8142897",
"0.81194806",
"0.81194806",
"0.808661",
"0.808661",
"0.79071206",
"0.7798403",
"0.77607864",
"0.77403873",
"0.77403873",
"0.77403873",
"0.77403873",
"0.7704517",
"0.7675323",
"0.7603196",
"0.75984395",
"0.756247",
"0.755479",
"0.7547568... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.