query stringlengths 9 9.05k | document stringlengths 10 222k | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
Tests that NewickEventFactory without arg raises ValueError. | def test_no_arg(self):
self.assertRaises(ValueError, NewickEventFactory) | [
"def test_init_event_type_badval(val):\n\n expected = ('event_type arg expected {} object, got {} object instead'.\n format(EventType.__name__, type(val).__name__))\n with pytest.raises(TypeError) as err:\n Event(val)\n\n assert err.value.args == (expected, )",
"def test_binary_even... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Find positions that are contained within segments | def find_overlapping_segments(pos, seg, columns):
seg = seg.sort_values(['start', 'end'])
if seg.duplicated(['start', 'end']).any():
raise ValueError('duplicate columns')
start_idx = np.searchsorted(seg['start'].values, pos['coord'].values) - 1
end_idx = np.searchsorted(seg['end'].values, pos[... | [
"def contained_segments_matrix(segments):\n x1, y1 = segments[:, 0], segments[:, 1]\n x2, y2 = x1 + segments[:, 2], y1 + segments[:, 3]\n n = len(segments)\n\n x1so, x2so, y1so, y2so = list(map(numpy.argsort, (x1, x2, y1, y2)))\n x1soi, x2soi, y1soi, y2soi = list(map(numpy.argsort, (x1so, x2so, y1so,... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Simple hierarhical clustering figure for SNVs | def snv_hierarchical_clustering_figure(snv_data, clusters):
snv_matrix = snv_data.merge(clusters)
snv_matrix = (
snv_matrix.groupby(
['chrom', 'coord', 'ref', 'alt', 'cluster_id'],
as_index=True, observed=True)[['alt_counts', 'ref_counts']]
.sum().unstack().fillna(0).ast... | [
"def cluster_visulization(self):\n dn = dendrogram(self.z)\n self.divide_linkage_matrix_in_clusters(self.z, 2)\n plt.show()",
"def clustering_and_visulization(self):\n centroids, _ = kmeans(self.data_mat, self.k)\n idx, _ = vq(self.data_mat, centroids)\n for i in range(se... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Compute the ML tree under the dollo model of SNV evolution | def compute_dollo_ml_tree(snv_log_likelihoods, leaf_name_groups=None):
trees = dollo.tasks.create_trees(
snv_log_likelihoods,
sample_col='cluster_id',
leaf_name_groups=leaf_name_groups,
)
results_table = dollo.tasks.compute_tree_log_likelihoods_mp(
snv_log_likelihoods, trees... | [
"def nnObjFunction(params, *args):\r\n \r\n n_input, n_hidden, n_class, training_data, training_label, lambdaval = args\r\n \r\n w1 = params[0:n_hidden * (n_input + 1)].reshape( (n_hidden, (n_input + 1)))\r\n w2 = params[(n_hidden * (n_input + 1)):].reshape((n_class, (n_hidden + 1)))\r\n\r\n data=... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Plot a tree with branchlengths as snv origin counts | def plot_dollo_ml_tree(tree, nodes):
leaf_order = []
for leaf in tree.leaves:
leaf.plot_id = leaf.name
leaf_order.append(leaf.name)
origin_counts = nodes.groupby('node')['ml_origin'].sum()
for node in tree.nodes:
node.origin_count = origin_counts[node.label]
loss_counts = ... | [
"def _layout(self):\n self.tree.root.branch_length = 0.001\n clade = 0\n yvalue = 0\n for node in self.tree.find_clades(order=\"preorder\"):\n # set mutations\n if node.up is not None:\n node.muts = \", \".join([\n node.up.sequence[p] + str(p) + node.sequence[p]\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Run the SNV phylogenetic analysis. | def run_snv_phylogenetics(snv_count_data, allele_cn, clusters, results_prefix):
snv_log_likelihoods = scgenome.snvphylo.compute_snv_log_likelihoods(
snv_count_data, allele_cn, clusters)
ml_tree, tree_annotations = scgenome.snvphylo.compute_dollo_ml_tree(
snv_log_likelihoods)
return ml_tree... | [
"def main():\n args = parameter_parser()\n tab_printer(args)\n trainer = GPNTrainer(args)\n # trainer.fit()\n \"\"\"\n Scoring on the prediction and learning ability.\n \"\"\"\n trainer.score()\n \"\"\"\n Scoring on the subgraph test set.\n \"\"\"\n # trainer.score2()\n \"\"\"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The function is used to extract faces from face coordinates | def extract_faces(self, img, list_face_coord):
#from the img array extract the facees
list_faces = []
#Go through each face coordinates and store the array
#or clip face region in the list
for i, coord in enumerate(list_face_coord):
left, top, right, bottom = coord
list_faces.append(img[... | [
"def get_faces(image):\n return (image.crop(face) for face in image.faces)",
"def detectFaces(image_path):\n img = cv2.imread(image_path)\n\n face_cascade = cv2.CascadeClassifier(\"cvdata\\\\haarcascades\\\\haarcascade_frontalface_default.xml\")\n if img.ndim == 3:\n gray = cv2.cvtColor(img, cv... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Takes in an Image object. Resizes to terminal window size, maps pixel darkness to characters, and matches pixel colors to closest colors available to xterm. Returns CursesFrame. | def render_frame(self, image):
arr = np.array(image.resize(self.curses_shape))
characters = self.character_transformer.map_pixels_to_characters(arr)
colors = self.color_transformer.nearest_neighbors(arr)
return CursesFrame(characters, colors) | [
"def convertDepthFrame(self):\n try:\n \"\"\" \n Convert Depth frame to rudimentary colormap\n \"\"\"\n self.DepthHSV[...,0] = self.currentDepthFrame\n self.DepthHSV[...,1] = 0x9F\n self.DepthHSV[...,2] = 0xFF\n self.DepthCM = cv2.c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Use black text in our curses colorpairs | def use_black_text(self):
black_foreground = 0
for color in range(curses.COLORS):
curses.init_pair(color, black_foreground, color) | [
"def format_black(c):\n c.run(\"black .\")",
"def prBlueBG(text):\n print(\"\\033[44m{}\\033[0m\".format(text), sep=\"\")",
"def display_green(text):\n print \"\\n\\n\"\n print colored(text, 'green', attrs=['reverse', 'blink'])",
"def blue(text):\n return colorize2(text, \"blue\")",
"def disp... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Takes in a CursesFrame, draws to terminal window | def draw(self, curses_frame):
nrows, ncols = self.shape[1], self.shape[0]
for row in range(nrows):
for col in range(ncols):
self.screen.addch(row, col,
curses_frame.characters[row][col],
curses.color_pair(curses_frame.colors[row][col]))... | [
"def update_window(self, window, frame):\n self.draw_eyes()\n self.show(window, frame)\n self.new_frame()",
"def draw(screen):\n MY.restart_button.draw(screen)\n MY.display_text.draw(screen)",
"def runFrame(self):\n self._drawFrame(self._advanceTime())",
"def redraw(self):\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Run 'git up' w/o remotes | def test_no_remotes():
os.chdir(master_path)
from PyGitUp.gitup import GitUp
with pytest.raises(GitError):
GitUp(testing=True) | [
"def flush_repo():\n server = get_server()\n run(\"rm -rf %(project_name)s\" % env)\n git.clone()\n server.setup()",
"def git_up_repo(repo_dir):\n os.chdir(repo_dir)\n print('CWD: %s' % os.getcwd())\n git_up_1 = 'git remote update -p'\n print('Running %s' % git_up_1)\n subprocess.call(g... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Python function wrapping c++ dcpagerank function. Computes the pagerank on the double cover of a graph. | def dcpagerank_weighted_cpp(n, ai, aj, a, alpha, eps, seedids, maxsteps, simplify=True, xlength=10**7):
# Find the appropriate types and the function to call
float_type, vtype, itype, ctypes_vtype, ctypes_itype, fun = _get_dcpagerank_weighted_cpp_types_fun(ai, aj)
# Set up the parameters for the function c... | [
"def pagerank(matrix, bias, d=0.85):\n n = matrix.shape[0]\n rank = 0\n new_rank = np.array([1.0 / n] * n)\n for i in range(0,200):\n print \"iteration: \"+str(i)\n rank = new_rank\n new_rank = np.array([(1.0-d)/n] * n) + d * np.dot(matrix, rank)\n# new_rank = (1.0-d) * bias ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the root node. | def root(self) -> Node:
return self._root | [
"def get_root_node(self):\n return self.root",
"def root(self):\n # type: () -> tree_node.TreeNode\n return self._root",
"def root_node(self):\n return self.process_tree",
"def root_node(self) -> 'Node':\n curr = self\n while curr.parent:\n curr = curr.pare... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns whether a given node is the root of the tree. | def is_root(self, node: Node) -> bool:
return node == self._root | [
"def is_root(self, node: object) -> bool:\n if node == self.root:\n return True\n else:\n return False",
"def is_root(self):\n return self.parent is Node.ROOT_PARENT",
"def is_root(self):\n return self.root is None",
"def is_root(self, ident):\n if self... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Loads the SNLI dataset Returns the train, dev and test sets in a dictionary, each as a tuple of containing the trees and the labels. | def load_snli(path, terminals_only=True, binary=False):
splits = {}
for split in ["train", "dev", "test"]:
data = list(
read_snli(split, path, terminals_only=terminals_only)
)
premises = [premise for premise, _, _ in data]
hypotheses = [hypothesis for _, hypothesis, _... | [
"def import_datasets(snli_path):\n print('extract data from snli directory..')\n train = dict(); dev = dict(); test = dict()\n gold_labels = {'entailment': 0, 'neutral': 1, 'contradiction': 2}\n\n for file_type in ['train', 'dev', 'test']:\n path = os.path.join(snli_path, 'snli_1.0_{}.jsonl'.form... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
a naive implementation of numerical gradient of f at x f shoule be a function that takes a single argument x is the point (numpy array) to evaluate the gradient at | def eval_numerical_gradient(f,x):
grad = np.zeros(x.shape)
h = 0.0001
# iterate over all indexes in x
it = np.nditer(x, flag = ['multi_index'], op_flags = ['readwrite'])
while not it.finished:
ix = it.multi_index
old_value = x[ix]
x[ix] = old_value + h
fxh_left = f(x)
x[ix] = old_value - h
fxh_rig... | [
"def eval_numerical_gradient(f, x, h=1e-5):\n\n fx = f(x) # evaluate function value at original point\n grad = np.zeros_like(x)\n # iterate over all indexes in x\n it = np.nditer(x, flags=['multi_index'], op_flags=['readwrite'])\n while not it.finished:\n\n # evaluate function at x+h\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Checks that all the user inputs were valid | def check_all_user_inputs_valid(self):
self.check_RNN_layers_valid()
self.check_activations_valid()
self.check_embedding_dimensions_valid()
self.check_initialiser_valid()
self.check_y_range_values_valid()
self.check_return_final_seq_only_valid() | [
"def validate_inputs(self):\r\n\r\n\t\t# Initialise the validation flag and set the change variable\r\n\t\tvalidate = False\r\n\t\tcharacters_exceeded = False\r\n\t\tchange = self.change_type.get()\r\n\r\n\t\t# Set the validation criteria\r\n\t\tself.subassembly_vaidation = bool(self.subassembly.get())\r\n\t\tself.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Checks that layers provided by user are valid | def check_RNN_layers_valid(self):
error_msg_layer_type = "First element in a layer specification must be one of {}".format(self.valid_RNN_hidden_layer_types)
error_msg_layer_form = "Layer must be of form [layer_name, hidden_units]"
error_msg_layer_list = "Layers must be provided as a list"
... | [
"def _checkLayers(self):\n pass",
"def check_layers(self, layer_param, params, permitted_layers, mandatory):\n exception = None\n\n requested_layers = params.get(layer_param)\n if requested_layers:\n requested_layers = requested_layers.split(',')\n for layer in reques... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Puts relevant data through embedding layers and then concatenates the result with the rest of the data ready to then be put through the hidden layers | def incorporate_embeddings(self, x):
all_embedded_data = []
for embedding_layer_ix, embedding_var in enumerate(self.columns_of_data_to_be_embedded):
data = x[:, :, embedding_var]
embedded_data = self.embedding_layers[embedding_layer_ix](data)
all_embedded_data.append(... | [
"def encode_data(model, data_loader, log_step=10, logging=print):\n # switch to evaluate mode\n model.eval()\n print (\"Evaluating...\")\n\n # numpy array to keep all the embeddings\n img_embs = None\n cap_embs = None\n with torch.no_grad():\n\n for i, (images, captions, index, image_nam... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Method to create a dictionary of state block representing stream states. This takes a dict with stream name keys and stream values. | def stream_states_dict(streams, time_point=0):
stream_dict = OrderedDict()
def _stream_dict_add(sb, n, i=None):
"""add a line to the stream table"""
if i is None:
key = n
else:
key = "{}[{}]".format(n, i)
stream_dict[key] = sb
for n in streams.keys()... | [
"def get_stream_blocks(self) -> Dict[str, StcStream]:\n return {o.name: o for o in self.get_objects_or_children_by_type(\"StreamBlock\")}",
"def state_feed_dict(self, his):\n return {v: his[k] for k, v in enumerate(self.state)}",
"def construct_latest_state_from_messages(messages: List[AirbyteMess... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Method to create a stream table in the form of a pandas dataframe. Method takes a dict with name keys and stream values. Use an OrderedDict to list the streams in a specific order, otherwise the dataframe can be sorted later. | def create_stream_table_dataframe(
streams, true_state=False, time_point=0, orient="columns"
):
stream_attributes = OrderedDict()
stream_states = stream_states_dict(streams=streams, time_point=time_point)
full_keys = [] # List of all rows in dataframe to fill in missing data
stream_attributes["Un... | [
"def create_stream_table_ui(\n streams, true_state=False, time_point=0, orient=\"columns\", precision=5\n):\n\n # Variable Types:\n class VariableTypes:\n UNFIXED = \"unfixed\"\n FIXED = \"fixed\"\n PARAMETER = \"parameter\"\n EXPRESSION = \"expression\"\n\n stream_attributes... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Method to create a stream table in the form of a pandas dataframe. Method takes a dict with name keys and stream values. Use an OrderedDict to list the streams in a specific order, otherwise the dataframe can be sorted | def create_stream_table_ui(
streams, true_state=False, time_point=0, orient="columns", precision=5
):
# Variable Types:
class VariableTypes:
UNFIXED = "unfixed"
FIXED = "fixed"
PARAMETER = "parameter"
EXPRESSION = "expression"
stream_attributes = OrderedDict()
strea... | [
"def create_stream_table_dataframe(\n streams, true_state=False, time_point=0, orient=\"columns\"\n):\n\n stream_attributes = OrderedDict()\n stream_states = stream_states_dict(streams=streams, time_point=time_point)\n full_keys = [] # List of all rows in dataframe to fill in missing data\n\n stream... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Method to print a stream table from a dataframe. Method takes any argument understood by DataFrame.to_string | def stream_table_dataframe_to_string(stream_table, **kwargs):
# Set some default values for keyword arguments
na_rep = kwargs.pop("na_rep", "-")
justify = kwargs.pop("justify", "center")
float_format = kwargs.pop("float_format", lambda x: "{:#.5g}".format(x))
# Print stream table
return stream_... | [
"def print_dataframe(self, df):\n header = [\n '일련번호',\n '학생 id',\n '이름',\n '생년월일',\n '중간고사',\n '기말고사',\n '평균',\n 'Grade'\n ]\n\n header_str = '{:10s}' * len(header)\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Attempt to find a StateBlocklike object connected to a Port. If the object is indexed both in space and time, assume that the time index comes first. If no components are assigned to the Port, raise a ValueError. If the first component's parent block has no index, raise an AttributeError. If different variables on the ... | def _get_state_from_port(port, time_point):
vlist = list(port.iter_vars())
states = [v.parent_block().parent_component() for v in vlist]
if len(vlist) == 0:
raise ValueError(
f"No block could be retrieved from Port {port.name} "
f"because it contains no components."
... | [
"def find(self,port):\n\tif self.portlist == []:\n\t\treturn -1\n\tif isinstance(port,Port):\n\t\tport = (int(port.GetPortNbr()), port.GetPortWay())\n\tmatch = ( (int(self.portlist[0].GetPortNbr()), self.portlist[0].GetPortWay()) == port )\n\ti = 0\n\twhile ( not match and i<len(self.portlist)-1 ):\n\t\ti += 1\n\t\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create a Pandas DataFrame that contains a list of userdefined attributes from a set of Blocks. | def generate_table(blocks, attributes, heading=None, exception=True):
if heading is None:
heading = attributes
st = DataFrame(columns=heading)
row = [None] * len(attributes) # not a big deal but save time on realloc
for key, s in blocks.items():
for i, a in enumerate(attributes):
... | [
"def dataframe_attributes(attributes, columns=None):\n\n df = pd.DataFrame(attributes, columns=columns)\n return df",
"def get_attributes(units, properties=[\"p_set\", \"q_set\"]):\n df = pd.DataFrame()\n for unit in units.items():\n for prop in properties:\n df.at[un... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Imports jammer info from [jammers.csv] it will perform classification and picture (url) fetching returns a list of Jammer objects with propagated fields. Hardcoded reasoner that thinks the jammer has a ticket, if it comes from the jammers.csv file. | def import_jammers(csvfile, fieldnames=None):
parsed_jammers = []
if fieldnames is None:
# Read fieldnames from first line of csvfile.
jammers = csv.DictReader(csvfile)
else:
# Fieldnames provided
# Skip header line/fieldnames line
jammers = csv.DictReader(csvfile, fieldnames)
next(jammers)
for jammer... | [
"def load_teachers_from_the_pull():\n with open(\"data/dance_teachers_data.csv\", encoding=\"ISO-8859-1\") as teach:\n reader = csv.reader(teach)\n for row in reader:\n # print(row[])\n teacher = Teacher(photo=row[1], teacher_name=row[3], bio=row[4])\n\n db.session.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Fetches the gforms results page as csv from a published csv link. imports it to the jamsite.jammers | def import_from_url(jamsite, url, fieldnames=None):
# import csv, from the webz.
csvfile = fetch_csv_from_url(url)
jamsite.mergeinsert( import_jammers(csvfile, fieldnames=fieldnames) ) | [
"def get_csv(request, cur_course_user, assessment_id):\n assessment = shortcuts.get_object_or_404(models.Assessment, pk=assessment_id)\n\n # Create the HttpResponse object with the appropriate CSV header.\n response = http.HttpResponse(content_type='text/csv')\n\n filename = \"%s-scores.csv\" % assessment.name\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Imports from jammers.csv and mergeinserts into jamsite.jammers. | def import_from_file(jamsite, source='jammers.csv', fieldnames=None):
# import jammers.csv
with open(source) as csvfile:
jamsite.mergeinsert( import_jammers(csvfile, fieldnames=fieldnames) ) | [
"def import_jammers(csvfile, fieldnames=None):\n\tparsed_jammers = []\n\tif fieldnames is None:\n\t\t# Read fieldnames from first line of csvfile.\n\t\tjammers = csv.DictReader(csvfile) \n\telse:\n\t\t# Fieldnames provided\n\t\t# Skip header line/fieldnames line\n\t\tjammers = csv.DictReader(csvfile, fieldnames)\n\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Input a google form mapped fieldnames file, | def gf_fieldnames(fn="forms-fields.txt"):
if fn is None:
return None
with open(fn) as f:
fieldnames = [fieldname.split(":")[0] for fieldname in f]
return fieldnames | [
"def populate_PDF_with_field_names(csv_file_name, pdf_file_name):\n field_mapping = get_field_list(csv_file_name)\n print \"UPDATING FORM VALUES\"\n update_form_values(pdf_file_name, 'out-' + pdf_file_name) # enumerate & fill the fields with their own names\n update_form_values(pdf_file_name, 'output-'... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Remove all files from list of files not mentioned in a changes file. | def remove_cruft_files(cls, files):
valid_files = []
for changes_file in files:
if cls.is_changes(changes_file):
LOG.debug("Checking: {c}".format(c=changes_file))
try:
with mini_buildd.misc.open_utf8(changes_file) as cf:
... | [
"def purge_git_related_files(file_list):\n ignorable = [\".gitignore\"]\n return [f for f in file_list if os.path.basename(f) not in ignorable]",
"def remove_files(self, files: Set[str]) -> None:\n for f in files:\n src = os.path.join(self.get_directory(), f)\n os.remove(src)",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Remove cruft files from incoming. | def remove_cruft(cls):
cls.remove_cruft_files(["{p}/{f}".format(p=mini_buildd.config.INCOMING_DIR, f=f) for f in os.listdir(mini_buildd.config.INCOMING_DIR)]) | [
"def remove_cruft_files(cls, files):\n valid_files = []\n for changes_file in files:\n if cls.is_changes(changes_file):\n LOG.debug(\"Checking: {c}\".format(c=changes_file))\n try:\n with mini_buildd.misc.open_utf8(changes_file) as cf:\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Requeue all existing changes in incoming. We must feed the the user uploads first, so the daemon does not get any yetunknown build results (hence the sorting). | def requeue_changes(cls, queue):
for c in sorted(cls.get_changes(), key=lambda c: 1 if fnmatch.fnmatch(c, "*mini-buildd-build*") else 0):
LOG.info("Incoming: Re-queuing: {c}".format(c=c))
queue.put(c) | [
"def requeue(self):",
"def queueStatusAll():",
"def ProcessqueueClean(self, dryrun=False):\n\n # BAL 30 March 2017 Trying a different method here that might be cleaner\n\n # # TODO this might break with weekly input files\n # DBlogging.dblogger.debug(\"Entering ProcessqueueClean(), there ar... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check if the testbed is dualtor. | def is_dualtor(tbinfo):
return "dualtor" in tbinfo["topo"]["name"] | [
"def skip_dualtor(tbinfo):\n pytest_require(\"dualtor\" not in tbinfo[\"topo\"][\"name\"], \"Skip 'test_tagged_arp' over dualtor.\")",
"def _is_test_mode():\n settings = sublime.load_settings(serial_constants.DEFAULT_SETTINGS)\n return bool(settings.get(\"test_mode\"))",
"def has_test(self):\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Given a timedelta object, returns a float representing milliseconds | def ms_from_timedelta(td):
return (td.seconds * 1000) + (td.microseconds / 1000.0) | [
"def __timedelta_millis(td):\n return int(round(td.total_seconds(), 3) * 1000)",
"def deltaTimeToMS(self, val):\n\t\tif (self.errTriggered):\n\t\t\treturn()\n\n\n\t\ttry:\n\t\t\treturn val * (self.tempo / self.ticksPerQuarterNote) / 1000\n\t\texcept ZeroDivisionError:\n\t\t\tprint(\"Division by zero while conv... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Couchdbkit < 0.6.0 changes feed listener | def old_changes(self):
from couchdbkit import Consumer
c = Consumer(self.couch_db, backend='gevent')
while True:
try:
c.wait(self.parsing_processor, since=self.since, filter=self.couch_filter,
heartbeat=WAIT_HEARTBEAT, feed='continuous', timeou... | [
"def test_changes_feed_call(self):\n changes = self.db.changes(limit=100)\n self.assertIs(type(changes), Feed)\n self.assertEqual(changes._url, '/'.join([self.db.database_url, '_changes']))\n self.assertIsInstance(changes._r_session, requests.Session)\n self.assertFalse(changes._r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Processor that also parses the change to json only for pre 0.6.0 couchdbkit, as the change is passed as a string | def parsing_processor(self, change):
self.processor(simplejson.loads(change)) | [
"def changeFromMessage(message):\n retval = message['payload']['change']\n retval['revision'] = retval['rev']\n retval['properties'] = dict((k,v) for (k,v,s) in retval['properties'])\n retval['files'] = [f['name'] for f in retval['files']]\n if not retval['files']:\n retval['files'] = ['dummy'... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set a more optimized setting setup for fast reindexing | def set_index_reindex_settings(self):
return self.update_settings(INDEX_REINDEX_SETTINGS) | [
"def set_use_slow_search(self, val):\n\n self.__use_slow_search = val",
"def tune(self):\n pass",
"def devpiserver_indexconfig_defaults(index_type):",
"def setSpellerCacheSize(self, value):\n self.setIntegerOption(17, value)",
"def tune_es_for_crawl(defaults=False):\n if conf... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Using the HEAD 404/200 result API for document existence Returns True if 200(exists) | def doc_exists(self, doc_id):
es = self.get_es()
doc_path = self.get_doc_path(doc_id)
head_result = es.head(doc_path)
return head_result | [
"def documentExists(self, id):\n uri = \"/%s/%s\" % (self.name, urllib.quote_plus(id))\n docExists = False\n try:\n self.makeRequest(uri, {}, 'HEAD')\n return True\n except:\n return False",
"def test_documentation_exists(self):\n response = self... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generator function for bulk changes note each individual change item goes through the pillowtop pathway individually when loading the bulk item, and short of change_transport, it's identical. It would be slightly more efficient if the couch load could be done in bulk for the actual documents, but it's not quite possibl... | def bulk_builder(self, changes):
for change in changes:
try:
t = self.change_trigger(change)
if t is not None:
tr = self.change_transform(t)
if tr is not None:
self.change_transport(tr)
... | [
"def _sources_to_change(data, scope: EditScope) -> Iterator:\n for report in _reports_to_change(data, scope):\n for subject_uuid, subject in _subjects_to_change(data, report, scope):\n for metric_uuid, metric in _metrics_to_change(data, subject, scope):\n for source_uuid, source_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Naive means to verify the alias of the current pillow iteration is matched. If we go fancier with routing and multiindex aliases due to index splitting, this will need to be revisited. | def check_alias(self):
es = self.get_es()
aliased_indexes = es[self.es_alias].get('_aliases')
return aliased_indexes.keys() | [
"def alias_exists(self, alias):\n req = requests.head(\n urljoin(self.base_url, '_alias/{0}'.format(alias)),\n verify=self.verify_certs)\n return req.status_code == 200",
"def check_alias_uniqueness(self):\n alias = self.alias\n changed = False\n count = 1\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
For this instance, have the index that represents this index receive the alias itself. This presents a management issue later if we route out additional indexes/aliases that we automate this carefully. But for now, 1 alias to 1 index. Routing will need a refactor anyway | def assume_alias(self):
es = self.get_es()
if es.head(self.es_alias):
#remove all existing aliases - this is destructive and could be harmful, but for current
#uses, it is legal - in a more delicate routing arrangement, a configuration file of
# some sort should be i... | [
"def alias(self, alias, target):\n res = self.__getindex__(target)\n self.__fastindex[alias.lower()] = res",
"def mitigate_alias(self, index):\n self.loggit.debug('BEGIN mitigate_alias')\n self.loggit.debug('Correcting an instance where an alias name points to index \"%s\"', index)\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Verify whether the server has indexed this type We can assume at startup that the mapping from the server is loaded, so in memory will be up to date. | def type_exists(self, doc_dict, server=False):
es = self.get_es()
type_string = self.get_type_string(doc_dict)
if server and self.online:
type_path = "%(index)s/%(type_string)s" % (
{
'index': self.es_index,
'type_string': type... | [
"def has_index(self):\n return self.index is not None",
"def index_exists(self) -> bool:\n return self._vcf_reader.index is not None",
"def check_type(self):\n pass\n\n indice = client.IndicesClient(self.es)\n print(self.es_main_index)\n if indice.exists_type(index=self... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
performs a DNS lookup an ip or hostname. | def handle_dns(bot, ievent):
if not ievent.args:
ievent.missing('<host | ip>')
else:
is_a = None
result = None
# If we support IPv6 ...
if socket.has_ipv6:
# ... then check if this is an IPv6 ip
try:
socket.inet_pton(socket.AF_INE... | [
"def lookup_host(ip):\n if ip not in dns:\n try:\n result = socket.gethostbyaddr(ip)\n dns[ip] = result[0]\n except Exception as e:\n log.warning(\n \"Failed to determine hostname for '%s': %s\"\n % (ip, e)\n )\n r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Discovers the resource structure and attributes. | def get_inventory(self, context):
# See below some example code demonstrating how to return the resource structure
# and attributes. In real life, of course, if the actual values are not static,
# this code would be preceded by some SNMP/other calls to get the actual resource information
... | [
"def introspect():\n mapper = get_mapper()\n controllers = get_controllers()\n routes = get_routes(mapper)\n resources = generate_resources(routes, controllers)\n apis, models = generate_apis_and_models(routes, controllers)\n return resources, apis, models",
"def get_inventory(self, context):\r\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Write decorated test log for all levels | def log_all_levels_decorated(logger_instance):
for log_level in list(new_loglevel_dict.keys()) + list(standard_loglevel_dict.keys()):
getattr(logger_instance, log_level.lower())('test ' + log_level, decorated=True)
getattr(logger_instance, "info")("", decorated=True) | [
"def test_logger_output() -> None:\n # Test DEBUG is written to stdout\n helper_logger_test(level=\"debug\")\n\n # Test INFO is written to stdout\n helper_logger_test(level=\"info\")\n\n # Test WARNING is written to stderr\n helper_logger_test(level=\"warning\")\n\n # Test ERROR is written to s... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Write test log for loops on all levels | def log_all_levels_loop(logger_instance):
for log_level in list(new_loglevel_dict.keys()) + list(standard_loglevel_dict.keys()):
for i in range(3):
logger_instance.loop_counter("test", i, getattr(logging, log_level.upper()))
getattr(logger_instance, log_level.lower())("\n\n") | [
"def runTest(self):\n import logging\n lg_name = expector.logger_name\n lg = logging.getLogger(lg_name)\n start_level = logging.getLevelName('DEBUG_9')\n end_level = logging.getLevelName('CRITICAL_0')\n for lvl in range(start_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Load a subset of the floorplan dataset. | def load_floorplan(self, dataset_dir, subset):
# Set class set based on provided config default classes
class_set = self.config.CLASSES
# Add Classes to inner collection
for idx, c in enumerate(class_set):
self.add_class("floorplan", idx + 1, c)
# Train or validati... | [
"def load_subset_data(data_path, subset_name, timesteps):\n\n selected_subset_paths = subset_paths(os.path.join(data_path, subset_name))\n selected_subset_arrays = subset_arrays(selected_subset_paths)\n\n load_selected_timesteps = lambda x: np.load(x)\n\n if timesteps is not None:\n selected_subs... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generate instance masks for shapes of the given image ID. | def load_mask(self, image_id):
info = self.image_info[image_id]
mask = np.zeros([info["height"], info["width"], len(info["polygons"])],
dtype=np.uint8)
shapes = info['polygons']
for i, p in enumerate(info['polygons']):
shape = p['shape_attributes']['... | [
"def load_mask(self, image_id):\n info = self.image_info[image_id]\n shapes = info[\"shapes\"]\n count = len(shapes)\n mask = np.zeros([info[\"height\"], info[\"width\"], count], dtype=np.uint8)\n for i, (shape, _, dims) in enumerate(info[\"shapes\"]):\n mask[:, :, i : ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Route to redirect /v to /version permanently (301). | def redirect_version():
return redirect(url_for("base_blueprint.version"), code=301) | [
"def redir_index():\n return redirect(url_for(\"index\"), code=301)",
"def redirect(request):\n matchdict = request.matchdict.copy()\n url = request.route_url(route_name, traverse=(), **matchdict)\n return HTTPFound(location=url)",
"def main():\n return redirect('/index') # redirect ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Route to return the current version of the application. | def version():
from app import get_version
return render_template("version.html", version=get_version()) | [
"def redirect_version():\n return redirect(url_for(\"base_blueprint.version\"), code=301)",
"def app_version(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"app_version\")",
"def get_version(self):\n return flask_djangofy.get_version()",
"def app_version(self) -> str:\n return... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Redirects /s to /source permanently (301). | def redirect_source():
return redirect(url_for("base_blueprint.source"), code=301) | [
"def _send_301(self, new_url):\n try:\n self.send_response(301)\n self.send_header('Location', new_url)\n self.send_header('Content-type', 'text/html')\n self.end_headers()\n except UnicodeEncodeError:\n self._send_internal_server_error()",
"def... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Redirects to the last menus' url. | def source():
return redirect(get_last_menus_url()) | [
"def redirect_url(default='home'):\n return request.args.get('next') or \\\n request.referrer or \\\n url_for(default)",
"def home(request):\r\n return redirect(reverse(\"manage_runs\") + \"?openfinder=1\")",
"def go_to_menu(self):\n self.clear_frame()\n Admin(self.frame)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
finds all MP3s below the path given and returns a list of all the file paths | def findMP3s(path=None):
if not path:
lib_path = r'.\songs'
else:
lib_path = path
all_songs = []
#folder from os.walk is: root, dirnames, filenames
for rt, dirs, files in os.walk(lib_path):
for fp in files:
if fnmatch.fnmatch(fp, ... | [
"def getMP3s():\n return getFilesFromPath(\"music/mp3/\")",
"def get_mp3_files(path):\n for dirname, dirnames, filenames in sorted(os.walk(path)):\n for filename in filenames:\n filepath = os.path.join(dirname, filename)\n if is_mp3_file(filepath):\n yield filepat... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Extract metadata from options and populate a post node. | def _update_post_node(node, options, arguments):
node["date"] = arguments[0] if arguments else None
node["tags"] = options.get("tags", [])
node["author"] = options.get("author", [])
node["category"] = options.get("category", [])
node["location"] = options.get("location", [])
node["language"] = o... | [
"def preprocess(cls, post, metadata):\n return post, metadata",
"def handle_post(self, node):\n\t\tattr = node.attributes\n\t\t# By default we always want to chroot, unless\n\t\t# otherwise specified\n\t\tif attr.getNamedItem((None, 'chroot')):\n\t\t\tchroot = attr.getNamedItem((None, 'chroot')).value\n\t\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return section title as text. | def _get_section_title(section):
for title in section.findall(nodes.title):
return title.astext()
raise Exception("Missing title")
# A problem with the following is that title may contain pending
# references, e.g. :ref:`tag-tips` | [
"def _get_title(self):\n section = self.section\n if section is None:\n return ''\n\n return ('%s: %s' % (section.__class__.__name__, section.title))",
"def get_section_title(section):\n return section.filter_headings()[0].title.strip()",
"def get_section_title(\n header_el... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return list of dates of updates found section. | def _get_update_dates(section, docname, post_date_format):
update_nodes = list(section.findall(UpdateNode))
update_dates = []
for update_node in update_nodes:
try:
update = datetime.strptime(update_node["date"], post_date_format)
except ValueError:
if date_parser:
... | [
"def get_updates(self):\n updates = []\n if self.update_tag.upper() in self.dirname.upper():\n update_version = re.search(self.update_pattern, self.dirname).groupdict()['version']\n updates.append(update_version)\n\n game_update_folders = glob.glob(os.path.join(self.update... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Process posts and map posted document names to post details in the environment. | def process_posts(app, doctree):
env = app.builder.env
if not hasattr(env, "ablog_posts"):
env.ablog_posts = {}
post_nodes = list(doctree.findall(PostNode))
if not post_nodes:
return
post_date_format = app.config["post_date_format"]
should_auto_orphan = app.config["post_auto_orph... | [
"def process(self):\n # tokenize, then filter & otherwise process words in each document\n # using steps in preprocess_doc()\n\n all_posts_count = self.postman.posts_read.find({'subreddit': self.postman.subreddit}).count()\n\n for post_idx, post in enumerate(self.postman.posts_read.find(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Replace `PostList` nodes with lists of posts. Also, register all posts if they have not been registered yet. | def process_postlist(app, doctree, docname):
blog = Blog(app)
if not blog:
register_posts(app)
for node in doctree.findall(PostList):
colls = []
for cat in ["tags", "author", "category", "location", "language"]:
for coll in node[cat]:
if coll in blog.catal... | [
"def update_all_posts():\n for post in CURRENT_POSTS:\n update_tag(post)",
"def UpdatePosts():\n posts = GetPosts()\n posts = [_ToPostModel(post) for post in posts]\n for post in posts:\n AddPosition(post)\n post_model.SavePosts(posts)",
"def _prepare_posts(self):\n post_temp... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generate archive pages for all posts, categories, tags, authors, and drafts. | def generate_archive_pages(app):
if not ablog.builder_support(app):
return
blog = Blog(app)
for post in blog.posts:
for redirect in post.redirect:
yield (redirect, {"redirect": post.docname, "post": post}, "ablog/redirect.html")
found_docs = app.env.found_docs
atom_feed =... | [
"def show_archives():\n if not session.get('logged_in'): \n latest = Post.query.filter_by(visible=True)\n else:\n latest = Post.query\n latest = latest.order_by(Post.id.desc()).limit(10)\n months = Post.query.get_months()\n tags = Tag.query.order_by(Tag.name).all()\n #: Needed for ca... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Register posts found in the Sphinx build environment. | def register_posts(app):
blog = Blog(app)
for docname, posts in getattr(app.env, "ablog_posts", {}).items():
for postinfo in posts:
blog.register(docname, postinfo) | [
"def process_posts(app, doctree):\n env = app.builder.env\n if not hasattr(env, \"ablog_posts\"):\n env.ablog_posts = {}\n post_nodes = list(doctree.findall(PostNode))\n if not post_nodes:\n return\n post_date_format = app.config[\"post_date_format\"]\n should_auto_orphan = app.confi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Use 2 variables to pass into the function for robustness. tn is the triggering number, tn = 1 will print all digits. otherwise, the lines will be whatever tn value is. xs is just 10 for now | def printstring(tn,xs): #Printing function
if (tn > -1) and (tn <= 9):
for x in range(xs): #Outer loop for line iteration
print("\n") #Need this new line to meet the output requirement
for y in range(xs): #Inner loop for horizontal printing
print(tn,end=' '... | [
"def test_nrates(self):\n\n answer = ' integer, parameter :: nrates = 7\\n'\n assert self.cromulent_ftag(self.fn._nrates, answer, n_indent=1)",
"def errs_tab(n):\n return [10**(q / -10) for q in range(n + 1)]",
"def tables(n, t):\n\n for i in range(1, t + 1):\n print(f\"{n} X {i} =\"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gives user a choice on how to write a release note | def select_input(cls):
print('Would you like to insert release notes?')
print('0) Cancel')
print('1) Insert directly from command line')
print('2) Insert from a file')
inputValue = 0
inputNote = False
try:
try: input = raw_input
except Nam... | [
"def select_input(cls):\n #Change current working directory to root sdk directory\n Utility.pushd(Settings.rootSdkPath)\n print('Would you like to insert release notes?')\n print('0) Cancel')\n print('1) Insert directly from command line')\n print('2) Insert from a file')\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return a sequence of oslo.messaging.Target This sequence is defining the exchange and topics to be connected for this plugin. | def get_targets(conf):
return [oslo.messaging.Target(topic=topic,
exchange=conf.glance_control_exchange)
for topic in conf.notification_topics] | [
"def get_targets(conf):\n return [oslo.messaging.Target(topic=topic,\n exchange=conf.swift_control_exchange)\n for topic in conf.notification_topics]",
"def get_initiator_target_connections(self):\n url = 'iscsi/target/'\n res = self.send_ht... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get or set if learning task is a time series. | def time_series(self) -> bool:
return self._time_series | [
"def isTimeSeries(self):\n return self._isDateTime",
"def is_timeseries(filepath):\n\n if os.path.isdir(os.path.dirname(filepath)):\n\n if len(os.listdir(os.path.dirname(filepath))) > 1:\n ts = True\n else:\n ts = False\n else:\n ts = None\n\n return ts",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get suitable hyperparameters ranges for a given task. The returning dictionary may contain other dictionaries in the values of a argument. This indicates that this is a optuna.trial method. The class _Objective will handle transforming this dictionary into a callable. | def _get_params_ranges(task: str,) -> Dict[str, Any]:
params_file = os.path.join(
os.path.dirname(__file__), "params", "xgboost.yml"
)
params = utils.read_yaml(params_file)
if "regression" in task.lower():
params.update({"objective": "reg:squarederror"})
... | [
"def _sample_params(self, trial: Trial) -> dict:\n # pseudocode\n # . hyparams = dict loop self.param_space trial.method(args)\n hyparams = {}\n for param in self.param_space:\n print(param.func)\n hyparams[param.name] = param.func(trial, param.name, *param.args)\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Compute impact of an hazard to exposures. | def calc_mortality(impact, key, exposures, impact_funcs, hazard, kanton, save_mat=False):
# 1. Assign centroids to each exposure if not done
assign_haz = INDICATOR_CENTR + hazard.tag.haz_type
if assign_haz not in exposures:
exposures.assign_centroids(hazard)
else:
LOGGER.info('Expo... | [
"def exp_impact_mortality(impact, exp_iimp, exposures, key, hazard, imp_fun, insure_flag, kanton):\r\n if not exp_iimp.size:\r\n return \r\n \r\n if kanton is None:\r\n kanton_name = 'CH'\r\n else:\r\n kanton_name = kanton\r\n \r\n directory = '../../input_data/impact_functi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Compute impact for inpute exposure indexes and impact function. | def exp_impact_mortality(impact, exp_iimp, exposures, key, hazard, imp_fun, insure_flag, kanton):
if not exp_iimp.size:
return
if kanton is None:
kanton_name = 'CH'
else:
kanton_name = kanton
directory = '../../input_data/impact_functions/'
annual... | [
"def calc_mortality(impact, key, exposures, impact_funcs, hazard, kanton, save_mat=False):\r\n # 1. Assign centroids to each exposure if not done\r\n assign_haz = INDICATOR_CENTR + hazard.tag.haz_type\r\n if assign_haz not in exposures:\r\n exposures.assign_centroids(hazard)\r\n else:\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Checks object's class and names it. Since we've got multiple nets predicting objects like 0,1,2 classes, we want to make sure it doesn't get confusing during saving data and drawing BBs | def determine_object_class(self, components_detected):
for subimage, components in components_detected.items():
for component in components:
if component.class_id == 0:
component.object_name = "insl" # Insulator
elif component.class_id == 1:
... | [
"def _is_class_label(feature_name_and_type):\n _, feature_type = feature_name_and_type\n return isinstance(feature_type, tfds.features.ClassLabel)",
"def detect_class_onpic(boxes, allowed_classes):\n object_class = \"all\"\n highest_prob = 0\n for box in boxes:\n box_prob = float(box[1].strip('%... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
syncroomaware users list. optional parameter conversation_id to get a list of users in other rooms. will include users in linked syncrooms. append "rooms" to segment user list by individual rooms. | def syncusers(bot, event, *args):
if not bot.get_config_option('syncing_enabled'):
return
combined = True
tokens = list(args)
if "rooms" in args:
tokens.remove("rooms")
combined = False
if "rooms" in args:
tokens.remove("room")
combined = False
if len(a... | [
"async def get_app_service_users_in_room(\n self,\n room_id: str,\n app_service: \"ApplicationService\",\n cache_context: _CacheContext,\n ) -> Sequence[str]:\n # We can use `get_local_users_in_room(...)` here because an application service\n # can only be interested in ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Rename OpsiDepotserver with id `oldId` to `newId`. References to the old id will be changed aswell. | def host_renameOpsiDepotserver(self, oldId, newId): | [
"def rename_command(source, destination):\n source_ep, source_path = source\n dest_ep, dest_path = destination\n\n if source_ep != dest_ep:\n raise click.UsageError(\n (\n \"rename requires that the source and dest \"\n \"endpoints are the same, {} != {}\"\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sub the center joint 1 (spine joint in ntu dataset | def sub_center_joint(data: np.ndarray, silient=False) -> np.array:
N, M, T, V, C = data.shape
# new_data = np.zeros((N, M, T, V+1, C))
# new_data[:, :, :, :V, :] = data
new_data = data.copy()
#sub center joint
for i_s, sample in enumerate(tqdm(new_data, disable=silient)):
if samp... | [
"def get_center_of_mass_allies(self,obs):",
"def recenter(self):\n self.x0 -= self.centroid",
"def center_protein(traj, inplace=True):\n create_bonds(traj.topology)\n return traj.image_molecules(inplace=inplace, make_whole=True)",
"def center(self):\n \n return self.stimulus.tr_leng... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
parallel the bone between right shoulder(jpt 8) and left shoulder(jpt 4) of the first person to the x axis | def align_horizontal(data: np.ndarray, xaxis=[8, 4], silient=False) -> None:
for i_s, skeleton in enumerate(tqdm(data, disable=silient)):
if skeleton.sum() == 0:
continue
joint_rshoulder = skeleton[0, 0, xaxis[0]]
joint_lshoulder = skeleton[0, 0, xaxis[1]]
axis = np.cros... | [
"def position_head(self):\n self.whole_body.move_to_go()\n if self.side == \"BOTTOM\":\n self.tt.move_to_pose(self.omni_base,'lower_start_tmp')\n self.whole_body.move_to_joint_positions({'arm_flex_joint': -np.pi/16.0})\n self.whole_body.move_to_joint_positions({'head_pan_joint... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get load balancer related models. The models are stored in a SimpleNamespace object, could be accessed by the dot operator like `load_balancer_models.ManagedClusterLoadBalancerProfile`. | def load_balancer_models(self) -> SimpleNamespace:
if self.__loadbalancer_models is None:
load_balancer_models = {}
load_balancer_models["ManagedClusterLoadBalancerProfile"] = self.ManagedClusterLoadBalancerProfile
load_balancer_models[
"ManagedClusterLoadBala... | [
"def get_models(self):\n\n base = self.get_base()\n return getattr(base, self.resource).json[\"api_declaration\"][\"models\"]",
"def get_models(self):\n return self.ensemble.get_models()",
"def get_models(self):\n self.load()\n return self._models",
"def get_models() -> Mapp... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get nat gateway related models. The models are stored in a SimpleNamespace object, could be accessed by the dot operator like `nat_gateway_models.ManagedClusterNATGatewayProfile`. | def nat_gateway_models(self) -> SimpleNamespace:
if self.__nat_gateway_models is None:
nat_gateway_models = {}
nat_gateway_models["ManagedClusterNATGatewayProfile"] = (
self.ManagedClusterNATGatewayProfile if hasattr(self, "ManagedClusterNATGatewayProfile") else None
... | [
"def generate_nnmodels(self):\n return []",
"def get_models(self):\n\n base = self.get_base()\n return getattr(base, self.resource).json[\"api_declaration\"][\"models\"]",
"def get_public_device_models(self):\n # https://api.relayr.io/device-models\n url = '{0}/device-models'.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get maintenance configuration related models. The models are stored in a SimpleNamespace object, could be accessed by the dot operator like `maintenance_configuration_models.ManagedClusterMaintenanceConfigurationProfile`. | def maintenance_configuration_models(self) -> SimpleNamespace:
if self.__maintenance_configuration_models is None:
maintenance_configuration_models = {}
# getting maintenance configuration related models
maintenance_configuration_models["MaintenanceConfiguration"] = self.Main... | [
"def models(self):\n return self.config.models()",
"def get_models(self):\n\n base = self.get_base()\n return getattr(base, self.resource).json[\"api_declaration\"][\"models\"]",
"def get_seo_models():\n seo_models = []\n for model_name in getattr(settings, setting_name_seo_models, ()... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the existing ManagedCluster object in update mode. | def existing_mc(self) -> ManagedCluster:
return self.__existing_mc | [
"def fetch_mc(self) -> ManagedCluster:\n mc = self.client.get(self.context.get_resource_group_name(), self.context.get_name())\n\n # attach mc to AKSContext\n self.context.attach_mc(mc)\n return mc",
"def get_cluster(self, name):\n return clusters.get_cluster(self, name)",
"def Up... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Attach the ManagedCluster object to the context. The `mc` object is only allowed to be attached once, and attaching again will raise a CLIInternalError. | def attach_mc(self, mc: ManagedCluster) -> None:
if self.decorator_mode == DecoratorMode.UPDATE:
self.attach_existing_mc(mc)
if self.mc is None:
self.mc = mc
else:
msg = "the same" if self.mc == mc else "different"
raise CLIInternalError(
... | [
"def attach_existing_mc(self, mc: ManagedCluster) -> None:\n if self.__existing_mc is None:\n self.__existing_mc = mc\n else:\n msg = \"the same\" if self.__existing_mc == mc else \"different\"\n raise CLIInternalError(\n \"Attempting to attach the exist... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Attach the existing ManagedCluster object to the context in update mode. The `mc` object is only allowed to be attached once, and attaching again will raise a CLIInternalError. | def attach_existing_mc(self, mc: ManagedCluster) -> None:
if self.__existing_mc is None:
self.__existing_mc = mc
else:
msg = "the same" if self.__existing_mc == mc else "different"
raise CLIInternalError(
"Attempting to attach the existing `mc` object ... | [
"def attach_mc(self, mc: ManagedCluster) -> None:\n if self.decorator_mode == DecoratorMode.UPDATE:\n self.attach_existing_mc(mc)\n\n if self.mc is None:\n self.mc = mc\n else:\n msg = \"the same\" if self.mc == mc else \"different\"\n raise CLIIntern... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Attach the AKSAgentPoolContext object to the context. The `agentpool_context` object is only allowed to be attached once, and attaching again will raise a CLIInternalError. | def attach_agentpool_context(self, agentpool_context: AKSAgentPoolContext) -> None:
if self.agentpool_context is None:
self.agentpool_context = agentpool_context
else:
msg = "the same" if self.agentpool_context == agentpool_context else "different"
raise CLIInternalEr... | [
"def init_agentpool_decorator_context(self) -> None:\n self.agentpool_decorator = AKSAgentPoolAddDecorator(\n self.cmd, self.client, self.__raw_parameters, self.resource_type, self.agentpool_decorator_mode\n )\n self.agentpool_context = self.agentpool_decorator.context\n self.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Helper function to parse and verify cluster_autoscaler_profile. If the user input is a list, parse it with function "extract_comma_separated_string". If the type of user input or parsed value is not a dictionary, raise an InvalidArgumentValueError. Otherwise, take the keys from the attribute map of ManagedClusterProper... | def __validate_cluster_autoscaler_profile(
self, cluster_autoscaler_profile: Union[List, Dict, None]
) -> Union[Dict, None]:
if cluster_autoscaler_profile is not None:
# convert list to dict
if isinstance(cluster_autoscaler_profile, list):
params_dict = {}
... | [
"def _get_cluster_autoscaler_profile(self, read_only: bool = False) -> Union[Dict[str, str], None]:\n # read the original value passed by the command\n cluster_autoscaler_profile = self.raw_param.get(\"cluster_autoscaler_profile\")\n # parse and validate user input\n cluster_autoscaler_p... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Helper function to validate gmsa related options. When enable_windows_gmsa is specified, if both gmsa_dns_server and gmsa_root_domain_name are not assigned and user does not confirm the operation, a DecoratorEarlyExitException will be raised; if only one of gmsa_dns_server or gmsa_root_domain_name is assigned, raise a ... | def __validate_gmsa_options(
self,
enable_windows_gmsa,
gmsa_dns_server,
gmsa_root_domain_name,
yes,
) -> None:
if enable_windows_gmsa:
if gmsa_dns_server is None and gmsa_root_domain_name is None:
msg = (
"Please assure... | [
"def _get_enable_windows_gmsa(self, enable_validation: bool = False) -> bool:\n # read the original value passed by the command\n enable_windows_gmsa = self.raw_param.get(\"enable_windows_gmsa\")\n # In create mode, try to read the property value corresponding to the parameter from the `mc` obj... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Helper function to obtain the value of subscription_id. | def get_subscription_id(self):
subscription_id = self.get_intermediate("subscription_id", None)
if not subscription_id:
subscription_id = self.cmd.cli_ctx.data.get('subscription_id')
if not subscription_id:
subscription_id = Profile(cli_ctx=self.cmd.cli_ctx).get_s... | [
"def subscription_id(self) -> str:\n return pulumi.get(self, \"subscription_id\")",
"def subscription_id(self) -> Optional[str]:\n return pulumi.get(self, \"subscription_id\")",
"def subscription_id(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"subscription_id\")",
"def subscrip... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Internal function to dynamically obtain the value of location according to the context. When location is not assigned, dynamic completion will be triggerd. Function "get_rg_location" will be called to get the location of the provided resource group, which internally used ResourceManagementClient to send the request. Th... | def _get_location(self, read_only: bool = False) -> Union[str, None]:
# read the original value passed by the command
location = self.raw_param.get("location")
# try to read the property value corresponding to the parameter from the `mc` object
read_from_mc = False
if self.mc and... | [
"def get_location(self, name, group=None):\n opt_group = OptGroup(group) if group is not None else None\n value, loc = self._do_get(name, opt_group, None)\n return loc",
"def get_location(\n self,\n ) -> Callable[[locations_pb2.GetLocationRequest], locations_pb2.Location]:\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Obtain the value of enable_keda. This function will verify the parameter by default. If both enable_keda and disable_keda are specified, raise a MutuallyExclusiveArgumentError. | def get_enable_keda(self) -> bool:
return self._get_enable_keda(enable_validation=True) | [
"def _get_enable_keda(self, enable_validation: bool = False) -> bool:\n # Read the original value passed by the command.\n enable_keda = self.raw_param.get(\"enable_keda\")\n\n # In create mode, try to read the property value corresponding to the parameter from the `mc` object.\n if self... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Internal function to obtain the value of enable_keda. This function supports the option of enable_validation. When enabled, if both enable_keda and disable_keda are specified, raise a MutuallyExclusiveArgumentError. | def _get_enable_keda(self, enable_validation: bool = False) -> bool:
# Read the original value passed by the command.
enable_keda = self.raw_param.get("enable_keda")
# In create mode, try to read the property value corresponding to the parameter from the `mc` object.
if self.decorator_m... | [
"def get_enable_keda(self) -> bool:\n return self._get_enable_keda(enable_validation=True)",
"def _get_disable_keda(self, enable_validation: bool = False) -> bool:\n # Read the original value passed by the command.\n disable_keda = self.raw_param.get(\"disable_keda\")\n\n # This option... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Obtain the value of disable_keda. This function will verify the parameter by default. If both enable_keda and disable_keda are specified, raise a MutuallyExclusiveArgumentError. | def get_disable_keda(self) -> bool:
return self._get_disable_keda(enable_validation=True) | [
"def _get_disable_keda(self, enable_validation: bool = False) -> bool:\n # Read the original value passed by the command.\n disable_keda = self.raw_param.get(\"disable_keda\")\n\n # This option is not supported in create mode, hence we do not read the property value from the `mc` object.\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Internal function to obtain the value of disable_keda. This function supports the option of enable_validation. When enabled, if both enable_keda and disable_keda are specified, raise a MutuallyExclusiveArgumentError. | def _get_disable_keda(self, enable_validation: bool = False) -> bool:
# Read the original value passed by the command.
disable_keda = self.raw_param.get("disable_keda")
# This option is not supported in create mode, hence we do not read the property value from the `mc` object.
# This pa... | [
"def get_disable_keda(self) -> bool:\n return self._get_disable_keda(enable_validation=True)",
"def _get_enable_keda(self, enable_validation: bool = False) -> bool:\n # Read the original value passed by the command.\n enable_keda = self.raw_param.get(\"enable_keda\")\n\n # In create mo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Obtain the value of storage_profile. | def get_storage_profile(self) -> Optional[ManagedClusterStorageProfile]:
profile = self.models.ManagedClusterStorageProfile()
if self.mc.storage_profile is not None:
profile = self.mc.storage_profile
profile.disk_csi_driver = self.get_disk_driver()
profile.file_csi_driver = s... | [
"def infra_storage_profile(self) -> Optional[pulumi.Input['CloudProviderProfileInfraStorageProfileArgs']]:\n return pulumi.get(self, \"infra_storage_profile\")",
"def _get_storage_profile(self, volume):\n return self._get_extra_spec_storage_profile(volume['volume_type_id'])",
"def getProfile(self)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Obtain the value of vnet_subnet_id. | def get_vnet_subnet_id(self) -> Union[str, None]:
return self.agentpool_context.get_vnet_subnet_id() | [
"def virsubnet_id(self):\n return self._virsubnet_id",
"def vip_subnet_id(self):\n return self._vip_subnet_id",
"def subnet_id(self) -> str:\n return pulumi.get(self, \"subnet_id\")",
"def subnet_id(self):\n return self._subnet_id",
"def vip_subnet_cidr_id(self):\n return ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Obtain the value of nodepool_labels. | def get_nodepool_labels(self) -> Union[Dict[str, str], None]:
return self.agentpool_context.get_nodepool_labels() | [
"def node_labels(self) -> Mapping[str, str]:\n return pulumi.get(self, \"node_labels\")",
"def node_labels(self) -> Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]:\n return pulumi.get(self, \"node_labels\")",
"def node_labels(self):\n return self._node_labels",
"def node_labels(s... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Internal function to dynamically obtain the value of dns_name_prefix according to the context. When both dns_name_prefix and fqdn_subdomain are not assigned, dynamic completion will be triggerd. A default dns_name_prefix composed of name (cluster), resource_group_name, and subscription_id will be created. This function... | def _get_dns_name_prefix(
self, enable_validation: bool = False, read_only: bool = False
) -> Union[str, None]:
# read the original value passed by the command
dns_name_prefix = self.raw_param.get("dns_name_prefix")
# try to read the property value corresponding to the parameter from... | [
"def get_dns_name_prefix(self) -> Union[str, None]:\n return self._get_dns_name_prefix(enable_validation=True)",
"def dns_prefix(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"dns_prefix\")",
"def dns_prefix(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"dns_pref... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Dynamically obtain the value of dns_name_prefix according to the context. When both dns_name_prefix and fqdn_subdomain are not assigned, dynamic completion will be triggerd. A default dns_name_prefix composed of name (cluster), resource_group_name, and subscription_id will be created. This function will verify the para... | def get_dns_name_prefix(self) -> Union[str, None]:
return self._get_dns_name_prefix(enable_validation=True) | [
"def _get_dns_name_prefix(\n self, enable_validation: bool = False, read_only: bool = False\n ) -> Union[str, None]:\n # read the original value passed by the command\n dns_name_prefix = self.raw_param.get(\"dns_name_prefix\")\n # try to read the property value corresponding to the pa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Obtain the value of node_osdisk_diskencryptionset_id. | def get_node_osdisk_diskencryptionset_id(self) -> Union[str, None]:
# read the original value passed by the command
node_osdisk_diskencryptionset_id = self.raw_param.get("node_osdisk_diskencryptionset_id")
# try to read the property value corresponding to the parameter from the `mc` object
... | [
"def disk_encryption_set_id(self) -> Optional[str]:\n return pulumi.get(self, \"disk_encryption_set_id\")",
"def disk_encryption_set_id(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"disk_encryption_set_id\")",
"def secure_vm_disk_encryption_set_id(self) -> Optional[str]:\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Obtain the value of ssh_key_value and no_ssh_key. | def get_ssh_key_value_and_no_ssh_key(self) -> Tuple[str, bool]:
# ssh_key_value
# read the original value passed by the command
raw_value = self.raw_param.get("ssh_key_value")
# try to read the property value corresponding to the parameter from the `mc` object
value_obtained_from... | [
"def ssh_key(self) -> str:\n return pulumi.get(self, \"ssh_key\")",
"def git_get_config_key(key:str) -> (None, str):\r\n\r\n try:\r\n cli = [\"git\", \"config\", \"--local\", \"--get\", key]\r\n output = subprocess.check_output(cli).decode()\r\n output = output.splitlines()\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Obtain the value of admin_username. | def get_admin_username(self) -> str:
# read the original value passed by the command
admin_username = self.raw_param.get("admin_username")
# try to read the property value corresponding to the parameter from the `mc` object
if (
self.mc and
self.mc.linux_profile a... | [
"def admin_username(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"admin_username\")",
"def admin_user_name(self) -> str:\n return pulumi.get(self, \"admin_user_name\")",
"def get_username(self):\n return getattr(self, self.USERNAME_FIELD)",
"def catalog_admin_user_name(self) -> ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Dynamically obtain the value of windows_admin_username and windows_admin_password according to the context. | def get_windows_admin_username_and_password(
self,
) -> Tuple[Union[str, None], Union[str, None]]:
return self._get_windows_admin_username_and_password(enable_validation=True) | [
"def get_windows_admin_password(self) -> Union[str, None]:\n # read the original value passed by the command\n windows_admin_password = self.raw_param.get(\"windows_admin_password\")\n\n # this parameter does not need dynamic completion\n # this parameter does not need validation\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Obtain the value of windows_admin_password. | def get_windows_admin_password(self) -> Union[str, None]:
# read the original value passed by the command
windows_admin_password = self.raw_param.get("windows_admin_password")
# this parameter does not need dynamic completion
# this parameter does not need validation
return wind... | [
"def get_windows_admin_username_and_password(\n self,\n ) -> Tuple[Union[str, None], Union[str, None]]:\n return self._get_windows_admin_username_and_password(enable_validation=True)",
"def admin_password(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"admin_password\")",... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Internal function to obtain the value of enable_ahub. | def _get_enable_ahub(
self, enable_validation: bool = False
) -> bool:
# read the original value passed by the command
enable_ahub = self.raw_param.get("enable_ahub")
# In create mode, try to read the property value corresponding to the parameter from the `mc` object.
if self... | [
"def get_enable_ahub(self) -> bool:\n return self._get_enable_ahub(enable_validation=True)",
"def get_disable_ahub(self) -> bool:\n return self._get_disable_ahub(enable_validation=True)",
"def get_enable(self):\n return self.quad.get_enable(self.channel_idx)",
"def _get_disable_ahub(self,... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Obtain the value of enable_ahub. | def get_enable_ahub(self) -> bool:
return self._get_enable_ahub(enable_validation=True) | [
"def _get_enable_ahub(\n self, enable_validation: bool = False\n ) -> bool:\n # read the original value passed by the command\n enable_ahub = self.raw_param.get(\"enable_ahub\")\n # In create mode, try to read the property value corresponding to the parameter from the `mc` object.\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Internal function to obtain the value of disable_ahub. | def _get_disable_ahub(self, enable_validation: bool = False) -> bool:
# read the original value passed by the command
disable_ahub = self.raw_param.get("disable_ahub")
# We do not support this option in create mode, therefore we do not read the value from `mc`.
# this parameter does not... | [
"def get_disable_ahub(self) -> bool:\n return self._get_disable_ahub(enable_validation=True)",
"def get_enable_ahub(self) -> bool:\n return self._get_enable_ahub(enable_validation=True)",
"def _get_enable_ahub(\n self, enable_validation: bool = False\n ) -> bool:\n # read the orig... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |