query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Returns the path or URL to the image. Override this to return a URL to the image if it's availble online for easy debugging.
def source_image_link(self, image_id): return self.image_info[image_id]["path"]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_image_url():", "def image_url(self) -> str:\n return pulumi.get(self, \"image_url\")", "def image_url(self) -> str:\n return self._image_url", "def image_url(self):\n return self.photo_url or GENERIC_IMAGE", "def get_image_path(self) -> Optional[str]:\n if not self.image...
[ "0.79277694", "0.7885301", "0.78479683", "0.77009135", "0.75217813", "0.74526876", "0.74526876", "0.74526876", "0.74526876", "0.74526876", "0.74526876", "0.74526876", "0.74526876", "0.74526876", "0.74526876", "0.74526876", "0.74526876", "0.74526876", "0.74526876", "0.74526876",...
0.0
-1
Load the specified image and return a [H,W,3] Numpy array.
def load_image(self, image_id): # Load image image = skimage.io.imread(self.image_info[image_id]['path']) # If grayscale. Convert to RGB for consistency. if image.ndim != 3: image = skimage.color.gray2rgb(image) return image
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load(image_path):\n\tpil_image = Image.open(image_path).convert(\"RGB\")\n\t# convert to BGR format\n\timage = np.array(pil_image)[:, :, [2, 1, 0]]\n\treturn image", "def image_load(path) -> numpy.ndarray:\n # file\n na = numpy.array(Image.open(path))\n # fix shape\n na = numpy.moveaxis(na, [2,0,1], [0,1...
[ "0.72160614", "0.72116804", "0.7164495", "0.7107803", "0.70217615", "0.7021219", "0.69830465", "0.69773704", "0.69746584", "0.69606197", "0.6924236", "0.68568075", "0.68477964", "0.67894596", "0.6728496", "0.67229056", "0.67135066", "0.67135066", "0.67096514", "0.66891384", "...
0.0
-1
Load instance masks for the given image. Different datasets use different ways to store masks. Override this method to load instance masks and return them in the form of am array of binary masks of shape [height, width, instances].
def load_mask(self, image_id): # Override this function to load a mask from your dataset. # Otherwise, it returns an empty mask. mask = np.empty([0, 0, 0]) class_ids = np.empty([0], np.int32) return mask, class_ids
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_mask(self, image_id):\n # If not a vesicle dataset image, delegate to parent class.\n image_info = self.image_info[image_id]\n if image_info[\"source\"] != \"vesicle\":\n return super(self.__class__, self).load_mask(image_id)\n\n # Convert polygons to a bitmap mask o...
[ "0.7870074", "0.7866982", "0.78071177", "0.7536204", "0.7487115", "0.7484187", "0.74017537", "0.7394961", "0.73513556", "0.73370403", "0.7289716", "0.7251488", "0.7209784", "0.7201714", "0.711484", "0.71026736", "0.70940757", "0.6973878", "0.6933921", "0.68129724", "0.6784072...
0.7264167
11
Resizes an image keeping the aspect ratio.
def resize_image(image, min_dim=None, max_dim=None, padding=False): # Default window (y1, x1, y2, x2) and default scale == 1. h, w = image.shape[:2] window = (0, 0, h, w) scale = 1 # Scale? if min_dim: # Scale up but not down scale = max(1, min_dim / min(h, w)) # Does it exc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resize_image(self, width=200):\n self.new_width = width\n aspect_ratio = self.original_height/float(self.original_width)\n self.new_height = int(aspect_ratio * self.new_width)\n\n resized_image = self.image.resize((self.new_width, self.new_height), Image.BILINEAR)\n return re...
[ "0.78305733", "0.75544757", "0.7551901", "0.74321085", "0.7339342", "0.7293609", "0.7288869", "0.72814983", "0.7271826", "0.7263803", "0.7260456", "0.7247438", "0.723056", "0.7190125", "0.71217114", "0.7120838", "0.70937073", "0.7078117", "0.70764786", "0.70764786", "0.706236...
0.0
-1
Resizes a mask using the given scale and padding. Typically, you get the scale and padding from resize_image() to ensure both, the image and the mask, are resized consistently.
def resize_mask(mask, scale, padding): h, w = mask.shape[:2] mask = scipy.ndimage.zoom(mask, zoom=[scale, scale, 1], order=0) mask = np.pad(mask, padding, mode='constant', constant_values=0) return mask
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resize_mask(mask, scale, padding, crop=None):\n # Suppress warning from scipy 0.13.0, the output shape of zoom() is\n # calculated with round() instead of int()\n with warnings.catch_warnings():\n warnings.simplefilter(\"ignore\")\n mask = scipy.ndimage.zoom(mask, zoom=[scale, scale, 1],...
[ "0.7524376", "0.6026159", "0.60111076", "0.5996426", "0.59808886", "0.59013957", "0.58934987", "0.58934987", "0.58655715", "0.5847212", "0.5544648", "0.55316556", "0.551225", "0.55118865", "0.5439356", "0.5435618", "0.5432131", "0.5410762", "0.5406681", "0.5390748", "0.538310...
0.78870475
0
Resize masks to a smaller version to cut memory load. Minimasks can then resized back to image scale using expand_masks() See inspect_data.ipynb notebook for more details.
def minimize_mask(bbox, mask, mini_shape): mini_mask = np.zeros(mini_shape + (mask.shape[-1],), dtype=bool) for i in range(mask.shape[-1]): m = mask[:, :, i] y1, x1, y2, x2 = bbox[i][:4] m = m[y1:y2, x1:x2] if m.size == 0: raise Exception("Invalid bounding box with ar...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _resize_masks(self, results):\n for key in results.get('mask_fields', []):\n if results[key] is None:\n continue\n if self.keep_ratio:\n results[key] = results[key].rescale(results['scale'])\n else:\n results[key] = results[ke...
[ "0.7213053", "0.7213053", "0.68250644", "0.67752737", "0.6732337", "0.6243121", "0.62307966", "0.614132", "0.6139431", "0.60674924", "0.6015982", "0.59839946", "0.59694403", "0.5966443", "0.59607905", "0.5867989", "0.58587825", "0.5798235", "0.57971656", "0.5771635", "0.57663...
0.60931146
9
Resizes mini masks back to image size. Reverses the change of minimize_mask(). See inspect_data.ipynb notebook for more details.
def expand_mask(bbox, mini_mask, image_shape): mask = np.zeros(image_shape[:2] + (mini_mask.shape[-1],), dtype=bool) for i in range(mask.shape[-1]): m = mini_mask[:, :, i] y1, x1, y2, x2 = bbox[i][:4] h = y2 - y1 w = x2 - x1 m = scipy.misc.imresize(m.astype(float), (h, w)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _resize_masks(self, results):\n for key in results.get('mask_fields', []):\n if results[key] is None:\n continue\n if self.keep_ratio:\n results[key] = results[key].rescale(results['scale'])\n else:\n results[key] = results[ke...
[ "0.6822982", "0.6822982", "0.6787279", "0.6767129", "0.67133975", "0.6579304", "0.63982093", "0.6381514", "0.60040766", "0.5954213", "0.5923956", "0.5859644", "0.5809574", "0.57935834", "0.5792019", "0.5772426", "0.5738961", "0.57241225", "0.5691497", "0.567617", "0.56547475"...
0.6448538
6
Converts a mask generated by the neural network into a format similar to it's original shape.
def unmold_mask(mask, bbox, image_shape): threshold = 0.5 y1, x1, y2, x2 = bbox mask = scipy.misc.imresize( mask, (y2 - y1, x2 - x1), interp='bilinear').astype(np.float32) / 255.0 mask = np.where(mask >= threshold, 1, 0).astype(np.uint8) # Put the mask in the right location. full_mask =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _prepare_mask_file(mask):\n result = np.ndarray((mask.shape[0], mask.shape[1]), dtype=np.uint8)\n for i in range(mask.shape[0]):\n for j in range(mask.shape[1]):\n\n if mask[i][j] > 0:\n result[i][j] = 1\n else:\n result[i][j] = 0\n \n ...
[ "0.67363673", "0.6400784", "0.61976534", "0.6169969", "0.61570865", "0.61305314", "0.6119419", "0.60829", "0.60594404", "0.60359824", "0.60315174", "0.59834504", "0.59827155", "0.59746486", "0.59679776", "0.5951048", "0.5945049", "0.5916519", "0.59161335", "0.5915754", "0.590...
0.0
-1
Takes attributes of an image and puts them in one 1D array. Use parse_image_meta() to parse the values back.
def compose_image_meta(image_id, image_shape, window, active_class_ids): meta = np.array( [image_id] + # size=1 list(image_shape) + # size=3 list(window) + # size=4 (x1, y1, x2, y2) in image cooredinates list(active_class_ids) # size=num_classes ) ret...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_image_meta(meta):\n image_id = meta[:, 0]\n image_shape = meta[:, 1:4]\n window = meta[:, 4:8] # (x1, y1, x2, y2) window of image in in pixels\n active_class_ids = meta[:, 8:]\n return image_id, image_shape, window, active_class_ids", "def parse_image_meta_graph(meta):\n image_id = ...
[ "0.6961262", "0.68284833", "0.6680033", "0.6580935", "0.65226597", "0.62724346", "0.6250281", "0.6245831", "0.61829305", "0.61117244", "0.5997438", "0.59963983", "0.5968198", "0.59649026", "0.5886057", "0.58529216", "0.58408123", "0.5830276", "0.58131766", "0.5739667", "0.572...
0.63926053
5
Parses an image info Numpy array to its components. See compose_image_meta() for more details.
def parse_image_meta(meta): image_id = meta[:, 0] image_shape = meta[:, 1:4] window = meta[:, 4:8] # (x1, y1, x2, y2) window of image in in pixels active_class_ids = meta[:, 8:] return image_id, image_shape, window, active_class_ids
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compose_image_meta(image_id, image_shape, window, active_class_ids):\n meta = np.array(\n [image_id] + # size=1\n list(image_shape) + # size=3\n list(window) + # size=4 (x1, y1, x2, y2) in image cooredinates\n list(active_class_ids) # size=num_classes\n ...
[ "0.6748621", "0.6561383", "0.65598667", "0.6534875", "0.6470997", "0.64522445", "0.63780797", "0.63463354", "0.6314436", "0.61476094", "0.6146815", "0.61462486", "0.6036927", "0.5900449", "0.58613026", "0.5849691", "0.5815929", "0.57962304", "0.57669264", "0.57289296", "0.564...
0.7094157
0
Parses a tensor that contains image attributes to its components. See compose_image_meta() for more details.
def parse_image_meta_graph(meta): image_id = meta[:, 0] image_shape = meta[:, 1:4] window = meta[:, 4:8] active_class_ids = meta[:, 8:] return [image_id, image_shape, window, active_class_ids]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_image_meta(meta):\n image_id = meta[:, 0]\n image_shape = meta[:, 1:4]\n window = meta[:, 4:8] # (x1, y1, x2, y2) window of image in in pixels\n active_class_ids = meta[:, 8:]\n return image_id, image_shape, window, active_class_ids", "def parse_image_meta_graph(meta):\n image_id = ...
[ "0.68008", "0.65505403", "0.6446451", "0.6419838", "0.6342747", "0.63355684", "0.6240773", "0.6208174", "0.6024644", "0.59972066", "0.5969638", "0.5958049", "0.59364647", "0.59085655", "0.5898517", "0.5863074", "0.58350563", "0.5811306", "0.57912415", "0.5774868", "0.5693937"...
0.67186666
1
Takes RGB images with 0255 values and subtraces the mean pixel and converts it to float. Expects image colors in RGB order.
def mold_image(images, config): return images.astype(np.float32) - config.MEAN_PIXEL
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def meanrgb(color1,color2):\r\n if check_colormath:\r\n srgb1 = sRGBColor(color1[0],color1[1],color1[2])\r\n srgb2 = sRGBColor(color2[0],color2[1],color2[2])\r\n\r\n lab1 = convert_color (srgb1,LabColor)\r\n lab2 = convert_color (srgb2,LabColor)\r\n lab1tuple = SpectralColor.g...
[ "0.67286867", "0.66740704", "0.664703", "0.6343192", "0.6306639", "0.62411296", "0.62333214", "0.62157416", "0.6175578", "0.61146677", "0.61092275", "0.60219425", "0.60141236", "0.5985964", "0.5982891", "0.59632343", "0.5950518", "0.59443295", "0.59316945", "0.58838046", "0.5...
0.5715338
32
Takes a image normalized with mold() and returns the original.
def unmold_image(normalized_images, config): return (normalized_images + config.MEAN_PIXEL).astype(np.uint8)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reverse_normalize(image):\n\n reverse = transforms.Normalize(mean=[-0.485 / 0.229, -0.456 / 0.224, -0.406 / 0.255],\n std=[1 / 0.229, 1 / 0.224, 1 / 0.255])\n return reverse(image)", "def undo_normalise(img):\n\treturn img + CONFIG.MEAN_PIXEL", "def normalize(image):...
[ "0.7031577", "0.7005976", "0.69107026", "0.6865523", "0.6853419", "0.67566377", "0.67410535", "0.67069924", "0.668433", "0.6668764", "0.66347265", "0.66220355", "0.66216874", "0.65882087", "0.6578069", "0.6530639", "0.65259606", "0.64923507", "0.64899814", "0.6445987", "0.643...
0.6433886
20
Compute bounding boxes from masks.
def extract_bboxes(mask): boxes = np.zeros([mask.shape[-1], 4], dtype=np.int32) for i in range(mask.shape[-1]): m = mask[:, :, i] # Bounding box. horizontal_indicies = np.where(np.any(m, axis=0))[0] vertical_indicies = np.where(np.any(m, axis=1))[0] if horizontal_indicies...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_bboxes(mask):\r\n boxes = np.zeros([mask.shape[-1], 4], dtype=np.int32)\r\n for i in range(mask.shape[-1]):\r\n m = mask[:, :, i]\r\n # Bounding box.\r\n horizontal_indicies = np.where(np.any(m, axis=0))[0]\r\n vertical_indicies = np.where(np.any(m, axis=1))[0]\r\n ...
[ "0.78467315", "0.78130674", "0.77246463", "0.7462639", "0.73268336", "0.7318628", "0.7165459", "0.70358133", "0.7027821", "0.6983254", "0.68408525", "0.6769498", "0.6769209", "0.6680738", "0.66408485", "0.6610212", "0.66068614", "0.6589283", "0.65518355", "0.64983237", "0.649...
0.7821438
1
Calculates IoU of the given box with the array of the given boxes.
def compute_iou(box, boxes, box_area, boxes_area): # Calculate intersection areas x1 = np.maximum(box[0], boxes[:, 0]) x2 = np.minimum(box[2], boxes[:, 2]) y1 = np.maximum(box[1], boxes[:, 1]) y2 = np.minimum(box[3], boxes[:, 3]) intersection = np.maximum(x2 - x1, 0) * np.maximum(y2 - y1, 0) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_iou(box, boxes):\n # Calculate intersection areas\n iou = [box.intersection(b).area / box.union(b).area for b in boxes]\n\n return np.array(iou, dtype=np.float32)", "def compute_iou(box, boxes, box_area, boxes_area):\n # Calculate intersection areas\n y1 = np.maximum(box[0], boxes[:, 0...
[ "0.8233654", "0.8116598", "0.8116598", "0.8116598", "0.80252707", "0.79859704", "0.7928408", "0.77582073", "0.77385104", "0.77119327", "0.7706524", "0.7639222", "0.7638932", "0.7638932", "0.76373506", "0.76087755", "0.76022065", "0.76022065", "0.75603807", "0.7515975", "0.721...
0.8128509
1
Computes IoU overlaps between two sets of boxes.
def compute_overlaps(boxes1, boxes2): # Areas of anchors and GT boxes area1 = (boxes1[:, 2] - boxes1[:, 0]) * (boxes1[:, 3] - boxes1[:, 1]) area2 = (boxes2[:, 2] - boxes2[:, 0]) * (boxes2[:, 3] - boxes2[:, 1]) # Compute overlaps to generate matrix [boxes1 count, boxes2 count] # Each cell contains t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bbox_overlaps(bboxes1, bboxes2, mode='iou'):\n\n from icv.data.core.bbox import BBox\n assert mode in ['iou', 'iof']\n\n bboxes1 = np.array([np.array(b.bbox) if isinstance(b,BBox) else b for b in bboxes1])\n bboxes2 = np.array([np.array(b.bbox) if isinstance(b,BBox) else b for b in bboxes2])\n\n ...
[ "0.7990615", "0.7887685", "0.76905334", "0.76589406", "0.76580244", "0.75641197", "0.75641197", "0.7538061", "0.7536853", "0.75354326", "0.7535125", "0.75168645", "0.74753267", "0.7447682", "0.7441888", "0.74396497", "0.7353138", "0.733241", "0.7319857", "0.7306891", "0.72513...
0.81738555
1
Compute refinement needed to transform box to gt_box. box and gt_box are [N, (x1, y1, x2, y2)] Return [dx, dy, dw, dh]
def box_refinement(box, gt_box): width = box[:, 2] - box[:, 0] height = box[:, 3] - box[:, 1] center_x = box[:, 0] + 0.5 * width center_y = box[:, 1] + 0.5 * height gt_width = gt_box[:, 2] - gt_box[:, 0] gt_height = gt_box[:, 3] - gt_box[:, 1] gt_center_x = gt_box[:, 0] + 0.5 * gt_width ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def box_refinement(box, gt_box):\n box = box.astype(np.float32)\n gt_box = gt_box.astype(np.float32)\n\n height = box[:, 2] - box[:, 0]\n width = box[:, 3] - box[:, 1]\n center_y = box[:, 0] + 0.5 * height\n center_x = box[:, 1] + 0.5 * width\n\n gt_height = gt_box[:, 2] - gt_box[:, 0]\n gt...
[ "0.81049865", "0.7526499", "0.62191415", "0.57420653", "0.5706127", "0.56717247", "0.562894", "0.5558623", "0.55334824", "0.547968", "0.54709405", "0.54709405", "0.5417713", "0.53789407", "0.53714305", "0.53692764", "0.53563386", "0.53544474", "0.5354361", "0.53206414", "0.52...
0.7666296
1
Performs recursive glob with given suffix and rootdir
def recursive_glob(rootdir='.', suffix=''): return [os.path.join(looproot, filename) for looproot, _, filenames in os.walk(rootdir) for filename in filenames if filename.endswith(suffix)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recursive_glob(rootdir=\".\", suffix=\"\"):\n return [\n os.path.join(looproot, filename)\n for looproot, _, filenames in os.walk(rootdir)\n for filename in filenames\n if filename.endswith(suffix)\n ]", "def recursive_glob(rootdir=\".\", suffix=\"\"):\n return [\n ...
[ "0.8374254", "0.8374254", "0.83679426", "0.8002211", "0.7678985", "0.7678985", "0.7495349", "0.69118714", "0.6903835", "0.6895921", "0.6877239", "0.6740461", "0.66994315", "0.6648505", "0.6640057", "0.66142553", "0.66053486", "0.6561372", "0.6561199", "0.6540212", "0.6540034"...
0.84430546
0
Polynomial decay of learning rate
def poly_lr_scheduler(optimizer, init_lr, iter, lr_decay_iter=1, max_iter=89280, power=0.9): curr_lr = init_lr if iter % lr_decay_iter or iter > max_iter: return curr_lr for param_group in optimizer.param_groups: curr_lr = init_lr * (1 - iter / max_iter) ** power param_group['lr'] =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lr_decay(step):\n return(alpha / (1 + decay_rate * step))", "def decay_learning_rate(initial_learning_rate, i, n_iterations):\n return initial_learning_rate * np.exp(-i / n_iterations)", "def learning_rate_decay(alpha, decay_rate, global_step, decay_step):\n epoc_number = int(global_st...
[ "0.7101829", "0.7059696", "0.6914346", "0.6776829", "0.67757654", "0.67602867", "0.67482287", "0.6728288", "0.67137057", "0.67137057", "0.6695183", "0.66131467", "0.65852076", "0.6568543", "0.6567431", "0.65560806", "0.6546024", "0.6538584", "0.65287113", "0.6522781", "0.6497...
0.5925285
62
Alpha Blending utility to overlay RGB masks on RBG images
def alpha_blend(input_image, segmentation_mask, alpha=0.5): blended = np.zeros(input_image.size, dtype=np.float32) blended = input_image * alpha + segmentation_mask * (1 - alpha) return blended
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def overlay_alpha_images(img1, img2, keepalpha=True, dtype=np.float32,\n impl='inplace'):\n rgb1, alpha1 = _prep_rgb_alpha(img1, dtype=dtype)\n rgb2, alpha2 = _prep_rgb_alpha(img2, dtype=dtype)\n\n # Perform the core alpha blending algorithm\n if impl == 'simple':\n rgb3,...
[ "0.7371414", "0.7325981", "0.71847594", "0.6971659", "0.69485855", "0.6942696", "0.67721236", "0.6767017", "0.6754402", "0.67189217", "0.67076755", "0.6691586", "0.6659953", "0.66452473", "0.66056895", "0.6588387", "0.65573066", "0.6542849", "0.64966124", "0.64951885", "0.648...
0.72947514
2
Converts a state dict saved from a dataParallel module to normal module state_dict inplace
def convert_state_dict(state_dict): for k, v in state_dict.items(): name = k[7:] # remove `module.` state_dict[name] = v del state_dict[k] return state_dict
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_state_dict(state_dict):\n if not next(iter(state_dict)).startswith(\"module.\"):\n return state_dict # abort if dict is not a DataParallel model_state\n new_state_dict = OrderedDict()\n for k, v in state_dict.items():\n name = k[7:] # remove `module.`\n new_state_dict[na...
[ "0.7545318", "0.69977325", "0.68029463", "0.679621", "0.67441726", "0.67441726", "0.6543534", "0.65411276", "0.6532188", "0.6524174", "0.65028906", "0.6461215", "0.6432956", "0.6427401", "0.6420491", "0.6416144", "0.6399552", "0.63865715", "0.6375166", "0.63732105", "0.635013...
0.66644204
6
r""" Create a ``pandas`` DataFrame containing all the scalar metrics for each region, such as volume, sphericity, and so on, calculated by ``regionprops_3D``.
def props_to_DataFrame(regionprops): # Parse the regionprops list and pull out all props with scalar values metrics = [] reg = regionprops[0] for item in reg.__dir__(): if not item.startswith('_'): try: if np.shape(getattr(reg, item)) == (): metric...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def regionprops_3D(im):\n results = regionprops(im)\n for i, obj in enumerate(results):\n a = results[i]\n b = RegionPropertiesPS(a.slice,\n a.label,\n a._label_image,\n a._intensity_image,\n ...
[ "0.61048806", "0.5576475", "0.5539143", "0.5508476", "0.53924125", "0.5167129", "0.51590127", "0.5065291", "0.5059763", "0.50290626", "0.5017758", "0.49959457", "0.49956805", "0.4931202", "0.49167672", "0.49122393", "0.48952475", "0.48703", "0.48633456", "0.48622513", "0.4855...
0.69139946
0
r""" Create an image with each region colored according the specified ``prop``, as obtained by ``regionprops_3d``.
def prop_to_image(regionprops, shape, prop): im = np.zeros(shape=shape) for r in regionprops: if prop == 'convex': mask = r.convex_image else: mask = r.image temp = mask * r[prop] s = bbox_to_slices(r.bbox) im[s] += temp return im
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def regionprops_3D(im):\n results = regionprops(im)\n for i, obj in enumerate(results):\n a = results[i]\n b = RegionPropertiesPS(a.slice,\n a.label,\n a._label_image,\n a._intensity_image,\n ...
[ "0.7339298", "0.527748", "0.51560384", "0.50442445", "0.49330938", "0.4932856", "0.4920493", "0.48628363", "0.48619524", "0.48309898", "0.48073664", "0.4803175", "0.478556", "0.47659725", "0.47488394", "0.4733009", "0.47046757", "0.4699467", "0.4686344", "0.4663633", "0.46441...
0.7215293
1
r""" Calculates various metrics for each labeled region in a 3D image. This functions offers a few extras for 3D images that are not provided by the ``regionprops`` function in ``scikitimage``.
def regionprops_3D(im): results = regionprops(im) for i, obj in enumerate(results): a = results[i] b = RegionPropertiesPS(a.slice, a.label, a._label_image, a._intensity_image, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def computerecondensity(d3d, label, leafs=16, PIX=10, IMGMAX=40000):\n points = d3d[:, :2].copy()\n mx, MX = np.min(points[:, 0]), np.max(points[:, 0])\n my, MY = np.min(points[:, 1]), np.max(points[:, 1])\n if mx < 0:\n points[:, 0] += np.abs(mx)\n print(\"Neg pos for {}\".format(label))...
[ "0.5946176", "0.5602765", "0.5601565", "0.5576514", "0.55764306", "0.5502203", "0.54844123", "0.5399035", "0.53916234", "0.53817475", "0.53667015", "0.5359348", "0.5357632", "0.53525645", "0.5342931", "0.53415495", "0.5309446", "0.5309116", "0.5304132", "0.53030264", "0.53002...
0.6498146
0
Sign out of the Plex account. Invalidates the authentication token.
def signout(self): return self.query(self.SIGNOUT, method=self._session.delete)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def sign_out(self) -> None:\n await self._api.call('system', 'sign_out')", "def sign_out(self):\n self.auth.log_out(self._user)\n self._user = None\n print(\"Signed out successfully\")\n return self.logging_page()", "def signout(self):\r\n return self.app.get('/a...
[ "0.75123715", "0.7064994", "0.70515144", "0.70232064", "0.7011089", "0.69937", "0.6984929", "0.6970486", "0.6908781", "0.68257934", "0.6790544", "0.6768565", "0.6752806", "0.6723435", "0.66537195", "0.66537195", "0.6649548", "0.6597267", "0.65866846", "0.65865177", "0.6562242...
0.63746226
42
Load attribute values from Plex XML response.
def _loadData(self, data): self._data = data self._token = logfilter.add_secret(data.attrib.get('authToken')) self._webhooks = [] self.adsConsent = data.attrib.get('adsConsent') self.adsConsentReminderAt = data.attrib.get('adsConsentReminderAt') self.adsConsentSetAt = da...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _load_attr_labels(self, results):\n results[\"attr_labels\"] = results[\"ann_info\"][\"attr_labels\"]\n return results", "def attrs(xml):\r\n return lxml.html.fromstring(xml).attrib", "def _read_attributes(root):\n output_list = []\n for _, value in enumerate(root[0][2]):\n ...
[ "0.5800456", "0.55647063", "0.55204767", "0.5424456", "0.53643525", "0.5363792", "0.533771", "0.53159636", "0.52937496", "0.5270431", "0.5269673", "0.5218576", "0.5201729", "0.519972", "0.5190466", "0.51735586", "0.5143817", "0.5125418", "0.5121331", "0.51174206", "0.5095228"...
0.47688302
55
Returns the authentication token for the account. Alias for ``authToken``.
def authenticationToken(self): return self.authToken
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_auth_token(self):\n\n __logger__.debug(\"Getting auth Token\")\n return self.keystone_client.auth_ref['token']['id']", "def get_auth_token(self):\n return self.do_rpc('get_authorization',\n username=self._username,\n passwo...
[ "0.7686397", "0.750086", "0.74594945", "0.73901206", "0.7239347", "0.72390926", "0.72006875", "0.71328807", "0.70678824", "0.70447904", "0.6959449", "0.69372714", "0.68875", "0.6856795", "0.6856795", "0.6797055", "0.67745656", "0.6751469", "0.67221653", "0.67173845", "0.67052...
0.7754439
0
Perform the actual reload.
def _reload(self, key=None, **kwargs): data = self.query(self.key) self._loadData(data) return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reload(self):\n\n pass", "def reload(self):", "def reload(self):", "def reloadfile(self, ):\n self.loadfile()", "def reload(self) -> None: # pragma: no cover\n raise NotImplementedError()", "def handleReload(self, confInfo=None):", "def reload(self):\n if len(self.files...
[ "0.79878336", "0.7965026", "0.7965026", "0.75626445", "0.75610816", "0.7467132", "0.72578794", "0.7102539", "0.69957817", "0.69768184", "0.6809638", "0.6707322", "0.67069906", "0.66809267", "0.6679244", "0.6670979", "0.6649912", "0.66397303", "0.65475136", "0.6511948", "0.647...
0.6114691
65
Returns dict containing base headers for all requests to the server.
def _headers(self, **kwargs): headers = BASE_HEADERS.copy() if self._token: headers['X-Plex-Token'] = self._token headers.update(kwargs) return headers
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_headers() -> dict:\n\n return {\"Connection\": \"keep-alive\",\n \"Cache-Control\": \"max-age=0\",\n \"Upgrade-Insecure-Requests\": 1,\n \"User-Agent\": (\"Mozilla/5.0 (X11; Linux x86_64)\"\n \" AppleWebKit/537.36 (KHTML, lik...
[ "0.7895725", "0.7845944", "0.7736167", "0.7726137", "0.76696944", "0.7639767", "0.762286", "0.7616582", "0.75192934", "0.7507129", "0.74842584", "0.74347717", "0.73944205", "0.7369718", "0.7330638", "0.7306654", "0.72877294", "0.72658294", "0.72474706", "0.7222104", "0.721495...
0.64396995
88
Share library content with the specified user.
def inviteFriend(self, user, server, sections=None, allowSync=False, allowCameraUpload=False, allowChannels=False, filterMovies=None, filterTelevision=None, filterMusic=None): username = user.username if isinstance(user, MyPlexUser) else user machineId = server.machineIdentifier if ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def share_link(cls, user, link):", "def share_link(cls, user, link):", "def share(self, request):\n try:\n article = self.get_object()\n except PermissionDenied as pd:\n return Response({'error': str(pd)})\n\n article.shared_by.add(request.user)\n return Respon...
[ "0.6599113", "0.6599113", "0.63235986", "0.6182018", "0.6084172", "0.5904037", "0.58363354", "0.5746808", "0.5721394", "0.57110006", "0.5587417", "0.5569068", "0.55491936", "0.54918355", "0.54916894", "0.5437971", "0.5420414", "0.537321", "0.5317244", "0.52955854", "0.528724"...
0.0
-1
Share library content with the specified user.
def createHomeUser(self, user, server, sections=None, allowSync=False, allowCameraUpload=False, allowChannels=False, filterMovies=None, filterTelevision=None, filterMusic=None): machineId = server.machineIdentifier if isinstance(server, PlexServer) else server sectionIds = self._g...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def share_link(cls, user, link):", "def share_link(cls, user, link):", "def share(self, request):\n try:\n article = self.get_object()\n except PermissionDenied as pd:\n return Response({'error': str(pd)})\n\n article.shared_by.add(request.user)\n return Respon...
[ "0.6599113", "0.6599113", "0.63235986", "0.6182018", "0.6084172", "0.5904037", "0.58363354", "0.5746808", "0.5721394", "0.57110006", "0.5587417", "0.5569068", "0.55491936", "0.54918355", "0.54916894", "0.5437971", "0.5420414", "0.537321", "0.5317244", "0.52955854", "0.528724"...
0.45930263
96
Share library content with the specified user.
def createExistingUser(self, user, server, sections=None, allowSync=False, allowCameraUpload=False, allowChannels=False, filterMovies=None, filterTelevision=None, filterMusic=None): headers = {'Content-Type': 'application/json'} # If user already exists, carry over sections an...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def share_link(cls, user, link):", "def share_link(cls, user, link):", "def share(self, request):\n try:\n article = self.get_object()\n except PermissionDenied as pd:\n return Response({'error': str(pd)})\n\n article.shared_by.add(request.user)\n return Respon...
[ "0.65952134", "0.65952134", "0.6320186", "0.61804867", "0.60819525", "0.5900932", "0.58345395", "0.5744589", "0.57219094", "0.57093006", "0.55845", "0.55683166", "0.55466396", "0.5490242", "0.54874593", "0.5435802", "0.54172504", "0.53711885", "0.5317109", "0.52943486", "0.52...
0.0
-1
Remove the specified user from your friends.
def removeFriend(self, user): user = user if isinstance(user, MyPlexUser) else self.user(user) url = self.FRIENDUPDATE.format(userId=user.id) return self.query(url, self._session.delete)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove(self, user):\n self.packet.send_room([\"rp\", user.get_int_id(self.rooms),\n user.data.id], user.room)\n self.rooms[user.room][\"users\"].remove(user)", "def unfriend(self, removee):\n remover_friends_list = self # person terminating the friendship\n ...
[ "0.75750345", "0.73965544", "0.73914206", "0.73895204", "0.7339403", "0.7315023", "0.7260339", "0.7260339", "0.7260339", "0.72601575", "0.71733886", "0.71509176", "0.71423334", "0.7130265", "0.7126609", "0.7122609", "0.7082952", "0.7058855", "0.7057249", "0.7005578", "0.69821...
0.8430593
0
Remove the specified user from your home users.
def removeHomeUser(self, user): user = user if isinstance(user, MyPlexUser) else self.user(user) url = self.HOMEUSER.format(userId=user.id) return self.query(url, self._session.delete)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_user(self):\n User.user_list.remove(self)", "def delete_user(self):\n User.user_list.remove(self)", "def delete_user(self):\n User.user_list.remove(self)", "def delete_user(self):\n\n User.user_list.remove(self)", "def del_user(self, username):\n pass", "def ...
[ "0.79521203", "0.79521203", "0.79521203", "0.77565557", "0.7709008", "0.7574918", "0.7531358", "0.7528389", "0.7528268", "0.74850774", "0.74408567", "0.74374604", "0.74332905", "0.7399435", "0.7395641", "0.7372773", "0.73429793", "0.7327085", "0.7314497", "0.73003787", "0.728...
0.8042959
0
Set a new Plex Home PIN for the account.
def setPin(self, newPin, currentPin=None): url = self.HOMEUSER.format(userId=self.id) params = {'pin': newPin} if currentPin: params['currentPin'] = currentPin return self.query(url, self._session.put, params=params)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_pin(self, pin):\n if pin not in range(0, 14):\n raise Exception(\"Incorrect pin {} selected. Pins available (0 to 13)\".format(pin))\n else:\n self.pin = pin\n self.gpio_pin = mraa.Gpio(pin)", "def setManagedUserPin(self, user, newPin):\n user = user ...
[ "0.6153788", "0.59974384", "0.59864146", "0.59733665", "0.5963043", "0.5556176", "0.54505527", "0.53750056", "0.5373772", "0.5263016", "0.52329767", "0.51979524", "0.5164805", "0.51487035", "0.51427305", "0.5126354", "0.51152235", "0.50755376", "0.50694025", "0.50654536", "0....
0.6447556
0
Remove the Plex Home PIN for the account.
def removePin(self, currentPin): return self.setPin('', currentPin)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def removeManagedUserPin(self, user):\n user = user if isinstance(user, MyPlexUser) else self.user(user)\n url = self.MANAGEDHOMEUSER.format(userId=user.id)\n params = {'removePin': 1}\n return self.query(url, self._session.post, params=params)", "def pin_delete(self, pin_id=None, pat...
[ "0.62562317", "0.58166564", "0.57057697", "0.5650252", "0.56384265", "0.5570742", "0.55672723", "0.5551021", "0.55282533", "0.54866034", "0.54462636", "0.5323598", "0.5253308", "0.5240803", "0.52063316", "0.5173862", "0.5155544", "0.5143557", "0.5123508", "0.5076293", "0.5070...
0.64912397
0
Set a new Plex Home PIN for a managed home user. This must be done from the Plex Home admin account.
def setManagedUserPin(self, user, newPin): user = user if isinstance(user, MyPlexUser) else self.user(user) url = self.MANAGEDHOMEUSER.format(userId=user.id) params = {'pin': newPin} return self.query(url, self._session.post, params=params)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setPin(self, newPin, currentPin=None):\n url = self.HOMEUSER.format(userId=self.id)\n params = {'pin': newPin}\n if currentPin:\n params['currentPin'] = currentPin\n return self.query(url, self._session.put, params=params)", "def home_phone_number(self, home_phone_numbe...
[ "0.65767866", "0.57163674", "0.5661071", "0.5636177", "0.5433339", "0.5433339", "0.5417261", "0.5402434", "0.53720695", "0.53613627", "0.5345811", "0.53364843", "0.52735096", "0.5249116", "0.5218774", "0.5218737", "0.521368", "0.518866", "0.51820076", "0.51588714", "0.5135046...
0.7289205
0
Remove the Plex Home PIN for a managed home user. This must be done from the Plex Home admin account.
def removeManagedUserPin(self, user): user = user if isinstance(user, MyPlexUser) else self.user(user) url = self.MANAGEDHOMEUSER.format(userId=user.id) params = {'removePin': 1} return self.query(url, self._session.post, params=params)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_user(self):\n\n if self.resin.auth.is_logged_in():\n self.wipe_application()\n self.resin.models.key.base_request.request(\n 'user__has__public_key', 'DELETE',\n endpoint=self.resin.settings.get('pine_endpoint'), login=True\n )", "de...
[ "0.65838814", "0.6372025", "0.57685417", "0.57436377", "0.5727263", "0.5636892", "0.55725056", "0.5459822", "0.5396541", "0.5375626", "0.5361395", "0.5360442", "0.5341104", "0.53383434", "0.5330915", "0.5303229", "0.52842", "0.5276797", "0.5263307", "0.5241363", "0.5208179", ...
0.7467859
0
Accept a pending friend invite from the specified user.
def acceptInvite(self, user): invite = user if isinstance(user, MyPlexInvite) else self.pendingInvite(user, includeSent=False) params = { 'friend': int(invite.friend), 'home': int(invite.home), 'server': int(invite.server) } url = MyPlexInvite.REQUESTS...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def request_to_be_friends(self, user_id, target_id):\n if self.database is None:\n raise Exception(\"No database.\")\n if user_id is None or len(user_id) == 0:\n raise Exception(\"Bad parameter.\")\n if target_id is None or len(target_id) == 0:\n raise Exceptio...
[ "0.67236567", "0.66429615", "0.6618216", "0.65635604", "0.6490835", "0.64125884", "0.6369266", "0.63692117", "0.62710553", "0.62471986", "0.62229943", "0.6143231", "0.6126977", "0.6117232", "0.6062572", "0.5978074", "0.5969485", "0.5958703", "0.5903784", "0.5852503", "0.58430...
0.8166146
0
Cancel a pending firend invite for the specified user.
def cancelInvite(self, user): invite = user if isinstance(user, MyPlexInvite) else self.pendingInvite(user, includeReceived=False) params = { 'friend': int(invite.friend), 'home': int(invite.home), 'server': int(invite.server) } url = MyPlexInvite.REQU...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cancel_invite(client, invite_id):\n query_str = \"\"\"mutation CancelInvitePyApi($where: WhereUniqueIdInput!) {\n cancelInvite(where: $where) {id}}\"\"\"\n client.execute(query_str, {'where': {'id': invite_id}}, experimental=True)", "def decline_invitation(self, user, group):\n if gro...
[ "0.68867844", "0.66456467", "0.6042282", "0.6011541", "0.59952796", "0.59848875", "0.58619255", "0.58557665", "0.583979", "0.5766142", "0.5740018", "0.56128234", "0.5551744", "0.5465493", "0.5451587", "0.5449337", "0.5407621", "0.5361635", "0.5342204", "0.5327", "0.531816", ...
0.8217152
0
Update the specified user's share settings.
def updateFriend(self, user, server, sections=None, removeSections=False, allowSync=None, allowCameraUpload=None, allowChannels=None, filterMovies=None, filterTelevision=None, filterMusic=None): # Update friend servers response_filters = '' response_servers = '' user...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_settings(self, user_settings):\n\n self._user_settings = user_settings", "def update_user_profile(IamUserArn=None, SshUsername=None, SshPublicKey=None, AllowSelfManagement=None):\n pass", "def test_set_share(self):\n self.app.post_json(url=\"/config/shares\",\n ...
[ "0.6057774", "0.5706636", "0.5669295", "0.56159735", "0.561211", "0.56015635", "0.558903", "0.558903", "0.5588496", "0.5571494", "0.5562692", "0.55587584", "0.5550408", "0.54994386", "0.54698664", "0.5453962", "0.54416984", "0.5416476", "0.54064447", "0.5392264", "0.53918785"...
0.49392515
56
Converts a list of section objects or names to sectionIds needed for library sharing.
def _getSectionIds(self, server, sections): if not sections: return [] # Get a list of all section ids for looking up each section. allSectionIds = {} machineIdentifier = server.machineIdentifier if isinstance(server, PlexServer) else server url = self.PLEXSERVERS.format(machineI...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def makesection(section):\n s = []\n if section is None:\n return s\n try:\n for i in section.split(':'):\n s.append(int(i))\n except Exception as e:\n msg = 'Not able to convet section to list because %s' % e\n raise SpecError(msg)\n return s", "def multiple...
[ "0.60895807", "0.5815571", "0.5697877", "0.55596393", "0.5502066", "0.5341237", "0.5244695", "0.51733077", "0.51356095", "0.51254946", "0.51153404", "0.509933", "0.5084965", "0.5084539", "0.50487703", "0.503764", "0.50344765", "0.5019604", "0.5013521", "0.49887103", "0.497200...
0.6299416
0
Converts friend filters to a string representation for transport.
def _filterDictToStr(self, filterDict): values = [] for key, vals in filterDict.items(): if key not in ('contentRating', 'label', 'contentRating!', 'label!'): raise BadRequest(f'Unknown filter key: {key}') values.append(f"{key}={'%2C'.join(vals)}") return ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_filter(self) -> str:\n\n return \";;\".join(self.filters)", "def get_current_filters(self) -> str:\r\n return self.__filters_string", "def metadata_filter_as_string(metadata_filter):\n if not isinstance(metadata_filter, dict):\n return metadata_filter\n\n additional = metadat...
[ "0.6735593", "0.6284408", "0.6256892", "0.6255688", "0.61947876", "0.5896819", "0.5744471", "0.56985873", "0.56510377", "0.56335956", "0.5488424", "0.5478061", "0.5414317", "0.54086196", "0.5398841", "0.5337547", "0.5289531", "0.527011", "0.52557015", "0.52546054", "0.5244179...
0.6928889
0
Opt in or out of sharing stuff with plex.
def optOut(self, playback=None, library=None): params = {} if playback is not None: params['optOutPlayback'] = int(playback) if library is not None: params['optOutLibraryStats'] = int(library) url = 'https://plex.tv/api/v2/user/privacy' return self.query(u...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def share():\n return True", "def ensure_share(self, context, share, share_server=None):\n pass", "def test_anon_shared(self):\n self.do_sharable(False, 'pattieblack', None)\n self.do_sharable(False, 'pattieblack', FakeMembership(True))", "def test_update_nas_share_by_pool(self):\n ...
[ "0.600817", "0.5308384", "0.5305331", "0.529965", "0.52739465", "0.52721006", "0.5249059", "0.52317286", "0.5179677", "0.5136471", "0.50039244", "0.49750024", "0.49567035", "0.4930382", "0.49152333", "0.48597014", "0.48186517", "0.48168325", "0.47945505", "0.4780467", "0.4751...
0.0
-1
Adds specified sync item for the client. It's always easier to use methods defined directly in the media
def sync(self, sync_item, client=None, clientId=None): if not client and not clientId: clientId = X_PLEX_IDENTIFIER if not client: for device in self.devices(): if device.clientIdentifier == clientId: client = device break ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_item(self, item):\n self.items.append(item)", "def add(self, item):\n self.contents.append(item)", "def _rc_add(self, mrl: MRL):\n self._rc_send('add %s' % mrl)\n # recache playlist\n self.get_playlist()", "def add(self, item):", "def addItem(*args):", "def addI...
[ "0.6117482", "0.6110298", "0.5960986", "0.57956463", "0.5739922", "0.5739922", "0.5739922", "0.5737603", "0.5732767", "0.56976056", "0.569363", "0.5682642", "0.5682642", "0.5677456", "0.56541353", "0.56399286", "0.56388456", "0.5636837", "0.5572411", "0.55590826", "0.5551299"...
0.67680466
0
Returns a str, a new "claimtoken", which you can use to register your new Plex Server instance to your account.
def claimToken(self): response = self._session.get('https://plex.tv/api/claim/token.json', headers=self._headers(), timeout=TIMEOUT) if response.status_code not in (200, 201, 204): # pragma: no cover codename = codes.get(response.status_code)[0] errtext = response.text.replace('...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate(self):\n return self.rpc.call(MsfRpcMethod.AuthTokenGenerate)['token']", "def _generate_token(self):\n return sha1(\"%s#%s\" % (time(),\n self.app.cfg['sessions/secret'])).hexdigest()", "def get_client_token(**_):\n return str(uuid.uuid4())", "def g...
[ "0.6547049", "0.6526151", "0.64889586", "0.6448134", "0.6368943", "0.62736434", "0.6266498", "0.6266498", "0.6266498", "0.62412906", "0.6131142", "0.61267006", "0.610294", "0.60728693", "0.60686207", "0.60686207", "0.6048715", "0.60401565", "0.60223335", "0.6018202", "0.60128...
0.69568545
0
Get Play History for all library sections on all servers for the owner.
def history(self, maxresults=None, mindate=None): servers = [x for x in self.resources() if x.provides == 'server' and x.owned] hist = [] for server in servers: conn = server.connect() hist.extend(conn.history(maxresults=maxresults, mindate=mindate, accountID=1)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def history(self, maxresults=None, mindate=None):\n server = self._server._server.resource(self._server.name).connect()\n return server.history(maxresults=maxresults, mindate=mindate,\n accountID=self._server.accountID, librarySectionID=self.sectionKey)", "def history(s...
[ "0.6726731", "0.6443011", "0.63816136", "0.6370995", "0.6218271", "0.6188942", "0.6162286", "0.60735977", "0.6002831", "0.59898585", "0.59841716", "0.597373", "0.58652014", "0.58424985", "0.5832161", "0.5830273", "0.5830273", "0.58065355", "0.57905906", "0.57822883", "0.57505...
0.67723
0
Returns True if the item is on the user's watchlist.
def onWatchlist(self, item): return bool(self.userState(item).watchlistedAt)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isPlayed(self, item):\n userState = self.userState(item)\n return bool(userState.viewCount > 0) if userState.viewCount else False", "def is_on_waiting_list(self):\n if self.user is None:\n return False\n if unicode(self.user._id) in self.barcamp.event.waiting_list:\n ...
[ "0.66236967", "0.63791096", "0.6310744", "0.6258938", "0.6136185", "0.6087883", "0.60839623", "0.6078763", "0.6075333", "0.60364056", "0.60264707", "0.6020573", "0.5992435", "0.5992435", "0.5989769", "0.5968984", "0.59473044", "0.5939764", "0.59225345", "0.59178853", "0.59042...
0.8587729
0
Add media items to the user's watchlist
def addToWatchlist(self, items): if not isinstance(items, list): items = [items] for item in items: if self.onWatchlist(item): raise BadRequest(f'"{item.title}" is already on the watchlist') ratingKey = item.guid.rsplit('/', 1)[-1] self.qu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add(self, obj):\n try:\n EditMedia(self.dbstate, self.uistate, [], MediaObject())\n except WindowActiveError:\n pass", "def test_adding_media_to_channel(self):\n videos = [\n make_video(title='test title', media_id='1'),\n make_video(title='tes...
[ "0.57887405", "0.57843083", "0.5721101", "0.56794786", "0.56581503", "0.55463034", "0.55322075", "0.55276906", "0.5501814", "0.54705894", "0.5467799", "0.54159045", "0.5352088", "0.53216416", "0.5313283", "0.5272073", "0.5267057", "0.5243338", "0.5243185", "0.51880914", "0.51...
0.6427449
0
Remove media items from the user's watchlist
def removeFromWatchlist(self, items): if not isinstance(items, list): items = [items] for item in items: if not self.onWatchlist(item): raise BadRequest(f'"{item.title}" is not on the watchlist') ratingKey = item.guid.rsplit('/', 1)[-1] se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_playlists_in(path):\n\n for f in [f for f in os.listdir(path) if f.endswith('.m3u')]:\n os.remove(os.path.join(path, f))", "def remove_songs(self):\n self.stop()\n self.listbox.delete(0, \"end\")\n pygame.mixer.music.stop()", "def clean():\n\n tracks = []\n remov...
[ "0.63080066", "0.63060296", "0.5782847", "0.5777922", "0.5765917", "0.5726394", "0.5680854", "0.5618816", "0.56157017", "0.56094664", "0.55790895", "0.55742043", "0.5554767", "0.5553096", "0.5545259", "0.5540396", "0.553902", "0.5528214", "0.552145", "0.552145", "0.55011266",...
0.6733222
0
Return True if the item is played on Discover.
def isPlayed(self, item): userState = self.userState(item) return bool(userState.viewCount > 0) if userState.viewCount else False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isInPlay(self):\n return self.inPlay", "def still_deciding(self):\n for player in self.players:\n if isinstance(player, user.User):\n if not player.has_played:\n return True\n return False", "def remote(self):\n return self.getItunesA...
[ "0.64082015", "0.62282306", "0.60732615", "0.60227174", "0.59953195", "0.5965395", "0.5949092", "0.59408605", "0.5901996", "0.5901996", "0.589008", "0.5888568", "0.586191", "0.5850891", "0.58479637", "0.5834604", "0.5824554", "0.57929164", "0.57896614", "0.5782654", "0.577901...
0.66849774
0
Mark the Plex object as played on Discover.
def markPlayed(self, item): key = f'{self.METADATA}/actions/scrobble' ratingKey = item.guid.rsplit('/', 1)[-1] params = {'key': ratingKey, 'identifier': 'com.plexapp.plugins.library'} self.query(key, params=params) return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def play(self, play):\n\n self._play = play", "def play(self):\n self.playing = True\n # FIXME?: Why is this not doing anything? Shouldn't it be calling into the player API?", "def play(self):\n pass", "def auto_play(self):\n raise NotImplementedError(self)", "def media...
[ "0.63159823", "0.61746883", "0.612647", "0.60003597", "0.59382504", "0.59382504", "0.5891946", "0.58701247", "0.5831045", "0.58073425", "0.57805103", "0.5739944", "0.5737227", "0.5728036", "0.5714434", "0.5681774", "0.56804883", "0.5662417", "0.5662295", "0.56486785", "0.5601...
0.59489906
4
Mark the Plex object as unplayed on Discover.
def markUnplayed(self, item): key = f'{self.METADATA}/actions/unscrobble' ratingKey = item.guid.rsplit('/', 1)[-1] params = {'key': ratingKey, 'identifier': 'com.plexapp.plugins.library'} self.query(key, params=params) return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mark_missed(self):\n if self.state == TrackState.Tentative:\n self.state = TrackState.Deleted\n elif self.time_since_update > self._max_age:\n self.state = TrackState.Deleted", "def mark_missed(self):\n if self.state == TrackState.Tentative:\n self.state ...
[ "0.62208116", "0.62208116", "0.6142608", "0.61274594", "0.6027523", "0.6001481", "0.5980694", "0.5958849", "0.5876295", "0.58727425", "0.58629274", "0.5835866", "0.5805139", "0.57847947", "0.5730438", "0.5729334", "0.57275385", "0.57192045", "0.57163554", "0.5709806", "0.5708...
0.61438805
2
Search for movies and TV shows in Discover.
def searchDiscover(self, query, limit=30, libtype=None): libtypes = {'movie': 'movies', 'show': 'tv'} libtype = libtypes.get(libtype, 'movies,tv') headers = { 'Accept': 'application/json' } params = { 'query': query, 'limit': limit, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_discover(self):\n response = Tmdb.discover()\n self.assertTrue(int(response.status_code) == 200)\n data = response.json()\n self.assertTrue(isinstance(data['results'], list))\n # TODO check if all the shows are in the good format (can be from_dict/to_dict)", "def test_...
[ "0.66099477", "0.6444534", "0.6350146", "0.614113", "0.60006374", "0.5987889", "0.57967275", "0.5759663", "0.5742494", "0.57225317", "0.5672441", "0.5668492", "0.5656447", "0.563853", "0.5622542", "0.5603253", "0.55852276", "0.5568305", "0.55185664", "0.551498", "0.55053127",...
0.61165285
4
Returns True or False if syncing of watch state and ratings is enabled or disabled, respectively, for the account.
def viewStateSync(self): headers = {'Accept': 'application/json'} data = self.query(self.VIEWSTATESYNC, headers=headers) return data.get('consent')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_enabled(self):\n return self.sdk.is_enabled", "def enabled(self) -> bool:\n return pulumi.get(self, \"enabled\")", "def enabled(self) -> bool:\n return pulumi.get(self, \"enabled\")", "def enabled(self) -> bool:\n return pulumi.get(self, \"enabled\")", "def enabled(self) ...
[ "0.63850796", "0.63297164", "0.63297164", "0.63297164", "0.63297164", "0.63297164", "0.63297164", "0.6259936", "0.61917317", "0.61917317", "0.6178057", "0.61588997", "0.6158067", "0.6104979", "0.6080342", "0.60781157", "0.6064422", "0.6055981", "0.60488766", "0.6034685", "0.6...
0.0
-1
Enable syncing of watch state and ratings for the account.
def enableViewStateSync(self): self._updateViewStateSync(True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _enable_sync(self, enable_sync: bool = True):\n self.__enable_sync = enable_sync", "def enable(self):\r\n self.update(enabled=True)", "def enable(self):\n self.enabled = True", "def enable(self):\n self.enabled = True", "async def enable(self, ctx):\n self.bot.db.exec...
[ "0.6384797", "0.619139", "0.5925894", "0.5925894", "0.5908896", "0.5855856", "0.57448715", "0.57208735", "0.55917585", "0.5506605", "0.54710066", "0.5455361", "0.54332507", "0.53798974", "0.53778887", "0.5356906", "0.53565437", "0.5352764", "0.53484905", "0.533796", "0.533171...
0.5408056
13
Disable syncing of watch state and ratings for the account.
def disableViewStateSync(self): self._updateViewStateSync(False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _disable(self):\n self.enabled = False", "def disable(self):\r\n self.update(enabled=False)", "def disable(self):\n self.enabled = False", "def disable(self):\n self._enabled = False", "def disable(self) -> None:", "def disable(self):\n self.enabled = False\n ...
[ "0.66356087", "0.65761364", "0.65525097", "0.65365714", "0.64032704", "0.63922524", "0.6357641", "0.63338727", "0.6222149", "0.6176749", "0.6166298", "0.6078402", "0.6047089", "0.6025441", "0.60187864", "0.59917814", "0.5938519", "0.5936781", "0.5928062", "0.5916039", "0.5903...
0.5882948
24
Enable or disable syncing of watch state and ratings for the account.
def _updateViewStateSync(self, consent): params = {'consent': consent} self.query(self.VIEWSTATESYNC, method=self._session.put, params=params)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _enable_sync(self, enable_sync: bool = True):\n self.__enable_sync = enable_sync", "def enable(self):\r\n self.update(enabled=True)", "def setAvailable(self):\n \n if self.scanner == False:\n self.syncButton.Disable()\n return\n \n self.printO...
[ "0.6317184", "0.6105547", "0.59594846", "0.5865879", "0.5865879", "0.5733009", "0.5690633", "0.5649012", "0.5621365", "0.55967754", "0.5566257", "0.5553317", "0.5501395", "0.5459027", "0.54556423", "0.54503745", "0.5439479", "0.5430237", "0.5423576", "0.541809", "0.54162437",...
0.0
-1
Link a device to the account using a pin code.
def link(self, pin): headers = { 'Content-Type': 'application/x-www-form-urlencoded', 'X-Plex-Product': 'Plex SSO' } data = {'code': pin} self.query(self.LINK, self._session.put, headers=headers, data=data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connect_device_over_ble(devCtrl, discriminator, pinCode, nodeId=None):\n if nodeId is None:\n nodeId = random.randint(1, 1000000)\n\n try:\n devCtrl.ConnectBLE(int(discriminator), int(pinCode), int(nodeId))\n except exceptions.ChipStackException as ex:\n log.error(\"Connect device...
[ "0.587559", "0.57496667", "0.56169987", "0.5383043", "0.5366147", "0.5315943", "0.5300602", "0.52975434", "0.5265919", "0.5238026", "0.52354", "0.5176752", "0.50742453", "0.5046556", "0.5041817", "0.50167", "0.5006453", "0.49984452", "0.49813223", "0.49634928", "0.4952628", ...
0.69169384
0
Convert a list of media objects to online metadata objects.
def _toOnlineMetadata(self, objs, **kwargs): # TODO: Add proper support for metadata.provider.plex.tv # Temporary workaround to allow reloading and browsing of online media objects server = PlexServer(self.METADATA, self._token, session=self._session) includeUserState = int(bool(kwargs....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _build_adhoc_medias(self, media_list, media_type):\n adhoc_medias = []\n media_id = 0\n for media in media_list:\n media_name = 'adhoc_media_' + media_type + '_' + self.viewport_name + '_' + str(media_id)\n adhoc_media = AdhocMedia()\n adhoc_media.id = medi...
[ "0.6491953", "0.64446926", "0.6356201", "0.6197777", "0.607783", "0.585688", "0.57791615", "0.5754816", "0.5718509", "0.5706103", "0.5706103", "0.5687239", "0.5585416", "0.5576888", "0.55728203", "0.5518264", "0.54846466", "0.54290694", "0.5418062", "0.54137397", "0.540778", ...
0.67632294
0
Returns your public IP address.
def publicIP(self): return self.query('https://plex.tv/:/ip')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_public_ip():\n public_ip = get('https://api.ipify.org').text\n return public_ip", "def obtain_public_ip():\n from urllib2 import urlopen\n my_ip = urlopen('http://ip.42.pl/raw').read()\n logger.debug('The public ip is: %s' % my_ip)\n return str(my_ip)", "def public_ip_address(self) ->...
[ "0.8946197", "0.8722185", "0.86662793", "0.84206116", "0.8289875", "0.8154184", "0.8063084", "0.80188555", "0.7996012", "0.7854233", "0.7819566", "0.78067154", "0.78050697", "0.78050697", "0.7789756", "0.7787629", "0.7754542", "0.77271944", "0.77032906", "0.7692751", "0.76825...
0.8285029
5
Load attribute values from Plex XML response.
def _loadData(self, data): self._data = data self.friend = self._initpath == self.key self.allowCameraUpload = utils.cast(bool, data.attrib.get('allowCameraUpload')) self.allowChannels = utils.cast(bool, data.attrib.get('allowChannels')) self.allowSync = utils.cast(bool, data.att...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _load_attr_labels(self, results):\n results[\"attr_labels\"] = results[\"ann_info\"][\"attr_labels\"]\n return results", "def attrs(xml):\r\n return lxml.html.fromstring(xml).attrib", "def _read_attributes(root):\n output_list = []\n for _, value in enumerate(root[0][2]):\n ...
[ "0.5800456", "0.55647063", "0.55204767", "0.5424456", "0.53643525", "0.5363792", "0.533771", "0.53159636", "0.52937496", "0.5270431", "0.5269673", "0.5218576", "0.5201729", "0.519972", "0.5190466", "0.51735586", "0.5143817", "0.5125418", "0.5121331", "0.51174206", "0.5095228"...
0.47113425
64
Get all Play History for a user in all shared servers.
def history(self, maxresults=None, mindate=None): hist = [] for server in self.servers: hist.extend(server.history(maxresults=maxresults, mindate=mindate)) return hist
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def history(self, maxresults=None, mindate=None):\n servers = [x for x in self.resources() if x.provides == 'server' and x.owned]\n hist = []\n for server in servers:\n conn = server.connect()\n hist.extend(conn.history(maxresults=maxresults, mindate=mindate, accountID=1)...
[ "0.68091244", "0.66874796", "0.65401554", "0.6415962", "0.61404586", "0.60052866", "0.59981656", "0.5929341", "0.5906145", "0.5895015", "0.58845526", "0.58747715", "0.5853269", "0.57827127", "0.5767588", "0.5760741", "0.57576877", "0.57384866", "0.5734536", "0.57342786", "0.5...
0.64243823
3
Load attribute values from Plex XML response.
def _loadData(self, data): self._data = data self.createdAt = utils.toDatetime(data.attrib.get('createdAt')) self.email = data.attrib.get('email') self.friend = utils.cast(bool, data.attrib.get('friend')) self.friendlyName = data.attrib.get('friendlyName') self.home = uti...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _load_attr_labels(self, results):\n results[\"attr_labels\"] = results[\"ann_info\"][\"attr_labels\"]\n return results", "def attrs(xml):\r\n return lxml.html.fromstring(xml).attrib", "def _read_attributes(root):\n output_list = []\n for _, value in enumerate(root[0][2]):\n ...
[ "0.5800456", "0.55647063", "0.55204767", "0.5424456", "0.53643525", "0.5363792", "0.533771", "0.53159636", "0.52937496", "0.5270431", "0.5269673", "0.5218576", "0.5201729", "0.519972", "0.5190466", "0.51735586", "0.5143817", "0.5125418", "0.5121331", "0.51174206", "0.5095228"...
0.5094139
21
Get all Play History for a user for this section in this shared server.
def history(self, maxresults=None, mindate=None): server = self._server._server.resource(self._server.name).connect() return server.history(maxresults=maxresults, mindate=mindate, accountID=self._server.accountID, librarySectionID=self.sectionKey)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_history(user_id):\n return History.where('user_id', user_id).get()", "def get_game_history(self, request):\n return games_ctrl.get_game_history(request.urlsafe_game_key)", "def get_game_history(self, req):\n return models.BattleShip.getByUrlKey(req.url_key).getHistory()", "def histo...
[ "0.6978014", "0.6969228", "0.6638498", "0.65219235", "0.6497225", "0.6410002", "0.6367215", "0.6261751", "0.6252674", "0.62357324", "0.62320465", "0.62255275", "0.619295", "0.6162945", "0.6137662", "0.61277443", "0.6118014", "0.611488", "0.6106509", "0.6078418", "0.6065834", ...
0.59333855
37
Load attribute values from Plex XML response.
def _loadData(self, data): self._data = data self.id = utils.cast(int, data.attrib.get('id')) self.accountID = utils.cast(int, data.attrib.get('accountID')) self.serverId = utils.cast(int, data.attrib.get('serverId')) self.machineIdentifier = data.attrib.get('machineIdentifier') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _load_attr_labels(self, results):\n results[\"attr_labels\"] = results[\"ann_info\"][\"attr_labels\"]\n return results", "def attrs(xml):\r\n return lxml.html.fromstring(xml).attrib", "def _read_attributes(root):\n output_list = []\n for _, value in enumerate(root[0][2]):\n ...
[ "0.5800456", "0.55647063", "0.55204767", "0.5424456", "0.5363792", "0.533771", "0.53159636", "0.52937496", "0.5270431", "0.5269673", "0.5218576", "0.5201729", "0.519972", "0.5190466", "0.51735586", "0.5143817", "0.5125418", "0.5121331", "0.51174206", "0.5095228", "0.5094139",...
0.53643525
4
Get all Play History for a user in this shared server.
def history(self, maxresults=9999999, mindate=None): server = self._server.resource(self.name).connect() return server.history(maxresults=maxresults, mindate=mindate, accountID=self.accountID)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_game_history(self, request):\n return games_ctrl.get_game_history(request.urlsafe_game_key)", "def show_history(user_id):\n return History.where('user_id', user_id).get()", "def get_game_history(self, req):\n return models.BattleShip.getByUrlKey(req.url_key).getHistory()", "def get_u...
[ "0.7164864", "0.70367354", "0.697591", "0.66738105", "0.6545098", "0.65412354", "0.64714295", "0.645157", "0.63795525", "0.6374508", "0.6345612", "0.6320159", "0.6312117", "0.6295848", "0.6290764", "0.6258834", "0.6240537", "0.6216408", "0.6216408", "0.62016493", "0.6195327",...
0.60635304
38
Returns a sorted list of the available connection addresses for this resource. Often times there is more than one address specified for a server or client. Default behavior will prioritize local connections before remote or relay and HTTPS before HTTP.
def preferred_connections( self, ssl=None, locations=None, schemes=None, ): if locations is None: locations = self.DEFAULT_LOCATION_ORDER[:] if schemes is None: schemes = self.DEFAULT_SCHEME_ORDER[:] connections_dict = {location: {sche...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def address(self):\n addrlist = []\n for s in self.srv_socks:\n addrlist.append(s.getsockname())\n return addrlist", "def get_addrs(self):\n # TODO check if server is listening\n return self.multiaddrs", "def local_bind_addresses(self):\n self._check...
[ "0.6279986", "0.6271671", "0.61258954", "0.61187387", "0.6059111", "0.60346603", "0.6029079", "0.60059905", "0.6001909", "0.590609", "0.5869694", "0.5860566", "0.58538294", "0.5840034", "0.5825427", "0.5771936", "0.5766021", "0.5761545", "0.57348853", "0.57348853", "0.5730826...
0.6224647
2
Remove this device from your account.
def delete(self): key = f'https://plex.tv/devices/{self.id}.xml' self._server.query(key, self._server._session.delete)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_device(self, path):\n pass", "def delete_device(self, device: Device) -> None:\n self._devices.pop(device.name, None)", "def delete_account(self):\n Credential.account_list.remove(self)", "def removeDevice(self, node, fullDeviceName):", "def remove(self):\n self._swit...
[ "0.72967273", "0.7080756", "0.69701", "0.6658338", "0.66215354", "0.66188896", "0.65908444", "0.65803075", "0.6559587", "0.65417635", "0.653894", "0.64708894", "0.64443463", "0.6431919", "0.63764185", "0.63704973", "0.6307975", "0.6277124", "0.6243031", "0.624166", "0.6228285...
0.6347724
16
Return the Plex OAuth url for login.
def oauthUrl(self, forwardUrl=None): if not self._oauth: raise BadRequest('Must use "MyPlexPinLogin(oauth=True)" for Plex OAuth login.') headers = self._headers() params = { 'clientID': headers['X-Plex-Client-Identifier'], 'context[device][product]': headers[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_oauth_authentication_url(request_token):\n return _FRIENDFEED_OAUTH_BASE + \"/authenticate?\" + \\\n urllib.urlencode(dict(oauth_token=request_token[\"key\"]))", "def authorize_login_url(self):\n\n return \"{site}{authorize_url}\" \\\n \"?response_type=code&client_id={clien...
[ "0.7395721", "0.7188687", "0.71606964", "0.70837724", "0.70610374", "0.7044484", "0.69741297", "0.68810767", "0.68794423", "0.68794423", "0.6801249", "0.67777795", "0.67777795", "0.67540216", "0.67245376", "0.6701567", "0.66954046", "0.66855377", "0.6673082", "0.66082096", "0...
0.7806607
0
Starts the thread which monitors the PIN login state.
def run(self, callback=None, timeout=None): if self._thread and not self._abort: raise RuntimeError('MyPlexPinLogin thread is already running') if self.expired: raise RuntimeError('MyPlexPinLogin has expired') self._loginTimeout = timeout self._callback = callbac...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start(self):\n self.synchronizer = SyncThread(self.api, self.sync_dir)\n self.synchronizer.start()\n self.tray.on_login()", "def start(self):\n \n self.thread.start()\n self.state = \"running\"", "def on_start(self):\n self.login()", "def on_start(self):\n...
[ "0.6769861", "0.64573824", "0.6383869", "0.6383869", "0.6383869", "0.6383869", "0.63040185", "0.6264163", "0.61168617", "0.6013585", "0.5917714", "0.5874773", "0.5859461", "0.58173347", "0.5816324", "0.5807674", "0.5768907", "0.57597697", "0.5750825", "0.5745972", "0.57169974...
0.6739606
1
Waits for the PIN login to succeed or expire.
def waitForLogin(self): if not self._thread or self._abort: return False self._thread.join() if self.expired or not self.token: return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self, callback=None, timeout=None):\n if self._thread and not self._abort:\n raise RuntimeError('MyPlexPinLogin thread is already running')\n if self.expired:\n raise RuntimeError('MyPlexPinLogin has expired')\n\n self._loginTimeout = timeout\n self._callba...
[ "0.609509", "0.58995926", "0.5862068", "0.58566433", "0.57962024", "0.5782627", "0.5772155", "0.5720976", "0.5663411", "0.56209844", "0.561488", "0.5590879", "0.553974", "0.5501239", "0.54725665", "0.54720837", "0.5464565", "0.54463655", "0.54337454", "0.5412827", "0.5401274"...
0.6863656
0
Stops the thread monitoring the PIN login state.
def stop(self): if not self._thread or self._abort: return self._abort = True self._thread.join()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stop(self):\n self.logger.debug(\"Plugin '{}': stop method called\".format(self.get_fullname()))\n self.scheduler_remove('check_login')\n self.alive = False", "def stop(self, pin):\n raise NotImplementedError", "def stop(self):\n logging.info(\"Shutting down thread...\")\...
[ "0.6752592", "0.670265", "0.6686312", "0.6584747", "0.65507317", "0.6357177", "0.6344688", "0.63398045", "0.63397866", "0.63313115", "0.6329364", "0.6301891", "0.6267454", "0.62612844", "0.62612844", "0.62556785", "0.62515384", "0.6176116", "0.6169899", "0.6156717", "0.615558...
0.60413575
29
Returns `True` if the PIN login has succeeded.
def checkLogin(self): if self._thread: return False try: return self._checkLogin() except Exception: self.expired = True self.finished = True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _login(self):\n if User.login(self.session.teller_id, self.session.teller_pin, 'teller'):\n return True\n else:\n self.session.output({'authentication_failure': 'wrong ID or PIN\\n'}, '[ Login failed ]')\n return False", "def loginCheckSuccess(self, output):\n ...
[ "0.7642515", "0.6633233", "0.6521667", "0.64879984", "0.6425598", "0.6380244", "0.63594204", "0.6307196", "0.6304255", "0.6236454", "0.62317634", "0.6201163", "0.61978865", "0.6186932", "0.61785436", "0.61599934", "0.6153482", "0.6136175", "0.61188054", "0.60983", "0.6069304"...
0.6556538
2
Returns dict containing base headers for all requests for pin login.
def _headers(self, **kwargs): headers = BASE_HEADERS.copy() if self.headers: headers.update(self.headers) headers.update(kwargs) return headers
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_headers(self):\r\n return {\r\n 'authenticate': {\r\n 'username': self.username,\r\n 'apiKey': self.api_key,\r\n }\r\n }", "def _get_headers() -> dict:\n api_key = API_KEY_CRED_LOADER.load_credentials()\n api_secret = API_SECRET_CRED...
[ "0.7109136", "0.70131314", "0.68047005", "0.6781197", "0.6757522", "0.672448", "0.664661", "0.6642876", "0.663626", "0.6593472", "0.6568405", "0.65503937", "0.65458703", "0.6509746", "0.6490855", "0.64824027", "0.6452898", "0.64524347", "0.64098334", "0.6408273", "0.63953894"...
0.0
-1
Connects to the specified cls with url and token. Stores the connection information to results[i] in a threadsafe way.
def _connect(cls, url, token, session, timeout, results, i, job_is_done_event=None): starttime = time.time() try: device = cls(baseurl=url, token=token, session=session, timeout=timeout) runtime = int(time.time() - starttime) results[i] = (url, token, device, runtime) if X_PLEX_E...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _connect(self, query):\n LOGGER.debug('Connecting to ' + self.url)\n return urllib.urlopen(self.url + '?' + query)", "def _connect(self):\n\n try:\n response = requests.post(\n f\"https://{self.hostname}:{self.port}/{self._ENDPOINTS['tokens']}\",\n ...
[ "0.5749226", "0.574414", "0.5564632", "0.55274254", "0.54324937", "0.5359193", "0.52658355", "0.5265485", "0.5254839", "0.5252927", "0.5232325", "0.5229557", "0.52239203", "0.5201088", "0.51740134", "0.51419693", "0.51385665", "0.51365185", "0.513369", "0.512383", "0.51006496...
0.6852977
0
Chooses the first (best) connection from the given _connect results.
def _chooseConnection(ctype, name, results): # At this point we have a list of result tuples containing (url, token, PlexServer, runtime) # or (url, token, None, runtime) in the case a connection could not be established. for url, token, result, runtime in results: okerr = 'OK' if result else 'ERR' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pick_first_connection(self):\n self.best_connection = []\n stations = list(self.grid.stations.values())\n\n # add a first station to the track \n for station in stations:\n self.track = Track(f\"greedy_track_{self.count}\", self.grid)\n self.track.add_station(...
[ "0.65833575", "0.5903044", "0.5626214", "0.54772633", "0.5463953", "0.5455997", "0.53981364", "0.5351905", "0.52869314", "0.52664995", "0.5259322", "0.5254459", "0.524534", "0.5242426", "0.5150927", "0.5150927", "0.51500577", "0.5110211", "0.51032764", "0.50856036", "0.506226...
0.6846864
0
Sets the Online Media Sources option.
def _updateOptOut(self, option): if option not in self.CHOICES: raise NotFound(f'{option} not found in available choices: {self.CHOICES}') url = self._server.OPTOUTS.format(userUUID=self._server.uuid) params = {'key': self.key, 'value': option} self._server.query(url, method=...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _admin_reload_media_sources(self):\n\t\tcur = self.app.blocking_db_con.cursor(cursor_factory=DictCursor)\n\t\tcur.execute(\"\"\"\n\t\t\tselect\n\t\t\t\tsource_name,\n\t\t\t\tsource_id\n\t\t\tfrom\n\t\t\t\tmedia_sources\n\t\t\t\"\"\", ())\n\t\trows = cur.fetchall()\n\t\tself.media_sources = {}\n\t\tfor r in row...
[ "0.5707506", "0.55549663", "0.54426366", "0.53811973", "0.5320573", "0.52618235", "0.5251154", "0.5241726", "0.51960665", "0.5157862", "0.51260084", "0.5041911", "0.50019246", "0.49683335", "0.49638748", "0.49631408", "0.4951615", "0.49303168", "0.49246013", "0.49112085", "0....
0.0
-1
Sets the Online Media Source to "Enabled".
def optIn(self): self._updateOptOut('opt_in')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_enabled(self, bEnabled):\n\t\tcall_sdk_function('PrlShare_SetEnabled', self.handle, bEnabled)", "def toggle_audio_feedback(self, enabled):\r\n self.config.audio_feedback = enabled", "def enable_vmedia(self, set_vmedia_state):\n\n if not isinstance(set_vmedia_state, bool):\n msg...
[ "0.5996727", "0.59891254", "0.59631747", "0.58329463", "0.5826937", "0.5826937", "0.5765493", "0.5743708", "0.5727709", "0.5727709", "0.56918323", "0.5677534", "0.5669758", "0.56507176", "0.56416196", "0.5612018", "0.560825", "0.5562033", "0.5562033", "0.5524705", "0.5524039"...
0.0
-1
Sets the Online Media Source to "Disabled".
def optOut(self): self._updateOptOut('opt_out')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disable_mute(self):\n self.mute = False", "def _disable(self):\n self.enabled = False", "def disable(self):\n self.direction = None # remove direction\n self.state['enabled'] = False # reset states\n self.state['return'] = False\n self.return_path = None # ...
[ "0.6459604", "0.6382627", "0.63219404", "0.631704", "0.6311943", "0.6309455", "0.6153234", "0.61331123", "0.61324054", "0.6036902", "0.6009612", "0.6005163", "0.5957407", "0.594619", "0.59160995", "0.59063905", "0.58791673", "0.58788365", "0.5857699", "0.5845848", "0.5845098"...
0.0
-1
Sets the Online Media Source to "Disabled for Managed Users".
def optOutManaged(self): if self.key == 'tv.plex.provider.music': raise BadRequest(f'{self.key} does not have the option to opt out managed users.') self._updateOptOut('opt_out_managed')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disable_mute(self):\n self.mute = False", "async def disable(self, ctx):\n await self.config.guild(ctx.guild).auto.set(True)\n await ctx.send(_(\"Automatic voicechannel creation disabled.\"))", "def disable_play_store(self):\n return self._disable_play_store", "def disable(ctx...
[ "0.62032115", "0.57203895", "0.5661377", "0.550994", "0.5481648", "0.5461425", "0.5386781", "0.53330046", "0.5321535", "0.52737826", "0.5179086", "0.517798", "0.51469177", "0.5144614", "0.51438916", "0.5143726", "0.51397663", "0.51338977", "0.5125021", "0.51136625", "0.511196...
0.6359012
0
Validate types and values of given parameters.
def validate_parameter_constraints(parameter_constraints, params, caller_name): for param_name, param_val in params.items(): # We allow parameters to not have a constraint so that third party estimators # can inherit from sklearn estimators without having to necessarily use the # validation ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _validate_parameter(value):\n if isinstance(value, (dict)):\n if any([not isinstance(key, string_types) for key in value.keys()]):\n raise TypeError(\"Invalid parameter. Dictionary keys must be strings.\")\n [_validate_parameter(item) for item in value.values()]\n elif isinstance...
[ "0.7676012", "0.7573012", "0.7188623", "0.7077284", "0.7072762", "0.70592767", "0.7002701", "0.7000788", "0.69313437", "0.6871822", "0.682083", "0.6803406", "0.67912877", "0.6762997", "0.67314076", "0.6717166", "0.6713645", "0.67132103", "0.67067224", "0.6690632", "0.6674358"...
0.0
-1
Convert the constraint into the appropriate Constraint object.
def make_constraint(constraint): if isinstance(constraint, str) and constraint == "array-like": return _ArrayLikes() if isinstance(constraint, str) and constraint == "sparse matrix": return _SparseMatrices() if isinstance(constraint, str) and constraint == "random_state": return _Ran...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_constraint(cls, constraint):\n attrs = constraint.deconstruct()[2]\n del attrs['name']\n\n return cls(name=constraint.name,\n constraint_type=type(constraint),\n attrs=attrs)", "def __init__(self, constraint: ConstraintExpr):\n self.constra...
[ "0.71897", "0.62142295", "0.6053933", "0.60538065", "0.59676236", "0.5716293", "0.57077557", "0.5686693", "0.5565292", "0.55383", "0.5535098", "0.54835606", "0.54016894", "0.5269533", "0.52447426", "0.52201873", "0.5187175", "0.51860994", "0.5160573", "0.50934225", "0.5074919...
0.69177777
1
Decorator to validate types and values of functions and methods.
def validate_params(parameter_constraints, *, prefer_skip_nested_validation): def decorator(func): # The dict of parameter constraints is set as an attribute of the function # to make it possible to dynamically introspect the constraints for # automatic testing. setattr(func, "_skl_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_args_validation_with_trait_type_classes(self):\n\n @function(x=Int, y=Int, _returns_=Int)\n def add(x, y):\n return x + y\n\n self.assertEqual(add(8, 2), 10)\n self.failUnlessRaises(TraitError, add, 2, 'xxx')\n\n return", "def test_args_validation_with_trait...
[ "0.70164084", "0.68357754", "0.6835633", "0.6575468", "0.65728724", "0.6535701", "0.64379215", "0.63646305", "0.6354022", "0.63443476", "0.6337048", "0.6296482", "0.6207699", "0.62053293", "0.61754143", "0.61603457", "0.6075107", "0.60638165", "0.60242766", "0.59959877", "0.5...
0.0
-1
Convert type into human readable string.
def _type_name(t): module = t.__module__ qualname = t.__qualname__ if module == "builtins": return qualname elif t == Real: return "float" elif t == Integral: return "int" return f"{module}.{qualname}"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def humanize_type(t: type) -> str:\n if hasattr(t, '__name__'):\n return t.__name__\n else:\n return str(t)", "def typestr(self) -> str:\n return self.type if not self.subtype else f\"{self.type}:{self.subtype}\"", "def __str__(self) -> str:\n return f'{self.type}'", "def __...
[ "0.78686064", "0.7663123", "0.7629725", "0.7625753", "0.7554282", "0.75518215", "0.7538132", "0.75376934", "0.7452931", "0.7447301", "0.7350898", "0.7243856", "0.7159932", "0.7158354", "0.71025497", "0.7044929", "0.70330364", "0.70237786", "0.6987111", "0.6973864", "0.6971573...
0.0
-1
Whether or not a value satisfies the constraint.
def is_satisfied_by(self, val):
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check(self, value: ATTRIBUTE_TYPES) -> bool:\n if self.type == ConstraintTypes.EQUAL:\n return self.value == value\n if self.type == ConstraintTypes.NOT_EQUAL:\n return self.value != value\n if self.type == ConstraintTypes.LESS_THAN:\n return self.value < v...
[ "0.74763227", "0.6885343", "0.68531924", "0.67870015", "0.6675362", "0.6627299", "0.65767336", "0.6570328", "0.6556595", "0.6510018", "0.6480528", "0.6413277", "0.63996035", "0.63865775", "0.6359002", "0.6319024", "0.6311135", "0.62896425", "0.624025", "0.6214113", "0.6212464...
0.5939678
36
A human readable representational string of the constraint.
def __str__(self):
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return \"Constraint(attribute_name={},constraint_type={})\".format(\n self.attribute_name, self.constraint_type\n )", "def __str__(self):\n _str = \"Variables:\\n\"\n for variable in self.variables:\n _str += \" {}\\n\".format(str(variable...
[ "0.78781337", "0.71208286", "0.70465356", "0.703947", "0.6952556", "0.69468546", "0.6793571", "0.6772973", "0.65838945", "0.65038264", "0.6484851", "0.63969684", "0.63585913", "0.6333392", "0.6331096", "0.63259465", "0.6321442", "0.63139385", "0.63076484", "0.6300251", "0.627...
0.0
-1
Add a deprecated mark to an option if needed.
def _mark_if_deprecated(self, option): option_str = f"{option!r}" if option in self.deprecated: option_str = f"{option_str} (deprecated)" return option_str
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_deprecated(self, dest: str, kwargs, print_warning: bool = True) -> None:\n removal_version = kwargs.get(\"removal_version\", None)\n if removal_version is not None:\n warn_or_error(\n removal_version=removal_version,\n entity=f\"option '{dest}' in {...
[ "0.6785955", "0.67780274", "0.670338", "0.66554064", "0.6550236", "0.630168", "0.62527436", "0.6196838", "0.61321324", "0.5973347", "0.59597474", "0.5939626", "0.5933445", "0.58870196", "0.58806485", "0.5876633", "0.58360225", "0.58323735", "0.57920855", "0.57822007", "0.5756...
0.82811135
0
Return a value that does not satisfy the constraint. Raises a NotImplementedError if there exists no invalid value for this constraint. This is only useful for testing purpose.
def generate_invalid_param_val(constraint): if isinstance(constraint, StrOptions): return f"not {' or '.join(constraint.options)}" if isinstance(constraint, MissingValues): return np.array([1, 2, 3]) if isinstance(constraint, _VerboseHelper): return -1 if isinstance(constraint...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_invalid(self):\n raise NotImplementedError(\n \"{} does not have implemented `get_invalid`\".format(self)\n )", "def expected_value(self):\n raise NotImplementedError", "def value_constraint(self):\n return self.fixed if self.fixed is not None else self.default", ...
[ "0.6787097", "0.59891254", "0.5789725", "0.57562804", "0.57388824", "0.5728102", "0.5581413", "0.5576958", "0.5563537", "0.55482495", "0.55482495", "0.5544226", "0.55391884", "0.5537348", "0.55056715", "0.5489122", "0.5475625", "0.5455809", "0.5449025", "0.54423475", "0.54339...
0.5943156
2
Return a value that does satisfy a constraint. This is only useful for testing purpose.
def generate_valid_param(constraint): if isinstance(constraint, _ArrayLikes): return np.array([1, 2, 3]) if isinstance(constraint, _SparseMatrices): return csr_matrix([[0, 1], [1, 0]]) if isinstance(constraint, _RandomStates): return np.random.RandomState(42) if isinstance(con...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def constraint_val(self, input_val_dict):\n\n sess = tf.get_default_session()\n feed_dict = self.create_feed_dict(input_val_dict)\n constrain_val = sess.run(self._constraint_objective, feed_dict)\n return constrain_val", "def constrain(small, value, big):\n return min(max(value, sm...
[ "0.6382416", "0.5974496", "0.59280646", "0.58724886", "0.58334225", "0.5797519", "0.56703", "0.56554455", "0.562912", "0.5609403", "0.5605717", "0.55847156", "0.5582877", "0.5556904", "0.55032855", "0.5494886", "0.5493752", "0.54506004", "0.5405943", "0.53952837", "0.5384186"...
0.57224387
6
Gets new state from current state by appending a valid production rule.
def get_new_states_probs(self, state): if not isinstance(state, states.ProductionRulesState): raise TypeError('Input state shoud be an instance of ' 'states.ProductionRulesState but got %s' % type(state)) production_rules_sequence = state.production_rules_sequence if len(product...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_new_state(state, rules):\n closed_line = f'{state[-1]}{state}{state[0]}'\n listed = list(window(closed_line))\n new_state = ''.join(rules[stride] for stride in listed)\n return new_state", "def append(self, state, symbol, action, destinationstate, production = None):\r\n if actio...
[ "0.63549554", "0.5838318", "0.54414475", "0.5250689", "0.5239543", "0.51818705", "0.5156978", "0.51152897", "0.5046735", "0.4995275", "0.4973245", "0.49462128", "0.49305478", "0.4925647", "0.48603725", "0.4833016", "0.48283416", "0.48274276", "0.4812447", "0.48101223", "0.480...
0.5873246
1
Gets the leading power error. The leading power error is defined as abs(leading power difference at 0) + abs(leading power difference at inf).
def get_leading_power_error(self, state): true_leading_at_0, true_leading_at_inf = ( metrics.evaluate_leading_powers_at_0_inf( expression_string=state.get_expression(), symbol=self._variable_symbol)) return (abs(true_leading_at_0 - self._leading_at_0) + abs(true_lead...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_power(self):\r\n x = self.query('POW?')\r\n if x == None: return None\r\n return float(x)", "def _evaluate(self, state):\n leading_power_error = self.get_leading_power_error(state)\n if np.isfinite(leading_power_error):\n return -float(leading_power_error)\n else:\n ...
[ "0.6223684", "0.61518496", "0.59973663", "0.5993435", "0.5993435", "0.59855384", "0.5983528", "0.5954963", "0.59362435", "0.5730163", "0.5727557", "0.5718702", "0.5718261", "0.56860334", "0.5671874", "0.5665454", "0.5646993", "0.56306994", "0.5620838", "0.56172", "0.55122155"...
0.8443688
0
Evaluates the reward from input state.
def _evaluate(self, state): leading_power_error = self.get_leading_power_error(state) if np.isfinite(leading_power_error): return -float(leading_power_error) else: return self._default_value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reward(self,\n state: float) -> float:\n raise NotImplementedError", "def reward(self):\n if self._state is None:\n return 0\n return self.reward_fn(self._state)", "def compute_reward(self, state, rl_actions, **kwargs):\n raise NotImplementedError", "d...
[ "0.7621711", "0.7283366", "0.723997", "0.7195736", "0.70496047", "0.7015229", "0.6892014", "0.6862567", "0.6732422", "0.6717588", "0.6686326", "0.66363186", "0.6607201", "0.6591858", "0.6576958", "0.6550873", "0.65504766", "0.65438485", "0.65298617", "0.6529115", "0.6520884",...
0.0
-1
Evaluates root mean square error on input_values.
def get_input_values_rmse(self, state): expression_output_values = metrics.evaluate_expression( expression_string=state.get_expression(), grids=self._input_values, symbol=self._variable_symbol) return np.sqrt( np.mean((expression_output_values - self._output_values) ** 2))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def root_mean_square_value( values ):\n return ma.sqrt(mean_square_value( values ))", "def root_mean_squared_error(y_true, y_pred):\n return sm.mean_squared_error(y_true, y_pred)**0.5", "def mean_square_value( values ):\n return sum( [ i**2 for i in values] ) / len( values )", "def normalize(values)...
[ "0.75984704", "0.6791166", "0.6666906", "0.64066774", "0.6400293", "0.63889384", "0.63857275", "0.63857275", "0.6380935", "0.63335484", "0.6311435", "0.6287042", "0.62786514", "0.62751985", "0.62706786", "0.62645537", "0.6241904", "0.6219923", "0.61794436", "0.6169004", "0.61...
0.66182965
3
Evaluates the reward from input state.
def _evaluate(self, state): input_values_rmse = self.get_input_values_rmse(state) if not self._include_leading_powers: if np.isfinite(input_values_rmse): return -input_values_rmse else: return self._default_value # NOTE(leeley): If computing the leading power fails # (timeout...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reward(self,\n state: float) -> float:\n raise NotImplementedError", "def reward(self):\n if self._state is None:\n return 0\n return self.reward_fn(self._state)", "def compute_reward(self, state, rl_actions, **kwargs):\n raise NotImplementedError", "d...
[ "0.7621711", "0.7283366", "0.723997", "0.7195736", "0.70496047", "0.7015229", "0.6892014", "0.6862567", "0.6732422", "0.6717588", "0.6686326", "0.66363186", "0.6607201", "0.6591858", "0.6576958", "0.6550873", "0.65504766", "0.65438485", "0.65298617", "0.6529115", "0.6520884",...
0.0
-1
creates a list of lists with groups of variables that have a pearson correlation bigger than corr_tresh among each other
def corrGroups(df:pd.DataFrame,corr_thresh:float=0.9) -> list: corrMatrix = df.corr().abs() corrMatrix.loc[:,:] = np.tril(corrMatrix, k=-1) corrMatrix = corrMatrix[corrMatrix >= corr_thresh].dropna(how='all').dropna(axis=1,how='all') corrMatrix['corr_groups'] = corrMatrix.apply(lambda x:sum([[x.na...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_correlation(df, vars_to_corr, target_var) :\n\n\n mean = df[target_var].mean()\n sigma = df[target_var].std()\n\n correlation = []\n error = []\n\n for j in vars_to_corr :\n mean_j = df[j].mean()\n sigma_j = df[j].std()\n\n cov = (df[j] - mean_j) * (df[target_var] ...
[ "0.62173957", "0.61023635", "0.5877231", "0.58633095", "0.58384293", "0.5704684", "0.5679107", "0.5643847", "0.56356066", "0.5618148", "0.56030685", "0.5599038", "0.5563642", "0.54343325", "0.5409856", "0.5384402", "0.53606004", "0.5351234", "0.53277904", "0.5318362", "0.5315...
0.67428017
0
Checks the time for advertising Patreon.
async def advertise_patreon(self) -> None: current_ts = await utils.get_timestamp() # Checks whether Patreon advertising event exists if not await self.get_advertising_event(event_label='patreon_ad'): # If not, creates it return await self.insert_advertising_event(event_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_attack(self):\n now = time.time() * 1000\n if self.prev_time is None:\n return True\n else:\n next_time = self.prev_time + self.get_recharge\n if now >= next_time:\n return True\n else:\n return False", "asyn...
[ "0.6274031", "0.6194048", "0.61901665", "0.61806667", "0.60662276", "0.5878633", "0.5875004", "0.5789522", "0.5676808", "0.567079", "0.56519186", "0.56447655", "0.5632327", "0.5620847", "0.558976", "0.55415356", "0.55282754", "0.5484038", "0.54835355", "0.5457494", "0.5435096...
0.6391378
0
(MOD) Makes the bot say something.
async def say(self, ctx): await ctx.message.delete() if len(ctx.message.content.split()) < 2: return await ctx.send('You must inform all parameters!') msg = ctx.message.content.split('!say', 1) await ctx.send(msg[1])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def say(self, ctx, tosay):\n author = ctx.message.author.name\n await ctx.send('_**{}** says:_\\n{}'.format(author, tosay))", "async def say(self, context,message):\n\t\tawait context.send(message)", "async def say(ctx, *, message):\n await ctx.send(message)", "def say(self, message):\...
[ "0.80019903", "0.78615457", "0.78321403", "0.77170765", "0.7698413", "0.76892996", "0.7678451", "0.7672907", "0.75970465", "0.755545", "0.7534433", "0.7517341", "0.74832827", "0.74525476", "0.7438446", "0.7403836", "0.73872346", "0.7371057", "0.7356562", "0.73430604", "0.7311...
0.778015
3
(ADM) Makes the bot send a message to a given channel.
async def spy(self, ctx, cid): await ctx.message.delete() if len(ctx.message.content.split()) < 3: return await ctx.send('You must inform all parameters!') spychannel = self.client.get_channel(int(cid)) msg = ctx.message.content.split(cid) embed = discord.Embed(desc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_message(self, channel, text):\n if not channel:\n return\n self.post('chat.postMessage', data={\"channel\": channel, \"text\": text})", "def send_message(channel, message):\n slack_client = get_client()\n slack_client.chat_postMessage(channel=channel, text=message, as_user...
[ "0.76402104", "0.749071", "0.73553145", "0.7295006", "0.7270505", "0.71178997", "0.71021503", "0.7075964", "0.70192367", "0.69817805", "0.6964009", "0.69105124", "0.6896307", "0.68637484", "0.67248034", "0.6693483", "0.6654537", "0.66520834", "0.66347295", "0.66001886", "0.65...
0.0
-1
(WELCOMER) Welcomes a user.
async def welcome(self, ctx, member: discord.Member = None): await ctx.message.delete() if not member: return await ctx.send('Inform a member!') bots_and_commands_channel = discord.utils.get(ctx.guild.channels, id=bots_and_commands_channel_id) await bots_and_commands_channe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def _welcome(self, ctx, *, users: discord.User = None):\n if not users:\n await ctx.send(f\"Welcome {ctx.author.mention} to {ctx.guild.name}!\")\n else:\n if len(users) > 1:\n users = humanize_list(users)\n else:\...
[ "0.76605815", "0.7478578", "0.7478578", "0.7303595", "0.7270073", "0.7147858", "0.7099021", "0.70733714", "0.70145994", "0.69923526", "0.69684184", "0.6880395", "0.6855196", "0.68179816", "0.67747295", "0.67403346", "0.6739421", "0.6671966", "0.66656846", "0.6622835", "0.6601...
0.61512053
46