query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Add gene IDs manually into the GEMPRO project.
def add_gene_ids(self, genes_list): orig_num_genes = len(self.genes) for g in list(set(genes_list)): if not self.genes.has_id(g): new_gene = GenePro(id=g, pdb_file_type=self.pdb_file_type, root_dir=self.genes_dir) if self.model: self.model...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _add_transform_genes(self):\n self._alleles.add(pu.make_int_gene(1, 1, 10, 1)) # 'AR' backshift (p)\n self._alleles.add(pu.make_choice_gene(1, [0, 1, 2])) # 'I' backshift (d) \n self._alleles.add(pu.make_choice_gene(1, [1, 2, 3])) # 'MA' backshift (q)\n self._alleles.add(pu.make_int...
[ "0.6379106", "0.6361385", "0.6263955", "0.596308", "0.59268", "0.5925437", "0.59055984", "0.5817298", "0.5774752", "0.5773884", "0.5769448", "0.575296", "0.57183534", "0.5694724", "0.5691077", "0.5668569", "0.5660597", "0.56413335", "0.5637899", "0.5637372", "0.56202716", "...
0.787999
0
Map all genes in the model to KEGG IDs using the KEGG service.
def kegg_mapping_and_metadata(self, kegg_organism_code, custom_gene_mapping=None, outdir=None, set_as_representative=False, force_rerun=False): # First map all of the organism's KEGG genes to UniProt kegg_to_uniprot = ssbio.databases.kegg.map_kegg_all_genes(organism_co...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def kegg_converter():\n from tools import prot_id_converter\n \n protList = []\n headerFlag = True\n with open(\"../bob/processed/24h_bobprots_up_full.csv\",\"r\") as inpF:\n for inpLine in inpF:\n if headerFlag:\n headerFlag = False\n continue\n inpList = inpLine.split(\",\")\n ...
[ "0.563114", "0.5574154", "0.5559782", "0.5551251", "0.5546921", "0.5503381", "0.54362684", "0.5342943", "0.5341184", "0.5323929", "0.5317131", "0.53079814", "0.53045225", "0.5293822", "0.5272457", "0.5237042", "0.51907456", "0.5179292", "0.51766217", "0.5175532", "0.51710236"...
0.55860746
1
Map all genes in the model to KEGG IDs using the KEGG service.
def kegg_mapping_and_metadata_parallelize(self, sc, kegg_organism_code, custom_gene_mapping=None, outdir=None, set_as_representative=False, force_rerun=False): # First map all of the organism's KEGG genes to UniProt kegg_to_uniprot = ssbio.databases.kegg.ma...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def kegg_converter():\n from tools import prot_id_converter\n \n protList = []\n headerFlag = True\n with open(\"../bob/processed/24h_bobprots_up_full.csv\",\"r\") as inpF:\n for inpLine in inpF:\n if headerFlag:\n headerFlag = False\n continue\n inpList = inpLine.split(\",\")\n ...
[ "0.563196", "0.55852866", "0.55733615", "0.55593973", "0.55501753", "0.5543938", "0.55040264", "0.54342514", "0.53412634", "0.53399163", "0.532083", "0.5315044", "0.5306522", "0.53050053", "0.52929395", "0.5270264", "0.5236628", "0.51889944", "0.51782745", "0.51738745", "0.51...
0.5175416
19
Map all genes in the model to UniProt IDs using the UniProt mapping service. Also download all metadata and sequences.
def uniprot_mapping_and_metadata(self, model_gene_source, custom_gene_mapping=None, outdir=None, set_as_representative=False, force_rerun=False): # Allow model gene --> custom ID mapping ({'TM_1012':'TM1012'}) if custom_gene_mapping: genes_to_map = list(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def manual_uniprot_mapping(self, gene_to_uniprot_dict, outdir=None, set_as_representative=True):\n for g, u in tqdm(gene_to_uniprot_dict.items()):\n g = str(g)\n gene = self.genes.get_by_id(g)\n\n try:\n uniprot_prop = gene.protein.load_uniprot(uniprot_id=u,\n...
[ "0.75125813", "0.6454647", "0.60671085", "0.6022228", "0.55977786", "0.55617076", "0.55605453", "0.5559257", "0.5417317", "0.537197", "0.5368202", "0.5332463", "0.53020674", "0.5237105", "0.52121115", "0.51696676", "0.5088646", "0.50799626", "0.5067423", "0.50670326", "0.5027...
0.7611813
0
Read a manual dictionary of model gene IDs > UniProt IDs. By default sets them as representative. This allows for mapping of the missing genes, or overriding of automatic mappings.
def manual_uniprot_mapping(self, gene_to_uniprot_dict, outdir=None, set_as_representative=True): for g, u in tqdm(gene_to_uniprot_dict.items()): g = str(g) gene = self.genes.get_by_id(g) try: uniprot_prop = gene.protein.load_uniprot(uniprot_id=u, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def uniprot_mapping_and_metadata(self, model_gene_source, custom_gene_mapping=None, outdir=None,\n set_as_representative=False, force_rerun=False):\n\n # Allow model gene --> custom ID mapping ({'TM_1012':'TM1012'})\n if custom_gene_mapping:\n genes_to_m...
[ "0.6403121", "0.5933689", "0.58469325", "0.58061844", "0.5766849", "0.57401544", "0.5734687", "0.57258844", "0.57226133", "0.57076377", "0.56597966", "0.5640181", "0.5619734", "0.56024665", "0.5573105", "0.5537513", "0.5523887", "0.55108166", "0.54736066", "0.5461213", "0.543...
0.71531695
0
Read a manual input dictionary of model gene IDs > protein sequences. By default sets them as representative.
def manual_seq_mapping(self, gene_to_seq_dict, outdir=None, write_fasta_files=True, set_as_representative=True): if outdir: outdir_set = True else: outdir_set = False # Save the sequence information in individual FASTA files for g, s in gene_to_seq_dict.items(): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def manual_uniprot_mapping(self, gene_to_uniprot_dict, outdir=None, set_as_representative=True):\n for g, u in tqdm(gene_to_uniprot_dict.items()):\n g = str(g)\n gene = self.genes.get_by_id(g)\n\n try:\n uniprot_prop = gene.protein.load_uniprot(uniprot_id=u,\n...
[ "0.578603", "0.5672215", "0.5651235", "0.56188124", "0.55466795", "0.55115235", "0.54341066", "0.5378654", "0.53599185", "0.53536785", "0.5351185", "0.53492874", "0.5341383", "0.53390723", "0.52942526", "0.528401", "0.5254791", "0.5242005", "0.52400976", "0.523667", "0.522224...
0.63073754
0
Automatically consolidate loaded sequences (manual, UniProt, or KEGG) and set a single representative sequence. Manually set representative sequences override all existing mappings. UniProt mappings override KEGG mappings except when KEGG mappings have PDBs associated with them and UniProt doesn't.
def set_representative_sequence(self, force_rerun=False): # TODO: rethink use of multiple database sources - may lead to inconsistency with genome sources successfully_mapped_counter = 0 for g in tqdm(self.genes): repseq = g.protein.set_representative_sequence(force_rerun=force_rer...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initial_sequence_loading(self, work_dir: str):\n # preprocess FASTA with sequences\n # rename IUPAC to N symbols using sed\n fasta_raw = self.from_param(\"manifest_data\", \"fasta_dna\")\n fasta_clean = self.pjc(work_dir, \"fasta\", \"seq_no_iupac.fasta\")\n self.remove_IUP...
[ "0.6016545", "0.593349", "0.5745965", "0.55212516", "0.5425716", "0.5406029", "0.53563493", "0.531381", "0.5310087", "0.530175", "0.5292923", "0.5184581", "0.5143346", "0.5078548", "0.5064941", "0.5030632", "0.4981743", "0.49592844", "0.49414554", "0.4931738", "0.4923748", ...
0.59329545
2
Write all the model's sequences as a single FASTA file. By default, sets IDs to model gene IDs.
def write_representative_sequences_file(self, outname, outdir=None, set_ids_from_model=True): if not outdir: outdir = self.data_dir if not outdir: raise ValueError('Output directory must be specified') outfile = op.join(outdir, outname + '.faa') tmp = [...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_seqs_to_file(self):\n if self.blast_type == 'local':\n self.seq_file = os.path.join(self.cwd,\n 'db',\n \"{0}_seqs.fas\".format(self.gene_code))\n queryset = Sequences.objects.all().filter(gene_cod...
[ "0.7703567", "0.68488854", "0.68150365", "0.66532373", "0.6577866", "0.65711606", "0.6558072", "0.6446043", "0.64120615", "0.6376058", "0.6327507", "0.63195807", "0.6264189", "0.61669415", "0.6066071", "0.6019347", "0.60165673", "0.6009975", "0.600401", "0.5998313", "0.597920...
0.7649602
1
Run Biopython ProteinAnalysis and EMBOSS pepstats to summarize basic statistics of all protein sequences. Results are stored in the protein's respective SeqProp objects at ``.annotations``
def get_sequence_properties(self, clean_seq=False, representatives_only=True): for g in tqdm(self.genes): g.protein.get_sequence_properties(clean_seq=clean_seq, representative_only=representatives_only)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self):\n\n # TODO: MOVE TO INIT?\n self.afile = write_amino_acid_masses()\n self.modfile = self.mods.write_modifications_file(mod_type=\"ptm\")\n self.modfile2 = self.mods.write_modifications_file(mod_type=\"sptm\")\n #\n\n self._read_peptide_information()\n\n ...
[ "0.58181006", "0.5602432", "0.5474755", "0.5441378", "0.5377746", "0.5277402", "0.52675635", "0.5208659", "0.5205044", "0.5202254", "0.51815295", "0.51808584", "0.51549906", "0.5146859", "0.51310307", "0.5126919", "0.5113819", "0.5107288", "0.509881", "0.50788367", "0.5047152...
0.0
-1
Run Biopython ProteinAnalysis and EMBOSS pepstats to summarize basic statistics of all protein sequences. Results are stored in the protein's respective SeqProp objects at ``.annotations``
def get_sequence_sliding_window_properties(self, scale, window, representatives_only=True): for g in tqdm(self.genes): g.protein.get_sequence_sliding_window_properties(scale=scale, window=window, representative_only=representatives_only)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self):\n\n # TODO: MOVE TO INIT?\n self.afile = write_amino_acid_masses()\n self.modfile = self.mods.write_modifications_file(mod_type=\"ptm\")\n self.modfile2 = self.mods.write_modifications_file(mod_type=\"sptm\")\n #\n\n self._read_peptide_information()\n\n ...
[ "0.58185875", "0.56039363", "0.5476142", "0.5443091", "0.5378449", "0.5278634", "0.52680093", "0.52093285", "0.52068824", "0.52031213", "0.51807773", "0.51793027", "0.51542205", "0.5149298", "0.5131479", "0.51278746", "0.511534", "0.51086545", "0.5099683", "0.50781924", "0.50...
0.0
-1
Run and parse ``SCRATCH`` results to predict secondary structure and solvent accessibility.
def get_scratch_predictions(self, path_to_scratch, results_dir, scratch_basename='scratch', num_cores=1, exposed_buried_cutoff=25, custom_gene_mapping=None): if not self.genome_path: # Write all sequences as one file all_seqs = self.write_representative_se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test__rules__std_L003_process_raw_stack(generate_test_segments, test_elems, result):\r\n cfg = FluffConfig()\r\n r = get_rule_from_set(\"L003\", config=cfg)\r\n test_stack = generate_test_segments(test_elems)\r\n res = r._process_raw_stack(test_stack)\r\n print(res)\r\n # Verify structure\r\n...
[ "0.5453937", "0.51707166", "0.5124746", "0.5067195", "0.5060421", "0.50340503", "0.50077313", "0.4995311", "0.49860317", "0.49587095", "0.49418697", "0.49291307", "0.49152204", "0.49127287", "0.49121913", "0.48993307", "0.48830223", "0.48630846", "0.48607942", "0.48574045", "...
0.6049171
0
Parse TMHMM results and store in the representative sequences. This is a basic function to parse prerun TMHMM results. Run TMHMM from the
def get_tmhmm_predictions(self, tmhmm_results, custom_gene_mapping=None): # TODO: refactor to Protein class? tmhmm_dict = ssbio.protein.sequence.properties.tmhmm.parse_tmhmm_long(tmhmm_results) counter = 0 for g in tqdm(self.genes_with_a_representative_sequence): if custom_g...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse(self):\n\n try:\n query = SearchIO.parse(self.resultsFile, \"hmmer3-text\").next()\n except StopIteration:\n raise RuntimeError(\"Invalid HMMER output\")\n\n\n self.hmmLength = query.seq_len\n self.total_gaps = [0]*self.hmmLength\n num_hits = 0\n ...
[ "0.718328", "0.6031104", "0.55474675", "0.554094", "0.54378474", "0.5321816", "0.5314905", "0.52604496", "0.52468085", "0.5240826", "0.52207154", "0.52113825", "0.5194342", "0.5175062", "0.5160311", "0.5124177", "0.5114975", "0.5098633", "0.50890535", "0.50630784", "0.5060001...
0.6237841
1
BLAST each representative protein sequence to the PDB. Saves raw BLAST results (XML files).
def blast_seqs_to_pdb(self, seq_ident_cutoff=0, evalue=0.0001, all_genes=False, display_link=False, outdir=None, force_rerun=False): counter = 0 for g in tqdm(self.genes_with_a_representative_sequence): # If all_genes=False, BLAST only genes without a uniprot -> pd...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exec_blast(infile, config_file, out_name):\n\tdb, evalue = parse_config(config_file, \"blast\")\n\tfasta_string = SeqIO.read(infile, format=\"fasta\")\n\tresult_handle = NCBIWWW.qblast(\"blastp\", \"nr\", fasta_string.seq)\n\toutput= out_name + \".xml\"\n\tsave_file = open(output, \"w\")\n\tsave_file.write(res...
[ "0.66139734", "0.6583862", "0.65296185", "0.64392793", "0.6255687", "0.61307186", "0.610086", "0.6055964", "0.5927576", "0.58890635", "0.58672094", "0.5843568", "0.5821608", "0.5803", "0.5789289", "0.57518595", "0.5740719", "0.5657906", "0.5657839", "0.5632192", "0.56158704",...
0.67663527
0
Map all representative sequences' UniProt ID to PDB IDs using the PDBe "Best Structures" API. Will save a JSON file of the results to each protein's ``sequences`` folder.
def map_uniprot_to_pdb(self, seq_ident_cutoff=0.0, outdir=None, force_rerun=False): # First get all UniProt IDs and check if they have PDBs all_representative_uniprots = [] for g in self.genes_with_a_representative_sequence: uniprot_id = g.protein.representative_sequence.uniprot ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_representative_sequences_file(self, outname, outdir=None, set_ids_from_model=True):\n\n if not outdir:\n outdir = self.data_dir\n if not outdir:\n raise ValueError('Output directory must be specified')\n\n outfile = op.join(outdir, outname + '.faa')\n\n ...
[ "0.610109", "0.6068264", "0.59874815", "0.58739364", "0.5861211", "0.5749738", "0.57296085", "0.5710959", "0.5675845", "0.5658217", "0.5652435", "0.56386983", "0.5631127", "0.5621135", "0.5585365", "0.55756485", "0.5574747", "0.554423", "0.55214447", "0.5519574", "0.5488832",...
0.69787073
0
Copy homology models to the GEMPRO project.
def get_manual_homology_models(self, input_dict, outdir=None, clean=True, force_rerun=False): if outdir: outdir_set = True else: outdir_set = False counter = 0 for g in tqdm(self.genes): if g.id not in input_dict: continue ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def makeModel(self):\n\n # Get the script\n modelScript = os.path.join(self.datapath, 'make3FGLxml.py')\n if not os.path.isfile(modelScript):\n # download it\n print(\"\\t=== Downloading make3FGLxml.py ===\")\n os.system('wget https://fermi.gsfc.nasa.gov/ssc/da...
[ "0.5996931", "0.5607615", "0.5403388", "0.539973", "0.5358105", "0.53344375", "0.5272187", "0.5250301", "0.5243482", "0.5218756", "0.5218072", "0.52161586", "0.51627207", "0.51617354", "0.51608515", "0.51242393", "0.5118167", "0.51130074", "0.51084733", "0.50734", "0.50628847...
0.61267424
0
Copy generated ITASSER models from a directory to the GEMPRO directory.
def get_itasser_models(self, homology_raw_dir, custom_itasser_name_mapping=None, outdir=None, force_rerun=False): counter = 0 for g in tqdm(self.genes): if custom_itasser_name_mapping and g.id in custom_itasser_name_mapping: hom_id = custom_itasser_name_mapping[g.id] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copyModels():\n\n # Create the local path if it doesn't exist\n createPath(opts.local_path)\n if not opts.local_path.endswith('/'): opts.local_path = opts.local_path + '/'\n\n sys.stdout.write(\"Copying the model files to the local path: %s ...\\n\\n\" % (opts.local_path))\n\n \"\"\"\n # Copy...
[ "0.6478024", "0.6302617", "0.60242254", "0.5965898", "0.5961495", "0.5955651", "0.591861", "0.58981764", "0.5849643", "0.58346474", "0.5819575", "0.581556", "0.5721305", "0.57172716", "0.57066035", "0.5671232", "0.5665389", "0.56633633", "0.5657864", "0.56418204", "0.56418204...
0.6195266
2
Set all representative structure for proteins from a structure in the structures attribute. Each gene can have a combination of the following, which will be analyzed to set a representative structure. Homology model(s) Ranked PDBs BLASTed PDBs If the ``always_use_homology`` flag is true, homology models are always set ...
def set_representative_structure(self, seq_outdir=None, struct_outdir=None, pdb_file_type=None, engine='needle', always_use_homology=False, rez_cutoff=0.0, seq_ident_cutoff=0.5, allow_missing_on_termini=0.2, a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _use_structure_for_label(self, configuration):\n\n # Initialize with the current user option value\n use_structures = self.options['structures']\n\n # But don't use structures if one or more species in the configuration \n # do not have structure data\n for spec in configurat...
[ "0.5631592", "0.5539555", "0.5113406", "0.50993943", "0.5098184", "0.5064794", "0.5059432", "0.49745953", "0.4968545", "0.4948768", "0.4903572", "0.490325", "0.48968196", "0.4873015", "0.4863114", "0.4784549", "0.4777041", "0.47675347", "0.47664335", "0.47510993", "0.47313488...
0.7305333
0
Prepare to run ITASSER homology modeling for genes without structures, or all genes.
def prep_itasser_modeling(self, itasser_installation, itlib_folder, runtype, create_in_dir=None, execute_from_dir=None, all_genes=False, print_exec=False, **kwargs): if not create_in_dir: if not self.data_dir: raise ValueError('Output directory must be spe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build(self):\n\t\n\t\tprint 'BUILDING HOMOLOGY MODELS'\n\t\tif self.procedure != 'mutator': self.get_targets()\n\t\tself.get_templates()\n\t\tif self.procedure == 'single': self.build_model_single()\n\t\telif self.procedure == 'multi': self.build_model_multi()\n\t\telif self.procedure == 'mutator': self.build_...
[ "0.5894737", "0.587222", "0.58079857", "0.5715369", "0.5680783", "0.56516254", "0.564085", "0.56005704", "0.5589831", "0.5576413", "0.5542736", "0.551361", "0.5513122", "0.55016124", "0.550024", "0.5468261", "0.54510504", "0.5430583", "0.54272515", "0.542462", "0.54098403", ...
0.60910213
0
Download ALL mapped experimental structures to each protein's structures directory.
def pdb_downloader_and_metadata(self, outdir=None, pdb_file_type=None, force_rerun=False): if not pdb_file_type: pdb_file_type = self.pdb_file_type counter = 0 for g in tqdm(self.genes): pdbs = g.protein.pdb_downloader_and_metadata(outdir=outdir, pdb_file_type=pdb_file_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download_structure(self):\n pdbl = PDBList()\n pdbl.retrieve_pdb_file(self.struct_name, pdir=self.struct_dir)", "def download_models_and_data():\n\n for file in DATA_FILES:\n download_file(file[\"url\"], file[\"path\"])", "def download_genotype_data():\n print(\"downloading genot...
[ "0.6037206", "0.59987074", "0.5837045", "0.5769285", "0.57660973", "0.57463247", "0.57460105", "0.56247157", "0.5559726", "0.5527695", "0.545999", "0.5443209", "0.54300445", "0.5329254", "0.5288044", "0.5280283", "0.52704644", "0.52487636", "0.5248658", "0.5201878", "0.519949...
0.5401219
13
Run DSSP on structures and store calculations.
def get_dssp_annotations(self, representatives_only=True, force_rerun=False): for g in tqdm(self.genes): g.protein.get_dssp_annotations(representative_only=representatives_only, force_rerun=force_rerun)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def call_dssp(self):\n import dssp_features\n output_name_A = \"output/\" + self.complex_name + \"_\" + self.chains[0] + \"_dssp.txt\"\n dssp_command_A = \"dssp -i \" + self.complex_name_A + \" > \" + output_name_A\n os.system(dssp_command_A)\n dssp_chain_A = dssp_features.DSSP_f...
[ "0.70517874", "0.58411133", "0.56528515", "0.5490418", "0.5473682", "0.54647654", "0.5445875", "0.5428461", "0.54253674", "0.535116", "0.5342631", "0.5324522", "0.53242445", "0.5322637", "0.5322276", "0.5304264", "0.5298354", "0.5294854", "0.5272032", "0.5269717", "0.5267885"...
0.0
-1
Run DSSP on structures and store calculations.
def get_dssp_annotations_parallelize(self, sc, representatives_only=True, force_rerun=False): genes_rdd = sc.parallelize(self.genes) def get_dssp_annotation(g): g.protein.get_dssp_annotations(representative_only=representatives_only, force_rerun=force_rerun) return g re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def call_dssp(self):\n import dssp_features\n output_name_A = \"output/\" + self.complex_name + \"_\" + self.chains[0] + \"_dssp.txt\"\n dssp_command_A = \"dssp -i \" + self.complex_name_A + \" > \" + output_name_A\n os.system(dssp_command_A)\n dssp_chain_A = dssp_features.DSSP_f...
[ "0.70526546", "0.58418775", "0.5653659", "0.54898846", "0.5473753", "0.54652107", "0.5447118", "0.54290944", "0.5425851", "0.5350949", "0.53426653", "0.5324783", "0.5324408", "0.5323901", "0.53231215", "0.53046083", "0.5298966", "0.52963674", "0.5272521", "0.5269802", "0.5269...
0.0
-1
Run MSMS on structures and store calculations.
def get_msms_annotations(self, representatives_only=True, force_rerun=False): for g in tqdm(self.genes): g.protein.get_msms_annotations(representative_only=representatives_only, force_rerun=force_rerun)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def perform_calculations(collector):\n result = {}\n try:\n radius, mass = Calculator.calculate_radius_mass(collector)\n result['radius'] = radius\n result['mass'] = mass\n average_density = Calculator.calculate_average_density(radius,\n ...
[ "0.6071868", "0.58869225", "0.5866962", "0.58051217", "0.5799538", "0.5704183", "0.5637838", "0.5555172", "0.54383713", "0.5412853", "0.5401304", "0.5325587", "0.5311658", "0.53054404", "0.52957356", "0.5240921", "0.5220982", "0.5193444", "0.5183969", "0.51734614", "0.5167927...
0.0
-1
Run MSMS on structures and store calculations.
def get_msms_annotations_parallelize(self, sc, representatives_only=True, force_rerun=False): genes_rdd = sc.parallelize(self.genes) def get_msms_annotation(g): g.protein.get_msms_annotations(representative_only=representatives_only, force_rerun=force_rerun) return g re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def perform_calculations(collector):\n result = {}\n try:\n radius, mass = Calculator.calculate_radius_mass(collector)\n result['radius'] = radius\n result['mass'] = mass\n average_density = Calculator.calculate_average_density(radius,\n ...
[ "0.6071868", "0.58869225", "0.5866962", "0.58051217", "0.5799538", "0.5704183", "0.5637838", "0.5555172", "0.54383713", "0.5412853", "0.5401304", "0.5325587", "0.5311658", "0.53054404", "0.52957356", "0.5240921", "0.5220982", "0.5193444", "0.5183969", "0.51734614", "0.5167927...
0.0
-1
Run freesasa on structures and store calculations.
def get_freesasa_annotations(self, include_hetatms=False, representatives_only=True, force_rerun=False): for g in tqdm(self.genes): g.protein.get_freesasa_annotations(include_hetatms=include_hetatms, representative_only=representatives_only, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_analysis(self):\n\n self._apply_loads_to_framat_model()\n\n # ----- Run the FramAT analysis -----\n results = standard_run(args=StdRunArgs(filename=self.own_files['model_file'], verbose=True))\n self.last_solution = results\n\n # ----- Share loads -----\n logger.in...
[ "0.6980309", "0.6318951", "0.6232673", "0.60748464", "0.5921279", "0.5824286", "0.5790136", "0.5772901", "0.57608694", "0.57494456", "0.57234335", "0.56578684", "0.5651609", "0.5612166", "0.5606721", "0.5604897", "0.5604186", "0.55726767", "0.55719376", "0.55543053", "0.55538...
0.0
-1
Run freesasa on structures and store calculations.
def get_freesasa_annotations_parallelize(self, sc, include_hetatms=False, representatives_only=True, force_rerun=False): genes_rdd = sc.parallelize(self.genes) def get_freesasa_annotation(g): g.protein.get_freesasa_annotations(include_hetatms=inc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_analysis(self):\n\n self._apply_loads_to_framat_model()\n\n # ----- Run the FramAT analysis -----\n results = standard_run(args=StdRunArgs(filename=self.own_files['model_file'], verbose=True))\n self.last_solution = results\n\n # ----- Share loads -----\n logger.in...
[ "0.69801366", "0.6316988", "0.6230642", "0.60748374", "0.5920034", "0.5824195", "0.5789938", "0.577425", "0.5760711", "0.5749059", "0.57218057", "0.56583464", "0.56520665", "0.56142336", "0.56094056", "0.5603997", "0.5603649", "0.5574297", "0.55710286", "0.5553558", "0.555345...
0.0
-1
Run Biopython's disulfide bridge finder and store found bridges.
def find_disulfide_bridges(self, representatives_only=True): for g in tqdm(self.genes): g.protein.find_disulfide_bridges(representative_only=representatives_only)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bridge(gwc = 0, brc = bridge_int):\n# bridge interface list\n br_interface = []\n# bridge ip addresses list\n gw_ipaddr = []\n# bridge network list\n gw_network = []\n# gatweway start number list\n gw_number = 0\n\n# fill all lists for bridge\n for i in netifaces.ifaddresses(bridge_int)[netifaces.AF_...
[ "0.5722066", "0.56421185", "0.55387205", "0.54129124", "0.5339122", "0.5317713", "0.5291248", "0.5289518", "0.5201121", "0.51779175", "0.5120208", "0.50416565", "0.5035486", "0.5010023", "0.49626023", "0.49342176", "0.49176186", "0.48929974", "0.4889427", "0.48860794", "0.488...
0.53551966
4
Run Biopython's disulfide bridge finder and store found bridges.
def find_disulfide_bridges_parallelize(self, sc, representatives_only=True): genes_rdd = sc.parallelize(self.genes) def find_disulfide_bridges(g): g.protein.find_disulfide_bridges(representative_only=representatives_only) return g result = genes_rdd.map(find_disulfide_b...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bridge(gwc = 0, brc = bridge_int):\n# bridge interface list\n br_interface = []\n# bridge ip addresses list\n gw_ipaddr = []\n# bridge network list\n gw_network = []\n# gatweway start number list\n gw_number = 0\n\n# fill all lists for bridge\n for i in netifaces.ifaddresses(bridge_int)[netifaces.AF_...
[ "0.572413", "0.5640543", "0.5538764", "0.541415", "0.53536755", "0.5339713", "0.5318477", "0.52893317", "0.52017176", "0.51782423", "0.51200026", "0.5042514", "0.50359213", "0.50109833", "0.49614125", "0.493445", "0.49191326", "0.48949632", "0.4889931", "0.48860416", "0.48856...
0.5290128
7
Save all Proteins as pickle files currently development code for parallelization purposes. Also clears the protein attribute in all genes!
def save_protein_pickles_and_reset_protein(self): self.gene_protein_pickles = {} for g in tqdm(self.genes): if g.protein.representative_sequence: initproteinpickle = op.join(g.protein.protein_dir, '{}_protein.pckl'.format(g.id)) g.protein.save_pickle(initprote...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _save(self):\n # TODO: Use local.punny dump (when written)\n with open(filename, 'w') as f:\n pickle = Pickler(f)\n pickle.dump(self.pungen.puns)", "def save_all(cls, dirpath=\".\"):\n for n, v in cls.__data.items():\n pickle.dump(v, open(cls.dirpath + n ...
[ "0.6193186", "0.61119145", "0.5805404", "0.5757874", "0.57536", "0.5635413", "0.5633482", "0.5631325", "0.5616221", "0.56147355", "0.55816686", "0.55774343", "0.553683", "0.5520816", "0.55060923", "0.5493343", "0.54926723", "0.54900473", "0.5416714", "0.54038894", "0.53814983...
0.7695337
0
run the quantum circuit.
def run(self, shots=DEF_SHOTS, reset_qubits=True, reset_cmem=True, reset_qcirc=True): if self.backend.name == 'qlazy_qstate_simulator': result = run_qlazy_qstate_simulator(self.qstate, self.qcirc, self.cmem, shots=shots) self.reset(reset_qubits, reset_cmem, reset_qcirc) elif self...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_sim(self):\n self.operator, var_form, opt = self.generate_VQE_args()\n\n backend = Aer.get_backend('statevector_simulator')\n quantum_instance = QuantumInstance(backend=backend)\n vqe = VQE(self.operator, var_form, opt) \n\n self.result = vqe.run(quantum_instance)\n solution = self.extrac...
[ "0.6475484", "0.6457555", "0.63491386", "0.62814707", "0.62131155", "0.6070016", "0.60595435", "0.6031392", "0.6018739", "0.59974253", "0.5992952", "0.59413075", "0.5863184", "0.5856578", "0.5853362", "0.57980144", "0.5766902", "0.5748436", "0.57332987", "0.5721311", "0.57128...
0.54874796
47
add measurement gate (Zbasis).
def measure(self, qid, cid=None, ctrl=None): self.__add_quantum_gate(kind=MEASURE, qid=qid, cid=cid, ctrl=ctrl) return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _represent_ZGate(self, basis, **options):\n _format = options.get('format', 'sympy')\n n = 1\n definite_state = 0\n for it in reversed(self.qubit_values):\n definite_state += n*it\n n = n*2\n result = [0]*(2**self.dimension)\n result[int(definite_...
[ "0.57827705", "0.5769769", "0.5658312", "0.55489653", "0.5533259", "0.54408574", "0.539096", "0.538447", "0.5345596", "0.5297939", "0.5282663", "0.52627313", "0.5226064", "0.5221448", "0.52154446", "0.5199522", "0.51891315", "0.518905", "0.51349676", "0.5126275", "0.5115005",...
0.0
-1
add H gate (hadamard gate).
def h(self, q0, ctrl=None): self.__add_quantum_gate(kind=HADAMARD, qid=[q0]) return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def H(self, qubit_expr):\n self.apply_gate_operation(cirq.ops.H, qubit_expr)", "def one_step(self, x, h):\n concatHX = torch.cat((x, h), 1)\n zt = self.sigmoid(self.linearZ(concatHX))\n rt = self.sigmoid(self.linearR(concatHX))\n ht = (1-zt)*h + zt* self.tanh(self.linearH(rt*co...
[ "0.6419409", "0.5969954", "0.59590846", "0.5871848", "0.5821663", "0.57674384", "0.57307285", "0.5712871", "0.5654674", "0.56424093", "0.56340796", "0.5620559", "0.56119233", "0.5600418", "0.55636835", "0.55636835", "0.55545986", "0.5546688", "0.55118287", "0.5500624", "0.549...
0.64646775
0
add root X gate.
def xr(self, q0, ctrl=None): self.__add_quantum_gate(kind=ROOT_PAULI_X, qid=[q0], ctrl=ctrl) return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def double_add(self, x):\n self.add(x*2)", "def add(self, x):\n self.sum += (1 / self.counter) * (x - self.sum)\n self.counter += 1", "def add(self, x):\n self.sum += x\n self.n += 1", "def add_x(self, x, add):\n return (x + add) % self.x_len", "def add(self, x):\n...
[ "0.6102522", "0.6007145", "0.585795", "0.5819852", "0.57789683", "0.5616054", "0.5561011", "0.549516", "0.5388424", "0.5349526", "0.5347666", "0.5294324", "0.52807593", "0.5275232", "0.51892567", "0.5138887", "0.5123675", "0.51219505", "0.5121168", "0.5118317", "0.51017565", ...
0.5430207
8
add root X dagger gate (hermmitian conjugate of root X gate).
def xr_dg(self, q0, ctrl=None): self.__add_quantum_gate(kind=ROOT_PAULI_X_, qid=[q0], ctrl=ctrl) return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def G(x,mu,T):\r\n den1 = np.cosh(mu/(kb*T))/np.sinh(x/(kb*T))\r\n den2 = np.tanh(x/(kb*T))\r\n\r\n return 1/(den1 + den2)", "def g(self, X):\n\n return (X[0])**2 - 2*X[0] + X[1]**3 - 2", "def DEX(self, *_):\n self._dec_or_inc_register('X', increment=False)", "def g(self, x):\n ...
[ "0.52737886", "0.5190329", "0.5135451", "0.5131622", "0.51256365", "0.5079745", "0.50729907", "0.5032203", "0.5030512", "0.49347252", "0.49339464", "0.4909581", "0.4902739", "0.4887746", "0.4885061", "0.4881056", "0.4863586", "0.48576003", "0.48407215", "0.48360857", "0.48278...
0.48627827
17
add S dagger gate (hermitian conjugate of S gate).
def s_dg(self, q0, ctrl=None): self.__add_quantum_gate(kind=PHASE_SHIFT_S_, qid=[q0], ctrl=ctrl) return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sdg(self, q):\n if isinstance(q, QuantumRegister):\n instructions = InstructionSet()\n for j in range(q.size):\n instructions.add(self.sdg((q, j)))\n return instructions\n\n self._check_qubit(q)\n return self._attach(SdgGate(q, self))", "def s_derivation(self, p, s, a...
[ "0.5595433", "0.5344511", "0.5192182", "0.51411366", "0.51041484", "0.5079701", "0.50640976", "0.50622725", "0.5046488", "0.50434494", "0.5021509", "0.49786434", "0.49517164", "0.49285102", "0.4919365", "0.49046585", "0.488642", "0.48804927", "0.48585668", "0.48501772", "0.48...
0.51566285
3
add T dagger gate (hermitian conjugate of T gate).
def t_dg(self, q0, ctrl=None): self.__add_quantum_gate(kind=PHASE_SHIFT_T_, qid=[q0], ctrl=ctrl) return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _add_entanglement_gate(self, gate_method, qubit_1, qubit_2):\r\n sig = signature(gate_method)\r\n\r\n # parametrized gate like a controlled single qubit rotation\r\n if 'theta' in sig.parameters:\r\n try:\r\n gate_method(self.circuit, self.parameters[next(self.ind...
[ "0.55271935", "0.53636426", "0.52517116", "0.5191573", "0.51875114", "0.51359725", "0.51213676", "0.5103118", "0.5092869", "0.5067736", "0.50508934", "0.49388814", "0.49368194", "0.49243402", "0.49038753", "0.48918512", "0.4888838", "0.4888838", "0.48756477", "0.48502102", "0...
0.524924
3
add RX gate (rotation around Xaxis).
def rx(self, q0, phase=DEF_PHASE, ctrl=None): self.__add_quantum_gate(kind=ROTATION_X, qid=[q0], phase=phase, ctrl=ctrl) return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rx(self, angle: float) -> \"Mate\":\n a = angle / 180 * pi\n self.y_dir = Mate._rotate(self.y_dir, self.x_dir, a)\n self.z_dir = Mate._rotate(self.z_dir, self.x_dir, a)\n return self", "def rx(self, angle: float, center: Onion[Iterable[Onion[float, int]], Point3D] = None) -> 'Comp...
[ "0.65553564", "0.650045", "0.5849988", "0.5727281", "0.562102", "0.5599952", "0.538176", "0.5361661", "0.533947", "0.53345203", "0.5285771", "0.5252457", "0.5218869", "0.51974756", "0.5187341", "0.50755596", "0.5019593", "0.5010519", "0.49932432", "0.49489382", "0.49301413", ...
0.62692696
2
add RY gate (rotation around Yaxis).
def ry(self, q0, phase=DEF_PHASE, ctrl=None): self.__add_quantum_gate(kind=ROTATION_Y, qid=[q0], phase=phase, ctrl=ctrl) return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rot_y(angle):\n sangle = math.sin(angle)\n cangle = math.cos(angle)\n ry = np.array([[cangle, 0.0, -sangle],\n [0.0, 1.0, 0.0],\n [sangle, 0.0, cangle]])\n return ry", "def rotate_y(angle):\n log.dev(\"lib.mathp.rotate_y is deprecated. Use lib.rotation.R2 in...
[ "0.68476254", "0.68437636", "0.680894", "0.63921726", "0.6370722", "0.6315495", "0.6244407", "0.6156097", "0.6085259", "0.6055177", "0.5998596", "0.597493", "0.59547675", "0.5952168", "0.5931695", "0.5923278", "0.5902155", "0.5877389", "0.5856021", "0.58337736", "0.5821165", ...
0.64825207
3
add RZ gate (rotation around Zaxis).
def rz(self, q0, phase=DEF_PHASE, ctrl=None): self.__add_quantum_gate(kind=ROTATION_Z, qid=[q0], phase=phase, ctrl=ctrl) return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rz(self, phi, q): # pylint: disable=invalid-name\n return self.append(RZGate(phi), [q], [])", "def rotateZ(self, *args, **kwargs):\n ...", "def _r_z(angle: tf.Tensor) -> tf.Tensor:\n zero = tf.constant(0, dtype=tf.float64)\n exponent = tf.complex(zero, angle)\n exp = tf.exp(...
[ "0.70971054", "0.6867665", "0.6615164", "0.65454346", "0.654375", "0.647146", "0.64289933", "0.64135015", "0.6400951", "0.62438506", "0.62215066", "0.6033293", "0.6030118", "0.60268694", "0.60091794", "0.5993204", "0.5962274", "0.59318596", "0.590546", "0.5898538", "0.5860597...
0.6309543
9
add P gate (phase shift gate).
def p(self, q0, phase=DEF_PHASE, ctrl=None): self.__add_quantum_gate(kind=PHASE_SHIFT, qid=[q0], phase=phase, ctrl=ctrl) return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add(self, p):\n self._pumps.add(p)", "def __add__(self, p: np.ndarray):\n return Quaternion(self.to_array() + p)", "def Add(p, q):\n return p*q", "def point_addition(self, P, Q):\n\t\traise Exception(NotImplemented)", "def PLP(self, *_):\n self.reg.P = self.pop()", "def update...
[ "0.6318269", "0.59578127", "0.5915731", "0.5825227", "0.5744571", "0.5720372", "0.5641655", "0.559485", "0.55680496", "0.55604863", "0.546399", "0.5454236", "0.5415402", "0.53876317", "0.5367949", "0.52692", "0.5242477", "0.5239249", "0.5235476", "0.52338487", "0.5204293", ...
0.61503357
1
add U1 gate (by IBM).
def u1(self, q0, alpha=DEF_PHASE, ctrl=None): self.__add_quantum_gate(kind=ROTATION_U1, qid=[q0], phase=alpha, ctrl=ctrl) return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cu1(self, q0, q1, alpha=DEF_PHASE, ctrl=None):\n self.__add_quantum_gate(kind=CONTROLLED_U1, qid=[q0,q1], phase=alpha, ctrl=ctrl)\n return self", "def _action_op_u1(self, plaq):\n # if self.link_type == 'U1':\n # return np.cos(plaq)\n return tf.math.cos(plaq)", "def...
[ "0.6728706", "0.6107796", "0.6091693", "0.60768634", "0.6043981", "0.59999627", "0.5992125", "0.5928929", "0.58962274", "0.58847916", "0.58111846", "0.5790187", "0.57823133", "0.5729477", "0.5695827", "0.5693138", "0.5691238", "0.56896335", "0.568388", "0.5657158", "0.5656396...
0.62217534
1
add U2 gate (by IBM).
def u2(self, q0, alpha=DEF_PHASE, beta=DEF_PHASE, ctrl=None): self.__add_quantum_gate(kind=ROTATION_U2, qid=[q0], phase=alpha, phase1=beta, ctrl=ctrl) return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _add_2_bit_oracle_without_ancilla_1_0(qc: QuantumCircuit, register: QuantumRegister) -> None:\n if len(list(register)) != 2:\n raise ValueError(f\"Need QuantumRegister with exactly 2 qubits, but got {len(list(register))} instead.\")\n\n qc.x(register[0])\n qc.cz(register[1], register[0])\n q...
[ "0.67444396", "0.6484918", "0.63779294", "0.6370151", "0.6348903", "0.6310671", "0.62745816", "0.6087733", "0.599484", "0.5910055", "0.5909812", "0.58794576", "0.5842368", "0.58024174", "0.58003265", "0.5782124", "0.5781626", "0.5779789", "0.57524997", "0.5730032", "0.5722179...
0.6176404
7
add U3 gate (by IBM).
def u3(self, q0, alpha=DEF_PHASE, beta=DEF_PHASE, gamma=DEF_PHASE, ctrl=None): self.__add_quantum_gate(kind=ROTATION_U3, qid=[q0], phase=alpha, phase1=beta, phase2=gamma, ctrl=ctrl) return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __iadd__( self, vector3 ):\n return self.add( vector3 )", "def cu3(self, q0, q1, alpha=DEF_PHASE, beta=DEF_PHASE, gamma=DEF_PHASE, ctrl=None):\n self.__add_quantum_gate(kind=CONTROLLED_U3, qid=[q0,q1], phase=alpha, phase1=beta,\n phase2=gamma, ctrl=ctrl)\n ...
[ "0.7029553", "0.6238025", "0.60627526", "0.5975905", "0.5929082", "0.5905331", "0.5873839", "0.5848612", "0.58422893", "0.5827687", "0.57158524", "0.563768", "0.5590613", "0.55825996", "0.5567244", "0.55254906", "0.5499538", "0.5457423", "0.54275006", "0.54163665", "0.5363699...
0.61557925
2
add CX gate (controlled X gate, controlled NOT gate, CNOT gate).
def cx(self, q0, q1, ctrl=None): self.__add_quantum_gate(kind=CONTROLLED_X, qid=[q0,q1], ctrl=ctrl) return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def CX(self, qubit_expr):\n self.apply_gate_operation(cirq.ops.CX, qubit_expr)", "def add(self, y):\n return circuit.add(self, y)", "def addGateCircuit(self, circuit, gate, qregs, cregs = None, ancillas = None):\n if self._gates == None or self._gatesToCircuit == None:\n return ...
[ "0.62984484", "0.5671249", "0.5556696", "0.5556419", "0.5492904", "0.53954756", "0.53890973", "0.53359663", "0.5300576", "0.5287976", "0.5240326", "0.5182423", "0.51742876", "0.5162475", "0.5155768", "0.51150185", "0.51141423", "0.51031303", "0.5088816", "0.50455844", "0.5043...
0.57537436
1
operate CY gate (controlled X gate).
def cy(self, q0, q1, ctrl=None): self.__add_quantum_gate(kind=CONTROLLED_Z, qid=[q0,q1], ctrl=ctrl) self.__add_quantum_gate(kind=CONTROLLED_X, qid=[q0,q1], ctrl=ctrl) self.__add_quantum_gate(kind=PHASE_SHIFT_S, qid=[q0], ctrl=ctrl) return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cy(control: QubitInput, target: QubitInput) -> Instruction:\n return Instruction(CY(), target=[control, target])", "def CX(self, qubit_expr):\n self.apply_gate_operation(cirq.ops.CX, qubit_expr)", "def ccx(self, ctl1, ctl2, tgt):\n return self.append(ToffoliGate(), [ctl1, ctl2, tgt], [])",...
[ "0.6910946", "0.6401429", "0.5860972", "0.5779722", "0.57023156", "0.5672864", "0.5589705", "0.55440325", "0.5509337", "0.5426937", "0.53601813", "0.5348523", "0.53088343", "0.52476794", "0.5232436", "0.5232274", "0.5184903", "0.5168113", "0.5129279", "0.51265514", "0.5118267...
0.60488343
2
add CZ gate (controlled Z gate).
def cz(self, q0, q1, ctrl=None): self.__add_quantum_gate(kind=CONTROLLED_Z, qid=[q0,q1], ctrl=ctrl) return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def CZ(self, qubit_expr):\n self.apply_gate_operation(cirq.ops.CZ, qubit_expr)", "def cz(control: QubitInput, target: QubitInput) -> Instruction:\n return Instruction(CZ(), target=[control, target])", "def crz(self, theta, ctl, tgt):\n return self.append(CrzGate(theta), [ctl, tgt], [])", "de...
[ "0.6692847", "0.6502453", "0.593888", "0.57899", "0.57899", "0.569876", "0.56540734", "0.56317514", "0.55797076", "0.55053544", "0.54111063", "0.53825223", "0.53213876", "0.5233289", "0.52176267", "0.52100134", "0.5150845", "0.51389116", "0.51233536", "0.50904244", "0.505567"...
0.6522352
1
add CXR gate (controlled root X gate).
def cxr(self, q0, q1, ctrl=None): self.__add_quantum_gate(kind=CONTROLLED_XR, qid=[q0,q1], ctrl=ctrl) return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cxr_dg(self, q0, q1, ctrl=None):\n self.__add_quantum_gate(kind=CONTROLLED_XR_, qid=[q0,q1], ctrl=ctrl)\n return self", "def crz(self, theta, ctl, tgt):\n return self.append(CrzGate(theta), [ctl, tgt], [])", "def cx(self, q0, q1, ctrl=None):\n self.__add_quantum_gate(kind=CONTROLLED...
[ "0.60456556", "0.5788765", "0.5551391", "0.5473348", "0.53226703", "0.5244496", "0.52266806", "0.5173726", "0.51487964", "0.510389", "0.50781316", "0.5073143", "0.49941725", "0.4989037", "0.49753806", "0.49564382", "0.493396", "0.49102163", "0.48927242", "0.48697314", "0.4860...
0.65724874
0
add CXR dagger gate (controlled XR dagger gate).
def cxr_dg(self, q0, q1, ctrl=None): self.__add_quantum_gate(kind=CONTROLLED_XR_, qid=[q0,q1], ctrl=ctrl) return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cxr(self, q0, q1, ctrl=None):\n self.__add_quantum_gate(kind=CONTROLLED_XR, qid=[q0,q1], ctrl=ctrl)\n return self", "def crz(self, theta, ctl, tgt):\n return self.append(CrzGate(theta), [ctl, tgt], [])", "def _gcl(x, r, D, Ia, Ct):\n\n Area = np.pi * D ** 2.0 / 4.0\n m = 1.0 / (np.sq...
[ "0.5829941", "0.5677816", "0.5607042", "0.5547162", "0.5384019", "0.52695274", "0.51288795", "0.50940967", "0.50349534", "0.49191833", "0.49003875", "0.48831064", "0.48794276", "0.48730922", "0.48560813", "0.48516476", "0.48199007", "0.48017424", "0.47675318", "0.47669303", "...
0.6386473
0
add CH gate (controlled H gate).
def ch(self, q0, q1, ctrl=None): self.__add_quantum_gate(kind=CONTROLLED_H, qid=[q0,q1], ctrl=ctrl) return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_append_one_wire_gate(self, circuit):\n gate = jet.GateFactory.create(\"H\")\n circuit.append_gate(gate, wire_ids=[3])\n assert gate.indices == [\"3-1\", \"3-0\"]\n assert list(circuit.operations)[-1] == jet.Operation(gate, [3])\n assert list(circuit.wires) == [\n ...
[ "0.593194", "0.55942816", "0.55546916", "0.5312524", "0.53084034", "0.5280236", "0.5275652", "0.52625185", "0.5245822", "0.52261335", "0.522333", "0.5186619", "0.5178953", "0.5166998", "0.5163261", "0.51590973", "0.5119946", "0.50677484", "0.5060551", "0.50518656", "0.5038371...
0.66249025
0
add CS gate (controlled S gate).
def cs(self, q0, q1, ctrl=None): self.__add_quantum_gate(kind=CONTROLLED_S, qid=[q0,q1], ctrl=ctrl) return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addGateCircuit(self, circuit, gate, qregs, cregs = None, ancillas = None):\n if self._gates == None or self._gatesToCircuit == None:\n return None\n\n gate = self._gatesToCircuit[gate.qasm()]\n \n circuit = circuit.copy()\n\n if cregs == None:\n cregs = ...
[ "0.61474854", "0.60933375", "0.5538856", "0.5500274", "0.5416745", "0.54130125", "0.5370142", "0.52709824", "0.5245407", "0.5190346", "0.5103887", "0.5103887", "0.50913537", "0.5075595", "0.50684726", "0.50532585", "0.5031381", "0.5031352", "0.49834308", "0.494981", "0.492664...
0.6095033
1
add CS dagger gate (controlled S dagger gate).
def cs_dg(self, q0, q1, ctrl=None): self.__add_quantum_gate(kind=CONTROLLED_S_, qid=[q0,q1], ctrl=ctrl) return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gate(self):\n self.gatedFrames = IVUS_gating(self.images, self.ivusPullbackRate, self.dicom.CineRate)", "def build_glyCB(self, gCBd: Dihedron): # -> None:\n ...", "def addGateDag(self, dag, gate, qregs, cregs = None, ancillas = None):\n if self._gates == None or self._gatesToDag == Non...
[ "0.5338038", "0.5312894", "0.52970165", "0.5271169", "0.517592", "0.51653695", "0.515889", "0.5066648", "0.50336796", "0.5003395", "0.5001316", "0.49954224", "0.4991093", "0.49732873", "0.49150544", "0.4883801", "0.48823026", "0.48561972", "0.48432097", "0.48432097", "0.48407...
0.5636926
0
add CT gate (controlled T gate).
def ct(self, q0, q1, ctrl=None): self.__add_quantum_gate(kind=CONTROLLED_T, qid=[q0,q1], ctrl=ctrl) return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def crz(self, theta, ctl, tgt):\n return self.append(CrzGate(theta), [ctl, tgt], [])", "def addGateCircuit(self, circuit, gate, qregs, cregs = None, ancillas = None):\n if self._gates == None or self._gatesToCircuit == None:\n return None\n\n gate = self._gatesToCircuit[gate.qasm()]\n...
[ "0.6381244", "0.6276733", "0.6038881", "0.60035855", "0.597752", "0.5808486", "0.55988115", "0.55569977", "0.55378765", "0.5425379", "0.53594565", "0.5328162", "0.5316508", "0.52781427", "0.5276781", "0.52332044", "0.52280194", "0.5162224", "0.5160193", "0.5147565", "0.513996...
0.61273205
2
add CT dagger gate (controlled T dagger gate).
def ct_dg(self, q0, q1, ctrl=None): self.__add_quantum_gate(kind=CONTROLLED_T_, qid=[q0,q1], ctrl=ctrl) return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_glyCB(self, gCBd: Dihedron): # -> None:\n ...", "def addGateDag(self, dag, gate, qregs, cregs = None, ancillas = None):\n if self._gates == None or self._gatesToDag == None:\n return None\n \n gate = self._gatesToDag[gate.qasm()]\n\n if cregs == None:\n ...
[ "0.57742953", "0.56914765", "0.55658096", "0.55089957", "0.53045684", "0.5290461", "0.5265818", "0.5198308", "0.512335", "0.5066861", "0.50638485", "0.50114036", "0.49884704", "0.49417618", "0.4919655", "0.49066445", "0.4892633", "0.48817962", "0.48796433", "0.48612082", "0.4...
0.5654775
2
add CP gate (controlled P gate).
def cp(self, q0, q1, phase=DEF_PHASE, ctrl=None): self.__add_quantum_gate(kind=CONTROLLED_P, qid=[q0,q1], phase=phase, ctrl=ctrl) return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addGateCircuit(self, circuit, gate, qregs, cregs = None, ancillas = None):\n if self._gates == None or self._gatesToCircuit == None:\n return None\n\n gate = self._gatesToCircuit[gate.qasm()]\n \n circuit = circuit.copy()\n\n if cregs == None:\n cregs = ...
[ "0.5904704", "0.5707195", "0.56965774", "0.5647329", "0.56336844", "0.55492866", "0.5349251", "0.53450406", "0.52863276", "0.5273215", "0.5263506", "0.5254979", "0.52324307", "0.5214165", "0.5191327", "0.5182098", "0.51805395", "0.5169316", "0.51630926", "0.51592803", "0.5153...
0.61328435
0
add CRX gate (controlled RX gate).
def crx(self, q0, q1, phase=DEF_PHASE, ctrl=None): self.__add_quantum_gate(kind=CONTROLLED_RX, qid=[q0,q1], phase=phase, ctrl=ctrl) return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ccx(self, ctl1, ctl2, tgt):\n return self.append(ToffoliGate(), [ctl1, ctl2, tgt], [])", "def crz(self, theta, ctl, tgt):\n return self.append(CrzGate(theta), [ctl, tgt], [])", "def addGateCircuit(self, circuit, gate, qregs, cregs = None, ancillas = None):\n if self._gates == None or self._gat...
[ "0.6399722", "0.6240949", "0.58750856", "0.5635678", "0.5619368", "0.534809", "0.53249425", "0.53150433", "0.52717066", "0.52563894", "0.52543056", "0.5253364", "0.5244658", "0.5180739", "0.5163616", "0.51406276", "0.513891", "0.50769234", "0.50509804", "0.5044092", "0.501908...
0.630366
1
add CRY gate (controlled RY gate).
def cry(self, q0, q1, phase=DEF_PHASE, ctrl=None): self.__add_quantum_gate(kind=CONTROLLED_RY, qid=[q0,q1], phase=phase, ctrl=ctrl) return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def crz(self, theta, ctl, tgt):\n return self.append(CrzGate(theta), [ctl, tgt], [])", "def cy(self, q0, q1, ctrl=None):\n self.__add_quantum_gate(kind=CONTROLLED_Z, qid=[q0,q1], ctrl=ctrl)\n self.__add_quantum_gate(kind=CONTROLLED_X, qid=[q0,q1], ctrl=ctrl)\n self.__add_quantum_gate(kind...
[ "0.5383607", "0.53207576", "0.523361", "0.5175593", "0.5152383", "0.5134093", "0.50781554", "0.50374013", "0.50269675", "0.5018746", "0.5007231", "0.49872983", "0.4968603", "0.49366578", "0.49154067", "0.4913415", "0.4904036", "0.48859322", "0.48642954", "0.48608968", "0.4823...
0.54176253
0
add CRZ gate (controlled RZ gate).
def crz(self, q0, q1, phase=DEF_PHASE, ctrl=None): self.__add_quantum_gate(kind=CONTROLLED_RZ, qid=[q0,q1], phase=phase, ctrl=ctrl) return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def crz(self, theta, ctl, tgt):\n return self.append(CrzGate(theta), [ctl, tgt], [])", "def __init__(self, theta):\n super().__init__(\"crz\", 2, [theta], num_ctrl_qubits=1)\n self.base_gate = RZGate(theta)", "def rz(self, phi, q): # pylint: disable=invalid-name\n return self.append(RZGate...
[ "0.6958848", "0.61419284", "0.6064584", "0.56396747", "0.5535329", "0.5404921", "0.5390143", "0.53515494", "0.5310394", "0.52780074", "0.5277078", "0.5226025", "0.5192308", "0.5169303", "0.5124667", "0.5121535", "0.5059638", "0.5004625", "0.4980288", "0.49734604", "0.49685302...
0.66018766
1
add CU1 gate (controlled U1 gate).
def cu1(self, q0, q1, alpha=DEF_PHASE, ctrl=None): self.__add_quantum_gate(kind=CONTROLLED_U1, qid=[q0,q1], phase=alpha, ctrl=ctrl) return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cu2(self, q0, q1, alpha=DEF_PHASE, beta=DEF_PHASE, ctrl=None):\n self.__add_quantum_gate(kind=CONTROLLED_U2, qid=[q0,q1], phase=alpha, phase1=beta, ctrl=ctrl)\n return self", "def _add_2_bit_oracle_with_ancilla_1_0(qc: QuantumCircuit, register: QuantumRegister, ancilla: Qubit) -> None:\n if ...
[ "0.58692527", "0.58496964", "0.57497954", "0.57320833", "0.5699937", "0.5659775", "0.55907893", "0.5577817", "0.55392885", "0.54260707", "0.53691983", "0.5344864", "0.53429586", "0.5311072", "0.5285583", "0.5258641", "0.5211102", "0.5174425", "0.5146771", "0.513239", "0.51196...
0.7375347
0
add CU2 gate (controlled U2 gate).
def cu2(self, q0, q1, alpha=DEF_PHASE, beta=DEF_PHASE, ctrl=None): self.__add_quantum_gate(kind=CONTROLLED_U2, qid=[q0,q1], phase=alpha, phase1=beta, ctrl=ctrl) return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _add_2_bit_oracle_without_ancilla_1_0(qc: QuantumCircuit, register: QuantumRegister) -> None:\n if len(list(register)) != 2:\n raise ValueError(f\"Need QuantumRegister with exactly 2 qubits, but got {len(list(register))} instead.\")\n\n qc.x(register[0])\n qc.cz(register[1], register[0])\n q...
[ "0.63387585", "0.60368437", "0.59752756", "0.5968923", "0.5940657", "0.58799356", "0.5746586", "0.5703197", "0.56583536", "0.56360215", "0.55208397", "0.55208397", "0.54839325", "0.54210496", "0.5384276", "0.53551805", "0.5338436", "0.53347147", "0.53148663", "0.528607", "0.5...
0.70731705
0
add CU3 gate (controlled U3 gate).
def cu3(self, q0, q1, alpha=DEF_PHASE, beta=DEF_PHASE, gamma=DEF_PHASE, ctrl=None): self.__add_quantum_gate(kind=CONTROLLED_U3, qid=[q0,q1], phase=alpha, phase1=beta, phase2=gamma, ctrl=ctrl) return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def u3(self, q0, alpha=DEF_PHASE, beta=DEF_PHASE, gamma=DEF_PHASE, ctrl=None):\n self.__add_quantum_gate(kind=ROTATION_U3, qid=[q0], phase=alpha, phase1=beta,\n phase2=gamma, ctrl=ctrl)\n return self", "def test_special_U3(self):\n self.check_oneq_special_cases...
[ "0.6172833", "0.60709476", "0.59816235", "0.597661", "0.58950996", "0.5756811", "0.57265884", "0.56782377", "0.5533537", "0.54784715", "0.54042715", "0.53975767", "0.5389443", "0.5381317", "0.5351581", "0.5308488", "0.52944463", "0.5283771", "0.5253617", "0.5241266", "0.52193...
0.69713616
0
add CCX gate (toffoli gate, controlled controlled X gate).
def ccx(self, q0, q1, q2, ctrl=None): self.cxr(q1,q2,ctrl=ctrl).cx(q0,q1,ctrl=ctrl).cxr_dg(q1,q2,ctrl=ctrl) self.cx(q0,q1,ctrl=ctrl).cxr(q0,q2,ctrl=ctrl) return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ccx(self, ctl1, ctl2, tgt):\n return self.append(ToffoliGate(), [ctl1, ctl2, tgt], [])", "def cx(self, q0, q1, ctrl=None):\n self.__add_quantum_gate(kind=CONTROLLED_X, qid=[q0,q1], ctrl=ctrl)\n return self", "def CX(self, qubit_expr):\n self.apply_gate_operation(cirq.ops.CX, qubit_e...
[ "0.63400793", "0.5722614", "0.57119", "0.555426", "0.5540648", "0.5507331", "0.5357815", "0.53444254", "0.53307414", "0.5300384", "0.52716064", "0.5259016", "0.51508355", "0.51378155", "0.5125027", "0.50955683", "0.50826627", "0.5060708", "0.5052761", "0.50502384", "0.5042433...
0.0
-1
add CSW gate (fredkin gate, controlled swap gate).
def csw(self, q0, q1, q2, ctrl=None): self.cx(q2,q1,ctrl=ctrl).ccx(q0,q1,q2,ctrl=ctrl).cx(q2,q1,ctrl=ctrl) return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addGateCircuit(self, circuit, gate, qregs, cregs = None, ancillas = None):\n if self._gates == None or self._gatesToCircuit == None:\n return None\n\n gate = self._gatesToCircuit[gate.qasm()]\n \n circuit = circuit.copy()\n\n if cregs == None:\n cregs = ...
[ "0.59902334", "0.5926082", "0.5785358", "0.567691", "0.5651704", "0.5646367", "0.5568842", "0.5285402", "0.5262861", "0.5240311", "0.5238952", "0.52281916", "0.5196213", "0.51387995", "0.5098061", "0.50610805", "0.50459075", "0.49702364", "0.49483865", "0.49053276", "0.488355...
0.56252754
6
Ensure that we have snapshots for a given volume
def run(connection, volume_id, interval='daily', max_snapshots=0, name=''): try: volumes = connection.get_all_volumes([volume_id]) except EC2ResponseError as error: logging.error(kayvee.formatLog("ebs-snapshots", "error", "failed to connect to AWS", {"msg": error.message})) return f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def snapshot_volumes(self) -> bool:\n return pulumi.get(self, \"snapshot_volumes\")", "def get_volume_snapshots(self, volume):\n LOG.debug('get_volume_snapshot starts')\n pool_name = self.configuration.rbd_pool\n volume_name = 'volume-%s' % encodeutils.safe_encode(volume[\"id\"])\n ...
[ "0.6860214", "0.68374085", "0.6810308", "0.6785922", "0.67043364", "0.66553533", "0.65876997", "0.65367866", "0.64045566", "0.6373387", "0.6342591", "0.62254906", "0.6165685", "0.60885876", "0.60594773", "0.6057364", "0.6054742", "0.6044898", "0.60077125", "0.6006443", "0.600...
0.5774927
34
Create a new snapshot
def _create_snapshot(connection, volume, name=''): logging.info(kayvee.formatLog("ebs-snapshots", "info", "creating new snapshot", {"volume": volume.id})) snapshot = volume.create_snapshot( description="automatic snapshot by ebs-snapshots") if not name: name = '{}-snapshot'.format(volume.id)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_snapshot(store, dataset, snapshot, description_fields, snapshot_changes):\n validate_snapshot_name(store, dataset, snapshot)\n validate_datalad_config(store, dataset)\n update_description(store, dataset, description_fields)\n update_changes(store, dataset, snapshot, snapshot_changes)\n sa...
[ "0.79396224", "0.79085445", "0.7880862", "0.78679043", "0.77699107", "0.77232075", "0.7571505", "0.7500152", "0.7409868", "0.73697287", "0.7301827", "0.7300242", "0.72600234", "0.72017276", "0.71182054", "0.7031012", "0.69631094", "0.69143236", "0.69007653", "0.68159884", "0....
0.752988
7
Ensure that a given volume has an appropriate snapshot
def _ensure_snapshot(connection, volume, interval, name): if interval not in VALID_INTERVALS: logging.warning(kayvee.formatLog("ebs-snapshots", "warning", "invalid snapshotting interval", { "volume": volume.id, "interval": interval })) return snapshots = connecti...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_volume_from_snapshot(self, mock_ghn):\n ctxt = context.get_admin_context()\n extra_specs = {}\n type_ref = volume_types.create(ctxt, 'hgst-1', extra_specs)\n snap = {'id': '1', 'name': 'volume1', 'display_name': '',\n 'volume_type_id': type_ref['id'], 'siz...
[ "0.72817236", "0.68085235", "0.6774093", "0.67722756", "0.67518574", "0.66919476", "0.66683424", "0.66099256", "0.6593119", "0.6561201", "0.64276564", "0.64078516", "0.64017785", "0.63788575", "0.63636637", "0.6321371", "0.62975985", "0.62808114", "0.6255119", "0.62545985", "...
0.6775116
2
Get the custom argument names and their defaults for this callbacks object.
def args_map_custom(cls) -> dict: args = {} args.update(cls.args_map_export()) args.update({"json_flat": False}) return args
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_defaults(self):\n default_dict = {}\n args, varargs, keyword, defaults = inspect.getargspec(self.exec_obj)\n if defaults:\n default_dict = dict(zip(args[-len(defaults):], defaults))\n return default_dict", "def _default_arguments(self, obj):\n \n ...
[ "0.61624855", "0.6132843", "0.6095295", "0.60910934", "0.6068363", "0.6068363", "0.6029796", "0.5978995", "0.5969861", "0.5933815", "0.5930009", "0.5890643", "0.58816427", "0.5855672", "0.5841174", "0.5833141", "0.58139366", "0.5811528", "0.58108425", "0.57942617", "0.5759906...
0.5322465
100
Start this callbacks object.
def start(self, **kwargs): super(Json, self).start(**kwargs) flat = self.get_arg_value("json_flat") self._first_row = True self.open_fd() begin = "" if flat else "[" self._fd.write(begin)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Start(self) :\n\t\t...", "def start(self):\n if self._start_event is None:\n _call_spawn_callbacks(self)\n hub = get_my_hub(self) # pylint:disable=undefined-variable\n self._start_event = hub.loop.run_callback(self.switch)", "def on_init_start(self):\n for cal...
[ "0.7341116", "0.72688156", "0.72455454", "0.72304714", "0.7201714", "0.71944135", "0.7172131", "0.7172131", "0.7169214", "0.7162993", "0.71609396", "0.7144856", "0.7144856", "0.7144856", "0.7144856", "0.7144856", "0.7144856", "0.7144856", "0.7144856", "0.7108717", "0.7108717"...
0.0
-1
Stop this callbacks object.
def stop(self, **kwargs): super(Json, self).stop(**kwargs) flat = self.get_arg_value("json_flat") self.do_export_schema() end = "" if flat else "\n]" self._fd.write(end) self.close_fd()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stop(self):\n callbacks_to_invoke = None\n self.__condition.acquire()\n if self.__is_running:\n callbacks_to_invoke = self.__on_stop_callbacks\n self.__on_stop_callbacks = []\n self.__is_running = False\n self.__condition.notifyAll()\n sel...
[ "0.7963989", "0.7829633", "0.77804077", "0.77698517", "0.7754477", "0.7754477", "0.7754477", "0.7754477", "0.7754477", "0.7754477", "0.7754477", "0.7754477", "0.7754477", "0.7754477", "0.7754477", "0.7751761", "0.7751761", "0.7730036", "0.7728273", "0.7700817", "0.7687963", ...
0.0
-1
Process the callbacks for current row.
def process_row(self, row: Union[List[dict], dict]) -> List[dict]: rows = listify(row) rows = self.do_pre_row(rows=rows) row_return = [{"internal_axon_id": row["internal_axon_id"]} for row in rows] rows = self.do_row(rows=rows) self.write_rows(rows=rows) del rows, row ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_row_callback(self, row_idx, callback):\n self.row_config[row_idx]['callback'] = callback", "def handleRowDataChange(self, changedItem ):\n with Tracer(traceLogger):\n # Figure out which row this widget is in\n row = changedItem.row()\n column = changedItem.c...
[ "0.6472857", "0.5750757", "0.5650037", "0.5516797", "0.5459125", "0.54315567", "0.542719", "0.5388466", "0.5336627", "0.53299576", "0.5304679", "0.52980345", "0.52818644", "0.52797127", "0.5246277", "0.5232472", "0.52007216", "0.5188484", "0.5181919", "0.5174036", "0.5146636"...
0.4780201
60
Write rows to the file descriptor.
def write_rows(self, rows: Union[List[dict], dict]): rows = listify(rows) flat = self.get_arg_value("json_flat") indent = None if flat else 2 prefix = " " * indent if indent else "" for row in rows: if self._first_row: pre = "" if flat else "\n" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write(self, row):\n bytes = struct.pack(self.pack_format, *row)\n self.f.write(bytes)", "def store_rows(self, course_id, filename, rows):\r\n output_buffer = StringIO()\r\n csv.writer(output_buffer).writerows(rows)\r\n self.store(course_id, filename, output_buffer)", "def...
[ "0.65288514", "0.64927477", "0.63778", "0.63315696", "0.63270783", "0.6293423", "0.6291826", "0.62790984", "0.6272529", "0.6243658", "0.62395215", "0.6211141", "0.61144894", "0.6026084", "0.60218585", "0.59980494", "0.5994269", "0.5977457", "0.5938158", "0.5935091", "0.592530...
0.5914556
21
Add schema rows to the output.
def do_export_schema(self): export_schema = self.get_arg_value("export_schema") if export_schema: row = {"schemas": self.final_schemas} self.write_rows(rows=row) del row
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_rows(self):\n for row in self.rows:\n self.table.add_row(row)", "def append_row(self):\r\n values = []\r\n vals_to_insert = ''\r\n\r\n for key in Output.COLUMNS:\r\n values.append(str(self[key]))\r\n\r\n # Replace any Quotes in parsed record with d...
[ "0.67264223", "0.6197562", "0.61581135", "0.5907348", "0.59029365", "0.5833993", "0.58154505", "0.57763284", "0.57446873", "0.5742718", "0.56974214", "0.56769365", "0.56498146", "0.5647206", "0.5645583", "0.56280947", "0.5627587", "0.56085706", "0.553828", "0.5537964", "0.553...
0.65681523
1
Return all the buffered objects, in the correct order as well as their index
def items(self): ix_obj = list(self.d_buffer.keys()) ix_obj.sort() l_obj = [self.d_buffer[ix] for ix in ix_obj] return ix_obj, l_obj
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(self):\n assert self.ptr == self.max_size\n self.ptr, self.path_start_idx = 0, 0\n return [self.obs_buf, self.act_buf, self.adv_buf, self.ret_buf, self.val_buf]", "def BufferList(self) -> _n_2_t_0[_n_0_t_11[_n_0_t_6]]:", "def __getitem__(self, index):\n return self.buffer[index]...
[ "0.60331285", "0.600125", "0.59499425", "0.5791308", "0.57847834", "0.57847834", "0.57508755", "0.5720811", "0.56735605", "0.5663488", "0.56373197", "0.5627264", "0.5612106", "0.5609416", "0.5598592", "0.5567743", "0.55047196", "0.5464387", "0.544293", "0.54306895", "0.541305...
0.66548544
0
Add one particular item, with a specific index to the buffer If the item is already buffered do not add it again Argument
def add_item(self, item, index): if index in self.d_buffer.keys(): return True elif len(self) < self._size: self.d_buffer.update({index: item}) return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add(self, item):\r\n if len(self.buff)==self.size: self.buff.pop(0)\r\n self.buff.append(item)", "def add_next(self, item, index):\n if index in self.d_buffer.keys():\n return\n if len(self) == self.size:\n self.pop_first()\n self.add_item(item, index)...
[ "0.76870745", "0.76835316", "0.7008656", "0.68846583", "0.6850312", "0.6849075", "0.67566377", "0.67298174", "0.6627526", "0.6571266", "0.6514428", "0.64295965", "0.6416794", "0.6378212", "0.6364589", "0.6336134", "0.63103914", "0.6234741", "0.623079", "0.6226195", "0.6119101...
0.7550045
2
Remove one particular item from the buffer
def pop_item(self, index): ix, obj = self.items if index < len(ix): self.d_buffer.pop(ix[index]) else: raise IndexError('Buffer does not have {0} elements'.format(index))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def take(self, item): \n self.contents.remove(item)", "def __delitem__(self, where):\n with self._lock:\n self._current_bytes -= self._data[where]\n del self._data[where]\n self._order.remove(where)", "def remove(self, item: T) -> None:\n index = self.index...
[ "0.7478718", "0.7395259", "0.70754623", "0.70754623", "0.70691514", "0.7067231", "0.6973058", "0.6886449", "0.6886449", "0.68595606", "0.6845985", "0.6819009", "0.67979664", "0.6790535", "0.6789824", "0.6737365", "0.6720759", "0.67044306", "0.66581875", "0.66425633", "0.66389...
0.7550008
0
Remove the first item in the buffer
def pop_first(self): self.pop_item(0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_first(self):\n self.deque.pop(0)", "def delete(self):\n first = self.data[0]\n self.data.pop(0)\n self.size = self.size - 1\n return first", "def pop_item(self, index):\n ix, obj = self.items\n if index < len(ix):\n self.d_buffer.pop(ix[ind...
[ "0.77843237", "0.7342911", "0.71000373", "0.68947244", "0.688018", "0.68741614", "0.6867453", "0.6845434", "0.6821856", "0.6749494", "0.66855025", "0.66670585", "0.66445595", "0.661845", "0.66004205", "0.6579086", "0.65492535", "0.6534603", "0.6392726", "0.6383168", "0.636512...
0.73949045
1
Remove the last item in the buffer
def pop_last(self): self.pop_item(-1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_last(self):\n self.deque.pop()", "def pop(self):\n value = self.buffer[self.end - 1]\n self.buffer[self.end - 1] = None\n self.end = (self.end - 1) % len(self.buffer)\n return value", "def pop(self):\n data = self.buffer.getvalue()\n self.buffer.seek(0)\n ...
[ "0.7669612", "0.7375816", "0.73687816", "0.7366045", "0.71360344", "0.70445234", "0.6985398", "0.6823437", "0.6730714", "0.6690923", "0.66654307", "0.6621386", "0.6602832", "0.659624", "0.6571084", "0.6533281", "0.65202886", "0.6503479", "0.64959717", "0.64928275", "0.6475953...
0.7435102
1
Add a new item at the end of the buffer and drop one item if necessary (from the beginning)
def add_next(self, item, index): if index in self.d_buffer.keys(): return if len(self) == self.size: self.pop_first() self.add_item(item, index)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add(self, item):\r\n if len(self.buff)==self.size: self.buff.pop(0)\r\n self.buff.append(item)", "def delayed_buffer_item(self, buffer_item, buffer_item_len, item):\n item_copy = copy.copy(item)\n if buffer_item is None:\n buffer_item = buffer_item_len * [item_copy]\n ...
[ "0.781679", "0.69368887", "0.69074106", "0.6848678", "0.6844897", "0.6722651", "0.6693831", "0.6517391", "0.65031815", "0.64660585", "0.64001614", "0.6381809", "0.6352038", "0.628194", "0.6240794", "0.6232624", "0.62238234", "0.62209296", "0.62180114", "0.62095904", "0.620959...
0.7406223
1
Add a new item at the beginning of the buffer and drop one item if necessary (from the end)
def add_prev(self, item, index): if index in self.d_buffer.keys(): return if len(self) == self._size: self.pop_last() self.add_item(item, index)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add(self, item):\r\n if len(self.buff)==self.size: self.buff.pop(0)\r\n self.buff.append(item)", "def add_next(self, item, index):\n if index in self.d_buffer.keys():\n return\n if len(self) == self.size:\n self.pop_first()\n self.add_item(item, index)...
[ "0.7400422", "0.71560556", "0.69278336", "0.6553957", "0.6530426", "0.6513943", "0.6506356", "0.6479094", "0.64768803", "0.6469337", "0.63909703", "0.62929386", "0.6251014", "0.624164", "0.6228138", "0.6228138", "0.6215412", "0.6198763", "0.61914164", "0.6188572", "0.6176583"...
0.70878935
2
In response to a signal, stops filling the buffer Argument signum frame
def stop_filling(self, signum, frame): self._filling = False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handler(signum, frame):\n m.signal()", "def signal_handler(self, signum, frame):\n self._running = False", "def signal_kernel(self, signum: int):", "def signal_kernel(self, signum):\n pass", "def sigterm(signum, frame):\n loop.stop()", "def signal(self, args):\n pass", "d...
[ "0.71383697", "0.6638584", "0.66365296", "0.65838414", "0.65606594", "0.651072", "0.6385658", "0.633539", "0.6274212", "0.62507004", "0.61414415", "0.6116271", "0.6104604", "0.60822886", "0.60652584", "0.60652584", "0.60072625", "0.59255743", "0.5915507", "0.58945", "0.589175...
0.6557572
5
Get a new picture to put in the buffer
def get_new_item(self, index): if index not in self.d_buffer.keys(): if 0 <= index < self.n_im: return self.stack[index] # Does not raise an error in case of wrong index for easier # handling upstream else: return None else:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def take_pic(self):\n \n try:\n if os.path.isfile(self.pics_path):\n os.remove(self.pics_path)\n self.camera.capture(self.pics_path, use_video_port=True)\n except:\n print(\"Error when recording image\")\n exit()\n \n try...
[ "0.67637736", "0.66389644", "0.6545607", "0.649641", "0.64811593", "0.6454082", "0.64298207", "0.63318187", "0.63116366", "0.6224079", "0.6165722", "0.6156108", "0.61227834", "0.60747534", "0.6073141", "0.60558736", "0.5991578", "0.5963383", "0.593771", "0.5916153", "0.591615...
0.0
-1
Returns a dictionary which maps subfolder > example > source wavs list. Returns a hierarchical dict of relative source file paths when given a folder produced by scaper.
def make_example_dict_from_folder( folder_sources, subset='all', ss_regex=re.compile(r'example.*_sources'), pattern='_sources', subfolder_events=('background', 'foreground')): if subset == 'all': subfolders = ['train', 'validation', 'eval'] else: subfolders = [subset] sources_for_mix = {} for su...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_folder_file_structure() -> Dict[str, List[str]]:\n folders_and_files = {}\n for path_to_folder in glob.glob(f\"{ZULIPTERMINAL}/**/\", recursive=True):\n complete_directory_path = Path(path_to_folder)\n if complete_directory_path.name in FOLDERS_TO_EXCLUDE:\n continue\n ...
[ "0.6020198", "0.6010303", "0.5987424", "0.59563166", "0.59123486", "0.58793145", "0.581208", "0.5806299", "0.5796214", "0.57869065", "0.5786168", "0.5785967", "0.57851917", "0.5748538", "0.56930906", "0.5687381", "0.5681763", "0.5676166", "0.56466466", "0.5594708", "0.5585946...
0.7107858
0
Makes a tab separated list of examples from a top folder.
def make_example_list_from_folder( folder_sources, subset='all', ss_regex=re.compile(r'example.*_sources'), pattern='_sources', subfolder_events=('background', 'foreground')): example_dict = make_example_dict_from_folder( folder_sources, subset=subset, ss_regex=ss_regex, pattern=pattern, subfolder...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_test_list(tdir):\n\n # Skip this if it already exists\n if os.path.exists(os.path.join(tdir.name, \"kstest-list\")):\n return\n\n kstest_log = os.path.join(tdir.name, \"kstest.log\")\n with open(kstest_log) as f:\n for line in f.readlines():\n if not line.startswit...
[ "0.6358621", "0.60888994", "0.60677725", "0.585937", "0.5713878", "0.5649388", "0.5635742", "0.5621542", "0.5621542", "0.55692166", "0.55307424", "0.54785776", "0.54528546", "0.54419327", "0.54034835", "0.5394622", "0.53802747", "0.53779495", "0.53719294", "0.53674066", "0.53...
0.50884354
59
Checks and possibly corrects a scaper produced example.
def check_and_correct_example(example, root_dir, check_length, fix_length, check_mix, fix_mix, sample_rate=16000, duration=10.0, chat=False): # Earlier versions of scaper had a tendency to make mist...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_is_gene_continuously_amplified_wrong_input(self):\n self.assertEqual(\"Wrong input data\", is_gene_continuously_amplified(13))", "def run_sample_checks(sub: Submission, logger):\n\n samples = sub.sample\n factors = [f.value for f in sub.study.experimental_factor]\n organisms = set()\n ...
[ "0.58382", "0.5788629", "0.57696885", "0.57351416", "0.5699103", "0.56888586", "0.5672273", "0.5641919", "0.5641791", "0.5625378", "0.5616322", "0.55867195", "0.55762357", "0.5548231", "0.55378455", "0.55378455", "0.55378455", "0.55340374", "0.5527008", "0.5521629", "0.551697...
0.64715683
0
Test that searching for part of the beer name and mfg name works
def test_compound_match(self): query_string = f'{self.beer.name[:10]}+{self.beer.manufacturer.name[:5]}' tap = TapFactory(beer=self.beer) response = self.client.get( f'{self.url}?search={query_string.upper()}', ) eq_(response.status_code, 200) eq_(len(response...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_search_checkname(self):\n self.assertEquals(self.t['Scrubs'].search('my first')[0]['episodename'], 'My First Day')\n self.assertEquals(self.t['My Name Is Earl'].search('Faked His Own Death')[0]['episodename'], 'Faked His Own Death')", "def test_name(self):\n\n self.check_search(\n ...
[ "0.78682476", "0.7367077", "0.69262975", "0.6646887", "0.6576953", "0.64594865", "0.6428426", "0.64177704", "0.6337653", "0.6327376", "0.6301725", "0.62890095", "0.6284056", "0.6256203", "0.6250491", "0.6238765", "0.6238765", "0.6227155", "0.62223715", "0.62219703", "0.621814...
0.5681
84
Wrapper for dot product operation, in order to be compatible with both Theano and Tensorflow
def dot_product(x, kernel): if K.backend() == 'tensorflow': # todo: check that this is correct return K.squeeze(K.dot(x, K.expand_dims(kernel)), axis=-1) else: return K.dot(x, kernel)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dot_prod(t1: torch.Tensor, t2: torch.Tensor, verbose: bool = False):\n assert t1.size() == t2.size(), \"Sizes for dot-product must match\"\n return mo.dot_prod(t1, t2, verbose)", "def _dot(a, b):\n return np.einsum('ijk,ikl->ijl', a, b)", "def dot(a, b):\r\n a, b = as_tensor_variable(a), as_ten...
[ "0.7651723", "0.76122725", "0.75896275", "0.75178", "0.74978065", "0.74902385", "0.74902385", "0.74902385", "0.74902385", "0.7466889", "0.74378735", "0.7429341", "0.7418364", "0.73810273", "0.7376632", "0.7343613", "0.7331493", "0.73104995", "0.7309816", "0.72749436", "0.7270...
0.7535402
3
Keras Layer that implements an Attention mechanism for temporal data. Supports Masking.
def __init__(self, W_regularizer=None, b_regularizer=None, W_constraint=None, b_constraint=None, bias=True, return_attention=False, **kwargs): self.supports_masking = True self.return_attention = return_attention ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _Attention(self, name, is_causal=True):\n p = self.params\n tr_atten_p = TransformerAttentionLayer.Params().Set(\n name='transformer_atten',\n input_dim=p.model_dim,\n hidden_dim=p.attention_hidden_dim or p.model_dim,\n is_masked=is_causal,\n num_heads=p.num_heads,\n ...
[ "0.6418364", "0.6348513", "0.5860708", "0.58178973", "0.56244344", "0.56133187", "0.55821043", "0.54933465", "0.5388436", "0.53026986", "0.5298122", "0.52612346", "0.52581245", "0.5257906", "0.5252626", "0.52330077", "0.5183299", "0.5153909", "0.5150206", "0.5134586", "0.5112...
0.48330575
69
Gets the position of a Fibonacci number and returns the Fibonacci number
def fibonacci_number_counter(p): if p == 0: return 0 elif p == 1 or p == 2: return 1 else: fibonacci_list = [1, 1] while len(fibonacci_list) < p: fibonacci_list.append(fibonacci_list[-1] + fibonacci_list[-2]) return fibonacci_list[-1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_fib(position):\n\n # Base Case: Positions greater thatn 0 or 1, since Fibonacci for 0 is 0 and\n # 1 is 1.\n if position == 0 or position == 1:\n return position\n\n return get_fib(position - 1) + get_fib(position - 2)", "def next_fib(f):\n for f in fib:\n i = fib.index(f)\n ...
[ "0.84752756", "0.7775988", "0.7635731", "0.75487685", "0.75380415", "0.7457801", "0.7436363", "0.7384562", "0.7375154", "0.73195016", "0.7316325", "0.7299088", "0.7251135", "0.7249416", "0.7244615", "0.71986157", "0.7195691", "0.7191518", "0.71824896", "0.7170513", "0.7158625...
0.0
-1
Get file names from config or user input Also get specified framerate, or default is 10 Hz Open file stream
def setup(self): print("Looking for ", self.filename) if os.path.exists(self.filename): n, ext = os.path.splitext(self.filename)[:2] if ext == ".h5" or ext == ".hdf5": with h5py.File(self.filename, "r") as file: keys = list(file.keys()) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_data_samples(fp):\n if(path.isdir(fp)):\n fps = glob.glob(fp + '\\\\*.txt')\n return list(map(lambda x: read_file(x), fps))", "def get_file_list(mixer_file, select_random, use_list_of_files):\n logger = logging.getLogger(get_file_list.__name__)\n files = list()\n\n if use_list_of_files:\...
[ "0.5744633", "0.57154065", "0.55288815", "0.54487276", "0.5439408", "0.54362303", "0.5347286", "0.5314243", "0.5279614", "0.5239958", "0.520664", "0.51828444", "0.51358587", "0.5131761", "0.512756", "0.5109966", "0.5094053", "0.5076949", "0.506344", "0.50362504", "0.50106287"...
0.0
-1
Here just return frame from loaded data
def getFrame(self, num): return self.data[:, :, num]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_data(self):", "def load_data(self) -> None:", "def _get_raw_data(self, idx=0):\n # Get the time step then make a data frame\n raise NotImplementedError('Code me up!')\n #data = self._data[???]\n return data", "def dataframe(self):\n\t\treturn self._dataframe", "def data...
[ "0.66847086", "0.66500604", "0.6578558", "0.6544992", "0.6464981", "0.6419371", "0.63444304", "0.6261828", "0.62608165", "0.6257387", "0.61691505", "0.613629", "0.60970247", "0.6049352", "0.60232645", "0.5995074", "0.59805757", "0.59766096", "0.597535", "0.59465176", "0.59391...
0.0
-1
Get file names from config or user input Also get specified framerate, or default is 10 Hz Open file stream
def setup(self): print("Looking for ", self.filename) if os.path.exists(self.filename): file = scio.loadmat(self.filename) self.data = np.squeeze(file["data"]) print("Motion Data length is ", len(self.data)) else: raise FileNotFoundError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_data_samples(fp):\n if(path.isdir(fp)):\n fps = glob.glob(fp + '\\\\*.txt')\n return list(map(lambda x: read_file(x), fps))", "def get_file_list(mixer_file, select_random, use_list_of_files):\n logger = logging.getLogger(get_file_list.__name__)\n files = list()\n\n if use_list_of_files:\...
[ "0.5744606", "0.5714158", "0.5527169", "0.5447836", "0.5439457", "0.5434857", "0.53462785", "0.5313303", "0.5279001", "0.52396804", "0.5205854", "0.5181732", "0.51353776", "0.51318854", "0.5127048", "0.51090044", "0.50929743", "0.50770855", "0.5064212", "0.5035977", "0.501092...
0.0
-1
Here just return frame from loaded data
def getFrame(self, num): return self.data[num]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_data(self):", "def load_data(self) -> None:", "def _get_raw_data(self, idx=0):\n # Get the time step then make a data frame\n raise NotImplementedError('Code me up!')\n #data = self._data[???]\n return data", "def dataframe(self):\n\t\treturn self._dataframe", "def data...
[ "0.66847086", "0.66500604", "0.6578558", "0.6544992", "0.6464981", "0.6419371", "0.63444304", "0.6261828", "0.62608165", "0.6257387", "0.61691505", "0.613629", "0.60970247", "0.6049352", "0.60232645", "0.5995074", "0.59805757", "0.59766096", "0.597535", "0.59465176", "0.59391...
0.0
-1
Creates the glove dictionnary from the glove file as a map, where the words are the key Forgets the stopwords
def _extractGloveVects(): embeddings_index = {} with open(GLOVE_CORPUS_FILE) as f: for line in f: values = line.split() word = values[0].lower() if word not in _cachedStopWords: coefs = np.asarray(values[1:], dtype='float32') embe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_glove_dictionary(self, file_path=\"./glove.twitter.27B.25d.txt\"):\n file = open(file_path, \"r\",encoding='utf-8')\n dictionary = {}\n keys = []\n for word_vector in file:\n dictionary[word_vector.split()[0]] = word_vector.split()[1:]\n keys.append(word_ve...
[ "0.7701295", "0.7338579", "0.6947404", "0.69307244", "0.6922794", "0.6919339", "0.68388474", "0.67719364", "0.6673551", "0.66312903", "0.6379227", "0.6355576", "0.63511074", "0.63474447", "0.6342942", "0.633822", "0.6330652", "0.6327623", "0.6324111", "0.6315943", "0.63043386...
0.6140933
34
Save the GloVe dictionary memory Object into binary file
def saveGloveDicIntoFile(gloveDic): np.save(GLOVE_DICT_FILE, np.asarray([gloveDic]))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_to_file(self, filename):\n outMap = {}\n for kanal in self._datastoreMap:\n # svaki pojedini Datastore se zna zapakirati u mapu (dictionary)\n outMap[kanal] = self._datastoreMap[kanal].store2dict()\n # serialize u binary string\n binstr = pickle.dumps(outM...
[ "0.6844523", "0.66101277", "0.65988386", "0.6553184", "0.65457076", "0.6461133", "0.6404799", "0.6393051", "0.6333784", "0.63045895", "0.6251503", "0.6237465", "0.6224473", "0.62162364", "0.62162364", "0.62048894", "0.6202406", "0.6202227", "0.62018937", "0.62000716", "0.6197...
0.6865105
0
Create an memory Object of GloVe dictionary from binary file
def loadGloveDicFromFile(): #if the resource file is not present, creates the file containing all vectors #and return vectors if not isfile(GLOVE_DICT_FILE): vects = _extractGloveVects() saveGloveDicIntoFile(vects) return vects return np.load(GLOVE_DICT_FILE)[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_from_file(path):\n with open(path) as obj:\n raw_file = obj.read()\n file_lines = [line.split(\" \") for line in raw_file.split(\"\\n\")]\n\n vertices = {}\n faces = []\n for number, line in enumerate(file_lines):\n if line[0] == \"v\":\n ...
[ "0.6563649", "0.6548593", "0.6548593", "0.6302663", "0.62614805", "0.6254731", "0.6220778", "0.61928546", "0.61538893", "0.6052055", "0.6007737", "0.59501976", "0.594304", "0.59378004", "0.5926469", "0.59219426", "0.5878771", "0.5871942", "0.58663714", "0.58638996", "0.585580...
0.60128707
10
Create dictionary of vectors and save it into file
def createGloveDic(): saveGloveDicIntoFile(_extractGloveVects())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_dict(emb, path_to_vec, dim=100):\n word_vec = {}\n for w in emb.keys():\n word_vec[w] = emb[w]\n with open(path_to_vec + f'embedding_{str(dim)}d.txt', 'w') as file:\n for w, v in word_vec.items():\n file.write(w + ' ')\n for el in v:\n file.write...
[ "0.68721676", "0.6824662", "0.6620886", "0.6619933", "0.65735036", "0.6529465", "0.6515113", "0.6493432", "0.6476171", "0.6336338", "0.6321563", "0.62979835", "0.62917596", "0.62372684", "0.61660385", "0.61660385", "0.61642545", "0.6095442", "0.60460395", "0.60164315", "0.597...
0.675696
2
Called from admin interface when page is moved. Should be used on all the places which are changing page position. Used like an interface to mptt, but after move is done page_moved signal is fired.
def move_page(self, target, position='first-child'): self.move_to(target, position) # fire signal self.force_moderation_action = PageModeratorState.ACTION_MOVE cms_signals.page_moved.send(sender=Page, instance=self) #titles get saved before moderation self.save(change_st...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_save_page(instance, raw, created, **kwargs):\n old_page = instance.old_page\n del(instance.old_page)\n \n if settings.CMS_MODERATOR:\n # tell moderator something was happen with this page\n from cms.utils.moderator import page_changed\n page_changed(instance, old_page)", ...
[ "0.64120024", "0.6210927", "0.6112562", "0.6102588", "0.60626286", "0.6050393", "0.599529", "0.59568924", "0.59317076", "0.57837987", "0.57799387", "0.5729946", "0.5728036", "0.5711554", "0.57115483", "0.568866", "0.55789995", "0.5550567", "0.55030763", "0.54747677", "0.54612...
0.7220067
0
copy a page and all its descendants to a new location Doesn't checks for add page permissions anymore, this is done in PageAdmin.
def copy_page(self, target, site, position='first-child', copy_permissions=True, copy_moderation=True): from cms.utils.moderator import update_moderation_message descendants = [self] + list(self.get_descendants().order_by('-rght')) tree = [target] level_dif = self.level - target...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy_pages(config):\n\n if \"Pages\" not in config:\n INFO(\"No information about pages\")\n return\n\n target_path = os.path.join(config[\"target\"][\"path\"],\n constants.PAGES_FOLDER)\n\n pages = config[\"Pages\"]\n params = {\n # \"rename\": No...
[ "0.67569137", "0.62102824", "0.6115456", "0.6008251", "0.57991344", "0.57538474", "0.57470375", "0.5713914", "0.56825674", "0.5637052", "0.55938256", "0.55267644", "0.5525658", "0.5520369", "0.55132717", "0.5499208", "0.54576015", "0.5446981", "0.53665066", "0.53636324", "0.5...
0.79622966
0
get the calculated status of the page based on published_date, published_end_date, and status
def get_calculated_status(self): if settings.CMS_SHOW_START_DATE: if self.publication_date > datetime.now(): return False if settings.CMS_SHOW_END_DATE and self.publication_end_date: if self.publication_end_date < datetime.now(): return Tr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_page_caculated_status(self):\n from pages import settings as pages_settings\n setattr(pages_settings, \"PAGE_SHOW_START_DATE\", True)\n yesterday = datetime.datetime.now() - datetime.timedelta(days=1)\n tomorrow = datetime.datetime.now() + datetime.timedelta(days=1)\n\n ...
[ "0.68869996", "0.613938", "0.58442456", "0.57751507", "0.57710797", "0.57653105", "0.564951", "0.55711806", "0.54949707", "0.54802895", "0.5322023", "0.53194374", "0.53085303", "0.52722406", "0.5250116", "0.51886964", "0.5137271", "0.5119178", "0.50824904", "0.50594455", "0.5...
0.7154325
0
get the list of all existing languages for this page
def get_languages(self): titles = Title.objects.filter(page=self) if not hasattr(self, "languages_cache"): languages = [] for t in titles: if t.language not in languages: languages.append(t.language) self.languages_cache = languages...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_languages():\n\tdef _get():\n\t\tif not frappe.db:\n\t\t\tfrappe.connect()\n\t\treturn frappe.db.sql_list('select name from tabLanguage')\n\treturn frappe.cache().get_value('languages', _get)", "def languages(self):\r\n url = '{0}/{1}'.format(self.get_url(), 'languages')\r\n\r\n return ...
[ "0.7950742", "0.79043835", "0.78993666", "0.78554344", "0.76446795", "0.75309783", "0.74677473", "0.74178064", "0.7268602", "0.723141", "0.71480125", "0.70844215", "0.7034048", "0.7020481", "0.6945113", "0.69438887", "0.6939026", "0.6901797", "0.68972915", "0.6825298", "0.676...
0.7613201
5
Helper function for accessing wanted / current title. If wanted title doesn't exists, EmptyTitle instance will be returned.
def get_title_obj(self, language=None, fallback=True, version_id=None, force_reload=False): self._get_title_cache(language, fallback, version_id, force_reload) if self.title_cache: return self.title_cache return EmptyTitle()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_title():", "def get_title(self):\n return self.run_command('get_title')[0]", "def get_title(self) -> Optional[str]:\n return self.title", "def get_title(cls, obj, **kwargs):\n if isinstance(obj.data, dict):\n titles = filter(None, get_value(obj.data, \"titles.title\", []))...
[ "0.7317102", "0.7292215", "0.7144462", "0.7138358", "0.70548296", "0.7035024", "0.7035024", "0.7035024", "0.7024971", "0.7007832", "0.6984208", "0.6984208", "0.69815016", "0.69728166", "0.69728166", "0.69728166", "0.6934254", "0.68951046", "0.68767846", "0.68251956", "0.68176...
0.0
-1
Helper function for getting attribute or None from wanted/current title.
def get_title_obj_attribute(self, attrname, language=None, fallback=True, version_id=None, force_reload=False): try: return getattr(self.get_title_obj(language, fallback, version_id, force_reload), attrname) except AttributeError: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_title(self) -> Optional[str]:\n return self.title", "def get_title():", "def get_title(self):\n return self.run_command('get_title')[0]", "def getAttrName(self, context):\r\n return self.attr if self.attr is not None else context.attr", "def _get_attribute(self):\n return se...
[ "0.6739067", "0.6692714", "0.65235364", "0.63904065", "0.63688284", "0.6344936", "0.6288744", "0.62723464", "0.62668854", "0.62502044", "0.6228555", "0.6215669", "0.6215669", "0.6215669", "0.6215669", "0.6191291", "0.6191291", "0.61492777", "0.6135957", "0.61327934", "0.61327...
0.6898922
0