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
Returns the model properties as a dict
def to_dict(self): result = {} for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): result[attr] = list(map( lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_dict(self):\n return self.properties", "def to_dict(self):\n return self.properties", "def get_properties(self):\n return self.properties", "def asdict(self):\n return self._prop_dict", "def json(self):\n rv = {\n prop: getattr(self, prop)\n f...
[ "0.775081", "0.775081", "0.7338297", "0.73333067", "0.7296288", "0.7277521", "0.7159291", "0.71573424", "0.714855", "0.714855", "0.71273863", "0.71261555", "0.7122034", "0.71070296", "0.7060047", "0.7043975", "0.7032398", "0.7023222", "0.6964265", "0.6958815", "0.68987364", ...
0.0
-1
Returns the string representation of the model
def to_str(self): import simplejson as json if six.PY2: import sys reload(sys) sys.setdefaultencoding("utf-8") return json.dumps(sanitize_for_serialization(self), ensure_ascii=False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return super().__str__() + self.model.__str__()", "def __str__(self) -> str:\n # noinspection PyUnresolvedReferences\n opts = self._meta\n if self.name_field:\n result = str(opts.get_field(self.name_field).value_from_object(self))\n else:\n ...
[ "0.85856134", "0.7814518", "0.77898884", "0.7751367", "0.7751367", "0.7712228", "0.76981676", "0.76700574", "0.7651133", "0.7597206", "0.75800353", "0.7568254", "0.7538184", "0.75228703", "0.7515832", "0.7498764", "0.74850684", "0.74850684", "0.7467648", "0.74488163", "0.7442...
0.0
-1
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, SmartDocumentRecognizerKvResult): return False return self.__dict__ == other.__dict__
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False", "def __eq__(self, other):\n if i...
[ "0.8088132", "0.8088132", "0.8054589", "0.7982687", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", ...
0.0
-1
Returns true if both objects are not equal
def __ne__(self, other): return not self == other
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True", "def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)", "def __ne__(self, other) -> bool:\n return not self.__eq__(other)", "def __eq__(self, other):\n ...
[ "0.845611", "0.8391477", "0.8144138", "0.81410587", "0.8132492", "0.8093973", "0.80920255", "0.80920255", "0.80920255", "0.8085325", "0.8085325", "0.8076365", "0.8076365", "0.8065748" ]
0.0
-1
Multi class version of Logarithmic Loss metric.
def multiclass_log_loss(y_true, y_pred, eps=1e-15): predictions = np.clip(y_pred, eps, 1 - eps) # normalize row sums to 1 predictions /= predictions.sum(axis=1)[:, np.newaxis] actual = np.zeros(y_pred.shape) n_samples = actual.shape[0] actual[np.arange(n_samples), y_true.astype(int)] =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_loss(self):\n probabilities = self.probability_array().copy()\n # need to flip the probabilities for p < 0.5 with this binary case.\n # 1 - old_val is same as oldval*-1 + 1. Do in 2 steps:\n probabilities[np.equal(0, self.y)] *= -1\n probabilities[np.equal(0, self.y)] +=...
[ "0.7211753", "0.6897029", "0.6878165", "0.67519027", "0.66347975", "0.6525428", "0.6510028", "0.64878744", "0.64682496", "0.6452781", "0.64294994", "0.64249194", "0.6417653", "0.6411695", "0.64109415", "0.6408834", "0.6394666", "0.6376997", "0.6347142", "0.6337753", "0.625644...
0.6180762
27
Only changeable constraint on the factory is the number of oscillators
def __init__(self, n): # this is equivalent to starting a random one self.n = n # From table S1 in the supplemental materials # each c parameters is [body,limb] self.cv0 = [0.3, 0.0] self.cv1 = [0.2, 0.2] self.cR0 = [0.196,0.131] self.cR1 = [0.065,0.131] #[[dbodylow,dbodyhigh],[dlimblow,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def circuitSat(C):", "def force(self, osc):\n pass", "def test_14_missing_nonbonded_handler(self, force_field):\n top = Molecule.from_smiles(\"CCCC\").to_topology()\n\n ff_no_vdw = copy.deepcopy(force_field)\n ff_no_electrostatics = copy.deepcopy(force_field)\n\n ff_no_vdw.de...
[ "0.5257939", "0.5219081", "0.5210399", "0.51840174", "0.5178341", "0.51490057", "0.5104576", "0.5071589", "0.5067967", "0.5032624", "0.50028354", "0.499776", "0.4982781", "0.49815163", "0.49683052", "0.4964372", "0.49502867", "0.49500018", "0.48942435", "0.48927838", "0.48829...
0.55693984
0
Converts things back into numpy
def deserialize(self, indv): for key in indv: if key in self.evolvables and not key in self.scalars: if not isinstance(indv[key], np.ndarray): indv[key] = np.array(indv[key]) return indv
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dataConvertToNumpy( self ):\n self.featureNumpy = np.asarray( self.feature )\n self.ClassNumpy = np.asarray( self.Class )", "def to_numpy(self, **kwargs):\n pass", "def to_numpy(x):\r\n return x.squeeze().detach().cpu().numpy()", "def to_numpy(x):\n if isinstance(x, list):\n ...
[ "0.7307521", "0.7142706", "0.7033888", "0.6991174", "0.6965739", "0.6851011", "0.68024766", "0.6748254", "0.67444295", "0.6721904", "0.66844344", "0.6681224", "0.6677446", "0.6631592", "0.66057754", "0.65985245", "0.6587741", "0.6528488", "0.6525603", "0.65188247", "0.6505604...
0.59111553
64
Randomly generates the parameters for a CPG
def make(self, ident, factor): CPG = {} CPG['ident'] = str(ident) # will not be updated during simulation CPG['w'] = np.random.rand(self.n * self.n) * factor # (n * n) for ind in range(self.n*self.n): if ind not in self.nonzeros: CPG['w'][ind] = 0 CPG['phi'] = np.random.rand(self.n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_params(self, randomize=True):\n pass", "def random():\n gauss_scale = 10**np.random.uniform(1, 3)\n lorentz_scale = 10**np.random.uniform(1, 3)\n cor_length_static = 10**np.random.uniform(0, 3)\n cor_length_dynamic = 10**np.random.uniform(0, 3)\n pars = dict(\n #backgrou...
[ "0.7374085", "0.6787519", "0.67266333", "0.65888166", "0.6582195", "0.65486234", "0.6505041", "0.63892645", "0.62967104", "0.6269808", "0.6220182", "0.61841", "0.6142248", "0.6137274", "0.60836434", "0.60771555", "0.60572374", "0.6054203", "0.6049343", "0.60028", "0.5997497",...
0.5695323
57
Because you can't refer to the current list in a list comprehension
def cumulative_sum(self, lis): new_list = [] for i in range(len(lis)): if i == 0: new_list.append(lis[i]) else: new_list.append(new_list[i-1] + lis[i]) return new_list
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _build_iterable(self):", "def iflatten(self):\n return _((e for es in self.array for e in es))", "def _loop_over(var):\n\n if hasattr(var,\"__iter__\"):\n return var\n else:\n return [var]", "def list_value(self) -> global___Expression.RepeatedValue:", "def demonstrate_list_c...
[ "0.6044748", "0.58948314", "0.5760046", "0.5743097", "0.57196575", "0.57158786", "0.5652399", "0.56166095", "0.5599128", "0.55789924", "0.55121166", "0.54547006", "0.54447865", "0.54377687", "0.5420903", "0.5420903", "0.5420903", "0.5420903", "0.54136294", "0.5407103", "0.539...
0.0
-1
Gets a random number, but makes sure it's not 1
def safe_rand(self): rand_n = np.random.rand() if rand_n == float(1): rand_n -= 1e-10 return rand_n
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def maybe(self):\n return random.getrandbits(1)", "def random_number():\n return random.randint(0, 9999)", "def random_number():\n random_num = random.choice(empty)\n return random_num", "def getRandom(self) -> int:", "def getRandom(self) -> int:", "def gen_unused_random_num(self):\n ...
[ "0.7610754", "0.73537326", "0.72561806", "0.7106875", "0.7106875", "0.7073731", "0.70407534", "0.70076555", "0.6958358", "0.6942665", "0.6919138", "0.6918378", "0.6899967", "0.68962634", "0.68693054", "0.68458706", "0.67763877", "0.675229", "0.675229", "0.6742172", "0.6728175...
0.7573157
1
Takes a list of cpgs (sorted from lowest fitness to highest) and mixes them into one. Note that crossover_prob is assumed to be sorted from lowest to highest and must sum to 1
def mix(self, cpgs, ident, method='avg', mutation_prob=0.5, crossover_prob=[0.5, 0.5]): # Available methods: # note that mutation means selecting a new random scalar for a particular value # avg -- takes the average of all of the keys in self.evolvables and then goes through all of their values and chooses ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _crossover(self, sel):\n offspring = []\n for p1, p2 in sel:\n p1 = copy.deepcopy(p1)\n p2 = copy.deepcopy(p2)\n\n tmp = self.op.crossover(\n copy.deepcopy(p1['individual']),\n copy.deepcopy(p2['individual']))\n if not tmp[...
[ "0.68679935", "0.65376526", "0.64644337", "0.63389164", "0.63024414", "0.6294254", "0.6285703", "0.6275384", "0.6211367", "0.61408365", "0.61313534", "0.6043319", "0.5995043", "0.5923218", "0.5911872", "0.58270127", "0.5813963", "0.5800146", "0.57875407", "0.5761791", "0.5756...
0.5951956
13
Test for login of registereduser
def test_login(self): with self.client: # user registration credentials = { 'username': 'EdwinKato', 'password': 'qwerty@123' } response = self.client.post('/api/v1/auth/login', data=json.dump...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_registered_user_login(self):\n # register a user\n register_user(self, 'some', 'name', 'another@gmail.com', 'aaaAAA111')\n\n # test logging in registered user\n with self.client:\n response = login_user(self, 'another@gmail.com', 'aaaAAA111')\n data = json...
[ "0.79693913", "0.7889857", "0.78656715", "0.77873445", "0.7646755", "0.7631561", "0.7569677", "0.7561159", "0.75429523", "0.7538628", "0.75328666", "0.75239885", "0.75087404", "0.75062454", "0.7505584", "0.7501152", "0.7411829", "0.7408641", "0.7408641", "0.7408641", "0.74086...
0.0
-1
Test for login of nonregistered user
def test_non_registered_user_login(self): with self.client: response = self.client.post( '/api/v1/auth/login', data=json.dumps({ "password": "qwerty@123", "username": "EdwinKyato" }), content_type...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_non_user_login(self):\n self.user.list_of_accounts = [{'username': 'Parseen',\n 'pwd': 'mypassword',\n 'email': 'david.parseen@yahoo.com'}]\n msg = self.user.login(\"nonuser@yahoo.com\", \"idontevenhaveone\")\n ...
[ "0.82027346", "0.80158097", "0.78653216", "0.7857918", "0.7857918", "0.7857918", "0.7857918", "0.7823152", "0.7721956", "0.7632311", "0.75731003", "0.7550225", "0.7539262", "0.75207067", "0.7428655", "0.7382271", "0.73642707", "0.73642707", "0.73642707", "0.73642707", "0.7362...
0.6747234
80
constructor initialize all footer panel elements
def __init__(self, commander_window): self.commander_window = commander_window self.font = QtGui.QFont(self) self.font.setBold(True) self.font.setWeight(75) self.setup_footer_panel()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_footer_panel(self):\r\n self.create_footer_push_button(\"F3 View\", \"F3\")\r\n self.create_footer_push_button(\"F4 Edit\", \"F4\")\r\n self.create_footer_push_button(\"F5 Copy\", \"F5\")\r\n self.create_footer_push_button(\"F6 move\", \"F6\")\r\n self.create_footer_pus...
[ "0.6983345", "0.6700082", "0.6700082", "0.65975446", "0.61720026", "0.59887004", "0.5947216", "0.5929559", "0.57196146", "0.57102317", "0.570946", "0.5708194", "0.5699149", "0.56370294", "0.5585587", "0.5581658", "0.55222774", "0.5504313", "0.54480815", "0.54113233", "0.53723...
0.5995883
5
This method is meant to create all the footer elements on this class used only from constructor
def setup_footer_panel(self): self.create_footer_push_button("F3 View", "F3") self.create_footer_push_button("F4 Edit", "F4") self.create_footer_push_button("F5 Copy", "F5") self.create_footer_push_button("F6 move", "F6") self.create_footer_push_button("F7 New Folder", "F7")...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def footer(self):\n pass", "def footer(self):\n pass", "def WriteFooter(self):\n return", "def writeFooter(self):\n pass", "def get_footer(self):\n self.footer = '</div>' \\\n '</div>' \\\n '</div>' \\\n '<div cla...
[ "0.7731519", "0.7731519", "0.73877597", "0.7227607", "0.71163267", "0.6826449", "0.6709397", "0.6580358", "0.6502539", "0.6416045", "0.63860506", "0.6339453", "0.63274145", "0.6317201", "0.6308385", "0.6304386", "0.6247864", "0.6222086", "0.614161", "0.6100365", "0.6100365", ...
0.6427684
9
This method will create a button into footer layout
def create_footer_push_button(self, text, shortcut=None, connection=None): button = QtGui.QPushButton(self.commander_window.footer_container) button.setFont(self.font) button.setText(text) if (shortcut is not None): button.setShortcut(shortcut) if connection is ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_footer_panel(self):\r\n self.create_footer_push_button(\"F3 View\", \"F3\")\r\n self.create_footer_push_button(\"F4 Edit\", \"F4\")\r\n self.create_footer_push_button(\"F5 Copy\", \"F5\")\r\n self.create_footer_push_button(\"F6 move\", \"F6\")\r\n self.create_footer_pus...
[ "0.7278086", "0.6899661", "0.6563083", "0.6563083", "0.6352914", "0.6226975", "0.6212638", "0.6148312", "0.6068258", "0.60441864", "0.6039494", "0.60364026", "0.6031277", "0.60041994", "0.5968427", "0.59683055", "0.59562105", "0.59323615", "0.5884248", "0.5879663", "0.5878796...
0.73384935
0
Shows all access requests that are waiting for approval.
def get(self): self.require_action_permitted('grant') q = model.Account.all().filter('requested_actions !=', None) requests = [] for account in q.fetch(100): for action in account.requested_actions: if check_action_permitted(self.account, 'grant'): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ListApprovalRequests(self, request, context):\n context.set_code(grpc.StatusCode.UNIMPLEMENTED)\n context.set_details(\"Method not implemented!\")\n raise NotImplementedError(\"Method not implemented!\")", "def list(self, request):\n\n to_approve_requests = Task.objects.filter(\n ...
[ "0.6685316", "0.66019034", "0.6032612", "0.59691817", "0.58465636", "0.5791276", "0.5645128", "0.562636", "0.5594557", "0.55650765", "0.55298376", "0.5490953", "0.5453304", "0.5444376", "0.5415444", "0.5356109", "0.5323455", "0.5323349", "0.5304046", "0.5287117", "0.52603364"...
0.62942934
2
Grants or denies a single request.
def post(self): action = self.request.get('action') if not action: raise ErrorMessage(404, 'missing action (requested_action) params') self.require_action_permitted('grant') account = model.Account.get(self.request.get('key')) if not account: raise Erro...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_everyone_denied(self):", "def denied_response(self, req):\n if req.remote_user:\n return HTTPForbidden(request=req)\n else:\n return HTTPUnauthorized(request=req)", "def _enforce(self, req, action):\n try:\n self.policy.enforce(req.context, action, ...
[ "0.6248997", "0.6164844", "0.61547506", "0.61528665", "0.6093935", "0.6086757", "0.6039381", "0.6008447", "0.6007422", "0.5984474", "0.59157324", "0.5846528", "0.5808597", "0.58016115", "0.57766014", "0.57766014", "0.5766336", "0.5743154", "0.57299995", "0.57168144", "0.57073...
0.5577951
33
Chain and apply a list of contexts
def nested(*contexts): with ExitStack() as stack: for ctx in contexts: stack.enter_context(ctx()) yield contexts
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def enrich_context(self, ctx: Context) -> Context:\n new_ctx = Context(ctx.expressions[:], ctx.namespace)\n for _ in range(self.expression_levels):\n new_ctx.extend(list(self.properties(new_ctx)))\n new_ctx.extend(list(self.unary_ops(new_ctx)))\n new_ctx.extend(list(s...
[ "0.6205127", "0.6081701", "0.5970155", "0.58488804", "0.57370806", "0.57311106", "0.5634332", "0.56243086", "0.56219083", "0.55781084", "0.55662006", "0.5537953", "0.5528676", "0.55269414", "0.5448107", "0.54284644", "0.541528", "0.541528", "0.5412888", "0.5401186", "0.534449...
0.6755412
0
Used to calculate the comoving distance to object at redshift z. Eqn 14 from Hogg, astroph/9905116.
def inv_efunc(z): return 1. / sqrt(omega_m * (1. + z)**3 + omega_lam)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Comoving_Distance(self, z):\n return self.cd_interp(z)", "def comoving_distance(self, z):\n\n # Calculate the integrand.\n def f(z1):\n return c_sl / self.H(z1)\n\n return _intf_0_z(f, z) / self._unit_distance", "def distcalc(z,h=0.70,omegalambda=0.7,omegam=0.3,omegak...
[ "0.6934687", "0.69317114", "0.6930934", "0.67977977", "0.6541344", "0.6534358", "0.6342927", "0.63420075", "0.6299687", "0.62785506", "0.6253984", "0.6174778", "0.6135191", "0.6090954", "0.6088764", "0.60628283", "0.60309136", "0.59934825", "0.5951465", "0.59276175", "0.59216...
0.0
-1
Returns True if filename1 has a newer modification time than filename2.
def is_newer(filename1, filename2): return os.stat(filename1).st_mtime > os.stat(filename2).st_mtime
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_newer(a, b):\n return os.stat(a).st_mtime >= os.stat(b).st_mtime", "def _newer(a: str, b: str) -> bool:\n if not os.path.exists(a):\n return False\n if not os.path.exists(b):\n return True\n return os.path.getmtime(a) >= os.path.getmtime(b)", "def file_is_modified(filename, lastu...
[ "0.8237509", "0.8148441", "0.80743307", "0.80290496", "0.79828465", "0.7979174", "0.79657996", "0.7751328", "0.77098334", "0.7662028", "0.75494844", "0.75325197", "0.7447955", "0.729623", "0.7292164", "0.7270774", "0.7239093", "0.69227624", "0.69209176", "0.69137496", "0.6862...
0.905768
0
Run SWIG if its outputs are missing or out of date.
def maybe_run_swig(wrapper_filename, module_name, base_directory, extra_deps=None): module_filename = 'python/bllipparser/%s.py' % module_name swig_filename = join(base_directory, 'swig', 'wrapper.i') extra_deps = extra_deps or [] if exists(wrapper_filename) and exists(module_filename...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compile_python(self):\n if(self.input == \"\"):\n stdout = subprocess.run(\n [\"python\", self.id+\".py\"], stdout=subprocess.PIPE).stdout.decode('utf-8')\n self.output = stdout\n if(len(stdout) == 0):\n self.output = subprocess.run(\n ...
[ "0.52748847", "0.5227529", "0.5040352", "0.50146484", "0.4976926", "0.4908266", "0.48579365", "0.4817482", "0.48093262", "0.4803266", "0.47972724", "0.47972095", "0.47310168", "0.47299778", "0.47203964", "0.4704658", "0.46845943", "0.46779928", "0.46702075", "0.4669818", "0.4...
0.5256493
1
Creates a new online controller.
def __init__(self, view: View, url: str, key: str, server_time_url: str, data_loader: DataLoader, data_writer: DataWriter, ai_class: str, ai_params): super().__init__(view) self.__url = url self.__key = key self.__server_time_url = server_time_url self.__data_lo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_controller() -> Controller:\n _controller = Controller()\n return _controller", "def create_controller(self, typ):\n return self.controller_objects[typ]()", "def garage_controller_create(self, name=None,\n driver=None, driver_info=None):\n location...
[ "0.74706405", "0.6701814", "0.6299631", "0.62110835", "0.61677057", "0.5994035", "0.5972941", "0.59482515", "0.5916179", "0.5785861", "0.5690907", "0.56186634", "0.56096566", "0.55698556", "0.55606925", "0.5510889", "0.5510889", "0.5509001", "0.5492552", "0.54767066", "0.5416...
0.0
-1
Create a FASTA header for a sequence in a otu DNA FASTA file downloadable from Virtool.
def format_fasta_entry(otu_name, isolate_name, sequence_id, sequence): return f">{otu_name}|{isolate_name}|{sequence_id}|{len(sequence)}\n{sequence}"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_header(args):\n header = os.path.join(args.output_dir,'header.sam')\n args.header = header\n header_handle = open(header,'w')\n header_handle.write('@HD\\tVN:1.4\\n')\n joined_sam = open(os.path.join(args.output_dir, 'watson_joinedAligned.out.sam'))\n merged_sam = open(os.path.join(args....
[ "0.69783336", "0.69290286", "0.6795281", "0.66700673", "0.6468582", "0.6380044", "0.634823", "0.62475306", "0.6224319", "0.6206568", "0.6201669", "0.6077374", "0.6075202", "0.6057273", "0.60009295", "0.5996821", "0.5993501", "0.5920932", "0.5891195", "0.5866044", "0.5844946",...
0.5927973
17
Format a FASTA filename of the form "otu.isolate.sequence_id.fa".
def format_fasta_filename(*args): if len(args) > 3: raise ValueError("Unexpected number of filename parts") if len(args) == 0: raise ValueError("At least one filename part required") filename = ".".join(args).replace(" ", "_") + ".fa" return filename.lower()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_filename(prefix, suffix, seq_len, uncased):\n seq_str = \"seq-{}\".format(seq_len)\n if uncased:\n case_str = \"uncased\"\n else:\n case_str = \"cased\"\n\n file_name = \"{}.{}.{}.{}\".format(prefix, seq_str, case_str, suffix)\n\n return file_name", "def format_filename(self, s):\n v...
[ "0.7300104", "0.67765343", "0.6772814", "0.6697145", "0.6529021", "0.6502655", "0.6502655", "0.6502655", "0.64751655", "0.6464903", "0.64495075", "0.6445141", "0.6358297", "0.62694526", "0.62530184", "0.62435997", "0.6228077", "0.6186597", "0.61775064", "0.6148595", "0.614143...
0.8101146
0
Generate a FASTA filename and body for the sequences associated with the isolate identified by the passed ``otu_id`` and ``isolate_id``.
async def generate_isolate_fasta(db, otu_id, isolate_id): _, isolate_name = await get_otu_and_isolate_names(db, otu_id, isolate_id) otu = await db.otus.find_one({"_id": otu_id, "isolates.id": isolate_id}, ["name", "isolates"]) fasta = list() async for sequence in db.sequences.find({"otu_id": otu_id, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def generate_sequence_fasta(db, sequence_id):\n sequence = await db.sequences.find_one(sequence_id, [\"sequence\", \"otu_id\", \"isolate_id\"])\n\n if not sequence:\n raise virtool.errors.DatabaseError(\"Sequence does not exist\")\n\n otu_name, isolate_name = await get_otu_and_isolate_names(d...
[ "0.69245267", "0.6894119", "0.5912291", "0.5337424", "0.51358384", "0.5091706", "0.5017148", "0.49292922", "0.490532", "0.4845423", "0.47710133", "0.47625893", "0.47573465", "0.4747771", "0.47446316", "0.47379455", "0.47282097", "0.47108236", "0.470876", "0.47039667", "0.4700...
0.8190999
0
Generate a FASTA filename and body for the sequence associated with the passed ``sequence_id``.
async def generate_sequence_fasta(db, sequence_id): sequence = await db.sequences.find_one(sequence_id, ["sequence", "otu_id", "isolate_id"]) if not sequence: raise virtool.errors.DatabaseError("Sequence does not exist") otu_name, isolate_name = await get_otu_and_isolate_names(db, sequence["otu_id...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_seq_file(seq_id, sequence, directory):\n f_fasta = open(directory + '/'+ seq_id + '.fasta', 'w')\n f_fasta.write(str(sequence))\n f_fasta.close()", "def generate_fasta(sequences, fasta_path):\n\n with open(fasta_path, 'w+') as f:\n for i in range(len(sequences)):\n f.write(...
[ "0.6654648", "0.5991678", "0.5893759", "0.55443513", "0.55410385", "0.5519095", "0.54996574", "0.5497378", "0.546989", "0.5423846", "0.54024166", "0.5382011", "0.5371277", "0.53569347", "0.53467464", "0.53463346", "0.52885425", "0.5284846", "0.52747065", "0.52720994", "0.5260...
0.7679342
0
Generate a FASTA filename and body for the sequences associated with the otu identified by the passed ``otu_id``.
async def generate_otu_fasta(db, otu_id): otu = await db.otus.find_one(otu_id, ["name", "isolates"]) if not otu: raise virtool.errors.DatabaseError("OTU does not exist") fasta = list() for isolate in otu["isolates"]: async for sequence in db.sequences.find({"otu_id": otu_id, "isolate...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def generate_sequence_fasta(db, sequence_id):\n sequence = await db.sequences.find_one(sequence_id, [\"sequence\", \"otu_id\", \"isolate_id\"])\n\n if not sequence:\n raise virtool.errors.DatabaseError(\"Sequence does not exist\")\n\n otu_name, isolate_name = await get_otu_and_isolate_names(d...
[ "0.683279", "0.6485399", "0.5569074", "0.5483403", "0.54582524", "0.54195255", "0.5392835", "0.53337544", "0.5320824", "0.5282094", "0.5202332", "0.51656145", "0.5165108", "0.51585346", "0.5126089", "0.5122553", "0.51130253", "0.50874543", "0.5049329", "0.49892703", "0.496523...
0.7690048
0
This function checks if a given number is a Nigerian phone number.
def is_Nigerian(args1): if len(args1) == 0: return "Invalid input!, input must not be empty." if (args1.isalnum() and not(args1.isnumeric())) or args1.isalpha(): return "Invalid Input!, input must be a string of numbers." #creating a matching pattern for nigerian numbers by making use of reg...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ni_number_check(number):\n ni_nuber = re.match(r\"^\\s*[a-zA-Z]{2}(?:\\s*\\d\\s*){6}[a-zA-Z]?\\s*$\", number)\n if ni_nuber:\n return True\n return False", "def is_phonenumber(number):\n\n phonenum = re.compile(r'^(\\d{3})-(\\d{3})-(\\d{4})$')\n if phonenum.match(number)...
[ "0.774606", "0.74679166", "0.69906837", "0.6815787", "0.65633965", "0.65529764", "0.64875734", "0.64522296", "0.6425909", "0.64103776", "0.63558793", "0.63498324", "0.6343741", "0.6288755", "0.6271888", "0.62652934", "0.6176938", "0.6169064", "0.61534375", "0.6152027", "0.612...
0.7525907
1
Should take the actor and the thing being used.
def test_init(self): user = object() used = object() a = Use(user, used) self.assertEqual(a.user, user) self.assertEqual(a.used, used)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def actor(self):\n raise NotImplementedError()", "def actor():\n return Actor()", "def is_actor():\n return False", "def is_actor(self):\n return True", "def act(self) -> None:\n pass", "def act(self):\n pass", "def test_actor_matches_activity(self):", "def act(self):\...
[ "0.6666154", "0.66368026", "0.6558715", "0.6442945", "0.6266615", "0.6225885", "0.60172606", "0.5948542", "0.56657785", "0.5661286", "0.5650924", "0.559296", "0.55888397", "0.5577099", "0.54633677", "0.5461658", "0.54506063", "0.5445267", "0.5445267", "0.5441684", "0.5418124"...
0.0
-1
Should call the .use method on used with user as the argument.
def test_call(self): user = object() used = Fake() called = [] used.use = lambda u: called.append(u) a = Use(user, used) a() self.assertEqual(called, [user], "Should have called used.use(user)")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_serve_user(self):\n pass", "def execute(self, user):\n pass", "def use(target, name):", "def use(self, target, name):\n return self.usable.use(target, name)", "def test_user(self):\n return True", "def test_func(self, user, **kwargs):\n return self.get_object()...
[ "0.65986025", "0.6208207", "0.6177418", "0.6163876", "0.6136552", "0.6130325", "0.6091194", "0.6085136", "0.6056721", "0.60412604", "0.6028056", "0.5941651", "0.58077157", "0.5778681", "0.57705474", "0.5755981", "0.5677145", "0.56585205", "0.5647163", "0.5641119", "0.56390595...
0.74292713
0
Test all functions parse.
def test_parses(func): quoting.parse_function(func)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_simple_parse(self):\n pass", "def main():\n\ttest() #test ParseError", "def test_parse(self): \n\n results = self.parser.parse()\n self.assertEqual(results, test_case_data['parse_output'])", "def test_basic_parsers():", "def test_parse_function_pass(self):\n def fun...
[ "0.73987454", "0.72671455", "0.7213445", "0.7200013", "0.7099595", "0.66740584", "0.6665561", "0.6617835", "0.65762043", "0.64718693", "0.6446804", "0.64256203", "0.6404218", "0.62964827", "0.6247", "0.62115675", "0.62110454", "0.6163633", "0.61307585", "0.6125878", "0.611448...
0.6957294
5
Test gradients of singleargument scalar functions.
def test_grad_unary(func, motion, optimized, preserve_result, a): utils.test_reverse_array(func, motion, optimized, preserve_result, a)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testNestedFunctionGradientCall(self):\n check_numerics_callback.enable_check_numerics()\n\n x = constant_op.constant(1.0 - 1e-8, dtype=dtypes.float32)\n\n @def_function.function\n def asinp1(x):\n # asin()'s gradient overflows at the value close to 1.0.\n return math_ops.asin(x) + 1.0\n\n...
[ "0.69838196", "0.62551624", "0.6240577", "0.6208231", "0.61972624", "0.61963433", "0.6193286", "0.6189036", "0.6149409", "0.60993594", "0.60622007", "0.6057781", "0.60543615", "0.6035959", "0.60253406", "0.6017511", "0.60147274", "0.5983582", "0.5977976", "0.59656", "0.595884...
0.64167225
1
Test gradients of twoargument scalar functions.
def test_grad_binary(func, motion, optimized, preserve_result, a, b): utils.test_reverse_array(func, motion, optimized, preserve_result, a, b)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testNestedFunctionGradientCall(self):\n check_numerics_callback.enable_check_numerics()\n\n x = constant_op.constant(1.0 - 1e-8, dtype=dtypes.float32)\n\n @def_function.function\n def asinp1(x):\n # asin()'s gradient overflows at the value close to 1.0.\n return math_ops.asin(x) + 1.0\n\n...
[ "0.7452785", "0.6717652", "0.6628295", "0.6502615", "0.6466579", "0.64543253", "0.63532865", "0.63481534", "0.6294409", "0.6281945", "0.62719196", "0.62702024", "0.6231899", "0.6228445", "0.6183046", "0.6182493", "0.61806935", "0.6167682", "0.61419064", "0.6122806", "0.611600...
0.6223911
14
Test gradients of threeargument scalar functions.
def test_grad_ternary(func, motion, optimized, preserve_result, a, b, c): utils.test_reverse_array(func, motion, optimized, preserve_result, a, b, c)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def grad_f3(x):\n pass", "def testNestedFunctionGradientCall(self):\n check_numerics_callback.enable_check_numerics()\n\n x = constant_op.constant(1.0 - 1e-8, dtype=dtypes.float32)\n\n @def_function.function\n def asinp1(x):\n # asin()'s gradient overflows at the value close to 1.0.\n re...
[ "0.6737468", "0.6493623", "0.6323118", "0.6316329", "0.6293697", "0.6276132", "0.6223059", "0.6057779", "0.5999899", "0.59681517", "0.59443873", "0.59325856", "0.59301656", "0.59234667", "0.5898176", "0.58958566", "0.58935535", "0.5885172", "0.5879116", "0.58456063", "0.58116...
0.5770117
25
Test gradients of vector functions.
def test_grad_vector(func, motion, optimized, preserve_result, x): utils.test_reverse_array(func, motion, optimized, preserve_result, x)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_numerical_gradient_vectorized(self):\n W, X, b, Y, expected_grad_W, expected_grad_b = vectorized_test_data()\n\n fn_to_optimize = lambda W: vectorized_loss(\n X, Y, W, b)\n grad_W = numerical_gradient(fn_to_optimize, W)\n np.testing.assert_allclose(grad_W, expected_g...
[ "0.70717275", "0.70420396", "0.6982868", "0.68923724", "0.6890963", "0.6879641", "0.6844028", "0.65803635", "0.6568304", "0.6504972", "0.6501379", "0.64940745", "0.64732254", "0.63941187", "0.63763016", "0.6368085", "0.6366209", "0.63571703", "0.6356648", "0.63120234", "0.630...
0.7636104
0
Test gradients of square matrix functions.
def test_grad_square_matrix(func, motion, optimized, preserve_result, sqm): utils.test_reverse_array(func, motion, optimized, preserve_result, sqm)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_grad(self):\r\n for shp0, shp1 in [((1,), (2,)),\r\n ((3,), (1,)),\r\n ((1,), (1,)),\r\n ((3,), (2,)),\r\n ((3, 2), (1, 1)),\r\n ((3, 2), (1, 4)),\r\n ...
[ "0.71215576", "0.6692214", "0.65100783", "0.6492603", "0.64668906", "0.6455008", "0.6402786", "0.64009535", "0.6388172", "0.6335372", "0.6319555", "0.6312385", "0.6283996", "0.62804395", "0.61972606", "0.6187361", "0.61780065", "0.61689115", "0.6151857", "0.613323", "0.613008...
0.77920055
0
Test gradients of functions with scalar and integer input.
def test_grad_binary_int(func, motion, optimized, preserve_result, a, n): utils.test_reverse_array(func, motion, optimized, preserve_result, a, n)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testNestedFunctionGradientCall(self):\n check_numerics_callback.enable_check_numerics()\n\n x = constant_op.constant(1.0 - 1e-8, dtype=dtypes.float32)\n\n @def_function.function\n def asinp1(x):\n # asin()'s gradient overflows at the value close to 1.0.\n return math_ops.asin(x) + 1.0\n\n...
[ "0.7141352", "0.65598017", "0.6515951", "0.6444053", "0.6311751", "0.6303223", "0.62829095", "0.62594473", "0.6215275", "0.62092286", "0.6166996", "0.6150048", "0.61389536", "0.6121117", "0.6120639", "0.61168426", "0.6020767", "0.598313", "0.59708667", "0.59692293", "0.596718...
0.5751722
45
Test gradients of functions with single tensor input.
def test_grad_unary_tensor(func, motion, optimized, preserve_result, t): tfe_utils.test_rev_tensor(func, motion, optimized, preserve_result, (0,), t)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testNestedFunctionGradientCall(self):\n check_numerics_callback.enable_check_numerics()\n\n x = constant_op.constant(1.0 - 1e-8, dtype=dtypes.float32)\n\n @def_function.function\n def asinp1(x):\n # asin()'s gradient overflows at the value close to 1.0.\n return math_ops.asin(x) + 1.0\n\n...
[ "0.75575894", "0.70530087", "0.70420367", "0.6837651", "0.67773134", "0.6739765", "0.6699057", "0.66702545", "0.66556704", "0.66472477", "0.6573843", "0.6523481", "0.649424", "0.6487613", "0.645774", "0.64325905", "0.643159", "0.6396742", "0.6388076", "0.63814676", "0.6348040...
0.68327725
4
Test gradients of reduction functions.
def test_grad_unary_reduction(func, motion, optimized, preserve_result, timage, boolean): tfe_utils.test_rev_tensor(func, motion, optimized, preserve_result, (0,), timage, boolean)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_gradient_convergence(self):\n pass", "def test_grad(self):\r\n for shp0, shp1 in [((1,), (2,)),\r\n ((3,), (1,)),\r\n ((1,), (1,)),\r\n ((3,), (2,)),\r\n ((3, 2), (1, 1)),\r\n ...
[ "0.73162276", "0.7096802", "0.6853156", "0.67028135", "0.6701313", "0.66994137", "0.6695083", "0.66722023", "0.66373664", "0.66370106", "0.65923834", "0.6569986", "0.65372443", "0.6479069", "0.64675087", "0.6438433", "0.6349279", "0.63451445", "0.6326558", "0.6315513", "0.631...
0.6766216
3
Test gradients of functions with binary tensor inputs.
def test_grad_binary_tensor(func, motion, optimized, preserve_result, t1, t2): tfe_utils.test_rev_tensor(func, motion, optimized, preserve_result, (0, 1), t1, t2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testNestedFunctionGradientCall(self):\n check_numerics_callback.enable_check_numerics()\n\n x = constant_op.constant(1.0 - 1e-8, dtype=dtypes.float32)\n\n @def_function.function\n def asinp1(x):\n # asin()'s gradient overflows at the value close to 1.0.\n return math_ops.asin(x) + 1.0\n\n...
[ "0.7174986", "0.69963866", "0.6909422", "0.6872271", "0.6760931", "0.6759554", "0.67556065", "0.6745516", "0.6740587", "0.67286974", "0.66507494", "0.6592925", "0.65785694", "0.65090275", "0.65043676", "0.6460004", "0.6445297", "0.64399576", "0.6439512", "0.6423145", "0.63291...
0.7402149
0
Test gradients of functions with binary matrix inputs.
def test_grad_matmul(func, motion, optimized, preserve_result, mat1, mat2, boolean1, boolean2): tfe_utils.test_rev_tensor(func, motion, optimized, preserve_result, (0, 1), mat1, mat2, boolean1, boolean2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_grad_binary(func, motion, optimized, preserve_result, a, b):\n utils.test_reverse_array(func, motion, optimized, preserve_result, a, b)", "def test_grad_binary_tensor(func, motion, optimized, preserve_result, t1, t2):\n tfe_utils.test_rev_tensor(func, motion, optimized, preserve_result, (0, 1),\n ...
[ "0.70167184", "0.6937823", "0.67399496", "0.67363566", "0.6702786", "0.67019135", "0.6695494", "0.66286254", "0.6604258", "0.6593175", "0.6582183", "0.65545446", "0.6515961", "0.64890236", "0.6457533", "0.64294976", "0.642394", "0.6420689", "0.6417929", "0.6411399", "0.638161...
0.6872022
2
Test gradients of functions with binary matrix inputs.
def test_grad_matmul_higherdim(func, motion, optimized, preserve_result, timage1, timage2, boolean1, boolean2): tfe_utils.test_rev_tensor(func, motion, optimized, preserve_result, (0, 1), timage1, timage2, boolean1, boolean2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_grad_binary(func, motion, optimized, preserve_result, a, b):\n utils.test_reverse_array(func, motion, optimized, preserve_result, a, b)", "def test_grad_binary_tensor(func, motion, optimized, preserve_result, t1, t2):\n tfe_utils.test_rev_tensor(func, motion, optimized, preserve_result, (0, 1),\n ...
[ "0.70167184", "0.6937823", "0.6872022", "0.67399496", "0.67363566", "0.6702786", "0.67019135", "0.6695494", "0.66286254", "0.6604258", "0.6593175", "0.6582183", "0.65545446", "0.6515961", "0.64890236", "0.6457533", "0.64294976", "0.6420689", "0.6417929", "0.6411399", "0.63816...
0.642394
17
Test gradients of functions with binary tensor inputs.
def test_grad_tensor_broadcast(func, motion, optimized, preserve_result, s, t): tfe_utils.test_rev_tensor(func, motion, optimized, preserve_result, (0, 1), s, t)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_grad_binary_tensor(func, motion, optimized, preserve_result, t1, t2):\n tfe_utils.test_rev_tensor(func, motion, optimized, preserve_result, (0, 1),\n t1, t2)", "def testNestedFunctionGradientCall(self):\n check_numerics_callback.enable_check_numerics()\n\n x = constant_...
[ "0.7404276", "0.71765655", "0.69961417", "0.6910999", "0.6869918", "0.6762966", "0.67546713", "0.6744153", "0.6739438", "0.6729621", "0.66494566", "0.6591663", "0.65795594", "0.6510418", "0.65035886", "0.64594465", "0.64457124", "0.6440613", "0.6439113", "0.6423183", "0.63270...
0.67602366
6
Test gradients of image functions.
def test_grad_image(func, motion, optimized, preserve_result, timage, tkernel, conv2dstrides): # TODO: Upgrade utils.py to allow simultaneous testing of uneven args. tfe_utils.test_rev_tensor(func, motion, optimized, preserve_result, (0,), timage, tkernel, conv2dstrid...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_gradient_convergence(self):\n pass", "def test_gradients(self):\n # Load from files.\n flow_ab = read_flow_file('pwcnet/warp/test_data/flow_ab.flo')\n img_b = read_image('pwcnet/warp/test_data/image_b.png', as_float=True)\n\n H = img_b.shape[0]\n W = img_b.shape...
[ "0.71023715", "0.6835922", "0.6640372", "0.6603771", "0.6524708", "0.65058905", "0.6494919", "0.63947445", "0.63629365", "0.63115203", "0.62794995", "0.6276175", "0.62534803", "0.62271285", "0.6223386", "0.6205185", "0.62044686", "0.6195168", "0.61621594", "0.6155193", "0.613...
0.7155387
0
Generator that iterates over an iterable in size chunks >>> list(chunks('ABCDEFG', size=3)) [('A', 'B', 'C'), ('D', 'E', 'F'), ('G',)] >>> list(chunks([1, 2, 3, 4, 5, 6], size=2)) [(1, 2), (3, 4), (5, 6)]
def chunks(iterable, size=20): stop = object() for chunk in recipes.grouper(size, iterable, fillvalue=stop): if chunk[-1] is stop: is_not_stop = functools.partial(operator.is_not, stop) yield tuple(itertools.takewhile(is_not_stop, chunk)) break yield chunk
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def chunks(iterator, size):\n for index in range(0, len(iterator), size):\n yield iterator[index:index + size]", "def iter_chunks(iterable, size):\n it = iter(iterable)\n while True:\n chunk = tuple(itertools.islice(it, size))\n if len(chunk) == 0:\n break\n yield ...
[ "0.84125316", "0.8280994", "0.8176167", "0.7985401", "0.7982482", "0.7932622", "0.78810847", "0.78195244", "0.78195244", "0.78195244", "0.7808499", "0.7795705", "0.77784157", "0.7770861", "0.7755475", "0.77362293", "0.7682972", "0.7598768", "0.7581873", "0.7565406", "0.755539...
0.0
-1
Drop Quasi Zero Features Returns a passed pandas DataFrame without columns containing too few nonzero values.
def drop_quasi_zero(df, thresh=0.05): drop_list = [] for el in df.columns.values: non_zero = df[el][df[el] != 0].shape[0] / df.shape[0] if non_zero < thresh: drop_list.append(el) print('Dropping column: {} | Non-zero values ratio: {}%'.format( el, round(10...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_zero_features(df,no_zeros = 1):\n thing = df.astype(bool).sum(axis=0) # number of nonzeros in each column\n idx = pd.Index(thing) #Index format\n location = idx.get_loc(no_zeros) # Set all elements that are 1.0 to True, rest to False.\n loc_of_one = np.asarray(np.nonzero(location)) #Array of...
[ "0.8001528", "0.6879542", "0.685985", "0.6835183", "0.6821461", "0.68055904", "0.67482245", "0.67280966", "0.6656785", "0.66356796", "0.6563634", "0.65300715", "0.6447803", "0.64278233", "0.64013696", "0.63996434", "0.6344614", "0.63372946", "0.63230413", "0.6318931", "0.6315...
0.77936864
1
Regularized Logarithmic Transformation Returns a logarithmic transformation that deals elegantly with very small positive values.
def log_trans(vec): m = vec[vec != 0] c = int(np.log(min(m))) d = 10 ^ c return np.log(vec + d) - c
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def logarithmic():\n return Equivalency(\n [(dimensionless_unscaled, function_units.dex, np.log10, lambda x: 10.0**x)],\n \"logarithmic\",\n )", "def transform(self, original_input):\n return super(LogarithmicDimension, self).transform(np.log(original_input))", "def safelog(x):\n #r...
[ "0.75638396", "0.7200353", "0.686215", "0.68412685", "0.6811226", "0.671013", "0.6648036", "0.64976794", "0.6454982", "0.6424051", "0.64047575", "0.638714", "0.63495034", "0.6339063", "0.6285992", "0.62852067", "0.62727803", "0.6262116", "0.62470746", "0.62452745", "0.6198531...
0.6616752
7
Drop Outliers by ZScore Deletes observations classified as outliers. The classification method analyzes if the observation is out of the established zscore bounds.
def drop_outliers_z_score(df, z=3): n_initial_rows = df.shape[0] drop_list = set() print('-' * 25) print('OUTLIERS DELETION: Z-SCORE METHOD\n') for el in df.columns.values: drop_list = drop_list | \ set(df[el][np.abs(df[el]-df[el].mean()) >= (z*df[el].std...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_outliers(self, data, sd_val):\n data = data.dropna()\n data = data[(np.abs(stats.zscore(data)) < float(sd_val)).all(axis=1)]\n return data", "def identify_and_handel_outliers(self):\n col_list = [] # This will hold the column names created for the administration of the modi...
[ "0.7309114", "0.7176904", "0.71419543", "0.7014585", "0.66157347", "0.66115505", "0.6607007", "0.6549644", "0.643559", "0.6377236", "0.6328624", "0.630123", "0.62695014", "0.6264223", "0.62510294", "0.6243806", "0.62305784", "0.6151706", "0.61425245", "0.61235154", "0.6117694...
0.7543709
0
Drop Outliers by Quantiles Deletes observations classified as outliers. The classification method analyzes if the observation is out of the established quantile bounds.
def drop_outliers_quantile(df, upper=0.99, lower=0): n_initial_rows = df.shape[0] drop_list = set() quant_upper = df.quantile(upper) quant_lower = df.quantile(lower) print('-' * 25) print('OUTLIERS DELETION: QUANTILE METHOD\n') for el in df.columns.values: drop_list = drop_list | \...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_outliers(data):\n upper_boundary = np.quantile(data, 0.992)\n lower_boundary = np.quantile(data, 0.008)\n selection = data[(data > lower_boundary) & (data < upper_boundary)]\n standard_dev = np.std(selection)\n median = np.median(selection)\n data[(median + 4.5 * standard_dev < data) |...
[ "0.7241458", "0.6982997", "0.6830516", "0.6804271", "0.6767851", "0.67002904", "0.6677959", "0.66053724", "0.65986574", "0.6532611", "0.65269667", "0.651718", "0.65114", "0.650066", "0.6455752", "0.6363624", "0.62836605", "0.62783426", "0.6254968", "0.61966586", "0.6195618", ...
0.73276263
0
Count Nan's Per Feature Returns a pandas DataFrame containing the absolute and percentual number of missing values per column. It can also show this information in a plot if show_plot=True.
def check_nan(df, show_plot=False): void = pd.DataFrame(np.sum(df.isna()), columns=['absolute']) void['percentage'] = round((void.absolute / df.shape[0]) * 100, 2) if show_plot: print('\n\n') plt.figure(figsize=(12, 5)) plt.plot(void.index.values, void.percentage.values, 'ro') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_nan_counts(data, cols, null_col_suffix=''):\n nulls_df = pd.DataFrame(pd.isnull(data[cols]).sum())\n nulls_df.columns = ['null_counts'+null_col_suffix]\n nulls_df['feature'] = nulls_df.index\n nulls_df.reset_index(inplace=True, drop=True)\n return nulls_df", "def nan_val_summary(df):\n ...
[ "0.76617587", "0.76107836", "0.7382069", "0.7363311", "0.7303697", "0.6956843", "0.6882129", "0.6876723", "0.672093", "0.6697947", "0.66910964", "0.66730636", "0.66213566", "0.6581595", "0.65028274", "0.6355325", "0.6343527", "0.6327267", "0.6289938", "0.62678796", "0.6197389...
0.7220725
5
Drop Quasi Null Features Returns a passed pandas DataFrame without columns containing too many Null values.
def drop_nan(df, perc=20): check = check_nan(df, show_plot=False) return df.drop(check[check.percentage > perc].index.values, axis=1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def data_cleaning(df):\n df = df.dropna(how='all')\n \n return df", "def df_cleaner(df):\n return df.dropna()", "def df_cleaner(df):\n df = df.dropna()\n return df", "def removeNull(self):\n self.data.dropna(axis=0, how='any')", "def remove_null_cols(df, thresh=0.08):\n \n # ...
[ "0.7871674", "0.7850133", "0.7708419", "0.7245343", "0.7152289", "0.71420413", "0.71229476", "0.706161", "0.6958182", "0.69297075", "0.69206834", "0.68892694", "0.6867685", "0.685136", "0.6831037", "0.6807297", "0.68061906", "0.6749607", "0.67389345", "0.6709776", "0.6659096"...
0.0
-1
Perform Automated Downsampling Returns a set of balanced x_train and y_train datasets for classification. As of now, it only works for binary classifications.
def downsampling(x_train, y_train, random_state=42): sampling = pd.concat([x_train, y_train], axis=1) big = sampling[y_train == y_train.value_counts().index[0]] small = sampling[y_train == y_train.value_counts().index[1]] downsampled = resample(big, replace=False, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _generate_data(self, x_data, y_data, max_seq_len, digits, seq_len,\n n_samples, use_one_hot, class_partition,\n upsample_control):\n # modify seq_len in case we do upsampling control\n if upsample_control:\n upsample_factor = seq_len\n ...
[ "0.64318675", "0.6423297", "0.6305304", "0.6246317", "0.6061455", "0.60597426", "0.6001533", "0.59941304", "0.596125", "0.59551734", "0.59408695", "0.5918505", "0.59173226", "0.5902152", "0.58708876", "0.5862264", "0.57767594", "0.5743646", "0.5723611", "0.5707372", "0.570502...
0.7455317
0
List Most Correlated Features Returns a pandas Series with the most correlated features to a certain target variable. The function will return features with a correlation value bigger than some threshold, which can be adjusted.
def corr_list(df, target, thresh=0.1, sort=True, fill=True): if fill: interest = df.corr().fillna(0)[target] else: interest = df.corr()[target] interest = interest[np.abs(interest) > thresh] if len(interest) > 0: if sort: return interest.sort_values(ascending=False) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_top_corr_features(self, feature_name):\n\n correlations = abs(self.train_correlations[feature_name][self.feature_names]) # abs!\n correlations.sort_values(ascending=False, inplace=True)\n return correlations.index[1:] # exlude itsself", "def remove_highly_correlated_vars_fast(df, cor...
[ "0.64598227", "0.64072794", "0.61176175", "0.60476017", "0.5959691", "0.5944587", "0.57532865", "0.56677884", "0.5658192", "0.56417507", "0.5623593", "0.558363", "0.5528225", "0.5513537", "0.54229397", "0.5422274", "0.541264", "0.53154373", "0.5312354", "0.52972484", "0.52403...
0.5943275
6
Cleaning of extra dots Deletes extra dots (thousands dot) in float values being represented as unprocessed strings.
def rm_dot(item): if len(str(item).split('.')) > 2: return item.replace('.', '', 1) else: return item
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_value(self, value):\n return float(value.replace('.', '').replace(',', '.'))", "def condense_floating_points(css):\n log.debug(\"Condensing all floating point values.\")\n return re.sub(r\"(:|\\s)0+\\.(\\d+)\", r\"\\1.\\2\", css)", "def replace_dot(data):\n data = re.sub(\"[.]\", \" ....
[ "0.7477636", "0.68418944", "0.65526754", "0.6344429", "0.6334262", "0.6282358", "0.62550396", "0.6232874", "0.62304324", "0.61961925", "0.6167261", "0.615144", "0.6147928", "0.6097535", "0.6063996", "0.5992138", "0.5967721", "0.5933247", "0.59322363", "0.591937", "0.5913577",...
0.64362913
3
Check categorical cardinality Checks the cardinality of categorical features of a given dataset. Returns two dictionaries, one for features with low cardinality and another for features with high cardinality. The low/high cardinality criteria can be tunned with the `threshold` parameter.
def check_cardinality(df, cat_cols, threshold=8): high_card = {} low_card = {} for col in cat_cols: rank = len(Counter(df[col])) if rank <= threshold: low_card[col] = rank else: high_card[col] = rank return low_card, high_card
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_counts(self, X: np.ndarray) -> Dict[int, np.ndarray]:\n return {f: np.bincount(X[:, f].astype(int), minlength=n_cat) for f, n_cat in\n self.categories_per_feature.items()}", "def test_cardinality(self):\n space = Space()\n probs = (0.1, 0.2, 0.3, 0.4)\n categor...
[ "0.60110897", "0.59391886", "0.58878255", "0.55651134", "0.5557575", "0.5502532", "0.5467048", "0.5462119", "0.5437828", "0.5422825", "0.540756", "0.53921795", "0.5321203", "0.530417", "0.5298471", "0.529479", "0.526825", "0.5265717", "0.52566886", "0.5253142", "0.52381426", ...
0.7394644
0
Perform OneHot Encoding Wrapper for perfoming OneHot Encoding on a set of categorical columns from a given DataFrame. The original categorical column is dropped. Good for encoding categorical features with low cardinality.
def one_hot_enc(df, ohe_cols): for col in ohe_cols: df_ohe = pd.get_dummies(df[col], preffix=col) df = pd.concat([df, df_ohe], axis=1) df.drop(col, axis=1, inplace=True) return df
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def onehot_enc(df, categorical_columns, categories):\n noncategorical_cols = [col for col in df.columns if col not in categorical_columns]\n \n enc = OneHotEncoder(categories=categories,\n sparse=False,\n handle_unknown='ignore')\n y = enc.fit_transform(df[...
[ "0.83821774", "0.8090642", "0.80746007", "0.80546844", "0.8051921", "0.7987664", "0.79627573", "0.7930709", "0.788882", "0.78858125", "0.7865726", "0.7839437", "0.78283674", "0.781988", "0.77600044", "0.7727394", "0.76851445", "0.7651386", "0.7616133", "0.76030165", "0.755102...
0.7897891
8
Perform Bniary Encoding Wrapper for perfoming Binary Encoding on a set of categorical columns from a given DataFrame. The original categorical columns are dropped. Good for encoding categorical features with high cardinality.
def binary_encoding(df, bin_cols): for col in bin_cols: enc = BinaryEncoder(cols=col) bin_enc = enc.fit_transform(df[col]) df = pd.concat([df, bin_enc], axis=1) df.drop(col, axis=1, inplace=True) return df
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encoding_df(df, cols):\n import pandas as pd\n df = df[cols]\n obj_df = df.select_dtypes(include=['object']).copy()\n num_var = df.select_dtypes(include=['int','float']).copy()\n cat_var = pd.get_dummies(obj_df, columns = obj_df.columns)\n encoded_df = pd.concat([num_var, cat_var], axis=1, so...
[ "0.7325643", "0.7214714", "0.71435875", "0.69621587", "0.6918023", "0.69116336", "0.6879287", "0.6841618", "0.68229026", "0.68160236", "0.6795417", "0.67443526", "0.6730028", "0.67107", "0.6649362", "0.65972847", "0.6576219", "0.65755546", "0.6571882", "0.6562026", "0.6538636...
0.7727909
0
Get sparse matrix of scores Returns a sparse score matrix of implicit Client > Product interactions. The scores are wightened by the correlation of each feature with the target feature. It is also possible to filter the values from the target feature we want to be considered in the building of the sparse matrix.
def get_corr_sparse_df(df, client_id, product_id, tgt_feature, tgt_filter=True, tgt_val=1): # Auxiliary tables declaration df_keys = df[[client_id, product_id, tgt_feature]] df_score = df.drop([client_id, product_id, tgt_feature], axis=1) # Calculating the score weight matrix, us...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_sparse(self):\n from divisi2.sparse import SparseMatrix\n return SparseMatrix(self, self.row_labels, self.col_labels)", "def analyze_sensitivity_sparse_grid(sparse_grid,max_order=2):\n from pyapprox.multivariate_polynomials import \\\n define_poly_options_from_variable_transformati...
[ "0.6489858", "0.63272566", "0.6297267", "0.61061746", "0.6096833", "0.5966724", "0.5915552", "0.58811307", "0.5846046", "0.5798666", "0.57851624", "0.5760531", "0.57405245", "0.5736884", "0.573338", "0.57287127", "0.5685769", "0.56659234", "0.56512487", "0.5630169", "0.561970...
0.7354125
0
Evaluate and perform dataset sclaing Evaluates if a given dataset needs scaling by checking the differences in the orders of magnitudes of its features. Also, can perform Robust Scaling, returning the transformed dataset.
def evaluate_for_scaling(df, transform=False, lower_quant=25, upper_quant=75): df_std_mean = df.mean().std() df_median_mean = df.mean().median() if df_std_mean > df_median_mean: if transform: # Scaling the features rsc = RobustScaler(quantile_range=(lower_quant, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def standardize_data(X_train, X_test):\n scaler = StandardScaler()\n scaler.fit(X_train)\n X_train = scaler.transform(X_train)\n # apply same transformation to test data\n X_test = scaler.transform(X_test)\n return X_train, X_test", "def X_scale_train_test(self, do_data=False):\n\n X_sca...
[ "0.67595345", "0.6736341", "0.6708757", "0.6693353", "0.66485626", "0.6570267", "0.6493276", "0.64883626", "0.64744467", "0.64196485", "0.63689077", "0.63577473", "0.63289684", "0.6326573", "0.6268254", "0.62646896", "0.62071", "0.6206559", "0.6201114", "0.6168693", "0.614723...
0.6680995
4
Determine Number of Principal Components Returns a PCAtransformed dataset with enough Principal Components to explain a certain amout of variability. Used for sparse datasets, leveraging the properties of the TruncatedSVD transformer from sklearn.
def explained_variability(df, threshold=0.95): # Using all components initially transf = TruncatedSVD(n_components=df.shape[1]-1, random_state=42).fit(df) s = pd.DataFrame(transf.explained_variance_ratio_, index=range(1, df.shape[1]), colum...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apply_PCA(data, ncomp):\n import sklearn.decomposition as dc\n \n pca = dc.PCA(n_components=ncomp, whiten=False, svd_solver='full')\n cps = pca.fit_transform(data)\n svl = pca.singular_values_\n return cps,pca,svl", "def do_pca(x_data, n_class):\n\n run_pca = decomposition.PCA(n_componen...
[ "0.706759", "0.6988584", "0.69768095", "0.6925743", "0.67113084", "0.66486746", "0.662425", "0.6620902", "0.65606546", "0.655598", "0.6546643", "0.65301853", "0.6490808", "0.64430857", "0.6430357", "0.64184636", "0.63982505", "0.6388121", "0.63843805", "0.6367074", "0.6322675...
0.0
-1
Returns object id for given address or None when unknown source
def lookup_object(self, address): obj_id = self.source_map.get(address) if not obj_id: # Register invalid event source if self.source_map: self.invalid_sources[address] += 1 return None return obj_id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def grab_external_id(stix_object, source_name):\n for external_reference in stix_object.get(\"external_references\", []):\n if external_reference.get(\"source_name\") == source_name:\n return external_reference[\"external_id\"]", "def getSourceForId(context, identifier):\n nearest = getat...
[ "0.66619503", "0.6295734", "0.62073255", "0.6147287", "0.6119063", "0.6066387", "0.600836", "0.6007095", "0.5943731", "0.58872235", "0.58872235", "0.58104545", "0.57378054", "0.57162756", "0.57081634", "0.57081634", "0.57081634", "0.568439", "0.568439", "0.568439", "0.568439"...
0.81914216
0
Spool message to be sent
def register_message(self, object, timestamp, data): self.perf_metrics["events_out"] += 1 self.messages += [{ "ts": timestamp, "object": object, "data": data }]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send(self, msg):\n pass", "def send(self, msg):\n pass", "def send(self, msg):\n pass", "def sendCommand(ser, msg):\n ser.write(\"%s\\r\\n\" % (msg))\n return", "def sendpm(self, the_id, msg):\r\n the_id = Client.touserid(the_id)\r\n self.tx_cmd(FCTYPE.PMESG, th...
[ "0.64589876", "0.64589876", "0.64589876", "0.6368447", "0.63330376", "0.6296989", "0.62598866", "0.6227509", "0.6222479", "0.6178442", "0.61577266", "0.6136637", "0.61044085", "0.61024183", "0.60762924", "0.6011487", "0.6005013", "0.600252", "0.6001607", "0.59993094", "0.5981...
0.0
-1
Periodic task to send collected messages to fmwriter
def send_messages(self): if self.messages: messages, self.messages = self.messages, [] self.mpub("events.%s" % config.pool, messages)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self):\n while True:\n try:\n sleep(influx_settings.write_freq)\n self._redis2influx()\n except InterruptExceptions as ex:\n raise ex", "def trigger_update(self):\n update_thread = Thread(target=self.process_queued_msg)\n ...
[ "0.613982", "0.61360604", "0.6054681", "0.6047653", "0.60263085", "0.6020203", "0.6016649", "0.5977986", "0.59506196", "0.5898428", "0.58631", "0.58552927", "0.5847367", "0.58328557", "0.5831154", "0.58268714", "0.5758967", "0.5752461", "0.5745754", "0.569751", "0.5676762", ...
0.6156687
0
Periodic task to request object mappings
def get_object_mappings(self): self.logger.debug("Requesting object mappings") sm = yield self.omap.get_trap_mappings(config.pool) if sm != self.source_map: self.logger.debug("Setting object mappings to: %s", sm) self.source_map = sm
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def task():", "def _schedule(self,task_dict):\n times = [time(), None, None, None] # (schedule timestamp, execution timestamp, stop timestamp, get timestamp)\n result_id = self._extract_features.remote(self, times) # calculation is started in new remote task \n task_dict[result_id] = self._i...
[ "0.61706334", "0.60808724", "0.58790255", "0.5862278", "0.5862278", "0.5748848", "0.5642705", "0.5589115", "0.55680954", "0.5532347", "0.5512871", "0.5512871", "0.5512871", "0.54854304", "0.54598445", "0.54582804", "0.5439082", "0.5416327", "0.54149127", "0.5397255", "0.53971...
0.0
-1
Report invalid event sources
def report_invalid_sources(self): if not self.invalid_sources: return total = sum(self.invalid_sources[s] for s in self.invalid_sources) self.logger.info( "Dropping %d messages with invalid sources: %s", total, ", ".join("%s: %s" % (s, self.invalid...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_sources_not_ok_on_connection_error(self):\n measurement = self.measurement(\n self.metric(),\n sources=[\n {\n \"source_uuid\": SOURCE_ID,\n \"value\": None,\n \"total\": None,\n \"parse...
[ "0.65968525", "0.64882016", "0.6418916", "0.6381476", "0.62577367", "0.5951416", "0.58868337", "0.57699937", "0.57269937", "0.56809556", "0.56666833", "0.5643618", "0.56132454", "0.55951136", "0.55816895", "0.5566584", "0.55154705", "0.5508068", "0.5502415", "0.5494327", "0.5...
0.758512
0
Add a list of items to the list of all library items
def add_items(self, library_items): for item in library_items: self._all_items.append(item)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_items(self, items):\n for item in items:\n self.add(item)", "def add_items(self, items):\n for item in items:\n self.addItem(item)\n # end for item in items", "def addItems(*args):", "def extend(self, items):\n\t\tfor item in items:\n\t\t\tself.append(item)"...
[ "0.76198214", "0.7341822", "0.7276178", "0.7267924", "0.71445847", "0.70814025", "0.706996", "0.70159686", "0.6767956", "0.6730525", "0.66963893", "0.66547024", "0.6601904", "0.65674746", "0.6306901", "0.6306901", "0.6306901", "0.6264611", "0.6227412", "0.62267005", "0.621254...
0.8472733
0
Remove a list of items from the catalog
def remove_items(self, library_items): for item in library_items: try: self._all_items.remove(item) except ValueError: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_items(todofile, items):\n for item in filter(lambda x: x.itemid in items, todofile.fetch_items()):\n todofile.remove_todo(item)", "def removeItem(*args):", "def removeItem(*args):", "def removeItems(c, items):\n\t\tcontainer.containersToSave[c['id_item_container']] = item.inventory.remov...
[ "0.7018876", "0.69360423", "0.69360423", "0.687769", "0.6809874", "0.67999625", "0.6712689", "0.66521966", "0.6628607", "0.66213995", "0.6594071", "0.6592304", "0.65764713", "0.6541679", "0.65117013", "0.65044403", "0.6392971", "0.62988776", "0.62521005", "0.62501127", "0.624...
0.6773232
6
Search for items and add any matching items to a list
def search_items(self, filter_text, type_filter=None): output = [] for item in self._all_items: if type_filter: if item.match(filter_text) and item.resource_type == type_filter: output.append(item) else: if item.match(filter_t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_items_to_find(self):\n self.items_to_find = ['sole', 'farina', 'innaffiatoio']", "def find_all_items(items: WebElements, value_list: List[str]=PARAMS_LEAGUES) -> WebElements:\n items_list = []\n for item in items:\n if any([True if word in item.text.lower() else False for word in valu...
[ "0.7003679", "0.635711", "0.58783317", "0.5858773", "0.58105254", "0.57913166", "0.573767", "0.5697082", "0.5669749", "0.5646335", "0.563685", "0.5634067", "0.5554156", "0.55335087", "0.55306315", "0.5501929", "0.5493303", "0.5480856", "0.5478738", "0.5444283", "0.5380661", ...
0.54567516
19
True/False whether the item is a match for the filter_text match should be case insensitive and should search all attributes of the class. Depending on the attribute, match requires an exact match or partial match. match needs to be redefined for any subclasses. Please see the note/notebook case study from Chapter 2 as...
def match(self, filter_text): return filter_text.lower() in self.name.lower() or \ filter_text.lower() == self.isbn.lower() or \ filter_text.lower() in (str(tag).lower() for tag in self.tags)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def match(self, filter_text):\n\n return filter_text.lower() in self.director.lower() or \\\n filter_text.lower() in self.actor.lower() or \\\n super().match(filter_text)", "def match(self, filter_text):\n\n return filter_text.lower() in self.artist.lower() or \\\n ...
[ "0.69324505", "0.6889434", "0.63976663", "0.63642013", "0.6214803", "0.5999873", "0.5973541", "0.5937157", "0.58969986", "0.589467", "0.58461", "0.58175755", "0.57801634", "0.5702319", "0.5633824", "0.5630518", "0.5629107", "0.5620056", "0.5602705", "0.5573345", "0.5557129", ...
0.66317177
2
Return a well formatted string representation of the item All instance variables are included. All subclasses must provide a __str__ method
def __str__(self): return f'Name: {self.name}\nISBN: {self.isbn}\nItem Type: {self.resource_type}\nTags: {", ".join(self.tags)}\n'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return str(self.item)", "def __repr__(self):\n return '<Item {0} : {1}>'.format(self.item_id, self.item_name)", "def __repr__(self):\n return '\\n<Item Code: =%s Item Name: =%s>' % (self.item_code, self.item_name)", "def __str__(self):\n\n return \"{}: {}\".fo...
[ "0.8661985", "0.8456193", "0.8331384", "0.83095175", "0.8259899", "0.8235929", "0.8235929", "0.8140813", "0.8089503", "0.80138934", "0.7948992", "0.7872446", "0.782787", "0.7735162", "0.7620142", "0.7596037", "0.7588032", "0.7571623", "0.75450194", "0.75450194", "0.75450194",...
0.8060703
9
Return a short string representation of the item String contains only the name of the item and the type of the item I.E. Moby Dick eBook All subclasses must provide a to_short_string method
def to_short_string(self): return f'{self.name} - {self.resource_type}'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return self._itemType", "def __str__(self):\n return str(self.item)", "def __str__(self):\n return f'Name: {self.name}\\nISBN: {self.isbn}\\nItem Type: {self.resource_type}\\nTags: {\", \".join(self.tags)}\\n'", "def __str__(self):\n return self.item_name", ...
[ "0.7117714", "0.7058652", "0.6880865", "0.6847068", "0.6796854", "0.6796854", "0.6796854", "0.67721087", "0.6702772", "0.66898733", "0.6665129", "0.6491782", "0.64446867", "0.64440036", "0.641076", "0.6404244", "0.6358782", "0.6358782", "0.62972945", "0.62821275", "0.6269284"...
0.68870425
2
Initialize a new book object
def __init__(self, name, isbn, author, tags=None): super().__init__(name, isbn, tags) self.author = author self.resource_type = "Book"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n self._book = Library.functions.new_()", "def __init__(self, bookAuthor, ISBN, numPurchased, bookTitle, numCheckedOut = 0, retailPrice = 0):\n\n self.bookAuthor = bookAuthor\n self.bookISBN = ISBN\n self.numberPurchased = numPurchased\n self.numberCheckedOu...
[ "0.7738984", "0.7383594", "0.73780483", "0.70157796", "0.69490784", "0.6875649", "0.68458223", "0.6771472", "0.6601914", "0.6483411", "0.6417341", "0.63756514", "0.6345037", "0.63199055", "0.626232", "0.62504995", "0.6247069", "0.6246545", "0.6223746", "0.62212014", "0.618638...
0.7439095
1
An extension of the match function in the base LibraryItem class. Also searches for the filter text in the author variable.
def match(self, filter_text): return filter_text.lower() in self.author.lower() or \ super().match(filter_text)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def match(self, filter_text):\n\n return filter_text.lower() in self.artist.lower() or \\\n super().match(filter_text)", "def match(self, filter_text):\n return filter_text.lower() in self.name.lower() or \\\n filter_text.lower() == self.isbn.lower() or \\\n filter_...
[ "0.682007", "0.6550258", "0.6416015", "0.63797086", "0.6266647", "0.59596294", "0.58739334", "0.58389205", "0.58080375", "0.5803565", "0.56252295", "0.5614221", "0.5611868", "0.5611807", "0.5606387", "0.5595165", "0.5577767", "0.5544993", "0.54778427", "0.5456448", "0.5431750...
0.7305958
0
Return a well formatted string representation of the item All instance variables are included. All subclasses must provide a __str__ method
def __str__(self): return super().__str__() + f'Author: {self.author}\n'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return str(self.item)", "def __repr__(self):\n return '<Item {0} : {1}>'.format(self.item_id, self.item_name)", "def __repr__(self):\n return '\\n<Item Code: =%s Item Name: =%s>' % (self.item_code, self.item_name)", "def __str__(self):\n\n return \"{}: {}\".fo...
[ "0.8661985", "0.8456193", "0.8331384", "0.83095175", "0.8259899", "0.8235929", "0.8235929", "0.8140813", "0.8089503", "0.8060703", "0.80138934", "0.7948992", "0.7872446", "0.782787", "0.7735162", "0.7620142", "0.7596037", "0.7588032", "0.7571623", "0.75450194", "0.75450194", ...
0.0
-1
Initialize a DVDMovie Item
def __init__(self, name, isbn, director, actor, tags=None): super().__init__(name, isbn, tags) self.director = director self.actor = actor self.resource_type = "DVD"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, C4Director, item_id):\n self.director = C4Director\n self.item_id = item_id", "def __init__(self, C4Director, item_id):\n self.director = C4Director\n self.item_id = item_id", "def __init__(self):\n # Item Dictionary (key: call number, value: Item object)\n...
[ "0.68161535", "0.68161535", "0.64105874", "0.63517463", "0.6327458", "0.63026476", "0.62970006", "0.6288919", "0.62316924", "0.62074465", "0.6139625", "0.6041508", "0.5999405", "0.59802437", "0.59486175", "0.5944403", "0.5904814", "0.58922637", "0.58280015", "0.5824133", "0.5...
0.5621799
46
An extension of the LibraryItem's match method. Also searches for filter text in the director and actor fields.
def match(self, filter_text): return filter_text.lower() in self.director.lower() or \ filter_text.lower() in self.actor.lower() or \ super().match(filter_text)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def match(self, item):", "def match(self, filter_text):\n\n return filter_text.lower() in self.artist.lower() or \\\n super().match(filter_text)", "def match(self, filter_text):\n\n return filter_text.lower() in self.author.lower() or \\\n super().match(filter_text)", "def...
[ "0.66584975", "0.66140664", "0.6375227", "0.62277186", "0.60852814", "0.5842212", "0.5810459", "0.58054554", "0.56884336", "0.56876177", "0.5668758", "0.5642446", "0.56119794", "0.56106514", "0.55795777", "0.55734146", "0.5569108", "0.5545362", "0.5492105", "0.5452527", "0.54...
0.7091767
0
Return a well formatted string representation of the item All instance variables are included. All subclasses must provide a __str__ method
def __str__(self): return super().__str__() + f'Lead Actor: {self.actor}\nDirector: {self.director}\n'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return str(self.item)", "def __repr__(self):\n return '<Item {0} : {1}>'.format(self.item_id, self.item_name)", "def __repr__(self):\n return '\\n<Item Code: =%s Item Name: =%s>' % (self.item_code, self.item_name)", "def __str__(self):\n\n return \"{}: {}\".fo...
[ "0.8661985", "0.8456193", "0.8331384", "0.83095175", "0.8259899", "0.8235929", "0.8235929", "0.8140813", "0.8089503", "0.8060703", "0.80138934", "0.7948992", "0.7872446", "0.782787", "0.7735162", "0.7620142", "0.7596037", "0.7588032", "0.7571623", "0.75450194", "0.75450194", ...
0.0
-1
Initialize a MusicCD item.
def __init__(self, name, isbn, artist, num_discs, tags=None): super().__init__(name, isbn, tags) self.artist = artist self.num_discs = num_discs self.resource_type = "Music CD"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, **kwargs):\n self.item = Item(**kwargs)\n self._working_dir = None", "def __init__(self):\n # Item Dictionary (key: call number, value: Item object)\n self.item_list = {}\n\n # Add some items manually for testing purposes.\n book1 = Book(\"In praise of...
[ "0.6313415", "0.62220263", "0.5928097", "0.58955693", "0.5831417", "0.5831417", "0.5783373", "0.5757864", "0.5751746", "0.5706846", "0.5677021", "0.5675513", "0.56697357", "0.56654", "0.5658594", "0.56570214", "0.56510967", "0.5628711", "0.5588841", "0.55882436", "0.55713534"...
0.6329616
0
An extension of the Library Item's match method. Also searches for the filter text in the artist variable
def match(self, filter_text): return filter_text.lower() in self.artist.lower() or \ super().match(filter_text)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def match(self, item):", "def find_artist(self):\n item = self.clementine_artists.currentItem()\n if not item:\n return\n self.artist_buffer = item\n search = item.text(0)\n self._parent.current_data = search\n if self.artist_map[item.text(0)]:\n ok...
[ "0.69125444", "0.6398688", "0.6256071", "0.6176387", "0.6136926", "0.61072534", "0.6032576", "0.6002995", "0.5977466", "0.59103507", "0.59099007", "0.58667594", "0.58499247", "0.58097106", "0.5808899", "0.5755709", "0.569537", "0.5620561", "0.5617918", "0.5600141", "0.5568909...
0.74232924
0
Return a well formatted string representation of the item All instance variables are included. All subclasses must provide a __str__ method
def __str__(self): return super().__str__() + f'Recording Artist: {self.artist}\nNumber of Discs: {self.num_discs}\n'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return str(self.item)", "def __repr__(self):\n return '<Item {0} : {1}>'.format(self.item_id, self.item_name)", "def __repr__(self):\n return '\\n<Item Code: =%s Item Name: =%s>' % (self.item_code, self.item_name)", "def __str__(self):\n\n return \"{}: {}\".fo...
[ "0.86619437", "0.8456832", "0.83310175", "0.83086365", "0.8260541", "0.8235759", "0.8235759", "0.81405205", "0.8088825", "0.8059674", "0.8013039", "0.79483455", "0.78710866", "0.78280276", "0.77361995", "0.7619677", "0.7594185", "0.75878334", "0.7569862", "0.75448054", "0.754...
0.0
-1
BFS using a for loop
def cloneGraph2(self, node): if not node: return None cloned = {} queue = [node] for original_node in queue: if original_node.label not in cloned: cloned[original_node.label] = UndirectedGraphNode(original_node.label) for neighbor in original_node.neighbors: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bfs_iterative(graph,start):\n\tvisited = set()\n\twatched = set()\n\tnodes_queue = [start] # List that helps as queue\n\twatched.add(start)\n\t\n\twhile nodes_queue:\n\t\tcurrent_node = nodes_queue.pop(0)\n\n\t\tprint(\"visiting\",current_node)\n\t\tvisited.add(current_node)\n\t\t\n\t\tfor adjacent_node in gra...
[ "0.7547011", "0.739157", "0.7352518", "0.73296833", "0.72997516", "0.7285272", "0.72228265", "0.7205614", "0.7166409", "0.7165715", "0.71539867", "0.710455", "0.70918494", "0.70626235", "0.7026808", "0.7024267", "0.7004307", "0.6999509", "0.698091", "0.69739", "0.6968559", ...
0.0
-1
Check whether the input string is a valid JSON
def is_json(json_str: str) -> bool: try: json.loads(json_str) except ValueError: return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_correct_json(string):\n if len(string) == 0:\n return False\n\n if string[0] is not '{' and string[0] is not '[':\n return False\n\n try:\n json.loads(string)\n except ValueError:\n return False\n\n return True", "def __valid_json(string):\n try:\n ...
[ "0.88037795", "0.87745696", "0.8589823", "0.8078066", "0.7820956", "0.78165317", "0.74995846", "0.7473835", "0.74669105", "0.7455147", "0.73179656", "0.7150155", "0.6894489", "0.6852388", "0.68200266", "0.67260844", "0.6717202", "0.66565275", "0.6613865", "0.6610069", "0.6563...
0.84249747
3
Get Config setting from predefined variables or environment parameters.
def init_config_values(): global HEADER, PROCESS_PROGRAM_NAME, METADATA_HANDLE_EVENT_NAME global APPINSIGHTS_INSTRUMENTATIONKEY global DATABRICKS_OUTPUT_STORAGE_ACCOUNT_URL, DATABRICKS_OUTPUT_STORAGE_SAS_TOKEN global ADX_INGEST_QUEUE_URL_LIST, ADX_INGEST_QUEUE_SAS_TOKEN global CONCURRENT_ENQUEUE_TAS...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_config(setting, config=CONFIG):\n try:\n return config[setting]\n except KeyError:\n raise ImproperlyConfigured(\"Set the {} setting\".format(setting))", "def get_config(config):\n global _config\n return _config", "def get_config():\n return CONFIG", "def get_config_var(...
[ "0.7611529", "0.7403772", "0.73666954", "0.73517406", "0.7271565", "0.7270964", "0.724717", "0.71440154", "0.71114945", "0.7067627", "0.70576876", "0.70354825", "0.70275337", "0.6970136", "0.69563943", "0.6925892", "0.6882713", "0.6837568", "0.68029976", "0.6720337", "0.67193...
0.0
-1
download blob file content as string
def get_blob_content(container_name: str, blob_path: str) -> str: global BLOB_SERVICE_CLIENT # TODO: Should add retry policy here if not BLOB_SERVICE_CLIENT: logging.info( f"{HEADER} Initialize blob service client for {DATABRICKS_OUTPUT_STORAGE_ACCOUNT_URL}") BLOB_SERVICE_CLIENT ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def blob_download(blob_url):\n blob = storage.Object.from_url(blob_url)\n blobc = blob.download()\n return blobc", "def download_blob(bucket_name, source_blob_name):\n storage_client = storage.Client()\n\n bucket = storage_client.bucket(bucket_name)\n blob = bucket.blob(source_blob_name)\n r...
[ "0.7356397", "0.6980018", "0.6911951", "0.68267864", "0.6805651", "0.6737355", "0.6728277", "0.66589123", "0.65999615", "0.65836155", "0.6581424", "0.658025", "0.6546602", "0.6525553", "0.65234154", "0.65129626", "0.6471623", "0.6471", "0.64411074", "0.64331", "0.6397154", ...
0.6978253
2
Shrink (reduce size) checkpoint files size
def get_shrinked_checkpoint_content(content, lines_to_keep)->str: i = 0 original_lines = content.splitlines() newlines = [] for line in reversed(original_lines): if i < lines_to_keep: newlines.append(line) i += 1 else: break #reached max lines to kee...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shrink_file(in_filepath, api_key=None, out_filepath=None):\n info = get_shrink_file_info(in_filepath, api_key, out_filepath)\n write_shrunk_file(info)\n return info", "def check_size():\n\n if os.path.getsize(config['LOG_PATH']) > config['LOG_MAXSIZE']:\n os.remove(config['LOG_PATH'])", ...
[ "0.58451694", "0.5770589", "0.5551063", "0.55098546", "0.5465791", "0.5463636", "0.53963625", "0.5392331", "0.537304", "0.5330672", "0.5321509", "0.5310033", "0.53080124", "0.5300658", "0.5292845", "0.5289114", "0.52819055", "0.5275576", "0.5267911", "0.52384543", "0.5223316"...
0.0
-1
update blob file by replace existing file
def update_blob_content(container_name: str, blob_path: str, content: str): global BLOB_SERVICE_CLIENT if not BLOB_SERVICE_CLIENT: logging.info( f"{HEADER} Initialize blob service client for {DATABRICKS_OUTPUT_STORAGE_ACCOUNT_URL}") BLOB_SERVICE_CLIENT = BlobServiceClient(DATABRICK...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_record_update_file(appctx, db, record_with_file_processed, obj_name, content):\n record = CernSearchRecord.get_record(record_with_file_processed.id)\n initial_file_name = \"hello.txt\"\n initial_file = record.files[initial_file_name].obj # type: ObjectVersion\n initial_file_content = record.f...
[ "0.6568326", "0.65407366", "0.6406529", "0.6354509", "0.6352969", "0.61979395", "0.61885375", "0.61471003", "0.6096474", "0.60016054", "0.599357", "0.5979346", "0.5972336", "0.5951576", "0.5928227", "0.58855575", "0.58786947", "0.5861474", "0.58392084", "0.58236605", "0.57857...
0.60457766
9
Convert the abfss path to https path style
def convert_abfss_path_to_https(abfss_path: str) -> str: pattern = r'abfss:\/\/([^@]+)@([^.]+)[^\/]+\/(.+)' regex = re.compile(pattern) match = regex.search(abfss_path) if not match: raise ValueError(f"Invalid abfss path {abfss_path}") container = match.group(1) storage_account = match.g...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def https(url):\n if url[:8] == 'https://':\n return url\n if url[:7] != 'http://':\n return False\n return 'https://' + url[7:]", "def path_ssl(self):\n return HOMEASSISTANT_SSL.format(HASSIO_SHARE_INT)", "def convertToURL( cPathname ):\n if len( cPathname ) > 1:\n if c...
[ "0.62642324", "0.61140555", "0.61136925", "0.6104507", "0.609913", "0.6059806", "0.6051831", "0.6046826", "0.60012305", "0.59881335", "0.5960421", "0.5948716", "0.59205675", "0.59025985", "0.5899939", "0.5899413", "0.5885915", "0.5857693", "0.584945", "0.5841724", "0.57719195...
0.73538405
0
Generate queue messages from Databricks ouutput metadata file content
def generate_metadata_queue_messages(event_time: str, metadata_file_content: str) -> List[str]: ingest_queue_msg_list = [] current_part_num = 100000 #Max part number global MAX_COMPACT_FILE_RECORDS for line in reversed(metadata_file_content.splitlines()): logging.info(f"{HEADER} Processing meta...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gen_metadata_msg_enqueue_tasks(queue_msg_list: List[str],\n queue_client_list: List[QueueClient],\n tc: TelemetryClient) -> None:\n\n tasks = []\n for idx, queue_msg in enumerate(queue_msg_list):\n output_obj = json.loads(queue_ms...
[ "0.64029324", "0.59525144", "0.5745095", "0.55602175", "0.5504239", "0.54586256", "0.5446348", "0.5404002", "0.5401268", "0.5355826", "0.53395224", "0.52417713", "0.5229069", "0.52107525", "0.51790047", "0.51555395", "0.5095745", "0.5088324", "0.50780344", "0.50593895", "0.50...
0.7086968
0
Async to send messages to storage queue
async def send_queue_messages(queue_client, base64_message, queue_msg): try: await queue_client.send_message(base64_message) except Exception: # pylint: disable=bare-except logging.exception(f"{HEADER} Failed to send message {queue_msg} to queue") # Raise exception to let azure function ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def send(self):", "async def send(self, message):", "def send_msg(self, my_queue, my_msg):", "def async(self, *args, **kwargs):\n uid = str(uuid.uuid4())\n message = {\n 'uid': uid,\n 'name': self.name,\n 'args': self.serializer.serialize(args),\n ...
[ "0.7073917", "0.6974844", "0.68638635", "0.6803254", "0.67270863", "0.6582076", "0.6537732", "0.6507097", "0.64683974", "0.64622647", "0.6417503", "0.63880336", "0.6262368", "0.6172687", "0.6127086", "0.6076321", "0.6046184", "0.60391587", "0.6025878", "0.60185766", "0.597763...
0.6072268
16
Send queue messages to target queues
def gen_metadata_msg_enqueue_tasks(queue_msg_list: List[str], queue_client_list: List[QueueClient], tc: TelemetryClient) -> None: tasks = [] for idx, queue_msg in enumerate(queue_msg_list): output_obj = json.loads(queue_msg) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_msg(self, my_queue, my_msg):", "def send_command_queue(self, command_queue):\n for command in command_queue:\n self._send_string(command)\n\n self._done_sending()", "def send_command_queue(self, command_queue):\n for command in command_queue:\n self._send_str...
[ "0.7450541", "0.72386956", "0.72386956", "0.71769816", "0.6649021", "0.6503821", "0.6503487", "0.6501781", "0.6476404", "0.64479864", "0.64465857", "0.6426796", "0.6396762", "0.63950366", "0.6379228", "0.62869745", "0.6278462", "0.62457585", "0.62373036", "0.619211", "0.61710...
0.0
-1
limit the concurrent tasks with semaphore
async def gather_with_concurrency(n, tasks): semaphore = asyncio.Semaphore(n) async def sem_task(task): async with semaphore: await task await asyncio.gather(*(sem_task(task) for task in tasks))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_ripe_request_tokens(sema: mp.Semaphore, limit: int, finish_event: threading.Event):\n logger.debug('generate thread started')\n while not finish_event.is_set():\n time.sleep(2 / limit)\n try:\n sema.release()\n sema.release()\n except ValueError:\n ...
[ "0.6282102", "0.6080879", "0.60440874", "0.59983575", "0.59436536", "0.5899353", "0.5844908", "0.5839281", "0.5807662", "0.573292", "0.571161", "0.566539", "0.5640771", "0.55995965", "0.5567172", "0.55225784", "0.5494984", "0.5481205", "0.54737425", "0.539674", "0.53499925", ...
0.6391296
0
Close queue clients connection
def close_queue_clients(queue_client_list: List[QueueClient], loop: asyncio.AbstractEventLoop): client_close_tasks = [] for client in queue_client_list: close_task = asyncio.ensure_future(client.close()) client_close_tasks.append(close_task) loop.run_until_complete(gather_with_concurrency(1,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _close_clients(self):\n for client in self.clients:\n client.close()", "def closeConnecetion(self):\n client.close()", "def close(self):\n for conn in self._conns:\n conn.send((self.CLOSE,()))", "def __close_connection_with_clients(self):\n for current_client in self._...
[ "0.74559975", "0.74452204", "0.7294628", "0.7047551", "0.6944966", "0.677886", "0.6763271", "0.6743381", "0.67432", "0.67000616", "0.6695658", "0.6674143", "0.66615736", "0.66608673", "0.6640044", "0.6629691", "0.66181344", "0.6616973", "0.66131306", "0.6568658", "0.6536984",...
0.74610734
0
Main function, triggered by Azure Storage Queue, parsed queue content and try to download the databricks output metadata file to get each succefully processed file location. Then enqueue to ingest queue for ingestion to ADX on later Azure function. If the file is checkpoint compact file, the code will shrink the file s...
def main(msg: func.QueueMessage) -> None: code_start_time = time.time() logging.info('Python queue trigger function processed a queue item: %s', msg.get_body().decode('utf-8')) # modify the log level of azure sdk requests logging.getLogger('azure').setLevel(logging.WARNING) init_con...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_metadata_queue_messages(event_time: str, metadata_file_content: str) -> List[str]:\n ingest_queue_msg_list = []\n current_part_num = 100000 #Max part number\n global MAX_COMPACT_FILE_RECORDS\n\n for line in reversed(metadata_file_content.splitlines()):\n logging.info(f\"{HEADER} Pro...
[ "0.6682282", "0.6162708", "0.6032964", "0.5799686", "0.5781316", "0.5746755", "0.5729667", "0.57098687", "0.5676677", "0.5572735", "0.5548825", "0.5534193", "0.55331063", "0.55202967", "0.55051416", "0.5490857", "0.5485531", "0.54404837", "0.54099286", "0.5386266", "0.5369767...
0.7072427
0
Parse Text file and yield 1 line at a time.
def parse_text_file(file_path): with open(file_path, 'r') as f: for line in f: line = line.rstrip() if not line: continue yield line
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def txt_line_iterator(path):\n with tf.io.gfile.GFile(path) as f:\n for line in f:\n yield line.strip()", "def parse(self, f):\n \n for line in f:\n self.parse_line(line)", "def _gen_txt_data(self, f):\n\t\treader = iter(f)\n\n\t\tfor line_num, line in enumerate(reader):\n\t\t...
[ "0.7017607", "0.66851646", "0.6601368", "0.6538029", "0.64616096", "0.64355737", "0.64092755", "0.6401797", "0.63687634", "0.6289389", "0.6269863", "0.62646693", "0.6264008", "0.6262496", "0.6234503", "0.62180173", "0.6187032", "0.6181076", "0.6180821", "0.6168177", "0.616333...
0.75814044
0
Import a data set, as its origin data points, in shape of
def fit(self, data): self.data = data self._not_included = data if self._expected_area == -1: self._expected_area = int(len(data) ** 0.5) pass self._x_extends = [data[0]['x'], data[0]['x']] self._y_extends = [data[0]['y'], data[0]['y']] self._value...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def import_dataset(fpath):\r\n data = read_csv(fpath)\r\n print(data.head())\r\n print(data.shape)\r\n return data", "def read_data_set():\n # shapes of datasets -- [] means expanded form:\n # - X: J\n # - net.R: J [x J x 1]\n # - F_DIST: J x J x num_features\n # - F_DIST_w1: J x J x n...
[ "0.6362504", "0.6320649", "0.62760663", "0.6209483", "0.60866785", "0.6017939", "0.5989352", "0.59728557", "0.59344363", "0.59291804", "0.5890433", "0.5882488", "0.58824617", "0.58749497", "0.5872966", "0.58425945", "0.58192444", "0.5801761", "0.5795395", "0.57905436", "0.578...
0.0
-1
Gather all points in some autogrowing areas
def _cluster(self): self._not_included = self.data self.leaves = [] flag = int(rand() * len(self.data)) flag = self._generate(flag) while len(self._not_included) > 0: flag = self._generate(flag) if flag == -1: break pass ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def grid_points(self):\n for i in range(self.rows):\n for j in range(self.cols):\n min_lat,max_lat,min_lon,max_lon = self.coords_to_min_max_lat_lon((i,j))\n if i == 0:\n print_gps(max_lat,max_lon,\"grid\")\n if j == 0:\n ...
[ "0.60352486", "0.60089654", "0.5957634", "0.57922155", "0.5735454", "0.56912833", "0.5677051", "0.5659202", "0.5644068", "0.5619629", "0.5581817", "0.55763596", "0.5568444", "0.5551165", "0.55458266", "0.55394226", "0.55220485", "0.5515554", "0.55153877", "0.55147487", "0.551...
0.0
-1
Generator of a new area
def _generate(self, center_idx): center = self._not_included[center_idx] area = [center] others = [] for i in range(len(self._not_included)): if i == center_idx: continue candidate = self._not_included[i] dis_geo = ((center['x'] - candi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def area(self):", "def area(self):\n ...", "def __areas_to_pool(self, region_width, region_height, region_width_step, region_height_step):\n \n areas = [[(width_ind * region_width_step, height_ind * region_height_step,\n (width_ind + 1) * region_width_step if (width_ind + 1) ...
[ "0.7147663", "0.6909164", "0.65530187", "0.63511145", "0.61740553", "0.6143072", "0.6023134", "0.6012145", "0.6012145", "0.6009092", "0.5989456", "0.59823465", "0.59821725", "0.5962189", "0.5962189", "0.5938174", "0.593229", "0.5910889", "0.5910889", "0.5908722", "0.5890229",...
0.5819086
22
Find a suitable binarytree structure
def linkage(self): self.tree = {} un_linked = [] for i in range(len(self.leaves)): leaf = self.leaves[i] un_linked.append({ 'id': i, 'x': 0, 'y': 0, 'value': 0, 'set': leaf, 'c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def binary_search_tree_run():\n\n # no need for Tree object as the Tree itself is a concept; its made of connected nodes\n # nodes are the object; connections are self contained\n\n def binary_insert(root, node):\n if root is None:\n root = node\n else:\n if root.data >...
[ "0.6735971", "0.6530564", "0.62307024", "0.61076456", "0.6053023", "0.5996912", "0.59570765", "0.59391767", "0.592461", "0.5840478", "0.5802106", "0.5735963", "0.5731404", "0.5731134", "0.5724618", "0.57046956", "0.56911415", "0.5674273", "0.56437874", "0.56290257", "0.560675...
0.0
-1
Run the c++ unit tests. This runs a subprocess because the HDF5 used by h5py clashed with the HDF5 linked to the c++ unit tests on some systems. h5py is used by some XDMF tests.
def run_cpp_unit_tests(): # We set cwd in case the script is run from another directory. This is needed # when testing from the core. out_bytes = subprocess.check_output( ['python3', 'run_cpp_unit_tests.py'], cwd=abspath(dirname(__file__))) return out_bytes.decode('utf-8')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __main() :\n launchTests()", "def test(c, index=0):\n exec_path = f'{ROOT_DIR}/gem5/build/GCN3_X86/gem5.opt' \n conf_path = f'{ROOT_DIR}/gem5/configs/example/apu_se.py'\n test_dir = TEST_PATHS[index]\n print(f'Testing {test_dir}...')\n \n # Try to find executable\n try_paths = [os.pat...
[ "0.6613631", "0.6581835", "0.6549095", "0.64722", "0.6412084", "0.63910145", "0.6268595", "0.62387437", "0.618074", "0.6167369", "0.61670023", "0.6159595", "0.61505693", "0.61311626", "0.61168665", "0.60939276", "0.6077586", "0.6045904", "0.60249716", "0.6006832", "0.6001748"...
0.67698425
0