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 |
|---|---|---|---|---|---|---|
Read and preprocess an image without data augmentation (use for testing). | def read_for_validation(p):
return read_cropped_image(p, False) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_preprocess(self, img):\n return crop_rescale(imread(img))# - self.pixel_means",
"def preprocess_image(image) -> np.ndarray:\n pass",
"def preprocess(image):\n image = crop(image)\n image = resize(image)\n #image = rgb2yuv(image)\n return image",
"def preprocess(image):\n\ti... | [
"0.7598993",
"0.7406281",
"0.71564955",
"0.71266955",
"0.71208",
"0.7080131",
"0.7046954",
"0.7020899",
"0.70149356",
"0.6982491",
"0.6915032",
"0.6909857",
"0.6908401",
"0.68933564",
"0.6875853",
"0.68574196",
"0.6852792",
"0.6850616",
"0.6847086",
"0.6794508",
"0.6769531",
... | 0.0 | -1 |
Qiskit wrapper of sigmaY operator. | def sigmay(dim=2):
if dim == 2:
return gen_operator.sigmay()
else:
raise Exception('Invalid level specification of the qubit subspace') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sigma(self, x, y):\n return (((y-self(x))**2).mean())**0.5",
"def sigmaKin(self):\n return _pythia8.Sigma2qg2QQbarX8q_sigmaKin(self)",
"def sigmaKin(self):\n return _pythia8.Sigma1qg2qStar_sigmaKin(self)",
"def sigmaKin(self):\n return _pythia8.Sigma2qg2Wq_sigmaKin(self)",
"... | [
"0.70456547",
"0.63504744",
"0.62884796",
"0.62388784",
"0.6222168",
"0.6219514",
"0.62159884",
"0.6193382",
"0.6191879",
"0.61728716",
"0.6157061",
"0.61472666",
"0.6130034",
"0.61241794",
"0.6111551",
"0.61077875",
"0.6106828",
"0.6106368",
"0.6100981",
"0.61005235",
"0.608... | 0.0 | -1 |
Qiskit wrapper of sigmaZ operator. | def sigmaz(dim=2):
if dim == 2:
return gen_operator.sigmaz()
else:
raise Exception('Invalid level specification of the qubit subspace') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Z(q, *args, **kwargs):\n q.Z(*args, **kwargs); return q",
"def sigma(self, M, z):\n return self.sigma_z0(M) * self.delta_c(0) / self.delta_c(z)",
"def _sigma(self, z, a, delta):\t\t\r\n\t\tassert delta > 0\r\n\t\tif self.X[0] < z < self.X[0] + delta:\r\n\t\t\treturn a * pow((z + abs(self.X[0]) - ... | [
"0.6646696",
"0.6614965",
"0.66015124",
"0.6418503",
"0.63763285",
"0.63751554",
"0.63462114",
"0.6330572",
"0.63216054",
"0.63003016",
"0.629797",
"0.62846214",
"0.628011",
"0.62624705",
"0.6254375",
"0.62493837",
"0.62347597",
"0.62092894",
"0.6202963",
"0.620237",
"0.61898... | 0.79701626 | 0 |
Qiskit wrapper of identity operator. | def qeye(dim):
return gen_operator.identity(dim) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _identity(X):\n return X",
"def identity(self):\n pass",
"def identity(x, name=None):\n return x",
"def identity(x):\n return x",
"def identity(x):\n return x",
"def identity(x):\n return x",
"def identity(x, *arg, **kw):\n return x",
"def identity(arg):\n return arg",... | [
"0.736701",
"0.701797",
"0.69657385",
"0.6935371",
"0.6935371",
"0.6935371",
"0.6825098",
"0.6799245",
"0.6799245",
"0.67053866",
"0.6548436",
"0.6516716",
"0.65138686",
"0.6485668",
"0.647304",
"0.64452857",
"0.64452857",
"0.6375677",
"0.63245296",
"0.6316641",
"0.6280974",
... | 0.64319354 | 17 |
Builds the occupation number operator for a target qubit in a qubit oscillator system, where the oscillator are the first subsystems, and the qubit last. This does it for a dressed systems assuming estates has the same ordering | def qubit_occ_oper_dressed(target_qubit, estates, h_osc, h_qub, level=0):
# reverse sort by index
rev_h_osc = sorted(h_osc.items(), key=lambda x: x[0])[::-1]
rev_h_qub = sorted(h_qub.items(), key=lambda x: x[0])[::-1]
# osc_n * … * osc_0 * qubit_n * … * qubit_0
states = []
proj_op = 0 * fock_dm... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _build_target_q_op(self):\n # Get the maximum Q-value across the actions dimension for each head.\n replay_next_qt_max = tf.reduce_max(\n self._replay_next_target_net_outputs.q_networks, axis=1)\n is_non_terminal = 1. - tf.cast(self._replay.terminals, tf.float32)\n is_non_terminal = tf.expan... | [
"0.54724413",
"0.5414313",
"0.53260666",
"0.5286694",
"0.52371556",
"0.5133925",
"0.5132831",
"0.5095254",
"0.50618833",
"0.4999805",
"0.49932075",
"0.4991977",
"0.49858397",
"0.4963936",
"0.49530268",
"0.49518695",
"0.4937594",
"0.4860373",
"0.48557454",
"0.4854688",
"0.4848... | 0.6206218 | 0 |
Constructor for ``FeatureExtractor`` module. | def __init__(self, submodule):
# language=rst
super(FeatureExtractor, self).__init__()
self.submodule = submodule | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, feature_extractor, gp):\n super().__init__()\n\n self.feature_extractor = feature_extractor\n self.gp = gp",
"def __init__(self, feature_extractor: BodyShapeFE):\n self.fe = feature_extractor\n self.data = {}\n # Classifier dictionary holding lists of ... | [
"0.7587692",
"0.7584687",
"0.72947294",
"0.72594017",
"0.7159693",
"0.71307355",
"0.7072286",
"0.7063282",
"0.7054289",
"0.6962334",
"0.6956415",
"0.6901017",
"0.68556744",
"0.6782389",
"0.6763931",
"0.67513037",
"0.6707352",
"0.6691858",
"0.6608651",
"0.6607222",
"0.6520379"... | 0.7027872 | 9 |
Instantiates a layer of IF neurons with the subtractive reset mechanism from `this paper | def __init__(
self,
n: Optional[int] = None,
shape: Optional[Iterable[int]] = None,
traces: bool = False,
traces_additive: bool = False,
tc_trace: Union[float, torch.Tensor] = 20.0,
trace_scale: Union[float, torch.Tensor] = 1.0,
sum_input: bool = False,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, input=1, output=1, hidden=5):\n super(ClassifierNet, self).__init__()\n self.fc1 = nn.Linear(input, hidden) #define fully connected layers\n self.fc2 = nn.Linear(hidden, hidden) #can add multiple layers\n self.fc3 = nn.Linear(hidden, output)\n \n #self.acti... | [
"0.6129133",
"0.6070002",
"0.60123545",
"0.59536046",
"0.59227055",
"0.58960474",
"0.5881604",
"0.5865857",
"0.5843992",
"0.58017135",
"0.5792083",
"0.5791562",
"0.57898647",
"0.5747554",
"0.5733607",
"0.5729425",
"0.57237756",
"0.57097036",
"0.570637",
"0.5696677",
"0.569394... | 0.0 | -1 |
Instantiates a layer of IF neurons. | def __init__(
self,
n: Optional[int] = None,
shape: Optional[Sequence[int]] = None,
traces: bool = False,
traces_additive: bool = False,
tc_trace: Union[float, torch.Tensor] = 20.0,
trace_scale: Union[float, torch.Tensor] = 1.0,
sum_input: bool = False,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, n_input, n_output, hidden_layer_size, reg):\n self.reg = reg\n self.n_input = n_input\n self.n_output = n_output\n self.hidden_layer_size = hidden_layer_size\n\n self.layer1 = FullyConnectedLayer(n_input, hidden_layer_size)\n self.activation = ReLULayer(... | [
"0.6380298",
"0.6355469",
"0.6339428",
"0.6280502",
"0.6201522",
"0.6200448",
"0.6158452",
"0.6140328",
"0.61326927",
"0.6121337",
"0.6116293",
"0.59994185",
"0.596102",
"0.5948881",
"0.594304",
"0.5920711",
"0.5920093",
"0.5913684",
"0.590572",
"0.59036154",
"0.5849014",
"... | 0.0 | -1 |
Use a dataset to rescale ANN weights and biases such that that the max ReLU activation is less than 1. | def data_based_normalization(
ann: Union[nn.Module, str], data: torch.Tensor, percentile: float = 99.9
):
# language=rst
if isinstance(ann, str):
ann = torch.load(ann)
assert isinstance(ann, nn.Module)
def set_requires_grad(module, value):
for param in module.parameters():
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _rescaleData(self):\n # calculate the maxmum and minimum for each feature\n featuresMax = np.max(self.data, axis=0).flatten()[2:]\n featuresMin = np.min(self.data, axis=0).flatten()[2:]\n # map the range of each feature to [-1,1]\n self.data[:, 2:] = 2*(self.data[:, 2:]-featu... | [
"0.6138963",
"0.59502774",
"0.58560765",
"0.581759",
"0.58140767",
"0.5753229",
"0.5752063",
"0.5747492",
"0.57299304",
"0.56955945",
"0.5691812",
"0.56890565",
"0.5668052",
"0.56042296",
"0.55877054",
"0.5587378",
"0.55310994",
"0.5516238",
"0.55141294",
"0.54850376",
"0.541... | 0.563717 | 13 |
Converts an artificial neural network (ANN) written as a ``torch.nn.Module`` into a nearequivalent spiking neural network. | def ann_to_snn(
ann: Union[nn.Module, str],
input_shape: Sequence[int],
data: Optional[torch.Tensor] = None,
percentile: float = 99.9,
node_type: Optional[nodes.Nodes] = SubtractiveResetIFNodes,
**kwargs,
) -> Network:
# language=rst
if isinstance(ann, str):
ann = torch.load(ann)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _ann_to_snn_helper(prev, current, node_type, last=False, **kwargs):\n # language=rst\n if isinstance(current, nn.Linear):\n layer = node_type(\n n=current.out_features,\n reset=0,\n thresh=1,\n refrac=0,\n sum_input=last,\n **kwargs... | [
"0.6345553",
"0.6062447",
"0.5954293",
"0.5777585",
"0.57511747",
"0.5696572",
"0.56790173",
"0.5646745",
"0.55959636",
"0.5578164",
"0.55752033",
"0.5558581",
"0.5554599",
"0.5517014",
"0.5508879",
"0.545114",
"0.54016846",
"0.5377376",
"0.53616405",
"0.53543514",
"0.5302436... | 0.62129325 | 1 |
Load the specified image and return a [H,W,3] Numpy array. | def load_image(self, image_id):
# Load image
image = skimage.io.imread(self.image_info[image_id]['path'])
# If grayscale. Convert to RGB for consistency.
if image.ndim != 3:
image = skimage.color.gray2rgb(image)
# If has an alpha channel, remove it for consistency
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_image(image_path):\n image = Image.open(image_path)\n (im_width, im_height) = image.size\n return np.array(image.getdata()).reshape((im_height, im_width, 3)).astype(np.uint8)",
"def load_img(self, filename):\n img = Image.open(filename, 'r') # load the image in read mode\n ... | [
"0.75883913",
"0.7566074",
"0.7480912",
"0.7186332",
"0.71021694",
"0.7075875",
"0.6884529",
"0.6818526",
"0.6815315",
"0.6809068",
"0.6806579",
"0.67069626",
"0.6605292",
"0.65715957",
"0.6525121",
"0.65142107",
"0.6500686",
"0.6494955",
"0.6490717",
"0.64653593",
"0.6458431... | 0.0 | -1 |
A generator that returns images and corresponding target class ids, bounding box deltas, and masks. | def data_generator(dataset, config, shuffle=True,
augment=False, augmentation=None,
random_rois=0, batch_size=1, detection_targets=False):
b = 0 # batch item index
image_index = -1
image_ids = np.copy(dataset.image_ids)
error_count = 0
# Anchors
# [anchor_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_image_generator(network, images_dir, split, *args):\n img_width, img_height, batch_size = args\n\n image_file_list = glob(f'{images_dir}/{split}/**/*.JPG', recursive=True)\n dirs = sorted(os.listdir(f'{images_dir}/{split}'))\n num_classes = len(dirs)\n num_images = len(image_file_list)\n ... | [
"0.6394474",
"0.6359937",
"0.6321726",
"0.6256832",
"0.6239272",
"0.62356555",
"0.6228109",
"0.62280035",
"0.6138543",
"0.61372375",
"0.6104549",
"0.61035156",
"0.6089864",
"0.6061255",
"0.60608953",
"0.60559213",
"0.60391563",
"0.6028159",
"0.6014335",
"0.60034424",
"0.59856... | 0.6027924 | 18 |
Convert commaseparated tag list into list if needed. | def split_tags(cls, tags: Union[str, Iterable[str]]) -> List[str]:
if isinstance(tags, str):
return tags.split(",")
return list(tags) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def preprocess(self, wordlist):\n taglist = []\n \n for word in wordlist:\n \n taglist.append(self.tag_word(word))\n\n return wordlist, taglist",
"def tag_list(self):\n tags = [tag.strip() for tag in self.tag_string.split(\",\")]\n return sorted(fil... | [
"0.66723156",
"0.6526884",
"0.6376066",
"0.6035379",
"0.6027366",
"0.5973016",
"0.57817435",
"0.5752843",
"0.5750209",
"0.5723988",
"0.57146055",
"0.56679374",
"0.5650757",
"0.563543",
"0.55899364",
"0.5578233",
"0.5549979",
"0.55473495",
"0.5540917",
"0.5540144",
"0.55274796... | 0.621007 | 3 |
Performs all_gather operation on the provided tensors. | def concat_all_gather(tensor):
tensors_gather = [
torch.ones_like(tensor)
for _ in range(torch.distributed.get_world_size())
]
torch.distributed.all_gather(tensors_gather, tensor, async_op=False)
output = torch.cat(tensors_gather, dim=0)
return output | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def concat_all_gather(tensor):\n return tensor",
"def concat_all_gather(tensor):\r\n\r\n tensors_gather = [torch.ones_like(tensor)\r\n for _ in range(torch.distributed.get_world_size())]\r\n torch.distributed.all_gather(tensors_gather, tensor, async_op=False)\r\n\r\n output = torch.cat(tensors... | [
"0.7724751",
"0.74344134",
"0.74205935",
"0.74205935",
"0.74205935",
"0.73385054",
"0.69116014",
"0.6733775",
"0.6727929",
"0.6714259",
"0.6706371",
"0.6629121",
"0.65338147",
"0.65319777",
"0.65038794",
"0.6486809",
"0.6483894",
"0.64343107",
"0.6414073",
"0.617286",
"0.6102... | 0.74301034 | 2 |
figure out the users current learning language use this one as parameter for the shop | def buy_streak_freeze(self):
lang = self.get_abbreviation_of(
self.get_user_info()['learning_language_string'])
if lang is None:
raise Exception('No learning language found')
try:
self.buy_item('streak_freeze', lang)
return True
except Alre... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_lang_param():\n if \"RU\" in forLastStrokes()[0]:\n TRIG_LNG = 'RU'\n return TRIG_LNG\n elif \"EN\" in forLastStrokes()[0]:\n TRIG_LNG = 'EN'\n return TRIG_LNG",
"def select_language():\n return translation.get_language()",
"def language():\n return random.choic... | [
"0.71389437",
"0.70938414",
"0.69485056",
"0.68811363",
"0.6850417",
"0.6833556",
"0.68295586",
"0.6743299",
"0.6615434",
"0.6615434",
"0.6612834",
"0.6581562",
"0.6579107",
"0.6575534",
"0.6571486",
"0.65700185",
"0.65284806",
"0.650098",
"0.64647365",
"0.64473975",
"0.64337... | 0.0 | -1 |
Return the current time formatted for logging. | def log_date_time_string(self):
monthname = [None, 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
now = time.time()
year, month, day, hh, mm, ss, x, y, z = time.localtime(now)
s = "%02d/%3s/%04d %02d:%02d:%02d" % (
day, monthname[month], year, hh, mm, ss)
return s | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_time():\n\tts = time.time()\n\treturn datetime.datetime.fromtimestamp(ts).strftime('%Y-%m-%d %H:%M:%S')",
"def now(self):\n return time.strftime(self.console_format_strftime)",
"def get_current_time():\n return datetime.now().strftime(\"%Y-%m-%d %H:%M:%S\")",
"def current_time() -> ... | [
"0.8288012",
"0.8287787",
"0.8239482",
"0.8226438",
"0.81187886",
"0.8085998",
"0.8067174",
"0.8033925",
"0.7927584",
"0.7909391",
"0.78702503",
"0.7858932",
"0.78461725",
"0.7838599",
"0.7830014",
"0.77598995",
"0.7726488",
"0.7697752",
"0.7678628",
"0.7659026",
"0.7642493",... | 0.73271525 | 57 |
Ban a user from the channel. | async def ban(self, user):
await self.send_message(".ban {user}".format(user=user))
LOG.debug("%s has been banned", user) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ban_user(self, user, channel):\n\n self.send_message(\"/ban {}\".format(user), channel)",
"def ban(user):\n self.sendMessageToChat(\".ban {}\".format(user))",
"async def ban(self, ctx: commands.Context, discord_user: discord.User) -> None:\n\n if discord_user.id in ADMIN_USER_IDS:\n ... | [
"0.8868841",
"0.8248323",
"0.8142516",
"0.8078495",
"0.79808193",
"0.79608274",
"0.78043485",
"0.780122",
"0.7750599",
"0.77224225",
"0.76273507",
"0.7567751",
"0.7526126",
"0.7375988",
"0.7366307",
"0.7317862",
"0.73164666",
"0.7238647",
"0.7236548",
"0.7217753",
"0.72162116... | 0.80425614 | 4 |
Ban a user from the channel. | async def timeout(self, user, seconds=600):
await self.send_message(".timeout {user} {seconds}".format(user=user, seconds=seconds))
LOG.debug("%s has been timed out for %ss", user, seconds) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ban_user(self, user, channel):\n\n self.send_message(\"/ban {}\".format(user), channel)",
"def ban(user):\n self.sendMessageToChat(\".ban {}\".format(user))",
"async def ban(self, ctx: commands.Context, discord_user: discord.User) -> None:\n\n if discord_user.id in ADMIN_USER_IDS:\n ... | [
"0.8868841",
"0.8248323",
"0.8142516",
"0.8078495",
"0.80425614",
"0.79808193",
"0.79608274",
"0.78043485",
"0.780122",
"0.7750599",
"0.77224225",
"0.76273507",
"0.7567751",
"0.7526126",
"0.7375988",
"0.7366307",
"0.7317862",
"0.73164666",
"0.7238647",
"0.7236548",
"0.7217753... | 0.0 | -1 |
Get git root path | def get_git_root(path):
git_repo = git.Repo(path, search_parent_directories=True)
git_root = git_repo.git.rev_parse("--show-toplevel")
return git_root | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_git_root_path():\r\n if '_git_root_path' not in _git_cache:\r\n root = check_subprocess_output('git rev-parse --show-toplevel', shell=True)\r\n _git_cache['_git_root_path'] = root.strip() if root else None\r\n return _git_cache['_git_root_path']",
"def get_git_root_folder():\n init... | [
"0.870771",
"0.86170995",
"0.8486402",
"0.8386353",
"0.8334225",
"0.8218487",
"0.82171524",
"0.8046516",
"0.8045912",
"0.7877124",
"0.78001994",
"0.7663117",
"0.7473233",
"0.74491805",
"0.7411227",
"0.7387491",
"0.72592187",
"0.7228911",
"0.7186794",
"0.7160083",
"0.71484965"... | 0.8374067 | 6 |
Get ARN for master instance profile. Currently needed since our upgrade code need ARN rather than name. | def get_master_arn(self):
profile = self._master_profile.get_instance_profile(self._master_name)
if profile:
return profile["InstanceProfile"]["Arn"] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def instance_arn(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"instance_arn\")",
"def instance_arn(self) -> Optional[str]:\n return pulumi.get(self, \"instance_arn\")",
"def instance_arn(self) -> Optional[str]:\n return pulumi.get(self, \"instance_arn\")",
"def _get_arn(self):... | [
"0.6315329",
"0.62189084",
"0.62189084",
"0.59236497",
"0.591906",
"0.58970267",
"0.58970267",
"0.58970267",
"0.58970267",
"0.58970267",
"0.58970267",
"0.58970267",
"0.58970267",
"0.58970267",
"0.58970267",
"0.58970267",
"0.58970267",
"0.58970267",
"0.58970267",
"0.58970267",
... | 0.85904276 | 0 |
Get name for minion instance profile. No need to lookup from AWS as name is sufficient. | def get_minion_instance_profile_name(self):
return self._minion_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def profile_name(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"profile_name\")",
"def profile_name(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"profile_name\")",
"def profile_name(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"profile_name\")",
"def Profile... | [
"0.8028233",
"0.78188854",
"0.78188854",
"0.72029895",
"0.7003823",
"0.69614637",
"0.68383986",
"0.68383986",
"0.6773511",
"0.6761452",
"0.6708672",
"0.66952896",
"0.66952896",
"0.6664435",
"0.6613814",
"0.6602192",
"0.65903187",
"0.6529931",
"0.6500878",
"0.646235",
"0.64590... | 0.8274209 | 0 |
True if the given token is out of the vocabulary used or if it is the actual unknown token. | def is_unknown_token(self, token):
return token not in self.token_to_id or token == self.unknown_token() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_unk(self, token: str) -> bool:\n return self.stoi[token] == DEFAULT_UNK_ID()",
"def is_valid_token(self, token: str) -> bool:\n return self.is_latin(token) and not (\n self.is_stopword(token) or self.is_punct(token) or self.is_digit(token) or self.is_single_letter(token)\n ... | [
"0.74913037",
"0.7164935",
"0.71004474",
"0.69666654",
"0.6657155",
"0.6587257",
"0.65815175",
"0.6455113",
"0.6448239",
"0.64217",
"0.63335526",
"0.6314986",
"0.62161076",
"0.62121665",
"0.61957073",
"0.61947477",
"0.61947477",
"0.61934716",
"0.6151861",
"0.61076784",
"0.606... | 0.7638412 | 0 |
Converts a whitespacedelimited sentence into a list of word ids. | def sentence_to_token_ids(self, sentence):
return [self.convert_token_to_id(word) for word in sentence.split()] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sentence2ids(sentence, vocabulary):\n\twords = list(sentence)\n\tword_list = []\n\tfor word in words:\n\t\tword_list.append(vocabulary.get(word))\n\treturn word_list",
"def convertSent2WordIds(self, sentence):\n\n sent2id = []\n\n try:\n sent2id = sent2id + [self.vocab_idx[word] if self.voc... | [
"0.7611485",
"0.74406576",
"0.719461",
"0.7137461",
"0.7038466",
"0.6939971",
"0.69280404",
"0.6922298",
"0.68866944",
"0.68820506",
"0.68687505",
"0.6861126",
"0.68175465",
"0.6707752",
"0.67042494",
"0.6651593",
"0.6649692",
"0.6621129",
"0.6610608",
"0.66069484",
"0.659773... | 0.78446895 | 0 |
Converts a list of word ids to a list of their corresponding words. | def token_ids_to_tokens(self, word_ids):
return [self.convert_id_to_token(word) for word in word_ids] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def outputids2words(id_list, source_oovs, vocab):\n\n ###########################################\n # TODO: module 1 task 4 #\n ###########################################\n\n words = []\n \n for id in id_list:\n try:\n word = vocab.index2word[id]\n exce... | [
"0.73610514",
"0.71997166",
"0.6999656",
"0.69163626",
"0.68160945",
"0.6704441",
"0.66474336",
"0.6604981",
"0.65623266",
"0.64362925",
"0.63661027",
"0.635341",
"0.62872785",
"0.62762266",
"0.6235747",
"0.6221872",
"0.6191389",
"0.61674404",
"0.6145446",
"0.61008275",
"0.60... | 0.6912709 | 4 |
Return a data frame that only includes the City portion of the sales tax. School District receives 50% of monthly collections until the cap ($120M) is reached. This gives the City sales data a strong seasonality, with peaks in the summer months. | def get_city_sales_only(X):
# Set up
R = X.copy()
has_sectors = X.columns.nlevels > 1
# Add a fake column level for continuity of cases
if not has_sectors and len(X.columns) != 1:
R.columns = pd.MultiIndex.from_product([["total"], R.columns])
has_sectors = True
# Get the "tota... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_city_sales_only(df: pd.DataFrame) -> pd.DataFrame:\n # Make sure our columns exist\n assert all(col in df.columns for col in [\"month\", \"fiscal_year\", \"total\"])\n\n # Create a copy and add the fiscal year for sales calculation\n X = df.copy()\n X[\"fiscal_year_sales\"] = df.apply(get_s... | [
"0.75552803",
"0.5746017",
"0.5688828",
"0.56631255",
"0.56395066",
"0.56158006",
"0.5609985",
"0.56088173",
"0.556738",
"0.5564772",
"0.5563576",
"0.5560639",
"0.5560242",
"0.5554912",
"0.5548161",
"0.55433095",
"0.54970866",
"0.5494793",
"0.54940295",
"0.5493806",
"0.549181... | 0.6939763 | 1 |
Constructor for VirtualMachine which assign basic properties. | def __init__(self, user_id, vm_property=None):
self.user_id = user_id
self.vm_property = vm_property | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, node,config=None, vm_info=None):\n VM.__init__(self, node, config,vm_info)",
"def __init__(self, virtual_memory: VirtualMemory, virtual_disk: VirtualDisk):\n pass",
"def __init__(self, vm_spec):\n super(DigitalOceanVirtualMachine, self).__init__(vm_spec)\n self.droplet_id... | [
"0.69429433",
"0.68785167",
"0.6667712",
"0.666642",
"0.6586862",
"0.6582658",
"0.64658487",
"0.64302707",
"0.6353395",
"0.6353226",
"0.613122",
"0.6066696",
"0.60421747",
"0.60363024",
"0.6026826",
"0.59966445",
"0.59961504",
"0.5987873",
"0.59769636",
"0.59606034",
"0.59505... | 0.6507372 | 6 |
Sets given id of virtual machine. | def set_vm_id(self, vm_id):
self.vm_id = vm_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_id(self, id):\n \n if id == self.id:\n return # nothing to do as no-op\n if id in self.__id_store:\n raise ValueError('ViewElement id %s is already assigned.' % id)\n \n # remove the old id if applicable\n if self.id != None and self.id in se... | [
"0.6689811",
"0.6665438",
"0.6401431",
"0.6365945",
"0.6279936",
"0.62338793",
"0.62338793",
"0.62338793",
"0.62338793",
"0.62338793",
"0.62338793",
"0.62338793",
"0.62338793",
"0.62338793",
"0.62338793",
"0.62338793",
"0.62338793",
"0.6197553",
"0.6197553",
"0.6197553",
"0.6... | 0.77777886 | 0 |
Gets private IP address caller's VM. | def get_vm_private_ip(cls, vm_id):
virtual_machine = cls.get_by_id(vm_id)
if virtual_machine != FAILED:
# Gets information about private IP
return virtual_machine.get('leases')[0].get('address')
else:
return virtual_machine | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_vm_priv_ip():\n ip = socket.gethostbyname(socket.getfqdn())\n return ip",
"def private_ip(self):\n return self._private_ip",
"def private_ip(self):\n return self._private_ip",
"def private_ip(self) -> str:\n return pulumi.get(self, \"private_ip\")",
"def private_ip_addres... | [
"0.82664895",
"0.78844",
"0.78844",
"0.7868557",
"0.7777794",
"0.77144784",
"0.77144784",
"0.7563921",
"0.7563921",
"0.7527404",
"0.7499474",
"0.7499474",
"0.7499474",
"0.7499474",
"0.7499474",
"0.7499474",
"0.7499474",
"0.74993086",
"0.74993086",
"0.74993086",
"0.74993086",
... | 0.7580753 | 7 |
Gets public IP address caller's VM. | def get_vm_public_ip(cls, vm_id):
virtual_machine = cls.get_by_id(vm_id)
if virtual_machine != FAILED:
# Gets information about public IP
return virtual_machine.get('leases')[0].get('public_ip').get('address')
else:
return virtual_machine | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def public_ip_address(self) -> str:\n return pulumi.get(self, \"public_ip_address\")",
"def get_public_ip(self):\n ip_addr = requests.get(self._PUBLIC_IP_URL).text\n return ip_addr.strip(\" \")",
"def public_ip(self):\n return self._public_ip",
"def public_ip(self):\n retur... | [
"0.7980097",
"0.7881606",
"0.7854073",
"0.7854073",
"0.7854073",
"0.7854073",
"0.77803963",
"0.7768923",
"0.77078205",
"0.77023417",
"0.76912",
"0.7679695",
"0.76748073",
"0.76748073",
"0.7635561",
"0.7624418",
"0.7624418",
"0.7624418",
"0.7624418",
"0.7624418",
"0.7624418",
... | 0.7573046 | 29 |
Returns whether there's a date gap in the series. | def has_missing_dates(self):
return self._dates.has_missing_dates() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_date_points(self):\n return self.__contains_datefields",
"def no_date_x_days_before_date_to_check(date_to_check, datelist, min_gap):\n for previous_date in datelist:\n if previous_date >= date_to_check:\n continue\n if (date_to_check - previous_date).days <= min_gap:\n ... | [
"0.6697807",
"0.6671149",
"0.6609423",
"0.6567023",
"0.62952125",
"0.6064757",
"0.5905626",
"0.5885827",
"0.5805659",
"0.5775929",
"0.5773055",
"0.57669",
"0.573684",
"0.5734824",
"0.5697757",
"0.5663714",
"0.56419724",
"0.5606667",
"0.5599163",
"0.5543669",
"0.5540185",
"0... | 0.63225055 | 4 |
Returns whether there's no date gap in the series. | def isfull(self):
return self._dates.isfull() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_missing_dates(self):\n return self._dates.has_missing_dates()",
"def has_date_points(self):\n return self.__contains_datefields",
"def gaps(self):\n return self._data == self.alphabet.gap_index",
"def has_duplicated_dates(self):\n return self._dates.has_duplicated_dates()"... | [
"0.7278429",
"0.66155237",
"0.6490977",
"0.6486538",
"0.6445962",
"0.6364193",
"0.6346676",
"0.6201986",
"0.608446",
"0.60835373",
"0.59527457",
"0.5927689",
"0.59224343",
"0.5851996",
"0.5829765",
"0.5772417",
"0.5741263",
"0.5726953",
"0.5709687",
"0.56747675",
"0.56677616"... | 0.5532367 | 29 |
Returns whether there are duplicated dates in the series. | def has_duplicated_dates(self):
return self._dates.has_duplicated_dates() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_duplicates(the_list):\n\n for day in the_list:\n if the_list.count(day) > 1:\n return True\n return False",
"def _has_timestamp_duplicates(df):\n df = df.copy()\n try:\n dup_mask = df.duplicated(subset=[TIME], keep=False)\n except KeyError:\n df = df.reset_i... | [
"0.7083914",
"0.6777442",
"0.6533388",
"0.6305219",
"0.62352103",
"0.613806",
"0.6030095",
"0.60163593",
"0.60088986",
"0.59911424",
"0.5943231",
"0.59313375",
"0.587853",
"0.58704644",
"0.5812012",
"0.57751054",
"0.5769493",
"0.5751475",
"0.57327694",
"0.5729417",
"0.5728829... | 0.8835026 | 0 |
Get the log viewers tab icon | def GetBitmap(self):
bmp = wx.ArtProvider.GetBitmap(str(self.GetId()), wx.ART_MENU)
return bmp | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def icon(self) -> str:\n return self.period[\"icon\"]",
"def icon(self):\n return self.get_info_string(\"P_ICON\")",
"def icon(self):\n\t\treturn self._icon",
"def icon(self):\n\t\treturn self._icon",
"def icon():\n\n return None",
"def icon(self):\n\t\treturn self._ezo_icon",
"def... | [
"0.6772291",
"0.67047536",
"0.66293234",
"0.66293234",
"0.66282135",
"0.6591643",
"0.65914917",
"0.65914917",
"0.65914917",
"0.65914917",
"0.65914917",
"0.65914917",
"0.65914917",
"0.65914917",
"0.65914917",
"0.65914917",
"0.65914917",
"0.65914917",
"0.65914917",
"0.65914917",
... | 0.0 | -1 |
Return the name of this control | def GetName(self):
return self.__name__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name(self) -> str:\n if self._open_ctrl:\n return f\"{self._name}_o{self.ctrl_state}\"\n else:\n return self._name",
"def name(self):\n return str(self.label.text())",
"def name(self):\n return self.root.label.text",
"def name(self) -> str:\n\t\treturn se... | [
"0.80879676",
"0.79933685",
"0.7721939",
"0.77104825",
"0.7681743",
"0.7661991",
"0.76442933",
"0.7640385",
"0.7640385",
"0.7626364",
"0.76183194",
"0.76037204",
"0.76037204",
"0.76037204",
"0.76037204",
"0.76037204",
"0.76037204",
"0.76037204",
"0.7602718",
"0.75960076",
"0.... | 0.0 | -1 |
Checks if num is a prime value | def __next_prime(self):
def is_prime(num):
for i in range(2, int(num ** 0.5) + 1):
if (num % i) == 0: return False
return True
prime = 3
while 1:
if is_prime(prime):
yield prime
prime += 2 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_prime(num: int) -> bool:\n pass",
"def is_prime_number(num):\n\n for i in range(2, num):\n if num % i == 0:\n return False\n else:\n return True",
"def is_prime(num):\n for i in range(3, int(num ** 0.5) + 1, 2):\n if num % i == 0:\n ... | [
"0.8536351",
"0.84232825",
"0.836485",
"0.83276284",
"0.83249646",
"0.8322677",
"0.8322144",
"0.8298836",
"0.8293609",
"0.8293099",
"0.8292301",
"0.8278527",
"0.82757384",
"0.82719606",
"0.8199665",
"0.8189039",
"0.8184318",
"0.8176038",
"0.8161287",
"0.8151188",
"0.8144022",... | 0.0 | -1 |
Add an axis description. | def set_axis(self, name, data, domain, dtype):
if domain == "categorical":
if dtype is int:
data = [int(i) for i in data]
elif dtype is str:
data = [str(i) for i in data]
elif dtype is float:
data = [float(i) for i in data]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_description(self, description):\n self.description = description",
"def addAxis(self, hideAxis=False, arrows=True, color='black', lw=1, label=True, xlabel='x', ylabel='y', mplprops={}):\n\n\t\tpixelSize = self.width\n\t\taxis = Axis.Axis(hideAxis, arrows, color, lw, label, xlabel, ylabel, mplprops... | [
"0.64115226",
"0.63427013",
"0.6237336",
"0.62156796",
"0.6206562",
"0.61592263",
"0.58897346",
"0.5829228",
"0.5753219",
"0.56116307",
"0.5513431",
"0.55040324",
"0.5500112",
"0.5445579",
"0.5438613",
"0.5422384",
"0.5420818",
"0.54147804",
"0.5410743",
"0.5405874",
"0.54058... | 0.0 | -1 |
The constructor accepts a HyppopyProject. | def __init__(self, project=None):
HyppopySolver.__init__(self, project)
self._sampler = None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, project):\n self.project = project",
"def __init__(self, project=None):\n HyppopySolver.__init__(self, project)\n self._searchspace = None\n self.candidates_list = list()",
"def __init__(self, proj=None):\n self._proj = proj or projects.new('new_project')\n... | [
"0.69205624",
"0.6880289",
"0.6607001",
"0.64621216",
"0.6228863",
"0.61656123",
"0.6081908",
"0.6008693",
"0.59014654",
"0.58944476",
"0.57785344",
"0.56618416",
"0.5620562",
"0.5616844",
"0.5610953",
"0.55924207",
"0.551884",
"0.5517482",
"0.54866326",
"0.54836047",
"0.5459... | 0.7241876 | 0 |
Convert instance to string | def __str__(self):
return "{0}".format(self.name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_string(self):\r\n return self.__str__()",
"def to_str (self):\n return str(self.__class__) + \" \" + pprint.pformat(self.to_dict())",
"def __str__(self):\n return self.to_string()",
"def to_string(self) -> str:\n pass",
"def toString(self):\n return self.__str__()"... | [
"0.80202794",
"0.792117",
"0.77184546",
"0.76863927",
"0.7629499",
"0.76233983",
"0.7582067",
"0.7527026",
"0.7521663",
"0.75089926",
"0.74827313",
"0.74827313",
"0.74827313",
"0.74827313",
"0.74827313",
"0.74827313",
"0.74827313",
"0.74827313",
"0.74827313",
"0.74827313",
"0... | 0.0 | -1 |
Equal comparison Two launch methods are defined equal, if and only if their names are equal. | def __eq__(self, other):
return self.name == other.name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def equivalent(p1, p2):\n equal = p1.name == p2.name\n if len(p1.args.args) != len(p2.args.args):\n return False\n else:\n for a1, a2 in zip(p1.args.args, p2.args.args):\n equal = equal and a1.arg_name == a2.arg_name\n return equal",
"def __eq__(self, other):\n ret... | [
"0.6145887",
"0.61037546",
"0.57509786",
"0.5735382",
"0.5554254",
"0.5554254",
"0.5554254",
"0.5554254",
"0.5554254",
"0.5554254",
"0.5554254",
"0.5554254",
"0.5554254",
"0.54589444",
"0.543829",
"0.536503",
"0.53460217",
"0.5311434",
"0.53001654",
"0.53001404",
"0.52902925"... | 0.4919218 | 95 |
Compare two cloth models | def compare_clothes(
model1, model2, db_path_1, db_path_2, face_conf,
intra_dist1=None, params=None, k=1):
# Method for comparing clothes ('min', 'mean' or 'max')
method = c.CLOTHES_CHECK_METHOD
# True if 3 bboxes per frame are used
used_3_bboxes = c.CLOTHING_REC_USE_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n comparison = Representation.compare_entities(self, other)\n self.diff_info = comparison[\"self_diff\"]\n other.diff_info = comparison[\"other_diff\"]\n return comparison[\"is_equal\"]",
"def same_model(res1, res2):\n return res1.get_parent().get_parent() == res2.get_pare... | [
"0.65161216",
"0.6497612",
"0.6391315",
"0.6331559",
"0.62610364",
"0.6237531",
"0.62303483",
"0.6215721",
"0.619992",
"0.6166617",
"0.6164665",
"0.6136317",
"0.6100597",
"0.60938936",
"0.6074784",
"0.6064405",
"0.60617745",
"0.6048385",
"0.6036931",
"0.60038537",
"0.5976149"... | 0.6454681 | 2 |
Sets the input tensor. | def set_input_tensor(interpreter, image):
tensor_index = interpreter.get_input_details()[0]['index']
input_tensor = interpreter.tensor(tensor_index)()[0]
input_tensor[:, :] = np.expand_dims((image-255)/255, axis=0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_input_tensor(self, input_tensor):\n self.input_tensor = input_tensor",
"def set_input_tensor(self, image):\n tensor_index = self._interpreter.get_input_details()[0]['index']\n input_tensor = self._interpreter.tensor(tensor_index)()[0]\n input_tensor[:, :] = image",
"def set_... | [
"0.8690655",
"0.78343236",
"0.7531339",
"0.75179994",
"0.74826103",
"0.6987358",
"0.6924989",
"0.6785216",
"0.675127",
"0.6743619",
"0.6697826",
"0.66477954",
"0.66477954",
"0.6571759",
"0.6563951",
"0.6552965",
"0.6464202",
"0.6441674",
"0.6380346",
"0.6380346",
"0.632905",
... | 0.7290475 | 6 |
Returns the output tensor at the given index. | def get_output_tensor(interpreter, index):
output_details = interpreter.get_output_details()[index]
tensor = np.squeeze(interpreter.get_tensor(output_details['index']))
return tensor | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_output_tensor(self, index) -> np.ndarray:\n output_details = self._interpreter.get_output_details()[index]\n tensor = np.squeeze(self._interpreter.get_tensor(output_details['index']))\n\n return tensor",
"def get_output_tensor(interpreter, index):\n output_details = interpreter.ge... | [
"0.8588016",
"0.8460146",
"0.84236956",
"0.73207355",
"0.7265836",
"0.6890047",
"0.6759862",
"0.66948026",
"0.6614312",
"0.6602761",
"0.653903",
"0.64080614",
"0.62412524",
"0.6142005",
"0.610645",
"0.60945153",
"0.6062034",
"0.60246843",
"0.6023404",
"0.60211194",
"0.5990455... | 0.8473132 | 3 |
Return user's real name. It's impossible to create an Applicant in the Onfido API with a blank first/last name, so assuming that get_full_name will not be blank. | def _user(self, obj: Applicant | Check | Report) -> str:
return obj.user.get_full_name().title() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_full_name(self):\n if not self.first_name and not self.last_name:\n return u'%s %s' % ('Anonymous User', self.id)\n full_name = u'%s %s' % (self.first_name, self.last_name)\n return full_name.strip()",
"def _user_get_full_name(user):\n return user.profile.full_name if u... | [
"0.8450197",
"0.82360315",
"0.8103581",
"0.8076186",
"0.8074853",
"0.8054131",
"0.7994775",
"0.7993053",
"0.79732025",
"0.7940613",
"0.7940613",
"0.793837",
"0.793837",
"0.793837",
"0.793837",
"0.793837",
"0.793837",
"0.793837",
"0.793837",
"0.793837",
"0.793837",
"0.793837... | 0.0 | -1 |
Returns True whether there is text to read. | def has_char(self):
return bool(not self._is_empty_buffer() or self._next_line()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hasText(self):\n return self.__text is not None",
"def _is_text(file_path: str) -> bool:\n try:\n with open_file(file_path, \"r\") as f:\n f.read()\n return True\n except UnicodeDecodeError:\n return False",
"def hasText(self):\n return len(self.text_) > 0",
... | [
"0.77025986",
"0.764653",
"0.7535597",
"0.72007656",
"0.6927919",
"0.68754864",
"0.6821187",
"0.67807555",
"0.67505515",
"0.674842",
"0.6734495",
"0.6690756",
"0.6655131",
"0.66471803",
"0.64601713",
"0.6421352",
"0.6421352",
"0.6421352",
"0.6367001",
"0.632881",
"0.6328567",... | 0.63749826 | 18 |
Test to make sure that previous users can list and delete projects where they aren't owners. | def test_previous_users_can_list_and_delete_translations_not_owner(self):
user_a = User.objects.get(username='eric')
project_a = get(
Project, users=[user_a],
language='es', main_language_project=None,
)
user_b = User.objects.get(username='tester')
projec... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_can_remove_owner_when_multiple_owners(self):\n # Make an extra owner for the project\n collaborator = self.project.collaborators.create(\n user = get_user_model().objects.create_user('owner2'),\n role = Collaborator.Role.OWNER\n )\n # Authenticate the clie... | [
"0.7334845",
"0.7314504",
"0.6921906",
"0.6824498",
"0.67919",
"0.6764037",
"0.6717957",
"0.66730934",
"0.6662892",
"0.66502506",
"0.66233987",
"0.6591928",
"0.6577181",
"0.65555114",
"0.65229785",
"0.65021294",
"0.64756685",
"0.64644754",
"0.64584225",
"0.6456225",
"0.645550... | 0.76625 | 0 |
Gets the type of Category. | def get_category_type(self) -> Categories:
return self._category | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_category(self):\n subtype = self.get_subtype_with_attr('get_category')\n if subtype:\n return subtype.get_category\n \n return self.category.all()[0].name",
"def get_category(self):\n return self.category",
"def get_category(self) -> str:\n return s... | [
"0.7761249",
"0.7648312",
"0.7616945",
"0.7471725",
"0.7387152",
"0.737387",
"0.7341254",
"0.7190663",
"0.7181667",
"0.71125877",
"0.69434804",
"0.6873398",
"0.6822473",
"0.6822473",
"0.6665863",
"0.6641275",
"0.65311784",
"0.64776343",
"0.6473038",
"0.64689374",
"0.6446576",... | 0.8926716 | 0 |
Gets the cost amount. | def get_amount(self) -> float:
return self._amount | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_cost(self):\n return float(self.main[\"cost\"])",
"def cost(self) -> str:\n return pulumi.get(self, \"cost\")",
"def cost(self):\n return self._cost",
"def cost(self):\n return self._cost",
"def cost(self):\n return self._cost",
"def cost(self):\n return ... | [
"0.8616",
"0.82697403",
"0.8230554",
"0.8230554",
"0.8230554",
"0.8230554",
"0.81507224",
"0.8063015",
"0.8063015",
"0.8063015",
"0.8063015",
"0.8063015",
"0.8063015",
"0.8063015",
"0.8063015",
"0.8063015",
"0.79131055",
"0.77215946",
"0.77168125",
"0.7691779",
"0.76873064",
... | 0.6784993 | 47 |
Returns the formatted string that represents this transaction. | def __str__(self) -> str:
return "Time: %s, Amount: %f, Category: %s, Institution Name: %s" % \
(datetime.fromtimestamp(ceil(self._timestamp)), self._amount, self._category, self._name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n time = self.timestamp.strftime(\"%b %d %Y %H:%M:%S\")\n transaction_string = tabulate(\n [[\"Category\", f\"{self.category}\"], [\"Time\", f\"{time}\"], [\"Amount\", f\"${self.dollar_amount:.2f}\"],\n [\"Location\", f\"{self.purchase_location}\"]], tablefmt... | [
"0.7918415",
"0.77845335",
"0.7607491",
"0.7607491",
"0.7607491",
"0.7607491",
"0.7607491",
"0.7607491",
"0.7607491",
"0.7607491",
"0.7607491",
"0.7607491",
"0.7607491",
"0.7607491",
"0.7607491",
"0.7607491",
"0.7607491",
"0.7607491",
"0.7607491",
"0.7607491",
"0.7607491",
... | 0.0 | -1 |
Return the currently selected item. | def value(self):
return self._wgt_select.value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def currently_selected_item(self):\n return self.currently_selected[0]",
"def currently_selected_sub_item(self):\n return self.currently_selected[1]",
"def current_item(self):\n return self._switcher.current_item()",
"def select_item(self):\n return self.tk.call(self._w, 'select',... | [
"0.91429013",
"0.8589467",
"0.8451988",
"0.83216506",
"0.82419544",
"0.81935847",
"0.8061256",
"0.78658974",
"0.78067607",
"0.7796263",
"0.7752732",
"0.77376044",
"0.77215666",
"0.75677645",
"0.7537001",
"0.7448949",
"0.7365907",
"0.7353046",
"0.72800994",
"0.72044325",
"0.72... | 0.0 | -1 |
Set current selected value of widget. | def value(self, value):
if value in self.options:
self._wgt_select.label = value
if isinstance(self.options, dict) and value in self.options.values():
self._wgt_select.value = value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_selection(self, value):\n if value is not None:\n if is_int(value):\n self.combobox.SetSelection(value)",
"def set_selection_by_data(self, value):\n self.combobox.set_selection_by_data(value)",
"def select(self):\n self.selected = True",
"def selected(se... | [
"0.76306945",
"0.73291355",
"0.7073432",
"0.68710476",
"0.67909443",
"0.6657822",
"0.6657822",
"0.65810513",
"0.65810513",
"0.6560391",
"0.65355253",
"0.6486679",
"0.64457387",
"0.6442499",
"0.64300066",
"0.6426783",
"0.64159703",
"0.6402404",
"0.63485706",
"0.63485706",
"0.6... | 0.57121676 | 54 |
Return optionally filtered list of option tuples. | def _get_filtered_options(
self, substring: str = ""
) -> List[Union[str, Tuple[str, str]]]:
if self.options is None:
return []
if isinstance(self.options, list):
return [val for val in self.options if substring.casefold() in val.lower()]
return [
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_option_tuples(self, option_string):\n return []",
"def _findAllOptions(optionType, options, default=[]):\n result = []\n for opt in options:\n if isinstance(opt,optionType):\n result.append(opt)\n if len(result)==0:\n result = default\n return result",
"def ... | [
"0.6295525",
"0.61575246",
"0.6138108",
"0.60871345",
"0.6084014",
"0.6066132",
"0.60460126",
"0.5997256",
"0.59210485",
"0.58897567",
"0.58477956",
"0.5826668",
"0.582357",
"0.58112204",
"0.5790197",
"0.57897705",
"0.5771087",
"0.57153785",
"0.56824076",
"0.5661081",
"0.5648... | 0.6440813 | 0 |
Count the number of instances of the supplied character in the candidate string. | def count_characters(candidate, characters):
counts = {}
for c in candidate:
if c in characters:
if c not in counts:
counts[c] = 0
counts[c] += 1
return counts | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def countLetterString(char,string):\n count = 0\n for a in string:\n if a == char:\n count=count+1\n return count;",
"def count_chars(entry, char):\r\n\r\n pos = 0\r\n count = 0\r\n while pos < len(entry):\r\n if entry[pos] == char:\r\n count = count + 1\r\n ... | [
"0.76088274",
"0.7496967",
"0.73206687",
"0.7313542",
"0.7313542",
"0.7129145",
"0.71212125",
"0.71212125",
"0.70597017",
"0.69695085",
"0.69567734",
"0.69387054",
"0.6934384",
"0.6906438",
"0.6874935",
"0.6868187",
"0.6852529",
"0.685077",
"0.6817543",
"0.6785212",
"0.675837... | 0.71995836 | 5 |
This function updates and returns shares Sq of the pool after a liquidity add. | def addLiquidity_Sq(params, substep, state_history, prev_state, policy_input):
asset_id = policy_input['asset_id'] # defines asset subscript
Sq = prev_state['Sq']
delta_R = policy_input['ri_deposit']
pool = prev_state['pool']
R = pool.get_reserve(asset_id)
S = pool.get_share(asset_id)
d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def addLiquidity_pool(params, substep, state_history, prev_state, policy_input):\n asset_id = policy_input['asset_id'] # defines asset subscript\n pool = prev_state['pool'] \n delta_R = policy_input['ri_deposit']\n a = params['a']\n\n R = pool.get_reserve(asset_id)\n S = pool.get_share(asset... | [
"0.6156317",
"0.565944",
"0.5557345",
"0.55232066",
"0.53193724",
"0.5271425",
"0.52659833",
"0.51941293",
"0.51846296",
"0.5169052",
"0.51598144",
"0.51541835",
"0.51343054",
"0.5131408",
"0.51225543",
"0.5105927",
"0.51054764",
"0.5099566",
"0.507925",
"0.5067094",
"0.50642... | 0.60814816 | 1 |
This function returns shares Sq after a liquidity removal in a specific risk asset. The delta_Sq is taken prom the policy_input as the amount 'UNI_burn' | def removeLiquidity_Sq(params, substep, state_history, prev_state, policy_input):
asset_id = policy_input['asset_id'] # defines asset subscript
delta_S = policy_input['UNI_burn']
Sq = prev_state['Sq']
return ('Sq', Sq - delta_S) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def addLiquidity_Sq(params, substep, state_history, prev_state, policy_input):\n asset_id = policy_input['asset_id'] # defines asset subscript\n Sq = prev_state['Sq']\n delta_R = policy_input['ri_deposit']\n pool = prev_state['pool']\n R = pool.get_reserve(asset_id)\n S = pool.get_share(asset_id)... | [
"0.66880953",
"0.6577927",
"0.6080535",
"0.5882658",
"0.5595726",
"0.5401485",
"0.5348573",
"0.53055537",
"0.53038174",
"0.5296841",
"0.5232176",
"0.5200716",
"0.51893973",
"0.50995225",
"0.50876635",
"0.50596046",
"0.5047947",
"0.50436264",
"0.50271356",
"0.4989646",
"0.4977... | 0.75221956 | 0 |
Test that we fail on missing json data. | def test_exit_on_missing_json(self, mockisfile, mock_sess):
self.login_handler.cred_file = "/tmp/fake.file"
mockisfile.return_value = True
with mock.patch("builtins.open", mock.mock_open(read_data="{}")):
self.assertFalse(self.login_handler.check_cred_file()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_json_data_with_missing_req_props_should_error():\n faulty_jsons = [\n { \"value\": \"foo\", \"size\": \"bar\" },\n { \"value\": [], \"size\": [] },\n { \"id\": [], \"size\": [] },\n { \"value\": [], \"id\": [] },\n ]\n for json_data in faulty_jsons:\n with pytes... | [
"0.8167233",
"0.7868333",
"0.78029394",
"0.7730193",
"0.77011824",
"0.7634229",
"0.7519706",
"0.74827605",
"0.74517775",
"0.74512",
"0.74325037",
"0.7394752",
"0.7326476",
"0.7324778",
"0.73175037",
"0.73175037",
"0.72763705",
"0.72511536",
"0.7250217",
"0.7238903",
"0.723530... | 0.0 | -1 |
Check bad response from server. | def test_bad_response(self, mock_sess):
self.assertFalse(self.login_handler.validate_response(None, None)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_error(self, response):\n pass",
"def _check_response_for_request_errors(self):\n\n pass",
"def check_response(self, response):\n if response.status_code == 401:\n raise D4S2Error(UNAUTHORIZED_MESSAGE)\n if not 200 <= response.status_code < 300:\n rais... | [
"0.7917304",
"0.73402005",
"0.7321523",
"0.7267913",
"0.7254284",
"0.7168588",
"0.7156158",
"0.71552587",
"0.707721",
"0.7075279",
"0.7053425",
"0.6983989",
"0.69764906",
"0.6914173",
"0.69106156",
"0.68916005",
"0.6885468",
"0.68584484",
"0.6852302",
"0.685044",
"0.68448687"... | 0.63458234 | 91 |
Initialize mock blink class. | def __init__(self, login_response):
self.available = False
self.login_response = login_response | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self):\n self.blink = blinkpy.Blink(username=USERNAME,\n password=PASSWORD)\n self.camera_config = {\n 'device_id': 1111,\n 'name': 'foobar',\n 'armed': False,\n 'active': 'disarmed',\n 'thumbnail': '/t... | [
"0.7118942",
"0.67123884",
"0.60771644",
"0.6025195",
"0.5962489",
"0.5752298",
"0.5722848",
"0.568779",
"0.5682905",
"0.5663229",
"0.5642815",
"0.5613709",
"0.5556249",
"0.5551786",
"0.55135834",
"0.5495806",
"0.54807407",
"0.5472651",
"0.5472601",
"0.54431564",
"0.54320323"... | 0.0 | -1 |
Determine if the frame produced a spare | def was_a_spare(self) -> bool:
is_spare = False
if all([self.roll_one is not None, self.roll_two is not None]):
is_spare = bool((self.roll_one + self.roll_two) == 10)
return is_spare | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def frame_available(self):\n return type(self._frame) != type(None)",
"def at_capacity(self):\n return False",
"def is_spill(self):\n return self._is_spill",
"def findFreeSlotInHand(self):\n if(len(self.hand) >= self.maxCardInHand):\n return False\n return True",... | [
"0.6681523",
"0.6561204",
"0.6117937",
"0.60814464",
"0.6076304",
"0.60415816",
"0.6022793",
"0.6000769",
"0.5999603",
"0.59908843",
"0.5951934",
"0.5938374",
"0.5935073",
"0.5923837",
"0.58783466",
"0.58782333",
"0.58638144",
"0.58330494",
"0.5824988",
"0.5821692",
"0.582169... | 0.6987601 | 0 |
get a dictionary representation of our frame object. | def __dict__(self):
return {'roll_one': self.roll_one,
'roll_two': self.roll_two,
'is_strike': self.is_strike,
'is_spare': self.is_spare,
'frame_score': self.frame_score,
'frame_complete': self.frame_complete()} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dict(self):\r\n return self.__dict__",
"def to_dict(self):\r\n return self.__dict__",
"def dict(self):\n return self.__dict__",
"def dict(self):\n return self.__dict__",
"def dict(self):\n return self.__dict__",
"def dict(self):\n return self.__dict__",
"de... | [
"0.7340186",
"0.7324841",
"0.7307647",
"0.7307647",
"0.7307647",
"0.7307647",
"0.7307647",
"0.7307647",
"0.7307647",
"0.7307647",
"0.7307647",
"0.7307647",
"0.7307647",
"0.7307647",
"0.7307647",
"0.72677034",
"0.7265292",
"0.72624695",
"0.72624695",
"0.72501296",
"0.7204771",... | 0.0 | -1 |
get a dictionary representation of our frame object. | def __dict__(self):
return {'roll_one': self.roll_one,
'roll_two': self.roll_two,
'roll_three': self.roll_three,
'is_strike': self.is_strike,
'is_spare': self.is_spare,
'frame_score': self.frame_score,
'frame_complet... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dict(self):\r\n return self.__dict__",
"def to_dict(self):\r\n return self.__dict__",
"def dict(self):\n return self.__dict__",
"def dict(self):\n return self.__dict__",
"def dict(self):\n return self.__dict__",
"def dict(self):\n return self.__dict__",
"de... | [
"0.7340186",
"0.7324841",
"0.7307647",
"0.7307647",
"0.7307647",
"0.7307647",
"0.7307647",
"0.7307647",
"0.7307647",
"0.7307647",
"0.7307647",
"0.7307647",
"0.7307647",
"0.7307647",
"0.7307647",
"0.72677034",
"0.7265292",
"0.72624695",
"0.72624695",
"0.72501296",
"0.7204771",... | 0.0 | -1 |
Log a message to stderr. | def log(self, message: str) -> None:
print(message, file=sys.stderr) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def log_err(msg):\n msg = 'ERROR: {0}\\n'.format(msg)\n sys.stderr.write(msg)",
"def log(message):\n stderr.write(\"%s\\n\" % message)",
"def log(message):\n sys.stderr.write(message + \"\\n\")",
"def STDERR(msg):\n sys.stderr.write(str(msg)+\"\\n\")",
"def error(message):\n\n if logLevel... | [
"0.8056336",
"0.8033304",
"0.7804102",
"0.76553595",
"0.76055974",
"0.75892496",
"0.75269014",
"0.746565",
"0.7300127",
"0.72577816",
"0.7247422",
"0.71775895",
"0.7164371",
"0.71591115",
"0.7130454",
"0.70036733",
"0.69603086",
"0.6959926",
"0.69544595",
"0.69256264",
"0.690... | 0.66105884 | 35 |
Create an authentication token on the REST server for this Session. | def _logon(self, conn_tries=1):
def delay_func(try_num, max_tries, *args, **kwargs):
delay = 2
LOG.warning(_("Failed to connect to REST server - is the pvm-rest "
"service started? Retrying %(try_num)d of "
"%(max_tries)d after %(delay... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _login(self):\n\n data = {\n 'grant_type': 'password',\n 'username': self.username,\n 'password': self.password\n }\n\n url = self.build_url('/token')\n return rest.post(url, data=data)",
"def generate_auth_token(self):\n token = Serializer(... | [
"0.7419975",
"0.72537285",
"0.721271",
"0.71500576",
"0.7042579",
"0.7012171",
"0.7008729",
"0.6935163",
"0.69219136",
"0.6905175",
"0.6903554",
"0.6899632",
"0.6899579",
"0.6891674",
"0.6885122",
"0.6880052",
"0.6874999",
"0.6871466",
"0.68381405",
"0.68174094",
"0.6797695",... | 0.0 | -1 |
Create a new Adapter instance, connected to a Session. | def __init__(self, session=None, use_cache=False, helpers=None):
if use_cache:
raise pvmex.CacheNotSupportedException()
self.session = session if session else Session()
self._helpers = self._standardize_helper_list(helpers)
self._sys_uuid = None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def create(cls, session):\n self = cls()\n self.session = session\n return self",
"def _create_session(config):\n connection = dvs_util.connect(config)\n return connection",
"def _adapter_connect(self):\r\n raise NotImplementedError",
"def __init__(self, session):\n ... | [
"0.6166855",
"0.6163837",
"0.5710425",
"0.56974655",
"0.56974655",
"0.56974655",
"0.56974655",
"0.56974655",
"0.56974655",
"0.569588",
"0.56836414",
"0.5662232",
"0.5662194",
"0.56550896",
"0.5630036",
"0.562997",
"0.5604555",
"0.5600288",
"0.5568905",
"0.55646694",
"0.556466... | 0.50422037 | 68 |
Produce a deep (except for adapter) copy of this Response. | def __deepcopy__(self, memo=None):
ret = self.__class__(
self.reqmethod, self.reqpath, self.status, self.reason,
copy.deepcopy(self.headers, memo=memo),
reqheaders=copy.deepcopy(self.reqheaders, memo=memo),
reqbody=self.reqbody, body=self.body)
if self.fee... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deepcopy(self):\n return self.__copy__()",
"def return_copy(self):\n return copy.deepcopy(self)",
"def deepcopy(self):\n return deepcopy(self)",
"def deepcopy(self):\n return copy.deepcopy(self)",
"def copy(self):\r\n return deepcopy(self)",
"def copy(self):\r\n ... | [
"0.65428346",
"0.65066165",
"0.65053535",
"0.64974105",
"0.6471339",
"0.6471339",
"0.64308834",
"0.64308834",
"0.64308834",
"0.641778",
"0.641778",
"0.6370276",
"0.6351813",
"0.63254416",
"0.6321187",
"0.6321187",
"0.6320698",
"0.63113177",
"0.6305421",
"0.6299179",
"0.629241... | 0.65005916 | 3 |
Formats an event Entry into events and raw events. This method operates on the events and raw_events lists themselves. It does not pass back the results. | def _format_events(self, entry, events, raw_events):
etype = entry.element.findtext('EventType')
href = entry.element.findtext('EventData')
if etype == 'NEW_CLIENT':
events['general'] = 'init'
elif etype in ['CACHE_CLEARED', 'MISSING_EVENTS']:
# Clears all prior e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format_events(cls, events: List) -> List:\n\n raise EventException('Unimplemented \"format_events\".')",
"def format_events(cls, events: List, event_field: str = \"event\") -> List:\n\n size = 0\n new_events, batched_events = [], []\n events = [event._to_hec(event_field) for event... | [
"0.6791563",
"0.61386657",
"0.608409",
"0.5903475",
"0.57953495",
"0.5766483",
"0.5740008",
"0.5665174",
"0.5629558",
"0.5442561",
"0.54249316",
"0.54108655",
"0.53839964",
"0.5371595",
"0.53535837",
"0.5321225",
"0.5287315",
"0.5268059",
"0.52669233",
"0.5254407",
"0.5244875... | 0.8132503 | 0 |
Return the version of Neo4j. | def kernel_version(self):
info = self.query_jmx("org.neo4j", name="Kernel")
version_string = info["KernelVersion"].partition("version:")[-1].partition(",")[0].strip()
return Version.parse(version_string).major_minor_patch | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def node_version(self) -> str:\n return pulumi.get(self, \"node_version\")",
"def node_version(self) -> str:\n return pulumi.get(self, \"node_version\")",
"def node_version(self) -> str:\n return pulumi.get(self, \"node_version\")",
"def node_version(self) -> str:\n return pulumi.... | [
"0.749498",
"0.749498",
"0.749498",
"0.749498",
"0.7446333",
"0.73912656",
"0.73906845",
"0.73906845",
"0.73906845",
"0.7390571",
"0.7390571",
"0.7390571",
"0.7390571",
"0.7127601",
"0.7088125",
"0.7029927",
"0.7029927",
"0.7029927",
"0.7029927",
"0.7029927",
"0.7029927",
"... | 0.0 | -1 |
Return the time when this Neo4j graph store was created. | def store_creation_time(self):
info = self.query_jmx("org.neo4j", name="Kernel")
return datetime.fromtimestamp(info["StoreCreationDate"] / 1000.0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_time(self):\n return self._create_time",
"def create_time(self):\n return self._create_time",
"def create_time(self):\n return self._create_time",
"def create_time(self):\n return self._create_time",
"def time_of_creation(self):\n return self._time_of_creation"... | [
"0.79098403",
"0.79098403",
"0.79098403",
"0.79098403",
"0.78209186",
"0.77064097",
"0.77064097",
"0.77064097",
"0.76866883",
"0.76866883",
"0.76866883",
"0.76866883",
"0.76695716",
"0.7632174",
"0.7632174",
"0.7632174",
"0.7632174",
"0.7632174",
"0.7632174",
"0.7631293",
"0.... | 0.8575366 | 0 |
Return an identifier that, together with store creation time, uniquely identifies this Neo4j graph store. | def store_id(self):
info = self.query_jmx("org.neo4j", name="Kernel")
return info["StoreId"] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_store_guid(self):\n\n\t\treturn uuid.UUID(bytes_le = self.get_store_guid_raw())",
"def get_store_guid(self):\n\n\t\treturn uuid.UUID(bytes_le = self.get_store_guid_raw())",
"def get_storename(self):\n return self.storename",
"def create_store(self, name_store):\n # 1.1- Create a cursor ... | [
"0.7787037",
"0.7787037",
"0.66930985",
"0.66880125",
"0.6549096",
"0.63821214",
"0.6378312",
"0.6375378",
"0.63186395",
"0.63186395",
"0.63102204",
"0.6305555",
"0.6301738",
"0.62944263",
"0.628659",
"0.62811923",
"0.6255269",
"0.6244831",
"0.6241935",
"0.62270015",
"0.62021... | 0.7864218 | 0 |
The set of node labels currently defined within the graph. | def node_labels(self):
return frozenset(record[0] for record in
self.graph.run("CALL db.labels")) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def defined_labels(self):\n return set(self.labels.keys())",
"def node_labels(self) -> np.ndarray:\n return self._node_labels",
"def labels(self):\n labelset = set([])\n for e in list(self.inEdges.values()):\n labelset = labelset.union(e.labels)\n for e in list(sel... | [
"0.81327957",
"0.80910224",
"0.79499847",
"0.789038",
"0.78424144",
"0.78079295",
"0.7719149",
"0.7702616",
"0.7617094",
"0.7617094",
"0.7617094",
"0.7617094",
"0.7580793",
"0.7558251",
"0.7551613",
"0.7512249",
"0.7443983",
"0.741994",
"0.741994",
"0.7384115",
"0.73590845",
... | 0.8707715 | 0 |
Generate a random salt of specified length | def getRandomSalt(length):
if length is not None and length > 0:
pass
else:
length = 4
return ''.join(random.SystemRandom().choice(string.ascii_uppercase + string.digits) for _ in range(length)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_salt(size):\n return hexlify(urandom(size)).decode()",
"def make_salt(length=5):\n return ''.join(random.choice(letters) for x in xrange(length))",
"def make_salt(length=5):\n return ''.join(random.choice(letters) for x in xrange(length))",
"def make_salt(length=5):\n return ''.join(... | [
"0.8553333",
"0.8530293",
"0.8530293",
"0.8530293",
"0.8498785",
"0.84648955",
"0.8138693",
"0.8137083",
"0.8104109",
"0.81006455",
"0.8038008",
"0.802619",
"0.78220695",
"0.76976186",
"0.76777893",
"0.7627549",
"0.7527076",
"0.7527076",
"0.7397056",
"0.73393226",
"0.7155297"... | 0.86525714 | 0 |
Append extra zeros to a source number based on the specified length | def zeroPrepender(source, length):
if (not source and source != 0) or not length:
return None
result = str(source)
if len(result) >= length:
return result
for i in range(length - len(result)):
result = '0' + result
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _prepend_zero(self, value: str, length: int = 2) -> str:\n final_value = value\n while len(final_value) < length:\n final_value = '0' + final_value\n return final_value",
"def add_trailing_zeros(un_trailed_data, target_length):\n\n # Cut the list of it's longer then target ... | [
"0.7596253",
"0.73970073",
"0.71644664",
"0.6984015",
"0.6842687",
"0.68241477",
"0.67797637",
"0.6726334",
"0.66611254",
"0.6589339",
"0.65770406",
"0.65640163",
"0.6550688",
"0.64708054",
"0.64524835",
"0.64504844",
"0.6393509",
"0.6381772",
"0.6377934",
"0.63702375",
"0.63... | 0.762943 | 0 |
Calculate the Weighted Average Cost of Capital (WACC) for our company. Used for consideration of existing capital structure. | def get_discount_rate():
return .1 # TODO: implement | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calc_capital_costs (self):\n self.capital_costs = self.opportunity_HH * self.refit_cost_rate",
"def bw_efficiency(cls, bw_input, uec_weighted):\n\n bw_change = pd.DataFrame(index=bw_input.index,\n columns=range(2014, cls.proj_years[-1]+1))\n\n for i in bw_... | [
"0.6704787",
"0.65885156",
"0.6072582",
"0.6023536",
"0.5960133",
"0.5955681",
"0.5930347",
"0.59081763",
"0.5907595",
"0.5765403",
"0.57427883",
"0.56822526",
"0.56410694",
"0.5622728",
"0.5606187",
"0.55849683",
"0.5560511",
"0.55567837",
"0.55456096",
"0.5514063",
"0.54936... | 0.0 | -1 |
Creates URL for detail of a single school, yields a response for an API call made for detail of a single school. | def parse_api(self, response):
# base URL for getting school detail.
base_url = "https://directory.ntschools.net/api/System/GetSchool?itSchoolCode="
# JSON string received from REST API call.
raw_data = response.body
# Converting JSON string to dictionary.
data = json.l... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_school_url(driver, school_id: int) -> str:\n driver.get(Config.campus_url.format(school_id=school_id))\n\n # find the URL link in the header portion\n result_title = driver.find_element(*CSS.school_header)\n website_url = result_title.find_element(By.TAG_NAME, 'a').get_attribute('href')\n\n ... | [
"0.64898",
"0.6320972",
"0.58466506",
"0.5748915",
"0.5710909",
"0.5627529",
"0.55579704",
"0.5450766",
"0.54224896",
"0.535178",
"0.53480595",
"0.53349894",
"0.5328674",
"0.5327463",
"0.53175855",
"0.53123164",
"0.5303641",
"0.5281067",
"0.52340746",
"0.52287614",
"0.5219511... | 0.6486448 | 1 |
Returns a cropped substring of a string s | def cropstring(s, l=None, r=None):
if isinstance(l, str):
il = s.find(l) + len(l)
else:
il = 0
if isinstance(r, str):
ir = s.find(r)
else:
ir = len(s)+1 #till the end of the original string
return s[il:ir] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cut_string(s, maxlen=800):\n if len(s) <= maxlen:\n return s\n halflen = (min(maxlen, len(s))/2)-6\n return s[:halflen]+\"[...snip...]\"+s[-halflen:]",
"def crop(self, start, length):\n repeat, one_left, one_right = self.\\\n get_occ_from_long_string(start, length)\n\n ... | [
"0.68713945",
"0.6720818",
"0.66060245",
"0.65942657",
"0.6515496",
"0.6482497",
"0.6482497",
"0.6428162",
"0.634811",
"0.634811",
"0.634811",
"0.634811",
"0.634811",
"0.6324035",
"0.61783063",
"0.61430985",
"0.6113787",
"0.6086137",
"0.6038654",
"0.60090834",
"0.59973186",
... | 0.77643496 | 0 |
Test buffer isn't changed if it already has content. | def test_no_change_if_nonempty(self):
# Set up our mock buffer
vim.current.buffer = ['content']
# Make call under test
zid = '5zyxw3zz'
title_words = ['badda-bing']
zettel.insert_zettel_template(zid, title_words, 'n')
# Test content
self.assertEqual(vim.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bufferHasChanged(self):\n if self.buffer:\n return self.buffer.hasChanged()\n else:\n return False",
"def hasBuffer(self):\n if self.buffer:\n return True\n else:\n return False",
"def __flushed_buffer(self):\n with self.__cond:... | [
"0.7309652",
"0.68440056",
"0.677896",
"0.6495235",
"0.6430541",
"0.6423779",
"0.6321481",
"0.6307539",
"0.629558",
"0.62506527",
"0.62382835",
"0.6179886",
"0.6140542",
"0.6126602",
"0.6122322",
"0.6122322",
"0.6090247",
"0.5963675",
"0.5956644",
"0.5936755",
"0.59214497",
... | 0.571272 | 38 |
Builds a URL and adds the client's API key | def build_api_key_url(self, format_string, format_params={},
query_params={}):
if 'api_key' not in query_params:
query_params['api_key'] = self.get_api_key()
return self.build_url(format_string, format_params, query_params) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_api_url(self, path, query_params=None, api_base_url=None,\n api_version=None):\n\n url = self.API_URL_TEMPLATE.format(\n api_base_url=(api_base_url or self.API_BASE_URL),\n api_version=(api_version or self.API_VERSION),\n path=path)\n\n query_params = query_p... | [
"0.68890864",
"0.67877245",
"0.66937786",
"0.66753113",
"0.6518944",
"0.6448704",
"0.63655406",
"0.63531643",
"0.63410664",
"0.630569",
"0.6285212",
"0.6285212",
"0.6241225",
"0.6240962",
"0.62190133",
"0.62023896",
"0.6201298",
"0.6195664",
"0.61803645",
"0.615736",
"0.61424... | 0.77314454 | 0 |
Reshapes the given array of frames in flat format to a shape that is suitable to be interpreted as an image in width x height format | def reshape_to_image(self, frames):
reshaped = frames.reshape(
(*frames.shape[:-1], self.im_rows, self.im_cols))
return reshaped | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reshape_to_tcn(self, frames):\n reshaped = frames.reshape((*frames.shape[:-3], self.im_size))\n return reshaped",
"def process_frame(frame, shape=(84, 84)):\n frame = frame.astype(np.uint8)\n frame = cv2.cvtColor(frame, cv2.COLOR_RGB2GRAY)\n frame = frame[34:34+160, :160]\n frame = ... | [
"0.66229254",
"0.6526334",
"0.64967406",
"0.6410886",
"0.6304962",
"0.6256993",
"0.6185434",
"0.61726475",
"0.6145009",
"0.61332303",
"0.6082908",
"0.6002729",
"0.59364396",
"0.5895089",
"0.5892904",
"0.58172",
"0.579299",
"0.5776293",
"0.57733834",
"0.57637095",
"0.57565916"... | 0.7750991 | 0 |
Adds a TimeDistributed reshaping layer to unflatten flattened image frames to width x height format. This layer cannot be used as the first layer in the model. Image shape information is gathered from the instance's attributes. | def add_td_im_reshape(self):
td_reshape = TimeDistributed(Reshape((-1, self.im_rows, self.im_cols)))
self.seq_model.add(td_reshape) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_td_flatten(self, data_format='channels_first'):\n if len(self.seq_model.layers) == 0:\n input_shape = (None, self.im_rows, self.im_cols)\n td_flat = TimeDistributed(Flatten(\n data_format=data_format,\n input_shape=input_shape))\n else:\n ... | [
"0.66602397",
"0.5404452",
"0.53281397",
"0.5292669",
"0.50889504",
"0.50469625",
"0.50409377",
"0.50391144",
"0.5030741",
"0.5011513",
"0.50113225",
"0.49905393",
"0.49484277",
"0.49295324",
"0.4923929",
"0.4903569",
"0.4898058",
"0.48970827",
"0.48868054",
"0.48807105",
"0.... | 0.67587733 | 0 |
Compiles the Sequential model with the given loss and optimizer. | def compile(self, loss, optimizer):
self.seq_model.compile(loss=loss, optimizer=optimizer) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compile_model(self, loss, optimizer, **kwargs):\n self.model.compile(loss=loss, optimizer=optimizer, **kwargs)",
"def compile_model(self, input_layer, output_layer, optimizer, loss):\n self.__model = Model(inputs=input_layer, outputs=output_layer)\n\n self.__model.compile(optimizer=optim... | [
"0.82588166",
"0.7773566",
"0.7605571",
"0.76031774",
"0.7507232",
"0.7422086",
"0.7349518",
"0.7141978",
"0.70807064",
"0.7076968",
"0.7069431",
"0.70567244",
"0.6926573",
"0.6884099",
"0.68196976",
"0.6715891",
"0.67158765",
"0.671139",
"0.6653377",
"0.6638967",
"0.66080886... | 0.7931878 | 1 |
Removes all layers from the Sequential model by resetting the attribute to a fresh Sequential model. | def reset_model(self):
self.seq_model = Sequential() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset_model(model):\n\n for layer in model.layers:\n # Note: these are custom depending on the layer type\n if '.MoleculeConv' in str(layer):\n W_inner = layer.init_inner((layer.inner_dim, layer.inner_dim))\n b_inner = np.zeros((1, layer.inner_dim))\n # Inner w... | [
"0.7193303",
"0.6985961",
"0.6758227",
"0.66596293",
"0.65628237",
"0.65362215",
"0.64840794",
"0.64730585",
"0.64710075",
"0.64381194",
"0.630699",
"0.6300441",
"0.6275783",
"0.6260702",
"0.6258294",
"0.6219546",
"0.6202775",
"0.6125962",
"0.60969293",
"0.6011158",
"0.599935... | 0.74472296 | 0 |
Get config file for requested Workload. | def get_config(data: dict) -> Response:
config_path = WorkloadService._get_workload_data_from_input_data(data).get("config_path")
if not config_path:
raise NotFoundException("Unable to find config file")
return ResponseGenerator.serve_from_filesystem(
path=config_path,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def config_file(self):\n return self.get_config_file(self._config.path)",
"def get_config_file(path):\n return os.path.join(path, Cluster.CLUSTER_CONFIG_FILE)",
"def get_config():\r\n cfg = eval(open(config_path).read())\r\n return cfg",
"def loaded_config_file(self):\n return self... | [
"0.70811015",
"0.6991549",
"0.6814134",
"0.68034804",
"0.6716813",
"0.66838354",
"0.66579086",
"0.66265345",
"0.6587626",
"0.6564919",
"0.656456",
"0.656456",
"0.656456",
"0.656456",
"0.656456",
"0.6564232",
"0.65640706",
"0.65640706",
"0.65637904",
"0.65108657",
"0.650099",
... | 0.5875373 | 76 |
Get config file for requested Workload. | def get_output(data: dict) -> Response:
log_path = WorkloadService._get_workload_data_from_input_data(data).get("log_path")
if not log_path:
raise NotFoundException("Unable to find output log")
try:
response = ResponseGenerator.serve_from_filesystem(
pat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def config_file(self):\n return self.get_config_file(self._config.path)",
"def get_config_file(path):\n return os.path.join(path, Cluster.CLUSTER_CONFIG_FILE)",
"def get_config():\r\n cfg = eval(open(config_path).read())\r\n return cfg",
"def loaded_config_file(self):\n return self... | [
"0.70811015",
"0.6991549",
"0.6814134",
"0.68034804",
"0.6716813",
"0.66838354",
"0.66579086",
"0.66265345",
"0.6587626",
"0.6564919",
"0.656456",
"0.656456",
"0.656456",
"0.656456",
"0.656456",
"0.6564232",
"0.65640706",
"0.65640706",
"0.65637904",
"0.65108657",
"0.650099",
... | 0.0 | -1 |
Get the configuration for a ``Command`` | def get_command_config(command_config_module, cmd, exit_on_failure=True):
cmd_cfg = None
error_msg = None
python_cmd_name = cmd.replace('-', '_')
try:
cmd_cfg = importlib.import_module('.'.join([command_config_module,
python_cmd_name]))
ex... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_config(self):\n return self._invoke('get_config')",
"def get_config(self):\n cmd = Command(CommandType.getconfig)\n rcmd = self._send_cmd(cmd)\n return Config.from_bytes(rcmd.body)",
"def get_config(self):\n return self.config.config",
"def get_config(self):\n ... | [
"0.6911241",
"0.6778142",
"0.6625337",
"0.65865314",
"0.65865314",
"0.65703475",
"0.65563524",
"0.6533231",
"0.65261465",
"0.6515186",
"0.65107435",
"0.65107435",
"0.65107435",
"0.65107435",
"0.65107435",
"0.65107435",
"0.65107435",
"0.65107435",
"0.65107435",
"0.65107435",
"... | 0.6678204 | 2 |
Takes the undirected graph ugraph and returns a list of sets of connected nodes | def cc_visited(ugraph):
connected_nodes = list()
remained_nodes = set(ugraph.keys())
while len(remained_nodes) != 0:
source_node = remained_nodes.pop()
visited = bfs_visited(ugraph, source_node)
connected_nodes.append(visited)
remained_nodes.difference_update(visited)
ret... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cc_visited(ugraph):\n remaining_nodes = set(ugraph.keys())\n connected_components = []\n\n while remaining_nodes:\n any_node = remaining_nodes.pop()\n all_visited = bfs_visited(ugraph, any_node)\n connected_components.append(all_visited)\n # remove visited nodes from remain... | [
"0.77325505",
"0.7707938",
"0.7494239",
"0.7249985",
"0.71618426",
"0.713946",
"0.70974517",
"0.7069355",
"0.69746083",
"0.69746083",
"0.69550216",
"0.69033176",
"0.6897465",
"0.6858123",
"0.6821303",
"0.6816262",
"0.67906225",
"0.6780406",
"0.67458814",
"0.67230135",
"0.6722... | 0.78901005 | 0 |
Takes the undirected graph ugraph and returns the size (integer) of the largest connected componet in ugraph | def largest_cc_size(ugraph):
connected_comp = cc_visited(ugraph)
max_size = 0
for comp in connected_comp:
if len(comp) > max_size:
max_size = len(comp)
return max_size | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def largest_cc_size(ugraph):\r\n \r\n components = cc_visited(ugraph)\r\n \r\n largest = 0\r\n for component in components:\r\n if len(component) > largest:\r\n largest = len(component)\r\n return largest",
"def largest_cc_size(ugraph):\n graph_ccs = cc_visited(ugraph)\n ... | [
"0.87057716",
"0.85433024",
"0.8527969",
"0.85164016",
"0.8486688",
"0.84424454",
"0.842696",
"0.7721193",
"0.68285894",
"0.6549457",
"0.6522449",
"0.6482747",
"0.6468488",
"0.64645165",
"0.6424594",
"0.63821656",
"0.6283204",
"0.6283204",
"0.6256682",
"0.6256682",
"0.6234312... | 0.8603419 | 1 |
Conduct num_node trials by using applying random.choice() to the list of node numbers Updates the list of node numbers so that the number of instances of each node number is in the same ratio as the desired probabilities | def run_trial(self, nodes_choose):
neighbor_set = set([])
for dummy_idx in xrange(nodes_choose):
neighbor_set.add(random.choice(self._node_space))
self._node_space.extend(list(neighbor_set))
self._node_space.extend([self._node_num] * (len(neighbor_set) + 1))
self._nod... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_trial(self, num_nodes):\n# print \" Inside run _trial number of nodes \" , self._num_nodes\n# print \"Inside run_trial intital _node_numbers\", self._node_numbers\n # compute the neighbors for the newly-created node\n new_node_neighbors = set()\n for _ in range(num_node... | [
"0.72166",
"0.69830096",
"0.69578636",
"0.6941301",
"0.6941301",
"0.69412893",
"0.6912696",
"0.6868621",
"0.6849905",
"0.6770911",
"0.63180494",
"0.63094044",
"0.630506",
"0.62423164",
"0.62284565",
"0.62202483",
"0.6076588",
"0.60475814",
"0.5991362",
"0.59852666",
"0.595626... | 0.63741827 | 10 |
Use UPA method to create a random directed graph based on the given final_nodes and nodes_choose in each iteration DPA Undirected graph with Preferential Attachment | def make_UPA_graph(nodes_num, nodes_choose):
graph_dict = make_complete_graph(nodes_choose)
trial = UPATrial(nodes_choose)
for node in xrange(nodes_choose, nodes_num):
neighbors = trial.run_trial(nodes_choose)
graph_dict[node] = neighbors
for neighbor in neighbors:
graph_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def alg_upa(n_nodes, m_nodes):\n # create a complete graph of m_nodes noes\n upa_graph = make_complete_graph(m_nodes)\n\n # create the UPAtrial object corresponding to complete graph\n upa_trial = upa.UPATrial(m_nodes)\n\n # add each new node to the existing graph randomly\n # chosen with probabi... | [
"0.6349619",
"0.63369465",
"0.62147063",
"0.6056803",
"0.60307705",
"0.59422106",
"0.58911633",
"0.58402246",
"0.57655245",
"0.5755748",
"0.57388264",
"0.5736851",
"0.56737155",
"0.5601574",
"0.55995715",
"0.55891985",
"0.55718964",
"0.5562822",
"0.5550557",
"0.5503816",
"0.5... | 0.67495614 | 0 |
Generate prime multipliers for input integer n | def get_prime_multipliers(number: int) -> list:
i = 2
multipliers = []
while i * i <= number:
while number % i == 0:
multipliers.append(i)
number = number / i
i = i + 1
if number > 1:
multipliers.append(number)
return list(map(int, multipliers)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gen_factorization(n, primes = None):\n bound = int(n ** 0.5)+1\n if primes == None:\n primeIterable = gen_prime_numbers(bound)\n else:\n primeIterable = primes\n extend_primes(primes, bound)\n\n for p in primeIterable:\n if p*p > n: break\n while n % p == 0:\n ... | [
"0.78118974",
"0.7616887",
"0.7609184",
"0.7480427",
"0.7465682",
"0.74527466",
"0.7396546",
"0.73871374",
"0.73358566",
"0.7308378",
"0.72749746",
"0.7203889",
"0.71795946",
"0.7179166",
"0.71680653",
"0.71596414",
"0.71504104",
"0.71372736",
"0.7131897",
"0.71075714",
"0.70... | 0.7213232 | 11 |
Returns the current warning Setting | def _warning_settings():
return warnings.showwarning.__name__ == "_showwarning" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def color_warning(self):\n return self.LEVEL_COLOR['WARNING']",
"def GetLastWarning (self):\n\t\treturn self._warning",
"def read_MPPT_Active_Warning(self):\n bitstream = self._port.read_holding_registers(0x0045, 1) # 0x0045 Active Warnings Flag uint16 r\n result = unpack('<H', pack('<H', ... | [
"0.7058463",
"0.6850115",
"0.67026955",
"0.6475611",
"0.6473893",
"0.6440046",
"0.6350644",
"0.6337798",
"0.62931484",
"0.6270478",
"0.62429756",
"0.6226995",
"0.6133827",
"0.6069378",
"0.6059955",
"0.6041677",
"0.6012105",
"0.59708947",
"0.5968796",
"0.5888828",
"0.584439",
... | 0.7041609 | 1 |
Do not return anything, modify board inplace instead. | def solve(self, board: List[List[str]]) -> None:
"""
方法1:
在记录每个节点是否访问过的前提下, 依次从每个 'O' 开始BFS/DFS, 并且只访问未访问过的 'O'.
如果从一个 'O' 可以访问到边界, 那么不做任何操作; 否则便将这个 'O' 可以访问到的所有的 'O' 替换为 'X'.
"""
if not board or not board[0]:
return
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def board_copy(board):\n return board.copy()",
"def move(board, row, col, char):\n board_copy = copy.deepcopy(board)\n board_copy[row][col] = char\n return board_copy",
"def _update_board(board, position, player):\n board = board.copy()\n board[position[0], position[1], player] = 1\n retur... | [
"0.71159256",
"0.7085941",
"0.6954577",
"0.68043697",
"0.67718863",
"0.6752613",
"0.67428917",
"0.6735564",
"0.6706817",
"0.6694613",
"0.6693218",
"0.6651022",
"0.66255426",
"0.6608803",
"0.6607113",
"0.6582967",
"0.6532868",
"0.6518662",
"0.6491719",
"0.6445777",
"0.64423895... | 0.0 | -1 |
Loads data for the specified city and filters by month and day if applicable. | def load_data(city, month, day):
df = pd.read_csv(CITY_DATA[city.lower()])
df['Start Time'] = pd.to_datetime(df['Start Time'])
df['month'] = df['Start Time'].dt.month_name()
df['day_of_week'] = df['Start Time'].dt.day_name()
if month.lower() != 'all':
df = df[df['month'] == month.title()]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_city_data(city, month, day):\n df = pd.read_csv(CITY_DATA[city])\n #extract month, day, hour from start time\n df['month'] = pd.to_datetime(df['Start Time']).dt.month_name()\n df['day'] = pd.to_datetime(df['Start Time']).dt.weekday\n df['hour'] = pd.to_datetime(df['Start Time']).dt.hour\n\n... | [
"0.8318415",
"0.822739",
"0.81510234",
"0.8079993",
"0.8043006",
"0.80181265",
"0.80013365",
"0.7991213",
"0.79782444",
"0.797258",
"0.79574573",
"0.79565233",
"0.7948909",
"0.7931596",
"0.7919054",
"0.7913166",
"0.79121137",
"0.79053557",
"0.79032975",
"0.7903154",
"0.790298... | 0.7979727 | 8 |
Displays statistics on the most frequent times of travel. | def time_stats(df):
print('\nCalculating The Most Frequent Times of Travel...\n')
message = input('Type "skip" to jump to the next part or anything else to continue: \n')
if message.lower() == 'skip':
print('-'*40)
else:
start_time = time.time()
df['Start Time'] = pd.to_datet... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def time_stats(df):\r\n\r\n print('\\nThese are the statistics of the most frequent times of travel:\\n')\r\n start_time = time.time()\r\n\r\n # Display the most common month\r\n common_month = df['month'].mode()[0]\r\n print(\"- That's the most common month based on your selection: \" +\r\n ... | [
"0.7974609",
"0.7851373",
"0.7800278",
"0.77821916",
"0.7775073",
"0.7762475",
"0.77532375",
"0.77384645",
"0.77262247",
"0.7718093",
"0.7685153",
"0.7683606",
"0.76808155",
"0.7679881",
"0.7650141",
"0.7644975",
"0.7643931",
"0.76428497",
"0.7629725",
"0.76246285",
"0.762423... | 0.0 | -1 |
Displays statistics on the most popular stations and trip. | def station_stats(df):
print('\nCalculating The Most Popular Stations and Trip...\n')
message = input('Type "skip" to jump to the next part or anything else to continue: \n')
if message.lower() == 'skip':
print('-'*40)
else:
start_time = time.time()
common_start_station = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def station_stats(df):\n\n print('\\033[1m' + 'Calculating the most popular stations and trip...\\n' + '\\033[0m')\n start_time = time.time()\n\n # display the most commonly used start station\n\n start_stn = df['Start Station'].mode()[0]\n print('Most popular start station is {}.'.format(start_stn)... | [
"0.7809938",
"0.76727635",
"0.7538624",
"0.74982685",
"0.7490305",
"0.74887866",
"0.7436869",
"0.7429845",
"0.74274427",
"0.7425571",
"0.74126786",
"0.7404592",
"0.7382532",
"0.7379482",
"0.73747545",
"0.7365935",
"0.73561436",
"0.7351966",
"0.7324152",
"0.7304813",
"0.729985... | 0.0 | -1 |
Displays statistics on the total and average trip duration. | def trip_duration_stats(df):
print('\nCalculating Trip Duration...\n')
message = input('Type "skip" to jump to the next part or anything else to continue: \n')
if message.lower() == 'skip':
print('-'*40)
else:
start_time = time.time()
total_travel_time = df['Trip Duration'].su... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trip_duration_stats(df):\r\n\r\n print('\\nThese are the statistics related to the trips durations:\\n')\r\n start_time = time.time()\r\n\r\n # Display total travel time\r\n total_travel_time = df['Trip Duration'].sum()\r\n print(\"\\n- The total travel time based on your selection is: \" +\r\n ... | [
"0.82698804",
"0.81186754",
"0.80481917",
"0.80468994",
"0.79780424",
"0.7962861",
"0.7959512",
"0.7946294",
"0.7936397",
"0.7929802",
"0.79278564",
"0.79269135",
"0.79246616",
"0.79200053",
"0.79158986",
"0.7915428",
"0.7913144",
"0.79076344",
"0.7903745",
"0.79023826",
"0.7... | 0.0 | -1 |
Calculate RMSE evaluation score. | def rmse(obs, pred):
assert(len(obs) == len(pred))
return np.sqrt(np.sum(np.power(obs - pred, 2)) / len(obs)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def evaluate(self, X_test, y_test):\n y_pred = self.pipeline.predict(X_test)\n rmse = round(compute_rmse(y_pred, y_test), 2)\n self.mlflow_log_metric(\"rmse\", rmse)\n return rmse",
"def evaluate(self, X_test, y_test):\n y_pred = self.pipeline.predict(X_test)\n rmse = co... | [
"0.78549534",
"0.7764073",
"0.76744956",
"0.7568704",
"0.7522948",
"0.7473855",
"0.74632096",
"0.7426835",
"0.73917866",
"0.738921",
"0.73545307",
"0.7326977",
"0.7320216",
"0.73062545",
"0.7265252",
"0.72507",
"0.7217039",
"0.72148454",
"0.71754754",
"0.71524805",
"0.7139851... | 0.62830216 | 96 |
Return the index of minimum elements. | def argmin(self, dim=None, keepdim=False):
return array_funcs.argmin(self, dim, keepdim) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def min_index(self):\n return self.indices[0] if len(self.indices) else 0",
"def min_index(self):\n return self.length_vector.min()",
"def getMinIndex(myList):\n # For a faster implementation in big lists, try return numpy.argmin(myList)\n return myList.index(min(myList))",
"def find_min(... | [
"0.7887528",
"0.77963746",
"0.77940077",
"0.7698101",
"0.7574173",
"0.7572896",
"0.7563337",
"0.74416554",
"0.7284918",
"0.72798884",
"0.72494364",
"0.7231932",
"0.72127116",
"0.7201288",
"0.7163875",
"0.70832014",
"0.7073704",
"0.7073049",
"0.70572084",
"0.7056454",
"0.70276... | 0.0 | -1 |
Return an uint8 tensor with the same data. Returns dragon.vm.torch.Tensor The output tensor. | def byte(self):
return array_funcs.cast(self, 'uint8', False) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def byte_(self):\n return array_funcs.cast(self, 'uint8', True)",
"def to_tensor(self):\n return self.tensor",
"def to_tensor(self, data):\n return torch.tensor(data).long()",
"def to_tensor(data):\n return torch.from_numpy(data)",
"def float_image_to_uint8(image):\n image = (image * 142.0... | [
"0.6612346",
"0.66067356",
"0.64871955",
"0.6122374",
"0.6052812",
"0.6006669",
"0.5977225",
"0.59573555",
"0.59019566",
"0.58035135",
"0.57962495",
"0.5778344",
"0.5750276",
"0.5750276",
"0.5746923",
"0.569661",
"0.5695556",
"0.5675343",
"0.56685984",
"0.56676525",
"0.565892... | 0.6486369 | 3 |
Cast to an uint8 tensor. Returns dragon.vm.torch.Tensor The self. | def byte_(self):
return array_funcs.cast(self, 'uint8', True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_tensor(self):\n return self.tensor",
"def byte(self):\n return array_funcs.cast(self, 'uint8', False)",
"def to_tensor(self, data):\n return torch.tensor(data).long()",
"def _to_uint(self, images):\n return (images * 255).type(torch.uint8)",
"def tensor(self):\n\t\treturn self._t... | [
"0.68709105",
"0.67526835",
"0.64252496",
"0.6238113",
"0.6180502",
"0.6017372",
"0.5799545",
"0.57494575",
"0.5748038",
"0.5742114",
"0.57142395",
"0.5690065",
"0.56763583",
"0.56331396",
"0.56234825",
"0.55902386",
"0.5558628",
"0.5530382",
"0.5528606",
"0.551209",
"0.55114... | 0.68734974 | 0 |
Return an int8 tensor with the same data. Returns dragon.vm.torch.Tensor The output tensor. | def char(self):
return array_funcs.cast(self, 'int8', False) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_tensor(self, data):\n return torch.tensor(data).long()",
"def to_tensor(self):\n return self.tensor",
"def to_tensor(data):\n return torch.from_numpy(data)",
"def tensor(self):\n\t\treturn self._tensor()",
"def ones_like(out):\n return torch.ones_like(out)",
"def tensor(*args):\n ... | [
"0.6961009",
"0.6913049",
"0.63697135",
"0.6215618",
"0.617448",
"0.6149525",
"0.60985345",
"0.6084705",
"0.6082183",
"0.6044942",
"0.6032395",
"0.60290974",
"0.6022491",
"0.5966663",
"0.5923833",
"0.5899198",
"0.58639836",
"0.5859174",
"0.5841669",
"0.5841669",
"0.583882",
... | 0.5711196 | 27 |
Cast to an int8 tensor. Returns dragon.vm.torch.Tensor The self. | def char_(self):
return array_funcs.cast(self, 'int8', True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_tensor(self):\n return self.tensor",
"def to_tensor(self, data):\n return torch.tensor(data).long()",
"def tensor(self):\n\t\treturn self._tensor()",
"def int_me(i):\n return tf.cast(i, dtype=DTYPEINT)",
"def astensor(self, tensor_in, dtype='float'):\n dtypemap = {'float': torch.... | [
"0.7292035",
"0.6803037",
"0.6577372",
"0.6470737",
"0.62337923",
"0.61966336",
"0.6158653",
"0.6135899",
"0.61002076",
"0.6090159",
"0.6086114",
"0.6052201",
"0.60437036",
"0.6022493",
"0.5971166",
"0.59511244",
"0.592044",
"0.590428",
"0.58729535",
"0.5870126",
"0.586689",
... | 0.6058872 | 11 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.