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 |
|---|---|---|---|---|---|---|
Perform Experiment execution loop while `iteration` < `iterations`. At each iteration, an Experiment will be executed, its results will be logged, and it will be compared to the current best experiment | def _optimization_loop(self, iteration=0):
self.logger.print_optimization_header()
while iteration < self.iterations:
try:
self._execute_experiment()
except RepeatedExperimentError:
# G.debug_(F'Skipping repeated Experiment: {_ex!s}\n')
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_experiment(self):\n\n start_time = time.time()\n\n strategy_instance = None\n if (self.strategy == 'ccegp'):\n strategy_instance = CCEGPStrategy(self)\n else:\n print('strategy unknown:', self.strategy)\n sys.exit(1)\n\n # For each run...\... | [
"0.68496907",
"0.66851443",
"0.6579186",
"0.6548474",
"0.6535283",
"0.6436933",
"0.6390565",
"0.63789713",
"0.63682425",
"0.62813556",
"0.6241212",
"0.6216628",
"0.61787146",
"0.6177963",
"0.61265844",
"0.6097695",
"0.6066338",
"0.6060972",
"0.60489714",
"0.60120654",
"0.6006... | 0.77558535 | 0 |
Perform any cleanup necessary after completion of the optimization loop. Most notably, this handles removal of temporary model files created for Keras optimization | def _clean_up_optimization():
for (root, dirs, files) in walk(TEMP_MODULES_DIR_PATH, topdown=False):
for file in files:
if file.startswith("__temp_"):
remove(f"{root}/{file}")
try:
rmdir(root)
except OSError:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clean_up_temp_files():\n global __tmp_model_dir\n\n if __tmp_model_dir is not None:\n FileUtils.deleteDirectory(__tmp_model_dir)\n __tmp_model_dir = None",
"def finalize(self):\n\t\tself.logger.info(\"Please wait while finalizing the operation.. Thank you\")\n\t\tself.save_checkpoint()\n\... | [
"0.7247562",
"0.6856073",
"0.6820326",
"0.67988986",
"0.67376834",
"0.67234576",
"0.6625386",
"0.6618082",
"0.6608171",
"0.65949863",
"0.65227926",
"0.64979666",
"0.6469358",
"0.6455322",
"0.64471257",
"0.6418023",
"0.6382895",
"0.63763237",
"0.6346993",
"0.63255244",
"0.6325... | 0.7344813 | 0 |
Retrieve the upcoming set of hyperparameters to be searched Returns | def _get_current_hyperparameters(self): | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_hyperparams(self):",
"def get_parameter_search_space() -> List[Dict[str, object]]:\n return get_default_prophet_parameter_search_space()",
"def hyperparameters(self):\n return self._hyperparameters",
"def get_params(self):",
"def get_hyper_params():\n ##############################... | [
"0.7254125",
"0.66889966",
"0.66368717",
"0.63099045",
"0.6307993",
"0.62125057",
"0.62107384",
"0.6199811",
"0.6199811",
"0.6186356",
"0.6183949",
"0.6136021",
"0.6092829",
"0.6085876",
"0.6079455",
"0.60685325",
"0.6049833",
"0.6047266",
"0.6032837",
"0.601193",
"0.59486675... | 0.7578366 | 0 |
Perform housekeeping tasks to prepare for core functionality like validating the `Environment` and parameters, and updating the verbosity of individual Experiments | def _preparation_workflow(self):
self._validate_environment()
self._validate_parameters()
self._update_verbosity() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _problem_run_experiments_initialise(self):\n pass",
"def all_experiments():\n elo_explain_experiments()\n alpha_beta_experiments()\n mtcs_experiments()",
"def _prepare(self):\n logging.warning('-> preparing EMPTY experiments...')",
"def run_experiment():\n pass",
"def main(_):\n ... | [
"0.69771826",
"0.643358",
"0.6360893",
"0.6325461",
"0.62512594",
"0.6200235",
"0.6061731",
"0.6037322",
"0.60248876",
"0.6017767",
"0.59680045",
"0.5925578",
"0.5903823",
"0.5886987",
"0.58234054",
"0.5810402",
"0.5797173",
"0.5795129",
"0.5792287",
"0.5785429",
"0.5770355",... | 0.6804703 | 1 |
Look for Experiments that were performed under similar conditions (algorithm and crossexperiment parameters) | def _find_similar_experiments(self):
if self.read_experiments is False:
return
self.logger.print_saved_results_header()
model_params = dict(
model_init_params=self.model_init_params,
model_extra_params=self.model_extra_params,
feature_engineer=se... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_experiments():\n elo_explain_experiments()\n alpha_beta_experiments()\n mtcs_experiments()",
"def find(self):\n self._get_ids()\n G.debug_(F'Experiments found with matching cross-experiment key and algorithm: {len(self.experiment_ids)}')\n self._get_scored_params()\n ... | [
"0.66052616",
"0.660157",
"0.6432554",
"0.6353031",
"0.60426754",
"0.6032956",
"0.57782686",
"0.5756873",
"0.57042104",
"0.5703704",
"0.56645733",
"0.56579703",
"0.56579703",
"0.56579703",
"0.56579703",
"0.56517315",
"0.5607809",
"0.55942553",
"0.5585169",
"0.5581075",
"0.556... | 0.6858498 | 0 |
get radion button checked | def radiobutton_check(self):
if self.radioButton_name.isChecked():
return 1
elif self.radioButton_desc.isChecked():
return 2
elif self.radioButton_cost.isChecked():
return 3
elif self.radioButton_cat.isChecked():
return 4 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_checked(self):\n return self._checked",
"def get_dayu_checked(self):\n return self._button_group.checkedId()",
"def GetButton(self):\r\n\r\n return self.button",
"def get_button(self, button):\n return getattr(self.get_buttons_state(), button)",
"def is_checked(self):\n\... | [
"0.66832584",
"0.6554549",
"0.64877707",
"0.64108527",
"0.6363302",
"0.63359964",
"0.63220686",
"0.62967074",
"0.62888235",
"0.6278064",
"0.621106",
"0.621106",
"0.62085074",
"0.6114008",
"0.6067334",
"0.60545164",
"0.5978011",
"0.59709793",
"0.5893007",
"0.5893007",
"0.58930... | 0.7039864 | 0 |
SEARCH PRODUCT ON LIST | def search_product(self):
cat = []
product = open_products()
radio = self.radiobutton_check()
search = self.lineEdit_search.text()
_translate = QtCore.QCoreApplication.translate
__sortingEnabled = self.tableWidget.isSortingEnabled()
self.tableWidget.setSortingEnab... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_prod(self, words_list):\n keep_search = True\n while keep_search:\n for word in words_list:\n print(\"word evaluated: {}\".format(word))\n # self.all_products = Product.objects.all()\n # print(\"ALL PROD:{}\".format(self.all_products))\... | [
"0.7368465",
"0.68435085",
"0.67631483",
"0.6602257",
"0.6492441",
"0.63022536",
"0.62622535",
"0.621282",
"0.62002796",
"0.6198023",
"0.61915225",
"0.6179591",
"0.6163453",
"0.6110953",
"0.6086722",
"0.6059976",
"0.60394925",
"0.6008008",
"0.5998727",
"0.5996595",
"0.5990144... | 0.68626744 | 1 |
Count files with extension in `white_list_formats` contained in a directory. Arguments | def _count_valid_files_in_directory_extension(directory, white_list_formats, follow_links):
def _recursive_list(subpath):
return sorted(os.walk(subpath, followlinks=follow_links), key=lambda tpl: tpl[0])
samples = 0
for root, _, files in _recursive_list(directory):
for fname in files:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _count_valid_files_in_directory(directory,\n white_list_formats,\n follow_links):\n num_files = len(list(\n _iter_valid_files(directory, white_list_formats, follow_links)))\n start, stop = 0, num_files\n return stop - start",... | [
"0.7465041",
"0.62647635",
"0.6224247",
"0.5982946",
"0.5942773",
"0.5792455",
"0.56484646",
"0.56447536",
"0.56257147",
"0.56177866",
"0.55859035",
"0.5492254",
"0.5459815",
"0.5453284",
"0.54187775",
"0.5406837",
"0.5361068",
"0.53605735",
"0.53528506",
"0.5350312",
"0.5344... | 0.8020394 | 0 |
List paths of files in `subdir` relative from `directory` whose extensions are in `white_list_formats`. Arguments | def _list_valid_filenames_in_directory_extension(directory, white_list_formats,
class_indices, follow_links):
def _recursive_list(subpath):
return sorted(os.walk(subpath, followlinks=follow_links), key=lambda tpl: tpl[0])
classes = []
filenames = []... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _iter_valid_files(directory, white_list_formats, follow_links):\n def _recursive_list(subpath):\n return sorted(os.walk(subpath, followlinks=follow_links),\n key=lambda x: x[0])\n\n for root, _, files in _recursive_list(directory):\n for fname in sorted(files):\n ... | [
"0.6827383",
"0.6369667",
"0.63064486",
"0.6282869",
"0.6239156",
"0.62143165",
"0.6174102",
"0.61162937",
"0.6066563",
"0.60545284",
"0.60362184",
"0.6027808",
"0.6015523",
"0.59927267",
"0.595235",
"0.59515905",
"0.59473044",
"0.5916887",
"0.58967173",
"0.58919686",
"0.5883... | 0.71519554 | 0 |
Return True for qualified midi files and False for unwanted ones | def isSuitable(path):
def _get_midi_info(pm):
"""Return useful information from a pretty_midi.PrettyMIDI instance"""
if pm.time_signature_changes:
pm.time_signature_changes.sort(key=lambda x: x.time)
first_beat_time = pm.time_signature_changes[0].time
else:
first_beat_time = pm.estimate_beat_star... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_midi(self):\n return bool(RPR.TakeIsMIDI(self.id))",
"def isMayaFile(potentialMayaFile):\n\n pass",
"def has_generated_waves(self):\n dirname = self.dirname\n name = self.get_name()\n videocluster = os.path.join(dirname, name)\n try:\n listwaves = os.list... | [
"0.65192074",
"0.63154596",
"0.63136584",
"0.62079424",
"0.610955",
"0.6079261",
"0.60711443",
"0.6057856",
"0.6034282",
"0.6031856",
"0.59427947",
"0.5940143",
"0.5938202",
"0.5802379",
"0.5795001",
"0.5782977",
"0.5742119",
"0.5721173",
"0.5712611",
"0.5700751",
"0.56922334... | 0.6853662 | 0 |
Return useful information from a pretty_midi.PrettyMIDI instance | def _get_midi_info(pm):
if pm.time_signature_changes:
pm.time_signature_changes.sort(key=lambda x: x.time)
first_beat_time = pm.time_signature_changes[0].time
else:
first_beat_time = pm.estimate_beat_start()
tc_times, tempi = pm.get_tempo_changes()
if len(pm.time_signature_changes) == 1:
t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_pretty_midi_note(note: PrettyMIDINote) -> Note:\n return Note(note.start, note.duration, note.pitch, note.velocity)",
"def parse_pretty_midi_instrument(instrument: Instrument) -> Track:\n notes = [parse_pretty_midi_note(note) for note in instrument.notes]\n return Track(\n instrument.pr... | [
"0.65778196",
"0.63057446",
"0.59767",
"0.5876989",
"0.5828711",
"0.5786473",
"0.5696012",
"0.5634179",
"0.55680436",
"0.5563069",
"0.5514152",
"0.55015683",
"0.54727244",
"0.5400317",
"0.53432196",
"0.53189695",
"0.5315751",
"0.52979916",
"0.5297307",
"0.5297307",
"0.5292939... | 0.65572685 | 1 |
Return a `pypianoroll.Multitrack` instance with pianorolls merged to four tracks (Bass, Guitar, Piano and Strings) | def _merge(multitrack):
category_list = {'Piano': [], 'Guitar': [], 'Bass': [], 'Strings': []}
program_dict = {i.name: i.value for i in Instrument}
#cf) program: 0 to 127
for idx, track in enumerate(multitrack.tracks):
if track.is_drum:
pass
elif track.program // 8 == 0: #0 - 7
category_list['Pi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_tracks(num=1):\n pass",
"def get_album_tracks(self):\n track_list = self.soup.findAll('div', class_='chart_row')\n number_of_tracks = 0\n titles = []\n urls = []\n track_numbers = []\n \n for track in track_list:\n track_title = re.sub(' ... | [
"0.58527136",
"0.56709594",
"0.55659324",
"0.54249096",
"0.53458554",
"0.52894205",
"0.52515024",
"0.5251181",
"0.51958305",
"0.5186714",
"0.51747096",
"0.5143788",
"0.511002",
"0.5060876",
"0.5053386",
"0.50461704",
"0.5039786",
"0.50202435",
"0.5016995",
"0.5015666",
"0.498... | 0.7705346 | 0 |
Return a list of paths to MIDI files in `root` (recursively) | def get_midi_paths(root):
return [os.path.join(dirpath, filename)
for dirpath, _, filenames in os.walk(root)
for filename in filenames
if filename.endswith(".mid")] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_file_paths_labels(data_root: str) -> list:\n\n speaker_dirs = os.listdir(data_root)\n all_files = []\n i = 0\n for d in speaker_dirs:\n files = glob.iglob(data_root + '/' + d + '/**/*.wav', recursive=True)\n files = [[f, i] for f in files]\n ... | [
"0.7220583",
"0.6779634",
"0.66516256",
"0.660098",
"0.6593407",
"0.6593407",
"0.65737945",
"0.65732753",
"0.6500786",
"0.6500786",
"0.64572006",
"0.6450992",
"0.64233357",
"0.64233357",
"0.6403645",
"0.6387609",
"0.635705",
"0.63077503",
"0.62888396",
"0.6211767",
"0.6182937... | 0.8703079 | 0 |
Converts a group database record to a response. | def from_record(grp: Group) -> "GetGroupOut":
return GetGroupOut(
authorized_to_login=grp.authorized_to_login,
created_on=grp.created_on,
description=grp.description,
group_id=str(grp.pk),
group_name=grp.group_name,
is_autogroup=grp.is_auto... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _object2proto(self) -> GetGroupResponse_PB:\n return GetGroupResponse_PB(\n msg_id=serialize(self.id),\n address=serialize(self.address),\n status_code=self.status_code,\n content=json.dumps(self.content),\n )",
"async def transform_record(db_pool, re... | [
"0.5983506",
"0.5862114",
"0.5798873",
"0.5791165",
"0.5771977",
"0.5722852",
"0.55841607",
"0.5445661",
"0.5412593",
"0.54094756",
"0.5405397",
"0.5392367",
"0.53608865",
"0.52276444",
"0.5210959",
"0.5206038",
"0.5200237",
"0.51761365",
"0.51631135",
"0.51630306",
"0.516127... | 0.59728944 | 1 |
Returns the first few lines of a file. | def head(filename, lines=5):
from itertools import islice
with open(filename, "r") as f:
return list(islice(f, lines)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def head(file_name):\n #from itertools import islice\n with open('../test_files/' + file_name, 'r') as infile:\n list = infile.readlines()\n #printing the 1st 10 lines\n print('list of first 10 lines',list[:10])",
"def read_file_first_line(filename):\n result = None\n with open(filename,... | [
"0.7563068",
"0.7150089",
"0.7069498",
"0.7031684",
"0.7002547",
"0.700077",
"0.69989806",
"0.69676536",
"0.6960286",
"0.6866039",
"0.68151474",
"0.6755719",
"0.6711644",
"0.66920006",
"0.6667594",
"0.6606857",
"0.6604088",
"0.6467503",
"0.64642733",
"0.6448474",
"0.6445988",... | 0.8027319 | 0 |
Computes the number of lines in a file. | def line_count(file):
with open(file, "r") as f:
return sum(1 for line in f) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def number_of_lines(filename=\"\"):\n c = 0\n with open(filename) as f:\n for r in f:\n c += 1\n return(c)",
"def count_lines(filename):\r\n with open(filename, 'rb') as f:\r\n return sum(1 for line in f)",
"def count_lines(filename):\n with open(filename, 'rb') as f... | [
"0.88178706",
"0.8731009",
"0.87178063",
"0.86746895",
"0.8655685",
"0.86433434",
"0.8635618",
"0.86204034",
"0.85999197",
"0.8552609",
"0.8499082",
"0.84909797",
"0.8486911",
"0.8467286",
"0.845325",
"0.84204537",
"0.84204537",
"0.84029585",
"0.83937734",
"0.8373345",
"0.836... | 0.88162655 | 1 |
Produces a barplot with an additional dotplot showing the percentage of the dataset population for each category of the barplot. Sometimes it is useful to split the numeric variable of interest into positive and negative values and plot it as a function of the categorical variable. This can be controlled with the split... | def bar_plot_with_population_proportion(df, x, y,
func=np.median,
show_error_bar=True,
show_na=True,
na_label='Null',
ci... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bar_chart_score(self, grouped):\n picked_scenario = self.scenario_dict[\"%d\" % (self.scenario_num-1)]\n distinct_enum_X = self.data_dict[picked_scenario[\"X\"]]['distinct_enum']\n score = 0\n if distinct_enum_X == 1:\n score = 0\n elif distinct_enum_X >= 2 and dis... | [
"0.6012238",
"0.59831685",
"0.59792155",
"0.5921298",
"0.5907083",
"0.5897353",
"0.5893277",
"0.5835981",
"0.57806444",
"0.57713383",
"0.575355",
"0.574088",
"0.57074916",
"0.5706776",
"0.5693925",
"0.56843495",
"0.56740963",
"0.5643116",
"0.5620242",
"0.56201875",
"0.5595681... | 0.6654248 | 0 |
List of ftrace tracers supported by the target's kernel. | def available_tracers(self):
return self.target.read_value(self.available_tracers_file).split(' ') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def query_trace_list(self) -> List[Trace]:\n traces = self.CONFch.TRACe.CATalog.q()\n return [\n self.get_trace(tr_name) for _tr_no, tr_name in traces.comma_list_pairs()\n ]",
"def available_functions(self):\n return self.target.read_value(self.available_functions_file).spl... | [
"0.5155804",
"0.50418574",
"0.49876532",
"0.4854254",
"0.483255",
"0.48173532",
"0.48074782",
"0.47781605",
"0.47650316",
"0.47434604",
"0.47068202",
"0.4687243",
"0.46697566",
"0.46637073",
"0.4634404",
"0.46293625",
"0.46089062",
"0.4605567",
"0.45630094",
"0.45514292",
"0.... | 0.5978413 | 0 |
List of ftrace events supported by the target's kernel. | def available_events(self):
return self.target.read_value(self.available_events_file).splitlines() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_events():\n return [\n snow,\n mosquito,\n sun_heat,\n orage,\n overflowing,\n gathering,\n trampling,\n pollution,\n southern_wind,\n northern_wind,\n fog,\n sun\n ]",
"def eventList(filterStr=\"\"):\n\tfilter... | [
"0.64338076",
"0.60052794",
"0.58559626",
"0.5771622",
"0.5702687",
"0.56906134",
"0.56906134",
"0.5634408",
"0.56129074",
"0.5597985",
"0.55945504",
"0.55546623",
"0.5514301",
"0.5514301",
"0.54983747",
"0.54352075",
"0.54187423",
"0.54012513",
"0.54012513",
"0.5393965",
"0.... | 0.60398436 | 1 |
List of functions whose tracing/profiling is supported by the target's kernel. | def available_functions(self):
return self.target.read_value(self.available_functions_file).splitlines() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def available_functions(self):\n return self.config.keys()",
"def get_functions(self):\n\n functions = []\n for scenario in self.scenarios:\n functions.extend(scenario.functions)\n\n return functions",
"def get_kernel_supports(self):\n corresponding_simu = self._co... | [
"0.654922",
"0.6181237",
"0.61072654",
"0.6086148",
"0.60289353",
"0.5878984",
"0.5826403",
"0.5737905",
"0.5728877",
"0.5720346",
"0.5692301",
"0.5639953",
"0.56246513",
"0.5593619",
"0.55149573",
"0.5498651",
"0.54976916",
"0.5482196",
"0.54501104",
"0.5421802",
"0.5420948"... | 0.6671336 | 0 |
Handles a role based on a reaction emoji and a type of reaction. | async def _on_raw_reaction(
self,
payload: RawReactionActionEvent,
reaction_type: EnumReactionType,
) -> None:
if self.__is_self(payload.user_id):
print("reaction added by the bot itself")
return
guild = self._client.get_guild(payload.guil... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def handle_role_reaction_press(interaction: disnake.MessageInteraction):\n if interaction.message not in await ReactionRoleMessage.get_all():\n return\n\n role_id = int(interaction.component.custom_id)\n member: disnake.Member = interaction.author\n user = await User.get(member.id)\n ro... | [
"0.75853884",
"0.65080506",
"0.6321461",
"0.626989",
"0.62467366",
"0.6242232",
"0.6224208",
"0.61942565",
"0.6163146",
"0.6127837",
"0.61120754",
"0.60993093",
"0.60630506",
"0.60504484",
"0.60156685",
"0.59883565",
"0.5951541",
"0.58812255",
"0.5837778",
"0.5836286",
"0.581... | 0.7242691 | 1 |
Returns a dictionary of valid codons, ignores N's and illegal characters | def codonComposition(self):#works
return {codon: self.countDicNuc.get(codon) for codon in self.rnaCodonTable.keys()} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def return_dic_dependencies_out_of_notallowed_chars(dic):\n\n if dic is None: return None\n \n #print(f'dic in fun {dic} ')\n d = {}\n\n l =['~', '^' ]\n for keys, value in dic.items():\n \n # clean from ['~', '^' ]\n res = [ele for ele in l if(ele in value)]\n if res... | [
"0.6018091",
"0.5945",
"0.555542",
"0.5410485",
"0.53875726",
"0.53845954",
"0.5378845",
"0.53736097",
"0.5337625",
"0.5290172",
"0.52862924",
"0.52392375",
"0.5218561",
"0.5204443",
"0.5167168",
"0.51661754",
"0.51373065",
"0.51317465",
"0.51103866",
"0.5084833",
"0.50588447... | 0.6041726 | 0 |
Only show the debug toolbar to users with the superuser flag. | def _custom_show_toolbar(request):
return DEBUG and request.user.is_superuser | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _custom_show_toolbar(request: 'HttpRequest') -> bool:\n return DEBUG and request.user.is_superuser",
"def show_toolbar(request: HttpRequest) -> bool:\n conditions = (\n settings.DEBUG\n and request.META.get('REMOTE_ADDR', None) in settings.INTERNAL_IPS,\n request.user.is_superuser,... | [
"0.8087914",
"0.67727125",
"0.6103555",
"0.60474735",
"0.5892317",
"0.5892317",
"0.58842987",
"0.58714366",
"0.5816039",
"0.5810322",
"0.57671577",
"0.5711794",
"0.57063246",
"0.5657372",
"0.5653421",
"0.56085503",
"0.55066454",
"0.54855955",
"0.5455898",
"0.5455898",
"0.5434... | 0.8176875 | 0 |
Initialise six songs before each test. | def setUp(self):
self.song_a = Song('a', 1)
self.song_b = Song('b', 2)
self.song_c = Song('c', 3)
self.song_d = Song('d', 4)
self.song_e = Song('e', 5)
self.song_f = Song('f', 6)
self.song_e.similar_songs.append(self.song_f)
self.song_f.similar_songs.app... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self):\n self.number_of_tests = 20 # number of pseudo-random seeds\n self.max_nq = 2 # maximal number of qubits to check",
"def setUp(self):\n\t\tself.testCases = [\n\t\t\t{\n\t\t\t\t'show': \"House\",\n\t\t\t\t'episode': 11,\n\t\t\t\t'season': 3,\n\t\t\t\t'title': \"Words and Deeds\"\n... | [
"0.65922815",
"0.6557048",
"0.63779956",
"0.6371013",
"0.6341531",
"0.63258535",
"0.6281631",
"0.6266484",
"0.6251819",
"0.6205352",
"0.6140316",
"0.6121998",
"0.61211514",
"0.6115406",
"0.60736674",
"0.60464025",
"0.60432833",
"0.59813267",
"0.59704286",
"0.59670115",
"0.595... | 0.74140155 | 0 |
this is where we'll generate the cannonical output name from a function name. right now that just means that we strip the 'make_' from the beginning of the function name, add INPUTS_DIR, and tack EXTENSION on to the end | def input_name_from_func_name(func_name):
return os.path.join(INPUTS_DIR, ''.join(func_name.split('make_')[1:])) \
+ '.%s' % EXTENSION | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def output_file_name_maker(args):\n log.debug(\"Entering output_file_name_maker()\")\n path = os.getcwd() + '/out_files/'\n if not os.path.isdir(path):\n os.mkdir(path)\n\n if args.output is None:\n out_file_name = path + args.input[:-4] + '_' + args.type + '_' + args.layer\n else:\n ... | [
"0.6630721",
"0.66192883",
"0.6388481",
"0.637673",
"0.6374839",
"0.6334956",
"0.63235456",
"0.631591",
"0.6311602",
"0.6281102",
"0.62400967",
"0.62400967",
"0.6230614",
"0.620073",
"0.6154631",
"0.613816",
"0.61082274",
"0.6094512",
"0.6085123",
"0.60691476",
"0.6050784",
... | 0.81121916 | 0 |
this just returns a list of all the functions that start with "make_" | def get_functions():
return [f for f in globals() if f.startswith('make_')] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def package_macros(self):\n from re import sub\n NAME = sub(r'[\\.\\-\\s]', '_', self.name.upper())\n return [('HAVE_' + NAME, '1')]",
"def _get_functions():\n\n # Get all functions that start with _office.\n fcts = {fct_name[len(FCT_PREFIX):]: fct for (fct_name, fct) in\n globals().ite... | [
"0.60451585",
"0.58664644",
"0.58178484",
"0.57064575",
"0.5700007",
"0.56543374",
"0.56080353",
"0.55933964",
"0.5483323",
"0.5477582",
"0.546114",
"0.5435612",
"0.54196805",
"0.53839195",
"0.5369107",
"0.53625953",
"0.53622127",
"0.5351551",
"0.53315413",
"0.53219134",
"0.5... | 0.8003073 | 0 |
since many of our inputs are just downloaded from some url, this provides an easy wrapper around saving a url to a file | def download(url, save_as):
open(save_as, 'w').write(urllib2.urlopen(url).read()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save(self, url, output):\n\n shutil.copy2(self.get(url), output)",
"def fetch_save(url):\n\n name = url.split(\"/\")[-1]\n response = requests.get(url, stream=True)\n if response.status_code == 200:\n with open(f\"{DATA_PATH}/{name}\", \"wb\") as f:\n f.write(response.raw.re... | [
"0.7638658",
"0.73803496",
"0.72144437",
"0.71887296",
"0.7153609",
"0.7097675",
"0.70664203",
"0.7059924",
"0.70580167",
"0.69909936",
"0.6938759",
"0.69179696",
"0.6909847",
"0.68970954",
"0.6850881",
"0.6831355",
"0.68188065",
"0.6787702",
"0.6773176",
"0.67188466",
"0.671... | 0.757932 | 1 |
Updates Vim file with new user, title | def update_vim(user, title, vim_path):
# Read lines from file
with open(vim_path, "r") as f:
lines = f.readlines()
# Insert title into file
lines.insert(-5, f" \\ ['{title}', '', '@{user}'],\n")
with open(vim_path, "w") as f:
f.writelines(lines) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _optionsmenu_changeusername():\n\n self.helpindex = Toplevel(self.master)\n self.helpindex.title(\"Change Username\")\n self.helpindex.geometry(\"300x500\")",
"async def set_title(ctx, title = \"\", user: discord.Member = None ):\r\n \r\n trainer_data = load_file(file_p... | [
"0.61298555",
"0.6078003",
"0.60159075",
"0.59112406",
"0.5866513",
"0.57504153",
"0.57092637",
"0.560006",
"0.55958575",
"0.5542052",
"0.5496401",
"0.5490127",
"0.54706687",
"0.5457698",
"0.5420618",
"0.541122",
"0.5356468",
"0.5340959",
"0.53261554",
"0.5316683",
"0.5304044... | 0.8486569 | 0 |
Updates Markdown file with new user, title | def update_md(user, title, md_path):
with open(md_path, "a") as f:
f.writelines(f"[@{user}](https://github.com/{user}) | {title}\n") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_vim(user, title, vim_path):\n # Read lines from file\n with open(vim_path, \"r\") as f:\n lines = f.readlines()\n # Insert title into file\n lines.insert(-5, f\" \\\\ ['{title}', '', '@{user}'],\\n\")\n with open(vim_path, \"w\") as f:\n f.writelines(lines)",
"def upd... | [
"0.66843",
"0.6229587",
"0.616807",
"0.6102767",
"0.60568714",
"0.5991879",
"0.59606457",
"0.58455515",
"0.5813753",
"0.569473",
"0.56687087",
"0.55642784",
"0.55494636",
"0.55429316",
"0.55008227",
"0.5462733",
"0.5462733",
"0.5457223",
"0.5414493",
"0.5414493",
"0.5407012",... | 0.8066076 | 0 |
Given a hand and a word_dict, find the word that gives the maximum value score, and return it. This word should be calculated by considering all possible permutations of lengths 1 to HAND_SIZE. | def comp_choose_word(hand, word_list):
perms_list = []
for i in range(1, HAND_SIZE+1):
perms_list.extend(get_perms(hand, i))
perms_valid = []
for j in range(0, len(perms_list)):
word = perms_list[j]
if is_valid_word(word, hand, word_list):
perms_valid.append(word)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def comp_choose_word(hand, word_list):\n maxscore = 0\n maxword = \"\" \n for n in range(calculate_handlen(hand)):\n perms = get_perms(hand, n)\n for word in perms:\n wordscore = get_word_score(word, HAND_SIZE)\n if wordscore > maxscore:\n if word not ... | [
"0.77833706",
"0.72977877",
"0.71027774",
"0.6737867",
"0.66900647",
"0.6670378",
"0.6476858",
"0.6342118",
"0.6323235",
"0.63189286",
"0.62784415",
"0.62189335",
"0.61059946",
"0.6101989",
"0.6097827",
"0.6094526",
"0.6071197",
"0.6023825",
"0.5972666",
"0.59301585",
"0.5925... | 0.74554676 | 1 |
Allow the user to play an arbitrary number of hands. 1) Asks the user to input 'n' or 'r' or 'e'. If the user inputs 'n', play a new (random) hand. If the user inputs 'r', play the last hand again. If the user inputs 'e', exit the game. If the user inputs anything else, ask them again. 2) Ask the user to input a 'u' or... | def play_game(word_list):
hand = None
while True:
game_type = raw_input('Please choose from the following: n(new random hand), r(last hand) or e(exit the game):')
if game_type == 'n':
hand = deal_hand(HAND_SIZE)
player_type = raw_input('Please choose from the following: u... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def play_game(word_list):\n # TO DO ...\n\n hand = deal_hand(HAND_SIZE) # random init\n\n while True:\n cmd = input('Enter n to deal a new hand, r to replay the last hand, or e to end game: ')\n\n if cmd == 'n':\n hand = deal_hand(HAND_SIZE)\n play_hand(hand.copy(), wo... | [
"0.7557814",
"0.7527267",
"0.74797827",
"0.7379375",
"0.72535694",
"0.71851766",
"0.70698625",
"0.6684698",
"0.6561251",
"0.64982176",
"0.6379913",
"0.6304568",
"0.6253691",
"0.61796606",
"0.6172802",
"0.6140073",
"0.6136756",
"0.6113289",
"0.61047894",
"0.607065",
"0.606503"... | 0.7875012 | 0 |
add company data to every template context | def company_context(request):
return {'COMPANY': settings.COMPANY} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_context_data(self, **kwargs):\n context = super().get_context_data(**kwargs)\n needle = self.kwargs.get('needle', None)\n if needle == 'Customers':\n context['object_list'] = self.object.company_set.all()\n elif needle == 'Domains':\n context['object_list']... | [
"0.59769374",
"0.5878992",
"0.5803282",
"0.57501537",
"0.5741075",
"0.5703858",
"0.570355",
"0.5700627",
"0.5565555",
"0.5557163",
"0.55502367",
"0.54978806",
"0.5474082",
"0.5456616",
"0.5455256",
"0.5454932",
"0.54474753",
"0.5446852",
"0.5443428",
"0.5426705",
"0.53685",
... | 0.7447639 | 0 |
Wipe all user's apps | def wipe_application(self):
self.resin.models.application.base_request.request(
'application', 'DELETE',
endpoint=self.resin.settings.get('pine_endpoint'), login=True
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_apps(self):\n self.membership_class.objects.filter(obj=self).delete()",
"def delete():\n run('rm -r {}'.format(utils.home('apps', env.PROJECT_NAME)))",
"def reset_all_users():\n for user in User.objects.all():\n user.delete()",
"def clear_app(self, package):\n return self.adb.... | [
"0.74396634",
"0.69564664",
"0.6937995",
"0.68211466",
"0.6796042",
"0.67892236",
"0.6630169",
"0.66269046",
"0.6558905",
"0.6450006",
"0.6427059",
"0.64153993",
"0.6374235",
"0.6370929",
"0.6357625",
"0.63500726",
"0.63498604",
"0.6297183",
"0.6294454",
"0.62323797",
"0.6223... | 0.71439457 | 1 |
Create a device belongs to an application. | def create_device(self, app_name='FooBar', device_type='Raspberry Pi 2'):
app = self.resin.models.application.create(app_name, device_type)
return app, self.resin.models.device.register(app['id'], self.resin.models.device.generate_uuid()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_device(self, name: str, app_eui: str, app_key: str, dev_eui: str):\n return create_device(self.api_key, name, app_eui, app_key, dev_eui)",
"def create_device(self, device_dict):\n devices = {'devices': [device_dict]}\n url = '{}/iot/devices'.format(self.url)\n return self.p... | [
"0.7041395",
"0.69097596",
"0.6562136",
"0.643912",
"0.6354461",
"0.6188778",
"0.6021216",
"0.5969741",
"0.59542394",
"0.59318775",
"0.58259416",
"0.5809529",
"0.5809529",
"0.57551366",
"0.5745852",
"0.5713538",
"0.57038534",
"0.57032233",
"0.5650224",
"0.56397",
"0.56394404"... | 0.82001734 | 0 |
Return the index of the maximum value in given 1D array. | def get_max_index(a):
return a.argmax() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_index(X):\n i = 0\n j = 0\n\n # TODO\n if not(isinstance(X,np.ndarray )):\n raise ValueError('you should enter an array')\n\n if len(X.shape)!=2:\n raise ValueError('you should enter a 2-D array')\n\n argmax=np.argmax(X)\n (i,j)=np.unravel_index(argmax, X.shape)\n\n re... | [
"0.80352587",
"0.79737943",
"0.7693542",
"0.75790477",
"0.75152373",
"0.74524474",
"0.7450931",
"0.7430339",
"0.72076416",
"0.7140371",
"0.7118747",
"0.71065456",
"0.71065456",
"0.7093195",
"0.7037094",
"0.6941774",
"0.6907463",
"0.68942875",
"0.6859869",
"0.68461674",
"0.684... | 0.82905304 | 0 |
Buil point spread function with radius containment `radius` | def make_point_spread_function(self, radius=68):
nbin = self.nbin_ereco
energ_lo = np.zeros(nbin)
energ_hi = np.zeros(nbin)
psf = np.zeros(nbin)
for ibin, (emin, emax) in enumerate(zip(self.ereco[0:-1], self.ereco[1:])):
energ_lo[ibin] = emin
energ_hi[ibi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def makeGaussianPSF(radius,sizeX,sizeY): \n x,y = mgrid[-sizeY/2:sizeY/2, -sizeX/2:sizeX/2]\n g = exp(-(x**2/float(radius)+y**2/float(radius)))\n return(g / g.sum())",
"def radius(x) :\r\n return Feature(x, \"radius\")",
"def get_radius(size):\n return (size * 10) - 5",
"def surface_point(radi... | [
"0.6041938",
"0.59283733",
"0.5512458",
"0.5495644",
"0.5474699",
"0.5454222",
"0.54459083",
"0.53944826",
"0.5317354",
"0.5309967",
"0.5286557",
"0.5269519",
"0.52683467",
"0.5267959",
"0.5255332",
"0.52435523",
"0.52343273",
"0.5203294",
"0.5181497",
"0.5171688",
"0.5169537... | 0.68513256 | 0 |
Create the Bintable HDU for the effective area describe here | def _make_aeff_hdu(cls, table_energy, table_theta, aeff):
table = Table(
{
"ENERG_LO": table_energy["ETRUE_LO"][np.newaxis, :].data
* table_energy["ETRUE_LO"].unit,
"ENERG_HI": table_energy["ETRUE_HI"][np.newaxis, :].data
* table_energy... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _make_edisp_hdu(cls, table_energy, table_migra, table_theta, matrix):\n\n table = Table(\n {\n \"ENERG_LO\": table_energy[\"ETRUE_LO\"][np.newaxis, :].data\n * table_energy[\"ETRUE_LO\"].unit,\n \"ENERG_HI\": table_energy[\"ETRUE_HI\"][np.newaxis, ... | [
"0.5731542",
"0.569609",
"0.56140924",
"0.5493942",
"0.54756486",
"0.5416275",
"0.54108244",
"0.5382527",
"0.5274065",
"0.5184025",
"0.5182952",
"0.514602",
"0.51327854",
"0.5132499",
"0.51211596",
"0.51145464",
"0.51102096",
"0.50821644",
"0.5080324",
"0.5076717",
"0.5064758... | 0.6158731 | 0 |
Create the Bintable HDU for the energy dispersion describe here | def _make_edisp_hdu(cls, table_energy, table_migra, table_theta, matrix):
table = Table(
{
"ENERG_LO": table_energy["ETRUE_LO"][np.newaxis, :].data
* table_energy["ETRUE_LO"].unit,
"ENERG_HI": table_energy["ETRUE_HI"][np.newaxis, :].data
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _make_aeff_hdu(cls, table_energy, table_theta, aeff):\n table = Table(\n {\n \"ENERG_LO\": table_energy[\"ETRUE_LO\"][np.newaxis, :].data\n * table_energy[\"ETRUE_LO\"].unit,\n \"ENERG_HI\": table_energy[\"ETRUE_HI\"][np.newaxis, :].data\n ... | [
"0.650117",
"0.62673503",
"0.5788488",
"0.57707006",
"0.56286347",
"0.55741984",
"0.55560106",
"0.55140525",
"0.55079234",
"0.5494061",
"0.5478699",
"0.5471191",
"0.54505545",
"0.5444994",
"0.5440098",
"0.5435845",
"0.54211193",
"0.5415218",
"0.5405363",
"0.540129",
"0.540123... | 0.6944647 | 0 |
Scapes a wikipedia web page to retrieve a table of S&P500 component stocks. Use this function if you require an updated table. | def get_sp500_stocks_wiki(url=None):
website_url = requests.get(url)
soup = BeautifulSoup(website_url.text, 'lxml')
my_table = soup.find('table', {'class': 'wikitable sortable'})
my_table
table_rows = my_table.find_all('tr')
data = []
for row in table_rows:
data.append([t.text.str... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_SP500_info():\n html_page = read_sp500_wiki_page()\n data, column_names = parse_sp500_wiki_page(html_page)\n \n sp_stock_dataframe = pd.DataFrame(data, columns=column_names)\n return sp_stock_dataframe",
"def read_sp500_wiki_page():\n response = requests.get(SP500_WIKI_PAGE)\n if no... | [
"0.6920673",
"0.6775415",
"0.6491018",
"0.64715534",
"0.6283885",
"0.61177415",
"0.60217345",
"0.6007706",
"0.5980837",
"0.58302146",
"0.5810305",
"0.5781243",
"0.5769318",
"0.5742761",
"0.56964123",
"0.5672572",
"0.56565785",
"0.56406903",
"0.5630493",
"0.5610964",
"0.560649... | 0.7354789 | 0 |
Filters a dataframe based on the GICS industries | def filter_stocks_industry(df, ind_excld=[]):
df_excld = df[~df['GICS'].isin(ind_excld)]
return df_excld | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normData( df, inSirenName=\"./siren_in.csv\", gtName=\"./Greentech_All_VF4_green.xlsx\", gt_sheet_name=\"FICHIER COMPLET\" ) :\n sirens_g = pd.read_excel( gtName, gt_sheet_name)[\"SIREN\"].tolist()\n print( \"Number of known GreenTechs:\", len(sirens_g))\n\n sirens = pd.read_csv( inSirenName )[\"siren... | [
"0.5948763",
"0.5933738",
"0.5821229",
"0.57077515",
"0.5700914",
"0.5690696",
"0.56460583",
"0.5575305",
"0.55246496",
"0.55217737",
"0.547266",
"0.54389167",
"0.53746265",
"0.5340918",
"0.5317793",
"0.5303669",
"0.52494544",
"0.5226824",
"0.52073926",
"0.5203186",
"0.51877"... | 0.7067409 | 0 |
Retrieves the daily stock price from a dataframe of stocks and their respective tickers | def get_stock_price(df_excld):
ts = TimeSeries(os.environ['ALPHA_VANTAGE_KEY'])
info = []
symbols = []
counter = 0
for t in df_excld['Ticker']:
if counter % 5 == 0:
time.sleep(65)
i, m = ts.get_daily(symbol=t, outputsize='full')
info.append(i)
symbol... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prices(tickers):\n try:\n start = dt.datetime.today()\n start = start.strftime('%Y-%m-%d') \n data = pdr.get_data_yahoo(tickers, start=start)\n price = data['Adj Close']\n vol = data['Volume']\n data_dic = {}\n for stock in tickers:\n data_dic[str(... | [
"0.7620487",
"0.72963095",
"0.7295528",
"0.72947097",
"0.7246966",
"0.70653677",
"0.6967518",
"0.6923329",
"0.68106955",
"0.67846423",
"0.6734135",
"0.6712004",
"0.6670008",
"0.6616316",
"0.66059697",
"0.658668",
"0.6559862",
"0.6543512",
"0.6509535",
"0.6502025",
"0.64984727... | 0.7850749 | 0 |
Converts pricing/volume information and the stocks symbols into a dataframe | def get_stock_price_df(info, symbols):
df_l = []
for num, i in enumerate(info):
df = pd.DataFrame.from_dict(i, orient='index')
df['Symbol'] = symbols[num]
df_l.append(df)
df_full = pd.concat(df_l)
df_full = df_full.rename(columns={'1. open': 'Open',
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_stock_data_frame(time, stock):\n\n print(\"Getting\", time, \"stock data for\", stock)\n url = 'https://api.iextrading.com/1.0/stock/'+stock+'/chart/'+time\n req = requests.get(url)\n print(url)\n\n print(\"Parsing data.\")\n rjson = req.text\n\n rdata = json.loads(rjson)\n\n dates ... | [
"0.7305524",
"0.72680324",
"0.6919489",
"0.6888051",
"0.68311673",
"0.67995304",
"0.67773247",
"0.6762041",
"0.674032",
"0.6681586",
"0.66755223",
"0.66613597",
"0.6641583",
"0.6629166",
"0.6600663",
"0.6586415",
"0.65680933",
"0.6533086",
"0.6442557",
"0.6419382",
"0.6370926... | 0.81713945 | 0 |
Create a random set of files and folders by repeatedly walking through the current tree and creating random files or subfolders (the number of files and folders created is chosen by evaluating a depth dependent function). | def iterative_tree(
basedir: Union[str, PurePath],
nfolders_func: Callable,
nfiles_func: Callable,
repeat: int = 1,
maxdepth: Optional[int] = None,
filename: Callable = random_string,
payload: Optional[Callable[[Path], Generator[Path, None, None]]] = None,
) -> Tuple[List[Path], List[Path]]:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_tree(path, depth=DEPTH):\r\n os.mkdir(path)\r\n for i in range(NUM_FILES):\r\n filename = os.path.join(path, 'file{0:03}.txt'.format(i))\r\n with open(filename, 'wb') as f:\r\n f.write(b'foo')\r\n if depth <= 1:\r\n return\r\n for i in range(NUM_DIRS):\r\n ... | [
"0.6726816",
"0.65547925",
"0.63757664",
"0.61973315",
"0.61346674",
"0.6116621",
"0.59830934",
"0.59818655",
"0.5974397",
"0.5958331",
"0.5939886",
"0.5917628",
"0.59022367",
"0.58766466",
"0.58576345",
"0.58414483",
"0.58323884",
"0.58179104",
"0.5786245",
"0.57839626",
"0.... | 0.67585284 | 0 |
Create a random set of files and folders by repeatedly walking through the current tree and creating random files or subfolders (the number of files and folders created is chosen from a Gaussian distribution). | def iterative_gaussian_tree(
basedir: Union[str, PurePath],
nfiles: int = 2,
nfolders: int = 1,
repeat: int = 1,
maxdepth: Optional[int] = None,
sigma_folders: int = 1,
sigma_files: int = 1,
min_folders: int = 0,
min_files: int = 0,
filename: Callable = random_string,
payload... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _make_files(self, dir, num_files=10):\n for i in range(num_files):\n self._make_random_file(dir)",
"def create_file_tree(root_folder: str, files: List[sync.FileInfo])-> None:\n for file in files:\n absolute_file_path = os.path.join(root_folder,\n ... | [
"0.6503651",
"0.63522047",
"0.6270621",
"0.62360495",
"0.62003726",
"0.61630064",
"0.61486286",
"0.6084488",
"0.6024795",
"0.60146976",
"0.5991459",
"0.59881437",
"0.59212524",
"0.5892128",
"0.5884012",
"0.58007777",
"0.57671463",
"0.57637715",
"0.5753899",
"0.574507",
"0.573... | 0.6726356 | 0 |
Select random distinct files and directories. If the directories and files do not have to be distinct, use choose_random_elements instead. | def sample_random_elements(
basedir: str, n_dirs: int, n_files: int, onfail: str = "raise"
) -> Tuple[List[Path], List[Path]]:
alldirs = []
allfiles = []
for root, dirs, files in os.walk(str(basedir)):
for d in dirs:
alldirs.append(Path(root) / d)
for file in files:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def choose_random_elements(\n basedir: str, n_dirs: int, n_files: int, onfail: str = \"raise\"\n) -> Tuple[List[Path], List[Path]]:\n alldirs = []\n allfiles = []\n for root, dirs, files in os.walk(str(basedir)):\n for d in dirs:\n alldirs.append(Path(root) / d)\n for file in f... | [
"0.6872804",
"0.589962",
"0.5864095",
"0.5834974",
"0.58170503",
"0.5798952",
"0.5792779",
"0.57830095",
"0.57264936",
"0.5723298",
"0.56182414",
"0.55619913",
"0.54683816",
"0.544911",
"0.5416354",
"0.5414076",
"0.53776866",
"0.535169",
"0.53425235",
"0.5307321",
"0.52958834... | 0.6968894 | 0 |
Create instrument from string. | def from_string(s):
pair, exchange = s.split('@')
base = pair[:3]
quote = pair[3:]
if base not in Instrument.KNOWN_CURRENCiES:
raise ValueError('Unknown base currency: {}'.format(base))
if quote not in Instrument.KNOWN_CURRENCiES:
raise ValueError('Unknown... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_str(cls, string):",
"def from_string(string):\n return Output('', magic=string)",
"def from_str(cls, s):\n raise NotImplementedError",
"def fromString(cls, string):\n raise NotImplementedError(\n 'fromString is not implemented on %r' % (cls.__name__,))",
"def fromSt... | [
"0.65949607",
"0.65292734",
"0.63579905",
"0.63524354",
"0.6308797",
"0.6084255",
"0.58738697",
"0.5861292",
"0.5838346",
"0.58349895",
"0.58315027",
"0.5789839",
"0.5763322",
"0.57365644",
"0.5729585",
"0.5724061",
"0.56975126",
"0.5695986",
"0.56947374",
"0.5684569",
"0.568... | 0.72674024 | 0 |
Return BTC/USD Instrument for given exchange. | def make_btc_usd(exchange_id):
return Instrument(base_currency='BTC',
quote_currency='USD',
exchange_id=exchange_id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_eth_usd(exchange_id):\n return Instrument(base_currency='ETH',\n quote_currency='USD',\n exchange_id=exchange_id)",
"def make_ltc_usd(exchange_id):\n return Instrument(base_currency='LTC',\n quote_currency='USD',\n ... | [
"0.67415154",
"0.5587795",
"0.53776586",
"0.5371926",
"0.52535015",
"0.5234568",
"0.5058571",
"0.50281864",
"0.5023253",
"0.50143576",
"0.50022155",
"0.49852893",
"0.49844432",
"0.49712318",
"0.496336",
"0.49362963",
"0.48738736",
"0.48471636",
"0.48137292",
"0.47896537",
"0.... | 0.67252517 | 1 |
Return LTC/USD Instrument for given exchange. | def make_ltc_usd(exchange_id):
return Instrument(base_currency='LTC',
quote_currency='USD',
exchange_id=exchange_id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_eth_usd(exchange_id):\n return Instrument(base_currency='ETH',\n quote_currency='USD',\n exchange_id=exchange_id)",
"def make_btc_usd(exchange_id):\n return Instrument(base_currency='BTC',\n quote_currency='USD',\n ... | [
"0.6908836",
"0.65457433",
"0.55306756",
"0.53915733",
"0.51590073",
"0.51282406",
"0.5085755",
"0.5064646",
"0.4958483",
"0.49563062",
"0.4888547",
"0.48622134",
"0.48508948",
"0.48487234",
"0.47917956",
"0.47855002",
"0.4778604",
"0.47776508",
"0.47672254",
"0.47508138",
"0... | 0.66164666 | 1 |
Return ETH/USD Instrument for given exchange. | def make_eth_usd(exchange_id):
return Instrument(base_currency='ETH',
quote_currency='USD',
exchange_id=exchange_id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_btc_usd(exchange_id):\n return Instrument(base_currency='BTC',\n quote_currency='USD',\n exchange_id=exchange_id)",
"def make_ltc_usd(exchange_id):\n return Instrument(base_currency='LTC',\n quote_currency='USD',\n ... | [
"0.6583832",
"0.5816019",
"0.54274714",
"0.5346759",
"0.52041954",
"0.5195923",
"0.5190232",
"0.51896995",
"0.5188491",
"0.51840764",
"0.5138339",
"0.51279074",
"0.5088344",
"0.5070251",
"0.5056582",
"0.5048986",
"0.5046646",
"0.50327915",
"0.50227565",
"0.4999693",
"0.499068... | 0.72136635 | 0 |
Returns an interface to access the methods in Gnome Online Accounts DBus service | def get_dbus_iface(self):
bus = dbus.SessionBus()
proxy = bus.get_object('org.gnome.OnlineAccounts',
'/org/gnome/OnlineAccounts')
#create an interface
iface=dbus.Interface(proxy, dbus_interface='org.freedesktop.DBus.ObjectManager')
return ifac... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_dbus_oauth_iface(self, account):\n bus = dbus.SessionBus()\n accProxy=bus.get_object('org.gnome.OnlineAccounts',\n account)\n #create an interface\n oauthIface=dbus.Interface(accProxy, dbus_interface='org.gnome.OnlineAccounts.OAuthBased')\n \n ... | [
"0.69837856",
"0.59495246",
"0.58241594",
"0.5758662",
"0.54101735",
"0.524742",
"0.52445054",
"0.51624984",
"0.51624984",
"0.51624984",
"0.51624984",
"0.51624984",
"0.51624984",
"0.51624984",
"0.51624984",
"0.51624984",
"0.51624984",
"0.51624984",
"0.51624984",
"0.51624984",
... | 0.71294856 | 0 |
Returns the interface for OAuth data access for the given account using DBus | def get_dbus_oauth_iface(self, account):
bus = dbus.SessionBus()
accProxy=bus.get_object('org.gnome.OnlineAccounts',
account)
#create an interface
oauthIface=dbus.Interface(accProxy, dbus_interface='org.gnome.OnlineAccounts.OAuthBased')
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_dbus_iface(self):\n bus = dbus.SessionBus()\n proxy = bus.get_object('org.gnome.OnlineAccounts',\n '/org/gnome/OnlineAccounts')\n #create an interface\n iface=dbus.Interface(proxy, dbus_interface='org.freedesktop.DBus.ObjectManager')\n \n\n ... | [
"0.62325776",
"0.56330216",
"0.5565936",
"0.5529039",
"0.5250369",
"0.52486426",
"0.5240692",
"0.52387524",
"0.5138909",
"0.5127849",
"0.51071155",
"0.5069372",
"0.5041326",
"0.50264287",
"0.50114554",
"0.5004811",
"0.5003612",
"0.49783772",
"0.49551997",
"0.4920538",
"0.4916... | 0.8120333 | 0 |
Convert the underlying object to dict and normalize all the percentage values from [0, 100] to [0, 1]. | def pre_load(self, data, **_) -> dict:
data = super().pre_load(data)
return {
key: value / 100.0
for key, value in (
data if isinstance(data, dict) else data._asdict()
).items()
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _normalize(self, value_dict):\n median = np.median([value_dict[i] for i in list(value_dict.keys())])\n n = len(value_dict.keys())\n if median < 1.0 / float(n):\n divisor = 1.0 / float(n)\n else:\n divisor = median\n return_dict = {}\n for i in lis... | [
"0.6799525",
"0.65754515",
"0.64411706",
"0.63665843",
"0.63184613",
"0.62824506",
"0.62614185",
"0.61632526",
"0.6160971",
"0.6152731",
"0.61147135",
"0.6112455",
"0.60967445",
"0.60734075",
"0.60437673",
"0.60280687",
"0.6009711",
"0.60028386",
"0.58760273",
"0.5870628",
"0... | 0.6648449 | 1 |
Test interaction between update and get_pools This test verifies that each time that get_pools is called it gets the latest copy of service_capabilities, which is timestamped with the current date/time. | def test_update_and_get_pools(self, _mock_utcnow,
_mock_service_is_up,
_mock_service_get_all):
context = 'fake_context'
dates = [datetime.fromtimestamp(400), datetime.fromtimestamp(401),
datetime.fromtimestamp(402)]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_update_pool(self):\r\n resource = 'pool'\r\n cmd = pool.UpdatePool(test_cli20.MyApp(sys.stdout), None)\r\n self._test_update_resource(resource, cmd, 'myid',\r\n ['myid', '--name', 'newname'],\r\n {'name': 'newname', }... | [
"0.6204971",
"0.60530496",
"0.58764",
"0.5875567",
"0.5835672",
"0.5810099",
"0.580151",
"0.5745013",
"0.5675129",
"0.56701493",
"0.56438327",
"0.56438327",
"0.56438327",
"0.5623865",
"0.5613094",
"0.5554875",
"0.55421156",
"0.5540872",
"0.55256253",
"0.545788",
"0.5452826",
... | 0.80368316 | 0 |
Test get_all_backend_states when we have clustered services. Confirm that clustered services are grouped and that only the latest of the capability reports is relevant. | def test_get_all_backend_states_cluster(self):
ctxt = context.RequestContext(fake.USER_ID, fake.PROJECT_ID, True)
cluster_name = 'cluster'
db.cluster_create(ctxt, {'name': cluster_name,
'binary': constants.VOLUME_BINARY})
services = (
db.ser... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_restart_statestore(self):\n # Verify two catalogd instances are created with one as active.\n catalogds = self.cluster.catalogds()\n assert(len(catalogds) == 2)\n catalogd_service_1 = catalogds[0].service\n catalogd_service_2 = catalogds[1].service\n assert(catalogd_service_1.get_metric_... | [
"0.5729701",
"0.5692969",
"0.55421036",
"0.55334276",
"0.5492443",
"0.54571676",
"0.5455251",
"0.54390645",
"0.54367226",
"0.5422881",
"0.5414973",
"0.5411074",
"0.54056114",
"0.53975976",
"0.53744614",
"0.533965",
"0.5323551",
"0.5284911",
"0.5282929",
"0.52533203",
"0.52496... | 0.8301232 | 0 |
Getter for grouping strategy class. | def getGroupingStrategyFactory(self) -> cern.japc.core.spi.group.GroupSubscriptionStrategyFactory:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def group_cls(self):\n return self.get_entity_cls('group')",
"def group(self):\n raise NotImplementedError()",
"def groupId(self):\n return self.algorithm_spec.category",
"def get_group(self):\n return self._group",
"def getGroup(self):\n\t\treturn self.Group",
"def group(self... | [
"0.7232418",
"0.6322865",
"0.62625855",
"0.62388116",
"0.61936986",
"0.6176015",
"0.6176015",
"0.6176015",
"0.6135591",
"0.60596156",
"0.59891313",
"0.5946566",
"0.5921016",
"0.577976",
"0.57770354",
"0.5761953",
"0.5761953",
"0.5761953",
"0.5761953",
"0.5761953",
"0.5761953"... | 0.7083736 | 1 |
Getter for protocol name. | def getProtocol(self) -> str:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def protocol(self) -> str:\n return __name__",
"def protocol_name(self):\n self._protocol_name = 'kerberos'\n return self._protocol_name",
"def layer_protocol_name(self) -> str:\n return self._layer_protocol_name",
"def getProtocol(self, _):\r\n return self._protocol",
"d... | [
"0.8002774",
"0.77359474",
"0.7692192",
"0.74168587",
"0.7388458",
"0.737085",
"0.7363643",
"0.7208979",
"0.7208979",
"0.7145496",
"0.70876086",
"0.70870215",
"0.7078827",
"0.7015773",
"0.7015773",
"0.7015773",
"0.7015773",
"0.7015773",
"0.6996118",
"0.69295037",
"0.6900162",... | 0.77547324 | 1 |
Checks whether a protocol is defined. | def isProtocolDefined(self) -> bool:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def provides_protocol(type_, protocol):\n return issubclass(type_, protocol)",
"def supports_protocol(self, obj, protocol):\n\n return self.adapt(obj, protocol, None) is not None",
"def protocol_available(self, module_id: str) -> bool:\n return self.protocol_loaded(module_id) or ZeroBot.mo... | [
"0.7594745",
"0.70137686",
"0.6995542",
"0.6952326",
"0.6947457",
"0.6624973",
"0.65586764",
"0.6474927",
"0.6457561",
"0.62508583",
"0.61251837",
"0.602409",
"0.6014505",
"0.6007922",
"0.5898452",
"0.57781094",
"0.5711765",
"0.565172",
"0.5552416",
"0.5510191",
"0.5483252",
... | 0.8576331 | 0 |
This method registers an instance of ParameterMetaFactory in the ParameterFactory map of instantiated parameter factories. This method should be used as postcreation method when ParameterMetaFactory is created inside Spring context to make sure that the instance returned from Spring is the same which returned via | def registerInParameterFactory(self) -> None:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _register_factory(self):\n for name, info in self._plugins.items():\n if info['priority']:\n factory = getattr(info['plugin'], 'factory', None)\n if callable(factory):\n registry[info['factory']] = info['plugin'].factory\n registry.freez... | [
"0.5793519",
"0.57484925",
"0.55389357",
"0.5499525",
"0.5310114",
"0.5285134",
"0.5257398",
"0.5134799",
"0.51279974",
"0.51279974",
"0.51279974",
"0.51279974",
"0.51279974",
"0.51279974",
"0.51279974",
"0.51279974",
"0.5071079",
"0.50270575",
"0.5011839",
"0.49468216",
"0.4... | 0.7546559 | 0 |
get default zone in given region | def default_zone(self, region):
if region == 'us-east-1':
return region + 'b'
else:
return region + 'a' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_single_zone(self, region):\n # TODO: Implement zones list\n # Hardcoded to us-west2\n z = {\n \"us-west2\": ['us-west2-a', 'us-west2-b', 'us-west2-c'],\n \"us-west1\": ['us-west1-a', 'us-west1-b', 'us-west1-c']\n }\n return z[region][:1]",
"def get... | [
"0.76369065",
"0.72399366",
"0.7175199",
"0.68981487",
"0.68733454",
"0.6461723",
"0.6460905",
"0.6460905",
"0.64468133",
"0.6437945",
"0.6437945",
"0.63922286",
"0.6372721",
"0.6322575",
"0.6303069",
"0.622817",
"0.6184209",
"0.61834896",
"0.61645055",
"0.6161976",
"0.606879... | 0.8509311 | 0 |
terminate an ec2 instance | def terminate_instance(self):
# connect to ec2
try:
ec2_region = [r for r in boto.ec2.regions() if r.name == self._region][0]
except indexerror:
print >> sys.stderr, 'unknown region: %s' % self._region
exit(2)
ec2_connection = ec2_region.connect()
#import code; code.interact(local... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ec2_stop(resource, metadata):\n instances = resource.instances.filter(\n Filters=[{'Name': 'instance-state-name', 'Values': ['running']},\n {'Name': 'tag:Name', 'Values': [metadata['fqdn']]}, ])\n\n for instance in instances:\n print(\"Terminating vm id {0} name {1}\".format... | [
"0.795829",
"0.7921747",
"0.7769632",
"0.76838297",
"0.7604274",
"0.7542121",
"0.7283582",
"0.72437674",
"0.72154665",
"0.7198874",
"0.7156043",
"0.71416855",
"0.7140608",
"0.7137611",
"0.7038343",
"0.70366335",
"0.69441235",
"0.6930024",
"0.6893427",
"0.68884844",
"0.6858489... | 0.80141443 | 0 |
Performs the kmedian approximation algorithm. | def kmedian_procedure(data_list, k, alpha=1, max_iter=100, groups_list=None, distances=None,
client_list=None, remaining_k=-1):
if not distances:
distances = calc_distances(data_list)
if not client_list:
client_list = range(len(data_list))
if remaining_k == -1:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def median(self, nums):\n n = len(nums)\n return self.find_kth(nums, 0, n, (n-1)/2)",
"def median(self):\n # TO DO\n pass",
"def _medfilt(x, k):\t\n\tk2 = (k - 1) // 2\n\ty = zeros((len(x), k), dtype=x.dtype)\n\ty[:,k2] = x\n\tfor i in range(k2):\n\t\tj = k2 - i\n\t\ty[j:,i] = x[:-j... | [
"0.6876999",
"0.6673821",
"0.652155",
"0.6407106",
"0.6400426",
"0.6345882",
"0.63423383",
"0.6290885",
"0.625823",
"0.616914",
"0.6133362",
"0.6131145",
"0.6098078",
"0.6041387",
"0.6014263",
"0.5996746",
"0.5986116",
"0.59763706",
"0.59631586",
"0.595448",
"0.59330016",
"... | 0.6896646 | 0 |
Test initialization of HMF object | def test_hmf_init(self):
spec = np.random.random((20, 100))
invvar = np.random.random((20, 100))
hmf = HMF(spec, invvar)
assert hmf.K == 4
assert log.level == 20 # INFO
hmf = HMF(spec, invvar, K=6, verbose=True)
assert hmf.K == 6
assert log.level == 10 #... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_01_Init(self):\n pass",
"def test_init(self):\r\n x = self.FWP({'x': 3})\r\n self.assertEqual(x.Name, 'FWP')\r\n self.assertEqual(x.Params, {'x': 3})",
"def test_constructor(self):\n pass",
"def test_init(self):\n xtal_model_data = XtalModelData(self.params)... | [
"0.74621004",
"0.7121081",
"0.6892803",
"0.6881722",
"0.68029225",
"0.6800388",
"0.6796026",
"0.6749046",
"0.67408496",
"0.67329174",
"0.67308205",
"0.67303675",
"0.6727606",
"0.6725984",
"0.6691618",
"0.6690803",
"0.6687763",
"0.66386503",
"0.65781575",
"0.65758735",
"0.6566... | 0.7808943 | 0 |
Construct Chi2 distributions with parameter `df`. | def __init__(self,
df,
validate_args=False,
allow_nan_stats=True,
name="Chi2"):
parameters = locals()
# Even though all stats of chi2 are defined for valid parameters, this is
# not true in the parent class "gamma." therefore, passing
# allow_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def chi2P(chi, df):\n assert df & 1 == 0\n # If chi is very large, exp(-m) will underflow to 0.\n m = chi / 2.0\n sum = term = exp(-m)\n for i in range(1, df//2):\n term *= m / i\n sum += term\n # With small chi and large df, accumulated\n # roundoff error, plus error in\n # t... | [
"0.5843204",
"0.57367903",
"0.5732908",
"0.5599636",
"0.5527276",
"0.54943526",
"0.547583",
"0.5467089",
"0.54378265",
"0.53899276",
"0.53712934",
"0.5288352",
"0.52827805",
"0.522218",
"0.52204704",
"0.521747",
"0.5164412",
"0.51503825",
"0.51320636",
"0.51305676",
"0.510407... | 0.6338645 | 0 |
Given a type, determine if it is a Valuelike type. This is equivalent to being Tensorlike, but assumes the type has already been transformed. | def isValueType(typ: CType) -> bool:
if isinstance(typ, BaseCType):
# I am regretting my naming conventions, but now we are wrapping at::scalar in
# lazy value, while preserving other 'scalar' types as scalars in the IR
return typ.type == valueT or typ.type == scalarT
elif isinstance(typ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isinstance_safe(value, type_):\n try:\n return isinstance(value, type_)\n except TypeError:\n # Cannot perform isinstance on some types\n return False",
"def hastype_helper(t, model):\n if t == model:\n return True\n elif isinstance(model, type) and issubclass(model, t... | [
"0.630604",
"0.6195434",
"0.6163491",
"0.6071071",
"0.602869",
"0.5941115",
"0.57113945",
"0.5711245",
"0.5709017",
"0.5640908",
"0.5594055",
"0.5561784",
"0.55328524",
"0.55195194",
"0.5509978",
"0.54999655",
"0.54901093",
"0.54566795",
"0.5438095",
"0.5428612",
"0.5425838",... | 0.65988016 | 0 |
Return camelcase version of op in node. | def node_name(self) -> str:
op_name = f"{self.name.name}_{self.name.overload_name}".lower()
return "".join(word.capitalize() or "" for word in op_name.split("_")) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def op(self) -> str:\n return self._node.get(\"op\")",
"def getOperatorName(self):\n return _libsbml.ASTNode_getOperatorName(self)",
"def name(self):\n return self._name + Operation.string_for_inverse if self.inverse else self._name",
"def operation(self) -> str:\n return self._op... | [
"0.70496655",
"0.6350555",
"0.6225515",
"0.6108189",
"0.604371",
"0.60395575",
"0.59710157",
"0.59143907",
"0.5888177",
"0.58866435",
"0.5882014",
"0.5882014",
"0.58430976",
"0.58254623",
"0.5804855",
"0.57883185",
"0.5723488",
"0.5672623",
"0.5670154",
"0.5648921",
"0.563740... | 0.7674802 | 0 |
return station unit belongs to | def station(unit, date):
req = 'select ParentLocId from PI_PlaceRelationship where RelationId = 4 and LocId = "{}" and EndDate > "{}"'.format(unit,d2d(date))
try:
station = pd.read_sql(req, engine).values[0][0]
return station if unit != station else 0
except:
logging.warning('e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_unit(self, unit):\n for u in self.units:\n if u.character.name == unit.character.name:\n return u\n assert False",
"def unit_at(x, y, units):\r\n for u in units:\r\n if u.x == x and u.y == y:\r\n return u\r\n return None",
"def get_unit(self, unit_id: str) -> ... | [
"0.70509297",
"0.6322347",
"0.6155294",
"0.6104046",
"0.60039574",
"0.59009016",
"0.5893615",
"0.5893615",
"0.5871283",
"0.58702105",
"0.5857957",
"0.58417964",
"0.582177",
"0.58191824",
"0.57724977",
"0.577135",
"0.57588387",
"0.57587105",
"0.57572883",
"0.57478976",
"0.5740... | 0.6567435 | 1 |
create a dataframe for selected period and centre to reflect the percentage of units met the targets | def chart_data(indicator, start, period, centre='all', lim=2020):
x = pd.DataFrame()
logging.info((indicator, centre))
d = [t.strftime("%Y%m") for t in pd.date_range(start=start, periods=period/3, freq='-3M')]
for date in d:
x = x.append(met(indicator, date, cent=centre, lim=lim))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _initialize_df(self, df):\n df['values'] = (self.tc.instrument_returns['cumulative'] *\n self.tc.starting_cash).mul(self.target_weights, axis=1).values * (1 - self.tc.commission)\n df['allocations'] = self.df['values'].div(df['values'].sum(axis=1), axis=0)\n df['retu... | [
"0.55154985",
"0.53978485",
"0.528577",
"0.5283913",
"0.526154",
"0.5241061",
"0.52362907",
"0.5204985",
"0.51255184",
"0.5116088",
"0.5088253",
"0.50761104",
"0.5063824",
"0.5042515",
"0.50090724",
"0.4999344",
"0.4994999",
"0.4994919",
"0.4944404",
"0.49217716",
"0.4920829"... | 0.6477169 | 0 |
chart dataframe created in chart_data() to reflect the percentage of units met the targets | def charting(lim=2020):
for indic in ['FLR ', 'CRE ', 'TISA', 'SSPI', 'US7 ']:
for c in ['A', 'M', 'P', 'T', 'all']:
# TODO: fix charting for SSPI - it returns three values
data = chart_data(indic, '2018-09-01', 12*5, c, lim=lim).set_index('date').sort_index()
y =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fundraise_piechart(dframe, target=15000):\n # find date of report run (usually appened to end of report in first column)\n for value in dframe['Contact Role']:\n try:\n if 'Generated' in value:\n for segment in value.split():\n i... | [
"0.5607518",
"0.5588294",
"0.55497134",
"0.5493036",
"0.5471481",
"0.5441912",
"0.540968",
"0.5407959",
"0.5401539",
"0.5393702",
"0.53325105",
"0.53251594",
"0.53240556",
"0.53185076",
"0.5302232",
"0.5271736",
"0.5246495",
"0.5240276",
"0.5217916",
"0.51861393",
"0.51847446... | 0.5623878 | 0 |
chart dataframe (as scatter) created in chart_data() | def scattered():
c = 'A'
i = 'FLR '
data = chart_data(i, '2018-09-01', 12*5, c).set_index('date').sort_index()
# print(data)
data.plot(kind='scatter', x='Perc.idv', y='Perc.ids') # ,c='Centre')
# plt.xticks(range(len(data)),data.index.tolist(),rotation=20)
# plt.axhline(y=100, color... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _scatter_example_3(data):\n # Plot the data\n ch = chartify.Chart(blank_labels=True, x_axis_type=\"datetime\")\n ch.plot.scatter(\n data_frame=data,\n x_column=\"date\",\n y_column=\"unit_price\",\n size_column=\"quantity\",\n color_column=\"fruit\",\n )\n ch.s... | [
"0.696473",
"0.6859107",
"0.68463117",
"0.6541971",
"0.65082794",
"0.6397974",
"0.63305575",
"0.6323484",
"0.6282535",
"0.6239813",
"0.62041914",
"0.6093777",
"0.60691404",
"0.60440475",
"0.60404783",
"0.6036908",
"0.60101837",
"0.6006857",
"0.5964689",
"0.5958484",
"0.592862... | 0.69041157 | 1 |
compare two sqlite PI_IndValues DB and write diffs into diff table; | def dbdiff(old, new):
# TODO: check the comparison and add the previous value(s) into the diff table
dir = "C:/Users/Volodymyr.Turbayevsk/Desktop/Docs/programming/R/indicators/zipDBCopy/"
logging.info(old + '->' + new)
engine = create_engine('sqlite:///' + dir + old + '.sqlite')
next_en = creat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def razcompare(self):\n connRepo = self.connect(self.cxRepo)\n sql = \"delete from {self.schemaRepo}.tablediff where step>0\"\n with connRepo:\n with connRepo.cursor() as curs:\n curs.execute(sql)\n sql = f\"\"\"udpate {self.schemaRepo}.tablediff set server1_st... | [
"0.5721453",
"0.5704419",
"0.5688827",
"0.5629298",
"0.56117886",
"0.5600046",
"0.5586763",
"0.55710196",
"0.5563941",
"0.5493394",
"0.5481742",
"0.54703635",
"0.5440157",
"0.54229254",
"0.541945",
"0.53910106",
"0.53806585",
"0.5372938",
"0.53507924",
"0.5341291",
"0.5300728... | 0.74494624 | 0 |
return a a dataframe object with the sensitivity and specificity for all the models in the dataframe scores (tn,fp,fn and tp). | def getSenSpeValuesByScores(datafram_scores):
sen_spe_values_vec = []
for index, row in datafram_scores.iterrows():
sensitivity = libraries.measures_calculation.calculateSensitivity(row['tn'], row['fp'], row['fn'], row['tp'])
specificity = libraries.measures_calculation.calculateSpecificity(row[... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def score(df, tmo, label):\n\n\tif str(type(tmo)) != \"<class 'sklearn.ensemble._forest.RandomForestRegressor'>\":\n\t\traise TypeError('Wrong model type!')\n\n\tX_test = df.loc[:, df.columns != label]\n\t\n\t# predict on test data\n\ty_pred = tmo.predict(X_test)\n\tdf['predict'] = y_pred\n\n\treturn df",
"def g... | [
"0.6351308",
"0.62085694",
"0.60583824",
"0.58898467",
"0.58857596",
"0.5876565",
"0.5854935",
"0.5800309",
"0.5788232",
"0.5785003",
"0.5774787",
"0.5759221",
"0.57526964",
"0.57422894",
"0.5722107",
"0.571696",
"0.57087576",
"0.569626",
"0.5685507",
"0.56836605",
"0.5661366... | 0.62919474 | 1 |
return a pandasDatafram filtered by the sensitivity and specificity | def filterDataframeBySenSpeLimit(value_sen, value_spe, dataframe_values_models):
datafram_values_filtered = dataframe_values_models.query('Sensitivity >= {0} and Specificity >= {1}'.format(value_sen, value_spe))
return datafram_values_filtered | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filterDataframeBySenSpeLimitContrary(value_sen, value_spe, dataframe_values_models):\n\n datafram_values_filtered = dataframe_values_models.query('Sensitivity < {0} or Specificity < {1}'.format(value_sen, value_spe))\n return datafram_values_filtered",
"def filter_patients(self):\n\n if self.dat... | [
"0.6283105",
"0.59321046",
"0.59147817",
"0.58202314",
"0.57689595",
"0.57322663",
"0.56981",
"0.56947404",
"0.5683785",
"0.55847675",
"0.5579376",
"0.55684865",
"0.55144626",
"0.54925483",
"0.54542375",
"0.5439213",
"0.54145217",
"0.5408246",
"0.53897417",
"0.53330564",
"0.5... | 0.6086207 | 1 |
return a pandasDatafram filtered by the sensitivity and specificity. This return the inverse of the limits | def filterDataframeBySenSpeLimitContrary(value_sen, value_spe, dataframe_values_models):
datafram_values_filtered = dataframe_values_models.query('Sensitivity < {0} or Specificity < {1}'.format(value_sen, value_spe))
return datafram_values_filtered | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filterDataframeBySenSpeLimit(value_sen, value_spe, dataframe_values_models):\n\n datafram_values_filtered = dataframe_values_models.query('Sensitivity >= {0} and Specificity >= {1}'.format(value_sen, value_spe))\n return datafram_values_filtered",
"def data_filter(\n df, CondTempRange=[float('-i... | [
"0.62525517",
"0.5784306",
"0.5749757",
"0.5676759",
"0.56637913",
"0.55624443",
"0.55553156",
"0.554391",
"0.5446718",
"0.5410978",
"0.5390618",
"0.53847355",
"0.535239",
"0.53331304",
"0.53201413",
"0.5319527",
"0.5309984",
"0.53064585",
"0.52934086",
"0.52859956",
"0.52789... | 0.6436738 | 0 |
return a list of the vector rules given a path model file | def getListRulesPerModel(path_model):
with open(path_model) as data_file:
data_json = json.load(data_file)
#pprint(len(data_json['rules']))
list_rules = data_json['rules']
return list_rules | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_rules(path):\n # type: (str) -> List[Tuple[AnyStr, AnyStr, AnyStr]]\n with open(path) as file:\n return parse_rules(file.read(), path)",
"def transformModelsToModelVarObj(list_models_path):\n list_models_vars = []\n for file_name_path in list_models_path:\n list_rules = getList... | [
"0.6337418",
"0.6270549",
"0.5808831",
"0.57977676",
"0.5773854",
"0.5698239",
"0.5684784",
"0.5674132",
"0.5562416",
"0.5552513",
"0.54325116",
"0.53824204",
"0.5355968",
"0.5301361",
"0.5294237",
"0.5277924",
"0.5260723",
"0.5252285",
"0.52191573",
"0.5183222",
"0.51687205"... | 0.6903637 | 0 |
return a list of model_var given a vector of rules (according to the structure) | def transformListRulesToModelVar(model_path, list_rules):
dict_var_qty = {}
for rule in list_rules:
variables_in_rule = rule[0]
for variable in variables_in_rule:
if variable[0] in dict_var_qty:
dict_var_qty[variable[0]] = dict_var_qty[variable[0]] + 1
els... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transformModelsToModelVarObj(list_models_path):\n list_models_vars = []\n for file_name_path in list_models_path:\n list_rules = getListRulesPerModel(file_name_path)\n model_var = transformListRulesToModelVar(file_name_path,list_rules)\n list_models_vars.append(model_var)\n return... | [
"0.67565286",
"0.6175802",
"0.5925038",
"0.59124666",
"0.57842046",
"0.5718866",
"0.5654402",
"0.5637661",
"0.5632623",
"0.55979496",
"0.5581548",
"0.5537441",
"0.5516785",
"0.5491804",
"0.54700035",
"0.5467291",
"0.5460307",
"0.543591",
"0.53885514",
"0.5370467",
"0.53584355... | 0.6685036 | 1 |
return a list model_var obj (see this class to understand what is it) based on a list of models path | def transformModelsToModelVarObj(list_models_path):
list_models_vars = []
for file_name_path in list_models_path:
list_rules = getListRulesPerModel(file_name_path)
model_var = transformListRulesToModelVar(file_name_path,list_rules)
list_models_vars.append(model_var)
return list_model... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_model_list():\n with open(os.path.join(MODELS_FOLDER, \"models.json\"), \"r\") as model_file:\n model_list = json.load(model_file)\n return model_list",
"def parameter_lists_for_model(self, model: AbstractPriorModel) -> List[float]:\n if self.is_path_kwargs:\n paths = model... | [
"0.6361709",
"0.6199795",
"0.6095818",
"0.5926312",
"0.5910624",
"0.58818686",
"0.5633365",
"0.56245583",
"0.55980605",
"0.55980605",
"0.5567548",
"0.5538526",
"0.552051",
"0.54753834",
"0.5442789",
"0.54362774",
"0.5426064",
"0.5419621",
"0.53376544",
"0.53309685",
"0.532839... | 0.73214364 | 0 |
return a dictionary with the frequencies of all the variables If the variable appear two times in a model it only count one | def countVarFreq(list_models_vars_freq):
list_variables_total = []
for model_var_freq in list_models_vars_freq:
variables_names = list(model_var_freq.dict_freq_var.keys())
list_variables_total.extend(variables_names)
counter_frec_variables = Counter(list_variables_total)
dict_frec_v... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def frequencies(self):\n dic = {}\n for word in self.words():\n dic[word] = dic.get(word, 0) + 1\n return dic",
"def freq_count(self):\n #eg: fc = spammy.freq_count()\n count_dict = defaultdict(int)\n for entry in self._train_list:\n if entry in sel... | [
"0.66403395",
"0.6630672",
"0.66018635",
"0.65474385",
"0.6342119",
"0.6335817",
"0.6262027",
"0.6228124",
"0.622065",
"0.6135556",
"0.61222184",
"0.611223",
"0.61059016",
"0.6104872",
"0.6086539",
"0.6079049",
"0.6056632",
"0.6030957",
"0.60051847",
"0.60010904",
"0.5994293"... | 0.78446215 | 0 |
return a dictionary reverse sorted by its values | def sort_reverse_dictionary_by_values(dicitonary_values):
#Sort the dictionary by values
sorted_dict_values = sorted(dicitonary_values.items(), key=lambda kv: kv[1], reverse=True)
#Transform in a dictionary
dict_sorted_values = dict((k[0],k[1]) for k in sorted_dict_values)
return dict_sorted_values | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _descending_values(d):\n d_tuples = list([(ky, float(val)) for ky, val in d.items()])\n d_tuples.sort(key=lambda t: t[1], reverse=True)\n return OrderedDict(d_tuples)",
"def sortDictionaryByValues(dictionary):\n items=dictionary.items()\n backitems=[ [v[1],v[0]] for v in items]\n ... | [
"0.7087785",
"0.7067285",
"0.6940441",
"0.68777895",
"0.6848628",
"0.67743003",
"0.67455363",
"0.6702293",
"0.66175365",
"0.64998436",
"0.64401543",
"0.64131755",
"0.63691056",
"0.6355151",
"0.62796354",
"0.62179714",
"0.6188938",
"0.6187233",
"0.61672145",
"0.61558783",
"0.6... | 0.72737134 | 0 |
Test case for retrieve_l_organization Organizations | def test_retrieve_l_organization(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_retrieve_l_organizations(self):\n pass",
"def test_get_organization(self):\n pass",
"def test_retrieve_l_organization_locations(self):\n pass",
"def test_organizations_list(self):\n pass",
"def test_getorgs(self):\n pass",
"def test_getorganizations_item(self):... | [
"0.90998673",
"0.8408835",
"0.8281598",
"0.78564435",
"0.7788948",
"0.7711566",
"0.764644",
"0.7263645",
"0.7107186",
"0.70974606",
"0.7080297",
"0.70490986",
"0.696621",
"0.68847847",
"0.6847462",
"0.68353933",
"0.6824173",
"0.6740781",
"0.6703354",
"0.664351",
"0.66247576",... | 0.9212768 | 0 |
Test case for retrieve_l_organization_locations Organization Locations | def test_retrieve_l_organization_locations(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_retrieve_l_organizations(self):\n pass",
"def test_retrieve_l_organization(self):\n pass",
"def test_getorgs(self):\n pass",
"def test_get_organization(self):\n pass",
"def generate_test_locations(self):\n def generate_locations_for_organization(\n ... | [
"0.79368585",
"0.7889656",
"0.6897446",
"0.68964434",
"0.6706266",
"0.66520286",
"0.6643623",
"0.66187805",
"0.65779436",
"0.65068",
"0.6446535",
"0.64247674",
"0.63992757",
"0.6360971",
"0.6264887",
"0.61562324",
"0.6126849",
"0.6117882",
"0.61067855",
"0.6072265",
"0.605323... | 0.92990893 | 0 |
Test case for retrieve_l_organizations Organizations | def test_retrieve_l_organizations(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_retrieve_l_organization(self):\n pass",
"def test_organizations_list(self):\n pass",
"def test_retrieve_l_organization_locations(self):\n pass",
"def test_get_organization(self):\n pass",
"def test_getorganizations_item(self):\n pass",
"def test_getorgs(self):\... | [
"0.8760034",
"0.8111214",
"0.8042687",
"0.8008577",
"0.79029566",
"0.7884515",
"0.77831376",
"0.73687166",
"0.7316363",
"0.7157773",
"0.70182896",
"0.7011177",
"0.6879291",
"0.6802428",
"0.6764412",
"0.67464083",
"0.67413956",
"0.67295873",
"0.6685559",
"0.66738224",
"0.66506... | 0.92882013 | 0 |
returns info of each layer of the baseline model with layer image path | def baseline(path = ""):
model = create_baseline(48, 0.5, None, None)
layer_name=[]
files = os.listdir(path)
for layer in model.layers:
check = path + "/" + layer.name + ".png"
if check in [path+'/'+f for f in files]:
if 'conv' in layer.name and (not 'bn' in layer.name) and ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_layers(self) :\n \n return self._layers",
"def layers(self):\n return self['layers']",
"def get_all_layers(model):\n layers = []\n for l in model.layers:\n if hasattr(l, 'layers'):\n layers += get_all_layers(l)\n else:\n layers.append(l)\n... | [
"0.58749354",
"0.586041",
"0.58264905",
"0.5741086",
"0.5718057",
"0.5714587",
"0.5695902",
"0.56512594",
"0.5642823",
"0.5639803",
"0.56073207",
"0.55606973",
"0.5545679",
"0.5536787",
"0.5411082",
"0.5381755",
"0.5330625",
"0.53295964",
"0.53182656",
"0.5317028",
"0.5304914... | 0.77881134 | 0 |
returns info of each layer of the googlenet model with layer image path | def googlenet(path = ""):
lr='0.001'
model = create_googlenet(48, 0.5)
files = os.listdir(path)
layer_name=[]
for layer in model.layers:
check = path + "/" + layer.name + ".png"
if check in [path+'/'+f for f in files]:
if 'conv' in layer.name and (not 'bn' in layer.name) ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def request_layers(url):\n layer_names = get_layers(url)\n for l in layer_names:\n print(\"Checking '%s'...\" % l)\n get_image(url, l, check_blank=True)",
"def _get_layers(self) :\n \n return self._layers",
"def layers(self):\n return self['layers']",
"def print_layer... | [
"0.6829889",
"0.66310006",
"0.6543045",
"0.65370345",
"0.65356624",
"0.6500424",
"0.643373",
"0.63885957",
"0.6333288",
"0.62843907",
"0.6221409",
"0.6149095",
"0.61454433",
"0.60956174",
"0.60861033",
"0.6071292",
"0.60635465",
"0.60454047",
"0.60245025",
"0.60117245",
"0.60... | 0.6898787 | 0 |
returns info of each layer of the mobilenet model with layer image path | def mobilenet(path = ""):
lr='0.0005'
model = create_mobilenet(48, 0.5)
layer_name=[]
files = os.listdir(path)
for layer in model.layers:
check = path + "/" + layer.name + ".png"
if check in [path+'/'+f for f in files]:
if 'conv' in layer.name and (not 'bn' in layer.name)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_layers(model):\r\n for i in range(len(model.layers)):\r\n print(\"Printing layer shape: %d\" % i, model.layers[i])\r\n weights = model.layers[i].get_weights()\r\n for weight in weights: # Layer type\r\n print(weight.shape)",
"def _get_layers(self) :\n \n ... | [
"0.63569474",
"0.6232437",
"0.61925966",
"0.6148661",
"0.6146664",
"0.61012375",
"0.6096571",
"0.60612625",
"0.5963642",
"0.5941732",
"0.59331226",
"0.584888",
"0.58306557",
"0.5809396",
"0.5767967",
"0.57432455",
"0.57275015",
"0.5717567",
"0.5713956",
"0.56950235",
"0.56926... | 0.7140373 | 0 |
returns info of each layer of the resnet model with layer image path | def resnet(path = ""):
lr='0.0001'
model = create_resnet(48, 0.5)
layer_name=[]
files = os.listdir(path)
for layer in model.layers:
check = path + "/" + layer.name + ".png"
if check in [path+'/'+f for f in files]:
if 'conv' in layer.name and (not 'bn' in layer.name) and (... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_layers(self) :\n \n return self._layers",
"def layers(self):\n return self['layers']",
"def print_layers(model):\r\n for i in range(len(model.layers)):\r\n print(\"Printing layer shape: %d\" % i, model.layers[i])\r\n weights = model.layers[i].get_weights()\r\n ... | [
"0.6266916",
"0.62381667",
"0.6172158",
"0.6094815",
"0.6065707",
"0.60457927",
"0.59643936",
"0.59621507",
"0.5950206",
"0.5922503",
"0.59163845",
"0.59037155",
"0.58740616",
"0.5840586",
"0.58338004",
"0.58138686",
"0.5808187",
"0.58058333",
"0.5757312",
"0.5679315",
"0.567... | 0.7090325 | 0 |
Test for Request model | def test_request_basic(self):
request = Request.objects.first()
self.assertEqual(request.path, 'request/')
self.assertEqual(request.viewed, False) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_save_request(self):\n\n entry = RequestEntry.objects.filter(path='/test_urn/')\n self.assertEqual(entry.count(), 0)\n self.client.get('/test_urn/')\n self.assertEqual(entry.count(), 1)",
"def test_request_model():\n new_request = models.Request(user_token='test_tokesn',\n ... | [
"0.68405426",
"0.66951084",
"0.6398994",
"0.633274",
"0.63213515",
"0.63008916",
"0.62942725",
"0.62931734",
"0.6264964",
"0.62233907",
"0.6221906",
"0.6178197",
"0.6171389",
"0.6168776",
"0.6155709",
"0.6146778",
"0.6144043",
"0.61373526",
"0.6132768",
"0.612409",
"0.6109196... | 0.7394075 | 0 |
Creates a serverstub pair with given interceptors. Returning the server object to protect it from being garbage collected. | async def _create_server_stub_pair(
*interceptors: aio.ServerInterceptor,
) -> Tuple[aio.Server, test_pb2_grpc.TestServiceStub]:
server_target, server = await start_test_server(interceptors=interceptors)
channel = aio.insecure_channel(server_target)
return server, test_pb2_grpc.TestServiceStub(channel) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def intercept_server(server, *interceptors):\n from grpc_opentracing.grpcext import _interceptor\n return _interceptor.intercept_server(server, *interceptors)",
"def create_server(\n max_workers: int,\n options: Optional[List[Tuple[str, Any]]] = None,\n interceptors: Optional[List[grpc... | [
"0.65742403",
"0.6161616",
"0.6092301",
"0.58553094",
"0.58087987",
"0.56531876",
"0.55611956",
"0.54887384",
"0.54680306",
"0.5413262",
"0.54113513",
"0.5403347",
"0.53919834",
"0.53656423",
"0.5340944",
"0.530253",
"0.52815795",
"0.52795255",
"0.52756506",
"0.52720517",
"0.... | 0.8046914 | 0 |
For loop impl of reduce in Python that honors sentinal wrapper Reduced and uses it to signal early termination. | def reduce(function, iterable, initializer=Missing):
if initializer is Missing:
accum_value = function() # 0 arity initializer.
else:
accum_value = initializer
for x in iterable:
accum_value = function(accum_value, x)
if isinstance(accum_value, Reduced): # <-- here's where w... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reduce_run():",
"def ireduce(f, it):\n acc = it.next()\n yield acc\n for x in it:\n acc = f(acc, x)\n yield acc",
"def do_reduce(iterable, fn, initial=None):\n if initial is not None:\n return reduce(GlobalFns(fn), iterable, initial)\n else:\n return reduce(Global... | [
"0.7029641",
"0.6798094",
"0.6311367",
"0.6142787",
"0.59432197",
"0.5883633",
"0.5758198",
"0.5734002",
"0.5729185",
"0.555836",
"0.554458",
"0.5542889",
"0.5509421",
"0.5509421",
"0.5509421",
"0.5509421",
"0.5509421",
"0.55050355",
"0.54910845",
"0.5453782",
"0.54265445",
... | 0.7102042 | 0 |
Compose functions using reduce on splat. compose(f, g) reads 'f composed with g', or f(g(x)) | def compose(*fns):
return functools.reduce(lambda f,g: lambda x: f(g(x)), fns) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compose(*fns):\n import functools\n\n def _apply(x, f):\n if isinstance(x, tuple):\n return f(*x)\n else:\n return f(x)\n\n def comp(*args):\n return functools.reduce(_apply, fns, args)\n\n return comp",
"def compose_many(*fs):\n return reduce(compose... | [
"0.7428329",
"0.73412967",
"0.733282",
"0.7329615",
"0.7317206",
"0.7145176",
"0.70295495",
"0.70178986",
"0.7006621",
"0.6979586",
"0.6964924",
"0.6908402",
"0.67738587",
"0.6738681",
"0.6722882",
"0.6644048",
"0.6611082",
"0.6608497",
"0.65725374",
"0.6558173",
"0.64756894"... | 0.7371172 | 1 |
Transducer version of map, returns f(item) with each reduction step. | def map(f):
def _map_xducer(step):
def _map_step(r=Missing, x=Missing):
if r is Missing: return step()
return step(r) if x is Missing else step(r, f(x))
return _map_step
return _map_xducer | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def simple_map(f, l):\n # Again, my first take is a list comprehension.\n return [ f(item) for item in l ]",
"def simple_map_2(f, l):\n # Same as above without comprehension:\n mapped_l = []\n for item in l:\n mapped_l.append( f(item) ) # the extra blanks are just for readability\n retur... | [
"0.71082574",
"0.7086972",
"0.6931073",
"0.6916699",
"0.6869305",
"0.68181884",
"0.6668191",
"0.6556822",
"0.65326244",
"0.64474636",
"0.6414421",
"0.637057",
"0.6341997",
"0.63179666",
"0.63035303",
"0.6293294",
"0.62459564",
"0.6243685",
"0.6229733",
"0.6194867",
"0.6193386... | 0.72072196 | 0 |
Transducer version of filter. | def filter(pred):
def _filter_xducer(step):
def _filter_step(r=Missing, x=Missing):
if r is Missing: return step()
if x is Missing:
return step(r)
return step(r, x) if pred(x) else r
return _filter_step
return _filter_xducer | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter(self, filters):",
"def filter(iteratee, seq):\n return _filter(fnc.iteratee(iteratee), seq)",
"def filter(self,state0):\n ok,tchi2 = True,0.\n state = state0.copy()\n ii = 0\n for node in self.nodes:\n zrun = node.zrun\n ok,state,F,Q = self.model.... | [
"0.62918854",
"0.6263525",
"0.62519073",
"0.6202291",
"0.60997903",
"0.6027823",
"0.6010915",
"0.5924559",
"0.59104764",
"0.5907264",
"0.58717513",
"0.57966006",
"0.5790738",
"0.5756974",
"0.57300127",
"0.5722221",
"0.57052356",
"0.56840384",
"0.5625489",
"0.5608139",
"0.5603... | 0.64526176 | 0 |
Mapcat transducer maps to a collection then cats item into one less level of nesting. | def mapcat(f):
return compose(map(f), cat) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mapcat(iteratee, *seqs):\n return concat(*map(iteratee, *seqs))",
"def mapcat(f, seqs):\n return concat(map(f, seqs))",
"def flat_map(fn, collection):\n return chain.from_iterable(map(fn, collection))",
"def mapflatdeep(iteratee, *seqs):\n return flattendeep(map(iteratee, *seqs))",
"def _ma... | [
"0.67169845",
"0.5947113",
"0.593782",
"0.55013025",
"0.5464157",
"0.5455989",
"0.5386271",
"0.5364641",
"0.5336661",
"0.5333093",
"0.52960485",
"0.5293454",
"0.52376324",
"0.51577437",
"0.51029867",
"0.50944924",
"0.5020107",
"0.49496916",
"0.49038225",
"0.4845615",
"0.48419... | 0.66856605 | 1 |
Takes while a condition is true. Note that take_while will take the first input that tests false, so be mindful of mutable input sources. | def take_while(pred):
def _take_while_xducer(step):
def _take_while_step(r=Missing, x=Missing):
if r is Missing: return step()
if x is Missing:
return step(r)
return step(r, x) if pred(x) else Reduced(r)
return _take_while_step
return _take_whi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def take_until(condition):\n return partial(takewhile, pipe | condition | operator.not_)",
"def while_do(condition: Callable[[Any], bool], source: ObservableBase) -> ObservableBase:\n from ..operators.observable.whiledo import while_do\n return while_do(condition, source)",
"def take_while(pre... | [
"0.75774056",
"0.7183836",
"0.6970755",
"0.68152565",
"0.6642728",
"0.6564559",
"0.6414927",
"0.63926256",
"0.63853824",
"0.6355998",
"0.6204189",
"0.6172875",
"0.612178",
"0.5996977",
"0.5927247",
"0.5905781",
"0.58939254",
"0.5853426",
"0.58456385",
"0.5827582",
"0.5800286"... | 0.7529158 | 1 |
Replaces keys in smap with corresponding values. | def replace(smap):
def _replace_xducer(step):
def _replace_step(r=Missing, x=Missing):
if r is Missing: return step()
if x is Missing:
return step(r)
if x in smap:
return step(r, smap[x])
else:
return step(r, x)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def replace_substrings(s, mapping):\n for (s1, repl) in mapping:\n s = s.replace(s1, repl)\n return s",
"def replacer(s,replace_dict):\n for k,v in replace_dict.items(): s = s.replace(k,v)\n return s",
"def set(self, keys, values):\n already = dict(zip(self._trans_dict.values(),self._... | [
"0.64755005",
"0.6418367",
"0.64172935",
"0.63835394",
"0.6345114",
"0.62664294",
"0.6211807",
"0.6080112",
"0.6066428",
"0.59368306",
"0.5921202",
"0.5919982",
"0.58929557",
"0.5870776",
"0.58548653",
"0.5818984",
"0.5816301",
"0.5794304",
"0.5776831",
"0.57469904",
"0.57404... | 0.6435995 | 1 |
Keep pred items for which pred does not return None. | def keep(pred):
def _keep_xducer(step):
def _keep_step(r=Missing, x=Missing):
if r is Missing: return step()
if x is Missing:
return step(r)
res = pred(x)
return step(r, res) if res is not None else r
return _keep_step
return _keep_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def keep(oin, env, pred_name: YPredName, arg: Any=None):\n return (obj for obj in oin if env.check_predicate(obj, pred_name, arg))",
"def filter(pred):\n def _filter_xducer(step):\n def _filter_step(r=Missing, x=Missing):\n if r is Missing: return step()\n if x is Missing:\n ... | [
"0.6538696",
"0.6223753",
"0.60223174",
"0.58947355",
"0.57204354",
"0.5712112",
"0.57030946",
"0.5679185",
"0.56454283",
"0.56133366",
"0.56065446",
"0.5576753",
"0.5559917",
"0.552689",
"0.54817",
"0.5469188",
"0.5459766",
"0.53858924",
"0.5383134",
"0.53330475",
"0.5314482... | 0.6466616 | 1 |
Remove anything that satisfies pred. | def remove(pred):
def _remove_xducer(step):
def _remove_step(r=Missing, x=Missing):
if r is Missing: return step()
if x is Missing:
return step(r)
return step(r, x) if not pred(x) else r
return _remove_step
return _remove_xducer | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def removepredicate(self, pred):\n self._preds.remove(pred)",
"def keep(oin, env, pred_name: YPredName, arg: Any=None):\n return (obj for obj in oin if env.check_predicate(obj, pred_name, arg))",
"def drop(oin, env, pred_name: YPredName, arg: Any=None):\n return (obj for obj in oin if not env.chec... | [
"0.8060674",
"0.67985487",
"0.6763179",
"0.67446786",
"0.66539854",
"0.64364445",
"0.63090956",
"0.6153212",
"0.59919184",
"0.59866333",
"0.59832275",
"0.59747016",
"0.5835441",
"0.57822657",
"0.5682632",
"0.5618432",
"0.5593123",
"0.5575366",
"0.55707157",
"0.5569582",
"0.55... | 0.7012591 | 1 |
Keep values where f does not return None. f for keep indexed is a function that takes both index and value as inputs. | def keep_indexed(f):
def _keep_indexed_xducer(step):
outer = {"idx": 0}
def _keep_indexed_step(r=Missing, x=Missing):
if r is Missing: return step()
if x is Missing:
return step(r)
res = f(outer["idx"], x)
outer["idx"] += 1
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ffill(arr, value=0):\n ndims = len(arr.shape)\n ran = np.arange(arr.shape[ndims-1])\n idx = np.where((arr != value), ran, 0)\n idx = np.maximum.accumulate(idx, axis=ndims-1)\n if ndims == 2:\n return arr[np.arange(idx.shape[0])[:, None], idx]\n return arr[idx]",
"def remove_filler(dg... | [
"0.5301614",
"0.52709675",
"0.522234",
"0.5201062",
"0.51979285",
"0.5182091",
"0.5182091",
"0.5064535",
"0.5025108",
"0.50104934",
"0.49593228",
"0.49518463",
"0.49200603",
"0.49187472",
"0.4898326",
"0.48338556",
"0.4825826",
"0.4821068",
"0.48164788",
"0.48150504",
"0.4767... | 0.69844073 | 0 |
Transduces items from coll into target. | def into(target, xducer, coll):
return transduce(xducer, append, target, coll) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def eduction(xf, coll):\n raise NotImplementedError",
"def _proj_out(bases, vec):\n for i in bases:\n vec -= vec.project(i)\n return vec",
"def move_to_collection(self, destination_collection):\n for entity in self:\n entity.move_to_collection(destination_collection)",
"def ... | [
"0.58851916",
"0.564655",
"0.55794936",
"0.5557976",
"0.5258974",
"0.52586657",
"0.5113035",
"0.5013188",
"0.49877483",
"0.4977792",
"0.49196208",
"0.49159983",
"0.4915428",
"0.48897424",
"0.48876464",
"0.48169947",
"0.48131686",
"0.480448",
"0.4802099",
"0.47601357",
"0.4747... | 0.66381115 | 0 |
Slide from (x1, y1) to (x2, y2) | def slide(x1, y1, x2, y2):
gui.mouseDown(x1, y1)
gui.moveTo(x2, y2)
release() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_to(self, x, y):\n self.x = x\n self.y = y",
"def move_to(self, x, y):\n self.x = x\n self.y = y",
"def moveTo(self, x: int, y: int):\n raise NotImplementedError",
"def move_to(self, x, y):\n self._impl.move_to(x, y)",
"def move_to_position2(self):",
"def... | [
"0.6673118",
"0.6673118",
"0.6490052",
"0.6466581",
"0.64208513",
"0.62540203",
"0.6208389",
"0.61991763",
"0.6176867",
"0.61728257",
"0.6162009",
"0.6155013",
"0.6139139",
"0.61119753",
"0.60250837",
"0.6006211",
"0.6005938",
"0.60059375",
"0.5991591",
"0.5985731",
"0.596559... | 0.79361194 | 0 |
Returns the associated isolate server. | def isolate_server(self):
assert self._server
return self._server | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isolate_server(self):\n return self._isolate_server",
"def get_server():\n\n instance = Ceic._get_instance()\n\n return instance._ceic_configuration.server",
"def get_server(self):\n return self.__server",
"def get_server(self):\n\n pass",
"def server(self):\n retu... | [
"0.82752734",
"0.73025125",
"0.71850723",
"0.6969313",
"0.68301916",
"0.68301916",
"0.6823826",
"0.66718084",
"0.6631983",
"0.65645224",
"0.64063483",
"0.64063483",
"0.64063483",
"0.6386203",
"0.63352203",
"0.63291883",
"0.6287141",
"0.6282834",
"0.6258896",
"0.60610104",
"0.... | 0.8056107 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.