query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Your value iteration agent should take an mdp on construction, run the indicated number of iterations and then act according to the resulting policy.
def __init__(self, mdp, discount = 0.9, iterations = 100): self.mdp = mdp self.discount = discount self.iterations = iterations self.values = util.Counter() # A Counter is a dict with default 0 "*** YOUR CODE HERE ***" # OUR CODE HERE #Note: I think we should use the util.Counter thing...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, mdp, discount = 0.9, iterations = 1000):\n ValueIterationAgent.__init__(self, mdp, discount, iterations)", "def __init__(self, mdp, discount = 0.9, iterations = 1000):\n ValueIterationAgent.__init__(self, mdp, discount, iterations)", "def __init__(self, mdp, discount = 0.9, ite...
[ "0.7559497", "0.7559497", "0.7559497", "0.7559497", "0.7559497", "0.7255983", "0.7130516", "0.6889592", "0.6889592", "0.6889592", "0.6889592", "0.6889592", "0.68525124", "0.68525124", "0.68525124", "0.68525124", "0.68525124", "0.6847414", "0.67304295", "0.6688111", "0.6649843...
0.6877906
12
Return the value of the state (computed in __init__).
def getValue(self, state): return self.values[state]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def value(self, state):\n raise NotImplementedError", "def value(self, state):\n raise NotImplementedError", "def value(self, state):\n\t\traise NotImplementedError", "def getValue(self, state):\n util.raiseNotDefined()", "def getValue(self, state):\n util.raiseNotDefined()", ...
[ "0.830136", "0.830136", "0.82602024", "0.8086008", "0.8086008", "0.7958413", "0.78017086", "0.7737145", "0.77342933", "0.7733657", "0.7733657", "0.7733657", "0.7733657", "0.7733657", "0.7733657", "0.7733657", "0.7733657", "0.7733657", "0.7733657", "0.7733657", "0.7733657", ...
0.7929993
6
The qvalue of the state action pair (after the indicated number of value iteration passes). Note that value iteration does not necessarily create this quantity and you may have to derive it on the fly.
def getQValue(self, state, action): "*** YOUR CODE HERE ***" # OUR CODE HERE #get the value of the state qVal = self.values[state] #iterate through the MDP transition states from the current state for transitionState, probability in self.mdp.getTransitionStatesAndProbs(state, action): #q v...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_Q_value(self, state, action):\n return self.Q.get((state, action), 0.0) # Return 0.0 if state-action pair does not exist", "def q_value(self, state_action):\n state, action = state_action\n hashable_state = self.represent_state(state)\n if not (hashable_state, action) in self...
[ "0.8044818", "0.8034924", "0.79408586", "0.79031444", "0.7877577", "0.786727", "0.77985466", "0.77936316", "0.7789955", "0.77891916", "0.774716", "0.7724164", "0.7708895", "0.7675049", "0.76234305", "0.75912863", "0.7588857", "0.7552034", "0.7504086", "0.74793303", "0.745265"...
0.79513013
2
The policy is the best action in the given state according to the values computed by value iteration. You may break ties any way you see fit. Note that if there are no legal actions, which is the case at the terminal state, you should return None.
def getPolicy(self, state): "*** YOUR CODE HERE ***" # OUR CODE HERE possibleActions = self.mdp.getPossibleActions(state) #checking for terminal state (no possible actions) if len(possibleActions) is 0: return None #attempt at using the Counter eValsActions = util.Counter() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def computeActionFromQValues(self, state):\n actions = self.getLegalActions(state)\n if len(actions) == 0:\n return None\n qVals = [self.getQValue(state, a) for a in actions]\n bestActions = []\n bestVal = max(qVals)\n ...
[ "0.76518464", "0.7514951", "0.750535", "0.7422988", "0.7374947", "0.7333288", "0.73329633", "0.7313349", "0.727814", "0.72609013", "0.7233381", "0.7125327", "0.70963556", "0.70804584", "0.70765764", "0.70520097", "0.7025357", "0.70238316", "0.7017081", "0.70063794", "0.700637...
0.7954697
0
Loads an image in the shape expected by other functions in this module. Doesn't Tensor it, in case you need to do further work with it.
def image_load(path) -> numpy.ndarray: # file na = numpy.array(Image.open(path)) # fix shape na = numpy.moveaxis(na, [2,0,1], [0,1,2]) # shape is now (3,h,w), add 1 na = na.reshape(1,3,na.shape[1],na.shape[2]) # change type na = na.astype("float32") / 255.0 return na
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_and_prep_image(img, img_shape=224):\n\n # Decode the read file into a tensor & ensure 3 colour channels \n # (our model is trained on images with 3 colour channels and sometimes images have 4 colour channels)\n img = tf.image.decode_image(img, channels=3)\n\n # Resize the image (to the same size our m...
[ "0.7699778", "0.74027497", "0.73622835", "0.7289454", "0.7263987", "0.7171054", "0.7155694", "0.7111653", "0.70905066", "0.70701224", "0.70668185", "0.7058207", "0.69781375", "0.6976194", "0.6969333", "0.6964644", "0.695557", "0.69107634", "0.69051933", "0.6844532", "0.681885...
0.6454209
57
Saves an image of the shape expected by other functions in this module. However, note this expects a numpy array.
def image_save(path, na: numpy.ndarray): # change type na = numpy.fmax(numpy.fmin(na * 255.0, 255), 0).astype("uint8") # shape is now (1,3,h,w), remove 1 na = na.reshape(3,na.shape[2],na.shape[3]) # fix shape na = numpy.moveaxis(na, [0,1,2], [2,0,1]) # shape is now (h,w,3) # file Image.fromarray(na).s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_img(img: np.ndarray, path: str) -> None:\n\n img_obj = Image.fromarray(img)\n img_obj.save(path)", "def save_npimg(array: np.ndarray, path: str) -> None:\r\n img = Image.fromarray(array.squeeze())\r\n img.save(path)", "def imwrite(image, path):\n\n if image.ndim == 3 and image.shape[2] ...
[ "0.7397582", "0.72214085", "0.7198307", "0.71386844", "0.71040505", "0.70708066", "0.7057253", "0.7015668", "0.698637", "0.6963281", "0.69594914", "0.68962365", "0.6883985", "0.68804735", "0.6848746", "0.6804764", "0.67976993", "0.6780601", "0.6767705", "0.6767581", "0.672906...
0.7051175
7
Loads weights from one of the waifu2x JSON files, i.e. waifu2x/models/vgg_7/art/noise0_model.json data (passed in) is assumed to be the output of json.load or some similar on such a file
def load_waifu2x_json(self, data: list): self.conv1.load_waifu2x_json(data[0]) self.conv2.load_waifu2x_json(data[1]) self.conv3.load_waifu2x_json(data[2]) self.conv4.load_waifu2x_json(data[3]) self.conv5.load_waifu2x_json(data[4]) self.conv6.load_waifu2x_json(data[5]) self.conv7.load_waifu2x...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _load_weights(self):\n self.npz_weights = np.load(self._weight_file)\n self._load_byte_embedding()\n self._load_cnn_weights()\n self._load_highway()\n self._load_projection()", "def load_weight(model):\n file = h5py.File(WEIGHT_SAVE, 'r')\n weight = []\n for i in r...
[ "0.6488443", "0.62604135", "0.61644244", "0.60816514", "0.604148", "0.6019102", "0.60177386", "0.60040563", "0.60030246", "0.5998064", "0.599155", "0.5979306", "0.59469867", "0.5919713", "0.5865932", "0.5829013", "0.5796365", "0.578166", "0.5680778", "0.5673663", "0.56730056"...
0.6863052
0
Given an ndarray image as loaded by image_load (NOT a tensor), scales it, pads it, splits it up, forwards the pieces, and reconstitutes it. Note that you really shouldn't try to run anything not (1, 3, , ) through this.
def forward_tiled(self, image: numpy.ndarray, tile_size: int) -> numpy.ndarray: # Constant that only really gets repeated a ton here. context = 7 context2 = context + context # Notably, numpy is used here because it makes this fine manipulation a lot simpler. # Scaling first - repeat on axis 2 and ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dimension_postprocess(self, chunked_data, original_data, scale=1, padding=True):\r\n\r\n assert len(original_data.shape) == 2, \"data dimension expected to be (xline ,samp_point)\"\r\n assert len(chunked_data.shape) == 3, \"Chunked data dimension expected to be (batch_size, xline, samp_point)\"\r...
[ "0.68369544", "0.6804232", "0.63060457", "0.6298447", "0.62349844", "0.62218934", "0.6182368", "0.6164234", "0.6161654", "0.6146714", "0.6141564", "0.61321", "0.61149937", "0.6093621", "0.6093426", "0.6044871", "0.5970364", "0.59532017", "0.59203714", "0.59078735", "0.5903252...
0.0
-1
Create lookup tables for vocabulary
def create_lookup_tables(text): word_counts = Counter(text) sorted_vocab = sorted(word_counts, key=word_counts.get, reverse=True) int_to_vocab = {ii: word for ii, word in enumerate(sorted_vocab)} vocab_to_int = {word: ii for ii, word in int_to_vocab.items()} return vocab_to_int, int_to_vocab
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_lookup_tables(text):\n # todo 需要编程:\n words = sorted(list(set(text)))\n vocab_to_int = {word:idx for idx, word in enumerate(words)}\n int_to_vocab = dict(enumerate(words))\n return vocab_to_int, int_to_vocab", "def create_lookup_tables(text):\n vocab = set(text.split())\n vocab_to...
[ "0.7771384", "0.77559125", "0.767672", "0.75280625", "0.7388749", "0.7338626", "0.6986911", "0.6866718", "0.6844249", "0.6324012", "0.62225556", "0.6083606", "0.5979698", "0.59622264", "0.5914716", "0.590712", "0.58832353", "0.58711576", "0.5857526", "0.58014566", "0.5794954"...
0.75501454
3
Generate a dict to turn punctuation into a token.
def token_lookup(): token_dict = {} token_dict['.'] = "||Period||" token_dict[','] = "||Comma||" token_dict['"'] = "||Quotation_Mark||" token_dict[';'] = "||Semicolon||" token_dict['!'] = "||Exclamation_Mark||" token_dict['?'] = "||Question_Mark||" token_dict['('] = "||Left_Parentheses||...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def token_lookup():\n token_dict = {'.':'||Period||', ', ':'||Comma||', '\"':'||Quotation_Mark||', ';':'||Semicolon||',\n '!':'||Exclamation_mark||', '?':'||Question_mark||', '(':'||Left_Parentheses||',\n ')':'||Right_Parentheses||', '--':'||Dash||', '\\n':'||Return||'}\n re...
[ "0.66179246", "0.6473263", "0.63673395", "0.63541335", "0.6318267", "0.6195351", "0.6170302", "0.61027676", "0.61009026", "0.6056571", "0.583608", "0.580536", "0.57960415", "0.5735746", "0.5717652", "0.5713248", "0.5703686", "0.56706595", "0.56492156", "0.56279296", "0.562042...
0.6736538
0
Create TF Placeholders for input, targets, and learning rate.
def get_inputs(): inputs = tf.placeholder(tf.int32, [None, None], name='input') targets = tf.placeholder(tf.int32,[None, None], name='targets') learning_rate = tf.placeholder(tf.float32, name='learning_rate') return inputs, targets, learning_rate
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_placeholders(self):\n\n\t\twith tf.name_scope(\"input_data\"):\n\t\t\tself.input_words=tf.placeholder(shape=(None,self.look_back), dtype=tf.int32,name='input_tokens')\n\t\twith tf.name_scope(\"output_data\"):\t\n\t\t\tself.output_words=tf.placeholder(shape=(None,self.look_back),dtype=tf.int32,name='out...
[ "0.7744293", "0.7662721", "0.7621616", "0.76179385", "0.75356156", "0.75137645", "0.7418147", "0.7405449", "0.7404622", "0.73941994", "0.73695993", "0.73649645", "0.7349455", "0.73242545", "0.72866756", "0.72504604", "0.7224488", "0.72090685", "0.7191729", "0.71353704", "0.71...
0.6295598
47
Create an RNN Cell and initialize it.
def get_init_cell(batch_size, rnn_size): lstm = tf.contrib.rnn.BasicLSTMCell(rnn_size) #drop = tf.contrib.rnn.DropoutWrapper(lstm, output_keep_prob=0.5) cell = tf.contrib.rnn.MultiRNNCell([lstm] * 3) initial_state = cell.zero_state(batch_size, tf.float32) initial_state = tf.identity(initial_state, n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, rnn_cell, batch_size,\n input_size, num_outputs):\n super().__init__(name='RNNCellStateModel')\n self._rnn_cell = rnn_cell\n self._batch_size = batch_size\n self._input_size = input_size\n self._num_outputs = num_outputs", "def constructCell():\n\t\tself.weightGene...
[ "0.71328205", "0.6902493", "0.6705795", "0.6509429", "0.6456088", "0.6427877", "0.64073706", "0.63708305", "0.6354739", "0.6346675", "0.6290552", "0.62503237", "0.62420845", "0.6240313", "0.6204581", "0.61756074", "0.6160576", "0.61548066", "0.6071491", "0.5992168", "0.59629"...
0.6565958
3
Create embedding for .
def get_embed(input_data, vocab_size, embed_dim): embedding = tf.Variable(tf.random_uniform((vocab_size, embed_dim), -1, 1)) embed = tf.nn.embedding_lookup(embedding, input_data) return embed
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_embedding(skills):\n corpus = list(skills[\"description\"].values)\n embedder = SentenceTransformer(config[\"sentence_transformer\"][\"model\"])\n embedding = embedder.encode(corpus, show_progress_bar=True)\n return embedding", "def construct_embedding(self):\n i = 0\n self.l...
[ "0.7729022", "0.70906544", "0.7015876", "0.6964542", "0.6931766", "0.6912709", "0.68787014", "0.683601", "0.6829165", "0.678458", "0.6782046", "0.67570746", "0.6701816", "0.6686522", "0.6662742", "0.6654593", "0.6634601", "0.65902793", "0.65855086", "0.65748143", "0.6549607",...
0.61894983
56
Create a RNN using a RNN Cell
def build_rnn(cell, inputs): outputs, final_state = tf.nn.dynamic_rnn(cell, inputs, dtype=tf.float32) final_state = tf.identity(final_state, name="final_state") return outputs, final_state
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_rnn(cell, inputs):\n #_,initial_state = get_init_cell(batch_size, rnn_size)\n \n output, final_state = tf.nn.dynamic_rnn(cell, inputs, dtype=tf.float32)\n final_state = tf.identity(final_state, name='final_state')\n\n return (output, final_state)", "def _rnn_layer(input_data, rnn_cell, r...
[ "0.7033094", "0.69850665", "0.68633723", "0.6852711", "0.67769927", "0.66758764", "0.6648302", "0.66166735", "0.6592799", "0.6567434", "0.6554101", "0.6538519", "0.6495457", "0.64752847", "0.6469102", "0.6350825", "0.6320496", "0.6306484", "0.6303071", "0.62986463", "0.62471"...
0.680208
4
Build part of the neural network
def build_nn(cell, rnn_size, input_data, vocab_size, embed_dim): embedding = get_embed(input_data, vocab_size, rnn_size) outputs, final_state = build_rnn(cell, embedding) logits = tf.contrib.layers.fully_connected(outputs, vocab_size, activation_fn=None) return logits, final_state
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _build_networks(self):\n self.online_convnet = self._create_network(name='Online')\n self.target_convnet = self._create_network(name='Target')\n self._net_outputs = self.online_convnet(self.state_ph, training=True)\n self._q_argmax = tf.argmax(self._net_outputs.q_values, axis=1)[0]\n self._repla...
[ "0.766122", "0.7452656", "0.7433276", "0.7394448", "0.7365365", "0.7333781", "0.7314295", "0.7269099", "0.7231311", "0.72150916", "0.7188546", "0.7183978", "0.7167791", "0.70908564", "0.7087455", "0.7060453", "0.7048502", "0.70391226", "0.70122766", "0.699026", "0.6972236", ...
0.0
-1
Return batches of input and target
def get_batches(int_text, batch_size, seq_length): slice_size = batch_size * seq_length n_batches = int(len(int_text) / slice_size) result = [] for i in range(n_batches): start, stop = i * slice_size, (i + 1) * slice_size x = int_text[start: stop] x = np.pad(x, (0, slice_size - ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_batch(source, i):\n data = source[i]\n target = source[i + 1]\n return data.reshape((1, len(data))), target.reshape((-1,))", "def batch_data(source, target, batch_size):\n for batch_i in range(0, len(source)//batch_size):\n start_i = batch_i * batch_size\n source_batch = source[...
[ "0.7363033", "0.71290106", "0.70627284", "0.703322", "0.6986728", "0.69704914", "0.69097173", "0.69094884", "0.68605214", "0.68146205", "0.681418", "0.68079066", "0.6777295", "0.67449534", "0.66930664", "0.6679705", "0.6668017", "0.6667492", "0.66516435", "0.664385", "0.66402...
0.0
-1
We use addiional id to make it possible to run multiple instances of the same code We use the neputne id for an easy reference. piotr.milos
def get_config(ctx): global HISTORY_LOGS, EXPERIMENT_ID #Ugly hack, make it better at some point, may be ;) id = ctx.job.id EXPERIMENT_ID = hash(id) import montezuma_env ctx.job.register_action("Set starting point procssor:", lambda str: set_motezuma_env_options(str, mo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n self.id = id(self)", "def _id(self):\n pass", "def getID():", "def pid(self):", "def __init__(self, id: int = 0, /):", "def __init__(self, id: str):\n self.id = id", "def __init__(self, id: int, /):", "def __init__(self, id: int, /):", "def __init__(self, ...
[ "0.64650697", "0.64362", "0.63527906", "0.6186919", "0.6167249", "0.5979204", "0.59692824", "0.59692824", "0.59692824", "0.59692824", "0.5918313", "0.5918313", "0.5908174", "0.58874714", "0.5886905", "0.586581", "0.584896", "0.5848244", "0.584183", "0.584183", "0.584183", "...
0.0
-1
Create a simulated image for testing.
def setup_class(self): from scipy.spatial import cKDTree shape = (500, 500) # define random star positions nstars = 50 from astropy.utils.misc import NumpyRNGContext with NumpyRNGContext(12345): # seed for repeatability xx = np.random.uniform(low=0, high...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_image(self):\n pass", "def new_test_image():\n warnings.warn(DeprecationWarning(\n \"new_test_image() is deprecated in favour of the get_sample_image() \"\n \"context manager.\"), stacklevel=2)\n image_name = 'test-{}.png'.format(uuid.uuid4())\n image = Image.new('RG...
[ "0.71623504", "0.68563354", "0.67887807", "0.67866874", "0.66272223", "0.65794975", "0.65335965", "0.6525982", "0.649347", "0.6438166", "0.6362632", "0.63506156", "0.62497157", "0.6224325", "0.62128174", "0.61762375", "0.609001", "0.6079063", "0.60769093", "0.6073406", "0.607...
0.0
-1
This is an endtoend test of EPSFBuilder on a simulated image.
def test_epsf_build(self): size = 25 oversampling = 4. stars = extract_stars(self.nddata, self.init_stars, size=size) epsf_builder = EPSFBuilder(oversampling=oversampling, maxiters=20, progress_bar=False) epsf, fitted_stars = epsf_builder(stars...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def expose_test(self):\n with self.lock:\n self.dark = 1\n self.tstart = time.time()\n self.timestamp = time.strftime(\"%Y-%m-%dT%H:%M:%S\", time.localtime(self.tstart))\n imagesize = (self.expArea[3] - self.expArea[1],\n self.expArea[2] - ...
[ "0.6532734", "0.65219575", "0.61546344", "0.6055118", "0.59790444", "0.5955276", "0.58926064", "0.58453953", "0.5843574", "0.5825598", "0.5800128", "0.57825714", "0.5774205", "0.57699555", "0.57476026", "0.5737863", "0.573536", "0.5732193", "0.5694142", "0.56920683", "0.56847...
0.6694861
0
Test that the input fitter is an EPSFFitter instance.
def test_epsf_build_invalid_fitter(self): with pytest.raises(TypeError): EPSFBuilder(fitter=EPSFFitter, maxiters=3) with pytest.raises(TypeError): EPSFBuilder(fitter=LevMarLSQFitter(), maxiters=3) with pytest.raises(TypeError): EPSFBuilder(fitter=LevMarLSQF...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_training_is_training_instance(self):\n self.assertIsInstance(self.weekly_training, Training)\n self.assertIsInstance(self.one_off_training, Training)", "def test_fitters_interface(fitter):\n fitter = fitter()\n\n model = models.Gaussian1D(10, 4, 0.3)\n x = np.arange(21)\n y = m...
[ "0.58193254", "0.576989", "0.5444093", "0.5416641", "0.54027134", "0.53487724", "0.5334198", "0.52976006", "0.5282834", "0.52802503", "0.5256052", "0.5253613", "0.51621646", "0.5144735", "0.5130423", "0.5122691", "0.51144564", "0.5113895", "0.5088265", "0.5082022", "0.5029815...
0.6341368
0
An instance of a `FitInterferometer` corresponding to the maximum log likelihood model inferred by the nonlinear search.
def max_log_likelihood_fit(self) -> FitInterferometer: return self.analysis.fit_interferometer_via_instance_from( instance=self.instance )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def max_log_likelihood_fit(self) -> ag.FitQuantity:\r\n\r\n return self.analysis.fit_quantity_for_instance(instance=self.instance)", "def log_likelihood_function(self, instance):\r\n\r\n try:\r\n return self.fit_interferometer_for_instance(\r\n instance=instance\r\n ...
[ "0.69463223", "0.63066924", "0.6028813", "0.5956261", "0.5869772", "0.5844398", "0.5813573", "0.57820946", "0.5766396", "0.5750532", "0.5746389", "0.5708685", "0.5698256", "0.5519008", "0.55123526", "0.55059314", "0.5490913", "0.5480697", "0.54476845", "0.54429275", "0.543328...
0.81059855
0
An instance of a `Tracer` corresponding to the maximum log likelihood model inferred by the nonlinear search. The `Tracer` is computed from the `max_log_likelihood_fit`, as this ensures that all linear light profiles are converted to normal light profiles with their `intensity` values updated.
def max_log_likelihood_tracer(self) -> Tracer: return ( self.max_log_likelihood_fit.model_obj_linear_light_profiles_to_light_profiles )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def max_log_likelihood_tracer(self) -> Tracer:\r\n return self.analysis.tracer_via_instance_from(instance=self.instance)", "def max_log_likelihood_fit(self) -> FitInterferometer:\r\n return self.analysis.fit_interferometer_via_instance_from(\r\n instance=self.instance\r\n )", "d...
[ "0.74774915", "0.66032386", "0.57672596", "0.5737945", "0.558012", "0.53950375", "0.53794014", "0.53068775", "0.53021854", "0.528267", "0.5255574", "0.5232161", "0.5228557", "0.5171876", "0.5137233", "0.5123503", "0.510592", "0.50647867", "0.506299", "0.50606036", "0.5060061"...
0.81920236
0
The real space mask used by this modelfit.
def real_space_mask(self) -> aa.Mask2D: return self.max_log_likelihood_fit.dataset.real_space_mask
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mask(self):\n return self._mask", "def mask(self):\n return self._mask", "def mask(self):\n return self._mask", "def mask(self):\n return self._mask", "def mask(self):\n return self.mask_index", "def medicalMask(self) -> float:\n return self._coreEstimation.m...
[ "0.71758425", "0.71758425", "0.71758425", "0.71758425", "0.6801398", "0.67848504", "0.6766158", "0.65531385", "0.65167063", "0.64373904", "0.6400794", "0.6234843", "0.6231467", "0.61996174", "0.61990255", "0.61990255", "0.61990255", "0.6129481", "0.60355794", "0.60135835", "0...
0.820525
0
Calculate the annualised sample covariance matrix of (daily) asset returns.
def sample_cov(prices, frequency=252): if not isinstance(prices, pd.DataFrame): warnings.warn("prices are not in a dataframe", RuntimeWarning) prices = pd.DataFrame(prices) daily_returns = daily_price_returns(prices) return daily_returns.cov() * frequency
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cov(self):\n E_x = Sample.mean(self)\n Std_x = Sample.std(self)\n cov = Std_x/E_x\n return(cov)", "def covariance(mtrx):\r\n\r\n # Average column of matrix\r\n T = np.transpose(mtrx)\r\n ave = np.zeros(len(mtrx))\r\n mtrx = np.asarray(mtrx)\r\n\r\n if isinstance(mtr...
[ "0.61024827", "0.60882634", "0.60061836", "0.60022545", "0.5951774", "0.5946839", "0.5942755", "0.593687", "0.5928027", "0.5898082", "0.58764166", "0.5865247", "0.5839527", "0.5812346", "0.5749281", "0.5738869", "0.57069844", "0.5693732", "0.56880194", "0.567809", "0.5676851"...
0.60892475
1
Estimate the semicovariance matrix, i.e the covariance given that the returns are less than the benchmark. .. semicov = E([min(r_i B, 0)] . [min(r_j B, 0)])
def semicovariance(prices, benchmark=0, frequency=252): if not isinstance(prices, pd.DataFrame): warnings.warn("prices are not in a dataframe", RuntimeWarning) prices = pd.DataFrame(prices) daily_returns = daily_price_returns(prices) drops = np.fmin(daily_returns - benchmark, 0) return d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decomposeCov(M):\n U,s,V = linalg.svd(M)\n R = mat(U)\n if R[1,0] > 0: R = -1.*R\n if linalg.det(R) < 0:\n R[:,1] = -1.*R[:,1]\n\n S = mat(diag(s))\n return R,S", "def sigma_from_cov(params, cov):\n rands = np.random.multivariate_normal(params, cov, 10000)\n breakdowns = -1*ran...
[ "0.6204444", "0.5936843", "0.58973277", "0.5895796", "0.58810544", "0.58502036", "0.5757374", "0.57432806", "0.57359", "0.571641", "0.56612056", "0.56434214", "0.56434214", "0.56368524", "0.56346697", "0.5591559", "0.55855596", "0.5577742", "0.5570818", "0.5570406", "0.556534...
0.6246111
0
Calculate the exponential covariance between two timeseries of returns.
def _pair_exp_cov(X, Y, span=180): covariation = (X - X.mean()) * (Y - Y.mean()) # Exponentially weight the covariation and take the mean if span < 10: warnings.warn("it is recommended to use a higher span, e.g 30 days") return covariation.ewm(span=span).mean()[-1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def covariance(self, x1, x2, lengths):\n z = self.dist(x1, x2, lengths)\n return (self.a**2) * exp(-0.5*z)", "def covariance (x, y):\n n = len(x)\n return dot(de_mean(x), de_mean(y))/(n-1)", "def calculate_covariance(column1: pd.Series, column2: pd.Series) -> np.float64:\n\n cov = column...
[ "0.663079", "0.64257526", "0.6424279", "0.64234096", "0.6411297", "0.6403209", "0.63896066", "0.6319481", "0.6286836", "0.614348", "0.61390924", "0.6127027", "0.6126614", "0.612525", "0.6087634", "0.5945993", "0.5933623", "0.58242244", "0.5799875", "0.57965803", "0.57709515",...
0.64166164
4
Estimate the exponentiallyweighted covariance matrix, which gives greater weight to more recent data.
def exp_cov(prices, span=180, frequency=252): if not isinstance(prices, pd.DataFrame): warnings.warn("prices are not in a dataframe", RuntimeWarning) prices = pd.DataFrame(prices) assets = prices.columns daily_returns = daily_price_returns(prices) N = len(assets) # Loop over matrix,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cov(self):\n cov_ = np.dot(self.weights * self.demeaned.T, self.demeaned)\n cov_ /= self.sum_weights - self.ddof\n return cov_", "def _mn_cov_ ( self , size = -1 , root = False ) :\n #\n if size <= 0 : size = len ( self )\n size = min ( size , len ( self ) ) \n #\n from ar...
[ "0.67914", "0.6656926", "0.66080594", "0.64771646", "0.63540035", "0.6342093", "0.6293979", "0.6258623", "0.6247504", "0.609174", "0.60618913", "0.606088", "0.6040714", "0.6021034", "0.5987279", "0.59834814", "0.5938113", "0.58909416", "0.5872555", "0.58216465", "0.5801764", ...
0.0
-1
Calculate the minimum covariance determinant, an estimator of the covariance matrix that is more robust to noise.
def min_cov_determinant(prices, frequency=252, random_state=None): if not isinstance(prices, pd.DataFrame): warnings.warn("prices are not in a dataframe", RuntimeWarning) prices = pd.DataFrame(prices) assets = prices.columns X = prices.pct_change().dropna(how="all") X = np.nan_to_num(X.v...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def covariance(data_matrix):\n return np.asmatrix(np.cov(data_matrix, rowvar=0))", "def cov_matrix(X, mu):\n m, n = X.shape\n X_minus_mu = X - mu\n sigma = (1 / m) * (X_minus_mu.T).dot(X_minus_mu)\n\n return sigma", "def _mn_cov_ ( self , size = -1 , root = False ) :\n #\n if size <= 0 : s...
[ "0.6320921", "0.63008386", "0.62460333", "0.6208877", "0.6198202", "0.61210555", "0.6080598", "0.606703", "0.6057687", "0.603914", "0.5986421", "0.59207064", "0.59205496", "0.58831877", "0.5879957", "0.5871225", "0.5817185", "0.57943755", "0.5783197", "0.5736097", "0.573593",...
0.6314101
1
Helper method which annualises the output of shrinkage calculations, and formats the result into a dataframe
def format_and_annualise(self, raw_cov_array): assets = self.X.columns return ( pd.DataFrame(raw_cov_array, index=assets, columns=assets) * self.frequency )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n df = pd.DataFrame([self.Xa.mean(),self.Xa.std()])\n df.index = ['E[R]','SD[R]']\n header = '\\nAnnual Returns (%):\\n\\n'\n return header + df.__str__()", "def compute (self):\r\n #obtain and validate the inputs\r\n startBalance = self.amount.getNumb...
[ "0.6088556", "0.5884749", "0.5837706", "0.580568", "0.5794596", "0.5783352", "0.57674056", "0.57600665", "0.56907064", "0.5690144", "0.564202", "0.56202173", "0.55736405", "0.55640435", "0.5552903", "0.55230665", "0.55076694", "0.55026937", "0.5494513", "0.5490592", "0.548795...
0.52572143
50
Shrink a sample covariance matrix to the identity matrix (scaled by the average sample variance). This method does not estimate an optimal shrinkage parameter, it requires manual input.
def shrunk_covariance(self, delta=0.2): self.delta = delta N = self.S.shape[1] # Shrinkage target mu = np.trace(self.S) / N F = np.identity(N) * mu # Shrinkage shrunk_cov = delta * F + (1 - delta) * self.S return self.format_and_annualise(shrunk_cov)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shrink(self):\n x = np.nan_to_num(self.X.values)\n\n # de-mean returns\n t, n = np.shape(x)\n meanx = x.mean(axis=0)\n x = x - np.tile(meanx, (t, 1))\n xmkt = x.mean(axis=1).reshape(t, 1)\n\n # compute sample covariance matrix\n sample = np.cov(np.append(...
[ "0.686523", "0.5708117", "0.56834924", "0.5621674", "0.54906625", "0.54182756", "0.533052", "0.5224842", "0.51816285", "0.5174759", "0.5155567", "0.51307696", "0.5077133", "0.5030297", "0.5008513", "0.49890906", "0.498165", "0.49331114", "0.489998", "0.48944172", "0.4869452",...
0.52941155
7
Calculate the LedoitWolf shrinkage estimate.
def ledoit_wolf(self): X = np.nan_to_num(self.X.values) shrunk_cov, self.delta = covariance.ledoit_wolf(X) return self.format_and_annualise(shrunk_cov)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lapse(self):\n pass", "def sweep50W(self):\n return 25.9", "def eady_growth_rate(data):\n N2 = ixr.brunt_vaisala(data)\n f = 2.0*omega*xruf.sin(xruf.deg2rad(data.lat))\n\n dz = ixr.domain.calculate_dz(data)\n du = ixr.domain.diff_pfull(data.ucomp, data)\n\n N = xruf.sqrt(N2.whe...
[ "0.60400766", "0.59365445", "0.5810836", "0.5762381", "0.5751515", "0.5725546", "0.5681198", "0.56707937", "0.5667252", "0.56470907", "0.5641813", "0.56293994", "0.5625519", "0.56059796", "0.560109", "0.5598705", "0.5592972", "0.5587249", "0.55850375", "0.5578529", "0.5576009...
0.6030858
1
Calculate the Oracle Approximating Shrinkage estimate
def oracle_approximating(self): X = np.nan_to_num(self.X.values) shrunk_cov, self.delta = covariance.oas(X) return self.format_and_annualise(shrunk_cov)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new_sga(self) -> float:\n increase_factor = (\n self.total_demand() / self.operations.productivity.total_m3_collected - 1\n )\n increase_factor *= 0.75\n return self.income_statement.opex.sga * (1 + increase_factor)", "def __calc_s(self, df):\n df.loc[:, \"avg_nu...
[ "0.57590866", "0.5601078", "0.55657876", "0.5491326", "0.5476864", "0.5450543", "0.5446301", "0.5414561", "0.54031104", "0.5387726", "0.5379592", "0.5351469", "0.5332968", "0.53287953", "0.53218544", "0.52865034", "0.5273125", "0.5265359", "0.525904", "0.5256719", "0.52269393...
0.51361924
31
Calculate the ConstantCorrelation covariance matrix.
def shrink(self): x = np.nan_to_num(self.X.values) # de-mean returns t, n = np.shape(x) meanx = x.mean(axis=0) x = x - np.tile(meanx, (t, 1)) # compute sample covariance matrix sample = (1.0 / t) * np.dot(x.T, x) # compute prior var = np.diag(sa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def correlation_matrix(self):\n correlation_matrix = self.model.covariance.copy()\n sigmaD = np.sqrt(np.diag(correlation_matrix))\n for ii in range(correlation_matrix.shape[0]):\n for jj in range(correlation_matrix.shape[1]):\n correlation_matrix[ii, jj] /= sigmaD[ii]...
[ "0.77284074", "0.7547228", "0.7090517", "0.7039451", "0.6994395", "0.69679624", "0.6934814", "0.68709993", "0.68600374", "0.6836816", "0.6824904", "0.6757267", "0.6741739", "0.66652405", "0.66569704", "0.6645018", "0.65971345", "0.65955824", "0.65839565", "0.6551665", "0.6527...
0.0
-1
Calculate the ConstantCorrelation covariance matrix.
def shrink(self): x = np.nan_to_num(self.X.values) # de-mean returns t, n = np.shape(x) meanx = x.mean(axis=0) x = x - np.tile(meanx, (t, 1)) xmkt = x.mean(axis=1).reshape(t, 1) # compute sample covariance matrix sample = np.cov(np.append(x, xmkt, axis=1...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def correlation_matrix(self):\n correlation_matrix = self.model.covariance.copy()\n sigmaD = np.sqrt(np.diag(correlation_matrix))\n for ii in range(correlation_matrix.shape[0]):\n for jj in range(correlation_matrix.shape[1]):\n correlation_matrix[ii, jj] /= sigmaD[ii]...
[ "0.77284074", "0.7547228", "0.7090517", "0.7039451", "0.6994395", "0.69679624", "0.6934814", "0.68709993", "0.68600374", "0.6836816", "0.6824904", "0.6757267", "0.6741739", "0.66652405", "0.66569704", "0.6645018", "0.65971345", "0.65955824", "0.65839565", "0.6551665", "0.6527...
0.0
-1
Add video tutorial link
def add_video(request): if request.method == "POST": form = AddForms(request.POST) if form.is_valid(): form.save() messages.info(request, 'New video added') else: logger = logging.getLogger(__name__) messages.error(request, form.errors) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_trailer(self):\r\n webbrowser.open(self.trailer_youtube_url)", "async def mathlesson(self, ctx):\r\n await ctx.send('https://www.youtube.com/watch?v=WFoC3TR5rzI')", "def getYouTubeLink(self):\n \n return self.link.replace('watch?v=', 'v/')", "def show_trailer(self):\n\t\twebb...
[ "0.61660105", "0.6136898", "0.6028367", "0.6017572", "0.6017572", "0.6017572", "0.60162205", "0.6013646", "0.59756875", "0.5960356", "0.5960356", "0.5960356", "0.59319365", "0.5921021", "0.5905654", "0.5895406", "0.58787245", "0.58760995", "0.58713305", "0.58693415", "0.58693...
0.0
-1
Serve book, take notes etc
def book(request, slug): if request.method == 'POST': book = Book.objects.get(slug=slug) form = AddForms(request.POST, instance=book) if form.is_valid(): form.save() messages.info(request, "Info updated") else: logger = logging.getLogger(__name__) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download_a_book():\n try:\n book_name = request.args.get('book_name')\n record = search_a_book(replica_one, book_name)\n if 'success' in record:\n blob = replica_one.blob(book_name)\n size = sys.getsizeof(blob.download_as_string())\n response = Response(...
[ "0.62519765", "0.6162564", "0.60040337", "0.58135223", "0.57725567", "0.5688528", "0.568447", "0.56799257", "0.5678683", "0.5664258", "0.564394", "0.5622881", "0.55608475", "0.55499345", "0.55365074", "0.55188197", "0.551556", "0.5500022", "0.5494903", "0.5486445", "0.5486445...
0.55682933
12
handle book "finish" in model
def book_finished(request, slug): book = Book.objects.get(slug=slug) book.finished = True book.finished_at = timezone.datetime.today() book.save() messages.info(request, "Book marked as finished") return redirect('/book/' + slug + "/")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def finish(self):", "def finish(self):", "def finish(self):\n pass", "def finish(self):\n pass", "def finish():\n pass", "def finish(self) -> None:", "def finish(self) -> None:", "def done(self):", "def done(self):", "def back(self):\n self.book.back()\n self.bo...
[ "0.651837", "0.651837", "0.6296331", "0.6296331", "0.6232587", "0.62136847", "0.62136847", "0.60935384", "0.60935384", "0.6090043", "0.6085858", "0.6074087", "0.60662776", "0.6063426", "0.6063426", "0.6063426", "0.6063426", "0.6054718", "0.6011309", "0.58680695", "0.5864044",...
0.7256532
0
Mask an item or a list of items, so it can not be searched.
def mask(self, item_or_items: Union[str, list]) -> None: if isinstance(item_or_items, str): self._masked_items.add(item_or_items) elif isinstance(item_or_items, list): for item in item_or_items: assert isinstance(item, str) self._masked_items.add(i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _mask_list(self, items):\n\n result_type = type(items)\n results = []\n for item in items:\n results.append(self._mask(item))\n\n return result_type(results)", "def clear_mask(self, item_or_items: Union[str, list]) -> None:\n if isinstance(item_or_items, str) and...
[ "0.71734196", "0.6949816", "0.6528739", "0.62340534", "0.5941682", "0.5838568", "0.56591773", "0.5654658", "0.54791373", "0.54755586", "0.53369683", "0.52959144", "0.52852184", "0.5266971", "0.5258228", "0.52347344", "0.5234729", "0.5205539", "0.520498", "0.51970905", "0.5194...
0.7793145
0
Recover a masked item or a list of maksed items, so it can be searched again.
def clear_mask(self, item_or_items: Union[str, list]) -> None: if isinstance(item_or_items, str) and item_or_items in self._masked_items: self._masked_items.remove(item_or_items) elif isinstance(item_or_items, list): for item in item_or_items: if item in self._mas...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mask(self, item_or_items: Union[str, list]) -> None:\n if isinstance(item_or_items, str):\n self._masked_items.add(item_or_items)\n elif isinstance(item_or_items, list):\n for item in item_or_items:\n assert isinstance(item, str)\n self._masked_...
[ "0.66658765", "0.6491505", "0.5480818", "0.5453097", "0.5444256", "0.5365729", "0.5221703", "0.51793486", "0.51662123", "0.5162058", "0.515265", "0.5151804", "0.5125398", "0.50725377", "0.5067496", "0.5029297", "0.5011799", "0.4962683", "0.49376792", "0.49319416", "0.48999804...
0.6037998
2
Insert a term into the tree. A term can be a word or phrase.
def insert(self, tokens: List[str]): cur = self._root for token in tokens: if token not in cur.children: cur.children[token] = _TrieNode(token) cur = cur.children[token] cur.is_term = True self._len += 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert(self, word):\n if not word:\n return\n if word[0] in self.trie:\n cur = self.trie[word[0]]\n else:\n cur = TrieNode(word[0])\n for char in word[1:]:\n if char not in cur.nexts:\n cur.nexts[char] = TrieNode(char)\n ...
[ "0.73594046", "0.7153792", "0.71109015", "0.7109018", "0.7107041", "0.7096108", "0.7021035", "0.701429", "0.7012358", "0.70056224", "0.69533575", "0.6944374", "0.6943619", "0.69425434", "0.689561", "0.6865354", "0.68383473", "0.68182147", "0.68131256", "0.6804924", "0.6795131...
0.64872843
40
Search a term int the tree. A term can be a word or phrase.
def search(self, tokens: List[str]) -> bool: item = "".join(tokens) if item in self._masked_items: return False cur = self._root for token in tokens: if token not in cur.children: return False cur = cur.children[token] return ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search(self, term):\n return self._search(self._root, term, 0)", "def search(self, term):", "def search(self, word):\n node = self.root\n return self.searchHelper(node, word)", "def search(self, word):\n return self.find(self.root,word)", "def search(self, word):\n re...
[ "0.80329716", "0.7918371", "0.7470943", "0.73325664", "0.73010314", "0.7292465", "0.7216557", "0.71666795", "0.7162614", "0.7153656", "0.71518344", "0.71518344", "0.7117164", "0.7061479", "0.6989512", "0.69825965", "0.6951326", "0.69268405", "0.69040906", "0.68754804", "0.687...
0.62226194
72
Enumerate all matched terms according to the prefix.
def enumerate_match(self, prefix: List[str]) -> List[str]: matched_terms = [] cur = self._root for i, token in enumerate(prefix): if token not in cur.children: break cur = cur.children[token] if cur.is_term: item = "".join(prefi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prefixSearch(self, prefix: str, _prec=\"\"):\n if prefix == \"\":\n # prefix exhasuted, match all\n yield from self.keys(_prec)\n else:\n try:\n # prefix not exhausted, traverse further\n chld = self.children[prefix[0]]\n ...
[ "0.6639456", "0.6516617", "0.61553776", "0.61436945", "0.6130935", "0.60279405", "0.60198647", "0.5976832", "0.5889858", "0.57862514", "0.5730367", "0.56938714", "0.56853217", "0.5670705", "0.5616336", "0.5614195", "0.5613336", "0.5585791", "0.55320466", "0.5512074", "0.55025...
0.824299
0
Load all lexicons into the trie tree.
def load_lexicons(self, folder: str, file_name: str): file_path = os.path.join(folder, file_name) with open(file_path, "r", encoding="utf-8") as f_in: for line in f_in.readlines(): line = line.replace("\n", "") tokens = list(line) self.insert(t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loadTrie(self):\n for file in self._gram_files:\n trie_file = getTrieFile(os.path.basename(file), self._pickle_dir)\n with open(trie_file, 'rb') as fd:\n self._tries.append(pickle.load(fd))", "def _add_all_to_tree(elms, trie):\n for elm in elms:\n ...
[ "0.70103794", "0.60826737", "0.5833833", "0.58041453", "0.58041453", "0.57136434", "0.5500055", "0.544029", "0.5410637", "0.541009", "0.53844976", "0.53844976", "0.53844976", "0.53844976", "0.5345329", "0.5302791", "0.52921546", "0.52657026", "0.5254543", "0.524532", "0.52442...
0.6468606
1
Return the total number of terms.
def __len__(self): return self._len
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getNumTerms(self):\n\n return self._numTerms", "def get_num_terms(self, documents=None):\n terms = []\n if documents == None:\n docs = self.vocab\n else:\n docs = [term for term in self.vocab if term['name'] in documents]\n for doc in docs:\n ...
[ "0.7713267", "0.7317305", "0.7209781", "0.707415", "0.7074131", "0.6786542", "0.67702496", "0.66621053", "0.66484886", "0.6547783", "0.6531839", "0.6531839", "0.6531839", "0.6483369", "0.6482668", "0.6460727", "0.64578813", "0.6441393", "0.64279175", "0.6408187", "0.6394199",...
0.0
-1
Calls super and then redefines the order in which the fields appear. for parameters see BaseForm.__init__()
def __init__(self, *args, **kwargs): super(CreateForm, self).__init__(*args, **kwargs) # set form fields order self.fields.keyOrder = ['to_user', 'subject', 'message']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args, **kw):\n super(SignupFormExtra, self).__init__(*args, **kw)\n # Put the first and last name at the top\n new_order = self.fields.keyOrder[:-2]\n new_order.insert(0, 'first_name')\n new_order.insert(1, 'last_name')\n self.fields.keyOrder = new_orde...
[ "0.72668296", "0.6936237", "0.6508285", "0.6419419", "0.6311311", "0.6287516", "0.62845707", "0.6266717", "0.62274545", "0.62013614", "0.6138659", "0.61382353", "0.6132888", "0.61148196", "0.6064425", "0.60594225", "0.6054909", "0.6046325", "0.6040513", "0.60086805", "0.60006...
0.6542123
2
Defines the fields and methods required for the base View class to provide the user with list, public, create, edit and delete views.
def __init__(self, params=None): rights = access.Checker(params) rights['unspecified'] = ['deny'] rights['edit'] = ['deny'] rights['show'] = [('checkIsMyEntity', [notification_logic, 'scope_path'])] rights['delete'] = [('checkIsMyEntity', [notification_logic, 'scope_path'])] rights['list'] = ['...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def admin_views(admin):\n\n # student no delete\n admin.add_view(CTextsView(Texts, db.session, name='Тексты'))\n\n admin.add_view(UserView(User, db.session, category=\"Люди\", name='Пользователи'))\n\n # chief upper full\n admin.add_view(CKeywordsView(Keywords, db.session, category=\"Жанры, слова\",...
[ "0.6588185", "0.64474666", "0.6445904", "0.6151662", "0.6102565", "0.6067544", "0.59592795", "0.59253454", "0.5914338", "0.5893061", "0.58813554", "0.5878796", "0.57946974", "0.57932574", "0.5790788", "0.57866484", "0.5786224", "0.57761693", "0.57538766", "0.57471484", "0.571...
0.5388812
38
Lists all notifications that the current logged in user has stored. for parameters see base.list()
def list(self, request, access_type, page_name=None, params=None, filter=None, order=None, **kwargs): # get the current user user_entity = user_logic.getForCurrentAccount() # only select the notifications for this user so construct a filter filter = { 'scope': user_entity, '...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_notifications():\n token = request.args.get('token')\n user = User.query.filter_by(token=token).first()\n\n if user is None:\n return jsonify({\"error\": \"Access Denied!\"})\n\n # Filter Posts so the user doesn't have to filter it\n notifications = Notifications.query.filter_by(user...
[ "0.78857595", "0.746229", "0.7321766", "0.7266858", "0.72493035", "0.7199395", "0.71889263", "0.6943352", "0.69205034", "0.6903298", "0.6903298", "0.68649685", "0.68214977", "0.681583", "0.68128014", "0.6807877", "0.68037546", "0.6783332", "0.6765252", "0.6734677", "0.6674633...
0.68386793
12
Checks if scope_path is seeded and puts it into to_user. for parameters see base._editSeed()
def _editSeed(self, request, seed): # if scope_path is present if 'scope_path' in seed.keys(): # fill the to_user field with the scope path seed['to_user'] = seed['scope_path']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initial(self, request, *args, **kwargs):\n try:\n request.data[\"user\"] = request.auth.user\n except:\n pass\n return super(BoundToUserMixin, self).initial(request, *args, **kwargs)", "def before_request ():\n try:\n g.user = current_user\n except Name...
[ "0.5439406", "0.5422712", "0.52258366", "0.5164079", "0.50828594", "0.50826675", "0.5003571", "0.4918171", "0.4914299", "0.4907016", "0.49020693", "0.48807842", "0.4876331", "0.48537108", "0.48348698", "0.48314634", "0.48105988", "0.47979325", "0.47977874", "0.47941908", "0.4...
0.7813154
0
Marks the Notification as read if that hasn't happened yet. for parameters see base._public()
def _public(self, request, entity, context): # if the user viewing is the user for which this notification is meant # and the notification has not been read yet if entity.unread: # get the current user user = user_logic.getForCurrentAccount() # if the message is meant for the user ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mark_read(self):\n # Obviously remove the exception when Kippt says the support it.\n raise NotImplementedError(\n \"The Kippt API does not yet support marking notifications as read.\"\n )\n\n data = json.dumps({\"action\": \"mark_seen\"})\n r = requests.post(\n ...
[ "0.7378796", "0.71452856", "0.70881987", "0.69997036", "0.6812067", "0.67487156", "0.66420895", "0.6324497", "0.629524", "0.6247599", "0.62287843", "0.6210138", "0.6176907", "0.61076736", "0.6079115", "0.6078349", "0.6051828", "0.60317713", "0.60317713", "0.60030264", "0.5937...
0.6149425
13
Set the global end timer, call at very end of algorithm.
def returnGlobalTimer(self): self.globalTime = (time.time() - self.globalStartRef) + self.addedTime #Reports time in minutes, addedTime is for population reboot. return self.globalTime/ 60.0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stop_timer(self):\n self.end_time = datetime.now()", "def _end_of_loop(self):\n\n ### LIVE FRAMERATE ###\n self.timer_ms.run(current_time=time.time())\n if self.timer_ms.isComplete():\n t_end = time.time()\n t_elapsed = np.round((t_end-self.timer_ms.startTime...
[ "0.7395899", "0.69717705", "0.6800864", "0.66952986", "0.66952986", "0.6679938", "0.65479946", "0.65479946", "0.65479946", "0.6544798", "0.64001036", "0.63770664", "0.6320661", "0.6230333", "0.61251456", "0.6105645", "0.61051744", "0.6089474", "0.60740453", "0.6064848", "0.60...
0.0
-1
Sets all time values to the those previously evolved in the loaded popFile.
def setTimerRestart(self, remakeFile): try: fileObject = open(remakeFile+"_PopStats.txt", 'r') # opens each datafile to read. except Exception as inst: print(type(inst)) print(inst.args) print(inst) print('cannot open', remakeFile+"_PopStats.t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def refreshMTimes(self):\n del self.mtimesReset[:]\n for fileName, fileInfo in self.data.items():\n oldMTime = self.mtimes.get(fileName,fileInfo.mtime)\n self.mtimes[fileName] = oldMTime\n #--Reset mtime?\n if fileInfo.mtime != oldMTime and oldMTime != -1:\...
[ "0.6186886", "0.6107426", "0.5825859", "0.58206654", "0.57823503", "0.5752457", "0.57256806", "0.5710723", "0.56567633", "0.5641898", "0.561546", "0.561546", "0.561546", "0.561546", "0.561546", "0.55910146", "0.55683637", "0.55649704", "0.55640715", "0.55567926", "0.5555497",...
0.5639504
10
Reports the time summaries for this run. Returns a string ready to be printed out.
def reportTimes(self): outputTime = "Global Time\t"+str(self.globalTime/ 60.0)+ \ "\nMatching Time\t" + str(self.globalMatching/ 60.0)+ \ "\nDeletion Time\t" + str(self.globalDeletion/ 60.0)+ \ "\nSubsumption Time\t" + str(self.globalSubsumption/ 60.0)+ \ "\nSelection Time\t"+str...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def report(self) -> str:\n return REPORT_TIMEFRAME.format(self.name,\n self.times_run,\n self.average_runtime)", "def render_timing_report(self):\r\n report = ('Timing report\\n'\r\n '=============\\n')\r\n for ...
[ "0.76224065", "0.7170328", "0.6984836", "0.6865964", "0.68170786", "0.6785364", "0.6738881", "0.6686491", "0.6552146", "0.65373576", "0.6534475", "0.6499587", "0.64938", "0.6482341", "0.64753103", "0.64553666", "0.64503497", "0.63862836", "0.6380132", "0.6368545", "0.63616604...
0.7542045
1
Establish a connection with the given XenServer using XMLRPC
def getXenConnection(server, logger): server = server.lower() #read the global 'locations' file with all information if os.path.isfile(LOCATIONS_CONF): try: locationConf = ConfigObj(LOCATIONS_CONF) #check if the server is specified if server in...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def xs_connection(password, url, user='root'):\n \n conn = xmlrpclib.Server(url)\n connection = conn.session.login_with_password(user, password)\n \n if connection['Status'] == 'Success':\n token = connection['Value']\n sys.stderr.write (\"\\n Connection unique ref: %s\\n\" %token)\n ...
[ "0.6573482", "0.6204108", "0.5981148", "0.59743536", "0.589587", "0.58379835", "0.5822125", "0.5776857", "0.5766201", "0.575728", "0.5750974", "0.56980014", "0.56352746", "0.55725807", "0.55596584", "0.5543674", "0.552844", "0.5514942", "0.5501016", "0.54789513", "0.5441803",...
0.71508884
0
Function to make a new, random ball.
def make_ball(): ball = Ball() # Starting position of the ball. # Take into account the ball size so we don't spawn on the edge. ball.x = random.randrange(BALL_SIZE, SCREEN_WIDTH - BALL_SIZE) ball.y = random.randrange(BALL_SIZE, SCREEN_HEIGHT - BALL_SIZE) # Speed and direction of rectangle ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_ball(id):\n ball = Ball()\n\n ball.id = id\n\n # Size of the ball\n # ball.size = random.randrange(10, 30)\n ball.size = 10\n\n # Starting position of the ball.\n # Take into account the ball size so we don't spawn on the edge.\n ball.x = random.randrange(ball.size, WINDOW_WIDTH - ...
[ "0.7997919", "0.7979903", "0.7828779", "0.770357", "0.75933796", "0.72658503", "0.71938133", "0.716515", "0.6854851", "0.6770598", "0.66657805", "0.6590058", "0.6589296", "0.65399325", "0.65335727", "0.6460613", "0.64353716", "0.6428926", "0.6326836", "0.63059175", "0.6277418...
0.85226744
0
This is our main program.
def main(): pygame.init() # Set the height and width of the screen size = [SCREEN_WIDTH, SCREEN_HEIGHT] screen = pygame.display.set_mode(size) pygame.display.set_caption("Bouncing Balls") # Loop until the user clicks the close button. done = False # Used to manage how fast the screen...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main(...
[ "0.89765817", "0.89765817", "0.89765817", "0.89765817", "0.89765817", "0.89765817", "0.89765817", "0.89765817", "0.89765817", "0.89765817", "0.89765817", "0.89765817", "0.89765817", "0.89765817", "0.89765817", "0.89765817", "0.89765817", "0.89765817", "0.89765817", "0.89765817"...
0.0
-1
These arguments should be helpful in tweaking the outputs to better fit the hardware or specific decoder requirements. I.e. if your hardware shapes the signal on longer/shorter intervals than the actual value, it can be adjusted here. Currently only bit_X_part_duration and packet_separation are used. `n. Performance sh...
def __init__(self, bit_one_part_min_duration=55, # microseconds bit_one_part_max_duration=61, bit_one_part_duration=58, bit_zero_part_min_duration=95, bit_zero_part_max_duration=9900, bit_zero_part_duration=100, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_synth_data(n):", "def measure_all_1(n, state):\n state = state.copy()\n\n outs = ''\n for i in range(n):\n out = measure_single(n, state,\n i) # After measuring bit0, bit0 collapses. It affects the subsequent bit1 measurement, but does not affect the 1000...
[ "0.5669672", "0.55470574", "0.55303466", "0.5242294", "0.52390707", "0.51292825", "0.51087517", "0.5086169", "0.50713027", "0.5057984", "0.5040431", "0.49897262", "0.4978931", "0.4975838", "0.49727336", "0.48955587", "0.48590678", "0.48550522", "0.48550522", "0.48501915", "0....
0.59223044
0
Executes a command and waits for it to finish. If args are provided, then they will be used. If args are not provided, and arguments were used to run this program, then those arguments will be used. If args are not provided, and no arguments were used to run this program, and default args are provided, then they will b...
def execute( file: str, args: Sequence[str], cwd: Optional[Union[Path, str]] = None, env: Optional[dict] = None, capture: bool = False, verbose: Optional[bool] = None, ) -> CompletedProcess: if env is None: env = os.environ.copy() if is_verbose(verbose): log.ok(f"run: {...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_command(): # pragma: no cover\n args = parse_args(sys.argv[1:])\n status = run(args)\n sys.exit(status)", "def run_command(*args):\n\n # Want to print the commmand before running it, like `set -x`. This is very niave, but at least gets the idea\n # across. A more accurate command line wi...
[ "0.71821827", "0.6948193", "0.6944926", "0.682519", "0.676949", "0.6722863", "0.6686224", "0.66784173", "0.66211605", "0.65788233", "0.6488399", "0.6342324", "0.6300042", "0.62756133", "0.626245", "0.6260843", "0.6245185", "0.6204857", "0.6172158", "0.6147972", "0.6116247", ...
0.5562702
96
Imports a Python module from any local filesystem path. Temporarily alters sys.path to allow the imported module to import other modules in the same directory.
def import_file(path: Union[PurePath, str]) -> Generator[ModuleType, None, None]: pathdir = os.path.dirname(path) if pathdir in sys.path: added_to_sys_path = False else: sys.path.insert(0, pathdir) added_to_sys_path = True try: name = os.path.basename(path).split(".")[0]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def import_module_from(mod_path):\n if '.' in mod_path:\n bits = mod_path.split('.')\n mod_name = bits.pop()\n mod_path = '.'.join(bits)\n return import_module(mod_path, mod_name)\n else:\n return import_module(mod_path)", "def import_module(name, path):\n spec = impor...
[ "0.7278681", "0.7132707", "0.7093543", "0.7034862", "0.699624", "0.6958857", "0.6950275", "0.69009155", "0.68416375", "0.67911935", "0.67736846", "0.67294097", "0.6699479", "0.663062", "0.663062", "0.663062", "0.66145456", "0.66145456", "0.66067624", "0.6605258", "0.6592462",...
0.61376876
36
create a graph with the partition R of size n1 and partition H of size n2
def seat_model_generator(n1, n2, k_low, k_up, flag=0): def order_by_master_list(l, master_list): return sorted(l, key=master_list.index) possible_credits = [5, 10, 15, 20] # set up geometric distribution among above possible hospital credits probs = np.random.geometric(p=0.10, size=len(possible...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GenDumbbellGraph(n1, n2):\n G = nx.complete_graph(n1)\n H = nx.complete_graph(n2)\n\n mapping = {}\n for i in range(n2):\n mapping[i] = i+n1\n H = nx.relabel_nodes(H, mapping=mapping)\n\n I = nx.union(G,H)\n I.add_edge(n1-1,n1)\n I.weighted = False\n #set weight to 1\n for ...
[ "0.63051015", "0.6041714", "0.5770795", "0.5697603", "0.56216264", "0.5607458", "0.5580612", "0.5548421", "0.5535614", "0.54805267", "0.5478538", "0.54504657", "0.5440092", "0.5411817", "0.5397303", "0.5375728", "0.5331656", "0.5326185", "0.53207487", "0.53173274", "0.5306093...
0.49827084
67
delete not exist pipeline
def test_delete_pipeline_not_exist(self): pipeline_name = 'pipeline_name_not_exist' try: self.client.delete_pipeline(pipeline_name) except BceHttpClientError as e: if isinstance(e.last_error, BceServerError): assert e.last_error.message.startswith('The req...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_list_pipeline_delete_one(self):\n response = self.client.delete_pipeline(self.pipeline_name)\n nose.tools.assert_is_not_none(response)\n\n response = self.client.list_pipelines()\n exsit = False\n for pipeline in response.pipelines:\n if pipeline.pipeline_name...
[ "0.6537438", "0.5996526", "0.59681296", "0.59105635", "0.57883143", "0.5757299", "0.56991524", "0.56369615", "0.5517205", "0.5428441", "0.5411213", "0.53958535", "0.5372841", "0.53464174", "0.5332597", "0.5326581", "0.5326282", "0.53257066", "0.53243315", "0.53197414", "0.529...
0.59694725
2
delete pipeline with name is empty
def test_delete_pipeline_with_name_is_empty(self): pipeline_name = '' with nose.tools.assert_raises_regexp(BceClientError, 'pipeline_name can\'t be empty string'): self.client.delete_pipeline(pipeline_name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_delete_pipeline_with_name_is_none(self):\n with nose.tools.assert_raises_regexp(ValueError,\n 'arg \"pipeline_name\" should not be None'):\n self.client.delete_pipeline(None)", "def test_list_pipeline_delete_one(self):\n response = self.client.delete_pipeline(self...
[ "0.7732262", "0.76229423", "0.64914685", "0.64858747", "0.6106427", "0.6091376", "0.5948275", "0.588508", "0.5849737", "0.571674", "0.5584181", "0.5460383", "0.5422234", "0.5408701", "0.54028195", "0.53799385", "0.5361476", "0.5329178", "0.52891815", "0.52666765", "0.5263914"...
0.7667069
1
delete pipeline with name is none
def test_delete_pipeline_with_name_is_none(self): with nose.tools.assert_raises_regexp(ValueError, 'arg "pipeline_name" should not be None'): self.client.delete_pipeline(None)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_list_pipeline_delete_one(self):\n response = self.client.delete_pipeline(self.pipeline_name)\n nose.tools.assert_is_not_none(response)\n\n response = self.client.list_pipelines()\n exsit = False\n for pipeline in response.pipelines:\n if pipeline.pipeline_name...
[ "0.763168", "0.71707374", "0.66285604", "0.64226484", "0.6412838", "0.63978565", "0.61271435", "0.59604853", "0.5898413", "0.58966225", "0.5781897", "0.5680162", "0.5664345", "0.561427", "0.555643", "0.5535108", "0.5525379", "0.55244136", "0.5465732", "0.54537594", "0.5414938...
0.7625798
1
Returns the model properties as a dict
def to_dict(self): result = {} for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): result[attr] = list(map( lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_dict(self):\n return self.properties", "def to_dict(self):\n return self.properties", "def get_properties(self):\n return self.properties", "def asdict(self):\n return self._prop_dict", "def json(self):\n rv = {\n prop: getattr(self, prop)\n f...
[ "0.7751993", "0.7751993", "0.73391134", "0.7334895", "0.7297356", "0.727818", "0.7159078", "0.71578115", "0.71494967", "0.71494967", "0.71283495", "0.71275014", "0.7122587", "0.71079814", "0.7060394", "0.7043251", "0.7034103", "0.70233124", "0.69635814", "0.69586295", "0.6900...
0.0
-1
Returns the string representation of the model
def to_str(self): import simplejson as json if six.PY2: import sys reload(sys) sys.setdefaultencoding("utf-8") return json.dumps(sanitize_for_serialization(self), ensure_ascii=False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return super().__str__() + self.model.__str__()", "def __str__(self) -> str:\n # noinspection PyUnresolvedReferences\n opts = self._meta\n if self.name_field:\n result = str(opts.get_field(self.name_field).value_from_object(self))\n else:\n ...
[ "0.85856473", "0.7816244", "0.77898955", "0.77511245", "0.77511245", "0.7712556", "0.76984036", "0.766997", "0.7650706", "0.7601334", "0.7583777", "0.7571045", "0.75404567", "0.7523676", "0.7515677", "0.7501507", "0.7488033", "0.7488033", "0.74696296", "0.7452353", "0.7446052...
0.0
-1
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, ListDevicesRequest): 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.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.0
-1
Shuffle (random out of order)
def shuffle(self): self._current = 0 random.shuffle(self._cards)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shuffle(self):\n for i in xrange(self.n - 1):\n pos = random.randint(i, self.n - 1)\n self.to[i], self.to[pos] = self.to[pos], self.to[i]\n self.a[i], self.a[pos] = self.a[pos], self.a[i]\n return self.a", "def _shuffle():\n\n random.shuffle(deck)", ...
[ "0.79199487", "0.78305924", "0.7767727", "0.7755848", "0.775454", "0.77540964", "0.77540964", "0.77540964", "0.77540964", "0.77540964", "0.77485484", "0.7747164", "0.7740806", "0.7716279", "0.7658358", "0.76217234", "0.7616497", "0.7616497", "0.7579704", "0.75728077", "0.7549...
0.7156094
49
The player sorts the cards in his hand
def arrange(self, card_key): self._cards_on_hand.sort(key=card_key)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sort(self):\n self.cards.sort()", "def sort(self):\n self.cards.sort()", "def sort(self):\n self.deckcards.sort()", "def sort_cards(self):\n self.cards.sort(key=operator.attrgetter('persona', 'rank'))\n self.update_position()", "def deal_cards(self, players):\n ...
[ "0.80259424", "0.80259424", "0.7755631", "0.7686", "0.74837816", "0.7480401", "0.7467405", "0.7019499", "0.6767792", "0.6756765", "0.6609087", "0.65876836", "0.65850675", "0.6544533", "0.6536881", "0.65107507", "0.6496739", "0.6467788", "0.6414254", "0.6405045", "0.639959", ...
0.7612255
4
Return the points of the player's hand type and the points of the largest card
def score_on_hands(cards_on_hand): score = 0 straightCount = 0 max_card = 0 suite_dict = {} face_dict = {} transfer_dict = {'A':1,'J':11,'Q':12,'K':13} card_face = [] '''Circulate the player's hand, build a list of points and a suit dict''' for index in range(len(cards_on_ha...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hand_points(hand):\n points = [[]]\n branch = 1\n for card in hand:\n if not card[\"is_hidden\"]:\n if card[\"value\"].isnumeric():\n for possibility in range(branch):\n points[possibility].append(int(card[\"value\"]))\n elif card[\"value\"] == \"A\":\n for possibility in...
[ "0.7345715", "0.6820116", "0.6792824", "0.67184216", "0.6671203", "0.6506451", "0.648527", "0.6457946", "0.64482373", "0.63901895", "0.63653654", "0.6356537", "0.63349295", "0.63116616", "0.63022965", "0.63019645", "0.62861043", "0.6262797", "0.62608933", "0.6257797", "0.6253...
0.7179427
1
Convert to jsonifyable dictionary.
def to_dict(self): print("\n\nSTARTING...") ea = db.session.query(entity_assets).filter(entity_assets.c.entity_id == self.id).all() print("\n\nmade it", ea) em = db.session.query(entity_meters).filter(entity_meters.c.entity_id == self.id).all() est = db.session.query(entity_statu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_dict(self) -> dict:", "def to_json(self) -> Dict[str, Any]:\n return self.__dict__", "def json(self) -> Dict[str, Union[List, Dict, str, int, float]]:", "def convert_to_json(self):\n return self.__dict__", "def to_dict(self, data):\n return json.loads(json.dumps(data))", "def ...
[ "0.749095", "0.7483248", "0.7391134", "0.73811585", "0.7361108", "0.72996116", "0.7164284", "0.7152736", "0.71295935", "0.70000273", "0.6992031", "0.69914335", "0.69574475", "0.6900836", "0.68706214", "0.68675035", "0.6857552", "0.68555397", "0.68414974", "0.6832031", "0.6832...
0.0
-1
this fnc made for test because we need user input but intest it cant typing itself os it need to call patch module but it need to create a sperate function and call it in function that we want to use
def inask(question: str) -> str: answer = input(question) return answer
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_main_gc_2(test):\n answers = (i for i in (test, '1 1 1 1', 'q'))\n with mock.patch.object(builtins, 'input', lambda _: next(answers)):\n g_c.main()", "def test_111(self):\n user_input = [\"1\",\"1\",\"1\"]\n with patch(\"builtins.input\", side_effect=user_input) as input_call:...
[ "0.60000163", "0.596667", "0.5931788", "0.5911655", "0.58867043", "0.5871372", "0.57529557", "0.5751793", "0.57436305", "0.57372427", "0.57297534", "0.5723434", "0.5711433", "0.5695959", "0.5677015", "0.56619185", "0.56531984", "0.55036503", "0.5501072", "0.549215", "0.548908...
0.0
-1
init draft draft_file (str) draft_work (list) if user did not have draft.json it will return None
def __init__(self, path: str, filename: str, draft: dict) -> None: self.draft_file = draft["fileDraft"] self.draft_out = draft["outputDraft"] self.pre_data = None self.filename = filename
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_save_draft():\n with open(basedir + \"fixture/7149593_formatted.json\", \"r\") as f:\n storage.save_draft(user_id, \"bib\", \"7149593\", f.read(), \"1362044230872\")\n with open(basedir + \"some/path/\" + user_id + \"/bib/7149593\", \"r\") as f:\n json_data = json.loads(f.read())\n ...
[ "0.5677488", "0.5291713", "0.5274986", "0.5244381", "0.5198095", "0.51400155", "0.50597966", "0.5025025", "0.49975803", "0.49552223", "0.49455118", "0.4918419", "0.49164775", "0.49087638", "0.49034452", "0.48699167", "0.4825065", "0.4804959", "0.47942033", "0.47536626", "0.47...
0.6959813
0
prepare filename to dict
def _filename_pre_data(self) -> dict: key = [] remainder = "" prework = {} for i in self.draft_file: if i == "{": remainder = "" elif i == "}": key.append(remainder) else: remainder += i list_file...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def file_to_dictionary():\n\n return;", "def make_file_dict():\r\n fileDict = {'pageUrls': [],\r\n 'pageFileNames': [],\r\n 'pageIds': [],\r\n 'fileUrls': [],\r\n 'fileIds': [],\r\n 'fileNames': [],\r\n 'cssUrls': [],...
[ "0.71812004", "0.6705322", "0.6690661", "0.66186893", "0.6445358", "0.64392036", "0.64164746", "0.6411736", "0.63395435", "0.6329124", "0.6299308", "0.61634296", "0.6087172", "0.6072993", "0.60555255", "0.60460156", "0.60145646", "0.59737724", "0.5971008", "0.59170955", "0.59...
0.6893264
1
make that studect_data(dict) ready for the next step by get the output draft and set it into student_data and have its value is "N/"A
def prepare_student_data(self) -> dict: self._filename_pre_data() empty_student = {} empty_student["scoreTimestamp"] = "N/A" for i in self.draft_out: empty_student[i] = "N/A" for i in self.pre_data: empty_student[i] = self.pre_data[i] self.pre_data...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _build_student_data(self, data, csvwriter):\n url_base = data['base_url']\n course_id = data['course']\n is_resumen = data['format']\n course_key = CourseKey.from_string(course_id)\n if is_resumen:\n header = ['Username', 'Email', 'Run', 'Seccion', 'SubSeccion', 'U...
[ "0.6489561", "0.6420505", "0.62448007", "0.5916584", "0.577582", "0.5774251", "0.56840724", "0.5663926", "0.5551127", "0.5542213", "0.54767984", "0.5294155", "0.5282048", "0.5276514", "0.5263904", "0.5198079", "0.51527464", "0.51271755", "0.5115177", "0.5107831", "0.5105366",...
0.7730551
0
get data form user and set into student data(dict)
def data_input(self, post_student_data: dict) -> dict: for i in post_student_data: if post_student_data[i] == "N/A": while True: if i == "scoreTimestamp": post_student_data[i] = int(round(time.time() * 1000)) break...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def student_view_data(self):\n def get_student_profile_data():\n # pylint: disable=no-member\n \"\"\"\n Returns profile data for all students on the course.\n \"\"\"\n try:\n regexp_string = self.regexp_from_users_included_email(self.user...
[ "0.67464226", "0.66404426", "0.6622056", "0.6347945", "0.6245057", "0.62142384", "0.6205935", "0.615984", "0.61378896", "0.61116576", "0.6104827", "0.6083482", "0.6057624", "0.5952726", "0.5943629", "0.5928082", "0.5885253", "0.5879775", "0.58410686", "0.58036226", "0.5772137...
0.6305316
4
ask user for student data
def ask(self) -> data_input: print("===========================") post_student_data = self.pre_data for i in post_student_data: if post_student_data[i] != "N/A": print(f"{i}: {post_student_data[i]}") print("===========================") post_data = sel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n student_info = prompt_student()\n display_student(student_info)", "def prompt_student():\n # user prompts\n f_name = input('Please enter your first name: ')\n l_name = input('Please enter your last name: ')\n s_id = int(input('Please enter your id number: '))\n\n # creates a ne...
[ "0.71365875", "0.68289113", "0.67440414", "0.6611434", "0.657059", "0.65320116", "0.6474956", "0.64589435", "0.6430051", "0.63646716", "0.6351014", "0.6342025", "0.63141805", "0.63013244", "0.62784135", "0.62527335", "0.62441015", "0.6243171", "0.62387955", "0.6225735", "0.61...
0.66810966
3
Runs classmethods according to the input parameters.
def run_parsing(self): if self.version: print(f'"{VERSION}"') return VERSION elif self.limit is not None and self.limit <= 0: print("Limit must be greater than 0!") return "Limit must be greater than 0!" elif self.date: if len(str(self...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_test_class(self, ClassName):\n tests = ClassName(\n self.model,\n self.parameter_values,\n self.disc,\n self.solution,\n self.operating_condition,\n )\n tests.test_all()", "def run_methods(self):\n results = {}\n me...
[ "0.64773834", "0.6194458", "0.612699", "0.6097567", "0.6065442", "0.60520273", "0.60313284", "0.59927815", "0.59875256", "0.59539783", "0.58946216", "0.58850116", "0.58268774", "0.58260775", "0.58240694", "0.5815849", "0.5781631", "0.5753776", "0.5736039", "0.57344794", "0.57...
0.0
-1
Method gets content of the RSS feed and converts it to XML. If URL is wrong returns exception.
def get_content(self): try: self.print_if_verbose( f"Method 'get_content' is working: \n" f"Trying to get content from RSS source: {self.source} ..." ) rss_xml = urlopen(self.source).read().decode("utf-8") self.news_amount = rss_xm...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def request_rss(self, url):\n return feedparser.parse(url)", "def get_feed(self):\n possible_endings = ('rss', 'rss/')\n if not self.url or not self.url.endswith(possible_endings):\n print('Please check URL(is RSS?) and Internet connection')\n sys.exit()\n try:\n ...
[ "0.7589636", "0.7390871", "0.73857987", "0.69300675", "0.681616", "0.65743273", "0.6510668", "0.6483486", "0.64016354", "0.6348268", "0.6312308", "0.6298152", "0.6253646", "0.6192138", "0.6180068", "0.61718124", "0.6167248", "0.61640453", "0.6153321", "0.6140984", "0.61041224...
0.684713
4
Method gets XML element and converts it to dict.
def process_content(self, channel) -> dict: self.print_if_verbose(f"Method 'process_content' is working:") if self.limit is None or self.limit >= self.news_amount: self.limit = self.news_amount rss_feed = {} rss_feed["Feed"] = channel.findtext('title') rss_feed["De...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_el_dict(activity_name, element):\n set_xml()\n element_dict = activity.get(activity_name).get(element)\n print(element_dict)\n return element_dict", "def __get_el_dict(activity_name, element_name):\n __set_xml()\n element_dict = activity.get(activity_name).get(element_name)\n return ...
[ "0.75600344", "0.75184923", "0.6895443", "0.6887687", "0.6611917", "0.63355374", "0.6308879", "0.62345254", "0.61984074", "0.6177131", "0.60915977", "0.607099", "0.6038045", "0.5996926", "0.5996239", "0.59638584", "0.5933457", "0.5915614", "0.5885475", "0.58365715", "0.583657...
0.0
-1
Method saves RSSfeed content to cache.
def save_news_to_cache(self, rss_feed): self.print_if_verbose( f"Method 'save_news_to_cache' is working: \n" f"Saving news to cache... \n" ) rss_feed_to_cache_title = self.source if not os.path.exists("cache"): os.mkdir("cache") os.chdir("ca...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_cache(feed):\n if ARGV.get(NOCACHE_OPT):\n return\n CACHE['feed'] = feed\n CACHE['last-request'] = str(time.time())\n CACHE['max-age'] = feed.headers['Cache-Control'].split('=')[1]\n save_datfile()", "def add_to_cache(self, content: Content):\n cache = self.cache\n c...
[ "0.67586154", "0.6627388", "0.6459616", "0.63490593", "0.62718034", "0.62651795", "0.6241656", "0.6175605", "0.617538", "0.61674666", "0.61565787", "0.58985907", "0.5897402", "0.58390415", "0.5832458", "0.58263427", "0.5811275", "0.58038193", "0.57993054", "0.5782869", "0.574...
0.73235667
0
Method saves images to local image_cache
def save_image_to_image_cache(self, image_url, image_name): self.print_if_verbose( f"Method 'save_image_to_image_cache' is working: \n" f"Saving image to image_cache... \n" ) os.chdir("image_cache") try: urlretrieve(image_url, image_name) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cache(self):\n\t\tprint self.url\n\t\tif self.url and not self.streetimage:\n\t\t\tresult = urllib.urlretrieve(self.url)\n\t\t\tfname = os.path.basename(self.url).split('&')[-1]+\".jpg\"\n\t\t\tprint 'fname = ', fname, 'result = ', result\n\t\t\tself.streetimage.save(fname, File(open(result[0])))\n\t\t\tself.s...
[ "0.7162924", "0.696713", "0.6893315", "0.68605286", "0.6816649", "0.6638263", "0.66211474", "0.6558931", "0.6538121", "0.6499858", "0.64770514", "0.6462724", "0.6439817", "0.64209604", "0.6399955", "0.6393154", "0.63581383", "0.6332679", "0.63150334", "0.62993383", "0.629635"...
0.7229129
0
Method gets content from cache and converts it to list.
def get_content_from_cache(self): rss_feed = [] news_to_show = 0 try: self.print_if_verbose( f"Method 'get_content_from_cache' is working: \n" f"Trying to get content from cache..." ) os.chdir("cache") except Exception...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def get() -> list:\n if _cache is None:\n await _update()\n return _cache", "def get(self):\n if path.exists(self.cachefile):\n self.invalidion()\n full_cache = self._get_all()\n return full_cache\n else:\n return []", "def getCacheCo...
[ "0.7287074", "0.7173358", "0.70179826", "0.67280906", "0.6566055", "0.6531295", "0.634033", "0.6329253", "0.6320799", "0.6245494", "0.6172922", "0.6124554", "0.6120082", "0.61168504", "0.60797656", "0.60768974", "0.60223424", "0.60223424", "0.60223424", "0.60223424", "0.60222...
0.6955499
3
Method prints RSSfeed content in standard format.
def print_content(self, rss_feed): self.print_if_verbose( f"Method 'print_content' is working: \n" f"Print information about RSS-feed: \n" ) for key in rss_feed: if type(rss_feed[key]) != list: print(f"{key}: {rss_feed[key]}") print(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def output(self):\n feed = []\n feed.append('''<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n <?xml-stylesheet href=\"http://www.blogger.com/styles/atom.css\" type=\"text/css\"?>\n <feed version=\"%(version)s\" xmlns=\"http://purl.org/atom/ns#\" xml:lang=\"%(lan...
[ "0.69217837", "0.6848304", "0.67503965", "0.6540545", "0.6479408", "0.63609755", "0.62872815", "0.604937", "0.60263556", "0.60063654", "0.5867962", "0.57046604", "0.5669589", "0.56494915", "0.55631423", "0.5525209", "0.55078566", "0.5471238", "0.54546905", "0.5432877", "0.541...
0.79999995
0
Method prints RSSfeed content in JSON format.
def print_json_content(self, rss_feed): self.print_if_verbose( f"Method 'print_json_content' is working: \n" f"RSS feed will be printed in JSON format: \n" ) json_content = json.dumps(rss_feed, indent=3) print(json_content) self.print_if_verbose(f"Metho...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_content(self, rss_feed):\n\n self.print_if_verbose(\n f\"Method 'print_content' is working: \\n\"\n f\"Print information about RSS-feed: \\n\"\n )\n\n for key in rss_feed:\n if type(rss_feed[key]) != list:\n print(f\"{key}: {rss_feed[ke...
[ "0.70555997", "0.64175785", "0.64175785", "0.6284882", "0.6267104", "0.6229609", "0.61915755", "0.6137583", "0.58659434", "0.5838001", "0.5723957", "0.57200825", "0.5677733", "0.5626589", "0.5596967", "0.5479984", "0.5475434", "0.543073", "0.54114175", "0.5400201", "0.5398685...
0.8396723
0
Method prints RSSfeed content from cache.
def print_content_from_cache(self, rss_feed): self.print_if_verbose(f"Method 'print_content_from_cache' is working: \n") for news in rss_feed: for key in news.keys(): print(f"{key}: {news[key]}") print() self.print_if_verbose(f"Method 'print_content_fro...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_content_from_cache(self):\n\n rss_feed = []\n news_to_show = 0\n\n try:\n self.print_if_verbose(\n f\"Method 'get_content_from_cache' is working: \\n\"\n f\"Trying to get content from cache...\"\n )\n os.chdir(\"cache\")\n ...
[ "0.6982981", "0.64359665", "0.6297086", "0.61537176", "0.5946821", "0.5885559", "0.58853716", "0.5868752", "0.58248276", "0.57419926", "0.5715743", "0.5712399", "0.57096833", "0.56506985", "0.5642677", "0.5574007", "0.55680573", "0.55316573", "0.55299604", "0.55256534", "0.54...
0.83626264
0
Method prints logs to stdout
def print_if_verbose(self, log): if self.verbose: print(log) return log
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log(self, *args):\n self.log_stdout(*args)\n print(*args, file=self.general_log_file.file)\n self.general_log_file.flush()", "def PrintLogs(self) -> None:\n assert self.Finished()\n for f, stream_name in (\n (self.stdout, \"STDOUT\"), (self.stderr, \"STDERR\")):\n f.flu...
[ "0.76321125", "0.7469357", "0.7286969", "0.7198565", "0.71786773", "0.7098051", "0.6855569", "0.68315417", "0.6798937", "0.6730275", "0.67166114", "0.6708592", "0.6638024", "0.6633471", "0.6632932", "0.6629533", "0.662067", "0.66190934", "0.66034806", "0.65940773", "0.6569787...
0.0
-1
Method converts date to format "%Y%m%d" if format of the date is in "possible_datetime_formats", else returns date unchanged.
def get_formatted_date(self, date): formatted_date = date possible_datetime_formats = [ "%Y-%m-%dT%H:%M:%S%z", # "2021-10-19T16:46:02Z" "%a, %d %b %Y %H:%M:%S %z", # "Tue, 19 Oct 2021 21:00:13 +0300" "%a, %d %b %Y %H:%M:%S %Z", # "Tue, 19 Oct 2021 18:54:00 GMT" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def date_format_correct(self):\n valid_format = True\n try:\n new_val = self.date_edit.text()\n datetime_object = datetime.strptime(new_val, \"%Y-%m-%d\")\n except BaseException:\n valid_format = False\n return valid_format", "def convert_date(self, da...
[ "0.6769846", "0.6541767", "0.6534601", "0.63497317", "0.6287422", "0.62583554", "0.6258047", "0.62580156", "0.62022954", "0.6196835", "0.6192632", "0.61566573", "0.61417395", "0.6123462", "0.6105762", "0.6104587", "0.60866493", "0.6068869", "0.6066987", "0.6055134", "0.604416...
0.6154808
12
Method saves RSSfeed content to HTMLfile. If path is wrong returns exception.
def save_to_html(self, rss_feed, date=None): self.print_if_verbose(f"Method 'save_to_html' is working: \n") add_to_html_file = "<!DOCTYPE html>\n<html lang='en'>\n<head>\n<meta charset='UTF-8'>\n</head>\n<body>\n" if not os.path.exists(self.to_html_path): try: os.m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_news_in_html_file(news, path_to_html, logger):\n check_path_to_directory(path_to_html, logger)\n html_file = tags.html(title='RSS news')\n html_file.add(tags.head(tags.meta(charset='utf-8')))\n\n logger.info('Converting news to html format...')\n for article in news:\n html_factory(a...
[ "0.70882803", "0.6659082", "0.6444682", "0.6379773", "0.6294752", "0.6192147", "0.610183", "0.60757816", "0.60023487", "0.5964989", "0.59016937", "0.5819117", "0.58073294", "0.5782866", "0.5758187", "0.57215035", "0.56917626", "0.56676036", "0.56220895", "0.56053066", "0.5592...
0.75413376
0
Method converts a news to HTMLformat.
def add_to_html(self, news: dict) -> str: add_to_html_file = "" add_to_html_file += f"<h2>Title: {news['Title']}</h2>\n" add_to_html_file += f"<a href={news['Link']}>Link to news</a><br>\n" add_to_html_file += f"<p>PubDate: {news['PubDate']}</p>\n" add_to_html_file += f"<p>Sourc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_to_html(self, news_list):\n self.logger.info(\"Converting news to HTML...\")\n self.prepare_storage()\n self.process_news_list_with_images(news_list)\n content = self.generate_html_template(news_list)\n self.write_to_file(content.encode(\"UTF-8\"))", "def convert_ht...
[ "0.7749601", "0.70121133", "0.6875486", "0.66495407", "0.6365921", "0.62624204", "0.6246973", "0.6110563", "0.5929288", "0.5882961", "0.5868945", "0.5861875", "0.58461696", "0.5827368", "0.5789063", "0.5754645", "0.5731008", "0.5714564", "0.56914157", "0.56863284", "0.5672449...
0.65101534
4
Method saves RSSfeed content to FB2file. If path is wrong returns exception.
def save_to_fb2(self, rss_feed, date=None): self.print_if_verbose(f"Method 'save_to_fb2' is working: \n") if not os.path.exists(self.to_fb2_path): try: os.makedirs(self.to_fb2_path) except Exception as error: print(f"Exception {error} - wrong pat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_to_file(self, content):\n try:\n with open(self.full_path_to_file, \"wb\") as fp:\n fp.write(content)\n except PermissionError:\n logging.error(\n \"Conversion cannot be performed. Permission denied for this directory\"\n )\n ...
[ "0.6336935", "0.6105859", "0.5953287", "0.59252447", "0.58727354", "0.5848965", "0.5748638", "0.57357615", "0.57232815", "0.57130784", "0.5701286", "0.56320465", "0.5586502", "0.5526823", "0.5505389", "0.55029744", "0.54756254", "0.54639256", "0.5439159", "0.5437611", "0.5437...
0.73413247
0
Method converts a news to FB2format.
def add_to_fb2(self, news: dict) -> str: add_to_fb2_file = "" add_to_fb2_file += f" <p>Title: {news['Title']}</p>\n" add_to_fb2_file += f" <p><a l:href='{news['Link']}'> 'Link to news' </a></p>\n" add_to_fb2_file += f" <p>PubDate: {news['PubDate']}</p>\n" add_to_f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_news(news):\r\n news = re.sub(r\"[<>]|=+\", \" \", news)\r\n news = re.sub(r\"-{2,}|/{2,}\", \" \", news)\r\n news = re.sub(r\"\\(.+?\\)\", \" \", news)\r\n news = re.sub(r\"\\s+\", \" \", news)\r\n return news", "def save_to_fb2(self, rss_feed, date=None):\n\n self.print_if_verb...
[ "0.6300344", "0.6065771", "0.5977929", "0.575112", "0.57443106", "0.57018936", "0.5690105", "0.56440276", "0.56249213", "0.56196296", "0.56100756", "0.55982596", "0.55377096", "0.55372685", "0.5521784", "0.5518923", "0.55061096", "0.54895186", "0.54895186", "0.5396291", "0.53...
0.6049749
2
Returns the field names in the same order as str()
def fieldNames(): return ( "totalValue", "totalValueStd", "mean", "meanStd", "variance", "varianceStd", "skew", "skewStd", "kurtosis", "kurtosisStd" )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_field_names() -> Sequence[str]:\n raise NotImplementedError", "def get_field_names(self):\n return {rv[0] for rv in self.iter_fields()}", "def field_names(self):\n return self.base_field_names() + list(self.data.keys())", "def field_names(self):\n ...", "def field_names(...
[ "0.82322943", "0.8167811", "0.8023562", "0.80067897", "0.7826049", "0.7809036", "0.77826476", "0.7728658", "0.7668442", "0.76414555", "0.7573801", "0.7390122", "0.7305378", "0.7290598", "0.7258827", "0.7254", "0.7249135", "0.72328836", "0.72208977", "0.7136987", "0.70926833",...
0.6830779
27
Tuple of member data incl. uncertainty for export.
def fields(self): return (self._total + self._mean + self._variance + self._skew + self._kurtosis)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unpack(self) -> Tuple[list, list, list, list, float, int, list]:\n # (nice to have) todo:refactor --> as a namedtuple\n unpacked_super = super().unpack()\n\n observations, actions, rewards, Q_values, trajectory_return, _trajectory_lenght = unpacked_super\n\n return observations, act...
[ "0.6213964", "0.6204447", "0.59384376", "0.57277507", "0.5707521", "0.5554493", "0.55509335", "0.5544605", "0.5535825", "0.55020016", "0.5489144", "0.5479862", "0.5433677", "0.5431568", "0.5417379", "0.5414188", "0.54121655", "0.5411566", "0.53934836", "0.5382212", "0.5382212...
0.55766004
5
Calculate contributions mask to be within the given value range.
def _setValidRange(self, contribs, valueRange): testfor(contribs.ndim == 2, ValueError) numContribs, numReps = contribs.shape self._validRange = np.zeros_like(contribs.T, dtype = bool) for ri in range(numReps): # the single set of R for this calculation rset = con...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _mask_for_values_between_exponent_limits(self):\n mask_between_exp_limits = None\n new_exp_lower = new_exp_upper = None\n if self.exp_lower is not None:\n new_exp_lower = self.exp_lower + 1\n if self.exp_upper is not None:\n new_exp_upper = self.exp_upper - 1\n...
[ "0.6139728", "0.5778516", "0.5743647", "0.5667564", "0.5649735", "0.5611406", "0.5567767", "0.55613536", "0.5501029", "0.54364896", "0.54216534", "0.5400132", "0.5389187", "0.5379457", "0.53776085", "0.5347557", "0.5343009", "0.53155017", "0.53128374", "0.5302718", "0.5296207...
0.60455686
1
Calculates the moments of the distribution of the current particular (implied) parameter.
def _calcMoments(self, contribs, fraction): numContribs, numReps = contribs.shape val = np.zeros(numReps) mu = np.zeros(numReps) var = np.zeros(numReps) skw = np.zeros(numReps) krt = np.zeros(numReps) # loop over each repetition for ri in range(numReps): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def moments(self):", "def calc_moments(distribution):\n x = torch.linspace(2, 22, 31)\n d_mean = torch.sum(x * distribution)\n d_var = torch.sum(distribution * (x - d_mean) ** 2) \n \n return d_mean, torch.sqrt(d_var)", "def moment(self, n, mu, sigma):\n return scipy_norm.moment(n, mu, si...
[ "0.68563664", "0.6402003", "0.6158102", "0.6069788", "0.60613734", "0.5964357", "0.5932727", "0.5914467", "0.59122914", "0.58807665", "0.58597636", "0.5813083", "0.581118", "0.58006424", "0.57764125", "0.57536584", "0.57454926", "0.57426", "0.5733544", "0.5727761", "0.5726019...
0.0
-1
Sets it to the first available option by default.
def xscale(self, kind): self._xscale = str(kind).strip() # remove whitespace eventually if self._xscale not in self.xscaling(): self._xscale = self.xscaling(1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def _opt_default(self, ctx, option):\n try:\n guild_options = self.database.get_guild_options(ctx.guild.id)\n setattr(guild_options, option, None)\n self.database.save_item(guild_options)\n await ctx.send(f\"Option {option} set to default\")\n except ...
[ "0.71261716", "0.66823363", "0.6678832", "0.6494152", "0.638087", "0.63636804", "0.628238", "0.62773716", "0.62408084", "0.62408084", "0.62408084", "0.62408084", "0.6227838", "0.6217609", "0.62013143", "0.6193903", "0.6130184", "0.61205834", "0.61205834", "0.6114318", "0.6108...
0.0
-1
Lower limit in display units including the unit text.
def lowerDisplay(self): return "{0:g} ({1})".format(self._param.toDisplay(self.lower), self._param.displayMagnitudeName())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_display_size(self):\n return '%d MB' % self.size if self.size < 1024 else '%.2f GB' % (self.size / 1024.0)", "def unit_of_measurement(self):\n return \"%\"", "def units(self):\n pass", "def unit_of_measurement(self):\n return '%'", "def unit_of_measurement(self) -> str:\n ...
[ "0.68737787", "0.6705744", "0.6617617", "0.65782964", "0.6403219", "0.6403219", "0.6349418", "0.62952155", "0.62344605", "0.6159931", "0.6157702", "0.61567926", "0.6149927", "0.6146399", "0.6140932", "0.61266", "0.61061746", "0.6068677", "0.605865", "0.5996165", "0.5980514", ...
0.6856167
1
Upper limit in display units including the unit text.
def upperDisplay(self): return "{0:g} ({1})".format(self._param.toDisplay(self.upper), self._param.displayMagnitudeName())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_display_size(self):\n return '%d MB' % self.size if self.size < 1024 else '%.2f GB' % (self.size / 1024.0)", "def unit_of_measurement(self):\n return \"%\"", "def unit_of_measurement(self):\n return '%'", "def units(self):\n pass", "def unit_of_measurement(self) -> str:\n ...
[ "0.70054436", "0.6769809", "0.6708141", "0.6669131", "0.65528774", "0.65528774", "0.65095055", "0.6420288", "0.6403162", "0.63651204", "0.63568985", "0.6297604", "0.62844765", "0.62185395", "0.6201521", "0.6183936", "0.61839217", "0.6120024", "0.611906", "0.6106219", "0.60859...
0.7146413
0
Restricts histogram range according to changed parameter range if needed. Checks histogram range against parameter limits.
def updateRange(self): if self.autoFollow: self.xrange = self.param.activeRange() self.xrange = self.xrange # call getter & setter again to verify limits
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def autoHistogramRange(self):\n self.vb.enableAutoRange(self.vb.XAxis, True)\n self.vb.enableAutoRange(self.vb.YAxis, True)\n # self.range = None\n # self.updateRange()\n # self.vb.setMouseEnabled(False, False)\n\n # def updateRange(self):\n # self.vb.autoRange()\n ...
[ "0.68070877", "0.663788", "0.6523232", "0.6398338", "0.63696873", "0.63696873", "0.63291216", "0.6299463", "0.60977095", "0.60977095", "0.6090064", "0.60784125", "0.5962637", "0.5954221", "0.5932417", "0.5870318", "0.586771", "0.5864656", "0.5857545", "0.5852148", "0.5813075"...
0.5693101
25
Descriptive text of fields for UI display.
def displayDataDescr(cls): return ( "Parameter", "Auto range", "Lower", "Upper", "Number of bins", "X-axis scaling", "Y-axis weighting" )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def description(self):", "def displayField(self):\n print(\"Field :\")\n for i in range(len(self.field)):\n currentSuit = Suit(i + 1)\n print(Bcolor.BOLD + Suit.toColor(currentSuit) + \"\\t\" + str(currentSuit), self.field[i], end=\"\\t\" + Bcolor.END)\n print()", "de...
[ "0.6875522", "0.67876977", "0.6738545", "0.67317694", "0.67317694", "0.6706509", "0.6705255", "0.6658271", "0.65845865", "0.65845865", "0.6545622", "0.649939", "0.64937603", "0.6486334", "0.6432132", "0.64196366", "0.63851905", "0.6357764", "0.6353186", "0.6350117", "0.634400...
0.616597
40