query
stringlengths
9
9.05k
document
stringlengths
10
222k
metadata
dict
negatives
listlengths
30
30
negative_scores
listlengths
30
30
document_score
stringlengths
4
10
document_rank
stringclasses
2 values
this function finds the amplitude and time of flight value of the 1st echo peak for a single file the function reads a single file and saves the data into a numpy array all peaks are found using scipy function and peaks appearing after 7.5 microseconds are selected the highest peak (with highest amplitude value) within...
def find_echo(file_name): #define a function data_list = [] #variable for storing data from a single file with open(file_name, 'r') as file: #read the file text = file.read().replace('\n','') items = text.split(',') items_array = np.array(items) #put the data into a numpy a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search_peaks(wavelength, flux, smooth_points=20, lmin=0, lmax=0, fmin=0.5, fmax=3., \n emission_line_file=\"lineas_c89_python.dat\", brightest_line=\"Ha\", cut=1.2, \n check_redshift = 0.0003, only_id_lines=True, plot=True, verbose=True, fig_size=12): \n # Setup wavelength li...
[ "0.66200674", "0.66005325", "0.6426022", "0.6163238", "0.6071056", "0.6058425", "0.60214376", "0.5993446", "0.59683865", "0.59630966", "0.5933588", "0.5910425", "0.5906383", "0.5904459", "0.5872501", "0.586358", "0.5857139", "0.58565015", "0.5853798", "0.58502036", "0.5841275...
0.78489673
0
Returns the translated sentiment values for all the words with their contexts and pos tags.
def translate_and_get_lexicon_sentiment(self, word, context=None, pos_tag=None): #Translate word translated_word = self.translater.translate(word) return self.sentiment_lexicon.get_values(translated_word, context, pos_tag)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_sentiment_scores(self, words):\n sentiment_scores = [0, 0]\n if self.allow_negation:\n negated_words = self.get_negated_words(words)\n else:\n negated_words = [(word.lower(), False) for word in words]\n\n for word, negated in negated_words:\n sig...
[ "0.68504715", "0.6666214", "0.6625289", "0.66209286", "0.6572529", "0.63133645", "0.6265507", "0.62212646", "0.6187039", "0.6158875", "0.61533237", "0.60923123", "0.6089172", "0.6072179", "0.6070961", "0.6065996", "0.6048803", "0.60386324", "0.59955454", "0.5993352", "0.59826...
0.73115903
0
Returns the translated sentiment values for a whole sentence.
def translate_sentence_and_get_lexicon_sentiment(self, sentence): #Translate word translated_sentence = self.translater.translate(sentence) translated_words = tokenizer(translated_sentence) sentiments = [] for word in translated_words: sentiment = self.sentiment_lexic...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sentiment(self) -> Dict[str, float]:", "def sentiment_analyzer_scores(sentence):\n score = get_sentiment_analyzer().polarity_scores(sentence)\n return 'Negative Score:', score['neg'], 'Neutral Score:', score['neu'], 'Positive Score:', score['pos'], 'Compound Score:', score['compound']", "def ...
[ "0.7307806", "0.72817993", "0.7175709", "0.71659714", "0.709465", "0.7094247", "0.6806409", "0.67347574", "0.6727833", "0.6727808", "0.67207444", "0.6687828", "0.6671193", "0.66231006", "0.6622882", "0.6618032", "0.6604835", "0.6603233", "0.6591723", "0.65365314", "0.6525918"...
0.7890226
0
Translate word using a translation API Perform sentence contezt translation on google web interface Perform word translation using Bing > get all alternatives anc check for a mathc in the google translation, if match choose it as translation if not then choose the bing translation that best matches using POS tag?
def translate(self, word, context=None, pos_tag=None): #Get contextual translation from google translate par = {"text": word, "raw": "raw"} r = requests.post(self.translation_url, data=par) results = r.text translated_word = get_from_html_text(results, 'TRANSLATED_TEXT') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def translate(sentence,target,api_key):\n #translate without using googletrans wrapper library\n URL = \"https://translation.googleapis.com/language/translate/v2?target=\"+target+\"&key=\"+api_key+\"&q=\"+sentence\n # sending get request and saving the response as response object \n r = requests.get(ur...
[ "0.6986141", "0.6904215", "0.6843515", "0.6752809", "0.64012456", "0.6333222", "0.6329238", "0.6315034", "0.62366", "0.6233318", "0.62277544", "0.6095749", "0.60782915", "0.6024761", "0.59746957", "0.59732395", "0.59434617", "0.59395015", "0.5909767", "0.5909218", "0.58783525...
0.7218373
0
Gets the value of a variable target from a html result set from a request.
def get_from_html_text(resultset, target): index = resultset.find(target)+len(target)+2 return resultset[index:index+140].split("'")[0].lower()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(self, target):\r\n return self.by_target.get(target)", "def get(self, target):\n return self.by_target.get(target)", "def get_html_soup(url_target, getter=1):\n if getter == 1:\n response = requests.get(url_target) # getter == 1\n status_code = response.status_code\n ...
[ "0.57343566", "0.5663029", "0.55805874", "0.55505645", "0.5496153", "0.53344357", "0.53299534", "0.5259097", "0.5129525", "0.51027006", "0.508095", "0.5023708", "0.49656013", "0.49633348", "0.49592254", "0.49385184", "0.49220452", "0.491933", "0.49182317", "0.4908452", "0.489...
0.6283419
0
Performs sentiment lexicon lookup on the tweets, and stores it in the objects.
def perform_bing_sentiment_lexicon_lookup(tweets): words = [] for t in tweets: for phrase in t.tagged_words: for word in phrase: try: if word["pos"] in TYPECRAFT_SENTIWORDNET: words.append(word['word']) except KeyErr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def performLexiconBasedSentimentAnalysis(data):\n opinions = data[0]\n taggedTweets = data[3]\n sentiments_mapping = lexiconBasedSentimentPrediction(\n taggedTweets) # identify the sentiment orientation of each tweet\n for key in sentiments_mapping:\n opinions[key].setSO(sentiments_mappi...
[ "0.7370526", "0.7097738", "0.7006562", "0.64456165", "0.6340128", "0.632244", "0.62891626", "0.62751544", "0.6197534", "0.6173351", "0.6125865", "0.61037207", "0.6070336", "0.6038822", "0.60357237", "0.59641814", "0.59597814", "0.5957132", "0.5880301", "0.5852879", "0.5848566...
0.7590928
0
Check if an object is an instance of an LCM type LCM offers no official way to do this, so test for a uniquelynamed method that is present in all LCM types
def is_lcm_message(obj): return '_get_packed_fingerprint' in dir(obj)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _is_run_type(cls, object_):\n # Do a string comparison instead of using isinstance() to avoid needing\n # to import lyse or other modules with these classes.\n return (type(object_).__name__ in cls._RUN_TYPES)", "def ismethod(object):\r\n return isinstance(object, types.MethodType)", ...
[ "0.6263648", "0.6260741", "0.6150388", "0.61354274", "0.6122315", "0.6088962", "0.608534", "0.60252255", "0.5998673", "0.59864396", "0.5965467", "0.5942482", "0.5938364", "0.59350634", "0.59340364", "0.59338605", "0.5924914", "0.59236515", "0.5888551", "0.58781093", "0.587558...
0.6780831
0
Prettyprints an LCM message to the console
def print_lcm_msg(msg, indent='', indent_increment=' '): print indent + msg.__module__ + ":" for slot in msg.__slots__: value = msg.__getattribute__(slot) if is_lcm_message(value): print indent + indent_increment + slot + ":" print_lcm_msg(value, indent + indent_incremen...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cprint(msg):\n pad = \"[-] \"\n print(pad + str(msg).replace(\"\\n\", \"\\n\" + pad))\n return msg", "def printer(message):\n if VERBOSITY:\n pprint(message)", "def print_message_nicely(message):\n print (\"\\n\\r\" + \"*\"*10 + \"\\n\" +\n \"\\rsender: \" + message[\"handl...
[ "0.7287007", "0.6827435", "0.6797373", "0.6790969", "0.67620224", "0.6643699", "0.66269726", "0.65355426", "0.65249914", "0.6467794", "0.646457", "0.6431178", "0.6431178", "0.6369951", "0.63578594", "0.6329203", "0.6326617", "0.62906", "0.6278557", "0.6251733", "0.6251249", ...
0.6886246
1
Returns users, who liked a given object.
def get_users_who_liked_object(*, obj: 'Model'): ct = ContentType.objects.get_for_model(obj) return ( User.objects .filter( likes__content_type=ct, likes__object_id=obj.pk ) )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_likes(obj):\n\t\tobj_type = ContentType.objects.get_for_model(obj)\n\t\treturn User.objects.filter(\n\t\t\tlikes_content_type=obj_type, likes_object_id=obj.id)", "def is_liked(obj, user) ->bool:\n\tif not user.is_authenticated:\n\t\treturn False\n\tobj_type = ContentType.objects.get_for_model(obj):\n...
[ "0.8247232", "0.720357", "0.7153659", "0.681568", "0.6613768", "0.6489929", "0.6452891", "0.6435902", "0.6430172", "0.6430172", "0.63929987", "0.636934", "0.62987703", "0.6246074", "0.61242574", "0.6083556", "0.5996237", "0.5906942", "0.58720946", "0.5790374", "0.5737628", ...
0.8285318
0
Returns the square around the face that should be used to crop the image.
def get_face_square(left, top, width, height, scale_factor): right = left+width bottom = top+height center_x = (left + right)/2 center_y = (top + bottom)/2 # Make the size of the square slightly bigger than in the ROI data square_len = scale_factor*max(width, height) half_len = square_len/2 new_left...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def crop_face(image,face_rect):\n (x1,y1,x2,y2) = face_rect\n w = abs(x2-x1)\n h = abs(y2-y1)\n return image[y1:y1 + h, x1:x1 + w]", "def crop_to_face(self):\n original = self.images['original']\n original.generate_borders(sigma=self.sigma)\n contours, hierarchy = cv2.findContour...
[ "0.72177374", "0.7009307", "0.6926336", "0.6809622", "0.67875606", "0.67350036", "0.6533129", "0.63569933", "0.63155836", "0.6263536", "0.611405", "0.61107206", "0.60713816", "0.6069404", "0.6049981", "0.60460263", "0.6037573", "0.6032958", "0.6027628", "0.6027092", "0.600383...
0.74686927
1
Computes all the facial landmarks of every frame in the given dataset.
def extract_all_face_landmarks(x_data, verbose=True): # Initialize dlib's face detector and create the facial landmark predictor detector = dlib.get_frontal_face_detector() predictor = dlib.shape_predictor(face_predictor_path) x_int = np.uint8(np.multiply(x_data, 256)) face_landmarks = [] for i, frame i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_landmarks(self, image): # from https://www.paulvangent.com/2016/08/05/emotion-recognition-using-facial-landmarks/\n # Ask the detector to find the bounding boxes of each face. The 1 in the\n # second argument indicates that we should upsample the image 1 time. This\n # will make everyt...
[ "0.68958193", "0.6811556", "0.65402263", "0.62786025", "0.62488014", "0.5944426", "0.582426", "0.5742848", "0.57209975", "0.5669684", "0.56630284", "0.55835474", "0.5580708", "0.5578325", "0.5563141", "0.5562418", "0.5529663", "0.55235064", "0.55135304", "0.54990023", "0.5486...
0.7537693
0
Normalize facial landmarks by subtracting the coordinates corresponding to the nose, and dividing by the standard deviation.
def normalize_face_landmarks(face_landmarks): face_landmarks_norm = np.zeros(face_landmarks.shape) for (i, lm) in enumerate(face_landmarks): face_landmarks_norm[i] = lm - lm[nose_center_idx] std_x = np.std(face_landmarks_norm[:,:,0].reshape((-1,))) std_y = np.std(face_landmarks_norm[:,:,1].reshape((-...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _normalize_pose_landmarks(self, landmarks):\n landmarks = np.copy(landmarks)\n\n # Normalize translation.\n pose_center = self._get_pose_center(landmarks)\n landmarks -= pose_center\n\n # Normalize scale.\n pose_size = self._get_pose_size(landmarks, self._torso_size_multiplier)\n landmarks...
[ "0.6602699", "0.65047765", "0.6116476", "0.61153936", "0.6102175", "0.60887134", "0.60887134", "0.6056694", "0.60432005", "0.5998011", "0.59603065", "0.593292", "0.5928172", "0.59173787", "0.5916784", "0.5911816", "0.59103507", "0.5895818", "0.58719146", "0.5857495", "0.58330...
0.75986326
0
Returns the weigths of first convolutional layer of VGGFace (conv_1_1).
def get_conv_1_1_weights(vgg_weights_path): temp_mod = Sequential() temp_mod.add(ZeroPadding2D((1,1),input_shape=(224, 224, 3))) temp_mod.add(Convolution2D(64, (3, 3), activation='relu', name='conv1_1')) temp_mod.load_weights(vgg_weights_path, by_name=True) conv1_1_weigths = temp_mod.get_layer('conv1_1').get_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_conv_weight(model):\n layer_name = 'conv2d_1'\n weights = model.get_layer(layer_name).get_weights()\n # weights[0] --- kernel weights\n # weights[1] --- kernel biases\n weights = np.asarray(weights[0])\n mean_weights = np.mean(weights, axis=0)\n mean_weights = np.reshape(mean_weights,...
[ "0.6880836", "0.6446795", "0.62245876", "0.5830352", "0.5720533", "0.5716584", "0.5664135", "0.5607025", "0.55970496", "0.55764055", "0.55692154", "0.55586255", "0.5547205", "0.55052", "0.5478627", "0.54659724", "0.5452994", "0.54324937", "0.54227585", "0.5411283", "0.5410625...
0.67051077
1
Creates the bottom part of the VGG16 TCNN.
def create_tcnn_bottom(vgg_weights_path, conv1_1_weigths): # Create inputs for the 5 frames input_shape=(224, 224, 3) frame1 = Input(shape=input_shape) frame2 = Input(shape=input_shape) frame3 = Input(shape=input_shape) frame4 = Input(shape=input_shape) frame5 = Input(shape=input_shape) # Convolution...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, dropout_rate, num_classes, include_top, layer):\r\n super(VGG16_Rand, self).__init__()\r\n print(\"CIFAR VGG16_Rand is used\")\r\n self.dropout_rate = dropout_rate\r\n self.num_classes = num_classes\r\n self.include_top = include_top\r\n self.layer = lay...
[ "0.5968993", "0.56978863", "0.56633925", "0.5567755", "0.55488694", "0.5446765", "0.5427923", "0.540701", "0.5383784", "0.53762066", "0.5356811", "0.5353515", "0.53460944", "0.5335096", "0.5333714", "0.532977", "0.52963775", "0.52963775", "0.52963775", "0.52963775", "0.529637...
0.6574418
0
Returns the weights of first convolutional layer of Squeezenet (conv_1).
def get_conv1_weights(squeezenet_weights_path): temp_mod = Sequential() temp_mod.add(Convolution2D(64, (3, 3), strides=(2, 2), padding='valid', name='conv1',input_shape=(227, 227, 3))) temp_mod.load_weights(squeezenet_weights_path, by_name=True) conv1_weights = temp_mod.get_layer('conv1').get_weights() return...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_conv_1_1_weights(vgg_weights_path):\r\n\ttemp_mod = Sequential()\r\n\ttemp_mod.add(ZeroPadding2D((1,1),input_shape=(224, 224, 3)))\r\n\ttemp_mod.add(Convolution2D(64, (3, 3), activation='relu', name='conv1_1'))\r\n\ttemp_mod.load_weights(vgg_weights_path, by_name=True)\r\n\tconv1_1_weigths = temp_mod.get_l...
[ "0.7159616", "0.69370097", "0.6645317", "0.65789485", "0.6442945", "0.6359862", "0.62819415", "0.6241098", "0.60584974", "0.6036052", "0.60115564", "0.5948799", "0.5866618", "0.5844523", "0.5834057", "0.5822089", "0.5785645", "0.5778168", "0.57660186", "0.5759582", "0.5747462...
0.8248324
0
Creates the bottom part of the Squeezenet TCNN.
def create_squeezenet_tcnn_bottom(squeezenet_weights_path, conv1_weights): # Create inputs for the 5 frames input_shape=(227, 227, 3) frame1 = Input(shape=input_shape, name='frame1') frame2 = Input(shape=input_shape, name='frame2') frame3 = Input(shape=input_shape, name='frame3') frame4 = Input(shape=input_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_bottom_text( self ):\n return None", "def generate_bottonDown(self):\n posx = self.posx + self.sizex - 2*self.sizebotx \n posy = self.posy + self.sizeboty \n return Boton(posx, posy, self.sizebotx, self.sizeboty, color=(124, 117, 221), color_h=(95, 90, 173), text_color=(0,0,0), press_...
[ "0.63507015", "0.59306735", "0.5717315", "0.5440764", "0.53798467", "0.5355761", "0.5258913", "0.5254765", "0.5169415", "0.5166382", "0.5158588", "0.5157795", "0.5141224", "0.51341766", "0.5103933", "0.5094972", "0.5058972", "0.5031355", "0.5001635", "0.4997176", "0.49896222"...
0.59352773
1
Return a list of requested prefixes using show_available, show_assigned filters. If available prefixes are requested, create fake Prefix objects for all unallocated space within a prefix.
def add_requested_prefixes(parent, prefix_list, show_available=True, show_assigned=True): child_prefixes = [] # Add available prefixes to the table if requested if prefix_list and show_available: # Find all unallocated space, add fake Prefix objects to child_prefixes. available_prefixes = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def process_prefix_list(\n guild: disnake.Guild,\n ctx: commands.Context = None,\n inter: AppCmdInter = None,\n allowed_mentions=None,\n):\n await create_guild_model(guild)\n guild = await Guild.get(guild.id)\n msg = f\"The following are the custom prefixes for {guild.name}:\\n\" + \", \...
[ "0.6399383", "0.63046", "0.6170257", "0.5926491", "0.5869022", "0.5695361", "0.5662833", "0.5521842", "0.548111", "0.5407241", "0.5374166", "0.5343678", "0.534079", "0.53343534", "0.53314716", "0.53045994", "0.5295335", "0.5289362", "0.5285895", "0.526447", "0.52554023", "0...
0.70916575
0
Annotate ranges of available IP addresses within a given prefix. If is_pool is True, the first and last IP will be considered usable (regardless of mask length).
def add_available_ipaddresses(prefix, ipaddress_list, is_pool=False): output = [] prev_ip = None # Ignore the network and broadcast addresses for non-pool IPv4 prefixes larger than /31. if prefix.version == 4 and prefix.prefixlen < 31 and not is_pool: first_ip_in_prefix = netaddr.IPAddress(pre...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ranges_conflicting_with_ip(ip_address, ip_ranges):\n return [(pool_name, ip_range) for (pool_name, ip_range) in ip_ranges\n if ip_address in ip_range]", "def create_ip_range(start_ip, end_ip):\n start = list(map(int, start_ip.split(\".\")))\n end = list(map(int, end_ip.split(\".\")))\n ...
[ "0.58543676", "0.58250356", "0.58245134", "0.58117574", "0.57345814", "0.57162213", "0.5665362", "0.56327623", "0.558843", "0.55872387", "0.5563175", "0.5519707", "0.54998046", "0.5456351", "0.545237", "0.54522675", "0.5451424", "0.5421326", "0.53966886", "0.53661", "0.532450...
0.766256
0
Rebuild the prefix hierarchy for all prefixes in the specified VRF (or global table).
def rebuild_prefixes(vrf): def contains(parent, child): return child in parent and child != parent def push_to_stack(prefix): # Increment child count on parent nodes for n in stack: n['children'] += 1 stack.append({ 'pk': [prefix['pk']], 'pref...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rearrange_cache_entries(current_prefix_len, new_prefix_len):\n print('Changing prefix length from', current_prefix_len,\n 'to', new_prefix_len)\n dirs = set()\n old_dirs = set()\n for file in glob.iglob(os.path.join('*', '*')):\n name = os.path.basename(file)\n dname = name[:...
[ "0.54053587", "0.53027314", "0.52030253", "0.5106114", "0.50747126", "0.5043651", "0.4985723", "0.4947775", "0.4925906", "0.48888353", "0.4878372", "0.4869921", "0.48516843", "0.48315048", "0.4809264", "0.48077404", "0.48029897", "0.4782021", "0.47673312", "0.4753303", "0.474...
0.80801743
0
This is to view product delete form
def delete_product(request, id): return render(request, "core/delete_product.html", { "object": Product.objects.get(id=id) })
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_product_view(request, id):\n Product.objects.get(id=id).delete()\n messages.success(request, \"Product deleted successfully.\")\n return redirect(\"products\")", "def deleteProduct(request,productId):\n deleteObj = Collection()\n deleteObj.id=productId\n productBll.deleteProducts(del...
[ "0.7487364", "0.7397607", "0.7221808", "0.6863954", "0.67881876", "0.6786731", "0.67212814", "0.6651951", "0.6651476", "0.6647984", "0.66293097", "0.660778", "0.65132225", "0.64691967", "0.6385923", "0.6357522", "0.6351545", "0.6340416", "0.63318235", "0.63097644", "0.6291429...
0.7627813
0
This is to view the list of categories
def category(request): return render(request, "core/category_list.html", { "category_list": Category.objects.all() })
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def showCategories():\n categories = session.query(Category).order_by(asc(Category.name))\n return render_template('categories.html', categories=categories)", "def list_categories(self):\n raise NotImplementedError()", "def show_categories():\n categories = session.query(Category).all()\n us...
[ "0.80051666", "0.79159254", "0.7752717", "0.7750971", "0.76418835", "0.76375914", "0.7610273", "0.75556064", "0.755282", "0.7549924", "0.75438476", "0.7432941", "0.7410804", "0.739726", "0.7395967", "0.7365315", "0.7288782", "0.7210047", "0.71686643", "0.7116042", "0.7044596"...
0.80612344
0
Get user details from users_file_name. Create users if they doesn't exist.
def create_users (users_file_name = 'lookup.csv'): users_file = open (users_file_name, 'r') for line in users_file: # user_fields = line.split () user_data_list = parse_user_info_list (line.split (',')) print user_data_list create_user (*user_data_list) users_file.close () ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_users():\n with open(user_path, \"r\") as infile:\n return json.load(infile)", "def read_all():\n with open(User.get_users_path(), encoding='utf8') as file:\n for line in file:\n username, pw_hash, email, name, level = line.strip().split(';')\n le...
[ "0.699987", "0.69790393", "0.69175494", "0.6900895", "0.68127024", "0.6811369", "0.6792603", "0.6771309", "0.66632086", "0.6585641", "0.6580552", "0.6541284", "0.65301734", "0.65133303", "0.6512585", "0.64926314", "0.6443598", "0.6434975", "0.63844013", "0.6333751", "0.631454...
0.77924067
0
Return True if the given distro is a debian.
def is_debian(distro): name = distro.lower() return name in debain
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_redhat(distro):\n name = distro.lower()\n return name in red_hat", "def supports_distro(self, distro_name):\n return bool(self._distro_pattern.search(distro_name))", "def osname_is_freebsd():\n return (\"FreeBSD\" == g_osname)", "def detect_distro(filename):\n if '.rpm' in filename:\n...
[ "0.67452145", "0.6453918", "0.6391131", "0.6335153", "0.63076335", "0.5892454", "0.58448195", "0.5832097", "0.5819791", "0.5791924", "0.57578975", "0.57451683", "0.5743173", "0.57380146", "0.5724344", "0.56947124", "0.563053", "0.56243736", "0.5565944", "0.55651695", "0.55026...
0.8746229
0
Return True if the given distro is a redhat linux.
def is_redhat(distro): name = distro.lower() return name in red_hat
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def osname_is_linux():\n return (\"Linux\" == g_osname)", "def is_linux():\n (sysname, nodename, release, version, machine) = os.uname()\n return sysname == 'Linux'", "def os_is_linux():\n return platform.system() == \"Linux\" and \"raspberrypi\" not in platform.uname()", "def IsLinux():\n return...
[ "0.7778125", "0.77675885", "0.77535135", "0.7672997", "0.7641158", "0.75940186", "0.75874895", "0.71660715", "0.6975107", "0.6803201", "0.6752388", "0.6609922", "0.6490096", "0.64594465", "0.6425964", "0.6388758", "0.6340358", "0.63352454", "0.63292605", "0.628556", "0.628334...
0.830006
0
Auto detect os flavor.
def auto_detect_os(distro): if is_debian(distro): return "Debian" if is_redhat(distro): return "Redhat" return "Unknown"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetFlavor(params):\n flavors = {\n 'cygwin': 'win',\n 'win32': 'win',\n 'darwin': 'mac',\n }\n if 'flavor' in params:\n return params['flavor']\n if sys.platform in flavors:\n return flavors[sys.platform]\n if sys.platform.startswith('sunos'):\n return 'solaris'\n if sys.platform.starts...
[ "0.7413526", "0.66558397", "0.6626726", "0.66139185", "0.65978736", "0.659083", "0.6531475", "0.64116955", "0.6364844", "0.6330103", "0.6312395", "0.6312395", "0.6253323", "0.623276", "0.6142177", "0.6133374", "0.6057103", "0.6042908", "0.6026476", "0.5990498", "0.5947277", ...
0.70920813
1
Scans a given directory
def scan_dir(self, directory="."): for root, dirs, files in os.walk(directory, topdown=False): for name in files: for filetype in self.allowed_file_types: if name.split(".")[-1] == filetype: self.song_list.append(os.path.join(root, name))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_scan_dir_files(self):\n self.run_scan(self.subdir, self.nest_fcount + 1)", "def scan(directory, cnx):\n print(\"Scanning {}\".format(directory))\n dirs = filter(\n os.path.isdir, map(lambda x: os.path.join(directory, x), os.listdir(directory)),\n )\n jobdirs = list(filter(lambd...
[ "0.7263853", "0.7050922", "0.6993613", "0.69773495", "0.6953387", "0.69411516", "0.6918187", "0.68469715", "0.67727137", "0.669542", "0.66603476", "0.6659864", "0.6642665", "0.662649", "0.6454037", "0.64492214", "0.644542", "0.6423452", "0.6388256", "0.6361539", "0.6324928", ...
0.74249417
0
Returns a list of all songs
def get_song_list(self): return self.song_list
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_songs():\r\n return [Song.song_json(song) for song in Song.query.all()]", "def getAllSongs(self):\n return self.__songDictionary", "def songs(self):\n return Html.find_song_names(self.content)", "def get_all_songs() -> Generator[dict, None, None]:\n\n logging.debug(\"Fetch...
[ "0.86367506", "0.8191542", "0.79647136", "0.79317945", "0.778444", "0.77034056", "0.7666665", "0.76622206", "0.7650521", "0.7553988", "0.75539553", "0.7451679", "0.7401373", "0.72680914", "0.72443455", "0.7234373", "0.7160428", "0.7121653", "0.710378", "0.6955602", "0.6953061...
0.8225056
1
Returns a random song form the library
def get_random_song(self): return random.choice(self.song_list)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_random_song(self):\n songs = self.get_all_song_names()\n song_name = songs[random.randrange(len(songs))]\n hits = self.get_song_data(song_name=song_name)\n if len(hits) == 0:\n # Just return Oops! I did it again by Britney\n return 'spotify:track:6naxalmIoL...
[ "0.84294975", "0.79365027", "0.7527877", "0.74414045", "0.6994297", "0.6836239", "0.66184133", "0.6540388", "0.6478357", "0.6443356", "0.627817", "0.6262528", "0.6180079", "0.61464846", "0.6126149", "0.6115689", "0.60868025", "0.60725373", "0.60570383", "0.6042103", "0.604138...
0.8657522
0
Returns a list of all allowed file types
def get_allowed_file_types(self): return self.allowed_file_types
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def file_types(self) -> Optional[List[str]]:\n return pulumi.get(self, \"file_types\")", "def SupportedFiletypes( self ):\n return ['plaintex', 'tex']", "def SupportedFiletypes( self ):\n return ['plaintex', 'tex']", "def allowed_file_type(file_name):\n\treturn file_name.lower().endswith...
[ "0.8019805", "0.70680654", "0.70680654", "0.6931715", "0.69169486", "0.6900044", "0.6873105", "0.68140197", "0.67997617", "0.6760427", "0.6705025", "0.6682", "0.66625834", "0.6586083", "0.654463", "0.6524727", "0.6423564", "0.6413762", "0.64102256", "0.64003706", "0.6366764",...
0.8676564
0
Construct a full path to a TFRecord file to be stored in the data_directory. Will also ensure the data directory exists
def _data_path(data_directory: str, name: str) -> str: if not os.path.isdir(data_directory): os.makedirs(data_directory) return os.path.join(data_directory, '{}.tfrecords'.format(name))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_record_fullpath(\n kapture_dirpath: str = '',\n record_filename: Optional[str] = None) -> str:\n feature_filename = record_filename or ''\n return path_secure(path.join(kapture_dirpath, RECORD_DATA_DIRNAME, feature_filename))", "def _get_output_filename(dataset_dir):\n return os.pa...
[ "0.70185626", "0.6525818", "0.65037584", "0.64261127", "0.64106345", "0.6286697", "0.62441295", "0.6237005", "0.6170105", "0.61235625", "0.61235625", "0.61235625", "0.6091769", "0.60649973", "0.60647696", "0.6057862", "0.6057388", "0.60410446", "0.599134", "0.5973309", "0.596...
0.7803677
0
Convert the TF MNIST Dataset to TFRecord formats
def convert_to_tf_record(_): mnist = input_data.read_data_sets( "/tmp/tensorflow/mnist/input_data", reshape=False ) convert_to(mnist.validation, 'validation', FLAGS.data_directory) convert_to(mnist.train, 'train', FLAGS.data_directory, num_shards=10) convert_to(mnist.test, 'test', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _convert_dataset(image_list, label_list, tfrecord_dir):\r\n with tf.Graph().as_default():\r\n with tf.Session() as sess:\r\n if not os.path.exists(tfrecord_dir):\r\n os.makedirs(tfrecord_dir)\r\n output_filename = os.path.join(tfrecord_dir, \"train.tfrecord\")\r\n...
[ "0.7336584", "0.71059585", "0.6941431", "0.69263786", "0.6666799", "0.6658504", "0.6604179", "0.65880334", "0.65699744", "0.6496939", "0.6470593", "0.64511", "0.64389676", "0.6437791", "0.63980347", "0.63980347", "0.6301751", "0.6214304", "0.61709315", "0.6148331", "0.6139368...
0.7885172
0
Compare winds between two different runs, looking at vertically binned averages first row shows model run 1 (and figures are saved under this run) second row shows model run 2 final row(s) show density or cumulative density from averaged metric
def compare_winds(mr1='waroona_run2', mr2='waroona_run2uc', hour=datetime(2016,1,5,15), extent=None, subsubdir=None): extentname = mr1.split('_')[0] if extent is None: extent = constants.extents[extentname] cubes1 = fio.read_model_run(mr1,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_dbscan():\n\n # simulate normal hourly data\n weekday = ([0.05, 0.95], 0.05) #bath, bed\n weekend = ([0.3, 0.7], 0.1)\n roomperwd, truelabelswd = make_blobs(n_samples=23, centers=weekday[0],\n cluster_std=weekday[1], random_state=0)\n...
[ "0.57822734", "0.56704324", "0.5660949", "0.55249906", "0.5501538", "0.5500486", "0.54958016", "0.54903275", "0.54321116", "0.54100454", "0.53929174", "0.5392418", "0.53871983", "0.53700304", "0.5360994", "0.5349561", "0.5341935", "0.53311086", "0.5319227", "0.5295784", "0.52...
0.61275434
0
examine some transects side by side for two runs
def compare_transects(run1, run2, hours=[12,], extent=None, ztop=1000, columntitles=['coupled','uncoupled'], subsubdir=None, third_transect=False): ltoffset=fio.run_info[run1]['UTC_offset'] if extent is None: extent = constants.extents[ru...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def target_intersection(self, runid):\n\n def targeting(shuffledict, seg_copy_array, cell_name):\n bedstring = \"\"\n seg_counts_dict = defaultdict(int)\n breakpoint_counts = 0\n sum_counts = 0\n for cell in shuffledict:\n with suppress(I...
[ "0.58377004", "0.56362206", "0.55310285", "0.5525444", "0.5372926", "0.53655076", "0.5349386", "0.53431064", "0.531971", "0.53118724", "0.5302521", "0.52792335", "0.5268443", "0.526257", "0.52554244", "0.5245634", "0.524434", "0.52419585", "0.5240232", "0.5191472", "0.5187347...
0.64227265
0
Prints the 3 most popular articles for the assignment
def print_popular_articles(): print("3 most popular articles\n") popularity_data = get_query_results(POPULARITY_QUERY) article_row_format = '"{}" — {} views' for title, views in popularity_data: print(article_row_format.format(title, views))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def most_popular_articles():\n\n results = query_database(QUERIES[0])\n print('\\nWhat are the most popular three articles of all time?\\n')\n for title, views in results:\n print(' * \"{}\" -- {} views'.format(title, views))", "def popular_articles():\n query = \"\"\"SELECT articles.title,cou...
[ "0.80384034", "0.7866598", "0.7835379", "0.7764855", "0.7761979", "0.7707849", "0.7582013", "0.7540308", "0.75282156", "0.7494457", "0.7437126", "0.74199694", "0.735037", "0.7328598", "0.72252476", "0.706676", "0.7053959", "0.6992004", "0.6985679", "0.6967921", "0.6862299", ...
0.80186194
1
This function is called periodically when disabled.
def disabledPeriodic(self): self.putData()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disable(self):", "def on_disable(self) -> None:\n self._on_stop_cycle({})", "def disable(self) -> None:", "def _disable(self):\n self.enabled = False", "def __periodic_maintenance__(self):\n pass", "def disable(self):\n pass", "def disable(self):\r\n self.update(e...
[ "0.7188317", "0.71696705", "0.71633327", "0.715838", "0.7012912", "0.6927466", "0.6846944", "0.68172634", "0.6771663", "0.67680657", "0.6745564", "0.66956854", "0.6674124", "0.6674124", "0.6560871", "0.651652", "0.6511851", "0.64960533", "0.6475593", "0.64734167", "0.6462959"...
0.7930481
0
Create a list of lists of training sequences for random walks.
def take_a_walk(num_steps, start_step, seq_per_set, num_sets, seed=-1): # Set the random seed, if supplied if seed > 0: np.random.seed(seed) # Preallocate the entire training data list of lists of NumPy arrays training = num_sets * [seq_per_set * [None]] # Iterate to build the training data ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_training_seqs(self):\r\n # Rdp requires unique sequence IDs without whitespace. Can't\r\n # trust user IDs to not have whitespace, so we replace all\r\n # whitespace with an underscore. Classification may fail if\r\n # the replacement method generates a name collision.\r\n ...
[ "0.64269406", "0.6263935", "0.6175524", "0.60688967", "0.60597795", "0.5988633", "0.59433323", "0.5925878", "0.5837932", "0.5814285", "0.5801816", "0.5774646", "0.57730526", "0.57244045", "0.57068837", "0.56785095", "0.5658072", "0.5645508", "0.56281906", "0.56249374", "0.562...
0.62973267
1
Encrypt each of the current initialization vector (iv), the nodeid, and the sensor_data using (staticiv, ivkey) for iv and (iv, datakey) for nodeid and sensor_data
def encrypt(self, sensor_data): # set encryption parameters encryption1 = aes(self.ivkey, 2, self.staticiv) encryption2 = aes(self.datakey, 2, self.iv) # encrypt data self.encrypted_data = encryption2.encrypt(sensor_data) self.encrypted_iv = encryption1.e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encrypt(self):\n # Generate a randomized initialization vector\n iv = Random.new().read(AES.block_size)\n # Create a new AES object in Cipher Block Chaining mode\n cipher = AES.new(self.key, AES.MODE_CBC, iv)\n # Add a buffer so that the plaintext is a multiple of 16 characte...
[ "0.6744823", "0.67062724", "0.6695682", "0.6685856", "0.6640773", "0.6543565", "0.6498856", "0.64661896", "0.6457696", "0.6416323", "0.6409741", "0.6402167", "0.6378356", "0.6310639", "0.63072586", "0.62721705", "0.62628764", "0.6250274", "0.6245834", "0.622982", "0.6165261",...
0.81590676
0
Generate HMAC by using passphrase, and combination of encrypted iv, encrypted nodeid, encrypted data, received sessionID.
def sign_hmac(self, sessionID): self.new_hmac = hmac.new(bytes(self.passphrase), self.encrypted_iv, hashlib.sha224) self.new_hmac.update(self.encrypted_nodeid) self.new_hmac.update(self.encrypted_data) self.new_hmac.update(sessionID) return self.new_hmac
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _hmac_create(self, password, shared_key):\n hmac_value = base64.b64encode(hmac.new(\n smart_str(shared_key),\n smart_str(password),\n hashlib.sha512).digest())\n return hmac_value", "def make_hmac(self, msg):\r\n return hmac.ne...
[ "0.6373782", "0.6372497", "0.63652205", "0.63358134", "0.63098156", "0.61327416", "0.6058701", "0.6033877", "0.5953167", "0.58876383", "0.58340234", "0.57657903", "0.5668364", "0.56224525", "0.5620607", "0.5610222", "0.5597424", "0.5579958", "0.55654293", "0.55556715", "0.555...
0.7923658
0
Prepare the message for MQTT transfer using all of encrypted iv, encrypted nodeid, encrypted data, HMAC. Create the message in JSON format.
def send_mqtt(self, hmac_signed): message = b'{"eiv": "' + ubinascii.hexlify(self.encrypted_iv) + b'", "enid": "' + ubinascii.hexlify(self.encrypted_nodeid) + \ b'", "ed": "' + ubinascii.hexlify(self.encrypted_data) + b'", "hmac": "' + ubinascii.hexlify(hmac_signed.digest()) + b'"}' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_msg(self, tr_id, payload, confirm, expire_time, encoding):\n tmp = [\"<SSAP_message><transaction_type>INSERT</transaction_type>\",\n \"<message_type>REQUEST</message_type>\"]\n tmp.extend([\"<transaction_id>\", str(tr_id), \"</transaction_id>\"])\n tmp.extend([\"<node...
[ "0.6143309", "0.602527", "0.5999091", "0.5869231", "0.58579576", "0.58292925", "0.5800224", "0.5793569", "0.5793569", "0.5769357", "0.5725672", "0.5725672", "0.5721188", "0.5717245", "0.5708326", "0.5705954", "0.565363", "0.56253594", "0.5604647", "0.56002784", "0.5582419", ...
0.689413
0
Authenticates the received MQTT message. Generate HMAC using passphrase, sessionID, RECEIVED encrypted iv, encrypted nodeid, encrypted data and compare with received hmac inside payload to authenticate.
def verify_hmac(self, payload): new_hmac = hmac.new(bytes(self.passphrase), b'%s'%(payload['eiv']) , hashlib.sha224) new_hmac.update(b'%s'%(payload['enid'])) new_hmac.update(b'%s'%(payload['ed'])) new_hmac.update(self.sessionID) #print(new_hmac.digest()) #pri...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_mqtt(self, hmac_signed):\r\n message = b'{\"eiv\": \"' + ubinascii.hexlify(self.encrypted_iv) + b'\", \"enid\": \"' + ubinascii.hexlify(self.encrypted_nodeid) + \\\r\n b'\", \"ed\": \"' + ubinascii.hexlify(self.encrypted_data) + b'\", \"hmac\": \"' + ubinascii.hexlify(hmac_signed.d...
[ "0.7111061", "0.65378034", "0.64993286", "0.6443285", "0.6406879", "0.6367979", "0.61420673", "0.6106591", "0.60985285", "0.6058307", "0.5845469", "0.5835342", "0.5778046", "0.57653725", "0.5732048", "0.5688146", "0.5630343", "0.56230575", "0.5594766", "0.55755526", "0.551378...
0.68764544
1
This function reads a positive real number a and integer n. Then it calls power2() function with the read parameters and prints its result.
def exponentiation(): print("Problem: Exponentiation") a = float(input()) n = int(input()) result = power_v2(a, n) print(result)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nextpow2(n):\n m_f = np.log2(n)\n m_i = np.ceil(m_f)\n return np.int(2 ** m_i)", "def power2(x, n):\n if n == 0:\n return 1\n else:\n partial = power2(x, n // 2)\n result = partial * partial\n if n % 2 == 1:\n result *= x\n return result", "def p...
[ "0.6642466", "0.6618187", "0.6618187", "0.66052455", "0.65642464", "0.652042", "0.63986135", "0.6393611", "0.63214487", "0.6251762", "0.62040746", "0.61476076", "0.61145496", "0.6101086", "0.6067954", "0.6016292", "0.6015004", "0.60130584", "0.6000192", "0.59537566", "0.59494...
0.7011147
0
Deprecated; use 'sitemaps' instead. Returns the sitemap URL present in the robots.txt, if any. Defaults to None. Read only.
def sitemap(self): _raise_error(DeprecationWarning, "The sitemap property is deprecated. Use 'sitemaps' instead.")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_sitemap_url_in_robots_file(self):\n logger.info(\"parsing robots.txt content for sitemap urls\")\n if self.content is None:\n logger.info(\"WARNING: No robots.txt content. Did we download it?\")\n return []\n r_content = self.content\n return [url.strip()...
[ "0.6406487", "0.5940337", "0.5868134", "0.5816416", "0.5793175", "0.5773923", "0.5761383", "0.5755242", "0.5623577", "0.55782825", "0.55680454", "0.55570644", "0.5468464", "0.54230595", "0.5414354", "0.5333714", "0.5312939", "0.530892", "0.5251798", "0.5246965", "0.5243624", ...
0.843564
0
True if the user agent is permitted to visit the URL. The syntax parameter can be GYM2008 (the default) or MK1996 for strict adherence to the traditional standard.
def is_allowed(self, user_agent, url, syntax=GYM2008): if PY_MAJOR_VERSION < 3: # The robot rules are stored internally as Unicode. The two lines # below ensure that the parameters passed to this function are # also Unicode. If those lines were not present and the c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _is_param_allowed(self, param, value):\n if param.startswith(\"utm_\"):\n return False\n if param == \"spref\" and value == \"tw\":\n return False\n return True", "def http_auth_allowed(request):\n\n if request.method not in ('GET', 'HEAD'):\n return False...
[ "0.577627", "0.55915993", "0.5435708", "0.54198724", "0.5389166", "0.5383636", "0.53650683", "0.5362166", "0.53550357", "0.52371985", "0.52172995", "0.5207171", "0.52051044", "0.5195745", "0.5137398", "0.51118255", "0.50607246", "0.50563884", "0.50516737", "0.5048682", "0.504...
0.79717934
0
Returns a float representing the crawl delay specified for this user agent, or None if the crawl delay was unspecified or not a float.
def get_crawl_delay(self, user_agent): # See is_allowed() comment about the explicit unicode conversion. if (PY_MAJOR_VERSION < 3) and (not isinstance(user_agent, unicode)): user_agent = user_agent.decode() for ruleset in self.__rulesets: if ruleset.does_user_agent_m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_crawl_delay(self, useragent=\"*\"):\n crawl_delay = None\n try:\n crawl_delay = self.rp.crawl_delay(useragent=useragent)\n logger.info(\"Crawl delay is %s\" % crawl_delay)\n except Exception as e:\n logger.error(\"get_crawl_delay:\\n%s\" % e)\n\n ...
[ "0.77960306", "0.63386637", "0.62997276", "0.6232375", "0.61948", "0.6143157", "0.6143157", "0.60890985", "0.6088594", "0.6088594", "0.60790205", "0.595705", "0.59461033", "0.5936903", "0.58981216", "0.5835806", "0.5829424", "0.5766042", "0.5766042", "0.5766042", "0.5766042",...
0.7142257
1
Parses the passed string as a set of robots.txt rules.
def parse(self, s): self._sitemaps = [ ] self.__rulesets = [ ] if (PY_MAJOR_VERSION > 2) and (isinstance(s, bytes) or isinstance(s, bytearray)) or \ (PY_MAJOR_VERSION == 2) and (not isinstance(s, unicode)): s = s.decode("iso-8859-1") # Nor...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def option_parse_robots_txt(self):\n return six.next(six.itervalues(self.zap._request(self.zap.base + 'spider/view/optionParseRobotsTxt/')))", "def urls_from_robots_txt(response):\n\n url = URL(response.request_url or response.url or '')\n if url.parsed.path != '/robots.txt':\n return\n\n ...
[ "0.6083513", "0.59182096", "0.57398623", "0.5728054", "0.5707375", "0.54907024", "0.54859394", "0.53908676", "0.52944636", "0.5086859", "0.50843805", "0.5010555", "0.49921304", "0.49470162", "0.49000725", "0.4897059", "0.48704797", "0.484974", "0.48105654", "0.47864226", "0.4...
0.6115702
0
This tests function return_only_filenames_under_ext(filenames, ppath, externsion) that receives a list of files and return those that have the extension given and are files
def test_return_only_filenames_under_ext(): hardcodedpath = "/home/dados/VideoAudio/Yt videos/Soc Sams vi/Lang Sams vi/Chinese Sams vi/" \ "Harbin Mandarin yu/BMC 19v 12' 2018 4h Beginning Mandarin Chinese Lessons yu Harbin ytpl/a" path_in_arg_if_any = None for arg in sys.argv: if arg.startswith('-ppath...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter_files_by_extension(\n files: list ,\n extensions: list\n):\n filtered_files = []\n for file in files:\n file_ext = os.path.splitext(file)[-1].lower()\n file_ext = _remove_dot_from_extension(file_ext)\n for extension in extensions:\n ext = _remove_dot_from_exte...
[ "0.7606867", "0.7403278", "0.7345675", "0.72660154", "0.7217896", "0.7184303", "0.71699125", "0.7112218", "0.7099673", "0.70392174", "0.6928361", "0.6919604", "0.6868715", "0.6813049", "0.68060046", "0.6777008", "0.6717877", "0.6683202", "0.6665789", "0.6600852", "0.6600551",...
0.83246964
0
Loads the feature flag states into the internal cache.
def load(self): all_ = self._fetch_features() features = {f.name: f for f in all_} self._cache = {n: self._state(features.get(n)) for n in FEATURES.keys()}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_features(self, features):\n pass\n # self.features = features", "def load_cache(self):\n self.mu.load(self.cached_mu)\n self.var.load(self.cached_var)\n self.count.load(self.cached_count)", "def load_states(self, checkpoint):\n raise NotImplementedError()", ...
[ "0.6460711", "0.61423707", "0.6131333", "0.6061394", "0.58082354", "0.58082354", "0.57750565", "0.5754009", "0.5651135", "0.56339914", "0.56137323", "0.55911314", "0.5533884", "0.55291766", "0.550093", "0.54703623", "0.546986", "0.5467458", "0.5459539", "0.5440157", "0.541391...
0.83442426
0
Determine if the named feature is enabled for the current request. If the feature has no override in the database, it will default to False. Features must be documented, and an UnknownFeatureError will be thrown if an undocumented feature is interrogated. When the internal cache is empty, it will automatically load the...
def enabled(self, name): if name not in FEATURES: raise UnknownFeatureError( '{0} is not a valid feature name'.format(name)) if not self._cache: self.load() return self._cache[name]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_enabled(self, feature):\n if feature in self._disabled:\n return False\n if feature in self._enabled:\n return True\n return self.default_enabled is True", "def __call__(self, feature):\n return self.is_enabled(feature)", "def has_feature(self, feature):...
[ "0.6690882", "0.6646818", "0.61427927", "0.6095452", "0.6087122", "0.5996685", "0.59492666", "0.58852005", "0.5782755", "0.5782755", "0.5782394", "0.5782394", "0.5782394", "0.5782394", "0.5718162", "0.5718162", "0.5718162", "0.5718162", "0.5701245", "0.56945777", "0.56353956"...
0.7392259
0
Remove old/unknown data from the feature table. When a feature flag is removed from the codebase, it will remain in the database. This could potentially cause very surprising issues in the event that a feature flag with the same name (but a different meaning) is added at some point in the future. This function removes ...
def remove_old_flags(): # N.B. We remove only those features we know absolutely nothing about, # which means that FEATURES_PENDING_REMOVAL are left alone. known = set(FEATURES) | set(FEATURES_PENDING_REMOVAL) unknown_flags = Feature.query.filter(sa.not_(Feature.name.in_(known))) count = unknown_flag...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_feature(self, name):\n logging.info('removing feature %s' % name)\n self.fguide.remove(name)\n self.dataset.pop(name)", "def remove_feature(self, feat: str):\n if feat in self._features:\n self._features.remove(feat)\n else:\n raise IDDoesNotExi...
[ "0.61806256", "0.6108143", "0.6068186", "0.6056526", "0.5986994", "0.59674114", "0.5930885", "0.5838497", "0.5731494", "0.5706631", "0.5690938", "0.5668172", "0.565345", "0.5647986", "0.5533835", "0.55313873", "0.5478874", "0.5448979", "0.5445967", "0.54204607", "0.53966075",...
0.82033163
0
Remove old feature flags from the database on startup.
def remove_old_flags_on_boot(event): # Skip this if we're in a script, not actual app startup. See the comment # in h.script:main for an explanation. if 'H_SCRIPT' in os.environ: return remove_old_flags() transaction.commit()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_old_flags():\n # N.B. We remove only those features we know absolutely nothing about,\n # which means that FEATURES_PENDING_REMOVAL are left alone.\n known = set(FEATURES) | set(FEATURES_PENDING_REMOVAL)\n unknown_flags = Feature.query.filter(sa.not_(Feature.name.in_(known)))\n count = un...
[ "0.7830818", "0.60210323", "0.59815943", "0.593286", "0.5920289", "0.58938146", "0.5876648", "0.5871416", "0.5839587", "0.58393186", "0.57996804", "0.579703", "0.5795434", "0.57841665", "0.5746831", "0.5744737", "0.5671682", "0.56663114", "0.5662509", "0.5660765", "0.56586766...
0.7267699
1
Should be able to properly create an entry within a model form
def test_form_create(self): create = { 'title': 'Last Post (Final)', 'content': '### Goodbye!', 'is_published': False, } form = self.form_cls(create) print(form.errors) form.save() actual = models.Entry.objects.get(slug='last-post-fi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create():\n if request.method == 'POST':\n if request.form.get('title') and request.form.get('content'):\n entry = Entry.create(\n title = request.form.get('title'),\n content = request.form.get('content'),\n published = request.form.get('publis...
[ "0.69358766", "0.66788036", "0.6572545", "0.648571", "0.63859326", "0.63699037", "0.63450783", "0.63332546", "0.63289684", "0.63275605", "0.6323583", "0.628292", "0.62665623", "0.626649", "0.6252105", "0.6249675", "0.6239987", "0.6236568", "0.62094796", "0.6204299", "0.620148...
0.7061157
0
Get vehicle annual data by calendar year.
def get_vehicle_annual_data_by_calendar_year(self, calendar_year): return [v for v in self._dict.values() if v['calendar_year'] == calendar_year]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_adjusted_vehicle_annual_data_by_calendar_year(self, calendar_year):\n return [v for v in self.adjusted_vads.values() if v['calendar_year'] == calendar_year]", "def calc_base_year_data(base_year_vehicles_df):\n pass", "def year_data(self,year):\n idx = [i for i in range(self.dates.s...
[ "0.74630845", "0.672582", "0.65577465", "0.6450788", "0.6054161", "0.60383314", "0.60259455", "0.6023866", "0.6003634", "0.59994143", "0.59975964", "0.5964439", "0.5964439", "0.59396625", "0.5935729", "0.59090114", "0.59042805", "0.58743894", "0.58512986", "0.5835047", "0.582...
0.778535
0
Get adjusted vehicle annual data by calendar year.
def get_adjusted_vehicle_annual_data_by_calendar_year(self, calendar_year): return [v for v in self.adjusted_vads.values() if v['calendar_year'] == calendar_year]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_vehicle_annual_data_by_calendar_year(self, calendar_year):\n return [v for v in self._dict.values() if v['calendar_year'] == calendar_year]", "def calc_base_year_data(base_year_vehicles_df):\n pass", "def predict(self, year):\n return self.linear_coef + year*self.angular_coef", "...
[ "0.72874385", "0.68556803", "0.61205184", "0.61040395", "0.6047256", "0.6026889", "0.60079885", "0.596187", "0.5923446", "0.5838555", "0.58341473", "0.5780452", "0.5777384", "0.5750522", "0.57442313", "0.5740942", "0.5676762", "0.5670741", "0.5660063", "0.5648438", "0.5636065...
0.7868242
0
Get vehicle annual data by vehicle id.
def get_vehicle_annual_data_by_vehicle_id(self, calendar_year, vehicle_id, *attribute_names): attribute_list = list() for attribute_name in attribute_names: attribute_list.append(self._dict[(vehicle_id, calendar_year)][attribute_name]) if len(attribute_list) == 1: return ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(self, vehicle_id=None):\n raise NotImplementedError()", "def get_vehicle(self, vehicle_id):\n return run_transaction(self.sessionfactory,\n lambda session: get_vehicle_txn(session,\n vehicle_id))", ...
[ "0.65360487", "0.642633", "0.61930376", "0.5709741", "0.5696065", "0.56498563", "0.54495054", "0.5365277", "0.5108141", "0.5060247", "0.5043872", "0.50159365", "0.49801266", "0.49450493", "0.49270937", "0.49204323", "0.49006584", "0.4850117", "0.48040837", "0.47913668", "0.47...
0.69925433
0
grab the file at and make a local copy at If filename is none, the basename of the url is used. urlgrab returns the filename of the local file, which may be different from the passedin filename if copy_local == 0.
def urlgrab(self, url, filename=None, **kwargs): opts = self.opts.derive(**kwargs) (url,parts) = opts.urlparser.parse(url, opts) (scheme, host, path, parm, query, frag) = parts if 'file:///' in url: return self._orig_urlgrab(url, filename, **kwargs) fsize = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def urlgrab(self, url, filename=None, **kwargs):\n blob_location = \"%s/%s\" % (self.base_path, url)\n self.verbose_logger.info(\"downloading gs://%s/%s to %s\" % (self.bucket.name, blob_location, filename))\n url = url.lstrip('/')\n if not filename:\n filename = url\n\n blob = storage.blob.Blo...
[ "0.63330466", "0.6216799", "0.6173416", "0.6116349", "0.59919065", "0.58961797", "0.58764476", "0.57157874", "0.5708401", "0.57017964", "0.5649003", "0.5612045", "0.5596911", "0.5570463", "0.55598676", "0.5522991", "0.5520831", "0.5518974", "0.5470131", "0.54661554", "0.54527...
0.6956193
0
directory (str).........folder to search for duplicate/similar images show_imgs (bool)........True = shows the duplicate/similar images found in output False = doesn't show found images similarity (str)........"high" = searches for duplicate images, more precise "low" = finds similar images compression (int).......reco...
def compare_group_images(directory, show_imgs=True, similarity="high", compression=100): # list where the found duplicate/similar images are stored duplicates = [] lower_res = [] imgs_matrix = create_imgs_matrix(directory, compression) # search for similar images if similarity == "low": ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_similar_for_img(img_dir, img_name,img_map, indices, disp_num):\n images = get_similar_imgs(img_name, img_map, indices, disp_num, img_dir)\n for img in images:\n display(Image(img))", "def print_images_in_statistics(self):\n self._print_images_statistics(self._images_in_folder, self._p...
[ "0.6732136", "0.63778746", "0.6108202", "0.6078475", "0.6015693", "0.6003447", "0.5973596", "0.59732586", "0.5911625", "0.5908507", "0.5861347", "0.5852408", "0.58388436", "0.5834546", "0.5832283", "0.5784225", "0.57784754", "0.57681084", "0.5730757", "0.5718954", "0.5718763"...
0.75780255
0
This function takes in the array of books and a string sorting to do a selection sort on the array.
def selection_sort(book_array, sorting): if sorting == "author": for i in range(len(book_array)): min_index = i for b in range(i + 1, len(book_array)): author1 = str(book_array[min_index].author) author2 = str(book_array[b].author) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n seq = [48, 11, 45, 92, 32, 61, 65, 57, 29, 96]\n print(selection_sort(seq))", "def custom_sort(arr):\n pass", "def selection_sort(array):\n # Your code\n for i in range(len(array) - 1):\n min_index = i\n for j in range(i + 1, len(array)):\n if array[j] < ar...
[ "0.62844706", "0.6158924", "0.61113906", "0.6057602", "0.5905687", "0.5877056", "0.58318806", "0.58203286", "0.57932335", "0.5700773", "0.5688165", "0.56296337", "0.5615541", "0.55875933", "0.55527544", "0.55435723", "0.5527511", "0.55238384", "0.55132675", "0.5505485", "0.55...
0.834053
0
Gets the alternate message for an original one i.e., the pending or approved messages.
def get_alternate(self, altype) -> Optional['Message']: query = self.base_query & (where('altype') == int(altype)) result = self.handle.table(ALTERNATES_TABLE_NAME).get(query) return None if result is None else \ Message(self.handle, channel_id=result['message_cid'], ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_overall_message(self):\r\n return self.overall_message", "def _get_plain_message (self) :\n return self._message", "def _get_draft_message(draft):\n return HttpTextResponse(draft.text if draft else '')", "def getMessage(self):\n m = self.messages\n l = len(m)\n if ...
[ "0.6303833", "0.5976237", "0.5840426", "0.5827424", "0.57263726", "0.5724456", "0.5670754", "0.56098056", "0.5605301", "0.5605301", "0.557652", "0.55585843", "0.55461645", "0.55460143", "0.5532704", "0.5499409", "0.54977375", "0.5481681", "0.54262847", "0.5411383", "0.534508"...
0.6679316
0
Sets the alternate message for an original one i.e., the pending or approved messages.
def set_alternate(self, message, altype): channel_id = 0 message_id = 0 if isinstance(message, discord.Message): channel_id = message.channel.id message_id = message.id else: # This class. channel_id = message.channel_id message_i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def step_impl_the_msg_to_is_set_to_alternative_respondent(context):\n step_impl_the_msg_to_is_set_to(context, context.bdd_helper.alternative_respondent_id)", "def default_message(update: Update, _: CCT) -> None:\n cast(Message, update.effective_message).reply_text(\n \"Sorry, but I can only text mes...
[ "0.6175556", "0.61469394", "0.59766644", "0.584172", "0.58137536", "0.5750123", "0.54745597", "0.5425066", "0.5388869", "0.53881246", "0.5347666", "0.53093845", "0.526095", "0.5194356", "0.51905596", "0.5173683", "0.51690054", "0.514879", "0.5129767", "0.5118783", "0.510934",...
0.63093853
0
Checks if this message is a registered comment hook of another message. A comment hook is a message that, when replied to, adds a comment onto the original message.
def is_comment_hook(self) -> bool: query = (where('message_cid') == self.channel_id) & \ (where('message_mid') == self.message_id) & \ (where('altype') == int(AlternateType.COMMENT)) return self.handle.table(ALTERNATES_TABLE_NAME).get(query) is not None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def supports_comment_notification(self):\n return False", "def new_comment(comment):\n attribute_state = inspect(comment).attrs.get('comment')\n # Check if the speaker has been updated\n history = attribute_state.history\n # TODO Check for insert rather than assuming the comment is immutable\n...
[ "0.65120983", "0.60476553", "0.591607", "0.5897561", "0.5897409", "0.581158", "0.57973003", "0.5780382", "0.56826466", "0.56794894", "0.5600061", "0.5591578", "0.5589947", "0.5589871", "0.5565548", "0.55532587", "0.5545653", "0.5512898", "0.54935193", "0.54858935", "0.5484137...
0.77876115
0
Test case for poets_get
def test_poets_get(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_poets_id_get(self):\n pass", "def test_get_pets(self):\n response = self.client.open(\n '/pet',\n method='GET')\n self.assert200(response,\n 'Response body is : ' + response.data.decode('utf-8'))", "def test_gettem_using_get(self):\n ...
[ "0.7934656", "0.708595", "0.6482241", "0.6463912", "0.6298073", "0.6247847", "0.62469655", "0.6220931", "0.6216032", "0.62146413", "0.6206823", "0.61909574", "0.6157131", "0.6108902", "0.59644943", "0.5955512", "0.5944408", "0.5938757", "0.592442", "0.5922961", "0.59196603", ...
0.90597945
0
Test case for poets_id_get
def test_poets_id_get(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_solareclipses_id_get(self):\n pass", "def test_variablepresentations_id_get(self):\n pass", "def test_get_pet_by_id(self):\n response = self.client.open(\n '/pet/{petId}'.format(pet_id=789),\n method='GET')\n self.assert200(response,\n ...
[ "0.73325884", "0.7115401", "0.7018856", "0.68544364", "0.6839831", "0.68250716", "0.6604801", "0.6574144", "0.6503818", "0.64928377", "0.6488825", "0.64454144", "0.6379939", "0.63332915", "0.6290299", "0.6193931", "0.61220706", "0.6109643", "0.5999027", "0.5979086", "0.597082...
0.91658837
0
Creates a tree node with the specified item and no children.
def __init__(self, item=None): self.item = item self.children = [] #List to hold all child nodes of this Node
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_node(self, item: Item) -> Dict[str, Any]:\n node = {'text': item.title,\n 'item-id': item.id,\n 'nodes': []}\n icon = self.icon_name(item)\n if icon:\n node['icon'] = 'glyphicon glyphicon-{}'.format(icon)\n node['item_title'] = item.t...
[ "0.72120506", "0.6496078", "0.6397744", "0.6353164", "0.61679065", "0.6135615", "0.607084", "0.6055204", "0.60016084", "0.59391564", "0.59245", "0.5908887", "0.58989173", "0.5862054", "0.58367574", "0.58367574", "0.58219486", "0.5793254", "0.57903504", "0.5783533", "0.5765618...
0.6915047
1
Method that sets the Node to contain the provided item.
def set_item(self, item): self.item = item
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def SetItem(self, item):\r\n\r\n self._item = item", "def setItem(self, item):\n self.setItem(0, item)", "def put(self, item, value, set_doc):\n if item is None:\n raise Exception(\"call __setitem__ with None argument\")\n else:\n self.size += 1\n self.r...
[ "0.68769044", "0.67932564", "0.6790702", "0.6731936", "0.650597", "0.65058905", "0.6407144", "0.6375588", "0.63562137", "0.63217515", "0.63217515", "0.631006", "0.6307787", "0.6247727", "0.62280065", "0.6214792", "0.6193703", "0.618815", "0.61634064", "0.60918224", "0.60916",...
0.69662505
1
Method that returns the number of children the Node has.
def get_num_children(self): return len(self.children)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def child_count(self):\n\t\treturn len(self._children)", "def num_children(self):\n # TODO: Determine how many children this node has\n count = 0\n for child in self.children:\n # if child not none\n if child:\n count += 1\n return count", "def c...
[ "0.8901353", "0.8867547", "0.8704944", "0.8633724", "0.86006594", "0.85742", "0.85078734", "0.8473704", "0.8423032", "0.8398717", "0.8290088", "0.8236163", "0.8213076", "0.8162665", "0.8156342", "0.81557095", "0.81479913", "0.8143253", "0.80995166", "0.80788803", "0.8036601",...
0.8918276
0
Method that deletes the provided child node from the children of self.
def delete_child(self, child): for i, c in enumerate(self.children): #For each child in the Node's children if c is child and c.is_leaf(): #If that child is the one we're looking for and it has no children del...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def del_child(self, child):\n\n try:\n self.children.remove(child)\n except ValueError:\n pass\n else:\n self.rebuild_children_dict()", "def remove_child(self, child):\n\n self.children.remove(child)", "def remove_child(self, child: \"AbstractNode\")...
[ "0.81277883", "0.7859505", "0.7772355", "0.7658508", "0.7587453", "0.7577232", "0.756572", "0.75191724", "0.7481923", "0.7452709", "0.72965026", "0.72944474", "0.7272959", "0.7231228", "0.7222163", "0.7217861", "0.71904266", "0.7172832", "0.71494955", "0.7073702", "0.6924567"...
0.8044754
1
Method that sets the Node's specified child to contain the provided node.
def set_child(self, child_index, node): try: self.children[child_index] = node #Set the node to be the child at the provided index. except: #If the index is invalid, pass ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def put(self, node, child):\n node.add_child(child)", "def set_child(self, n, node):\n if n == 0:\n raise ValueError('Cannot set child 0; replace from parent node')\n complete, _ = self.recursive_set_child(n, node)\n return complete", "def SetChild(self, *args):\n ...
[ "0.7864978", "0.6824039", "0.68098235", "0.67459416", "0.6383755", "0.63726526", "0.637112", "0.636934", "0.63545716", "0.63336885", "0.6316308", "0.6316308", "0.6271233", "0.62638515", "0.6258728", "0.6258107", "0.625607", "0.62430274", "0.62395316", "0.6211954", "0.62063515...
0.73403627
1
Method that checks if the Node is a leaf (ie, has no children).
def is_leaf(self): if len(self.children) == 0: #If the Node has no children, it's a leaf return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isNodeLeaf ( self ):\n return self.nodes is None or len ( self.nodes ) == 0\n # End isNodeLeaf", "def is_leaf(self):\n if len(self.children) == 0:\n return True\n else:\n return False", "def is_leaf(self):\n # Has no children nodes\n return se...
[ "0.85527277", "0.85413235", "0.8488753", "0.8472446", "0.84598154", "0.84169316", "0.84035474", "0.8401013", "0.8387275", "0.8386148", "0.8362038", "0.83535224", "0.83190703", "0.82959837", "0.829054", "0.82625026", "0.81944114", "0.81807554", "0.8176544", "0.8171646", "0.815...
0.8790564
0
return pure background image around the character in char_pos position.
def get_raw_background(char_pos, size=394): full_back = Image.open(WORLD_MAP).convert("RGBA") # get terrain part in radius size/2 from your position cropbox = (char_pos[0] - size//2, char_pos[1] - size//2, char_pos[0] + size//2, char_pos[1] + size//2) full_back = full_back.crop(cropbox) return full_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extractBackgroundLayer(x, y, nameInfix=None, debug=False):\n\n\tif nameInfix == None:\n\t\tbgLayerName = \"./captcha/captcha_bg_\" + str(datetime.datetime.now().isoformat()) + \".png\"\n\telse:\n\t\tbgLayerName = \"./captcha/captcha_bg_\" + str(nameInfix) + \".png\"\n\n\treturn extractScreenPart(x-50, y+5, 170...
[ "0.6068305", "0.6010466", "0.592064", "0.58031726", "0.57311773", "0.568295", "0.56614536", "0.5643831", "0.5586677", "0.5562304", "0.5542021", "0.5471494", "0.54627204", "0.5458167", "0.5455516", "0.5427192", "0.5399227", "0.53817147", "0.5379586", "0.5340737", "0.5333464", ...
0.71396303
0
turn background into 9x9 marked field
def field_markup(background): # transparent background for markup markup = Image.new('RGBA', background.size, (0,0,0,0)) # draw on markup using drawer drawer = ImageDraw.Draw(markup) for c in range(1, 9): # x0 = (one_column_width + line_width) * line_index # y0 = (one_row_height + li...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generateTransparentBackground(sizex, sizey):\n\tsizex += sizex % 16\n\tsizey += sizey % 16\n\tsingleTileData = (\n\t\t\"GdkP\"\n\t\t\"\\0\\0\\0\\263\"\n\t\t\"\\2\\1\\0\\2\"\n\t\t\"\\0\\0\\0@\"\n\t\t\"\\0\\0\\0\\20\"\n\t\t\"\\0\\0\\0\\20\"\n\t\t\"\\210jjj\\377\\210\\233\\233\\233\\377\\210jjj\\377\\210\\233\\23...
[ "0.60989535", "0.6064079", "0.6011309", "0.5981861", "0.5904239", "0.5861575", "0.58314615", "0.58049744", "0.57813656", "0.5766787", "0.5761716", "0.5711361", "0.57077533", "0.5651801", "0.5643565", "0.5639585", "0.56047606", "0.5586983", "0.55819553", "0.55753237", "0.55683...
0.62590545
0
Encode a value which will be sent to memcached to bytes
def _encode_value(self, value): return pickle.dumps(value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encode(self, value):\r\n pass", "def encode(self, value):\r\n return value", "def _encode(self, value):\n if value is None:\n return value\n if isinstance(value, six.binary_type):\n return value\n return value.encode(\"utf-8\")", "def encode(Value)...
[ "0.76877534", "0.7669633", "0.76282704", "0.75531465", "0.7417588", "0.7414691", "0.73372877", "0.7274985", "0.7262916", "0.71883106", "0.7169597", "0.7050967", "0.70305836", "0.70305836", "0.70305836", "0.6986489", "0.69832224", "0.6967171", "0.69320613", "0.6896767", "0.688...
0.7838096
0
Decode a value recived from memcached (which is an Items object with a pickled 'value' attribute) from bytes
def _decode_value(self, value): return pickle.loads(value.value) if value else value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decode(self, value):\r\n return value", "def decode(self, value):\r\n pass", "def deserialize(self, value: bytes) -> VALUE:\n raise NotImplementedError", "def loads(value):\n return unpackb(value)", "def decode(eVal):\n return pickle.loads(zlib.decompress(base64.b64decode(eVa...
[ "0.758928", "0.7560655", "0.7464401", "0.7230734", "0.72043496", "0.70247626", "0.69700325", "0.69022685", "0.68700695", "0.68490577", "0.6848108", "0.6812324", "0.67350894", "0.6707784", "0.6704967", "0.66838783", "0.66746414", "0.662379", "0.66013104", "0.6577154", "0.65622...
0.79774255
0
Returns a current window number. Provides a workaround for Neovim.
def get_current_window(): try: return vim.current.window.number - 1 except AttributeError: return int(vim.eval('winnr()')) - 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_current_workspace_num(i3: i3ipc.Connection):\n return i3.get_tree().find_focused().workspace().num", "def current_window(self):\n pass", "def _current_window_for_event(event):\n return find_window_for_buffer_name(event.cli, event.cli.current_buffer_name)", "def getCurrentWindowId(*args):...
[ "0.7134305", "0.70722437", "0.70285165", "0.7016507", "0.6743091", "0.6721204", "0.67071027", "0.6652955", "0.66428214", "0.66220456", "0.654497", "0.64602", "0.64349806", "0.64271337", "0.63907015", "0.6350733", "0.6341784", "0.6301516", "0.62706727", "0.6267491", "0.6263614...
0.825932
0
Returns a buffer with specfied number. Provides a workaround for Neovim. Note that vim.buffers may not contain all buffers with sequential numbers.
def get_buffer(number): buffers = [buffer for buffer in vim.buffers if buffer.number == number] assert len(buffers) == 1 return buffers[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_or_get_buffer(self, name):\n for b in self.nvim.buffers:\n bname = path.basename(b.name)\n if bname == name:\n return b\n\n # Create new buffer\n self.nvim.command('set splitbelow')\n self.nvim.command('new')\n self.nvim.command('se...
[ "0.64269066", "0.6200232", "0.5850689", "0.576306", "0.5742352", "0.5495861", "0.53048766", "0.52937204", "0.5267217", "0.52580374", "0.5243534", "0.5243441", "0.5242601", "0.5201827", "0.5152681", "0.51385325", "0.51290786", "0.51121384", "0.51107764", "0.50899225", "0.50101...
0.8474364
0
Data structures obtained from vim under python3 will return bytestrings. Neovim under python3 will return str. Make sure we can handle that.
def decode_bytes(var): if NEOVIM: return var if isinstance(var, bytes): return var.decode() if isinstance(var, list): return list([decode_bytes(element) for element in var]) if isinstance(var, dict) or 'vim.dictionary' in str(type(var)): return { decode_b...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def v(self):\n try:\n length = self.Length.v()\n if length > 1024:\n length = 0\n data = self.obj_vm.read(self.Value.obj_offset, length)\n return data.decode(\"utf16\", \"ignore\").encode(\"ascii\", 'backslashreplace')\n except Exception, _e:...
[ "0.5697703", "0.55449975", "0.54810137", "0.53547406", "0.53514504", "0.51948434", "0.51918554", "0.5176014", "0.51729167", "0.5170987", "0.5148722", "0.5135276", "0.51316583", "0.5122111", "0.5118774", "0.51135623", "0.51103127", "0.51103127", "0.51103127", "0.5094316", "0.5...
0.60030717
0
Determines if given datetime object is set to midnight.
def is_midnight(dt): return dt.hour == 0 and dt.minute == 0 and dt.second == 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_starttrimester(today):\n if isinstance(today, datetime):\n if today.day == 1 and today.month == 1:\n return True\n elif today.day == 1 and today.month == 4:\n return True\n elif today.day == 1 and today.month == 7:\n return True\n elif today.da...
[ "0.6316294", "0.6185327", "0.6185327", "0.60319597", "0.5906638", "0.59025776", "0.5823405", "0.5798733", "0.57395375", "0.5674077", "0.56247437", "0.5597596", "0.5577019", "0.5562061", "0.5554642", "0.5542466", "0.5540736", "0.552818", "0.5467706", "0.54512024", "0.5443104",...
0.8336064
0
List all columns if requested by user.
def list_all_columns(data): # Print columns to user. print("\nFeatures in our original dataset include (one at a time, please!):") print("-" * 30) print("") # Print each column in our DataFrame. for index, column in enumerate(data.columns.values): print("[{}] {}".format(index, column))...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_export_csv_columns(self, user):\n return self.EXPORT_CSV_COLUMNS if self.EXPORT_CSV_COLUMNS is not None else self.LIST_DISPLAY", "def columns(self):\n result = self.execute(self.commands.table_columns(self.name))\n return [x[0] for x in result]", "def columns(self):\n return...
[ "0.6910003", "0.6817264", "0.6817256", "0.68077284", "0.6725023", "0.6707625", "0.6696625", "0.66918695", "0.66891545", "0.66841733", "0.6649609", "0.66460717", "0.66359997", "0.6591473", "0.65853304", "0.6576705", "0.65684015", "0.65569896", "0.6546881", "0.65267754", "0.651...
0.7048273
0
Pack items into n bins while minimising the variance of weight accumulated in each bin. The function uses a greedy algorithm, which doesn't not guarantee a perfect result.
def binpack(nbins: int, weight: Callable[[T], Number], items: Sequence[T]) \ -> List[List[int]]: if len(items) < nbins: raise ValueError('There should be at lest `nbins` items') weighted = [(i, weight(item)) for i, item in enumerate(items)] return (F(map, F(map, op.itemgetter(0)) >> list) >>...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fit_n_bins(self, n):\n\n # Lazily evaluate all replacement-combinations of the defined bin\n # sizes.\n combinations = itertools.combinations_with_replacement(\n self.bins, r=n\n )\n\n # Initialize the minimum capacity as a infinite number.\n capacity_min = ...
[ "0.6838654", "0.66570944", "0.66363686", "0.6406828", "0.6365487", "0.63395023", "0.632179", "0.626821", "0.62097055", "0.6180603", "0.6143287", "0.6114745", "0.60678905", "0.6044241", "0.59624237", "0.59358436", "0.59065413", "0.5905714", "0.58689713", "0.5823215", "0.581085...
0.70148504
0
Merge sources within bins and stack them on top of each other.
def merge_bins(sources: Union[np.ndarray, Sequence[np.ndarray]], bins: Sequence[Sequence[int]], dtype=None) -> np.ndarray: if not len(sources): raise ValueError('no `sources`') extracted = ( F(binextract) >> (map, np.concatenate) >> list )(sources, bins) return preproc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def merge(): #Status: WIP\r\n pass", "def merge(self, other):\n\n for n in other.cfg_nodes:\n self.insert_cfgnode(n)\n\n for ins_addr, outs in other.out_branches.items():\n if ins_addr in self.out_branches:\n for stmt_idx, item in outs.items():\n ...
[ "0.5610717", "0.5577793", "0.54981995", "0.54440415", "0.53566283", "0.52986896", "0.5258105", "0.5223241", "0.5203493", "0.5198048", "0.51867235", "0.5176678", "0.51682204", "0.51180494", "0.51003104", "0.508353", "0.50684834", "0.50475913", "0.5029195", "0.5017992", "0.5008...
0.7032406
0
Breaks `merged` into binned objects corresponding to the original objects in a binned Sequence
def unmerge_bins(merged: np.ndarray, bins: Sequence[Sequence[int]], lengths: Sequence[int]) -> List[List[np.ndarray]]: lengths_ = np.array(lengths) indices = [lengths_[bin_] for bin_ in bins] return [list(np.split(line, np.cumsum(l_indices)))[:-1] for line, l_indices in zip(merg...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bin_binarise(self):\n pass", "def merge_bins(sources: Union[np.ndarray, Sequence[np.ndarray]],\n bins: Sequence[Sequence[int]], dtype=None) -> np.ndarray:\n if not len(sources):\n raise ValueError('no `sources`')\n extracted = (\n F(binextract) >> (map, np.concate...
[ "0.6278117", "0.5802776", "0.5701724", "0.56743956", "0.5587524", "0.5562375", "0.5430487", "0.5424693", "0.54014516", "0.5376119", "0.53448343", "0.53386086", "0.5316188", "0.5302566", "0.5256823", "0.52365977", "0.52354133", "0.52308834", "0.5221173", "0.5203321", "0.518018...
0.6594228
0
utility method to get the status of a slicing job resource, but also used to initialize slice objects by location
def _get_status(self): if self._state in ["processed", "error"]: return self._state get_resp = requests.get(self.location, cookies={"session": self.session}) self._state = get_resp.json()["status"] self.slice_time = get_resp.json()["slice_time"] ret...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_job_state(self, job_origin_id):", "def create_call_status(job, internal_storage):\n monitoring_backend = job.config['lithops']['monitoring']\n Status = getattr(lithops.worker.status, '{}CallStatus'\n .format(monitoring_backend.capitalize()))\n return Status(job, internal_stor...
[ "0.5596492", "0.5443711", "0.535045", "0.5323175", "0.5262061", "0.5210716", "0.5188371", "0.5149958", "0.50847584", "0.50565773", "0.5034694", "0.49489132", "0.49276173", "0.49091348", "0.49002594", "0.48943186", "0.4892928", "0.48713648", "0.48684072", "0.48647726", "0.4830...
0.5802584
0
Inicializa y carga lista de stopwords desde el path recibido
def __init__(self,dir_stopwords): arc = open(dir_stopwords, "r", encoding='utf-8') self.stp_wrds = [line.strip() for line in arc] arc.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_stop_words():\n with open('../data/stop_words.txt', 'r') as stop_words_file:\n return stop_words_file.read().split()", "def _stopwords():\n global _stopword_set\n if _stopword_set:\n return _stopword_set\n f_name = \"stopword.list\"\n if os.path.isfile(f_name):\n res ...
[ "0.70847505", "0.7051989", "0.69990194", "0.699775", "0.6894505", "0.6890229", "0.68880403", "0.6702198", "0.6643121", "0.661804", "0.6568817", "0.6564261", "0.63946927", "0.63723576", "0.63657683", "0.6362664", "0.6362664", "0.62694436", "0.62655616", "0.6248142", "0.6236767...
0.7769529
0
Remueve todos los espacios en blanco duplicados y al inicio/fin de un texto
def remocion_de_espacios(self, texto): texto = re.sub(' +', ' ', texto) return texto.strip()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def archivos_de_texto():\n palabra = \"\" \n palabras_candidatas = [] #lista donde se guardara las palabras candidatas de cada linea\n palabra_cantidad = {} #diccionario con la palabra candidata de clave y las veces que esta repetida en cada texto de valor\n with open(\"Cuentos.txt\",\"r\") as Cuentos:...
[ "0.67440516", "0.5940296", "0.5903421", "0.5857507", "0.58517766", "0.580737", "0.57168955", "0.5688586", "0.56707925", "0.5667713", "0.56565845", "0.5570237", "0.55577683", "0.5556952", "0.5548623", "0.5548623", "0.55474615", "0.5543919", "0.5535501", "0.55274934", "0.552749...
0.604015
1
Remueve los urls de un texto
def remocion_de_urls(self, texto): texto = re.sub(r'http\S+', '', texto) return texto
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_urls(text):\n pass", "def remove_url(txt):\n\n return \" \".join(re.sub(\"([^0-9A-Za-z \\t])|(\\w+:\\/\\/\\S+)\", \"\", txt).split())", "def remove_urls(self, text):\n return re.sub(r'http.?://[^\\s]+[\\s]?', '', text)", "def remove_urls(text):\n text = re.sub('(?P<url>https?:...
[ "0.8236439", "0.7687637", "0.76258564", "0.7610231", "0.75714636", "0.7381592", "0.73281145", "0.7291962", "0.72305655", "0.7223943", "0.7149883", "0.7116193", "0.7099934", "0.70258516", "0.70243233", "0.6961751", "0.6845452", "0.6842385", "0.6840557", "0.6826632", "0.6821755...
0.8614365
0
Get course by ID.
def get_course_by_id(course_id): course = Courses.query. \ filter_by(id=course_id). \ first_or_404() return course
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_course(self, id):\n id = str(id)\n for i in range(len(self.courses)):\n if self.courses[i].id == id:\n return self.courses[i]", "def course_from_id(course_id):\r\n return modulestore().get_course(course_id)", "def get_course(course_id, depth=0):\r\n course ...
[ "0.8754217", "0.8195493", "0.7963292", "0.79108286", "0.7743166", "0.75298303", "0.73153013", "0.6986335", "0.6899813", "0.68694556", "0.6834117", "0.676725", "0.6743542", "0.67193156", "0.6594527", "0.6588531", "0.65700185", "0.65609026", "0.6532858", "0.6466432", "0.6460019...
0.8391626
1
Make sure cube values lie between min_value and max_value. (The regridding produces spurious large and small values.)
def clean_data(cube, max_value, min_value): data_clean = numpy.where(cube.data < min_value, min_value, cube.data) data_clean = numpy.where(data_clean > max_value, max_value, data_clean) return data_clean
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testMinMax(self, value):\n\t\tif value > self.oldmax:\n\t\t\tself.oldmax = value\n\t\t\tself.maxBox.SetValue(str(value).encode('utf-8'))\n\t\telif value < self.oldmin:\n\t\t\tself.oldmin = value\n\t\t\tself.minBox.SetValue(str(value).encode('utf-8'))", "def normalize_array(cube, new_max, new_min):\n minim...
[ "0.6778949", "0.67541873", "0.65034217", "0.6453922", "0.6337516", "0.63310474", "0.62423635", "0.6044201", "0.5967745", "0.5966973", "0.5956198", "0.59383535", "0.5935861", "0.5926228", "0.59092534", "0.59006083", "0.58963996", "0.58813196", "0.58765817", "0.587259", "0.5871...
0.74482757
0
Recursive Low Pass filter applied to signal to detect abrupt changes in data.
def RecursiveLowPassFast(signal, coeff, self): # Creates running mean value of the input ml = scipy.signal.lfilter([1 - coeff['a'], 0], [1, -coeff['a']], signal) # Plot Running threshold value at the current plot self.p1.plot(self.t, ml, pen=pg.mkPen(color=(246, 178, 255), width=3)) # Creates runn...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _lowpass(self, signal, dx, Lmax):\n W = np.fft.rfftfreq(len(signal), dx)\n f_signal = np.fft.rfft(signal)\n filtered_signal = f_signal.copy()\n filtered_signal[np.where(self._div0(1,W) > Lmax)] = 0+0j\n return np.fft.irfft(filtered_signal, n=len(signal)), f_signal", "def lo...
[ "0.7445913", "0.7080542", "0.67733", "0.6515121", "0.6403294", "0.6391119", "0.6300052", "0.6276789", "0.6203948", "0.61616427", "0.59953845", "0.59280086", "0.588583", "0.58757645", "0.58734024", "0.5844126", "0.5727902", "0.56987983", "0.5607834", "0.5604717", "0.5585114", ...
0.7278061
1
convert the hextstring to a length n list of booleans be careful of the order of indexing.
def __init__(self,hexstr,n=32): binary=bin(int(hexstr,16))[2:] binary=list(reversed(binary)) self.boolVals=[] self.n=n for i in range(len(binary)): if binary[i]=="1": self.boolVals.append(True) else: self.boolVals.append(Fa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_list_bool_from_string(input_string):\n for text in [\"[\", \"]\", \" \"]:\n input_string = input_string.replace(text,\"\")\n list_of_strings = input_string.strip().split(\",\")\n list_bool = [True if item==\"True\" else False for item in list_of_strings]\n return list_bool", "def _stri...
[ "0.6215853", "0.6185812", "0.6075862", "0.5706183", "0.56247956", "0.55055803", "0.5454395", "0.53939575", "0.53916115", "0.5276847", "0.52423596", "0.523195", "0.5227039", "0.52196985", "0.52083784", "0.5198761", "0.5193633", "0.51714325", "0.509806", "0.50853235", "0.506152...
0.62269765
0
__str__ is called when you 'print' a BoolArray object it should return a string of 0's and 1's or T's and F's
def __str__(self): t=self.boolVals[:] t.reverse() bitstring="" for i in range(len(t)): if t[i]: bitstring +="1" else: bitstring +="0" return bitstring
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return str(self.array)", "def convertToStringArray(booleanArray: typing.List[bool]) -> typing.List[str]:\n ...", "def __str__(self):\n return str(self.arr)", "def __str__(self):\n\n\t\tterms = \\\n\t\t[{att:self.att[att]} for att in self.att if type(self.att[att])==b...
[ "0.7086239", "0.69809735", "0.69591606", "0.6907924", "0.6651512", "0.651511", "0.64804393", "0.6445904", "0.641663", "0.63940984", "0.63854927", "0.6364848", "0.63532674", "0.63077587", "0.6303245", "0.62841654", "0.6273793", "0.6210671", "0.61499935", "0.6105573", "0.610168...
0.78295434
0
return a string representing the current value in base 16 eg a string whose current barray is [True,False,False,True,False] should return "09" the number of hex digits should be len//4 rounded up
def toHex(self): t=self.boolVals[:] t.reverse() string=str(self) string=hex(int(string,2)) string=string[2:] d=ceil(self.n/4)-len(string) string=d*"0"+string return string
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_bit_string(value):\n\n return \"{0:b}\".format(value).zfill(8)", "def repr_as_binary(value):\n b = bin(value)[2:]\n return b.zfill(len(b) + -len(b) % 8)", "def makeBinary(self):\r\n\t\tls = 5.12 #limite superior\r\n\t\tli = -5.12 #limite inferior\r\n\t\tt = 14 # total de binarios\r\n\...
[ "0.7058882", "0.6392439", "0.6222204", "0.6158912", "0.6080948", "0.60667956", "0.60667205", "0.6056909", "0.6006372", "0.6000414", "0.59778523", "0.5933791", "0.5930252", "0.59256697", "0.5902404", "0.58848834", "0.5876726", "0.5848609", "0.58275574", "0.5799989", "0.5767638...
0.657323
1
extracts a subarray of bits from indices left through rightplus including left and upto but not including rightplus e.g. getBits(7,10) a BoolArray object with bits equal to bits 7 through 9 inclusive
def subArray(self,left,rightplus): lst=self.boolVals[:] sm="" for i in range(len(lst)): if lst[i]: sm+="1" else: sm+="0" newlst=sm[left:rightplus] newlst=newlst[::-1] final=hex(int(newlst,2)) final=f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_bits_bit_array(x, bit_array):\n\n mask = bit_array - 1\n\n lower = x & mask\n upper = x & ~mask\n\n return lower, upper", "def getBits(data, offset, bits=1):\n mask = ((1 << bits) - 1) << offset\n return (data & mask) >> offset", "def extract_bits_from_bytes(data, start_bit, num_bit...
[ "0.6666846", "0.6550691", "0.63042086", "0.61315566", "0.5952953", "0.5867907", "0.5860803", "0.58586663", "0.5853388", "0.5819336", "0.58026683", "0.57966226", "0.5780705", "0.57767975", "0.57251287", "0.563046", "0.5615567", "0.5565193", "0.554005", "0.55119723", "0.5487314...
0.72914374
0
sets the ith bit of the array to the value boolval
def setBit(self,i,boolval): self.boolVals[i]=boolval
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_bools(self, value, bools, limit):\n for x in range(limit):\n if value & 1 << x:\n bools[x]['value'] = True\n else:\n bools[x]['value'] = False\n pass", "def getBit(self,i):\n return self.boolVals[i]", "def _writeBool(self, val):\n...
[ "0.6962903", "0.66782933", "0.6667447", "0.6411262", "0.62882495", "0.62702703", "0.62094015", "0.6161459", "0.61547625", "0.61496127", "0.61445296", "0.61427075", "0.61041844", "0.61004615", "0.60862726", "0.60484177", "0.6040124", "0.6032554", "0.6024791", "0.60237294", "0....
0.85109
0
returns a new BoolArray Object whose bits are those of self with bits of barray concatenated on the high end. partly courtsey of Wu & Nick
def catHigh(self,barrayobj): n=len(barrayobj)+len(self) ans=BoolArray("0",n) for i in range(len(self)): ans.setBit(i,self.getBit(i)) for i in range(len(barrayobj)): k=len(self)+i ans.setBit(k,barrayobj.getBit(i)) return ans
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def BitArray(self):\n from bitstring import BitArray,BitStream\n b = BitArray(bin=str(self))\n return b", "def get_bools_array(self, bools, limit):\n bit_array = bytearray()\n bits_array_length = (limit) // 8\n\n for x in range(bits_array_length):\n bit_array....
[ "0.6805339", "0.64134794", "0.6321549", "0.6254817", "0.6220117", "0.6050312", "0.5911523", "0.58177805", "0.58122724", "0.57025063", "0.56709033", "0.56610006", "0.56454986", "0.5612264", "0.55264765", "0.551421", "0.5503693", "0.54890084", "0.54750764", "0.5456264", "0.5386...
0.71963525
0
make the parent temp dir directory
def makeTempDirParent(): if not os.path.exists(os.path.join(os.curdir, '.tempTestDir')): os.mkdir(os.path.join(os.curdir, '.tempTestDir'))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_tempdir(parent=None):\n tmpdir = tempfile.mkdtemp(prefix='rbtools.',\n dir=parent)\n tempdirs.append(tmpdir)\n\n return tmpdir", "def _temp_dir(self):\n tmp_dir = os.path.join(self.output_dir, self.config.find_tune[\"run_dir\"])\n try:\n os....
[ "0.7953512", "0.7689953", "0.7443195", "0.74010277", "0.7275494", "0.7275494", "0.7269701", "0.7257673", "0.72371775", "0.7236921", "0.71696526", "0.71673244", "0.70553", "0.70450443", "0.7034643", "0.7030688", "0.6994628", "0.69758165", "0.6975151", "0.6973209", "0.697156", ...
0.85826695
0
remove the parent temp dir directory
def removeTempDirParent(): if os.path.exists(os.path.join(os.curdir, '.tempTestDir')): shutil.rmtree(os.path.join(os.curdir, '.tempTestDir'))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cleanup_temp_dir(context):\n\n try:\n os.chdir(context.cwd)\n except:\n print(\"Current working file record does not exist\")\n\n try:\n context.tempdir.cleanup()\n except:\n print(\"Temporary directory cannot be cleaned up - does it exist?\")", "def delete_tempdirs(se...
[ "0.7464048", "0.74386084", "0.737131", "0.7270957", "0.7195876", "0.7177246", "0.7172913", "0.71712023", "0.71699035", "0.7107506", "0.7097899", "0.7092721", "0.706929", "0.7044867", "0.70276105", "0.70221287", "0.7017767", "0.7015327", "0.6981963", "0.6973451", "0.6961621", ...
0.88151497
0
Tests the conversion of chromosome/transcript/cds coordinates into individual amino acids.
def test_amino_acid_slicing(self): chrom_result = [None, None, None, None, "R", "R", None, "R", "A", "A", None, None, "A", None, None, None] for i in xrange(len(chrom_result)): self.assertEqual(self.t.chromosome_coordinate_to_amino_acid(i, self.chrom_seq), chrom_resul...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_amino_acid_slicing(self):\n chrom_result = [None, \"Y\", \"Y\", \"Y\", None, None, None]\n for i in xrange(len(chrom_result)):\n self.assertEqual(self.t.chromosome_coordinate_to_amino_acid(i, self.chrom_seq), chrom_result[i])\n cds_result = [\"Y\", \"Y\", \"Y\", None]\n ...
[ "0.81207925", "0.78851515", "0.6803442", "0.6741371", "0.6730588", "0.6724373", "0.6722188", "0.67108667", "0.6659613", "0.66537243", "0.6625853", "0.65557414", "0.655514", "0.6540536", "0.6538844", "0.65250623", "0.65198827", "0.65152", "0.65103084", "0.6509142", "0.64945513...
0.79467404
1
Tests that the proper sequences are created from the intervals
def test_sequences(self): self.assertEqual(self.t.get_mrna(self.chrom_seq), self.transcript_seq) self.assertEqual(self.t.get_cds(self.chrom_seq), self.cds_seq) self.assertEqual(self.t.get_protein_sequence(self.chrom_seq), self.amino_acid) self.assertEqual(self.t.get_intron_sequences(self...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_sequences(self):\n self.assertEqual(self.t.get_mrna(self.chrom_seq), self.transcript_seq)\n self.assertEqual(self.t.get_cds(self.chrom_seq), self.inframe_cds_seq)\n self.assertEqual(self.t.get_cds(self.chrom_seq, in_frame=False), self.cds_seq)\n self.assertEqual(self.t.get_prot...
[ "0.68494034", "0.6827028", "0.6589176", "0.65395045", "0.65141827", "0.65008366", "0.6499456", "0.64786434", "0.6472841", "0.6369248", "0.63641524", "0.63555324", "0.6309749", "0.63069963", "0.6296829", "0.62372506", "0.6227087", "0.6224931", "0.6202431", "0.60909975", "0.608...
0.6874728
0
Check all possible chromosome translations for correct result
def test_chromosome_coordinate_translations(self): cds_result = [None, 0, 1, 2, None, None, None] transcript_result = [0, 1, 2, 3, 4, 5, None] for i in xrange(6): self.assertEqual(self.t.chromosome_coordinate_to_cds(i), cds_result[i]) self.assertEqual(self.t.chromosome_co...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_chromosome_coordinate_translations(self):\n cds_result = [4, 3, 2, 1, 0, None, None]\n transcript_result = [5, 4, 3, 2, 1, 0, None]\n for i in xrange(7):\n self.assertEqual(self.t.chromosome_coordinate_to_cds(i), cds_result[i])\n self.assertEqual(self.t.chromosom...
[ "0.7148265", "0.7123192", "0.71121114", "0.7103658", "0.7076491", "0.70754874", "0.702512", "0.657712", "0.6540573", "0.6503475", "0.65028846", "0.64769745", "0.6476169", "0.64734954", "0.6463151", "0.6416668", "0.6416668", "0.6416668", "0.6403567", "0.6403567", "0.6403004", ...
0.71365863
1
Tests that the proper sequences are created from the intervals
def test_sequences(self): self.assertEqual(self.t.get_mrna(self.chrom_seq), self.transcript_seq) self.assertEqual(self.t.get_cds(self.chrom_seq), self.cds_seq) self.assertEqual(self.t.get_protein_sequence(self.chrom_seq), self.amino_acid) self.assertEqual(self.t.get_intron_sequences(self...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_sequences(self):\n self.assertEqual(self.t.get_mrna(self.chrom_seq), self.transcript_seq)\n self.assertEqual(self.t.get_cds(self.chrom_seq), self.inframe_cds_seq)\n self.assertEqual(self.t.get_cds(self.chrom_seq, in_frame=False), self.cds_seq)\n self.assertEqual(self.t.get_prot...
[ "0.68494034", "0.6827028", "0.6589176", "0.65395045", "0.65141827", "0.65008366", "0.6499456", "0.64786434", "0.6472841", "0.6369248", "0.63641524", "0.63555324", "0.6309749", "0.63069963", "0.6296829", "0.62372506", "0.6227087", "0.6224931", "0.6202431", "0.60909975", "0.608...
0.6874728
1
Tests the conversion of chromosome/transcript/cds coordinates into individual amino acids.
def test_amino_acid_slicing(self): chrom_result = [None, "Y", "Y", "Y", None, None, None] for i in xrange(len(chrom_result)): self.assertEqual(self.t.chromosome_coordinate_to_amino_acid(i, self.chrom_seq), chrom_result[i]) cds_result = ["Y", "Y", "Y", None] for i in xrange(le...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_amino_acid_slicing(self):\n chrom_result = [None, None, None, None, \"R\", \"R\", None, \"R\", \"A\", \"A\", None, None,\n \"A\", None, None, None]\n for i in xrange(len(chrom_result)):\n self.assertEqual(self.t.chromosome_coordinate_to_amino_acid(i, self.ch...
[ "0.79467404", "0.78851515", "0.6803442", "0.6741371", "0.6730588", "0.6724373", "0.6722188", "0.67108667", "0.6659613", "0.66537243", "0.6625853", "0.65557414", "0.655514", "0.6540536", "0.6538844", "0.65250623", "0.65198827", "0.65152", "0.65103084", "0.6509142", "0.64945513...
0.81207925
0