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
build a virtualenv to run python in (do not use system python)
def build_virtualenv( venv_name, which_python='python3', _atexit_register=True, logger=p_logging.DEFAULT_LOGGER, ): logger.info('--removing existing venv %s', path.abspath(venv_name)) rm_log = local['rm']('-rf', venv_name) logger.debug(rm_log) logger.info('--creating fre...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_virtualenv():\n\n puts(yellow(\"Install dependencies from requirements.txt\"))\n with cd(env.source_dir):\n with prefix('source %s' % in_rwd('bin/activate')):\n sudo('pip install -r %s' % env.requirements_file,\n user=env.app_user)\n sudo('python setup.p...
[ "0.80692744", "0.7908599", "0.774222", "0.7519093", "0.74175507", "0.7393784", "0.7345013", "0.7202901", "0.7137042", "0.6831256", "0.67260164", "0.6682618", "0.66242117", "0.6602086", "0.659668", "0.6590112", "0.6586367", "0.65805423", "0.65607154", "0.6559693", "0.6536713",...
0.68260074
10
generate plumbum command given an incoming string
def parse_command(self, command): split_list = command.split() command = local[split_list[0]] if 'python' in split_list[0]: self.logger.debug(self.venv_pip) command = self.venv_python if split_list[0] == 'pip' or split_list[0] == 'pip3': self.logger.d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _build_command(self, cmd, unit):\n return '#' + unit + cmd + NEWLINE", "def label(cmd):\r\n cmd = cmd.replace('make][.DP', 'make1][.NP')\r\n cmd = cmd.replace('make][.SC', 'make2][.SC')\r\n cmd = re.sub('(draw.*)one','\\\\1one1',cmd)\r\n cmd = re.sub('(make1.*)one','\\\\1one1',cmd)\r\n ...
[ "0.610332", "0.592388", "0.5890794", "0.5611963", "0.55802214", "0.5506339", "0.5454742", "0.5393428", "0.53576297", "0.5340454", "0.53389555", "0.52919143", "0.5271593", "0.5251179", "0.52395785", "0.5224731", "0.52002454", "0.5191659", "0.5186986", "0.5183798", "0.5174906",...
0.0
-1
entry point for launching app
def run_main(): # pragma: no cover RunTestsCLI.run()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def startapp():", "def main():\n LOGGER.info('Loading Application')\n main_app = Application()\n parser = argparse.ArgumentParser()\n parser.add_argument(\"-c\", \"--console\", help=\"Command Line Mode\", action=\"store_true\")\n args = parser.parse_args()\n if args.console:\n LOGGER.inf...
[ "0.82018286", "0.7624813", "0.7525161", "0.7458898", "0.73670477", "0.73670477", "0.73670477", "0.73534673", "0.72916853", "0.72408944", "0.7198092", "0.7178572", "0.71465766", "0.71312237", "0.7105006", "0.709632", "0.70753425", "0.7052808", "0.70301676", "0.69803256", "0.69...
0.0
-1
Automatically make targets file in the requested format
def make_targets_file( data_path: str, split: Union[str, dict], output_filename: str ) -> None: # Logger fuse_logger_start(console_verbose_level=logging.INFO) lgr = logging.getLogger("Fuse") lgr.info("KNIGHT: make targets file", {"attrs": ["bold", "underline"]}) lgr.info( f"targets_filen...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def formatTargets(self, **kwargs):\n for key, val in kwargs.items():\n self.formatTarget(key, val)", "def formatAllTargets(self):\n self.formatTargets(**self.targets)", "def targets(path, args):\n if args:\n return \" \".join([\"{0}{1}\".format(path, target) for target in args])", "def make_ta...
[ "0.6089231", "0.60107285", "0.59871346", "0.5941533", "0.5851913", "0.57587314", "0.57550573", "0.57475406", "0.566028", "0.56577504", "0.55643654", "0.55010134", "0.54606646", "0.5458965", "0.5450588", "0.544378", "0.5424429", "0.54133", "0.54092586", "0.5373693", "0.5369220...
0.5215766
31
This function observes a given process through an event and when it fires an action is performed.
def observe_process(action: Callable, mode, *events: Event) -> None: fts = set() results = [] with futures.ThreadPoolExecutor(max_workers=os.cpu_count()) as executor: try: logger.log('[*] Press CTRL+C to cancel this operation') for event in events: ft = execu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process(self, event):\n pass", "def process_event(self, event):\r\n pass", "def process_event(self, event):\n\t\tself.current_screen.control_manager.process_event(event)", "def event_queue_proc(self,event):\r\n event()", "def process(self, user_event: UserEvent) -> None:\n p...
[ "0.7059733", "0.6694472", "0.64632255", "0.6247462", "0.60620666", "0.60335714", "0.60333025", "0.60097194", "0.58359826", "0.5816169", "0.5780159", "0.57303345", "0.5709481", "0.56664777", "0.56647664", "0.5661354", "0.56491786", "0.5625206", "0.561545", "0.55729115", "0.554...
0.57487816
11
Attach a text label above each bar in rects, displaying its height.
def autolabel(rects): for rect in rects: height = rect.get_height() ax.annotate( "{}".format(height), xy=(rect.get_x() + rect.get_width() / 2, height), xytext=(0, 3), # 3 points vertical offset textcoords="offset points", ha="center", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def autolabel(rects, ax):\n global BAR_NUMBER_SIZE\n for rect in rects:\n height = rect.get_height()\n ax.text(rect.get_x() + rect.get_width()/2.,\n height,\n str(round(height, 1)),\n ha ='center',\n va ='bottom',\n size...
[ "0.807113", "0.79336554", "0.7861467", "0.7835557", "0.7822906", "0.77769476", "0.7776375", "0.7745001", "0.7730597", "0.7730573", "0.7708679", "0.77040344", "0.7690377", "0.7677892", "0.76754576", "0.76730984", "0.76562864", "0.7648832", "0.7645011", "0.7640306", "0.76307166...
0.73544943
49
Test that if empty file is given, None is returned.
def test_empty_file(self): field = TypedFileField(required=False) for v in EMPTY_VALUES: assert field.clean(v) is None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_empty_file(fpath):\n return \\\n fpath is not None and \\\n os.path.isfile(fpath) and \\\n os.path.getsize(fpath) == 0", "def is_empty(file):\n with open(file, 'rb') as f:\n return not f.read(1)", "def input_file_test(input):\n try:\n if os.stat(input).st_size...
[ "0.76489717", "0.75652725", "0.74976176", "0.7404431", "0.73362535", "0.715226", "0.7049083", "0.69203573", "0.6779363", "0.6743024", "0.66844594", "0.6634716", "0.66292167", "0.6496561", "0.64861906", "0.64728576", "0.64662516", "0.640066", "0.63500714", "0.6261185", "0.6241...
0.6451045
17
Test that the extension validation is working properly
def test_extensions(self): field = TypedFileField(required=False, ext_whitelist=self.good_extensions) for ext in self.good_extensions: name = 'somefooname.%s' % ext file = UploadedFile(name=name, size=1) assert field.clean(file) is file for ext in self.bad_e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_validate(self):\n pass", "def test_validators():", "def validate_extension(extension):\n\n error_flag = 0\n error_string = ''\n\n if isinstance(extension, dict):\n try:\n schema = jsonref.load_uri(extension['extension_schema'])\n try:\n print...
[ "0.7298474", "0.69515324", "0.6950843", "0.68759197", "0.68593514", "0.68426394", "0.6806111", "0.6804598", "0.6562722", "0.65436846", "0.65347743", "0.65035516", "0.6489072", "0.6402878", "0.6388997", "0.6346691", "0.63387173", "0.6312984", "0.62796175", "0.62742496", "0.625...
0.75316143
0
Test that the mimetypes are validate correctly
def test_mimetypes(self): field = TypedFileField(required=False, type_whitelist=self.good_types, use_magic=False) for t in self.good_types: name = 'somefooname' file = UploadedFile(name=name, size=1, content_type=t) assert field.clean(file) is file for t in ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_mimetypes_magic(self, mock_get_content_type):\n\n def get_content_type(value):\n return value.content_type\n\n mock_get_content_type.side_effect = get_content_type\n\n field = TypedFileField(required=False, type_whitelist=self.good_types, use_magic=True)\n\n for t in...
[ "0.7667273", "0.763851", "0.75550187", "0.75023365", "0.7006191", "0.69769895", "0.69073343", "0.69062054", "0.6781376", "0.67640036", "0.67325264", "0.6723504", "0.6719304", "0.6687197", "0.6671605", "0.66456544", "0.66422045", "0.66077816", "0.65924525", "0.65606976", "0.65...
0.82419276
0
Test that the mimetypes are validate correctly
def test_mimetypes_magic(self, mock_get_content_type): def get_content_type(value): return value.content_type mock_get_content_type.side_effect = get_content_type field = TypedFileField(required=False, type_whitelist=self.good_types, use_magic=True) for t in self.good_typ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_mimetypes(self):\n field = TypedFileField(required=False, type_whitelist=self.good_types, use_magic=False)\n\n for t in self.good_types:\n name = 'somefooname'\n file = UploadedFile(name=name, size=1, content_type=t)\n assert field.clean(file) is file\n\n ...
[ "0.82419276", "0.763851", "0.75550187", "0.75023365", "0.7006191", "0.69769895", "0.69073343", "0.69062054", "0.6781376", "0.67640036", "0.67325264", "0.6723504", "0.6719304", "0.6687197", "0.6671605", "0.66456544", "0.66422045", "0.66077816", "0.65924525", "0.65606976", "0.6...
0.7667273
1
Make sure ``ValidationError`` is raised if uploaded file has no mimetype
def test_no_mimetype(self): field = TypedFileField(required=False, type_whitelist=self.good_types, use_magic=False) for t in self.good_types: name = 'somefooname' file = UploadedFile(name=name, size=1, content_type=t) del file.content_type with pytest.rai...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_no_mimetype_magic(self, mock_get_content_type):\n mock_get_content_type.side_effect = ValueError\n\n field = TypedFileField(required=False, type_whitelist=self.good_types)\n\n for t in self.good_types:\n name = 'somefooname'\n file = UploadedFile(name=name, size=...
[ "0.7776475", "0.72709423", "0.7118607", "0.7027781", "0.7002521", "0.69914484", "0.694859", "0.68884635", "0.686069", "0.6736035", "0.6707866", "0.66616106", "0.66365695", "0.66283804", "0.6582579", "0.6581422", "0.6486669", "0.64784694", "0.6478206", "0.6458501", "0.632179",...
0.79070336
0
Make sure ``ValidationError`` is raised if uploaded file has no mimetype
def test_no_mimetype_magic(self, mock_get_content_type): mock_get_content_type.side_effect = ValueError field = TypedFileField(required=False, type_whitelist=self.good_types) for t in self.good_types: name = 'somefooname' file = UploadedFile(name=name, size=1, content_t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_no_mimetype(self):\n field = TypedFileField(required=False, type_whitelist=self.good_types, use_magic=False)\n\n for t in self.good_types:\n name = 'somefooname'\n file = UploadedFile(name=name, size=1, content_type=t)\n del file.content_type\n wit...
[ "0.7906906", "0.7269755", "0.7116972", "0.7030246", "0.7002452", "0.69941306", "0.6949124", "0.6888954", "0.6862505", "0.67371505", "0.6708364", "0.6663474", "0.66362625", "0.66306883", "0.658149", "0.65809655", "0.64851123", "0.647826", "0.64769727", "0.64585227", "0.6320358...
0.7776174
1
Test that both extensions and mimetypes are validated correctly both at the same time
def test_both(self): field = TypedFileField(required=False, ext_whitelist=self.good_extensions, type_whitelist=self.good_types, use_magic=False) for ext in self.good_extensions: name = 'somefooname....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_mimetypes(self):\n field = TypedFileField(required=False, type_whitelist=self.good_types, use_magic=False)\n\n for t in self.good_types:\n name = 'somefooname'\n file = UploadedFile(name=name, size=1, content_type=t)\n assert field.clean(file) is file\n\n ...
[ "0.7914891", "0.7877988", "0.77082807", "0.74534076", "0.7424329", "0.7364778", "0.730363", "0.72946537", "0.72751206", "0.7241609", "0.7228069", "0.68160814", "0.6785955", "0.6745132", "0.6717975", "0.6690857", "0.66653776", "0.6623098", "0.66182786", "0.65562433", "0.650258...
0.72777843
8
Initialize class with lfp data
def __init__(self, lfp_data): self.lfp_data = lfp_data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n \n self.load_PSF_data()", "def __init__(self, *args, **kwargs):\n super(AbsLoopinData, self).__init__(\n # All set outside\n ('linl_lis', LinlLis()),\n ('linh', Byte()),\n *args, **kwargs\n )", "def __init__(self, fea...
[ "0.75963", "0.67351204", "0.6706532", "0.66661716", "0.6611448", "0.6609953", "0.66079646", "0.66079646", "0.66079646", "0.66079646", "0.6534196", "0.6520125", "0.65192205", "0.650805", "0.6506647", "0.6488057", "0.6477326", "0.6463792", "0.64620787", "0.64137286", "0.6397195...
0.88286996
0
Remove temporal mean from each trial
def remove_temporal_mean(self): if not hasattr(self, 'detrended_data'): self.detrend_data() self.mean_removed_data = self.detrended_data - \ np.mean(self.detrended_data, axis=-1, keepdims=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subtract_mean_across_trials(self):\n if not hasattr(self, 'std_divided_data'):\n self.divide_by_temporal_std()\n self.mean_across_trials_subtracted_data = \\\n self.std_divided_data - \\\n np.mean(self.std_divided_data, axis=1, keepdims=True)", "def divide_by_te...
[ "0.7029652", "0.62682873", "0.598299", "0.5920819", "0.5916785", "0.58507323", "0.5822636", "0.5814729", "0.5688639", "0.5680869", "0.5662162", "0.5650724", "0.5647669", "0.55737066", "0.5537115", "0.55138284", "0.55138284", "0.5509475", "0.5509475", "0.54969525", "0.54960907...
0.7598146
0
Divide by temporal standard deviation
def divide_by_temporal_std(self): if not hasattr(self, 'mean_removed_data'): self.remove_temporal_mean() self.std_divided_data = self.mean_removed_data / \ np.std(self.mean_removed_data, axis=-1, keepdims=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stdev(values):\n mean = avg(values)\n diffs = [(value - mean) ** 2 for value in values]\n return avg(diffs) ** 0.5", "def stdev(items):\n return Series.std(Series(items))", "def stdev_from_mean(x):\r\n x = array(x)\r\n return (x - mean(x)) / std(x)", "def _std(self, data):\n var ...
[ "0.70303154", "0.70081013", "0.6894062", "0.68192405", "0.680471", "0.67917585", "0.67652786", "0.6757293", "0.6757293", "0.6733499", "0.671972", "0.6718157", "0.67139", "0.6705973", "0.6677462", "0.6677462", "0.66751814", "0.6662546", "0.6652855", "0.66227466", "0.66132027",...
0.8091293
0
Subtract mean across trials from each trial (for each timepoint)
def subtract_mean_across_trials(self): if not hasattr(self, 'std_divided_data'): self.divide_by_temporal_std() self.mean_across_trials_subtracted_data = \ self.std_divided_data - \ np.mean(self.std_divided_data, axis=1, keepdims=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def avgtr(self):\n return np.diff(self.trtimes).mean()", "def trial_atr(trial, omit_missing_frames=True):\n frames = trial.HMM_MLE\n if omit_missing_frames:\n frames = frames[frames >= 0]\n\n runs = calc_run_lengths(trial.HMM_MLE)\n return_times = []\n current_return_time = 0\n for run in runs:\n...
[ "0.6891229", "0.6561155", "0.6152613", "0.61516047", "0.6104623", "0.60979486", "0.60725135", "0.6048731", "0.598965", "0.5979206", "0.59755933", "0.5951833", "0.5951288", "0.5923516", "0.58769214", "0.58767086", "0.5859882", "0.5859882", "0.5859882", "0.584206", "0.5766064",...
0.759768
0
Divide by standard deviation across trials (for each timepoint)
def divide_by_std_across_trials(self): if not hasattr(self, 'mean_across_trials_subtracted_data'): self.subtract_mean_across_trials() self.std_across_trials_divided_data = \ self.mean_across_trials_subtracted_data / \ np.std(self.mean_across_trials_subtracted_data, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stdev(items):\n return Series.std(Series(items))", "def calc_standard_deviation(data: list) -> float:\n mean = calc_mean(data)\n acc = 0.0\n for n in data:\n acc += (n - mean) ** 2\n acc /= len(data) - 1\n return math.sqrt(acc)", "def stdDev(data):\r\n sum = 0\r\n ave = avera...
[ "0.7041086", "0.6919613", "0.6913145", "0.6878369", "0.68775237", "0.6814619", "0.67827666", "0.67530537", "0.67530537", "0.67328584", "0.6639971", "0.6564795", "0.6559348", "0.65451086", "0.65384686", "0.65182203", "0.64876235", "0.64876235", "0.64549816", "0.6444664", "0.64...
0.7416995
0
alpha = threshold for single test (will be Bonferroni corrected internally) wanted_fraction = minimum fraction of tests that should be significant (stationary)
def run_adfuller_test(preprocessed_data, alpha=0.05, wanted_fraction=0.95): inds = list(np.ndindex(preprocessed_data.shape[:-1])) def return_adfuller_pval(this_ind): return adfuller( preprocessed_data[this_ind])[1] pval_list = np.array(parallelize(return_adfuller_pval, inds, n_jobs=30)) alpha =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pvalue_test(self, alpha=0.01):\n CL = int((1-alpha)*100) # confidence level\n \n if self.p_value < alpha:\n print(\"Null hypothesis rejected at {:d}%CL => distributions are different\".format(CL))\n else:\n print(\"Null hypothesis NOT rejected => distr...
[ "0.59391797", "0.58778065", "0.5851814", "0.58380985", "0.57947487", "0.579216", "0.57526", "0.5734187", "0.56922245", "0.56904244", "0.56162506", "0.5595958", "0.5584986", "0.5574947", "0.5539639", "0.5525329", "0.5498995", "0.5490676", "0.5487545", "0.54838616", "0.5480658"...
0.6295856
0
Calculate granger causality time_series = time x trials x channels
def calc_granger(time_series, time_halfbandwidth_product=1, sampling_frequency=1000, time_window_duration=0.3, time_window_step=0.05, ): m = Multitaper( time_series, sampling_frequency=sampling_frequency, # in Hz ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def graphite_cracking_rate_Ai2020(T_dim):\n k_cr = 3.9e-20\n Eac_cr = 0 # to be implemented\n arrhenius = np.exp(Eac_cr / pybamm.constants.R * (1 / T_dim - 1 / 298.15))\n return k_cr * arrhenius", "def calc_granger_actual(self):\n if not hasattr(self, 'input_data'):\n self.preproce...
[ "0.5973435", "0.5885312", "0.5802749", "0.574831", "0.56886405", "0.55259013", "0.54229647", "0.5363545", "0.53522897", "0.5351203", "0.53407997", "0.53008807", "0.5212511", "0.51963246", "0.51937586", "0.51852894", "0.5148304", "0.5119841", "0.51136154", "0.5099041", "0.5090...
0.61610305
0
preprocessed_data = (n_channels, n_trials, n_timepoints) sampling_frequency = in Hz n_shuffles = number of shuffles to perform wanted_window = window to calculate granger causality in alpha = significance level multitaper_time_window_duration = duration of time window for multitaper multitaper_time_window_step = step o...
def __init__(self, good_lfp_data, # preprocessed_data, sampling_frequency=1000, n_shuffles=500, wanted_window=[1500, 4000], alpha=0.05, multitaper_time_halfbandwidth_product=1, multita...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cubetest_per_topic(topic_truth, topic_result, gamma, max_height, cutoff):\n subtopic_num = topic_truth[1]\n topic_truth = topic_truth[0]\n\n subtopic_height = Counter() # current height of every subtopic\n subtopic_count = Counter() # #docs found relevant to every subtopic (nrels)\n\n weight_p...
[ "0.57132494", "0.5595162", "0.5551956", "0.5525474", "0.5525352", "0.55149806", "0.5493697", "0.54556054", "0.5432164", "0.5368782", "0.53298104", "0.53258", "0.53194267", "0.53181934", "0.5303471", "0.5290147", "0.52515495", "0.5232192", "0.52276266", "0.52183676", "0.520918...
0.68344384
0
Calculate bootstrapped actual granger causality to allow for estimation of error
def calc_granger_actual(self): if not hasattr(self, 'input_data'): self.preprocess_and_check_stationarity() # input_data shape = (n_timepoints, n_trials, n_channels) # Calculate as many bootstrapped samples as n_shuffles trial_inds = np.random.randint( 0, self...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def binom_bca_bootstrap_err(k, n, B=10000, CL=[0.025, 0.975], acceleration=True, return_full=False):\n theta_MLE = k/n\n k_i = bootstrap_sample_binomial(k, n, B)\n\n # Bootstrap estimates of the parameter\n theta_i = k_i / n\n theta0_star = np.sum(theta_i) / B\n print(f'theta_MLE = {theta_MLE}, t...
[ "0.62454176", "0.6181481", "0.5973252", "0.58579695", "0.5794351", "0.57939696", "0.57455033", "0.57455033", "0.5720694", "0.57071906", "0.5694225", "0.5676966", "0.56485546", "0.56252354", "0.56042624", "0.55519134", "0.55401033", "0.55351764", "0.5533983", "0.55071896", "0....
0.63861793
0
Calculate shuffled granger causality
def calc_granger_shuffle(self): if not hasattr(self, 'input_data'): self.preprocess_and_check_stationarity() temp_series = [np.stack([np.random.permutation(x) for x in self.input_data.T]).T for i in trange(self.n_shuffles)] outs...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc_granger_actual(self):\n if not hasattr(self, 'input_data'):\n self.preprocess_and_check_stationarity()\n # input_data shape = (n_timepoints, n_trials, n_channels)\n # Calculate as many bootstrapped samples as n_shuffles\n trial_inds = np.random.randint(\n ...
[ "0.62754345", "0.62195766", "0.60361123", "0.5824733", "0.58219045", "0.563918", "0.5584704", "0.5575912", "0.5573002", "0.55611855", "0.54603237", "0.54584056", "0.5441802", "0.5441032", "0.5434684", "0.5428206", "0.5410833", "0.54057086", "0.54057086", "0.53993386", "0.5378...
0.6487357
0
Mask is True when granger causality is NOT SIGNIFICANT
def get_granger_sig_mask(self): if not hasattr(self, 'percentile_granger'): self.calc_shuffle_threshold() if not hasattr(self, 'granger_actual'): self.calc_granger_actual() mean_granger_actual = np.mean(self.granger_actual, axis=0) self.masked_granger = np.ma.mask...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mask(self):", "def cmask(self):\n mask = np.zeros(18)\n if 'full' in self.CONS: mask[:] = 1\n if 'f0' in self.CONS: mask[0] = 1\n if 'f1' in self.CONS: mask[1:4] = 1\n if 'f2' in self.CONS: mask[4:10] = 1\n if 'vx' in self.CONS: mask[10] = 1\n if 'vy' in self....
[ "0.6703793", "0.63538605", "0.63142383", "0.6256875", "0.61741894", "0.6091233", "0.60839707", "0.6051521", "0.5936672", "0.59186983", "0.5887224", "0.58444947", "0.57600707", "0.5741366", "0.57228017", "0.5708867", "0.5700054", "0.5693821", "0.56917423", "0.56917423", "0.568...
0.66818357
1
Load a .ini file in a ConfigObject. Dont raise if the file does not exist
def ini(filename, **defaults): filename = sh.path(filename) defaults.update(home=sh.path('~')) return ConfigObject(filename=filename, defaults=defaults)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_config():\n config_path = Path(\"config.ini\")\n if config_path.exists():\n config.read(config_path)\n else:\n config[\"database\"] = {\"location\": \"image-database.db\"}\n config[\"images\"] = {\"extensions\": \".jpeg,.jpg,.png,.gif,.tiff\"}\n with open(config_path,...
[ "0.7024221", "0.7011484", "0.698936", "0.69812244", "0.6818969", "0.67843896", "0.6672474", "0.6648733", "0.66448754", "0.66153926", "0.6569366", "0.653835", "0.65142953", "0.6496884", "0.6484515", "0.6464613", "0.64596313", "0.6449164", "0.64488745", "0.6447785", "0.6437697"...
0.6802061
5
A list of return codes of all processes launched by the pipe
def returncodes(self): for p in self.processes: p.wait() codes = [p.poll() for p in self.processes] if set(codes) == set([0]): return [] return codes
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ListProcesses(self):\n stdout, stderr = self.RunCmdOnDevice(\n ['/bin/ps', '--no-headers', '-A', '-o', 'pid,ppid,args:4096,state'],\n quiet=True)\n assert stderr == '', stderr\n procs = []\n for l in stdout.split('\\n'):\n if l == '':\n continue\n m = re.match(r'^\\s*...
[ "0.6246769", "0.6245669", "0.6231879", "0.6155173", "0.61222064", "0.6060783", "0.5963847", "0.5958712", "0.59503996", "0.5923416", "0.59230506", "0.5919986", "0.59160084", "0.58853406", "0.58609474", "0.58411664", "0.5837716", "0.5834148", "0.5834146", "0.58337736", "0.58334...
0.7935474
0
True if one or more process failed
def failed(self): output = self.__call__() return output.failed
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_processes(process_list):\n running = 1 # 0 when the subprocesses are all done\n while running:\n for proc in process_list:\n proc.poll()\n if proc.returncode == 1:\n raise RuntimeError(\"Program \" +\n \"number \" +\n ...
[ "0.7545346", "0.72061265", "0.69463867", "0.68636256", "0.64848185", "0.6456872", "0.6443327", "0.6412077", "0.6346322", "0.63018525", "0.62907344", "0.6174255", "0.6166908", "0.6157817", "0.61569697", "0.6152704", "0.6116674", "0.61150193", "0.60692024", "0.6061821", "0.6015...
0.5971587
22
True if all processes succeeded
def succeeded(self): output = self.__call__() if output.succeeded: return output or True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_processes(process_list):\n running = 1 # 0 when the subprocesses are all done\n while running:\n for proc in process_list:\n proc.poll()\n if proc.returncode == 1:\n raise RuntimeError(\"Program \" +\n \"number \" +\n ...
[ "0.7873151", "0.65517205", "0.65272486", "0.6456628", "0.6421741", "0.635912", "0.63176507", "0.62866455", "0.62855405", "0.62604", "0.62322694", "0.6218841", "0.6209144", "0.62087065", "0.6196792", "0.61760706", "0.6167658", "0.61458474", "0.61261225", "0.6108483", "0.608764...
0.0
-1
combined stderr of all processes
def stderr(self): if self._stderr is None: stderr = [p.stderr.read() for p in self.processes if p.stderr] output = b'\n'.join(stderr).strip() if not isinstance(output, str): output = output.decode(self.encoding, 'ignore') self._stderr = output ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nostderr():\n save_stderr = sys.stderr\n sys.stderr = cStringIO.StringIO()\n yield\n sys.stderr = save_stderr", "def stderr(self, stderr: str) -> Tuple[List[Message], List[AnnotateCode], str]:\n return [], [], stderr", "def result_stderr(result):\n return result[1][1]", "def get_std...
[ "0.6715245", "0.66839", "0.6574798", "0.65431535", "0.6496524", "0.64380735", "0.63869214", "0.6328884", "0.62826824", "0.6277269", "0.6198289", "0.6133846", "0.60173345", "0.5962739", "0.5962001", "0.5930159", "0.59266466", "0.5872949", "0.58673817", "0.5847088", "0.5786829"...
0.68787926
0
Run processes in background. Return the last piped Popen object
def bg(self): p = None self.processes = [] self._stderr = None stdin = sys.stdin cmds = self.commands if [c for c in cmds if c._cmd_args[:1] == ['sudo']]: check_sudo() for cmd in cmds: if isinstance(cmd, Stdin): stdin = cm...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def call(*args, **kwargs):\n return Popen(*args, **kwargs).wait()", "def start(self):\n last_stdout = None\n self.processes = []\n for cmd in self.cmds:\n # TODO: handle exceptions raised by Popen\n p = subprocess.Popen(cmd, stdin=last_stdout, stdout=subprocess.PIPE,...
[ "0.6664132", "0.64688516", "0.64178354", "0.6342972", "0.6325031", "0.62582344", "0.62191474", "0.60025233", "0.5937454", "0.5910544", "0.5850933", "0.58419496", "0.584046", "0.5808457", "0.5794157", "0.5777509", "0.5762344", "0.5744797", "0.572683", "0.56833637", "0.5670176"...
0.7648508
0
standard output of the pipe. A file descriptor or an iteraror
def stdout(self): p = self.bg() if isinstance(p, PyPipe): return p.iter_stdout else: return p.stdout
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def output_to_pipe(pipe_in):\n os.dup2(pipe_in, 1) # stdout\n # os.dup2(pipe_in, 2) # stderr", "def standard_output(self) -> global___Statement.StandardOutput:", "def echo_pipe(name: str, pipe: IO[AnyStr], dest_file: TextIO):\r\n assert pipe\r\n with pipe:\r\n for line in iter(pipe.readlin...
[ "0.72244734", "0.70827913", "0.65350837", "0.6514286", "0.6406539", "0.6382835", "0.63103026", "0.6296839", "0.62585413", "0.62052107", "0.6111356", "0.5982335", "0.59437376", "0.59391224", "0.5939096", "0.5938583", "0.5837392", "0.58273935", "0.58165693", "0.57854456", "0.57...
0.6322155
6
Run a batch of the same command and manage a pool of processes for you
def map(cls, args, pool_size=None, stop_on_failure=False, **kwargs): kw = dict( stdin=sys.stdin, stderr=PIPE, stdout=PIPE ) kw.update(kwargs) if pool_size is None: import multiprocessing pool_size = multiprocessing.cpu_count() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_commands(self):\n processes = []\n\n i = 0\n ## get list of commands\n commands = self.get_commands()\n cnum = multiprocessing.cpu_count()\n\n while len(commands)>0:\n while len(processes)<cnum-1:\n c = commands.pop()\n i+=1...
[ "0.70449847", "0.6387804", "0.63765144", "0.6361185", "0.635158", "0.6335699", "0.62907577", "0.6248162", "0.61241436", "0.60282695", "0.5980476", "0.59682316", "0.59614676", "0.594237", "0.5920128", "0.5910792", "0.5903998", "0.58932984", "0.58870876", "0.58841103", "0.58738...
0.61576796
8
Change the current directory
def cd(self, directory): return ChangeDir(directory)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def change_dir(path): \r\n os.chdir(path)", "def change_directory(path):\n os.chdir(path)", "def change_to_current_path(to_change_path):\n os.chdir(to_change_path)", "def changeDirectory( self, directory ):\n if directory[0] == '/':\n directory = directory.lstrip( '/' )\n self.cwd = '%s...
[ "0.8097169", "0.80569446", "0.8038111", "0.7640401", "0.7405466", "0.73729455", "0.73583424", "0.7357387", "0.7277819", "0.7239829", "0.723306", "0.71557087", "0.71235436", "0.7116997", "0.70742506", "0.69925034", "0.696881", "0.6960464", "0.6955261", "0.69533086", "0.6878237...
0.61863726
74
Add extra dependencies in a virtualenv
def requires(*requirements, **kwargs): if '/.tox/' in sys.executable: venv = os.path.dirname(os.path.dirname(sys.executable)) elif env.virtual_env: # pragma: no cover venv = env.chut_virtualenv = env.virtual_env else: # pragma: no cover venv = os.path.expanduser(kwargs.get('venv', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sub_install_python_requirements():\n # Activate the virtualenv\n activate = 'source {0}/{1}/bin/activate'.format(\n env.virtualenv['dir'], env.virtualenv['name'])\n run(activate)\n\n # Install Python requirements\n install = 'pip install -r /vagrant/Flask_app/requirements.txt'\n\n # Jo...
[ "0.74376476", "0.7316353", "0.7110245", "0.70823187", "0.7031737", "0.7028379", "0.70093244", "0.6918647", "0.68816835", "0.68357944", "0.6831954", "0.6818253", "0.67393124", "0.67264587", "0.67101854", "0.6637899", "0.6598489", "0.65739876", "0.6546227", "0.6543257", "0.6529...
0.7067952
4
Generate chut scripts contained in location
def chutifab(self, *args): ll = logging.getLogger(posixpath.basename(sys.argv[0])) level = ll.level ll.setLevel(logging.WARN) if not args: args = ['.'] for location in args: Generator(destination='.chutifab')(location) ll.setLevel(level) se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _add_scripts(prefix):\n mapping = {\"MAST_HOME\": prefix}\n if \"Windows\" in platform.system():\n script_dir = os.path.join(INSTALL_DIR, \"files\", \"windows\")\n files = [\n \"mast.bat\",\n \"mast-system.bat\",\n \"mast-accounts.bat\",\n \"mast-...
[ "0.6096537", "0.6009406", "0.59709835", "0.5967113", "0.5920322", "0.59109473", "0.58882314", "0.5841919", "0.57877", "0.5781333", "0.5743029", "0.57190037", "0.5708141", "0.5695298", "0.5688432", "0.56231797", "0.5622278", "0.55802655", "0.5565092", "0.55514556", "0.55338746...
0.67919713
0
Upload a script and run it. ``args`` are used as command line arguments. ``kwargs`` are passed to `fabric`'s `run`
def run(self, script, *args, **kwargs): return self._run('run', script, *args, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def script_run(ctx: click.Context, name, script_arguments):\n subcommand_script.cmd_run(ctx.obj, name, script_arguments)", "def run(args):\n\n drive_uid = str(args[\"drive_uid\"])\n file_uid = str(args[\"file_uid\"])\n chunk_idx = int(args[\"chunk_index\"])\n secret = str(args[\"secret\"])\n da...
[ "0.6333176", "0.6069562", "0.60669595", "0.5997453", "0.5979731", "0.59490883", "0.5912231", "0.59050536", "0.59018415", "0.5843688", "0.5803377", "0.57960784", "0.5723168", "0.56878614", "0.5683986", "0.5648805", "0.5643183", "0.5575065", "0.5519657", "0.5519369", "0.5487893...
0.68447685
0
Upload a script and run it using sudo. ``args`` are used as command line arguments. ``kwargs`` are passed to `fabric`'s `sudo`
def sudo(self, script, *args, **kwargs): return self._run('sudo', script, *args, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _upload_template(filename, destination, **kwargs):\n user = kwargs.pop('user')\n kwargs['use_sudo'] = True\n upload_template(filename, destination, **kwargs)\n sudo('chown %(user)s:%(user)s %(dest)s' % {'user': user, 'dest': destination})", "def run_remote_script(self, script_file, args=None, log...
[ "0.6268761", "0.589509", "0.58233005", "0.58182013", "0.5760758", "0.57154745", "0.5654159", "0.5632504", "0.5609804", "0.5580056", "0.556147", "0.5543384", "0.5473087", "0.54669285", "0.5439649", "0.5400255", "0.5376021", "0.5350383", "0.5334175", "0.5298767", "0.5295162", ...
0.6812293
0
Return a random ktuple of unique elements selected from population.
def rand_tuple(population, k, required_inds=None): if isinstance(population, int): population = xrange(population) if required_inds is None: required_inds = [] if not isinstance(required_inds, collections.Iterable): required_inds = [required_inds] t = set(random.sample(populati...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def random_sample(population, k):\r\n \r\n newpopulation = population[:]\r\n if len(population) < k:\r\n raise ValueError, \"sample larger than population\"\r\n\r\n retlist = []\r\n populationsize = len(population)-1\r\n\r\n for num in range(k):\r\n pos = random_randint(0,populationsize-num)\r\n ret...
[ "0.7027959", "0.6738937", "0.67178", "0.6524128", "0.649793", "0.6422931", "0.6414868", "0.63981503", "0.6355274", "0.63087744", "0.6304614", "0.61815244", "0.6177249", "0.6150533", "0.6144496", "0.61237365", "0.610168", "0.60970324", "0.60753673", "0.6051624", "0.6015738", ...
0.78772885
0
The purpose of this is to help the API decide which fields to expose to the user when they are creating and updateing an Object. This function should be implemented in inheriting models and overriden to provide additional fields. Tastypie ignores any relational fields on the model. See the ModelResource definitions for...
def get_api_fields(cls): return ['fqdn', 'ttl', 'description', 'views']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def objectFields(self):\n raise NotImplementedError", "def get_fields(self, request, obj=None):\n if obj:\n return self.fields\n return self.add_fields", "def clean_fields(self, exclude=None):\n obj = self._obj\n if obj is None:\n return None\n\n self...
[ "0.64550966", "0.61312807", "0.60282755", "0.5996905", "0.5970836", "0.59571695", "0.5911654", "0.5871284", "0.58693796", "0.5844966", "0.58281255", "0.57374364", "0.57277536", "0.5713314", "0.5681614", "0.56656194", "0.5655514", "0.56459785", "0.5596161", "0.55887556", "0.55...
0.59325325
6
If a CNAME RR is present at a node, no other data should be present; this ensures that the data for a canonical name and its aliases cannot be different."
def check_for_cname(record): CNAME = cydns.cname.models.CNAME if hasattr(record, 'label'): if CNAME.objects.filter(domain=record.domain, label=record.label).exists(): raise ValidationError("A CNAME with this name already exists.") else: if CNAME.ob...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_cname_response(self):\n fqdn = \"cname.github.com\"\n answer = self.resolver.query(fqdn, \"CNAME\")\n for rr in answer:\n if rr.target.to_text() != \"github.map.fastly.net.\":\n raise TestException(\"Unexpected target for {0}: {1}\"\n ...
[ "0.66299236", "0.660377", "0.6489522", "0.6237036", "0.5940322", "0.5899176", "0.5880195", "0.5746405", "0.56934726", "0.5651654", "0.54630584", "0.5213084", "0.5147239", "0.5126222", "0.507616", "0.507153", "0.50488186", "0.50211823", "0.49776897", "0.4961214", "0.49337912",...
0.6656125
0
If an object's domain is delegated it should not be able to be changed. Delegated domains cannot have objects created in them.
def check_for_delegation(record): try: if not record.domain.delegated: return except ObjectDoesNotExist: return if not record.pk: # We don't exist yet. raise ValidationError("No objects can be created in the {0}" "domain. It is delegated." ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _adddomain(self, domain: Domain):\n\n domain = copy.deepcopy(domain)\n if self.model is not None:\n # Check that model and domain are compatible\n self._validate_model_domain(self.model, domain)\n\n # Add in domain\n self.domain = domain\n\n ...
[ "0.58941036", "0.5639527", "0.5625555", "0.5514755", "0.54754555", "0.54411316", "0.53744304", "0.5370402", "0.5310718", "0.5309314", "0.52955467", "0.5281646", "0.5263368", "0.5252164", "0.5234074", "0.5162429", "0.51530653", "0.5148863", "0.51440006", "0.5141241", "0.512088...
0.6326696
0
Represent an intersection using the Cantor pairing function.
def intersection(st, ave): return (st+ave)*(st+ave+1)//2 + ave
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_union_intersection():\n X = np.random.randn(d, 100)\n assert np.array_equal(lincon.indicator_intersection(X), 1-lincon.indicator_union(X))", "def intersection(x, y, f, p):", "def intersection(self, other):\n return self._geomgen(capi.geom_intersection, other)", "def intersect(self, *arg...
[ "0.6529781", "0.64454335", "0.643646", "0.6377812", "0.6290983", "0.6158032", "0.61379325", "0.6099429", "0.60879844", "0.60427094", "0.6039375", "0.6011817", "0.5966033", "0.5949825", "0.5942497", "0.5928957", "0.59143835", "0.59129083", "0.5910618", "0.5907354", "0.5888551"...
0.5358017
95
Return the taxicab distance between two intersections. >>> times_square = intersection(46, 7) >>> ess_a_bagel = intersection(51, 3) >>> taxicab(times_square, ess_a_bagel) 9 >>> taxicab(ess_a_bagel, times_square) 9
def taxicab(a, b): "*** YOUR CODE HERE ***" return abs(street(a)-street(b)) + abs(avenue(a)-avenue(b))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def taxicab(a, b):\n street_1, street_2 = street(a), street(b)\n avenue_1, avenue_2 = avenue(a), avenue(b)\n return abs(street_1 - street_2) + abs(avenue_1 - avenue_2)", "def taxicab(a, b):\n \"*** YOUR CODE HERE ***\"\n return abs(street(a) - street(b)) + abs(avenue(a) - avenue(b))", "def taxic...
[ "0.7120618", "0.67128575", "0.67128575", "0.65796095", "0.65704274", "0.5223073", "0.50749713", "0.5042515", "0.5000128", "0.48629433", "0.48522303", "0.4831717", "0.47960907", "0.4795959", "0.478697", "0.4773556", "0.4723682", "0.4699743", "0.46614695", "0.46481127", "0.4647...
0.68399566
1
Returns a new list containing square roots of the elements of the original list that are perfect squares. >>> seq = [8, 49, 8, 9, 2, 1, 100, 102] >>> squares(seq) [7, 3, 1, 10] >>> seq = [500, 30] >>> squares(seq) []
def squares(s): "*** YOUR CODE HERE ***" return [int(i**0.5) for i in s if round(i ** 0.5) ** 2 == i ]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_squares(self):\n\t\tself.squares = [x for x in range(self.low, self.high + 1) if sqrt(x) == int(sqrt(x))]", "def squares(s):\n \"*** YOUR CODE HERE ***\"\n result = []\n for num in s:\n sr = round(math.sqrt(num))\n if sr * sr == num:\n result.append(sr)\n return resu...
[ "0.7534428", "0.7139836", "0.7011327", "0.69586444", "0.6890902", "0.6872329", "0.68216246", "0.66573334", "0.66424423", "0.66406393", "0.66404545", "0.66344607", "0.66228914", "0.6611309", "0.65243477", "0.65034103", "0.6489072", "0.64806134", "0.64675397", "0.6315774", "0.6...
0.6735762
7
Return the value of G(n), computed recursively. >>> g(1) 1 >>> g(2) 2 >>> g(3) 3 >>> g(4) 10 >>> g(5) 22 >>> from construct_check import check >>> check(HW_SOURCE_FILE, 'g', ['While', 'For']) True
def g(n): "*** YOUR CODE HERE ***" if n <= 3: return n else: return g(n-1) + 2*g(n-2) + 3*g(n-3)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def g(n):\n \"*** YOUR CODE HERE ***\"\n if n < 4:\n return n\n else:\n return g(n-1) + 2*g(n-2) + 3*g(n-3)", "def g(n):\n \"*** YOUR CODE HERE ***\"\n if n <=3:\n return n\n else:\n return g(n-1)+2*g(n-2)+3*g(n-3)", "def g(n):\n \"*** YOUR CODE HERE ***\"\n ...
[ "0.6509589", "0.6436936", "0.63279766", "0.63279766", "0.615563", "0.6023759", "0.5937535", "0.55640376", "0.5536395", "0.55231243", "0.54222506", "0.5410513", "0.539917", "0.53932846", "0.5342397", "0.5292581", "0.5288211", "0.52790266", "0.5253362", "0.5252296", "0.51862425...
0.65330666
0
Return the value of G(n), computed iteratively. >>> g_iter(1) 1 >>> g_iter(2) 2 >>> g_iter(3) 3 >>> g_iter(4) 10 >>> g_iter(5) 22 >>> from construct_check import check >>> check(HW_SOURCE_FILE, 'g_iter', ['Recursion']) True
def g_iter(n): if n <= 3: return n else: g_n_1, g_n_2, g_n_3 = 3, 2, 1 # always update the g_i until reach the final n for i in range(4,n+1): g_i = g_n_1 + 2*g_n_2 + 3*g_n_3 # update the g(n-1), g(n-2), g(n-3) g_n_1, g_n_2, g_n_3 = g_i, g_n_1, g_n_2 return g_i "*** YOUR CODE HERE ***"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def g_iter(n):\n \"*** YOUR CODE HERE ***\"\n if n < 4:\n return n\n else:\n g1 = 1\n g2 = 2\n g3 = 3\n i = 3\n while(i < n):\n i += 1\n t = g3 + 2*g2 + 3*g1\n g1 = g2\n g2 = g3\n g3 = t\n return g3", "de...
[ "0.71208894", "0.68869877", "0.6281551", "0.622201", "0.6130775", "0.6093902", "0.60279924", "0.5978761", "0.59504557", "0.59047425", "0.5899456", "0.5899456", "0.5845385", "0.58453226", "0.58441585", "0.583596", "0.57956004", "0.5788619", "0.570271", "0.56376046", "0.5634359...
0.73005706
0
Return the nth element of the pingpong sequence. >>> pingpong(7) 7 >>> pingpong(8) 6 >>> pingpong(15) 1 >>> pingpong(21) 1 >>> pingpong(22) 0 >>> pingpong(30) 6 >>> pingpong(68) 2 >>> pingpong(69) 1 >>> pingpong(70) 0 >>> pingpong(71) 1 >>> pingpong(72) 0 >>> pingpong(100) 2 >>> from construct_check import check >>> ch...
def pingpong(n): # define two helper function, the recursion start from the bottom # from 1 to n "*** YOUR CODE HERE ***" def positive(n, k, turn): if turn == n: return k else: if (k % 7 == 0) or has_seven(k): return negative(n, k-1, turn + 1) else: return positive(n, k+1, turn + 1) def negat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pingpong(n):\n def helper(k, direction, ret):\n if k == n:\n return ret +direction\n elif k%7 == 0 or num_sevens(k):\n return helper(k+1, -direction, ret + direction)\n else:\n return helper(k+1, direction, ret + direction)\n return helper(1, 1, 0)", ...
[ "0.5579512", "0.55709857", "0.5553509", "0.554925", "0.55054665", "0.5184937", "0.5149973", "0.51207805", "0.51080966", "0.51080966", "0.51080966", "0.50996745", "0.50977975", "0.50484616", "0.5023953", "0.49914345", "0.49744314", "0.4963783", "0.49512187", "0.49058053", "0.4...
0.48134068
26
Returns True if at least one of the digits of k is a 7, False otherwise. >>> has_seven(3) False >>> has_seven(7) True >>> has_seven(2734) True >>> has_seven(2634) False >>> has_seven(734) True >>> has_seven(7777) True
def has_seven(k): if k % 10 == 7: return True elif k < 10: return False else: return has_seven(k // 10)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_seven(k):\n if k == 0:\n return False\n else:\n if k%10 == 7:\n return True\n return has_seven(k//10)", "def has_seven(k):\n \n if k % 10 == 7:\n return True\n else:\n if k<10:\n return False\n return has_seven(k//10)", "def...
[ "0.8716564", "0.8706798", "0.8690393", "0.8690393", "0.8690393", "0.61994755", "0.58175665", "0.57838863", "0.57414204", "0.5732691", "0.55530447", "0.5547129", "0.55352366", "0.5535023", "0.5497758", "0.5434485", "0.5352723", "0.53297573", "0.5328972", "0.5325144", "0.531923...
0.8931878
0
Return the number of ways to make change for amount. >>> count_change(7) 6 >>> count_change(10) 14 >>> count_change(20) 60 >>> count_change(100) 9828
def count_change(amount): options = [2**i for i in range(amount+1) if 2**i <= amount] options = sorted(options, reverse = True) length = len(options) # print(length) def helper(remains, i, options, length): # loop until reaching the smallest coin if i >= length : return 0 # check the remains if remains...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_change(amount):\n def change_with_maxcoin(total, maxcoin):\n if total == 0:\n return 1\n if maxcoin == 0:\n return 0\n cnt = 0\n num_change = 0\n while cnt * maxcoin <= total:\n num_change += change_with_maxcoin(total - cnt * maxcoin,...
[ "0.7939031", "0.76921844", "0.7645819", "0.7632281", "0.751326", "0.735496", "0.7268972", "0.69675857", "0.6723433", "0.6232168", "0.6041933", "0.59812564", "0.59323406", "0.58486235", "0.5755835", "0.56916153", "0.5571448", "0.5469678", "0.54315627", "0.5374645", "0.53648406...
0.79869974
0
Return the value of an expression that computes factorial. >>> make_anonymous_factorial()(5) 120 >>> from construct_check import check >>> check(HW_SOURCE_FILE, 'make_anonymous_factorial', ['Assign', 'AugAssign', 'FunctionDef', 'Recursion']) True
def make_anonymous_factorial(): # u need to use a helper function if your lambda statement does # not have a name # fact = lambda n: 1 if n == 1 else mul(n, fact(sub(n, 1))) def recursive2(f, n): return f(f, n) def recursive(n): return recursive2((lambda rec, n: 1 if n == 1 else mul(n, rec(sub(n, 1)))), n) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_anonymous_factorial():\n return 'YOUR_EXPRESSION_HERE'", "def make_anonymous_factorial():\n return 'YOUR_EXPRESSION_HERE'", "def make_anonymous_factorial():\n return 'YOUR_EXPRESSION_HERE'", "def make_anonymous_factorial():\n return 'YOUR_EXPRESSION_HERE'", "def make_anonymous_factoria...
[ "0.84055257", "0.84055257", "0.84055257", "0.84055257", "0.7953051", "0.7495947", "0.6420814", "0.6418577", "0.6416657", "0.6380578", "0.63460726", "0.63381463", "0.6334002", "0.62267727", "0.6200206", "0.6187498", "0.61707485", "0.61447144", "0.6141441", "0.6130753", "0.6130...
0.7648021
5
Implementation of Focal Loss from the paper in multiclass classification
def categorical_focal_loss(gamma=2.0, alpha=0.25): def focal_loss(y_true, y_pred): # Define epsilon so that the backpropagation will not result in NaN for 0 divisor case epsilon = backend.epsilon() # Add the epsilon to prediction value #y_pred = y_pred + epsilon # Clip the pr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def focal_loss(self,labels, logits, gamma=2):\n y_pred = tf.nn.softmax(logits, dim=-1) # [batch_size,num_classes]\n # labels = tf.one_hot(labels, depth=y_pred.shape[1])\n L = -labels * ((1 - y_pred) ** gamma) * tf.log(y_pred)\n L = tf.reduce_sum(L, axis=1)\n return L", "def fo...
[ "0.6775613", "0.6576758", "0.6491725", "0.64844924", "0.6475553", "0.64732516", "0.64350957", "0.6420379", "0.63795304", "0.6373628", "0.63676196", "0.63623226", "0.63240296", "0.63087744", "0.6286535", "0.62419695", "0.62229663", "0.6222136", "0.6222136", "0.62179106", "0.62...
0.7187947
0
Look at each neighbor of a point and, if healthy, have chance to infect
def infect(r, c): subset = grid[r-1:r+2, c-1:c+2] print(f"Looking at ({r-1}, {c-1}) through ({r+1}, {c+1})") # np.where(subset == 0) # subset[subset == 0] = np.fromfunction(calc_infect, shape=()) #v_calc_infect(subset[subset == 0]) #for i in np.nditer(subset): # if subset[i] == 0: # ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def investigate(self, nearest_neighbors):\n pass", "def _check_neighbors(self):\n for direction, dir_info in self.DIRECTIONS.items():\n pos = Point(\n self.position.x + dir_info[\"mask\"][0],\n self.position.y + dir_info[\"mask\"][1]\n )\n ...
[ "0.6369916", "0.6350412", "0.63481426", "0.63157475", "0.6314983", "0.62951374", "0.62788635", "0.6255883", "0.62350255", "0.6151278", "0.61396664", "0.6091706", "0.6090609", "0.60713357", "0.60690695", "0.6063208", "0.6038064", "0.602581", "0.60251755", "0.60057694", "0.6004...
0.0
-1
Perform actions on all infected members of the population in a random order
def turn(grid): # Select infected people rows, cols = np.where(grid == 1) #print(f"Infected at {rows}, {cols}") # In random order, go through each infected idx = np.arange(len(rows)) np.random.shuffle(idx) for i in idx: # Chance to heal if np.random.binomial(1, heal_rate): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _mutate(self, individuals):\n for cur in individuals:\n if random.random() < self.mutation_probability:\n self.op.mutate(cur['individual'])\n cur['fitness'] = None", "def hesitant_action(self):\n if not self.agent.done:\n if not self.opponenet...
[ "0.6152134", "0.6125817", "0.61022955", "0.6062612", "0.5987989", "0.5987563", "0.59344083", "0.5924505", "0.5913674", "0.5815777", "0.58083546", "0.5803261", "0.5792966", "0.578544", "0.5772891", "0.5767429", "0.57490784", "0.5739122", "0.572956", "0.57269686", "0.57267815",...
0.6190832
0
Count up the number of
def add_tally(grid): # Count number of each patient type in the grid tally['healthy'].append(len(grid[grid == 0])) tally['sickos'].append(len(grid[grid == 1])) tally['immune'].append(len(grid[grid == -1])) tally['dead'].append(len(grid[grid == 2])) tally['time'].append(tally['time'][-1]+1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count():", "def Count(self) -> int:", "def Count(self) -> int:", "def Count(self) -> int:", "def Count(self) -> int:", "def counter(self) -> int:", "def counter(self) -> int:", "def count() -> int:\n pass", "def count(self):\n # TODO not implemented yet\n return 0", "def coun...
[ "0.8492241", "0.78293914", "0.78293914", "0.78293914", "0.78293914", "0.7768418", "0.7768418", "0.7636821", "0.7427295", "0.7401275", "0.71662635", "0.71338016", "0.71338016", "0.71240383", "0.7112772", "0.70056784", "0.6985037", "0.69749457", "0.69513613", "0.68868035", "0.6...
0.0
-1
Function that's called automatically by the animation loop
def updatefig(*args): p1.set_array(turn(grid)) p2.set_data(tally['time'], tally['sickos']) p3.set_data(tally['time'], tally['immune']) p4.set_data(tally['time'], tally['dead']) ax2.set_xlim(0, max(tally['time'])) # ax2.set_ylim(0, max(max(sickos), max(immune))) # End sim if the disease is go...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_animations(self):\n self.animate_bloop(700, 160, 50)", "def animate(self, u):\n pass", "def animate(self, u):\n pass", "def start_animation(self):\n\t\ttime.sleep(1)\n\t\tself.fishbowl.animate_balls()", "def Gameloop():", "def _init_anim(self):\n pass", "def event1151...
[ "0.7553557", "0.7044329", "0.7044329", "0.69232357", "0.6861924", "0.6777186", "0.6736097", "0.67172956", "0.6617808", "0.6612902", "0.660838", "0.6603106", "0.6549287", "0.6549287", "0.6549287", "0.6549287", "0.6549287", "0.6549287", "0.6549287", "0.6549287", "0.6549287", ...
0.0
-1
CLI frontend function. It takes command line options e.g. host, port and provides `help` message.
def main(): docopt = docoptinit(__doc__) logging.basicConfig(level=logging.INFO, format='[%(asctime)s] [%(levelname)s] [ %(filename)s:%(lineno)s - %(name)s ] %(message)s ') logging.info('basic config') # qb.set_logger(__file__, debug=docopt['--debug']) host = docopt['--host']...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cli_help(self):\n self._generate_cli_version()\n self._generate_cli_help()\n sys.exit(0)", "def test_cli_help(self):\n output = self.update_command('-h')", "def cli():\n return", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", ...
[ "0.7485873", "0.7443428", "0.7438209", "0.7409361", "0.7409361", "0.7409361", "0.7409361", "0.7409361", "0.7409361", "0.7409361", "0.7409361", "0.7409361", "0.7409361", "0.7409361", "0.7409361", "0.7409361", "0.7409361", "0.7409361", "0.7409361", "0.7409361", "0.7409361", "...
0.0
-1
removes the old repo in server and clones a new one. the configures the host.
def flush_repo(): server = get_server() run("rm -rf %(project_name)s" % env) git.clone() server.setup()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_source(self):\n cwd = None\n if os.path.exists(self.path):\n cwd = self.path\n cmd = 'git fetch && git reset --hard origin/master'\n else:\n cmd = 'git clone %s %s' % (self.repo_url, self.path)\n Command(cmd, cwd=cwd)", "def deploy_pull_mast...
[ "0.61914355", "0.61613387", "0.61292326", "0.610431", "0.6018636", "0.600334", "0.5974268", "0.59159434", "0.5908282", "0.5882658", "0.58382523", "0.5837231", "0.5782798", "0.5774126", "0.57253504", "0.56959504", "0.5688279", "0.5687978", "0.5686983", "0.56722623", "0.5639738...
0.7116184
0
pull, commit, push and test in the app.
def prepare_deploy(): from fabdeploy.django import test as django_test django_test() git.add_commit_pull() git.push()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pull():\n _with_deploy_env(['git pull'])", "def d_test():\n\tlocal(\"git push origin --all\")\n\twith cd(TEST_ROOT):\n\t\trun(\"git pull\")", "def d_ploy():\n\tlocal(\"git push origin --all\")\n\twith cd(LIVE_ROOT):\n\t\trun(\"git pull\")", "def call_git_pull():\n print(\"This will pull the rem...
[ "0.73450637", "0.71330017", "0.6839212", "0.67483294", "0.6688655", "0.6645566", "0.66057", "0.6592987", "0.65404755", "0.64778686", "0.64207804", "0.6351524", "0.6296596", "0.62679905", "0.62662596", "0.6240535", "0.6227741", "0.6202468", "0.61747855", "0.61554646", "0.61433...
0.64939606
9
empty static_root and collects the static files
def deploy_static(): from fabdeploy.django import collectstatic as django_collectstatic # run("rm -rf %(root_path)s%(project_name)s/static/*" % env) # call again git_add_commit_pull django_collectstatic()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy_static_resources(self):\n if not hasattr(settings, 'STATIC_ROOT'):\n raise MissingStaticRoot()\n destination = os.path.join(STORAGE_PATH, 'static')\n if os.path.exists(destination):\n shutil.rmtree(destination)\n shutil.copytree(settings.STATIC_ROOT, desti...
[ "0.7267547", "0.7195497", "0.7118182", "0.70244145", "0.68203026", "0.670332", "0.6697972", "0.66582984", "0.6642347", "0.65253", "0.6453902", "0.63838065", "0.6336708", "0.6258352", "0.61938727", "0.6126046", "0.6057303", "0.60528827", "0.60449046", "0.601442", "0.60042685",...
0.6938294
4
deploy the application to the server
def run(syncdb=False): from fabdeploy.django import migrate as django_migrate, syncdb as django_syncdb import time env.release = time.strftime('%Y%m%d%H%M%S') prepare_deploy() # pull, test, push git.remote_pull() app.install_requirements() django_migrate(syncdb) # syncdb in case is first tim...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deploy():", "def deploy():\n upload_static()\n compile_code()\n upload_code()\n upload_supervisor()\n start_server()", "def deploy():\n require('hosts', provided_by=[prod])\n require('whole_path', provided_by=[prod])\n require('code_root')\n upload_tar_from_git(env.whole_path)\n ...
[ "0.8416337", "0.7875095", "0.784592", "0.78096145", "0.7726005", "0.76824063", "0.7591086", "0.75828916", "0.7564499", "0.7564499", "0.7564499", "0.7369355", "0.7331053", "0.7323487", "0.73168474", "0.7304545", "0.7243055", "0.72401834", "0.7240129", "0.7224798", "0.7142134",...
0.6559371
65
fetch the data and labels
def __init__(self, path_image, path_imagefile, path_bndboxfile, transform): # -------------------- DATA ARGUMENT self.shape = 446 self.hue = 0.1 self.saturation = 1.5 self.exposure = 1.5 self.imagelist = [] self.labellist = [] self.transform = tran...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetch_data(self):", "def get_labels():\n return if_found(dao.get_labels())", "def _fetch_data(self):\n pass", "def _fetch_labels(self, list_fams, no_imgs, num_samples) -> Tuple[np.ndarray, List]:\n y_train = np.zeros(num_samples)\n pos = 0\n label = 0\n indexes = []\...
[ "0.7082837", "0.68395245", "0.6802044", "0.6746683", "0.67372286", "0.67104995", "0.6593471", "0.6433335", "0.63847095", "0.63727075", "0.6362536", "0.6323776", "0.629321", "0.6279828", "0.6273046", "0.6208926", "0.6184165", "0.6184165", "0.6184165", "0.6152687", "0.61433417"...
0.0
-1
Create a custom function that maps to one of the CUDA Math library functions. The function name must match one of the already existing names in the CUDA
def function(name: str, expr: vecpy.base.Expr, *args) -> vecpy.base.Function: return vecpy.base.Function(name, expr, *args)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def map_string2func(funcname, clss, compute_capability):\n if \"_get_\" + funcname not in globals():\n raise AttributeError(\"kernel type '\" + funcname + \"' not understood\")\n return globals()[\"_get_\" + funcname](clss, compute_capability)", "def function_application(func):\n if func not in N...
[ "0.68791264", "0.63282084", "0.6155065", "0.6080748", "0.6060965", "0.60382944", "0.59281456", "0.58298725", "0.58285344", "0.57828945", "0.57409996", "0.57352984", "0.57184166", "0.56775355", "0.5672887", "0.5661893", "0.55811965", "0.5579806", "0.557754", "0.55657697", "0.5...
0.5445002
29
Returns a list of restaurants whose name, description and/or tags match the query_string and are closer than 3km from the paramter latitude and longitude coordinates.
def restaurant_search(): # Get query string parameters query_string = request.args.get('q') latitude = request.args.get('lat') longitude = request.args.get('lon') # Check that request parameters are valid, if not send 400 response if query_string == None or len(query_string) < 1: respo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def restaurants_search() -> str:\n args = request.args\n if 'q' in args and 'lat' in args and 'lon' in args: # check if correct params are given\n if len(args['q']) > 0 and len(args['lat']) > 0 and len(args['lon']) > 0: # check that\n # params satisfy length requirements\n try:...
[ "0.6773024", "0.66979843", "0.6554955", "0.65408885", "0.6487632", "0.64766216", "0.6475124", "0.6210143", "0.6178921", "0.60852146", "0.608248", "0.60315293", "0.6000485", "0.5993607", "0.58657825", "0.5844165", "0.58390087", "0.5809332", "0.5793267", "0.57707137", "0.576198...
0.6517051
4
Returns True if value can be converted to float, otherwise returns False.\n
def isfloat(value): try: float(value) return True except ValueError: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_floatable(value):\n\n try:\n float(value)\n return True\n except:\n return False", "def isFloat(value): \n try:\n float(value)\n return True\n except ValueError:\n return False", "def is_float(self, value):\n try:\n float(val...
[ "0.8476934", "0.83771354", "0.8343819", "0.8308899", "0.8175327", "0.81586117", "0.8139705", "0.81321037", "0.8056236", "0.8011302", "0.7905029", "0.7842661", "0.76165664", "0.7579738", "0.7570646", "0.7516587", "0.7417768", "0.7385605", "0.7295912", "0.72901154", "0.72365445...
0.82445174
4
return nuber of items in repo
def size(self): return len(self._items)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unmerged_total(self):\n return int(self.git.rev_list('--count', '{}..{}'.format(self.base_branch, self.topic_branch)))", "def test_repositories(self):\n\t\ttot_repos = total_repos(self)\n\t\t#self.assertEqual(tot_repos, \"6052353)", "def n_public_repos(gh, user):\n return getuser(gh, user).public...
[ "0.63817924", "0.6111955", "0.6042396", "0.60301703", "0.59792984", "0.59792984", "0.5954415", "0.58658177", "0.5719205", "0.56176406", "0.5599673", "0.5552937", "0.5523746", "0.5484504", "0.5479842", "0.5449454", "0.5437292", "0.5430239", "0.5408196", "0.5402071", "0.5392688...
0.0
-1
add in repo an object
def adauga(self, item): if item in self._items: raise RepoError("item deja existent!\n") self._items.append(item)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add(obj):", "def add_object(self, obj):\n\t\tself.objects.append(obj)", "def add_object(self, object):\n object.save()", "def add_content_object_to_repo(self, name, co, wired=True):\n name = Name(name).toUri()\n if not wired:\n data = co.wireEncode().toRawStr()\n el...
[ "0.67793566", "0.67431223", "0.67289394", "0.6702126", "0.6696394", "0.66702986", "0.664344", "0.64573383", "0.64354074", "0.6379205", "0.63360125", "0.6306308", "0.63011926", "0.62364924", "0.6183897", "0.6140982", "0.6124869", "0.61231977", "0.6122632", "0.6120433", "0.6049...
0.5787345
47
search in repo an item
def cauta(self, item): if item not in self._items: raise RepoError("item inexistent") for x in self._items: if x == item: return x
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _search_repository(self, query):\n \n # raise repository search dialog\n dlg = RepositoryView(self, self._library, query=query)\n response = dlg.ShowModal()\n articles = dlg.GetArticles()\n dlg.Destroy()\n \n # check response\n if response != wx.ID...
[ "0.6507103", "0.6487686", "0.63771313", "0.635545", "0.63503957", "0.62970537", "0.62911946", "0.6150294", "0.6143739", "0.6120025", "0.6084103", "0.6054245", "0.603377", "0.6031059", "0.602512", "0.601455", "0.6002547", "0.59994215", "0.59819794", "0.59696996", "0.5959124", ...
0.6053503
12
check if object exists in repo
def exista(self, item): if item not in self._items: return False for x in self._items: if x == item: return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exists(self):\n return self._repository is not None", "def exists(self, obj):\n return False", "def objExists(*args, **kwargs)->bool:\n pass", "def git_has_object(project: Project, name: str) -> bool:\n ret = project.git(\"rev-parse\", \"--verify\", name, _ok_code=[0, 128])\n retur...
[ "0.7361505", "0.727437", "0.7086809", "0.705437", "0.6815172", "0.67559314", "0.6645725", "0.6632751", "0.6463651", "0.64450514", "0.64416546", "0.64301205", "0.64293253", "0.6377242", "0.6319144", "0.6310503", "0.6303328", "0.6303328", "0.6284294", "0.627665", "0.6234188", ...
0.0
-1
modify the name of the object with the string
def modifica(self, item, change): item = self.cauta(item) self.delete(item) item.set_nume(change) self.adauga(item)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_object_name(remote, object_id, new_name):\n cmd = mmapi.StoredCommands()\n cmd.AppendSceneCommand_SetObjectName(object_id, new_name)\n remote.runCommand(cmd)", "def new_name(self,new_name):\n self.name = new_name", "def replace(name, newobject):", "def __set_name__(self, cls, name):\n...
[ "0.7426106", "0.7336926", "0.72198415", "0.7127601", "0.7119643", "0.70936084", "0.70936084", "0.7019569", "0.69729173", "0.694107", "0.69359905", "0.68720067", "0.6853922", "0.6847054", "0.68378264", "0.6826936", "0.68108994", "0.67999107", "0.6772332", "0.6772332", "0.67723...
0.0
-1
modify the name of a discipline with the string
def modifica_materie(self, item, change): item = self.cauta(item) self.delete(item) item.set_materie(change) self.adauga(item)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new_name(self,new_name):\n self.name = new_name", "def get_discipline_name(self):\n return self.__discipline_name", "def MotherNaming(s, pref=None):\n l=s.split(\"_\")\n l=[\"%s%s\" % (i[0].upper(),i[1:]) for i in l]\n return (pref or \"\") + \"\".join(l)", "def set_name(self, newn...
[ "0.6241928", "0.6217428", "0.59670246", "0.58978", "0.5894144", "0.58591086", "0.58377343", "0.57294095", "0.57294095", "0.56621903", "0.56435573", "0.5610684", "0.55671847", "0.5564039", "0.55466604", "0.55393904", "0.553432", "0.55148774", "0.5498157", "0.54763716", "0.5444...
0.0
-1
return a list with all the objects
def get_all(self): return self._items[:]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetObjects(self): \r\n return self.model.GetObjects()", "def all(self):\n return (self.__objects)", "def all(self):\n return self.__objects", "def all(self):\n return self.__objects", "def all(self):\n return self.__objects", "def all(self):\n return s...
[ "0.79968905", "0.7928298", "0.7899466", "0.7899466", "0.7899466", "0.7899466", "0.7899466", "0.7899466", "0.78799754", "0.78036886", "0.77928257", "0.7701835", "0.765167", "0.76110023", "0.74869895", "0.7473495", "0.7435969", "0.7390489", "0.738795", "0.73557454", "0.73383856...
0.6596494
74
return a list with items with the same student
def get_all_by_student(self, stud_id): l = [] for item in self._items: if item.get_student() == stud_id: l.append(item) return l[:]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def students(self):\n\t\treturn self.grade_set.all().distinct()", "def find_duplicate(student_list):\r\n place_holder = student_info('null', 'null', '0', '0')\r\n current = place_holder\r\n dupe = []\r\n final = []\r\n for student in student_list:\r\n previous = current\r\n current =...
[ "0.6781505", "0.65362155", "0.6199378", "0.60326993", "0.601739", "0.5969962", "0.5895063", "0.583807", "0.5774767", "0.57600665", "0.5728087", "0.57097805", "0.5650832", "0.56497097", "0.5617477", "0.560614", "0.55885255", "0.55699545", "0.55072105", "0.5501444", "0.5463087"...
0.6604642
1
return a list with items with the same discipline
def get_all_by_discipline(self, disc_id): l = [] for i in self._items: if i.get_id_disciplina() == disc_id: l.append(i) return l[:]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deduped(items):\n \n return list(set(items))", "def Collection_select_cheap(C:list, n: float)->list:\r\n result = []\r\n for rest in C:\r\n if Restaurant_is_cheap(rest, n) == True:\r\n result.append(rest)\r\n return result", "def duplicates(items):\n duplicate_items = se...
[ "0.57249516", "0.559361", "0.54721725", "0.5366635", "0.5349736", "0.53270197", "0.532001", "0.53142184", "0.5301576", "0.5295073", "0.52504534", "0.5219532", "0.5206376", "0.5200724", "0.51740515", "0.5167879", "0.5167069", "0.514371", "0.51328325", "0.51251054", "0.51210004...
0.6530238
0
Master segment function Based on SETTINGS, run corresponding function
def segment(data):
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main(filepath, maskpath):\n analytics.result = {}\n img_mask = nib.load(maskpath).get_fdata()\n print(\"loading\\n\", flush=True)\n # segmentation\n print(\"loading segmentation...\\n\", flush=True)\n seg = nib.load(filepath).get_fdata()\n # post processing\n print(\"applying some post ...
[ "0.570246", "0.56575155", "0.56105673", "0.5582549", "0.5550274", "0.5524165", "0.5475396", "0.54618686", "0.54181546", "0.5416725", "0.54031515", "0.53997654", "0.5375668", "0.5363712", "0.5326585", "0.53262764", "0.5325988", "0.5306261", "0.52622974", "0.52571845", "0.52416...
0.5211432
27
Sliding window algorithm realization Output 'segments' contains start and end indexes for each step Assumption data is contiguous data
def segment_sliding_window(data, winSizeMillisecond=1000, stepSizeMillisecond=100): logger.info("Sliding window with win size %.2f second and step size %.2f second", winSizeMillisecond, stepSizeMillisecond) if stepSizeMillisecond <= 0: raise ValueError("Step size must be larger t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _segment(data, segment_length=200,\n seq_length=None,\n stride=None,\n input_type='trials'):\n x_out = []\n if input_type == 'trials':\n seq_length = 1\n\n if not stride:\n stride = segment_length\n\n for jj, xx in enumerate(data):\n\n n_ch, ...
[ "0.67323786", "0.66023433", "0.6593062", "0.65148705", "0.6402961", "0.6359427", "0.6332763", "0.6283209", "0.6280443", "0.62024176", "0.61759365", "0.6168342", "0.6120425", "0.6099909", "0.6057716", "0.6040668", "0.5987201", "0.5953549", "0.5936035", "0.5916517", "0.5867777"...
0.7024497
0
Create a (spatial) probability distribution with four active cells, such that the expected value is centered on `(x, y)`.
def cross_entropy_four_hot(x: float, y: float, width: int, height: int) -> torch.Tensor: t = torch.zeros(height, width) from_left = (x + 1.0) / 2.0 * (width - 1) from_top = (y + 1.0) / 2.0 * (height - 1) width_idx = math.floor(from_left) height_idx = math.floor(from_top) left_frac = from_left...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prob4():\n#raise NotImplementedError(\"Problem 4 Incomplete\")\n h = lambda x : x[0] < -1 and x[1] > 1\n f = lambda x : stats.multivariate_normal.pdf(x,mean=np.array([0,0]),cov=np.eye(2))\n g = lambda x : stats.multivariate_normal.pdf(x,mean=np.array([-1,1]),cov=np.eye(2))\n X = np.random.multivari...
[ "0.62995535", "0.6053863", "0.6011577", "0.5927498", "0.5884353", "0.578833", "0.5772819", "0.5764375", "0.57246447", "0.571302", "0.56987005", "0.56945825", "0.56622314", "0.5659095", "0.5632271", "0.5623151", "0.5592304", "0.5591458", "0.5576871", "0.5529894", "0.55254793",...
0.0
-1
Convert django model to geojson
def to_geojson(model, contrib_id): feature_collection = [] for record in model.objects.filter(contributer_id=contrib_id): try: properies = { "name": record.name, "address": record.address, "email": record.email, "website": recor...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default(self, o): \n if isinstance(o, GEOSGeometry):\n dictval = json.loads(o.geojson)\n #raise Exception(o.ewkt)\n dictval['__GEOSGeometry__'] = ['__init__', [o.ewkt]] #json class hint; see http://json-rpc.org/wiki/specification\n return dictval\n else...
[ "0.6924277", "0.6681148", "0.6647204", "0.6602624", "0.6577234", "0.6551587", "0.6533658", "0.6529714", "0.64571106", "0.645591", "0.6319082", "0.6317624", "0.62623715", "0.6253182", "0.62173903", "0.6201155", "0.6189135", "0.61708796", "0.6170053", "0.61695904", "0.6141281",...
0.6926797
0
Run tests for apply.
def test_apply(buffer, window, out): buffer = np.array(buffer, dtype=np.float32) windows.apply(buffer, window) assert_almost_equal(buffer, np.array(out))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def runTests(self):\n \n pass", "def _run_ci_test():\n _run_install(False)\n _run_coverage_html(False)\n _run_typecheck_xml(False)\n _run_lint(True)", "def run_tests(self):\n raise NotImplementedError", "def run_tests(self):\n\n self.manifest_path = os.path.join('tests',\n...
[ "0.72071713", "0.6894174", "0.6725332", "0.6708562", "0.67010826", "0.6690568", "0.66734636", "0.6645388", "0.66027665", "0.6576913", "0.64471364", "0.6384366", "0.63726693", "0.6348226", "0.6334608", "0.63228375", "0.6313171", "0.630247", "0.6302341", "0.62591064", "0.625864...
0.0
-1
Run tests for hanning.
def test_hanning(length, window): assert_almost_equal(windows.hanning(length), np.array(window))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def runTests(self):\n \n pass", "def main():\n run_test_all()", "def tests():", "def run_tests(self):\n raise NotImplementedError", "def runtest(self):", "def __main() :\n launchTests()", "def do_test(self):\n\t\tshutit_global.shutit_global_object.yield_to_draw()\n\t\tif not self...
[ "0.69998217", "0.67782", "0.6729991", "0.67242986", "0.6668787", "0.65461665", "0.65364975", "0.6497846", "0.64213234", "0.64198595", "0.6398026", "0.63839835", "0.6382242", "0.63557005", "0.63405514", "0.63068205", "0.6247848", "0.6240262", "0.622832", "0.62153053", "0.61878...
0.0
-1
Run tests for product.
def test_product(window1, window2, out): if window1 is not None: window1 = np.array(window1) if window2 is not None: window2 = np.array(window2) if out is None: assert windows.product(window1, window2) is None else: assert_almost_equal(windows.product(window1, window2), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_product(self):\n self.assertEqual(self.test_product.name, self.test_product_name)\n self.assertEqual(self.test_product.price, self.test_product_price)", "def runtests(projectfolder, product, app_dir):\n\n featuremodel_path = path.join(projectfolder, \"productline\", \"model.xml\")\n ...
[ "0.7426649", "0.7392313", "0.7278057", "0.7218119", "0.71037585", "0.6960336", "0.69112176", "0.6868908", "0.68441224", "0.66730344", "0.6667417", "0.6661973", "0.6645852", "0.663013", "0.66245073", "0.65999675", "0.65693885", "0.6536961", "0.6534648", "0.6513289", "0.6512881...
0.0
-1
Call the defined shared _lstm_model_fn.
def _model_fn(features, labels, mode, config): return _transformer_model_fn( features=features, labels=labels, mode=mode, head=head_lib._regression_head_with_mean_squared_error_loss( label_dimension=label_dimension, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def model_fn(model_dir):\n print(\"Loading model.\")\n\n # First, load the parameters used to create the model.\n model_info = {}\n model_info_path = os.path.join(model_dir, 'model_info.pth')\n with open(model_info_path, 'rb') as f:\n model_info = torch.load(f)\n\n print(\"model_info: {}\"...
[ "0.6602407", "0.65134597", "0.64115566", "0.6322604", "0.6283986", "0.6278085", "0.62462604", "0.61601216", "0.61334085", "0.6110869", "0.61028546", "0.6077902", "0.6000676", "0.5919205", "0.5910395", "0.5875338", "0.5792687", "0.57925415", "0.5742876", "0.570209", "0.5696264...
0.5779005
18
This constructor takes care of the fact that we want different
def dropout_constr(options, use_noise, trng, sampling): # if dropout is off, or we don't need it because we're sampling, multiply by 1 # this is also why we make all arguments optional def get_layer(shape=None, dropout_probability=0, num=1): if num > 1: return theano.shared(numpy.array(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n raise NotImplementedError", "def __init__(self):\n raise NotImplementedError", "def __init__(self):\n raise NotImplementedError", "def __init__(self):\n raise NotImplementedError", "def __init__(self) -> None:\n # Values are already set on __new__.\n...
[ "0.6959799", "0.6959799", "0.6959799", "0.6959799", "0.6956357", "0.6907315", "0.68319875", "0.6811867", "0.6758628", "0.6758628", "0.66888803", "0.6647492", "0.66381866", "0.6590327", "0.6586049", "0.6569259", "0.65685713", "0.65660447", "0.65438515", "0.65360767", "0.652982...
0.0
-1
Normalize the columns of a matrix
def weight_norm(W, s): _eps = numpy_floatX(1e-5) W_norms = tensor.sqrt((W * W).sum(axis=0, keepdims=True) + _eps) W_norms_s = W_norms * s # do this first to ensure proper broadcasting return W / W_norms_s
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize_columns(mat):\n norm = np.sqrt((mat**2).sum(0))\n return mat / norm", "def normalize_col(input_matrix):\n\n col_sums = np.nan_to_num(input_matrix).sum(axis=0, keepdims=True)\n\n #new_matrix = input_matrix / col_sums if np.isscalar(col_sums) else input_matrix / col_sums[np.newax...
[ "0.8688684", "0.8052972", "0.7980672", "0.7900643", "0.78383934", "0.75666314", "0.73540807", "0.731092", "0.72516435", "0.7244838", "0.722297", "0.71880865", "0.71880865", "0.7166997", "0.71601856", "0.71208394", "0.70959723", "0.70877707", "0.7086986", "0.70312995", "0.7003...
0.0
-1
sudoku is a pointer to the parent sudoku object
def __init__(self, idx, sudoku, is_given=False, cands=None, notify=False): self.sudoku = sudoku self.idx = idx self.is_given = is_given self.row = idx // 9 + 1 self.col = idx % 9 + 1 self.box = ((idx % 9) // 3) + 3 * (idx // 9 // 3) + 1 #used for debugging purpo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solve(sudoku):\n\n # Go through all numbers in the Sudoku.\n for row in range(9):\n for column in range(9):\n # Try all possible combinations of numbers recursively and look for\n # one that is a correct solution.\n if sudoku[row][column] is None:\n ...
[ "0.6209334", "0.6017485", "0.58750165", "0.5834461", "0.57241505", "0.5716464", "0.57155645", "0.5701739", "0.5681319", "0.56612116", "0.5656719", "0.562426", "0.5623384", "0.5614225", "0.55433786", "0.55363554", "0.5503499", "0.55015236", "0.54771733", "0.5473852", "0.542645...
0.5963765
2
returns the candidates as a simple string
def cand_str(self): return "".join([str(x) for x in self.cands])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_candidates(self):\n return u', '.join([c.identifier for c in self.candidates.all()])", "def get_all_candidates(self) -> list:", "def view_candidates(self):\n items = ['id', self.filter, 'half_light', 'separation', 'P_c']\n for add_on in ['P_O', 'P_Ox']:\n if add_on in se...
[ "0.7313972", "0.634011", "0.6055387", "0.59636027", "0.5877696", "0.585959", "0.5841727", "0.5791971", "0.5778096", "0.5705545", "0.5683101", "0.56824327", "0.5674035", "0.5649382", "0.56227845", "0.5609205", "0.5592801", "0.5583754", "0.5580004", "0.55474", "0.55360365", "...
0.6516208
1
returns all the cells in the same row, without the current cell inclusive determines if the cell itself is included
def iter_row(self, inclusive=False, **kwargs): ret = self.sudoku.row(self.row, **kwargs) if not inclusive: ret -= self return ret
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_cells(self, row, col):\r\n surrounding_cells = self.get_surrounding_cells(row, col)\r\n closed_cells = self.filter_cells(surrounding_cells, '?')\r\n mine_cells = self.filter_cells(surrounding_cells, 'x')\r\n numbered_cells = list(set(surrounding_cells).difference(closed_cells))\...
[ "0.71352303", "0.6480721", "0.6268291", "0.6262645", "0.62549186", "0.6136679", "0.61350024", "0.61134684", "0.6101507", "0.60813344", "0.6079841", "0.6076919", "0.6074675", "0.60700923", "0.60681236", "0.60458994", "0.6036992", "0.60198283", "0.5929248", "0.5918401", "0.5892...
0.589297
20
returns all the cells in the same col, without the current cell inclusive determines if the cell itself is included
def iter_col(self, inclusive=False, **kwargs): ret = self.sudoku.col(self.col, **kwargs) if not inclusive: ret -= self return ret
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_cells(self, row, col):\r\n surrounding_cells = self.get_surrounding_cells(row, col)\r\n closed_cells = self.filter_cells(surrounding_cells, '?')\r\n mine_cells = self.filter_cells(surrounding_cells, 'x')\r\n numbered_cells = list(set(surrounding_cells).difference(closed_cells))\...
[ "0.7064214", "0.6296526", "0.6143211", "0.61400205", "0.5967883", "0.5850532", "0.58066463", "0.5805396", "0.57250965", "0.5717699", "0.57054645", "0.5698774", "0.568885", "0.5681665", "0.56682837", "0.5637537", "0.5636615", "0.5634904", "0.5617153", "0.56157374", "0.55999815...
0.58380413
6
returns all the cells in the same box, without the current cell inclusive determines if the cell itself is included
def iter_box(self, inclusive=False, **kwargs): ret = self.sudoku.box(self.box, **kwargs) if not inclusive: ret -= self return ret
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_cells(self, row, col):\r\n surrounding_cells = self.get_surrounding_cells(row, col)\r\n closed_cells = self.filter_cells(surrounding_cells, '?')\r\n mine_cells = self.filter_cells(surrounding_cells, 'x')\r\n numbered_cells = list(set(surrounding_cells).difference(closed_cells))\...
[ "0.6804994", "0.6405771", "0.6399067", "0.63050866", "0.6237328", "0.6216472", "0.6136879", "0.61026025", "0.60741955", "0.601029", "0.59894836", "0.5928568", "0.5905775", "0.5898801", "0.5895932", "0.58847314", "0.5870224", "0.5865845", "0.58648765", "0.584756", "0.5796867",...
0.6200451
6
returns all the cells in the same row or col, without the current cell inclusive determines if the cell itself is included
def iter_rowcol(self, inclusive=False, **kwargs): ret = self.sudoku.row(self.row, **kwargs) + \ self.sudoku.col(self.col, **kwargs) if not inclusive: ret -= self return ret
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_cells(self, row, col):\r\n surrounding_cells = self.get_surrounding_cells(row, col)\r\n closed_cells = self.filter_cells(surrounding_cells, '?')\r\n mine_cells = self.filter_cells(surrounding_cells, 'x')\r\n numbered_cells = list(set(surrounding_cells).difference(closed_cells))\...
[ "0.7665889", "0.6758721", "0.6708378", "0.6522236", "0.6457412", "0.63777393", "0.6367174", "0.635705", "0.63372207", "0.6306044", "0.62925977", "0.6252321", "0.62497276", "0.6222248", "0.6141052", "0.61358106", "0.6101616", "0.6090473", "0.6044252", "0.6036179", "0.6006793",...
0.5831525
37
returns all the cells in the same row, col or box, without the current cell inclusive determines if the cell itself is included
def iter_related(self, inclusive=False, **kwargs): ret = self.sudoku.row(self.row, **kwargs) + \ self.sudoku.col(self.col, **kwargs) + \ self.sudoku.box(self.box, **kwargs) if not inclusive: ret -= self return ret
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_cells(self, row, col):\r\n surrounding_cells = self.get_surrounding_cells(row, col)\r\n closed_cells = self.filter_cells(surrounding_cells, '?')\r\n mine_cells = self.filter_cells(surrounding_cells, 'x')\r\n numbered_cells = list(set(surrounding_cells).difference(closed_cells))\...
[ "0.7512581", "0.67403513", "0.67195696", "0.65978575", "0.6567471", "0.6452255", "0.6296703", "0.628843", "0.6267234", "0.6255064", "0.622117", "0.62134117", "0.620172", "0.6194931", "0.6168033", "0.6118354", "0.6111063", "0.6110185", "0.60929686", "0.6083315", "0.60692847", ...
0.63505846
6
Creates the panel and passes it as a return value
def UOWrapperPanel(parent, interpParent, uOpName, pfd): #Empty panel... Overload this function for each specific UO return FlashMainPanel(parent, interpParent, uOpName, pfd)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_panel(self):\n return\n # return Panel(self)", "def create(self):\n self.panel = pg.rect.Rect(self.position, self.dimensions)", "def create_main_panel(self):\n self.panel = wx.Panel(self)\n\n self.init_plot()\n self.canvas = FigCanvas(self.panel, -1, self.fi...
[ "0.8496374", "0.74238116", "0.7307615", "0.7078812", "0.69499403", "0.68423665", "0.68091047", "0.66479605", "0.663662", "0.6614185", "0.65787846", "0.6572077", "0.65553594", "0.65231746", "0.6521527", "0.6508235", "0.64754564", "0.6388567", "0.6313709", "0.6289764", "0.62435...
0.57041156
69
Disables provided function from one or multiple channels which are specified. A function can be any of the commands, plugins or galaxies which are allowed to be disabled.
async def disable(self, ctx, function: typing.Union[CommandConverter, PluginConverter, GalaxyConverter], *channels: discord.TextChannel): channels = channels or (ctx.channel, ) await ctx.guild_profile.permissions.disable_function(function, channels) # noinspection PyUnresol...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disable(func):\n return func", "async def disable_channel(self, ctx, *channels: discord.TextChannel):\n channels = channels or (ctx.channel, )\n await ctx.guild_profile.permissions.disable_channels(channels)\n await ctx.send_line(f\"{ctx.emotes.web_emotion.galka} Bot commands and m...
[ "0.7478053", "0.6590839", "0.63677406", "0.61984825", "0.5935865", "0.5847337", "0.57535195", "0.5705342", "0.57022613", "0.5698396", "0.56209135", "0.5606587", "0.5573692", "0.55229694", "0.55216694", "0.5494032", "0.54801023", "0.5455171", "0.5423171", "0.5408966", "0.53884...
0.8369485
0
Enables provided function in all of the specified channels. A function can be any of the commands, plugins or galaxies.
async def enable(self, ctx, function: typing.Union[CommandConverter, PluginConverter, GalaxyConverter], *channels: discord.TextChannel): channels = channels or (ctx.channel, ) await ctx.guild_profile.permissions.enable_function(function, channels) # noinspection PyUnresolved...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def enable_channel(self, ctx, *channels: discord.TextChannel):\n channels = channels or (ctx.channel, )\n await ctx.guild_profile.permissions.enable_channels(channels)\n await ctx.send_line(f\"{ctx.emotes.web_emotion.galka} Bot commands and messages has been enabled in specified chann...
[ "0.6668181", "0.6548446", "0.6338657", "0.5989139", "0.574073", "0.56826746", "0.56814885", "0.55161613", "0.54051787", "0.5351172", "0.5333117", "0.5286296", "0.52859515", "0.52859515", "0.52859515", "0.52859515", "0.52859515", "0.52859515", "0.52859515", "0.52859515", "0.52...
0.78735584
0
Disables bot commands and most of its automatic messages in current or provided channels.
async def disable_channel(self, ctx, *channels: discord.TextChannel): channels = channels or (ctx.channel, ) await ctx.guild_profile.permissions.disable_channels(channels) await ctx.send_line(f"{ctx.emotes.web_emotion.galka} Bot commands and messages has been disabled in specified channels.")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def blacklist_commands(self, ctx):\r\n await self.amethyst.send_command_help(ctx)", "async def disable(self, ctx, function: typing.Union[CommandConverter, PluginConverter, GalaxyConverter],\n *channels: discord.TextChannel):\n channels = channels or (ctx.channel, )\n ...
[ "0.7108723", "0.7096003", "0.69496554", "0.67883027", "0.6707562", "0.6565387", "0.6368427", "0.63573396", "0.6339441", "0.6334304", "0.63192993", "0.62177265", "0.61687315", "0.61560297", "0.6059689", "0.6038491", "0.5994542", "0.59823614", "0.5947161", "0.59250474", "0.5920...
0.78277546
0
Enables back bot commands and its automatic messages in current or provided channels if it was disabled previously.
async def enable_channel(self, ctx, *channels: discord.TextChannel): channels = channels or (ctx.channel, ) await ctx.guild_profile.permissions.enable_channels(channels) await ctx.send_line(f"{ctx.emotes.web_emotion.galka} Bot commands and messages has been enabled in specified channels.")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def func(self):\n from evennia.comms.models import ChannelDB\n\n caller = self.caller\n if self.args not in (\"on\", \"off\"):\n return super(CmdArxAllCom, self).func()\n if self.args == \"on\":\n # get names of all channels available to listen to\n # an...
[ "0.67751026", "0.6625209", "0.65478224", "0.6417928", "0.6308489", "0.610151", "0.60823476", "0.5960483", "0.5899421", "0.5865763", "0.5858996", "0.58107245", "0.580726", "0.5788629", "0.56712127", "0.56574357", "0.5640026", "0.5632828", "0.56324667", "0.5491965", "0.5487777"...
0.73707277
0
JSON resolver plugin that loads the schema endpoint. Injected into InvenioRecords JSON resolver.
def jsonresolver_loader(url_map): url_map.add(Rule( "/api/taxonomies/<string:code>/<path:slug>", endpoint=get_taxonomy_term, host=current_app.config.get('SERVER_NAME') ))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _load_schema(self, json_schema):\n # use jsonrefs to resolve all $refs in json\n data = jsonref.loads(json.dumps(json_schema))\n return self.__initialise_template(data)", "def resolver():\n if RESOLVER:\n return RESOLVER\n path = str(pathlib.Path(__file__).parents[1].joinpat...
[ "0.63883114", "0.58803993", "0.5456595", "0.54404473", "0.5353926", "0.53508955", "0.5329297", "0.53031135", "0.5302368", "0.52422416", "0.5230475", "0.51963526", "0.51711226", "0.51576716", "0.51557875", "0.5149049", "0.5118869", "0.51106626", "0.5100498", "0.508437", "0.507...
0.5573852
2
Name scope. Must be defined by implementations.
def name_scope(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scope(self, name):\r\n raise NotImplementedError", "def _set_name_scope(self):\n if self.name is None:\n self._name_scope = self.__class__.__name__\n elif self.name == '<lambda>':\n self._name_scope = 'lambda'\n else:\n # E.g. '_my_loss' => 'my_loss'\n self._name_scope = self....
[ "0.83334064", "0.78577036", "0.7441628", "0.7270988", "0.72071725", "0.71555185", "0.7115489", "0.7110687", "0.71026707", "0.7065051", "0.6968165", "0.6964567", "0.69457537", "0.69046456", "0.6899518", "0.6899518", "0.6892065", "0.6835145", "0.6835145", "0.6819266", "0.681926...
0.8675015
0
Whether to dynamically check the number of anchors generated. Can be overridden by implementations that would like to disable this behavior.
def check_num_anchors(self): return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def num_anchors_per_location(self):\n pass", "def adjust_anchors(self):\n pass", "def is_anchor_valid(self):\n return self.properties.get('IsAnchorValid', None)", "def _assert_correct_number_of_anchors(self, anchors_list,\n feature_map_shape_list):\n ...
[ "0.68195313", "0.6357228", "0.6135154", "0.5779674", "0.5483983", "0.54224265", "0.5373215", "0.5297422", "0.5296277", "0.5272198", "0.52359825", "0.5194844", "0.51695627", "0.51695627", "0.51695627", "0.51695627", "0.5161574", "0.51068735", "0.51042", "0.5082342", "0.507974"...
0.77952874
0
Returns the number of anchors per spatial location.
def num_anchors_per_location(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def num_anchors_per_localization(self):\n num_rot = len(self._rotations)\n num_size = np.array(self._sizes).reshape([-1, 3]).shape[0]\n return num_rot * num_size", "def num_locations(self):\n return len(self.locations)", "def get_location_count(self):\n return len(self.matrix...
[ "0.749816", "0.6937425", "0.66813695", "0.6656154", "0.6582445", "0.6582445", "0.6582445", "0.6580193", "0.65188473", "0.65087336", "0.6447474", "0.63943326", "0.6365181", "0.6354651", "0.6345681", "0.6322735", "0.6313625", "0.6276137", "0.62072563", "0.6178259", "0.61153775"...
0.8555305
0
Generates a collection of bounding boxes to be used as anchors.
def generate(self, feature_map_shape_list, **params): if self.check_num_anchors and ( len(feature_map_shape_list) != len(self.num_anchors_per_location())): raise ValueError('Number of feature maps is expected to equal the length ' 'of `num_anchors_per_location`.') with tf.na...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decode_boxes(raw_boxes, anchors):\n boxes = np.zeros_like(raw_boxes)\n\n x_center = raw_boxes[..., 0] / x_scale * anchors[:, 2] + anchors[:, 0]\n y_center = raw_boxes[..., 1] / y_scale * anchors[:, 3] + anchors[:, 1]\n\n w = raw_boxes[..., 2] / w_scale * anchors[:, 2]\n h = raw_boxes[..., 3] / h...
[ "0.6876775", "0.6868104", "0.6695623", "0.6521236", "0.64991575", "0.6486309", "0.6483232", "0.6424955", "0.6403451", "0.6394041", "0.63770133", "0.6352162", "0.63495255", "0.63414896", "0.6316883", "0.63068944", "0.62946934", "0.62793225", "0.62689435", "0.62679905", "0.6248...
0.0
-1