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
Adds to the partition provided `number` in all its combinations
def add_number(partitions, number): # Add to each list in partitions add 1 prods = partitions.values() nKeys = [(1,) + x for x in partitions.keys()] # apply sum_ones on each partition, and add results to partitions # Done use reduce, the continues list creation is just too slow #partitions = r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add(self, number):\n\n for n in list(self.num):\n if n + number not in self.pair:\n self.pair.add(n + number)\n if number not in self.num:\n self.num.add(number)", "def add(self, number):\n bisect.insort(self.arr, number)", "def add(self, number):\n...
[ "0.6787744", "0.6068892", "0.57908505", "0.5640544", "0.5640544", "0.56027186", "0.5575665", "0.5567512", "0.5543029", "0.55217093", "0.5484204", "0.5459124", "0.54481226", "0.54335606", "0.5411571", "0.54085", "0.53956294", "0.53827155", "0.536468", "0.5321466", "0.5317977",...
0.7305611
0
Generate all partitions for partitions number `value`
def partitions(value, show_progress=False): p = {(1,): 1} for num in range(2, value+1): p = add_number(p, num) if show_progress: print(('%d' % num) + '.'*num) return p
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def partitions(n):\n for a in range(2,n//2+1):\n yield a, n-a", "def partitions(n, k):\n if k == 1:\n yield (n,)\n return\n for i in range(1, n):\n for p in partitions(n-i, k-1):\n yield (i,) + p", "def fixed_size_partitioner(num_shards, axis=0):\n def _partitio...
[ "0.62917763", "0.6152162", "0.5948146", "0.5925437", "0.5881951", "0.5843679", "0.58393574", "0.58084816", "0.57997406", "0.57366866", "0.57020015", "0.56715804", "0.5613356", "0.55816793", "0.551945", "0.5429442", "0.54274815", "0.54197305", "0.54184514", "0.5406913", "0.540...
0.7284648
0
Generate all partitions for the number `n` and summarize them
def part(n, show_progress=False): # Get partitions as list of tuples parts = partitions(n, show_progress=show_progress) #products = set(map(lambda x: np.prod(x), parts)) # Only count unique products filtered_products = list(set(parts.values())) filtered_products.sort() return format('Range...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def partitions(n):\n for a in range(2,n//2+1):\n yield a, n-a", "def partitions(n, k):\n if k == 1:\n yield (n,)\n return\n for i in range(1, n):\n for p in partitions(n-i, k-1):\n yield (i,) + p", "def integer_partitions(n, **kwargs):\n if 'parts' in kwargs:\...
[ "0.75936687", "0.7289861", "0.6991443", "0.6911324", "0.6906773", "0.67632943", "0.67629695", "0.6354496", "0.6316298", "0.6284562", "0.6174668", "0.614111", "0.61089796", "0.60974896", "0.609314", "0.6087594", "0.60763526", "0.60584867", "0.60584146", "0.60495347", "0.604165...
0.7270836
2
Crop human from origin image according to Dectecion Results
def crop_from_dets( img, bboxes, target_height, target_width, extra_zoom ): imght = img.size(1) imgwidth = img.size(2) tmp_img = img # normalization (per-channel) tmp_img[0].add_(-0.406) tmp_img[1].add_(-0.457) tmp_img[2].add_(-0.480) crops = [] bboxes_zo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def doCrop(image, x, y, w, h):\n\tcrop_height = int((config.FACE_HEIGHT / float(config.FACE_WIDTH)) * w)\n\tmidy = y + h/2\n\ty1 = max(0, midy-crop_height/2)\n\ty2 = min(image.shape[0]-1, midy+crop_height/2)\n\treturn image[y1:y2, x:x+w]", "def crop_img(image, bound):\n scale = 1.01 # 1%\n return image.cr...
[ "0.75699186", "0.71195096", "0.711933", "0.7116151", "0.7115106", "0.7076203", "0.7076203", "0.7045804", "0.70263135", "0.69870144", "0.6883512", "0.6826923", "0.68131226", "0.679303", "0.67609984", "0.67426807", "0.671228", "0.6706907", "0.670277", "0.66972685", "0.66972685"...
0.6248669
58
Get version number from __init__.py
def get_version(): version_file = Path(__file__).resolve().parent / "clinker" / "__init__.py" version_match = re.search( r"^__version__ = ['\"]([^'\"]*)['\"]", version_file.read_text(), re.M ) if version_match: return version_match.group(1) raise RuntimeError("Failed to find version ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_version():\n init = read(\"src\", \"{{cookiecutter.module_name}}\", \"__init__.py\")\n return VERSION_RE.search(init).group(1)", "def get_version():\n init_py = open(os.path.join(PACKAGE_NAME, '__init__.py')).read()\n return re.search(\"__version__ = ['\\\"]([^'\\\"]+)['\\\"]\", init_py).grou...
[ "0.8263509", "0.81200486", "0.8036122", "0.788947", "0.7815058", "0.7798184", "0.77652556", "0.7677987", "0.76658064", "0.765544", "0.7644095", "0.7627291", "0.7626872", "0.7610348", "0.7610348", "0.7610348", "0.7610348", "0.7610348", "0.7610348", "0.7610348", "0.760331", "...
0.73769873
36
flags are locally scoped and will only effect the supplied pattern, nothing more
def __init__(self, pattern, flags=0): if flags: str_flags = hre.decodeflags(flags) pattern = r"(?%s:%s)"%(str_flags, pattern) super(Regex, self).__init__(pattern)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, pattern):\r\n self.pattern = pattern", "def add_regex_flag(vocab, pattern_str):\n flag_id = vocab.add_flag(re.compile(pattern_str).match)\n return flag_id", "def flag():\n pass", "def __init__(self, pattern):\n self._pattern = pattern.lower()", "def __init__(self, ...
[ "0.61030114", "0.60706294", "0.60552096", "0.59832364", "0.5979558", "0.5806734", "0.5704767", "0.56000733", "0.55459285", "0.55117047", "0.54956514", "0.5492899", "0.54871315", "0.5471751", "0.54650545", "0.54639566", "0.54463387", "0.54463387", "0.5410023", "0.53698367", "0...
0.6474127
0
Lookahead matching of the given parse expression. C{FollowedBy} does not advance the parsing position within the input string, it only verifies that the specified parse expression matches at the current position. C{FollowedBy} always returns a null token list.
def __init__(self, expr): pattern = r"(?=%s)" % _silent_pattern(expr) # standard lookahead super(FollowedBy, self).__init__(pattern, silent=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def match(self, input_reader):\n retval = []\n # skip the whitespace here to prevent errors at the end of the string\n if input_reader.getIgnoreState():\n input_reader.skipWhite()\n retval.append(self.__rule.match(input_reader))\n try:\n while True:\n ...
[ "0.57092345", "0.51224923", "0.50611615", "0.5051354", "0.5044692", "0.50340766", "0.5002219", "0.49619815", "0.49585378", "0.4927308", "0.4903575", "0.49026915", "0.48927513", "0.4887522", "0.48688808", "0.485787", "0.4854168", "0.48492277", "0.4842384", "0.47809103", "0.478...
0.614381
0
Converter to concatenate all matching tokens to a single string. By default, the matching patterns must also be contiguous in the input string; this can be disabled by specifying C{'adjacent=False'} in the constructor.
def __init__(self, expr): super(Combine, self).__init__(_silent_pattern(expr))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def concat_pattern():\n pattern = is_tuple(None)\n pattern = is_op(\"concatenate\")(pattern)\n\n return pattern", "def __str__(self):\n if self._tokens == '*' or self._tokens == '':\n return self._tokens\n self.compact()\n return \"\".join(str(s[0])+s[1] for s...
[ "0.59595114", "0.57842726", "0.5616125", "0.5448913", "0.5443619", "0.53175265", "0.52894366", "0.5280263", "0.52522457", "0.5182611", "0.5123116", "0.5114711", "0.51117396", "0.5109501", "0.51040983", "0.5074894", "0.50383157", "0.50181276", "0.49863017", "0.49685773", "0.49...
0.43721387
87
matches beginning of the text
def __init__(self): super(StringStart, self).__init__(r"^")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_match_start_check_at_beginning_of_string(self):\n first_letter = \"a\"\n s = \"abcdef\"\n self.assertEqual(__, re.search(first_letter, s).group())", "def test_search_must_not_start_at_the_beginning(self):\n pattern = \"cde\"\n s = \"abcdefabcdef\"\n self.assertE...
[ "0.7459816", "0.7157082", "0.70960927", "0.6685786", "0.6513345", "0.6484883", "0.62120664", "0.6208123", "0.6184214", "0.6173123", "0.6173123", "0.60689545", "0.60616946", "0.6007263", "0.5987133", "0.59861463", "0.59861463", "0.59760106", "0.5938425", "0.59302884", "0.58934...
0.57005984
33
matches the end of the text
def __init__(self): super(StringEnd, self).__init__(r"$")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_ends_with_tag(text):\n\treturn re_tag.search(text) != None", "def is_sentence_end(mystem_element):\n word = mystem_element.get('text', '')\n return word == '\\\\s' or word == '\\n'", "def _is_at_end(self):\n return self._peek().token_type == scanner.TokenType.EOF", "def end(text=None)...
[ "0.7476687", "0.6760125", "0.6562617", "0.6539688", "0.6499316", "0.6459909", "0.64461684", "0.6443235", "0.6415043", "0.64100724", "0.6400385", "0.63827956", "0.6360815", "0.634099", "0.63295174", "0.63171655", "0.6280718", "0.6259339", "0.6254817", "0.62466514", "0.6224799"...
0.0
-1
matches beginning of a line (lines delimited by \n characters)
def __init__(self): super(LineStart, self).__init__(r"^", regex.MULTILINE)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def beginning_of_line():\n app = get_app()\n before_cursor = app.current_buffer.document.current_line_before_cursor\n\n return bool(\n len(before_cursor) == 0 and not app.current_buffer.document.on_first_line\n )", "def test_single_match_returns_line(self):\n eq_(self.line,line_matches_...
[ "0.6724533", "0.6564636", "0.6491154", "0.6476332", "0.6458178", "0.63772756", "0.63512397", "0.6270179", "0.61780316", "0.61767286", "0.6069144", "0.6049681", "0.6032598", "0.6013289", "0.59645575", "0.59616494", "0.59479475", "0.59277445", "0.59225243", "0.59197265", "0.588...
0.6926507
0
matches the end of a line
def __init__(self): super(LineEnd, self).__init__(r"$", regex.MULTILINE)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def end_of_line():\n d = get_app().current_buffer.document\n at_end = d.is_cursor_at_the_end_of_line\n last_line = d.is_cursor_at_the_end\n\n return bool(at_end and not last_line)", "def is_eof(line):\n return line == \"\"", "def consume_endmarker(self) -> None:\n line = self.fetch(1, all...
[ "0.76364774", "0.75829315", "0.7319803", "0.72967774", "0.7241813", "0.7074683", "0.6728071", "0.6668653", "0.6628906", "0.6628906", "0.6628906", "0.65676385", "0.65182096", "0.65070575", "0.6411334", "0.6385906", "0.6384036", "0.6356747", "0.63522285", "0.6307246", "0.629779...
0.64160645
14
__dict__ of first element will be passed through And result
def And(iterable): try: gen = iter(iterable) first = next(gen) first.__class__ = ParserElement base = first + next(gen) # once (+) to have a new element for expr in gen: base += expr # in place addition to avoid copying return base except StopIteratio...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __dict__(self):\r\n return", "def __iter__(self):\n return dict(self.parameters)", "def __iter__(self):\n return iter({})", "def dict(self) -> Dict:\r\n return super().dict()", "def dict(self) -> Dict:\r\n return super().dict()", "def __iter__(self):\n return sel...
[ "0.62040645", "0.6012093", "0.59367734", "0.59250385", "0.59250385", "0.58250386", "0.5777455", "0.5736926", "0.5710979", "0.56667316", "0.56530744", "0.56530744", "0.56530744", "0.56530744", "0.56530744", "0.56530744", "0.56530744", "0.5637386", "0.5633632", "0.5605346", "0....
0.0
-1
__dict__ of first element will be passed through MatchFirst result
def MatchFirst(iterable): try: gen = iter(iterable) first = next(gen) first.__class__ = ParserElement base = first | next(gen) # once (|) to have a new element for expr in gen: base |= expr # in place or to avoid copying return base except StopIterati...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def first(self):", "def match(self, item):", "def _resolver_first(self, item: Any, *_: Any) -> Any:\n try:\n return next(iter(item))\n except StopIteration:\n assert False # not supposed to happen in current tests", "def test_iterate_candidates():\n schema = {\n ...
[ "0.58991224", "0.57390743", "0.55232596", "0.5517997", "0.5477718", "0.5353361", "0.52800155", "0.52528894", "0.52161586", "0.51638794", "0.5128384", "0.5103873", "0.5087606", "0.50297964", "0.49996066", "0.49995494", "0.49985522", "0.49985522", "0.49861073", "0.49752066", "0...
0.5412561
5
adds resultsname in place, no copy as with method
def setResultsNameInPlace(expr, name, listAllMatches=False): expr.setResultsName(name) return expr
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new_results(self, name):\n self.results[name] = copy.deepcopy(self.dict)\n return self.results[name]", "def setResultsName(self, name, **kwargs):\n return self", "def setResultsName(self, name, **kwargs):\n self.structure.set_name(name)\n return self", "def add_to_resul...
[ "0.7488943", "0.68073475", "0.653575", "0.6451395", "0.63623095", "0.63264364", "0.628756", "0.6123773", "0.60992354", "0.60139364", "0.5929875", "0.59268665", "0.5869892", "0.5869892", "0.5866788", "0.58469075", "0.578019", "0.57685715", "0.5736709", "0.57096404", "0.5701012...
0.71201277
1
Function to calculate sharpe ratio
def sharpe_ratio(r1, r2, rf, o1, o2, cov): def sr(x): w1 = x[0] w2 = 1 - w1 Rp = w1 * r1 + w2 * r2 STDEVp = math.sqrt(portfolio_variance(o1, o2, cov)(x)) R = (Rp - rf) / STDEVp return R return sr
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_sharpe_ratio(allocs, prices):\n\tport_val = get_portfolio_value(prices, allocs, start_val=1.0)\n\tsharpe_ratio = get_portfolio_stats(port_val, daily_rf=0.0, samples_per_year=252)[3]\n\treturn -sharpe_ratio", "def sharpe_ratio(self, r_f):\n return (\n self.cumulative_returns().last('1D')...
[ "0.71775174", "0.6924688", "0.6842624", "0.65903723", "0.64614457", "0.63057446", "0.621388", "0.6211801", "0.62085533", "0.6188876", "0.61764693", "0.6168705", "0.61206347", "0.59352535", "0.58917314", "0.5888528", "0.5863196", "0.5852122", "0.580885", "0.5797968", "0.579179...
0.6978456
1
An ugly solution that works and runs in O(len(S)+len(W)max(len(W[i])) in time and space
def ugly_solution(self, S: str, words: List[str]) -> int: count = 0 k, v = [], [] for key, value in groupby(S): k.append(key) v.append(list(value)) kk, vv = [], [] for word in words: kkk, vvv = [], [] for key, value in groupby(word): kkk.append(key) vvv.append...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solution(s):", "def better_solution(self, S: str, words: List[str]) -> int:\n def encode(S):\n return zip(*[(k, len(list(v))) for k, v in groupby(S)])\n\n k, v = encode(S)\n count = 0\n for word in words:\n kk, vv = encode(word)\n if k != kk:\n continue\n count += int(a...
[ "0.66980284", "0.6310912", "0.5983516", "0.5870128", "0.5866691", "0.5809376", "0.5785435", "0.5728468", "0.5718472", "0.5660262", "0.5630392", "0.56271183", "0.56244045", "0.56228566", "0.5622619", "0.56053615", "0.5599059", "0.5550877", "0.5534361", "0.55255306", "0.552341"...
0.63939565
1
A better solution that runs in same run and time complexity
def better_solution(self, S: str, words: List[str]) -> int: def encode(S): return zip(*[(k, len(list(v))) for k, v in groupby(S)]) k, v = encode(S) count = 0 for word in words: kk, vv = encode(word) if k != kk: continue count += int(all(c1 >= max(c2, 3) or c1 == c2 for c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solution(s):", "def solution():\n i = 1\n\n while True:\n if (\n sorted(str(i))\n == sorted(str(2 * i))\n == sorted(str(3 * i))\n == sorted(str(4 * i))\n == sorted(str(5 * i))\n == sorted(str(6 * i))\n ):\n retur...
[ "0.68023205", "0.6355133", "0.62611985", "0.62062913", "0.61780125", "0.61359423", "0.6107481", "0.60673547", "0.60637593", "0.60575277", "0.60428673", "0.6036304", "0.60319996", "0.60026586", "0.6001307", "0.59841186", "0.5968639", "0.5929165", "0.5871913", "0.58677447", "0....
0.0
-1
start_sleep_time time for wich all backoff process always will be sleep border_sleep_time maximum time wich procces will be wait, if service will not answer factor factor to multiply wait time jitter if True, proccess will be sleep random time between start_sleep_time and start_sleep_time factor
def backoff(start_sleep_time=0.1, border_sleep_time=30, factor=2, jitter=True): if start_sleep_time < 0.001: logger.warning('start_sleep_time fewer than 0.001 and will be set to 0.001') start_sleep_time = 0.001 def decorator(target): @wraps(target) def retry(*args, **kwargs): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def backoff_time(attempt, retry_backoff=2., max_delay=30.):\n delay = retry_backoff * (2 ** attempt)\n # Add +-25% of variation.\n delay += delay * ((random.random() - 0.5) / 2.)\n return min(delay, max_delay)", "def determine_sleep_times(self):\n\n determined_sleep_time = \\\n random.randr...
[ "0.6575967", "0.64338106", "0.6302687", "0.6217478", "0.6202927", "0.6117126", "0.6097843", "0.6096164", "0.60948235", "0.60805535", "0.6042051", "0.6040414", "0.6029319", "0.5992592", "0.598864", "0.5986761", "0.59843516", "0.5946478", "0.5908621", "0.5894738", "0.5891776", ...
0.7326327
0
Returns candidate words from the dictionaries by looking at the edit distances
def _candidates(self, token):
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_candidates(self, word):\n candidates = dict()\n for word_list_item in self.vocab_list:\n edit_distance = damerau_levenshtein_distance(word, word_list_item)\n if edit_distance <= 1:\n candidates[word_list_item] = edit_distance\n return sorted(candida...
[ "0.7445052", "0.63797855", "0.63719475", "0.62922674", "0.62409437", "0.6032358", "0.5935112", "0.5930762", "0.58684367", "0.5865186", "0.5863879", "0.5848819", "0.5848078", "0.58083117", "0.58079624", "0.578666", "0.5776913", "0.5765153", "0.5755829", "0.57348025", "0.572585...
0.0
-1
Returns frequency of the token
def _frequency_of(self, token): frequency_value_of_word = self._word_2_frequency.get(token) if not frequency_value_of_word: return 0 return frequency_value_of_word
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def freq(self) -> int:", "def freq():", "def frequency(self, word):\n if word in self:\n return self[word].tokens\n return 0", "def computeWordsFrequencies(self):\n token_stream = self._tokenize(self.readable)\n token_map = self._countTokens(token_stream)\n # pri...
[ "0.8070311", "0.78679377", "0.76784575", "0.74142516", "0.7385732", "0.7375787", "0.735579", "0.7177395", "0.7167934", "0.7024137", "0.70036995", "0.69915587", "0.69732666", "0.6970479", "0.69324076", "0.69139016", "0.6905725", "0.6893925", "0.6890974", "0.68878806", "0.68825...
0.8163045
0
Returns the subset of words that appear in the vocabulary
def _known_in(self, words): return set(word for word in words if self._word_2_frequency.get(word))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def known(words):\n return [w for w in words if w in tokenizer.vocab] #change vocab file?", "def vocabulary(corpus_tokenized):\n vocab = list()\n for element in corpus_tokenized:\n document = element['document']\n for word in document:\n if word not in vocab:\n vo...
[ "0.7594449", "0.720146", "0.70779043", "0.7063525", "0.7058395", "0.69525725", "0.69047606", "0.69046646", "0.6876374", "0.68029535", "0.6776875", "0.6718827", "0.6660168", "0.6533313", "0.6492384", "0.64660704", "0.6452104", "0.64520884", "0.642334", "0.64188725", "0.6406661...
0.63981956
22
Tokenizes the utterance and corrects each token
def correct(self, utterance): tokens = self._tokenizer(utterance.lower()) corrected_tokens = [self._correct_token(token) for token in tokens] return self._retokenizer(corrected_tokens)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_tokens_and_lemmetize(self, tweet_tokens: list) -> list:\n\n cleaned_tokens = []\n\n pos_dict = {'V': 'v', 'N': 'n'}\n for token, tag in pos_tag(tweet_tokens):\n token = re.sub('(https?:\\/\\/(?:www\\.|(?!www))[a-zA-Z0-9][a-zA-Z0-9-]\\\n +[a-zA-Z0-9]\\.[^\\s]...
[ "0.64839673", "0.64127326", "0.63831973", "0.63160646", "0.62622374", "0.62543154", "0.6233098", "0.6205803", "0.62020516", "0.6178733", "0.61561644", "0.61272216", "0.6113682", "0.61115193", "0.61115193", "0.6100868", "0.6097759", "0.6081727", "0.6078775", "0.60780025", "0.6...
0.7098633
0
Returns candidate words from the dictionaries by looking at the edit distances
def _candidates(self, token): token_as_list = [token] token_1_edits = NorvigCorrector._one_edit_token_distances(token) token_2_edits = NorvigCorrector._two_edits_token_distances(token) return ( self._known_in(token_as_list) or self._known_in(token_1_edits) or self._known_in(t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_candidates(self, word):\n candidates = dict()\n for word_list_item in self.vocab_list:\n edit_distance = damerau_levenshtein_distance(word, word_list_item)\n if edit_distance <= 1:\n candidates[word_list_item] = edit_distance\n return sorted(candida...
[ "0.7445052", "0.63797855", "0.63719475", "0.62922674", "0.62409437", "0.6032358", "0.5935112", "0.5930762", "0.58684367", "0.5865186", "0.5863879", "0.5848819", "0.5848078", "0.58083117", "0.58079624", "0.578666", "0.5776913", "0.5765153", "0.5755829", "0.57348025", "0.572585...
0.0
-1
Returns the one edit distances of the token
def _one_edit_token_distances(token): splitted_token_pairs = [(token[:i], token[i:]) for i in range(len(token) + 1)] deleted_distances = ( left_split + right_split[1:] for left_split, right_split in splitted_token_pairs if right_split) inserted_variations = ( left_split +...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _two_edits_token_distances(token):\n return (\n two_edits_distance_of_word for one_edit_distance_of_word in NorvigCorrector._one_edit_token_distances(\n token) for two_edits_distance_of_word in NorvigCorrector._one_edit_token_distances(\n one_edit_distance_of...
[ "0.7460531", "0.6638046", "0.66191673", "0.6553232", "0.6533313", "0.6435335", "0.6410075", "0.63724303", "0.6183879", "0.6125283", "0.6087842", "0.5997161", "0.59966505", "0.5862038", "0.5844792", "0.58082", "0.5770743", "0.56975096", "0.5694219", "0.56764853", "0.5661425", ...
0.74810326
0
Returns the two edit distances of the token
def _two_edits_token_distances(token): return ( two_edits_distance_of_word for one_edit_distance_of_word in NorvigCorrector._one_edit_token_distances( token) for two_edits_distance_of_word in NorvigCorrector._one_edit_token_distances( one_edit_distance_of_word))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _one_edit_token_distances(token):\n splitted_token_pairs = [(token[:i], token[i:]) for i in range(len(token) + 1)]\n deleted_distances = (\n left_split + right_split[1:] for left_split, right_split in splitted_token_pairs if right_split)\n inserted_variations = (\n le...
[ "0.73686165", "0.7345276", "0.73087025", "0.72469914", "0.6769684", "0.675673", "0.6731244", "0.67224896", "0.6405587", "0.62889516", "0.6235302", "0.6150123", "0.6112475", "0.60474837", "0.60397756", "0.60285234", "0.6020914", "0.5996137", "0.59572864", "0.59506327", "0.5943...
0.7739078
0
Returns candidate words from the dictionaries by looking at the edit distances
def _candidates(self, token): token_as_list = [token] token_1_edits = SymmetricDeleteCorrector._one_edit_deleted_variations(token) token_2_edits = SymmetricDeleteCorrector._two_edits_deleted_variations(token) return ( self._known_in(token_as_list) or self._deleted...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_candidates(self, word):\n candidates = dict()\n for word_list_item in self.vocab_list:\n edit_distance = damerau_levenshtein_distance(word, word_list_item)\n if edit_distance <= 1:\n candidates[word_list_item] = edit_distance\n return sorted(candida...
[ "0.74451125", "0.6379122", "0.63712984", "0.6292692", "0.62401664", "0.603273", "0.5935713", "0.593242", "0.5867233", "0.5865679", "0.5864875", "0.58493054", "0.5848584", "0.5810966", "0.5808733", "0.5786027", "0.57760483", "0.5763759", "0.57558244", "0.5735191", "0.57252365"...
0.0
-1
Creates the deleted variation to dictionary words
def _create_deleted_variation_2_dictionary_words(self): deleted_variation_2_dictionary_words = defaultdict(set) for word in self._word_2_frequency.keys(): deleted_variations = chain(self._one_edit_deleted_variations(word), self._two_edits_deleted_variations(word)) for deleted_var...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def constitute_word_dict(self):\r\n\r\n #IS THIS NECESSARY WITH DATABASE??\r\n\r\n if self.using_shelf:\r\n for k_temp in self.get_words():\r\n self.delete_word(k_temp)\r\n\r\n for i_temp in [a_temp for a_temp in self.indexes()\r\n if Index(a_tem...
[ "0.6810291", "0.6484141", "0.6279463", "0.61285645", "0.60841674", "0.60628283", "0.60328877", "0.60259354", "0.6014623", "0.599867", "0.5962856", "0.5923651", "0.5922238", "0.5905566", "0.5870536", "0.58691525", "0.5840234", "0.5830632", "0.58221495", "0.5821239", "0.5805232...
0.8154589
0
Returns the one edit deleted variations of the token
def _one_edit_deleted_variations(token): splitted_token_pairs = [(token[:i], token[i:]) for i in range(len(token) + 1)] return (left_split + right_split[1:] for left_split, right_split in splitted_token_pairs if right_split)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _two_edits_deleted_variations(token):\n return (\n two_edits_distance_of_word for one_edit_distance_of_word in\n SymmetricDeleteCorrector._one_edit_deleted_variations(token) for two_edits_distance_of_word in\n SymmetricDeleteCorrector._one_edit_deleted_variations(one_edi...
[ "0.75817436", "0.614762", "0.60068387", "0.5992109", "0.5739046", "0.5739046", "0.5627935", "0.55786633", "0.5472322", "0.54617894", "0.52510107", "0.52435124", "0.5187034", "0.5068616", "0.5025506", "0.5009688", "0.50048673", "0.4995821", "0.49677786", "0.4938722", "0.492104...
0.7687418
0
Returns the two edit deleted variations of the token
def _two_edits_deleted_variations(token): return ( two_edits_distance_of_word for one_edit_distance_of_word in SymmetricDeleteCorrector._one_edit_deleted_variations(token) for two_edits_distance_of_word in SymmetricDeleteCorrector._one_edit_deleted_variations(one_edit_distanc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _one_edit_deleted_variations(token):\n splitted_token_pairs = [(token[:i], token[i:]) for i in range(len(token) + 1)]\n return (left_split + right_split[1:] for left_split, right_split in splitted_token_pairs if right_split)", "def _two_edits_token_distances(token):\n return (\n ...
[ "0.7830289", "0.6501761", "0.6358295", "0.61561555", "0.60037905", "0.5835675", "0.5647721", "0.5647721", "0.5622455", "0.5511201", "0.5399774", "0.5336072", "0.5334806", "0.5281815", "0.5241469", "0.5086132", "0.50707567", "0.5040011", "0.5039645", "0.502873", "0.50018567", ...
0.79751015
0
creates random name using prefix and podstfix list
def name_generator(): prefix_list = [ "admiring", "adoring", "affectionate", "agitated", "amazing", "angry", "awesome", "beautiful", "blissful", "bold", "boring", "brave", "busy", "charming", "clever", "cool", "compassionate", "competent", "confident", "crazy", "dazzling", "determine...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def random_name(prefix='test'):\n rndbytes = os.urandom(8)\n md5 = hashlib.md5()\n md5.update(rndbytes)\n return '{}_{}'.format(prefix, md5.hexdigest()[:7])", "def generate_name(prefix):\n suffix = generate_uuid()[:8]\n return '{0}_{1}'.format(prefix, suffix)", "def fixture_make_unique_name()...
[ "0.7150694", "0.6983631", "0.66490257", "0.65892994", "0.6525399", "0.6470662", "0.64642584", "0.63855755", "0.6346495", "0.6342627", "0.6325903", "0.6323696", "0.6320582", "0.6301048", "0.62752664", "0.6265931", "0.6225501", "0.62056917", "0.61992645", "0.6192563", "0.618883...
0.70794344
1
Creates the predictions for the masked LM objective.
def create_masked_lm_predictions_based_given(tokens, max_predictions_per_seq, segment_ids): tokens_len = len(tokens) output_tokens = [] masked_lm_positions = [] masked_lm_labels = [] segment_ids_new = [] i=0 idx=0 num_masks = 0 while i < tokens_len: tok = tokens[i] if tok==u'01': maske...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_masked_lm_predictions(self,tokens, masked_lm_prob,\n max_predictions_per_seq, vocab_words, rng):\n\n cand_indexes = []\n for (i, token) in enumerate(tokens):\n if token == \"[CLS]\" or token == \"[SEP]\":\n continue\n # Whole Word Mask...
[ "0.7088187", "0.7078701", "0.70093477", "0.68983495", "0.68388635", "0.68317044", "0.63680357", "0.61000663", "0.60574543", "0.6040631", "0.59481055", "0.58741295", "0.5852571", "0.5783499", "0.5720174", "0.5705252", "0.56482947", "0.56482947", "0.5646142", "0.5646142", "0.56...
0.64624184
6
Run the style transfer.
def run_LBFGS_transfer(embeddings, input_type_ids, input_mask, input_ids, next_sentence_labels, model_out, num_steps=20, style_weight=1, content_weight=1): print('Building the style transfer model..') masked_lm_loss, next_sentence_loss, masked_lm_logits_scores, seq_r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_style_transfer(self, content_and_style_class,\n num_iterations=3000,\n content_weight=1e-1,\n style_weight=1e2,\n ta_weight=1,\n save=False):\n # trainable to false.\n ...
[ "0.6577166", "0.6574639", "0.63947445", "0.632196", "0.62253326", "0.61658293", "0.61573493", "0.61570954", "0.5726317", "0.57210195", "0.5577958", "0.54556286", "0.54371464", "0.54241574", "0.5423986", "0.5374224", "0.53283286", "0.5305154", "0.52452993", "0.5238506", "0.523...
0.0
-1
this returns a density dependent population process of an SIR model
def sir_model(): ddpp = rmf.DDPP() ddpp.add_transition([-1,1,0],lambda x:x[0]+2*x[0]*x[1]) ddpp.add_transition([0,-1,+1],lambda x:x[1]) ddpp.add_transition([1,0,-1],lambda x:3*x[2]**3) ddpp.set_initial_state([.3,.2,.5]) # We first need to define an initial stater return ddpp
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def d_SIR(u,parametres):\r\n S = u[0]\r\n I = u[2]\r\n N = parametres[0]\r\n demo = parametres[1]\r\n beta = parametres[2]\r\n gamma = parametres[3]\r\n return np.array([[-beta*I/N,0,-beta*S/N,0,0],[0,0,0,0,0],[beta*I/N,0,beta*S/N-gamma,0,0],[0,0,gamma,0,0],[0,0,0,0,0]])", "def density(temp,...
[ "0.594957", "0.5948744", "0.57866687", "0.5670235", "0.55575085", "0.5497227", "0.5432012", "0.5432012", "0.54252124", "0.5406989", "0.53866404", "0.53780395", "0.53753906", "0.53392345", "0.532365", "0.53202826", "0.53138345", "0.53130454", "0.53034365", "0.5302921", "0.5301...
0.59713703
0
datas to be tested (from the model)
def function(model, x0): values = [model.defineDriftDerivativeQ(evaluate_at=x0), model.defineDriftSecondDerivativeQderivativesR(evaluate_at=x0)] return [array for mytuple in values for array in mytuple ]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_data(self):\n\n return self.__valid_data, self.__valid_labels", "def test_set_data_attributes(self):\n\n self.mediator.get_results()", "def testGetModelsData(self):\n models = models_logic._getModelsData()\n self.assertTrue(models)", "def test_data_in_param(self):", "def test_p...
[ "0.7144107", "0.7043283", "0.69385195", "0.6907699", "0.67905295", "0.6768344", "0.6762318", "0.6753012", "0.6725048", "0.671619", "0.6715869", "0.6684966", "0.6623228", "0.6601191", "0.65910333", "0.65051377", "0.6480545", "0.6455283", "0.6418601", "0.6366668", "0.6356498", ...
0.0
-1
Takes two sequences of data and return the sum of the absolute differences between all
def absolute_difference(new_data, old_data): diff = 0 assert len(new_data) == len(old_data) for new, old in zip(new_data, old_data): diff += np.sum(np.abs(new-old)) return diff
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def absolute_difference(x1: np.ndarray, x2: np.ndarray) -> float:\n assert isinstance(x1, np.ndarray) and isinstance(x2, np.ndarray)\n return np.absolute(x1 - x2).sum()", "def minusRes(res1, res2):\n return [(x - y) for x, y in zip(res1, res2)]", "def calcSum2(data1, data2): \n \n data11 = data1...
[ "0.7245496", "0.65538746", "0.6548169", "0.6521336", "0.6393904", "0.6391251", "0.6290411", "0.62849253", "0.6262603", "0.61964387", "0.61614966", "0.6133634", "0.61204493", "0.6114484", "0.60988724", "0.6095925", "0.60876584", "0.60465556", "0.6027689", "0.6021893", "0.60155...
0.7623687
0
Generate a pickle file with the current version of the tool.
def generate_data(): model = sir_model() data = dict([]) for i in range(10): x0 = np.random.rand(3) x0 = x0/sum(x0) data[tuple(x0)] = function(model, x0) print(x0) with open('{}/drift_derivatives.pickle'.format(CACHE_DIR), 'wb') as f: # Pickle the 'data' dictionar...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _pickle_path(self) -> Path:\r\n return self.output_path / \"pickles\"", "def dumpme(self) :\n fileName = \"./data/oP4_ModelBuilder.dump\"\n with open(fileName,\"wb\") as dumpedFile:\n oPickler = pickle.Pickler(dumpedFile)\n oPickler.dump(self)", "def io_pickle_file():...
[ "0.6512416", "0.64114046", "0.6162565", "0.60745955", "0.58623403", "0.58478934", "0.5795711", "0.57190627", "0.5663178", "0.5650875", "0.5619514", "0.5615624", "0.55739355", "0.55288756", "0.5496679", "0.5492069", "0.5476334", "0.54596454", "0.5444554", "0.54435253", "0.5440...
0.0
-1
Test if derivatives are correct
def test_drift_derivatives(): model = sir_model() with open('{}/drift_derivatives.pickle'.format(CACHE_DIR), 'rb') as f: data = pickle.load(f) for x0 in data: print(x0, 'OK') new_data = function(model, np.array(x0)) test_data = data[x0] assert abso...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_dg_de(self):\n dfn = lambda x: self.model.g(self.s, x, self.t, self.T)\n nderiv = differentiate(dfn, self.e)\n cderiv = self.model.dg_de(self.s, self.e, self.t, self.T)\n self.assertTrue(np.isclose(nderiv, cderiv, rtol = 1.0e-4))", "def test_dg_ds(self):\n dfn = lambda x: self.model.g(x, ...
[ "0.74486", "0.74408644", "0.7392387", "0.71654516", "0.6677398", "0.6653746", "0.65808666", "0.65401244", "0.6472054", "0.6465151", "0.64444363", "0.64302665", "0.6384481", "0.6366423", "0.6358769", "0.6340351", "0.633646", "0.6328038", "0.63234633", "0.63190013", "0.63186324...
0.6442464
11
get node data from a json file
def getNodeData(self, file): with open('./data/{}.json'.format(file), 'r') as json_file: try: objs = [] data = json_file.read() dic = json.loads(data)['data'] for i in dic: objs.append(Entity(i['id'], i['name'])) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_data(node):\n return node['data']", "def get_json_data(json_file):\n logging.log(logging.DEBUG, \"Extracting JSON file %s\" % json_file)\n with open(json_file, \"r\") as json_d:\n d = json.load(json_d)\n return d", "def getEdgeData(self, file):\n\n with open('./data/{}.json'.f...
[ "0.68290836", "0.6781301", "0.6769785", "0.66034156", "0.6499282", "0.64148074", "0.6403095", "0.63928735", "0.6382607", "0.63717014", "0.63713247", "0.6370972", "0.6365524", "0.6348017", "0.63064176", "0.62792647", "0.6270903", "0.62460166", "0.62435853", "0.62405324", "0.62...
0.74540293
0
get edge data from a json file
def getEdgeData(self, file): with open('./data/{}.json'.format(file), 'r') as json_file: try: data = json_file.read() return json.loads(data)['data'] except Exception as e: print(e)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_read_json1():\n s = JsonSource()\n g = s.parse(os.path.join(RESOURCE_DIR, 'valid.json'))\n nodes = {}\n edges = {}\n for rec in g:\n if rec:\n if len(rec) == 4:\n edges[(rec[0], rec[1])] = rec[3]\n else:\n nodes[rec[0]] = rec[1]\n\n...
[ "0.6612572", "0.64917535", "0.6468805", "0.64079446", "0.6126041", "0.6125289", "0.611786", "0.6089167", "0.60870355", "0.6072723", "0.60507375", "0.60412115", "0.6011671", "0.59364545", "0.5920987", "0.5885477", "0.587848", "0.5866589", "0.5837983", "0.58012176", "0.5772618"...
0.8260459
0
get config values from config.json
def getConfig(self, config): with open('./config.json', 'r') as json_file: try: data = json_file.read() return json.loads(data)[config] except Exception as e: print(e)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_config():\n handle = open(\"config.json\", \"r\")\n raw_json = handle.read()\n handle.close()\n return json.loads(raw_json)", "def get_config():\n\n return json.loads(CONFIG_FILE.read_text())", "def config():\n with open(config_path) as config_file:\n data = json.load(config_fi...
[ "0.7822822", "0.77645606", "0.7666279", "0.76599467", "0.7431984", "0.7382189", "0.71417624", "0.71175736", "0.710821", "0.70374674", "0.70326966", "0.69988185", "0.6972378", "0.6971484", "0.69543666", "0.69187796", "0.69164115", "0.6905965", "0.68725795", "0.68205625", "0.68...
0.78410286
0
get Node using it's ID
def getNodeById(self, nodes, id): for item in nodes: if item.getProperty('id') == id: return item
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_node_by_id(self, id):\r\n for n in self.nodes:\r\n if n.id==id:\r\n return n\r\n return None", "def getnode(self, id: int) -> node_data:\n return self.Nodes[id]", "def get_node(self, _id):\n return self.make_request(\"GET\", \"nodes/\"+_id, {})", ...
[ "0.87735546", "0.8293469", "0.82840246", "0.8281298", "0.77772284", "0.77547264", "0.770013", "0.7696881", "0.7687932", "0.7687932", "0.7620842", "0.7558624", "0.75013095", "0.74228144", "0.72494537", "0.7239995", "0.721944", "0.71209675", "0.70884997", "0.7025952", "0.700373...
0.7975717
4
Uploads a file to the bucket.
def upload_files(self, source_file_name, destination_blob_name): blob = self.bucket.blob(destination_blob_name) blob.upload_from_filename(source_file_name) print( "File {} uploaded to {} in {} bucket.".format( source_file_name, destination_blob_name, self.bucket ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upload(self, file_path, bucket_name, file_name):\n\n self.client.upload_file(file_path, bucket_name, file_name)", "def upload_file(\n self, bucket_id: uplink.Path, filename: uplink.Path, file: uplink.Body\n ):\n pass", "def upload_file(bucket_name, filename, file):\n client = get...
[ "0.8588696", "0.8466648", "0.8340263", "0.80842817", "0.7956433", "0.7941887", "0.7916317", "0.78907514", "0.7868876", "0.7842521", "0.782565", "0.7808135", "0.77641773", "0.77560735", "0.77194613", "0.7699153", "0.7697878", "0.76752263", "0.76390654", "0.76050806", "0.754288...
0.70723397
60
Locked name does not necessarily exist but is the convention for all locked file names.
def __init__(self): super(NetworkManager, self).__init__() self.user = None self.contactInfo = {} self._file = '' self._locked = None self._lockedFile = self._file + consts.LOCKED_NOTIFIER self._is_local = None self._is_locked = False self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_lock_file(name):\n\n # Sanitize the global lock name by using URL-style quoting, which\n # keeps most ASCII characters (nice) and turns the rest into ASCII.\n name = urllib.parse.quote_plus(name)\n\n # Add a global thing for ourself.\n name = \"py_exclusivelock_\" + name\n\n if os.path.is...
[ "0.66529053", "0.6519242", "0.65097946", "0.64328307", "0.6292754", "0.6268115", "0.620599", "0.60666156", "0.60344714", "0.5971618", "0.5926985", "0.5882121", "0.5766307", "0.5670884", "0.5656948", "0.5623486", "0.5613016", "0.5577803", "0.5557742", "0.55561566", "0.5554919"...
0.0
-1
Looks at file's name to get the username of the person. Sends that person an email, requesting access to the file
def request_access(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def users_filename(self):\n pass", "def picture_name(self, filename):\n return '%s%s'%(self.username, splitext(filename)[1])", "def send_file_name():\n if value.get() == \"----------------------\":\n messagebox.showinfo(\"Choose File\", \"Please choose a file to edit.\", parent=...
[ "0.6601799", "0.60246694", "0.59635353", "0.58238286", "0.5815965", "0.57149166", "0.57149166", "0.5625246", "0.55697244", "0.55019593", "0.5499112", "0.5487572", "0.54667807", "0.5463769", "0.5442607", "0.54387337", "0.54381704", "0.5427805", "0.5422216", "0.54099715", "0.53...
0.0
-1
Sets the contact information on the locked file being queried. Creates a locked file if none exists
def set_contact_info(self, *args, **kwargs): if self._file is None: LOGGER.error(["AIE7602"]) return None pass # ::TO DO:: append to the contact info variable (so that it can be queried)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def locked(self, status):\n self._locked = status # regardless of network condition, set the state\n\n # test for locked file types and set/delete data if necessary\n if status == True and not os.path.isfile(self._lockedFile):\n lockedInfoDict = self.get_contact_info()\n\n ...
[ "0.6619195", "0.63302183", "0.59904164", "0.5968864", "0.5957725", "0.5929916", "0.58473015", "0.5818651", "0.5649607", "0.5638628", "0.5603077", "0.5470479", "0.5425234", "0.54109716", "0.5408093", "0.5405351", "0.5381302", "0.5313618", "0.5309879", "0.5304098", "0.5289235",...
0.6325732
2
Used to determine if a user is accessing a file from the local space or from over the network collaborative space
def is_local(self): if not "COLLABORATIVE" in self._file.upper(): LOGGER.debug(['AIE4606', 'match_false'], {'file': self._file}) return True else: LOGGER.debug(['AIE4607', 'match_true'], {'file': self._file}) return False return self._is_local
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def local(self):\r\n return self._url.scheme in ('', 'file')", "def is_local(self):\n try:\n return os.path.isfile(self.get_absolute_path())\n except ValueError:\n logger.error(\"'%s' is not a file\", self.get_absolute_path())\n except TypeError: # no datafile avail...
[ "0.68394345", "0.6371771", "0.6318138", "0.6003473", "0.5885277", "0.58569914", "0.5808809", "0.58042467", "0.5800792", "0.5788042", "0.57299757", "0.5725294", "0.5709621", "0.5707535", "0.5704905", "0.5691405", "0.56619984", "0.5624465", "0.56215996", "0.55953", "0.55869484"...
0.60794324
3
Determine if user is working remotely from home by finding out if they're hardwired to the SCAD network
def is_remote(self): if socket.gethostbyname(socket.gethostname()).startswith('10.7'): return False else: return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def local(self):\n return self.hostname == \"localhost\" and self.user is None and self.ssh_args is None", "def isInternal(self):\n\n\t\t# TODO optimization do we really need to look at the host attributes?\n\t\t# maybe we can just use the global attribute (faster)\n\t\tfe = self.newdb.getFrontendName()\n...
[ "0.6746262", "0.6501059", "0.639614", "0.6300451", "0.6245207", "0.623486", "0.6172692", "0.6162669", "0.6123355", "0.6117255", "0.6056349", "0.60108894", "0.598257", "0.5924982", "0.5924665", "0.5913644", "0.59085006", "0.58952856", "0.5883244", "0.58753103", "0.58581614", ...
0.64587235
2
Check if the current user is registered in the group. Also useful to perform checks to make sure that the current file was last saved by the current user
def is_registered(self): if self.user == getpass.getuser(): return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def es_utilizado(self):\n group = Group.objects.filter(id=self.id)\n group = group.all()[0] if group.exists() else None\n # group = Group.objects.get(name=self.nombre)\n return group.user_set.all().exists() if group is not None else False", "def uploaded_by_group(self) -> bool:\n ...
[ "0.690413", "0.67884076", "0.6780551", "0.6506758", "0.6494973", "0.6420326", "0.6378534", "0.6368675", "0.6305088", "0.6275783", "0.6195581", "0.61794806", "0.61671656", "0.6150682", "0.61350936", "0.61300755", "0.61207616", "0.60981613", "0.60970503", "0.6087024", "0.608025...
0.71394736
0
Locks the current file with a self.lockedName with information about the current user inside of the locked file
def locked(self): return self._locked
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def acquire(self):\r\n start_time = time.time()\r\n import getpass\r\n userName = getpass.getuser()\r\n import platform\r\n computerName = platform.uname()[1]\r\n while True:\r\n try:\r\n self.fd = os.open(self.lockfile, os.O_CREAT|os.O_EXCL|os.O_...
[ "0.7319412", "0.6713311", "0.6704923", "0.65925634", "0.6558025", "0.64695764", "0.64668727", "0.63746464", "0.6370193", "0.6352582", "0.6290588", "0.62440544", "0.61972994", "0.6195987", "0.618115", "0.61459136", "0.6136329", "0.6128319", "0.6116032", "0.6029182", "0.6026486...
0.5496984
79
Set method for locking or unlocking a specified file over the network Setting the locked method to true will generate a locked file version Setting the locked method to false will delete the locked file version
def locked(self, status): self._locked = status # regardless of network condition, set the state # test for locked file types and set/delete data if necessary if status == True and not os.path.isfile(self._lockedFile): lockedInfoDict = self.get_contact_info() with open...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def file(self, file_h):\n if os.path.exists(file_h):\n self._file = file_h\n self._lockedFile = self._file + consts.LOCKED_NOTIFIER\n self.locked = self.is_locked\n else:\n self._file = None\n self._lockedFile = None", "def is_locked(self):\n ...
[ "0.6429591", "0.62945414", "0.62620234", "0.6154761", "0.61190027", "0.60099566", "0.5973717", "0.58742625", "0.58742625", "0.58257365", "0.5809529", "0.57795733", "0.57549113", "0.57517904", "0.5742705", "0.5740216", "0.57396597", "0.57032406", "0.5677568", "0.5675368", "0.5...
0.6693105
0
Given a file path, determine if the locked version of the file exists in the same directory
def is_locked(self): return self._is_locked
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_locked(filepath):\n locked = None\n file_object = None\n if os.path.exists(filepath):\n try:\n #print(\"Trying to open %s.\" % filepath)\n buffer_size = 8\n # Opening file in append mode and read the first 8 characters.\n file_object = open(filepat...
[ "0.7873738", "0.7703074", "0.7274687", "0.7218735", "0.7059324", "0.70378995", "0.7030156", "0.7021772", "0.6967949", "0.6939281", "0.69273204", "0.6913889", "0.6906323", "0.6902612", "0.68610716", "0.68346906", "0.6776115", "0.6736323", "0.6736237", "0.6734509", "0.6727924",...
0.0
-1
Setter method for is_locked
def is_locked(self): if not os.path.isfile(self.file) or not os.path.isfile(self._lockedFile): self._is_locked = False else: self._is_locked = True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_locked(self):\r\n pass", "def is_locked(self):\n return self._is_locked", "def locked(self, value):\n if value is None:\n value = False\n elif isinstance(value, int):\n value = value == 1\n elif isinstance(value, str):\n value = value.l...
[ "0.8403629", "0.79370964", "0.7698656", "0.7669855", "0.765417", "0.7645083", "0.75940216", "0.75510615", "0.74765366", "0.7468049", "0.7452025", "0.7397617", "0.736937", "0.73543483", "0.7347248", "0.7297758", "0.72975045", "0.72965384", "0.72836757", "0.72325194", "0.719225...
0.73259944
15
Checks if the current user is a registered admin for the current project
def is_admin(self): return self._is_admin
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_admin(self):\n if not self.current_user:\n return False\n else:\n return self.current_user in [\"1\"]", "def check_is_admin(current_user):\n return current_user['isAdmin'] == True", "def is_admin(user):\n return user.is_authenticated and user.id == app.confi...
[ "0.8297756", "0.8160167", "0.80554956", "0.8043304", "0.79863364", "0.79214054", "0.7903485", "0.7887539", "0.7857068", "0.78517", "0.78253925", "0.7813934", "0.78050643", "0.7784232", "0.7778466", "0.77617514", "0.77617204", "0.77617204", "0.7747296", "0.77374744", "0.772453...
0.7416524
38
Method to determine if a specific user has access to a given file
def has_access(self): self._has_access = False if self.read_contact_info is not None: if self.read_contact_info['USERNAME'] == consts.USERNAME or \ consts.USERNAME in consts.REGISTEREDADMINS: self._has_access = True return self._has_access
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_repo_file_privilege(login, repo_base, repo, privilege):\n repo = repo.lower()\n repo_base = repo_base.lower()\n\n # Users always have privileges over their own files.\n if login == repo_base:\n return\n\n # Check if the current user or the public user has the p...
[ "0.6930615", "0.6836904", "0.6724489", "0.66948104", "0.6682556", "0.66695434", "0.66538167", "0.6621766", "0.6619583", "0.65748703", "0.65140116", "0.6506986", "0.6495302", "0.6474799", "0.64360607", "0.6389911", "0.6389425", "0.6388728", "0.6342937", "0.6318559", "0.6317628...
0.6043489
37
Gets and sets a handler which points to a file. By default, the requested file does not have to be any particular type
def file(self): return self._file
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getHandler(self):\n raise NotImplementedError(\"Shouldn't be called\")", "def get_file(self, filename, handler=False):\n result = None\n if self.exists(filename):\n file_path = join_paths(self.path, filename)\n if handler:\n result = open(file_path, '...
[ "0.6235745", "0.6198772", "0.6150657", "0.61482644", "0.6148208", "0.6085737", "0.6083981", "0.60715765", "0.60701716", "0.58436525", "0.5803957", "0.5717897", "0.56975657", "0.5662963", "0.56386894", "0.5610936", "0.5596063", "0.5585613", "0.5567606", "0.5543669", "0.5522854...
0.5066331
88
This is the set method for the self._file attribute
def file(self, file_h): if os.path.exists(file_h): self._file = file_h self._lockedFile = self._file + consts.LOCKED_NOTIFIER self.locked = self.is_locked else: self._file = None self._lockedFile = None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def file(self, file) :\n\t\ttry :\n\t\t\tself._file = file\n\t\texcept Exception as e:\n\t\t\traise e", "def file(self, file):\n\n self._file = file", "def file(self, file):\n\n self._file = file", "def file(self, file):\n\n self._file = file", "def setFile(self, filename): #$NON-NLS-1...
[ "0.7904883", "0.78903043", "0.78903043", "0.78903043", "0.76915526", "0.74483263", "0.7437798", "0.70267606", "0.69860595", "0.6880995", "0.68352175", "0.6819517", "0.6819517", "0.6795758", "0.67829293", "0.6750898", "0.6711711", "0.66994476", "0.66848433", "0.66604096", "0.6...
0.63434905
35
This is the delete method for the self._file attribute
def file(self): del self._file
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete(self, filename):\n pass", "def delete(self, *args, **kwargs):\n self.file.storage.delete(self.file.name)\n super().delete(*args, **kwargs)", "def delete(self, filename):\n raise NotImplementedError", "def delete(self):\n\n try:\n remove(self.fi...
[ "0.85430634", "0.84725296", "0.8472122", "0.8437599", "0.8379431", "0.8186978", "0.8156367", "0.8096573", "0.8061327", "0.7823987", "0.7781638", "0.77410585", "0.76950413", "0.7685722", "0.7676339", "0.75810295", "0.7514508", "0.7480745", "0.74576366", "0.7417653", "0.7394873...
0.7923327
9
Reads the contact information on the locked file being queried
def read_contact_info(self): if not os.path.isfile(self._lockedFile): LOGGER.error(['AIE7601', 'match_false'], {'file': self._file}) return None with open(self._lockedFile) as f: contactInfo = f.read() contactInfo = json.loads(contactInfo) LOGGER.deb...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def simple_contacts(filename):\n\n try:\n file_path = open(filename, 'r', encoding='utf-8')\n\n except FileNotFoundError:\n pretty_print(\"Cannot open contacts.txt\", \":\")\n sleep(3)\n\n else:\n with file_path:\n print_list = []\n email_dict = {}\n ...
[ "0.6030336", "0.58627254", "0.5794467", "0.571189", "0.5666441", "0.55783695", "0.55464315", "0.5537097", "0.54523414", "0.54176277", "0.5404614", "0.53873605", "0.5383962", "0.5369375", "0.5341976", "0.5339391", "0.52636397", "0.5230393", "0.5212816", "0.51953137", "0.519079...
0.7421391
0
Generates contact information from the current user. Used to insert information about the current session to a locked file
def get_contact_info(self): outputDict = {"USERNAME": consts.USERNAME, "IP": consts.IPADDRESS, "MACHINE": consts.HOSTNAME, "EMAIL": 'ckenne24@student.scad.edu', "PHONE": '203-722-6620'} # ::: TO DO::: dynamically get pho...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_contact(self, update, context):\n user = update.effective_user\n chat_id = update.effective_chat.id\n phone = update.message.contact.phone_number\n log.info(\n \"TEL from %s, %s, @%s, %s\", user.username, user.full_name, chat_id, phone,\n )\n\n # Here's a...
[ "0.6068317", "0.59416777", "0.5837409", "0.578141", "0.5709636", "0.569902", "0.56854504", "0.56514823", "0.563346", "0.5628087", "0.5613098", "0.5603869", "0.55927914", "0.55591536", "0.55484784", "0.55438", "0.55161154", "0.5503551", "0.5472641", "0.5457811", "0.5456469", ...
0.63363904
0
Locks/Unlocks every asset in the specified directory. Useful to lock all files in the project directory
def state_change_all(self, rootdir, state): if state == "unlock": stateChange = False elif state == "lock": stateChange = True else: LOGGER.error(['NET7800'], {'script':inspect.stack()[1], 'parameter':stateChange}) return None for subdir, dirs, files in os.walk(rootdir):...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lock(self):\n logging.debug(\"Locking %s (and subdirectories)\" % self.directory)\n LOCK_ACL.append(target=self.directory)\n for subdirectory in self._subdirectories():\n LOCK_ACL.append(target=subdirectory)", "def LockFiles(self, entries):\n self._model.lock(entries)",...
[ "0.67156315", "0.6367278", "0.59245753", "0.59112793", "0.58467436", "0.5814613", "0.57898957", "0.57445335", "0.57083416", "0.56619686", "0.5612699", "0.5585905", "0.5530833", "0.5501121", "0.5440756", "0.540078", "0.5379993", "0.5373726", "0.5358043", "0.53534496", "0.52948...
0.55754584
12
Initialize the graph model
def _init_graph(self): self.G = nx.Graph() self.G.add_nodes_from([1,2,3,4,5]) self.G.add_edges_from([(1,2),(2,3),(2,4)\ ,(2,5),(3,4),(4,5)])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n self.graph = None", "def _setup_graph(self):\n pass", "def _setup_graph(self):\n pass", "def populate_graph(self):", "def __init__(self):\n self.graph = {}\n self.edges = 0\n self.vertices = 0", "def initialize_model(self):\n pass", ...
[ "0.7955148", "0.79491997", "0.79491997", "0.7608103", "0.75090194", "0.72850966", "0.72598547", "0.7238274", "0.7231413", "0.7163065", "0.7156674", "0.7083523", "0.7077605", "0.7066249", "0.70459795", "0.7044202", "0.7032068", "0.7022893", "0.7022692", "0.7000591", "0.6996009...
0.74924195
5
Override to allow nonlive pages for preview/revisions.
def get_queryset(self): request = self.request # Allow pages to be filtered to a specific type page_type = request.GET.get('type', 'wagtailcore.Page') try: models = page_models_from_string(page_type) except (LookupError, ValueError): raise BadRequestError(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_public_status_page_patch_public_status_page(self):\n pass", "def published(self, for_user=None, include_login_required=False):\n published = super(PageManager, self).published(for_user=for_user)\n unauthenticated = for_user and not is_authenticated(for_user)\n if (\n ...
[ "0.5872605", "0.5646225", "0.5628984", "0.56126446", "0.5596146", "0.5567708", "0.54944396", "0.54927784", "0.5490055", "0.54556245", "0.5455509", "0.54282874", "0.5423416", "0.5352463", "0.53520197", "0.5341767", "0.5334728", "0.53308606", "0.5324184", "0.5298268", "0.529826...
0.0
-1
Override to provide revision rendering.
def detail_view(self, request, pk): instance = self.get_object() if self.revision_wanted is not None: instance = get_object_or_404( instance.revisions, id=self.revision_wanted).as_page_object() elif self.is_preview: instance = instance.get_latest_revision_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def revision():\n pass", "def get_revision(self) -> str:\n raise NotImplementedError", "def show_revision(revision):\n click.echo(format_revision(revision))", "def test_should_render_on_diff_viewer_revision(self) -> None:\n self.assertTrue(self.action.should_render(\n context=s...
[ "0.6833898", "0.64648914", "0.6463111", "0.6385229", "0.62519765", "0.6208156", "0.6205674", "0.6205674", "0.6205674", "0.6205674", "0.6205674", "0.6205674", "0.6162173", "0.61472213", "0.6129462", "0.6119212", "0.60852784", "0.6027086", "0.59811574", "0.5916577", "0.5916577"...
0.5759637
29
Override to provide single instance by url.
def listing_view(self, request): self._object = self.get_page_for_url(request) if self._object is not None: self.kwargs.update({'pk': self._object.pk}) # pylint: disable=attribute-defined-outside-init self.action = 'detail_view' return self.detail_view(req...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_one(self,url):\n pass", "def __get__(self, instance, owner):\n if instance._location is None:\n raise AttributeError('Cannot find URL of %s relative to URL-less %s' % (self.cls.__name__, owner.__name__))\n newurl = join(instance._location, self.api_name)\n obj = se...
[ "0.7477579", "0.63970745", "0.6331655", "0.63120526", "0.6304143", "0.62702614", "0.6185333", "0.61765903", "0.6173375", "0.6173375", "0.6115221", "0.6106244", "0.6092612", "0.60880363", "0.6082785", "0.60695165", "0.60519", "0.5959531", "0.593627", "0.59142184", "0.59068626"...
0.0
-1
Compute minimumnorm binary mask that produce greater or equal score at the target DOA.
def minimum_norm_binary_mask(net, x, l_doa, forward_kargs={}): assert x.dim() == 4 m = torch.ones(x.size(0), 1, x.size(2), x.size(3), device=x.device, requires_grad=True) cont = True while cont: y = ne...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fn(mask, j):\n ans = 0 \n for i in range(m): \n if not mask & (1<<i): \n ans = max(ans, fn(mask^(1<<i), j-1) + score[i][j])\n return ans", "def masked_mae_cal(inputs, target, mask):\n return torch.sum(torch.abs(inputs - target) * mask) / (...
[ "0.6547064", "0.60683686", "0.58953935", "0.5854404", "0.5787471", "0.57840794", "0.5616405", "0.55389327", "0.5538452", "0.5458827", "0.5401254", "0.53918004", "0.5344775", "0.534124", "0.5338037", "0.5333005", "0.53060377", "0.52803165", "0.5278462", "0.52730894", "0.526402...
0.52015364
26
Estimate the softmask that produce minimum loss.
def minimum_loss_mask(net, x, l_doa, loss_func, forward_kargs={}, alpha=0.0): n_samples, n_feat, m1_size, m2_size = x.size() m = torch.ones(n_samples, 1, m1_size, m2_size, device=x.device, requires_grad=True) cont...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def softmax_masked(x, mask=None):\n if mask is None:\n sm = K.softmax(x)\n else:\n casted_mask = K.cast(mask, dtype=x.dtype)\n # subtract min first so that, after masking, the masked elements are the smallest\n z = (x - K.min(x, axis=1, keepdims=True)) * casted_mask\n # Now sub...
[ "0.6844918", "0.6534099", "0.64093167", "0.6378031", "0.6360926", "0.62574977", "0.62190497", "0.6211745", "0.6191691", "0.6191036", "0.6191036", "0.61117625", "0.60833985", "0.6079447", "0.6047586", "0.6046867", "0.59916764", "0.59828776", "0.5969106", "0.59641343", "0.59629...
0.58389044
33
initialize simulation for n receivers.
def init_sim(self,n): self.beacon = beacon(ENABLE_BEACON_DELAY) self.data = data_utils(n) random.seed() if n < 3: print 'Number of receivers %i is less than three.' %n print 'Simulation controller will not run.' print 'Now exiting.' sys.ex...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialise_sim(self):\n pass", "def initialize_simulation(self) -> Simulation:\n pass", "def initialize(self,t0=0.0):\n \n # An connection_distribution_list (store unique connection(defined by weight,syn,prob))\n self.connection_distribution_collection = ConnectionDistrib...
[ "0.69506", "0.64275706", "0.63273084", "0.62234366", "0.6148517", "0.61418355", "0.6120078", "0.61150783", "0.6010363", "0.5956427", "0.5942656", "0.58964765", "0.5848229", "0.5831818", "0.5811069", "0.5795932", "0.5783453", "0.57297236", "0.5719643", "0.5719192", "0.5715589"...
0.7817745
0
receive a single beacon packet. this will then be copied n times. this tries to ensure clock synchronization across receivers.
def rx_beacon_packet(self): self.beacon.make_packet() rx_packet = self.beacon.tx_packet() rx_time = np.float128('%.20f'%(time.time())) if self.DEBUG: print 'rx_time: ', repr(rx_time) self.data.set_timestamp_base(rx_time) self.data.set_beacon_packet(rx...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def receive(self, packet, time):\n raise NotImplementedError", "def receive_packet(self, packet):\n\t\treturn", "def _pop_received_packet(self):\n fragments = self._receive_heap.pop_min_and_all_fragments()\n if fragments is None:\n self._attempt_disabling_looping_receive()\n ...
[ "0.659308", "0.64314634", "0.606834", "0.60046196", "0.5971926", "0.5800873", "0.57699144", "0.57684416", "0.57513785", "0.57189965", "0.57180727", "0.56841934", "0.56787455", "0.5678482", "0.56770194", "0.5673957", "0.5648746", "0.56187123", "0.5616314", "0.5613586", "0.5600...
0.62612706
2
simulate receiver chain for n repeaters
def receiver_chain(self,h): self.host = h n = self.data.get_rx_number() beacon_packet = self.data.get_beacon_packet() time_base = self.data.get_timestamp_base() # lists containing data for all current teams team_id = self.data.get_rx_team_id() location = self.d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sender_iter(self):\n while 1:\n yield self.send_next()", "def twist(r, num_repeats=1):\n for i in range(num_repeats):\n r.go(0, 50)\n time.sleep(.75)\n r.stop()\n time.sleep(.1)\n r.go(0, -50)\n time.sleep(.75)\n r.stop()\n time.sle...
[ "0.6061919", "0.5930912", "0.5800893", "0.57489747", "0.5692484", "0.5670281", "0.56442624", "0.55754143", "0.5571901", "0.5569587", "0.55004776", "0.54889697", "0.5432728", "0.5415508", "0.54130584", "0.5395254", "0.53849345", "0.53539467", "0.5328398", "0.53203446", "0.5312...
0.0
-1
getLeavess tree, returns dictionary mapping paths from root to leafs to value of leafs
def getLeaves(ob, pre=""): return ob._getLeaves(pre)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _find_leaves(self):\n def recursive_find_leaves(node):\n leaf_paths = []\n leaf_vals = []\n for child_key, child_val in listitems(node):\n if isinstance(child_val, collections.Mapping):\n subleaf_paths, subleaf_vals = recursive_find_leav...
[ "0.7439923", "0.6674589", "0.6602256", "0.65051883", "0.6423506", "0.6379858", "0.62725616", "0.6214842", "0.61323255", "0.61126393", "0.61046517", "0.60996276", "0.6080123", "0.60579246", "0.6049959", "0.60245085", "0.60147864", "0.5993699", "0.59607226", "0.59546477", "0.59...
0.6345133
6
Method that allows loading by default one or more of a csv file made up of the respective data of a module each time it is installed, it is also configured so that each time the module is updated, the data is not reloaded, if not only the first time of installation.
def import_csv_data(cr, registry): files = ['data/sc.info.csv'] for file in files: tools.convert_file(cr, 'prospects_app', file, None, mode='init', noupdate=True, kind='init')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_init(cr, registry):\n import_csv_data(cr, registry)", "def dataLoad():\n try:\n try: #Python3\n f = open(__file__ + \".csv\",\"rt\")\n except: #Python2\n f = open(__file__ + \".csv\",\"rb\")\n data = f.read().split(',')\n entryCol.ent...
[ "0.6944496", "0.6613097", "0.6268355", "0.6120693", "0.5976569", "0.59328526", "0.59083223", "0.58878165", "0.58811647", "0.5780418", "0.5769617", "0.5763331", "0.5758913", "0.57168734", "0.57096916", "0.5696545", "0.5685578", "0.56796867", "0.56740993", "0.5669624", "0.56579...
0.6190781
3
This method originates from odoo, and allows us to intercept and perform operations during the installation of a module.
def post_init(cr, registry): import_csv_data(cr, registry)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_install(self, request, trigger_context):\n raise NotImplementedError", "def do_post_install(self, context):\n pass", "def _install(self):\n\n pass", "def pre_installation(self):\n pass", "def post_installation(self, exc_value):\n pass", "def on_install(self, even...
[ "0.73276484", "0.72285664", "0.71663624", "0.6793765", "0.6767852", "0.67301214", "0.6694756", "0.6653628", "0.6501767", "0.6449297", "0.64281327", "0.6426008", "0.6401456", "0.6384393", "0.6347906", "0.6347906", "0.61990964", "0.61691725", "0.61644363", "0.61421716", "0.6140...
0.0
-1
Create a verilator based simulation model for specified unit and load it to Python
def toVerilatorSimModel(unit: Unit, unique_name: str, build_dir: Optional[str], target_platform=DummyPlatform(), do_compile=True): if build_dir is None: build_dir = "tmp/%s" % unique_name # with tempdir(suff...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_simple_creation():\n # Get model file\n create.main(\"mlp\", \"10:12:8\", \"model_test.tar\")", "def cli_simulate(model_file, output_dir, exporter, overwrite, compression,\n confirm, progress: int, progress_tag, output_same,\n simtime_total, simtime_lims, max_sweeps...
[ "0.65765846", "0.65580773", "0.6550769", "0.6546276", "0.6504218", "0.6469117", "0.63433236", "0.627054", "0.62532395", "0.6251698", "0.6249102", "0.6248536", "0.62141037", "0.61618936", "0.6083821", "0.60495144", "0.6038472", "0.60380536", "0.5984989", "0.5971478", "0.596941...
0.6919998
0
Loads the query molecule from SMILES, molblock or InChI.
def load_query(self, query_string: str) -> np.ndarray: rdmol = load_molecule(query_string) fp = build_fp(rdmol, self.fp_type, self.fp_params, 0) return np.array(fp, dtype=np.uint64)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _load_molecule(self):\n self.pymol = pybel.readstring(self.input_format, self.file_dic['input'])", "def _set_molecule_from_smiles(self, mol_smiles):\n try:\n self.mol_graph = Chem.MolFromSmiles(mol_smiles)\n except Exception:\n raise LoadingError(f'{mol_smiles} coul...
[ "0.6670654", "0.6001101", "0.5710529", "0.56766015", "0.56631404", "0.5651736", "0.56413436", "0.5599945", "0.5409557", "0.5342238", "0.5283499", "0.5217227", "0.51927537", "0.5192512", "0.51640475", "0.51393247", "0.5125168", "0.5119117", "0.51116127", "0.5100645", "0.504425...
0.61572385
1
Function for start consume queue
async def run(self): self.connection = await aio_pika.connect(self.mq_connection_str, loop=asyncio.get_event_loop()) self.channel = await self.connection.channel() # connect to exchanger market data # market data send with routing key format: message_type.data_type.exchange.pair[.time_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_queue_declared(frame):\n start_consuming(frame)", "def _begin_consuming(self):\n self._consuming = True\n loop = asyncio.get_event_loop()\n self._message_queue = asyncio.Queue(\n maxsize=self.app.settings['SQS_PREFETCH_LIMIT'],\n loop=loop,\n )\n ...
[ "0.746919", "0.7318628", "0.7253952", "0.720065", "0.70642626", "0.6913265", "0.6835673", "0.6803511", "0.6803057", "0.6796903", "0.67246705", "0.6708709", "0.6708709", "0.6695424", "0.6666162", "0.6664384", "0.6656905", "0.6656905", "0.6656905", "0.6656905", "0.6656905", "...
0.0
-1
Callback for consume market data
def callback_crypto_currency_market_data(message): body = json.loads(message.body.decode('utf-8')) # routing_key have view: message_type.data_type.exchange.pair[.time_frame] # message_type == update | starting, data_type == ticker | candles | depth, # exchang...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def onMarketUpdate(self, data):\n pass", "def reqData(self):\r\n #self.reqGlobalCancel()\r\n #self.add_historical(\"Stock('TSLA', 'SMART', 'USD')\")\r\n #self.add_historical(\"Stock('IBM', 'SMART', 'USD')\")\r\n #self.add_historical(\"Stock('MSFT', 'SMART', 'USD')\")\r\n ...
[ "0.62477213", "0.61514366", "0.6128023", "0.60764545", "0.60088414", "0.5806404", "0.57827836", "0.57634103", "0.56659967", "0.56629735", "0.5657414", "0.5644092", "0.56204426", "0.5616694", "0.5585005", "0.5579463", "0.55152094", "0.55029154", "0.54901165", "0.5487008", "0.5...
0.5871096
5
Callback for consume information about access pairs, exchanges and timeframes
def callback_crypto_currency_listing(message): body = json.loads(message.body.decode('utf-8')) data_id = TYPE_LISTING if not self.waiters_first_msg.get(data_id): return while self.waiters_first_msg[data_id]: observer = self.waiters_first_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_access(access_token='',expire_time=0):\r\n #Get a new access token if it expires or is five minutes away from exp#iration\r\n if (expire_time==0) or (len(access_token)==0) or (time.time()-expire_time>=-300):\r\n\r\n #API needed to authorize account with refresh token\r\n auth_url = 'htt...
[ "0.56401396", "0.518623", "0.51103735", "0.5109212", "0.509419", "0.50253606", "0.49838096", "0.49723276", "0.4957218", "0.49409106", "0.49339992", "0.49231294", "0.49127924", "0.49077892", "0.4878639", "0.48296976", "0.48238656", "0.48189038", "0.48154843", "0.4801777", "0.4...
0.0
-1
Callback for consume error queue
def callback_crypto_currency_error(message): logger.error(message.body.decode('utf-8')) body = json.loads(message.body.decode('utf-8')) # validation error_place = body.get('error_place') message = 'Sorry! Error on server' if not message or not er...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _error(self, failure):\n if self.consumer:\n self.consumer.unregisterProducer()\n self.consumer = None\n\n if not self.deferred.called:\n self.deferred.errback(failure)", "def handle_err(self, err, msg):\n assert \"BAD:\" in msg.value().decode('utf-8'...
[ "0.6839042", "0.6459104", "0.625038", "0.61979455", "0.5988399", "0.5987127", "0.5921204", "0.58454615", "0.5803769", "0.5781101", "0.57774234", "0.5760444", "0.574583", "0.57097596", "0.57090175", "0.5704201", "0.5691423", "0.56824505", "0.56783295", "0.56582546", "0.5649026...
0.5154054
93
Append observer in waiters and send message for get starting data
async def attach(self, observer, data_id): # init table for waiters if need self.waiters_first_msg.setdefault(data_id, []) # if user want get information, that user already wait (in subscribers), send error if observer in self.waiters_first_msg[data_id]: asyncio.get_event_lo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subscribe(observer):", "def subscribe(observer):", "def notifyObservers(self):", "def start(self):\n self.observer.start()", "def notify(self):\n for observer in self.observers:\n observer(self.obj)", "def __init__(self, observer):\r\n self.AllData = []\r\n self...
[ "0.6195174", "0.6195174", "0.6134825", "0.59606004", "0.5884273", "0.5874226", "0.5856661", "0.58515745", "0.5820923", "0.5779754", "0.57091755", "0.57087344", "0.5685442", "0.5676267", "0.5667569", "0.56597275", "0.562525", "0.56158704", "0.5600424", "0.55934954", "0.5593495...
0.6811588
0
Remove observer from specific data thread or from all data thread
async def detach(self, observer, data_id=None): if data_id: if self.subscribers.get(data_id) and observer in self.subscribers[data_id]: self.subscribers[data_id].remove(observer) # If all subscribers unsubscribe, than stop task in microservice if not ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unsubscribe(observer):", "def unsubscribe(observer):", "def cleanup(self):\n self.removeObservers()", "def cleanup(self):\r\n #self.removeObservers()\r\n pass", "def detach(observer):\n Bots._observers.discard(observer)", "def detach(self, observer):\n self._observers.remove(ob...
[ "0.7425274", "0.7425274", "0.6909904", "0.68086785", "0.66946447", "0.6681472", "0.66574574", "0.66435343", "0.6572405", "0.6534271", "0.6534271", "0.6506021", "0.6466749", "0.6429247", "0.64109105", "0.6393422", "0.6300596", "0.625951", "0.6231729", "0.61574364", "0.61232704...
0.7354055
2
Send message to microservice for stop task
async def _send_message_for_unsubscribe(self, data_id): body = json.dumps( dict( action='unsub', data_id=data_id ) ).encode('utf-8') await self._send_message_in_queue(self.queue_crypto_quotes_service, body)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stop(self):\n\n print(\"Status sent: stop\")\n\n offset = self.app_id * 10\n\n status_dict = {}\n # Test run led\n status_dict[offset + self.PIN_LED] = 0\n\n self.post_dict(status_dict)", "def request_stop(self):\n self._messaged.emit((\"stop\",None,0,None))",...
[ "0.7038723", "0.68268883", "0.67853475", "0.67275447", "0.6705208", "0.6662396", "0.6658448", "0.66512424", "0.6558279", "0.6554395", "0.6550023", "0.65290016", "0.650736", "0.65059763", "0.65056133", "0.6490163", "0.6465663", "0.64636797", "0.646028", "0.64439756", "0.644062...
0.0
-1
Send message to microservice for start task
async def _send_message_for_subscribe(self, data_id): body = json.dumps( dict( action='sub', data_id=data_id ) ).encode('utf-8') await self._send_message_in_queue(self.queue_crypto_quotes_service, body)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_task():\n get_results_from_message_queue()\n test_all_servers_connection()", "def start(self, sessionId, task, contact):\n pass", "def start(self):\n\n self._task.start()", "def start(self):\n self._task.start()", "def start(self):\n self._task.start()", "def s...
[ "0.68237936", "0.64673775", "0.64239603", "0.6423366", "0.6423366", "0.6416074", "0.6412341", "0.6349693", "0.63340735", "0.6286867", "0.6227775", "0.62181467", "0.6197044", "0.61880827", "0.6181497", "0.6180048", "0.61479753", "0.61479753", "0.61381507", "0.6136974", "0.6135...
0.0
-1
Send message to microservice for get starting data
async def _send_message_for_get_starting_data(self, data_id): body = json.dumps( dict( action='get_starting', data_id=data_id ) ).encode('utf-8') await self._send_message_in_queue(self.queue_crypto_quotes_service, body)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start(self):\n return self.params.send_params()", "def start( self ):\n\n self.service()", "def onstart(self, sender, **kwargs):\n #Example publish to pubsub\n #self.vip.pubsub.publish('pubsub', \"some/random/topic\", message=\"HI!\")\n\n #Exmaple RPC call\n #self....
[ "0.6436687", "0.6173941", "0.5911074", "0.5895981", "0.5873411", "0.5822935", "0.5810223", "0.5786783", "0.5746238", "0.57382137", "0.5737131", "0.5708002", "0.5708002", "0.5697802", "0.56788045", "0.56786233", "0.56777674", "0.56777674", "0.56653273", "0.5652313", "0.5651069...
0.65215296
0
Method for send some message to microservice queue
async def _send_message_in_queue(self, queue_name, body, reply_to=None): message = aio_pika.Message(body=body, reply_to=reply_to) await self.channel.default_exchange.publish(message, routing_key=queue_name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_msg(self, my_queue, my_msg):", "def send_message(self, message):\n self.client.queue.put(message)", "def send_msg(self, msg):\n self.msg_queue.put(dict(to=settings.IOTTLY_XMPP_SERVER_USER,msg='/json ' + json.dumps(msg)))", "def send_message(self, message):\n self.send_message_qu...
[ "0.80504113", "0.7602186", "0.697076", "0.69060606", "0.6894798", "0.6890281", "0.6855451", "0.6780414", "0.6778336", "0.66990376", "0.6685773", "0.666059", "0.66551816", "0.6645941", "0.66451305", "0.6633204", "0.65861213", "0.6567353", "0.65366375", "0.64876604", "0.6446524...
0.7033083
2
Method to send an http post request to google analytics with the specified events.
def send(self, events, validation_hit=False, postpone=False, date=None): # check for any missing or invalid parameters among automatically collected and recommended event types self._check_params(events) self._check_date_not_in_future(date) if postpone is True: # build even...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upload(self, events):\n if len(events) == 0:\n return\n\n headers = {'Content-Type': 'application/json'}\n if self.config.access_key is not None:\n headers['x-analytics-key'] = self.config.access_key\n\n return requests.post(\n self.config.ingest_url...
[ "0.6711665", "0.62720424", "0.62670887", "0.61956185", "0.6026201", "0.5925697", "0.58145595", "0.57575643", "0.57574177", "0.5739429", "0.5726341", "0.56397337", "0.5555134", "0.5510911", "0.5506685", "0.5491807", "0.5491508", "0.5475669", "0.5462015", "0.5427705", "0.537889...
0.6399683
1
Method to send the events provided to Ga4mp.send(events,postpone=True)
def postponed_send(self): for event in self._event_list: self._http_post([event], postpone=True) # clear event_list for future use self._event_list = []
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send(self, events):\n if not self._last_connection and self.max_connect_time:\n self._last_connection = time.time()\n log.debug(\"Sending %i messages\", len(events))\n start = time.time()\n skipped = 0\n sent = 0\n for e in events:\n routing_key ...
[ "0.66752946", "0.6622529", "0.6494706", "0.6443658", "0.6292387", "0.625667", "0.621399", "0.6105599", "0.60990536", "0.6045782", "0.5952999", "0.5915013", "0.58958846", "0.5810091", "0.5784288", "0.57736", "0.5758093", "0.57533085", "0.57154965", "0.57087296", "0.5696536", ...
0.6935207
0
Method to append event name and parameters keyvalue pair to parameters dictionary.
def append_event_to_params_dict(self, new_name_and_parameters): params_dict.update(new_name_and_parameters)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_parameter():\n parameter_info = {}\n argget = utils.create_common_parameter_list(example_string='''\nExample:\n \"python add_event_subscriptions.py -i 10.10.10.10 -u USERID -p PASSW0RD --destination https://10.10.10.11 --eventtypes Alert --context test\"\n''')\n add_helpmessage(argget)\n args ...
[ "0.68617225", "0.62716216", "0.6232052", "0.6038", "0.60304385", "0.5938188", "0.59378177", "0.5865848", "0.5854884", "0.58266795", "0.5789419", "0.5729528", "0.5708161", "0.5707308", "0.56872445", "0.56527895", "0.562703", "0.56114787", "0.558981", "0.5583605", "0.5574064", ...
0.86380863
0
Method to send http POST request to googleanalytics.
def _http_post( self, batched_event_list, validation_hit=False, postpone=False, date=None ): self._check_date_not_in_future(date) status_code = None # Default set to know if batch loop does not work and to bound status_code # set domain domain = self._base_domain if...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_post(url):\n HEADERS['accept'] = 'application/vnd.yang.data+json'\n if not url.startswith('/'):\n url = \"/{}\".format(url)\n url = BASE_URL + url\n resp = requests.post(url, headers=HEADERS)\n return resp", "def make_post_request(self, url, data):\n auth = (self.AUTH_ID, se...
[ "0.6720064", "0.65196544", "0.6432846", "0.63779813", "0.6342663", "0.6266589", "0.6203186", "0.61331373", "0.608125", "0.6074327", "0.6064117", "0.60617054", "0.604678", "0.60177386", "0.59844047", "0.59335184", "0.5928332", "0.58617276", "0.5861302", "0.585581", "0.582514",...
0.0
-1
Method to check whether the event payload parameters provided meets supported parameters.
def _check_params(self, events): # check to make sure it's a list of dictionaries with the right keys assert type(events) == list, "events should be a list" for event in events: assert type(event) == dict, "each event should be a dictionary" assert "name" in event, '...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _CheckUnknownParameters(event_type, known_params, given_params):\n unknown_parameters = (\n set(given_params) -\n set(known_params))\n if unknown_parameters:\n raise exceptions.UnknownEventTypeParameters(\n unknown_parameters, event_type)", "def _check_parameters_support(self, parameter...
[ "0.67511195", "0.66740525", "0.6658935", "0.66236603", "0.6601524", "0.6599001", "0.65948415", "0.654032", "0.64032465", "0.6403099", "0.63868374", "0.6351361", "0.6346865", "0.6340865", "0.6333561", "0.63206863", "0.62974364", "0.62974364", "0.6297307", "0.624125", "0.623159...
0.70182455
0
Method to set user_id, user_properties, non_personalized_ads
def set_user_property(self, property, value): self._user_properties.update({property: value})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set(self, **kwargs: Any) -> None: # nosec\n attributes = {}\n user_id: int = int(kwargs[\"user_id\"])\n user = self.first(id_int=user_id)\n\n for k, v in kwargs.items():\n if k in user.__attr_searchable__:\n attributes[k] = v\n\n if kwargs.get(\"ema...
[ "0.6564755", "0.634265", "0.62848526", "0.61611325", "0.60830605", "0.604645", "0.6024073", "0.60226315", "0.60106003", "0.6009926", "0.6004591", "0.6002404", "0.5993274", "0.5980254", "0.5966345", "0.59272254", "0.5908844", "0.589789", "0.58937514", "0.588092", "0.58706254",...
0.56334096
57
Method to remove user_id, user_properties, non_personalized_ads
def delete_user_property(self, property): try: if property in self._user_properties.keys(): self._user_properties.pop(property) except: logger.info(f"Failed to delete user property: {property}")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove(self, user_id):\n pass", "def delete_user():", "def remove_user_from_govern(self, request, pk=None, user_id=None):\n try:\n user = UserProfile.objects.get(id=user_id, organization__id=pk)\n except ObjectDoesNotExist:\n raise ResourceNotFound\n else:\...
[ "0.7690527", "0.68628436", "0.6809862", "0.6763096", "0.67459846", "0.672382", "0.66511494", "0.66391873", "0.65763855", "0.65636003", "0.6503157", "0.6503157", "0.6503157", "0.6462171", "0.64142317", "0.64020616", "0.6388449", "0.6368618", "0.6367317", "0.63463014", "0.63433...
0.6259957
29
Method is a helper function to add user properties to outgoing hits.
def _add_user_props_to_hit(self, hit): for key in self._user_properties: try: if key in ["user_id", "non_personalized_ads"]: hit.update({key: self._user_properties[key]}) else: if "user_properties" not in hit.keys(): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_user_property(self, property, value):\n self._user_properties.update({property: value})", "def _collect_properties(self):\n properties = {\n 'userid': self.user_id,\n 'title': self.get_fullname()\n }\n if not self.ogds_user:\n return properties...
[ "0.54060847", "0.53914547", "0.5311348", "0.5277481", "0.52685785", "0.51766896", "0.51704776", "0.51350677", "0.51231086", "0.5059008", "0.50121903", "0.49840477", "0.49707344", "0.48758975", "0.48634145", "0.47971946", "0.47815537", "0.47756538", "0.47756028", "0.47628966", ...
0.8418524
0
Method returns UNIX timestamp in microseconds for postponed hits.
def _get_timestamp(self, timestamp): return int(timestamp * 1e6)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def timestamp(self):\n # this only returns second precision, which is why we don't use it\n #now = calendar.timegm(datetime.datetime.utcnow().utctimetuple())\n\n # this returns microsecond precision\n # http://bugs.python.org/msg180110\n epoch = datetime.datetime(1970, 1, 1)\n ...
[ "0.6687162", "0.65268767", "0.64837664", "0.62574315", "0.6251524", "0.62419933", "0.6156922", "0.6118674", "0.6096377", "0.6090016", "0.6081391", "0.6076217", "0.606859", "0.60536283", "0.6051933", "0.60178834", "0.6004308", "0.5993894", "0.59835035", "0.59697664", "0.596976...
0.6128073
7
Private method to convert a datetime object into a timestamp
def _datetime_to_timestamp(self, dt): return time.mktime(dt.timetuple())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def datetime_to_timestamp(obj: \"datetime\") -> \"Timestamp\":\n td = datetime_to_epoch_timedelta(obj)\n ts = Timestamp()\n ts.seconds = td.seconds + td.days * _SECONDS_PER_DAY\n ts.nanos = td.microseconds * _NANOS_PER_MICROSECOND\n return ts", "def to_stamp(datetime_):\r\n try:\r\n retu...
[ "0.72915614", "0.7261263", "0.7230859", "0.72280365", "0.72121686", "0.7209182", "0.7165147", "0.7133808", "0.7081074", "0.70417845", "0.70254016", "0.701384", "0.6949144", "0.69176286", "0.68709433", "0.6847967", "0.6819334", "0.680639", "0.68053293", "0.67908376", "0.672243...
0.7956671
0
Method to check that provided date is not in the future.
def _check_date_not_in_future(self, date): if date is None: pass else: assert ( date <= datetime.datetime.now() ), "Provided date cannot be in the future"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def date_in_past(date: dt.datetime) -> bool:\n return date < dt.datetime.now()", "def date_in_future(date) -> bool:\n is_in_the_future = time_after(date)\n return is_in_the_future", "def check_past_date(self, date: datetime) -> bool:\n try:\n date += timedelta(minutes=10)\n ...
[ "0.7830144", "0.78268987", "0.7666937", "0.7171819", "0.7074505", "0.70292217", "0.6953728", "0.6893718", "0.6834612", "0.68208104", "0.6793942", "0.67898786", "0.675023", "0.668981", "0.6677652", "0.6641531", "0.66341525", "0.66302", "0.6622533", "0.66169786", "0.65040976", ...
0.8926335
0
Tests whether ``put_afk_timeout_into`` is working as intended.
def test__put_afk_timeout_into(): for input_value, defaults, expected_output in ( (AFK_TIMEOUT_DEFAULT, False, {'afk_timeout': AFK_TIMEOUT_DEFAULT}), (60, False, {'afk_timeout': 60}), ): data = put_afk_timeout_into(input_value, {}, defaults) vampytest.assert_eq(data, expected_out...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assert_timeout(self) -> None:", "def has_set_timeout(self) -> bool:\n return False", "def is_timeout(self) -> bool:\n return self.runtime.timeout <= 0.0", "def test_timeout_processing(self):\n # setup\n self.transaction_behaviour.processing_time = None\n\n # operation\n...
[ "0.68487453", "0.6385761", "0.61897486", "0.6164593", "0.61386365", "0.61113673", "0.6101769", "0.6094305", "0.60300237", "0.60300094", "0.5981271", "0.5962097", "0.5956315", "0.59308213", "0.59132403", "0.58779216", "0.5873864", "0.583141", "0.582798", "0.58113694", "0.57715...
0.8338849
0
Add user and profile to context.
def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) context['user'] = self.request.user context['profile'] = self.request.user.profile return context
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def profile(request):\n auth, created = AuthProfile.objects.get_or_create(user=request.user)\n if not request.user.is_authenticated():\n raise Exception(\"Not Logged in\")\n\n token, created = Token.objects.get_or_create(user=request.user)\n context = {}\n context['TOKEN'] = token.key\n\n ...
[ "0.6517379", "0.6254326", "0.6094922", "0.60652465", "0.6037776", "0.6030282", "0.59925145", "0.59905326", "0.5950769", "0.5945794", "0.5915224", "0.5913894", "0.58779365", "0.58496886", "0.58473426", "0.58443123", "0.57948256", "0.5792512", "0.5786131", "0.57842964", "0.5783...
0.74891156
0
Class repr dunar function.
def __repr__(self): txt = super(GrfNodeCore, self).__repr__() txt += '; size = {0}'.format(self.__size) # generate formatted text return txt
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __repr__(self):\n cls = self.__class__.__name__\n return '%s(%s)' % (cls, repr(self.d))", "def __repr__(self):", "def __repr__(self):", "def __repr__(self):", "def __repr__(self) -> str:\n ...", "def __repr__(self) -> str:\n ...", "def __repr__(self) -> str:\n ......
[ "0.7661119", "0.7524849", "0.7524849", "0.7524849", "0.74996495", "0.74996495", "0.74996495", "0.74996495", "0.74996495", "0.7245245", "0.7229086", "0.719027", "0.7186712", "0.7139939", "0.70917195", "0.7087323", "0.70799", "0.7039764", "0.70323795", "0.7022793", "0.70188785"...
0.0
-1
Class str dunar function.
def __str__(self): txt = super(GrfNodeCore, self).__str__() inID = self.inPort[0] outID = [P[0] for P in self.outPort] txt += '; input ID = {0}; output ID = {1}'.format(inID, outID) # generate formatted text return txt
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def d(self):\n pass", "def d(self):\n pass", "def __init__(self,diam_in,diam_out):\n self.diam_in = diam_in\n\tself.diam_out = diam_out", "def __init__(self,diam_in,diam_out):\n self.diam_in = diam_in\n\tself.diam_out = diam_out", "def __init__(self,diam_in,diam_out):\n s...
[ "0.61627364", "0.61627364", "0.5772706", "0.5772706", "0.5772706", "0.56676114", "0.56526196", "0.5613712", "0.5512681", "0.5497858", "0.5338831", "0.5276834", "0.5224214", "0.52163273", "0.5198226", "0.5195729", "0.5184555", "0.518183", "0.5173272", "0.51435447", "0.5113224"...
0.0
-1