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
This returns the total value (price) of all unconsumed bottles of this label, added together.
def unconsumedValue(self): value = 0 for bottle in self.bottles: if bottle.consumption == None: value += bottle.inflatedCost return value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def totalValue(self):\n\n\t\tvalue = 0\n\t\tfor bottle in self.bottles:\n\t\t\tvalue += bottle.inflatedCost\n\n\t\treturn value", "def get_total(self):\n total = 0.00\n\n for _drink in self.drinks:\n total = total + _drink.get_price()\n\n for _food in self.food:\n total...
[ "0.71366096", "0.7054682", "0.7002307", "0.692349", "0.6689894", "0.66624624", "0.663871", "0.66339916", "0.66246104", "0.6535497", "0.65155625", "0.6415112", "0.635748", "0.63303185", "0.63290447", "0.63061535", "0.6293522", "0.62630177", "0.6251291", "0.62362224", "0.620674...
0.71843904
0
Find largest 2^n that is <= given number.
def prevpow2(i): n = 1 while 2*n <= i: n *= 2 return n
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def largest_exponent(i, n):\n x = 1\n while i ** x <= n:\n x += 1\n x -= 1\n print(i, x, i**x)\n return i ** x", "def _nearest_bigger_power_of_two(x: int) -> int:\n y = 2\n while y < x:\n y *= 2\n return y", "def ceillog( n ) : ## ceil( log_2 ( n ))...
[ "0.7364856", "0.7220699", "0.71639603", "0.71285456", "0.71056217", "0.70454973", "0.70280796", "0.6953697", "0.69153583", "0.69078165", "0.6884936", "0.68798625", "0.686944", "0.68523663", "0.685187", "0.6785887", "0.67648023", "0.67581284", "0.6746755", "0.6734345", "0.6685...
0.0
-1
Pads the edges of an ndimensional input array with a constant value across all of its dimensions.
def ndpad(a,npad=None,padval=0): if npad == None: npad = np.ones(a.ndim) elif np.isscalar(npad): npad = (npad,)*a.ndim elif len(npad) != a.ndim: raise Exception('Length of npad (%i) does not match the '\ 'dimensionality of the input array (%i)' %(len(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pad_edge_to_shape(arr, nx, ny):\n\tnxa, nya = arr.shape\n\n\tfor n in [nx, ny, nxa, nya]:\n\t\tif not isodd(n):\n\t\t\traise Exception(\"[pad_edge_to_shape] only accept odd-number-length arrays\")\n\n\tif nx > nxa:\n\t\tdx = (nx - nxa)/2\n\t\tarr = np.pad(arr, ((int(dx), int(dx)), (0, 0)), 'constant', constant...
[ "0.70748633", "0.6740863", "0.66968995", "0.66164505", "0.6341354", "0.6333178", "0.6298866", "0.6266749", "0.6240734", "0.6142749", "0.61150956", "0.6076388", "0.6069231", "0.6006855", "0.599805", "0.5995245", "0.5971221", "0.59542406", "0.594628", "0.59075075", "0.59069514"...
0.52360415
92
return the indices for he unique rows of matrix (data)
def unique_rows(data): udict = dict() for row in range(len(data)): row_data = tuple(data[row,:]) if not row_data in udict: udict[row_data] =row uInd=udict.values() uRows=np.c_[udict.keys()] return uInd, uRows
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unique_rows(mat, return_inverse=False):\n\n b = np.ascontiguousarray(mat).view(np.dtype((np.void, mat.dtype.itemsize * mat.shape[1])))\n if not return_inverse:\n _, idx = np.unique(b, return_index=True)\n else:\n _, idx = np.unique(b, return_inverse=True)\n \n return idx", "def _...
[ "0.7141886", "0.6757034", "0.67283213", "0.6579893", "0.6348019", "0.62737936", "0.6192369", "0.6148231", "0.6143522", "0.6118104", "0.6085444", "0.60841966", "0.6032499", "0.59927875", "0.59516716", "0.5946568", "0.59439254", "0.59393436", "0.5928374", "0.59168315", "0.59092...
0.75071067
0
Return the current user data or redirect to /login
def user(self): user = None if not 'user' in self.session and os.environ['APPLICATION_ID'].startswith('dev'): if self.request.get('paToken'): user = Github({'paToken': self.request.get('paToken')}).user() if user: logging.info("Read user da...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getUser(self):\n user = users.get_current_user()\n if not user:\n self.redirect(users.create_login_url(self.request.uri))\n else:\n return user", "def index(self):\n\n # try and pull the user's data\n user = get_active_user_data()\n\n if not user:\n # they a...
[ "0.77440953", "0.7385087", "0.7254302", "0.7151339", "0.71150273", "0.7096179", "0.70940703", "0.7076556", "0.7071419", "0.7068162", "0.7036085", "0.70170254", "0.6947696", "0.6947696", "0.6947696", "0.6928699", "0.69211274", "0.690957", "0.68713444", "0.6862259", "0.6838694"...
0.7382352
2
Test retrieving a list of recipes
def test_retrieve_recipes(self): sample_recipe(name="Avocado toast") sample_recipe(name='Baklava') res = self.client.get(RECIPES_URL) recipes = Recipe.objects.all() serializer = RecipeSerializer(recipes, many=True) self.assertEqual(res.status_code, status.HTTP_200_OK) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_recipe_information_bulk(self):\n pass", "def test_get_recipe_information(self):\n pass", "def test_get_random_recipes(self):\n pass", "def test_retrieving_recipes(self):\n sample_recipe(user=self.user)\n sample_recipe(user=self.user)\n\n res = self.clien...
[ "0.81033486", "0.79804796", "0.79704607", "0.7895004", "0.78925663", "0.78374314", "0.76769125", "0.767323", "0.74180543", "0.73952913", "0.73141986", "0.72933966", "0.7182399", "0.71717864", "0.7072997", "0.70101357", "0.6926858", "0.6895275", "0.689", "0.6882748", "0.687709...
0.79853475
1
Test creating a recipe without ingredients
def test_create_basic_recipe(self): payload = {'name': 'Focaccia', 'description': 'Detailed description'} res = self.client.post(RECIPES_URL, payload) self.assertEqual(res.status_code, status.HTTP_201_CREATED) recipe = Recipe.objects.get(id=res.data['id']) self.assertEqual(p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_basic_recipe_without_name_fails(self):\n\n payload = {'name': '', 'description': 'Detailed description'}\n res = self.client.post(RECIPES_URL, payload, format='json')\n\n self.assertEqual(res.status_code, status.HTTP_400_BAD_REQUEST)", "def test_creating_recipe_with_ingredien...
[ "0.7708326", "0.7443987", "0.7335176", "0.7308571", "0.7274586", "0.72403127", "0.72294104", "0.719718", "0.7191069", "0.7180229", "0.7140219", "0.71174973", "0.7011941", "0.69898486", "0.6964708", "0.6949731", "0.69417", "0.6928444", "0.69159746", "0.6894708", "0.68790495", ...
0.7214119
7
Test creating a recipe without a name fails
def test_create_basic_recipe_without_name_fails(self): payload = {'name': '', 'description': 'Detailed description'} res = self.client.post(RECIPES_URL, payload, format='json') self.assertEqual(res.status_code, status.HTTP_400_BAD_REQUEST)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_recipes_create(self):\n app = self.create_app()\n c = app.test_client()\n\n # test if authorization is required to create a recipe\n rv = c.get('/recipes/create')\n self.assertRedirects(rv, \"/auth/login\")\n\n # test recipe page\n register(c, app.config[\"...
[ "0.67582875", "0.6713784", "0.66163594", "0.65163505", "0.64881986", "0.6484161", "0.64016336", "0.64010495", "0.6394526", "0.6370647", "0.63700956", "0.63484925", "0.6314215", "0.6284871", "0.62412465", "0.6167506", "0.61221933", "0.6113738", "0.60885835", "0.6055646", "0.60...
0.7653346
0
Test updating a recipe with put
def test_full_update_recipe(self): recipe = sample_recipe() recipe.ingredients.create(name='Eggs') original_description = recipe.description payload = { 'name': 'Vegan gnocchi', 'ingredients': [{'name': 'Vegegg'}] } url = recipe_detail_url(recipe....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_full_update_recipe(self):\n recipe = sample_recipe(user=self.user)\n recipe.tag.add(sample_tag(user=self.user))\n payload = {\n 'title':'chicken noodles',\n 'time_minutes':50,\n 'price':12.67,\n }\n url = detail_url(recipe.id)\n se...
[ "0.78568375", "0.77522546", "0.77279186", "0.7705229", "0.75257915", "0.7482447", "0.7438424", "0.74294686", "0.73584014", "0.73344994", "0.73036426", "0.7301371", "0.71905774", "0.7173551", "0.7123488", "0.7123488", "0.7123488", "0.712177", "0.7091531", "0.7063973", "0.70320...
0.7712993
3
Classifies each sample in data in one of the classes definited using the method labels_map. Returns a list of the same length of data where the ith element is the class assigned to data[i].
def classify(som, data): winmap = som.labels_map(X_train, y_train) default_class = np.sum(list(winmap.values())).most_common()[0][0] result = [] for d in data: win_position = som.winner(d) if win_position in winmap: result.append(winmap[win_position].most_common()[0][0]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def classify(self, data ):\n\t\tguesses = []\n\t\tfor datum in data:\n\t\t\tvectors = util.Counter()\n\t\t\tfor l in self.legalLabels:\n\t\t\t\tvectors[l] = self.weights[l] * datum\n\t\t\tguesses.append(vectors.argMax())\n\t\treturn guesses", "def classify(self, data ):\n\t\tguesses = []\n\t\tfor datum in data:\...
[ "0.7065536", "0.7065536", "0.700341", "0.700123", "0.6958873", "0.69268996", "0.6831625", "0.67626524", "0.6755509", "0.67288136", "0.6716321", "0.6683421", "0.6629587", "0.6629587", "0.6625043", "0.6624215", "0.6618992", "0.66058224", "0.65080017", "0.642267", "0.64096785", ...
0.6328104
23
For a vector theta ~ Dir(alpha), computes E[log(theta)] given alpha.
def dirichlet_expectation(alpha): if (len(alpha.shape) == 1): return(psi(alpha) - psi(n.sum(alpha))) return(psi(alpha) - psi(n.sum(alpha, 1))[:, n.newaxis])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lnlike(theta, dtarray, dmagarray, sigmaarray):\n gamma, A = theta\n\n aux=np.sum(np.log(like_one(theta,dtarray,dmagarray,sigmaarray)))\n\n return aux", "def my_loglike(theta, x, data, sigma):\n\n model = my_model(theta, x)\n\n return -0.5*len(x)*np.log(2*math.pi*sigma**2) - (0.5/sigma**2) * np...
[ "0.6623323", "0.6441767", "0.6319258", "0.62098414", "0.61824596", "0.61517125", "0.6130782", "0.6114013", "0.61095107", "0.6073221", "0.6054262", "0.6042971", "0.6041485", "0.6023611", "0.6020745", "0.60070974", "0.5977238", "0.5959134", "0.59383947", "0.5936282", "0.5921042...
0.0
-1
View function for home page
def index(request): num_videos = Video.objects.all().count() num_courses = Course.objects.all().count() context = { 'num_videos': num_videos, 'num_courses': num_courses, } return render(request, 'index.html', context=context)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def home(request):\n\treturn render(request, \"compta/home.html\")", "def home(request):\r\n return render(request, 'home.html')", "def home_page(request):\r\n return render(request, 'ez_main/home_page.html')", "def home(request):\n return render(request, 'base/home.html')", "def home():\n\n ret...
[ "0.86116576", "0.85212237", "0.828496", "0.8280337", "0.82703805", "0.8265588", "0.823626", "0.82155585", "0.8204985", "0.8200393", "0.8196282", "0.8196282", "0.8196282", "0.8196282", "0.8196282", "0.8196282", "0.8196282", "0.8196282", "0.8196282", "0.8196282", "0.8196282", ...
0.0
-1
View function for about page
def about(request): context = { } return render(request, 'about.html', context=context)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def about_page(request):\r\n return render(request, 'ez_main/about_page.html')", "def aboutus(request):\r\n\treturn render(request, 'aboutus.html')", "def about_us(request):\n\treturn render(request, 'about_us.html')", "def about():\n\n return render_template('about_page.html', title='About')", "def a...
[ "0.8355086", "0.8312827", "0.82380015", "0.82251745", "0.822185", "0.8204033", "0.8199857", "0.81911445", "0.8180105", "0.8174336", "0.8160832", "0.81555104", "0.8136058", "0.81355864", "0.81152654", "0.811384", "0.8104847", "0.81029695", "0.8097307", "0.8092031", "0.80877846...
0.78916156
47
Returns a string representation of self
def __str__(self): # on trie la liste de valeurs par ordre croissant self.vals.sort() return '{' + ','.join([str(e) for e in self.vals]) + '}'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def toString(self) -> str:\n raise NotImplementedError", "def to_string(self):\r\n return self.__str__()", "def __str__ (self) :\n\n return self.as_string()", "def __repr__(self) -> str:\n return str(self)", "def __repr__(self):\n\n return str(self)", "def __repr__(self...
[ "0.8763703", "0.86562204", "0.8588547", "0.8529507", "0.8518056", "0.85170096", "0.85170096", "0.85170096", "0.85170096", "0.85170096", "0.85170096", "0.85170096", "0.85170096", "0.85170096", "0.85170096", "0.85170096", "0.85170096", "0.85170096", "0.84979486", "0.84701693", ...
0.0
-1
Normalize stock prices using the first row of the dataframe.
def normalize_data(df): return df / df.ix[0,:]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize_price_values(df):\r\n\r\n\tdf_normalize_dict = dict()\r\n\r\n\tfor i, col in enumerate(df.columns):\r\n\t\tcol_array = np.array(df[col])\r\n\t\tdf_normalize_dict[\"Normalized\" + col] = preprocessing.normalize([col_array])[0]\r\n\r\n\tdf_normalize = pd.DataFrame(df_normalize_dict, index=df.index)\r\n...
[ "0.7371106", "0.72801805", "0.7170513", "0.6706012", "0.6654511", "0.6565614", "0.6506297", "0.65005535", "0.6419033", "0.6419033", "0.6391165", "0.63268536", "0.6315997", "0.6304028", "0.61510575", "0.6140669", "0.60450274", "0.6029373", "0.60041595", "0.5880133", "0.5829837...
0.7246905
3
If signal is None, signal_path must be set. If weights is None, weights_path must be set Setting signal_path and weights_path allows to use dynamic data loading with lru_cache. It is useful when your dataset is large. Args
def __init__(self, freq, signal=None, weights=None, signal_path=None, weights_path=None): if (signal is None and signal_path is None): raise ValueError('signal or signal_path must be provided') if (weights is None and weights_path is None): raise ValueError('signal or signal_path...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_weights(self, the_path):\n self.model.load_state_dict(torch.load(the_path))", "def load_weights(self, path=None):\n\n if path is None:\n path = self.checkpoints_dir\n\n self.model.load_weights(tf.train.latest_checkpoint(path))\n logging.info(f'\\tWeights loaded fro...
[ "0.5540702", "0.54982555", "0.5465026", "0.54177743", "0.53977966", "0.5362939", "0.53489757", "0.53489757", "0.53251344", "0.5309731", "0.5309731", "0.53026253", "0.52891326", "0.52592576", "0.52135", "0.5206958", "0.5192607", "0.518099", "0.51167053", "0.51148754", "0.50440...
0.6660356
0
Create holidays data frame for the end of the year season.
def create_end_of_year_holidays_df(): holidays = pd.DataFrame({ 'holiday': 'end_of_year', 'ds': pd.to_datetime( ['2019-12-25', '2020-12-25'] ), 'lower_window': -7, 'upper_window': 7, }) return holidays
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_fed_holidays(start_date, end_date):\n\n dr = pd.date_range(start=start_date, end=end_date)\n df = pd.DataFrame()\n df['Date'] = dr\n\n cal = calendar()\n holidays = cal.holidays(start=dr.min(), end=dr.max())\n\n df['Holiday'] = df['Date'].isin(holidays)\n df_holiday = df[df['Holiday'] ...
[ "0.6553565", "0.6493272", "0.64793694", "0.622014", "0.61762357", "0.60843945", "0.6073655", "0.60243803", "0.60228825", "0.6016245", "0.5972893", "0.5954934", "0.5951974", "0.5809751", "0.5794923", "0.57821554", "0.57458144", "0.5704674", "0.5637749", "0.56101394", "0.560207...
0.8475737
0
Induces a random typo into the input token with a given probability.
def induce_noise_typos(input_token, typos : dict, prob = 1.0): if input_token in typos and random.random() <= prob: typos_for_token = typos[input_token] typo_idx = random.randint(0, len(typos_for_token) - 1) typo = typos_for_token[typo_idx] return typo, typo != input_token else:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def random_distribution():\n b = np.random.uniform(0.0, 1.0, size=[1, vocabulary_size])\n return b / np.sum(b, 1)[:, None]", "def random_distribution():\n b = np.random.uniform(0.0, 1.0, size=[1, vocabulary_size])\n return b/np.sum(b, 1)[:,None]", "def random_distribution():\n b = np.random.unif...
[ "0.6239329", "0.6228471", "0.6228471", "0.62233233", "0.6091594", "0.6003502", "0.5989174", "0.59626144", "0.5943841", "0.5923232", "0.5899579", "0.5890256", "0.5875842", "0.58572656", "0.58443916", "0.5765246", "0.57500386", "0.5739233", "0.5739233", "0.5720066", "0.5715422"...
0.7111269
0
Get route send state
def getRouteSendActive(*args, **kwargs): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_state(self):\n ret = self.send(\"?S\", recv=True)\n assert ret in \"WDR\"\n return ret", "def send_state(self, req):\n state = GetStateResponse()\n state.update_underway = self.update_underway\n state.world = self.scenarios[self.scenario_idx][0]\n state.sc...
[ "0.7035245", "0.62164575", "0.6176743", "0.60522985", "0.6002121", "0.5957839", "0.5957839", "0.59208906", "0.58553505", "0.5826387", "0.5685848", "0.5684062", "0.56246877", "0.56156206", "0.56137985", "0.56053776", "0.55872554", "0.5510968", "0.55063266", "0.5470109", "0.546...
0.69378054
1
Move tensor(s) to a chosen device
def to_device(data, device): if isinstance(data, (list,tuple)): return [to_device(x, device) for x in data] return data.to(device, non_blocking=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_to_device(input_tensors: List[torch.Tensor],\n target_device: Optional[torch.device],\n non_blocking: bool = False) -> Iterable[torch.Tensor]:\n return (tensor if tensor.device == target_device or target_device is None\n else tensor.to(target_device, non_b...
[ "0.62812006", "0.60571903", "0.59711176", "0.5875509", "0.5805213", "0.5803408", "0.5785348", "0.57743037", "0.5773978", "0.56551516", "0.56403613", "0.56376976", "0.556951", "0.55620337", "0.55513346", "0.55418897", "0.5503264", "0.5465752", "0.54527617", "0.54527617", "0.54...
0.0
-1
Sets the private property __api_key to allow information retrieval from the selected inofficial IMDb REST API
def set_api_key(api_key): Movie.__api_key = api_key
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def SetAPIKey(self, api_key):\n self._api_key = api_key", "def SetAPIKey(self, api_key):\n self._api_key = api_key", "def api_key(self, api_key):\n\n self._api_key = api_key", "def set_api_key(self, api_key):\n self.api_key = api_key\n self.session.auth = (\"api\", api_key)", "de...
[ "0.80814177", "0.80814177", "0.7798116", "0.7555325", "0.7493613", "0.738859", "0.72739583", "0.72717834", "0.72629946", "0.72392243", "0.72326624", "0.7125125", "0.71221435", "0.7094733", "0.70813483", "0.70786273", "0.7055916", "0.7053033", "0.70342547", "0.6994829", "0.696...
0.7574494
3
This method will grab the first resume object and compare it to our test case and what we expect using the method defined in our resume model last_name_first_name
def test_last_name_first_name(self): current_resume = resume.objects.first() expected = 'Bielinski, Nicholas' case = current_resume.last_name_first_name() self.assertEqual(case, expected)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_full_name(self):\n current_resume = resume.objects.first()\n expected = 'Nicholas Bielinski'\n case = current_resume.full_name()\n self.assertEqual(case, expected)", "def test_resume_created(self):\n\n\t\t# Pass a resume file object to CVResume to save to db/disk\n\t\tCVResum...
[ "0.66364294", "0.63328934", "0.6240789", "0.56515604", "0.5609393", "0.5564774", "0.54490584", "0.5423683", "0.53985345", "0.53911626", "0.5389533", "0.53498", "0.53456694", "0.53253233", "0.52584267", "0.52399075", "0.52290124", "0.5224997", "0.5207656", "0.5189579", "0.5188...
0.6835695
0
This method will grab the first resume object and compare it to our test case and what we expect using the method defined in our resume model get_education
def test_get_education(self): current_resume = resume.objects.first() expected = list(current_resume.get_education()) case = list(current_resume.education_set.all()) self.assertEqual(case,expected)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_experience(self):\n current_resume = resume.objects.first()\n expected = list(current_resume.get_experience())\n case = list(current_resume.experience_set.all())\n self.assertEqual(case,expected)", "def test_resume_created(self):\n\n\t\t# Pass a resume file object to CVRe...
[ "0.6503877", "0.6403518", "0.62503386", "0.5958376", "0.5746377", "0.5535521", "0.55176723", "0.54322916", "0.5417124", "0.5327987", "0.52882856", "0.5273539", "0.52406", "0.5232225", "0.520038", "0.5182467", "0.5155429", "0.5129079", "0.5110051", "0.50939655", "0.50937176", ...
0.7036994
0
Constructor. Any message fields that are implicitly/explicitly set to None will be assigned a default value. The recommend use is keyword arguments as this is more robust to future message changes. You cannot mix inorder arguments and keyword arguments.
def __init__(self, *args, **kwds): if args or kwds: super(SensorState, self).__init__(*args, **kwds) # message fields cannot be None, assign default values for those that are if self.header is None: self.header = std_msgs.msg.Header() if self.sim_step is None: self.sim_step =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args, **kwds):\n if args or kwds:\n super(KomodoSpeechRecCommand, self).__init__(*args, **kwds)\n #message fields cannot be None, assign default values for those that are\n if self.header is None:\n self.header = std_msgs.msg.Header()\n if self.cmd is None:\n ...
[ "0.7794795", "0.77207875", "0.77207875", "0.7687243", "0.7625947", "0.7564293", "0.7440383", "0.74175525", "0.7352349", "0.7308313", "0.72808266", "0.72378874", "0.722805", "0.7225032", "0.7225032", "0.7219433", "0.72120637", "0.72120637", "0.72120637", "0.72120637", "0.72120...
0.0
-1
(Generator) Yields each of the alphabetic characters in a string.
def alpha_chars (text): for letter in text: if letter.isalpha (): yield letter
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gen_alphabet():\n for x in list(xrange(ord('a'),ord('z')+1)):\n yield chr(x)", "def letters():\n letters = \"BINGO\"\n for letter in letters:\n yield letter", "def alphametics(s):\n words = re.findall(\"[A-Za-z]+\", s)\n chars = set(\"\".join(words)) # Characters to be ...
[ "0.766867", "0.7420937", "0.7158086", "0.67932135", "0.66354424", "0.66159403", "0.6599739", "0.6362456", "0.6343288", "0.63327587", "0.62894404", "0.62067884", "0.6127309", "0.6127309", "0.6127309", "0.61133635", "0.6081948", "0.60405755", "0.60404944", "0.6031312", "0.60182...
0.81256324
0
[Lab 14] Scales the vector x by a constant alpha.
def vec_scale (x, alpha): return [x_i*alpha for x_i in x]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_alpha(self, alpha=1.0):\r\n self.unif[17] = alpha", "def alpha(self, x):\n alpha = [0] * len(self.A)\n for i in xrange(len(self.A)):\n alpha[i] = self.A[i].dot(x) / self.mu\n\n # Apply projection\n alpha = self.project(alpha)\n\n return alpha", "def gues...
[ "0.67462593", "0.6362331", "0.62898505", "0.62876225", "0.6162155", "0.6056142", "0.6043743", "0.6029091", "0.6006104", "0.59830624", "0.59809655", "0.59763116", "0.5941285", "0.5927482", "0.5913922", "0.5901176", "0.5894425", "0.58874387", "0.5830705", "0.58277094", "0.58127...
0.6824012
0
[Lab 14] Adds the scalar value c to every element of x.
def vec_add_scalar (x, c): return [x_i+c for x_i in x]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scalar_multiply(c: float, v: Vector) -> Vector:\n return [c * v_i for v_i in v]", "def scalar_multiply(c: float, v: Vector) -> Vector:\n return [c * v_i for v_i in v]", "def scalar_multiply(c, v):\n\treturn [c * v_i for v_i in v]", "def scale(c, scalar):\n return [c[0]*scalar, c[1]*scalar]", "...
[ "0.645461", "0.645461", "0.6337266", "0.63219905", "0.62739515", "0.62046134", "0.62046134", "0.6029307", "0.6012549", "0.59823424", "0.59100974", "0.584622", "0.5830653", "0.57910347", "0.57558453", "0.5742593", "0.57363415", "0.572871", "0.5707376", "0.56881905", "0.5655132...
0.83270913
0
Given a `float`, returns its binary form as a string.
def float_to_bin (x): assert type (x) is float s_hex = float.hex (x) hex_parts = RE_FLOAT_HEX_PARTS.match (s_hex) assert hex_parts s = hex_parts.group ('sign') m = hex_parts.group ('mantissa') se = hex_parts.group ('signexp') e = hex_parts.group ('exp') # Mantissa, includin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _floatToBytestring(value, numberOfRegisters=2):\n _checkNumerical(value, description='inputvalue')\n _checkInt(numberOfRegisters, minvalue=2, maxvalue=4, description='number of registers')\n\n formatcode = '>' # Big-endian\n if numberOfRegisters == 2:\n formatcode += 'f' # Float (4 bytes)\...
[ "0.72873336", "0.72778803", "0.7049035", "0.6979534", "0.6955068", "0.68843937", "0.67476755", "0.6713939", "0.66478384", "0.65779734", "0.6367039", "0.630046", "0.6271491", "0.6219043", "0.6203176", "0.6173669", "0.6166321", "0.6153719", "0.61336195", "0.61124074", "0.607726...
0.7102452
2
Generates 'm' noisy observations for a linear model whose predictor (nonintercept) coefficients are given in 'x'. Decrease 'sigma' to decrease the amount of noise.
def generate_data (m, x, sigma=1.0/(2**0.5)): assert (type (x) is np.ndarray) and (x.ndim == 2) and (x.shape[1] == 1) n = len (x) A = np.random.rand (m, n) A[:, 0] = 1.0 b = A.dot (x) + sigma*np.random.randn (m, 1) return (A, b)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def noise(x: np.ndarray) -> np.ndarray:\n\n return np.random.normal(loc=MEAN, scale=1e-2, size=1)", "def generate_noisy_window(d, sigma= 1):\n return np.random.normal(scale=sigma, size=d)", "def add_noise(Y, sigma):\r\n return Y + np.random.normal(0, sigma, Y.shape)", "def model_gauss_noise(sigma, n...
[ "0.6092505", "0.60270995", "0.59387547", "0.58079237", "0.5737313", "0.57152", "0.5682847", "0.56649846", "0.56201303", "0.55905986", "0.5566366", "0.5550676", "0.5549603", "0.55376756", "0.5523535", "0.5476474", "0.5465465", "0.53947264", "0.53899723", "0.5381233", "0.537908...
0.56396747
8
Display durations in seconds in a readable form.
def display_duration(description, total_seconds): duration_args = ['{0} days, ','{1} hours, ','{2} minutes, ','{3} seconds '] duration_names = ['days', 'hours', 'minutes', 'seconds'] duration_unit_in_seconds = [24 * 60 * 60, 60 * 60, 60, 1] # Calculate time units, rounding fractional seconds, # and...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_seconds(duration):\n\treturn stats_utils.format_seconds(duration)", "def pretty_print_seconds(self, num_seconds):\r\n # Here _ is the N variant ungettext that does pluralization with a 3-arg call\r\n _ = self.runtime.service(self, \"i18n\").ungettext\r\n hours = num_seconds // 360...
[ "0.7697494", "0.76552415", "0.72010756", "0.7065205", "0.7058942", "0.70589304", "0.70532465", "0.7012484", "0.6916185", "0.68863195", "0.6848411", "0.6728021", "0.67110425", "0.6694079", "0.6622895", "0.6594973", "0.65906596", "0.653608", "0.6523483", "0.6518563", "0.6510243...
0.7073246
3
Load data for specified city, month and day, or as applicable.
def load_data(city, month, day): # Load data file into a dataframe. print('\nLoading data for city = {}, month = {}, day = {}...' .format(city, month, day)) df = pd.read_csv(CITY_DATA[city]) # Convert the Start Time column to datetime. df['Start Time'] = pd.to_datetime(df['Start Time']) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_data(city, month, day):\n if city == 'new york city':\n df=pd.read_csv(\"./new_york_city.csv\")\n else: \n df=pd.read_csv(\"./\" + city + \".csv\")\n df['Start Time']=pd.to_datetime(df['Start Time'])\n df['month'] = df['Start Time'].dt.month\n df['day'] = df['Start Time'].dt.d...
[ "0.8190308", "0.818666", "0.8183753", "0.8160309", "0.8149875", "0.811988", "0.81090003", "0.80912447", "0.8085883", "0.80856633", "0.80724996", "0.80557233", "0.8050945", "0.80472803", "0.80334985", "0.8032042", "0.8026659", "0.8018097", "0.80145663", "0.8001409", "0.7990581...
0.76729375
76
Display statistics on the most frequent times of travel. The function assumes the presence in the Dataframe of columns for 'Month', Day of Week' and 'Hour' and that Hour is an integer representing the hour in 24 hour format (e.g. 17 = 5pm, 5 = 5am).
def time_stats(df, timing_off_flag, month, day): print('\nCalculating The Most Frequent Times of Travel...\n') if not timing_off_flag: start_time = time.time() # If more than one month, display the most common month. if month == "All": display_most_common('The most common month(s):', df...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def time_stats(df):\n\n print(\"\\nDisplaying the most frequent times of travel...\\n\")\n start_time = time.time()\n\n # Ignoring getting the most popular month when the data is already filtered by month\n if len(df[\"month\"].unique()) > 1:\n most_popular_month, month_count = get_most_popular(...
[ "0.865205", "0.857788", "0.85673714", "0.8547373", "0.84821355", "0.84819305", "0.8474293", "0.8457032", "0.845438", "0.845365", "0.8453254", "0.8434474", "0.84329", "0.8432701", "0.8431652", "0.8427904", "0.8408821", "0.8404698", "0.8401156", "0.83989346", "0.8398109", "0....
0.0
-1
Display statistics on the most popular stations and trip. The function assumes the presence in the Dataframe of columns for 'Start Station' and 'End Station'.
def station_stats(df, timing_off_flag): print('\nCalculating The Most Popular Stations and Trip...\n') if not timing_off_flag: start_time = time.time() show_in_rows = True # Show results in rows (better for multiples). # Display most commonly used start station. display_most_common('The m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def station_stats(df):\n\n print('\\nCalculating The Most Popular Stations and Trip...\\n')\n start_time = time.time()\n\n # TO DO: display most commonly used start station\n start_station_count = df['Start Station'].value_counts()[df['Start Station'].value_counts() == df['Start Station'].value_counts(...
[ "0.8615547", "0.8602319", "0.8594257", "0.85916424", "0.8578669", "0.8568244", "0.8562653", "0.8559396", "0.8554434", "0.8551285", "0.85511225", "0.85371834", "0.8533339", "0.8531855", "0.85314673", "0.85218763", "0.85217327", "0.85200024", "0.8519829", "0.8512708", "0.850973...
0.0
-1
Display statistics on the most popular stations and trip. The function assumes the presence in the Dataframe of a column for 'Trip Duration'.
def trip_duration_stats(df, timing_off_flag): print('\nCalculating Trip Duration...\n') if not timing_off_flag: start_time = time.time() # Display total travel time. display_duration('Total duration of all trips:\n', df['Trip Duration'].sum()) # EXTENSION: display minimum trave...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def station_stats(df):\n\n print('\\nCalculating The Most Popular Stations and Trip...\\n')\n start_time = time.time()\n\n # TO DO: display most commonly used start station\n popular_start_station = df['Start Station'].mode()[0]\n\n # TO DO: display most commonly used end station\n popular_end_st...
[ "0.82203543", "0.81997657", "0.8180946", "0.81757003", "0.816", "0.81585497", "0.8148318", "0.81158763", "0.8112239", "0.81015164", "0.80948395", "0.80795735", "0.80740887", "0.8071285", "0.8044685", "0.8042057", "0.80366313", "0.803572", "0.80323714", "0.80260694", "0.801673...
0.0
-1
Parses the date field based to return the correct value. If the value is 'Just Posted' or 'Today', set day = 0.
def parse_date(date_posted: str, today: date) -> Union[date, None]: if not date_posted: return None if date_posted in {"Just posted", "Today"}: days_ago = 0 else: days_ago = int(date_posted[0]) if date_posted else 0 return today - timedelta(days=days_ago)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _parse_date_wo_default_month_day(self, field):\r\n # It's not trivial to replace dateutil b/c parsing timezones as Z, +03:30, -400 is hard in python\r\n # however, we don't want dateutil to default the month or day (but some tests at least expect\r\n # us to default year); so, we'll see if...
[ "0.66166264", "0.5982016", "0.5946381", "0.58628625", "0.58628625", "0.5762587", "0.57179576", "0.5693804", "0.5671181", "0.5656358", "0.5612516", "0.55772495", "0.555575", "0.55305463", "0.5524904", "0.54997355", "0.5494109", "0.5471046", "0.54521734", "0.5430507", "0.541228...
0.6539143
1
updateAlpacaDeviceNameList updates the indi device name selectors combobox with the discovered entries. therefore it deletes the old list and rebuild it new.
def updateAlpacaDeviceNameList(self, deviceNames): self.ui.alpacaDeviceList.clear() self.ui.alpacaDeviceList.setView(QListView()) for deviceName in deviceNames: self.ui.alpacaDeviceList.addItem(deviceName) return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_device_list(self, device_list):\n self.device_list = device_list\n\n self.device_combo.clear()\n\n if not device_list:\n return\n\n self.device_combo.addItem(\"\")\n\n active_entry = None\n\n for dev in device_list:\n\n action_string = \"{m...
[ "0.6842839", "0.6552486", "0.6548222", "0.59289885", "0.58572453", "0.574594", "0.5392472", "0.53213036", "0.5286323", "0.5285137", "0.52759945", "0.5236435", "0.5165592", "0.51622915", "0.5146045", "0.5118332", "0.5093552", "0.5074116", "0.5053878", "0.50514036", "0.5034101"...
0.7756851
0
updateSGProDeviceNameList updates the indi device name selectors combobox with the discovered entries. therefore it deletes the old list and rebuild it new.
def updateSGProDeviceNameList(self, deviceNames): self.ui.sgproDeviceList.clear() self.ui.sgproDeviceList.setView(QListView()) for deviceName in deviceNames: self.ui.sgproDeviceList.addItem(deviceName) return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_device_list(self, device_list):\n self.device_list = device_list\n\n self.device_combo.clear()\n\n if not device_list:\n return\n\n self.device_combo.addItem(\"\")\n\n active_entry = None\n\n for dev in device_list:\n\n action_string = \"{m...
[ "0.67138946", "0.6436016", "0.63982064", "0.6244521", "0.5763582", "0.56752294", "0.5407658", "0.5382027", "0.5367582", "0.5326008", "0.5271619", "0.5218974", "0.51767164", "0.51060617", "0.5070315", "0.50677264", "0.50446874", "0.5019104", "0.49977344", "0.49760225", "0.4968...
0.7787743
0
updateSGProDeviceNameList updates the indi device name selectors combobox with the discovered entries. therefore it deletes the old list and rebuild it new.
def updateNINADeviceNameList(self, deviceNames): self.ui.ninaDeviceList.clear() self.ui.ninaDeviceList.setView(QListView()) for deviceName in deviceNames: self.ui.ninaDeviceList.addItem(deviceName) return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def updateSGProDeviceNameList(self, deviceNames):\n self.ui.sgproDeviceList.clear()\n self.ui.sgproDeviceList.setView(QListView())\n for deviceName in deviceNames:\n self.ui.sgproDeviceList.addItem(deviceName)\n return True", "def update_device_list(self, device_list):\n ...
[ "0.77884877", "0.6711578", "0.6395692", "0.6242371", "0.5762176", "0.56746346", "0.5406087", "0.5379286", "0.5370134", "0.5323343", "0.5269187", "0.5216611", "0.5175841", "0.5105096", "0.507038", "0.5064967", "0.5042007", "0.50170124", "0.49952573", "0.49733996", "0.49664146"...
0.64341456
2
Performs a get call to the api.
def _get(self, relative_uri, payload={}): response = self.session.get( self._get_absolute_uri(relative_uri), params=payload) if response.status_code != 200: raise ApiException('API returned %s' % response.status_code) return self._parse(response.content, sel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get(self, *args, **kwargs):\n return self._request('get', *args, **kwargs)", "def get(self, api_path, *args, **kwargs):\n\n\t\treturn self._do_operation(u'get', api_path, *args, **kwargs)", "def get(self, api_path, *args, **kwargs):\n\n return self._do_operation(u'get', api_path, *args, **kw...
[ "0.7853812", "0.7831877", "0.76743704", "0.7635168", "0.7616737", "0.7604631", "0.7603225", "0.75755036", "0.7545404", "0.73294705", "0.73114055", "0.73054355", "0.72735626", "0.72599655", "0.7216778", "0.72147095", "0.7202322", "0.72022295", "0.71832633", "0.7180241", "0.717...
0.0
-1
Return the axis label for an experiment.
def _fact2label(self, ax_ndx, fact_ndx): if len(self._dims) > 1: key,value = self._factors[ax_ndx][fact_ndx] else: if fact_ndx == 1: return '' key,value = self._factors[ax_ndx][0] return '{} = {}'.format(key,value) if key != '' else ''
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getAxisLabel(self, dim=0):\n return self.__axis_labels__[dim]", "def axis_name(self):\n return self._axis_name", "def get_xlabel(self):\n return self._frame.GetXaxis().GetTitle()", "def get_axis_name(self, axis_id):\n if isinstance(axis_id, str):\n if axis_id in sel...
[ "0.8199995", "0.7460472", "0.73125696", "0.6733561", "0.65919125", "0.6559759", "0.62548625", "0.6250321", "0.6193733", "0.6137797", "0.6135996", "0.61245096", "0.6112237", "0.6111702", "0.608084", "0.6078953", "0.60780257", "0.6056622", "0.60543054", "0.60070395", "0.5995077...
0.0
-1
Return a PayloadFromDict object that will convert the source dict to a payload of the target class. All values of dict items are expected to be lists.
def __init__(self, source, target): self._verify_class_dicts() self.source = source # this relies on payload module names matching payload class names self.module = getattr(regrws.payload, target.__module__.split('.')[-1]) self.payload = target()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_dict(cls, dikt) -> 'Body':\n return util.deserialize_model(dikt, cls)", "def from_dict(cls, dikt) -> 'Body':\n return deserialize_model(dikt, cls)", "def from_dict(cls, dict_, archive_reader):\n\n obj = Source.__new__(cls)\n super().__init__(obj)\n obj.to_natives(dic...
[ "0.5709198", "0.5677408", "0.56486124", "0.5604381", "0.5597064", "0.55731875", "0.5550588", "0.55322653", "0.55143726", "0.5509267", "0.54902655", "0.54867643", "0.54697824", "0.54697824", "0.54697824", "0.54697824", "0.54697824", "0.54697824", "0.54697824", "0.54697824", "0...
0.0
-1
Get the environment variable.
def _get_env(key: str) -> str: value = os.getenv(key) assert isinstance(value, str), ( f"the {key} environment variable must be set and a string, " f"{value=}" ) return value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetEnvVariable(name):\n return os.environ.get(name)", "def env(var):\n return os.environ[var]", "def get_environment_variable(name):\n\n variable = None\n try:\n variable = os.environ[name]\n except KeyError:\n pass\n \n return variable", "def getenv(self, var):\n ...
[ "0.8341453", "0.8062252", "0.80459845", "0.8012182", "0.779349", "0.77395684", "0.7737103", "0.7736536", "0.76870877", "0.7686322", "0.7678296", "0.7649419", "0.7621249", "0.75579655", "0.7524827", "0.74989533", "0.74787927", "0.74604577", "0.7403519", "0.7349242", "0.7320503...
0.80955946
1
Retrieve the stage configuration.
def stage(self) -> Stage: if self._stage is None: stage_key = "STAGE" stage_str = self._get_env(stage_key) assert stage_str in _STAGES, ( f"the {stage_key} environment variable value must be one of " f"{_STAGES}, {stage_str=}" ) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stage_cfg(self, stage_name: str):\n stage_cfg = self._app_cfg['stages'][stage_name]\n global_cfg = self._app_cfg['global']\n\n # Copy all of the global configuration items into the stage config section\n stage_cfg['parameters'].update(**global_cfg)\n return stage_cfg", "def...
[ "0.7182858", "0.67468876", "0.6592159", "0.65044117", "0.65044117", "0.65044117", "0.6492366", "0.6443227", "0.6381361", "0.6281882", "0.6243507", "0.620966", "0.61930096", "0.61930096", "0.61930096", "0.61882675", "0.6184398", "0.6180898", "0.6180898", "0.6180898", "0.618089...
0.6602624
2
Retrieve the package_storage_bucket_name configuration.
def package_storage_bucket_name(self) -> str: if self._package_storage_bucket_name is None: package_storage_bucket_name = self._get_env("PACKAGE_STORAGE_BUCKET_NAME") self._package_storage_bucket_name = package_storage_bucket_name return self._package_storage_bucket_name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bucket_name(self) -> typing.Optional[str]:\n return self._values.get('bucket_name')", "def bucket_name(self) -> typing.Optional[str]:\n return self._values.get('bucket_name')", "def gcs_bucket(self) -> str:\n return pulumi.get(self, \"gcs_bucket\")", "def secrets_bucket_name(self):\n...
[ "0.7418269", "0.7418269", "0.73772347", "0.73441905", "0.73316646", "0.73008436", "0.7176804", "0.717286", "0.717286", "0.7152588", "0.7152588", "0.7152588", "0.7152588", "0.7152588", "0.7152588", "0.7152588", "0.7152588", "0.7152588", "0.7152588", "0.69405", "0.6935878", "...
0.84172916
0
Retrieve the access_control_allow_origin configuration.
def access_control_allow_origin(self) -> str: if self._access_control_allow_origin is None: access_control_allow_origin = self._get_env("ACCESS_CONTROL_ALLOW_ORIGIN") self._access_control_allow_origin = access_control_allow_origin return self._access_control_allow_origin
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_access_control_allow_origin(self):\n return self.access_control_allow_origin", "def http_header_access_control_allow_origin():\n return 'Access-Control-Allow-Origin'", "def allow_origins(self) -> Optional[Sequence[str]]:\n return pulumi.get(self, \"allow_origins\")", "def allowed...
[ "0.8499172", "0.7605839", "0.67787504", "0.6529629", "0.6505759", "0.6491768", "0.6427015", "0.63813573", "0.6330934", "0.6308371", "0.62970215", "0.60918975", "0.60232615", "0.5872341", "0.586881", "0.5866486", "0.58340925", "0.5796879", "0.57109547", "0.5701661", "0.5650875...
0.8082247
1
Retrieve the access_control_allow_headers configuration.
def access_control_allow_headers(self) -> str: if self._access_control_allow_headers is None: access_control_allow_headers = self._get_env("ACCESS_CONTROL_ALLOW_HEADERS") self._access_control_allow_headers = access_control_allow_headers return self._access_control_allow_headers
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_access_control_allow_headers(self):\n return self.access_control_allow_headers", "def allowed_headers(self):\n\n return self._allowed_headers", "def allow_headers(self) -> Optional[Sequence[str]]:\n return pulumi.get(self, \"allow_headers\")", "def allowed_headers(self) -> typing...
[ "0.848187", "0.7188289", "0.7024918", "0.67447263", "0.6650517", "0.64105564", "0.6364686", "0.6307511", "0.627564", "0.6227396", "0.61184645", "0.60557556", "0.5995747", "0.5878745", "0.5844155", "0.5838459", "0.58346146", "0.58152944", "0.57989836", "0.57916677", "0.5786762...
0.821496
1
Retrieve the default_credentials_id configuration.
def default_credentials_id(self) -> str: if self._default_credentials_id is None: default_credentials_id = self._get_env("DEFAULT_CREDENTIALS_ID") self._default_credentials_id = default_credentials_id return self._default_credentials_id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def auth_config_id(self) -> Sequence[str]:\n return pulumi.get(self, \"auth_config_id\")", "def credential_id(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"credential_id\")", "def default_storage_account_id(self) -> str:\n return pulumi.get(self, \"default_storage_accou...
[ "0.69821006", "0.6614287", "0.6544026", "0.64617586", "0.64507127", "0.6441844", "0.6405215", "0.6384589", "0.62822336", "0.6264175", "0.6186932", "0.61812216", "0.6063073", "0.6052873", "0.6043047", "0.5996459", "0.59839934", "0.5970893", "0.5966746", "0.5958236", "0.5955688...
0.8479063
0
Removes stop words from a tokenized sentence
def stop_words_remover(tokenized_sent): # Convert string back to list filtered_sentence = [] stop_words = set(stopwords.words("english")) for word in literal_eval(tokenized_sent): if word not in stop_words: filtered_sentence.append(word) return filtered_sentence
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_stopwords_fun(self):\n tokens = str(self.doc).split()\n cleaned_tokens = [token for token in tokens\n if token.lower() not in self.stopword_list]\n self.doc = ' '.join(cleaned_tokens)", "def removeStopword(text, stop_words=stop_words):\n word_tokens = w...
[ "0.8389512", "0.83719605", "0.8244052", "0.81836987", "0.80287904", "0.79766536", "0.79550785", "0.7944314", "0.78956", "0.7888704", "0.7886362", "0.78531396", "0.78506005", "0.77985585", "0.77864045", "0.77498156", "0.7746916", "0.771699", "0.770927", "0.7693116", "0.7682686...
0.81616026
4
dw = dw` { L_val(w`, alpha) } w+ = w + eps dw w = w eps dw hessian = (dalpha { L_trn(w+, alpha) } dalpha { L_trn(w, alpha) }) / (2eps) eps = 0.01 / ||dw||
def compute_hessian(self, dw, trn_X, trn_y, epsilon: float = 0.01): norm = torch.cat([w.view(-1) for w in dw]).norm() eps = epsilon / norm dalpha_pos = self.finite_difference(dw, trn_X, trn_y, eps, wrt='alpha') dalpha_neg = self.finite_difference(dw, trn_X, trn_y, -eps, wrt='alpha') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hessian(poly):\n return gradient(gradient(poly))", "def amended_gradient(self, dw, trn_X, trn_y, epsilon: float = 0.01, amend: float = 0.1):\n norm = torch.cat([w.view(-1) for w in dw]).norm()\n eps = epsilon / norm\n\n dw_pos = self.finite_difference(dw, trn_X, trn_y, eps, wrt='weigh...
[ "0.6822256", "0.67025983", "0.6654734", "0.65710294", "0.6477701", "0.63771653", "0.6376971", "0.6376971", "0.6311902", "0.6299026", "0.62950784", "0.6217092", "0.61834186", "0.61795", "0.6146845", "0.61441666", "0.6142313", "0.6106731", "0.6058134", "0.60392934", "0.6033669"...
0.70821196
0
GET /canon/ Must return status code 200
def test_get(self): self.assertEqual(200, self.response.status_code)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index():\n return (jsonify(status=\"OK\")), 200", "def index():\n # curl -k -X POST https://127.0.0.1:43210/api/v1.0 -H 'content-type: application/json' -d '{\"data\": \"exhaust\"}'\n return jsonify({'meta': {'success': True, 'code': 200}, 'result': {\"message\": request.get_json()}}), 200", "def ...
[ "0.6167156", "0.5899435", "0.5751378", "0.5705325", "0.5682897", "0.5674316", "0.56618583", "0.5634525", "0.56250316", "0.56105804", "0.56082785", "0.55815625", "0.5576192", "0.55664295", "0.5540307", "0.55368835", "0.55240923", "0.55029327", "0.5447691", "0.54309887", "0.541...
0.51699305
95
Setup the initial values for the parameters to be optimized (fitted)
def setup_fitting_init_pars(inparam, night, band, masterbeam, order): # Determine whether IGRINS mounting was loose or # the night of interest is in question if (int(night) < 20180401) or (int(night) > 20190531): IPpars = inparam.ips_tightmount_pars[band][masterbeam][order] else: IPpars...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resetParams(self):\n self.prediction = cons.init_pred # Classifier payoff - initialized to a constant initial payoff value\n self.error = cons.init_err # Classifier error - initialized to a constant initial error value\n self.fitness = cons.init_fit # Classifier fitness ...
[ "0.73729235", "0.73685074", "0.7204093", "0.7204093", "0.7204093", "0.71527046", "0.7109222", "0.70906174", "0.70119065", "0.70044607", "0.6974778", "0.694932", "0.6932054", "0.69195116", "0.6882618", "0.6863889", "0.68560153", "0.68560153", "0.67917556", "0.67707175", "0.674...
0.64903027
51
build a wordnet offsetsynset dict, as suggested in this SO post
def store_wn_lookup(): syns = list( wn.all_synsets() ) #syn_str = map(lambda s: str(s).replace("Synset",'').strip('()').strip("'"), syns) syn_str = map(lambda s: str(s).replace("Synset",'').strip('()').strip("'").strip('"'), syns) #offsets_list = [("n%08d" % s.offset, s) for s in syns] olist = map(l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_lemma_pos_offset_map():\n lemma_pos_offset_map = defaultdict(dict)\n ##pos_lemma_offset_map = defaultdict(dict)\n for suffix in _FILEMAP.values():\n # parse each line of the file (ignoring comment lines)\n with open(wordnet_dir+'index.%s' % suffix) as fin:\n for i, line i...
[ "0.6443904", "0.59904605", "0.5976617", "0.595055", "0.58728015", "0.5838823", "0.57856035", "0.5770872", "0.5574813", "0.5530199", "0.5499793", "0.54042435", "0.53676575", "0.5365947", "0.5359893", "0.5309148", "0.53001344", "0.5287636", "0.5257414", "0.5222102", "0.5221093"...
0.678214
0
Convert input UTC timestamp to local timezone.
def utc_to_local(utc_dt: datetime) -> datetime: if utc_dt is None: return None local_dt = utc_dt.astimezone(tz.tzlocal()) return local_dt
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def UTCtimestampTolocal(ts, local_tz):\n t_utc = dt.datetime.fromtimestamp(ts,tz=pytz.timezone(\"UTC\"))\n t_local = t_utc.astimezone(local_tz)\n return t_local", "def timestamp_to_local(timestamp):\n naive = datetime.datetime.strptime(timestamp, '%Y-%m-%dT%H:%M:%SZ').replace(tzinfo=pytz.utc)\n re...
[ "0.801562", "0.78291744", "0.76696664", "0.74626726", "0.7174784", "0.71128833", "0.70447266", "0.70406413", "0.7038577", "0.7018921", "0.7004543", "0.69634545", "0.69316155", "0.6920649", "0.6906102", "0.6834218", "0.6808308", "0.6801729", "0.6763384", "0.6758848", "0.675254...
0.68485636
15
Convert input local timezone timestamp to UTC timezone.
def local_to_utc(local_dt: datetime) -> datetime: if local_dt is None: return None utc_dt = local_dt.astimezone(tz.UTC) return utc_dt
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def UTCtimestampTolocal(ts, local_tz):\n t_utc = dt.datetime.fromtimestamp(ts,tz=pytz.timezone(\"UTC\"))\n t_local = t_utc.astimezone(local_tz)\n return t_local", "def localToUTC(t, local_tz):\n t_local = local_tz.localize(t, is_dst=None)\n t_utc = t_local.astimezone(pytz.utc)\n return t_utc", ...
[ "0.7504289", "0.74859524", "0.7440629", "0.7357582", "0.7313858", "0.71291375", "0.7063828", "0.7006611", "0.68404126", "0.673425", "0.67234975", "0.6719648", "0.6695059", "0.667435", "0.66163605", "0.6614698", "0.65348226", "0.65332985", "0.6532639", "0.6530088", "0.651378",...
0.70806277
6
Return the creation datetime of this experiment data.
def creation_datetime(self) -> datetime: return utc_to_local(self._db_data.creation_datetime)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_creation_time(self):\n return self.creation_time", "def get_creation_time(self):\n return self.get_attr('date_created')", "def creation_time(self) -> str:\n return pulumi.get(self, \"creation_time\")", "def creation_time(self) -> str:\n return pulumi.get(self, \"creation_t...
[ "0.8311438", "0.82469696", "0.812193", "0.812193", "0.812193", "0.80909884", "0.80909884", "0.80909884", "0.803599", "0.8019377", "0.8019377", "0.7953435", "0.7953435", "0.7953435", "0.7931279", "0.7905995", "0.7905995", "0.7905995", "0.789896", "0.78683853", "0.78081614", ...
0.8208431
2
Return the start datetime of this experiment data.
def start_datetime(self) -> datetime: return utc_to_local(self._db_data.start_datetime)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_datetime_start(self):\n return self.get_t_sect()['datetime_start']", "def start_time(self):\n # TODO: use pd.Timestamp instead\n return self.time[0].to_pydatetime()", "def start(self) -> datetime:\n return self._start", "def start(self):\n # type: () -> datetime\n ...
[ "0.83715767", "0.8268385", "0.81634057", "0.81589437", "0.81268144", "0.8078509", "0.8001099", "0.8001099", "0.8001099", "0.8001099", "0.8001099", "0.8001099", "0.8001099", "0.8001099", "0.7982609", "0.79790926", "0.79518664", "0.79429674", "0.7933631", "0.7932464", "0.789753...
0.8054732
6
Return the end datetime of this experiment data. The end datetime is the time the latest job data was added without errors; this can change as more jobs finish.
def end_datetime(self) -> datetime: return utc_to_local(self._db_data.end_datetime)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def end(self) -> datetime:\n return self._end", "def end_time(self):\n # TODO: use pd.Timestamp instead\n return self.time[-1].to_pydatetime()", "def end_time(self):\n return self._end_time", "def end_time(self):\n return self._end_time", "def end_time(self):\n ret...
[ "0.76465285", "0.76458716", "0.7640677", "0.7640677", "0.7640677", "0.7640677", "0.7640677", "0.7640677", "0.75482595", "0.75473326", "0.7507595", "0.7350901", "0.7340042", "0.73313844", "0.7311017", "0.72841406", "0.72716016", "0.72716016", "0.72655225", "0.7251588", "0.7250...
0.7654552
0
Return the hub of this experiment data.
def hub(self) -> str: return self._db_data.hub
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hub(self):\n return self._application_handler.data_collection.hub", "def hub(self) -> N4Hub:\n return self.platform_common.hub", "def _samp_hub(self):\n return self.proxy.samp.hub", "def getHubble(self):\n return self._hubble", "def hub_name(self):\n return self._...
[ "0.83677095", "0.805713", "0.7706438", "0.7258118", "0.69434506", "0.68720275", "0.66646737", "0.6521313", "0.64760774", "0.63531435", "0.6275451", "0.62338746", "0.6123511", "0.61120695", "0.6061617", "0.603155", "0.5905103", "0.58853745", "0.5871158", "0.5802781", "0.572431...
0.8198742
1
Return the group of this experiment data.
def group(self) -> str: return self._db_data.group
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_group(self):\n return self._group", "def group(self):\n return self._group", "def group(self):\n return self._group", "def group(self):\n return self._group", "def get_group(self):\n\t\treturn self.variables.get('group')", "def group(self):\n return self.propert...
[ "0.82442665", "0.82426876", "0.82426876", "0.82426876", "0.8217748", "0.80105937", "0.7968851", "0.79486686", "0.787269", "0.77912265", "0.766107", "0.7573221", "0.7573221", "0.7573221", "0.7381078", "0.7331955", "0.7331955", "0.7331955", "0.73194414", "0.73094803", "0.726371...
0.77649266
10
Return the project of this experiment data.
def project(self) -> str: return self._db_data.project
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def project(self):\n return self._project", "def project(self):\n return self._project", "def project(self):\n return self._project", "def project(self):\n return self._project", "def project(self):\n return self._project", "def getProject(self):\r\n return self....
[ "0.80236626", "0.80236626", "0.80236626", "0.80236626", "0.80236626", "0.7964119", "0.79533833", "0.7937571", "0.7911267", "0.78891206", "0.78891206", "0.78891206", "0.78891206", "0.78891206", "0.78891206", "0.78891206", "0.78891206", "0.78891206", "0.78891206", "0.78891206", ...
0.7818807
29
Return the share level for this experiment
def share_level(self) -> str: return self._db_data.share_level
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def share_type(self) -> str:\n return pulumi.get(self, \"share_type\")", "def level(self):\n return self.game_data['player stats']['Level']", "def share_info(self) -> Sequence['outputs.ShareInfoElementResponse']:\n return pulumi.get(self, \"share_info\")", "def getLevel(self):\n r...
[ "0.5961452", "0.5894079", "0.5570122", "0.5560998", "0.5543545", "0.5526534", "0.5485564", "0.5485564", "0.5485564", "0.5485564", "0.5474747", "0.5458396", "0.5458396", "0.5450978", "0.5443471", "0.5405041", "0.5389859", "0.5365532", "0.53505695", "0.532974", "0.52839667", ...
0.80433404
0
Return the database service.
def service(self) -> Optional[IBMExperimentService]: return self._service
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_db(self):\n self.logger.info('in get_db()')\n try:\n return self.client[self.db_name]\n except Exception as e:\n self.logger.error(f'Error occurred while getting client {e}')", "def getDb(self):\n return self.db", "def get_database(self):\n retur...
[ "0.7517992", "0.74533683", "0.7400521", "0.7353447", "0.7353447", "0.72779244", "0.72628486", "0.7210041", "0.7204975", "0.71421534", "0.71394044", "0.710123", "0.7095708", "0.7085826", "0.6955539", "0.69484633", "0.69270545", "0.69119555", "0.68993706", "0.68789864", "0.6878...
0.0
-1
Return the experiment data at the specified index.
def data( self, index: Optional[Union[int, slice, str]] = None, ) -> Union[Dict, List[Dict]]: self._retrieve_data() if index is None: return self._result_data.copy() if isinstance(index, (int, slice)): return self._result_data[index] if isinsta...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __getitem__(self, index):\n\n if self._data_indices is not None:\n index = self._data_indices[index]\n data = self._dataset[index]\n return data", "def __getitem__(self, index):\n return self.dataset[index]", "def get_data(self, index=0):\n if index is None:\n ...
[ "0.7360088", "0.7230474", "0.7142219", "0.70794433", "0.7074295", "0.69526154", "0.69199806", "0.6890676", "0.68488276", "0.68488276", "0.6811153", "0.680421", "0.67867315", "0.6763953", "0.6710909", "0.6705396", "0.66356224", "0.6630615", "0.66043764", "0.65403104", "0.65137...
0.69274074
6
Return the experiment status.
def status(self) -> ExperimentStatus: if all( len(container) == 0 for container in [ self._result_data, self._jobs, self._job_futures, self._analysis_callbacks, self._analysis_futures, self._f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def status(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"status\")", "def status(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"status\")", "def status(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"status\")", "def status(self) -> pulumi.Output[str]:\n ...
[ "0.74598557", "0.74598557", "0.74598557", "0.74598557", "0.74598557", "0.74598557", "0.74598557", "0.74598557", "0.74598557", "0.74598557", "0.74598557", "0.74598557", "0.74598557", "0.74598557", "0.74598557", "0.74598557", "0.74598557", "0.74598557", "0.74598557", "0.73491883"...
0.70688826
96
Return the experiment job execution status.
def job_status(self) -> JobStatus: statuses = set() with self._jobs.lock: # No jobs present if not self._jobs: return JobStatus.DONE statuses = set() for job in self._jobs.values(): if job: statuses.add...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def status(self):\n return self.job_proto.status", "def status(self) -> str:\n return self._check_job_status()", "def get_status(self):\n\t\treturn call_sdk_function('PrlJob_GetStatus', self.handle)", "def job_status(self, job_id):\n\n response = self.batch_client.describe_jobs(jobs=[job...
[ "0.797115", "0.7626941", "0.75662005", "0.7505498", "0.7481017", "0.74668974", "0.74545133", "0.7357164", "0.7319241", "0.71512866", "0.7093327", "0.70906943", "0.6974851", "0.68573093", "0.679144", "0.67616034", "0.6718037", "0.6708237", "0.6680923", "0.6665475", "0.6629132"...
0.6954849
13
Validate an email using Mailgun.
def validate_email(self, email): data = { "address": email } resp = self.get(_u.build_uri("address.validate"), data) return utils.handle_response(resp)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_parse_valid_request(self):\n request = self.factory.post(self.url, data=mailgun_payload)\n email = self.parser.parse(request)\n self._assertEmailParsedCorrectly(email, mailgun_payload)", "def email_validate(self,\r\n email,\r\n fix_typos=F...
[ "0.6949642", "0.6919618", "0.6819963", "0.6767459", "0.6660087", "0.6595556", "0.6586254", "0.6550652", "0.65419906", "0.6522163", "0.6425467", "0.6422758", "0.63785195", "0.63655496", "0.6364324", "0.6359974", "0.6351327", "0.6330538", "0.63176584", "0.62947917", "0.6258132"...
0.6839902
2
Get the total stats of a specified domain (`<domain/stats/total`).
def get_total_stats(self, **kwargs): resp = self.get(_u.build_uri("total.stats", domain=self.domain), kwargs) return utils.handle_response(resp)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stats_get(self, host):\n\n s = self.get_stats(host, 'get')\n\n data = {\n 'missing_total': s['missing_total'],\n 'exists_total': s['exists_total'],\n 'current': s['current'],\n 'total': s['total']\n }\n\n return data", "def total(sel...
[ "0.64953107", "0.6434208", "0.6291768", "0.6003003", "0.5999368", "0.57673377", "0.57635796", "0.57534575", "0.5727809", "0.57129586", "0.56741464", "0.56524754", "0.5645492", "0.5563786", "0.55424386", "0.553859", "0.5525109", "0.5515685", "0.5512926", "0.55043834", "0.55023...
0.74730736
0
Return normal to a segment defined by two points (end, start) The normal is a unit vector (normalized by its length)
def segment_normal(end, start): return rotate90cw(unit(make_vector(end, start)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normal(point_one, point_two):\n return numpy.array([point_one[1] - point_two[1], point_two[0] - point_one[0]])", "def normal(point0: Point, point1: Point) -> Tuple[Point, float]:\n mid: Point = ((point0[0] + point1[0]) / 2, (point0[1] + point1[1]) / 2)\n v: Vector2 = (point1[0] - point0[0], point1[1...
[ "0.71030354", "0.7005137", "0.6869082", "0.65474004", "0.6543886", "0.65186495", "0.64897406", "0.6424013", "0.6414078", "0.6399166", "0.63676035", "0.6352875", "0.6346771", "0.6340706", "0.63279265", "0.6317402", "0.6245882", "0.61598873", "0.61419547", "0.6123057", "0.60855...
0.8303345
0
cast from float tensor ([1.,1.]) to int image ([0,255])
def to_int(image): image = tf.clip_by_value(image, -1, 1) return tf.image.convert_image_dtype((image + 1.0) / 2.0, tf.uint8)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def float2int(img_float):\n img = img_float * (MAX_VALUE - 1)\n img = img.astype(int)\n return img", "def tensor_to_image(x):\n\n # scale back from [-1,1] to [0,255] \n x = x.add(1).mul_(255).div_(2) # x = ((x + 1)*255 / (2))\n \n if x.is_cuda:\n x = x.cpu()\n\n x = x.data.nump...
[ "0.7358158", "0.73276913", "0.6970659", "0.6764872", "0.6739017", "0.66921455", "0.66294557", "0.65918756", "0.6563598", "0.6550647", "0.64720356", "0.647187", "0.64185196", "0.6367765", "0.63437194", "0.63364106", "0.63337463", "0.6305305", "0.62948024", "0.6263061", "0.6261...
0.7630529
0
Test rendering a schema with references as URL pointing to a YAML file
def test_references_url_yaml() -> None: soup = generate_case("references_url_yaml") tests.html_schema_doc_asserts.assert_property_names(soup, ["address", "street_address", "city", "state"]) tests.html_schema_doc_asserts.assert_descriptions(soup, ["Testing $ref with URL with YAML destination"]) tests.h...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_references_url() -> None:\n\n soup = generate_case(\"references_url\")\n\n tests.html_schema_doc_asserts.assert_property_names(soup, [\"firstName\"])\n tests.html_schema_doc_asserts.assert_descriptions(soup, [\"Testing $ref with URL\", \"The person's first name.\"])\n tests.html_schema_doc_ass...
[ "0.6659201", "0.63814336", "0.63580984", "0.6151976", "0.6142749", "0.6036624", "0.5984149", "0.5943261", "0.5906646", "0.5857475", "0.5856845", "0.5855536", "0.5802851", "0.57780904", "0.5774281", "0.5761441", "0.57482505", "0.5710211", "0.5699136", "0.56840366", "0.56740004...
0.76384634
0
Test that having a description next to a $ref in an object uses that description and not the one from the referenced object
def test_description_with_ref() -> None: soup = generate_case("description_with_ref") tests.html_schema_doc_asserts.assert_descriptions( soup, ["We should see this", "inner description", "We should see this too"] )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_description_with_ref_link_to_reused_ref() -> None:\n soup = generate_case(\"description_with_ref\", GenerationConfiguration(link_to_reused_ref=False))\n\n tests.html_schema_doc_asserts.assert_descriptions(\n soup, [\"We should see this\", \"inner description\", \"We should see this too\", \"i...
[ "0.72383195", "0.689555", "0.6848524", "0.67768216", "0.66733485", "0.6430653", "0.63819915", "0.6288493", "0.6172914", "0.6093997", "0.6075981", "0.6051115", "0.6006429", "0.5983971", "0.5978027", "0.59510773", "0.59304583", "0.5920716", "0.59113884", "0.5895696", "0.5856179...
0.70741904
1
Test that having a description next to a $ref in an object uses that description and not the one from the referenced object
def test_description_from_ref() -> None: soup = generate_case("description_from_ref") tests.html_schema_doc_asserts.assert_descriptions(soup, ["a filled string"] * 2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_description_with_ref_link_to_reused_ref() -> None:\n soup = generate_case(\"description_with_ref\", GenerationConfiguration(link_to_reused_ref=False))\n\n tests.html_schema_doc_asserts.assert_descriptions(\n soup, [\"We should see this\", \"inner description\", \"We should see this too\", \"i...
[ "0.72383195", "0.70741904", "0.6848524", "0.67768216", "0.66733485", "0.6430653", "0.63819915", "0.6288493", "0.6172914", "0.6093997", "0.6075981", "0.6051115", "0.6006429", "0.5983971", "0.5978027", "0.59510773", "0.59304583", "0.5920716", "0.59113884", "0.5895696", "0.58561...
0.689555
2
Get a datetime tzaware time object from a timestamp
def from_timestamp(timestamp: float, tz_info: tzinfo = UTC) -> datetime: utc_dt = datetime.fromtimestamp(timestamp, tz=UTC) return convert_timezone(utc_dt, tz_info)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def timestamp_to_time(timestamp):\n n_day = timestamp // (60*24)\n n_time = timestamp - n_day * (60*24)\n n_hour = n_time // 60\n n_minutes = n_time - n_hour * 60\n return Time(n_day, n_hour, n_minutes)", "def _time_from_timestamp(timestamp: int) -> time:\n SECONDS_IN_MINUTE = 60\n SECONDS_I...
[ "0.73569435", "0.7095146", "0.7068814", "0.7003683", "0.699199", "0.6984039", "0.6851821", "0.6737096", "0.669087", "0.6647898", "0.66186595", "0.66161174", "0.661149", "0.6573137", "0.65106344", "0.6501489", "0.65013564", "0.6493674", "0.64839727", "0.6472279", "0.6465058", ...
0.6654329
9
Add a timezone to a naive datetime Raise an error in case of a tzaware datetime
def add_timezone(dt: datetime, tz_info: tzinfo = UTC) -> datetime: if dt.tzinfo is not None: raise ValueError(f"{dt} is already tz-aware") return dt.replace(tzinfo=tz_info)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def may_the_timezone_be_with_it(self):\n self.timestamp = pytz.utc.localize(self.timestamp)", "def add_local_timezone(dt):\n assert dt.tzinfo is None\n localtz = tzlocal.get_localzone()\n logging.warning(\"Assuming timezone for {} is {}\".format(dt, localtz))\n return localtz.localize(dt)", ...
[ "0.6834473", "0.6719845", "0.67034686", "0.65381306", "0.6455073", "0.6430281", "0.6420912", "0.63867235", "0.6385113", "0.63788813", "0.6353452", "0.63219005", "0.6318592", "0.6293526", "0.62916386", "0.62788343", "0.625945", "0.62426007", "0.6224375", "0.621212", "0.6200042...
0.7680081
0
Change the timezone of a tzaware datetime Raise an error in case of a naive datetime
def convert_timezone(dt: datetime, tz_info: tzinfo = UTC) -> datetime: if dt.tzinfo is None: raise ValueError(f"{dt} is a naive datetime") return dt.astimezone(tz_info)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tz_aware(value: datetime) -> datetime:\n if settings.USE_TZ:\n value = value.replace(tzinfo=timezone.utc)\n\n return value", "def test_datetime_in_timezone(monkeypatch):\n try:\n with monkeypatch.context() as m, freeze_time(\"1970-01-01 00:00:00\"):\n m.setenv(\"TZ\", \"Euro...
[ "0.72220784", "0.7190392", "0.6918409", "0.6897703", "0.6883826", "0.68323904", "0.6831575", "0.6820948", "0.677761", "0.67357635", "0.6722398", "0.67094827", "0.6686504", "0.6628855", "0.6621806", "0.6611476", "0.6558472", "0.6544679", "0.65106106", "0.6505062", "0.6482041",...
0.6444673
21
Returns the scaling factor necessary so that at least [delta] percent of the Gaussian nodes [x] satisfy | [x] |<= [L]. Mostly used for the infinite interval expansions.
def scale_factor(L,x,delta=0.5): from numpy import floor, ceil,abs,mean N = x.size delta = min(1.0,delta) Nfrac = ceil(N*delta) # Find scale interval [Lprev,Lnext] containing desired delta Lprev = 1e6 Lnext = Lprev Nxs = sum(abs(x*Lnext)<=L) while Nxs<Nfrac: Lprev = L...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_scaled_diff(self, prev_sigma, sigma):\n return np.linalg.norm(sigma - prev_sigma) / np.linalg.norm(sigma)", "def gradK(self, X, Xstar, param):\n r = l2norm_(X, Xstar)\n if param == 'l':\n num_one = 5 * r ** 2 * np.exp(-np.sqrt(5) * r / self.l)\n num_two = np.sq...
[ "0.61542714", "0.592842", "0.5898738", "0.589756", "0.5824373", "0.57803863", "0.5684737", "0.56766313", "0.56723964", "0.5664878", "0.5662565", "0.56541836", "0.5653758", "0.56512314", "0.5649636", "0.5636062", "0.56349653", "0.56281936", "0.55953413", "0.55738646", "0.55708...
0.7646707
0
Given a document (represented as a string), return a list of all of the words in that document, in order. Process document by coverting all words to lowercase, and removing any punctuation or English stopwords.
def tokenize(document): # Unable to acquire 'stopwords' without these snippets due to my python config # import ssl # ssl._create_default_https_context = ssl._create_unverified_context # nltk.download('stopwords') stops = nltk.corpus.stopwords.words("english") all_words = list() cleaned_w...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tokenize(document):\n raw_words=[word.lower() for word in nltk.word_tokenize(document) if word.isalpha()]\n raw_words=[word.lower() for word in raw_words]\n final_words=[]\n for word in raw_words:\n if word not in string.punctuation and word not in nltk.corpus.stopwords.words(\"english\"):\n...
[ "0.7945455", "0.7920988", "0.7898004", "0.7755041", "0.77347577", "0.76664394", "0.7387016", "0.7339664", "0.72888803", "0.72275144", "0.7075368", "0.7041337", "0.70225614", "0.70190245", "0.70190245", "0.6992113", "0.6973064", "0.69688004", "0.6964989", "0.69493914", "0.6945...
0.7725208
5
Given sentence and image embeddings, compute the error matrix
def compute_errors(s_emb, im_emb): erros = [order_violations(x, y) for x in s_emb for y in im_emb] return np.asarray(erros).reshape((len(s_emb), len(im_emb)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_embedding_matrix(self):\n self.id2word = dict([(self.vocab[word]['id'], word) for word in self.vocab])\n vocab_size = len(self.vocab)\n result = np.zeros((vocab_size, self.embed_dim))\n unknown_token_set = set()\n\n found_words = 0\n avg = np.zeros(self.embed_di...
[ "0.6236352", "0.60631925", "0.6018525", "0.59150034", "0.58150715", "0.5803172", "0.5692922", "0.56820816", "0.5668799", "0.5664964", "0.5642809", "0.5631807", "0.56111884", "0.56029725", "0.56009895", "0.55958384", "0.5579363", "0.5524484", "0.55223465", "0.55066633", "0.547...
0.6730203
0
Size of the dataset.
def size(self): return len(self.selected)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dataset_size(self):\n return self.dataset.size", "def dataset_size(self):\n if not self._dataset_size:\n # pylint: disable=attribute-defined-outside-init\n self._dataset_size = count_file_lines(\n self._hparams.source_dataset.files)\n return self._dat...
[ "0.9138172", "0.8446193", "0.83839023", "0.82936084", "0.82011366", "0.81763774", "0.81763774", "0.81763774", "0.81763774", "0.81756335", "0.8165018", "0.816301", "0.8139261", "0.8139261", "0.8139261", "0.8139261", "0.8139261", "0.81073326", "0.8090232", "0.80635065", "0.8007...
0.0
-1
A heap sort algorithm can be implemented by push and pop items in a heap data structure.
def heap_sort(alist: list, key=None) -> list: newList = List() hp = BinaryHeap(func=key) for item in alist: hp.heappush(item) for _ in range(len(alist)): newList.append(hp.heappop()) return newList
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def heap_sort(items):\n heapq.heapify(items)\n items[:] = [heapq.heappop(items) for i in range(len(items))]", "def heap_sort(items):\n heapq.heapify(items)\n items[:] = [heapq.heappop(items) for i in range(len(items))]", "def heap_sort(list):\n pass", "def heapsort(heap):\n ...
[ "0.80810106", "0.80810106", "0.8065213", "0.7969527", "0.7871505", "0.7779462", "0.7767052", "0.7767052", "0.7754931", "0.7722286", "0.7696757", "0.76917565", "0.76484823", "0.7641402", "0.75963074", "0.75474125", "0.74018455", "0.7368808", "0.730276", "0.7269775", "0.7239735...
0.71074367
25
Get probability of x being positive/negative
def _predict_doc(self, x, flag): if flag == 1: denom = self.X.num_positive() else: denom = self.X.num_negative() denom += self.X.vocab_size() # multiply word probabilities for all words in x words = tokenize(x) # prob = 1.0 # for word in words: # wi = self._doc_count_for_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def probit(x):\n from tensorflow_probability import distributions\n return distributions.Normal(0, 1).cdf(x)", "def probability(p):\n return p > random.uniform(0.0, 1.0)", "def prob(x):\n\treturn 1. * bivariate_normal(x, (0., 1.2), (1., 1.), .8) + \\\n\t 1.05 * bivariate_normal(x, (.6, -1.), (...
[ "0.77516997", "0.7646525", "0.760882", "0.7534861", "0.7312508", "0.7217548", "0.7212593", "0.7053256", "0.70349985", "0.6947563", "0.6878752", "0.6875178", "0.68683416", "0.6838652", "0.68095946", "0.6754729", "0.6716682", "0.67123187", "0.67123187", "0.6712007", "0.67010075...
0.0
-1
bin_to_utf(string) string may contain only '1','0',' '. Takes binary bites. Return UTF decoded str. Example
def byn_to_utf(str_): byte = bytearray() for item in str_.split(' '): byte.append(int(item, 2)) return byte.decode()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def binary_to_utf8():\n added, binary_seq, seq, file = binary_conversion()\n \n comp_seq = \"\"\n for bit in range(0, len(binary_seq), 8):\n #cut the sequence each 8 bits\n byte = binary_seq[bit:bit+8]\n code = int(byte, 2)\n #transforms 8 bits into a single character coded ...
[ "0.7198909", "0.6733615", "0.65858203", "0.6539944", "0.65385836", "0.6492881", "0.6360139", "0.63376904", "0.63263893", "0.6300334", "0.6178209", "0.6158652", "0.6157431", "0.61360717", "0.6127543", "0.6118636", "0.6114617", "0.61142415", "0.61050445", "0.6092993", "0.609007...
0.73303455
0
Create and return a new template node.
def template_node(scope_key): node = TemplateNode() node.scope_key = scope_key return node
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create(self):\n if self.node_id:\n raise ValueError(\"Node already created\")\n if not self.connector:\n raise ValueError(\"Gns3Connector not assigned under 'connector'\")\n if not self.project_id:\n raise ValueError(\"Node object needs to have project_id a...
[ "0.7092169", "0.68951344", "0.6671383", "0.65100455", "0.6503042", "0.6422178", "0.63820213", "0.6299173", "0.6233802", "0.6233802", "0.6129575", "0.61248887", "0.6032512", "0.60201544", "0.6016594", "0.59659797", "0.5939292", "0.5929075", "0.59224206", "0.5890705", "0.588056...
0.6904548
1
Bind a handler pair to an aliased member.
def bind_aliased_member(node, name, alias, pair, scope_key): target_node, member = resolve_alias(node, alias) if target_node is None or member is None: msg = "alias '%s' does not resolve to a declarative member" raise TypeError(msg % name) bind_aliased_member_impl(name, target_node, member, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bind_aliased_member_impl(name, node, member, pair, scope_key):\n if member.metadata is None or not member.metadata.get('d_member'):\n raise TypeError(\"alias '%s' is not a declarative member\" % name)\n if pair.writer is not None and not member.metadata.get('d_readable'):\n raise TypeError(...
[ "0.7424383", "0.6093026", "0.60644734", "0.5986479", "0.5921971", "0.58025056", "0.5741825", "0.5683469", "0.5651", "0.55914426", "0.5556978", "0.5556978", "0.5556978", "0.5556978", "0.5556978", "0.5556978", "0.5554496", "0.54737926", "0.5425069", "0.5411162", "0.54094696", ...
0.738595
1
Validate that an object is a Declarative type.
def validate_declarative(klass): if not isinstance(klass, type): raise TypeError("%s is not a type" % klass) if not issubclass(klass, Declarative): raise TypeError("'%s' is not a Declarative type" % klass.__name__)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _valid_typable_object(ui_object, platform=Platform.ANDROID):\n if platform == Platform.ANDROID:\n return ui_object.obj_type in _TYPABLE_OBJECT_DESC.keys()\n else:\n assert False, 'Wrong Platform'", "def verify_type(self, obj):\n return isinstance(obj, self.type_)", "def validate(self):\n ...
[ "0.5767053", "0.56969655", "0.5505446", "0.5501776", "0.54739076", "0.54402006", "0.54352033", "0.5432131", "0.5382167", "0.5313318", "0.52798873", "0.5243048", "0.519881", "0.51865125", "0.51820326", "0.51451397", "0.51337975", "0.51331466", "0.5130298", "0.5113282", "0.5109...
0.7657522
0
Compute distortion with given radial distance.
def getDr(d, IO, type_): # Define radial distance range xp = np.linspace(0, d, d*50) yp = 0 # Compute distortion corrections x0 = IO["x0"] y0 = IO["y0"] xbar = xp - x0 ybar = yp - y0 r = np.hypot(xbar, ybar) if type_ == "symmetric": k1 = IO["k1"] k2 = IO["k2"] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _radial_distortion(self, r2: np.ndarray) -> np.ndarray:\n # dr = (1 + k1 * r^2 + k2 * r^4 + k3 * r^6)/(1 + k4 * r^2 + k5 * r^4 + k6 * r^6)\n dr: np.ndarray = 1\n if self.k[0]:\n dr += self.k[0] * r2\n if self.k[1]:\n dr += self.k[1] * r2 * r2\n if self.k...
[ "0.7562922", "0.6847956", "0.6509773", "0.6339225", "0.6322459", "0.61489975", "0.6117932", "0.60744816", "0.604182", "0.60390115", "0.6038623", "0.5987627", "0.5950015", "0.59297115", "0.5891333", "0.5875402", "0.5860593", "0.5857393", "0.5832682", "0.58005834", "0.5791976",...
0.6186995
5
Returns the function corresponding to a rule.
def get_rule(self, rule_name): assert rule_name in self.rules.keys(), 'Rule name not in current set of rules' return self.rules[rule_name]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def execution_rule(f):\n return _ExecutionRuleFunction(f)", "def _get_rule(self, rule):\n for kbrule in self.rules:\n if rule == kbrule:\n return kbrule", "def _get_rule(self, rule):\n for kbrule in self.rules:\n if rule == kbrule:\n return k...
[ "0.71336573", "0.6980094", "0.6980094", "0.6980094", "0.6715975", "0.6715975", "0.6715975", "0.6484821", "0.6407591", "0.6407591", "0.6407591", "0.6407591", "0.6407591", "0.6407591", "0.6407591", "0.6319304", "0.62840444", "0.6229967", "0.62228966", "0.6199889", "0.61739576",...
0.63067126
16
Generate a _pb2.py from a .proto file. Invokes the Protocol Compiler to generate a _pb2.py from the given .proto file. Does nothing if the output already exists and is newer than the input.
def GenerateProto(source): output = source.replace(".proto", "_pb2.py") if not os.path.exists(output) or ( os.path.exists(source) and os.path.getmtime(source) > os.path.getmtime(output)): print("Generating %s..." % output) if not os.path.exists(source): sys...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_proto(source):\n\n output = source.replace(\".proto\", \"_pb2.py\")\n\n if not os.path.exists(output) or (\n os.path.exists(source) and os.path.getmtime(source) > os.path.getmtime(output)\n ):\n print(\"Generating %s...\" % output)\n\n if not os.path.exists(source):\n ...
[ "0.75922966", "0.7167947", "0.7146357", "0.70081615", "0.66439784", "0.656944", "0.6567505", "0.64830565", "0.6109961", "0.60823405", "0.6052203", "0.6043621", "0.5953926", "0.59039897", "0.5865753", "0.57863194", "0.571365", "0.56317145", "0.5610454", "0.5606293", "0.5500144...
0.7371245
1
Generate JWT IAM token
def get_token(url, key): # Payload for retrieving token payload = ("grant_type=urn:ibm:params:oauth:grant-type:" "apikey&apikey={}".format(key)) # Required headers headers_auth = { 'Content-Type': 'application/x-www-form-urlencoded', 'Accept': 'application/json', } ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _generate_jwt_token(self):\n import jwt\n from datetime import datetime, timedelta\n from django.conf import settings\n\n dt = datetime.now() + timedelta(days=60)\n\n token = jwt.encode({\n 'id': self.pk,\n 'username': self.username,\n 'exp': ...
[ "0.7822805", "0.7817401", "0.7787527", "0.77091163", "0.76944023", "0.76842445", "0.757803", "0.7521471", "0.7340754", "0.73173773", "0.7287648", "0.72640634", "0.7256946", "0.7224735", "0.7157771", "0.7133933", "0.7123265", "0.70758086", "0.705345", "0.705345", "0.705345", ...
0.0
-1
Calculate the Pchance values for the candidates self.Pchance filled in place Added as P_c to candidates Table
def calc_pchance(self, ndens_eval='driver', extinction_correct=False): # Correct for extinction if extinction_correct and self.filter+'_orig' not in self.candidates.keys(): ebv = nebular.get_ebv(self.frb.coord, definition='SandF')['meanValue'] linear_ext = photom.extinction_corre...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def chance(n, p):\n total = 0.0\n for k in range(n+1):\n total += comb(n, k, exact=False) * p**k * (1-p) ** (n-k)\n return total", "def chance_points(dice_list):\n return sum(dice_list)", "def _cost_caught_by_police(self):\n if self.fine_frequency != 0:\n if self.number_of_...
[ "0.6194795", "0.6146503", "0.61316603", "0.6109825", "0.592361", "0.5868454", "0.58537465", "0.58435285", "0.5730609", "0.572128", "0.56551254", "0.5618404", "0.5605583", "0.5597681", "0.5597638", "0.5592523", "0.5558241", "0.55329144", "0.5530034", "0.55272853", "0.55190235"...
0.56609064
10
Calculate p(x|O) and assign to p_xOi self.p_xOi is set in place
def calc_pxO(self, min_rellipse=0.3, **kwargs): # This hack sets the minimum localization to 0.3'' # This is to avoid round-off issues for very small localizations # It will be superseded by Healpix approaches (soon) # TODO -- Replace with Healpix eellipse = self.frb.eellipse....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc_POx(self, **kwargs):\n\n # Intermediate steps\n self.calc_pxO(**kwargs)\n self.calc_pxU()\n self.calc_px()\n\n # Finish\n self.P_Oix = self.prior_Oi * self.p_xOi / self.p_x\n self.candidates['P_Ox'] = self.P_Oix\n\n # P(S|x)\n self.P_Ux = self...
[ "0.82409185", "0.5986716", "0.58089197", "0.56979567", "0.5656994", "0.5618129", "0.5611389", "0.5610136", "0.5603298", "0.5598299", "0.55969834", "0.5576857", "0.5542931", "0.55082834", "0.55072534", "0.5493133", "0.5490686", "0.5487989", "0.5479724", "0.54692256", "0.543337...
0.5938485
2
Calculate p(x|U) and assign to p_xU
def calc_pxU(self): self.p_xU = bayesian.px_U(self.max_radius)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def x_to_u(self, x):\n return stats.norm.ppf(self.CDF(x))", "def calc_POx(self, **kwargs):\n\n # Intermediate steps\n self.calc_pxO(**kwargs)\n self.calc_pxU()\n self.calc_px()\n\n # Finish\n self.P_Oix = self.prior_Oi * self.p_xOi / self.p_x\n self.candida...
[ "0.6808744", "0.67470646", "0.6611508", "0.6593435", "0.6443371", "0.632724", "0.62382394", "0.613177", "0.60677487", "0.60240984", "0.6005079", "0.59901315", "0.5981278", "0.5938731", "0.5937166", "0.5924601", "0.5896004", "0.5888657", "0.5877085", "0.5858312", "0.5854887", ...
0.79550624
0
Determine if self (board) and other(board) are equal
def __eq__(self, other): return self.board == other.board
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other) -> None:\n\t\tfor k, v in enumerate(self.board):\n\t\t\tif v != other.board[k]:\n\t\t\t\treturn False\n\t\treturn True", "def __eq__(self, other):\n for row in range( self.n ):\n if self.board[row] != other.board[row]:\n return False\n return True",...
[ "0.8811603", "0.8580009", "0.8375203", "0.8119644", "0.79856634", "0.7921919", "0.78699124", "0.7818962", "0.77137494", "0.7700428", "0.7697556", "0.7679941", "0.7679941", "0.766595", "0.7635343", "0.7635343", "0.7635343", "0.7612382", "0.7532614", "0.75100595", "0.749481", ...
0.88022506
1
Convert a datetime to UTC.
def date_to_utc(self, date): if date.tzinfo is not None: # date is timezone-aware date = date.astimezone(self.tz_utc) else: # date is a naive date: assume expressed in local time date = date.replace(tzinfo=self.tz_local) # and converted to UTC...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_utc(dt):\n if dt.tzinfo is None:\n return dt.replace(tzinfo=pytz.utc)\n else:\n return dt.astimezone(pytz.utc)", "def tz_as_utc(dt: datetime) -> datetime:\n if dt.tzinfo is None:\n return dt.replace(tzinfo=tzutc())\n return dt.astimezone(tzutc())", "def localize_datetime...
[ "0.77849716", "0.75058514", "0.74497586", "0.74497586", "0.74497586", "0.74107426", "0.7405147", "0.7403654", "0.72656757", "0.71634954", "0.7102073", "0.69719094", "0.6967771", "0.69056", "0.68823105", "0.68538535", "0.68381095", "0.6791557", "0.6766025", "0.67250633", "0.67...
0.72791326
8
Convert a datetime to the observer's timezone.
def date_to_local(self, date): if date.tzinfo is not None: # date is timezone-aware date = date.astimezone(self.tz_local) else: # date is a naive date: assume expressed in UTC date = date.replace(tzinfo=self.tz_utc) # and converted to local ti...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tz_localize(self, dt):\n if is_datetime(dt):\n # Naive datetime, see\n # https://docs.python.org/3/library/datetime.html#available-types\n if dt.tzinfo == None or dt.tzinfo.utcoffset(dt) == None:\n return dt\n else:\n return dt.as...
[ "0.68690753", "0.6810309", "0.67775357", "0.6702147", "0.6577165", "0.64757377", "0.6386884", "0.6320343", "0.6304063", "0.6244073", "0.6199291", "0.618724", "0.6113522", "0.6103425", "0.6103425", "0.6103425", "0.6095392", "0.60908544", "0.5984139", "0.59757566", "0.5960107",...
0.0
-1
Set the date for the observer. This is converted and stored internally in the timezone set for the observer.
def set_date(self, date): self.date = self.date_to_local(date) # ephem deals only in UTC self.site.date = ephem.Date(self.date_to_utc(self.date))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_date(self, date):\n self.date = date", "def set_date(self, date):\n self.date = date\n return", "def set_datetime(self, date):\n self.date = date", "def set_date(self, date):\n self.data['date'] = date", "def date(self, date):\n self._date = date", "def _...
[ "0.7835349", "0.78085804", "0.7727623", "0.75793207", "0.74578774", "0.7449714", "0.7449714", "0.73792404", "0.73792404", "0.73792404", "0.73792404", "0.73792404", "0.72798663", "0.72754437", "0.6969783", "0.6931557", "0.6742604", "0.6731562", "0.6713876", "0.6703831", "0.666...
0.7480913
4
Returns sunset in observer's time.
def sunset(self, date=None): self.site.horizon = self.horizon self._set_site_date(date) r_date = self.site.next_setting(self.sun) r_date = self.date_to_local(r_date.datetime()) return r_date
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sunset(cls, date):\n return (date + Clock.days_from_hours(18) + \n ((cls.UJJAIN.longitude - cls.LOCATION.longitude) / 360) -\n cls.equation_of_time(date) +\n (((1577917828/1582237828) / 360) *\n (- cls.ascensional_difference(date, cls.LOCATION...
[ "0.61782646", "0.6167092", "0.6065353", "0.597179", "0.5909645", "0.58766127", "0.5848274", "0.57731354", "0.5754889", "0.566252", "0.56117", "0.5611047", "0.5610758", "0.5610758", "0.5610758", "0.5584906", "0.54879636", "0.5460466", "0.5454881", "0.54217404", "0.53973305", ...
0.5408359
20
Compute Greenwich Mean Sidereal Time
def calc_GMST(self, date): jd = self.julian_date(date) T = (jd - 2451545.0)/36525.0 gmstdeg = 280.46061837+(360.98564736629*(jd-2451545.0))+(0.000387933*T*T)-(T*T*T/38710000.0) gmst = ephem.degrees(gmstdeg*np.pi/180.0) return gmst
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gmst(self):\n GMST = np.array([24110.54841, 8640184.812866, 9.3104e-2, -6.2e-6])\n # convert from seconds to fractions of day\n return np.mod(self.polynomial_sum(GMST, self.T)/self.day, self.turn)", "def st(self):\n # sidereal time polynomial coefficients in arcseconds\n si...
[ "0.64064705", "0.6239459", "0.6216831", "0.61418617", "0.6088164", "0.59599626", "0.5910298", "0.58426213", "0.58264726", "0.57346576", "0.5721127", "0.5710391", "0.5532592", "0.5519946", "0.550801", "0.54954463", "0.54917836", "0.5486549", "0.54727477", "0.5413248", "0.54040...
0.594907
6
Compute Local Mean Sidereal Time
def calc_LMST(self, date, longitude): gmst = self.calc_GMST(date) lmst = ephem.degrees(gmst + longitude) return lmst.norm
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mean(self):\n\n return time_stat(self, stat=\"mean\")", "def averageTime(self):\n \n pass", "def mean_time_spending_in_system(self):\n dur_sum = 0.0\n spending_time_seq = self.system.spending_time.values()\n start = int(len(spending_time_seq) / 2.0)\n end = int(len(...
[ "0.6500592", "0.6319622", "0.6237077", "0.617427", "0.6126128", "0.6035979", "0.5944296", "0.58628786", "0.5856649", "0.5850803", "0.5829351", "0.5794561", "0.5779006", "0.5744898", "0.5714191", "0.5705241", "0.5680264", "0.5679926", "0.56741244", "0.56393164", "0.5616678", ...
0.0
-1
String for representing the Model object.
def __str__(self): return self.name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return super().__str__() + self.model.__str__()", "def __str__(self):\n return \"DataModel(name={},attributes={},description={})\".format(\n self.name, {a.name: str(a) for a in self.attributes}, self.description\n )", "def __str__(self):\n \n res =...
[ "0.82368803", "0.79901737", "0.7849152", "0.78468513", "0.77520275", "0.7625378", "0.7625378", "0.76225406", "0.76225406", "0.75483394", "0.7522958", "0.7470355", "0.7469358", "0.7447144", "0.7447144", "0.74314755", "0.7427648", "0.7389925", "0.7351721", "0.73424315", "0.7322...
0.0
-1