query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Create an IK attribute on the given ctrl, connect IK handles to ik switch. Also connect fk ctrls and ik ctrls visibility to switch. This will create an 'IK' attr on the switch ctrl
def create_fk_ik_switch(switch_ctrl, ik_handles, fk_ctrls, ik_ctrls, vis_ctrl=None, switch_attr_name='IK', vis_attr_name='fkIkCtrlVis'): fk_ctrls = mc.ls(fk_ctrls) ik_ctrls = mc.ls(ik_ctrls) ik_handles = mc.ls(ik_handles) if not vis_ctrl: vis_ctrl = switch_ctrl # Create attributes if ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_soft_ik(ik_ctrl, ik_joints, ik_handle):\n\n # get name and constant variables\n name = ik_handle+'Soft'\n parent = utils.get_parent(ik_joints[0])\n ik_handle_parent = utils.get_parent(ik_handle)\n\n # get total length of joint chain\n chain_length = 0\n for jnt in ik_joints[1:]:\n ...
[ "0.6865341", "0.670034", "0.6326762", "0.61733705", "0.6086193", "0.59026164", "0.57446015", "0.55481964", "0.540773", "0.5367092", "0.53659767", "0.51581305", "0.5066359", "0.493914", "0.48905978", "0.48687443", "0.48397043", "0.48023486", "0.47860128", "0.47808054", "0.4765...
0.7807563
0
Create soft ik constraint on ikHandle.
def create_soft_ik(ik_ctrl, ik_joints, ik_handle): # get name and constant variables name = ik_handle+'Soft' parent = utils.get_parent(ik_joints[0]) ik_handle_parent = utils.get_parent(ik_handle) # get total length of joint chain chain_length = 0 for jnt in ik_joints[1:]: chain_len...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_keep_in_constraint(self,der=2,limit=1e1,weight=1e5):\n print(\"Creating Keep in constraint\")\n constr = dict()\n constr['constraint_type'] = \"ellipsoid\"\n constr['weight'] = self.accel_weight\n constr['keep_out'] = False\n constr['der'] = der\n constr[...
[ "0.5469389", "0.531737", "0.52888745", "0.51781154", "0.50092465", "0.49953595", "0.49701515", "0.4952075", "0.49448365", "0.49093467", "0.49027547", "0.4884955", "0.4834274", "0.47601178", "0.47214177", "0.46724012", "0.4648716", "0.46426857", "0.4633451", "0.46300042", "0.4...
0.7518777
0
Quaterion / matrix based twist for upper arms and legs.
def upper_twist(shoulder_jnt, up_arm_ik_jnt, lo_arm_ik_jnt, up_arm_jnt, lo_arm_jnt, up_arm_twist_jnts): # Create a group that does not rotate and parent under the ik arm parent (shoulder) stable_reader_grp = utils.create_node('transform', n=up_arm_ik_jnt+'_stable_reader', p=up_arm_ik_jnt) # Create a grp t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lower_twist(lo_arm_ik_jnt, wrist_ik_jnt, lo_arm_jnt, lo_arm_twist_jnts, wrist_jnt=None):\n\n # Create a group that does not rotate and parent under the ik arm parent (shoulder)\n stable_reader_grp = utils.create_node('transform', n=lo_arm_ik_jnt+'_stable_reader', p=lo_arm_ik_jnt)\n\n # Create a grp th...
[ "0.5514963", "0.52410305", "0.5185732", "0.51259094", "0.5053267", "0.5020422", "0.49390778", "0.4879556", "0.48793352", "0.4878152", "0.4855", "0.4854443", "0.48542276", "0.48520848", "0.48423955", "0.4821107", "0.4791083", "0.47887972", "0.47870728", "0.47847036", "0.478411...
0.56926125
0
Quaterion / matrix based stretch for forearms and lower legs
def lower_twist(lo_arm_ik_jnt, wrist_ik_jnt, lo_arm_jnt, lo_arm_twist_jnts, wrist_jnt=None): # Create a group that does not rotate and parent under the ik arm parent (shoulder) stable_reader_grp = utils.create_node('transform', n=lo_arm_ik_jnt+'_stable_reader', p=lo_arm_ik_jnt) # Create a grp that will ro...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ar_addStretchSquash():\n setupName = 'Nose'\n sel = cmds.ls(sl=True)\n chain = cmds.ls(sel[0], dag=True, typ='joint')\n IKSpine = cmds.ikHandle(sj=chain[0], ee=chain[len(chain) - 1], sol='ikSplineSolver')\n # rename\n cmds.rename(IKSpine[0], 'IKSplineHandle_' + setupName)\n cmds.rename(IKS...
[ "0.5521156", "0.52241683", "0.52145356", "0.51717967", "0.5153184", "0.5151809", "0.5132688", "0.5117285", "0.5094757", "0.50800526", "0.5053586", "0.5023979", "0.5008975", "0.50081855", "0.50077236", "0.5004814", "0.49971503", "0.49883208", "0.49845037", "0.49832925", "0.497...
0.0
-1
Stretch setup for biped (2 joint chain) arms and legs
def biped_stretch(ik_ctrl, ik_last_node, pv_ctrl, switch_ctrl, up_arm_fk_ctrl, lo_arm_fk_ctrl, wrist_fk_ctrl, up_arm_ik_jnt, lo_arm_ik_jnt, wrist_ik_jnt, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def multi_joint_stretch(ik_ctrl, ik_last_node, switch_ctrl, fk_ctrls, jnts, ik_handle):\n\n root_grp = utils.get_parent(jnts[0])\n stretch_jnts = jnts[1:]\n stretch_fk_ctrls = fk_ctrls[1:]\n\n # create attrs\n attrs = ['upStretch','loStretch']\n for i in reversed(range(len(stretch_jnts)-2)):\n ...
[ "0.6122613", "0.60881704", "0.5706191", "0.5586057", "0.554519", "0.55225635", "0.55225635", "0.54242057", "0.54017335", "0.5394755", "0.5353252", "0.52999943", "0.52834505", "0.52750146", "0.524787", "0.5220676", "0.5217967", "0.51952493", "0.51629597", "0.5109538", "0.51004...
0.66334
0
Create IK FK Streatch for limbs with more than two bines
def multi_joint_stretch(ik_ctrl, ik_last_node, switch_ctrl, fk_ctrls, jnts, ik_handle): root_grp = utils.get_parent(jnts[0]) stretch_jnts = jnts[1:] stretch_fk_ctrls = fk_ctrls[1:] # create attrs attrs = ['upStretch','loStretch'] for i in reversed(range(len(stretch_jnts)-2)): ltr = '' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def boundary(self):\n answer = self.zero()\n for k, v in self.items():\n for idx, cube in enumerate(k):\n acc_dim = sum((cube_l.dimension for cube_l in k[:idx]))\n for i in range(cube.dimension):\n for epsilon in (0, 1):\n ...
[ "0.5314263", "0.5311153", "0.5255831", "0.5082965", "0.50570154", "0.4981262", "0.49758726", "0.4932032", "0.49083376", "0.49006724", "0.48869604", "0.4875669", "0.4868179", "0.48634484", "0.48508698", "0.48497802", "0.48386258", "0.4834771", "0.48233885", "0.48123473", "0.48...
0.0
-1
Create stratch point constraints on a chain of stretch joints.
def stretch_twist_jnts(start_jnt, end_jnt, twist_jnts): div = 1.0 / (len(twist_jnts)+1) for i, joint in enumerate(twist_jnts): weight = div*(i+1) mc.pointConstraint(start_jnt, joint, weight=1.0-weight) mc.pointConstraint(end_jnt, joint, weight=weight)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def multi_joint_stretch(ik_ctrl, ik_last_node, switch_ctrl, fk_ctrls, jnts, ik_handle):\n\n root_grp = utils.get_parent(jnts[0])\n stretch_jnts = jnts[1:]\n stretch_fk_ctrls = fk_ctrls[1:]\n\n # create attrs\n attrs = ['upStretch','loStretch']\n for i in reversed(range(len(stretch_jnts)-2)):\n ...
[ "0.60946095", "0.5763195", "0.5703657", "0.5553354", "0.5487165", "0.5435914", "0.53954494", "0.51878697", "0.51259", "0.51116204", "0.5077191", "0.5054225", "0.4999024", "0.49555075", "0.49334964", "0.4926704", "0.4873679", "0.48712805", "0.48634586", "0.48509604", "0.484819...
0.66719025
0
Duplicate a joint chain.
def duplicate_chain(chain, search='', replace='', suffix=''): if suffix: suffix = '_'+suffix new_jnts = [] for joint in chain: new_name = joint.replace(search, replace, 1)+suffix new_jnt = mc.duplicate(joint, po=1, n=new_name)[0] if new_jnts: mc.parent(new_jnt,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def skeleton_buildDuplicateChain(self,sourceJoints = None, modifier = 'rig', connectToModule = False, connectAs = 'rigJoints', connectToSource = None, singleMode = False, cgmType = None, indices = [],blockNames=False):\n _str_func = 'skeleton_buildDuplicateChain'\n \n \n if indices:\n log.debug...
[ "0.63030636", "0.6269034", "0.60625374", "0.58090156", "0.5777003", "0.57204974", "0.56585926", "0.55766195", "0.5560866", "0.55120313", "0.5510162", "0.54400694", "0.5433781", "0.54283494", "0.5389344", "0.5383912", "0.53801215", "0.53679395", "0.5365678", "0.5365056", "0.53...
0.6813391
0
Extract the images into a 4D uint8 numpy array [index, y, x, depth].
def extract_images(filename,lx): print('Extracting', filename,'aaaaaa') data=numpy.loadtxt(filename,dtype='int64') dim=data.shape[0] data=data.reshape(dim, lx, lx, 1) # Convert shape from [num examples, rows, columns, depth] # to [num examples, rows*columns] (assuming depth == 1) data ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _images(path):\r\n with gzip.open(path) as f:\r\n # First 16 bytes are magic_number, n_imgs, n_rows, n_cols\r\n pixels = np.frombuffer(f.read(), 'B', offset=16)\r\n return pixels.reshape(-1, 784).astype('float32') / 255", "def extract_data(filename, num_images):\n print('...
[ "0.6674317", "0.6536259", "0.651069", "0.63781893", "0.63752973", "0.63359886", "0.6284267", "0.6278434", "0.6248823", "0.623316", "0.6226097", "0.62114894", "0.6170373", "0.61536634", "0.61412567", "0.61320215", "0.61277705", "0.6126708", "0.6115631", "0.61038214", "0.604964...
0.6521254
2
Convert class labels from scalars to onehot vectors.
def dense_to_one_hot(labels_dense, num_classes=10): num_labels = labels_dense.shape[0] index_offset = numpy.arange(num_labels) * num_classes labels_one_hot = numpy.zeros((num_labels, num_classes)) labels_one_hot.flat[index_offset + labels_dense.ravel()] = 1 return labels_one_hot
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def one_hot(labels, classes=None):\n return K.utils.to_categorical(labels, classes)", "def one_hot(labels, classes=None):\n\n one_hot_ = K.utils.to_categorical(labels, classes)\n return(one_hot_)", "def to_onehot(labels: torch.Tensor, num_classes: int) -> torch.Tensor:\n if len(labels.size()) == 1:...
[ "0.8250402", "0.807683", "0.80523187", "0.7977843", "0.7908335", "0.7900327", "0.7892233", "0.7869711", "0.7849721", "0.7849721", "0.7826951", "0.7826122", "0.77677035", "0.7765413", "0.77540547", "0.77540547", "0.77540547", "0.77489346", "0.7742955", "0.7737176", "0.77226317...
0.76462805
33
Extract the labels into a 1D uint8 numpy array [index].
def extract_labels(nlabels,filename, one_hot=False): print('Extracting', filename,'bbbccicicicicib') labels=numpy.loadtxt(filename,dtype='int64') if one_hot: print("LABELS ONE HOT") print(labels.shape) XXX=dense_to_one_hot(labels,nlabels) print(XXX.shape) return de...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def labels_array(self):\n return _build_label_vector_rows(\n [[(label, 1)] for label in self.labels], self.training_labels)[1:].T", "def array2(self):\r\n profbox(whoami())\r\n # research\r\n inputLabelID = self.__needleLabelSelector.currentNode().GetID()\r\n labelnode = slicer.mrml...
[ "0.70427394", "0.70352", "0.68724084", "0.6775525", "0.67488664", "0.67066264", "0.67066264", "0.66832286", "0.6675897", "0.65783316", "0.657126", "0.65644187", "0.65461975", "0.6527157", "0.65213823", "0.651859", "0.6512153", "0.65094626", "0.6494245", "0.6442707", "0.642644...
0.64324766
20
Copies the folder from the source directory into a docs folder eliminating commercial information.
def oh_folders(src, dest=dest): copytree(src, dest, ignore=ignore_patterns(*ignore_list), dirs_exist_ok=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy_docs():\n local('rsync -av --delete --exclude=.svn %s:%s/ /tmp/djangodocs/' %\n (env.hosts[0], env.deploy_base.child('docbuilds')))", "def copy_project_docs(srctree):\n docdir = os.path.join(srctree, 'Doc')\n\n # This block shouldn't be here, but I do not yet know how to\n # embed...
[ "0.71197486", "0.64806306", "0.61687136", "0.6106528", "0.6040729", "0.599639", "0.59881204", "0.59192413", "0.5918901", "0.5830127", "0.5795234", "0.57863706", "0.5776979", "0.57418394", "0.57132345", "0.5694525", "0.5685527", "0.5615512", "0.5591277", "0.5551153", "0.554456...
0.0
-1
Remove references to elements in the ignore list.
def edit_summary(): with open("docs/SUMMARY.md", "r") as opened_file: summary = opened_file.readlines() with open("docs/SUMMARY.md", "w") as opened_file: for line in summary: if not any(ext in line for ext in ignore_list): opened_file.write(line)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_ignore_list(book_list):\n my_ignore_list = ['a','able','about','across','after','all','almost','also',\n 'am','an','and','any','are','as','at','be','because',\n 'been','but','by','can','cannot','could','did','do','does',\n 'for','from','get','g...
[ "0.6355515", "0.63518995", "0.62366766", "0.6146372", "0.609999", "0.60373515", "0.59647715", "0.58614707", "0.58380705", "0.581101", "0.57721406", "0.5733889", "0.56982344", "0.5688912", "0.56855273", "0.5677034", "0.5676934", "0.5671325", "0.5661625", "0.56558764", "0.56454...
0.0
-1
This function loops through directory and updates dates of files in said directory.
def update_date(dest=dest): for root, _, files in os.walk(dest): ignore = ["README.md","SUMMARY.md"] _ = [edit_files(root + "/" + file) for file in files if (file not in ignore and file.endswith(".md"))]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _update_files():\n configuration_settings = get_configuration()\n\n # Need to find all of the files that are stored in the input_files directories in order to start building the\n # reports that will be used to generate the static log files.\n for input_path in configuration_settings.processing.inp...
[ "0.7497474", "0.65693516", "0.6360544", "0.6272613", "0.62687546", "0.6217366", "0.58838624", "0.58187634", "0.5807831", "0.57809776", "0.57797885", "0.57654995", "0.5759113", "0.57328516", "0.570991", "0.56900525", "0.56631005", "0.56558955", "0.5641615", "0.5629182", "0.562...
0.7363431
1
This function updates date of files passed into it.
def edit_files(i_file): a_file = open(i_file, "r") content = a_file.readlines() content[3] = f"years: {datetime.now().year}\n" content[4] = f'lastupdated: "{date.today()}"\n' a_file = open(i_file, "w") #open the same file and overrite line3 & 4 a_file.writelines(content) a_file.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_date(dest=dest):\n for root, _, files in os.walk(dest):\n ignore = [\"README.md\",\"SUMMARY.md\"]\n _ = [edit_files(root + \"/\" + file) for file in files if (file not in ignore and file.endswith(\".md\"))]", "def changeDate(names, date, ctlFunc = lambda s, d: True): \n\n # parse ...
[ "0.7073105", "0.6812823", "0.66919583", "0.6668282", "0.62575287", "0.6241051", "0.61830145", "0.6148155", "0.59413326", "0.5930518", "0.58680063", "0.5799601", "0.57853353", "0.5773595", "0.5749723", "0.57237613", "0.5706964", "0.57064885", "0.57048666", "0.56627303", "0.566...
0.6030693
8
Test combining each center's file errors
def test__combine_center_file_errors(syn): expected_error = ( f"\t{ENT1.name} ({ENT1.id}):\n\nmy errors\nn\n\n" f"\t{ENT1.name} ({ENT1.id}):\n\nerrors here\nf\n\n" ) calls = [ mock.call("syn1234", downloadFile=False), mock.call("syn2345", downloadFile=False), ] with p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_single_error_merge(self):\n test_folder = base_path +'/test_data/merging_tests/error_test/'\n output_file = os.path.join(test_folder, \"output1.jpg\")\n\n self.assertRaises(mi.ImageError, lambda: mi.add_background(test_folder+\"dummy.txt\", test_folder+\"background.jpg\", output_file)...
[ "0.6594361", "0.6371965", "0.6179928", "0.617114", "0.613714", "0.61048645", "0.6091394", "0.6054181", "0.5993377", "0.5975022", "0.5965196", "0.5943787", "0.59276956", "0.5922497", "0.59199405", "0.5838658", "0.58281934", "0.58267826", "0.581185", "0.58048946", "0.57999486",...
0.7143594
0
Test getting all center invalid errors
def test_get_center_invalid_errors(syn): with patch.object( syn, "tableQuery", return_value=QueryResponse ) as patch_query, patch.object( write_invalid_reasons, "_combine_center_file_errors", return_value="errors" ) as patch_combine: center_invalid = write_invalid_reasons.get_center_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_errors(self) -> None:", "def storefront_check_errors():\n\n\tcurrentView = uidoc.ActiveView\n\tfamTypeDict = GetFamilyTypeDict(\"Fabrication-Error-Symbol\")\n\n\t# Clear existing error notations\n\terrorNotations = list(GetElementsInView(BuiltInCategory.OST_GenericAnnotation, Autodesk.Revit.DB.FamilyIn...
[ "0.68639857", "0.65659684", "0.6317057", "0.6280998", "0.624511", "0.62418723", "0.6231955", "0.6174314", "0.6160829", "0.6155387", "0.6125272", "0.61134624", "0.6105969", "0.60783327", "0.606288", "0.60506743", "0.604379", "0.6016345", "0.60074997", "0.6006396", "0.6003036",...
0.73111194
0
Returns the highest magnification for the slide
def highest_mag(slide): return int(slide.properties['aperio.AppMag'])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mag(self):\n return self.photosamplers.get_estimate(mag=True)[0]", "def get_mag_for_size(slide, size):\n max_size = slide.dimensions\n max_mag = highest_mag(slide)\n downsample = np.average([max_dim/size_dim for max_dim, size_dim in zip(max_size, size)])\n return max_mag/downsample", "de...
[ "0.7143382", "0.6984062", "0.6947595", "0.6700194", "0.6502702", "0.6465279", "0.6439392", "0.6389368", "0.62770873", "0.62758964", "0.6203424", "0.6182897", "0.6060569", "0.6010728", "0.6000861", "0.59334785", "0.5931892", "0.59017086", "0.5889821", "0.58670044", "0.584315",...
0.8554771
0
Returns the magnification for each level in a slide
def level_mags(slide): return [highest_mag(slide)/downsample for downsample in slide.level_downsamples]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_level_mag(slide, level):\n return level_mags(slide)[level]", "def get_thumbnail_magnification(slide):\n ratio = np.asarray(slide.dimensions) / np.asarray(slide.associated_images[\"thumbnail\"].size)\n # np.sqrt(np.prod(ratio))\n return ratio", "def get_level_for_mag(slide, mag):\n level...
[ "0.7798809", "0.6923862", "0.66853", "0.65677786", "0.62147903", "0.6124908", "0.61031574", "0.6090716", "0.6088541", "0.58556306", "0.5820038", "0.56304854", "0.5626129", "0.56065404", "0.5559378", "0.54275894", "0.54266506", "0.5425498", "0.53985816", "0.53818405", "0.52535...
0.78430814
0
Returns the dimensions of a level
def get_level_size(slide, level): return slide.level_dimensions[level]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dimensions():", "def getDimensions():", "def _get_ndim(self):\n return len(self.level_shapes[0])", "def depth(self):\n return _libsbml.Dimensions_depth(self)", "def dimensions(self) -> int:\n return pulumi.get(self, \"dimensions\")", "def get_map_size(level):\n if level < 5:\n...
[ "0.7337827", "0.7250944", "0.7064121", "0.7035364", "0.6847221", "0.67899704", "0.67407316", "0.6720339", "0.66824", "0.66605484", "0.66371953", "0.6546749", "0.6472022", "0.6469843", "0.64618737", "0.6444262", "0.6423922", "0.6412058", "0.6396843", "0.6379703", "0.6365779", ...
0.8075793
0
Returns the magnification at a particular level
def get_level_mag(slide, level): return level_mags(slide)[level]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _calculate_magnification(self, times):\n if self._model.n_lenses == 2:\n factor = 10.\n params = self._model.parameters\n t_1 = params.t_0 - factor * params.t_E\n t_2 = params.t_0 + factor * params.t_E\n self._model.set_magnification_methods([t_1, '...
[ "0.67559737", "0.6685309", "0.66784066", "0.65893006", "0.6497956", "0.62938315", "0.61198086", "0.6092812", "0.6024545", "0.5632027", "0.55412483", "0.5471536", "0.54661393", "0.5413815", "0.5413614", "0.53920174", "0.53455603", "0.5330778", "0.5330044", "0.5313709", "0.5275...
0.7867714
0
Get the level corresponding to a certain magnification, if available
def get_level_for_mag(slide, mag): level_mags_rounded = list(np.round(level_mags(slide), decimals = 2)) if mag in level_mags_rounded: return level_mags_rounded.index(mag) else: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_level_mag(slide, level):\n return level_mags(slide)[level]", "def getLevel(unique_name):", "def level_mags(slide):\n return [highest_mag(slide)/downsample for downsample in slide.level_downsamples]", "def mag(self):\n return self.photosamplers.get_estimate(mag=True)[0]", "def get_lumin...
[ "0.76260245", "0.6262649", "0.62293607", "0.61587805", "0.60415137", "0.6033318", "0.58130866", "0.5732402", "0.57084596", "0.5647901", "0.5613819", "0.5604842", "0.5599045", "0.55820286", "0.5574072", "0.5559694", "0.55576396", "0.555535", "0.55302167", "0.5511368", "0.54941...
0.7825988
0
Get the magnification corresponding to an image size at the highest magnification
def get_mag_for_size(slide, size): max_size = slide.dimensions max_mag = highest_mag(slide) downsample = np.average([max_dim/size_dim for max_dim, size_dim in zip(max_size, size)]) return max_mag/downsample
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mag(self):\n return self.photosamplers.get_estimate(mag=True)[0]", "def highest_mag(slide):\n return int(slide.properties['aperio.AppMag'])", "def get_size_for_mag(slide, mag):\n max_size = slide.dimensions\n max_mag = highest_mag(slide)\n downsample = max_mag/mag\n return [np.int(np....
[ "0.7177108", "0.71568376", "0.6950366", "0.67886364", "0.6724605", "0.65802383", "0.62866354", "0.6198589", "0.60788", "0.60172695", "0.599912", "0.5912535", "0.5909752", "0.5874121", "0.5848604", "0.58275664", "0.5797984", "0.5797821", "0.57959604", "0.57886523", "0.5763161"...
0.7147567
2
Get the image size the highest magnification image would have to be resized to get an equivalent magnification
def get_size_for_mag(slide, mag): max_size = slide.dimensions max_mag = highest_mag(slide) downsample = max_mag/mag return [np.int(np.round(dim/downsample)) for dim in max_size]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getZoomFactor(imageSize, maxW, maxH):\n\timageW, imageH = imageSize\n\tzoomW = float(imageW) / float(maxW)\n\tzoomH = float(imageH) / float(maxH)\n\treturn max(zoomW, zoomH)", "def get_image_size(self):", "def get_thumbnail_magnification(slide):\n ratio = np.asarray(slide.dimensions) / np.asarray(slide....
[ "0.70223284", "0.69094974", "0.6904307", "0.6871893", "0.6834652", "0.67987007", "0.6753258", "0.6662533", "0.6641104", "0.6629991", "0.6623062", "0.66070765", "0.65710425", "0.6462559", "0.6438334", "0.64352167", "0.64264476", "0.6413869", "0.64073336", "0.6405353", "0.63959...
0.721434
0
Outputs at Pillow Image for a particular magnification
def read_slide_at_mag(slide, mag): exact_level = get_level_for_mag(slide, mag) if exact_level is not None: return slide.read_region((0,0), exact_level, get_level_size(slide, exact_level)) else: max_size = slide.dimensions region_size = tuple(get_size_for_mag(slide, mag)) down...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def large_image(self):\n pass", "def mag(self):\n return self.photosamplers.get_estimate(mag=True)[0]", "def _calculate_magnification(self, times):\n if self._model.n_lenses == 2:\n factor = 10.\n params = self._model.parameters\n t_1 = params.t_0 - factor ...
[ "0.60173213", "0.5782513", "0.5777427", "0.5764191", "0.56933355", "0.56771076", "0.56483626", "0.5612517", "0.5609735", "0.56014514", "0.5599658", "0.55762804", "0.55341315", "0.55226684", "0.5477635", "0.5477049", "0.546813", "0.54632145", "0.54585576", "0.54283446", "0.538...
0.0
-1
Generates tiles from whole slide images
def tile_gen_at_mag(wsi, mag, tile_size): #Get size of WSI at Level 0 (Max Magnification) x0, y0 = wsi.level_dimensions[0] #Get size of WSI at the mag we want x_mag, y_mag = get_size_for_mag(wsi, mag) x_tiles = int(np.floor(x_mag/tile_size)) y_tiles = int(np.floor(y_mag/tile_size)) #Scale ti...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tile_slides(slides_filepaths, desired_tile_with, desired_overlap, desired_magnification):\n containing_folders = []\n for slide_filepath in slides_filepaths:\n containing_folders.append(tile_slide(slide_filepath, desired_tile_with, desired_overlap, desired_magnification))\n return containing_fo...
[ "0.7096497", "0.7032253", "0.6989992", "0.69054127", "0.6749181", "0.66839963", "0.6649588", "0.65237033", "0.6499432", "0.64959127", "0.6372662", "0.6356276", "0.63422674", "0.63199794", "0.6305179", "0.6302457", "0.62703687", "0.62687695", "0.62687695", "0.62516", "0.617920...
0.0
-1
takes a command, telnet session, and a prompt and returns the output of the code
def respond(cmd,t,p): t.write(cmd) return wait(t,p)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_telnet_command(command):\n\n tn = telnetlib.Telnet(stb_parameters.STB_IP)\n tn.read_until(bytes(\"login: \", 'UTF-8'))\n tn.write(bytes(stb_parameters.STB_USER_NAME + \"\\n\", 'UTF-8'))\n tn.write(bytes(command + \"\\n\", 'UTF-8'))\n tn.write(bytes(\"exit\\n\", 'UTF-8'))\n result = tn.re...
[ "0.70798624", "0.7071471", "0.70600575", "0.6706458", "0.6631486", "0.64974564", "0.6339306", "0.62638974", "0.6244074", "0.6220981", "0.60587776", "0.6056408", "0.60353273", "0.5993267", "0.5937854", "0.5930016", "0.59039897", "0.5903268", "0.58991635", "0.5847472", "0.58356...
0.56606126
28
takes a telnet session, and a prompt
def wait(t,p): output_list = [] c = '' d = '' while p not in d: c = t.read_very_eager() if len(c) > 0: d += c print c output_list.append(c) if "Press any key to continue" in c or "--More--" in c: t.write(" ") output_list = ((''.join(output_list)).replace('\r\n','\n')).split('\n') return output_l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def telnet_run(self, cmd_list, prompt_usr='Username:', prompt_pwd='Password:', prompt_ena='>',\n prompt_conf=']', timeout=2, LOGIN_LOG=0):\n prompt_usr = prompt_usr.encode(\"ascii\")\n prompt_pwd = prompt_pwd.encode(\"ascii\")\n prompt_ena = prompt_ena.encode(\"ascii\")\n ...
[ "0.7024742", "0.67167115", "0.6706943", "0.65913546", "0.65091944", "0.645665", "0.62801105", "0.6189571", "0.61475736", "0.61325663", "0.60985357", "0.6096203", "0.6044156", "0.60315806", "0.60073096", "0.5959323", "0.5922411", "0.5920338", "0.5898053", "0.58856004", "0.5876...
0.0
-1
Python function for importing the MNIST data set. It returns an iterator of 2tuples with the first element being the label and the second element being a numpy.uint8 2D array of pixel data for the given image.
def read(dataset = "training", path = "."): if dataset is "training": fname_img = os.path.join(path, 'train-images-idx3-ubyte') fname_lbl = os.path.join(path, 'train-labels-idx1-ubyte') elif dataset is "testing": fname_img = os.path.join(path, 't10k-images-idx3-ubyte') fname_lbl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def readmnist(dataset = \"training\", path = \".\"):\n\n if dataset is \"training\":\n fname_img = os.path.join(path, 'train-images.idx3-ubyte')\n fname_lbl = os.path.join(path, 'train-labels.idx1-ubyte')\n elif dataset is \"testing\":\n fname_img = os.path.join(path, 't10k-images.idx3-u...
[ "0.7315804", "0.7006713", "0.6858111", "0.679963", "0.67536896", "0.66597587", "0.6541016", "0.6534925", "0.64882743", "0.6464874", "0.64425945", "0.6425871", "0.6410244", "0.63993555", "0.63947785", "0.63876855", "0.6385198", "0.638357", "0.63787776", "0.6377489", "0.6373172...
0.6018545
67
Render a given numpy.uint8 2D array of pixel data.
def show(image): from matplotlib import pyplot import matplotlib as mpl fig = pyplot.figure() ax = fig.add_subplot(1,1,1) imgplot = ax.imshow(image, cmap=mpl.cm.Greys) imgplot.set_interpolation('nearest') ax.xaxis.set_ticks_position('top') ax.yaxis.set_ticks_position('left') pyplot.s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_pixel_array(arr, figsize=(10, 10)):\n arr = arr.squeeze()\n plt.figure(figsize=figsize)\n plt.imshow(arr, cmap=plt.cm.bone)\n plt.show()", "def render(self):\n np_img = np.array(self.prev_img, dtype=np.uint8)\n np_img = np.swapaxes(np_img, 0, 2)\n return np_img", "def ...
[ "0.6824776", "0.6289643", "0.5894268", "0.5886476", "0.58250576", "0.5715473", "0.570549", "0.5702945", "0.5690092", "0.56785333", "0.567429", "0.56699634", "0.56405544", "0.5639835", "0.5638185", "0.562523", "0.56111133", "0.5560625", "0.5559693", "0.5551056", "0.55414987", ...
0.0
-1
Adds 5 latest blog posts as `latest_articles`, 5 latest comments as `latest_comments`, and all tags (annotated with `num_articles` field) as `tags` to the context, regardless of `request`.
def latest_content(request): latest_articles = Article.published_articles()[:5] latest_comments = Comment.objects.all().order_by('-pub_date')[:5] tags = Tag.objects.annotate(num_articles=Count('article')).order_by( '-num_articles') contributors = Contributor.objects.annotate( num_article...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def latest_blog_posts(self, request, *args, **kwargs):\n context = self.get_context(request, *args, **kwargs)\n context[\"latest_posts\"] = MyblogDetailPage.objects.live().public()[:1] \n return render(request, \"myblog/latest_posts.html\", context)", "def last_five(request):\n fla...
[ "0.6630519", "0.6064325", "0.5982739", "0.5916848", "0.58361304", "0.5788325", "0.57815117", "0.5755909", "0.57152796", "0.56332666", "0.56171244", "0.5601291", "0.5582968", "0.54634035", "0.5452473", "0.53599924", "0.5354808", "0.5313329", "0.52591276", "0.522024", "0.521882...
0.67686737
0
Format a Roku Channel name.
def format_channel_name(channel_number: str, channel_name: str | None = None) -> str: if channel_name is not None and channel_name != "": return f"{channel_name} ({channel_number})" return channel_number
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def channel_name(radio_id: int, channel_id: int) -> str:\n return f\"COMM{radio_id} Ch {channel_id}\"", "def channelName(self):\n channel_list = (\"Neutral\",\n \"BBC1\",\n \"BBC2\",\n \"ITV\",\n \"Channel 4...
[ "0.78294134", "0.7059564", "0.6983384", "0.68293834", "0.68293834", "0.68293834", "0.68293834", "0.68293834", "0.68293834", "0.68293834", "0.68293834", "0.68293834", "0.68293834", "0.68293834", "0.68293834", "0.68293834", "0.68293834", "0.68293834", "0.68293834", "0.68293834", ...
0.7868498
1
Input filepath of financial data csv dump compile all the information into one dataframe return dataframe containing Adjusted price values of each security listed in directory
def compile_index_data(data_filepath,index_name): # find existing .pickle file filename = [_ for _ in glob.glob('*.pickle') if index_name in _ ][0].split('.')[0] + '_adj_close.csv' # with open(pickle_list[0],'rb') as f: # tickers = pickle.load(f) tickers = os.listdir(data_filepath) os.chdir(data_filepath) # r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_df(self, file_path):\n df = pd.read_csv(file_path, sep=\";\")\n df.rename(columns={\"Get\": \"Currency\"}, inplace=True)\n df = df[df[\"Pay\"] == \"Chaos Orb\"]\n df = df[[\"League\", \"Date\", \"Currency\", \"Value\"]]\n df[\"Date\"] = pd.to_datetime(df[\"Date\"])\n ...
[ "0.65828145", "0.62339157", "0.6199246", "0.6138019", "0.61140287", "0.6102608", "0.6034207", "0.6006899", "0.59451014", "0.5918473", "0.5865274", "0.5854998", "0.58193326", "0.58130115", "0.57813156", "0.5780981", "0.57623285", "0.5745247", "0.5731047", "0.57274765", "0.5706...
0.5412425
58
pricing data converted into percentage change to normalize data percentage change will be considered as features labels will be either buy, sell or hold. if each week, the company's increasing by 2% = buy if decreasing by 2% = sell, if neither, hold. Each model is made on a percompany basis, but each company is going t...
def process_data_for_labels(df, ticker, time_period): data_ = df.fillna(0) # ensuring NaN values are replaced by 0 incase data doesn't exist. # Avoiding inplace as it does not convert NaNs as expected, and will return None tickers = df.columns.values.tolist() # grab all adj close values of security for i in rang...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def percent_changes(self):\n\n # close_t = float(val[\"klines\"][\"1m\"].get(self.mw.cfg_manager.pair, {})[-5][4])\n klines_data = self.mw.klines.get(\"1m\")\n coin_data = klines_data.get(self.mw.cfg_manager.pair)\n\n if isinstance(coin_data, list):\n close_5m = float(self.mw...
[ "0.5864486", "0.5679427", "0.55887026", "0.55827385", "0.5496743", "0.5447927", "0.5396345", "0.5391044", "0.5382922", "0.5358451", "0.53466296", "0.53371716", "0.52985895", "0.528991", "0.52696675", "0.52553165", "0.5239735", "0.5239484", "0.5230781", "0.5222127", "0.522195"...
0.5120163
33
Returns an instance of fetcher
def initialize() -> fetcher.Fetcher: options = fetcher.Input( command="some_cmd", config_file="looker.ini", section="Looker" ) return fetcher.Fetcher(options)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_fetcher(self):\n return self.__fetcher", "def fetch(self) -> Fetch:\n return self._fetch", "def get_fetcher(\n launcher_url: str, output_dir: str, spec: Optional[str] = None\n) -> WorkflowFetcherBase:\n parsed_url = ParsedUrl(launcher_url)\n\n if parsed_url.scheme not in FETCHER_...
[ "0.7616966", "0.64553005", "0.6100894", "0.6082667", "0.59977883", "0.5952911", "0.58968616", "0.58818334", "0.5799498", "0.5791189", "0.5787772", "0.57814115", "0.57779944", "0.577231", "0.57723045", "0.5654948", "0.56429166", "0.56370324", "0.56276923", "0.56252486", "0.561...
0.6439661
2
fetcher.get_projects() should return a list of projects.
def test_get_projects_returns_projects(fc: fetcher.Fetcher): projects = fc.get_projects() assert isinstance(projects, list) assert isinstance(projects[0], models.Project)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_projects(self):\n projects = []\n page = 1\n while not len(projects) % 100:\n projects += self._get('/projects?{0}'.format(urllib.urlencode({'per_page': 100, 'page': page})))\n if not projects:\n break\n page += 1\n return projects...
[ "0.8439259", "0.8330137", "0.81635183", "0.790544", "0.7656669", "0.7634909", "0.7559611", "0.7557729", "0.7551785", "0.7523433", "0.7494402", "0.7446309", "0.74364996", "0.7427242", "0.73962003", "0.7385047", "0.73531884", "0.7350818", "0.73503566", "0.7344059", "0.7321423",...
0.862502
0
fetchet.get_projects() should be able to filter on project.
def test_get_projects_filters(fc: fetcher.Fetcher, test_project_name): projects = fc.get_projects(test_project_name) assert isinstance(projects, list) assert len(projects) == 1 assert projects[0].name == test_project_name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_projects(self):\n pass", "def test_list_project_request(self):\n pass", "def test_list_projects(self):\n pass", "def test_list_projects(self):\n pass", "def test_get_projects_returns_projects(fc: fetcher.Fetcher):\n projects = fc.get_projects()\n assert isinst...
[ "0.740072", "0.7351347", "0.7287984", "0.7287984", "0.72771144", "0.72143286", "0.7165112", "0.71590155", "0.7144451", "0.7075294", "0.7046728", "0.7021743", "0.70181876", "0.69926757", "0.698769", "0.6950364", "0.6894256", "0.68472075", "0.6795028", "0.67938405", "0.6792199"...
0.829477
0
fetchet.get_projects() should error if filter is invalid
def test_get_projects_throws_if_project_does_not_exist(fc: fetcher.Fetcher): with pytest.raises(exceptions.NotFoundError) as exc: fc.get_projects("BadProject") assert "An error occured while getting projects." in str(exc.value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_projects_filters(fc: fetcher.Fetcher, test_project_name):\n projects = fc.get_projects(test_project_name)\n assert isinstance(projects, list)\n assert len(projects) == 1\n assert projects[0].name == test_project_name", "def _get_filtered_projects(filters):\n projects_itr = (projects_l...
[ "0.8058686", "0.71893626", "0.70169073", "0.6866926", "0.6799763", "0.67065436", "0.66316026", "0.66316026", "0.6614815", "0.66046983", "0.65524906", "0.6446057", "0.64291626", "0.6345218", "0.63182366", "0.6217229", "0.6167629", "0.616253", "0.6144264", "0.612364", "0.611247...
0.59895086
24
fetcher.get_models() should return a list of models.
def test_get_models_returns_models(fc: fetcher.Fetcher): ml = fc.get_models() assert isinstance(ml, list) assert isinstance(ml[0], models.LookmlModel)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_models(self, req, is_detail):\n context = req.environ['meteos.context']\n\n search_opts = {}\n search_opts.update(req.GET)\n\n # Remove keys that are not related to model attrs\n search_opts.pop('limit', None)\n search_opts.pop('offset', None)\n sort_key = ...
[ "0.7452906", "0.72231185", "0.7150281", "0.71438277", "0.70214987", "0.69560665", "0.69169444", "0.6905092", "0.68741965", "0.6871369", "0.6853938", "0.6839921", "0.67970765", "0.67815137", "0.6671083", "0.66492426", "0.6614827", "0.65691483", "0.6551473", "0.64561534", "0.64...
0.769774
0
fetcher.get_models() should be able to filter on project or model.
def test_get_models_filters(fc: fetcher.Fetcher, test_project_name, test_model): ml = fc.get_models(project=test_project_name) assert all(m.project_name == test_project_name for m in ml) ml = fc.get_models(model=test_model["name"]) assert all(m.name == test_model["name"] for m in ml) ml = fc.get_m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_models(self, req, is_detail):\n context = req.environ['meteos.context']\n\n search_opts = {}\n search_opts.update(req.GET)\n\n # Remove keys that are not related to model attrs\n search_opts.pop('limit', None)\n search_opts.pop('offset', None)\n sort_key = ...
[ "0.72766924", "0.66285986", "0.6556921", "0.6551836", "0.6296319", "0.626473", "0.6252031", "0.61985433", "0.61647654", "0.61226976", "0.61226976", "0.607028", "0.60465264", "0.6035401", "0.60337895", "0.59634507", "0.5959686", "0.5941662", "0.5922241", "0.59054995", "0.58814...
0.75294465
0
fetcher.get_models() should throw if a model is not found.
def test_get_models_throws_if_model_does_not_exist(fc: fetcher.Fetcher, project, model): with pytest.raises(exceptions.NotFoundError) as exc: fc.get_models(project=project, model=model) assert "An error occured while getting models." in str(exc.value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_models_returns_models(fc: fetcher.Fetcher):\n ml = fc.get_models()\n assert isinstance(ml, list)\n assert isinstance(ml[0], models.LookmlModel)", "def get_models(self, app_name):\n try:\n models = list(apps.get_app_config(app_name).get_models())\n return models\...
[ "0.7327567", "0.69435924", "0.67743224", "0.67731684", "0.666128", "0.66390353", "0.6595562", "0.6590047", "0.64084816", "0.6316313", "0.6267025", "0.62651926", "0.626041", "0.6233475", "0.6200443", "0.61957514", "0.61935633", "0.61921066", "0.61672646", "0.61589247", "0.6154...
0.75194955
0
fetcher.get_models() should throw if a model is not found.
def test_get_models_throws_if_project_does_not_exist( fc: fetcher.Fetcher, project, model ): with pytest.raises(exceptions.NotFoundError) as exc: fc.get_models(project=project, model=model) assert "An error occured while getting projects." in str(exc.value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_models_throws_if_model_does_not_exist(fc: fetcher.Fetcher, project, model):\n with pytest.raises(exceptions.NotFoundError) as exc:\n fc.get_models(project=project, model=model)\n assert \"An error occured while getting models.\" in str(exc.value)", "def test_get_models_returns_models(fc...
[ "0.75194955", "0.7327567", "0.69435924", "0.67743224", "0.67731684", "0.66390353", "0.6595562", "0.6590047", "0.64084816", "0.6316313", "0.6267025", "0.62651926", "0.626041", "0.6233475", "0.6200443", "0.61957514", "0.61935633", "0.61921066", "0.61672646", "0.61589247", "0.61...
0.666128
5
fetcher.get_used_models() should return models that have queries against them.
def test_get_used_models(fc: fetcher.Fetcher, test_model): used_models = fc.get_used_models() assert isinstance(used_models, dict) assert len(used_models) > 0 assert all(type(model_name) == str for model_name in used_models.keys()) assert all(type(query_count) == int for query_count in used_models.v...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def availablemodels(self):\n return self.__models.keys()", "def _get_models(self, req, is_detail):\n context = req.environ['meteos.context']\n\n search_opts = {}\n search_opts.update(req.GET)\n\n # Remove keys that are not related to model attrs\n search_opts.pop('limit'...
[ "0.70178705", "0.66382486", "0.6534866", "0.631813", "0.63044095", "0.6285215", "0.61792207", "0.6041896", "0.60361505", "0.6007675", "0.592958", "0.5920479", "0.58479476", "0.5833444", "0.58288264", "0.5817674", "0.58034897", "0.58034897", "0.58034897", "0.58034897", "0.5747...
0.7987806
0
fetcher.get_explores() should return a list of explores.
def test_get_explores(fc: fetcher.Fetcher): explores = fc.get_explores() assert isinstance(explores, list) assert len(explores) > 0 assert isinstance(explores[0], models.LookmlModelExplore)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_explores_filters(fc: fetcher.Fetcher):\n explores = fc.get_explores(model=\"henry_dusty\")\n assert all(e.model_name == \"henry_dusty\" for e in explores)\n\n explores = fc.get_explores(model=\"henry_qa\", explore=\"explore_2_joins_all_used\")\n assert all(\n e.model_name == \"henry...
[ "0.6731509", "0.6563917", "0.6551571", "0.63968503", "0.63752097", "0.5857632", "0.57382774", "0.5567012", "0.54315007", "0.54032236", "0.5390805", "0.53766435", "0.52719086", "0.52510387", "0.52280146", "0.52221656", "0.5203557", "0.5185477", "0.5180662", "0.5156471", "0.514...
0.7531671
0
fetcher.get_explores() should be able to filter on model and/or explore.
def test_get_explores_filters(fc: fetcher.Fetcher): explores = fc.get_explores(model="henry_dusty") assert all(e.model_name == "henry_dusty" for e in explores) explores = fc.get_explores(model="henry_qa", explore="explore_2_joins_all_used") assert all( e.model_name == "henry_qa" and e.name == "...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_explores(fc: fetcher.Fetcher):\n explores = fc.get_explores()\n assert isinstance(explores, list)\n assert len(explores) > 0\n assert isinstance(explores[0], models.LookmlModelExplore)", "def test_get_used_explores(fc: fetcher.Fetcher, test_model, test_used_explore_names):\n used_expl...
[ "0.753411", "0.6666877", "0.6630365", "0.63271785", "0.6167889", "0.5833313", "0.55136293", "0.53865874", "0.53228235", "0.53056663", "0.5212486", "0.51720136", "0.51571435", "0.5055647", "0.50480455", "0.50150645", "0.49779034", "0.49160555", "0.49039322", "0.4895284", "0.48...
0.822642
0
fetcher.get_explores() should throw if an explore/model is not found.
def test_get_explores_throws_if_model_or_explore_does_not_exist( fc: fetcher.Fetcher, model: Optional[str], explore: Optional[str], msg: str ): with pytest.raises(exceptions.NotFoundError) as exc: fc.get_explores(model=model, explore=explore) assert msg in str(exc.value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_explores(fc: fetcher.Fetcher):\n explores = fc.get_explores()\n assert isinstance(explores, list)\n assert len(explores) > 0\n assert isinstance(explores[0], models.LookmlModelExplore)", "def test_get_explores_filters(fc: fetcher.Fetcher):\n explores = fc.get_explores(model=\"henry_du...
[ "0.79972434", "0.6808644", "0.64591634", "0.6081574", "0.6081095", "0.6056974", "0.5249449", "0.5153191", "0.5144307", "0.5057118", "0.49663934", "0.49415502", "0.4938596", "0.49360746", "0.49263144", "0.4916875", "0.49087682", "0.48916966", "0.48450214", "0.4824901", "0.4805...
0.73947066
1
fetcher.get_used_explores() should return all used explores.
def test_get_used_explores(fc: fetcher.Fetcher, test_model, test_used_explore_names): used_explores = fc.get_used_explores(model=test_model["name"]) assert isinstance(used_explores, dict) assert all(e in test_used_explore_names for e in used_explores)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_unused_explores(fc: fetcher.Fetcher, test_model, test_unused_explores):\n unused_explores = fc.get_unused_explores(model=test_model[\"name\"])\n assert all(e in test_unused_explores for e in unused_explores)", "def test_get_explores_filters(fc: fetcher.Fetcher):\n explores = fc.get_explores...
[ "0.7264244", "0.6198452", "0.6186663", "0.59214425", "0.5807355", "0.5651149", "0.56107587", "0.5609498", "0.5529075", "0.5527514", "0.5387147", "0.5349075", "0.52784765", "0.52772737", "0.5273169", "0.5267631", "0.52531534", "0.52378064", "0.52269423", "0.5195598", "0.515275...
0.7800213
0
fetcher.get_unused_explores() should return all unused explores.
def test_get_unused_explores(fc: fetcher.Fetcher, test_model, test_unused_explores): unused_explores = fc.get_unused_explores(model=test_model["name"]) assert all(e in test_unused_explores for e in unused_explores)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_used_explores(fc: fetcher.Fetcher, test_model, test_used_explore_names):\n used_explores = fc.get_used_explores(model=test_model[\"name\"])\n assert isinstance(used_explores, dict)\n assert all(e in test_used_explore_names for e in used_explores)", "def exploits(self):\n return self....
[ "0.6674417", "0.5879174", "0.573975", "0.5573522", "0.5512234", "0.5511594", "0.54789424", "0.5453956", "0.54249877", "0.5305752", "0.52119917", "0.5211895", "0.5186949", "0.5154393", "0.5097592", "0.50868165", "0.50696427", "0.4995546", "0.49941427", "0.49911252", "0.4978347...
0.7982038
0
fetcher.get_explore_fields() should return an explores fields.
def test_get_explore_fields_gets_fields( fc: fetcher.Fetcher, test_model, test_explores_stats ): test_explore = test_explores_stats[0] explore = fc.get_explores(model=test_model["name"], explore=test_explore["name"]) assert isinstance(explore, list) explore = explore[0] assert isinstance(explore...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_explore_fields_gets_fields_for_dimension_or_measure_only_explores(\n fc: fetcher.Fetcher, test_model, test_dimensions_or_measures_only_explores\n):\n expected = test_dimensions_or_measures_only_explores[0]\n explore = fc.get_explores(model=test_model[\"name\"], explore=expected[\"name\"])\n ...
[ "0.7630596", "0.71610755", "0.619276", "0.5935856", "0.5886932", "0.56719977", "0.56685346", "0.56128865", "0.5601622", "0.55978966", "0.55809444", "0.5578002", "0.55722994", "0.54728", "0.5469623", "0.5441008", "0.543378", "0.5390191", "0.5388459", "0.5369778", "0.5361909", ...
0.8270363
0
fetcher.get_explore_fields() should return when an explore has only dimensions or only measures.
def test_get_explore_fields_gets_fields_for_dimension_or_measure_only_explores( fc: fetcher.Fetcher, test_model, test_dimensions_or_measures_only_explores ): expected = test_dimensions_or_measures_only_explores[0] explore = fc.get_explores(model=test_model["name"], explore=expected["name"]) assert isins...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_explore_fields_gets_fields(\n fc: fetcher.Fetcher, test_model, test_explores_stats\n):\n test_explore = test_explores_stats[0]\n explore = fc.get_explores(model=test_model[\"name\"], explore=test_explore[\"name\"])\n assert isinstance(explore, list)\n explore = explore[0]\n assert is...
[ "0.79898906", "0.7255912", "0.57427955", "0.5689888", "0.5485005", "0.544207", "0.5428259", "0.54008704", "0.5328612", "0.52564484", "0.5198791", "0.5090246", "0.5081006", "0.5072066", "0.50549966", "0.5046278", "0.49843732", "0.49804208", "0.49604252", "0.49604252", "0.49590...
0.81051433
0
fetcher.get_explore_field_stats() should get the stats of all fields in an explore.
def test_get_explore_field_stats( fc: fetcher.Fetcher, looker_sdk: methods.Looker40SDK, test_model, test_used_explore_names, test_explores_stats, ): explore = fc.get_explores( model=test_model["name"], explore=test_used_explore_names[0] )[0] actual_stats = fc.get_explore_field_st...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_explore_fields_gets_fields(\n fc: fetcher.Fetcher, test_model, test_explores_stats\n):\n test_explore = test_explores_stats[0]\n explore = fc.get_explores(model=test_model[\"name\"], explore=test_explore[\"name\"])\n assert isinstance(explore, list)\n explore = explore[0]\n assert is...
[ "0.757388", "0.66561705", "0.5693254", "0.5563461", "0.5562313", "0.55102324", "0.55069894", "0.54181457", "0.5415948", "0.53354806", "0.53127414", "0.528702", "0.5241747", "0.52340806", "0.52330387", "0.52114326", "0.51936793", "0.5185652", "0.51400167", "0.5138318", "0.5132...
0.7587318
0
fetcher.get_explore_join_stats() should return the stats of all joins in an explore.
def test_get_explore_join_stats(fc: fetcher.Fetcher, test_model): explore = fc.get_explores( model=test_model["name"], explore="explore_2_joins_1_used" )[0] field_stats = { "explore_2_joins_1_used.d1": 10, "explore_2_joins_1_used.d2": 5, "explore_2_joins_1_used.d3": 0, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_join_info(node):\n operator_info = node['operatorInfo']\n analyze_info = node['AnalyzeInfo']\n\n if 'Join' in node['id']:\n # Join Node\n join_type = extract_join_type(operator_info)\n conditions = extract_join_conditions(operator_info)\n current_node = JoinPlan(joi...
[ "0.5480241", "0.53656536", "0.50666654", "0.5061134", "0.49818888", "0.4904676", "0.48338452", "0.48054832", "0.47597033", "0.47334749", "0.4718956", "0.47070545", "0.46772164", "0.46477938", "0.46049055", "0.45803955", "0.45192826", "0.44968593", "0.44656146", "0.44228086", ...
0.83031076
0
This is the main function.
def main(argv): parser = OptionParser() parser.add_option( "--output-dir", help="Output directory for generated files. Defaults to chromium root " "directory.") parser.add_option( "-v", "--verbose", action="store_true", help="Verbose logging output.") parser.add_option( "-c", "--ch...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main(...
[ "0.9125712", "0.9125712", "0.9125712", "0.9125712", "0.9125712", "0.9125712", "0.9125712", "0.9125712", "0.9125712", "0.9125712", "0.9125712", "0.9125712", "0.9125712", "0.9125712", "0.9125712", "0.9125712", "0.9125712", "0.9125712", "0.9125712", "0.9125712", "0.9125712", "...
0.0
-1
Compute Haversine distance between points. LatLongDistance(p1, p2) returns distance in meters between points p1 and p2. A point p is a list/array p=[longitude, latitude]
def latlong_distance(p1, p2): radius = 6371 # km lat1 = p1[1] * math.pi / 180.0 lat2 = p2[1] * math.pi / 180.0 lon1 = p1[0] * math.pi / 180.0 lon2 = p2[0] * math.pi / 180.0 deltaLat = lat2 - lat1 deltaLon = lon2 - lon1 a = (math.sin(deltaLat / 2)**2 + math.cos(lat1) * math.co...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def haversine(point_1, \n point_2):\n # Specify the radius of the Earth in kilometers\n earth_radius = 6372.8\n # Extract latitudes and longitudes from the provided points\n latitude_1 = point_1[0]\n latitude_2 = point_2[0]\n longitude_1 = point_1[1]\n longitude_2 = point_2[1]\n ...
[ "0.7411768", "0.7283244", "0.7281911", "0.7275467", "0.7160516", "0.7140681", "0.71359766", "0.706824", "0.7068029", "0.7050806", "0.70261496", "0.70184296", "0.69995123", "0.6997063", "0.69919103", "0.6987301", "0.69823533", "0.69742984", "0.6964179", "0.6947977", "0.6935867...
0.71147573
7
Normalize audio file to range [1, 1]
def normalize(audio): norm = audio/max(audio) return norm
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize(filename,wout=True):\n n, data, data_dB,sr,ch=inputwav(filename)\n if ch==1:\n diff=0-max(data_dB)\n if ch==2:\n d1=0-max(data_dB[:,0])\n d2=0-max(data_dB[:,1])\n diff=max(d1,d2)\n print('Adding '+str(diff)+' dB...')\n data_dB_norm=data_dB+diff\n data_nor...
[ "0.6990606", "0.69585127", "0.6922056", "0.6835355", "0.6835355", "0.66305023", "0.64685136", "0.64316094", "0.6400724", "0.6398994", "0.63599336", "0.6334538", "0.63280183", "0.62815994", "0.62611055", "0.62473464", "0.6237534", "0.6221386", "0.6176301", "0.6140515", "0.6132...
0.78221744
0
Load an audio file and divide into 10 second segments.
def segment_10s(audio, sr): seg_files = {} n_seg = int((len(audio)/sr)/10) for i in range(n_seg): segment = audio[10*i*sr:(i+1)*10*sr] seg_files[i] = segment return seg_files
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, secs, path, concat=True):\n audio = np.empty((1,))\n secs_loaded = 0\n files_loaded = 0\n files = glob.glob(path + \"*.wav\")\n for file in files:\n (sr, samples) = wavfile.read(file)\n audio = np.concatenate((audio, samples))\n\n ...
[ "0.64271533", "0.6278708", "0.6274508", "0.6185571", "0.60926473", "0.6001208", "0.59411097", "0.59162825", "0.59099066", "0.5908874", "0.58851975", "0.58825463", "0.58139896", "0.5805803", "0.5801357", "0.57745636", "0.57619977", "0.5760922", "0.5745996", "0.56929225", "0.56...
0.62473094
3
Load an audio file and segment into 10s increments Save each segment to the target directory. Append the gender of the speaker and the segment index to the filename.
def segment_audio(filename, y_value, split='train', clf='gender'): filepath = 'recordings/recordings/' + filename + '.mp3' audio, sr = librosa.load(filepath, sr=16000) audio = normalize(audio) # Add gender label to filename for later processing sex = y_value if sex == 'female': filenam...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def file_generator(files: list,\n segment_duration: float,\n sampleRate: int,\n db_thr: float or None = None,\n frame_length: int = 512,\n hop_length: int = 128,\n ) -> None:\n\n I = 0\n J = 0\n\n s...
[ "0.5985446", "0.5802684", "0.57816744", "0.5737059", "0.5693634", "0.5681921", "0.55937463", "0.5582633", "0.5564124", "0.55507296", "0.55322385", "0.5512459", "0.55056393", "0.5496371", "0.54751974", "0.5456971", "0.5410829", "0.5401392", "0.53417194", "0.5321298", "0.531510...
0.70655805
0
Load an audio file (or segment). Add random noise to the file and save with new filename.
def noisy_data(filename, split='train', clf='gender'): filepath = 'data/{}/{}/{}o.wav'.format(clf, split, filename) audio, sr = librosa.load(filepath, sr=16000) # Add noise noisy = add_noise(audio) # Write noise to file sf.write('data/{}/{}/{}n.wav'.format(clf, split, filename), noisy, sr) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_audio(file_path):\n # load the audio file in its original sampling rate\n audio_data, sr = librosa.load(file_path, sr=sampling_rate)\n\n # get the common file name\n file_name = file_path.split(\"/\")[-1]\n file_name = file_name.split(\".wav\")[0]\n\n # calculate number of samples in the...
[ "0.62971425", "0.6159043", "0.5984587", "0.59020734", "0.58086365", "0.5675305", "0.56475496", "0.5606833", "0.559785", "0.5565294", "0.54593736", "0.54581594", "0.5443855", "0.5441127", "0.54234785", "0.542045", "0.5408668", "0.53995633", "0.53893155", "0.5381253", "0.537922...
0.689111
0
Upload a file to S3 or move to another directory. INPUT_DIR is the name of the directory with parquets. DETECTIONS_DIR can be a
def upload_file( input_dir, output_dir, partition, node_id, job_id, pattern, file_format ): logging.basicConfig( level=logging.INFO, format="%(asctime)s %(levelname)s %(name)s.%(funcName)s: %(message)s", datefmt="%Y-%m-%d %H:%M:%S", ) logging.info(f"Job: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upload_data(dir, input_dir, s3_dir):\n config = _read_config(dir)\n sage_maker_client = sagemaker.SageMakerClient(config.aws_profile, config.aws_region)\n\n return sage_maker_client.upload_data(input_dir, s3_dir)", "def upload_file_to_s3(bucket_name, input_filepath, output_filename):\n s3 = boto3...
[ "0.6746442", "0.6491204", "0.63522506", "0.6235617", "0.6157146", "0.61324275", "0.6127183", "0.6115192", "0.61045253", "0.6098759", "0.60934263", "0.6089703", "0.60668164", "0.60577595", "0.5977721", "0.5973843", "0.59473646", "0.5942112", "0.5934158", "0.5906467", "0.590605...
0.0
-1
Get the state of the fsm
def get_state(self, node_uuid, index): return self.state
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetState(self):\r\n \r\n return self.state", "def getState():\n # TODO: this isn't nearly as meaningful as it used to be", "def getState(self):\r\n return self._get_SS_State()#self.currentState\r", "def _get_state(self):\n return self.__state", "def _get_state(self):\...
[ "0.77134407", "0.76589096", "0.76107895", "0.7550614", "0.7550614", "0.7550614", "0.7550614", "0.7550614", "0.7550614", "0.7550614", "0.7550614", "0.7550614", "0.7550614", "0.7550614", "0.7550614", "0.7550614", "0.7550614", "0.7550614", "0.7550614", "0.7550614", "0.7550614", ...
0.0
-1
Get a lock on the bus
def bus_acquire(self, blocking=True): if self._bus_lock.acquire(blocking): return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_lock(name):\n return _handler_locks[name]", "def get_lock():\n\n return multiprocessing.Lock()", "def get_lock(self, name, try_=False):\n lock = Lock(self, name, try_)\n with lock as got_lock:\n yield got_lock", "def get_lock(self):\n function_string = 'IFLOC...
[ "0.7457342", "0.7200968", "0.7150414", "0.71146137", "0.6958682", "0.6892568", "0.6885043", "0.6851491", "0.67310303", "0.6696432", "0.66290563", "0.66086996", "0.6608197", "0.66038275", "0.65713847", "0.6433796", "0.6428536", "0.6421543", "0.6370052", "0.63416463", "0.633213...
0.569449
69
Release a lock on the bus
def bus_release(self): self._bus_lock.release()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def release_lock():\r\n get_lock.n_lock -= 1\r\n assert get_lock.n_lock >= 0\r\n # Only really release lock once all lock requests have ended.\r\n if get_lock.lock_is_enabled and get_lock.n_lock == 0:\r\n get_lock.start_time = None\r\n get_lock.unlocker.unlock()", "def release_lock(self...
[ "0.7924762", "0.7834396", "0.77969474", "0.77904904", "0.74435604", "0.74268526", "0.73679256", "0.7322436", "0.7123128", "0.7118452", "0.71132535", "0.709967", "0.7089947", "0.70288163", "0.7005624", "0.699237", "0.6928809", "0.6910996", "0.6896251", "0.687286", "0.6866911",...
0.8140664
0
Get status of the lock
def bus_locked(self): return self._bus_lock.locked()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lock_status(self) -> Dict[str, str]:\n self.__logger.debug('Eva.lock_status called')\n return self.__http_client.lock_status()", "def getstatus(self):\n with self.lock:\n return (self.status, self.time_start)", "def get_raw_status(self):\n self.__param_lock.acquire()\n ...
[ "0.79571366", "0.72897905", "0.72555906", "0.72103953", "0.70631886", "0.7003551", "0.6984304", "0.6949121", "0.69234353", "0.69027823", "0.6886226", "0.6849591", "0.68323433", "0.67312163", "0.6725681", "0.67219126", "0.67061067", "0.6695192", "0.6695192", "0.6695192", "0.66...
0.0
-1
Retrieve data Don't do long task in loop. Use a separated thread to not perturbate the nodeman
def loop(self, stopevent): for bus in self.buses: self.buses[bus].loop(stopevent)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_data_thread(self, ip):\n get_data_thread = Thread(target=self.get_data, args=[ip])\n get_data_thread.start()", "def fetch_data():\n data.fetch_data()\n data.start_updating()", "def main(self):\n while True:\n if not self.data_server_command.empty():\n ...
[ "0.696191", "0.6716008", "0.65941787", "0.6481667", "0.6426779", "0.6374192", "0.62645483", "0.61824685", "0.610256", "0.60537034", "0.60457593", "0.60247904", "0.5971915", "0.59577423", "0.5926537", "0.59190476", "0.58765227", "0.5859717", "0.5845389", "0.58351386", "0.58195...
0.0
-1
Change the position of the pan
def set_position(self, node_uuid, index, data): try: servox = self._bus.nodeman.find_node('servox') servoy = self._bus.nodeman.find_node('servoy') logger.debug('[%s] - set_position of servos %s and %s', self.__class__.__name__, servox, servoy) if data is None or d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def panTo(self, p=None):\n if p == None:\n p = self.focus\n MV = self.MV\n vr = self.getViewRight()\n vu = self.getViewUp()\n p = -p\n x = np.dot(p, vr) # dot product\n y = np.dot(p, vu)\n MV[3, :2] = x, y # set first two entries of 4th row to x, y...
[ "0.7055883", "0.7055883", "0.69751316", "0.66623855", "0.65398514", "0.6447946", "0.6447465", "0.64395374", "0.6402126", "0.63889927", "0.63513035", "0.63486654", "0.63106734", "0.6296175", "0.6237631", "0.62298304", "0.62075496", "0.6197965", "0.61601925", "0.61556464", "0.6...
0.0
-1
Decorator to be used in apimethods to serve the swaggerdocumentation for this api.
def api_documentation(api: str, summary: str, in_model: BaseModel, out_model: BaseModel, out_description: str) -> Callable: for model, name in ((in_model, 'Input'), (out_model, 'Output')): doc.Object( make_dataclass( f'Api{api[1:].title()}{name}', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index():\n definition = {\n \"swagger\": \"2.0\",\n \"info\": {\n \"title\": flask.current_app.config.get(\"APPNAME\", \"Not specified\"),\n \"version\": flask.current_app.config.get(\"VERSION\", \"Not specified\"),\n },\n \"host\": request.host,\n \"...
[ "0.7308593", "0.67804843", "0.67267275", "0.6568308", "0.6500626", "0.6489433", "0.64708114", "0.64436257", "0.63863075", "0.6336464", "0.6331381", "0.6279588", "0.6140457", "0.6124011", "0.6117498", "0.6093394", "0.60924906", "0.60902476", "0.60646194", "0.6054501", "0.60270...
0.6823912
1
Decorator to be used in apimethods to convert the requestdata to an instance of the passed `model`. This instance is passed to the decorated apiendpoint as the parameter `service_params`.
def api_inputmodel(api: str, model: BaseModel, servicename: str, service_logger: logger) -> Callable: def decorator(func): @wraps(func) async def function_wrapper(request, *args, **kwargs): try: service_params = model.parse_raw(request.body) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def api_outputmodel(api: str, model: BaseModel, servicename: str,\n service_logger: logger) -> Callable:\n\n def decorator(func):\n @wraps(func)\n async def function_wrapper(request, *args, **kwargs):\n service_result = await func(request, *args, **kwargs)\n ...
[ "0.6261429", "0.61969465", "0.5975331", "0.56145257", "0.5604642", "0.55971265", "0.558913", "0.5562619", "0.54409605", "0.5427529", "0.5384895", "0.53138745", "0.531021", "0.5299018", "0.52693087", "0.52421254", "0.5187899", "0.5182848", "0.51826674", "0.5159831", "0.5159831...
0.7151013
0
Decorator to be used in apimethods to convert the responsedata of the decorated apimethod to a json based on the passed `model`.
def api_outputmodel(api: str, model: BaseModel, servicename: str, service_logger: logger) -> Callable: def decorator(func): @wraps(func) async def function_wrapper(request, *args, **kwargs): service_result = await func(request, *args, **kwargs) try: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def json_response(func):\n\t@wraps(func)\n\tdef decorated_view(*args, **kwargs):\n\t\tdata = func(*args, **kwargs)\n\t\tdata = json.dumps(data)\n\t\tresponse = make_response(data)\n\t\tresponse.headers['Content-Type'] = 'application/json'\n\t\treturn response\n\treturn decorated_view", "def json_response(func):\...
[ "0.6303589", "0.6233411", "0.6158551", "0.61566204", "0.61502767", "0.6142237", "0.6134618", "0.60121006", "0.60005003", "0.5990344", "0.59364825", "0.59224707", "0.59192204", "0.5905445", "0.58905154", "0.58634555", "0.5848181", "0.5831524", "0.58291614", "0.58150035", "0.57...
0.6607163
0
Route to send calculator input
def operation_result(): input1 = request.form['Input1'] input2 = request.form['Input2'] input3 = request.form['Input3'] input4 = request.form['Input4'] input5 = request.form['Input5'] input6 = request.form['Input6'] try: token_price_a_initial = float(input1) token_pri...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculator(operation): \n \n operation = MATH[operation]\n a = int(request.args.get(\"a\"))\n b = int(request.args.get(\"b\"))\n total = operation(a, b)\n\n return f\"<h1>TOTAL: {total}</h1>\"", "def all_arithmetic_operators(request: Any) -> Any:\n return request.param", "def all_arith...
[ "0.6870682", "0.62640357", "0.62640357", "0.6200235", "0.60145706", "0.6007947", "0.5992822", "0.59635174", "0.5928874", "0.58482105", "0.58049804", "0.5771265", "0.5717723", "0.56060153", "0.5605487", "0.5560057", "0.55397177", "0.5519091", "0.54609567", "0.5438152", "0.5435...
0.5568533
15
Create a new branch.
def create_branch(self, name, base_name, from_sha=False): logger.debug( 'GitHubAPI.create_branch: name={}, base_name={}'.format( name, base_name ) ) # raise an error if we can find the branch, continue if we get # a 404 try: se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_branch(self):\n os.chdir(str(self.repository_path))\n sh.git.checkout('master')\n sh.git.checkout('-b', self.branch)\n logger.debug('Branch {} created', self.branch)", "def create_branch(ctx, name, sha):\n\n try:\n\n gh = ctx.obj.github\n\n log.echo('Creati...
[ "0.8263331", "0.77891356", "0.76186675", "0.72726834", "0.71636385", "0.7043409", "0.69660765", "0.6948939", "0.6918359", "0.6828066", "0.6820213", "0.6789778", "0.67066014", "0.660529", "0.66019213", "0.65866226", "0.6435828", "0.6376282", "0.62368584", "0.62368584", "0.6212...
0.6839864
9
Update attempt to update branch to the given SHA.
def update_branch(self, name, sha): branch_info = { 'sha': sha, } resp = self.patch('git/refs/heads/{}'.format(name), json=branch_info) try: resp.raise_for_status() except Exception: logger.error(resp.json()) raise return ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_latest_branch (product, which, main_branch):\n\n name = \"Latest_ACE7TAO3_\" + which\n\n vprint ('Fast-forwarding', name, 'to', main_branch)\n ex (\"cd $DOC_ROOT/\" + product + \" && git fetch . \" + main_branch + \":\" + name)", "def update(self, branch=None):\n if branch is None:\n ...
[ "0.62394434", "0.62033707", "0.58707505", "0.5823983", "0.57316476", "0.5548735", "0.54924744", "0.5490744", "0.54566896", "0.53568214", "0.533697", "0.53313905", "0.5318119", "0.5305053", "0.52909243", "0.52125496", "0.5172792", "0.51444185", "0.5125727", "0.5123589", "0.511...
0.70466286
0
Create a new pull request
def create_pull_request(self, base, head, title, body=None): pull_info = { 'title': title, 'head': head, 'base': base } if body: pull_info['body'] = body logger.info(pull_info) resp = self.post('pulls', json=pull_info) try...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_pull_request(filepath, github_account):\n repo = _git.clone_from_github(\n _repo_path(), join(filepath, _repo_name()), github_account=github_account)\n branch = ('update-discovery-artifacts-' +\n datetime.datetime.now().strftime('%Y%m%d-%H%M%S'))\n repo.checkout_new(branch)\n i...
[ "0.70592564", "0.704382", "0.6956816", "0.6912854", "0.6759392", "0.6718217", "0.67178744", "0.66204125", "0.6516321", "0.6229428", "0.61973286", "0.61781627", "0.61508805", "0.614511", "0.614511", "0.61279315", "0.61080235", "0.60647273", "0.60609627", "0.603208", "0.6000777...
0.62417126
9
Verify that the release is actually read to be released If the release is new (corresponds to a release branch), then we check that the release is merged into master. If we can not find the release branch, we assume that it is a hotfix and we verify that the major version number matches the latest release.
def check_release_status(self, release_name, release_branch): logger.debug('GitHubAPI.check_release_status args: {}; {}'.format( release_name, release_branch) ) release_version = extract_release_branch_version(release_name) release_branch_base = build_release_base_name(get_co...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_release_branch():\n diff_string_config_yml = run_command(\"git diff origin/master .circleci/config.yml\")\n if re.search(r'[+-][ ]+CONTENT_VERSION: \".*', diff_string_config_yml):\n return True\n\n return False", "def verify_tags(git_ref_target):\n latest_release = github_util.get_lates...
[ "0.69423383", "0.6784403", "0.66795766", "0.6649919", "0.6507445", "0.64944094", "0.63654304", "0.6350596", "0.6347604", "0.63336277", "0.6305721", "0.6219666", "0.62047046", "0.61802447", "0.6172858", "0.612331", "0.6118963", "0.6113204", "0.6088553", "0.60614514", "0.604839...
0.73628855
0
Evaluate the mfcc_length for a given file
def get_mfcc_length_from_duration(duration): length = int(duration // FRAME_STRIDE) - 1 return length
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wav2mfcc(file_path, max_len=44, n_mfcc=20):", "def mfcc(path, windowsize, overlap, M):\n srate, data = scipy.io.wavfile.read(path)\n\n bank = filterbank(0, srate/2, M, srate, windowsize)\n buckets = bucketize(data/32768.0, windowsize, overlap)\n energies = buckets.dot(bank.transpose())\n\n ret...
[ "0.6658678", "0.6523835", "0.6392451", "0.61464643", "0.5918345", "0.58868235", "0.5885237", "0.5809652", "0.5772686", "0.5743787", "0.57237357", "0.56915265", "0.5688", "0.5644551", "0.56252927", "0.5590044", "0.5578385", "0.55762726", "0.5562501", "0.5446046", "0.54189724",...
0.60624254
4
Reads in audio file, processes it
def process_audio_file(self, file_name): sig, sr = librosa.load(file_name, mono=True) return self._extract_function(sig, sr)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_audio(f, downmix):\n if f.endswith('.mp3'):\n f = _mp3_hook(f)\n sr, audio = scipy.io.wavfile.read(f)\n if not audio.dtype is np.float32:\n audio = _normalize_pcm(audio)\n if downmix and len(audio.shape) == 2:\n audio = down_mix(audio)\n return sr, audio", "def audioR...
[ "0.7045707", "0.6956398", "0.6821181", "0.6742061", "0.6704527", "0.6699321", "0.6644113", "0.6615665", "0.64650714", "0.6453779", "0.63955903", "0.63811314", "0.63749427", "0.6367572", "0.63429946", "0.6340871", "0.633396", "0.6314544", "0.6308602", "0.6294938", "0.6285965",...
0.72694874
0
Reads in audio file, processes it
def process_signal(self, sig, sr): return self._extract_function(sig, sr)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_audio_file(self, file_name):\n sig, sr = librosa.load(file_name, mono=True)\n return self._extract_function(sig, sr)", "def read_audio(f, downmix):\n if f.endswith('.mp3'):\n f = _mp3_hook(f)\n sr, audio = scipy.io.wavfile.read(f)\n if not audio.dtype is np.float32:\n ...
[ "0.72694874", "0.7045707", "0.6956398", "0.6821181", "0.6742061", "0.6704527", "0.6699321", "0.6644113", "0.6615665", "0.64650714", "0.6453779", "0.63955903", "0.63811314", "0.63749427", "0.6367572", "0.63429946", "0.6340871", "0.633396", "0.6314544", "0.6308602", "0.6294938"...
0.0
-1
Compute log mel filterbank features with deltas and double deltas
def _extract_fbank(self, sig, sr): emphasized_signal = np.append(sig[0], sig[1:] - 0.97 * sig[:-1]) frame_length, frame_step = FRAME_SIZE * sr, FRAME_STRIDE * sr signal_length = len(emphasized_signal) frame_length = int(round(frame_length)) frame_step = int(round(frame_step)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def logMelSpectrum(input, samplingrate):\n nfft = input.shape[1]\n N = input.shape[0]\n filters = trfbank(samplingrate, nfft)\n\n # plot Mel filters\n # plt.plot(filters)\n # plt.title('Mel filters')\n # plt.show()\n\n output = np.zeros((N, filters.shape[0]))\n for j in range(filters.sha...
[ "0.6378001", "0.6166156", "0.6106605", "0.5986836", "0.59717876", "0.59704345", "0.59436226", "0.59277886", "0.59004104", "0.5880232", "0.58595026", "0.5850303", "0.5847764", "0.5805098", "0.5797871", "0.5773712", "0.57430214", "0.5730535", "0.5728411", "0.5695498", "0.569287...
0.0
-1
Create the game, SpaceInvaders. Train or test it.
def __init__ (self,gameName,total_episodes=50,train_or_test=2): #additional param:- doLoadNetwork=True self.createGame(gameName) ### Training Hyperparameters self.TOT_EPISODES = total_episodes #no. of episodes/epochs self.MAX_STEPS = 50000 #max steps taken every episode/epoch ### Pr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, game_name, skip_actions=4, num_frames=4, w=84, h=84):\n self.env = gym.make(game_name)\n self.num_frames = num_frames\n self.skip_actions = skip_actions\n self.w = w\n self.h = h\n\n if game_name == 'SpaceInvaders-v0':\n self.action_space=[1,2...
[ "0.6907318", "0.68599695", "0.6728783", "0.66609395", "0.6579913", "0.6554996", "0.6510835", "0.64591074", "0.64184606", "0.6393087", "0.63915473", "0.6364802", "0.6364802", "0.6364802", "0.6364802", "0.6364802", "0.6359255", "0.635703", "0.63438934", "0.6340655", "0.63222647...
0.0
-1
load the network from saved.h5
def load_network(self): self.dqn.load_network(self.path)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_network(self, which_epoch):\n save_filename = '%s_net.pth' % which_epoch\n load_path = os.path.join(self.save_dir, save_filename)\n net = self.net\n if isinstance(net, torch.nn.DataParallel):\n net = net.module\n print('loading the model from %s' % load_path)\...
[ "0.71672744", "0.7150659", "0.6883396", "0.67808", "0.6710601", "0.66247654", "0.6531737", "0.64843845", "0.64828396", "0.6471173", "0.6450578", "0.64475465", "0.6441468", "0.64281887", "0.6308086", "0.6201771", "0.6194544", "0.61861485", "0.61786836", "0.61785096", "0.617107...
0.7140678
2
Train the model for a certain no of episodes
def trainAgent(self): for episode in range(self.TOT_EPISODES): #reset environment, stacked frames every episode. state = self.env.reset() rewards = 0 #preprocess and stack the frame/state. state, self.stacked_frames = stack_frames(self.stack_size, self.stacked_frames, state, True) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train(self, num_episodes, max_episode_steps=100, save_freq=100, render=False):\n while self.episodes_done < num_episodes:\n self.trainOneEpisode(num_episodes, max_episode_steps, save_freq, render)\n self.saveCheckpoint()", "def train(self, training_steps=10):", "def train(\n ...
[ "0.75523275", "0.743832", "0.74258286", "0.7422637", "0.7364126", "0.73365295", "0.73187625", "0.72586364", "0.7242011", "0.7233209", "0.72105044", "0.7161378", "0.71507365", "0.713142", "0.71212167", "0.71001995", "0.7051916", "0.7029939", "0.7000444", "0.6976201", "0.693145...
0.66573066
38
Test the agen and watch it play for one episode.
def simulate(self): print("##################################") print("SIMULATING GAME - SpaceInvaders..") print("##################################") # Play 3 episodes: for i in range(3): print("Playing Episode %d" % i) state = self.env.reset() #self.env.render() done = False tot...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test():\n env = gym.make('CartPole-v1')\n\n results = []\n for _ in range(100):\n results.append(episode(env, render=False, verbose=False))\n\n print(f'average={sum(results) / len(results)} '\n f'max={max(results)} '\n f'min={min(results)}')", "def test_scraper(self):\n ...
[ "0.6574454", "0.64675266", "0.6428111", "0.6335772", "0.6264014", "0.6199133", "0.6197816", "0.6196485", "0.6193701", "0.6170308", "0.6169579", "0.61569935", "0.61476463", "0.60803", "0.6072124", "0.60470563", "0.6037859", "0.6029739", "0.60170627", "0.60096955", "0.59748065"...
0.0
-1
This function is called to check if a username / password combination is valid.
def check_auth(username, password): return (username == app.config['USERNAME'] and password == app.config['PASSWORD'])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_auth(username, password, expected_user, expected_pw):\n return username == expected_user and password == expected_pw", "def validate_authentication(self, username, password):\n return self.user_table[username]['pwd'] == password", "def check_auth(username, password):\n return usernam...
[ "0.82211864", "0.8146436", "0.7975914", "0.7962432", "0.7885527", "0.78588223", "0.78382313", "0.78288996", "0.7815222", "0.7798579", "0.77856815", "0.77700555", "0.7760794", "0.7754975", "0.77548647", "0.7750886", "0.7749223", "0.77322245", "0.7715806", "0.7685904", "0.76736...
0.7687129
19
Sends a 401 response that enables basic auth
def authenticate(): return Response(render_template('index.html', auth=False), 401, {'WWW-Authenticate': 'Basic realm="Login Required"'})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authenticate():\n return Response('Not Authorized', 401, {'WWW-Authenticate': 'Basic realm=\"api\"'})", "def authenticate():\n return Response(\n '', 401, {'WWW-Authenticate': 'Basic realm=\"Login Required\"'}\n )", "def authenticate():\n return Response(\n 'You have to login with pro...
[ "0.8093736", "0.80926424", "0.7958403", "0.7852648", "0.7843114", "0.7824419", "0.7810746", "0.7810746", "0.7810746", "0.7810746", "0.7810746", "0.7810746", "0.7810746", "0.7810746", "0.7810746", "0.7810746", "0.7810746", "0.7810746", "0.7810746", "0.7810746", "0.7810746", ...
0.76140213
41
Check if no user login
def require_visitor(func): @wraps(func) def decorator(*args, **kwargs): if g.user: return redirect(url_for('site.home')) return func(*args, **kwargs) return decorator
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_user_and_login(self) -> Response:\n pass", "def check_auth_none(self, username):\n return AUTH_FAILED", "def check_user_logged():\n global user\n if 'user' not in session:\n return False\n else:\n user = session.get('user')\n return user['username'] != ''", "...
[ "0.7631167", "0.7377581", "0.7348826", "0.7320364", "0.72438157", "0.7098895", "0.70730084", "0.70391387", "0.6981259", "0.6977111", "0.6969315", "0.6933913", "0.69154346", "0.6907214", "0.6865833", "0.6815512", "0.6799823", "0.67882526", "0.67734057", "0.67627156", "0.670679...
0.0
-1
Check if user login
def require_user(func): @wraps(func) def decorator(*args, **kwargs): if not g.user: # flash('此操作需要登录账户') return render_template('account/error.html', error='抱歉,您无权进行该操作!') # return redirect(url_for('site.login')) return func(*args, **kwargs) return decor...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_user_and_login(self) -> Response:\n pass", "def is_correct_user(self, login, password):\n pass", "def check_user_logged():\n global user\n if 'user' not in session:\n return False\n else:\n user = session.get('user')\n return user['username'] != ''", "def log...
[ "0.8381395", "0.8055585", "0.7813263", "0.7678583", "0.7649151", "0.7576734", "0.7567418", "0.7521423", "0.75094885", "0.7488563", "0.74643886", "0.7460811", "0.7460811", "0.7443086", "0.7417814", "0.74102914", "0.7391327", "0.73445153", "0.73423046", "0.72956836", "0.7277331...
0.0
-1
Check if mobile user login
def require_mobile_user(func): @wraps(func) def decorator(*args, **kwargs): if not g.user: return redirect(url_for('wechat.signin')) return func(*args, **kwargs) return decorator
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_mobile(request):\n MOBILE_AGENT_RE=re.compile(r\".*(iphone|mobile|androidtouch)\",re.IGNORECASE)\n\n if MOBILE_AGENT_RE.match(request.META['HTTP_USER_AGENT']):\n return True\n else:\n return False", "def mobile(request):\n MOBILE_AGENT_RE = re.compile(\n r\".*(iphone|mo...
[ "0.6898011", "0.689399", "0.6369667", "0.635195", "0.63429105", "0.63109106", "0.62703073", "0.6228723", "0.62186426", "0.6195903", "0.6157435", "0.61390567", "0.6046515", "0.60213834", "0.5956583", "0.59477335", "0.5935797", "0.5915573", "0.58781195", "0.58594924", "0.585450...
0.6534018
2
Check if user is admin
def require_admin(func): @wraps(func) def decorator(*args, **kwargs): if not g.user: # flash('此操作需要登录账户') return redirect(url_for('admin.login')) if g.user.name != 'admin': abort(403) return func(*args, **kwargs) return decorator
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_is_admin(user):\n return user in admins", "def is_admin(user):\n return user.is_authenticated and user.id == app.config.get('ADMIN')", "def is_admin(self, user):\n return user.name in self.admins", "def is_admin_user(self):\n if \"is_admin\" in self._properties and self.is_ad...
[ "0.8688236", "0.8687356", "0.8556875", "0.8554287", "0.85044616", "0.84716874", "0.8450938", "0.841185", "0.84050906", "0.8394017", "0.8363089", "0.83423585", "0.83161926", "0.8280715", "0.82797027", "0.82743096", "0.82743096", "0.8248748", "0.82192075", "0.8196186", "0.81672...
0.0
-1
r""" Return the ``d x d`` identity matrices on ``nvar`` variables.
def symbolic_max_plus_identity(d, nvar, ch=None): d = int(d) nvar = int(nvar) V = FreeModule(ZZ, nvar) e = () zero = (V([0]*nvar),) data = [[zero if i == j else e for j in range(d)] for i in range(d)] return SymbolicMaxPlusMatrix(d, nvar, data, ch)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def identity_matrix(self, n):\r\n IdM = self.zeros_matrix(n, n)\r\n for i in range(n):\r\n IdM[i][i] = 1.0\r\n \r\n return IdM", "def identity(n):\r\n I = np.zeros((n, n))\r\n diag = np.ones(n)\r\n np.fill_diagonal(I, diag)\r\n return matrix(I)", "d...
[ "0.6807005", "0.63776374", "0.63734645", "0.63494134", "0.6294045", "0.6278014", "0.6278014", "0.61580557", "0.61580557", "0.61580557", "0.615476", "0.6121155", "0.6051036", "0.601457", "0.58180785", "0.5777933", "0.57341456", "0.5717382", "0.5687784", "0.5684385", "0.5680099...
0.0
-1
r""" Return ``n`` independent symbolic matrices in dimension ``d``.
def symbolic_max_plus_matrices(d, n, ch=None, typ='sym'): d = int(d) n = int(n) if d <= 0: raise ValueError("d (= {}) must be postive".format(d)) nvar = n * d * d V = FreeModule(ZZ, nvar) B = ((b,) for b in V.basis()) matrices = [] if d == 1: typ = 'full' if typ ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def basis(d, symbolic=True):\n X = sym.symbols('X')\n if d == 0:\n phi_sym = [1]\n else:\n if symbolic:\n h = sym.Rational(1, d) # node spacing\n nodes = [2*i*h - 1 for i in range(d+1)]\n else:\n nodes = np.linspace(-1, 1, d+1)\n \n phi_sym = [Lagrange_poly...
[ "0.59795463", "0.5888374", "0.57391495", "0.5711324", "0.5686454", "0.5563071", "0.5492323", "0.5435326", "0.5423058", "0.5419523", "0.54059994", "0.5392236", "0.538575", "0.5366352", "0.5356909", "0.53455615", "0.5337914", "0.5334625", "0.5330213", "0.53227186", "0.53154725"...
0.58973736
1
r""" Return a string that describes the convex hull engine.
def convex_hull_engine(self): return self.convex_hull._name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _repr_(self):\n desc = ''\n if self.n_vertices()==0:\n desc += 'The empty polyhedron'\n else:\n desc += 'A ' + repr(self.dim()) + '-dimensional polyhedron'\n desc += ' in '\n if self.field()==QQ: desc += 'QQ'\n else: desc += 'RDF'\n...
[ "0.66425604", "0.63532376", "0.6281747", "0.60994506", "0.60871357", "0.5944821", "0.5937618", "0.5842721", "0.5841963", "0.5745582", "0.57072836", "0.5683671", "0.5624012", "0.5577006", "0.55180144", "0.54937017", "0.5490255", "0.5487594", "0.54810053", "0.5431776", "0.54206...
0.75023854
0
r""" Return the dimension of this matrix.
def dim(self): return self._d
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dimension(self):\n return self.__N", "def get_num_dimensions(self):\n dimensions = self.data.shape\n return dimensions[1]", "def dim(self):\n return len(self.shape)", "def dim(self):\n return len(self.shape)", "def dimensionality(self):\n return int(self.nDims)...
[ "0.84898525", "0.84692967", "0.83745944", "0.83745944", "0.8322008", "0.8309151", "0.8180309", "0.81371695", "0.8114333", "0.8109193", "0.8031762", "0.8031762", "0.8015657", "0.7960735", "0.7944764", "0.7926571", "0.79092103", "0.78969157", "0.787916", "0.78600526", "0.778453...
0.7624366
52
r""" Return the number of variables used in this matrix.
def num_vars(self): return self._nvars
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_num_variables(self):\n return len(self.variables)", "def num_vars(self):\n return self.nvars", "def nvar(self):\n return len(self.__vars)", "def GetNumberOfVariables(self):\n\n # nvar = 0\n # for i in self.variables_order:\n # # DO NOT COUNT VARIABLES THAT GE...
[ "0.826646", "0.80817354", "0.79613394", "0.7953327", "0.79433763", "0.7778536", "0.7749949", "0.75871086", "0.74991745", "0.74765337", "0.74339026", "0.72988725", "0.71537995", "0.71156085", "0.7080469", "0.69808406", "0.691234", "0.67460585", "0.6729376", "0.6723816", "0.671...
0.8000086
2
r""" To obtain an item of the matrix
def __getitem__(self, data): i,j = data return self._data[i][j]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __getitem__(self, item):\n if type(item) is int:\n # select row by default\n if self.shape[0] == 1: # iterate by column if it's a row vector\n return self.values[0][item]\n elif self.shape[1] == 1: # iterate by row if it's a column vector\n ...
[ "0.75138944", "0.7311626", "0.7112711", "0.7027379", "0.69761306", "0.68627983", "0.6828977", "0.6801616", "0.67811024", "0.6719613", "0.6719613", "0.6719613", "0.6648522", "0.6594458", "0.6576159", "0.65010285", "0.64954424", "0.6479522", "0.6468668", "0.6449649", "0.6440751...
0.61327946
42
r""" Multiplication of matrices
def __mul__(self, other): if type(self) != type(other) and \ not isinstance(self, SymbolicMaxPlusMatrix) and \ not isinstance(other, SymbolicMaxPlusMatrix): raise TypeError("can not multiply {} with {}".format(type(self),type(other))) if self._d != other._d: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def matrix_mult(m1, m2):\n pass", "def Multiply(M1,M2):\r\n M3=[]\r\n w=0\r\n while w<len(M2[0]):\r\n tap=[]\r\n t=0\r\n while t<len(M2):\r\n tap.append(M2[t][w])\r\n t=t+1\r\n M3.append(tap)\r\n w=w+1\r\n M=[]\r\n # Multiplying matrices\r...
[ "0.839403", "0.77877283", "0.7786913", "0.76345795", "0.7578386", "0.752093", "0.7499151", "0.7495682", "0.74534243", "0.7433087", "0.74056447", "0.73597676", "0.7326738", "0.732322", "0.7322675", "0.731054", "0.72843087", "0.7257866", "0.72538614", "0.7223289", "0.7222726", ...
0.0
-1
r""" Return the list of entries of this matrix.
def list(self): return [self[i,j] for i in range(self._d) for j in range(self._d)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def as_list(self):\n data = []\n for row in self._matrix_data:\n for column in row:\n data.append(column)\n return data", "def rows(self):\n return list(self)", "def as_list_of_lists(self):\n return self._matrix_data", "def readentries(self):\n ...
[ "0.74211484", "0.7351907", "0.7139602", "0.7107239", "0.7102002", "0.7040875", "0.700234", "0.700234", "0.69514894", "0.6915959", "0.6805772", "0.68021935", "0.67886513", "0.6775163", "0.6770315", "0.6736421", "0.67067957", "0.66475236", "0.6628927", "0.66164464", "0.65946597...
0.69504046
9
r""" Return the list of equal coefficients between self and other.
def equal_coefficients(self, other): d = self._d return [(i,j) for i in range(d) for j in range(d) \ if self[i][j] == other[i][j]]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __xor__(self, other):\n\n sym_diff = [value for value in self if value not in other]\n sym_diff.extend([value for value in other if value not in self])\n\n return sym_diff", "def GetEqualConstrains(self):\n return _gmat_py.Spacecraft_GetEqualConstrains(self)", "def coefficients(...
[ "0.66310555", "0.6198817", "0.61889756", "0.5865301", "0.5818835", "0.5683608", "0.5683608", "0.56740135", "0.5648324", "0.56273437", "0.56273437", "0.5593266", "0.55242145", "0.5514569", "0.546532", "0.5455155", "0.5414487", "0.5409538", "0.5363544", "0.53480685", "0.5334692...
0.78071773
0
r""" String when the object is printed
def _repr_(self): return 'A {}x{} symbolic max plus matrix on {} variables'.format( self.dim(), self.dim(), self.num_vars())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return self.printable()", "def __str__(self):\r\n return repr(self)", "def __str__(self):\n return repr(self)", "def __str__(self):\n return \"<%s: %s>\" % (self.__class__, self.describe())", "def __str__(self):\n return_string = self.name + \"\\n\" +...
[ "0.8097469", "0.78782415", "0.77841264", "0.7769064", "0.7669302", "0.76466906", "0.76466906", "0.7623327", "0.75980204", "0.75980204", "0.75980204", "0.75980204", "0.7578883", "0.7571893", "0.75686365", "0.75658494", "0.7563032", "0.7543171", "0.7536491", "0.7536491", "0.753...
0.0
-1
r""" Evaluates this symbolic matrix at the integer point ``p``.
def eval(self, p): from max_plus.max_plus_int import minus_infinity, IntegerMaxPlusMatrix F = FreeModule(ZZ, self._nvars) p = F(p) mat = [] d = self.dim() for i in range(d): row = [] for j in range(d): pts = self[i,j] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluate(self,p):\n if not self.initialized: self.__initialize__()\n if self.vp0: p_ = 1-p\n else: p_ = p\n if self.ids_to_consider is None:\n #sum on all parametrized cell\n cf = np.sum(self.V[self.p_ids-1]*p_)/self.V_tot - self.max_v_frac\n else:\n cf = np.sum((self.V[self.ids_t...
[ "0.6590414", "0.64902985", "0.5803352", "0.576456", "0.56841123", "0.56735307", "0.5545928", "0.54923505", "0.54681116", "0.5413606", "0.5399578", "0.5339681", "0.5316676", "0.53084254", "0.5288867", "0.525981", "0.52447516", "0.5244498", "0.5217221", "0.521235", "0.5206362",...
0.6615458
0
r""" Return the dimension of the affine space spanned generated by each Newton polytopes. for triangular matrices, seems to stay 0 on the diagonal.
def get_vector_span(self, i, j): from sage.rings.infinity import Infinity from sage.matrix.constructor import matrix data = self[i,j] if not data: return None elif len(data) == 1: return FreeModule(ZZ, self._nvars).submodule([]) else: r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dim(self) -> int:", "def getlen(self):\n if self.onlydiag():\n return self.lendiag()\n else:\n return len(self)", "def dimension(self):\n return 3*self.genus - 3 + self.n", "def dim(self) -> int:\n return self.atoms.shape[:-1]", "def dimension(self):\r\...
[ "0.67515165", "0.67112654", "0.6535919", "0.653394", "0.64353853", "0.6379742", "0.63764715", "0.63629043", "0.63574785", "0.63428813", "0.62986326", "0.6278618", "0.62567246", "0.62425613", "0.6237966", "0.6212587", "0.6183233", "0.61782753", "0.61762774", "0.61756885", "0.6...
0.0
-1
r""" Permutations (i1,j1) > (i2,j2) Make an exchange of rows/columns in matrix data. This is used in multiplication of full symbolic matrices.
def vertex_swap(d, n, l, i1, i2, j1, j2): if i1 == i2 and j1 == j2: return l if i1 == j1: # (i1,i1) -> (i2,i2) assert i2 == j2 def swap(v): swap2(d, n, v, i1, i2) elif i1 == i2: # (i,j1) -> (i,j2) def swap(v): swap2(d, n, v, j1, j2) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def swap_columns(i, j, *args):\n output = list()\n for M in args:\n output.append(_cswap(i, j, M))\n return output", "def swap_rows(i, j, *args):\n output = list()\n for M in args:\n output.append(_rswap(i, j, M))\n return output", "def return_swaps( # pylint: disable=too-many-...
[ "0.6260572", "0.61407316", "0.60737467", "0.58037573", "0.5779625", "0.5728096", "0.56909776", "0.5626455", "0.5626066", "0.55842173", "0.5571164", "0.5571073", "0.5566883", "0.55655205", "0.55617666", "0.5537897", "0.55265135", "0.5522779", "0.55212414", "0.5504172", "0.5502...
0.0
-1