query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
The ID or Amazon Resource Name (ARN) of the target group.
def target_group_identifier(self) -> pulumi.Input[str]: return pulumi.get(self, "target_group_identifier")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def target_group_identifier(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"target_group_identifier\")", "def get_target_group_arn(self, short_name):\n target_group_info = self.get_target_group_info(short_name)\n return target_group_info['TargetGroupArn']", "def target_group(self)...
[ "0.8059303", "0.77209467", "0.76946956", "0.76142114", "0.7459761", "0.7424217", "0.7291563", "0.7291563", "0.7070664", "0.7054723", "0.7054723", "0.7054723", "0.7054723", "0.7054723", "0.7054723", "0.700518", "0.700518", "0.6932303", "0.6895912", "0.68954605", "0.689537", ...
0.77805084
1
Input properties used for looking up and filtering TargetGroupAttachment resources.
def __init__(__self__, *, target: Optional[pulumi.Input['TargetGroupAttachmentTargetArgs']] = None, target_group_identifier: Optional[pulumi.Input[str]] = None): if target is not None: pulumi.set(__self__, "target", target) if target_group_identifier is not ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(__self__,\n resource_name: str,\n opts: Optional[pulumi.ResourceOptions] = None,\n target: Optional[pulumi.Input[pulumi.InputType['TargetGroupAttachmentTargetArgs']]] = None,\n target_group_identifier: Optional[pulumi.Input[str]] = None,\...
[ "0.6232913", "0.6098704", "0.58432794", "0.5615819", "0.5539513", "0.54342437", "0.4729805", "0.4729805", "0.4729805", "0.4729805", "0.4729805", "0.4729805", "0.46846697", "0.46832612", "0.45703927", "0.4514953", "0.45037252", "0.4499622", "0.44905135", "0.44891226", "0.44881...
0.6002845
2
The ID or Amazon Resource Name (ARN) of the target group.
def target_group_identifier(self) -> Optional[pulumi.Input[str]]: return pulumi.get(self, "target_group_identifier")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def target_group_identifier(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"target_group_identifier\")", "def target_group_identifier(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"target_group_identifier\")", "def get_target_group_arn(self, short_name):\n target_group_in...
[ "0.8060474", "0.7782377", "0.77201146", "0.7695647", "0.74612945", "0.74235034", "0.72911525", "0.72911525", "0.7071454", "0.7055554", "0.7055554", "0.7055554", "0.7055554", "0.7055554", "0.7055554", "0.70069563", "0.70069563", "0.6934187", "0.6897746", "0.6897058", "0.689599...
0.76161706
4
Provides the ability to register a target with an AWS VPC Lattice Target Group. Example Usage Basic Usage ```python import pulumi import pulumi_aws as aws example = aws.vpclattice.TargetGroupAttachment("example", target_group_identifier=aws_vpclattice_target_group["example"]["id"], target=aws.vpclattice.TargetGroupAtta...
def __init__(__self__, resource_name: str, opts: Optional[pulumi.ResourceOptions] = None, target: Optional[pulumi.Input[pulumi.InputType['TargetGroupAttachmentTargetArgs']]] = None, target_group_identifier: Optional[pulumi.Input[str]] = None, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(__self__, *,\n target: pulumi.Input['TargetGroupAttachmentTargetArgs'],\n target_group_identifier: pulumi.Input[str]):\n pulumi.set(__self__, \"target\", target)\n pulumi.set(__self__, \"target_group_identifier\", target_group_identifier)", "def __init__...
[ "0.7431431", "0.7055174", "0.66023284", "0.6325992", "0.62801075", "0.62801075", "0.62801075", "0.62706286", "0.62706286", "0.62706286", "0.61292464", "0.5706547", "0.5595607", "0.5569349", "0.5554444", "0.5554444", "0.5554444", "0.5554444", "0.5554444", "0.5554444", "0.55528...
0.6507032
3
Provides the ability to register a target with an AWS VPC Lattice Target Group. Example Usage Basic Usage ```python import pulumi import pulumi_aws as aws example = aws.vpclattice.TargetGroupAttachment("example", target_group_identifier=aws_vpclattice_target_group["example"]["id"], target=aws.vpclattice.TargetGroupAtta...
def __init__(__self__, resource_name: str, args: TargetGroupAttachmentArgs, opts: Optional[pulumi.ResourceOptions] = None): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(__self__, *,\n target: pulumi.Input['TargetGroupAttachmentTargetArgs'],\n target_group_identifier: pulumi.Input[str]):\n pulumi.set(__self__, \"target\", target)\n pulumi.set(__self__, \"target_group_identifier\", target_group_identifier)", "def __init__...
[ "0.74325806", "0.7056155", "0.6508622", "0.63249356", "0.62815833", "0.62815833", "0.62815833", "0.6272129", "0.6272129", "0.6272129", "0.61320055", "0.5705912", "0.5594829", "0.5568451", "0.5556853", "0.5556853", "0.5556853", "0.5556853", "0.5556853", "0.5556853", "0.5553764...
0.6603863
2
Get an existing TargetGroupAttachment resource's state with the given name, id, and optional extra properties used to qualify the lookup.
def get(resource_name: str, id: pulumi.Input[str], opts: Optional[pulumi.ResourceOptions] = None, target: Optional[pulumi.Input[pulumi.InputType['TargetGroupAttachmentTargetArgs']]] = None, target_group_identifier: Optional[pulumi.Input[str]] = None) -> 'TargetGroupAttach...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_attachment(self,\n attachment_name: Text) -> Optional[test_record.Attachment]:\n # Check current running phase state for the attachment name first.\n if self.running_phase_state:\n if attachment_name in self.running_phase_state.phase_record.attachments:\n attachment = ...
[ "0.5213174", "0.5193024", "0.5071051", "0.50478333", "0.49847454", "0.4979039", "0.48070908", "0.46779084", "0.4650041", "0.4650041", "0.4650041", "0.4650041", "0.4650041", "0.4650041", "0.46282402", "0.461483", "0.4582758", "0.4582302", "0.45697513", "0.45678928", "0.4559987...
0.752676
0
The ID or Amazon Resource Name (ARN) of the target group.
def target_group_identifier(self) -> pulumi.Output[str]: return pulumi.get(self, "target_group_identifier")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def target_group_identifier(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"target_group_identifier\")", "def get_target_group_arn(self, short_name):\n target_group_info = self.get_target_group_info(short_name)\n return target_group_info['TargetGroupArn']", "def target_group(self) ...
[ "0.7782377", "0.77201146", "0.7695647", "0.76161706", "0.74612945", "0.74235034", "0.72911525", "0.72911525", "0.7071454", "0.7055554", "0.7055554", "0.7055554", "0.7055554", "0.7055554", "0.7055554", "0.70069563", "0.70069563", "0.6934187", "0.6897746", "0.6897058", "0.68959...
0.8060474
0
Extract color data from the .tiff file
def generate_colour_data(width, height, imagiry_data, pixel2coord): for i in range(1, height): for j in range(1, width): colour_data.append( [ pixel2coord(j, i)[0], pixel2coord(j, i)[1], imagiry_data.read([1])[0][i - 1][...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def readtiff(datafile, sub_im, cr):\n\n with rasterio.open(datafile) as src:\n d = src.read(1, window=Window(cr[0]-sub_im, cr[1]-sub_im, sub_im*2, sub_im*2))\n\n #print(\"Number of elements and size of the array is\",d.size, d.shape)\n #d[d==0]= np.nan # convert zeros to nan\n return d", "def ...
[ "0.6775925", "0.64769757", "0.64712006", "0.64067876", "0.6323894", "0.62590426", "0.62494826", "0.6191413", "0.60908866", "0.6090622", "0.60546464", "0.6032689", "0.60201806", "0.59800386", "0.5953728", "0.59474844", "0.59427553", "0.5886405", "0.58635443", "0.58419293", "0....
0.0
-1
Return a count of how many employees this person manages. Return a count of how many people that manager manages. This should include everyone under them, not just people who directly report to them.
def count_employees(self, count=0): if self.children: for child in self.children: count += 1 + child.count_employees() # recursion: count_employees(child) if not self.children: # base case but that is already covered in line 48 return count return coun...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def employees_count(self, obj):\n return obj.employees_count()", "def number_of_employees(self) -> object:\n return self._number_of_employees", "def display_count():\n print \"There are %d employees\" % Employee.count", "def getEmpiricalCounts(self):\n return self.empirical_counts...
[ "0.75958306", "0.70435137", "0.6484758", "0.62854797", "0.6084669", "0.59884465", "0.59163004", "0.587685", "0.5790845", "0.5768297", "0.5670242", "0.5650915", "0.5648204", "0.5602807", "0.5590338", "0.5584585", "0.5559131", "0.55568874", "0.5534962", "0.54872304", "0.5434427...
0.6947313
2
Returns a string containing a random uuid
def generate_uuid(): return uuid.uuid4()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def uuid():\n return ''.join(random.choice(string.ascii_lowercase + string.digits) for _ in range(32))", "def __generate_random_string():\n return uuid4().hex[:6].upper()", "def gen_uuid():\n return str( uuid.uuid4() )", "def gen_uuid():\n return str( uuid.uuid4() )", "def gen_uuid() -> str...
[ "0.89296514", "0.8614583", "0.8608552", "0.8608552", "0.8571099", "0.85449356", "0.8490883", "0.8451079", "0.84057623", "0.8386715", "0.83474123", "0.8344002", "0.83331656", "0.832412", "0.8317769", "0.82759994", "0.8266738", "0.80771947", "0.7984721", "0.7977263", "0.7977143...
0.8265079
17
Construct and return data provider.
def find_provider(self) -> DataProvider: data_source = self._single_data_source() identifiers = self._make_identifiers() return self._create_data_provider(data_source, identifiers)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_data_provider(self, data_source: DataSource, identifiers: Identifiers) -> DataProvider:\n if data_source.driver is not None:\n return DatabaseDataProvider(data_source, identifiers, self._injector)\n elif data_source.mime_type == DataSourceConstants.MIME_TYPE_JSON:\n ...
[ "0.6566284", "0.64414555", "0.6421565", "0.6354318", "0.62949705", "0.6272591", "0.6233643", "0.6149416", "0.60801214", "0.5942076", "0.5927878", "0.5916989", "0.59090745", "0.5891367", "0.5875818", "0.58682203", "0.58377075", "0.5828267", "0.5732329", "0.56926715", "0.567040...
0.6899661
0
Find an appropriate data provider instance for a data source and return it.
def _create_data_provider(self, data_source: DataSource, identifiers: Identifiers) -> DataProvider: if data_source.driver is not None: return DatabaseDataProvider(data_source, identifiers, self._injector) elif data_source.mime_type == DataSourceConstants.MIME_TYPE_JSON: return Js...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_provider(self) -> DataProvider:\n data_source = self._single_data_source()\n identifiers = self._make_identifiers()\n return self._create_data_provider(data_source, identifiers)", "def engine_for_data_source(self, data_source_id):\n engine = None\n\n # find data_source...
[ "0.80434716", "0.68087965", "0.6472477", "0.6324865", "0.6181027", "0.6065154", "0.6047303", "0.5923456", "0.5854328", "0.58054674", "0.57857233", "0.57642937", "0.5744689", "0.5741175", "0.5718049", "0.5650882", "0.56424963", "0.56369716", "0.5622577", "0.56058973", "0.55954...
0.7104102
1
Find and return data source in the list of columns.
def _single_data_source(self) -> DataSource: data_source = None for meta_column in self._meta_columns: if data_source is None: data_source = meta_column.data_source elif data_source is not meta_column.data_source: raise SomeError('Mixed data source...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_data_source_identifiers(self):\n collection_ids = self.am_db_api.get_collections_identifiers()\n for col in collection_ids:\n if col['code'] == self.collection_acronym:\n _raw_data = col\n break\n if _raw_data:\n return [col, ]\n ...
[ "0.630452", "0.60534185", "0.60346985", "0.59439075", "0.5786718", "0.57262063", "0.5580457", "0.5549795", "0.5502819", "0.546728", "0.54508007", "0.53607213", "0.53460145", "0.5345716", "0.53440297", "0.531765", "0.5290032", "0.5263445", "0.52465343", "0.52288145", "0.520390...
0.68384
0
Construct and return list of all identifiers in a column list.
def _make_identifiers(self) -> Identifiers: identifier_list = [] for meta_column in self._meta_columns: idf_string = meta_column.reflected_column_idf idf = Identifier.from_string(idf_string) identifier_list.append(idf) return identifier_list
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def column_values(table: list[dict[str, str]], column_name: str) -> list[str]:\n column_values: list[str] = []\n for row in table:\n item: str = row[column_name]\n column_values.append(item)\n return column_values", "def _create_sql_columns(self, a_list):\n result = \"\"\n \n...
[ "0.6425198", "0.63352287", "0.62166625", "0.62166625", "0.6156101", "0.61026555", "0.6070932", "0.60350156", "0.60269547", "0.59695834", "0.59083545", "0.5736998", "0.57237095", "0.570372", "0.56879526", "0.5640683", "0.5635314", "0.5628415", "0.5623144", "0.56099755", "0.559...
0.716665
0
This is an example test for a Dagster op.
def test_hello(): with build_op_context( resources={ "partition_start": ResourceDefinition.hardcoded_resource("2020-12-30 00:00:00"), "partition_end": ResourceDefinition.hardcoded_resource("2020-12-30 01:00:00"), "hn_client": hn_snapshot_client, } ) as context...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_drugs_get(self):\n pass", "def test_basic_execution(self):", "def test():\n pass", "def test(self):\n pass", "def test():", "def test():", "def test_doc():\n pass", "def test_01_visit(self):", "def tests():", "def test(ctx):\n pass", "def _test(self):", ...
[ "0.64674073", "0.6402451", "0.6398701", "0.63896984", "0.6277145", "0.6277145", "0.61513007", "0.61400527", "0.60824406", "0.6073764", "0.6054717", "0.6054717", "0.6054717", "0.6054717", "0.6054717", "0.60486776", "0.6027375", "0.60171676", "0.60171676", "0.6013399", "0.59449...
0.0
-1
Download, parse, and clean the spreads & overunder tables for one game. The columns are pinnacle, betonline, bookmaker each with suffix _spread or _over_under; datetime; hometeam, awayteam, favored; week. The first three are the bookies and give the spreads from the point of view of the favored team (so they're general...
def game(hometeam, awayteam, week, year): with urlopen(spread_url(hometeam, awayteam, week, year)) as connection: spreads_page = connection.read() # Note that infer_types is deprecated and won't work starting in Pandas 0.14 LOG.debug('Getting game %s', (hometeam, awayteam, week, year)) sp = read_html(io=spreads_p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_proboxingodds(soup):\n tables = []\n site = pd.read_html(str(soup))\n for idx, table in enumerate(site):\n if idx == 0:\n pass\n elif idx % 2 != 0:\n sliced = table[(table['Unnamed: 0'].str.contains(':')) | (table['Unnamed: 0'] == 'UTC')]\n sliced =...
[ "0.6246023", "0.61548907", "0.60092086", "0.5975189", "0.5945373", "0.58612907", "0.581316", "0.57939166", "0.57939166", "0.57505715", "0.5735615", "0.57076836", "0.56700265", "0.56516606", "0.5643471", "0.56255335", "0.56039417", "0.55867517", "0.5583636", "0.5582516", "0.55...
0.7500191
0
Download, parse, and clean a table of games and scores for given season. The columns are week; hometeam; awayteam; winner; date; points, yards, and turn overs for the winning team; points, yards, and turn overs for the losing team; and season.
def season_games(year): LOG.debug('Getting season %d', year) data = read_html(io=season_games_url(year), attrs={'id': 'games'}, infer_types=False, header=0) if len(data) != 1: raise CantFindTheRightTable data = data.pop() # Cleaning. del data["Unnamed: 3"] # The code below issues "UserWar...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pageScrape(season_url, wr):\r\n\r\n\thtml = urlopen(season_url)\r\n\tsoup = BeautifulSoup(html, \"lxml\")\r\n\r\n\t# our desired table has id = 'results'\r\n\t# we take the rows in the table's children\r\n\t# But we make sure to ignore the first two, since they're unrelated\r\n\ttable = soup.find(id = 'results...
[ "0.72744703", "0.71057445", "0.7024942", "0.6991828", "0.67987585", "0.6700538", "0.6658425", "0.6575679", "0.64786863", "0.64421767", "0.6356316", "0.63480973", "0.6342161", "0.63054234", "0.628538", "0.62465894", "0.62191725", "0.6196027", "0.6153302", "0.61445725", "0.6125...
0.77701926
0
Convenience wrapper for `game` when you're not sure who's the home team. We first try calling `game` with `team_a` as the home team, and if that doesn't work, we next try `team_b`. In the former case we add a column called `home_away_discrepency` equal to `False`. In the latter case the column contains `True` and the `...
def game_unknown_homeaway(team_a, team_b, week, year): try: g = game(team_a, team_b, week, year) except (CantFindTheRightTable, ValueError): g = game(team_b, team_a, week, year) awayteam, hometeam = g.hometeam.copy(), g.awayteam.copy() g.hometeam, g.awayteam = hometeam, awayteam g['home_away_discrepency'] =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def game(self, **kw):\n _append_conds(self._default_cond, types.Game, kw)\n if 'team' in kw:\n ors = {'home_team': kw['team'], 'away_team': kw['team']}\n self.andalso(Query(self._db, orelse=True).game(**ors))\n return self", "def hometeamify(t):\n\tt = t.copy()\n\t# Win...
[ "0.6640279", "0.64301515", "0.6302677", "0.62670434", "0.6090484", "0.59702206", "0.5948577", "0.5926323", "0.5851775", "0.581768", "0.5812748", "0.57850784", "0.5778715", "0.5760123", "0.56636155", "0.5662619", "0.5662174", "0.56604946", "0.5657123", "0.5652413", "0.56399506...
0.685784
0
Download, parse, and clean the scores & spreads for all games in a season `timeout` is in seconds and `concurrency` is the number of threads to use, defaulting to the number of CPUs. If not `None`, `week` limits the games fetched to those in the given week. This function returns two values. The first is the table, whic...
def season(year, week=None, timeout=None, concurrency=_DEFAULT_CONCURRENCY): LOG.debug('Concurrency = %d', concurrency) games = season_games(year) if week is not None: games = games[games.week == week] expected_n = len(games) tables, futures_to_args, failures = [], {}, [] # See https://docs.python.org/3/library...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def seasons(years, timeout=None, concurrency=_DEFAULT_CONCURRENCY):\n\ttables, failures = [], []\n\tfor year in years:\n\t\tLOG.info('=' * 10 + ' %d ' + '=' * 10, year)\n\t\ttable, failure = season(year, timeout=timeout, concurrency=concurrency)\n\t\ttables.append(table)\n\t\tfailures.extend(failure)\n\treturn pd....
[ "0.6129513", "0.5730428", "0.5411161", "0.5363586", "0.5149617", "0.50999445", "0.50895286", "0.50845605", "0.5071889", "0.5037335", "0.50228286", "0.49968722", "0.4969007", "0.49601135", "0.49494612", "0.49304613", "0.49097982", "0.48657218", "0.48565075", "0.4851376", "0.48...
0.746054
0
Download, parse, and clean multiple seasons of NFL games and spreads. `years` is an iterable of integers. `timeout` is measured in seconds. `concurrency is the number of threads to use, defaulting to the number of CPUs. This function returns two values. The first is the table, which is the the merger of the tables that...
def seasons(years, timeout=None, concurrency=_DEFAULT_CONCURRENCY): tables, failures = [], [] for year in years: LOG.info('=' * 10 + ' %d ' + '=' * 10, year) table, failure = season(year, timeout=timeout, concurrency=concurrency) tables.append(table) failures.extend(failure) return pd.concat(tables), failure...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def season(year, week=None, timeout=None, concurrency=_DEFAULT_CONCURRENCY):\n\tLOG.debug('Concurrency = %d', concurrency)\n\tgames = season_games(year)\n\tif week is not None:\n\t\tgames = games[games.week == week]\n\texpected_n = len(games)\n\ttables, futures_to_args, failures = [], {}, []\n\t# See https://docs....
[ "0.6988165", "0.53787047", "0.5354344", "0.50391036", "0.48686248", "0.48666587", "0.48592305", "0.48330218", "0.47225174", "0.4698474", "0.46848443", "0.46690604", "0.46613982", "0.4643933", "0.46422544", "0.45821732", "0.4577877", "0.4571864", "0.45470133", "0.45312637", "0...
0.742822
0
Convert a `season`generated table `t` so the data is hometeam centric. `season` generates a table whose points, yards, and turnovers columns are broken down by winning and losing team and whose spreads columns are relative to the favored team. Convert all these winner/loser based columns to be home/away based and conve...
def hometeamify(t): t = t.copy() # Winner/loser based columns hw, aw = t.hometeam == t.winner, t.awayteam == t.winner assert (hw == ~aw).all() # Suffix for keys = W for winner L for loser. Values are new names for old, new in {'Pts': 'points', 'Yds': 'yards', 'TO': 'turn_overs'}.items(): t[new + '_home'] = (hw ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def season_games(year):\n\tLOG.debug('Getting season %d', year)\n\tdata = read_html(io=season_games_url(year),\n\t\t\t\t\t attrs={'id': 'games'},\n\t\t\t\t\t infer_types=False,\n\t\t\t\t\t header=0)\n\tif len(data) != 1:\n\t\traise CantFindTheRightTable\n\tdata = data.pop()\n\n\t# Cleaning.\n\tdel data[\"Unname...
[ "0.63010097", "0.6165743", "0.609641", "0.59280556", "0.5682527", "0.5622098", "0.5577865", "0.55546534", "0.5509511", "0.55027294", "0.5485158", "0.54674494", "0.5361212", "0.5352292", "0.5331872", "0.5305586", "0.5231739", "0.5226202", "0.51555604", "0.51513076", "0.5111141...
0.6389691
0
Return the latest football season that started before the given `date`. `date` should be a `datetime.date` object. This function merely assumes that football season starts at the beginning of September.
def latest_season_before(date): if date.month < 9: return date.year - 1 return date.year
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def return_football_season(date=datetime.datetime.today()):\n date_aux = subtract_months(date, 6)\n beginning_year = str(date_aux.year)\n ending_year = date_aux.year + 1\n ending_year = str(ending_year)[-2:]\n season = ''.join([beginning_year, '-', ending_year])\n return season", "def getSeason...
[ "0.69180113", "0.6146285", "0.57859606", "0.576548", "0.56443614", "0.55603045", "0.5519733", "0.54679203", "0.5379245", "0.5354513", "0.5308661", "0.5244202", "0.51410407", "0.51207197", "0.510111", "0.5079919", "0.50713015", "0.5060351", "0.5047275", "0.49737677", "0.493112...
0.7798447
0
Some arbitrary deterministic test function.
def some_mock_f(x): random_stream = pyrandom.Random(json.dumps(x, sort_keys=True)) y = [random_stream.gauss(0, 1) for _ in OBJECTIVE_NAMES] return y
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def istest(func):\n func.__test__ = True\n return func", "def test():\r\n\tassert 1609693773.1609693773() == \"1609693773\", \"test failed\"\r\n\t#assert 1609693773.<function>(<values>) == <the result(s) you would like to have>, \"<the fail message>\"\r", "def test_function(arg):\n return arg * 2", ...
[ "0.68127704", "0.67535555", "0.67393816", "0.6707131", "0.6696128", "0.6687894", "0.6634872", "0.65684974", "0.6532523", "0.6460401", "0.644191", "0.64264655", "0.6384061", "0.6370439", "0.634573", "0.6340645", "0.6301211", "0.62693214", "0.62587863", "0.6235812", "0.62279636...
0.0
-1
Assignes a selfRef to a resource
def set_self_ref(self, resource): fullname = utils.class_fullname(resource) if fullname not in self._models_index: self.send_error(400, message="Unrecognized resource type: %s" % type(resource)) return -1 resource_name = self._models_index[fullname] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def self_uri(self, self_uri):\n \n self._self_uri = self_uri", "def self_uri(self, self_uri):\n \n self._self_uri = self_uri", "def self_uri(self, self_uri):\n \n self._self_uri = self_uri", "def self_uri(self, self_uri):\n \n self._self_uri = self_uri"...
[ "0.69215506", "0.69215506", "0.69215506", "0.69215506", "0.6608306", "0.6608306", "0.62731814", "0.6217579", "0.6217579", "0.61596036", "0.6048173", "0.59555393", "0.5861509", "0.5775239", "0.5726745", "0.56997484", "0.5627227", "0.562261", "0.562261", "0.5587249", "0.5512516...
0.81884384
0
Resolves self hyperlinks (JSONPath and JSONPointers.
def _complete_href_links(self, parent_collection, current): if isinstance(current, HyperLink) or \ (isinstance(current, dict) and "href" in current): if isinstance(current["href"], (bytes, str)): resource = None if current["href"] in self._cache: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_self_href(response):\n data = jsonutils.loads(response.body)\n for link in data['versions'][0]['links']:\n if link['rel'] == 'self':\n return link['href']\n return ''", "def self_link(self):\n return self._json['coredata'].get('link', [])[0].get('@href')", "def Self(s...
[ "0.602833", "0.5747524", "0.53852236", "0.5332049", "0.53265524", "0.52382493", "0.52201176", "0.52140194", "0.52034295", "0.5167555", "0.50881326", "0.50849515", "0.5083651", "0.50580704", "0.5019191", "0.49718055", "0.4957375", "0.4956555", "0.4889869", "0.48428294", "0.483...
0.67970556
0
This method is called when the spider is opened.
def open_spider(self,Spider): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def open_spider(self, spider):\n pass", "def open_spider(self, spider):\n assert spider not in self.sites, \"Spider already opened: %s\" % spider\n self.sites[spider] = SpiderInfo(spider)", "def __init__(self, spider):\n\n super(SprintBehavior, self).__init__(spider)\n self.r...
[ "0.83981526", "0.7474456", "0.6518192", "0.6464361", "0.64332694", "0.6359454", "0.6268794", "0.6236614", "0.62211096", "0.62166256", "0.6149158", "0.6127409", "0.61030036", "0.60981435", "0.60644287", "0.6060854", "0.6018061", "0.60120916", "0.59972566", "0.59972566", "0.599...
0.79172105
1
Get an image set.
def get(log, session, args): log('imageset id: {highlight}{id}{reset}', highlight=Fore.GREEN, id=args.id, reset=Style.RESET_ALL) log.warn('Get imageset command coming soon.')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetImageSet(cls, ID):\n if ID in cls._imageSets:\n return cls._imageSets[ID]", "def get_image_set(image_set, depth=False, scale=1):\n image_files = glob.glob(image_set)\n loaded_images = []\n\n # reorder file names to be in numbering order\n filenames_in_order = ['' for _ in ran...
[ "0.7954262", "0.6740134", "0.64645076", "0.62871885", "0.6021483", "0.601437", "0.599391", "0.5967952", "0.5960324", "0.59564406", "0.5953417", "0.5952895", "0.59492964", "0.59325", "0.5910726", "0.5877919", "0.5854985", "0.58473265", "0.5806738", "0.57102996", "0.56972474", ...
0.7376378
1
Return executable tasks with image uploads in batches. Instead of performing image uploads and updating the imageset one at a time, we reduce load on the API server by uploading many images and updating the api server in one go, consequently making upload faster.
def _get_chunk_upload_futures( executor, paths, session, create_url, complete_url, log, workload_size, offset ): total_work = len(paths) workloads = [] temp = [] i = 0 while i < total_work: path = paths[i] temp.append(path) i += 1 if len(temp) == workload_siz...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _process_image_files(name, cnts, roots, num_shards): \n \n # Break all images into batches with a [ranges[i][0], ranges[i][1]].\n spacing = np.linspace(0, sum(cnts), FLAGS.num_threads + 1).astype(np.int)\n ranges = []\n for i in range(len(spacing) - 1):\n ranges.append([spacing[i], spacing[i +...
[ "0.6663598", "0.63845474", "0.62568337", "0.6249887", "0.618294", "0.60570496", "0.60385495", "0.5976142", "0.596462", "0.5929896", "0.5870594", "0.58550143", "0.5847463", "0.5847073", "0.58429337", "0.5841489", "0.5832478", "0.5810369", "0.5801244", "0.5747127", "0.57306874"...
0.70541716
0
Update an image set.
def update_from_dict(log, session, configuration): # check for config ims_type = configuration["imageset_type"] ims_id = configuration["id"] ims_url = "{}imagesets/{}".format( http.get_api_url(configuration["url"], configuration["project"]), ims_id, ) ims = http.get(session, ims_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_image(self, image):\n raise NotImplementedError()", "def update_image(self):\n self.image = Image.fromarray(self.img)", "def update_img(self):\n self.img = np.array(self.image)", "def update_image(self):\n if self.filenames:\n pos = self.slider.value()\n ...
[ "0.6671458", "0.6253759", "0.61016107", "0.6100223", "0.60599226", "0.5962895", "0.5962895", "0.5962895", "0.5962895", "0.5943573", "0.5916061", "0.5887711", "0.5863244", "0.5825705", "0.5805472", "0.5747548", "0.57276976", "0.57228637", "0.56967413", "0.56580544", "0.5621037...
0.5917782
10
Delete an image set.
def delete(log, session, args): log('imageset id: {highlight}{id}{reset}', highlight=Fore.GREEN, id=args.id, reset=Style.RESET_ALL) log.warn('delete imageset command coming soon.')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_set(set_name):\n\n flg = logging.getLogger(\"lettuce.xgenSetup.delete_set\")\n\n flg.info(\"Set to delete: {}\".format(set_name))\n\n if mc.objExists(set_name):\n mc.select(set_name)\n old_objects = mc.ls(selection=True)\n flg.debug(\"Old Objects:\")\n for o in old_o...
[ "0.7083559", "0.6625625", "0.65320134", "0.6487162", "0.6302784", "0.62108546", "0.61581236", "0.61563313", "0.6123999", "0.6080582", "0.6059259", "0.6047355", "0.6043354", "0.60260856", "0.600469", "0.6001009", "0.5964619", "0.5953437", "0.5917767", "0.5909501", "0.58970803"...
0.81307465
0
Resolve all paths to a list of files.
def _resolve_paths(paths): allowed_ext = tuple(MIMES.keys()) resolved = [] for path in paths: if os.path.isdir(path): resolved.extend( entry.path for entry in os.scandir(path) if entry.is_file() and entry.name.lower().endswith(allowed_ext) ) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resolve_specs(paths):\n specs = []\n for path in paths:\n if os.path.isdir(path):\n _, _, files = os.walk(path).next()\n specs.extend(os.path.join(path, fname) for fname in files)\n else:\n specs.append(path)\n return specs", "def handle_files_args(*pat...
[ "0.70843834", "0.7008949", "0.7005918", "0.6991757", "0.6980533", "0.6943847", "0.6908536", "0.6815965", "0.6810721", "0.67709655", "0.66659486", "0.66539854", "0.6626398", "0.6625859", "0.660965", "0.65911394", "0.6577185", "0.6509825", "0.6505772", "0.64861", "0.64778113", ...
0.7782248
0
Store SLR data in a dataset
def _write_to_dataset(parser1, parser2, dset, rundate): data_all1 = parser1.as_dict() data_all2 = parser2.as_dict() if parser1.file_path == parser2.file_path: collection = [data_all1] else: collection = [data_all1, data_all2] # Meta information dset.meta["tech"] = "slr" dse...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_data():\r\n #if not os.path.exists(filepath):\r\n #download_data()\r\n metadata = read(filepath + flist[-1])\r\n ndata = metadata['num_cases_per_batch']\r\n ndim = metadata['num_vis']\r\n\r\n data, train, test = {}, {}, {}\r\n data['labels'] = metadata['label_names']\r\n data['n...
[ "0.6032091", "0.60181564", "0.5990172", "0.59721607", "0.59474033", "0.5929216", "0.59091103", "0.5888812", "0.586171", "0.5857652", "0.58549386", "0.5849131", "0.5848328", "0.5759807", "0.5758934", "0.5748189", "0.57465774", "0.57341397", "0.57004267", "0.56873584", "0.56487...
0.0
-1
Write the meteorological data from the parser to the dataset
def _write_met_to_dataset(dset, data, rundate): data = _interpolate_meteorological_data(dset, data, rundate) met_fields = set().union(*[v.keys() for k, v in data.items() if k.startswith("met_")]) for field in met_fields: dset.add_float(field, val=np.diag([data["met_" + s][field] for s in dset.stati...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _write_to_dataset(parser1, parser2, dset, rundate):\n\n data_all1 = parser1.as_dict()\n data_all2 = parser2.as_dict()\n if parser1.file_path == parser2.file_path:\n collection = [data_all1]\n else:\n collection = [data_all1, data_all2]\n\n # Meta information\n dset.meta[\"tech\"...
[ "0.64577776", "0.64060456", "0.61828107", "0.6066828", "0.58823055", "0.5870293", "0.58422923", "0.5788097", "0.57642424", "0.5742792", "0.5716306", "0.5624275", "0.5606775", "0.55803984", "0.55746037", "0.5545224", "0.55425394", "0.55351293", "0.5533233", "0.55117476", "0.54...
0.59315515
4
Calculate temperature, humidity and pressure at observation epochs Meteorological data are calculated at observation epochs by interpolating in the data given on the observation file for each station. Missing meteorological data are currently not handled.
def _interpolate_meteorological_data(dset, data, rundate): rundate = datetime(rundate.year, rundate.month, rundate.day) for field, station in [(f, f[4:]) for f in data.keys() if f.startswith("met_")]: log.debug(f"Meteorological data available for station {station}") met_time = data[field].pop("...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getTemperatureMeasurements(self):\n # self.board.readline()\n self.stop = False\n times = []\n temps = [[], [], []]\n \n # A synchronisation string containing the characters tx is sent before each set of measurements,\n # we ensure correct reading of the measure...
[ "0.63405967", "0.63176763", "0.60726416", "0.60086864", "0.6006904", "0.5976299", "0.5911458", "0.585778", "0.5847371", "0.58325535", "0.58182263", "0.5791185", "0.5782068", "0.576098", "0.5759699", "0.5731579", "0.5731077", "0.57164955", "0.5713108", "0.5697223", "0.5689423"...
0.62920344
2
Make sure email not in use.
def validate_email(form, field): if User.query.filter_by(email=form.email.data).first(): form.email.errors.append( "Email already associated with account!") raise ValidationError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_invalid_email_when_logging_in(self):\n pass", "def clean_email(self):\r\n if User.objects.filter(email__iexact=self.cleaned_data['email']):\r\n raise forms.ValidationError(_(u'This email address is already in use. Please supply a different email address.'))\r\n return sel...
[ "0.7547832", "0.69692755", "0.68943226", "0.68845636", "0.68845636", "0.6878333", "0.6797547", "0.6777223", "0.67052704", "0.66979927", "0.6694335", "0.66453594", "0.66256976", "0.66151065", "0.6599791", "0.6570279", "0.65497637", "0.65465266", "0.6540458", "0.65211236", "0.6...
0.0
-1
Make sure username not in use.
def validate_username(form, field): if User.query.filter_by(username=form.username.data).first(): form.username.errors.append("Username already taken!") raise ValidationError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_auth_none(self, username):\n return AUTH_FAILED", "def clean_username(self):\n username = self.cleaned_data['username']\n\n try:\n User.objects.get(username=username)\n except ObjectDoesNotExist:\n return username\n\n raise forms.ValidationError(...
[ "0.72980964", "0.7277678", "0.71732837", "0.71541303", "0.7144778", "0.7115024", "0.7101641", "0.7087915", "0.7060178", "0.7016285", "0.69974613", "0.69890416", "0.6978878", "0.6956085", "0.6935131", "0.69266754", "0.68790114", "0.6853017", "0.6840044", "0.68063754", "0.68047...
0.6258547
83
Make sure email is not in use unless it's the current user's email.
def validate_email(form, field): user = User.query.filter_by(email=form.email.data).first() if user and not user == g.user: form.email.errors = [ "Email already associated with account!", *form.email.errors ] raise ValidationError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_email(self):\r\n if User.objects.filter(email__iexact=self.cleaned_data['email']):\r\n raise forms.ValidationError(_(u'This email address is already in use. Please supply a different email address.'))\r\n return self.cleaned_data['email']", "def clean_email(self):\n if U...
[ "0.7446851", "0.739905", "0.739905", "0.7380747", "0.73281556", "0.72398597", "0.72120744", "0.72011906", "0.7174148", "0.71672803", "0.7081384", "0.70392203", "0.7017105", "0.6994809", "0.69502664", "0.6879769", "0.6850791", "0.67699957", "0.67592144", "0.6754703", "0.668111...
0.66117746
24
Make sure username is not in use unless it's the current user's username.
def validate_username(form, field): user = User.query.filter_by(username=form.username.data).first() if user and not user == g.user: form.username.errors = [ "Username already taken!", *form.username.errors ] raise ValidationError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_username(self):\n username = self.cleaned_data['username']\n\n try:\n User.objects.get(username=username)\n except ObjectDoesNotExist:\n return username\n\n raise forms.ValidationError('Login is already in use.')", "def clean_username(self):\r\n ...
[ "0.73932433", "0.7269057", "0.7248478", "0.7208094", "0.715533", "0.71511453", "0.70808494", "0.70128983", "0.7008816", "0.69899356", "0.6968489", "0.6933201", "0.69043255", "0.6860258", "0.6844749", "0.6816242", "0.6789844", "0.6788677", "0.6784953", "0.6778212", "0.6778212"...
0.66590476
22
Constraint the output of detector to lie within the image. Also check if the detection is valid by measuring area of BB.
def get_refined_detection(detections, im_shape, conf): refined_detection = [] for dets in detections: score = dets[-1] if score<conf: continue dets = constraint_boxes(dets, im_shape) if check_area(dets, im_shape) is False: continue refined_detectio...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_boundary_boxes(gt_detection_combo):\n found = False\n overlap_threshold = 0.7\n\n for found_box in gt_detection_combo.detected_boxes:\n if overlap_between(gt_detection_combo.gt_box, found_box) > overlap_threshold:\n found = True\n break\n\n assert found is True", ...
[ "0.63479084", "0.62445164", "0.62041825", "0.605389", "0.59362656", "0.59316784", "0.5855736", "0.5836759", "0.58320904", "0.58183193", "0.5813324", "0.58023053", "0.5775182", "0.57734776", "0.5770503", "0.5768477", "0.57378244", "0.56990397", "0.5648787", "0.5648514", "0.563...
0.0
-1
Convert (x_min, y_min, x_max, y_max) to (x_centroid, y_centroid, aspect_ratio, height)
def coord_shift(std_coord): std_coord = np.array(std_coord) x_c, y_c = compute_centroid(std_coord) height = std_coord[3] - std_coord[1] width = std_coord[2] - std_coord[0] aspect_ratio = height/width return np.array([x_c, y_c, aspect_ratio, height])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transform_coords(x, y, w, h, nw, nh):\r\n return ((((x / w) - 0.5) * nw), (((h - y) / h) - 0.5) * nh)", "def normalize_coords(xx, yy, width, height):\n xx = (2.0 / (width - 1.0)) * xx.float() - 1.0\n yy = (2.0 / (height - 1.0)) * yy.float() - 1.0\n return xx, yy", "def _xywh2cs(self, x, y, w, h...
[ "0.6549811", "0.6173128", "0.6143023", "0.61052555", "0.60435134", "0.5976582", "0.5964702", "0.5933406", "0.59303606", "0.59181345", "0.590507", "0.5885561", "0.58818907", "0.58802193", "0.5839666", "0.57727206", "0.5764812", "0.5732082", "0.5715445", "0.5713514", "0.5708426...
0.5307831
58
opposite of `def coord_shift`
def inverse_coord_shift(kalman_coord): x_c, y_c, aspect_ratio, height = kalman_coord[:4] width = height / aspect_ratio x_min = x_c - width / 2 x_max = x_c + width / 2 y_min = y_c - height / 2 y_max = y_c + height / 2 std_coord = np.array([x_min, y_min, x_max, y_max]) return np.int_(np.ro...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_to(self, shift: Move) -> Coordinate:\n if shift.direction == \"U\":\n new_coordinate = Coordinate(x=self.x, y=self.y + shift.dist)\n elif shift.direction == \"D\":\n new_coordinate = Coordinate(x=self.x, y=self.y - shift.dist)\n elif shift.direction == \"L\":\n ...
[ "0.63441014", "0.62020755", "0.61686033", "0.6162898", "0.61144555", "0.607844", "0.6076379", "0.6066273", "0.6032216", "0.6012332", "0.5981737", "0.5956843", "0.58499765", "0.5840761", "0.57823914", "0.5777684", "0.5755403", "0.5743055", "0.57391936", "0.5738413", "0.5735400...
0.56250626
30
Convert (x_centroid, y_centroid, width, height) to (x_min, y_min, x_max, y_max)
def box_from_centroid(boxes): boxes = np.array(boxes) if len(boxes.shape) > 1: mins = boxes[:, 0:2] - boxes[:, 2:4]//2 maxes = boxes[:, 0:2] + boxes[:, 2:4]//2 boxes = np.c_[mins, maxes] else: mins = boxes[0:2] - boxes[2:4]//2 maxes = boxes[0:2] + boxes[2:4]//2 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _xywh2min_max(box):\n x, y, w, h = box\n return np.array([x, y, x+w, y+h])", "def convert_bbox(bbox, width, height):\n min_x, min_y, max_x, max_y = bbox\n # scale X axis\n min_x *= width\n max_x *= width\n # invert Y axis and scale\n min_y = (1 - min_y) * height\n max_y = (1 - max_...
[ "0.69743425", "0.6879865", "0.6665653", "0.6642741", "0.66418016", "0.64907706", "0.63931614", "0.6312063", "0.6281699", "0.6257308", "0.6256554", "0.6223768", "0.6211792", "0.61935616", "0.61682916", "0.6108087", "0.6095347", "0.6067567", "0.6064313", "0.6063418", "0.6047971...
0.5560307
81
This method is used to initialise bounding boxes around initial detection for particles.
def scatter_particles(box, cent_disp=(-3,0,3), max_particles=100): box = np.array(box) init_val = [i for i in combinations_with_replacement(list(cent_disp), 4)] disp_list = [] for k in init_val: for i in permutations(k): disp_list.append(i) unique_disp_list = np.unique(np.array(d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _initial_normal_bbox(self):\n cx = cy = .5\n width = FLAGS.bbox_grid / float(FLAGS.cropbox_grid)\n x1 = cx - width / 2\n x2 = cx + width / 2\n y1 = cy - width / 2\n y2 = cy + width / 2\n return [y1,x1,y2,x2]", "def create_prior_boxes(self):\n # value of...
[ "0.6935602", "0.6608635", "0.66064626", "0.6469737", "0.63891006", "0.63366115", "0.62954956", "0.6258402", "0.62572044", "0.6242446", "0.6229715", "0.61691654", "0.61258924", "0.6112904", "0.610026", "0.6094922", "0.6093308", "0.6046396", "0.6010858", "0.60028255", "0.599828...
0.0
-1
ARCHIVED!!! Test code not using anymore!
def get_neighbour_loc(box, p_noise, min_hw=10, h_variance=0.25, ar_range=(0.7, 1.4), max_particles=100): box = np.array(box) final_box = [] x_c, y_c = compute_centroid(box) h,w = box[2:4] - box[0:2] h_min = max(min_hw, h-h*h_variance) h_max = h+h*h_variance p_noise = i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_4_4_1_1(self):\n pass", "def _test(self):", "def _test(self):", "def _test(self):", "def _test(self):", "def _test(self):", "def _test(self):\n pass", "def _test(self):\n pass", "def _test(self):\n pass", "def unitary_test():", "def test(self):\n pass...
[ "0.7265025", "0.70079964", "0.70079964", "0.70079964", "0.70079964", "0.70079964", "0.6839366", "0.6839366", "0.6839366", "0.67159957", "0.6635851", "0.6512066", "0.6482012", "0.6477105", "0.6477105", "0.64568764", "0.64359695", "0.6346702", "0.6346702", "0.6346105", "0.62854...
0.0
-1
Illuminance and Gamma invariant HSV
def compute_new_hsv(im): eps = 1e-10 r,g,b = np.array(cv2.split(im)) + eps traditional_hsv = cv2.cvtColor(im, cv2.COLOR_RGB2HSV) numerator = np.log(r) - np.log(g) denominator = np.log(r) + np.log(g) - 2*np.log(b) + eps new_hue = np.clip(np.round(numerator/denominator).astype(np.uint8), 0, 180) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hsv(img):\n\tif img is None:\n\t\tprint \"Img is None\"\n\t\tsys.exit()\n\tif len(img.shape) > 2:\n\t\treturn cv2.cvtColor(img, cv2.COLOR_BGR2HSV)\n\treturn None", "def applyHSV(img):\n\treturn applyColorMap(img, \"hsv\")", "def rgb_to_hsv(x):\n # separating channels\n R = x[:,:,0]\n G = x[:,:,1]\...
[ "0.6549909", "0.6278752", "0.61685187", "0.61676866", "0.61129785", "0.60947835", "0.6063609", "0.60199535", "0.60035217", "0.5999966", "0.59681344", "0.596583", "0.5963666", "0.5957139", "0.5953068", "0.59217805", "0.5900227", "0.5840088", "0.5821216", "0.58200157", "0.58166...
0.6006632
8
Check if Public box has Y coordinate > head box's
def check_yposition(public_box, head_box): # Higher Y centroid condition h_centroid = compute_centroid(head_box) box_centroid = compute_centroid(public_box) if box_centroid[1] > h_centroid[1]: return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def in_box(coords, box):\n\tif box[0][0] < coords[0] < box[1][0] and box[1][1] < coords[1] < box[0][1]:\n\t\treturn True\n\treturn False", "def check():\n mouse = pygame.mouse.get_pos()\n\n # mouse[0] = x-coordinate of mouse position.\n # mouse[1] = y-coordinate of mouse position.\n if box1.x + box1....
[ "0.68767154", "0.6867427", "0.6867155", "0.68380576", "0.67364043", "0.6676998", "0.65949243", "0.6590243", "0.659016", "0.65420324", "0.6540078", "0.6508726", "0.64178467", "0.64138055", "0.63922703", "0.636486", "0.63461787", "0.6325837", "0.62986743", "0.6255579", "0.62415...
0.84469277
0
Warping position for camera motion compensation
def warp_pos(pos, warp_matrix): import torch p1 = torch.Tensor([pos[0], pos[1], 1]).view(3, 1) p2 = torch.Tensor([pos[2], pos[3], 1]).view(3, 1) p1_n = torch.mm(warp_matrix, p1).view(1, 2) p2_n = torch.mm(warp_matrix, p2).view(1, 2) return torch.cat((p1_n, p2_n), 1).view(1, -1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def adjust_camera(self):\n pose = deepcopy(self.data['poses']['marker']) # PoseStamped()\n eye_pose = deepcopy(pose)\n eye_pose.pose.position.x += 0.60\n eye_pose.pose.position.z += 0.20\n focus_pose = PoseStamped()\n base_eye_pose = PoseStamped()\n\n try:\n ...
[ "0.6999849", "0.6293164", "0.6187928", "0.61723226", "0.6152385", "0.6121566", "0.6087216", "0.6058499", "0.5968891", "0.5954549", "0.59318614", "0.59167844", "0.58837736", "0.58698213", "0.58682966", "0.5845259", "0.5835952", "0.5831883", "0.5797068", "0.57966304", "0.573792...
0.0
-1
Calculates the attribustes x_axis and y_axis of the image. These are the spatial axes, and \ can be used to find the spatial location of a pixel and are used in the plotting functions. If one wants to alter these axis, one can do this manually by running image.x_axis = ..., \ and image.y_axis = .... Returns None.
def calc_axes(self): y_axis = np.linspace(0, self.image_shape[0] - 1, self.image_shape[0]) x_axis = np.linspace(0, self.image_shape[1] - 1, self.image_shape[1]) if hasattr(self, 'pixelsize'): y_axis *= self.pixelsize[0] x_axis *= self.pixelsize[1] return x_axis, y...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc_axes(self):\n self.y_axis = np.linspace(0, self.image_shape[0] - 1, self.image_shape[0])\n self.x_axis = np.linspace(0, self.image_shape[1] - 1, self.image_shape[1])\n if hasattr(self, 'pixelsize'):\n self.y_axis *= self.pixelsize[0]\n self.x_axis *= self.pixelsi...
[ "0.75874233", "0.5822837", "0.5817969", "0.57584405", "0.57190233", "0.57038426", "0.5673402", "0.5554586", "0.54701406", "0.544219", "0.54328954", "0.5411503", "0.5408289", "0.5349925", "0.5347552", "0.5324715", "0.5292402", "0.5288886", "0.52761215", "0.52639616", "0.524531...
0.7306818
1
Generates ticks of (spatial) x and y axis for plotting perposes.
def get_ticks(self, sig=2, n_tick=10): fmt = '%.' + str(sig) + 'g' xlabels = np.zeros(self.x_axis.shape, dtype=object) xlabels[:] = "" each_n_pixels = math.floor(len(xlabels) / n_tick) for i in range(len(xlabels)): if i % each_n_pixels == 0: xlabels[i]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __draw_xaxis(self):\n self.ax.set_xlim(self.xlims)\n # put x ticks on top\n xticks = [1]\n xticks.extend(range(5, self.xmax+5, 5))\n fs = self.settings.rcParams[\"axes.labelsize\"] if self.settings.otherParams[\n \"xlabel.fontsize\"] is None else self.settings.othe...
[ "0.685796", "0.683631", "0.6493824", "0.6489116", "0.6280993", "0.6253217", "0.6213189", "0.62066805", "0.61965775", "0.6185663", "0.6183213", "0.6158319", "0.6151242", "0.61462426", "0.614514", "0.60663545", "0.6061497", "0.6052717", "0.6010763", "0.6005849", "0.59700614", ...
0.5936412
21
returns length of spectra, i.e. num energy loss bins
def l(self): return self.data.shape[2]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def len(self):\n return len(self.spectrae)", "def n_spectra(self):\n return np.product(self.image_shape)", "def get_length(self):\r\n check_mixer()\r\n frequency, format, channels = (ffi.new('int*'), ffi.new('uint16_t*'),\r\n ffi.new('int*'))\r\...
[ "0.70883423", "0.6979756", "0.68218476", "0.6779714", "0.6756354", "0.66088486", "0.66071105", "0.6516876", "0.6474125", "0.6472874", "0.64442796", "0.64272666", "0.64053273", "0.6404178", "0.6366925", "0.63087887", "0.63034546", "0.63007635", "0.62594527", "0.6221866", "0.62...
0.0
-1
return 2Dshape of spectral image
def image_shape(self): return self.data.shape[:2]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shape(self):\n return self._spectral_shape", "def n_spectra(self):\n return np.product(self.image_shape)", "def get_shape(self):\n if not self.channels_first:\n return [None] + self.w + [self.numoffeatures]\n else:\n return [None] + [self.numoffeatures] + s...
[ "0.7009999", "0.6421456", "0.64017713", "0.62458396", "0.622019", "0.62103504", "0.61071396", "0.6098754", "0.60419506", "0.59981734", "0.5972207", "0.59172094", "0.5889621", "0.5889621", "0.57486176", "0.5729457", "0.5722359", "0.57197887", "0.56805056", "0.56609035", "0.565...
0.603204
10
Return True if each character in pattern is found in order in instring.
def fuzzy_match_simple(pattern, instring): p_idx, s_idx, p_len, s_len = 0, 0, len(pattern), len(instring) while (p_idx != p_len) and (s_idx != s_len): if pattern[p_idx].lower() == instring[s_idx].lower(): p_idx += 1 s_idx += 1 return p_len != 0 and s_len != 0 and p_idx == p_len
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fn(query):\n i = 0\n for x in query:\n if i < len(pattern) and x == pattern[i]: i += 1\n elif x.isupper(): return False\n return i == len(pattern)", "def search_string(self, pattern):\n if not pattern:\n return True\n\n l...
[ "0.6986734", "0.63803357", "0.6278569", "0.6240252", "0.6181874", "0.6150704", "0.61025155", "0.6093655", "0.60356295", "0.60251266", "0.6010011", "0.5930002", "0.58766013", "0.58752376", "0.58708507", "0.58647394", "0.5857319", "0.58516085", "0.58455545", "0.5821804", "0.579...
0.68680596
1
Return match boolean and match score.
def fuzzy_match(pattern, instring, adj_bonus=5, sep_bonus=10, camel_bonus=10, lead_penalty=-3, max_lead_penalty=-9, unmatched_penalty=-1): score, p_idx, s_idx, p_len, s_len = 0, 0, 0, len(pattern), len(instring) prev_match, prev_lower = False, False prev_sep = True # so that matching first ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def match_score(self):\n return self._match_score", "def matchscore(self):\n print(self.team1.name + \" \" + str(self.team1score) + \" - \" + str(self.team2score) + \" \" + self.team2.name)", "def _exact_match_score_(prediction, ground_truth):\n return _normalize_answer(prediction) == _normalize...
[ "0.77264833", "0.6901766", "0.6428443", "0.6412519", "0.6410612", "0.6404016", "0.6386512", "0.63160306", "0.6315266", "0.6290225", "0.62550575", "0.6250385", "0.6244538", "0.62204444", "0.62137514", "0.61782926", "0.61713946", "0.6165614", "0.6165092", "0.61639434", "0.61604...
0.0
-1
The mocked value when mocked_translate is called
def mocked_translate(lur): lur = { "success": {"total": 1}, "contents": { "translated": "Hi,Zaafira, I am", "text": "Hi, I am Zaafira", "translation": "yoda", }, } json_response_mock = mock.Mock() json_response_mock.json.return_value = lur ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_translation(self):", "def test_simple_translation_using_get(self):\n pass", "def translate():\n pass", "def translate(self):\n pass", "def test_translation_smoke():\n english_to_morse = get_translator(\"english\", \"morse\")\n morse_to_english = get_translator(\"morse\", ...
[ "0.71579444", "0.6881472", "0.6809995", "0.6740325", "0.6596415", "0.65692574", "0.63575834", "0.6336652", "0.6304506", "0.62915236", "0.6259732", "0.62328964", "0.6221216", "0.6167749", "0.6110162", "0.6085425", "0.6049397", "0.6040752", "0.60180646", "0.5991216", "0.5950553...
0.7410818
0
The value when mocked_pun is called
def mocked_pun(lur): lur = { "error": "false", "category": "Pun", "type": "single", "joke": "How do you make holy water? You freeze it and drill holes in it.", "flags": { "nsfw": "false", "religious": "true", "political": "false", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def native_value(self) -> int | float | None:\n if unit := self.entity_description.native_unit_of_measurement:\n with suppress(KeyError):\n return self._gateway.data[self._mtu][unit]\n return None", "def __call__(self):\n return self.value", "def native_value(self...
[ "0.62340176", "0.6050914", "0.6029403", "0.5947733", "0.5904513", "0.5900864", "0.5865688", "0.58591336", "0.58540183", "0.58415765", "0.5830056", "0.5816821", "0.58057034", "0.5774541", "0.5767923", "0.57539093", "0.57487166", "0.57286894", "0.57249993", "0.57249993", "0.569...
0.56409425
27
Mocks the requests.get method in app.py with a given translate
def test_parse_message_success(self): for test_case in self.success_test_params: expected = test_case[KEY_EXPECTED] with mock.patch("requests.get", mocked_translate): bring_message = app.on_new_address(test_case) self.assertEqual(expected, bring_message)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_translate(self):\n result = self.app.get('/translate?text=Something')\n self.assertEqual(result.status_code, 200)\n\n result = self.app.get('/translate')\n self.assertEqual(result.status_code, 500)", "def test_simple_translation_using_get(self):\n pass", "def mocked_...
[ "0.7905929", "0.6907052", "0.6885581", "0.65317535", "0.62674296", "0.61959946", "0.6195798", "0.61866117", "0.6023579", "0.6014453", "0.6010995", "0.60024124", "0.59135413", "0.59132636", "0.5901935", "0.5898458", "0.58547974", "0.5806662", "0.5758713", "0.57383454", "0.5732...
0.535832
69
Mocks the requests.get method in app.py with a given pun
def test_parse_message_pun(self): for test_case in self.success_test_pun: expected = test_case[KEY_EXPECTED] with mock.patch("requests.get", mocked_pun): bring_message = app.on_new_address(test_case) self.assertEqual(expected, bring_message)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get(self):\n client = RestClient(host=self.host, username='')\n rest_url = 'some/url/'\n \n # Mock good response\n with responses.RequestsMock() as rsps:\n rsps.add(responses.GET, f'{self.host}/{rest_url}', status=200,\n json={'value':\"goo...
[ "0.69669604", "0.67627823", "0.6592265", "0.65826535", "0.6497083", "0.64620715", "0.6438313", "0.6414112", "0.6376383", "0.636982", "0.63449466", "0.63231426", "0.63054174", "0.6286555", "0.61875427", "0.6182093", "0.6159612", "0.61394614", "0.60945237", "0.609397", "0.60508...
0.0
-1
Mocks the google login in app.py
def test_parse_message_google_login(self): for test_case in self.success_test_google_login: expected = test_case[KEY_EXPECTED] google_obj = app.on_new_google_user(test_case[KEY_INPUT]) self.assertEqual(expected, google_obj)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def google_login():\n # If a logged-in user goes to \"/google-login\", that user won't need to\n # log-in again, and automatically go back to the home page.\n if current_user.is_authenticated:\n return redirect(url_for('main.home'))\n\n # Google Sign-In constants\n GOOGLE_APP_CLIENT_ID = os.e...
[ "0.6950064", "0.6899369", "0.6833176", "0.67480683", "0.668549", "0.6654326", "0.662798", "0.6426083", "0.6347506", "0.63022953", "0.62749", "0.624253", "0.62268525", "0.6206372", "0.61844385", "0.61392105", "0.61314225", "0.6110542", "0.6109147", "0.6103422", "0.6095651", ...
0.6566431
7
Mocks the requests.get method in app.py
def test_parse_message_failure_translation(self): for test_case in self.failure_test_params: expected = test_case[KEY_EXPECTED] with mock.patch("requests.get", mocked_translate): bring_message = app.on_new_address(test_case) self.assertNotEqual(expected, bring_me...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get(self):\n client = RestClient(host=self.host, username='')\n rest_url = 'some/url/'\n \n # Mock good response\n with responses.RequestsMock() as rsps:\n rsps.add(responses.GET, f'{self.host}/{rest_url}', status=200,\n json={'value':\"goo...
[ "0.757244", "0.7426668", "0.7414589", "0.72550845", "0.7225032", "0.7213081", "0.70949316", "0.704562", "0.7016927", "0.6952909", "0.6937874", "0.6872953", "0.68185633", "0.6812734", "0.6795233", "0.6713535", "0.67129856", "0.671215", "0.6706005", "0.6678081", "0.66740376", ...
0.0
-1
Mocks the connect method in app.py
def test_parse_message_failure_connect(self): for test_case in self.failure_test_params_wrong_connect: expected = test_case[KEY_EXPECTED] mock_connect = app.on_connect() self.assertNotEqual(expected, mock_connect)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_connection(self):\n self._bind_to_service()", "def test_connect_opens_connection(self):\n\n mock_connector = MagicMock()\n database = Database()\n\n database.connect(connector_impl=mock_connector)\n\n self.assertTrue(mock_connector.connect.called)", "def test_connect(self):\n ...
[ "0.6830517", "0.6756951", "0.6701353", "0.656319", "0.644824", "0.6433424", "0.64212114", "0.64014095", "0.63124925", "0.62617815", "0.6254651", "0.62454945", "0.6245166", "0.6238087", "0.6238087", "0.6233201", "0.6230148", "0.6220331", "0.62118423", "0.6202078", "0.61952484"...
0.5798926
80
Mocks the connect method in app.py
def test_parse_message_success_connect(self, mock_connect): for test_case in self.success_test_params_connect: expected = test_case[KEY_EXPECTED] mock_connect = app.on_connect() self.assertNotEqual(expected, mock_connect)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_connection(self):\n self._bind_to_service()", "def test_connect_opens_connection(self):\n\n mock_connector = MagicMock()\n database = Database()\n\n database.connect(connector_impl=mock_connector)\n\n self.assertTrue(mock_connector.connect.called)", "def test_connect(self):\n ...
[ "0.68321073", "0.67585236", "0.6702276", "0.6563183", "0.64499116", "0.64343023", "0.64209443", "0.6402553", "0.63121194", "0.62629735", "0.6255002", "0.6245169", "0.624482", "0.62380844", "0.62380844", "0.62337166", "0.62314856", "0.6221396", "0.6212393", "0.62029994", "0.61...
0.5937141
62
Mocks the disconnect method in app.py
def test_parse_message_success_disconnect(self): for test_case in self.success_test_params_disconnect: expected = test_case[KEY_EXPECTED] mock_disconnect = app.on_disconnect() self.assertEqual(expected, mock_disconnect)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disconnect(self) -> None:\n ...", "def disconnect(self):", "def disconnect(self):\n pass", "def disconnect(self):\n pass", "def disconnect(self):\n pass", "def disconnect(self):\n pass", "def disconnect(self):\n pass", "async def test_disconnect(self):\n ...
[ "0.7235118", "0.7185853", "0.6926002", "0.6926002", "0.6926002", "0.6926002", "0.6926002", "0.69075775", "0.68698186", "0.68698186", "0.6831722", "0.6776029", "0.6724207", "0.6720808", "0.6720613", "0.66972715", "0.66972715", "0.6688903", "0.6668982", "0.6634627", "0.66278213...
0.61994046
37
Mocks the disconnect method in app.py
def test_parse_message_failure_disconnect(self, mock_disconnect): for test_case in self.failure_test_params_disconnect: expected = test_case[KEY_EXPECTED] mock_disconnect = app.on_disconnect() self.assertNotEqual(expected, mock_disconnect)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disconnect(self) -> None:\n ...", "def disconnect(self):", "def disconnect(self):\n pass", "def disconnect(self):\n pass", "def disconnect(self):\n pass", "def disconnect(self):\n pass", "def disconnect(self):\n pass", "async def test_disconnect(self):\n ...
[ "0.7235118", "0.7185853", "0.6926002", "0.6926002", "0.6926002", "0.6926002", "0.6926002", "0.69075775", "0.68698186", "0.68698186", "0.6831722", "0.6776029", "0.6724207", "0.6720808", "0.6720613", "0.66972715", "0.66972715", "0.6688903", "0.6668982", "0.6634627", "0.66278213...
0.61715174
38
Mocks the index method in app.py
def test_parse_message_success_load_page(self): for test_case in self.success_test_params_load_page: expected = test_case[KEY_EXPECTED] try: app.index() bring_message = "finishedLoading" except: bring_message = "finishedLoading"...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_index(self):\n tester = app.test_client(self) # You can use self.app in place of tester\n response = tester.get('/', content_type='html/text')\n self.assertEqual(response.status_code, 200)", "def test_index_view(self):\n response = self.client.get(url_for('main.index')...
[ "0.756429", "0.7450295", "0.7273167", "0.72171074", "0.713972", "0.70764107", "0.7024345", "0.700154", "0.6995603", "0.6955005", "0.69039184", "0.68204653", "0.6817888", "0.67863053", "0.6782207", "0.6770325", "0.6768245", "0.6750743", "0.67223954", "0.6701688", "0.66842735",...
0.0
-1
Mocks the index method in app.py
def test_parse_message_failure_load_page(self): for test_case in self.failure_test_params_load_page: expected = test_case[KEY_EXPECTED] try: app.index() bring_message = "finishedLoading" except: bring_message = "notfinishedLoadi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_index(self):\n tester = app.test_client(self) # You can use self.app in place of tester\n response = tester.get('/', content_type='html/text')\n self.assertEqual(response.status_code, 200)", "def test_index_view(self):\n response = self.client.get(url_for('main.index')...
[ "0.7563205", "0.7449145", "0.727243", "0.72170496", "0.7139567", "0.70759034", "0.70236087", "0.700091", "0.6994253", "0.6953592", "0.69042593", "0.68208843", "0.681823", "0.6785938", "0.67808765", "0.67698324", "0.676912", "0.67513835", "0.6721882", "0.6701293", "0.6684354",...
0.0
-1
Make the matrix look pretty
def pretty_print(self): out = "" rows,cols = self.matrix.shape for row in xrange(0,rows): out += "[" for col in xrange(0,cols): out += "%+0.2f "%self.matrix[row][col] out += "]\n" return out
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __repr__(self):\n return self.matrix and '\\n'.join([\"|%s|\" % s for s in [' '.join([\"%-6.3f\" % e for e in w]) for w in self.matrix]]) or \"<pusta macierz>\"", "def print_matrix_on_screen(matrix, width=5):\n for row in matrix:\n print(''.join(['{0:>{w}}'.format(item, w=width) for item in ...
[ "0.71262836", "0.69080645", "0.6853885", "0.66841817", "0.66777855", "0.6670398", "0.6620714", "0.65799606", "0.6577681", "0.65713257", "0.65455055", "0.6541483", "0.64739263", "0.64697397", "0.64694947", "0.64253175", "0.6413195", "0.6405803", "0.6385066", "0.6358517", "0.63...
0.7403584
0
Override the `create` function to add extra functinality.
def create(self, validated_data): # STEP 1 - Get validated POST data. task_item = validated_data.get('task_item', None) number_of_visits = validated_data.get('number_of_visits', 0) # Go through the number of visits and create a new WorkOrder per visit. for visit in range(0, numb...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create(*args):", "def creates(f):\n f.creates = True\n return f", "def create(self, *args, **kwargs):\n pass", "def Create(self):\n raise NotImplementedError()", "def create():\n pass", "def _Create(self):\n pass", "def addOnCreate(call, args=(), kwargs={}, nodeClass='*'):\n ...
[ "0.6564043", "0.6538325", "0.6369618", "0.6267383", "0.62032413", "0.61438775", "0.6055754", "0.602165", "0.602165", "0.599945", "0.5951197", "0.59097826", "0.5909072", "0.5906299", "0.5906299", "0.5906299", "0.5906299", "0.5906299", "0.5906299", "0.5906299", "0.5906299", "...
0.0
-1
tearDown destroys any existing objects and processes
def tearDown(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tearDown(self):\r\n testing.tearDown()", "def tearDown(self):\n self.tmp.cleanup()", "def tearDown(self):\n util.delete_mocks()", "def tearDown(self):\n util.delete_mocks()", "def tearDown(self):\n util.delete_mocks()", "def tearDown(self):\n util.delete_mock...
[ "0.8303317", "0.82350826", "0.82248276", "0.82248276", "0.82248276", "0.82248276", "0.82248276", "0.82248276", "0.8189078", "0.81885344", "0.8152555", "0.8152555", "0.8152555", "0.8152002", "0.8152002", "0.8152002", "0.8139147", "0.8139147", "0.8139147", "0.8132551", "0.81095...
0.0
-1
Tests if Rectangle inherits Base.
def test_inheritance(self): self.assertTrue(issubclass(Rectangle, Base))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_0_is_Rectangle_class(self):\r\n self.assertTrue(issubclass(type(self.S0), Rectangle) and\r\n type(self.S0) != Rectangle)", "def test_SquareinheritancefromRectangle(self):\n Square.reset_objects()\n self.assertEqual(issubclass(Square, Rectangle), True)", "def...
[ "0.7410984", "0.73879737", "0.71916723", "0.6733655", "0.64805657", "0.6343817", "0.61637074", "0.6104673", "0.59940827", "0.590253", "0.58446425", "0.5831769", "0.57768166", "0.5750307", "0.5746952", "0.574595", "0.57251126", "0.571214", "0.5711103", "0.56737524", "0.5669128...
0.86079776
0
Tests if id is inherited from Base.
def test_id_inherited(self): Base._Base__nb_objects = 98 r = Rectangle(2, 4) self.assertEqual(r.id, 99)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_baseid(self):\n self.assertEqual(str, type(BaseModel().id))", "def _has_base(cls, base):\n if cls is base:\n return True\n elif cls is None:\n return False\n try:\n for bs in cls.__bases__:\n if _has_base(bs, base):\n return True\n except...
[ "0.7071606", "0.68614566", "0.6663652", "0.6555642", "0.65274465", "0.6456492", "0.64129174", "0.6386005", "0.63816565", "0.6371645", "0.63647985", "0.6364053", "0.6361062", "0.6350097", "0.63280857", "0.6287805", "0.6272882", "0.6255194", "0.6255194", "0.6244298", "0.6238731...
0.6967543
1
Tests area() method signature.
def test_area_no_args(self): r = Rectangle(5, 6) with self.assertRaises(TypeError) as e: Rectangle.area() s = "area() missing 1 required positional argument: 'self'" self.assertEqual(str(e.exception), s)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def area(self):\n raise Exception('area() is not implemented')", "def area(self):\n raise Exception('area() is not implemented')", "def area(self):\n raise Exception(\"area() is not implemented\")", "def area(self):\n raise Exception(\"area() is not implemented\")", "def test_ar...
[ "0.7761191", "0.7761191", "0.76756704", "0.76756704", "0.7654037", "0.76147753", "0.75531185", "0.75346404", "0.74885106", "0.74715465", "0.7454449", "0.7454449", "0.744922", "0.74276274", "0.7393726", "0.7391685", "0.73708904", "0.7359716", "0.73506284", "0.7303255", "0.7282...
0.62658966
53
Tests area() method compuation.
def test_area(self): r = Rectangle(5, 6) self.assertEqual(r.area(), 30) w = randrange(10) + 1 h = randrange(10) + 1 r.width = w r.height = h self.assertEqual(r.area(), w * h) w = randrange(10) + 1 h = randrange(10) + 1 r = Rectangle(w, h, 7...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_area(self):\n r1 = Rectangle(3, 2)\n self.assertEqual(r1.area(), 6)\n\n r2 = Rectangle(2, 10)\n self.assertEqual(r2.area(), 20)\n\n r3 = Rectangle(10, 10)\n self.assertEqual(r3.area(), 100)", "def test_area1(self):\n r1 = Rectangle(3, 2)\n self.ass...
[ "0.83019114", "0.8017923", "0.80146426", "0.8005159", "0.7995337", "0.7947589", "0.79453653", "0.79390806", "0.79390806", "0.7928512", "0.78742164", "0.78742164", "0.7852106", "0.78420675", "0.7834758", "0.77837646", "0.7741229", "0.7740818", "0.7740818", "0.76975816", "0.763...
0.7638582
20
Tests display() method signature.
def test_display_no_args(self): r = Rectangle(9, 8) with self.assertRaises(TypeError) as e: Rectangle.display() s = "display() missing 1 required positional argument: 'self'" self.assertEqual(str(e.exception), s)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_display__method(self):\n Rectangle.reset_objects()\n s1 = Square(5)\n f = io.StringIO()\n with contextlib.redirect_stdout(f):\n s1.display()\n self.assertEqual(f.getvalue(), \"#####\\n#####\\n#####\\n#####\\n#####\\n\")", "def test_display_method4(self):\n ...
[ "0.72286975", "0.7220992", "0.7171832", "0.71217597", "0.71199435", "0.7091923", "0.7068505", "0.7067569", "0.705811", "0.6985495", "0.6922923", "0.6909551", "0.6879732", "0.6846518", "0.6839326", "0.6823341", "0.6788506", "0.67868525", "0.67603636", "0.6748174", "0.6736388",...
0.645122
33
Tests display() method output.
def test_display_simple(self): r = Rectangle(1, 1) f = io.StringIO() with redirect_stdout(f): r.display() s = "#\n" self.assertEqual(f.getvalue(), s) r.width = 2 r.height = 2 f = io.StringIO() with redirect_stdout(f): r.disp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_display_method1(self):\n capturedOutput = io.StringIO()\n sys.stdout = capturedOutput\n r1 = Rectangle(4, 6)\n r1.display()\n sys.stdout = sys.__stdout__\n desired = '####\\n####\\n####\\n####\\n####\\n####\\n'\n self.assertEqual(capturedOutput.getvalue(), ...
[ "0.7984882", "0.7975976", "0.7949459", "0.7943532", "0.79417163", "0.7919054", "0.7876275", "0.78596795", "0.7641263", "0.7537544", "0.7532322", "0.74249905", "0.7285819", "0.70703816", "0.7018516", "0.696649", "0.69599384", "0.6948042", "0.69043356", "0.68679106", "0.6840440...
0.7197419
13
Tests __str__() method signature.
def test_K_str_no_args(self): r = Rectangle(5, 2) with self.assertRaises(TypeError) as e: Rectangle.__str__() s = "__str__() missing 1 required positional argument: 'self'" self.assertEqual(str(e.exception), s)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_str_method(self):\n s1 = Square(4, 6, 2, 12)\n self.assertEqual(s1.__str__(), '[Square] (12) 6/2 - 4')", "def test_strmethod(self):\n b1 = BaseModel()\n self.assertEqual(type(str(b1)), str)", "def test_str_method(self):\n b1 = BaseModel()\n b1printed =...
[ "0.7903349", "0.7795397", "0.7790063", "0.7765625", "0.774312", "0.75303704", "0.74712944", "0.74447334", "0.7424896", "0.735923", "0.735923", "0.735923", "0.735923", "0.7346667", "0.73428327", "0.73418957", "0.7332717", "0.7289573", "0.7279956", "0.7278092", "0.7265257", "...
0.7410371
9
Tests __str__() method return.
def test_K_str(self): r = Rectangle(5, 2) s = '[Rectangle] (1) 0/0 - 5/2' self.assertEqual(str(r), s) r = Rectangle(1, 1, 1) s = '[Rectangle] (2) 1/0 - 1/1' self.assertEqual(str(r), s) r = Rectangle(3, 4, 5, 6) s = '[Rectangle] (3) 5/6 - 3/4' self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_str_method(self):\n b1 = BaseModel()\n b1printed = b1.__str__()\n self.assertEqual(b1printed,\n \"[BaseModel] ({}) {}\".format(b1.id, b1.__dict__))", "def test_str_magic_method(self):\n correct_output = \"[User] ({}) {}\".format(\n self.user...
[ "0.8076664", "0.7979401", "0.78803456", "0.7769605", "0.7743831", "0.77330804", "0.7694057", "0.7694057", "0.7666207", "0.76300365", "0.76118594", "0.76118594", "0.76118594", "0.76118594", "0.75641793", "0.7534076", "0.7477838", "0.7465533", "0.7428464", "0.7426698", "0.74242...
0.0
-1
Tests update() postional args.
def test_update_args(self): r = Rectangle(5, 2) d = r.__dict__.copy() r.update(10) d["id"] = 10 self.assertEqual(r.__dict__, d) r.update(10, 5) d["_Rectangle__width"] = 5 self.assertEqual(r.__dict__, d) r.update(10, 5, 17) d["_Rectangle_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_update(self):\n pass", "def test_update(self):\n pass", "def test_update(self):\n pass", "def update(*args):", "def test_update_case(self):\n pass", "def test_update(self):\n # this is tested graphically, as it is UI\n pass", "def test_21_update_args(s...
[ "0.78976095", "0.78976095", "0.78976095", "0.7831367", "0.77857095", "0.7644135", "0.7635107", "0.7419102", "0.7413974", "0.7362397", "0.73514724", "0.73471075", "0.7343083", "0.7343083", "0.7343083", "0.7343083", "0.7343083", "0.7343083", "0.7310264", "0.72708553", "0.715508...
0.72341317
20
Tests update() positional arg bad values.
def test_update_args_bad(self): r = Rectangle(5, 2) d = r.__dict__.copy() r.update(10) d["id"] = 10 self.assertEqual(r.__dict__, d) with self.assertRaises(ValueError) as e: r.update(10, -5) s = "width must be > 0" self.assertEqual(str(e.excep...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_invalid_update_kwarg(self):\r\n m0 = TestUpdateModel.create(count=5, text='monkey')\r\n with self.assertRaises(ValidationError):\r\n m0.update(numbers=20)", "def test_invalid_update_kwarg(self):\n m0 = TestUpdateModel.create(count=5, text='monkey')\n with self.asse...
[ "0.75484985", "0.7544116", "0.7184915", "0.7156995", "0.7053883", "0.7009638", "0.6897584", "0.6860641", "0.66748905", "0.6668533", "0.6648059", "0.65885854", "0.65509695", "0.6534375", "0.6524069", "0.64533055", "0.6448236", "0.64405257", "0.64405257", "0.64405257", "0.64384...
0.7652585
0
Tests update() keyword args.
def test_update_kwargs(self): r = Rectangle(5, 2) d = r.__dict__.copy() r.update(id=10) d["id"] = 10 self.assertEqual(r.__dict__, d) r.update(width=5) d["_Rectangle__width"] = 5 self.assertEqual(r.__dict__, d) r.update(height=17) d["_Rec...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(*args):", "def test_update(self):\n pass", "def test_update(self):\n pass", "def test_update(self):\n pass", "def test_update_case(self):\n pass", "def test_22_update_kwargs(self):\n r = Rectangle(10, 10, 10, 10, 1)\n r.update(height=1)\n self.a...
[ "0.7933049", "0.7655731", "0.7655731", "0.7655731", "0.7525596", "0.7503009", "0.74636483", "0.74636483", "0.74636483", "0.74636483", "0.74636483", "0.74636483", "0.7429537", "0.73988676", "0.73822886", "0.727029", "0.7252961", "0.71389437", "0.7127599", "0.7118577", "0.70688...
0.65902525
48
Tests update() keyword args.
def test_update_kwargs_2(self): r = Rectangle(5, 2) d = r.__dict__.copy() r.update(id=10) d["id"] = 10 self.assertEqual(r.__dict__, d) r.update(id=10, width=5) d["_Rectangle__width"] = 5 self.assertEqual(r.__dict__, d) r.update(id=10, width=5, h...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(*args):", "def test_update(self):\n pass", "def test_update(self):\n pass", "def test_update(self):\n pass", "def test_update_case(self):\n pass", "def test_22_update_kwargs(self):\n r = Rectangle(10, 10, 10, 10, 1)\n r.update(height=1)\n self.a...
[ "0.7933049", "0.7655731", "0.7655731", "0.7655731", "0.7525596", "0.7503009", "0.74636483", "0.74636483", "0.74636483", "0.74636483", "0.74636483", "0.74636483", "0.7429537", "0.73988676", "0.73822886", "0.727029", "0.7252961", "0.71389437", "0.7127599", "0.7118577", "0.70688...
0.63131505
70
Fetch public transport stations.
def fetch_public_transport(lat, lon, radius, results=10): headers = {'X-Identifier': 'olli-simulation'} params = {'latitude': lat, 'longitude': lon, 'distance': radius, 'results': results} response = requests.get(url=BASE_URL, params=params, headers=headers) return response.json()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stations():\n\n return station_list", "def get_stations(self):\n return self.__request('stations')['stations']", "async def _get_stations_remote() -> List[WeatherStation]:\n LOGGER.info('Using WFWX to retrieve station list')\n async with ClientSession() as session:\n # Get the authen...
[ "0.652366", "0.64384484", "0.6400441", "0.63273543", "0.60794353", "0.6060445", "0.6023141", "0.5923451", "0.591057", "0.58895737", "0.58801377", "0.58708596", "0.58183354", "0.57893187", "0.5763391", "0.5755471", "0.5719387", "0.5708214", "0.56968224", "0.56882566", "0.56855...
0.6247813
4
Returns a protobuf serialization of self. As a requirement of all objects which inherit from Serializable, this method transforms the current object into the corresponding Protobuf object so that it can be further serialized.
def _object2proto(self) -> Metadata_PB: return Metadata_PB( name=self.name, id=serialize(self.id), node=serialize(self.node) )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def serialize(self) -> typing.Any:\n return self._serialize(self.__dict__)", "def serialize(self) -> bytes:\n return pickle.dumps(self)", "def serialize(self):\n raise NotImplementedError(\n \"Subclasses of Serializable must implement serialize\"\n )", "def _serialize(\...
[ "0.7394982", "0.7394048", "0.7250269", "0.7047218", "0.70303553", "0.70303553", "0.70303553", "0.7026158", "0.69605255", "0.69605255", "0.69462675", "0.6899246", "0.687692", "0.68090254", "0.6795104", "0.6707859", "0.66748744", "0.66719115", "0.66151845", "0.66151845", "0.661...
0.67812586
15
Creates a ObjectWithID from a protobuf As a requirement of all objects which inherit from Serializable, this method transforms a protobuf object into an instance of this class.
def _proto2object(proto: Metadata_PB) -> "Metadata": return Metadata( id=validate_type(_deserialize(blob=proto.id), UID, optional=True), name=proto.name, node=validate_type(_deserialize(blob=proto.node), Location), )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _proto2object(\n proto: CreateGroupMessage_PB,\n ) -> \"CreateGroupMessage\":\n\n return CreateGroupMessage(\n msg_id=_deserialize(blob=proto.msg_id),\n address=_deserialize(blob=proto.address),\n content=json.loads(proto.content),\n reply_to=_deseri...
[ "0.70799685", "0.6824257", "0.67300284", "0.6629282", "0.66131353", "0.65628207", "0.65527236", "0.65504444", "0.65402055", "0.6278673", "0.627125", "0.6209945", "0.6203828", "0.6177975", "0.6148224", "0.6105038", "0.60929835", "0.60874814", "0.5987831", "0.59861207", "0.5970...
0.667701
3
Return the type of protobuf object which stores a class of this type As a part of serialization and deserialization, we need the ability to lookup the protobuf object type directly from the object type. This static method allows us to do this. Importantly, this method is also used to create the reverse lookup ability w...
def get_protobuf_schema() -> GeneratedProtocolMessageType: return Metadata_PB
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetProtobufType(cls):\n return _GetFactory(cls).protobuf_type", "def get_obj_class(self, obj_type: str) -> Type[TgnObject]:\n pass", "def get_type ( self, object ):\n return self.type", "def get_type ( self, object ):\n return self.type", "def getMetaType(self, object) :\n\t\tif c...
[ "0.7063471", "0.6982377", "0.6548026", "0.6548026", "0.65435624", "0.6421704", "0.63375413", "0.63375413", "0.63375413", "0.63375413", "0.63375413", "0.63375413", "0.63375413", "0.63375413", "0.63375413", "0.63375413", "0.63375413", "0.63375413", "0.63375413", "0.63375413", "...
0.0
-1
Function to perform hierarchical clustering of the 16S data matrix.
def cluster16SMatrix(dataMatrix, distanceMetric='jensenshannon', clusterMethod='ward', nClusters=5): # Cluster the data matrix using the desired metrics distanceCalc = distance.pdist(dataMatrix.values, distanceMetric) distanceCalc[np.isnan(distanceCalc)] = 0 colLinkage = hierarchy.linkage(distanceCalc, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hierarchicalClustering(distanceMatrix, withDendrogram=False):\n\n # convert symmetric distance matrix into upper triangular array\n distArray = ssd.squareform(np.asmatrix(distanceMatrix), checks=False)\n # find \"best\" method\n methods = [\"ward\", \"median\", \"average\", \"single\", \"complet...
[ "0.71700925", "0.7048514", "0.6960884", "0.6786377", "0.6780482", "0.6740712", "0.6685286", "0.663984", "0.6570671", "0.6514675", "0.6510114", "0.65045625", "0.6497484", "0.64436615", "0.64186096", "0.64010465", "0.6389351", "0.6367447", "0.6346259", "0.634564", "0.6306024", ...
0.6460729
13
Function to assess the "optimal" number of clusters for hierarchical clustering.
def validateClusters(dataMatrix, distanceMetric='jensenshannon', clusterMethod='ward', method='silhouette', maxClusters=25): distanceCalc = distance.pdist(dataMatrix.values, distanceMetric) distanceCalc[np.isnan(distanceCalc)] = 0 colLinkage = hierarchy.linkage(distanceCalc, method=clusterMethod) distMa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_nb_clusters(self):\n \n print(\"Finding the optimal number of clusters...\")\n \n sample = ro.r.matrix(self.df[self.df[\"filename\"].between(1, 4)][\"active_power\"].to_numpy())\n \n r=ro.r(\"\"\"\n check = function(matrix) {\n n_clust = fviz...
[ "0.71986145", "0.6878082", "0.6713189", "0.66142327", "0.6468205", "0.6460931", "0.6435595", "0.63791865", "0.6353146", "0.63363975", "0.62885153", "0.6247442", "0.61853504", "0.6152921", "0.6150224", "0.6145353", "0.6141246", "0.60855657", "0.60784227", "0.60701925", "0.6041...
0.0
-1
Append raw report item or bytes to HID report
def add_report_raw(self, report_data): self._reports.append(report_data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_report_item(self, report_prefix, *report_data):\n hid_report = ReportDescriptorEmitter()\n report_len = _hid_item_length.index(len(report_data))\n hid_report.bHeader = {\n \"prefix\": report_prefix,\n \"bSize\": report_len\n }\n hid_report.data = re...
[ "0.7176925", "0.5762664", "0.56536555", "0.5579736", "0.5500773", "0.5449259", "0.5405908", "0.5357833", "0.52661437", "0.5226669", "0.5153525", "0.51037776", "0.5079036", "0.5062024", "0.5052433", "0.50386965", "0.50331897", "0.5029711", "0.5022681", "0.50067246", "0.5004431...
0.66093427
1
Convenience function to add formatted HID report item
def add_report_item(self, report_prefix, *report_data): hid_report = ReportDescriptorEmitter() report_len = _hid_item_length.index(len(report_data)) hid_report.bHeader = { "prefix": report_prefix, "bSize": report_len } hid_report.data = report_data ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _add_report_formatting(self, cell_range: str, fmt_spec: gsfmt.CellFormat):\n self.report_formatting.append((cell_range, fmt_spec))", "def format(self, item):\n raise NotImplementedError()", "def addItem(self, track_dict):\n for i in ['order_id', 'sku', 'name', 'price', 'quantity']: # ...
[ "0.58909196", "0.57545817", "0.5592168", "0.5580048", "0.55122375", "0.54767895", "0.54133266", "0.53118646", "0.5274623", "0.52535117", "0.5248676", "0.523191", "0.5217867", "0.5205428", "0.515771", "0.5144452", "0.51378083", "0.51216", "0.5105966", "0.51056516", "0.5085843"...
0.70738643
0
Convenience function to add HID input item with preformatted flags. See HID 1.11 section 6.2.2.5 for flag meanings.
def add_input_item(self, data_constant = False, array_variable = True, absolute_relative = False, wrap = False, linear = False, preferred = True, null = False, volatile = False...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_flag_entry(entry_message, data=''):\n return partial(__add_entry,\n event_type='FLAG',\n entry_message=entry_message,\n data=data)", "def add_special_input(self, input, number, logid='default-log'):\n cell = self.get_cell(number, logid)\n ...
[ "0.57880765", "0.5669327", "0.56324345", "0.55200225", "0.54979795", "0.5425436", "0.53873056", "0.5352823", "0.5308463", "0.5291668", "0.52721167", "0.52556586", "0.5171872", "0.5164225", "0.515738", "0.5134334", "0.5124091", "0.5116217", "0.50476795", "0.5022534", "0.502253...
0.56855875
1
Convenience function to add HID output item with preformatted flags. See HID 1.11 section 6.2.2.5 for flag meanings.
def add_output_item(self, data_constant = False, array_variable = True, absolute_relative = False, wrap = False, linear = False, preferred = True, null = False, volatile = Fals...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render_flags_into(into, flags):\n field_added = False\n \n for flag_name in flags:\n if field_added:\n into.append(', ')\n else:\n field_added = True\n \n into.append(flag_name.replace('_', ' '))\n \n return into", "def add_item(self, command, ...
[ "0.566925", "0.5456259", "0.53306985", "0.53150094", "0.518418", "0.51789975", "0.5112157", "0.5067346", "0.5030945", "0.49701762", "0.494928", "0.49411944", "0.49125028", "0.49066538", "0.48974305", "0.48620847", "0.48526123", "0.48305097", "0.483018", "0.48075736", "0.48072...
0.5750249
0
Auxiliary function (K' in the paper)
def B(self, s, t, n): if n == 0: return 1 elif min(len(s), len(t)) < n: return 0 if (s[:-1], t, n) in self.B_st.keys(): B1 = self.B_st[(s[:-1], t, n)] else: B1 = self.B(s[:-1], t, n) #self.B_st[(s[:-1], t, n)] = B1 if (...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fn(k):\n if k <= 1: return 1\n return fn(k-1) + fn(k-2)", "def getK2(inp):\n\treturn 0.9/(1-math.exp(-getLambda(inp)))", "def fn(m, k):\n if m == 0 or k == 0: return 0 \n return 1 + fn(m-1, k-1) + fn(m-1, k)", "def f(X_,K_):\r\n return max(exp(X_)-K_,0)", ...
[ "0.63933635", "0.6363057", "0.63177955", "0.62598974", "0.62358433", "0.62325853", "0.6205404", "0.61867553", "0.61731815", "0.6159942", "0.61560804", "0.6133259", "0.6103906", "0.609453", "0.60727435", "0.60464805", "0.600266", "0.6000921", "0.59985346", "0.59777886", "0.596...
0.0
-1
Rabbits and recurrence relations
def fib(m, k): assert m > 2 first = 1 second = 1 generation = 3 while generation <= m: result = second + first * k second, first = result, second generation += 1 return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rabbits(n, k):\n prev, nxt = 1, 1\n for _ in range(2, n):\n prev, nxt = nxt, prev * k + nxt\n return nxt", "def setup_RR(self):\n for n in range(self.L - 1, -1, -1):\n self.update_RR(n)\n return self.R[-1]", "def SingleQubitRB(qubit: qreg, seqs, purity=False, add_ca...
[ "0.58385503", "0.57514787", "0.5736917", "0.5587354", "0.55848575", "0.5511443", "0.55083007", "0.5465466", "0.54601455", "0.54573774", "0.54498184", "0.54476917", "0.54418176", "0.5397274", "0.53703415", "0.53316414", "0.53296494", "0.5311462", "0.5302778", "0.5293368", "0.5...
0.0
-1
Lint the code with flake8.
def lint(session): session.install("flake8") session.run("flake8", "")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flake8():\n call([\"flake8\"])", "def flake8(context):\n exec_cmd = \"flake8 .\"\n run_cmd(context, exec_cmd)", "def lint(session):\n session.install(\"flake8\", BLACK_VERSION)\n session.run(\n \"black\",\n \"--check\",\n *BLACK_PATHS,\n )\n session.run(\"flake8\",...
[ "0.7826502", "0.7439914", "0.7414755", "0.7378273", "0.71720546", "0.6855276", "0.68128854", "0.6767506", "0.6689481", "0.66845065", "0.66831493", "0.66447073", "0.66055167", "0.6570661", "0.656754", "0.6563536", "0.65325195", "0.65315926", "0.65244573", "0.65235114", "0.6497...
0.83361983
0
Get next prime number.
def __next__(self): self.index = self.__get_next_unmarked(self.index) if self.index > self.limit: raise StopIteration self.primes.append(self.index) return self.index
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nextPrime(self):\n\t\tnum = self.cur + 1\n\t\twhile not self.isPrime(num):\n\t\t\tnum += 1\n\t\tself.cur = num\n\t\tself.prev.append(num)\n\t\t# print num\n\t\treturn num", "def next_prime(n):\n i = n + 1\n while not is_prime(i):\n i += 1\n return i", "def next(self):\n nextPrime = N...
[ "0.7907222", "0.76951885", "0.7654759", "0.71056986", "0.7048942", "0.69492847", "0.6936683", "0.6892645", "0.68164766", "0.68124247", "0.67196745", "0.6714677", "0.6711068", "0.66861314", "0.6676425", "0.6606492", "0.6604533", "0.6596021", "0.6593638", "0.6583414", "0.655728...
0.6296308
37
Get the next unmarked number.
def __get_next_unmarked(self, current): while self.__is_multiple(current): current += 1 return current
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_next_sequence_number(self):\n cur = self._next_sequence_number\n self._next_sequence_number += 1\n return cur", "def next_num(cls):\r\n cls.num += 1\r\n return cls.num", "def next(self) -> int:\n value = self.inorder[self.index]\n self.index = self.inde...
[ "0.70734465", "0.6977527", "0.6927917", "0.69086856", "0.6900802", "0.6900802", "0.67605877", "0.6751186", "0.67221344", "0.66767734", "0.6674278", "0.66321826", "0.66191983", "0.6531785", "0.6526116", "0.6522179", "0.6513542", "0.6510174", "0.6490269", "0.6476114", "0.644534...
0.76074725
0
Check, whether current index is a multiple of one of the already discovered primes.
def __is_multiple(self, current): for prime in self.primes: if current % prime == 0: return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def esPrimo(self, x):\r\n divisor = 0\r\n for i in range(2, x+1):\r\n if x%i == 0:\r\n divisor = divisor + 1\r\n if divisor > 1:\r\n return False\r\n return True", "def is_prime(a):\n return all(a % i for i in xrange(2, a))", "...
[ "0.68746513", "0.68040067", "0.6702705", "0.6702675", "0.6682332", "0.66237456", "0.6601964", "0.65563357", "0.6531201", "0.652898", "0.65209794", "0.6499448", "0.6499271", "0.64508814", "0.6449261", "0.6444774", "0.6443582", "0.64350456", "0.6424135", "0.6399239", "0.6384989...
0.7993067
0
Parses arguments from command line
def arg_parsing(): # parser instance parser = argparse.ArgumentParser(description="Neural Network Settings") # select data directory parser.add_argument('--data_dir', type=str, help='Data directory.') # select architecture parser.add_argum...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_arguments(args):", "def parse_command_line(self, argv):\n from optparse import OptionParser\n usage = \"usage: %prog [options]\"\n parser = OptionParser(usage)\n\n (options, args) = parser.parse_args(argv)", "def process_command_line_arguments() -> Namespace:\n\n parser...
[ "0.82391286", "0.761403", "0.7605433", "0.75999135", "0.7588268", "0.7584151", "0.7485596", "0.7418313", "0.7409787", "0.7405591", "0.7386275", "0.73807216", "0.7370799", "0.736445", "0.7352877", "0.7339369", "0.73152745", "0.7292983", "0.7279095", "0.7278008", "0.7266839", ...
0.0
-1
Performs training transformations on dataset.
def transformation_for_training(train_dir): train_transforms = transforms.Compose([transforms.RandomRotation(30), transforms.RandomResizedCrop(224), transforms.RandomHorizontalFlip(), tr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _transform(self, dataset):\n raise NotImplementedError()", "def train(self, training_data):\n pass", "def train(self, dataset) -> None:\n raise NotImplementedError()", "def transform_data(dataset_train, dataset_test):\n\n #transform dataset using fit_transform\n dataset_train =...
[ "0.74984956", "0.714322", "0.7125565", "0.7067932", "0.70065993", "0.684767", "0.67919225", "0.6773342", "0.6690853", "0.66440636", "0.6640035", "0.6621524", "0.6609387", "0.65764475", "0.65696764", "0.6529118", "0.65197486", "0.6495644", "0.64931464", "0.6469883", "0.64534",...
0.62729067
34
Performs test transformations on a dataset.
def transformation_for_testing(test_dir): # Define transformation test_transforms = transforms.Compose([transforms.Resize(256), transforms.CenterCrop(224), transforms.ToTensor(), transforms.Nor...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test(self, dataset) -> None:\n raise NotImplementedError()", "def test(self, dataset):\n\n outputs, errors = self.use(dataset)\n\n ## PUT CODE HERE ##\n # I put the code in the \"use\" function, seems better :-)\n\n return outputs, errors", "def transform_data(dataset_tra...
[ "0.7348205", "0.7184683", "0.71561563", "0.7091412", "0.7063284", "0.7034932", "0.68949515", "0.68701756", "0.6851518", "0.6554057", "0.6454966", "0.63948965", "0.63236576", "0.62374663", "0.6223602", "0.61879635", "0.6180748", "0.6177663", "0.6177561", "0.6172904", "0.615515...
0.6279633
13
Creates a dataloader from dataset
def data_loader(data, train=True): loader_config = { 'batch_size':64, 'shuffle':train } return torch.utils.data.DataLoader(data, **loader_config)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_dataloader(data):\r\n input_ids = torch.LongTensor([sent['input_ids'] for sent in data])\r\n input_mask = torch.LongTensor([sent['input_mask'] for sent in data])\r\n segment_ids = torch.LongTensor([sent['segment_ids'] for sent in data])\r\n label_ids = torch.LongTensor([sent['label_ids'] for...
[ "0.80838567", "0.7692149", "0.7623508", "0.76028895", "0.752949", "0.7343747", "0.73312813", "0.7285905", "0.72848207", "0.72800523", "0.7233345", "0.71680284", "0.7144422", "0.7127126", "0.7112699", "0.70464253", "0.70323205", "0.69610095", "0.6957902", "0.69366944", "0.6930...
0.6414222
62