query stringlengths 9 9.05k | document stringlengths 10 222k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 4 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
reset the execution providers to execute the collect_data. It triggers to recreating inference session. | def set_execution_providers(self, execution_providers=["CPUExecutionProvider"]): # noqa: B006
self.execution_providers = execution_providers
self.create_inference_session() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset(self):\n for provider in self.providers.values():\n provider.reset()\n\n for observation in self.observations.values():\n observation.reset()",
"def on_reset_after_execution(self):\n pass",
"def interactive_reset(self):\n # Set the initial state\n\n ... | [
"0.6323081",
"0.58850425",
"0.58387077",
"0.5724095",
"0.57188416",
"0.56691223",
"0.5652778",
"0.5533942",
"0.5513653",
"0.55113894",
"0.55113894",
"0.55113894",
"0.5511064",
"0.55093247",
"0.54930425",
"0.54805976",
"0.54596144",
"0.5457072",
"0.54517335",
"0.5450865",
"0.5... | 0.6150363 | 1 |
create an OnnxRuntime InferenceSession. | def create_inference_session(self):
sess_options = onnxruntime.SessionOptions()
sess_options.graph_optimization_level = onnxruntime.GraphOptimizationLevel.ORT_DISABLE_ALL
self.infer_session = onnxruntime.InferenceSession(
self.augmented_model_path,
sess_options=sess_optio... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_ort_session(self, onnx_path):\n # Setup options for optimization\n sess_options = ort.SessionOptions()\n sess_options.execution_mode = ort.ExecutionMode.ORT_SEQUENTIAL\n sess_options.graph_optimization_level = ort.GraphOptimizationLevel.ORT_ENABLE_ALL\n\n self.ort_sessio... | [
"0.64287347",
"0.63863736",
"0.6347452",
"0.5931692",
"0.5925455",
"0.58672893",
"0.5637707",
"0.5620587",
"0.5582713",
"0.55574703",
"0.550082",
"0.5489399",
"0.547671",
"0.54669124",
"0.5439374",
"0.54066926",
"0.5406201",
"0.53796494",
"0.5331371",
"0.5314776",
"0.5209954"... | 0.82782066 | 0 |
select input/output tensors of candidate nodes to calibrate. | def select_tensors_to_calibrate(self, model: ModelProto):
value_infos = {vi.name: vi for vi in model.graph.value_info}
value_infos.update({ot.name: ot for ot in model.graph.output})
value_infos.update({it.name: it for it in model.graph.input})
initializer = {init.name for init in model.g... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def learning_Utility(self):\n # Shape the input that we give to the neural network with the value of sensors, the previous actions the life of the agent \n # Get the results from the sensors according the different movement executed by the agent \n sensors_result_N = self.agent.sensors(self, d... | [
"0.5132529",
"0.5103128",
"0.50717694",
"0.50447917",
"0.5014779",
"0.50001043",
"0.49974504",
"0.49860495",
"0.49711442",
"0.49643132",
"0.49161378",
"0.49030358",
"0.49007672",
"0.48981002",
"0.48850143",
"0.485468",
"0.48339158",
"0.48284072",
"0.48257983",
"0.47925872",
"... | 0.5722057 | 0 |
Adds ReduceMin and ReduceMax nodes to all quantization_candidates op type nodes in model and ensures their outputs are stored as part of the graph output | def augment_graph(self):
tensors, _ = self.select_tensors_to_calibrate(self.model)
reshape_shape_name = str(uuid.uuid4())
reshape_shape = numpy_helper.from_array(np.array([1], dtype=np.int64), reshape_shape_name)
self.model.graph.initializer.append(reshape_shape)
def add_reduce_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_reduce(g, op, block):\n\n op_map = {\n \"reduce_all\": \"all\",\n \"reduce_any\": \"any\",\n \"reduce_max\": \"max\",\n \"reduce_min\": \"min\",\n \"reduce_prod\": \"prod\",\n \"reduce_sum\": \"sum\",\n \"reduce_mean\": \"mean\",\n }\n op_name =... | [
"0.5645855",
"0.53501433",
"0.5246339",
"0.52274525",
"0.5080488",
"0.50688004",
"0.5044712",
"0.49589333",
"0.4905664",
"0.4891885",
"0.48683834",
"0.48381573",
"0.48108053",
"0.4800535",
"0.47633642",
"0.47312012",
"0.47288904",
"0.471117",
"0.47105142",
"0.4692214",
"0.468... | 0.56021696 | 1 |
Get the optimal result among collection data. | def compute_collection_result(self):
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetPts(self):\n return self.best",
"def getResults():",
"def _compute_best_value(self):\n reduced_cs = []\n concerned_vars = set()\n\n for c in self.utilities:\n asgt = filter_assignment_dict(self._neighbors_values, c.dimensions)\n reduced_cs.append(c.slice(asg... | [
"0.6284819",
"0.62337065",
"0.61745787",
"0.61052895",
"0.60609734",
"0.60476875",
"0.6004349",
"0.59691477",
"0.5940262",
"0.59164304",
"0.5862893",
"0.5773496",
"0.57638365",
"0.5753932",
"0.574135",
"0.57389337",
"0.5737159",
"0.57235175",
"0.5709042",
"0.56935674",
"0.567... | 0.6996528 | 0 |
Collect histogram on absolute value | def collect_absolute_value(self, name_to_arr):
for tensor, data_arr in name_to_arr.items():
data_arr = np.asarray(data_arr) # noqa: PLW2901
data_arr = data_arr.flatten() # noqa: PLW2901
if data_arr.size > 0:
min_value = np.min(data_arr)
max_v... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_histogram(self):\n\n for bin in range(self.bins.size):\n bin_inf = self.bins[bin]\n try: bin_sup = self.bins[bin + 1]\n except IndexError: bin_sup = self.vmax\n self.hist[bin] = np.sum(\n (self.values >= bin_inf)*(self.values < bin_sup))\n\n... | [
"0.6780593",
"0.6637294",
"0.6636672",
"0.6386098",
"0.6373501",
"0.6371298",
"0.6316349",
"0.6257009",
"0.62314403",
"0.6217895",
"0.6184364",
"0.6180108",
"0.614731",
"0.6107375",
"0.60950774",
"0.6084479",
"0.60823816",
"0.6082355",
"0.60809517",
"0.607641",
"0.60702395",
... | 0.7000032 | 0 |
Find the line that contains or matches substr since line ``start``. | def find_line(lines: List[str], substr: Predicate, start: int = 0) -> int:
if isinstance(substr, str):
pred = _string_contains
elif isinstance(substr, tuple):
pred = _pattern_value_match
else:
pred = _apply_func
for i in range(start, len(lines)):
if pred(lines[i], substr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _match_start_get_remaining(self, start, text):\n if not text.startswith(start):\n return\n return text[len(start):]",
"def _get_prev_line_having_substr(substr):\n last_occ_idx = vim.eval(SEARCH_LAST_CMD.format(substr=substr))\n if last_occ_idx == 0:\n return\n line_co... | [
"0.6829045",
"0.6382696",
"0.6371454",
"0.6307071",
"0.62964875",
"0.60427123",
"0.60387963",
"0.6038122",
"0.60191697",
"0.59272146",
"0.59037364",
"0.5864446",
"0.5817685",
"0.58130187",
"0.58130187",
"0.58130187",
"0.5806736",
"0.5797243",
"0.5758163",
"0.5758163",
"0.5746... | 0.73265594 | 0 |
Extract the lines between the line containing ``begin`` and the line containing ``end`` (excluding both lines) in ``parent``. | def extract_lines(parent: str, begin: Predicate, end: Predicate) -> str:
lines = parent.splitlines()
begin_line = find_line(lines, begin)
end_line = find_line(lines, end, begin_line+1)
new_lines = lines[begin_line+1:end_line]
return "\n".join(new_lines) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def section(fle, begin, end):\n with open(fle) as f:\n for line in f:\n # found start of section so start iterating from next line\n if line.startswith(begin):\n for line in f: \n # found end so end function\n if line.startswith(e... | [
"0.58529377",
"0.5581693",
"0.54582626",
"0.5362531",
"0.5349962",
"0.5346175",
"0.53401434",
"0.51990694",
"0.5192469",
"0.5124478",
"0.49769285",
"0.49085382",
"0.48960736",
"0.48947686",
"0.48660842",
"0.48560873",
"0.48549527",
"0.485269",
"0.4845138",
"0.48439127",
"0.48... | 0.81444484 | 0 |
Replace the lines between the line containing ``begin`` and the line containing ``end`` (excluding both lines) in ``parent`` with ``generated``. | def inject_lines(parent: str, begin: Predicate, end: Predicate, generated: str) -> str:
lines = parent.splitlines()
begin_line = find_line(lines, begin)
end_line = find_line(lines, end, begin_line+1)
new_lines = lines[:begin_line+1] + generated.splitlines() + lines[end_line:]
return "\n".join(new... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_new_file(file, new_content):\n with open(file, 'r') as f:\n old_content = f.read()\n\n try:\n before, begin_marker, _, end_marker, after = re.split(r'(// GENERATED-MARKER\\n)', old_content, flags=re.MULTILINE | re.DOTALL)\n except ValueError:\n raise RuntimeError(\"Failed... | [
"0.5403601",
"0.51225114",
"0.49107388",
"0.48132256",
"0.48054352",
"0.47870225",
"0.47572523",
"0.47332415",
"0.4713576",
"0.4713462",
"0.4688489",
"0.46581972",
"0.46474382",
"0.46446952",
"0.46335268",
"0.4598963",
"0.4561457",
"0.45551708",
"0.4552287",
"0.454125",
"0.45... | 0.71948594 | 0 |
Setters for _grilleCSV We read the csv file and copy it into _grilleCSV | def _set_grille_csv(self):
with open(self.csvPath, "r") as csvFile:
fileRead = csv.reader(csvFile, delimiter=",")
#We read each row of the csv file
for row in fileRead:
rowSplitted = row[0].split(";")
self._grilleCSV.append(rowSplitted) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_csv_file(self):\n pass",
"def read_csv():",
"def _read_csv(self):\n self.function_name = '_read_csv'\n with open(os.path.join(self.task.downloads, self.csv_name)) as csv_file:\n reader = csv.reader(csv_file, dialect='excel')\n for row in reader:\n ... | [
"0.6927725",
"0.69130695",
"0.6871285",
"0.6801644",
"0.6744654",
"0.6588532",
"0.6566736",
"0.64618015",
"0.6455032",
"0.6349118",
"0.63289684",
"0.63281035",
"0.6291599",
"0.628651",
"0.6254619",
"0.6231155",
"0.62277955",
"0.62180835",
"0.62180835",
"0.62067026",
"0.620670... | 0.84458977 | 0 |
Setters for start element which is a tuple of the coordinates | def _set_start(self, coordinates):
self._start = coordinates | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_start_coords(self, x:int, y:int) -> None:\r\n self.start_x = x\r\n self.start_y = y",
"def coordinates_from(self, start):\r\n x, y, z = start\r\n return (\r\n x + self.x,\r\n y + self.y,\r\n z + self.z\r\n )",
"def coordinates(self):",... | [
"0.7095122",
"0.6971883",
"0.6610215",
"0.6512453",
"0.64471847",
"0.6387624",
"0.6292622",
"0.62576914",
"0.6186957",
"0.6184456",
"0.6180708",
"0.61720043",
"0.61565536",
"0.61150855",
"0.6073061",
"0.606037",
"0.60584736",
"0.60528666",
"0.6041813",
"0.60272986",
"0.599969... | 0.72577804 | 0 |
Getters for the list of spikes in the level | def _get_spikes(self):
return self._spikes | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(self) -> list[float]:",
"def get_spikes(self):\n\t\treturn spiketrain.netconvecs_to_listoflists(self.t_vec, self.id_vec)",
"def getSpikes(self, compatible_output=False, gather=True):\n global controller\n timer = None\n if conf.config.getboolean(\"Reports\", \"outputTimesForSection... | [
"0.61956644",
"0.5953451",
"0.5892223",
"0.5826972",
"0.5796336",
"0.57914096",
"0.57477033",
"0.5735276",
"0.5733464",
"0.57141876",
"0.5683586",
"0.5670041",
"0.5660167",
"0.5659242",
"0.5631785",
"0.56237555",
"0.55452305",
"0.5457929",
"0.5413642",
"0.54100657",
"0.539900... | 0.6275449 | 0 |
Setters for the list of spikes in the level | def _set_spikes(self, listOfSpikes):
self._spikes = listOfSpikes | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, spikes, position, size=(100, 100), x_range=(-100, 100), y_range=(-100, 100)):\n self.ratemap = np.empty(shape=size)\n self.ratemap[:] = np.nan\n self.size = size\n self.x_range = x_range\n self.y_range = y_range\n self.x_pos_bins = np.linspace(x_range[0]... | [
"0.62325805",
"0.62285364",
"0.59513015",
"0.5906226",
"0.57516617",
"0.5725869",
"0.56792474",
"0.5572047",
"0.55598605",
"0.5543055",
"0.54973334",
"0.54973334",
"0.54973334",
"0.54973334",
"0.54973334",
"0.54973334",
"0.54185104",
"0.5391921",
"0.53644025",
"0.53621906",
"... | 0.72314775 | 0 |
Getters for the list of scrolls in the level | def _get_scrolls(self):
return self._scrolls | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_scroll(self, event):\n raise NotImplementedError",
"def scroll(*args):",
"def _on_scroll(self, event):",
"def _set_scrolls(self, listOfScrolls):\n self._scrolls = listOfScrolls",
"def scrolls(publications, ):\n return (int(publications)) // 11",
"def children_list(self):\n ... | [
"0.6164769",
"0.60499156",
"0.586094",
"0.56506693",
"0.5509772",
"0.54274267",
"0.54106253",
"0.53923464",
"0.5361039",
"0.53581995",
"0.5320929",
"0.5300484",
"0.52752745",
"0.5220838",
"0.52052206",
"0.52046984",
"0.5188282",
"0.5162258",
"0.51587117",
"0.51358074",
"0.513... | 0.78128433 | 0 |
Setters for the list of scrolls in the level | def _set_scrolls(self, listOfScrolls):
self._scrolls = listOfScrolls | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_scrolls(self):\n return self._scrolls",
"def scroll(*args):",
"def _on_scroll(self, event):",
"def set_scroll(self, identifier, **kwargs):\n # scroll is allowed to be set only once\n if self.scroll is not None: raise AssertionError(\n '!! Scroll has already been set to {}'.format(s... | [
"0.6509867",
"0.63745624",
"0.61840516",
"0.6137126",
"0.5879936",
"0.5810164",
"0.5725133",
"0.5686556",
"0.55222386",
"0.5488683",
"0.54880834",
"0.54756045",
"0.5447873",
"0.543492",
"0.5424347",
"0.540691",
"0.5397197",
"0.5397197",
"0.5359283",
"0.5328611",
"0.5326155",
... | 0.73645455 | 0 |
Setters for the list of keys in the level | def _set_keys(self, listOfKeys):
self._keys = listOfKeys | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_levels(lst_all, lst_chiln, lng_level):\n lng_next = lng_level + 1\n for id_child in lst_chiln:\n dct_child = lst_all[id_child]\n dct_child[ATT_LEVEL] = lng_level\n lst_next = dct_child[ATT_CHILN]\n if lst_next:\n _set_levels(lst_all,... | [
"0.62106353",
"0.6073294",
"0.6059759",
"0.6054648",
"0.60144097",
"0.5976053",
"0.59505826",
"0.5905664",
"0.58825254",
"0.5876824",
"0.5862798",
"0.58334285",
"0.5832255",
"0.5832255",
"0.5827494",
"0.58216745",
"0.5820126",
"0.58027184",
"0.57900196",
"0.5781017",
"0.57641... | 0.6867925 | 0 |
Getters for the list of boxes in the level | def _get_boxes(self):
return self._boxes | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def boxes(self) -> dict:\n return self.data[\"boxes\"]",
"def get_boxes(self):\r\n\r\n boxes = [(\" \", self.worldbox.tl, self.worldbox.br)]\r\n# boxes = []\r\n boxes += [(\".\", b.tl, b.br) for b in self.wallboxes]\r\n boxes += [(\"x\", b.tl, b.br) for b in self.targetboxes]\r... | [
"0.7172589",
"0.697769",
"0.6899347",
"0.6241453",
"0.6183926",
"0.61807877",
"0.6094649",
"0.60684776",
"0.60360795",
"0.6034314",
"0.5913935",
"0.58993864",
"0.5893196",
"0.5861107",
"0.5827474",
"0.58121175",
"0.5772795",
"0.5753878",
"0.57495",
"0.5748847",
"0.5685398",
... | 0.74243194 | 0 |
Setters for the list of Boxes in the level | def _set_boxes(self, listOfBoxes):
self._boxes = listOfBoxes | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_boxes(self):\n for index in self.box_space.points:\n if self.rank_of_box[index] == self.my_rank:\n self.my_boxes.append(Box(self, index))",
"def set_box(self) -> None:\n from pymol import cmd\n\n # Delete Box object in PyMOL\n if \"box\" in cmd.get_... | [
"0.6488099",
"0.62966734",
"0.6291908",
"0.6249032",
"0.6207434",
"0.62001705",
"0.61554664",
"0.6131512",
"0.6013343",
"0.6009452",
"0.5989353",
"0.5961712",
"0.5961302",
"0.585783",
"0.5741735",
"0.5741374",
"0.57052207",
"0.5686588",
"0.56825024",
"0.5679052",
"0.56784123"... | 0.77856565 | 0 |
Check if the player is on a cell where there is a box | def checkPlayerBoxes(self, player, event):
playerCoordinates = [player.positionRect.x, player.positionRect.y]
element = self._get_grille()[playerCoordinates[1]][playerCoordinates[0]].element
#If the player goes left
if event.key == K_LEFT:
playerCoordinates[0] -= 1
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def in_cell(self):\n for player in self.players:\n for cell in self.cell_lst:\n if player.x in cell[0] and player.y in cell[1]:\n player.current_cell = cell\n break",
"def is_cell_on_board(cell, board_shape): # TODO: Remove\n return (... | [
"0.7465015",
"0.672763",
"0.6629412",
"0.66279733",
"0.6605929",
"0.6571107",
"0.6549291",
"0.6466717",
"0.6451506",
"0.6445698",
"0.64178747",
"0.6398614",
"0.6392987",
"0.63851756",
"0.63734686",
"0.63638514",
"0.6356712",
"0.6354886",
"0.6336888",
"0.63310224",
"0.6327387"... | 0.70915484 | 1 |
We check if the player has reached the end of the level | def checkEndLevel(self, player):
playerCoordinates = (player.positionRect.x, player.positionRect.y)
#If the player coordinates match the end coordinates, he/she goes to
#next level
if playerCoordinates == self._get_end():
#We return True because the player has finished the ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def checking_level_end(level, inventory, x_player, y_player, hamster_energy, board):\n\n next_level = False\n if level == 1 and board[y_player][x_player] == '⇵':\n print_level_title(4)\n you_win = guess_number_game.main()\n if you_win:\n next_level = True\n\n elif level == ... | [
"0.74338865",
"0.73416334",
"0.707644",
"0.6987549",
"0.69578713",
"0.6906042",
"0.68912905",
"0.6860396",
"0.6851032",
"0.6842135",
"0.6782858",
"0.6637998",
"0.6631234",
"0.6627323",
"0.66188407",
"0.6568642",
"0.65587145",
"0.6540509",
"0.6532094",
"0.65032136",
"0.6489751... | 0.8452138 | 0 |
We check if the player has landed on a spike | def checkPlayerDies(self, player):
listOfSpikesCoordinates = self._get_spikes()
playerCoordinates = (player.positionRect.x, player.positionRect.y)
if listOfSpikesCoordinates is not None:
for spike in listOfSpikesCoordinates:
if playerCoordinates == spike:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shooting(self):\r\n return not self.stopped",
"def check_player_reached():\n global round_start_timer, round_over\n\n if player1.alive and player1.rect.top < (platform_width // 2):\n add_time_points()\n reset_players()\n player1.wins += 1\n return True\n\n elif pla... | [
"0.6846098",
"0.6458586",
"0.63440526",
"0.6338565",
"0.6249835",
"0.62253314",
"0.62216103",
"0.62067175",
"0.61905605",
"0.6189007",
"0.61774755",
"0.61774445",
"0.6148635",
"0.6141195",
"0.6140921",
"0.6134919",
"0.61269647",
"0.61019903",
"0.60916376",
"0.605803",
"0.6040... | 0.6756985 | 1 |
We check if the player is on a scroll. If it is the case, we display the message | def checkPlayerOnScroll(self, player, window):
player_x = player.positionRect.x
player_y = player.positionRect.y
cell = self._get_grille()[player_y][player_x]
#If the player is indeed on a scroll, we display the message
if cell.element is not None and cell.element.name == "scro... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _on_scroll(self, event):",
"def on_scroll(self, event):\n if not self.ignore(event):\n self._on_scroll(event)",
"def scroll(self):\n x_position = self._player.get_position()[0]\n half_screen = self._master.winfo_width() / 2\n world_size = self._world.get_pixel_size()[... | [
"0.6754014",
"0.61627185",
"0.59489286",
"0.58599424",
"0.58091974",
"0.5730006",
"0.5727527",
"0.5721493",
"0.5674587",
"0.56674063",
"0.5644082",
"0.5583983",
"0.55697966",
"0.55506766",
"0.5526234",
"0.55249226",
"0.54950845",
"0.5437477",
"0.54235554",
"0.54235554",
"0.53... | 0.81422544 | 0 |
We search in _grilleCSV which element is present in the level. And we return a list of those elements. | def whichElementIsInTheLevel(self):
listElements = list()
#We read each line
for row in self._get_grille_csv():
#We read each cell of each line
for cell in row:
if cell in listElements or cell == "":
pass
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Students_at_level(l:list,c:str)->list:\n result=[]\n for s in l:\n if s.level==c:\n result.append(s)\n return result",
"def __level_entries_list__(self):\n # | - __level_entries_list__\n level_entries_dict = self.level_entries\n level_labels = self.tree_level_l... | [
"0.5882086",
"0.57715577",
"0.5668204",
"0.55717176",
"0.55569273",
"0.5481823",
"0.5476221",
"0.54283863",
"0.53939533",
"0.53934926",
"0.53920054",
"0.5376523",
"0.534386",
"0.5311687",
"0.5285689",
"0.5260011",
"0.5256839",
"0.5251279",
"0.523684",
"0.5231328",
"0.52153337... | 0.7708357 | 0 |
Evaluate the impurity of the current node, i.e. the impurity of | def node_impurity(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def impurity_improvement(self, impurity):\n\n\t\timpurity_left, impurity_right = self.children_impurity()\n\t\t#return (impurity - impurity_right - impurity_left)\n\t\treturn ((self.weighted_n_node_samples / self.weighted_n_samples) *\n\t\t\t\t\t(impurity - self.weighted_n_right / self.weighted_n_node_samples * ... | [
"0.78295517",
"0.7248663",
"0.7110147",
"0.6886589",
"0.6518789",
"0.63929516",
"0.60269886",
"0.59222686",
"0.59094167",
"0.57904196",
"0.5781065",
"0.57793313",
"0.5759873",
"0.5666492",
"0.56532997",
"0.5626398",
"0.5572544",
"0.55681336",
"0.55646896",
"0.5553427",
"0.553... | 0.8082868 | 0 |
Evaluate the impurity in children nodes, i.e. the impurity of | def children_impurity(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def children_impurity(self):\n\n\t\tgini_left = 0.0\n\t\tgini_right = 0.0\n\t\ttotal = 0.0\n\t\ttotal_left = 0.0\n\t\ttotal_right = 0.0\n\n\t\tfor c in range(self.n_classes):\n\t\t\ttmp = self.label_count_left[c]\n\t\t\tgini_left += tmp * tmp\n\t\t\ttmp = self.label_count_right[c]\n\t\t\tgini_right += tmp * tmp\n\... | [
"0.77084464",
"0.7573167",
"0.7419221",
"0.71277595",
"0.70864475",
"0.6807712",
"0.6530234",
"0.64339405",
"0.5859735",
"0.58362544",
"0.5586613",
"0.55728024",
"0.5482493",
"0.5471503",
"0.53822565",
"0.53801626",
"0.53689873",
"0.53448784",
"0.5277155",
"0.5187495",
"0.517... | 0.8106887 | 0 |
Weighted impurity improvement, i.e. N_t / N (impurity N_t_L / N_t left impurity N_t_L / N_t right impurity), where N is the total number of samples, N_t is the number of samples in the current node, N_t_L is the number of samples in the left child and N_t_R is the number of samples in the right child. | def impurity_improvement(self, impurity):
impurity_left, impurity_right = self.children_impurity()
#return (impurity - impurity_right - impurity_left)
return ((self.weighted_n_node_samples / self.weighted_n_samples) *
(impurity - self.weighted_n_right / self.weighted_n_node_samples * impurity_right
-... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def average_impurity(self):\n children = tf.squeeze(tf.slice(self.variables.tree, [0, 0], [-1, 1]),\n squeeze_dims=[1])\n is_leaf = tf.equal(LEAF_NODE, children)\n leaves = tf.to_int32(tf.squeeze(tf.where(is_leaf), squeeze_dims=[1]))\n counts = tf.gather(self.variables.node_sum... | [
"0.7002049",
"0.6800746",
"0.6706278",
"0.63784224",
"0.6244614",
"0.61719793",
"0.5932771",
"0.5896449",
"0.5837439",
"0.5794223",
"0.5679852",
"0.5576592",
"0.55287987",
"0.55078816",
"0.55039716",
"0.54881984",
"0.5456553",
"0.5454219",
"0.54524636",
"0.5421927",
"0.541978... | 0.7847695 | 0 |
Evaluate the impurity in children nodes, i.e. the impurity of the | def children_impurity(self):
gini_left = 0.0
gini_right = 0.0
total = 0.0
total_left = 0.0
total_right = 0.0
for c in range(self.n_classes):
tmp = self.label_count_left[c]
gini_left += tmp * tmp
tmp = self.label_count_right[c]
gini_right += tmp * tmp
gini_left = 1.0 - gini_left / (self.weig... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def children_impurity(self):\n\t\tpass",
"def impurity_improvement(self, impurity):\n\n\t\timpurity_left, impurity_right = self.children_impurity()\n\t\t#return (impurity - impurity_right - impurity_left)\n\t\treturn ((self.weighted_n_node_samples / self.weighted_n_samples) *\n\t\t\t\t\t(impurity - self.weight... | [
"0.8039218",
"0.7484614",
"0.7301385",
"0.7063674",
"0.7054645",
"0.6728233",
"0.647173",
"0.64218664",
"0.5771031",
"0.5730978",
"0.5528201",
"0.5526324",
"0.54418504",
"0.54391795",
"0.5437261",
"0.5401724",
"0.53852344",
"0.52498543",
"0.5227944",
"0.52093345",
"0.5187871"... | 0.76952016 | 1 |
Sets the token_expiration of this OrgApacheJackrabbitOakSecurityAuthenticationTokenTokenConfiguraProperties. | def token_expiration(self, token_expiration):
self._token_expiration = token_expiration | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_expiration(self):\n # This is an arbitrary decision setting the expiration time\n # to the current date + expires_in - 10 seconds\n self.expiration = datetime.now() + \\\n timedelta(seconds=(self.expires_in - 10))\n logging.debug('Token expiration set to %s' % self.ex... | [
"0.65515846",
"0.6489425",
"0.61133724",
"0.6036679",
"0.58961684",
"0.55701935",
"0.5387193",
"0.536487",
"0.5342043",
"0.5285386",
"0.5218918",
"0.5185711",
"0.5058732",
"0.50248253",
"0.49781796",
"0.4948664",
"0.49243316",
"0.48843396",
"0.48690245",
"0.4849527",
"0.48338... | 0.7860061 | 0 |
Sets the token_length of this OrgApacheJackrabbitOakSecurityAuthenticationTokenTokenConfiguraProperties. | def token_length(self, token_length):
self._token_length = token_length | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def token_length(self):\n return 32",
"def checklength(config, tokenizer):\n\n # Unpack nested config, handles passing model directly\n if hasattr(config, \"config\"):\n config = config.config\n\n if (\n hasattr(config, \"max_position_embeddings\")\n a... | [
"0.64974827",
"0.54974973",
"0.54938304",
"0.5431286",
"0.5425911",
"0.53945225",
"0.53191924",
"0.53072226",
"0.5291858",
"0.5279412",
"0.5225515",
"0.51672924",
"0.51644915",
"0.5126199",
"0.50341994",
"0.50252384",
"0.49880198",
"0.49486992",
"0.4948699",
"0.49478066",
"0.... | 0.77983516 | 0 |
Sets the token_refresh of this OrgApacheJackrabbitOakSecurityAuthenticationTokenTokenConfiguraProperties. | def token_refresh(self, token_refresh):
self._token_refresh = token_refresh | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_reddit_oauth_refresh_token(site_name, token, _current_parser=None):\n set_value(site_name, OAUTH_CRED_KEYS[CredKeys.refresh], token, _current_parser)",
"def set_refresh_token(self, token):\n\n self.__current_request_mock.headers['Cookie'] = f'Refresh-Auth={token}'",
"def refresh(self):\n ... | [
"0.70055157",
"0.69926065",
"0.69331497",
"0.6908582",
"0.6820355",
"0.6664596",
"0.66341186",
"0.6582922",
"0.65732235",
"0.65676665",
"0.65497774",
"0.651406",
"0.6422973",
"0.6415158",
"0.63710177",
"0.6363387",
"0.62807554",
"0.62514967",
"0.62255317",
"0.6166498",
"0.616... | 0.8201788 | 0 |
Sets the token_cleanup_threshold of this OrgApacheJackrabbitOakSecurityAuthenticationTokenTokenConfiguraProperties. | def token_cleanup_threshold(self, token_cleanup_threshold):
self._token_cleanup_threshold = token_cleanup_threshold | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def repo_size_limit_threshold_mb(self, repo_size_limit_threshold_mb):\n\n self._repo_size_limit_threshold_mb = repo_size_limit_threshold_mb",
"def setCleanupTool(self,value):\n self.PDFreactorConfiguration.in1[\"cleanupTool\"] = value",
"def token_length(self, token_length):\n\n self._toke... | [
"0.516139",
"0.46267745",
"0.4521541",
"0.44696322",
"0.444375",
"0.44179785",
"0.4386771",
"0.43714768",
"0.43595752",
"0.43552157",
"0.43172798",
"0.43127617",
"0.43013564",
"0.42994827",
"0.4276944",
"0.4255348",
"0.4255348",
"0.42459875",
"0.42274946",
"0.42036274",
"0.41... | 0.8393153 | 0 |
Sets the password_hash_algorithm of this OrgApacheJackrabbitOakSecurityAuthenticationTokenTokenConfiguraProperties. | def password_hash_algorithm(self, password_hash_algorithm):
self._password_hash_algorithm = password_hash_algorithm | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def password_hash_iterations(self, password_hash_iterations):\n\n self._password_hash_iterations = password_hash_iterations",
"def set_password_hash(self, password):\n salt = bcrypt.gensalt()\n self.password_hash = bcrypt.hashpw(password.encode(), salt)",
"def hash_password(self):\n ... | [
"0.5773472",
"0.5705776",
"0.55370224",
"0.5362767",
"0.5339795",
"0.53345174",
"0.53082556",
"0.51998013",
"0.5115244",
"0.5096059",
"0.5081463",
"0.50515366",
"0.50405407",
"0.5034428",
"0.50164604",
"0.50102544",
"0.49913713",
"0.4933232",
"0.4923823",
"0.491897",
"0.48978... | 0.7354172 | 0 |
Sets the password_hash_iterations of this OrgApacheJackrabbitOakSecurityAuthenticationTokenTokenConfiguraProperties. | def password_hash_iterations(self, password_hash_iterations):
self._password_hash_iterations = password_hash_iterations | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_password_hash(self, password):\n salt = bcrypt.gensalt()\n self.password_hash = bcrypt.hashpw(password.encode(), salt)",
"def password_hash_algorithm(self, password_hash_algorithm):\n\n self._password_hash_algorithm = password_hash_algorithm",
"def set_password(self, password):\n ... | [
"0.61004245",
"0.6039315",
"0.57552356",
"0.56171733",
"0.5576066",
"0.5576066",
"0.5562618",
"0.55493253",
"0.55397487",
"0.5534445",
"0.5534032",
"0.54852223",
"0.5428458",
"0.5395618",
"0.5395618",
"0.5395618",
"0.5395618",
"0.5382891",
"0.5292858",
"0.5260845",
"0.5180539... | 0.7950528 | 0 |
Sets the password_salt_size of this OrgApacheJackrabbitOakSecurityAuthenticationTokenTokenConfiguraProperties. | def password_salt_size(self, password_salt_size):
self._password_salt_size = password_salt_size | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def salt_opts(self):\n if self._salt_opts is None:\n salt_conf = self.config.settings.get('salt.master_config',\n '/etc/salt/master')\n self._salt_opts = salt.config.master_config(salt_conf)\n return self._salt_opts",
"def token_... | [
"0.5313568",
"0.5256036",
"0.5200819",
"0.5188654",
"0.5129989",
"0.5075282",
"0.5042031",
"0.48906437",
"0.48233792",
"0.48224723",
"0.48160204",
"0.48035473",
"0.47991824",
"0.4790052",
"0.47885826",
"0.47757542",
"0.47442412",
"0.47429308",
"0.47291636",
"0.47253898",
"0.4... | 0.8290696 | 0 |
Makes classes based on given thresholds. | def make_classes(y,thresholds,exact_value=False,reverse=False):
nthres = len(thresholds)
if ~exact_value: # Scale thresholds by standard deviation
y_std = np.std(y) # Get standard deviation
thresholds = np.array(thresholds) * y_std
y_class = np.zeros((y.shape[0],1))
if nthres == 1: ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def adjusted_classes(pred_prob, threshold):\n return [1 if y >= threshold else 0 for y in pred_prob]",
"def threshold_probs(probs):\n classes = np.ones(len(probs),)\n classes[probs < 0.5] = 0\n return classes",
"def _absorb_classes(self, ground_to='in'):\n # Find number of new class for insi... | [
"0.66689724",
"0.6337159",
"0.6335962",
"0.6220492",
"0.6176042",
"0.60976267",
"0.5937524",
"0.5936047",
"0.5931283",
"0.58739364",
"0.58739364",
"0.58739364",
"0.5836414",
"0.583373",
"0.5806876",
"0.57137614",
"0.56987673",
"0.5665866",
"0.56295145",
"0.56280977",
"0.56014... | 0.75083107 | 0 |
Returns mean absolute change across parameters from param1 to param2 | def rate_change_param(param1, param2):
total_change = []
for key, val in param1.items():
total_change.append(np.mean(np.abs(param1[key] - param2[key])))
return np.mean(total_change) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate_absolute_mean_diff(a1, a2):\n diff = np.array(a1) - np.array(a2)\n diff_abs = np.absolute(diff)\n mean_diff = diff_abs.mean()\n return mean_diff",
"def mean_absolute_error(x0, x1):\n return MeanAbsoluteError()(x0, x1)",
"def _mean_diff(x, y):\n return np.mean(x) - np.mean(y)",
... | [
"0.63603914",
"0.63594985",
"0.6053924",
"0.60095775",
"0.5975715",
"0.5948787",
"0.59298044",
"0.591829",
"0.5827105",
"0.58030134",
"0.57447094",
"0.5736064",
"0.5735196",
"0.57252514",
"0.57165",
"0.5701881",
"0.5671757",
"0.5671596",
"0.56521547",
"0.56521547",
"0.5639293... | 0.7746873 | 0 |
Prints model parameter names | def print_param_names(model):
for (param_name, param) in model.get_parameters().items():
print(param_name, param.shape) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_model_params(model):\n for param, value in zip(model.param_names, model.parameters):\n print(\"{:0.4f}\\t{}\".format(value, param))",
"def _print_model_parameters(labels, parameters, errors):\n for label, parameter, error in zip(labels, parameters, errors):\n print(f\"{label} = {par... | [
"0.8404375",
"0.7564573",
"0.7433546",
"0.74063957",
"0.73906106",
"0.73810023",
"0.73810023",
"0.7354682",
"0.7354682",
"0.7354682",
"0.7354682",
"0.73462445",
"0.73395395",
"0.7317706",
"0.7309974",
"0.7309974",
"0.7294344",
"0.7041816",
"0.70049655",
"0.69939125",
"0.69919... | 0.84604084 | 0 |
Returns the index of the parameter in the list of params | def get_param_idx(model, target_name):
for i, (param_name, param) in enumerate(model.get_parameters().items()):
if param_name == target_name:
return i | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parameter_index(self):\n return self._parameter_index",
"def index(*, list : Union[List[Any], ConduitVariable], item : Any) -> int:\n return -1 if item not in list else list.index(item)",
"def argpos(self, name):\n for argid, arg in enumerate(self):\n if arg.name == name:\n ... | [
"0.74701416",
"0.6805807",
"0.6738186",
"0.6619826",
"0.6500323",
"0.6223929",
"0.61853826",
"0.617099",
"0.61469775",
"0.60978466",
"0.60906076",
"0.60640705",
"0.60425174",
"0.60390157",
"0.6004774",
"0.6004478",
"0.60024226",
"0.60024226",
"0.6002037",
"0.59592974",
"0.594... | 0.7686104 | 0 |
This clears the file at url out of the cache, if it was in there. You can use this for testing stuff, or clearing munged stuff. | def _clearFile(url):
md5 = hashlib.md5(url).hexdigest()
filename = os.path.join(config.WEB_CACHE_DIR, md5)
if os.path.exists(filename):
os.remove(filename) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clear_latest_url(self):\n if os.path.isfile(self.HTTPD_LATEST_URL_FILE):\n os.remove(self.HTTPD_LATEST_URL_FILE)\n logger.debug('deleted latest URL file %s' % (self.HTTPD_LATEST_URL_FILE))",
"def download_file_cached(file_url: str, location: str) -> None:\n\titem = os.path.basena... | [
"0.6960745",
"0.65934867",
"0.6407384",
"0.6370004",
"0.63664705",
"0.63399345",
"0.63247496",
"0.6270519",
"0.6260388",
"0.6255713",
"0.6162333",
"0.61528885",
"0.61217046",
"0.6118693",
"0.6115658",
"0.6114848",
"0.61089736",
"0.6104531",
"0.60990155",
"0.6096224",
"0.60911... | 0.8728758 | 0 |
All metainformation from section 1+3 as multiline string | def get_meta_str(self):
s = []
t = "%-32s: %s"
s.append(t % ("Edition", self._meta.get("edition", "---")))
s.append(t % ("Master-table", self._meta.get("master", "---")))
cc = self._meta.get("center", "---")
cs = self._meta.get("subcenter", "---")
if self._tables ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def section_overindented(): # noqa: D416",
"def format_sections(self, sections: SectionDict) -> str:",
"def Synopsis(self, line):\n nest = 0 # [...] nesting level.\n no_split = 0 # buf[no_split:i] should not be split across lines.\n # String append on buf used below because of no_split lookbehind.\... | [
"0.61869085",
"0.60846585",
"0.59987414",
"0.5969794",
"0.57623047",
"0.571841",
"0.5692296",
"0.5684557",
"0.56818175",
"0.5665133",
"0.56437826",
"0.5580224",
"0.5568865",
"0.5556232",
"0.5531403",
"0.5530892",
"0.5473025",
"0.5450933",
"0.5413128",
"0.54026747",
"0.5384964... | 0.61269915 | 1 |
Load all tables referenced by the BUFR | def load_tables(self):
if not len(self._meta):
raise BufrTableError("No table loaded!")
if self._tables is None or self._tables.differs(
self._meta['master'], self._meta['mver'], self._meta['lver'],
self._meta['center'], self._meta['subcenter']... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_db_tables(self):\r\n\r\n self.list_of_tables = pd.read_json(os.path.join(self.config_path, self.db_config_file),\r\n orient='records')[self.report_type]['table']\r\n\r\n # Loading tables from database\r\n for aux_index, table in enumerate(self... | [
"0.67528474",
"0.6654105",
"0.6233552",
"0.61613905",
"0.60914737",
"0.6038449",
"0.5963201",
"0.5953026",
"0.59409255",
"0.5924329",
"0.5912999",
"0.5891923",
"0.58842725",
"0.5881582",
"0.58523697",
"0.5782399",
"0.57753015",
"0.5756432",
"0.5729028",
"0.57129955",
"0.56915... | 0.69495076 | 0 |
Parses fastq file and returns percentage of sequences with base pair count over base_pair_limit. >>> parse_sequence_lengths('./test_files/fastq/read1/doc_test_R1.fastq', 1) 1.0 >>> parse_sequence_lengths('./test_files/fastq/read1/doc_test_R1.fastq', 150) 0.25 >>> parse_sequence_lengths('./test_files/fastq/read2/doc_tes... | def parse_sequence_lengths(filepath, base_pair_limit):
total_count = 0
limit_count = 0
with open(filepath) as f:
line = f.readline()
while line:
if line.startswith('@'):
total_count += 1
seq = f.readline()
sep = f.readline()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_sequence_length_report(directory, base_pair_limit):\n\n for filepath in find_fastq_files(directory):\n print(\"%(filepath)s\\n%(percent)1.2f%% sequences over %(base_pair_limit)i\\n\" %\n {\n 'filepath': filepath,\n 'percent': parse_sequence_lengths... | [
"0.6764307",
"0.5802329",
"0.5756304",
"0.55055326",
"0.5395995",
"0.53483945",
"0.5332044",
"0.5317592",
"0.531458",
"0.52290314",
"0.518055",
"0.51804584",
"0.5171881",
"0.5151545",
"0.51515394",
"0.5149465",
"0.5130835",
"0.50997776",
"0.508935",
"0.5087203",
"0.5056916",
... | 0.8040582 | 0 |
Recursively find all fastq files in a directory and return list of file paths. >>> find_fastq_files('./test_files/fastq') ['./test_files/fastq/read1/doc_test_R1.fastq', './test_files/fastq/read2/doc_test_R2.fastq', './test_files/fastq/read2/nested_read/doc_test_R2.fastq'] | def find_fastq_files(directory):
filepaths = []
for dirpath, dirnames, filenames in os.walk(directory):
for filename in filenames:
if filename.endswith('.fastq'):
filepaths.append(os.path.join(dirpath, filename))
return filepaths | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_fastq_files(self) -> List[Path]:\n return list(self.sequence_data_paths.fastq_path.glob(\"*.fastq.gz\")) # type: ignore",
"def findFiles(target, path):\r\n\tfiles = []\r\n\tlyst = os.listdir(path)\r\n\tfor element in lyst:\r\n\t\tif os.path.isfile(element):\r\n\t\t\tif target in element:\r\n\t\t\... | [
"0.6896931",
"0.6678779",
"0.6610727",
"0.6594567",
"0.655162",
"0.649314",
"0.64682156",
"0.646473",
"0.6444073",
"0.64168435",
"0.64084363",
"0.64079094",
"0.6388692",
"0.63645154",
"0.6359806",
"0.6356913",
"0.6343995",
"0.6331972",
"0.63294595",
"0.6327411",
"0.63087934",... | 0.7965275 | 0 |
Prints sequence length report for fastq files. >>> print_sequence_length_report('./test_files/fastq', 50) ./test_files/fastq/read1/doc_test_R1.fastq 0.75% sequences over 50 ./test_files/fastq/read2/doc_test_R2.fastq 0.50% sequences over 50 ./test_files/fastq/read2/nested_read/doc_test_R2.fastq 0.50% sequences over 50 | def print_sequence_length_report(directory, base_pair_limit):
for filepath in find_fastq_files(directory):
print("%(filepath)s\n%(percent)1.2f%% sequences over %(base_pair_limit)i\n" %
{
'filepath': filepath,
'percent': parse_sequence_lengths(filepath, base... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def seq_length_dist_plot (self):\n if 'seq_length_dist' not in self.fastqc_data or len(self.fastqc_data['seq_length_dist']) == 0:\n log.debug('seq_length_dist not found in FastQC reports')\n return None\n \n if len(self.seq_lengths) < 2:\n html = '<p>All sample... | [
"0.5582171",
"0.5474865",
"0.5386637",
"0.52735984",
"0.5259297",
"0.51798034",
"0.5077845",
"0.50574565",
"0.49718148",
"0.49467772",
"0.49403054",
"0.4932409",
"0.49305895",
"0.49275067",
"0.4908537",
"0.48811987",
"0.48619094",
"0.48561153",
"0.48316237",
"0.4814083",
"0.4... | 0.72994655 | 0 |
Remove rows from the queue_str that are to be skipped. | def _skip_q_rows(queue_str, skip_rows):
if skip_rows is not None:
if isinstance(skip_rows, int):
skip_rows = [skip_rows]
queue_str = [row for i, row in enumerate(queue_str.split('\n'))
if i not in skip_rows]
queue_str = '\n'.join(queu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_discarded(self):\n while self.shrink_target.has_discards:\n discarded = []\n\n for ex in self.shrink_target.examples:\n if ex.discarded and (not discarded or ex.start >= discarded[-1][-1]):\n discarded.append((ex.start, ex.end))\n\n ... | [
"0.58652204",
"0.5480105",
"0.5404816",
"0.5341779",
"0.53255266",
"0.5216241",
"0.51934636",
"0.51636267",
"0.5147229",
"0.5136533",
"0.5135457",
"0.50923824",
"0.50681114",
"0.50654984",
"0.50593674",
"0.50584257",
"0.50341904",
"0.50255984",
"0.5017315",
"0.5010488",
"0.50... | 0.80545586 | 0 |
Get a list of the job names in the queue | def queue_job_names(self):
return [attrs[self.QCOL_NAME] for attrs in self.queue.values()] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_job_names(self):\n return []",
"def list_jobs():\n\n name_to_job_details = redis_controller.get_name_to_job_details()\n return list(name_to_job_details.values())",
"def job_names(self):\n resp = self._cmd(uri = '/jenkins_jobs')\n names = []\n for item in resp.get('jobs... | [
"0.8273716",
"0.7834548",
"0.76624656",
"0.7539052",
"0.7539052",
"0.735248",
"0.72475135",
"0.72475135",
"0.72107977",
"0.71837294",
"0.7078723",
"0.70635825",
"0.7042516",
"0.6969034",
"0.69666624",
"0.68644357",
"0.6825185",
"0.68218863",
"0.67994833",
"0.67952615",
"0.677... | 0.8310541 | 0 |
Get a list of the job integer ids in the queue | def queue_job_ids(self):
return list(self.queue.keys()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_jobs_in_queue() -> List[int]:\n output = subprocess.check_output([\"qstat\"]).decode().splitlines()\n job_ids = []\n for line in output:\n m = REGEX_QSTAT.match(line)\n if m:\n job_ids.append(int(m.group(1)))\n return job_ids",
"def job_ids(self):\n return self... | [
"0.8098724",
"0.80771327",
"0.78428227",
"0.7811004",
"0.775912",
"0.72046375",
"0.7141711",
"0.71055824",
"0.6956485",
"0.6750556",
"0.673579",
"0.66713566",
"0.6658379",
"0.6580794",
"0.6493945",
"0.647386",
"0.6462457",
"0.6444312",
"0.6428943",
"0.6428943",
"0.6425815",
... | 0.8492634 | 0 |
Check the status of an HPC job using the HPC queue. | def check_status(self, job_id=None, job_name=None):
status = None
if job_id is not None:
if int(job_id) in self.queue:
status = self.queue[int(job_id)][self.QCOL_STATUS]
elif job_name is not None:
if job_name in self.queue_job_names:
for... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def in_queue(self):\n if self.get_db('jobid') is None:\n log.debug('jobid not found for calculation.')\n return False\n else:\n # get the jobid\n jobid = self.get_db('jobid')\n # see if jobid is in queue\n _, jobids_in_queue, _ = getstatusoutput('qselect',\n ... | [
"0.7212962",
"0.69906795",
"0.69142705",
"0.68985856",
"0.6762104",
"0.6701875",
"0.6539493",
"0.6510221",
"0.6506319",
"0.64982665",
"0.64312536",
"0.6420319",
"0.6400587",
"0.63170016",
"0.6303401",
"0.62657523",
"0.62130135",
"0.61849165",
"0.6177326",
"0.61487484",
"0.613... | 0.748768 | 0 |
Submit a PBS job via qsub command and PBS shell script | def qsub(self, cmd, alloc, queue, name='reV', feature=None,
stdout_path='./stdout', keep_sh=False):
if len(name) > self.MAX_NAME_LEN:
msg = ('Cannot submit job with name longer than {} chars: "{}"'
.format(self.MAX_NAME_LEN, name))
logger.error(msg)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def submit(STAGE_ID, *options):\n if any([opt.startswith(\"-t\") for opt in options]):\n wrapper = \"qsubwrapmpi\"\n else:\n wrapper = \"qsubwrap\"\n options = \" \".join(options)\n cmd = \"%s -v STAGE_ID=%s %s %s\" % (wrapper, STAGE_ID, options, jobscript)\n status, output = getstatus... | [
"0.71585524",
"0.7095454",
"0.6913012",
"0.68427753",
"0.67105037",
"0.6635338",
"0.6621555",
"0.6582521",
"0.6575965",
"0.64710623",
"0.6449171",
"0.6360658",
"0.6262581",
"0.6214798",
"0.62027866",
"0.6189288",
"0.61486655",
"0.6098876",
"0.60129523",
"0.5985976",
"0.597295... | 0.75427103 | 0 |
Submit an scontrol command. | def scontrol(cmd):
cmd = 'scontrol {}'.format(cmd)
cmd = shlex.split(cmd)
subprocess.call(cmd) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sendCommand1(controlName, command):\n return (_sendCommand1(controlName, command))",
"def _control_sim(sid: SimulationID, command: int, direct: bool) -> None:\n from datetime import datetime\n data = _get_data(sid)\n task = data.simulation_task\n if direct:\n if comman... | [
"0.61158484",
"0.58385885",
"0.58221704",
"0.578542",
"0.5764538",
"0.57640177",
"0.5724178",
"0.56994617",
"0.5611968",
"0.5530975",
"0.5496334",
"0.5483568",
"0.54329103",
"0.54042935",
"0.5398764",
"0.53919667",
"0.5370302",
"0.536005",
"0.53475225",
"0.53416157",
"0.53365... | 0.7594123 | 0 |
Get special sbatch request strings for SLURM features, memory, modules, and conda environments | def _special_cmd_strs(feature, memory, module, module_root, conda_env):
feature_str = ''
if feature is not None:
feature_str = '#SBATCH {} # extra feature\n'.format(feature)
mem_str = ''
if memory is not None:
mem_str = ('#SBATCH --mem={} # node RAM in MB\n'
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _GetEnvironmentVars(benchmark_spec):\n return ' '.join([\n 'NUM_GPUS=%s' % benchmark_spec.total_gpus,\n 'OMP_NUM_THREADS=%s' % benchmark_spec.cpus_per_rank\n ])",
"def slurm(ctx, alloc, nodes, memory, walltime, feature, conda_env, module,\n stdout_path, verbose):\n\n name = ctx.obj['N... | [
"0.5991726",
"0.5722359",
"0.5467262",
"0.5430195",
"0.5405498",
"0.53937364",
"0.5297909",
"0.5296478",
"0.5159235",
"0.5117139",
"0.50537795",
"0.5013929",
"0.501283",
"0.5005968",
"0.49504542",
"0.49317688",
"0.490989",
"0.4881221",
"0.48775366",
"0.48487797",
"0.4847411",... | 0.6994536 | 0 |
Check stdout for a job id and return just the job id if present, otherwise return full stdout. | def _job_id_or_out(out):
stdout = re.sub("[^0-9]", "", str(out))
if not stdout:
stdout = out
return stdout | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getjobid(self, job_dir):\n input = os.path.join(job_dir,'job_id.txt')\n result = None\n if os.path.exists(input):\n contents = file(input).read()\n for c in contents.split('\\n'):\n if c and re.match('^Job <\\\\d*> is submitted to queue <.*>',c) is not ... | [
"0.66317225",
"0.6467701",
"0.6398876",
"0.6239879",
"0.6168",
"0.6134288",
"0.59314007",
"0.59240144",
"0.58849907",
"0.5877714",
"0.582274",
"0.58160233",
"0.5781358",
"0.5755716",
"0.57437587",
"0.57348174",
"0.5688087",
"0.56809086",
"0.5653149",
"0.5645773",
"0.5628289",... | 0.7391676 | 0 |
Submit a SLURM job via sbatch command and SLURM shell script | def sbatch(self, cmd, alloc=None, walltime=None, memory=None, nodes=1,
feature=None, name='reV', stdout_path='./stdout', keep_sh=False,
conda_env=None, module=None,
module_root='/shared-projects/rev/modulefiles'):
if len(name) > self.MAX_NAME_LEN:
msg = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def submit_job(sample_config, jobname, rundir, cliargs, extramodules=[]):\n slurmfile_path = os.path.join(rundir, \"{}.slurm\".format(jobname))\n with open(slurmfile_path, \"w\") as slurmfile:\n slurmfile.write(\"#! /bin/bash -l\\n\")\n slurmfile.write(\"#SBATCH -A {}\\n\".format(cliargs.projec... | [
"0.7767973",
"0.7430228",
"0.7365613",
"0.73106",
"0.7287275",
"0.7097567",
"0.68471104",
"0.6811804",
"0.67943597",
"0.6710504",
"0.6694972",
"0.66010755",
"0.65791327",
"0.655623",
"0.6522866",
"0.65226007",
"0.6492101",
"0.6465887",
"0.6458933",
"0.6431161",
"0.6384085",
... | 0.75273824 | 1 |
Counts the occurences of the regular expressions you will write. | def count_regexp():
# Here's an example regular expression that roughly matches a valid email address.
# The ones you write below should be shorter than this
email = re.compile("[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+\.[a-zA-Z]{2,5}")
###### Write below #########
subheading = re.compile("\=\=+.*\=\=+")... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def counts(self, regex = \"\\w+\"): \n tokenizer = RegexpTokenizer(r'{}'.format(regex))\n count = []\n for i in tqdm(self.text):\n count.append(len(tokenizer.tokenize(i)))\n return count",
"def count_regexp_occ(regexp=\"\", text=None):\n return len(re.findall(rege... | [
"0.6603277",
"0.6473146",
"0.6473146",
"0.6335502",
"0.6326465",
"0.6281599",
"0.62775224",
"0.6204243",
"0.6147632",
"0.6115495",
"0.6080672",
"0.607526",
"0.59416723",
"0.58771884",
"0.58596057",
"0.5846294",
"0.5826234",
"0.5753396",
"0.5752021",
"0.573326",
"0.5732142",
... | 0.749758 | 0 |
Returns the counts of articles, quotes, sources, people and authors grouped by the publishing outlet. | def outlet_stats(args: Dict[str, Any]) -> List[object]:
query = [
{
"$match": {
"body": {"$ne": ""},
"quotesUpdated": {"$exists": True},
"outlet": {"$in": args["outlets"]},
"publishedAt": {
"$gte": args["begin_da... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def daily_article_counts(args: Dict[str, Any]) -> List[object]:\n query = [\n {\n \"$match\": {\n \"outlet\": {\"$in\": args[\"outlets\"]},\n \"publishedAt\": {\n \"$gte\": args[\"begin_date\"],\n \"$lt\": args[\"end_date\"] +... | [
"0.6641451",
"0.6594027",
"0.609627",
"0.60139996",
"0.60049236",
"0.59390366",
"0.58774114",
"0.58294153",
"0.58186644",
"0.5793566",
"0.5775842",
"0.575149",
"0.56283534",
"0.5605162",
"0.55714655",
"0.5557268",
"0.5527308",
"0.55222803",
"0.5514021",
"0.55080914",
"0.54788... | 0.68048644 | 0 |
Returns the names of the topN female sources (i.e. people quoted). If sorted in ascending order, the returned values represent the bottomN female sources. | def top_sources_female(args: Dict[str, Any]) -> List[object]:
query = [
{
"$match": {
"body": {"$ne": ""},
"quotesUpdated": {"$exists": True},
"outlet": {"$in": args["outlets"]},
"publishedAt": {
"$gte": args["be... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_top_five_countries():\n countries=country_populations.split('\\n')\n top_5=[]\n count=0\n for country in countries:\n if count<6:\n data= country.split('\\t')\n top_5.append(data[1])\n count+=1\n top_5.remove('Country')\n return top_5",
"def get_t... | [
"0.61172545",
"0.59121114",
"0.5909458",
"0.5758684",
"0.57050043",
"0.5610208",
"0.557011",
"0.556409",
"0.55274975",
"0.5517988",
"0.5496929",
"0.54120415",
"0.5354707",
"0.53357583",
"0.5312174",
"0.5304028",
"0.52824086",
"0.5277953",
"0.52743703",
"0.5156685",
"0.5156685... | 0.61862856 | 0 |
Returns the names of the topN male sources (i.e. people quoted) If sorted in ascending order, the returned values represent the bottomN male sources. | def top_sources_male(args: Dict[str, Any]) -> List[object]:
query = [
{
"$match": {
"body": {"$ne": ""},
"quotesUpdated": {"$exists": True},
"outlet": {"$in": args["outlets"]},
"publishedAt": {
"$gte": args["begi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_top_five_countries():\n countries=country_populations.split('\\n')\n top_5=[]\n count=0\n for country in countries:\n if count<6:\n data= country.split('\\t')\n top_5.append(data[1])\n count+=1\n top_5.remove('Country')\n return top_5",
"def top_s... | [
"0.61076355",
"0.60428524",
"0.5827024",
"0.5753119",
"0.56296337",
"0.5583178",
"0.5564095",
"0.5548946",
"0.5536436",
"0.5528105",
"0.5505326",
"0.5449902",
"0.5427936",
"0.5384758",
"0.5322544",
"0.52708346",
"0.5269185",
"0.52411515",
"0.5210623",
"0.5191965",
"0.51891917... | 0.6174725 | 0 |
Returns the names of the topN unknown sources (i.e. people quoted) If sorted in ascending order, the returned values represent the bottomN unknown sources. This function is useful to identify if the NER module is wrongly identifying nonhuman entities for gender recognition. | def top_sources_unknown(args: Dict[str, Any]) -> List[object]:
query = [
{
"$match": {
"body": {"$ne": ""},
"quotesUpdated": {"$exists": True},
"outlet": {"$in": args["outlets"]},
"publishedAt": {
"$gte": args["b... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_most_mentioned_domain_names(self, n: int = 15) -> list:\n rex = re.compile(r'https?://[^/]+')\n c = Counter()\n\n for entry in self.entries:\n domains = set(re.findall(rex, entry.summary))\n for domain in domains:\n if domain not in IGNORE_DOMAINS:\... | [
"0.5438144",
"0.53108513",
"0.5292486",
"0.51422256",
"0.50795126",
"0.50723386",
"0.5067788",
"0.5062302",
"0.50510025",
"0.50035435",
"0.49705988",
"0.49468875",
"0.4936847",
"0.49250895",
"0.49103707",
"0.49024624",
"0.4894621",
"0.48907855",
"0.48807895",
"0.48807895",
"0... | 0.5611983 | 0 |
Returns the total number of male, female and unknown sources for all articles written by female authors only, grouped by outlet. | def female_author_sources(args: Dict[str, Any]) -> List[object]:
query = [
{
"$match": {
"body": {"$ne": ""},
"quotesUpdated": {"$exists": True},
"outlet": {"$in": args["outlets"]},
"publishedAt": {
"$gte": args[... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def male_author_sources(args: Dict[str, Any]) -> List[object]:\n query = [\n {\n \"$match\": {\n \"body\": {\"$ne\": \"\"},\n \"quotesUpdated\": {\"$exists\": True},\n \"outlet\": {\"$in\": args[\"outlets\"]},\n \"publishedAt\": {\n ... | [
"0.63028884",
"0.6067728",
"0.5979208",
"0.5923935",
"0.563917",
"0.56347656",
"0.5618972",
"0.55839",
"0.5571018",
"0.5537448",
"0.5448501",
"0.543584",
"0.5417854",
"0.5402827",
"0.53901386",
"0.5271362",
"0.5158223",
"0.51473176",
"0.5140698",
"0.51267785",
"0.51085174",
... | 0.6584573 | 0 |
Returns the total number of male, female and unknown sources for all articles written by male authors only, grouped by outlet. | def male_author_sources(args: Dict[str, Any]) -> List[object]:
query = [
{
"$match": {
"body": {"$ne": ""},
"quotesUpdated": {"$exists": True},
"outlet": {"$in": args["outlets"]},
"publishedAt": {
"$gte": args["b... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def female_author_sources(args: Dict[str, Any]) -> List[object]:\n query = [\n {\n \"$match\": {\n \"body\": {\"$ne\": \"\"},\n \"quotesUpdated\": {\"$exists\": True},\n \"outlet\": {\"$in\": args[\"outlets\"]},\n \"publishedAt\": {\n... | [
"0.65447915",
"0.6158866",
"0.6048317",
"0.6032611",
"0.5955391",
"0.59325594",
"0.584644",
"0.5783226",
"0.5729507",
"0.56834257",
"0.56163013",
"0.5553626",
"0.5549774",
"0.55377823",
"0.53980654",
"0.53967756",
"0.5341202",
"0.53187984",
"0.5308738",
"0.5274333",
"0.527414... | 0.6587021 | 0 |
Returns the daily counts for articles published by each outlet between two specified dates | def daily_article_counts(args: Dict[str, Any]) -> List[object]:
query = [
{
"$match": {
"outlet": {"$in": args["outlets"]},
"publishedAt": {
"$gte": args["begin_date"],
"$lt": args["end_date"] + timedelta(days=1),
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def outlet_stats(args: Dict[str, Any]) -> List[object]:\n query = [\n {\n \"$match\": {\n \"body\": {\"$ne\": \"\"},\n \"quotesUpdated\": {\"$exists\": True},\n \"outlet\": {\"$in\": args[\"outlets\"]},\n \"publishedAt\": {\n ... | [
"0.6289571",
"0.615072",
"0.6117011",
"0.603978",
"0.58786905",
"0.5747146",
"0.5680999",
"0.5617395",
"0.56029195",
"0.55829245",
"0.5579136",
"0.5559607",
"0.5551197",
"0.5544807",
"0.5519936",
"0.5508556",
"0.546817",
"0.54621863",
"0.53908515",
"0.5376911",
"0.53611594",
... | 0.8119425 | 0 |
Prints exception and details in human readable form. You can specify IO stream object in `output` parameter. By default text is printed to standard output. | def print_exception(self, output=None):
if not output:
output = sys.stderr
text = u"stream failed. reason: %s\n" % self.message
text += u"exception: %s: \n" % self.exception.__class__.__name__
text += u"node: %s\n" % self.node
try:
text += u... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _print_exception(self, s, e):\n \n # Output exception message\n sys.stdout.write(\"\\n{0}: {1} \\n\\n\".format(s, e))\n \n if self.model.debug:\n with open(self.logfile,'a') as f:\n f.write(\"\\n{0}: {1} \\n\\n\".format(s, e))",
"def print_exceptio... | [
"0.62906975",
"0.6251691",
"0.62405336",
"0.6206749",
"0.6202872",
"0.6147127",
"0.61255515",
"0.60808784",
"0.60314536",
"0.59662056",
"0.5931189",
"0.59250456",
"0.5917284",
"0.59140176",
"0.59088075",
"0.5900321",
"0.5894885",
"0.58672184",
"0.5854904",
"0.5840295",
"0.581... | 0.7543073 | 0 |
Creates a probeset which acts as multiprobe. `probes` should be a list of probes. | def __init__(self, probes=None):
super(ProbeSet, self).__init__()
self.probes = probes | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_probes(base_path: Path, config: SectionProxy) -> List[Probe]:\n probes = []\n probes_path = resolve_path(base_path, config['probes_file'])\n probes_config = ConfigParser()\n found_files = probes_config.read(probes_path)\n if len(found_files) == 0:\n raise ConfigFileNotFound(\n ... | [
"0.56823057",
"0.5577413",
"0.5493009",
"0.5411468",
"0.52715063",
"0.5165909",
"0.49353126",
"0.48462152",
"0.47813573",
"0.45911404",
"0.45671707",
"0.45637053",
"0.45545438",
"0.45459583",
"0.45090252",
"0.44826382",
"0.4462405",
"0.44391167",
"0.43170765",
"0.42972097",
"... | 0.6866162 | 0 |
Probe the value in all of the probes. | def probe(self, value):
for probe in self.probes:
probe.probe(value) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def probe(self):",
"def probe(self):\n return",
"def probes(self):\r\n return probes.Probes(self)",
"def probe(self) -> dict:\n result = {}\n for name, func in self._probes.items():\n result[name] = func()\n return result",
"def set_probe(self, probe: float = 1... | [
"0.66325283",
"0.6366462",
"0.61691785",
"0.6069871",
"0.57456434",
"0.5673926",
"0.558257",
"0.5505177",
"0.52197695",
"0.52027285",
"0.52027285",
"0.52027285",
"0.51894253",
"0.513183",
"0.5115917",
"0.5115917",
"0.5115266",
"0.5011102",
"0.49694473",
"0.4906507",
"0.480552... | 0.8462102 | 0 |
Abstrac class for data sources. | def __init__(self):
super(DataSource, self).__init__() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def data_source(self, data_source):\n\n self._data_source = data_source",
"def init_sources(self):\n\n columns = ['some', 'column', 'headers']\n self.columns = columns\n\n self.data_source = ColumnDataSource(data=dict(zip(columns, []*len(columns))))",
"def data_source(self, **kwargs):\n... | [
"0.701723",
"0.67206526",
"0.6619245",
"0.6619245",
"0.6619245",
"0.6513528",
"0.64356047",
"0.6419896",
"0.6349979",
"0.63332766",
"0.6320385",
"0.6317874",
"0.63037527",
"0.62717515",
"0.6267693",
"0.62227976",
"0.61938244",
"0.6177788",
"0.60715955",
"0.6035828",
"0.602544... | 0.7559021 | 0 |
Read field descriptions from data source. You should use this for datasets that do not provide metadata directly, such as CSV files, document bases databases or directories with structured files. Does nothing in relational databases, as fields are represented by table columns and table metadata can obtained from databa... | def read_fields(self, limit = 0, collapse = False):
keys = []
probes = {}
def probe_record(record, parent = None):
for key, value in record.items():
full_key = parent + "." + key if parent else key
if self.expand and type(value) == dict:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_fields_sources_list():\n from pandas import read_csv\n try:\n sources = read_csv(FIELDS_SOURCES_LIST)\n names = read_csv(SOURCES_NAMES_LIST)\n except FileNotFoundError:\n create_fields_sources_list()\n sources = read_csv(FIELDS_SOURCES_LIST)\n names = read_csv(S... | [
"0.574807",
"0.5591403",
"0.5533271",
"0.54910386",
"0.534256",
"0.5339238",
"0.53237236",
"0.53038514",
"0.52398056",
"0.5235906",
"0.52067125",
"0.5196019",
"0.51878726",
"0.5167189",
"0.51464045",
"0.5118895",
"0.51055586",
"0.51055384",
"0.5102298",
"0.5099592",
"0.507946... | 0.5652659 | 1 |
Abstrac class for data targets. | def __init__(self):
super(DataTarget, self).__init__() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, dataset: Dataset, targets_file: str = os.path.join('data', 'targets.pkl')):\n self.dataset = dataset\n with open(targets_file, 'rb') as f:\n target_data = pickle.load(f)\n self.targets = target_data",
"def __init__(self, datapath, fileType='TargetLynx', sop='Gen... | [
"0.6896411",
"0.6206037",
"0.61528915",
"0.6137634",
"0.6076541",
"0.6049195",
"0.60137206",
"0.59384775",
"0.5917785",
"0.5908812",
"0.5888908",
"0.58537924",
"0.58418393",
"0.5836145",
"0.5802555",
"0.57947993",
"0.5794262",
"0.57715225",
"0.5756541",
"0.57526934",
"0.57315... | 0.7761443 | 0 |
Get fields from a table. Field types are normalized to the Brewery data types. Analytical type is set according to a default conversion dictionary. | def fields_from_table(table):
fields = []
for column in table.columns:
field = brewery.metadata.Field(name=column.name)
field.concrete_storage_type = column.type
for conv in _sql_to_brewery_types:
if issubclass(column.type.__class__, conv[0]):
fie... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_fields(self, table):\n fields = list()\n for column in table.columns:\n fields.append({'id': column.name, 'type': str(column.type)})\n return fields",
"def _parse_dtypes(data, table_meta):\n for name, field in table_meta['fields'].items():\n field_type = field['... | [
"0.7448947",
"0.63859844",
"0.6380723",
"0.6318095",
"0.62467355",
"0.6087675",
"0.60488886",
"0.60342807",
"0.5896163",
"0.57827",
"0.5764722",
"0.5717361",
"0.5648926",
"0.5629947",
"0.5598005",
"0.5575235",
"0.555654",
"0.5524569",
"0.55119383",
"0.55036217",
"0.5495978",
... | 0.7548131 | 0 |
Derives a concrete storage type for the field based on field conversion dictionary | def concrete_storage_type(field, type_map={}):
concrete_type = field.concrete_storage_type
if not isinstance(concrete_type, sqlalchemy.types.TypeEngine):
if type_map:
concrete_type = type_map.get(field.storage_type)
if not concrete_type:
concrete_type = concre... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_field(obj):\r\n\r\n\r\n if isinstance(obj, Field):\r\n field = obj\r\n else:\r\n d = { \"storage_type\": \"unknown\" }\r\n\r\n if isinstance(obj, basestring):\r\n d[\"name\"] = obj\r\n elif type(obj) == tuple or type(obj) == list:\r\n d[\"name\"] = obj... | [
"0.69869864",
"0.68262047",
"0.6369962",
"0.6199096",
"0.61867684",
"0.6157527",
"0.61219966",
"0.6100469",
"0.6078638",
"0.6066346",
"0.6054696",
"0.60377914",
"0.6002127",
"0.5978446",
"0.59775907",
"0.5968036",
"0.5954878",
"0.588861",
"0.5781072",
"0.5752546",
"0.5749853"... | 0.7401502 | 0 |
Initialize source stream. If the fields are not initialized, then they are read from the table. | def initialize(self):
if not self.context:
self.context = SQLContext(self.url, self.connection, self.schema)
if self.table is None:
self.table = self.context.table(self.table_name)
if not self.fields:
self.read_fields()
self.field_names = self.f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _init_table(self, table: \"Table\"):\n if not self.columns:\n self.columns = table.columns\n self._data = table.data",
"def __post_init__(self):\n # Only do this if source_data already exists (not during its own initialization)\n if \"SOURCE_DATA\" in globals():\n ... | [
"0.6567911",
"0.64584345",
"0.64303744",
"0.62981564",
"0.6155012",
"0.61321723",
"0.6029323",
"0.59548885",
"0.59049594",
"0.5894522",
"0.58836263",
"0.5859183",
"0.58539855",
"0.58505374",
"0.58505374",
"0.58505374",
"0.58505374",
"0.58505374",
"0.58505374",
"0.58505374",
"... | 0.6926253 | 0 |
Get single field statistics. Create if does not exist | def _field_stat(self, field):
if not field in self.stats:
stat = dq.FieldStatistics(field, distinct_threshold = self.distinct_threshold)
self.stats[field] = stat
else:
stat = self.stats[field]
return stat | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_statistics(self, data, field):\n statistics = super(NumberField, self).get_statistics(data, field)\n numeric_statistics = NumericStatistics(data)\n statistics.update(numeric_statistics.getSerializedData())\n return statistics",
"def field():\n data = request.get_json()\n ... | [
"0.58849454",
"0.56622",
"0.5446068",
"0.53929067",
"0.5386856",
"0.5380485",
"0.53466165",
"0.5260551",
"0.5220686",
"0.52184",
"0.51879865",
"0.5187592",
"0.5151635",
"0.51212466",
"0.51178455",
"0.5096719",
"0.5086637",
"0.50830716",
"0.5081789",
"0.50643116",
"0.5033314",... | 0.77910864 | 0 |
Convert Excel cell into value of a python type (from Swiss XlsReader.cell_to_python) | def _cell_value(self, cell):
# annoying need book argument for datemode
# info on types: http://www.lexicon.net/sjmachin/xlrd.html#xlrd.Cell-class
if cell.ctype == xlrd.XL_CELL_NUMBER:
return float(cell.value)
elif cell.ctype == xlrd.XL_CELL_DATE:
# TODO: ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cell_value_converter(cell, *args, **kwds):\n return cell.value",
"def cell_to_value(cell: xlrd.sheet.Cell, datemode: int):\n if cell.ctype in (xlrd.XL_CELL_EMPTY, xlrd.XL_CELL_BLANK):\n return ''\n elif cell.ctype == xlrd.XL_CELL_TEXT:\n return cell.value.strip()\n ... | [
"0.7249213",
"0.6936346",
"0.65123373",
"0.60368603",
"0.6010351",
"0.59544545",
"0.5816567",
"0.5776723",
"0.56016874",
"0.5587784",
"0.5578082",
"0.5562387",
"0.5554144",
"0.55176824",
"0.5473793",
"0.5473606",
"0.54652697",
"0.54652697",
"0.5377445",
"0.5328113",
"0.532464... | 0.71617 | 1 |
Generates unique name for a node | def _generate_node_name(self):
while 1:
name = "node" + str(self._name_sequence)
if name not in self.nodes.keys():
break
self._name_sequence += 1
return name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _auto_name(self):\n return \"node_\"+str(self._id)",
"def _generate_node_name(labels: dict, node_suffix: str) -> str:\n name_label = labels[TAG_RAY_NODE_NAME]\n assert len(name_label) <= (INSTANCE_NAME_MAX_LEN - INSTANCE_NAME_UUID_LEN - 1), (\n name_label,\n len(name_label),\n )... | [
"0.8495822",
"0.79702437",
"0.78181773",
"0.78113025",
"0.7744661",
"0.7536287",
"0.73967725",
"0.7288656",
"0.72870237",
"0.7182658",
"0.71326786",
"0.7110013",
"0.7080412",
"0.7079248",
"0.7072927",
"0.7049974",
"0.7044005",
"0.7023917",
"0.7008675",
"0.6926937",
"0.6914010... | 0.87746894 | 0 |
Add a `node` into the stream. Does not allow to add named node if node with given name already exists. Generate node name if not provided. Node name is generated as ``node`` + sequence number. Uniqueness is tested. | def add(self, node, name=None):
name = name or self._generate_node_name()
if name in self.nodes:
raise KeyError("Node with name %s already exists" % name)
self.nodes[name] = node
return name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_node(self, node):\n \n if node in self.node_set:\n return \n \n self.num_node = self.num_node + 1\n self.node_set.add(node)\n self.prefix[node] = {}\n self.suffix[node] = {}",
"def add_node(self, name, node):\n self.nodes.setdefault(name,... | [
"0.7261664",
"0.69256246",
"0.67104006",
"0.670441",
"0.6656498",
"0.6646234",
"0.66098297",
"0.66058105",
"0.65808105",
"0.65784144",
"0.6569567",
"0.65557235",
"0.6535508",
"0.653294",
"0.6526756",
"0.65054995",
"0.64960676",
"0.64960676",
"0.6494902",
"0.6482181",
"0.64649... | 0.75492877 | 0 |
Sets a name for `node`. Raises an exception if the `node` is not part of the stream, if `name` is empty or there is already node with the same name. | def rename_node(self, node, name):
if not name:
raise ValueError("No node name provided for rename")
if name in self.nodes():
raise ValueError("Node with name '%s' already exists" % name)
old_name = self.node_name(node)
del self.nodes[old_name]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_name(self, name):\r\n self.stream.set_node_name(self.node, name)",
"def setName(self, name):\n libxml2mod.xmlNodeSetName(self._o, name)",
"def node_name(self, value: str):\n self._properties[\"nodeName\"] = value",
"def set_name(self, name):\n self.name = name # overwrite... | [
"0.83490866",
"0.7088931",
"0.6897682",
"0.6853107",
"0.6853107",
"0.6769459",
"0.67315155",
"0.6702388",
"0.6701894",
"0.668318",
"0.6648065",
"0.6642689",
"0.6640702",
"0.6640702",
"0.6640702",
"0.6640702",
"0.6634831",
"0.6628643",
"0.66260713",
"0.6609876",
"0.65992534",
... | 0.7324265 | 1 |
Connects source node and target node. Nodes can be provided as objects or names. | def connect(self, source, target):
connection = (self.coalesce_node(source), self.coalesce_node(target))
self.connections.add(connection) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def connect(src, target, reftype):",
"def connect(self, node1, node2):\n self.neighbour1 = node1\n self.neighbour2 = node2",
"def connect_nodes(self, src, tgt, locked=False):\n if not src.add_hook(tgt, 'inhook'):\n return False\n tgt.add_hook(src, 'outhook')\n tgt.... | [
"0.7269944",
"0.70790887",
"0.67458445",
"0.6719491",
"0.66222644",
"0.6585517",
"0.6552827",
"0.6541949",
"0.6534172",
"0.63189816",
"0.6278052",
"0.62138635",
"0.61803526",
"0.6146746",
"0.6121839",
"0.609566",
"0.60728294",
"0.6057733",
"0.60307",
"0.60224915",
"0.6019208"... | 0.8045065 | 0 |
Remove connection between source and target nodes, if exists. | def remove_connection(self, source, target):
connection = (self.coalesce_node(source), self.coalesce_node(target))
self.connections.discard(connection) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def removeConnection(tagA, tagB): #@NoSelf",
"def remove_nodes_connections(self, nodes):\n nodes = ensure_list(nodes)\n for nd in nodes:\n for nd_in in self.successors[nd.name]:\n self.predecessors[nd_in.name].remove(nd)\n self.edges.remove((nd, nd_in))\n ... | [
"0.6762276",
"0.67581093",
"0.6644162",
"0.66242313",
"0.6555694",
"0.6522651",
"0.6485569",
"0.64436626",
"0.64415437",
"0.63333553",
"0.6331394",
"0.63294",
"0.6292633",
"0.6252986",
"0.61544985",
"0.6116792",
"0.6114218",
"0.6095088",
"0.60817045",
"0.60571676",
"0.6050193... | 0.85355616 | 0 |
Expand record represented as dict object by treating keys as key paths separated by | def expand_record(record, separator = '.'):
result = {}
for key, value in record.items():
current = result
path = key.split(separator)
for part in path[:-1]:
if part not in current:
current[part] = {}
current = current[part]
curren... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def expand_objects(record):\n new_record = copy.deepcopy(record)\n for key, value in record.items():\n parts = key.split(\".\")\n if len(parts) > 1:\n parts.reverse()\n current = {parts[0]: value}\n for part in parts[1:]:\n current = {part: curren... | [
"0.77235836",
"0.6214426",
"0.6204807",
"0.6192491",
"0.61800855",
"0.606586",
"0.6001238",
"0.5989735",
"0.5945751",
"0.5884399",
"0.58728135",
"0.5796908",
"0.5785131",
"0.57662815",
"0.5703317",
"0.56907934",
"0.5617995",
"0.56040907",
"0.5504228",
"0.54999644",
"0.54974",... | 0.8102187 | 0 |
Converts `obj` to a field object. `obj` can be ``str``, ``tuple`` | def to_field(obj):
if isinstance(obj, Field):
field = obj
else:
d = { "storage_type": "unknown" }
if isinstance(obj, basestring):
d["name"] = obj
elif type(obj) == tuple or type(obj) == list:
d["name"] = obj[0]
try:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_obj(cls, obj: any) -> Objdict:\n # CASE: list. Convert each item in the list.\n if isinstance(obj, list):\n value = [cls.from_obj(item) for item in obj]\n\n # CASE: dictionary. Convert each item in the dictionary.\n elif isinstance(obj, dict):\n d = {k: cl... | [
"0.6367572",
"0.62205976",
"0.6188497",
"0.61414284",
"0.60535365",
"0.59802586",
"0.59760207",
"0.59645313",
"0.59378475",
"0.58161896",
"0.58113116",
"0.5773553",
"0.57665277",
"0.5729413",
"0.57289016",
"0.5696793",
"0.5690984",
"0.5655159",
"0.56360304",
"0.56264126",
"0.... | 0.76156193 | 0 |
Appends a field to the list. This method requires `field` to be instance of `Field` | def append(self, field):
field = to_field(field)
self._fields.append(field)
self._field_dict[field.name] = field
self._field_names.append(field.name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_field(self, field):\n if field.name in self.fields:\n print(\"WARNING: Field {0} already in model {1}\"\n .format(field.name, self.table_name))\n return\n\n self.fields[field.name] = field\n self.sorted_fields.append(field)\n self.sorted_fi... | [
"0.73584527",
"0.73173344",
"0.73173344",
"0.72460747",
"0.7038897",
"0.69933426",
"0.67837954",
"0.660281",
"0.6547732",
"0.6257247",
"0.60159636",
"0.5994535",
"0.59549665",
"0.59549665",
"0.59549665",
"0.59048706",
"0.5901957",
"0.5901957",
"0.5894635",
"0.5832519",
"0.582... | 0.79776734 | 0 |
Return a tuple with indexes of fields from ``fields`` in a data row. Fields should be a list of ``Field`` objects or strings. This method is useful when it is more desirable to process data as rows (arrays), not as dictionaries, for example for performance purposes. | def indexes(self, fields):
indexes = [self.index(field) for field in fields]
return tuple(indexes) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extractFields(deerfootRDDRecord):\n fieldsList = deerfootRDDRecord.split(\",\")\n return (fieldsList[0], [fieldsList[1], fieldsList[15], fieldsList[46]])",
"def extract(self, *fields):\n if len(fields) == 0:\n raise ValueError(\"no field(s) given for extraction\")\n elif len(fi... | [
"0.61811095",
"0.6051826",
"0.60384977",
"0.6001089",
"0.59001076",
"0.5739948",
"0.56098425",
"0.5493705",
"0.5472491",
"0.54576796",
"0.54421836",
"0.54421836",
"0.54239964",
"0.5387598",
"0.53843665",
"0.5356989",
"0.5320126",
"0.5304942",
"0.5289367",
"0.52688307",
"0.524... | 0.71579444 | 0 |
Return index of a field | def index(self, field):
try:
index = self._field_names.index(unicode(field))
except ValueError:
raise KeyError("Field list has no field with name '%s'" % unicode(field))
return index | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def field_index(self, field):\r\n idx = self.fields.index(field)\r\n if self.index:\r\n idx = self.index[idx]\r\n return idx",
"def convert_field_name_to_indexes(field_name):\n rows = '87654321'\n columns = 'abcdefgh'\n row_index = column_index = None\n\n row_name = fi... | [
"0.88422716",
"0.6718861",
"0.66167814",
"0.64797366",
"0.64267",
"0.6413878",
"0.631809",
"0.61919314",
"0.61846656",
"0.6132731",
"0.6104587",
"0.608516",
"0.6048858",
"0.6009871",
"0.59791565",
"0.5953976",
"0.59410733",
"0.59244543",
"0.5886749",
"0.5883558",
"0.5883102",... | 0.78399575 | 1 |
Return a tuple with fields. `names` specifies which fields are returned. When names is ``None`` all fields are returned. | def fields(self, names = None):
if not names:
return self._fields
fields = [self._field_dict[name] for name in names]
return fields | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_namedtuple(name, field_names, values=None):\n if values is None:\n values = range(len(field_names))\n field_names = [f.replace(' ', '_') for f in field_names]\n return _namedtuple(name, field_names)(*values)",
"def field_names(cls) -> tuple:\n return tuple((field.name for field in ... | [
"0.6950016",
"0.67159724",
"0.66012585",
"0.59431046",
"0.58848846",
"0.577644",
"0.5722483",
"0.57022977",
"0.5617106",
"0.56001776",
"0.55626434",
"0.55010647",
"0.55008906",
"0.54608077",
"0.5446141",
"0.54451907",
"0.54388106",
"0.5402777",
"0.53886825",
"0.53750217",
"0.... | 0.75947446 | 0 |
Retype fields according to the dictionary. Dictionary contains field names as keys and field attribute dictionary as values. | def retype(self, dictionary):
for name, retype in dictionary.items():
field = self._field_dict[name]
for key, value in retype.items():
if key in _valid_retype_attributes:
field.__setattr__(key, value)
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def map_field_name_to_attribute() -> typing.Dict:\n return {\n \"tag\": \"tag\",\n \"contact\": \"contact\",\n }",
"def map_to_db_fields(field_attrs):\n attr_keys = field_attrs.keys()\n field_name = field_attrs[attr_keys.pop(attr_keys.index('name'))]\n field_type_raw ... | [
"0.6638699",
"0.6297308",
"0.62741715",
"0.61012524",
"0.60796726",
"0.6069095",
"0.6063906",
"0.60093445",
"0.5871374",
"0.5849077",
"0.58450663",
"0.5843713",
"0.5837479",
"0.58280677",
"0.58179206",
"0.5793641",
"0.5781531",
"0.5733772",
"0.5708058",
"0.57070625",
"0.57049... | 0.66592646 | 0 |
Creates a field map. `rename` is a dictionary where keys are input field names and values are output field names. `drop` is list of field names that will be dropped from the stream. If `keep` is used, then all fields are dropped except those specified in `keep` list. | def __init__(self, rename = None, drop = None, keep=None):
if drop and keep:
raise Exception('Configuration error in FieldMap: you cant specify both keep and drop options.')
super(FieldMap, self).__init__()
if rename:
self.rename = rename
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rename_fields(r, rename_map):\n new_record = {}\n for f in r.keys():\n if f in rename_map.keys():\n new_record[rename_map[f]] = r[f]\n else:\n new_key = f.lower().replace(' ', '_')\n new_record[new_key] = r[f]\n return new_... | [
"0.5862681",
"0.55686843",
"0.5299097",
"0.52944267",
"0.524568",
"0.5228895",
"0.5196348",
"0.5167842",
"0.5154742",
"0.5143839",
"0.49291566",
"0.48727214",
"0.47858247",
"0.4741838",
"0.47405508",
"0.47203442",
"0.47053137",
"0.45981687",
"0.45894343",
"0.4580538",
"0.4570... | 0.6910661 | 0 |
Returns selectors of fields to be used by `itertools.compress()`. This is the preferred way of field filtering. | def field_selectors(self, fields):
selectors = []
for field in fields:
flag = (self.drop and field.name not in self.drop) \
or (self.keep and field.name in self.keep) \
or not (self.keep or self.drop)
selectors.append(flag)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def selectors(self, fields = None):\r\n\r\n sel_names = [str(field) for field in fields]\r\n\r\n selectors = [unicode(name) in sel_names for name in self.names()]\r\n return selectors",
"def tableSelFieldsFilter(tdata, columns):\n\tif areAllFieldsIncluded(tdata[0], columns):\n\t\tntdata = td... | [
"0.71675444",
"0.6121632",
"0.6081692",
"0.59284747",
"0.568655",
"0.56459606",
"0.5645398",
"0.5632499",
"0.5608243",
"0.5601196",
"0.5568667",
"0.5538119",
"0.5488354",
"0.5479283",
"0.5446744",
"0.54406416",
"0.5429593",
"0.5420711",
"0.54198086",
"0.5416203",
"0.54044914"... | 0.73484904 | 0 |
Coalesces `value` to given storage `type`. `empty_values` is a dictionary where keys are storage type names and values are values to be used as empty value replacements. | def coalesce_value(value, storage_type, empty_values=None, strip=False):
if empty_values is None:
empty_values={}
if storage_type in ["string", "text"]:
if strip:
value = value.strip()
elif value:
value = unicode(value)
if value == "" or value is... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def action_store(raw_val):\n if raw_val not in EMPTY_VALUES:\n return auto_type_convert(raw_val)\n else:\n return raw_val",
"def check_integrity(dict):\n if (dict['type'] == 'string') and (dict['value'] == None or dict['value'] == ''):\n dict['value'] = '\"\"'",
"def empty(cls, ke... | [
"0.58325046",
"0.521288",
"0.49877736",
"0.4948348",
"0.48418808",
"0.4832019",
"0.4825413",
"0.47597077",
"0.47303224",
"0.47151342",
"0.47076306",
"0.4702731",
"0.46962714",
"0.46962714",
"0.46882483",
"0.46549195",
"0.4623449",
"0.4623449",
"0.4623449",
"0.4623449",
"0.462... | 0.65644866 | 0 |
Creates a node of type specified by `identifier`. Options are passed to the node initializer | def create_node(identifier, *args, **kwargs):
d = node_dictionary()
node_class = d[identifier]
node = node_class(*args, **kwargs)
return node | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_node(name, node_type):\n if node_type in NODE_REGISTRY:\n return Node(name, NODE_REGISTRY[node_type])\n raise TypeError('The specified node type \\'%s\\' could not be found within imagegen.' % node_type)",
"def _create_node(\n self,\n name,\n ):\n pass",
... | [
"0.6298921",
"0.5776966",
"0.5754006",
"0.5657194",
"0.56104183",
"0.5609372",
"0.55108285",
"0.53705436",
"0.5338448",
"0.53078574",
"0.5302105",
"0.52723897",
"0.52688146",
"0.52115166",
"0.52099746",
"0.5203637",
"0.5183259",
"0.5177779",
"0.51555586",
"0.50895774",
"0.505... | 0.8164702 | 0 |
Return a dictionary containing node name as key and node class as value. This will be depreciated soon in favour of | def node_dictionary():
classes = node_subclasses(Node)
dictionary = {}
for c in classes:
try:
name = c.identifier()
dictionary[name] = c
except AttributeError:
# If node does not provide identifier, we consider it to be
# private o... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def node_catalogue():\r\n\r\n classes = node_subclasses(Node)\r\n\r\n catalogue = {}\r\n\r\n for node_class in classes:\r\n try:\r\n name = node_class.identifier()\r\n except AttributeError:\r\n # If node does not provide identifier, we consider it to be\r\n ... | [
"0.7518577",
"0.64790714",
"0.64441085",
"0.6396249",
"0.6357954",
"0.6273917",
"0.6252944",
"0.6094156",
"0.6071588",
"0.6064794",
"0.60554457",
"0.6027468",
"0.6006948",
"0.59741557",
"0.5917332",
"0.5897811",
"0.58968717",
"0.5875732",
"0.58470047",
"0.583958",
"0.58379084... | 0.8277194 | 0 |
Get all subclasses of node. | def node_subclasses(root, abstract = False):
classes = []
for c in utils.subclass_iterator(root):
try:
info = get_node_info(c)
node_type = info.get("type")
if node_type != "abstract":
classes.append(c)
except AttributeError:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def descendants(cls):\n return cls.__subclasses__() + \\\n [g for s in cls.__subclasses__() for g in s.descendants()]",
"def get_subclasses(self, klass: TypeInfo) -> OrderedSet[TypeInfo]:\n if klass not in self._graph:\n return OrderedSet([klass])\n result: OrderedSet[T... | [
"0.7140406",
"0.6957714",
"0.6886573",
"0.6848165",
"0.68365824",
"0.6833044",
"0.6756908",
"0.67236257",
"0.66959816",
"0.66798323",
"0.6634815",
"0.6603208",
"0.65786904",
"0.65046304",
"0.64756143",
"0.64746326",
"0.6457086",
"0.6451578",
"0.6394505",
"0.6363579",
"0.63500... | 0.7421831 | 0 |
Push a `value` into rank `key` in the stack. If stack is full, remove the highestkey element. | def push(self, key, value):
if len(self.heap)<self.depth:
heapq.heappush(self.heap, key)
self.elements[key] = value
else:
oldkey = heapq.heappushpop(self.heap, key)
self.elements[key] = value
del self.elements[oldkey] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def push(self, priority, key):\n index = len(self.__heap)\n self.__position[key] = index\n self.__heap.append([priority, key])\n self.__bubble_up(index)",
"def push(value):\n _get_stack().append(value)\n return value",
"def stack_push(self, key, value):\n task = Task.cu... | [
"0.66849923",
"0.6634082",
"0.6583867",
"0.6583773",
"0.6389176",
"0.63875455",
"0.63447315",
"0.63144517",
"0.624918",
"0.6230208",
"0.6230208",
"0.6230208",
"0.62131965",
"0.6210933",
"0.6181782",
"0.61637515",
"0.6156839",
"0.61547214",
"0.61363983",
"0.61363983",
"0.61276... | 0.7211073 | 0 |
Main method for running the node code. Subclasses should implement this method. | def run(self):
raise NotImplementedError("Subclasses of Node should implement the run() method") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main(self) -> None:\n pass",
"def run(self):\n self.node_id = CONFIG.node_id\n self.running = Event()\n if not CONFIG.master_pub or not CONFIG.master_repl:\n print colors.yellow(\"Master IP:port is not set in config file (%s)\"\n % CONFIG.... | [
"0.71127063",
"0.7055299",
"0.7004291",
"0.6951679",
"0.68885565",
"0.6849409",
"0.67891467",
"0.6762363",
"0.6762363",
"0.6762363",
"0.6762363",
"0.6761332",
"0.6734421",
"0.6734421",
"0.6734421",
"0.6734421",
"0.6734421",
"0.6734421",
"0.6734421",
"0.6734421",
"0.6734421",
... | 0.73212767 | 0 |
Return single node imput if exists. Convenience property for nodes which process only one input. Raises exception if there are no inputs or are more than one imput. | def input(self):
if len(self.inputs) == 1:
return self.inputs[0]
else:
raise Exception("Single input requested. Node has none or more than one input (%d)."
% len(self.inputs)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_input_node(model):\n iter = model.GetNodes()\n while iter.IsValid():\n node = iter.Get()\n if \"InputNode\" in node.GetRuntimeTypeName():\n return node\n iter.Next()\n return None",
"def single_input_node(self, port: int):\n input_nodes = self.input_nodes(p... | [
"0.6151729",
"0.5955724",
"0.5748265",
"0.5743951",
"0.53562725",
"0.5282334",
"0.52456343",
"0.51267284",
"0.5086693",
"0.49852207",
"0.4975962",
"0.49515104",
"0.49140608",
"0.49103492",
"0.49075767",
"0.48992518",
"0.48833162",
"0.48802078",
"0.4870505",
"0.48196357",
"0.4... | 0.6596412 | 0 |
Remove all retype information for field `name` | def reset_type(self, name):
del self._retype_dictionary[name] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_type(self, name):\n del self.types[name]",
"def del_typecheck(self, name: str):\n try:\n del self.__custom_types[name]\n except KeyError:\n pass",
"def removeType(self, name):\n delattr(self, name)\n try:\n del self._type_names[name... | [
"0.72864145",
"0.7192131",
"0.691836",
"0.687526",
"0.67571354",
"0.6357059",
"0.6221183",
"0.618953",
"0.61195374",
"0.60606825",
"0.59978074",
"0.594721",
"0.5918989",
"0.59160805",
"0.587979",
"0.5868728",
"0.5825539",
"0.58252525",
"0.57835454",
"0.57558835",
"0.57390386"... | 0.7932862 | 0 |
Put row into all output pipes. Raises `NodeFinished` exception when node's target nodes are not receiving data anymore. In most cases this exception might be ignored, as it is handled in the node thread wrapper. If you want to perform necessary cleanup in the `run()` method before exiting, you should handle this except... | def put(self, obj):
active_outputs = 0
for output in self.outputs:
if not output.closed():
output.put(obj)
active_outputs += 1
# This is not very safe, as run() might not expect it
if not active_outputs:
raise NodeFinished | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run(self):\r\n for pipe in self.inputs:\r\n for row in pipe.rows():\r\n self.put(row)",
"def run(self):\r\n\r\n label = node_label(self.node)\r\n self.logger.debug(\"%s: start\" % label)\r\n try:\r\n self.node.run()\r\n except NodeFinish... | [
"0.6481702",
"0.5708942",
"0.5306772",
"0.5198733",
"0.5191754",
"0.49823996",
"0.49682274",
"0.49448922",
"0.4925235",
"0.49159628",
"0.48515922",
"0.47902027",
"0.47844213",
"0.47796345",
"0.47772634",
"0.475717",
"0.46879926",
"0.4686693",
"0.4680408",
"0.46567523",
"0.464... | 0.5994392 | 1 |
Put record into all output pipes. Convenience method. Not recommended to be used. | def put_record(self, obj):
for output in self.outputs:
output.put_record(obj) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run(self):\r\n for pipe in self.inputs:\r\n for row in pipe.rows():\r\n self.put(row)",
"def output_to_pipe(pipe_in):\n os.dup2(pipe_in, 1) # stdout\n # os.dup2(pipe_in, 2) # stderr",
"def _redirect_output(self, statement):\n if statement.parsed.pipeTo:\n ... | [
"0.61213005",
"0.57475716",
"0.5589168",
"0.55723286",
"0.55597144",
"0.55597144",
"0.5523319",
"0.54203606",
"0.5412293",
"0.54047567",
"0.53350186",
"0.53147745",
"0.5309683",
"0.53073287",
"0.5282204",
"0.5254947",
"0.5243214",
"0.5234403",
"0.5232203",
"0.51854795",
"0.51... | 0.6897131 | 0 |
Return fields from input pipe, if there is one and only one input pipe. | def input_fields(self):
return self.input.fields | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def output_fields(self):\r\n if not len(self.inputs) == 1:\r\n raise ValueError(\"Can not get default list of output fields: node has more than one input\"\r\n \" or no input is provided. Subclasses should override this method\")\r\n\r\n if not self.input.fields... | [
"0.63556445",
"0.55331165",
"0.55220664",
"0.55100864",
"0.53098017",
"0.5223637",
"0.5223637",
"0.5223637",
"0.5215609",
"0.5214126",
"0.5176225",
"0.5149865",
"0.5132685",
"0.51181376",
"0.51016253",
"0.5084988",
"0.50791216",
"0.50791216",
"0.5059624",
"0.5044385",
"0.5024... | 0.5838707 | 1 |
Return fields passed to the output by the node. Subclasses should override this method. Default implementation returns same fields as input has, raises exception when there are more inputs or if there is no input connected. | def output_fields(self):
if not len(self.inputs) == 1:
raise ValueError("Can not get default list of output fields: node has more than one input"
" or no input is provided. Subclasses should override this method")
if not self.input.fields:
rais... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def input_fields(self):\r\n return self.input.fields",
"def get_data(self):\n return self._fullInput, self._fullOutput",
"def inputs(self):\n return self._inputs",
"def get_inputs(self):\r\n raise NotImplementedError",
"def get_inputs(self):\r\n raise NotImplementedError",
... | [
"0.7205753",
"0.6450373",
"0.6430596",
"0.64131397",
"0.64131397",
"0.6407265",
"0.6407265",
"0.6407265",
"0.63933927",
"0.63620764",
"0.634084",
"0.6317568",
"0.6317568",
"0.6309495",
"0.629971",
"0.6276949",
"0.624751",
"0.62453175",
"0.6219483",
"0.6219483",
"0.6219483",
... | 0.8261576 | 0 |
Returns an identifier name of the node class. Identifier is used for construction of streams from dictionaries or for any other outofprogram constructions. Node identifier is specified in the `node_info` dictioanry as ``name``. If no explicit identifier is specified, then decamelized | def identifier(cls):
logger = utils.get_logger()
# FIXME: this is temporary warning
info = get_node_info(cls)
ident = None
if info:
ident = info.get("name")
if not ident:
ident = utils.to_identifier(utils.decamelize(cls.__name__))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _generate_node_name(self):\r\n while 1:\r\n name = \"node\" + str(self._name_sequence)\r\n if name not in self.nodes.keys():\r\n break\r\n self._name_sequence += 1\r\n\r\n return name",
"def _auto_name(self):\n return \"node_\"+str(self._id... | [
"0.720475",
"0.7109115",
"0.69905436",
"0.6864503",
"0.67508626",
"0.66256005",
"0.65824854",
"0.6535852",
"0.6410217",
"0.6389824",
"0.6365405",
"0.6337286",
"0.6250073",
"0.6166268",
"0.6068963",
"0.6068963",
"0.6067767",
"0.60515636",
"0.60225874",
"0.6009654",
"0.59937155... | 0.82302177 | 0 |
Creates a node for string stripping. | def __init__(self, fields = None, chars = None):
super(StringStripNode, self).__init__()
self.fields = fields
self.chars = chars | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strip(self) -> String:\n pass",
"def rstrip(self) -> String:\n pass",
"def strip(s):\n parser = StrippingParser( )\n parser.feed(s)\n parser.close( )\n parser.cleanup( )\n return ''.join(parser.result)",
"def lstrip(self) -> String:\n pass",
"def strip(value):\n return value.... | [
"0.6333236",
"0.61538136",
"0.6017034",
"0.59572077",
"0.5842414",
"0.5815026",
"0.58048934",
"0.5781299",
"0.56491125",
"0.55710804",
"0.55240613",
"0.5368304",
"0.536036",
"0.53468174",
"0.5315989",
"0.5271353",
"0.5270803",
"0.5199625",
"0.51990485",
"0.51944214",
"0.51918... | 0.64795625 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.