query
stringlengths
9
9.05k
document
stringlengths
10
222k
metadata
dict
negatives
listlengths
30
30
negative_scores
listlengths
30
30
document_score
stringlengths
4
10
document_rank
stringclasses
2 values
Return indices of cat1 (e.g., DR3) and cat2 (e.g., DEE2) cross matched to tolerance.
def crossmatch_cat1_to_cat2(ra1, dec1, ra2, dec2, tol=1./(deg2arcsec+1e-12)): # Match cat1 to cat2 using astropy functions. idx_cat1_to_cat2, d2d = match_cat1_to_cat2(ra1, dec1, ra2, dec2) # Indicies of unique cat2 objects that were matched. cat2matched = np.unique(idx_cat1_to_cat2) # For each cat2 object ma...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def crossmatch_cat1_to_cat2(ra1, dec1, ra2, dec2, tol=1./(deg2arcsec+1e-12)):\n \n # Match cat1 to cat2 using astropy functions.\n idx_cat1_to_cat2, d2d = match_cat1_to_cat2(ra1, dec1, ra2, dec2)\n \n # Indicies of unique cat2 objects that were matched.\n cat2matched = np.unique(idx_cat1_to_cat2)...
[ "0.7273517", "0.7074182", "0.6868919", "0.63668644", "0.5824827", "0.5761797", "0.57361114", "0.57059646", "0.5682298", "0.5637548", "0.5636656", "0.56193185", "0.5542675", "0.54949087", "0.54615426", "0.54560876", "0.5449705", "0.542691", "0.5422937", "0.5405052", "0.5393791...
0.7280892
0
converting ra dec to position on a unit sphere. ra, dec are in degrees.
def radec2pos(ra, dec): pos = np.empty(len(ra), dtype=('f8', 3)) ra = ra * (np.pi / 180) dec = dec * (np.pi / 180) pos[:, 2] = np.sin(dec) pos[:, 0] = np.cos(dec) * np.sin(ra) pos[:, 1] = np.cos(dec) * np.cos(ra) return pos
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sph2cart(ra, dec):\n \n x = np.cos(ra) * np.cos(dec)\n y = np.sin(ra) * np.cos(dec)\n z = np.sin(dec)\n \n return (x, y, z)", "def ra2phi(ra: float) -> float:\n return np.pi / 180.0 * ra", "def _embed_sphere(ra, dec):\n phi = np.radians(np.asarray(ra))\n theta = np.radians(90.0 -...
[ "0.6893546", "0.67895794", "0.6682297", "0.665276", "0.6544455", "0.6492953", "0.6448709", "0.642386", "0.6402071", "0.63698786", "0.6313035", "0.6278914", "0.62634504", "0.62517715", "0.62214535", "0.62151355", "0.61769056", "0.6155247", "0.6103077", "0.6033891", "0.603029",...
0.70798403
0
Returns a veto mask for coord. any coordinate within R of center is vet.
def veto(coord, center, R): from sklearn.neighbors import KDTree pos_stars = radec2pos(center[0], center[1]) R = 2 * np.sin(np.radians(R) * 0.5) pos_obj = radec2pos(coord[0], coord[1]) tree = KDTree(pos_obj) vetoflag = ~np.zeros(len(pos_obj), dtype='?') arg = tree.query_radius(pos_stars, r=R) arg = np.concatena...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_ellipann_mask(self, x, y, a, b, theta, rin, rout):\n from sep import mask_ellipse\n ellipsemask_o = np.asarray(np.zeros((self.height,self.width)),dtype=\"bool\")\n ellipsemask_i = np.asarray(np.zeros((self.height,self.width)),dtype=\"bool\")\n\n mask_ellipse( ellipsemask_o, x...
[ "0.5683561", "0.5385706", "0.53708506", "0.53487974", "0.5341335", "0.5317976", "0.5245315", "0.5237945", "0.5225114", "0.5225114", "0.5225114", "0.5220337", "0.51531094", "0.51192397", "0.5110745", "0.5102594", "0.5065542", "0.5038501", "0.50374997", "0.50311804", "0.5006915...
0.7419253
0
Search for a conda virtual environment.
def search_conda(): conda_prefix = os.environ.get("CONDA_PREFIX") if conda_prefix is not None: conda_include = join(conda_prefix, 'include') conda_lib = join(conda_prefix, 'lib') else: conda_include = "" conda_lib = "" return conda_include, conda_lib
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def contains_venv(_dir, **kargs):\n kargs.update(max_venvs=1)\n venvs = find_venvs(_dir, **kargs)\n return venvs and venvs[0]", "def conda_list_environments():\n conda = '{0}/bin/conda'.format(utils.home('apps', 'miniconda'))\n\n run('{conda} info --envs'.format(conda=conda))", "def find_env_var...
[ "0.6501221", "0.64872575", "0.5896567", "0.5862308", "0.5738842", "0.5682096", "0.55808485", "0.5560375", "0.5541428", "0.5453468", "0.5409258", "0.53685075", "0.53522867", "0.53394055", "0.5309959", "0.526319", "0.526319", "0.52403754", "0.52245736", "0.5191459", "0.5144137"...
0.70555747
0
Return a boolean indicating whether a flag name is supported on the specified compiler. As of Python 3.6, CCompiler has a `has_flag` method.
def has_flag(compiler, flagname): import tempfile with tempfile.NamedTemporaryFile('w', suffix='.cc') as f: f.write('int main (int argc, char **argv) { return 0; }') try: compiler.compile([f.name], extra_postargs=[flagname]) except setuptools.distutils.errors.CompileError: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_flag(compiler, flag, ext=None):\n return try_compile(compiler, flags=[flag], ext=ext)", "def has_flag(compiler, flagname):\n import tempfile\n\n with tempfile.NamedTemporaryFile(\"w\", suffix=\".cpp\") as f:\n f.write(\"int main (int argc, char **argv) { return 0; }\")\n try:\n ...
[ "0.7681172", "0.7246893", "0.7205566", "0.7165383", "0.711455", "0.6638837", "0.65981674", "0.65981674", "0.63818413", "0.6097321", "0.60695636", "0.6068559", "0.5869087", "0.58026737", "0.57388264", "0.5737919", "0.5731855", "0.5719258", "0.5714382", "0.5707564", "0.5677161"...
0.7289814
1
Add variant to list of variants in descending order of pos
def add_variant(self, variant): self.__variants.append(variant) self.__variants.sort(reverse=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add(self, seq, diff):\n # Insert into sorted list using linear search because it will almost always be the front\n new = (seq, diff)\n for i, curr in enumerate(reversed(self.list)):\n if new > curr:\n self.list.insert(len(self.list) - i, new)\n...
[ "0.5643841", "0.5639404", "0.5550322", "0.5547384", "0.5547384", "0.5423284", "0.53913283", "0.52955395", "0.52480763", "0.5223209", "0.51826555", "0.51636374", "0.5097131", "0.50961167", "0.5091756", "0.5086889", "0.50580907", "0.503355", "0.50115395", "0.4998054", "0.498599...
0.6789352
0
Define location and size of large deletions 100bp5000bp in length
def define_deletions(genome, num): start = [] end = [] for n in range(num): start_pos, end_pos = get_del_pos(genome) # add deletion Variants to genome list var = Variant("deletion", start_pos, end_pos, start_pos-end_pos) genome.add_variant(var) # add to unavail list ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_normal_case():\n assert(minDeletionSize(['abc', 'bce', 'cae']) == 1)", "def estimated_lookup_memory(self):\n return 60 * len(self.docvecs.offset2doctag) + 140 * len(self.docvecs.doctags)", "def search_space_size(self):", "def count_deleted_bytes(self): # EntryList.count_deleted_bytes\...
[ "0.58779526", "0.5684169", "0.5653817", "0.5618745", "0.536154", "0.5326422", "0.529904", "0.52936506", "0.52892846", "0.5253986", "0.52372485", "0.5233735", "0.51832646", "0.51760125", "0.5156877", "0.5154205", "0.51484495", "0.5126337", "0.51138765", "0.51056486", "0.508888...
0.6098612
0
Helper function. Deletion position generator
def get_del_pos(genome): start_pos = random.randint(100,len(genome.seq)-5100) # positions 100bp from start or end will not be variable end_pos = start_pos + random.randint(100,5000) unavail = False for n in range(start_pos, end_pos): if n in genome.unavail_pos: unavail = True ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def define_deletions(genome, num):\n start = []\n end = []\n for n in range(num):\n start_pos, end_pos = get_del_pos(genome)\n # add deletion Variants to genome list\n var = Variant(\"deletion\", start_pos, end_pos, start_pos-end_pos)\n genome.add_variant(var)\n # add to...
[ "0.63984585", "0.62548083", "0.6207785", "0.6132328", "0.61139756", "0.6092633", "0.60486585", "0.5975002", "0.59704536", "0.5825324", "0.5764438", "0.5744961", "0.5653837", "0.558589", "0.55785906", "0.552752", "0.55268854", "0.55255824", "0.55244887", "0.5521869", "0.549194...
0.6689718
0
Define the translocation variants plus deletions in the case on nonconservative translocations
def define_translocations(genome, num, nc): start = [] end = [] for n in range(num): start_pos = random.randint(100,len(genome.seq)-5100) # positions 100bp from start or end will not be variable end_pos = start_pos + random.randint(500,5000) start.append(start_pos) end.append...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def define_deletions(genome, num):\n start = []\n end = []\n for n in range(num):\n start_pos, end_pos = get_del_pos(genome)\n # add deletion Variants to genome list\n var = Variant(\"deletion\", start_pos, end_pos, start_pos-end_pos)\n genome.add_variant(var)\n # add to...
[ "0.5537677", "0.52762145", "0.4961916", "0.48434523", "0.47945848", "0.47786444", "0.47647405", "0.476209", "0.47455353", "0.4735057", "0.46808425", "0.46668348", "0.46216846", "0.46124536", "0.46008486", "0.458566", "0.45777264", "0.45706475", "0.45653558", "0.45610404", "0....
0.66891193
0
Mutates the reference sequence with variants
def mutate_seq(genome): for var in genome.get_variants(): if var.type == "snp": mutate_snp(genome, var) elif var.type == "indel": mutate_indel(genome, var) elif var.type == "deletion": mutate_deletion(genome, var) elif var.type == "translocation or...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_variant_sequence(seq, variant, start=0, offset=0):\n ref, position, alt = extract_variant_info(variant)\n\n # make sure ref and alt have the same number of characters\n assert len(ref) == len(alt), \"Variants have different length.\"\n\n # calculate position relative to gene ref sequence i...
[ "0.5858595", "0.5744785", "0.56669265", "0.5648644", "0.5623361", "0.548982", "0.54564863", "0.5297106", "0.52755165", "0.5271355", "0.5177751", "0.5170914", "0.513498", "0.5070963", "0.5059057", "0.5057927", "0.5028841", "0.5012394", "0.5010652", "0.50088125", "0.50017047", ...
0.63627815
0
Mutate reference with snp
def mutate_snp(genome, var): nt_options = {'A':['T','G','C'], 'T':['A','G','C'], 'G':['A','T','C'], 'C':['A','T','G']} n = random.randint(0,2) nt = nt_options.get(genome.seq[var.start])[n] genome.mut_seq[var.start] = nt var.ref = genome.seq[var.start] var.alt = nt
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def use_reference(self, reference: Reference) -> Experiment:\n for component in self:\n component.with_reference(reference, inplace=True)\n return self", "def rewrite_refs(sexpr, from_args, base_offsets):\n\n def rewrite_node(sexpr):\n # Push unboxing into the state variables o...
[ "0.5736196", "0.5497471", "0.54629546", "0.5329286", "0.52986115", "0.52874947", "0.52780104", "0.5260885", "0.519358", "0.51861936", "0.5177854", "0.5172398", "0.51685095", "0.5161797", "0.5157027", "0.5100351", "0.5098187", "0.5091996", "0.50896424", "0.50819147", "0.507418...
0.6534935
0
Mutation reference with small indel
def mutate_indel(genome, var): if var.size > 0: # insertion if var.size <= 10: new_seq = small_insert(var) if var.size > 10: new_seq = large_insert(var) for nt in new_seq: genome.mut_seq.insert(var.start,nt) var.ref = "." var.alt = "".join...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gen_inplace_mutation(self, expr, op, pre):\n ir_a = self.gen_expr(expr.a, rvalue=False)\n assert expr.a.lvalue\n\n ir_typ = self.get_ir_type(expr.typ)\n loaded = self._load_value(ir_a, expr.typ)\n # for pointers, this is not one, but sizeof\n if expr.typ.is_pointer:\n ...
[ "0.5505765", "0.54360455", "0.54230344", "0.5306911", "0.5252342", "0.5247956", "0.52443165", "0.52398235", "0.5150387", "0.5141352", "0.5135512", "0.5132745", "0.5129781", "0.5118407", "0.5118393", "0.51132834", "0.5103163", "0.5092006", "0.50837165", "0.50821406", "0.507362...
0.6331966
0
Write vcf of introduced mutations
def write_vcf(file, ref, genome): vcf = open(file, "w") vcf.write("##fileformat=VCFv4.2\n") vcf.write("##fileDate={}\n".format(datetime.datetime.today().strftime('%Y%m%d'))) vcf.write("##source={}\n".format(os.path.basename(__file__))) vcf.write("##reference={}\n".format(ref)) vcf.write("##conti...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_to_vcf(self):\n\n # 1. Generate header info\n date_for_vcf = datetime.now().strftime('%Y%m%d')\n header_info = [\n '##fileformat=VCFv4.2',\n '##fileDate=%s' % date_for_vcf,\n '##source=%s' % self.get_analyser_name(),\n '##reference=https://...
[ "0.59303916", "0.59228677", "0.5450651", "0.5450651", "0.5290239", "0.5255168", "0.5247454", "0.5226452", "0.5224074", "0.51939577", "0.51847774", "0.5123652", "0.51178366", "0.51178366", "0.5115961", "0.5109222", "0.5107506", "0.5100864", "0.50648683", "0.50439674", "0.50036...
0.6345698
0
Install InfluxDBGrafana plugin and check it exists
def install_influxdb_grafana(self): self.env.revert_snapshot("ready_with_3_slaves") self.prepare_plugin() self.helpers.create_cluster(name=self.__class__.__name__) self.activate_plugin()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_install():\n if platform.dist()[0] not in ['fedora', 'redhat', 'centos']:\n print \"{} not supported\".format(platform.dist()[0])\n sys.exit(1)\n print \"\\ndetected {} {} ...\".format(platform.dist()[0], platform.dist()[1])\n\n import yum\n # Remove loggin. Taken from: https://...
[ "0.595304", "0.5745254", "0.5667974", "0.5486305", "0.5457506", "0.54097706", "0.5339488", "0.52555525", "0.5219142", "0.5215366", "0.52148485", "0.5198161", "0.51315707", "0.5096612", "0.50960976", "0.5095093", "0.5054607", "0.502322", "0.5018326", "0.5018175", "0.50078493",...
0.62883
0
Deploy a cluster with the InfluxDBGrafana plugin
def deploy_influxdb_grafana(self): self.check_run("deploy_influxdb_grafana") self.env.revert_snapshot("ready_with_3_slaves") self.prepare_plugin() self.helpers.create_cluster(name=self.__class__.__name__) self.activate_plugin() self.helpers.deploy_cluster(self.base_no...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deploy(self, log_cli_level='DEBUG'):\n logger.info(\"Deploying OCP cluster\")\n logger.info(\n f\"Openshift-installer will be using loglevel:{log_cli_level}\"\n )\n run_cmd(\n f\"{self.installer} create cluster \"\n f\"--d...
[ "0.6760748", "0.6698812", "0.646193", "0.64088714", "0.6371984", "0.62422365", "0.593232", "0.58423775", "0.5802093", "0.5791027", "0.5774496", "0.57614875", "0.5748934", "0.5731464", "0.5723261", "0.56795734", "0.5674716", "0.56585866", "0.56582737", "0.56570524", "0.5653534...
0.7179212
0
Deploy a cluster with the InfluxDBGrafana plugin in HA mode
def deploy_ha_influxdb_grafana(self): self.check_run("deploy_ha_influxdb_grafana") self.env.revert_snapshot("ready_with_9_slaves") self.prepare_plugin() self.helpers.create_cluster(name=self.__class__.__name__) self.activate_plugin() self.helpers.deploy_cluster(self.f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deploy_influxdb_grafana(self):\n self.check_run(\"deploy_influxdb_grafana\")\n self.env.revert_snapshot(\"ready_with_3_slaves\")\n\n self.prepare_plugin()\n\n self.helpers.create_cluster(name=self.__class__.__name__)\n\n self.activate_plugin()\n\n self.helpers.deploy_c...
[ "0.71375924", "0.6614553", "0.64100206", "0.63719606", "0.6290196", "0.60809684", "0.59947604", "0.59402806", "0.59021074", "0.58445066", "0.5838543", "0.5811758", "0.58109844", "0.57998806", "0.5750243", "0.57220453", "0.57189244", "0.5712368", "0.571099", "0.56962675", "0.5...
0.73999476
0
Uninstall the InfluxDBGrafana plugin with a deployed environment
def uninstall_deployed_influxdb_grafana(self): self.env.revert_snapshot("deploy_influxdb_grafana") self.check_uninstall_failure() self.fuel_web.delete_env_wait(self.helpers.cluster_id) self.uninstall_plugin()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def uninstall():\n log.info(\"Deregistering NukeStudio plug-ins..\")\n pyblish.deregister_host(\"nukestudio\")\n pyblish.deregister_plugin_path(PUBLISH_PATH)\n avalon.deregister_plugin_path(avalon.Loader, LOAD_PATH)\n avalon.deregister_plugin_path(avalon.Creator, CREATE_PATH)", "def uninstall_infl...
[ "0.7415947", "0.7020453", "0.6791701", "0.6397008", "0.63118774", "0.6249087", "0.6243023", "0.6228777", "0.61701214", "0.60724145", "0.60215527", "0.59974086", "0.5995501", "0.59630316", "0.5962823", "0.59561855", "0.59256834", "0.5903769", "0.5888267", "0.5855758", "0.58130...
0.7765449
0
Creating the layer structure (3 convolutional layers).
def setup_layer_structure(self): self.page_rank_convolution_1 = self.layer(self.feature_number, self.args.layers[0], self.args.iterations, self.args.alpha) self.page_rank_convolution_2 = self.layer(self.args.layers[0], self.args.layers[1], self.args.iterations, self.args.alpha) self.page_rank_co...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def c3d(self):\n model = Sequential()\n # 1st layer group\n model.add(Conv3D(64, 3, 3, 3, activation='relu',\n border_mode='same', name='conv1',\n subsample=(1, 1, 1),\n input_shape=self.input_shape))\n model.add(Ma...
[ "0.68870306", "0.683484", "0.6814327", "0.6804855", "0.68003833", "0.6713563", "0.66956025", "0.66609627", "0.66032994", "0.6591668", "0.6574811", "0.6561159", "0.6557254", "0.6556963", "0.6540236", "0.6533591", "0.65318054", "0.6522324", "0.65200955", "0.6493742", "0.6478714...
0.74192584
0
Classifies crop time series over 7 years into crop sequence types based on the sum of transitions from one crop to another and on the number of different crops that are in the time series. If there are more than two years no data, arable grass or any class from the skip list, then the crop type is set to 255. Crop typi...
def identifyMainTypes(ts, no_data_value, arable_grass_value, skip_lst): ## first set all values in the sequence that also occur in the skip list to the no data value ts_calc = ts.copy() for value in skip_lst: ts_calc[ts_calc == value] = no_data_value ## now count the transitions between values...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cover_crop_added(self):\n\n ## getting input parameter\n crop_input = self.soil_inputs.crop_cover.values[0]\n if pd.isnull(crop_input):\n crop_input = \"nan\"\n #climate_input = self.soil_inputs.climate.values[0]\n years_cropcover_tech = self.soil_inputs.time_using...
[ "0.57735205", "0.5470136", "0.53959316", "0.5390093", "0.5317971", "0.5257832", "0.51116467", "0.5083217", "0.505098", "0.5042806", "0.5031339", "0.50271606", "0.49884757", "0.4988455", "0.4988233", "0.4983223", "0.49774", "0.49759567", "0.4963905", "0.49603346", "0.49494007"...
0.7345915
0
Generates a scenery class file.
def create_class_file(self, template, class_name, property_map): class_array = class_name.split('::') if len(class_array) < 2: return None # Check to see if output directory exists; create it if not output_dir = os.path.join(CURRENT_DIR, 'output', class_array[1]) fi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def createClassFile( p ):\n create_modules( p[\"package\"] )\n name = p[\"protocol\"][\"name\"]\n name.lower()\n path = os.path.join( *p[\"package\"].split( \".\" ) )\n with open( \"./%s/%s.py\" % ( path, name ), \"w\" ) as f:\n for i in p[\"imports\"]:\n createClassFile( i )\n\n c = Klass( packag...
[ "0.63012064", "0.57624567", "0.5673907", "0.56524706", "0.56247723", "0.559761", "0.5517652", "0.55045784", "0.54892766", "0.5427729", "0.5389342", "0.5362354", "0.5358269", "0.5313234", "0.5306498", "0.52437127", "0.5232796", "0.52304536", "0.5210277", "0.51950926", "0.51756...
0.6172175
1
Recommended way of creating a `GridArray` from arraylike object. The arguments are used to for initialization but their validity is only checked at the initialization and not during call of `.from_array`.
def from_array( cls, data: Any, *, name: str = "unnamed", label: str = "unlabeled", unit: str = "", axes: Optional[Sequence[Any]] = None, time: Optional[Union[Axis, int, float]] = None, ) -> "GridArray": if not isinstance(data, da.Array): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def construct_array_type(cls, *args):\n if len(args) > 0:\n raise NotImplementedError(\"construct_array_type does not support arguments\")\n return FletcherArray", "def from_aoa(cls, arr: np.ndarray) -> JaggedArray:\n\n return cls(\n np.concatenate([sub.flatten() for su...
[ "0.5861719", "0.58411664", "0.5807189", "0.5794113", "0.57707715", "0.5725675", "0.56492186", "0.5555531", "0.55266875", "0.54991966", "0.54706967", "0.5466415", "0.5434855", "0.5399766", "0.538198", "0.5362605", "0.53543764", "0.534192", "0.5304696", "0.5302362", "0.5280143"...
0.66321325
0
This generates returns a query_batch object that holds the logic for creating aggregators for the queries, and also contains the logic for processing the results and printing the query
def produce_query_batches(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def execute_query(self):\n query_sum = self.initialize_totals()\n data = []\n\n with tenant_context(self.tenant):\n query = self.query_table.objects.filter(self.query_filter)\n query_data = query.annotate(**self.annotations)\n group_by_value = self._get_group_b...
[ "0.7060534", "0.66994315", "0.6620399", "0.62947273", "0.6257918", "0.62054086", "0.6186071", "0.61333835", "0.61093706", "0.6022132", "0.60047007", "0.59585905", "0.59502935", "0.5888858", "0.5850026", "0.5838606", "0.5817395", "0.58075523", "0.5784201", "0.573412", "0.57296...
0.7362229
0
Generic handler for errors. We respond in json if the request contenttype is JSON. The ui package can also define how it wants to render HTML errors, by setting a function.
def error_handling_router(error: HTTPException): log_error(error, getattr(error, "description", str(error))) http_error_code = 500 # fallback if hasattr(error, "code"): try: http_error_code = int(error.code) except ValueError: pass error_text = getattr( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def jsonable_server_error(request, template_name='500.html'):\r\n if request.is_ajax():\r\n msg = {\"error\": \"The edX servers encountered an error\"}\r\n return HttpResponseServerError(json.dumps(msg))\r\n else:\r\n return server_error(request, template_name=template_name)", "def _ha...
[ "0.6857887", "0.6807274", "0.68060046", "0.674509", "0.67290926", "0.6649142", "0.6611438", "0.6521405", "0.6462725", "0.64569706", "0.64436275", "0.6441589", "0.64084977", "0.6404532", "0.6399829", "0.6387114", "0.6339011", "0.63352144", "0.6311002", "0.6308664", "0.6301348"...
0.71245116
0
Print full SQLAlchemy query with compiled parameters. Recommended use as developer tool only.
def print_query(query: Query) -> str: regex = re.compile(r":(?P<name>\w+)") params = query.statement.compile().params sql = regex.sub(r"'{\g<name>}'", str(query.statement)).format(**params) from flexmeasures.data.config import db print(f"\nPrinting SQLAlchemy query to database {db.engine.url.databa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def printquery(statement, bind=None):\n\n import sqlalchemy.orm\n if isinstance(statement, sqlalchemy.orm.Query):\n if bind is None:\n bind = statement.session.get_bind(\n statement._mapper_zero_or_none()\n )\n statement = statement.statement\n elif bind ...
[ "0.70998377", "0.68763727", "0.63828874", "0.6131392", "0.60103345", "0.594502", "0.5877274", "0.58495736", "0.58404386", "0.5834906", "0.581142", "0.5753179", "0.57432276", "0.572709", "0.57251364", "0.5713708", "0.5708522", "0.5690537", "0.5654676", "0.56491846", "0.5647538...
0.7811912
0
Detect LF or CRLF newlines in a string by looking at the end of the first line
def detect_newline(string: str) -> str: first_lf_pos = string.find("\n") if first_lf_pos > 0 and string[first_lf_pos - 1] == "\r": return "\r\n" return "\n"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def detect_nl(string_or_lines, line_end=None):\n if line_end is None:\n line_end = '\\n' if (string_or_lines and\n string_or_lines[-1].endswith('\\n')) else ''\n return line_end", "def is_eof(line):\n return line == \"\"", "def _has_newline(line) -> bool:\n if line...
[ "0.7394444", "0.68073046", "0.6609574", "0.625732", "0.6152909", "0.61358434", "0.60357213", "0.59975314", "0.5993197", "0.58893144", "0.58762205", "0.5856547", "0.585503", "0.58519197", "0.5804647", "0.58043027", "0.5777561", "0.57619953", "0.5737633", "0.5732159", "0.570855...
0.7932517
0
Return the document as a string, using the given newline sequence
def string_with_newline(self, newline: str) -> str: if self._string is None or detect_newline(self._string) != newline: return joinlines(self.lines or (), newline) return self._string
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def doc(self):\n return \"\\n\".join(self.docLines)", "def get_newline():\n\treturn newline", "def get_string(self, n):\n pad = self.get_pad(n)\n string = pad + self.word\n string += \"\\n\" + self.children[0].get_string(n + 1)\n string += \"\\n\" + self.children[1].get_strin...
[ "0.59038466", "0.5900649", "0.56437266", "0.5614142", "0.5517783", "0.55030686", "0.54820883", "0.5474988", "0.54506934", "0.5390957", "0.535871", "0.53297806", "0.5306269", "0.529391", "0.52757686", "0.52658176", "0.52603555", "0.5253008", "0.5248537", "0.523697", "0.5210093...
0.63121516
0
Return the newline character sequence used in the document
def newline(self) -> str: return self._newline
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_newline():\n\treturn newline", "def getterminator(self):\n if self.multiline:\n return \"%s.%s\" % (CRLF,CRLF)\n return CRLF", "def readln(self):\n line = self.file.readline().decode(\"latin-1\")\n if line == \"\":\n self.eof = True\n return line...
[ "0.7639971", "0.6484275", "0.64083356", "0.6223464", "0.6215926", "0.62154984", "0.6167751", "0.61112815", "0.6108109", "0.6060583", "0.6018653", "0.6015469", "0.5946901", "0.59370923", "0.59001154", "0.5894698", "0.58863777", "0.58575237", "0.585528", "0.58470714", "0.580396...
0.71997255
1
Create a document object from a binary string
def from_bytes(cls, data: bytes, mtime: str = "") -> "TextDocument": srcbuf = io.BytesIO(data) encoding, lines = tokenize.detect_encoding(srcbuf.readline) if not lines: return cls(lines=[], encoding=encoding, mtime=mtime) return cls.from_str(data.decode(encoding), encoding=en...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def FromDocument(cls, source):\n if not hasattr(source, 'read'):\n source = StringIO(source)\n start = source.read(1)\n source.seek(0)\n if start == \"<\":\n return cls.FromXML(source)\n elif start == \"!\" or start == \"#\":\n return cls.FromYAML...
[ "0.6446747", "0.6314763", "0.62984926", "0.62984926", "0.62984926", "0.6264506", "0.62210226", "0.61864877", "0.60645014", "0.5978606", "0.5966424", "0.59642285", "0.5854134", "0.5845508", "0.5845508", "0.5845508", "0.5845508", "0.5845508", "0.5845508", "0.5845508", "0.584550...
0.7051095
0
Create a document object by reading a text file Also store the last modification time of the file.
def from_file(cls, path: Path) -> "TextDocument": mtime = datetime.utcfromtimestamp(path.stat().st_mtime).strftime(GIT_DATEFORMAT) with path.open("rb") as srcbuf: return cls.from_bytes(srcbuf.read(), mtime)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_document(file_name):\n path = INPUT_DIR+file_name # assemble the file descriptor\n file = open(path) # open in read mode\n doc = Document() # create a new document\n # add the title field\n doc.add(StringField(\"title\", input_file, Field.Store.YES))\n # add the whole book\n doc....
[ "0.63087434", "0.60907453", "0.60794234", "0.5917491", "0.5877584", "0.57569164", "0.5594606", "0.55924493", "0.55829984", "0.5578096", "0.5573896", "0.5541656", "0.5533086", "0.5498218", "0.54502106", "0.5444103", "0.54318726", "0.54280806", "0.5426904", "0.54081434", "0.538...
0.7122993
0
Create a document object from a list of lines The lines should be strings without trailing newlines. They should be encoded in UTF8 unless a different encoding is specified with the ``encoding`` argument.
def from_lines( cls, lines: Iterable[str], encoding: str = DEFAULT_ENCODING, newline: str = DEFAULT_NEWLINE, mtime: str = "", ) -> "TextDocument": return cls(None, lines, encoding=encoding, newline=newline, mtime=mtime)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_document(lines_of_document):\n\n Document = collections.namedtuple('Document', ['header', 'body'])\n document = Document(body=' '.join(lines_of_document[1:]),\n header=lines_of_document[0])\n\n return document", "def create_document_list(lines_of_file):\n\n document ...
[ "0.6565803", "0.62112606", "0.56560326", "0.56098795", "0.55255246", "0.54968804", "0.5485866", "0.5462324", "0.5462324", "0.5462324", "0.5342116", "0.5340061", "0.5301299", "0.52774715", "0.5247652", "0.5211941", "0.5210363", "0.5164008", "0.5100039", "0.5023548", "0.4995328...
0.80589086
0
Join a list of lines back, adding a linefeed after each line This is the reverse of ``str.splitlines()``.
def joinlines(lines: Iterable[str], newline: str = "\n") -> str: return "".join(f"{line}{newline}" for line in lines)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def join_lines(strings):\n liness = [string.splitlines() for string in strings]\n return '\\n'.join(''.join(lines) for lines in zip(*liness))", "def join_lines(lst):\n out = \"\"\n for line in lst:\n if line.startswith(\"[\") and line.endswith(\"]\"):\n out = f\"{out}\\n{line}\\n\"\...
[ "0.68668073", "0.6618031", "0.6415966", "0.6370114", "0.6345548", "0.6344231", "0.6172707", "0.60735846", "0.60735846", "0.5951289", "0.59325594", "0.5896327", "0.5874852", "0.58594126", "0.58511895", "0.5841074", "0.5720319", "0.5712678", "0.56969863", "0.5684662", "0.566502...
0.76907945
0
Find the deepest common parent directory of given paths
def get_common_root(paths: Iterable[Path]) -> Path: resolved_paths = [path.resolve() for path in paths] parents = reversed(list(zip(*(get_path_ancestry(path) for path in resolved_paths)))) for first_path, *other_paths in parents: if all(path == first_path for path in other_paths): return...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_common_parent(paths: 'List[str]') -> str:\n return os.path.commonprefix([path + '/' for path in paths]).rstrip('/')", "def find_ancestor(self, path, top_dirs):\n for top in top_dirs:\n if string.find(path, top) == 0:\n return top,path[len(top) + 1:]\n return Non...
[ "0.7577359", "0.7051292", "0.704602", "0.67906773", "0.6736205", "0.6676651", "0.66717577", "0.6500751", "0.64524204", "0.6428018", "0.6404881", "0.6383251", "0.6369289", "0.6266403", "0.6240449", "0.6204154", "0.6199969", "0.61758876", "0.6161473", "0.6146992", "0.6143098", ...
0.74601996
1
Return `True` if path matches any of the patterns Return `False` if there are no patterns to match.
def glob_any(path: Path, patterns: Collection[str]) -> bool: return any(path.glob(pattern) for pattern in patterns)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def matchPatterns(path, patterns):\n name = os.path.basename(path)\n for p in patterns:\n if fnmatch.fnmatch(name, p):\n return True\n return False", "def match_patterns(pathname, patterns):\n for pattern in patterns:\n if fnmatch(pathname, pattern):\n return True\n return Fa...
[ "0.8110019", "0.8085808", "0.7943399", "0.7749051", "0.7342699", "0.7113122", "0.7037795", "0.6994152", "0.6942523", "0.6905134", "0.6782805", "0.6762406", "0.6705592", "0.67052513", "0.660866", "0.65590024", "0.6527401", "0.6451756", "0.641032", "0.6376683", "0.6355369", "...
0.8415344
0
Creates a row object for D2TXT. If `row` is a mapping, each keyvalue pair is copied to the new row. Keys that do not match any column name in `d2txt` are ignored. Otherwise, `row` is treated as an iterable of values to insert into each cell of the new row.
def __init__(self, d2txt: "D2TXT", row: _RowPrototype) -> None: self._d2txt = d2txt num_columns = len(d2txt.column_names()) if isinstance(row, collections.abc.Mapping): self._row = [None] * num_columns for column_name, value in row.items(): try: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_toml_row(\n txt_row: Mapping[str, Any],\n colgroups: Iterable[ColumnGroupRule],\n columns_with_colgroups: Iterable[Union[ColumnGroupRule, str]],\n) -> Dict[str, Any]:\n # Black magic to avoid creating more than one dictionary per row\n toml_row = {}\n\n # Fill the row dict with colgroups...
[ "0.5914588", "0.58543175", "0.57564735", "0.56817734", "0.5615939", "0.5527952", "0.5510769", "0.5507778", "0.5495897", "0.54596424", "0.5449704", "0.5436924", "0.53855574", "0.5381971", "0.53568095", "0.5334737", "0.5333201", "0.5328481", "0.5321902", "0.52984434", "0.528998...
0.6899036
0
Returns a row at the given index, or a `list` of rows if slice syntax is used.
def __getitem__(self, index: Union[int, slice]) -> Union[D2TXTRow, List[D2TXTRow]]: return self._rows[index]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def row(self, index):\n return self.data[index]", "def get_row(self, index: int) -> [str]:\n return self.content[index]", "def get_row( self, rowIndex ):\n return self.data[rowIndex,:]", "def GetRow(a: numpy.ndarray, index: int) -> numpy.ndarray:\n return a[index, numpy.newaxis]", "de...
[ "0.69944495", "0.6861161", "0.6644764", "0.6537287", "0.6389719", "0.61822164", "0.617615", "0.61587846", "0.60963815", "0.60695034", "0.6028585", "0.6022226", "0.6018685", "0.6013321", "0.5944566", "0.593963", "0.59085304", "0.5889016", "0.58758247", "0.587161", "0.5844017",...
0.7645909
0
Sets a row at the given index to `value`. If slice syntax is used, replaces the rows with each item in `value`.
def __setitem__( self, index: Union[int, slice], value: Union[_RowPrototype, Iterable[_RowPrototype]], ) -> None: if isinstance(index, slice): self._rows[index] = [D2TXTRow(self, row) for row in value] else: self._rows[index] = D2TXTRow(self, value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_value(self, value):\n for row in self.rows:\n row.set_values(value)", "def __setitem__(self, index, value):\n if isinstance(index, int):\n self.data.iloc[index] = value\n elif isinstance(index, str):\n self.data[index] = value\n elif (\n ...
[ "0.72726995", "0.72012883", "0.69891423", "0.6948186", "0.6933526", "0.67805815", "0.67316794", "0.6686963", "0.6582839", "0.6567976", "0.6483665", "0.64775735", "0.64628476", "0.64168507", "0.63912326", "0.6346127", "0.6339085", "0.63241065", "0.6289696", "0.6220861", "0.618...
0.74966866
0
Returns a readonly view of the list of column names.
def column_names(self) -> D2TXTColumnNameView: return D2TXTColumnNameView(self._column_names)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def column_names(\n self,\n table: exp.Table | str,\n only_visible: bool = False,\n dialect: DialectType = None,\n normalize: t.Optional[bool] = None,\n ) -> t.List[str]:", "def columns(self) -> List[str]:\n\n return [column.name for column in self.plaincolumns]", "...
[ "0.669823", "0.66555965", "0.66378015", "0.66087085", "0.6516752", "0.6500815", "0.64622533", "0.64327806", "0.640118", "0.64002204", "0.63858116", "0.6358179", "0.63401395", "0.63251615", "0.63190323", "0.6308985", "0.62916976", "0.6289878", "0.6280371", "0.626355", "0.62591...
0.7220144
0
Returns the index of a column.
def column_index(self, column_name: str) -> int: return self._column_indices[column_name]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_index(self, column):\r\n\r\n\t\treturn self.columns.index(column)", "def getColIdx(self, col):\n try:\n return int(col)\n except:\n return ord(col)-ord('a')", "def getColIdx(self, col):\n try: \n return int(col)\n except:\n return ...
[ "0.8619392", "0.8429728", "0.84154207", "0.83312255", "0.80317616", "0.76882744", "0.75399107", "0.74809426", "0.7480255", "0.7480255", "0.7480255", "0.7480255", "0.7480255", "0.7480255", "0.7480255", "0.7480255", "0.7480255", "0.7480255", "0.7480255", "0.7480255", "0.7480255...
0.8449339
1
Creates a D2TXT object from a tabbed TXT file.
def load_txt(cls, txtfile: Union[str, PathLike, TextIO]) -> "D2TXT": try: txtfile_fd = open(txtfile, encoding="cp949") except TypeError: pass else: with txtfile_fd: return cls.load_txt(txtfile_fd) txt_reader = csv.reader( t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def d2txt_to_toml(d2txt: D2TXT) -> str:\n columns = d2txt.column_names()\n colgroups = get_matched_colgroups(columns)\n columns_with_colgroups = get_sorted_columns_and_groups(columns, colgroups)\n\n toml_rows = [make_toml_row(row, colgroups, columns_with_colgroups) for row in d2txt]\n\n # Use qtoml....
[ "0.6052778", "0.58982295", "0.5799807", "0.57703215", "0.5684601", "0.5684529", "0.557211", "0.5560367", "0.55572504", "0.5540841", "0.5458384", "0.54328406", "0.5414993", "0.53965706", "0.5371137", "0.53689736", "0.5321151", "0.5318514", "0.5304354", "0.5291157", "0.52887577...
0.7439095
0
Decodes an AuraFilter value into a list of flag names.
def decode_aurafilter(aurafilter: int) -> Tuple[List[str], _Hex]: af_names = [] for name, flag in AURAFILTER_FLAGS.items(): if aurafilter & flag: aurafilter &= ~flag af_names.append(name) return af_names, _Hex(aurafilter)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse(value: str):\n return [member for member in FilterMode if member.name == value][0]", "def encode_aurafilter(flags: List[str]) -> int:\n aurafilter = 0\n for name in flags:\n try:\n aurafilter |= AURAFILTER_FLAGS[name]\n except KeyError:\n raise ValueErro...
[ "0.6381787", "0.6365174", "0.5831184", "0.5673043", "0.5527654", "0.54318756", "0.5431615", "0.531801", "0.5313234", "0.5182614", "0.51407236", "0.5120919", "0.5096309", "0.5052159", "0.50205535", "0.5017882", "0.5013001", "0.50068474", "0.49978173", "0.4992086", "0.49678352"...
0.7292126
0
Returns an integer made from combining the list of AuraFilter flag names.
def encode_aurafilter(flags: List[str]) -> int: aurafilter = 0 for name in flags: try: aurafilter |= AURAFILTER_FLAGS[name] except KeyError: raise ValueError(f"Unknown AuraFilter flag name: {name!r}") from None return aurafilter
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decode_aurafilter(aurafilter: int) -> Tuple[List[str], _Hex]:\n af_names = []\n for name, flag in AURAFILTER_FLAGS.items():\n if aurafilter & flag:\n aurafilter &= ~flag\n af_names.append(name)\n return af_names, _Hex(aurafilter)", "def encode_flags(names):\n return r...
[ "0.6257298", "0.60551655", "0.59182096", "0.58377236", "0.58117735", "0.56117", "0.54887646", "0.54781926", "0.5476762", "0.5417197", "0.52866024", "0.5133936", "0.5132465", "0.51104814", "0.5102524", "0.5053128", "0.5051292", "0.50383395", "0.5037587", "0.5036518", "0.499014...
0.7792647
0
Returns a range that starts at 1 and ends at `stop`, inclusive.
def range_1(stop: int) -> range: return range(1, stop + 1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def range_inclusive(start, stop):\n return range(start, stop + 1)", "def get_range(start, stop):\n \n nums = []\n\n for num in range(start, stop):\n nums.append(num)\n\n return nums", "def getRange (start, stop, step=1):\r\n result = [n for n in range(start, stop, step)]\r\n return ...
[ "0.7600765", "0.72744143", "0.70160294", "0.70014435", "0.69963294", "0.68381304", "0.6764418", "0.6667893", "0.6647192", "0.66197246", "0.6616324", "0.65756834", "0.65628725", "0.6459923", "0.6389658", "0.6369184", "0.6277148", "0.6272892", "0.6268128", "0.62641555", "0.6151...
0.8663045
0
Recursively traverses `schema` and yields member column names.
def yield_column_names(schema: ColumnGroupSchema) -> Iterator[str]: if isinstance(schema, str): yield schema else: seq = schema.values() if isinstance(schema, collections.abc.Mapping) else schema for value in seq: yield from yield_column_names(value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def member_names(self) -> Iterator[str]:\n return yield_column_names(self.schema)", "def _columns(cls, schema: dsl.Source.Schema) -> typing.Sequence[str]:\n return tuple(f.name for f in schema)", "def columns(self, model=None):\n for query in self.__queries:\n for column in ...
[ "0.7563345", "0.66443443", "0.58611506", "0.5780913", "0.5721082", "0.5655082", "0.5635283", "0.548102", "0.54754317", "0.54406667", "0.54115874", "0.5393273", "0.53615844", "0.5355434", "0.5302217", "0.5290218", "0.52563983", "0.5241743", "0.5233976", "0.5203451", "0.519351"...
0.68476903
1
Returns an iterator of member column names.
def member_names(self) -> Iterator[str]: return yield_column_names(self.schema)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetColumnIterator(self):\n return self.columns.__iter__()", "def __iter__(self):\r\n for column_id in self._columns.keys():\r\n yield column_id", "def __iter__(self) -> Generator[str, None, None]:\n\n yield from self.__dict__[\"members\"]", "def iterall(self):\r\n retur...
[ "0.74746215", "0.69454056", "0.6690719", "0.66593105", "0.6542654", "0.65231043", "0.65033484", "0.6474581", "0.63884705", "0.6319774", "0.6300248", "0.6268912", "0.62328297", "0.6186718", "0.6174151", "0.6115749", "0.611104", "0.61110395", "0.6109243", "0.6086009", "0.608509...
0.86986816
0
Returns a new column group schema parameterized with str.format().
def format_schema(schema: ColumnGroupSchema, param: str) -> ColumnGroupSchema: if isinstance(schema, str): return schema.format(param) if isinstance(schema, collections.abc.Mapping): return {k.format(param): format_schema(v, param) for k, v in schema.items()} return [format_schema(v, param) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_colgroup(\n params: Iterable[Union[int, str]], alias: str, schema: ColumnGroupSchema\n) -> Iterator[Tuple[str, ColumnGroupSchema]]:\n return ((alias.format(p), format_schema(schema, p)) for p in params)", "def __makeFormatString(self):\n self.__formatString = \"\"\n for f in self.__c...
[ "0.59646285", "0.5563327", "0.5234521", "0.52144516", "0.51626664", "0.516235", "0.5109114", "0.50909567", "0.5080647", "0.50231594", "0.5014989", "0.4978651", "0.49769673", "0.4948268", "0.494655", "0.48997864", "0.4875068", "0.48681432", "0.48621714", "0.48513272", "0.48462...
0.6455084
0
Initializes the list of column group rules.
def initialize_column_groups( *colgroups: Iterable[Tuple[str, ColumnGroupSchema]] ) -> List[ColumnGroupRule]: return sorted( (ColumnGroupRule(*colgroup_def) for colgroup_def in colgroups), key=lambda colgroup: sum(1 for _ in colgroup.member_names()), reverse=True, )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _compile_rules(self):\n for state, table in self.RULES.items():\n patterns = []\n actions = []\n nextstates = []\n for i, row in enumerate(table):\n if len(row) == 2:\n pattern, action_ = row\n nextstate = N...
[ "0.5566197", "0.5542554", "0.54401386", "0.54300237", "0.5343018", "0.53388387", "0.5254803", "0.52473783", "0.5232684", "0.5150873", "0.51397043", "0.5123415", "0.5113568", "0.5062633", "0.5054941", "0.5009353", "0.5002684", "0.50020784", "0.49938783", "0.49886483", "0.49834...
0.6727511
0
Returns a new column group schema with properly recased member names.
def recase_schema( obj: ColumnGroupSchema, uncasefold: Mapping[str, str] ) -> ColumnGroupSchema: if isinstance(obj, str): return uncasefold[obj.casefold()] if isinstance(obj, collections.abc.Mapping): return {key: recase_schema(value, uncasefold) for key, value in obj.items()} return [re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_column_family_name_generation(self):\r\n class TestModel(Model):\r\n id = columns.UUID(primary_key=True, default=lambda:uuid4())\r\n text = columns.Text()\r\n\r\n assert TestModel.column_family_name(include_keyspace=False) == 'test_model'", "def test_new_columns(self...
[ "0.5103442", "0.5068711", "0.5054673", "0.5048149", "0.5021421", "0.49743184", "0.49688938", "0.49561247", "0.49495164", "0.4924085", "0.49119753", "0.48623934", "0.48522207", "0.4816956", "0.47880214", "0.4778498", "0.47763094", "0.47636637", "0.4746027", "0.47379166", "0.47...
0.5384115
0
Return a list of column groups that match the given column names.
def get_matched_colgroups(column_names: Iterable[str]) -> List[ColumnGroupRule]: casefold_to_normal = {name.casefold(): name for name in column_names} matched_colgroups = [] for group in COLUMN_GROUPS: try: new_schema = recase_schema(group.schema, casefold_to_normal) except KeyE...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_matching_columns(self, columns):\n result = []\n for column in columns:\n if self.match(column):\n result.append(column)\n return result", "def get_sorted_columns_and_groups(\n columns: Collection[str], colgroups: Iterable[ColumnGroupRule]\n) -> List[Unio...
[ "0.7152319", "0.62195057", "0.620709", "0.6017562", "0.59982556", "0.59308577", "0.581594", "0.5789305", "0.57864106", "0.57861966", "0.57049054", "0.5701381", "0.56945986", "0.5563272", "0.5550737", "0.55381936", "0.54624593", "0.5457094", "0.54433465", "0.541781", "0.541461...
0.77742374
0
Builds a sorted list of column names and column groups.
def get_sorted_columns_and_groups( columns: Collection[str], colgroups: Iterable[ColumnGroupRule] ) -> List[Union[ColumnGroupRule, str]]: column_to_index = {name: index for index, name in enumerate(columns)} # Build an iterable of tuples of (index, column name or colgroup). # Each colgroup is given the ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_country_groups_grid_column_names_by_order(self):\n self.column_name_list = self.get_grid_column_names_by_order(self.country_groups_grid_div_id)\n return self.column_name_list", "def initialize_column_groups(\n *colgroups: Iterable[Tuple[str, ColumnGroupSchema]]\n) -> List[ColumnGroupRule...
[ "0.6557017", "0.64251554", "0.6375868", "0.62967944", "0.62698936", "0.6223582", "0.62156993", "0.6114358", "0.60224587", "0.5958244", "0.59161377", "0.589448", "0.5839277", "0.58142245", "0.580243", "0.5756395", "0.57147145", "0.57139885", "0.57064396", "0.5672191", "0.56656...
0.64487064
1
Converts a D2TXT object to TOML markup.
def d2txt_to_toml(d2txt: D2TXT) -> str: columns = d2txt.column_names() colgroups = get_matched_colgroups(columns) columns_with_colgroups = get_sorted_columns_and_groups(columns, colgroups) toml_rows = [make_toml_row(row, colgroups, columns_with_colgroups) for row in d2txt] # Use qtoml.dumps(), bec...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def toml_to_d2txt(toml_data: str) -> D2TXT:\n # Use toml.loads() because it's ~50% faster than qtoml.loads()\n toml_data = toml.loads(toml_data)\n d2txt_data = D2TXT(toml_data[\"columns\"])\n column_groups = toml_data.get(\"column_groups\", {})\n\n for toml_row in toml_data[\"rows\"]:\n # Cre...
[ "0.6619909", "0.54684037", "0.54184175", "0.54079455", "0.5403487", "0.53605205", "0.53591055", "0.5342695", "0.53344387", "0.52875906", "0.52467185", "0.52421534", "0.52376467", "0.52144116", "0.5213634", "0.5198607", "0.51925313", "0.51891714", "0.51873887", "0.5153984", "0...
0.72692186
0
Recursively unpacks a column group, yielding column names and values.
def unpack_colgroup( schema: ColumnGroupSchema, value: Union[Mapping, Collection, str] ) -> Iterator[Tuple[str, Union[int, str]]]: if isinstance(value, (int, str)): yield schema, value elif isinstance(value, collections.abc.Mapping): for key, sub_value in value.items(): yield fro...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unpack(buf: bytes) -> dict[str, Any]:\n flags: int\n column_count: int\n len_names: int\n flags, column_count, len_names = struct_unpack_from(\"<BHH\", buf)\n data_offset_code, coldata_size, data_offset_mask = decode_data_size(flags)\n if (flags & 0xFC) != 4:\n raise DynColValueError(\...
[ "0.5860921", "0.5324127", "0.51193476", "0.5077297", "0.50552446", "0.5020031", "0.4994846", "0.48956397", "0.4880254", "0.4875191", "0.487421", "0.483045", "0.48031977", "0.47879", "0.47606307", "0.4749535", "0.4624712", "0.46180382", "0.46014702", "0.4568014", "0.45275748",...
0.59978026
0
Repaint display. Optional rect or rect list to specify regions to repaint.
def update(self, rect_list=None): if isinstance(rect_list, list): self._rect_list = rect_list elif rect_list: self._rect_list = [rect_list] else: self._rect_list = self._surface_rect try: SwingUtilities.invokeAndWait(self) except In...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_rect(self):\n self._update_tiles()", "def update(self, rect_list=None):\n if hasattr(rect_list, 'append'):\n _update(self.canvas, rect_list)\n elif rect_list:\n _update(self.canvas, [rect_list])\n else:\n self.flip()\n return None", ...
[ "0.6264015", "0.6239573", "0.62211937", "0.59891003", "0.5882044", "0.5631246", "0.5621027", "0.5553285", "0.54953784", "0.5484684", "0.5482387", "0.54778844", "0.5471384", "0.5463113", "0.54597145", "0.5437975", "0.5435315", "0.54189324", "0.5392594", "0.5364516", "0.5360767...
0.724831
0
Creating a dictionary of all rmsd values calculated after docking. Writes to 'no_rmsd' receptors that failed the docking.
def _get_rmsd_list(self): fout_no = open('no_rmsd','w')#no poses file fout_empty = open('rmsd_empty','w')#poses file was empty fout_minus = open('minus_1','w') for subdir in os.listdir(self.path): if subdir.startswith('.'): continue try: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_rdm(self): \n\n # Check if CCSD calculation is performed\n if not self.cc_fragment:\n raise RuntimeError(\"Cannot retrieve RDM because no simulation has been run.\")\n\n # Solve the lambda equation and obtain the reduced density matrix from CC calculation\n sel...
[ "0.55083853", "0.53247666", "0.52147055", "0.5113063", "0.508443", "0.50518584", "0.5041542", "0.50227654", "0.50118756", "0.49788424", "0.4976313", "0.49651384", "0.4965058", "0.49617785", "0.49557033", "0.49505562", "0.49466375", "0.49391615", "0.4937128", "0.4921787", "0.4...
0.6169083
0
Sets self.running_time by summing all run times of successful runs
def _get_running_time(self): time_sum = 0.0 for subdir in os.listdir(self.path): if subdir.startswith('.'): continue try: line = open('{0}/{1}/{2}/out/OUTDOCK'.format(self.path, subdir, DOCKING_RUN_FILES),'r').readlines()[-1] if lin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_running_time(self, t):\n util.write_to_file(self.running_time_file, str(int(t)))", "def measure(self):\n # --- perform repeated runs\n for i_run in range(self.n_runs):\n if self.verbosity > 0:\n print(\"Run {0} / {1} ...\".format(i_run, self.n_runs), end = '...
[ "0.66474855", "0.6257626", "0.62287956", "0.61896676", "0.618632", "0.61650294", "0.6004173", "0.5977951", "0.5937204", "0.59302664", "0.59168065", "0.5875335", "0.5774087", "0.57727706", "0.57559896", "0.5748766", "0.5747493", "0.5747493", "0.5747493", "0.5742051", "0.573750...
0.6936682
0
reads a baseline file (contains list of names and rmsd values) and returns it as a dictionary
def _read_baseline(self, path): base_rmsd = dict() fin = open(path,'r') for line in fin: if line == '\s' or line == '' or line == '\n': continue k, v = line.split() base_rmsd[k.strip()] = float(v.strip()) return base_rmsd
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def readRunDict(fileName):\n result = {}\n with FileWrapper(fileName) as f:\n for ln, line in enumerate(tqdm(f, desc='loading run (by line)', leave=False)):\n line = line.strip()\n if not line:\n continue\n fld = line.split()\n if len(fld) != ...
[ "0.61480147", "0.60595286", "0.6045368", "0.59409505", "0.5931084", "0.5925992", "0.5837242", "0.5764198", "0.57251114", "0.57059115", "0.5681708", "0.5676454", "0.56752664", "0.5659213", "0.56583595", "0.5657403", "0.56132305", "0.5588289", "0.55877316", "0.55817276", "0.557...
0.78487563
0
reads a scores file (contains list of names and scores) and returns it as a dictionary
def _read_scores(self,path): scores = dict() fin = open(path,'r') for line in fin: k, v = line.split() scores[k.strip()] = float(v.strip()) return scores
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_score_dict(score_dict='sentiment.txt'):\n with open(score_dict, 'r') as f:\n dictionary = {}\n\n # Remove empty lines from file.\n lines = (line.strip() for line in f)\n lines = (line for line in lines if line)\n\n for line in lines:\n if line.startswith('#...
[ "0.7554493", "0.73974615", "0.73380387", "0.7258621", "0.71717304", "0.7118672", "0.7099427", "0.7050795", "0.70404834", "0.7024652", "0.6743745", "0.6737352", "0.67248523", "0.6702224", "0.6366896", "0.62206274", "0.621493", "0.6208894", "0.61971027", "0.6186668", "0.6177739...
0.81163096
0
This function split the attribute manifest file of CelebA dataset into three files, train, test and valid file which are used
def split_manifest(root_path, manifest_file_path): train_manifest = open(os.path.join(root_path,"dataset", "train_manifest.txt"), "w+") test_manifest = open(os.path.join(root_path, "dataset","test_manifest.txt"), "w+") val_manifest = open(os.path.join(root_path,"dataset" ,"valid_manifest.txt"), "w+") w...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preprocess(self):\n lines = [line.rstrip() for line in open(self.attr_path, 'r')]\n all_attr_names = lines[1].split()\n for i, attr_name in enumerate(all_attr_names):\n self.attr2idx[attr_name] = i\n self.idx2attr[i] = attr_name\n\n lines = lines[2:]\n r...
[ "0.63171077", "0.59228057", "0.57602185", "0.5748916", "0.5701956", "0.5697547", "0.56918025", "0.56853265", "0.5656477", "0.5642757", "0.55658674", "0.5557938", "0.55486494", "0.5534446", "0.5530946", "0.55017805", "0.5499939", "0.5495286", "0.5490541", "0.5489271", "0.54864...
0.73371595
0
Extracts samples with the same amount of pressed and not pressed keys. Returns a list of these samples. Each sample is a tuple, containing (time, data, key_code), where key_code is 0 for a sample where no key was pressed.
def extract_samples(config, preprosessed_events): MIN_DISTANCE = config.negative_sample_min_distance BEFORE_PRESSED = int(round(config.sequence_length * config.sequence_ratio)) AFTER_PRESSED = config.sequence_length - BEFORE_PRESSED preprosessed_events = list(preprosessed_events) samples = [] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_pressed_keys(self):\n pressed_keys = np.empty(len(constants.POSSIBLE_KEYS))\n for index, key in enumerate(constants.POSSIBLE_KEYS):\n if((win32api.GetKeyState(ord(key)) & (1 << 7)) != 0):\n pressed_keys[index] = 1\n\n return pressed_keys", "def read_keys(self) -> list[KeyPress]...
[ "0.598518", "0.59702766", "0.5398699", "0.53702694", "0.53204024", "0.52953404", "0.52726287", "0.52653307", "0.526068", "0.5190021", "0.51599646", "0.51461023", "0.5123114", "0.5119837", "0.51105505", "0.5108816", "0.5085003", "0.50841266", "0.5075455", "0.5019613", "0.50082...
0.6360126
0
Test drop API call
def test_drop(self): client_cik, client_rid = self.makeClient(self.cik) isok, response = self.onep.drop(self.cik, client_rid) self.assertTrue(isok, 'client drop succeeded') isok, response = self.onep.info(self.cik, client_rid) self.assertFalse(isok, 'dropped client was really dro...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post(self):\n args = request.args or request.json\n if not args:\n args = {}\n res = services.file.drop_out(**args)\n return res", "def test_delete(self):\n client = RestClient(host=self.host, username='')\n rest_url = 'some/url/'\n \n # Mock...
[ "0.60445166", "0.59849435", "0.5963894", "0.5925855", "0.5893165", "0.5893165", "0.58600456", "0.58490944", "0.58430433", "0.5778766", "0.57677984", "0.5765767", "0.57437706", "0.5741457", "0.5727738", "0.57185566", "0.5714887", "0.5714887", "0.57011527", "0.569266", "0.56911...
0.6833602
0
Create HLD yaml file.
def generate_HLD(component, output): component.delete_none_attrs() yaml.indent(mapping=2, sequence=4, offset=2) d = component.asdict() yaml.dump(d, output)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_create_yaml(self):\n pass", "def create_yaml(self):\n if self._language == PYTHON:\n language_str = 'python'\n package_route = '$(System.DefaultWorkingDirectory)'\n dependencies = self._python_dependencies()\n elif self._language == NODE:\n ...
[ "0.7203727", "0.65164655", "0.63559806", "0.616078", "0.61359596", "0.60976785", "0.607504", "0.6025496", "0.5974471", "0.59713763", "0.59619933", "0.59435076", "0.5899742", "0.5846163", "0.58288187", "0.576837", "0.572865", "0.57010597", "0.5699323", "0.5697814", "0.5682538"...
0.6817044
1
Tests sorting by revenue.
def testGameRevenue(self): response = self.client.get( reverse('api:game-list', args=['v1']), {'order_by': 'revenue'}, format='json' ) self.assertEquals(response.status_code, 200) content = self.parser.parse(BytesIO(response.content)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_overall_report_banner_revenue():\n assert (overall_data['banner_report']['data'][1][0] == 'Revenue')\n for num in overall_data['banner_report']['data'][1][1:]:\n assert (num == 600)", "def test_overall_report_ad_revenue():\n assert (overall_data['overall_report']['data'][5][0] == 'Ad rev...
[ "0.6073946", "0.5968955", "0.5867104", "0.583367", "0.57776046", "0.5665777", "0.5621369", "0.5613056", "0.5512017", "0.5493276", "0.5472315", "0.54544646", "0.54435676", "0.5439316", "0.54366535", "0.5378785", "0.53452957", "0.5333099", "0.5304615", "0.529743", "0.52817583",...
0.70918286
0
Test function to check equality of two SciPy Compressed Sparse Row (CSR) matrices.
def test__csr_matrix_equal(self): matrix_a = sparse.csr_matrix(([1.0], ([0], [0])), shape=(2, 2)) matrix_b = sparse.csr_matrix(([1.0], ([0], [0])), shape=(2, 2)) matrix_c = sparse.csr_matrix(([1.0], ([1], [0])), shape=(2, 2)) self.assertEqual(decaydata._csr_matrix_equal(matrix_a, matrix...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_check_sparse(self):\n x, x_rand, s = self.create_testdata()\n task = mmRDTR()\n #check that a dense array x is passed thru unchanged\n check = task.check_sparse(x)\n self.assertEqual(np.all(check==x),True)\n #check that a sparse matrix s is converted to a numpy ar...
[ "0.75255007", "0.70881766", "0.6936769", "0.6748501", "0.6725134", "0.6625221", "0.6262431", "0.62476075", "0.6242845", "0.6235576", "0.6234698", "0.6216757", "0.617656", "0.6069728", "0.6065661", "0.6020067", "0.5997353", "0.59542704", "0.5946027", "0.59227175", "0.5916793",...
0.8238183
0
Test instantiation of DecayMatrices objects.
def test_decaymatrices_instantiation(self): # check with artificial SciPy data decay_consts = np.array([0.0] * 2) matrix_c = sparse.csr_matrix(([1.0], ([0], [0])), shape=(2, 2)) matrix_c_inv = sparse.csr_matrix(([1.0], ([1], [1])), shape=(2, 2)) year_conv = 365.0 decay_m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_init(self):\n xtal_model_data = XtalModelData(self.params)\n\n assert xtal_model_data.pdb == self.params.input.pdb\n\n assert xtal_model_data.mtz == self.params.input.mtz\n\n # TODO Assert utilised method calls of these classes\n # Assert is innstance causses issues if c...
[ "0.6335622", "0.6152222", "0.6143266", "0.6107216", "0.6085473", "0.60701674", "0.6063382", "0.60449255", "0.60084045", "0.6006065", "0.59878147", "0.5971782", "0.59470296", "0.59432346", "0.5901723", "0.58784366", "0.5870529", "0.5836426", "0.5835888", "0.58201396", "0.58170...
0.6674967
0
Test DecayMatrices instances equal.
def test_decaymatrices___eq__(self): # check with artificial SciPy data decay_consts = np.array([0.0] * 2) matrix_c = sparse.csr_matrix(([1.0], ([0], [0])), shape=(2, 2)) matrix_c_inv = sparse.csr_matrix(([1.0], ([0], [0])), shape=(2, 2)) year_conv = 365.0 decay_mats_a =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test__csr_matrix_equal(self):\n\n matrix_a = sparse.csr_matrix(([1.0], ([0], [0])), shape=(2, 2))\n matrix_b = sparse.csr_matrix(([1.0], ([0], [0])), shape=(2, 2))\n matrix_c = sparse.csr_matrix(([1.0], ([1], [0])), shape=(2, 2))\n self.assertEqual(decaydata._csr_matrix_equal(matrix...
[ "0.6724439", "0.6625551", "0.6601644", "0.6571526", "0.65042174", "0.64922494", "0.647412", "0.64028496", "0.63886464", "0.63575387", "0.6338429", "0.6309244", "0.62796915", "0.6267138", "0.6241655", "0.6225666", "0.62177324", "0.62018245", "0.61902", "0.6189794", "0.6184469"...
0.71448934
0
Test DecayMatrices instances not equal.
def test_decaymatrices___ne__(self): # check with artificial SciPy data decay_consts = np.array([0.0] * 2) matrix_c = sparse.csr_matrix(([1.0], ([0], [0])), shape=(2, 2)) matrix_c_inv = sparse.csr_matrix(([1.0], ([0], [0])), shape=(2, 2)) year_conv = 365.0 decay_mats_a =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_decaymatrices___eq__(self):\n\n # check with artificial SciPy data\n decay_consts = np.array([0.0] * 2)\n matrix_c = sparse.csr_matrix(([1.0], ([0], [0])), shape=(2, 2))\n matrix_c_inv = sparse.csr_matrix(([1.0], ([0], [0])), shape=(2, 2))\n year_conv = 365.0\n de...
[ "0.6807747", "0.65974367", "0.64604723", "0.64379275", "0.64359516", "0.63681597", "0.6310077", "0.6305383", "0.6303035", "0.6292445", "0.62532765", "0.6248959", "0.6224212", "0.6216298", "0.6199344", "0.615426", "0.61538285", "0.6140818", "0.61335593", "0.61297596", "0.61289...
0.6680435
1
Test instantiation of DecayData objects.
def test_decaydata_instantiation(self): # pylint: disable=too-many-statements # check instantiation from sub-package data = decaydata.DecayData("icrp107", load_sympy=False) self.assertEqual(data.dataset, "icrp107") self.assertEqual(data.hldata[0][0], 100.5) self.assertE...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_init(self):\n xtal_model_data = XtalModelData(self.params)\n\n assert xtal_model_data.pdb == self.params.input.pdb\n\n assert xtal_model_data.mtz == self.params.input.mtz\n\n # TODO Assert utilised method calls of these classes\n # Assert is innstance causses issues if c...
[ "0.67739683", "0.6569035", "0.6552307", "0.64942336", "0.6327415", "0.62917715", "0.62742186", "0.6183184", "0.6181641", "0.6171357", "0.61660767", "0.6160217", "0.61252683", "0.61206543", "0.611989", "0.60632426", "0.6022004", "0.60123825", "0.6011048", "0.5974161", "0.59692...
0.6696012
1
Test DecayData half_life() method.
def test_decaydata_half_life(self): data = decaydata.DecayData("icrp107") self.assertEqual(data.half_life("H-3"), 388781329.30560005) self.assertEqual(data.half_life("H-3", "y"), 12.32) self.assertEqual(data.half_life("Fm-257", "h"), 2412.0) self.assertEqual(data.half_life("Rn-2...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_trade(self):\n pass", "def test_life_critical():\n assert chap2.life_critical()", "def test_half_life_u_220():\n\n isotope_without_half_life_data = \"No-248\"\n\n with pytest.raises(MissingParticleDataError):\n half_life(isotope_without_half_life_data)\n pytest.fail(\n ...
[ "0.5796697", "0.57669073", "0.5728945", "0.5670261", "0.55979985", "0.5548448", "0.5440843", "0.5419394", "0.5361673", "0.5361315", "0.5339667", "0.53109133", "0.5307445", "0.5298182", "0.5294534", "0.52938366", "0.5292087", "0.5273447", "0.525145", "0.52498347", "0.5246218",...
0.7382109
0
Test DecayData branching_fraction() method.
def test_decaydata_branching_fraction(self): data = decaydata.DecayData("icrp107") self.assertEqual(data.branching_fraction("K-40", "Ca-40"), 0.8914) self.assertEqual(data.branching_fraction("K-40", "H-3"), 0.0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_balance_tracking(self):\n # TODO\n pass", "def testConsistency(self):\n #self.assertAlmostEqual(self.fxlinkedcashflow.amount(),0)", "def test_GreaterThanorEqualto(self):\n self.assertTrue(Fraction(7,10)>=Fraction(7,10))", "def test_GreaterThan(self):\n self.assertT...
[ "0.6398069", "0.5908882", "0.58867043", "0.57709557", "0.5702995", "0.56889933", "0.56587094", "0.56036335", "0.5591165", "0.5551884", "0.5540942", "0.5535433", "0.55173635", "0.55159515", "0.5512363", "0.54914564", "0.543573", "0.54323155", "0.5387125", "0.53253156", "0.5310...
0.8532006
0
Test DecayData decay_mode() method.
def test_decaydata_decay_mode(self): data = decaydata.DecayData("icrp107") self.assertEqual(data.decay_mode("K-40", "Ca-40"), "\u03b2-") self.assertEqual(data.decay_mode("K-40", "H-3"), "")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_decaydata_instantiation(self):\n\n # pylint: disable=too-many-statements\n\n # check instantiation from sub-package\n data = decaydata.DecayData(\"icrp107\", load_sympy=False)\n self.assertEqual(data.dataset, \"icrp107\")\n self.assertEqual(data.hldata[0][0], 100.5)\n ...
[ "0.6530617", "0.62742394", "0.5752269", "0.5589825", "0.5533413", "0.5443039", "0.54366904", "0.5365598", "0.53418976", "0.53227764", "0.5319307", "0.5278953", "0.5269455", "0.517746", "0.517117", "0.5163841", "0.51543117", "0.51177377", "0.51144737", "0.5021004", "0.50047845...
0.7831463
0
Test DecayData not equality.
def test_decaydata___ne__(self): data1 = decaydata.DecayData("icrp107") data2 = decaydata.DecayData("icrp107") data2.dataset = "icrp07" self.assertNotEqual(data1, data2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_ne(self):\n dummy = DummyCryptographicObject()\n self.assertFalse(dummy != dummy)", "def test_not_equal_on_equal(self):\n a = objects.OpaqueObject(self.bytes_a, enums.OpaqueDataType.NONE)\n b = objects.OpaqueObject(self.bytes_a, enums.OpaqueDataType.NONE)\n self.assert...
[ "0.6697621", "0.6547288", "0.65409845", "0.65157837", "0.64842427", "0.6425806", "0.64179957", "0.639179", "0.63803834", "0.6240254", "0.6171575", "0.61434686", "0.6043949", "0.6041308", "0.5941752", "0.5938338", "0.5928148", "0.5906339", "0.5904251", "0.589092", "0.58882195"...
0.725904
0
Filters the Pipeline IR proto, thus enabling partial runs. The set of nodes included in the filtered pipeline is the set of nodes between from_nodes and to_nodes, minus the set of skip_nodes. Note that the input_pipeline will not have any subpipeline nodes, since the compiler is supposed to flatten them. Also, if the i...
def filter_pipeline( input_pipeline: p_pb2.Pipeline, pipeline_run_id_fn: Callable[[p_pb2.InputSpec.Channel], str], from_nodes: Optional[Callable[[str], bool]] = None, to_nodes: Optional[Callable[[str], bool]] = None, skip_nodes: Optional[Callable[[str], bool]] = None, ) -> p_pb2.Pipeline: if any( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _make_filtered_pipeline(\n input_pipeline: p_pb2.Pipeline,\n node_map: 'collections.OrderedDict[str, p_pb2.PipelineNode]',\n fixed_deployment_config: Optional[any_pb2.Any] = None) -> p_pb2.Pipeline:\n result_pipeline = p_pb2.Pipeline()\n result_pipeline.CopyFrom(input_pipeline)\n del result_pipelin...
[ "0.626808", "0.57481754", "0.55183756", "0.5461565", "0.54446995", "0.5413548", "0.5295609", "0.5106804", "0.5098482", "0.50845003", "0.4899333", "0.48920533", "0.4883989", "0.48744228", "0.48624146", "0.4840189", "0.47933373", "0.47923186", "0.47316015", "0.47193617", "0.465...
0.7543988
0
Makes a pipeline_run_id_fn that automatically resolves pipeline_run_ids.
def make_latest_resolver_pipeline_run_id_fn( metadata_connection_config: mlmd_pb2.ConnectionConfig ) -> Callable[[p_pb2.InputSpec.Channel], str]: mlmd_client = mlmd_analytics.Analytics(metadata_connection_config) def _pipeline_run_id_fn(channel): pipeline_run = mlmd_client.get_latest_pipeline_run( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pipeline_id(self):\n pass", "def create_run_from_pipeline_func(self,\n pipeline_func: Callable,\n arguments: Mapping[str, str],\n run_name=None,\n experim...
[ "0.6188539", "0.55255634", "0.5440588", "0.5407079", "0.53376985", "0.53376985", "0.52851945", "0.5149808", "0.51486856", "0.50528824", "0.50337017", "0.5019323", "0.5019323", "0.50126743", "0.49977186", "0.49316475", "0.4924752", "0.4916863", "0.49152628", "0.49068025", "0.4...
0.65402013
0
Traverse a DAG from start_nodes, either upstream or downstream.
def _traverse(node_map: Mapping[str, p_pb2.PipelineNode], direction: _Direction, start_nodes: Collection[str]) -> Set[str]: visited_node_ids = set() stack = [] for start_node in start_nodes: # Depth-first traversal stack.append(start_node) while stack: current_node_id = stack.pop()...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_reachable_nodes_from(self, start_node, **kwargs):\r\n\t\treturn BreadthFirstTraverser(start_node, **kwargs)", "def __visit_task_nodes(self, curr_node, start_nodes):\n if curr_node in start_nodes:\n return [curr_node]\n\n visited_nodes = [curr_node]\n for dependency in sel...
[ "0.65200627", "0.6420951", "0.6342246", "0.62083316", "0.6130333", "0.5946058", "0.5942348", "0.5925855", "0.58858234", "0.58857954", "0.5885704", "0.57054967", "0.57054967", "0.56973165", "0.5695573", "0.56255525", "0.562145", "0.56126773", "0.56092864", "0.5592838", "0.5582...
0.693768
0
Remove node.downstream_nodes that have been filtered out.
def _remove_dangling_downstream_nodes( node: p_pb2.PipelineNode, node_ids_to_keep: Collection[str]) -> p_pb2.PipelineNode: # Using a loop instead of set intersection to ensure the same order. downstream_nodes_to_keep = [ downstream_node for downstream_node in node.downstream_nodes if downstream_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prune_unlinked(self):\n linked_ids = set()\n for (link_from, link_to, link_style, link_tail) in self.links:\n linked_ids.add(link_from)\n linked_ids.add(link_to)\n nodes_to_delete = []\n for name, node in self.nodes.items():\n if node.node_id not in ...
[ "0.64075077", "0.6293061", "0.6272721", "0.6239326", "0.6138292", "0.61175746", "0.6022862", "0.5999925", "0.59829855", "0.5875055", "0.58451885", "0.581128", "0.5790747", "0.57738894", "0.5743534", "0.5712408", "0.56904477", "0.5672564", "0.5654795", "0.56452525", "0.5641826...
0.70578897
0
Filter pernode deployment configs. Cast deployment configs from Any proto to IntermediateDeploymentConfig. Take all three pernode fields and filter out the nodes using node_ids_to_keep. This works because those fields don't contain references to other nodes.
def _fix_deployment_config( input_pipeline: p_pb2.Pipeline, node_ids_to_keep: Collection[str]) -> Union[any_pb2.Any, None]: if not input_pipeline.HasField('deployment_config'): return None deployment_config = p_pb2.IntermediateDeploymentConfig() input_pipeline.deployment_config.Unpack(deployment_conf...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter_nodes(nodes, filters):\n\n # print(\"Filtering nodes...\")\n\n kept_nodes = dict() # New list of filtered nodes\n\n for node_name in nodes:\n # print(\"Checking node \" + node_name)\n node = nodes[node_name]\n keep = True # Keep the node by default\n\n # Filter on pr...
[ "0.55076057", "0.50794566", "0.50770617", "0.5021", "0.49710894", "0.49631986", "0.49140954", "0.49088448", "0.49088448", "0.48994195", "0.4847997", "0.48334137", "0.48013473", "0.47772717", "0.47760564", "0.47729412", "0.47248706", "0.4698924", "0.4672511", "0.46457225", "0....
0.73370343
0
Convert a FBAModel to a SBML file
def to_sbml(self, params): files = {} _id, cobra_model = self._ws_obj_to_cobra(params['input_ref']) files['file_path'] = os.path.join(params['destination_dir'], _id + ".xml") cobra.io.write_sbml_model(cobra_model, files['file_path']) return _id, files
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def toSBML(self):\n return _libsbml.SBase_toSBML(self)", "def writeSBMLToFile(self, *args):\n return _libsbml.SBMLWriter_writeSBMLToFile(self, *args)", "def writeSBML(self, *args):\n return _libsbml.SBMLWriter_writeSBML(self, *args)", "def writeSBML(*args):\n return _libsbml.writeSBML(*...
[ "0.6434838", "0.6124707", "0.6101274", "0.6092745", "0.60307145", "0.60157996", "0.59253436", "0.58968455", "0.5859733", "0.58347833", "0.58183426", "0.57849723", "0.57628727", "0.5760876", "0.5742967", "0.573119", "0.5714304", "0.5701726", "0.56744957", "0.5672499", "0.56637...
0.61358327
1
Execute the specified file, optionaly setup its context by using globals and locals.
def exec_file(filename, globals=None, locals=None): if globals is None: globals = {} if locals is None: locals = globals locals['__file__'] = filename from py import path from _pytest import config from _pytest.assertion import rewrite f = path.local(filename) config = co...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_execute_file(file_path, globals=None, locals=None):\n if globals is None:\n globals = {}\n globals.update({\n \"__file__\": file_path,\n \"__name__\": \"__main__\",\n })\n with open(file_path, 'rb') as file:\n exec(compile(file.read(), file_path, 'exec'), globals, lo...
[ "0.7517493", "0.7043965", "0.6860222", "0.6845836", "0.6636562", "0.65708846", "0.6563779", "0.65163225", "0.64941037", "0.63483906", "0.62934136", "0.62400806", "0.60027814", "0.59763885", "0.5930375", "0.5903378", "0.57821786", "0.57609266", "0.5755491", "0.5730677", "0.570...
0.7253767
1
Run the specified command in container. equiv of `docker exec`, command is str
def _exec_command_in_container(client, container, command): exec_id = client.exec_create(container, command) output = client.exec_start(exec_id).decode('utf-8') logger.info(output) return output
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_docker_command(self, container_node, command):\n output = \"\"\n try:\n container = self.docker_client.containers.get(container_node.get_container_id())\n success, output = container.exec_run(command)\n if success != 0:\n return False, output\n ...
[ "0.78536147", "0.773723", "0.76985824", "0.75227827", "0.74490446", "0.7440863", "0.7166846", "0.71136314", "0.70962405", "0.69740474", "0.69553137", "0.69461185", "0.6896541", "0.675958", "0.6757563", "0.6711982", "0.67066276", "0.6692652", "0.66810197", "0.66510123", "0.663...
0.8035583
0
Send the JSON file to the selected API endpoint. The optional custom header is used (given it is provided).
def _send_json_file(endpoint, filename, custom_headers=None): headers = {'Content-Type': 'application/json', 'Accept': 'application/json'} if custom_headers is not None: headers.update(custom_headers) with open(filename) as json_data: response = requests.post(endpoint, data=js...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_json_file(self, endpoint, filename):\n headers = {'Content-Type': 'application/json',\n 'Accept': 'application/json'}\n\n headers.update(self.authorization())\n with open(filename) as json_data:\n response = requests.post(endpoint, data=json_data, headers=...
[ "0.728455", "0.60100454", "0.5989386", "0.59265965", "0.5922887", "0.5897828", "0.58942896", "0.57795155", "0.5748968", "0.57196146", "0.5715392", "0.57078165", "0.5632714", "0.56252563", "0.5579078", "0.55781686", "0.5440876", "0.53878236", "0.5384645", "0.5384645", "0.53406...
0.74872756
0
Check if given environment variable exist. Check the existence of environment variable needed to connect to the AWS S3 database.
def _check_env_var_presence_s3_db(env_var_name): if os.environ.get(env_var_name) is None: logger.info("Warning: the {name} environment variable is not set.\n" "All tests that access AWS S3 database will fail\n".format( name=env_var_name))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_envvar(envvar):\n if not os.environ.get(envvar):\n raise EnvironmentError(\"Variable '%s' not set\" % envvar)", "def test_environ_vars_available(self) -> None:\n self.assertIsNotNone(os.environ.get('AWS_ACCESS_KEY_ID'))\n self.assertIsNotNone(os.environ.get('AWS_SECRET_KEY'))\n ...
[ "0.7573115", "0.746895", "0.7198972", "0.7155614", "0.70553595", "0.6951461", "0.69158894", "0.6749286", "0.6720157", "0.67106384", "0.6675638", "0.6675638", "0.6604065", "0.6588491", "0.65775776", "0.65393454", "0.6451127", "0.6432441", "0.6409005", "0.64020705", "0.6384522"...
0.86543125
0
Check the test environent whether tests are run locally or in Docker.
def check_test_environment(context, coreapi_url): if context.running_locally: logger.info("Note: integration tests are running localy via docker-compose") if coreapi_url: _check_env_for_remote_tests("F8A_API_URL") _check_env_for_remote_tests("F8A_JOB_API_URL") _ch...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check():\n cmake('tests')\n docker('./{build}/tests', build=BUILD)", "def is_docker_env() -> bool:\n return Path(\"/.dockerenv\").exists()", "def in_host():\n return not in_docker()", "def _in_travis(): # pragma: no cover\n return 'TRAVIS' in os.environ", "def is_inside_im_container() -...
[ "0.7085454", "0.6972889", "0.6836361", "0.680045", "0.6660223", "0.64918905", "0.6490152", "0.6429396", "0.64235157", "0.6407268", "0.6385829", "0.6385829", "0.63703775", "0.6327769", "0.62010854", "0.6197625", "0.6145367", "0.6106998", "0.61064464", "0.6063737", "0.60425466"...
0.7772756
0
Check the basic structure of response with access token.
def check_token_structure(data): assert "token" in data token_structure = data["token"] assert "access_token" in token_structure assert "token_type" in token_structure assert "expires_in" in token_structure
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_response(self, res: requests.Response, token: str) -> None:\n return", "def test_get_token_response_is_correct(self):\n resp = self.client.get('/v3/auth/tokens')\n\n self.assert_status(resp, 201)\n self.assertEquals(resp.content_type, 'application/json')", "def _check_tok...
[ "0.7235304", "0.7022099", "0.6986698", "0.6742272", "0.6740001", "0.67229813", "0.66890514", "0.66066724", "0.65918523", "0.6562969", "0.6557273", "0.65550774", "0.65403134", "0.65298235", "0.65127647", "0.6506141", "0.64695024", "0.64605296", "0.6407249", "0.63836205", "0.63...
0.71028525
1
Get the current stock level for a product.
def get_stock_level(cls, product): available_stock_level = cls.available_stock_level(product.sku) StockLevelHistory.objects.new_import_stock_level_update( product=product, stock_level=available_stock_level ) return available_stock_level
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_initial_stock_level(cls, product):\n try:\n instance = InitialStockLevel.objects.get(sku=product.sku)\n except InitialStockLevel.DoesNotExist:\n return None\n else:\n return instance.stock_level", "def _get_stock_level__info_from_linnworks(cls, sku):\...
[ "0.7975026", "0.68074864", "0.67956704", "0.6778341", "0.6626684", "0.6621337", "0.65481734", "0.64591295", "0.64310557", "0.6292551", "0.6272004", "0.6258781", "0.6215204", "0.6184986", "0.61785865", "0.6176363", "0.6151966", "0.61401266", "0.61293405", "0.607665", "0.605996...
0.86454695
0
Get the current stock level for multiple products.
def get_stock_levels(cls, products): skus = products.values_list("sku", flat=True) stock_level_records = cls._get_multiple_stock_level_info_from_linnworks(*skus) with transaction.atomic(): for product in products: StockLevelHistory.objects.new_import_stock_level_updat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_stock_level(cls, product):\n available_stock_level = cls.available_stock_level(product.sku)\n StockLevelHistory.objects.new_import_stock_level_update(\n product=product, stock_level=available_stock_level\n )\n return available_stock_level", "def get_initial_stock_le...
[ "0.78233457", "0.70803547", "0.66599005", "0.65330136", "0.64730215", "0.63465714", "0.61681795", "0.61516035", "0.609274", "0.60331887", "0.601192", "0.60093623", "0.5968689", "0.58623636", "0.58594537", "0.5815411", "0.58009183", "0.5797005", "0.5761796", "0.57290524", "0.5...
0.73661983
1
Get the temporary intial stock level for a new product.
def get_initial_stock_level(cls, product): try: instance = InitialStockLevel.objects.get(sku=product.sku) except InitialStockLevel.DoesNotExist: return None else: return instance.stock_level
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_stock_level(cls, product):\n available_stock_level = cls.available_stock_level(product.sku)\n StockLevelHistory.objects.new_import_stock_level_update(\n product=product, stock_level=available_stock_level\n )\n return available_stock_level", "def set_initial_stock_le...
[ "0.77785766", "0.6799256", "0.6544615", "0.63310117", "0.6160742", "0.61123455", "0.59186417", "0.5671332", "0.56181884", "0.5612365", "0.55716836", "0.5571019", "0.55592614", "0.5517988", "0.55118215", "0.54798126", "0.5474257", "0.54507595", "0.5439992", "0.5430552", "0.542...
0.7681855
1
Update the stock level for a product.
def set_stock_level(cls, product, user, new_stock_level, change_source=""): available_stock_level = cls.available_stock_level(sku=product.sku) relative_stock_level_change = new_stock_level - available_stock_level change_source = change_source or f"Updated through STCAdmin by {user}" upda...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_stock_level(cls, product):\n available_stock_level = cls.available_stock_level(product.sku)\n StockLevelHistory.objects.new_import_stock_level_update(\n product=product, stock_level=available_stock_level\n )\n return available_stock_level", "def save(self, *args, **...
[ "0.7103011", "0.69509274", "0.68693435", "0.6788985", "0.6534898", "0.64501613", "0.6209903", "0.6202093", "0.6182717", "0.6155275", "0.60498655", "0.6035019", "0.6031203", "0.597725", "0.59372586", "0.5936088", "0.5852151", "0.58444107", "0.5841381", "0.58096075", "0.5778932...
0.76101154
0
Return a history of stock level changes for a SKU.
def get_stock_level_history(cls, sku): records = cls._get_stock_level_history(sku) return [ { "timestamp": record.timestamp, "stock_level": record.stock_level, "text": record.text, "relative_change": record.relative_change, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stock_level_info(cls, sku):\n return cls._get_stock_level__info_from_linnworks(sku)", "def recorded_stock_level(cls, *skus):\n update = StockLevelExportUpdate.objects.latest()\n records = StockLevelExportRecord.objects.filter(\n product__sku__in=skus, stock_level_update=update...
[ "0.6653443", "0.6470306", "0.6444246", "0.62727344", "0.6041416", "0.59631824", "0.59041005", "0.58030045", "0.579046", "0.5771174", "0.574723", "0.5717658", "0.5667479", "0.5653224", "0.56333935", "0.5631744", "0.56092733", "0.55707073", "0.55588335", "0.552834", "0.5502277"...
0.8622037
0
Return stock level information for a product SKU.
def stock_level_info(cls, sku): return cls._get_stock_level__info_from_linnworks(sku)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_stock_level__info_from_linnworks(cls, sku):\n return linnapi.inventory.get_stock_level_by_sku(sku=sku)", "def available_stock_level(cls, sku):\n stock_level_info = cls.stock_level_info(sku)\n return stock_level_info.available", "def get_stock_level(cls, product):\n availabl...
[ "0.8229937", "0.77503586", "0.7536986", "0.7009773", "0.6737878", "0.67187744", "0.6565997", "0.65189314", "0.6503355", "0.6183571", "0.6153029", "0.6153029", "0.6114212", "0.6081748", "0.5955857", "0.59486717", "0.59486717", "0.5891367", "0.5885439", "0.5821629", "0.5821629"...
0.8824631
0
Return True if all SKUs exist in Linnworks, otherwise False.
def products_exist(cls, *skus): try: stock_level_ids = cls._get_stock_item_ids(*skus) except linnapi.exceptions.InvalidResponseError: return False if not set(skus).issubset(set(stock_level_ids.keys())): return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checker(product):\n for item in INSTOCK:\n if item == product:\n return True\n return False", "def available(name):\n return name in get_all()", "async def contains(self, key: datastore.Key) -> bool:\n\t\tfor store in self._stores:\n\t\t\tif await store.contains(key):\n\t\t\t\tre...
[ "0.59433883", "0.5891937", "0.57773954", "0.572666", "0.56900984", "0.5678442", "0.562304", "0.5603981", "0.55992395", "0.55668586", "0.5534463", "0.5533152", "0.55312425", "0.55312425", "0.5522889", "0.5522342", "0.5501154", "0.5475581", "0.5435014", "0.5430746", "0.5423793"...
0.7234608
0
Return channel linked items for SKUs.
def channel_links(cls, *skus): links = cls._get_channel_linked_items(*skus) output = defaultdict(lambda: defaultdict(list)) for sku, sku_links in links.items(): for channel in LinnworksChannel.objects.all(): for link in sku_links: if ( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def request_channel_items(\n self, page, keyword='', show_linked=True, show_unlinked=True,\n show_on_page=50):\n request = GetChannelItems(\n self.api_session, self.channel_id, self.source, self.sub_source,\n show_linked=show_linked, show_unlinked=show_unlinked, p...
[ "0.57261294", "0.5454687", "0.5351223", "0.530747", "0.528651", "0.5236663", "0.52220523", "0.52177167", "0.52097195", "0.5180705", "0.51764345", "0.51686364", "0.51534677", "0.50684905", "0.50655085", "0.5037654", "0.503156", "0.5025536", "0.49919096", "0.49683672", "0.49414...
0.6566989
0
Return stock item IDs for one or more SKUs.
def _get_stock_item_ids(cls, *skus): return linnapi.inventory.get_stock_item_ids_by_sku(*skus)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_skus():\n sku_ids = set()\n for sku_id in sku_database.find({}, {\"_id\": 0, \"SKU_id\": 1}):\n if sku_id.get(\"SKU_id\"):\n sku_ids.add(sku_id[\"SKU_id\"])\n else:\n continue\n\n return list(sku_ids)", "def get_items(self):\n\n items = []\n\n ...
[ "0.60386074", "0.5877784", "0.5850191", "0.5564648", "0.5518621", "0.5510836", "0.54726046", "0.5405433", "0.54011416", "0.5322821", "0.5274925", "0.521478", "0.5211524", "0.51584136", "0.5150719", "0.514397", "0.5127577", "0.5125728", "0.5118117", "0.5089163", "0.50639", "...
0.85865766
0
Return stock level information for a product SKU.
def _get_stock_level__info_from_linnworks(cls, sku): return linnapi.inventory.get_stock_level_by_sku(sku=sku)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stock_level_info(cls, sku):\n return cls._get_stock_level__info_from_linnworks(sku)", "def available_stock_level(cls, sku):\n stock_level_info = cls.stock_level_info(sku)\n return stock_level_info.available", "def get_stock_level(cls, product):\n available_stock_level = cls.avai...
[ "0.8824631", "0.77503586", "0.7536986", "0.7009773", "0.6737878", "0.67187744", "0.6565997", "0.65189314", "0.6503355", "0.6183571", "0.6153029", "0.6153029", "0.6114212", "0.6081748", "0.5955857", "0.59486717", "0.59486717", "0.5891367", "0.5885439", "0.5821629", "0.5821629"...
0.8229937
1
Return stock level information for multiple product SKUs.
def _get_multiple_stock_level_info_from_linnworks(cls, *skus): if not skus: return {} return linnapi.inventory.get_stock_levels_by_skus(*skus)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stock_level_info(cls, sku):\n return cls._get_stock_level__info_from_linnworks(sku)", "def _get_stock_level__info_from_linnworks(cls, sku):\n return linnapi.inventory.get_stock_level_by_sku(sku=sku)", "def get_stock_levels(cls, products):\n skus = products.values_list(\"sku\", flat=Tru...
[ "0.7849442", "0.7608624", "0.75110203", "0.70191705", "0.6930921", "0.66814154", "0.62600654", "0.61519235", "0.6082991", "0.583082", "0.5801799", "0.5739271", "0.5717464", "0.5695087", "0.568916", "0.56352705", "0.54917514", "0.5481735", "0.53914833", "0.53471345", "0.533668...
0.7669444
1
Return the total number of items in stock.
def stock_count(self): return self.stock_level_records.aggregate(models.Sum("stock_level"))[ "stock_level__sum" ]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_numStocks(self):\n return len(self.DoS)", "def num_items(self):\n num_items = 0\n for line in self.lines.all():\n num_items += line.quantity\n return num_items", "def count_items(self):\n count = 0\n for o in self.order_lst:\n count += o.c...
[ "0.7388547", "0.7379074", "0.7302415", "0.7249715", "0.71613944", "0.7151938", "0.7118709", "0.7084765", "0.7064341", "0.70529896", "0.7047173", "0.6938453", "0.6902857", "0.6891417", "0.68682635", "0.68492645", "0.6829879", "0.6824458", "0.6810021", "0.67641544", "0.6744819"...
0.7622305
0
Return if perform importing, based on checking zexp files in /import directory.
def checkIfImport(): instance_ipath, product_ipath = getImportedPathes() product_ilist = [i for i in os.listdir(product_ipath) \ if osp.isfile(osp.join(product_ipath,i)) and i.endswith('.zexp')] if product_ilist: return 1 return 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_import():\n return sync_mode in (SyncMode.IMPORT_LOCAL, SyncMode.IMPORT_REMOTE)", "def imports(self):\n line = self.line.strip()\n if line.startswith('im'):\n if line.startswith('import') is False:\n return True\n elif line == '':\n return True"...
[ "0.6689702", "0.65143263", "0.63264966", "0.60910213", "0.60741305", "0.60403466", "0.60024047", "0.59149635", "0.5831564", "0.58145857", "0.5812378", "0.5784449", "0.57167757", "0.57130134", "0.5711915", "0.56874937", "0.56806207", "0.5678624", "0.5662329", "0.55868036", "0....
0.80718017
0
Return Plone instance and Skin product import pathes.
def getImportedPathes(): # Based on instance path, construct import pathes cfg = getConfiguration() instance_ipath = osp.join(cfg.instancehome, "import") product_ipath = osp.join(package_home(GLOBALS), "import") # Check presence of Product import directory if not osp.isdir(product_ipath): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copyToInstanceImport():\n print >> import_out, INTRO_TO_INSTANCE\n instance_ipath, product_ipath = getImportedPathes()\n\n # Compose temp dir back_[date] dir path in Instance import directory\n temp_dir_id = \"back_%s\" % strftime(\"%Y%m%d%H%M%S\", gmtime())\n temp_dir_path = osp.join(instance_i...
[ "0.60475075", "0.512264", "0.50769174", "0.501878", "0.50102895", "0.50094783", "0.50048816", "0.4983643", "0.49736297", "0.49705213", "0.4953559", "0.4949259", "0.4940075", "0.49227905", "0.49213436", "0.4902615", "0.4888882", "0.48643917", "0.48296902", "0.47972006", "0.478...
0.65622646
0
Move samenamed files from Instanse's dir to temp dir.
def moveToTemp(same_instance_files, instance_ipath, temp_dir_path): os.mkdir(temp_dir_path) # Create temp back_[date] dir try: [copyFile(instance_ipath, temp_dir_path, f_name) for f_name in same_instance_files] [os.remove(osp.join(instance_ipath, f_name)) for f_name in same_instance_files] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_from_temp_directory(self):", "def handle_tmp_extracted(dir: str):\n if not dir.startswith(\"/\"):\n dir = os.path.absname(dir)\n import_name = os.path.basename(dir)\n sub_dir = f\"{dir}/Takeout\"\n assert os.path.isdir(dir) and os.path.isdir(sub_dir)\n assert os.path.isdir(target_a...
[ "0.78957987", "0.631066", "0.60948616", "0.6024184", "0.5967517", "0.5847319", "0.5834216", "0.5803895", "0.58007216", "0.5800085", "0.57811874", "0.5779987", "0.5762405", "0.5750412", "0.5736834", "0.5736834", "0.57231766", "0.572187", "0.56780314", "0.5665179", "0.56462777"...
0.7135775
1
Perform copying imported files from /import dir to Plone's instance import dir.
def copyToInstanceImport(): print >> import_out, INTRO_TO_INSTANCE instance_ipath, product_ipath = getImportedPathes() # Compose temp dir back_[date] dir path in Instance import directory temp_dir_id = "back_%s" % strftime("%Y%m%d%H%M%S", gmtime()) temp_dir_path = osp.join(instance_ipath, temp_dir_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def executeImports():\n\tglobal cactusConfig\n\tinputPath = cactusConfig['inputPath']\n\toutputPath = cactusConfig['outputPath']\n\n\t#find all html files in input path\n\tfor filename in glob.glob(os.path.join(inputPath, '*.html')):\n\t\tif os.path.basename(filename) not in cactusConfig:\n\t\t\timportIntoFile(fil...
[ "0.64455897", "0.6293776", "0.62083894", "0.61261725", "0.6004535", "0.60034525", "0.59733075", "0.5954557", "0.59396386", "0.5933255", "0.59181863", "0.5917292", "0.58093524", "0.5755437", "0.57479215", "0.57039285", "0.56993216", "0.5692062", "0.5660959", "0.56176054", "0.5...
0.74273926
0
Perfom backup same named portal objects in temp folder.
def makeBackUp(portal, portal_objects, temp_dir_path, obj_id): # Get id of temp folder-object durty_path,temp_id = osp.split(temp_dir_path) if not temp_id: durty_path,temp_id = osp.split(durty_path) # Get temp folder-object if temp_id not in portal_objects: portal.invokeFactory('L...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __makeBackup(self):\n pass #FIXME!!!", "def backup(self):\n import datetime\n suffix = datetime.datetime.now().strftime('%Y-%m-%d--%H-%M-%S')\n self.host.run(\"test -f '%s' && cp --archive '%s' '%s.%s'\" % (\n esc1(self.remote_path), esc1(self.remote_path), ...
[ "0.6638991", "0.60802615", "0.6063167", "0.5923381", "0.59127176", "0.5897796", "0.5870464", "0.58584565", "0.5843003", "0.582764", "0.57654107", "0.5751813", "0.57227737", "0.5719126", "0.5715519", "0.57077056", "0.5696699", "0.56780267", "0.5675559", "0.56728834", "0.564588...
0.7360031
0
Import all objects from zexp files to portal root (based on IMPORT_POLICY).
def importToPortalRoot(portal, product_file_names, temp_dir_path): if not IMPORT_POLICY in ALLOWED_IMPORT_POLICY: raise Exception("%s - wrong import policy, must be one of the %s" \ % (IMPORT_POLICY, ALLOWED_IMPORT_POLICY) ) print >> import_out, INTRO_TO_ROOT % (product_file_na...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_import(self, expanded, unexpanded) : \n\t\tif not unexpanded :\n\t\t\treturn self.errormessage(\"Needs some filenames to import\")\n\t\tif not self.HasPerms(self.__context, 'Import/Export objects') :\n\t\t\treturn -1\n\t\tfor filename in unexpanded :\n\t\t\tself.__context.manage_importObject(filename)\n\...
[ "0.6061871", "0.6020753", "0.6020753", "0.59407675", "0.5928573", "0.5911126", "0.5891137", "0.5757732", "0.5486214", "0.5421777", "0.5270001", "0.52444345", "0.523715", "0.5223723", "0.5178999", "0.5171578", "0.51592106", "0.51357245", "0.50601596", "0.50400037", "0.50124675...
0.6083432
0