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
Produces permutations with nonadjacent chars swapped (up to 4 chars distance)
def longswapchar(word: str) -> Iterator[str]: for first in range(0, len(word) - 2): for second in range(first + 2, min(first + MAX_CHAR_DISTANCE, len(word))): yield word[:first] + word[second] + word[first+1:second] + word[first] + word[second+1:]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def permute(s):\n output = []\n if len(s) <= 1:\n return s\n\n for i, letter in enumerate(s):\n # strip current letter from s and find perms on new string\n\n new_s = s[:i] + s[i + 1:]\n\n permutes = permute(new_s)\n\n for perm in permutes:\n output.append(let...
[ "0.6736689", "0.65894395", "0.6449836", "0.6353029", "0.6336718", "0.63142693", "0.62049276", "0.6189887", "0.61519015", "0.6071711", "0.60714144", "0.5976132", "0.5960588", "0.5945252", "0.5918505", "0.5895274", "0.5881311", "0.58511114", "0.58357", "0.58307004", "0.582559",...
0.5421294
76
Produces permutations with chars replaced by adjacent chars on keyboard layout ("vat > cat") or downcased (if it was accidental uppercase).
def badcharkey(word: str, layout: str) -> Iterator[str]: for i, c in enumerate(word): before = word[:i] after = word[i+1:] if c != c.upper(): yield before + c.upper() + after if not layout: continue pos = layout.find(c) while pos != -1: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def permutor(text, permutation):\n scrambled = \"\"\n for x in permutation:\n scrambled = scrambled + text[x]\n return scrambled", "def permute(s):\n output = []\n if len(s) <= 1:\n return s\n\n for i, letter in enumerate(s):\n # strip current letter from s and find perms o...
[ "0.6372465", "0.63254774", "0.6264477", "0.6245013", "0.604972", "0.59293675", "0.58192295", "0.5791638", "0.5778724", "0.5763599", "0.57522595", "0.5729332", "0.57102674", "0.5680283", "0.56723374", "0.5573873", "0.55528605", "0.55336505", "0.5531236", "0.5504609", "0.550429...
0.54962444
22
Produces permutations with one char removed in all possible positions
def extrachar(word: str) -> Iterator[str]: if len(word) < 2: return for i in range(0, len(word)): yield word[:i] + word[i+1:]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def permute(s):\n output = []\n if len(s) <= 1:\n return s\n\n for i, letter in enumerate(s):\n # strip current letter from s and find perms on new string\n\n new_s = s[:i] + s[i + 1:]\n\n permutes = permute(new_s)\n\n for perm in permutes:\n output.append(let...
[ "0.71060157", "0.6775533", "0.650322", "0.64496285", "0.6383745", "0.6379555", "0.6363275", "0.62668854", "0.6234628", "0.6207375", "0.6204744", "0.61904925", "0.6178601", "0.6170437", "0.6127599", "0.6112459", "0.6085988", "0.6070011", "0.6062588", "0.6038429", "0.600483", ...
0.0
-1
Produces permutations with one char inserted in all possible possitions.
def forgotchar(word: str, trystring: str) -> Iterator[str]: if not trystring: return for c in trystring: for i in range(0, len(word)): yield word[:i] + c + word[i:]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def permutations(iterable):\n pass", "def permute(s):\n output = []\n if len(s) <= 1:\n return s\n\n for i, letter in enumerate(s):\n # strip current letter from s and find perms on new string\n\n new_s = s[:i] + s[i + 1:]\n\n permutes = permute(new_s)\n\n for perm ...
[ "0.68747985", "0.68487537", "0.675091", "0.6745953", "0.6665328", "0.6615404", "0.6543778", "0.6540176", "0.6488002", "0.6486939", "0.64503247", "0.64461046", "0.64378107", "0.64356333", "0.6427934", "0.638743", "0.6379941", "0.6378034", "0.6345018", "0.6322257", "0.6304166",...
0.0
-1
Produces permutations with one character moved by 2, 3 or 4 places forward or backward (not 1,
def movechar(word: str) -> Iterator[str]: if len(word) < 2: return for frompos, char in enumerate(word): for topos in range(frompos + 3, min(len(word), frompos + MAX_CHAR_DISTANCE + 1)): yield word[:frompos] + word[frompos+1:topos] + char + word[topos:] for frompos in reversed...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def permute(s):\n output = []\n if len(s) <= 1:\n return s\n\n for i, letter in enumerate(s):\n # strip current letter from s and find perms on new string\n\n new_s = s[:i] + s[i + 1:]\n\n permutes = permute(new_s)\n\n for perm in permutes:\n output.append(let...
[ "0.6871835", "0.67360544", "0.66985404", "0.6541775", "0.65291804", "0.6452237", "0.6439172", "0.63887715", "0.63329065", "0.62688124", "0.6244564", "0.6234082", "0.6229988", "0.6199025", "0.61834604", "0.6168268", "0.6122072", "0.61141455", "0.61071986", "0.60252476", "0.598...
0.0
-1
Produces permutations with accidental twoletterdoubling fixed (vacation > vacacation)
def doubletwochars(word: str) -> Iterator[str]: if len(word) < 5: return # TODO: 1) for vacacation yields "vacation" twice, hunspell's algo kinda wiser # 2) maybe just use regexp?.. for i in range(2, len(word)): if word[i-2] == word[i] and word[i-3] == word[i-1]: yield word...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def perm_2_let():\r\n return {''.join(i) for i in permutations('abcdefghijklmnopqrstuvwxyz', 2)}\r\n # print(comb_2_let, sep='')\r", "def exercise_b2_2():\r\n letters = ['a', 'e', 'i', 'o', 'u', 'u']\r\n combinations = list(permutations(letters))\r\n uniq_combinations = set(combinations)\r\n to...
[ "0.6638055", "0.6480466", "0.634991", "0.63021815", "0.6247458", "0.6168677", "0.61462843", "0.6046891", "0.5984386", "0.59619355", "0.58376366", "0.5808831", "0.58081603", "0.5806433", "0.57955134", "0.5788775", "0.5746197", "0.574384", "0.57248336", "0.5721883", "0.5707456"...
0.54011095
58
Produces permutation of splitting in two words in all possible positions.
def twowords(word: str) -> Iterator[List[str]]: for i in range(1, len(word)): yield [word[:i], word[i:]]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def word_perms(word):\n\t# Question 4a: Generates all strings that are permutations of the letters in word\n\treturn {''.join(w) for w in permutations(word)}", "def perm_2_let():\r\n return {''.join(i) for i in permutations('abcdefghijklmnopqrstuvwxyz', 2)}\r\n # print(comb_2_let, sep='')\r", "def genera...
[ "0.6488516", "0.6271073", "0.62227064", "0.61066955", "0.60962975", "0.60536313", "0.59959745", "0.5934376", "0.5868344", "0.5823151", "0.5795944", "0.5765678", "0.57420015", "0.5711072", "0.5696769", "0.5692085", "0.5676564", "0.5672385", "0.5649941", "0.5633519", "0.5633268...
0.5415966
39
Initialize MeSH search tool
def __init__(self, outprefix: str): paths = PhenoXPaths(outprefix) mesh_json_path = os.path.join(paths.data_dir, 'mesh.json') self.mesh = dict() if not os.path.exists(mesh_json_path): mesh_bin_file = glob.glob(os.path.join(paths.data_dir, '*.bin')) if mesh_bin_fi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, args, parsers):\n self.parsers = parsers\n self.search_fields = args.search_field if args.search_field else []", "def __init__(self, command_name, search_term):\n\n BotCommand.__init__(self, command_name, 'all')\n self.search_term = search_term\n self.api_cli...
[ "0.6176019", "0.6114654", "0.6089348", "0.6023115", "0.60166216", "0.5964663", "0.5958271", "0.58684164", "0.5789062", "0.5752446", "0.57192004", "0.56736904", "0.56730086", "0.56630135", "0.56393933", "0.56281126", "0.562146", "0.5617541", "0.56095546", "0.56027716", "0.5574...
0.0
-1
Parse MeSH tree from bin file
def _parse_mesh_bin(self, bin_file, json_file): def _chunks(filename, start): """ Split file into chunks :param filename: :param start: :return: """ with open(filename, 'r') as f: buffer = [] for...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __parse(self):\n # raw/objects: detect name, type, use major tag for type as parent node\n # raw/graphics: as object raw, but add TILE_PAGE\n # init: usually flat file, except\n # embark_profiles.txt: [PROFILE] is parent\n # interface.txt: [BIND] is parent (legacy will be...
[ "0.59550416", "0.578597", "0.5505974", "0.544396", "0.5331556", "0.5322069", "0.5312597", "0.52813524", "0.5267293", "0.5237262", "0.5228618", "0.5199379", "0.518287", "0.5182435", "0.5178287", "0.5173431", "0.5137329", "0.51313764", "0.5130195", "0.5124704", "0.5118085", "...
0.6865124
0
Split file into chunks
def _chunks(filename, start): with open(filename, 'r') as f: buffer = [] for line in f: if line.startswith(start): if buffer: yield buffer buffer = [] else:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_file(self, input_file):\r\n file_list = [] \r\n with open(input_file, 'r', encoding='GB18030', errors='ignore') as f_in:\r\n data = f_in.readlines()\r\n lines_num = len(data)\r\n size = lines_num // self.num_workers # lines splitted in a chunk\r\n ...
[ "0.804088", "0.7830803", "0.75680953", "0.74309623", "0.74250346", "0.7374043", "0.7371516", "0.7276274", "0.7133963", "0.7073844", "0.70632815", "0.70365644", "0.7006685", "0.69359064", "0.6887627", "0.68578815", "0.6841715", "0.6821044", "0.68040067", "0.68006545", "0.67727...
0.71220946
9
Find closest MeSH term
def lookup(self, query_text): query = query_text.lower() if query in self.mesh.keys(): return self.mesh[query] else: closest = difflib.get_close_matches(query, self.mesh.keys()) print('Did you mean?') for ind, match in enumerate(closest): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_closest(self):\n m = mats.Materials(\"mats_test.json\", NoneVisited())\n self.assertEqual( '164 G. Canis Majoris', m.closest([0, 0, 0], ['Tungsten'])[1]['system'])\n self.assertEqual( '2MASS J10433563-5945136', m.closest([0, 0, 0], ['Germanium'])[1]['system'])", "def closest_phrase(...
[ "0.6311742", "0.60357434", "0.6002968", "0.5989886", "0.59766924", "0.59562415", "0.58662575", "0.5721969", "0.5704622", "0.5643911", "0.5631589", "0.56212884", "0.5604074", "0.55850166", "0.5584442", "0.5579262", "0.5561027", "0.55594707", "0.5556232", "0.5536082", "0.552261...
0.0
-1
Takes in an infix expression, evaluates it, and returns the result
def calculator(infix_expr): # Assign precedence values to operators prec = {} prec['^'] = 4 prec['*'] = 3 prec['/'] = 3 prec['+'] = 2 prec['-'] = 2 prec['('] = 1 # Instantiate stacks operand_stack = Stack() operator_stack = Stack() try: token_list = infix_expr....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluate_infix(string):\n return postfix(infix_to_postfix(string))", "def calculate_infix_expression(cls, expression):\n\t\tlogger.info(f\"in the calculate infix expression {expression}\")\n\t\telements = expression.split()\n\t\tstack = []\n\t\ttry:\n\t\t\tfor e in elements:\n\t\t\t\tif not e.isdigit() an...
[ "0.81387174", "0.79848576", "0.7524545", "0.73664916", "0.7191866", "0.7085205", "0.7037346", "0.6990421", "0.6908584", "0.69054866", "0.6903593", "0.6898661", "0.68923616", "0.68888754", "0.6804834", "0.67953634", "0.67565376", "0.6755559", "0.6743953", "0.6695394", "0.66859...
0.721813
4
Helper function to do mathematical operations /+
def do_math(operator, op1, op2): if operator == "*": return op1 * op2 if operator == "/": return op1 / op2 if operator == "+": return op1 + op2 if operator == "-": return op1 - op2 if operator == "^": return op1**(op2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def perform_operation(operator, num_1, num_2):\n\n if operator == \"*\":\n return num_1 * num_2\n if operator == \"+\":\n return num_1 + num_2\n if operator == \"-\":\n return num_1 - num_2\n if operator == \"/\":\n return num_1 / num_2", "def calculate_expression(number1,...
[ "0.7359163", "0.7181013", "0.7104238", "0.6985625", "0.697319", "0.697319", "0.6970828", "0.6933551", "0.69055194", "0.6828667", "0.67890763", "0.6654178", "0.6600834", "0.657938", "0.6561923", "0.65443194", "0.6537193", "0.6487585", "0.6484884", "0.6473484", "0.6470769", "...
0.7230534
1
Adds gates to the input circuit to perform a thresholding operation, which discards singular values below some threshold, or minimum value.
def _threshold(self, circuit, register, ctrl_string, measure_flag_qubit=True): # Determine the number of controls ncontrols = (ctrl_string + "1").index("1") # Edge case in which no operations are added if ncontrols == 0: return # Make sure there is at least one cont...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def threshold(self,thresholdValue):\n # TO DO\n pass", "def global_threshold(img, threshold_method):\n pass", "def overlay_thresholding_function(threshold, positive=True):\n # from the interface class definition above, there will be 3 values\n # for the thresh type: inactive, less than, ...
[ "0.6542963", "0.6380482", "0.63642716", "0.6296534", "0.6028167", "0.59781814", "0.59754616", "0.5960532", "0.5943381", "0.59409696", "0.592669", "0.59017485", "0.585506", "0.58209485", "0.58209485", "0.58209485", "0.57742774", "0.575426", "0.57475746", "0.57433945", "0.57346...
0.58375096
13
Returns the quantum circuit to recommend product(s) to a user.
def create_circuit(self, user, threshold, measurements=True, return_registers=False, logical_barriers=False, swaps=True): # Make sure the user is valid self._validate...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_recommend(self, user):\n return self.user_cf.calculate(target_user_id=user, user_n=self.user_n,\n item_n=self.item_n, type=2)", "def classical_recommendation(self, user, rank, quantum_format=True):\n # Make sure the user and rank are ok\n self._v...
[ "0.6139024", "0.5891252", "0.574195", "0.5702561", "0.5693326", "0.5630196", "0.5525133", "0.55186236", "0.5515071", "0.54674363", "0.54653776", "0.54438645", "0.54074544", "0.53887576", "0.5363334", "0.53183645", "0.52956206", "0.52643067", "0.52258486", "0.517817", "0.51552...
0.49878383
29
Runs the quantum circuit recommending products for the given user and returns the raw counts.
def run_and_return_counts(self, user, threshold, shots=10000): circuit = self.create_circuit(user, threshold, measurements=True, logical_barriers=False) job = execute(circuit, BasicAer.get_backend("qasm_simulator"), shots=shots) results = job.result() return results.get_counts()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_recommend(self, user):\n return self.user_cf.calculate(target_user_id=user, user_n=self.user_n,\n item_n=self.item_n, type=2)", "def recommend(self, user, threshold, shots=10000, with_probabilities=True, products_as_ints=True):\n # Run the quantum recom...
[ "0.664292", "0.6593653", "0.60152787", "0.5872946", "0.5831164", "0.5804622", "0.57920045", "0.56995636", "0.5659857", "0.5658142", "0.5658142", "0.5597596", "0.5582271", "0.55194044", "0.55072933", "0.54899436", "0.5483319", "0.54552543", "0.53995514", "0.53746325", "0.53264...
0.62393165
2
Returns a recommendation for a specified user.
def recommend(self, user, threshold, shots=10000, with_probabilities=True, products_as_ints=True): # Run the quantum recommendation and get the counts counts = self.run_and_return_counts(user, threshold, shots) # Remove all outcomes with flag qubit measured as zero (assuming the flag qubit is m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_recommend(self, user):\n return self.user_cf.calculate(target_user_id=user, user_n=self.user_n,\n item_n=self.item_n, type=2)", "def get_recommendations_for_user(self, user_id):\r\n\r\n sql_command = \"\"\"\r\n SELECT event_id, sc...
[ "0.82474965", "0.752934", "0.7385011", "0.732243", "0.72096705", "0.70603764", "0.70367336", "0.6976795", "0.6925429", "0.67433727", "0.672272", "0.66872346", "0.6640382", "0.66097564", "0.65273446", "0.6522883", "0.6514766", "0.64301234", "0.6375047", "0.6346488", "0.6334251...
0.0
-1
Returns a recommendation for a specified user via classical singular value decomposition.
def classical_recommendation(self, user, rank, quantum_format=True): # Make sure the user and rank are ok self._validate_user(user) self._validate_rank(rank) # Do the classical SVD _, _, vmat = np.linalg.svd(self.matrix, full_matrices=True) # Do the projection r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recommend(self, user):\n K = self.n_sim_user\n N = self.n_rec_movie\n rank = dict()\n watched_movies = self.trainset[user]\n\n # v=similar user, wuv=similarity factor\n for v, wuv in sorted(self.user_sim_mat[user].items(),\n key=itemgetter(1...
[ "0.62279725", "0.6218502", "0.593269", "0.58930665", "0.570855", "0.56177104", "0.5597132", "0.5564896", "0.55526376", "0.5535168", "0.5519044", "0.5508257", "0.54996467", "0.5496056", "0.54412323", "0.54394263", "0.5439314", "0.5430811", "0.5413947", "0.5373785", "0.53643227...
0.6778557
0
Validates a user (vector). If an invalid user for the recommendation system is given, a UserError is thrown. Else, nothing happens.
def _validate_user(self, user): # Make sure the user is of the correct type if not isinstance(user, (list, tuple, np.ndarray)): raise UserVectorError("Invalid type for user. Accepted types are list, tuple, and numpy.ndarray.") # Make sure the user vector has the correct length ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _validate_user(_):\n pass", "def validate_by_user(self, user, value):\n if not self.validated and not self.destroyed:\n self.parent.logger.write(\"vote\", user, [value, self.createur.identifier])\n if value == 0:\n if self.validator.count(user) > 0:\n ...
[ "0.6562727", "0.605157", "0.5901822", "0.5775897", "0.57269454", "0.56912977", "0.56912977", "0.5518426", "0.5507653", "0.5503397", "0.55014575", "0.54806924", "0.5464648", "0.5460626", "0.54598135", "0.53860456", "0.5361218", "0.53423893", "0.53335655", "0.53295267", "0.5252...
0.8340915
0
Throws a RankError if the rank is not valid, else nothing happens.
def _validate_rank(self, rank): if rank <= 0 or rank > self.num_users: raise RankError("Rank must be in the range 0 < rank <= number of users.")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _validate_rank(self, rank: int) -> None:\n if not isinstance(rank, int):\n raise TypeError(\"rank should be an integer\")\n if rank < 0:\n raise ValueError(\"rank cannot be negative\")\n if rank >= self.L**2:\n raise ValueError(f\"rank should be less than {...
[ "0.8221189", "0.6799999", "0.6629772", "0.64921623", "0.6485812", "0.6354266", "0.6354266", "0.6263529", "0.60272527", "0.5991913", "0.59675074", "0.58497083", "0.5840833", "0.58285457", "0.5822559", "0.57317233", "0.56980824", "0.56085336", "0.55671346", "0.5528553", "0.5522...
0.86043864
0
Converts a decimal in base ten to a binary decimal string.
def _to_binary_decimal(decimal, nbits=5): if 1 <= decimal < 0: raise ValueError("Argument decimal should satisfy 0 <= decimal < 1.") binary = "" for ii in range(1, nbits + 1): if decimal * 2 ** ii >= 1: binary += "1" decimal = (decimal * 1...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decimal_to_binary(num):\n binary_res = \"\"\n while num >= 1:\n binary_char = num % BINARY_BASE\n num = math.floor(num / BINARY_BASE)\n binary_res += str(binary_char)\n if len(binary_res) < REGISTER_SIZE:\n binary_res += \"0\" * (REGISTER_SIZE - len(binary_res))\n return...
[ "0.7807933", "0.7628011", "0.7184916", "0.71676975", "0.7100728", "0.70524585", "0.7034531", "0.70182544", "0.70076656", "0.6989513", "0.6979323", "0.69152266", "0.68483025", "0.68307817", "0.6806326", "0.67578655", "0.6750961", "0.6747368", "0.672164", "0.6674812", "0.663185...
0.6931232
11
Returns the integer equivalent of the binary string.
def _binary_string_to_int(bitstring, big_endian=True): if not big_endian: bitstring = str(reversed(bitstring)) val = 0 nbits = len(bitstring) for (n, bit) in enumerate(bitstring): if bit == "1": val += 2**(nbits - n - 1) return val
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bin2int(r: str) -> int:", "def bin_to_int(bit_string):\r\n return int(''.join(bit_string), 2)", "def bitstr_to_int(a):\n return int(a, 2)", "def byte_str_to_int(str):\n return int.from_bytes(str, byteorder = \"big\")", "def bitstring_to_int(bitstr):\n b_list = bitstr.tolist()\n mystring ...
[ "0.8224296", "0.8092693", "0.76653373", "0.740448", "0.7333371", "0.73030263", "0.7261367", "0.7229864", "0.70981485", "0.70571816", "0.7037208", "0.6998326", "0.69783306", "0.68612695", "0.68541133", "0.684989", "0.683415", "0.6813389", "0.68040365", "0.67303544", "0.6716656...
0.7727533
2
Converts the rank to a ctrl_string for thresholding.
def _rank_to_ctrl_string(rank, length): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __rank_from_int_to_str(rank: int) -> str:\n return str(rank + 1)", "def __str__(self):\n return str(self.rank)", "def _threshold_to_control_string(self, threshold):\n # Make sure the threshold is ok\n if threshold < 0 or threshold > 1:\n raise ThresholdError(\"Argumen...
[ "0.6593619", "0.6022002", "0.56026626", "0.5538748", "0.53891945", "0.5351683", "0.5284331", "0.52622", "0.52310747", "0.5225471", "0.5217082", "0.5201264", "0.51567566", "0.5155428", "0.5123787", "0.51021874", "0.5084797", "0.5050555", "0.50300705", "0.50247926", "0.5008611"...
0.8312594
0
Returns a control string for the threshold circuit which keeps all values strictly above the threshold.
def _threshold_to_control_string(self, threshold): # Make sure the threshold is ok if threshold < 0 or threshold > 1: raise ThresholdError("Argument threshold must satisfy 0 <= threshold <= 1.") # Compute the angle 0 <= theta <= 1 for this threshold singular value theta = 1 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_threshold_str(self):\n if self.unit == ThresholdUnit.PERCENTAGE:\n return f\"{self.threshold}%\"\n return self.threshold", "def _strHard(self):\n if self.checkGreaterThanThreshold:\n operator += \">\"\n else:\n operator += \"<\"\n return \"(Hard) %s %...
[ "0.67489445", "0.64910465", "0.61631197", "0.60861534", "0.60524446", "0.60228556", "0.5994099", "0.5945274", "0.590314", "0.590314", "0.590314", "0.590314", "0.590314", "0.58639866", "0.5801137", "0.5792392", "0.5790814", "0.5790814", "0.57659495", "0.5691014", "0.5691014", ...
0.7095868
0
Tigerholm version of IA.
def ka_tf(Y,t,voltage_clamp_func,voltage_clamp_params): # g = gbar * n * h v = voltage_clamp_func(t,voltage_clamp_params) n = Y[0] h = Y[1] q10 = 1.0#3.3 # Preserved in case it is useful but disabled ninf = (1.0/(1.0 + np.exp(-(v+5.4+15)/16.4)))**4 ntau = 0.25 + 10.04*np.exp((-(v+24.67)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def t_IAx(mt, x, defer=0, i=None, inc=1., method='udd'):\n\n return IA_x(mt=mt, x=x, x_first=x + 1 + defer, x_last=mt.w + 1, i=i, inc=inc, method=method)", "def airl():\n algorithm = \"airl\"", "def ij(ij, pol, ant) :\n s.ij(pol, ij, ant)", "def t_nIAx(mt, x, n, defer=0, i=None, inc=1., method='udd'...
[ "0.6104706", "0.6072912", "0.5867349", "0.57087487", "0.567309", "0.5646599", "0.5618267", "0.5607819", "0.5509949", "0.54581845", "0.5440544", "0.5368196", "0.53348154", "0.5330311", "0.53295183", "0.53151816", "0.5309329", "0.52920604", "0.5260829", "0.525207", "0.5248973",...
0.0
-1
Jaffe et al. 1994 ICaL model.
def cal_ja(Y,t,voltage_clamp_func,voltage_clamp_params): v = voltage_clamp_func(t,voltage_clamp_params) m = Y[0] tfa = 1. ki = 0.001 # (mM) cao = 2.5 # Davidson (mM) " To do: make cai variable as an input like voltage " cai = 1.e-4 # (mM) Roughly values (100 nM) from Intracellular ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ICA_log_likelihood(X, model):\n\n # TODO: YOUR CODE HERE", "def construct_model():\n import lbann\n\n # Layer graph\n input = lbann.Input(target_mode='N/A', name='inp_data')\n # data is 64*64*4 images + 15 scalar + 5 param\n #inp_slice = lbann.Slice(input, axis=0, slice_points=\"0 16399 164...
[ "0.6196822", "0.5908754", "0.5809889", "0.57607794", "0.57542014", "0.5594538", "0.5566583", "0.5541234", "0.55340904", "0.54170597", "0.5401296", "0.54003006", "0.5380386", "0.53723615", "0.5342001", "0.5331724", "0.5316832", "0.5313649", "0.53117883", "0.5307793", "0.530736...
0.0
-1
Model of Ntype Ca current from Migliore 95
def can_mi(): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Ncen(self, m):\n pass", "def nits(self):", "def front_column_model_p_gain():", "def NuGrid_net(self,model_type='delay'):\n\n # Create list of masses and metallicites:\n self.masses = [12.0,15.0,20.0,25.0]\n self.metallicities = [0.02,0.01,0.006,0.001,0.0001]\t\t\n \n ...
[ "0.6159706", "0.5985799", "0.5833766", "0.57632107", "0.5715623", "0.56937754", "0.56754404", "0.5638119", "0.5625848", "0.56154746", "0.55823624", "0.5574716", "0.55289745", "0.55031383", "0.55031383", "0.549705", "0.5462524", "0.5442102", "0.5433495", "0.543087", "0.5421858...
0.0
-1
Kouranova Ih model with nonspecific current (reversal potential should be set at 30 mV
def hcn_kn(Y,t,voltage_clamp_func,voltage_clamp_params): v = voltage_clamp_func(t,voltage_clamp_params) n_s = Y[0] n_f = Y[1] ninf_s = 1/(1 + np.exp((v+87.2)/9.7)) ninf_f = ninf_s if v > -70.0: tau_ns = 300.0 + 542.0 * np.exp((v+25.0)/20.0) tau_nf = 140.0 + 50.0 * np.exp(-(v+2...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def doParametersOfInterest(self):\n self.modelBuilder.doVar(\"kappa_W[1,0.0,2.0]\") \n self.modelBuilder.doVar(\"kappa_Z[1,0.0,2.0]\") \n self.modelBuilder.doVar(\"kappa_tau[1,0.0,3.0]\")\n self.modelBuilder.doVar(\"kappa_mu[1,0.0,5.0]\") \n self.modelBuilder.factory_(\"expr::kap...
[ "0.5959516", "0.5938657", "0.59188086", "0.56832284", "0.5678824", "0.56349754", "0.556212", "0.5555892", "0.5533694", "0.5513207", "0.55051756", "0.54915553", "0.5479147", "0.54786277", "0.5437813", "0.5418036", "0.5404291", "0.5395422", "0.53909826", "0.53884333", "0.538687...
0.0
-1
Tigerholm version of the Kouranova Ih model which is identical except that when you calculate the current you don't use a nonspecific reversal potential and instead split the current between Na+ and K+, 50/50.
def hcn_tf(Y,t,voltage_clamp_func,voltage_clamp_params): v = voltage_clamp_func(t,voltage_clamp_params) n_s = Y[0] n_f = Y[1] ninf_s = 1/(1 + np.exp((v+87.2)/9.7)) ninf_f = ninf_s if v > -70.0: tau_ns = 300.0 + 542.0 * np.exp((v+25.0)/20.0) tau_nf = 140.0 + 50.0 * np.e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc_kwta_inhibition(self) -> None:\n top_m_units = self.units.top_k_net_indices(self.spec.k + 1)\n g_i_thr_m = self.units.g_i_thr(top_m_units[-1])\n g_i_thr_k = self.units.g_i_thr(top_m_units[-2])\n self.gc_i = g_i_thr_m + 0.5 * (g_i_thr_k - g_i_thr_m)", "def calc_k(self):\n\t\n\...
[ "0.6207315", "0.61734277", "0.61404717", "0.6069017", "0.59344864", "0.57818156", "0.57013375", "0.568654", "0.5584831", "0.5570212", "0.55488724", "0.5501513", "0.54939854", "0.5492646", "0.5472838", "0.547054", "0.54563785", "0.5454046", "0.54503864", "0.54393375", "0.54393...
0.0
-1
Instantiate Basic Classes to call here.
def __init__(self, secret_key=None): PayStackBase.__init__(self, secret_key=secret_key) self.transaction = Transaction self.customer = Customer self.plan = Plan
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(cls):", "def setUpClass(cls):\n\n Base._Base__nb_objects = 0\n cls.b1 = Base()\n cls.b2 = Base()\n cls.b3 = Base(22)\n cls.b4 = Base(2.2)\n cls.b5 = Base(\"two\")\n cls.r1 = Rectangle(10, 7, 2, 8)\n cls.r2 = Rectangle(2, 4)", "def __init__(...
[ "0.68417025", "0.6666116", "0.6656014", "0.65786934", "0.6541811", "0.647474", "0.6471347", "0.6452271", "0.64435893", "0.64189386", "0.64028394", "0.6396954", "0.6392208", "0.63788474", "0.63788474", "0.63529116", "0.6334275", "0.63251996", "0.6317408", "0.631519", "0.630211...
0.0
-1
This function returns a custom augmentations object for use with sequences via the load_sequences function in data_core.py. Please note that these augmentations have only been tested with RGB data between 0 and 1 and that order of operations is critical. e.g., blurs don't like missing data so shouldn't be applied befor...
def sample_custom_augmentations_constructor(num_features: int, window_radius: int) -> albumentations.Compose: max_kernel = int(round(0.1 * window_radius)) max_hole_size = int(round(0.1 * window_radius)) additional_targets = [ADDITIONAL_TARGETS_KEY.format(idx) for idx in range(1, num_features)] return a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_augmentation_sequence():\n # Macro to apply something with 50% chance\n sometimes = lambda aug: iaa.Sometimes(0.5, aug) # 50%\n rarely = lambda aug: iaa.Sometimes(0.1, aug) # 10%\n\n # Augmentation applied to every image\n # Augmentors sampled one value per channel\n aug_sequence = iaa.Se...
[ "0.72518003", "0.7063507", "0.6583223", "0.6424683", "0.6421103", "0.6192685", "0.6152167", "0.6097807", "0.6092612", "0.6060356", "0.60179466", "0.60006166", "0.59754187", "0.5908761", "0.5866812", "0.5864484", "0.58596736", "0.58376133", "0.58314306", "0.58147705", "0.57766...
0.6154471
6
Returns true if the instance exists.
def _Exists(self): cmd = util.GcloudCommand(self, 'beta', 'bigtable', 'instances', 'list') cmd.flags['format'] = 'json' cmd.flags['project'] = self.project # The zone flag makes this command fail. cmd.flags['zone'] = [] stdout, stderr, retcode = cmd.Issue( suppress_warning=True, raise_on...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exists(self):\n return True", "def exists(self):\n return True", "def singularity_exists(self):\n instances = Client.instances(quiet=self.quiet)\n for instance in instances:\n if self.pid in instance.name:\n return True\n return False", "def ex...
[ "0.80422133", "0.80422133", "0.79262125", "0.77907544", "0.7623855", "0.76222694", "0.7574529", "0.75404423", "0.75287634", "0.74621236", "0.7362517", "0.7278307", "0.7277255", "0.7208512", "0.7166167", "0.71638733", "0.71490216", "0.7146296", "0.7137245", "0.70719695", "0.70...
0.71871287
14
Generate Campaign Mailer File
def put(self, campaign_id): campaign = Campaign.query.filter_by(public_id=campaign_id).first() if campaign.candidates.count() > 0: campaign.launch_task('generate_mailer_file') return {'success': True, 'message': 'Initiated generate mailer file'}, 200 else: api...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sendEmail(householdID):\n contactID = mdb.getContact(householdID)\n sqlq = \"\"\"\n SELECT Name, Surname, Address1, Address2, Town, Postcode, email, status\n FROM Contact\n WHERE idContact = '{}';\n \"\"\".format(contactID)\n result = mdb.getSQL(sqlq)[0]\n\n...
[ "0.62662476", "0.6100366", "0.6038897", "0.60258704", "0.6018833", "0.5995741", "0.59857935", "0.59802675", "0.59382075", "0.59136933", "0.5876253", "0.58697945", "0.58588535", "0.585498", "0.5701235", "0.5700115", "0.5661588", "0.5602806", "0.55970114", "0.5536965", "0.55360...
0.6127983
1
Download Generated Campaign Mailer File
def get(self, campaign_id): campaign = Campaign.query.filter_by(public_id=campaign_id).first() if campaign: return send_file(campaign.mailer_file) else: api.abort(404, message='Campaign does not exist', success=False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download_attachment(self, msg):\n path = None\n for part in msg.walk():\n if part.get_content_type() == 'application/pdf':\n\n time_prefix = datetime.datetime.now().strftime(\"%Y-%m-%dT%H:%M:%S\")\n filename = time_prefix+\"-\"+part.get_filename()\n ...
[ "0.6207587", "0.61629426", "0.61061794", "0.60872763", "0.6069316", "0.6033814", "0.6006443", "0.5982717", "0.5926988", "0.5911624", "0.5889739", "0.5855126", "0.5819009", "0.57935196", "0.5749433", "0.5705398", "0.56524426", "0.5646966", "0.5636374", "0.5617726", "0.5607355"...
0.64709884
0
Assign Candidate Import to Campaign
def put(self, campaign_id, import_id): try: campaign = Campaign.query.filter_by(public_id=campaign_id).first() candidate_import = CandidateImport.query.filter_by(public_id=import_id).first() Candidate.query.filter_by(import_id=candidate_import.id).update({Candidate.campaign_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def put(self, campaign_id):\n campaign = Campaign.query.filter_by(public_id=campaign_id).first()\n if campaign.candidates.count() > 0:\n campaign.launch_task('generate_mailer_file')\n return {'success': True, 'message': 'Initiated generate mailer file'}, 200\n else:\n ...
[ "0.57850623", "0.53894794", "0.52772266", "0.52463496", "0.5215476", "0.5212152", "0.51909935", "0.50752306", "0.5036112", "0.5028312", "0.50166535", "0.50076145", "0.4974562", "0.48906434", "0.48841932", "0.48716426", "0.48612928", "0.48469207", "0.48326838", "0.4820747", "0...
0.72279286
0
Print the list of filters in the pcigale database.
def list_filters(): with Database() as base: filters = {name: base.get_filter(name) for name in base.get_filter_names()} name = Column(data=[filters[f].name for f in filters], name='Name') description = Column(data=[filters[f].description for f in filters], ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_filters():\n print('Hello! Let\\'s explore some US bikeshare data!')", "def PrintFilterCollection(self):\n self._filter_collection.Print(self._output_writer)", "def filters_show():\n log = slog()\n log.title_set('Filters applied')\n if self.args['table3D']...
[ "0.7513858", "0.728271", "0.7068839", "0.656867", "0.6391572", "0.6353896", "0.6288215", "0.61509585", "0.6072937", "0.60103214", "0.5993697", "0.59286284", "0.58995205", "0.5839732", "0.5807007", "0.5801106", "0.5794581", "0.57741386", "0.5759257", "0.57586986", "0.57420343"...
0.7171043
2
Add filters to the pcigale database.
def add_filters(fnames): with Database(writable=True) as base: for fname in fnames: with open(fname, 'r') as f_fname: filter_name = f_fname.readline().strip('# \n\t') filter_type = f_fname.readline().strip('# \n\t') filter_description = f_fname.rea...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _add_filters(self, filters):\n self._env.filters['dateformat'] = dateformat\n self._env.filters.update(filters or {})", "def apply_filters(self, new_filters):\n\t\tself.filters = new_filters", "def apply_filters(self, filters):\n self._data = self.model.objects.filter(**filters)", "d...
[ "0.66940427", "0.6561778", "0.6558746", "0.6418302", "0.64057815", "0.62887925", "0.6068981", "0.60636497", "0.6025763", "0.6024873", "0.600526", "0.59792304", "0.5913037", "0.58850616", "0.5872086", "0.5865903", "0.58526486", "0.5840947", "0.58158356", "0.5815147", "0.581483...
0.63654387
5
Delete filters from the pcigale database
def del_filters(fnames): with Database(writable=True) as base: names = base.get_filter_names() for fname in fnames: if fname in names: base.del_filter(fname) print("Removing filter {}".format(fname)) else: print("Filter {} not i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clear_list_filter(self,*args,**kwargs):\n # import pdb;pdb.set_trace()\n if args:\n for arg in args:\n if isinstance(arg,SqliteTable):\n try:\n del session[self.HEADER_NAME][arg.table_name]\n except Exception a...
[ "0.6794046", "0.6666188", "0.64374053", "0.6412906", "0.6134906", "0.612257", "0.60874057", "0.60324705", "0.60267925", "0.6019257", "0.5974808", "0.594915", "0.59430444", "0.59391993", "0.5930648", "0.58455044", "0.5835066", "0.58248544", "0.5820826", "0.58151543", "0.578677...
0.717233
0
Worker to plot filter transmission curves in parallel
def worker_plot(fname): with Database() as base: _filter = base.get_filter(fname) plt.clf() plt.plot(_filter.trans_table[0], _filter.trans_table[1], color='k') plt.xlim(_filter.trans_table[0][0], _filter.trans_table[0][-1]) plt.minorticks_on() plt.xlabel('Wavelength [nm]') plt.ylabel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_filters(fnames):\n if len(fnames) == 0:\n with Database() as base:\n fnames = base.get_filter_names()\n with mp.Pool(processes=mp.cpu_count()) as pool:\n pool.map(worker_plot, fnames)", "def doAllPlots ():\n #df = processIp (\"18-06-01-1-attack.pcap\", \"ec:1a:59:79:f4:...
[ "0.63512516", "0.6205365", "0.61081904", "0.5971916", "0.5961135", "0.5878029", "0.5855526", "0.58490413", "0.5817654", "0.58115464", "0.5803139", "0.5800116", "0.57768595", "0.57581633", "0.5753977", "0.5733456", "0.5699219", "0.56965303", "0.5688704", "0.5669338", "0.566890...
0.69686276
0
Plot the filters provided as parameters. If not filter is given, then plot all the filters.
def plot_filters(fnames): if len(fnames) == 0: with Database() as base: fnames = base.get_filter_names() with mp.Pool(processes=mp.cpu_count()) as pool: pool.map(worker_plot, fnames)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_filters(net, layer, x, y):\n filters = net.layers[layer].w.eval()\n fig = plt.figure()\n for j in range(len(filters)):\n ax = fig.add_subplot(y, x, j)\n ax.matshow(filters[j][0], cmap = matplotlib.cm.binary)\n plt.xticks(np.array([]))\n plt.yticks(np.array([]))\n pl...
[ "0.7144101", "0.68334246", "0.6760905", "0.66760325", "0.64315146", "0.63357484", "0.626112", "0.6214689", "0.6168091", "0.6132944", "0.61184967", "0.61166304", "0.6065469", "0.60580444", "0.60235727", "0.59663427", "0.5963482", "0.5903638", "0.58925027", "0.5876012", "0.5876...
0.70423925
1
helper function to parse time
def parse_date(td): resYear = float(td.days)/364.0 # get the number of years including the the numbers after the dot resMonth = int((resYear - int(resYear))*364/30) # get the number of months, by multiply the number after the dot by 364 and divide by 30. resYear = int(resYear) return str(resYear)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_time(text):\n\n # When keyword is 'in' adds values to time\n if text[-3] == 'in':\n remind_time = time.gmtime(int(text[-2]) * int(text[-1]) + time.time())\n # Otherwise try to parse time as written\n else:\n remind_time = text[-1].replace(':', ' ') \\\n + \" \...
[ "0.76827943", "0.76406664", "0.7517842", "0.7467294", "0.7415888", "0.73868084", "0.7386573", "0.7343121", "0.73254955", "0.73001826", "0.7159429", "0.70875233", "0.70563596", "0.704737", "0.7032999", "0.701714", "0.70158684", "0.70149547", "0.70029277", "0.6998369", "0.69053...
0.0
-1
Reads ATP matches but does not parse time into datetime object
def readATPMatches(dirname): allFiles = glob.glob(dirname + "/atp_matches_" + "20??.csv") ##restrict training set to matches from 2000s matches = pd.DataFrame() container = list() for filen in allFiles: df = pd.read_csv(filen, index_col=None, header=0) container.append(df) matches = pd.concat(con...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def test_process_read_custom_time(self):\n xknx = XKNX()\n self.datetime = DateTime(\n xknx,\n \"TestDateTime\",\n group_address=\"1/2/3\",\n broadcast_type=\"TIME\",\n localtime=False,\n respond_to_read=True,\n )\n\n ...
[ "0.6332722", "0.62225044", "0.6097771", "0.6039601", "0.6038429", "0.6006697", "0.5948585", "0.5936493", "0.59112996", "0.58939725", "0.5887772", "0.5887216", "0.5877503", "0.585918", "0.5835001", "0.5828498", "0.5826352", "0.581287", "0.58076936", "0.5769214", "0.57655585", ...
0.0
-1
Reads ATP matches and parses time into datetime object
def readATPMatchesParseTime(dirname): allFiles = glob.glob(dirname + "/atp_matches_" + "20??.csv") allFiles = allFiles[:-1] ## avoid 2017 since its incomplete matches = pd.DataFrame() container = list() for filen in allFiles: df = pd.read_csv(filen, index_col=None, header=0, parse_dates=[5],...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _parse_time(time_string: str) -> datetime:\n\n # Strings with timezone (+01:00) in v2 are not easily parsed. But time\n # zones are not important here, so we just omit them.\n time_string = time_string.rsplit('+')[0]\n\n time_formats = [\n '%Y-%m-%dT%H:%M:%S.%fZ', # Defa...
[ "0.63215744", "0.6218922", "0.620877", "0.60958487", "0.60541457", "0.60302633", "0.6005715", "0.5943619", "0.59128654", "0.59121895", "0.58951235", "0.58806336", "0.58780116", "0.58697003", "0.5864516", "0.5851861", "0.5849143", "0.5806065", "0.5782346", "0.5781294", "0.5772...
0.65270346
0
This is an intentionally bad condition that triggers an error
def condition(x): return 'string' + x
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sanity_check(self):\n pass", "def sanity_check(self):\n return True", "def invalid(self):\n pass", "def violated(self) -> bool:\n ...", "def unexpectedException(self):", "def unexpected_error(self, exception):", "def test_case_01(self):\n if True:\n sel...
[ "0.7094991", "0.70528525", "0.7000832", "0.6899215", "0.68890953", "0.682098", "0.6796712", "0.6757366", "0.675611", "0.6751527", "0.6733074", "0.6728573", "0.6728573", "0.65932304", "0.6588249", "0.656368", "0.6537258", "0.6537245", "0.64931065", "0.64808136", "0.6459043", ...
0.0
-1
No. 1 tests collection for DeviceAssociation.
def test_deviceassociation_1(base_settings): filename = base_settings["unittest_data_dir"] / "deviceassociation-example.json" inst = deviceassociation.DeviceAssociation.parse_file( filename, content_type="application/json", encoding="utf-8" ) assert "DeviceAssociation" == inst.resource_type ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_instance(self):\n self.assertEqual(True, type(self.Test.defined_associations['things']) is pyperry.association.HasMany)", "def test_get_devices1(self):\n pass", "def test_defined_associations(self):\n self.assertEqual(True, len(self.Test.defined_associations) > 0)", "def test_de...
[ "0.63186795", "0.62924093", "0.62830204", "0.62830204", "0.62830204", "0.62792283", "0.62792283", "0.624757", "0.61836016", "0.611244", "0.6044153", "0.5977334", "0.59670866", "0.59656906", "0.5937387", "0.59067976", "0.5894439", "0.5884807", "0.58664834", "0.58437556", "0.58...
0.67872405
0
Time complexity is O(log N), since the problem can be reduced down to binary search. If A[j] > j, then no entry after j can satisfy the given criterion. This is because each element in the array is at least 1 greater than the previous element. For the same reason , if A[j] < j, no entry before j can satisfy the given c...
def search_entry_equal_to_its_index(A): L, R = 0, len(A) -1 while L <= R: M = L + (R - L) // 2 if A[M] > M: R = M - 1 elif A[M] == M: return M else: # A[M] < M L = M + 1 return -1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def BS(self, arr, N, X):\n lo = 0\n hi = N - 1\n while lo <= hi:\n mid = (lo + hi) // 2\n if arr[mid] == X:\n return True\n elif arr[mid] < X:\n lo = mid + 1\n else:\n hi = mid - 1\n return False", ...
[ "0.6312722", "0.62923104", "0.6226362", "0.6148673", "0.6132592", "0.6132072", "0.60798305", "0.60679054", "0.60506034", "0.6018032", "0.6006477", "0.6005336", "0.5975313", "0.59663606", "0.5922118", "0.5916837", "0.5898111", "0.58858323", "0.588001", "0.58537954", "0.5833917...
0.6494884
0
Handle GET requests for job
def retrieve(self, request, pk=None): try: job = Job.objects.get(pk=pk) serializer = JobSerializer(job, context={'request': request}) return Response(serializer.data) except Exception as ex: return HttpResponseServerError(ex)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_GET(self):\n self._try_to_process_request(self._handle_get_request)", "def on_get(self, req, resp):\n try:\n n_reqs = int(req.params.get('n', self.default_reqs))\n except ValueError:\n error_response(resp, 'ERROR: Incorrect number of requests')\n retur...
[ "0.7475271", "0.70410204", "0.6988128", "0.6965615", "0.6851276", "0.67894495", "0.6776669", "0.67289686", "0.6651133", "0.6593948", "0.6584175", "0.6569812", "0.65278816", "0.6481121", "0.6451629", "0.6391111", "0.6358613", "0.6351677", "0.6351061", "0.6326234", "0.6315531",...
0.6014503
35
Handle PUT requests for a job
def update(self, request, pk=None): job = Job.objects.get(pk=pk) job.title = request.data["title"] job.description = request.data["description"] job.city = request.data["city"] job.state = request.data["state"] job.application = request.data["application"] user =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_put(self, api, command):\n return self._make_request_from_command('PUT', command)", "def put(self, *args, **kwargs):\n return self.handle_put_request()", "def _put(self, *args, **kwargs):\n return self._request('put', *args, **kwargs)", "def http_put(self, **kwargs):\n ...
[ "0.70080054", "0.697571", "0.6961433", "0.68555117", "0.68339956", "0.6767455", "0.67614263", "0.67394274", "0.6658202", "0.65806633", "0.65120596", "0.6483549", "0.6420429", "0.6349386", "0.62906986", "0.6290243", "0.6290243", "0.6290243", "0.62850165", "0.6248225", "0.62433...
0.62344754
21
Handle DELETE requests for a single job
def destroy(self, request, pk=None): try: job = Job.objects.get(pk=pk) job.delete() return Response({}, status=status.HTTP_204_NO_CONTENT) except Job.DoesNotExist as ex: return Response({'message': ex.args[0]}, status=status.HTTP_404_NOT_FOUND) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _delete_job(self, job):", "def delete(self):\n parser = reqparse.RequestParser()\n parser.add_argument(\"job_id\", type=str, location=\"form\")\n args = parser.parse_args()\n job_id = args[\"job_id\"]\n if job_id is None or job_id == \"\":\n return errors.all_err...
[ "0.804811", "0.72077435", "0.7132578", "0.7118642", "0.71037126", "0.708545", "0.68401533", "0.6763502", "0.67079043", "0.668712", "0.6683445", "0.66702896", "0.6655265", "0.6599019", "0.6597455", "0.6576192", "0.6546401", "0.6521259", "0.6478296", "0.64718896", "0.64297384",...
0.70287615
6
Handle GET requests to profile
def list(self, request): jobs = Job.objects.all() city = self.request.query_params.get('city', None) state = self.request.query_params.get('state', None) # Support filtering jobs by user id job = self.request.query_params.get('user', None) if job is not None: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getProfile(self):\n # GET /profile\n debugMain('getProfile')\n return self._genericGet('/profile')", "def get_profile(request):\n collected_values = {}\n\n # Only allow GET requests on this endpoint\n if request.method != 'GET':\n collected_values[\"success\"] = False\n ...
[ "0.7356478", "0.7284313", "0.714012", "0.7091871", "0.6971823", "0.6945185", "0.68961984", "0.6872427", "0.681282", "0.6787994", "0.67019415", "0.6681623", "0.66748136", "0.66683257", "0.6582885", "0.65826267", "0.6577597", "0.6541843", "0.64396584", "0.6310587", "0.62897474"...
0.0
-1
>>> h_d_n(123) (1, 2, 3) >>> h_d_n(321) (3, 2, 1) >>> h_d_n(90) (0, 9, 0)
def h_d_n(x:int) -> tuple: return(x // 100, (x % 100) // 10, x % 10)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculateDeCrypt(asci: int, d: int, n: int) -> int:\n return pow(int(asci),d,n)", "def d(n):\n return sum(divisors(n))", "def d(s):\n return s + 1", "def factorizacion_ds(n:int) -> Tuple[int,int]:\r\n if n<2:\r\n raise ValueError(\"n debe ser >=2\")\r\n d = n if not n&1 else (n - 1)...
[ "0.6135414", "0.59373635", "0.59330577", "0.5917609", "0.58610594", "0.5802275", "0.5800661", "0.57471615", "0.5747002", "0.57074314", "0.57021093", "0.5676164", "0.5650685", "0.56254137", "0.558355", "0.55562544", "0.5553181", "0.55499274", "0.55134493", "0.55087435", "0.548...
0.719936
0
Instantiates a local feature extractor.
def __init__(self):
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def magic_init(cls, feature_path=FEATURES_DATA_PATH, raw_path=RAW_DATA_PATH,\n raw_label_filename='labels.csv'):\n\n from features import AVAILABLE_FEATURES\n out_path = feature_path\n if cls.dependency_feature_name:\n # source path is in feature path\n ...
[ "0.6501958", "0.60083246", "0.5784577", "0.57365555", "0.56559485", "0.56446105", "0.56006855", "0.55886626", "0.5558868", "0.5509337", "0.5506666", "0.5467253", "0.5453437", "0.5414988", "0.5393013", "0.5385658", "0.5385658", "0.536459", "0.535608", "0.5349533", "0.5327604",...
0.0
-1
Detect and describe local keypoints.
def get_local_des(self, img): _, des =self.fe.detectAndCompute(img, None) return des
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_keypoint_detection(init_env, config_file):\n run_all_steps(init_env, config_file)", "def get_local_features(self, img):\n kp, des = self.fe.detectAndCompute(img, None)\n return kp, des", "def surf_keypoint_detection(img):\n surf = cv2.xfeatures2d.SURF_create(510)\n kp, des = sur...
[ "0.63079906", "0.61416626", "0.61312884", "0.6021436", "0.57368505", "0.5623367", "0.55178356", "0.5503452", "0.5495695", "0.5457657", "0.5428592", "0.54241955", "0.5420307", "0.54104996", "0.53900355", "0.53616196", "0.53247434", "0.5266665", "0.5254872", "0.5253049", "0.523...
0.0
-1
Detect and describe local keypoints.
def get_local_features(self, img): kp, des = self.fe.detectAndCompute(img, None) return kp, des
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_keypoint_detection(init_env, config_file):\n run_all_steps(init_env, config_file)", "def surf_keypoint_detection(img):\n surf = cv2.xfeatures2d.SURF_create(510)\n kp, des = surf.detectAndCompute(img, None)\n return des", "def get_keypoints():\n # Keypoints are not available in the COCO ...
[ "0.63097143", "0.61336166", "0.60220844", "0.5738497", "0.5622902", "0.55199105", "0.55028194", "0.5497425", "0.545911", "0.5430861", "0.54248726", "0.54204404", "0.5411404", "0.53913933", "0.5363734", "0.5326334", "0.52683765", "0.5255654", "0.52534306", "0.5239289", "0.5189...
0.6142685
1
Instantiates a local feature extractor.
def __init__(self, delf_dir): self.des_dir = delf_dir
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def magic_init(cls, feature_path=FEATURES_DATA_PATH, raw_path=RAW_DATA_PATH,\n raw_label_filename='labels.csv'):\n\n from features import AVAILABLE_FEATURES\n out_path = feature_path\n if cls.dependency_feature_name:\n # source path is in feature path\n ...
[ "0.6501958", "0.60083246", "0.5784577", "0.57365555", "0.56559485", "0.56446105", "0.56006855", "0.55886626", "0.5558868", "0.5509337", "0.5506666", "0.5467253", "0.5453437", "0.5414988", "0.5393013", "0.5385658", "0.5385658", "0.536459", "0.535608", "0.5349533", "0.5327604",...
0.0
-1
Instantiates a local feature extractor.
def __init__(self, label_num, des_dir, des_dim=48): self.label_num = label_num self.des_dir = des_dir self.des_dim = 48
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def magic_init(cls, feature_path=FEATURES_DATA_PATH, raw_path=RAW_DATA_PATH,\n raw_label_filename='labels.csv'):\n\n from features import AVAILABLE_FEATURES\n out_path = feature_path\n if cls.dependency_feature_name:\n # source path is in feature path\n ...
[ "0.6501958", "0.60083246", "0.5784577", "0.57365555", "0.56559485", "0.56446105", "0.56006855", "0.55886626", "0.5558868", "0.5509337", "0.5506666", "0.5467253", "0.5453437", "0.5414988", "0.5393013", "0.5385658", "0.5385658", "0.536459", "0.535608", "0.5349533", "0.5327604",...
0.0
-1
Sets up the argparse object for a specific dataset.
def init_cormorant_argparse(dataset): parser = argparse.ArgumentParser(description='Cormorant network options.') parser = setup_shared_args(parser) # Datasets without additional arguments if dataset.lower() in ["smp", "lba"]: pass # Datasets for classification tasks elif dataset == "res"...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse():\n parser = argparse.ArgumentParser()\n parser.add_argument('--dataset', default='ml-1m', help='which dataset to use')\n args = parser.parse_args()\n main(args)", "def __init__(self):\n self.parser = argparse.ArgumentParser(prog='PROG')\n self.parser.add_argument(\"--idir\",...
[ "0.709905", "0.6737217", "0.6725684", "0.6715105", "0.66910356", "0.6689633", "0.66340303", "0.6629519", "0.6566277", "0.65392494", "0.64324933", "0.6376761", "0.6372934", "0.6358038", "0.63520265", "0.6338287", "0.6338084", "0.633524", "0.63297504", "0.6312832", "0.6287631",...
0.70690745
1
Set up for the doc tests
def setUpClass(cls): cls.fs_f = inspect.getmembers(FileStorage, inspect.isfunction)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup( self ):", "def setup(self) -> None:", "def setup(self):\n pass", "def setUp(self):\n self.docCounter = 0", "def setup(self):\n ...", "def test_doc():\n pass", "def setup(self):\n pass", "def setup(self):\n pass", "def setup(self):\n pass", ...
[ "0.7833533", "0.7703642", "0.7694024", "0.7689729", "0.7655827", "0.7654702", "0.76496744", "0.76496744", "0.76496744", "0.76496744", "0.76496744", "0.76496744", "0.76496744", "0.76496744", "0.76496744", "0.76496744", "0.76496744", "0.76496744", "0.7637151", "0.7637151", "0.7...
0.0
-1
Test that models/engine/file_storage.py conforms to PEP8.
def test_pep8_conformance_file_storage(self): pep8s = pep8.StyleGuide(quiet=True) result = pep8s.check_files(['models/engine/file_storage.py']) self.assertEqual(result.total_errors, 0, "Found code style errors (and warnings).")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_pep8_conformance_test_file_storage(self):\n pep8s = pep8.StyleGuide(quiet=True)\n result = pep8s.check_files(['tests/test_models/test_engine/\\\ntest_file_storage.py'])\n self.assertEqual(result.total_errors, 0,\n \"Found code style errors (and warnings).\")", ...
[ "0.7939913", "0.740642", "0.740642", "0.7346395", "0.7346395", "0.66497564", "0.6502688", "0.6492406", "0.63181925", "0.6306742", "0.6300503", "0.6291657", "0.6269766", "0.62613714", "0.6225302", "0.62200075", "0.61967963", "0.61587316", "0.615522", "0.6145747", "0.61391056",...
0.8031939
0
Test tests/test_models/test_file_storage.py conforms to PEP8.
def test_pep8_conformance_test_file_storage(self): pep8s = pep8.StyleGuide(quiet=True) result = pep8s.check_files(['tests/test_models/test_engine/\ test_file_storage.py']) self.assertEqual(result.total_errors, 0, "Found code style errors (and warnings).")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_pep8_conformance_file_storage(self):\n pep8s = pep8.StyleGuide(quiet=True)\n result = pep8s.check_files(['models/engine/file_storage.py'])\n self.assertEqual(result.total_errors, 0,\n \"Found code style errors (and warnings).\")", "def test_file_field():", ...
[ "0.750308", "0.7247188", "0.7087716", "0.7005382", "0.7005382", "0.69971234", "0.68696296", "0.6790633", "0.6790633", "0.6779602", "0.6669038", "0.6602457", "0.6590004", "0.6556125", "0.6523744", "0.65025145", "0.6485095", "0.6340272", "0.6330424", "0.6330424", "0.6236692", ...
0.7583977
0
Test for the file_storage.py module docstring
def test_file_storage_module_docstring(self): self.assertIsNot(file_storage.__doc__, None, "file_storage.py needs a docstring") self.assertTrue(len(file_storage.__doc__) >= 1, "file_storage.py needs a docstring")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_file_storage_class_docstring(self):\n self.assertIsNot(FileStorage.__doc__, None,\n \"State class needs a docstring\")\n self.assertTrue(len(FileStorage.__doc__) >= 1,\n \"State class needs a docstring\")", "def test_docstring(self):\n ...
[ "0.7408883", "0.7304265", "0.68893766", "0.68893766", "0.68422467", "0.6720938", "0.66850764", "0.66716516", "0.6499715", "0.6474401", "0.6443321", "0.6381629", "0.6381629", "0.6371081", "0.6322822", "0.6282735", "0.6265872", "0.6205506", "0.6188024", "0.6153745", "0.6124802"...
0.8053633
0
Test for the FileStorage class docstring
def test_file_storage_class_docstring(self): self.assertIsNot(FileStorage.__doc__, None, "State class needs a docstring") self.assertTrue(len(FileStorage.__doc__) >= 1, "State class needs a docstring")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_file_storage_module_docstring(self):\n self.assertIsNot(file_storage.__doc__, None,\n \"file_storage.py needs a docstring\")\n self.assertTrue(len(file_storage.__doc__) >= 1,\n \"file_storage.py needs a docstring\")", "def test_docstring(self)...
[ "0.7724605", "0.7373347", "0.7370406", "0.70291007", "0.70291007", "0.70174724", "0.69507873", "0.68998235", "0.6748319", "0.6748319", "0.6646066", "0.6420071", "0.6388432", "0.6388432", "0.6386928", "0.6385066", "0.62834305", "0.6273837", "0.6257467", "0.6246449", "0.6236639...
0.79537505
0
Test for the presence of docstrings in FileStorage methods
def test_fs_func_docstrings(self): for func in self.fs_f: self.assertIsNot(func[1].__doc__, None, "{:s} method needs a docstring".format(func[0])) self.assertTrue(len(func[1].__doc__) >= 1, "{:s} method needs a docstring".format(fu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_docstring(self):\n self.assertTrue(len(FileStorage.__doc__) > 1)\n self.assertTrue(len(FileStorage.all.__doc__) > 1)\n self.assertTrue(len(FileStorage.new.__doc__) > 1)\n self.assertTrue(len(FileStorage.save.__doc__) > 1)\n self.assertTrue(len(FileStorage.reload.__doc__)...
[ "0.7583647", "0.73714226", "0.726911", "0.71747947", "0.71257865", "0.7060106", "0.6927781", "0.68431073", "0.68117917", "0.6764475", "0.674331", "0.6721562", "0.67128253", "0.6688601", "0.66628176", "0.6654613", "0.6654613", "0.66002995", "0.6595453", "0.6587535", "0.6514702...
0.7237537
3
Generator that checks types
def checks_type(self, itr, raises=None, warns=None, silent=None): if raises is warns is silent is None: # default behaviour decided at init (default is to raise TypeError) raises = True emit = self._actions[1 - first_true_index((raises, warns, silent))] for i, obj in enu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_basic_types(self):\n\t\tyield self.check_setget(\"a_string\", \"some random string\")\n\t\tyield self.check_setget(\"an_integer\", 42)\n\t\tyield self.check_setget(\"a_long\", long(1<<30))\n\t\tyield self.check_setget(\"a_dict\", { \"foo\" : \"bar\", \"baz\" : \"quux\" })", "def get_check_types():", "...
[ "0.6941974", "0.66699964", "0.649637", "0.6342046", "0.63404155", "0.62976897", "0.62158614", "0.62021077", "0.61712503", "0.61615604", "0.61520094", "0.60979986", "0.6086096", "0.60858196", "0.60639775", "0.60638964", "0.6004825", "0.5992021", "0.59898406", "0.5961027", "0.5...
0.661526
2
Main function to perform configs loading and wishart calculations
def main(template, wishart_neighbors, wishart_significance): print("------------------ LOADING CONFIGURATIONS -------------------") file_conf = environ.get('CONFIG') try: with open(file_conf, 'r') as file_conf: configs = yaml.load(file_conf) except Exception: raise Exception...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n logger = logging.getLogger(__name__)\n logger.info('making final data set from raw data')\n get_user_config()", "def load_config():\n # config variables are fetched from file, but if not, then here are defaults\n x_of_outer = 30\n y_of_outer = 30\n\n min_percent = 30\n max_p...
[ "0.7060118", "0.69054794", "0.67772466", "0.67089844", "0.6650186", "0.66354215", "0.66354215", "0.6626167", "0.6543456", "0.6519847", "0.646248", "0.6450026", "0.6423697", "0.64213604", "0.64095026", "0.63988", "0.6387472", "0.6386118", "0.6385381", "0.6366049", "0.6364681",...
0.6297701
25
Check mysql doesn't exists. Test that we can trigger a mysql connection failure and we fail gracefully to ensure we don't break people without mysql
def test_mysql_connect_fail(self): if test_migrations._is_backend_avail( 'mysql', 'kickstand_cifail', self.PASSWD, self.DATABASE): self.fail("Shouldn't have connected")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_mysql_connect_fail(self):\n if _is_backend_avail('mysql', user=\"openstack_cifail\"):\n self.fail(\"Shouldn't have connected\")", "def test_missing(server):\n\n assert \"non_existing_database\" not in server\n with pytest.raises(excepts.DBNotExists):\n server[\"non_existin...
[ "0.8019343", "0.64847225", "0.6414118", "0.6394261", "0.6361902", "0.63209903", "0.62543845", "0.6211786", "0.6167792", "0.61182964", "0.6047251", "0.6041001", "0.6038732", "0.6023822", "0.6023704", "0.5986073", "0.59562546", "0.5951382", "0.59086776", "0.58945745", "0.589357...
0.7984295
1
Check postgres doesn't exists. Test that we can trigger a postgres connection failure and we fail gracefully to ensure we don't break people without postgres
def test_postgresql_connect_fail(self): if test_migrations._is_backend_avail( 'postgres', 'kickstand_cifail', self.PASSWD, self.DATABASE): self.fail("Shouldn't have connected")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_postgresql_connect_fail(self):\n if _is_backend_avail('postgresql', user=\"openstack_cifail\"):\n self.fail(\"Shouldn't have connected\")", "def database_exists(database):\n try:\n test_connection_db = Database(database=database)\n test_connection_db.close()\n r...
[ "0.79075533", "0.7150718", "0.6752807", "0.66953045", "0.66447365", "0.660909", "0.6439612", "0.63683623", "0.6328746", "0.6321043", "0.6304608", "0.6242608", "0.6206685", "0.61457425", "0.6078942", "0.6048207", "0.603846", "0.6034774", "0.59535533", "0.59409016", "0.5940679"...
0.7844154
1
Construct new File Counter.
def __init__(self, synapse_df): self._file_df = synapse_df[synapse_df.type == "file"] self._folder_df = synapse_df[synapse_df.type == "folder"] self._init_file_types() self._identify_archive_folders() self._walk_files()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fileCounter(directory):", "def _increment_file_counter(self):\n self._add_to_file_counter(1)", "def _setcounter():\n fname = os.path.basename(camera.status.lastfile)\n tname = fname.split('.')[0]\n i = len(tname)-1\n if i > -1:\n while tname[i].isdigit() and i>-1:\n i = i - 1\n nname ...
[ "0.7541506", "0.72807074", "0.7094554", "0.6776536", "0.66911954", "0.66372764", "0.64699787", "0.64583606", "0.64356756", "0.6371093", "0.6329999", "0.6246639", "0.61441904", "0.61257684", "0.6021628", "0.597491", "0.5957693", "0.5949097", "0.5911655", "0.59001577", "0.58357...
0.0
-1
Get the File Type Counter.
def get_num_files(self, file_type): return self.file_type_counter.get(file_type, 0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_filetype(filepath, fileinfo, temppath):\n features = collections.Counter()\n\n # skip files in temp directory (only record primary file type here)\n if filepath.startswith(temppath):\n return features\n\n # skip if no fileinfo\n if not fileinfo:\n return features\n\n feature...
[ "0.7075743", "0.6808621", "0.6684209", "0.660871", "0.6603232", "0.65423536", "0.6539293", "0.6506061", "0.6490176", "0.6285142", "0.62413156", "0.61309546", "0.6097419", "0.6095863", "0.60910076", "0.60835075", "0.605242", "0.60425013", "0.60141003", "0.6012714", "0.59846336...
0.78032047
0
Get the Total File Size for the Specified File Type.
def get_total_file_size(self, file_type): return self.file_size_counter.get(file_type, 0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_num_files(self, file_type):\n return self.file_type_counter.get(file_type, 0)", "def get_size(self, typ):\n return self.info.get_size(typ)", "def get_file_size(self) -> int:\n return self.get_main_information()['FileSize']", "def total_file_length(self):\n if self.is_multi...
[ "0.71219486", "0.702957", "0.7018137", "0.6878474", "0.6850464", "0.67821544", "0.6761017", "0.6627649", "0.6599945", "0.65494007", "0.6542609", "0.65323985", "0.6529978", "0.652283", "0.6522734", "0.65056324", "0.6504725", "0.6465689", "0.64619946", "0.6411416", "0.638301", ...
0.88532853
0
Make sure the input data is correctly formatted. Return only correctly formatted rows.
def assert_data_format(data): counter = {'normal': 0, 'malformatted': 0, 'total': 0} dataOutput = [] try: assert isinstance(data, list), 'Input must be a list' except AssertionError as e: logging.critical('Incorrect input') raise AssertionError(e) for row in data: try...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_row_length(self):\n\n row_data = []\n for row in self._extract_data():\n if len(row) < self.row_length:\n row_data.append(row + [\"\" for _ in range(self.row_length - len(row))])\n else:\n row_data.append(row)\n\n return row_data",...
[ "0.6582768", "0.65188223", "0.64139277", "0.61330855", "0.5944692", "0.5943652", "0.5934933", "0.5927441", "0.5897106", "0.5895621", "0.58874494", "0.5877053", "0.5865555", "0.58563167", "0.58471286", "0.58074796", "0.5797014", "0.5791906", "0.57584476", "0.5747523", "0.57316...
0.629423
3
Print the dimensions of the dataset.
def dataDimensions(data): logging.info('Number of rows of data: %s' % len(data)) logging.info('Number of columns of data: %s' % len(data[1]))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dimensions():", "def print_shape(self, data):\n print(data.shape)", "def test_dimensions(self):\n\t\t\n\t\t# default\t\n\t\tdetails = self.watcher.describe()\n\t\tprint(details)\n\t\t\n\t\t# default\t\n\t\tdetails = self.watcher.describe(layers=[self.first_layer])\n\t\tprint(details)\n\t\tN = detail...
[ "0.72835773", "0.7208219", "0.70247895", "0.6825681", "0.6780157", "0.6741044", "0.67365885", "0.66827595", "0.6679423", "0.6673389", "0.6670542", "0.66320324", "0.66320324", "0.6608273", "0.6598985", "0.65961164", "0.6579692", "0.6556183", "0.6556135", "0.65442944", "0.65418...
0.73739463
0
Convert a csv to a list of dictionaries.
def csvToDict(filepath): data = [] with open(getcwd() + filepath, 'r') as dataset: assert csv.Sniffer().has_header(dataset.read(9999)), 'No headers' dataset.seek(0) dialect = csv.Sniffer().sniff(dataset.read(99999)) dataset.seek(0) reader = csv.DictReader(dataset, dialect...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def csv_to_dict(filename):\n data_list = []\n \n with open(filename, 'rb') as datafile:\n data_reader = csv.DictReader(datafile, delimiter = ',')\n for row in data_reader:\n data_list.append(row)\n\n return data_list", "def read_csv_as_dicts(csv_input_file_name):\n input_t...
[ "0.79083765", "0.7728302", "0.7700437", "0.76274085", "0.75642544", "0.7432599", "0.7360535", "0.72664535", "0.7258198", "0.7178364", "0.7064394", "0.7061235", "0.6999389", "0.6995503", "0.69937056", "0.6939701", "0.6924568", "0.6895539", "0.68594724", "0.6778694", "0.6662602...
0.7280546
7
Print a list of file and ask user to pick one.
def choose_file(): chdir(getcwd()+'/data/US') f = [] for (dirpath, dirnames, filenames) in walk(getcwd()): f.extend(filenames) print('Which file do you want to work on?') for i in f: print(str(f.index(i)) + ' - ' + i) while True: try: return f[int(input('Type ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def select(files, file_type):\n k = 0\n print('== ' + file_type + ' List ==')\n for file in files:\n print(\"[\" + str(k) + \"]. \" + file)\n k += 1\n print('Select a ' + file_type + ' to continue')\n idx = int(input())\n return files[idx]", "def Infor_file():\n \n import os...
[ "0.75064415", "0.71939963", "0.65890867", "0.6564373", "0.65554124", "0.64916223", "0.6449925", "0.6444414", "0.6431766", "0.63376623", "0.6304233", "0.6280491", "0.6218513", "0.6209496", "0.61802244", "0.6176718", "0.6160366", "0.61584055", "0.614337", "0.61433536", "0.61109...
0.6795578
2
Essa fucao retorna os registros
def __repr__(self): return "<User %s>"% self.username
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def regs() -> None:", "def regenall(ctx):\n c = ctx.obj['client']\n if not c.login:\n return False\n\n r = requests.request(\"GET\", urljoin(c.BASE_URL, '/apiproxy/JobService.js'), params={'accesskey': c.login, 'method': 'GenerateAndPopulateAllSearches'})\n print(r.status_code, r.text)\n\n ...
[ "0.6523601", "0.5854332", "0.57901585", "0.5744846", "0.5733562", "0.56205326", "0.56156015", "0.5540107", "0.5526909", "0.5510328", "0.5385071", "0.53573036", "0.5337793", "0.5313724", "0.5296566", "0.5269433", "0.5258065", "0.52537435", "0.52228576", "0.52224046", "0.519734...
0.0
-1
Set the scroll region on the canvas
def set_scrollregion(self, event=None): self.canvas.configure(scrollregion=self.canvas.bbox('all'))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_configure(self, event):\n self.testCanvas.configure(scrollregion=self.testCanvas.bbox('all'))\n self.testCanvas.yview_moveto(1)", "def __reconfig__(self, event):\r\n x, y = event.width//2, event.height//2\r\n self.canvas.config(scrollregion=(-x, -y, x, y))", "def update_scrol...
[ "0.7618465", "0.75891054", "0.70867497", "0.6937721", "0.66451067", "0.66319126", "0.6626159", "0.6525639", "0.6470909", "0.6445509", "0.6432371", "0.64242435", "0.63335246", "0.6312971", "0.62980497", "0.62910694", "0.6274682", "0.6224632", "0.6214763", "0.6129663", "0.60695...
0.82397264
0
Get the instance's families
def get_families(instance): families = instance.data.get("families", []) family = instance.data.get("family") if family: families.append(family) return set(families)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_families(self):\n return self.__make_api_call('get/families')", "def list_families(self):\n return self.__make_api_call('list/families')", "def families(self):\n\n return [get_target_family_by_id(i) for i in self._family_ids]", "def get_families(self):\n # Implemented from...
[ "0.7949288", "0.7805857", "0.730276", "0.71409595", "0.71386194", "0.68486196", "0.6693059", "0.64362943", "0.63239765", "0.63228005", "0.6175703", "0.6123435", "0.6111729", "0.6105033", "0.6057197", "0.59759986", "0.5844662", "0.58399475", "0.5798087", "0.5798087", "0.578143...
0.8296791
0
Return the member nodes that are invalid
def get_invalid(cls, instance): others = [i for i in list(instance.context) if i is not instance and set(cls.families) & get_families(i)] if not others: return [] other_ids = defaultdict(list) for other in others: for _id, mem...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate(self, node):", "def get_member_errors(rows):\n\n member_errors = []\n\n for row in rows:\n if row['svname'] not in ['FRONTEND', 'BACKEND'] and \\\n row['status'] not in ['UP', 'no check']:\n member_errors.append(row['pxname'] + ':' + row['svname'])\n\n return mem...
[ "0.6208121", "0.61689955", "0.61560327", "0.6121829", "0.5997731", "0.58034176", "0.57894987", "0.57870746", "0.5766943", "0.5748134", "0.5737588", "0.5679277", "0.56642914", "0.5614621", "0.5604182", "0.5556039", "0.55382854", "0.55286926", "0.54840016", "0.5482115", "0.5415...
0.68075114
0
Workaround if cmd.png() doesn't work
def pnghack(filepath, width=2000, height=2000): #cmd.png() doesnt work with api cmd.set('ray_trace_frames', 1) # Frames are raytraced before saving an image. cmd.viewport(width, height) # Set resolution cmd.mpng(filepath, 1, 1) # Use batch png mode with 1 frame only cmd.mplay() # cmd.mpng needs the ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _repr_png_(self):\n mol = self.owner.mol\n keku = IPythonConsole.kekulizeStructures\n size = IPythonConsole.molSize\n opts = IPythonConsole.drawOptions\n return Draw._moltoimg(\n mol, size, self.aix, \"\", returnPNG=True, drawOptions=opts,\n kekulize=kek...
[ "0.6851574", "0.6851574", "0.64041066", "0.6282898", "0.62631154", "0.6247078", "0.62100506", "0.60794604", "0.6079245", "0.5956906", "0.5950246", "0.5947135", "0.59258497", "0.59258497", "0.5924405", "0.57349074", "0.5717621", "0.5695675", "0.56849134", "0.56611705", "0.5616...
0.65783626
2
Create event for when application starts.
def __init__(self): self.started = Event()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_start(self):\n pass", "def on_start(self):\n pass", "def on_start(self):\n pass", "def on_start(self):\n pass", "def on_start(self):\n pass", "def on_start(self):\n pass", "def on_start(self):\n pass", "def on_start(self):\n pass", "def...
[ "0.7306682", "0.7306682", "0.7306682", "0.7306682", "0.7306682", "0.7306682", "0.7306682", "0.7306682", "0.7121523", "0.708508", "0.69430435", "0.6940174", "0.6940174", "0.68922603", "0.66725594", "0.66557467", "0.66363394", "0.66359836", "0.6628001", "0.6623074", "0.6535528"...
0.67195034
14
Called after the model is created.
def run(self): self.started()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize_model(self):\n pass", "def init_model(self):\n pass", "def initialize(self, model):\n pass", "def post_build(self):\n pass", "def afterInit(self):", "def create_model(self):\n pass", "def create_model(self):\n pass", "def create_models( self ):...
[ "0.74985135", "0.7452881", "0.7244991", "0.7007463", "0.6994847", "0.6924713", "0.6924713", "0.6918619", "0.6884343", "0.6876301", "0.685897", "0.6847569", "0.68398577", "0.6822226", "0.6820061", "0.6773574", "0.6766544", "0.6766544", "0.671303", "0.66979086", "0.66924626", ...
0.0
-1
Encode a Caesar cipher.
def caesar_encode(self, text, key): result_list = [] for char in text: if char.isalpha(): if char.islower(): offset = ASCII_LOWER_OFFSET else: offset = ASCII_UPPER_OFFSET char = chr((ord(char) - offset + ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encode(key, plain):\n print(\"ciphertext: \", end=\"\")\n\n # used variables\n pos = 0\n key_len = len(key)\n\n # loop over every character in the text\n for char in plain:\n key_pos = pos % key_len\n # leave non-alphabetical characters alone\n if not char.isalpha():\n ...
[ "0.7432236", "0.73142827", "0.7064377", "0.7056149", "0.69567156", "0.68698937", "0.6776725", "0.6752809", "0.6702963", "0.660597", "0.657546", "0.65655595", "0.65487605", "0.6533035", "0.65041655", "0.6461819", "0.64432335", "0.639268", "0.637906", "0.63251495", "0.6317241",...
0.6664478
9
Overview of monthly spend by category for the last n months.
def monthly_overview(): df = ( monzo [~monzo.category.isin(['general', 'transfer'])] .pivot_table('amount', 'month', 'category', aggfunc='sum', fill_value=0) .reset_index() .melt(id_vars=['month'], value_name='amount') ) inc = df[df.category.eq('i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def SumCostByMonthPerCategory(year, numberOfMonth, category):\n\n logs.logger.debug(\n \"Start to adds all amount of Cost objects based on the month of payment date and on the category.\")\n try:\n num_days = calendar.monthrange(year, numberOfMonth)[1]\n searchedCostByMonthFromDB = GetAl...
[ "0.6153713", "0.58537513", "0.58471185", "0.5838708", "0.56815994", "0.5626167", "0.5604199", "0.5594761", "0.55863005", "0.5585975", "0.55839974", "0.55758244", "0.55617726", "0.55524075", "0.55136883", "0.55043674", "0.54847926", "0.54786766", "0.5466748", "0.54640615", "0....
0.69854707
0
Ensure findlinks option endup being a list of strings.
def _fixup_find_links(find_links): if isinstance(find_links, str): return find_links.split() assert isinstance(find_links, (tuple, list)) return find_links
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def produce_links_search(self, value_list:list) -> list:\n return [\n [self.produce_link_google(f) for f in value_list],\n [self.produce_link_qwant(f) for f in value_list],\n [self.produce_link_bing(f) for f in value_list],\n [self.produce_link_duckduckgo(f) for f...
[ "0.59844595", "0.59079087", "0.58242726", "0.5810565", "0.5720067", "0.56380796", "0.56306934", "0.5554415", "0.55288565", "0.55027115", "0.54880166", "0.54853743", "0.54810125", "0.54488546", "0.54431033", "0.5396246", "0.5343557", "0.5296428", "0.5295228", "0.5291945", "0.5...
0.71301365
0
Fetch an egg needed for building. Use pip/wheel to fetch/build a wheel.
def fetch_build_egg(dist, req): _DeprecatedInstaller.emit() _warn_wheel_not_available(dist) return _fetch_build_egg_no_warn(dist, req)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_essential(self):\n self.install_package(\"build-essential\")", "def build():\n local('python' + python_version + ' setup.py bdist_egg')", "def ensure_wheel():\n wheels = sorted(DIST.glob(\"*.whl\"))\n if not wheels:\n subprocess.check_call([\"pyproject-build\", \".\", \"--wheel...
[ "0.6031584", "0.59851366", "0.5983711", "0.5879789", "0.58144295", "0.57931286", "0.5760505", "0.5605846", "0.5510201", "0.54663193", "0.5444306", "0.54275984", "0.5427478", "0.5391566", "0.5365108", "0.53289986", "0.53218055", "0.5299065", "0.5275417", "0.5265924", "0.525300...
0.7449293
0
Return a new requirement without the environment marker to avoid calling pip with something like `babel; extra == "i18n"`, which would always be ignored.
def strip_marker(req): import pkg_resources # Delay import to avoid unnecessary side-effects # create a copy to avoid mutating the input req = pkg_resources.Requirement.parse(str(req)) req.marker = None return req
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def avoid_pip_isolation(env: Mapping[str, str]) -> dict[str, str]:\n new_env = {k: v for k, v in env.items() if k != \"PYTHONNOUSERSITE\"}\n if \"PYTHONPATH\" not in new_env:\n return new_env\n\n new_env[\"PYTHONPATH\"] = os.pathsep.join(\n [\n path\n for path in new_en...
[ "0.6552357", "0.5994064", "0.589006", "0.5876299", "0.57701266", "0.5718214", "0.56937885", "0.5686367", "0.5629351", "0.55940837", "0.5577624", "0.549431", "0.54820436", "0.5460692", "0.54408735", "0.5440247", "0.5432639", "0.5432031", "0.54307127", "0.54157686", "0.53946084...
0.75084823
0
Test Case for setup of Logistic Regression
def test_setup_log_reg_classifier(self): model ,vec, x_testing=setup_log_reg_classifier(self.training_data, self.training_y, self.testing_data,"text", method="count") model2 ,vec_tfidf, x_testing2=setup_log_reg_classifier(self.training_data, self.training_y, self.testing_data,"text", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_logistic_regression_c_parameter(params, X_train, X_test, y_train, y_test):", "def test_train_logist(x_train_variable, y_train_dep):\n # Ensure the function works\n try:\n lrc = cls.train_logistic(x_train_variable, y_train_dep)\n logging.info(\"Successful Logistic Model\")\n except...
[ "0.77214766", "0.7520839", "0.7343993", "0.7281926", "0.7180691", "0.71483684", "0.71165", "0.7098579", "0.7064817", "0.7052712", "0.7048455", "0.6993554", "0.6963736", "0.68801945", "0.6828811", "0.6816357", "0.6768154", "0.67567813", "0.664204", "0.6568265", "0.6563794", ...
0.69252974
13
Test Case for Predict for Logistic Regression
def test_predict(self): model ,vec, x_testing=setup_log_reg_classifier(self.training_data, self.training_y, self.testing_data,"text", method="count") model2 ,vec_tfidf, x_testing2=setup_log_reg_classifier(self.training_data, self.training_y, self.testing_data,"text", method="tfidf") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def logistic_predict(weights, data):\n\n # TODO: Finish this function\n\n return y", "def logistic_predict(self, x: np.array) -> np.array:\r\n if self.LogisticModel is None:\r\n print('Logistic Model not trained, please run logistic_fit first!')\r\n return None\r\n else:...
[ "0.7305153", "0.7237397", "0.7183373", "0.7152834", "0.71376544", "0.7132555", "0.7074927", "0.6997127", "0.69198036", "0.69073516", "0.68978494", "0.68912554", "0.687313", "0.6825163", "0.68070877", "0.67960995", "0.67626137", "0.67519486", "0.674025", "0.673961", "0.6705134...
0.6600049
24
Initialize database connection and sessionmaker
def __init__(self): engine = db_connect() create_tables(engine) self.Session = sessionmaker(bind=engine)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_db(self):\n\n # The user can provide a custom string\n if self.database is None:\n self.logger.error(\"You must provide a database url, exiting.\")\n sys.exit(1)\n\n self.engine = create_engine(self.database, convert_unicode=True)\n self.session = scoped_session(\n session...
[ "0.77571905", "0.77500427", "0.77498686", "0.77142614", "0.7675466", "0.7598643", "0.75940216", "0.75440794", "0.75440794", "0.753408", "0.7526113", "0.7511898", "0.7495771", "0.7474186", "0.737677", "0.73386455", "0.73346627", "0.7311713", "0.72757417", "0.7271616", "0.72439...
0.79214334
0
Let's Authenticate the Banks Note This is using docstrings for specifications.
def predict_note_authentication(totalyearlycompensation,safety,classifier): prediction=classifier.predict([[totalyearlycompensation,safety]]) print(prediction) return prediction
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def auth():\n pass", "def auth():\n pass", "def authorization():\n pass", "def authenticate(self, username, password, consumerKey, consumerSecret):\r\n pass", "def authenticate():\n return Response(\n '''Login Required - email acaceres@0-sec.net for access or DM him @_hyp3ri0n on Twitter....
[ "0.6442201", "0.6442201", "0.61614424", "0.5995388", "0.59081537", "0.58965886", "0.5888043", "0.58654636", "0.5845789", "0.58425903", "0.58413416", "0.58286655", "0.58205444", "0.5803473", "0.58030915", "0.5792578", "0.57841116", "0.57841116", "0.57841116", "0.57841116", "0....
0.0
-1
Recenters an image from the origin to the middle of the display image
def center(image): size = image.shape half = int(np.ceil(size[0]/2)) image = np.roll(np.roll(image, half, 0), half, 1) return image
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_image(self, image):", "def center_image(image):\r\n image.anchor_x = image.width / 2\r\n image.anchor_y = image.height / 2", "def center_image(image):\r\n image.anchor_x = image.width / 2\r\n image.anchor_y = image.height / 2", "def center_image(image):\n image.anchor_x = image.width/2\...
[ "0.65491354", "0.6542907", "0.6542907", "0.64663273", "0.6463194", "0.6424689", "0.63045746", "0.6273058", "0.6259496", "0.62448", "0.6225228", "0.6177235", "0.6176828", "0.6174159", "0.61622965", "0.61580944", "0.6121791", "0.60993665", "0.6059796", "0.6056057", "0.60365945"...
0.0
-1
Returns the power spectrum function of an image
def ps(image): image = image.astype(float) ps_img = abs(pow(fft2(image), 2)) return ps_img
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def spectral_power(img, avg_window_size=None, log=True): #COMPLETE spectrum generator\r\n image = img.copy()\r\n # to avoid large spectral power at the 0 frequency :\r\n image -= np.mean(image)\r\n # wiener filter to reduce non physical variability in the spectral power\r\n if avg_window_size:\r\n ...
[ "0.75860554", "0.7297011", "0.72364277", "0.7204423", "0.7068326", "0.6855464", "0.6534", "0.64967054", "0.64738446", "0.63099605", "0.62746674", "0.6239556", "0.62161505", "0.6206272", "0.61712384", "0.61586595", "0.61429554", "0.61336607", "0.61296254", "0.601769", "0.59822...
0.69459283
5
Returns the hash_value for any substring of a string using the precomputed hash table.
def get_hash_value(table, prime, multiplier, start, length): y = pow(multiplier, length, prime) hash_value = (table[start+length] - y*table[start]) % prime return hash_value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def computeHash(string):\n\tif isBytes(string):\n\t\tstring = string.decode(\"latin-1\")\n\thash_ = 63689\n\tfor char in string:\n\t\thash_ = hash_ * 378551 + ord(char)\n\treturn hash_ % 65536", "def hash(self, string):\n return self.__scaffydb.hash(string)", "def hash(string):\n hs = 0\n ...
[ "0.698711", "0.666947", "0.6521936", "0.64672047", "0.6333751", "0.6230026", "0.619084", "0.6189764", "0.6126085", "0.6096258", "0.6066745", "0.60384375", "0.6025499", "0.6015478", "0.59934574", "0.5983955", "0.5969096", "0.5931997", "0.5915404", "0.590932", "0.590201", "0....
0.5547814
36
Precompute hashtable for a string with 2 prime numbers and a multiplier. Using a rolling hash function, we can get the hashvalue for any substring in constant time.
def pre_compute_hashes(s, M1, M2, X): n = len(s) h1 = [0 for _ in range(n+1)] h2 = [0 for _ in range(n+1)] for i in range(1, n+1): ch = ord(s[i-1]) h1[i] = (X*h1[i-1] + ch) % M1 h2[i] = (X*h2[i-1] + ch) % M2 return h1, h2
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _precompute_substrings(self, p: int) -> List[int]:\n hash_vals: List[int] = [0]\n for i in range(len(self._s)):\n val = (hash_vals[i] * self.X + ord(self._s[i])) % p\n hash_vals.append(val)\n\n return hash_vals", "def get_hash_value(table, prime, multiplier, start, ...
[ "0.7161889", "0.68627113", "0.664224", "0.656542", "0.6429222", "0.6295608", "0.62773484", "0.6263875", "0.6260028", "0.6208387", "0.6194183", "0.61931044", "0.615499", "0.61416006", "0.6121987", "0.60881466", "0.6085557", "0.6082059", "0.6034449", "0.59991634", "0.59969115",...
0.69907576
1
Uses binary search to find the number of mismatches. It finds the leftmost mismatch and then looks at the substring hash after that index position and continues until the number of mismatches are more than k or the start pointer is more than or equal to end.
def find_num_matches(p1, p2, t1, t2, m1, m2, x, k, len_p, i): start = 0 for mismatch in range(k): # print(f'start: {start}, id: {id}') id = start end = len_p-1 while start <= end: mid = start + (end-start)//2 p_h1, p_h2 = get_hash_value( p1...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lcs_hamming_only_matches(s1: str, s2: str, k: int, length: int, matches_lst: List):\n count = 0\n for i in range(0, len(s1) - length + 1):\n for j in range(0, len(s2) - length + 1):\n sub1 = s1[i: i + length]\n sub2 = s2[j: j + length]\n result = hamming_distance(s...
[ "0.6563195", "0.63334215", "0.619655", "0.6072905", "0.5992598", "0.5792656", "0.57802635", "0.5761363", "0.57300216", "0.5706402", "0.56756544", "0.5673622", "0.56674", "0.5588823", "0.55755645", "0.557284", "0.5536065", "0.5526799", "0.55215424", "0.55209804", "0.5507269", ...
0.6899368
0
Driver function to return number of occurences of a pattern in a text with at most k mismatches. Returns the start index of occurence as well as the number of mismatches.
def solve(k, text, pattern): # print(k, text, pattern) base = pow(10, 9) M1 = base + 7 M2 = base + 9 X = 263 len_p = len(pattern) len_t = len(text) pattern1, pattern2 = pre_compute_hashes(pattern, M1, M2, X) text1, text2 = pre_compute_hashes(text, M1, M2, X) res = [] p_hash1,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def frequent_words_with_mismatches(text, k, d):\n\n patterns = []\n freq_map = {}\n n = len(text)\n for i in range(n - k + 1):\n pattern = text[i:i + k]\n pattern_rc = reverse_complement(pattern)\n neighborhood = neighbors(pattern, d) + neighbors(pattern_rc, d)\n for j in ra...
[ "0.6649192", "0.6579769", "0.6411769", "0.63241273", "0.62982893", "0.62874293", "0.6251507", "0.6247955", "0.6232768", "0.62261176", "0.6216543", "0.6216298", "0.6168045", "0.6126884", "0.6091661", "0.6048104", "0.6023427", "0.60232127", "0.6001935", "0.59950364", "0.5993816...
0.6189535
12
Calculate the mse for vector e.
def calculate_mse(e): return 1/2*np.mean(e**2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_mse(e):\n return 1/2*np.mean(e.dot(e))", "def compute_MSE(e):\n\n return 1/2*np.mean(e**2)", "def compute_RMSE(e):\n \"\"\"Corresponds to sqrt(2*MSE)\"\"\"\n \n return np.sqrt(2*compute_MSE(e))", "def _mse(self):\n error = self._input * self._weights - self._label\n ...
[ "0.8627569", "0.8492956", "0.7717357", "0.7474573", "0.73560566", "0.73297226", "0.725569", "0.72040147", "0.7180668", "0.716424", "0.715627", "0.7137266", "0.71137995", "0.71091557", "0.71063846", "0.70705134", "0.70670843", "0.70613927", "0.70559907", "0.7045481", "0.703998...
0.86390364
0
Initialise UI Data Manager and Response Handler
def __init__(self, iface, configManager): QObject.__init__(self) self.iface = iface self._queues = None self._dockWindow = None self._currentMapTool = None self.rclParent = None self.currentRevItem = None self.actions = [] if Controller._instance ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n self.websock_handlers = {}\n self.ajax_handlers = {'__dashboard__': self.get_dashboard_ui}\n self.dashboard_handlers = {}", "def init_ui(self):\n raise NotImplementedError", "def init_ui(self):\n raise NotImplementedError", "def prepare_UI(self):", "...
[ "0.6750872", "0.66436946", "0.66436946", "0.65866643", "0.65207833", "0.6492288", "0.64365065", "0.6331915", "0.6310459", "0.62631446", "0.6223878", "0.6221055", "0.6193123", "0.6126456", "0.6115807", "0.60736716", "0.6054278", "0.6013648", "0.600479", "0.59794086", "0.597384...
0.55337137
95
Set up UI within QGIS
def initGui(self): # set srs self._displayCrs = QgsCoordinateReferenceSystem() self._displayCrs.createFromOgcWmsCrs('EPSG:4167') self.iface.mapCanvas().mapSettings().setDestinationCrs(self._displayCrs) # init layerManager self._layerManager = LayerManager(self.iface, s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup(self):\n self.ui.setup_window()", "def initUI(self):\n \n self.setWindowTitle(\"Intecol Flir camera\")\n self.setGeometry(300, 100, 1012, 622)", "def inicialUI(self):\r\n\r\n self.setGeometry(500, 500, 500, 500)\r\n self.setWindownTitle(\"Pesquisa\")\r\n ...
[ "0.72260803", "0.7211928", "0.7206275", "0.71976244", "0.7164867", "0.7164867", "0.7149143", "0.7126986", "0.70783645", "0.7038808", "0.70362467", "0.7032511", "0.70274544", "0.698081", "0.69556254", "0.69539404", "0.69419616", "0.6932011", "0.69111043", "0.69000256", "0.6899...
0.7779239
0
Initialise Loading of the queue widgets into QGIS
def loadQueues( self ): queues = self.Queues() if not queues.isVisible(): queues.parent().show()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initGui(self):\n\n # set srs\n self._displayCrs = QgsCoordinateReferenceSystem()\n self._displayCrs.createFromOgcWmsCrs('EPSG:4167') \n self.iface.mapCanvas().mapSettings().setDestinationCrs(self._displayCrs)\n\n # init layerManager\n self._layerManager = LayerManager(...
[ "0.67353976", "0.6553519", "0.65403384", "0.64762926", "0.63988465", "0.639814", "0.6305668", "0.62839437", "0.6229685", "0.6174939", "0.6174939", "0.6155415", "0.6138522", "0.6124276", "0.6120289", "0.6089418", "0.60719943", "0.6070405", "0.6062321", "0.605937", "0.60530907"...
0.6407615
4