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
Records a lap time. If no lap label is specified, a single 'last lap' counter will be (re)used. To keep track of more laps, provide labels yourself.
def lap(self, lap="__lap__"): t = time.time() self.laps[lap] = t return t
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log(self, label, times, overlapping=False):\r\n self._timings.append(Timing(label, times, overlapping))", "def log_time(label: str) -> None:\n print(label, datetime.now())", "def lap(self):\n oldtime = self._clock() - self._starttime\n self._starttime = self._clock()\n return old...
[ "0.6577776", "0.6341617", "0.619218", "0.600884", "0.595028", "0.56649774", "0.5482535", "0.5314698", "0.52446914", "0.5106381", "0.5097195", "0.50922316", "0.5041162", "0.50392014", "0.50362635", "0.50173616", "0.4965538", "0.49572885", "0.49547583", "0.4949091", "0.4937117"...
0.7235086
0
Get the timer for label specified by 'lap'
def get_lap(self, lap="__exit__"): return self.lap[lap]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lap(self, lap=\"__lap__\"):\n t = time.time()\n self.laps[lap] = t\n return t", "def test_time_lapse(self):\n t0 = time.time()\n time.sleep(2)\n lap = time_lapse(t0)\n self.assertEqual(lap, '00:00:02')", "def run_lap():\n pass", "def label(self, t):\n ...
[ "0.66542476", "0.5889318", "0.5687886", "0.56285954", "0.5593656", "0.55107373", "0.524594", "0.5210685", "0.5123175", "0.5055814", "0.49799293", "0.49091572", "0.4891311", "0.4878939", "0.485451", "0.4827149", "0.48147845", "0.47879618", "0.47779948", "0.47756517", "0.475122...
0.7295211
0
Use an HTTP service that only returns IP address.
def myip_http(arg=None): # Return type if no argument for use in Lister. if arg is None: return 'https' page = requests.get(arg, stream=True, timeout=3.05) soup = BeautifulSoup(page.text, 'html.parser') if page.status_code != 200: raise RuntimeError( f"[-] error: {page.re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def api_myip():\n return request.remote_addr, 200, {'Content-Type': 'text/plain'}", "def GetExternalIp():\n h = httplib2.Http(tempfile.gettempdir(), timeout=10)\n url = 'http://whatismyip.akamai.com'\n resp, content = h.request(url, 'GET')\n if resp.status == 200:\n return content\n for provider in (U...
[ "0.6969286", "0.66623604", "0.6631766", "0.66235554", "0.6597741", "0.6467402", "0.6458488", "0.6360583", "0.62954813", "0.6271929", "0.62604827", "0.62479866", "0.6207786", "0.61434484", "0.6139615", "0.6131207", "0.61227196", "0.61169213", "0.61078197", "0.6082477", "0.6081...
0.7358666
0
Return list of available method ids for getting IP address.
def get_myip_methods(include_random=False): methods = list(myip_methods.keys()) # For argparse choices, set True if include_random: methods.append('random') return methods
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_ids_from_ip(self, ip):\r\n try:\r\n # Does it look like an ip address?\r\n socket.inet_aton(ip)\r\n except socket.error:\r\n return []\r\n\r\n # Find the server via ip address. First try public ip, then private\r\n results = self.list_hardware(p...
[ "0.656648", "0.62675756", "0.62597704", "0.5974203", "0.5927884", "0.5880266", "0.5875549", "0.58529127", "0.5826927", "0.5816129", "0.5808003", "0.57877886", "0.5781475", "0.57750034", "0.57587093", "0.57474077", "0.5737622", "0.5725721", "0.57247376", "0.5709294", "0.570403...
0.6813391
0
Main script to initialize DataSource object in interactive python. Currently using ipsana.sh bash script to start this, but should look to using example Dan D. provided for IPython startup. /reg/neh/home/ddamiani/Workarea/psanadev/psmondev/psmon/src/console.py Left some code from psutils module for automatically guessi...
def main(): time0 = time.time() args = initArgs() if not args.exp: from PyDataSource import psutils args.exp = psutils.active_experiment() print('No exp provided -- {:} is the active experiment'.format(args.exp)) ds = PyDataSource.DataSource(**vars(args)) setattr(sys.module...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_run(self, reload=False, *args, **kwargs):\n if 'data_source' in kwargs:\n data_source = kwargs['data_source']\n else:\n data_source = self.get_data_source(*args, **kwargs)\n \n if data_source:\n# try:\n if True:\n self.d...
[ "0.6025968", "0.5882253", "0.5881036", "0.5810399", "0.5765473", "0.5746006", "0.5735826", "0.57271963", "0.5704829", "0.56844497", "0.56774366", "0.5664643", "0.5602337", "0.55749357", "0.5566321", "0.55554545", "0.5535359", "0.5527598", "0.5526025", "0.55064017", "0.5496822...
0.78781056
0
Gets all unique column names for all csv files in file path.
def get_unique_col_names(source_path: str, sink_path: str) -> None: # Get all files in data directory files = glob.glob(get_project_root() + '/' + source_path + '*.csv') # Get all timestamps from filenames [filename_to_timestamp(f, sink_path) for f in files]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_file_names(self):\n return glob.glob(os.path.join(self.path, '*.csv'))", "def get_processed_csv_file_names(directory_path):\n\n\t__supported_extensions = ['.csv', ]\n\n\tprocessed_csv_file_names = list()\n\tlistdir = os.listdir(directory_path)\n\tfor file in listdir:\n\t\tif os.path.splitext(file)...
[ "0.6773052", "0.6419558", "0.6371183", "0.63577497", "0.6126617", "0.6117228", "0.60081875", "0.58998555", "0.5802751", "0.5797968", "0.5726824", "0.57106483", "0.5674198", "0.56591386", "0.56252927", "0.5609181", "0.56086415", "0.5538723", "0.5481517", "0.54493904", "0.54167...
0.7558615
0
Retorna o valor do produto com desconto
def desconto(self, porcentagem): return(self.__valor * (100 - porcentagem)/100)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def descricao_produto(self):\n return self._descricao_produto", "def precio_descuento(self):\n descount_price = self.html.xpath(self.xpath_descount_price)\n precio_descuento = map(self.limpieza_precio, descount_price)\n return precio_descuento", "def get_descuentos(self):\n r...
[ "0.7405879", "0.6725024", "0.6323255", "0.60881495", "0.60817945", "0.6061298", "0.5971168", "0.5968312", "0.5792806", "0.57581604", "0.5727338", "0.5680671", "0.56648684", "0.56408626", "0.5625328", "0.55662155", "0.55641836", "0.5562378", "0.5562378", "0.5552865", "0.552516...
0.70276046
1
Sets a string designating the mutation type.
def set_mutation_type(self, mut_type=''): if mut_type: # specified mutation type self.mutation_type = mut_type else: # interpret mutation type from attributes if not self.is_valid: # does not correctly fall into a category s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def type(self, type: str):\n\n self._type = type", "def type(self, string):\n\n\t\tself._interface.type(string)", "def data_type_string(self, data_type_string):\n\n self._data_type_string = data_type_string", "def set_type(self, type):\n self.type = type", "def set_type(self, type):\n ...
[ "0.6742497", "0.664363", "0.6386889", "0.6342491", "0.6342491", "0.6250034", "0.6208556", "0.62068844", "0.61978424", "0.61978424", "0.6162762", "0.6158626", "0.60422486", "0.60403293", "0.6031799", "0.6026561", "0.6026561", "0.6026561", "0.6026561", "0.6026561", "0.6026561",...
0.78382325
0
Set the is_splicing_mutation flag
def __set_splice_mutation(self): #len5ss = 6 # positive number since 5SS #len3ss = -20 # use negative syntax like HGVS if type(self.intron_pos) == int: # SNV case, only one position if self.len3ss <= self.intron_pos <= self.len5ss: self.is_splicing_mutat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_seen_op(self, boolean):\n\n self.seen_op = boolean", "def toggle_scattering(self, setting=1):\n if setting not in [0, 1, \"on\", \"off\"]:\n raise ValueError(\n \"The input for the toggle the us of scattering \"\n 'in the model must \"on\" (1) or \"o...
[ "0.5286722", "0.52487475", "0.50532234", "0.49155635", "0.48051128", "0.4798468", "0.4796511", "0.47922078", "0.47871938", "0.4733797", "0.4712082", "0.4694651", "0.46598366", "0.46041948", "0.45968363", "0.45936152", "0.45646825", "0.454141", "0.45339727", "0.45288524", "0.4...
0.7626875
0
Sets a flag for unkown effect (c.? or ?).
def __set_unknown_effect(self, hgvs_str): unknown_effect_list = ['c.?', '?'] if hgvs_str.lower() in unknown_effect_list: self.unknown_effect = True elif hgvs_str.startswith("("): self.unknown_effect = True else: self.unknown_effect = False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_fluorescence(self, flag):\n flag_ = c.c_int(flag)\n logger.debug('StSetFluorFlg(%i)', flag)\n self._lib.StSetFluorFlg(flag_)", "def take_action_on_flags(self, *args, **kwargs):\r\n pass", "def setFlag(self, flag, value) -> None:\n ...", "def flag(self, reason):\r\n ...
[ "0.6180999", "0.60227305", "0.59633523", "0.58997005", "0.5819151", "0.5815705", "0.580962", "0.57771164", "0.5773074", "0.5726969", "0.56456053", "0.56246287", "0.5571652", "0.5487456", "0.54704344", "0.54658586", "0.54554933", "0.5448815", "0.5436461", "0.5383572", "0.53551...
0.6313566
0
Sets a flag for missing data (? in HGVS syntax).
def __set_missing_info(self, hgvs_str): if '?' in hgvs_str: self.is_missing_info = True else: self.is_missing_info = False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def missing(self, value):\n self.MISSING = value", "def no_data_value(self, no_data_value):\n\n self._no_data_value = no_data_value", "def missing_information(self, info, field):\n raise NoData", "def correct_miss_fill(ds):\n for d in ds.data_vars:\n try:\n ds[d].att...
[ "0.6888793", "0.62723064", "0.5965886", "0.5911416", "0.58497274", "0.5812564", "0.58124995", "0.58106726", "0.58079594", "0.58027685", "0.5800109", "0.57520694", "0.5685451", "0.5645255", "0.5604394", "0.5580269", "0.55797935", "0.55784595", "0.55784595", "0.55740666", "0.55...
0.69292474
0
Parse the HGVS DNA mutation string to set attributes. Look at tests/test_nucleotide.py for examples on how specific HGVS strings should be parsed.
def __parse_hgvs_syntax(self, hgvs_str): self.is_valid = True # assume initially the syntax is valid if self.is_substitution: sub_pattern = '(?:(\d+)([+-]\d+)?_)?(\d+)([+-]\d+)?([A-Z]+)>([A-Z]+)$' matches = re.findall(sub_pattern, hgvs_str) if matches: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __set_nucleotide_mutation(self, hgvs_str):\n self.__set_substitution_status(hgvs_str)\n self.__set_indel_status(hgvs_str)", "def _parseAttributeString(self, line):\n attribute, value = line.partition(' ')[::2]\n self._setAttribute(attribute, value)", "def format_hgvs_mutation(mu...
[ "0.57316065", "0.5169754", "0.5088486", "0.49869543", "0.4979097", "0.4970234", "0.48902816", "0.48882684", "0.4880839", "0.48786032", "0.4860372", "0.48560435", "0.48316512", "0.48309886", "0.4803737", "0.4778657", "0.47782975", "0.476909", "0.47433475", "0.47147992", "0.470...
0.6598335
0
Variables for clients scalar aggregation.
def clients_scalar_aggregates(**kwargs): attributes_list = [ "client_id", "ping_type", "os", "app_version", "app_build_id", "channel", ] attributes_type_list = ["STRING", "STRING", "STRING", "INT64", "STRING", "STRING"] user_data_attributes_list = ["metric...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _aggregate(self, *params): \n serialized_params = np.array([self._serialize(client) for client in params])\n serialized_aggregation = self._aggregate(*serialized_params)\n aggregated_weights = self._deserialize(serialized_aggregation)\n \n return aggregated_weights", ...
[ "0.5818746", "0.5604993", "0.55532503", "0.543757", "0.5422631", "0.5242082", "0.52301157", "0.498277", "0.49819478", "0.49520943", "0.48781514", "0.48485976", "0.48349586", "0.48041868", "0.47949913", "0.47696248", "0.47664636", "0.47661284", "0.4756242", "0.47452343", "0.47...
0.65746534
0
Variables for scalar bucket_counts.
def scalar_bucket_counts(**kwargs): attributes_list = ["ping_type", "os", "app_version", "app_build_id", "channel"] fixed_attributes = ["app_version", "channel"] cubed_attributes = [x for x in attributes_list if x not in fixed_attributes] return dict( attributes=",".join(attributes_list), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def raw_counts(self):\n return np.array([1, 2, 3])", "def raw_counts(self):\n return np.array([1, 2, 3])", "def histogram_bucket_counts(**kwargs):\n attributes_list = [\"ping_type\", \"os\", \"app_version\", \"app_build_id\", \"channel\"]\n metric_attributes_list = [\"metric\", \"metric_typ...
[ "0.619195", "0.619195", "0.6113734", "0.61020154", "0.6027104", "0.60071844", "0.58921134", "0.58503234", "0.57796675", "0.576681", "0.576681", "0.5760521", "0.5759519", "0.57510465", "0.5747679", "0.57229006", "0.57080144", "0.5696534", "0.56908894", "0.56377625", "0.5584959...
0.6860446
0
Variables for clients histogram bucket counts.
def histogram_bucket_counts(**kwargs): attributes_list = ["ping_type", "os", "app_version", "app_build_id", "channel"] metric_attributes_list = ["metric", "metric_type", "key", "agg_type"] fixed_attributes = ["app_version", "channel"] cubed_attributes = [x for x in attributes_list if x not in fixed_attr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_counts(self) -> Dict[int, int]:\n if self._split_counts is None:\n self.RefreshStats()\n return self._split_counts", "def __init__(self):\n self.num_counts = {}", "def make_histogram(points, bucket_size):\r\n return Counter(bucketize(point, bucket_size) for point in points)", "...
[ "0.64437705", "0.6230765", "0.5934437", "0.5867544", "0.5862011", "0.5840779", "0.5840779", "0.5733316", "0.57241476", "0.5720756", "0.57149744", "0.5714322", "0.57127947", "0.57107496", "0.56810373", "0.5674694", "0.5669135", "0.56563807", "0.5625264", "0.56244755", "0.56134...
0.6240644
1
Variables for scalar percentiles.
def scalar_percentiles(**kwargs): attributes = ["ping_type", "os", "app_version", "app_build_id", "channel"] fixed_attributes = ["app_version", "channel"] cubed_attributes = [x for x in attributes if x not in fixed_attributes] return dict( # TODO: be consistent with naming of attributes (e.g. a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def p(n):\n def p_(x):\n return np.percentile(x, n)\n\n p_.__name__ = \"p_%s\" % n\n return p_", "def matlab_percentile(in_data, percentiles):\n data = np.sort(in_data)\n p_rank = 100.0 * (np.arange(data.size) + 0.5) / data.size\n perc = np.interp(percentiles, p_rank, data, left=data[0],...
[ "0.61870414", "0.61465955", "0.61424303", "0.60795677", "0.6067243", "0.60474974", "0.6034548", "0.5990514", "0.5940601", "0.59211874", "0.5808842", "0.5808842", "0.57736224", "0.5736083", "0.56959504", "0.5695266", "0.56910336", "0.56861234", "0.5676175", "0.5672638", "0.566...
0.6244538
0
Sort list by Name attribute
def sort_by_name(list_to_sort): return sorted( list_to_sort, key=lambda k: k['Name'].lower() )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sort_names(li, by_which):\n \n if by_which == 'first':\n li.sort(key = Name.first)\n elif by_which == 'last':\n li.sort(key = Name.last)", "def sortByName(requestContext, seriesList):\n def compare(x,y):\n return cmp(x.name, y.name)\n\n seriesList.sort(compare)\n return seriesLis...
[ "0.75667953", "0.73988223", "0.7169916", "0.7092047", "0.70860684", "0.68805975", "0.6856633", "0.68530154", "0.6819512", "0.6807089", "0.6799249", "0.6778685", "0.6757527", "0.66386515", "0.65819705", "0.6440485", "0.642067", "0.64073896", "0.64035416", "0.63455665", "0.6334...
0.7980984
0
Get all instance reservations for a profile
def get_ec2_reservations(profile, running_filter): try: ec2_client = boto3.Session(profile_name=profile).client('ec2') except ProfileNotFound: print("Profile: %s not found" % profile, file=sys.stderr) sys.exit(1) filtered_instances = ec2_client.describe_instances(Filters=running_filt...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_reservations(config):\n reservations = []\n region_list = regions(aws_access_key_id=config.keys.api,\n aws_secret_access_key=config.keys.secret)\n for region in region_list:\n _logger.info(\"Searching %s\", region)\n cnx = region.connect(aws_access_key_id=config.keys.api,\...
[ "0.70828646", "0.69551444", "0.63018495", "0.62302214", "0.6171069", "0.61087954", "0.6061365", "0.6009173", "0.58852756", "0.5856838", "0.5851381", "0.5816237", "0.5808627", "0.57474256", "0.57241356", "0.57098675", "0.56716835", "0.5623796", "0.5615587", "0.56060773", "0.55...
0.7721795
0
Test that getting tags is successful
def test_get_tags_successful(self): Tag.objects.create(user=self.user, name='Vegan') Tag.objects.create(user=self.user, name='Dessert') res = self.client.get(TAGS_URL) tags = Tag.objects.all().order_by('-name') serializer = TagSerializer(tags, many=True) self.assertEqu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_list(self):\n response = self.app.get(self.url('tags.list'))\n # Test response...", "def test_show_tags(self):\r\n\r\n with app.test_client() as client:\r\n resp = client.get(\"/tags\")\r\n html = resp.get_data(as_text=True)\r\n tags = Tag.query.all(...
[ "0.783578", "0.7753292", "0.771596", "0.7457215", "0.74495363", "0.73183525", "0.7141053", "0.7133542", "0.71330744", "0.7128664", "0.7118904", "0.71148205", "0.70716166", "0.70590526", "0.70323956", "0.70219934", "0.701507", "0.7002467", "0.69986093", "0.69817287", "0.698142...
0.7995485
0
Test that adding a tag is successful
def test_add_tag_successful(self): payload = {'name': 'test tag'} self.client.post(TAGS_URL, payload) # self.assertEqual(res.status_code, status.HTTP_201_CREATED) exists = Tag.objects.filter( user=self.user, name=payload['name'] ).exists() self.as...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_add_tag(self):\r\n\r\n with app.test_client() as client:\r\n d = {\"name\": \"hero\"}\r\n resp = client.post(\"/tags/new\", data=d, follow_redirects=True)\r\n html = resp.get_data(as_text=True) \r\n\r\n self.assertEqual(resp.status_code, 200)\r\n ...
[ "0.84031516", "0.7963376", "0.78905445", "0.78477657", "0.77803254", "0.7744458", "0.7717115", "0.7699082", "0.7671048", "0.7661872", "0.76451296", "0.7629898", "0.7573351", "0.75318795", "0.75171554", "0.7457491", "0.74124134", "0.7369319", "0.73623157", "0.73550355", "0.735...
0.7980848
1
1. Query all of the puppies and return the results in ascending alphabetical order
def query_one(): puppies = session.query(Puppy.name).order_by(Puppy.name.asc()).all() for puppy in puppies: print puppy.name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def query_three():\n \n puppies = session.query(Puppy.name, Puppy.weight).order_by(Puppy.weight.asc()).all()\n \n for puppy in puppies:\n print \"{puppy_name}: {weight}\".format(puppy_name=puppy[0], weight=puppy[1])", "def __qualitaetsListeProteins(self):\n rv = []\n pam30_sortie...
[ "0.62195045", "0.6189954", "0.60429305", "0.59504145", "0.593689", "0.59041137", "0.58872336", "0.5828653", "0.5522957", "0.551187", "0.549347", "0.54705834", "0.5439277", "0.539479", "0.53898966", "0.5383236", "0.53803074", "0.5371636", "0.53633094", "0.5298849", "0.5276708"...
0.69107115
0
2. Query all of the puppies that are less than 6 months old organized by the youngest first
def query_two(): today = datetime.date.today() max_days_old = 180 max_birthday = today - datetime.timedelta(days = max_days_old) puppies = session.query(Puppy.name, Puppy.dateOfBirth).filter(Puppy.dateOfBirth >= max_birthday).order_by(Puppy.dateOfBirth.desc()).all() for puppy in puppies: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upcoming_meetups_query(cls):\r\n # Warning, this timestamp inequality is actually done as a string comparison\r\n # in the db for some reason. BUT, since epoch seconds won't get another digit\r\n # for another 275 years, we're good for now...\r\n return Meetup._query(Meetup.c.timestamp > time.time...
[ "0.5563784", "0.55196935", "0.5485716", "0.5437919", "0.5433165", "0.5424259", "0.5388219", "0.5372176", "0.5352127", "0.53500694", "0.53387654", "0.53329307", "0.5328321", "0.5301275", "0.52543426", "0.52214634", "0.5210267", "0.5205575", "0.52035064", "0.5195869", "0.516637...
0.5989886
0
3. Query all puppies by ascending weight.
def query_three(): puppies = session.query(Puppy.name, Puppy.weight).order_by(Puppy.weight.asc()).all() for puppy in puppies: print "{puppy_name}: {weight}".format(puppy_name=puppy[0], weight=puppy[1])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getByWeight(list, w):\n itemId = 0\n partialWeight = list[0][1]\n while partialWeight < w:\n itemId += 1\n partialWeight += list[itemId][1]\n return list[itemId]", "def partial_pgs(dset: admix.Dataset, weight: np.ndarray):\n pass", "def selection_wheel(self, weighted_population...
[ "0.62865865", "0.5884093", "0.58838344", "0.57850003", "0.57574505", "0.5615625", "0.55487806", "0.5510328", "0.5503547", "0.5503547", "0.54957587", "0.5479928", "0.5474046", "0.5428138", "0.54146487", "0.54041064", "0.539627", "0.5385185", "0.5379307", "0.53660184", "0.53618...
0.7313781
0
4. Query all puppies grouped by the shelter in which they are staying. Show count of puppies at each shelter
def query_four(): puppies = session.query(Shelter, func.count(Puppy.id)).join(Puppy).group_by(Shelter.id).all() for shelter_puppy in puppies: print "{shelter_name}: {puppy}".format(shelter_name=shelter_puppy[0].name, puppy=shelter_puppy[1])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count(cls, queryset):\n result_group = queryset.values('date')\n annotate_report = result_group.annotate(\n breakfast=CountTrue('breakfast'),\n lunch=CountTrue('lunch')\n )\n\n def serialize(queryset):\n return [\n {\"breakfast\": res[...
[ "0.58302456", "0.5761377", "0.57559884", "0.57153726", "0.55361503", "0.53359115", "0.53024775", "0.53024465", "0.52998257", "0.52760255", "0.5253698", "0.52469337", "0.5225774", "0.5219363", "0.52180797", "0.52175015", "0.5206509", "0.5189646", "0.51462865", "0.5143075", "0....
0.75888115
0
Same functionality as RelPosEmb1D
def rel_pos_emb_1d(q, rel_emb, shared_heads): if shared_heads: emb = torch.einsum('b h t d, r d -> b h t r', q, rel_emb) else: emb = torch.einsum('b h t d, h r d -> b h t r', q, rel_emb) return relative_to_absolute(emb)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetPosition(self):\n ...", "def get_position(self, position):", "def embed():", "def parent(self, pos): \n return pos//2", "def position(self):\r\n pass", "def prepare_emb(self):\n with tf.variable_scope(\"PrepEmb\", reuse=tf.AUTO_REUSE):\n self.src_ten = tf.cas...
[ "0.5444562", "0.54409677", "0.5416211", "0.5387021", "0.5341349", "0.5335706", "0.53265387", "0.53168595", "0.52536285", "0.5244918", "0.5244918", "0.5244918", "0.5244918", "0.5244918", "0.5244918", "0.5244918", "0.5244918", "0.5244918", "0.5244918", "0.5244918", "0.52423215"...
0.6280389
0
Updates current querystring with a given dict of params, removing existing occurrences of such params. Returns a urlencoded querystring.
def updated_querystring(request, params): original_params = request.GET.copy() for key in params: if key in original_params: original_params.pop(key) original_params.update(params) return original_params.urlencode()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def replace_query_params(cls, url: str, **params: Mapping[str, str]) -> str:\n url, _ = cls.separate_query_params(url, params.keys())\n return cls.add_query_params(url, **params)", "def get_query_string(p, new_params=None, remove=None):\n if new_params is None:\n new_params = {}\n if r...
[ "0.7936514", "0.74957633", "0.7153125", "0.6790267", "0.67709136", "0.6738045", "0.67204905", "0.6706251", "0.6668768", "0.66175866", "0.65436184", "0.64668345", "0.64521825", "0.64521825", "0.64507204", "0.6441597", "0.63582", "0.635697", "0.6322598", "0.6310018", "0.6254809...
0.8049712
1
If template context variable with `name` not set get default value from django.settings
def context_or_settings(context, name): if name in context: return context[name] return getattr(settings, 'DEFAULT_' + name.upper())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def context_or_settings(context, name):\n if name in context:\n return context[name]\n return getattr(settings, \"DEFAULT_\" + name.upper())", "def get(self, name, default=''):\n return getattr(settings, name, DEFAULT_SETTINGS.get(name, default))", "def overridable(name, default):\n retu...
[ "0.7920417", "0.69148594", "0.668963", "0.64151293", "0.6401593", "0.6313355", "0.62323475", "0.6224653", "0.61965585", "0.6167027", "0.6102653", "0.6031418", "0.60309875", "0.6024571", "0.6023175", "0.60073507", "0.5987906", "0.59244883", "0.591425", "0.59125286", "0.5911162...
0.79297477
0
Parses raw data in family field.
def parse_raw_family_string(family_raw): return map(parse_family_member, filter(None, family_raw.split(";")))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse(self, data):\n raise NotImplementedError", "def parse_data(self):\n\t\traise NotImplementedError('%s: No parse function implemented!' % self.name)", "def parse(cls, data):\n raise NotImplementedError", "def parse (cls, raw_data):\n # Parse text\n model = NFFGModel.parse(raw_data...
[ "0.639509", "0.6316901", "0.6251834", "0.60667557", "0.5943526", "0.5904677", "0.590174", "0.58886784", "0.58568", "0.5732877", "0.5695509", "0.5673828", "0.5630869", "0.5599959", "0.5596141", "0.55798674", "0.5560866", "0.5554267", "0.551541", "0.5472412", "0.5449194", "0....
0.7011084
1
Decodes jwt token and returns u_id
def decode_token(token): payload = None try: payload = jwt.decode(token.encode('utf-8'), '1$Arh"1bWa/7+OS', algorithm='HS256')['u_id'] except jwt.InvalidTokenError: pass return payload
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decode_token(token):\n decoded_token = jwt.decode(token, secret_key, algorithms=['HS256'])\n return decoded_token", "def decode_token(token):\n\n return jwt.decode(\n token, settings.JWT_SECRET, algorithms=[settings.JWT_ALGO])", "def decode_auth_token(auth_token):\n try:\n ...
[ "0.73388416", "0.7323046", "0.7312567", "0.73051447", "0.72864336", "0.7283443", "0.7226972", "0.72155005", "0.7181544", "0.71759796", "0.7158139", "0.7103684", "0.7087449", "0.70397997", "0.70281523", "0.70019835", "0.6946715", "0.6909414", "0.684371", "0.6787965", "0.677747...
0.8062185
0
Turn a BeautifulSoup form into a dict of fields and default values
def __extract_form_fields(self, soup): fields = OrderedDict() for input in soup.find_all('input', attrs={'name': True}): if 'type' not in input.attrs: input.attrs['type'] = 'text' # Single element name/value fields if input.attrs['type'].lower() in ('t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_form_fields(url):\n page = urlopen(url)\n soup = BeautifulSoup(page)\n form = soup.form\n\n # Setting up data structure\n form_data = dict(fields=[])\n form_attr = dict(form.attrs)\n\n form_data['title'] = soup.h1 and soup.h1.text or soup.title.text\n form_data['action'] = urljoin(u...
[ "0.71022296", "0.6459439", "0.6177059", "0.6105775", "0.599876", "0.59322363", "0.591192", "0.58990943", "0.58737135", "0.5773327", "0.5691127", "0.56752855", "0.5608315", "0.5581501", "0.55641794", "0.5464512", "0.5438915", "0.54178506", "0.54005194", "0.53804064", "0.537791...
0.75426733
0
Try to find the name of username field among a list of input fields. Looks for the most evocative value for the "name" attribute
def __find_username_field_via_name(self, inputs): for input in inputs: for n in ('name', 'login', 'user', 'mail'): if n in input.attrs['name'].lower(): return input.attrs['name'] return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_names_users(self):\n user_1 = self.view.entry_player_1.get()\n user_2 = self.view.entry_player_2.get()\n if len(user_1) == 0 or len(user_2) == 0:\n\n tk.messagebox.showwarning(\"Warning\", \"Please enter players name\")\n self.logger.warning(\"Please enter players...
[ "0.62485945", "0.60185325", "0.57569325", "0.56318814", "0.5626669", "0.5613124", "0.5558389", "0.55256784", "0.55114937", "0.5503218", "0.54988205", "0.5492651", "0.54753804", "0.54659086", "0.54486895", "0.54486895", "0.54365706", "0.5434026", "0.54223335", "0.5385833", "0....
0.82819116
0
clear ip arp inspection statistics
def clear_ip_arp_inspection_stats(device): log.info("clear ip arp inspection statistics on {device}".format(device=device)) dialog = Dialog([Statement(pattern=r'\[confirm\].*', action='sendline(\r)',loop_continue=True,continue_timer=False)]) try: device.execute("clear ip arp inspection statistics"...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flush_arp(self):\n self.cli.cmd('ip neighbour flush all')", "def clear_statistics(self, sniff_port_list):\n pass", "def clear(self):\n self.sum_hit_at_one = 0.0\n self.sum_perr = 0.0\n self.sum_loss = 0.0\n self.map_calculator.clear()\n self.global_ap_calculator.clear()\n se...
[ "0.7376848", "0.6851561", "0.61201775", "0.6055344", "0.6003891", "0.58312273", "0.5794471", "0.57746357", "0.57414865", "0.57137805", "0.5713237", "0.563474", "0.5631463", "0.5629161", "0.55918115", "0.55341196", "0.55341196", "0.5510395", "0.55059004", "0.548406", "0.547733...
0.8344019
0
A dictionary to map required slots to an extracted entity
def slot_mappings(self) -> Dict[Text, Union[Dict, List[Dict]]]: return { "bug":[self.from_entity( entity="bug", intent="inform"), self.from_text( intent="inform")], "beverage": [self.from_entity( entity="be...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def slot_mappings(self) -> Dict[Text, Union[Dict, List[Dict]]]:\n\n return {\n \"product\": [\n self.from_entity(entity=\"product\", intent=[\"inform\"]),\n ],\n \"applicant_name\": [\n self.from_entity(entity=\"applicant_name\", intent=[\"infor...
[ "0.6995648", "0.6558813", "0.64900076", "0.6489124", "0.64611995", "0.64086974", "0.63684666", "0.63684666", "0.6338538", "0.62612367", "0.62104833", "0.6197755", "0.6197755", "0.5999761", "0.59434724", "0.59309", "0.588155", "0.58714616", "0.5779117", "0.5742074", "0.5714348...
0.6862953
1
Database of multiple choice answers
def answers_db() -> Dict[str, List]: return{"lawyer":["either","other","law","boy"], "cot_caught":["different","other","same"], "second_person_plural":["other","y'all","yins", "you","you'uns","you all","you guys","you lot", "yous, youse"], "yard_sale":["car boot","car boo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_answers(self):\r\n pass", "def answers_all(self):\n return self.answer_set.all()", "def quiz_selection():\n\n verbs = crud.get_verbs()\n tenses = crud.get_tenses()\n\n return render_template(\"verb-conjugation.html\", verbs=verbs, tenses=tenses)", "def collection(self):\n ...
[ "0.6372834", "0.6058923", "0.6049124", "0.60463506", "0.6011711", "0.59754276", "0.5964876", "0.58967185", "0.58833796", "0.5869681", "0.58407676", "0.58407676", "0.58407676", "0.58407676", "0.5830177", "0.58156514", "0.5808251", "0.5800475", "0.5790557", "0.5755108", "0.5726...
0.6919275
0
Function generate our validation functions, since they're pretty much the same for each slot
def create_validation_function(name_of_slot): def validate_slot( self, value: Text, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict[Text, Any], ) -> Dict[Text, Any]: """Validate user input.""" if value....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate():", "def question_new_validate():", "def __validate():\n # TODO: implement", "def validate(self):", "def validate(self):", "def validate(self):\n\n\tmissing = []\n\tbadcheck = []\n\tfor name, checkfunc, params in self._required:\n\t try:\n\t\targ = self.make_required(name)\n\t\tif che...
[ "0.69904894", "0.6749303", "0.65610975", "0.64473385", "0.64473385", "0.6413806", "0.63149947", "0.6285735", "0.62739533", "0.62182045", "0.61723286", "0.61714697", "0.61690015", "0.6168363", "0.6159842", "0.61568487", "0.6098348", "0.6089911", "0.5990922", "0.5985952", "0.59...
0.7123748
0
Database of slot values & corresponding questions
def slot_key_db() -> Dict[str, List]: return {'q50': 'second_person_plural', 'q28': 'cot_caught', 'q80': 'rain_sun', 'q66': 'crawfish', 'q110': 'halloween', 'q64': 'sandwich', 'q90': 'side_road', 'q105': 'beverage', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def return_questions_data():\n conn = sq.connect(host='localhost', user='root',\n password='student', database='quiz')\n cursor = conn.cursor()\n \n cursor.execute(\"select * from questions\")\n data = cursor.fetchall()\n\n table = PrettyTable()\n table.field_names = [...
[ "0.5948487", "0.572332", "0.5715427", "0.5700892", "0.56761324", "0.56518036", "0.5600143", "0.55988514", "0.55528927", "0.55419713", "0.5529572", "0.55215013", "0.5486724", "0.5486546", "0.5483428", "0.5483428", "0.54654187", "0.5455922", "0.54557544", "0.5442031", "0.543996...
0.6630833
0
Calculates pairs of nodes (i, j) that have at least one common neighbour.
def _get_common_neighbour_node_pairs(self): node_pairs = [] for node1 in self.graph.nodes(): for node2 in self.graph.nodes(): if node1 != node2: neighbour_count = self.neighbour_counts[(node1, node2)] if neighbour_count >= 1: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_common_neighbours(p1: Position, p2: Position) -> List[Position]:\n i, j = p1\n l1 = [(i + x, j + y) for x, y in NEIGHBORS_1]\n i, j = p2\n l2 = [(i + x, j + y) for x, y in NEIGHBORS_1]\n return [k for k in l1 if k in l2]", "def get_neighbors(size_i, size_j, ij):\n i,j = ij\n neighbor...
[ "0.71448857", "0.6700568", "0.66831475", "0.6655144", "0.655701", "0.64960265", "0.6442587", "0.64309496", "0.63989466", "0.6389736", "0.63726455", "0.63648593", "0.6331582", "0.6319956", "0.629356", "0.6202063", "0.6175751", "0.6175056", "0.6142384", "0.61294764", "0.6110346...
0.77886975
0
Return list of service_ids that match a given datetime
def getServiceIdsForDate(self, dt, exclude0000=True): dayDict = {1:"monday", 2:"tuesday", 3:"wednesday", 4:"thursday", 5:"friday", 6:"saturday", 7:"sunday"} sqlQuery = "select service_id from calendar" \ + " where {} = 1".format(dayDict[dt.isoweekday()]) \ + " and...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_serviceIDs_for_date(date):\n global SDHandler\n return SDHandler.effective_service_ids(date);", "def filter_list_by_day(vevent_seq, dt=None):\n dt = dt or datetime_now()\n if is_naive(dt):\n dt = make_aware(dt)\n start = datetime.datetime(dt.year, dt.month, dt.day, tzinfo=dt.tzinfo)\n ...
[ "0.7054457", "0.55842924", "0.5545218", "0.5449232", "0.53947216", "0.5309217", "0.52697635", "0.52399474", "0.5219247", "0.51845676", "0.51796013", "0.5153664", "0.51219136", "0.50670344", "0.5062298", "0.50604385", "0.5058337", "0.5056613", "0.5055468", "0.50297636", "0.501...
0.71749496
0
Provides the template tag {% attendance SESSION USER as ATTENDING TENTATIVE %}
def do_attendance(parser, token): try: _tagname, session, user, _as, context_attending, context_tentative = token.split_contents() except ValueError: raise template.TemplateSyntaxError(u'%(tagname)r tag syntax is as follows: ' '{%% %(tagname)r SESSION USER as VARIABLE1 VARIABLE2 %%}'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def myevents(request):\n context = RequestContext(request)\n\n user = request.user\n\n return render_to_response('myevents.html', context)", "def attendingAamas(request):\n # Test Comment\n assert isinstance(request, HttpRequest)\n return render(\n request,\n 'attendingAamas.html'...
[ "0.5380975", "0.5284373", "0.51338685", "0.50877583", "0.47516084", "0.4744274", "0.46639973", "0.46611938", "0.46537858", "0.46502122", "0.4644335", "0.46430787", "0.46318945", "0.46318626", "0.4629813", "0.4629813", "0.46247694", "0.4561819", "0.45509246", "0.45318717", "0....
0.7040058
0
Test the ability to send http requests and receive responses.
def test_http_request(self): response = requests.get(self.live_server_url) assert response.status_code == 200
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def test_http_communicator():\n communicator = HttpCommunicator(SimpleHttpApp(), \"GET\", \"/test/?foo=bar\")\n response = await communicator.get_response()\n assert response[\"body\"] == b\"test response\"\n assert response[\"status\"] == 200", "def test_requests():\n resp = requests.get('h...
[ "0.73358715", "0.7149893", "0.706139", "0.7047892", "0.6992253", "0.6875096", "0.68440574", "0.6793313", "0.6736568", "0.6731907", "0.6665411", "0.6582444", "0.65607095", "0.6537129", "0.6513156", "0.6468829", "0.6438426", "0.6429819", "0.6426431", "0.6422942", "0.6403098", ...
0.74512917
0
Test the ability to send and receive messages over WebSocket.
def test_websocket_message(self): ws = websocket.create_connection(self.live_server_ws_url) ws.send('test') response = ws.recv() ws.close() assert 'test' == response
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def test_websocket_communicator():\n communicator = WebsocketCommunicator(SimpleWebsocketApp(), \"/testws/\")\n # Test connection\n connected, subprotocol = await communicator.connect()\n assert connected\n assert subprotocol is None\n # Test sending text\n await communicator.send_to(tex...
[ "0.7966903", "0.76768017", "0.7575018", "0.7060776", "0.6980282", "0.69595164", "0.6943459", "0.6832196", "0.6824839", "0.6571906", "0.6556549", "0.65429413", "0.6536917", "0.653471", "0.65176815", "0.6514772", "0.6420771", "0.64101034", "0.63527155", "0.6324924", "0.6294606"...
0.7992703
0
Verify that the __version__ in the module is being correctly pulled from the pyproject.toml config
def test_module_version_matches_pyproject_version(): version_from_package_init = __version__ # this is so that the test finds the pyproject.toml file when run from the command line or from within Pycharm this_directory = os.path.dirname(os.path.realpath(__file__)) pyproject_toml_path = os.path.join(thi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_version(self) -> None:\n with open(\"pyproject.toml\") as f:\n for line in f:\n if \"version\" in line:\n version = line.split()[-1].replace('\"', \"\")\n break\n self.assertEqual(__version__, version)", "def test_version():\n...
[ "0.76714927", "0.7583335", "0.70532936", "0.70007664", "0.69990474", "0.6964934", "0.69035417", "0.6880883", "0.6865948", "0.6860865", "0.6843608", "0.6820196", "0.67528504", "0.6709303", "0.6704592", "0.66768426", "0.66471404", "0.663688", "0.6608777", "0.65195024", "0.65166...
0.7678285
0
Writes the loss onto the Tensorboard log
def log_loss(self, loss: float, duration: float, iteration: int): self.train_writer.add_scalar("Time", duration, iteration) self.train_writer.add_scalar("Loss", loss, iteration)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_log(callback, name, loss, batch_no):\n tf.summary.scalar(name,loss)\n tf.summary.scalar(name,batch_no)\n callback.flush()", "def report(LOGDIR, epoch, e_dict, saver, sess, fh_log):\n # print loss\n print (\"Epoch: %i; Loss: %f; KLd: %f; CE %f\" % (epoch, e_dict[\"loss\"][-1], e_dict[\"KLd\...
[ "0.77510965", "0.68144965", "0.68104905", "0.6748108", "0.66942436", "0.6621524", "0.65469015", "0.64916056", "0.6481054", "0.6480031", "0.6452032", "0.6398478", "0.63887477", "0.63484746", "0.6345198", "0.63233024", "0.63219935", "0.6314104", "0.63047945", "0.6295101", "0.62...
0.7034058
1
Remove a record with a given id from the table.
def remove(table, id_): table, successful = common.remove_record(table, id_) if not successful: ui.print_error_message('Error!') return table
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove(table, id_):\n\n record = common.find_id(table, id_[0])\n if record in table:\n table = common.remove_record(table, record)\n\n return table", "def delete_record(self, id_: str) -> None:\n instance = self._get(id_)\n self._delete_from_db(instance)", "def delete_record(s...
[ "0.80548465", "0.8014713", "0.76164806", "0.7429268", "0.7287538", "0.72552764", "0.70760125", "0.70389813", "0.70386046", "0.6974744", "0.69381046", "0.69041747", "0.6890031", "0.68539524", "0.68431026", "0.68202865", "0.68175966", "0.68118525", "0.68029445", "0.67899823", "...
0.8177736
0
Check how many different games are made by each manufacturer. Return dictionary where key is manufacturer and value is number of games by it.
def get_counts_by_manufacturers(table): manufacturers_dict = {} for item in table: try: if item[2]: try: if item[2] in manufacturers_dict.keys(): manufacturers_dict[item[2]] += 1 else: man...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_counts_by_manufacturers(table):\n manufacturers = []\n for item in table:\n if item[2] not in manufacturers:\n manufacturers.append(item[2])\n\n manufacturers_games = {}\n\n for record in manufacturers:\n games_counter = 0\n for item in table:\n if ite...
[ "0.80333066", "0.6666297", "0.60503423", "0.5857039", "0.5830689", "0.5794255", "0.57780874", "0.57385373", "0.5657014", "0.5654159", "0.56414384", "0.5587509", "0.5579291", "0.55584073", "0.55410427", "0.55083615", "0.5503112", "0.54968363", "0.54839206", "0.5473748", "0.546...
0.73525363
1
Give back average amount of games in stock of a given manufacturer. Count how many different games are in stock by given manufacturer and how many copies of them are in total. On that base avarege amount is count.
def get_average_by_manufacturer(table, manufacturer): games = 0 manufacturer_apperance = 0 for i in range(len(table)): try: if manufacturer.lower() == table[i][2].lower(): games += int(table[i][-1]) manufacturer_apperance += 1 except (IndexError, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_average_by_manufacturer(table, manufacturer):\n games_sum = 0\n games_occurance = 0\n for item in table:\n if item[2] == manufacturer:\n games_sum += int(item[4])\n games_occurance += 1\n\n average_amount = games_sum / games_occurance\n\n return average_amount", ...
[ "0.7342873", "0.6410505", "0.6404865", "0.6355063", "0.60661423", "0.5972831", "0.5928848", "0.58975023", "0.5817373", "0.5790253", "0.578803", "0.57879853", "0.5711856", "0.569899", "0.56955236", "0.5678931", "0.56765807", "0.5669755", "0.56412584", "0.5638682", "0.56296676"...
0.7130538
1
Checks whether the lattice is binary or not i.e if every vertex except the bottom covers maximum two elements and is covered by maximum two elements
def is_binary(self): for element in self: if element != self.bottom and not self.isa_binary_element(element): return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_upper_triangular(self):\n self.check_square()\n\n for i in range(self.rows):\n for j in range(i):\n if self[i, j] != 0:\n return False\n return True", "def check_bp(self):\n return self.min_basepairs <= self.seqdata.basepairs <= self...
[ "0.6223635", "0.6164103", "0.6037212", "0.6003846", "0.6003286", "0.600052", "0.59370893", "0.59369665", "0.5901001", "0.5893176", "0.5862025", "0.5842988", "0.5840645", "0.5815979", "0.5813464", "0.57918024", "0.57914144", "0.57866615", "0.5781662", "0.5779035", "0.57772624"...
0.62754655
0
Checks whether a given element is binary or not i.e if it covers maximum two elements and is covered by maximum two elements
def isa_binary_element(self, element): return len(self.above(element)) <= 2 and len(self.under(element)) <= 2
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_binary(self):\n\n for element in self:\n if element != self.bottom and not self.isa_binary_element(element):\n return False\n return True", "def is_power_of_2(x):\n return x == get_lowest_one_mask(x)", "def majority_logical(*bit_arrays):\n\n if (len(bit_arrays...
[ "0.66362745", "0.61674225", "0.6033844", "0.5968726", "0.5959528", "0.593749", "0.5853412", "0.5815236", "0.5798761", "0.57288164", "0.570948", "0.5697407", "0.56866753", "0.56554615", "0.5654972", "0.5636119", "0.55755115", "0.5565799", "0.5554582", "0.55395794", "0.5535122"...
0.7928481
0
Returns the successor of element different from first_successor in a binary lattice
def other_above(self, element, first_successor): successors = list(self.above(element)) if len(successors) != 2: raise ValueError("element is not binary in lattice") elif successors[0] == first_successor: return successors[1] elif successors[1] == first_successor:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def other_under(self, element, first_predecessor):\n predecessors = list(self.under(element))\n if len(predecessors) != 2:\n raise ValueError(\"element is not binary in lattice\")\n elif predecessors[0] == first_predecessor:\n return predecessors[1]\n elif predeces...
[ "0.6546926", "0.64019597", "0.60879385", "0.6056825", "0.6039657", "0.5892914", "0.5845297", "0.57128656", "0.566253", "0.56558645", "0.56257665", "0.56140566", "0.5604517", "0.56000495", "0.56000495", "0.56000495", "0.56000495", "0.56000495", "0.56000495", "0.56000495", "0.5...
0.67283386
0
Returns the predecessor of element different from first_predecessor in a binary lattice
def other_under(self, element, first_predecessor): predecessors = list(self.under(element)) if len(predecessors) != 2: raise ValueError("element is not binary in lattice") elif predecessors[0] == first_predecessor: return predecessors[1] elif predecessors[1] == fi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def predecessor(self, node):\n if node is None:\n return None\n if node.left_child is not None:\n pred = node.left_child\n while pred.right_child is not None:\n pred = pred.right_child\n return pred\n else:\n p = node.parent\n while p is not None:\n if node is n...
[ "0.6908084", "0.6575059", "0.65220636", "0.64290535", "0.6356892", "0.62963617", "0.62842953", "0.6266937", "0.6206771", "0.61826193", "0.6116143", "0.60884154", "0.60773015", "0.6038158", "0.6006918", "0.598322", "0.5974723", "0.5910431", "0.5852234", "0.5840869", "0.5837235...
0.65804267
1
Tensorflow peak picking via local maxima Returns the indices of the local maxima of the first dimension of the tensor
def find_local_maxima(tens): return tf.squeeze(tf.where(tf.equal(label_local_extrema(tens), 'P')))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def local_max(img, size=(70,100,100)):\n # Apply a maximum filter.\n max_f = ndi.maximum_filter(img, size=size)\n # Find pixels that are local maxima.\n local_max = np.where(max_f == img, 1, 0)\n return(local_max)", "def get_peak_inds(map_):\n return np.unravel_index(np.argmax(map_, axis=None),...
[ "0.6616471", "0.6606883", "0.6585712", "0.65430903", "0.64255357", "0.62576705", "0.6244409", "0.6212893", "0.6207875", "0.61622685", "0.60652435", "0.6040522", "0.6009267", "0.59946674", "0.5976845", "0.59472924", "0.59412134", "0.5932775", "0.5926134", "0.5915045", "0.58859...
0.75924444
0
Tensorflowbased implementation of np.fft.fftfreq
def fft_frequencies(sr=22050, n_fft=2048): # TODO endpoint=True return tf.linspace(0, tf.cast(sr/2., dtype=tf.int32), tf.cast(1. + n_fft // 2., dtype=tf.int32))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_fft_freq(dt, nfft, full):\n freqs = da.fft.fftfreq(nfft, d=dt) \n\n if (nfft % 2 == 0):\n freqs = da.hstack([freqs[0: nfft // 2], -freqs[nfft //2], freqs[nfft // 2:nfft]])\n if full:\n freqs = da.fft.fftshift(freqs)\n else:\n freqs = freqs[0:nfft // 2 + 1]\n\n return(...
[ "0.6975749", "0.69176376", "0.689881", "0.6862554", "0.6815903", "0.67304593", "0.6688847", "0.6614525", "0.65949523", "0.6556522", "0.65385807", "0.6481248", "0.64473915", "0.642961", "0.6424027", "0.64006203", "0.6398523", "0.6341776", "0.633343", "0.633183", "0.63218015", ...
0.733585
0
Tensorflowbased implementation of librosa.core.fourier_tempo_frequencies
def fourier_tempo_frequencies(sr=22050, win_length=384, hop_length=512): return fft_frequencies(sr=sr * 60 / float(hop_length), n_fft=win_length)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fft_frequencies(sr=22050, n_fft=2048):\n # TODO endpoint=True\n return tf.linspace(0, tf.cast(sr/2., dtype=tf.int32), tf.cast(1. + n_fft // 2., dtype=tf.int32))", "def get_frequencies(self):\n num_seconds = float(self.timestamps[-2] - self.timestamps[0]) / float(1000)\n samples_per_second...
[ "0.69349486", "0.6646392", "0.6491517", "0.6421155", "0.64123386", "0.6288628", "0.6275574", "0.6232782", "0.6211876", "0.61571944", "0.6095463", "0.60664654", "0.6022247", "0.6018121", "0.6014456", "0.5987318", "0.59843725", "0.5984003", "0.5983363", "0.5969597", "0.5968721"...
0.6719496
1
Bandpass filters audio to given frequency range
def bandpass_filter_audio(audio, f_low=400, f_high=450): filtered_audio = core.sinc_filter(audio, f_low, window_size=256, high_pass=True) filtered_audio = core.sinc_filter(filtered_audio, f_high, window_size=256, high_pass=False) return tf.squeeze(filtered_audio)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bandpassFilter (self, lowerFreq, upperFreq):\n self.bandpassLimits = (lowerFreq, upperFreq)\n # stuff to do", "def butterworth_bandpass_filter( values, lowFreq, highFreq, sampleFreq, order=5):\n nyq = 0.5 * sampleFreq\n low = lowFreq / nyq\n high = highFreq /nyq\n b,a = butter( orde...
[ "0.73646635", "0.7264086", "0.72377187", "0.7138188", "0.7078694", "0.70686543", "0.70422363", "0.6981005", "0.691496", "0.6907205", "0.69069135", "0.6898185", "0.6839194", "0.6818611", "0.6705521", "0.66445243", "0.6612388", "0.66105556", "0.65803343", "0.6549235", "0.652060...
0.7543435
0
Calculate dominant frequency from tempogram.
def dominant_freq_from_tempogram(tempogram, tempo_frequencies, return_Hz = True): tempo_BPM_max = tempo_frequencies \ * tf.cast(tf.math.abs(tempogram[:, 0]) == tf.math.reduce_max(tf.math.abs(tempogram[:, 0])), t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def DominantFrequency(data):\n w = fft.fft(data)\n freqs = fft.fftfreq(len(data))\n i = argmax(abs(w))\n dom_freq = freqs[i]\n dom_freq_hz = abs(dom_freq * 32.0)\n return dom_freq_hz", "def freq():", "def freq(self) -> int:", "def compute_frequency(record):\n try:\n info = record....
[ "0.7576257", "0.7283553", "0.69760036", "0.6434121", "0.6414743", "0.6393278", "0.6370433", "0.6363414", "0.63366425", "0.6316601", "0.62846553", "0.61912936", "0.61501634", "0.61432326", "0.6078933", "0.6078761", "0.607784", "0.60529363", "0.60146475", "0.5996548", "0.599318...
0.7321282
1
Run PLP encoder over all chunks in a song
def encode_song(y, sr, chunks=8, tempo_min=60, tempo_max=300, f_low=400, f_high=450, loudness_min=0.1, loudness_max=1, filter=False, plot=True, padding_seconds=4, frame_step=0.1): if chunks != 0: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encoding_loop(self, commands):\n try:\n enc_path = self.temp / 'split'\n done_path = self.temp / 'done.json'\n\n if self.resume and done_path.exists():\n log('Resuming...\\n')\n\n with open(done_path) as f:\n data = json.l...
[ "0.5605265", "0.5559755", "0.5549146", "0.55153775", "0.5348678", "0.53030664", "0.5284979", "0.5227434", "0.5210017", "0.5203231", "0.516057", "0.5159312", "0.51228446", "0.5113281", "0.5102108", "0.5093781", "0.50582504", "0.50577176", "0.50477487", "0.5035931", "0.50243163...
0.59695196
0
Plots tempogram and local pulse.
def plot_tempogram_and_pulse(tempogram, pulse, oenv, sr_, hop_length, plot_pulse=True): tempogram = tempogram.numpy() librosa.display.specshow(np.abs(tempogram), sr=sr_, hop_length=hop_length, x_axis='time', y_axis='fourier_tempo', cmap='magma') plt.show() peaks = find_local...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_plot(self):\r\n\t\tx, y = zip(*[p.p for p in self.universe])\r\n\t\tself.ax.cla()\r\n\t\tself.ax.plot(x, y, '.')\r\n\t\tself.ax.set_title('Universe at time: %d' % self.universe.time)\r\n\t\tself.ax.set_xlim([P_MU-4*P_STD, P_MU+4*P_STD])\r\n\t\tself.ax.set_ylim([P_MU-4*P_STD, P_MU+4*P_STD])", "def pl...
[ "0.6167347", "0.6045964", "0.6005844", "0.60007274", "0.5986079", "0.5946726", "0.5940409", "0.59366363", "0.5927733", "0.59202886", "0.5919486", "0.59166664", "0.589321", "0.5878967", "0.5878385", "0.58383024", "0.5815395", "0.58096075", "0.5796197", "0.5794684", "0.5793674"...
0.7408538
0
find the octant of the point p
def octant(p): x = p[0] y = p[1] z = p[2] if z > 0: if y > 0: if x > 0: return 1 else: return 2 else: if x > 0: return 4 else: return 3 else: if y > 0: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pentagonal_index(P):\n return (1 + sqrt(1 + 24 * P)) / 6", "def pentagonal(n):\n return (n * ((3 * n) - 1)) / 2", "def octagonal(n: int) -> int:\n return int(n * (3 * n - 2))", "def pentagon(n) -> int:\n\n return (n * (3 * n - 1)) // 2", "def pentagonal(n: int) -> int:\n return int(n * (...
[ "0.6850405", "0.6668282", "0.66609925", "0.66571915", "0.6533113", "0.6394671", "0.6280675", "0.606131", "0.6050526", "0.6026284", "0.5963669", "0.59469676", "0.5932404", "0.5902425", "0.58995277", "0.5889232", "0.58607674", "0.5808065", "0.5808065", "0.578582", "0.57765496",...
0.81374913
0
Check if an axis from beta1 to beta2 is nearly perpendicular with a maximal distance to an axis from alpha1 to alpha2 and if their distance is under maxDist
def isSecondOblateAxis(alpha1, alpha2, beta1, beta2, maxDist, maxTorsAngle): a1 = np.asarray(alpha1) a2 = np.asarray(alpha2) b1 = np.asarray(beta1) b2 = np.asarray(beta2) #lent = alpha1 - beta1 adir = a2 - a1 bdir = b2 - b1 aLength = np.sqrt ( np.dot(adir, adir) ) bLength = np...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_optimality(self):\n\n dual_obj = -0.5* np.dot(self.beta, self.beta) + np.sum(self.alpha)\n\n prim_obj = 0.5* np.dot(self.beta, self.beta) + self.C * np.sum( np.maximum(1 - np.multiply(np.dot(self.X, self.beta), self.y), 0))\n\n # print (prim_obj - dual_obj)\n self.gap = prim_...
[ "0.6011611", "0.59310466", "0.58656365", "0.56454873", "0.5604216", "0.5604216", "0.5479761", "0.54793507", "0.5468954", "0.5461638", "0.54490155", "0.54316163", "0.5398481", "0.5396198", "0.53858936", "0.5370805", "0.5352234", "0.5349109", "0.53405297", "0.5321658", "0.53058...
0.70764565
0
checks if a sample point (sx,sy,sz) is inside the prolate shape with semi=axes alpha > beta. The translation vector and rotation matrix have to describe the transformation for aligning the alphaaxis with the x of the coordinate system and in setting the center to the origin. The fundamental ellipsoidal equation is appl...
def isInProlate(sample, alpha, beta): E = sample[0] * sample[0] / (alpha * alpha) E += (sample[1] * sample[1] + sample[2] * sample[2] ) / (beta * beta) if E > 1.0: return False else: return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def in_ellipse(x,y,a,b):\n return ellipse(x,y,a,b) <= 1", "def isInside(self, point):\n # we rotate back the point to the frame parallel to the axis of the ellipse\n rotatedPoint = self.rotatePoint(point)\n # we check if each point is inside the associated liquid drop\n return ((ro...
[ "0.6214587", "0.6080027", "0.59774446", "0.5851352", "0.57803434", "0.5715725", "0.56959075", "0.5690712", "0.56784356", "0.56699437", "0.5643856", "0.5614901", "0.5609464", "0.5566931", "0.5535911", "0.5525101", "0.55000794", "0.5498535", "0.5493109", "0.547834", "0.54584306...
0.6873963
0
The harvesting event occurs when the voltage U has an extremum. This is equivalent with I_Cp = Iq = 0. To distinguish the positive and negative zero crossing, the event function becomes Iq sign(U) <= 0.
def ev_harvest(t, x, y): Iq, UC, U = x return Iq * sign(U)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def elu(x):\n return np.where(x < 0, np.exp(x) - 1, x)", "def signal_hammer(icu, icu_slope, hammer_icu, hammer_slope):\n\n return (icu > hammer_icu and icu_slope > 0) or (icu_slope > hammer_slope)", "def test_interferometer(self, tol):\n # fmt:off\n U = np.array([[0.83645892-0.40533293j, -0...
[ "0.5832589", "0.5714973", "0.5664049", "0.56627977", "0.56614596", "0.5622842", "0.5586296", "0.55655104", "0.5534538", "0.55224675", "0.5492418", "0.5483554", "0.547994", "0.5463935", "0.54606885", "0.5450898", "0.54117996", "0.53925806", "0.5379839", "0.5368728", "0.5368728...
0.6363804
0
The SECE principle could modeled with only one FSM state CHARGE. After every extremum of the output voltage U is reseted to zero. Also the current Iq is set to zero avoiding numerical problems. Additional the time discrete state vector saves the energy E transfered through the output and every extremum of the voltage U...
def CHARGE(t, x, y): Iq, UC, U = x E, Umax = y # time discrete state vector E_new = E + Cp/2 * U**2 return array([0.0, UC, 0.0]), array([E_new, U])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sweep():\n \n set_enable_load(True) # turn input ON\n time.sleep(.250)\n \n print('Begin IV curve measurement')\n \n voc = open_circ() # measure open circuit voltage\n iv_curve(voc) # measure iv curve\n short_circ() # measure short circuit current\n \n time.sleep(.250)\n set...
[ "0.58612555", "0.5846139", "0.5843146", "0.5814054", "0.5794621", "0.57264256", "0.5697631", "0.563857", "0.5614976", "0.56104195", "0.5602246", "0.55924416", "0.55586153", "0.5540207", "0.5527369", "0.55189097", "0.5507827", "0.55074686", "0.5505165", "0.5498555", "0.54622",...
0.62694937
0
Extracts the csrf token from a url
def extract_csrf(self, url): with requests.Session() as client: client.get(url) csrf = client.cookies['csrftoken'] return csrf
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_initial_token(url):\n cj = CookieJar()\n opener = build_opener(HTTPCookieProcessor(cj))\n install_opener(opener)\n opener.open(url)\n\n for cookie in cj:\n if cookie.name == 'csrftoken':\n return cookie.value\n\n return ''", "def get_csrf_token(url,cookie):\r\n\r\n ...
[ "0.73404205", "0.69607997", "0.6890592", "0.6776865", "0.6656046", "0.6628088", "0.65032995", "0.6463559", "0.6401501", "0.63869375", "0.6296214", "0.6274736", "0.6208114", "0.62058866", "0.613803", "0.61265904", "0.6116208", "0.6084349", "0.6079563", "0.60091925", "0.5976771...
0.7907463
0
Adds a new weight; params needed for post request's payload
def add_weight(self): # Get the csrf token csrf = self.extract_csrf('https://wger.de/en/weight/add/') # Adding referer to the headers self.headers['Referer'] = API.url_weight # Take the weight entires from TOML file entries = self.cfg.get('payload', {}).get('we...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_weight():\n\twts = request.json['featureWeights']\n\n\t# Intialize new model with the latest weights\n\tglobal model\n\tmodel = tscore.ScoreModel(wts)\n\treturn jsonify( { 'updated': \"True\", 'featureWeights': wts } ), 201", "def my_assign_weights(context, data):\n pass", "def set_weight(self, w...
[ "0.70913374", "0.6750403", "0.6731251", "0.67190844", "0.67190844", "0.67190844", "0.6427595", "0.62867343", "0.6260229", "0.6235389", "0.6201869", "0.61902094", "0.61885905", "0.6185385", "0.61091244", "0.6068805", "0.6056508", "0.6048858", "0.60299945", "0.6019781", "0.6000...
0.8363505
0
Adds a new nutrition plan and stores information about it in the class dictionary Params needed for post request's payload
def add_plan(self): # Take the weight entries from TOML file plans = self.cfg.get('payload', {}).get('plan') # Check for valid entries if plans : # Construct payload for payload in plans: # Parse the payload ready = self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create(cls, **kwargs):\n return cls().requests.post('plan', data=kwargs)", "def post(self):\n return CreateSavingPlan(request, current_user.id)", "def new_flight_plan(self):\n r = requests.post(self.base_url + f'/users/{self.username}/flight-plans')\n return r.text", "def add_...
[ "0.7086115", "0.6310721", "0.61961544", "0.6100489", "0.6030358", "0.6028867", "0.5888967", "0.5846056", "0.5657358", "0.561522", "0.56080353", "0.5604049", "0.5563316", "0.5547414", "0.55382395", "0.5532841", "0.55313814", "0.5527719", "0.5475129", "0.5444152", "0.5414031", ...
0.7057411
1
Adds a new meal to a nutrition plan and stores information about it in the class dictionary Params needed for post request's payload
def add_meal(self, p_id): # Take the plans entires from TOML file plans = self.cfg.get('payload',{}).get('plan') # For each meal in each plan for entries in plans: # Check for valid entires if entries: for payload in entries.get('m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_item(self, m_id):\r\n \r\n # Take the meals entires from TOML file\r\n meals = self.cfg.get('payload',{}).get('plan',{})[0].get('meal',{})\r\n for entries in meals:\r\n # Check for valid entires\r\n if entries:\r\n # Construct payload \r\n ...
[ "0.69292074", "0.6641523", "0.6351043", "0.63263077", "0.61973137", "0.6144904", "0.613827", "0.6112059", "0.5795221", "0.578838", "0.5749714", "0.56976366", "0.56927705", "0.565634", "0.56037104", "0.55582607", "0.55232936", "0.5504037", "0.5457082", "0.5444953", "0.5418034"...
0.72102773
0
Adds a new item to a meal and stores information about it in the class dictionary Params needed for post request's payload
def add_item(self, m_id): # Take the meals entires from TOML file meals = self.cfg.get('payload',{}).get('plan',{})[0].get('meal',{}) for entries in meals: # Check for valid entires if entries: # Construct payload for payl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_items_handler():\n rq = request.get_json()\n name = rq['name']\n picture = rq['picture']\n description = rq['description']\n category_id = rq['category_id']\n item = addItem(name, picture, description, category_id, g.user.id)\n return jsonify(item=item.serialize)", "def add_item():\n...
[ "0.7085926", "0.69619817", "0.68986714", "0.67922443", "0.67652833", "0.66561204", "0.66533005", "0.6582756", "0.65212536", "0.6510233", "0.64977646", "0.6480944", "0.64776444", "0.6473709", "0.64668727", "0.64668727", "0.64668727", "0.6349618", "0.6285246", "0.6214289", "0.6...
0.7788327
0
Adds a new exercise and stores information about it in the class dictionary Params needed for post request's payload
def add_exercise(self): # Take the exercise entires from TOML file entries = self.cfg.get("payload",{}).get("exercise") # Check for valid entires if entries: # Construct payload for payload in entries: # Check the entry vs a json schema ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_exercise():\n json_data = request.get_json()\n new_question = json_data.get(\"new_question\")\n new_answer = json_data.get(\"new_answer\")\n user_id = session.get(\"email\")\n try:\n fm.add_exercise(new_question, new_answer, user_id)\n msg = \"Exercise added for user: {}\".form...
[ "0.78411895", "0.7553409", "0.7353586", "0.6304569", "0.6214312", "0.61633617", "0.6020029", "0.5988647", "0.5927404", "0.58324516", "0.581646", "0.57472754", "0.5722411", "0.57162255", "0.56089395", "0.55933064", "0.55925333", "0.5591956", "0.5584668", "0.55407256", "0.55314...
0.84900373
0
Adds a new workout and stores information about it in the class dictionary Params needed for post request's payload
def add_workout(self): # Take the workout entires from TOML file workouts = self.cfg.get('payload',{}).get('workout') # Check for valid entires if workouts : # Construct payload for payload in workouts: # Parse the workout payload ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_add_workout(self):\n body = Workout()\n response = self.client.open(\n '/workout',\n method='POST',\n data=json.dumps(body),\n content_type='application/json')\n self.assert200(response,\n 'Response body is : ' + respon...
[ "0.72422904", "0.6504186", "0.64762545", "0.62977403", "0.5962294", "0.5751026", "0.57090676", "0.55889237", "0.5556088", "0.5445592", "0.5418208", "0.5339491", "0.531289", "0.5290283", "0.52862394", "0.5234424", "0.523056", "0.5227997", "0.52270323", "0.5209627", "0.51640904...
0.74642444
0
Adds a new day to a workout and stores information about it in the class dictionary Params needed for post request's payload
def add_day(self, w_id): # Take the weight entries from TOML file workouts = self.cfg.get('payload',{}).get('workout') # Check for valid entries if workouts: for entries in workouts: if entries: # Construct payload ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_workout(self):\r\n # Take the workout entires from TOML file\r\n workouts = self.cfg.get('payload',{}).get('workout')\r\n # Check for valid entires\r\n if workouts :\r\n # Construct payload \r\n for payload in workouts:\r\n # Parse the workou...
[ "0.68411314", "0.6214305", "0.6009533", "0.5855128", "0.5778126", "0.5644487", "0.5631726", "0.5598066", "0.55861247", "0.55030936", "0.5460911", "0.5424971", "0.541958", "0.54160273", "0.5392873", "0.5369233", "0.5363748", "0.5343311", "0.5311711", "0.530917", "0.5297215", ...
0.7105944
0
Adds a new schedule and stores information about it in the class dictionary Params needed for post request's payload
def add_schedule(self): # Take the schedule entires from TOML file entries = self.cfg.get('payload',{}).get('schedule') # Check for valid entires if entries: # Construct payload for payload in entries: # Parse schedule payload ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_add_schedule(self):\n body = Schedule()\n response = self.client.open('/v1/schedule',\n method='POST',\n data=json.dumps(body),\n content_type='application/json')\n self.assert200(...
[ "0.7588622", "0.72927296", "0.6554353", "0.6533283", "0.64751756", "0.6465415", "0.64390296", "0.63615066", "0.6257769", "0.61862046", "0.61686426", "0.6160965", "0.6158384", "0.61472726", "0.613723", "0.611298", "0.6108676", "0.604877", "0.59989715", "0.59989715", "0.5993948...
0.7421662
1
Download the image of a exercice by index
def get_image(self, index): # Get request to get all the links for all exercises image = requests.get(API.url_image, headers = self.headers).json() filename = download(image[index]['image'])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_img_from_url(index, url):\n try:\n with urllib.request.urlopen(url) as response:\n if response.headers.get_content_maintype() == 'image':\n image_filename = image_filename_prefix.format(name=image_class_name,\n ...
[ "0.646242", "0.62567097", "0.62492424", "0.62149733", "0.618829", "0.6157407", "0.6142673", "0.61364245", "0.61317563", "0.6123799", "0.60892314", "0.6060126", "0.5978582", "0.59611326", "0.59461564", "0.5933663", "0.5931147", "0.5914811", "0.5893483", "0.588527", "0.5846178"...
0.84663945
0
Gets the comment from a exercice by index
def get_comment(self, index): # Get request to get all the comments for all exercises comments = requests.get(API.url_comment, headers = self.headers).json() # Parse the response for my_comment in comments: if my_comment['id'] == index: print(my_commen...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getComment(self, ind):\r\n if ind >= 0 and ind < len(self.comments):\r\n return self.comments[ind]\r\n return None", "def getComment(self, n = None):\n \n if n is None:\n return self._comments\n else:\n return self._comments[n]", "def get_...
[ "0.72585046", "0.6156863", "0.60285085", "0.6012852", "0.5878884", "0.5870563", "0.58260715", "0.5798382", "0.5696689", "0.5656557", "0.56371516", "0.5632999", "0.5582955", "0.5553322", "0.54806364", "0.54631793", "0.54591316", "0.540845", "0.54078734", "0.5400077", "0.534076...
0.8401464
0
Checks if a delete was succesfull
def check_delete(self, url, info, index): exists = requests.get(url, headers=self.headers) requests.delete(url + str(index), headers = self.headers) exists2 = requests.get(url, headers=self.headers) if exists.ok == exists2.ok == True and exists.json()['results'] == exists2.json()['...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_success(self, id_):\n rv = self.post((id_, self.delete_url), dict(post='yes'))\n assert not self.verify_object({self.id_field: id_})\n return rv", "def delete(self) -> bool:\n return False", "def do_delete(self, arg):\n \treturn False", "def check_deletion():\n\n ...
[ "0.7594761", "0.72328854", "0.7226481", "0.71072614", "0.70056593", "0.6999749", "0.69725275", "0.69210666", "0.6857827", "0.68532443", "0.6804796", "0.67526543", "0.6752633", "0.6748591", "0.67414945", "0.6728462", "0.6620742", "0.659836", "0.6586197", "0.6577026", "0.656985...
0.7322521
1
Define the processing of each new directory added [in] dirpath The directory just added by the user Improve this ugly inteface...
def _processNewDirectory(self, dirpath): self._parent.processDirectory(dirpath)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_directory(current_path, parent_dir, path_list):\n try:\n for item in scandir(current_path):\n path_list.append(join(current_path, item.name))\n except PermissionError:\n pass", "def parse_dir(self, directory):\n for dir in os.listdir(directory):\n if dir i...
[ "0.70050806", "0.6855994", "0.6640226", "0.6566045", "0.65539616", "0.6538955", "0.6464651", "0.6424907", "0.64209896", "0.6417724", "0.6414585", "0.64013577", "0.634992", "0.63381624", "0.63350016", "0.6300745", "0.6300745", "0.62926817", "0.6290385", "0.62734854", "0.625532...
0.7614743
0
Parse the given line in order to return an array of n_classes probabilities
def _parse_preds_line(self, preds_line): # The output for AWS XGBoost for multiclass is [proba_c1, probac2, probac3,...] for each sample, neither csv, nor python... # return list(map(float, preds_line[1:-2].split(','))) return eval(preds_line)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_predictions(filepath):\n\twith open(filepath, 'r') as fh:\n\t\tcells = [line.split(',') for line in fh.read().splitlines()]\n\tdata = empty((TESTSIZE, NCLASSES), dtype = float64)\n\tfor k, row in enumerate(cells[1:]):\n\t\tdata[k, :] = row[1:]\n\treturn data", "def classesAndFrames(self):\n class...
[ "0.5941844", "0.59043354", "0.5703307", "0.5698324", "0.5682355", "0.56445974", "0.5567654", "0.5566163", "0.5558649", "0.5481291", "0.5458445", "0.54475963", "0.54351074", "0.541697", "0.54056454", "0.5386606", "0.5369917", "0.5330952", "0.5315417", "0.5310961", "0.5310177",...
0.64363974
0
Generate the local and S3 libsvm files used for the training
def _prepare_libsvm_data(self): logging.info('Preparing libsvm training data...') if self.clean or not (self.is_s3_file(self.s3_training_file) and self.is_s3_file(self.s3_validation_file)): logging.info('S3 libsvm files do not exist.') if self.clean or not (os.path.isfile(self.lo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _init_s3_train_files(self):\n # XGBoost requires libsvm training and validation files when invoking fit()\n self._prepare_libsvm_data()\n\n if self.n_classes <= 2:\n self.hyperparameters['eval_metric'] = 'auc'\n self.hyperparameters['objective'] = 'binary:logistic'\n ...
[ "0.7015092", "0.6091238", "0.5931611", "0.5814341", "0.58115715", "0.57931757", "0.5764446", "0.5748602", "0.5714243", "0.5709069", "0.57070225", "0.5673651", "0.5672113", "0.56681716", "0.5613454", "0.5541235", "0.5527485", "0.5524118", "0.55085415", "0.55060285", "0.5504347...
0.7519468
0
Search the nodes with the lowest f scores first. You specify the function f(node) that you want to minimize; for example, if f is a heuristic estimate to the goal, then we have greedy best first search; if f is node.depth then we have depthfirst search.
def best_first_graph_search(problem, f): f = memoize(f, 'f') return graph_search(problem, PriorityQueue(min, f))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def best_first_graph_search(self, problem, f):\n f = memoize(f, 'f')\n # Set starting node\n node = SearchNode(problem.initial)\n # If the goal is reached, return the resulting node\n if problem.goal_test(node.state):\n return node\n\n # Set priority queue to or...
[ "0.8007521", "0.74137783", "0.71993816", "0.6964788", "0.65959895", "0.6396831", "0.6337583", "0.6335017", "0.629833", "0.629833", "0.62494665", "0.6157962", "0.6094576", "0.6086956", "0.60373163", "0.60041636", "0.5996339", "0.5954216", "0.594967", "0.594148", "0.5939211", ...
0.805306
0
A search is bestfirst graph search with f(n) = g(n)+h(n). You need to specify the h function when you call astar_search.
def astar_search(problem, h=None): h = h or problem.h h = memoize(h, 'h') def f(n): return max(getattr(n, 'f', -infinity), n.path_cost + h(n)) return best_first_graph_search(problem, f)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def astar_search(problem, h=None, display=False):\n\n\th = memoize(h or problem.h, 'h')\n\treturn best_first_graph_search(problem, lambda n: n.path_cost + h(n), display)", "def aStarSearch(problem, heuristic=nullHeuristic):\n \"*** YOUR CODE HERE ***\"\n fringe = util.PriorityQueueWithFunction(lambda node:...
[ "0.7837965", "0.72131985", "0.7186974", "0.7146829", "0.7014595", "0.7014595", "0.68833905", "0.6877281", "0.6810793", "0.67949086", "0.67546475", "0.67528677", "0.67514026", "0.67317224", "0.67040306", "0.66801614", "0.66776395", "0.660388", "0.65700275", "0.64990413", "0.64...
0.8199077
0
This helper function validates inputs to check that they are either scalars or arrays and then that any arrays of the same shape. It either raises an error or returns the common shape or 1 if all arguments are scalar.
def check_input_shapes(*args): # Collect the shapes of the inputs shapes = set() # DESIGN NOTES - currently allow: # - scalars, # - 0 dim ndarrays (also scalars but packaged differently) # - 1 dim ndarrays with only a single value for val in args: if isinstance(val, np.ndarr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def common_shape(arrays):\n arrays = iter(arrays)\n shape = next(arrays).shape\n for array in arrays:\n shape = tuple(a if a == b else None\n for a, b in zip(shape, array.shape))\n return shape", "def _get_consistent_shape(images: Iterable):\n dim0s = []\n dim1s = []...
[ "0.6624878", "0.65816003", "0.6564006", "0.64985836", "0.63906205", "0.63877285", "0.63808954", "0.63576496", "0.6357112", "0.6344511", "0.6341772", "0.62508506", "0.62365884", "0.62330407", "0.61754423", "0.61516166", "0.61161005", "0.6115013", "0.60989213", "0.60769963", "0...
0.82600343
0
Helper function to create a simple table of attribute mean, min, max and nan count from an object for use in summarize function.
def summarize_attrs(obj, attrs, dp=2, repr_head=True): ret = [] for attr in attrs: data = getattr(obj, attr) ret.append([attr, np.round(np.nanmean(data), dp), np.round(np.nanmin(data), dp), np.round(np.nanmax(data), dp), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def summary(df):\n summary_list = []\n print 'SHAPE', df.shape\n \n for i in df.columns:\n vals = df[i] \n if df[i].dtype == 'O':\n try:\n most_frequent = Counter(df[i].tolist()).most_common(1)\n uniq = vals.nunique()\n except TypeErr...
[ "0.6258448", "0.6139533", "0.6088402", "0.5927841", "0.5914616", "0.5914616", "0.58495516", "0.5825066", "0.5823076", "0.58073944", "0.58008504", "0.5683719", "0.5677983", "0.5675944", "0.56542504", "0.56505287", "0.5644049", "0.5593806", "0.5590825", "0.5570467", "0.5566631"...
0.7691301
0
tests passing 1D data into sigma_points
def test_julier_sigma_points_1D(): kappa = 0. sp = JulierSigmaPoints(1, kappa) #ukf = UKF(dim_x=1, dim_z=1, dt=0.1, hx=None, fx=None, kappa=kappa) Wm, Wc = sp.weights() assert np.allclose(Wm, Wc, 1e-12) assert len(Wm) == 3 mean = 5 cov = 9 Xi = sp.sigma_points(mean, cov) xm,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_simplex_sigma_points_1D():\n\n sp = SimplexSigmaPoints(1)\n\n #ukf = UKF(dim_x=1, dim_z=1, dt=0.1, hx=None, fx=None, kappa=kappa)\n\n Wm, Wc = sp.weights()\n assert np.allclose(Wm, Wc, 1e-12)\n assert len(Wm) == 2\n\n mean = 5\n cov = 9\n\n Xi = sp.sigma_points(mean, cov)\n xm, ...
[ "0.7060399", "0.6355961", "0.6252628", "0.61673874", "0.6088816", "0.60293305", "0.601793", "0.60165256", "0.5899794", "0.5886947", "0.58542943", "0.5822399", "0.5793257", "0.57819784", "0.5781244", "0.57780117", "0.57685053", "0.5725073", "0.571579", "0.570493", "0.56952965"...
0.68443924
1
tests passing 1D data into sigma_points
def test_simplex_sigma_points_1D(): sp = SimplexSigmaPoints(1) #ukf = UKF(dim_x=1, dim_z=1, dt=0.1, hx=None, fx=None, kappa=kappa) Wm, Wc = sp.weights() assert np.allclose(Wm, Wc, 1e-12) assert len(Wm) == 2 mean = 5 cov = 9 Xi = sp.sigma_points(mean, cov) xm, ucov = unscented_tr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_julier_sigma_points_1D():\n\n kappa = 0.\n sp = JulierSigmaPoints(1, kappa)\n\n #ukf = UKF(dim_x=1, dim_z=1, dt=0.1, hx=None, fx=None, kappa=kappa)\n\n Wm, Wc = sp.weights()\n assert np.allclose(Wm, Wc, 1e-12)\n assert len(Wm) == 3\n\n mean = 5\n cov = 9\n\n Xi = sp.sigma_points...
[ "0.68443924", "0.6355961", "0.6252628", "0.61673874", "0.6088816", "0.60293305", "0.601793", "0.60165256", "0.5899794", "0.5886947", "0.58542943", "0.5822399", "0.5793257", "0.57819784", "0.5781244", "0.57780117", "0.57685053", "0.5725073", "0.571579", "0.570493", "0.56952965...
0.7060399
0
should work like a linear KF if problem is linear
def test_linear_1d(): def fx(x, dt): F = np.array([[1., dt], [0, 1]], dtype=float) return np.dot(F, x) def hx(x): return np.array([x[0]]) dt = 0.1 points = MerweScaledSigmaPoints(2, .1, 2., -1) kf = UKF(dim_x=2, dim_z=1, dt=dt, fx=fx, hx=hx, point...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def f(y):\n \n\n k = 1.0\n return y*(1-y)", "def test_linear_2d_simplex():\n\n\n def fx(x, dt):\n F = np.array([[1, dt, 0, 0],\n [0, 1, 0, 0],\n [0, 0, 1, dt],\n [0, 0, 0, 1]], dtype=float)\n\n return np.dot(F, x)\n\n ...
[ "0.6229389", "0.6101894", "0.6101571", "0.6099031", "0.6074229", "0.6072425", "0.59670156", "0.59268576", "0.5925382", "0.5912769", "0.5893324", "0.58837515", "0.588084", "0.5869752", "0.5866996", "0.58545065", "0.5852562", "0.5850432", "0.58104014", "0.58003116", "0.57745236...
0.68978345
0
batch filter should accept missing data with None in the measurements
def test_batch_missing_data(): def fx(x, dt): F = np.array([[1, dt, 0, 0], [0, 1, 0, 0], [0, 0, 1, dt], [0, 0, 0, 1]], dtype=float) return np.dot(F, x) def hx(x): return np.array([x[0], x[2]]) dt = 0.1 poi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter(self):\n self.data = self.data.loc[~self.data.isnull().any(1),:]", "def exclude_empty_feats(self):\n for dataset in self:\n dataset.dropna(axis=1, how=\"all\", inplace=True)", "def test_filter_function_none(self):\n self.es.register_filter(lambda x: False, ftype='none...
[ "0.67278403", "0.6175362", "0.6124427", "0.6085084", "0.60801446", "0.60551065", "0.60479623", "0.5973895", "0.5940673", "0.5825715", "0.58188224", "0.5808652", "0.58032894", "0.5801553", "0.5752523", "0.5751148", "0.57105243", "0.5690395", "0.5634014", "0.56285006", "0.56263...
0.6651685
1
plot overscan in 9x2 plots with 16 channels
def plot_overscan(overscan, img, TITLE, OUT_DIR): fig = plt.figure(figsize=(20, 20)) gs0 = gridspec.GridSpec(3, 3) for i, f in enumerate(img): x = f.dev_index % 3 gs = gridspec.GridSpecFromSubplotSpec( 1, 2, wspace=0, subplot_spec=gs0[f.dev_index]) ax2 = plt.subplot(gs[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_sample(x):\n plt.imshow(x[:,:,0])\n plt.title(\"gasf\")\n plt.colorbar()\n plt.show()\n\n plt.imshow(x[:,:,1])\n plt.title(\"gadf\")\n plt.colorbar()\n plt.show()\n\n plt.imshow(x[:,:,2])\n plt.title(\"mtf\")\n plt.colorbar()\n plt.show()", "def plot_channels(self, da...
[ "0.62094134", "0.6168367", "0.6072057", "0.60688096", "0.6013233", "0.5994714", "0.59258676", "0.59078777", "0.58876216", "0.5884491", "0.5867321", "0.5860733", "0.5855114", "0.5851817", "0.5822021", "0.5821232", "0.582071", "0.580893", "0.58087957", "0.57978433", "0.57874113...
0.6649696
0
plot overscan with subtracted 7th / 17th channel
def plot_overscan_diff(overscan, img, TITLE, OUT_DIR): fig = plt.figure(figsize=(20, 20)) gs0 = gridspec.GridSpec(3, 3) for i, f in enumerate(img): x = f.dev_index % 3 gs = gridspec.GridSpecFromSubplotSpec( 1, 2, wspace=0, subplot_spec=gs0[f.dev_index]) ax2 = plt.subplo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def overviewCommand(self):\n plt.figure(11)\n plt.clf()\n ax = plt.subplot(211)\n plt.plot(self.raw['OPDC'].data.field('TIME'),\n 1e6*self.raw['OPDC'].data.field('FUOFFSET'),\n color='r', label='FUOFFSET',\n linewidth=1, alpha=1) ...
[ "0.59074193", "0.5813279", "0.57293385", "0.5697952", "0.5669091", "0.56296587", "0.5561183", "0.5508389", "0.5485753", "0.5481958", "0.5460965", "0.5353382", "0.5347737", "0.53302866", "0.53153086", "0.5289892", "0.5282458", "0.52795255", "0.52742654", "0.5266973", "0.526658...
0.6187088
0
plot gains with respect to the reference gain, whre reference gain is number => gains[gain_ref]
def plot_gains(gains, gain_ref, TITLES, OUT_DIR): # print 'directory: %s' % OUT_DIR # print 'TITLES:%s', TITLES gain_ref_np = np.array(gains[gain_ref].gain) ratios = [] for gain in gains: gain_np = np.array(gain.gain) dim = (min(gain_ref_np.shape[0], gain_np.shape[0]), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def graphe_gains(res_alea, res_glou, res_glou_e, res_ucb):\n T = np.arange(res_alea.size)\n fig, ax = plt.subplots()\n ax.grid(True)\n plt.xlabel(\"T\")\n plt.ylabel(\"Gain\")\n \n ax.plot(T, res_alea, label = 'aléatoire') \n ax.plot(T, res_glou, label = 'glouton')\n ax.plot(T, res_glou_e...
[ "0.63260645", "0.60909754", "0.59331757", "0.58492154", "0.5663414", "0.557176", "0.5538274", "0.54979277", "0.5453396", "0.54062104", "0.53628033", "0.5208242", "0.51532966", "0.515238", "0.5149669", "0.5138719", "0.5089669", "0.50747716", "0.5045793", "0.50385696", "0.50305...
0.68738127
0
Get an API event instance
def get_api_event(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def retrieve(cls, event_id):\n return Event(Requester.get(cls.endpoint + '/' + event_id))", "def apigw_event():\n with open(\"events/event.json\") as json_file:\n return json.load(json_file)", "def get_event(self):\r\n return self.events[0]", "def event_object(self):\n ...
[ "0.7332259", "0.6719658", "0.66772777", "0.6642309", "0.6639862", "0.656849", "0.64558864", "0.6429285", "0.63894624", "0.637635", "0.63647616", "0.6342903", "0.6329512", "0.6308655", "0.6297398", "0.6271047", "0.6254106", "0.6243177", "0.62060595", "0.6162659", "0.6148124", ...
0.80483943
0
Returns the next count number for the given metric/variant (rotates every few calls)
def _get_metric_count(cls, metric, variant, next=True): counters = cls._metric_counters key = '%s_%s' % (metric, variant) try: cls._metric_counters_lock.acquire() value = counters.get(key, -1) if next: value = counters[key] = value + 1 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next(self):\n self.lock.acquire()\n self.count += self.step;\n result = self.count\n self.lock.release()\n return result", "def next_num(cls):\r\n cls.num += 1\r\n return cls.num", "def get_next(current):\n return 0.5 * (current + n / current)", "def ne...
[ "0.63280904", "0.6065394", "0.59277976", "0.5897081", "0.5783465", "0.57659507", "0.57659507", "0.5717719", "0.5647151", "0.5628614", "0.55990857", "0.55796415", "0.5523331", "0.5496951", "0.5465766", "0.54415905", "0.5427532", "0.54228556", "0.54203236", "0.54203236", "0.540...
0.7852118
0
proc_df takes a data frame df and splits off the response variable, and changes the df into an entirely numeric dataframe. For each column of df which is not in skip_flds nor in ignore_flds, na values are replaced by the median value of the column.
def proc_df(df, y_fld=None, skip_flds=None, ignore_flds=None, do_scale=False, na_dict=None, preproc_fn=None, max_n_cat=None, subset=None, mapper=None): if not ignore_flds: ignore_flds=[] if not skip_flds: skip_flds=[] if subset: df = get_sample(df,subset) else: df = df.copy() ignored_fld...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def proc_df(df, y_fld=None, skip_flds=None, ignore_flds=None, do_scale=False, na_dict=None,\n preproc_fn=None, max_n_cat=None, subset=None, mapper=None):\n if not ignore_flds: ignore_flds=[]\n if not skip_flds: skip_flds=[]\n if subset: df = get_sample(df,subset)\n else: df = df.copy()\n ...
[ "0.66418713", "0.6127512", "0.58669835", "0.5857657", "0.5837059", "0.5729272", "0.5686927", "0.5652169", "0.56378347", "0.5603194", "0.55321705", "0.5485073", "0.5433233", "0.5423102", "0.5404316", "0.5354289", "0.5354275", "0.53387", "0.53330916", "0.5324305", "0.5293128", ...
0.6647287
0
Sort standings_rows according to the subclass rank method.
def sort_standings_rows(self, standings_rows, heat_games, players, rank_finals=False): non_finals_sort_key_fn = self.get_standings_row_sort_key_fn() self.calculate_secondary_rank_values(standings_rows, heat_games, players) standings_rows.sort(key=non_finals_sort_key_fn, reverse=True) if...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _sort(self):\n self.rows.sort(key=lambda x: (x['PERC1'], x['EQ'], x['PASS'], x['W2']),\n reverse=True)\n\n rank = 0\n prev_perc = 0\n prev_rank = 0\n for row in self.rows:\n if row[\"NR\"] == 0:\n # Something has already populat...
[ "0.6434854", "0.62527853", "0.6219509", "0.6213747", "0.6067628", "0.59437746", "0.5909843", "0.5891942", "0.5752573", "0.5714053", "0.5691639", "0.56828415", "0.5677474", "0.56695354", "0.5645508", "0.5575053", "0.5563753", "0.55051386", "0.5498401", "0.5484112", "0.54697895...
0.7152437
0
One waypoint must exist on database
def test_create(self): self.assertTrue(WayPoint.objects.exists())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_waypoint(self, waypoint):\n connection = self.__create_connection()\n try:\n waypoint_list = list(waypoint)\n key = self.__compound_key(waypoint)\n waypoint_list.insert(0, key)\n\n keyed_waypoint = tuple(waypoint_list)\n\n sql = ''' IN...
[ "0.6968115", "0.62368494", "0.5923784", "0.5820203", "0.5715904", "0.5578013", "0.54665357", "0.5460138", "0.5361839", "0.5331722", "0.53265536", "0.53263104", "0.52776194", "0.5273881", "0.5273881", "0.5269537", "0.52435905", "0.52151394", "0.51992184", "0.51812834", "0.5144...
0.68909466
1
Returns True if max episode steps have been reached.
def is_terminal(self) -> bool: return self.time_index == self.max_episode_steps - 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_episode_end_condition(self):\n vehicles = self._get_available_vehicles()\n if np.sum(vehicles == 0) < self.episode_threshold:\n return True\n else:\n return False", "def _exceeded_maximum_iteration(self) -> bool:\n if self.iteration >= self._maxiter:\n...
[ "0.71122867", "0.6849744", "0.6711568", "0.670124", "0.6694763", "0.6669541", "0.6615247", "0.6608392", "0.6584162", "0.6422713", "0.6394887", "0.63653255", "0.63096106", "0.6282592", "0.6261041", "0.62465924", "0.6240609", "0.62317926", "0.62271726", "0.61191446", "0.6112608...
0.69028705
1
Round the value x down to the nearest time step interval.
def _round(self, x): return x - x % self.minutes_per_step
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def round_down(x):\n return int(math.floor(x / 10.0)) * 10", "def round_down(x, sig=2):\n dig = pow(10., sig - int(math.floor(math.log10(abs(x)))) - 1)\n return math.floor(x * dig) / dig", "def downround(x, base):\n return base * math.floor(float(x) / base)", "def round_down(x, m):\n r...
[ "0.75671387", "0.7262019", "0.7236685", "0.6981943", "0.68482816", "0.6823797", "0.6816983", "0.6760523", "0.66808796", "0.6487473", "0.64819694", "0.64758486", "0.6460304", "0.63035595", "0.62998134", "0.62797904", "0.6267597", "0.62645566", "0.62511766", "0.62149465", "0.61...
0.77484167
0
Disconnect user using Facebook
def fbdisconnect(): facebook_id = login_session['facebook_id'] url = 'https://graph.facebook.com/%s/permissions' % facebook_id h = httplib2.Http() result = h.request(url, 'DELETE')[1] del login_session['facebook_id'] return "you have been logged out"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fbdisconnect():\n\n facebook_id = login_session['facebook_id']\n # The access token must me included to successfully logout\n access_token = login_session['access_token']\n # Only disconnect a connected user.\n if access_token is None:\n response = make_response(json.dumps('Current user n...
[ "0.85809785", "0.7544562", "0.7427517", "0.73637265", "0.72514355", "0.7159431", "0.7095894", "0.7086774", "0.70851356", "0.7000922", "0.6953053", "0.6939351", "0.69161266", "0.6914257", "0.6896904", "0.67927265", "0.6780294", "0.67707384", "0.67109525", "0.6651078", "0.65444...
0.86079866
0
Gera hash do arquivo
def gerar_hash(nome_arquivo): m = hashlib.sha256() arquivo = open(nome_arquivo,'rb').read() m.update(arquivo) hash_votos = m.digest() open("hash_votos_cifrados.txt","w").write(hash_votos)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hash_file(filename):\r\n\r\n # make a hash object\r\n h = hashlib.sha1()\r\n\r\n # open file for reading in binary mode\r\n with open(filename,'rb') as file:\r\n\r\n # loop till the end of the file\r\n chunk = 0\r\n while chunk != b'':\r\n # read only 1024 bytes at a time\r\...
[ "0.74447024", "0.7410846", "0.7404686", "0.73769", "0.73769", "0.7374401", "0.7373445", "0.73704106", "0.7331975", "0.7331069", "0.7302976", "0.73004663", "0.7294757", "0.7269015", "0.719902", "0.7176025", "0.71684515", "0.71463585", "0.7139593", "0.71361864", "0.71261925", ...
0.82218
0
Gera a chave aes secreta
def gera_chave(): AES_tamanho_chave = 32 chave_aes_secreta = os.urandom(AES_tamanho_chave) return chave_aes_secreta
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cambiar_escena(self, escena):\n\t\t# Reemplazo directo\n\t\tself.escena = escena\n\t\t# Reiniciar la ventana con el tamaño de la nueva escena\n\t\tprint(\"Iniciando nuevo contexto OpenGL...\")\n\t\tv_ancho, v_alto = escena.tam\n\t\topciones = OPENGL | DOUBLEBUF\n\t\tif escena.pant_compl:\n\t\t\topciones |= FUL...
[ "0.551257", "0.5442712", "0.53087753", "0.5194765", "0.5139646", "0.50706965", "0.4979023", "0.49139866", "0.49010268", "0.4873511", "0.4871852", "0.48144704", "0.47974575", "0.47648686", "0.47554955", "0.4750068", "0.47483042", "0.47270516", "0.4726411", "0.4709047", "0.4704...
0.624345
0
Returns all nodes of the graph visited using BFS
def bfs(graph,start): #keeps track of nodes to be visited queue = [] #keeps track of nodes already visited explored = [] queue.append(start) while queue: #remove first node from queue curr_node = queue.pop(0) #check if node is visited if curr_node not in explored: explored.append(curr_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_visited_nodes(self):\n return self.visited_nodes", "def bfs(self, start):\n output_list = []\n queue = Queue()\n queue.put(start)\n visited = set(start)\n while not queue.empty():\n current_node = queue.get()\n output_list.append(current...
[ "0.7565556", "0.7559426", "0.74942124", "0.7450504", "0.7416849", "0.7399297", "0.73478484", "0.7344478", "0.7339527", "0.7230581", "0.7224638", "0.72207165", "0.72174174", "0.7151831", "0.71481955", "0.7136827", "0.70414394", "0.6941996", "0.6924116", "0.6856379", "0.6832478...
0.76385623
0
Create an empty Queue. Test that its size is 0.
def test_new_queue_is_empty(self): queue = Queue_() self.assertTrue(queue.empty()) self.assertEqual(queue.size(), 0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_empty_queue():\n return Queue(0, None, None)", "def empty_queue():\n return Queue()", "def empty_queue():\n return Queue()", "def test_size_empty(the_queue):\n assert the_queue.size() == 0", "def test_size_of_new_queue():\n queue = Queue()\n assert queue.size() == 0", "def test...
[ "0.87515324", "0.8171699", "0.8171699", "0.81615436", "0.80206966", "0.75779504", "0.7575396", "0.7412317", "0.7373005", "0.73489606", "0.7348045", "0.7347103", "0.7224042", "0.7193373", "0.7141106", "0.71210796", "0.7055048", "0.7046142", "0.7018612", "0.6972072", "0.6963029...
0.8647534
1