query
stringlengths
10
2k
document
stringlengths
20
51.2k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
returns x^e mod m
def modulo_exp(x: int, e: int, m: int) -> int: X = x E = e Y = 1 while E > 0: if E % 2 == 0: X = (X * X) % m E = E / 2 else: Y = (X * Y) % m E = E - 1 return Y
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def modinv(a, m):\n g, x, y = egcd(a, m)\n if g != 1:\n raise Exception('modular inverse does not exist')\n else:\n return x % m", "def computePow (m,n,e):\n p = m # p will hold m^{2^j}\n r = 1 # r is the result\n while ( e > 0):\n if (e %2 == 1):\n r = (r * p)%n...
[ "0.77618134", "0.73800933", "0.73720944", "0.7367118", "0.7336699", "0.7270356", "0.7231597", "0.7227261", "0.72020775", "0.7172352", "0.7125868", "0.712268", "0.7120021", "0.7046479", "0.6995632", "0.69825965", "0.6939103", "0.6901672", "0.68617284", "0.6860597", "0.681716",...
0.82136214
0
Test an authenticated GET request to '/api/edit/' route.
def test_authenticated_get(self): url = reverse('edit-list') # authenticate the user self.login_user() # attemot the get response = self.client.get(url) self.assertEqual(200, response.status_code) self.assertEqual('OK', response.status_text)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_edit(self):\n response = self.get('/study/edit/1')\n self.assertEqual(response.code, 200)\n self.assertNotEqual(str(response.body), \"\")", "def test_unauthenticated_get(self):\n url = reverse('edit-list')\n\n response = self.client.get(url)\n self.assertEqu...
[ "0.74603575", "0.71756166", "0.6856432", "0.6835556", "0.6751757", "0.6749755", "0.66705084", "0.6666924", "0.6665174", "0.66029817", "0.6583607", "0.6583607", "0.6567011", "0.65654224", "0.6564242", "0.65298873", "0.6508791", "0.64519", "0.64493906", "0.6438354", "0.6398379"...
0.7706011
0
Test unauthenticateed GET request to '/api/edit/' route.
def test_unauthenticated_get(self): url = reverse('edit-list') response = self.client.get(url) self.assertEqual(403, response.status_code) self.assertEqual('Forbidden', response.status_text) self.assertTrue( 'credentials were not provided.' in response.data.get('deta...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_request_should_not_work(self):\n response = self.client.get(reverse('user-list'))\n self.assertEqual(response.status_code, status.HTTP_405_METHOD_NOT_ALLOWED)", "def test_get_unauthenticated(self):\n del self.client.request_kwargs['auth']\n self.verify_get_response(self.c...
[ "0.7277791", "0.72487885", "0.7220945", "0.7091226", "0.69987005", "0.6996893", "0.6975998", "0.6964022", "0.6945057", "0.6941246", "0.6902181", "0.6893428", "0.6880922", "0.6811421", "0.67871207", "0.67709994", "0.6745298", "0.6745167", "0.6714094", "0.671361", "0.6678392", ...
0.8011483
0
Returns data from YAML file
def LoadYaml(path): #NOTE(g): Import is done here, instead of the top of the file, to not require this module if it is not used import yaml fp = None try: fp = open(path) data = yaml.load(fp) finally: if fp: fp.close() return data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_yaml(file):\n with open(file, 'r') as file:\n data = yaml.safe_load(file)\n return data", "def input_data(self):\n return read_yaml(self.file_path)", "def _load_data_yaml(self, pathname): \n pathname = self._yaml_extension(pathname)\n\n with open(pathname) as f...
[ "0.7411979", "0.73919797", "0.73073447", "0.727959", "0.72240406", "0.7206825", "0.7061394", "0.7040566", "0.70256674", "0.70217174", "0.69758844", "0.6975274", "0.696519", "0.6957341", "0.69525087", "0.6927362", "0.6901285", "0.6883409", "0.68753177", "0.6875066", "0.6873311...
0.7006065
10
Returns textual YAML from data
def DumpYaml(data): #NOTE(g): Import is done here, instead of the top of the file, to not require this module if it is not used import yaml text = yaml.safe_dump(data) return text
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dump(data):\n stream = StringIO()\n yaml.dump(data, stream, Dumper=yaml.RoundTripDumper)\n return stream.getvalue().rstrip()", "def to_content(cls, data: Mapping) -> str:\n cls._check_yaml()\n s = yaml.safe_dump(data, default_flow_style=False)\n s = '---\\n' + s\n return ...
[ "0.7758485", "0.75545096", "0.755083", "0.72594833", "0.7180453", "0.70795083", "0.70387435", "0.69264066", "0.6889537", "0.68860036", "0.6810295", "0.6696815", "0.66957206", "0.66270345", "0.6621601", "0.65453994", "0.6516874", "0.64137805", "0.63969934", "0.6394415", "0.632...
0.81712455
0
Resize and center image to max bounds If ratios are different, fill with `fill` (default None, transparency) image is PIL.Image object, so is returned value
def autofit_fill(image, dest_w, dest_h, fill=None): x0, y0, x1, y1 = max_bounds(dest_w, dest_h, image.size[0], image.size[1]) if fill is None: fill_color = (255, 255, 255, 0) # transparency else: fill_color = fill + (255, ) # solid canvas = Image.new(mode='RGBA', size=(dest_w, dest_h),...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stretch_image(img, max_val):\n\n @_decorate_validation\n def validate_input():\n _numeric('img', 'floating', shape=(-1, -1))\n _numeric('max_val', ('integer', 'floating'), range_='(0;inf)')\n\n validate_input()\n\n min_ = img.min()\n max_ = img.max()\n\n if max_ > min_:\n ...
[ "0.6617564", "0.6578692", "0.6465079", "0.6354953", "0.6286622", "0.6265972", "0.6234316", "0.62103504", "0.6176447", "0.6122636", "0.60962164", "0.6090722", "0.6021135", "0.6012989", "0.5978036", "0.59551686", "0.5954757", "0.5921902", "0.58571124", "0.5856888", "0.5856444",...
0.0
-1
Returns the token value for a ClientLoginToken. Reads the token from the server's response to a Client Login request and creates the token value string to use in requests.
def get_client_login_token_string(http_body): for response_line in http_body.splitlines(): if response_line.startswith('Auth='): # Strip off the leading Auth= and return the Authorization value. return response_line[5:] return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetToken(self):\n if self.auth_token_:\n return self.auth_token_\n raise RuntimeError('ClientLoginAuthPolicy is not logged in.')", "def _get_token() -> str:\n username = si.get_env_var(\"EODDATA_USERNAME\")\n password = si.get_env_var(\"EODDATA_PASSWORD\")\n\n _LOG.info(\"Logging into EOD...
[ "0.66343063", "0.6560703", "0.65581447", "0.6484823", "0.64780766", "0.63888884", "0.63565564", "0.6352307", "0.6339977", "0.6307415", "0.6282628", "0.6282628", "0.6282628", "0.6212494", "0.6204946", "0.6202248", "0.6199305", "0.6199305", "0.61532557", "0.6135001", "0.6105996...
0.6471538
5
cards is str type
def check_card_type(cards): if isinstance(cards, str): cards = str2cards(cards) if not isinstance(cards, list): return False, None sorted_cards = sort_cards(cards) value = Doudizhu.DATA.get(cards2str(sorted_cards)) if value is None: return Fals...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cards_to_str(cards):\n cards_list = []\n for c in cards:\n cards_list.append(c.get_str())\n return cards_list", "def print_cards(cards):\r\n string = ''\r\n for c in cards:\r\n suit = c[0]\r\n if suit == 1:\r\n suit = \"\\u2665\" # heart\r\n elif suit == ...
[ "0.7256349", "0.6764489", "0.6617614", "0.65662724", "0.65662724", "0.6515188", "0.6456979", "0.6438798", "0.6424895", "0.6388091", "0.6287316", "0.62371194", "0.6211511", "0.62098175", "0.6202915", "0.6198513", "0.6191678", "0.6184957", "0.6150248", "0.6145743", "0.6139556",...
0.596934
28
L2normalize columns of X
def l2norm(X): norm = np.linalg.norm(X, axis=1, keepdims=True) return 1.0 * X / norm
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def l2_normalize(data, eps, axis=None):\n return cpp.nn.l2_normalize(data, eps, axis)", "def normalize_l2(x):\n return x / (npla.norm(x))", "def L2_normalize(xx):\r\n\tZx = compute_L2_normalization(xx)\r\n\treturn xx / np.sqrt(Zx[:, np.newaxis])", "def normalizeRows(x):\n\n ### YOUR CODE HERE\n #...
[ "0.76127386", "0.74197316", "0.72367084", "0.7202008", "0.7162083", "0.7133827", "0.70338094", "0.69962883", "0.6908121", "0.69054306", "0.6894549", "0.6815722", "0.6789521", "0.6779976", "0.67509", "0.6738499", "0.6678439", "0.66768813", "0.6676479", "0.665484", "0.665484", ...
0.66763866
19
Calculate average end point error (a.k.a. EPEall, 'all' as for all pixels in the image)
def flow_error(tu, tv, u, v): smallflow = 0.0 ''' stu = tu[bord+1:end-bord,bord+1:end-bord] stv = tv[bord+1:end-bord,bord+1:end-bord] su = u[bord+1:end-bord,bord+1:end-bord] sv = v[bord+1:end-bord,bord+1:end-bord] ''' stu = tu[:] stv = tv[:] su = u[:] sv = v[:] idxUnknow...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc_epe_stat(flow, ground_truth):\n epe = calc_end_point_error(flow, ground_truth)\n\n return (np.mean(epe),\n np.std(epe),\n np.sum(epe > 0.5)/epe.size * 100,\n np.sum(epe > 1.0)/epe.size * 100,\n np.sum(epe > 2.0)/epe.size * 100)", "def average_error(self,...
[ "0.676861", "0.6471946", "0.64455485", "0.64113706", "0.63658243", "0.6360693", "0.62717247", "0.6269962", "0.62403154", "0.6209257", "0.62079763", "0.6204396", "0.61982054", "0.6184807", "0.61778194", "0.61603117", "0.61334854", "0.60988224", "0.60933465", "0.60900396", "0.6...
0.0
-1
Converts flow to 3channel color image.
def flow_to_color(flow, mask=None, max_flow=-1): n = 8 height, width, _ = flow.shape mask = np.ones([height, width, 1]) if mask is None else mask flow_u, flow_v = flow[:, :, 0], flow[:, :, 1] if max_flow > 0: max_flow = np.max((max_flow, 1.)) else: max_flow = np.max(np.abs(flow *...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flow_to_image(flow):\n out = []\n maxu = -999.\n maxv = -999.\n minu = 999.\n minv = 999.\n maxrad = -1\n for i in range(flow.shape[0]):\n u = flow[i, :, :, 0]\n v = flow[i, :, :, 1]\n idxunknow = (abs(u) > 1e7) | (abs(v) > 1e7)\n u[idxunknow] = 0\n v[idx...
[ "0.6582053", "0.6278282", "0.62068164", "0.6200359", "0.6102226", "0.602159", "0.5981555", "0.5971707", "0.5934091", "0.58711046", "0.5869604", "0.5819569", "0.5813481", "0.5799363", "0.5781338", "0.5740127", "0.5738435", "0.57129496", "0.5663482", "0.55947", "0.5590835", "...
0.6213894
2
The cumulative distribution function (CDF) of the data.
def cdf(self, data, survival=False, **kwargs): data = np.array(data) if not data.any(): return array([np.nan]), array([np.nan]) #data = trim_to_range(data, xmin=xmin, xmax=xmax) n = float(len(data)) data = np.sort(data) all_unique = not( any( data[:-1]==da...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cdf(self,x):\n if hasattr(x,'__len__'):\n returnCdf = np.array([self.cdf(i) for i in x])\n else:\n returnCdf = self._distribution.cdf(x)\n return returnCdf", "def getCDF(self):\n return self.cdfSample", "def cdf(self,x):\n if self.method == 'spline':\n coordinate = distrib...
[ "0.8312398", "0.8069242", "0.7966937", "0.79368794", "0.79368794", "0.79343504", "0.79070044", "0.7878156", "0.75872463", "0.75343543", "0.7483361", "0.74508965", "0.74177235", "0.7412769", "0.7353442", "0.7325215", "0.71242255", "0.7082983", "0.70690787", "0.7054519", "0.705...
0.72157747
16
Returns the probability density function (normalized histogram) of the data.
def pmf(self, data=None, linear_bins=False, xmin=None, xmax=None, **kwargs): if data is None: data = self.data data = np.asarray(data) if not xmax: xmax = np.max(data) if not xmin: xmin = np.min(data) if xmin < 1: #To compute the pdf also fr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def probability_density(self, X):\n raise NotImplementedError", "def density(self, x):\n\t\tN = len(self.train_data)\n\t\tpoints = list(self.train_data)\n\t\tdists = [np.linalg.norm(x-point)**2 for point in points]\n\t\texps = [np.exp(-dist / (2 * (self.bandwidth ** 2))) for dist in dists]\n\t\tunnormaliz...
[ "0.7401939", "0.7332015", "0.70409703", "0.6828579", "0.6819409", "0.65929025", "0.6396415", "0.63840675", "0.63405675", "0.63214135", "0.63103414", "0.6301953", "0.62734354", "0.6264197", "0.62366116", "0.6235056", "0.6226968", "0.6219993", "0.61587846", "0.61575365", "0.613...
0.61521846
20
Mock valid climacell config flow setup.
def climacell_config_flow_connect(): with patch( "homeassistant.components.climacell.config_flow.ClimaCell.realtime", return_value={}, ): yield
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mock_config():\n from .. import config\n\n _old_fs = os.getenv('FREESURFER_HOME')\n if not _old_fs:\n os.environ['FREESURFER_HOME'] = mkdtemp()\n\n filename = Path(pkgrf('fmriprep', 'data/tests/config.toml'))\n settings = loads(filename.read_text())\n for sectionname, configs in settin...
[ "0.69582886", "0.6873422", "0.6871681", "0.6709498", "0.6637577", "0.6511983", "0.6507525", "0.648652", "0.6476719", "0.6473631", "0.6472812", "0.64642954", "0.64637196", "0.64525974", "0.63963526", "0.63782156", "0.63611716", "0.634602", "0.6336725", "0.63268924", "0.6303397...
0.0
-1
Mock valid climacell config entry setup.
def climacell_config_entry_update_fixture(): with patch( "homeassistant.components.climacell.ClimaCell.realtime", return_value={}, ), patch( "homeassistant.components.climacell.ClimaCell.forecast_hourly", return_value=[], ), patch( "homeassistant.components.climacell....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mock_config_entry() -> MockConfigEntry:\n return MockConfigEntry(\n domain=DOMAIN,\n title=DEFAULT_TITLE,\n unique_id=DEFAULT_UNIQUE_ID,\n data=CONFIG,\n options=None,\n )", "def mock_config_entry() -> MockConfigEntry:\n return MockConfigEntry(\n title=\"hom...
[ "0.73159343", "0.7237302", "0.7198707", "0.6937859", "0.6917505", "0.6917299", "0.68804663", "0.6829887", "0.6797196", "0.6768501", "0.6718456", "0.6712674", "0.668805", "0.66720724", "0.66330284", "0.6630312", "0.6620679", "0.65885454", "0.6584296", "0.65566015", "0.655377",...
0.0
-1
Check if exception is raised if from input format is invalid.
def test_invalid_from_input_format(self): pandoc_default_files = [ os.path.join( TEST_DEFAULT_FILES_PATH, "invalid_from_input_format.yaml" ) ] settings = get_settings(PANDOC_DEFAULT_FILES=pandoc_default_files) pandoc_reader = PandocReader(setting...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_readbadformat(self):\n\n self.assertRaises(ParseError, self.hw, self.badfile)", "def validate_format(self):\n raise NotImplementedError()", "def _raise_format_error(self, name: str, format_str: str, source_format: str):\n\n raise ValueError(f\"The '{ name }' should be { format_str...
[ "0.7076024", "0.6856705", "0.68443424", "0.67795557", "0.66482705", "0.65584666", "0.65584666", "0.65507966", "0.65463793", "0.6518664", "0.6516572", "0.6499935", "0.64181614", "0.64066964", "0.6392288", "0.63600343", "0.63571525", "0.63563573", "0.635571", "0.6344534", "0.63...
0.6691419
4
Return a SphinxWriter containing the rST for the given feature file.
def feature_to_rst( source_path: pathlib.Path, root_path: pathlib.Path, feature_parser: str = "behave", get_url_from_tag: Optional[Callable] = None, get_url_from_step: Optional[Callable] = None, integrate_background: bool = False, background_step_format: str = "{}", raw_descriptions: boo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _write_feature(self, feature, rec_id, out_handle):\n if feature.strand == 1:\n strand = '+'\n elif feature.strand == -1:\n strand = '-'\n else:\n strand = '.'\n # remove any standard features from the qualifiers\n quals = feature.qualifiers.co...
[ "0.58863276", "0.5131135", "0.5094758", "0.5020256", "0.5017759", "0.48758158", "0.48743612", "0.4874202", "0.48263675", "0.48243678", "0.48140782", "0.48072454", "0.47351438", "0.4732037", "0.47241306", "0.46937355", "0.46621343", "0.4613593", "0.45948058", "0.4591444", "0.4...
0.6277406
0
Get Type of Event
def type_of_event_22B(self): type_of_event = FFXMMConfirmationOutUtils_Override.get_event_type_MT330(self.acm_obj) return type_of_event
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_event_type(event):\n return event.type()", "def _get_event_type(event):\n return event.type()", "def get_type(self):\n return self.event_type", "def event_type(self) -> int:\n return self.data[\"args\"][\"eventType\"]", "def type(self) -> str:\n return self._even...
[ "0.9039561", "0.9039561", "0.8968464", "0.86296123", "0.82592815", "0.79184973", "0.78151655", "0.77471405", "0.76145095", "0.74922657", "0.7464918", "0.7428743", "0.7311547", "0.71165574", "0.70780694", "0.7017133", "0.6817698", "0.67291504", "0.6687107", "0.6675605", "0.666...
0.6211328
43
Determine the joker usage of this player, where exemptions are given a certain joker value.
def joker_usage(self, exemption_value: int) -> int: return exemption_value if self.immunity else self.jokers
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_value(self, hand):\n global FACE_CARDS\n #could refactor the 2 hand possiblities into methods of a Dealer and Player Class\n if hand == \"player\":\n if self.player_hand[-1].value in FACE_CARDS:\n self.player_value += 10\n elif self.player_han...
[ "0.58364624", "0.575141", "0.55857944", "0.5526583", "0.5501216", "0.539533", "0.53563464", "0.535569", "0.53516", "0.5311092", "0.523309", "0.5183501", "0.51636785", "0.51541847", "0.5147182", "0.51385343", "0.50707763", "0.5070622", "0.5070622", "0.50516206", "0.50038177", ...
0.815206
0
Syntax sugar for accessing the current config instance.
def from_databand_context(cls, name=None): from dbnd._core.current import get_databand_context if not name: if cls._conf__task_family: # using the current cls section name to get the current instance of a class name = cls._conf__task_family else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def config(self):\n return self.namespace['config']", "def config(self):\n return self._config", "def _get_config(self):\n return self.__config", "def _get_config(self):\n return self.__config", "def _get_config(self):\n return self.__config", "def _get_config(self):\n return self.__con...
[ "0.7732577", "0.7716242", "0.7702904", "0.7702904", "0.7702904", "0.7702904", "0.7702904", "0.7702904", "0.7702904", "0.7702904", "0.7702904", "0.7702904", "0.7702904", "0.7702904", "0.7702904", "0.7702904", "0.7702904", "0.7702904", "0.7702904", "0.7702904", "0.7702904", "...
0.0
-1
Retrieve the value of a symbol. If it does not yet exist, assign it the value of self.symbol_counter and increment self.symbol_counter.
def get(self, symbol): if symbol not in self.symbol_map: self.symbol_map[symbol] = self.symbol_counter self.symbol_counter += 1 return self.symbol_map[symbol]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getSymbolValue(self) -> int:\n ...", "def _get_address(self, symbol):\n if symbol.isdigit():\n \n return symbol\n else:\n if not self.symbols_table.contains(symbol):\n self.symbols_table.add_entry(symbol, self.symbol_address)\n ...
[ "0.7505889", "0.67904294", "0.6708682", "0.65858257", "0.6525912", "0.6356913", "0.63366395", "0.62767935", "0.6263043", "0.62340844", "0.622327", "0.61353004", "0.6081971", "0.5996735", "0.5991955", "0.5976109", "0.59754443", "0.5957946", "0.5954517", "0.5945833", "0.5945295...
0.84746516
0
Open a browser tab showing single
def _open_browser(self, single_doc_html): url = os.path.join( "file://", DOC_PATH, "build", "html", single_doc_html ) webbrowser.open(url, new=2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def open_tab(self, url):\n orig_handles = self.driver.window_handles\n\n if mozinfo.os == \"mac\":\n self.driver.find_element_by_tag_name(\n 'body').send_keys(Keys.COMMAND + \"t\")\n else:\n self.driver.find_element_by_tag_name(\n 'body').sen...
[ "0.7756085", "0.7722199", "0.7556339", "0.7513065", "0.7471108", "0.74636674", "0.7443533", "0.7296394", "0.7287611", "0.72752327", "0.7197633", "0.71591455", "0.7093839", "0.7073787", "0.70440507", "0.7039261", "0.7020562", "0.6931634", "0.69233656", "0.6906186", "0.6898574"...
0.65999377
36
Looks up a component configuration setting.
def setting(self, config, name, default=None): return config.get(name, default) if config else default
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lookup(self, name):\n for config in self._config:\n if name in config:\n return config[name]\n raise AttributeError(\"%s not found\" % name)", "def get_config(param):\n _config = loadConfig()\n try:\n click.echo(f\"{param}={rgetattr(_config, param)}\")\n ...
[ "0.6656505", "0.63403267", "0.6328603", "0.6307622", "0.6270947", "0.62521553", "0.62230664", "0.62032765", "0.61798537", "0.6170165", "0.6131152", "0.6082774", "0.60715026", "0.6070269", "0.6048063", "0.6040495", "0.6022426", "0.5985675", "0.5970957", "0.59675246", "0.595320...
0.0
-1
Splits text on commas and returns a list.
def split(self, text): return [x.strip() for x in text.split(",")]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse(text):\n # Make sure that there's text to be split\n if text == None:\n return text\n return text.split(',')", "def split(text, delim=','):\n return [x.strip() for x in text.split(delim)]", "def split_by_comma(s):\n return s.strip().split(\",\")", "def separate_comma(s):\n ...
[ "0.8104706", "0.7714697", "0.7410554", "0.71497846", "0.69168514", "0.68710077", "0.6836202", "0.6800617", "0.6775104", "0.6670574", "0.65933233", "0.6575576", "0.6561537", "0.6546084", "0.65120304", "0.6483095", "0.6468458", "0.6465695", "0.6455105", "0.6450798", "0.6428575"...
0.8560528
0
Return the keys of dictionary d sorted by value.
def keys_sorted_by_value(d): # By Daniel Schult, 2004/01/23 # http://aspn.activestate.com/ASPN/Python/Cookbook/Recipe/52306 items=d.items() backitems=[ [v[1],v[0]] for v in items] backitems.sort() return [ backitems[i][1] for i in range(0,len(backitems))]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def keys_sorted_by_value_unique(d, **sort_kwargs):\n values = d.values()\n values.sort(**sort_kwargs)\n i = inverse(d)\n return [i[val] for val in values]", "def dict_keys(d):\n return list(d.keys())", "def get_dictionary_keys(self,dictionary):\r\n return sorted(dictionary)", "def sorte...
[ "0.7648055", "0.7574371", "0.72671735", "0.71819156", "0.7030882", "0.6914503", "0.6819046", "0.6806462", "0.6724049", "0.6625385", "0.6591414", "0.65574574", "0.6536147", "0.648512", "0.6432345", "0.6382336", "0.6357224", "0.63272214", "0.6273491", "0.6218116", "0.6178627", ...
0.83248097
0
Return the keys of d, sorted by value. The values of d must be unique (see inverse)
def keys_sorted_by_value_unique(d, **sort_kwargs): values = d.values() values.sort(**sort_kwargs) i = inverse(d) return [i[val] for val in values]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def keys_sorted_by_value(d):\n # By Daniel Schult, 2004/01/23\n # http://aspn.activestate.com/ASPN/Python/Cookbook/Recipe/52306\n items=d.items()\n backitems=[ [v[1],v[0]] for v in items]\n backitems.sort()\n return [ backitems[i][1] for i in range(0,len(backitems))]", "def sortedKeys(self):\n ...
[ "0.828998", "0.68249035", "0.6788732", "0.67789346", "0.6723821", "0.65725684", "0.652572", "0.6430274", "0.63924444", "0.63046885", "0.62875473", "0.62682825", "0.62573016", "0.6206646", "0.61490786", "0.61143225", "0.6027892", "0.60167885", "0.5973069", "0.58965385", "0.589...
0.8135287
1
If the attribute is found on this object, return it. Otherwise, return the attribute from the extraPO, if it exists. If there is no match, raise an attribute error.
def __getattribute__(self,name): try: return object.__getattribute__(self,name) except AttributeError: extraPO = object.__getattribute__(self,'_extraPO') if hasattr(extraPO,name): return getattr(extraPO,name) # HIDDEN! _attr_err_msg = obj...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(self, attr):\n try:\n return getattr(self, attr)\n except:\n print(\"%s is not an attribute of this instance\" % attr)\n return None", "def __getattr__ (self, attr):\n try:\n return self.get_value (attr)\n except exc.x_not_found:\n try:\n ...
[ "0.6640714", "0.66089976", "0.65671325", "0.652425", "0.64390314", "0.6418666", "0.6293225", "0.62674934", "0.6243494", "0.6238905", "0.61984557", "0.6186747", "0.61763155", "0.61569124", "0.6105884", "0.60857785", "0.60582787", "0.6044727", "0.60407495", "0.6032193", "0.6023...
0.7535025
0
Set new lower and upper bounds for the slider. If specified, inclusive_bounds should be a sequence of length 2 specifying True or False for the lower and upper bounds.
def set_slider_bounds(self,lower,upper,inclusive_bounds=None): self.bounds = (lower,upper) if inclusive_bounds is not None: self.inclusive_bounds = inclusive_bounds epsilon = max(self.slider['resolution'],0.00000000001) if self.inclusive_bounds[0] is False: low...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_bounds(\n self: A,\n lower: BoundValue = None,\n upper: BoundValue = None,\n method: str = \"clipping\",\n full_range_sampling: bool = False,\n a_min: BoundValue = None,\n a_max: BoundValue = None,\n ) -> A: # TODO improve description of methods\n ...
[ "0.6754745", "0.65818197", "0.64382577", "0.6375103", "0.630331", "0.62359047", "0.6088578", "0.60379994", "0.6031926", "0.58776194", "0.58652264", "0.58632916", "0.58520585", "0.58520585", "0.58020866", "0.57935274", "0.57603294", "0.57568383", "0.5756646", "0.5754212", "0.5...
0.82393193
0
Runs basic whitespace cleaning and splitting on a piece of text.
def whitespace_tokenize(text): text = text.strip() if not text: return [] tokens = text.split() return tokens
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tokenize(text):\n return text.split(' ')", "def whitespace_tokenize(text):\n text = text.strip()\n if not text:\n return []\n tokens = text.split()\n return tokens", "def clean_whitespace(text):\n return text\n #return re.sub(r'\\r\\n|\\n', \"\\t\", text)", "def _split(self):\n \n ...
[ "0.6435109", "0.6294716", "0.6286841", "0.62813765", "0.62159514", "0.62050986", "0.6165822", "0.6157904", "0.6150862", "0.6125603", "0.6113938", "0.61069316", "0.60987145", "0.60753495", "0.6067092", "0.6060387", "0.6018349", "0.60176057", "0.59887636", "0.59887636", "0.5987...
0.6250661
5
Strips accents from a piece of text.
def _run_strip_accents(self, text): text = unicodedata.normalize("NFD", text) output = [] for char in text: cat = unicodedata.category(char) if cat == "Mn": continue output.append(char) return "".join(output)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_accented_chars(text):\n text = unidecode.unidecode(text)\n return text", "def remove_accented_chars(text):\n text = unicodedata.normalize('NFKD', text).encode('ascii', 'ignore').decode('utf-8', 'ignore')\n return text", "def _run_strip_accents(self, text):\n text = unicodedata.nor...
[ "0.8073748", "0.7942181", "0.78255457", "0.7824997", "0.77855134", "0.7652594", "0.75760865", "0.7575228", "0.755694", "0.7513403", "0.70939153", "0.700332", "0.700332", "0.6948511", "0.6939078", "0.6920245", "0.6917249", "0.68867254", "0.6855788", "0.68418425", "0.6819216", ...
0.7815759
4
Checks whether `chars` is a whitespace character.
def _is_whitespace(char): # \t, \n, and \r are technically contorl characters but we treat them # as whitespace since they are generally considered as such. if char == " " or char == "\t" or char == "\n" or char == "\r": return True cat = unicodedata.category(char) if cat == "Zs": re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _is_whitespace(char):\n if char == ' ' or char == '\\t' or char == '\\n' or char == '\\r':\n return True\n cat = unicodedata.category(char)\n if cat == 'Zs':\n return True\n return False", "def _is_whitespace(char):\n # \\t, \\n, and \\r are technically contorl characters but...
[ "0.78012747", "0.7633813", "0.76118195", "0.7108098", "0.6929217", "0.6814356", "0.67606235", "0.65372074", "0.64895546", "0.64892155", "0.6466964", "0.64537275", "0.64364225", "0.6071991", "0.5989213", "0.59863365", "0.59160656", "0.5889098", "0.5882985", "0.58735234", "0.58...
0.7680234
1
Checks whether `chars` is a control character.
def _is_control(char): # These are technically control characters but we count them as whitespace # characters. if char == "\t" or char == "\n" or char == "\r": return False cat = unicodedata.category(char) if cat.startswith("C"): return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _is_control(char):\n # These are technically control characters but we count them as whitespace\n # characters.\n if char == \"\\t\" or char == \"\\n\" or char == \"\\r\":\n return False\n cat = unicodedata.category(char)\n if cat.startswith(\"C\"):\n re...
[ "0.8177336", "0.8169858", "0.80915713", "0.6468453", "0.58763784", "0.582512", "0.5796899", "0.5719301", "0.57148904", "0.57065594", "0.56959367", "0.5653251", "0.5603813", "0.5585948", "0.55843735", "0.55716395", "0.55498976", "0.55498976", "0.55404437", "0.5529611", "0.5528...
0.81981814
1
Construct me from an OpenID Message.
def fromMessage(klass, message, op_endpoint=UNUSED): if message.isOpenID1(): session_type = message.getArg(OPENID_NS, 'session_type') if session_type == 'no-encryption': logger.warning( 'Received OpenID 1 request with a no-encryption ' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fromMessage(klass, message, op_endpoint=UNUSED):\n self = klass.__new__(klass)\n self.message = message\n self.namespace = message.getOpenIDNamespace()\n self.assoc_handle = message.getArg(OPENID_NS, 'assoc_handle')\n self.sig = message.getArg(OPENID_NS, 'sig')\n\n if ...
[ "0.73658746", "0.7066063", "0.5978809", "0.5867185", "0.5830791", "0.5758488", "0.5673879", "0.5559432", "0.5545962", "0.5538745", "0.5415345", "0.5382182", "0.5359821", "0.53569394", "0.5334857", "0.5283096", "0.5277757", "0.52708024", "0.5234115", "0.51958185", "0.51955026"...
0.6686458
2
Construct me from an OpenID message.
def fromMessage(klass, message, op_endpoint): self = klass.__new__(klass) self.message = message self.op_endpoint = op_endpoint mode = message.getArg(OPENID_NS, 'mode') if mode == "checkid_immediate": self.immediate = True self.mode = "checkid_immediate" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fromMessage(klass, message, op_endpoint=UNUSED):\n self = klass.__new__(klass)\n self.message = message\n self.namespace = message.getOpenIDNamespace()\n self.assoc_handle = message.getArg(OPENID_NS, 'assoc_handle')\n self.sig = message.getArg(OPENID_NS, 'sig')\n\n if ...
[ "0.7162601", "0.646302", "0.5932815", "0.5826082", "0.5703606", "0.56656533", "0.5557441", "0.54961085", "0.54658264", "0.5437126", "0.53514045", "0.52692455", "0.526294", "0.52247536", "0.5217891", "0.52131367", "0.52044255", "0.51957613", "0.5184471", "0.5182908", "0.518080...
0.69739133
1
Encode this request as a URL to GET.
def encodeToURL(self, server_url): if not self.return_to: raise NoReturnToError # Imported from the alternate reality where these classes are used # in both the client and server code, so Requests are Encodable too. # That's right, code imported from alternate realities all ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_full_url(self, url):\n param_str = self.request.GET.urlencode()\n request_url = u'%s%s' % (self.base_url, url)\n request_url += '?%s' % param_str if param_str else ''\n return request_url", "def _prepare_url(self):\n\n base_url = '{}://{}{}'.format(\n ...
[ "0.64698714", "0.6464859", "0.6393425", "0.6377673", "0.6368444", "0.63676476", "0.6217673", "0.6213688", "0.61894387", "0.61884767", "0.6117526", "0.6117526", "0.6041832", "0.6032467", "0.5995228", "0.59843105", "0.5946393", "0.5920144", "0.5891122", "0.58828133", "0.5864367...
0.55789113
40
Get the return_to argument from the request, if any.
def getReturnTo(self): if self.openid_message is None: return None else: return self.openid_message.getArg(OPENID_NS, 'return_to')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_return_to_from_query(req: web.Request) -> str:\n return_to = req.query.get(\"return_to\", \"/\")\n return urllib.parse.quote(return_to, safe=\"\")", "def extract_ui_return_url(self) -> str:\n return (\n \"\"\n if not self.request\n else self.request.GET.get(s...
[ "0.7131408", "0.6590107", "0.59401417", "0.57691437", "0.575223", "0.56719255", "0.5635832", "0.55886686", "0.5520585", "0.5471063", "0.54438555", "0.5368381", "0.5368381", "0.53424656", "0.5260554", "0.5245431", "0.5199376", "0.5175595", "0.51629543", "0.5146438", "0.5146438...
0.69806415
1
Load an SWC file into a DataFrame.
def load_swc(file_name): df = pd.read_csv(file_name, delimiter=' ', header=None, comment='#', names=['sample', 'identifier', 'x', 'y', 'z', 'r', 'parent'], skipinitialspace=True).astype({'sample':int,'identifier':int,'x':float,'y':float,'z':float,'r':float,'parent':int}) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_swc(file_name):\n df = pd.read_csv(file_name, sep = ' ', header=None, comment='#', index_col = False,\n names=['sample', 'identifier', 'x', 'y', 'z', 'r', 'parent'],\n skipinitialspace=True)\n return df", "def import_data_to_streamlit(file):\n df = import...
[ "0.7903309", "0.62008125", "0.60887754", "0.60773456", "0.60683715", "0.6041929", "0.5958941", "0.58864176", "0.58325297", "0.58230084", "0.5816817", "0.5788819", "0.5787642", "0.577373", "0.57658166", "0.5743022", "0.57248044", "0.57178473", "0.57016563", "0.5658189", "0.563...
0.7876682
1
Retreives the last block in the block chain and updates the balances of all addresses in the wallet based on the current state of balances from retreived block
def update_balances(self): self.semaphore.acquire(timeout=2) try: last_block = get_last_block(self.node_address) for address in self.addresses.keys(): self.addresses[address]['balance'] = \ last_block.current_state_balances.get(address, self.ad...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _update(self, last_blk=None):\n self._clear_queue()\n self.blockchain_lock.acquire()\n self.added_tx_lock.acquire()\n self.balance_lock.acquire()\n try:\n # Resolve blockchain to get last block\n if last_blk is None:\n last_blk = self._blo...
[ "0.67767745", "0.6503057", "0.61612546", "0.61525005", "0.61064094", "0.6090585", "0.6069932", "0.6039026", "0.6034712", "0.595486", "0.5943291", "0.58598447", "0.5853092", "0.584986", "0.5824638", "0.57975334", "0.57880193", "0.57880193", "0.5767392", "0.5757136", "0.5721296...
0.68241197
0
Given a list of a dataset, returns a dictionary including variable name and values
def means_of_variables(dataset, name_of_variable): list_of_means = [] for num in range(len(dataset)): sum_of_variables = 0 for row in dataset[num].items(): if name_of_variable in row[0]: if row[1].strip() != "": sum_of_variables += int(row[1...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_var_data(self, var_names):\n variable_dict = {} # Declaring dictionary used to store key-val pairs, var_name as key and the array as the value\n try:\n for var in var_names:\n variable_dict[var] = self.dataset[var].values\n return variable_dict\n ...
[ "0.7313331", "0.6809115", "0.67498577", "0.674804", "0.6347535", "0.6243014", "0.6239884", "0.6178876", "0.6013384", "0.59954333", "0.59461516", "0.59138596", "0.59126335", "0.58991444", "0.5844866", "0.58385694", "0.58070344", "0.57961863", "0.57837087", "0.5758114", "0.5751...
0.0
-1
Given a list of a dataset, returns a dictionary including variable name and values
def make_a_new_dict(dataset, names_of_variables): new_dict = {} for variable_name in names_of_variables: new_dict[variable_name] = means_of_variables(dataset, variable_name) return new_dict
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_var_data(self, var_names):\n variable_dict = {} # Declaring dictionary used to store key-val pairs, var_name as key and the array as the value\n try:\n for var in var_names:\n variable_dict[var] = self.dataset[var].values\n return variable_dict\n ...
[ "0.7313331", "0.67498577", "0.674804", "0.6347535", "0.6243014", "0.6239884", "0.6178876", "0.6013384", "0.59954333", "0.59461516", "0.59138596", "0.59126335", "0.58991444", "0.5844866", "0.58385694", "0.58070344", "0.57961863", "0.57837087", "0.5758114", "0.5751961", "0.5731...
0.6809115
1
Build a query's clauses string
def build_query_clauses( where: str = "", order: str = "", limit: int = 0, offset: int = 0 ) -> str: return SqliteQueryBuilder.build_query_clauses(where, order, limit, offset)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _build_statement(self, query, query_key, beets_key):\n statement = \"\"\n if query_key in query:\n for query_string in query[query_key]:\n if '\"' in query_string:\n statement += \" and %s = \\'%s\\' \" % (beets_key,\n ...
[ "0.7411496", "0.7321115", "0.69815445", "0.6945033", "0.67279077", "0.65595436", "0.65528387", "0.6440801", "0.64377224", "0.6431604", "0.6402749", "0.6369724", "0.6341752", "0.62677383", "0.62298346", "0.62235826", "0.6201735", "0.6199055", "0.6196418", "0.61622447", "0.6107...
0.7814997
0
Get the list of variables included accross all the datasets.
def variables(self): return self.get_field('variable')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def variables(self):\n return self.dataset.data_vars", "def get_all_variables(self):\n out = []\n for i in self.items:\n out += i.get_all_variables()\n return out", "def get_all_variables(self):\n out = []\n for i in self.items:\n out += i.get_all...
[ "0.75146765", "0.7204054", "0.7204054", "0.7204054", "0.7203361", "0.71806943", "0.7174945", "0.7121902", "0.6776497", "0.67028946", "0.6695119", "0.664691", "0.66417056", "0.6629108", "0.6627198", "0.66109866", "0.6596385", "0.6571219", "0.6546874", "0.65032095", "0.65022665...
0.6292409
46
Get the list of variables included accross all the datasets.
def names(self): return self.get_field(self.name_field)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def variables(self):\n return self.dataset.data_vars", "def get_all_variables(self):\n out = []\n for i in self.items:\n out += i.get_all_variables()\n return out", "def get_all_variables(self):\n out = []\n for i in self.items:\n out += i.get_all...
[ "0.7514807", "0.7204267", "0.7204267", "0.7204267", "0.72035646", "0.7180601", "0.7175165", "0.71220595", "0.6776565", "0.67031574", "0.66955996", "0.66465604", "0.6642302", "0.6629098", "0.66273844", "0.6610906", "0.6596519", "0.65710056", "0.65468425", "0.6503201", "0.65020...
0.0
-1
Name of field which is used to denote dataset name.
def name_field(self): return 'name'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def NAME(self) -> str:\n return self._field_name", "def name(self):\n if self.table:\n return \"{}.{}\".format(self.table, self.field_name)\n return self.field_name", "def dataset_name(self):\n return self.dataset.name", "def dataset_name(self):\n return self._da...
[ "0.8084721", "0.7900659", "0.7557846", "0.7512588", "0.7511891", "0.7494031", "0.74646115", "0.7434117", "0.7269217", "0.71972996", "0.7195668", "0.7184917", "0.71656114", "0.7164674", "0.7117895", "0.70904875", "0.70904875", "0.6976624", "0.69080114", "0.6830984", "0.6798751...
0.78287727
2
Group metadata in two extractors by field name.
def groupby(self, extractor, field): # First we only want to consider values of field which are contained # in both extractors subset = self.get_field(field) other_subset = extractor.get_field(field) intersection = list(subset.intersection(other_subset)) # Next we...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_group_by_fields(self):\r\n t = [\r\n ['#sample', 'loc', 'age', 'mal'],\r\n ['a', 'US', '5', 'n'],\r\n ['b', 'US', '10', 'n'],\r\n ['c', 'Mal', '5', 'y'],\r\n ['d', 'Mal', '10', 'n'],\r\n ['e', 'Mal', '5', 'y'],\r\n ]\r\n ...
[ "0.581132", "0.5727124", "0.5564045", "0.55591154", "0.5362584", "0.52418345", "0.518619", "0.51415426", "0.49659586", "0.495551", "0.494652", "0.48815522", "0.486774", "0.48674235", "0.48523498", "0.48484617", "0.48276815", "0.47890982", "0.47731486", "0.47533065", "0.472886...
0.6388224
0
Get the list of models accross all the datasets.
def models(self): return self.get_field('model')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def models(self):\n models = []\n for bundle in self.bundles.values():\n models.extend(list(bundle.models.values()))\n\n return models", "def peak_all_models(self) -> List:\n models = list(self.meta.name)\n print(models)\n return models", "def models(self):\...
[ "0.7243102", "0.72427577", "0.7062452", "0.7048007", "0.7034361", "0.70260155", "0.7012853", "0.69546777", "0.6946614", "0.6755285", "0.66590476", "0.6651973", "0.6645976", "0.66453326", "0.6633704", "0.66267276", "0.66263556", "0.6592571", "0.6581745", "0.6549026", "0.653586...
0.68004805
9
Get the list of models accross all the datasets.
def models(self): return self.get_field('model')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def peak_all_models(self) -> List:\n models = list(self.meta.name)\n print(models)\n return models", "def models(self):\n models = []\n for bundle in self.bundles.values():\n models.extend(list(bundle.models.values()))\n\n return models", "def models(self):\...
[ "0.72451544", "0.72430545", "0.7062216", "0.70481944", "0.7035025", "0.70253646", "0.7011785", "0.6954791", "0.69467795", "0.6755385", "0.666054", "0.6651775", "0.66455466", "0.66452765", "0.6634393", "0.6627122", "0.6626375", "0.65928054", "0.658141", "0.654921", "0.65361416...
0.6802422
10
Get error response as defined by OIDC spec.
def _get_authorize_error_response(error, redirect_uri): params = error.get_body() uri = add_params_to_uri(redirect_uri, params) headers = [("Location", uri)] response = flask.Response("", status=302, headers=headers) return response
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getError(self):\n \n return self.resp[\"error\"]", "def errorResponse(self):\n return self._errorResponse", "def error(self) -> 'outputs.StatusResponse':\n return pulumi.get(self, \"error\")", "def odata_error(self, request, environ, start_response, sub_code,\n ...
[ "0.7344291", "0.7186283", "0.70750374", "0.67855656", "0.67337686", "0.67203623", "0.667546", "0.66589713", "0.661861", "0.6533592", "0.6533445", "0.6503586", "0.64935875", "0.64411193", "0.6435796", "0.6364215", "0.6358624", "0.6346011", "0.63101053", "0.63007516", "0.624925...
0.0
-1
Load configuration from a YAML file.
def set_config(config_dir=None, raise_on_set=False): config_dir = Config.resolve_config_dir(config_dir) if Config.is_set: if raise_on_set: raise ConfigurationError('Configuration is already set.') return config_dat, _ = Config.get_config_file(config_dir...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_yaml(cls, file=None):\n if file is None: file = f'{rcp.base_path}cfg.yml'\n try:\n with open(file, 'r') as f:\n config = yaml.load(f, Loader=yaml.FullLoader)\n cfg.__dict__ = config\n return cfg\n except FileNotFoundError:\n p...
[ "0.8048505", "0.798588", "0.7970013", "0.7923101", "0.7893431", "0.78851426", "0.7881829", "0.7881483", "0.78723943", "0.7833457", "0.78100014", "0.77967936", "0.7791032", "0.776708", "0.7639484", "0.76365036", "0.76303476", "0.76260066", "0.76063514", "0.751274", "0.74993104...
0.0
-1
Update the config file.
def update(name, value, config_dir=None): if name not in Config.__ALLOWED: msg = f'Cannot update configuration; value "{name}" is not allowed.' raise ConfigurationError(msg) config_dir = Config.resolve_config_dir(config_dir) config_dat, config_file = Config.get_config_fil...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(self):\n self.save_config_file()", "def conf_update(self):\n pass", "def updateConfig(self):\n # Make sure to keep the default values in place.\n if self.newConfig['sensor'] == 0:\n self.newConfig['sensor'] = self.config['sensor']\n if self.newConfig['ca...
[ "0.8885268", "0.81524", "0.77020496", "0.7408482", "0.7374931", "0.73603415", "0.71920687", "0.7136412", "0.7056922", "0.70347303", "0.6964669", "0.6887257", "0.68872374", "0.6874766", "0.682183", "0.6817259", "0.6775496", "0.67741746", "0.6761193", "0.6758088", "0.6745914", ...
0.64634293
41
Convert data to float.
def to_float(self) -> float: return (1.0 * self.as_int) / sensor_fixed_point_conversion
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_float(data, **kwargs):\n return Component(\n \"ToFloat\",\n arguments={\n 'data': Component.of(data)\n },\n options={\n \n },\n constraints=kwargs)", "def _float(data):\n try:\n return float(data)\n except ValueError as err:\n...
[ "0.77688867", "0.73576283", "0.721554", "0.7199789", "0.7111365", "0.71106994", "0.7068348", "0.6999863", "0.69156855", "0.6851563", "0.6741484", "0.66096705", "0.660938", "0.6552332", "0.64802533", "0.64568955", "0.638771", "0.635416", "0.63181204", "0.62850237", "0.6275641"...
0.6734611
11
Adds transition into the buffer.
def _add(self, sample):#obs_t, action, reward, obs_tp1, done): if self._next_idx >= len(self._buffer): #appends data if max capacity not reached yet self._buffer.append(sample) else: self._buffer[self._next_idx] = sample #drops old entry and appends new data if max capacity ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def storeTransition(self, transition):\n self.buffer.append(transition)", "def add(self, state, action, reward, next_state, done):\n e = self.transition(state, action, reward, next_state, done)\n self.buffer.append(e)", "def push(self,transition):\n \n input_to_buffer = trans...
[ "0.8007498", "0.75534815", "0.73529", "0.7312809", "0.7294796", "0.71221447", "0.69739544", "0.6968795", "0.67416793", "0.67289054", "0.6690588", "0.6690388", "0.6637615", "0.6591411", "0.6497185", "0.6496028", "0.64424294", "0.6420977", "0.6389127", "0.6348002", "0.63262844"...
0.5305684
85
If ship is hit by aliens
def ship_hit(si_settings,screen,stats,sb,ship,aliens,bullets): if stats.ships_left > 0: # Decrement ships_left. stats.ships_left -= 1 #update Scoreboard sb.prep_ships() else: stats.game_active = False pygame.mouse.set_visible(True) #empties aliens and bullets ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ship_hit(si_settings, screen, stats, sb, ship, aliens, bullets, alienBullets, images):\r\n if stats.ships_left > 0:\r\n # Decrement ships_left.\r\n stats.ships_left -= 1\r\n\r\n # Animate the ship explosion\r\n ship_explosion(si_settings, screen, ship)\r\n\r\n # Update sco...
[ "0.7101742", "0.70793736", "0.70728976", "0.70425344", "0.6993844", "0.6984081", "0.69634247", "0.6920138", "0.69026875", "0.6894335", "0.680322", "0.67927855", "0.67925715", "0.67509097", "0.6748145", "0.670095", "0.66557956", "0.66338193", "0.6630933", "0.6606999", "0.65774...
0.6873968
10
Collect foreign key constraints for tables
def collect_drop_fk(self): try: conn = self.engine.connect() transactional = conn.begin() inspector = reflection.Inspector.from_engine(self.engine) for table_name in inspector.get_table_names(): if table_name in self.table_list: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_common_fk_constraints(table1, table2):\n c1 = set(c for c in table1.constraints if isinstance(c, ForeignKeyConstraint) and\n c.elements[0].column.table == table2)\n c2 = set(c for c in table2.constraints if isinstance(c, ForeignKeyConstraint) and\n ...
[ "0.68391013", "0.6786642", "0.6660295", "0.6651925", "0.6525535", "0.6499966", "0.6468135", "0.6379242", "0.6333041", "0.6306279", "0.62989616", "0.6266514", "0.6220113", "0.6119289", "0.6069561", "0.60677576", "0.6051211", "0.5988677", "0.59318906", "0.5905413", "0.58962214"...
0.7899762
0
Updates relu activation functions so that 1 stores output in forward pass 2 imputes zero for gradient values that are less than zero
def update_relus(self): def relu_backward_hook_function(module, grad_in, grad_out): """ If there is a negative gradient, change it to zero """ # Get last forward output corresponding_forward_output = self.forward_relu_outputs[-1] correspon...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_relus(self):\n def relu_backward_hook_function(module, grad_in, grad_out):\n \"\"\"\n If there is a negative gradient, change it to zero\n \"\"\"\n # Get last forward output\n corresponding_forward_output = self.forward_relu_outputs[-1]\n corresponding_forward_output[c...
[ "0.7103151", "0.70542413", "0.70163447", "0.6980773", "0.6973175", "0.6939466", "0.689476", "0.6884034", "0.6853449", "0.67612594", "0.6736678", "0.66016924", "0.65656114", "0.6561161", "0.6528184", "0.64771426", "0.6473467", "0.64671826", "0.6466242", "0.64503235", "0.642089...
0.70613265
1
Returns true, if the given node forms a shorter path, when inserted into an other arc than the given one
def is_closer_to_other_arc(interior_node, arc, hull, nodes): closest_arc = find_closest_arc(interior_node, hull, nodes) return not ((closest_arc == arc) or (closest_arc[::-1] == arc))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_shorter(node, n_node):\r\n return True if node.distance + n_node.value < n_node.distance else False", "def too_short(self, node_list):\n for node in node_list:\n if node.path_length < 1:\n return True\n return False", "def have_min_distance(self, node):\r\n...
[ "0.7063842", "0.64614785", "0.62758064", "0.62371194", "0.60476726", "0.60307163", "0.60233545", "0.5992083", "0.5990681", "0.5788397", "0.5747229", "0.5670067", "0.5633543", "0.55904484", "0.5578916", "0.5575368", "0.5559711", "0.55560976", "0.55002475", "0.5488577", "0.5477...
0.6787485
1
Convenience function converting magnetic field vector in the local northing, easting, elevation (uppointing) geodetic frame to inclination in degrees (from 90 to 90, positive values point down), declination in degrees (from 180 to 180, 0 points north, clockwise), and vector intensity (vector norm). This conversion is e...
def vincdecnorm(arr): tmp = convert(arr, GEOCENTRIC_CARTESIAN, GEOCENTRIC_SPHERICAL) return -tmp[..., 0], tmp[..., 1], tmp[..., 2]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def atan2_vec(vector):\n return -np.arctan2(vector[1], vector[0])", "def z_to_vector(vector):\n norm = np.linalg.norm(vector)\n if norm == 0:\n return np.identity(3)\n v = np.array(vector) / norm\n phi = np.arccos(v[2])\n if any(v[:2]):\n #projection of vector to unit circle\n ...
[ "0.6241404", "0.6238266", "0.588497", "0.57482463", "0.56919914", "0.56833637", "0.5668754", "0.559687", "0.55822194", "0.5570279", "0.55509424", "0.55488896", "0.554604", "0.55429643", "0.5527274", "0.55063707", "0.5498835", "0.54819536", "0.546798", "0.5467272", "0.5463973"...
0.0
-1
Pull all values of specified key from nested JSON.
def extract_values(obj, key): arr = [] def extract(obj, arr, key): """Recursively search for values of key in JSON tree.""" if isinstance(obj, dict): for k, v in obj.items(): if isinstance(v, (dict, list)): extract(v, arr, key) eli...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_values(obj, key): \n arr = [] \n def extract(obj, arr, key): \n \"\"\"Recursively search for values of key in JSON tree.\"\"\" \n if isinstance(obj, dict): \n for k, v in obj.items(): \n if isinstance(v, (dict, list)): \n extract(v, arr, ...
[ "0.74641794", "0.74437475", "0.73697776", "0.72856975", "0.727579", "0.64386314", "0.6149639", "0.61051595", "0.61051595", "0.61051595", "0.61051595", "0.61051595", "0.6092075", "0.60787505", "0.6049016", "0.6016443", "0.5951423", "0.58230776", "0.579484", "0.5791495", "0.578...
0.73673946
3
returns pandas dataframe of values in colnames of table in postgres database
def get_table_col(colnames="pmid", condition="", table="test_articles_1", database="tumba", user="xui", password="mmceez", host="localhost", port="5433"): engine = create_engine(f"post...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def postgresql_to_dataframe(conn, select_query, column_names):\n cursor = conn.cursor()\n try:\n cursor.execute(select_query)\n except (Exception, psycopg2.DatabaseError) as error:\n print(\"Error: %s\" % error)\n cursor.close()\n return 1\n \n # Naturally we get a list o...
[ "0.74196416", "0.7376208", "0.7103198", "0.7048362", "0.7009011", "0.6987119", "0.69806546", "0.6960698", "0.6927194", "0.6816537", "0.6778547", "0.6749602", "0.67262626", "0.67042243", "0.669658", "0.668573", "0.66496056", "0.66217744", "0.653552", "0.6495743", "0.6458093", ...
0.7015175
4
Returns 3D surface coordinates. Returns
def surface(): """ Get surface for plotting. :return fsaverage: surface locations as in nilearn :return surf: surface for plotting """ fsaverage = fetch_surf_fsaverage('fsaverage') surf = {} for key in [t + '_' + h for t in ['pial', 'infl'] for h in ['l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def three_dimensional(self, z): # Maybe I misunderstood the task. My method looks weird\n return (self.x, self.y, z)", "def get3Dcoordinates(self, skel_2d):\n skel_2d = skel_2d.to(self.device)\n z_out = self.net(skel_2d)\n z_out = z_out.detach().cpu().numpy()\n z_out = z_out.re...
[ "0.7196546", "0.7112156", "0.7056973", "0.69997543", "0.692475", "0.69123536", "0.6892076", "0.68550056", "0.681121", "0.68065214", "0.6758454", "0.6671345", "0.6671345", "0.66360456", "0.656445", "0.6476307", "0.6460939", "0.64060545", "0.639585", "0.6377206", "0.63701624", ...
0.58124393
96
Returns the least common multiple of two integers x & y
def lcm(x,y): #Initialize counter & condition counter = 1 condition = False #While loop iterates until LCM condition is satisfied while condition == False : counter = counter + 1 condition = (counter % x == 0) and (counter % y == 0) return counter
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lowest_common_multiple(a, b):\n # 两个数字相乘后除以最大公约数 = 两个数字的最小公倍数\n return a * b // gcd(a, b)", "def least_common_multiple(number1, number2):\n return number1 * number2 // math.gcd(number1, number2)", "def lcm(x, y):\n return x*y//gcd(x,y)", "def lcm(x: int, y: int) -> int:\n assert isinstance...
[ "0.7836181", "0.7830528", "0.75562865", "0.7515196", "0.73085237", "0.7279543", "0.72713405", "0.70721155", "0.7071794", "0.7054986", "0.70521206", "0.7036223", "0.70358443", "0.70358443", "0.7026599", "0.7026513", "0.7024563", "0.7024563", "0.70025325", "0.70025325", "0.7002...
0.69858414
28
Return a logger with a default ColoredFormatter.
def setup_logger(log_file_path =""): formatter = ColoredFormatter( "%(log_color)s%(levelname)-8s%(reset)s %(blue)s%(message)s", datefmt=None, reset=True, log_colors={ 'DEBUG': 'cyan', 'INFO': 'green', 'WARNING': 'yellow', 'ERROR': 'red'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_logger():\n log = logging.getLogger() # root logger\n log.setLevel(logging.DEBUG)\n format_str = '%(asctime)s - %(levelname)-8s - %(message)s'\n date_format = '%Y-%m-%d %H:%M:%S'\n if os.isatty(2):\n cformat = '%(log_color)s' + format_str\n colors = {'DEBUG': 'reset',\n ...
[ "0.6996591", "0.69907147", "0.6911573", "0.682854", "0.67095196", "0.65775317", "0.6396354", "0.6385912", "0.6341703", "0.6268824", "0.61986893", "0.6196991", "0.618999", "0.61819875", "0.6148457", "0.6129842", "0.6128831", "0.6113148", "0.61027133", "0.60929334", "0.60799354...
0.65120155
6
Make sure list are cast to int and returned as list of values
def test_cast_list(self): dim = Integer("yolo", "uniform", -3, 5) assert dim.cast(["1", "2"]) == [1, 2]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def toIntList(values):\n\treturn list(map(lambda va: int(va), values))", "def get_list_of_int2(self):\n pass", "def test_to_int_list(self):\n self.assertEqual(to_int_list([u\"3\", None, \"asdf\", u\"42\"]), [3, 0, 0, 42])", "def ints(xs: Iterable) -> list[int]:\n return lmap(int, xs)", "de...
[ "0.7838308", "0.7678808", "0.7522331", "0.7352634", "0.68803596", "0.6807334", "0.67980254", "0.66967463", "0.65656537", "0.656538", "0.65022695", "0.6475334", "0.6462381", "0.6420589", "0.6370343", "0.6359063", "0.6358936", "0.6343446", "0.62816185", "0.62816185", "0.6281618...
0.700432
4
Check whether interval is cool.
def test_interval(self): space = Space() probs = (0.1, 0.2, 0.3, 0.4) categories = ("asdfa", 2, 3, 4) dim = Categorical("yolo", OrderedDict(zip(categories, probs)), shape=2) space.register(dim) dim = Integer("yolo2", "uniform", -3, 6) space.register(dim) d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_interval(self):\n return True", "def is_cooling(self) -> bool:\r\n self._logger.debug(log_message_formatter(\r\n \"get\", f\"{self}\", \"is_cooling\"))\r\n return (self._ambient_temperature > self._target_temperature) \\\r\n and self.can_cool \\\r\n an...
[ "0.67157364", "0.647483", "0.6251448", "0.62513936", "0.6179143", "0.6175733", "0.6059279", "0.60339946", "0.5970255", "0.5927797", "0.5906299", "0.5898313", "0.57373446", "0.57215995", "0.5710233", "0.5696857", "0.5689898", "0.568865", "0.56741077", "0.566865", "0.5653622", ...
0.5775349
12
String representation of the ProbabilityMask
def __str__(self): return self.printable()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __repr__(self) -> str:\n bits_str = \"\"\n\n raw_key = self.raw_key()\n for byte_idx, chunk in enumerate(raw_key):\n # Range from 7 to 0 inclusively:\n for bit in range(7, -1, -1):\n i = byte_idx * 8 + bit\n if i < self.start() or i >= se...
[ "0.6378716", "0.63169175", "0.62971824", "0.61919385", "0.6159933", "0.604919", "0.60285693", "0.5961747", "0.5916144", "0.59136134", "0.59075695", "0.5864275", "0.5863304", "0.5860545", "0.58383024", "0.5826783", "0.5799168", "0.5797788", "0.578541", "0.5775818", "0.577448",...
0.0
-1
Returns milestones by site, e.g. date of first full participant enrollment
def get_milestones(counts_by_site_per_interval): milestones = {} for hpo in counts_by_site_per_interval: milestones[hpo] = {} for hpo in counts_by_site_per_interval: dates = sorted(counts_by_site_per_interval[hpo].keys()) for date in dates: co...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_sites_at_milestone(milestones, dates):\n\n # Initialize variable with zero-filled values by date \n sites_at_milestone = {'first_fp': {}}\n for date in dates:\n sites_at_milestone['first_fp'][date] = 0\n\n for hpo in milestones:\n first_fp_date = int(milest...
[ "0.6793394", "0.5771371", "0.5768861", "0.57488155", "0.57224596", "0.54434013", "0.5202563", "0.49920276", "0.48736456", "0.4821828", "0.47848856", "0.464642", "0.46444276", "0.46253875", "0.45792574", "0.4536353", "0.45184338", "0.45036438", "0.44936332", "0.44393995", "0.4...
0.72941756
0
Collapse cumulative totals by date by site into cumulative totals by date
def get_cumulative_totals(cumulative_totals_by_site, dates): cumulative_totals = {} for date in dates: cumulative_totals[date] = 0 for hpo in cumulative_totals_by_site: for date in dates: cumulative_totals[date] += cumulative_totals_by_site[hpo][date] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_cumulative_totals_by_site(counts_by_site_per_interval, dates):\n cumulative_totals_by_site = {}\n for hpo in counts_by_site_per_interval:\n cumulative_totals_by_site[hpo] = {}\n for i, date in enumerate(dates):\n count = counts_by_site_per_interval[hpo][da...
[ "0.6989158", "0.6453", "0.5659555", "0.5538998", "0.5433455", "0.53242946", "0.5280098", "0.51991147", "0.5172089", "0.5162224", "0.51526326", "0.513318", "0.51276726", "0.50956535", "0.50896215", "0.50867593", "0.50368637", "0.50340444", "0.5028876", "0.5025051", "0.50004035...
0.7150764
0
Should redirect anonymous user to login page.
def test_redirect_if_not_logged_in(self): response = self.client.get(self.account_overview_url) self.assertEqual(response.status_code, 302) self.assertRedirects(response, self.login_url)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deny_access():\n flash('You must login first.')\n return redirect(url_for('home'))", "def test_dispatch_anonymous_user(self):\n class MyView(LoginRequiredViewMixin, View):\n def get(view, *args, **kwargs):\n self.fail('Should not be reached')\n\n request = Reques...
[ "0.73274297", "0.71531737", "0.71255636", "0.6996786", "0.69853425", "0.69656384", "0.69485277", "0.69432324", "0.69351006", "0.6931503", "0.68932885", "0.68927073", "0.68913966", "0.6854409", "0.684352", "0.6805551", "0.67871714", "0.6751677", "0.6749827", "0.6740645", "0.67...
0.6613543
37
Should redirect user to login page if they aren't logged in.
def test_user_not_logged_in_redirects_from_change_password(self): get_response = self.client.get(self.change_password_url) post_response = self.client.post(self.change_password_url, {}) self.assertRedirects(get_response, self.login_url) self.assertRedirects(post_response, self.login_url)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_needs_login():\n flash(\"You must be logged in to access this page.\")\n return redirect(url_for('auth.login', next=request.path))", "def require_login(self):\n\tif users.get_current_user():\n\t return True\n\telse:\n\t self.redirect(users.create_login_url(self.request.uri))\n\t return ...
[ "0.81208235", "0.77413166", "0.75454766", "0.75024456", "0.7411224", "0.7348042", "0.7304874", "0.7259016", "0.725042", "0.7247448", "0.72140497", "0.7210232", "0.7165918", "0.71407515", "0.7118406", "0.7109688", "0.7109074", "0.70981216", "0.7091881", "0.7083025", "0.7065273...
0.0
-1
Should successfully change user's password.
def test_user_logged_in_post_changes_password(self): form_data = { "old_password": self.password, "new_password": "newtestpassword12", "new_password2": "newtestpassword12" } login = self.client.login(username=self.username, password=self.password) self...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_010_change_user_password(self):\n\n testflow.step(\"Resetting password for user %s\", TEST_USER1)\n assert USER_CLI.run(\n 'password-reset',\n TEST_USER1,\n password='pass:%s' % self.user_password,\n password_valid_to='2100-01-01 11:11:11Z',\n ...
[ "0.8595526", "0.8250219", "0.8249956", "0.8184136", "0.817371", "0.8096074", "0.80791736", "0.80735016", "0.8033495", "0.80045015", "0.7907977", "0.78715044", "0.78530544", "0.7821903", "0.7813827", "0.77729493", "0.77064437", "0.77057976", "0.7659512", "0.76134866", "0.76047...
0.77640665
16
Should redirect user to login page if they aren't logged in.
def test_user_not_logged_in_redirects_from_change_email(self): get_response = self.get_change_email() post_response = self.post_change_email() self.assertRedirects(get_response, self.login_url) self.assertRedirects(post_response, self.login_url)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_needs_login():\n flash(\"You must be logged in to access this page.\")\n return redirect(url_for('auth.login', next=request.path))", "def require_login(self):\n\tif users.get_current_user():\n\t return True\n\telse:\n\t self.redirect(users.create_login_url(self.request.uri))\n\t return ...
[ "0.81208235", "0.77413166", "0.75454766", "0.75024456", "0.7411224", "0.7348042", "0.7304874", "0.7259016", "0.725042", "0.7247448", "0.72140497", "0.7210232", "0.7165918", "0.71407515", "0.7118406", "0.7109688", "0.7109074", "0.70981216", "0.7091881", "0.7083025", "0.7065273...
0.0
-1
Should successfully change a user's email if new email matches confirmation and is an actual email.
def test_user_logged_in_post_changes_email(self): form_data = { 'password': self.password, 'new_email': "new@email.com", 'new_email2': "new@email.com" } self.assertTrue(self.login()) post_response = self.post_change_email(form_data) self.assert...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def change(self, request, new_email, confirm=True):\n with transaction.commit_on_success():\n user_email(self.user, new_email)\n self.user.save()\n self.email = new_email\n self.verified = False\n self.save()\n if confirm:\n se...
[ "0.7688148", "0.737031", "0.72769403", "0.72429085", "0.72155285", "0.7163114", "0.71287704", "0.7116753", "0.7100977", "0.70429146", "0.70397806", "0.70106393", "0.70039344", "0.699343", "0.6968061", "0.6959034", "0.6946057", "0.6911854", "0.69089824", "0.69059813", "0.69049...
0.7752042
0
Should redirect user to login page if they aren't logged in.
def test_user_not_logged_in_redirects_from_delete_account(self): get_response = self.get_delete_account() post_response = self.post_delete_account() self.assertRedirects(get_response, self.login_url) self.assertRedirects(post_response, self.login_url)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_needs_login():\n flash(\"You must be logged in to access this page.\")\n return redirect(url_for('auth.login', next=request.path))", "def require_login(self):\n\tif users.get_current_user():\n\t return True\n\telse:\n\t self.redirect(users.create_login_url(self.request.uri))\n\t return ...
[ "0.81208235", "0.77413166", "0.75454766", "0.75024456", "0.7411224", "0.7348042", "0.7304874", "0.7259016", "0.725042", "0.7247448", "0.72140497", "0.7210232", "0.7165918", "0.71407515", "0.7118406", "0.7109688", "0.7109074", "0.70981216", "0.7091881", "0.7083025", "0.7065273...
0.0
-1
Nim.otherPlayer(player) returns the player that is not `player`. Assumes `player` is either 0 or 1.
def otherPlayer(cls, player): return 0 if player == 1 else 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __negated_player(self, player):\n\t\treturn self.PLAYER2 if self.current_player == self.PLAYER1 else self.PLAYER1", "def other_player(cls, player):\n return 0 if player == 1 else 1", "def other_player(self, player):\n if player == self.__opponent:\n return self.__pid\n else:...
[ "0.78096604", "0.75338763", "0.7423782", "0.72975385", "0.72975385", "0.72975385", "0.70284206", "0.69978875", "0.68819314", "0.6628766", "0.6439482", "0.6439482", "0.64113295", "0.61606115", "0.61557275", "0.6145383", "0.5985088", "0.59775", "0.59666336", "0.5951676", "0.595...
0.76483554
1
Access to the dirty status on this Plug.
def is_dirty(self): if self.sub_plugs: for sub_plug in self.sub_plugs.values(): if sub_plug.is_dirty: return True return False return self._is_dirty
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_dirty(self, status):\n self._is_dirty = status\n if status:\n self.parent_plug.is_dirty = status # pylint: disable=no-member", "def isDirty( self ):\n return self._dirty", "def dirty(self) -> bool:\n return self.__dirty", "def isDirty(self):\n return self...
[ "0.778781", "0.75308883", "0.75268245", "0.7460101", "0.7442655", "0.7442655", "0.7421917", "0.7421917", "0.73016334", "0.7243542", "0.705128", "0.7033133", "0.6750943", "0.6699425", "0.6685107", "0.6670641", "0.6655825", "0.62684643", "0.6248314", "0.6248314", "0.62162334", ...
0.69732624
12
Access to the dirty status on this Plug.
def is_dirty(self): return self._is_dirty
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_dirty(self, status):\n self._is_dirty = status\n if status:\n self.parent_plug.is_dirty = status # pylint: disable=no-member", "def isDirty( self ):\n return self._dirty", "def dirty(self) -> bool:\n return self.__dirty", "def isDirty(self):\n return self...
[ "0.778781", "0.75308883", "0.75268245", "0.7460101", "0.7421917", "0.7421917", "0.73016334", "0.7243542", "0.705128", "0.7033133", "0.69732624", "0.6750943", "0.6699425", "0.6685107", "0.6670641", "0.6655825", "0.62684643", "0.6248314", "0.6248314", "0.62162334", "0.6191607",...
0.7442655
5
Given a theta, load and return value function and normalization factors corresponding to that theta.
def load_theta(theta, eta): if len(eta[1]) == 0: #i.e. there are hierarchical skills available vals = np.load('./thetas/' + str(eta[0]) + '/0/' + str(theta) + '_vals.npy') Zs = np.load('./thetas/' + str(eta[0]) + '/0/' + str(theta) + '_Zs.npy') else: vals = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gradient(self, theta):\n a = -(6 * self.scale ** 2)\n b = 3 * self.scale ** 2 + np.exp(2 * theta)\n b *= np.log(3 * self.scale ** 2 * np.exp(-2 * theta) + 1)\n return a / b", "def f(self, x, theta):\n raise NotImplementedError(\n \"f has not been implemented for ...
[ "0.5645837", "0.56179833", "0.548566", "0.5443402", "0.54173374", "0.53421444", "0.52532285", "0.5239856", "0.5102279", "0.50731015", "0.5069536", "0.50634265", "0.5059795", "0.50555193", "0.5046189", "0.5044061", "0.5039503", "0.5016452", "0.50049335", "0.49974173", "0.49974...
0.50480855
14
This function is set up separately because the haversine distance likely will still be useful after we're done with this adhoc approach. Note, this does not account for the oblateness of the Earth. Not sure if this will cause a problem.
def haversine_distance(self, p1, p2): r = 6371000 # Setting up haversine terms of distance expansion hav_1 = np.power(np.sin((p2[1] - p1[1]) / 2 * np.pi / 180), 2.0) hav_2 = np.cos(p2[1] * np.pi / 180) * np.cos(p1[1] * np.pi / 180) * np.power( np.sin((p2[0] - p1[0]) / 2 * np...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def haversine_distance(loc1_lat, loc1_lon, loc1_alt, loc2_lat, loc2_lon, loc2_alt):\n R = 6372797.560856 # radius of the earth in meters\n R = R + loc2_alt - loc1_alt\n\n lat_arc = math.radians(loc1_lat - loc2_lat)\n lon_arc = math.radians(loc1_lon - loc2_lon)\n\n lat_h = math.sin(lat_arc * 0.5)\n ...
[ "0.7138541", "0.7134377", "0.6982782", "0.6906094", "0.684917", "0.6831888", "0.68149483", "0.6811825", "0.67952913", "0.67906564", "0.6645542", "0.66442364", "0.66426235", "0.66324574", "0.6627111", "0.66212994", "0.6582136", "0.6564867", "0.65646285", "0.65592617", "0.65424...
0.0
-1
Set the kicker servo to on state
def kickerOn(self): self.sKicker.set(.3 if not config.isPracticeBot else 0) if not self.lastKicker: self.datalogger.event("Fire!") self.lastKicker = True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def servo_on(self):\n self.logger.info('Setting servo ON')\n self.electronics.move_servo(1)\n self.config['servo']['status'] = 1", "def poweron(self) -> None:\n self.servo_reset()", "def turn_on(self, **kwargs):\n self._state = True\n if(self._device['type'] == '_DT-PL...
[ "0.8177993", "0.7001728", "0.69537073", "0.6906014", "0.6892915", "0.686044", "0.6843597", "0.68165225", "0.67864305", "0.6729483", "0.67123014", "0.6690263", "0.66787434", "0.66457176", "0.66360253", "0.65999144", "0.65862626", "0.6570924", "0.65645313", "0.6557972", "0.6552...
0.6567164
18
Return key to this object.
def __key__(self) -> Tuple[int, int]: return self.col, self.row
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def key(self):\n return key_for_name(self.name)", "def get_key(self):\n return self.key", "def get_key(self):\n return self.key", "def key(self):\n return self._key if self._key else self.factory().key", "def key(self):\n return self.key_for(self.id)", "def get_key(self...
[ "0.89339936", "0.8794254", "0.8794254", "0.8751649", "0.8749292", "0.872509", "0.8676269", "0.86204773", "0.86180115", "0.8585415", "0.85724723", "0.85674083", "0.8527013", "0.8516703", "0.8516703", "0.8516703", "0.8516703", "0.85125244", "0.848198", "0.8470208", "0.84109867"...
0.0
-1
Create the queue and related ops and placeholders to be used to feed the network.
def create_queue(data_size, num_steps, capacity=128, dtype=tf.int32): # Feeds for inputs. input_data = tf.placeholder( dtype, shape=[data_size, num_steps], name="input_data") targets = tf.placeholder( dtype, shape=[data_size, num_steps], name="targets")...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _build_network(self):\n # self._observation = tf.placeholder(shape=[None, *self._dim_obs], dtype=tf.uint8, name=\"observation\")\n # self._observation = tf.to_float(self._observation) / 255.0\n # self._observation = tf.placeholder(shape=[None, *self._dim_obs], dtype=tf.float32, name=\"obse...
[ "0.6695488", "0.63230306", "0.62743384", "0.6225641", "0.6214275", "0.62095904", "0.6180419", "0.6177495", "0.61351687", "0.6129813", "0.6107699", "0.6093995", "0.6058082", "0.60559136", "0.60512", "0.6043767", "0.60291874", "0.6019639", "0.60172755", "0.60082144", "0.6006118...
0.6042816
16
Scatter plot of umap clusters.
def plot_umap_clusters(ax, df): labels = cluster_labels(df['cluster_id']) color_map = get_cluster_color_map(df['cluster_id'].values) if -1 in labels: df_noise = df[df['cluster_id'] < 0] ax.scatter( df_noise['umap1'].values, df_noise['umap2'].values, color...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cluster_plot(self):\r\n train = StandardScaler().fit_transform(self.X)\r\n pca = PCA(n_components=3)\r\n pca_component = pca.fit_transform(self.X)\r\n fig = plt.figure(figsize=(10,8))\r\n sns.set_palette(sns.color_palette(\"cubehelix\", 8))\r\n ax ...
[ "0.7362859", "0.7328215", "0.71821433", "0.6652636", "0.6650715", "0.66452557", "0.65254337", "0.65057236", "0.64475816", "0.6397107", "0.6342276", "0.63407594", "0.6313768", "0.63022804", "0.629088", "0.62877756", "0.6276047", "0.6250616", "0.62417346", "0.6239525", "0.62074...
0.7536156
0
Returns a fake request with the user added to the request
def fake_request(user=None, method='GET', data=None, url='/', content_type='text/html; charset=utf-8'): factory = RequestFactory() # Get the method to be used for the request (i.e. get, put, post, delete) method = getattr(factory, method.lower()) # If the user is passing in a json object if conten...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mock_req(path='/', user = None):\n if not user:\n user = random_user()\n req = RequestFactory().get(path)\n req.user = user\n return req", "def fake_authorized_request(*args, **kwargs):\n user = User.objects.get(email=\"autoupdate@leaguevine.com\")\n return fake_request(user, *args, ...
[ "0.79375637", "0.7633201", "0.7622312", "0.74213177", "0.737045", "0.69596565", "0.6617873", "0.66164124", "0.65721303", "0.64923614", "0.64125293", "0.6357072", "0.63448113", "0.6341333", "0.63232636", "0.63030064", "0.6301177", "0.62871444", "0.6267534", "0.62394756", "0.62...
0.7068597
5
Convert coordinate values to floats.
def floatize(self): self.x = float(self.x) self.y = float(self.y)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _fs (v):\r\n try : \r\n v = float(v)\r\n except : \r\n v = tuple([float (ss) for ss in \r\n v.replace('(', '').replace(')', '').split(',')])\r\n return v", "def to_float(self) -> float:\n return (1.0 * self.as_int) ...
[ "0.6701161", "0.6688434", "0.6554382", "0.6455828", "0.64538753", "0.63701093", "0.63075864", "0.625625", "0.6252969", "0.61478543", "0.612631", "0.608965", "0.6048243", "0.60262245", "0.5968809", "0.5924165", "0.5878196", "0.58732855", "0.5872968", "0.5834271", "0.57987195",...
0.6917977
1
Returns a regularly spaced grid of points occupying a rectangular region of length x width partitioned into div intervals. If different spacing is desired in width, then width_div can be specified, otherwise it will default to div. If div < 2 in either x or y, then the corresponding coordinate will be set to length or ...
def grid_points_2d(length, width, div, width_div=None): if div > 1: px = [-length / 2.0 + (x / (div - 1)) * length for x in range(div)] else: px = [length] if width_div is not None: wd = width_div else: wd = div if wd > 1: py = [-width / 2.0 + (y / (wd - 1)) *...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def grid_points_at_height(length, width, height, div, width_div=None):\n pts = grid_points_2d(length, width, div, width_div)\n return points2d_at_height(pts, height)", "def create_grid(height, width):\n grid = []\n \n for r in range(height):\n row = [0] * width # a row containing width ...
[ "0.63857245", "0.60420936", "0.6014064", "0.5954926", "0.59538287", "0.5935298", "0.5893713", "0.5792251", "0.5758469", "0.5646313", "0.5639371", "0.5604536", "0.55971926", "0.5551463", "0.55095685", "0.55077183", "0.54831856", "0.54750013", "0.5458949", "0.5442643", "0.54200...
0.7321998
0
Scale the edge weights of a networkx graph for graphing and return the new graph.
def scale_edge_weights(graph): g = graph.copy() original_weights = [] for edge in g.edges(): original_weights.append(g.edges()[edge]['weight']) scaler = MinMaxScaler(feature_range=(.5,12)) new_weights = scaler.fit_transform(np.array(original_weights).reshape(-1,1)).flatten() for i,edge i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def graph_with_edges():\n from weighted_graph import Weighted\n new_graph = Weighted()\n new_graph.add_node('A')\n new_graph.add_node('B')\n new_graph.add_node('C')\n new_graph.add_node('D')\n new_graph.add_node('E')\n new_graph.add_node('F')\n new_graph.add_edge('A', 'B')\n new_graph...
[ "0.67784804", "0.65568006", "0.63074267", "0.6209843", "0.61467314", "0.6057095", "0.60071784", "0.592084", "0.59085596", "0.5858623", "0.58403045", "0.58204406", "0.58031934", "0.57772774", "0.5753427", "0.5753173", "0.5740179", "0.57196593", "0.56935596", "0.56858593", "0.5...
0.8123249
0
constructor. \param[in] _name listener's name \param[in] _subject observing/listening subject
def __init__(self, _name, _subject): super(MyListener, self).__init__(_name, _subject)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, subject: any) -> None:\n self.subject = subject", "def subject_name(self, subject_name):\r\n\r\n self._subject_name = subject_name", "def __init__(self, name):\n\n self.name = name\n self.rules = []\n self._watched_files = []", "def __init__(self):\n ...
[ "0.64074576", "0.6144547", "0.60417414", "0.5975011", "0.5887988", "0.58520967", "0.5831707", "0.5831707", "0.5782004", "0.5779323", "0.57398456", "0.57261133", "0.56851166", "0.5673011", "0.56686926", "0.56686926", "0.56686926", "0.56686926", "0.56686926", "0.56686926", "0.5...
0.8395023
0
The interval of nodes having a specified node type. The nodes are organized in intervals of nodes with the same type. For each type there is only one such interval.
def sInterval(self, val): # NB: the support attribute has been added by precomputing __levels__ if val in self.support: return self.support[val] else: return ()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_nodes_by_type(self, node_type=None):\n target_nodes = []\n if node_type is not None:\n for node in self.nodes:\n if str(node_type).lower() == str(node.get('infos').get('type')).lower():\n target_nodes.append(node)\n return target_nodes", "...
[ "0.57924926", "0.5635654", "0.5632197", "0.5452467", "0.54186344", "0.5408335", "0.53553164", "0.53216803", "0.5295567", "0.5287385", "0.5232302", "0.5220098", "0.52005625", "0.51650167", "0.515823", "0.5119059", "0.5097048", "0.509453", "0.5090237", "0.508099", "0.50771624",...
0.0
-1
Only users with review.add_attachment permission for self.review are allowed to create new Attachments
def get_permission_object(self): return self.gfk_object
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def perform_create(self, serializer):\n\n attachment = serializer.save()\n attachment.user = self.request.user\n attachment.save()", "def create(self, file_attachment, review_request):\n comment = FileAttachmentComment(text=self.cleaned_data['review'],\n ...
[ "0.6022977", "0.5812456", "0.57044667", "0.56265455", "0.56028605", "0.5497942", "0.5487815", "0.5458336", "0.5421869", "0.54218173", "0.539608", "0.539608", "0.53883725", "0.5373952", "0.5373564", "0.5369529", "0.5369155", "0.5347165", "0.53464645", "0.5311207", "0.53085595"...
0.0
-1
Return a list of groups relevant to this session/profile (i.e. user). Return a list of groups filtered on user, authority, document_uri. Include all types of relevant groups (open and private).
def all_groups(self, user=None, authority=None, document_uri=None): open_groups = self.open_groups(user, authority, document_uri) private_groups = self.private_groups(user) return open_groups + private_groups
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def open_groups(self, user=None, authority=None, document_uri=None):\n\n authority = self._authority(user, authority)\n # TODO This is going to change once scopes and model updates in place\n groups = (self._session.query(models.Group)\n .filter_by(authority=authority,\n ...
[ "0.6992599", "0.69042265", "0.64993864", "0.64541155", "0.6430946", "0.6427862", "0.6419899", "0.63737446", "0.6340171", "0.63224334", "0.6318945", "0.6310853", "0.628563", "0.6282887", "0.62672126", "0.62573975", "0.623832", "0.623737", "0.6225064", "0.62042546", "0.61733913...
0.7638258
0
Return all matching open groups for the authority and target URI. Return matching open groups for the authority (or request_authority default), filtered by scope as per ``document_uri``.
def open_groups(self, user=None, authority=None, document_uri=None): authority = self._authority(user, authority) # TODO This is going to change once scopes and model updates in place groups = (self._session.query(models.Group) .filter_by(authority=authority, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_groups(self, user=None, authority=None, document_uri=None):\n open_groups = self.open_groups(user, authority, document_uri)\n private_groups = self.private_groups(user)\n\n return open_groups + private_groups", "def fusion_api_get_enclosure_groups(self, uri=None, param='', api=None, ...
[ "0.6502701", "0.50607336", "0.44348842", "0.43159467", "0.42863858", "0.42658743", "0.42466027", "0.419818", "0.41678372", "0.41664693", "0.41408813", "0.41025388", "0.4092412", "0.40821356", "0.40725842", "0.4068398", "0.40642485", "0.405907", "0.40525642", "0.40493518", "0....
0.726218
0
Return this user's private groups per user.groups.
def private_groups(self, user=None): if user is None: return [] return self._format(user.groups)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def groups(self):\r\n return users.Groups(self)", "def member_groups(self, user):\n \n if not hasattr(user, '_group_member_groups'):\n # be sure to use \"slow\" version of is_member to prevent it recursing back\n user._group_member_groups = [self[group] for group in sel...
[ "0.73866785", "0.7255108", "0.7245778", "0.7172321", "0.7171644", "0.7061307", "0.69920015", "0.6991282", "0.6948813", "0.6914971", "0.6910865", "0.688395", "0.6800314", "0.6740059", "0.6701702", "0.669342", "0.6679005", "0.6679005", "0.6679005", "0.6673664", "0.66704136", ...
0.7641592
0
sort a list of groups of a single type
def _sort(self, groups): return sorted(groups, key=lambda group: (group.name.lower(), group.pubid))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sort2groups(array, gpat=['_R1','_R2']):\n groups = [REGroup(gp) for gp in gpat]\n unmatched = []\n for item in array:\n matched = False\n for m in groups:\n if m.match(item):\n matched = True\n break\n if not matched: unmatched.append(item)\n return [sorted(...
[ "0.6659355", "0.6451238", "0.6341741", "0.63039374", "0.6164097", "0.61605155", "0.61358804", "0.61322373", "0.61172026", "0.6062132", "0.6050758", "0.60111916", "0.59587", "0.5920772", "0.58970225", "0.58934945", "0.5879824", "0.58409876", "0.58378166", "0.58325225", "0.5820...
0.7094954
0
Return a tree like t but with leaf labels invremented.
def increment_leaves(t): if is_leaf(t): return tree(label(t) + 1) else: bs = [increment_leaves(b) for b in branches(t)] return tree(label(t), bs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reduceLabel(T):\n if not T.isLeaf():\n T.label = T.label[:1]\n for t,w in T.children:\n reduceLabel(t)", "def label(tree):\n return tree[0]", "def label_to_name(label):\n return \"Tree\"", "def leaves_with_labels(tree, label=None):\n leaves = []\n for child in tree...
[ "0.6645282", "0.6432071", "0.63790923", "0.6363019", "0.6296878", "0.6288536", "0.6237982", "0.6235521", "0.6222123", "0.6217208", "0.6208112", "0.6169805", "0.6110479", "0.6102878", "0.6009769", "0.5984556", "0.5975827", "0.59562695", "0.5951135", "0.59411436", "0.5931704", ...
0.6125397
12
Construct a rightbranching binary tree.
def right_binarize(t): return tree(label(t), binarize_branches(branches(t)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build():\n r = TreeNode(1)\n r.left = TreeNode(2)\n r.left.left = TreeNode(4)\n r.left.right = TreeNode(5)\n\n r.right = TreeNode(3)\n\n return r\n return TreeNode(3)", "def _gen_test_tree_2():\n tree = BinaryNode(5)\n tree.left = BinaryNode(3)\n tree.left.left = BinaryNode(2)\n tree...
[ "0.6767954", "0.66027343", "0.65538377", "0.648459", "0.6484455", "0.645335", "0.64312917", "0.64110446", "0.63402146", "0.63226146", "0.6318895", "0.63017195", "0.62751544", "0.62627965", "0.625614", "0.62394744", "0.62188256", "0.6216536", "0.6186813", "0.61606973", "0.6141...
0.7152841
0
Return the first element of a linked list.
def first(s): assert is_link(s), 'fist only applies to a linked list.' assert s != empty, 'empty linked list has no first element.' return s[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def first(self):\n if self.is_empty():\n raise Empty('list is empty')\n return self._head._next._element # front aligned with head of list", "def first(self):\n if self.is_empty():\n raise Empty('list is empty')\n return self._head._element ...
[ "0.8302732", "0.80180436", "0.7996175", "0.79702324", "0.7927017", "0.7857343", "0.781984", "0.7566057", "0.7566057", "0.7417194", "0.74003017", "0.7326504", "0.7226518", "0.72149956", "0.71793175", "0.7158552", "0.71470237", "0.711482", "0.70440286", "0.7015269", "0.6974497"...
0.80580926
1
Return the element at the index i.
def getitem_link(s, i): while i > 0: s, i = rest(s), i - 1 return first(s)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __getitem__(self, i):\n\t\tif i < self.n:\n\t\t\treturn self.v[i]", "def __getitem__(self, i):\n return self.get(i, i + 1)", "def at(self, i): # pylint: disable=invalid-name\n return self._collection.at(i)", "def __getitem__(self, i):\n return self._ar[i]", "def __getitem__(self,i...
[ "0.77450424", "0.7719901", "0.76535714", "0.7637271", "0.74509263", "0.736621", "0.7338026", "0.72599876", "0.71994966", "0.7158954", "0.7085822", "0.6988378", "0.6934727", "0.6882624", "0.68701315", "0.6863925", "0.6861713", "0.6759231", "0.6732252", "0.6725775", "0.6719507"...
0.0
-1
Return a linked list of partition of n using parts up to m. Each partition is represented as a linked list.
def partitions(n, m): if n == 0: return link(empty, empty) elif n < 0 or m == 0: return empty else: using_m = partitions(n-m, m) with_m = apply_to_all_link(lambda s: link(m, s), using_m) without_m = partitions(n, m-1) return extend_link(with_m, without_m)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def partitions(n, m):\n if n == 0:\n return link(empty, empty) #A LIST containing the empty partition\n elif n < 0 or m == 0:\n return empty\n else:\n using_m = partitions(n-m, m)\n with_m = apply_to_all_link(lambda s: link(m, s), using_m)\n without_m = partitions(n, m-1...
[ "0.85267216", "0.81772673", "0.7715053", "0.7451254", "0.73839056", "0.7286676", "0.7224421", "0.71836346", "0.7161897", "0.70386356", "0.69995934", "0.6953063", "0.6883224", "0.68341243", "0.68231815", "0.67895097", "0.6745905", "0.6662967", "0.6657839", "0.66233855", "0.658...
0.8183731
1
Read textfile into a list of characters.
def _read_chars(filename): with open(filename, "r") as f: return list(f.read())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getlistfromtext(self,filename):\n l=[]\n\n if self.encoding:\n f = codecs.open(filename,\"r\",encoding=self.encoding)\n for line in f:\n l.append(line.rstrip())\n f.close()\n\n else:\n f = open(filename,\"r\")\n for line...
[ "0.7797019", "0.7692268", "0.76224816", "0.7505364", "0.7467279", "0.74498594", "0.74065286", "0.7393378", "0.7189307", "0.7189307", "0.718575", "0.71296006", "0.7128037", "0.7103139", "0.6993273", "0.6954452", "0.69005", "0.6879312", "0.68749774", "0.6872089", "0.6828317", ...
0.8381397
0
Takes a recipe id and queries storage for the reviews of that recipe
def get_reviews(recipe_id=None): recipe = storage.get(Recipe, recipe_id) print(recipe) if not recipe: abort(404) reviews = [] for review in recipe.reviews: reviews.append(review.to_dict()) return jsonify(reviews)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_review(recipe_id=None):\n\n if not storage.get(Recipe, recipe_id):\n abort(404)\n data = request.get_json()\n if not data:\n abort(400, 'Not a JSON')\n if 'user_id' not in data.keys():\n abort(400, 'Missing user_id')\n if not storage.get(User, data['user_id']):\n ...
[ "0.66114295", "0.65849173", "0.65241224", "0.6489395", "0.6412487", "0.6387869", "0.6369061", "0.636602", "0.63461775", "0.6252506", "0.61526704", "0.6137812", "0.6105889", "0.609834", "0.6005004", "0.59731907", "0.59368044", "0.58929306", "0.5812475", "0.5778954", "0.5776133...
0.7480168
0