query
stringlengths
9
9.05k
document
stringlengths
10
222k
metadata
dict
negatives
listlengths
30
30
negative_scores
listlengths
30
30
document_score
stringlengths
4
10
document_rank
stringclasses
2 values
Test in filter on a choice field using an enum (Reporter.reporter_type).
def test_enum_in_filter(query): Reporter.objects.create( first_name="John", last_name="Doe", email="john@doe.com", reporter_type=1 ) Reporter.objects.create( first_name="Jean", last_name="Bon", email="jean@bon.com", reporter_type=2 ) Reporter.objects.create( first_name="Jane...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_choice_in_filter_without_enum(query):\n\n john_doe = Reporter.objects.create(\n first_name=\"John\", last_name=\"Doe\", email=\"john@doe.com\"\n )\n jean_bon = Reporter.objects.create(\n first_name=\"Jean\", last_name=\"Bon\", email=\"jean@bon.com\"\n )\n documentary_film = Fi...
[ "0.6124881", "0.5575385", "0.54288995", "0.54145145", "0.5324439", "0.53120065", "0.53093195", "0.52942735", "0.52369535", "0.5213601", "0.5205873", "0.5193913", "0.5182427", "0.5172175", "0.51323706", "0.51200104", "0.5100281", "0.50874496", "0.50767154", "0.50623184", "0.50...
0.56262904
1
Handle GET requests to park ProductCategorys resource
def list(self, request): product_category = ProductCategory.objects.all() # Support filtering ProductCategorys by area id # name = self.request.query_params.get('name', None) # if name is not None: # ProductCategories = ProductCategories.filter(name=name) serializer...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def retrieve(self, request, pk=None):\n try:\n category = ProductCategory.objects.get(pk=pk)\n serializer = ProductCategorySerializer(category, context={'request': request})\n return Response(serializer.data)\n except Exception as ex:\n return HttpResponseS...
[ "0.71682376", "0.7032157", "0.69441664", "0.6676812", "0.66664386", "0.6588189", "0.6565913", "0.64754415", "0.6378403", "0.6333164", "0.6246395", "0.6242302", "0.6219372", "0.6217133", "0.6207262", "0.6182406", "0.6178808", "0.61548734", "0.61504626", "0.6134846", "0.6096371...
0.7259174
0
returns True if event ends a possession, False otherwise
def is_possession_ending_event(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_as_possession(self):\n if self.is_possession_ending_event:\n if self.seconds_remaining > 2:\n return True\n # check when previous possession ended\n prev_event = self.previous_event\n while prev_event is not None and not prev_event.is_poss...
[ "0.75881785", "0.702573", "0.7022446", "0.6956652", "0.6942744", "0.68245476", "0.66753006", "0.6652011", "0.6642587", "0.65541005", "0.6489061", "0.64834446", "0.64689803", "0.6468721", "0.64471143", "0.6441375", "0.64016587", "0.63684183", "0.63627636", "0.63627636", "0.634...
0.85768574
0
returns list of dicts with all stats for event
def event_stats(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def event_stats(self):\n return self.base_stats", "def get_metrics(event):\n return tba_session.get(BASE_URL + '/event/%s/oprs' %event).json()", "def event_dicts(self):\n events = []\n # We're assuming that the table has alternating rows that\n # containg (date, event title) poss...
[ "0.7214178", "0.69517624", "0.67323565", "0.6659741", "0.6565855", "0.654559", "0.65454817", "0.6497064", "0.64058197", "0.6327785", "0.6292388", "0.62751824", "0.62552947", "0.62509114", "0.6241405", "0.62282646", "0.6225516", "0.62236094", "0.62227386", "0.62097263", "0.616...
0.7740182
0
returns team id for team on offense for event
def get_offense_team_id(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_team_id(team_name):\n\n team_name = team_name.lower()\n endpoint = \"/teams\"\n response = api.nhl_api(endpoint)\n\n if not response:\n raise ConnectionError(\"An invalid response was returned from the NHL Teams API.\")\n\n teams_json = response.json()\n teams = teams_json[\"teams\...
[ "0.6402092", "0.63786477", "0.6285374", "0.62278175", "0.6203459", "0.617215", "0.5979764", "0.5927196", "0.573476", "0.57201517", "0.56839955", "0.5652449", "0.5618322", "0.5600507", "0.5562163", "0.5533258", "0.55129105", "0.5488184", "0.5462104", "0.54099923", "0.53854465"...
0.82629144
0
returns list of all events that take place as the same time as the current event
def get_all_events_at_current_time(self): events = [self] # going backwards event = self while event is not None and self.seconds_remaining == event.seconds_remaining: if event != self: events.append(event) event = event.previous_event # go...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_curr_events(self):\n today = datetime.date.today()\n return self.s.query(Event).filter(Event.time > today).all()", "def events(time):\n\n event_list = eventlist()\n idx = np.all(time == event_list[:, 0:len(time)], axis=1)\n return event_list[idx,:]", "def get_events(self):\n ...
[ "0.7656709", "0.7239735", "0.670789", "0.66426444", "0.65620106", "0.65207577", "0.64506966", "0.63653976", "0.63593066", "0.6298316", "0.6236205", "0.6210293", "0.6126111", "0.6072726", "0.60209477", "0.59940344", "0.5987256", "0.59750044", "0.5967468", "0.59477067", "0.5942...
0.7872362
0
returns dict with list of player ids for each team with players on the floor for current event For all non subsitution events current players are just the same as previous event
def current_players(self): return self.previous_event.current_players
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_players_on_floor(self):\n for period in self.Periods:\n # set current players to be period starters\n current_players = period.Starters.copy()\n for pbp_event in period.Events:\n if pbp_event.is_substitution():\n coming_in = pbp_even...
[ "0.65528506", "0.59010434", "0.5883524", "0.5855024", "0.58492154", "0.5839282", "0.57566845", "0.5750913", "0.57267255", "0.57229966", "0.56700575", "0.5654687", "0.5652263", "0.5650997", "0.5623131", "0.56151515", "0.56052953", "0.5571534", "0.5563076", "0.55602336", "0.555...
0.6070743
1
returns the score margin from perspective of offense team before the event took place
def score_margin(self): if self.previous_event is None: score = self.score else: score = self.previous_event.score offense_team_id = self.get_offense_team_id() offense_points = score[offense_team_id] defense_points = 0 for team_id, points in score....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Margin(self):\n s = self.margin\n assert s in range(1,6), \"Margin score out of bounds.\"\n if s == 1: return 'Poor'\n elif s == 2: return 'Near Poor'\n elif s == 3: return 'Medium'\n elif s == 4: return 'Near Sharp'\n elif s == 5: return 'Sharp'", "def marg...
[ "0.6575193", "0.5990418", "0.59229994", "0.5904188", "0.58731693", "0.58324146", "0.57912004", "0.57143426", "0.56908834", "0.56435466", "0.56371015", "0.56231445", "0.5613722", "0.5583762", "0.5572104", "0.5566963", "0.55475724", "0.5513546", "0.5509342", "0.55083126", "0.54...
0.8493469
0
returns dict with lineup ids for each team for current event. Lineup ids are hyphen separated sorted player id strings.
def lineup_ids(self): lineup_ids = {} for team_id, team_players in self.current_players.items(): players = [str(player_id) for player_id in team_players] sorted_player_ids = sorted(players) lineup_id = "-".join(sorted_player_ids) lineup_ids[team_id] = line...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compile_lineups(players, pos, id_list, team):\n lu = []\n subs = []\n names = players[team]\n positions = pos[team]\n ids = id_list[team]\n for n in range(len(names)):\n if names[n][-1] == ' ':\n names[n] = names[n][0:-1]\n for i in range(0, len(names)):\n names[i]...
[ "0.63278043", "0.5798467", "0.57650906", "0.576339", "0.54533684", "0.54256725", "0.5386581", "0.53313106", "0.5272173", "0.5270027", "0.5256748", "0.52523595", "0.52510047", "0.5233039", "0.5219826", "0.52058655", "0.5196101", "0.51753414", "0.5173734", "0.5145153", "0.51366...
0.8228265
0
returns the number of seconds that have elapsed since the previous event
def seconds_since_previous_event(self): if self.previous_event is None: return 0 if self.seconds_remaining == 720: # so that subs between periods for live don't have negative seconds return 0 if self.seconds_remaining == 300 and self.period > 4: # ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def time_since_last_state_change(self):\n current_time = rospy.get_rostime()\n difference = current_time - self._timestamps['last_state_change']\n return difference.to_sec()", "def elapsed():\n global start_time\n return time.time() - start_time", "def elapsed(self):\n ...
[ "0.73553234", "0.73396635", "0.7332249", "0.7310087", "0.7274196", "0.72670037", "0.7216402", "0.71862936", "0.71495765", "0.71136665", "0.70829964", "0.70781296", "0.7034211", "0.697659", "0.69762397", "0.696461", "0.69368035", "0.6934867", "0.69290966", "0.68871796", "0.688...
0.8197923
0
returns True if the event takes place after an offensive rebound on the current possession, False otherwise
def is_second_chance_event(self): event = self.previous_event if isinstance(event, Rebound) and event.is_real_rebound and event.oreb: return True while not (event is None or event.is_possession_ending_event): if isinstance(event, Rebound) and event.is_real_rebound and eve...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_possession_ending_event(self):\n pass", "def is_onhold(self) -> bool:", "def is_on(self) -> bool:\n return self.event.is_tripped", "def shooting(self):\r\n return not self.stopped", "def is_penalty_event(self):\n if hasattr(self, \"fouls_to_give\"):\n team_ids ...
[ "0.70515865", "0.6717488", "0.6612516", "0.6464781", "0.64172095", "0.63652587", "0.6318331", "0.6302998", "0.62632906", "0.62373704", "0.6230576", "0.622687", "0.62076503", "0.6200433", "0.61976546", "0.6172198", "0.6165521", "0.61521184", "0.6148918", "0.6104865", "0.608294...
0.69695365
1
returns True if the team on offense is in the penalty, False otherwise
def is_penalty_event(self): if hasattr(self, "fouls_to_give"): team_ids = list(self.current_players.keys()) offense_team_id = self.get_offense_team_id() defense_team_id = ( team_ids[0] if offense_team_id == team_ids[1] else team_ids[1] ) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def winningTeamPenalty(r):\n \n #Check if home or away had more goals at the 'event' time\n homecheck = int(r['about.goals.home'] > r['about.goals.away'])\n awaycheck = int(r['about.goals.away'] > r['about.goals.home'])\n \n #If home had more goals and the penalty was on the home team, set to 1\n...
[ "0.6627246", "0.6298236", "0.6159958", "0.6144886", "0.61247426", "0.6035521", "0.6007446", "0.5965502", "0.5947476", "0.59469855", "0.5929833", "0.5910404", "0.5885881", "0.58652747", "0.5852705", "0.5821209", "0.5802464", "0.58004534", "0.5798505", "0.57926786", "0.5742253"...
0.70770013
0
returns True if event is possession changing event that should count as a real possession, False otherwise. In order to not include possessions which a very low probability of scoring in possession counts, possession won't be counted as a possession if it starts with <= 2 seconds left and no points are scored before pe...
def count_as_possession(self): if self.is_possession_ending_event: if self.seconds_remaining > 2: return True # check when previous possession ended prev_event = self.previous_event while prev_event is not None and not prev_event.is_possession_endi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_possession_ending_event(self):\n pass", "def significant_position_change(self, timestamp, new_position):\n timediff = (timestamp - self.timestamp).total_seconds()\n posdiff = (new_position - self.position) / 1000\n diffdiff = timediff - posdiff\n\n if abs(diffdiff) > 5:\...
[ "0.7091942", "0.60511667", "0.58913386", "0.5813963", "0.5769117", "0.5687262", "0.5611369", "0.56004244", "0.55632025", "0.5527948", "0.5527946", "0.55076903", "0.54790807", "0.5442499", "0.54219216", "0.5415135", "0.5407619", "0.5396577", "0.5360468", "0.53576845", "0.53544...
0.82088506
0
download the HR2 from the sqlite DB
def download(self,connector,condition): c= connector.cursor() # condition = " WHERE DIF_ID=%d AND NUM=%d" % (difid,num) snew = buildSelect(self,'HR2',condition) # print snew c.execute(snew) lnames=[] for name,val in sorted(self.__dict__.iteritems()): lna...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download_hess_dr1_data():\n download_data_files(FILENAMES_HESS_DR1)", "def download():\n return response.download(request,db)", "def download():\n return response.download(request,db)", "def download():\n return response.download(request,db)", "def download():\n return response.download(...
[ "0.6795823", "0.6621874", "0.6621874", "0.6621874", "0.6621874", "0.6621874", "0.6621874", "0.6479302", "0.62850004", "0.62850004", "0.62850004", "0.62850004", "0.62850004", "0.62850004", "0.62850004", "0.62850004", "0.62850004", "0.62850004", "0.62850004", "0.62850004", "0.6...
0.71289873
0
download the DCC from the sqlite DB
def download(self,connector,condition): c= connector.cursor() snew = buildSelect(self,'DCC',condition) # print snew c.execute(snew) lnames=[] for name,val in sorted(self.__dict__.iteritems()): lnames.append(name) vobj=[] for row in c: # ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download_dbase(ascii_dbase_url, ascii_dbase_root):\n from fiasco import log\n log.debug(f'Downloading database from {ascii_dbase_url}')\n log.debug(f'Downloading database to {ascii_dbase_root}')\n tar_tmp_dir = FIASCO_HOME / 'tmp'\n tar_tmp_dir.mkdir(exist_ok=True, parents=True)\n with set_te...
[ "0.64645934", "0.63106734", "0.63106734", "0.63106734", "0.63106734", "0.63106734", "0.63106734", "0.61389863", "0.61100876", "0.6083434", "0.59853745", "0.59853745", "0.59853745", "0.59853745", "0.59853745", "0.59853745", "0.59853745", "0.59853745", "0.59853745", "0.59853745",...
0.66012114
0
download the SETUP from the sqlite DB
def download(self,connector,condition): c= connector.cursor() snew = buildSelect(self,'SETUP',condition) # print snew c.execute(snew) lnames=[] for name,val in sorted(self.__dict__.iteritems()): lnames.append(name) vobj=[] for row in c: # ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download_and_prepare(self):\n self._download_and_prepare()", "def download_and_preprocess(self):\n print('Preparing steering angle database.')\n print('Downloading...')\n self.download()\n print('Preprocessing...')\n self.preprocess()", "def initial_db_setup() -> None:...
[ "0.62866896", "0.62310046", "0.61061794", "0.60753727", "0.60753727", "0.60753727", "0.60753727", "0.60753727", "0.60753727", "0.6056658", "0.5950842", "0.5944346", "0.5913646", "0.58318216", "0.58160055", "0.57921296", "0.57838356", "0.57605076", "0.57173675", "0.5682499", "...
0.6631947
0
Create the descriptor. `base_attr` is the name of an integer attribute that represents binary flags. `bitmask` is the binary value to toggle on `base_attr`.
def __init__(self, base_attr, bitmask): self.base_attr = base_attr self.bitmask = bitmask
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __set__(self, obj, enabled):\n\n value = getattr(obj, self.base_attr)\n if enabled:\n value |= self.bitmask\n else:\n value &= ~self.bitmask\n setattr(obj, self.base_attr, value)", "def _create_inherited_flag_field(property_):\n name_for_methods = join_nam...
[ "0.5400316", "0.5286925", "0.5209522", "0.51593536", "0.51050526", "0.5062308", "0.49769795", "0.49352902", "0.4898312", "0.47941947", "0.4774199", "0.4736493", "0.473473", "0.4696283", "0.46891314", "0.46879336", "0.46860164", "0.4677896", "0.46669382", "0.46669382", "0.4665...
0.76175773
0
Tests the backward pass of the hinge loss function
def test_hinge_loss_backward(): from your_code import HingeLoss X = np.array([[-1, 2, 1], [-3, 4, 1]]) w = np.array([1, 2, 3]) y = np.array([1, -1]) loss = HingeLoss(regularization=None) _true = np.array([-1.5, 2, 0.5]) _est = loss.backward(X, w, y) print(_est)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_backward(net, X, Y, grad, loss, index):\n eps = 1e-7\n backup = X[index]\n X[index] += eps\n A1 = net.forward(X)\n loss1 = net.loss(Y, A1[-1])\n ratio = (loss1 - loss) / eps\n assert np.isclose(grad[index], ratio)\n X[index] = backup", "def _backward(loss):\n\n loss.backwa...
[ "0.70681214", "0.6942057", "0.659498", "0.6545506", "0.6523432", "0.64993215", "0.64905953", "0.64883435", "0.64445055", "0.6438305", "0.64352924", "0.642554", "0.6404636", "0.6404417", "0.63782287", "0.63528156", "0.6351562", "0.6339242", "0.6338139", "0.6330921", "0.6330372...
0.8668524
0
Tests the forward pass of the squared loss function
def test_squared_loss_forward(): from your_code import SquaredLoss X = np.array([[-1, 2, 1], [-3, 4, 1]]) w = np.array([1, 2, 3]) y = np.array([1, -1]) loss = SquaredLoss(regularization=None) _true = 26.5 _est = loss.forward(X, w, y) print(_est)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forward(self,y_out, y_truth): \n result = (np.square(np.subtract(y_out, y_truth)))\n #########################################################################\n # TODO: #\n # Implement the forward pass and return the...
[ "0.6932652", "0.68198997", "0.65537393", "0.65324885", "0.6529143", "0.63533276", "0.6301397", "0.6298944", "0.628218", "0.62585825", "0.6255691", "0.62509155", "0.6244331", "0.6233", "0.6224718", "0.62080723", "0.6198414", "0.6166633", "0.61483914", "0.6138617", "0.6106742",...
0.8524856
0
Tests the ability of the gradient descent algorithm to classify a linearly separable dataset.
def test_gradient_descent_blobs(): features, _, targets, _ = load_data('blobs') hinge = make_predictions(features, targets, 'hinge', None) # assert np.all(hinge == targets) # l1_hinge = make_predictions(features, targets, 'hinge', 'l1') # # assert np.all(l1_hinge == targets) # # l2_hinge =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_train_dataset(self):\n classifiers, estimates =\\\n ada_boost.train_dataset(self.larger_matrix,\n self.larger_class_labels,\n 9)\n expected = [\n {'alpha': 0.6931471805599453,\n 'dim': 0,\...
[ "0.6490156", "0.6451971", "0.64335155", "0.6392328", "0.63797176", "0.62720233", "0.6257553", "0.6255466", "0.6249252", "0.623954", "0.6229559", "0.62094355", "0.6200106", "0.61554265", "0.61163557", "0.6115135", "0.61097056", "0.6069717", "0.60438246", "0.60386896", "0.60309...
0.65788424
0
Returns a client configured with the given MetaHttpClient
def __init__(self, metaHttpClient): self.httpClient = metaHttpClient
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_httpx_client() -> httpx.Client:\n return httpx.Client(**CLIENT_PARAMETERS) # type: ignore", "def _obtain_http_client(hostname=METADATA_SERVER_HOSTNAME):\n return http.client.HTTPConnection(hostname,\n timeout=METADATA_SERVER_CONN_TIMEOUT)", "def get(cls, conf...
[ "0.69275284", "0.69132006", "0.6854978", "0.6838644", "0.67625606", "0.6725256", "0.6679172", "0.65378565", "0.6535458", "0.6499919", "0.64733833", "0.6437994", "0.6422018", "0.6411563", "0.6403961", "0.63889176", "0.6383493", "0.6340762", "0.6308783", "0.6306034", "0.6300599...
0.6965378
0
Factory method to reate a new client from url and auth strategy.
def createClientFromUrl(url, authStrategy=None): return MetaClient(MetaHttpClient(url, authStrategy))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def client():\n return Client(**common_data.AUTH_ARGS)", "def make_client(self, context):\n return Client(self.settings['client_routing'], context=context)", "def client_from_config(cls, base_client, conf, logger=None):\n _unused = conf\n if cls == PapiViewClient:\n # we're i...
[ "0.6883496", "0.6652142", "0.65504664", "0.63140374", "0.62927", "0.6198969", "0.61564", "0.6089419", "0.6076771", "0.60702914", "0.60631484", "0.60540426", "0.6042376", "0.6015032", "0.5999247", "0.5936448", "0.5922538", "0.59159464", "0.58842707", "0.5857151", "0.58331627",...
0.74867505
0
Function for loading the features and labels associated with the training dataset.
def _loadTrain(self, features, labels): self.trainX_, self.trainY_, self.trainLabel_ = self.__load(features, labels)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_features(self, features):\n pass\n # self.features = features", "def read_data(feature_file, label_file):", "def train(self, features, labels):\n pass", "def _read_train_datas(self):\r\n with open(self.train_label_path, 'r') as fb:\r\n lines = fb.readlines()\r\...
[ "0.72724336", "0.71050906", "0.70961773", "0.7020884", "0.6974502", "0.69578195", "0.68213254", "0.68110377", "0.68032", "0.67908686", "0.6778066", "0.6760534", "0.67411566", "0.6715979", "0.66920966", "0.66892487", "0.66885465", "0.66482824", "0.6603724", "0.65990937", "0.65...
0.7857445
0
Function for loading the features and labels associated with the testing dataset.
def _loadTest(self, features, labels): self.testX_, self.testY_, self.testLabel_ = self.__load(features, labels)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_test_data(label_fname, data_fname):\n labels = load_csv(label_fname)\n data = load_csv(data_fname, 'excel-tab')\n\n # Join all data together on the ids given in the files\n joined_data = {}\n for label in labels:\n id = label[0]\n joined_data[id] = {'class': label[1]}\n for...
[ "0.7340451", "0.7329776", "0.729219", "0.70436066", "0.70091707", "0.6979865", "0.6900357", "0.68143857", "0.67991424", "0.67709094", "0.67183954", "0.6622276", "0.6608396", "0.6606673", "0.65982616", "0.657758", "0.65768003", "0.65713066", "0.6517931", "0.65098", "0.65078866...
0.80802953
0
Function for loading the features and labels associated with the validation dataset.
def _loadValid(self, features, labels): self.validX_, self.validY_, self.validLabel_ = self.__load(features, labels)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _loadTrain(self, features, labels):\n\t\tself.trainX_, self.trainY_, self.trainLabel_ = self.__load(features, labels)", "def load_data(self):\n sets = ['train', 'val']\n images = []\n labels = []\n self.labels_dic = {}\n file = open(self.path + 'wnids.txt')\n train_l...
[ "0.7066322", "0.6910587", "0.68762726", "0.68701327", "0.6851733", "0.6828537", "0.6772606", "0.6747656", "0.671662", "0.6708065", "0.6663688", "0.6652927", "0.66424817", "0.66018474", "0.6580891", "0.6563428", "0.6560234", "0.65583473", "0.65253925", "0.6494413", "0.64848816...
0.7184243
0
Handles displaying recipe categories
def categories(): return render_template('categories.html', recipe_categories=USERS[session['username']].recipe_categories)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_categories():\n if 'user' not in session:\n flash(\"You need to own this recipe to be able to delete it.\")\n return redirect(url_for(\"login\"))\n\n categories = list(mongo.db.categories.find().sort(\"category_name\", 1))\n return render_template(\"categories.html\", categories=cate...
[ "0.7086564", "0.68516177", "0.67932105", "0.67012036", "0.66799504", "0.6656528", "0.6643379", "0.66044766", "0.6603303", "0.66017115", "0.65058404", "0.6419562", "0.6403973", "0.6363026", "0.63584274", "0.63432485", "0.63299835", "0.6321505", "0.6302908", "0.62928087", "0.62...
0.7799081
0
Inserts a book into the book table
def insert_book(self, title, author, year, isbn): self.cursor.execute("INSERT INTO Book VALUES(NULL, ?, ?, ?, ?)", (title, author, year, isbn)) self.connection.commit()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert_book(title, author, year):\n try:\n cursor = conn.cursor()\n cursor.execute(\"\"\"\n INSERT INTO books(title, author, year)\n VALUES(?,?,?)\n \"\"\", (title, author, year))\n conn.commit()\n except Exception as e:\n logging.error(e)\n ...
[ "0.8030016", "0.75679004", "0.74723715", "0.74601537", "0.7431787", "0.70822483", "0.6939844", "0.688597", "0.66291636", "0.6627789", "0.6603897", "0.65962255", "0.6493063", "0.64219564", "0.6401724", "0.625291", "0.62327266", "0.62045246", "0.618287", "0.618287", "0.618287",...
0.80825835
0
Updates a book from the book database
def update(self, id, title, author, year, isbn): self.cursor.execute("UPDATE Book SET Title = ?, Author = ?, Year = ?, \ ISBN = ? WHERE Id = ?", (title, author, year, isbn, id)) self.connection.commit()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def put(self, book_id):\n a_book = query_book_by_id(book_id)\n if a_book is None:\n return 'Book does not exit', 404\n body = request.get_json()\n a_book.parse_body(body)\n db.session.add(a_book)\n db.session.commit()\n return a_book.serialize(), 200", ...
[ "0.7573654", "0.72800773", "0.724804", "0.71230936", "0.7046375", "0.70066255", "0.6929183", "0.6876896", "0.6876203", "0.68481857", "0.6840768", "0.6555312", "0.6484862", "0.6337583", "0.6248639", "0.62454295", "0.62454295", "0.6211745", "0.6150676", "0.61380297", "0.6113835...
0.7472767
1
Create a UI from a SQL table and return a ``Panel``
def create_tables(name, role, doc, options, connection): if role == 'data_samples': print(f'create data_samples={name}') data_table = TabsDynamicData(doc, options, connection, name, role, creator_fn=process_data_samples) panel = Panel(child=data_table.get_ui(), title=name, name=f'data_sample...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def makeTableWidget(self):\n from collective.table.browser.table import TableWidget\n context = self.portal.table\n widget = TableWidget(context, None)\n widget.fieldName = 'table'\n return widget", "def create_panel(self):\n return\n # return Panel(self)", "def...
[ "0.6599751", "0.60347813", "0.6001966", "0.59753203", "0.5832454", "0.58038557", "0.5691837", "0.568478", "0.558809", "0.55831575", "0.5527184", "0.5521518", "0.55198944", "0.5481038", "0.5476279", "0.54733795", "0.5462939", "0.54569745", "0.54461217", "0.54309857", "0.542044...
0.62888616
1
Get the next update from the queue. If no update is found, block the process until one is received. If a stop signal is sent, try to gracefully stop the thread.
def __receive_next_update(self) -> telegram.Update: # Pop data from the queue try: data = self.queue.get(timeout=self.cfg.telegram["conversation_timeout"]) except queuem.Empty: # If the conversation times out, gracefully stop the thread self.__graceful_stop(St...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def receive_next_update(self) -> telegram.Update:\n # Pop data from the queue\n data = \"\"\n try:\n data = self.queue.get(timeout=self.cfg.telegram[\"conversation_timeout\"])\n except queuem.Empty:\n # If the conversation times out, gracefully stop the thread\n ...
[ "0.75623107", "0.61685276", "0.5938287", "0.591084", "0.58862364", "0.5823619", "0.5713644", "0.56726706", "0.5642151", "0.5579003", "0.55334973", "0.5469232", "0.54662484", "0.5425067", "0.54067975", "0.54012185", "0.53892756", "0.5383263", "0.537932", "0.53742594", "0.53650...
0.778689
0
Get the next update from the queue. If no update is found, block the process until one is received. If a stop signal is sent, try to gracefully stop the thread.
def receive_next_update(self) -> telegram.Update: # Pop data from the queue data = "" try: data = self.queue.get(timeout=self.cfg.telegram["conversation_timeout"]) except queuem.Empty: # If the conversation times out, gracefully stop the thread self.__...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __receive_next_update(self) -> telegram.Update:\n # Pop data from the queue\n try:\n data = self.queue.get(timeout=self.cfg.telegram[\"conversation_timeout\"])\n except queuem.Empty:\n # If the conversation times out, gracefully stop the thread\n self.__gra...
[ "0.77863574", "0.61682695", "0.59378856", "0.5911545", "0.5886102", "0.5824382", "0.5714152", "0.5673009", "0.56416255", "0.5580509", "0.5534133", "0.54715234", "0.5465117", "0.54249656", "0.5407767", "0.5402611", "0.53896356", "0.53829896", "0.5379179", "0.5373928", "0.53666...
0.7561312
1
Continue getting updates until until one of the strings contained in the list is received as a message.
def __wait_for_specific_message(self, items: List[str], cancellable: bool = False) -> Union[str, CancelSignal]: log.debug("Waiting for a specific message...") while True: # Get the next update update = self._...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handl_update(updates):\n for update in updates[\"result\"]:\n text = update[\"message\"][\"text\"]\n chat = update[\"message\"][\"chat\"][\"id\"]\n items = db.get_item(chat)\n if text == \"/done\":\n keyboard = build_keyboard(items)\n send_message(\"Sélectio...
[ "0.63190633", "0.6146581", "0.6050368", "0.59897554", "0.5915279", "0.58745605", "0.57445425", "0.5734721", "0.5697445", "0.5672764", "0.5622075", "0.55866826", "0.55780554", "0.55602586", "0.5549589", "0.55215335", "0.5500802", "0.5496615", "0.5496615", "0.54910165", "0.5484...
0.61539835
1
Continue getting updates until the regex finds a match in a message, then return the first capture group.
def __wait_for_regex(self, regex: str, cancellable: bool = False) -> Union[str, CancelSignal]: log.debug("Waiting for a regex...") while True: # Get the next update update = self.__receive_next_update() # If a CancelSignal is received... if isinstance(upda...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getMatch(reMatch,group=0):\n if reMatch: return reMatch.group(group)\n else: return ''", "def recvregex(self, regex):\n if isinstance(regex, str):\n regex = re.compile(regex)\n buf = ''\n match = None\n\n while not match:\n buf += d(self.recv(1))\n ...
[ "0.629262", "0.62774885", "0.6136326", "0.61299783", "0.6032749", "0.6029412", "0.59464234", "0.5920094", "0.57432276", "0.57361436", "0.5642497", "0.56279725", "0.5584992", "0.55632395", "0.5546507", "0.5532469", "0.54971576", "0.5486865", "0.54025245", "0.53982574", "0.5376...
0.69942236
0
Continue getting updates until a precheckoutquery is received. The payload is checked by the core before forwarding the message.
def __wait_for_precheckoutquery(self, cancellable: bool = False) -> Union[telegram.PreCheckoutQuery, CancelSignal]: log.debug("Waiting for a PreCheckoutQuery...") while True: # Get the next update update = self.__receive_next_update() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def answer_pre_checkout_query(self, pre_checkout_query_id: base.String, ok: base.Boolean,\n error_message: typing.Union[base.String, None] = None) -> base.Boolean:\n payload = generate_payload(**locals())\n result = await self.request(api.Methods.ANSWER_PR...
[ "0.6297387", "0.52683717", "0.51722956", "0.51680756", "0.5077127", "0.50706697", "0.5068419", "0.50682193", "0.5056422", "0.5022585", "0.4991616", "0.4961541", "0.49071103", "0.49062324", "0.48711935", "0.4865397", "0.48612118", "0.48573983", "0.48536915", "0.4841989", "0.48...
0.7185964
0
Continue getting updates until a successfulpayment is received.
def __wait_for_successfulpayment(self, cancellable: bool = False) -> Union[telegram.SuccessfulPayment, CancelSignal]: log.debug("Waiting for a SuccessfulPayment...") while True: # Get the next update update = self.__receive_next_update() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def awaiting_payment(self):", "def webhook_payment_successful(self, event):\n\n intent = event.data.object\n p_id = intent.id\n pack = intent.metadata.pack\n save_detail = intent.metadata.save_detail\n\n billing_details = intent.charges.data[0].billing_details\n shipping...
[ "0.7672672", "0.6573215", "0.65442157", "0.6435054", "0.6081593", "0.60590357", "0.60243624", "0.6005645", "0.59923875", "0.5971794", "0.5949517", "0.59342396", "0.5882962", "0.58690065", "0.5868896", "0.5814729", "0.5801393", "0.5796031", "0.5784956", "0.5747631", "0.5716991...
0.67208254
1
Continue getting updates until a photo is received, then return it.
def __wait_for_photo(self, cancellable: bool = False) -> Union[List[telegram.PhotoSize], CancelSignal]: log.debug("Waiting for a photo...") while True: # Get the next update update = self.__receive_next_update() # If a CancelSignal is received... if isinst...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_img(self):\n img_old = self.img\n #Ensure at least one image has been captured\n attempts = 0\n while img_old == None:\n print(\"Wating to capture first image...\")\n time.sleep(1)\n img_old = self.img\n attempts = attempts + 1\n ...
[ "0.65705794", "0.6327374", "0.63064396", "0.60424834", "0.5937122", "0.5898389", "0.5863462", "0.582088", "0.58116835", "0.57911056", "0.5773972", "0.57718194", "0.5729892", "0.57232875", "0.5681439", "0.5619149", "0.5587965", "0.5579192", "0.5574852", "0.5565938", "0.5523706...
0.78513974
0
Continue getting updates until an inline keyboard callback is received, then return it.
def __wait_for_inlinekeyboard_callback(self, cancellable: bool = False) \ -> Union[telegram.CallbackQuery, CancelSignal]: log.debug("Waiting for a CallbackQuery...") while True: # Get the next update update = self.__receive_next_update() # If a CancelSigna...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def detectKeyboard(self):\n self.runKeyboard()\n time.sleep(0.2)\n searching = True\n while searching:\n for dev in self.keyboards:\n if self.hitsKeyboards[dev] != False:\n return(dev, self.map(self.hitsKeyboards[dev]))\n time....
[ "0.635834", "0.61028296", "0.57839763", "0.572346", "0.57095325", "0.57065344", "0.56824297", "0.5674951", "0.5604688", "0.5577965", "0.5554134", "0.5550242", "0.5487043", "0.54515177", "0.54401964", "0.54355025", "0.54113567", "0.54003197", "0.53757066", "0.5371119", "0.5356...
0.6559372
0
Select an user from the ones in the database.
def __user_select(self) -> Union[db.User, CancelSignal]: log.debug("Waiting for a user selection...") # Find all the users in the database users = self.session.query(db.User).order_by(db.User.user_id).all() # Create a list containing all the keyboard button strings keyboard_butto...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def select_user(user_id):\n return session.query(User).filter(User.id == user_id).first()", "def get_user_by_id(self, user_id):\n query = \"SELECT * FROM users WHERE user_id = %s\"\n self.cursor.execute(query,[user_id])\n result = self.cursor.fetchone()\n return result", "def sel...
[ "0.75827193", "0.699098", "0.6802506", "0.6733667", "0.67225665", "0.6699956", "0.65688473", "0.648302", "0.6470143", "0.6464637", "0.6432358", "0.6409055", "0.63881916", "0.6382047", "0.6382047", "0.6382047", "0.6382047", "0.63656896", "0.6337928", "0.6337304", "0.63207024",...
0.7315355
1
User menu to order products from the shop.
def __order_menu(self): log.debug("Displaying __order_menu") # Get the products list from the db products = self.session.query(db.Product).filter_by(deleted=False).all() # Create a dict to be used as 'cart' # The key is the message id of the product list cart: Dict[List[d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __products_menu(self):\n log.debug(\"Displaying __products_menu\")\n # Get the products list from the db\n products = self.session.query(db.Product).filter_by(deleted=False).all()\n # Create a list of product names\n product_names = [product.name for product in products]\n ...
[ "0.73180735", "0.72016907", "0.6804957", "0.6651566", "0.64211893", "0.6275277", "0.6244939", "0.6185193", "0.6105577", "0.59807813", "0.5963281", "0.5960109", "0.59552896", "0.5910854", "0.5890219", "0.58691454", "0.58535814", "0.58395153", "0.5799699", "0.57818246", "0.5745...
0.73403376
0
Display the status of the sent orders.
def __order_status(self): log.debug("Displaying __order_status") # Find the latest orders orders = self.session.query(db.Order) \ .filter(db.Order.user == self.user) \ .order_by(db.Order.creation_date.desc()) \ .limit(20) \ .all() # Ensure ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_orders(self):\n\n data = cur.execute(\"\"\"SELECT * FROM orders\"\"\").fetchall()\n print(tabulate(data, headers=[\"Order ID\", \"Status\", \"Customer\", \"Address\", \"Delivery Method\"]))", "def order_update_status():\n result = order_obj.order_update_status(request.forms) \n retur...
[ "0.6624454", "0.6607733", "0.6512122", "0.6492815", "0.6353827", "0.633038", "0.61956954", "0.6176387", "0.6156388", "0.6110003", "0.6095435", "0.6048326", "0.6021349", "0.601456", "0.6001526", "0.5956618", "0.59367436", "0.5935654", "0.5873689", "0.58426803", "0.58011866", ...
0.8103798
0
Send information about the bot.
def __bot_info(self): log.debug("Displaying __bot_info") self.bot.send_message(self.chat.id, self.loc.get("bot_info"))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def info(ctx):\n embed = discord.Embed(title=\"Zane Bot\", description=\"All hail the hypnotoad!\", color=0x0091C5)\n\n # give info about you here\n embed.add_field(name=\"Author\", value=\"Zanexius\")\n\n # Shows the number of servers the bot is member of.\n embed.add_field(name=\"Server coun...
[ "0.725934", "0.7055274", "0.7054091", "0.7039354", "0.6996456", "0.6912311", "0.68851507", "0.6837405", "0.68016917", "0.67736316", "0.671528", "0.6668429", "0.6624", "0.65209925", "0.64319694", "0.6400704", "0.63974255", "0.6349702", "0.63252884", "0.62954056", "0.62543094",...
0.8450503
0
Display the admin menu to select a product to edit.
def __products_menu(self): log.debug("Displaying __products_menu") # Get the products list from the db products = self.session.query(db.Product).filter_by(deleted=False).all() # Create a list of product names product_names = [product.name for product in products] # Insert...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __edit_product_menu(self, product: Optional[db.SwimPool] = None):\n log.debug(\"Displaying __edit_product_menu\")\n # Create an inline keyboard with a single skip button\n cancel = telegram.InlineKeyboardMarkup([[telegram.InlineKeyboardButton(self.loc.get(\"menu_skip\"),\n ...
[ "0.6703032", "0.6085533", "0.6074324", "0.60685647", "0.60130733", "0.59926045", "0.59859747", "0.5963964", "0.594613", "0.5924462", "0.5916004", "0.5900565", "0.5900224", "0.588214", "0.58810765", "0.5868658", "0.58564746", "0.58458424", "0.58431137", "0.5818649", "0.5691315...
0.67454296
0
Display the latest transactions, in pages.
def __transaction_pages(self): log.debug("Displaying __transaction_pages") # Page number page = 0 # Create and send a placeholder message to be populated message = self.bot.send_message(self.chat.id, self.loc.get("loading_transactions")) # Loop used to move between pages ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transaction_list(request, model_class=Transaction, template_name='budget/transactions/list.html'):\n transaction_list = model_class.active.order_by('-date', '-created')\n try:\n paginator = Paginator(transaction_list, getattr(settings, 'BUDGET_LIST_PER_PAGE', 50))\n page = paginator.page(re...
[ "0.688372", "0.6692908", "0.65745246", "0.65152967", "0.6440288", "0.6437697", "0.6429272", "0.6316394", "0.628526", "0.6220077", "0.6215298", "0.61452043", "0.6122129", "0.6120994", "0.6119554", "0.60814244", "0.6068557", "0.60655093", "0.60478973", "0.60313505", "0.6014012"...
0.76497626
0
Generate a .csv file containing the list of all transactions.
def __transactions_file(self): log.debug("Generating __transaction_file") # Retrieve all the transactions transactions = self.session.query(db.Transaction).order_by(db.Transaction.transaction_id.asc()).all() # Create the file if it doesn't exists try: with open(f"tran...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_customers(self):\n output = ''\n for i in range(len(self.customers)):\n output += f'Customer no. {self.customers[i].id} is in {self.customers[i].state[0]} section\\n'\n #print(output)\n with open('oneday.csv','a') as outfile:\n for i in range(len(self.cus...
[ "0.66963094", "0.6593577", "0.6530911", "0.6499839", "0.647537", "0.63679814", "0.63550764", "0.63113767", "0.6298641", "0.6165292", "0.615324", "0.6120086", "0.6116998", "0.61141175", "0.61109525", "0.6062832", "0.6051639", "0.60443205", "0.60440016", "0.60371464", "0.602755...
0.69846463
0
Add an administrator to the bot.
def __add_admin(self): log.debug("Displaying __add_admin") # Let the admin select an administrator to promote user = self.__user_select() # Allow the cancellation of the operation if isinstance(user, CancelSignal): return # Check if the user is already an admi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def addadmin(self, ctx, user: discord.Member):\n self.settings.addAdmin(user.id)\n await ctx.send(\"done\")", "def addAdmin(self, softwareProfileName, adminUsername):\n return self._sp_db_api.addAdmin(softwareProfileName, adminUsername)", "def cmd_addadmin_private(self, argument):\n ...
[ "0.7431501", "0.69612104", "0.69173306", "0.6861339", "0.6813076", "0.6811589", "0.6779468", "0.6773782", "0.67275375", "0.6693339", "0.6648171", "0.66383785", "0.66203934", "0.64802665", "0.63945043", "0.61657405", "0.6165614", "0.6116291", "0.60149425", "0.6012939", "0.6005...
0.74137247
1
Given a frame from the camera and a destination, figure out which direction to take next
def get_next_direction(current_frame, scanner, code): # ### thresholding. susceptible to glare, solve with masking tape? thresh = cv2.cvtColor(current_frame, cv2.COLOR_BGR2GRAY) # success, thresh = cv2.threshold(thresh, BW_THRESHOLD, 255, cv2.THRESH_BINARY) # if not success: # print "Could not threshold fra...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def camera_frame_directions(self) -> _BFRAME_TYPE:\n pass", "def camera_frame_directions(self) -> _BFRAME_TYPE:\n\n return self._base_frame_directions", "def get_direction(position, next_position):\n x, y = position\n next_x, next_y = next_position\n if x == next_x:\n if y < next_...
[ "0.694612", "0.6346096", "0.6220887", "0.61938536", "0.6123104", "0.606547", "0.60267913", "0.59429306", "0.5911182", "0.5875572", "0.5870038", "0.5853388", "0.5850153", "0.5848268", "0.5836786", "0.58342284", "0.5824965", "0.58235735", "0.58171266", "0.5813398", "0.5795338",...
0.6649756
1
Given a frame from the camera, figure out the line error
def get_line_error(im): ### Crop the picture height = len(im) width = len(im[0]) im = im[height/CROP_RATIO:-height/CROP_RATIO, width/CROP_RATIO:-width/CROP_RATIO] ### thresholding. susceptible to glare, solve with masking tape? thresh = cv2.cvtColor(im, cv2.COLOR_BGR2GRAY) success, thresh = cv2.thresho...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_linear_track_error(self):\r\n return self._arm.get_linear_track_error()", "def error(line, data): # error function\n # Metric: Sum of squared Y-axis differences\n err = np.sum((data[:, 1] - (line[0] * data[:, 0] + line[1])) ** 2)\n return err", "def error(self) -> Sequence[float]:\n ...
[ "0.6348194", "0.6194607", "0.6192224", "0.5972827", "0.5821756", "0.58052456", "0.57963437", "0.5735557", "0.5705652", "0.5681445", "0.5633082", "0.5596675", "0.55598956", "0.5546809", "0.5519722", "0.54857236", "0.5475193", "0.54616123", "0.5458455", "0.54289025", "0.5419931...
0.67456424
0
Given a frame from the camera, figure out the desired speed and current line error
def compute_speed_and_line_error(current_frame, scanner, code): next_direction = get_next_direction(current_frame, scanner, code) if next_direction == 'STOP': return STOP line_error = get_line_error(current_frame) if line_error is None: return None return (2, line_error)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc_acc_frame(velocity, step_size, frame, vel_start_frame):\n #The offset required due to the velocities starting a vel_start_frame\n acc_offset = frame - vel_start_frame + 1\n if ((acc_offset) < step_size):\n raise IndexError(\"Acceleration cannot be calculated for this frame\")\n else:\n ...
[ "0.6475174", "0.63403714", "0.5990031", "0.5899495", "0.5873651", "0.58731246", "0.5788477", "0.57712096", "0.57585996", "0.5747586", "0.57444304", "0.56175065", "0.56138253", "0.5610825", "0.56059897", "0.55898684", "0.55860823", "0.5576143", "0.5572634", "0.5566797", "0.554...
0.6958017
0
Initialize a Student instance with given name and the number of scores to associate with the given Student.
def __init__(self, name: str, number: float): self._name = name self._scores = [0] * number
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, name, number):\n self._name = name\n self._scores = []", "def __init__(self, name, age, student_id, courses):\n self.name = name\n self.age = age\n self.student_id = student_id\n self.courses = courses\n\n # When adding a student, increment the\n ...
[ "0.68761146", "0.6798942", "0.660163", "0.65491754", "0.6526323", "0.64837736", "0.64603394", "0.64021593", "0.6373097", "0.61487335", "0.59534216", "0.5864722", "0.58540154", "0.5832365", "0.5794798", "0.5733008", "0.5677068", "0.5636913", "0.56352925", "0.5627736", "0.55593...
0.687974
0
Calculate the average score associated with this Student.
def get_average(self) -> float: return sum(self._scores) / len(self._scores)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getAverage(self):\n return sum(self.scores) / len(self.scores)", "def get_mean_score(rating_scores):\n return sum(rating_scores) / len(rating_scores)", "def get_average(self):\n self.avg = math.floor((self.maths + self.phy + self.che) / 3, )\n self.assign_grade()\n return self....
[ "0.79639894", "0.73673606", "0.7196625", "0.71720856", "0.7162906", "0.71442413", "0.70670134", "0.7030095", "0.7030095", "0.6999512", "0.69382113", "0.69370216", "0.6887286", "0.68780196", "0.6849795", "0.6842055", "0.6833306", "0.6798177", "0.6760756", "0.6755839", "0.67513...
0.78896713
1
Constructor creates a number with the given numerator and denominator and reduces it to lowest terms.
def __init__(self, numerator: int, denominator: int): self._numerator = numerator self._denominator = denominator self._reduce()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, numerator, denominator=1):\n if (type(numerator) not in(int,float)):\n raise ValueError('Numerator must be a number')\n if (type(denominator) not in(int,float)):\n raise ValueError('Denominator must be a number')\n if denominator == 0:\n if n...
[ "0.7272838", "0.71475744", "0.6812566", "0.6804737", "0.6622814", "0.6595566", "0.6460698", "0.6444287", "0.64000016", "0.6399492", "0.63688904", "0.6362692", "0.6287831", "0.62010443", "0.60404706", "0.5914123", "0.57778704", "0.5751536", "0.5651751", "0.560133", "0.5544102"...
0.7570159
0
Returns the current pin.
def get_pin(self) -> str: return self._pin
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pin(self) -> int:", "async def get_pin_thread(self) -> int:\n return await self.AD.threading.get_pin_thread(self.name)", "def get_current_address(self):\n pass", "def read(self):\n if self.mode == UNAVAILABLE:\n raise IOError, \"Cannot read pin %s\"% self.__str__()\n ...
[ "0.68164206", "0.6619968", "0.64361113", "0.64119536", "0.632375", "0.6322167", "0.62348837", "0.6177347", "0.6095625", "0.6095085", "0.6087233", "0.6051547", "0.6041345", "0.6023839", "0.59682727", "0.59486204", "0.59245473", "0.59245473", "0.59241426", "0.59072316", "0.5895...
0.80345154
0
If the amount is valid, subtract it from the balance and returns None; otherwise, returns an error message.
def withdraw(self, amount): if amount < 0: return "Amount must be >= 0" elif self._balance < amount: return "Insufficient funds" else: self._balance -= amount return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_fail_balance_negative(self):\n self.bundle.transactions[3].value -= 1\n\n validator = BundleValidator(self.bundle)\n\n self.assertFalse(validator.is_valid())\n\n self.assertListEqual(\n validator.errors,\n\n [\n 'Bundle has invalid balance (expected 0, actual -1).',\n ],\...
[ "0.6829546", "0.665555", "0.6612244", "0.65875065", "0.6495299", "0.6483181", "0.62700593", "0.6266016", "0.622912", "0.62264717", "0.6190278", "0.6178433", "0.603522", "0.6021789", "0.6011362", "0.5971348", "0.5929509", "0.5925402", "0.59032834", "0.5886347", "0.5868926", ...
0.7301331
0
Computes, deposits, and returns the interest.
def compute_interest(self) -> float: interest = self._balance * SavingsAccount.RATE self.deposit(interest) return interest
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def total_interest(self):\n return sum(self.table[\"interest\"])", "def total_interest(self) -> Decimal:\n return self._quantize(self.schedule(int(self.term / self.term_multiplier * self.n_periods)).total_interest)", "def investment(principal, interest):\r\n while True:\r\n principal *= (1 + ...
[ "0.6494362", "0.6311625", "0.6234926", "0.61784625", "0.61245126", "0.5884585", "0.5769434", "0.57603633", "0.5738999", "0.5728413", "0.57176214", "0.5580446", "0.5550851", "0.5508479", "0.55062574", "0.54875445", "0.54787284", "0.54710907", "0.54048574", "0.5400234", "0.5348...
0.74920017
0
This request returns all the colors in an image as RGB values.
def color(self, image): response = self._send_request("color", files=dict(image=image)) return response[self._layer]['colors']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_colors(self, url):\n fd = urlopen(url)\n f = io.BytesIO(fd.read())\n im = Image.open(f)\n palette = im.quantize(colors=len(self.lights)).getpalette()\n return self.extract_colors(palette, len(self.lights))", "def retrieveColor(image):\n w, h, dim = image.shape\n ret = np.zeros((w, h,...
[ "0.7301836", "0.7018421", "0.683226", "0.6683104", "0.6672693", "0.6624762", "0.6596658", "0.6569393", "0.646526", "0.646526", "0.63765454", "0.63485533", "0.6336055", "0.63002443", "0.6296228", "0.625343", "0.6228482", "0.6222722", "0.62008834", "0.61840725", "0.6144083", ...
0.7611546
0
Create instances of each available layer.
def __init__(self): for layer in self._layer_class_map: setattr(self, layer, self._layer_class_map[layer]())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build(self):\n\n layers = GiraffeLayer.get_all_structural()\n \n for layer in layers:\n\n self.add_objects_from_layer(layer)\n\n return self", "def init_layers(self):\n\n # get caching layers activated\n caching_layers = G3WCachingLayer.objects...
[ "0.676467", "0.6691837", "0.66686845", "0.64733326", "0.640632", "0.6375107", "0.6259991", "0.6259991", "0.6215809", "0.6148475", "0.6107703", "0.6078645", "0.606979", "0.60238254", "0.59650904", "0.59550387", "0.595401", "0.59325004", "0.5912907", "0.58784574", "0.5870248", ...
0.6919045
0
Set value to the tensor.
def set_value(self, indices, val): assert len(indices) == 3, indices if self.model_tensor is None: raise ValueError("Please set the tensor") self.model_tensor[indices[0], indices[1], indices[2]] = val return val
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Update(self, value):\n self.SetValue(self.GetValue() + tf.cast(value, self.dtype))", "def Update(self, value):\n self.SetValue(self.GetValue() + tf.cast(value, self.dtype))", "def set_node_value(node: Node, value: np.ndarray):\n if node.type != 'Const':\n raise Exception('Can\\'t set value ...
[ "0.73305565", "0.73305565", "0.7164538", "0.7106505", "0.69294816", "0.6863438", "0.67309785", "0.6588569", "0.65452635", "0.6523065", "0.6523065", "0.6513894", "0.6425833", "0.6411298", "0.6411298", "0.63991857", "0.63785946", "0.6368179", "0.63664836", "0.6361774", "0.63610...
0.76344925
0
Given a list of indices (with possible repeats), run optimization and return stats.
def best_value_many_indices(self, indices_list, **kwargs): indices_list = [tuple(x) for x in indices_list] stats = {indices: [] for indices in set(indices_list)} for indices in indices_list: stats[indices].append(self.best_value_indices(indices=indices, **kwargs)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scipy_optimize_from_indices(\n muygps: MuyGPS,\n batch_indices: np.ndarray,\n batch_nn_indices: np.ndarray,\n test: np.ndarray,\n train: np.ndarray,\n train_targets: np.ndarray,\n loss_method: str = \"mse\",\n verbose: bool = False,\n) -> np.ndarray:\n crosswise_dists = crosswise_dis...
[ "0.57875735", "0.5553495", "0.54737693", "0.54532033", "0.5412092", "0.5370195", "0.53218067", "0.52247834", "0.5223462", "0.5169793", "0.5165328", "0.5104045", "0.5101016", "0.51004094", "0.5073601", "0.50521386", "0.5042904", "0.50331867", "0.50312966", "0.5018096", "0.4991...
0.59009445
0
Compute an online update given a precomputed minibatch of data, and a model tensor.
def compute_online_update(rating_value, mb_np_orig, model_tensor_orig, idx_set, users_get_value=None, n_repeats=1, hotfix_update_hypers=None, plot_charts=Fals...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def replica_local_fn(*args, **kwargs):\n if any(\n isinstance(arg, keras_tensor.KerasTensor)\n for arg in nest.flatten((args, kwargs))):\n update_op = None\n else:\n update_op = self.update_state(*args, **kwargs) # pylint: disable=not-callable\n update_ops = []\n ...
[ "0.6139598", "0.60502064", "0.6037282", "0.59968215", "0.5993548", "0.59875697", "0.59847033", "0.5928292", "0.58975184", "0.5886014", "0.5876047", "0.58682144", "0.58607525", "0.579297", "0.5697605", "0.56715125", "0.56684655", "0.56642056", "0.5641743", "0.563186", "0.56158...
0.6717393
0
Seeds the given output Image with random pixels from the source Image.
def __seed_output_image(self, src_image: Image, out_image: Image) -> None: src_pixel_array = src_image[:, :].reshape((src_image.area, 3)) src_index_array = np.random.choice(np.arange(src_image.area), out_image.area) out_image[:, :] = np.take(src_pixel_array, src_index_array, axis=0).reshape(out_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def randomize_pixels(image):\n shape_ = image.size()\n image_flat = image.view(-1, image.size(-1))\n shuffled_image = shuffle(image_flat)\n return shuffled_image.view(shape_)", "def setUp(self):\n self.image = np.random.randint(\n 0, 256, size=(10, 10, 3)).astype('uint8')", "def p...
[ "0.68415916", "0.65006113", "0.6458804", "0.63344526", "0.6230885", "0.62036294", "0.6179382", "0.5990032", "0.5980545", "0.5975108", "0.59486", "0.59019417", "0.5884772", "0.58742434", "0.58631706", "0.58573", "0.58512574", "0.5831452", "0.5810674", "0.57992274", "0.5780533"...
0.81843376
0
Renders the given pixel in the specified layer of the output Pyramid using the colour of a pixel from the source Pyramid with the closest neighbourhood to the output pixel.
def __render_output_pixel(self, src_pyramid: Pyramid, out_pyramid: Pyramid, level: int, out_point: Point) -> None: if level == self.__levels - 1: distances = self.__make_distance_matrix(src_pyramid[level], out_pyramid[level], self.__neighbourhood_padding[level], out_point, True) else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render_pixel(game_map: PreGameMap, coord: Coordinate):\n if not((0 <= coord[0] < game_map.size[0]) and (0 <= coord[1] < game_map.size[1])):\n return\n terrain = TERRAIN.get(coord, None)\n if terrain == 'sea':\n game_map.display_coord(coord, 'blue')\n return\n if terrain is None...
[ "0.5802858", "0.5658782", "0.54832906", "0.54623395", "0.5383574", "0.53326017", "0.5214478", "0.520735", "0.5191128", "0.51251477", "0.50873256", "0.5066412", "0.49981758", "0.49971747", "0.49680513", "0.49348786", "0.49256635", "0.4886838", "0.48779047", "0.48769373", "0.48...
0.74728173
0
Returns a matrix containing the weighted squared difference of the pixel values between each window in the source Image and the window extracted from the output Image at the specified Point with the given padding.
def __make_distance_matrix(self, src_image: Image, out_image: Image, padding: int, out_point: Point, causal: bool) -> np.ndarray: # Extract the reference window and for the neighbourhood matching. out_window = out_image.extract(out_point, padding, 'wrap') out_filled = out_image.filled(out_point,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def padding(self):\n pad = self.ntiles - self.windowsize\n return (int((pad - 1)/2.), int((pad + 1)/2.))", "def padding(self):\n\t\treturn self.paddings_shape_param('W')", "def convolution(img, kernel, padding=True):\n result = np.zeros_like(img)\n p_size_i = kernel.shape[0] // 2\n p_siz...
[ "0.59613675", "0.5644716", "0.55131125", "0.5483496", "0.54455864", "0.53608745", "0.53575754", "0.5356096", "0.5319758", "0.5300092", "0.52018", "0.5187523", "0.5163065", "0.5131752", "0.5121635", "0.50840497", "0.50273937", "0.500391", "0.49987105", "0.49745652", "0.4957173...
0.66690564
0
Updates the mouse_over variable and returns the button's action value when clicked.
def update(self, mouse_pos, mouse_up): if self.rect.collidepoint(mouse_pos): self.mouse_over = True if mouse_up: return self.action else: self.mouse_over = False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mouse_over(self):\n pass", "def update_button_hover_status(self):\n for button in self.playing_buttons:\n button.update(self.mousePos)", "def mouse_hover(self):\n self.color1 = self.color # Color changes\n position = pygame.mouse.get_pos() # Get mouse position\n ...
[ "0.63936216", "0.62173915", "0.618309", "0.6071253", "0.60500014", "0.5977573", "0.583766", "0.57638043", "0.56980425", "0.5674184", "0.5642134", "0.5620496", "0.5582014", "0.5577019", "0.55757505", "0.5544018", "0.55341464", "0.55198807", "0.55091316", "0.5495941", "0.545860...
0.6484619
0
Draws element onto a surface
def draw(self, surface): surface.blit(self.image, self.rect)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw(self, surface):\r\n if self.visible:\r\n surface.blit(self.image, (self.x, self.y))", "def draw(self, surface):\n surface.blit(self.image, self.rect)", "def draw(self, surface):\n surface.blit(self.image, self.rect)", "def draw(self, surface):\n\n\t\tsurface.blit(self...
[ "0.8029322", "0.7931684", "0.7931684", "0.7848772", "0.77393", "0.7583257", "0.75462705", "0.74494654", "0.73914146", "0.73739934", "0.7322107", "0.728858", "0.71618783", "0.7161633", "0.7157818", "0.71283376", "0.7125859", "0.7120794", "0.7112475", "0.7098524", "0.7094169", ...
0.7984203
1
Handles game loop until an action is return by a button in the buttons sprite renderer.
def game_loop(screen, buttons): while True: mouse_up = False for event in pygame.event.get(): if event.type == pygame.MOUSEBUTTONUP and event.button == 1: mouse_up = True screen.fill(BLACK) for button in buttons: ui_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def callback_game_loop(self) -> None:\n self._goal_generate()\n self._update()\n self.reset()\n\n while self._player != self._goal:\n self._update()\n action = self._action_callback(\n self._player.np,\n self._goal.np,\n ...
[ "0.65111536", "0.6462207", "0.6459699", "0.6442829", "0.6415537", "0.64030033", "0.63696444", "0.635908", "0.6352003", "0.63030666", "0.62873745", "0.6223671", "0.62234336", "0.61902213", "0.61875373", "0.6147553", "0.61422455", "0.61360407", "0.6135536", "0.6128289", "0.6121...
0.7331514
0
handle a keypress space > take a screen shot tab > start/stop recording a screencast escape > quit
def onKeypress(self, keycode): # space if keycode == 32: self._captureManager.writeImage('screenshot.png') # tab elif keycode == 9: if not self._captureManager.isWritingVideo: self._captureManager.startWritingVideo('screencast.avi') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def keypress(self, key): # pragma: no cover\n if key == \"s\":\n self.screenshot()\n\n elif key == \"q\" or key == \"Esc\":\n self.close()\n\n elif key == \"c\":\n self._print_camera()", "def on_key_press(symbol, modifiers):\n\n if symbol == key.BACKSPACE...
[ "0.6659243", "0.6474064", "0.6172918", "0.6085636", "0.60522807", "0.60106236", "0.59625655", "0.59214485", "0.5895227", "0.5893601", "0.5828445", "0.57692516", "0.5768595", "0.5760644", "0.5697636", "0.5668367", "0.5653859", "0.56379724", "0.5637277", "0.56291217", "0.562732...
0.7867244
0
Convert octal string to binary string.
def oct2bin(x): return bin(int(x, 8))[2:]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_binary_string_to_octal_string():\n obj = pmisc.binary_string_to_octal_string\n if sys.hexversion < 0x03000000:\n ref = (\n \"\\\\1\\\\0\\\\2\\\\0\\\\3\\\\0\\\\4\\\\0\\\\5\\\\0\\\\6\\\\0\\\\a\\\\0\"\n \"\\\\b\\\\0\\\\t\\\\0\\\\n\\\\0\\\\v\\\\0\\\\f\\\\0\\\\r\\\\0\\\\16\\\...
[ "0.75368214", "0.70557326", "0.69577855", "0.69247776", "0.6849758", "0.6813903", "0.6772026", "0.67233974", "0.66740793", "0.6569174", "0.64823663", "0.6465421", "0.64253926", "0.63317066", "0.6325535", "0.6298426", "0.61963886", "0.61666733", "0.6131182", "0.61288166", "0.6...
0.7644674
0
Convert octal string to decimal number.
def oct2dec(x): return int(x, 8)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dec2int(r: str) -> int:", "def octal_frac_to_decimal(octal_frac_string):\n result = 0.0\n for place, digit in enumerate(octal_frac_string, start=1):\n result += int(digit) * (8 ** -place)\n\n return result", "def strToDec(string):\n\tstring = string.lstrip(\"0\")\n\tif len(string) == 0:\n\t...
[ "0.7270691", "0.6982738", "0.6802102", "0.6558195", "0.63187855", "0.6228094", "0.61978084", "0.6157006", "0.6082201", "0.60479116", "0.6019029", "0.59776914", "0.59653455", "0.5915168", "0.588256", "0.5826446", "0.5811062", "0.5801341", "0.5750719", "0.5742125", "0.5740209",...
0.73984647
0
Convert octal string to hexadecimal string.
def oct2hex(x): return hex(int(x, 8))[2:]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def int2hex(n: int) -> str:", "def print_as_hex(s):\n print(\":\".join(\"{0:x}\".format(ord(c)) for c in s))", "def hex(string):\n return string.encode('hex')", "def hex2oct(x):\n # moreZero = random.choice(range(10))\n moreZero = 0\n return oct(int(x, 16)).zfill(moreZero + len(oct(int(x, 16))...
[ "0.7127962", "0.6858865", "0.67977035", "0.66891956", "0.66581327", "0.6595217", "0.65746325", "0.6475897", "0.6462714", "0.6440759", "0.6420401", "0.63975835", "0.6394663", "0.6390578", "0.6357414", "0.63572913", "0.6354585", "0.6322785", "0.6259033", "0.62520534", "0.624957...
0.79475677
0
Convert hexadecimal string to octal string.
def hex2oct(x): return oct(int(x, 16))[_oct_index:]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def oct2hex(x):\n return hex(int(x, 8))[2:]", "def hex2oct(x):\n # moreZero = random.choice(range(10))\n moreZero = 0\n return oct(int(x, 16)).zfill(moreZero + len(oct(int(x, 16)))).strip('L')", "def to_octal(number: int) -> str:\n return oct(number).replace(\"0o\", \"\")", "def test_binary_st...
[ "0.7262856", "0.6970385", "0.6871056", "0.6547219", "0.6355148", "0.626188", "0.6197579", "0.608063", "0.60802263", "0.6070935", "0.6067904", "0.6041254", "0.6039679", "0.6004906", "0.5979743", "0.59688586", "0.59631056", "0.5912364", "0.5895775", "0.5880666", "0.5853619", ...
0.7017675
1
Get the first identifier for the next month.
def _next_yymm_id(self, identifier: Identifier) -> Optional[Identifier]: next_yymm_id = None if identifier.year is not None and \ identifier.month is not None: new_year = identifier.year new_month = identifier.month + 1 new_num = 1 if new_m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def first_of_next_month(ref_date):\n year, month = add_months(ref_date.year, ref_date.month, 1)\n return type(ref_date)(year, month, 1)", "def _next_id(self, identifier: Identifier) -> Optional['Identifier']:\n next_id = None\n if identifier.year is not None and \\\n identifier...
[ "0.71140623", "0.70819384", "0.65288323", "0.64989054", "0.64522034", "0.6431146", "0.6364784", "0.63500136", "0.63453865", "0.62631005", "0.6257072", "0.6244404", "0.6200054", "0.6192637", "0.6188998", "0.6186235", "0.6151943", "0.61216503", "0.61216503", "0.61076903", "0.60...
0.74007684
0
Get previous consecutive Identifier relative to provided Identifier.
def _previous_id(self, identifier: Identifier) -> Optional['Identifier']: previous_id = None if identifier.year is not None and \ identifier.month is not None and \ identifier.num is not None: new_year = identifier.year new_month = identifier.month...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_previous_id(identifier: Identifier) -> Optional[Identifier]:\n return current_session().get_previous_id(identifier)", "def getPreviousElement(self,currentId):\n\tids = self.getObjectIds()\n\tpreviousId = None\n\tfor id in ids:\n\t if id == currentId:\n\t\treturn previousId\n\t else:\n\t\tpreviou...
[ "0.68398184", "0.6584527", "0.63730377", "0.63493836", "0.6142223", "0.6125821", "0.61153346", "0.597462", "0.5952775", "0.5942755", "0.5874705", "0.5858013", "0.5850779", "0.57981914", "0.5797494", "0.57876164", "0.57495373", "0.5744229", "0.5709335", "0.56956834", "0.566618...
0.6983114
0
Parse arXiv .abs file.
def parse_abs_file(filename: str) -> DocMetadata: try: with open(filename, mode='r', encoding='latin-1') as absf: raw = absf.read() except FileNotFoundError: raise AbsNotFoundException except UnicodeDecodeError as e: # TODO: log this ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load(filename):\n o = open(filename)\n s = o.read()\n a = ArffFile.parse(s)\n o.close()\n return a", "def parser(path):\n\t\n\tdata = Arff()\n\tdata.read_arff(path)\n\t\n\treturn data", "def read_abinit(filename='abinit.in'):\n\n from ase import Atoms, units\n\n if ...
[ "0.6293335", "0.5960045", "0.5839446", "0.56938064", "0.5470229", "0.54585195", "0.5442415", "0.5383238", "0.5345072", "0.5325224", "0.53108054", "0.530532", "0.5262298", "0.5240521", "0.5239216", "0.5221165", "0.5207952", "0.51851124", "0.51766455", "0.51730996", "0.5159004"...
0.7341478
0
Get a specific version of a paper's abstract metadata.
def _get_version(self, identifier: Identifier, version: Optional[int] = None) -> DocMetadata: parent_path = self._get_parent_path(identifier=identifier, version=version) path = os.path.join(parent_path, (f'{iden...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_meta_from_remote(paper_id):\n # $ Query Paper\n paper = arxiv.query(id_list=[paper_id])[0]\n # $ Set the Arxiv Object to ensure Proper extraction\n return ArxivIdentity.from_arxiv_response(paper),paper", "def get_abs(self, arxiv_id: str) -> DocMetadata:\n paper_id =...
[ "0.6080023", "0.60320914", "0.5905042", "0.58196634", "0.575648", "0.5752106", "0.56954294", "0.5672822", "0.56069934", "0.5584644", "0.54881644", "0.54842895", "0.54152155", "0.5414221", "0.5410572", "0.54053754", "0.5396079", "0.53368646", "0.5315691", "0.52807045", "0.5266...
0.6086258
0
Get the absolute parent path of the provided identifier.
def _get_parent_path(self, identifier: Identifier, version: Optional[int] = None) -> str: parent_path = os.path.join( (self.latest_versions_path if not version else self.original_versions_path), ('arxiv' if not identifier.is_old_id or identifier.arch...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_parent(self, id_) -> str:\n return list(self._nodes[id_]['parents'].keys())[0]", "def parent_dir_path(path):\n return absolute_path(os.path.dirname(path))", "def get_parent_id_from_trace_id():\n trace_id = get_trace_id()\n return trace_id.parent_id", "def get_parent(path):\n\n # secu...
[ "0.74234164", "0.7001471", "0.698503", "0.69271344", "0.69162315", "0.6713711", "0.6697498", "0.66670144", "0.66431475", "0.66178703", "0.6597941", "0.6594848", "0.6549766", "0.6548474", "0.6538243", "0.6464383", "0.64623785", "0.64418644", "0.64418644", "0.63819927", "0.6351...
0.7567351
0
Parse the version entries from the arXiv .abs file.
def _parse_version_entries(arxiv_id: str, version_entry_list: List) \ -> Tuple[int, List[VersionEntry], str]: version_count = 0 version_entries = list() for parsed_version_entry in version_entry_list: version_count += 1 date_match = RE_DATE_COMPONENTS.match(pa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_abs_file(filename: str) -> DocMetadata:\n try:\n with open(filename, mode='r', encoding='latin-1') as absf:\n raw = absf.read()\n except FileNotFoundError:\n raise AbsNotFoundException\n except UnicodeDecodeError as e:\n # TODO: log thi...
[ "0.6567073", "0.5690683", "0.56216645", "0.5586731", "0.5546465", "0.55331504", "0.5424544", "0.5418142", "0.5321359", "0.5282709", "0.52254856", "0.5218742", "0.52110106", "0.5190335", "0.51662725", "0.5163971", "0.5161085", "0.51590484", "0.5139128", "0.5135782", "0.5133198...
0.6053738
1
Get list of dissemination formats.
def get_dissemination_formats(docmeta: DocMetadata, format_pref: Optional[str] = None, add_sciencewise: bool = False) -> List: return current_session().get_dissemination_formats(docmeta, format_pref, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def formats(self):\n logger.debug(\"Get formats\")\n return self._raw_api.formats.get()", "def getFormats(self):\n return self.formats", "def get_export_formats(self):\n return [f for f in self.formats if f().can_export()]", "def export_formats(self):\n return list(self._ex...
[ "0.7676491", "0.72095263", "0.6843036", "0.676619", "0.6653835", "0.664365", "0.65041065", "0.6443467", "0.64138347", "0.60489416", "0.6047862", "0.6045683", "0.60069233", "0.60045713", "0.59716725", "0.5901643", "0.58269656", "0.580406", "0.57598495", "0.56726515", "0.566924...
0.745034
1
get the closest mesh triangles ids from a transomr position
def closestTriangleToTransform(transform, meshName): faceVertices, points = meshData.getMeshData(meshName) vertexFaces = meshData.getMeshVertexFaces(faceVertices) point = np.array(cmds.xform(transform, q=1, ws=1, t=1), dtype=np.double) return meshData.getClosestTriangle(point, points, vertexFaces, faceV...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def MeshVtxAdjacentVtxs (strMesh, index, blnAbsolutConnections=False, blnCreate=False):\n \"\"\"custom function\"\"\"\n #-----------------------------------------------------------------------------------------------------------------------------------------\n def CullDuplicates(seq, idfun=None): \n ...
[ "0.5805424", "0.57145", "0.56526566", "0.565149", "0.56275636", "0.55619234", "0.55525434", "0.545092", "0.54096115", "0.53921366", "0.538401", "0.536471", "0.5312883", "0.5299891", "0.5299523", "0.52991015", "0.52976525", "0.5295863", "0.5291774", "0.5280542", "0.52317286", ...
0.59132826
0
get the skinweights form the skincluster, create a skintransforms node and connect it to drive the transforms
def createSkinTansformNode(skinCluster, transforms): node = cmds.createNode('skinTransforms') influences = cmds.listConnections('{}.matrix'.format(skinCluster), s=1, d=0) for i, jnt in enumerate(influences): cmds.connectAttr('{}.worldMatrix[0]'.format(jnt), '{}.matrix[{}]'.format(node,i)) m ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy_cluster_weights(shape, weight_file, method=\"bilinear\"):\n\n # gets the temporary folder path\n temp_path = get_temp_folder()\n short_name = get_prefix_less_name(shape)\n\n for node in weight_file:\n if not weight_file[node]:\n continue\n cmds.deformerWeights(weight_f...
[ "0.60992557", "0.59548813", "0.5897242", "0.58499587", "0.5831983", "0.57551503", "0.57265556", "0.5725397", "0.5677713", "0.54353786", "0.5421846", "0.5350296", "0.5301341", "0.5252528", "0.5239307", "0.52385575", "0.52209234", "0.5210054", "0.52021974", "0.51798564", "0.517...
0.72898114
0
Changes the value of var to value, in target card json target
def doEdit(var, value, target): currentValue = target.get(var, "") newValue = Simplifier.simplify(str(value).replace(f"{{{var}}}", str(currentValue))) target[var] = newValue
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_var(self,variable,value):\n self.template=self.template.replace(\"@{}@\".format(variable),value)", "def updateValue(self):\n self.value = self.var.get()", "def set_variable(self, request, context):\n response = SetVariableResponse()\n value = decode(request.value)\n s...
[ "0.5401657", "0.53921354", "0.5373613", "0.53605235", "0.5335546", "0.5331462", "0.5317318", "0.5298089", "0.5265769", "0.5262278", "0.52587116", "0.5233701", "0.520725", "0.514586", "0.51372725", "0.50887924", "0.5060526", "0.5028422", "0.50151414", "0.5007186", "0.49935517"...
0.5842602
0
Return a numeric PIN with length digits
def get_pin(length=6): pin = str(random.sample(range(10 ** (length - 1), 10 ** length), 1)[0]) print("pin "+pin) return pin
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __generate_pin(cls) -> str:\n return str(randbelow(10 ** cls.PIN_DIGITS)).zfill(cls.PIN_DIGITS)", "def get_pin_digits(pin):\n digits = []\n for i in range(1, 5):\n digit = pin % 10\n pin = int(pin / 10)\n digits = [digit] + digits\n return digits", "def number2patten(nu...
[ "0.74236387", "0.70152956", "0.6587809", "0.64308965", "0.62868375", "0.6269005", "0.6230067", "0.6148351", "0.6140739", "0.6132022", "0.6079048", "0.6036217", "0.59997034", "0.5981399", "0.59480107", "0.5926849", "0.5907118", "0.58957", "0.5892246", "0.58810383", "0.587727",...
0.76024115
0
Fixture for DataFrame of ints which are constant per column
def int_frame_const_col(): df = DataFrame( np.tile(np.arange(3, dtype="int64"), 6).reshape(6, -1) + 1, columns=["A", "B", "C"], ) return df
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _to_constant_df(self, num):\n if isinstance(num, pd.DataFrame):\n# pdb.set_trace()\n return num\n else:\n return self.data['ones'].copy() * num", "def test_df():\n return pd.DataFrame({\n 'intcol': [1, 2, 3],\n 'strcol': ['four', 'five', 'six'],...
[ "0.62194395", "0.60628957", "0.5972536", "0.57523376", "0.5721764", "0.56640995", "0.56414294", "0.5635445", "0.559424", "0.5559713", "0.55304813", "0.5526375", "0.5492284", "0.54894716", "0.5483786", "0.5478982", "0.5412668", "0.5365263", "0.5359209", "0.5358688", "0.5310620...
0.6852467
0
Logs a message, preserving the progress bar correct output format.
def log_message(self, message: str) -> None: from tqdm import tqdm tqdm.write(message, file=self.tqdm_kwargs.get("file", None))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_message(self, message):\n if self.root.is_logging:\n if len(repr(str(msg))) < 1:\n stdout(msg)\n self.root.log_file.write(\"%.4f\" % time.time() + \" \" + repr(str(msg)) + \"\\n\")\n return", "def log_and_print(self, message):\n self.f.write(messa...
[ "0.72831756", "0.7170845", "0.71509373", "0.7105534", "0.7096617", "0.6908535", "0.6884731", "0.6878834", "0.6869885", "0.682706", "0.67774737", "0.6756506", "0.67553526", "0.67249006", "0.67246664", "0.6717832", "0.6699004", "0.66793716", "0.66682446", "0.66388786", "0.66219...
0.73927295
0
Encode the sequence as a list of floats using the provided vocab.
def encode_dna_as_floats(sequence: Iterable[str], vocab: str = dc_constants.VOCAB, offset: int = 0) -> Optional[Iterable[float]]: ids = [] for base in sequence: if base not in vocab: return None base_id = float(vocab.index(base) + offset) ids.appe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def put_float_list_to_feature(seq_example: tf.train.SequenceExample,\n value: Sequence[Sequence[float]], key: str):\n for s in value:\n seq_example.feature_lists.feature_list.get_or_create(\n key).feature.add().float_list.value[:] = s", "def encode_sequence(text: List[str]...
[ "0.55322623", "0.55027866", "0.54789644", "0.5260034", "0.5258647", "0.5159166", "0.5092331", "0.50536036", "0.5027336", "0.50256157", "0.50224316", "0.50179625", "0.5005602", "0.5005602", "0.49933308", "0.49916053", "0.49875823", "0.49784765", "0.49743456", "0.49743456", "0....
0.67705715
0
Returns the sequence with GAP_OR_PAD and GAP_OR_PAD tokens removed.
def get_sequence_without_gaps_or_padding(sequence: str) -> str: return sequence.replace(dc_constants.GAP_OR_PAD, '').replace(dc_constants.GAP_OR_PAD, '')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ungapped(self):\n s = self.sequence\n for sGapChar in GAP_CHARACTERS:\n s = s.replace(sGapChar, '')\n return s", "def remove_guff(seqs):\n new_seqs = {}\n stop_codons = [\"TGA\", \"TAA\", \"TAG\"]\n for key, value in seqs.items():\n new_seq = \"\"\n for ...
[ "0.6750863", "0.5907528", "0.5521466", "0.5289905", "0.5231796", "0.51557064", "0.50116265", "0.4972692", "0.49560896", "0.49461672", "0.4935586", "0.48857594", "0.48742893", "0.4835272", "0.4817296", "0.48110196", "0.4809287", "0.4806622", "0.47794852", "0.47744012", "0.4755...
0.68402666
0
Returns start and end coordinates of label in the reference genome. Querying the reference genome for these coordinates will produce the label sequence. We need to add 1 to either start or end depending on the orientation of the reference.
def get_label_start_end( label_base_positions: Iterable[int], strand: bed_pb2.BedRecord.Strand) -> Tuple[Optional[int], Optional[int]]: # Gap and padding tokens may have a position of -1, since they are not # actually present in the reference. Remove all instances of -1, since we do # not want to consider...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def labelpos(self):\n return self._labelpos", "def get_ref_and_start_and_offset(forward_ref_sequence: str,\n strand: bed_pb2.BedRecord.Strand,\n chrom_start: int,\n chrom_end: int) -> Tuple[str, int, int]:\n r...
[ "0.6364321", "0.6140304", "0.61087877", "0.60330933", "0.60321313", "0.575407", "0.5750131", "0.57237166", "0.55922985", "0.55865574", "0.55369616", "0.5511564", "0.5482404", "0.5407526", "0.53941387", "0.53722996", "0.5353169", "0.5347849", "0.53471684", "0.53188986", "0.528...
0.6887572
0
Gets subreads/encoded field from example as a string.
def get_encoded_subreads_from_example(example): return example.features.feature['subreads/encoded'].bytes_list.value[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_field(self, bib_entry, field):\n output = bib_entry.fields[field] if field in bib_entry.fields else \"\"\n return self.strip_braces(output)", "def __str__(self):\n outstr = self._field1\n return outstr", "def get_encoded_label_from_example(example):\n return example.feature...
[ "0.5705618", "0.5460794", "0.5459715", "0.539829", "0.5357855", "0.5356727", "0.5356727", "0.5356539", "0.53236294", "0.5237667", "0.5237599", "0.5225943", "0.5169422", "0.51572955", "0.5146009", "0.5126784", "0.51213324", "0.51131326", "0.5083494", "0.5076718", "0.5053751", ...
0.70664877
0
Gets the subreads/shape field from example as a list of int64.
def get_subreads_shape_from_example(example): assert len(example.features.feature['subreads/shape'].int64_list.value) == 3 return example.features.feature['subreads/shape'].int64_list.value[:]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_encoded_subreads_from_example(example):\n return example.features.feature['subreads/encoded'].bytes_list.value[0]", "def read_ints(self):\n return self.numbers", "def as_list(self) -> List[int]:\n return self.my_partition", "def get_list_of_int2(self):\n pass", "def getIntArra...
[ "0.6184817", "0.5882475", "0.5881324", "0.57822245", "0.57525074", "0.56289333", "0.5594792", "0.5497891", "0.54603356", "0.5455274", "0.5443167", "0.54085", "0.53583235", "0.5348249", "0.53445643", "0.53237766", "0.53161526", "0.53096575", "0.5279014", "0.52352875", "0.52090...
0.7593962
0
Gets the subreads/num_passes field from example as a list of int64.
def get_num_passes_from_example(example): assert len( example.features.feature['subreads/num_passes'].int64_list.value) == 1 return example.features.feature['subreads/num_passes'].int64_list.value[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getRefReads(self):# -> int\n return self.refReads", "def list_of_runnums (ins, exp) :\n try : expruns = experiment_info.experiment_runs(ins, exp)\n #if exp == 'xcs83814' : return []\n except : return []\n\n return [int(rec['num']) for rec in expruns]\n #runs = experiment_info.experiment...
[ "0.5838554", "0.57468516", "0.57462114", "0.55311155", "0.5446684", "0.5408164", "0.5309831", "0.5301768", "0.527564", "0.52182186", "0.51577634", "0.5125342", "0.5124437", "0.51199293", "0.51196676", "0.5108761", "0.506709", "0.5051076", "0.5049883", "0.5034971", "0.5034971"...
0.78519976
0
Gets label/encoded field from example as a string.
def get_encoded_label_from_example(example): return example.features.feature['label/encoded'].bytes_list.value[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def label_from_example(example):\n val = example.features.feature['label'].int64_list.value\n if val:\n return int(val[0])\n else:\n return None", "def get_label(self, which_label: str, extra_label: str) -> str:\n result = self.row_dict.get(extra_label)\n if result:\n # We will ...
[ "0.6567466", "0.6203385", "0.6174128", "0.6174128", "0.6174128", "0.6174128", "0.60609", "0.60340345", "0.5977775", "0.59713846", "0.5863954", "0.58526266", "0.58526266", "0.58526266", "0.57978487", "0.5788342", "0.57807505", "0.57807505", "0.57807505", "0.57807505", "0.57807...
0.7369651
0
Gets the label/shape field from example as a list of int64.
def get_label_shape_from_example(example): assert len(example.features.feature['label/shape'].int64_list.value) == 1 return example.features.feature['label/shape'].int64_list.value[:]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def label_from_example(example):\n val = example.features.feature['label'].int64_list.value\n if val:\n return int(val[0])\n else:\n return None", "def provide_label(self):\n return [(k, v.shape) for k, v in self.label]", "def provide_label(self):\r\n return [(k, tuple([1] + list(v.shape...
[ "0.679036", "0.6569586", "0.62951785", "0.6134868", "0.6108419", "0.59921026", "0.59756845", "0.5952071", "0.5952071", "0.59401375", "0.58788294", "0.5849895", "0.5831298", "0.5816761", "0.5816761", "0.5807753", "0.5801871", "0.5795513", "0.5795513", "0.5795513", "0.5794914",...
0.74587005
0
Gets deepconsensus_input/encoded field from example as a string.
def get_encoded_deepconsensus_input_from_example(example): return example.features.feature[ 'deepconsensus_input/encoded'].bytes_list.value[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_encoded_label_from_example(example):\n return example.features.feature['label/encoded'].bytes_list.value[0]", "def get_encoded_subreads_from_example(example):\n return example.features.feature['subreads/encoded'].bytes_list.value[0]", "def deepconsensus_input_to_example(\n deepconsensus_input: dee...
[ "0.6439003", "0.58448774", "0.53348607", "0.5202095", "0.5010533", "0.49677646", "0.49160782", "0.4901157", "0.48838043", "0.4850435", "0.4850435", "0.4814992", "0.48128593", "0.47833014", "0.47751632", "0.46998075", "0.46935028", "0.4684098", "0.46840334", "0.4667676", "0.46...
0.81469035
0
Returns tf.Example created from the given DeepConsensusInput proto.
def deepconsensus_input_to_example( deepconsensus_input: deepconsensus_pb2.DeepConsensusInput, example_height: int, inference: bool, counters: Optional[Dict[str, metrics.Metrics.counter]] = None, ) -> Optional[tf.train.Example]: if not deepconsensus_input.subreads: if counters and counters['exampl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_encoded_deepconsensus_input_from_example(example):\n return example.features.feature[\n 'deepconsensus_input/encoded'].bytes_list.value[0]", "def _create_example(self):\n source = np.random.randn(self.batch_size, self.max_decode_length,\n self.input_depth)\n source...
[ "0.6588792", "0.5950223", "0.58684516", "0.5803522", "0.5487936", "0.5469294", "0.5404084", "0.5355273", "0.527753", "0.51956975", "0.5192631", "0.51771414", "0.516648", "0.51630205", "0.51613873", "0.51525664", "0.5150702", "0.5136441", "0.51273745", "0.5113387", "0.511311",...
0.70847815
0
Add external padding to bases, PW, IP, and cigar.
def pad_bases_pw_ip_cigar(read: deepconsensus_pb2.Subread, padded_len: int) -> None: pad_amt = padded_len - len(read.bases) if pad_amt > 0: str_padding = dc_constants.GAP_OR_PAD * pad_amt list_padding = [dc_constants.GAP_OR_PAD_INT] * pad_amt read.bases = read.bases + str_paddi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _add_padding(input_str):\r\n padding_len = AES.block_size - len(input_str) % AES.block_size\r\n return input_str + padding_len * chr(padding_len)", "def add_padding(im, pad):\n\n return np.pad(im, pad_width=((pad, pad), (pad, pad), (0, 0)), mode='symmetric')", "def pad(data):\r\n bytes_...
[ "0.6520033", "0.62590957", "0.61074096", "0.6048786", "0.60357", "0.6028013", "0.6009145", "0.60039216", "0.59985995", "0.5989889", "0.5911762", "0.5902912", "0.5881732", "0.5876407", "0.58472306", "0.5836514", "0.58284765", "0.58035165", "0.5787002", "0.57860774", "0.5778415...
0.7777972
0
Returns the max passes for bases/PW/IP.
def get_max_passes(example_height: int) -> int: return (example_height - 5) // 4
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def max_pw(self, entity):\n return float(entity['pw_bb'][1])", "def get_password_count(frm, to, is_adjascent):\n\n num = frm\n\n # make number compatible with #1\n if num < 100000:\n num = 100000\n\n digits = []\n while num > 0:\n digit = num % 10\n digits.append(digit)...
[ "0.6741339", "0.60329866", "0.58437866", "0.58013153", "0.5779518", "0.57709515", "0.57115567", "0.56688434", "0.5657231", "0.5628787", "0.5628583", "0.5627118", "0.5619595", "0.56186515", "0.56177336", "0.55893004", "0.55542743", "0.5524528", "0.55046046", "0.5483269", "0.54...
0.6484286
1
How many IPs are allowed by the blacklist? >>> example_blacklist = RangeSet.from_file(data_path(__file__, 'example.txt')) >>> print(example_blacklist) 02, 48 >>> part_2(example_blacklist, total_ips_count=10)
def part_2(ranges: 'RangeSet', total_ips_count: int = 1 << 32) -> int: allowed_count = total_ips_count - len(ranges) print(f"part 2: there are total {allowed_count} allowed IPs") return allowed_count
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_count():\n\n config = configparser.ConfigParser()\n config.read('config.ini')\n\n while True:\n try:\n for user in get_count_request():\n ip, count, protocol = str(user[0][0]), user[1][0], str(user[2][0])\n if count >= int(config[protocol]['Count R...
[ "0.57934356", "0.5705135", "0.56226957", "0.5578852", "0.5336283", "0.5191611", "0.5136622", "0.51027375", "0.50659984", "0.5059147", "0.50535524", "0.49664873", "0.49608132", "0.49188912", "0.4906973", "0.48834145", "0.4876514", "0.48726276", "0.48689985", "0.48537868", "0.4...
0.80164754
0
Logical disjunction of two ranges. Contains items present in either. However if the two ranges are disjunct (no common items), `None` is returned. >>> Range(10, 20) | Range(1, 3) >>> Range(10, 20) | Range(1, 9) Range(1, 20) >>> Range(10, 20) | Range(1, 10) Range(1, 20) >>> Range(10, 20) | Range(1, 14) Range(1, 20) >>> ...
def __or__(self, other): if not isinstance(other, Range): raise TypeError( f"unsupported operand types for |: " f"{type(self).__name__!r} and {type(other).__name__!r}" ) if self == other: return Range(self.vmin, self.vmax) elif...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ranges_overlap(start1, end1, start2, end2):\n return start1 <= end2 and end1 >= start2", "def overlap(start1, end1, start2, end2):\n return not (end1 < start2 or end2 < start1)", "def __and__(self, other):\n if not isinstance(other, Range):\n raise TypeError(\n f\"uns...
[ "0.66074175", "0.64702195", "0.6391564", "0.63127744", "0.6272544", "0.618147", "0.6166346", "0.60126203", "0.598657", "0.5985955", "0.58613884", "0.5857347", "0.5855965", "0.58527166", "0.5840612", "0.58333844", "0.5826907", "0.580981", "0.57973963", "0.5791664", "0.576489",...
0.6901047
0
Gets the donor_participant of this AllOfCreateClaimResponseClaim.
def donor_participant(self) -> Object: return self._donor_participant
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def donor_participant(self, donor_participant: Object):\n\n self._donor_participant = donor_participant", "def participant(self) -> AllOfCancelClaimRequestParticipant:\n return self._participant", "def participant(self) -> AllOfAcknowledgeClaimRequestParticipant:\n return self._participant...
[ "0.64143723", "0.62174505", "0.5898315", "0.50857437", "0.49990976", "0.48347864", "0.48060545", "0.46557683", "0.45774764", "0.45774764", "0.45192257", "0.4476471", "0.44539085", "0.4446725", "0.4414176", "0.43843213", "0.43202215", "0.43045747", "0.42562267", "0.42562267", ...
0.7721172
0
Sets the donor_participant of this AllOfCreateClaimResponseClaim.
def donor_participant(self, donor_participant: Object): self._donor_participant = donor_participant
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def participant(self, participant: AllOfCancelClaimRequestParticipant):\n if participant is None:\n raise ValueError(\"Invalid value for `participant`, must not be `None`\") # noqa: E501\n\n self._participant = participant", "def donor_participant(self) -> Object:\n return self._...
[ "0.60350543", "0.6025046", "0.55765235", "0.5541427", "0.515288", "0.4857232", "0.47399157", "0.4663719", "0.4635826", "0.45958862", "0.4552072", "0.44890487", "0.44712678", "0.44042704", "0.43036908", "0.426201", "0.42143816", "0.41979194", "0.41707268", "0.41660166", "0.416...
0.7887795
0
Writes an annotation on file according to the darkflow format.
def write_as_frcnn(annotation: pd.DataFrame, path_to_annotations: str, image_id: str): annotation.to_csv(os.path.join(path_to_annotations, '..', 'annotations.txt'), header=None, index=None, mode='a', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def writeAnnotations(b, f, ld, n=0):\n \n if args.format.lower() == 'kitti':\n writeKitty(b, os.path.join(ld, \"%06d.txt\" % n))\n elif args.format.lower() == 'voc':\n writeVOC(b, ld, f)\n elif args.format.lower() == 'darknet':\n writeDarknet(b, os.path.join(ld, \"%06d.txt\" % n))"...
[ "0.6668815", "0.6605532", "0.6497272", "0.6436646", "0.64314204", "0.6285113", "0.624797", "0.624234", "0.6178932", "0.6084837", "0.6082922", "0.6038828", "0.5981543", "0.59467894", "0.5830986", "0.5830986", "0.5819359", "0.5800235", "0.5796739", "0.57627714", "0.57070196", ...
0.67075735
0