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
Assign Tags and Mentions to a Post(type) by parsing the description.
def on_saved_post(sender, instance, created, **kwargs): # If the post was just created, stop here since we have no tags yet if created: return if not issubclass(sender, dillo.models.posts.Post): return # Extract tags and mentions from text and assign them to the Post tags, mentions =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_meta(self, post, *args, **kwargs):\n\t\tsuper(Command, self).add_meta(post, *args, **kwargs)\n\t\tpost.gen_description = False\n\t\tpost.description = description_from_content(post)\n\t\tpost.save()", "def post(self, post_id=None):\n\n if post_id:\n abort(400)\n else:\n ...
[ "0.612241", "0.59482175", "0.5902697", "0.5901005", "0.5845779", "0.58072627", "0.5710131", "0.56681836", "0.5645754", "0.5642677", "0.5604725", "0.5604725", "0.55815965", "0.55642414", "0.54975563", "0.54782796", "0.5466466", "0.54545844", "0.54401195", "0.54401195", "0.5419...
0.6026173
1
Create activity for published Post.
def on_post_published(sender, instance: dillo.models.posts.Post, **kwargs): # If activity was already created (the post was already published), # skip this signal to prevent the activity from appearing twice in the feeds. if models_actstream.Action.objects.filter( actor_object_id=instance.user.id, a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_to_activity(self, post):\n id = None\n if post.get('id'):\n # strip USERID_ prefix if it's there\n post['id'] = post['id'].split('_', 1)[-1]\n id = post['id']\n\n obj = self.post_to_object(post)\n activity = {\n 'verb': VERBS.get(post.get('type', obj.get('objectType')), 'po...
[ "0.74787325", "0.6533647", "0.64678", "0.6233577", "0.62174255", "0.61825395", "0.6088378", "0.60738593", "0.60658085", "0.6014791", "0.6014791", "0.6007368", "0.5983524", "0.5974287", "0.5948988", "0.5934463", "0.58406353", "0.58193", "0.58059466", "0.5795128", "0.5768188", ...
0.6908637
1
Actions to perform once a Like is created.
def on_created_like(sender, instance: dillo.models.mixins.Likes, created, **kwargs): if ( isinstance(instance.content_object, dillo.models.comments.Comment) and instance.content_object.parent_comment ): target = instance.content_object.parent_comment else: target = None ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def like(self):\n self.like_count = self.like_count + 1 if self.like_count else 1", "def like():\n if CURR_USER_KEY in session:\n cafe_id = int(request.json[\"cafe_id\"])\n print(type(cafe_id))\n user_id = g.user.id\n print(type(user_id))\n like = Like(\n c...
[ "0.6593319", "0.6169452", "0.6148844", "0.6112476", "0.6108443", "0.6105551", "0.60661376", "0.60419214", "0.6040893", "0.59646094", "0.59646094", "0.59571815", "0.5945115", "0.5939536", "0.5915928", "0.5865272", "0.58126223", "0.5807308", "0.5788529", "0.57406265", "0.572260...
0.74319637
0
Decrease user profile likes of 1. The function is available as standalone for easier unit testing.
def profile_likes_count_decrease(target_user: User): try: with transaction.atomic(): dillo.models.profiles.Profile.objects.filter(user=target_user).update( likes_count=F('likes_count') - 1 ) except IntegrityError: log.warning('Integrity error when incremen...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_deleted_like(sender, instance: dillo.models.mixins.Likes, **kwargs):\n if not instance.content_object:\n return\n target_user = instance.content_object.user\n profile_likes_count_decrease(target_user)\n log.debug('Decreased like count for user %s' % target_user)", "def unlike(self, data...
[ "0.7092867", "0.69812095", "0.6517912", "0.61881864", "0.61731464", "0.6097247", "0.6096408", "0.6036876", "0.5903274", "0.58781475", "0.58778524", "0.5823332", "0.5778853", "0.5737949", "0.5679264", "0.563741", "0.55705523", "0.5514937", "0.54584485", "0.5454046", "0.5450492...
0.8061975
0
Decrease likes_count for profile when Entity or Comment is unliked.
def on_deleted_like(sender, instance: dillo.models.mixins.Likes, **kwargs): if not instance.content_object: return target_user = instance.content_object.user profile_likes_count_decrease(target_user) log.debug('Decreased like count for user %s' % target_user)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def profile_likes_count_decrease(target_user: User):\n try:\n with transaction.atomic():\n dillo.models.profiles.Profile.objects.filter(user=target_user).update(\n likes_count=F('likes_count') - 1\n )\n except IntegrityError:\n log.warning('Integrity error w...
[ "0.74382937", "0.68135536", "0.62009215", "0.61690074", "0.6078528", "0.5979719", "0.5800343", "0.5772288", "0.5705149", "0.56960106", "0.5675965", "0.56723356", "0.5662375", "0.56615674", "0.5642525", "0.56078047", "0.56078047", "0.56078047", "0.5589605", "0.5575719", "0.557...
0.7310249
1
Fetch social account name and avatar, and add them to the Profile.
def on_social_account_added(sender, instance: SocialAccount, created, **kwargs): if not created: return name = instance.extra_data.get('name') if name: log.debug('Updating name via socialaccount for user %i' % instance.user.id) instance.user.profile.name = name instance.user....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_profile(self,soup,Name,Profile_url):\n h3=soup.find(\"h3\")\n \n if h3 !=None:\n if h3.find(\"a\")!=None: \n name=h3.a.get_text()\n if h3.a.has_attr('href') :\n h3_a_tag=h3.a['href']\n h3_a_tag=h3_...
[ "0.62179977", "0.61199266", "0.61171144", "0.6097713", "0.60976326", "0.60648817", "0.605172", "0.60389084", "0.6031145", "0.60300606", "0.60167927", "0.6015737", "0.6003023", "0.5930042", "0.5929104", "0.5922604", "0.59004813", "0.59002423", "0.58768433", "0.58611965", "0.58...
0.76166373
0
On action created, fan out notifications
def on_created_action(sender, instance: models_actstream.Action, created, **kwargs): if not created: return # If content_type is Post or Profile if ( instance.action_object_content_type == ContentType.objects.get_for_model(dillo.models.posts.Post) and instance.verb == 'poste...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def action_defined(sender, instance, created, raw, using, **kwargs):\n if created:\n raw_hook_event.send(\n sender=None,\n event_name=\"action_defined\",\n instance=instance,\n payload=ActionSerializer(instance).data,\n user=instance.team,\n )...
[ "0.63869154", "0.6225311", "0.6225311", "0.6225311", "0.6225311", "0.6144163", "0.5890172", "0.58513165", "0.58451253", "0.5807999", "0.57855886", "0.57809436", "0.5763071", "0.5763071", "0.57493734", "0.5724776", "0.572035", "0.5714243", "0.5679732", "0.5625895", "0.55907756...
0.7528839
0
updates the precision and recall data in the image_matching_module's results
def update_precision_and_recall(experiment_dict, list_dict, algorithm_name, thresholds): for threshold in thresholds: algorithm_column_name = algorithm_name + "_actual" tp = experiment_dict[str(threshold)][algorithm_name][list_dict['TP']] fp = experiment_dict[str(threshold)][...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluate_matrices(self, precision_matrix, recall_matrix):\n\t\tground_truth_count = precision_matrix.shape[0]\n\t\tdetection_count = precision_matrix.shape[1]\n\t\tground_truth_sets_precision = defaultdict(set) # number of ground truth items that match a particular detection in the precision matrix\n\t\tdetect...
[ "0.625239", "0.6167243", "0.6078468", "0.6062458", "0.60042554", "0.5945311", "0.59133434", "0.5907834", "0.5897664", "0.587507", "0.58680505", "0.58505803", "0.5835626", "0.5821899", "0.58180785", "0.57850605", "0.5741462", "0.5735853", "0.57268965", "0.5706414", "0.5699125"...
0.6408821
0
find dir, create it if it doesn't exist
def find_and_create_dirs(dir_name): if os.path.exists(dir_name) is False: os.makedirs(dir_name) return dir_name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_dir_if_needed(dir) :\n\tif not exists(dir) :\n\t\tos.makedirs(dir)", "def _find_or_create_dir(dir_name: str) -> str:\r\n # Get the directory of the current file.\r\n parent_dir_path = os.path.dirname(os.path.realpath(__file__))\r\n \r\n # Create a directory if it doesn't exist.\r\n dir_pa...
[ "0.78143203", "0.7572564", "0.75672174", "0.7505218", "0.7405751", "0.73660105", "0.7318875", "0.7313977", "0.7313617", "0.7306224", "0.7281798", "0.7190104", "0.7147234", "0.7147234", "0.7122194", "0.7111919", "0.7110475", "0.7098091", "0.70818955", "0.70818603", "0.7077556"...
0.7628102
1
Return a series of spheres centered on the current center of mass with radius decreasing by stepsize. Stop when inner_radius is reached.
def iterate_center_of_mass(sphere, inner_radius, stepsize=0.05, com_kwargs=None): if com_kwargs is None: com_kwargs = {} yield sphere while (sphere.radius > inner_radius): com = sphere.quantities.center_of_mass(**com_kwargs) try: sphere = sphe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Icosphere(radius=1.0, center=(0.0, 0.0, 0.0), nsub=3):\n mesh = Icosahedron()\n mesh.clear_data()\n mesh = mesh.subdivide(nsub=nsub)\n\n # scale to desired radius and translate origin\n dist = np.linalg.norm(mesh.points, axis=1, keepdims=True) # distance from origin\n mesh.points = mesh.poin...
[ "0.63789153", "0.6274192", "0.61310375", "0.61086935", "0.6108442", "0.60960174", "0.60567", "0.601587", "0.5988825", "0.5943185", "0.5924592", "0.5862869", "0.58270377", "0.5824245", "0.5806278", "0.5776951", "0.5719401", "0.5662561", "0.56606776", "0.559281", "0.559004", ...
0.75595194
0
Get list of savegame files
def getSaveGames(): dll = ctypes.windll.shell32 buf = ctypes.create_unicode_buffer(ctypes.wintypes.MAX_PATH + 1) try: if dll.SHGetSpecialFolderPathW(None, buf, 0x0005, False): savedir = osp.join(buf.value, "My Games", "Skyrim", "Saves") if not osp.exists(savedir) or not osp.i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def readPlayerImageFiles(self):\n currentPath = os.path.dirname(os.path.abspath(__file__))\n listOfFileNames=[]\n for i in os.listdir(currentPath):\n if re.match(\"player\\_\\d+\",i): #i.endswith(\".gif\")\n listOfFileNames.append(currentPath+'/'+i)\n return li...
[ "0.7067182", "0.6939934", "0.6672595", "0.6662785", "0.662831", "0.6571709", "0.65469205", "0.6523936", "0.6403642", "0.63961196", "0.6357462", "0.63361794", "0.6335132", "0.6324376", "0.6322563", "0.630025", "0.6292312", "0.6264926", "0.62489045", "0.6243798", "0.6222176", ...
0.7966331
0
Whether to use L2 weight decay for `param_name`.
def _do_use_weight_decay(self, param_name): if not self.weight_decay_rate: return False if self.exclude_from_weight_decay: for r in self.exclude_from_weight_decay: if re.search(r, param_name) is not None: return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _do_use_weight_decay(self, param_name):\n if self._exclude_from_weight_decay:\n for r in self._exclude_from_weight_decay:\n if re.search(r, param_name) is not None:\n return False\n return True", "def _do_use_weight_decay(self, param_name):\n ...
[ "0.70423925", "0.70372206", "0.6972458", "0.6972458", "0.6972458", "0.6972458", "0.61478865", "0.61143965", "0.60728186", "0.5874968", "0.57316977", "0.5686603", "0.5607701", "0.5540735", "0.5532297", "0.5527218", "0.5491086", "0.5461098", "0.5446388", "0.54453504", "0.544086...
0.70576096
0
Whether to use L2 weight decay for `param_name`.
def _do_use_weight_decay(self, param_name): if not self.weight_decay_rate: return False if self.exclude_from_weight_decay: for r in self.exclude_from_weight_decay: if re.search(r, param_name) is not None: return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _do_use_weight_decay(self, param_name):\n if self._exclude_from_weight_decay:\n for r in self._exclude_from_weight_decay:\n if re.search(r, param_name) is not None:\n return False\n return True", "def _do_use_weight_decay(self, param_name):\n ...
[ "0.70423925", "0.70372206", "0.6972458", "0.6972458", "0.6972458", "0.6972458", "0.61478865", "0.61143965", "0.60728186", "0.5874968", "0.57316977", "0.5686603", "0.5607701", "0.5540735", "0.5532297", "0.5527218", "0.5491086", "0.5461098", "0.5446388", "0.54453504", "0.544086...
0.70576096
1
activet the sensor with sensor index This function activates a specific sensor having a matched sensor index among multiple sensors if there are multiple sensors in system. \brief Activate a specific sensor This function activates a specific sensor having a matched sensor index among multiple sensors if there are multi...
def index_activation(pSpecDevice, sensor_index): ret = pSpecDevice.duActivateSensorWithIndex(sensor_index) if ret <=0: print ("[PythonPrismError] Activating Sensor with Index failed!") return -1; else: print ("[PythonPrism] Successfully Activated the sesnor with specific in...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def activate_item(self, index):\n item = index.model().listdata[index.row()]\n self.get_selected(item)\n self.controller.display_item(item)", "def activate(self):\n super(ActiveIndexedComponent, self).activate()\n if self.is_indexed():\n for component_data in iterval...
[ "0.5475209", "0.5446762", "0.5374098", "0.52927256", "0.5236261", "0.517365", "0.4991842", "0.49528223", "0.4937684", "0.4916082", "0.4858801", "0.48299465", "0.47647876", "0.47303236", "0.47166547", "0.47158837", "0.4614805", "0.4611197", "0.45979622", "0.45724156", "0.45665...
0.8379042
0
Verify the Jenkins Config History plugin has been configured properly.
def test_job_config_history(self): self.config_page.visit() self.config_page.expand_advanced() assert self.job_config_history['HISTORY_ROOT_DIR'] == self.config_page.get_history_root_dir() assert self.job_config_history['MAX_HISTORY_ENTRIES'] == self.config_page.get_max_history_entries()...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_config(self):", "def check_configs(self):\n\n pass", "def check_config():\n\n if not config_instance:\n LOG.error(\"Failed to load the config!\")\n sys.exit(9)\n\n if not hasattr(config_instance, \"CONFIG_VERSION\"):\n LOG.warning( \"The config file does not specify...
[ "0.6823133", "0.67036337", "0.6660288", "0.66462886", "0.6567653", "0.63230246", "0.629709", "0.6247693", "0.62097293", "0.61033195", "0.6071187", "0.6071187", "0.6033012", "0.5999714", "0.5996398", "0.5953271", "0.59522414", "0.5932529", "0.5889813", "0.58763665", "0.5860229...
0.7349895
0
Saves a 'allbatteriesincluded' feature generator at a given path (folder)
def save(self, path: str): os.makedirs(path, exist_ok=True) frozen = encode_indent(self) lprint(f"Saving feature generator to: {path}") with open(join(path, "feature_generation.json"), "w") as json_file: json_file.write(frozen) return frozen
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_features_to_file(self):\n if not os.path.exists(self.features_save_path):\n os.makedirs(self.features_save_path)\n for s in self.sets:\n self.save_features_to_file_by_set(s)", "def save(self, folder):\n self.generator.save_weights('%s/generator.h5'%folder)\n ...
[ "0.6550367", "0.63035154", "0.62864685", "0.6070348", "0.60682887", "0.6041556", "0.5851316", "0.57868385", "0.5766876", "0.57223296", "0.56905526", "0.56848353", "0.56739694", "0.5669084", "0.5645307", "0.5645307", "0.5635035", "0.56290305", "0.5603846", "0.55711997", "0.553...
0.6561969
0
Returns the receptive field radius in pixels
def get_receptive_field_radius(self): raise NotImplementedError()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def estimate_radius(self):\n red = self.T[:,:,0] # empirically, the most reliable channel\n\n eye_radius = red.sum(axis=1).max() / 2\n return eye_radius", "def get_receptive_field_radius(self) -> int:\n\n receptive_field_radius = 0\n for feature_group in self.features_group_lis...
[ "0.76650316", "0.7617731", "0.7569536", "0.75477064", "0.730754", "0.72716415", "0.7263465", "0.72270113", "0.72229064", "0.72219", "0.72117025", "0.71374255", "0.71154857", "0.71154857", "0.71154857", "0.71154857", "0.71154857", "0.7106693", "0.71053755", "0.7082142", "0.708...
0.7922638
0
Creates a feature array of the right size and possibly in a 'lazy' way using memory mapping.
def create_feature_array(self, image, nb_features): with lsection(f'Creating feature array for image of shape: {image.shape}'): # That's the shape we need: shape = (nb_features, image.shape[0]) + image.shape[2:] dtype = image.dtype if self.dtype is None else self.dtype ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def memmap_feats(features):\n features = np.array(features)\n dtype = features.dtype\n feats_shape = features.shape\n\n outfile = TemporaryFile()\n fp = np.memmap(outfile, dtype=dtype, mode='w+', shape=feats_shape)\n fp[:] = features[:]\n fp.flush()\n del features\n del fp\n logging.i...
[ "0.6230521", "0.6202618", "0.5860363", "0.5834283", "0.57285964", "0.57285964", "0.5699803", "0.565439", "0.55717295", "0.5529149", "0.54918015", "0.5489064", "0.5474994", "0.5464324", "0.5447807", "0.5440975", "0.54392403", "0.54379714", "0.5425065", "0.53975654", "0.5385166...
0.66130865
0
Decides if there is a majority among the votes
def iterative_majority(votes): half = len(votes)//2 counts = defaultdict(lambda: 0) for vote in votes: counts[vote] += 1 sorted_counts = sorted((count for count in counts.values()), reverse=True) return (Outcome.has_majority if sorted_counts[0] > half else Outcome.no_majority)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def majority_vote(votes):\n import scipy.stats as ss\n mode, count = ss.mstats.mode(votes)", "def naive_majority(voters):\n half = len(voters)//2\n for index, voter in enumerate(voters):\n count = 0\n for other_voter in voters:\n if voter == other_voter:\n coun...
[ "0.8047089", "0.78859496", "0.7793428", "0.7649061", "0.759137", "0.7395394", "0.7320145", "0.7288646", "0.72348565", "0.71879995", "0.6928337", "0.67314535", "0.6582607", "0.65114915", "0.6500682", "0.6484041", "0.6430799", "0.6409211", "0.6389137", "0.63407356", "0.63311565...
0.7945168
1
Returns a list of merged variant(s) from the provided `variants`.
def get_merged_variants(self, variants, key): # type: (List[vcfio.Variant], str) -> List[vcfio.Variant] raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exclude_duplicates(self, variants):\n \n unique_vars = {}\n for variant in variants:\n key = variant[0].child.get_key()\n if key not in unique_vars:\n unique_vars[key] = list(variant)\n else:\n result = variant[1]\n ...
[ "0.657678", "0.6056205", "0.59043044", "0.5827425", "0.5802855", "0.5766344", "0.55869615", "0.5510106", "0.5472591", "0.53676164", "0.53660834", "0.53125113", "0.5301464", "0.5296049", "0.5262057", "0.525347", "0.5252048", "0.5224145", "0.52215767", "0.5197025", "0.51750356"...
0.74890333
0
Returns a generator of keys (str) used for merging variants.
def get_merge_keys(self, variant): # type: (vcfio.Variant) -> Iterable[str] raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gen_keys():", "async def keys(self) -> Iterable[str]:", "def random_keys(self):\n while True:\n yield self.generator.str()", "def keys(self) -> Sequence[str]:\n raise NotImplementedError", "def gen_decomp_keys(self, decomp_list):\n for key in decomp_list:\n if...
[ "0.6789153", "0.6568766", "0.6476109", "0.64546305", "0.6377591", "0.62587345", "0.62532", "0.6250463", "0.62424064", "0.62237823", "0.6207848", "0.6157455", "0.610816", "0.60871756", "0.6028108", "0.601163", "0.59775627", "0.59563607", "0.5953673", "0.59474635", "0.59450173"...
0.6784472
1
Optionally modifies the bigquery schema based on merging logic.
def modify_bigquery_schema(self, schema, info_keys): # type: (bigquery.TableSchema, Set[str]) -> None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def merge_schema(self, schema):\n self.validate_schema(schema)\n\n if self.exclusive is False:\n self.exclusive = schema.exclusive\n\n if self.default is None:\n self.default = schema.default", "def merge_schema(first, second):\n if not (type(first) == type(second) =...
[ "0.6379471", "0.6048851", "0.59542614", "0.59007806", "0.5778663", "0.5664556", "0.5654739", "0.5611729", "0.5603805", "0.5579028", "0.5564193", "0.54974824", "0.54887533", "0.5486523", "0.5463733", "0.54462385", "0.5430294", "0.54173553", "0.5397434", "0.5388764", "0.5323661...
0.6154523
1
Creates a SkyScanner object with default country, currency, and local which can be changed as necessary. In addition, a requests session is made.
def __init__(self, originCountry = "US", currency = "USD", locale="en-US"): self.originCountry = originCountry self.currency = currency self.locale = locale self.rootURL = "https://skyscanner-skyscanner-flight-search-v1.p.rapidapi.com" #path to the API self.airports = {} ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _scan(self):\n\n return self._scan_factory.make_scan(\n image_range=(1, 1),\n # dummy value--return to this later please\n exposure_time=1,\n oscillation=(\n self.detectorbase.osc_start,\n self.detectorbase.osc_start + self.detect...
[ "0.47756967", "0.47718138", "0.4711326", "0.47016704", "0.46773443", "0.4665861", "0.46638766", "0.46559757", "0.46452054", "0.46146983", "0.45960456", "0.45547736", "0.45530304", "0.45436147", "0.45220035", "0.45085174", "0.44786787", "0.44782293", "0.44725567", "0.44702947", ...
0.6197627
0
Gets the quotes for two specific dates. Only for 1way trips. Returns both 1) quotes in JSON format and 2) a dict of airport_code > airport_name
def get_quotes_oneway(self, source, destination, outboundDate): quoteRequestPath = "/apiservices/browsequotes/v1.0/" browseQuotesURL = self.rootURL + quoteRequestPath + self.originCountry + "/" + self.currency + "/" + self.locale + "/" + source + "/" + destination + "/" + outboundDate + "/" resp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_quotes(scanner: SkyScanner, start, end, start_date, entire_month=\"false\"):\n all_quotes = []\n if entire_month == \"false\":\n quotes, airports = scanner.get_quotes_oneway(start, end, start_date)\n else:\n start_date = start_date.split(\"-\")[0] + \"-\" + start_date.split(\"-\")[1]...
[ "0.59062976", "0.56777614", "0.53988975", "0.53696054", "0.5356138", "0.5263399", "0.5209945", "0.5087088", "0.50474745", "0.49753934", "0.49591064", "0.49152985", "0.49046555", "0.48815036", "0.48767883", "0.48675764", "0.4862268", "0.48283228", "0.4813378", "0.4811284", "0....
0.6263273
0
Returns places that match a specific search query. Can choose to exclude countries or cities. Airports are always returned.
def search_places(self, search, country="True", city="True"): params = {} params["query"] = search params["includeCities"] = city params["includeCountries"] = country placeRequestPath = "/apiservices/autosuggest/v1.0/" browsePlacesURL = self.rootURL + placeRequestPath + s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search():\n\n # Store the 'q' part of the URL as a string called 'q'. Check 'q' loaded, and produce runtime error if not.\n # e.g. '12589'\n q = request.args.get(\"q\")\n if not q:\n raise RuntimeError(\"missing location\")\n\n # Rewrites user input as lowercase\n q = str.lower(q)\n\n ...
[ "0.7065333", "0.6633748", "0.6569348", "0.6467306", "0.64596575", "0.63857245", "0.6306432", "0.62548643", "0.61801684", "0.6125794", "0.61072093", "0.60262483", "0.59899133", "0.595883", "0.59574234", "0.5949816", "0.5907867", "0.58415496", "0.58353376", "0.5792506", "0.5788...
0.66791874
1
Returns the cheapest quote and then all other quotes given the params and a scanner object
def get_quotes(scanner: SkyScanner, start, end, start_date, entire_month="false"): all_quotes = [] if entire_month == "false": quotes, airports = scanner.get_quotes_oneway(start, end, start_date) else: start_date = start_date.split("-")[0] + "-" + start_date.split("-")[1] quotes, air...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def first_inside_quotes(s):\n\n assert type(s) == str, repr(s)+' is not a string.'\n assert introcs.count_str(s,'\"') >= 2, repr(s)+' needs two \"\" characters.'\n\n #find first double quotation\n\n first = introcs.find_str(s,'\"')\n #print(first)\n #find second double quotation\n\n second = i...
[ "0.58224344", "0.5512561", "0.50302064", "0.48981693", "0.48731175", "0.47719675", "0.47137618", "0.4713489", "0.46993667", "0.4697319", "0.46878594", "0.46744052", "0.46669102", "0.46645442", "0.46498346", "0.45787597", "0.45504197", "0.45458466", "0.4529796", "0.45278853", ...
0.5722081
1
Train the policy network using the collected experiences during the episode(s).
def train_agent(self): # Retrieve collected experiences from memory experiences = np.array(self.replay.get_all()) # rewards = np.array([h['reward'] for h in experiences]) #rewards = experiences[:,2] rewards = np.array([r[2] for r in experiences]) # Discount and normalize ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train(self, env):\n\n\t\tmin_average_reward_for_stopping = 195\n\t\tconsecutive_successful_episodes_to_stop = 10\n\t\tlast_10_rewards = deque(maxlen=consecutive_successful_episodes_to_stop)\n\n\t\tnum_Episodes = []\n\t\tEpisode_Rewards = []\n\n\t\tfor episode in range(self.episodes):\n\t\t\tstate = env.reset()...
[ "0.7571355", "0.73662174", "0.7365849", "0.7270195", "0.7265887", "0.71922773", "0.7191969", "0.7185173", "0.716789", "0.7138937", "0.7132511", "0.71263695", "0.7119303", "0.7110821", "0.7008673", "0.6987574", "0.6936", "0.69279706", "0.6918577", "0.6911287", "0.6890119", "...
0.77739614
0
QRectF.adjusted(float, float, float, float) > QRectF
def adjusted(self, p_float, p_float_1, p_float_2, p_float_3): # real signature unknown; restored from __doc__ return QRectF
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def boundingRect(self) -> QRectF:\n return self._rect.adjusted(-10, -10, 10, 10)", "def boundingRect(self):\n return QRectF()", "def boundingRect(self):\n extra = self._halfLength / 2.0\n return QRectF(self._origin, QSizeF(self._end.x() - self._origin.x(),\n ...
[ "0.7523984", "0.7407381", "0.6920634", "0.68608844", "0.6679734", "0.6560438", "0.64691794", "0.6168941", "0.59401673", "0.5911161", "0.5906248", "0.5896799", "0.58789915", "0.5817213", "0.57800424", "0.5741719", "0.57302284", "0.57062167", "0.563075", "0.56293607", "0.561055...
0.82418644
0
QRectF.getCoords() > (float, float, float, float)
def getCoords(self): # real signature unknown; restored from __doc__ pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_box_coordinates(self):\n return QRect(self.box_begin,self.box_end)", "def getRect(self): # real signature unknown; restored from __doc__\r\n pass", "def coordinates(self):", "def boundingRect(self):\n return QRectF()", "def get_pos(self) -> tuple:\n return self.rect....
[ "0.7368357", "0.66639704", "0.66209674", "0.65601283", "0.64767325", "0.64313006", "0.64045686", "0.63729024", "0.6357421", "0.6334392", "0.6302994", "0.6292692", "0.62892866", "0.6275379", "0.6220668", "0.62196934", "0.61438215", "0.6137749", "0.6102628", "0.60969114", "0.60...
0.6971415
1
QRectF.getRect() > (float, float, float, float)
def getRect(self): # real signature unknown; restored from __doc__ pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def boundingRect(self):\n return QRectF()", "def getRect(self):\n return self.rect()", "def getRect(self):\n return self.rect", "def get_view_rect(self) -> core.QRect:\n r = core.QRectF(self.rect())\n return self.viewportTransform().inverted()[0].mapRect(r)", "def get_box...
[ "0.7405999", "0.7291851", "0.7247606", "0.7115561", "0.705903", "0.70336133", "0.70179623", "0.6998176", "0.6907978", "0.6870234", "0.6763795", "0.6759248", "0.67521775", "0.66974133", "0.66245663", "0.6588025", "0.6582874", "0.657484", "0.65584433", "0.65322214", "0.65298295...
0.7626621
0
QRectF.setRect(float, float, float, float)
def setRect(self, p_float, p_float_1, p_float_2, p_float_3): # real signature unknown; restored from __doc__ pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setRect(self, *args):\n if len(args) == 0:\n self.resetTransform() # reset scaling and rotation when called without argument\n return\n if isinstance(args[0], (QtCore.QRectF, QtCore.QRect)):\n rect = args[0] # use QRectF or QRect directly\n else:\n ...
[ "0.811456", "0.72924024", "0.6899937", "0.67006505", "0.66871715", "0.6679867", "0.66333675", "0.66026175", "0.65830314", "0.6501076", "0.6378331", "0.63138497", "0.6312193", "0.6284299", "0.62495655", "0.6125737", "0.6122323", "0.6093273", "0.60838044", "0.6054471", "0.60270...
0.77824867
1
QRectF.translated(float, float) > QRectF QRectF.translated(QPointF) > QRectF
def translated(self, *__args): # real signature unknown; restored from __doc__ with multiple overloads return QRectF
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def adjusted(self, p_float, p_float_1, p_float_2, p_float_3): # real signature unknown; restored from __doc__\r\n return QRectF", "def updatePosition(self, scene):\n pos0 = scene.posFromLonLat(self._lon0, self._lat0)\n pos1 = scene.posFromLonLat(self._lon1, self._lat1)\n\n self.prepar...
[ "0.68442065", "0.5737175", "0.5611309", "0.5594033", "0.5561529", "0.55589247", "0.54844475", "0.5468499", "0.54548025", "0.541805", "0.53979594", "0.53938884", "0.53861076", "0.5311449", "0.52604544", "0.52604544", "0.5161839", "0.51586455", "0.5154933", "0.51431406", "0.512...
0.7493262
0
Get mobilenet_v3 large model
def get_mobilenet_v3(model_name:str, pretrained=True, **kwargs) -> nn.Module: mbconfig = partial(MBConvConfig, depth_mult=1.0, width_mult=1.0, norm_layer=nn.BatchNorm2d, se_act2=partial(nn.Hardsigmoid, inplace=True), se_reduction_ratio=4, se_reduce_mode='adjust') if model_name == 'mobil...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mobilenet_v3_large(pretrained: bool = False, include_top: bool = False, freeze: bool = False):\n model = torchvision.models.mobilenet_v3_large(pretrained)\n if freeze:\n set_parameter_requires_grad(model, \"classifier\")\n if not include_top:\n output_size = model.classifier[0].in_featur...
[ "0.73536885", "0.72899085", "0.71932006", "0.7060566", "0.6891054", "0.6839438", "0.6653818", "0.65547043", "0.64544296", "0.64085776", "0.63266057", "0.63144726", "0.6296878", "0.6257561", "0.62444127", "0.6231361", "0.619437", "0.6168173", "0.61530125", "0.6107736", "0.6062...
0.7593799
0
Initialize the runner, optionally with text to validate. (If not a string, it must be an OrderedDict, ideally straight out of the parser.)
def __init__(self, text: Union[str, Text, None] = None): if isinstance(text, str): text = TNTParser().parse(text) if text is not None: self.text = text
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate(self, text: Union[str, Text, None] = None) -> None:\n text = text or self.text\n if isinstance(text, str):\n text = TNTParser().parse(text)\n if text is not None:\n self.text = text\n try:\n for i, (lineno, line) in enumerate(text.items()):\...
[ "0.5885243", "0.57479566", "0.5742945", "0.57244945", "0.5588444", "0.558445", "0.5526332", "0.5523798", "0.5482151", "0.5470329", "0.54604083", "0.54574263", "0.54541725", "0.5433209", "0.5433209", "0.5429169", "0.54059213", "0.54005533", "0.5378159", "0.5374998", "0.5370741...
0.645403
0
Validates the OrderedDict of line numbers to TNT statements. If no issues, returns None. Otherwise, raises an exception tailored to the rule. ``text`` can be set at initialization or passed at call.
def validate(self, text: Union[str, Text, None] = None) -> None: text = text or self.text if isinstance(text, str): text = TNTParser().parse(text) if text is not None: self.text = text try: for i, (lineno, line) in enumerate(text.items()): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check(text):\n text = text.copy()\n if not isinstance(text,list): # TEST\n raise TypeError(\"text must be a listlike :\\n{}\".format(text))\n \n # managing latex genuine tag\n for i, line in enumerate(text):\n if '\\\\' in line:\n utils.underlineall(line,'\\\\')\n ...
[ "0.5193765", "0.5154263", "0.505798", "0.49654058", "0.4808358", "0.47402716", "0.4713079", "0.47065118", "0.47031403", "0.47010857", "0.46935087", "0.46704283", "0.465404", "0.46469313", "0.46239817", "0.46209937", "0.46112055", "0.460087", "0.45773935", "0.4564255", "0.4562...
0.6640136
0
Returns True if ``obj`` has any parent Fantasy ``fantasy``.
def find_fantasy(self, fantasy: Fantasy, obj: Union[Statement, Fantasy]) -> bool: if fantasy is None: return True # all objects have top level as parent fant = obj.fantasy while fant is not None: fant = fant.fantasy if fant is fantasy: return T...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_parent(obj, parent_name):\n if obj.parent is None:\n return False\n if obj.parent.name is None:\n return False\n elif obj.parent.name == parent_name:\n return True\n else:\n return has_parent(obj.parent, parent_name)", "def is_known(self, child):\r\n return ...
[ "0.6535494", "0.63880473", "0.6018726", "0.59466255", "0.59413505", "0.5922115", "0.5884263", "0.5848098", "0.5846054", "0.5814949", "0.58070546", "0.57707447", "0.57596886", "0.57503855", "0.57455945", "0.5726896", "0.5691056", "0.56856734", "0.5673926", "0.56407756", "0.563...
0.8815424
0
Returns True if the loop should continue, False if no action is needed. Raises MissingArgument with ``rule`` and ``arg`` in the exception message if the fantasy ends prematurely.
def raise_fantasy(self, idx: int, fantasy: Fantasy, rule: str, arg: str) -> bool: try: if idx < 0: # When idx < 0, it'll wrap to the end. Check for this instead. raise MissingArgument(rule + ' missing corresponding ' + arg) if self.text.vals[idx].fantasy i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def should_continue():\n\n return LoopContinueEvent()", "def has_rule(self):\n # Someday I'll have a real implementation, but for now I just:\n return False", "def check_args(self):\n parser = get_base_arguments(get_parser())\n parser = get_tc_arguments(parser)\n # Dis...
[ "0.5710809", "0.5579009", "0.5500455", "0.54977596", "0.5490412", "0.54401356", "0.5400107", "0.538158", "0.5363287", "0.5356038", "0.5355447", "0.5333873", "0.53159326", "0.53159326", "0.53159326", "0.53159326", "0.53159326", "0.5308262", "0.530587", "0.52823794", "0.5276743...
0.60716426
0
Raise TooManyReferrals if there are too many referrals.
def at_most_refs(self, line: Statement, count: int, rule: str) -> None: if len(line.referrals) > count: raise TooManyReferrals(f'too many referrals for {rule}: expected ' f'at most {count}, got {len(line.referrals)}')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_referrers_consistency(self):\n logger.info(\"Checking for inconsistent referrers field\")\n assigned_fix_reqs = set()\n\n # Get all assigned fixture requests. Ensure that the instance has the fixture request in it's list of referrers\n # If instance does not have the referrer,...
[ "0.5879438", "0.5434337", "0.539833", "0.5300049", "0.52206147", "0.51793766", "0.5150164", "0.5094897", "0.5081152", "0.50607497", "0.49575502", "0.49304283", "0.49287638", "0.4914705", "0.49128336", "0.49035567", "0.489277", "0.48598227", "0.484587", "0.48380458", "0.480528...
0.6889877
0
Find an argument that matches the cmp function.
def find_arg(self, idx: int, line: Statement, cmp: type(lambda: None), rule: str, argname: str) -> Statement: i = idx fantasy = line.fantasy while i > 0: i -= 1 # if True, text.vals[i] is in an inner fantasy than line, # and c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_arg(needle, haystack):\r\n for i in range(0, len(haystack)):\r\n if haystack[i] == needle:\r\n try:\r\n return haystack[i+1]\r\n except IndexError:\r\n pass\r\n return None", "def match_argname(argname, fallback=None, default=None):\n return class_predicate(argname, NameK...
[ "0.63055265", "0.5989534", "0.59502274", "0.59242034", "0.5879357", "0.5817449", "0.57719547", "0.57121897", "0.57012236", "0.5686402", "0.5519801", "0.5498948", "0.5480281", "0.5455657", "0.54323494", "0.5412333", "0.5405195", "0.5395234", "0.53883517", "0.53606737", "0.5351...
0.6921261
0
Creates a new instance of TrackwayDirectionStage.
def __init__(self, key, owner, **kwargs): super(TrackwayDirectionStage, self).__init__( key, owner, label='Trackway Direction', **kwargs) self._paths = []
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n super().__init__()\n self.waypoint_vector = [-1, 10]", "def _build_directions(self):\n d = {'start': self.get_start(), 'end': self.get_end(), 'duration': self.get_duration(),\n 'mode': self.get_primary_mode(), 'price_range': self.get_price_range(), 'legs': s...
[ "0.5205769", "0.5060475", "0.49711707", "0.4937936", "0.4937936", "0.48164803", "0.46623772", "0.46488953", "0.46384993", "0.46002585", "0.45988762", "0.4572386", "0.45723125", "0.45568055", "0.45305637", "0.45285165", "0.4508893", "0.44773376", "0.4474872", "0.4455077", "0.4...
0.6856049
0
Filter the queryset with the underlying form's `cleaned_data`. You must call `is_valid()` or `errors` before calling this method. This method should be overridden if additional filtering needs to be applied to the queryset before it is cached.
def filter_queryset(self, queryset): for name, value in self.form.cleaned_data.items(): queryset = self.filters[name].filter(queryset, value) # assert isinstance(queryset, models.QuerySet), \ # "Expected '%s.%s' to return a QuerySet, but got a %s instead." \ #...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _clean(self):\n return self._cleaned_data", "def clean(self):\n return self.cleaned_data", "def filter_queryset(self, request, queryset, view):\n form_id = view.kwargs.get(view.lookup_field, view.kwargs.get(\"xform_pk\"))\n lookup_field = view.lookup_field\n\n queryset = ...
[ "0.6860447", "0.67583185", "0.6699687", "0.66001344", "0.63974935", "0.6367156", "0.634692", "0.6310847", "0.6285551", "0.6239892", "0.6235133", "0.6218591", "0.6080913", "0.60272163", "0.601743", "0.5989977", "0.5984208", "0.59268767", "0.59214664", "0.5918033", "0.591439", ...
0.76146466
0
Welcome page quiz info and username form.
def welcome_page(): username = session.get('username') reset() if request.method == 'POST': if not username: session['username'] = request.form['username'] if username: return redirect(url_for('question_page')) return render_template('welcome.html', username=...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def welcome():\n on_session_start()\n return question(PRIME_QUESTION, intro=WELCOME_SPEECH)", "def test_welcome_exploration(self):\n self.init_player(\n '0', 'Welcome to Oppia!', 'do you know where the name \\'Oppia\\'')\n self.submit_and_compare(\n '0', 'Yes!', 'In fact...
[ "0.6697398", "0.6539233", "0.64245236", "0.63571936", "0.62531626", "0.6225158", "0.6220158", "0.6194444", "0.6194444", "0.6178174", "0.61647373", "0.61265844", "0.61160815", "0.60899746", "0.60562956", "0.6045096", "0.60315967", "0.602277", "0.5971155", "0.59668285", "0.5961...
0.7527604
0
Load the data and calculate heights.
def _initialise_data(self): data_graph = self._load_data() data_graph.calculate_max_heights() return data_graph
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getHeights(self):\n if self.heights: return self.heights\n reader = self.getReader()\n subData = reader.findSubRecord('VHGT','LAND')\n if not subData: return None\n height0 = struct.unpack('f',subData[:4])[0]\n import array\n deltas = array.array('b',subData[4:4...
[ "0.64111936", "0.6029936", "0.5960766", "0.59529585", "0.5880706", "0.5839389", "0.5756515", "0.5741466", "0.5675853", "0.5659828", "0.5659828", "0.5659828", "0.563116", "0.563116", "0.56030744", "0.5593001", "0.55927116", "0.5567349", "0.5567349", "0.552846", "0.5522765", ...
0.6433362
1
Test for foreign key constraints that don't have a corresponding index.
def test_missing_foreign_key_indices(db_session): from sqlalchemy_utils.functions import non_indexed_foreign_keys from kotti import metadata assert non_indexed_foreign_keys(metadata) == {}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_indexed_foreign_key(constraint):\n for index in constraint.table.indexes:\n index_column_names = set([\n column.name for column in index.columns\n ])\n if index_column_names == set(constraint.columns):\n return True\n return False", "def collect_drop_fk(sel...
[ "0.748976", "0.704024", "0.68740153", "0.6803409", "0.6442127", "0.63733286", "0.6137904", "0.6083083", "0.6067429", "0.59864193", "0.5934889", "0.57362586", "0.56498003", "0.56025785", "0.5596647", "0.5577209", "0.5565569", "0.5537458", "0.552599", "0.5427226", "0.5406838", ...
0.7493482
0
Discover this item using its id or description id. The description id is preferred as it provides more information, so if only an id is provided, libkol will first determine the desc_id. Note that this Returns an Item object but it is not automatically committed to the database. It is not sufficient to run `await item....
async def discover(cls, id: int = None, desc_id: int = None): if id is not None: desc_id = (await request.item_information(cls.kol, id).parse()).descid if desc_id is None: raise ItemNotFoundError( "Cannot discover an item without either an id or a desc_id" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_item_detail(item_id):\n pass", "def get_item_description(item_slug):\n return session.query(\n Items.description).filter_by(\n slug=item_slug).first()[0]", "def get_item(self, item_id): # pragma: no cover\n raise NotImplementedError", "def get_item(item_id):\n return It...
[ "0.5958962", "0.5945608", "0.58951426", "0.5857073", "0.5793325", "0.5768699", "0.57304674", "0.5702956", "0.5690138", "0.5687487", "0.56168866", "0.5571609", "0.5569454", "0.55473393", "0.5527266", "0.5521872", "0.54873824", "0.54755473", "0.541963", "0.54195684", "0.5334919...
0.80740875
0
Factory function to create a new currency from its ISO code
def create_currency_from_ISO(isocode): from .commodity import Commodity # if self.get_session().query(Commodity).filter_by(isocode=isocode).first(): # raise GncCommodityError("Currency '{}' already exists".format(isocode)) from .currency_ISO import ISO_currencies cur = ISO_currencies.get(isoc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getCurrencyIsoCode(id=None):", "def fromisoformat(cls, *args, **kwargs): # real signature unknown\r\n pass", "def from_code_and_minor(cls, currency_code, value):\n from .currency import currencies\n try:\n return cls(currencies[currency_code.upper()], value)\n except ...
[ "0.66242546", "0.63548607", "0.62624526", "0.6172577", "0.6047738", "0.5967506", "0.594702", "0.59417343", "0.5927033", "0.5797854", "0.5797854", "0.57801336", "0.5746309", "0.57142186", "0.56475854", "0.5633694", "0.563085", "0.56046224", "0.56037885", "0.5591195", "0.557395...
0.7708666
0
Factory function to create a new stock from its symbol. The ISO code of the quoted currency of the stock is stored in the slot "quoted_currency".
def create_stock_from_symbol(symbol, book=None): from .commodity import Commodity share = get_latest_quote(symbol) stock = Commodity( mnemonic=symbol, fullname=share.name, fraction=10000, namespace=share.exchange, quote_flag=1, quote_source="yahoo", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_symbol(symbol):\n st = Stock(symbol)\n return st.get_quote()", "def FromYfinance(symbol):\n stock = Stock(symbol)\n stock.Update()\n return stock", "def create(symbol, number_of_shares, purchase_price):\n stock = Stock(symbol, number_of_shares, purchase_price)\n databas...
[ "0.658607", "0.655007", "0.64967674", "0.6324575", "0.61781764", "0.61781764", "0.61742914", "0.61241645", "0.6066685", "0.6028303", "0.5916321", "0.58823574", "0.5855334", "0.58455604", "0.5823851", "0.58002996", "0.5796427", "0.5793406", "0.575277", "0.57361037", "0.5734318...
0.7477825
0
Creates a new textmessage SpamFilter trained on the given text messages and their associated labels. Performs any necessary preprocessing before training the SpamFilter's Naive Bayes Classifier. As part of this process, trains and stores the CountVectorizer used in the feature extraction process.
def __init__(self, text_train, labels_train): self.vectorizer = CountVectorizer(stop_words='english') self.features = self.vectorizer.fit_transform(text_train) self.nbc = MultinomialNB().fit(self.features, labels_train)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train_model(self, text, labels):\n clf = svm.SVR()\n count_vect = CountVectorizer()\n tfidf_transformer = TfidfTransformer()\n counts = count_vect.fit_transform(text)\n tfidf = tfidf_transformer.fit_transform(counts)\n clf.fit(tfidf, labels)\n\n return clf, coun...
[ "0.59928596", "0.5991479", "0.58972853", "0.5896386", "0.5881257", "0.58270174", "0.5791569", "0.57531697", "0.56607693", "0.5642098", "0.56038517", "0.55683374", "0.5556388", "0.5550796", "0.5503383", "0.54590356", "0.53853714", "0.53828907", "0.5378921", "0.5342874", "0.534...
0.624333
0
Takes the testset as input (2 DataFrames consisting of test texts and their associated labels), classifies each text, and then prints the classification_report on the expected vs. given labels.
def test_model (self, text_test, labels_test): print(classification_report(labels_test, self.classify(text_test)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_classification_report(y_train,y_test,y_train_preds,y_test_preds): \n try:\n for i in range(y_train.shape[-1]):\n test = (y_test.iloc[:,i].values, y_test_preds[:,i])\n train = (y_train.iloc[:,i].values, y_train_preds[:,i])\n print(f\"---------------{y_train.co...
[ "0.70495254", "0.6905331", "0.68044335", "0.67821795", "0.67230874", "0.6670411", "0.6623034", "0.6588332", "0.6568425", "0.652718", "0.64948666", "0.6488643", "0.6487697", "0.64806813", "0.64704436", "0.6383303", "0.6340591", "0.63397235", "0.6333492", "0.63176745", "0.63121...
0.75366956
0
Parses the Gaussian log file for the QM energy. Returns
def ReadGaussian(): # LICHEM calculates this as the optimization energy - self energy. # Self energy of the charges = {f} a.u. self_line = " Self energy of the charges" # SCF Done: E({s}) = {f} A.U. after {d} cycles SCF_line = " SCF Done:" with open('LICHM_GaussEnergy_0.log') as f: for ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_fermi_energy_from_log(log_file):\n with open(log_file, \"r\") as f:\n content = f.readlines()\n ferimiValues = EFermi_Pattern.findall(\"\".join(content))\n return list([float(item.split()[1]) for item in ferimiValues])", "def read_data_test_MLOG(self):\n self.na.set_query_timeout(...
[ "0.60903597", "0.575791", "0.5489557", "0.54672337", "0.5395261", "0.5361491", "0.5357795", "0.53484565", "0.53275615", "0.5284829", "0.5283435", "0.52671564", "0.5243411", "0.5235176", "0.5217604", "0.5205431", "0.51733214", "0.5166768", "0.515823", "0.51553243", "0.5126141"...
0.6854024
0
Parses the TINKER log file for the MM energy. Currently does not support AMOEBA polarization terms! Returns
def ReadTinker(): # Total Potential Energy : {f} Kcal/mole total_line = " Total Potential Energy :" with open('LICHM_TINKEREnergy_0.log') as f: for line in f: if line.startswith(total_line): # print(line) TinkE = re.findall(r'\-\d+\.*\d*', line) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_lammps_log(logfile):\n keys = None\n data = []\n read = False\n with open(logfile) as infile:\n for lines in infile:\n if lines.startswith('Step'):\n if data:\n yield keys, data\n keys = [i.lower() for i in lines.strip().split(...
[ "0.6170222", "0.6100037", "0.5945984", "0.59330875", "0.583597", "0.58223265", "0.573726", "0.5724382", "0.57241416", "0.5691281", "0.5658535", "0.55970955", "0.55613095", "0.5531624", "0.55298966", "0.5528802", "0.55086756", "0.5499865", "0.54951453", "0.54804593", "0.547738...
0.70619804
0
Choose a behavior class, based on the behaviorClass JSON attribute.
def get_behavior_class_from_dict(data): # TODO: Replace with a behavior package. class_map = { "PlayAnim": BehaviorPlayAnim, "PlayArbitraryAnim": BehaviorPlayArbitraryAnim, "ReactToCliff": BehaviorReactToCliff, "DriveOffCharger": BehaviorDriveOffCharger, } cls = class_map...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def behavior_for_attributes(self, attributes):\n for behavior, criteria in self.registered_behaviors:\n if criteria.evaluate(attributes):\n return behavior\n return self.event.default_behavior", "def getBehaviorNature(self, behavior):\n if not self.proxy:\n ...
[ "0.58255094", "0.5570628", "0.51562303", "0.5121632", "0.51032513", "0.5080963", "0.5079439", "0.5076947", "0.50172156", "0.5009232", "0.50005877", "0.49934128", "0.493821", "0.49222156", "0.49222156", "0.48718593", "0.4865874", "0.4862071", "0.4836569", "0.48241413", "0.4805...
0.72726583
0
Collect urls of images by keyword using splash api
def collect_urls_by_keyword(keyword: str, page_num: int, n_max: int, scenery: bool = False): if scenery: keyword += '-scenery' r = requests.get(f'https://api.unsplash.com/search/collections?query={keyword}&page={page_num}&per_page={n_max}&client_id=1H5zbugfvk1UOnX60y2yiMyjNMrE-vdpThxGkP1y9_E') data ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def keyword_to_images(keywords):\n searchTerm = ' '.join(keywords)\n searchTerm = searchTerm.replace(' ', '%20')\n\n # Start FancyURLopener with defined version\n # myopener = MyOpener()\n\n # Notice that the start changes for each iteration in order\n # to request a new set of images for each lo...
[ "0.67936283", "0.662286", "0.66023016", "0.65941745", "0.65375906", "0.65149903", "0.64483434", "0.6410244", "0.6386181", "0.6354036", "0.6343934", "0.63412344", "0.6332881", "0.6311104", "0.6299738", "0.62983704", "0.62725866", "0.62346876", "0.62243366", "0.61484414", "0.61...
0.7433807
0
Convert a caffe parameter name to a tensorflow parameter name as defined in the above model
def name_conversion(caffe_layer_name, prefix=''): # beginning & end mapping NAME_MAP = { 'bn_conv1/beta': 'conv0/BatchNorm/beta:0', 'bn_conv1/gamma': 'conv0/BatchNorm/gamma:0', 'bn_conv1/mean/EMA': 'conv0/BatchNorm/moving_mean:0', 'bn_conv1/variance/EMA': 'conv0/BatchNorm/moving_variance:0',...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eff_param():\n return r.TF1('photon_eff_param', eff_param_string(), 0, 7)", "def _get_param_to_param_name(\n model: torch.nn.Module,\n) -> Dict[torch.nn.Parameter, str]:\n param_to_param_names = _get_param_to_unflat_param_names(model)\n for param_names in param_to_param_names.values():\n a...
[ "0.59476686", "0.58388007", "0.5772405", "0.5701666", "0.5692458", "0.5617242", "0.55691546", "0.54260504", "0.53634006", "0.5344747", "0.53117526", "0.5303694", "0.5301256", "0.5296789", "0.5279293", "0.5278879", "0.52710485", "0.5232698", "0.5229766", "0.5218155", "0.520569...
0.6089701
1
Called by self._format_as(space), to check whether self and space have compatible sizes. Throws a ValueError if they don't.
def _check_sizes(self, space): my_dimension = self.get_total_dimension() other_dimension = space.get_total_dimension() if my_dimension != other_dimension: if isinstance(space, Conv2DSpace): if my_dimension * space.shape[0] !=\ other_dimension: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_size(self):\n if self.type == 'grid':\n if not self.size:\n raise ChartError(\n \"Layout size must be set \"\n \"if layout type is 'grid'\")\n\n if len(self.size) != 2:\n raise ChartError('Layout size leng...
[ "0.6610175", "0.6451334", "0.6441938", "0.640975", "0.61760485", "0.61393535", "0.61014336", "0.60155046", "0.5922366", "0.58863646", "0.58730096", "0.58581656", "0.5849174", "0.58366275", "0.58356285", "0.5833874", "0.5824362", "0.5816935", "0.5773754", "0.5703666", "0.57024...
0.76109046
0
CLI to collect random commits and analyze maintainability.
def tool(security_dataset, regular_dataset): df = pd.read_csv(security_dataset) add_random_regular_commits(df, regular_dataset)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n print(\"Hello World!!!\")\n print(\"Commit to DLNA\")\n print(\"Another commit\")\n print(\"Commit after PR merge\")", "def main():\n# logging.basicConfig(level=logging.DEBUG)\n try:\n user = sys.ARGV[1]\n except:\n user = 'hmm01i'\n repos = getRepos(user)\n ...
[ "0.618323", "0.60287666", "0.5585191", "0.55699843", "0.5559813", "0.5543677", "0.5541772", "0.5530489", "0.5476184", "0.5458055", "0.54341", "0.5431736", "0.5429843", "0.53909594", "0.5388294", "0.5387541", "0.5365055", "0.5360595", "0.5360282", "0.5360282", "0.5341381", "...
0.6278088
0
Return boxes with a confidence >= `min_score`
def filter_boxes(min_score, boxes, scores, classes): n = len(classes) idxs = [] for i in range(n): if scores[i] >= min_score: idxs.append(i) filtered_boxes = boxes[idxs, ...] filtered_scores = scores[idxs, ...] filtered_classes = classes[idxs, ...] return filtered_bo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter_boxes(self, min_score, boxes, scores, classes):\n n = len(classes)\n idxs = []\n for i in range(n):\n if scores[i] >= min_score:\n idxs.append(i)\n \n filtered_boxes = boxes[idxs, ...]\n filtered_scores = scores[idxs, ...]\n filt...
[ "0.7317321", "0.72855526", "0.72492224", "0.72279024", "0.6647105", "0.6314491", "0.63112724", "0.61915874", "0.6165219", "0.61569124", "0.6156313", "0.61135215", "0.6062302", "0.5995685", "0.59620845", "0.5960607", "0.5950879", "0.59485", "0.5940718", "0.5940718", "0.5936835...
0.72886777
1
Read through a ped/samples file and get the names of the cases and controls.
def getCaseAndControlListsFromPedFile(pedFilePath): CASE = "2" CONTROL = "1" statusIndex = 5 nameIndex = 1 names = defaultdict(list) with open(pedFilePath, "r") as samples: for sample in samples: names[sample.split("\t")[statusIndex]].append(sample.split("\t")[nameIndex]) # The second spot is the ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def samples():\n f = open(config['samples'], \"r\")\n samp=[]\n for line in f:\n samp.append(line.strip().split()[0])\n return samp", "def read_file(testing_file):\n samples = []\n with open(testing_file, 'r') as in_file:\n for line in in_file:\n info = line.strip('\\n'...
[ "0.63636255", "0.6313014", "0.61136013", "0.59631413", "0.56838787", "0.56684047", "0.56344813", "0.5632566", "0.5621312", "0.5583971", "0.55766374", "0.55750257", "0.55492824", "0.55484843", "0.55387455", "0.5510029", "0.5475519", "0.5473172", "0.5460236", "0.5412151", "0.54...
0.6725174
0
Read through the first two lines of a _genotypes file and calculate how many total cases and controls were in the initial ATAV job. (If a sample does not have a variant, they won't show up in the file, so this total needs to be calculated separately.)
def getTotalCaseAndControlCounts(genotypesFilename): comphetSuffix = "" if "comphet" in genotypesFilename: comphetSuffix = " (#1)" # We read through the whole file. Might take a while, but easier than dealing with all edge cases. maxCoveredCasePercentage = 0 maxCoveredControlPercentage = 0 reader = c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_total(self):\n total = 0\n rpk_total = 0.0\n with open(self.filename, 'rU') as my_htseq:\n for line in my_htseq:\n if '_' not in line:\n line = line.rstrip('\\n').split('\\t')\n ensg_id = line[0]\n gen...
[ "0.62967587", "0.6293312", "0.6029363", "0.6015871", "0.5913728", "0.58160174", "0.5763021", "0.5732417", "0.57178193", "0.56836647", "0.56249833", "0.5541682", "0.5532769", "0.5515604", "0.55022156", "0.5498849", "0.5483801", "0.54305834", "0.5416177", "0.5402783", "0.538538...
0.7090837
0
Read through a genotypes file and get the number of QVs per sample.
def getQVcounts(genotypesFilename, caseNames, controlNames): if "genotypes" in genotypesFilename: caseCounts, controlCounts = getQVcountsForDominantModel(genotypesFilename, caseNames, controlNames) elif "comphet" in genotypesFilename: caseCounts, controlCounts = getQVsForComphetModel(genotypesFilename, case...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def n(self):\n return len(self.genotypes)", "def countgenes():\n directory = openfile('db_directory.txt')\n no_genes_file = directory+'GENES_IN_HPO.txt'\n GENES_IN_HPO = openfile(no_genes_file)\n #GENES_IN_HPO = openfile(numbergenes_file)\n return int(GENES_IN_HPO)", "def populate(infile,...
[ "0.6377052", "0.61921424", "0.6050802", "0.5921395", "0.57854915", "0.5723797", "0.5702904", "0.56815153", "0.5647343", "0.5629553", "0.55353963", "0.55299056", "0.54956543", "0.548101", "0.5472195", "0.5413845", "0.54131746", "0.53874993", "0.5385036", "0.53508884", "0.53467...
0.62267786
1
Read through a _comphet file and get the variant counts for all samples, broken down into cases and controls. If a sample has 2 variants in one gene, they'll be printed to the same line as "Variant (1)" and "Variant (2)".
def getQVsForComphetModel(comphetVariantsFilename, caseNames, controlNames): # If we have a sample file, then we have everyone's names: if len(caseNames) != 0 or len(controlNames) != 0: caseCounts = {name: set() for name in caseNames} controlCounts = {name: set() for name in controlNames} variantIDs ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getTotalCaseAndControlCounts(genotypesFilename):\r\n\r\n\tcomphetSuffix = \"\"\r\n\tif \"comphet\" in genotypesFilename:\r\n\t\tcomphetSuffix = \" (#1)\"\r\n\r\n\t# We read through the whole file. Might take a while, but easier than dealing with all edge cases.\r\n\tmaxCoveredCasePercentage = 0\r\n\tmaxCovered...
[ "0.6928196", "0.625293", "0.58950937", "0.58474743", "0.5823805", "0.56312484", "0.5608807", "0.5597664", "0.5558391", "0.55020434", "0.54880935", "0.5404076", "0.53877914", "0.53493875", "0.53344697", "0.52961344", "0.5296094", "0.5268602", "0.5253312", "0.52310175", "0.5185...
0.6625952
1
Write out the sample name and the number of QVs they have to a log.
def writeOutQVcounts(qvCountsLogName, casesToTheirQVcounts, controlsToTheirQVcounts, missingCases, missingControls): log = "" if missingCases > 0 or missingControls > 0: log += "### A sample file may have not been submitted, and so there are some samples that do not have\n" log += "### any QVs, but we don't...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _print_log(self, step, data=None):\n \n # Set mode to append to log file\n mode = 'a'\n\n if self.logfile is None:\n # Increment log counter for the class. Each instance of the class generates a new log.\n self.__class__.log_no += 1\n\n # Create a lo...
[ "0.60270923", "0.5782031", "0.57312113", "0.5726678", "0.57149386", "0.557019", "0.55264795", "0.5509941", "0.54832083", "0.5469556", "0.54433197", "0.5429885", "0.5374645", "0.5369299", "0.53379154", "0.5330904", "0.5304008", "0.5279867", "0.52705723", "0.52650094", "0.52610...
0.6655646
0
Run Mann Whitney and write out the results.
def runMannWhitney(mannWhitneyLogName, qvsPerCase, qvsPerControl): log = "" log += "Checking amounts of found variants for cases vs. controls. Date: {}.\n".format(datetime.datetime.now().strftime("%Y-%m-%d %H:%M")) log += "Cases (n = {}): Median: {}; mean: {}.\n".format(len(qvsPerCase), np.median(qvsPerCase), n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _mann_whitney(_sample_a, _sample_b):\n res = stats.mannwhitneyu(_sample_a, _sample_b, use_continuity=True)\n print('Mann-Whitney rank test\\nU-statistic: {}\\np-value: {}'.format(res[0], res[1]))\n print('-' * 10)", "def mann_whitney_plus_means(turnstile_weather):\n with_rain = turnst...
[ "0.6443433", "0.62065065", "0.6126351", "0.60448587", "0.58548564", "0.55368865", "0.552356", "0.52770686", "0.5268584", "0.5214635", "0.5069704", "0.5024073", "0.49422473", "0.49388117", "0.49314013", "0.4907475", "0.4886257", "0.48828724", "0.4872175", "0.48712775", "0.4866...
0.6721948
0
Create and plot a histogram of variant counts, broken into cases and controls.
def graphQVcounts(caseCounts, controlCounts, outputName): plt.figure(1) caseCounter = Counter(caseCounts) controlCounter = Counter(controlCounts) totalCases = float(len(caseCounts)) totalControls = float(len(controlCounts)) plt.bar(caseCounter.keys(), np.array(caseCounter.values())/totalCases, facec...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hist_qual(self, fontsize=16, bins=100):\n self.rewind()\n data = [x.QUAL for x in self._vcf_reader]\n pylab.hist(data, bins=bins)\n pylab.grid(True)\n pylab.xlabel(\"Variant quality\", fontsize=fontsize)", "def generate_counthist(counts, label, view_lim=[1e-6,1e0,1e0,1e5]):...
[ "0.639714", "0.6303354", "0.6291766", "0.61522007", "0.6151823", "0.61423516", "0.6139937", "0.60908663", "0.6076454", "0.6051278", "0.6031893", "0.595742", "0.5954826", "0.5929051", "0.5881224", "0.5870992", "0.5846922", "0.58407176", "0.5829935", "0.5828306", "0.5822304", ...
0.65548986
0
Starts a watchfolder in the user's iCloud directory
def do_start_icloud(self, args): args = self.parse_arguments(args) plat = get_local_platform_routines() user = LocalUserRoutines(plat) home_dir = user.get_home_dir() icloud_dir = os.path.join(home_dir, "iCloudDrive", "fiepipe_watch") if not os.path.exists(icloud_dir...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start(self):\n try:\n self.getEverything()\n self._watchFolder()\n except Unauthorized, e:\n self.authorize()\n self.start()\n \n #TODO: make this work\n #self._setPeriodicSync()\n \n print 'stopped'", "def _watchFol...
[ "0.6660409", "0.63080263", "0.60288143", "0.587695", "0.57806844", "0.577429", "0.56855834", "0.5651817", "0.546844", "0.54465985", "0.54192054", "0.5416022", "0.5339537", "0.5321164", "0.52857655", "0.5200085", "0.51923317", "0.5147048", "0.50987595", "0.50855106", "0.507541...
0.669887
0
Starts a watchfolder in the user's Documents directory
def do_start_documents(self, args): args = self.parse_arguments(args) plat = get_local_platform_routines() user = LocalUserRoutines(plat) home_dir = user.get_home_dir() docs_dir = os.path.join(home_dir, "Documents", "fiepipe_watch") if not os.path.exists(docs_dir): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _watchFolder(self):\n wm = pyinotify.WatchManager()\n wm.add_watch(self.gdocs_folder, pyinotify.IN_MODIFY, rec=True)\n \n handler = EventHandler(self)\n notifier = pyinotify.Notifier(wm, handler)\n \n print 'waiting for changes . . .'\n notifier.loop()", ...
[ "0.71423084", "0.6504502", "0.6461225", "0.62531656", "0.62520504", "0.59916514", "0.5971321", "0.5947779", "0.58603346", "0.57456636", "0.5725944", "0.5721107", "0.56487375", "0.55851334", "0.5476341", "0.54706573", "0.54611844", "0.5439405", "0.53978366", "0.5392165", "0.53...
0.66735244
1
Runs R correlation calculations and pvalue corrections on the given dataframe.
def run_r_corr(df, corr_type='spearman', p_correction='BH'): num_cols = len(df.columns.values) r_dataframe = pandas2ri.py2ri(df) r_as = r['as.matrix'] rcorr = r['rcorr'] r_p_adjust = r['p.adjust'] result = rcorr(r_as(r_dataframe), type=corr_type) rho = result[0] n = result[1] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def df_corr(df, method=\"pearson\", min_periods=1):\n op = DataFrameCorr(method=method, min_periods=min_periods)\n return op(df)", "def df_corrwith(df, other, axis=0, drop=False, method=\"pearson\"):\n axis = validate_axis(axis, df)\n if drop:\n # TODO implement with df.align(method='inner')\n...
[ "0.67682356", "0.6436532", "0.6363697", "0.625707", "0.6251887", "0.61984104", "0.6184104", "0.61419874", "0.61195624", "0.6110142", "0.61037296", "0.61014676", "0.60986847", "0.6088977", "0.60165393", "0.6007464", "0.59634864", "0.5930247", "0.5885391", "0.5870298", "0.58694...
0.8098069
0
Generate yaml test cases from the yaml files in the given directory
def generate_yaml_tests(directory): for yml_file in directory.glob("*/*.yml"): data = yaml.safe_load(yml_file.read_text()) assert "cases" in data, "A fixture needs cases to be used in testing" # Strip the parts of the directory to only get a name without # extension and resolver dir...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_yaml_tests(directory):\n for yml_file in directory.glob(\"*.yml\"):\n data = yaml.safe_load(yml_file.read_text())\n assert \"cases\" in data, \"A fixture needs cases to be used in testing\"\n\n # Strip the parts of the directory to only get a name without\n # extension a...
[ "0.81488127", "0.7012131", "0.6698927", "0.66773045", "0.6447837", "0.63057554", "0.627959", "0.6240237", "0.6215887", "0.6164365", "0.609653", "0.60548806", "0.6040794", "0.6032984", "0.5965803", "0.59477776", "0.5941153", "0.5919988", "0.5910295", "0.5891571", "0.58607346",...
0.8186191
0
Creates an inline LOAD_ATTR call, using a validator.
def attr(self, attr: _PyteAugmentedValidator): # Use the __override_opcode param and __override_list_restriction return _AttrLoader(self, attr)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def visit_Attribute(self, node):\n self.generic_visit(node)\n if isinstance(node.ctx, ast.Load):\n args = [ node.value, ast.Str(node.attr) ]\n return to_call(to_name('getattr'), args)\n return node", "def loader_for_attribute(self, attribute):\n return lambda x: ...
[ "0.5518646", "0.53865415", "0.53345865", "0.528758", "0.51410544", "0.50560033", "0.5017652", "0.4997242", "0.4987636", "0.4981382", "0.48947912", "0.48831546", "0.48165223", "0.47417164", "0.4713835", "0.4696541", "0.4672414", "0.46377176", "0.46348855", "0.4614697", "0.4609...
0.6687772
0
Parse rule about what child bags a parent bag can contain
def parse_rule(line): parent, children_str = line.strip().split(" bags contain ") children = {} for child in children_str.split(", "): match = re.match(r"(?P<quantity>\d+) (?P<color>.+?) bag", child) if match: children[match.group("color")] = int(match.group("quantity")) retu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test__findChildBags(self):\n file = \"\"\"\n shiny gold bags contain 2 dark red bags.\n dark red bags contain 2 dark orange bags.\n dark orange bags contain 2 dark yellow bags.\n dark yellow bags contain 2 dark green bags.\n dark green bags contain 2 dark blue bags.\n dark blue bags contai...
[ "0.6878267", "0.6853976", "0.6154937", "0.61455214", "0.5890407", "0.5784656", "0.5481967", "0.5432812", "0.53975284", "0.53018963", "0.528658", "0.517007", "0.51429975", "0.51294297", "0.51093775", "0.51039433", "0.4958595", "0.49047592", "0.48926118", "0.4822519", "0.480323...
0.6862749
1
Gets lists of lists of SubContour objects from a watershed array using ImageContour
def GetSubContoursByFrame(watershed, allValsByFrame): scListByFrame = [] for frame in range(len(watershed)): scList = [] for v in allValsByFrame[frame]: boundingRect = ImageContour.GetBoundingRect(watershed[frame], v) # No longer needed: #contour,turns,vals = ImageContour...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def detect_contours(self):\r\n (contours, _) = cv2.findContours(self.image.copy(), cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)\r\n return [DbugContour(cv_contour=contour) for contour in contours]", "def contour_ice(dataarray):\n contours = dataarray.plot.contourf(vmin=0, vmax=100, levels=5)\n ...
[ "0.6358348", "0.62865835", "0.61682415", "0.61467576", "0.6096353", "0.60877997", "0.6076599", "0.60685176", "0.6063275", "0.6045179", "0.6035992", "0.6009514", "0.59757787", "0.5924858", "0.5912952", "0.5906821", "0.5885125", "0.5875746", "0.5873737", "0.5834278", "0.5828782...
0.6689849
0
Gets lists of lists of CVLS's from a watershed array use GetSubContoursByFrame instead!
def GetContourValuesLengthsAndSubContoursByFrame(watershed, allValsByFrame): return [ [sc.cVLS() for sc in scList] for scList in GetSubContoursByFrame(watershed, allValsByFrame) ]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetSubContoursByFrame(watershed, allValsByFrame):\n scListByFrame = []\n for frame in range(len(watershed)):\n scList = []\n for v in allValsByFrame[frame]:\n boundingRect = ImageContour.GetBoundingRect(watershed[frame], v)\n # No longer needed: #contour,turns,vals = I...
[ "0.75937665", "0.6507299", "0.6484516", "0.6458244", "0.6308807", "0.62851155", "0.6266374", "0.62063503", "0.60648507", "0.59767586", "0.5921466", "0.5914407", "0.5904614", "0.58996433", "0.58695424", "0.58617276", "0.5860281", "0.584063", "0.577641", "0.5762255", "0.5724690...
0.6806032
1
Identify every contour in the watershed segmentation for each frame as defined by each pair of cell IDs (vals). Also, return the order of contours that is needed to reconstruct the border surrounding each cell.
def GetSubContoursAndOrderingByFrame(watershed, allValsByFrame): cellNetworkList = GetCellNetworksByFrame(watershed, allValsByFrame) scListByFrame = [cellNetworkList[i].subContours for i in range(len(watershed))] orderOfSCsByValueByFrame = [ cellNetworkList[i].orderOfSubContoursDict for i in range(l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetSubContoursByFrame(watershed, allValsByFrame):\n scListByFrame = []\n for frame in range(len(watershed)):\n scList = []\n for v in allValsByFrame[frame]:\n boundingRect = ImageContour.GetBoundingRect(watershed[frame], v)\n # No longer needed: #contour,turns,vals = I...
[ "0.682303", "0.62864244", "0.6280185", "0.60297304", "0.59573025", "0.5944612", "0.58334446", "0.57923675", "0.5783148", "0.5739409", "0.56378686", "0.55968744", "0.5590528", "0.55639815", "0.5518648", "0.54740554", "0.5468312", "0.5427046", "0.5407643", "0.5381385", "0.53796...
0.6968971
0
Turn a cVLS into a list of points (xyList) and a dictionary of index lists (into xyList) with cellID keys (polyList) polyList basically contains the information that reconstructs each individual contour from points Appends the first point to the end of each list to close the loop and makes plotting cleaner, but be caut...
def GetXYListAndPolyListFromCVLS(cVLS, allValsByFrame, orderOfSCsByValueByFrame): numFrames = len(cVLS) xyList = [ sorted(list(set(tuple(pt) for c in cvlsByVal for pt in c[2]))) for cvlsByVal in cVLS ] polyList = [] for t in range(numFrames): polyList.append({}) for ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def individual_plot(z, cf_lvls, cl_lvls, cline_label_format=cline_label_format_default, log_scale=False ,\n extend=\"neither\"):\n map_plot.drawcoastlines(linewidth=.4)\n\n if log_scale:\n norm = colors.LogNorm(vmin=cf_lvls[0], vmax=cf_lvls[-1])\n else:\n norm = None\n\n ...
[ "0.57014245", "0.5649377", "0.56392044", "0.55886257", "0.5495664", "0.54937655", "0.5468166", "0.54670477", "0.54585874", "0.5396782", "0.5394453", "0.5374216", "0.53528965", "0.5322514", "0.53171647", "0.5304197", "0.5300245", "0.52861774", "0.52711666", "0.526915", "0.5230...
0.6929526
0
Get an list of points and a connection network from a cVLS and orderOfSCsByValueByFrame; limit points between triple junctions (Applies GetCVLSWithLimitedPointsBetweenNodes and then GetXYListAndPolyListFromCVLS)
def GetXYListAndPolyListWithLimitedPointsBetweenNodes_CVLS( cVLS, allValsByFrame, orderOfSCsByValueByFrame, splitLength=1, fixedNumInteriorPoints=None, interpolate=True, ): cVLS2 = GetCVLSWithLimitedPointsBetweenNodes( cVLS, allValsByFrame, splitLength, fixedN...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetCVLSWithLimitedPointsBetweenNodes(\n cVLS, allValsByFrame, splitLength=1, fixedNumInteriorPoints=None, interpolate=True\n):\n allValues = list(set(tuple(flatten(allValsByFrame))))\n allPairs = sorted(\n list(set([tuple(c[0]) for cVLSByFrame in cVLS for c in cVLSByFrame]))\n ) # Value pai...
[ "0.6758528", "0.65826356", "0.5632501", "0.55175966", "0.54169285", "0.5379928", "0.5346093", "0.5311847", "0.53098977", "0.52789253", "0.52344453", "0.52038324", "0.5167569", "0.51378644", "0.51114464", "0.50953865", "0.5084913", "0.5053021", "0.5044931", "0.5041024", "0.501...
0.71487695
0
Make 2 simplified subcontour networks, one for scListRef and another for scList with a 1to1 mapping to the first
def GetMatchedSubContourLists( scListRef, scList, allValsByFrame, orderOfSCsByValue, splitLength=1, fixedNumInteriorPoints=None, ): ## NOT DONE! MERGE LATER?? return simplifiedSCListRef, simplifiedSCList
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetMatchedSubContourListsCollapsing(scListA, scListB):\n\n if (\n scListA == scListB\n ): # if we got the same object for some reason, just return 2 shallow clones\n return scListA, scListB\n\n scsMatchedInB = [] # This keeps us from looping over both lists\n\n scsMatchedInB, remove...
[ "0.6174592", "0.5594567", "0.5401644", "0.53908986", "0.5365256", "0.5335248", "0.5255532", "0.5243055", "0.5222066", "0.5215828", "0.5205438", "0.5200392", "0.5197557", "0.51619846", "0.51185894", "0.5075667", "0.5075613", "0.5074813", "0.5073621", "0.50514334", "0.50234973"...
0.6822347
0
Check all the subcontours in A to see if they have a match in B and return them Also check for flipped matches; in the event of a flip, both sc's are flagged for removal
def FindMatchesAndRemovals(scListA, scListB, searchInds=None): scsMatchedInB = [] removeFromA = [] removeFromB = [] if searchInds is None: searchInds = list(range(len(scListA))) for ind in searchInds: sca = scListA[ind] # Look for each sc from A in B: matchTuples = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetMatchedSubContourListsCollapsing(scListA, scListB):\n\n if (\n scListA == scListB\n ): # if we got the same object for some reason, just return 2 shallow clones\n return scListA, scListB\n\n scsMatchedInB = [] # This keeps us from looping over both lists\n\n scsMatchedInB, remove...
[ "0.67644656", "0.5664181", "0.55579877", "0.5505676", "0.5449042", "0.5422501", "0.53664684", "0.535521", "0.5319952", "0.53025115", "0.5284908", "0.5258869", "0.52418005", "0.52386093", "0.52161735", "0.5211302", "0.51943326", "0.5173569", "0.51730245", "0.51399046", "0.5133...
0.64999247
1
Make 2 simplified subcontour networks, making sure that there is a 1to1 mapping between all points; this function collapses pairs of subcontours that do not match but are in between the same 4 cells
def GetMatchedSubContourListsCollapsing(scListA, scListB): if ( scListA == scListB ): # if we got the same object for some reason, just return 2 shallow clones return scListA, scListB scsMatchedInB = [] # This keeps us from looping over both lists scsMatchedInB, removeFromA, removeF...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def multiple_intersections():\n levels = np.array([966., 937.2, 925., 904.6, 872.6, 853., 850., 836., 821., 811.6, 782.3,\n 754.2, 726.9, 700., 648.9, 624.6, 601.1, 595., 587., 576., 555.7,\n 534.2, 524., 500., 473.3, 400., 384.5, 358., 343., 308.3, 300., 276.,\n ...
[ "0.5663014", "0.55421275", "0.5500052", "0.54700613", "0.54657197", "0.5435926", "0.54106635", "0.540982", "0.5407893", "0.54021794", "0.5359405", "0.5358323", "0.5355261", "0.53323746", "0.5324935", "0.5305605", "0.53029805", "0.5296254", "0.5277591", "0.5276798", "0.5273874...
0.6103664
0
Tests whether ``limit_string_length`` works as intended.
def test__limit_string_length(string, max_length): return limit_string_length(string, max_length)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _validate_string_max_length(self, value):\n if self.max_length is not None:\n return len(str(value)) <= self.max_length\n else:\n return True", "def _str_len_check(text, min_len, max_len):\n if not isinstance(text, str):\n raise ValueError(\"expected string type\...
[ "0.7828164", "0.74206644", "0.7354528", "0.73487365", "0.730151", "0.7263644", "0.721242", "0.7049977", "0.7049977", "0.696591", "0.69547063", "0.6921804", "0.68282324", "0.68267554", "0.6825206", "0.6779123", "0.67705727", "0.66442156", "0.66199005", "0.65304154", "0.6527428...
0.87113315
0
Split A at q and merge together in order.
def merge_in_place(A, p, q, r): n_1 = q - p + 1 n_2 = r - q L = 0 R = 0 for k in range(p, r+1): if A[p] <= A[q + 1]: A.insert(r+1, A[p]) del A[p] L += 1 q -= 1 else: A.insert(r+1, A[q+1]) del A[q+1] R...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def merge(A, p, q, r):\n\n # Split A[p..r] into L = A[p..q] and R = A[q+1..r]\n n1 = q - p + 1 # will hold A[p..q]\n n2 = r - q # will hold A[q+1..r]\n\n L = [0] * (n1 + 1)\n R = [0] * (n2 + 1)\n \n for i in range(n1):\n L[i] = A[p+i]\n for j in range(n2):\n R[j] = A[q+j...
[ "0.6118815", "0.58961606", "0.5878436", "0.57619405", "0.5558039", "0.5241369", "0.5224264", "0.5186988", "0.5172165", "0.51325655", "0.5128098", "0.51249146", "0.51147157", "0.5049574", "0.5020555", "0.49630874", "0.49623552", "0.49531335", "0.49419618", "0.48679426", "0.486...
0.5974006
1
Sort array elements in A between p and r using mergesort.
def mergesort(A, p, r): if p < r: q = (p+r)//2 mergesort(A, p, q) mergesort(A, q + 1, r) merge(A, p, q, r)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sort(self, A, index, p, r, rc_arr):\n\n if p < r:\n q = (p + r) // 2\n\n self.sort(A, index, p, q, rc_arr)\n self.sort(A, index, q + 1, r, rc_arr)\n self.merge(A, index, p, q, r, rc_arr)", "def mergesort_ip(A, p, r):\n if p < r:\n q = (p+r)//2\n ...
[ "0.83909804", "0.82299715", "0.7800592", "0.752118", "0.74472076", "0.74064726", "0.7010142", "0.69270617", "0.6911257", "0.6762529", "0.6758566", "0.67509073", "0.6742108", "0.6702788", "0.66815907", "0.6673625", "0.6635363", "0.656472", "0.65487516", "0.6545953", "0.6545235...
0.86928904
0
Sort array elements in A between p and r using mergesort inplace.
def mergesort_ip(A, p, r): if p < r: q = (p+r)//2 mergesort(A, p, q) mergesort(A, q + 1, r) merge_in_place(A, p, q, r)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mergesort(A, p, r):\n if p < r:\n q = (p+r)//2\n mergesort(A, p, q)\n mergesort(A, q + 1, r)\n merge(A, p, q, r)", "def sort(self, A, index, p, r, rc_arr):\n\n if p < r:\n q = (p + r) // 2\n\n self.sort(A, index, p, q, rc_arr)\n self.sort...
[ "0.84125704", "0.83105433", "0.7512306", "0.7361288", "0.73299336", "0.7286003", "0.6971325", "0.69071525", "0.689582", "0.6885693", "0.68768835", "0.6779977", "0.66591114", "0.662605", "0.6586384", "0.65090984", "0.6479134", "0.64221436", "0.64146775", "0.64103496", "0.63233...
0.83402205
1
Get an object's element key.
def get_key(self, object_id): try: info = self.storage.load("", object_id) return info["object_key"] except KeyError: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def object_key(self) -> str:\n return self._values.get('object_key')", "def get_key(self, item):\r\n return item[0]", "def key(self):\n raise NotImplementedError(\"'key' not implemented for Element subclass\")", "def obj_key(objname):\n return OBJ_PREFIX + objname", "def get_key(sel...
[ "0.7112568", "0.705819", "0.6947471", "0.6844022", "0.6839712", "0.67814183", "0.67632306", "0.67580813", "0.6720763", "0.6639502", "0.6636918", "0.66335106", "0.6631516", "0.6629096", "0.6537854", "0.6537854", "0.6499949", "0.6489818", "0.64673126", "0.6444907", "0.6434619",...
0.7098794
1
Setup of creation of shared libraries in 2 Steps.
def _shared_library_in_2steps(env): if not config.shared_library_1st in env['BUILDERS']: # The 1st builder shlinkcom_name = config.shared_library_1st + "COM" env[shlinkcom_name] = "${TEMPFILE('$AR /DEF $ARFLAGS /OUT:$TARGET $SOURCES')}" ar_action = SCons.Action.Action("$" + shlinkcom_n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_lib(CLIB):\n # {{ SETUP_LIB }}", "def setup_module():\n common_setup_module()", "def initialize_library():\n # return the handle to the shared object\n if os.name == \"nt\":\n pass\n # libc = load_windows_dll()\n else:\n libc = load_linux_so()\n return libc", ...
[ "0.69693637", "0.6318507", "0.62593526", "0.61885273", "0.6175638", "0.61054045", "0.6081299", "0.60247236", "0.6005774", "0.59742194", "0.59631056", "0.59508246", "0.59508246", "0.59334606", "0.5921951", "0.5921951", "0.5921951", "0.5921951", "0.5921951", "0.5915148", "0.590...
0.761938
0
Return the url and etag (which may be ``None``) stored for `filename`. Raise ``EnvironmentError`` if `filename` or its stored metadata do not exist.
def filename_to_url(filename, cache_dir=None): if cache_dir is None: cache_dir = PYTORCH_PRETRAINED_BERT_CACHE if sys.version_info[0] == 3 and isinstance(cache_dir, Path): cache_dir = str(cache_dir) cache_path = os.path.join(cache_dir, filename) if not os.path.exists(cache_path): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filename_to_url(filename, cache_dir=None):\n if cache_dir is None:\n cache_dir = PYTORCH_PRETRAINED_BIGGAN_CACHE\n if sys.version_info[0] == 3 and isinstance(cache_dir, Path):\n cache_dir = str(cache_dir)\n\n cache_path = os.path.join(cache_dir, filename)\n if not os.path.exists(cache...
[ "0.6935979", "0.66862404", "0.56602347", "0.5526214", "0.5495133", "0.549179", "0.54821646", "0.5451763", "0.54232866", "0.5404365", "0.5390168", "0.53592336", "0.5340097", "0.5316367", "0.5316367", "0.53050923", "0.5263058", "0.5249617", "0.5236301", "0.5236301", "0.5236301"...
0.6845483
1
Check ETag on S3 object.
def s3_etag(url): s3_resource = boto3.resource("s3") bucket_name, s3_path = split_s3_path(url) s3_object = s3_resource.Object(bucket_name, s3_path) return s3_object.e_tag
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def s3_etag(url, proxies=None):\n\ts3_resource = boto3.resource (\"s3\", config=Config (proxies=proxies))\n\tbucket_name, s3_path = split_s3_path (url)\n\ts3_object = s3_resource.Object (bucket_name, s3_path)\n\treturn s3_object.e_tag", "def __check_metadata(s3client, key, bucket_name):\n response = s3client....
[ "0.7609127", "0.6753514", "0.6726762", "0.66672444", "0.62203646", "0.62162846", "0.61209494", "0.6087607", "0.59397113", "0.5937211", "0.5868046", "0.5830815", "0.5825242", "0.58229005", "0.58092743", "0.57960355", "0.57894117", "0.57681316", "0.57361794", "0.57229257", "0.5...
0.7740408
1
Extract a deduped collection (set) of text from a file. Expected file format is one item per line.
def read_set_from_file(filename): collection = set() with open(filename, "r", encoding="utf-8") as file_: for line in file_: collection.add(line.rstrip()) return collection
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_set(file):\n s = set([])\n\n f = open(file, 'r')\n for line in f:\n flist = extract_words(line)\n\n for word in flist:\n if(word not in s):\n s.add(word)\n\n f.close()\n\n return s", "def read_gzip_file_lines_into_set(filename):\n with gzip.op...
[ "0.70601773", "0.6523493", "0.62634283", "0.6184579", "0.6109035", "0.6089902", "0.60104346", "0.6005262", "0.5984719", "0.5939507", "0.5928584", "0.5926395", "0.586926", "0.58470607", "0.58362484", "0.5735106", "0.5721555", "0.5711964", "0.570927", "0.56818986", "0.56660604"...
0.71203864
0
Tie or clone module weights depending of weither we are using TorchScript or not
def _tie_or_clone_weights(self, first_module, second_module): # TODO: ignore torch scripts here first_module.weight = second_module.weight
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialise_weights(self): \n \n def initialise_process(param):\n \n \"\"\"\n Initialises weights of a given parameter following either Xavier or Kaiming uniform or normal processes.\n \n : param (torch.Tensor):\n \n ...
[ "0.6059909", "0.59139943", "0.5835686", "0.5801824", "0.578343", "0.57619166", "0.5751291", "0.55874944", "0.5566885", "0.5566885", "0.5566885", "0.55622125", "0.55498856", "0.5534293", "0.5514865", "0.54380494", "0.540177", "0.53923684", "0.5387447", "0.5385017", "0.5377151"...
0.7063566
0
Resize input token embeddings matrix of the model if new_num_tokens != config.vocab_size. Take care of tying weights embeddings afterwards if the model class has a `tie_weights()` method.
def resize_token_embeddings(self, new_num_tokens=None): base_model = getattr(self, self.base_model_prefix, self) # get the base model if needed model_embeds = base_model._resize_token_embeddings(new_num_tokens) if new_num_tokens is None: return model_embeds # Update base mo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _resize_token_embeddings(\n cls, model: PreTrainedModel, tokenizer_wrapper: TokenizerWrapper\n ):\n if tokenizer_wrapper.num_added_special_tokens > 0:\n model.resize_token_embeddings(\n new_num_tokens=len(tokenizer_wrapper.tokenizer)\n )", "def _get_resiz...
[ "0.7340149", "0.73199034", "0.66773486", "0.6232395", "0.5885491", "0.5708248", "0.5682836", "0.5608442", "0.5600368", "0.55258316", "0.54641026", "0.5434204", "0.5431489", "0.54279315", "0.53705066", "0.53556705", "0.5320183", "0.5313493", "0.53025067", "0.52424026", "0.5235...
0.8302218
0
Prunes heads of the base model.
def prune_heads(self, heads_to_prune): base_model = getattr(self, self.base_model_prefix, self) # get the base model if needed base_model._prune_heads(heads_to_prune)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _prune_heads(self, heads_to_prune):\n\n for layer, heads in heads_to_prune.items():\n\n self.encoder.layer[layer].attention.prune_heads(heads)", "def _prune_heads(self, heads_to_prune):\n for layer, heads in heads_to_prune.items():\n self.encoder.layer[layer].attention.pru...
[ "0.72563326", "0.72481006", "0.72481006", "0.72481006", "0.70842814", "0.6267746", "0.5592379", "0.5545439", "0.54839396", "0.54800785", "0.5456683", "0.5320149", "0.5312295", "0.5246493", "0.5192349", "0.51423156", "0.5136725", "0.51237094", "0.5061058", "0.49885798", "0.495...
0.83380306
0
Return list of results sorted by rank
def get_sorted_results(self): results = self.results.values() return sorted(results, key=lambda r: r.rank(), reverse=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_rank_order(self):\n for k in self._run:\n self._run[k].sort(key=lambda x:x.get_rank(),reverse=False)\n tot_res = len(self._run[k])\n for r in self._run[k]:\n r.set_score(tot_res - int(r.get_rank()) + 1)\n print r.get_str()", "def get_p...
[ "0.69254977", "0.684963", "0.6849142", "0.6802348", "0.67524517", "0.6719774", "0.66903794", "0.6648478", "0.6606203", "0.65088266", "0.6424007", "0.6407158", "0.63892245", "0.6320967", "0.63044244", "0.6295104", "0.6294889", "0.62153345", "0.6185796", "0.6177191", "0.6166677...
0.8218771
0
Return a list of dictionaries of the results sorted by rank
def get_sorted_results_by_dict(self): results = self.get_sorted_results() return [dict(r) for r in results]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_sorted_results(self):\n results = self.results.values()\n return sorted(results, key=lambda r: r.rank(), reverse=True)", "def sort_ranking_dict(self):\n\n # reset self.ranking_dict to empty dict (if sorted tuple)\n self.ranking_dict = {}\n\n # create ranking dict with p...
[ "0.775157", "0.6683781", "0.6677163", "0.6617864", "0.65598196", "0.6511982", "0.64773464", "0.6474295", "0.6439614", "0.63109255", "0.6295219", "0.6294836", "0.62821764", "0.625474", "0.62448514", "0.62414736", "0.6218454", "0.62135255", "0.61834943", "0.61212486", "0.610193...
0.6865028
1
Change name reported in log.
def rename(self, name): self._name = name self._logger = logging.getLogger(name) self._logger.setLevel(self._level)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def change_name(change_account):\n change_data(change_account, changed_data='name')", "def new_name(self,new_name):\n self.name = new_name", "def update_name(self, new_name):\r\n self.__name = new_name", "def update_name(self, new_name):\r\n self.__name = new_name", "def set_name(se...
[ "0.75993884", "0.75131446", "0.73500913", "0.73500913", "0.72083247", "0.71485895", "0.70160717", "0.689644", "0.68923503", "0.68923503", "0.6866243", "0.68378323", "0.6815318", "0.6801107", "0.67552984", "0.6750267", "0.6738826", "0.671881", "0.67061144", "0.66812235", "0.66...
0.7860457
0
Smoke test for pipeline runner main. Strictly speaking this is an integration test, not a unit test.
def test_pipeline_runner_main(): working_dir = os.path.join( os.getcwd(), 'tests') pypyr.pipelinerunner.main(pipeline_name='smoke', pipeline_context_input=None, working_dir=working_dir, log_level=50, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testRunSmoke(self):\n stage = self.ConstructStage()\n with self.OutputCapturer():\n stage.Run()", "def test_build_pipeline_one(self):\n args = \"Test_APP ONE TWO THREE\".split(\" \")\n task_list = build_pipeline(args, False)\n self.assertEqual(\"Task One\", task_list[0].execut...
[ "0.76054335", "0.6964659", "0.6951112", "0.69106495", "0.68871206", "0.68079656", "0.67062974", "0.6609242", "0.6600631", "0.65963787", "0.65834165", "0.65677947", "0.654029", "0.6531875", "0.6528586", "0.65184176", "0.65039784", "0.648935", "0.64736086", "0.6444929", "0.6443...
0.848315
0
test attendees for bag_check testing
def get_test_attendees(): attendees = [Attendee(.5, 0.3, .25, .5, i) for i in range(10)] for attendee in attendees: attendee.has_bag = True return attendees
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_teams_invite_member(self):\n pass", "def test_meetings(self):\n pass", "def test_assign_managing_team(self):\n pass", "def test_invite_ct(self):\r\n # for now just make sure we can get a 200 call on it.\r\n params = {\r\n 'api_key': self.api_key\r\n ...
[ "0.63845855", "0.5888382", "0.58855546", "0.5864182", "0.5847379", "0.5691347", "0.5680123", "0.5594723", "0.55914426", "0.55857736", "0.5568812", "0.555654", "0.5538625", "0.553525", "0.54930884", "0.5454616", "0.5431417", "0.5431417", "0.5431417", "0.5431417", "0.5431417", ...
0.69715554
0
Compose fill spectrum from Amplitude and Phase parts
def compose_spectra(amplitude, phase, duplicate=True, **kwargs): if duplicate: amplitude = deepcopy(amplitude) phase = deepcopy(phase) s = amplitude * np.exp(np.array([1.j]) * phase) return s
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def app_complex(data_pupil,data_phase,oversize=4):\n#phase colors\n # cdict = {'red': ((0.0, 1.0, 1.0),(0.25, 0.0, 0.0),(0.5, 0.0, 0.0),(0.75, 1.0, 1.0),(1.00, 1.0, 1.0)),'green': ((0.0, 0.0, 0.0),(0.25, 1.0, 1.0),(0.5, 0.0, 0.0),(0.75, 1.0, 1.0),(1.0, 0.0, 0.0)),'blue': ((0.0, 0.0, 0.0),(0.25, 0.0, 0.0),(0.5, 1...
[ "0.6411826", "0.57913023", "0.5675218", "0.5653244", "0.55799466", "0.5579412", "0.5542808", "0.5533283", "0.55275106", "0.5524995", "0.5507862", "0.55072194", "0.5503415", "0.54930496", "0.5489805", "0.54528993", "0.5415201", "0.5358701", "0.5357929", "0.5354411", "0.5347019...
0.5825405
1
For a given intensity matrix and midpoint value mid_value, return the difference map (see diffmap) with the proper midpoint color.
def get_diffmap_for(M, mid_value=0.0, **kwargs): Mmin, Mmax = M.min(), M.max() return diffmap(mid=(mid_value-Mmin) / (Mmax - Mmin), **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def diffmap(mid=0.5, use_black=False):\n m = int(not use_black)\n segmentdata = { 'red': [(0, 1, 1), (mid, m, m), (1, 0, 0)],\n 'green': [(0, 0, 0), (mid, m, m), (1, 0, 0)],\n 'blue': [(0, 0, 0), (mid, m, m), (1, 1, 1)] }\n return LSC('RdWhBu', segmentdata)", "de...
[ "0.6853404", "0.6015778", "0.5425222", "0.52518445", "0.5215845", "0.5185668", "0.5179875", "0.5131757", "0.5131583", "0.5131583", "0.5131583", "0.5131583", "0.49886134", "0.49092737", "0.4889693", "0.48509473", "0.48508602", "0.47814962", "0.47762534", "0.4763996", "0.474199...
0.6858394
0
Conventional differencing map with graded red and blue for values less than and greater than, respectively, the mean of the data. Values approaching the mean are increasingly whitened, and the mean value is white.
def diffmap(mid=0.5, use_black=False): m = int(not use_black) segmentdata = { 'red': [(0, 1, 1), (mid, m, m), (1, 0, 0)], 'green': [(0, 0, 0), (mid, m, m), (1, 0, 0)], 'blue': [(0, 0, 0), (mid, m, m), (1, 1, 1)] } return LSC('RdWhBu', segmentdata)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def determine_color(score=be.df[\"score\"].mean()):\n avg_score = int(round(be.df[\"score\"].mean(), 0))\n if score < avg_score * 0.95:\n return \"red\"\n elif score > avg_score * 1.05:\n return \"green\"\n else:\n return \"yellow\"", "def lightness(self):\n min_component ...
[ "0.60227", "0.57572806", "0.5668451", "0.56669575", "0.5605286", "0.55654144", "0.5550292", "0.5537512", "0.5494354", "0.5462608", "0.5445197", "0.5441948", "0.53646445", "0.5362676", "0.5309056", "0.5297285", "0.52458024", "0.5243891", "0.52267265", "0.5226143", "0.5220546",...
0.60766786
0
Returns all of the patient fields for a given Patient ID.
def get_patient_fields(connection, patient_id): patient_id = str(patient_id) patient_field_results = pymedphys.mosaiq.execute( connection, """ SELECT TxField.FLD_ID, TxField.Field_Label, TxField.Field_Name, TxField.Version, TxF...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_fields_for_cr(cr_id):\n # Construct request\n url = \"{}/reports/{}/patient_fields\"\n url = url.format(FABRIC_API_URL, cr_id)\n\n sys.stdout.flush()\n result = requests.get(url, auth=auth)\n return result.json()", "def getMetadataFields(self, study_id):\n try:\n con =...
[ "0.7638833", "0.6249444", "0.6241787", "0.5919338", "0.5912562", "0.59045774", "0.5813044", "0.5777699", "0.5760114", "0.5727335", "0.5727335", "0.57182664", "0.5704563", "0.56991935", "0.5695287", "0.568826", "0.5680867", "0.5672122", "0.566745", "0.5660976", "0.56479514", ...
0.7786585
0
converts frame to format suitable for QtGui
def convertFrame(self): try: height,width=self.currentFrame.shape[:2] img=QtGui.QImage(self.currentFrame, width, height, QtGui.QImage.Format_RGB888) img=QtGui.QPixmap.fromImage(img) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convertFrame(self):\r\n try:\r\n height, width = self.currentFrame.shape[:2]\r\n img = QtGui.QImage(self.currentFrame,\r\n width,\r\n height,\r\n QtGui.QImage.Format_RGB888)\r\n img...
[ "0.6662103", "0.5891546", "0.5891546", "0.57573384", "0.57337284", "0.5656035", "0.55532897", "0.55452555", "0.55336356", "0.54665524", "0.5404309", "0.5376422", "0.53557295", "0.5321648", "0.53171486", "0.5305771", "0.52639043", "0.52639043", "0.52639043", "0.5260184", "0.52...
0.6601457
1