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 |
|---|---|---|---|---|---|---|
Return the independent variable | def independent_variable(self):
return self._independent_variable | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def independent(self):\n return self.x",
"def independent_variables(self):\n return self._independent_variables",
"def var(self,i): # TODO: change to property to access (read only?) X?\n return Var(i,self.dims[i])",
"def dependent(self):\n return self.y",
"def get_variable(x):\n ... | [
"0.8070098",
"0.70679766",
"0.64576",
"0.6426048",
"0.63628656",
"0.63345295",
"0.6317649",
"0.62160623",
"0.6196762",
"0.60668665",
"0.60254407",
"0.5995482",
"0.598136",
"0.5965164",
"0.5939327",
"0.5936174",
"0.592209",
"0.5905915",
"0.5862706",
"0.5856919",
"0.5852582",
... | 0.8211715 | 0 |
Download a zipfile from DATA_URL decompress it and put results in dest_dir | def do_download( data_url, dest_dir,
skip_download=False,
skip_decompress=False,
remove_zip_after=False ) :
zip_file_path = dest_dir + '/tmp_file.zip'
#%%
if not skip_download :
import urllib.request
response = urllib.request.urlopen(dat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def download_one_zip(data_url, data_dir):\r\n\r\n zipfile_path, unzip_dir = zip_file_name_from_url(data_url, data_dir)\r\n if not is_there_file(zipfile_path, unzip_dir):\r\n if not os.path.isdir(unzip_dir):\r\n os.makedirs(unzip_dir)\r\n r = requests.get(data_url, stream=True)\r\n ... | [
"0.78328586",
"0.7798352",
"0.76649535",
"0.7604983",
"0.75774753",
"0.7538702",
"0.75202626",
"0.7494005",
"0.74863935",
"0.74813175",
"0.747373",
"0.74567354",
"0.74397504",
"0.74328345",
"0.74316996",
"0.7350973",
"0.7334047",
"0.7311569",
"0.71952146",
"0.7154378",
"0.714... | 0.75083846 | 7 |
Copy one image with to either train_dir or test_dir, decided at random based on train_prop | def copy_one_image( class_id, orig_path, train_dir, test_dir, train_prop ) :
img = skimage.io.imread(orig_path)
img_st = { 'class_id' : class_id,
'orig_path' : orig_path,
'shape0' : img.shape[0],
'shape1' : img.shape[1],
'shape2' : img.shape[2] }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test(train_out_dir):\n above = os.path.join(train_out_dir, '..')\n os.chdir(above)\n if not os.path.exists(\"test\"):\n os.mkdir(\"test\")\n\n for sdir in os.listdir(train_out_dir):\n cur_dir = os.path.join(train_out_dir, sdir)\n list_curr_dir = os.listdir(cur_dir)\n ran... | [
"0.71218294",
"0.6293875",
"0.62305844",
"0.6200001",
"0.6076529",
"0.60421854",
"0.5951492",
"0.59054196",
"0.5895511",
"0.58121043",
"0.5757838",
"0.57302606",
"0.5708046",
"0.56875736",
"0.56785256",
"0.5667212",
"0.5642194",
"0.5633676",
"0.5632049",
"0.5587862",
"0.55614... | 0.76671845 | 0 |
Oracle is picky about dates. This function takes a previously validated date format and returns a formatted string for inserting into database | def convertToOracleHappyName(self, date_string):
formatted_date = ''
# First handle the date portion since it must exist for a valid submission
if date_string.find(' ') == -1:
# Date only
formatted_date = 'to_date(\'%s\', \'%s\')' % (date_string, 'MM/DD/YYYY')
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sql_date(date):\n return \"to_date('{}', 'dd.mm.yyyy')\".format(date)",
"def validate_date(column_name, value, date_format, column_data_type=\"date\"):\n value = value.replace(\"T\", \" \")\n dtpart = value.split(\" \")\n value = dtpart[0]\n try:\n datetime.strptime(value, date_format)\... | [
"0.6463332",
"0.6300693",
"0.6172106",
"0.61529535",
"0.6138918",
"0.6064596",
"0.6038927",
"0.6012155",
"0.5974856",
"0.59460264",
"0.594372",
"0.59282184",
"0.5916814",
"0.59145314",
"0.5894109",
"0.58732176",
"0.586847",
"0.58648974",
"0.58288556",
"0.58248925",
"0.5793888... | 0.6505158 | 0 |
Get the project type of the barcode. Return a strings of project type. | def getBarcodeProjType(self, barcode):
con = self.getMetadataDatabaseConnection()
result = con.cursor()
con.cursor().callproc('get_barcode_proj_type', [barcode, result])
proj_type = result.fetchall()
if proj_type:
return proj_type[0][0]
else:
retur... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def project_type(self):\n project_type = self.__class__.__name__.lower()\n if project_type == 'baseproject':\n project_type = None\n return project_type",
"def get_project_type(build_rules_list, verbose=False, project_type=None):\n\n # Make sure the input is ProjectTypes\n i... | [
"0.6620398",
"0.6439979",
"0.6298783",
"0.6249022",
"0.59994674",
"0.59262997",
"0.5893659",
"0.5893659",
"0.5882683",
"0.5882683",
"0.5882683",
"0.5882683",
"0.5882683",
"0.5882683",
"0.5882683",
"0.5882683",
"0.5882683",
"0.5882683",
"0.5882683",
"0.5882683",
"0.5882683",
... | 0.83946776 | 0 |
Create a `~SparseArray` from a numpy array. | def from_array(cls, data, min_value=0.0):
shape = data.shape
idx = np.where(data > min_value)
idx = np.ravel_multi_index(idx, shape)
data = data[data > min_value]
return cls(shape, idx, data) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _conv_array_to_sparse(arr):\n if has_scipy():\n from scipy.sparse import isspmatrix as scipy_sparse_isspmatrix\n else:\n from cuml.internals.import_utils import (\n dummy_function_always_false as scipy_sparse_isspmatrix,\n )\n if scipy_sparse_isspmatrix(arr):\n r... | [
"0.71068984",
"0.6881982",
"0.66462433",
"0.64401287",
"0.6351757",
"0.6259173",
"0.6229246",
"0.61437935",
"0.6057513",
"0.60180575",
"0.5976613",
"0.5949867",
"0.591565",
"0.5846259",
"0.5812716",
"0.57932925",
"0.5772403",
"0.57660246",
"0.5754035",
"0.5747604",
"0.573727"... | 0.0 | -1 |
Get array values at indices ``idx_in``. | def get(self, idx_in):
shape_out = idx_in[0].shape
idx_flat_in, msk_in = self._to_flat_index(idx_in)
idx, msk = find_in_array(idx_flat_in, self.idx)
val_out = np.full(shape_out, self._fill_value)
val_out.flat[np.flatnonzero(msk_in)[msk]] = self._data[idx[msk]]
return np.s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getidx(self, ind: Union[str, int]) -> List[Any]:\n output = []\n for data in self.data:\n output.append(data[ind])\n\n return output",
"def getidx(self, ind: Union[str, int]) -> List[Any]:\n output = []\n for data in self.data:\n output.append(data[ind... | [
"0.6820564",
"0.6808787",
"0.60364795",
"0.5868214",
"0.5833609",
"0.5755304",
"0.57414734",
"0.57414734",
"0.5713776",
"0.5610782",
"0.5601043",
"0.556262",
"0.5530298",
"0.5509058",
"0.54814804",
"0.5443044",
"0.54056257",
"0.5363668",
"0.5338236",
"0.53075165",
"0.52944154... | 0.71068025 | 0 |
Initializes a piece that is capable of moving | def __init__(self, input_color, location, white_symbol, black_symbol):
assert isinstance(input_color, Color)
assert isinstance(location, Location)
assert isinstance(white_symbol, str)
assert isinstance(black_symbol, str)
self.color = input_color
self.location = location
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, piece):\n self.piece = piece",
"def __init__(self, board, position, player, piece_type):\n self.board = board\n self.position = position\n self.player = player\n self.piece_behavior = piece_type",
"def __init__(self, size):\n self.size = size\n ... | [
"0.71445894",
"0.71302414",
"0.7005115",
"0.6896317",
"0.6803345",
"0.67610323",
"0.67067343",
"0.6694958",
"0.6650613",
"0.66026425",
"0.65401554",
"0.6519343",
"0.6515273",
"0.6515273",
"0.6486686",
"0.64633214",
"0.6454891",
"0.64491045",
"0.6441329",
"0.6427789",
"0.64267... | 0.0 | -1 |
Assign only product as reference product. Skips datasets that already have a reference product or no production exchanges. Production exchanges must have a ``name`` and an amount. | def assign_only_product_as_production(db):
#TODOBW3
for ds in db:
if ds.get("reference product"):
continue
products = [x for x in ds.get('exchanges', []) if x.get('type') == 'production']
if len(products) == 1:
product = products[0]
assert product['nam... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def product(self, product):\n self._product = product",
"def product(self, product):\n\n self._product = product",
"def product(self, product):\n\n self._product = product",
"def update_cement_production_datasets(self, name, ref_prod):\n # Fetch proxies\n # Delete old datas... | [
"0.6366862",
"0.62054414",
"0.62054414",
"0.6040472",
"0.6039596",
"0.5963649",
"0.5448757",
"0.5417166",
"0.5417166",
"0.53466594",
"0.5336359",
"0.5303624",
"0.52670604",
"0.52541906",
"0.5254117",
"0.5239951",
"0.5239024",
"0.5239024",
"0.5233707",
"0.5222708",
"0.5211903"... | 0.70998734 | 0 |
Compute the Mean Square Error as defined in class. Takes as input the targeted y, the sample matrix X and the feature fector w. | def compute_mse(y, tx, w):
e = y - tx@w
mse = e.T.dot(e) /(2*len(e))
return mse | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mean_square_error(y, y_pred, w):\n return np.average(((y_pred - y) ** 2), weights=w)",
"def calculate_mean_squared_error(self, X, y):\n mserror = 0\n results = self.predict(X)\n \n mserror = mean_squared_error(results,y)\n #print(error)\n return mserror",
"def c... | [
"0.7519256",
"0.7230931",
"0.7225373",
"0.7168808",
"0.7127767",
"0.69846994",
"0.6917657",
"0.69080395",
"0.6809563",
"0.67517066",
"0.6577833",
"0.6565578",
"0.6558008",
"0.6540199",
"0.6523615",
"0.63881266",
"0.63775766",
"0.6328799",
"0.63175803",
"0.63174653",
"0.630474... | 0.0 | -1 |
Compute an estimated solution of the problem y = tx @ w and the associated error using Stochastic Gradient Descent. | def least_squares_SGD(y, tx, initial_w=None, batch_size=1, max_iters=50, gamma=0.00005):
# Define parameters to store w and loss
if np.all(initial_w == None): initial_w = np.zeros(tx.shape[1])
losses = []
w = initial_w
for n_iter in range(max_iters):
for y_batch, tx_batch in batch_iter(y, tx... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def least_squares_GD(y, tx, initial_w, max_iters, gamma, verbose=False):\n return gradient_descent(y, tx, initial_w, max_iters, gamma, compute_mse, \n compute_mse_gradient, verbose=verbose)",
"def fit(self, w):\n w_former = w\n w_next = w\n w_t = w\n w_t_... | [
"0.6856589",
"0.68494356",
"0.6760678",
"0.67285097",
"0.66885006",
"0.6684119",
"0.6680294",
"0.66779876",
"0.6659919",
"0.6657839",
"0.6656694",
"0.66373754",
"0.66318285",
"0.6625516",
"0.65983826",
"0.6582635",
"0.65447026",
"0.6544425",
"0.6541134",
"0.6539986",
"0.65290... | 0.65275055 | 21 |
Apply the sigmoid function on t. | def sigmoid(t):
return np.exp(t)/(1+np.exp(t)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sigmoid(t):\n\n return 1.0 / (1.0 + np.exp(-t))",
"def sigmoid(t):\n sig=np.exp(t)/(1+np.exp(t))\n return sig",
"def sigmoid(t):\n return 1 / (1 + np.exp(-t))",
"def sigmoid(t):\n\tprecLim = 10\n\t\n\tt[t<=-precLim] = 0\n\tt[t>-precLim] = 1/ (1 + np.exp(-t))\n\n\treturn t",
"def sigmoid(t):... | [
"0.88741136",
"0.8870041",
"0.8825303",
"0.8571457",
"0.82834846",
"0.82468945",
"0.7952311",
"0.7939777",
"0.7936021",
"0.79155815",
"0.78916776",
"0.78916776",
"0.7866913",
"0.7857604",
"0.7857604",
"0.7857604",
"0.7857604",
"0.7857604",
"0.7857604",
"0.7857216",
"0.784499"... | 0.8936481 | 0 |
Compute one step of gradient descent for logistic regression. Takes as input the targeted y, the sample matrix w, the feature w and the learning rate gamma. Return the feature vector w and the error defined as the negative log likelihood. | def learning_by_gradient_descent(y, tx, w, gamma):
loss = calculate_loss(y,tx,w)
grad = calculate_gradient(y,tx,w)
w = w-gamma*grad
return w, loss | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def logistic_regression(y, tx, initial_w, max_iters, gamma, verbose=False):\n return gradient_descent(y, tx, initial_w, max_iters, gamma, \n compute_logistic_loss, compute_logistic_gradient, verbose=verbose)",
"def logistic_regression_gradient_descent(y, tx, initial_w, max_iters, ga... | [
"0.78798413",
"0.78597426",
"0.78100485",
"0.7748026",
"0.77464354",
"0.77353334",
"0.7730399",
"0.7690425",
"0.76503605",
"0.7603831",
"0.75576955",
"0.75515443",
"0.75199664",
"0.74932945",
"0.74167645",
"0.73702186",
"0.7361575",
"0.72960067",
"0.7278545",
"0.72506195",
"0... | 0.77873665 | 3 |
Compute an estimated solution of the problem y = sigmoid(tx @ w) and the associated error using Gradient Descent. Note that this method is a variant of logistic_regression() but with an added regularization term lambda_. This method is equivalent to the minimization problem of finding w such that the negative log likel... | def reg_logistic_regression(y, tx, lambda_, initial_w=None, max_iters=100, gamma=0.009, batch_size=1):
# init parameters
if np.all(initial_w == None): initial_w = np.zeros(tx.shape[1])
threshold = 1e-8
losses = []
y = (1 + y) / 2
# build tx
w = initial_w
# start the logistic regression
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def penalized_logistic_regression(y, tx, w, lambda_):\n\tgradient = calculate_gradient(y, tx, w) + 2.0 * lambda_ * w\n\tH = calculate_hessian(y, tx, w) + 2.0 * lambda_\n\t\n\treturn gradient, H",
"def penalized_logistic_regression(y, tx, w, lambda_):\n penality = lambda_*np.linalg.norm(w)**2\n diag = np.di... | [
"0.79392076",
"0.7720822",
"0.7404823",
"0.7256978",
"0.72463864",
"0.72109365",
"0.71910673",
"0.71692044",
"0.7163605",
"0.713457",
"0.7132974",
"0.7122508",
"0.7085594",
"0.70796144",
"0.7075445",
"0.7069283",
"0.7061211",
"0.704969",
"0.7015332",
"0.7014146",
"0.6980591",... | 0.7283843 | 3 |
Compute softmax values for each sets of scores in x. | def softmax(x):
e_x = np.exp(x - np.max(x))
return e_x / e_x.sum(axis=0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def softmax(self, scores):\n\n\n # for each sample, for each class ,caclulate\n # np.exp(scores) : still (n_samples, n_classes)\n\n # axis = 1\n # a00, a01, a02 as a sinlge one to perfrom np_sum\n # which is the same sample \n # sum_exp : still (n_samples, 1)\n\n # ... | [
"0.7796294",
"0.7760558",
"0.7759004",
"0.77567077",
"0.76577055",
"0.76577055",
"0.76577055",
"0.76577055",
"0.7585655",
"0.743143",
"0.7407772",
"0.73941606",
"0.7358175",
"0.73174125",
"0.72689486",
"0.72623265",
"0.72614294",
"0.7256868",
"0.723019",
"0.7214918",
"0.72017... | 0.72012734 | 21 |
Return matrix to rotate about axis defined by point and direction. | def rotation_matrix(angle, direction, point=None):
sina = math.sin(angle)
cosa = math.cos(angle)
direction = unit_vector(direction[:3])
# rotation matrix around unit vector
R = np.array(((cosa, 0.0, 0.0),
(0.0, cosa, 0.0),
(0.0, 0.0, cosa)), dtype=np.flo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def axisangle2matrix(angle, direction, point=None):\r\n sina = math.sin(angle)\r\n cosa = math.cos(angle)\r\n direction = unit_vector(direction[:3])\r\n # rotation matrix around unit vector\r\n R = numpy.diag([cosa, cosa, cosa])\r\n R += numpy.outer(direction, direction) * (1.0 - cosa)\r\n dir... | [
"0.7728638",
"0.7376166",
"0.73260933",
"0.72684383",
"0.68231016",
"0.68071234",
"0.6744153",
"0.6679284",
"0.6599115",
"0.65899456",
"0.65185314",
"0.6479314",
"0.6469909",
"0.6443638",
"0.64419574",
"0.639568",
"0.63933754",
"0.63706535",
"0.63692194",
"0.6365154",
"0.6360... | 0.7244205 | 4 |
Split a string into comma or blankseparated words. | def commaSep (location, dtype=""):
if location.strip() == "":
locn = None
else:
# first split on comma
temp_words = location.split (",")
words = []
for word in temp_words:
word = word.strip()
if word == "":
words.append (None)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split_by_comma_and_whitespace(s):\r\n return re.split(r'[\\s,]+', s)",
"def split_by_comma_and_whitespace(a_str):\r\n return re.split(r'[\\s,]', a_str)",
"def split_by_comma(s):\n return s.strip().split(\",\")",
"def separate_comma(s):\n return s.split(',')",
"def split_strings(text: str, d... | [
"0.7574233",
"0.73089695",
"0.71119577",
"0.6807712",
"0.6796136",
"0.67475116",
"0.67031693",
"0.6641995",
"0.6641995",
"0.65415066",
"0.6463766",
"0.6408195",
"0.64042866",
"0.6376429",
"0.6348869",
"0.63086325",
"0.62710905",
"0.6256816",
"0.625645",
"0.625645",
"0.6255660... | 0.0 | -1 |
Gets the cardholder_type of this CardholderData. | def cardholder_type(self) -> str:
return self._cardholder_type | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def card_type(self):\n return self._card_type",
"def card_type(self):\n for card_type, card_type_re in CARD_TYPES.items():\n if re.match(card_type_re, self.card_number):\n return card_type",
"def cardholder_type(self, cardholder_type: str):\n allowed_values = [\"m... | [
"0.76314133",
"0.68942827",
"0.66019166",
"0.64488554",
"0.64488554",
"0.64126927",
"0.64126927",
"0.6317985",
"0.6317985",
"0.6289097",
"0.6250084",
"0.6239345",
"0.619984",
"0.6189117",
"0.6189117",
"0.6189117",
"0.6189117",
"0.6189117",
"0.6189117",
"0.6189117",
"0.6189117... | 0.86667883 | 0 |
Sets the cardholder_type of this CardholderData. | def cardholder_type(self, cardholder_type: str):
allowed_values = ["main", "additional"] # noqa: E501
if cardholder_type not in allowed_values:
raise ValueError(
"Invalid value for `cardholder_type` ({0}), must be one of {1}"
.format(cardholder_type, allowed_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cardholder_type(self) -> str:\n return self._cardholder_type",
"def SetType(self, ct_type):\r\n\r\n self._type = ct_type",
"def cabletype(self, cabletype):\n\n self._cabletype = cabletype",
"def set_type(self, type):\n self.type = type",
"def set_type(self, type):\n s... | [
"0.70960534",
"0.61007315",
"0.60667527",
"0.59675616",
"0.59675616",
"0.5953415",
"0.59231496",
"0.58879375",
"0.57528746",
"0.5715674",
"0.56834215",
"0.56834215",
"0.56533766",
"0.565084",
"0.5626611",
"0.5626611",
"0.56197673",
"0.56150895",
"0.5599596",
"0.559772",
"0.55... | 0.80168545 | 0 |
Sets the card_data of this CardholderData. | def card_data(self, card_data: CardEmbossing):
if card_data is None:
raise ValueError("Invalid value for `card_data`, must not be `None`") # noqa: E501
self._card_data = card_data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_data(self, data):\n\n self._data = data",
"def set_data(self, data):\n\n self._data = data",
"def set_data(self, data):\n\n self._data = data",
"def set_card(self, new_card):\n self.card = new_card\n DB.update_checkpoint(self.student.get_id(), self.get_date(), self.... | [
"0.65325767",
"0.65325767",
"0.65325767",
"0.64587694",
"0.6411887",
"0.6395292",
"0.6373534",
"0.63434184",
"0.6297042",
"0.6283186",
"0.62208456",
"0.62208456",
"0.6152857",
"0.6004436",
"0.6004436",
"0.6004436",
"0.6004436",
"0.6004436",
"0.6004436",
"0.5947164",
"0.594716... | 0.7983443 | 0 |
Sets the other_identity_document_number of this CardholderData. | def other_identity_document_number(self, other_identity_document_number: PersonalIdentityDocumentInfo):
self._other_identity_document_number = other_identity_document_number | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def other_identity_document_number(self) -> PersonalIdentityDocumentInfo:\n return self._other_identity_document_number",
"def identity_document_number(self, identity_document_number: str):\n if identity_document_number is None:\n raise ValueError(\"Invalid value for `identity_document_n... | [
"0.72535783",
"0.6117745",
"0.585125",
"0.57019055",
"0.56832355",
"0.5478071",
"0.53862625",
"0.5381748",
"0.5348404",
"0.5326677",
"0.5285886",
"0.5222788",
"0.52027905",
"0.519952",
"0.5189033",
"0.51857567",
"0.5176908",
"0.5176908",
"0.5176908",
"0.5176908",
"0.5170005",... | 0.8620812 | 0 |
Gets the birth_date of this CardholderData. | def birth_date(self) -> str:
return self._birth_date | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def date_of_birth(self):\n return self.__date_of_birth",
"def birthdate_date(self):\n\n bday = self.birthdate\n if bday:\n dt = datetime.datetime.strptime(\n bday,\n \"%d %b %Y\") # not sure if this format even complies with spec\n # dt = ... | [
"0.82094276",
"0.7986733",
"0.78450865",
"0.7539563",
"0.74239874",
"0.74016047",
"0.7216146",
"0.69338423",
"0.69277805",
"0.684367",
"0.66537213",
"0.64280105",
"0.6355084",
"0.63419855",
"0.6324227",
"0.6296505",
"0.6290477",
"0.6290477",
"0.6290477",
"0.6290477",
"0.62734... | 0.84037244 | 0 |
Sets the birth_date of this CardholderData. | def birth_date(self, birth_date: str):
if birth_date is None:
raise ValueError("Invalid value for `birth_date`, must not be `None`") # noqa: E501
self._birth_date = birth_date | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_birthdate(self, date):\n\n if validate_date_format(self.birt):\n self.birt = date\n else:\n raise ValueError('Invalid date!')",
"def setBirthday(self, birthdate):\r\n self.birthday = birthdate",
"def setBirthday(self, birthdate):\n self.birthday = birth... | [
"0.8171191",
"0.81321114",
"0.81091624",
"0.7786533",
"0.7766809",
"0.7766809",
"0.76717186",
"0.7357389",
"0.7345878",
"0.7331164",
"0.71841717",
"0.6534832",
"0.6524198",
"0.6505752",
"0.6492139",
"0.648573",
"0.6454953",
"0.6410791",
"0.626877",
"0.6264513",
"0.62470746",
... | 0.78476346 | 3 |
Gets the civil_status of this CardholderData. | def civil_status(self) -> str:
return self._civil_status | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def civil_status(self, civil_status: str):\n allowed_values = [\"single\", \"married\", \"divorced\", \"widowed\", \"other\"] # noqa: E501\n if civil_status not in allowed_values:\n raise ValueError(\n \"Invalid value for `civil_status` ({0}), must be one of {1}\"\n ... | [
"0.6603595",
"0.6550432",
"0.64807695",
"0.6388875",
"0.63637215",
"0.63287115",
"0.63240993",
"0.6317975",
"0.6272981",
"0.6254054",
"0.62232906",
"0.62232906",
"0.62232906",
"0.6183971",
"0.61730146",
"0.6170431",
"0.616957",
"0.61636126",
"0.61636126",
"0.61636126",
"0.616... | 0.8453657 | 0 |
Display the site's root/home page. | def index(request):
chats = Chat.objects.all().order_by('-created_at')
if request.user.is_authenticated():
chats = chats.filter(friend_groups__in=request.user.get_profile().\
friend_groups.all().values_list('id'))
else:
chats = chats.filter(friend_groups__isnul... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def homepage():\n return render_template('home/index.html', \n title=\"Bem vindo!\")",
"def home():\n\n\treturn render_template('index.html', title='Home Page',\n\t\t\t\t\t\t year=datetime.now().year)",
"def homepage():\n\treturn render_template(\"home/a_homepage.html\", title=\... | [
"0.80540305",
"0.79357564",
"0.792574",
"0.78851664",
"0.78729856",
"0.78668326",
"0.78668326",
"0.7864881",
"0.78519654",
"0.7781757",
"0.77659875",
"0.77659875",
"0.77659875",
"0.77659875",
"0.77659875",
"0.77659875",
"0.77659875",
"0.77659875",
"0.77659875",
"0.77659875",
... | 0.0 | -1 |
Return framerate of video | def get_frame_rate(filename):
cmd = ('ffprobe -v 0 -of flat=s=_ -select_streams v:0 -show_entries '
'stream=avg_frame_rate -of default=nokey=1:noprint_wrappers=1 ' +
filename).split()
pid = subprocess.run(cmd, stdout=subprocess.PIPE,
universal_newlines=True)
if... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_video_frame_rate(filename):\n clip = VideoFileClip(filename)\n frame_rate = clip.fps\n clip.close()\n return frame_rate",
"def get_video_fps(self):\n fps = self.video.get(cv2.CAP_PROP_FPS)\n logging.info('Video FPS: {}'.format(fps))\n return fps",
"def get_fps(self):\n ... | [
"0.78256744",
"0.7818656",
"0.77910453",
"0.7693458",
"0.7687905",
"0.7682698",
"0.7585733",
"0.7531094",
"0.7522758",
"0.74421835",
"0.74298465",
"0.7403464",
"0.74018276",
"0.72677064",
"0.72575873",
"0.72174186",
"0.71892464",
"0.7186394",
"0.71397185",
"0.7015631",
"0.701... | 0.6291789 | 51 |
Preweights the old sample x. Used in the APF. Defaults to using the mean of the constructed proposal. Note that you should call `construct` prior to this function. | def pre_weight(self, y):
if not isinstance(self._kernel, (TransformedDistribution, Independent)):
return self._model.log_prob(y, self._kernel.loc)
elif isinstance(self._kernel, Independent):
return self._model.log_prob(y, self._kernel.base_dist.loc)
# TODO: Not entirely... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _update_normalize_params(self, x):\n # Flatten x to be a tensor of embeddings.\n assert x.size()[-1:] == self.mean.size()\n x_flattened = x.view(-1, x.size(-1))\n\n # Update mean.\n x_mean = x_flattened.mean(dim=0)\n self.mean.data = (\n self.normalize_decay... | [
"0.61896056",
"0.6080285",
"0.5973677",
"0.5887193",
"0.58746225",
"0.5807365",
"0.5775834",
"0.57545906",
"0.57545906",
"0.57545906",
"0.57424957",
"0.571574",
"0.570348",
"0.5703058",
"0.5700596",
"0.56989974",
"0.5697579",
"0.5694746",
"0.5689372",
"0.56738615",
"0.5665889... | 0.5436915 | 43 |
Sets up weights needed for the weak library. Integrals over domain cells are approximated as dot products of weights and the input data. | def _set_up_weights(self):
dims = self.spatiotemporal_grid.shape[:-1]
self.grid_dims = dims
# Sample the random domain centers
xt1, xt2 = self._get_spatial_endpoints()
domain_centers = np.zeros((self.K, self.grid_ndim))
for i in range(self.grid_ndim):
domain_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_weights(self):\n self._q_neuron.h(self._weights) \n self._q_neuron.x(self._weights)",
"def _initialize_weights(self):\n pass",
"def init_weights_(self):\n raise NotImplementedError",
"def init_weights(self):\n # Initialize weights\n self.apply(self._init_wei... | [
"0.7440717",
"0.72118646",
"0.72028434",
"0.7070769",
"0.70707",
"0.7063996",
"0.7063277",
"0.7030416",
"0.70205206",
"0.6954196",
"0.69414693",
"0.69345266",
"0.6909294",
"0.68723446",
"0.6860606",
"0.6860203",
"0.6855835",
"0.6833388",
"0.68092597",
"0.67853475",
"0.6770708... | 0.0 | -1 |
Takes a full set of spatiotemporal fields u(x, t) and finds the weak form of u_dot. | def convert_u_dot_integral(self, u):
K = self.K
gdim = self.grid_ndim
u_dot_integral = np.zeros((K, u.shape[-1]))
deriv_orders = np.zeros(gdim)
deriv_orders[-1] = 1
# Extract the input features on indices in each domain cell
dims = np.array(self.spatiotemporal_gr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dynstall_mhh_dxdt_simple(t, x, U, U_dot, omega, alpha_34, p):\n # States\n x1=x[0] # Downwash memory term 1\n x2=x[1] # Downwash memory term 2\n x3=x[2] # Clp', Lift coefficient with a time lag to the attached lift coeff\n x4=x[3] # f'' , Final separation point function\n # Parameters\n al... | [
"0.5998158",
"0.56871706",
"0.5502239",
"0.54859835",
"0.5480769",
"0.54804975",
"0.546871",
"0.546871",
"0.5452844",
"0.54297847",
"0.53597337",
"0.53338",
"0.5310762",
"0.52729785",
"0.5236866",
"0.5236866",
"0.52051383",
"0.5195674",
"0.5193862",
"0.5185539",
"0.51853347",... | 0.49806526 | 38 |
Look to see if the current user has permission on remote object. | def checkRemotePerm(self, permission, robject):
user = getSecurityManager().getUser()
return user.has_permission(permission, robject.primaryAq()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_access_permissions(self, request, obj, local_site=None, *args,\n **kwargs):\n return obj.is_accessible_by(request.user, local_site=local_site)",
"def has_object_permission(self, request, view, obj):\n return request.user == obj",
"def has_object_permission(se... | [
"0.76900905",
"0.76605695",
"0.76065016",
"0.75949645",
"0.75791025",
"0.75680476",
"0.75582683",
"0.7546493",
"0.75312287",
"0.7527094",
"0.7518238",
"0.7514912",
"0.74800664",
"0.74669194",
"0.74553174",
"0.7436055",
"0.7414055",
"0.7406434",
"0.7394793",
"0.7363221",
"0.73... | 0.82463056 | 0 |
DEPRECATED Split a path on its '/'. | def zenpathsplit(self, path):
return zenpathsplit(path) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pathSplit(path):\n path = re.split('/|\\\\\\\\', path)\n return path",
"def __split_path(path: str) -> List[str]:\n return [part for part in path.split('/') if part] # Splits path at '/', handles extra slashes in the process",
"def split_path(path):\n\n if type(path) != str:\n ... | [
"0.7829508",
"0.7576823",
"0.74901074",
"0.7438745",
"0.735932",
"0.71927243",
"0.7185427",
"0.71289957",
"0.7031248",
"0.7015888",
"0.6984942",
"0.69584095",
"0.69357616",
"0.6930854",
"0.6900162",
"0.68524486",
"0.6754241",
"0.66994286",
"0.6642121",
"0.66350377",
"0.659416... | 0.6228588 | 39 |
Return today's date as a string in the format 'mm/dd/yyyy'. | def todayDate(self):
return time.strftime("%m/%d/%Y", time.localtime()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def today():\n today_object = datetime.utcnow()\n today_string = today_object.strftime('%m/%d/%Y')\n return today_string",
"def get_date_today() -> str:\n return datetime.now().strftime(\"%Y-%m-%d\")",
"def get_current_date():\n return datetime.datetime.today().strftime(constants.DATE_FO... | [
"0.8569251",
"0.85343814",
"0.8127799",
"0.78554255",
"0.78010994",
"0.7673737",
"0.7590752",
"0.75893354",
"0.7579165",
"0.75487685",
"0.7527254",
"0.75068086",
"0.7370055",
"0.7368723",
"0.7271716",
"0.7259536",
"0.72562844",
"0.72463816",
"0.7242545",
"0.7181311",
"0.71658... | 0.83232874 | 2 |
Return yesterday's date as a string in the format 'mm/dd/yyyy'. | def yesterdayDate(self):
yesterday = time.time() - 24*3600
return time.strftime("%m/%d/%Y", time.localtime(yesterday)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def yesterday_string(fmt='%Y-%m-%d'):\n return (brasilia_time() - pd.Timedelta(days=1)).strftime(fmt)",
"def yesterday():\n return datetime.today() - timedelta(1)",
"def get_yesterday(x: Optional[Date] = None) -> Date:\n return (x or get_today()) - TimeDelta(days=1)",
"def get_todays_date(self):\r\n... | [
"0.7781613",
"0.75126123",
"0.66478735",
"0.66273797",
"0.65889525",
"0.65858674",
"0.6565938",
"0.6543969",
"0.6448405",
"0.62783694",
"0.62430507",
"0.6144189",
"0.6070273",
"0.6011966",
"0.60056853",
"0.5973202",
"0.5934512",
"0.58746064",
"0.58082294",
"0.5793347",
"0.575... | 0.87713957 | 0 |
Return the icon associated with this object. The icon path is defined in the zProperty zIcon. | def getIconPath(self):
try:
return self.primaryAq().zIcon
except AttributeError:
return '/zport/dmd/img/icons/noicon.png' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_icon(self):\n return self._icon",
"def get_icon(self):\n\n return self._icon",
"def icon(self):\n return self._icon",
"def icon(self):\n return self._icon",
"def icon(self):\n return self._icon",
"def icon(self):\n return self._icon",
"def icon(self):\n... | [
"0.794968",
"0.79486406",
"0.7873439",
"0.7873439",
"0.7873439",
"0.7873439",
"0.7873439",
"0.7873439",
"0.7873439",
"0.7873439",
"0.7873439",
"0.7873439",
"0.7873439",
"0.7873439",
"0.7873439",
"0.7873439",
"0.7873439",
"0.7873439",
"0.7873439",
"0.7873439",
"0.7873439",
"... | 0.77732223 | 25 |
Start a selenium's chrome webdriver with specific options meant for displaying all the result html pages Put the result chrome driver in the queue, if given, so that it can be retrieved in an multithread/multiprocessing environments | def start_result_web_browser(my_queue = None):
chrome_options = Options()
chrome_options.add_argument('--hide-scrollbars')
chrome_options.add_argument('--start-maximized')
chrome_options.add_argument("disable-infobars")
# disable the notification "Chrome is being controlled by automa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start_chrome_browser(options_list, headless_mode, desired_capab= None, my_queue = None):\r\n\r\n driver = None\r\n chrome_options = Options()\r\n for option in options_list:\r\n chrome_options.add_argument(option) \r\n \r\n # suppress chrome log info\r\n chrome_options.add_argument('... | [
"0.7511449",
"0.6177045",
"0.6092919",
"0.6083736",
"0.6004566",
"0.59450895",
"0.5921535",
"0.59157044",
"0.58926123",
"0.58592665",
"0.5839421",
"0.58253545",
"0.579655",
"0.5779305",
"0.5757267",
"0.5757069",
"0.57506394",
"0.5748568",
"0.5725987",
"0.57079077",
"0.5674993... | 0.81120425 | 0 |
Loads a json manifest | def load_manifest(path: Path):
with open(path, "rt") as fin:
data = json_load(fin)
return Manifest.schema().load(data, many=True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _read_manifest_json(self):\n with open(os.path.join(self._crx_dir, \"manifest.json\")) as manifest:\n return json.load(manifest)",
"def parse_manifest(manifest_path):\n with open(manifest_path, 'r') as f:\n data = f.read()\n if data:\n return json.loads(data)\n ... | [
"0.7950216",
"0.7534347",
"0.7460454",
"0.7111946",
"0.7012574",
"0.667174",
"0.6625532",
"0.63913536",
"0.62528116",
"0.62335455",
"0.6154103",
"0.60512197",
"0.60245854",
"0.59875417",
"0.59875417",
"0.5954935",
"0.59407824",
"0.58922565",
"0.5879088",
"0.586719",
"0.580517... | 0.77565736 | 1 |
Method to load a json manifest and return a list of Bownloadable object. This list is passed to the DownloadManager methods of download, and list | def load(filename: Path) -> Optional[List["Downloadable"]]:
try:
manifest = Manifest.load_manifest(filename)
return Manifest.create_object_list(manifest)
except FileNotFoundError as ex:
logger.critical(f"Error file not found: {ex.filename}")
except JSONDecodeE... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_object_list(manifest) -> List[\"Downloadable\"]:\n results = []\n for entry in manifest:\n results.append(\n Downloadable(\n object_id=entry.object_id,\n hostname=remove_trailing_whitespace_and_slashes_in_url(\n ... | [
"0.7333877",
"0.6395941",
"0.6363624",
"0.614262",
"0.5989594",
"0.5933901",
"0.5895813",
"0.58912075",
"0.5887972",
"0.586331",
"0.58318835",
"0.5704325",
"0.55838734",
"0.55769324",
"0.5569865",
"0.55491304",
"0.5546626",
"0.55119616",
"0.5481255",
"0.5480366",
"0.546658",
... | 0.72059983 | 1 |
From the object info determine the type of object. | def get_drs_object_type(object_info: dict) -> DRSObjectType:
if "form" in object_info:
if object_info["form"] is None:
return DRSObjectType.object
return DRSObjectType(object_info["form"])
if "contents" in object_info and len(object_info["contents"]) > 0:
return DRSObjectTyp... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_type ( self, object ):\n return self.type",
"def get_type ( self, object ):\n return self.type",
"def get_target_object_type(self, data):\n if data.get(\"jsonmodel_type\") == \"archival_object\":\n if self.aspace_helper.has_children(data[\"uri\"]):\n retur... | [
"0.7005083",
"0.7005083",
"0.6877945",
"0.68236613",
"0.68236613",
"0.68236613",
"0.68236613",
"0.68209726",
"0.6806579",
"0.6806579",
"0.6806579",
"0.6806579",
"0.6806579",
"0.6806579",
"0.6806579",
"0.6806579",
"0.6806579",
"0.6806579",
"0.6806579",
"0.6806579",
"0.6806579"... | 0.75590444 | 0 |
returns the timestamp in datetime if not none otherwise returns None | def get_drs_object_timestamp(s: Optional[str]) -> Optional[datetime]:
return date_parser.parse(s) if s is not None else None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_timestamp(self):\n p = self._get_sub_text('timestamp')\n if not p:\n return None\n else:\n return xep_0082.datetime(p)",
"def stime(self):\n try:\n return self['datetime_1']\n except TypeError:\n return None",
"def get_next_... | [
"0.75179017",
"0.714047",
"0.6949186",
"0.6869479",
"0.68109053",
"0.670333",
"0.66398096",
"0.65387124",
"0.6525222",
"0.65162057",
"0.6483578",
"0.647227",
"0.6404403",
"0.6398088",
"0.6379014",
"0.63414896",
"0.6337728",
"0.63237375",
"0.6303122",
"0.62993085",
"0.6297133"... | 0.6727219 | 5 |
Returns the presigned URL for a DRS object, from a DRS hostname, via the access method | def get_download_url_using_drs(
drs_hostname: str, object_id: str, access_method: str, access_token: str
) -> Optional[str]:
headers = {
"Content-Type": "application/json",
"Accept": "application/json",
"Authorization": "bearer " + access_token,
}
try:
response = requests... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_presigned_url_expanded(objName):\n\n # Generate a presigned URL for the S3 client method\n s3_client = boto3.client('s3')\n try:\n response = s3_client.generate_presigned_url('get_object',\n Params={\n 'Bucket': 'ece1779-a... | [
"0.6691943",
"0.66074586",
"0.64302975",
"0.6295886",
"0.62162083",
"0.62133163",
"0.6162307",
"0.6132776",
"0.60811496",
"0.607882",
"0.60779405",
"0.6045358",
"0.60292447",
"0.60292447",
"0.60292447",
"0.60292447",
"0.60292447",
"0.60292447",
"0.60292447",
"0.60292447",
"0.... | 0.63766766 | 3 |
Creates a Representation of a Congressional Discussion. | def __init__(self, lines=[], people=[], name=''):
self.name=repr(name)
self.relable=defaultdict(str)
self.people=set(people + self.keys())
self.new_names=list(set(people)-set(self.keys())) #New People being added.
self.process_lines(lines)
self.concepts=set(self.relable.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_discussion(self, discussion_type, anchor, channel):\n discussion = self.create(anchor=anchor, channel=channel)\n return discussion",
"def discussion(cls, user, discussion):\n pass",
"def discussion(cls, user, discussion):\r\n pass",
"def make_comment_data(self, comment_... | [
"0.6121425",
"0.54592836",
"0.5438481",
"0.53712726",
"0.5355652",
"0.5322955",
"0.531263",
"0.5059086",
"0.5008249",
"0.4974523",
"0.49735048",
"0.4858716",
"0.484576",
"0.48083723",
"0.4805956",
"0.48000222",
"0.47977188",
"0.47706756",
"0.4767464",
"0.47667748",
"0.4766617... | 0.0 | -1 |
Paint a checkbox without the label. | def paint(self, painter, option, index):
self.drawCheck(painter, option, option.rect, Qt.Unchecked if int(index.data()) == 0 else Qt.Checked) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def DrawCheckBox(*args, **kwargs):\n return _gdi_.RendererNative_DrawCheckBox(*args, **kwargs)",
"def _onCheckBox(self, widget):\n widget.setStateCheck(not widget.getStateCheck())",
"def checkBox(parent,label='',pos=defPos,size=defSize,style=0,val=defVal,\r\n name='checkBox',id=defId,onChe... | [
"0.6658085",
"0.61212695",
"0.6009462",
"0.598491",
"0.57794183",
"0.57696193",
"0.56871",
"0.5511196",
"0.54637843",
"0.5397577",
"0.5356402",
"0.53238875",
"0.5316491",
"0.53046924",
"0.5289639",
"0.52892673",
"0.52746964",
"0.5273674",
"0.5241159",
"0.5222188",
"0.5207558"... | 0.6071485 | 2 |
Computes the accuracy over the k top predictions for the specified values of k | def comp_accuracy(output, target, topk=(1,)):
with torch.no_grad():
maxk = max(topk)
batch_size = target.size(0)
_, pred = output.topk(maxk, 1, True, True)
pred = pred.t()
correct = pred.eq(target.view(1, -1).expand_as(pred))
res = []
for k in topk:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def topk_accuracy(y, y_pred, k=2):\n pred = []\n for i in range(len(y)):\n if y[i] in y_pred[i][:k]:\n pred.append(1)\n else:\n pred.append(0)\n return sum(pred) / len(pred)",
"def accuracy(y_pred, y_actual, topk=(1, )):\n maxk = max(topk)\n batch_size = y_actua... | [
"0.8331214",
"0.8284662",
"0.82381004",
"0.8229767",
"0.82202226",
"0.81864446",
"0.81847763",
"0.8175173",
"0.8171541",
"0.81699467",
"0.81664646",
"0.81645083",
"0.81637454",
"0.81622064",
"0.81622064",
"0.81622064",
"0.81622064",
"0.81622064",
"0.81622064",
"0.81622064",
"... | 0.0 | -1 |
Reset logger to its initial state. | def _set_defaults(self, log_level=logging.INFO, redirect_stdout=False):
# Remove all previous handlers
for handler in self.handlers[:]:
self.removeHandler(handler)
# Set levels
self.setLevel(logging.DEBUG)
# Set up the stdout handler
self.fh = None
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ResetLogger(self):\n self._formatter = ColoredFormatter(self.format)\n self._console_handler = logging.StreamHandler()\n self._console_handler.setFormatter(self._formatter)\n self.addHandler(self._console_handler)",
"def reset() -> None:\n Logger._logger = logging.getLogger(\"dynamake\")\n... | [
"0.7786038",
"0.7393896",
"0.732958",
"0.7256361",
"0.7067699",
"0.7000535",
"0.6962",
"0.6729588",
"0.66916573",
"0.6574961",
"0.6463081",
"0.64565474",
"0.6454157",
"0.6448897",
"0.63684577",
"0.63226646",
"0.62829846",
"0.6247726",
"0.6202541",
"0.616412",
"0.6160938",
"... | 0.0 | -1 |
Sets levels for both sh and (if initialised) fh. | def set_level(self, level):
self.sh.setLevel(level)
if self.fh:
self.fh.setLevel(level) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setLevels(self, levels, update=True):\n if self._xp is None:\n self.levels = levels\n self._defferedLevels = levels\n return\n if levels is not None:\n levels = self._xp.asarray(levels)\n self.levels = levels\n self._effectiveLut = None\n ... | [
"0.64839387",
"0.6170355",
"0.5774692",
"0.56698835",
"0.5668958",
"0.56018984",
"0.56018955",
"0.5592076",
"0.5485535",
"0.5434442",
"0.5420916",
"0.53526694",
"0.53077203",
"0.53010577",
"0.5211431",
"0.5209993",
"0.51980305",
"0.51524526",
"0.5140634",
"0.5132578",
"0.5127... | 0.6920395 | 0 |
A function that checks whether it is a negative number | def check_negative(self,one_value,two_value,types):
# hex or sixteen
if types is "sixteen" or types is "two":
# one_value and two_value is Negative
if one_value[0] is "-" and two_value[0] is "-":
one_value = one_value[0] + one_value[3:]
two_value ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isnegative(x):\n if x < 0 :\n return True\n return False",
"def is_negative(self, a):\n return a < 0",
"def is_negative(self):\n return (self._num < 0)",
"def _is_non_negative_int(item):\n if not isinstance(item, int):\n return False\n return item >= 0",
"def is_... | [
"0.8635887",
"0.815258",
"0.81070906",
"0.7823102",
"0.7708909",
"0.75208044",
"0.74813837",
"0.7446939",
"0.74310464",
"0.7392862",
"0.7380344",
"0.7341391",
"0.7230411",
"0.7160397",
"0.71558374",
"0.7138852",
"0.7135854",
"0.71272427",
"0.71065855",
"0.7102888",
"0.7073884... | 0.0 | -1 |
Calculate distance calculates the distance between two lat/lon coordinates in km | def distance(origin, destination):
lat1, lon1 = origin
lat2, lon2 = destination
radius = 6371 # km
dlat = math.radians(lat2-lat1)
dlon = math.radians(lon2-lon1)
a = math.sin(dlat/2) * math.sin(dlat/2) + math.cos(math.radians(lat1)) \
* math.cos(math.radians(lat2)) * math.sin(dlon/2) * ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculateDistanceBetweenPoints(lat1,lon1,lat2,lon2):\n\treturn Geodesic.WGS84.Inverse(lat1,lon1, lat2, lon2)['s12']",
"def coord_distance(lat1, lon1, lat2, lon2):\n\tlon1, lat1, lon2, lat2 = map(math.radians, [lon1, lat1, lon2, lat2])\n\tdlon = lon2 - lon1\n\tdlat = lat2 - lat1\n\ta = math.sin(dlat/2)**2 + m... | [
"0.80502284",
"0.8005954",
"0.79820293",
"0.7966692",
"0.7928491",
"0.7907258",
"0.7899248",
"0.78703845",
"0.7857682",
"0.78222835",
"0.7820211",
"0.7794497",
"0.7785044",
"0.77783644",
"0.7773532",
"0.7769799",
"0.7748572",
"0.7744909",
"0.7740228",
"0.77401626",
"0.7727355... | 0.0 | -1 |
Return the global batch size. | def get_global_batch_size(self) -> int:
return self._global_batch_size | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_batch_size():\n return get_global_variable(GraphKeys.BATCH_SIZE)",
"def batch_size(self):\n return self.size",
"def batch_size(self):\n return self._batch_size",
"def batch_size(self):\n return self._batch_size",
"def batch_size(self):\n return self._batch_size",
"d... | [
"0.88151634",
"0.830064",
"0.8187259",
"0.8187259",
"0.8187259",
"0.8187259",
"0.81246334",
"0.81107974",
"0.8043567",
"0.7874009",
"0.77817184",
"0.7775664",
"0.77704424",
"0.77704424",
"0.77704424",
"0.77704424",
"0.7754545",
"0.7707345",
"0.7618055",
"0.7487076",
"0.747518... | 0.9227336 | 0 |
Return the perslot batch size. When a model is trained with a single GPU, this is equal to the global batch size. When multiGPU training is used, this is equal to the global batch size divided by the number of GPUs used to train the model. | def get_per_slot_batch_size(self) -> int:
return self._per_slot_batch_size | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_global_batch_size(self) -> int:\n return self._global_batch_size",
"def get_batch_size():\n return get_global_variable(GraphKeys.BATCH_SIZE)",
"def _get_batch_size(self):\n if self.batch_size == 'auto':\n return self._backend.compute_batch_size()\n else:\n ... | [
"0.8238029",
"0.7809571",
"0.77661675",
"0.7646264",
"0.7595805",
"0.7595805",
"0.7595805",
"0.7595805",
"0.739097",
"0.73034316",
"0.7273159",
"0.7253004",
"0.72418463",
"0.719239",
"0.71808815",
"0.71808815",
"0.71808815",
"0.71808815",
"0.71706736",
"0.71199524",
"0.710943... | 0.7471908 | 8 |
Return True if Action can be run otherwise False. | def is_usable(self) -> bool:
return self.is_unlimited or self.__times > ActionState.NEUTRAL | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def can_make_action(self) -> bool:\n return not(self.has_pending_action or self.is_dead())",
"def __bool__(self):\n return bool(self._actions)",
"def can_act(self, **kwargs):\n return True",
"def can_run(self):\n return True",
"def should_run_action(self) -> bool: # pylint: dis... | [
"0.77184546",
"0.73480946",
"0.73334974",
"0.7327742",
"0.7230089",
"0.69986284",
"0.6968338",
"0.6937793",
"0.6829514",
"0.6793314",
"0.6698373",
"0.6628202",
"0.6628202",
"0.6624669",
"0.6549766",
"0.65005076",
"0.64915216",
"0.6475175",
"0.6426544",
"0.63981414",
"0.638831... | 0.56247467 | 98 |
Note that priors are [x,y,width,height] where (x,y) is the center of the box. | def make_priors(self):
if self.last_img_size != (self.target_size, self.target_size):
prior_data = []
for conv_w, conv_h, scale in zip(self.conv_ws, self.conv_hs, self.scales):
for i in range(conv_h):
for j in range(conv_w):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def box(self, x, y, w, h):\n\t\tpass",
"def get_points_from_box(box):\n\t# Center of the box x = (x1+x2)/2 et y = (y1+y2)/2\n\tcenter_x = int(((box[1]+box[3])/2))\n\tcenter_y = int(((box[0]+box[2])/2))\n\n\treturn (center_x,center_y)",
"def box(points):\n xmin = min(points, key=lambda x: x[0])[0]\n ymin ... | [
"0.65200204",
"0.6351534",
"0.6293803",
"0.6175837",
"0.6171597",
"0.6136941",
"0.6040345",
"0.6030253",
"0.6021425",
"0.59045",
"0.59045",
"0.5882173",
"0.58451736",
"0.5836166",
"0.58320534",
"0.58292246",
"0.5818855",
"0.58105886",
"0.5807391",
"0.58068585",
"0.578693",
... | 0.5668521 | 31 |
Lists agents for the given scanner. | def list(self):
response = self._client.get('scanners/1/agents')
return AgentList.from_json(response.text) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run(self, agent_args=None):\n agent_args = agent_args or {}\n self.neutron.list_agents(**agent_args)",
"def list_agents(self, platform_uuid):\n return self.do_rpc('platforms.uuid.' + platform_uuid + '.list_agents')",
"def get_agents(self):\n ret = []\n for i in self.all_i... | [
"0.6347723",
"0.6090113",
"0.6086717",
"0.6085292",
"0.60526425",
"0.60139686",
"0.59474236",
"0.58881485",
"0.5875097",
"0.5740293",
"0.56911343",
"0.56392485",
"0.56189364",
"0.5598501",
"0.5570177",
"0.5567872",
"0.55478185",
"0.5469883",
"0.543812",
"0.5428336",
"0.541336... | 0.76324165 | 0 |
Removes a queue from the shard catalog. Call this method after successfully deleting it from a backend shard. | def deregister(self, queue, project=None):
# TODO(kgriffs): SHARDING - Implement this!
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_queue(self):\n self.work_queue_client.delete_queue()",
"def remove_queue(self, queue) -> None:\r\n self.receive_queues.remove(queue)",
"def remove_queue(self, queue):\n with self.mutex:\n self.queues.remove(queue)",
"def _queue_delete(self, queue):\n\n queue.... | [
"0.7496421",
"0.73610497",
"0.73293966",
"0.7305945",
"0.72437954",
"0.72253674",
"0.7151214",
"0.7142337",
"0.71367115",
"0.7116734",
"0.7023352",
"0.6969044",
"0.68962514",
"0.6785475",
"0.6775993",
"0.6749584",
"0.67103916",
"0.6655882",
"0.65476745",
"0.65470827",
"0.6526... | 0.6059937 | 29 |
Test Uniformity HU values. | def test_uniformity_values(self):
for key, exp_val in self.unif_values.items():
meas_val = self.quart.uniformity_module.rois[key].pixel_value
self.assertAlmostEqual(exp_val, meas_val, delta=5) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_special_U(self):\n self.check_oneq_special_cases(U3Gate(0.0, 0.1, -0.1).to_matrix(), \"U\", {})\n self.check_oneq_special_cases(U3Gate(0.0, 0.1, 0.2).to_matrix(), \"U\", {\"u\": 1})\n self.check_oneq_special_cases(U3Gate(np.pi / 2, 0.2, 0.0).to_matrix(), \"U\", {\"u\": 1})\n se... | [
"0.6392726",
"0.63832325",
"0.635788",
"0.6284848",
"0.6252059",
"0.60868734",
"0.60838914",
"0.60822636",
"0.6080787",
"0.6030547",
"0.59913117",
"0.5933068",
"0.5929542",
"0.59291995",
"0.58343595",
"0.58000004",
"0.5741081",
"0.57206076",
"0.57145053",
"0.5688586",
"0.5678... | 0.70609903 | 0 |
Get the permutations for the set of letters of length n with the highest number of valid word permutations. | def _get_highest_nperms(n, words, dawg):
best = (None, 0, []) # word, num perms, nperms
words_counted = 0
total_perms_counted = 0
for word in words:
words_counted += 1
# Generate all n-length permutations of word
nperms = [w for w in dawg.gen_completions('', word)]
t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_perms(n):\n \n from itertools import permutations\n bases = 'CATGN'\n return [''.join(perm) for perm in permutations(bases, n)]",
"def _get_hardest_wordcube(n, words, dawg):\n best = (None, None, 0, []) # word, num perms, nperms\n\n words_counted = 0\n total_perms_counted = 0\n\n ... | [
"0.7206389",
"0.67316425",
"0.66215926",
"0.6508754",
"0.6451284",
"0.6386333",
"0.6330295",
"0.62981945",
"0.6181717",
"0.6180008",
"0.6150083",
"0.6131791",
"0.6120874",
"0.6068811",
"0.6022777",
"0.59975755",
"0.5980939",
"0.59306306",
"0.592329",
"0.59163797",
"0.59012115... | 0.7686926 | 0 |
Get the permutations for the set of letters of length n with the highest number of valid word permutations. | def _get_hardest_wordcube(n, words, dawg):
best = (None, None, 0, []) # word, num perms, nperms
words_counted = 0
total_perms_counted = 0
for word in words:
words_counted += 1
# Generate all n-length permutations of word
perms = [w for w in dawg.gen_completions('', word)]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_highest_nperms(n, words, dawg):\n best = (None, 0, []) # word, num perms, nperms\n\n words_counted = 0\n total_perms_counted = 0\n\n for word in words:\n words_counted += 1\n # Generate all n-length permutations of word\n nperms = [w for w in dawg.gen_completions('', wo... | [
"0.7686926",
"0.7206389",
"0.66215926",
"0.6508754",
"0.6451284",
"0.6386333",
"0.6330295",
"0.62981945",
"0.6181717",
"0.6180008",
"0.6150083",
"0.6131791",
"0.6120874",
"0.6068811",
"0.6022777",
"0.59975755",
"0.5980939",
"0.59306306",
"0.592329",
"0.59163797",
"0.59012115"... | 0.67316425 | 2 |
Get path to inferencer.mallet file. Returns str Path to inferencer.mallet file. | def finferencer(self):
return self.prefix + 'inferencer.mallet' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fcorpusmallet(self):\n return self.prefix + 'corpus.mallet'",
"def _get_filename():\n dirname = os.path.dirname(__file__)\n return os.path.join(dirname, 'occulttraining.txt')",
"def _get_conv_filepath(self):\n\t\treturn os.path.join(self.workdir, \"conv.txt\")",
"def get_encoder_pretrained_p... | [
"0.6441582",
"0.60328674",
"0.5922919",
"0.5882406",
"0.57976377",
"0.56919473",
"0.5652616",
"0.56470686",
"0.5615627",
"0.56059074",
"0.54792726",
"0.5433098",
"0.5426791",
"0.542622",
"0.54225934",
"0.5418696",
"0.54155797",
"0.5415084",
"0.54078496",
"0.53646195",
"0.5357... | 0.7157939 | 0 |
Set up the simulation parameters. | def init_params():
p = OrderedDict()
p['startYear'] = 1855
p['num5YearAgeClasses'] = 25
p['numCareLevels'] = 5
p['pixelsInPopPyramid'] = 2000
p['pixelsPerTown'] = 16 # 56
p['mapGridXDimension'] = 20
p['mapGridYDimension'] = 25
p['careLevelColour'] = ['deepskyblue','green',... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_simulation(self, **kwargs):\n\n self.distance = self.config[\"site\"][\"distance\"]\n self.num_substations = self.config[\"num_substations\"]\n\n self.initialize_substructure_production()\n self.initialize_installation_vessel()",
"def _setup_simulation(self\n ... | [
"0.7967988",
"0.7734476",
"0.704249",
"0.6984055",
"0.6949559",
"0.69266033",
"0.6907263",
"0.6892427",
"0.6808959",
"0.6769671",
"0.6757042",
"0.6746337",
"0.6701368",
"0.6674279",
"0.6617649",
"0.6564198",
"0.6555078",
"0.6552783",
"0.65447706",
"0.65382516",
"0.65378135",
... | 0.60937005 | 77 |
Convert feet to meters. | def meters_from(feet):
try:
meters = float(feet) / 3.28
meters = round(meters, 2) # Round to two decimal places
return str(meters)
except ValueError:
return "invalid input" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def feet_to_meters(feet: float) -> float:\n feet = float(feet)\n meter = float(float(feet) * 0.3048)\n return round(meter, 2)",
"def meters_to_feet(meters: float) -> float:\n meters = float(meters)\n feet = float(float(meters) * 3.28084)\n return round(feet, 2)",
"def feet2m(feet):\n retur... | [
"0.87025774",
"0.82659894",
"0.7739321",
"0.7645984",
"0.7324921",
"0.700244",
"0.6886812",
"0.67837816",
"0.66554064",
"0.6441032",
"0.64013606",
"0.63439703",
"0.6339806",
"0.63303095",
"0.63266355",
"0.6132486",
"0.6091889",
"0.5971584",
"0.59507674",
"0.5929875",
"0.59266... | 0.7666288 | 3 |
This is the yaml constructor for a Module object. First, the object mapping is loaded from the yaml module file. Next, the "constraint" key value is replaced with with a Constraint object created from the value loaded from the yaml module file. Then the module's filename path is added to the mapping. The last mapping e... | def module_constructor(loader, node):
new_module = Module.__new__(Module)
yield new_module
values = loader.construct_mapping(node, deep=True)
values["constraint"] = ec2rlcore.constraint.Constraint(values["constraint"])
values["path"] = Module.temp_path
# Strip trailing newlines from string value... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, name=None, version=None, title=None, helptext=None, placement=None, package=None,\n language=None, content=None, path=None, constraint=None, remediation=False):\n if not placement:\n raise ModuleConstraintParseError(\n \"Module('{}'): must have a ... | [
"0.7075642",
"0.6156473",
"0.594121",
"0.59134895",
"0.581492",
"0.5749495",
"0.57377917",
"0.5720062",
"0.5718925",
"0.5634863",
"0.56319904",
"0.559874",
"0.55547297",
"0.5542878",
"0.55354613",
"0.55078304",
"0.5480433",
"0.54748434",
"0.5428144",
"0.53920656",
"0.5361269"... | 0.7782868 | 0 |
Delete any created files on teardown. | def teardown():
for filename in files_to_delete:
delete_file(filename) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tearDown(self):\r\n remove_files(self.files_to_remove, False)\r\n if self.tmpdir:\r\n rmtree(self.tmpdir)\r\n\r\n # clean up the file from init_flowgram_file\r\n if (hasattr(self, \"tmp_filename\") and exists(self.tmp_filename)):\r\n remove(self.tmp_filename)",... | [
"0.81960475",
"0.8115798",
"0.8046664",
"0.8042699",
"0.80376184",
"0.80279875",
"0.8023201",
"0.7994642",
"0.7929984",
"0.79281807",
"0.79036784",
"0.79027873",
"0.78746796",
"0.7871661",
"0.78490055",
"0.78448004",
"0.78430504",
"0.78209215",
"0.78209215",
"0.78209215",
"0.... | 0.8997357 | 0 |
Get information of the current user on the cluster. | def user_info(self):
resp = self._get(get_url('user'))
raise_on_error(resp)
ret = resp.json()
return UserInfo(ret) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_info(self):\n return self.auth.get_user_by_session()",
"def current_user_info():\n\n return current_user",
"def user_info(self):\n \n return self.auth.get_user_by_session()",
"def user(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"user\")",
"def user_info(self... | [
"0.80031466",
"0.7967693",
"0.796435",
"0.77391934",
"0.7683627",
"0.76282316",
"0.749018",
"0.74720657",
"0.744161",
"0.7358734",
"0.73438686",
"0.73346436",
"0.7323366",
"0.73095995",
"0.7285283",
"0.72841567",
"0.7249313",
"0.72286355",
"0.7227165",
"0.7220908",
"0.7218197... | 0.7077701 | 29 |
Get a profile available on the cluster. | def profile_details(self, profile_name):
url = get_url('profile details', profile=profile_name)
response = self._get(url)
if response.status_code == 404:
return None
raise_on_error(response)
return Profile(response.json()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_profile(self):\n endpoint = '/profile'\n return self.get_request(endpoint)",
"def get(profile):\n client = boto3client.get(\"iam\", profile)\n return client.list_instance_profiles()",
"def getProfile(self):\n # GET /profile\n debugMain('getProfile')\n return sel... | [
"0.74622744",
"0.7349308",
"0.727226",
"0.690349",
"0.69005364",
"0.68300575",
"0.6816332",
"0.6757707",
"0.6714197",
"0.668962",
"0.66388845",
"0.6617772",
"0.64669675",
"0.64646536",
"0.64088595",
"0.6390334",
"0.6372879",
"0.6358854",
"0.6328871",
"0.63270193",
"0.6317294"... | 0.570784 | 96 |
Return a string removing words made only of numbers. If there is an exception or s is not a string, return s asis. | def strip_numbers(s):
if s:
s = u' '.join([x for x in s.split(' ') if not x.isdigit()])
return s | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def removeNumbers(self, words):\n\t\treturn re.sub(r'\\d', '', words)",
"def strip_non_digits(x: str) -> str:\n exp = re.compile(\"[^\\d]+\")\n return re.sub(exp, \"\", x)",
"def remove_numbers(text):\n return ''.join([i for i in text if not i.isdigit()])",
"def remove_words_digits(text):\n ret... | [
"0.73077655",
"0.72730196",
"0.721575",
"0.71944594",
"0.71499383",
"0.7059973",
"0.70448935",
"0.7020625",
"0.6946507",
"0.68835324",
"0.68364906",
"0.67976224",
"0.67952883",
"0.6661595",
"0.6653278",
"0.6644055",
"0.66143197",
"0.65771985",
"0.65234226",
"0.64884853",
"0.6... | 0.8082544 | 0 |
Return an iterable of tokens from lines of text. | def get_tokens(self, numbered_lines):
tokens = []
tokens_append = tokens.append
# simple tokenization: spaces and some punctuation
splitter = re.compile('[\\t =;]+').split
for _line_number, line in numbered_lines:
line = line.strip()
if line:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_token_list(text):\n return text.split()",
"def get_tokens(self, text):\n\t\treturn tuple(self._compiled_pattern.findall(text))",
"def _tokenize(self, text: str) -> List[str]:\n tokens = []\n for token in re.findall(self._pat, text):\n tokens.extend(bpe_token for bpe_token in s... | [
"0.7449176",
"0.7400768",
"0.7366092",
"0.7341256",
"0.72738683",
"0.72695684",
"0.7254661",
"0.7122992",
"0.7104838",
"0.70864177",
"0.7081336",
"0.70578074",
"0.70445377",
"0.70362794",
"0.7034011",
"0.7005435",
"0.6992214",
"0.6924696",
"0.68998027",
"0.6888463",
"0.684234... | 0.7163761 | 7 |
Return True if a line ends with "all rights reserved"like statements. | def is_all_rights_reserved(line):
line = prepare_text_line(line)
# remove any non-character
line = re.sub(r'\W+', '', line)
line = line.strip()
line = line.lower()
return line.endswith(('rightreserved', 'rightsreserved')) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_candidate(line):\n line = line.lower()\n line = prepare_text_line(line)\n return (has_content(line) and any(s in line for s in copyrights_hint.statement_markers))",
"def check(self): # full program\n r = re.compile('(?!(^(((?!;)[A-Z][+-]?\\d+(\\.\\d+)?\\s?)*(\\s*;\\s.*)?)$))')\n f... | [
"0.582402",
"0.5677294",
"0.56479794",
"0.55847377",
"0.5551333",
"0.54304326",
"0.53932893",
"0.5387476",
"0.5382076",
"0.53021413",
"0.52555776",
"0.5251216",
"0.5237541",
"0.52193344",
"0.51983285",
"0.5195619",
"0.51882297",
"0.51770175",
"0.51729655",
"0.5161867",
"0.515... | 0.8228577 | 0 |
PyTorch module implementing one stack of the NBEATS architecture that comprises multiple basic blocks. | def __init__(
self,
num_blocks: int,
num_layers: int,
layer_width: int,
nr_params: int,
expansion_coefficient_dim: int,
input_chunk_length: int,
target_length: int,
g_type: GTypes,
batch_norm: bool,
dropout: float,
activatio... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __call__(self, **kwargs):\n segname = 'block_{}_expand_relu'\n blocks = [13, 6, 3, 1]\n skips = [self._backbone.get_layer(segname.format(i)) for i in blocks]\n backbone_out = self._backbone.get_layer('block_16_project')\n\n p5 = self._fpn_block(backbone_out.output, skips[0].o... | [
"0.6428098",
"0.6285032",
"0.6232121",
"0.62275654",
"0.6206801",
"0.620139",
"0.61986154",
"0.61758053",
"0.61700666",
"0.6152608",
"0.6130815",
"0.6043318",
"0.60364246",
"0.6024662",
"0.5995602",
"0.5981588",
"0.59363943",
"0.59247404",
"0.590662",
"0.59031117",
"0.5898559... | 0.61661696 | 9 |
Transition a user to limited. | def test_transitions_create_limited(self):
self.transition_data['status'] = 'LIMITED'
transition = self.client.users(
self.user.token).transitions.create(self.transition_data)
verify_user_transition(self, transition, self.transition_data) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def level_up(self):\n self.user_access_level += 1",
"def userMaximum(self, new_max: float) -> None:\n self._user_maximum = new_max\n self.reset_limits()",
"def limit(self, limit):\n raise NotImplementedError(\"This should have been implemented.\")",
"def setOverdraftLimit(self, ne... | [
"0.5970535",
"0.5791147",
"0.5734212",
"0.5688846",
"0.56344736",
"0.55891764",
"0.5558542",
"0.5551772",
"0.5541966",
"0.55276746",
"0.5493733",
"0.54908234",
"0.5405842",
"0.5405842",
"0.5405842",
"0.53714436",
"0.5348867",
"0.5348772",
"0.5343764",
"0.5341893",
"0.530923",... | 0.59214973 | 1 |
Transition a user to active. | def test_transitions_create_active(self):
self.transition_data['status'] = 'ACTIVE'
transition = self.client.users(
self.user.token).transitions.create(self.transition_data)
verify_user_transition(self, transition, self.transition_data) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def activate_user(self, user):\n if not user.active:\n user.active = True\n return True\n return False",
"def activate_user(self, user):\n if not user.active:\n user.active = True\n # noinspection PyUnresolvedReferences\n self.save(user)... | [
"0.7957551",
"0.7887443",
"0.7706528",
"0.75576293",
"0.74901134",
"0.726034",
"0.71865284",
"0.7157044",
"0.7151426",
"0.7053879",
"0.6994248",
"0.6969487",
"0.69481003",
"0.6945044",
"0.67824113",
"0.6750158",
"0.6678815",
"0.6642999",
"0.66201687",
"0.6488795",
"0.64796245... | 0.6644201 | 17 |
Gets Google Cloud location resource attribute. | def LocationAttributeConfig():
return concepts.ResourceParameterAttributeConfig(
name='location',
help_text='Google Cloud location for the {resource}.',
fallthroughs=[
deps.PropertyFallthrough(properties.VALUES.container_aws.location)
],
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_location(self):\r\n response = self.connection.make_request('GET', self.name,\r\n query_args='location')\r\n body = response.read()\r\n if response.status == 200:\r\n rs = ResultSet(self)\r\n h = handler.XmlHandler(rs... | [
"0.7209479",
"0.7154934",
"0.7083953",
"0.69514734",
"0.69372094",
"0.6915048",
"0.67542803",
"0.6749096",
"0.6713175",
"0.6682517",
"0.6650851",
"0.66502076",
"0.6620738",
"0.66150904",
"0.66150904",
"0.66150904",
"0.6602889",
"0.65445054",
"0.65445054",
"0.65445054",
"0.654... | 0.6741057 | 8 |
Adds a resource argument for an AWS cluster. | def AddAwsClusterResourceArg(parser, verb, positional=True):
name = 'cluster' if positional else '--cluster'
concept_parsers.ConceptParser.ForResource(
name,
GetAwsClusterResourceSpec(),
'cluster {}.'.format(verb),
required=True,
).AddToParser(parser) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(__self__,\n resource_name: str,\n args: ClusterArgs,\n opts: Optional[pulumi.ResourceOptions] = None):\n ...",
"def __init__(__self__,\n resource_name: str,\n args: ClusterArgs,\n opts: Optional[pu... | [
"0.6765696",
"0.6765696",
"0.6765696",
"0.63581204",
"0.63294226",
"0.62697977",
"0.61736447",
"0.6052374",
"0.60172683",
"0.59232193",
"0.5872655",
"0.5835451",
"0.58238155",
"0.5782281",
"0.57593507",
"0.57480997",
"0.57373613",
"0.5736491",
"0.5724026",
"0.57043844",
"0.56... | 0.82604265 | 0 |
Adds a resource argument for an AWS node pool. | def AddAwsNodePoolResourceArg(parser, verb, positional=True):
name = 'node_pool' if positional else '--node-pool'
concept_parsers.ConceptParser.ForResource(
name,
GetAwsNodePoolResourceSpec(),
'node pool {}.'.format(verb),
required=True,
).AddToParser(parser) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(__self__,\n resource_name: str,\n args: Optional[TargetPoolArgs] = None,\n opts: Optional[pulumi.ResourceOptions] = None):\n ...",
"def __init__(__self__,\n resource_name: str,\n opts: Optional[pulumi.ResourceOpti... | [
"0.6712464",
"0.64813393",
"0.6403346",
"0.62576807",
"0.61882377",
"0.61110395",
"0.60874754",
"0.5956252",
"0.5888236",
"0.58859825",
"0.58598787",
"0.58349735",
"0.5827847",
"0.5826829",
"0.58237416",
"0.580317",
"0.5788526",
"0.5774138",
"0.5745805",
"0.57423896",
"0.5740... | 0.83453107 | 0 |
Adds a resource argument for operation in AWS. | def AddOperationResourceArg(parser, verb):
concept_parsers.ConceptParser.ForResource(
'operation_id',
GetOperationResourceSpec(),
'operation {}.'.format(verb),
required=True,
).AddToParser(parser) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_resource(self, resource_name, resource):\n self.resources[resource_name] = resource",
"def add_resource(self, *args, **kwargs):\n return self._resources_manager.add_resource(*args, **kwargs)",
"def AddAssetResourceArg(parser, verb, positional=True):\n name = 'asset' if positional else '-... | [
"0.7064835",
"0.68138164",
"0.6747009",
"0.6610789",
"0.64635116",
"0.6420831",
"0.64084077",
"0.64084077",
"0.64084077",
"0.63632065",
"0.62503445",
"0.6233409",
"0.6195563",
"0.61681795",
"0.6117799",
"0.6108109",
"0.6097323",
"0.6094501",
"0.6094227",
"0.608696",
"0.608046... | 0.67903453 | 2 |
helper to squeeze a multidim tensor and then unsqueeze the axis dimension if dims < 4 | def squeeze_expand_dim(tensor, axis):
tensor = torch.squeeze(tensor)
if len(list(tensor.size())) < 4:
return tensor.unsqueeze(axis)
else:
return tensor | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _squeeze_dims(ds):\n ds = ds.squeeze()\n for dim in ['lon', 'lat', 'bnds', 'depth', 'depth_2', 'depth_3']:\n if dim in ds:\n if ds[dim].size <= 1:\n del ds[dim]\n drop = []\n for dim in [\n 'hyai', 'hybi', 'hyam', 'hybm', 'time_bnds', 'lat_bnds', 'lon_bnd... | [
"0.7123118",
"0.7102468",
"0.70218647",
"0.6977147",
"0.6752624",
"0.6597701",
"0.65809166",
"0.65626967",
"0.6532513",
"0.6447006",
"0.63564414",
"0.62984633",
"0.62720203",
"0.6104143",
"0.60487205",
"0.6045749",
"0.59699076",
"0.5960887",
"0.5934532",
"0.59310925",
"0.5888... | 0.7898027 | 0 |
Creates a matrix of one hot vectors. | def one_hot(size, index, use_cuda=False):
mask = long_type(use_cuda)(*size).fill_(0)
ones = 1
if isinstance(index, Variable):
ones = Variable(long_type(use_cuda)(index.size()).fill_(1))
mask = Variable(mask, volatile=index.volatile)
ret = mask.scatter_(1, index, ones)
return ret | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_one_hot(v):\n n = len(v)\n m = max(v) + 1\n out = np.zeros((n, m))\n out[np.arange(n), v] = 1\n return out",
"def make_one_hot(y):\n one_hot = np.zeros((len(y), 10))\n for i in range(len(y)):\n one_hot[i, y[i]] = 1.\n return one_hot.transpose(1,0)",
"def as_one_hot(ind, n)... | [
"0.7880626",
"0.77315766",
"0.7719077",
"0.75795925",
"0.75690067",
"0.7543586",
"0.7510152",
"0.7493308",
"0.74694",
"0.7445",
"0.74297535",
"0.74294597",
"0.7390358",
"0.7365833",
"0.7326789",
"0.73231465",
"0.7306291",
"0.72954714",
"0.7294881",
"0.72773504",
"0.72742087",... | 0.0 | -1 |
Return sensor measurement unit. | def unit_of_measurement(self) -> str:
return self._unit | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unit_of_measurement(self):\n return self.sensor_type[\"unit\"]",
"def unit_of_measurement(self):\n return self._sensor.unit",
"def unit_of_measurement(self):\n return SENSOR_TYPES[self.sensor][1]",
"def unit_of_measurement(self):\n return SENSOR_UNITS.get(self._sensor_name, No... | [
"0.90164906",
"0.8944909",
"0.89354575",
"0.891295",
"0.891295",
"0.89047736",
"0.8893451",
"0.8893451",
"0.8892512",
"0.8880513",
"0.8880513",
"0.88272554",
"0.88272554",
"0.8803744",
"0.8784024",
"0.8784024",
"0.87681395",
"0.8661122",
"0.86030114",
"0.85649514",
"0.8540175... | 0.83773637 | 22 |
Return path to our static fixture file. | def _fixture(self):
fdir = os.path.join(FIXTURES_DIR, 'errata.devel.redhat.com/')
filename = self._url_with_params.replace(
'https://errata.devel.redhat.com/', fdir)
# If we need to represent this API endpoint as both a directory and a
# file, check for a ".body" file.
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fixtures_path():\n return path.abspath(\n path.join(path.dirname(path.realpath(__file__)),\n \"..\",\n \"conf\",\n \"jenkins\",\n \"update-templates.xml\"))",
"def path_static():\n return os.path.abspath(os.path.dirname(__file__... | [
"0.7403396",
"0.7261221",
"0.72089046",
"0.70025986",
"0.6927854",
"0.68947965",
"0.6854143",
"0.68169224",
"0.678344",
"0.6704188",
"0.6681954",
"0.6674829",
"0.6655893",
"0.66347665",
"0.66214293",
"0.6616788",
"0.6616158",
"0.6609446",
"0.65572053",
"0.65410745",
"0.649454... | 0.67424315 | 9 |
Return sample interval in ns, rounded up to the next integer. | def trc_get_sample_time(path):
datX, datY, m = readTrc.readTrc(path)
return int(np.ceil(m['HORIZ_INTERVAL'] * 1e9)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sample_interval(self):\n\n if self.sample_rate != 0:\n return 1.0 / self.sample_rate\n return 0.0",
"def get_sample_interval(profileDict):\n assert isinstance(profileDict, dict)\n\n return float(get_runtime(profileDict)) / get_sample_count(profileDict)",
"def get_sampling_int... | [
"0.75324184",
"0.6851176",
"0.6807576",
"0.65523577",
"0.65419865",
"0.6144179",
"0.60692763",
"0.6040186",
"0.6014209",
"0.59740424",
"0.5963946",
"0.5955173",
"0.5955173",
"0.5954635",
"0.5901994",
"0.58557314",
"0.5850648",
"0.5842389",
"0.5777286",
"0.57563066",
"0.575161... | 0.52956235 | 72 |
Load a .txt (csv) or .trc oscilloscope data file and return it as a pandas dataframe. | def read_trace(path):
suffix = path[-3:]
if suffix == 'txt':
return read_csv(path)
elif suffix == 'trc':
return read_trc(path)
else:
raise ValueError("Invalid file extension: %s" % suffix) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_data(txt_path: str = RAW_TXT) -> pd.DataFrame:\n df = pd.read_csv(txt_path)[INDICES]\n return df",
"def load_file_to_dataframe(self, file_path: str) -> pd.DataFrame:\n return pd.read_csv(file_path, sep=\"\\t\")",
"def load_raw_data(path: str) -> pd.DataFrame:\n data = []\n with open... | [
"0.77092946",
"0.686403",
"0.6709067",
"0.6695926",
"0.6681597",
"0.6640343",
"0.6640343",
"0.6640343",
"0.6519055",
"0.64785504",
"0.6464856",
"0.64496285",
"0.64181286",
"0.6361252",
"0.6357586",
"0.6352054",
"0.6315645",
"0.63147825",
"0.62478715",
"0.62405705",
"0.6219156... | 0.0 | -1 |
Returns a column from the 1d grid corresponding to the column number passed in. | def col(self, col: tuple) -> list:
return self.grid[col::9] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_column(grid, column_index):\n\treturn [row[column_index] for row in grid]",
"def get_column(grid, column_index):\n return [row[column_index] for row in grid]",
"def get_col(grid, n):\n\t\n if grid == []:\n return grid\n \n return [grid[0][n]] + get_col(grid[1:],n)",
"def get_co... | [
"0.763176",
"0.75465965",
"0.73089594",
"0.72217983",
"0.7111912",
"0.6985619",
"0.6912179",
"0.68575567",
"0.6841729",
"0.6831654",
"0.68024164",
"0.6717906",
"0.66998535",
"0.6684328",
"0.66583407",
"0.6653498",
"0.6653498",
"0.6653498",
"0.6646114",
"0.6646114",
"0.6646114... | 0.65594894 | 41 |
Returns a block as a 1d array from the 1d grid corresponding to the block number passed in as a parameter | def block(self, block: tuple) -> list:
b = []
for j in range(3):
index = block * 3 + j * 9 + 18 * (block // 3)
for val in self.grid[index:index+3]:
b.append(val)
return b | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def block(B):\n return np.array(np.bmat(B))",
"def create(block):\n block_output = []\n N = len(block)\n\n for n_x in range(N):\n for n_y in range(N):\n \n b = block[n_y][n_x]\n if b == '#':\n out = block\n else:\n o... | [
"0.6596604",
"0.6275451",
"0.6216896",
"0.60509354",
"0.60368764",
"0.59524965",
"0.58641636",
"0.58338434",
"0.58165884",
"0.5804993",
"0.57964194",
"0.5785122",
"0.57813835",
"0.5738215",
"0.5721931",
"0.5705185",
"0.5696535",
"0.5691737",
"0.56757617",
"0.5635264",
"0.5622... | 0.64374816 | 1 |
Build ListGrid from a given 2d matrix | def init_from(cls, matrix: list) -> object:
return cls(tool.flatten(matrix)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_grid(dataset):\n top_left_lat = dataset[\"a\"][0]\n top_left_lng = dataset[\"a\"][1]\n top_right_lng = dataset[\"c\"][1]\n bot_left_lat = dataset[\"b\"][0]\n\n lng_row = []\n lat_col = []\n i = top_left_lng\n while i < top_right_lng:\n lng_row.append(round(i, 5))\n i ... | [
"0.70964164",
"0.7051387",
"0.7016182",
"0.7011469",
"0.694119",
"0.6915384",
"0.6899745",
"0.6838715",
"0.67363447",
"0.67156136",
"0.66692257",
"0.66110635",
"0.6583045",
"0.654213",
"0.6538638",
"0.6521525",
"0.6426151",
"0.64024603",
"0.63907474",
"0.63830775",
"0.6346314... | 0.0 | -1 |
Builds a new ListGrid with a given 2d matrix | def from_matrix(cls, matrix: list) -> object:
return cls(tool.matrix_to_array(matrix)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_grid(grid):\r\n for i in range(4):\r\n grid.append([0,0,0,0])",
"def create_grid(grid):\r\n inner = [0]*4\r\n for i in range(4):\r\n grid.append(inner[:])",
"def create_grid(grid):\r\n for i in range(4):\r\n grid.append([0]*4)\r\n return grid",
"def create_grid(... | [
"0.6853439",
"0.68188334",
"0.67960197",
"0.67111576",
"0.6643937",
"0.6622254",
"0.65489304",
"0.6539025",
"0.6513963",
"0.65114903",
"0.6442969",
"0.6421784",
"0.64129174",
"0.6409409",
"0.64071894",
"0.63606155",
"0.63230443",
"0.62915593",
"0.62804466",
"0.61889535",
"0.6... | 0.0 | -1 |
get the filename only | def get_fname(a_file):
fname, fext = os.path.splitext(a_file)
return os.path.basename(fname) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filename(self):\n filename, ext = os.path.splitext(self.file.name)\n return filename.split('/')[-1]",
"def get_filename(self):\n \n for f in os.listdir(self.get_directory()):\n if os.path.isfile(os.path.join(self.get_directory(), f)):\n return... | [
"0.8149858",
"0.81272596",
"0.81119883",
"0.8046814",
"0.8037212",
"0.79741955",
"0.79505414",
"0.7938233",
"0.7925669",
"0.78973913",
"0.7842346",
"0.77857304",
"0.7784356",
"0.7768325",
"0.77559966",
"0.7729143",
"0.77165014",
"0.7703956",
"0.7684395",
"0.7659758",
"0.76538... | 0.77571553 | 14 |
chdir to working_path, return the file's relative path | def get_relative_path(file_string, root_path, working_path=""):
if not working_path:
working_path = os.getcwd()
new_file = to_abs_list(file_string, root_path)[0]
new_file = win2unix(new_file)
working_path = win2unix(working_path)
f, d = re.split("/", new_file), re.split("/", working_pa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rel_cwd():\n return os.path.relpath(os.getcwd(), git_toplevel())",
"def get_working_dir():\n working_dir = os.path.dirname(os.path.abspath(__file__))\n return working_dir",
"def get_relative_path(self, source: str) -> str:\n abs_top_level_dir = os.path.normcase(\n os.path.normpath(... | [
"0.70322984",
"0.70313996",
"0.68518555",
"0.6817049",
"0.6791708",
"0.67575824",
"0.66942835",
"0.663793",
"0.66284734",
"0.6587387",
"0.6571259",
"0.65531856",
"0.6551998",
"0.6536715",
"0.6528017",
"0.6519981",
"0.6455574",
"0.6441343",
"0.64205396",
"0.6407837",
"0.640110... | 0.6092518 | 50 |
Convert original time string to seconds | def time2secs(time_str):
try:
time_str = float(time_str)
return get_simple_digit_str(time_str)
except:
pass
try:
final_secs = 0
new_time = re.split("\s+", time_str)
day_hour_min_sec = {"days" : 24*3600, "hrs" : 3600, "mins" : 60, "secs" : 1}
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def time2secs( s ):\n t = s.split( ':' )\n nf = len( t )\n if nf == 1:\n # Seconds only!\n secs = int( t[0] )\n elif nf == 2:\n # Minutes & seconds!\n secs = int( t[1] ) + int( t[0] ) * 60\n elif nf == 3:\n # Hours, minutes & seconds!\n secs = int( t[2] ) + int( t[1] ) * 60 ... | [
"0.802223",
"0.7890975",
"0.7739677",
"0.7735319",
"0.772061",
"0.76610905",
"0.7648427",
"0.75449514",
"0.75449514",
"0.75402117",
"0.75229037",
"0.7449159",
"0.74251723",
"0.73193175",
"0.7225263",
"0.7217493",
"0.7209082",
"0.7190421",
"0.71712285",
"0.71049786",
"0.709243... | 0.779616 | 2 |
/products/ Returns a list of all products in the database. The ?limit= parameter limits the number of products returned. | def product_list(request):
error = {
'status': False,
'name': None,
'text': None,
'level': None,
'debug': None
}
limit, error = get_limit(request, error)
serializer = FreshSerializer()
queryset = Product.objects.all()[:limit]
if not queryset:
er... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def products(self, start=None, limit=None):\r\n params = base.get_params(None, locals())\r\n url = '{0}/products'.format(self.get_url())\r\n return http.Request('GET', url, params), parsers.parse_json",
"def list_products(self):\n return self._make_get_request(self._urls['products'])"... | [
"0.8379842",
"0.79079634",
"0.754041",
"0.72439677",
"0.7218145",
"0.72142035",
"0.71469724",
"0.71344185",
"0.7047566",
"0.7044488",
"0.70364034",
"0.70157695",
"0.6989742",
"0.6954997",
"0.6953964",
"0.6940142",
"0.6924515",
"0.6907063",
"0.6848293",
"0.68441236",
"0.683841... | 0.7411265 | 3 |
/products/vendors/ List all products sold by vendor . This information includes the details of the products, rather than only the product name/id and preparation name/id returned by /vendors/. | def product_vendor(request, id=None):
data = {}
error = {
'status': False,
'name': None,
'text': None,
'level': None,
'debug': None
}
limit, error = get_limit(request, error)
try:
product_list = Product.objects.filter(
productpreparation__... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_vendors_and_products_seen(cls, cb):\n url = \"/device_control/v3/orgs/{0}/products\".format(cb.credentials.org_key)\n resp = cb.get_object(url)\n return resp.get(\"results\", [])",
"def get_vendor_list_v1(self, **kwargs):\n # type: (**Any) -> Union[ApiResponse, object, Error_f... | [
"0.7009929",
"0.6769171",
"0.6441932",
"0.6378878",
"0.6339969",
"0.630428",
"0.6255927",
"0.62227416",
"0.60888684",
"0.60691774",
"0.6054556",
"0.60483617",
"0.6034511",
"0.6022641",
"0.6010922",
"0.59780735",
"0.59759647",
"0.5947294",
"0.59165514",
"0.5910425",
"0.5897023... | 0.75869775 | 0 |
Returns an int with the number of total rows. | def __len__(self):
return int(self._rows) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def total_rows(self):\n total_rows = self._properties.get(\"totalRows\")\n if total_rows is not None:\n return int(total_rows)",
"def getNumRows(self) -> int:\n ...",
"def get_num_rows(self):\n return self._num_rows",
"def row_count(self) -> int:\n return len(sel... | [
"0.8451552",
"0.8309093",
"0.8098741",
"0.807834",
"0.807834",
"0.80540586",
"0.8035529",
"0.8029583",
"0.796774",
"0.7956449",
"0.7875388",
"0.78611845",
"0.784996",
"0.783195",
"0.7790053",
"0.77729183",
"0.77488834",
"0.7707841",
"0.7707104",
"0.7672535",
"0.7627348",
"0... | 0.71880496 | 44 |
Exports the generated table into a CSV file. Returns a CSV string if filename is None. | def to_csv(self, filename: str):
if filename and filename.endswith(".csv"):
filename = filename[:-4]
if len(self.analysis) > 0:
export_to_csv(
[
"ticker",
"date",
"category",
"analys... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def export_csv(self):\n outputfile = tkinter.filedialog.asksaveasfilename(\n defaultextension=\".csv\",\n filetypes=((\"comma seperated values\", \"*.csv\"),\n (\"All Files\", \"*.*\")))\n if outputfile:\n tabledata = self.tabs.window.aistracker.... | [
"0.73528457",
"0.72158015",
"0.7122334",
"0.7081413",
"0.70288604",
"0.6954543",
"0.6919814",
"0.6874064",
"0.6872272",
"0.6872075",
"0.6872075",
"0.6821509",
"0.67809093",
"0.677267",
"0.66437554",
"0.6632045",
"0.66078234",
"0.6598682",
"0.65512663",
"0.6543926",
"0.6540225... | 0.6620963 | 16 |
This function validates the URL provided. In TRUE condition, it returns the spected URL with proper format. In FALSE condition, it returns FALSE. | def validate_url (url):
# Parse URL provided
v = urlparse(url)
# Verify if protocol (http, https, ftp) and hostname are present
# in the URL provided.
if v.scheme and v.hostname:
# Get URL base and hostname to form the correct URL base
u = v.scheme + '://' + v.hostname + '/'
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_url(value):\n\n valid = validators.url(value)\n if valid != True:\n return False",
"def check_url(value):\n\n valid = validators.url(value)\n if valid is not True:\n return False",
"def validateURL(url):\n pattern = re.compile(\"^https*:\\/\\/\\w+(\\.\\w+){2}[\\/A-Za-z\\d... | [
"0.84151167",
"0.83876365",
"0.82546586",
"0.8170183",
"0.8126023",
"0.80905324",
"0.8066149",
"0.8065271",
"0.79713136",
"0.79710037",
"0.7964333",
"0.7937214",
"0.7920466",
"0.7919988",
"0.79123944",
"0.79038715",
"0.789658",
"0.7850311",
"0.78479826",
"0.78052497",
"0.7790... | 0.8310658 | 2 |
Targetfunction for nonlinear problem with tridiagonal structure F = A.dot(phi) b, where A is tridiagonal and represented by ldu | def _tridiag_targetfun(ldu, x, b):
l, d, u = ldu
f = d * x - b # Target function
f[:-1] += u[:-1] * x[1:]
f[1:] += l[1:] * x[:-1]
return f | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tridiagonal_matrix_algorithm(l, d, u, b): # noqa:E741\n n = l.size\n cp = np.zeros(n)\n dp = np.zeros(n)\n x = np.zeros(n)\n cp[0] = u[0]/d[0]\n dp[0] = b[0]/d[0]\n for k in range(1, n):\n cp[k] = u[k] / (d[k]-l[k]*cp[k-1])\n dp[k] = (b[k]-l[k]*dp[k-1]) / (d[k]-l[k]*cp[k-1])... | [
"0.71777475",
"0.62545997",
"0.61453307",
"0.6127529",
"0.60955346",
"0.6070622",
"0.6063156",
"0.5998365",
"0.59669715",
"0.5844578",
"0.5832452",
"0.5831555",
"0.5780857",
"0.57086307",
"0.56756794",
"0.5640143",
"0.55353093",
"0.5514356",
"0.55076575",
"0.55037487",
"0.549... | 0.7946664 | 0 |
Solves the Boltzmann Poisson equation for a static background charge density rho_0 and particles with line number density n, Temperature kT and charge state q. The electron beam charge density is computed from a uniform current density and the iteratively corrected velocity profile of the electron beam. Below, nRS and ... | def boltzmann_radial_potential_linear_density_ebeam(
r, current, r_e, e_kin, nl, kT, q, first_guess=None, ldu=None, max_step=500, rel_diff=1e-3
):
# Solves the nonlinear radial poisson equation for a dynamic charge distribution following
# the Boltzmann law
# A * phi = b0 + bx (where b0 and ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def boltzmann_radial_potential_linear_density(r, rho_0, nl, kT, q, first_guess=None, ldu=None):\n # Solves the nonlinear radial poisson equation for a dynamic charge distribution following\n # the Boltzmann law\n # A * phi = b0 + bx (where b0 and bx are the static and dynamic terms)\n # Define cost fun... | [
"0.7129863",
"0.70444626",
"0.6988514",
"0.62166566",
"0.6087107",
"0.5982163",
"0.5772805",
"0.57719797",
"0.5769646",
"0.57517624",
"0.572791",
"0.56791365",
"0.56753576",
"0.5674403",
"0.5653443",
"0.5652101",
"0.55632365",
"0.55046517",
"0.54795617",
"0.5475105",
"0.54750... | 0.6683271 | 3 |
takes in a list of colours in 0255 | def color_norm(col):
norm_col = [x/255.0 for x in col]
return norm_col | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split_colours(colours_list, colours_required):\n colour_range = spectra.range(colours_list, colours_required)\n return [colour.hexcode for colour in colour_range]",
"def convert_to_RGB_255(colors):\n return (colors[0]*255.0, colors[1]*255.0, colors[2]*255.0)",
"def setColors255(self):\n #produc... | [
"0.7645698",
"0.74753046",
"0.7388678",
"0.7307979",
"0.70702434",
"0.70144117",
"0.6941006",
"0.6843356",
"0.68384683",
"0.67881876",
"0.6783083",
"0.673377",
"0.6644574",
"0.66425055",
"0.66415715",
"0.66050845",
"0.65736336",
"0.6561557",
"0.6531442",
"0.6485857",
"0.64570... | 0.0 | -1 |
Create a new dataset composed of the tsuid_list | def dataset_create(self, name, description, ts):
# Inputs check
check_type(value=name, allowed_types=str, var_name="name", raise_exception=True)
check_type(value=description, allowed_types=str, var_name="description", raise_exception=True)
check_type(value=ts, allowed_types=list, var_na... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create(data):\n \n return Setlist(\n list_id = data['id'],\n name = data['name'],\n items = data['num_sets'])",
"def data_setup_datapoints():\n datapoints_list = []\n datapoints_list.append(helper_datapoints(\"datapoints1\", [(10, 0), (5, 1), (15, 2), (5, ... | [
"0.61155903",
"0.59910387",
"0.59871066",
"0.59871066",
"0.5854735",
"0.5852432",
"0.58519083",
"0.58284366",
"0.58197993",
"0.5756523",
"0.5701114",
"0.5695972",
"0.56889087",
"0.56380296",
"0.5601108",
"0.55811197",
"0.5569408",
"0.5556829",
"0.54803616",
"0.54780936",
"0.5... | 0.62431777 | 0 |
Post process a resources.json object. | def process_resource_listing(self, resources, context):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def post(request, resource):\n return json({resource})",
"def process_resource_api(self, resources, resource, api, context):\n pass",
"def on_post_resource(self, req, resp, *args, **params):\n instance = self.get_object(**params)\n self.save_object(req.params, req, resp, instance,... | [
"0.63949823",
"0.63790756",
"0.6338782",
"0.63297665",
"0.6230304",
"0.610904",
"0.59832877",
"0.58985794",
"0.58970517",
"0.588157",
"0.58680284",
"0.58635885",
"0.5739864",
"0.5717385",
"0.5710937",
"0.5670049",
"0.5658417",
"0.5641183",
"0.56394184",
"0.56298715",
"0.56295... | 0.5997785 | 6 |
Dictionary with different activation functions. | def activation_func(activation:str):
return nn.ModuleDict([
['relu', nn.ReLU(inplace=True)],
['leaky_relu', nn.LeakyReLU(negative_slope=0.01, inplace=True)],
['selu', nn.SELU(inplace=True)],
['none', nn.Identity()]
])[activation] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_activation_function(func_name):\n return {\n 'linear': lambda x: x,\n 'relu': lambda x: x * (x > 0),\n 'elu': lambda x: x * (x >= 0) + (T.exp(x) - 1) * (x < 0),\n 'softmax': T.nnet.softmax,\n 'tanh': T.tanh,\n 'log_softmax': log_softmax,\n 'sigmoid': T.nn... | [
"0.7570218",
"0.6848615",
"0.6841948",
"0.67862386",
"0.6744199",
"0.64368254",
"0.6429687",
"0.6411081",
"0.625488",
"0.6246155",
"0.62342626",
"0.61979306",
"0.6156805",
"0.6140626",
"0.61293834",
"0.6117845",
"0.61040837",
"0.6089005",
"0.6088522",
"0.6087037",
"0.60753834... | 0.72628 | 1 |
r"""Fills the input Tensor with values drawn from a truncated normal distribution. The values are effectively drawn from the | def trunc_normal_(tensor, mean=0., std=1., a=-2., b=2.):
# type: (Tensor, float, float, float, float) -> Tensor
return _no_grad_trunc_normal_(tensor, mean, std, a, b) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def truncated_normal_(tensor):\n mean = 0\n std = 1/float(np.sqrt(tensor.shape[0]))\n size = tensor.shape\n tmp = tensor.new_empty(size + (4,)).normal_()\n valid = (tmp < 2) & (tmp > -2)\n ind = valid.max(-1, keepdim=True)[1]\n tensor.data.copy_(tmp.gather(-1, ind).squeeze(-1))\n tensor.dat... | [
"0.6750196",
"0.6719845",
"0.65550774",
"0.6375475",
"0.61642325",
"0.606227",
"0.6056913",
"0.5934547",
"0.5930023",
"0.59137565",
"0.5881416",
"0.58442247",
"0.58432597",
"0.582833",
"0.578847",
"0.57659245",
"0.5763045",
"0.5763045",
"0.5763045",
"0.5763045",
"0.5763045",
... | 0.66160834 | 3 |
Create a signed URL representing the given path. If the coresponding filesystem doesn't support signing then the filename is returned as is. | def sign(filename: str) -> str:
fs, relative_path = url_to_fs(filename)
try:
return cast(str, fs.sign(relative_path))
except NotImplementedError:
return filename | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_signed_url(self, file_name, protocol=None, expires_in=None, bucket=None):\n\n # check if azure, and default to S3\n\n if protocol == \"az\":\n try:\n container = flask.current_app.config[\"AZ_BLOB_CONTAINER_URL\"]\n except KeyError:\n raise... | [
"0.6667899",
"0.61025894",
"0.60460144",
"0.6014868",
"0.6011966",
"0.59710205",
"0.5880491",
"0.58774847",
"0.57798773",
"0.5759842",
"0.5695912",
"0.5688438",
"0.5683859",
"0.5677025",
"0.56407964",
"0.56129783",
"0.5607843",
"0.55759263",
"0.54832304",
"0.5479549",
"0.5468... | 0.6928506 | 0 |
Adds a dummy value of 1 to every input vector in the training set so we can simply take the dot product of the weight vector and the input vector to calculate the sum of products of the components of the two vectors. | def __add_dummy_inputs(training_set):
return [(Perceptron.__add_dummy_input(input_vector), is_connected)
for input_vector, is_connected in training_set] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def feed_forward(self, input_vector):\n # return sigmoid(np.dot(self.weights, input_vector))\n return np.dot(self.weights, input_vector)",
"def test_feature_computation(self):\n k = [2, 3, 4, 5, 6]\n mn = self.create_chain_model(k)\n d = 4\n\n for i in range(len(k)):\n ... | [
"0.64247316",
"0.6413011",
"0.6066335",
"0.6004161",
"0.5980652",
"0.5980037",
"0.5962148",
"0.5934218",
"0.58595866",
"0.5827749",
"0.5826738",
"0.5810867",
"0.57867616",
"0.57783175",
"0.57745934",
"0.57313484",
"0.572427",
"0.57221615",
"0.57215106",
"0.5718272",
"0.57143"... | 0.6660553 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.