query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Logbinning of a distribution.
def logbin_distribution(data, nbins = 30): # define the support of the distribution lower_bound = min(data) upper_bound = max(data) # define bin edges log = np.log10 lower_bound = log(lower_bound) if lower_bound > 0 else -1 upper_bound = log(upper_bound) bins = np.logspace(lower_bound, u...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bincalc(nbin=0.1,bmin=5,bmax=2000):\n\n logbmin=np.log10(bmin)\n logbmax=np.log10(bmax)\n\n logbins=np.arange(logbmin,logbmax,nbin)\n\n bins=10**logbins\n\n #bins=np.linspace(bmin,bmax,60)\n return (bins)", "def logbin(data, scale = 1.3, zeros = False):\n if scale < 1:\n raise Val...
[ "0.66757274", "0.6646079", "0.62253493", "0.6120671", "0.6099856", "0.60060704", "0.5891733", "0.5800523", "0.5758203", "0.5757172", "0.5721329", "0.57009387", "0.5697628", "0.56797785", "0.5635742", "0.5630419", "0.5628087", "0.56177866", "0.5596117", "0.55869347", "0.558515...
0.73683405
0
Get CCDF from a degree sequence.
def get_ccdf(degseq): uniques, counts = np.unique(degseq, return_counts=True) cumprob = np.cumsum(counts).astype(np.double) / (degseq.size) return uniques[::-1], (1. - cumprob)[::-1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_cdf(self, points=None):\n if points is not None:\n return self.parent.cdf(points)\n else:\n raise ValueError( 'Please digit an input for getCDF method')", "def getCDF(self):\n return self.cdfSample", "def cdf(self,x):\n if self.method == 'spline':\n co...
[ "0.66865236", "0.66738886", "0.6528202", "0.6394472", "0.6394472", "0.6280722", "0.612189", "0.6061525", "0.6054699", "0.6042136", "0.6035633", "0.6016287", "0.59556776", "0.59411925", "0.593399", "0.59306073", "0.5848178", "0.5825168", "0.5806766", "0.5793067", "0.5657572", ...
0.6885644
0
Get `eps_stop` from AMSE upper bound. Upper bound for order statistic to consider for doublebootstrap AMSE minimizer. Entries that are smaller or equal to the border value are ignored during AMSE minimization.
def get_eps_stop(data, amse_border=1, sort=True): if sort: data = np.sort(data)[::-1] return 1 - len(data[np.where(data <= amse_border)]) / len(data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_eps(self, target_ess, upper, min_bisection_its=50, max_ess_error=0.01):\n # Return upper bound if it can't achieve target ESS\n w = self.get_alternate_weights(upper)\n ess = effective_sample_size(w)\n if ess < target_ess:\n return upper\n\n # Return lower boun...
[ "0.54890054", "0.5254461", "0.5224461", "0.5161098", "0.50961953", "0.50945413", "0.4922195", "0.4905253", "0.49029648", "0.4899326", "0.48968145", "0.48947158", "0.48665237", "0.48532668", "0.47960132", "0.47947425", "0.47858372", "0.47762918", "0.47524136", "0.47450542", "0...
0.71831954
0
Factory function for transforming any iterable to a WindowedIterable. Can be used as a function in pipey pipeline.
def windowify(window_size): def windowed(iterable): return WindowedIterable(iterable, window_size) return windowed
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dewindowify(iterable):\n for _, current, _ in iterable:\n yield current", "def window(iterable, stride=3):\n for i in range(len(iterable) - stride + 1):\n yield iterable[i: i + stride]", "def iwindow(seq, n):\n it = iter(seq)\n result = tuple(islice(it, n))\n\n if len(result) =...
[ "0.65870017", "0.6276887", "0.6252061", "0.5979201", "0.59202135", "0.5901803", "0.5901803", "0.5890584", "0.5884487", "0.5882071", "0.58312255", "0.58300227", "0.5824383", "0.5805883", "0.5774541", "0.57557213", "0.5744897", "0.5730951", "0.57180876", "0.5696275", "0.5636358...
0.79773754
0
Yields elements from a WindowedIterable without the cached windows. Can be used as a function in pipey pipeline.
def dewindowify(iterable): for _, current, _ in iterable: yield current
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unique_window(iterable, window, key = None):\n seen = collections.deque(maxlen = window)\n seen_add = seen.append\n if key is None:\n for element in iterable:\n if element not in seen:\n yield element\n seen_add(element)\n else:\n for element in it...
[ "0.64814496", "0.64370525", "0.63999337", "0.6393452", "0.6304972", "0.6201049", "0.61454827", "0.61207074", "0.59631115", "0.59161437", "0.588799", "0.5862907", "0.5833489", "0.5828903", "0.5827851", "0.5813124", "0.5795005", "0.5790015", "0.57886785", "0.5785899", "0.576882...
0.73613864
0
Used to verify your account. $verify SpiesWithin na
async def verify(self,ctx,ign='',region=''): if ign =='' or region =='': await self.bot.say("Please type in a ign and region.") return if not ctx.message.channel.is_private: #Makes sure channel is private await self.bot.say('Sorry. But this process must be done i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verify():", "async def check(self,ctx):\r\n try:\r\n check = verify.check(ctx.message.author.id)\r\n except Exception as e:\r\n await self.bot.say('Error: ' +str(e)+'\\n\\nIf your match hasn\\'t registered yet, wait 5-10 minutes or check http://discord.me/EZLBot for update...
[ "0.62231475", "0.5896493", "0.5764052", "0.5706635", "0.5706635", "0.569275", "0.5588584", "0.55374587", "0.54390234", "0.5343147", "0.5337591", "0.5284817", "0.52805984", "0.5266697", "0.5257193", "0.525256", "0.52475417", "0.5245184", "0.51888824", "0.5128513", "0.510791", ...
0.5602167
6
Check for your latest match to verify $check
async def check(self,ctx): try: check = verify.check(ctx.message.author.id) except Exception as e: await self.bot.say('Error: ' +str(e)+'\n\nIf your match hasn\'t registered yet, wait 5-10 minutes or check http://discord.me/EZLBot for updates. Else, signup again with {}verify...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check():", "def match(self) -> bool:", "def verify():", "def check(self) -> None:", "def test_version_check_update_available(self):\n output = self.run_command(\"selfupdate --check bennr01:selfupdate_test_future\", exitcode=0)\n self.assertIn(\"Target: bennr01:selfupdate_test_future\", ou...
[ "0.6599547", "0.61560607", "0.60273844", "0.60122466", "0.59057695", "0.5849235", "0.58330333", "0.58012295", "0.5780078", "0.5763232", "0.5735489", "0.56997085", "0.5669704", "0.56647074", "0.56647074", "0.56647074", "0.56647074", "0.56266236", "0.5582165", "0.55417573", "0....
0.64390785
1
Forward pass of the convolutional neural network. Should not be called manually but by calling a model instance directly.
def forward(self, x): #print('output of fetures.children() : %s'%str([i for i in self.features.children()])) #print("shape of input is %s" % str(x.size())) for layer_no, layer in enumerate(self.features.children()): if layer_no is 23: y = layer(x) if laye...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forward(self, x):\n x = self.conv1(x)\n if self.use_bn:\n x = self.batchnorm(x)\n if self.use_dropout:\n x = self.dropout(x)\n x = self.activation(x)\n x = self.conv2(x)\n if self.use_bn:\n x = self.batchnorm(x)\n if self.use_dro...
[ "0.74265546", "0.72891587", "0.72310466", "0.71984327", "0.71327746", "0.70876646", "0.7082048", "0.7066212", "0.7045469", "0.7042458", "0.7019415", "0.6999947", "0.6985048", "0.6975621", "0.69695985", "0.6968059", "0.69360054", "0.69360054", "0.6899931", "0.68841743", "0.687...
0.0
-1
Check if model parameters are allocated on the GPU.
def is_cuda(self): return next(self.parameters()).is_cuda
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_cuda(model):\n\treturn next(model.parameters()).is_cuda", "def is_gpu_available():\n ret = get_gpu_count() > 0\n if _HAS_PADDLE:\n import paddle\n if ret is True and not paddle.is_compiled_with_cuda():\n logger.warning(\"Found non-empty CUDA_VISIBLE_DEVICES. \\\n ...
[ "0.7035844", "0.67039204", "0.6659393", "0.65733784", "0.6548726", "0.6418005", "0.6284684", "0.61922556", "0.6084889", "0.60580724", "0.60226715", "0.60047615", "0.59713936", "0.5916576", "0.5914285", "0.5895965", "0.588647", "0.58627695", "0.584468", "0.58226997", "0.579909...
0.64029634
9
Save model with its parameters to the given path. Conventionally the path should end with ".model".
def save(self, path): print('Saving model... %s' % path) torch.save(self, path)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_model(self, model_path: str):", "def save(path_to_model):\n pass", "def save_model(self, path):\n pass", "def save_model(model, model_filepath):", "def save_model(self, path):\n self._model.save(path)", "def save(\n self,\n modelSavePath\n ):\n ...
[ "0.9188017", "0.8917799", "0.8776302", "0.87582433", "0.8621109", "0.85514325", "0.82969207", "0.8235511", "0.81234485", "0.8070782", "0.8021807", "0.8004452", "0.79982024", "0.7997642", "0.79857653", "0.79795116", "0.7919307", "0.7912375", "0.7908963", "0.79005027", "0.78822...
0.7686676
60
Rolls a dice in NdN format.
async def roll(dice: str): try: rolls, limit = map(int, dice.split('d')) except Exception: await rose.say('Format has to be in NdN!') return result = ', '.join(str(random.randint(1, limit)) for r in range(rolls)) await rose.say(result)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def roll(self, dice: str):\n try:\n rolls, limit = map(int, dice.split('d'))\n except Exception:\n await self.bot.say('Format has to be in NdN!')\n return\n\n result = ', '.join(str(random.randint(1, limit)) for r in range(rolls))\n await self.bot....
[ "0.755448", "0.74622107", "0.7365103", "0.73002577", "0.7191522", "0.7023106", "0.6970918", "0.6968365", "0.69634557", "0.69537085", "0.6942039", "0.6915231", "0.6908482", "0.688081", "0.68375415", "0.6817635", "0.68015164", "0.67889714", "0.6771499", "0.67671233", "0.6754963...
0.71320593
5
[Get categorical & numerical columns]
def num_cat_variables(self, data): is_cat = np.array([dt.kind == "O" for dt in data.dtypes]) cat_cols = data.columns.values[is_cat] num_cols = data.columns.values[~is_cat] return cat_cols, num_cols
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def categorical(df):\r\n categorical_var=df.select_dtypes(include ='object').columns.tolist()\r\n\r\n return categorical_var", "def identify_nominal_columns(dataset):\n return identify_columns_by_type(dataset, include=['object', 'category'])", "def num_and_cat_columns(df):\n \n \n cols = df.c...
[ "0.79687566", "0.7539611", "0.7244404", "0.71197504", "0.7072402", "0.70692486", "0.70692486", "0.706313", "0.6996327", "0.69746363", "0.68318164", "0.68226284", "0.6712321", "0.6663871", "0.65088147", "0.64935565", "0.6454352", "0.6430965", "0.6424896", "0.63983136", "0.6371...
0.6754961
12
[Initiate the prediction function]
def make_predictions(self): if is_classification(self.model): if self.ct == None: prediction = self.model.predict(self.input_data.to_numpy()) probabilities = self.model.predict_proba(self.input_data.to_numpy()) return prediction, probabilities ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self) :\n self.prediction_ = None", "def __init__(self) :\n self.prediction_ = None", "def __init__(self) :\n self.prediction_ = None", "def run_prediction(self):\r\n self.get_prediction_indices()\r\n self.walk_forward_prediction()", "def predict_proba(self):...
[ "0.7213135", "0.7213135", "0.7213135", "0.71546817", "0.7110174", "0.7085127", "0.70659715", "0.7040501", "0.7040501", "0.70266724", "0.70256954", "0.70132285", "0.69427246", "0.6924442", "0.6908858", "0.6908858", "0.6908858", "0.68776196", "0.6865355", "0.6865355", "0.679594...
0.0
-1
[Create prediction columns and add them to the self.predicted_columns dictionary]
def create_prediction_columns(self): if is_classification(self.model) == True: prediction, probabilities = self.make_predictions() self.predicted_columns['Model Decision'] = prediction self.predicted_columns['True Values'] = self.target_data for i in range(len(np....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def predict(self, data, only_lp=True):\n df = self.model.transpose(data)\n if only_lp:\n df = df.select(self.label_index_name, self.prediction_name, self.probability)\n return df", "def predict(data, model, final_columns, category_features, averages):\n new_data = extend_dummy_...
[ "0.66258246", "0.66254413", "0.66087073", "0.6596617", "0.6541436", "0.653981", "0.6455183", "0.633809", "0.6312074", "0.62493366", "0.6248378", "0.6227264", "0.61748564", "0.6172468", "0.61246616", "0.6104596", "0.6046965", "0.6040922", "0.60071677", "0.59578884", "0.594849"...
0.85224473
0
[Calculates the metrics for classification problems]
def classification_metrics(self, target_data, predicted): from sklearn import preprocessing from sklearn import metrics y_true_copy, predictions = pd.DataFrame(self.target_data), predicted #y_true_copy.unique() np.unique(y_true_copy) encode = {} for i in range(l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluate_classifications(self):\n test_labels = open('./digitdata/testlabels', 'r')\n self.init_confusion_matrix()\n i = 0\n class_stats = {0:[0,0], 1:[0,0], 2:[0,0], 3:[0,0], 4:[0,0], 5:[0,0], 6:[0,0], 7:[0,0], 8:[0,0], 9:[0,0]}\n total_correct = 0\n num_labels = 1000...
[ "0.76563865", "0.73574686", "0.7215205", "0.7158094", "0.7139988", "0.7071734", "0.70559233", "0.7028776", "0.7013852", "0.69567895", "0.6920448", "0.69164896", "0.6915393", "0.68986934", "0.6862297", "0.68464446", "0.6821253", "0.6814688", "0.68041426", "0.6802625", "0.67856...
0.6284864
91
[Calculates the metrics for regression problems]
def regression_metrics(self, target_data, predicted): from sklearn import metrics if len(target_data) != 0: #Mean Absolute Error mae = round(metrics.mean_absolute_error(target_data, predicted),2) #Mean Squared Error mse = round(metrics.mean_squared_error(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nnRegression(data):", "def metrics_regression(y_real, y_pred):\n mae=mean_absolute_error(y_real, y_pred)\n mape= mean_absolute_percentage_error(y_real, y_pred)\n mse=mean_squared_error(y_real, y_pred)\n evs= explained_variance_score(y_real, y_pred)\n maximo_error= max_error(y_real, y_pred)\n ...
[ "0.7045143", "0.69846684", "0.6826172", "0.6746359", "0.6659643", "0.65737325", "0.65525055", "0.654626", "0.65024227", "0.64893055", "0.64601713", "0.645842", "0.6457579", "0.6452948", "0.6445572", "0.6427412", "0.6411009", "0.63788265", "0.6367059", "0.63479114", "0.6253903...
0.65989304
5
Return name of the columns created by FeatureOperations applied on ``column``
def derived_columns_from_col(self, column: str) -> List[str]: derived_columns = [] operations = self.operations_from_original_column(column) for operation in operations: if operation.derived_columns is not None: derived_columns.extend(operation.derived_columns) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_column_title(col):\n col_type = self.features_bucket_mapping_.get(col).type\n return [f\"Feature '{col}'\"], [col_type]", "def column_name(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"column_name\")", "def column_name(self) -> pulumi.Input[str]:\n return pulumi...
[ "0.6876426", "0.68675435", "0.68675435", "0.68417263", "0.669856", "0.6658086", "0.6653428", "0.66112936", "0.66074544", "0.65204847", "0.6458184", "0.64255005", "0.639284", "0.63239753", "0.62822115", "0.62794644", "0.62625235", "0.625934", "0.6234871", "0.6232935", "0.62093...
0.62644273
16
Return the FeatureOperations that generated ``derived_column``
def operations_from_derived_column( self, derived_column: str ) -> List["FeatureOperation"]: return list( filter( lambda op: op.derived_columns is not None and derived_column in op.derived_columns, self[derived_column], ) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def original_columns_from_derived_column(self, derived_column: str) -> List[str]:\n operations = self.operations_from_derived_column(derived_column)\n\n if len(operations) > 1:\n raise RuntimeError(\n \"Multiple FeatureOperation found that generated column \"\n ...
[ "0.7034697", "0.6264205", "0.58456624", "0.55798423", "0.5506693", "0.53352195", "0.5264634", "0.5252218", "0.5208565", "0.5165842", "0.51332474", "0.513137", "0.51287925", "0.512307", "0.5089447", "0.5088569", "0.5083715", "0.50238687", "0.5020082", "0.49969816", "0.4994706"...
0.7685979
0
Return the FeatureOperations applied on ``original_column``
def operations_from_original_column( self, original_column: str ) -> List["FeatureOperation"]: return list( filter( lambda op: original_column in op.columns, self[original_column], ) )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def original_columns_from_derived_column(self, derived_column: str) -> List[str]:\n operations = self.operations_from_derived_column(derived_column)\n\n if len(operations) > 1:\n raise RuntimeError(\n \"Multiple FeatureOperation found that generated column \"\n ...
[ "0.61692166", "0.61273307", "0.58502436", "0.55084825", "0.54451436", "0.54365456", "0.53751487", "0.52888155", "0.5206171", "0.5201663", "0.508027", "0.50541335", "0.50530684", "0.50475353", "0.5007608", "0.4991465", "0.49836087", "0.49430266", "0.49388215", "0.49367413", "0...
0.7905143
0
Return the name of the columns from which ``derived_column`` is generated.
def original_columns_from_derived_column(self, derived_column: str) -> List[str]: operations = self.operations_from_derived_column(derived_column) if len(operations) > 1: raise RuntimeError( "Multiple FeatureOperation found that generated column " f"{derived_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def derived_columns_from_col(self, column: str) -> List[str]:\n derived_columns = []\n operations = self.operations_from_original_column(column)\n\n for operation in operations:\n if operation.derived_columns is not None:\n derived_columns.extend(operation.derived_col...
[ "0.68002284", "0.6473398", "0.6276224", "0.62645346", "0.624039", "0.62050974", "0.61963874", "0.6118237", "0.61114836", "0.60975206", "0.6070955", "0.60598886", "0.60405964", "0.60157603", "0.60076255", "0.5958728", "0.5958728", "0.5935321", "0.5919565", "0.59103626", "0.590...
0.7360953
0
Return True if ``other`` is a OperationsList containing the same operations.
def __eq__(self, other: Any) -> bool: if not isinstance(other, OperationsList): return False if not self._operations_list == other._operations_list: return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other: SymbolicObject) -> bool:\n\n if isinstance(other, ListObject):\n return self._subobjects == other._subobjects\n else:\n return False", "def __eq__(self, other):\n if not isinstance(other, CashFlowList):\n return False\n\n return...
[ "0.7605562", "0.7011663", "0.68128866", "0.67968446", "0.6753017", "0.6692754", "0.6628194", "0.6615114", "0.6595707", "0.6594383", "0.6566219", "0.6549629", "0.65435344", "0.6532957", "0.6516649", "0.6473852", "0.6468497", "0.646396", "0.645403", "0.64523", "0.64292806", "...
0.8506768
0
Helper function used in src.api.routes.main_urls.py for routing URLs to the appropriate view functions
def re_path(route, view, **kwargs): return view, route, kwargs
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def urlpath( request, *args, **kwargs ):", "def pathfor( request, *args, **kwargs ):", "def __create_routes__(self):\n self.app.add_url_rule('/', 'main_page', self.main_page)\n self.app.add_url_rule('/day', 'day', self.get_current_iteration, methods=['GET'])\n self.app.add_url_rule('/trade...
[ "0.72670937", "0.6907818", "0.66150296", "0.65024936", "0.64763063", "0.63228345", "0.63206047", "0.6313643", "0.6229998", "0.6178121", "0.61501104", "0.61366874", "0.6130338", "0.6113", "0.6111944", "0.6090943", "0.60885", "0.60818", "0.606321", "0.60524136", "0.60514635", ...
0.5981405
25
Helper function to add a song to db
def add_song(name, duration): song = Song( name=name, duration=duration, ) db.session.add(song) db.session.commit() return song
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_song(_name_of_the_song, _duration_in_number_of_seconds):\r\n # creating an instance of our Song constructor\r\n new_song = Song(name_of_the_song=_name_of_the_song,\r\n duration_in_number_of_seconds=_duration_in_number_of_seconds)\r\n db.session.add(new_song) # a...
[ "0.7740324", "0.76434267", "0.75772154", "0.7524001", "0.7350646", "0.7221055", "0.71301234", "0.7102691", "0.70967597", "0.7082078", "0.7064771", "0.6968714", "0.6960384", "0.69075376", "0.68390363", "0.6826875", "0.6817456", "0.68168634", "0.67879635", "0.67730844", "0.6766...
0.74220836
4
Helper function to add an audiobook to database
def add_audiobook(name, duration, author, narrator): audiobook = AudioBook( name=name, duration=duration, author=author, narrator=narrator ) db.session.add(audiobook) db.session.commit() return audiobook
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_audiobook(_title_of_the_audiobook, _author_of_the_title, _narrator,\r\n _duration_in_number_of_seconds):\r\n # creating an instance of our Audiobook constructor\r\n new_audiobook = Audiobook(title_of_the_audiobook=_title_of_the_audiobook,\r\n ...
[ "0.77613556", "0.70807827", "0.65985125", "0.6316089", "0.6239264", "0.62226313", "0.6193941", "0.6126204", "0.611152", "0.6100338", "0.60866594", "0.6031406", "0.5984584", "0.59791315", "0.5968961", "0.5952915", "0.59519464", "0.5949488", "0.59182364", "0.58955574", "0.58570...
0.7655839
1
Shortcut for ``bot.send_chat_action(update.message.chat.id, args, kwargs)``
def send_action(self, *args, **kwargs): return self.bot.send_chat_action(self.id, *args, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_action(action):\n def decorator(func):\n @wraps(func)\n def command_func(self, update, context, *args, **kwargs):\n context.bot.send_chat_action(chat_id=update.effective_message.chat_id, action=action)\n return func(self, update, context, *args, **kwargs)\n re...
[ "0.7509384", "0.7375992", "0.6927227", "0.6501493", "0.6169821", "0.6134623", "0.6082273", "0.60704964", "0.60244894", "0.6001735", "0.596165", "0.5954815", "0.59119594", "0.5823286", "0.5799726", "0.5714884", "0.57128656", "0.5614297", "0.55790704", "0.55705637", "0.55119675...
0.7766484
0
Shortcut for ``bot.leave_chat(update.message.chat.id, args, kwargs)``
def leave(self, *args, **kwargs): return self.bot.leave_chat(self.id, *args, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def leave_chat(self, chat_id: typing.Union[base.Integer, base.String]) -> base.Boolean:\n payload = generate_payload(**locals())\n result = await self.request(api.Methods.LEAVE_CHAT, payload)\n\n return result", "def leave(bot, event, conversation_id=None, *args):\n\n arglist = list...
[ "0.6716415", "0.6618045", "0.6549425", "0.6191924", "0.6101038", "0.6079317", "0.6001494", "0.5859587", "0.5734056", "0.57170254", "0.5706082", "0.5672748", "0.5663437", "0.5622406", "0.5606106", "0.55953854", "0.5537519", "0.55289155", "0.54851896", "0.5475721", "0.54088616"...
0.8217309
0
Shortcut for ``bot.get_chat_administrators(update.message.chat.id, args, kwargs)``
def get_administrators(self, *args, **kwargs): return self.bot.get_chat_administrators(self.id, *args, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_admin_ids(bot, chat_id):\r\n return [admin.user.id for admin in bot.get_chat_administrators(chat_id)]", "def get_admin_ids(bot, chat_id):\n return [admin.user.id for admin in bot.get_chat_administrators(chat_id)]", "def get_admin_ids(bot, chat_id):\n return [admin.user.id for admin in bot.get_...
[ "0.72916365", "0.7257801", "0.7257801", "0.7257801", "0.71312785", "0.63350284", "0.6305754", "0.6275993", "0.6170726", "0.6099674", "0.58945954", "0.58601385", "0.58280176", "0.58112365", "0.577033", "0.5728004", "0.5673534", "0.5667694", "0.5667427", "0.5659937", "0.5639199...
0.8342136
0
Shortcut for ``bot.get_chat_members_count(update.message.chat.id, args, kwargs)``
def get_members_count(self, *args, **kwargs): return self.bot.get_chat_members_count(self.id, *args, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def get_chat_members_count(self, chat_id: typing.Union[base.Integer, base.String]) -> base.Integer:\n payload = generate_payload(**locals())\n result = await self.request(api.Methods.GET_CHAT_MEMBERS_COUNT, payload)\n\n return result", "async def membercount(ctx, *args):\n if ctx.me...
[ "0.7653538", "0.7079209", "0.67141974", "0.64766777", "0.6410987", "0.63265955", "0.63157445", "0.6290398", "0.6003215", "0.5918783", "0.5874979", "0.5852854", "0.5671665", "0.56622785", "0.5651697", "0.5633376", "0.55913067", "0.5557523", "0.5552522", "0.5539572", "0.5515641...
0.8773616
0
Shortcut for ``bot.get_chat_member(update.message.chat.id, args, kwargs)``
def get_member(self, *args, **kwargs): return self.bot.get_chat_member(self.id, *args, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def get_chat_member(self, chat_id: typing.Union[base.Integer, base.String],\n user_id: base.Integer) -> types.ChatMember:\n payload = generate_payload(**locals())\n result = await self.request(api.Methods.GET_CHAT_MEMBER, payload)\n\n return types.ChatMember(...
[ "0.6845233", "0.59359425", "0.59342927", "0.59342927", "0.5720699", "0.5720276", "0.56279147", "0.56157714", "0.55889475", "0.5583294", "0.5564403", "0.55140746", "0.54459745", "0.5426997", "0.5400163", "0.53775513", "0.53349453", "0.53254014", "0.53250545", "0.529635", "0.52...
0.8052762
0
Shortcut for ``bot.kick_chat_member(update.message.chat.id, args, kwargs)``
def kick_member(self, *args, **kwargs): return self.bot.kick_chat_member(self.id, *args, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def kick(ctx, member: discord.Member, *, reason=None):\n await member.kick(reason=reason)\n await ctx.send(f\"User {member} has been kicked\")", "async def kick(self, member: discord.Member, *, reason=None): # asterix=all parameters after member and reason will just be added to reason\n await...
[ "0.67335683", "0.6692941", "0.6343571", "0.6296833", "0.6268952", "0.6116799", "0.60498536", "0.603678", "0.6020632", "0.6001688", "0.59897", "0.5921761", "0.5896615", "0.58285856", "0.5738672", "0.57337326", "0.5710275", "0.5696058", "0.5683905", "0.56561285", "0.56306046", ...
0.83216196
0
Shortcut for ``bot.unban_chat_member(update.message.chat.id, args, kwargs)``
def unban_member(self, *args, **kwargs): return self.bot.unban_chat_member(self.id, *args, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def unban_chat_member(self, chat_id: typing.Union[base.Integer, base.String],\n user_id: base.Integer) -> base.Boolean:\n payload = generate_payload(**locals())\n result = await self.request(api.Methods.UNBAN_CHAT_MEMBER, payload)\n\n return result", "asy...
[ "0.73356986", "0.70719296", "0.70260084", "0.6497744", "0.64395726", "0.6274795", "0.6266587", "0.6266034", "0.6130883", "0.6102467", "0.5987942", "0.5970644", "0.5834732", "0.5762892", "0.57180315", "0.57048714", "0.5699499", "0.56516176", "0.5640035", "0.5636267", "0.562204...
0.86313546
0
Gets all the meshes inside all the piper skinned nodes in the scene.
def getMeshes(): nodes = pipernode.get('piperSkinnedMesh') return {mesh.getParent() for skin in nodes for mesh in skin.getChildren(ad=True, type='mesh') if mesh.getParent()}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_meshes(self):\n for meta_mesh in self.gltf.meshes:\n # Returns a list of meshes\n meshes = meta_mesh.load(self.materials)\n self.meshes.append(meshes)\n\n for mesh in meshes:\n self.scene.meshes.append(mesh)", "def get_meshes(scene):\r\n ...
[ "0.6114167", "0.60293436", "0.5757967", "0.5612728", "0.5534438", "0.54922056", "0.54847145", "0.54710627", "0.54542154", "0.5363654", "0.5363654", "0.5363654", "0.5363654", "0.5305868", "0.52891994", "0.5282078", "0.5273619", "0.5245254", "0.52361906", "0.5214873", "0.521100...
0.8215878
0
Locks or unlocks all the transforms under piper skinned nodes that have mesh shapes.
def setLockOnMeshes(lock): meshes = getMeshes() for mesh in meshes: try: mesh.overrideEnabled.set(1) mesh.overrideDisplayType.set(lock) except RuntimeError as error: pm.warning('Can\'t set lock on mesh! ' + str(error))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lockMeshes():\n setLockOnMeshes(2)", "def unlockMeshes():\n setLockOnMeshes(0)", "def setupForRigPose(self):\n\n # unlock joint movers\n cmds.select(\"JointMover\", hi=True)\n jmNodes = cmds.ls(sl=True)\n for node in jmNodes:\n cmds.lockNode(node, lock=False)\n\...
[ "0.6720721", "0.63663757", "0.55522466", "0.5495686", "0.5413373", "0.5364269", "0.5231629", "0.5168335", "0.5118983", "0.50137115", "0.5010853", "0.48933464", "0.4859253", "0.48555687", "0.48477027", "0.48028678", "0.4737559", "0.4709482", "0.47019863", "0.46750396", "0.4672...
0.601429
2
Locks all the transforms under piper skinned nodes that have mesh shapes.
def lockMeshes(): setLockOnMeshes(2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unlockMeshes():\n setLockOnMeshes(0)", "def setLockOnMeshes(lock):\n meshes = getMeshes()\n for mesh in meshes:\n try:\n mesh.overrideEnabled.set(1)\n mesh.overrideDisplayType.set(lock)\n except RuntimeError as error:\n pm.warning('Can\\'t set lock on m...
[ "0.5996941", "0.5933928", "0.56343156", "0.5437628", "0.5400132", "0.5262749", "0.5243079", "0.52421004", "0.51741475", "0.51033777", "0.5092315", "0.5088405", "0.50729567", "0.49983454", "0.49829763", "0.49469054", "0.49222684", "0.48831803", "0.4858286", "0.48506966", "0.48...
0.6672777
0
Unlocks all the transforms under piper skinned nodes that have mesh shapes.
def unlockMeshes(): setLockOnMeshes(0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lockMeshes():\n setLockOnMeshes(2)", "def cleanUpRigPose(self):\n\n # show the proxy geo\n cmds.select(self.name + \"_mover_grp\", hi=True)\n allNodes = cmds.ls(sl=True)\n for node in allNodes:\n if node.find(\"_proxy_geo\") != -1:\n if cmds.nodeType(n...
[ "0.5675033", "0.5524052", "0.5401451", "0.53727466", "0.53193283", "0.5234211", "0.51849127", "0.5175909", "0.51477677", "0.5075064", "0.50477535", "0.5032112", "0.5016843", "0.49993888", "0.49989218", "0.4995508", "0.49578157", "0.4956141", "0.49486592", "0.49314776", "0.492...
0.6947981
0
Prepares the scene for a rig.
def prepare(): # getRelativeArt checks if scene is saved skeleton_path = paths.getRelativeArt() # if scene is modified, ask user if they would like to save, not save, or cancel operation if not uiwindow.save(): pm.error('Scene not saved.') # perform a bone health check before referencing t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_scene(self, ):\n self.scene = create_scene(\n self.opt.splats_img_size, self.opt.splats_img_size, self.opt.fovy,\n self.opt.focal_length, self.opt.n_splats)", "def set_up_scenes():\n cmd.zoom('Cathepsin', 10) # Zoom out to get a view on the whole complex\n cmd.scene...
[ "0.6489929", "0.61271745", "0.6016473", "0.60112846", "0.58737195", "0.58737195", "0.5808305", "0.58061624", "0.58061624", "0.58061624", "0.57967305", "0.5735352", "0.5718494", "0.5693235", "0.5693235", "0.5693235", "0.5693235", "0.5693235", "0.5693235", "0.5693235", "0.56932...
0.6952782
0
Returns all available categories.
def get_all_categories(): return jsonify({ "success": True, "categories": _read_all_categories() })
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getAllCategories(self):\n return self.categories", "def get_categories(self):\n _url = urljoin(self.base_url, self.API_CATEGORIES)\n return requests.get(_url)", "def _get_all_categories() -> dict:\n categories = database.fetchall(\"Categories\", \"id\", \"name_ua\")\n ret...
[ "0.84352666", "0.8040093", "0.795076", "0.7868622", "0.78226036", "0.781811", "0.78094435", "0.7806805", "0.7805045", "0.77995926", "0.7742181", "0.7735259", "0.7709532", "0.7694586", "0.769186", "0.7655308", "0.76461715", "0.7583643", "0.7582509", "0.7538103", "0.7518969", ...
0.7982361
2
DELETE question using a question ID.
def delete_question(question_id): try: question = Question.query.get(question_id) if question is None: abort(404) question.delete() db.session.commit() return jsonify({ "success": True, "deleted_question_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_question(request, question_id):\n raise NotImplementedError", "def delete_question(self, question_id):\n\n question = self.sql.fetch_details_by_criteria(\n \"question_id\", question_id, \"questions\")\n\n if not question:\n\n return self.makeresp(\"This question ...
[ "0.87092954", "0.8384955", "0.8353129", "0.81277585", "0.810169", "0.8093647", "0.79760695", "0.79537916", "0.7660801", "0.7504361", "0.74473095", "0.73947793", "0.7327632", "0.71958506", "0.7178379", "0.7133595", "0.7054951", "0.6951195", "0.68221045", "0.67974144", "0.65992...
0.801446
6
Creates a new question
def create_question(): if request.content_type != "application/json": abort(415) question_text = request.json['question'] answer = request.json['answer'] difficulty = request.json['difficulty'] category = request.json['category'] question_object = Question(qu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_question():\n body = request.get_json()\n\n question_text = body.get('question', None)\n answer = body.get('answer', None)\n category = body.get('category', 1)\n difficulty = body.get('difficulty', 1)\n\n try:\n question = Question(question=question_t...
[ "0.79055667", "0.7813074", "0.76496226", "0.75417274", "0.7536455", "0.7524911", "0.7431518", "0.7412654", "0.7412654", "0.73918843", "0.73026544", "0.7290407", "0.7285686", "0.7280948", "0.7277673", "0.7270049", "0.7219192", "0.7162589", "0.70821846", "0.70660996", "0.705721...
0.80899006
0
Returns case insensitive matches for a search term
def search_questions(): if request.content_type != "application/json": abort(415) search_term: str = request.json.get('searchTerm') if search_term is None: abort(400) if search("^\\s*$", search_term) is not None: abort(422) questions = Question...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_query(term):\n def search(text):\n s=term.lower()\n if s in text.lower():\n return True\n return False\n return search", "def search(self, term):", "def search(self, word):", "def searchable(query):\n if query is None:\n return ''\n return strip_acc...
[ "0.7639096", "0.7310269", "0.7139636", "0.6653358", "0.65988", "0.6546445", "0.64347154", "0.6413569", "0.640629", "0.6398818", "0.63864064", "0.6377819", "0.63540596", "0.6295629", "0.62894785", "0.62558854", "0.6229605", "0.6159774", "0.61374915", "0.6110191", "0.6094641", ...
0.0
-1
Get all questions filtered by a category
def get_questions_by_category(category_id: int): category = Category.query.get(category_id) if category is None: abort(400) questions_by_category = Question.query.filter( Question.category == str(category_id)).all() return jsonify({ "success": True, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def retrieve_questions_by_category(category_id):\n try:\n selection = Question.query.filter(\n Question.category == category_id).order_by(Question.id).all()\n\n if len(selection) == 0:\n abort(404)\n\n questions = []\n\n for question ...
[ "0.7045061", "0.70348823", "0.7026578", "0.68939084", "0.6882774", "0.6860482", "0.6797814", "0.6765122", "0.6690764", "0.6680299", "0.6671632", "0.6665664", "0.6628369", "0.6480059", "0.64080924", "0.6332876", "0.6249306", "0.62117636", "0.61584663", "0.61449456", "0.6097295...
0.7141734
0
This endpoint should take category and previous question parameters and return a random questions within the given category, if provided, and that is not one of the previous questions.
def get_quiz_question(): if request.content_type != "application/json": abort(415) previous_questions: list[int] = request.json['previous_questions'] category: str = request.json['quiz_category'] filtered_category: list[Category] = Category.query.filter( Category...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_questions_toplay():\n data = request.get_json()\n category = data.get('category', 'None')\n previous_questions = data.get('previous_questions', None)\n questions = Question.query.filter(Question.category == category).all()\n all_questions = Question.query.all()\n c...
[ "0.74568665", "0.6912038", "0.6561906", "0.6539811", "0.65362525", "0.6439181", "0.64383984", "0.63652915", "0.63634086", "0.6346514", "0.62832403", "0.6261533", "0.61639524", "0.6094321", "0.6050536", "0.6016344", "0.5915583", "0.5853105", "0.58042264", "0.57684845", "0.5714...
0.7499
0
Return True if closed and False otherwise.
def _is_closed(self) -> bool: return self._status == Status.CLOSED
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_closed(self) -> bool:", "def is_close(self) -> bool:\n return not self.open", "def is_closed(self): # -> bool | Any:\n ...", "def closed(self):\n\n return not self.open", "def is_closed(self) -> bool | None:\n if self._is_open is None:\n return None\n r...
[ "0.86177653", "0.81572", "0.80928993", "0.80755955", "0.79734445", "0.7967501", "0.79415077", "0.79415077", "0.7935826", "0.7887935", "0.78787166", "0.7871184", "0.7847067", "0.7829436", "0.7829436", "0.78189903", "0.78124225", "0.77931994", "0.7779017", "0.77337986", "0.7634...
0.799
4
Validate status transition and set next status. The caller of the transition method will have to aquire conditional variable.
def _transition(self, next_status: Status) -> None: if next_status == Status.CLOSED: self._status = next_status elif ( self._status == Status.AWAITING_SERVER_MESSAGE and next_status == Status.SERVER_MESSAGE_AVAILABLE and self._server_message is not None ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next_status(self):\n if self.status == self.DRAFT:\n self._advance_to_registration()\n elif self.status == self.REGISTRATION:\n self._advance_to_pending()\n elif self.status == self.PENDING:\n self._advance_to_running()", "def _set_status(self, status, in...
[ "0.6936471", "0.6545385", "0.61415124", "0.6049134", "0.59733415", "0.5904015", "0.58512765", "0.580843", "0.5763939", "0.57431453", "0.5728972", "0.5710814", "0.57087004", "0.5695417", "0.5690907", "0.564556", "0.5603299", "0.55643886", "0.55600923", "0.5519623", "0.55151504...
0.8059536
0
Set bridge status to closed.
def close(self) -> None: with self._cv: self._transition(Status.CLOSED)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close(self, state):\n pass", "def is_closed(self, is_closed):\n\n self._is_closed = is_closed", "def close(self):\n self.state = STATE_STOPPED", "def close(self) -> None:\n self._connected = False", "def handle_close(self):\n self.active = False\n self.close()"...
[ "0.6226209", "0.61714906", "0.6165825", "0.60678107", "0.6056273", "0.60554194", "0.6015147", "0.6015147", "0.6001937", "0.5994272", "0.5922576", "0.5888235", "0.5880483", "0.5880483", "0.5865483", "0.58528066", "0.5836694", "0.58268356", "0.5815143", "0.58124125", "0.5787924...
0.61619353
3
Set server massage and wait for client message.
def request(self, server_message: ServerMessage) -> ClientMessage: # Set server message and transition to SERVER_MESSAGE_AVAILABLE with self._cv: self._raise_if_closed() if self._status != Status.AWAITING_SERVER_MESSAGE: raise Exception("This should not happen") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_client_message(self, client_message: ClientMessage) -> None:\n with self._cv:\n self._raise_if_closed()\n\n if self._status != Status.AWAITING_CLIENT_MESSAGE:\n raise Exception(\"This should not happen\")\n\n self._client_message = client_message # Wr...
[ "0.6532621", "0.60829353", "0.60618067", "0.60367125", "0.6031149", "0.60242295", "0.600211", "0.5916708", "0.5914085", "0.5873393", "0.58694917", "0.5843696", "0.5749328", "0.57308495", "0.570649", "0.57043403", "0.56998175", "0.56871885", "0.56841075", "0.5670463", "0.56438...
0.56337774
23
Return iterator over server messages.
def server_message_iterator(self) -> Iterator[ServerMessage]: while not self._is_closed(): with self._cv: self._cv.wait_for( lambda: self._status in [Status.CLOSED, Status.SERVER_MESSAGE_AVAILABLE] ) self._raise...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __iter__(self):\n while True:\n m = self.recv(timeout=1.0)\n if m is not None:\n yield m\n logger.debug(\"done iterating over bus messages\")", "def __iter__(self):\n return iter([self.format_message(record) for record in self._messages])", "def sen...
[ "0.70293", "0.681426", "0.6685467", "0.65742815", "0.63746", "0.6322583", "0.6322583", "0.6319159", "0.6243213", "0.6237469", "0.6149023", "0.6103872", "0.60832894", "0.6079954", "0.597399", "0.5964599", "0.59449357", "0.5915447", "0.59143317", "0.59071326", "0.5888881", "0...
0.80226314
0
Set client message for consumption.
def set_client_message(self, client_message: ClientMessage) -> None: with self._cv: self._raise_if_closed() if self._status != Status.AWAITING_CLIENT_MESSAGE: raise Exception("This should not happen") self._client_message = client_message # Write ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def client(self,message):\n self.message = message\n self.run()", "def _set_message(self, value):\n self.__message = value", "def setMessage(self, message):\n self._message = message", "def message(self, message):\n self._message = message", "def message(self, message):\n...
[ "0.7064386", "0.6990123", "0.67184645", "0.65573794", "0.65573794", "0.65327984", "0.6515193", "0.6515193", "0.6515193", "0.6515193", "0.6515193", "0.6515193", "0.6515193", "0.6515193", "0.6393413", "0.6339335", "0.63246405", "0.6275719", "0.62454003", "0.6086344", "0.6082703...
0.7599568
0
gets the distance between two cities from the database and updates the number of hits if found.
def get_distance_between_cities(self, source, destination): query = {"$or": [{SOURCE: source, DESTINATION: destination}, {SOURCE: destination, DESTINATION: source}]} doc1 = self._cities_distance.find_one_and_update(query, {"$inc": {HITS: 1}}) distance = -1 if doc1: distance =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def distanceBetweenTwoCities(cityA, cityB):\r\n\r\n return ( ( (cityA[0] - cityB[0]) ** 2 ) + ( (cityA[1] - cityB[1]) ** 2) ) ** 0.5", "def evaluate_distance(self, city):\n\t\treturn self.distance[city.value]", "def calculate_distance(loc1, loc2):\n matrix = googlemaps.distance_matrix.distance_matrix(cli...
[ "0.65696883", "0.63588417", "0.63102216", "0.6298032", "0.6286711", "0.6248496", "0.61212575", "0.60218096", "0.6021427", "0.5920487", "0.5870352", "0.5845951", "0.5799753", "0.57648885", "0.5758182", "0.57455", "0.57340556", "0.57309353", "0.572869", "0.5690227", "0.56465304...
0.75209475
0
adds two citie and their distance to the database.
def add_cities_to_db(self, source, destination, distance, is_post_insert=False): if not is_post_insert: self._cities_distance.insert_one( {SOURCE: source, DESTINATION: destination, DISTANCE: distance, HITS: 1}) else: self._cities_distance.insert_one( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def distance(self, other):\n ...", "def distance(self, keyOne, keyTwo):", "def distance(self, a, b):\n raise NotImplementedError()", "def costInsertion(el1,el2):\r\n return 2", "def distance(self, c1, c2):\r\n x = (c2.x - c1.x) ** 2\r\n y = (c2.y - c1.y) ** 2\r\n d = i...
[ "0.6052168", "0.59256554", "0.58947444", "0.56122863", "0.5598152", "0.5561179", "0.55405825", "0.5526655", "0.54927796", "0.547482", "0.54159796", "0.5413959", "0.5394808", "0.5382403", "0.5351781", "0.5341194", "0.5296761", "0.52946454", "0.5241165", "0.5225384", "0.5225066...
0.6522734
0
a method that checks if the connection to the database is ok.
def check_connection_to_db(self): try: self._client.admin.command('ismaster') return True except Exception: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_connection(self):\n if \"_connection\" not in self.__dict__:\n message = \"use connect method before doing operation on this database\"\n raise Exception(message)", "def check_db_connection(self):\n self.logger.debug('Checking database connection.')\n if self...
[ "0.7988681", "0.7964591", "0.7871532", "0.7792396", "0.77690375", "0.7682444", "0.7531027", "0.7450076", "0.74004126", "0.7381222", "0.73133624", "0.7306993", "0.7288626", "0.7231069", "0.71915644", "0.7104789", "0.7095957", "0.70758843", "0.7065347", "0.706142", "0.6992617",...
0.7153132
15
resets the data bases.
def reset_db(self): self._cities_distance.drop()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset():\n teardown_db()\n build()", "def reset_database(self):\n\n self.db.reset_database()", "def reset(self, reset_from):\n self._grants.clear()\n self._groups.clear()\n self._reset_cached()\n self._id += 1\n for name, backend in self._backends.items():\n ...
[ "0.70161057", "0.6995996", "0.69501084", "0.6918107", "0.69116414", "0.69109124", "0.67918694", "0.66903466", "0.6641579", "0.6610864", "0.6573909", "0.6535122", "0.6534111", "0.649824", "0.64869547", "0.6480793", "0.6437938", "0.64327985", "0.64327985", "0.64327985", "0.6428...
0.0
-1
The send() method is disabled in DummyConnection
async def send(self, message):
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send(self):\n raise NotImplementedError()", "def send(self):\n return False", "def send(self, msg):\n pass", "def send(self, msg):\n pass", "def send(self, msg):\n pass", "def send(self, message):\n pass", "def test_save_send(self):\r\n # Don't reall...
[ "0.75775987", "0.7284872", "0.71137285", "0.71137285", "0.71137285", "0.7007816", "0.6987256", "0.69711745", "0.6949789", "0.6918521", "0.6863206", "0.6835957", "0.6798795", "0.67086285", "0.6704559", "0.6691615", "0.6684624", "0.6666767", "0.66444695", "0.6639989", "0.659800...
0.6332149
44
Captures the response to a message
def respond(self, response): self.response = response
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_message(self, event):\n self.response = event.message\n self.connection.container.yield_() # Wake up the wait() loop to handle the message.", "def message_recording(client):\n client.register_and_login('foo', 'default')\n client.add_message('test message 1')\n client.add_message('<t...
[ "0.6729939", "0.6371365", "0.6274233", "0.6257684", "0.6242246", "0.624042", "0.6186375", "0.6183935", "0.6183935", "0.61788493", "0.6178649", "0.6155919", "0.6099436", "0.6081144", "0.6071888", "0.6071641", "0.6012938", "0.6002373", "0.5995019", "0.59876066", "0.5974825", ...
0.5608025
58
Captures the HTML response to a message
async def respondHTML(self, html): self.HTMLResponse = html
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def message_body_html(self):\n ...", "def _html(self, message):\n content = f\"<html><body><h1>{message}</h1></body></html>\"\n return content.encode(\"utf8\") # NOTE: must return a bytes object!", "def _html(self, message):\n content = f\"<html><body><h1>{message}</h1></body></htm...
[ "0.6637344", "0.6620112", "0.65681136", "0.64055985", "0.62257975", "0.62002647", "0.604187", "0.6003477", "0.5985468", "0.59392756", "0.59041214", "0.57948726", "0.5739584", "0.5736432", "0.5728024", "0.5726305", "0.5707939", "0.5704044", "0.5688189", "0.5646242", "0.5642735...
0.68577594
0
Called at decoration time, with the bare function being decorated
def __call__(self, func): LOG.debug("@function %s", func) func.handler = True func.function = True # Circuits properties func.names = self.names func.priority = self.kwargs.get("priority", 0) func.channel = self.kwargs.get("channel", ",".join(["functions.{}".for...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decorated(origFunc, newFunc, decoration='None'):\n\n pass", "def get_decorated_function(self):", "def __init__(self, decorated):\n self.decorated = decorated", "def __init__(self, decorated):\n self.decorated = decorated", "def __init__(self, decorated):\n self.decor...
[ "0.7754051", "0.7553801", "0.7309605", "0.7309605", "0.7309605", "0.7270114", "0.7269324", "0.70715153", "0.7051411", "0.69272476", "0.6877044", "0.6687945", "0.6658759", "0.66349643", "0.657433", "0.65073574", "0.6471143", "0.6452122", "0.64488125", "0.6425963", "0.64155096"...
0.0
-1
Called at decoration time, with the bare method being decorated
def __call__(self, ia): ia.handler = True ia.inbound_handler = True # Circuits properties ia.names = self.names ia.priority = self.kwargs.get("priority", 0) ia.channel = "{0}.{1}".format(constants.INBOUND_MSG_DEST_PREFIX, self.names[0]) ia.override = self.kwargs....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, decorated):\n self.decorated = decorated", "def __init__(self, decorated):\n self.decorated = decorated", "def __init__(self, decorated):\n self.decorated = decorated", "def get_decorated_function(self):", "def setDecorated(self, decorated):", "def deco...
[ "0.728691", "0.728691", "0.728691", "0.7025943", "0.69668305", "0.666403", "0.64638346", "0.6426368", "0.6348816", "0.63256234", "0.6299635", "0.62492776", "0.61985344", "0.61859363", "0.61783594", "0.61721826", "0.61710614", "0.6159806", "0.6103955", "0.6100871", "0.60811365...
0.0
-1
The code to call when a method with the decorator `()` is invoked. Returns result_list when method with the decorator `()` is finished processing. A method that has this handler should yield a str when done
def _invoke_inbound_app(evt, **kwds): result_list = [] LOG.debug("Running _invoke_inbound_app in Thread: %s", threading.currentThread().name) # Invoke the actual Function ia_results = ia(itself, evt.message, evt.message.get("action", "Unknown")) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def execute(self):\n results = []\n\n for callNumber in xrange(len(self.callback)):\n results.append( (self.callback.pop(0))(*self.args.pop(0)) )\n\n return results", "def test_returns_list(self):\n metrics = ('input', 'output')\n\n @callback_return(*metrics)\n ...
[ "0.5730961", "0.571719", "0.5681547", "0.56003", "0.5579488", "0.55392265", "0.5468535", "0.54375017", "0.54157335", "0.5337627", "0.5329474", "0.52912915", "0.52912664", "0.5280508", "0.5269396", "0.52686286", "0.52246803", "0.5219803", "0.5192265", "0.5190813", "0.5187031",...
0.0
-1
Called at decoration time, with the bare function being decorated
def __call__(self, fn): fn.handler = True fn.function = True # Circuits properties fn.names = self.names fn.priority = self.kwargs.get("priority", 0) fn.channel = "functions.{0}".format(self.names[0]) fn.override = self.kwargs.get("override", False) fn.ev...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decorated(origFunc, newFunc, decoration='None'):\n\n pass", "def get_decorated_function(self):", "def __init__(self, decorated):\n self.decorated = decorated", "def __init__(self, decorated):\n self.decorated = decorated", "def __init__(self, decorated):\n self.decor...
[ "0.7754051", "0.7553801", "0.7309605", "0.7309605", "0.7309605", "0.7270114", "0.7269324", "0.70715153", "0.7051411", "0.69272476", "0.6877044", "0.6687945", "0.6658759", "0.66349643", "0.657433", "0.65073574", "0.6471143", "0.6452122", "0.64488125", "0.6425963", "0.64155096"...
0.0
-1
The code to call when a function with the decorator `(api_name)` is invoked. Returns result_list when function with the decorator `(api_name)` is finished processing. A method that has this handler should yield a StatusMessage or a FunctionResult When a StatusMessage is yield'ed a StatusMessageEvent is fired with the t...
def _invoke_app_function(evt, **kwds): LOG.debug("Running _invoke_app_function in Thread: %s", threading.currentThread().name) result_list = [] # Validate the fn_inputs in the Message fn_inputs = validate_fields([], kwds) LOG.info("[%s] V...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __call__(self, fn):\n fn.handler = True\n fn.function = True\n\n # Circuits properties\n fn.names = self.names\n fn.priority = self.kwargs.get(\"priority\", 0)\n fn.channel = \"functions.{0}\".format(self.names[0])\n fn.override = self.kwargs.get(\"override\", F...
[ "0.59578174", "0.5911615", "0.57482475", "0.5733824", "0.549491", "0.5357246", "0.5351939", "0.5299015", "0.5251983", "0.5232291", "0.5200426", "0.5197246", "0.51885444", "0.5169449", "0.51555896", "0.5143685", "0.5096061", "0.50952315", "0.50873774", "0.5064264", "0.5055664"...
0.5020217
23
Called at decoration time
def __call__(self, func): # Set or extend the function's "custom_fields" attribute func.required_fields = getattr(func, "required_fields", {}) func.required_fields[self.fieldname] = self.input_type # The decorated function is unchanged return func
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, decorated):\n self.decorated = decorated", "def __init__(self, decorated):\n self.decorated = decorated", "def __init__(self, decorated):\n self.decorated = decorated", "def __call__( self ):\n pass", "def __call__(self):\n pass", "def __c...
[ "0.67608446", "0.67608446", "0.67608446", "0.6426024", "0.6418647", "0.6418647", "0.6292791", "0.629227", "0.6245761", "0.6233334", "0.62161237", "0.6214014", "0.61665714", "0.61352736", "0.60767996", "0.6046218", "0.59930605", "0.59683245", "0.59683245", "0.59683245", "0.596...
0.0
-1
Called at decoration time
def __call__(self, func): # Set or extend the function's "action_fields" attribute func.required_action_fields = getattr(func, "required_action_fields", {}) func.required_action_fields[self.fieldname] = self.input_type # The decorated functio...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, decorated):\n self.decorated = decorated", "def __init__(self, decorated):\n self.decorated = decorated", "def __init__(self, decorated):\n self.decorated = decorated", "def __call__( self ):\n pass", "def __call__(self):\n pass", "def __c...
[ "0.67608446", "0.67608446", "0.67608446", "0.6426024", "0.6418647", "0.6418647", "0.6292791", "0.629227", "0.6245761", "0.6233334", "0.62161237", "0.6214014", "0.61665714", "0.61352736", "0.60767996", "0.6046218", "0.59930605", "0.59683245", "0.59683245", "0.59683245", "0.596...
0.0
-1
Called at decoration time, with function
def __call__(self, func): LOG.debug("@defer %s", func) @wraps(func) def decorated(itself, event, *args, **kwargs): """the decorated function""" LOG.debug("decorated") if event.defer(itself, delay=self.delay): # OK, let's handle it later ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_decorated_function(self):", "def __init__(self, decorated):\n self.decorated = decorated", "def __init__(self, decorated):\n self.decorated = decorated", "def __init__(self, decorated):\n self.decorated = decorated", "def decorated(origFunc, newFunc, decoration='Non...
[ "0.7237454", "0.69157207", "0.69157207", "0.69157207", "0.67605", "0.6554005", "0.65471756", "0.65029734", "0.64229554", "0.63622516", "0.6257818", "0.62327325", "0.62327325", "0.62327325", "0.62327325", "0.62327325", "0.6222223", "0.6181449", "0.6173241", "0.61729336", "0.61...
0.5763306
59
Callback to return the debouncekey for an event. Multiple events with this key will be debounced together.
def debounce_get_incident_key(event): key = "{} for {}".format(event.name, event.message["incident"]["id"]) return key
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def debounce(self):\n return self._debounce", "def __call__(self, func):\n LOG.debug(\"@debounce %s\", func)\n\n @wraps(func)\n def decorated(itself, event, *args, **kwargs):\n \"\"\"the decorated function\"\"\"\n LOG.debug(\"decorated\")\n # De-bounce...
[ "0.69050074", "0.6123342", "0.5904678", "0.52922404", "0.5247472", "0.5242694", "0.5129239", "0.51142675", "0.5103602", "0.50961006", "0.50425494", "0.5007442", "0.49957982", "0.4994945", "0.49930578", "0.49906588", "0.49828362", "0.49241093", "0.49202102", "0.4884297", "0.48...
0.57593954
3
Called at decoration time, with function
def __call__(self, func): LOG.debug("@debounce %s", func) @wraps(func) def decorated(itself, event, *args, **kwargs): """the decorated function""" LOG.debug("decorated") # De-bounce messages for this event and the same key: # (key is the incident-...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_decorated_function(self):", "def __init__(self, decorated):\n self.decorated = decorated", "def __init__(self, decorated):\n self.decorated = decorated", "def __init__(self, decorated):\n self.decorated = decorated", "def decorated(origFunc, newFunc, decoration='Non...
[ "0.72377807", "0.69162107", "0.69162107", "0.69162107", "0.6759313", "0.65535724", "0.654546", "0.6501962", "0.6421653", "0.6363204", "0.6257508", "0.6234376", "0.6234376", "0.6234376", "0.6234376", "0.6234376", "0.6224008", "0.6180461", "0.617621", "0.6172303", "0.61428994",...
0.0
-1
Max limit is number of the combinations.
def generate_operations(self): combinations = self.COMBINATIONS.items()[:self.limit] for (term1, term2), type in combinations: yield (term1, term2, type)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_max_combination(total_cuts):\n max_pieces = 0\n for i in range(total_cuts):\n result = i * (total_cuts - i)\n if result > max_pieces:\n max_pieces = result\n print(max_pieces)", "def brute(limit):\n c_lengths = {s: collatz_length(s) for s in range(1, limit+1)}\n re...
[ "0.6800466", "0.6524601", "0.6210363", "0.6164436", "0.6090136", "0.6063205", "0.5984609", "0.59758997", "0.5967854", "0.59423184", "0.5904825", "0.58632207", "0.5821482", "0.5780177", "0.5776541", "0.5754548", "0.5750066", "0.57412267", "0.5734265", "0.5721653", "0.5720588",...
0.0
-1
Check for Walabot connectivity. loop until detect a Walabot.
def verifyWalabotIsConnected(): while True: try: wlbt.ConnectAny() except wlbt.WalabotError as err: input("- Connect Walabot and press 'Enter'.") else: print('- Connection to Walabot established.') return
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_connection():\n if connected():\n ws.emit(Message('mycroft.internet.connected'))\n # check for pairing, if not automatically start pairing\n if not is_paired():\n # begin the process\n payload = {\n 'utterances': [\"pair my device\"],\n ...
[ "0.67418945", "0.67034936", "0.6321306", "0.6317192", "0.6138319", "0.6137619", "0.6137448", "0.6100447", "0.6077443", "0.6034586", "0.5992254", "0.5982001", "0.5950899", "0.5919076", "0.5894772", "0.58944863", "0.5866478", "0.5837735", "0.5822696", "0.5799287", "0.57872075",...
0.8310073
0
Configure Walabot's profile, arena (r, theta, phi), threshold and the image filter.
def setWalabotSettings(): wlbt.SetProfile(wlbt.PROF_SENSOR) wlbt.SetArenaR(R_MIN, R_MAX, R_RES) wlbt.SetArenaTheta(THETA_MIN, THETA_MAX, THETA_RES) wlbt.SetArenaPhi(PHI_MIN, PHI_MAX, PHI_RES) #wlbt.SetThreshold(THRESHOLD) wlbt.SetDynamicImageFilter(wlbt.FILTER_TYPE_DERIVATIVE) #Also test with FI...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pibooth_setup_camera(cfg):", "def __init__(self):\n\n # self.threshold = 3.\n self.gamma_min = 3\n self.gamma_max = 12\n self.n_samples = 40\n # self.do_plots = False\n # self.do_albedo = True\n # self.verbose = True\n\n self.nbands = 7\n sel...
[ "0.55619794", "0.5276887", "0.5156513", "0.51370335", "0.512774", "0.51219815", "0.5073326", "0.5047057", "0.50075054", "0.49671337", "0.4966661", "0.49465856", "0.4934728", "0.49258626", "0.49199712", "0.49144244", "0.48763582", "0.48478684", "0.48258424", "0.4820601", "0.48...
0.75236595
0
Start the Walabot and calibrate it.
def startAndCalibrateWalabot(): wlbt.StartCalibration() print('- Calibrating...') while wlbt.GetStatus()[0] == wlbt.STATUS_CALIBRATING: wlbt.Trigger() wlbt.Start() print('- Calibration ended.\n- Ready!')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setWalabotSettings():\n wlbt.SetProfile(wlbt.PROF_SENSOR)\n wlbt.SetArenaR(R_MIN, R_MAX, R_RES)\n wlbt.SetArenaTheta(THETA_MIN, THETA_MAX, THETA_RES)\n wlbt.SetArenaPhi(PHI_MIN, PHI_MAX, PHI_RES)\n #wlbt.SetThreshold(THRESHOLD)\n wlbt.SetDynamicImageFilter(wlbt.FILTER_TYPE_DERIVATIVE) #Also t...
[ "0.61959416", "0.6061523", "0.60181415", "0.60077643", "0.58197683", "0.5722696", "0.5720339", "0.56705564", "0.56593007", "0.5618712", "0.56180704", "0.56057066", "0.56027627", "0.5589759", "0.5566517", "0.55604434", "0.5554661", "0.5530717", "0.5525474", "0.5512045", "0.550...
0.84001803
0
Stops Walabot and disconnect the device.
def stopAndDisconnectWalabot(): wlbt.Stop() wlbt.Disconnect() print ('Termination successful')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stop(self) -> None:\n self.mqttc.disconnect()", "def stop(self):\n self.conn.stop()", "def stop(self):\n self.bus.log('Stopping down OLA Plugin.')\n self.bus.unsubscribe(\n self.channel_names['channel_request'],\n self.handle_channel\n )\n sel...
[ "0.73858374", "0.69355065", "0.6850796", "0.6815512", "0.68138057", "0.68138057", "0.6790304", "0.67658573", "0.676303", "0.6745841", "0.67418426", "0.67080593", "0.6698249", "0.66884", "0.6684982", "0.6664148", "0.66465163", "0.663873", "0.66383976", "0.66383976", "0.6627888...
0.832489
0
Detect and record whether or not there is a target and whether or not it is breathing.
def catExists(): currentTime = datetime.now().strftime('%H:%M:%S') while True: #wlbt.Trigger() target = wlbt.GetSensorTargets() if target: breathing = isBreathing() if breathing == 1: #print("the cat is alive!") catStatus = 2 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_ball_on_target():\n\n pass", "async def is_target_reached(self) -> bool: # type: ignore\n ...", "def is_gentarget(self, target):\r\n raise NotImplementedError", "def has_target(self):\n return self.target is not None", "def need_target(self):\n\t\t# if we search for color tar...
[ "0.73965406", "0.69133866", "0.659677", "0.65672535", "0.65581936", "0.6413436", "0.6356345", "0.62851787", "0.62369335", "0.61396855", "0.6083162", "0.60699123", "0.6033767", "0.6033767", "0.60063726", "0.59937567", "0.5978707", "0.5915004", "0.590908", "0.58708715", "0.5870...
0.0
-1
Assign lipids to respective leaflets
def identify_leaflets(u, time_ts): z = u.select_atoms("all").center_of_geometry()[2] COM_z= np.array([0,0,z]) #defines the global midplane position along z x, y, z = u.trajectory.ts.triclinic_dimensions[0][0], u.trajectory.ts.triclinic_dimensions[1][1], u.trajectory.ts.triclinic_dimensions[2][2] box = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def replace_lipid(membrane,cholesterol,nreplace) :\n\n if nreplace % 2 != 0 :\n raise ValueError(\"Number of replacements must be divisible by 2\")\n \n lipids_wat = [\"W\"]\n lipids_wat.extend(lipids)\n \n # Store away residues\n lipid_res = [r for r in membrane.residues if r.resname.upper().strip() in ...
[ "0.57010627", "0.56445384", "0.56101805", "0.5581516", "0.55390495", "0.5480422", "0.5306147", "0.5279905", "0.52695376", "0.5215408", "0.5198409", "0.51911825", "0.5180127", "0.515217", "0.5136848", "0.5120094", "0.51109314", "0.5096809", "0.50735694", "0.5068601", "0.505996...
0.53537464
6
Returns the unit vector of the vector.
def unit_vector(vector): return vector / np.linalg.norm(vector)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unit_vector(vector):\n #print 'unit_vector'\n #print vector\n #print type(vector)\n #npvector = np.array(vector)\n return vector / np.linalg.norm(vector)", "def _get_unit_vector(self, v):\n return v / np.linalg.norm(v)", "def get_unit_vector(self, vector):\n return vector / la....
[ "0.8355314", "0.8344175", "0.83402044", "0.83041203", "0.8288785", "0.82710177", "0.8263843", "0.8237869", "0.8219826", "0.8203201", "0.8180198", "0.8180198", "0.8180198", "0.8157419", "0.80363405", "0.8024346", "0.7914348", "0.7900733", "0.78349787", "0.7770651", "0.77661633...
0.8116172
22
Returns the angle in radians between vectors 'v1' and 'v2' The sign of the angle is dependent on the order of v1 and v2
def compute_angle(v1, v2): cosang = np.dot(v1, v2) sinang = la.norm(np.cross(v1, v2)) angle = np.arctan2(sinang, cosang) return angle
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def angleBetweenVectors(v1, v2):\n v2Size = vectorLength(v2)\n if not v2Size:\n theta = 0.0\n else:\n theta = math.acos(dotProduct(v1, v2) / v2Size)\n return theta", "def angle(self, v1, v2):\r\n cosang = np.dot(v1, v2)\r\n sinang = np.linalg.norm(np.cross(v1, v2))\r\n return n...
[ "0.89745975", "0.89499927", "0.89068824", "0.8855927", "0.8761891", "0.87150687", "0.86889726", "0.8623233", "0.8622836", "0.8610433", "0.86037433", "0.8565726", "0.85333735", "0.83600396", "0.83338356", "0.8310569", "0.8287398", "0.82812274", "0.8280104", "0.82704085", "0.82...
0.8954668
1
computes ID reward, +1 if player scores a point, 1 otherwise
def rewardID(score1, score2): reward = score1 - score2 return reward, -reward
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reward(self, player, winning_state):\n if winning_state == \"Tie\":\n return 1\n elif winning_state == \"Resume\":\n return -1\n else:\n if player == \"agent\":\n return 10\n else:\n return -10", "def r_point(self)...
[ "0.6437977", "0.64029753", "0.6254412", "0.61305016", "0.6119045", "0.6057819", "0.60051566", "0.59680796", "0.595627", "0.59547967", "0.58996826", "0.5880871", "0.5861454", "0.58425546", "0.5823367", "0.58139914", "0.5804704", "0.57948387", "0.5769876", "0.57661957", "0.5737...
0.7202625
0
computes SE reward, depending on whether the agent is 'catching up' or 'getting ahead'
def rewardSE(score1, score2, cum_score1, cum_score2): score_diff = score1 - score2 diff = cum_score1 - cum_score2 return unitRewardSE(score_diff, diff), unitRewardSE(-score_diff, diff)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_reward(self):\n if self.status():\n return self.current_step/self.ep_length # the reward is proportional to the duration \n else:\n return 0", "def get_reward(self, is_terminal_state, result, reward, is_agent_move):\n if is_terminal_state:\n reward += 0 if result == \"...
[ "0.69249827", "0.68843967", "0.68833375", "0.68820304", "0.68806565", "0.6787305", "0.6781655", "0.67804056", "0.67503536", "0.6675589", "0.66218454", "0.6619695", "0.66102624", "0.6590536", "0.6574249", "0.65695703", "0.65641147", "0.65584797", "0.6543265", "0.6542407", "0.6...
0.0
-1
Load the pcb metal dataset
def load_pcb(self, dataset_dir, subset, file_list=None, image_ext="jpg", object_class=None): self.image_dir = os.path.join(dataset_dir, "images") self.annotations_dir = os.path.join(dataset_dir, "annotations") # add classes. if object_class is None: obj = glob.glob...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_data_pkl(self):\n pkl_name = '{}/data/mini-imagenet-cache-{}.pkl'.format(self.root_dir, self.split)\n print('Loading pkl dataset: {} '.format(pkl_name))\n\n try:\n with open(pkl_name, \"rb\") as f:\n data = pkl.load(f, encoding='bytes')\n image_d...
[ "0.6541246", "0.6287889", "0.6214803", "0.6182117", "0.6064615", "0.60214704", "0.5922483", "0.5921194", "0.5889621", "0.58767706", "0.5812144", "0.5799", "0.5793534", "0.5788472", "0.5771795", "0.5732959", "0.5713654", "0.5689809", "0.5689483", "0.5679353", "0.5677678", "0...
0.0
-1
Generate instance masks for an image.
def load_mask(self, image_id): image_info = self.image_info[image_id] if image_info["source"] != "pcb": return super(self.__class__, self).load_mask(image_id) # convert polygons to a bitmap mask of shape # [height, width, instance_count] info = self.image_info[image...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_mask(self, image_id):\n # If not a vesicle dataset image, delegate to parent class.\n image_info = self.image_info[image_id]\n if image_info[\"source\"] != \"vesicle\":\n return super(self.__class__, self).load_mask(image_id)\n\n # Convert polygons to a bitmap mask o...
[ "0.6926018", "0.6916978", "0.6871326", "0.6845947", "0.67575824", "0.67555743", "0.67047006", "0.6701396", "0.6675392", "0.6627721", "0.6609718", "0.6604988", "0.6547317", "0.65468746", "0.6392952", "0.63381743", "0.63316107", "0.6330832", "0.6304875", "0.62868094", "0.628625...
0.69285274
0
Return the path of the image
def image_reference(self, image_id): info = self.image_info[image_id] if info["source"] == "pcb": return info["path"] else: super(self.__class__, self).image_reference(image_id)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def imagePath(self):\n return self.path", "def get_pathname(self):\n return self.image_data.path", "def imagePath(self):\n if self.use_dic:\n if self.imlist:\n paths = []\n for img in self.allimgs:\n paths.append(join(self.home, '...
[ "0.85880727", "0.8271568", "0.8216832", "0.7946613", "0.7911829", "0.7874524", "0.7848652", "0.77885175", "0.7750109", "0.76651067", "0.75987107", "0.7574366", "0.7495351", "0.74785393", "0.74669605", "0.7447827", "0.7440666", "0.7435005", "0.7424479", "0.74243397", "0.740057...
0.0
-1
Simple wget get line
def fetch(file): print "Fetching {0}...".format(file.split("/")[-1]) subprocess.call("wget {0} > /dev/null 2>&1".format(file), shell=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wget(URL):\n URL = URL.replace(\"http://\",\"\")\n ip_address = URL.split(\"/\")[0]\n script = \"/\"+\"/\".join(URL.split(\"/\")[1:])\n if not ip_address in connections:\n from httplib import HTTPConnection\n connection = HTTPConnection(ip_address)\n connections[ip_address] = c...
[ "0.73125535", "0.71006334", "0.69523764", "0.648822", "0.6264116", "0.6225872", "0.60921", "0.6089753", "0.6039321", "0.60207665", "0.60082555", "0.59652096", "0.59531015", "0.5945191", "0.5940594", "0.5929515", "0.59092826", "0.58861315", "0.5877554", "0.5873468", "0.5867955...
0.67773914
3
Makes a GET request to the {url}. Searches for an html element(s) by its xpath.
def find_html_element_by_xpath(url, xpath, proxies=None): try: response = requests.get(url, proxies=proxies).text except requests.RequestException as e: logging.error("Request error: {}".format(e)) # TODO: exception handling return None tree = ht...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_tag(url, xpathExpression, params=None):\n headers = {'User-Agent': 'curl/7.35.0'}\n page = requests.get(url, params=params, headers=headers)\n page.raise_for_status()\n tree = html.fromstring(page.content)\n return tree.xpath(xpathExpression)", "def do_get(self, url):\n self.driver....
[ "0.64967495", "0.6384309", "0.6333756", "0.6136398", "0.61055344", "0.59896374", "0.5950545", "0.5900976", "0.58881927", "0.5864435", "0.5814219", "0.57650304", "0.5764316", "0.57599485", "0.5714126", "0.5696378", "0.5645251", "0.5619285", "0.5600905", "0.5598952", "0.5590954...
0.5867571
9
Coefficients are taken from the official codes of DUFVSR This conversion is also the same as that in BasicSR
def rgb_to_ycbcr(img): T = np.array([ [0.256788235294118, -0.148223529411765, 0.439215686274510], [0.504129411764706, -0.290992156862745, -0.367788235294118], [0.097905882352941, 0.439215686274510, -0.071427450980392], ], dtype=np.float64) O = np.array([16, 128, 128], dtype=np.fl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def d_coefficients(x1,x2,x3,CCoefficients):\n\tDCoefficients = np.array([\t(CCoefficients[1]-CCoefficients[0])/(3*(x2-x1)), \\\n\t\t\t\t\t\t\t\t(CCoefficients[2]-CCoefficients[1])/(3*(x3-x2))\t], \\\n\t\t\t\t\t\t\t\tfloat)\n\treturn(DCoefficients)", "def b_coefficients(x1,x2,x3,y1,y2,y3,CCoefficients,DCoeffici...
[ "0.6410733", "0.63527215", "0.6306684", "0.6229015", "0.6164668", "0.6134661", "0.60982096", "0.6057532", "0.60417587", "0.60015625", "0.5875096", "0.5800425", "0.5776809", "0.57378215", "0.5697484", "0.56964654", "0.56898993", "0.5680222", "0.56543076", "0.5653175", "0.56488...
0.0
-1
Convert np.float32 array to np.uint8
def float32_to_uint8(inputs): return np.uint8(np.clip(np.round(inputs * 255), 0, 255))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cast_float_to_uint8(array_float):\n if not numpy.issubdtype(array_float.dtype, numpy.float):\n raise TypeError('`array_float.dtype` is not smaller than `numpy.float` in type hierarchy.')\n \n # If the above check did not exist and `array_float`\n # contained integers, the clipping below woul...
[ "0.7408117", "0.73111886", "0.7305541", "0.7285258", "0.7285258", "0.7240387", "0.7012514", "0.69310755", "0.68306875", "0.68195", "0.64354885", "0.6360376", "0.6294902", "0.6274729", "0.6251667", "0.6224117", "0.6179129", "0.6171993", "0.60785764", "0.60785764", "0.60175484"...
0.80445904
0
Convert data to torch tensor with type float32 Assume data has type np.uint8/np.float32 or torch.uint8/torch.float32, and uint8 data ranges in [0, 255] and float32 data ranges in [0, 1]
def canonicalize(data): if isinstance(data, np.ndarray): if data.dtype == np.uint8: data = data.astype(np.float32) / 255.0 data = torch.from_numpy(np.ascontiguousarray(data)) elif isinstance(data, torch.Tensor): if data.dtype == torch.uint8: data = data.float() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def data_convert2float32 (self, data):\r\n data = data.astype(np.float32)\r\n\r\n return data", "def list_to_tensor(data):\n return torch.as_tensor(data, dtype=torch.float32, device=global_device())", "def __to_tensor__(data: Union[int, float, np.ndarray, List]) -> torch.tensor:\n\n if ...
[ "0.7918191", "0.75068885", "0.73765385", "0.6987699", "0.6949261", "0.6949261", "0.6949261", "0.67039037", "0.6699868", "0.66764146", "0.6664306", "0.6650705", "0.6586295", "0.6581201", "0.65121454", "0.64635706", "0.64152795", "0.6371685", "0.63533086", "0.63247216", "0.6193...
0.75479096
1
Save each frame of a sequence to .png image in seq_dir
def save_sequence(seq_dir, seq_data, frm_idx_lst=None, to_bgr=False): if to_bgr: seq_data = seq_data[..., ::-1] # rgb2bgr # use default frm_idx_lst is not specified tot_frm = len(seq_data) if frm_idx_lst is None: frm_idx_lst = ['{:04d}.png'.format(i) for i in range(tot_frm)] # sa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def saveFrames(filepath, frames):\n\n for i, frame in enumerate(frames):\n image = Image.fromarray(frame)\n image.save(filepath + str(i).zfill(8) + '.png')", "def _save_frame_as_png(\n self : \"animation\",\n frame : \"np.ndarray\",\n filename : \"str\"\n ...
[ "0.7453527", "0.70677906", "0.70371145", "0.68463975", "0.6716898", "0.66529393", "0.656279", "0.6541152", "0.64740807", "0.64529353", "0.63749933", "0.6366781", "0.6315768", "0.62766594", "0.62292975", "0.62225884", "0.6212714", "0.6183725", "0.6175805", "0.61635643", "0.610...
0.7877584
0
Test Codon Adaptation Index (CAI) using default E. coli data.
def test_codon_usage_ecoli(self): CAI = CodonAdaptationIndex() self.assertEqual("%0.5f" % CAI.cai_for_gene("ATGCGTATCGATCGCGATACGATTAGGCGGATG"), "0.09978")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_codon_usage_custom(self):\n # We need a FASTA file of CDS sequences to count the codon usage...\n dna_fasta_filename = \"fasta.tmp\"\n dna_genbank_filename = \"GenBank/NC_005816.gb\"\n record = SeqIO.read(dna_genbank_filename, \"genbank\")\n records = []\n for fea...
[ "0.6492251", "0.63939977", "0.5973257", "0.58685595", "0.58200365", "0.5816378", "0.5812816", "0.5785232", "0.5783167", "0.5756506", "0.5725458", "0.57007027", "0.5692516", "0.56283003", "0.5610308", "0.5608039", "0.55863476", "0.55578107", "0.55529904", "0.5548385", "0.55437...
0.73449653
0
Test Codon Adaptation Index (CAI) using FASTA file for background.
def test_codon_usage_custom(self): # We need a FASTA file of CDS sequences to count the codon usage... dna_fasta_filename = "fasta.tmp" dna_genbank_filename = "GenBank/NC_005816.gb" record = SeqIO.read(dna_genbank_filename, "genbank") records = [] for feature in record.fe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_fasta_one_sequence(self):\n record = list(SeqIO.parse(\"Registry/seqs.fasta\", \"fasta\"))[0]\n input_file = \"seq.fasta\"\n with open(input_file, \"w\") as handle:\n SeqIO.write(record, handle, \"fasta\")\n\n cline = XXmotifCommandline(outdir=self.out_dir, seqfile=i...
[ "0.6029809", "0.6004039", "0.5884848", "0.58040977", "0.57673204", "0.5664929", "0.5589991", "0.5577867", "0.5553025", "0.5465446", "0.5464523", "0.54561615", "0.54151857", "0.5407253", "0.5386596", "0.5384784", "0.5371423", "0.5339712", "0.52890664", "0.527738", "0.5269766",...
0.59767234
2
Test getting Elgato Light state in temperature mode.
async def test_state_temperature(aresponses): aresponses.add( "example.com:9123", "/elgato/lights", "GET", aresponses.Response( status=200, headers={"Content-Type": "application/json"}, text=load_fixture("state-temperature.json"), ), ) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def test_light_state(\n hass: HomeAssistant, aioclient_mock: AiohttpClientMocker\n) -> None:\n await init_integration(hass, aioclient_mock)\n\n entity_registry = er.async_get(hass)\n\n state = hass.states.get(\"light.modernformsfan_light\")\n assert state\n assert state.attributes.get(ATTR_...
[ "0.6878956", "0.6712697", "0.6622997", "0.661685", "0.65766895", "0.6493358", "0.64604175", "0.64513606", "0.63721883", "0.63063693", "0.62966764", "0.6294307", "0.62630814", "0.6253732", "0.6194373", "0.6189593", "0.61587435", "0.6146471", "0.6141874", "0.6124011", "0.612033...
0.727813
0
Test getting Elgato Light state in color mode.
async def test_state_color(aresponses): aresponses.add( "example.com:9123", "/elgato/lights", "GET", aresponses.Response( status=200, headers={"Content-Type": "application/json"}, text=load_fixture("state-color.json"), ), ) async wi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_color(self):\n self._calibration_test(\"color_full\")", "def test_change_color_of_the_device__true():", "def check_light(light: pykulersky.Light):\n light.connect()\n light.get_color()", "def test_change_color_of_the_device__false():", "async def test_light_state(\n hass: HomeAssis...
[ "0.7008754", "0.699675", "0.68415654", "0.6793344", "0.6721419", "0.66686684", "0.66600657", "0.65265566", "0.6461606", "0.6447308", "0.6429285", "0.6395175", "0.6358749", "0.6337252", "0.6333656", "0.63308775", "0.62578654", "0.6250418", "0.6241562", "0.62268525", "0.6144565...
0.6693482
5
Test changing Elgato Light State in temperature mode.
async def test_change_state_temperature(aresponses): async def response_handler(request): """Response handler for this test.""" data = await request.json() assert data == { "numberOfLights": 1, "lights": [{"on": 1, "brightness": 100, "temperature": 200}], } ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def test_thermostat_heatit_z_trm2fx(\n hass: HomeAssistant, client, climate_heatit_z_trm2fx, integration\n) -> None:\n node = climate_heatit_z_trm2fx\n state = hass.states.get(CLIMATE_FLOOR_THERMOSTAT_ENTITY)\n\n assert state\n assert state.state == HVACMode.HEAT\n assert state.attributes[A...
[ "0.69498336", "0.6923428", "0.681475", "0.6802302", "0.6794112", "0.67801625", "0.6736621", "0.65671206", "0.65611637", "0.65540653", "0.6538566", "0.652884", "0.6527561", "0.6511185", "0.64904994", "0.6450532", "0.64299566", "0.639926", "0.6396049", "0.63834566", "0.6369441"...
0.0
-1
Response handler for this test.
async def response_handler(request): data = await request.json() assert data == { "numberOfLights": 1, "lights": [{"on": 1, "brightness": 100, "temperature": 200}], } return aresponses.Response( status=200, headers={"Content-Type": "applica...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def _response_handler(self):", "def response_handling(self) -> global___Snippet.SimpleResponseHandling:", "def response_handling(self) -> global___Snippet.SimpleResponseHandling:", "def responseHandler(self, factory):\n pass", "def main_response(self, data):", "def main_response(self, data):...
[ "0.79522353", "0.76998967", "0.76998967", "0.7572021", "0.75436866", "0.75436866", "0.74242777", "0.72418624", "0.71199226", "0.71199226", "0.7052633", "0.70363975", "0.6936624", "0.693356", "0.69223917", "0.69198334", "0.6851695", "0.683862", "0.683862", "0.6835354", "0.6757...
0.0
-1
Test changing Elgato Light State in color mode.
async def test_change_state_color(aresponses): async def response_handler(request): """Response handler for this test.""" data = await request.json() assert data == { "numberOfLights": 1, "lights": [{"on": 1, "brightness": 100, "hue": 10.1, "saturation": 20.2}], ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_change_color_of_the_device__true():", "def test_change_color_of_the_device__false():", "async def test_color_light(\n hass: HomeAssistant, bulb: MagicMock, transition: float | None\n) -> None:\n already_migrated_config_entry = MockConfigEntry(\n domain=DOMAIN, data={}, unique_id=MAC_ADDRE...
[ "0.7458252", "0.72283345", "0.7105034", "0.6960823", "0.6951184", "0.68336487", "0.6811411", "0.6783545", "0.67750144", "0.6621819", "0.66058975", "0.6532489", "0.6530398", "0.65095425", "0.6417558", "0.6401113", "0.6388816", "0.63654095", "0.63467056", "0.63447046", "0.63100...
0.0
-1
Response handler for this test.
async def response_handler(request): data = await request.json() assert data == { "numberOfLights": 1, "lights": [{"on": 1, "brightness": 100, "hue": 10.1, "saturation": 20.2}], } return aresponses.Response( status=200, headers={"Content-Ty...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def _response_handler(self):", "def response_handling(self) -> global___Snippet.SimpleResponseHandling:", "def response_handling(self) -> global___Snippet.SimpleResponseHandling:", "def responseHandler(self, factory):\n pass", "def main_response(self, data):", "def main_response(self, data):...
[ "0.79537404", "0.7702842", "0.7702842", "0.75738364", "0.7545603", "0.7545603", "0.7425096", "0.724262", "0.71217763", "0.71217763", "0.7053156", "0.70377403", "0.69370884", "0.69352", "0.69240254", "0.6920867", "0.6853209", "0.684176", "0.684176", "0.6834451", "0.675802", ...
0.0
-1
Test changing Elgato Light State with invalid values.
async def test_change_state_errors(state, message): elgato = Elgato("example.com") with pytest.raises(ElgatoError, match=message): await elgato.light(**state)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def the_changed_brightness_should_be_reflected_in_the_state_10():\n assert web_app.get_state()\n assert web_app.check_value_in_state(\"brightness\",\"10\")", "def the_changed_brightness_should_be_reflected_in_the_state_5():\n assert web_app.get_state()\n assert web_app.check_value_in_state(\"brightne...
[ "0.6809742", "0.66639435", "0.66344774", "0.66061795", "0.6496359", "0.6360549", "0.6340057", "0.6306056", "0.6299002", "0.62746155", "0.6260993", "0.6253095", "0.62426645", "0.62362736", "0.62243295", "0.6211078", "0.6190869", "0.6169105", "0.6162311", "0.61528707", "0.61483...
0.72896004
0
Test all AWS SGE related features. Grouped all tests in a single function so that cluster can be reused for all of them.
def test_sge(region, pcluster_config_reader, clusters_factory): scaledown_idletime = 3 max_queue_size = 5 max_slots = 4 maintain_initial_size = "false" cluster_config = pcluster_config_reader( scaledown_idletime=scaledown_idletime, max_queue_size=max_queue_size, maintain_init...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_feature_extraction_tests():\n test_feature_extraction()\n test_distributed_feature_extraction()\n test_multimodel_feature_extraction()\n test_distributed_multimodel_feature_extraction()", "def test_KGE_methods(model_name):\n testing_function(model_name)", "def test_all(test_fn):\n suc...
[ "0.68769574", "0.6050843", "0.59764224", "0.59701645", "0.5910464", "0.58170825", "0.5778389", "0.5770995", "0.570061", "0.5699018", "0.56946063", "0.56882393", "0.5659208", "0.5657952", "0.56547195", "0.5646147", "0.5645969", "0.56331563", "0.56217706", "0.5608319", "0.56032...
0.52178943
54
Initialize Legifrance client with client_id and client_secret.
def __init__(self, client_id: str, client_secret: str): self._client_id: str = client_id self._client_secret: str = client_secret self._client: OAuth2Session = _get_legifrance_client(client_id, client_secret) self._last_compute_time = time.time()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self,\n client_id,\n client_secret):\n self.__client_id = client_id\n self.__client_secret = client_secret", "def __init__(self, client_id, client_secret):\n self.client_id = client_id\n self.client_secret = client_secret\n self.toke...
[ "0.7384509", "0.7032771", "0.69361496", "0.6745765", "0.6422078", "0.63998556", "0.6372419", "0.63556576", "0.6346859", "0.62635595", "0.6213391", "0.62095", "0.6143803", "0.6129101", "0.60696596", "0.605228", "0.6049244", "0.6039157", "0.60341024", "0.6029901", "0.60164165",...
0.7158159
1
Fetches the consolidated version of a law/decree/arrete by text identifier for a specific date. If no date is provided, today's date is used.
def consult_law_decree(self, text_id: str, date: Optional[datetime] = None) -> Dict[str, Any]: self._update_client_if_necessary() return _consult_law_decree(text_id, date, self._client)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def by_date(self, date_=None):\n\n if date_ is None:\n try:\n date_ = date.fromtimestamp(\n mktime(strptime(self.date, '%Y-%m-%d'))\n )\n return self.by_date(date_)\n except (TypeError, ValueError):\n try:\n...
[ "0.5327379", "0.5118535", "0.50998086", "0.50386214", "0.501414", "0.5004253", "0.49816415", "0.49502483", "0.49380118", "0.49352133", "0.49011025", "0.47921678", "0.47635776", "0.47317624", "0.4716115", "0.47025126", "0.46872622", "0.46852967", "0.46658716", "0.4610747", "0....
0.56007445
0
Fetches the JORF version of a law/decree/arrete by text identifier.
def consult_jorf(self, text_id: str) -> Dict[str, Any]: self._update_client_if_necessary() return _consult_jorf(text_id, self._client)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_element_from_id(self, identifier):\n classification, org, rel, com = classify_id(identifier)\n if classification == id_classification.org:\n return self.get_org_question(org)\n elif classification == id_classification.rel:\n return self.get_rel_question(org, rel)\...
[ "0.49641275", "0.46501428", "0.4630191", "0.45927075", "0.4589712", "0.4521436", "0.44825307", "0.44575438", "0.44496873", "0.44368324", "0.43593493", "0.43212026", "0.43087837", "0.42987674", "0.42854863", "0.42817187", "0.42626467", "0.4260149", "0.4252432", "0.4248289", "0...
0.5531085
0
Fetches article by id
def consult_article(self, article_id: str) -> Dict[str, Any]: self._update_client_if_necessary() return _article_by_id(article_id, self._client)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def article_by_id(self, id):\n return self.es.get(index=self.index, doc_type=self.doc_type, id=id)", "def get_article_by_id(article_id):\n return Article.query.get(article_id)", "def get_article(db:Session, article_id:int):\n return db.query(ArticleModel).filter(ArticleModel.id==article_id).fi...
[ "0.78759176", "0.7567833", "0.71963876", "0.71949047", "0.70986164", "0.69430614", "0.6830546", "0.6741828", "0.6676814", "0.6666822", "0.6655588", "0.6580953", "0.6569796", "0.65317386", "0.65252817", "0.65047145", "0.64999455", "0.64910865", "0.6478443", "0.64600855", "0.64...
0.6894055
6
Gets an object from S3.
def get(self, key): return s3.Object(self.bucket.name, key).get()['Body'].read()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_s3_object(self, s3_path):\n bucket_name, key = S3Util.get_bucket_and_key(s3_path)\n return self.s3_resource.Object(bucket_name, key)", "def get_s3_object(self, key):\n try:\n bucket_name = app.config['S3_BUCKET_NAME']\n s3_client = app.config['S3']\n ...
[ "0.8539686", "0.8165444", "0.7961786", "0.7722801", "0.7547169", "0.74239224", "0.74183124", "0.73820263", "0.731202", "0.71821254", "0.7147931", "0.7108089", "0.71075475", "0.70903015", "0.7077998", "0.7044556", "0.7038838", "0.701147", "0.7006739", "0.698413", "0.698143", ...
0.7761224
3