query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Append a new job offer at the beginning of an old job list
def _write_jobs(self, new_job, old_jobs): template = Template(filename=self._jobs_template_file_path) with codecs.open(self._jobs_file_path, 'w', 'utf-8') as jobs_file: print(template.render(new_job=new_job, get_job_url=get_job_url, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_job(self, job):\n self.job_list.append(job)\n self.num_jobs += 1", "def append(self, job):\n self.jobs.append(job)\n return job", "def add_job(self, job):\n self.job_list.append(job)\n return", "def reAddJob(self, runner):\n with self.__queueLock:\n i...
[ "0.67082626", "0.6593252", "0.6590853", "0.64988285", "0.63676196", "0.62414956", "0.61544013", "0.6147807", "0.6142019", "0.6142019", "0.6052054", "0.59258604", "0.58956194", "0.58864427", "0.5875771", "0.58692414", "0.58575416", "0.5826668", "0.5737809", "0.57162756", "0.56...
0.0
-1
define RC constants for all PMTs values are from the exponential fits
def tau_RC(run = 0): tau = {} tau[0] = { 0 : 0.000528448223727 , 1 : 0.000534286124735 , 2 : 0.000531127097197 , 3 : 0.000528590936727 , 4 : 0.000523307118588 , 5 : 0.000531484578773 , 6 : 0.000522540813269 , ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def CircadianRythme(t,initial_conditions) :\n#-----------------------\n# PARAMETERS IMPORTATION\n#-----------------------\n\tfichier = 'param.csv'\n\tparam = readparam(fichier, 1)\n\n#-----------------------\n# Initial conditions : \n#-----------------------\n\n\t# mRNAs of per, Cry and Bmal : \n\tMp = initial_co...
[ "0.59947115", "0.5979338", "0.59365064", "0.5700077", "0.5584614", "0.5576223", "0.55731964", "0.55699474", "0.5451077", "0.5430894", "0.54292077", "0.54174143", "0.53537995", "0.5318765", "0.5317667", "0.53131855", "0.5313132", "0.5312092", "0.5295731", "0.5288166", "0.52866...
0.5408007
12
Mainly for debugging purposes and reward calculation
def get_observation(self , reward = False): # magnetic_ends **** open_magnetic_ends = rnadc.count_magnetic_ends(graph = self._state._graph) # sequence_length difference factor instance_counter, seq_length = self._state.get_state_counters() seq_length_difference = abs(seq_length - self._state._seq_length_thres...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_reward(self):\n # Ver list\n self.Verlist = {\n '1': False,\n '2': False,\n '3': False,\n '4': False,\n '5': True,\n }\n # --------------------------------- NEW ----\n r = 0\n if self.ENVGetSIReset:\n ...
[ "0.70444673", "0.672267", "0.66842985", "0.6675816", "0.66618603", "0.664417", "0.66124755", "0.66105366", "0.660046", "0.660046", "0.660046", "0.660046", "0.660046", "0.660046", "0.65996534", "0.65790987", "0.6563731", "0.6527801", "0.6526614", "0.6496617", "0.6487803", "0...
0.0
-1
Action trajectory recorder for Random Controller
def get_action_history(self): return self._action_history
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sample_trajectory(self, env, animate_this_episode, is_evaluation):\n # Using current task with meta inside\n env.reset_task(is_evaluation=is_evaluation)\n stats = []\n #====================================================================================#\n # ...
[ "0.6435756", "0.6201483", "0.60628945", "0.5977748", "0.59482795", "0.5931435", "0.59078723", "0.5815285", "0.57550347", "0.57478774", "0.5705742", "0.5694128", "0.56779414", "0.56674814", "0.5665087", "0.56198", "0.56031513", "0.5595908", "0.55920386", "0.5578394", "0.556598...
0.0
-1
Mainly for debugging purposes
def get_biGramTable(self): return self._state.biGramTable
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def debug():", "def compute_debug(self):", "def debug(self):\n raise NotImplementedError", "def debug() -> bool:", "def output_debug_info(self):", "def debug(self, *args, **kwargs):", "def debug(msg):", "def debug_run(self):\n raise NotImplementedError", "def NeedsDebugInfo(self):\n ...
[ "0.8190411", "0.7394609", "0.70804167", "0.6942116", "0.6908365", "0.6805495", "0.6697124", "0.6629927", "0.65502924", "0.65248924", "0.6494577", "0.6456546", "0.64328665", "0.6412611", "0.63713104", "0.63713104", "0.63713104", "0.63713104", "0.63713104", "0.63713104", "0.637...
0.0
-1
Current game tick number
def currentTick(self): return self._currentTick
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_tick():\n return _tick", "def get_current_tick():\n return _pigpio_command(_control, _PI_CMD_TICK, 0, 0)", "def get_tick_value(self):\n return self.tick", "def lastTick():", "def last_tick_time(self):\n return self.last_tick_", "def tick():\n global current\n current += 1", ...
[ "0.7729197", "0.7552153", "0.7264076", "0.7203146", "0.7004014", "0.697165", "0.697165", "0.6765588", "0.6716648", "0.6716648", "0.6700422", "0.6700422", "0.66372967", "0.6637098", "0.662143", "0.65604573", "0.6550471", "0.6546328", "0.65204513", "0.6507544", "0.6485652", "...
0.76679164
1
Time when current tick started by BigWorld.serverTime()
def currentTickStartedAt(self): return self._currentTickStartedAt
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def now():\n\treturn time.time() * 1000", "def time(self):\n return pygame.time.get_ticks() - self.start_time", "def now():\r\n return time.time()", "def current_time(cls) -> float:", "def _time(self):\n return time()", "def last_tick_time(self):\n return self.last_tick_", "def time...
[ "0.74115777", "0.73304033", "0.7298208", "0.7283902", "0.7281058", "0.72151214", "0.7213217", "0.71796346", "0.7176354", "0.71648115", "0.7153452", "0.71018744", "0.70915014", "0.7042261", "0.70142376", "0.7001907", "0.69949746", "0.69580656", "0.69186115", "0.6902324", "0.68...
0.0
-1
Create sectors data using arena settings
def createSectorsData(self): for sectorId, settings in self.arenaTypeData.sectors.sectors.iteritems(): entity = next((sector for sector in ACSector.entities if sector.ident == sectorId), None) if entity: self._sectors[sectorId] = sector = ACSectorClient.ACSectorClient(set...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def onACSectorCreated(self, entity):\n raise entity.ident in self.arenaTypeData.sectors.sectors or AssertionError(\"Unexpected sector created: '{0}', arena: {1}\".format(entity.ident, self.arenaTypeData.typeName))\n settings = self.arenaTypeData.sectors.sectors[entity.ident]\n self._sectors[en...
[ "0.55664074", "0.55636305", "0.542939", "0.5337099", "0.52993226", "0.5280087", "0.5258398", "0.5203788", "0.519687", "0.517711", "0.5176165", "0.51434815", "0.5119572", "0.5079671", "0.5027002", "0.5022975", "0.50052536", "0.49962944", "0.49929285", "0.4988988", "0.49803966"...
0.73192996
0
Return Points in tick
def getPointsInTick(self, tickNumber = None): tickNumber = tickNumber or self.currentTick score = [0, 0] for sector in self.sectors.itervalues(): if sector.teamIndex in (TEAM_ID.TEAM_0, TEAM_ID.TEAM_1): score[sector.teamIndex] += sector.getPointsInTick(tickNumber) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_points(self):\r\n return self.points", "def get_points(self):\n\t\treturn self.points", "def get_points(self) -> typing.Iterable[float]:\n raise NotImplementedError()", "def get_points(self):\n\t\treturn self._points", "def get_points(self):\n return self._points", "def get_p...
[ "0.6878397", "0.6822513", "0.6761417", "0.66511023", "0.64932066", "0.64932066", "0.6465872", "0.64656305", "0.64656305", "0.64656305", "0.64656305", "0.64656305", "0.6429709", "0.64206946", "0.63874173", "0.6366324", "0.63138926", "0.6263593", "0.62264043", "0.6152122", "0.6...
0.63498574
16
Check capture sectors by team
def teamSuperiority(self, teamIndex): sectors = 0 capturedSectors = 0 for sector in self._sectors.itervalues(): if not sector.isCapturable: continue sectors += 1 if sector.teamIndex == teamIndex: capturedSectors += 1 re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_team_owned_clouds(self):\n pass", "def test_retrieve_team(self):\n pass", "def test_get_open_requests_by_team(self):\n pass", "def _run_test_case(radio, lines):\n calc_reachable_surface_and_people(radio, lines)", "def test_boundary_boxes(gt_detection_combo):\n found ...
[ "0.585762", "0.5425284", "0.5285067", "0.51805264", "0.5127063", "0.5094818", "0.5067533", "0.50342155", "0.50342155", "0.4998648", "0.49926502", "0.49775308", "0.49333805", "0.4923098", "0.48978695", "0.487425", "0.48576087", "0.48571336", "0.48376897", "0.48255724", "0.4815...
0.5762825
1
Event handler for state changed event
def onSectorStateChanged(self, ident, oldState, state, *args, **kwargs): self.dispatch(AC_EVENTS.SECTOR_STATE_CHANGED, ident, oldState.state, oldState.teamIndex, state.state, state.teamIndex, state.nextStateTimestamp)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def state_changed(self, oldstate, newstate, event, *args, **kwargs):", "def state_changed(self, oldstate, newstate, event, *args, **kwargs):", "def state_changed(self, old_state, new_state, target_state):\n pass", "def StatusChanged(self, state, info):\n pass", "def on_state_change(self, new_...
[ "0.89258164", "0.89258164", "0.78254133", "0.7790999", "0.77453846", "0.7712101", "0.7584465", "0.7529153", "0.743796", "0.7314286", "0.7314286", "0.72914416", "0.72466034", "0.7214875", "0.7149744", "0.6995301", "0.69609445", "0.6928996", "0.69072014", "0.6897663", "0.688563...
0.0
-1
Callback from sector entity on enter world event
def onACSectorCreated(self, entity): raise entity.ident in self.arenaTypeData.sectors.sectors or AssertionError("Unexpected sector created: '{0}', arena: {1}".format(entity.ident, self.arenaTypeData.typeName)) settings = self.arenaTypeData.sectors.sectors[entity.ident] self._sectors[entity.ident...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_enter(self, userdata):\n pass", "def on_enter(self):\n\n super(BaseScene, self).on_enter()\n\n self.load_map()\n self.load_players()\n self.load_enemies()\n self.load_status_bar()\n\n self.enemies_layer.next_wave()", "def enter(self, requestStatus):\n ...
[ "0.6323127", "0.6106356", "0.60761666", "0.60585976", "0.59934866", "0.5988334", "0.58825266", "0.5833842", "0.5788801", "0.56700206", "0.56108665", "0.5576887", "0.5552568", "0.5508921", "0.5449114", "0.53695977", "0.5339965", "0.5338463", "0.529457", "0.52394", "0.5227798",...
0.5195288
25
Handler for GameActionsManager.eWaveAdded event
def _onASWaveAdded(self, record, *args, **kwargs): self.dispatch(AC_EVENTS.BOMBERS_LAUNCHED, record['sectorID'], record['targetID'], record['teamIndex'], record['waveID'], record['bomberIDsStates'], record['startTime'])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def enemy_waves(self):\n\n pass", "def OnSelfAdded(event, wavelet):\n logging.info('OnSelfAdded')\n blip = event.blip\n wavelet.title = 'A wavelet title'\n blip.append(element.Image(url='http://www.google.com/logos/clickortreat1.gif',\n width=320, height=118))\n blip.append...
[ "0.6564487", "0.6305496", "0.6295222", "0.624337", "0.6228176", "0.61882764", "0.6124069", "0.6016413", "0.5928014", "0.5927098", "0.5856141", "0.5809874", "0.57393336", "0.56411064", "0.55959076", "0.556875", "0.55132854", "0.5500313", "0.54534775", "0.5402665", "0.5397432",...
0.67384034
0
Handler for GameActionsManager.eWaveRemoved event
def _onASWaveRemoved(self, waveID, *args, **kwargs): self.dispatch(AC_EVENTS.BOMBERS_DIED, waveID)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _handle_wave_clear(self):\n if self._wave == self._level.get_max_wave():\n self._handle_game_over(won=True)", "def wave_delete(wave_id):\n return _u2i(_pigpio_command(_control, _PI_CMD_WVDEL, wave_id, 0))", "def RemoveWave(self, wave_id):\n if wave_id in self._waves:\n del self....
[ "0.72184855", "0.6400077", "0.6078642", "0.59243494", "0.568439", "0.54848194", "0.54277045", "0.540061", "0.5394511", "0.53893125", "0.5346797", "0.5292275", "0.5267865", "0.52520764", "0.52520764", "0.524276", "0.5233132", "0.5218466", "0.52099115", "0.5200941", "0.5176571"...
0.7309811
0
Handler for GameActionsManager.eWaveStateChanged event
def _onASWaveStateChanged(self, record, stateOld, state, *args, **kwargs): if state == AIR_STRIKE_WAVE_STATE.ATTACK_IN_PROGRESS and stateOld == AIR_STRIKE_WAVE_STATE.BOMBS_DROPPED: self.dispatch(AC_EVENTS.BOMBERS_ATTACK_STARTED, record['sectorID'], record['waveID'], record['size'], len(record['bombe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _handle_wave_clear(self):\n if self._wave == self._level.get_max_wave():\n self._handle_game_over(won=True)", "def updateNewWave(self):\n self.setWave(Wave())\n self.setState(STATE_ACTIVE)", "def enemy_waves(self):\n\n pass", "def wave(self):\n return self._wa...
[ "0.6617994", "0.6225838", "0.6001227", "0.59568113", "0.57056344", "0.5561393", "0.55339545", "0.5515362", "0.5397272", "0.5359885", "0.52892125", "0.5245316", "0.5243214", "0.5218238", "0.51534873", "0.5038011", "0.49959427", "0.49787053", "0.4978145", "0.4969912", "0.495556...
0.6601928
1
Handler for GameActionsManager.eBomberStateChanged event
def _onASBomberStateChanged(self, record, bomberID, stateOld, state, *args, **kwargs): if state == AIR_STRIKE_WAVE_STATE.ATTACK_NOTIFIED and stateOld == AIR_STRIKE_WAVE_STATE.INTRO_FLIGHT: self.dispatch(AC_EVENTS.BOMBER_ATTACK_NOTIFIED, record['sectorID'], record['waveID'], bomberID, record['size'],...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def event11510110():\n header(11510110, 0)\n skip_if_this_event_off(2)\n anim.end_animation(1511010, 0)\n end()\n if_player_has_item(1, ItemType.good, ITEM.KeyToSunChamber)\n if_action_button_state(1, 'object', 1511010, 60.0, 100, 1.5, 10010400, ReactionAttribute.all, pad_id=0)\n if_condition_...
[ "0.60966915", "0.5917737", "0.58220637", "0.5642345", "0.5607595", "0.55787665", "0.5578585", "0.55759805", "0.55634815", "0.55482996", "0.5500401", "0.5487836", "0.54848653", "0.5467751", "0.5443894", "0.5443894", "0.5423846", "0.53952", "0.5387089", "0.53677356", "0.5364623...
0.739324
0
Columns generated by the transformation.
def output_columns(self) -> List[str]:
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def columns(self):\n \n pass", "def columns(self):\r\n _columns = self.base_columns + self.veg_columns\r\n return _columns", "def columns(self):\n\n return None", "def _get_columns(self):\n columns = []\n for column in self.plate_meta['columns']:\n colu...
[ "0.7621217", "0.7536427", "0.7163175", "0.70887214", "0.6988662", "0.69491094", "0.6948782", "0.69425744", "0.69079775", "0.68992317", "0.68722904", "0.685491", "0.6844722", "0.6844722", "0.6827679", "0.6796943", "0.67880386", "0.6773778", "0.67617524", "0.67471766", "0.67393...
0.6554851
30
Performs a transformation to the feature pipeline.
def transform(self, dataframe: DataFrame) -> DataFrame:
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transform():\n pass", "def _apply_transform(self):\n pass", "def transform(self, X: pd.DataFrame):\n return self.feature_transformer.transform(X)", "def transform():", "def transform(self, X):\n ...", "def transform(self, X):\n ...", "def transform(self, X):\n ...
[ "0.7171644", "0.7105834", "0.7023362", "0.70011497", "0.6983504", "0.6983504", "0.6983504", "0.6983504", "0.6983504", "0.6983504", "0.6983504", "0.69327205", "0.68861645", "0.68850255", "0.6766826", "0.67095256", "0.6707715", "0.66797096", "0.66404986", "0.6632335", "0.662262...
0.0
-1
Tally elements from `seq`.
def count_elements(seq) -> dict: hist = {} for i in seq: hist[i] = hist.get(i, 0) + 1 return hist
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count(seq):\n\treturn sum(1 for x in seq)", "def count_to(count):\n numbers = [\"one\", \"two\", \"three\", \"four\", \"five\"]\n for number in numbers[:count]:\n yield number", "def count(seq):\n\n if not seq:\n return 0\n elif isinstance(seq[0], list):\n return count(seq[...
[ "0.7100034", "0.6317669", "0.6170751", "0.5921281", "0.5849787", "0.5824706", "0.5793777", "0.57923806", "0.572948", "0.5619338", "0.5604529", "0.5596039", "0.5580609", "0.557614", "0.5479906", "0.54281884", "0.5426027", "0.54189825", "0.54155487", "0.5404879", "0.539859", ...
0.5435123
16
A horizontal frequencytable/histogram plot.
def ascii_histogram(seq) -> None: counted = count_elements(seq) for k in sorted(counted): print('{0:5d} {1}'.format(k, '+' * counted[k]))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_hist(self):\n \n plt.figure();\n self.dist_frame.plot(kind='hist',legend=False,orientation='horizontal')", "def show_histo(dict, orient=\"horiz\", label=\"counts\", title=\"title\"):\n plt.clf()\n plt.cla()\n if orient==\"horiz\":\n bar_fun = plt.barh...
[ "0.61392516", "0.61110634", "0.6049273", "0.60358125", "0.59522873", "0.58571607", "0.5726057", "0.57158583", "0.56673574", "0.5663885", "0.5644567", "0.5643656", "0.5642409", "0.56384397", "0.56205577", "0.5610789", "0.5597303", "0.5594205", "0.55640066", "0.5560971", "0.551...
0.51303035
98
It prefixes the `view_name` with `@@`.
def test_base__BaseView__url__1(): view = BaseView() view.request = Mock() with patch('zope.traversing.browser.absoluteURL') as absoluteURL: absoluteURL.return_value = 'http://base.url' assert 'http://base.url/@@index.html' == view.url(Mock(), 'index.html')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def view_name(self, view_name):\n\n self._view_name = view_name", "def getViewName(self, index) -> Str:\n ...", "def view_name(self):\n return self._view_name", "def get_view_name(self, vid):\n return \"cview-{0}\".format(vid)", "def test_view_name(self):\n if self.test_c...
[ "0.62900454", "0.62463444", "0.6076066", "0.5663651", "0.56600094", "0.54461974", "0.5430363", "0.52574223", "0.5238498", "0.51954156", "0.51083297", "0.50939125", "0.50511086", "0.5016216", "0.49701998", "0.49507728", "0.49330765", "0.49114177", "0.48809448", "0.4860955", "0...
0.0
-1
It does not prefix `view_name` starting with `++`.
def test_base__BaseView__url__2(): view = BaseView() view.request = Mock() with patch('zope.traversing.browser.absoluteURL') as absoluteURL: absoluteURL.return_value = 'http://base.url' assert 'http://base.url/++path++foo' == view.url(Mock(), '++path++foo')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getViewName(self, index) -> Str:\n ...", "def __init__( viewname, view ):", "def namehack(field):\n if field.endswith((\"attribute\", \"views\")):\n return field + \"__name\"\n else:\n return field", "def prefix_if_needed(name):\n if (keyword.iskeyword(name)\n or ...
[ "0.60278064", "0.5911064", "0.583683", "0.579326", "0.57767504", "0.57549834", "0.5753062", "0.56333697", "0.56141996", "0.5607088", "0.5519988", "0.54276973", "0.54114366", "0.53545886", "0.53220314", "0.5279165", "0.5215463", "0.5211833", "0.5209457", "0.51984173", "0.51713...
0.0
-1
It adds keyword arguments as query arguments.
def test_base__BaseView__url__3(): view = BaseView() view.request = Mock() with patch('zope.traversing.browser.absoluteURL') as absoluteURL: absoluteURL.return_value = 'http://base.url' assert 'http://base.url/@@view?a=2&b=q&b=w' == view.url( Mock(), 'view', a=2, b=['q', 'w'])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_kwargs():\n pass", "def updatekwargs(self,request):\n updated_dict={}\n if isinstance(request.query_params,QueryDict):\n updated_dict = {k:','.join(v) for k,v in request.query_params.iterlists()}\n else:\n updated_dict = request.query_params\n updated_...
[ "0.71644", "0.6749467", "0.66288537", "0.6625248", "0.6516482", "0.6497864", "0.64340866", "0.6360057", "0.6315432", "0.6286231", "0.623458", "0.6234474", "0.6218008", "0.6196561", "0.6086617", "0.60786927", "0.6069198", "0.60665965", "0.6059446", "0.6058143", "0.6038552", ...
0.0
-1
It cannot be set twice.
def test_base__BaseForm__fields__1(): form = BaseForm() form.fields = Mock() with pytest.raises(ValueError): form.fields = Mock()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pre_set(self, value):\r\n return value", "def set():\n pass", "def set():", "def set_once(setter):\n set_instances = DescDict()\n @wraps(setter)\n def __set__(desc, instance, value):\n if instance in set_instances:\n raise AttributeError(\"Cannot set a read-only attri...
[ "0.64605004", "0.6446169", "0.63387764", "0.61596113", "0.6159611", "0.5917274", "0.59148306", "0.5905022", "0.58802766", "0.5841229", "0.5827132", "0.5816782", "0.57996696", "0.578699", "0.57819563", "0.5768832", "0.57646", "0.5760425", "0.57556295", "0.57512033", "0.572916"...
0.0
-1
Returns major and minor verions extracted from hal_version string.
def ParseHalVersion(hal_version): hal_version_major, hal_version_minor = hal_version.split(".") return int(hal_version_major), int(hal_version_minor)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def version_major_minor(version_string):\n return '.'.join(version_string.split('.')[0:2])", "def version(harness_string):\n lines = harness_string.split(\"\\n\")\n version_string = lines[1][11:]\n return [int(x) for x in version_string.split(\".\")]", "def version_info():\r\n return tuple(map(i...
[ "0.6808128", "0.6800184", "0.64949715", "0.6468127", "0.64401436", "0.64337885", "0.64071137", "0.63955134", "0.6358101", "0.63574815", "0.63204896", "0.63001186", "0.62353826", "0.6229219", "0.6155122", "0.6138727", "0.61198515", "0.6089407", "0.6043678", "0.6036056", "0.601...
0.7774886
0
Parses a vintf xml string.
def GetHalDescriptions(vintf_xml): try: xml_root = ElementTree.fromstring(vintf_xml) except ElementTree.ParseError as e: logging.exception(e) logging.error('This vintf xml could not be parsed:\n%s' % vintf_xml) return None, None hwbinder_hals = dict() passthrough_hals = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse(self, xml_text):\n self.xml_text = xml_text\n xml_doc = parse_doc(xml_text)\n incarnation = find(xml_doc, \"Incarnation\")\n self.vm_name = getattrib(incarnation, \"instance\")\n role = find(xml_doc, \"Role\")\n self.role_name = getattrib(role, \"name\")\n ...
[ "0.5724768", "0.5701528", "0.5598521", "0.5517836", "0.55085194", "0.53746754", "0.53405863", "0.53346115", "0.5281464", "0.52588713", "0.5205887", "0.51867217", "0.5175915", "0.5140365", "0.5135632", "0.51355606", "0.51182544", "0.50796145", "0.5076784", "0.5068767", "0.5061...
0.0
-1
Check that uses of security with its scopes matches a securityDefinition
def check_security(swagger: Dict): events = set() secdefs = swagger.get("securityDefinitions", {}) security_jspath = JSPATH_SECURITY for sec_key, scopes, path in get_elements(swagger, security_jspath): # retrieve security definition name from security declaration secdef = secdefs.get(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _allow_scopes(self, scopes):\n self.ensure_one()\n if not scopes:\n return True\n provided_scopes = set(self.scope.split())\n resource_scopes = set(scopes)\n return resource_scopes.issubset(provided_scopes)", "def allow_scopes(self, scopes):\n if not scope...
[ "0.65138483", "0.6327811", "0.5783558", "0.5783558", "0.5767268", "0.5724105", "0.5654273", "0.5641699", "0.5622558", "0.56123286", "0.54999596", "0.54790866", "0.5475231", "0.54410386", "0.54316336", "0.5362886", "0.5335938", "0.52609617", "0.5260208", "0.52396923", "0.52269...
0.685158
0
Check a parameter structure
def _check_parameter(param: Dict, path_param): events = set() name = param.get("name", "unnamed-parameter") required = param.get("required", False) default = param.get("default") _type = param.get("type") format = param.get("format") enum = param.get("enum") # check if required=True an...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_params(self):\n raise NotImplementedError", "def _check_params(self):\n pass", "def check_error_param_structure(body, # type: JSON\n version=null, # type: Optional[Str]\n ...
[ "0.76767725", "0.7591125", "0.7402214", "0.7298862", "0.7248852", "0.7133816", "0.7025089", "0.6993465", "0.6929772", "0.69171894", "0.6895547", "0.6859764", "0.68273586", "0.68253374", "0.682298", "0.67765826", "0.6766701", "0.6745067", "0.6733507", "0.671078", "0.6690218", ...
0.738073
3
Find reference in paths, for /definitions/ and /responses/ /securityDefinitions/. Follow from these, references to other references, till no more added.
def check_references(swagger: Dict): events = set() ref_jspath = JSPATH_REFERENCES for _, reference, path in get_elements(swagger, ref_jspath): # handle only local references if reference.startswith("#/"): # decompose reference (error if not possible) try: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resolve_references(path, schema):\n if isinstance(schema, dict):\n # do $ref first\n if '$ref' in schema:\n # Pull the referenced filepath from the schema\n referenced_file = schema['$ref']\n\n # Referenced filepaths are relative, so take the current path's\n ...
[ "0.5813966", "0.580421", "0.57232213", "0.567098", "0.5387027", "0.536545", "0.5360238", "0.53423506", "0.5322113", "0.53113806", "0.52813274", "0.5275058", "0.52129483", "0.5208881", "0.5207236", "0.5207236", "0.519945", "0.5163528", "0.5115436", "0.510193", "0.5087295", "...
0.62231946
0
Return list of Action with duplicate operationIds
def detect_duplicate_operationId(swagger: Dict): events = set() # retrieve all operationIds operationId_jspath = JSPATH_OPERATIONID def get_operationId_name(name_value_path): return name_value_path[1] operationIds = sorted(get_elements(swagger, operationId_jspath), key=get_operationId_nam...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getOperations(tasks):\n uniqueOps = []\n for t in tasks:\n if t.operation not in uniqueOps:\n uniqueOps.append(t.operation)\n return uniqueOps", "def get_action_meanings(self) -> list[str]:\n keys = ale_py.Action.__members__.values()\n values = ale_py.Action.__members...
[ "0.5931796", "0.5806651", "0.5590762", "0.5534209", "0.5511355", "0.54215086", "0.54107136", "0.53395987", "0.53227234", "0.5308435", "0.5300775", "0.52975464", "0.5292807", "0.5246177", "0.5204808", "0.520251", "0.5185142", "0.5185142", "0.5164353", "0.5164038", "0.514922", ...
0.6498538
0
Check swagger is compliant with schema
def check_schema(swagger: Dict) -> Set[ValidationError]: # validate the json schema of the swagger_lib schema = json.load((Path(__file__).parent / "schemas" / "schema_swagger.json").open()) v = Draft4Validator(schema) # convert any key to string (as json swagger expects all keys to be str and response ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_valid_schema(context):\n data = context.response.json()\n validate_schema(data)", "def swagger_content_validator(spec_body):\n version = spec_body['swagger']\n if version.startswith('1'):\n return 'Deprecated Swagger version. Please visit http://swagger.io for information on upgradin...
[ "0.77425784", "0.7562302", "0.72516084", "0.717681", "0.70947933", "0.70194536", "0.69743437", "0.6922692", "0.6911827", "0.68855506", "0.6852835", "0.6786875", "0.67004496", "0.6655609", "0.6642783", "0.6634432", "0.662754", "0.6577465", "0.6576202", "0.6549941", "0.64734167...
0.72195214
3
Validate a swagger specification.
def validate(swagger: Dict) -> Tuple[Dict, List[ValidationError]]: errors = ( check_schema(swagger) | check_references(swagger) | check_security(swagger) | check_parameters(swagger) | detect_duplicate_operationId(swagger) ) return swagger, errors
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def swagger_content_validator(spec_body):\n version = spec_body['swagger']\n if version.startswith('1'):\n return 'Deprecated Swagger version. Please visit http://swagger.io for information on upgrading to Swagger 2.0'\n\n with open(config.JSON_SCHEMA) as schema:\n swagger_schema = json.load...
[ "0.7564172", "0.7142951", "0.70726055", "0.63631016", "0.6279129", "0.6207321", "0.6128875", "0.61037344", "0.60811204", "0.6034144", "0.59926444", "0.59833854", "0.5943502", "0.58826286", "0.5682068", "0.56607676", "0.56415325", "0.5634097", "0.56200796", "0.5616248", "0.554...
0.62099564
5
Return a custom Task deriving from the given features. The method resolution order of the created custom task class is (features, ZenTask, celery.app.task.Task, object) where 'features' are the classes given to this function.
def requires(*features): bases = tuple(features) + (app.Task, object) culled = [] for feature in reversed(bases): for cls in reversed(inspect.getmro(feature)): if cls not in culled: culled.insert(0, cls) name = "".join(t.__name__ for t in features) + "Task" baseta...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def task(self, *args, **options):\n\n def inner_create_task_cls(**options):\n\n def _create_task_cls(fun):\n options[\"app\"] = self\n options.setdefault(\"accept_magic_kwargs\", False)\n base = options.pop(\"base\", None) or self.Task\n\n ...
[ "0.6390325", "0.6185908", "0.6112467", "0.6085256", "0.60752213", "0.6052281", "0.59219766", "0.5772356", "0.5659865", "0.5566926", "0.5566227", "0.55407", "0.5519343", "0.5488936", "0.5457622", "0.54563", "0.5421232", "0.5372621", "0.5343277", "0.53029823", "0.52959937", "...
0.6746591
0
Return True if the job's log contains any ERROR messages.
def job_log_has_errors(task_id): storage = getUtility(IJobStore, "redis") logfile = storage.getfield(task_id, "logfile") if not logfile: return False try: with open(logfile, "r") as f: return any( any(txt in line for txt in _failure_text) for l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_error_logs(self) -> bool:\n return pulumi.get(self, \"has_error_logs\")", "def has_error_logs(self) -> Optional[pulumi.Input[bool]]:\n return pulumi.get(self, \"has_error_logs\")", "def is_error(self):\n qstat = self._grep_qstat('error')\n err = self._grep_status('error')\n ...
[ "0.7957555", "0.7402968", "0.7083291", "0.679797", "0.6731912", "0.668849", "0.666115", "0.66186255", "0.66132045", "0.65512913", "0.65366274", "0.65144116", "0.65144086", "0.6504721", "0.6497874", "0.6482571", "0.64806294", "0.6465928", "0.64602154", "0.64566797", "0.6456679...
0.76105946
1
Test when don't pass units.
def test_nounit(self, a, b, rtol, atol, expected): assert self.func(a, b, rtol=rtol, atol=atol) == expected
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_not_units(self):\n with self.assertRaises(AssertionError):\n _unit_map(\"WiB\")", "def try_consume_units(self, units):\n pass", "def consume_units_unconditionally(self, units):\n pass", "def hasUnit(val):\n return hasattr(val, 'unit') or hasattr(val, 'units')", "...
[ "0.7225719", "0.692526", "0.6857469", "0.6781277", "0.67387825", "0.6737033", "0.663228", "0.6590681", "0.652528", "0.65109396", "0.6473032", "0.6452513", "0.6380616", "0.6373073", "0.6364898", "0.6364898", "0.6364372", "0.6357402", "0.6339903", "0.63209164", "0.6301794", "...
0.0
-1
Test when pass wrong units.
def test_wrongunit(self, a, b, rtol, atol, expected): with pytest.raises(u.UnitsError): assert self.func(a, b, rtol, atol)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_not_units(self):\n with self.assertRaises(AssertionError):\n _unit_map(\"WiB\")", "def test_convert_incompatible_units(self):\n self.assertRaises(ValueError, convert_units, self.arr, 'm')", "def test_wrongunit(self, a, b, rtol, atol):\n with pytest.raises(u.UnitsError):...
[ "0.7563029", "0.7384433", "0.7306796", "0.7187844", "0.717531", "0.71051407", "0.70176244", "0.6969035", "0.69454175", "0.68970394", "0.680133", "0.680133", "0.67173606", "0.6709138", "0.6685805", "0.66673374", "0.6642611", "0.6606422", "0.6606422", "0.656627", "0.65347236", ...
0.7279169
3
Test when arguments are scalars.
def test_scalar(self, a, b, rtol, atol, expected): assert self.func(a, b, rtol=rtol, atol=atol) == expected
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_scalar(x: Any) -> bool:\r\n return np.isscalar(x) or (isinstance(x, np.ndarray) and x.ndim == 0)", "def is_scalar(self):", "def require_scalar(self, *args: Type) -> None:\n node = Node(self.yaml_node)\n if len(args) == 0:\n if not node.is_scalar():\n raise Reco...
[ "0.75825137", "0.73548776", "0.71445835", "0.7102149", "0.7089228", "0.70303446", "0.69841146", "0.69172186", "0.68699443", "0.66607696", "0.66573393", "0.66312736", "0.65940714", "0.65878916", "0.65793663", "0.6562073", "0.6507556", "0.64181775", "0.6342314", "0.63420236", "...
0.6315345
21
Tests when arguments are vectors. To address [148]
def test_vector(self, a, b, rtol, atol, expected): assert np.all(self.func(a, b, rtol=rtol, atol=atol) == expected)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_vargs(self):", "def is_vector(x):\r\n return len(x.shape) == 1", "def isvect(x):\n return isinstance(x,list) and len(x) == 4 and isgoodnum(x[0]) and isgoodnum(x[1]) and isgoodnum(x[2]) and isgoodnum(x[3])", "def is_vec(x):\n return x.ndim == 1 or (x.ndim == 2 and \n (x.shape[0] == 1 ...
[ "0.70414275", "0.69837004", "0.6749711", "0.6565308", "0.6532564", "0.6434003", "0.6259922", "0.6231436", "0.6187329", "0.6129599", "0.6121884", "0.6117826", "0.6058663", "0.6016492", "0.6013097", "0.5982279", "0.59802455", "0.5975753", "0.59430534", "0.5928976", "0.59202373"...
0.62501943
7
Tests when arguments are vectors. Unit tests IN the list are from [148].
def test_vector(self, a, b, rtol, atol, expected): assert self.func(a, b, rtol=rtol, atol=atol) == expected
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_vargs(self):", "def test_suite():\r\n test(add_vectors([1, 1], [1, 1]) == [2, 2])\r\n test(add_vectors([1, 2], [1, 4]) == [2, 6])\r\n test(add_vectors([1, 2, 1], [1, 4, 3]) == [2, 6, 4])\r\n test(scalar_mult(5, [1, 2]) == [5, 10])\r\n test(scalar_mult(3, [1, 0, -1]) == [3, 0, -3])\r\n ...
[ "0.7944651", "0.71358556", "0.7112957", "0.6632586", "0.65785676", "0.6546965", "0.6496939", "0.6496055", "0.640353", "0.63462496", "0.62693065", "0.62572634", "0.62320375", "0.62320375", "0.61611867", "0.61609304", "0.61587226", "0.6141067", "0.6108911", "0.6080782", "0.6080...
0.65294266
6
Tests when arguments are vectors. Unit tests IN the list are from [148].
def test_vector_fails(self, a, b, rtol, atol): with pytest.raises(u.UnitsError): self.func(a, b, rtol=rtol, atol=atol)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_vargs(self):", "def test_suite():\r\n test(add_vectors([1, 1], [1, 1]) == [2, 2])\r\n test(add_vectors([1, 2], [1, 4]) == [2, 6])\r\n test(add_vectors([1, 2, 1], [1, 4, 3]) == [2, 6, 4])\r\n test(scalar_mult(5, [1, 2]) == [5, 10])\r\n test(scalar_mult(3, [1, 0, -1]) == [3, 0, -3])\r\n ...
[ "0.7944651", "0.71358556", "0.7112957", "0.6632586", "0.65785676", "0.6546965", "0.65294266", "0.6496939", "0.6496055", "0.640353", "0.63462496", "0.62693065", "0.62572634", "0.62320375", "0.62320375", "0.61611867", "0.61609304", "0.61587226", "0.6141067", "0.6108911", "0.608...
0.5903848
39
Test when don't pass units.
def test_nounit(self, a, b, rtol, atol): self.func(a, b, rtol=rtol, atol=atol)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_not_units(self):\n with self.assertRaises(AssertionError):\n _unit_map(\"WiB\")", "def try_consume_units(self, units):\n pass", "def consume_units_unconditionally(self, units):\n pass", "def hasUnit(val):\n return hasattr(val, 'unit') or hasattr(val, 'units')", "...
[ "0.7225719", "0.692526", "0.6857469", "0.6781277", "0.67387825", "0.6737033", "0.663228", "0.6590681", "0.652528", "0.65109396", "0.6473032", "0.6452513", "0.6380616", "0.6373073", "0.6364898", "0.6364898", "0.6364372", "0.6357402", "0.6339903", "0.63209164", "0.6301794", "...
0.0
-1
Test when pass wrong units.
def test_wrongunit(self, a, b, rtol, atol): with pytest.raises(u.UnitsError): self.func(a, b, rtol, atol)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_not_units(self):\n with self.assertRaises(AssertionError):\n _unit_map(\"WiB\")", "def test_convert_incompatible_units(self):\n self.assertRaises(ValueError, convert_units, self.arr, 'm')", "def test_wrongunit(self, a, b, rtol, atol, expected):\n with pytest.raises(u.Un...
[ "0.7563029", "0.7384433", "0.7279169", "0.7187844", "0.717531", "0.71051407", "0.70176244", "0.6969035", "0.69454175", "0.68970394", "0.680133", "0.680133", "0.67173606", "0.6709138", "0.6685805", "0.66673374", "0.6642611", "0.6606422", "0.6606422", "0.656627", "0.65347236", ...
0.7306796
2
Test when arguments are scalars.
def test_scalar(self, a, b, rtol, atol): self.func(a, b, rtol=rtol, atol=atol)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_scalar(x: Any) -> bool:\r\n return np.isscalar(x) or (isinstance(x, np.ndarray) and x.ndim == 0)", "def is_scalar(self):", "def require_scalar(self, *args: Type) -> None:\n node = Node(self.yaml_node)\n if len(args) == 0:\n if not node.is_scalar():\n raise Reco...
[ "0.75825137", "0.73548776", "0.71445835", "0.7102149", "0.7089228", "0.70303446", "0.69841146", "0.69172186", "0.68699443", "0.66607696", "0.66573393", "0.66312736", "0.65940714", "0.65878916", "0.65793663", "0.6562073", "0.6507556", "0.64181775", "0.6342314", "0.63420236", "...
0.6225962
27
Test when arguments are scalars.
def test_scalar_fails(self, a, b, rtol, atol): with pytest.raises(AssertionError): self.func(a, b, rtol=rtol, atol=atol)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_scalar(x: Any) -> bool:\r\n return np.isscalar(x) or (isinstance(x, np.ndarray) and x.ndim == 0)", "def is_scalar(self):", "def require_scalar(self, *args: Type) -> None:\n node = Node(self.yaml_node)\n if len(args) == 0:\n if not node.is_scalar():\n raise Reco...
[ "0.75825137", "0.73548776", "0.71445835", "0.7102149", "0.7089228", "0.70303446", "0.69841146", "0.69172186", "0.68699443", "0.66607696", "0.66573393", "0.66312736", "0.65940714", "0.65878916", "0.65793663", "0.6562073", "0.6507556", "0.64181775", "0.6342314", "0.63420236", "...
0.60102016
35
Tests when arguments are vectors. To address [148]
def test_vector(self, a, b, rtol, atol): self.func(a, b, rtol=rtol, atol=atol)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_vargs(self):", "def is_vector(x):\r\n return len(x.shape) == 1", "def isvect(x):\n return isinstance(x,list) and len(x) == 4 and isgoodnum(x[0]) and isgoodnum(x[1]) and isgoodnum(x[2]) and isgoodnum(x[3])", "def is_vec(x):\n return x.ndim == 1 or (x.ndim == 2 and \n (x.shape[0] == 1 ...
[ "0.7040591", "0.6985148", "0.6750895", "0.6566001", "0.6533638", "0.6435194", "0.6262337", "0.625173", "0.6232071", "0.6190312", "0.6131285", "0.6123131", "0.61189514", "0.60593975", "0.6019126", "0.60132104", "0.598194", "0.598104", "0.59766185", "0.5943508", "0.59310186", ...
0.5875946
23
Tests when arguments are vectors.
def test_vector_fails(self, a, b, rtol, atol): with pytest.raises(AssertionError): self.func(a, b, rtol=rtol, atol=atol)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_vargs(self):", "def is_vector(x):\r\n return len(x.shape) == 1", "def test_get_vec(self):\n x = get_vec(5)\n assert x.shape == (5,)\n assert np.all(x == np.zeros(5))", "def test_vector(self, a, b, rtol, atol, expected):\n assert np.all(self.func(a, b, rtol=rtol, atol=a...
[ "0.7000132", "0.69634503", "0.6599487", "0.65526724", "0.65170616", "0.64394903", "0.6426221", "0.640228", "0.639873", "0.63829446", "0.6292685", "0.6227628", "0.62214035", "0.6190462", "0.6174687", "0.61742216", "0.61488736", "0.61400294", "0.6138772", "0.6138772", "0.610839...
0.58194864
43
Tests when arguments are vectors. Unit tests IN the list are from [148].
def test_vector(self, a, b, rtol, atol): self.func(a, b, rtol=rtol, atol=atol)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_vargs(self):", "def test_suite():\r\n test(add_vectors([1, 1], [1, 1]) == [2, 2])\r\n test(add_vectors([1, 2], [1, 4]) == [2, 6])\r\n test(add_vectors([1, 2, 1], [1, 4, 3]) == [2, 6, 4])\r\n test(scalar_mult(5, [1, 2]) == [5, 10])\r\n test(scalar_mult(3, [1, 0, -1]) == [3, 0, -3])\r\n ...
[ "0.7944651", "0.71358556", "0.7112957", "0.6632586", "0.65785676", "0.6546965", "0.65294266", "0.6496939", "0.6496055", "0.640353", "0.63462496", "0.62693065", "0.62572634", "0.61611867", "0.61609304", "0.61587226", "0.6141067", "0.6108911", "0.6080782", "0.60804427", "0.6069...
0.62320375
13
Tests when arguments are vectors. Unit tests IN the list are from [148].
def test_vector_fails(self, a, b, rtol, atol): # Raises AssertionError or UnitsError with pytest.raises((AssertionError, u.UnitsError)): self.func(a, b, rtol=rtol, atol=atol)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_vargs(self):", "def test_suite():\r\n test(add_vectors([1, 1], [1, 1]) == [2, 2])\r\n test(add_vectors([1, 2], [1, 4]) == [2, 6])\r\n test(add_vectors([1, 2, 1], [1, 4, 3]) == [2, 6, 4])\r\n test(scalar_mult(5, [1, 2]) == [5, 10])\r\n test(scalar_mult(3, [1, 0, -1]) == [3, 0, -3])\r\n ...
[ "0.7944651", "0.71358556", "0.7112957", "0.6632586", "0.65785676", "0.6546965", "0.65294266", "0.6496939", "0.6496055", "0.640353", "0.63462496", "0.62693065", "0.62572634", "0.62320375", "0.62320375", "0.61611867", "0.61609304", "0.61587226", "0.6141067", "0.6108911", "0.608...
0.60526836
24
Open filename with PIL and return it as numpy array.
def load_image_as_array(filename): im = Image.open(filename) arr = np.asarray(im) return arr
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_image(filename):\n\n from matplotlib.image import pil_to_array\n\n with Image.open(filename) as image:\n return pil_to_array(image)", "def read_image(filename):\n img = Image.open(filename)\n im = np.array(img)\n return im", "def open_image(self, filename):\n return np.arr...
[ "0.8164177", "0.77908725", "0.7741218", "0.76329213", "0.74809325", "0.7479899", "0.74402076", "0.74395764", "0.7395058", "0.73114026", "0.7271109", "0.7271109", "0.7229047", "0.72032166", "0.71685344", "0.7142918", "0.7133434", "0.71028465", "0.7099148", "0.70751023", "0.705...
0.76072836
4
Save array arr as image named filename using PIL. Array values are expected to be in range 0, 255
def save_array_as_image(arr, filename): arr = arr.copy().clip(0, 255).astype('uint8') im = Image.fromarray(arr) im.save(filename)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def array_to_file(filename, a):\n a = normalize_array(a)\n i = Image.fromarray(a.astype('uint8'))\n return i.save(filename)", "def save_array_as_image(array, save_location):\n image = Image.fromarray(array)\n image.save(save_location)\n image.close()", "def save_array_as_rgb_image(data, image...
[ "0.74595904", "0.7408031", "0.7337335", "0.7290139", "0.7236084", "0.71091694", "0.7072147", "0.7061919", "0.70130265", "0.6976142", "0.6947858", "0.68813074", "0.67939574", "0.6785626", "0.67748415", "0.6718204", "0.67100114", "0.67048955", "0.66497797", "0.66431254", "0.659...
0.86196065
0
Assuming population is sorted from best to worst, sample in proportion to rank.
def rank_selector(population): # make a cdf of probability of being selected invrange = np.arange(len(population), 0, -1, dtype = np.double) cdf = np.r_[0., (invrange / invrange.sum()).cumsum()] while True: u = nprand.random() ix = np.searchsorted(cdf, u) - 1 yield population[ix]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scramble_pop(pop, fit_pop, fraction):\n\n ranked_worst = np.argsort(fit_pop)\n\n for rank in ranked_worst[:int(fraction * npop)]:\n for gene in range(0, len(pop[rank])-1):\n pop[rank][gene] = np.random.uniform(dom_l, dom_u, 1)\n\n return pop", "def roulette(total_fitness, populatio...
[ "0.6435638", "0.628591", "0.6211622", "0.61294687", "0.60651034", "0.6053954", "0.6044325", "0.6033243", "0.6014987", "0.5992214", "0.59467053", "0.59455305", "0.5945468", "0.5937301", "0.59296274", "0.592006", "0.59174055", "0.5895622", "0.58792055", "0.58780485", "0.5864598...
0.6758833
0
Pick individuals at random and return best. We're assuming pop is sorted by cost (we sort it anyway for elitism/truncation).
def tournament_selector(population, size = 5): while True: sample_ix = nprand.random_integers(0, len(population) - 1, size) # because of sorted-ness, best ind is in smallest ix yield population[sample_ix.min()]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_best(self, population):\n best = min(population, key=self.cost_function)\n return best, self.cost_function(best)", "def next_population():\n result = [best]\n while len(result) < population_size:\n chromosomes = crossover(tournament(), tournament()) if random() < cr...
[ "0.70738643", "0.6965774", "0.6779665", "0.67614806", "0.6746761", "0.6681077", "0.66567594", "0.6530817", "0.6395215", "0.6351832", "0.63446516", "0.6301186", "0.6299437", "0.6299208", "0.62986785", "0.62763137", "0.6274381", "0.62522805", "0.6240033", "0.62383235", "0.62280...
0.62296253
20
Kid is made from a fraction of rectangles from each parent. Uniform crossover.
def crossover_unif(pa, ma): mask = nprand.random_integers(0, 1, len(pa.data)) kiddata = np.array([pa_r if mask_r else ma_r for (pa_r, ma_r, mask_r) in zip(pa.data, ma.data, mask)]) return Individual(kiddata.copy())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _cross_parents(self):\n while len(self.children_population) < self.children_count:\n parent_1, parent_2 = random.sample(self.population, k=2)\n self.children_population.extend(self.crossover.cross(parent_1, parent_2))", "def returnParent(k):\n for e in G[edges]:\n if e[...
[ "0.5607901", "0.5338766", "0.5321788", "0.5321788", "0.52213955", "0.52155346", "0.5211212", "0.5185531", "0.51608497", "0.51588005", "0.51362604", "0.5091361", "0.50754136", "0.50291425", "0.50072676", "0.49963102", "0.49932796", "0.49873686", "0.49739757", "0.49610615", "0....
0.0
-1
Kid is a linear combination of both parents.
def crossover_arith(pa, ma): alpha = nprand.uniform(0, 2.) newdata = np.empty(pa.data.shape) if alpha < 1.0: newdata[:, R:] = pa.data[:, R:].copy() else: newdata[:, R:] = ma.data[:, R:].copy() newdata[:, :R] = alpha * pa.data[:, :R]+ (1 - alpha) * ma.data[:, :R] newdata.clip(0.,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_clan_pks(self):\n return self.get_ancestor_pks() + [self.pk, ] + self.get_descendant_pks()", "def parent_model_object_to_key(self, parent_object: 'Any') -> 'Any':\n key = tuple(getattr(parent_object, pk) for pk in self.parent_model_pks)\n return key", "def __gen_keys__(self):\n ...
[ "0.55820996", "0.53958976", "0.5391543", "0.53781796", "0.5373292", "0.5368611", "0.5346104", "0.5288615", "0.52749944", "0.52732855", "0.52495104", "0.5238568", "0.5238568", "0.5204715", "0.52013385", "0.51939166", "0.5191444", "0.5171168", "0.51643276", "0.51314", "0.507756...
0.0
-1
Find reference file. Start one directory above where current script is located
def _find_ref_fname(fname, ref_fname): curr_dir = "" next_dir = os.path.dirname(os.path.abspath(fname)) while next_dir != curr_dir: curr_dir = next_dir rcfile = os.path.join(curr_dir, ref_fname) if os.path.exists(rcfile): return rcfile next_dir = os.path.dirname(c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def here(*args):\n return os.path.join(os.path.dirname(__file__), *args)", "def find_file(filename):\n for i in list(_ctx.include_paths) + [ os.path.dirname(_ctx.filename) ]:\n full_path = os.path.join(i, filename)\n if os.path.exists(full_path):\n return full_path\n return file...
[ "0.6440464", "0.59702355", "0.5936138", "0.5847516", "0.5828445", "0.5815112", "0.58074206", "0.5772543", "0.57669914", "0.5754274", "0.5753154", "0.57404125", "0.5732479", "0.57175195", "0.5709073", "0.5703181", "0.5684399", "0.56781787", "0.56758654", "0.5631285", "0.562101...
0.6339929
1
Return line numbers in which words appear in a file.
def _grep(fname, words): # pylint: disable=W0631 pat = "(.*[^a-zA-Z]|^){}([^a-zA-Z].*|$)" regexps = [(word, re.compile(pat.format(word))) for word in words] ldict = collections.defaultdict(list) for num, line in enumerate(_read_file(fname)): for word in [word for word, regexp in regexps if r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def readFile(filename):\n listOfWords = []\n currentLine = 1\n f = open(filename, \"r\")\n for line in f:\n line = stripPunctuation(line)\n for word in line.split():\n word = word.lower()\n if len(word) > 1:\n if not word[0].isdigit():\n ...
[ "0.68952453", "0.68816835", "0.6739507", "0.6731516", "0.659104", "0.6548588", "0.6534446", "0.64847416", "0.64710104", "0.6459936", "0.6455618", "0.6455618", "0.64289", "0.6384691", "0.63595414", "0.63479334", "0.63156974", "0.63041383", "0.62864065", "0.62247175", "0.622347...
0.61952215
24
Homogenize files to have absolute paths.
def _make_abspath(value): value = value.strip() if not os.path.isabs(value): value = os.path.abspath(os.path.join(os.getcwd(), value)) return value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def makeRelativePathsAbsolute(cmdargs):\n for i in range(len(cmdargs)):\n if relativePathRE.match(cmdargs[i]):\n cmdargs[i]=os.path.abspath(cmdargs[i])", "def resolve_paths(self, hashes=None):\n\n if hashes is None:\n hashes = default_hashfile(self.path).load()\n for...
[ "0.6141227", "0.610496", "0.60980517", "0.5973628", "0.5973345", "0.597262", "0.5913579", "0.58410686", "0.5765675", "0.5652343", "0.56239516", "0.56209445", "0.5620413", "0.5596444", "0.5558857", "0.5558733", "0.5553855", "0.5514656", "0.5492969", "0.54754305", "0.544206", ...
0.4948299
94
Return file lines as strings.
def _read_file(fname): with open(fname) as fobj: for line in fobj: yield _tostr(line).strip()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_strings(src_file):\n res = []\n try:\n res = open(src_file,'r').readlines()\n res = [x.strip() for x in res]\n except:\n res = []\n return res", "def wrapped_getlines(filename, globals):\n lines = orig(filename, globals)\n source = self.format_source...
[ "0.7301371", "0.6943662", "0.68974286", "0.6884952", "0.6822472", "0.677273", "0.6769133", "0.67444825", "0.6675356", "0.66742903", "0.66620487", "0.6630497", "0.66217786", "0.6610436", "0.6606942", "0.66017795", "0.6593835", "0.65923136", "0.65613157", "0.65596306", "0.65535...
0.6384129
43
Safely execute shell command.
def _shcmd(cmd, timeout=15): delay = 1.0 obj = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) if sys.hexversion < 0x03000000: while (obj.poll() is None) and (timeout > 0): time.sleep(delay) timeout -= delay if not timeout: obj.kill()...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sh(cmd):\r\n return check_call(cmd, shell=True)", "def safe_call(cmd, shell=False, *args, **kwargs):\n try:\n rtn = subprocess.call(cmd, shell=False, *args, **kwargs)\n except (subprocess.CalledProcessError, OSError):\n cmd = ' '.join(cmd)\n rtn = subprocess.call(cmd, shell=True...
[ "0.717853", "0.71366054", "0.6877115", "0.68308824", "0.68284416", "0.67937887", "0.6784106", "0.6777239", "0.67754066", "0.6760615", "0.6755838", "0.67463934", "0.67259985", "0.66922224", "0.6671042", "0.66493744", "0.65985805", "0.65897596", "0.6586132", "0.6585629", "0.656...
0.0
-1
Convert to string if necessary.
def _tostr(obj): # pragma: no cover return obj if isinstance(obj, str) else obj.decode()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def safeToString():", "def to_str(self) -> str:", "def _convert_to_str(self, data):\n raise NotImplementedError()", "def to_string(value: Any) -> str:\n return StringConverter.to_string_with_default(value, '')", "def string(self, value):\n # respect {None}\n if value is None:\n ...
[ "0.7451325", "0.7419031", "0.73534083", "0.69365436", "0.68944424", "0.68562615", "0.6801645", "0.67324364", "0.66701794", "0.6667838", "0.6575911", "0.6575464", "0.65649295", "0.6564775", "0.65415096", "0.65244424", "0.65074533", "0.6503762", "0.649728", "0.6459192", "0.6457...
0.6997696
3
Looks for the best configuration according to the metric with which the configurations are compared > best config metric
def get_optimum_config( self, tested_configs, fold_operation=FoldOperations.MEAN ): list_of_config_vals = [] list_of_non_failed_configs = [ conf for conf in tested_configs if not conf.config_failed ] if len(list_of_non_failed_configs)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_best(template, config, key_seq, metric):\n possibles = get_deep(template, key_seq)\n if 1 == len(possibles):\n return None\n best_score = 2**60\n best_val = None\n for val in possibles:\n set_deep(config, key_seq, val)\n score = metric(config)\n #print \"FFFFFFFFF\", score\n if score <...
[ "0.6712287", "0.67110497", "0.6517062", "0.64486647", "0.644139", "0.625165", "0.6074667", "0.5995878", "0.5835893", "0.57242954", "0.57160693", "0.56855017", "0.56855017", "0.56656194", "0.5652332", "0.564348", "0.5612303", "0.56057096", "0.56019616", "0.56008816", "0.559924...
0.6942822
0
Add an element to the machine learning pipeline Returns self
def __iadd__(self, pipe_element): if isinstance(pipe_element, Preprocessing): self.preprocessing = pipe_element elif isinstance(pipe_element, CallbackElement): pipe_element.needs_y = True self.elements.append(pipe_element) else: if isinstance(pipe_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add(self, pipe_element):\n self.__iadd__(pipe_element)", "def add(self, element):\n pass", "def add(self):\n self.inp.inputs.add(self)\n self.out.outputs.add(self)", "def add(self, element):\n self.elements.append(element)", "def __add__(self, element):\r\n sel...
[ "0.70778596", "0.67362624", "0.6649324", "0.6646544", "0.65935856", "0.65228593", "0.64086336", "0.639863", "0.6348306", "0.6348306", "0.62513787", "0.62475896", "0.62036484", "0.6151312", "0.614484", "0.61237323", "0.61083806", "0.61050963", "0.60869807", "0.6086253", "0.607...
0.7266616
0
Add an element to the machine learning pipeline Returns self
def add(self, pipe_element): self.__iadd__(pipe_element)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __iadd__(self, pipe_element):\n if isinstance(pipe_element, Preprocessing):\n self.preprocessing = pipe_element\n elif isinstance(pipe_element, CallbackElement):\n pipe_element.needs_y = True\n self.elements.append(pipe_element)\n else:\n if isin...
[ "0.7266616", "0.67362624", "0.6649324", "0.6646544", "0.65935856", "0.65228593", "0.64086336", "0.639863", "0.6348306", "0.6348306", "0.62513787", "0.62475896", "0.62036484", "0.6151312", "0.614484", "0.61237323", "0.61083806", "0.61050963", "0.60869807", "0.6086253", "0.6079...
0.70778596
1
Starts the hyperparameter search and/or fits the pipeline to the data and targets
def fit(self, data, targets, **kwargs): # switch to result output folder start = datetime.datetime.now() self.output_settings._update_settings( self.name, start.strftime("%Y-%m-%d_%H-%M-%S") ) logger.photon_system_log( "**********************************...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self):\n self.set_pipeline()\n self.pipeline.fit(self.X, self.y)", "def run(self):\n pipeline = set_pipeline()\n pipeline.fit(self.X_train, self.y_train)\n return pipeline", "def run(self):\n self.pipeline = self.set_pipeline()\n self.pipeline.fit(self.X...
[ "0.7419216", "0.6926744", "0.69053704", "0.6559574", "0.65116477", "0.64201826", "0.6362185", "0.63327354", "0.6321451", "0.62613463", "0.6223869", "0.6147718", "0.61431974", "0.61370444", "0.61232775", "0.61111504", "0.6097273", "0.60916704", "0.60867953", "0.6055705", "0.60...
0.6348985
7
Use the optimum pipe to predict the data Returns predicted targets
def predict(self, data, **kwargs): # Todo: if local_search = true then use optimized pipe here? if self._pipe: return self.optimum_pipe.predict(data, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def predict(self, X):\n return self.opt.eval(X, top=True)", "def predict(self, X):\n return self.opt.eval(X)", "def getPredictions(self):\n\t\tself.bestLabel = self.testingProbs.apply(lambda x: x.argmax(),1)", "def predict(self, data, verbose=0):\n\n if self.model is None:\n r...
[ "0.6907801", "0.68176144", "0.6800588", "0.6799681", "0.6799681", "0.67252415", "0.6709709", "0.6695485", "0.6654642", "0.6617693", "0.6604021", "0.6581415", "0.65737164", "0.65672374", "0.6523594", "0.6510785", "0.6510358", "0.6510358", "0.6494413", "0.64923626", "0.6485281"...
0.73675454
0
Predict probabilities Returns predicted probabilities
def predict_proba(self, data, **kwargs): if self._pipe: return self.optimum_pipe.predict_proba(data, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def predict_proba(self):\n ...", "def predictability(self):\n temp = self.probs\n for n in range(10):\n temp = temp.dot(temp)\n final = temp[0,:]\n #Let's assume that all words have unique initial letters\n probs = map(len, self.words)\n probs = array(p...
[ "0.76249707", "0.7617488", "0.75270545", "0.75229007", "0.74414474", "0.7413118", "0.7406734", "0.74018633", "0.7329308", "0.7292255", "0.7280925", "0.72790766", "0.7278843", "0.72735214", "0.7270244", "0.7264718", "0.7251891", "0.72308606", "0.72005945", "0.71976465", "0.717...
0.0
-1
Use the optimum pipe to transform the data
def transform(self, data, **kwargs): if self._pipe: X, _, _ = self.optimum_pipe.transform(data, y=None, **kwargs) return X
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transform(self, data):", "def transform():", "def transform(config, data, transfo, *args, **kwargs):\n \n# stderr.write(str((config, data, transfo) + args) + \"\\n\")\n pipe = ktpipes.KtPipe.from_json(config[transfo])\n\n return pipe.fit_transform(get_raw(data))", "def transform():\n p...
[ "0.71663713", "0.7165865", "0.68435884", "0.6630693", "0.6535905", "0.65170705", "0.6233505", "0.6196889", "0.61578715", "0.6157544", "0.6103798", "0.6094707", "0.6094707", "0.6094707", "0.6094707", "0.6094707", "0.6094707", "0.6094707", "0.59727305", "0.5970371", "0.5964616"...
0.72844344
0
Helper function to copy an entire Hyperpipe
def copy_me(self): signature = inspect.getfullargspec(OutputSettings.__init__)[0] settings = OutputSettings() for attr in signature: if hasattr(self.output_settings, attr): setattr(settings, attr, getattr(self.output_settings, attr)) settings.initialize_log_fi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def threading_copy(self, data):\n r_fd, w_fd = os.pipe()\n rstream = os.fdopen(r_fd, \"rb\")\n wstream = os.fdopen(w_fd, \"wb\")\n copy_thread = threading.Thread(target=self.copystream, args=(rstream,))\n copy_thread.start()\n self.writestream(data, wstream)\n wstre...
[ "0.6295839", "0.61451626", "0.610873", "0.60578406", "0.6020367", "0.5932582", "0.5854358", "0.57254714", "0.5709322", "0.56596786", "0.5651965", "0.5637481", "0.55423003", "0.55423003", "0.55423003", "0.55423003", "0.55423003", "0.55423003", "0.55423003", "0.55398184", "0.55...
0.62963563
0
Inverse transform data for a pipeline with specific hyperparameter configuration 1. Copy Sklearn Pipeline, 2. Set Parameters 3. Fit Pipeline to data and targets 4. Inverse transform data with that pipeline
def inverse_transform_pipeline( self, hyperparameters: dict, data, targets, data_to_inverse ): copied_pipe = self.pipe.copy_me() copied_pipe.set_params(**hyperparameters) copied_pipe.fit(data, targets) return copied_pipe.inverse_transform(data_to_inverse)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _inverse_transform(self, X, y=None):\n return clone(self.transformer).fit(X=X, y=y).inverse_transform(X=X, y=y)", "def inverse_transform(self, X, copy=...):\n ...", "def inverse_transform(self, X):\n ...", "def inverse_transform(self, X):\n ...", "def inverse_transform(self,...
[ "0.67512584", "0.6557717", "0.6473889", "0.6473889", "0.6473889", "0.6473889", "0.6473889", "0.64618254", "0.64002866", "0.63939637", "0.6292726", "0.6234573", "0.62108785", "0.61722", "0.61578774", "0.61001974", "0.6087496", "0.6086325", "0.6037008", "0.60338575", "0.6021908...
0.8462068
0
Save optimal pipeline only. Complete hyperpipe will no not be saved.
def save_optimum_pipe(optimum_pipe, zip_file, password=None): folder = os.path.splitext(zip_file)[0] zip_file = folder + ".photon" if os.path.exists(folder): logger.warn("The file you specified already exists as a folder.") else: os.makedirs(folder) # on...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_pipeline(model_to_persist):\n\n save_file_name = 'model.pkl'\n save_path = configuracion.TRAINED_MODEL_DIR / save_file_name\n joblib.dump(model_to_persist, save_path)\n\n print('saved pipeline')", "def save_pipeline(pipeline: PreprocessingPipeline, file_path: str) -> None:\n joblib.dump(p...
[ "0.6719764", "0.6504388", "0.6493676", "0.6202175", "0.6114317", "0.6052772", "0.5999825", "0.59734327", "0.5906684", "0.58500457", "0.5779668", "0.57592094", "0.57326293", "0.5724763", "0.56603277", "0.5638089", "0.56085145", "0.55954397", "0.5572512", "0.55692756", "0.55595...
0.56951374
14
Sigmoid function. This function accepts any shape of np.ndarray object as input and perform sigmoid operation.
def sigmoid(x): return 1 / (1 + np.exp(-x))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sigmoid(x: np.ndarray \n ) -> np.ndarray:\n return 1/(1+np.exp(-x))", "def sigmoid(X):\n if isinstance(X,(list,tuple)):\n X=np.array(X)\n return 1/(1+np.exp(-X))\n #return np.exp(X)/(1+np.exp(X))", "def sigmoid(x):\n return 1.0/(1 + np.exp(-x))", "def sigmoid(x):\r\...
[ "0.82872546", "0.77726996", "0.75892836", "0.75803345", "0.75792193", "0.75692123", "0.75561017", "0.7554079", "0.7553817", "0.75433666", "0.7523711", "0.7523711", "0.7517644", "0.74938184", "0.7459675", "0.7390222", "0.7347192", "0.7343358", "0.7307995", "0.72994894", "0.729...
0.75519615
14
First derivative of Sigmoid function. The input to this function should be the value that output from sigmoid function.
def der_sigmoid(y): return y * (1 - y)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sigmoid_derivative(x):\n return x * (1-x)", "def derivative_sigmoid(x):\n return x * (1 - x)", "def derivative_sigmoid(x):\n return x * (1 - x)", "def sigmoid_derivative(x):\n return x * (1.0 - x)", "def sigmoid_derivative(x):\n\n return sigmoid(x) * (1 - sigmoid(x))", "def sigmoid_der...
[ "0.87601984", "0.87236494", "0.87236494", "0.87169576", "0.8606332", "0.84701663", "0.8355083", "0.7660587", "0.76379246", "0.76147074", "0.75108695", "0.7500872", "0.74812835", "0.7464008", "0.74280185", "0.7420573", "0.7313185", "0.7219959", "0.72071964", "0.71963114", "0.7...
0.7864624
7
A handcrafted implementation of simple network.
def __init__(self, hidden_size, num_step=2000, print_interval=1000): self.num_step = num_step self.print_interval = print_interval # Model parameters initialization # Please initiate your network parameters here. self.w1 = np.array([[random.random() for i in range(hidden_size)] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def basic_network(cm=False):\n # fmt: off\n tpm = np.array([\n [0, 0, 0],\n [0, 0, 1],\n [1, 0, 1],\n [1, 0, 0],\n [1, 1, 0],\n [1, 1, 1],\n [1, 1, 1],\n [1, 1, 0],\n ])\n if cm is False:\n cm = np.array([\n [0, 0, 1],\n ...
[ "0.6780551", "0.6732573", "0.6719326", "0.6683937", "0.6660805", "0.6627568", "0.6614102", "0.6609547", "0.6552806", "0.64799374", "0.64727414", "0.644539", "0.64116246", "0.63671744", "0.62734425", "0.6249296", "0.62257653", "0.6222961", "0.6196915", "0.6179985", "0.61756784...
0.0
-1
Data visualization with ground truth and predicted data comparison. There are two plots for them and each of them use different colors to differentiate the data with different labels.
def plot_result(data, gt_y, pred_y): assert data.shape[0] == gt_y.shape[0] assert data.shape[0] == pred_y.shape[0] plt.figure() plt.subplot(1, 2, 1) plt.title('Ground Truth', fontsize=18) for idx in range(data.shape[0]): if gt_y[idx] == 0: p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_true_predictions(self):\n \n if self.data_generated:\n \n # Choosing a different color for each target\n n_targets = len(self.true_data['targets'])\n cmap = plt.get_cmap('gnuplot')\n colors = [cmap(i) for i in np.linspace(0, 0.9, n_targe...
[ "0.72492915", "0.69190305", "0.6835955", "0.66809905", "0.667098", "0.666655", "0.66369617", "0.6629329", "0.65713775", "0.6568579", "0.6568099", "0.65115273", "0.65052915", "0.6482675", "0.645257", "0.64101094", "0.63752383", "0.6353995", "0.63376975", "0.63136935", "0.63063...
0.761913
1
Implementation of the forward pass. It should accepts the inputs and passing them through the network and return results.
def forward(self, inputs): #print("w1 shape", self.w1.shape) z1 = np.dot(inputs, self.w1) self.a1 = sigmoid(z1) z2 = np.dot(self.a1, self.w2) self.a2 = sigmoid(z2) z3 = np.dot(self.a2, self.w3) self.y = sigmoid(z3) return...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forward(self, inputs):\r\n #print (len(inputs))\r\n out = self.fc1(inputs)\r\n out = self.fc2(out)\r\n self.out = out\r\n return out\r\n #raise NotImplementedError('Implement the forward method of the model')\r", "def forward(self, inputs):\n raise NotImplemen...
[ "0.8330594", "0.8141684", "0.7926628", "0.78035897", "0.78035897", "0.78035897", "0.7752818", "0.7752818", "0.7738907", "0.7679073", "0.7660625", "0.7643285", "0.7581304", "0.7569203", "0.7479867", "0.74048865", "0.7394922", "0.73774797", "0.7364085", "0.73442876", "0.7337264...
0.0
-1
Implementation of the backward pass. It should utilize the saved loss to compute gradients and update the network all the way to the front.
def backward(self, i): #Compute gradient for w1, w2, w3 w1_grad = np.zeros((2, 3)) w2_grad = np.zeros((3, 3)) w3_grad = np.zeros((3, 1)) w3_backward_pass = np.zeros((1, 1)) w2_backward_pass = np.zeros((1, 3)) #print("self.error shap...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def backward_pass(self, loss):\n\n self.optimizer.zero_grad()\n self.optimizer.backward(loss)\n self.optimizer.step()", "def backward(self, loss):\n global_timer.my_timer.start_profile(\"BWD\")\n mgr = PatrickStarManager()\n mgr.set_training_stage(TrainingStage.BWD)\n\n ...
[ "0.8116909", "0.788521", "0.78546345", "0.7807031", "0.7777338", "0.7689684", "0.7631545", "0.7611851", "0.76023585", "0.75521505", "0.75045365", "0.7501314", "0.7501314", "0.7485868", "0.7481361", "0.7481292", "0.7444571", "0.739935", "0.73771346", "0.73410493", "0.7311101",...
0.704288
47
The training routine that runs and update the model.
def train(self, inputs, labels): # make sure that the amount of data and label is match assert inputs.shape[0] == labels.shape[0] n = inputs.shape[0] self.X = inputs for epochs in range(self.num_step): for idx in range(n): # operation in each training...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self) -> None:\n self.model = self.trainer.train_model(self.model, self.data)", "def train(self):\n self.log(f\"{self.cur_file_path}\\t\\tInfo: train method invoked!\")\n self.log(f\"{self.cur_file_path}\\t\\tInfo: training {self.model.__class__.__name__} model!\")\n\n self.mo...
[ "0.8060706", "0.7975103", "0.7927661", "0.7736048", "0.76948273", "0.76467866", "0.76372075", "0.75805736", "0.7536198", "0.7535632", "0.7504544", "0.7491782", "0.7491782", "0.7491782", "0.7491782", "0.7491782", "0.7424159", "0.74111897", "0.7405611", "0.7394329", "0.7371131"...
0.0
-1
The testing routine that run forward pass and report the accuracy.
def test(self, inputs, labels): n = inputs.shape[0] error = 0.0 for idx in range(n): result = self.forward(inputs[idx:idx+1, :]) error += abs(result - labels[idx:idx+1, :]) print("error: ", error) error /= n print('accuracy: %.2f' % ((1 - error)*...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_test_accuracy(self):\n print('\\n# Evaluate on test data')\n results = self.model.evaluate(self.data.test_dataset)\n print('\\ntest loss, test acc:', results)", "def test(self, inputs, labels):\n n = inputs.shape[0]\n\n error = 0.0\n for idx in range(n):\n resul...
[ "0.72380465", "0.715886", "0.7128923", "0.7114244", "0.69067264", "0.6893159", "0.68612593", "0.6830581", "0.6810949", "0.6660967", "0.6586082", "0.6583371", "0.65602446", "0.6550997", "0.65361035", "0.6513076", "0.651241", "0.6480439", "0.6477393", "0.6469423", "0.6455284", ...
0.6952357
4
Gets a batch of Kitti images
def get(self, idxs, reader_idx=0): images = None classes = None bboxes = None depths = None suppress = None if reader_idx < self.num_readers: kitti_images = [] kitti_suppress = [] kitti_classes = [] kitti_bboxes = [] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def batch(img_path, gt_path,img_list, batch, total_size, label_list):\r\n\r\n image_list = [os.path.join(img_path, i) for i in img_list]\r\n gt_list = [os.path.join(gt_path,i) for i in img_list]\r\n\r\n \r\n for i in range(0, total_size, batch):\r\n yield image_load_resize(image_list[i:i+batch])...
[ "0.698181", "0.6909378", "0.68081933", "0.6774116", "0.66922164", "0.66588205", "0.66521394", "0.6625911", "0.66220707", "0.6333528", "0.6321946", "0.6295973", "0.62674206", "0.62569577", "0.6205556", "0.618339", "0.61810595", "0.6170498", "0.61429924", "0.6130476", "0.611273...
0.0
-1
Sets up the target generator. Initializes model information, target/mask size information and index matrices
def setup(self, num_classes=5, image_height=352, image_width=1216, stride=4): self.num_classes = num_classes self.stride = stride # Setting the target height/width based on the image height/width and stride self.target_height = int(np.ceil(image_height / stride)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def model_setup(self):\n self.DNN = DgganMLP(self.settings.hidden_size)\n self.D = DgganMLP(self.settings.hidden_size)\n self.G = Generator(self.settings.hidden_size)", "def model_setup(self):\n self.DNN = SganMLP(self.settings.number_of_bins)\n self.D = SganMLP(self.settings.n...
[ "0.6743984", "0.6662545", "0.6412051", "0.633487", "0.60139644", "0.6012132", "0.59861887", "0.5959018", "0.5939881", "0.59041286", "0.58947814", "0.58561397", "0.58427376", "0.5808038", "0.58001965", "0.5791838", "0.5786698", "0.5760188", "0.57474685", "0.57474685", "0.57327...
0.6084381
4
Generates a network target from the `objects`.
def generate(self, objects): 'Initialize/reset each target volume with zeros' self.classification_mask = np.zeros([self.num_classes, self.target_height, self.target_width]) self.bbox_mask = np.zeros([self.num_coords, self.target_height, self.target_width]) self.depth_mas...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def targets(obj, reftype):", "def _make_targets(self, pargs, origin):\n targets = []\n for pi, ai, co, ci, pa, pch, mask in pargs:\n if len(pi) < 5:\n continue\n\n tr = Target()\n tr.origin = origin\n tr.poly_points = pi\n # ...
[ "0.60472536", "0.5931685", "0.5639617", "0.5610839", "0.5562847", "0.55241793", "0.5485938", "0.5450851", "0.53905225", "0.53836095", "0.53825873", "0.53552836", "0.5295558", "0.52760553", "0.52651876", "0.5251376", "0.524118", "0.52309996", "0.5196931", "0.5173882", "0.51695...
0.5918512
2
Suppresses background and don't care classes for the bounding box and depth masks.
def _suppress_bg_dc(self): # mask for suppressing background/don't care classes suppress_mask = 1 - (self.classification_mask[0] + self.classification_mask[1]) # Suppress bounding box mask for i in range(self.num_coords): self.bbox_mask[i] = np.multiply(se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_mask(mask, background=0):\n kernels = [\n np.array([[ 1, -1, -1], [-1, 1, -1], [-1, -1, -1]]), # top left standalone pixel\n np.array([[-1, -1, 1], [-1, 1, -1], [-1, -1, -1]]), # top right standalone pixel\n np.array([[-1, -1, -1], [-1, 1, -1], [ 1, -1, -1]]), # bottom left...
[ "0.65584725", "0.6462295", "0.6241451", "0.6011713", "0.5985777", "0.58868444", "0.58594817", "0.5858424", "0.5788712", "0.5771418", "0.5730475", "0.57079804", "0.5688872", "0.5662684", "0.56402606", "0.56402606", "0.56084776", "0.5579039", "0.5578632", "0.55614763", "0.55481...
0.765611
0
Updates the classification target/mask. Sets classification mask to 1 where object resides for the specified object class (dimension), removes (sets to 0) classification mask for background class
def _update_classification_mask(self, obj_class, mask_coords): # Remove background where object resides self.classification_mask[0, mask_coords[1]:mask_coords[3], mask_coords[0]:mask_coords[2]] = 0 # Set classification mask where object resides self.classification_mask[ob...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_mask_class(y_true: Tensor):\n y_true = y_true.detach().cpu()\n batch_size = y_true.size(0)\n num_classes = y_true.size(1)\n if num_classes == 1:\n y_true = y_true.view(batch_size, -1)\n elif num_classes == 2:\n y_true = y_true[:, 1, ...].contiguous().view(batch_size, -1) #...
[ "0.6051678", "0.59728235", "0.59617054", "0.5888132", "0.579369", "0.57847327", "0.5740755", "0.5721277", "0.56688094", "0.56654084", "0.5584212", "0.55299306", "0.5471518", "0.544962", "0.5445147", "0.5418681", "0.54098785", "0.5379724", "0.53662145", "0.53600085", "0.534663...
0.8229826
0
Updates the bounding box mask.
def _update_bbox_mask(self, bbox_coords, mask_coords): # Set target/mask regions to image bounding box values self.bbox_mask[0, mask_coords[1]:mask_coords[3], mask_coords[0]:mask_coords[2]] = bbox_coords[0] self.bbox_mask[1, mask_coords[1]:mask_coords[3], mask_coords[0]:mask_coords[2...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_mask(self, mask):\n\n # Get general mask\n general_mask = self.general_mask\n\n # Complete with the input mask\n new_mask = (general_mask | mask)\n\n # Update attribute\n self.mask = new_mask\n\n # Correct i_bounds if it was not specified\n # self....
[ "0.75237775", "0.6830645", "0.6461692", "0.64357376", "0.63380176", "0.6325248", "0.63241714", "0.63219225", "0.63219225", "0.6279461", "0.62621343", "0.6258309", "0.61555755", "0.6138366", "0.6099952", "0.60500365", "0.59804887", "0.59581435", "0.5953628", "0.58981764", "0.5...
0.75807804
0
Updates the depth target/mask. Sets depth mask to the object distance value where the object resides
def _update_depth_mask(self, bbox_coords, mask_coords): # Compute object distance in camera coordinates distance = np.linalg.norm(bbox_coords) # Set target/mask bounding box to distance value self.depth_mask[0, mask_coords[1]:mask_coords[3], mask_coords[0]:mask_coords[2]]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_depth_image(self, depth_image):\n depth_image = depth_image.copy()\n mask = np.where(self.depth != 0)\n depth_image[mask] = self.depth[mask]\n return depth_image", "def set_depth(self, d):\r\n self.depth = d", "def update(self):\n\n obstVals = self.robot.getDept...
[ "0.65219533", "0.6309409", "0.60920554", "0.6080584", "0.58906686", "0.5660977", "0.56466246", "0.56459874", "0.5601333", "0.55544955", "0.5519529", "0.54683584", "0.54389834", "0.54141563", "0.54045874", "0.5251762", "0.5218233", "0.5212886", "0.5203349", "0.5186193", "0.512...
0.7949633
0
Get object class/type as integer value.
def _get_class(self, obj): object_type = obj.object_type 'Background class' object_class = 0 # Don't care classes if object_type in ['DontCare', 'Person_sitting'] or obj.truncation > 0.75 or obj.occlusion > 1: object_class = 1 #...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __int__(self):\n return int(self.obj)", "def as_int(self):\n return self.as_type(int)", "def __int__(self):\n return self.get_raw_int()", "def type(self) -> int:\n raise NotImplemented", "def getInteger(self):", "def getInteger(self):", "def typecode (self) :\r\n ...
[ "0.75328976", "0.68305755", "0.6802564", "0.6463922", "0.64499986", "0.64499986", "0.63958645", "0.6391265", "0.634385", "0.6329917", "0.6329917", "0.6326063", "0.62648165", "0.62240374", "0.62227476", "0.62104326", "0.6194881", "0.61826885", "0.6130903", "0.6121851", "0.6121...
0.6513827
3
Get shrink factor 0.2 for don't care classes, otherwise 0.5.
def _get_shrink_factor(self, obj_class): return 0.5 if obj_class == 1 else 0.2
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shrink(value):\n return (1 + value) / 2", "def _shrink_main(self, amt):\n self.ratio -= amt\n self.ratio = max(self.min_ratio, self.ratio)", "def _shrink_solo_secondary(self, amt):\n self.ratio += amt\n self.ratio = min(self.max_ratio, self.ratio)", "def shrink(self):\n...
[ "0.6753253", "0.6477864", "0.6349043", "0.6325587", "0.62213475", "0.6212219", "0.59073776", "0.5755183", "0.5662071", "0.5660799", "0.55830854", "0.5568108", "0.5534276", "0.55322623", "0.5520105", "0.54937047", "0.54918087", "0.54691523", "0.54646486", "0.5417098", "0.54150...
0.8377038
0
Get bounding box coordinates mapped to target/mask coordinates.
def _get_mask_coords(self, obj, shrink_factor): # split bounding box into x,y coordinates xmin, ymin, xmax, ymax = np.split(obj.bounding_box, len(obj.bounding_box)) # compute bounding box center coordinate bbox_center = np.array([xmin + (xmax - xmin) / 2, ymin + (ymax - y...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bounding_box(self):\n latlon00 = self.ij_to_latlon(-1,-1)\n latlon01 = self.ij_to_latlon(-1,self.domain_size[1]+1)\n latlon11 = self.ij_to_latlon(self.domain_size[0]+1,self.domain_size[1]+1)\n latlon10 = self.ij_to_latlon(self.domain_size[0]+1,-1)\n return (latlon00,latlon01,...
[ "0.72255194", "0.7148642", "0.7067591", "0.6957974", "0.68591", "0.68346167", "0.6829538", "0.6804426", "0.6800595", "0.67711234", "0.6754198", "0.6741878", "0.6736427", "0.67342806", "0.67342806", "0.6726432", "0.67016345", "0.6692683", "0.6662506", "0.65757245", "0.6558426"...
0.7551965
0
TEAdecipher a raw string
def decipher_raw(s, key): assert struct.calcsize('I') == 4 assert len(s) % 8 == 0, len(s) u = struct.unpack('%dI' % (len(s) / 4), s) e = [decrypt(u[i], u[i + 1], key) for i in range(len(u))[::2]] return b''.join([struct.pack('2I', ee, ef) for ee, ef in e])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __decrypt(string: str) -> str:\n key = 171\n result = \"\"\n i: int\n for i in string:\n a = key ^ i\n key = i\n result += chr(a)\n return result", "def encrypt_string(self, raw_string):\n return self.fernet_instance.encrypt(raw_strin...
[ "0.603108", "0.5927424", "0.58939284", "0.58939284", "0.5668595", "0.5660442", "0.56581235", "0.56284785", "0.56123984", "0.56107175", "0.5610184", "0.5593652", "0.5547797", "0.5510677", "0.55048835", "0.55010855", "0.54805976", "0.5421111", "0.5391804", "0.5383944", "0.53831...
0.57095903
4
TEAdecipher a readable string
def decipher(s, key): # s = message return decipher_raw(s, key).rstrip(bytes('\x00'.encode('utf-8')))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decode(self, s):", "def decode(self, s):", "def __decrypt(string: str) -> str:\n key = 171\n result = \"\"\n i: int\n for i in string:\n a = key ^ i\n key = i\n result += chr(a)\n return result", "def __decodeString(self,ascii):\n ...
[ "0.6088144", "0.6088144", "0.6083961", "0.59669656", "0.59265375", "0.58188593", "0.57889634", "0.5739999", "0.56989884", "0.5665952", "0.5662835", "0.56381017", "0.563521", "0.56271595", "0.56076795", "0.5601502", "0.55516595", "0.5532928", "0.5529246", "0.552184", "0.552180...
0.0
-1
TEAdecipher a raw string
def decipher_raw2(s, key): assert struct.calcsize('I') == 4 assert len(s) % 8 == 0, len(s) u = struct.unpack('%dI' % (len(s) / 4), s) stringa = str(b'\xff\xd8\xff').replace('\'', '') for i in range(len(u))[::2]: e = [decrypt2(u[i], u[i + 1], key)] i = b''.join([struct.pack('2I', ee, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __decrypt(string: str) -> str:\n key = 171\n result = \"\"\n i: int\n for i in string:\n a = key ^ i\n key = i\n result += chr(a)\n return result", "def encrypt_string(self, raw_string):\n return self.fernet_instance.encrypt(raw_strin...
[ "0.60299903", "0.5923909", "0.5895414", "0.5895414", "0.5707876", "0.56680304", "0.5662493", "0.5627445", "0.5611586", "0.5609877", "0.5609046", "0.55948067", "0.5546838", "0.5510928", "0.5504863", "0.5500292", "0.54825294", "0.5421781", "0.53899634", "0.53847766", "0.5384431...
0.56581277
7
TEAdecipher a readable string
def decipher2(s, key): # s = message return decipher_raw2(s, key).rstrip(bytes('\x00'.encode('utf-8')))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decode(self, s):", "def decode(self, s):", "def __decrypt(string: str) -> str:\n key = 171\n result = \"\"\n i: int\n for i in string:\n a = key ^ i\n key = i\n result += chr(a)\n return result", "def __decodeString(self,ascii):\n ...
[ "0.6088144", "0.6088144", "0.6083961", "0.59669656", "0.59265375", "0.58188593", "0.57889634", "0.5739999", "0.56989884", "0.5665952", "0.5662835", "0.56381017", "0.563521", "0.56271595", "0.56076795", "0.5601502", "0.55516595", "0.5532928", "0.5529246", "0.552184", "0.552180...
0.0
-1
Obtain data from the functions/ directory.
def get_sections_data(dirs, root_depth=0): # type: (list(, int)) -> dict sections = dict() for info in dirs: # search through directories depth = info[0].count("/") if depth == root_depth: # section section = TABLE[info[0].split("/")[-1]] sections[section] = dict(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_data(path=None):\n import os\n location = os.path.dirname(__file__).replace('/fun', '/ax')\n if path is None:\n print(\"Choose one: \")\n print(\"\\n\".join(os.listdir(os.path.abspath(location))))\n else:\n return os.path.join(os.path.abspath(location), path)", "def get_f...
[ "0.6649906", "0.65643775", "0.62378126", "0.58906674", "0.58688694", "0.58688694", "0.58688694", "0.58524084", "0.58486766", "0.5791835", "0.5767962", "0.57443917", "0.5697903", "0.5672255", "0.5637025", "0.5628779", "0.5626075", "0.5583516", "0.5550271", "0.5508503", "0.5502...
0.0
-1
Generates and writes the results of traversing the root directory, and translating all files in FILES.
def translate_files(root_directory, output_file): # type: () root_depth = len(root_directory.split("/")) dirs = [d for d in os.walk(root_directory) if d[0].count("/") == root_depth] sections = get_sections_data(dirs, root_depth=root_depth) # generate subsection headers for section, subsectio...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_files(self):\n\t\tapply_stemmer, xml_file, query_file, expected_file = self.read_config_file()\n\t\tself.generate_query_file(query_file, xml_file, apply_stemmer)\n\t\tself.generate_expected_file(expected_file, xml_file)\n\t\tlogging.info('FINALIZADO: MÓDULO PROCESSADOR DE CONSULTAS')", "def _walk_di...
[ "0.64966166", "0.6460757", "0.6386852", "0.6370105", "0.626249", "0.62603694", "0.6221598", "0.61822647", "0.6176402", "0.61323655", "0.611833", "0.61116767", "0.6110516", "0.6088533", "0.6053908", "0.6014351", "0.5996637", "0.59711146", "0.59499", "0.5925247", "0.5915936", ...
0.6501915
0
Return set of all variable names used in Call
def op_vars(self, attr_calls = True): varnames = set() op_var = self._get_op_var() if op_var is not None: varnames.add(op_var) if (not attr_calls and self.func == "__call__" and isinstance(self.args[0], Call) and self.args[0].func == "__g...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_variables_names(self):\n return self.project.get_variable_names() + self.design.get_variable_names()", "def varNames(self):\n return self.__varNames", "def variables_used (self) :\r\n\t\treturn [i[0] for i in self.parameters]", "def variables(s):\n result = set([])\n def walk(...
[ "0.7222859", "0.7198924", "0.70924807", "0.7070117", "0.70563793", "0.7032682", "0.6956318", "0.6945843", "0.69337505", "0.69089997", "0.6836117", "0.6764953", "0.6725772", "0.67194897", "0.67115456", "0.67067635", "0.66894853", "0.666509", "0.6656405", "0.66467744", "0.66301...
0.6666726
17
Called if no explicit visitor function exists for a node.
def generic_visit(self, node): node.map_subcalls(self.visit)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def visit_nonstrict(self, node):\n name = 'visit_%s' % node.__class__.__name__\n try:\n method = getattr(self, name)\n except AttributeError:\n pass\n else:\n method(node)", "def no_visit_method(self, node: None, symbol_table: SymbolTable):\n ra...
[ "0.7080836", "0.7049841", "0.6931889", "0.68415844", "0.67500186", "0.67500186", "0.6630894", "0.6530177", "0.6501405", "0.642987", "0.642987", "0.63553625", "0.62231934", "0.61957836", "0.6174697", "0.6150994", "0.59714776", "0.5965445", "0.5913915", "0.5903648", "0.5890149"...
0.5561227
30
Print representation that resembles code used to create symbol.
def explain(symbol): if isinstance(symbol, Symbolic): print(symbol.source) else: print(symbol)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n dictt = self.getFullDict()\n return \"SymbolTable(\\n{}\\n)\".format(pprint.pformat(dictt))", "def __repr__(self):\n s = '{\\n'\n s += 'symbol: \\'' + self.symbol + '\\',\\n'\n s += 'label: \\'' + self.label + '\\',\\n'\n s += 'coords: ' + str(self.c...
[ "0.7456397", "0.7275658", "0.70717686", "0.69211096", "0.6814309", "0.68047076", "0.6772585", "0.6770289", "0.6743779", "0.6713505", "0.666437", "0.6640906", "0.6621319", "0.66029316", "0.65998054", "0.65644276", "0.6545657", "0.6537183", "0.6526337", "0.65120643", "0.6504262...
0.6322685
39
1.This is outer function doc
def outer(func): print("1This is outer function\n", outer.__name__, outer.__doc__) # @wraps(func) def inner(): """ 2.This is inner function doc """ print("2This is inner function\n", inner.__name__, inner.__doc__) func() return inner
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def func_doc():", "def func():", "def inner():\n print(\"2This is inner function\\n\", inner.__name__, inner.__doc__)\n func()", "def fn():", "def example_function():", "def g():", "def somefunc():", "def firstFunction(self):", "def plothub1():\r\n pass", "def f():", "def f():"...
[ "0.7320636", "0.7247775", "0.7117645", "0.70340997", "0.69838387", "0.6803952", "0.6779911", "0.67322886", "0.6686417", "0.6629269", "0.6629269", "0.6614427", "0.6610885", "0.6601652", "0.65939987", "0.6555766", "0.6550982", "0.6549004", "0.65400654", "0.6525443", "0.6512712"...
0.7095086
3
2.This is inner function doc
def inner(): print("2This is inner function\n", inner.__name__, inner.__doc__) func()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def func_doc():", "def func():", "def outer(func):\n print(\"1This is outer function\\n\", outer.__name__, outer.__doc__)\n\n # @wraps(func)\n def inner():\n \"\"\"\n 2.This is inner function doc\n \"\"\"\n print(\"2This is inner function\\n\", inner.__name__, inner.__doc__...
[ "0.7314841", "0.71997875", "0.6960891", "0.6956809", "0.6925443", "0.67094266", "0.67094266", "0.67094266", "0.67094266", "0.67094266", "0.66744035", "0.6662484", "0.6639418", "0.6628781", "0.6556674", "0.6535099", "0.65294397", "0.65168387", "0.6515121", "0.6504789", "0.6500...
0.7596468
0
3.This is custom function doc
def custom_func(): print("3This is custom function\n", custom_func.__name__, custom_func.__doc__)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def func():", "def func_doc():", "def fn():", "def example_function():", "def __call__(fun_name):", "def cpp_function(self):", "def fn(*args, **kwargs):\n pass", "def function(self):\n raise NotImplementedError", "def my_function():\n\tpass", "def dummy_fn(self, *args, **kwargs)...
[ "0.78651154", "0.7679242", "0.76098806", "0.74240965", "0.7219672", "0.71826315", "0.7156973", "0.715083", "0.70380765", "0.68878466", "0.6866208", "0.6754988", "0.6754988", "0.6754988", "0.6754988", "0.6754988", "0.6746803", "0.6730078", "0.67196953", "0.67196953", "0.671095...
0.7380106
4