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 |
|---|---|---|---|---|---|---|
Get paths of all files in `path` with s3 prefix, which can be passed to Spark. | def get_path(self, path=''):
if not self.bucket:
raise Exception('no bucket is opened.')
path = path.strip()
if len(path) and path[0] == '/':
path = path[1:]
files = self.bucket.list(prefix=path)
prefix = "s3n://%s/" % self.bucket_name
return [pre... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ls_s3(self, path=''):\n if not self.bucket:\n raise Exception('No bucket is opened. '\n 'Please use open_bucket method first.')\n\n path = path.strip()\n if len(path) and path[0] == '/':\n path = path[1:]\n files = self.bucket.list(pr... | [
"0.7563313",
"0.7014275",
"0.7014007",
"0.69258434",
"0.6762931",
"0.6517002",
"0.6289149",
"0.6219844",
"0.62038857",
"0.61895585",
"0.6178326",
"0.6169268",
"0.61263037",
"0.6121393",
"0.61162996",
"0.6098097",
"0.6084092",
"0.60785997",
"0.6067679",
"0.605728",
"0.6040515"... | 0.7834092 | 0 |
r""" Load the PyTorch model for the encoder specified in args. If pretrained_encoder, load the checkpoint of the encoder saved after trainin for reconstruction (pretrain_encoder.py). If test, load the state dictionary from checkpoint. Create optimizer for the encoder. | def load_encoder(args):
if args.encoder == "EncoderCNNAtt":
if args.all_history:
encoder = CNNEncoderAtt(adj_size=args.max_prev_node * args.max_n_nodes, coord_size=2 * args.max_n_nodes)
else:
encoder = CNNEncoderAtt()
if not args.is_test and args.pretrained_encoder:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_checkpoint(path: str,\n cuda: bool = False,\n get_scaler: bool = False,\n get_args: bool = False,\n num_tasks: int = None,\n dataset_type: str = None,\n encoder_only: bool = False,\n ... | [
"0.6732859",
"0.6423775",
"0.6345794",
"0.6256984",
"0.6169624",
"0.616854",
"0.61288655",
"0.6111171",
"0.6054828",
"0.60357535",
"0.6019535",
"0.6004252",
"0.6004125",
"0.59950316",
"0.5979214",
"0.5975179",
"0.5974464",
"0.5973202",
"0.59601074",
"0.5914177",
"0.5897398",
... | 0.77258134 | 0 |
r""" Load the PyTorch model for the decoder specified in args. If test, load the state dictionary from checkpoint. Create optimizer for the decoder. | def load_decoder(args):
if args.decoder == "DecoderGRU":
decoder = DecoderGRU(d_model=args.d_model, n_hidden=args.n_hidden, dropout=args.dropout,
adj_size=args.max_prev_node, coord_size=2, visual_size=args.features_dim)
elif args.decoder == "DecoderGRUAtt":
decoder =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_checkpoint(path: str,\n cuda: bool = False,\n get_scaler: bool = False,\n get_args: bool = False,\n num_tasks: int = None,\n dataset_type: str = None,\n encoder_only: bool = False,\n ... | [
"0.68290025",
"0.66835207",
"0.654203",
"0.65292203",
"0.6408195",
"0.6394518",
"0.63638693",
"0.63608646",
"0.6346231",
"0.6290576",
"0.6281665",
"0.6253249",
"0.624998",
"0.6249191",
"0.6225803",
"0.6208064",
"0.61995155",
"0.61915904",
"0.6168606",
"0.6150547",
"0.6143054"... | 0.69988114 | 0 |
Tokenize a chunk of text into sentence tokens. In this method, nonunicode characters will be substituted by similar unicode characters. | def sentence_tokenize(string):
string = string.replace('-\r', '').replace('\r', ' ')
string = string.replace('-\n', '').replace('\n', ' ')
string = ''.join([i if ord(i) < 128 else unidecode(i) for i in string])
string = string.lower()
string = re.sub(' +', ' ', string)
return sent_tokenize(strin... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tokenize(self, sentence):\r\n raise NotImplementedError()",
"def tokenize_sentence(self, text):\n sentence_arr = sent_tokenize(text)\n return sentence_arr",
"def tokenize_sentences(self, text):\n return nltk.tokenize.sent_tokenize(text)",
"def tokenize_sentence(self, sentence)... | [
"0.72573054",
"0.71079606",
"0.6996577",
"0.6988282",
"0.69545496",
"0.69296217",
"0.6900233",
"0.68698555",
"0.6867446",
"0.68529195",
"0.68416595",
"0.684134",
"0.68278635",
"0.6804012",
"0.6803266",
"0.6792064",
"0.6780863",
"0.6774229",
"0.6768077",
"0.67533886",
"0.67479... | 0.6651936 | 25 |
Instantiates the form the class should use to process the search query. | def build_form(self, form_kwargs=None):
data = None
kwargs = {
'load_all': self.load_all,
}
if form_kwargs:
kwargs.update(form_kwargs)
if len(self.request.GET):
data = self.request.GET
if self.searchqueryset is not Non... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search_form(self):\n return SearchForm",
"def search_form(session, client):\n form = SearchForm(query=g.text.word())\n return form",
"def get_form(self, form_class=None):\n\n if form_class is None:\n form_class = self.get_form_class()\n\n datasets = self.request.sessio... | [
"0.7671135",
"0.71277636",
"0.7047862",
"0.6991183",
"0.6978689",
"0.6890365",
"0.68845564",
"0.6834141",
"0.67528224",
"0.66992867",
"0.66277456",
"0.64628273",
"0.6406224",
"0.6389731",
"0.6288819",
"0.6248308",
"0.6212238",
"0.62046087",
"0.62001103",
"0.61515504",
"0.6140... | 0.75104123 | 1 |
Generates a batch iterator for a dataset. | def batch_iter(data, batch_size, num_epochs, shuffle=True):
data = np.array(data)
data_size = len(data)
num_batches_per_epoch = int((len(data)-1)/batch_size) + 1
for epoch in range(num_epochs):
# Shuffle the data at each epoch
if shuffle:
shuffle_indices = np.random.permutati... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def iter_batches(self, dataset, batch_size):\n # TODO batch_size = -1 should yield the entire dataset\n num_batches = int(dataset.num_images / batch_size)\n for cur_batch_num in xrange(num_batches):\n data = dataset.get_next_batch(batch_size)\n fetches, feed_dict = self.p... | [
"0.775265",
"0.760047",
"0.747829",
"0.7429436",
"0.73099685",
"0.72625387",
"0.722453",
"0.7198546",
"0.71628886",
"0.71628886",
"0.71251935",
"0.71040386",
"0.7094916",
"0.70796514",
"0.7046541",
"0.6963296",
"0.69625556",
"0.69355357",
"0.69355357",
"0.68848604",
"0.686806... | 0.0 | -1 |
Search for a book and return its title if found in the library. | def search_book():
book = input("Enter the name of the book you search for: ")
book = book.lower().strip()
if book in books:
print(book.capitalize())
else:
print(f"'{book.capitalize()}' is not found in the library.") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_book(self, title):\n if title in self._books:\n return self._books[title]\n else:\n print(\"{title} not found in {shelf}!\"\n .format(title=title, shelf=self.name))",
"def find_book():\n\n potential_names = [\n os.path.join(me... | [
"0.77847344",
"0.7032433",
"0.6919774",
"0.6885654",
"0.68491036",
"0.6832707",
"0.6806035",
"0.6610352",
"0.6424113",
"0.63823086",
"0.63172567",
"0.62680465",
"0.62624735",
"0.62464255",
"0.6207123",
"0.6163967",
"0.61615264",
"0.61519706",
"0.609867",
"0.6039429",
"0.60337... | 0.77630204 | 1 |
judege n is prime or not. | def is_prime(n):
if n < 2:
return False
if n == 2:
return True
for m in range(2, int(n ** 0.5) + 1):
if (n % m) == 0:
return False
else:
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isprime(n):\n if prime(n):\n return True\n else:\n return False",
"def isprime(n):\n if prime(n):\n return True\n else:\n return False",
"def isprime(n):\n\n m = int(math.floor(n**0.5) + 1)\n \n for i in range(2, m):\n #print('n:', n, 'i:', i, 'n%i:',... | [
"0.7924617",
"0.7924617",
"0.7894159",
"0.7877993",
"0.78535557",
"0.78487974",
"0.78054035",
"0.7801046",
"0.77952105",
"0.77900255",
"0.77833253",
"0.7768687",
"0.77586645",
"0.77334166",
"0.7721457",
"0.77210695",
"0.77145576",
"0.77117413",
"0.7702999",
"0.76840705",
"0.7... | 0.7838685 | 6 |
Smooth a 2D array im by convolving with a Gaussian kernel of size n | def smooth(im, n=15):
from scipy import signal
g = gaussKern(n)
improc = signal.convolve2d(im, g, mode='same', boundary='symm')
return (improc) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _gaussian_filter(self, img):\n kernel = self._gaussian_kernel()\n kernel = self._flip(kernel)\n # print(kernel.shape)\n # print(img.shape)\n dim_y, dim_x = img.shape\n\n ## Pad the image before convolving\n # img = np.pad(img, (3,3), 'edge')\n img = self.... | [
"0.7058994",
"0.6985581",
"0.686277",
"0.677351",
"0.6720614",
"0.6695216",
"0.6671712",
"0.6632464",
"0.66167915",
"0.65423274",
"0.64841586",
"0.64695776",
"0.6463413",
"0.6446843",
"0.64220655",
"0.6307523",
"0.6226583",
"0.6212144",
"0.617295",
"0.61565644",
"0.614697",
... | 0.71929395 | 0 |
Converts a (ra,dec) coordinates to rectangular (x,y,z) coordinates in a sphere of radius r. For ``r=0.5``, this allows to speed up subsecuent haversine distance calculations between two points, by simply computing | def radec2xyz(ra, dec, r=0.5):
r = 0.5
return (r*np.cos(dec)*np.sin(ra), r*np.cos(dec)*np.cos(ra), r*np.sin(dec)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def project_z(r, x, y):\n\td = np.sqrt(x*x + y*y)\n\tif (d < r * 0.70710678118654752440): # Inside sphere\n\t\tz = np.sqrt(r*r - d*d)\n\telse: # On hyperbola\n\t\tt = r / 1.41421356237309504880\n\t\tz = t*t / d\n\treturn z",
"def radec_to_xyz(ra, dec, r=1.):\n cosdec =... | [
"0.7267659",
"0.6826014",
"0.6755563",
"0.64239234",
"0.6346023",
"0.62465197",
"0.6238147",
"0.622342",
"0.6204106",
"0.61849064",
"0.6121192",
"0.6103064",
"0.6081438",
"0.6057067",
"0.6049536",
"0.6037102",
"0.59782416",
"0.5963729",
"0.5927599",
"0.5913483",
"0.59012705",... | 0.6966407 | 1 |
With this test, a token is set to expire every 10 seconds Fetches and prints a token at 2 seconds interval Assert that we get two unique tokens | def token_renew_frequency(self):
until = 10
interval = 2
# get the token that expires in 10 seconds
self.tg = TokenGetter(expires=10)
tokens = []
# check if the token expires properly in set interval and the new toke is successfully fetched after expiry only
for... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_tokenExpires(self):\n clock = task.Clock()\n d = TimedTokenDispenser(expiration=50, store=MemoryStore(clock),\n clock=clock)\n token = yield d.getToken('foo')\n clock.advance(50)\n yield self.assertFailure(d.useToken(token), InvalidToken)",
"def test_regener... | [
"0.76699257",
"0.72842896",
"0.70710194",
"0.70550424",
"0.69333744",
"0.68960696",
"0.6842416",
"0.6835366",
"0.6816014",
"0.6809999",
"0.68075144",
"0.67929524",
"0.6733937",
"0.67259735",
"0.672342",
"0.6704047",
"0.65974593",
"0.65651095",
"0.65191615",
"0.65105826",
"0.6... | 0.7877533 | 0 |
Compute the relative mean pT fluctuation \sqrt{C_m}/M(p_T)_m, defined in | def pT_fluct(events):
N, sum_pT, sum_pTsq = [
events['pT_fluct'][k] for k in
['N', 'sum_pT', 'sum_pTsq']
]
Npairs = .5*N*(N - 1)
M = sum_pT.sum() / N.sum()
# This is equivalent to the sum over pairs in Eq. (2). It may be derived
# by using that, in general,
#
# \sum_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mean_anm(t,T_0,P):\n return 2*np.pi*(t-T_0)/P",
"def compute_mean_dist_pc(self) -> float:\n pc = self.get_o3d()\n pcd_tree = open3d.geometry.KDTreeFlann(pc)\n n_points = len(pc.points)\n total_dist = 0.0\n for i in range(0,n_points):\n p1 = pc.points[i]... | [
"0.68901736",
"0.6589649",
"0.6526352",
"0.63993835",
"0.6366313",
"0.6325968",
"0.62972397",
"0.62457526",
"0.6230931",
"0.6227951",
"0.6217739",
"0.61843103",
"0.6055543",
"0.60034984",
"0.5987709",
"0.59727234",
"0.5970879",
"0.5959629",
"0.59088653",
"0.59042335",
"0.5866... | 0.5822398 | 25 |
Returns the convolutional neural network (CNN/ConvNet) for wordembedded vectors. | def train_cnn(self,
n_gram=2,
num_filters=1200,
max_sentence_len=15,
vec_size=128,
drop_out=0.0,
activation='softmax',
w_l2reg=0.0,
b_l2reg=0.0,
optimizer='adam'
):
self.max_sentence_len = max_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __convolution(self, x, W):\n\n return tf.nn.conv2d(x, W, strides=[1, 1, 1, 1], padding='SAME')",
"def conv_layer(self, input_vector, filters, ksize, padding=\"SAME\", layer_name=\"convolutional_layer\", dilate=1,\n strides=(1, 1), bias_term=False, active=tf.nn.relu, bn=True, regulari... | [
"0.60848665",
"0.57559156",
"0.5734616",
"0.56925446",
"0.56696606",
"0.5652124",
"0.5647858",
"0.5646678",
"0.5639994",
"0.56263244",
"0.5612554",
"0.5605589",
"0.5605589",
"0.5580709",
"0.55461407",
"0.55406016",
"0.55377847",
"0.5536931",
"0.5535659",
"0.5528534",
"0.55285... | 0.0 | -1 |
Returns the twolayer convolutional neural network (CNN/ConvNet) for wordembedded vectors. two layers of CNN, maxpooling, dense Model = Input |> Embeddings |> Conv1D |> Dropout |> Conv1D |> Dropout |> MaxPooling |> Flatten |> Dense |> Optimzer | def train_twolayer_cnn(self,
num_filters_1=1200,
num_filters_2=600,
n_gram=2,
window_size_2=10,
max_sentence_len=15,
vec_size=128,
drop_out_1=0.0,
drop_out_2=0.0,
activation... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_dwconv(dim, kernel_size, bias=True):\n return nn.Conv2d(dim, dim, kernel_size=kernel_size, padding=(kernel_size - 1) // 2, bias=bias, groups=dim)",
"def conv_layer(self, input_vector, filters, ksize, padding=\"SAME\", layer_name=\"convolutional_layer\", dilate=1,\n strides=(1, 1), bi... | [
"0.6400909",
"0.63568956",
"0.63528633",
"0.63255763",
"0.63016945",
"0.6290802",
"0.6283033",
"0.62827134",
"0.6272853",
"0.6272853",
"0.6264262",
"0.6254283",
"0.6242582",
"0.6205178",
"0.6201625",
"0.62004024",
"0.61992604",
"0.6194601",
"0.61783236",
"0.61776084",
"0.6177... | 0.59178686 | 50 |
Add a Child object to the database. Doing so may also require adding a Contact object as well. | def add_or_update_child(self, child):
if type(child) is not Child:
raise TypeError(
"%s != Child: Can only add Child "
"objects to the database as Child objects" % type(child)
)
self.log.info("%s - %s" % (
child.get_field("Case_Number_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add(self, parent: Person, child: Person) -> None:\n self._relations.append((parent, Relationship.PARENT, child))\n self._relations.append((child, Relationship.CHILD, parent))",
"def add_child(self, child):\n self.children.append(child)\n child.parent = self",
"def add(self, chil... | [
"0.70773005",
"0.6872617",
"0.68193644",
"0.6802168",
"0.67940384",
"0.6793565",
"0.6780564",
"0.6771669",
"0.6756932",
"0.6756932",
"0.67479753",
"0.67150515",
"0.6701018",
"0.6701018",
"0.66312647",
"0.66105497",
"0.66010386",
"0.65363085",
"0.6517995",
"0.6508837",
"0.6472... | 0.7348067 | 0 |
Find and return a list of similar contacts, create if missing. | def get_contact(self, contact, create=False):
query = """
SELECT Id,%(fields)s FROM Contact
WHERE (%(name)s) AND (%(mailing)s)
"""
# Fields to return from the query along with the Id
fields = {
'MailingStreet': '',
'MailingCity': '',
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _GatherExistingContacts(self):\r\n self._all_contacts_dict, self._contacts_to_delete = \\\r\n yield FetchContactsOperation._GetAllContactsWithDedup(self._client, self._user_id)\r\n\r\n for contact in self._all_contacts_dict.itervalues():\r\n # Compute total count of present and removed contac... | [
"0.6938385",
"0.65488935",
"0.64410883",
"0.6374903",
"0.632756",
"0.6155942",
"0.60567844",
"0.60343",
"0.5986732",
"0.59734154",
"0.5967731",
"0.59499806",
"0.5882589",
"0.58600557",
"0.5834651",
"0.5782056",
"0.57792825",
"0.5745054",
"0.57102466",
"0.5701219",
"0.56729686... | 0.5666318 | 21 |
Sets the number of people served in the restaurant. | def set_number_served(self, num_served):
# later add conditional to not allow negative numbers
self.number_served = num_served
print("Number served set to " + str(self.number_served) ) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_number_people_served(self,n_served):\n self.number_people_served+=n_served",
"def set_number_served(self, num_customers):\r\n self.number_served = num_customers",
"def set_number_served(self, served):\n\t\tif served >= self.number_served:\n\t\t\tself.number_served = served\n\t\telse:\n\t\t\tp... | [
"0.7411846",
"0.7080733",
"0.70641065",
"0.7031298",
"0.6981485",
"0.69378996",
"0.6894234",
"0.6529872",
"0.65279037",
"0.65153515",
"0.6349716",
"0.6256428",
"0.6235568",
"0.62206274",
"0.6213254",
"0.6187514",
"0.61872584",
"0.61658865",
"0.6148376",
"0.611791",
"0.6059454... | 0.6408226 | 10 |
Append given text as a new line at the end of file | def append_new_line(file_name, text_to_append):
# Open the file in append & read mode ('a+')
with open(file_name, "a+") as file_object:
# Move read cursor to the start of file.
file_object.seek(0)
# If file is not empty then append '\n'
data = file_object.read(100)
if len... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write(path, text, end='\\n'):\n with open(path, 'a+') as f:\n f.write(text)\n f.write(end)",
"def AppendFile(text, filename):\n with open(filename, \"a\") as f:\n f.write(text)\n f.write(\"\\n\")",
"def writeLine(self, text):\n text += '\\n'\n self._f.write(t... | [
"0.81320924",
"0.7958058",
"0.7868384",
"0.76731545",
"0.7665224",
"0.7653859",
"0.76499605",
"0.763712",
"0.7622696",
"0.7622696",
"0.7622696",
"0.7622696",
"0.761104",
"0.7564341",
"0.7561614",
"0.7534451",
"0.7439961",
"0.74281573",
"0.7417431",
"0.73646647",
"0.721976",
... | 0.8052369 | 1 |
Updates the UI text about how large the current group is. | def update_groupsize_txt(self):
if self.idx == None:
return
group = self.get_current_group()
self.txtctrl_num_elements.SetLabel(str(len(group.imgpaths))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_ui_text(self):\n self.update_grouptag_txt()\n self.update_groupsize_txt()\n self.update_header()\n self.update_footer()",
"def get_font_size(self):\r\n while self.font_size > 12:\r\n self.date_label.config(font=(\"SFUIText\", self.font_size, \"bold\"))\r\n... | [
"0.7371415",
"0.6334146",
"0.6171469",
"0.61512285",
"0.5933331",
"0.5928309",
"0.58607537",
"0.57305604",
"0.5727194",
"0.5725678",
"0.56949383",
"0.56566054",
"0.5655699",
"0.5627949",
"0.5616718",
"0.56089383",
"0.55798936",
"0.5566978",
"0.55454403",
"0.5531533",
"0.55221... | 0.8098737 | 0 |
Given a group GROUP, returns a humanreadable string for GROUP. | def get_group_label(self, group):
label = "{0} -> {1} elements".format(str(group.tag), str(len(group.imgpaths)))
return label | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _group_name(cls, group=None):\n prefix = GraphqlWsConsumer.group_name_prefix\n suffix = f\"{cls.__module__}.{cls.__qualname__}\"\n if group is not None:\n suffix += \"-\" + group\n\n # Wrap the suffix into SHA256 to guarantee that the length of\n # the group name i... | [
"0.69257134",
"0.6755878",
"0.6755878",
"0.6755878",
"0.6655984",
"0.66286653",
"0.65838456",
"0.63537735",
"0.6301012",
"0.6195561",
"0.616305",
"0.6124059",
"0.6108337",
"0.6091995",
"0.60599273",
"0.60188746",
"0.6004187",
"0.59667575",
"0.59667575",
"0.5962208",
"0.594989... | 0.6225861 | 9 |
Returns a dictrep of myself. In particular, you can't pickle IplImages, so don't include them. | def marshall(self):
me = {'tag': self.tag,
'imgpaths': self.imgpaths, 'do_align': self.do_align}
return me | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def images(self):\n return self._images.copy()",
"def run(self):\n return {'img': self.img}",
"def to_dict(self):\n return {\n \"img_url\":self.img_url\n }",
"def get_public_images(self):\n return dict((i.id, i) for i in self.glance.images.list()\n ... | [
"0.6268454",
"0.6088157",
"0.59807605",
"0.59439254",
"0.5941762",
"0.59359276",
"0.5846208",
"0.58195585",
"0.58162695",
"0.58127373",
"0.5757627",
"0.573544",
"0.57322943",
"0.57222784",
"0.56951976",
"0.56951976",
"0.56807286",
"0.56611556",
"0.5660826",
"0.5634153",
"0.56... | 0.0 | -1 |
Returns the indices of the leaf node bins into which the values fall. Leaf nodes uniformly partition the [data_low, data_high] range. | def get_leaf_indices(self, values):
range_fracs = (values - self._data_low) / self._range
leaf_indices = np.trunc(range_fracs * self._num_leaves)
high_values = values == self._data_high
leaf_indices[high_values] -= 1
return self._leftmost_leaf_index + leaf_indices | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_bin_edges(self, i_min, i_max):\n x = np.arange(i_min, i_max)\n return np.append(x - 0.5, x[-1] + 0.5) # Bins centred on integers",
"def get_reverse_indices(x, nbins, min_range, max_range):\n bin_edges = np.linspace(min_range, max_range, nbins+1)\n arrays_bin_indices = (float(nbins)/(... | [
"0.6472896",
"0.6430987",
"0.6410883",
"0.6366104",
"0.6352313",
"0.63221985",
"0.6291107",
"0.625927",
"0.6253836",
"0.6201511",
"0.61769885",
"0.61421263",
"0.6106536",
"0.60525775",
"0.60402673",
"0.6030064",
"0.60297185",
"0.6020661",
"0.6011821",
"0.59896445",
"0.5960889... | 0.76122826 | 0 |
Returns the leftmost (lowestnumbered) child of the parent_index node. | def get_leftmost_child(self, parent_index):
return parent_index * self._branching_factor + 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def left_child_index(parent_index: int) -> int:\n return (2 * parent_index) + 1",
"def get_left_child_index(self, parent_index):\r\n\r\n # Remember this is a 1-base index.\r\n if parent_index * 2 > self.length():\r\n # There is no left-child\r\n return False\r\n\r\n ... | [
"0.810826",
"0.8024983",
"0.78987104",
"0.7852992",
"0.75517195",
"0.7544579",
"0.7506507",
"0.74858326",
"0.7440076",
"0.73529774",
"0.7301417",
"0.7230232",
"0.72135776",
"0.7171295",
"0.71273774",
"0.71037257",
"0.70841867",
"0.70761955",
"0.70530796",
"0.7050215",
"0.6999... | 0.8726589 | 0 |
Returns the rightmost (highestnumbered) child of the parent_index node. | def get_rightmost_child(self, parent_index):
return (parent_index + 1) * self._branching_factor | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_leftmost_child(self, parent_index):\n return parent_index * self._branching_factor + 1",
"def get_right_child_index(self, parent_index):\r\n\r\n # Remember, this is a 1-base index.\r\n if parent_index * 2 + 1 > self.length():\r\n # There is no right child\r\n return... | [
"0.79251075",
"0.7906473",
"0.78501725",
"0.7577195",
"0.7572854",
"0.75090915",
"0.74778223",
"0.7337135",
"0.7252186",
"0.7232031",
"0.71786445",
"0.7135732",
"0.7028387",
"0.6947021",
"0.69260484",
"0.6917921",
"0.6906752",
"0.68836045",
"0.6811015",
"0.6804964",
"0.679702... | 0.8619758 | 0 |
Returns the minimum value that is mapped to index's subtree. | def get_left_value(self, index):
# Find the smallest-index leaf node in this subtree.
while index < self._leftmost_leaf_index:
index = self.get_leftmost_child(index)
return self._data_low + self._range * (
index - self._leftmost_leaf_index) / self._num_leaves | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def treeMin(self,start=0):\n indx = start\n min_val = self.nodelist[indx].key\n while self.nodelist[indx].Left:\n indx = self.nodelist[indx].Left\n if indx:\n min_val = self.nodelist[indx].key\n return min_val",
"def min(self):\n return self._min(s... | [
"0.7846412",
"0.76028967",
"0.75590944",
"0.753064",
"0.7427621",
"0.7417082",
"0.7405562",
"0.7353647",
"0.7351266",
"0.73437196",
"0.7321823",
"0.72927976",
"0.726648",
"0.72636586",
"0.7229511",
"0.7178066",
"0.71777964",
"0.7166224",
"0.71555954",
"0.7118936",
"0.7096472"... | 0.7304398 | 11 |
Returns the index of the parent of the child_index node. | def get_parent(self, child_index):
return self.get_parents(np.asarray([child_index]))[0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parent_index(child_index: int) -> int:\n return (child_index - 1)//2",
"def get_parent_index(self, child_index):\r\n\r\n # The root of the tree is at index position 1 \r\n # and can have no parent\r\n if child_index == 1:\r\n return False\r\n return child_index /... | [
"0.8327025",
"0.8201449",
"0.79884535",
"0.79556245",
"0.79114646",
"0.78513694",
"0.7848623",
"0.7837058",
"0.78011805",
"0.7750291",
"0.767099",
"0.7565845",
"0.7538199",
"0.75233",
"0.7459171",
"0.73819566",
"0.730919",
"0.726084",
"0.71563095",
"0.7041942",
"0.7017682",
... | 0.8107262 | 2 |
Create an EllipsoidGate instance. | def __init__(
self,
gate_name,
dimensions,
coordinates,
covariance_matrix,
distance_square
):
super().__init__(
gate_name,
dimensions
)
self.gate_type = "EllipsoidGate"
self.coordinates = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_to_parent_class(self):\n return gates.EllipsoidGate(\n self.gate_name, self.dimensions, self.coordinates, self.covariance_matrix, self.distance_square\n )",
"def GetEllipsoid(self) -> \"itkEllipseSpatialObject2_Pointer\":\n return _itkGaussianSpatialObjectPython.itkGau... | [
"0.6724203",
"0.55882424",
"0.55870336",
"0.54545027",
"0.54479533",
"0.5387654",
"0.5286316",
"0.5235783",
"0.51824296",
"0.5163397",
"0.51126283",
"0.51100934",
"0.50261146",
"0.5025607",
"0.49759236",
"0.49597508",
"0.4940214",
"0.49288177",
"0.49120355",
"0.48638743",
"0.... | 0.5901543 | 1 |
Create a QuadrantGate instance. | def __init__(
self,
gate_name,
dividers,
quadrants
):
super().__init__(
gate_name,
dividers
)
self.gate_type = "QuadrantGate"
# First, check dimension count
if len(self.dimensions) < 1:
raise... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_to_parent_class(self):\n return gates.QuadrantGate(self.gate_name, self.dimensions, self.quadrants.values())",
"def ZZgate(q1, q2, gamma):\n\n # get a circuit\n circ = Circuit()\n\n # construct diagonal elements (fourth element)\n gate = Circuit().cphaseshift(q1, q2, gamma)\n ci... | [
"0.63825566",
"0.5468719",
"0.54511714",
"0.5444869",
"0.53652906",
"0.5343572",
"0.5281695",
"0.52656096",
"0.5257477",
"0.5219977",
"0.51584035",
"0.51357657",
"0.5115101",
"0.50482315",
"0.49972767",
"0.49591854",
"0.49425298",
"0.4933435",
"0.49322397",
"0.49056202",
"0.4... | 0.63555974 | 1 |
Return current Y position of mouse | def getY():
return mouse.position[1] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mouse_position(self):\n x = c_int(-1)\n y = c_int(-1)\n\n SDL_GetMouseState(x, y)\n \n return (x.value, y.value)",
"def GetY(*args, **kwargs):\n return _core_.SetCursorEvent_GetY(*args, **kwargs)",
"def getPosition():\r\n return mouse.position",
"def mouse_posi... | [
"0.7850562",
"0.7769377",
"0.76996475",
"0.75788975",
"0.7556506",
"0.75230324",
"0.7499565",
"0.7469771",
"0.7384672",
"0.73808664",
"0.7369288",
"0.736575",
"0.7347527",
"0.7343208",
"0.73367286",
"0.73312193",
"0.732111",
"0.7298077",
"0.7235723",
"0.72321516",
"0.7228965"... | 0.90542006 | 0 |
Ensure number is even by incrementing if odd | def evenify(n):
return n if n % 2 == 0 else n + 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def oddify(n):\n return n if n % 2 else n + 1",
"def is_even(number):\r\n return number % 2 == 0",
"def is_even(nbr):\n return nbr % 2 == 0",
"def odd(number):\n\n return number % 2 == 1",
"def is_odd(number):\n return not is_even(number)",
"def is_odd(number):\n\n if number % 2 == 0:\n... | [
"0.79367113",
"0.7609225",
"0.75907737",
"0.7566355",
"0.7563249",
"0.75103706",
"0.7481565",
"0.7454659",
"0.74163973",
"0.7376935",
"0.73649865",
"0.734351",
"0.73277396",
"0.73226273",
"0.72992945",
"0.72658724",
"0.7241075",
"0.7228634",
"0.7184844",
"0.71774906",
"0.7172... | 0.77642727 | 1 |
Ensure number is odd by incrementing if even | def oddify(n):
return n if n % 2 else n + 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_odd(number):\n return not is_even(number)",
"def evenify(n):\n return n if n % 2 == 0 else n + 1",
"def odd(number):\n\n return number % 2 == 1",
"def is_odd(number):\n\n if number % 2 == 0:\n return False\n else:\n return True",
"def isOdd(n):\n return n % 2 == 1",
"... | [
"0.77047455",
"0.7692066",
"0.7633051",
"0.7605075",
"0.75566286",
"0.74600095",
"0.7399845",
"0.7365772",
"0.7350885",
"0.73476094",
"0.72775304",
"0.72714084",
"0.7172438",
"0.716479",
"0.7142992",
"0.7139197",
"0.7137078",
"0.71336764",
"0.71282965",
"0.71278626",
"0.71274... | 0.803124 | 0 |
returns true if the angle range given represents a wall | def isWall(angle_1, angle_2):
global D
#print "before: ", D.ranges
all_ranges = D.ranges
#print "after: ", ranges
if angle_1 > angle_2:
ranges = all_ranges[angle_1 - 1 : ] + all_ranges[ : angle_2]
else:
ranges = all_ranges[angle_1 - 1 : angle_2]
ranges.sort()
median =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_ring_normal_angle(cls, angle):\n dev = cls.ring_normal_angle_deviation\n if 0 <= angle <= dev or 90 - dev <= angle <= 90 + dev:\n return True\n else:\n return False",
"def _angleBetween(angle, min_angle, max_angle):\n angle = angle % 360\n min_angle = min_an... | [
"0.67234665",
"0.6365055",
"0.63626057",
"0.6295533",
"0.626801",
"0.6193529",
"0.6140691",
"0.6136498",
"0.612389",
"0.60518086",
"0.5994016",
"0.5959365",
"0.59404635",
"0.5897636",
"0.5883279",
"0.58791846",
"0.58689016",
"0.5856178",
"0.5835118",
"0.58219767",
"0.58029425... | 0.7762054 | 0 |
Filters a predictions bed file by returning only rows where the score is above the threshold | def filter_scores(input, output, threshhold=0.0, source_index=3):
reader = csv.reader(input, delimiter='\t')
writer = csv.writer(output, delimiter='\t')
for row in reader:
# Adds a score column by multiplying the value of an existing column by a factor
# http://genome.ucsc.edu/FAQ/FAQformat.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def qc(csv, txt, threshold):\n click.echo('Filtering with N threshold of %s' % threshold)\n filter_threshold(csv, txt, threshold)",
"def qc(csv, txt, threshold):\n click.echo('Filtering with N threshold of %s' % threshold)\n filter_threshold(csv, txt, threshold)",
"def filter_BF_matches(matches: li... | [
"0.6174147",
"0.6174147",
"0.60725176",
"0.5961008",
"0.58945155",
"0.58739805",
"0.57970357",
"0.5753549",
"0.57472986",
"0.5715441",
"0.5708733",
"0.56614584",
"0.5643657",
"0.56366175",
"0.5603545",
"0.5571413",
"0.55305386",
"0.5520081",
"0.5499175",
"0.5478441",
"0.54645... | 0.60731685 | 2 |
Generate and return two offspring from the passed parents | def get_crossover(parent0, parent1, max_attempt_num, shape_min_length_proportion, shape_max_length_proportion, shape_min_area_proportion, polygon_max_vertex_num, max_permutation_num, min_fitness_for_non_best):
# determine the bounds and side length of the container (common for both parents)
min_x, min_y, max_x... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __reproduce(first_parent, second_parent):\n # zygote = first_parent + second_parent\n # np.random.shuffle(zygote)\n # offspring = zygote[:len(first_parent)]\n # # offspring2 = zygote[len(first_parent):]\n\n # For a random cut\n # ****************************************************\n rando... | [
"0.74068165",
"0.73251796",
"0.7177293",
"0.7046932",
"0.65801835",
"0.6533567",
"0.6496708",
"0.6369267",
"0.63491017",
"0.62168485",
"0.61526763",
"0.6118598",
"0.60756296",
"0.6074085",
"0.60622066",
"0.60576683",
"0.60248363",
"0.59559137",
"0.59442055",
"0.59423435",
"0.... | 0.5105721 | 63 |
Generate and return offspring from the passed parents | def generate_offspring(parents, mutation_min_iter_num, mutation_add_weight, mutation_remove_weight, mutation_modify_weight, mutation_add_max_attempt_num, mutation_modify_max_attempt_num, small_position_change_proportion, small_rotation_change_proportion, mutation_modify_move_until_intersection_point_num, mutation_modif... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_offspring(self, parents, generation, pool=None):\n offsprings = Population(self.params, init_size=0, name='offsprings')\n\n parent_genome = parents['genome']\n parent_ids = parents['id']\n parent_ancestor = parents['ancestor']\n\n if pool is not None:\n offs = pool.map(self._genera... | [
"0.7721953",
"0.7668697",
"0.6859599",
"0.6690956",
"0.66844344",
"0.64232415",
"0.6340152",
"0.6270222",
"0.6249979",
"0.6237946",
"0.603951",
"0.58284485",
"0.57931054",
"0.5762432",
"0.5653261",
"0.56302625",
"0.5564773",
"0.55488116",
"0.55437386",
"0.55281067",
"0.552299... | 0.6824638 | 3 |
list of str > list of tuple Returns a list of tuple. One tuple for every string in test_string with first element as teh string and second element as True if string has valid html tags and False if invalid html tags. >>> valid_html(['''''']) [('', True)] | def valid_html(test_strings):
# initialize list result
result = []
for item in test_strings:
# get html tags
tags = get_html_tags(item)
# if the number of html tags is less than 2, it means that the html
# string is invalid. In that case append the r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_html_validates(self):\n\n validator = Validator({})\n html = '<!doctype html><html lang=\"en\"><head><body></body></html>'\n html_results = validator.validate_html(html)\n self.assertTrue(type(html_results) is list)",
"def check_words(self, wlist):\n\n if self.word_che... | [
"0.64088994",
"0.568821",
"0.56216323",
"0.55964786",
"0.5585876",
"0.5540447",
"0.5415755",
"0.5306649",
"0.52725273",
"0.5224366",
"0.5151313",
"0.5139251",
"0.51266587",
"0.51261544",
"0.5124496",
"0.5113539",
"0.5063183",
"0.50055516",
"0.49957946",
"0.49755013",
"0.49723... | 0.7907479 | 0 |
Return the current configuration and put Pepper in the configuration to walk hand in hand. | def setSettings(self):
ecp = self.motionService.getExternalCollisionProtectionEnabled("All")
ss = self.motionService.getSmartStiffnessEnabled()
cp = self.motionService.getCollisionProtectionEnabled("Arms")
aa = self.lifeService.getAutonomousAbilityEnabled("BackgroundMovement")
sd... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def config(self):\n return local.config()",
"def configure(self):\n return utils.ConfigContext(self)",
"def _get_config(self):\n return self.__config",
"def _get_config(self):\n return self.__config",
"def _get_config(self):\n return self.__config",
"def _get_config(self):\n return ... | [
"0.6745966",
"0.6685294",
"0.6652948",
"0.6652948",
"0.6652948",
"0.6652948",
"0.6652948",
"0.6652948",
"0.6652948",
"0.6652948",
"0.6652948",
"0.6652948",
"0.6652948",
"0.6652948",
"0.6652948",
"0.6652948",
"0.6652948",
"0.6652948",
"0.6652948",
"0.6652948",
"0.6652948",
"... | 0.0 | -1 |
Sparse version of a `log(softmax)` function. There are `BATCH_SIZE` entries, each with an arbitrary number of logits. For each value in `logits` there is a corresponding value in `indices` from `0` to `BATCH_SIZE1` which indicate which entry the logit is participating. | def sparse_log_soft_max(logits, indices):
with tf.name_scope("SparseLogSoftMax"):
if len(indices.shape) == 1:
indices = tf.expand_dims(indices, 1)
batch_size = tf.math.reduce_max(indices) + 1
num_values = tf.cast(tf.shape(logits)[0], tf.int64)
dense_shape_2d = [batch_size... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sparse_softmax(logits, temp, name='weight'):\n # TODO(jereliu): identify efficient method for multivariate expit\n\n logits = tf.convert_to_tensor(logits)\n temp = tf.convert_to_tensor(temp)\n\n batch_sample_size = logits.get_shape().as_list()[:-1]\n\n # check dimension\n if logits.get_shape(... | [
"0.71006674",
"0.6990867",
"0.68320304",
"0.6826239",
"0.6680374",
"0.6652835",
"0.659688",
"0.6516822",
"0.6504395",
"0.6361283",
"0.63219297",
"0.6207669",
"0.61978424",
"0.6165849",
"0.6161283",
"0.6146307",
"0.61287075",
"0.6120086",
"0.60897017",
"0.60449106",
"0.6038272... | 0.7901316 | 0 |
Yield successive nsized chunks from l. | def chunks(l, n):
for i in range(0, len(l), n):
yield l[i:i + n] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __chunks(self, l, n):\n for i in range(0, len(l), n):\n yield l[i:i+n]",
"def _chunks(self, l, n):\n for i in xrange(0, len(l), n):\n yield l[i:i+n]",
"def chunk(self, l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]",
"def chunks(l, n):\n ... | [
"0.80763406",
"0.79780173",
"0.7848591",
"0.7818154",
"0.7764843",
"0.7764843",
"0.7740603",
"0.76803994",
"0.7677509",
"0.7673566",
"0.765864",
"0.7655856",
"0.7655856",
"0.7655856",
"0.76458347",
"0.7615106",
"0.75838816",
"0.7557435",
"0.7549177",
"0.7549177",
"0.7549177",... | 0.7448925 | 71 |
Get a mocked out ChangeNotifier. | def change_notifier(decoy: Decoy) -> ChangeNotifier:
return decoy.mock(cls=ChangeNotifier) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_mock(self):\n return self.mock",
"def beer():\n return mock()",
"def create_observer(self):\n\n return MockObserver(self)",
"def mock_temperature_sensor() -> MagicMock:\n temperature_sensor = mock_with_listeners()\n temperature_sensor.temperature = 32.0\n return temperature_... | [
"0.5881854",
"0.55710053",
"0.5481768",
"0.54714113",
"0.53740305",
"0.53452766",
"0.52895015",
"0.52895015",
"0.52552634",
"0.52552634",
"0.52418745",
"0.52174115",
"0.5188408",
"0.5081704",
"0.506801",
"0.50541234",
"0.50349146",
"0.50312114",
"0.50124115",
"0.50096625",
"0... | 0.85368544 | 0 |
Get a ProtocolEngine config value object. | def engine_config() -> Config:
return Config(
# Choice of robot and deck type is arbitrary.
robot_type="OT-2 Standard",
deck_type=DeckType.OT2_STANDARD,
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_config_value(self, name): \n value = self.cf.get(\"config\", name)\n return value",
"def config(self):\n if self.__config is None:\n config_str = getattr(self.configuration, 'value')\n self.__config = json.loads(config_str)\n return self.__config",
"def _get_config(c... | [
"0.6379751",
"0.63779485",
"0.63097656",
"0.6263325",
"0.62112993",
"0.6162084",
"0.6118341",
"0.6112841",
"0.6112216",
"0.6112216",
"0.60364336",
"0.6035278",
"0.6035167",
"0.6035167",
"0.6035167",
"0.6035167",
"0.6035167",
"0.6035167",
"0.6035167",
"0.6035167",
"0.6035167",... | 0.0 | -1 |
Return the number of columns (used in unit tests only) | def count_columns(self):
return len(self.columns) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def number_of_columns(self):\n pass",
"def num_columns(self):\n return self.get_info()['num_columns']",
"def getColumnCount(self):\n return nColumns",
"def num_columns(self):\n return len(self.column_names())",
"def numColumns(self):\r\n return self.__data.numColumns",
... | [
"0.84093004",
"0.83721554",
"0.8281462",
"0.8208096",
"0.8163659",
"0.8134165",
"0.8026101",
"0.7927648",
"0.78844047",
"0.7838945",
"0.781946",
"0.781887",
"0.7807437",
"0.7796002",
"0.77727306",
"0.7753032",
"0.7727833",
"0.77177155",
"0.7675614",
"0.7656865",
"0.7532318",
... | 0.83897007 | 1 |
Returns the labels associated with the board | def labels(self):
return [self._services(Label, data) for data in self.data.labels] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_labels(self) -> List[str]:\n pass",
"def get_labels(self):\n\n if self.counter == -1:\n return \"\"\n\n return self.specific[self.specific.index == self.counter].labels.item()",
"def print_labels():\n return labels",
"def labels(self):\n return self.label2cc.... | [
"0.7449358",
"0.73624605",
"0.7321211",
"0.73133296",
"0.73065716",
"0.72881484",
"0.72799075",
"0.72490674",
"0.72247267",
"0.7192943",
"0.71400315",
"0.71400315",
"0.7036298",
"0.7032953",
"0.7032953",
"0.7032953",
"0.7032953",
"0.6978283",
"0.6966378",
"0.6952436",
"0.6936... | 0.0 | -1 |
x.__nonzero__() x != 0 | def __nonzero__(self):
if not self.A:
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nonzero(self):\n return array_funcs.nonzero(self)",
"def __nonzero__(self):\n return self.coef != 0",
"def __nonzero__(self):\n return _yarp.DVector___nonzero__(self)",
"def __nonzero__(self):\n return _yarp.SVector___nonzero__(self)",
"def __nonzero__(self):\n return _yarp... | [
"0.7808791",
"0.76496756",
"0.76207846",
"0.748408",
"0.74814665",
"0.7428579",
"0.74177545",
"0.7417281",
"0.7369343",
"0.734173",
"0.72957754",
"0.7249776",
"0.7239459",
"0.7223903",
"0.71947175",
"0.71292543",
"0.71008015",
"0.70948005",
"0.7083269",
"0.7074118",
"0.705046... | 0.7016214 | 28 |
Determine the closest cluster for the datapoint `e`. | def predict_map(interface, state, label, inp):
out = interface.output(0)
for row in inp:
if len(row) > 1:
row = row.strip().split(state["delimiter"])
x_id = "" if state["id_index"] == -1 else row[state["id_index"]]
x = [(0 if row[i] in state["missing_vals"] else float... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _closest_cluster(self, x):\n distances = [euclidean(x, self.cluster_centers[i]) for i in range(self.n_clusters)]\n return distances.index(min(distances))",
"def _nearest(self, point):\n assert checks.is_point(point)\n assert len(point) == self._dataset.getDimension()\n max ... | [
"0.6889001",
"0.62160337",
"0.62149906",
"0.61221105",
"0.6086355",
"0.60256994",
"0.6013489",
"0.5949672",
"0.58800465",
"0.58533585",
"0.5841449",
"0.5838228",
"0.58358294",
"0.5799136",
"0.57580113",
"0.5727892",
"0.5723462",
"0.5721644",
"0.5716076",
"0.5683072",
"0.56794... | 0.0 | -1 |
Creates the ship in random location and present on the game screen | def create_new_ship(self):
location_tuple = self.get_random_location_tuple()
new_ship = Ship(location_tuple)
self._screen.draw_ship(*location_tuple,
new_ship.get_direction_angle_in_degrees())
return new_ship | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _create_ship(self):\n x = random.randint(Screen.SCREEN_MIN_X, Screen.SCREEN_MAX_X)\n y = random.randint(Screen.SCREEN_MIN_Y, Screen.SCREEN_MAX_Y)\n ship = Ship((STRT_SPEED, STRT_SPEED), (x, y), START_DIR)\n self.__screen.draw_ship(x, y, START_DIR)\n return ship",
"def rando... | [
"0.8269255",
"0.75209755",
"0.7223523",
"0.6857918",
"0.68542475",
"0.67940044",
"0.67925125",
"0.66678095",
"0.66678053",
"0.666647",
"0.66312546",
"0.6613961",
"0.65759146",
"0.6560117",
"0.65583104",
"0.6531719",
"0.6518159",
"0.6507253",
"0.6501836",
"0.6493893",
"0.64770... | 0.7828031 | 1 |
Uses the function draw_ship in Screen to present the ship on the screen | def draw_ship(self):
ship_location = self._ship.get_location_tuple()
self._screen.draw_ship(ship_location[0],
ship_location[1],
self._ship.get_direction_angle_in_degrees()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def draw_ship(self):\n x_coordinate = self.__screen_ship.get_x_coordinate()\n y_coordinate = self.__screen_ship.get_y_coordinate()\n heading = self.__screen_ship.get_heading()\n self.__screen.draw_ship(x_coordinate, y_coordinate, heading)",
"def draw_ship(self, screen):\n scree... | [
"0.89276373",
"0.88268656",
"0.8458126",
"0.7631512",
"0.7301093",
"0.71853364",
"0.70509005",
"0.69781697",
"0.69625074",
"0.6928964",
"0.6923292",
"0.6886925",
"0.6849139",
"0.6831001",
"0.68203276",
"0.681106",
"0.67701715",
"0.67622644",
"0.674636",
"0.67452693",
"0.67383... | 0.86648595 | 2 |
Uses the function draw_asteroid in Screen to present the asteroids on the screen | def draw_asteroids(self, asteroids_list):
for asteroid in asteroids_list:
self._screen.draw_asteroid(asteroid,
*asteroid.get_location_tuple()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def draw_asteroid(self, screen):\n screen.draw_asteroid(self, self.__x, self.__y)",
"def draw_asteroid(self):\n for asteroid in self.__screen_asteroids:\n x_coordinate = asteroid.get_x_coordinate()\n y_coordinate = asteroid.get_y_coordinate()\n self.__screen.draw_as... | [
"0.852346",
"0.84181845",
"0.8177185",
"0.7471511",
"0.7350897",
"0.72527957",
"0.69428086",
"0.69049346",
"0.6792069",
"0.6789087",
"0.6787353",
"0.67502147",
"0.67315054",
"0.67274773",
"0.6713341",
"0.6641348",
"0.6618385",
"0.6606354",
"0.65991527",
"0.65886796",
"0.65401... | 0.7311661 | 5 |
Initialize this hash table with the given initial size. | def __init__(self, num_buckets=8):
# Create a new list (used as fixed-size array) of empty linked lists
self.buckets = []
for i in range(num_buckets):
self.buckets.append(LinkedList()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, initial_size):\n self.comparisons_used = 0\n self.number_of_slots = initial_size\n self._number_of_items = 0\n\n # setup the given number of slots, each containing None\n # Note: self._data[i] will be the head of a linked list\n self._data = [None] * ini... | [
"0.81716406",
"0.8068201",
"0.74659175",
"0.7463431",
"0.68560755",
"0.685495",
"0.6824136",
"0.6612218",
"0.6571335",
"0.6562739",
"0.6540444",
"0.6526839",
"0.6517995",
"0.650115",
"0.64838153",
"0.64783955",
"0.64533633",
"0.6424357",
"0.6424357",
"0.6424357",
"0.6372607",... | 0.0 | -1 |
Return a formatted string representation of this hash table. | def __str__(self):
items = []
for key, val in self.items():
items.append('{!r}: {!r}'.format(key, val))
return '{' + ', '.join(items) + '}' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __repr__(self):\n items = ['{!r}'.format(key) for key in self.table.keys()]\n return '{' + ', '.join(items) + '}'",
"def __repr__(self):\n string = \"\\n\"\n for key in self.keys():\n string = string + \"{:50}\\t{}\\n\".format(\"'\" + key + \"':\", self[key])\n r... | [
"0.8100671",
"0.7806259",
"0.76623046",
"0.76225966",
"0.7506086",
"0.73542666",
"0.72493166",
"0.7202661",
"0.7199181",
"0.7190019",
"0.71778363",
"0.71778363",
"0.71778363",
"0.71778363",
"0.71778363",
"0.71778363",
"0.71778363",
"0.71778363",
"0.71778363",
"0.71778363",
"0... | 0.0 | -1 |
Return a string representation of this hash table. | def __repr__(self):
return 'HashTable({!r})'.format(self.items()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __repr__(self):\n items = ['{!r}'.format(key) for key in self.table.keys()]\n return '{' + ', '.join(items) + '}'",
"def __repr__(self):\n return 'Hash Table: {}'.format(item.data for item in self.buckets)",
"def __str__(self):\n return \"{\"+\",\".join([key for key in self._table... | [
"0.7884212",
"0.7877412",
"0.77178365",
"0.7676377",
"0.7637128",
"0.7358087",
"0.7170986",
"0.7145676",
"0.71071374",
"0.7089374",
"0.7084111",
"0.7032707",
"0.70268774",
"0.7017071",
"0.7015861",
"0.69939774",
"0.6988916",
"0.69583064",
"0.69583064",
"0.6938291",
"0.6920164... | 0.79319084 | 0 |
Return a list of all keys in this hash table. | def keys(self):
# Collect all keys in each bucket
all_keys = []
for bucket in self.buckets:
for key, value in bucket.items():
all_keys.append(key)
return all_keys | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_keys(self):\n s = []\n for n in self.hash_table:\n if n is not None:\n s.append(n[0])\n return s",
"def get_keys(self):\n return list(self._keydict.keys())",
"def keys(self):\n return list(self.iterkeys())",
"def keys(self):\n re... | [
"0.87913597",
"0.8554101",
"0.8356747",
"0.8356747",
"0.8335763",
"0.830945",
"0.8281106",
"0.82617104",
"0.82517785",
"0.8205547",
"0.81843674",
"0.817584",
"0.81754196",
"0.8174725",
"0.8157013",
"0.8146467",
"0.8143414",
"0.812813",
"0.81207424",
"0.8119905",
"0.80622464",... | 0.8258955 | 8 |
Return a list of all values in this hash table. | def values(self):
# TODO: Loop through all buckets
# TODO: Collect all values in each bucket
all_values = []
for bucket in self.buckets:
for key, value in bucket.items():
all_values.append(value)
return all_values | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_values(self):\n return self.__dict__.values()",
"def values(self):\n r = []\n for key in self:\n try:\n r.append(self[key])\n except KeyError:\n pass\n return r",
"def values(self):\n return list(self.itervalues())",... | [
"0.8127153",
"0.80979484",
"0.8064922",
"0.8064922",
"0.7955789",
"0.78682095",
"0.78682095",
"0.78500676",
"0.78375214",
"0.7767254",
"0.77467155",
"0.7732646",
"0.7665227",
"0.7664623",
"0.7664418",
"0.76434356",
"0.7624305",
"0.7603521",
"0.759922",
"0.7588295",
"0.7554171... | 0.7696051 | 12 |
Return the number of keyvalue entries by traversing its buckets. | def length(self):
# TODO: Loop through all buckets
# TODO: Count number of key-value entries in each bucket
count = 0
for bucket in self.buckets:
for item in bucket.items():
count += 1
return count | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_num_keys_in_bucket(bucket):\n num_files = 0 # Informational\n for k in bucket.list():\n num_files += 1 # Informational\n return num_files",
"def bucket_counts(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[builtins.int]:\n pass",
"def bucket_count... | [
"0.73185045",
"0.67338514",
"0.67338514",
"0.6701394",
"0.6625941",
"0.64966345",
"0.6450951",
"0.64002687",
"0.6396686",
"0.6329878",
"0.6295669",
"0.62761927",
"0.6247365",
"0.6214968",
"0.62102854",
"0.6197422",
"0.6182213",
"0.6181107",
"0.61802405",
"0.6179953",
"0.61700... | 0.7865009 | 0 |
Return the value associated with the given key, or raise KeyError. | def get(self, key):
# TODO: Find bucket where given key belongs
# TODO: Check if key-value entry exists in bucket
# TODO: If found, return value associated with given key
# TODO: Otherwise, raise error to tell user get failed
# Hint: raise KeyError('Key not found: {}'.format(key)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __getitem__(self, key):\n value = self.get(key, missing)\n if value is missing:\n raise KeyError(key)\n return value",
"def __getitem__(self, key):\n temp = self.find(key)\n if temp is None:\n raise KeyError(repr(key))\n else:\n retur... | [
"0.81576973",
"0.79498535",
"0.7937667",
"0.77307224",
"0.7620045",
"0.76139283",
"0.7607665",
"0.7581089",
"0.75622416",
"0.75551176",
"0.75154245",
"0.74129605",
"0.7395322",
"0.73677266",
"0.7365687",
"0.7345327",
"0.7345017",
"0.7344696",
"0.73413944",
"0.72960955",
"0.72... | 0.7106446 | 32 |
Open a json file and assign it contents to a variable | def open_contact_file_read(filename):
with open(filename, 'r') as json_file:
contact_list = json.load(json_file)
return contact_list | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def openjson(arg):\n with open(arg, \"r\") as file:\n myfile = json.load(file)\n return myfile",
"def open_json_file(filename):\n with open(filename, 'r') as f:\n return json.load(f)",
"def open_json(self, filename):\n filename = os.path.join(self.data_dir, filename)\n... | [
"0.7842094",
"0.7782103",
"0.77097344",
"0.76331455",
"0.76224005",
"0.7595562",
"0.75664765",
"0.7554189",
"0.7452981",
"0.74490064",
"0.74372494",
"0.74090594",
"0.73987293",
"0.73938376",
"0.73904675",
"0.7385435",
"0.73808104",
"0.73808104",
"0.73775524",
"0.7368575",
"0.... | 0.0 | -1 |
Test that voting can be voted up or voted down. | def test_voting(self):
votes = votes.objects.create(title="Voting", user=self.user, status=CONTENT_STATUS_PUBLISHED) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_upvote_and_downvote(self):\n user = self.create_user()\n user_id = user[0] # answer author user id\n question_id = int(self.create_question()[0])\n # token should be encoded with the id of the answer author\n auth_token = user[1]\n new_answer = self.post_data(que... | [
"0.72204125",
"0.71646976",
"0.7010708",
"0.695215",
"0.66934824",
"0.66655606",
"0.662098",
"0.66192496",
"0.66117597",
"0.66010696",
"0.65551364",
"0.65397555",
"0.6522417",
"0.6509952",
"0.64576876",
"0.6345272",
"0.62922376",
"0.62647533",
"0.6240288",
"0.62358975",
"0.62... | 0.6922429 | 4 |
Returns the changes that have been made to the object, as the difference between the current state and the staged copy. | def changes(self):
changes = dict()
current_state = self.to_dict()
for k, v in current_state.items():
if v != self.staged.get(k, None):
changes[k] = v
for k in self.staged.keys():
if k not in current_state:
changes[k] = None
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def changes(self):\n if self.prev:\n return CompareMixin.compare(\n CompareMixin(), self.object, self.prev, self)[0]\n return []",
"def get_changes(self):\n return self._updated",
"def changes(self):\n return self._changes",
"def diff(self):\n opts... | [
"0.7313305",
"0.6860864",
"0.6765979",
"0.64484453",
"0.6369503",
"0.63651496",
"0.635136",
"0.62882096",
"0.62647384",
"0.62483805",
"0.624721",
"0.624721",
"0.624721",
"0.624721",
"0.61653227",
"0.6163979",
"0.61530834",
"0.61295396",
"0.5930317",
"0.5926231",
"0.58763194",... | 0.7711229 | 0 |
Returns starting state of the board. | def initial_state():
return [[EMPTY, EMPTY, EMPTY],
[EMPTY, EMPTY, EMPTY],
[EMPTY, EMPTY, EMPTY]] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def startState(self):\n return (1, # 0 white moves first\n [sr.copy() for sr in self.board], #2 board\n None, #2 en passant coords\n {'Q': 1, 'K': 1, 'q': 1, 'k': 1}, #3 castle_rights\n False, #4 check_w,\n False, #5 check_b,\n ... | [
"0.76783687",
"0.7257875",
"0.72262055",
"0.72262055",
"0.72262055",
"0.72262055",
"0.72262055",
"0.72262055",
"0.72262055",
"0.72262055",
"0.72262055",
"0.72262055",
"0.72262055",
"0.72262055",
"0.72262055",
"0.72262055",
"0.72262055",
"0.72262055",
"0.72262055",
"0.72262055",... | 0.0 | -1 |
Returns set of all possible actions (i, j) available on the board. | def actions(board):
actionlist = []
for (i, row) in enumerate(board):
for (j, element) in enumerate(row):
if (element == EMPTY):
actionlist.append((i, j))
return actionlist | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def actions(board):\n\n # If terminal board, then just return\n if terminal(board):\n return\n\n # Initialize an empty set of available actions\n actions = set()\n\n # Add coordinates to actions if empty\n for i in range(3):\n for j in range(3):\n if board[i][j] == EMPTY:... | [
"0.8162253",
"0.809379",
"0.76952",
"0.76864576",
"0.7559482",
"0.7528511",
"0.7473039",
"0.736256",
"0.7230098",
"0.7225175",
"0.7213716",
"0.71954256",
"0.715177",
"0.7151186",
"0.7151186",
"0.71435434",
"0.70876163",
"0.7060127",
"0.7059491",
"0.69834083",
"0.69833654",
... | 0.7267635 | 8 |
Returns True if game is over, False otherwise. | def terminal(board):
boardelements = []
for row in board:
for element in row:
boardelements.append(element)
myset = set(boardelements)
if len(myset) > 1:
# for checking rows
for (i, row) in enumerate(board):
rowset = set(row)
if None not in ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_game_over(self):\n return (self.is_win() != 0 or self.is_tie())",
"def game_over(self):\n #lost game\n if self.check_game_status() == True:\n return False\n #lost game\n if self.pos_aliens() == True:\n return False\n #won game\n if sel... | [
"0.88403744",
"0.8762089",
"0.8541484",
"0.85287684",
"0.852308",
"0.8474544",
"0.8472174",
"0.8355815",
"0.83500564",
"0.8305116",
"0.82132494",
"0.8209343",
"0.79689944",
"0.7965635",
"0.78867507",
"0.78531194",
"0.78175175",
"0.7754379",
"0.7720457",
"0.7696392",
"0.754576... | 0.0 | -1 |
Parse all docstrings inside a folder. Iterates over all files | def folder_docstring_to_yaml(path, file_extension='py', output_file=None, resource=None, comment_docstring=None):
files = glob(path + "/*." + file_extension)
for file in files:
file_docstring_to_yaml(file, output_file, resource, comment_docstring) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_files_to_parse():\n current_dir = os.path.dirname(os.path.realpath(__file__))\n docs_dir = os.path.join(current_dir, \"docs\")\n return [os.path.join(docs_dir, fname) for fname in os.listdir(docs_dir)]",
"def _yield_documents(input_dir, doc_type):\n for fpath in glob.iglob(\"{}/{}*.*\".format... | [
"0.6589707",
"0.65891933",
"0.65421915",
"0.63711715",
"0.63052434",
"0.62347806",
"0.62259704",
"0.6167938",
"0.6101944",
"0.604108",
"0.6008642",
"0.5928471",
"0.59091824",
"0.58210176",
"0.58167094",
"0.5803455",
"0.57745075",
"0.5758395",
"0.5723978",
"0.5703084",
"0.5700... | 0.0 | -1 |
Get the details of invoice settings. | def get_invoice_settings(self):
url = base_url + 'invoices'
resp = zoho_http_client.get(url, self.details, self.headers)
return parser.get_invoice_settings(resp) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_settings(self) -> APIResponse:\n return self._get(\"detail\")",
"def update_invoice_settings(self, invoice_settings):\n url = base_url + 'invoices'\n json_object = dumps(invoice_settings.to_json())\n data = { \n 'JSONString': json_object\n }\n resp... | [
"0.6717794",
"0.65506315",
"0.63786656",
"0.6188255",
"0.60131025",
"0.6012769",
"0.59775823",
"0.59322447",
"0.5868731",
"0.5868731",
"0.58551544",
"0.5831286",
"0.57839775",
"0.5760944",
"0.5699498",
"0.5661022",
"0.5652561",
"0.56394434",
"0.56159484",
"0.5615906",
"0.5584... | 0.87996006 | 0 |
List of configured currencies with pagination. | def get_currencies(self, param=None):
url = base_url + 'currencies'
if param is not None:
data = {
'filter_by': param
}
else:
data = None
resp = zoho_http_client.get(url, self.details, self.headers, data)
return parser.get_c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_currencies():\n print(f\"{helper.blue_text}Available currencies: {helper.white_text}\")\n # Print all available currencies\n api.display_currency_list()\n press_enter_to_continue()",
"def get_currencies(self) -> List[Dict[str, Any]]:\n result = self.api_query('getcurrencies')\n ... | [
"0.81017447",
"0.77026415",
"0.75800693",
"0.7484915",
"0.7339784",
"0.7264952",
"0.7057768",
"0.68459666",
"0.6804433",
"0.6804226",
"0.6687871",
"0.66649187",
"0.6654512",
"0.65427405",
"0.6459162",
"0.6415659",
"0.6360258",
"0.62578106",
"0.61503226",
"0.61465234",
"0.6118... | 0.66882324 | 10 |
List of exchange rates configured for the currency. | def list_exchange_rates(self, currency_id, param=None):
url = base_url + 'currencies/' + currency_id + '/exchangerates'
resp = zoho_http_client.get(url, self.details, self.headers, param)
return parser.get_exchange_rates(resp) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_exchange_rates(self):\n\n api_url = '{0}exchange_rates'.format(self.api_base_url)\n\n return self.__request(api_url)",
"def rates(self):\n return self._rates",
"def get_rates(self):\n r = list(self._CONFIG_DR.keys())\n r.sort()\n return r",
"def get_rates(sel... | [
"0.82615185",
"0.73313254",
"0.72481096",
"0.72481096",
"0.71130055",
"0.7069275",
"0.6825407",
"0.68194824",
"0.6816547",
"0.67784953",
"0.6716649",
"0.66826904",
"0.6669752",
"0.666528",
"0.66555935",
"0.66182905",
"0.6500629",
"0.6489591",
"0.64711195",
"0.63363576",
"0.61... | 0.77754754 | 1 |
Get details of an exchange rate that has been associated to the currency. | def get_exchange_rate(self, currency_id, exchange_rate_id):
url = base_url + 'currencies/' + currency_id + '/exchangerates/' + \
exchange_rate_id
resp = zoho_http_client.get(url, self.details, self.headers)
return parser.get_exchange_rate(resp) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def view_exchange_rate():\n # Get source currency\n source = prompt_for_currency(\"Enter source currency: \")\n # Get destination currency\n destination = prompt_for_currency(\"Enter destination currency: \")\n # Get the exchange rate in both directions\n exchange_rate = api.get_exchange_rate(sou... | [
"0.7544007",
"0.73575616",
"0.71946895",
"0.71278286",
"0.6762509",
"0.672362",
"0.66418463",
"0.66146773",
"0.65301514",
"0.6489969",
"0.6470985",
"0.6455621",
"0.64003533",
"0.6394783",
"0.63869286",
"0.6317394",
"0.62978184",
"0.6265184",
"0.62353855",
"0.62233394",
"0.604... | 0.78243864 | 0 |
Dot product of channel mapping matrix to channel data. | def _do_interp_dots(inst, interpolation, goods_idx, bads_idx):
from ..io import BaseRaw
from ..epochs import BaseEpochs
from ..evoked import Evoked
_validate_type(inst, (BaseRaw, BaseEpochs, Evoked), "inst")
inst._data[..., bads_idx, :] = np.matmul(
interpolation, inst._data[..., goods_idx,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dotProduct(self, *args):\n return _almathswig.Position2D_dotProduct(self, *args)",
"def dotProduct(self, *args):\n return _almathswig.Position2D_dotProduct(self, *args)",
"def __dot_product(self, other, self_row, other_column):\n\n dot_product = 0\n\n for i in range(0, self.colu... | [
"0.5892277",
"0.5892277",
"0.5808189",
"0.5790276",
"0.56805253",
"0.5679507",
"0.5639542",
"0.56206286",
"0.56142986",
"0.56128246",
"0.56105065",
"0.55818886",
"0.5547673",
"0.5547673",
"0.5535192",
"0.5520376",
"0.55152977",
"0.5506207",
"0.5506207",
"0.54960036",
"0.54334... | 0.0 | -1 |
Choose a random colour from the list of known colours. | def random_colour(name=False, rgb=True):
if not name:
if rgb:
return choice(get_all_colours())
else:
return rgb_to_hex(choice(get_all_colours()))
else:
return choice(list(get_all_colours(rtype=dict).keys())) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_color():\n return random.choice(list(colors.values())[2:])",
"def random_color(cls):\n return random.choice(cls.COLORS)",
"def set_color(self):\n colors = ['black', 'yellow', 'blue', 'brown', 'white']\n x = random.randint(0, 3)\n return colors[x - 1]",
"def choose_color(... | [
"0.8084881",
"0.7560875",
"0.7535245",
"0.749781",
"0.74655294",
"0.7439766",
"0.7421132",
"0.7419715",
"0.7412848",
"0.7397231",
"0.7342484",
"0.73259157",
"0.73229533",
"0.7314314",
"0.72948045",
"0.72195196",
"0.719142",
"0.7190574",
"0.7119936",
"0.70379233",
"0.70155454"... | 0.72462934 | 15 |
Creates a node that represents a np.zeros array of same shape as node_A. | def __call__(self, node_A):
new_node = Op.__call__(self)
new_node.inputs = [node_A]
new_node.name = "Zeroslike(%s)" % node_A.name
return new_node | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zero_init(self, shape):\r\n return np.zeros(shape)",
"def make_zeros(self, shape):\n\t\treturn self._make_zeros(shape)",
"def zeros(shape, dtype=None):\n if not isinstance(shape, (list, tuple, TensorVariable)):\n shape = [shape]\n if dtype is None:\n dtype = config.floatX\n re... | [
"0.65079033",
"0.6501168",
"0.6446529",
"0.6412443",
"0.6352731",
"0.6346798",
"0.6313834",
"0.6283817",
"0.62395537",
"0.6227046",
"0.6120473",
"0.61156416",
"0.6091292",
"0.6091292",
"0.60705376",
"0.6055529",
"0.6047737",
"0.59938496",
"0.5975426",
"0.5953376",
"0.59423065... | 0.7663837 | 1 |
Returns zeros_like of the same shape as input. | def compute(self, node, input_vals):
assert(isinstance(input_vals[0], np.ndarray))
return np.zeros(input_vals[0].shape) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zeros(shape):\n return empty(shape, 0)",
"def zeros_like(inputs: T) -> T:\n try:\n inputs = asmatrix(inputs)\n return matrix([\n [0 for _ in range(inputs.column)]\n for _ in range(inputs.row)\n ])\n except TypeError:\n raise TypeError('Not supprt... | [
"0.78556436",
"0.7765395",
"0.75102067",
"0.75017476",
"0.74198264",
"0.7396041",
"0.7294536",
"0.7172771",
"0.71327215",
"0.7017507",
"0.6943554",
"0.6921704",
"0.69124615",
"0.69085246",
"0.6834866",
"0.6834866",
"0.6834328",
"0.68017626",
"0.67728615",
"0.6738267",
"0.6709... | 0.0 | -1 |
Returns ones_like of the same shape as input. | def compute(self, node, input_vals):
assert(isinstance(input_vals[0], np.ndarray))
return np.ones(input_vals[0].shape) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ones_like(inputs: T) -> T:\n try:\n inputs = asmatrix(inputs)\n if inputs.row == inputs.column:\n return matrix([\n [0 if not i==j else 1 for i in range(inputs.column)]\n for j in range(inputs.row)\n ])\n else:\n raise V... | [
"0.81402665",
"0.74907637",
"0.72647107",
"0.72209376",
"0.7198289",
"0.7177727",
"0.7176025",
"0.7151029",
"0.7051502",
"0.7037182",
"0.69028986",
"0.68756974",
"0.687373",
"0.67909837",
"0.6713403",
"0.6477075",
"0.6436834",
"0.6407905",
"0.6329456",
"0.6261956",
"0.6145334... | 0.0 | -1 |
Checking the len() reports expected results on our test graphs | def test_length_works_on_fixtures():
assert len(graph_filled_for_traversal()) == 7
assert len(graph_filled()) == 6
assert len(graph_empty()) == 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_length_of_short_graph(graph_one):\n assert len(graph_one) == 6",
"def test_empty_graph_size(graph_empty):\n assert len(graph_empty) == 0",
"def test_num_frames(self):\n\n self.assertEqual(len(self.dataset.annotation), 20)",
"def test_num_frames(self):\n\n self.assertEqual(len(sel... | [
"0.74009746",
"0.72823864",
"0.7074162",
"0.7074162",
"0.70053923",
"0.6973736",
"0.6901706",
"0.6901706",
"0.6900747",
"0.6897908",
"0.68895614",
"0.6857054",
"0.68377215",
"0.68141186",
"0.6801209",
"0.6762092",
"0.6761654",
"0.6661202",
"0.66539925",
"0.66244763",
"0.66189... | 0.76680595 | 0 |
Set blank character and create tape as a dictionary. | def __init__(self, tape_str, blank):
self.blank = blank
self.tape = dict((enumerate(tape_str))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gen_char_dict():\n alphabet = \"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-;.!?:'\\\"/\\|_@#$%^&*~`+-=<>()[]{}\"\n char_dict = {}\n char_dict[\"null\"] = 0\n for i, char in enumerate(alphabet):\n char_dict[char] = i + 1\n char_dict[\"UNK\"] = len(alphabet) + 1\n ret... | [
"0.5911733",
"0.5861407",
"0.58122367",
"0.5691266",
"0.5647168",
"0.54096985",
"0.5347686",
"0.5308171",
"0.529522",
"0.5277901",
"0.5240279",
"0.5133319",
"0.5131713",
"0.51301",
"0.51269686",
"0.51058054",
"0.50786346",
"0.504965",
"0.50348556",
"0.50215614",
"0.50100017",... | 0.734148 | 0 |
Get character based on index (which can be negative). If there is no character at the specified index, return the blank character. | def __getitem__(self, index):
if index in self.tape:
return self.tape[index]
else:
return self.blank | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def char_at(self, index):\n\n if index < self.length:\n return self.value_list[index + self.offset]\n else:\n return None",
"def __getitem__(self, index):\n\n return self.char_at(index)",
"def GetCharAtIndexFromString(baseString, charIndex):\n if (charIndex > len(b... | [
"0.7931723",
"0.73958844",
"0.7003817",
"0.67582595",
"0.654757",
"0.6423242",
"0.637842",
"0.61969936",
"0.6141348",
"0.60647714",
"0.5886497",
"0.58820206",
"0.58520144",
"0.58098155",
"0.5756393",
"0.5751603",
"0.5751603",
"0.5734934",
"0.5724206",
"0.56784075",
"0.565234"... | 0.5102973 | 74 |
Set the character at index i to c | def __setitem__(self, i, c):
self.tape[i] = c | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def putc(self, c):\n index = ord(c)\n for x in range(8):\n data = f.font[index*8+x]\n for y in range(7, -1, -1):\n self.set_pixel(x, y, [(data & 0x1)*10, 0, 0])\n data = data >> 1\n self.refresh()",
"def fill(s, c, i):\n while len(s) < i... | [
"0.70993656",
"0.636053",
"0.6335573",
"0.62828547",
"0.62796926",
"0.6264209",
"0.6177623",
"0.61522543",
"0.6020847",
"0.6005699",
"0.5966581",
"0.5937043",
"0.58474785",
"0.5846171",
"0.5806327",
"0.58046854",
"0.57838273",
"0.5689622",
"0.56336576",
"0.5621878",
"0.560219... | 0.595868 | 11 |
This controller return the template for Ajax Add to Cart with product details | def get_ajax_cart_item(self, product_id=None):
if product_id:
product = request.env['product.template'].search([['id', '=', product_id]])
values = {
'product': product,
}
response = http.Response(template="emipro_theme_base.ajax_cart_container", qc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render_cart(self, request, context):\n return render_to_response('plata/shop_cart.html',\n self.get_context(request, context))",
"def get_ajax_cart_sucess(self, product_id=None, product_product=None):\n if product_id:\n product = request.env['product.template'].search([['i... | [
"0.7190223",
"0.71583736",
"0.6886227",
"0.6839095",
"0.67862314",
"0.67819804",
"0.67819804",
"0.67819804",
"0.67769504",
"0.6704901",
"0.66221154",
"0.66044384",
"0.65929157",
"0.651915",
"0.6518078",
"0.6512622",
"0.64842856",
"0.6470672",
"0.644508",
"0.6324116",
"0.62973... | 0.73329306 | 0 |
This controller return the template for Ajax Add to Cart with product details | def get_ajax_cart_sucess(self, product_id=None, product_product=None):
if product_id:
product = request.env['product.template'].search([['id', '=', product_id]])
product_variant = request.env['product.product'].search([['id', '=', product_product]])
values = {
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_ajax_cart_item(self, product_id=None):\n if product_id:\n product = request.env['product.template'].search([['id', '=', product_id]])\n values = {\n 'product': product,\n }\n response = http.Response(template=\"emipro_theme_base.ajax_cart_co... | [
"0.7334346",
"0.7189511",
"0.6885171",
"0.68381417",
"0.67848647",
"0.6780965",
"0.6780965",
"0.6780965",
"0.67765075",
"0.6705136",
"0.66225725",
"0.66029686",
"0.6592665",
"0.6518074",
"0.6517523",
"0.6512461",
"0.64840037",
"0.64702946",
"0.6445819",
"0.63242",
"0.62960696... | 0.71592325 | 2 |
Inherit this method because set the product offer timer data if it's available | def get_combination_info_website(self, product_template_id, product_id, combination, add_qty, **kw):
res = super(EptWebsiteSaleVariantController, self).get_combination_info_website(
product_template_id=product_template_id,
product_id=product_id,
combination=combination,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _slot_timer_info_later(self, _sender, _data):\n self.request_info()\n self._info_timer = None",
"def supplement_data_instance_time(self, supplement_data_instance_time):\n self._supplement_data_instance_time = supplement_data_instance_time",
"def plugged_in(self):\n # Add 1 day t... | [
"0.6040981",
"0.5612528",
"0.5608754",
"0.54891753",
"0.547835",
"0.5427451",
"0.54077035",
"0.5405702",
"0.54018724",
"0.54005957",
"0.53656965",
"0.5334523",
"0.531374",
"0.53128415",
"0.5299668",
"0.5265234",
"0.52563024",
"0.5254337",
"0.52404577",
"0.5236943",
"0.5221990... | 0.0 | -1 |
Sets the number of people served to a given specific number. | def set_number_served(self, number_served):
self.number_served = number_served | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_number_people_served(self,n_served):\n self.number_people_served+=n_served",
"def set_number_served(self, served):\n\t\tself.number_served = served",
"def set_number_served(self, number):\n if number >= self.number_served:\n print(str(number) + \" people have been served today!\")\... | [
"0.7445296",
"0.73250484",
"0.7250046",
"0.71915674",
"0.7170619",
"0.7089039",
"0.70438325",
"0.7038195",
"0.69886005",
"0.69315803",
"0.69110185",
"0.6907122",
"0.69047767",
"0.69047767",
"0.6863942",
"0.6823399",
"0.6772982",
"0.67703855",
"0.67084694",
"0.6613954",
"0.660... | 0.68563503 | 18 |
Whether spec is discrete. | def is_discrete(self):
return not self.dtype.is_floating_point | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isdiscrete(self):\n return all(r.isdiscrete() for r in self.ranges())",
"def isdiscrete(self):\n return all(r.isdiscrete() for r in self.ranges())",
"def is_discrete(self) -> bool:\n return np.issubdtype(self.dtype, np.integer)",
"def isdiscrete(self):\n return True",
"def i... | [
"0.7705969",
"0.7705969",
"0.7503275",
"0.7414743",
"0.72821647",
"0.70999014",
"0.69100654",
"0.61592835",
"0.60454565",
"0.58650744",
"0.5811822",
"0.5693493",
"0.5678432",
"0.5673987",
"0.56400084",
"0.56328136",
"0.56300426",
"0.5602277",
"0.55721486",
"0.5526529",
"0.552... | 0.73255366 | 4 |
Whether spec is continuous. | def is_continuous(self):
return self.dtype.is_floating_point | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_continuous():\n raise NotImplementedError",
"def is_continuous(self) -> bool:\n return np.issubdtype(self.dtype, np.floating)",
"def isdiscrete(self):\n return all(r.isdiscrete() for r in self.ranges())",
"def isdiscrete(self):\n return all(r.isdiscrete() for r in self.rang... | [
"0.7703639",
"0.7153393",
"0.6525154",
"0.6525154",
"0.6379025",
"0.6361553",
"0.613904",
"0.6122912",
"0.61117303",
"0.6076641",
"0.6046332",
"0.5994834",
"0.59490955",
"0.58875126",
"0.58850455",
"0.5854197",
"0.5837462",
"0.58296144",
"0.5799578",
"0.57703644",
"0.5761626"... | 0.6861293 | 2 |
Create a zero tensor from the spec. | def zeros(self, outer_dims=None):
return torch.zeros(self._calc_shape(outer_dims), dtype=self._dtype) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zero_tensor() -> tf.Tensor:\n\n return tf.zeros([3, 3])",
"def make_zero(cls, dim: int):\n return cls([0] * dim)",
"def zero_state(self, batch_size, dtype):\n return tf.zeros([batch_size, self._num_units * 2])",
"def zeros(shape):\n return torch.zeros(shape)",
"def zero_nil_slot... | [
"0.7858074",
"0.717447",
"0.6960474",
"0.6849783",
"0.6839369",
"0.6821967",
"0.6760834",
"0.671803",
"0.6622162",
"0.65999997",
"0.65133977",
"0.64087594",
"0.63806486",
"0.6368841",
"0.6366973",
"0.63580996",
"0.63208354",
"0.6300794",
"0.6276351",
"0.62408286",
"0.6228245"... | 0.68291765 | 5 |
Create a zero numpy.ndarray from the spec. | def numpy_zeros(self, outer_dims=None):
return self.numpy_constant(0, outer_dims) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zero_array() -> np.ndarray:\n\n return np.zeros([3, 3])",
"def zero_init(self, shape):\r\n return np.zeros(shape)",
"def numpy_zero(dtype: np.dtype) -> any:\n return np.zeros(1, dtype=dtype)[0]",
"def CreateEmptyArray(self, dtype, numEntries):\n typeShape = (numEntries,) + self.GetDat... | [
"0.7228184",
"0.6836966",
"0.6700869",
"0.6649734",
"0.65916145",
"0.65770566",
"0.6382568",
"0.632227",
"0.63152",
"0.6279431",
"0.6251205",
"0.6243239",
"0.6143071",
"0.6116579",
"0.60620534",
"0.6015471",
"0.5989827",
"0.59719455",
"0.59630525",
"0.5945537",
"0.59344864",
... | 0.66355354 | 4 |
Create a tensor filled with random numbers from a std normal dist. | def randn(self, outer_dims=None):
shape = self._shape
if outer_dims is not None:
shape = tuple(outer_dims) + shape
return torch.randn(*shape, dtype=self._dtype) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def randn(mean: float = 0.0, sd: float = 1.0):\n return Float(None, None).normal(mean, sd)",
"def random_normal(*size):\n return torch.randn(*size)",
"def rand_norm(mean=0, sd=1):\n return _func(\"rnorm\", TFloat64(), mean, sd)",
"def random_st_vec(dim):\n st_vec = np.random.randn(dim) + 1j*np.ra... | [
"0.74842525",
"0.7076302",
"0.70673454",
"0.6924417",
"0.6898352",
"0.6898352",
"0.67760146",
"0.6775647",
"0.66211313",
"0.6537649",
"0.6500808",
"0.64956295",
"0.63966215",
"0.638379",
"0.6377267",
"0.63724256",
"0.6349785",
"0.6333673",
"0.63105536",
"0.63098615",
"0.62622... | 0.57611597 | 86 |
Get a User object from the username. | def get_user(self, user_id):
User = get_user_model()
try:
return User.objects.get(pk=user_id)
except User.DoesNotExist:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_user_by_username(cls, username) -> \"UserModel\":\n return UserModel.query.filter_by(username=username).first()",
"def get_user(cls, username):\n key = ndb.Key(User, username.lower())\n u = key.get()\n return u",
"def _user(username):\n return Persistence.get_one(User._ge... | [
"0.84020597",
"0.8190537",
"0.81642073",
"0.816235",
"0.816235",
"0.81273484",
"0.8096667",
"0.80245054",
"0.7980793",
"0.79803777",
"0.7979431",
"0.7965284",
"0.7957627",
"0.79560757",
"0.7871523",
"0.78303033",
"0.7755817",
"0.77533484",
"0.7739208",
"0.7720287",
"0.7692663... | 0.0 | -1 |
Get a User object from the username. | def get_user(self, user_id):
User = get_user_model()
try:
return User.objects.get(pk=user_id)
except User.DoesNotExist:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_user_by_username(cls, username) -> \"UserModel\":\n return UserModel.query.filter_by(username=username).first()",
"def get_user(cls, username):\n key = ndb.Key(User, username.lower())\n u = key.get()\n return u",
"def _user(username):\n return Persistence.get_one(User._ge... | [
"0.84020597",
"0.8190537",
"0.81642073",
"0.816235",
"0.816235",
"0.81273484",
"0.8096667",
"0.80245054",
"0.7980793",
"0.79803777",
"0.7979431",
"0.7965284",
"0.7957627",
"0.79560757",
"0.7871523",
"0.78303033",
"0.7755817",
"0.77533484",
"0.7739208",
"0.7720287",
"0.7692663... | 0.0 | -1 |
Get a User object from the username. | def get_user(self, user_id):
User = get_user_model()
try:
return User.objects.get(pk=user_id)
except User.DoesNotExist:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_user_by_username(cls, username) -> \"UserModel\":\n return UserModel.query.filter_by(username=username).first()",
"def get_user(cls, username):\n key = ndb.Key(User, username.lower())\n u = key.get()\n return u",
"def _user(username):\n return Persistence.get_one(User._ge... | [
"0.84020597",
"0.8190537",
"0.81642073",
"0.816235",
"0.816235",
"0.81273484",
"0.8096667",
"0.80245054",
"0.7980793",
"0.79803777",
"0.7979431",
"0.7965284",
"0.7957627",
"0.79560757",
"0.7871523",
"0.78303033",
"0.7755817",
"0.77533484",
"0.7739208",
"0.7720287",
"0.7692663... | 0.0 | -1 |
Local contrast normalization (LCN) both input output are numpy | def apply_lcn(patch, P=3, Q=3, C=1):
# patch = patch.numpy()
kernel = np.ones((P, Q)) / (P * Q)
patch_mean = convolve2d(patch, kernel, boundary='symm', mode='same')
patch_sm = convolve2d(np.square(patch), kernel, boundary='symm', mode='same')
patch_std = np.sqrt(np.maximum(patch_sm - np.square(patch... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalize_lc(lc_array: np.array) -> np.array:\n\n result = np.zeros((lc_array.shape[0], 3))\n result[:, 0] = lc_array[:, 0]\n result[:, 0] -= lc_array[0, 0]\n for i in range(1, 3):\n norm = (lc_array[:, i] - np.min(lc_array[:, i])) / \\\n np.ptp(lc_array[:, i])\n result[:, ... | [
"0.6875769",
"0.620212",
"0.6145795",
"0.61407727",
"0.61258423",
"0.61258423",
"0.61048985",
"0.60450596",
"0.5949472",
"0.59427965",
"0.5675034",
"0.56650037",
"0.56439906",
"0.56355834",
"0.56349516",
"0.5627102",
"0.5626889",
"0.5617822",
"0.5610445",
"0.5596755",
"0.5593... | 0.53590935 | 55 |
dataclasses don't allow __init__ to be called with excess fields. This method allows the API to add fields in the response body without breaking the client | def _filter_excess_fields(cls, obj_dict: Dict) -> None:
excess = set(obj_dict.keys()) - {f.name for f in fields(cls)}
for f in excess:
del obj_dict[f] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, fields, **kwargs):\n super().__setattr__(\"_data\", {})\n super().__setattr__(\"_fields\", fields)\n self._data.update(kwargs)",
"def __init__(self):\n super(RequestData, self).__init__()\n # program wide fields\n self.program = None\n self.program_timeline = N... | [
"0.765049",
"0.6636863",
"0.660086",
"0.6592706",
"0.6565435",
"0.65412974",
"0.64065313",
"0.6367791",
"0.63598794",
"0.6336004",
"0.6324177",
"0.62944007",
"0.629058",
"0.6284938",
"0.6271536",
"0.6269096",
"0.6254455",
"0.62496036",
"0.6220238",
"0.62150633",
"0.62095046",... | 0.0 | -1 |
Wrap the given L{INavigableFragment} in an appropriate L{_FragmentWrapperMixin} subclass. | def _wrapNavFrag(self, frag, useAthena):
username = self._privateApplication._getUsername()
cf = getattr(frag, 'customizeFor', None)
if cf is not None:
frag = cf(username)
if useAthena:
pageClass = GenericNavigationAthenaPage
else:
pageClass = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enclosing_fragment(self):\n raise NotImplementedError(\n 'operation enclosing_fragment(...) not yet implemented')",
"def wrapinstance(ptr, base=None):\n if ptr is None:\n return None\n ptr = long(ptr)\n if base is None:\n qObj = shiboken2.wrapInstance(ptr, QtCore.QObj... | [
"0.5275763",
"0.46550342",
"0.45969862",
"0.43566027",
"0.43334794",
"0.42509282",
"0.42282885",
"0.41647467",
"0.415188",
"0.41402957",
"0.41366547",
"0.41366547",
"0.4093303",
"0.4086942",
"0.40761808",
"0.3960692",
"0.3953822",
"0.3947945",
"0.39425498",
"0.39227396",
"0.3... | 0.55026114 | 0 |
Add primary application navigation to the given tag. L{xmantissa.webnav.applicationNavigation} | def render_applicationNavigation(self, ctx, data):
return applicationNavigation(
ctx, self.translator, self.pageComponents.navigation) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def app_nav(context):\n url_name = get_url_name(context)\n namespace = get_namespace(context)\n\n cache_id = \"{}:{}x\".format(context['request'].user.username, context.request.path)\n cache_key = make_template_fragment_key('app_nav', [cache_id])\n context['app_nav_cache_id'] = cache_id\n\n # Onl... | [
"0.6069083",
"0.5316972",
"0.52795714",
"0.5253201",
"0.5203747",
"0.51080513",
"0.48292676",
"0.48009315",
"0.47688648",
"0.4762475",
"0.4719742",
"0.4681091",
"0.4679551",
"0.46566606",
"0.4648488",
"0.46475077",
"0.46404347",
"0.4606027",
"0.4583447",
"0.45805672",
"0.4565... | 0.68104047 | 0 |
Initialize the class with proper information. Set the issue numbers, description and affected datasets. As other tickets may affect this SQL, append them to the list of Jira Issues. DO NOT REMOVE ORIGINAL JIRA ISSUE NUMBERS! | def __init__(self, project_id, dataset_id, sandbox_dataset_id):
desc = (
'Ensures consistency when the datetime field is null or when the date and datetime fields are equal by '
'(1) If the datetime field is null: Setting the datetime field\'s values to the date field\'s date and '
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n self.issues = []",
"def __init__(self, project_id, dataset_id, sandbox_dataset_id,\n mapping_dataset_id, mapping_table_id, affected_tables,\n issue_numbers):\n desc = f'Change PIDs to RIDs in specified tables'\n super().__init__(issue_num... | [
"0.67575985",
"0.64895386",
"0.6307598",
"0.6191781",
"0.61233777",
"0.60856086",
"0.60201824",
"0.5963435",
"0.58960617",
"0.5784933",
"0.5747214",
"0.56955004",
"0.5693891",
"0.5621872",
"0.55905366",
"0.55579096",
"0.55164796",
"0.54902625",
"0.54434323",
"0.54345286",
"0.... | 0.5434953 | 19 |
Creates a convolutional layer, with optional batch normalization. | def conv(
in_channels,
out_channels,
kernel_size,
stride=2,
padding=1,
batch_norm=True,
init_zero_weights=False,
):
layers = []
conv_layer = nn.Conv2d(
in_channels=in_channels,
out_channels=out_channels,
kernel_size=kernel_size,
stride=stride,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _convolutional_layer(input, filters, strides, is_training):\n x = tf.layers.conv2d(\n input,\n filters=filters,\n kernel_size=(3, 3),\n strides=strides,\n padding='same',\n activation=tf.nn.relu,\n kernel_initializer=tf.truncat... | [
"0.7667875",
"0.7651713",
"0.72974366",
"0.72701126",
"0.7193253",
"0.7057059",
"0.7032488",
"0.7028705",
"0.69842595",
"0.68181044",
"0.68163323",
"0.68050665",
"0.6804241",
"0.67824125",
"0.6777159",
"0.6777159",
"0.67754936",
"0.6759351",
"0.6757672",
"0.674374",
"0.674237... | 0.661139 | 34 |
This function computes the local density of states at given x0 values | def getLDOS(self,Exmin,Exmax,dE,pts,x0s,initiator=""):
self.running["LDOS"] = True
N = self.N
X = self.X
bz = self.bz
k1,k2 = self.K
Ek = self.Ek
Gnm = self.Gnm
Coeff = self.Coeff
n = int((1+(2*N+1)**2)/2) ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def density(self, x):\n raise NotImplementedError",
"def neutral_density(ds):\n\n import pygamma\n\n def gamma_n_wrapper(s, t, p, lon, lat):\n if np.isscalar(lat):\n lat = lat * np.ones_like(s[..., 0])\n if np.isscalar(lon):\n lon = lon * np.ones_like(s[..., 0])\n... | [
"0.67535",
"0.6301185",
"0.62517494",
"0.6243695",
"0.61987746",
"0.61108994",
"0.6079942",
"0.6073509",
"0.6061938",
"0.59281474",
"0.59075",
"0.58740646",
"0.5756983",
"0.5750472",
"0.56862855",
"0.568451",
"0.5647962",
"0.56398594",
"0.5621359",
"0.56159073",
"0.5614864",
... | 0.0 | -1 |
creates dictonary for translation of symbolic jump cinstruction into binary number. | def initialze_jump_table():
jump_table = {}
jump_table["null"] = "000"
jump_table["JGT"] = "001"
jump_table["JEQ"] = "010"
jump_table["JGE"] = "011"
jump_table["JLT"] = "100"
jump_table["JNE"] = "101"
jump_table["JLE"] = "110"
jump_table["JMP"] = "111"
return jump_table | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize_opcode_dict(self): \n self._opcode_dict[0] = 'Special-Delta'\n self._opcode_dict[2] = 'J'\n self._opcode_dict[3] = 'JAL'\n self._opcode_dict[int('010001', 2)] = 'FP'\n self._opcode_dict[int('000011', 2)] = 'FP'\n self._opcode_dict[int('000100', 2)] = 'BEQ'\n... | [
"0.5801568",
"0.5628427",
"0.54986286",
"0.5495548",
"0.53584135",
"0.5246504",
"0.52365047",
"0.5194354",
"0.5186994",
"0.5142676",
"0.50802696",
"0.50799894",
"0.50656277",
"0.50403625",
"0.50308365",
"0.50306576",
"0.50199693",
"0.49806124",
"0.49738124",
"0.4952168",
"0.4... | 0.69189817 | 0 |
Constructor which can be provided with data read by the sensor, and optionally a timestamp | def __init__( self, data, timestamp=0.0 ):
self.data = data
self.timestamp = timestamp | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, timestamp, data):\n\n self.timestamp = timestamp\n self.data = data",
"def __init__(self, timestamp):\n\n self.timestamp = timestamp",
"def __init__(self, timestamp, open, high, low, close, volume):\n self.timestamp = timestamp\n self.open=float(open); self... | [
"0.8519984",
"0.77371466",
"0.738199",
"0.72458893",
"0.6743788",
"0.66743803",
"0.66622233",
"0.6616083",
"0.65755975",
"0.6553264",
"0.65338635",
"0.64938253",
"0.6456368",
"0.6405271",
"0.63723433",
"0.6359877",
"0.63517994",
"0.62478554",
"0.62381345",
"0.62354684",
"0.62... | 0.8477058 | 1 |
Receives amplitude proportion, returns decibel difference | def amp2Db(self, amp_difference):
return 20.*n.log10(amp_difference) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delta_amplitude(self):\n self._sbvk # This is where _delta is calculated.\n return self._delta",
"def gain(dB):\n return 10.**(dB/10.)",
"def getPre(meaVolt):\n return meaVolt * 250 / 1024 - 25",
"def mag2dB(yf):\n return 20*np.log10(yf)",
"def deltam():\n mismatch = 0.2\n r... | [
"0.61772776",
"0.59828645",
"0.5973153",
"0.591048",
"0.5700092",
"0.569311",
"0.5628703",
"0.5585981",
"0.55717283",
"0.5557228",
"0.5533258",
"0.54857457",
"0.54810107",
"0.5469084",
"0.5465479",
"0.5460253",
"0.54579186",
"0.54492384",
"0.5442953",
"0.54169136",
"0.5411648... | 0.0 | -1 |
Get list of overlapping window bounds for a larger image. | def get_slice_bounds(image_size, slice_size=(1024, 1024),
min_window_overlap=(128, 128)):
assert isinstance(slice_size[0], int)
assert isinstance(slice_size[1], int)
assert isinstance(min_window_overlap[0], int)
assert isinstance(min_window_overlap[1], int)
ideal_intervals = [w... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bounds(self):\n return self._bboxes[0][0] #TODO: merge all coverages",
"def bounds(self):\n try:\n pts = self.points()\n xmin, ymin, zmin = np.min(pts, axis=0)\n xmax, ymax, zmax = np.max(pts, axis=0)\n return [xmin, xmax, ymin, ymax, zmin, zmax]\n ... | [
"0.6856592",
"0.6805595",
"0.6757625",
"0.66712826",
"0.6654698",
"0.66150177",
"0.66064227",
"0.65001124",
"0.6457427",
"0.64500105",
"0.64430887",
"0.6438013",
"0.6438013",
"0.6401948",
"0.6395389",
"0.63488245",
"0.6344579",
"0.63270247",
"0.6322371",
"0.63109213",
"0.6303... | 0.6388739 | 15 |
Initialize the game, and create game resources. | def __init__(self):
pygame.init()
self.settings = Settings()
self.screen = pygame.display.set_mode((0, 0), pygame.FULLSCREEN)
self.settings.screen_width = self.screen.get_rect().width
self.settings.screen_height = self.screen.get_rect().height
pygame.display.set_caption(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_init(self):\n pygame.init()\n\n easel.init_easel()\n\n init_game(\n player_details=[\n ('Caroline', RandomAI()),\n ('Nigel', RandomAI()),\n ('Issie', RandomAI()),\n ('Coen', None)\n ],\n )\n\n ... | [
"0.71607727",
"0.70706403",
"0.7055453",
"0.6910038",
"0.68276536",
"0.68254423",
"0.67744815",
"0.6696387",
"0.6690805",
"0.6640151",
"0.6568064",
"0.6560442",
"0.6505847",
"0.6490476",
"0.64599574",
"0.6452469",
"0.6450821",
"0.64494556",
"0.6435921",
"0.64351606",
"0.64314... | 0.0 | -1 |
Drop the entire fleet and change the fleet's direction. | def changeFleetDirection(self):
for alien in self.aliens.sprites():
alien.rect.y += self.settings.fleetDropSpeed
self.settings.fleetDirection *= -1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _change_fleet_direction(self):\n for enemy in self.enemies.sprites():\n enemy.rect.y += self.settings.fleet_drop_speed\n self.settings.fleet_direction *= -1\n # END _change_fleet_direction",
"def _change_fleet_direction(self):\r\n\t\tfor alien in self.aliens.sprites():\r\n\t\t... | [
"0.70827883",
"0.7077283",
"0.7072649",
"0.69704396",
"0.69377816",
"0.69377816",
"0.69377816",
"0.66406894",
"0.66315407",
"0.65605664",
"0.6543642",
"0.6543642",
"0.64740723",
"0.6417027",
"0.6397298",
"0.63815767",
"0.62065506",
"0.6049595",
"0.6026479",
"0.6014412",
"0.60... | 0.72617275 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.