query
stringlengths
10
2k
document
stringlengths
20
51.2k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Get the file's title from it's filename Returns str The file's title or filename without extension
def get_title(self): if self.title: return self.title path = self.get_path() if str(path) == "": Settings.err_print("missing file title") return "" title, ext = os.path.splitext(path) self.ext = ext self.title = "{}{}".format(os.path.basename(tit...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def file_title(self):\n basename = os.path.basename(self.__path)\n index_dot = basename.rfind(\".\")\n if index_dot == 0:\n return basename[1:]\n return basename if index_dot < 0 else basename[:index_dot]", "def get_title(f):\n return os.path.basename(f)", "def _ti...
[ "0.85270035", "0.8106531", "0.7841243", "0.7561341", "0.75493515", "0.75156236", "0.7415955", "0.73922175", "0.728514", "0.7254932", "0.7237261", "0.71792877", "0.7170418", "0.7145408", "0.7138128", "0.7096436", "0.70645815", "0.70355225", "0.7027177", "0.7021833", "0.7011798...
0.82522774
1
A user is able to see only your own Reviews.
def test_get_all_reviews_user_1_review(self): # Get the User's Auth Token. url = '/api-token-auth/' data = {'username': 'adam', 'password': '123'} response = Client().post(url, data) content = json.loads(response.content) user_token = content['token'] # Prepare t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_view(self, user):\r\n return True", "def can_be_viewed_by(self,user):\n return True", "def is_review_permitted(self, user):\n if user.is_authenticated or settings.OSCAR_ALLOW_ANON_REVIEWS:\n return not self.has_review_by(user)\n else:\n return False", ...
[ "0.696665", "0.68822646", "0.68026716", "0.64058536", "0.6339557", "0.6231918", "0.62074375", "0.6193986", "0.6167242", "0.61603075", "0.61420053", "0.61081815", "0.59642303", "0.59347665", "0.5929876", "0.58836985", "0.58709574", "0.58615035", "0.58590317", "0.5828781", "0.5...
0.0
-1
A user is able to see only your own Reviews.
def test_get_all_reviews_user_2_reviews(self): # Get the User's Auth Token. url = '/api-token-auth/' data = {'username': 'carlos', 'password': '123'} response = Client().post(url, data) content = json.loads(response.content) user_token = content['token'] # Prepar...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_view(self, user):\r\n return True", "def can_be_viewed_by(self,user):\n return True", "def is_review_permitted(self, user):\n if user.is_authenticated or settings.OSCAR_ALLOW_ANON_REVIEWS:\n return not self.has_review_by(user)\n else:\n return False", ...
[ "0.6967567", "0.68833977", "0.68021643", "0.6405899", "0.634047", "0.6232425", "0.6208988", "0.6192835", "0.61677784", "0.6161476", "0.6142264", "0.61091983", "0.59644604", "0.5935641", "0.5929832", "0.5883609", "0.5871787", "0.5862439", "0.58608764", "0.5828405", "0.5810102"...
0.0
-1
A user is able to see only your own Reviews.
def test_get_all_reviews_user_0_reviews(self): # Get the User's Auth Token. url = '/api-token-auth/' data = {'username': 'mary', 'password': '123'} response = Client().post(url, data) content = json.loads(response.content) user_token = content['token'] # Prepare ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_view(self, user):\r\n return True", "def can_be_viewed_by(self,user):\n return True", "def is_review_permitted(self, user):\n if user.is_authenticated or settings.OSCAR_ALLOW_ANON_REVIEWS:\n return not self.has_review_by(user)\n else:\n return False", ...
[ "0.6967567", "0.68833977", "0.68021643", "0.6405899", "0.634047", "0.6232425", "0.6208988", "0.6192835", "0.61677784", "0.6161476", "0.6142264", "0.61091983", "0.59644604", "0.5935641", "0.5929832", "0.5883609", "0.5871787", "0.5862439", "0.58608764", "0.5828405", "0.5810102"...
0.0
-1
This method destroys the test tables
def tearDown(self): InitializeDb('TEST_DATABASE_URI').drop_tables()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tearDown(self):\n\n # Remove all tables from test db\n db.session.remove()\n db.drop_all()", "def tearDown(self):\n QuestionerDB.destroy_tables()", "def tearDown(self):\n self.database.truncate_all_tables()", "def tearDown(self):\n drop_all_tables()\n crea...
[ "0.8365615", "0.822596", "0.82186544", "0.8148653", "0.8015203", "0.8011667", "0.7974169", "0.7974169", "0.7963355", "0.7943867", "0.79231477", "0.7923067", "0.79141307", "0.79002464", "0.7871275", "0.7871275", "0.7871275", "0.7871275", "0.7871275", "0.7850591", "0.7847009", ...
0.8222104
2
Returns the absolute path to the top of the Blink directory.
def _blink_base(self): module_path = self._filesystem.path_to_module(self.__module__) tools_index = module_path.rfind('tools') assert tools_index != -1, 'could not find location of this checkout from %s' % module_path return self._filesystem.normpath(module_path[0:tools_index - 1])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getRootPath():\n return '/'.join(__file__.split('/')[:-4]) # Path of this file with pagebot/__init__.py(c) removed.", "def get_path() -> str:\n return os.path.dirname(os.path.realpath(__file__))", "def get_root_abs_path() -> pathlib.Path:\n return PathManager._ROOT", "def root_dir():\r\n ...
[ "0.71005297", "0.6808198", "0.66513723", "0.66281736", "0.66248", "0.6610364", "0.6508273", "0.6457233", "0.64514893", "0.641951", "0.641951", "0.64085084", "0.6397865", "0.63950807", "0.6394845", "0.6341603", "0.63409376", "0.63325405", "0.6320651", "0.63113993", "0.6295845"...
0.6765114
2
Function to convert a date in a string format into a datetime YYYY/MM/DD.
def convert_str_to_date(date: str): try: return datetime.strptime(date, "%Y/%m/%d").date() except ValueError: try: return datetime.strptime(date, "%Y-%m-%d").date() except ValueError as error: raise error
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def str2date(date):\n return datetime.datetime.strptime(date, \"%m/%d/%Y\").date()", "def convert_date(date_str):\n return datetime.strptime(date_str, \"%d/%m/%Y\")", "def str_2_date(str_date):\n str_format = \"%m/%d/%y\"\n return datetime.strptime(str_date, str_format)", "def datemake(datestring...
[ "0.8262519", "0.821634", "0.81823945", "0.8073552", "0.77613103", "0.76111436", "0.76068413", "0.74898297", "0.7397662", "0.7392983", "0.73535097", "0.7288793", "0.72769505", "0.72687507", "0.72312564", "0.722656", "0.7225468", "0.7218194", "0.71986306", "0.7191751", "0.71864...
0.78208685
4
Returns a combined list of RGB colors from sampled map slices
def get_combined_palette(self, palette_size, sampling_map_size): print("==|Generating Palette|==") sample_raw_size = self.get_tile_size(sampling_map_size, show_info="Sample Tiles") tiles = self.slice_to_tiles(tile_raw_size=sample_raw_size, show_info="Palette Sample") temp_path = Path('te...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_colors(self, palette, colors):\n return [palette[i:i + 3] for i in range(0, colors * 3, 3)]", "def get_colors(color_map, count):\n cols = plt.get_cmap(color_map, count + 1) # +1 to prevent wrapping, where col 0 is same as col -1\n cols = cols(range(count + 1)).tolist() # Create a list of c...
[ "0.70793307", "0.69510067", "0.660042", "0.6558808", "0.6461439", "0.64456874", "0.6429963", "0.6349161", "0.63420326", "0.6336081", "0.6234905", "0.62121415", "0.618692", "0.6183491", "0.61688673", "0.61685663", "0.61600417", "0.6141504", "0.614113", "0.60967", "0.6093607", ...
0.6144069
17
This function calculates the cdf of multidimensional pdf
def multidim_cumsum(a): out = a.cumsum(-1) for i in range(2, a.ndim+1): np.cumsum(out, axis=-i, out=out) return out
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pmf2cdf(pdf: np.ndarray) -> np.ndarray:\n\n cdf = np.cumsum(pdf)\n return cdf / cdf[-1]", "def pdf_from_cdf(data, idx, what):\n\n cdf = data[what + '_sum'].cumsum() / data[what + '_sum'].sum()\n cdfi = scipy.interpolate.interp1d(cdf.index, cdf, 'linear', bounds_error=False)(idx)\n pdfi = np.hs...
[ "0.7142917", "0.65834635", "0.6485841", "0.6385388", "0.6331824", "0.6286102", "0.62828165", "0.6254222", "0.62504166", "0.619682", "0.6183351", "0.6170187", "0.61612415", "0.6139738", "0.61328447", "0.61328447", "0.60849357", "0.6055629", "0.603719", "0.6025926", "0.59998477...
0.0
-1
Computes Mel Frequency Cepstrum Coefficients.
def mfcc(samples, winlen=400, winshift=200, preempcoeff=0.97, nfft=512, nceps=13, samplingrate=20000, liftercoeff=22): frames = enframe(samples, winlen, winshift) preemph = preemp(frames, preempcoeff) windowed = windowing(preemph) spec = powerSpectrum(windowed, nfft) mspec = logMelSpectrum(spec, sam...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cdf(weights):\r\n\treturn np.cumsum(weights) / sum(weights)", "def coefficient(self) -> float:\n ...", "def mfcc(signal,samplerate=16000,winlen=0.025,winstep=0.01,numcep=13,\n nfilt=23,nfft=512,lowfreq=20,highfreq=None,dither=1.0,remove_dc_offset=True,preemph=0.97,\n ceplifter=22,use...
[ "0.6328272", "0.62782675", "0.6062686", "0.60540813", "0.5983977", "0.5907479", "0.590178", "0.5866188", "0.5864804", "0.5861641", "0.58088684", "0.57848746", "0.5764189", "0.5749957", "0.57423687", "0.57259506", "0.5719117", "0.56868285", "0.5678846", "0.5676854", "0.5676739...
0.5593045
36
Implement the softmax function here. Remember to take care of the overflow condition.
def softmax(x): max_val = np.amax(x) numerator = np.exp(x-max_val) denominator = np.sum(numerator, axis=1).reshape((numerator.shape[0],1)) return numerator/denominator #raise NotImplementedError("Softmax not implemented")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def softmax(x):\n #pass # TODO: Compute and return softmax(x)\n return np.exp(x) / np.sum(np.exp(x), axis=0)", "def softmax(x):\n pass # TODO: Compute and return softmax(x)\n\n exp_x = np.exp(x)\n sum_x = np.sum(exp_x, axis=0)\n softmax = exp_x/sum_x\n \n return softmax", "def softmax(x)...
[ "0.8524865", "0.8479125", "0.84255785", "0.83729947", "0.8351216", "0.8338315", "0.83183265", "0.83183265", "0.8306144", "0.8299594", "0.8293157", "0.8289965", "0.82797647", "0.82715756", "0.82715756", "0.82715756", "0.82715756", "0.82715756", "0.82715756", "0.82715756", "0.8...
0.0
-1
Implement the sigmoid activation here.
def sigmoid(self, x): y = 1/(1 + np.exp((-x))) return y raise NotImplementedError("Sigmoid not implemented")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def activation_sigmoid_custom(self):\n self.value = 1 / (1 + np.e ** (-4.9 * self.value))", "def activation_sigmoid(self):\n self.value = 1 / (1 + np.e ** (-self.value))", "def sigmoid(X,W,b):\n preActivation = np.dot(X, W) + b\n return (1.0)/(1.0 + np.exp(-preActivation))", "def sigmoid_...
[ "0.8432057", "0.83801156", "0.81539214", "0.8104509", "0.7961734", "0.79450077", "0.7938365", "0.7938365", "0.79009974", "0.7880128", "0.78781825", "0.78656334", "0.78448844", "0.7843101", "0.7842134", "0.78332436", "0.78329337", "0.7832812", "0.78252167", "0.7825107", "0.782...
0.7807936
28
Return the Wigner rotation matrix given Euler angles `alpha` and `gamma`. The angle of rotation, `phi`, may also be provided. If it is not, returns a matrix whose entries are vectors in the Wigner basis sin(phi/2)^{2l i} cos(phi/2)^i which can be exploited to integrate `R` analytically.
def R( ydeg, phi=None, cos_alpha=0, sin_alpha=1, cos_gamma=0, sin_gamma=-1, tol=1e-12, ): if phi is not None: return _R_num( ydeg, phi, cos_alpha=cos_alpha, sin_alpha=sin_alpha, cos_gamma=cos_gamma, sin_gamma...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_rotation_matrix(phi: float, the: float, psi: float) -> np.matrix:\n # Transfer the angle to Euclidean\n phi = -float(phi) * np.pi / 180.0\n the = -float(the) * np.pi / 180.0\n psi = -float(psi) * np.pi / 180.0\n sin_alpha = np.sin(phi)\n cos_alpha = np.cos(phi)\n sin_beta = np.sin...
[ "0.68278587", "0.660923", "0.6587761", "0.6215881", "0.61423945", "0.60392416", "0.60303485", "0.59484035", "0.59403", "0.5931113", "0.5926389", "0.5919424", "0.59154016", "0.59100014", "0.590851", "0.58949083", "0.5889342", "0.58883476", "0.58784574", "0.5862527", "0.5860116...
0.5606886
33
Build a __dense_block where the output of each __conv_block is fed to subsequent ones Arguments
def __dense_block(self, x, stage, nb_layers, nb_filter, growth_rate, dropout_rate=None, weight_decay=1e-4, grow_nb_filters=True): eps = 1.1e-5 concat_feat = x for i in range(nb_layers): branch = i+1 x = self.__conv_block(concat_feat, stage, branch, growth_rate, dropout_rate, weight_decay) concat_feat =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dense_block(x, filters: int, a=0.01, dr=0.05, depth=4):\n for _ in range(depth):\n xn = conv_block(x, filters, a, dr)\n x = Concatenate(axis=-1)([x, xn])\n\n return x", "def _build(self, *args, **kwargs):\n num_targets = self.get('num_targets', self.config)\n dropout_rate = ...
[ "0.6657471", "0.6608941", "0.6596523", "0.6574227", "0.6535581", "0.64698917", "0.643373", "0.64266515", "0.64041084", "0.63389003", "0.6322264", "0.6308268", "0.6303574", "0.6303574", "0.6288737", "0.62669325", "0.6259522", "0.62577397", "0.6246465", "0.62402886", "0.6237121...
0.6671253
0
Layer normalize the tensor x, averaging over the last dimension.
def layer_norm(x, filters=None, epsilon=1e-6, scope=None, reuse=None): regularizer = tf.contrib.layers.l2_regularizer(scale = 3e-7) if filters is None: filters = x.get_shape()[-1] with tf.variable_scope(scope, default_name="layer_norm", values=[x], reuse=reuse): scale = tf.get_variable(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize(self, x, train=True):\n if train is not None:\n mean, variance = tf.nn.moments(x, [0,1,2])\n assign_mean = self.mean.assign(mean)\n assign_variance = self.variance.assign(variance)\n with tf.control_dependencies([assign_mean, assign_variance]):\n return tf.nn.batch_norm_...
[ "0.7025246", "0.7000931", "0.69984037", "0.6946193", "0.6926463", "0.6913268", "0.6907985", "0.68715054", "0.6863467", "0.6787572", "0.6776529", "0.67483455", "0.6723166", "0.6712802", "0.6702004", "0.66976094", "0.6691674", "0.66691875", "0.6619964", "0.6619837", "0.65780723...
0.0
-1
Reshape x so that the last dimension becomes two dimensions. The first of these two dimensions is n.
def split_last_dimension(x, n): old_shape = x.get_shape().dims last = old_shape[-1] new_shape = old_shape[:-1] + [n] + [last // n if last else None] ret = tf.reshape(x, tf.concat([tf.shape(x)[:-1], [n, -1]], 0)) ret.set_shape(new_shape) return tf.transpose(ret,[0,2,1,3])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_last_dim(self, x, n):\n old_shape = list(x.size())\n last = old_shape[-1]\n new_shape = old_shape[:-1] + [n] + [last // n if last else None]\n ret = x.view(new_shape)\n return ret.permute(0, 2, 1, 3)", "def split_last_dim(self, x, n):\n old_shape = list(x.size(...
[ "0.74946404", "0.74946404", "0.74946404", "0.73020244", "0.7280611", "0.7202338", "0.71383685", "0.7065397", "0.70424783", "0.69664395", "0.6925465", "0.6821332", "0.65621865", "0.6520704", "0.6497828", "0.64708275", "0.6422941", "0.63602656", "0.6279762", "0.62483484", "0.62...
0.72741413
5
Reshape x so that the last two dimension become one.
def combine_last_two_dimensions(x): old_shape = x.get_shape().dims a, b = old_shape[-2:] new_shape = old_shape[:-2] + [a * b if a and b else None] ret = tf.reshape(x, tf.concat([tf.shape(x)[:-2], [-1]], 0)) ret.set_shape(new_shape) return ret
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flatten(x):\n return reshape(x, (x.shape[0], -1))", "def reshape(x, shape):\n return Reshape(shape)(x)", "def _reshape_channels(x):\n assert x.dim() == 4\n batch_size, nc, h, w = x.size()\n x_t = x.view(batch_size, nc, -1).transpose(1, 2).contiguous()\n x_t = x_t.view(batc...
[ "0.7625156", "0.73639303", "0.73568356", "0.7354795", "0.7213243", "0.71526986", "0.7027912", "0.6971893", "0.69291925", "0.69090563", "0.6782256", "0.6774319", "0.6704276", "0.66897327", "0.66897327", "0.66504353", "0.6635763", "0.660998", "0.65902555", "0.6565449", "0.65606...
0.671809
12
To get the last hidden layer form a dynamically unrolled RNN. Input of shape (batch_size, max_seq_length, hidden_dim).
def last_output(output, true_length): max_length = int(output.get_shape()[1]) length_mask = tf.expand_dims(tf.one_hot(true_length-1, max_length, on_value=1., off_value=0.), -1) last_output = tf.reduce_sum(tf.multiply(output, length_mask), 1) return last_output
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_last_hidden_state(hidden_state):\n seq_len, hidden_size = hidden_state.size()\n assert hidden_size % 2 == 0\n split_point = hidden_size // 2\n last_hidden_state = torch.cat(\n [hidden_state[-1, :split_point], hidden_state[0, split_point:]], dim=0\n )\n return last_hidden_state"...
[ "0.73724943", "0.6424089", "0.6366455", "0.6330447", "0.6142304", "0.6125732", "0.6125732", "0.6124933", "0.6124933", "0.61118793", "0.6083285", "0.60757357", "0.60285467", "0.5998704", "0.5949351", "0.5943115", "0.5936098", "0.5929445", "0.5921272", "0.5921201", "0.59207284"...
0.6084499
10
Used to calculcate a softmax score with true sequence length (without padding), rather than maxsequence length.
def masked_softmax(scores, mask): numerator = tf.exp(tf.subtract(scores, tf.reduce_max(scores, 1, keep_dims=True))) * mask denominator = tf.reduce_sum(numerator, 1, keep_dims=True) weights = tf.div(numerator, denominator) return weights
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def softmax(self, scores):\n\n\n # for each sample, for each class ,caclulate\n # np.exp(scores) : still (n_samples, n_classes)\n\n # axis = 1\n # a00, a01, a02 as a sinlge one to perfrom np_sum\n # which is the same sample \n # sum_exp : still (n_samples, 1)\n\n # ...
[ "0.6579787", "0.6444217", "0.64197344", "0.64126873", "0.6380236", "0.63542855", "0.62734705", "0.61215335", "0.61101156", "0.6075225", "0.6066392", "0.6039287", "0.6039287", "0.60339266", "0.60176617", "0.60012525", "0.59999925", "0.5996649", "0.59958255", "0.5993504", "0.59...
0.0
-1
compute the kldivergence between 2 logits vector p and q, default returns a scalar
def compute_KL_divergence_from_logits(logits_p, logits_q, mask): #suppose p and q are both tensors with shape [batch, seq_len, #class] #suppose mask is a tensor with shape [batch, seq_len] p = tf.nn.softmax(logits_p) q = tf.nn.softmax(logits_q) mask = tf.expand_dims(mask, -1) total_kl = ma...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def kl_divergence(p, q):\n p = np.asarray(p, dtype=np.float)\n q = np.asarray(q, dtype=np.float)\n\n # Add error message when p==0\n return np.sum(np.where(p != 0, p * np.log(p / q), 0))", "def kl_divergence(self, logits_q, logits_p):\n return (torch.exp(logits_q) * (logits_q - logits_p)).sum(...
[ "0.8792921", "0.87113464", "0.8643858", "0.837638", "0.81340533", "0.8092953", "0.8058118", "0.80392987", "0.79317486", "0.7864795", "0.7619187", "0.75592035", "0.74859196", "0.744151", "0.74145067", "0.73683876", "0.7357911", "0.73411596", "0.7304224", "0.7302556", "0.726973...
0.7756917
10
a simplified implementation of selfattention block without layer dropout
def simple_self_attention_block(inputs, num_filters, seq_len, mask = None, num_heads = 3, scope = "self_attention_ffn", reuse=None, is_training = True, bias = True, dropout = 0.0): norm_fn = layer_norm with tf.variable_scope(scope, reuse = reuse): outputs = norm_fn(inputs, scope = "layer_norm_1...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def self_attention(self, hidden):\n mul1 = self.attention1(hidden)\n mul2 = self.attention2(mul1)\n return self.softmax(mul2)", "def _add_bert_self_attention_layer(model_1, model_2):\n\n class Config:\n pass\n\n config = Config()\n config.hidden_size = model_1.all_head_size +...
[ "0.70018864", "0.6639154", "0.65501106", "0.6532801", "0.6433585", "0.63334566", "0.61249757", "0.6036679", "0.5989038", "0.5967901", "0.59566945", "0.5956206", "0.59173185", "0.58982813", "0.5863495", "0.585786", "0.5842614", "0.57834417", "0.57821155", "0.57791114", "0.5763...
0.65331113
3
Add headers to both force latest IE rendering engine or Chrome Frame, and also to cache the rendered page for 10 minutes.
def add_header(response): response.headers['X-UA-Compatible'] = 'IE=Edge,chrome=1' response.headers['Cache-Control'] = 'public, max-age=0' return response
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_header(response):\n response.headers['X-UA-Compatible'] = 'IE=Edge,chrome=1'\n response.headers['Cache-Control'] = 'public, max-age=60'\n return response", "def add_header(response):\n response.headers['X-UA-Compatible'] = 'IE=Edge,chrome=1'\n response.headers['Cache-Control'] = 'public, m...
[ "0.8221727", "0.8220911", "0.8220911", "0.8220911", "0.8220911", "0.81940746", "0.81111443", "0.80852413", "0.79712725", "0.78637785", "0.7659569", "0.72363365", "0.71586627", "0.71513546", "0.71513546", "0.71502376", "0.71502376", "0.7140211", "0.7135492", "0.7126684", "0.71...
0.8161616
18
GET request for room overview view.
def get(self, request, **kwargs): player = get_player_from_request(request) if player is None or player.room is not None: return redirect("rooms:redirect") rooms = Room.objects.all() return render(request, self.template_name, {"rooms": rooms})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def room_detail(request, room_id):\n room = get_object_or_404(Room, pk=room_id)\n template = 'rooms/room_detail.html'\n context = {\n 'room': room,\n }\n return render(request, template, context)", "def get(self):\n join = request.args.get('join')\n limit = request.args.get('l...
[ "0.6298131", "0.6296462", "0.608264", "0.60493356", "0.60431623", "0.5956184", "0.59289235", "0.5870579", "0.5859273", "0.57993245", "0.5750409", "0.5739564", "0.57341796", "0.5669755", "0.5659692", "0.5629116", "0.56098276", "0.55502033", "0.55199814", "0.5497462", "0.549131...
0.6402129
0
Return the build type string.
def build_type(self): return self._build_type
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_type(self) -> pulumi.Output['outputs.BuildTypeResponse']:\n return pulumi.get(self, \"build_type\")", "def build_type(self) -> Optional[pulumi.Input['BuildTypeArgs']]:\n return pulumi.get(self, \"build_type\")", "def getTypeString(self):\n return '_'.join(self.types)", "def get...
[ "0.7744098", "0.7654816", "0.73755527", "0.7257609", "0.7245159", "0.72408867", "0.7171913", "0.71455926", "0.71106666", "0.71106666", "0.71082574", "0.70370835", "0.70076275", "0.7004867", "0.6993871", "0.69705564", "0.69705564", "0.69705564", "0.69553334", "0.68788946", "0....
0.7819608
0
Convert a git tag into a semantic version string. i.e. R4.1 becomes 4.1.0. A leading 'r' or 'v' is optional on the tag.
def tag_to_version(tag): components = [] if tag is not None: if tag.lower().startswith('r') or tag.lower().startswith('v'): tag = tag[1:] components = tag.split('.') major = '0' minor = '0' patch = '0' try: major = components[0] minor = components[1] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_version_tag(self, version: str) -> str:\n return version", "def get_version_string():\n major, minor, micro, patch, tag, relnum, is_release = VERSION\n\n version = '%s.%s' % (major, minor)\n\n if micro or patch:\n version += '.%s' % micro\n\n if patch:\n version +...
[ "0.6628933", "0.6514775", "0.64474803", "0.6350046", "0.63145506", "0.63077223", "0.62216616", "0.61740255", "0.61352396", "0.6117192", "0.60884625", "0.60635966", "0.6060489", "0.60588706", "0.6027797", "0.60146207", "0.6002229", "0.59903055", "0.59118927", "0.58876795", "0....
0.8383206
0
Waits for a spot to free in the queue of processes, and when one finished, the pending one is appended to the list and started.
def start_processing(self, task, task_name, ignore_SIGINT=False) -> None: self.poll_process_done() print(definitions.PRINT_CODES[0] + blue("Processes in queue before add: "), blue(len(self.process_queue))) def preexec_function(): signal.signal(signal.SIGINT, signal.SIG_IGN) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def populatereadyqueue():\n readyQueue.put(Process(\"P1\", time(0, 0, 1), time(0, 0, 4)))\n readyQueue.put(Process(\"P2\", time(0, 0, 2), time(0, 0, 6)))\n readyQueue.put(Process(\"P3\", time(0, 0, 3), time(0, 0, 2)))", "def _wait_queue(self):\n while True:\n time.sleep(0.1)\n if self.queue...
[ "0.66952586", "0.6522352", "0.6500348", "0.6486177", "0.63698393", "0.61450535", "0.6052626", "0.60034055", "0.5967725", "0.5907091", "0.589684", "0.5893755", "0.5893755", "0.5883861", "0.5881638", "0.5881638", "0.5871393", "0.5867457", "0.58605033", "0.5846529", "0.57893276"...
0.0
-1
Gets the parallel_encodings of this KubernetesClusterConfiguration. Number of parallel scheduled encodings on the Kubernetes cluster (required)
def parallel_encodings(self): # type: () -> int return self._parallel_encodings
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parallel_encodings(self, parallel_encodings):\n # type: (int) -> None\n\n if parallel_encodings is not None:\n if not isinstance(parallel_encodings, int):\n raise TypeError(\"Invalid type for `parallel_encodings`, type has to be `int`\")\n\n self._parallel_encodin...
[ "0.63696164", "0.63055515", "0.57519925", "0.57072", "0.55878", "0.5424524", "0.53042793", "0.5243902", "0.52257377", "0.5142923", "0.5141737", "0.51326036", "0.5132365", "0.5104244", "0.5103577", "0.5092581", "0.50842184", "0.5065174", "0.50526625", "0.50363475", "0.5026686"...
0.8035924
0
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, KubernetesClusterConfiguration): return False return self.__dict__ == other.__dict__
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False", "def __eq__(self, other):\n if i...
[ "0.8088132", "0.8088132", "0.8054589", "0.7982687", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", ...
0.0
-1
Returns true if both objects are not equal
def __ne__(self, other): return not self == other
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True", "def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)", "def __ne__(self, other) -> bool:\n return not self.__eq__(other)", "def __eq__(self, other):\n ...
[ "0.84564555", "0.8391999", "0.8144653", "0.81410354", "0.81326365", "0.8094085", "0.80921024", "0.80921024", "0.80921024", "0.8085453", "0.8085453", "0.807646", "0.807646", "0.806588" ]
0.0
-1
Sort a list of integer id keys in reverse order
def sort_byint(keys): keys = list(keys) def byint(a, b): try: return cmp(int(a), int(b)) except TypeError: return cmp(a, b) keys.sort(byint) keys.reverse() return keys
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_sort_ids(self):\r\n\r\n mapping = {\"1\": [\"0\", \"2\", \"5\", \"6\"],\r\n \"3\": [],\r\n \"4\": [],\r\n \"11\": [1, 2, 3, 4, 5, 6, 7, 8, 9],\r\n \"8\": [\"7\"]}\r\n\r\n self.assertEqual(sort_ids([\"1\", \"3\", \"4\", \...
[ "0.6881376", "0.6881376", "0.68337667", "0.67537796", "0.6668128", "0.65001273", "0.6408191", "0.6279599", "0.61869496", "0.61633915", "0.6128101", "0.6112799", "0.60943824", "0.60908496", "0.6089416", "0.6078244", "0.60489297", "0.6032038", "0.60188293", "0.6010052", "0.6008...
0.7025851
0
Create a coroutine that only passes along the first `n` items it receives. This raises a `ValueError` if `n >> result = [] >>> consume(taking(5)(append(result)), range(1000)) >>> assert result == list(range(5))
def taking(n): if n <= 0: raise ValueError('taking() requires a positive value.') @coroutine def gen(target): for _ in range(n): x = (yield) target.send(x) raise StopConsumption() return gen
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def take(n, seq):\n return itertools.islice(seq, n)", "def take(iterable, n):\n\n def taking(iterable_):\n for i, e in enumerate(iterable_):\n if i < n:\n yield e\n\n return taking(iterable)", "def take(n, iterable, islice=islice):\n return islice(iterable, n)", "...
[ "0.7118659", "0.6970967", "0.6964197", "0.68319297", "0.6753357", "0.6753357", "0.67000836", "0.66500825", "0.66500825", "0.6641032", "0.6410811", "0.63258356", "0.6269636", "0.6224597", "0.6207164", "0.6165607", "0.60142034", "0.59352964", "0.5932804", "0.5901318", "0.589893...
0.7426415
0
This function returns the filename in the output directory.
def __add_output_file_location(self, filename): # Return the joined path of the output directory and the filename return os.path.join(self._output_file_location, filename)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetOutputFilename(fname):\n return os.path.join(outdir, fname)", "def _make_output_path(self, filename):\n return os.path.join(self._output_directory, filename)", "def get_filename(out_dir, file_date, extension):\n return path.join(out_dir, f'CrossrefCitations_{file_date}.{extension}')", "de...
[ "0.8249299", "0.77690125", "0.77032715", "0.7632639", "0.75309914", "0.7523404", "0.7433338", "0.7414562", "0.73891205", "0.7372557", "0.7347809", "0.733226", "0.73173136", "0.7291896", "0.7289239", "0.7283097", "0.72742665", "0.72501886", "0.72208095", "0.7206597", "0.718268...
0.6590028
76
This adds serial names to the delete .csv file.
def add_delete_serial_names(self, serial_name): # Open the delete .csv file # Create the reader # Check if the serial name exists # Remove it the serial name exists input_filename = "HobowareDeleteSerial.csv" delete_serial_name = False name = str(serial_name) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_delete_serial_names(self, serial_name):\n # Open the delete .csv file\n # Open a temporary file\n # In the input file, \n # If the serial name exists, \n # Delete the row with the serial name\n input_filename = \"DeleteSerial.csv\"\n temp_filename...
[ "0.7003598", "0.6939585", "0.68332696", "0.6179419", "0.6057682", "0.6012354", "0.5906888", "0.5848974", "0.58431906", "0.5820452", "0.5700644", "0.5700644", "0.5627302", "0.562232", "0.5616109", "0.56125534", "0.5605653", "0.56050694", "0.55923116", "0.55488056", "0.55334496...
0.8196345
0
Test that we can write an updated record.
def test_write_record_update(self): fake_uuid = uuid.uuid4() # Assert connection's from_task_id is not expected connection = TaskConnectionRepository.fetch_connections_for_pipeline( self.connection1.pipeline_id )[0] self.assertNotEquals(connection.from_task_id, fake_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_update_record(self):\n pass", "def test_patch_record(self):\n pass", "def test_record_update(app_static, app_live):\n time.sleep(SLEEP_TIME)\n record = dict(app_live.get(OBJ)[0])\n update_value = \"0.00\" if record[UPDATE_KEY] != \"0.00\" else \"1.00\"\n data = {\"id\": recor...
[ "0.8776097", "0.7616486", "0.75694555", "0.7545615", "0.7331891", "0.7331891", "0.7331891", "0.7203256", "0.71912897", "0.7171017", "0.7024771", "0.69617873", "0.6961685", "0.69527316", "0.6916652", "0.69068664", "0.6896513", "0.6854713", "0.6853661", "0.6846648", "0.68441796...
0.73799026
4
Convert the data held in this object to a structure (eg, struct) that represents all the data elements. This method is used to recursively convert the object into a selfdocumenting form that can easily be used for various purposes, including diffs and queries. These structures may be primitive Python types (string, int...
def to_struct(self): return {"_class": "Repository", "handle": Handle("Repository", self.handle), "gramps_id": self.gramps_id, "type": self.type.to_struct(), "name": cuni(self.name), "note_list": NoteBase.to_struct(self), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_struct(self):\n return parsers.to_struct(self)", "def _decode_struct(\n data_type, obj, alias_validators, strict, old_style, for_msgpack):\n if obj is None and data_type.has_default():\n return data_type.get_default()\n elif not isinstance(obj, dict):\n raise bv.Validatio...
[ "0.63176167", "0.62968254", "0.6070241", "0.60239774", "0.5953166", "0.5904701", "0.58804613", "0.5827879", "0.5815313", "0.5736975", "0.5719195", "0.5640114", "0.563834", "0.5638245", "0.563493", "0.5629673", "0.56166697", "0.56040037", "0.5597538", "0.5595411", "0.55895245"...
0.0
-1
Like tf.roll(), but runs on GPU as a well as CPU.
def roll( tensor: tf.Tensor, shift: Union[int, Sequence[int]], axis: Union[int, Sequence[int]], ) -> tf.Tensor: if isinstance(axis, int): axis = [axis] if isinstance(shift, int): shift = [shift] result = tensor for axis_element, shift_element in zip(axis, shift): result = _roll_once(resu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _roll_once(\n tensor: tf.Tensor,\n shift: int,\n axis: int,\n) -> tf.Tensor:\n if not shift:\n return tensor\n axis = _normalize_axis(axis, len(tensor.shape))\n slice_left = (slice(None),) * axis + (slice(-shift, None),)\n slice_right = (slice(None),) * axis + (slice(None, -shift),)\n return t...
[ "0.6455731", "0.640824", "0.5832912", "0.56033653", "0.56033653", "0.56033653", "0.56033653", "0.5522386", "0.5489812", "0.53992224", "0.5378867", "0.53412855", "0.5330457", "0.5264869", "0.5236787", "0.5202231", "0.51971227", "0.5168406", "0.51418847", "0.51247597", "0.51053...
0.6199889
2
Periodic padding along one axis.
def _pad_periodic_by_axis( tensor: tf.Tensor, padding: Sequence[int], axis: int, ) -> tf.Tensor: ndim = len(tensor.shape) axis = _normalize_axis(axis, ndim) if len(padding) != 2: raise ValueError('padding must have length 2: {}'.format(padding)) if any(pad < 0 for pad in padding): raise ValueError(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pad_periodic(\n tensor: tf.Tensor, paddings: Sequence[Sequence[int]],\n) -> tf.Tensor:\n result = tensor\n for axis, padding in enumerate(paddings):\n result = _pad_periodic_by_axis(result, padding, axis)\n return result", "def add_periodic_padding(X, pad_size):\n\tpad_size = np.array(pad_size)\n\tn...
[ "0.7350723", "0.70677024", "0.70218354", "0.6887722", "0.68106157", "0.6763197", "0.676205", "0.6735011", "0.6609661", "0.6535416", "0.6512715", "0.6503809", "0.64122325", "0.6395771", "0.6387863", "0.63477993", "0.6303524", "0.6255481", "0.6210585", "0.61701703", "0.61686623...
0.7178763
1
Periodic padding, with an API like tf.pad().
def pad_periodic( tensor: tf.Tensor, paddings: Sequence[Sequence[int]], ) -> tf.Tensor: result = tensor for axis, padding in enumerate(paddings): result = _pad_periodic_by_axis(result, padding, axis) return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def temporal_padding(x, padding=(1, 1)):\n assert len(padding) == 2\n pattern = [[0, 0], [padding[0], padding[1]], [0, 0]]\n return tf.pad(x, pattern)", "def _fixed_padding(inputs, kernel_size, *args, mode='CONSTANT', **kwargs):\n pad_total = kernel_size - 1\n pad_beg = pad_total // 2\n pad_end...
[ "0.79014826", "0.772877", "0.7648923", "0.75924057", "0.7460519", "0.74380404", "0.7415238", "0.73464036", "0.723934", "0.72134453", "0.7186332", "0.7151793", "0.7127568", "0.7121429", "0.71188825", "0.71135587", "0.7098793", "0.708807", "0.70564884", "0.7053962", "0.70303786...
0.7769186
1
Pad a tensor in preparation for a conv2d valid convolution.
def pad_periodic_2d( tensor: tf.Tensor, kernel_size: Sequence[int], shifts: Sequence[int] = (0, 0), ) -> tf.Tensor: if len(tensor.shape) != 4: raise ValueError('tensor has wrong number of dimensions: {}'.format(tensor)) paddings = paddings_for_conv2d(kernel_size, shifts) result = pad_periodic(ten...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def padding(src, min_size):\n # pad before put into convolutional layer\n src_dim = src.dim()\n if src_dim[0][1] >= min_size:\n return src\n pad_size = min_size - src_dim[0][1]\n channels = src_dim[0][2] if len(src_dim[0]) >= 3 else 1\n if pad_size == 1:\n return dy.concatenate([src, dy.zeroes((src_dim...
[ "0.6944607", "0.65842676", "0.6499104", "0.64711624", "0.64178425", "0.6393017", "0.63912714", "0.6365434", "0.63218635", "0.62973297", "0.6270427", "0.6263989", "0.62369096", "0.6213127", "0.62118363", "0.6179103", "0.6171463", "0.61606115", "0.6149715", "0.61177725", "0.610...
0.59268343
33
Create a tensor of patches for use with finite difference coefficients.
def extract_patches_2d( tensor: tf.Tensor, kernel_size: Sequence[int], shifts: Sequence[int] = (0, 0), ) -> tf.Tensor: if len(tensor.shape) == 2: added_batch = True tensor = tensor[tf.newaxis, ...] else: added_batch = False if len(tensor.shape) != 3: raise ValueError('tensor has wrong...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_patches(self, image):\n images = tf.expand_dims(image, axis=0)\n patches = tf.extract_image_patches(\n images,\n ksizes=[1, self.patch_h, self.patch_w, 1],\n strides=[1, self.strides_rows, self.strides_cols, 1],\n rates=[1, 1, 1, 1],\n ...
[ "0.67712885", "0.6671576", "0.6229056", "0.5952054", "0.5863657", "0.574355", "0.57346123", "0.5728088", "0.5691077", "0.5685363", "0.5684569", "0.56661844", "0.56631243", "0.5658356", "0.56545573", "0.56521404", "0.56215733", "0.5615032", "0.5612613", "0.55966103", "0.558011...
0.0
-1
Regrid a Tensor along all its axes.
def _regrid_tensor( tensor: tf.Tensor, definition: states.StateDefinition, factors: Tuple[int, ...], axes: Tuple[int, ...], ) -> tf.Tensor: result = tensor for factor, cell_offset, axis in zip(factors, definition.offset, axes): # TODO(shoyer): add a notion of the geometry (cell vs face variables...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def repeat_to_batch(x, batch_size):\n shape = tf.shape(x)\n rnk = tf.rank(x)\n tileshp = tf.ones([rnk - 1], dtype=tf.int32)\n tileshpfinal = tf.concat([[batch_size], tileshp], 0)\n return tf.tile(x, tileshpfinal)", "def regrid_subsample(\n tensor: TensorLike,\n factor: int,\n offset: int ...
[ "0.5994911", "0.5980859", "0.5867703", "0.5825201", "0.5709988", "0.5501772", "0.5457117", "0.53429806", "0.5280482", "0.5278021", "0.5248799", "0.52139217", "0.52139217", "0.51857877", "0.5182524", "0.51778203", "0.5159832", "0.5153073", "0.5147607", "0.5144487", "0.5120232"...
0.70859283
0
Constructor for the Sensor1 class
def __init__(self, door_closed=None, id=None, name=None): # Initialize members of the class self.door_closed = door_closed self.id = id self.name = name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self) -> None:\n self.sensor = serial.Serial(config.DEVICE)\n super().__init__()", "def __init__(self, sensor):\n self.sensor = sensor\n self.temperature = None\n self.humitidy = None\n self.update()", "def __init__(self, sensor):\n self.sensor = se...
[ "0.7407671", "0.73940104", "0.72611165", "0.7160983", "0.71385497", "0.6990198", "0.6894223", "0.68847984", "0.68847203", "0.68847203", "0.68847203", "0.68741435", "0.68637246", "0.68582463", "0.68470013", "0.67814624", "0.6748313", "0.67434806", "0.67305", "0.6718795", "0.66...
0.0
-1
Creates an instance of this model from a dictionary
def from_dictionary(cls, dictionary): if dictionary is None: return None # Extract variables from the dictionary door_closed = dictionary.get('doorClosed') id = dictionary.get('id') name = dictionary.get('name') # Return an ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_dictionary(cls,\n dictionary):\n if dictionary is None:\n return None\n\n # Extract variables from the dictionary\n id = dictionary.get('id')\n name = dictionary.get('name')\n mtype = dictionary.get('type')\n usage_bytes = diction...
[ "0.83181584", "0.8168118", "0.8168118", "0.8118749", "0.8089047", "0.79787344", "0.7949278", "0.79231393", "0.7898951", "0.78923255", "0.788838", "0.7882321", "0.7882212", "0.7876749", "0.78585315", "0.7836853", "0.7801407", "0.7801407", "0.7801407", "0.7801407", "0.7801407",...
0.746709
89
Does a little test to see if threading is worth it. Sets up a global worker queue if it's worth it. Calling init() is not required, but is generally better to do.
def init(number_of_workers=0): global _wq, _use_workers if number_of_workers: _use_workers = number_of_workers else: _use_workers = benchmark_workers() # if it is best to use zero workers, then use that. _wq = WorkerQueue(_use_workers)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, queue):\n super(Worker, self).__init__()\n self.queue = queue\n logger.debug(\"Worker thread started.\")\n self.start()", "def Initialize(self):\n self.queue_workers = [\n gevent.spawn(self._EventQueueWorker) for _ in xrange(self.num_workers)]\n self.gc...
[ "0.71653205", "0.68342614", "0.67335", "0.67064154", "0.66467917", "0.64302886", "0.64179873", "0.6359383", "0.6333682", "0.6333594", "0.63267994", "0.63182056", "0.630586", "0.63000995", "0.62923574", "0.6281853", "0.6240347", "0.6238418", "0.6223692", "0.618455", "0.618455"...
0.74457324
0
Given the current state, output the action probabilities. The input has dim=(self.state_size,). The output has dim= (self.action_size,)
def forward(self, input): return self.layers(input)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_action_probs(self, state):\n state = state.astype(np.float32)\n return self.session.run(self.action_probs,\n feed_dict={self.s_placeholder: state})", "def action_log_probs(self, state):\n dist = self.action_distribution(state)\n raw_action = dist...
[ "0.77879333", "0.76336634", "0.745568", "0.7320216", "0.73150074", "0.7175391", "0.7151032", "0.71089184", "0.7084449", "0.70040745", "0.69839925", "0.6956943", "0.6918896", "0.69159025", "0.6909668", "0.6877435", "0.687124", "0.678158", "0.6768776", "0.6764993", "0.6715941",...
0.0
-1
Return the reward of action given current state.
def get_penalty(state, action, winrate_predictor): if violate_rule(state, action): return -1 return 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_reward(\n self,\n current_state,\n action,\n next_state\n ):\n if self.__env.is_goal_state(next_state):\n return 0\n else:\n return -1", "def get_reward(self, state, action, next_state):\n assert action in self.get_possible_actions...
[ "0.8243525", "0.81764", "0.8155826", "0.8133589", "0.8122447", "0.799331", "0.78190786", "0.77679384", "0.7728548", "0.7702821", "0.7681827", "0.7681292", "0.76359135", "0.76326126", "0.75706595", "0.755938", "0.7558307", "0.7443625", "0.74349976", "0.7431407", "0.73181283", ...
0.0
-1
Tests that calling set_percentage() on an invalid percentage raises ValueError.
def test_set_invalid_string_percentage(self): with self.assertRaises(ValueError): self.feature_test.set_percentage("meow")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_positive_percentage():\n assert issubclass(type(Percentage(1)), int)\n for val in [0, 1, 2, 5, 100, 2.0, '1', '2', '25']:\n assert Percentage(val) == int(val)\n \n for val in [-2, 1.5, '-2', '0.1']:\n with pytest.raises(ValueError):\n PositiveInteger(val)", "def test...
[ "0.6974046", "0.6861399", "0.685514", "0.67189187", "0.67159706", "0.6656125", "0.65868866", "0.65575314", "0.64351165", "0.6418661", "0.6283492", "0.6238413", "0.62039804", "0.61923194", "0.6106713", "0.60753447", "0.6074279", "0.6042611", "0.60362893", "0.60320705", "0.6017...
0.8524206
0
Return a ImageNetpretrained ResNet34 model, resized.
def get_model(): # Load the pretrained model. model = torchvision.models.resnet34(pretrained=True) # Resize model for our task. model.conv1 = torch.nn.Conv2d(1, 64, kernel_size=3, stride=1, padding=1, bias=False) model.avgpool = torch.nn.AvgPool2d(2) model.fc =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resnet():\n return models.resnet152(pretrained=True)", "def resnet50(pretrained=False):\n model = ResNet(Bottleneck, [3, 4, 6, 3])\n if pretrained:\n model.load_state_dict(model_zoo.load_url(model_urls['resnet50']))\n return model", "def resnet34(pretrained=False):\n model = ResNet(Ba...
[ "0.7520531", "0.7456227", "0.7420835", "0.7317142", "0.7317142", "0.7317142", "0.7317142", "0.7295347", "0.7230314", "0.7230314", "0.7230314", "0.71967095", "0.71812594", "0.7164221", "0.7156711", "0.71513647", "0.7147296", "0.7128248", "0.6977488", "0.696137", "0.69479245", ...
0.8008716
0
Evaluate the model on the given data.
def evaluate(model, data): n_targets = 0 n_correct_predictions = 0 # Set the model on evaluatio mode. model.eval() # Create progress bar. progress_bar = tqdm.tqdm(total=len(data), unit='batch', desc='[evaluate] batch accuracy: 0.000', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluate(self, test_data):\n result = self.model.run(test_data)\n self._save_result(result)", "def evaluate(self, dataset):\n return self.model.evaluate(dataset.X_val, dataset.y_val)", "def evaluate(self, data: dataset.Dataset, batch_size: int = 32) -> Any:\n ds = data.gen_tf_datase...
[ "0.7752745", "0.75963926", "0.7432489", "0.7431978", "0.7342505", "0.7290959", "0.7036236", "0.6890727", "0.688648", "0.6869519", "0.6866746", "0.68467", "0.68306494", "0.6786916", "0.6738565", "0.6737862", "0.673585", "0.67301273", "0.6695147", "0.6673498", "0.6634779", "0...
0.69462115
7
Convert an hour number to a time string.
def _hour_to_time(num: int): return datetime.datetime.now().replace(hour=num).strftime("%-I %p")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hours_to_24h_time(hours: float) -> str:\n return (\n dt.datetime(2001, 1, 2) + dt.timedelta(hours=hours)\n ).time().isoformat()", "def task11_time_converter(num):\n if num < 0:\n raise ValueError\n hour = num // 60\n minute = num % 60\n return f'{hour}:{minute}'", "def h...
[ "0.7398881", "0.7333758", "0.72103816", "0.7094853", "0.69765925", "0.69126964", "0.68644613", "0.68084025", "0.6782675", "0.6703001", "0.6687546", "0.66461545", "0.66415226", "0.6625899", "0.6621728", "0.66071516", "0.6582608", "0.6509648", "0.650571", "0.65015376", "0.63956...
0.8543666
0
Returns the callback parameter name (string). The default uses get_json_callback_parameter to get the parameter name and reads the corresponding value in the GET request dictionary. Returns an empty string if no callback name parameter name was provided.
def get_json_callback_parameter_name(self): return self.request.GET.get(self.get_json_callback_parameter(), '')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getParameter(self, name, defaultValue):\n try:\n if self.params.has(name):\n return self.params.get(name)\n else:\n return defaultValue\n except JSONException as je:\n return defaultValue", "def get_param(name, default=''):\n ...
[ "0.655069", "0.61430717", "0.61027", "0.6069103", "0.60093504", "0.59885025", "0.5979771", "0.58413154", "0.58078384", "0.57723856", "0.57341534", "0.57251877", "0.5704197", "0.56891185", "0.56684035", "0.5652107", "0.5647669", "0.5647669", "0.56133026", "0.5599456", "0.55875...
0.8954893
0
Returns logical true if the view should filter by semester or not. This may be set by the particular URL (eg API).
def should_filter_by_semester(self): return self.kwargs.get('filter_by_semester', True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def optionally_by_semester(self, queryset):\n if self.should_filter_by_semester():\n year, month = self.get_year_and_month()\n return queryset.by_semester(year, month)\n return queryset", "def from_new_banner_api(self):\n return self.semester > \"2022A\"", "def test_g...
[ "0.7200252", "0.58567", "0.5519299", "0.53147984", "0.5309299", "0.52782255", "0.5273871", "0.527334", "0.52633184", "0.5217098", "0.5214777", "0.520608", "0.520608", "0.51869863", "0.5155259", "0.511058", "0.5103982", "0.5089047", "0.5079053", "0.50610876", "0.505513", "0....
0.8873663
0
Filters a given queryset by semester if should_filter_by_semester returns True. This is useful to allow subclasses of the view to change the default queryset behavior.
def optionally_by_semester(self, queryset): if self.should_filter_by_semester(): year, month = self.get_year_and_month() return queryset.by_semester(year, month) return queryset
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def should_filter_by_semester(self):\n return self.kwargs.get('filter_by_semester', True)", "def filter_queryset(self, request, queryset, view):\n\n username = request.query_params.get(\"shared_with\")\n\n if username:\n try:\n # The Team model extends the built-in ...
[ "0.78016067", "0.5707583", "0.54767686", "0.5278277", "0.5225021", "0.5221683", "0.51839423", "0.5121781", "0.51148456", "0.5095574", "0.50909346", "0.5078116", "0.50776625", "0.50635535", "0.5054013", "0.503732", "0.5018792", "0.5006882", "0.5006627", "0.49945918", "0.498085...
0.83708525
0
Sets the subsequent_action_type of this SubsequentAction.
def subsequent_action_type(self, subsequent_action_type): if self._configuration.client_side_validation and subsequent_action_type is None: raise ValueError("Invalid value for `subsequent_action_type`, must not be `None`") # noqa: E501 allowed_values = ["continue", "wait"] # noqa: E501 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_action_type(self, action_type):\n self.single_selection_from_kendo_dropdown(self.action_type_kendo_dropdown_locator, action_type)\n self.wait_for_ajax_spinner_load()", "def resource_type(self, resource_type):\n\n self._resource_type = resource_type", "def resource_type(self, resour...
[ "0.60909563", "0.55847025", "0.55847025", "0.55847025", "0.55847025", "0.5567574", "0.5475222", "0.5433121", "0.5433121", "0.53553236", "0.53365916", "0.5310769", "0.53030163", "0.52992076", "0.52992076", "0.52992076", "0.52992076", "0.52992076", "0.52992076", "0.52956665", "...
0.8321552
0
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, SubsequentAction): return False return self.to_dict() == other.to_dict()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False", "def __eq__(self, other):\n if i...
[ "0.8088132", "0.8088132", "0.8054589", "0.7982687", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", ...
0.0
-1
Returns true if both objects are not equal
def __ne__(self, other): if not isinstance(other, SubsequentAction): return True return self.to_dict() != other.to_dict()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True", "def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)", "def __ne__(self, other) -> bool:\n return not self.__eq__(other)", "def __eq__(self, other):\n ...
[ "0.845611", "0.8391477", "0.8144138", "0.81410587", "0.8132492", "0.8093973", "0.80920255", "0.80920255", "0.80920255", "0.8085325", "0.8085325", "0.8076365", "0.8076365", "0.8065748", "0.8042487", "0.8042487", "0.8042487", "0.8042487", "0.8042487", "0.8042487", "0.8042487", ...
0.0
-1
Test that we correctly handle failed updates.
async def test_update_update_failed( hass: HomeAssistant, hass_ws_client: Callable[[HomeAssistant], Awaitable[ClientWebSocketResponse]], ) -> None: async def mock_async_perform_update( hass: HomeAssistant, identifier: str, version: str, **kwargs, ) -> bool: raise...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_update_case(self):\n pass", "def test_update(self):\n pass", "def test_update(self):\n pass", "def test_update(self):\n pass", "def test_update(self):\n # this is tested graphically, as it is UI\n pass", "def test_update9(self):\n pass", "def te...
[ "0.7698151", "0.7555623", "0.7555623", "0.7555623", "0.74038315", "0.7300779", "0.72238475", "0.7199262", "0.71405333", "0.7115935", "0.7094564", "0.7090168", "0.7060949", "0.70283484", "0.7012493", "0.7001382", "0.69577277", "0.6956795", "0.6936533", "0.6903463", "0.69004387...
0.68699694
26
Test that we correctly handle failed updates.
async def test_update_update_failed_generic( hass: HomeAssistant, hass_ws_client: Callable[[HomeAssistant], Awaitable[ClientWebSocketResponse]], caplog: pytest.LogCaptureFixture, ) -> None: async def mock_async_perform_update( hass: HomeAssistant, identifier: str, version: str, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_update_case(self):\n pass", "def test_update(self):\n pass", "def test_update(self):\n pass", "def test_update(self):\n pass", "def test_update(self):\n # this is tested graphically, as it is UI\n pass", "def test_update9(self):\n pass", "def te...
[ "0.7698151", "0.7555623", "0.7555623", "0.7555623", "0.74038315", "0.7300779", "0.72238475", "0.7199262", "0.71405333", "0.7115935", "0.7094564", "0.7090168", "0.7060949", "0.70283484", "0.7012493", "0.7001382", "0.69577277", "0.6956795", "0.6936533", "0.6903463", "0.69004387...
0.6801393
34
Push the ``item`` onto the ``heap``.
def heappush(heap, item): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def push(self, item):\n heapq.heappush(self.heap, item)", "def push(self, item: tuple):\n self.__heap.append(item)\n self.__sift_up(self.__len__() - 1)", "def push(self, item):\n self.heap.append(self.m * item)\n self._sift_up()", "def insert(self, item):\n self.heap...
[ "0.90944177", "0.8950794", "0.88169676", "0.84293777", "0.84228855", "0.834147", "0.8212874", "0.813163", "0.7975144", "0.7719185", "0.76586336", "0.7629183", "0.7629183", "0.76128477", "0.75794315", "0.7549693", "0.75027233", "0.74606943", "0.7432327", "0.7404742", "0.740273...
0.81389236
7
Convert the list ``x`` into a heap. This is an inplace operation.
def heapify(x): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def heapify(self, l):\n if not l:\n return\n self.h = [None]\n for i in xrange(0, len(l)):\n self.push(l[i])", "def heapify(self, l):\n if not l:\n return\n self.h = [None]\n for i in xrange(0, len(l)):\n self.push(l[i])", "d...
[ "0.7190882", "0.7190882", "0.7132667", "0.70577073", "0.70189303", "0.68819296", "0.6728291", "0.6610465", "0.65268725", "0.65064824", "0.64971143", "0.6495196", "0.64860326", "0.64689493", "0.64273703", "0.6416231", "0.63753", "0.6370966", "0.6348077", "0.63422525", "0.63343...
0.81002754
0
Parse the given XML and use the document element to create a Python instance.
def CreateFromDocument (xml_text, default_namespace=None, location_base=None): if pyxb.XMLStyle_saxer != pyxb._XMLStyle: dom = pyxb.utils.domutils.StringToDOM(xml_text) return CreateFromDOM(dom.documentElement) saxer = pyxb.binding.saxer.make_parser(fallback_namespace=Namespace.fallbackNamespace...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new(cls, xml):\n return oxml.parse_xml(xml)", "def FromXML(cls, doc, element):\n return cls()", "def FromXML(cls, doc, element):\n return cls(element.text)", "def FromXML(cls, doc, element):\n return cls(element.text)", "def FromXML(cls, doc, element):\n return cls(el...
[ "0.72852814", "0.7229201", "0.72076064", "0.72076064", "0.72076064", "0.6942217", "0.69327796", "0.6916065", "0.681501", "0.681501", "0.681501", "0.6795118", "0.67863685", "0.6779175", "0.6779175", "0.6779175", "0.6779175", "0.6779175", "0.6779175", "0.6779175", "0.6771341", ...
0.6925659
8
Create a Python instance from the given DOM node. The node tag must correspond to an element declaration in this module.
def CreateFromDOM (node, default_namespace=None): if default_namespace is None: default_namespace = Namespace.fallbackNamespace() return pyxb.binding.basis.element.AnyCreateFromDOM(node, _fallback_namespace=default_namespace)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def CreateFromDOM (node, default_namespace=None):\n if default_namespace is None:\n default_namespace = Namespace.fallbackNamespace()\n return pyxb.binding.basis.element.AnyCreateFromDOM(node, default_namespace)", "def CreateFromDOM (node, default_namespace=None):\n if default_namespace is None:\...
[ "0.701177", "0.701177", "0.701177", "0.701177", "0.701177", "0.701177", "0.701177", "0.701177", "0.701177", "0.701177", "0.701177", "0.6946889", "0.67008233", "0.67008233", "0.67008233", "0.66995627", "0.666665", "0.66533023", "0.6624167", "0.6596215", "0.6587306", "0.65668...
0.6949917
13
Get the reachable block if one exists.
def getReachableBlock(self): return self._reachableBlock
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getPossiblyUnreachableBlock(self):\n return self._unreachableBlock", "def get_best_block(self) -> Block:\n assert self.indexes is not None\n block_hash = self.indexes.height.get_tip()\n block = self.get_transaction(block_hash)\n assert isinstance(block, Block)\n ...
[ "0.73572046", "0.6767149", "0.6729331", "0.6513234", "0.6512834", "0.6467023", "0.64137524", "0.63591564", "0.63328016", "0.6286904", "0.6212816", "0.6185036", "0.61674905", "0.61650103", "0.61393315", "0.6084148", "0.6053657", "0.6046049", "0.6042158", "0.6026781", "0.602089...
0.81899905
0
Initialize network weights using Xavier init (with bias 0.01)
def reset_parameters(self): self.apply(ixvr)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_weight(self):\r\n xavier_init(self.output_proj, distribution='uniform', bias=0.)", "def _init_weights(self):\n nn.init.xavier_normal_(self.out.weight)", "def initialize_weights_xavier(self):\n\t\tself.weights = [np.random.uniform(-1/sqrt(size1), 1/sqrt(size1)) for size1, size2 in zip(sel...
[ "0.8134675", "0.8126905", "0.78172004", "0.78052557", "0.7582583", "0.74870545", "0.73903245", "0.73810655", "0.73809713", "0.73809713", "0.7348969", "0.7344929", "0.7339859", "0.7328382", "0.7316756", "0.7311869", "0.7311186", "0.7300655", "0.7300655", "0.7300655", "0.728423...
0.0
-1
Initialize network weights using Xavier init (with bias 0.01)
def reset_parameters(self): self.apply(ixvr)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_weight(self):\r\n xavier_init(self.output_proj, distribution='uniform', bias=0.)", "def _init_weights(self):\n nn.init.xavier_normal_(self.out.weight)", "def initialize_weights_xavier(self):\n\t\tself.weights = [np.random.uniform(-1/sqrt(size1), 1/sqrt(size1)) for size1, size2 in zip(sel...
[ "0.8134697", "0.8126297", "0.7817752", "0.7805981", "0.75819314", "0.7485224", "0.7389764", "0.7380552", "0.7379943", "0.7379943", "0.73474073", "0.73439795", "0.733913", "0.7325943", "0.7315538", "0.73110205", "0.7309389", "0.7299991", "0.7299991", "0.7299991", "0.72836345",...
0.0
-1
Flattens a dict object into a list.
def flatten_dict(d, target='key' or 'value'): def format_nested(nested, _key=None): if _key is None: _key = key return '{}_{}'.format(_key, nested) flattened = [] target_is_key = target == 'key' for key, value in OrderedDict(sorted(d.items())).items(): # Simple case...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dict2list(d: dict) -> list:\n\n d = d if d else {}\n flattened_list = []\n for k, v in d.items():\n flattened_list.append(k)\n if isinstance(v, str):\n flattened_list.extend(v.split())\n else:\n flattened_list.append(str(v))\n\n return flattened_list", "...
[ "0.7413925", "0.7387555", "0.71809876", "0.70991117", "0.7054372", "0.7054372", "0.7005532", "0.6959152", "0.69535184", "0.6930125", "0.69086725", "0.68899304", "0.68885565", "0.67682797", "0.6752687", "0.66582024", "0.6570722", "0.65374595", "0.65222204", "0.6493028", "0.647...
0.568252
68
Reads a json file from the file system and returns the json object representation of the file. Converting mechanism is made for the notation style of the smartPunch project. If changes are made here make shure to also change the export/import function(s)!
def import_local_json_database_file(filename): # open json dataset with open(filename, 'r') as f: jsnDataset = json.load(f) return jsnDataset
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _read_json(cls, input_file):\n with open(input_file, 'rb') as f:\n return json.load(f)", "def _read_json(cls, input_file):\n with open(input_file, 'rb') as f:\n return json.load(f)", "def _read_json(cls, input_file):\n with open(input_file) as f:\n return json....
[ "0.77762234", "0.77762234", "0.7764009", "0.7764009", "0.7664302", "0.7649764", "0.7621535", "0.7596103", "0.7532043", "0.749695", "0.7488574", "0.7484123", "0.74537027", "0.7449935", "0.74341863", "0.7421221", "0.741027", "0.73763704", "0.73429006", "0.7341898", "0.7338864",...
0.0
-1
Parses a python object from a JSON string. Every Object which should be loaded needs a constuctor that doesn't need any Arguments.
def load(d): def _load(d): if isinstance(d, list): li = [] for item in d: li.append(_load(item)) return li elif isinstance(d, dict) and "type" in d: # object t = d["type"] if t == "datetime": if hasattr(dat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def json_loads(self, string: str) -> object:\n return json.loads(string)", "def from_json_string(cls, json_string: Text, check_params=False):\n lparams = json.loads(json_string)\n if check_params:\n return cls(**lparams)\n else:\n return cls.from_dict(lparams, re...
[ "0.75893193", "0.75874954", "0.73847663", "0.73038447", "0.72096467", "0.7141645", "0.70897776", "0.69934916", "0.69573027", "0.69573027", "0.68673426", "0.67982817", "0.67833555", "0.6737511", "0.6733199", "0.6710952", "0.6673139", "0.6653347", "0.664952", "0.66433716", "0.6...
0.0
-1
Import a firmata board as a config entry. This flow is triggered by `async_setup` for configured boards. This will execute for any board that does not have a config entry yet (based on entry_id). It validates a connection and then adds the entry.
async def async_step_import(self, import_config: dict[str, Any]) -> FlowResult: name = f"serial-{import_config[CONF_SERIAL_PORT]}" import_config[CONF_NAME] = name # Connect to the board to verify connection and then shutdown # If either fail then we cannot continue _LOGGER.debug...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> bool:\n if DOMAIN not in hass.data:\n hass.data[DOMAIN] = {}\n\n _LOGGER.debug(\n \"Setting up Firmata id %s, name %s, config %s\",\n config_entry.entry_id,\n config_entry.data[CONF_NAME],\n conf...
[ "0.6456605", "0.64398366", "0.6178761", "0.61589324", "0.5939511", "0.58839524", "0.56406575", "0.5600264", "0.5582196", "0.5572619", "0.55387795", "0.55276614", "0.551262", "0.5493431", "0.5444854", "0.5433133", "0.5404842", "0.540435", "0.53986657", "0.53888035", "0.5385815...
0.68190265
0
Similar to classy_vision.generic.distributed_util.gather_from_all except that it does not cut the gradients
def gather_from_all(tensor: torch.Tensor) -> torch.Tensor: if tensor.ndim == 0: # 0 dim tensors cannot be gathered. so unsqueeze tensor = tensor.unsqueeze(0) if is_distributed_training_run(): tensor, orig_device = convert_to_distributed_tensor(tensor) gathered_tensors = GatherLa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _dad_reduce_all_gather(self, act_tensor, grad_tensor, *args, **kw):\n act_gathered = [_torch.zeros_like(act_tensor) for _ in range(_dist.get_world_size())]\n grad_gathered = [_torch.zeros_like(grad_tensor) for _ in range(_dist.get_world_size())]\n\n _dist.all_gather(act_gathered, act_tenso...
[ "0.7033691", "0.6266524", "0.62544954", "0.6252149", "0.6199403", "0.6192221", "0.6173418", "0.6168397", "0.61506397", "0.5990087", "0.5986478", "0.5965882", "0.5932558", "0.59073997", "0.59073687", "0.5891313", "0.5866367", "0.58537686", "0.5843613", "0.5783673", "0.57608306...
0.65511614
1
Convert 'first_name' from bytes to string.
def resolve_first_name(obj, _): return obj.first_name.decode()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def FirstNamePayload(self):\n\t\treturn \"<firstname>%s</firstname>\" % (self.FirstName)", "def get_first_name(self) -> str:\n return self.first_name", "def first_name(self) -> str:\n return self._first_name", "def headerNameAsBytes(name):\n # type: (String) -> bytes\n if isinstance(name,...
[ "0.61611384", "0.60410094", "0.5908696", "0.5837509", "0.5822775", "0.5796808", "0.5796808", "0.5739189", "0.5739189", "0.5719792", "0.5684342", "0.5669909", "0.56455475", "0.56308067", "0.55944407", "0.55944407", "0.55944407", "0.55671906", "0.55654", "0.55569804", "0.555198...
0.71823657
0
Convert 'last_name' from bytes to string.
def resolve_last_name(obj, _): return obj.last_name.decode()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_last_name(self) -> str:\n return self.last_name", "def last_name(self) -> str:\n return self._last_name", "def LastNamePayload(self):\n\t\treturn \"<lastname>%s</lastname>\" % (self.LastName)", "def last_name():\r\n\r\n return surnames()", "def get_last_name(self):\n return ...
[ "0.6681719", "0.64722407", "0.6431481", "0.64279103", "0.6424358", "0.6341344", "0.6341344", "0.63133734", "0.629326", "0.6258184", "0.6258184", "0.6258184", "0.6258184", "0.6246556", "0.62109804", "0.6181572", "0.6178805", "0.61221796", "0.6081423", "0.6078723", "0.6063298",...
0.7392096
0
Creates a new NodeBalancer in the given Region.
def create(self, region, **kwargs): params = { "region": region.id if isinstance(region, Base) else region, } params.update(kwargs) result = self.client.post("/nodebalancers", data=params) if not "id" in result: raise UnexpectedResponseError( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(__self__,\n resource_name: str,\n args: NodeBalancerConfigArgs,\n opts: Optional[pulumi.ResourceOptions] = None):\n ...", "def create_node(self, node_cfg):\n with self.__connect_node(node_cfg) as conn:\n self._provision_node(co...
[ "0.5614717", "0.5497302", "0.54811215", "0.5468596", "0.53758484", "0.53414124", "0.52650726", "0.519032", "0.51523167", "0.51165915", "0.50643307", "0.50269973", "0.5023346", "0.49752986", "0.49441034", "0.48928002", "0.48847878", "0.4882051", "0.4870336", "0.48620906", "0.4...
0.8609491
0
Returns the connections dictionary
def get_connections(self): return self.connections
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getConnections():\n\n c = psutil.net_connections()\n connects = {}\n\n count = 0\n for connection in c:\n conn = {}\n status = connection.status\n if status == 'ESTABLISHED' or connection.status == 'CLOSE_WAIT':\n conn['status'] = status\n conn['local'] = ...
[ "0.79399544", "0.74418175", "0.7431194", "0.7392697", "0.737379", "0.7362447", "0.71881986", "0.71526724", "0.7134719", "0.703953", "0.69298923", "0.6853831", "0.6841482", "0.6684173", "0.66814363", "0.6656513", "0.66480994", "0.6635382", "0.659446", "0.656062", "0.65559924",...
0.76824564
1
Adds a new vertex to the graph
def add_vertex(self, vertex_name: n): new_vertex = Vertex(vertex_name) self._graph[new_vertex.name] = new_vertex
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_vertex(self, vertex):\n raise NotImplementedError", "def add_vertex(self, vertex_id):\n pass # TODO", "def add_vertex(self, vertex):\n if vertex.id not in self.vertices.keys():\n self.vertices[vertex.id] = vertex", "def add_vertex(self, vertex):\n self.vertices...
[ "0.86597973", "0.865018", "0.8502884", "0.83829963", "0.8229884", "0.82148147", "0.8210845", "0.8191837", "0.8107712", "0.8107712", "0.8089218", "0.8072729", "0.8011462", "0.7992569", "0.79880404", "0.7961638", "0.79415363", "0.79246783", "0.79168236", "0.79086894", "0.788801...
0.85234517
2
Adds an edge to the graph, if the vertexes containing source and destination are not present it adds them as well
def add_edge(self, source: n, destination: n, weight: w = 1.): if not self.contains_vertex(destination): self.add_vertex(destination) if not self.contains_vertex(source): self.add_vertex(source) self._graph[source].add(destination, weight) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_edge(self, source_vertex, destination_vertex):\n self.vertex_edge[source_vertex].append(destination_vertex)\n new_edge = GraphEdge(source_vertex, destination_vertex)\n if destination_vertex not in self.vertex_edge:\n self.edges.append(new_edge)", "def add_edge (self, src, ...
[ "0.8213741", "0.7736372", "0.77203834", "0.7683421", "0.75248927", "0.7516008", "0.7481358", "0.74725807", "0.74678904", "0.74190617", "0.73770815", "0.7371244", "0.73563945", "0.7339221", "0.73364645", "0.731952", "0.73119444", "0.7298949", "0.7295416", "0.7294176", "0.72587...
0.77489465
1
Returns a list of all the vertexes present in the graph
def V(self) -> list: return list(self._graph.values())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_vertices(self):\n return list(self.graph_dict.keys())", "def vertices(self):\n return list(self.__graph.values())", "def vertices(self):\n return list(self._graph)", "def vertices(self):\n return list(self.graph_dict.keys())", "def vertices(self):\r\n return list...
[ "0.85577774", "0.8467579", "0.84072846", "0.83985937", "0.8396241", "0.83685464", "0.83685464", "0.83685464", "0.83654594", "0.8019154", "0.788897", "0.7854953", "0.7841199", "0.7760846", "0.7757628", "0.77368397", "0.7688497", "0.76358175", "0.75688446", "0.7537871", "0.7467...
0.7089602
39
Get the current sensor data based on the dataset and its index
def generateTelemetry(self) -> SensorData: #a = super().generateTelemetry() #logging.info("temp data value:"+ str(a.getValue())) return super().generateTelemetry()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __getitem__(self, index):\n\n if self._data_indices is not None:\n index = self._data_indices[index]\n data = self._dataset[index]\n return data", "def __getitem__(self, index):\n return self.dataset[index]", "def getDataWithTimeIndex(self, t):\n\n return self....
[ "0.7160577", "0.70945543", "0.6963012", "0.6909007", "0.6879901", "0.6665895", "0.6634536", "0.6532112", "0.6491637", "0.64337933", "0.6428865", "0.6426649", "0.6426215", "0.63832873", "0.6361961", "0.6325438", "0.6325438", "0.6301461", "0.6298233", "0.62461025", "0.62121767"...
0.0
-1
return the residual at u
def f(self, u: np.ndarray, lmbda: float) -> np.ndarray: out = self.lap @ u - lmbda * self.mass @ np.exp(u) out[self.D] = u[self.D] return out
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def residual(us):\n return self.h_S(z0, us) - h_P", "def phy_residual(self, x, t, u, v):\n \n u_t = torch.autograd.grad(\n u, t, \n grad_outputs=torch.ones_like(u),\n retain_graph=True,\n create_graph=True\n )[0]\n \n u_x =...
[ "0.7670767", "0.7368317", "0.68493295", "0.68214536", "0.68151", "0.68030035", "0.67941093", "0.67700744", "0.676385", "0.6703985", "0.6700995", "0.66820705", "0.6663537", "0.66563207", "0.6469329", "0.6465379", "0.64247763", "0.6385948", "0.6357091", "0.63339216", "0.6312744...
0.0
-1
The derivative of the residual with respect to the parameter. Used in EulerNewton continuation.
def df_dlmbda(self, u: np.ndarray, lmbda: float) -> np.ndarray: out = -self.mass @ np.exp(u) out[self.D] = 0.0 return out
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _derivative_(self, x, diff_param=None):\n return 2*exp(-x**2)/sqrt(pi)", "def _derivativeTerm(self):\n\n\t\treturn self._Kd * (self._getErrorFunction() - self._previousError) / self._dt", "def derivative ( self ):\n return self.__derivative", "def d_Drepp_d_par(self,par):\n sinE = np...
[ "0.7035738", "0.6826137", "0.679452", "0.6582748", "0.6545443", "0.6543227", "0.6543227", "0.6531717", "0.65181184", "0.65071195", "0.65069425", "0.6457427", "0.64012736", "0.6376166", "0.6366317", "0.63370824", "0.63173455", "0.62997544", "0.62969416", "0.62677324", "0.62511...
0.0
-1
Calculate dot product of v1 and v2
def dotproduct(v1, v2): return sum(imap(operator.mul, v1, v2))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dotProduct(v1, v2):\n n1 = normalize(v1)\n n2 = normalize(v2)\n return n1[0] * n2[0] + n1[1] * n2[1] + n1[2] * n2[2]", "def dotProduct(v1, v2):\n return sum((a * b) for a, b in zip(v1, v2))", "def dot_product(v1, v2):\n return v1[0]*v2[0] + v1[1]*v2[1] + v1[2]*v2[2]", "def dot_product(v1, ...
[ "0.9011216", "0.88046986", "0.8802928", "0.877148", "0.8390897", "0.8312007", "0.82874155", "0.8230417", "0.81541765", "0.8086629", "0.8085847", "0.8051249", "0.8047475", "0.80343944", "0.794914", "0.7899223", "0.7876424", "0.78519124", "0.78466487", "0.7813269", "0.7749119",...
0.8753282
4
Add each word to the dictionary. If exist, increment the count by 1.
def add_word(words, summary): for word in words: if word not in summary: summary[word] = 1 # If not a word exists, add the word and set value as 1 else: summary[word] += 1 # If a word exists, just increase value by 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_word_to_dict(self, word):\n\n # if the word already exist in the dict\n # we increment 1 the value\n if word in self.words_to_counts:\n self.words_to_counts[word] += 1\n\n # if the word in the dict is capitalize\n # we add the new word lower case, with the valu...
[ "0.74804264", "0.74707896", "0.74161327", "0.73735464", "0.7334063", "0.7275007", "0.72642446", "0.7224123", "0.715103", "0.715103", "0.70900035", "0.7085115", "0.70731467", "0.7065782", "0.70644194", "0.7022234", "0.7021121", "0.69922835", "0.6973806", "0.6971217", "0.696497...
0.73961014
3
Strip off various characters, split out the words, and so on
def Process_line(line, summary): line = line.lower() # lower all words in the line line = line.translate(str.maketrans('','', string.punctuation)) # Remove all punctuation words = line.split() # Split word from the line add_word(words, summary) # Add word to dictionary
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_words(s):\n\n if has_dashdash(s):\n s = myreplace(\"--\",\" \", s)\n\n s = s.lower().split()\n word_list = []\n\n for word in s:\n\n word_list.append(cleanword(word))\n\n return word_list", "def separate_words(text):\n splitter = re.compile('\\\\W*')\n return [s.low...
[ "0.72464114", "0.7114745", "0.70998925", "0.7046914", "0.70378274", "0.7028266", "0.7024242", "0.7006664", "0.69620126", "0.69620126", "0.6923457", "0.6907312", "0.688371", "0.6871506", "0.6871506", "0.68694544", "0.6859201", "0.68414587", "0.6834398", "0.6834398", "0.6834398...
0.0
-1
Plot fitted model, its 1D fit profile and residuals. If trying to convert a model to image, use `petrofit.modeling.fitting.model_to_image` instead. This function dose not call `plt.show()`.
def plot_fit(model, image, mode='center', center=None, vmin=None, vmax=None, cbar=True, fontsize=18, figsize=[18, 6], flux_label='Pixel Value'): if isinstance(image, (CCDData, Cutout2D)): image = image.data # Make Model Image # ---------------- # Set the size of the model image ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Plot_model_diagram(model, save= True):\n if save:\n keras.utils.plot_model(model, to_file= \"images/CNN_SE_model.png\")\n else:\n keras.utils.plot_model(model)", "def plot(self, filename='model.png'):\n plot_model(self.model, to_file=filename)", "def _plot_resid_vs_fitted(self, a...
[ "0.6711502", "0.6685387", "0.64594096", "0.64095724", "0.6395664", "0.63616246", "0.6351676", "0.6311594", "0.62972", "0.6295945", "0.6274349", "0.62459004", "0.62380844", "0.62373024", "0.62257826", "0.621951", "0.61952823", "0.61728215", "0.6150363", "0.61476785", "0.612197...
0.6899091
0
Generates a list with `pop_size` number of random road trips.
def generate_random_population(pop_size): random_population = [] for agent in range(pop_size): random_population.append(generate_random_agent_keys()) return random_population
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _generate_random_population(self, pop_size):\n\n random_population = []\n for agent in range(pop_size):\n random_population.append(self._generate_random_agent())\n return random_population", "def generatePopulation(self,size):\n return [ self._individual(self._individua...
[ "0.756301", "0.70111656", "0.70104223", "0.70022404", "0.68137777", "0.67444295", "0.66847694", "0.6681259", "0.66471225", "0.6549113", "0.65250474", "0.65127766", "0.64951795", "0.64607686", "0.6440732", "0.64033014", "0.6382167", "0.63558006", "0.6338012", "0.62743735", "0....
0.7596933
0
Sets the learning rate to the initial LR decayed by 10
def adjust_learning_rate_SR(optimizer, epoch): lr = opt.lr * (0.1 ** (epoch // opt.step)) return lr
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize_learning_rate(self):\n\n if (self.FLAGS.learning_rate_decay is \"exponential\"):\n self.learning_rate = tf.train.exponential_decay(\n self.FLAGS.learning_rate,\n self.global_step,\n self....
[ "0.7959039", "0.7805878", "0.7714199", "0.7714199", "0.7709345", "0.76715976", "0.76372325", "0.7587329", "0.7555862", "0.75545394", "0.753872", "0.7536499", "0.7524686", "0.7513468", "0.7500843", "0.74928516", "0.7491835", "0.74907947", "0.74510103", "0.74506384", "0.7449817...
0.0
-1
Sets the learning rate to the initial LR decayed by 10
def adjust_learning_rate_GAN(optimizer, epoch): lrD = opt.lrD * (0.1 ** (epoch // opt.step)) return lrD
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize_learning_rate(self):\n\n if (self.FLAGS.learning_rate_decay is \"exponential\"):\n self.learning_rate = tf.train.exponential_decay(\n self.FLAGS.learning_rate,\n self.global_step,\n self....
[ "0.7959039", "0.7805878", "0.7714199", "0.7714199", "0.7709345", "0.76715976", "0.76372325", "0.7587329", "0.7555862", "0.75545394", "0.753872", "0.7536499", "0.7524686", "0.7513468", "0.7500843", "0.74928516", "0.7491835", "0.74907947", "0.74510103", "0.74506384", "0.7449817...
0.0
-1
This is the property that holds the value for the duplicate rate of the 'gentle' profile. In this profile it is not necessary to specify the duplication rate or correlation because this is a good equivalent channel environment, like an optical fiber or another good quality medium, with gentle neighbors that will not re...
def duplicate(self) -> dict: return { 'probability': float(self._parser[self._key]['DuplicateChance']), 'correlation': float(self._parser[self._key]['DuplicateCorrelation']), }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_sample_rate(self):\n return 1", "def relative_rate(self):\n return _spacegrant_swig.udp_debug_sptr_relative_rate(self)", "def relative_rate(self):\n return _spacegrant_swig.ax25_udp_pdu_gen_sptr_relative_rate(self)", "def stamp_rate(self):\n raise NotImplementedError()", ...
[ "0.6002435", "0.5732419", "0.5656808", "0.558728", "0.55340004", "0.550296", "0.5483645", "0.5482716", "0.5481873", "0.54778296", "0.54732364", "0.5374955", "0.5372873", "0.53653324", "0.53060985", "0.52174246", "0.5208897", "0.51846534", "0.5178023", "0.51656103", "0.5158701...
0.59110826
1
This is the property that holds the value for the corruption rate of the 'gentle' profile. In this profile it is not necessary to specify the corruption rate or correlation because this is a good channel environment, like an optical fiber or another good quality medium. Other Parameters
def corrupt(self): return { 'probability': float(self._parser[self._key]['CorruptProbability']), 'correlation': float(self._parser[self._key]['CorruptCorrelation']), }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def relative_rate(self):\n return _spacegrant_swig.message_debug_sptr_relative_rate(self)", "def expectation(self):\n\n return self.rate", "def success_rate(self):\n success_rate_text = self.emulator.get_screen_text(ui_element=self.ui['ENHANCE_POTENTIAL_RATE'])\n success_rate = succ...
[ "0.5823396", "0.5773824", "0.5741961", "0.5729175", "0.5724383", "0.5685644", "0.56598926", "0.5618718", "0.5606316", "0.5564641", "0.5486504", "0.54822236", "0.546058", "0.544804", "0.5433389", "0.5427785", "0.5385069", "0.5370604", "0.53687316", "0.53618413", "0.53496015", ...
0.49745354
91
The number of bytes in the file.
def num_bytes(self): if self._num_bytes is None: status, info = self._resource._file.stat( timeout=(0 if self._timeout is None else self._timeout) ) if not status.ok: raise OSError( """XRootD error: {0} in file {1}""".format...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def file_size(self) -> int:\n return self.get_main_information()['FileSize']", "def file_size():\n return os.path.getsize(FILE_NAME)", "def file_size(self):\n return self._fileSize", "def _filelength(self):\r\n with open(self.fileName, 'rb') as f:\r\n f.seek(0, 2) # move t...
[ "0.8193849", "0.8097815", "0.8095197", "0.8090032", "0.8032161", "0.8030494", "0.8028773", "0.79909897", "0.78938264", "0.78302467", "0.7792864", "0.77148414", "0.7702475", "0.767751", "0.767493", "0.76454973", "0.7618835", "0.7613218", "0.7582886", "0.7568936", "0.7531735", ...
0.86665577
0
The number of bytes in the file.
def num_bytes(self): if self._num_bytes is None: status, info = self._resource._file.stat( timeout=(0 if self._timeout is None else self._timeout) ) if not status.ok: raise OSError( """XRootD error: {0} in file {1}""".format...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def file_size(self) -> int:\n return self.get_main_information()['FileSize']", "def file_size():\n return os.path.getsize(FILE_NAME)", "def file_size(self):\n return self._fileSize", "def _filelength(self):\r\n with open(self.fileName, 'rb') as f:\r\n f.seek(0, 2) # move t...
[ "0.8193849", "0.8097815", "0.8095197", "0.8090032", "0.8032161", "0.8030494", "0.8028773", "0.79909897", "0.78938264", "0.78302467", "0.7792864", "0.77148414", "0.7702475", "0.767751", "0.767493", "0.76454973", "0.7618835", "0.7613218", "0.7582886", "0.7568936", "0.7531735", ...
0.86665577
1
Look for text between the tags, and return it if found
def get_title(content): content = content[:100000] pa = re.compile("<title.*?>(.*?)<\/title>", re.DOTALL | re.IGNORECASE) match = re.search(pa, content) title = "" if match != None: title_found = match.group(1) title = title_found.replace("\r", "").replace("\n", "").replace("\t", " "...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_text_in_tag(st, tag):\n if tag == \"e1\":\n st = st.replace(\"<e2>\", \"\")\n st = st.replace(\"</e2>\", \"\")\n elif tag == \"e2\":\n st = st.replace(\"<e1>\", \"\")\n st = st.replace(\"</e1>\", \"\")\n\n for i in range(len(st) - (len(tag)+2) + 1): # +2 is for < and >...
[ "0.7352765", "0.6999268", "0.6839149", "0.6779017", "0.66172516", "0.65433747", "0.64483255", "0.6397277", "0.6319691", "0.6243663", "0.6086515", "0.60652447", "0.60641146", "0.6047092", "0.60266256", "0.5983833", "0.59697986", "0.5958324", "0.59434575", "0.59393406", "0.5898...
0.0
-1
Get the name of this device.
def name(self) -> str: return self._raw_result['name']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name(self):\n return self._device.name", "def name(self):\n return self._device.name", "def name(self):\n return self._device.name", "def name(self):\n return self.device.device_data[self.device_id]['name']", "def name(self):\n return f\"{get_device_name(self._data, 0...
[ "0.90619653", "0.90619653", "0.90619653", "0.901331", "0.89590377", "0.8949661", "0.89073145", "0.8542833", "0.84459203", "0.84289736", "0.8397456", "0.8332138", "0.8332138", "0.83228123", "0.824958", "0.8114453", "0.80855197", "0.80855197", "0.80741453", "0.79943174", "0.792...
0.0
-1
Get the mp4 video url of this device.
def mp4_url(self) -> str: return 'video.mp4?oid={0}'.format(self._oid)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_url(self):\n if not self.get_video_id():\n return ''\n \n return 'http://www.dailymotion.com/%s' % self.get_video_id()", "def video_stream_url(self):\n return self._video_stream_url", "def getMP4DownloadLink(self):\n context = aq_inner(self.context)\n exten...
[ "0.7341978", "0.727869", "0.7263905", "0.69841677", "0.69719684", "0.6902771", "0.6829598", "0.6829598", "0.6812388", "0.67730206", "0.6771522", "0.6703543", "0.66866213", "0.6661487", "0.66156065", "0.65955645", "0.65279937", "0.6508401", "0.6486817", "0.64403033", "0.642539...
0.8567876
0
Get the mp4 video url of this device.
def webm_url(self) -> str: return 'video.webm?oid={0}'.format(self._oid)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mp4_url(self) -> str:\n\t\treturn 'video.mp4?oid={0}'.format(self._oid)", "def get_url(self):\n if not self.get_video_id():\n return ''\n \n return 'http://www.dailymotion.com/%s' % self.get_video_id()", "def video_stream_url(self):\n return self._video_stream_url", "def g...
[ "0.8567876", "0.7341978", "0.727869", "0.7263905", "0.69841677", "0.69719684", "0.6902771", "0.6829598", "0.6829598", "0.6812388", "0.67730206", "0.6771522", "0.6703543", "0.6661487", "0.66156065", "0.65955645", "0.65279937", "0.6508401", "0.6486817", "0.64403033", "0.6425398...
0.66866213
13
Indicate if this device has PTZ capability.
def has_ptz(self) -> bool: return self._ot == 2 and self._raw_result['data']['ptzid'] != -1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def available(self) -> bool:\n return (\n self._wrap_device.device.is_duct_zone_enabled(self._zone)\n and self._wrap_device.is_power_on\n )", "def is_on(self):\n return self._wrap_device.device.get_duct_zone(self._zone)", "def satisfies_pzs(self) -> bool:\n ret...
[ "0.65179265", "0.62078243", "0.6113048", "0.6113048", "0.6113048", "0.6113048", "0.6113048", "0.6113048", "0.5944797", "0.59226155", "0.58535546", "0.58535546", "0.58535546", "0.58309865", "0.5770029", "0.5759229", "0.5758352", "0.5758352", "0.57512283", "0.5708956", "0.56820...
0.7232537
0
Get the width of the device.
def width(self) -> int: return self._raw_result['data']['width']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_width(self):\n return self.width", "def get_width ( self ):\n return self.width", "def get_width(self):\n return self.__width", "def get_width(self):\n return self._width", "def get_width(self):\n return self._width", "def get_width(self):\n return self._...
[ "0.80329585", "0.80326945", "0.8010967", "0.80066454", "0.80066454", "0.80066454", "0.80066454", "0.79643023", "0.79643023", "0.79643023", "0.79359734", "0.78945655", "0.78266245", "0.78266245", "0.7806425", "0.7795565", "0.7786337", "0.77858496", "0.7742952", "0.7742952", "0...
0.72978336
81
Get the height of the device.
def height(self) -> int: return self._raw_result['data']['height']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def height(self):\n return(self.SCREEN_H)", "def getHeight(self):\n return self.height", "def getHeight(self):\n return self.height", "def getHeight(self):\n return self._height", "def height(self):\n return self.client.call('GET', self.name + 'height')", "def height (s...
[ "0.8075958", "0.80711424", "0.80711424", "0.8068315", "0.8056694", "0.8033957", "0.8011129", "0.7992822", "0.7992822", "0.7992822", "0.7992822", "0.7954081", "0.7954081", "0.7954081", "0.7935232", "0.79273736", "0.78212976", "0.7816188", "0.77483076", "0.7727231", "0.77173877...
0.7336247
86
Get the computed stream width of the device.
def mjpegStreamWidth(self) -> int: if 'mjpegStreamWidth' in self._raw_result['data']: return self._raw_result['data']['mjpegStreamWidth'] return 640
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def width(self):\n return (self.norm / max(self.transmit)) * Unit(self.wavelength_unit)", "def width(self):\n return self._get_mean_and_samples_attribute('width')", "def get_width(self):\n return self._width", "def get_width(self):\n return self._width", "def get_width(self):\n ...
[ "0.7370297", "0.72261536", "0.7194588", "0.7194588", "0.7194588", "0.7194588", "0.71755964", "0.70969546", "0.70861286", "0.70861286", "0.70861286", "0.70746833", "0.70561874", "0.70561755", "0.69884044", "0.6968343", "0.69667697", "0.69618875", "0.69275165", "0.6919484", "0....
0.0
-1
Get the computed stream height of the device.
def mjpegStreamHeight(self) -> int: if 'mjpegStreamHeight' in self._raw_result['data']: return self._raw_result['data']['mjpegStreamHeight'] return 480
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def height(self):\n return self.client.call('GET', self.name + 'height')", "def getHeight(self):\n return self._height", "def getHeight(self):\r\n height = 1\r\n if self.orientation == \"v\":\r\n height = self.size\r\n return height", "def height(self) -> int:\n\...
[ "0.7217517", "0.7042014", "0.69488746", "0.6947199", "0.6934532", "0.6934532", "0.6929202", "0.6923142", "0.6923142", "0.6923142", "0.6923142", "0.69131863", "0.68864673", "0.6877093", "0.686294", "0.6831061", "0.68121046", "0.68121046", "0.68121046", "0.6800318", "0.6778252"...
0.6607814
61