query
stringlengths
9
9.05k
document
stringlengths
10
222k
metadata
dict
negatives
listlengths
30
30
negative_scores
listlengths
30
30
document_score
stringlengths
4
10
document_rank
stringclasses
2 values
Register basic http handler for ``path``. Returns decorator that registers handler ``path``. Original function is
def handler( self, path: str, *, prefix: bool = False, raw_request: bool = False, json_response: bool = False, regex: bool = False, ) -> classes.GenericRequestDecorator: if raw_request: warnings.warn( 'raw_request=True is d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def route(self, path: str, **args: t.Any) -> t.Callable:\n def decorator(f: t.Callable) -> None:\n RouteMap.add_route(Route(path, f, args.get('methods', ['GET'])))\n return decorator", "def route(self, path, **params):\n\n def decorate(func):\n \"\"\"\n A fun...
[ "0.70389605", "0.6534678", "0.6408403", "0.63335747", "0.61402905", "0.6068795", "0.6028713", "0.59991825", "0.5991726", "0.583295", "0.58132607", "0.57764244", "0.5770693", "0.57121223", "0.5699575", "0.5677943", "0.5642269", "0.55968165", "0.5511001", "0.55000204", "0.54496...
0.6610586
1
Register json http handler for ``path``. Returns decorator that registers handler ``path``. Original function is
def json_handler( self, path: str, *, prefix: bool = False, raw_request: bool = False, regex: bool = False, ) -> classes.JsonRequestDecorator: if raw_request: warnings.warn( 'raw_request=True is deprecated, ' 'use ai...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handler(\n self,\n path: str,\n *,\n prefix: bool = False,\n raw_request: bool = False,\n json_response: bool = False,\n regex: bool = False,\n ) -> classes.GenericRequestDecorator:\n\n if raw_request:\n warnings.warn(\n 'raw_...
[ "0.635753", "0.62774855", "0.62112063", "0.5870397", "0.58667946", "0.5824875", "0.57517153", "0.56219816", "0.559925", "0.5537551", "0.5514887", "0.5482105", "0.53990465", "0.53843427", "0.5350179", "0.53452075", "0.5301597", "0.5294478", "0.5262936", "0.5238661", "0.5234605...
0.7319544
0
Adds this object into RPCObjectsRegistry.
def register(self): RPCObjectsRegistry.add(self)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register_object(self, obj):\n self.modules.append(obj)", "def add(self, obj):\n raise NotImplementedError", "def add_object(self, obj):\n\t\tself.objects.append(obj)", "def register_game_object(self, game_object):\n game_object.game_engine = self\n self.game_objects.append(gam...
[ "0.6500335", "0.6298396", "0.6176747", "0.5985746", "0.59362805", "0.5898682", "0.589083", "0.5882165", "0.5882165", "0.5855296", "0.58454084", "0.5833654", "0.58285195", "0.57802975", "0.57693374", "0.5759779", "0.5755791", "0.5746198", "0.57284", "0.5719672", "0.5718099", ...
0.8551187
0
Translates from torrent fields names in terms of RPC to field names in term of torrt. Updates accordingly a given torrent_info inplace.
def normalize_field_names(cls, torrent_info: dict): for old_name, new_name in cls.torrent_fields_map.items(): if old_name in torrent_info: torrent_info[new_name] = torrent_info[old_name]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def translate_to_rpc(self, rpcGpsInfo):\n\n \n \n \n rpcGpsInfo.num_satellites = self.num_satellites\n \n \n \n \n \n self.fix_type.translate_to_rpc(rpcGpsInfo.fix_type)", "def parse(self, response):\n\n soup = self.get_soup...
[ "0.5490789", "0.48936307", "0.4878743", "0.48644245", "0.48522484", "0.47663695", "0.4763732", "0.47174785", "0.46556622", "0.46541375", "0.46373942", "0.4631039", "0.46163505", "0.46141046", "0.45888224", "0.4587626", "0.45875117", "0.45628116", "0.44955462", "0.4485022", "0...
0.7291361
0
Adds torrent to torrent client using RPC.
def method_add_torrent( self, torrent: TorrentData, download_to: str = None, params: dict = None) -> Any: # pragma: nocover raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_url(self, torrent_url, **kwargs):\n torrent_file = None\n if os.path.exists(torrent_url):\n torrent_file = open(torrent_url, 'r')\n else:\n try:\n torrent_file = urllib2.urlopen(torrent_url)\n except:\n torrent_file = None\...
[ "0.635147", "0.63492984", "0.62975305", "0.6278799", "0.605318", "0.59510833", "0.58699375", "0.57017046", "0.56679016", "0.56444883", "0.55343133", "0.5360891", "0.5229143", "0.5220499", "0.51626086", "0.5075035", "0.50575095", "0.50342584", "0.5007457", "0.49540228", "0.493...
0.726202
0
Given a sequence [A, B, C] of size n, creates a new sequence of size n 1 where each element is the pair of the element paired up with next item. [(A, B), (B, C)].
def make_pairs(sequence): length = len(sequence) return [ (sequence[i], sequence[i + 1]) for i in range(length - 1) ]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pairwise(s):\n return [(s[i - 1], s[i]) for i in range(1, len(s))]", "def pairs(lst):\r\n\tfor i in range(1, len(lst), 2):\r\n\t\tyield lst[i-1], lst[i]", "def pairwise(lst):\r\n if not lst: return\r\n\r\n for i in range(len(lst)-1):\r\n yield lst[i], lst[i+1]\r\n yield lst[-1], None", ...
[ "0.6647065", "0.6605497", "0.6511508", "0.6460928", "0.6441834", "0.63978654", "0.63488936", "0.63446945", "0.6314862", "0.62877", "0.62877", "0.62877", "0.62877", "0.6272627", "0.6254846", "0.6254846", "0.6252398", "0.6245274", "0.6228544", "0.6206464", "0.62000936", "0.61...
0.742209
0
Calls the other functions in this module to demo EXCEPTIONS.
def main(): cause_a_bunch_of_exceptions_to_happen()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sample_exception_function(self, a, b):\r\n raise Exception(\"An error has occurred.\")", "def exception(self):\n raise Exception(\"Exception test\")", "def exception(self, *args, **kwargs):", "def unexpectedException(self):", "def _error_handling(self,e,func):\n print(self.type, \"...
[ "0.69869906", "0.69335115", "0.6914864", "0.68889344", "0.6693079", "0.6592993", "0.6496618", "0.6475176", "0.6412602", "0.6369952", "0.631923", "0.6302522", "0.62638557", "0.624012", "0.62393117", "0.6237558", "0.6185627", "0.6180185", "0.6179123", "0.61729246", "0.6162453",...
0.7207709
0
Generating a CScorrected sgRNA library
def generate_CS_corr_lib(CS_FS_file, cutoff, prefix): f1 = CS_FS_file # File containing sgRNA ID, gene name, CS & FS sgRNA = []; gene = []; CS = []; FS = [] # Lists for storing sgRNA ID, gene name, CS & FS of sgRNA with open(f1,'r') as f: reader = csv.reader(f, delimiter = '\t') for row...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n\n args = get_args()\n seq = args.seq.upper()\n codon_to_aa = {\n 'AAA': 'K',\n 'AAC': 'N',\n 'AAG': 'K',\n 'AAU': 'N',\n 'ACA': 'T',\n 'ACC': 'T',\n 'ACG': 'T',\n 'ACU': 'T',\n 'AGA': 'R',\n 'AGC': 'S',\n 'AGG': 'R'...
[ "0.5914763", "0.5844911", "0.5771143", "0.5732164", "0.5673758", "0.559946", "0.5598976", "0.5588416", "0.54602283", "0.54459363", "0.5418552", "0.54178566", "0.5411538", "0.54027534", "0.53996927", "0.53923035", "0.5389671", "0.5376762", "0.5376288", "0.53674847", "0.5367364...
0.636523
0
return the dentist list which belong to the patient's geolocation range
def search_geoloc_range(request): distance = float(request.POST['distance']) latlng = (request.POST['latlng']).replace("(",'').replace(")",'').split(', ') latitude = float(latlng[0]) longitude = float(latlng[1]) print distance print latitude print longitude # count range of nowa latln...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_locations(self):", "def get_location_list(self) -> DBRecList:\n raise NotImplementedError('not implemented')", "def get_locations_by_ids(self, id_list):", "def get_all_locations():\n rs = run_query('''select * from zlrz_office_location''')\n return [] if rs is None else list(map(lamb...
[ "0.6298353", "0.6181128", "0.60087264", "0.58675116", "0.5854363", "0.5822824", "0.5809094", "0.5726278", "0.5707428", "0.56973445", "0.5651478", "0.5620393", "0.56060654", "0.5582987", "0.5575221", "0.55734974", "0.55728966", "0.55693656", "0.5540762", "0.55345756", "0.55184...
0.63256073
0
Convert network prediction into a quantile prediction.
def to_quantiles(self, y_pred: torch.Tensor) -> torch.Tensor: if y_pred.ndim == 2: y_pred = y_pred.unsqueeze(-1) return y_pred
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_quantiles(self, y_pred: torch.Tensor) -> torch.Tensor:\n return self.metrics[0].to_quantiles(y_pred)", "def to_prediction(self, y_pred: torch.Tensor) -> torch.Tensor:\n if y_pred.ndim == 3:\n if self.quantiles is None:\n idx = y_pred.size(-1) // 2\n else:...
[ "0.69405204", "0.66854614", "0.63962317", "0.6220067", "0.6220067", "0.6220067", "0.62083036", "0.61750406", "0.6122583", "0.60333264", "0.60130334", "0.59850204", "0.5856626", "0.5762192", "0.57340574", "0.56476927", "0.5630361", "0.5611544", "0.5575561", "0.55525225", "0.55...
0.69842494
0
Convert network prediction into a point prediction. Will use first metric in ``metrics`` attribute to calculate result.
def to_prediction(self, y_pred: torch.Tensor) -> torch.Tensor: return self.metrics[0].to_prediction(y_pred)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def predict(self, predPoints=None):", "def predict(self, src):\n\n src = torch.as_tensor(src).float()\n\n self.eval()\n\n return self.forward(src)", "def predict(self, data):\n return self.result.predict(data)", "def make_prediction(x_train, y_train, x_test, model):\n model.fit...
[ "0.62139356", "0.592735", "0.5917442", "0.58713216", "0.5846584", "0.58464545", "0.58458954", "0.58442515", "0.58321273", "0.5825166", "0.581363", "0.5793487", "0.57819176", "0.57676953", "0.5754333", "0.57541", "0.5729127", "0.5722584", "0.5722584", "0.5709793", "0.5709147",...
0.65825105
0
Convert network prediction into a quantile prediction. Will use first metric in ``metrics`` attribute to calculate result.
def to_quantiles(self, y_pred: torch.Tensor) -> torch.Tensor: return self.metrics[0].to_quantiles(y_pred)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_quantiles(self, y_pred: torch.Tensor) -> torch.Tensor:\n if y_pred.ndim == 2:\n y_pred = y_pred.unsqueeze(-1)\n return y_pred", "def _predict_quantiles(self, fh, X, alpha, legacy_interface=False):\n # X is ignored\n y_pred = self.forecaster_.predict(fh=fh, X=None)\n ...
[ "0.64407766", "0.6166652", "0.6106042", "0.6106042", "0.6106042", "0.60184526", "0.6003432", "0.5676995", "0.55563223", "0.5442841", "0.54117227", "0.5411699", "0.53962255", "0.53373915", "0.5334559", "0.5313909", "0.5313356", "0.5305422", "0.53017294", "0.5263997", "0.522271...
0.71505016
0
Perform login with user_name and password. Will also click on submit button
def perform_login(self, user_name, user_pass): if self.api_type == 'real': self.input_user_name(user_name) self.input_user_pass(user_pass) self.click_login_button()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def login(self):\n self.open(base_url + '/login')\n self.type(\"#email\", test_user.email)\n self.type(\"#password\", test_user.password)\n self.click('input[type=\"submit\"]')", "def login(self):\n self.open(self.urls['login'])\n self.select_form(nr=0)\n\n self.f...
[ "0.86815476", "0.82012194", "0.8182604", "0.8160588", "0.8155845", "0.8153802", "0.8081446", "0.79173183", "0.79063976", "0.7905402", "0.7863392", "0.78577876", "0.77982575", "0.77977216", "0.77882123", "0.77759624", "0.77754444", "0.7735458", "0.7724226", "0.7714599", "0.770...
0.8306581
1
Input user name in the username field
def input_user_name(self, user_name): self.locate_element_by_css_selector(USERNAME_SELECTOR).send_keys(user_name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def enter_username(self):", "def enter_username(self, user=TestData.USERS[0]):\n self.username.clear()\n self.username.click()\n self.username.send_keys(user)\n return self.username", "async def name(self, ctx:utils.Context, *, username:str):\n\n if len(username) > 32:\n ...
[ "0.83844244", "0.7793074", "0.77437156", "0.7544351", "0.75347865", "0.746749", "0.74552125", "0.74343115", "0.74343115", "0.7393107", "0.7366523", "0.7348734", "0.7230174", "0.72246015", "0.72246015", "0.72246015", "0.72134644", "0.72134644", "0.72134644", "0.72134644", "0.7...
0.8012587
1
Test the function for filtering a list of dicts by IDs.
def test_filter_by_ids(self, original_list, ids_to_filter, expected_result): result = helpers.filter_by_ids(original_list, ids_to_filter) self.assertEqual(result, expected_result)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_filter_one_key():\n data = [\n {\n \"name\": \"Bill\",\n \"last_name\": \"Gilbert\",\n \"occupation\": \"was here\",\n \"type\": \"person\",\n },\n {\"is_dead\": True, \"kind\": \"parrot\", \"type\": \"bird\", \"name\": \"polly\"},\n ]...
[ "0.63231933", "0.6294664", "0.6083012", "0.6032764", "0.60289437", "0.5982421", "0.5978051", "0.5954492", "0.5890737", "0.58673173", "0.58463347", "0.5829516", "0.58131033", "0.581021", "0.58003426", "0.5800084", "0.5790466", "0.5764041", "0.57584804", "0.57129014", "0.570288...
0.7315509
0
Get the vector representation of a Java file by using the Tokenizer software, available at
def get_vector(filename): command = 'tokenizer -l Java ' + filename process = subprocess.Popen(command.split(), stdout=subprocess.PIPE) try: output, error = process.communicate() output = output.decode('utf8') output = output.replace('\t', ' ').replace('\n', '') return outp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def creating_feature_vector():\r\n\twordlist = []\r\n\tlabel = \"\"\r\n\tfw = open(\"feature_vector.txt\", \"w+\", encoding = \"utf-8\")\r\n\twith open(\"D:\\\\Python_Prac\\\\wordstag\\\\modules\\\\HI_EN_TRAIN.txt\", \"r\", encoding = \"utf-8\") as f:\r\n\t\tfor line in f:\r\n\t\t\twordlist.append(line)\r\n\t\tfor...
[ "0.6416757", "0.62327266", "0.60778207", "0.6074375", "0.59916574", "0.59763277", "0.5959007", "0.58398885", "0.58218986", "0.5782387", "0.5736434", "0.56751204", "0.5662761", "0.56255937", "0.5624131", "0.5610292", "0.5511656", "0.55001396", "0.54787713", "0.5473224", "0.546...
0.81640184
0
Get the vector representation of the Java files for each entry in the test smells datasets
def get_source_vectors(testsmells): for testsmell in testsmells: df = pd.read_csv('data/' + testsmell + '_data.csv') df['Vector'] = '' repnames = df['App'].unique().tolist() for repname in repnames: print('Processing project \'' + repname + '\' for ' + testsmell + '...'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_val_files(self):\n raise NotImplementedError", "def get_files():\n\n img_dir = '../ADE20K_2016_07_26/full_data/images/validation/'\n sem_dir = '../ADE20K_2016_07_26/full_data/annotations/validation/'\n ins_dir = '../ADE20K_2016_07_26/full_data/annotations_instance/validation/'\n\n img_...
[ "0.59823614", "0.58932596", "0.5880856", "0.5873031", "0.58624476", "0.58493125", "0.5828769", "0.5659944", "0.563126", "0.5616376", "0.5614372", "0.5604483", "0.55912095", "0.5590761", "0.5588533", "0.55793095", "0.5575923", "0.5574407", "0.55511385", "0.55041325", "0.550128...
0.672657
0
Convert from Power (ppm^2 muHz^1) to SNR by dividing the signal by the fitted background. If the power in the first bin is zero, change the SNR value in the first bin.
def Power2SNR(self, plt_PS=False, plt_SNR=False): self.bkg = self.estimate_background(log_width=0.1) self.snr = self.ds.power/self.bkg if np.isnan(self.snr[0]) == True: self.snr[0] = 1e-5 if plt_PS: self.plot_ps() if plt_SNR: self.plot_snr()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def snr(signal, noise, impl):\n if np.abs(np.asarray(noise)).sum() != 0:\n ave1 = np.sum(signal) / signal.size\n ave2 = np.sum(noise) / noise.size\n s_power = np.sqrt(np.sum((signal - ave1) * (signal - ave1)))\n n_power = np.sqrt(np.sum((noise - ave2) * (noise - ave2)))\n if i...
[ "0.662258", "0.6343327", "0.61114603", "0.6071063", "0.60139227", "0.59976", "0.5731144", "0.5669829", "0.5667247", "0.56547326", "0.5598908", "0.5598716", "0.55902946", "0.5581395", "0.55365753", "0.5530538", "0.5428642", "0.5395104", "0.53827447", "0.53820187", "0.53773564"...
0.65321547
1
Get the SNR values for the modes by taking the highest value around the range defined by the mode linewidth. Inputs
def mode_snrs(self, v=False): for idx, f in ds.mode_id.iterrows(): # iterate over the fitted modes #smoo = nd.filters.uniform_filter1d(self.snr, int(np.exp(f['w0'])/ds.bin_width)) #smoo = self.Conv(self.snr, np.exp(f['w0'])/ds.bin_width) # smooth the SNR by convolving with Guassian ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_mode_range(self):\n\n if (len(self.n) < 1): return -1,-1,-1,-1\n nmin = np.nanmin(self.modes['n'])\n nmax = np.nanmax(self.modes['n'])\n lmin = np.nanmin(self.modes['l'])\n lmax = np.nanmax(self.modes['l'])\n return nmin, nmax, lmin, lmax", "def find_mode_range(...
[ "0.63691455", "0.5755589", "0.56798846", "0.55553097", "0.5400229", "0.5385353", "0.5368631", "0.53094167", "0.52106154", "0.5195081", "0.5195081", "0.51637816", "0.51129365", "0.5059698", "0.504854", "0.502076", "0.49895513", "0.49888864", "0.49770626", "0.49713275", "0.4961...
0.710035
0
Perform a convolution using a 1D Gaussian Kernel Inputs
def Conv(self, data, stddev): g = Gaussian1DKernel(stddev=stddev) data = convolve(data, g, boundary='extend') return data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gaus_1d(kernel_size):\n gaus_kernel = np.array([1, 1])\n for i in range(kernel_size - 2):\n gaus_kernel = convolve(gaus_kernel, np.array([1, 1]), mode ='full')\n gaus_kernel = gaus_kernel.astype(np.float32)\n gaus_kernel /= np.sum(gaus_kernel)\n return gaus_kernel", "def gaussian_1xDeri...
[ "0.6910197", "0.68678355", "0.68497664", "0.68476313", "0.6798438", "0.6566952", "0.65629685", "0.65509295", "0.6515141", "0.6481429", "0.6476788", "0.64733094", "0.6466025", "0.64222294", "0.6382573", "0.63792497", "0.6373601", "0.6361632", "0.63434386", "0.6335786", "0.6334...
0.71196985
0
Plot the power spectrum around the modes. Label each mode.
def plot5(self): cond = ((self.ds.freq<32.6) & (self.ds.freq>17)) freq = self.ds.freq[cond] power = self.ds.power[cond] # the modes for KIC 9205705 m = pd.read_csv('/home/mxs191/Desktop/MathewSchofield/TRG/GetData/Modes/modes_9205705.csv') m1 = [17.65, 20.6, 23.7, 26.9,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_modes(Nsq, depth, nmodes, wmodes, pmodes, rmodes):\n fig = plt.figure(figsize=(10, 10))\n ax = fig.add_subplot(2, 2, 1)\n # Nsq\n ax.plot(Nsq, -depth)\n ax.ticklabel_format(style='sci', scilimits=(2, 2), axis='x')\n ax.set_ylabel('z')\n ax.set_xlabel('N^2')\n # modes\n mode_sets...
[ "0.718802", "0.6514636", "0.62820745", "0.62354803", "0.6184051", "0.6100533", "0.6069731", "0.59970057", "0.59583354", "0.5903426", "0.5901001", "0.58818585", "0.5878296", "0.58575016", "0.5810429", "0.5794788", "0.57789266", "0.575831", "0.57273126", "0.57169765", "0.569091...
0.6957116
1
get an average dnu value for each star.
def average_dnu(self): freqs = self.star.ds.mode_id['f0'].as_matrix() f1 = freqs[1:] f2 = freqs[:-1] diff = f1-f2 self.dnu = np.mean(diff)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_mean(self):\n self.meanval = np.mean(self.adulist)", "def dishlist_avg_cal(n:list)->float:\r\n all_cal = dishlist_cal(n)\r\n return sum(all_cal)/len(all_cal)", "def dishlist_avg(n:list)->float:\r\n all_prices = dishlist_prices(n)\r\n return sum(all_prices)/len(all_prices)", "def av...
[ "0.66252935", "0.6614639", "0.6564732", "0.6556646", "0.653662", "0.652671", "0.64400977", "0.6382912", "0.63632435", "0.6310402", "0.6305995", "0.6298518", "0.6268439", "0.6214084", "0.6201155", "0.61908823", "0.6187806", "0.6186737", "0.6182179", "0.6181229", "0.6181143", ...
0.7173697
0
Function to compute the specialization of a graph. Base nodes and links between the base nodes remain the same. The remaining nodes are specialized.
def specializeGraph(A,Base): Base = list(Base) # Base must be a list if np.diag(A).sum() != 0: raise ValueError("Some vertices have self edges") n = A.shape[0] #Permute A so that the base nodes come first A = baseFirst(A,Base) bSize = len(Base) #Begin creating the block diagonal ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gen_graph(self):", "def sub_graph_merging(self):", "def _construct_graph(self):\n raise NotImplementedError", "def generate_subgraph(format):\n\n # get business information\n directorypath = genpath+directory\n if os.path.isfile(directorypath):\n \n bizdata = pd.read_csv( directo...
[ "0.58118695", "0.57412744", "0.5507447", "0.5488444", "0.5477021", "0.5434728", "0.54268074", "0.53475577", "0.53230757", "0.5293456", "0.5270499", "0.5263068", "0.5239227", "0.5223926", "0.52161515", "0.5136057", "0.5131078", "0.5119321", "0.5108465", "0.50698274", "0.506134...
0.68801135
0
Creates a new compressed adjacency matrix, smallA, by representing each strongly connected component as a single node (if the component has no nodes in the base set)
def compressGraph(A,bSize): #Find all strongly connected components in the specialization set Spec = A[bSize:,bSize:] specG = nx.DiGraph(Spec.T) SCComp = [np.array(list(c)) for c in nx.strongly_connected_components(specG)] numComp = len(SCComp) #How many strongly connected components N = bSize+n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flagser_simplex_tree(adjacency_matrix):\n N=adjacency_matrix.shape[0]\n row,col=convertCOO(adjacency_matrix,ret_data=False)\n return compute_simplex_tree(N, np.transpose(np.array( (row,col))))", "def makesparse(matrix):\n n = matrix[0].size\n elements = []\n for i in range(n):\n for ...
[ "0.6236915", "0.5880214", "0.58655965", "0.57726514", "0.56644994", "0.56357485", "0.5632688", "0.55827653", "0.54169714", "0.5406192", "0.53971684", "0.53727835", "0.53701967", "0.53622043", "0.5348147", "0.530404", "0.5301147", "0.52787435", "0.5275099", "0.52602816", "0.52...
0.6884272
0
Finds paths between base nodes that travel through the specialization set in the compressed graph.
def findPathsToBase(A,bSize): M,N = A.shape pressedPaths = [] #For every two nodes in the base find all paths between them for b1 in range(bSize): for b2 in range(bSize): #Remove all other base nodes from the graph so that #we only find paths that go through the speciali...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def specializeGraph(A,Base):\n Base = list(Base) # Base must be a list\n if np.diag(A).sum() != 0:\n raise ValueError(\"Some vertices have self edges\")\n\n n = A.shape[0]\n\n\n #Permute A so that the base nodes come first\n A = baseFirst(A,Base)\n bSize = len(Base)\n\n #Begin creating ...
[ "0.61441725", "0.58689064", "0.5725829", "0.5694379", "0.566795", "0.5636597", "0.55859995", "0.5451755", "0.5417815", "0.5414171", "0.5399241", "0.5392572", "0.5387948", "0.53793997", "0.5360395", "0.53601676", "0.5345823", "0.53097486", "0.5294268", "0.5289336", "0.5289292"...
0.6749419
0
Given a path through the connected components of A, find every unique combination of edges between the components that can be followed to complete the given path
def pathCombinations(A,compnts): linkOpt = [] pSize = len(compnts) #Variable to keep track of number of nodes in the branch nNodes = 1 #Find the links between each adjacent component in the path for i in range(pSize-1): rows,cols = np.where(A[compnts[i+1],:][:,compnts[i]]==1) if...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def findPathsToBase(A,bSize):\n M,N = A.shape\n pressedPaths = []\n\n #For every two nodes in the base find all paths between them\n for b1 in range(bSize):\n for b2 in range(bSize):\n #Remove all other base nodes from the graph so that\n #we only find paths that go through...
[ "0.656265", "0.6289668", "0.6166597", "0.6129095", "0.61064494", "0.6010041", "0.5984903", "0.59507126", "0.59493124", "0.59280294", "0.59174395", "0.5891158", "0.5886794", "0.5849333", "0.5846739", "0.5846695", "0.58445317", "0.5812014", "0.5811338", "0.5801881", "0.579324",...
0.7216366
0
Produces the links needed to add a branch of strongly connected components to a graph with nNodes
def linkAdder(path,nNodes,compnts): links = [] lenP = len(path) #TODO: Edge weights, loops for i in range(lenP): if i == 0: links.append((path[i][0]+nNodes-1,path[i][1])) elif i == lenP - 1: links.append((path[i][0],path[i][1]+nNodes-1)) else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __connectNode__(self, numOfNodes, linksPerIteration):\n numOfLinks = 0\n node1 = self.getNode(numOfNodes - 1)\n # add n links per iteration\n while numOfLinks < linksPerIteration:\n #choose second node randomly\n nodeid2 = 0\n r = random.random()\n ...
[ "0.6313949", "0.6185626", "0.61180794", "0.60032433", "0.5991985", "0.59834194", "0.59797716", "0.5974082", "0.5962595", "0.59299135", "0.5903571", "0.5901444", "0.590087", "0.588318", "0.5873435", "0.5871734", "0.58666784", "0.58507955", "0.58486944", "0.58413434", "0.583373...
0.64270025
0
Specializes one link of the adjacency matrix A copying the given component
def specializeLink(A,bSize,edge,node,comp): #Return A unchanged if there is no link at edge n = A.shape[0] if A[edge] == 0: return A # If node is in the base set, return A unchanged if node < bSize: return A #Determine if the edge is ingoing or outgoing #If the edge is cont...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def commute_matrix(A):\n R = resistance_matrix(A)\n E = A.sum() / 2 # number of edges in graph\n C = 2 * E * R\n return C", "def adjacency_matrix():\n file_path = PROJECT_PATH + \"/geographycal_data/adjacency_matrix/Howgrp.txt\"\n router = Router(adjacency_metrix=file_path)\n # router.write...
[ "0.58570933", "0.5658251", "0.56477374", "0.5544675", "0.5507475", "0.54240173", "0.5413495", "0.52775264", "0.52507293", "0.5221803", "0.51768464", "0.5164879", "0.5160115", "0.515279", "0.51510197", "0.512366", "0.5112801", "0.51061696", "0.51059765", "0.5103154", "0.509774...
0.65455246
0
Returns the spectral radius of matrix A
def spectralRad(A): eigs = np.linalg.eig(A)[0] eigs = (eigs*eigs.conj())**.5 return max(eigs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rms(a):\n\treturn np.sqrt(np.sum(np.power(a,2))/len(a))", "def estimate_radius(self):\n red = self.T[:,:,0] # empirically, the most reliable channel\n\n eye_radius = red.sum(axis=1).max() / 2\n return eye_radius", "def apply_spectral_radius(w,spectral_radius):\n assert len(w.shape)==2...
[ "0.67630935", "0.65095603", "0.6394266", "0.6233465", "0.6225927", "0.6162436", "0.6148226", "0.61107635", "0.6023429", "0.60199916", "0.60130274", "0.6008262", "0.5999449", "0.5941901", "0.59106445", "0.590408", "0.5855397", "0.583363", "0.58267236", "0.5813907", "0.58131063...
0.7391085
0
Draws graph represented by adjacency matrix A
def drawGraph(A): m,n = A.shape labels = {} for i in range(n): labels[i]=str(i) gr = nx.from_numpy_matrix(A.T,create_using=nx.DiGraph()) nx.draw(gr,arrows=True,node_color='#15b01a',labels=labels) plt.show()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def graphviz(A,B):\r\n N = len(A) \r\n sc = 1.0 / len(B)\r\n \r\n print \"digraph AdjacencyMatrix {\"\r\n print \"\\tgraph[label=\\\"Graph representing the weight of the edge and adjacent\\\",labelloc =t];\"\r\n for i in range(N):\r\n #p = colorsys.hsv_to_rgb(sc*i,1.0,1.0)\r\n p ...
[ "0.7753731", "0.7202567", "0.7053941", "0.6911245", "0.68880284", "0.66435486", "0.6528022", "0.64066434", "0.6352613", "0.62549865", "0.62473476", "0.6180963", "0.6151698", "0.6114001", "0.60965455", "0.6072729", "0.6054285", "0.5999952", "0.5962524", "0.59414023", "0.593761...
0.8276277
0
Copies itself, updates the copy with `d`, and returns the copy.
def add(self, d): new = self.copy() new.update(d) return new
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _copy_(self):\n return copy.copy(self)", "def copy(self):\n import copy as pcopy\n return pcopy.deepcopy(self)", "def __copy__(self):\n return self.__class__(self.m, self.n, self.data)", "def copy(self):\n return self.mutate().simple_copy()", "def copy(self):\n return ...
[ "0.67048097", "0.66494346", "0.6573236", "0.65236926", "0.65050924", "0.6469327", "0.64656144", "0.646476", "0.6454663", "0.6448755", "0.64424205", "0.63726443", "0.63726443", "0.63689566", "0.63675594", "0.6356672", "0.6341567", "0.63413846", "0.63390404", "0.6333291", "0.63...
0.6703547
1
Searches for cards which match the given condition. Returns a function which takes a database dict or Result and returns a Result. The Result object is dictlike. Keys in Result are keys from the db; values are values from the db.
def search(field='name', method=IS, value=None): def searchPred(db): return Result((k, v) for k, v in db.items() if field in v and method(v[field], value)) return searchPred
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def where(**kwargs):\n return QueryBuilder(Card).where(**kwargs)", "def search_by_id_card(self, id_card):\n elector_query_filter = {'cedula': id_card}\n searching_result = self.build_searching_result(elector_query_filter)\n return searching_result", "def cards_matching_conditions(se...
[ "0.59276855", "0.5812465", "0.5636901", "0.5556645", "0.54063714", "0.53802407", "0.53196573", "0.5315584", "0.5264373", "0.52634364", "0.52167475", "0.51336163", "0.50327796", "0.50313216", "0.5024651", "0.49799803", "0.4945375", "0.49235415", "0.49122122", "0.4890973", "0.4...
0.62974584
0
The intersection of the results of searches satisfying `conditions`. Returns a function which takes a database dict or Result and returns a Result.
def And(*conditions): def andPred(db): from functools import reduce return reduce(lambda result, c: c(result), conditions, db) return andPred
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def where(self, *conditions):\n\n if len(conditions) == 0:\n return self\n\n values = []\n for i, condition in enumerate(conditions):\n value = eval_expression(condition, {\"me\": self})\n values.append(value)\n\n reduced_values = functools.reduce(lambda...
[ "0.61523086", "0.56473666", "0.56442654", "0.5626438", "0.5591212", "0.55036616", "0.544095", "0.535758", "0.5301115", "0.5171821", "0.514699", "0.5136264", "0.5136264", "0.5136264", "0.5136264", "0.5136264", "0.5077165", "0.506816", "0.5043708", "0.504221", "0.5034693", "0...
0.58310485
1
The union of the results of searches satisfying `conditions`. Returns a function which takes a database dict or Result and returns a Result.
def Or(*conditions): def orPred(db): from functools import reduce return reduce(lambda result, c: result.add(c(db)), conditions, Result()) return orPred
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def where(self, *conditions):\n\n if len(conditions) == 0:\n return self\n\n values = []\n for i, condition in enumerate(conditions):\n value = eval_expression(condition, {\"me\": self})\n values.append(value)\n\n reduced_values = functools.reduce(lambda...
[ "0.5631328", "0.5533582", "0.54699045", "0.5375606", "0.53350306", "0.53269434", "0.52058524", "0.5204164", "0.5117934", "0.5088415", "0.50790113", "0.50347936", "0.5018712", "0.50088555", "0.4987747", "0.4955332", "0.49544537", "0.49429125", "0.49248612", "0.48825148", "0.48...
0.6559617
0
The negation of the union of search results satisfying `conditions`. In other words, the result set is every item in db which does not meet any of the supplied conditions. Returns a function which takes a database dict/Result and returns a Result.
def Not(*conditions): def notPred(db): matches = Or(*conditions)(db) return Result((k, v) for k, v in db.items() if k not in matches) return notPred
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter_not(self, *arguments, **kwargs):\n from jetengine.query_builder.node import Q, QCombination, QNot\n\n if arguments and len(arguments) == 1 and isinstance(arguments[0], (Q, QCombination)):\n self.filter(QNot(arguments[0]))\n else:\n self.filter(QNot(Q(**kwargs))...
[ "0.64066637", "0.5963093", "0.58638847", "0.5750859", "0.57244474", "0.5704547", "0.5672951", "0.53814346", "0.5298135", "0.52810514", "0.52787226", "0.5243609", "0.52421033", "0.52313274", "0.5210754", "0.5210277", "0.520814", "0.5199096", "0.5182062", "0.51634836", "0.51111...
0.8138855
0
Matches cards that have at least all elements of the colour identity. `colours` is a string containing any or all of the letters 'BGRUWC'.
def ColorIdentityHas(colours): return And(*(search(field='colorIdentity', method=IN, value=c) for c in colours.upper()))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ColorIdentityOnly(colours):\n notcolours = set('BRGUW').difference(colours.upper())\n return Not(*(search(field='colorIdentity', method=IN, value=c)\n for c in notcolours))", "def ColorIdentityIs(colours):\n return And(ColorIdentityHas(colours), ColorIdentityOnly(colours))\n # ret...
[ "0.6947996", "0.66252", "0.6173588", "0.59359413", "0.53730327", "0.5254956", "0.5157743", "0.51473755", "0.5128806", "0.51144445", "0.5088921", "0.50494784", "0.49587902", "0.49481738", "0.4941442", "0.48983386", "0.4880034", "0.48530093", "0.48495722", "0.4848194", "0.48415...
0.69656295
0
Matches cards whose colour identity is `colours` or a subset of it. `colours` is a string containing any or all of the letters 'BGRUW'.
def ColorIdentityOnly(colours): notcolours = set('BRGUW').difference(colours.upper()) return Not(*(search(field='colorIdentity', method=IN, value=c) for c in notcolours))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ColorIdentityHas(colours):\n return And(*(search(field='colorIdentity', method=IN, value=c)\n for c in colours.upper()))", "def ColorIdentityIs(colours):\n return And(ColorIdentityHas(colours), ColorIdentityOnly(colours))\n # return And( And(*(search(field='colorIdentity', method=IN,...
[ "0.68914694", "0.6237633", "0.6003614", "0.56125367", "0.5522522", "0.54943395", "0.5463245", "0.5459654", "0.5133627", "0.5108964", "0.5078852", "0.5075397", "0.5054728", "0.5017138", "0.50122744", "0.49829018", "0.49595648", "0.49097934", "0.49019974", "0.48760837", "0.4869...
0.6928027
0
Encodes IP packed bytes as hex. We want to encode the packed bytes as hex instead of base64 since hex preserves sort order as a string and base64 does not. Ensures the string is 32 characters long, padding with 0s if it is shorter.
def hex_encode_ip(ip_addr): if not ip_addr: return None return base64.b16encode(ip_addr.packed).rjust(32, '0')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pack_ip(self, str_ip):\n return struct.pack(\">BBBB\", *[ int(c) for c in str_ip.split(\".\") ])", "def pack(self, input_string):\r\n #This function lacks basic error checking....\r\n klaf = ''\r\n for s in input_string:\r\n klaf += bin((ord(s) % 128) % 64)[2:].zfill(6)...
[ "0.63983035", "0.6283811", "0.6256769", "0.62420493", "0.61872345", "0.6174868", "0.6169863", "0.6109006", "0.60874736", "0.6084913", "0.6083231", "0.5987517", "0.5936024", "0.5907522", "0.5835274", "0.58311224", "0.5824503", "0.58216393", "0.5795381", "0.5752156", "0.5737948...
0.72372484
0
Builds the location map from the location input file where MLab Site ID maps to latitude and longitude
def build_location_map(): location_map = {} with open(INPUT_LOCATIONS_FILE, 'rbU') as csvfile: reader = csv.DictReader(csvfile) for row in reader: site_id = row[LOCATION_SITE_ID_COLUMN] location_map[site_id] = { 'site': site_id, 'latitude...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_map(filename: str) -> TravelMap:\n travel_map = {}\n for line in open(filename, \"r\"):\n loc1, loc2, dist = parse_line(line)\n add_locs(travel_map, loc1, loc2, dist)\n add_locs(travel_map, loc2, loc1, dist)\n return travel_map", "def maploc(loc):\n\n\n loc = REGEX['pa...
[ "0.59450126", "0.5890171", "0.5789345", "0.57870317", "0.5750917", "0.57212865", "0.5539347", "0.55388284", "0.5512641", "0.55045027", "0.54962724", "0.5439575", "0.5425502", "0.54206777", "0.5402784", "0.5395432", "0.5394554", "0.5384766", "0.53836846", "0.53796923", "0.5371...
0.7507676
0
The main program starting point, processes the CSV.
def main(): # Ensure the output directory exists if not os.path.exists(OUTPUT_DIR): os.makedirs(OUTPUT_DIR) process_csv()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n\n handler = CSVDownloader('download.csv')\n handler.start()", "def main(csvfile, dbfile, verbose=False):\n CONN = sqlite3.connect(dbfile)\n cursor = CONN.cursor()\n create_schema(cursor)\n process_data(cursor, csvfile, verbose=verbose)\n CONN.commit()\n CONN.close()", "def...
[ "0.7343742", "0.7049417", "0.68303186", "0.66581416", "0.65156454", "0.6489554", "0.6455292", "0.64319116", "0.6401431", "0.63953215", "0.6331502", "0.62616014", "0.6247926", "0.6226336", "0.6215583", "0.62077993", "0.6197634", "0.6177441", "0.6173137", "0.61711943", "0.61642...
0.81806535
0
Read tratz_2011 files and print reformatted csv files
def read_from_tratz_2011(file_full_path, labeled_dict): # 1. read the data with open(file_full_path, "r", encoding="utf-8-sig") as input_file: reader = csv.reader((line.replace("\0", "") for line in input_file)) reader_list = list(reader) csv_data = [] for index, row in enumerate...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n master_csv = open(\"master.csv\", \"w\")\n master_csv.write(\"lat, lon, year, month, day, T_max, T_min, PrecipMM, T_ave, PrecipCM, RelHum\\n\")\n MoLS_comp_csv = open(\"MoLS_comp.csv\", \"w\")\n lat_lon_csv = open(\"lat_lon.csv\", \"w\")\n\n for csvFilename in os.listdir('.'):\n\n ...
[ "0.6114815", "0.59159887", "0.58782846", "0.5876882", "0.58222306", "0.5669393", "0.56678593", "0.560018", "0.55381453", "0.55149317", "0.5509179", "0.55069023", "0.5467473", "0.54572016", "0.545218", "0.54418755", "0.5430773", "0.54084426", "0.53959244", "0.53923994", "0.538...
0.68356717
0
Return a list of values from sample descriptor.
def _parse_sample_descriptor(descriptor): data = [] for var in DATA: value = None # Prevent assigning previous value if current one is missing if 'group' in var[1]: if descriptor.get(var[1]['group'], None): value = descriptor[var[1]['group']][var[0]] else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_sample(self):\n return [layer._get_sample() for layer in self.layers]", "def samples(self):\n return self._values[:self.nsamples]", "def get_samples_list(self):\n return self.samples_list", "def getValues(self):\n return [self._rng.normal(25,1)]", "def getSamplesList(se...
[ "0.6536403", "0.6485035", "0.6441714", "0.64184034", "0.6403922", "0.63869774", "0.6332552", "0.6282445", "0.6280394", "0.624317", "0.6222772", "0.62073594", "0.62014925", "0.61722386", "0.6163539", "0.61147225", "0.6106813", "0.6088882", "0.60880065", "0.60880065", "0.608682...
0.68354845
0
Parse data from samples to Orange.data.Table
def to_orange_table(samples): # Create table and fill it with sample data: table = [] for sample in samples: table.append(_parse_sample_descriptor(sample.descriptor['sample'])) # Create domain (header in table): header = [var[1]['type'].make(var[0]) for var in DATA] # It is necessary...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _load_sample_table(self):\n self.sampleTable = pd.read_table(self.config['sampletable'], sep='\\t', dtype=str)\n self.sampleTable.set_index('sampleID', inplace=True)\n self.samples = self.sampleTable.reset_index().to_dict('records')", "def parse_trflp(lines):\r\n\r\n sample_ids = []\r...
[ "0.6100819", "0.60721487", "0.59981054", "0.59081817", "0.59068567", "0.58611846", "0.58368427", "0.58265287", "0.5777086", "0.5742348", "0.5693635", "0.56883407", "0.56474876", "0.5633176", "0.5622054", "0.557272", "0.55682075", "0.5516522", "0.5495864", "0.5484695", "0.5473...
0.6597719
0
Returns a command capped between 1. and 1.
def cap_command(u): return min(max(u, -1.), 1.)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def command(self):\n return (self.command_).format(self.x)", "def genCommand(char, command): \n \n if char == 'a':\n command = SModelRobotOutput();\n command.rACT = 1\n command.rGTO = 1\n command.rSPA = 255\n command.rFRA = 150\n\n if char == 'r':\n ...
[ "0.5821659", "0.5638357", "0.5556967", "0.5493774", "0.5433915", "0.5428322", "0.5386615", "0.5377889", "0.53021556", "0.52872634", "0.5284025", "0.5284025", "0.5282277", "0.52527523", "0.5245862", "0.52396727", "0.5229571", "0.52215743", "0.52029353", "0.52024204", "0.516216...
0.6863914
0
This controller implements the constant spacing controller defined in Rajamani.
def constant_spacing_controller(vehicles, priority): u_lead = 1. xsi, omega = 1., 1. v_lead, v_follow = vehicles[priority], vehicles[1-priority] constant_spacing = 10. u = (u_lead - 2*xsi*omega*(v_follow.speed - v_lead.speed) - omega**2*(v_follow.position - v_lead.position + constant_spacin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def SetSpacing(self, p_int, ):\n ...", "def spacing(self, spacing):\n\n self._spacing = spacing", "def update_knot_spacing(self):\n knot_spacing = self.knot_spacing.text()\n if knot_spacing:\n self._cache[\"input\"][\"knot_spacing\"] = float(knot_spacing)\n sel...
[ "0.59537655", "0.5687711", "0.54729176", "0.5428336", "0.54281616", "0.5397117", "0.53942287", "0.53693706", "0.53690684", "0.5365852", "0.5341081", "0.52536523", "0.5210555", "0.5204996", "0.5192146", "0.5170302", "0.51656395", "0.5114866", "0.50950676", "0.509088", "0.50749...
0.63144785
0
Shows and hides the contents of the ToggledFrame
def toggle(self): if bool(self.show.get()): self.sub_frame.pack(fill="x", expand=1) self.toggle_button.configure(text='-') else: self.sub_frame.forget() self.toggle_button.configure(text='+')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def toggle(self) -> None:\n if bool(self.show.get()):\n self.sub_frame.pack(fill=tk.X, expand=True)\n self.toggle_button.configure(text=self.sep[0])\n else:\n self.sub_frame.forget()\n self.toggle_button.configure(text=self.sep[1])", "def toggle(self):\n ...
[ "0.75016373", "0.72530895", "0.69452643", "0.6886407", "0.67134506", "0.65950507", "0.65528065", "0.6453078", "0.63985837", "0.6377393", "0.63395697", "0.6292594", "0.6290115", "0.6273213", "0.61994946", "0.61936015", "0.619098", "0.618752", "0.61778116", "0.6164028", "0.6109...
0.75318563
0
At line's reconciliation the cash flow share is computed based on the counterpart moves share (if reconciled with invoices) or from the account move's structure in case of simple reconciliation.
def compute_counterpart_lines(self): for item in self: move_debit_lines = [] move_credit_lines = [] # list of all the move lines of the payment's move line_list = [] for entry in item.journal_entry_ids: for line in entry.line_ids: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _compute_move_line(self):\n self.move_line_ids = False\n if self.is_account_balance_detail_template:\n TB = self.env['account.general.ledger.report']\n _x, moves = TB._get_moves(self.fiscalyear_id.id, self.target_move,\n self.reconcile_co...
[ "0.6417576", "0.6256426", "0.62358844", "0.6181787", "0.59663254", "0.58834475", "0.5791047", "0.57768714", "0.5739293", "0.569058", "0.5677759", "0.56724447", "0.55891144", "0.5576013", "0.5546815", "0.54625577", "0.53655434", "0.534112", "0.53377295", "0.5306065", "0.527013...
0.72559375
0
Corrects word by replacing characters with written similarly depending on which language the word. Fraudsters use this technique to avoid detection by antifraud algorithms.
def correctWord (w): if len(re.findall(r"[а-я]",w))>len(re.findall(r"[a-z]",w)): return w.translate(eng_rusTranslateTable) else: return w.translate(rus_engTranslateTable)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def correctWord (w):\n\n if len(re.findall(ur\"[а-я]\",w))>len(re.findall(ur\"[a-z]\",w)):\n return w.translate(eng_rusTranslateTable)\n else:\n return w.translate(rus_engTranslateTable)", "def corrected(text):\n # Init SpellChecker\n spell = SpellChecker(language='fr', distance...
[ "0.78141385", "0.74022794", "0.7166453", "0.70677793", "0.6925757", "0.6788918", "0.6545906", "0.65434587", "0.6468143", "0.6450252", "0.6400079", "0.6383179", "0.6376166", "0.6322892", "0.63156724", "0.62960476", "0.6293348", "0.62666917", "0.6263179", "0.62558824", "0.61929...
0.78376377
0
Char count for a word.
def getWordCharCount(w): rus = len(re.findall(r"[а-я]",w)) eng = len(re.findall(r"[a-z]",w)) c = len(w) return c, rus, eng
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def num_chars(word):\n return len(word)", "def count(word):\n\n return len(word)", "def count(self, word):\n pass", "def word_char_count(word):\n\talphabet = alphabet_init()\n\tfor i in range(len(word)):\n\t\tchar_index = convert_letter_to_int(word[i])\n\t\talphabet[char_index] += 1 \n\treturn ...
[ "0.8467571", "0.8092834", "0.77545226", "0.77429795", "0.7580676", "0.7529951", "0.75093347", "0.7419033", "0.733552", "0.72578025", "0.7231552", "0.72314847", "0.7166851", "0.7125904", "0.71065956", "0.7088167", "0.7078181", "0.705774", "0.705344", "0.70157576", "0.7007348",...
0.8250801
1
Get index dict for category, subcategory, attrs key & value, and word in title and description. You only need to run this once.
def getDataIndex(tsvFile): start = datetime.now() # dict for counts catCounts = defaultdict(setDefaultCount) subCatCounts = defaultdict(setDefaultCount) attrsKeyCounts = defaultdict(setDefaultCount) attrsValCounts = defaultdict(setDefaultCount) wordCounts = defaultdict(setDefaul...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def createIndex(pages): \n index = defaultdict(list)\n for url, content, links in pages:\n counts = getNumberTerms(content)\n for term, count in counts.items():\n index[term].append((url, count))\n return index", "def build_index(text: Iterable) -> Dict[str, List[Tuple[int, i...
[ "0.6309492", "0.61245775", "0.609044", "0.5956732", "0.5889888", "0.5869278", "0.5798291", "0.5781497", "0.57125753", "0.5658303", "0.5634527", "0.56326133", "0.5545616", "0.55112594", "0.54947156", "0.5490412", "0.54686826", "0.5451463", "0.5447535", "0.5439721", "0.5399769"...
0.643772
0
process the tweet with text and tm
def process(self, tweet): #identify the applicable event keywords for this text text = self.cleanup_data(tweet.text) tokens = [str(t.lower()).translate(None, string.punctuation) for t in tweet.text.split()] applicable_tokens = [] for phrase in self.match_event_tree.root.keywords...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_tweet(json_data):\n text = json_data.get('text')\n\n # Strip URLs.\n for url in json_data.get('entities').get('urls', []):\n text = text.replace(url.get('url', ''), 'http')\n\n # Tokenize text.\n tokens = twitter_tokenizer.tokenize(text)\n\n # Remove punctuation and stopwords.\...
[ "0.70383126", "0.6865265", "0.6819113", "0.6643864", "0.6625023", "0.6587484", "0.6577722", "0.65677804", "0.654974", "0.6548882", "0.6529953", "0.6529935", "0.6429815", "0.6402482", "0.6396686", "0.63851416", "0.637452", "0.6369618", "0.6335108", "0.63318837", "0.62541884", ...
0.7421995
0
write (issn,minYear,maxYear) as issn.tab to one publisher directories, adding issnOverwrite at the end
def writeIssnTables(outDir, pubIds, pubToIssn, issnOverwrite): outFhDict = {} # prep the lookup table pubIdToDescs = {} for pubDesc, pubId in pubIds.iteritems(): pubIdToDescs.setdefault(pubId, []).append(pubDesc) # outDir has to be identical to the pubId from pubConf pubId = basename(o...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def writeIssns(pubFname, outDir, pubDirs, issnOverwrite):\n pubToIssnTitle = parseIssns(pubFname, pubDirs, issnOverwrite)\n writeIssnTables(outDir, pubDirs, pubToIssnTitle, issnOverwrite)", "def blacklistIssnYear(outDir, issnYear, journal):\n issn, year = issnYear\n fname = join(outDir, ISSNSTATNAME)...
[ "0.71226144", "0.5963562", "0.5832776", "0.5570426", "0.5542497", "0.5126973", "0.5098071", "0.50205076", "0.50153023", "0.49770194", "0.4975966", "0.49736565", "0.4951415", "0.49424815", "0.49368542", "0.49265504", "0.4906967", "0.49036133", "0.48306945", "0.48277748", "0.47...
0.7130042
0
use pubConf.py and the publishers.tab file to get target ISSNs and write them to outDir/issns.tab
def writeIssns(pubFname, outDir, pubDirs, issnOverwrite): pubToIssnTitle = parseIssns(pubFname, pubDirs, issnOverwrite) writeIssnTables(outDir, pubDirs, pubToIssnTitle, issnOverwrite)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def writeIssnTables(outDir, pubIds, pubToIssn, issnOverwrite):\n outFhDict = {}\n\n # prep the lookup table\n pubIdToDescs = {}\n for pubDesc, pubId in pubIds.iteritems():\n pubIdToDescs.setdefault(pubId, []).append(pubDesc)\n\n # outDir has to be identical to the pubId from pubConf\n pubI...
[ "0.70458555", "0.58005977", "0.5270302", "0.5221248", "0.5129613", "0.5083846", "0.50225556", "0.4940209", "0.49242353", "0.48736656", "0.4833738", "0.48145944", "0.47826403", "0.47478098", "0.47368413", "0.47161388", "0.47066933", "0.46989992", "0.46963295", "0.46746317", "0...
0.65162486
1
use pubmed eutils to get the PMIDs for a dict of pubDir > (list of ISSN records) and append to filename
def resolveIssnToPmid_Pubmed(issnRowFnames, minYear): for pubDir, issns in issnRowFnames.iteritems(): logging.info("Processing publisher dir %s" % pubDir) pmids = [] for issnData in issns: # read pmids from pubmed or filesystem logging.info("Retrieving PMIDs for ISSN ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def writeIssnTables(outDir, pubIds, pubToIssn, issnOverwrite):\n outFhDict = {}\n\n # prep the lookup table\n pubIdToDescs = {}\n for pubDesc, pubId in pubIds.iteritems():\n pubIdToDescs.setdefault(pubId, []).append(pubDesc)\n\n # outDir has to be identical to the pubId from pubConf\n pubI...
[ "0.6146676", "0.6044227", "0.5882621", "0.5613284", "0.5595173", "0.5426304", "0.53780425", "0.5323866", "0.53013694", "0.5282614", "0.5275529", "0.52751493", "0.5271122", "0.52665514", "0.52560455", "0.5224879", "0.5196614", "0.5193479", "0.51751614", "0.5162122", "0.5140853...
0.6526521
0
Gets a DataProcessorGaussAndCosine with a ScaledDataCategoryVisitor
def getPreProcessData(self, data:np.ndarray, dataIncludesLabels:bool) -> DataProcessorWithVisitor: scaledDataCategoryVisitor = ScaledDataCategoryVisitor() train_data = pd.read_csv("titanic/train.csv") train_data = train_data.to_numpy().tolist() dataProcessorWithVisitor = DataProcessorWit...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def itkCumulativeGaussianCostFunction_cast(*args):\n return _ITKCostFunctionsPython.itkCumulativeGaussianCostFunction_cast(*args)", "def cast(*args):\n return _ITKCostFunctionsPython.itkCumulativeGaussianCostFunction_cast(*args)", "def Conv(self, data, stddev):\n\n g = Gaussian1DKernel(stddev=st...
[ "0.51025367", "0.499564", "0.49015063", "0.4842893", "0.48145047", "0.47574672", "0.47345772", "0.47108147", "0.47042477", "0.4692768", "0.46669626", "0.46453416", "0.46164936", "0.46053067", "0.46015137", "0.45477536", "0.45451072", "0.45390218", "0.4537623", "0.4534281", "0...
0.5954979
0
get the list after the first paired tiles
def get_list_before_paired(line): if find_pair(line): index = get_index(line) return line[ :index + 2] return []
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_list_after_paired(line):\n if find_pair(line):\n index = get_index(line)\n return line[index + 2: ]\n return []", "def partOne(tileList):\n\n blackTiles = set()\n directionsDict = {\n \"e\" : (0, 1),\n \"se\": (-0.5, 0.5),\n ...
[ "0.6331188", "0.63308346", "0.6175819", "0.5937171", "0.5849126", "0.58075583", "0.57991785", "0.579134", "0.5789031", "0.57733005", "0.5729336", "0.5685393", "0.5652022", "0.5633206", "0.5622049", "0.5613084", "0.5599018", "0.5593354", "0.55789274", "0.55728406", "0.5559817"...
0.634153
0
get the list after the first paired tiles
def get_list_after_paired(line): if find_pair(line): index = get_index(line) return line[index + 2: ] return []
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_list_before_paired(line):\n if find_pair(line):\n index = get_index(line)\n return line[ :index + 2]\n return []", "def partOne(tileList):\n\n blackTiles = set()\n directionsDict = {\n \"e\" : (0, 1),\n \"se\": (-0.5, 0.5),\n ...
[ "0.634153", "0.63308346", "0.6175819", "0.5937171", "0.5849126", "0.58075583", "0.57991785", "0.579134", "0.5789031", "0.57733005", "0.5729336", "0.5685393", "0.5652022", "0.5633206", "0.5622049", "0.5613084", "0.5599018", "0.5593354", "0.55789274", "0.55728406", "0.5559817",...
0.6331188
1
Test that `change_server` correctly switches NetworkTables server
def test_change_server(self): networktables_mock = unittest.mock.Mock() network_instance = network.Network(networktables_mock, None, None) network_instance.change_server("localhost") # Make sure Networktables was shutdown before network change self.assertTrue(networktables_mock...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def jump_server(self, msg=\"Changing servers\"):\n if self.connection.is_connected():\n self.connection.disconnect(msg)\n self._connect()", "def toggle_server(self):\n name = request.params.get('name', g.DEFAULT_SERVER)\n log.debug('toggle_server(%s)' % name)\n serve...
[ "0.6564109", "0.63662076", "0.6251782", "0.6216001", "0.6195454", "0.60257745", "0.599519", "0.5994409", "0.59291255", "0.5920932", "0.59180075", "0.59046245", "0.58677465", "0.5857504", "0.5834919", "0.5815491", "0.58078676", "0.574853", "0.5732923", "0.5729377", "0.5722384"...
0.8538353
0
Test that the NetworkTable reference is a reference to a table on the new network after a `change_server`
def test_table_reference(self): networktables_mock = unittest.mock.Mock() table_mock = unittest.mock.Mock() # When table is gotten from first network, table will be None, # from second network will return table_mock networktables_mock.getTable.side_effect = [None, table_mock] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_change_server(self):\n networktables_mock = unittest.mock.Mock()\n\n network_instance = network.Network(networktables_mock, None, None)\n network_instance.change_server(\"localhost\")\n\n # Make sure Networktables was shutdown before network change\n self.assertTrue(netw...
[ "0.7040516", "0.64426756", "0.62193614", "0.61545986", "0.6150826", "0.59335345", "0.57249546", "0.561838", "0.55832547", "0.54797703", "0.5437208", "0.5409199", "0.5375246", "0.535293", "0.53211164", "0.53162736", "0.53074", "0.5306424", "0.53007084", "0.52694523", "0.526139...
0.8247613
0
Test whether `set_game_mode` correctly sets game mode
def test_set_game_mode(self): networktables_mock = unittest.mock.Mock() table_mock = unittest.mock.Mock() networktables_mock.getTable.return_value = table_mock network_instance = network.Network(networktables_mock, None, None) network_instance.set_game_mode("autonomous") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def chooseGamemode(self):\n\n # Set the gamemode when user clicks a radio button\n self.GAME_MODE = self.gamemode_var.get()", "def game_mode(self):\n return self._get(\"game_mode\")", "def game(var, wrapper, message):\n if message:\n vote_gamemode(var, wrapper, message.lower().sp...
[ "0.7076608", "0.69357663", "0.66953015", "0.6684289", "0.65998554", "0.6553573", "0.64389825", "0.6413695", "0.63650054", "0.6328096", "0.6296748", "0.62670696", "0.6236318", "0.62078387", "0.6193881", "0.6125178", "0.6115306", "0.6095592", "0.6092801", "0.6088724", "0.605139...
0.71076816
0
Test that `shutdown` correctly shutsdown NetworkTables
def test_shutdown(self): networktables_mock = unittest.mock.Mock() table_mock = unittest.mock.Mock() networktables_mock.getTable.return_value = table_mock network_instance = network.Network(networktables_mock, None, None) network_instance.shutdown() self.assertTrue(netw...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_shutdown(self):\n server, client = loopback()\n assert not server.shutdown()\n assert server.get_shutdown() == SENT_SHUTDOWN\n with pytest.raises(ZeroReturnError):\n client.recv(1024)\n assert client.get_shutdown() == RECEIVED_SHUTDOWN\n client.shutdown...
[ "0.7357897", "0.7308006", "0.7112359", "0.70831245", "0.70263946", "0.68987185", "0.6898308", "0.6876604", "0.6876604", "0.682065", "0.6804308", "0.67841977", "0.67178166", "0.67143506", "0.66615677", "0.6593673", "0.65264696", "0.6515292", "0.64864665", "0.6437829", "0.64378...
0.8445106
0
Test that `set_joystick_axis_value` works right
def test_set_joystick_axis_value(self): networktables_mock = unittest.mock.Mock() table_mock = unittest.mock.Mock() networktables_mock.getTable.return_value = table_mock network_instance = network.Network(networktables_mock, None, None) network_instance.set_joystick_axis_value(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_set_joystick_button_value(self):\n networktables_mock = unittest.mock.Mock()\n table_mock = unittest.mock.Mock()\n networktables_mock.getTable.return_value = table_mock\n\n network_instance = network.Network(networktables_mock, None, None)\n\n network_instance.set_joysti...
[ "0.6993351", "0.60509837", "0.5932644", "0.58161926", "0.57900983", "0.5729542", "0.5704524", "0.5699112", "0.56921357", "0.5642631", "0.5637337", "0.55956006", "0.55887055", "0.54923844", "0.5486586", "0.54321635", "0.54120564", "0.5356765", "0.53170174", "0.525961", "0.5243...
0.82735866
0
Test that `set_joystick_axis_value` performs correctly
def test_set_joystick_button_value(self): networktables_mock = unittest.mock.Mock() table_mock = unittest.mock.Mock() networktables_mock.getTable.return_value = table_mock network_instance = network.Network(networktables_mock, None, None) network_instance.set_joystick_button_va...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_set_joystick_axis_value(self):\n networktables_mock = unittest.mock.Mock()\n table_mock = unittest.mock.Mock()\n networktables_mock.getTable.return_value = table_mock\n\n network_instance = network.Network(networktables_mock, None, None)\n\n network_instance.set_joystick...
[ "0.82196504", "0.59310603", "0.58440566", "0.5839585", "0.58033645", "0.57529277", "0.57394177", "0.57351005", "0.57174516", "0.56859165", "0.5573661", "0.55520636", "0.55332476", "0.5498259", "0.5429676", "0.54180104", "0.5384856", "0.5327553", "0.5320097", "0.52863336", "0....
0.68706405
1
Returns the url to access a particular qualifier name instance.
def get_absolute_url(self): return reverse('qualifier-name-detail', args=[str(self.id)])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def uri(cls):\n return f'{cls.app_label}.{cls.name}'", "def url(self):\n return self.storage.url(self.name)", "def url(self, name):\n return self.path(name)", "def get_absolute_url(self):\n return reverse('qualifier-detail', args=[str(self.id)])", "def get_absolute_url(self):\n ...
[ "0.6403521", "0.6374523", "0.631921", "0.6301958", "0.6284575", "0.615681", "0.61077195", "0.6067237", "0.6023603", "0.60200226", "0.59623253", "0.59623253", "0.5959486", "0.59475857", "0.59091675", "0.5902702", "0.58974665", "0.5859419", "0.5859419", "0.5859419", "0.5859419"...
0.6534345
0
Returns the url to access a particular stratigraphic qualifier instance.
def get_absolute_url(self): return reverse('stratigraphic-qualifier-detail', args=[str(self.id)])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_absolute_url(self):\n return reverse('qualifier-detail', args=[str(self.id)])", "def url(self):\n return f\"{self.volume_provider.boss._project._base_protocol}://{self.volume_provider.boss._project._base_url}/v1/mgmt/resources/{self.collection_name}/{self.experiment_name}/{self.channel_name...
[ "0.6336867", "0.6331043", "0.618768", "0.6170334", "0.60770804", "0.60533834", "0.5896032", "0.58868665", "0.5866689", "0.5866144", "0.5855815", "0.5855528", "0.576337", "0.5745196", "0.5740608", "0.57325244", "0.5727627", "0.5724878", "0.5724878", "0.56984353", "0.56825215",...
0.66152835
0
Returns the url to access a particular relation instance.
def get_absolute_url(self): return reverse('relation-detail', args=[str(self.id)])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def related_url(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['RelatedUrlArgs']]]]:\n return pulumi.get(self, \"related_url\")", "def related_url(self) -> pulumi.Output[Sequence['outputs.RelatedUrlResponse']]:\n return pulumi.get(self, \"related_url\")", "def url(self) -> str:\n ret...
[ "0.703903", "0.6999717", "0.6889909", "0.67122614", "0.6711695", "0.6588091", "0.6579229", "0.65591305", "0.653995", "0.649362", "0.6448614", "0.6430037", "0.64235455", "0.64061326", "0.64061326", "0.64017934", "0.6401295", "0.640002", "0.640002", "0.63910306", "0.6363239", ...
0.7473583
0
Simulate a structure in a particular engine
def simulate(structure, engine, **kwargs): if engine.lower() == 'gromacs': import mosdef_trappe.gromacs_util.gromacs_functions as gmx_funcs gmx_funcs.simulate(structure, **kwargs) elif engine.lower() == 'openmm': import mosdef_trappe.openmm_util.openmm_functions as omm_funcs omm...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_simulation(self):\n pass", "def simulation():\n\n return {\n \"type\": \"class\",\n \"base\": \"iso.process_step\",\n \"is_abstract\": False,\n \"is_document\": True,\n \"pstr\": (\"({}/{}/{})\", (\"used\", \"ran_for_experiments\", \"ensemble_id\")),\n ...
[ "0.59783286", "0.5900295", "0.58193743", "0.56426394", "0.54236114", "0.537126", "0.53172547", "0.52613777", "0.5254791", "0.5243928", "0.52388346", "0.52122456", "0.52076817", "0.520146", "0.5201435", "0.52001196", "0.5197022", "0.5195794", "0.51947594", "0.5190608", "0.5185...
0.6906421
0
Overrides the function to set the joint positions directly, since we need to notify the IK controller of the change.
def set_robot_joint_positions(self, positions): self.env.set_robot_joint_positions(positions) self.controller.sync_state()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_jpos(self, position, joint_name=None, wait=True, *args, **kwargs):\n raise NotImplementedError", "def setJointPosition(self, jointPosition):\n if len(jointPosition.shape) != 1:\n raise ValueError(jointPosition.shape)\n jointPosition = jointPosition.tolist()\n for i ...
[ "0.71733934", "0.70218307", "0.681294", "0.6667217", "0.6633841", "0.65523356", "0.65418726", "0.6449512", "0.6404605", "0.6331693", "0.6317472", "0.6270752", "0.6194473", "0.619205", "0.6134428", "0.6121182", "0.6121167", "0.61061996", "0.61039925", "0.6075902", "0.6066686",...
0.7285343
0
Helper function to pass to the ik controller for access to the current robot joint positions.
def _robot_jpos_getter(self): return np.array(self.env._joint_positions)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_joints(joint_listener): \n if LOCAL_TEST: # dummy\n return np.array([-0.5596, 0.5123, 0.5575, -1.6929, 0.2937, 1.6097, -1.237, 0.04, 0.04])\n else:\n joints = joint_listener.joint_position\n print('robot joints', joints)\n return joints", "def update_model(self, sim...
[ "0.657817", "0.64777404", "0.6437659", "0.63669014", "0.6312918", "0.6279917", "0.6250009", "0.62454057", "0.6168636", "0.6141011", "0.6132064", "0.6124037", "0.6106073", "0.60908693", "0.60904276", "0.60808355", "0.6065106", "0.60612345", "0.6044297", "0.6003794", "0.599838"...
0.7396005
0
Returns a list of tuples of (EventDecorator instance, bound_handler) from this object and ancestor objects from self.acquire.event_handlers
def event_handlers(self): if self._event_handlers is not None: return self._event_handlers # Get event handlers for self ordered = [] unordered = [] cls = type(self) for cls_name in dir(cls): cls_item = getattr(cls, cls_name, None) if ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def event_handlers(self):\n if self.is_flow:\n return self._event_handlers\n\n try:\n return self._event_handlers\n except AttributeError:\n return self.flow._event_handlers", "def getSimulationEventHandlers(self): \r\n return self.__eventHandlers.valu...
[ "0.67658865", "0.6552246", "0.64678615", "0.639541", "0.6313409", "0.62939036", "0.6275198", "0.62692815", "0.6265524", "0.6208477", "0.61809075", "0.61581475", "0.61307466", "0.609664", "0.5906315", "0.58772147", "0.58408815", "0.583683", "0.58332", "0.5833084", "0.577553", ...
0.80491716
0
Post JSON data to the websocket
def _send_json(self, data): return self.sendMessage(json.dumps(data).encode("utf-8"))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sendjson(self, data):\n\n import json\n\n self.sendraw(json.dumps(data))", "def _post(self, data):\n self.websocket.send(json.dumps(data).encode('utf-8'))\n res = self.websocket.recv()\n if isinstance(res, bytes):\n res = res.decode('utf-8')\n try:\n ...
[ "0.7257501", "0.724171", "0.70779884", "0.7036044", "0.7018935", "0.6907296", "0.6853255", "0.68515754", "0.6793821", "0.67510307", "0.6701318", "0.6601435", "0.65219593", "0.6395368", "0.63825196", "0.6345039", "0.6322365", "0.6313261", "0.63037735", "0.6232314", "0.6232314"...
0.742681
0
Process the response from sending a POST request
def post_response(self, body, **kwargs): data = json.loads(body) if "errors" in data: self.handle_error(data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _postproc(self, request):\n if request.status_code != 200: raise Exception('wrong error code: {0}'.format(request.status_code))\n data = request.json()\n self.data = self._finalize_data(data)", "def do_POST(self):\n self._try_to_process_request(self._handle_post_request)", "def ...
[ "0.72786516", "0.71845734", "0.70296896", "0.7028681", "0.6994484", "0.6980143", "0.6917807", "0.6917807", "0.6860147", "0.68288165", "0.68072546", "0.6783355", "0.6613666", "0.65663016", "0.65295136", "0.64826673", "0.64631534", "0.6457269", "0.645449", "0.642605", "0.636953...
0.7194144
1
Process incoming data from Discord and sent to the Evennia server
def data_in(self, data, **kwargs): action_type = data.get("t", "UNKNOWN") if action_type == "MESSAGE_CREATE": # someone posted a message on Discord that the bot can see data = data["d"] if data["author"]["id"] == self.discord_id: # it's by the bot its...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_message(self, data):\n req = json.loads(data)\n self.serve(req)", "def on_message(self, data):\n req = json.loads(data)\n self.serve(req)", "def handle_datachan(bot, event):\n event.reply(event.chan.data.tojson())", "def handle_dataevent(bot, event):\n event.reply(eve...
[ "0.6787008", "0.6787008", "0.65925914", "0.6332882", "0.620201", "0.61801255", "0.6176691", "0.6147087", "0.6141238", "0.6121019", "0.6080775", "0.60344297", "0.6016867", "0.5958886", "0.59530663", "0.5944855", "0.59378296", "0.590387", "0.5896228", "0.5881752", "0.58804387",...
0.68667096
0
Reads in an annotations file provided in the SDD dataset, and converts the text file into a list of Agent objects
def read_annotations(file): with open(file) as f: lines = f.read().splitlines() annotations_by_agent = divide_annotations(lines) agent_list = [] for annotation_set in annotations_by_agent: agent_list.append(Agent(annotation_set)) return agent_list
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def readAnnotations(f):\n lbf = \"../labels/\" + f[: f.rfind('.')] + \".txt\"\n b = []\n with open(lbf, \"r\") as fh:\n for l in fh:\n p = l.strip().split()\n b.append( (p[0], int(p[1]), int(p[2]), int(p[3]), int(p[4])) )\n\n return b", "def get_all_anns(filepaths):\n ...
[ "0.6495842", "0.61055315", "0.5936407", "0.5928163", "0.59193313", "0.59085315", "0.5900489", "0.58918697", "0.5882934", "0.58729166", "0.5862145", "0.57869107", "0.5754009", "0.5737869", "0.5689054", "0.568775", "0.56168294", "0.5550701", "0.5546542", "0.5540045", "0.552546"...
0.8095501
0
Divides the lines of an annotation file into lists based on the different objects. For internal use only
def divide_annotations(annotation_lines): annotation_lists = [] current_agent_num = 0 annotation_lists.append([]) for line in annotation_lines: line = line.split() read_agent_num = int(line[0]) if read_agent_num == current_agent_num: annotation_lists[current_agent_n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_objects(self,label_fh):\n objects = []\n for line in label_fh.readlines():\n try:\n object = {}\n line = line.replace(u'\\ufeff', '')\n if line != '':\n x1, y1, x2, y2, x3, y3, x4, y4= [int(i) for i in line.split(',')...
[ "0.69032574", "0.65089506", "0.6486001", "0.63201815", "0.6307162", "0.6293492", "0.6251644", "0.5972691", "0.5968226", "0.5962004", "0.5961044", "0.5929577", "0.5877518", "0.585566", "0.5829064", "0.5809951", "0.58059394", "0.5805565", "0.57631123", "0.57427", "0.5731958", ...
0.7509743
0
Given an agent and a list of Path lists comprising a grid, returns the list of position of the agent in that grid.
def get_agent_positions_in_grid(agent, grid): grid_position_list = [] for position in agent.positions: for (grid_row, grid_row_index) in zip(grid, range(len(grid))): grid_col_index = _get_position_grid_column(position, grid_row) if grid_col_index or grid_col_index == 0: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def agent_locs_idx(self):\n return tuple(self.agent_locs.T)", "def get_agent_position(agent):\n pos = Vector2()\n pos.x = agent.pose.pose.position.x\n pos.y = agent.pose.pose.position.y\n return pos", "def find_obstacle_loc(self, obstacle_list):\n\n x_obst = []\n y_obst = []\n ...
[ "0.65672046", "0.60959625", "0.5928386", "0.57416713", "0.5716897", "0.56906486", "0.56605065", "0.5650157", "0.5554241", "0.55107236", "0.5491558", "0.54760265", "0.54340756", "0.5387839", "0.5380781", "0.53696215", "0.53695965", "0.5357078", "0.5357078", "0.5356395", "0.533...
0.7945787
0
Given a position and a grid_row in which the position may lie, returns the grid column containing the position (if any)
def _get_position_grid_column(position, grid_row): for (box, grid_col_index) in zip(grid_row, range(len(grid_row))): if box.contains_point((position.x, position.y)): return grid_col_index return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_column(board, position):\n col = (position-1) % 3\n return [board[x] for x in (col, col+3, col+6)]", "def current_position(self, solved_row, solved_col):\n solved_value = (solved_col + self._width * solved_row)\n\n for row in range(self._height):\n for col in range(self._wi...
[ "0.6834848", "0.67231095", "0.67231095", "0.67231095", "0.67231095", "0.67059284", "0.66897565", "0.66897565", "0.66897565", "0.6662139", "0.6561211", "0.649932", "0.646591", "0.64569575", "0.63809735", "0.6362832", "0.6324165", "0.62707597", "0.6263895", "0.62173307", "0.616...
0.8711368
0
Given the path to a video file, returns an array where each value in the array is the average pixel value over all frames of the video
def get_video_average(video_path): vidcap = cv2.VideoCapture(video_path) width = int(vidcap.get(cv2.CAP_PROP_FRAME_WIDTH)) height = int(vidcap.get(cv2.CAP_PROP_FRAME_HEIGHT)) num_color_channels = 3 avg_frame = np.zeros((height, width, num_color_channels), dtype=np.float64) frames = 0 whil...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_video(file_path):\n video = cv2.VideoCapture(file_path)\n\n video_sum = 0\n frame_cnt = 0\n\n previous_frame_digits = set()\n\n while True:\n return_value, frame = video.read()\n\n # skip same frames to improve performance\n frame_cnt += 1\n if frame_cnt % 2 !...
[ "0.6709997", "0.65353996", "0.63483286", "0.6030646", "0.5916428", "0.58618426", "0.5843053", "0.58196795", "0.5800116", "0.5793864", "0.5748744", "0.5735727", "0.5709901", "0.5652134", "0.5630493", "0.5589929", "0.55867535", "0.55382717", "0.55272627", "0.55004865", "0.54835...
0.78508526
0
Copy bootstrap files to project path.
def copy_bootstrap(path): os.makedirs(path, exist_ok=True) shutil.copyfile(os.path.join(OLIVER_PATH, 'static/css/bootstrap-theme.min.css'), os.path.join(path, 'css/bootstrap-theme.min.css')) shutil.copyfile(os.path.join(OLIVER_PATH, 'static/css/bootstrap.min.css'), os.path.join(path, 'css/bootstrap.min.cs...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bootstrap_development_distribution(project_name: str, dest_dir: Path):\n src_dir = Path(__file__).parent.parent.absolute()\n print(f\"Bootstrap: {src_dir} -> {dest_dir}\")\n shutil.copytree(\n src_dir,\n dest_dir,\n ignore=shutil.ignore_patterns(\n project_name.lower(),...
[ "0.6599318", "0.65507007", "0.6458174", "0.64305246", "0.62477404", "0.62408614", "0.6130951", "0.6073285", "0.60645944", "0.6008748", "0.59939706", "0.5964222", "0.5938451", "0.5926723", "0.59016085", "0.5899678", "0.5868144", "0.58241385", "0.5812965", "0.5791987", "0.57598...
0.7466384
0
Groups and aggregates the numeric values in a child dataframe by the parent variable.
def agg_numeric(df, parent_var, df_name): # Remove id variables other than grouping variable for col in df: if col != parent_var and 'SK_ID' in col: df = df.drop(columns = col) # Only want the numeric variables parent_ids = df[parent_var].copy() numeric_df = df....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def aggregate_intermediate_data_frame(self, node_name, child, child_df, edge_df):\n expr = []\n for n in child_df.schema.names:\n if n in self.parser.reducer_by_prop:\n if self.parser.reducer_by_prop.get(n) in [\"list\", \"set\"]:\n expr.append(\n ...
[ "0.6405845", "0.5659017", "0.5639334", "0.56020314", "0.55453014", "0.54367316", "0.5435871", "0.5343848", "0.53375214", "0.5327178", "0.53201914", "0.5232847", "0.51918155", "0.5142759", "0.51409286", "0.5138706", "0.5050446", "0.5015498", "0.49957687", "0.496422", "0.494899...
0.6909564
0
Aggregates the categorical features in a child dataframe for each observation of the parent variable.
def agg_categorical(df, parent_var, df_name): # Select the categorical columns categorical = pd.get_dummies(df.select_dtypes('category')) # Make sure to put the identifying id on the column categorical[parent_var] = df[parent_var] # Groupby the group var and calculate the sum and mean cat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def aggregate_intermediate_data_frame(self, node_name, child, child_df, edge_df):\n expr = []\n for n in child_df.schema.names:\n if n in self.parser.reducer_by_prop:\n if self.parser.reducer_by_prop.get(n) in [\"list\", \"set\"]:\n expr.append(\n ...
[ "0.5881424", "0.5792956", "0.5593468", "0.54979646", "0.547347", "0.53375316", "0.53190714", "0.52196026", "0.51966864", "0.51893455", "0.51737344", "0.51393646", "0.5125012", "0.50899655", "0.50812674", "0.50604707", "0.5032672", "0.4998905", "0.49879724", "0.4975688", "0.49...
0.6721816
0
Return size of dataframe in gigabytes
def return_size(df): return round(sys.getsizeof(df) / 1e9, 2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def size(self):\n\t\t# Better to have this as a method rather than property, as self._dataframe may change\n\t\treturn self._dataframe.shape[0]", "def sizeof(self):\n return DataFrameDefault.register(pandas.DataFrame.__sizeof__)(self)", "def get_size(self):\n return len(self.table)", "def get_t...
[ "0.7539217", "0.71868426", "0.71014214", "0.6981158", "0.69563097", "0.6928741", "0.68863845", "0.6873563", "0.6839056", "0.68301284", "0.6781674", "0.6780729", "0.6773887", "0.6764741", "0.675003", "0.6743411", "0.6720044", "0.67099255", "0.669466", "0.6680309", "0.6661846",...
0.91736096
0
Aggregate a dataframe with data at the loan level at the client level
def aggregate_client(df, group_vars, df_names): # Aggregate the numeric columns df_agg = agg_numeric(df, parent_var= group_vars[0], df_name = df_names[0]) # If there are categorical variables if any(df.dtypes == 'category'): # Count the categorical columns df_counts = agg_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def summarize_dat(totalData):\n import pandas as pd\n from numpy import log\n pkRed = totalData.loc[:, ['PEAK_NUM', 'pk_LON', 'pk_LAT', 'pk_maxCH4_AB', 'numtimes',\n 'min_read']].drop_duplicates().reset_index().loc[:,\n ['PEAK_NUM', 'pk_LON', 'pk_LAT', 'pk_maxCH4_AB...
[ "0.5899827", "0.58720815", "0.5583481", "0.55768025", "0.5478975", "0.5475994", "0.54546964", "0.54032886", "0.53741336", "0.5308893", "0.5267938", "0.5263674", "0.52354604", "0.51949954", "0.5189078", "0.51808757", "0.517462", "0.5159225", "0.5153163", "0.5148064", "0.513752...
0.7175305
0
Creates a bar graph based on the grades offered by the school
def grades_bargraph(self, plot_col, barWidth=1, title=None): try: self.grade_data_list except AttributeError: self._init_grade_data_list() if title == None: title = plot_col + ' by Grade' return(self.single_barplot_dfs_by_index(barWidth = 1, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exercise_5(self):\n student_data = self.student_data\n # Create a dictionary mapping subgroup values to colors\n palette_colors = {\"Rural\": \"green\", \"Urban\": \"blue\"}\n\n # Create a count plot of school with location subgroups\n sns.countplot(x=\"school\", data=student...
[ "0.64279497", "0.6255501", "0.61524636", "0.6041345", "0.60383916", "0.59868604", "0.5871553", "0.5851524", "0.584409", "0.5791879", "0.57609695", "0.57495725", "0.57449627", "0.57372385", "0.567651", "0.56719476", "0.56669927", "0.55731493", "0.5554168", "0.55427074", "0.553...
0.70252264
0
Creates a bar graph based on District and the plot column sent in
def dis_bargraph(self, plot_col, dollarticks_y = False): try: self.dis except AttributeError: self._init_dis() col = [self.dis.df[plot_col][i] for i in range(1,32+1)] return self.single_barplot(barWidth = 1.5, col = col, section_labels = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bar_plot(df_NP):\n cnt = Counter()\n for tax_list in df_NP.taxonomy:\n for tax in list(tax_list):\n if tax != 'no':\n cnt[tax] += 1\n plt.bar(cnt.keys(),cnt.values())\n plt.xlabel('taxonomic provenance')\n plt.ylabel('number of molecules')\n plt.title('number ...
[ "0.65744084", "0.621566", "0.6155076", "0.6126981", "0.6079038", "0.60530996", "0.6009262", "0.59919995", "0.5969284", "0.5936745", "0.591975", "0.58805853", "0.58365923", "0.58269864", "0.58184946", "0.5808916", "0.57855326", "0.5778091", "0.5773475", "0.57532036", "0.575217...
0.6771895
0
Creates a bar graph for all the different cities in the dataset
def city_bargraph(self, plot_col): try: self.cit except AttributeError: self._init_cit() col = [self.cit.df[plot_col][city] for city in self.city_names] self.single_barplot(col=col, section_labels=self.city_names, title=plot_col + ' by City', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_1d (cities):\n # find the first selected city\n city = None\n for c in cities:\n if 'selected' in c:\n city = c\n if not city:\n print('No city selected for plot_1d')\n return\n\n points_per_day = ('morn', 'day', 'eve', 'night')\n nb_per_day = len(points_p...
[ "0.66559434", "0.6537207", "0.6218424", "0.61415833", "0.60437536", "0.603769", "0.59898806", "0.5961996", "0.5961419", "0.59207594", "0.59090465", "0.58832794", "0.5798213", "0.5718343", "0.57025886", "0.5675946", "0.565777", "0.56253374", "0.5621214", "0.5612315", "0.560481...
0.73301643
0
Plots all the Ratings by the plot_col sent in
def all_ratings_barplot(self, plot_col, **kwargs): figwidth, figheight = self._set_multi_figs() graph_dict = { 0: { 'rating_col': 'Trust Rating', 'plot_col': plot_col }, 1: { 'rating_col': 'Rigorous Instruction Rating', 'plot_col': plot_col }, 2: { ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_raw_data(ratings, pl = True):\n # do statistics.\n num_items_per_user = np.array((ratings != 0).sum(axis=0)).flatten()\n num_users_per_item = np.array((ratings != 0).sum(axis=1).T).flatten()\n sorted_num_movies_per_user = np.sort(num_items_per_user)[::-1]\n sorted_num_users_per_movie = np.s...
[ "0.6303508", "0.61682445", "0.61404604", "0.6060701", "0.6025423", "0.59798723", "0.597201", "0.597201", "0.5925109", "0.5855288", "0.58538806", "0.5811949", "0.56399864", "0.5629649", "0.5628397", "0.5626872", "0.56191844", "0.5562137", "0.5556041", "0.55535656", "0.5542159"...
0.75106126
0
Test salt.states.pdbedit.absent when user is already absent
def test_generate_absent(self): name = "testname" cmd_ret = {"pid": 13172, "retcode": 0, "stdout": "", "stderr": ""} with patch.dict(pdbedit.__salt__, {"pdbedit.list": pdbedit_mod.list_users}): with patch.dict( pdbedit_mod.__salt__, {"cmd.run_all": MagicMock(return_va...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_bad_student(self):\r\n staff_page = self._goto_staff_page()\r\n staff_page.answer_problem()\r\n\r\n staff_debug_page = staff_page.open_staff_debug_info()\r\n staff_debug_page.delete_state('INVALIDUSER')\r\n msg = staff_debug_page.idash_msg[0]\r\n self.assertEqual(...
[ "0.6264558", "0.6153602", "0.6065998", "0.5910771", "0.5907491", "0.5848986", "0.5840648", "0.5784793", "0.57658625", "0.5742423", "0.5739113", "0.57173777", "0.5696082", "0.5678233", "0.5672122", "0.5670082", "0.56599903", "0.5638567", "0.5636633", "0.5634852", "0.56236583",...
0.73469025
0
Activate the latexaccess settings stored in file. Consult the actual function definition in settings.py for details and documentation.
def activateSettings (self): settings.loadSettings (os.path.expanduser(self.filename)) self.nemeth_translator=settings.brailleTableToUse () return settings.activateSettings ({"braille":self.nemeth_translator,"speak":self.speech_translator,"preprocessor":self.preprocessor})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def activateSettings ():\r\n global n # handle to the braille translator\r\n # Paths pointing to potential configuration files.\r\n configFilePaths=(os.path.expanduser(\"~/.latex-access\"), \"/etc/latex-access.conf\")\r\n for configFile in configFilePaths:\r\n if os.path.exists (configFile):\r\n...
[ "0.7660193", "0.56286865", "0.55798304", "0.54697657", "0.5323892", "0.5308821", "0.5260642", "0.52453375", "0.51649904", "0.51433796", "0.51357913", "0.50250113", "0.501552", "0.4969897", "0.4969882", "0.49596834", "0.49330676", "0.4925036", "0.4924721", "0.4892674", "0.4889...
0.68447345
1
Returns the biggest level L such that 2L <= min(data.shape).
def max_level(data: np.ndarray) -> int: shape = data.shape[1:] # exclude channel dimension return min(shape).bit_length() - 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def max_level(self):\n return self.__max", "def rough_l_max(L):\r\n # TODO: Check if L is sparse or not, and handle the situation accordingly\r\n\r\n l_max = np.linalg.eigvalsh(L.todense()).max()\r\n\r\n\r\n l_max_ub = 1.01 * l_max\r\n return l_max_ub", "def est_maxlevel(dims,bandwidth):\n ...
[ "0.6758998", "0.6721723", "0.6686649", "0.6608053", "0.6595378", "0.6529461", "0.6303419", "0.6294639", "0.6193048", "0.6193048", "0.61896706", "0.61675924", "0.6162399", "0.6122396", "0.6087327", "0.6061966", "0.6022759", "0.60093987", "0.59859574", "0.594151", "0.5902914", ...
0.76993465
0
Check that the test callable has a level parameter. If not, it wraps test with a callable that does accept level.
def _check_test( test: Callable[[np.ndarray, np.ndarray], np.ndarray[bool]] | Callable[[np.ndarray, np.ndarray, int], np.ndarray[bool]], ) -> Callable[[np.ndarray, np.ndarray, int], np.ndarray[bool]]: signature = inspect.signature(test) if "level" in signature.parameters: return test def te...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_level_width_is_callable(self):\n self.assertTrue(callable(level_width))", "def requires_calc_level(level):\n def wrapper(f):\n @wraps(f)\n def wrapped(self, *f_args, **f_kwargs):\n if self.calc_level < level:\n if not self.quiet:\n pri...
[ "0.6848462", "0.67685944", "0.6077892", "0.60152423", "0.60152423", "0.60152423", "0.5961046", "0.5934465", "0.58914024", "0.5838351", "0.57919294", "0.5690322", "0.5619783", "0.5519705", "0.55192703", "0.5516738", "0.5495598", "0.5488296", "0.54877627", "0.5459896", "0.54275...
0.7827714
0
Create a wavelengthrange reference file. Supply a filter range dictionary keyed on order or use the default
def create_grism_waverange(outname="", history="Ground NIRCAM Grismwavelengthrange", author="STScI", filter_range=None): ref_kw = common_reference_file_keywords(reftype="wavelengthrange", tit...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def use_w(args):\n try:\n bounddata = Table.read(\n f'./Input/UseWv/WaveRegions_{args.WRegion}_{args.band}.csv',\n format='csv')\n except IOError:\n sys.exit(\n f'WaveRegions FILE \"./Input/UseWv/WaveRegions'\n '_{args.WRegion}_{args.band}.csv\" N...
[ "0.5970843", "0.55526656", "0.55398667", "0.524666", "0.50919276", "0.5088043", "0.5058544", "0.50419027", "0.5036173", "0.50325483", "0.5000166", "0.49375093", "0.4928301", "0.49178305", "0.4885408", "0.48761797", "0.48269498", "0.48242816", "0.48125654", "0.4807627", "0.480...
0.6631038
0
Designed to take as input the dictionary created by dict_from_file and for nircam, split out and accumulate the keys for each beam/order. The keys must have the beam in their string, the spurious beam designation is removed from the returned dictionary. Keywords with the same first name in the underscore separated stri...
def split_order_info(keydict): if not isinstance(keydict, dict): raise ValueError("Expected an input dictionary") # has beam name fits token token = re.compile('^[a-zA-Z]*_(?:[+\-]){0,1}[a-zA-Z0-9]{0,1}_*') rangekey = re.compile('^[a-zA-Z]*_[0-1]{1,1}$') rdict = dict() # return dictionary...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_required_keywords_from_original():\n required_keywords = {}\n f = open('required_keywords.txt', 'r')\n curr_instrument = \"\"\n for line in f:\n if line[-2:] == \":\\n\":\n instrument = line[:-2]\n curr_instrument = instrument\n if instrument not in requi...
[ "0.5961436", "0.5756927", "0.5614604", "0.5552414", "0.55262214", "0.55095243", "0.54953116", "0.547571", "0.54471046", "0.5443385", "0.54416037", "0.5385698", "0.5379856", "0.53514105", "0.53469867", "0.5271564", "0.5262891", "0.525804", "0.5241439", "0.5231174", "0.5230212"...
0.73885834
0
Helper function to get the width of an intervaltree. Interval in inches.
def get_interval_width(interval, points_per_inch=72): return (interval.end - interval.begin) / points_per_inch
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getRangeInches(self) -> float:\n ...", "def getWidth(self):\n area = self.getArea()\n length = self.getLength()\n return area / length", "def calculate_width(self):\n return self.endX - self.startX", "def width(self):\n self._updateExtents()\n return self....
[ "0.67200017", "0.6389745", "0.635875", "0.6339206", "0.63279945", "0.6293627", "0.6269636", "0.6257028", "0.6251801", "0.6228675", "0.6223224", "0.6214839", "0.62135017", "0.6186402", "0.61589587", "0.61436427", "0.61424446", "0.61303717", "0.61303717", "0.6130295", "0.612434...
0.8180913
0
Takes params and builds a dict with the geometry settings
def params_to_geometry(params): geometry = {} for i, var in enumerate(PARAMS_SPACE): if var.name == 'col_frac_left': leftcol = int(round(100*params[i])) geometry['leftcol'] = leftcol geometry['rightcol'] = 100 - leftcol elif var.name == 'margin': g...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_vol_geom(*varargin):\n vol_geom = {'option': {}}\n # astra_create_vol_geom(row_count)\n if len(varargin) == 1 and isinstance(varargin[0], int) == 1:\n vol_geom['GridRowCount'] = varargin[0]\n vol_geom['GridColCount'] = varargin[0]\n # astra_create_vol_geom([row_count col_count]...
[ "0.613657", "0.5988286", "0.59513026", "0.5948562", "0.59466225", "0.594484", "0.59289175", "0.59200495", "0.58901006", "0.58046836", "0.5774169", "0.57739556", "0.5765474", "0.56805974", "0.56087965", "0.5600253", "0.55994374", "0.55930686", "0.5569176", "0.55588317", "0.555...
0.7735505
0
Subtract ingredients from the resources.
def make_coffee(drink, ingredients): for item in ingredients: resources[item] -= ingredients[item] print(f"Here is your {drink}. Enjoy!")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def makecoffee(drink_name, ingredients):\n for item in ingredients:\n resources[item] -= ingredients[item]\n print(f\"Please enjoy your {drink_name}\")", "def make_cup(drink_name, order_ingredients):\n for item in order_ingredients:\n resources[item] -= order_ingredients[item]\n print(f...
[ "0.65578175", "0.64536124", "0.630242", "0.60667235", "0.60218954", "0.6020807", "0.58641", "0.5725307", "0.5675901", "0.5581495", "0.55647224", "0.5550156", "0.5480233", "0.5480233", "0.5480233", "0.5406905", "0.52944106", "0.5247268", "0.52106005", "0.5186231", "0.5167943",...
0.6647779
0
Handle setting the status complete on failure
def handle_set_status_complete_fail(self, event: Any): #execution_id = event['execution_id'] return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def indicate_failure(self):\n pass", "def on_failure(self):\n pass", "def handle_set_status_complete_success(self, event: Any):\n #execution_id = event['execution_id']\n return None", "def set_test_failed(self):\n self.set_result(Status.FAILED)", "def _set_status(self, st...
[ "0.7089453", "0.6841502", "0.67423695", "0.6737847", "0.6659803", "0.6633483", "0.66202384", "0.6602571", "0.65985835", "0.65885085", "0.64517546", "0.6447539", "0.6438641", "0.6421384", "0.64168215", "0.6366359", "0.6364409", "0.6360104", "0.63111556", "0.6283461", "0.628346...
0.74932075
0
Handle setting the status complete on success
def handle_set_status_complete_success(self, event: Any): #execution_id = event['execution_id'] return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def notify_complete(self, status=\"Done\") -> None:\n\n self.progress = 100\n self.update(status)", "def mark_as_done(self):\n self.status = \"DONE\"", "def state_finalStatus(self, fileObj):\n if self.fillResponseBuffer(fileObj, 4):\n status = struct.unpack(\"<I\", self.r...
[ "0.74431217", "0.7173549", "0.70302624", "0.7006268", "0.69710594", "0.69074273", "0.68972147", "0.6856348", "0.683755", "0.68330353", "0.6806789", "0.6754385", "0.674682", "0.66901946", "0.6684364", "0.66484624", "0.66245276", "0.66245276", "0.66245276", "0.66245276", "0.662...
0.75193006
0
Returns a sorted list of json files in path.
def list_files(path): return list(sorted([f for f in os.listdir(path=path) if f.endswith('.json')]))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_json_files(path: Path) -> list[Any]:\n return [load_json(p) for p in path.glob('*.json')]", "def ls_json(directory):\n return_list = [\n f for f in os.listdir(directory) if f.endswith(\".json.gz\")\n ]\n return_list.sort()\n return return_list", "def get_all_json_files_in_dir...
[ "0.77437764", "0.744067", "0.7308948", "0.7188102", "0.71667", "0.71616673", "0.7077415", "0.69726586", "0.684269", "0.6764997", "0.67370605", "0.6733643", "0.6685426", "0.66846746", "0.6636008", "0.6634397", "0.65690386", "0.65448153", "0.65280855", "0.6521011", "0.6498378",...
0.85874534
0
Extracts the locations from the spoiler logs dicts and checks whether the json files are spoiler logs.
def extract_locations(spoiler_logs): locations = [] for log in spoiler_logs: # loop to check the spoiler log with try-except try: locations.append(log['locations']) except KeyError: print("Invalid spoiler log ...") return locations
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_logs(path, n=1000, from_=0, to=1000):\n assert from_ < to, 'from_ must be smaller than to'\n json_files = list_files(path=path)\n nb_files = n if n <= len(json_files) else len(json_files)\n json_files = json_files[:nb_files]\n \n spoiler_logs = extract_json(path, json_files)\n \n ...
[ "0.5864885", "0.56441116", "0.5583917", "0.53947806", "0.5368058", "0.5350979", "0.52808344", "0.52800953", "0.5195371", "0.51938814", "0.5161817", "0.51347166", "0.5084448", "0.5026799", "0.5015924", "0.4993269", "0.49874437", "0.49871245", "0.498361", "0.49794728", "0.49526...
0.78657186
0