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
Evaluates all the QC metric functions in this module (those starting with 'check') and returns the results. The optional kwargs listed below are passed to each QC metric function.
def get_bpodqc_metrics_frame(data, **kwargs): def is_metric(x): return isfunction(x) and x.__name__.startswith('check_') # Find all methods that begin with 'check_' checks = getmembers(sys.modules[__name__], is_metric) prefix = '_task_' # Extended QC fields will start with this # Method 'ch...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_all(self):\n # TODO: this should use functions in execute.py to run tests in-sequence so that variable\n # name collisions are accounted for\n self._log_event(EventType.BEGIN_CHECK_ALL)\n\n # TODO: this is a janky way of resolving where the tests are. Formalize a method of \n ...
[ "0.5860062", "0.5827285", "0.5809412", "0.57624185", "0.5620037", "0.5605969", "0.5575548", "0.55414146", "0.54573965", "0.5391575", "0.5385385", "0.53589267", "0.5340336", "0.53369385", "0.53235877", "0.53075016", "0.53034043", "0.5302152", "0.52251285", "0.52243036", "0.521...
0.6367398
0
Checks that the time difference between the onset of the visual stimulus and the onset of the go cue tone is positive and less than 10ms.
def check_stimOn_goCue_delays(data, **_): # Calculate the difference between stimOn and goCue times. # If either are NaN, the result will be Inf to ensure that it crosses the failure threshold. metric = np.nan_to_num(data["goCue_times"] - data["stimOn_times"], nan=np.inf) passed = (metric < 0.01) & (met...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_time():\n times = get_times()\n time_difference = abs((times['local'] - times['target']).total_seconds())\n return time_difference < post_time_tol_seconds", "def check_errorCue_delays(data, **_):\n metric = np.nan_to_num(data[\"errorCue_times\"] - data[\"errorCueTrigger_times\"], nan=np.inf...
[ "0.67452455", "0.661119", "0.66066587", "0.6345932", "0.6258288", "0.6236096", "0.6135885", "0.610645", "0.6103701", "0.60535103", "0.5981245", "0.59316677", "0.5911776", "0.5881983", "0.5873338", "0.5859669", "0.58114415", "0.5803081", "0.57706165", "0.57561266", "0.57425934...
0.6955062
0
Checks that the time difference between the response and the feedback onset (error sound or valve) is positive and less than 10ms.
def check_response_feedback_delays(data, **_): metric = np.nan_to_num(data["feedback_times"] - data["response_times"], nan=np.inf) passed = (metric < 0.01) & (metric > 0) assert data["intervals"].shape[0] == len(metric) == len(passed) return metric, passed
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_time():\n times = get_times()\n time_difference = abs((times['local'] - times['target']).total_seconds())\n return time_difference < post_time_tol_seconds", "def check_errorCue_delays(data, **_):\n metric = np.nan_to_num(data[\"errorCue_times\"] - data[\"errorCueTrigger_times\"], nan=np.inf...
[ "0.6539133", "0.6228387", "0.5913726", "0.58829933", "0.58373797", "0.5837246", "0.58290553", "0.5787292", "0.5782435", "0.5740518", "0.57268006", "0.5696717", "0.5689673", "0.5688602", "0.56735766", "0.5667824", "0.56554264", "0.56536883", "0.5650586", "0.5647413", "0.562253...
0.66533184
0
Checks that the time difference between the visual stimulus freezing and the response is positive and less than 100ms.
def check_response_stimFreeze_delays(data, **_): # Calculate the difference between stimOn and goCue times. # If either are NaN, the result will be Inf to ensure that it crosses the failure threshold. metric = np.nan_to_num(data["stimFreeze_times"] - data["response_times"], nan=np.inf) # Test for valid ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_time():\n times = get_times()\n time_difference = abs((times['local'] - times['target']).total_seconds())\n return time_difference < post_time_tol_seconds", "def remaining_ms():", "def check_stimFreeze_delays(data, **_):\n metric = np.nan_to_num(data[\"stimFreeze_times\"] - data[\"stimFre...
[ "0.6850367", "0.66160536", "0.6374804", "0.6345569", "0.6269667", "0.6260532", "0.6249905", "0.6247848", "0.62191147", "0.6194862", "0.6190176", "0.61887175", "0.6181643", "0.61796886", "0.6098504", "0.60839707", "0.6060317", "0.6029891", "0.6001722", "0.5985031", "0.59810483...
0.69304246
0
Check that the start of the trial interval is within 10ms of the visual stimulus turning off.
def check_stimOff_itiIn_delays(data, **_): # If either are NaN, the result will be Inf to ensure that it crosses the failure threshold. metric = np.nan_to_num(data["itiIn_times"] - data["stimOff_times"], nan=np.inf) passed = ((metric < 0.01) & (metric >= 0)).astype(float) # Remove no_go trials (stimOff ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def should_stop(self, frac_for_search=0.85):\n\n cur_time = time.time()\n return (cur_time - self._start_time) >= frac_for_search * self._time_budget", "def time_is_out(self):\n return self.get_simulation_time() > self.config.max_time", "def check_stimOff_delays(data, **_):\n metric = n...
[ "0.63186246", "0.61754483", "0.6080378", "0.6033233", "0.5956797", "0.59156644", "0.58557594", "0.5820624", "0.5791662", "0.575639", "0.573831", "0.57282573", "0.5710017", "0.56937844", "0.56884557", "0.5685853", "0.5673288", "0.5667813", "0.5665415", "0.5660665", "0.5656665"...
0.5364126
75
Check that the period of gray screen between stim off and the start of the next trial is 0.5s +/ 200%.
def check_iti_delays(data, **_): # Initialize array the length of completed trials metric = np.full(data["intervals"].shape[0], np.nan) passed = metric.copy() # Get the difference between stim off and the start of the next trial # Missing data are set to Inf, except for the last trial which is a NaN...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_stimOn_delays(data, **_):\n metric = np.nan_to_num(data[\"stimOn_times\"] - data[\"stimOnTrigger_times\"], nan=np.inf)\n passed = (metric <= 0.15) & (metric > 0)\n assert data[\"intervals\"].shape[0] == len(metric) == len(passed)\n return metric, passed", "def check_stimOff_delays(data, **_...
[ "0.62369365", "0.6093667", "0.60400087", "0.60400087", "0.60380054", "0.60068035", "0.5923062", "0.5866355", "0.5861482", "0.5854692", "0.5836571", "0.58123666", "0.57815397", "0.57758045", "0.577544", "0.5755446", "0.5724792", "0.57190776", "0.57091266", "0.57058424", "0.567...
0.5373369
65
Check that the wheel does move within 100ms of the feedback onset (error sound or valve).
def check_wheel_move_before_feedback(data, **_): # Get tuple of wheel times and positions within 100ms of feedback traces = traces_by_trial( data["wheel_timestamps"], data["wheel_position"], start=data["feedback_times"] - 0.05, end=data["feedback_times"] + 0.05, ) metric ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def quick_check(self):\n #loop three times and moce the servo \n for ang in range(self.MIDPOINT - 115, self.MIDPOINT+116, 115):\n self.servo(ang)\n time.sleep(.05)\n if self.read_distance() < self.SAFE_DISTANCE:\n return False\n #if the three-par...
[ "0.66823375", "0.6660327", "0.6061239", "0.6020045", "0.60030603", "0.59889495", "0.5890945", "0.58775824", "0.58463895", "0.58456963", "0.58017486", "0.57889277", "0.574577", "0.57411665", "0.57179874", "0.56755745", "0.5675489", "0.5675418", "0.56641567", "0.5627082", "0.55...
0.68362546
0
Check that the wheel moves by approximately 35 degrees during the closedloop period on trials where a feedback (error sound or valve) is delivered.
def _wheel_move_during_closed_loop(re_ts, re_pos, data, wheel_gain=None, tol=1, **_): if wheel_gain is None: _log.warning("No wheel_gain input in function call, returning None") return None, None # Get tuple of wheel times and positions over each trial's closed-loop period traces = traces_b...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_wheel_move_before_feedback(data, **_):\n # Get tuple of wheel times and positions within 100ms of feedback\n traces = traces_by_trial(\n data[\"wheel_timestamps\"],\n data[\"wheel_position\"],\n start=data[\"feedback_times\"] - 0.05,\n end=data[\"feedback_times\"] + 0.05...
[ "0.6896701", "0.67245317", "0.64731926", "0.64051974", "0.63707674", "0.6349085", "0.61891997", "0.6164305", "0.61226195", "0.6035763", "0.598332", "0.59420884", "0.5899759", "0.58649623", "0.5802859", "0.5794761", "0.579144", "0.5765569", "0.57602274", "0.5758644", "0.573117...
0.67129755
2
Check that the wheel moves by approximately 35 degrees during the closedloop period on trials where a feedback (error sound or valve) is delivered.
def check_wheel_move_during_closed_loop(data, wheel_gain=None, **_): # Get the Bpod extracted wheel data timestamps = data['wheel_timestamps'] position = data['wheel_position'] return _wheel_move_during_closed_loop(timestamps, position, data, wheel_gain, tol=3)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_wheel_move_before_feedback(data, **_):\n # Get tuple of wheel times and positions within 100ms of feedback\n traces = traces_by_trial(\n data[\"wheel_timestamps\"],\n data[\"wheel_position\"],\n start=data[\"feedback_times\"] - 0.05,\n end=data[\"feedback_times\"] + 0.05...
[ "0.68954474", "0.6710869", "0.6472989", "0.6405544", "0.6370359", "0.6348814", "0.6189378", "0.61632794", "0.61214834", "0.60362446", "0.59838736", "0.59421074", "0.5902024", "0.5865627", "0.5801896", "0.5794535", "0.5791539", "0.576547", "0.5760083", "0.57588446", "0.5731025...
0.6723247
1
Check that the wheel moves by approximately 35 degrees during the closedloop period on trials where a feedback (error sound or valve) is delivered. This check uses the Bpod wheel data (measured at a lower resolution) with a stricter tolerance (1 visual degree).
def check_wheel_move_during_closed_loop_bpod(data, wheel_gain=None, **_): # Get the Bpod extracted wheel data timestamps = data.get('wheel_timestamps_bpod', data['wheel_timestamps']) position = data.get('wheel_position_bpod', data['wheel_position']) return _wheel_move_during_closed_loop(timestamps, pos...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_wheel_move_during_closed_loop(data, wheel_gain=None, **_):\n # Get the Bpod extracted wheel data\n timestamps = data['wheel_timestamps']\n position = data['wheel_position']\n\n return _wheel_move_during_closed_loop(timestamps, position, data, wheel_gain, tol=3)", "def check_wheel_move_befor...
[ "0.70852953", "0.6954929", "0.67112726", "0.6621059", "0.65253836", "0.61799824", "0.60759044", "0.60224724", "0.5899143", "0.58587676", "0.5816214", "0.57901406", "0.5771904", "0.5665009", "0.5647753", "0.564011", "0.5637705", "0.5631486", "0.562445", "0.558077", "0.5572283"...
0.6956577
1
Check that the wheel does not move more than 2 degrees in each direction during the quiescence interval before the stimulus appears.
def check_wheel_freeze_during_quiescence(data, **_): assert np.all(np.diff(data["wheel_timestamps"]) >= 0) assert data["quiescence"].size == data["stimOnTrigger_times"].size # Get tuple of wheel times and positions over each trial's quiescence period qevt_start_times = data["stimOnTrigger_times"] - data...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def quick_check(self):\n # loop three times and move the servo\n for ang in range(self.MIDPOINT - 100, self.MIDPOINT + 101, 100):\n self.servo(ang)\n time.sleep(.01)\n if self.read_distance() < self.SAFE_DISTANCE:\n return False \n # if the th...
[ "0.6584762", "0.6560514", "0.5976932", "0.59019744", "0.5843425", "0.57786036", "0.5677382", "0.5633235", "0.55985075", "0.55899405", "0.55809784", "0.5558802", "0.5558802", "0.5558802", "0.5558802", "0.5558802", "0.5558802", "0.5558802", "0.5558802", "0.5558802", "0.5558802"...
0.7057081
0
Check that the detected first movement times are reasonable.
def check_detected_wheel_moves(data, min_qt=0, **_): # Depending on task version this may be a single value or an array of quiescent periods min_qt = np.array(min_qt) if min_qt.size > data["intervals"].shape[0]: min_qt = min_qt[:data["intervals"].shape[0]] metric = data['firstMovement_times'] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_time():\n times = get_times()\n time_difference = abs((times['local'] - times['target']).total_seconds())\n return time_difference < post_time_tol_seconds", "def time_to_move(self):\r\n if int(self.pix_pos.x+TOP_BOTTOM_BUFFER//2) % self.app.cell_width == 0:\r\n if self.direct...
[ "0.66767734", "0.64776844", "0.6209506", "0.6206966", "0.6181623", "0.61467826", "0.6139169", "0.6107836", "0.60901344", "0.5962288", "0.5961366", "0.59439737", "0.5916781", "0.5914136", "0.5910368", "0.58523804", "0.5834022", "0.5821572", "0.5816675", "0.58116716", "0.581064...
0.6048624
9
Check that the number events per trial is correct Within every trial interval there should be one of each trial event, except for goCueTrigger_times which should only be defined for incorrect trials
def check_n_trial_events(data, **_): intervals = data['intervals'] correct = data['correct'] err_trig = data['errorCueTrigger_times'] # Exclude these fields; valve and errorCue times are the same as feedback_times and we must # test errorCueTrigger_times separately # stimFreeze_times fails oft...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_goCue_delays(data, **_):\n metric = np.nan_to_num(data[\"goCue_times\"] - data[\"goCueTrigger_times\"], nan=np.inf)\n passed = (metric <= 0.0015) & (metric > 0)\n assert data[\"intervals\"].shape[0] == len(metric) == len(passed)\n return metric, passed", "def check_errorCue_delays(data, **_...
[ "0.6352797", "0.6281508", "0.6265516", "0.6174661", "0.610466", "0.6047479", "0.598376", "0.58821785", "0.58792245", "0.58375305", "0.5833678", "0.5823899", "0.5821095", "0.57591885", "0.57549226", "0.5688481", "0.56665254", "0.5654957", "0.56445843", "0.5622237", "0.5621385"...
0.79935586
0
Check that the time difference between the onset of the go cue sound and the feedback (error sound or valve) is positive and smaller than 60.1 s.
def check_trial_length(data, **_): # NaN values are usually ignored so replace them with Inf so they fail the threshold metric = np.nan_to_num(data["feedback_times"] - data["goCue_times"], nan=np.inf) passed = (metric < 60.1) & (metric > 0) assert data["intervals"].shape[0] == len(metric) == len(passed)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_errorCue_delays(data, **_):\n metric = np.nan_to_num(data[\"errorCue_times\"] - data[\"errorCueTrigger_times\"], nan=np.inf)\n passed = ((metric <= 0.0015) & (metric > 0)).astype(float)\n passed[data[\"correct\"]] = metric[data[\"correct\"]] = np.nan\n assert data[\"intervals\"].shape[0] == l...
[ "0.70781237", "0.7067546", "0.6860366", "0.68157357", "0.6473594", "0.63731015", "0.63535625", "0.6339053", "0.610584", "0.6088462", "0.5990782", "0.5982985", "0.5925282", "0.58908373", "0.58709663", "0.58643955", "0.5835171", "0.58261645", "0.5822708", "0.5817701", "0.571886...
0.6608643
4
Check that the time difference between the go cue sound being triggered and effectively played is smaller than 1ms.
def check_goCue_delays(data, **_): metric = np.nan_to_num(data["goCue_times"] - data["goCueTrigger_times"], nan=np.inf) passed = (metric <= 0.0015) & (metric > 0) assert data["intervals"].shape[0] == len(metric) == len(passed) return metric, passed
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_time():\n times = get_times()\n time_difference = abs((times['local'] - times['target']).total_seconds())\n return time_difference < post_time_tol_seconds", "def _check_pulse(self):\n timedelta = time.time() - self.heartbeat\n update_delay = float(1/self.qbpm.frequency)\n ...
[ "0.6558506", "0.652614", "0.63803875", "0.63722324", "0.63205606", "0.62500775", "0.614797", "0.61217046", "0.61198664", "0.6035143", "0.6023255", "0.6005282", "0.59982604", "0.5967966", "0.5940312", "0.5916272", "0.59027004", "0.5871094", "0.5867321", "0.58207625", "0.580995...
0.64367205
2
Check that the time difference between the error sound being triggered and effectively played is smaller than 1ms.
def check_errorCue_delays(data, **_): metric = np.nan_to_num(data["errorCue_times"] - data["errorCueTrigger_times"], nan=np.inf) passed = ((metric <= 0.0015) & (metric > 0)).astype(float) passed[data["correct"]] = metric[data["correct"]] = np.nan assert data["intervals"].shape[0] == len(metric) == len(p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_time():\n times = get_times()\n time_difference = abs((times['local'] - times['target']).total_seconds())\n return time_difference < post_time_tol_seconds", "def exceeded(self):\r\n return int(time.time()) - self.start_time >= self.length", "def _check_pulse(self):\n timedelta ...
[ "0.63809866", "0.6369317", "0.6303926", "0.6241684", "0.6189293", "0.6126625", "0.61201036", "0.6059147", "0.6035885", "0.6030861", "0.5960428", "0.595137", "0.59228307", "0.591266", "0.5895837", "0.5881437", "0.5878008", "0.58527195", "0.58361906", "0.5836097", "0.5812616", ...
0.59147036
13
Check that the time difference between the visual stimulus onsetcommand being triggered and the stimulus effectively appearing on the screen is smaller than 150 ms.
def check_stimOn_delays(data, **_): metric = np.nan_to_num(data["stimOn_times"] - data["stimOnTrigger_times"], nan=np.inf) passed = (metric <= 0.15) & (metric > 0) assert data["intervals"].shape[0] == len(metric) == len(passed) return metric, passed
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_ontime_pane(self):\n pass", "def getRenderingDelay():\n\treturn 10000", "def set_display_time(log_mes,displaytime = 1800000):\n kill_adb_uiautomator_block_old()\n if int(get_screen_off_time(log_mes)) == displaytime:\n if int(displaytime) >= 60000:\n log_mes.info( 'screen off ...
[ "0.5829976", "0.58124435", "0.5725175", "0.56766385", "0.5645575", "0.56244695", "0.5588966", "0.55774724", "0.5574274", "0.55274653", "0.55251485", "0.55121475", "0.54736817", "0.54676294", "0.546234", "0.545834", "0.5455408", "0.54342467", "0.5423098", "0.54160184", "0.5412...
0.53926814
23
Check that the time difference between the visual stimulus offsetcommand being triggered and the visual stimulus effectively turning off on the screen is smaller than 150 ms.
def check_stimOff_delays(data, **_): metric = np.nan_to_num(data["stimOff_times"] - data["stimOffTrigger_times"], nan=np.inf) passed = (metric <= 0.15) & (metric > 0) assert data["intervals"].shape[0] == len(metric) == len(passed) return metric, passed
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_time():\n times = get_times()\n time_difference = abs((times['local'] - times['target']).total_seconds())\n return time_difference < post_time_tol_seconds", "def time_is_out(self):\n return self.get_simulation_time() > self.config.max_time", "def check_stimOn_delays(data, **_):\n m...
[ "0.58006537", "0.56599766", "0.5618854", "0.5499769", "0.5478083", "0.53942436", "0.53775084", "0.5348891", "0.5329084", "0.53289485", "0.5304241", "0.5275082", "0.52612203", "0.52390426", "0.5216157", "0.5191221", "0.51908827", "0.5189167", "0.51579493", "0.51578766", "0.514...
0.58672446
0
Check that the time difference between the visual stimulus freezecommand being triggered and the visual stimulus effectively freezing on the screen is smaller than 150 ms.
def check_stimFreeze_delays(data, **_): metric = np.nan_to_num(data["stimFreeze_times"] - data["stimFreezeTrigger_times"], nan=np.inf) passed = (metric <= 0.15) & (metric > 0) assert data["intervals"].shape[0] == len(metric) == len(passed) return metric, passed
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _checkUiFreeze(self):\r\n\r\n motionCountBefore = core.FW_conf['blackbox'].getCountMotionFrames()\r\n\r\n # swipe a bit to see if it causes motion\r\n yCoordinate = int(self.phone.uiState.getScreenHeight()/1.5)\r\n self.phone._touch.drawLine((self.phone.uiState.getScreenWidth()-2, y...
[ "0.6285543", "0.6078267", "0.59383905", "0.58365345", "0.5743292", "0.57134765", "0.5674565", "0.5663597", "0.5644523", "0.5638384", "0.55540234", "0.5553151", "0.55458677", "0.5534003", "0.55099857", "0.5495784", "0.54823756", "0.54745513", "0.547419", "0.54643154", "0.54413...
0.6246702
1
Check that the reward volume is between 1.5 and 3 uL for correct trials, 0 for incorrect.
def check_reward_volumes(data, **_): metric = data['rewardVolume'] correct = data['correct'] passed = np.zeros_like(metric, dtype=bool) # Check correct trials within correct range passed[correct] = (1.5 <= metric[correct]) & (metric[correct] <= 3.) # Check incorrect trials are 0 passed[~corr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_reward_volume_set(data, **_):\n metric = data[\"rewardVolume\"]\n passed = 0 < len(set(metric)) <= 2 and 0. in metric\n return metric, passed", "def reward_threshold(self) -> Optional[float]:", "def acquisition_function_expected_volume_removal(\n gp_reward_model: BasicGPRewardModel,\n) ->...
[ "0.74345225", "0.6066089", "0.60463685", "0.5764846", "0.56886953", "0.56773823", "0.5655682", "0.557835", "0.557422", "0.5477881", "0.54463166", "0.5427771", "0.5410125", "0.5407789", "0.53777486", "0.5369534", "0.5368286", "0.53387535", "0.5324725", "0.5320856", "0.5311284"...
0.7724097
0
Check that there is only two reward volumes within a session, one of which is 0.
def check_reward_volume_set(data, **_): metric = data["rewardVolume"] passed = 0 < len(set(metric)) <= 2 and 0. in metric return metric, passed
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_reward_volumes(data, **_):\n metric = data['rewardVolume']\n correct = data['correct']\n passed = np.zeros_like(metric, dtype=bool)\n # Check correct trials within correct range\n passed[correct] = (1.5 <= metric[correct]) & (metric[correct] <= 3.)\n # Check incorrect trials are 0\n ...
[ "0.6595489", "0.59923935", "0.58829993", "0.55576754", "0.5459114", "0.5263144", "0.5262954", "0.5224466", "0.51899666", "0.5080002", "0.50792956", "0.5036989", "0.5031256", "0.5027713", "0.501224", "0.50117445", "0.5010227", "0.49776033", "0.49289915", "0.49272078", "0.49198...
0.71636873
0
Check that the difference between wheel position samples is close to the encoder resolution and that the wheel timestamps strictly increase.
def check_wheel_integrity(data, re_encoding='X1', enc_res=None, **_): if isinstance(re_encoding, str): re_encoding = int(re_encoding[-1]) # The expected difference between samples in the extracted units resolution = 1 / (enc_res or ephys_fpga.WHEEL_TICKS ) * np.pi * 2 * ephys_f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_wheel_freeze_during_quiescence(data, **_):\n assert np.all(np.diff(data[\"wheel_timestamps\"]) >= 0)\n assert data[\"quiescence\"].size == data[\"stimOnTrigger_times\"].size\n # Get tuple of wheel times and positions over each trial's quiescence period\n qevt_start_times = data[\"stimOnTrigge...
[ "0.6416596", "0.6204324", "0.5757079", "0.5752711", "0.5702539", "0.5654965", "0.56396395", "0.5632442", "0.5595564", "0.5541013", "0.5507114", "0.54889065", "0.54887325", "0.5486571", "0.54845035", "0.5462624", "0.54456806", "0.5435884", "0.5428846", "0.53493243", "0.5341664...
0.6974392
0
Check that there are no visual stimulus change(s) between the start of the trial and the go cue sound onset 20 ms.
def check_stimulus_move_before_goCue(data, photodiode=None, **_): if photodiode is None: _log.warning("No photodiode TTL input in function call, returning None") return None photodiode_clean = ephys_fpga._clean_frame2ttl(photodiode) s = photodiode_clean["times"] s = s[~np.isnan(s)] # Re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_stimOn_goCue_delays(data, **_):\n # Calculate the difference between stimOn and goCue times.\n # If either are NaN, the result will be Inf to ensure that it crosses the failure threshold.\n metric = np.nan_to_num(data[\"goCue_times\"] - data[\"stimOn_times\"], nan=np.inf)\n passed = (metric <...
[ "0.6354419", "0.6000324", "0.59408736", "0.5866978", "0.57393473", "0.57139313", "0.5711118", "0.5710513", "0.5707353", "0.5694259", "0.5690813", "0.56839126", "0.5650754", "0.56314546", "0.5617871", "0.55769795", "0.55545104", "0.55352086", "0.55352086", "0.55305403", "0.552...
0.5756799
4
Check that there are no audio outputs between the start of the trial and the go cue sound onset 20 ms.
def check_audio_pre_trial(data, audio=None, **_): if audio is None: _log.warning("No BNC2 input in function call, retuning None") return None s = audio["times"][~np.isnan(audio["times"])] # Audio TTLs with NaNs removed metric = np.array([], dtype=np.int8) for i, c in zip(data["intervals...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def test_skipped_already_unsilenced(self):\n self.cog.scheduler.__contains__.return_value = False\n self.cog.previous_overwrites.get.return_value = None\n\n for channel in (MockVoiceChannel(), MockTextChannel()):\n with self.subTest(channel=channel):\n self.asse...
[ "0.6270315", "0.60045695", "0.5891026", "0.5863397", "0.57892865", "0.57889146", "0.57805943", "0.57586294", "0.5748307", "0.57187366", "0.57087165", "0.5685844", "0.5684214", "0.5667447", "0.56195986", "0.5612378", "0.5611862", "0.5586836", "0.5543327", "0.55262345", "0.5487...
0.662603
0
Displays live scores, if there are any cachebased.
def live_scores(): live_scores = cache.get('FOOTBALL_LIVE_SCORES') if live_scores: scores_array = [] for score in json.loads(live_scores)[0:3]: if not score['LIVE']: scores_array.append(score) return {'live_scores': scores_array} else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disp_score():", "def print_scores(self):\n print(\"scores: \", self.get_scores())", "def print_scores(self):\n ### FILL IN ###", "def leaderboard(request):\r\n\tMEDIA_URL = '/media/'\r\n\tgames = Game.objects.all()\r\n\tuser_high_scores = []\r\n\tgame_high_scores = []\r\n\tnew = {}\r\n\t# ...
[ "0.6858791", "0.6613947", "0.64735764", "0.6458424", "0.6457006", "0.64317644", "0.6379885", "0.63430274", "0.62341434", "0.61590296", "0.61511016", "0.60896087", "0.60704505", "0.6070299", "0.60636115", "0.60623306", "0.6015615", "0.6012938", "0.5983447", "0.5973117", "0.596...
0.6330986
8
Generator that reads a file in chunks of bytes
def chunk_reader(fobj, chunk_size=1024): while True: chunk = fobj.read(chunk_size) if not chunk: return yield chunk
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _file_iter(f, size):\n chunk = f.read(size)\n while chunk:\n yield chunk\n chunk = f.read(size)", "def chunked_reader(name):\n with open(name, \"rb\") as src:\n for chunk in iter(lambda: src.read(4096), b\"\"):\n yield chunk", "def iter_chunks(file: io.BytesIO, chun...
[ "0.81411135", "0.812362", "0.79420245", "0.78421736", "0.7806382", "0.7788373", "0.77788925", "0.77514833", "0.7743376", "0.77123445", "0.76579094", "0.7653206", "0.7611707", "0.7543842", "0.7541586", "0.75278574", "0.7496216", "0.7496216", "0.7496216", "0.7496216", "0.748027...
0.7366223
29
This procedure runs properties outside of the AiiDA graph and scheduler, returns (bands, dos), work_folder, error
def properties_run_direct(wf_path, input_dict, work_folder=None, timeout=None): assert wf_path.endswith('fort.9') and 'band' in input_dict and 'dos' in input_dict assert 'first' not in input_dict['dos'] and 'first' not in input_dict['band'] assert 'last' not in input_dict['dos'] and 'last' not in input_dict...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _compute_(self):\n dic = \"data/sim/{dn}/{rad}/\".format(dn=self.event.strftime(\"%Y.%m.%d.%H.%M\"), rad=self.rad)\n fbgc = \"data/sim/{dn}/{rad}/exp.bgc.bm({bm}).elv(<elv>).csv\".format(dn=self.event.strftime(\"%Y.%m.%d.%H.%M\"), \n rad=self.rad, bm=self.bmnum)\n fflare = \...
[ "0.55644387", "0.551232", "0.54428643", "0.5440682", "0.5420483", "0.5408332", "0.535289", "0.53515273", "0.5293637", "0.5288862", "0.5278051", "0.52756935", "0.52553535", "0.524453", "0.52417237", "0.52357215", "0.5220347", "0.52017593", "0.52000576", "0.5181018", "0.5159042...
0.53311384
8
Check the VTK version.
def vtk_version_ok(major, minor, build): requested_version = (100 * int(major) + int(minor)) * 100000000 + int(build) ver = vtkVersion() actual_version = (100 * ver.GetVTKMajorVersion() + ver.GetVTKMinorVersion()) \ * 100000000 + ver.GetVTKBuildVersion() if actual_version >= request...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vtk_version_ok(major, minor, build):\n needed_version = 10000000000 * int(major) + 100000000 * int(minor) + int(build)\n try:\n vtk_version_number = vtk.VTK_VERSION_NUMBER\n except AttributeError: # as error:\n ver = vtk.vtkVersion()\n vtk_version_number = 10000000000 * ver.GetVT...
[ "0.75072044", "0.6211863", "0.61744905", "0.60805243", "0.60018027", "0.5978742", "0.59628785", "0.59613186", "0.595438", "0.5882819", "0.5849206", "0.58227885", "0.5737467", "0.5716113", "0.56421566", "0.56049746", "0.55878174", "0.5585991", "0.5575074", "0.5545344", "0.5543...
0.7449666
1
Return an element constructor using the attribute as the tagname
def __getattr__(self, attr): def factory(parent=None, **kwargs): return self.Node(parent, attr, **kwargs) return factory
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def makeelement(self, _tag, attrib=None, nsmap=None, **_extra): # real signature unknown; restored from __doc__\n pass", "def new_element(tag: str, **attributes: str | float) -> EtreeElement:\n elem = etree.Element(tag)\n set_attributes(elem, **attributes)\n return elem", "def make_tag(tag_name...
[ "0.7042952", "0.70413274", "0.67657304", "0.66148645", "0.65574425", "0.6458189", "0.6426173", "0.638877", "0.6383565", "0.61737496", "0.6168189", "0.61617744", "0.6104883", "0.6045782", "0.6044016", "0.60417426", "0.59239376", "0.59000546", "0.5874417", "0.58590645", "0.5827...
0.6092295
13
Try to read a file from subversion for inclusion in the wiki.
def GoogleCode_ReadSVNFile(wikifier, domain, path, start, end): gcurl = "http://%s.googlecode.com/svn/trunk/%s" % (domain,path) fdata = urllib.urlopen(gcurl).readlines() return gcurl, fdata[start-1:end]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_file_with_svn_and_revision(self):\n self._test_get_file(\n tool_name='Subversion',\n revision='123',\n base_commit_id=None,\n expected_revision='123')", "def read(fname):\n try:\n return open(os.path.join(os.path.dirname(__file__), fname))...
[ "0.6046934", "0.5708818", "0.5687152", "0.56721485", "0.564001", "0.5629846", "0.55640376", "0.5557791", "0.5525044", "0.5476475", "0.5451403", "0.5451343", "0.5430152", "0.5422481", "0.5422481", "0.53963757", "0.5382174", "0.5358687", "0.53586805", "0.53561574", "0.53425014"...
0.60082895
1
See if the link points outside of the wiki.
def GoogleCode_IsExternalLink(wikifier, link): if GoogleCode_Exists(wikifier, link): return False; if URL.match(link): return True if '.' in link or '\\' in link or '/' in link or '#' in link: return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def point_in_map(self, x, y):\r\n return 0 <= x < self.width and 0 <= y < self.height and (x,y) not in self.walls", "def check_link(self, link):\n false_links = [\"wikipedia:\", \"w:\", \"wikitionary:\", \"wikt:\", \"wikinews:\",\n \"n:\", \"wikibooks:\", \"b:\", \"wikiquote:...
[ "0.62444544", "0.6219953", "0.61899996", "0.6161278", "0.6066359", "0.59666175", "0.59406906", "0.5932137", "0.5886184", "0.5865217", "0.5863333", "0.5848958", "0.5839706", "0.5823677", "0.5811866", "0.58009964", "0.57617086", "0.5751351", "0.57444584", "0.5724708", "0.570117...
0.5530297
37
See if a wiki page exists inside this wiki.
def GoogleCode_Exists(wikifier, wikipage): path = os.path.join(wikifier.srcdir, "%s.wiki" % wikipage) if os.path.exists(path): return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exists(self, page: str) -> bool:\n\n if \"-1\" in requests.get(self.apiurl.format(page)).json()[\"query\"][\"pages\"]:\n return False\n return True", "def has(self, page):\n for entry in self._entries:\n if entry.page == page:\n return True\n r...
[ "0.7470133", "0.7071724", "0.6359", "0.6307588", "0.61616486", "0.60769135", "0.60642064", "0.59580964", "0.59262496", "0.5925431", "0.5878704", "0.5871501", "0.5866469", "0.5847651", "0.57986796", "0.57646424", "0.57566583", "0.57266927", "0.5647473", "0.5646546", "0.5635745...
0.5980301
7
This funtion generate the required XML file
def GenerateXML(dictionary, fileName="labelling.xml") : root = gfg.Element("annotation") #the big section is called Annotation for key in dictionary: #for every polygon list in inside object witho subelement name and attributes and the type "polygon" objectElement = gfg.Element("object"...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_gen_xml(self, out_file):\n\n param_list = []\n msg = []\n msg_type = []\n dep_node = []\n for line in self.full_ed_lines:\n param_list.append(line.text())\n dep_pkg = param_list[6].split(', ')\n if dep_pkg[len(dep_pkg) - 1] == '':\n ...
[ "0.7619716", "0.7042673", "0.6887093", "0.6697616", "0.667627", "0.653743", "0.65311813", "0.6476896", "0.6450493", "0.64394724", "0.6422238", "0.640959", "0.6369861", "0.6347647", "0.63359433", "0.63069695", "0.6288832", "0.62810713", "0.62806565", "0.6250659", "0.6241523", ...
0.69687957
2
Return the distance between two points.
def dist(x, y): dx = x[0] - y[0] dy = x[1] - y[1] ans = dx**2 + dy**2 ans = ans**(0.5) return ans
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getDistanceBetweenTwoPoints(self, one, two):\n dx = one.x - two.x\n dy = one.y - two.y\n return math.sqrt(dx * dx + dy * dy)", "def distance(self, point_1=(0, 0), point_2=(0, 0)):\n\t\treturn math.sqrt((point_1[0]-point_2[0])**2+(point_1[1]-point_2[1])**2)", "def distance_between_point...
[ "0.8368969", "0.83030796", "0.82819957", "0.8270679", "0.8251577", "0.822101", "0.81797934", "0.8110245", "0.8081759", "0.8075603", "0.8075603", "0.8066959", "0.8064443", "0.8011896", "0.8009855", "0.8009171", "0.7988856", "0.7983882", "0.79810566", "0.7979536", "0.79614943",...
0.0
-1
Return the distance between two points.
def dist(x, y): dx = x[0] - y[0] dy = x[1] - y[1] ans = dx**2 + dy**2 ans = ans**(0.5) return ans
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getDistanceBetweenTwoPoints(self, one, two):\n dx = one.x - two.x\n dy = one.y - two.y\n return math.sqrt(dx * dx + dy * dy)", "def distance(self, point_1=(0, 0), point_2=(0, 0)):\n\t\treturn math.sqrt((point_1[0]-point_2[0])**2+(point_1[1]-point_2[1])**2)", "def distance_between_point...
[ "0.83687085", "0.8303762", "0.82825816", "0.82710844", "0.82514185", "0.82212085", "0.8179991", "0.811085", "0.80821276", "0.80768585", "0.80768585", "0.8067992", "0.8064622", "0.80125624", "0.8010694", "0.8010279", "0.79893786", "0.79843163", "0.7981714", "0.7980694", "0.796...
0.0
-1
Initialise the SOM node.
def __init__(self, x, y, numWeights, netHeight, netWidth, PBC, minVal=[], maxVal=[], pcaVec=[], weiArray=[]): self.PBC = PBC self.pos = hx.coorToHex(x, y) self.weights = [] self.netHeight = netHeight self.netWidth = netWidth if weiArray == [] and pcaVec == []:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialise(self):\n self.sc.init.exec_action(self.variables)", "def initNode():\n\n # 0) General Setup\n #initialize listener node!\n rospy.init_node('main', anonymous=True)\n\n #Create instances of subscriber objects\n joint_state_sub = rospy.Subscriber(\"joint_states\", JointState, jo...
[ "0.65920955", "0.6574032", "0.6541358", "0.6527483", "0.65112543", "0.6501685", "0.6471804", "0.64079267", "0.64079267", "0.64079267", "0.64079267", "0.64079267", "0.64079267", "0.64079267", "0.64079267", "0.6377817", "0.63691443", "0.6326998", "0.6322229", "0.63097847", "0.6...
0.0
-1
Calculate the distance between the weights vector of the node and a given vector.
def get_distance_hamming(self, vec): sum = 0 if len(self.weights) == len(vec): return self.hamming(self.weights, vec) else: sys.exit("Error: dimension of nodes != input data dimension!")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_distance(self, vec):\r\n\r\n sum = 0\r\n if len(self.weights) == len(vec):\r\n for i in range(len(vec)):\r\n sum += (self.weights[i] - vec[i]) * (self.weights[i] - vec[i])\r\n return np.sqrt(sum)\r\n else:\r\n sys.exit(\"Error: dimension ...
[ "0.8129802", "0.7776943", "0.75197655", "0.74430245", "0.7414237", "0.72065103", "0.70574385", "0.6956456", "0.6886902", "0.68522006", "0.66722745", "0.6630235", "0.65637356", "0.6562747", "0.6544819", "0.65342325", "0.65096647", "0.6496538", "0.64798594", "0.6430961", "0.641...
0.62257284
36
Calculate the distance between the weights vector of the node and a given vector.
def get_distance(self, vec): sum = 0 if len(self.weights) == len(vec): for i in range(len(vec)): sum += (self.weights[i] - vec[i]) * (self.weights[i] - vec[i]) return np.sqrt(sum) else: sys.exit("Error: dimension of nodes != input data...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def distance(v: Vector, w: Vector) -> float:\n return magnitude(subtract(v, w))", "def distance(v, w):\n return magnitude_of_vector(vector_subtract(v, w))", "def vector_dist(v, w):\n if isinstance(v, list):\n v = np.asarray(v)\n return vector_mag(v - w)", "def distance(v, w):\n\treturn mag...
[ "0.7776724", "0.7519333", "0.7443472", "0.7413635", "0.72083104", "0.705537", "0.6956175", "0.6888227", "0.6851769", "0.66734695", "0.6631523", "0.6563728", "0.65633744", "0.6544231", "0.6533643", "0.6511806", "0.6494287", "0.6481558", "0.6432434", "0.64151883", "0.64133346",...
0.8128836
0
Calculate the distance within the network between the node and another node.
def get_nodeDistance(self, node): if self.PBC == True: """ Hexagonal Periodic Boundary Conditions """ if self.netHeight % 2 == 0: offset = 0 else: offset = 0.5 return np.min([np.sqrt((self.pos[0] - node.pos[0]) * (sel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def node_distance(self, node1, node2):\n if node1 == node2:\n return 0.0\n for i, (n1, n2) in enumerate(zip(self.paths[node1], self.paths[node2])):\n if n1 != n2:\n break\n else:\n i = min(len(self.paths[node1]), len(self.paths[node2]))\n ...
[ "0.81943595", "0.8066891", "0.80382264", "0.7987724", "0.73648864", "0.72907925", "0.72408456", "0.7237398", "0.7143689", "0.7105717", "0.70669633", "0.70651615", "0.6979849", "0.6954018", "0.6897688", "0.6872164", "0.6826083", "0.68116397", "0.6795933", "0.67900324", "0.6788...
0.0
-1
Update the node Weights.
def update_weights(self, inputVec, sigma, lrate, bmu): dist = self.get_nodeDistance(bmu) gauss = np.exp(-dist * dist / (2 * sigma * sigma)) if gauss > 0: for i in range(len(self.weights)): self.weights[i] = self.weights[i] - gauss * lrate * (self.weights[i] - i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_weights(self):\n self._weights = self._weights + self.update_weights_value", "def update_weights(self):\n\t\tpass", "def update_weights(self):\n self._weights = self._weights + self.update_weights_value\n self.weights_clipping()", "def update_weights(self):\r\n\r\n ined...
[ "0.7578588", "0.75189555", "0.71403605", "0.71005577", "0.7062587", "0.69478846", "0.6734397", "0.6722941", "0.6722521", "0.66968465", "0.6692374", "0.6667497", "0.6484811", "0.6466809", "0.6404177", "0.63912404", "0.6376099", "0.6338962", "0.63102174", "0.6305071", "0.630327...
0.0
-1
Update the node Weights.
def update_weights_hamming(self, inputVec, sigma, lrate, bmu): MAX_CHANGE_BITS = 8 dist = self.get_nodeDistance(bmu) gauss = np.exp(-dist * dist / (2 * sigma * sigma)) if gauss > 0 and dist > 0: num_bits = int(round((gauss * lrate) + 0.5)) if (num_bits < 1...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_weights(self):\n self._weights = self._weights + self.update_weights_value", "def update_weights(self):\n\t\tpass", "def update_weights(self):\n self._weights = self._weights + self.update_weights_value\n self.weights_clipping()", "def update_weights(self):\r\n\r\n ined...
[ "0.7578588", "0.75189555", "0.71403605", "0.71005577", "0.7062587", "0.69478846", "0.6734397", "0.6722941", "0.6722521", "0.66968465", "0.6692374", "0.6667497", "0.6484811", "0.6466809", "0.6404177", "0.63912404", "0.6376099", "0.6338962", "0.63102174", "0.6305071", "0.630327...
0.0
-1
The Sim that received the added object.
def sim_info(self) -> SimInfo: return self._sim_info
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sim(self):\n return self._sim", "def sim(self) -> Sim:\n\n return self._sim", "def sim(self):\n return self.mujoco_simulation.sim", "def finished_sim(self):\n raise NotImplementedError(\n \"finished_sim function not reimplemented form base class\")", "def simulate...
[ "0.64399767", "0.64065397", "0.5968966", "0.59378386", "0.5746229", "0.5715688", "0.5592882", "0.556474", "0.5528598", "0.552818", "0.544656", "0.542825", "0.5353126", "0.5342055", "0.5310156", "0.5297516", "0.524547", "0.5245354", "0.5238541", "0.52157784", "0.520578", "0....
0.60363245
2
The Game Object that was added.
def added_game_object(self) -> GameObject: return self._added_game_object
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add(self, game_obj):\r\n self.game_objects_for_adding.append(game_obj)", "def added_game_object_id(self) -> int:\n return CommonObjectUtils.get_object_id(self.added_game_object)", "def added_object_guid(self) -> int:\n return CommonObjectUtils.get_object_guid(self.added_game_object)", ...
[ "0.6893105", "0.67863286", "0.6558083", "0.60798115", "0.6059226", "0.60259646", "0.60233736", "0.6021916", "0.5961065", "0.5930729", "0.5921287", "0.5852365", "0.58480656", "0.58340657", "0.5832652", "0.5820273", "0.5774459", "0.5736312", "0.571463", "0.5690474", "0.56496143...
0.8658577
0
The decimal identifier of the Game Object that was added.
def added_game_object_id(self) -> int: return CommonObjectUtils.get_object_id(self.added_game_object)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def added_object_guid(self) -> int:\n return CommonObjectUtils.get_object_guid(self.added_game_object)", "def GetID(self):\n return hex(id(self()))", "def id(self):\n # Might also be a first 12-characters shortcut.\n return self._id", "def dot_id(self):\n return u\"{0}_{1}\".format...
[ "0.72008175", "0.67034495", "0.6595657", "0.6433382", "0.6414539", "0.63876456", "0.6380759", "0.637583", "0.63683313", "0.6359994", "0.6348633", "0.63423586", "0.633373", "0.6327065", "0.6312481", "0.6284648", "0.62755895", "0.6267277", "0.62603825", "0.6254732", "0.6250296"...
0.74052256
0
The guid identifier of the Game Object that was added.
def added_object_guid(self) -> int: return CommonObjectUtils.get_object_guid(self.added_game_object)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def added_game_object_id(self) -> int:\n return CommonObjectUtils.get_object_id(self.added_game_object)", "def guid(self):\n return self._guid", "def guid(self) -> str:\n return pulumi.get(self, \"guid\")", "def guid(self) -> str:\n return pulumi.get(self, \"guid\")", "def guid(...
[ "0.7552691", "0.7443691", "0.7353285", "0.7353285", "0.69248873", "0.6919849", "0.6838233", "0.68214774", "0.6788781", "0.6781373", "0.6761098", "0.6761098", "0.6756859", "0.67415684", "0.6731418", "0.6731418", "0.6710318", "0.67052126", "0.6645539", "0.6645539", "0.6645539",...
0.8549839
0
Get the current voltage.
def voltage(self): return self._voltage
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_voltage(self):\n self._raise_not_implemented()", "def voltage(self):\n return self.outputValue()", "def get_voltage(self):\n return self.environment.get_voltage(self.neuron_id)", "def get_voltage(self):\n print(\"voici le voltage de la batterie\")", "def voltage(self) ->...
[ "0.87557864", "0.8721714", "0.86113745", "0.8594014", "0.8466012", "0.8349264", "0.8208592", "0.8176201", "0.812972", "0.7857926", "0.7801919", "0.77965105", "0.7761072", "0.773627", "0.76734275", "0.76537436", "0.7645603", "0.7621279", "0.7468227", "0.7446886", "0.73814726",...
0.8939401
0
Computes length of the longest palindromic substring centered on each char in the given string. The idea behind this algorithm is to reuse previously computed values whenever possible (palindromes are symmetric).
def shortestPalindrome(self, string): if not string: return '' right = 0 center = 0 dataString = string string = self.interleave(string) dps = [0] * len(string) for i in range(1, len(string)): mirror = 2*center - i if i + dps[mirror] < right: dps[i] = dps[mirror] else: center = i ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def longest_palindromic_substring(s):\n longest = s[0] if len(s) > 0 else \"\"\n for i in range(len(s)):\n j = len(s)\n while s[i] in s[i+1:j] and j <= len(s):\n j = s[i + 1:j].rfind(s[i]) + i + 2\n print(i, j)\n if is_palindrome(s[i:j]) and len(longest) < len(s...
[ "0.81799245", "0.8091567", "0.79525757", "0.7952387", "0.78724146", "0.780216", "0.7627599", "0.74365264", "0.7409426", "0.7349915", "0.72829574", "0.71973425", "0.71203476", "0.70699084", "0.699025", "0.6959139", "0.69530565", "0.6939643", "0.68121177", "0.66998845", "0.6637...
0.64685607
26
Returns a interleaved version of a given string. 'aaa' > 'aaa'. Thanks to thin function we don't have to deal with even/odd palindrome length problem.
def interleave(self, string): ret = [] for s in string: ret.extend(['#', s]) ret.append('#') return ''.join(ret)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def interleave_binarystr(str_list):\n ret = \"\"\n for i in range(0, len(min(str_list)), 2):\n for j in range(len(str_list)):\n ret += str_list[j][i:(i + 2)]\n return ret", "def smoothie(s_1: str, s_2: str) -> str:\n assert isinstance(s_1, str), \"s1 needs to be a str\"\n assert ...
[ "0.65503883", "0.6346604", "0.63350785", "0.63295734", "0.626099", "0.6210569", "0.62085015", "0.6165204", "0.6155948", "0.60873735", "0.607952", "0.6067298", "0.6033569", "0.6020375", "0.5980434", "0.594999", "0.59177643", "0.591128", "0.59047115", "0.59037185", "0.59030473"...
0.5985341
14
Computes length of the longest palindromic substring centered on each char in the given string. The idea behind this algorithm is to reuse previously computed values whenever possible (palindromes are symmetric).
def manacher(string): if not string: return [] right = 0 center = 0 string = interleave(string) dps = [0] * len(string) for i in range(1, len(string)): mirror = 2*center - i if i + dps[mirror] < right: dps[i] = dps[mirror] else: center = i mirror = 2 * center - right - 1 ridx = right + 1 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def longest_palindromic_substring(s):\n longest = s[0] if len(s) > 0 else \"\"\n for i in range(len(s)):\n j = len(s)\n while s[i] in s[i+1:j] and j <= len(s):\n j = s[i + 1:j].rfind(s[i]) + i + 2\n print(i, j)\n if is_palindrome(s[i:j]) and len(longest) < len(s...
[ "0.81797045", "0.8091579", "0.7952609", "0.7951362", "0.7871153", "0.7801784", "0.7626617", "0.7435464", "0.7408651", "0.7349753", "0.7283186", "0.7197244", "0.7122332", "0.7069073", "0.69898516", "0.6957567", "0.6951752", "0.69401443", "0.6811773", "0.6698392", "0.6638347", ...
0.5603707
92
Computes the thrust force for the given command.
def get_thrust_value(self, command): return self._gain * numpy.abs(command) * command
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def applyForce(self, F, dT):", "def thrust(self, evt=None):\n self.dbgprint(\"thrust(%r)\"%evt)", "def calculer_force_traction(module_young, coefficient_poisson, longueur_fleche,\n longueur_bras, longueur_corde):\n return calculer_ressort(module_young, coefficient_poisson) * \\...
[ "0.5629867", "0.55524796", "0.5294417", "0.52144986", "0.5205213", "0.51810914", "0.51384085", "0.50823224", "0.5055878", "0.49796396", "0.49717823", "0.4953122", "0.49304152", "0.49190193", "0.48769048", "0.48733506", "0.48713782", "0.4851697", "0.48084703", "0.48044527", "0...
0.6190781
0
Class decorator for adding a metaclass to a SWIG wrapped class a slimmed down version of six.add_metaclass
def _swig_add_metaclass(metaclass): def wrapper(cls): return metaclass(cls.__name__, cls.__bases__, cls.__dict__.copy()) return wrapper
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _swig_add_metaclass(metaclass):\r\n def wrapper(cls):\r\n return metaclass(cls.__name__, cls.__bases__, cls.__dict__.copy())\r\n return wrapper", "def add_metaclass(metaclass):\n def wrapper(cls):\n orig_vars = cls.__dict__.copy()\n slots = orig_vars.get('__slots__')\n if...
[ "0.88745296", "0.80567133", "0.80182785", "0.80156446", "0.7977649", "0.7951604", "0.7740915", "0.7594493", "0.70668244", "0.70668244", "0.70584345", "0.6954554", "0.6951016", "0.6951016", "0.69139373", "0.6740209", "0.6584427", "0.65783054", "0.65568185", "0.6511821", "0.646...
0.89225966
11
Attempt to decode date
def make_datetime_from_dicom_date(date: str, time: str = None) -> Optional[datetime]: try: return datetime( year=int(date[:4]), month=int(date[4:6]), day=int(date[6:8]), hour=int(time[:2]), minute=int(time[2:4]), second=int(time[4:6]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dehydrate_date(value):\n return Structure(ord(b\"D\"), value.toordinal() - unix_epoch_date.toordinal())", "def convert_date(value: t.Any) -> date:\n try:\n return date.fromisoformat(value.decode())\n except ValueError as err:\n raise ValueError(f\"DATE field contains {err}\") ...
[ "0.6760816", "0.672241", "0.6653389", "0.6627221", "0.6588315", "0.6568988", "0.65203935", "0.6395972", "0.6383938", "0.6379894", "0.6267428", "0.62567985", "0.6241483", "0.6218822", "0.6194785", "0.6174442", "0.61556965", "0.6086676", "0.60829145", "0.60730714", "0.607134", ...
0.0
-1
Get a pydicom.FileDataset from the instance's Orthanc identifier
def get_pydicom(orthanc: Orthanc, instance_identifier: str) -> pydicom.FileDataset: dicom_bytes = orthanc.get_instances_id_file(instance_identifier) return pydicom.dcmread(BytesIO(dicom_bytes))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_pydicom(self) -> pydicom.FileDataset:\n return util.get_pydicom(self.client, self.id_)", "def get_dataset(self, identifier):\n # Test if a subfolder for the given dataset identifier exists. If not\n # return None.\n dataset_dir = self.get_dataset_dir(identifier)\n if no...
[ "0.76758665", "0.6792178", "0.6289413", "0.628798", "0.62494963", "0.6189763", "0.6181921", "0.6159265", "0.6122643", "0.60905063", "0.6083762", "0.60353416", "0.6018338", "0.6012588", "0.59544116", "0.5922192", "0.5917395", "0.59086275", "0.5863918", "0.58565897", "0.5843114...
0.75693786
1
Time the execution of a context block.
def timer(): start = time.time() yield end = time.time() print('Elapsed: {:.2f}s'.format(end - start))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def timer():\n start = time.time()\n # Send control back to the context block\n yield timer()\n end = time.time()\n print('Elapsed: {:.2f}s'.format(end - start))", "def timer():\n start = time.time()\n # Send control back to the context block\n yield\n end = time.time()\n print('Elapsed: {:.2f}s'.forma...
[ "0.7216326", "0.721241", "0.681922", "0.64067435", "0.6320994", "0.6232323", "0.6086919", "0.60752887", "0.6070061", "0.6026426", "0.5965496", "0.5925121", "0.5913486", "0.5885805", "0.5835166", "0.581954", "0.5808619", "0.58071965", "0.577885", "0.5747311", "0.5727065", "0...
0.6539471
3
Rasterize a collection of lon,lat shapes onto a DLTile.
def rasterize_shape( tile: Tile, shapes: AnyShapes, values: Sequence[int] = None, out: np.ndarray = None, mode="burn", dtype=np.byte, shape_coords="lonlat", all_touched=False, ) -> np.ndarray: shapes = normalize_polygons(shapes) if values is None: if mode == "burn": ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rasterize(shapes, coords, fill=np.nan, **kwargs):\n from rasterio import features\n transform = transform_from_latlon(coords['lat'], coords['lon'])\n out_shape = (len(coords['lat']), len(coords['lon']))\n raster = features.rasterize(shapes, out_shape=out_shape,\n fill...
[ "0.6464894", "0.60362566", "0.57705593", "0.57181996", "0.5690948", "0.5690948", "0.56545186", "0.5653969", "0.5625701", "0.55724025", "0.5562426", "0.55392987", "0.54787064", "0.5474159", "0.546856", "0.5447885", "0.5437408", "0.54057693", "0.5390586", "0.5384432", "0.538070...
0.6133304
1
Attempts to retrieve the Luxafor Flag device using the known Vendor and Product IDs.
def find_device(): device = usb.core.find( idVendor=LuxaforFlag.DEVICE_VENDOR_ID, idProduct=LuxaforFlag.DEVICE_PRODUCT_ID ) return device
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def detect(self):\n # Get PCI devices\n lines = subprocess.check_output([\"lspci\", \"-n\"]).decode().split(\"\\n\")\n for line in lines:\n if len(line) > 0:\n class_id = \"0x{0}\".format(line.split()[1].rstrip(\":\")[0:2])\n if class_id == self.class_i...
[ "0.5497102", "0.53719485", "0.5059956", "0.49484098", "0.4937318", "0.4928376", "0.49243534", "0.49225545", "0.49225545", "0.4906008", "0.48982006", "0.48982006", "0.48853615", "0.4871683", "0.48592058", "0.48569036", "0.48358673", "0.48094153", "0.47977498", "0.4792012", "0....
0.5113587
2
Performs initialisation on the device.
def setup_device(device): try: # Gets around "Resource busy" errors device.detach_kernel_driver(0) except Exception: pass device.set_configuration()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialise(self):\n self.device.initialise()\n return \"OK\"", "def doInitializeDevice(self):\n super().doInitializeDevice()", "async def init(self):\n logger.info(\"Init device: %s\", self._serial)\n self._callback(STATUS_INIT)\n\n self._init_binaries()\n s...
[ "0.8142239", "0.8030572", "0.7634052", "0.7572732", "0.74541605", "0.74400437", "0.73344386", "0.7195496", "0.7136507", "0.69610447", "0.6952285", "0.693592", "0.68971163", "0.6896529", "0.6893833", "0.68740445", "0.6738852", "0.672309", "0.67206156", "0.6712533", "0.67090005...
0.0
-1
Retrieve a PyUSB device for the Luxafor Flag. Will lazy load the device as necessary.
def get_device(l): if not l.device: l.device = find_device() setup_device(l.device) return l.device
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_device():\n device = usb.core.find(\n idVendor=LuxaforFlag.DEVICE_VENDOR_ID,\n idProduct=LuxaforFlag.DEVICE_PRODUCT_ID\n )\n return device", "def get_device(cls, devdesc: UsbDeviceDescriptor) -> UsbDevice:\n cls.Lock.acquire()\n try:\n if devdesc.index or ...
[ "0.69254965", "0.6485634", "0.63472474", "0.6307298", "0.6286261", "0.6203117", "0.61067283", "0.60893977", "0.60004014", "0.59861434", "0.59207916", "0.59178483", "0.5893291", "0.58582234", "0.58397084", "0.5817381", "0.5815132", "0.5781035", "0.5756109", "0.5748684", "0.571...
0.65442044
1
Send values to the device. Expects the values to be a List of command byte codes. Refer to the individual commands for more information on the specific command codes.
def write(l, values): l.get_device().write(1, values) # Sometimes the flag simply ignores the command. Unknown if this # is an issue with PyUSB or the flag itself. But sending the # command again works a treat. l.get_device().write(1, values)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __send(self, cmd_val, data):\n # Proof the input\n if cmd_val not in command.values():\n raise ValueError(\"{}: the provided command value {} is not valid.\".format(self.sensor_name, cmd_val))\n if not isinstance(data, bytearray):\n raise TypeError(\"{}: command data ...
[ "0.70586413", "0.69986117", "0.6902992", "0.6806956", "0.677012", "0.6769976", "0.6622003", "0.6621487", "0.6603113", "0.658566", "0.6583125", "0.6578142", "0.6574134", "0.65513706", "0.6506194", "0.65046686", "0.64179957", "0.6382939", "0.6382298", "0.6373489", "0.63698804",...
0.71878153
0
Turn off all LEDs.
def off(l): l.do_static_colour(255, 0, 0, 0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def turn_all_off(self):\n for led_type in LED:\n self.led_off(led_type)\n logging.info('LED: ALL - Status: 0')", "def off(self):\n for light in self.all:\n GPIO.output(light, 0)", "def turn_off(self):\n print(\"Turning the lights off\")\n self.led.all_of...
[ "0.8682389", "0.85096216", "0.8233179", "0.78701323", "0.78341633", "0.7745513", "0.77019066", "0.75074905", "0.74071926", "0.7406597", "0.7396668", "0.7395751", "0.7395048", "0.7351189", "0.7350677", "0.73119456", "0.7311833", "0.7267839", "0.7256568", "0.7236224", "0.721898...
0.0
-1
Set a single LED or multiple LEDs immediately to the specified colour.
def do_static_colour(l, leds, r, g, b): l._do_multi_led_command( create_static_colour_command, leds, r, g, b )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def led(color: int, /) -> None:", "def set_color(color='black', index=-1): # (8)\n if index == -1:\n global color_buffer\n color_buffer = deque([color]*NUM_LEDS, maxlen=NUM_LEDS)\n else:\n color_buffer[index] = color", "def set_led_color...
[ "0.72180986", "0.7165931", "0.7148298", "0.7129489", "0.70958394", "0.7094422", "0.6971359", "0.6958042", "0.69543785", "0.69412607", "0.6889958", "0.6867686", "0.6838649", "0.67877847", "0.6728043", "0.67058116", "0.6662282", "0.66565037", "0.6617628", "0.66135013", "0.66040...
0.62172866
55
Fade a single LED or multiple LEDs from their current colour to a new colour for the supplied duration.
def do_fade_colour(l, leds, r, g, b, duration): l._do_multi_led_command( create_fade_colour_command, leds, r, g, b, duration )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fade_out(self, duration: int = 1):\n original_brightness = self.np.brightness\n\n step_level = 0.01\n sleep_cycle = duration / (original_brightness / step_level)\n\n while self.np.brightness > 0:\n # FIXME :\n # Im not totally sure why, but...\n # se...
[ "0.7056472", "0.68512785", "0.6850706", "0.6402508", "0.63308096", "0.62507784", "0.62267405", "0.6176442", "0.6172806", "0.6114443", "0.6007189", "0.5919894", "0.5918335", "0.5838925", "0.58141935", "0.578331", "0.5769158", "0.567631", "0.566404", "0.5663928", "0.5610591", ...
0.79324836
0
Flash the specified LED a specific colour, giving the duration of each flash and the number of times to repeat. Unfortunately this command does not support multiple specific LEDs.
def do_strobe(l, led, r, g, b, duration, repeat): command = create_strobe_command(led, r, g, b, duration, repeat) l.write(command)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ledFlash(strip, color, t = 1):\r\n utime.sleep(t)\r\n setStrip(strip, color)\r\n utime.sleep(t)\r\n setStrip(strip, LED_COLOR_OFF)", "async def flash(self, light: Light, num_times: int, delay=0.15) -> None:\n for _ in range(num_times):\n self.set_lights_off()\n await ...
[ "0.7412073", "0.7081003", "0.70323014", "0.6768686", "0.6668136", "0.6636846", "0.6632896", "0.66248983", "0.6488767", "0.647701", "0.6381761", "0.6295228", "0.62298834", "0.6197924", "0.61790836", "0.6162615", "0.6100585", "0.6092881", "0.6068329", "0.5988156", "0.5981007", ...
0.0
-1
Animate the flag with a wave pattern of the given type, using the specified colour, duration and number of times to repeat.
def do_wave(l, wave_type, r, g, b, duration, repeat): command = create_wave_command( wave_type, r, g, b, duration, repeat ) l.write(command)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def animate_to(number, color):\n for _ in range(10):\n trellis.pixels.fill((0, 0, 0))\n display_number(random.randint(10, 99), color)\n time.sleep(0.1)\n trellis.pixels.fill((0, 0, 0))\n display_number(number, color)", "def flash_red(self, duration=0.2):\n self.pen_color = wx...
[ "0.5687249", "0.5520184", "0.5502301", "0.549894", "0.54490465", "0.5440435", "0.52621114", "0.52320236", "0.522888", "0.52235174", "0.5193794", "0.5145144", "0.51310945", "0.5130986", "0.5125205", "0.51163036", "0.5074429", "0.504401", "0.5028484", "0.5004908", "0.4992485", ...
0.5781703
0
Execute a built in pattern a given number of times.
def do_pattern(l, pattern, repeat=1): command = create_pattern_command(pattern, repeat) l.write(command)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def repeatfunc(func, n, *args):\n return starmap(func, repeat(args, n))", "def repeat(self, fn, *args, **kwargs):\n return repeat_n_times(self.n, fn, *args, **kwargs)", "def repeat_string_n_times(string, count):\r\n return string * int(count)", "def repeat(num_times):\n\n def decorator_re...
[ "0.6683459", "0.658673", "0.6401458", "0.6365324", "0.63218576", "0.6288645", "0.6204004", "0.61430645", "0.61430645", "0.61289394", "0.59831303", "0.5890716", "0.5888583", "0.588187", "0.58576274", "0.5825577", "0.57919276", "0.57130724", "0.5705344", "0.5685097", "0.5682121...
0.59160846
11
Collect Historical data from Oct 2017 till Nov 2019
def __init__(self, api=None): self.file = open(OUTPUT_FILE, "w")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getHistoricalData(dev, MAC):\n # Creating a MongoDB client and switching to the relevant database\n database = parseDatabase('MongoDB')\n mongo_client = pymongo.MongoClient(database['host'], int(database['port']))\n db = mongo_client[dev]\n \n # Creating an array consisting of the dates for w...
[ "0.65280616", "0.64203715", "0.62852067", "0.6244216", "0.6211454", "0.61560786", "0.6026289", "0.60248744", "0.60008925", "0.59849656", "0.59746367", "0.59710944", "0.5962332", "0.5949948", "0.5922541", "0.592224", "0.591134", "0.5909345", "0.5896168", "0.5868421", "0.584708...
0.0
-1
Produce the noramlized location description we use from the EuropePMC data.
def pretty_location(data): issue = data.get("issue", "") if issue: issue = "(%s)" % issue pages = data.get("pageInfo", "") if "pageInfo" in data and pages: pages = ":" + pages location = u"{title} {volume}{issue}{pages} ({year})".format( title=data.get("journalTitle", ""),...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _utm_description(self):\n # 'PROJCS' vs. 'PROJCRS' in rsplit\n if int(gdal.VersionInfo()) >= 3000000:\n ifo = self._info['coordinateSystem']['wkt'].rsplit('PROJCRS[\"', 1)[-1].split('\"')[0]\n else:\n ifo = self._info['coordinateSystem']['wkt'].rsplit('PROJCS[\"', 1)[...
[ "0.6250442", "0.60719377", "0.5786751", "0.57662743", "0.570048", "0.56878185", "0.5687203", "0.5681456", "0.5672667", "0.5654472", "0.5636864", "0.5614611", "0.5524811", "0.54621524", "0.54606557", "0.54302543", "0.54212713", "0.5387661", "0.5379423", "0.5379423", "0.5379423...
0.5227744
68
Cleanup the title into a normalized setup.
def clean_title(title): stripped = re.sub(r"\.$", "", title) return html.unescape(stripped)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_title(title):\n title = re.sub(\"\\n\", \"\", title) # Remove newlines\n title = ' '.join(title.split()) # Turn multiple whitespaces into a single one\n title = title.lower() # Make everything lowercase\n return title", "def clean_title(self):\n # split into tokens by white space\n ...
[ "0.74847317", "0.73940444", "0.7389024", "0.7369857", "0.72249997", "0.72034925", "0.7175848", "0.71642005", "0.69197303", "0.6917761", "0.6901634", "0.688855", "0.6833176", "0.68327075", "0.68211526", "0.6790044", "0.6746907", "0.6720353", "0.66678065", "0.66599876", "0.6653...
0.65478605
30
Constructor for the SSH Timeout Exception class
def __init__(self, message="Remote operation timeout"): super(SshTimeout, self).__init__(message)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, error_msg):\n super(RequestTimeoutException, self).__init__(error_msg)", "def __init__(self, timeout_time):\n self.timeout_time = timeout_time", "def __init__(self, hostname, username, password, timeout, optional_args):\n raise NotImplementedError", "def __init__(self,...
[ "0.67599875", "0.67163706", "0.64918303", "0.64363897", "0.63409185", "0.6284611", "0.6284362", "0.6282421", "0.62392485", "0.6182562", "0.6173027", "0.6143694", "0.6105834", "0.6094346", "0.6094346", "0.60341465", "0.5954169", "0.59241354", "0.5864031", "0.57930404", "0.5763...
0.8164756
0
Interactively send commands to an interactive shell
def _posix_shell(cls, chan, user_input, iotimeout, iodelay, cmcli_bool): timeout = 60 # 1 mins , only its only applicable to cmcli ssl commands result = '' input = list(user_input) cmcli_ssl_bool = False last_prompt = '' if len(filter(lambda x: x.find('ssl') >= 0, user_i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shell(self):\r\n channel = self._ssh_client.invoke_shell()\r\n interactive_shell(channel)", "async def interactive_shell(self) -> None:\n session = PromptSession()\n while True:\n try:\n result = await session.prompt_async(f\"redCisco> \", style=style)\n ...
[ "0.7574692", "0.7355218", "0.70447016", "0.6996314", "0.68284637", "0.6793135", "0.6792362", "0.67699385", "0.6592669", "0.6590637", "0.6585436", "0.6533579", "0.65116394", "0.65081716", "0.65000874", "0.6492091", "0.64726466", "0.64402354", "0.6436567", "0.6429424", "0.64135...
0.0
-1
Run interactive commands using bash tricks. This is good for simple ops
def run_interactive(cls, shell, command, input): feed = '\\n'.join(input) icommand = "echo -e '{}' | {}".format(feed, command) _stdout, _stderr = cls.run(shell, icommand) return _stdout
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(*commands):\n command = str(value_translation(gget(\"raw_command_args\")))\n if (command):\n res = send(get_system_code(command))\n if (not res):\n return\n print(color.green(\"\\nResult:\\n\\n\") + res.r_text.strip() + \"\\n\")\n return\n print(color.cyan(\n...
[ "0.69014305", "0.6747323", "0.66980237", "0.66032296", "0.65309674", "0.64838135", "0.6461989", "0.63458425", "0.63382506", "0.6331459", "0.6313852", "0.6313827", "0.6274359", "0.62724936", "0.62724936", "0.62592", "0.62527144", "0.62494063", "0.62054163", "0.6143466", "0.613...
0.6597981
4
Interactively send commands to an interactive shell. IMPORTANT!!! This version of posix_shell does not automatically insert end of line characters, instead, these must be embedded in the user_input stream In certain cases, it has been learned the \r\n is required to terminate lines, as opposed to simply \n To use this ...
def _posix_shell(cls, chan, user_input, iotimeout, iodelay): timeout = 60 # 1 mins , only its only applicable to cmcli ssl commands result = '' input = list(user_input) input_end = 1 try: chan.settimeout(iotimeout) input.reverse() start_time =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def interactive_shell(self) -> None:\n session = PromptSession()\n while True:\n try:\n result = await session.prompt_async(f\"redCisco> \", style=style)\n if not result:\n continue\n await self.command_interpreter(str(r...
[ "0.75494426", "0.75093126", "0.74016654", "0.7063117", "0.6962918", "0.69306165", "0.6850606", "0.67923796", "0.6699168", "0.66553134", "0.6648596", "0.66393715", "0.6586876", "0.6574025", "0.64603734", "0.6418309", "0.6390558", "0.6328121", "0.6327472", "0.6250909", "0.62472...
0.6325232
19
create a shell connector from machine info object
def from_info(cls, info, user='root'): conn = None if not isinstance(info, MachineInfo): raise TypeError('info must be a MachineInfo') if user == 'cmuser': conn = cls(info.ip, 22, info.operator_user, info.operator_password, '') else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_shell(self, shell):", "def __init__(self, connector=pxssh.pxssh()):\n self.connector = connector\n\n # pxssh.UNIQUE_PROMPT is \"\\[PEXPECT\\][\\$\\#] \", set prompt for csh\n # should not contain slash(\\)\n if isinstance(self.connector, pxssh.pxssh):\n self.connect...
[ "0.63129455", "0.55860054", "0.5557034", "0.55390114", "0.5533736", "0.5485371", "0.54844224", "0.5483027", "0.5439714", "0.54216254", "0.53780776", "0.5342085", "0.53084445", "0.5289528", "0.5280711", "0.52249736", "0.52055746", "0.51824886", "0.5179961", "0.51555294", "0.51...
0.59186614
1
Alternative method 'run'. Use temporary files to save stdout & stderr on remote host, download it and read to output lists.
def run_console_redirect(self, command, exit_if_error=True, log_error_as_warning=False, print_to_console=True): excluded_commands = ['>', 'rm', '[ ! -d'] # If the command already have output redirect or use 'rm' command, # uses major method 'run' for exclude...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self, stdout=None, stderr=None):", "def download():\n try:\n cli.run(\n [URL, '--output', TEMP_DIR],\n )\n except SystemExit:\n return None", "def _get_remote_results(self):\n\n if not self._setup_has_ran:\n raise CoreError('The results object mus...
[ "0.6506826", "0.61649877", "0.5938436", "0.5928891", "0.5863804", "0.5714962", "0.56754893", "0.56243324", "0.56220454", "0.562156", "0.5609978", "0.5592758", "0.5592219", "0.558236", "0.55720264", "0.55479157", "0.5545531", "0.5536956", "0.55281484", "0.5525863", "0.5489686"...
0.542526
26
creates a tarball and add the specific directories and their subdirectories
def tar(self, folders, tarfile): if not folders: raise ValueError('folders must be set') if not tarfile: raise ValueError('tarfile must be set') with OpenShell(self._conn) as os: if log.isEnabledFor(logging.DEBUG): RemoteOperation.run(os, 'tar ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_tar(self):\n with tarfile.open(self.tgzfile, \"w:gz\") as tar_handle:\n for root, _, files in os.walk(self.dirname):\n for file in files:\n tar_handle.add(os.path.join(root, file))", "def tar_dir(output_path, source_dir):\n with tarfile.open(outpu...
[ "0.7463398", "0.7096503", "0.6855722", "0.6846352", "0.6729907", "0.6717818", "0.6600126", "0.6539058", "0.6501881", "0.64683044", "0.64502305", "0.64371777", "0.6407858", "0.6329113", "0.63137776", "0.6312026", "0.62357825", "0.62323153", "0.62013674", "0.61913204", "0.61714...
0.0
-1
Computes the precision for the specified values of k
def accuracy(output, target, topk=(1,)): maxk = max(topk) batch_size = target.size(0) _, pred = output.topk(maxk, 1, True, True) pred = pred.t() correct = pred.eq(target.view(1, -1).expand_as(pred)) res = [] for k in topk: correct_k = correct[:k].view(-1).float().sum(0) res.append(correct_k.mul_(100.0 / ba...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def precision(gt, pred, k):\n k = min(len(pred), k)\n den = min(len(gt), k)\n return sum([int(pred[i] in gt) for i in range(k)]) / den", "def precision_at_k(r, k):\n assert k >= 1\n r = np.asarray(r)[:k] != 0\n if r.size != k:\n raise ValueError('Relevance score length < k')\...
[ "0.7642627", "0.7417984", "0.7417116", "0.72703016", "0.7245068", "0.7244174", "0.72359973", "0.7221287", "0.72093123", "0.70574844", "0.68535876", "0.6785699", "0.6785369", "0.6770165", "0.6727407", "0.67198336", "0.67198336", "0.67198336", "0.67198336", "0.67198336", "0.671...
0.0
-1
adds an error to each field if it is empty
def check_for_empties(): if hasattr(self.instance, 'fields_required_for_publish'): errors_for_empties = { field_name: try_adding_error_to_field( field_name, field_value) for (field_name, field_value) in self.data.items() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_fields(fields: Dict, data: Dict):\n error = \"\"\n for key, value in fields.items():\n if isinstance(value, StringField):\n if data[key] != None and str(data[\"key\"]).strip():\n error += \"\\n \" + key + \" cannot be empty or blank spaces\"\n...
[ "0.72946787", "0.6586762", "0.65724796", "0.6550193", "0.6518666", "0.6511024", "0.6437989", "0.63800997", "0.6174074", "0.6135356", "0.61327016", "0.61255014", "0.61240035", "0.6085383", "0.60637295", "0.60483295", "0.6010442", "0.594893", "0.5935339", "0.59098697", "0.59016...
0.53913206
94
Updates the widgets so they reflect the current settings
def settingstowidgets(self): # disconnect before updating, otherwise # the current GUI settings will be reinstated # after the first GUI element is updated self.disconnect_all_widgets() self.spansliderInt.setLowerValue(int(self.ABsettings["intensity_range"][0])) self.sp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def updateSettingsUI(self):\n\n pass", "def update_control_widgets(self):\n logger.info(f'Loading settings: {self.settings_dict}')\n for k, section in self.settings_dict.items():\n for setting_name, value in section.items():\n self.set_control_value(setting_name, va...
[ "0.8098167", "0.7988747", "0.7656187", "0.7542083", "0.7314689", "0.7068832", "0.69963694", "0.69397193", "0.6937981", "0.6914909", "0.68111056", "0.6686983", "0.66728216", "0.6653556", "0.66239417", "0.66172475", "0.6594131", "0.65858173", "0.6583962", "0.65752417", "0.65551...
0.72931415
5
Updates the settings dictionary so they reflect the current settings
def widgetstosettings(self): print "in widgets to settings" self.ABsettings["intensity_range"]=(self.spansliderInt.lowerValue,self.spansliderInt.upperValue) self.ABsettings["rgb"]=self.colorBox.getRGB self.ABsettings["visible"]=self.abEnabledCB.isChecked() self.ABsettings["zrange...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(self, settings):\n self.settings.cache_clear()\n self._settings = settings\n log.info(\"Updated settings to %s\", self._settings)", "def updateSettingsUI(self):\n\n pass", "def update_settings(self):\n\n self.sim.account.set_balance(int(self.balance_str.get()))\n\n...
[ "0.7661199", "0.74230856", "0.73977643", "0.7368709", "0.6998151", "0.6977936", "0.6937434", "0.68867767", "0.6871526", "0.6870288", "0.68526256", "0.6842596", "0.6815777", "0.6701579", "0.66962636", "0.6687492", "0.6686757", "0.66777384", "0.66298074", "0.6615604", "0.657869...
0.0
-1
Updates the text labels that display the slider values
def updateLabels(self): # Intensity range self.minIntensityLabel.setText("Intensity: "+str(self.ABsettings["intensity_range"][0]).rjust(3)) self.labelMaxInt.setText(str(self.ABsettings["intensity_range"][1]).ljust(3)) # Z range self.minZLabel.setText("Z range: "+str(self.ABsettin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_elements(self, viewer):\n for i in range(self.num_labels):\n lbl = self.lbls[i]\n # get data coord equivalents\n x, y = self.get_data_xy(viewer, (lbl.x, lbl.y))\n # format according to user's preference\n lbl.text = self.format_value(x)", "...
[ "0.73107535", "0.7074322", "0.68887264", "0.6816435", "0.67901117", "0.6768138", "0.6733651", "0.6677558", "0.6651518", "0.65698177", "0.6497585", "0.6495086", "0.64658064", "0.6458767", "0.64468765", "0.64334774", "0.64204824", "0.64106315", "0.63746005", "0.63589525", "0.63...
0.77173656
0
status(event) evaluate the status of the specified endpoint
def status(event): e = '' try: logger.setLevel(event.get('loglevel')) logging.getLogger('urllib3').setLevel(event.get('loglevel')) except: pass try: pool = urllib3.PoolManager() except Exception as e: raise CreatePoolManagerFailure(e) if event.get('url',...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_endpoint_status(self) -> None:\n status = self.client.endpoint_status\n self.assertIsInstance(status, dict)", "def status(self):\n endpoint = self.sagemaker.describe_endpoint(EndpointName=self.endpoint_name)\n if endpoint[\"EndpointStatus\"] in self.FAILED_STATUS:\n ...
[ "0.69619536", "0.68893653", "0.6584585", "0.64474016", "0.64256316", "0.6398473", "0.639443", "0.6211213", "0.6206", "0.6203431", "0.61535424", "0.61348665", "0.6094001", "0.6090071", "0.6080359", "0.60790765", "0.6043896", "0.6043896", "0.6023741", "0.60236883", "0.5989833",...
0.68734205
2
Construct a new CPU.
def __init__(self): self.ram = [0] * 256 self.register = [0] * 8 self.pc = 0 # self.register[7] = 255 # self.sp = self.register[7] # self.sp = 244 # self.register[7] = self.sp self.flag = 0b00000001 self.running = True # self.register[7] = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_cpu():\n return CPU()", "def __new__(cls, cpu):\n assert CpuMap.len() > cpu\n if not CpuMap.arr:\n CpuMap.arr = CpuMap._cpus()\n return CpuMap.arr[cpu]", "def __init__(__self__, *,\n cpu: Optional[pulumi.Input[str]] = None,\n memory:...
[ "0.8731919", "0.6451253", "0.6190836", "0.6190836", "0.6189993", "0.5998105", "0.5969071", "0.5961957", "0.593079", "0.59214157", "0.5899172", "0.5899172", "0.588635", "0.58153635", "0.5809251", "0.57824373", "0.57761335", "0.57144094", "0.5672549", "0.56323063", "0.5601474",...
0.0
-1
Load a program into memory.
def load(self, path): address = 0 with open(path) as f: # with open(sys.argv[1]) as f: for line in f: comment_split = line.split('#') value = comment_split[0].strip() if value == '': continue num ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load(self):\n \"\"\"Load a program into memory.\"\"\"\n\n if len(sys.argv) != 2:\n print(\"format: ls8.py [filename]\")\n sys.exit(1)\n\n program = sys.argv[1]\n address = 0\n\n # For now, we've just hardcoded a program:\n\n # program = [\n ...
[ "0.81635815", "0.80002964", "0.79455954", "0.7740371", "0.7578946", "0.75005037", "0.7421909", "0.733644", "0.7264945", "0.7231969", "0.7057473", "0.7012705", "0.69477135", "0.69359463", "0.6899449", "0.6871655", "0.6857009", "0.68485945", "0.6750489", "0.6687089", "0.6562723...
0.6433474
26
Handy function to print out the CPU state. You might want to call this from run() if you need help debugging.
def trace(self): print(f"TRACE: %02X | %02X %02X %02X |" % ( self.pc, #self.fl, #self.ie, self.ram_read(self.pc), self.ram_read(self.pc + 1), self.ram_read(self.pc + 2) ), end='') for i in range(8): print(" %02...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_cpu_state(self):\n print(\"PC:\", hex(self.pc))\n print(\"SP:\", hex(self.sp))\n print(\"A:\", hex(self.a))\n print(\"X:\", hex(self.x))\n print(\"Y:\", hex(self.y))\n print(\"P:\", bin(self.p))", "def print_state(self):\n print('\\nthe current state is:...
[ "0.83509916", "0.6877878", "0.6797638", "0.6769822", "0.6621224", "0.63364536", "0.62950456", "0.62756854", "0.6188329", "0.61485726", "0.60723615", "0.5985339", "0.59524155", "0.5936344", "0.59292483", "0.5926776", "0.59024507", "0.58878917", "0.5857369", "0.58049345", "0.57...
0.56122416
41
This function calculates the sum of even fibonacci numbers before they reach 4,000,000
def compute(): x = 1 # Setting the initial fibonacci numbers here y = 2 ans = 0 while x <= 4000000: if x % 2 == 0: ans += x x, y = y, (x + y) print(ans)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sum_fibonacci_even_terms():\n result = 0\n a, b = 1, 2\n\n while True:\n if a > 4000000:\n return result\n if a % 2 == 0:\n result += a\n a, b = b, a + b", "def sum_even_fibs(n):\n return sum(filter(even, map(fib, range(1, n+1))))", "def problem2():\n\...
[ "0.85439277", "0.80277014", "0.7929904", "0.790548", "0.7836163", "0.7785493", "0.7687464", "0.7685551", "0.76444805", "0.761374", "0.7500409", "0.7412425", "0.73603016", "0.73598427", "0.7327563", "0.723944", "0.718491", "0.7167632", "0.704026", "0.688502", "0.68761563", "...
0.75073767
10
encode string into numpy.ndarray using utf32.
def array_encode(s): return np.frombuffer(s.encode('utf32'), dtype=np.int32, offset=4)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _unicode(arr):\n try:\n return unicode(arr)\n except UnicodeEncodeError:\n dt = arr.dtype.newbyteorder('S')\n return unicode(arr.view(dt))", "def encoded(self):\n text, chars = self.chars()\n int2char = dict(enumerate(chars))\n char2int = {ch: ii for ii, ch in ...
[ "0.6568203", "0.6536662", "0.6487182", "0.6231948", "0.6180096", "0.6152209", "0.5947935", "0.59344274", "0.59313184", "0.59313184", "0.5893763", "0.5873927", "0.5808209", "0.56744933", "0.56118715", "0.5595339", "0.55714226", "0.55584484", "0.5555841", "0.55391484", "0.55205...
0.8272287
0
decode numpy.ndarray into string
def array_decode(arr): if arr.dtype != np.int32: raise ValueError('Incompatible dtype: expected numpy.int32, got numpy.%s' % arr.dtype) return bytes(arr).decode('utf32')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def np2str(a: np.ndarray) -> str:\n return json.dumps(a.tolist())", "def to_str(array, encoding='utf8'):\n\n if not isinstance(array, np.ndarray):\n raise ValueError('input should be a NumPy array.')\n\n return np.char.decode(array, encoding)", "def data_2_base64(data: np.ndarray) -> str:\n ...
[ "0.7554251", "0.7333261", "0.7178325", "0.689365", "0.6661134", "0.6608159", "0.6600345", "0.6569578", "0.65656227", "0.6551613", "0.64922774", "0.64922774", "0.6448398", "0.64382356", "0.6428167", "0.63806415", "0.63731456", "0.63284403", "0.6245304", "0.62329787", "0.619375...
0.63843673
15
Find length of longest common prefix of two sequences.
def common_prefix_length(s, u): length = 0 for cs, cu in zip(s, u): if cs != cu: break length += 1 return length
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _common_prefix(sequence1, sequence2):\n i = 0\n for elem1, elem2 in zip(sequence1, sequence2):\n if elem1 != elem2:\n return i\n i += 1\n\n # Return length of sequence if sequences are identical\n return min(len(sequence1), len(sequence2))", "d...
[ "0.81115776", "0.8016439", "0.7792098", "0.77686703", "0.7512462", "0.75021654", "0.74276894", "0.7405654", "0.7279104", "0.72687703", "0.72460264", "0.7241484", "0.72381425", "0.72181463", "0.72037673", "0.7160593", "0.71592325", "0.7085007", "0.7052361", "0.70391333", "0.70...
0.7707382
4
This produces a dataset 5 times bigger than the original one, by moving the 8x8 images in X around by 1px to left, right, down, up
def nudge_dataset(X, Y): direction_vectors = [ [[0, 1, 0], [0, 0, 0], [0, 0, 0]], [[0, 0, 0], [1, 0, 0], [0, 0, 0]], [[0, 0, 0], [0, 0, 1], [0, 0, 0]], [[0, 0, 0], [0, 0, 0], [0, 1, 0]]] shift = lambda x,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def montage(images, w_sub, h_sub, step):\n target = Image.new('RGB', (w_sub*step, h_sub*step))\n left = 0\n right = w_sub\n for i in range(len(images)):\n top=(i//step)*h_sub\n target.paste(images[i], (left, top, right, top+h_sub))\n if(i//step < (i+1)//step):#Check if this row is ...
[ "0.6509138", "0.62219596", "0.61874", "0.61412805", "0.6126439", "0.60589224", "0.5921873", "0.5915314", "0.5900487", "0.5836291", "0.58324534", "0.58324534", "0.5808579", "0.57560366", "0.57557076", "0.5751854", "0.572693", "0.5726757", "0.56758326", "0.5675063", "0.5669236"...
0.0
-1
Function to create a Flask instance for testing.
def create_app(self): template_folder = T_SYSTEM_PATH + "/remote_ui/www" static_folder = template_folder + "/static" remote_ui = RemoteUI(args={"host": "localhost", "port": "5000", "debug": True, "mode": "testing"}) return remote_ui.app
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_app(test_config=None) -> Flask:\n app = Flask(\"front-end-web-server\", instance_relative_config=True)\n\n if test_config is None:\n # Get path to configuration file and load that configuration into Flask's app.config object.\n curr_dir = os.path.abspath(os.path.dirname(__file__))\n ...
[ "0.800137", "0.79899365", "0.7917945", "0.7903484", "0.78777474", "0.7799609", "0.7797458", "0.77839214", "0.77667195", "0.77507985", "0.773824", "0.7732427", "0.7711934", "0.7660504", "0.7659221", "0.7613417", "0.7591966", "0.75756544", "0.756021", "0.75428635", "0.7511057",...
0.0
-1
Function to create a Flask instance for testing.
def create_app(self): template_folder = T_SYSTEM_PATH + "/remote_ui/www" static_folder = template_folder + "/static" remote_ui = RemoteUI(args={"host": "localhost", "port": "5000", "debug": True, "mode": "testing"}, template_folder=template_folder, static_folder=static_folder) return ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_app(test_config=None) -> Flask:\n app = Flask(\"front-end-web-server\", instance_relative_config=True)\n\n if test_config is None:\n # Get path to configuration file and load that configuration into Flask's app.config object.\n curr_dir = os.path.abspath(os.path.dirname(__file__))\n ...
[ "0.8001913", "0.79912984", "0.7919605", "0.79042524", "0.7879039", "0.78006184", "0.779912", "0.7784838", "0.7769028", "0.7751926", "0.7739027", "0.7733947", "0.7712897", "0.7661446", "0.7659738", "0.7614846", "0.75935984", "0.75766546", "0.75618625", "0.75437117", "0.7512033...
0.0
-1
write out error message for csv instead of normal pandas dataframe
def write_out(message, fp): with open(fp, 'wb') as csvfile: writer = csv.writer(csvfile, delimiter=',', quotechar='"') writer.writerow([message])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def csv_error(path: Path, index: int, message: str, value: str):\n print(f\"ERROR: {path}:{index+1}: {message} '{value}'\")", "def create_csv_errors_file(self):\n errors_df = self.consent_df[self.consent_df.sync_status == int(ConsentSyncStatus.NEEDS_CORRECTING)]\n\n # Initialize the list of list...
[ "0.6669553", "0.6651798", "0.6458607", "0.61917794", "0.59686214", "0.5943157", "0.5637388", "0.55841535", "0.5582802", "0.55715203", "0.55653346", "0.55526006", "0.5542042", "0.55346024", "0.55187315", "0.5516565", "0.5501169", "0.5494901", "0.54673123", "0.5449329", "0.5435...
0.0
-1
Test handling a poorly implemented locate_module method.
def test_handling_wrong_locate_module_implementation(method): loader = WrongEnamlImporter() with pytest.raises(ImportError): getattr(loader, method)('module_name')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test___find_corresponding_module_for_location_exceptions(self):\r\n # pylint: disable=protected-access\r\n with self.assertRaises(ItemNotFoundError):\r\n self.peer_grading._find_corresponding_module_for_location(\r\n Location('org', 'course', 'run', 'category', 'name', '...
[ "0.704441", "0.66467345", "0.65472347", "0.642813", "0.6363407", "0.6362937", "0.625545", "0.6194759", "0.6184722", "0.6180454", "0.6120239", "0.6073932", "0.60296243", "0.6000383", "0.596782", "0.5952297", "0.5937704", "0.5937704", "0.5937704", "0.59352267", "0.5929191", "...
0.693356
1
Create an enaml module in a tempdir and add it to sys.path.
def enaml_module(tmpdir): name = '__enaml_test_module__' folder = str(tmpdir) path = os.path.join(folder, name + '.enaml') with open(path, 'w') as f: f.write(SOURCE) sys.path.append(folder) yield name, folder, path sys.path.remove(folder) if name in sys.modules: del sys...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_import_and_cache_generation(enaml_module):\n name, folder, _ = enaml_module\n with imports():\n importlib.import_module(name)\n\n assert name in sys.modules\n\n # Check that the module attributes are properly populated\n mod = sys.modules[name]\n assert mod.__name__ == name\n a...
[ "0.6082835", "0.6066244", "0.60439175", "0.58154875", "0.5798756", "0.57679164", "0.575023", "0.574298", "0.57139564", "0.56493825", "0.5631153", "0.5621098", "0.5608184", "0.5584475", "0.55722296", "0.55148625", "0.54987985", "0.5458551", "0.54473263", "0.54202634", "0.54123...
0.7460824
0
Test importing a module and checking that the cache was generated.
def test_import_and_cache_generation(enaml_module): name, folder, _ = enaml_module with imports(): importlib.import_module(name) assert name in sys.modules # Check that the module attributes are properly populated mod = sys.modules[name] assert mod.__name__ == name assert mod.__fil...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_import_when_cache_exists(enaml_module):\n name, folder, _ = enaml_module\n assert name not in sys.modules\n with imports():\n importlib.import_module(name)\n\n assert name in sys.modules\n del sys.modules[name]\n\n cache_folder = os.path.join(folder, '__enamlcache__')\n assert ...
[ "0.7983087", "0.7303237", "0.72239596", "0.7091177", "0.69668573", "0.693975", "0.67968786", "0.67071986", "0.6687973", "0.66533375", "0.6651848", "0.6650018", "0.6642446", "0.66381323", "0.6611553", "0.6525819", "0.6480871", "0.6442875", "0.6429513", "0.6378989", "0.63643533...
0.7375834
1
Test importing a module when the cache exists.
def test_import_when_cache_exists(enaml_module): name, folder, _ = enaml_module assert name not in sys.modules with imports(): importlib.import_module(name) assert name in sys.modules del sys.modules[name] cache_folder = os.path.join(folder, '__enamlcache__') assert os.path.isdir(c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __exist_module_in_sys_cache(module_name):\n try:\n if hasattr(sys, 'stypy_module_cache'):\n return module_name in sys.stypy_module_cache\n else:\n __preload_sys_module_cache()\n return False\n except:\n return False", "def test_import_cache_only(ena...
[ "0.7172652", "0.70065624", "0.6809813", "0.67054206", "0.66869247", "0.6645123", "0.6615341", "0.65780705", "0.6531684", "0.64752275", "0.64740145", "0.64509606", "0.6437659", "0.6436985", "0.6392631", "0.6389371", "0.63749903", "0.6354479", "0.6347128", "0.6333608", "0.63293...
0.80143213
0
Test importing a module for which we have no sources.
def test_import_cache_only(enaml_module): name, _, path = enaml_module with imports(): importlib.import_module(name) assert name in sys.modules del sys.modules[name] os.remove(path) with imports(): importlib.import_module(name) assert name in sys.modules
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_compiled_import_none(monkeypatch, Script):\n monkeypatch.setattr(compiled, 'load_module', lambda *args, **kwargs: None)\n assert not Script('import sys').goto_definitions()", "def test_imports():\n assert False", "def test_absent_imports():\n module, HABEMUS_MODULE = optional_import(\"not_...
[ "0.7279511", "0.72179735", "0.7074391", "0.70343304", "0.7027087", "0.6903926", "0.68690455", "0.68622535", "0.6852216", "0.6838048", "0.6827407", "0.6776726", "0.67610514", "0.67333263", "0.67163676", "0.66975", "0.6679254", "0.66571933", "0.66387653", "0.6570487", "0.656696...
0.0
-1
Test that when importing a bugged module it does not stay in sys.modules
def test_handling_importing_a_bugged_module(enaml_module): name, _, path = enaml_module with open(path, 'a') as f: f.write('\nraise RuntimeError()') assert name not in sys.modules with imports(): with pytest.raises(RuntimeError): importlib.import_module(name) assert nam...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_ensureWhenNotImportedDontPrevent(self):\n modules = {}\n self.patch(sys, \"modules\", modules)\n ensureNotImported([\"m1\", \"m2\"], \"A message.\")\n self.assertEqual(modules, {})", "def test_ensureWhenNotImported(self):\n modules = {}\n self.patch(sys, \"modul...
[ "0.79996395", "0.78471667", "0.768952", "0.7535967", "0.7368562", "0.734957", "0.7345492", "0.7159542", "0.71299237", "0.7128423", "0.7118006", "0.7104902", "0.7044433", "0.7019619", "0.69887257", "0.6944878", "0.69394755", "0.69145775", "0.6887307", "0.6861263", "0.6858044",...
0.7406661
4
Standard enaml importer whose state is restored after testing.
def enaml_importer(): print(imports, dir(imports)) old = imports.get_importers() yield imports imports._imports__importers = old
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_importer_management(enaml_importer):\n standard_importers_numbers = len(enaml_importer.get_importers())\n enaml_importer.add_importer(WrongEnamlImporter)\n assert WrongEnamlImporter in enaml_importer.get_importers()\n enaml_importer.add_importer(WrongEnamlImporter)\n assert (len(enaml_impor...
[ "0.624024", "0.58275086", "0.5791585", "0.57655126", "0.55804414", "0.55008775", "0.5492725", "0.53878236", "0.5371314", "0.5351267", "0.5319722", "0.52447087", "0.5232631", "0.5228512", "0.5220751", "0.52105415", "0.5205329", "0.5183187", "0.5170881", "0.5164955", "0.5149321...
0.6965677
0
Test managing manually enaml importers.
def test_importer_management(enaml_importer): standard_importers_numbers = len(enaml_importer.get_importers()) enaml_importer.add_importer(WrongEnamlImporter) assert WrongEnamlImporter in enaml_importer.get_importers() enaml_importer.add_importer(WrongEnamlImporter) assert (len(enaml_importer.get_im...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def enaml_importer():\n print(imports, dir(imports))\n old = imports.get_importers()\n\n yield imports\n\n imports._imports__importers = old", "def test_import_and_cache_generation(enaml_module):\n name, folder, _ = enaml_module\n with imports():\n importlib.import_module(name)\n\n as...
[ "0.7417657", "0.6825249", "0.6661549", "0.6391132", "0.63690794", "0.6306982", "0.6259021", "0.6216331", "0.6164024", "0.6135842", "0.60130453", "0.59856313", "0.59792435", "0.5934923", "0.5910432", "0.59071934", "0.58914375", "0.5864077", "0.58505535", "0.58491695", "0.58251...
0.77357394
0