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
Same as fit(), only this time fix gamma and vary the scaling parameters M, N.
def fit_experimental(self, m_tokens: np.ndarray, n_types: np.ndarray, gamma: float): # initial guess M = m_tokens.max() N = n_types.max() p0 = (M, N) # fix gamma, but fit M, N to the data xdata = np.array(m_tokens) ydata = np.array(n_types) def func(m, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fit(self, M=10, N=100):\n\n # determine Beta and Gamma\n diffBeta = diffGamma = 1e5\n for itr in range(1,N+1):\n print(\"Fisher Updation : {}\".format(itr))\n converge_Beta = diffBeta < DoubleGLM.Converge\n converge_Gamma = diffGamma < DoubleGLM.Converge\n ...
[ "0.7009402", "0.66039926", "0.65707844", "0.6531312", "0.6080446", "0.6067638", "0.59525573", "0.5908823", "0.58356297", "0.57312196", "0.5656949", "0.56371266", "0.5622519", "0.5606728", "0.56053764", "0.5600286", "0.5597048", "0.55889964", "0.55802816", "0.5578507", "0.5571...
0.614702
4
Calculate & return n_types = N formula(m_tokens/M)
def predict(self, m_tokens: np.ndarray, nearest_int: bool = True) -> np.ndarray: # allow scalar return_scalar = np.isscalar(m_tokens) m_tokens = np.array(m_tokens).reshape(-1) # redirect: E(m) = N * formula(m/M) n_types = self.N * self.formula(m_tokens / self.M) # roun...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def number_types(corpus):\n number_of_types = len(set(corpus))\n return number_of_types", "def _get_token_cnts(self, doc, doc_type):\n tokenized_doc = self.nlp(doc)\n self.stat_dict[doc_type][0].append(len([s for s in tokenized_doc.sents]))\n doc_len = len([t for t in tokenized_doc])\n...
[ "0.67526203", "0.62566036", "0.62371844", "0.5901608", "0.5888075", "0.58496165", "0.57824427", "0.5770406", "0.5752158", "0.5723402", "0.571023", "0.5654798", "0.5651176", "0.56446815", "0.5636102", "0.5617561", "0.558259", "0.5553394", "0.5552679", "0.5541281", "0.5538353",...
0.634425
1
Equivalent to fit(m_tokens, n_types).predict(m_tokens)
def fit_predict(self, m_tokens: np.ndarray, n_types: np.ndarray) -> np.ndarray: # fit and predict return self.fit(m_tokens, n_types).predict(m_tokens)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def predict_tokens(self, tokens):\n return", "def predict(self, m_tokens: np.ndarray, nearest_int: bool = True) -> np.ndarray:\n\n # allow scalar\n return_scalar = np.isscalar(m_tokens)\n m_tokens = np.array(m_tokens).reshape(-1)\n\n # run model\n K, B = self.params\n ...
[ "0.7781518", "0.73240215", "0.7084659", "0.7001472", "0.6887836", "0.6869992", "0.6573101", "0.65558875", "0.6472882", "0.6406988", "0.6373421", "0.6328009", "0.63156056", "0.62392", "0.62203497", "0.6218441", "0.62113047", "0.61780936", "0.6171465", "0.6155943", "0.6139154",...
0.8682314
1
The bag of words, listlike of elements of any type.
def tokens(self) -> list: if self._tokens is None: tokens_ = sorted(list(self.elements())) self._tokens = tokens_ return self._tokens
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bagOfWords(self,phrase):\n return self._support.bagOfWords(phrase)", "def bagOfWords(self):\n if self._bow is None:\n self._bow = {}\n for word in self._words:\n if word['word'] in self._bow:\n self._bow[word['word']] += 1\n ...
[ "0.79047793", "0.7136931", "0.6737468", "0.6510284", "0.6507203", "0.6482501", "0.6482501", "0.6442788", "0.6363518", "0.61131364", "0.60773015", "0.60773015", "0.60743415", "0.60694146", "0.6062248", "0.60533744", "0.6009823", "0.59903455", "0.59698325", "0.5932865", "0.5902...
0.0
-1
The lexicon, ranked by frequency.
def types(self) -> list: if self._types is None: fdist = self.fdist # ranked order types_ = list(fdist.type.values) self._types = types_ return self._types
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_freqs(self):\n dictionary = {}\n for word in self.word_list:\n if word in dictionary:\n dictionary[word] += 1\n else:\n dictionary[word] = 1\n letter_sorted = sorted(dictionary.items(), key=lambda entry: entry[0]) #sorts dictionary ...
[ "0.62368214", "0.62107235", "0.61713415", "0.59072626", "0.58206505", "0.58105433", "0.578898", "0.57820475", "0.572781", "0.57198226", "0.57109106", "0.56773496", "0.56420904", "0.56307787", "0.5620338", "0.5560785", "0.5552102", "0.5548115", "0.55412704", "0.5535327", "0.55...
0.0
-1
The frequency distribution, as a dataframe.
def fdist(self) -> pd.DataFrame: df = pd.DataFrame.from_dict(self, orient="index").reset_index() df.columns = ["type", "freq"] df = df.sort_values("freq", ascending=False).reset_index(drop=True) df.index = df.index + 1 df.index.name = "rank" return df
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def kdf(self) -> pd.DataFrame:\n k = self.k\n df = pd.DataFrame({\"freq\": k})\n df = df.query(\"freq > 0\")\n return df", "def freq_table(a):\n Detail_freq = a.loc[:, (a.dtypes == object) | (a.dtypes == long) ].columns.get_values().tolist()\n print(Detail_freq)\n for freq in...
[ "0.7015139", "0.70034003", "0.69050044", "0.67988557", "0.66653955", "0.6634818", "0.6430949", "0.6413127", "0.63767004", "0.6323943", "0.62729007", "0.6254082", "0.6240195", "0.6230129", "0.62288827", "0.62209", "0.61965597", "0.6145627", "0.61223084", "0.6080821", "0.602591...
0.7425145
0
Word Frequency Distribution, as a dataframe.
def WFD(self) -> pd.DataFrame: return self.fdist
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def word_frequency(book):\n unique_dict = unique_words(book)\n\n word_array = pd.DataFrame(list(unique_dict.items()), columns=['Word', 'Occurence'])\n\n return word_array", "def gen_bag_of_words_df(self):\n\t\tdef word_vector(doc_text):\n\t\t\tfreqs = pd.Series(collections.Counter(doc_text.split()))\n\t...
[ "0.77551967", "0.703563", "0.70219326", "0.6889847", "0.68569183", "0.6798403", "0.6781964", "0.66619533", "0.6533462", "0.6527044", "0.650191", "0.64759505", "0.6424331", "0.63954175", "0.6391389", "0.6367461", "0.63445616", "0.63182276", "0.62909853", "0.6278312", "0.627525...
0.0
-1
The vector describing the frequency of nlegomena.
def k(self) -> np.ndarray: if self._k is None: self._k = Counter(self.values()) # return as array k = self._k kmax = max(k.keys()) karr = np.array([k[i] for i in range(kmax + 1)]) return karr
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def freq(self) -> int:", "def freq_vector(cls, n, fs):\n return freq_vector(n, fs, sided='single')", "def freq():", "def frequency(self) -> NumType:\n return self._freq", "def get_list_frequencies(self):\r\n return self.fs", "def nf(self): # noqa: D401\n return len(self._freq...
[ "0.75615513", "0.7411483", "0.74007624", "0.7058373", "0.70470566", "0.7041061", "0.7031087", "0.6991735", "0.6963829", "0.69044167", "0.68561155", "0.6847944", "0.67626005", "0.67521465", "0.6750632", "0.67353666", "0.6704952", "0.6691696", "0.66541374", "0.6601236", "0.6548...
0.0
-1
The frequency of nlegomena, as a dataframe.
def kdf(self) -> pd.DataFrame: k = self.k df = pd.DataFrame({"freq": k}) df = df.query("freq > 0") return df
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def freq_table(a):\n Detail_freq = a.loc[:, (a.dtypes == object) | (a.dtypes == long) ].columns.get_values().tolist()\n print(Detail_freq)\n for freq in Detail_freq:\n df1 = pd.DataFrame(a[freq].value_counts(dropna=False).astype(float).map('{:20,.0f}'.format).sort_index()).rename(columns={freq:...
[ "0.6855748", "0.6798541", "0.6741774", "0.6674704", "0.65324074", "0.6460966", "0.6400662", "0.63544863", "0.63303024", "0.63302773", "0.63004935", "0.6201374", "0.6187635", "0.61751354", "0.61735904", "0.6154796", "0.61421585", "0.61284846", "0.6078534", "0.6026069", "0.6023...
0.62839085
11
The number of tokens in the corpus.
def M(self) -> int: m_tokens = sum(self.values()) return m_tokens
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def corpus_size():\n return ix.doc_count()", "def length(self):\n return len(self.tokens)", "def get_token_count():\r\n tokens = cache.get('tokens-number')\r\n\r\n if tokens is None:\r\n tokens = 0\r\n tweets = mongo_coll_tweets.find({}, {'text': 1})\r\n for tweet in tweets:\r\...
[ "0.806606", "0.7887896", "0.77023524", "0.76616067", "0.7650494", "0.75955534", "0.75822", "0.75771636", "0.7513522", "0.7409987", "0.7341951", "0.7302427", "0.7302427", "0.7294214", "0.7235468", "0.72276926", "0.7198542", "0.7188423", "0.716213", "0.7112996", "0.70776194", ...
0.63286906
84
The number of types in the corpus.
def N(self) -> int: n_types = len(self) return n_types
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def number_types(corpus):\n number_of_types = len(set(corpus))\n return number_of_types", "def corpus_size():\n return ix.doc_count()", "def get_types_count():\n return len(type_dict.keys())", "def corpus_stats(self):\n print(\"Number of sentences: {}\".format(len(self.corpus.sents())))\n ...
[ "0.8634066", "0.7551378", "0.7305775", "0.7046758", "0.6834303", "0.6826278", "0.6794817", "0.6789365", "0.6740976", "0.6739985", "0.6602497", "0.65643173", "0.65375954", "0.6528483", "0.6514582", "0.6514582", "0.6507632", "0.64969087", "0.6494558", "0.6494558", "0.6494558", ...
0.7391774
2
Misc lowimpact options when computing the TTR curve.
def options(self) -> tuple: # UserOptions return self._options
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n super().__init__()\n self.TERRAIN_VARIANCE = 0.0", "def tp_normalization_terms(self) -> Tuple[float, ...]:\n return (\n self.tp_threshold_m,\n MAX_SCALE_ERROR,\n MAX_YAW_RAD_ERROR,\n )", "def _get_tr(cls, data):\n\t\tprev_close ...
[ "0.56601906", "0.55291677", "0.54700196", "0.54572487", "0.5432492", "0.5424084", "0.53523594", "0.5346248", "0.5336818", "0.5320287", "0.532004", "0.52685815", "0.5220859", "0.52124465", "0.52079284", "0.52079284", "0.51959765", "0.51903504", "0.51897305", "0.5173662", "0.51...
0.0
-1
The desired resolution (number of samples) of the TTR curve.
def resolution(self) -> int: return self.options.resolution
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetTimeoutScale(self):\n return 1.0", "def Resolution(self, *args):\n return _Adaptor3d.Adaptor3d_Curve_Resolution(self, *args)", "def _get_precision(self) -> float:\n precicions = [PRECISION_WHOLE, PRECISION_HALVES, PRECISION_TENTHS]\n static_info = self._static_info\n if st...
[ "0.60521173", "0.60105336", "0.59367245", "0.5923141", "0.5885568", "0.58004886", "0.5767791", "0.57620853", "0.5721305", "0.57185507", "0.56608087", "0.5654783", "0.5643189", "0.56309325", "0.56196046", "0.5619018", "0.5599963", "0.55848116", "0.5572867", "0.55679", "0.55658...
0.52401835
74
The desired dimension of the problem, include nlegomena counts for n = 0 to dim1.
def dimension(self) -> int: return self.options.dimension
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dim(self) -> int:", "def dim(self) -> int:\n pass", "def dim(self):\n raise NotImplementedError", "def n_dim(self):\n return self._n_dim", "def dim(self):\n return len(self._n)", "def dim(self):\n raise NotImplementedError()", "def dim(self):\n return (self...
[ "0.7162239", "0.70030576", "0.6902002", "0.6821285", "0.679913", "0.67311895", "0.6589778", "0.65505236", "0.65028936", "0.6496205", "0.64856654", "0.6477278", "0.6469472", "0.6457778", "0.6443905", "0.6437938", "0.6395255", "0.63650846", "0.6350618", "0.6337354", "0.632572",...
0.0
-1
Minimum tolerable rvalue for alpha/gamma fitting.
def rmin(self) -> float: return self.options.rmin
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fitGammaFun(self, x, y):\n minGamma = 0.8\n maxGamma = 20.0\n gammaGuess = 2.0\n y = numpy.asarray(y)\n minLum = y[0]\n maxLum = y[-1]\n if self.eq == 4:\n aGuess = old_div(minLum, 5.0)\n kGuess = (maxLum - aGuess)**(old_div(1.0, gammaGuess...
[ "0.63407654", "0.63026994", "0.6287014", "0.60175276", "0.60090613", "0.59669006", "0.5966791", "0.59616977", "0.5877795", "0.57783884", "0.5761651", "0.575267", "0.5742401", "0.5717993", "0.57104796", "0.56746495", "0.5667096", "0.56499827", "0.5602869", "0.5588299", "0.5584...
0.5482496
34
DataFrame of typetoken relation data.
def TTR(self) -> pd.DataFrame: if self._TTR is None: self._TTR = self._compute_TTR() return self._TTR.copy()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tree2OTU_table(mvp_tree):\n series = []\n for terminal in mvp_tree.feature_tree.get_terminals():\n try:\n series.append(terminal.sample_series)\n except:\n print('there is no sample series in tree2OTU ')\n df = pd.dataframe(series)\n return df", "def get_all_ty...
[ "0.58827794", "0.56823826", "0.5624013", "0.56088346", "0.55921096", "0.5588505", "0.5588118", "0.55807763", "0.55250126", "0.5488735", "0.54556924", "0.5430967", "0.5424438", "0.5412748", "0.5357323", "0.53376436", "0.5330537", "0.5324322", "0.52766204", "0.5269181", "0.5256...
0.0
-1
List of types occurring exactly n times in the corpus.
def nlegomena(self, n: int) -> list: nlegomena_ = [typ for typ, freq in self.items() if freq == n] return nlegomena_
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def words_used_n_times(word_count_dict, n):\n n_times = []\n # TODO 6: define this function\n return n_times", "def number_types(corpus):\n number_of_types = len(set(corpus))\n return number_of_types", "def get_word_list_with_freq_at_least_n(text, n = 2):\n word_freq_dists = get_freq_dist_fro...
[ "0.6714524", "0.6527129", "0.59584874", "0.5888055", "0.5846559", "0.5826109", "0.5826109", "0.580149", "0.57607275", "0.57391286", "0.5738133", "0.5702115", "0.56759584", "0.5675838", "0.567131", "0.5657338", "0.5640981", "0.5639966", "0.5626122", "0.5583879", "0.5564764", ...
0.6207115
2
List of hapax (words that appear exactly once)
def hapax(self): return self.nlegomena(1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def findSingletonWords(text):\n counter = collections.Counter(text.split(' '))\n return set(key for key in counter if counter[key] == 1)", "def get_only_once_occured_words(tokens):\n\n return FreqDist(tokens).hapaxes()", "def without_duplicates(words):\n words_with_number_of_times_appear = {}\n\n ...
[ "0.74249303", "0.7040619", "0.7021704", "0.69164014", "0.685625", "0.6805045", "0.6758218", "0.6692616", "0.66596305", "0.65774477", "0.6512198", "0.651194", "0.6500546", "0.6496711", "0.6471564", "0.645764", "0.62868756", "0.62331617", "0.62319994", "0.6219582", "0.6215873",...
0.0
-1
List of dis legomena (words that appear exactly twice)
def dis(self): return self.nlegomena(2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_repeated_adjectives(lyrics):\n adjectives = adjectives_sorted(lyrics)\n repeated_adjectives = [key for key, value in adjectives.most_common()\n if value > 1]\n return repeated_adjectives", "def without_duplicates(words):\n words_with_number_of_times_appear = {}\n\...
[ "0.7007671", "0.6557846", "0.6511922", "0.6324321", "0.61666095", "0.61439174", "0.60808223", "0.607123", "0.6064847", "0.60454196", "0.6035322", "0.59560263", "0.59280574", "0.5899438", "0.58737564", "0.585691", "0.58416516", "0.5834053", "0.57926893", "0.57424235", "0.57310...
0.56816626
26
List of tris legomena (words that appear exactly three times)
def tris(self): return self.nlegomena(3)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def important_words(words):\n return [x for x in words if len(x) >= 3]", "def print_3doubles():\n count_3d = 0\n for line in fin:\n word = line.strip()\n if is_3doubles(word):\n print(word)\n count_3d += 1\n print('Number of words that have three consecutive letter...
[ "0.638524", "0.636448", "0.6323874", "0.61784875", "0.61460406", "0.6089362", "0.606369", "0.60504633", "0.5986401", "0.59374803", "0.5933942", "0.5849791", "0.5847815", "0.58224094", "0.5804096", "0.579045", "0.57699424", "0.5759842", "0.5742839", "0.5725644", "0.5709586", ...
0.6295359
3
List of tetrakis legomena (words that appear exactly four times)
def tetrakis(self): return self.nlegomena(4)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def long_words(words):\n words_longer_than_four = []\n for word in words:\n if len(word) > 4:\n words_longer_than_four.append(word)\n return words_longer_than_four", "def spellingBeeSolutions(wordlist, puzzles):\n counter = []\n word_counter = 0\n\n for puzzle in puzzles:\n\n ...
[ "0.63501143", "0.62058187", "0.61091346", "0.6090198", "0.6072124", "0.6050098", "0.6045462", "0.59422415", "0.592569", "0.58884233", "0.58610547", "0.5836775", "0.58207697", "0.5820003", "0.58184505", "0.5811583", "0.58039045", "0.580003", "0.5789296", "0.578027", "0.5759076...
0.7097487
0
List of pentakis legomena (words that appear exactly five times)
def pentakis(self): return self.nlegomena(5)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def spellingBeeSolutions(wordlist, puzzles):\n counter = []\n word_counter = 0\n\n for puzzle in puzzles:\n\n for word in wordlist:\n\n if len(word) < 5 or puzzle[0][0] not in word:\n word_counter += 0\n elif not set(word).issubset(set(puzzle)):\n ...
[ "0.63574743", "0.61537546", "0.60389626", "0.60285294", "0.59958076", "0.5985367", "0.5875503", "0.58625233", "0.57821107", "0.5780373", "0.572211", "0.56892055", "0.56762123", "0.56759745", "0.5654279", "0.5650885", "0.5640835", "0.56299686", "0.5619005", "0.56152874", "0.56...
0.65256196
0
Calculate the powerlaw distribution parameter by linearly regressing log(y) ~ log(x)
def _powerlaw(self, x: np.ndarray, y: np.ndarray) -> float: # regress def _regress(x, y): slope, intercept, rval, pval, err = linregress(x, y) return slope, rval # log of inputs logx = np.log(x) logy = np.log(y) # naive fit rmin = self.r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def logpowerlaw(x, p=default()):\n xtr, ytr, gradtr = logcontinuity(p)\n power = p[3]\n x0 = xtr - power/gradtr\n b = ytr - power*np.log(xtr-x0)\n return b + power*np.log(x-x0)", "def _perplexity(self, X, log_w):\n return np.exp(-log_w/X.sum())", "def log_error(X, y, w):\r\n N = X.shap...
[ "0.7547706", "0.72815764", "0.71533996", "0.7117507", "0.70111793", "0.6898695", "0.6815277", "0.6702048", "0.66757977", "0.66714597", "0.6629532", "0.66028696", "0.6596733", "0.65886843", "0.6582827", "0.65826434", "0.65737474", "0.656805", "0.65621656", "0.6553187", "0.6520...
0.7102762
4
Bestfit powerlaw distribution parameter for wordfrequency distribution.
def alpha(self): if self._alpha is None: df = self.fdist alpha_ = -self._powerlaw(df.index, df.freq) self._alpha = alpha_ # return return self._alpha
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def weight(total_doc_count: int, doccount: int, wordfreq: int) -> float:\n return (1 + math.log(wordfreq)) * (math.log(total_doc_count / doccount))", "def test_ww_power_law_fit_directly(self):\n\n\t\t\tnp.random.seed(123)\n\t\t\tdata = np.random.pareto(2.5, 100)\n\t\t\t\n\t\t\n\t\t\tresult = WW_powerlaw.pl_fi...
[ "0.6299154", "0.62223506", "0.60453904", "0.59938824", "0.5975313", "0.588475", "0.58383644", "0.5807667", "0.580691", "0.57966554", "0.577179", "0.57661694", "0.5747873", "0.5734982", "0.5697256", "0.5630832", "0.561877", "0.5602931", "0.5602043", "0.5601106", "0.5599215", ...
0.52550924
96
Bestfit powerlaw distribution parameter for nlegomena distribution.
def gamma(self): if self._gamma is None: df = self.kdf gamma_ = -self._powerlaw(df.index, df.freq) self._gamma = gamma_ # return return self._gamma
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lnprob(theta, dtarray, dmagarray, sigmaarray):\n lp = lnprior(theta)\n\n if not np.isfinite(lp):\n #if (lp==-(10**32)):\n return -np.inf\n #return -(10**32)\n return lp +lnlike(theta, dtarray, dmagarray, sigmaarray)", "def lnprobability(self):\n return", "def mle_gamma(n):\...
[ "0.60050225", "0.59290206", "0.5856609", "0.5707104", "0.568622", "0.5653902", "0.5628147", "0.55932814", "0.557776", "0.557484", "0.5545804", "0.55385697", "0.5533278", "0.5519798", "0.5516862", "0.55131334", "0.55112755", "0.5507567", "0.5494404", "0.54595095", "0.5457159",...
0.0
-1
Entropy content of this corpus, based on wordfrequency distribution.
def entropy(self, base: int = None): # shannon entropy in nats fdist_ = self.fdist fdist_["prob"] = fdist_["freq"] / fdist_["freq"].sum() fdist_["logp"] = np.log(fdist_["prob"]) fdist_["nats"] = -fdist_["prob"] * fdist_["logp"] entropy_ = fdist_["nats"].sum() # ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def word_entropy(self, doc, lemmatized=False):\n # filter out words\n words = [token for token in doc if not token.is_punct and \"'\" not in token.text and not token.is_space]\n # create bag of words\n if lemmatized:\n list_words = [w.lemma_ for w in words]\n else:\n ...
[ "0.71550137", "0.7075918", "0.6877915", "0.6864271", "0.68232894", "0.6782823", "0.6778635", "0.67370933", "0.67321175", "0.6719566", "0.6655286", "0.66454005", "0.6627845", "0.66105163", "0.6608293", "0.65667075", "0.65590805", "0.6539854", "0.651763", "0.65124595", "0.65088...
0.58525765
92
Entropy content of this corpus in bits. Alias for corpus.entropy(base=2)
def bits(self) -> float: return self.entropy(base=2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def entropy(message):\n # Should the import be here or should it be at the top of the page?\n freq_dict = letter_freq(message)\n length_message = len(message)\n bit_entropy = 0\n for occurrences in freq_dict.values():\n frequency = occurrences / length_message\n bit_entropy = bit_entro...
[ "0.7491076", "0.7399863", "0.7320623", "0.7159664", "0.70670843", "0.7045957", "0.69883734", "0.68656015", "0.68206745", "0.6803545", "0.67884374", "0.6785398", "0.67565924", "0.6748237", "0.6730218", "0.67207277", "0.67074144", "0.6648535", "0.66484684", "0.6635924", "0.6633...
0.73236203
2
Entropy content of this corpus in nats. Alias for corpus.entropy()
def nats(self) -> float: return self.entropy()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _entropy(self):\n return self.rv.entropy(*self._pymc_dists_to_value(self.args), **self.kwds)", "def entropy(self):\n return self._normal.entropy()", "def entropy(self):\n raise NotImplementedError", "def entropy(self):\n return self._entropy_func", "def entropy(self):\n ...
[ "0.7621689", "0.7540994", "0.75289077", "0.7394473", "0.71717995", "0.69339526", "0.6920086", "0.68708897", "0.6859584", "0.685799", "0.68499535", "0.6849836", "0.6849836", "0.6843891", "0.683201", "0.6831035", "0.6810657", "0.68066424", "0.6795694", "0.6756814", "0.67478263"...
0.7286658
4
Entropy content of this corpus in bans. Alias for corpus.entropy(base=10)
def bans(self) -> float: return self.entropy(base=10)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def entropy(self):\n ent = 0.0\n for f in self.byte_freq:\n if f > 0:\n freq = float(f) / self.byte_total\n ent = ent + freq * math.log(freq, 2)\n return -ent", "def entropy(self):\n return -np.sum(self.log_likelihoods * np.exp(self.log_likelih...
[ "0.70751554", "0.7065577", "0.7030088", "0.70103115", "0.70071584", "0.6898724", "0.6885471", "0.6854623", "0.6845571", "0.6833479", "0.68299824", "0.6805772", "0.6804219", "0.67963296", "0.6787629", "0.6783454", "0.67623", "0.67574275", "0.67453134", "0.67439795", "0.6727648...
0.7201912
0
Samples either tokens or proportion of tokens and returns smaller Corpus
def sample(self, m: int = None, x: float = None): # sample m = m or int(x * self.M) seed = self.seed if seed: seed = seed + m # salt random_state = np.random.RandomState(seed) tokens = random_state.choice(self.tokens, m, replace=False) corpus = Corpu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def choose_tokens(documents, tokenizer, k=1000, max_token_fraction=1.0):\n # Select a random subset of the posts to deterimine common tokens\n token_counts = document_token_frequency(documents, tokenizer)\n\n # Remove tokens that are too common or only appear once.\n #\n # Completely ignore tokens that are to...
[ "0.6532466", "0.62119925", "0.6053086", "0.59959257", "0.59437203", "0.5918144", "0.5914303", "0.5905475", "0.59039974", "0.5891227", "0.586828", "0.58457077", "0.58437693", "0.5832004", "0.58237463", "0.57968634", "0.5788619", "0.57861835", "0.57448494", "0.57317233", "0.572...
0.55098987
38
Samples the corpus at intervals 1/res, 2/res,...1 to build a TypeToken Relation curve consisting of points
def _compute_TTR(self) -> pd.DataFrame: # user options res = self.options.resolution dim = self.options.dimension # sample the corpus x_choices = (np.arange(res) + 1) / res TTR = [self.sample(x=x).as_datarow(dim) for x in x_choices] # save to self.TTR as datafr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train(self, corpus): \n for sentence in corpus.corpus: # iterate over sentences in the corpus\n for token in sentence: # iterate over datums in the sentence\n self.unigrams[token] += 1\n self.total += 1\n V = len(self.unigrams) # vocabulary size \n for ug,count in self.unigrams....
[ "0.5874491", "0.58671075", "0.57804304", "0.56456023", "0.55978715", "0.55529207", "0.54739827", "0.54739827", "0.54463845", "0.54449224", "0.5435586", "0.5393194", "0.5391173", "0.53832495", "0.53769755", "0.5376634", "0.5370237", "0.5346179", "0.5338023", "0.52940077", "0.5...
0.0
-1
No fit() function, instantiate model as an extension of corpus.
def __init__(self, corpus: Corpus): # the legomena counts parametrize this model self.M = corpus.M self.N = corpus.N self.k = corpus.k
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, corpus):\n self.train(corpus)", "def train_with_corpus(corpus):\n\n chatbot.set_trainer(\"chatterbot.trainers.ChatterBotCorpusTrainer\")\n chatbot.train(corpus)", "def fit(self, corpus, **kwargs):\n if not len(corpus.dictionary):\n return None\n self.reset_m...
[ "0.7622122", "0.67618674", "0.6746831", "0.6603909", "0.6491007", "0.64208156", "0.6414985", "0.63691133", "0.63691133", "0.63648343", "0.6361368", "0.63341796", "0.62987226", "0.627608", "0.6252556", "0.6229855", "0.62258166", "0.62188244", "0.62176317", "0.6207785", "0.6189...
0.6193247
20
Calculate & return n_types = E(m_tokens) = Km^B
def predict(self, m_tokens: np.ndarray, nearest_int: bool = True) -> np.ndarray: # allow scalar return_scalar = np.isscalar(m_tokens) m_tokens = np.array(m_tokens).reshape(-1) # sum over legomena coefficients k x = m_tokens / self.M exponents = range(len(self.k)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def M(self) -> int:\n m_tokens = sum(self.values())\n return m_tokens", "def predict(self, m_tokens: np.ndarray, nearest_int: bool = True) -> np.ndarray:\n\n # allow scalar\n return_scalar = np.isscalar(m_tokens)\n m_tokens = np.array(m_tokens).reshape(-1)\n\n # redirect...
[ "0.6336613", "0.6152428", "0.59152997", "0.5897365", "0.58761245", "0.58518755", "0.5752618", "0.5729471", "0.5483581", "0.54251605", "0.5394446", "0.53918296", "0.5376547", "0.5374203", "0.5361404", "0.5334682", "0.5328986", "0.5317697", "0.5310449", "0.5305349", "0.528925",...
0.6008679
2
Set up a blank temp database before each test.
def setUp(self): self.db_fd, app.app.config['DATABASE'] = tempfile.mkstemp() app.app.config['TESTING'] = True self.app = app.app.test_client() app.init_db()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setUp(self):\n INFLUX_DB_NAME = 'test_device_parameters'\n EmptyDBTestCase.client.create_database(INFLUX_DB_NAME)\n EmptyDBTestCase.client.drop_database(INFLUX_DB_NAME)\n EmptyDBTestCase.client.create_database(INFLUX_DB_NAME)", "def setUp(self):\n db.drop_all() # clean up ...
[ "0.77843106", "0.77771306", "0.7653405", "0.7542947", "0.74636453", "0.742284", "0.74097896", "0.7405572", "0.7398729", "0.7378329", "0.7239845", "0.7238194", "0.7204825", "0.7201795", "0.7177115", "0.7173495", "0.7173495", "0.7173495", "0.71711636", "0.715569", "0.71481705",...
0.75357413
4
Destroy blank temp database after each test.
def tearDown(self): os.close(self.db_fd) os.unlink(app.app.config['DATABASE'])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tearDown(self):\r\n empty_db()", "def tearDown(self):\r\n empty_db()", "def tearDown(self):\r\n empty_db()", "def tearDown(self):\r\n empty_db()", "def tearDown(self):\r\n empty_db()", "def tearDown(self):\r\n empty_db()", "def tearDown(self):\n app....
[ "0.78953713", "0.78953713", "0.78953713", "0.78953713", "0.78953713", "0.78953713", "0.7880197", "0.78739846", "0.78739846", "0.78739846", "0.78739846", "0.78739846", "0.78739846", "0.78739846", "0.78739846", "0.78739846", "0.7790146", "0.7782551", "0.7782551", "0.776434", "0...
0.747593
36
Return a report that matches ``name``
def get_by_name(cls, request_handler, name) -> Optional['Report']: data = request_handler.make_request( 'GET', '/reports' ) for item in data: if item['reportName'] == name: return cls(request_handler, item, False) return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _lookup_report(self, name):\n join = os.path.join\n\n # First lookup in the deprecated place, because if the report definition\n # has not been updated, it is more likely the correct definition is there.\n # Only reports with custom parser sepcified in Python are still there.\n ...
[ "0.6853577", "0.62809956", "0.6192643", "0.59630734", "0.59579366", "0.5907598", "0.5829875", "0.5815571", "0.5706736", "0.5666769", "0.56577384", "0.5649815", "0.55669826", "0.55585176", "0.5488637", "0.5387013", "0.53585726", "0.53358823", "0.5304978", "0.5289828", "0.52720...
0.72802335
0
Check whether a report with the name (case sensitive) exists
def exists(request_handler, name) -> bool: data = request_handler.make_request( 'GET', '/reports' ) for item in data: if item['reportName'] == name: return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prompt_report_file_name(self):\n while True:\n report_file = input(\"Enter name for your report file: \")\n if os.path.isfile(report_file):\n print(\"'{}' is already exist!\".format(report_file))\n else:\n break\n return report_file",...
[ "0.6400386", "0.62383264", "0.61647785", "0.61240596", "0.5892352", "0.5886611", "0.5847345", "0.5765161", "0.5716618", "0.5715015", "0.56347984", "0.56011236", "0.5545829", "0.554371", "0.5507774", "0.55055326", "0.5505301", "0.5472425", "0.5455854", "0.54495406", "0.5425733...
0.74193585
0
Run the report ``name`` if it exists
def run(request_handler, name, generic_result_set=True, **kwargs) -> Union[List, Dict]: params = { 'genericResultSet': generic_result_set, 'pretty': False } for param in kwargs.keys(): params['R_{}'.format(param)] = kwargs[param] return request_handle...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exists(request_handler, name) -> bool:\n data = request_handler.make_request(\n 'GET',\n '/reports'\n )\n for item in data:\n if item['reportName'] == name:\n return True\n return False", "def __execute_reporter(self):\n if no...
[ "0.61830515", "0.6133899", "0.5999947", "0.59468216", "0.5875816", "0.57317984", "0.5717517", "0.57046014", "0.5638821", "0.5610034", "0.55661505", "0.5520681", "0.55163336", "0.54569095", "0.5435247", "0.5433041", "0.5411181", "0.53963923", "0.5374266", "0.536527", "0.535119...
0.48297888
85
consider there are 5 points in YAxis, if we give 4/5 in `yAxisPos`, Paddle we positioned at 4th place + + | 1 . | | 2 . | | 3 . | | 4 . (canvas_height yAxisPos)
def __init__(self, myCanvas, color, paddleW, paddleH, yAxisPos): self.canvas = myCanvas self.id = myCanvas.create_rectangle(0, 0, paddleW, paddleH, fill=color) # Getting height and width of current window self.canvas_width = self.canvas.winfo_width() self.canvas_height = self.ca...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pos_y(self, *args, **kwargs) -> Any:\n pass", "def calculate_y_pos(value, sensor):\n if GraphModel.check_value(value, sensor):\n return ((32 - int(value)) * 12.5) + 50 if sensor == 't' else 450 - (int(value) / 10 * 40)\n return", "def checkYPos(self, *args):\n x = sel...
[ "0.66333294", "0.64487386", "0.62421274", "0.6238937", "0.6220619", "0.6194612", "0.6183145", "0.61616826", "0.61470264", "0.60619056", "0.60619056", "0.6048159", "0.60376287", "0.6028491", "0.60157543", "0.6014515", "0.60117626", "0.6009412", "0.6004599", "0.5994862", "0.598...
0.5968976
21
Load groups from a YAML file in the config folder
def load_group_from_config(self): group_file_name = "cicada/config/group.yaml" if os.path.isfile(group_file_name): self.group_data = dict() with open(group_file_name, 'r') as stream: self.group_data = yaml.safe_load(stream) self.all_groups = deepcopy(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load():\n with open('groups.pkl', \"rb\") as f:\n while True:\n try:\n groups = yield pickle.load(f)\n except EOFError:\n break\n return groups", "def load_groups(filename):\r\n with open(filename, 'rb') as f:\r\n saved_data = pickle....
[ "0.65959233", "0.64898235", "0.64154387", "0.6401552", "0.63734794", "0.6257335", "0.623626", "0.6220587", "0.6212126", "0.6127406", "0.61166525", "0.61151856", "0.6106009", "0.6093432", "0.6090286", "0.60723686", "0.6064391", "0.60514224", "0.60509735", "0.604319", "0.603630...
0.7781451
0
Check if the last dir opened is saved in config and load it automatically
def load_data_from_config(self): config_file_name = "cicada/config/config.yaml" config_dict = None self.labels = [] self.to_add_labels = [] if os.path.isfile(config_file_name): with open(config_file_name, 'r') as stream: config_dict = yaml.safe_load(s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_local_dir_state(self):\n def _rebuild_local_dir_state():\n self.local_dir_state = {'last_timestamp': 0.0, 'global_md5': self.calculate_md5_of_dir()}\n json.dump(self.local_dir_state, open(self.cfg['local_dir_state_path'], \"wb\"), indent=4)\n\n if os.path.isfile(self.cf...
[ "0.65286005", "0.6428862", "0.63742137", "0.63639176", "0.61485606", "0.5978066", "0.5909513", "0.5828272", "0.58097017", "0.5808923", "0.58018124", "0.57625043", "0.5757688", "0.5729015", "0.572652", "0.5702798", "0.57023174", "0.56917", "0.56898713", "0.5666185", "0.5659846...
0.0
-1
Load data (currently only NWB) from selected directory
def load_data_from_dir(self, dir_name, method): # TODO: deal with the different format # TODO: decide if we should add those nwb to the ones already opened (if that's the case) # or erase the ones present and replace them by the new one. # probably best to have 2 options on the menu o...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _load(self, directory):\n pass", "def onLoadData(self, event):\n pub.sendMessage(\"status_bar\", \"\")\n dlg = wx.DirDialog(self, \"Choose directory containing data:\")\n if dlg.ShowModal() == wx.ID_OK:\n rooms_path = join(dlg.GetPath(), \n \"roomInve...
[ "0.6391868", "0.6348239", "0.61885", "0.6017402", "0.5971649", "0.5957116", "0.5869767", "0.5859153", "0.58570105", "0.58322805", "0.5805255", "0.5755532", "0.5664785", "0.56557834", "0.565291", "0.5651005", "0.5642741", "0.5620435", "0.5616933", "0.5581586", "0.5560718", "...
0.6117966
3
Keep path to last data directory selected in a YAML in config
def save_last_data_location(self, dir_name): # TODO think about where to keep the config yaml file config_file_name = "cicada/config/config.yaml" config_dict = None if os.path.isfile(config_file_name): with open(config_file_name, 'r') as stream: config_dict = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def patch_yaml_path(options):\n if '/' not in options['config_yaml']:\n dir_name = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))\n options['config_yaml'] = os.path.join(dir_name, options['config_yaml'])\n return options", "def configs() -> Path:\n return TEST_RO...
[ "0.6551428", "0.6194027", "0.6087345", "0.6048823", "0.5975001", "0.5923837", "0.5874789", "0.5872855", "0.5858172", "0.58444166", "0.57109195", "0.56871974", "0.56857955", "0.567317", "0.5672065", "0.56700754", "0.5640668", "0.561254", "0.55931914", "0.5587805", "0.55854946"...
0.7011594
0
Populate the menu to load groups
def populate_menu(self): # TODO : Performance issue ? self.showGroupMenu.clear() self.addGroupDataMenu.clear() counter = 0 for group_name in self.group_data.keys(): counter +=1 exec('self.groupAct' + str(counter) + ' = QAction("' + group_name+'", self)') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_group(self):\n items = self.group_list.selectedItems()\n counter = 0\n for item in items:\n if counter == 0:\n self.parent.load_group(item.text())\n else:\n self.parent.add_group_data(item.text())\n counter += 1", "def m...
[ "0.7500009", "0.6833545", "0.6763835", "0.6695808", "0.6598628", "0.65358573", "0.6460276", "0.635643", "0.6344677", "0.6300626", "0.61615777", "0.6161559", "0.6140795", "0.6076778", "0.6062436", "0.60474885", "0.6024077", "0.6014315", "0.5905576", "0.5900018", "0.58814174", ...
0.77946186
0
Load a group of saved sessions, it will clear the current session list
def load_group(self, group_name): self.sorted = False self.grouped = False self.nwb_path_list = dict() self.labels = [] for path_list in {group_name: self.all_groups.get(group_name)}.values(): for path in path_list: io = NWBHDF5IO(path, 'r') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reload_sessions(self):\n import glob \n sessions = glob.glob('*.session')\n for x in sessions:\n self._db['accounts'][x.split('.')[0]] = { 'session': x.split('.')[0] }", "def load_sessions(self):\n try:\n with open(\"sessions.json\") as file:\n ...
[ "0.73663676", "0.625648", "0.6237639", "0.61992913", "0.6044509", "0.60382867", "0.59929925", "0.59021896", "0.5888748", "0.58655155", "0.5786546", "0.5772561", "0.57512414", "0.5732969", "0.5664934", "0.5631897", "0.5575293", "0.5560664", "0.55603945", "0.5530463", "0.551639...
0.0
-1
Add a group of saved sessions to the current list of session
def add_group_data(self, group_name): self.sorted = False self.grouped = False self.labels_to_add = [] for path in self.all_groups.get(group_name): io = NWBHDF5IO(path, 'r') nwb_file = io.read() # self.labels.append(nwb_file.identifier) sel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _group_sessions(self, sessions):\n session_dict = collections.defaultdict(list)\n for session in sessions:\n session_dict[session.query].append(session)\n return session_dict", "def save_history_to_session_history(request: Request):\n session_history = request.session.get('...
[ "0.64716005", "0.6076919", "0.60477024", "0.60235125", "0.60061514", "0.59361243", "0.5876115", "0.58665574", "0.5849508", "0.5819857", "0.5773704", "0.57445985", "0.57442605", "0.5725946", "0.57125133", "0.5704313", "0.5675484", "0.5666136", "0.56417865", "0.56342447", "0.56...
0.0
-1
Create menu bar and put some menu in it
def createMenus(self): self.fileMenu = QMenu("&File", self) self.fileMenu.addAction(self.openAct) self.fileMenu.addAction(self.addAct) self.fileMenu.addSeparator() # self.fileMenu.addAction(self.showSessionAct) self.fileMenu.addAction(self.exitAct) self.helpMenu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_menu():", "def makeMenu(self):\n\t\tself.fileMenu = self.menuBar().addMenu(self.tr(\"&Arquivo\"))\n\t\tself.fileMenu.addAction(self.newAct)\n\t\tself.fileMenu.addAction(self.openAct)\n\t\tself.fileMenu.addAction(self.saveAct)\n\t\tself.fileMenu.addAction(self.exportAct)\n\t\tself.fileMenu.addSeparator...
[ "0.85790855", "0.8304356", "0.82345146", "0.786037", "0.7679123", "0.7674533", "0.76623", "0.7662006", "0.7660757", "0.7657108", "0.7548236", "0.7460278", "0.74561024", "0.7440466", "0.7430572", "0.7311803", "0.72917926", "0.72628886", "0.72443056", "0.7241892", "0.7239563", ...
0.688012
46
Display a widget with all existing groups
def see_all_groups(self): self.all_group_window = AllGroups(self) self.all_group_window.show() self.object_created.append(self.all_group_window)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main(self, session: Session) -> None:\n buttons = []\n for group in groups_api.get_user_groups(session.user):\n if session.user in group.admins:\n buttons.append(self.ui.create_button_view(group.name,\n lambda s: s...
[ "0.65709853", "0.65663856", "0.65644485", "0.65421635", "0.65280133", "0.64636356", "0.64218944", "0.6376457", "0.6360781", "0.63253874", "0.62325615", "0.62173945", "0.6206902", "0.61970323", "0.6093062", "0.609157", "0.60860276", "0.6067449", "0.606232", "0.6043758", "0.602...
0.75397146
0
Uncheck all checkboxes in sort menu
def uncheck_all_sort(self): self.param_list = [] self.ageSort.setChecked(False) self.sexSort.setChecked(False) self.speciesSort.setChecked(False) self.genotypeSort.setChecked(False) self.subjectIDSort.setChecked(False) self.weightSort.setChecked(False) se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _uncheck_all(self):\n for item in self.list_cb_data.values():\n data_ctrl, _, _, _, _, _, _, _ = item\n self.tree_ctrl.CheckItem(data_ctrl, False)\n self.enable_append()\n self.enable_freeze()\n self.enable_plot()\n self.enable_import()\n self.ena...
[ "0.72601676", "0.6726408", "0.657636", "0.62095094", "0.62095094", "0.60626274", "0.5698548", "0.5637104", "0.5637104", "0.56126153", "0.55147564", "0.54877746", "0.5466746", "0.5438217", "0.54364055", "0.53939456", "0.5389247", "0.53833723", "0.53738457", "0.53720176", "0.53...
0.8237576
0
Uncheck group menu parameter
def uncheck_group(self, param=''): self.param_group_list = [] param_value_list = ['age', 'sex', 'species', 'raster', 'genotype', 'subjectID', 'weight', 'birth', 'fluorescence', 'imageseg', 'raster'] for value in param_value_list: if value is not param: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deSelect(self):\n for i in range(len(self.__controlsChecks)):\n self.__controlsChecks[i].setChecked(False)", "def remove_checks(self):\n for checkbox in self.checkboxes:\n checkbox.setChecked(False)\n mw.checked_stats = []\n mw.bonuses = {'Charisma': 2}", "...
[ "0.62023604", "0.5943233", "0.59362906", "0.5904742", "0.5887329", "0.58729535", "0.58031875", "0.57545954", "0.5694991", "0.56908864", "0.56908864", "0.56908864", "0.56908864", "0.569008", "0.5686398", "0.5664812", "0.56092334", "0.5595471", "0.5594885", "0.5594102", "0.5582...
0.81725067
0
Give group list and parameters value to populate QListWidget
def on_group(self, param, state): self.grouped = True if state > 0: # From unchecked to checked self.sorted = False self.uncheck_all_sort() self.musketeers_widget.session_widget.update_text_filter(param) if param not in self.param_group_list: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def populate_list(self):\n counter = 0\n for group_name in self.parent.all_groups.keys():\n counter += 1\n exec('self.groupItem' + str(counter) + ' = QListWidgetItem()')\n eval('self.groupItem' + str(counter) + '.setText(\"' + group_name + '\")')\n self.gro...
[ "0.7947126", "0.655771", "0.630049", "0.62590325", "0.6169743", "0.61142784", "0.59797513", "0.5976366", "0.5818843", "0.57001776", "0.56741434", "0.5673938", "0.56582415", "0.5632328", "0.5632328", "0.559963", "0.5504916", "0.5485373", "0.54283863", "0.540961", "0.5365603", ...
0.5685492
10
Give sorted list to populate QListWidget
def on_sort(self, param, state): if state > 0: # From unchecked to checked self.grouped = False self.uncheck_group() if param not in self.param_list: self.param_list.append(param) else: # From checked to unchecked if param in self.param_l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def SortList(self, key: callable = str.lower):\n temp_list = self.Items\n temp_list.sort(key=key)\n # delete contents of present listbox\n self.delete(0, Tags.End.value)\n # load listbox with sorted data\n for item in temp_list:\n self.insert(Tags.End.value, ite...
[ "0.7195374", "0.634339", "0.6213609", "0.62112373", "0.620845", "0.6157287", "0.61380816", "0.612543", "0.60668546", "0.6054881", "0.6006459", "0.5967853", "0.5941298", "0.59369195", "0.5905371", "0.58992815", "0.586437", "0.5840661", "0.5829871", "0.5808108", "0.578183", "...
0.52781713
59
Small about QMessageBox for the project
def about(self): QMessageBox.about(self, "About CICADA", "Always compassionately illuminate the one yogi.")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def about(self):\n QMessageBox.about(self, \"About MClub Mover\",\n \"\"\"This program is designed to help make the process of copying \\\nfiles from multiple directories much easier and simpler.\\n\nThis software is provided as is with absolutely no warranties.\"\"\",\n Window...
[ "0.77457535", "0.7707642", "0.7680148", "0.76799256", "0.7566085", "0.745824", "0.7455929", "0.7370029", "0.73554003", "0.73409283", "0.7333736", "0.7286007", "0.72819567", "0.7228995", "0.72187036", "0.72083974", "0.720648", "0.7197121", "0.7190358", "0.71038103", "0.7088334...
0.72563857
13
Open all widgets in a CentralWidget and call some menus that needed those widgets
def openWindow(self): # self.showSessionAct.setEnabled(False) self.musketeers_widget = MusketeersWidget(parent=self) self.setCentralWidget(self.musketeers_widget) self.saveGroupMenu = QAction('Save Group', self.fileMenu) self.fileMenu.addAction(self.saveGroupMenu) self.sa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_widgets(self):\r\n\r\n self.runmode_menu.add_radiobutton(label=\"Graphical User Interface\", value=0, variable=self.gui_menu_var,\r\n command=self.disable_debugging_mode)\r\n self.runmode_menu.add_radiobutton(label=\"Command Line Interface\", value...
[ "0.6565933", "0.64844656", "0.64175093", "0.61131245", "0.6092365", "0.6027676", "0.5999339", "0.5959611", "0.59424806", "0.5918777", "0.5893858", "0.58714414", "0.58619857", "0.5850647", "0.583551", "0.58028114", "0.57998383", "0.57807225", "0.5760813", "0.5752231", "0.57514...
0.5706268
27
Close all analysises windows on main window close (uses Garbage Collector to get a list of them and close them, might be a better and faster way)
def closeEvent(self, event): self.object_created = utils.flatten(self.object_created) copied_list = self.object_created.copy() for obj in copied_list: if isinstance(obj, AnalysisPackage): obj.close() else: obj.close() self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def closeAllWindows(self):\n savedEditors = self.editors[:]\n for editor in savedEditors:\n self.closeEditor(editor)", "def destroy(self):\n for window in self.windows:\n try:\n destroy_window(window)\n except:\n pass", "def qu...
[ "0.7279", "0.6973314", "0.69238275", "0.68025184", "0.67724067", "0.67650545", "0.6735201", "0.6712918", "0.6701239", "0.6693736", "0.66902304", "0.66822565", "0.6654024", "0.6641324", "0.65786326", "0.6552778", "0.6539647", "0.6528289", "0.6514999", "0.649385", "0.6468901", ...
0.0
-1
Populate the list containing all existing groups
def populate_list(self): counter = 0 for group_name in self.parent.all_groups.keys(): counter += 1 exec('self.groupItem' + str(counter) + ' = QListWidgetItem()') eval('self.groupItem' + str(counter) + '.setText("' + group_name + '")') self.group_list.addIt...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def refreshGroups(self):\n self.groups = []\n\n self.addGroupsWithIds(self._getGroupIdsJoined())\n self.addGroupsWithIds(self._getGroupIdsInvited(), False)", "def groups(self):\n return []", "def get_groups():\n\n groups = [\"shelter\", \"sharing\", \"unsheltered\", \"motel\"]\n\...
[ "0.74455947", "0.72695047", "0.70179003", "0.6911439", "0.68036634", "0.6797211", "0.67502695", "0.6680795", "0.6622235", "0.66078264", "0.65454835", "0.65221393", "0.6508832", "0.64983976", "0.6488474", "0.6488474", "0.64586484", "0.64459145", "0.644146", "0.6388259", "0.636...
0.6522339
11
Get item which was double clicked and call the function to load the group
def double_click_event(self, clicked_item): item = self.group_list.item(clicked_item.row()) self.parent.load_group(item.text())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def selectitem_double_click(a):\n\n view_thumbnail_main(treeview)", "def __itemDoubleClicked(self, index):\n self.__itemClicked(index)\n\n obj = index.data(self._model.ObjectRole)\n Events.OpenDetails.emit(\"worker\", obj.id)", "def on_double_click(self, event):\n del event\n...
[ "0.654185", "0.6531166", "0.6398607", "0.626244", "0.6227709", "0.61823887", "0.60586107", "0.6039766", "0.6019913", "0.5941906", "0.59150326", "0.58683527", "0.57862693", "0.5730637", "0.5727311", "0.5683523", "0.56778467", "0.56778467", "0.5628967", "0.5549079", "0.5532867"...
0.8749318
0
Add all selected groups to the current session list
def add_group(self): items = self.group_list.selectedItems() for item in items: self.parent.add_group_data(item.text())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def refreshGroups(self):\n self.groups = []\n\n self.addGroupsWithIds(self._getGroupIdsJoined())\n self.addGroupsWithIds(self._getGroupIdsInvited(), False)", "def add_groups(self, groups):\n\n if isinstance(groups, list):\n self.groups.extend(groups)\n else:\n ...
[ "0.7198782", "0.65768206", "0.6516849", "0.649049", "0.63447", "0.633779", "0.62852854", "0.62480265", "0.62076575", "0.61926115", "0.61926115", "0.61926115", "0.61926115", "0.61872953", "0.6126039", "0.6066471", "0.6044021", "0.6041064", "0.59948653", "0.5971394", "0.5945446...
0.7007145
1
Load all selected groups in the session list (clear the existing sessions from the list)
def load_group(self): items = self.group_list.selectedItems() counter = 0 for item in items: if counter == 0: self.parent.load_group(item.text()) else: self.parent.add_group_data(item.text()) counter += 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def refreshGroups(self):\n self.groups = []\n\n self.addGroupsWithIds(self._getGroupIdsJoined())\n self.addGroupsWithIds(self._getGroupIdsInvited(), False)", "def load_all_groups(self):\n for _, group in self.scopes.items():\n group.update()", "def load_security_groups(se...
[ "0.73204184", "0.71574694", "0.6582505", "0.65805537", "0.61208105", "0.60435444", "0.59676194", "0.5891134", "0.5871092", "0.5825946", "0.5818764", "0.5807851", "0.57890207", "0.5774662", "0.5772591", "0.5762555", "0.57619005", "0.56834203", "0.5666265", "0.5605679", "0.5602...
0.6710286
2
Display a context menu at the cursor position. Allow the user to add or load the group at the given position.
def showContextMenu(self, pos): self.global_pos = self.mapToGlobal(pos) self.context_menu = QMenu() self.context_menuAct = QAction("Load group", self, triggered=self.load_group) self.context_menuAct.setIcon(QtGui.QIcon('cicada/gui/icons/svg/question-mark.svg')) self.context_menu....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def request_context_menu(self, pos):\n pass", "def context_menu(self, treeview, position):\n\n all_item = get_current_item(self,treeview,single=False)\n\n if len(all_item) == 1:\n\n item = all_item[0]\n data = get_group_data(get_current_hdf5_group(self,item))\n\n if data is None...
[ "0.7212771", "0.678654", "0.65126127", "0.64903605", "0.6424609", "0.6273866", "0.6197641", "0.615202", "0.6123941", "0.61029315", "0.6096487", "0.60755485", "0.6071013", "0.60664713", "0.60274", "0.60050493", "0.5987533", "0.59152305", "0.5884155", "0.58706045", "0.5829349",...
0.78167677
0
Compares the variance of two populations
def two_pop_var_test(datae,dataf,alpha): # Dataset E data_e = 1.0*np.array(datae) n_e = data_e.shape[0]*data_e.shape[1] mean_e = np.array(data_e).mean() var_e = np.array(data_e).var(ddof=1) df_e = n_e-1 # Dataset F data_f = 1.0*np.array(d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_two_pop_known_var_ind(data1_: tuple, data2_: tuple):\n x_bar = cls.get_mean(data1_)\n y_bar = cls.get_mean(data2_)\n var_x = cls.get_var(data1_, is_population=True)\n var_y = cls.get_var(data2_, is_population=True)\n n_x = cls.get_n(data1_)\n ...
[ "0.72035736", "0.70861506", "0.69419616", "0.66663724", "0.64570904", "0.6321903", "0.6257305", "0.6210859", "0.61727285", "0.6171072", "0.6087778", "0.6069369", "0.6041394", "0.6028173", "0.6025705", "0.60173965", "0.5926076", "0.5914954", "0.5896978", "0.5893868", "0.589117...
0.5579834
46
Finds a confidence interval between two means
def conf_interval_two_means(datae,dataf,conf): # Dataset E data_e = 1.0*np.array(datae) n_e = data_e.shape[0]*data_e.shape[1] mean_e = np.array(data_e).mean() var_e = np.array(data_e).var(ddof=1) df_e = n_e-1 # Dataset F data_f = 1.0*np.a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_mean_cis_differ(mean1, ci1, mean2, ci2):\n\n assert ci1 >= 0.0 and ci2 >= 0.0, 'Found negative confidence interval from bootstrapping.'\n x1 = mean1 - ci1\n y1 = mean1 + ci1\n x2 = mean2 - ci2\n y2 = mean2 + ci2\n return do_intervals_differ((x1, y1), (x2, y2))", "def ci_diff_mean_std_kno...
[ "0.7905093", "0.755459", "0.73970735", "0.7384377", "0.7246968", "0.694616", "0.6898705", "0.68254566", "0.6653396", "0.6586122", "0.65857404", "0.6494277", "0.64374715", "0.63844085", "0.6370864", "0.63254786", "0.63097435", "0.6290247", "0.62892437", "0.62825596", "0.628255...
0.68438715
7
Hypothesis test between two means and a test value.
def hypothesis_test_two_means_testvalue(datae,dataf,test_value,alpha): # Dataset E data_e = 1.0*np.array(datae) n_e = data_e.shape[0]*data_e.shape[1] mean_e = np.array(data_e).mean() var_e = np.array(data_e).var(ddof=1) df_e = n_e-1 # Dataset F ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ztest_mean(self, value=0, alternative=\"two-sided\"):\n tstat = (self.mean - value) / self.std_mean\n # TODO: use outsourced\n if alternative == \"two-sided\":\n pvalue = stats.norm.sf(np.abs(tstat)) * 2\n elif alternative == \"larger\":\n pvalue = stats.norm.s...
[ "0.6710968", "0.6620438", "0.6591137", "0.6552622", "0.6482526", "0.6482526", "0.64806324", "0.6331792", "0.6331792", "0.6331792", "0.627764", "0.627764", "0.627764", "0.6153879", "0.6121712", "0.6088862", "0.5960355", "0.5959184", "0.58887804", "0.587921", "0.58151937", "0...
0.69773674
0
Respond to incoming calls w text message
def hello_monkey(): resp = MessagingResponse().message("Hey hey you logged a brag! Nice!!") return str(resp)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def incoming_sms():\n txt = request.form['Body']\n\n # remove leading and trailing white space and make lowercase\n txt = txt.strip()\n txt = txt.lower()\n\n # handle random searches differently than breed searches\n if txt == 'random' or txt == 'dog':\n url = get_dogs.get_random_dog()\n ...
[ "0.6899525", "0.6855874", "0.68247676", "0.67563117", "0.6655541", "0.6640213", "0.6558934", "0.6555738", "0.6495798", "0.64888585", "0.64746815", "0.64649504", "0.6444909", "0.6444635", "0.641899", "0.6356388", "0.63346", "0.6326011", "0.630552", "0.63048863", "0.6273054", ...
0.5899815
63
Function to run MCMC to decrypt the given text
def decrypt_full_text(encrypt_text, num_mcmc_iters = 2500): best_score = 0 store_iter_texts = [] lc_encrypt = copy.copy(lc_alph) random.shuffle(lc_encrypt) lc_alph_c = copy.copy(lc_alph) ## Initialize a random decryption dict old_decrypt_dict = {} for l, e in zip(lc_alph, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decrypt(self, text):\n return self.encrypt(text)", "def decrypt(text,key):\r\n aes = pyaes.AESModeOfOperationCTR(key)\r\n decrypted = aes.decrypt(text)\r\n return decrypted", "def decrypt(self, data):", "def brute_force_decrypt(text):\n for n in range(26):\n ...
[ "0.656711", "0.651175", "0.6417851", "0.63948435", "0.636516", "0.6217032", "0.6092972", "0.60881126", "0.6066977", "0.5999001", "0.59818745", "0.59265184", "0.59110427", "0.59004205", "0.58550304", "0.58400905", "0.5837091", "0.5831699", "0.58255726", "0.58239216", "0.579112...
0.7016229
0
Get the image directory
def get_image_dir(): directory = os.path.abspath(os.path.dirname(__file__)) directory = os.path.join(directory, 'images') return directory
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_image_dir(self):\n return self.img_dir", "def img_dir(self):\n try:\n return dirname(self.img_files[0])\n except:\n return \"Not available\"", "def getImagePath():\n currentPath = os.path.dirname(__file__)\n resourcesPath = os.path.join(currentPath, \"Re...
[ "0.8793968", "0.84042066", "0.77433044", "0.76953804", "0.74764985", "0.73420596", "0.73061466", "0.72368455", "0.7196323", "0.71532214", "0.71343267", "0.7119933", "0.70874393", "0.70609367", "0.6979767", "0.6938392", "0.6902296", "0.6884043", "0.6879346", "0.68787575", "0.6...
0.8774431
1
Update the sprites, ordering from the bottom
def update_menu(self): x_pos = (self.menu_x - self.block_x) // 2 + self.offset_x y_pos = self.offset_y + 50 # account for bottom text self.menu_sprites[0].image = self.sprite_types[self.curr_sprite] for sprite in self.menu_sprites: sprite.x = x_pos sprite.y = y_po...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(self) -> None:\n self.all_sprites.update()", "def updateAllSpritesPositions(self):\n\n # aggiorno posizione del player\n self.player.update()\n\n # aggiorno posizione dei nemici\n self.enemies.update()\n\n # aggiorno posizione delle bombe\n self.bombs.u...
[ "0.75415903", "0.6881713", "0.66425973", "0.6640513", "0.66195995", "0.65252113", "0.6494556", "0.6484125", "0.64611435", "0.6380394", "0.63577837", "0.62733495", "0.62682766", "0.6227692", "0.6185237", "0.6163127", "0.609721", "0.60229945", "0.5988534", "0.5973319", "0.59429...
0.6710384
2
grab the block at the coords (if one exists) and update it
def create_block(self, x, y, block_type): sprite_stack = self.get_sprite(x, y) if sprite_stack: sprite = sprite_stack[-1] sprite.image = block_type return # no existing block, so create a new one block_x = x * self.block_x + self.offset_x + self.menu_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def updateBlock(self):\n self.blkno = self.blknoSpinBox.value() - 1\n self.initDataParms()\n self.updateCurveList()\n self.compute()", "def set_block(self, coords, block):\n\n x, y, z = coords\n index, section_y = divmod(y, 16)\n\n column = x * 16 + z\n\n i...
[ "0.67585504", "0.66361964", "0.65238327", "0.6433237", "0.6385589", "0.6251285", "0.624588", "0.6121563", "0.6119986", "0.6001952", "0.5998446", "0.5989942", "0.59702826", "0.5923056", "0.59144133", "0.59054977", "0.5892768", "0.58867383", "0.58862054", "0.5845917", "0.582490...
0.0
-1
Do the two sprites intersect? sprite Sprite The Sprite to test
def intersect(self, sprite): return not ((self.left > sprite.right) or (self.right < sprite.left) or (self.top < sprite.bottom) or (self.bottom > sprite.top))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def collide(obj1, obj2):\n offset_x = obj2.x - obj1.x #The difference between obj1 and obj 2\n offset_y = obj2.y - obj1.y \n return obj1.mask.overlap(obj2.mask, (int(offset_x), int(offset_y))) != None # (x,y)", "def check_collide(self):\r\n for raindrop in self.overlapping_sprites:\r\n ...
[ "0.69023377", "0.6828504", "0.66966444", "0.6652892", "0.6606588", "0.6513285", "0.65090466", "0.6431784", "0.63963944", "0.6376261", "0.63616073", "0.6354351", "0.62159806", "0.6202103", "0.6198012", "0.61656076", "0.6162445", "0.6159237", "0.6142227", "0.6126394", "0.612616...
0.783341
0
Determing ther are collisions with this sprite and the list of sprites sprite_list A list of sprites list List of collisions
def collide(self, sprite_list): lst_return = [] for sprite in sprite_list: if (self.intersect(sprite)): lst_return.append(sprite) return lst_return
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def e_collisions(rect, enemy_list):\r\n for enemy in enemy_list:\r\n if rect.colliderect(enemy[1]) and rect.bottom - 4 < enemy[1].top:\r\n dropped_objects.append([[enemy[1].x, enemy[1].y], heart_img, [0, 0], 45])\r\n enemy_list.remove(enemy)", "def is_collision(self):\n to_...
[ "0.6842545", "0.6460546", "0.64304525", "0.6426143", "0.6256541", "0.6211209", "0.62064403", "0.6188275", "0.61544716", "0.61448425", "0.61448425", "0.6114543", "0.609662", "0.60907686", "0.6049961", "0.6025568", "0.60046536", "0.59867775", "0.59822077", "0.59715503", "0.5949...
0.7027629
0
Determine if there is at least one collision between this sprite and the list sprite_list A list of sprites None No Collision, or the first sprite to collide
def collide_once(self, sprite_list): for sprite in sprite_list: if (self.intersect(sprite)): return sprite return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def collide(self, sprite_list):\n\n lst_return = []\n for sprite in sprite_list:\n if (self.intersect(sprite)):\n lst_return.append(sprite)\n return lst_return", "def check_collide(self):\r\n for raindrop in self.overlapping_sprites:\r\n raindrop.h...
[ "0.76459634", "0.6861803", "0.67869467", "0.67277163", "0.6404311", "0.63971245", "0.63583386", "0.6321546", "0.6310485", "0.6258321", "0.6196923", "0.61400634", "0.6084565", "0.6059887", "0.60567945", "0.59895366", "0.5981568", "0.59409964", "0.58866584", "0.5883322", "0.586...
0.8650495
0
Do package setup at package load time.
def loaded(): hha_setting.obj = sublime.load_settings("HyperHelpAuthor.sublime-settings") hha_setting.default = { "update_header_on_save": True, "reload_index_on_save": True, "lint_output_to_view": False, "author_view_settings": { "rulers": [80], "match_se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _setup(self):\n pass", "def _setup(self):\n pass", "def _setup(self):\n pass", "def _setup(self):\n pass", "def _setup(self):\n pass", "def _setup(self) -> None:\n\t\treturn", "def setup(self) -> None:\n self.setup_logging()\n self.setup_plugins()\n ...
[ "0.7681793", "0.7681793", "0.7681793", "0.7681793", "0.7681793", "0.74936527", "0.74605334", "0.7374216", "0.7374216", "0.7317745", "0.72899806", "0.71940863", "0.71940863", "0.71940863", "0.71940863", "0.71940863", "0.71940863", "0.71940863", "0.71940863", "0.71940863", "0.7...
0.0
-1
Do package cleanup at unload time.
def unloaded(): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unload_all():\n module_utils.unload_package_modules(__name__)", "def cleanup(self):\n\t\tself.loader.cleanup()\n\t\tself.Loaded = False", "def cleanup():", "def cleanup(self):\n self.GP.cleanup()", "def cleanup(self):\r\n pass", "def cleanup(self):\r\n pass", "def cleanup(self):...
[ "0.7700454", "0.7571508", "0.75054604", "0.74872094", "0.7401457", "0.73306626", "0.73306626", "0.73286986", "0.73286986", "0.73286986", "0.73286986", "0.73286986", "0.73286986", "0.73286986", "0.73286986", "0.73286986", "0.73286986", "0.73286986", "0.730025", "0.729119", "0....
0.708029
32
Get a HyperHelpAuthor setting from a cached settings object.
def hha_setting(key): default = hha_setting.default.get(key, None) return hha_setting.obj.get(key, default)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apply_authoring_settings(view):\n # Ensure help files with no header get the appropriate syntax set\n view.assign_syntax(hh_syntax(\"HyperHelp-Help.sublime-syntax\"))\n\n author_view_settings = hha_setting(\"author_view_settings\")\n settings = view.settings()\n for option in author_view_setting...
[ "0.6095596", "0.5634342", "0.5394313", "0.52192473", "0.52102685", "0.52102685", "0.51438564", "0.512326", "0.5084381", "0.50817287", "0.50310844", "0.5022928", "0.50225395", "0.5015123", "0.50020033", "0.49942827", "0.49935323", "0.49907595", "0.49438605", "0.49339852", "0.4...
0.5041114
10
Given a view object, tells you if that view represents a help source file.
def is_authoring_source(view): if view.match_selector(0, "text.hyperhelp.help"): return not view.is_read_only() return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def package_for_view(view):\n if view.file_name() is not None:\n spp = sublime.packages_path()\n if view.file_name().startswith(spp):\n file_name = view.file_name()[len(spp)+1:]\n for pkg_name, pkg_info in help_index_list().items():\n if file_name.startswith(pk...
[ "0.64434224", "0.6221", "0.61636925", "0.5855022", "0.5569256", "0.5569256", "0.55248463", "0.55218595", "0.5490958", "0.5458554", "0.54406416", "0.54218847", "0.53848445", "0.5383498", "0.53619915", "0.53554165", "0.53252333", "0.5302516", "0.52975994", "0.52934253", "0.5279...
0.7374875
0
Given a view object, provides you back the help index tuple for the help package that contains this file. This may be None if this file is not a Sublime package file, or if it doesn't correspond to a loaded help package. This does not verify that the file is actually a part of the provided help package, only that it is...
def package_for_view(view): if view.file_name() is not None: spp = sublime.packages_path() if view.file_name().startswith(spp): file_name = view.file_name()[len(spp)+1:] for pkg_name, pkg_info in help_index_list().items(): if file_name.startswith(pkg_info.doc_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def open_help_index(pkg_info, window=None):\n window = window if window is not None else sublime.active_window()\n\n # The index file is stored as a resource file spec, so strip the prefix\n local_path = local_help_index(pkg_info)\n\n if not os.path.exists(local_path):\n return log(format_templa...
[ "0.6871109", "0.6823521", "0.64809155", "0.6385842", "0.60667676", "0.6026283", "0.59947926", "0.59919167", "0.5991301", "0.5935679", "0.5878535", "0.58728653", "0.5842411", "0.58300155", "0.5813974", "0.5789508", "0.57894164", "0.57725763", "0.57585585", "0.5727645", "0.5701...
0.75560325
0
Determine what the full file name of a help file from a given package would be if it was stored locally.
def local_help_filename(pkg_info, help_file): return os.path.normpath(os.path.join(sublime.packages_path(), pkg_info.doc_root, help_file))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def local_help_index(pkg_info):\n return os.path.normpath(os.path.join(sublime.packages_path(),\n pkg_info.index_file[len(\"Packages/\"):]))", "def name_from_file(pth = getattr(modules['__main__'], '__file__', 'optimize.default')):\n\treturn '{0:s}'.format(splitext(basename(pth))[0]...
[ "0.7155894", "0.64388376", "0.6425103", "0.6395578", "0.63303095", "0.6289822", "0.6247393", "0.619017", "0.61771953", "0.613666", "0.61287826", "0.60831016", "0.606742", "0.60500973", "0.6015383", "0.59999245", "0.5986673", "0.59850043", "0.5959858", "0.5953095", "0.5944372"...
0.8257178
0
Determine what the full file name of the help index file for the given package would be if it was stored locally.
def local_help_index(pkg_info): return os.path.normpath(os.path.join(sublime.packages_path(), pkg_info.index_file[len("Packages/"):]))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def local_help_filename(pkg_info, help_file):\n return os.path.normpath(os.path.join(sublime.packages_path(),\n pkg_info.doc_root, help_file))", "def _template_file_default(self):\n return \"index\"", "def open_help_index(pkg_info, window=None):\n window = window if wind...
[ "0.7559249", "0.64428043", "0.6427507", "0.6295475", "0.6083822", "0.60460234", "0.59824336", "0.59647536", "0.58642995", "0.5853091", "0.5838828", "0.5836808", "0.58200973", "0.5815175", "0.58049196", "0.580457", "0.5802551", "0.57947975", "0.5784477", "0.5781049", "0.573363...
0.78894776
0
Given incoming text, remove all common indent, then strip away the leading and trailing whitespace from it. This is a modified version of code from Default/new_templates.py from the core Sublime code.
def format_template(template, *args): return textwrap.dedent(template % args).strip()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cleaningIndent(text):\n\n text = re.sub(r'^[\\s \\t]+', r'', text)\n text = re.sub(r'[\\s \\t]+$', r'', text)\n text = re.sub(r'[\\r\\n]+', r'\\r\\n', text)\n text = re.sub(r'(<(/p|/h[1-6]|/?div|/head|/l|/?lg|/?body|/?back|/?text|/?front)>)', r'\\1\\r\\n', text, flags=re.DOTALL|re.IGNORECASE)\n ...
[ "0.7582474", "0.7230056", "0.7086244", "0.7032659", "0.6705167", "0.6624806", "0.6379604", "0.6292716", "0.6165224", "0.6155373", "0.614591", "0.61450934", "0.60598785", "0.60362625", "0.59933895", "0.5987637", "0.59669304", "0.59515756", "0.59338224", "0.59015787", "0.588991...
0.0
-1
Attempt to open the provided help file locally for editing.
def open_local_help(pkg_info, help_file, window=None): window = window if window is not None else sublime.active_window() local_path = local_help_filename(pkg_info, help_file) if not os.path.exists(local_path): return log(format_template( """ Specified help file does not exi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def os_open_help_file( cls, help_file ):\n #help_file = self.parameters.help_file\n if help_file.startswith( \"http:\" ) or help_file.startswith( \"https:\" ):\n ret = webbrowser.open( help_file, new=0, autoraise=True ) # popopen might also work with a url\n# print(...
[ "0.74577296", "0.67560256", "0.67560256", "0.6645325", "0.64900404", "0.6351481", "0.6331407", "0.62790215", "0.6220714", "0.6169091", "0.6098027", "0.6042996", "0.60400534", "0.5978792", "0.5902903", "0.5882742", "0.5872984", "0.582122", "0.57693267", "0.57081306", "0.567081...
0.760992
0
Attempt to open the provided help index file localy for editing.
def open_help_index(pkg_info, window=None): window = window if window is not None else sublime.active_window() # The index file is stored as a resource file spec, so strip the prefix local_path = local_help_index(pkg_info) if not os.path.exists(local_path): return log(format_template( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def openFile(self, index):\n page_name = index.data().toString()\n file_name = self.file_names[str(page_name)]\n self.main_help_window.setHtml(open(file_name, 'r').read())", "def os_open_help_file( cls, help_file ):\n #help_file = self.parameters.help_file\n if help_...
[ "0.6962194", "0.65130967", "0.65087134", "0.64038634", "0.60102427", "0.5912191", "0.58855593", "0.58855593", "0.58015025", "0.5717869", "0.56538856", "0.56368715", "0.563381", "0.5614867", "0.55863905", "0.5571036", "0.5564107", "0.55595046", "0.5534661", "0.5512867", "0.542...
0.74973387
0
Given a view, apply the appropriate settings to it to ensure that it is set up properly for editing.
def apply_authoring_settings(view): # Ensure help files with no header get the appropriate syntax set view.assign_syntax(hh_syntax("HyperHelp-Help.sublime-syntax")) author_view_settings = hha_setting("author_view_settings") settings = view.settings() for option in author_view_settings: sett...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def view_edit(\n request: HttpRequest,\n pk: Optional[int] = None,\n workflow: Optional[Workflow] = None,\n view: Optional[View] = None,\n) -> JsonResponse:\n # Form to read/process data\n form = ViewAddForm(request.POST or None, instance=view, workflow=workflow)\n\n return save_view_form(\n ...
[ "0.65728766", "0.6163671", "0.60453045", "0.59775466", "0.5938634", "0.58105135", "0.57623327", "0.5750053", "0.5716351", "0.57006294", "0.565684", "0.5621864", "0.5545479", "0.54347074", "0.54126024", "0.5385227", "0.5381327", "0.5372022", "0.5363141", "0.5358644", "0.535481...
0.5831245
5
Implement the cost function and its gradient for the propagation explained above
def propagate(w, b, x, y): m = x.shape[1] # Forward Propagation (from x to cost) # Compute activation activation = 1 / (1 + np.exp(-(np.dot(w.T, x) + b))) # compute cost cost = (-1 / m) * np.sum( (np.dot(np.log(activation), y.T)) + np.dot(np.log(1 - activation), (1 - y).T) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nnCostFunction2(nn_params, input_layer_size, hidden_layer_size, num_labels, X, y, lambda_):\n # Reshape nn_params back into the parameters Theta1 and Theta2, the weight matrices\n # for our 2 layer neural network\n Theta1 = nn_params[:hidden_layer_size * (input_layer_size + 1)].reshape(\n (hidd...
[ "0.7349644", "0.7308223", "0.7261303", "0.72194695", "0.7216402", "0.7159302", "0.71557546", "0.7141162", "0.7081815", "0.7050095", "0.7041962", "0.7005075", "0.70046824", "0.69966596", "0.69785345", "0.69745356", "0.6957009", "0.69493884", "0.69397837", "0.6933552", "0.69106...
0.0
-1
This function optimizes w and b by running a gradient descent algorithm
def optimize(w, b, x, y, num_iterations, learning_rate, print_cost=False): costs = [] for i in range(num_iterations): # Cost and gradient calculation grads, cost = propagate(w, b, x, y) # Retrieve derivatives from grads dw = grads["dw"] db = grads["db"] # Upd...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fit(self, w):\n w_former = w\n w_next = w\n w_t = w\n w_t_100 = w\n w_diff = 10000\n i = 0\n #tim_beg = t.time()\n # use two part to calculate the a(w,w0):calculate the gradient using regular or SDG, batch = 10\n # calculate the gradient and update...
[ "0.76754355", "0.7661515", "0.7623487", "0.75583196", "0.7547733", "0.7358705", "0.7332718", "0.72917825", "0.72705144", "0.7256053", "0.724173", "0.72292984", "0.721992", "0.7204339", "0.71772975", "0.7161911", "0.71546173", "0.712995", "0.71283716", "0.71263844", "0.7118954...
0.75092006
5
Filter returns a list containing range made from given value
def get_range(value): return list(range(value))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_range( value ):\n return list(range(value))", "def ex_range(data):\n a, b, step = _cleanse_range_args(data)\n return list(range(a, b+sign(step), step))", "def _range_to_list(cls, rng):\n ends = rng.split(\"-\")\n if len(ends) != 2:\n return []\n\n return list(ra...
[ "0.7232286", "0.6389737", "0.6220292", "0.6103578", "0.6096528", "0.60947645", "0.6037131", "0.60205203", "0.6008224", "0.59948736", "0.59946954", "0.5991958", "0.5981121", "0.5955905", "0.5937625", "0.59324116", "0.5920362", "0.59036714", "0.589868", "0.5882526", "0.5868773"...
0.72140145
1
subtract the arg from the value.
def subtract(value, arg): try: return int(value) - int(arg) except (ValueError, TypeError): try: return value - arg except Exception: return ""
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subtract(self, value):\n return self.number - value", "def subtract(val, otherval=None):\n if otherval is None:\n return val\n\n try:\n answer = val - int(otherval)\n return answer\n except ValueError:\n return val", "def subtract(*args):\n\n # TODO: Fill ...
[ "0.7714425", "0.71640867", "0.71093124", "0.69877523", "0.69389325", "0.6776049", "0.67269045", "0.6721766", "0.6658199", "0.6658199", "0.66268027", "0.66268027", "0.66268027", "0.66232294", "0.66111463", "0.6543256", "0.65196186", "0.6496731", "0.6493978", "0.6485772", "0.64...
0.7948222
0
Converts an integer to a string containing spaces every three digits. For example, 3000 becomes '3 000' and 45000 becomes '45 000'.
def intspace(value): # http://softwaremaniacs.org/forum/django/19392/ if value is None: return None orig = force_str(value) new = re.sub(r"^(-?\d+)(\d{3})", r"\g<1> \g<2>", orig) return new if orig == new else intspace(new)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pad_to_three_digits(my_int):\n my_int_length = len(str(my_int))\n result = \"\"\n if my_int_length == 3:\n result = str(my_int)\n elif my_int_length == 2:\n result = \"{:0>2d}\".format(my_int)\n elif my_int_length == 1:\n result = \"{:0>3d}\".format(my_int)\n return resul...
[ "0.75848144", "0.7137401", "0.70835763", "0.7000823", "0.69268286", "0.6852972", "0.67821044", "0.665556", "0.66420245", "0.6546761", "0.65388364", "0.65102667", "0.65006787", "0.64911485", "0.6490529", "0.6482787", "0.647601", "0.64534444", "0.6404267", "0.6373435", "0.63356...
0.5903954
50
concatenate arg1 & arg2
def addstr(arg1, arg2): return str(arg1) + str(arg2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def str_cat(arg1, arg2):\n return str(arg1) + str(arg2)", "def addstr(arg1, arg2):\r\n return str(arg1) + str(arg2)", "def addstr(arg1, arg2):\n\treturn str(arg1) + str(arg2)", "def concat(*args, sep=\"/\"):\n return sep.join(args)", "def concatenate_string(string1, stringy2):\n return string1 ...
[ "0.7705419", "0.7376582", "0.73275083", "0.71895283", "0.6915367", "0.66292495", "0.6604084", "0.6604084", "0.6604084", "0.6530825", "0.63616997", "0.6319354", "0.6299842", "0.62613356", "0.6218319", "0.6215948", "0.62125397", "0.6203147", "0.6194626", "0.6113558", "0.6112376...
0.73033583
6
Prints a textbased representation of where mines are located.
def print(self): for i in range(self.height): print("--" * self.width + "-") for j in range(self.width): if self.board[i][j]: print("|X", end="") else: print("| ", end="") print("|") print("--" * ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_mines(self):\n\t\tfor y in range(self.height):\n\t\t\tfor x in range(self.width):\n\t\t\t\tprint(\"#\" if self.mines[x][y] else \".\", end=\"\")\n\t\t\tprint(\"\")", "def printMaze(self):\r\n\t\tdef getString(tile):\r\n\t\t\tif tile == 0:\r\n\t\t\t\treturn \" \"\r\n\t\t\telse:\r\n\t\t\t\treturn \"*\"\r...
[ "0.7783241", "0.63434047", "0.6129617", "0.6111089", "0.598937", "0.59727496", "0.5889701", "0.58786064", "0.580806", "0.5765644", "0.5760836", "0.5695705", "0.5673537", "0.56688195", "0.56594807", "0.5641057", "0.5621189", "0.56207407", "0.5591179", "0.55872834", "0.5568029"...
0.0
-1
Returns the number of mines that are within one row and column of a given cell, not including the cell itself.
def nearby_mines(self, cell): # Keep count of nearby mines count = 0 # Loop over all cells within one row and column for i in range(cell[0] - 1, cell[0] + 2): for j in range(cell[1] - 1, cell[1] + 2): # Ignore the cell itself if (i, j) == ce...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_mines(row, col):\r\n total = 0\r\n for r,c in ((-1,-1),(-1,0),(-1,1),(0,-1),(0,1),(1,-1),(1,0),(1,1)):\r\n try:\r\n if mines[row+r][col+c] == 1:\r\n total += 1\r\n except KeyError:\r\n pass\r\n return total", "def nearby_mines(self, cell):\n\n...
[ "0.8124631", "0.8020939", "0.7473211", "0.6857038", "0.6601409", "0.65887624", "0.6528617", "0.6528617", "0.6484438", "0.6437584", "0.64335096", "0.6366495", "0.63632774", "0.6360802", "0.62802094", "0.62700754", "0.62669563", "0.6262771", "0.6202617", "0.61958134", "0.617344...
0.80061084
7
Checks if all mines have been flagged.
def won(self): return self.mines_found == self.mines
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mark_mines(self, cells):\r\n for cell in cells:\r\n row, col = cell\r\n self.mine_field[row][col] = 'x'\r\n self.mines_left -= 1\r\n return", "def known_mines(self):\n self.mines", "def all_bees_raised_flag(self):\n pos, com, success = self.perce...
[ "0.6496075", "0.6441596", "0.62646043", "0.61920667", "0.5948475", "0.59368217", "0.5887279", "0.58706886", "0.58314085", "0.5809972", "0.579444", "0.5790966", "0.5783772", "0.5762287", "0.5746479", "0.57060987", "0.56872654", "0.56198263", "0.5619175", "0.5610368", "0.560209...
0.67849445
5
Marks a cell as a mine, and updates all knowledge to mark that cell as a mine as well.
def mark_mine(self, cell): self.mines.add(cell) for sentence in self.knowledge: sentence.mark_mine(cell)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mark_mine(self, cell):\n \n self.mines.add(cell)\n \n for sentence in self.knowledge:\n sentence.mark_mine(cell)", "def mark_mine(self, cell):\n if cell in self.cells:\n self.mines.add(cell)\n self.cells.remove(cell)\n self.count ...
[ "0.8251422", "0.78307855", "0.74419504", "0.72862476", "0.7236856", "0.7171737", "0.7095954", "0.65288585", "0.6487759", "0.6450284", "0.64431626", "0.6440336", "0.6121804", "0.61191404", "0.6079563", "0.6020219", "0.59274065", "0.58763057", "0.58511955", "0.5844367", "0.5806...
0.82279795
5
Marks a cell as safe, and updates all knowledge to mark that cell as safe as well.
def mark_safe(self, cell): self.safes.add(cell) for sentence in self.knowledge: sentence.mark_safe(cell)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mark_safe(self, cell):\n if cell in self.cells:\n self.safes.add(cell)\n self.cells.remove(cell)", "def mark_safe(self, cell):\n \n self.safes.add(cell)\n \n for sentence in self.knowledge:\n sentence.mark_safe(cell)", "def mark_safe(self,...
[ "0.80514836", "0.8004329", "0.7685909", "0.7554772", "0.74373066", "0.73009825", "0.6205402", "0.6075546", "0.605152", "0.603979", "0.5919499", "0.58894336", "0.5873248", "0.576457", "0.5671165", "0.5653492", "0.5630281", "0.5630281", "0.5630281", "0.5630281", "0.5630281", ...
0.79188526
6
Called when the Minesweeper board tells us, for a given safe cell, how many neighboring cells have mines in them.
def add_knowledge(self, cell, count): #Add to moves made self.moves_made.add(cell) #Mark cell as safe self.mark_safe(cell) #Get a tuple x,y from the cell and generate set x = cell[0] y = cell[1] cells = set() #iterate through all cells surrounding ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nearby_mines(self, cell):\n\n # Keep count of nearby mines\n count = 0\n\n # Loop over all cells within one row and column\n for i in range(cell[0] - 1, cell[0] + 2):\n for j in range(cell[1] - 1, cell[1] + 2):\n\n # Ignore the cell itself\n ...
[ "0.75791645", "0.7563611", "0.7563611", "0.7563611", "0.7563611", "0.7563611", "0.7563611", "0.7395664", "0.70108175", "0.6958551", "0.6957981", "0.687749", "0.687749", "0.683041", "0.68214226", "0.67757803", "0.67534685", "0.6657069", "0.6622465", "0.661732", "0.6603846", ...
0.0
-1
Returns a safe cell to choose on the Minesweeper board. The move must be known to be safe, and not already a move that has been made. This function may use the knowledge in self.mines, self.safes and self.moves_made, but should not modify any of those values.
def make_safe_move(self): #iterate through safe moves until you find one that has not yet been played for move in self.safes: if move not in self.moves_made: return move #If we make it through the end of the list, return None return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_safe_move(self):\n # returns a safe cell to choose on the board, known in safes, not already move made\n for safe in self.safes:\n if safe not in self.moves_made:\n return safe\n return None", "def make_random_move(self):\n # get copy of the empty bo...
[ "0.8287994", "0.70533794", "0.70276654", "0.6816493", "0.660001", "0.6562774", "0.6451475", "0.61594796", "0.61411023", "0.6089609", "0.60534877", "0.6046469", "0.6003024", "0.5954219", "0.58764064", "0.5864738", "0.58513474", "0.5832227", "0.5802777", "0.5772268", "0.5759464...
0.6723422
4
Returns a move to make on the Minesweeper board.
def make_random_move(self): choice = None options = [] #generate full moves list for i in range(self.width): for j in range(self.height): #make sure move has not been made if (i,j) not in self.moves_made: #make sure move is ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_move(self, board: Board) -> int:\n move, evalutation = self.minimax(board, -math.inf, math.inf, self._depth, 1)\n return move", "def make_random_move(self):\n # get copy of the empty board\n board = set([(i, j) for i in range(self.height) for j in range(self.width)])\n\n ...
[ "0.6971538", "0.6966947", "0.6904679", "0.6889987", "0.6841902", "0.67715955", "0.6702656", "0.668117", "0.6619134", "0.6596002", "0.6594854", "0.65729135", "0.65625435", "0.65225434", "0.6517698", "0.651173", "0.64922816", "0.6490992", "0.6478841", "0.6465598", "0.6450335", ...
0.0
-1
Returns the reverse of inputs string s
def reverse(s): result = '' for i in xrange(len(s)-1, -1, -1): result += s[i] return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reverse_string(s):\n s.reverse()", "def reverse(s):\n return s[::-1]", "def reverseString(s):\n return s[::-1]", "def reverseString(self, s) -> None:\n i = 0\n j = len(s) - 1\n while i < j:\n temp = s[i]\n s[i] = s[j]\n s[j] = temp\n ...
[ "0.86106724", "0.8563862", "0.8432495", "0.8252615", "0.82508796", "0.8211682", "0.81901413", "0.8167683", "0.8163093", "0.8064074", "0.8010472", "0.7992999", "0.79454887", "0.7933002", "0.7896344", "0.78728724", "0.785388", "0.78389746", "0.78286767", "0.7810577", "0.7774425...
0.8231241
5
Send a payment confirmation email. Certain products may need to send a confirmation seperately. Maybe eventually there will need to be a settings.DROP_MAIL_CONFIRMATION_NO_MATTER_WHAT option?
def send_payment_confirmation_email(self,order): order_items = [i for i in order.items.all()] for cls in set([i.product.__class__ for i in order_items]): if not hasattr(cls,"send_payment_confirmation_email"): continue cls_items = [i for i in order_items if isinsta...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_payment_email(order):\n if not settings.LOCAL:\n if order.latest_action == OrderAction.Action.BANKNOTE_UPLOADED:\n title = \"Order #{} Banknote Received\".format(order.id)\n else:\n title = \"Order #{} Payment Received\".format(order.id)\n\n mail.send_mail(\n ...
[ "0.70650756", "0.6956238", "0.6937234", "0.6903004", "0.6883585", "0.6694232", "0.66092557", "0.6589168", "0.6447598", "0.64447516", "0.6420641", "0.6387323", "0.63784933", "0.6378442", "0.63290316", "0.6279329", "0.62416524", "0.60740715", "0.6064392", "0.605832", "0.5989102...
0.80389726
0
Marks the specified amount for the given order as paid. This allows to hook in more complex behaviors (like saving a history of payments in a Payment model) The optional save argument allows backends to explicitly not save the order yet
def confirm_payment(self, order, amount, transaction_id, backend, description, save=True): #! TODO this bit should probably be in the "if save..." block below. Check rest of code base first OrderPayment.objects.get_or_create( order=order, amount=Decimal(amount), trans...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def paid(self, paid):\n\n self._paid = paid", "def transaction_amount_paid(self, transaction_amount_paid):\n\n self._transaction_amount_paid = transaction_amount_paid", "def paid_interest(self, paid_interest):\n\n self._paid_interest = paid_interest", "def save(self, *args, **kwargs):\n ...
[ "0.6905266", "0.6039232", "0.6021345", "0.59171605", "0.5789729", "0.57723475", "0.5649608", "0.5606408", "0.5603221", "0.5592143", "0.554666", "0.5468819", "0.5401203", "0.5376429", "0.5343095", "0.5258786", "0.52550066", "0.523511", "0.5198044", "0.51331836", "0.51278967", ...
0.66326064
1
A helper for backends, so that they can call this when their job is finished i.e. The payment has been processed from a user perspective This will redirect to the "Thanks for your order" page. To confirm the payment, call confirm_payment before this function. For example, for PayPal IPN, the payment is confirmed upon r...
def get_finished_url(self): return reverse('thank_you_for_your_order')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ui_redirect_success(self, order: Order = None) -> HttpResponse:\n ui_return_url = self.extract_ui_return_url()\n if ui_return_url:\n return self._redirect_to_ui(\n ui_return_url, \"success\", order, path=\"/payment-result\"\n )\n else:\n retu...
[ "0.68665624", "0.68651086", "0.680893", "0.67644334", "0.6647942", "0.65912706", "0.6569984", "0.65695244", "0.6566958", "0.6547204", "0.64461654", "0.64198613", "0.6389767", "0.63429487", "0.6298445", "0.6286267", "0.62616205", "0.6234617", "0.6205829", "0.6182683", "0.61775...
0.6518645
10