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
Setter method for config, mapped from YANG variable /qos/classifiers/classifier/terms/term/actions/config (container)
def _set_config(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: t = YANGDynClass(v,base=yc_config_openconfig_qos_elements__qos_classifiers_classifier_terms_term_actions_config, is_container='container', yang_name="config", parent=self, path_helper=self._path_helper, extmethods=se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _set_config(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=yc_config_openconfig_qos__qos_classifiers_classifier_terms_term_actions_config, is_container='container', yang_name=\"config\", parent=self, path_helper=self._path_helper, extmethod...
[ "0.7753501", "0.7675862", "0.7008285", "0.6946487", "0.6942015", "0.69097257", "0.6899828", "0.6890862", "0.6761178", "0.6748173", "0.6712947", "0.67033094", "0.66637194", "0.6626415", "0.62444615", "0.6207965", "0.6195187", "0.59189385", "0.58433783", "0.5840088", "0.5546627...
0.76947004
1
Setter method for fabric_priority, mapped from YANG variable /qos/forwarding_groups/forwarding_group/state/fabric_priority (uint8)
def _set_fabric_priority(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: t = YANGDynClass(v,base=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), is_leaf=True, yang_name="fabric-priority", parent=self, path_helper=self._path_helper, extmetho...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _set_fabric_priority(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), is_leaf=True, yang_name=\"fabric-priority\", parent=self, path_helper=self._path_hel...
[ "0.8703112", "0.8703112", "0.8703112", "0.68219924", "0.68219924", "0.68219924", "0.68219924", "0.68219924", "0.68219924", "0.6466212", "0.5697737", "0.5620686", "0.5620686", "0.5620686", "0.54876095", "0.54821587", "0.5458027", "0.53546315", "0.53224856", "0.52495664", "0.52...
0.8709492
1
Setter method for output_queue, mapped from YANG variable /qos/forwarding_groups/forwarding_group/state/output_queue (leafref)
def _set_output_queue(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: t = YANGDynClass(v,base=ReferenceType(referenced_path='../../../../queues/queue/config/name', caller=self._path() + ['output-queue'], path_helper=self._path_helper, require_instance=True), is_leaf=True, yang_na...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _set_output_queue(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=ReferenceType(referenced_path='../../../../queues/queue/config/name', caller=self._path() + ['output-queue'], path_helper=self._path_helper, require_instance=True), is_leaf=Tr...
[ "0.84071624", "0.84071624", "0.84071624", "0.6145043", "0.6145043", "0.6145043", "0.6145043", "0.6145043", "0.6145043", "0.58650875", "0.583755", "0.5777044", "0.5709037", "0.5692527", "0.56790125", "0.55928755", "0.55928755", "0.55928755", "0.5590846", "0.5590846", "0.559084...
0.8416613
0
Setter method for queue_type, mapped from YANG variable /qos/queues/queue/config/queue_type (identityref)
def _set_queue_type(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: t = YANGDynClass(v,base=RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'WRED': {'@namespace': u'http://openconfig.net/yang/qos-types', '@module': u'openconfig-qos-types'}, u...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _set_queue_type(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=RestrictedClassType(base_type=unicode, restriction_type=\"dict_key\", restriction_arg={u'WRED': {'@namespace': u'http://openconfig.net/yang/qos-types', '@module': u'openconfig-q...
[ "0.8188465", "0.8188465", "0.8188465", "0.58452153", "0.58452153", "0.58452153", "0.58452153", "0.58452153", "0.58452153", "0.58246166", "0.58246166", "0.58246166", "0.5821027", "0.5821027", "0.5821027", "0.5613775", "0.5608145", "0.5607709", "0.5567809", "0.55473167", "0.551...
0.8189401
0
Setter method for type, mapped from YANG variable /qos/scheduler_policies/scheduler_policy/schedulers/scheduler/config/type (identityref)
def _set_type(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: t = YANGDynClass(v,base=RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'TWO_RATE_THREE_COLOR': {'@namespace': u'http://openconfig.net/yang/qos-types', '@module': u'openconfig-qos-...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _set_type(self, v, load=False):\n parent = getattr(self, \"_parent\", None)\n if parent is not None and load is False:\n raise AttributeError(\"Cannot set keys directly when\" +\n \" within an instantiated list\")\n\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n...
[ "0.6079179", "0.6079179", "0.6079179", "0.6079179", "0.6079179", "0.6079179", "0.5856121", "0.5820195", "0.5820195", "0.5820195", "0.5818998", "0.5818998", "0.5818998", "0.5786819", "0.5742643", "0.5666232", "0.5666232", "0.5666232", "0.5655157", "0.5655157", "0.5535465", "...
0.69181323
1
Setter method for output_type, mapped from YANG variable /qos/scheduler_policies/scheduler_policy/schedulers/scheduler/output/state/output_type (enumeration)
def _set_output_type(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: t = YANGDynClass(v,base=RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'INTERFACE': {}, u'FWD_GROUP'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _set_output_type(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=RestrictedClassType(base_type=unicode, restriction_type=\"dict_key\", restriction_arg={u'INTERFACE': {},...
[ "0.7817635", "0.7817635", "0.7817635", "0.75405216", "0.7092058", "0.67754036", "0.66114086", "0.658952", "0.6548502", "0.65262413", "0.6414229", "0.6414229", "0.6414229", "0.6414229", "0.6414229", "0.6414229", "0.61669576", "0.60286003", "0.60150146", "0.59828776", "0.586021...
0.78202087
0
Setter method for child_scheduler, mapped from YANG variable /qos/scheduler_policies/scheduler_policy/schedulers/scheduler/output/state/child_scheduler (leafref)
def _set_child_scheduler(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: t = YANGDynClass(v,base=ReferenceType(referenced_path='../../../../../../../scheduler-policies/scheduler-policy/config/name', caller=self._path() + ['child-scheduler'], path_helper=self._path_helper, require...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _set_child_scheduler(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=ReferenceType(referenced_path='../../../../../../../scheduler-policies/scheduler-policy/config/name', caller=self._path() + ['child-scheduler'], path_helper=self._path_help...
[ "0.87512016", "0.87512016", "0.87512016", "0.619783", "0.619783", "0.619783", "0.619783", "0.619783", "0.619783", "0.5622926", "0.5619009", "0.55892956", "0.55092835", "0.5505467", "0.549857", "0.54943466", "0.5480284", "0.5470563", "0.5122367", "0.5072427", "0.5065212", "0...
0.8754882
0
Setter method for output_fwd_group, mapped from YANG variable /qos/scheduler_policies/scheduler_policy/schedulers/scheduler/output/state/output_fwd_group (leafref)
def _set_output_fwd_group(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: t = YANGDynClass(v,base=ReferenceType(referenced_path='../../../../../../../forwarding-groups/forwarding-group/config/name', caller=self._path() + ['output-fwd-group'], path_helper=self._path_helper, requir...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _set_output_fwd_group(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=ReferenceType(referenced_path='../../../../../../../forwarding-groups/forwarding-group/config/name', caller=self._path() + ['output-fwd-group'], path_helper=self._path_hel...
[ "0.8849426", "0.8849426", "0.8849426", "0.7297854", "0.7297854", "0.7297854", "0.7297854", "0.7297854", "0.7297854", "0.54066", "0.5398142", "0.53769094", "0.5190799", "0.50763273", "0.50763273", "0.50763273", "0.50733656", "0.50733656", "0.50733656", "0.5014509", "0.5014509"...
0.88560826
0
Setter method for classifiers, mapped from YANG variable /qos/classifiers (container)
def _set_classifiers(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: t = YANGDynClass(v,base=yc_classifiers_openconfig_qos_elements__qos_classifiers, is_container='container', yang_name="classifiers", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, regist...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _set_classifiers(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=yc_classifiers_openconfig_qos_interfaces__qos_classifiers, is_container='container', yang_name=\"classifiers\", parent=self, path_helper=self._path_helper, extmethods=self._ext...
[ "0.82530403", "0.8241558", "0.7123468", "0.7094438", "0.70506966", "0.6976243", "0.694139", "0.69180167", "0.6889296", "0.68863773", "0.6857859", "0.6479475", "0.6362965", "0.6342974", "0.62938404", "0.62655514", "0.6226275", "0.6226275", "0.6226275", "0.6222281", "0.6210237"...
0.8259568
0
Setter method for qos, mapped from YANG variable /qos (container)
def _set_qos(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: t = YANGDynClass(v,base=yc_qos_openconfig_qos_elements__qos, is_container='container', yang_name="qos", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, name...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _set_qos(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=yc_qos_openconfig_qos__qos, is_container='container', yang_name=\"qos\", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, ...
[ "0.8609246", "0.85111344", "0.7597798", "0.7596655", "0.7364632", "0.734918", "0.73001933", "0.7288749", "0.7147441", "0.688754", "0.68543226", "0.6760626", "0.6681731", "0.6681731", "0.6681731", "0.6644931", "0.66224885", "0.65287834", "0.64852667", "0.64273447", "0.6204437"...
0.8545393
1
Get special publickey class by chain name
def get_chain_publickey_class(chain_name): if not isinstance(chain_name, str): raise TypeError("Parameter chain_type must be a str type") special_class_name = chain_name.upper() + 'PublicKey' special_class = getattr(chain_public_key, special_class_name, None) if special_cla...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_chain_privatekey_class(chain_name):\n if not isinstance(chain_name, str):\n raise TypeError(\"Parameter chain_type must be a str type\")\n\n special_class_name = chain_name.upper() + 'PrivateKey'\n special_class = getattr(chain_private_key, special_class_name, None)\n\n ...
[ "0.70200235", "0.5786376", "0.5693633", "0.56712514", "0.556306", "0.5497301", "0.5420272", "0.5407898", "0.5402335", "0.53959894", "0.5393334", "0.5364388", "0.5338761", "0.5319936", "0.5311926", "0.531006", "0.5299957", "0.5281626", "0.5257811", "0.5257811", "0.5253967", ...
0.8302043
0
Get special privatekey class by chain name
def get_chain_privatekey_class(chain_name): if not isinstance(chain_name, str): raise TypeError("Parameter chain_type must be a str type") special_class_name = chain_name.upper() + 'PrivateKey' special_class = getattr(chain_private_key, special_class_name, None) if special_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_chain_publickey_class(chain_name):\n if not isinstance(chain_name, str):\n raise TypeError(\"Parameter chain_type must be a str type\")\n\n special_class_name = chain_name.upper() + 'PublicKey'\n special_class = getattr(chain_public_key, special_class_name, None)\n\n ...
[ "0.73345137", "0.6184118", "0.5900513", "0.5676384", "0.561138", "0.55520713", "0.55074745", "0.54260904", "0.54236543", "0.54126894", "0.5387696", "0.53570294", "0.5345783", "0.5341593", "0.533357", "0.5326266", "0.52903", "0.52700853", "0.5246799", "0.523326", "0.5227396", ...
0.82060266
0
Create a csv at data/processed/fda_tags.csv.
def save_csv(entities): project_root = os.environ['PYTHONPATH'] with open('{}/data/processed/fda_tags.csv'.format(project_root), 'w', newline="") as output_file: writer = csv.writer(output_file) for entity, file_name in entities.items(): writer.writerow([entity, file_name])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_csv(self):\n try:\n # Convert List of Lists to DataFrame and write it to a CSV\n pd.DataFrame(self.data, columns=self.header) \\\n .to_csv(os.path.join(self.file_path, self.file_name), index=False)\n self.successful_run = True\n except:\n ...
[ "0.6521327", "0.6518673", "0.64840883", "0.64822674", "0.6449399", "0.64278305", "0.64200765", "0.6351564", "0.63418496", "0.62822706", "0.6264051", "0.6242414", "0.622792", "0.6190316", "0.6150013", "0.61265075", "0.60137904", "0.59682465", "0.5953714", "0.59530944", "0.5933...
0.7170449
0
add a ReportCase to the group
def add_case(self, case_obj): self.cases.append(case_obj)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_test_case(self, test_case_name, test_case):\n\n self._test_cases[test_case_name] = test_case", "def add_case(self, name):\n mod = self._mod\n std = mod.give_aster_study()\n prefs = aster_s_gui.AsterPreferences()\n \n case = std.add_case(self.find_new_name(std, na...
[ "0.6237872", "0.5863993", "0.58544415", "0.5831309", "0.57800025", "0.57660055", "0.5737593", "0.56749934", "0.55061084", "0.5502182", "0.5452439", "0.5448897", "0.54385877", "0.54353064", "0.542006", "0.5385378", "0.53229624", "0.5295082", "0.52944016", "0.5281046", "0.52491...
0.6893121
0
Summarize completed test report cases for the entire group Once all ReportCase objects in the group's "cases" list are completed (ie. validation methods have been run and case object properties finalized), this method will summarize/aggregate the pass,failure, warning, skipped counts into a single ReportSummary object,...
def summarize(self): def increment_summary(summary_obj, case_obj): """increment ReportSummary count was ReportCase status Whatever the status of the case object, the corresponding property will be incremented by 1 in the summary object Args: sum...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def summarize(self):\n \n print self._num_tests, \"tests ran with\", len(self._failed_tests), \"failures:\", sorted(list(self._failed_tests))\n\n self._num_tests = 0\n self._failed_tests = set()", "def summary(args, json_logs, all_logs):\n all_data = process_logs(json_logs)\n if...
[ "0.6726409", "0.62247014", "0.6195111", "0.5953109", "0.59407234", "0.59068424", "0.589801", "0.5834184", "0.57976574", "0.57773745", "0.56817347", "0.5623849", "0.55982476", "0.5593549", "0.5587234", "0.5579308", "0.55545485", "0.55511916", "0.55486363", "0.55376333", "0.552...
0.7360044
0
increment ReportSummary count was ReportCase status Whatever the status of the case object, the corresponding property will be incremented by 1 in the summary object
def increment_summary(summary_obj, case_obj): summary_obj.increment(case_obj.get_status())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def summarize(self):\n\n def increment_summary(summary_obj, case_obj):\n \"\"\"increment ReportSummary count was ReportCase status\n\n Whatever the status of the case object, the corresponding property\n will be incremented by 1 in the summary object\n\n Args:\n ...
[ "0.7471274", "0.67572695", "0.5988539", "0.59391177", "0.593637", "0.59350777", "0.5892036", "0.588228", "0.579597", "0.56581557", "0.5656422", "0.56543165", "0.5618947", "0.5562755", "0.55201346", "0.54926676", "0.54926676", "0.5486988", "0.54549104", "0.54328424", "0.536852...
0.81073225
0
Extract All serializable_ops declarations from the sources and generate a serializable_array with it.
def extract_serializable(target, source, env): target = map(str,target) source = map(str,source) files = "" for f in source: files += " " + f serializable = map(str.strip, os.popen("sed -nre s/'.*DECLARE_KSERIALIZABLE_OPS\(([A-Za-z_][A-Za-z0-9_]*)\).*/\\1_serializable_ops/p'" + files).readlines())...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_code(self):\r\n ret = []\r\n for x in [y.type for y in self.variables] + [\r\n y.op for y in self.node_order]:\r\n try:\r\n ret += x.c_init_code()\r\n except utils.MethodNotDefined:\r\n pass\r\n return utils.uniq(ret)", ...
[ "0.5436233", "0.53608954", "0.53360826", "0.53100693", "0.5196691", "0.5176061", "0.51618457", "0.5157441", "0.50943583", "0.5072418", "0.5072328", "0.50484145", "0.5035929", "0.50296754", "0.50295705", "0.5010275", "0.49399534", "0.49374524", "0.49338317", "0.4921788", "0.48...
0.6642127
0
Extract All test functions from the sources and generate a test_array with it.
def extract_tests(target, source, env): target = map(str,target) source = map(str,source) files = "" for f in source: files += " " + f tests = map(str.strip, os.popen("sed -nre s/'.*UNIT_TEST\(([A-Za-z_][A-Za-z0-9_]*)\).*/__test_\\1/p'" + files).readlines()) f = file(target[0], "w") f.wri...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tests(test_sources, headers, deps):\n tests = [compile(src, headers) for src in test_sources]\n return [*random.sample(tests, len(tests))]", "def get_tests():\n # tests = ['test_build_gaussian_pyramid_random', 'test_build_gaussian_pyramid_static', 'test_build_laplacian_pyramid_random', 'test_build_l...
[ "0.69420505", "0.68925446", "0.65394074", "0.6314652", "0.6279704", "0.6253576", "0.62524784", "0.6249327", "0.6240159", "0.6197071", "0.61414826", "0.613656", "0.61142665", "0.6112904", "0.6100098", "0.6092026", "0.609175", "0.6048249", "0.60387415", "0.5993707", "0.58848804...
0.6942902
0
Custom astropy model for the autocorrelation of the Larkin transform.
def larkin_autocor_model(x,y,amplitude=1.,x_mean_0=0.,y_mean_0=0.,width=1.,background=0.): intensity = 1./(2*np.pi) * (width/((x-x_mean_0)**2 + (y-y_mean_0)**2 + width**2)**1.5) # 2D Lorentzian works well intensity *= amplitude / np.max(intensity) intensity += background return intensity
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def autocorrelate(self, mode='full'):\n return self.correlate(self, mode=mode)", "def autocorrelate(self, mode='full', pearson=None, normalize=False):\n new_data, new_bset = self._correlate(self, mode, pearson, normalize)\n n, m = new_data.shape\n center = new_data[n // 2, m // 2]\n ...
[ "0.6276287", "0.5675344", "0.5632551", "0.5537154", "0.5537154", "0.5466875", "0.5382376", "0.52871406", "0.5217979", "0.5206586", "0.5156632", "0.5136885", "0.5132465", "0.51303536", "0.5083371", "0.5066815", "0.50549936", "0.49848264", "0.49837676", "0.4983254", "0.49832436...
0.5968839
1
Custom astropy model for the Larkin Transform of an image. Each peak should follow J1(R)/R, whereas the AiryDisk2D is (J1(R)/R)2 . So this function uses sqrt(AiryDisk2D) plus a background term, and should be fit to the absolute value of the LarkinTransformed image.
def larkin_model(x,y,amplitude=1.,x_0=0.,y_0=0.,radius=1.,background = 0.): intensity = models.AiryDisk2D.evaluate(x,y,amplitude=amplitude,x_0=x_0,y_0=y_0,radius=radius) intensity = np.sqrt(np.abs(intensity)) intensity += background return intensity
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def larkin_transform_fit(params,transformed_im,plot=True,fit_airy=False,rough_sep_pix = 45):\n x0,y0,flux0,width0,sep,pa,flux1,width1 = params\n \n rough_sep_pix = int(round(rough_sep_pix))\n \n im_shape = transformed_im.shape\n y,x = np.indices(im_shape)\n y -= im_shape[0]//2\n x -= im_sha...
[ "0.6433322", "0.56984633", "0.51532596", "0.51216185", "0.50955576", "0.50230247", "0.50141144", "0.4991178", "0.49736372", "0.49611297", "0.49544144", "0.49280855", "0.49128085", "0.48942685", "0.48766693", "0.48654518", "0.48501238", "0.48463643", "0.48053038", "0.4797296", ...
0.6747487
0
Function to fit to the Larkin Transform of the image. params = [x0, y0, flux0, width0, sep, pa, flux1, width1] x0, y0 = position of primary relative to the central pixel flux0, flux1 = flux of primary and secondary width0,width1 = width of model for the primary and secondary sep,pa = separation and position angle of th...
def larkin_transform_fit(params,transformed_im,plot=True,fit_airy=False,rough_sep_pix = 45): x0,y0,flux0,width0,sep,pa,flux1,width1 = params rough_sep_pix = int(round(rough_sep_pix)) im_shape = transformed_im.shape y,x = np.indices(im_shape) y -= im_shape[0]//2 x -= im_shape[1]//2 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fit(\n self,\n img: np.array,\n debug_mode: bool = False,\n crop_inside_input_canvas: bool = False\n ):\n input_landmarks = self.predict_landmarks(img)\n transform_matrix_0 = make_transform_matrix(*self.compute_fit_params(input_landmarks))\n\n ...
[ "0.5452657", "0.542686", "0.50089985", "0.48959357", "0.48534596", "0.48393694", "0.48097762", "0.47962236", "0.47917128", "0.4758458", "0.47471312", "0.4734518", "0.47336176", "0.47181845", "0.4711118", "0.46912268", "0.46809337", "0.4680599", "0.466322", "0.4662773", "0.465...
0.8080511
0
Factory for positional paramater.
def positional(cls, type_, value): return cls(None, type_, value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def positional(cls, *sub_params):\n return cls(None, *sub_params)", "def test_create_positional_only(self, extra_in, extra_out):\n kwargs = dict(\n type=int,\n converter=dummy_converter,\n validator=dummy_validator,\n metadata={'meta': 'data'},\n )...
[ "0.67748505", "0.67433304", "0.6643681", "0.6591227", "0.64945084", "0.63933545", "0.6303821", "0.6157385", "0.61376953", "0.6107468", "0.60313785", "0.60313785", "0.60313785", "0.60313785", "0.60313785", "0.60313785", "0.60313785", "0.60313785", "0.60313785", "0.60313785", "...
0.68461674
0
Construct JSON API representation for the parameter.
def to_api_repr(self): value = self.value converter = _SCALAR_VALUE_TO_JSON_PARAM.get(self.type_) if converter is not None: value = converter(value) resource = { "parameterType": {"type": self.type_}, "parameterValue": {"value": value}, } ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_api_repr(self):\n s_types = {}\n values = {}\n for name, value in self.struct_values.items():\n type_ = self.struct_types[name]\n if type_ in (\"STRUCT\", \"ARRAY\"):\n repr_ = value.to_api_repr()\n s_types[name] = {\"name\": name, \"t...
[ "0.7400845", "0.7177451", "0.6567187", "0.6526279", "0.6507946", "0.65026647", "0.64961666", "0.642037", "0.6318333", "0.6297575", "0.62498194", "0.62380654", "0.6218743", "0.6203005", "0.6189108", "0.61607015", "0.61312574", "0.612906", "0.61262566", "0.6124734", "0.61226195...
0.81345576
0
A tuple key that uniquely describes this field. Used to compute this instance's hashcode and evaluate equality.
def _key(self): return (self.name, self.type_.upper(), self.value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def key(self):\n if self._key is None:\n fields = []\n for attr in self.__fields__:\n val = getattr(self, attr)\n if isinstance(val, list):\n val = tuple(val)\n fields.append(val)\n self._key = hash(tuple(fields...
[ "0.8073362", "0.73307294", "0.68891484", "0.6876893", "0.6864808", "0.68153316", "0.6807194", "0.6807194", "0.679337", "0.67671806", "0.676488", "0.6757766", "0.6757766", "0.6757766", "0.6757766", "0.67559737", "0.67520636", "0.6739155", "0.67156065", "0.6711026", "0.669324",...
0.740056
1
Factory for positional parameters.
def positional(cls, *sub_params): return cls(None, *sub_params)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_positional_only(self, extra_in, extra_out):\n kwargs = dict(\n type=int,\n converter=dummy_converter,\n validator=dummy_validator,\n metadata={'meta': 'data'},\n )\n fparam = FParameter.create_positional_only(**kwargs, **extra_in)\n ...
[ "0.67969805", "0.6713723", "0.6706307", "0.6494048", "0.6403838", "0.63711035", "0.6273701", "0.6268477", "0.61687833", "0.6161113", "0.59897465", "0.59873784", "0.5938854", "0.58729386", "0.58270824", "0.57967067", "0.57967067", "0.57967067", "0.57967067", "0.57967067", "0.5...
0.69131774
0
Construct JSON API representation for the parameter.
def to_api_repr(self): s_types = {} values = {} for name, value in self.struct_values.items(): type_ = self.struct_types[name] if type_ in ("STRUCT", "ARRAY"): repr_ = value.to_api_repr() s_types[name] = {"name": name, "type": repr_["parame...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_api_repr(self):\n value = self.value\n converter = _SCALAR_VALUE_TO_JSON_PARAM.get(self.type_)\n if converter is not None:\n value = converter(value)\n resource = {\n \"parameterType\": {\"type\": self.type_},\n \"parameterValue\": {\"value\": val...
[ "0.81345576", "0.7177451", "0.6567187", "0.6526279", "0.6507946", "0.65026647", "0.64961666", "0.642037", "0.6318333", "0.6297575", "0.62498194", "0.62380654", "0.6218743", "0.6203005", "0.6189108", "0.61607015", "0.61312574", "0.612906", "0.61262566", "0.6124734", "0.6122619...
0.7400845
1
Total number of rows affected by a DML query. See
def num_dml_affected_rows(self): num_dml_affected_rows = self._properties.get("numDmlAffectedRows") if num_dml_affected_rows is not None: return int(num_dml_affected_rows)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count(self):\r\n if self._batch:\r\n raise CQLEngineException(\"Only inserts, updates, and deletes are available in batch mode\")\r\n\r\n if self._result_cache is None:\r\n query = self._select_query()\r\n query.count = True\r\n _, result = self._execut...
[ "0.67597127", "0.6585426", "0.65087414", "0.64261293", "0.6411363", "0.6398853", "0.63860244", "0.63272095", "0.62906486", "0.6282119", "0.62070364", "0.62039334", "0.61564195", "0.6114899", "0.6114899", "0.6113449", "0.60866684", "0.60670227", "0.6061739", "0.6029048", "0.60...
0.7717292
0
Ensure that the Query consumer works properly in nonincremental mode. We test the stage with different batch sizes, since the logic is different depending on the whole table fit in a batch or not (see e.g. SDC14882 for an issue with the second case).
def test_jdbc_consumer_non_incremental_mode(sdc_builder, sdc_executor, database, batch_size): if database.type == 'Oracle': pytest.skip("This test depends on proper case for column names that Oracle auto-uppers.") num_records = 8 input_data = [{'id': i, 'name': get_random_string()} for i in range(1...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def produce_query_batches(self):\n pass", "def test_dml_none_success_case(self):\r\n b = BatchQuery()\r\n\r\n q = DMLQuery(TestMultiKeyModel, batch=b)\r\n assert q._batch == b\r\n\r\n q.batch(None)\r\n assert q._batch is None", "def test_multithread_batch_size(sdc_buil...
[ "0.60642856", "0.60471416", "0.60265416", "0.5933575", "0.59189045", "0.5765756", "0.5757005", "0.56588644", "0.55983466", "0.55828047", "0.5550171", "0.5531414", "0.5515177", "0.5441325", "0.5435375", "0.53909355", "0.537465", "0.5359157", "0.53465533", "0.53192425", "0.5299...
0.69045174
0
Tests that 'JDBC Query Consumer' populates the jdbc.tables in header.values correctly COLLECTOR1503. The case of multiple tables is covered by creating two identical tables and joining them on id. The jdbc.tables string format and content varies between JDBC drivers, and test assertions deal with each case.
def test_jdbc_tables_header(sdc_builder, sdc_executor, database): table_name1 = get_random_string(string.ascii_lowercase, 20) table_name2 = get_random_string(string.ascii_lowercase, 20) if database.type == 'Oracle': # When not quoted, Oracle automatically converts names to upper case. Quoting is in...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_table_description(self):\n db_introspection = DatabaseIntrospection(self.connection)\n cursor = mock.MagicMock()\n\n def description(*args, **kwargs):\n return [[\"name\", TypeCode.STRING], [\"age\", TypeCode.INT64]]\n\n def get_table_column_schema(*args, **kwarg...
[ "0.6099929", "0.6050347", "0.5908134", "0.59064555", "0.5898078", "0.5844867", "0.5806076", "0.57768804", "0.5775118", "0.5757321", "0.57336575", "0.57170755", "0.56858015", "0.5669269", "0.56598884", "0.5652677", "0.5630881", "0.55999815", "0.55959713", "0.55939347", "0.5584...
0.8060155
0
Given a dictionary my_dict whose values are numbers, return the sums of the values in my_dict
def value_sum(my_dict): # Enter code here a = 0 for key in my_dict: a += my_dict[key] return a
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dict_sum(d):\n return sum(k*v for k, v in d.items())", "def sum_points(points_dict: dict) -> int:\n\n return sum([points for points in points_dict.values() if type(points) == int])", "def _sum_over_dicts(total_n_grams: Dict[int, Tensor], n_grams: Dict[int, Tensor]) ->Dict[int, Tensor]:\n for n in ...
[ "0.7784291", "0.7433062", "0.685477", "0.68170774", "0.680583", "0.67678684", "0.67300326", "0.66210335", "0.6578636", "0.650841", "0.6438248", "0.6424539", "0.6424153", "0.63794196", "0.6222952", "0.614205", "0.614205", "0.606515", "0.604229", "0.6024133", "0.600752", "0.5...
0.8361676
0
Calculates the IBU (International Bitterness Units) for the given values. The output is listed in both Rager and Tinseth.
async def ibu(self, ctx, *, batch_size = None, original_gravity = None, hops_amount = None, alpha_acid_percent = None, boil_time_minutes = None): usage = "Usage: `{}ibu [batch_size] [original_gravity] [hops_amount] [alpha_acid_percent] [boil_time_minutes]`".format(ctx.prefix) if not batch_size: return...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unit_string(value, units, prefu={'M', 'L', 'J', 'C', 'V', 'N', 'W', 'Pa'}):\r\n if units == unity or not value:\r\n return value, \"\", \"\"\r\n SIunits = list(units)\r\n derived = dict((pu, 0) for pu in prefu if sum(abs(t) for t in unitquant[pu].units) > 1)\r\n while derived:\r\n (im...
[ "0.5558031", "0.5522377", "0.5520454", "0.54839325", "0.54337764", "0.5429432", "0.54203045", "0.541885", "0.53770447", "0.5294681", "0.52925074", "0.52584463", "0.5237981", "0.52058226", "0.5160935", "0.51522696", "0.51522696", "0.5140036", "0.51287264", "0.508224", "0.50822...
0.56817824
0
Calculates the alcohol by volume for the passed original and final gravity. Accepts (P)lato or (S)tandard Gravity values.
async def abv(self, ctx, original_gravity = None, final_gravity = None): usage = "Usage: `{}abv [original_gravity] [final_gravity]`\neg: `{}abv 1.055s 1.015s` or `{}abv 12p 2.5p`".replace("{}",ctx.prefix) if not original_gravity or not final_gravity: return await ctx.send(usage) # Let's check...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calories_alcohol(og, fg):\n\n return 25.2 * fg * abw(og, fg)", "def gravity(*args, attenuation: Union[float, bool]=0.0, directionX: Union[float, bool]=0.0,\n directionY: Union[float, bool]=0.0, directionZ: Union[float, bool]=0.0, magnitude:\n Union[float, bool]=0.0, maxDistance: Unio...
[ "0.6264313", "0.5527323", "0.5443195", "0.54169804", "0.53622687", "0.53384143", "0.5326559", "0.53138787", "0.5286408", "0.5207751", "0.5198585", "0.51633", "0.51275295", "0.51246876", "0.5109929", "0.51094586", "0.5107223", "0.5102606", "0.5028312", "0.5001944", "0.49904513...
0.62745726
0
Retorna todos os paciente
def getPacientes(self): catalog = getToolByName(self, 'portal_catalog') pacientes = catalog(object_provides=IPaciente.__identifier__, sort_on='sortable_title', sort_order='ascending',) return pacientes
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def listaNacionalidades():\n nac = NacionalidadModel()\n\n return nac.listarTodos()", "def listar_cadastros():\n return cadastro_alunos.listar_aluno()", "def carregar_contatos(self):\r\n self.clientes = []\r\n fornecedor = SistemaFornecedor()\r\n fornecedor.carregar_arquivo('')\r\...
[ "0.6678159", "0.6463812", "0.64219046", "0.6188779", "0.61852473", "0.61661166", "0.6147162", "0.6130553", "0.60990566", "0.60201883", "0.6000656", "0.5920263", "0.57640845", "0.57483995", "0.57391536", "0.5714154", "0.5709688", "0.57080996", "0.5677154", "0.5665157", "0.5644...
0.6671025
1
helper function to remove reactions excepting forbidden either by context being a dm_channel or bot lacking perms
async def try_clear_reactions(msg): if msg.guild: try: await msg.clear_reactions() except discord.errors.Forbidden: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def deny(self, ctx, user: discord.Member, *, reason: str=None):\n self.data_check(ctx)\n server = ctx.message.server\n try:\n defchannel = self.riceCog2[server.id][\"defchannel\"]\n except:\n defchannel = default_channel\n try:\n channelmute...
[ "0.6155896", "0.6152794", "0.60419816", "0.5992369", "0.58843166", "0.5852726", "0.58496845", "0.5830875", "0.5789773", "0.57646656", "0.5731415", "0.57270026", "0.56984353", "0.568108", "0.56252587", "0.5567302", "0.55126", "0.5509449", "0.54936266", "0.5463827", "0.54610586...
0.6996832
0
Sends multiple embeds with a reaction navigation menu.
async def arrows(ctx: commands.Context, embed_list: List[Embed], content: Optional[str] = None, head: int = 0, timeout: int = 30, closed_embed: Optional[Embed] = None, channel: Optional[discord.abc.Messageable] = None)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def hockey_menu(\n ctx: Context,\n display_type: str,\n post_list: list,\n message: discord.Message = None,\n page=0,\n timeout: int = 30,\n):\n if ctx.channel.permissions_for(ctx.me).embed_links:\n if display_type == \"standings\":\n em = await Standings.build_standing...
[ "0.6524929", "0.57839245", "0.5696751", "0.56624776", "0.5575576", "0.55673796", "0.5538615", "0.54887754", "0.5438213", "0.5413994", "0.5401292", "0.5399007", "0.53608143", "0.53516537", "0.52856296", "0.52719206", "0.5269945", "0.52479947", "0.52326506", "0.5209612", "0.519...
0.59497476
1
Test initialization of the shell history.
def test_hist_init(): FNAME = 'xonsh-SESSIONID.json' FNAME += '.init' History(filename=FNAME, here='yup', **HIST_TEST_KWARGS) with LazyJSON(FNAME) as lj: obs = lj['here'] assert_equal('yup', obs) os.remove(FNAME)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_readline():\n if g.command_line:\n return\n\n if has_readline:\n g.READLINE_FILE = os.path.join(get_config_dir(), \"input_history\")\n\n if os.path.exists(g.READLINE_FILE):\n readline.read_history_file(g.READLINE_FILE)\n dbg(c.g + \"Read history file\" + c....
[ "0.6567233", "0.6478693", "0.6262059", "0.6226292", "0.61227757", "0.60714823", "0.6032949", "0.6023111", "0.5995236", "0.5993356", "0.59792143", "0.5951227", "0.59489", "0.5932676", "0.5919769", "0.58783114", "0.58561987", "0.58536834", "0.58430207", "0.5767917", "0.57160944...
0.7157953
0
Verify appending to the history works.
def test_hist_append(): FNAME = 'xonsh-SESSIONID.json' FNAME += '.append' hist = History(filename=FNAME, here='yup', **HIST_TEST_KWARGS) with mock_xonsh_env({'HISTCONTROL': set()}): hf = hist.append({'joco': 'still alive'}) yield assert_is_none, hf yield assert_equal, 'still alive', hist...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_tracker_addHistory():\n\n trackers, cap = init_tracker()\n tr = trackers[0]\n tr.addHistory([1, 1, 1, 1])\n\n assert len(tr.history) >= 1", "def addHistory(self):\r\n \r\n data = self.get()\r\n \r\n if data == '':\r\n return\r\n elif len(self.his...
[ "0.7117542", "0.68953985", "0.65174603", "0.6516128", "0.63584256", "0.63073814", "0.6270839", "0.6266126", "0.6219707", "0.62142664", "0.61958504", "0.61478865", "0.61476344", "0.6145098", "0.61397976", "0.61091983", "0.6099464", "0.6094237", "0.6045134", "0.6041925", "0.603...
0.7671662
0
Verify explicit flushing of the history works.
def test_hist_flush(): FNAME = 'xonsh-SESSIONID.json' FNAME += '.flush' hist = History(filename=FNAME, here='yup', **HIST_TEST_KWARGS) hf = hist.flush() yield assert_is_none, hf with mock_xonsh_env({'HISTCONTROL': set()}): hist.append({'joco': 'still alive'}) hf = hist.flush() yi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_sync_history(self):\n pass", "def test_hist_append():\n FNAME = 'xonsh-SESSIONID.json'\n FNAME += '.append'\n hist = History(filename=FNAME, here='yup', **HIST_TEST_KWARGS)\n with mock_xonsh_env({'HISTCONTROL': set()}):\n hf = hist.append({'joco': 'still alive'})\n yield...
[ "0.6369426", "0.62858725", "0.6233328", "0.62180614", "0.6214477", "0.6206889", "0.6110817", "0.593025", "0.5857564", "0.58436346", "0.58433986", "0.58326983", "0.5832089", "0.5820372", "0.5817628", "0.5791294", "0.5781735", "0.57798004", "0.5770181", "0.57640594", "0.5743274...
0.7554811
0
Verify that CLI history commands work.
def test_show_cmd(): FNAME = 'xonsh-SESSIONID.json' FNAME += '.show_cmd' cmds = ['ls', 'cat hello kitty', 'abc', 'def', 'touch me', 'grep from me'] def format_hist_line(idx, cmd): """Construct a history output line.""" return ' {:d}: {:s}\n'.format(idx, cmd) def run_show_cmd(hist_a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def history(command):\n namespace = app.main(command)\n assert namespace.command == 'h' or namespace.command == \"history\"", "def check_commands(self):\n pass", "def flight_check():\n for command in ['git']:\n if shutil.which(command) is None:\n raise RuntimeError('command no...
[ "0.691394", "0.6344154", "0.6129089", "0.599363", "0.5964866", "0.595906", "0.5941668", "0.5933146", "0.58534676", "0.5852435", "0.58189535", "0.58174145", "0.5801089", "0.57871234", "0.57837546", "0.57643056", "0.5764258", "0.5752061", "0.574191", "0.57215357", "0.5717525", ...
0.66661304
1
Given a string S, find the number of different nonempty palindromic subsequences in S, and return that number modulo 10^9 + 7. A subsequence of a string S is obtained by deleting 0 or more characters from S. A sequence is palindromic if it is equal to the sequence reversed. Two sequences A_1, A_2, ... and B_1, B_2, ......
def countPalindromicSubsequences(self, S): if not S: return 0 ways = [[0] * len(S) for i in range(len(S))] # base cases: for subarray of length 1 and 2 for i in range(len(S)): ways[i][i] = 1 if i < len(S) - 1: ways[i][i+1] = 2 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def countPalindromicSubsequences(self, s: str) -> int:\n MOD = 10 ** 9 + 7\n \n def dp(i, j) -> (int, set):\n distinct = set()\n if i > j:\n return (0, distinct)\n if i == j:\n distinct.add(s[i])\n return (1, distinc...
[ "0.8500411", "0.71955913", "0.69797105", "0.6927197", "0.68406475", "0.6832696", "0.6633637", "0.6602206", "0.6598531", "0.6547339", "0.6489498", "0.6444721", "0.6421548", "0.6389225", "0.63467926", "0.6267129", "0.62564206", "0.62525743", "0.62490845", "0.6247127", "0.623493...
0.83323157
1
Writes the template user map file to the Git Fusion workspace and submits to the repository, if such a file does not already exist.
def _write_user_map(p4, client_name, rootdir): mappath = rootdir + '/users/p4gf_usermap' if os.path.exists(mappath): return old_client = p4.client try: p4.client = client_name p4.run('sync', '-q', mappath) if not os.path.exists(mappath): userdir = os.path.dirn...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_template(self, template_file, template_dict, rename_as=None):\n dest_name = rename_as if rename_as else template_file\n return self._write_template_to(template_file, os.path.join(self.dest, dest_name), template_dict)", "def action(self, args):\n create_new_scratch_file(args.file, s...
[ "0.5638482", "0.55940014", "0.5511949", "0.5463785", "0.539701", "0.5378371", "0.5339835", "0.53327686", "0.5332577", "0.5262577", "0.5168104", "0.51636285", "0.51364815", "0.5122284", "0.511681", "0.5096761", "0.5095272", "0.50877833", "0.50789964", "0.5071558", "0.50477564"...
0.64156795
0
Create the hostspecific Perforce client to enable working with the object cache in the .gitfusion depot.
def _create_client(p4, client_name, p4gf_dir): view = ['//{depot}/... //{client}/...'.format(depot=p4gf_const.P4GF_DEPOT, client=client_name)] spec_created = False if not p4gf_util.spec_exists(p4, "client", client_name): # See if the old object clien...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_client(httpx_settings: Optional[dict] = None) -> \"PrefectClient\":\n ctx = prefect.context.get_settings_context()\n api = PREFECT_API_URL.value()\n\n if not api:\n # create an ephemeral API if none was provided\n from prefect.server.api.server import create_app\n\n api = crea...
[ "0.6067395", "0.59023935", "0.5763974", "0.57209224", "0.5720407", "0.57114536", "0.5667238", "0.5667238", "0.5566475", "0.5537462", "0.54923743", "0.5467718", "0.5458746", "0.5401217", "0.53990245", "0.5365079", "0.53348136", "0.5301034", "0.52862656", "0.5280647", "0.527619...
0.63218766
0
Check if initialization is required, and if so, kick off the initialization process. This is done by checking that both the started and completed counters are nonzero, in which case the initialization is not performed because it was (presumably) done already. If both counters are zero, initialization is performed. Othe...
def _maybe_perform_init(p4, started_counter, complete_counter, func): check_times = 0 inited = False while True: r = p4.run('counter', '-u', started_counter) if r[0]['value'] == "0": # Initialization has not been started, try to do so now. r = p4.run('counter', '-u', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(self):\n if not self._ready:\n self._real_initialize()\n self._ready = True", "def initialize():\n manager.initialize()\n logs.exit_great_success()", "def startup(self):\n if self.initialize_mp:\n self.initialize_multiprocessing()\n sel...
[ "0.63754106", "0.626908", "0.6195228", "0.59315026", "0.5882258", "0.5879813", "0.58529186", "0.5852115", "0.58439577", "0.58128345", "0.5724729", "0.5721204", "0.5711509", "0.56759584", "0.5661934", "0.56606936", "0.5652516", "0.56494814", "0.5619984", "0.5616509", "0.558063...
0.7684339
0
Copies a file from old_name to new_name using rsync. Doublechecks the copy was successful using md5. Returns md5. If you already know the md5 of the file, then save time by providing it with the md5sum option this will avoid calculating it on the old file.
def rsync_and_md5(old_name, new_name, md5sum=None): if md5sum is None: md5sum = md5(old_name) syscall("rsync " + old_name + " " + new_name) new_md5sum = md5(new_name) if new_md5sum != md5sum: raise Exception( "Error copying file " + old_name + " -> "...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def md5checksum(file_name):\n from hashlib import md5\n hash_md5 = md5()\n with open(file_name, \"rb\") as f:\n for chunk in iter(lambda: f.read(32768), b\"\"):\n hash_md5.update(chunk)\n return hash_md5.hexdigest()", "def copy_file(file_name, new_file_name):\n\n import os\n\...
[ "0.62980545", "0.6277662", "0.62474626", "0.6149949", "0.61007166", "0.6001591", "0.59551173", "0.58685404", "0.5835982", "0.5822893", "0.57942426", "0.5791998", "0.5751748", "0.57308465", "0.5712402", "0.569063", "0.5683799", "0.5678064", "0.56743795", "0.56731594", "0.56489...
0.8707821
0
Create a minimal valid AuxPOW.
def dummy(cls) -> 'BitcoinAuxPow': from hathor.merged_mining import MAGIC_NUMBER return cls(b'\0' * 36, MAGIC_NUMBER, b'', [b'\0' * 32], b'\0' * 12)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_proto(self) -> protos.BitcoinAuxPow:\n return protos.BitcoinAuxPow(\n header_head=self.header_head,\n coinbase_head=self.coinbase_head,\n coinbase_tail=self.coinbase_tail,\n merkle_path=self.merkle_path,\n header_tail=self.header_tail,\n )...
[ "0.65142345", "0.6446436", "0.5438709", "0.5130514", "0.50987667", "0.5063869", "0.5038091", "0.50309414", "0.5008341", "0.49947566", "0.49537897", "0.4949598", "0.49436164", "0.49240798", "0.4882189", "0.4882189", "0.48523495", "0.47705284", "0.47649708", "0.47589833", "0.47...
0.73786235
0
Create a BitcionAuxPow instance from Protobuf.
def create_from_proto(cls, aux_pow_proto: protos.BitcoinAuxPow) -> 'BitcoinAuxPow': return cls( header_head=aux_pow_proto.header_head, coinbase_head=aux_pow_proto.coinbase_head, coinbase_tail=aux_pow_proto.coinbase_tail, merkle_path=list(aux_pow_proto.merkle_path)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_proto(self) -> protos.BitcoinAuxPow:\n return protos.BitcoinAuxPow(\n header_head=self.header_head,\n coinbase_head=self.coinbase_head,\n coinbase_tail=self.coinbase_tail,\n merkle_path=self.merkle_path,\n header_tail=self.header_tail,\n )...
[ "0.7454246", "0.70878726", "0.69267774", "0.6651924", "0.64275515", "0.5601703", "0.55243737", "0.5496423", "0.54736924", "0.542522", "0.5359548", "0.53417504", "0.53286505", "0.5309325", "0.5262467", "0.518746", "0.5146024", "0.5108976", "0.5101151", "0.5101151", "0.5101151"...
0.8144661
0
Convert to byte representation. | Size | Description | Comments | |||| | 36 | `header_head` | first 36 bytes of the header | | 1+ | `coinbase_head` size | byte length of the next field | | 47+ | `coinbase_head` | coinbase bytes before hash of `block_data` | | 1+ | `coinbase_tail` size | byte length of the next field | ...
def __bytes__(self) -> bytes: from hathor.merged_mining.bitcoin import encode_bytearray, encode_list struct_bytes = self.header_head struct_bytes += encode_bytearray(self.coinbase_head) struct_bytes += encode_bytearray(self.coinbase_tail) struct_bytes += encode_list(self.merkle_p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __bytes__(self):\n return (\n bytes(self.block_header) +\n pack_compact_int(len(self.txns)) +\n b''.join([bytes(t) for t in self.txns])\n )", "def __bytes__(self):\n return (\n pack_u32(self.version) +\n bytes(self.prev_block_hash) +...
[ "0.65536994", "0.644386", "0.61023426", "0.60631305", "0.58615506", "0.58594733", "0.5661637", "0.5593413", "0.5586266", "0.55836904", "0.557445", "0.5558041", "0.5555168", "0.54753864", "0.54682314", "0.5465478", "0.54636484", "0.54583806", "0.5429407", "0.54175836", "0.5407...
0.7875346
0
Perform every gathering function of the document gatherer and save the results.
def gather_documents(self): self.document_gatherer.gather_and_save_everything(Constants.path_cord, Constants.path_metadata, Constants.path_linked_documents, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self, mapping={}, *args, **kwargs):\n self.processed = 0\n for batch in self._process_by_batch(self.load(*args, **kwargs)):\n batch = list(map(lambda doc: self._apply_mapping(doc, mapping), batch))\n for doc in batch:\n self._ingest(iterable=doc, doctype=d...
[ "0.63208365", "0.6310852", "0.62251484", "0.62203014", "0.61948436", "0.61260116", "0.59762764", "0.59550303", "0.5933499", "0.59319824", "0.5928782", "0.5891748", "0.58326626", "0.5828935", "0.582793", "0.5797647", "0.5783629", "0.57672393", "0.57604563", "0.57010144", "0.57...
0.78143805
0
Score and rank each document for each query, then rerank them.
def rank_documents_with_reranker(self): # Load the required data inverted_indexes = load_pickle(Constants.path_inverted_indexes) doc_lengths = load_pickle(Constants.path_document_lengths) documents_dictionary = load_pickle(Constants.path_documents_dictionary) pa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rank_with_reranker(self, inverted_indexes, doc_lengths,\n documents_dict, parameters, path_topics,\n path_results_dir=r\"../trec_eval-master/our_data/\",\n results_file_name=\"results_rerank\"):\n \n def rerank(query, d...
[ "0.7109783", "0.70434386", "0.6938351", "0.680297", "0.67725307", "0.6599905", "0.6597595", "0.6512439", "0.6494416", "0.632713", "0.6264954", "0.6171399", "0.6124308", "0.60628396", "0.6037545", "0.59636736", "0.5938729", "0.5925772", "0.5903492", "0.58956957", "0.5895068", ...
0.7365163
0
Score and rank each document for each query with BM25F, then rerank them.
def rank_documents_BM25F_with_reranker(self): # Load the required data inverted_indexes_bm25f = load_pickle(Constants.path_inverted_indexes_bm25f) doc_length_info_bm25f = load_pickle(Constants.path_doc_length_info_bm25f) documents_dictionary = load_pickle(Constants.path_document...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rank_BM25F_with_reranker(self, inverted_indexes_bm25f,\n doc_length_info_bm25f,\n documents_dict, parameters,\n path_topics, \n path_results_di...
[ "0.7582974", "0.7218275", "0.71323603", "0.69331366", "0.67993605", "0.6627072", "0.6608538", "0.62652826", "0.6242428", "0.61587226", "0.6125173", "0.609784", "0.60729665", "0.604112", "0.59470564", "0.59294224", "0.59218794", "0.58747166", "0.5873094", "0.5868336", "0.58552...
0.76622707
0
posts run_deg command to database
def rundeg(t): adoc = { "type": "command", "execute": "run_deg", "arguments" : [t] } r = po.write_document_to_db(adoc) print(r)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def execute():", "def execute():\n pass", "def run(self):\n self.db.table('points').insert({\n 'name': 'biblioteca',\n 'rfid': '123456'\n })", "def run_new_sql(self):\n\n pass", "def do_command(self, args):\n chk_arg_count(args, 0)\n dbops.ini...
[ "0.6520675", "0.62497586", "0.60606915", "0.60485804", "0.5903037", "0.5783432", "0.5783432", "0.5783432", "0.5783432", "0.577783", "0.57615983", "0.57309693", "0.57309693", "0.57309693", "0.57309693", "0.57309693", "0.57309693", "0.5724005", "0.5720251", "0.5720251", "0.5720...
0.695964
0
creates x,y and dotsize value from df. Takes in the df, the list of events and a yvalue (fixed int).
def create_scatter_vals(df, event, y_val): df_to = df.iloc[:, [1,2]].copy() # Dataframe mit Fokus auf Ereignis (ohne Datum) xs = list(df_to.loc[df_to["Ereignis"] == event]["Zeit"]) #get times filtered by event ys = [y_val for i in xs] # assigns position on y axis dotsizes = create_dotsize(xs) # creates ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_vals(df, colors, events):\n #to do: take df.Datum.loc[0] und df.Datum.loc[-1], datetime.strftime() back to str, set as start&end\n fig, ax = plt.subplots(figsize=(16,5))\n ax.axis([0, 1440, 0, 5])\n start, end = ax.get_xlim()\n formatter = FuncFormatter(my_ticks)\n plt.xticks(rotation=70...
[ "0.5979637", "0.5333078", "0.52589226", "0.51039004", "0.50728667", "0.5014631", "0.5001048", "0.493825", "0.48673743", "0.48581478", "0.4814925", "0.47627378", "0.47526553", "0.47498432", "0.47356844", "0.47240847", "0.47105187", "0.47072247", "0.46750993", "0.46670592", "0....
0.7404653
0
Try to find a version first in the accept header, then the URL
def process_request(self, req): args = {'method': req.method, 'path': req.path, 'accept': req.accept} LOG.debug("Determining version of request: %(method)s %(path)s " "Accept: %(accept)s", args) # If the request is for /versions, just return the versions container if r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _accept_strategy(self, host, port, environ, supported_content_types):\n accept = Accept(environ.get('HTTP_ACCEPT', ''))\n\n app = None\n\n # Find the best match in the Accept header\n mime_type, params = accept.best_match(supported_content_types)\n if 'version' in params:\n ...
[ "0.65241855", "0.61994874", "0.61020184", "0.60657495", "0.59228003", "0.5913362", "0.58904594", "0.58224976", "0.5789533", "0.5747727", "0.57146627", "0.56723285", "0.5652628", "0.5646093", "0.5645961", "0.5630747", "0.562988", "0.56111246", "0.5572454", "0.5567687", "0.5566...
0.6573035
0
'Pops' off the next segment of PATH_INFO, returns the popped segment. Do NOT push it onto SCRIPT_NAME.
def _pop_path_info(self, req): path = req.path_info if not path: return None while path.startswith('/'): path = path[1:] idx = path.find('/') if idx == -1: idx = len(path) r = path[:idx] req.path_info = path[idx:] return...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def path_info(self):\r\n return urllib.unquote(self._environ.get('PATH_INFO', ''))", "def path_info(self):\n return urllib.unquote(self._environ.get('PATH_INFO', ''))", "def remove_trailing_slash(self, path_info):\n if len(path_info) > 1 and path_info[-1] == '/':\n return path_i...
[ "0.64052016", "0.63539183", "0.61269605", "0.60119283", "0.599985", "0.58956325", "0.5832812", "0.5771437", "0.57705855", "0.57386273", "0.5735876", "0.5684598", "0.5680894", "0.55890024", "0.55563253", "0.55428946", "0.5519192", "0.5517262", "0.550227", "0.5500655", "0.54894...
0.7012188
0
Rawhide | Enter rawhide mode (scratch, koji, distgit).
def switch_rawhide(self, key, rows): self.controller.set_context('rawhide')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setNoHiddenLines():\n dislin.nohide()", "def hideCursor():\n print(\"\\u001b[?25l\", end='')", "def setup_buffer(self):\n vim.command(\"setlocal buftype=nofile\")\n vim.command(\"setlocal bufhidden=wipe\")\n vim.command(\"setlocal encoding=utf-8\")\n vim.command(\"setlocal...
[ "0.57828194", "0.5534211", "0.5464102", "0.5419502", "0.5414498", "0.53362167", "0.5321124", "0.5313493", "0.5260814", "0.52138644", "0.5197474", "0.5179241", "0.5160263", "0.5120625", "0.5064298", "0.504837", "0.504555", "0.50425935", "0.5035267", "0.5018936", "0.50165594", ...
0.60647184
0
This is a utility to fix the LD_LIBRARY_PATH on Grid WNs. The shared libraries from the original LD_LIBRARY_PATH are linked to the locally specified directory. For Windows (and in general) this needs some refurbishment.
def fixLDPath( root, ldpath, directory ): if os.path.exists( directory ): shutil.rmtree( directory ) start = os.getcwd() os.mkdir( directory ) os.chdir( directory ) uniqueLD = uniquePath( ldpath ) if DEBUG: print 'Unique LD LIBRARY PATH is:' print uniqueLD sys.stdout.flush() ldlist = s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cleanup_pathes(pathprefix=\"/lustre/\"):\n path = os.environ['PATH'].split(':')\n for p in path[:]:\n if p.startswith(\"/lustre/\"):\n path.remove(p)\n ppath = os.environ['PYTHONPATH'].split(':')\n for p in ppath[:]:\n if p.startswith(\"/lustre/\"):\n ppath.remov...
[ "0.65650845", "0.63391817", "0.63352984", "0.62351537", "0.6156669", "0.61534935", "0.59634215", "0.5922939", "0.58287007", "0.5824075", "0.5812033", "0.58022743", "0.57365704", "0.56661457", "0.56549275", "0.56351", "0.55675626", "0.55385363", "0.5520636", "0.5479384", "0.54...
0.7180996
0
Reshapes all interaction terms not rejected into a dataframe containing all interactions not rejected
def transform(self, data): # Column indices and values for non-rejected interactions sign_interacts = [i for i in self.interactions if i] columns=["{}*{}".format(i,j) for i, j in sign_interacts] m = [(data[i].values*data[j].values) for i, j in sign_interacts] return DataFrame(arr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reshape_data(tbl):\n\n \n # Indexes where the sentece starts\n sentStarters = tbl.loc[tbl['index'] == 'I1']\n\n # Add indicator for group and fill that forward for the group\n tbl.loc[tbl['index'] == 'I1', 'sent'] = range(sentStarters.shape[0])\n tbl['sent'] = tbl['sent'].fillna(method='ffill...
[ "0.5296251", "0.50448215", "0.49882343", "0.49752834", "0.4784553", "0.46971163", "0.46811965", "0.4678921", "0.4678319", "0.46712497", "0.4667884", "0.46515015", "0.46471173", "0.46231386", "0.46227324", "0.4620517", "0.4616891", "0.46062323", "0.45972782", "0.45959982", "0....
0.5553635
0
Returns the dataset python module for a given dataset.
def get_dataset_module(dataset_folder, dataset_name): def import_from_path(path): return importlib.import_module(path.replace('/', '.')) dataset_module_onefile = os.path.join(dataset_folder, 'dataset_' + dataset_name) dataset_module_in_folder = os.path.join(dataset_folder, dataset_name, 'dataset')...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_dataset(params):\r\n module_name, class_name = params.dataset.name.rsplit('.', 1)\r\n i = importlib.import_module(module_name)\r\n return getattr(i, class_name)", "def find_dataset_using_name(dataset_name):\n\tdataset_filename = \"data.\" + dataset_name + \"_dataset\"\n\tdatasetlib = importlib.i...
[ "0.73264754", "0.72350645", "0.71752924", "0.7166021", "0.7166021", "0.7166021", "0.6654495", "0.66539073", "0.65764385", "0.644241", "0.6394687", "0.6313015", "0.6133304", "0.59396625", "0.5906272", "0.5846273", "0.5845261", "0.58413136", "0.5836072", "0.5780055", "0.5714767...
0.8096602
0
Function for grading a population ,
def grade(population, targetSum, targetProduct): summed = reduce (add,(fitness(x, targetSum, targetProduct) for x in population), 0 ) return summed / len(population)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def grade(population, target_sum, target_mult):\r\n summed = reduce(add, (fitness(x, target_sum, target_mult) for x in population), 0)\r\n return summed / len(population)", "def average_population_grade(population):\r\n total = 0\r\n for individual in population :\r\n total += get_individual_fitne...
[ "0.6993276", "0.63423914", "0.6227656", "0.61377686", "0.59616965", "0.59205884", "0.58718634", "0.5840246", "0.576392", "0.57095534", "0.5658771", "0.56275207", "0.55760205", "0.5548924", "0.5543805", "0.55057234", "0.54703254", "0.5458489", "0.54506767", "0.5434442", "0.543...
0.68289614
1
Set host specific variables and filepaths
def setfilepaths(): if gethostname() in ['stable', 'challenger', 'p', 'fog']: ncDir = '/home/disk/eos9/woelfle/cesm/nobackup/cesm1to2/' ncSubDir = '0.9x1.25/' saveDir = ('/home/disk/user_www/woelfle/cesm1to2/') elif gethostname() == 'woelfle-laptop': ncDir = 'C:\\Users\\woelfle...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_env():\n env.local_dotenv_path = os.path.join(\n os.path.dirname(__file__), 'etc/base_image/.env')\n dotenv.load_dotenv(env.local_dotenv_path)\n env.project_name = os.environ.get('PROJECT_NAME', '')\n env.project_dir = posixpath.join('/srv/images/', env.project_name)\n env.use_ssh_con...
[ "0.6728325", "0.6590333", "0.6357103", "0.6246629", "0.6224392", "0.61092585", "0.61050576", "0.60647786", "0.6016794", "0.5995365", "0.59627765", "0.59380144", "0.5918912", "0.59134096", "0.5893649", "0.58535784", "0.5851636", "0.58498275", "0.58452713", "0.5843026", "0.5830...
0.6591387
1
Transform article to include featured image, a group, human readable date and a stripped version of the excerpt
def _transform_article(self, article): if "_embedded" in article: article["image"] = article["_embedded"].get( "wp:featuredmedia", [None] )[0] article["author"] = article["_embedded"].get("author", [None])[0] if "display_category" not in article:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_article_text(article_text, post_date=datetime.datetime.now()):\n result = {}\n\n metadata_start = 0\n main_content_start = 0\n main_content_end = len(article_text)\n \n article_date_match = re.search(r\"^Date:\\s(?P<date>[^\\(\\[\\n]+)\", article_text, re.M)\n if article_date_match:\...
[ "0.63765067", "0.59273577", "0.576224", "0.5727734", "0.5579421", "0.554297", "0.5525144", "0.54683924", "0.534822", "0.5342797", "0.5315999", "0.531241", "0.53093195", "0.5293264", "0.5267404", "0.5252893", "0.5251424", "0.5243767", "0.52437246", "0.5182474", "0.51745653", ...
0.7987216
0
Change insights url to ubuntu.com
def _replace_url(self, content): url = "admin.insights.ubuntu.com/wp-content/uploads" new_url = "ubuntu.com/wp-content/uploads" return content.replace(url, new_url)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def url(vmanage_host,vmanage_port,api):\r\n \"\"\" function to get the url provide api endpoint \"\"\"\r\n \r\n return f\"https://{vmanage_host}:{vmanage_port}{api}\"", "def get_monitoring_url(self):\n return \"http://{0}:{1}\".format(self.get_head_node_ip(), self.MONITOR_PORT)", "def _get_base_url...
[ "0.56609356", "0.54593635", "0.5440748", "0.53232497", "0.531342", "0.5301552", "0.5253633", "0.5221669", "0.5219996", "0.5204762", "0.5193427", "0.5171594", "0.5170956", "0.5165865", "0.5160762", "0.5143746", "0.5133706", "0.5123774", "0.5107873", "0.50997674", "0.50977683",...
0.56136745
1
This method is used to store the number of Phrases the set of associated question ids and the phrase itself in the formm of dictionary.
def newPhraseInfo(phrase): return {"count":0, "ids":set(), "phrase":phrase }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insertdata():\n import models \n from models import Ngrams\n from models import Phrases\n allphrases = {}\n phrase_index= {}\n # Reading 100000 questions for this project. Original data was 7GB \n # and very large to process.\n r = engine.execute('select * from questions where id < 10...
[ "0.61090493", "0.60974437", "0.60796773", "0.60327303", "0.6013276", "0.59914404", "0.59764063", "0.5937562", "0.5934691", "0.58438116", "0.5816703", "0.5812482", "0.580263", "0.5786577", "0.5772324", "0.5743339", "0.5708285", "0.57045424", "0.5704257", "0.57031155", "0.57030...
0.6746181
0
Method is used to insert data into ngrams table.
def insertdata(): import models from models import Ngrams from models import Phrases allphrases = {} phrase_index= {} # Reading 100000 questions for this project. Original data was 7GB # and very large to process. r = engine.execute('select * from questions where id < 100000') da...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert(self, data):\r\n pass", "def do_insert_data(self, *args):\n print(\"Provide data to insert\")\n self.connection_obj.insert_into_table(**self.__class__.populate_data())\n print(\"Data Insertion Successful\")", "def insert_data(self):\n\n pass", "def insert(self, d...
[ "0.6616197", "0.64917606", "0.6381885", "0.630928", "0.616651", "0.6123893", "0.6026917", "0.5882324", "0.5811922", "0.58021003", "0.5786418", "0.5749454", "0.5693521", "0.5679468", "0.5667272", "0.5665395", "0.5654505", "0.56507695", "0.56378365", "0.5626777", "0.56233746", ...
0.71751004
0
generated source for method askAll
def askAll(self, query, context): return self.ask(query, context, False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ask_all():\n for q in Question.all_questions:\n print 'from', q.file\n q.ask()", "def ask(self):\r\n raise NotImplementedError('method ask() must be implemented in derived class')", "def find_all(self):\n pass", "def all(self):", "def all(self):", "def ask(self, query):...
[ "0.68762124", "0.6541031", "0.64404917", "0.6375134", "0.6375134", "0.6189118", "0.60972637", "0.6008021", "0.5954431", "0.5893621", "0.58253133", "0.57081395", "0.5686914", "0.5686914", "0.5674268", "0.5646725", "0.564506", "0.56098235", "0.55840117", "0.549253", "0.5472602"...
0.7488003
0
generated source for method askDistinct
def askDistinct(self, distinct, goals, context, theta, cache, renamer, askOne, results, alreadyAsking): if not distinct.getArg1() == distinct.getArg2(): return self.ask(goals, context, theta, cache, renamer, askOne, results, alreadyAsking) return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_distinct(self):\n self.Person(name=\"Mr Orange\", age=20).save()\n self.Person(name=\"Mr White\", age=20).save()\n self.Person(name=\"Mr Orange\", age=30).save()\n self.Person(name=\"Mr Pink\", age=30).save()\n assert set(self.Person.objects.distinct(\"name\")) == {\n ...
[ "0.6418156", "0.61456114", "0.611483", "0.60488766", "0.60450125", "0.5944014", "0.5881153", "0.5881153", "0.58679473", "0.58203804", "0.5810426", "0.56479967", "0.56079286", "0.55133986", "0.55128944", "0.5486326", "0.544509", "0.5420401", "0.54131985", "0.5411191", "0.54084...
0.67170626
0
generated source for method askNot
def askNot(self, not_, goals, context, theta, cache, renamer, askOne, results, alreadyAsking): notGoals = LinkedList() notGoals.add(not_.getBody()) notResults = HashSet() isConstant = True isConstant &= self.ask(notGoals, context, theta, cache, renamer, True, notResults, alreadyA...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def NoPrompt(self) -> bool:", "def ask(self):\r\n raise NotImplementedError('method ask() must be implemented in derived class')", "def ask(prompt):\n\n return renpy.exports.invoke_in_new_context(renpy.store.layout.yesno_prompt, None, prompt)", "def _not(self, _not):\n\n self.__not = _no...
[ "0.7038238", "0.66820526", "0.661959", "0.62249154", "0.62249154", "0.62249154", "0.62249154", "0.62249154", "0.6157174", "0.603767", "0.6020222", "0.60200495", "0.6012169", "0.59095556", "0.5902744", "0.5901135", "0.5873471", "0.5873102", "0.5818709", "0.5817744", "0.5770676...
0.6969324
1
generated source for method askOne
def askOne(self, query, context): results = self.ask(query, context, True) return results.iterator().next() if (len(results) > 0) else None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ask(self):\r\n raise NotImplementedError('method ask() must be implemented in derived class')", "def ask(self, query):\n for result in self.ask_generator(query):\n return result\n return False", "def ask(self, prompt: str) -> str:\n raise NotImplementedError", "def ...
[ "0.6974776", "0.63603956", "0.62081957", "0.61278903", "0.60302037", "0.5998662", "0.59775746", "0.59772795", "0.5908402", "0.58956623", "0.5818989", "0.5722933", "0.567324", "0.5657432", "0.56231785", "0.55992055", "0.55899596", "0.5587708", "0.5548068", "0.55400026", "0.552...
0.6855358
1
generated source for method askOr
def askOr(self, or_, goals, context, theta, cache, renamer, askOne, results, alreadyAsking): isConstant = True i = 0 while i < or_.arity(): goals.addFirst(or_.get(i)) isConstant &= self.ask(goals, context, theta, cache, renamer, askOne, results, alreadyAsking) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ask(self):\r\n raise NotImplementedError('method ask() must be implemented in derived class')", "def ask(self, query):\n for result in self.ask_generator(query):\n return result\n return False", "def fol_bc_ask(KB, query):\n return fol_bc_or(KB, query, {})", "def ask_om...
[ "0.6394673", "0.5968614", "0.5681398", "0.5660794", "0.5645479", "0.56053257", "0.5584787", "0.5435221", "0.54326046", "0.5425958", "0.54077053", "0.5396859", "0.5390637", "0.5352522", "0.53515357", "0.53515357", "0.53515357", "0.53515357", "0.53515357", "0.52641827", "0.5246...
0.6382259
1
Return the sum of the values in the list.
def sumValues(aList): sum = 0 for d in aList: sum += d return sum
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sum_list(input_list: List[float]) -> float:\n return sum(input_list)", "def sum_list(input_list: List[float]) -> float:\n return sum(input_list)", "def get_sum(lst):\n _sum=0\n for i in lst:\n _sum+=i\n return _sum", "def sum(self):\n total = 0\n for el in self.__list:...
[ "0.80653644", "0.80653644", "0.8001775", "0.79280007", "0.7860678", "0.78340703", "0.7821923", "0.7696951", "0.7693333", "0.76381296", "0.7636615", "0.757661", "0.7553229", "0.7484554", "0.7473504", "0.7423066", "0.73859787", "0.7341427", "0.7341427", "0.7306134", "0.727144",...
0.8263737
0
Return True if aList contains any duplicates. Its contents are not altered. A single string is constructed of the form ",13,245,18," which contains three values seen so far (i.e., 13, 245 and 18) in commaseparated form.
def uniqueCheckString(aList): check = ',' for v in aList: if f',{v},' in check: return True check = f'{check}{v},' return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_duplicates(L):\r\n unique = []\r\n for e in L:\r\n if e in unique:\r\n return True\r\n unique.append(e)\r\n return False", "def has_duplicates(list):\n for i in list:\n if list.count(i) > 1:\n return True\n else:\n return False", ...
[ "0.6787053", "0.67753315", "0.65917766", "0.65760654", "0.65437454", "0.6538598", "0.6528487", "0.6481092", "0.6471208", "0.6407861", "0.6335585", "0.63289225", "0.62248725", "0.6205944", "0.61558795", "0.6102182", "0.6076127", "0.59922785", "0.5946844", "0.59386694", "0.5937...
0.73364633
0
Identify node as being one of the Pytest context managers used to catch exceptions and warnings.
def node_is_pytest_context_manager(node: ast.AST) -> bool: return isinstance(node, ast.With) and bool(cm_exp.match(get_first_token(node).line))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_context_manager_error() -> None:\n with pytest.raises(ValueError):\n with managed_resource() as p:\n raise ValueError(\"Oops\")", "def test_context(self):\n\n with warnings.catch_warnings(record=True) as w:\n self.add_two(0)\n self.assertEqual(len(w), 1, \"E...
[ "0.6248248", "0.59191525", "0.5812641", "0.5799864", "0.5737333", "0.5653467", "0.5642243", "0.56090295", "0.55173486", "0.55005103", "0.54707175", "0.5422493", "0.5362038", "0.53551507", "0.53322744", "0.5306471", "0.5270237", "0.5260858", "0.5253033", "0.5232535", "0.521033...
0.6453945
0
``node`` corresponds to a With node where the context manager is unittest's ``self.assertRaises``.
def node_is_unittest_raises(node: ast.AST) -> bool: return isinstance(node, ast.With) and get_first_token(node).line.strip().startswith('with self.assertRaises')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def test_invalid_actions(self):\n n = Node()\n\n with self.assertRaises(exceptions.InvalidActionError):\n n.__enter__()\n\n with self.assertRaises(exceptions.InvalidActionError):\n await n.join_network('hello')\n\n with self.assertRaises(exceptions.InvalidAct...
[ "0.63707966", "0.6173758", "0.6159043", "0.6037898", "0.59475", "0.59425884", "0.5922024", "0.5918802", "0.5918802", "0.58982646", "0.5747239", "0.5725107", "0.5721607", "0.5685204", "0.5623817", "0.56080234", "0.5563667", "0.55569565", "0.5541216", "0.5537627", "0.5487326", ...
0.69669175
0
Helper for checking that a single line is a comment. Will be replaced by a complete `find_comment_lines()` helper in 148. Could also use `tokens` from Flake8.
def line_is_comment(line: str) -> bool: # TODO use existing tokens try: first_token = next(tokenize.generate_tokens(io.StringIO(line).readline)) except tokenize.TokenError: # Assume that a token error happens because this is *not* a comment return False return first_token.type ==...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _is_comment_line(self):\n pattern = re.compile(r\"^(\\s)*(//)+\")\n return pattern.search(self._line)", "def _is_comment_or_blank(line):\n return re.sub(\"#.*\", \"\", line).rstrip() == \"\"", "def test_line(line):\r\n if not line.strip():\r\n return False # if the last line is ...
[ "0.7689475", "0.71644783", "0.689326", "0.68896234", "0.681889", "0.6804938", "0.66704214", "0.6634671", "0.64071965", "0.64071965", "0.6405662", "0.6352973", "0.63502693", "0.6296257", "0.6225783", "0.6225152", "0.61794573", "0.6168305", "0.6167924", "0.6163349", "0.60995764...
0.7943037
0
Given a list of strings, flatten them to '"X", "Y" or "Z"' format.
def flatten_list(items: List[str]) -> str: if len(items) == 1: return f'"{items[0]}"' try: last = items[-1] except IndexError: # Empty list raise ValueError('Empty list of values received') return ', '.join(f'"{item}"' for item in items[:-1]) + f' or "{last}"'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def str_transform_list(L):\n return [str(x) for x in L]", "def flatten_to_strings(listOfLists):\n result = []\n\n for i in listOfLists:\n # Only append if i is a basestring (superclass of string)\n if isinstance(i, basestring):\n result.append(i)\n # Otherwise call this f...
[ "0.6590471", "0.64766574", "0.63473684", "0.63124985", "0.61528033", "0.6101601", "0.605049", "0.6018018", "0.60144645", "0.59859216", "0.59632397", "0.59396946", "0.5936779", "0.5919289", "0.5873567", "0.5865811", "0.5860493", "0.5847764", "0.5846506", "0.5839805", "0.581842...
0.6485808
1
plot a line with slope m and bias b, currently using Gnuplot
def plot_line(m, b, xrange=None, yrange=None): if(G): line = Gnuplot.Func ('%f + (%f) * x' % (b, m)) if xrange: G.set_range('xrange', xrange) if yrange: G.set_range('yrange', yrange) G.plot(line) wait_for_input()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def abline(slope, intercept):\n axes = plt.gca()\n x_vals = np.array(axes.get_xlim())\n y_vals = intercept + slope * x_vals\n plt.plot(x_vals, y_vals, '--', color='r')", "def abline(slope, intercept, a, b):\n # axes = plt.gca()\n print(slope)\n print(intercept)\n x_vals = np.array(list_xs...
[ "0.67005205", "0.66452366", "0.6643357", "0.6643357", "0.6620731", "0.65518814", "0.63624734", "0.62903225", "0.6250816", "0.6137937", "0.6073619", "0.60408103", "0.5932913", "0.58653915", "0.5855533", "0.5846106", "0.58337486", "0.57534456", "0.5731403", "0.5712848", "0.5688...
0.7329453
0
Load cwl from the given basedir + path and execute it.
def cwl( path, basedir, input, output, params, wildcards, threads, resources, log, config, rulename, use_singularity, bench_record, jobid, runtime_sourcecache_path, ): if shutil.which("cwltool") is None: raise WorkflowError( "'cwltool' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do__relative_load(self, arg=None):\n if arg:\n arg = arg.split(None, 1)\n targetname, args = arg[0], (arg[1:] or [''])[0]\n targetname = os.path.join(self.current_script_dir or '', targetname)\n self.do_load('%s %s' % (targetname, args))", "def run_workdir(s...
[ "0.5472019", "0.5286262", "0.51820034", "0.5172856", "0.5155763", "0.50584733", "0.5048083", "0.5017105", "0.49978065", "0.49350342", "0.47857547", "0.4785004", "0.47837776", "0.47827807", "0.47755104", "0.47637135", "0.47264427", "0.47169706", "0.47167784", "0.4700816", "0.4...
0.6200928
0
Convert a job with its dependencies to a CWL workflow step.
def job_to_cwl(job, dag, outputs, inputs): if job.dynamic_output: raise WorkflowError("Dynamic output is not supported by CWL conversion.") for f in job.output: if os.path.isabs(f): raise WorkflowError( "All output files have to be relative to the working directory."...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_job_to_v1_json(node):\n\n dependency_names = set()\n dependencies = []\n connections = {} # {Dependency name: [Connection]}\n recipe_inputs = []\n for conn in node.connections.values():\n if isinstance(conn, DependencyInputConnection):\n conn_dict = {'output': conn.out...
[ "0.57025605", "0.5572199", "0.5454381", "0.5306173", "0.5305479", "0.5196979", "0.513986", "0.51398337", "0.51386607", "0.5098436", "0.5066731", "0.5034485", "0.50004184", "0.49475408", "0.49250734", "0.4911291", "0.48805118", "0.48701978", "0.4858888", "0.48455086", "0.48371...
0.6977093
0
Convert a given DAG to a CWL workflow, which is returned as a JSON object.
def dag_to_cwl(dag): snakemake_cwl = { "class": "CommandLineTool", "id": "#snakemake-job", "label": "Snakemake job executor", "hints": [{"dockerPull": get_container_image(), "class": "DockerRequirement"}], "baseCommand": "snakemake", "requirements": {"ResourceRequirem...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def adc_api_workflow_create():\n workflow_json = request.get_json(force=True)\n\n return jsonify(adc.workflow_create(workflow_json=workflow_json))", "def job_to_cwl(job, dag, outputs, inputs):\n\n if job.dynamic_output:\n raise WorkflowError(\"Dynamic output is not supported by CWL conversion.\")...
[ "0.60057473", "0.57711726", "0.54607505", "0.52523565", "0.52184075", "0.520872", "0.5175393", "0.51619226", "0.51132953", "0.5105267", "0.5077007", "0.5077007", "0.506583", "0.5046743", "0.5043462", "0.50167465", "0.4992273", "0.4957207", "0.49400368", "0.49348277", "0.49278...
0.6420766
0
Enhances os.listdir by telling folders from files Returns a 2tuple containg a set of the folders and a set of the files present in path
def listdir2(path): found_names = set(listdir(path)) found_folders = set(d for d in found_names if isdir(join(path, d))) found_files = found_names - found_folders return found_folders, found_files
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def files_in_dir(path):\n return os.listdir(path)", "def _get_files(self, path):\n result = []\n for f in os.listdir(path):\n if os.path.isdir(os.path.join(path, f)):\n result += self._get_files(os.path.join(path, f))\n else:\n result.append(os...
[ "0.73522145", "0.727122", "0.7205746", "0.71162903", "0.71033645", "0.70028937", "0.6995678", "0.6989585", "0.6984193", "0.6982197", "0.69557333", "0.6900363", "0.6883837", "0.6856107", "0.683619", "0.6833507", "0.6803367", "0.67804277", "0.67738813", "0.6743047", "0.6738504"...
0.7624863
0
Tests the mark down function
def test_mark_down(): text = "is {s.o.b.|show} gonna be {{on at 8 p.m.|sys_time}|range}?" marked_down = markup.mark_down(text) assert marked_down == "is s.o.b. gonna be on at 8 p.m.?"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test__markMarkdown_textOnly2(self):\n self._degrotesque._restoreDefaultElementsToSkip()\n assert(self._degrotesque._markMarkdown(\"a\")==\"0\")", "def test__markMarkdown_textOnly1(self):\n self._degrotesque._restoreDefaultElementsToSkip()\n assert(self._degrotesque._markMarkdown(\...
[ "0.6187888", "0.6025822", "0.5987771", "0.59410393", "0.59102297", "0.5867247", "0.586284", "0.5860177", "0.58407134", "0.5829447", "0.58201814", "0.57842267", "0.57744783", "0.5765581", "0.57359433", "0.568183", "0.56724155", "0.56715685", "0.5665918", "0.56514627", "0.56150...
0.70514786
0
Tests loading a query with a system entity
def test_load_system( query_factory, query, entity_value, entity_type, entity_start_span, value, unit_or_grain, ): # We added a pm timestamp to bias duckling time resolution to resolve to pm times processed_query = markup.load_query( query, query_factory, query_options={"time...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_entity_query_initialization(self, test_domain):\n dao = test_domain.repository_for(Person)._dao\n query = dao.query\n\n assert query is not None\n assert isinstance(query, QuerySet)\n assert query._criteria == QuerySet(dao, test_domain, Person)._criteria", "def test_mi...
[ "0.6882604", "0.6315088", "0.6208851", "0.6173479", "0.6010085", "0.60069346", "0.5999608", "0.5997937", "0.5990377", "0.59888357", "0.5980015", "0.59056866", "0.58403456", "0.57627726", "0.57441854", "0.57208246", "0.5691609", "0.56876", "0.56404763", "0.56399614", "0.562742...
0.6968847
0
Tests loading a query with a nested system entity
def test_load_nested(query_factory): text = "show me houses under {{600,000|sys_number} dollars|price}" processed_query = markup.load_query(text, query_factory) assert processed_query assert len(processed_query.entities) == 1 entity = processed_query.entities[0] assert entity.text == "600,000...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_load_nested_2(query_factory):\n text = \"show me houses under {${600,000|sys_number}|price}\"\n processed_query = markup.load_query(text, query_factory)\n assert processed_query\n assert len(processed_query.entities) == 1\n\n entity = processed_query.entities[0]\n assert entity.text == \...
[ "0.64174753", "0.6207494", "0.6102191", "0.6020554", "0.59707344", "0.58967036", "0.5892735", "0.5891619", "0.58769387", "0.5793142", "0.57849574", "0.56937766", "0.5662939", "0.5611519", "0.5603587", "0.55947906", "0.5564341", "0.5530206", "0.5500367", "0.5468014", "0.541906...
0.65018725
0
Tests loading a query with a nested system entity
def test_load_nested_2(query_factory): text = "show me houses under {${600,000|sys_number}|price}" processed_query = markup.load_query(text, query_factory) assert processed_query assert len(processed_query.entities) == 1 entity = processed_query.entities[0] assert entity.text == "$600,000" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_load_nested(query_factory):\n text = \"show me houses under {{600,000|sys_number} dollars|price}\"\n\n processed_query = markup.load_query(text, query_factory)\n\n assert processed_query\n assert len(processed_query.entities) == 1\n\n entity = processed_query.entities[0]\n assert entity....
[ "0.65040904", "0.620822", "0.61026746", "0.6023311", "0.5970642", "0.589841", "0.58936185", "0.58920145", "0.5879364", "0.5794893", "0.5787097", "0.56947935", "0.5663789", "0.56134623", "0.56061", "0.5594938", "0.5563675", "0.55328274", "0.55021393", "0.54698694", "0.5420051"...
0.6419645
1
Tests loading a query with special characters
def test_load_special_chars(query_factory): text = "play {s.o.b.|track}" processed_query = markup.load_query(text, query_factory) entities = processed_query.entities assert len(entities) entity = entities[0] assert entity.text == "s.o.b." assert entity.normalized_text == "s o b" assert ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_load_special_chars_5(query_factory):\n text = \"what christmas movies are , showing at {{8pm|sys_time}|range}\"\n\n processed_query = markup.load_query(text, query_factory)\n\n assert len(processed_query.entities) == 1\n\n entity = processed_query.entities[0]\n\n assert entity.span == Sp...
[ "0.70414346", "0.7010049", "0.6857869", "0.68561053", "0.6748143", "0.6631658", "0.6182071", "0.61444944", "0.6142484", "0.6135165", "0.6084559", "0.6079846", "0.60792255", "0.6064071", "0.60511106", "0.6043016", "0.6020681", "0.60045534", "0.5997319", "0.5959898", "0.5959021...
0.7334232
0
Tests loading a query with special characters
def test_load_special_chars_5(query_factory): text = "what christmas movies are , showing at {{8pm|sys_time}|range}" processed_query = markup.load_query(text, query_factory) assert len(processed_query.entities) == 1 entity = processed_query.entities[0] assert entity.span == Span(42, 44) a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_load_special_chars(query_factory):\n text = \"play {s.o.b.|track}\"\n processed_query = markup.load_query(text, query_factory)\n entities = processed_query.entities\n\n assert len(entities)\n entity = entities[0]\n assert entity.text == \"s.o.b.\"\n assert entity.normalized_text == \"...
[ "0.7334232", "0.7010049", "0.6857869", "0.68561053", "0.6748143", "0.6631658", "0.6182071", "0.61444944", "0.6142484", "0.6135165", "0.6084559", "0.6079846", "0.60792255", "0.6064071", "0.60511106", "0.6043016", "0.6020681", "0.60045534", "0.5997319", "0.5959898", "0.5959021"...
0.70414346
1
Tests loading a query with an entity group
def test_load_group(query_factory): text = "a [{large|size} {latte|product} with {nonfat milk|option}|product] please" processed_query = markup.load_query(text, query_factory) entities = processed_query.entities assert len(entities) == 3 assert entities[0].text == "large" assert entities[0].e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_load_groups(query_factory):\n text = (\n \"Order [{one|quantity} {large|size} {Tesora|product} with \"\n \"[{medium|size} {cream|option}|option]|product] from \"\n \"[{Philz|store} in {Downtown Sunnyvale|location}|store]\"\n )\n\n processed_query = markup.load_query(text, que...
[ "0.6922146", "0.6698068", "0.6674211", "0.6455266", "0.6455266", "0.63562536", "0.6272671", "0.6234232", "0.6234232", "0.6098769", "0.60820675", "0.59880984", "0.5929337", "0.5882182", "0.586249", "0.5840969", "0.5833159", "0.57951176", "0.57951176", "0.5793945", "0.57825756"...
0.7034404
0
Tests loading a query with a nested entity group
def test_load_group_nested(query_factory): text = ( "Order [{one|quantity} {large|size} {Tesora|product} with [{medium|size} " "{cream|option}|option] and [{medium|size} {sugar|option}|option]|product]" ) processed_query = markup.load_query(text, query_factory) entities = processed_quer...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_load_groups(query_factory):\n text = (\n \"Order [{one|quantity} {large|size} {Tesora|product} with \"\n \"[{medium|size} {cream|option}|option]|product] from \"\n \"[{Philz|store} in {Downtown Sunnyvale|location}|store]\"\n )\n\n processed_query = markup.load_query(text, que...
[ "0.6852751", "0.67507565", "0.6733235", "0.6425985", "0.6405728", "0.6343709", "0.63376415", "0.6315703", "0.62358165", "0.6090504", "0.5980589", "0.59561956", "0.59561956", "0.59355557", "0.5927764", "0.59212", "0.5897766", "0.5837605", "0.5803721", "0.5775811", "0.57518846"...
0.7372748
0
Tests loading a query with multiple top level entity groups
def test_load_groups(query_factory): text = ( "Order [{one|quantity} {large|size} {Tesora|product} with " "[{medium|size} {cream|option}|option]|product] from " "[{Philz|store} in {Downtown Sunnyvale|location}|store]" ) processed_query = markup.load_query(text, query_factory) en...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_load_group_nested(query_factory):\n text = (\n \"Order [{one|quantity} {large|size} {Tesora|product} with [{medium|size} \"\n \"{cream|option}|option] and [{medium|size} {sugar|option}|option]|product]\"\n )\n\n processed_query = markup.load_query(text, query_factory)\n entities ...
[ "0.7292449", "0.71016204", "0.6445895", "0.6445895", "0.64262056", "0.64262056", "0.6365395", "0.62307394", "0.6140845", "0.6094372", "0.6089263", "0.6008375", "0.598762", "0.59279555", "0.59175617", "0.5891219", "0.5889126", "0.58700496", "0.5868931", "0.5851101", "0.584637"...
0.73481613
0
Tests dumping a basic query
def test_dump_basic(query_factory): query_text = "A basic query" query = query_factory.create_query(query_text) processed_query = ProcessedQuery(query) assert markup.dump_query(processed_query) == query_text
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_custom_query_basic(self):\n\n # Create a simple query statement a\n query = \"SELECT * FROM system.local\"\n statement = SimpleStatement(query)\n # Validate that various types of custom payloads are sent and received okay\n self.validate_various_custom_payloads(statement...
[ "0.7166274", "0.6906095", "0.6691977", "0.6625925", "0.6585336", "0.64712536", "0.6439293", "0.6422908", "0.6374031", "0.63319397", "0.63274354", "0.62943244", "0.62856", "0.62493825", "0.6227922", "0.61888146", "0.61859685", "0.6179438", "0.6167324", "0.61584187", "0.6143338...
0.79571617
0
Tests dumping a basic query with an entity
def test_dump_entity(query_factory): query_text = "When does the Elm Street store close?" query = query_factory.create_query(query_text) entities = [QueryEntity.from_query(query, Span(14, 23), entity_type="store_name")] processed_query = ProcessedQuery(query, entities=entities) markup_text = "When ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_dump_basic(query_factory):\n query_text = \"A basic query\"\n query = query_factory.create_query(query_text)\n processed_query = ProcessedQuery(query)\n\n assert markup.dump_query(processed_query) == query_text", "def test_dump_entities(query_factory):\n query_text = \"When does the Elm S...
[ "0.70164984", "0.6942989", "0.63821155", "0.63478345", "0.62632", "0.61844546", "0.6032848", "0.60213566", "0.5985118", "0.592417", "0.59031546", "0.5879068", "0.587353", "0.5823261", "0.581317", "0.5812662", "0.57979393", "0.5795499", "0.5774977", "0.57740223", "0.57691973",...
0.7057311
0
Tests dumping a basic query with an entity with a role
def test_dump_role(query_factory): query_text = "What stores are open between 3 and 5" query = query_factory.create_query(query_text) entities = [ QueryEntity.from_query( query, Span(29, 29), entity_type="sys_time", role="open_hours" ), QueryEntity.from_query( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_list_role(self):\n pass", "def test_dump_group_with_role(query_factory):\n query_text = \"a large latte with nonfat milk please\"\n query = query_factory.create_query(query_text)\n\n size = QueryEntity.from_query(query, Span(2, 6), entity_type=\"size\")\n option = QueryEntity.from_que...
[ "0.63127863", "0.60272", "0.58488405", "0.58140993", "0.56976765", "0.56804717", "0.56513727", "0.5503075", "0.54541576", "0.5449408", "0.54444814", "0.5424154", "0.5367787", "0.5335837", "0.5329066", "0.5269236", "0.5227816", "0.52169746", "0.5214677", "0.5209685", "0.519880...
0.6884807
0
Tests dumping a basic query with two entities
def test_dump_entities(query_factory): query_text = "When does the Elm Street store close on Monday?" query = query_factory.create_query(query_text) entities = [ QueryEntity.from_query(query, Span(14, 23), entity_type="store_name"), QueryEntity.from_query(query, Span(40, 45), entity_type="sy...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_dump_multi_nested(query_factory):\n query_text = \"show me houses between 600,000 and 1,000,000 dollars\"\n query = query_factory.create_query(query_text)\n\n lower = NestedEntity.from_query(\n query, Span(8, 14), parent_offset=15, entity_type=\"sys_number\"\n )\n upper = NestedEntit...
[ "0.6597396", "0.6446962", "0.641532", "0.62305427", "0.6153734", "0.5912634", "0.5890147", "0.58877134", "0.5878916", "0.5850815", "0.5825958", "0.58079165", "0.5779736", "0.5769967", "0.57654464", "0.57338274", "0.5699456", "0.56960565", "0.5689494", "0.56758285", "0.5658056...
0.65416807
1
Tests dumping a query with a nested system entity
def test_dump_nested(query_factory): query_text = "show me houses under 600,000 dollars" query = query_factory.create_query(query_text) nested = NestedEntity.from_query( query, Span(0, 6), parent_offset=21, entity_type="sys_number" ) raw_entity = Entity("600,000 dollars", "price", value={"c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_dump_multi_nested(query_factory):\n query_text = \"show me houses between 600,000 and 1,000,000 dollars\"\n query = query_factory.create_query(query_text)\n\n lower = NestedEntity.from_query(\n query, Span(8, 14), parent_offset=15, entity_type=\"sys_number\"\n )\n upper = NestedEntit...
[ "0.7218748", "0.6717435", "0.6651528", "0.6497341", "0.6476246", "0.63336414", "0.6314813", "0.6233797", "0.60895777", "0.5956409", "0.59267765", "0.59251523", "0.56548256", "0.55714726", "0.55644065", "0.55613106", "0.55468893", "0.550936", "0.55042", "0.5494251", "0.5483023...
0.7648275
0
Tests dumping a query with multiple nested system entities
def test_dump_multi_nested(query_factory): query_text = "show me houses between 600,000 and 1,000,000 dollars" query = query_factory.create_query(query_text) lower = NestedEntity.from_query( query, Span(8, 14), parent_offset=15, entity_type="sys_number" ) upper = NestedEntity.from_query( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_dump_nested(query_factory):\n query_text = \"show me houses under 600,000 dollars\"\n query = query_factory.create_query(query_text)\n\n nested = NestedEntity.from_query(\n query, Span(0, 6), parent_offset=21, entity_type=\"sys_number\"\n )\n raw_entity = Entity(\"600,000 dollars\", ...
[ "0.7409675", "0.6886322", "0.6743928", "0.6635139", "0.64739424", "0.6420422", "0.6251543", "0.6236309", "0.6006512", "0.5957879", "0.5949977", "0.5915153", "0.584922", "0.58461314", "0.576871", "0.5757109", "0.5747585", "0.5675196", "0.5629257", "0.5602789", "0.5505603", "...
0.7620687
0
Tests dumping a query with an entity group
def test_dump_group(query_factory): query_text = "a large latte with nonfat milk please" query = query_factory.create_query(query_text) size = QueryEntity.from_query(query, Span(2, 6), entity_type="size") option = QueryEntity.from_query(query, Span(19, 29), entity_type="option") product = QueryEnti...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_dump_groups(query_factory):\n query_text = (\n \"Order one large Tesora with medium cream from Philz in Downtown Sunnyvale\"\n )\n\n query = query_factory.create_query(query_text)\n entities = [\n QueryEntity.from_query(query, Span(6, 8), entity_type=\"quantity\"),\n Query...
[ "0.7728824", "0.73878556", "0.73611355", "0.73568225", "0.6980937", "0.67500836", "0.66765565", "0.6631256", "0.65174985", "0.65099794", "0.6509517", "0.63969594", "0.63396436", "0.6260021", "0.61006707", "0.609431", "0.60304797", "0.59405273", "0.59405273", "0.59311336", "0....
0.79367137
0
Tests dumping a query with an entity group with role type
def test_dump_group_with_role(query_factory): query_text = "a large latte with nonfat milk please" query = query_factory.create_query(query_text) size = QueryEntity.from_query(query, Span(2, 6), entity_type="size") option = QueryEntity.from_query( query, Span(19, 29), entity_type="option", role...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_load_dump_groups_roles(query_factory):\n text = (\n \"Order [{one|sys_number|quantity} {large|size} {Tesora|product|dish} with \"\n \"[{medium|size} {cream|option|addin}|option]|product]\"\n )\n\n processed_query = markup.load_query(text, query_factory)\n\n markup_text = markup.d...
[ "0.68940794", "0.6687955", "0.6116656", "0.6075696", "0.6018095", "0.59883916", "0.56749684", "0.56273687", "0.5412338", "0.5365833", "0.53557146", "0.5325597", "0.5268824", "0.52180314", "0.52180314", "0.5197968", "0.51955163", "0.51800805", "0.5176409", "0.5144937", "0.5111...
0.74709177
0
Tests dumping a query with nested entity groups
def test_dump_group_nested(query_factory): query_text = "Order one large Tesora with medium cream and medium sugar" query = query_factory.create_query(query_text) entities = [ QueryEntity.from_query(query, Span(6, 8), entity_type="quantity"), QueryEntity.from_query(query, Span(10, 14), enti...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_dump_group_nested_2(query_factory):\n query_text = \"Can I get one curry sauce with my rice ball with house salad\"\n\n query = query_factory.create_query(query_text)\n entities = [\n QueryEntity.from_query(\n query, Span(10, 12), entity_type=\"sys_number\", role=\"quantity\"\n ...
[ "0.80004984", "0.77831924", "0.7781654", "0.7481701", "0.7372311", "0.7277713", "0.70594674", "0.68453634", "0.66857725", "0.642309", "0.6242609", "0.6172241", "0.6081421", "0.60730916", "0.6067266", "0.5970114", "0.59611917", "0.59611917", "0.59312177", "0.5920109", "0.59138...
0.7987302
1
Tests dumping a query with nested entity groups
def test_dump_group_nested_2(query_factory): query_text = "Can I get one curry sauce with my rice ball with house salad" query = query_factory.create_query(query_text) entities = [ QueryEntity.from_query( query, Span(10, 12), entity_type="sys_number", role="quantity" ), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_dump_group_nested(query_factory):\n query_text = \"Order one large Tesora with medium cream and medium sugar\"\n\n query = query_factory.create_query(query_text)\n entities = [\n QueryEntity.from_query(query, Span(6, 8), entity_type=\"quantity\"),\n QueryEntity.from_query(query, Spa...
[ "0.79877585", "0.7783541", "0.7781369", "0.74832314", "0.73737556", "0.72776306", "0.70608634", "0.6845921", "0.6686973", "0.6423796", "0.62440217", "0.6173139", "0.6082054", "0.607462", "0.60686547", "0.59699726", "0.5959356", "0.5959356", "0.59329194", "0.59190637", "0.5911...
0.8001208
0
Tests dumping a query with multiple top level entity groups
def test_dump_groups(query_factory): query_text = ( "Order one large Tesora with medium cream from Philz in Downtown Sunnyvale" ) query = query_factory.create_query(query_text) entities = [ QueryEntity.from_query(query, Span(6, 8), entity_type="quantity"), QueryEntity.from_query...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_dump_group(query_factory):\n query_text = \"a large latte with nonfat milk please\"\n query = query_factory.create_query(query_text)\n\n size = QueryEntity.from_query(query, Span(2, 6), entity_type=\"size\")\n option = QueryEntity.from_query(query, Span(19, 29), entity_type=\"option\")\n pr...
[ "0.77208966", "0.77002674", "0.7645482", "0.7323937", "0.71672314", "0.6979817", "0.695178", "0.6919541", "0.68213445", "0.6450741", "0.640448", "0.6267981", "0.62337583", "0.61278176", "0.61278176", "0.6051138", "0.6008989", "0.59751815", "0.59717935", "0.5960583", "0.595468...
0.77480334
0