query
stringlengths
9
9.05k
document
stringlengths
10
222k
metadata
dict
negatives
listlengths
30
30
negative_scores
listlengths
30
30
document_score
stringlengths
4
10
document_rank
stringclasses
2 values
given rois, overlaps, gt labels, seg, compute bounding box mask targets
def compute_bbox_mask_targets_and_label(rois, instances, overlaps, labels, seg, flipped, for_maskfcn): # Ensure ROIs are floats rois = rois.astype(np.float32, copy=False) # Sanity check assert len(rois) == len(overlaps), 'number of proposal ROIs and max overlap with gt bbox does not match' fg_inde...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _compute_targets(self, rois, overlaps, labels):\n # Indices of ground-truth ROIs\n gt_inds = np.where(overlaps == 1)[0]\n if len(gt_inds) == 0:\n # Bail if the image has no ground-truth ROIs\n return np.zeros((rois.shape[0], 5), dtype=np.float32)\n # Indices of...
[ "0.7313925", "0.71592087", "0.71402454", "0.6996708", "0.69459915", "0.6941204", "0.6892724", "0.68765074", "0.6802383", "0.679862", "0.6783485", "0.6766833", "0.6740475", "0.67032063", "0.6667434", "0.66613775", "0.649947", "0.6463107", "0.64395213", "0.6392578", "0.63605434...
0.8092106
0
expand from 5 to 4 num_classes; only the right class has nonzero bbox regression targets
def expand_bbox_regression_targets(bbox_targets_data, num_classes): classes = bbox_targets_data[:, 0] bbox_targets = np.zeros((classes.size, 4 * num_classes), dtype=np.float32) bbox_weights = np.zeros(bbox_targets.shape, dtype=np.float32) indexes = np.where(classes > 0)[0] for index in indexes: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_bbox_regression_labels(bbox_target_data, num_classes):\r\n\r\n clss = bbox_target_data[:, 0]\r\n # print (\"===============class size: \" + str(clss))\r\n bbox_targets = np.zeros((clss.size, 4 * num_classes), dtype=np.float32) #clss.size = 128 ---> bbox_targets = 128 * 84, moi roi la 1*84 dimesio...
[ "0.7097818", "0.6854565", "0.6845996", "0.683115", "0.68256617", "0.6730579", "0.6384556", "0.62378794", "0.60689676", "0.5892966", "0.5789716", "0.563533", "0.5575039", "0.55258065", "0.55096483", "0.5507529", "0.54746383", "0.543765", "0.54329604", "0.54232174", "0.54087734...
0.78628755
0
Instructs Karel to run a full lap around an 8x7 track. Runs on world lab01_1.kwld.
def run_lap(): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n\n run_lap()", "def main() -> None:\n xlim = L\n x = np.arange(xlim)\n xi = np.arange(0, xlim - 1 + STEP, STEP)\n kappas = sleplet.wavelet_methods.create_kappas(xlim, B, J_MIN)\n yi = scipy.interpolate.pchip(x, kappas[0])\n plt.semilogx(xi, yi(xi), label=r\"$\\Phi_{\\ell0}$\")\n...
[ "0.6048424", "0.55863696", "0.55684906", "0.5441503", "0.53783417", "0.53147775", "0.5288994", "0.5276593", "0.52241784", "0.5216078", "0.51647866", "0.511809", "0.5103908", "0.50852877", "0.5049923", "0.5030189", "0.5028622", "0.50210935", "0.5014402", "0.5013589", "0.501084...
0.6143961
0
This method calculates de forward prop for one timestep x_t is a numpy.ndarray of shape (m, i) that contains the data input for the cell m is the batche size for the data h_prev is a numpy.ndarray of shape (m, h) containing the previous hidden state The output of the cell should use a softmax activation function
def forward(self, h_prev, x_t): concat = np.concatenate([h_prev, x_t], axis=1) r = sigmoid(np.dot(concat, self.Wr) + self.br) # reset z = sigmoid(np.dot(concat, self.Wz) + self.bz) # update copy_con = np.concatenate([h_prev * r, x_t], axis=1) cct = np.tanh(np.dot(copy_con, self...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forward(self, h_prev, x_t):\n from scipy.special import softmax\n # softmax(arr, axis=0)\n m, i = x_t.shape\n Wi = self.Wh[:i]\n Wh = self.Wh[i:]\n cat = np.concatenate((h_prev, x_t), axis=1)\n # print('meow', cat.shape)\n h_next = np.tanh(cat @ self.Wh +...
[ "0.80434895", "0.74866027", "0.73839766", "0.73818326", "0.722713", "0.6849928", "0.6842875", "0.67530245", "0.67320037", "0.6571977", "0.6473638", "0.63928777", "0.63824487", "0.6361955", "0.63596976", "0.63473755", "0.6346941", "0.6345837", "0.63381314", "0.63281643", "0.63...
0.75904
1
Executes a command in a subprocess. Returns a tuple of (exitcode, out, err), where out is the string output from stdout and err is the string output from stderr when executing the command.
def execute(cmd): process = subprocess.Popen(cmd, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) out = '' err = '' exitcode = 0 result = p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _exec_command(command):\n\n log(\"Run command for '%s'\" % command)\n p = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE)\n (output, err) = p.communicate()\n p_status = p.wait()\n return p_status, output", "def execute_command(cmd):\n\n env = environ.copy()\n proc = subproc...
[ "0.82215", "0.81156176", "0.807166", "0.8065492", "0.79262006", "0.7895881", "0.7893727", "0.7856351", "0.7809825", "0.7807077", "0.77643573", "0.77529234", "0.77512175", "0.7721036", "0.771688", "0.76943904", "0.7692906", "0.76773775", "0.7677352", "0.7636083", "0.76313853",...
0.8283931
0
Registers a set of accounts
def create_accounts(account_list, user_type): account_client = AccountClient() for account in account_list: try: account_client.add_account(account, user_type, email=None) except exception.Duplicate: pass # Account already exists, no need to create it
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def accounts(self, accounts):\n\n self._accounts = accounts", "def accounts():", "def set_accounts(self, accounts):\n\n\t\tif accounts is not None and not isinstance(accounts, list):\n\t\t\traise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: accounts EXPECTED TYPE: list', None, None)\n\t\t\n\t\tself.__a...
[ "0.70042574", "0.67914295", "0.655478", "0.6516786", "0.64204633", "0.64204633", "0.6387295", "0.6300533", "0.62818116", "0.62031263", "0.61633456", "0.6096136", "0.60013926", "0.59863746", "0.59792167", "0.59623075", "0.59547436", "0.59001887", "0.58801574", "0.5879945", "0....
0.7034563
0
Generate random account name.
def account_name_generator(): return 'jdoe-' + str(uuid()).lower()[:16]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_name(self):\n letters = string.ascii_letters\n random_name = ''.join(random.choice(letters) for _ in range(10))\n assert isinstance(random_name, str)\n return random_name", "def random_username():\n return str(uuid.uuid4().hex.upper())", "def create_random_username()...
[ "0.8303968", "0.8120217", "0.8100042", "0.77641845", "0.7753038", "0.76790786", "0.76534474", "0.76172715", "0.7595423", "0.75660664", "0.75545484", "0.7548045", "0.75479037", "0.7371235", "0.7327479", "0.7317477", "0.7268474", "0.7216197", "0.7207971", "0.71842176", "0.71314...
0.87259203
0
Generate random scope name.
def scope_name_generator(): return 'mock_' + str(uuid()).lower()[:16]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_name(self):\n letters = string.ascii_letters\n random_name = ''.join(random.choice(letters) for _ in range(10))\n assert isinstance(random_name, str)\n return random_name", "def _get_random_name(self, length=10):\n return base64.b64encode(os.urandom(10)).translate(...
[ "0.7447893", "0.744636", "0.73160076", "0.7207004", "0.7178981", "0.70837486", "0.70615864", "0.6930399", "0.6833568", "0.6799694", "0.6743375", "0.672266", "0.6716136", "0.6712767", "0.670714", "0.66949475", "0.6689852", "0.6673536", "0.66614676", "0.6655013", "0.6639624", ...
0.8101027
0
return internalStructure value as semantic string
def InternalStructure(self): s = self.internalStructure assert s in range(1,5), "Internal structure score out of bounds." if s == 1: return 'Soft Tissue' elif s == 2: return 'Fluid' elif s == 3: return 'Fat' elif s == 4: return 'Air'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Value(self) -> str:", "def __repr__ (self):\n\t\tStr = \"\"\n\t\tfor i in self.structref:\n\t\t\tStr = Str + \"%-15s = \"%(i[self.NAME])\n\t\t\tvalue = self.value [i[self.NAME]]\n\t\t\tif isInteger(value):\n\t\t\t\tStr = Str + \"%d, 0x%X\"%(value,value)\n\t\t\t\tif value >= 0x20 and value <= 0xFF:\n\t\t\t\t\...
[ "0.6395907", "0.62609285", "0.6181325", "0.6171499", "0.6154879", "0.6147787", "0.61259633", "0.6062094", "0.60563964", "0.5993036", "0.5991818", "0.59766865", "0.59766865", "0.59556943", "0.5950167", "0.59492517", "0.5938027", "0.59356564", "0.5909987", "0.5900417", "0.58979...
0.7256251
0
return sphericity value as semantic string
def Sphericity(self): s = self.sphericity assert s in range(1,6), "Sphericity score out of bounds." if s == 1: return 'Linear' elif s == 2: return 'Ovoid Linear' elif s == 3: return 'Ovoid' elif s == 4: return 'Ovoid Round' elif s == 5: return 'Round'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_mlt_phys(sed_name):\n\n new_name = sed_name.replace('+','-').replace('a','-').split('-')\n\n logg_sgn_dex = len(new_name[0])\n\n if sed_name[logg_sgn_dex] == '-':\n logg_sgn = 1.0\n elif sed_name[logg_sgn_dex] == '+':\n logg_sgn = -1.0\n else:\n raise RuntimeError('Canno...
[ "0.6266079", "0.5995713", "0.59221244", "0.5912348", "0.5837154", "0.5797885", "0.5778113", "0.5684354", "0.55472344", "0.55463403", "0.5535897", "0.5513915", "0.5510647", "0.55044264", "0.5465538", "0.5459485", "0.545632", "0.5400688", "0.5390603", "0.5384475", "0.53796214",...
0.7642424
0
return margin value as semantic string
def Margin(self): s = self.margin assert s in range(1,6), "Margin score out of bounds." if s == 1: return 'Poor' elif s == 2: return 'Near Poor' elif s == 3: return 'Medium' elif s == 4: return 'Near Sharp' elif s == 5: return 'Sharp'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_margin(self):\n return unicode(self._visual_indent * 20)", "def margins(value):\r\n if value.isNull():\r\n return '(Null)'\r\n return '({}, {}, {}, {})'.format(value.left(), value.top(), \r\n value.right(), value.bottom())", "def m...
[ "0.7172934", "0.7142144", "0.6958601", "0.6434537", "0.6100191", "0.60955596", "0.5875325", "0.57198894", "0.56654567", "0.55979145", "0.554245", "0.5518524", "0.55126953", "0.53820264", "0.53573495", "0.5355246", "0.5353938", "0.5344531", "0.53443724", "0.53443724", "0.53292...
0.7275707
0
return texture value as semantic string
def Texture(self): s = self.texture assert s in range(1,6), "Texture score out of bounds." if s == 1: return 'Non-Solid / Ground Glass Opacity Texture' elif s == 2: return 'Non-Solid or Mixed Texture' elif s == 3: return 'Part Solid or Mixed Texture' elif s == 4: return...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_texture_declaration(texture):\n declaration = \"uniform sampler%dD %s;\\n\" % (texture[\"ndim\"], texture[\"name\"])\n return declaration", "def tex(self):\r\n self.load_opengl()\r\n return self._tex", "def get_normal_texture(self):\n return self.normal_tex", "def get_string(self):...
[ "0.6280576", "0.6064373", "0.6039767", "0.5987319", "0.5837439", "0.5831737", "0.5831737", "0.5756667", "0.5711865", "0.5571416", "0.55610704", "0.5536256", "0.5521191", "0.55084234", "0.54987895", "0.54588586", "0.5453837", "0.5451207", "0.5441147", "0.543771", "0.5433726", ...
0.73007345
0
return malignancy value as semantic string
def Malignancy(self): s = self.malignancy assert s in range(1,6), "Malignancy score out of bounds." return _char_to_word_[ s-1 ] + ' Malignancy'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _masses_string(self):\n return_str = 'Masses\\n\\n'\n for at in self.atom_types:\n return_str += '{} {:9.5f} # {}\\n'.format( at.atom_type_index, float(at.mass), at.label)\n return_str += '\\n'\n return return_str", "def Value(self) -> str:", "def __str__(self):\n ...
[ "0.6825632", "0.63513833", "0.6302737", "0.613402", "0.60075605", "0.59989643", "0.5990464", "0.5968698", "0.59461033", "0.5928307", "0.59046125", "0.5860752", "0.5840992", "0.58364856", "0.5791848", "0.5791848", "0.5775395", "0.5761437", "0.5732464", "0.573032", "0.57137626"...
0.7178172
0
Return all characteristic values as a string table.
def all_characteristics_as_string(self): chars1 = _all_characteristics_ chars2 = [ch.title() for ch in chars1] chars2[chars2.index('Internalstructure')] = 'InternalStructure' s = ('%-18s %-24s %-2s'%('Characteristic', 'Semantic value','#')) s+= '\n' s+= ('%-18s %-2...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __repr__(self):\n return \"[\" + \", \".join([str(member) for member in self.table]).rstrip(\",\") + \"]\"", "def pretty(self):\n #table = [\"\".join([\"%8s \" % s for s in self.alpha.getSymbols()])]\n table = []\n for row in PWM.getFreq(self):\n table.append(\"\".join(...
[ "0.6615294", "0.63754445", "0.63443357", "0.6261339", "0.6210332", "0.62101907", "0.6169288", "0.61684954", "0.60672635", "0.6061374", "0.6031117", "0.5987905", "0.5913056", "0.5912034", "0.5910876", "0.589292", "0.58677334", "0.5863537", "0.5842935", "0.58288443", "0.5818556...
0.67759836
0
Return all characteristic values as a numpy array in the order presented in `pylidc._all_characteristics_`.
def all_characteristics_as_array(self): return np.array([getattr(self,char) for char in _all_characteristics_])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def array(self):\n return array(self.get_values())", "def tovector(self):\n return np.hstack(self.values())", "def get_characteristic_vals(self):\n\n # Characteristic quantity of x\n x = scutils.qv2x(self.dyn_sys.tpwl_dict['q'], self.dyn_sys.tpwl_dict['v'])\n x_char = np.abs(...
[ "0.658936", "0.6133145", "0.61247593", "0.60914385", "0.60115767", "0.598908", "0.59529126", "0.5922147", "0.5917438", "0.5913722", "0.58510214", "0.5841785", "0.5768531", "0.57629716", "0.57280236", "0.5700412", "0.5694716", "0.5689029", "0.56782", "0.5669914", "0.5669728", ...
0.82255787
0
Estimate the greatest axial plane diameter using the annotation's contours. This estimation does not currently account for cases where the diamter passes outside the boundary of the nodule, or through cavities within the nodule.
def estimate_diameter(self, return_indices=False): greatest_diameter = -np.inf i,j,k = 0,0,1 # placeholders for max indices for c,contour in enumerate(self.contours): contour_array = contour.to_matrix()[:,:2]*self.scan.pixel_spacing # There's some edge cases where the con...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def spatial_diameter(self):\n import math\n \n Temp = 0\n for i in range(self.nodenum):\n for j in range(self.nodenum):\n pathlist = []\n self.pathij(i, j, pathlist)\n distance = []\n \n for k in range...
[ "0.5946595", "0.59179574", "0.5900602", "0.5811028", "0.5724767", "0.5684864", "0.5669118", "0.54426765", "0.54000616", "0.54000616", "0.53228766", "0.5242601", "0.5242601", "0.52219695", "0.5220894", "0.5181787", "0.51761675", "0.5164866", "0.5157376", "0.51253206", "0.51168...
0.6322775
0
Estimate the volume of the annotated nodule, using the contour annotations. Green's theorem (via the shoelace formula) is first used to measure the area in each slice. This area is multiplied by the distance between slices to obtain a volume for each slice, which is then added or subtracted from the total volume, depen...
def estimate_volume(self): volume = 0. zvals = np.unique([c.image_z_position for c in self.contours]) # We pad a zval on the bottom that is the same distance from the # first zval to the second zval but below the first point. We do # the same thing for the top zval. if...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _calculate_area(image: sitk.Image, slice_number: int=-1) -> float:\n\n img_arr = sitk.GetArrayFromImage(image)\n\n if slice_number == -1:\n slice_number = int(img_arr.shape[0] / 2) # use the intermediate slice\n\n return img_arr[slice_number, ...].sum() * image.GetSpacing()[0] ...
[ "0.5720075", "0.5698159", "0.5492189", "0.54893225", "0.534639", "0.5338476", "0.5153268", "0.509255", "0.5068469", "0.5027483", "0.5025481", "0.4986204", "0.49686146", "0.49681854", "0.4936929", "0.49252084", "0.49239445", "0.49167615", "0.49138218", "0.49062705", "0.4905258...
0.6969737
0
This method is for rough visualization only, and could look nasty if the annotated nodule has a shape that deviates significantly from spherical. Any keyword argument that is accepted by matplotlib's `plot_trisurf` function can passed as an argument to this function. The surface of the annotated nodule is triangulated ...
def visualize_in_3d(self,**kwargs): fig = plt.figure(figsize=(7,7)) ax = fig.add_subplot(111, projection='3d') points = np.vstack([ c.to_matrix() for c in self.contours if c.inclusion ]) points[:,:2] = points[:,:2] * self.scan.pixel_spacing # Center the poi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def visualize(z_in, azimuth=25., elevation=30.,\n thresholds=[0.95, .9, .75, .5, .25, .125], opacities=[1, .9, .7, .5, .2, .1],\n# thresholds=[0.94, .89, .75, .5, .25, .1], opacities=[.9, .8, .7, .5, .2, .1],\n# thresholds=[0.94, .89, .75], opacities=[.99, .7, .2],\n# thresholds=[0.7, .5, .2], opacit...
[ "0.55621755", "0.55289763", "0.5486421", "0.5254015", "0.52248514", "0.5188055", "0.5138209", "0.5135826", "0.5093871", "0.50793964", "0.50005364", "0.49997965", "0.4995897", "0.4992421", "0.49744967", "0.49583253", "0.49551812", "0.4954185", "0.49368548", "0.4923951", "0.492...
0.6626345
0
Interactive visualization of the slices of the scan along with scan and annotation information. The visualization begins (but is not limited to) the first slice where the nodule occurs (according to the annotation). Contours are plotted atop the images for visualization and can be toggled on and off.
def visualize_in_scan(self, verbose=True): images = self.scan.load_all_dicom_images(verbose) # Preload contours and sort them by z pos. contours = sorted(self.contours, key=lambda c: c.image_z_position) fnames = self.scan.sorted_dicom_file_names.split(',') index_of_conto...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_slice(file_path, x, y, z):\n img = nib.load(file_path)\n img = img.get_fdata()\n print(\"The scan has dimensions {}.\".format(img.shape))\n slice_0 = img[x, :, :]\n slice_1 = img[:, y, :]\n slice_2 = img[:, :, z]\n slices = [slice_0, slice_1, slice_2]\n fig, axes = plt.subplots(1, ...
[ "0.6748113", "0.66205937", "0.6403574", "0.6349743", "0.63460815", "0.6204037", "0.61733246", "0.6166155", "0.6161124", "0.61607283", "0.6137194", "0.6114361", "0.6100951", "0.60913765", "0.6089182", "0.605136", "0.6050236", "0.6044484", "0.6016622", "0.6001389", "0.59969157"...
0.7885456
0
A fake sensor error function.
def ultrasonic_sensor_error(raw_sensor_value): return raw_sensor_value * 1.1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_ft_sensor_error(self):\r\n return self._arm.get_ft_sensor_error()", "def test_value_error(self):\n self._error_test(ValueError)", "def handle_device_error(self, device: SimplePeriphDev):\r\n pass", "def test_temperature_unknown_unit(self):\n with self.assertRaises(ValueErr...
[ "0.65954626", "0.64486176", "0.6418622", "0.63417256", "0.6332862", "0.6301069", "0.62974256", "0.62375325", "0.6198266", "0.6198123", "0.6167467", "0.6159817", "0.6134851", "0.61187", "0.6107647", "0.6104197", "0.6073738", "0.60613334", "0.6056106", "0.6055696", "0.6037705",...
0.7465372
0
Verify actions to take a distance measurement.
def test_sense_distance(self): measurements = [29, 29, 28] self.driver.us_dist.side_effect = lambda x: measurements.pop() expected_measurement = int(ultrasonic_sensor_error(29)) self.assertEqual(self.s.sense_distance(60), expected_measurement) self.mount.move.assert_called_once_with(x=60)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_06_valid_distance(self):\n distance_record = SwimRecord(distance=20)\n try:\n distance_record.full_clean()\n except ValidationError as e:\n self.assertTrue(\"Ensure this value is greater than or equal to 50.\" in e.message_dict['distance'])", "def test_get_dist...
[ "0.70417863", "0.67651945", "0.6564168", "0.6535019", "0.65243864", "0.65083605", "0.6476387", "0.6409747", "0.6386501", "0.63810277", "0.6356363", "0.627032", "0.6192513", "0.616095", "0.6014396", "0.5996598", "0.5981547", "0.5977096", "0.59571403", "0.5955657", "0.5887156",...
0.6922547
1
Preprocess input string and tokenize it.
def preprocess(input_str: str, tokenizer, is_observation=False, lower_case=True) -> List[str]: if input_str is None: return ["nothing"] input_str = input_str.replace("\n", ' ') if input_str.strip() == "": return ["nothing"] if is_observation: if "$$$$$$$" in input_str: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _tokenize(self, string):\n self._tokens = []\n\n # Split and strip the input string by newlines\n for token in re.split('(.*)', string):\n if token.strip() != '':\n self._tokens.append(token)", "def tokenize(self, input_string: str) -> List[str]:", "def prepro...
[ "0.73023975", "0.7099006", "0.7031939", "0.69380856", "0.68518794", "0.6742743", "0.66618824", "0.6660827", "0.6584697", "0.6538246", "0.65237117", "0.650214", "0.6486665", "0.6478612", "0.64631766", "0.6415667", "0.64015114", "0.63696903", "0.63656837", "0.6322496", "0.62950...
0.72192407
1
Log transform income and standardize
def standardizedIncome(dfIn, dfOut): nIncome = pd.Series(scale(np.log(dfIn['AMT_INCOME_TOTAL'])), name = 'scaledLogINC') dfOut = pd.concat([dfOut, nIncome], axis = 1) return dfOut
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_log(tx, index_log, mean=[], std=[]):\n tx_new = np.log10(3+abs(tx[:,index_log]))\n return standardize(tx_new,mean,std)", "def log_cust(x):\n if type(x) != str:\n if x < 0:\n return 0\n elif x == 0:\n return 0\n elif x > 0:\n return np.log...
[ "0.6813375", "0.6642125", "0.6604573", "0.6576997", "0.6442008", "0.635995", "0.6338285", "0.63280946", "0.6277291", "0.6257421", "0.6235148", "0.61958665", "0.6194957", "0.61920244", "0.6137519", "0.6123614", "0.61151403", "0.6087989", "0.6087153", "0.6080998", "0.60708565",...
0.6933409
0
DAYS_EMPLOYEED is from when employment starts. Data is positively skewed. Need to log transform. Added flag columns for the anomly in data and people who have no job (only 2 in train set) .
def engineerDays(dfIn, dfOut): imp = Imputer(missing_values='NaN', strategy='mean', axis=1) dfOut['DAYS_EMPLOYED_ANOM'] = dfIn["DAYS_EMPLOYED"] == 365243 dfOut['DAYS_EMPLOYED_ZERO'] = dfIn["DAYS_EMPLOYED"] == 0 dfOut['DAYS_EMPLOYED'] = dfIn['DAYS_EMPLOYED'].replace({0: np.nan}) dfOut['DAYS_EMPLOYE...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def LogLikeEducation(DFData,SATTuition,grad_horizon,sectors,beta,\n ability,flows_penalized,unskilled_var,grade_params_by_quality,normReps,simReps,\n LaborGradeRange,final_size,dropout_payouts, STEM_payouts_by_quality,\n nonSTEM_payouts_by_quality,gamma_p, unskilled_meanvar, norm_quantiles,\n skilled_w...
[ "0.55555177", "0.5407575", "0.52377355", "0.52227855", "0.5194908", "0.51869196", "0.51812595", "0.51748693", "0.5168488", "0.5159893", "0.50422114", "0.4994865", "0.49752843", "0.4962805", "0.49600822", "0.49335244", "0.4930702", "0.4923342", "0.49105477", "0.48778147", "0.4...
0.59338206
0
Update Family and one hot encode them
def simplifyFamily(dfIn, dfOut): fam = pd.get_dummies(dfIn.NAME_FAMILY_STATUS, prefix = 'FAM') dfOut = pd.concat([dfOut, fam], axis = 1) return dfOut
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mutation(self, base_offsprings, model_features_count) :", "def expand_features(data):\n\t## combine num of siblings and parents to feature of family size\n\tdata[\"Fam_size\"] = data[\"SibSp\"] + data[\"Parch\"]\n\n\t## add friend category defined as either sharing a ticket with someone not family\n\t## or s...
[ "0.5722502", "0.5646956", "0.5601784", "0.54684687", "0.5459479", "0.5398935", "0.5398314", "0.5356387", "0.5337912", "0.5322841", "0.5311964", "0.5302762", "0.530068", "0.52727234", "0.5257333", "0.5255186", "0.52438605", "0.524151", "0.523831", "0.5231394", "0.52255195", ...
0.56714404
1
Calculates the frame of the current animation for the given object to play.
def _getCurrentObjectFrame(self, object): object.currentFrame = object.currentAnimation.frame[(self.frameCount * object.currentAnimation.fps / Game.FPSLimit) % len(object.currentAnimation.frame)] if object.flipped: object.currentFrame = pygame.transform.flip(object.currentFrame, 1, 0) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_frame(self):\n frame = self.stream.read()\n self.keypoints, self.image = self.openpose.forward(frame, True)", "def animate(self,frame,im = None):\n # With matplotlib, it's much, much faster to just update the properties\n # of a display object than it is to create a new ...
[ "0.59017915", "0.5787076", "0.57224494", "0.57027364", "0.5676773", "0.5668733", "0.56634897", "0.5654022", "0.56365573", "0.5632305", "0.5583426", "0.5572537", "0.55294377", "0.5505394", "0.54867", "0.5472437", "0.54619044", "0.54589146", "0.54057217", "0.5384014", "0.536382...
0.7669203
0
Sets up the controls for MoveLeft,MoveRight,Jump,Duck,Fly,Quit
def _initControls(self): print "DEBUG: Initializing Controls" Game.Controls[pygame.K_a] = Game.MoveLeft Game.Controls[pygame.K_d] = Game.MoveRight Game.Controls[pygame.K_w] = Game.Jump Game.Controls[pygame.K_s] = Game.Duck Game.Controls[pygame.K_SPACE] = Game.Fly ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_controls(self):\n # Image tnds\n image = pyxbmct.Image(addonfolder+artsfolder+'/tnds82.png')\n self.placeControl(image, 0, 0, rowspan=8, columnspan=16)\n\n\t\t# Image Welcome\n image = pyxbmct.Image(addonfolder+artsfolder+'/finish.png')\n self.placeControl(image, 8, 4, ro...
[ "0.67535305", "0.67528874", "0.6706851", "0.6682404", "0.66544104", "0.6610975", "0.6576695", "0.64958274", "0.64776945", "0.6440076", "0.6438304", "0.6434471", "0.63930136", "0.6314228", "0.6312908", "0.6231908", "0.6226296", "0.6183975", "0.6181548", "0.61798674", "0.617766...
0.6888316
0
Initializes the game (doesn't do anything currently)
def __init__(self): self.frameCount = 0 self._initScreen() self._initObjects() self._initControls() self._initLevel() self._start() print "DEBUG: Initializing Game" pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(self):\n result = pygame.init()\n pygame.font.init()\n pygame.display.set_caption('gomoku TDD')\n self.screen = pygame.display.set_mode((WINDOWWIDTH, WINDOWHEIGHT))\n self.clock = pygame.time.Clock()\n self.smallfont = pygame.font.Font(None, 40)\n sel...
[ "0.7978076", "0.7942171", "0.7835903", "0.76601416", "0.765562", "0.76463", "0.7643461", "0.76285267", "0.75802094", "0.7556535", "0.7498032", "0.7491085", "0.74514705", "0.74461895", "0.74435586", "0.7401352", "0.7387998", "0.7330799", "0.7295875", "0.72882247", "0.72680324"...
0.84068996
0
the baxter interface requires you to send the joint velocities / torques as a dictionary, this turns and array of velocities and torques into a dictionary with joint names.
def joint_array_to_dict(vel_torque_array, limb): return dict(itertools.izip(limb.joint_names(), vel_torque_array))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def velocity_to_JointTorqueMsg(self):\n\t\t\tjointCmd = kinova_msgs.msg.JointTorque()\n\t\t\tjointCmd.joint1 = self.torque[0][0];\n\t\t\tjointCmd.joint2 = self.torque[1][1];\n\t\t\tjointCmd.joint3 = self.torque[2][2];\n\t\t\tjointCmd.joint4 = self.torque[3][3];\n\t\t\tjointCmd.joint5 = self.torque[4][4];\n\t\t\tjo...
[ "0.6479307", "0.611845", "0.5999296", "0.5937377", "0.5804322", "0.57596093", "0.5723849", "0.5719393", "0.57161325", "0.5700277", "0.56974316", "0.5605066", "0.5587984", "0.55590045", "0.55538946", "0.5506049", "0.54647374", "0.5428091", "0.54104525", "0.5410338", "0.5382091...
0.636021
1
Extract one or more string fields from the JSONencoded data. Returns an iterator for flatMapValues(...), so pruning can cause a record to be skipped.
def extractStringValues(jsonDataString): global recordCount, valueCount, noValueCount, emptyValueCount, exceptionNoValueCount, exceptionEmptyValueCount, extractionKeyPathHitCounts try: recordCount += 1 gotResult = False result = "" jsonData = json.loads(js...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_fields(self, json_dict):\n raise NotImplementedError()", "def _iterparse(self, j):\n nonspace = re.compile(r'\\S')\n decoder = json.JSONDecoder()\n pos = 0\n while True:\n matched = nonspace.search(j, pos)\n if not matched:\n bre...
[ "0.56334275", "0.562375", "0.54885584", "0.5459256", "0.53585255", "0.53320086", "0.51678795", "0.51448035", "0.5137016", "0.5121183", "0.5087737", "0.5083478", "0.5004998", "0.5000332", "0.49989465", "0.4992387", "0.49810985", "0.49719757", "0.49289095", "0.4904621", "0.4876...
0.61863464
0
Extract one or more string fields from the JSONencoded data and tokenize. Returns an iterator for flatMapValues(...), so pruning can cause a record to be skipped.
def extractTokenValues(jsonDataString): global recordCount, valueCount, noValueCount, emptyValueCount, exceptionNoValueCount, exceptionEmptyValueCount, extractionKeyPathHitCounts try: recordCount += 1 gotResult = False result = [] jsonData = json.loads(jso...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extractStringValues(jsonDataString):\n global recordCount, valueCount, noValueCount, emptyValueCount, exceptionNoValueCount, exceptionEmptyValueCount, extractionKeyPathHitCounts\n try:\n recordCount += 1\n gotResult = False\n result = \"\"\n jsonData = ...
[ "0.62266153", "0.60889643", "0.5987294", "0.52785254", "0.5179372", "0.517047", "0.5113987", "0.5106585", "0.50985056", "0.5043698", "0.5026142", "0.49740243", "0.49658123", "0.49212655", "0.48934677", "0.4877979", "0.48729306", "0.48449123", "0.48083436", "0.48065665", "0.47...
0.65409565
0
Extract a new RDD key from the JSONencoded data in pair data. Returns an iterator for flatMap(...), so records without new RDD keys can be skipped.
def extractNewRddKey(pairData): global newRddCount, noNewRddCount, extractNewRddExceptionCount try: d = json.loads(pairData[1]) if newRddKeyKey in d: result = iter([(d[newRddKeyKey], pairData[1])]) newRddCount += 1 return result ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def key_stream(src, tokenizer=tokenize_mapper_json):\n this_streams_key = None\n while src.has_next():\n next_val = src.peek()\n key, value = tokenizer(next_val)\n if this_streams_key is None:\n this_streams_key = key\n if this_streams_key == key:\n yield tok...
[ "0.56174546", "0.55692035", "0.55390763", "0.54464686", "0.5446101", "0.527092", "0.5186368", "0.5037808", "0.49645412", "0.49645412", "0.4842991", "0.48318213", "0.4802165", "0.47952998", "0.47433558", "0.47379297", "0.47344434", "0.4731318", "0.47124025", "0.47107363", "0.4...
0.6308366
0
Generate `n` ddimensional points randomly distributed from the origin to `shape`
def random_points(n, shape): n = int(n) if n < 0: raise ValueError('n must be a positive integer') else: try: d = len(shape) if d == 0: raise ValueError('shape must contain at least one integer value') except TypeError: raise ValueE...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_point_cloud(n:int, d:int = 2, seed=1234) -> np.ndarray:\n initial_seed = np.random.get_state()\n np.random.seed(seed)\n points = np.random.rand(n, d)\n np.random.set_state(initial_seed)\n return points", "def make_random_nodes(size=100, ndim=2, expand=True):\n \n coords = np.ran...
[ "0.72449017", "0.7003255", "0.69783014", "0.68934023", "0.6881497", "0.68452924", "0.67632395", "0.6743165", "0.6722354", "0.66673714", "0.66623", "0.6654275", "0.6609782", "0.6609181", "0.6573012", "0.65394706", "0.65039957", "0.649928", "0.6467942", "0.64618504", "0.6433885...
0.7884414
0
Convert `points` to a binary image of size `shape` with hot pixels at each point
def points_to_binary(points, shape, dtype='uint8', cval=255, size=1): try: if len(points) != len(shape): raise ValueError('points and shape need to contain the same number of dimensions') else: d = len(points) if d == 0: raise ValueError('points an...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_bin_color_features(img, p):\n return cv2.resize(img, p.spatial_size).ravel()", "def bin_spatial(img, size=(32, 32)):\n color1 = cv2.resize(img[:, :, 0], size).ravel()\n color2 = cv2.resize(img[:, :, 1], size).ravel()\n color3 = cv2.resize(img[:, :, 2], size).ravel()\n return np.hstack((col...
[ "0.60144943", "0.5937813", "0.57862747", "0.5703861", "0.55770963", "0.5554891", "0.5531245", "0.5487618", "0.5448969", "0.5438692", "0.5438291", "0.53834456", "0.5377859", "0.53517765", "0.53464794", "0.53324103", "0.5332022", "0.5329281", "0.5318009", "0.5312711", "0.531087...
0.6389262
0
Remove a random subset from a set of points
def remove_random_points(points, amount): try: n = len(points[0]) except TypeError: raise ValueError('points needs to contain array-like objects') except IndexError: raise ValueError('points needs to have at least one dimension') if isinstance(amount, float) and 0 <= amount <= 1...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_point(mutated_genome,index):\n point_index = random.randint(0,max(0,len(mutated_genome[index][2])-1))\n del mutated_genome[index][2][point_index]", "def test_removing_selected_points(self, data, delete_indices):\n assume(np.max(delete_indices) < data.shape[0])\n\n delete_indices = se...
[ "0.6928655", "0.64177036", "0.63612354", "0.6347287", "0.62967795", "0.62883335", "0.6252221", "0.6252221", "0.62381864", "0.6218546", "0.61706203", "0.61508983", "0.61369", "0.61285615", "0.6119827", "0.6095844", "0.60833335", "0.6013879", "0.5989956", "0.598747", "0.5952686...
0.7110376
0
Generate an image of random noise scaled within `clim` bounds
def generate_random_noise(shape, clim): if len(clim) != 2: raise ValueError('clim must contain a minimum and maximum value') return np.random.rand(*shape) * (clim[1] - clim[0]) + clim[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_rand_img(c, w, h):\n if K.image_dim_ordering() == 'th':\n x = np.random.random((c, w, h))\n else:\n x = np.random.random((w, h, c))\n x = (x - 0.5) * 20 + 128\n return x", "def make_noisy_images(image):\r\n return apply_poisson_noise(image, random_state=12345)", "def add...
[ "0.5916642", "0.59127945", "0.58566624", "0.582824", "0.58167136", "0.578318", "0.57773983", "0.57493526", "0.5745429", "0.57056034", "0.57029104", "0.5697419", "0.5675307", "0.5655115", "0.5646064", "0.5607961", "0.56015295", "0.5601164", "0.5582431", "0.55754024", "0.556960...
0.7069578
0
Calculates the average of the nonzero entries in `samples`.
def average(samples): count = len(samples) total = 0 for sample in samples: if sample == 0: count = count - 1 else: total = total + sample if count > 0: return total / count else: return 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def avgOfNonZeroes(a): # Input a is an array of numbers (floats)\r\n\r\n if len([x for x in a if x != 0]) == 0:\r\n avg = 0\r\n else:\r\n avg = sum(a)/len([x for x in a if x != 0])\r\n return avg", "def sample_zero_mean(x):\n return x - np.mean(x, axis=1).reshape((x.shape[0], 1))", "...
[ "0.6870921", "0.68706125", "0.6864562", "0.6791676", "0.67436594", "0.6608023", "0.659685", "0.6594815", "0.654136", "0.65132946", "0.65051407", "0.6464864", "0.64451903", "0.64393044", "0.6434198", "0.64094883", "0.6387289", "0.6386887", "0.6386887", "0.6355019", "0.6315737"...
0.84275734
0
Serializes and optimizes `obj`.
def pickle(obj): return pickletools.optimize(cPickle.dumps(obj))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def serialize(obj):\n return serialization_manager.serialize(obj)", "def serialize(self, obj):\n pass", "def serialize(obj):\n return pickle.dumps(obj)", "def serialize_forstorage(cls, obj):\n return misc.serialize_forstorage(obj)", "def serialize(self, obj):\n return obj", "def ...
[ "0.7497463", "0.72954184", "0.72607034", "0.7084962", "0.68679386", "0.6842404", "0.66578233", "0.66539603", "0.6605147", "0.6605147", "0.65930146", "0.6498019", "0.6478875", "0.6396613", "0.63773865", "0.6370594", "0.63476485", "0.6312579", "0.6238561", "0.6238561", "0.62066...
0.7735133
0
Implementation of subprocess.call that accepts a timeout. The default timeout is 20 seconds. Returns None if the process times out or the subprocess exit code
def call_timeout(args, **kwargs): timeout = kwargs.pop('timeout', 20) assert timeout > 0 endtime = time.time() + timeout proc = subprocess.Popen(args, **kwargs) try: while time.time() < endtime: if proc.poll() != None: return proc.returncode ti...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def timeout_check_call(timeout, *args, **kwargs):\n resolution = 0.1\n pro = subprocess.Popen(*args, **kwargs)\n starttime = time.time()\n while pro.poll() is None:\n time.sleep(resolution)\n if time.time() - starttime > timeout:\n to = time.time() - starttime\n pro....
[ "0.7397217", "0.6879841", "0.6756392", "0.6497707", "0.6371244", "0.6353054", "0.63002896", "0.6209084", "0.6127244", "0.6117529", "0.6103111", "0.60869664", "0.60846025", "0.5947054", "0.5943417", "0.5937241", "0.59235954", "0.5861403", "0.5854743", "0.58463854", "0.58170426...
0.7610998
0
Obtain a DHCP lease for `ifname`.
def dhcp_release(ifname): logging.debug('Releasing %s...', ifname) try: subprocess.call(['dhcpcd', '--release', ifname]) except OSError, err: if err.errno != errno.ENOENT: raise err try: call_timeout(['dhclient', '-1', '-r', ifname], timeout=5) exce...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dhcp_renew(ifname):\n\n logging.debug('Renewing %s DHCP lease...', ifname)\n\n try:\n subprocess.call(['dhcpcd', '--rebind', ifname])\n except OSError, err:\n if err.errno != errno.ENOENT:\n raise err\n\n try:\n call_timeout(['dhclient', '-1', ifname], timeou...
[ "0.71241206", "0.595382", "0.56347615", "0.5569478", "0.5502887", "0.5482136", "0.5317377", "0.5085954", "0.50587684", "0.50569785", "0.5051202", "0.49877977", "0.49470493", "0.48861608", "0.4799783", "0.47883204", "0.47871375", "0.4751086", "0.47439423", "0.47390437", "0.471...
0.63030654
1
Renews `ifname`'s DHCP lease.
def dhcp_renew(ifname): logging.debug('Renewing %s DHCP lease...', ifname) try: subprocess.call(['dhcpcd', '--rebind', ifname]) except OSError, err: if err.errno != errno.ENOENT: raise err try: call_timeout(['dhclient', '-1', ifname], timeout=5) exc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def renew_dhcp_lease(self):\n\t\tresponse = os.system(\"/sbin/dhclient -r;/sbin/dhclient\")\n\t\tif response != 0:\n\t\t\tprint \"Network restart failed. DHCP Lease failed.\"", "def dhcp_release(ifname):\n\n logging.debug('Releasing %s...', ifname)\n\n try:\n subprocess.call(['dhcpcd', '--release', ...
[ "0.732168", "0.62170875", "0.5669002", "0.55773413", "0.5262287", "0.51193064", "0.49761513", "0.4920206", "0.4849435", "0.47442365", "0.46990854", "0.4650535", "0.463263", "0.46259677", "0.46149766", "0.45916057", "0.45732495", "0.45397198", "0.4480762", "0.44794604", "0.442...
0.855547
0
Binds `sock` to `dev`.
def bind_sock_to_device(sock, dev=''): # TODO: use IP_PKTINFO # TODO: move to sockios sock.setsockopt(socket.SOL_SOCKET, SO_BINDTODEVICE, dev)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def port_connection(self, sock):\n sock.bind(('', 0)) # Bind to OS-assigned available & random port.\n sock.listen(1)", "def setup_socket(self, sock):\n # Set SO_REUSEPORT option\n if self.has_reuseport and self.enable_reuseport():\n sock.setsockopt(socket.SOL_SOCKET, sock...
[ "0.68367743", "0.6669776", "0.65992016", "0.60933244", "0.60906714", "0.60136706", "0.60044533", "0.59942436", "0.5967698", "0.5959254", "0.59355754", "0.5934543", "0.58557534", "0.5849249", "0.5820383", "0.5808425", "0.57572097", "0.57572097", "0.5756014", "0.574935", "0.570...
0.8765568
0
Matches `pattern` against the output of the call to `cmd`.
def match_output(pattern, cmd): if isinstance(cmd, str): cmd = shlex.split(cmd) return re.findall(pattern, subprocess.check_output(cmd))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search_output_from_cmd(cmd: str, find_regex: typing.Pattern) -> typing.Match:\n # Run the given command in a shell\n _, stdout, _ = run_cmd(cmd)\n\n # Search for the object\n content = re.search(find_regex, stdout)\n\n # If the result is not None, return it\n if content:\n return conte...
[ "0.6709291", "0.6681424", "0.6544241", "0.64539653", "0.6192387", "0.6117293", "0.61116415", "0.60969716", "0.6072133", "0.607122", "0.60474145", "0.60255533", "0.6020787", "0.5927981", "0.5791718", "0.5786043", "0.5770694", "0.5762428", "0.5762428", "0.57523876", "0.5744132"...
0.8182549
0
Enables or disables the blocking I/O on `fildes`.
def set_blocking(fildes, blocking): import fcntl flags = fcntl.fcntl(fildes, fcntl.F_GETFL) flags = flags | (os.O_NONBLOCK * (blocking == False)) fcntl.fcntl(fildes, fcntl.F_SETFL, flags)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __setNonBlocking(fd):\n flags = fcntl.fcntl(fd, fcntl.F_GETFL)\n flags = flags | os.O_NONBLOCK\n fcntl.fcntl(fd, fcntl.F_SETFL, flags)", "def setblocking(fd, flag):\n\n # get the file's current flag settings\n fl = fcntl.fcntl(fd, fcntl.F_GETFL)\n if flag:\n # clear non-b...
[ "0.64254594", "0.6363372", "0.63173944", "0.62648624", "0.6204778", "0.61008084", "0.60372573", "0.57048655", "0.565035", "0.5522095", "0.54768926", "0.54000705", "0.53841656", "0.529856", "0.5235297", "0.5113002", "0.51026034", "0.5097197", "0.50740075", "0.50730133", "0.507...
0.7613581
0
Compares two links. Returns 1, 0 or 1 depending on whether the a link is considered worse, similar or better than b.
def link_compare(a, b): # wired > anything if not a.is_wifi() and not a.is_mobile() and (b.is_wifi() or b.is_mobile()): return 1 # wifi > mobile unless wifi is going down. if a.is_wifi() and b.is_mobile(): return a.is_going_down() == False # if its the same tech, signal strength d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compare(l1, l2):\n if link_weights[l1] < link_weights[l2]:\n return 1\n elif link_weights[l1] == link_weights[l2]:\n return 0\n else:\n return -1", "def compare_distance(self, a, b):\n a_dist = int(a['distance'])\n b_dist = int(b['distance'])\n if a_dist < b_dist:\n ...
[ "0.70454", "0.6447037", "0.6303607", "0.62195873", "0.6186371", "0.60023266", "0.60021836", "0.599595", "0.5959228", "0.5898069", "0.5841289", "0.5822387", "0.58094496", "0.57987005", "0.5795709", "0.5772296", "0.574678", "0.5744194", "0.5739526", "0.5714097", "0.57100344", ...
0.8182829
0
when donor is initiated the object is avaliable
def test_donor_initiaztion(new_donor): assert isinstance(new_donor, Donor)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n self.donors = {}", "def get_object_to_run(self):", "def __init__(self, donors=None):\n if donors is None:\n self.donor_inf = {}\n else:\n self.donor_inf = {name: donations}", "def object(self):", "def __init__(self, requestor):\n self....
[ "0.7184559", "0.6386976", "0.6301603", "0.6201877", "0.61659503", "0.61299187", "0.6115164", "0.61122286", "0.6006392", "0.6006392", "0.6006392", "0.6006392", "0.6006392", "0.6006392", "0.6006392", "0.6006392", "0.60032755", "0.59968513", "0.5957757", "0.5955629", "0.59532094...
0.6511407
1
Get the system's installed fonts, loop over the fonts and add them to the PDF
def system_font_demo(my_canvas, fonts): pos_y = 750 for font in fonts: try: ttf = TTFont(font, fonts[font]) except: # Skip this font continue pdfmetrics.registerFont(ttf) my_canvas.setFont(font, 12) my_canvas.drawString(30, pos_y, fon...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_fonts(self):\n for key, font in enumerate(self.fonts):\n self.fonts[key]['font'] = load_font(font['name'], font['size'])\n checkpoint('fonts')", "def initialize():\n #carga las fuente del usuario\n for family in USER_FONTS:\n for font in USER_FONTS[family]:\n name, pat...
[ "0.75900877", "0.7204318", "0.71811783", "0.71616787", "0.7056642", "0.6935759", "0.68808836", "0.68438905", "0.6832116", "0.67777437", "0.67198193", "0.6653027", "0.6647451", "0.66267127", "0.65464425", "0.65464425", "0.6534153", "0.6510333", "0.64171493", "0.6391914", "0.62...
0.7321207
1
Get production image create it's testable version. For now, it adds just a coverage library as additional requirements, so our image tests can enable it in order to obtain coverage information of the docker/k8s related code.
def build_test_version_of_container_image( image_type: ImageType, image_builder_cls: Type[ContainerisedAgentBuilder], architecture: CpuArch, result_image_name: str, ready_image_oci_tarball: pl.Path = None, install_additional_test_libs: bool = True, ): image_builder = image_builder_cls() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_image(runtime):\n return \"{}:{}\".format(LambdaContainer._IMAGE_REPO_NAME, runtime)", "def _ensure_image(testkit_path, branch_name, artifacts_path):\n # Construct Docker image name from branch name\n image_name = \"runner:%s\" % branch_name\n image_path = os.path.join(testkit_path, \"ru...
[ "0.60722476", "0.60149956", "0.5801076", "0.56776553", "0.5626107", "0.5608371", "0.5608036", "0.54736507", "0.5470767", "0.5428152", "0.5400544", "0.5348892", "0.5346526", "0.53116447", "0.52694076", "0.5261629", "0.52526265", "0.5247445", "0.5245241", "0.5218683", "0.519586...
0.64492244
0
Create a Calculation object after submitting a calculator form
def create_calculation(): if request.method == 'POST': ip = request.remote_addr text = request.form['answer'] user = find_user(ip) is_valid, message = check_valid_expression(text) if is_valid: answer = eval(text) db.create(user, str(message + "=" + str...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n model = Calculator()", "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 calculator(**pars):\n # paying for parame...
[ "0.6706225", "0.6265942", "0.6022682", "0.5893873", "0.5817431", "0.57421255", "0.57395124", "0.57244724", "0.5710595", "0.5682451", "0.5672359", "0.56109774", "0.5610867", "0.55981994", "0.5596186", "0.5593982", "0.5591234", "0.55802864", "0.55526197", "0.553753", "0.5533165...
0.6501163
1
rename column `votes_num` to `real_votes_num` add column admin_votes_num
def upgrade(): op.add_column( 'wish', sa.Column( 'admin_votes_num', sa.Integer(), server_default='0', nullable=True)) op.add_column( 'wish', sa.Column('real_votes_num', sa.Integer(), nullable=True)) op.execute('UPDATE wish SET real_votes_num = votes_num') op.drop_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upgrade():\n op.drop_table(\"fetch_win_rate\")\n op.drop_table(\"fetch_history\")\n op.rename_table('fetch_summary', 'dota_fetch_summary')\n op.create_table(\"dota_hero_win_rate\",\n sa.Column('time_hero_skill', sa.String(128),\n primary_key=True),\n ...
[ "0.559774", "0.557594", "0.55078936", "0.52423596", "0.520714", "0.5181643", "0.5181023", "0.51146615", "0.5089447", "0.50557715", "0.5035652", "0.5024631", "0.49794018", "0.49136025", "0.48422492", "0.48149562", "0.4814864", "0.48127317", "0.48111665", "0.47909853", "0.47795...
0.7832552
0
Updates player' health and armor status bar items
def set_player_state(self, player): health_str = "HP {0}/{1}".format(int(player.health), int(player.max_health)) self.health_label.element.text = health_str if player.armor is not None: armor_hp = int(player.armor.health) max_armor_hp = int(player.armor.max_health) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setPlayerStates(self, updates):\r\n for upd in updates:\r\n print \"UPD player %s\" % upd['player']\r\n player = self.players[upd['player']]\r\n player.setStatus(upd['status'], upd['jump'], upd['charge'])\r\n\r\n player.health = upd['health']\r\n if...
[ "0.70559305", "0.6723304", "0.65944636", "0.64733964", "0.62678206", "0.62488115", "0.61416495", "0.61129445", "0.6080276", "0.6064772", "0.6014446", "0.5998788", "0.5951158", "0.5938943", "0.58863354", "0.5868311", "0.5859064", "0.5853154", "0.5830821", "0.5824744", "0.58096...
0.68151045
1
If the form is valid, save the associated model and respond the resulted shortened_url
def form_valid(self, form): obj = form.save() base_url = self.request.build_absolute_uri() return self.render_to_response( self.get_context_data( result=f'{base_url}{obj.shortened_url}'))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save(self,\n force_insert=False,\n force_update=False,\n using=None,\n update_fields=None):\n # If the short url wasn't specified\n if not self.short_url:\n # We pass the model instance that is being saved\n self.short_url = cr...
[ "0.6750792", "0.66781956", "0.65994966", "0.65302175", "0.64536464", "0.6371185", "0.6371185", "0.6316489", "0.6276938", "0.61873704", "0.6156711", "0.6149612", "0.6149612", "0.6120635", "0.61127406", "0.60791844", "0.60360485", "0.6009595", "0.5989229", "0.59776646", "0.5942...
0.79156256
0
If form is invalid, show errors as text.
def form_invalid(self, form): return self.render_to_response( self.get_context_data(result=form.errors.as_text()))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_form_errors(form):\n\n for fieldname, errors in form.errors.items():\n for error in errors:\n err_str = 'Error in field <' + fieldname + '>: ' + error\n flash(err_str, 'error')", "def form_invalid(self, form):\n return self.render_to_response(self.get_context_da...
[ "0.7510478", "0.73192906", "0.73192906", "0.72316563", "0.69572705", "0.69572705", "0.6908557", "0.6882932", "0.68779737", "0.68687606", "0.68590236", "0.68590236", "0.6853912", "0.6848186", "0.6848186", "0.6842627", "0.68291146", "0.68291146", "0.681507", "0.681507", "0.6778...
0.79132736
0
Gets the argument provided (shortened code) and update `self.url` so super can be used to redirect the client.
def get(self, request, *args, **kwargs): shortened_code = args[0] if args else None if not shortened_code: self.url = '/' else: # TODO: Make a custom 404 and show it when shortened_code doesn't # exist on database # Try and fetch the full_url usin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _redirect_implementation(request, model, b36_encoded_pk):\n endpoint = get_object_or_404(model, pk=base36_to_int(b36_encoded_pk))\n shorturl_redirect.send(sender=model, instance=endpoint, user=request.user)\n return endpoint.url", "def route_view(request, code):\n try:\n instance = get_obj...
[ "0.68586576", "0.64993536", "0.6492017", "0.6486846", "0.6464387", "0.6448385", "0.6392105", "0.6353576", "0.6344151", "0.63086563", "0.63049245", "0.6283371", "0.62764204", "0.6224965", "0.613608", "0.61353785", "0.6127238", "0.6052615", "0.6025233", "0.60024446", "0.6000577...
0.72384745
0
make a grid of cells with the specified limits. limits is a list of pairs, [[lowx, lowy], [highx, highy]]
def make_cells(self, limits): low, high = limits xs = range(low[0], high[0]) ys = range(low[1], high[1]) for x in xs: col = [] for y in ys: indices = (x, y) self.cells[indices] = Patch(self, indices)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_grid(xlim, ylim, step):\n x_range = np.arange(xlim[0], xlim[1], step)\n y_range = np.arange(ylim[0], ylim[1], step)\n return x_range, y_range", "def make_grid(data=None, xmin=-5, xmax=5, ymin=-5, ymax=5, n_points = 400):\n if data is not None:\n xmin, ymin = np.min(data, axis = 0)\n...
[ "0.7732495", "0.7290888", "0.7176541", "0.704265", "0.70399666", "0.70399666", "0.70263743", "0.6990715", "0.67124534", "0.6641184", "0.6620352", "0.65798974", "0.6560937", "0.65129614", "0.6507297", "0.6446217", "0.6444136", "0.6407571", "0.6394874", "0.6387809", "0.6359436"...
0.7728064
1
find the set of cells that are connected to (patch) in the sense that they are either neighbors, or neighbors of neighbors, etc.
def get_cluster(self, patch): # queue is the set of cells waiting to be checked queue = set([patch]) # res it the resulting set of cells res = set([patch]) # do a breadth first search based on neighbors relationships while queue: patch = queue.pop() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def neighbours(self):\n seen = set()\n return [l.other(self) for l in self.dovetails \\\n if id(l) not in seen and not seen.add(id(l))]", "def cell_neighbours(self, x, y):\n if self.maze_map[y][x]:\n return set()\n neighbours = set()\n for (direction, ((i, j), d...
[ "0.6829217", "0.66356844", "0.6618786", "0.6613173", "0.65474004", "0.64726627", "0.6467263", "0.64063984", "0.640279", "0.6371476", "0.63605577", "0.63590986", "0.63590986", "0.63558114", "0.6340382", "0.63261217", "0.63145864", "0.63143116", "0.6303374", "0.6296545", "0.628...
0.694693
0
find all the clusters in the current grid (returns a list of sets).
def all_clusters(self): # find all the green cells greens = [p for p in self.cells.itervalues() if p.state == "green"] # keep track of cells we have already seen marked = set() # initialize the list of cluster clusters = [] for patch in greens: if ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_clusters(self):\r\n\r\n return self.__clusters", "def get_clusters():\n return objects.ClusterCollection.order_by(\n objects.ClusterCollection.all(),\n 'id'\n )", "def clusters(self):\n return self._clusters", "def get_clusters(self):\n return ...
[ "0.7552373", "0.74815166", "0.74222213", "0.741887", "0.7366615", "0.72868776", "0.71821016", "0.71755326", "0.7097102", "0.7094541", "0.7083775", "0.69984156", "0.69703794", "0.6935397", "0.6900433", "0.6889937", "0.6845578", "0.68063116", "0.6769066", "0.6698206", "0.654052...
0.7873478
0
compute and display the distribution of cluster sizes.
def cluster_dist(self): clusters = self.all_clusters() lengths = [len(cluster) for cluster in clusters] d = Dist(lengths) d.plot_ccdf(loglog) show()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_cluster_sizes(self,sc):\n\n clusterSizes = []\n clusters = sc.labels\n for k in np.arange(clusters.max()):\n clusterSizes.append(len(np.where(clusters==k)[0])) \n \n return clusterSizes", "def DistributionSize(self):\n return self.distribution_size", ...
[ "0.75164026", "0.6634813", "0.6442297", "0.64080244", "0.63970906", "0.6369941", "0.6293231", "0.62672687", "0.62653583", "0.6199664", "0.6193117", "0.61638856", "0.61137295", "0.6021083", "0.5994114", "0.59815377", "0.5961161", "0.59536093", "0.59212863", "0.58701324", "0.58...
0.68331957
1
this event handler is executed when the user clicks on the canvas. It finds the cluster of the cell that was clicked and displays it in red.
def click(self, event): x, y = self.canvas.invert([event.x, event.y]) i, j = int(floor(x)), int(floor(y)) patch = self.get_cell(i, j) if patch and patch.state == "green": cluster = self.get_cluster(patch) self.show_cluster(cluster)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _onclick(self,event):\r\n if self.NumCells > 0:\r\n ShapeMask = np.shape(self.Mask)\r\n # get coorinates at selected location in image coordinates\r\n if event.xdata == None or event.ydata == None:\r\n return\r\n xcoor = min(max(int(event.xdata)...
[ "0.7216182", "0.66125804", "0.65536726", "0.6398306", "0.6370748", "0.62716126", "0.6215063", "0.61873126", "0.6062875", "0.59600496", "0.5933807", "0.590672", "0.58761984", "0.5797216", "0.57884073", "0.57595307", "0.57301027", "0.56525195", "0.56268847", "0.56253386", "0.55...
0.8439539
0
color all the cells in this cluster red
def show_cluster(self, cluster): for patch in cluster: patch.config(fill="red")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def color_invalid(self):\n for i in self.invalid:\n self.color_cell(i, INVALID)", "def color(self, sids=None, sat=1):\n if sids == None: # init/overwrite self.colors\n nids = self.nids\n # uint8, single unit nids are 1-based:\n self.colors = CLUSTERCLRSRG...
[ "0.6507152", "0.6380359", "0.63705295", "0.634146", "0.61118144", "0.6086162", "0.59977335", "0.59868664", "0.59370923", "0.58787715", "0.5852878", "0.58338547", "0.58059615", "0.5716626", "0.5705305", "0.56975734", "0.56566024", "0.5644871", "0.564142", "0.5637264", "0.55917...
0.7172361
0
run one step and profile it
def profile_step(self): import profile profile.run("world.step()")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_one_step(self):\n pass", "def do_step(self) -> None:", "def TestOneStep(self):\n pass", "def _step(self):\n title()\n self.runCount = 1\n self.experiment.pause = False\n self._runExperiment()\n self.pause = True", "def perform_step(self) -> None:\n pass", "def ...
[ "0.76332366", "0.73576313", "0.6879557", "0.6847156", "0.68181074", "0.6768962", "0.671694", "0.6647652", "0.6565782", "0.6495113", "0.64842176", "0.6477628", "0.64197576", "0.64171064", "0.6372245", "0.6334341", "0.629735", "0.6234604", "0.62291634", "0.61691546", "0.6158106...
0.84291345
0
display the FFT of the last (N) values in self.series
def display_fft(self, N=4096): if len(self.series) % N != 0: return h = self.series[-N:] H = fft(h) # the squared magnitude of the fft is an estimate of the # power spectral density # http://documents.wolfram.com/applications/timeseries/ # User...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plotfft(s, fmax):\n\n fs = abs(np.fft.fft(s))\n f = np.linspace(0, fmax // 2, len(s) // 2)\n return (f[1:len(s) // 2].copy(), fs[1:len(s) // 2].copy())", "def plot_fft(self):\r\n\r\n self.ipx = int(self.imageData.shape[1]/2.)\r\n\r\n self.ipy = int(self.imageData.shape[2]/2.)\r\n\r\n ...
[ "0.64106685", "0.6259204", "0.6121661", "0.6043962", "0.60367", "0.602173", "0.60159296", "0.59614336", "0.5943147", "0.5784943", "0.5773492", "0.5750416", "0.57236975", "0.5719462", "0.57088095", "0.5705503", "0.5704268", "0.5667961", "0.5645121", "0.5631272", "0.56306136", ...
0.77692866
0
world is a Forest, indices is a tuple of integer coordinates
def __init__(self, world, indices): self.world = world self.indices = indices self.bounds = self.world.cell_bounds(*indices) self.state = "white" self.draw()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def master_ndindex(self): # itermaster_indices(self):\n return itertools_product(\n *[range(*r) for r in self.location]\n ) # TODO check", "def indices(self):\n return tuple([slice(*r) for r in self.location])", "def index_object(idxs=None):", "def identify_bodies(self, inde...
[ "0.5891684", "0.58609426", "0.5841883", "0.5825762", "0.5768459", "0.57638896", "0.57202816", "0.56736535", "0.56165963", "0.560714", "0.5594902", "0.55937994", "0.5532244", "0.55151504", "0.5477267", "0.54553896", "0.54517114", "0.5451648", "0.5436055", "0.5425861", "0.54108...
0.64196026
0
set the state of this patch and update the display. (state) must be a color.
def set_state(self, state): self.state = state self.config(fill=self.state)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_state(self, state: int):", "def setState(self, state):\n self.state = state", "def set_state(self, state):\n self.state = state", "def set_state( self ):", "def set_state(self, state):\n return self.update(current_state=state)", "def update(self):\n self._state = 23", ...
[ "0.67459357", "0.67421955", "0.6708725", "0.6684036", "0.6635258", "0.66032887", "0.6595726", "0.656716", "0.65356606", "0.65223676", "0.65065753", "0.65051764", "0.6488053", "0.64739656", "0.64739656", "0.64739656", "0.64739656", "0.64739656", "0.64739656", "0.64739656", "0....
0.7030595
0
return True if any of this patch's 4 Von Neumann neighbors are currently burning, False otherwise.
def any_neighbor_burning(self): neighbors = self.world.get_four_neighbors(self, Patch.null) states = [patch.state for patch in neighbors] return "orange" in states
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_bees_raised_flag(self):\n pos, com, success = self.perception\n if len(pos) > 0:\n return all(map(lambda x: x[1][\"flag\"] == (self.nr_of_possible_neighbors + 1), com))\n else:\n return True", "def check_neighbours(self):\n for p in self.targetCell.possib...
[ "0.6983231", "0.66076064", "0.6487816", "0.6410324", "0.62506366", "0.61580676", "0.6140016", "0.6094453", "0.60612327", "0.60612327", "0.60612327", "0.60612327", "0.60612327", "0.60612327", "0.6060617", "0.60549283", "0.60548204", "0.6028688", "0.60227245", "0.6008509", "0.5...
0.8200193
0
Updates the view of a sample. Takes the angle (an int, from 0 to 359) and the list of four bytes of data in the order they arrived.
def update_view( angle, data ): global offset, use_outer_line, use_line #reset the point display point.pos[angle] = vector( 0, 0, 0 ) pointb.pos[angle] = vector( 0, 0, 0 ) point2.pos[angle] = vector( 0, 0, 0 ) point2b.pos[angle] = vector( 0, 0, 0 ) #unpack data using the denominat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def change_angle(self, new_angle):\r\n self.angle = new_angle", "def updateAngles(self, dt):\n for angle in self.angles:\n angle.update(dt)", "def update_with_samples(self, samples):\n nsamples_input = len(samples)\n idx_input = 0\n while nsamples_input > 0:\n ...
[ "0.5704588", "0.5529057", "0.55203885", "0.54247576", "0.5415066", "0.52971214", "0.5271452", "0.5211176", "0.5174099", "0.51739424", "0.5168637", "0.5162323", "0.51409554", "0.513634", "0.51331687", "0.510945", "0.5108934", "0.51000667", "0.5098921", "0.5098419", "0.5077611"...
0.67124146
0
Compute and return the checksum as an int. data list of 20 bytes (as ints), in the order they arrived in.
def checksum(data): # group the data by word, little-endian data_list = [] for t in range(10): data_list.append( data[2*t] + (data[2*t+1]<<8) ) # compute the checksum on 32 bits chk32 = 0 for d in data_list: chk32 = (chk32 << 1) + d # return a value wrapped a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checksum(data):\n total = sum([ord(x) for x in data])\n return total & 0xff", "def calcChecksum(self, data, length):\n checksum = 0\n\n for i in range(length//2):\n checksum = checksum ^ (data[i*2] | (data[i*2+1] << 8)) #xor-ing\n return 0xffff & (checksum ^ 0xffff) ...
[ "0.7550743", "0.73446167", "0.72034293", "0.718895", "0.71197575", "0.70011425", "0.694011", "0.690407", "0.6840839", "0.6676402", "0.66548973", "0.6643646", "0.6624862", "0.66209", "0.6611515", "0.66103023", "0.66002893", "0.6573551", "0.6560882", "0.6548677", "0.64923114", ...
0.76232636
0
Allow any relation between two objects in the pool
def allow_relation(self, obj1, obj2, **hints): if obj1._state.db in self.pool and obj2._state.db in self.pool: return True return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allow_relation(self, obj1, obj2, **hints):\n return None", "def allow_relation(self, obj1, obj2, **hints):\n return True", "def allow_relation(self, obj1, obj2, **hints):\n\n if obj1._state.db == obj2._state.db:\n return True\n return False", "def relate(self, other...
[ "0.68575275", "0.6793133", "0.66868186", "0.6414275", "0.6220083", "0.61565876", "0.5977879", "0.5956121", "0.5910697", "0.58156484", "0.577888", "0.573786", "0.5720376", "0.5711609", "0.57091683", "0.57042164", "0.5609974", "0.5608323", "0.5605707", "0.55947703", "0.55662155...
0.7719002
0
Imprime una matriz de manera ordenada
def imprimir_matriz(matriz): for i in matriz: print(i)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def matI(a):\n shape=matShape(a)\n if shape[0]!=shape[1]: raise ValueError\n n=shape[0]\n ret=matZeros((n,n*2))\n for i in range(n):\n for j in range(n):\n matSet(ret,i,j,matGet(a,i,j))\n for i in range(n):\n matSet(ret,i,i+n,1)\n for row in range(n):\n rm=row\n ...
[ "0.6105108", "0.59901255", "0.5840717", "0.5819956", "0.5774199", "0.57367104", "0.567831", "0.56604546", "0.5639857", "0.5628217", "0.56268775", "0.562588", "0.56233406", "0.5620485", "0.5614912", "0.55957156", "0.5586525", "0.5555572", "0.5550814", "0.5550684", "0.55364424"...
0.67050844
0
Recorre la matriz en forma espiral desde el centro y retorna todos esos valores en una lista
def espiral(matriz): result = [] # Lista resultado indice_central = indice_central = len(matriz) // 2 # Coordenadas x = indice_central y = indice_central pasos = 1 direcciones = ["derecha", "abajo", "izquierda", "arriba"] contador_direccion = 0 # Agregamos el numero central ya a la lista ant...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def traspo(*args):\r\n filas,columnas = len(args),len(args[0])\r\n matriz_r = []\r\n for i in range(0,filas):\r\n lista_aux = []\r\n for j in range(0,columnas):\r\n lista_aux.append(args[j][i])\r\n matriz_r.append(lista_aux)\r\n return matriz_r", "def copie_matrice(m):...
[ "0.62347144", "0.62175804", "0.60558903", "0.5869268", "0.5828088", "0.57976675", "0.5797499", "0.579525", "0.57904315", "0.574203", "0.5738405", "0.5691709", "0.568947", "0.5664443", "0.5657994", "0.5656907", "0.5647695", "0.562721", "0.5613911", "0.56131196", "0.5611424", ...
0.6679654
0
STFT of multiple data series.
def _multiple_stft(X, frame_length, win=None, step=None): n_samples = X.shape[0] n_features = X.shape[1] n_frequencies = frame_length if step is None: step = frame_length / 4 elif step > frame_length: print "step is longer than frame_length.\n" sys.exit() elif step <...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stft(db,istart=0,istop=86400,nh=2**8,tstep=2**7,ng=1,df=1.0,nfbins=2**9):\r\n \r\n #get length of input time series if there is two columns\r\n if type(fx) is list:\r\n fx=np.array(fx)\r\n try:\r\n fn,fm=fx.shape\r\n if fm<fn:\r\n fm,fn=fx.shape\r\n except ValueEr...
[ "0.6631433", "0.64781517", "0.6423828", "0.63805515", "0.6306611", "0.62617964", "0.6156083", "0.6076733", "0.6035118", "0.59293747", "0.5917681", "0.58611757", "0.58375967", "0.57622796", "0.57565075", "0.56980896", "0.5684713", "0.5672126", "0.566136", "0.5642429", "0.56330...
0.69396687
0
apply ComplexfastICA Fouriertransformed data by frequency, and get separated spectra.
def _ica_by_freq(S): n_samples, n_frames , n_frequencies= S.shape T = np.zeros(S.shape, dtype=np.complex64) WK = np.zeros([n_samples, n_samples, n_frequencies], dtype=np.complex64) for l in range(n_frequencies): M = S[:,:,l].T M = M.astype(np.complex64) M /= M.std(axis = 0)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_fft_complex_1d():\n\ta = np.exp(2j * np.pi * np.arange(8) / 8)\n\tdummy_array = xr.DataArray(a, dims=['x'])\n\tchunked_array = dummy_array.chunk(chunks={'x': 2})\n\tspectrum_array, spectrum_coords, spectrum_dims = \\\n\t\txfft._fft(chunked_array, nfft={'x': 16}, dim=['x'], dx={'x': 0.5})\n\tassert np.arra...
[ "0.6351739", "0.62736195", "0.622976", "0.62279737", "0.6123631", "0.6098033", "0.6083373", "0.59512115", "0.59214175", "0.59004575", "0.5896987", "0.5891838", "0.5876645", "0.5875746", "0.5859034", "0.5829158", "0.5819647", "0.58167285", "0.58039093", "0.5740096", "0.5732711...
0.69138736
0
checks if function has any semnops that can be replaced
def can_semnops(f): if hasattr(f, 'displaced_bytes'): return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_isReplacement(self):\n isReplacement = self.standardcode.get_predefined_predicate(\"replacement\")\n # for the standard code, a replacement\n assert isReplacement(\"CTG\", \"ATG\")\n assert not isReplacement(\"AGT\", \"TCC\")\n assert not isReplacement(\"CTG\", \"---\")\...
[ "0.5799297", "0.5719962", "0.5488146", "0.54848474", "0.54792565", "0.54656696", "0.54517066", "0.5445082", "0.54302424", "0.54051816", "0.5391857", "0.53737867", "0.53291875", "0.5325738", "0.5308172", "0.52382326", "0.5227866", "0.5216511", "0.5198014", "0.51851785", "0.518...
0.6186944
0
Calculates the total length and average radius for this root
def calculate_root_statistics(self): total_length = 0 total_radius = 0 for i in range(len(self.pixel_list)): total_radius += self.pixel_list[i].radius + 0.5 if i > 0: # Use the distance formula delta_x = self.pixel_list[i].x - self.pixel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_root_statistics_and_totals(self):\n\n self.average_radius = 0\n self.total_root_length = 0\n\n total_radius = 0\n\n for root in self.root_dict.values():\n\n root.calculate_root_statistics()\n\n self.total_root_length += root.total_length\n\n t...
[ "0.7723698", "0.7188401", "0.69766617", "0.6917069", "0.68209773", "0.6818739", "0.66914785", "0.65687287", "0.65585107", "0.6556658", "0.6546357", "0.6467312", "0.6456991", "0.6447579", "0.641768", "0.64088196", "0.63881326", "0.63841647", "0.63694173", "0.63541543", "0.6354...
0.7892125
0
Remove a root from its parent's branch list.
def remove_edge_root(self): to_remove = None # Find this in the parent's branch list if self.parent_root: for branch_tuple in self.parent_root.branch_list: if branch_tuple[1] is self: to_remove = branch_tuple break if...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_subtree(self, root: State):\n self.remove(root)\n for child in root.children:\n self.remove_subtree(child)", "def delete_root(self, node):\n current = node\n successor = self.find_successor(current) \n temp_height = current.height\n current.height =...
[ "0.73607355", "0.6952799", "0.65805894", "0.65719575", "0.6545137", "0.65333545", "0.65272546", "0.644984", "0.6428002", "0.642797", "0.640299", "0.6325491", "0.6315396", "0.62021756", "0.61744195", "0.61712736", "0.6169025", "0.61533856", "0.61319804", "0.6108882", "0.609850...
0.7035294
1
Gets the general direction represented by the first few pixels of this root
def get_starting_direction_vector(self): total_length = len(self.pixel_list) if total_length < 2: return None elif total_length < 15: delta_x = self.pixel_list[-1].x - self.pixel_list[0].x delta_y = self.pixel_list[-1].y - self.pixel_list[0].y re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_direction(self):\n return self.actual_coordinates[2]", "def getGlobalPhaseDirection(self):\n\t\tretVal = np.zeros((2*self.totalBins))\n\t\tfor i in range(self.totalBins):\n\t\t\tretVal[2*i ] = -self.imags[i]\n\t\t\tretVal[2*i+1] = self.reals[i]\n\n\t\treturn normVector(retVal)", "def direction...
[ "0.61930716", "0.6141917", "0.61050874", "0.6096267", "0.6053399", "0.5843753", "0.5758967", "0.57532096", "0.5717552", "0.57116604", "0.57002044", "0.5676624", "0.56682706", "0.5666424", "0.56513083", "0.56285447", "0.559396", "0.5584189", "0.555835", "0.5524356", "0.5517763...
0.6158047
1
Checks if a slot can be made with `current time` and `duration` before the `end time`
def time_left(current, end, duration): today = datetime.date.today() diff = (datetime.datetime.combine(today, end) - datetime.datetime.combine(today, current)) return diff >= duration
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _is_available_by_duration(self) -> bool:\n current_time = datetime.datetime.utcnow()\n if self.time_start is not None and self.time_start > current_time:\n return False\n if self.time_stop is not None and self.time_stop < current_time:\n return False\n return T...
[ "0.71018445", "0.6512393", "0.62997633", "0.6284452", "0.6268738", "0.622294", "0.61454606", "0.6109484", "0.61018145", "0.6055699", "0.60147876", "0.5987539", "0.5982598", "0.59697145", "0.5968583", "0.5960791", "0.5940211", "0.59363467", "0.5930146", "0.59214646", "0.589261...
0.6769289
1
Bulk Import Slots has a form for creating slots. This form is restricted to staff.
def generate_slots(request): if request.method == 'POST': form = BulkCreateSlotsForm(request.POST) if not form.is_valid(): return SlotAdmin.render_bulk_slots_form(request, form) instr = form.cleaned_data['instrument'] start_date = form.cleaned_dat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_parking_lot(self, allow_slots):\n allow_slots = int(allow_slots)\n\n if len(self.slots) > 0:\n print(\"Parking Lot is already created\")\n return\n\n if allow_slots < 1:\n print(\"Number of slot: %s provided is incorrect.\" % allow_slots)\n ...
[ "0.5631297", "0.51076645", "0.5056643", "0.50280803", "0.4981345", "0.4980151", "0.49414772", "0.49152222", "0.48947087", "0.4865669", "0.4808657", "0.47663075", "0.47653168", "0.47571674", "0.4751166", "0.4751166", "0.47428787", "0.4737241", "0.4734336", "0.47273046", "0.470...
0.70364946
0
test if new account credential has been saved to the new credential_list
def test_save_account(self): self.new_account.save_account() # add account to list self.assertEqual(len(Credential.credential_list), 1) # check length of list
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_store_existing_cred(self):\n self.new_cred.save_cred()\n self.assertEqual(len(Credentials.cred_list), 1)", "def test_save_credential(self):\n self.new_credential.save_credential() # saving the new credential\n self.assertEqual(len(Credential.credential_list),1)", "def test_...
[ "0.7832446", "0.7683091", "0.7600945", "0.7573333", "0.7386722", "0.7337577", "0.72540885", "0.7194982", "0.7048586", "0.6951442", "0.6930954", "0.685089", "0.674881", "0.6683021", "0.6635546", "0.6612441", "0.65795165", "0.6546666", "0.6495144", "0.64704657", "0.644774", "...
0.78498554
0
send the token to server and wait for it return
def request(self, token): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_and_receive(self, token):\n self._send_token(token)\n return self._receive_token()", "def send_mfa(self):\n\n try:\n response = self.post(\"/authentication/loginToken\",\n {\"user\": self.user, \"password\": self.password, \"TempCode\": Tru...
[ "0.7365586", "0.65757877", "0.65690523", "0.6468089", "0.6427283", "0.6418594", "0.63000584", "0.6262973", "0.62615955", "0.6131265", "0.61195034", "0.60729843", "0.6069176", "0.6055175", "0.6054932", "0.6052025", "0.60150856", "0.60011166", "0.5928777", "0.59102345", "0.5898...
0.68809885
1
Display the found token
def print_token(self): log.success("Your token : [{}]".format(self.get_token()))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return self.token", "def token(self) -> str:", "def token(self):\n token = self.lex.token()\n if token is not None:\n print(token)\n return token", "def print_token(self, token_node_index):\n err_msg = \"The given node is not a token node.\"\...
[ "0.67491794", "0.65787387", "0.65611935", "0.6544689", "0.64002043", "0.630983", "0.61383736", "0.60940343", "0.6034388", "0.6000451", "0.5970468", "0.58582294", "0.5847218", "0.57738835", "0.57554305", "0.5734318", "0.5734318", "0.5734318", "0.56961346", "0.56961346", "0.569...
0.74025446
0
Test registration and annotation of VCFs
def test_vcf_registration(client, sample_vcf): resp = client.put("/vcf", files={"vcf": ("test.vcf", sample_vcf)}) assert resp.status_code == HTTPStatus.OK assert b"VRS_Allele=ga4gh:VA.AFrq9QZuBrvJdB9xxOJsKvRJFIHuAYxH,ga4gh:VA.VTEdMcoqSZEqIGuQHKRrpkoAwYPEf0-X" in resp.content # noqa: E501
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_ipam_vrfs_create(self):\n pass", "def test_register_cloud(self):\n pass", "def test_register_virtualization_realm(self):\n pass", "def test_register_fov(self):\n task = MesoscopeFOV(self.session_path, device_collection='raw_imaging_data', one=self.one)\n mlapdv = {...
[ "0.6750206", "0.659648", "0.61771595", "0.6152025", "0.6062379", "0.6044492", "0.6001242", "0.5932112", "0.58147687", "0.5787732", "0.57776475", "0.5761501", "0.5745228", "0.5719477", "0.5709839", "0.5706517", "0.56890947", "0.5683279", "0.56692696", "0.56658405", "0.56387335...
0.7121834
0
Resets the database to the original state using alembic downgrade and upgrade commands
def reset_db(): from alembic.command import downgrade, upgrade from alembic.config import Config as AlembicConfig config = AlembicConfig('alembic.ini') downgrade(config, 'base') upgrade(config, 'head') print('Database has been reset')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset(self) -> None:\n call_command('migrate', verbosity=0, database=self._database)", "def reset_db_danger():\n from flask.ext.migrate import init, migrate\n # Remove the migration folder if exist\n if os.path.exists('migrations'):\n shutil.rmtree('migrations')\n\n # Remove the sql...
[ "0.7494169", "0.744497", "0.73783547", "0.7303981", "0.7228575", "0.7150942", "0.712678", "0.7084664", "0.707177", "0.69442177", "0.6936162", "0.6895912", "0.68475103", "0.68241227", "0.68073624", "0.67611486", "0.6722329", "0.6648558", "0.66036296", "0.66012627", "0.659435",...
0.85889274
0
Set state of this flow to a given value
def set_state(self, value): self.state = value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_state(self, state: int):", "def set_state(self,s):\n self.state = s", "def setState(self, state):\n self.state = state", "def _set_state(self, state):\n #print(\"** set state from %d to %d\" % (self.state, state))\n self.state = state", "def set_state(self, state):\n ...
[ "0.7850291", "0.7650408", "0.7601784", "0.76001054", "0.7598213", "0.75650716", "0.75024015", "0.74790454", "0.73654693", "0.7330667", "0.7259985", "0.72402036", "0.72402036", "0.72402036", "0.72402036", "0.72402036", "0.72402036", "0.72402036", "0.72402036", "0.72402036", "0...
0.8665828
0
Set state30 of this flow to a given value
def set_state30(self, value): self.state30 = value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_state60(self, value):\n self.state60 = value", "def set_state(self, value):\n self.state = value", "def set_state(self, state: int):", "def get_state30(self):\n return self.state30", "def SetItem3StateValue(self, item, state):\r\n\r\n item.Set3StateValue(state)", "def ...
[ "0.7443766", "0.64535356", "0.63516176", "0.62936455", "0.6208677", "0.6128096", "0.61000913", "0.6035998", "0.59970856", "0.5992949", "0.59686965", "0.5943714", "0.593329", "0.59294325", "0.5920407", "0.5900463", "0.58512354", "0.58252364", "0.5774069", "0.5755571", "0.57299...
0.91143554
0
Set state60 of this flow to a given value
def set_state60(self, value): self.state60 = value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_state30(self, value):\n self.state30 = value", "def get_state60(self):\n return self.state60", "def set_adap60(self, a60):\n self.a60 = a60", "def set_state(self, value):\n self.state = value", "def set_state(self, state):\n self.state = state\n self.config...
[ "0.7089954", "0.669587", "0.65523326", "0.59611404", "0.5760847", "0.5751215", "0.5595722", "0.5524349", "0.55173475", "0.55131865", "0.5510748", "0.550422", "0.5494262", "0.54619616", "0.54615027", "0.5415636", "0.5411988", "0.5411831", "0.53981686", "0.5384987", "0.5374284"...
0.91500723
0
Calculate electron Debye length for electron density in cm^3, electron_temperature in Kelvin
def debye_length_m(electron_density, electron_temperature): return 0.069 * np.sqrt(electron_temperature / electron_density)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def debye_length(eps_0, electron_temperature, electron_density, elementary_charge):\n return np.sqrt(eps_0*electron_temperature/electron_density/abs(elementary_charge))", "def electron_density_per_m3(self):\n return self.electron_density * 1e6", "def calculate_debye(electron_nd=10**32, ion_nd=10**32,...
[ "0.72443056", "0.66933715", "0.6562432", "0.65546685", "0.6275485", "0.62507874", "0.6194163", "0.6155942", "0.61209047", "0.6086372", "0.607388", "0.6071659", "0.6051036", "0.60047543", "0.5934858", "0.58749455", "0.57793105", "0.5762295", "0.57530594", "0.569418", "0.568195...
0.78492785
0
given an array of points a, create a curve through those points. rad is a number between 0 and 1 to steer the distance of control points. edgy is a parameter which controls how "edgy" the curve is, edgy=0 is smoothest.
def get_bezier_curve(a, rad=0.2, edgy=0): p = np.arctan(edgy) / np.pi + .5 a = ccw_sort(a) a = np.append(a, np.atleast_2d(a[0, :]), axis=0) d = np.diff(a, axis=0) ang = np.arctan2(d[:, 1], d[:, 0]) def f(ang): return (ang >= 0) * ang + (ang < 0) * (ang + 2 * np.pi) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bezier_curve(arr):\n t = Symbol('t')\n x1 = 0\n x2 = 0\n y1 = 0\n y2 = 0\n n = len(arr) - 1 # highest degree\n\n for i in range(0, n + 1, 1):\n x1 = x1 + bezier(i, n, t) * arr[i].x * arr[i].wx\n x2 = x2 + bezier(i, n, t) * arr[i].wx\n y1 = y1 + bezier(i, n, t) * arr[i...
[ "0.59907484", "0.564196", "0.5594315", "0.5563189", "0.5500303", "0.54100823", "0.5375897", "0.53486985", "0.53467965", "0.5342222", "0.5337959", "0.52831906", "0.52777493", "0.52609235", "0.5249435", "0.5239993", "0.5203339", "0.5186966", "0.51528555", "0.5101387", "0.509715...
0.6967401
0
Assumes we already have pairs of pos/neg posts. Modifies the n_comments_observed fields to match the given lead_time.
def set_observed_comments(posts, lead_time=10*60*60): pos_posts = [p for p in posts if p['num_hostile'] > 0] neg_posts = [p for p in posts if p['num_hostile'] == 0] pos_posts = sorted(pos_posts, key=lambda p: p['n_comments_observed']) neg_posts = sorted(neg_posts, key=lambda p: p['n_comments_observed'])...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sample_posts_task1(posts, lead_time=10*60*60):\n for p in posts:\n p['n_comments_observed'] = 0\n # for positive posts\n n_comments_obs = []\n positive_posts = [p for p in posts if p['num_hostile'] > 0]\n valid_positive_posts = []\n for p in positive_posts:\n hostile_idx = get_h...
[ "0.6160002", "0.60451794", "0.52119666", "0.51050603", "0.50582945", "0.49317157", "0.48182854", "0.47602895", "0.47291332", "0.46491358", "0.46416318", "0.46113414", "0.46075326", "0.4605577", "0.45908684", "0.45729515", "0.45656192", "0.45615846", "0.45038146", "0.45010072", ...
0.81091535
0
look for 3 or more repetitions of letters and replace with this letter itself only once
def replaceThreeOrMore(word): pattern = re.compile(r"(.)\1{3,}", re.DOTALL) return pattern.sub(r"\1", word)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def replace_multichars(text):\n new = text\n # find series of three or more consecutive chars\n multichars = re.findall(r'((\\w)\\2{3,})', text)\n if multichars:\n for char in multichars:\n # replace them with a sequence of two chars\n new = new....
[ "0.691009", "0.6564344", "0.6317216", "0.62128663", "0.6207211", "0.61061704", "0.6103632", "0.60906416", "0.60702413", "0.60661453", "0.6033034", "0.60239244", "0.6023137", "0.6001431", "0.59998375", "0.5962428", "0.59440416", "0.5907894", "0.58770674", "0.58611435", "0.5823...
0.75572485
0
First 100 dimention is the average of w2v vectors Second 100 dimention is the maximum of w2v vectors
def w2v_aggregation(X, length_vector=100): global w2v_model if w2v_model == None: # lazy load w2v_model = Word2Vec.load(os.path.join(os.environ['NOBULL_PATH'], 'model.w2v')) num_row = len(X) max_matrix = np.zeros(shape=(num_row, length_vector)) average_matrix = np.zeros(shape=(num_row, leng...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_avg_w2v_vector(w2v_dict, text_nlp_proc):\n SIZE = 50 # size of the w2v dimension\n list_of_word_vectors = [w2v_dict[w] for w in text_nlp_proc if w in w2v_dict.vocab.keys()]\n if len(list_of_word_vectors) == 0:\n result = [0.0]*SIZE\n else:\n result = np.sum(list_of_word_vector...
[ "0.6907427", "0.6445794", "0.63725036", "0.62594515", "0.6109773", "0.6092452", "0.6022491", "0.6004772", "0.5986629", "0.5956953", "0.58583695", "0.58123976", "0.58073723", "0.5800133", "0.57228917", "0.5712622", "0.5696706", "0.5688984", "0.566945", "0.561947", "0.5615334",...
0.67351854
1
Previous comments from users on this post. Since this can generate many features, we put a limit on the number of comments per user we consider.
def previous_comment_features(posts, previous_comment_file=os.path.join(os.environ['NOBULL_PATH'], 'user2comment.json'), max_per_user=10): with open(previous_comment_file, "r", encoding="utf8") as f: d = f.readlines()[0] user2previouscomment_map = json.loads(d) X_previous_comments = [] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc_comments(self):\n for comment in self.pull_request.get_comments():\n self._users.add(comment.user.login)\n lowercase_body = comment.body.lower()\n if \"protm\" in lowercase_body:\n self.num_protm += 1\n self.num_comments += 1\n i...
[ "0.59874374", "0.5970528", "0.58169955", "0.56660694", "0.5480376", "0.5466283", "0.5461248", "0.5453661", "0.5445736", "0.54306996", "0.5416275", "0.5405761", "0.5370476", "0.5351578", "0.53384423", "0.5314126", "0.5282044", "0.5265623", "0.5258937", "0.5232992", "0.5222806"...
0.71875936
0
Returns whether the queried particletype operator is supported by this mapping.
def supports_particle_type(self, particle_type: ParticleOp) -> bool: return isinstance(particle_type, SpinOp)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_supported_type(self) -> bool:\n t = self.type.strip()\n return t in self.SUPPORTED_LABELS or t.lower() in self.SUPPORTED_LABELS", "def is_psionic(self) -> bool:\n return ATTRIBUTE.Psionic.value in self.type_data.attributes", "def isOp(self):\n return True", "def is_P(self):...
[ "0.6209507", "0.60236984", "0.58755344", "0.5867701", "0.5861172", "0.5797319", "0.57950944", "0.5729426", "0.5701224", "0.5694179", "0.5689202", "0.5671311", "0.56394696", "0.56170326", "0.56170326", "0.5593421", "0.5587711", "0.55781263", "0.55294603", "0.547905", "0.545724...
0.6716687
0
Maps a `ParticleOp` to a `PauliSumOp` using the Linear spintoqubit mapping.
def map(self, second_q_op: ParticleOp) -> PauliSumOp: # TODO raise NotImplementedError()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_psum_function(fn, in_axes, out_axes, out_dtype):\n\n out_axes = nest.map_structure_up_to(out_dtype, canonicalize_axis_name,\n out_axes)\n\n def psum_fn(*args):\n out = make_pbroadcast_function(fn, in_axes, out_axes, out_dtype)(*args)\n\n def _psum_output(x, out...
[ "0.5450211", "0.5408506", "0.53830457", "0.53718454", "0.5250277", "0.51737875", "0.5158226", "0.51196986", "0.5088218", "0.50587285", "0.500662", "0.4974975", "0.49721375", "0.49000585", "0.4843034", "0.48167402", "0.4804326", "0.47891065", "0.47596222", "0.4744413", "0.4738...
0.7404073
0
Preload the tutorial suit (Flunky)
def loadTutorialSuit(): loader.loadModelNode("phase_3.5/models/char/suitC-mod") loadDialog(1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_fixture(self):\n pass", "def start():\r\n introduction()\r\n score = duck_shooting1()\r\n dogs()\r\n play_again(score)", "def setup_game(self):", "def init_loader(dataset):\n if dataset == 'chaos':\n return ChaosLoader()\n return None", "def startup(self) -> None:"...
[ "0.60946447", "0.59661293", "0.586882", "0.57811826", "0.57065624", "0.56613576", "0.56517327", "0.5650559", "0.56112975", "0.56112874", "0.56049365", "0.560117", "0.55895984", "0.5581026", "0.5566698", "0.5559327", "0.5557797", "0.55274355", "0.5520707", "0.5512453", "0.5512...
0.70180774
0
loadSuits(int) Preload all suit anims and models for given suit level.
def loadSuits(level): loadSuitModelsAndAnims(level, flag = 1) loadDialog(level)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loadSuitModelsAndAnims(level, flag = 0):\n # print \"print loading level %d suits...\" % level\n \n for key in ModelDict.keys():\n # load/unload the models\n # All the mods are in 3.5 now, except the suita and B headsd which are in 4\n model, phase = ModelDict[key]\n headMo...
[ "0.6787545", "0.54215276", "0.52343243", "0.51419127", "0.5059519", "0.50409365", "0.50155747", "0.5002037", "0.4994393", "0.49726716", "0.49407205", "0.49368754", "0.47505206", "0.4712982", "0.47066012", "0.4696753", "0.4692803", "0.46796146", "0.4674333", "0.46536395", "0.4...
0.7335268
0
unloadSuits(int) Unload all suit anims and models for given suit level.
def unloadSuits(level): loadSuitModelsAndAnims(level, flag = 0) unloadDialog(level)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unloadallskills(self):\r\n for skill in skills.skills.copy():\r\n es.unload(\"%s/skills/%s\" % (info.basename, skill))\r\n skills.clearList()", "def loadSuits(level):\n loadSuitModelsAndAnims(level, flag = 1)\n loadDialog(level)", "def loadSuitModelsAndAnims(level, flag = 0):...
[ "0.6161039", "0.5987814", "0.57257533", "0.56408286", "0.54862994", "0.5293753", "0.5286754", "0.52387786", "0.5150738", "0.51081455", "0.5073882", "0.50538075", "0.5025202", "0.4987735", "0.49706188", "0.49633595", "0.49533835", "0.4933578", "0.49008495", "0.48935863", "0.48...
0.8215627
0
Load (flag = 1) or unload (flag = 0) all suit anims and models for given suit level.
def loadSuitModelsAndAnims(level, flag = 0): # print "print loading level %d suits..." % level for key in ModelDict.keys(): # load/unload the models # All the mods are in 3.5 now, except the suita and B headsd which are in 4 model, phase = ModelDict[key] headModel, headPhase...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loadSuits(level):\n loadSuitModelsAndAnims(level, flag = 1)\n loadDialog(level)", "def unloadSuits(level):\n loadSuitModelsAndAnims(level, flag = 0)\n unloadDialog(level)", "def load(self, model):\r\n\r\n self._model = model\r\n\r\n _model = self.tvwRiskMap.get_model()\r\n ...
[ "0.73017895", "0.613394", "0.55944794", "0.55703217", "0.540524", "0.53776044", "0.53333807", "0.53161025", "0.5229305", "0.5229131", "0.51979345", "0.5147233", "0.5124578", "0.5111262", "0.51038367", "0.50625545", "0.5014234", "0.5005247", "0.5002459", "0.50021565", "0.49807...
0.75649977
0
gets a suit head whose scale and vertical pos has been normalized to all the suit heads
def attachSuitHead(node, suitName): suitIndex = SuitDNA.suitHeadTypes.index(suitName) suitDNA = SuitDNA.SuitDNA() suitDNA.newSuit(suitName) suit = Suit() suit.setDNA(suitDNA) headParts = suit.getHeadParts() head = node.attachNewNode('head') for part in headParts: copyPart = part....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generateSuit(self):\n\n dna = self.style\n self.headParts = []\n \n # most heads do not need different poly color or texture\n self.headColor = None\n self.headTexture = None\n\n # For suit death animation\n self.loseActor = None\n\n # Have we beco...
[ "0.6111109", "0.55292815", "0.54055595", "0.52352273", "0.52352273", "0.5136125", "0.5078705", "0.50504553", "0.50421864", "0.50311714", "0.49803075", "0.49763826", "0.49761122", "0.49368015", "0.49249455", "0.49249455", "0.484495", "0.48240063", "0.48054636", "0.48052624", "...
0.59288603
1
Set the appropriate textures for a bosscog battle waiter
def makeWaiter(self, modelRoot=None): # default to setting textures on ourselves if not modelRoot: modelRoot = self # set the clothes textures for a waiter self.isWaiter = 1 torsoTex = loader.loadTexture("phase_3.5/maps/waiter_m_blazer.jpg") torsoTex....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, scale=COIN_SCALE):#, image, scale):\n\n # Call the parent init\n super().__init__()#image, scale)\n self.textures_walk_left = []\n self.textures_walk_right = []\n self.textures_idle_left = []\n self.textures_idle_right = []\n self.textures_attack_...
[ "0.61543006", "0.6088035", "0.6050483", "0.5912068", "0.59103066", "0.588986", "0.58731264", "0.57766855", "0.5762836", "0.57127196", "0.5604394", "0.55957955", "0.55749714", "0.5541386", "0.55375457", "0.552369", "0.55194277", "0.55019945", "0.5497299", "0.5448573", "0.54215...
0.6137091
1