query
stringlengths
9
9.05k
document
stringlengths
10
222k
metadata
dict
negatives
listlengths
30
30
negative_scores
listlengths
30
30
document_score
stringlengths
4
10
document_rank
stringclasses
2 values
Test basic ``host_str`` parsing; no surprises
def test_parse_host_str(self, host_str, expected, expected_tls_dict, ): out = client_kwargs_from_config(host_str) out_tls = out.pop('tls', {}) try: out_tls = out_tls.__dic...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_host(self):\n pass", "def test_parse_url_lowercase_host() -> None:\n assert indieauth._parse_url(\"http://ex.com/hello\").path == \"/hello\"\n assert indieauth._parse_url(\"http://EX.COM/hello\").hostname == \"ex.com\"\n\n parts = indieauth._parse_url(\"http://EX.COM:123/HELLO\")\n ...
[ "0.71296555", "0.7004411", "0.6710971", "0.6688106", "0.6684157", "0.66836333", "0.66433156", "0.65940166", "0.6588238", "0.65803725", "0.65153784", "0.64709073", "0.6464598", "0.6449479", "0.6441863", "0.6395573", "0.63726616", "0.63305074", "0.6261786", "0.6249969", "0.6230...
0.7255004
0
Test that ``verify=no`` overrides ``cert_path``
def test_no_verify_no_ca(self, host_str_fs, tmpdir): tmpdir.join('cert.pem').ensure() tmpdir.join('key.pem').ensure() tmpdir.join('ca.pem').ensure() out = client_kwargs_from_config( host_str_fs.format(cert_path=tmpdir.strpath), ) assert out['tls'].cert == ( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_fallback_default_verify_paths(self, monkeypatch):\n context = Context(SSLv23_METHOD)\n monkeypatch.setattr(\n _lib, \"SSL_CTX_set_default_verify_paths\", lambda x: 1\n )\n monkeypatch.setattr(\n SSL,\n \"_CRYPTOGRAPHY_MANYLINUX_CA_FILE\",\n ...
[ "0.75012845", "0.72467285", "0.70869243", "0.6916627", "0.6636409", "0.66044754", "0.6463585", "0.63147724", "0.62792575", "0.6222937", "0.6192983", "0.61852807", "0.6139677", "0.61195046", "0.60851365", "0.6025279", "0.60072756", "0.59979486", "0.5995647", "0.59738326", "0.5...
0.7373964
1
Test raising ``TLSParameterError`` when certs don't exist
def test_certs_error(self, tmpdir): with pytest.raises(docker.errors.TLSParameterError): client_kwargs_from_config( 'http://l cert_path=%s' % tmpdir.strpath )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_use_certificate_wrong_args(self, ctx_or_conn):\n with pytest.raises(TypeError):\n ctx_or_conn.use_certificate(\"hello, world\")", "def test_use_certificate_uninitialized(self, ctx_or_conn):\n with pytest.raises(Error):\n ctx_or_conn.use_certificate(X509())", "def te...
[ "0.72817093", "0.70087916", "0.6903538", "0.6889311", "0.6868677", "0.68513125", "0.68279433", "0.6764401", "0.6663912", "0.66038126", "0.6587073", "0.6454101", "0.6369873", "0.6354723", "0.6334118", "0.63293386", "0.6291678", "0.6207184", "0.6188143", "0.61739486", "0.616070...
0.7826428
0
Ensure that when client cert/key exists, but the CA doesn't, cert params are set without verify
def test_no_ca_no_error(self, tmpdir): tmpdir.join('cert.pem').ensure() tmpdir.join('key.pem').ensure() out = client_kwargs_from_config( 'http://l cert_path=%s' % tmpdir.strpath ) assert out['tls'].cert == ( tmpdir.join('cert.pem').strpath, t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_no_verify_no_ca(self, host_str_fs, tmpdir):\n tmpdir.join('cert.pem').ensure()\n tmpdir.join('key.pem').ensure()\n tmpdir.join('ca.pem').ensure()\n\n out = client_kwargs_from_config(\n host_str_fs.format(cert_path=tmpdir.strpath),\n )\n\n assert out['tl...
[ "0.7238679", "0.6843561", "0.66534835", "0.6623861", "0.65620136", "0.65516835", "0.65445775", "0.6510549", "0.6388831", "0.6363554", "0.6320691", "0.6276618", "0.62438065", "0.6237401", "0.62106156", "0.6189989", "0.61834127", "0.61439455", "0.6106423", "0.6105602", "0.60965...
0.7384116
0
Test when a git commit is made, tagged, then described by it's tag
def test_tagged(self, tmpgitdir, branch): with tmpgitdir.join('file_a.txt').open('w') as handle: handle.write('first file') subprocess.check_call(['git', 'checkout', '-b', branch]) subprocess.check_call(['git', 'add', '.']) subprocess.check_call(['git', 'commit', '-m', 'firs...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_git_commits(self):\n event_id = dog.Event.create(title=\"Testing git commits\", text=\"\"\"$$$\n eac54655 * Merge pull request #2 from DataDog/alq-add-arg-validation (alq@datadoghq.com)\n |\\\n 760735ef | * origin/alq-add-arg-validation Simple typecheck between me...
[ "0.71023124", "0.68768877", "0.66216725", "0.65907145", "0.6243646", "0.62270266", "0.6220564", "0.6176081", "0.6136612", "0.61345124", "0.61071676", "0.6001234", "0.5948178", "0.5940225", "0.59256774", "0.5903266", "0.58939385", "0.5875933", "0.5875386", "0.5869599", "0.5838...
0.69506216
1
Test when in a detached head state
def test_detached_head(self, tmpgitdir, branch): with tmpgitdir.join('file_a.txt').open('w') as handle: handle.write('first file') subprocess.check_call(['git', 'checkout', '-b', branch]) subprocess.check_call(['git', 'add', '.']) subprocess.check_call(['git', 'commit', '-m'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_head_detached(repository: Repository) -> None:\n repository._repository.set_head(repository.head.commit.id)\n with pytest.raises(ValueError):\n repository.head", "def on_detached(reason, crash):\n print(\"on_detached()\")\n print(\"reason:\", reason)\n print...
[ "0.62961733", "0.5902365", "0.588763", "0.581806", "0.57294714", "0.5610439", "0.5524324", "0.5491706", "0.548161", "0.54555845", "0.5435171", "0.53663003", "0.53559685", "0.5302321", "0.5245934", "0.5240968", "0.52279854", "0.5223066", "0.52176344", "0.5216953", "0.52143174"...
0.6109551
1
Test when in a detached head state, where the commit is tagged
def test_tagged_detached_head(self, tmpgitdir, branch): with tmpgitdir.join('file_a.txt').open('w') as handle: handle.write('first file') subprocess.check_call(['git', 'checkout', '-b', branch]) subprocess.check_call(['git', 'add', '.']) subprocess.check_call(['git', 'commit...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_detached_head(tmpdir):\n repo = Repo.init(path=tmpdir)\n tmppath = pathlib.Path(tmpdir)\n\n index = repo.index\n author = Actor(\"An author\", \"author@example.com\")\n committer = Actor(\"A committer\", \"committer@example.com\")\n\n # First commit\n with open(tmppath / \"test.py\", ...
[ "0.7025714", "0.6931008", "0.69243526", "0.66605234", "0.652574", "0.6475694", "0.6046414", "0.6031785", "0.5926672", "0.5866686", "0.58500826", "0.58421004", "0.5838575", "0.5799745", "0.57833153", "0.5764867", "0.57611847", "0.56860304", "0.5668869", "0.5654756", "0.5649913...
0.7445173
0
Uses hdevtools info filename symbol_name to get symbol info
def hdevtools_info(filename, symbol_name, cabal = None): contents = call_hdevtools_and_wait(['info', filename, symbol_name], filename = filename, cabal = cabal) return parse_info(symbol_name, contents) if contents else None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nm(filename):\n binary = parse(filename) # Build an abstract binary\n symbols = binary.symbols\n\n if len(symbols) > 0:\n for symbol in symbols:\n print(symbol)\n else:\n print(\"No symbols found\")", "def symbols_details(self):\n pass", "def get_symbols(doc, li...
[ "0.68157065", "0.6396066", "0.61771023", "0.6132515", "0.6047057", "0.5982517", "0.5970701", "0.59500575", "0.585406", "0.58314234", "0.5776864", "0.5761884", "0.57422334", "0.5717828", "0.56954217", "0.56462055", "0.5640362", "0.56306994", "0.5626244", "0.5619888", "0.561891...
0.80114484
0
Uses hdevtools to check file
def hdevtools_check(filename, cabal = None): return call_hdevtools_and_wait(['check', filename], filename = filename, cabal = cabal)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_and_analyze(self, domain_path, php_info_filename):\n php_info_url = domain_path.url_join(php_info_filename)\n\n response = self._uri_opener.GET(php_info_url,\n cache=True,\n grep=False)\n\n if is_404(respo...
[ "0.5883917", "0.5862428", "0.58590376", "0.5857866", "0.58339536", "0.58069247", "0.578893", "0.57692254", "0.57237095", "0.57019496", "0.5681064", "0.5659866", "0.5608667", "0.5608043", "0.56055325", "0.5588865", "0.55619746", "0.55446285", "0.55349016", "0.55287385", "0.551...
0.7422176
0
Uses hdevtools to infer type
def hdevtools_type(filename, line, column, cabal = None): return call_hdevtools_and_wait(['type', filename, str(line), str(column)], filename = filename, cabal = cabal)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def infer(self):\n # Update ext_type.symtab\n self.type_infer_init_method()\n\n # Type infer the rest of the methods (with fixed attribute table!)\n self.type_infer_methods()", "def test_get_types(self):\n pass", "def get_check_types():", "def _propagate_types(self):\n p...
[ "0.58407456", "0.58132976", "0.5809135", "0.5733886", "0.57151115", "0.5673977", "0.5669237", "0.56227255", "0.561683", "0.5489797", "0.5477508", "0.54729587", "0.54698926", "0.54627055", "0.5419648", "0.54010326", "0.53666264", "0.5364339", "0.5355661", "0.5355128", "0.53074...
0.5939715
0
Construct a WorldfileMultiple command.
def __init__(self, projectDir, configFile=None, outfp=sys.stdout): super(WorldfileMultiple, self).__init__(projectDir, configFile, outfp)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def construct_phyla_plots_cmds(sample_ids, cmd_format, cmd_args):\n commands = []\n for chunk in chunk_list(sample_ids):\n args = cmd_args.copy()\n args['samples'] = ','.join(chunk)\n commands.append(cmd_format % args)\n return commands", "def multi(self, *argv, **kwargs):\n ...
[ "0.5461225", "0.5446993", "0.5372413", "0.5307399", "0.5222449", "0.5203311", "0.5134721", "0.50966644", "0.50889033", "0.5069162", "0.50483453", "0.5005254", "0.50007635", "0.49818003", "0.49678537", "0.49677798", "0.4950114", "0.49232692", "0.49096394", "0.48966783", "0.488...
0.56983197
0
read_symbols(filename) > SymbolTable read from the binary file
def read_symbols(filename): filename = as_str(filename) cdef ifstream* fstream = new ifstream(filename) cdef SymbolTable table = SymbolTable.__new__(SymbolTable) table.table = sym.SymbolTableRead(fstream[0], filename) del fstream return table
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_symbols(symbols_file_path):\n return np.genfromtxt(symbols_file_path, delimiter=',', dtype=np.str)", "def read_opcode_info(filename):\r\n \r\n # Open file and read it into a list of lines.\r\n fin = open(filename, \"r\")\r\n lines = fin.readlines()\r\n fin.close()\r\n \r\n # We'll ...
[ "0.70136464", "0.6443618", "0.62608534", "0.60250115", "0.59742904", "0.59548825", "0.5942269", "0.59381986", "0.5802325", "0.57955843", "0.57708764", "0.5745995", "0.57382387", "0.56561285", "0.5611826", "0.56110764", "0.55889505", "0.5569072", "0.5523966", "0.55123675", "0....
0.83470607
0
SymbolTable() > new symbol table with \u03b5 0 SymbolTable(epsilon) > new symbol table with epsilon 0
def __init__(self, epsilon=EPSILON): cdef bytes name = 'SymbolTable<{0}>'.format(id(self)).encode('ascii') self.table = new sym.SymbolTable(<string> name) assert (self[epsilon] == EPSILON_ID)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\r\n self.s_table = SymbolTable.preSymbols", "def symbol_table(self, value: str):\n self._symbol_table = value", "def getSymbolTable(self) -> ghidra.app.util.bin.format.pe.debug.DebugCodeViewSymbolTable:\n ...", "def symbols(self):\n pass", "def _create_symbol...
[ "0.6887349", "0.60825706", "0.59769744", "0.59410924", "0.59129506", "0.5899086", "0.58946913", "0.58743674", "0.57885927", "0.5715725", "0.5517328", "0.5511564", "0.5511564", "0.549144", "0.5476111", "0.5462763", "0.53864384", "0.53756225", "0.5362634", "0.5319834", "0.53064...
0.782774
0
table.copy() > copy of the symbol table
def copy(self): cdef SymbolTable result = SymbolTable.__new__(SymbolTable) result.table = new sym.SymbolTable(self.table[0]) return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_table(self):\n return copy.deepcopy(self._table)", "def Copy(self, copy):\n return _table.Table_Copy(self, copy)", "def copy(self):\n table = Table()\n for label in self.column_labels:\n self._add_column_and_format(table, label, np.copy(self[label]))\n retu...
[ "0.6492269", "0.6435444", "0.6395961", "0.63327885", "0.6277186", "0.6192845", "0.61332405", "0.613064", "0.59814733", "0.5872732", "0.5858917", "0.58048284", "0.5763351", "0.5747134", "0.5696706", "0.5637006", "0.5603323", "0.5565166", "0.5478365", "0.54699296", "0.54500276"...
0.8015655
0
table.items() > iterator over (symbol, value) pairs
def items(self): cdef sym.SymbolTableIterator* it = new sym.SymbolTableIterator(self.table[0]) try: while not it.Done(): yield (it.Symbol().decode('utf8'), it.Value()) it.Next() finally: del it
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __iter__(self) -> Iterator[Tuple[K, List[V]]]:\n return (entry for entry in self._table.items())", "def __iter__(self):\r\n for column, value in self.items():\r\n # this uses __getitem__, using the name (rather than the accessor)\r\n # is correct – it's what __getitem__ ex...
[ "0.6874724", "0.68101335", "0.65793943", "0.6564461", "0.65016985", "0.64539164", "0.637112", "0.6238372", "0.61545885", "0.614661", "0.61349154", "0.60843146", "0.6063622", "0.6063622", "0.6025974", "0.60004103", "0.59667796", "0.59623426", "0.59541434", "0.59279233", "0.591...
0.7380278
0
Merge tables `syms1` and `syms2` into `merged` if they are compatible. Tables are compatible if all common symbol/values map identically.
def _merge_tables(SymbolTable syms1, SymbolTable syms2, SymbolTable merged): for symbol, value in syms1.items(): try: other_symbol = syms2.find(value) if other_symbol != symbol: raise ValueError('incompatible symbol tables') except KeyError: pass ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def merge_fs(fs1,fs2):\n # This function merges fs2 into fs1, changing fs1 in-place\n # It's a cheaper and faster alternative of unify(), which will check\n # all the similarities and differences between fs1 and fs2. But this one\n # just assumes that fs2 and fs1 does not have any entries in common\n ...
[ "0.601715", "0.5610678", "0.5535604", "0.5451038", "0.5331601", "0.53010577", "0.5196176", "0.51377356", "0.5095105", "0.5080329", "0.5064888", "0.50560766", "0.50427425", "0.50423485", "0.50400716", "0.49894622", "0.49616647", "0.49493426", "0.49420464", "0.4935286", "0.4889...
0.8205983
0
TropicalWeight(value) > tropical weight initialized with the given value
def __init__(self, value): if value is True or value is None: self.weight = new openfst.TropicalWeight(openfst.TropicalWeightOne()) elif value is False: self.weight = new openfst.TropicalWeight(openfst.TropicalWeightZero()) else: self.weight = new openfst.Trop...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gen_tb_tb_weights(weight=1.):\r\n W = np.zeros([8, 8])\r\n sinusoid = -(np.cos(np.linspace(0, 2 * np.pi, 8, endpoint=False)) - 1) / 2\r\n for i in range(8):\r\n values = np.roll(sinusoid, i)\r\n W[i, :] = values\r\n return weight * W", "def get_weight(self):\n pass", "def g...
[ "0.65349126", "0.6164336", "0.6164336", "0.6140293", "0.6139442", "0.61315674", "0.61213374", "0.6033982", "0.6022765", "0.60090303", "0.59763247", "0.59763247", "0.59679335", "0.5965371", "0.59355384", "0.59238636", "0.5918259", "0.5911267", "0.58945274", "0.58842987", "0.58...
0.6796364
0
StdVectorFst(isyms=None, osyms=None) > empty finitestate transducer StdVectorFst(source) > copy of the source transducer
def __init__(self, source=None, isyms=None, osyms=None): if isinstance(source, StdVectorFst): self.fst = <openfst.StdVectorFst*> self.fst.Copy() else: self.fst = new openfst.StdVectorFst() # todo: implement LogVectorFst. #if isinstance(source, LogVectorFst...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy(self):\n cdef StdVectorFst result = StdVectorFst.__new__(StdVectorFst)\n if self.isyms is not None:\n result.isyms = self.isyms.copy()\n if self.osyms is not None:\n result.osyms = (result.isyms if (self.isyms is self.osyms)\n else self.osyms.copy(...
[ "0.6920192", "0.62388426", "0.5871237", "0.57356966", "0.5718539", "0.5653314", "0.5335162", "0.5119913", "0.5045772", "0.49676844", "0.47438803", "0.47279066", "0.46557736", "0.46314356", "0.46143156", "0.4575382", "0.4566534", "0.45189705", "0.44923723", "0.44423857", "0.44...
0.69025594
1
fst.num_arcs() > total number of arcs in the transducer
def num_arcs(self): return sum(len(state) for state in self)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def num_arcs(self):\n return len(self.arcs)", "def get_num_arcs(self):\n num_arcs = 0\n for node in self._nodes.values(): num_arcs += node._deg\n return (num_arcs / 2) + 1", "def get_num_arcs(self):\n num_arcs = 0\n for node in self._nodes.values(): num_arcs += node._d...
[ "0.6503137", "0.5390219", "0.5390219", "0.5311139", "0.53066105", "0.52582544", "0.51249367", "0.51127076", "0.5084829", "0.50745136", "0.50736403", "0.5000744", "0.5000361", "0.49896824", "0.49630937", "0.49618727", "0.48941165", "0.4880546", "0.4877309", "0.48604143", "0.48...
0.6417278
1
fst.add_arc(int source, int dest, int ilabel, int olabel, weight=None)
def add_arc(self, int source, int dest, int ilabel, int olabel, weight=None): if source > self.fst.NumStates()-1: raise ValueError('invalid source state id ({0} > {1})'.format(source, self.fst.NumStates()-1)) if dest > self.fst.NumStates()-1: raise ValueError('inv...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_arc(rule_fst, index, token, nonterminal_coverages, weight=None):\n\n # Add arc of the form epsilon:token\n\n # Nonterminal symbol\n if token in nonterminal_coverages:\n rule_fst.add_arc(index, index + 1, 0, int(nonterminal_coverages[token]))\n\n elif int(token) == Ope...
[ "0.69422287", "0.6696642", "0.64102465", "0.6044187", "0.585226", "0.58391315", "0.57758266", "0.5771317", "0.57682467", "0.57481164", "0.56878084", "0.56331134", "0.5566571", "0.5551789", "0.5551048", "0.552699", "0.55259097", "0.5471207", "0.54608434", "0.5456122", "0.54319...
0.8584377
0
fst.add_state() > new state
def add_state(self): return self.fst.AddState()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def put(cls, new_state: TState) -> \"State[Tuple, TState]\":\n return State(lambda state: (Unit, new_state))", "def set_state(self, new_state):\n if self.state_size != len(new_state):\n raise()\n \n self.index = 0\n self.mt = [0] * self.state_size\n \n ...
[ "0.72844535", "0.6810779", "0.66312695", "0.65882593", "0.6583458", "0.6462981", "0.64470166", "0.64100325", "0.63604087", "0.63312083", "0.6286474", "0.62414885", "0.62280333", "0.6183359", "0.6148567", "0.614787", "0.613842", "0.6137333", "0.61278456", "0.61263424", "0.6094...
0.8028894
0
fst.determinize() > determinized transducer
def determinize(self): cdef StdVectorFst result = StdVectorFst(isyms=self.isyms, osyms=self.osyms) openfst.Determinize(self.fst[0], result.fst) return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def determinize(A):\n A = epsilon_remove(A)\n subset2state = {frozenset({0}): 0}\n state2subset = {0: frozenset({0})}\n\n alphabet = A.alphabet\n\n B = Automaton(1, set())\n\n if 0 in A.accepting:\n B.accepting.add(0)\n \n frontier = {0}\n while len(frontier) > 0:\n new_fro...
[ "0.5419944", "0.53823406", "0.53585374", "0.5134222", "0.5114933", "0.5071433", "0.5023954", "0.5011669", "0.49769273", "0.49137333", "0.48699903", "0.48521927", "0.48403203", "0.48399127", "0.4822672", "0.48219958", "0.481958", "0.48166376", "0.481023", "0.480491", "0.480353...
0.63501775
0
fst.compose(StdVectorFst other) > composed transducer
def compose(self, StdVectorFst other): if (self.osyms or other.isyms) and (self.osyms != other.isyms): raise ValueError('transducer symbol tables are not compatible for composition') cdef StdVectorFst result = StdVectorFst(isyms=self.isyms, osyms=other.osyms) openfst.Compose(self.fst...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def into(target, xducer, coll):\n return transduce(xducer, append, target, coll)", "def compose(a,b,shape_factor=None):\n\tif isinstance(a,Dense.denseAD) and (isinstance(b,Sparse.spAD) or all(isinstance(e,Sparse.spAD) for e in b)):\n\t\telem = None\n\t\tsize_factor = np.prod(shape_factor)\n\t\tif shape_factor...
[ "0.5957253", "0.5651029", "0.564393", "0.56030774", "0.5564454", "0.5412876", "0.5410412", "0.53948104", "0.53605056", "0.53134406", "0.5311556", "0.5243856", "0.5236318", "0.5185403", "0.5152642", "0.5138685", "0.5131285", "0.513073", "0.50922656", "0.5081686", "0.50802356",...
0.76929843
0
fst.intersect(StdVectorFst other) > intersection of the two acceptors
def intersect(self, StdVectorFst other): if not (self.acceptor and other.acceptor): raise ValueError('both transducers need to be acceptors for intersection') # TODO check and merge symbol tables (intersection) if self.isyms and (self.isyms != other.isyms): raise ValueErr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def intersection(st, ave):\n return (st+ave)*(st+ave+1)//2 + ave", "def intersection(st, ave):\n return (st+ave)*(st+ave+1)//2 + ave", "def intersection(st, ave):\n return (st+ave)*(st+ave+1)//2 + ave", "def intersection(st, ave):\n return (st+ave)*(st+ave+1)//2 + ave", "def intersection(st, av...
[ "0.7009266", "0.7009266", "0.7009266", "0.7009266", "0.7009266", "0.7006973", "0.6933211", "0.66707516", "0.6646042", "0.66373456", "0.66121304", "0.6597997", "0.65473455", "0.65094155", "0.64364016", "0.63134086", "0.63125205", "0.6276214", "0.6265396", "0.6218907", "0.62164...
0.7845703
0
fst.union(StdVectorFst other) > union of the two transducers
def union(self, StdVectorFst other): cdef StdVectorFst result = self.copy() result.set_union(other) return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def union(set1, set2):", "def _union(cls, s1, s2):\n return s1.union(s2)", "def intersect(self, StdVectorFst other):\n if not (self.acceptor and other.acceptor):\n raise ValueError('both transducers need to be acceptors for intersection')\n # TODO check and merge symbol tables (...
[ "0.6959548", "0.6676238", "0.655247", "0.65170395", "0.64780825", "0.64126706", "0.63926506", "0.63912684", "0.6372273", "0.63648283", "0.6319378", "0.6300179", "0.6287052", "0.62588483", "0.625192", "0.62286276", "0.616206", "0.6152447", "0.6104714", "0.6100579", "0.6093492"...
0.77419794
0
fst.concatenation(StdVectorFst other) > concatenation of the two transducers
def concatenation(self, StdVectorFst other): cdef StdVectorFst result = self.copy() result.concatenate(other) return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compose(self, StdVectorFst other):\n if (self.osyms or other.isyms) and (self.osyms != other.isyms):\n raise ValueError('transducer symbol tables are not compatible for composition')\n cdef StdVectorFst result = StdVectorFst(isyms=self.isyms, osyms=other.osyms)\n openfst.Compose...
[ "0.69481677", "0.64964294", "0.62441736", "0.61367065", "0.60064864", "0.5919863", "0.58268344", "0.58133394", "0.5789787", "0.5779817", "0.5777069", "0.5752967", "0.5726033", "0.57251793", "0.5657184", "0.5645212", "0.5640987", "0.5640987", "0.5624115", "0.56046396", "0.5593...
0.74791336
0
fst.difference(StdVectorFst other) > difference of the two transducers
def difference(self, StdVectorFst other): # TODO merge symbol tables (union) if self.isyms and (self.isyms != other.isyms): raise ValueError('transducers must use shared input symbol table') if self.osyms and (self.osyms != other.osyms): raise ValueError('transducers must...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sub(first, other):\n if isinstance(first,FreeCAD.Vector) and isinstance(other,FreeCAD.Vector):\n return FreeCAD.Vector(first.x-other.x, first.y-other.y, first.z-other.z)", "def reverse_difference():", "def intersect(self, StdVectorFst other):\n if not (self.acceptor and other.acceptor):\n ...
[ "0.6086411", "0.6045616", "0.5977697", "0.59613603", "0.59549946", "0.5882719", "0.58611953", "0.57981336", "0.57964694", "0.57882184", "0.5762597", "0.5756364", "0.57557607", "0.5750434", "0.57060045", "0.5683181", "0.56800276", "0.5673425", "0.5637026", "0.5625878", "0.5625...
0.7712873
0
fst.closure_plus() > Kleen plus closure (X+ = XX) of the transducer
def closure_plus(self): cdef StdVectorFst result = self.copy() result.set_closure(plus=True) return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addition(self):\n\t\treturn lambda anything: self.__class__(\n\t\t\t(self[:], disj, checked_proposition(anything)[:])\n\t\t)", "def zzX_add_term(f, c, k=0):\n if poly_univariate_p(f):\n return zzx_add_term(f, c, k)\n\n if zzX_zero_p(c):\n return f\n\n n = len(f)\n m = n-k-1\n\n i...
[ "0.50570345", "0.5037606", "0.5026509", "0.49782056", "0.49160352", "0.49004078", "0.48918864", "0.48902607", "0.4848267", "0.4829272", "0.48242396", "0.47120345", "0.47120014", "0.47120014", "0.47050413", "0.46969607", "0.46718997", "0.46661776", "0.46263248", "0.4610262", "...
0.5831245
0
fst.reverse() > reversed transducer
def reverse(self): cdef StdVectorFst result = StdVectorFst(isyms=self.isyms, osyms=self.osyms) openfst.Reverse(self.fst[0], result.fst) return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reverse(seq):\n return seq[::-1]", "def reverse(seq):\n return seq[::-1]", "def reverse_this(seq):\n r_seq = seq[::-1]\n return r_seq", "def reverse_elements(seq):\n seq_copy = seq [::-1]\n return seq_copy", "def uninferable(seq):\n return reversed(seq)", "def rev(self):\n ...
[ "0.65589255", "0.65589255", "0.6322597", "0.62404", "0.61557543", "0.6151756", "0.6123157", "0.6069002", "0.6058933", "0.6027868", "0.60132813", "0.59784895", "0.5960527", "0.5904797", "0.59039223", "0.5903171", "0.58870864", "0.5848986", "0.582349", "0.5799277", "0.5793437",...
0.66294193
0
fst.shortest_distance(bool reverse=False) > length of the shortest path
def shortest_distance(self, bint reverse=False): cdef vector[openfst.TropicalWeight] distances openfst.ShortestDistance(self.fst[0], &distances, reverse) cdef unsigned i dist = [TropicalWeight(distances[i].Value()) for i in range(distances.size())] return dist
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shortestPathLength(self, graph):\n # binary representation of a state of which nodes visited.\n ans = (1 << len(graph)) - 1\n\n # typical template for bfs; initil\n qe = []\n visited = set()\n for i in range(len(graph)):\n qe.append((i, 1 << i))\n ...
[ "0.6468428", "0.6400149", "0.62307173", "0.6181717", "0.6119881", "0.61102235", "0.60731053", "0.6039813", "0.59823483", "0.5925195", "0.5919849", "0.5901156", "0.58949405", "0.58628094", "0.5846925", "0.58374566", "0.5829668", "0.5780163", "0.57778525", "0.5777451", "0.57663...
0.67651814
0
fst.shortest_path(int n=1) > transducer containing the n shortest paths
def shortest_path(self, unsigned n=1): if not isinstance(self, StdVectorFst): raise TypeError('Weight needs to have the path property and be right distributive') cdef StdVectorFst result = StdVectorFst(isyms=self.isyms, osyms=self.osyms) openfst.ShortestPath(self.fst[0], result.fst, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shortest_path(N, a_0, a_1=None):\n path = HJ_path(a_1*N, a_0*N)\n path = [c/d/N for c, d in path]\n return path", "def find_shortest_path(g, n, s, e):\n dist, prev = lazy_dijkstra(g, n, s)\n path = []\n if (dist[e] == inf):\n return path\n # loop backwards from the end vertex\n ...
[ "0.72574353", "0.6779499", "0.6626936", "0.65902966", "0.657986", "0.64826405", "0.6330357", "0.6329434", "0.6324753", "0.6273223", "0.62089425", "0.6148668", "0.61475307", "0.6145802", "0.61132425", "0.60910463", "0.60695976", "0.6064646", "0.6057583", "0.6035212", "0.603401...
0.723889
1
fst.push(final=False, weights=False, labels=False) > transducer with weights or/and labels pushed to initial (default) or final state
def push(self, final=False, weights=False, labels=False): cdef StdVectorFst result = StdVectorFst(isyms=self.isyms, osyms=self.osyms) cdef int ptype = 0 if weights: ptype |= openfst.kPushWeights if labels: ptype |= openfst.kPushLabels if final: openfst.StdArcPushFinal...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def push_weights(self, final=False):\n return self.push(final, weights=True)", "def push(self, transition, *args, **kwargs):\n raise NotImplementedError", "def push_transition(self, s_tp1):\n self.states[self.pointer + 1] = s_tp1\n self.pointer += 1", "def push(self, state, action...
[ "0.6277243", "0.5895588", "0.5667142", "0.55976665", "0.559007", "0.5564427", "0.5254385", "0.5218644", "0.52134675", "0.5156183", "0.5109405", "0.5109405", "0.51072586", "0.5081782", "0.5081119", "0.5075794", "0.505604", "0.50500065", "0.5024904", "0.5011437", "0.50001043", ...
0.6876669
0
fst.push_weights(final=False) > transducer with weights pushed to initial (default) or final state
def push_weights(self, final=False): return self.push(final, weights=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def push(self, final=False, weights=False, labels=False):\n cdef StdVectorFst result = StdVectorFst(isyms=self.isyms, osyms=self.osyms)\n cdef int ptype = 0\n if weights: ptype |= openfst.kPushWeights\n if labels: ptype |= openfst.kPushLabels\n if final:\n openfst.StdA...
[ "0.5956245", "0.56888956", "0.56398916", "0.56398916", "0.54933304", "0.54659986", "0.54577655", "0.5434372", "0.54123586", "0.54071677", "0.5347842", "0.5316553", "0.53136283", "0.530291", "0.5295784", "0.52882373", "0.52612233", "0.52612233", "0.52612233", "0.5259971", "0.5...
0.75353676
0
fst.push_labels(final=False) > transducer with labels pushed to initial (default) or final state
def push_labels(self, final=False): return self.push(final, labels=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def push(self, final=False, weights=False, labels=False):\n cdef StdVectorFst result = StdVectorFst(isyms=self.isyms, osyms=self.osyms)\n cdef int ptype = 0\n if weights: ptype |= openfst.kPushWeights\n if labels: ptype |= openfst.kPushLabels\n if final:\n openfst.StdA...
[ "0.5967105", "0.5179531", "0.51263374", "0.5107814", "0.51046795", "0.506244", "0.5060464", "0.50451463", "0.5039498", "0.5032216", "0.5010942", "0.5009389", "0.5004121", "0.49748337", "0.49653673", "0.49534157", "0.49496177", "0.49412832", "0.49258912", "0.4917706", "0.49072...
0.7259111
0
fst.plus_map(value) > transducer with weights equal to the original weights plus the given value
def plus_map(self, value): cdef StdVectorFst result = StdVectorFst(isyms=self.isyms, osyms=self.osyms) if not isinstance(value, TropicalWeight): value = TropicalWeight(value) openfst.ArcMap(self.fst[0], result.fst, openfst.PlusStdArcMapper((<TropicalWeight> value).weight[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def weight_expr(self, t, w_plus, z, value):\n pass", "def add_weight(self, from_neuron, to_neuron, value):\n index = (to_neuron * self.neuron_count) + from_neuron\n if index >= len(self.weights):\n raise IndexError(\"Out of range: from_neuron: {}, to_neuron: {}\".format(from_neuro...
[ "0.621839", "0.6114559", "0.600115", "0.5804063", "0.5722751", "0.5693648", "0.5687755", "0.5559211", "0.55528057", "0.5552691", "0.5549615", "0.5522629", "0.5510024", "0.5501206", "0.54631764", "0.54226154", "0.5411739", "0.53821194", "0.5376813", "0.53541845", "0.5352328", ...
0.71642935
0
fst.times_map(value) > transducer with weights equal to the original weights times the given value
def times_map(self, value): cdef StdVectorFst result = StdVectorFst(isyms=self.isyms, osyms=self.osyms) if not isinstance(value, TropicalWeight): value = TropicalWeight(value) openfst.ArcMap(self.fst[0], result.fst, openfst.TimesStdArcMapper((<TropicalWeight> value).weigh...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def weighting(wb, m, a):\n s = control.tf([1, 0], [1])\n return (s/m + wb) / (s + wb*a)", "def comprehensive_transition_matrix(v, weight, n_bits):\n assert len(v) == n_parameters(weight, n_bits), \"v is the wrong dimension\"\n\n n_w = n_parameters_per_matrix(weight, n_bits)\n n_a = n_matrices_per_...
[ "0.58155817", "0.5608829", "0.54855907", "0.5482287", "0.54707223", "0.5318477", "0.5318477", "0.52631176", "0.52570164", "0.5213809", "0.5201124", "0.5189139", "0.51564693", "0.5148534", "0.5133489", "0.5125699", "0.51220584", "0.51186234", "0.51099324", "0.5065519", "0.5058...
0.68501806
0
fst.remove_weights() > transducer with weights removed
def remove_weights(self): cdef StdVectorFst result = StdVectorFst(isyms=self.isyms, osyms=self.osyms) openfst.ArcMap(self.fst[0], result.fst, openfst.RmTropicalWeightMapper()) return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def RemoveWeights(frame, zero_nans=False):\n if \"Wpol\" not in frame and \"Wunpol\" not in frame:\n return\n\n if not frame[\"T\"].weighted:\n return frame\n ValidateMaps(frame)\n\n tmap = frame.pop(\"T\")\n\n if \"Wpol\" in frame:\n wmap = frame[\"Wpol\"]\n qmap = frame...
[ "0.62990224", "0.60294455", "0.59813094", "0.5881217", "0.57514244", "0.5749189", "0.5739195", "0.57177734", "0.56974894", "0.56974894", "0.5688978", "0.5655647", "0.5633824", "0.5622353", "0.55966955", "0.55897725", "0.555529", "0.55475813", "0.5521228", "0.5521228", "0.5496...
0.6814973
0
fst.invert_weights() > transducer with inverted weights
def invert_weights(self): cdef StdVectorFst result = StdVectorFst(isyms=self.isyms, osyms=self.osyms) openfst.ArcMap(self.fst[0], result.fst, openfst.InvertTropicalWeightMapper()) return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalizeWeights(self):\n for wt in self.weights:\n wt[wt>1] = 1\n wt[wt<-1] = -1\n for bs in self.bias:\n bs[bs>1] = 1\n bs[bs<-1] = -1", "def __invert__(self):\n return self.fam.c_unop('invert', self)", "def invert(self):\n self.vert...
[ "0.6245089", "0.6137868", "0.5967409", "0.5943088", "0.5874188", "0.57992786", "0.579553", "0.57924", "0.5773543", "0.5705209", "0.566515", "0.56568927", "0.5629463", "0.5623858", "0.5580975", "0.55782956", "0.55737484", "0.55570453", "0.5556228", "0.55188745", "0.5512776", ...
0.7489498
0
fst.replace(label_fst_map, epsilon=False) > transducer with nonterminals replaced
def replace(self, label_fst_map, epsilon=False): assert self.osyms # used to encode labels cdef StdVectorFst result = StdVectorFst(isyms=self.isyms, osyms=self.osyms) cdef vector[pair[int, openfst.ConstStdVectorFstPtr]] label_fst_pairs cdef StdVectorFst fst label_fst_map['__ROOT_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addReplaceGraph(self, index_graph, index_namespace, *temp_namespaces):\n\n existing_indexes = list(set(index_graph.matchNamespace(index_namespace))) # target prefix?\n lp = len(index_namespace)\n suffixes = [int(u[lp:]) for u in existing_indexes]\n start = max(suffixes) + 1 if suf...
[ "0.55535024", "0.54823536", "0.54716563", "0.54646164", "0.53058475", "0.5207826", "0.5121671", "0.50306106", "0.5001328", "0.4949655", "0.49229786", "0.4922424", "0.49219033", "0.4906215", "0.489468", "0.487425", "0.48597205", "0.4857501", "0.48156703", "0.4814905", "0.48079...
0.7282194
0
fst.logprob_generate(n_path=1) > n_path random paths sampled according to weights assumed to encode log probabilities
def logprob_generate(self, n_path=1, max_len=None, weighted=False): cdef StdVectorFst result = StdVectorFst(isyms=self.isyms, osyms=self.osyms) cdef int seed = random.randint(0, INT_MAX) cdef openfst.LogProbStdArcSelector* selector = new openfst.LogProbStdArcSelector(seed) cdef int maxle...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_prob(self):", "def pathProb(self, path):\n # Establish initial state distribution.\n estState = []\n for s in range(self.P):\n estState.append(self.initial(path[0][0], s))\n logProb = 0\n for step in range(1, len(path)):\n # Calculate a softmax pro...
[ "0.6375611", "0.63293356", "0.6045664", "0.60323983", "0.6031593", "0.60283834", "0.59639466", "0.5921264", "0.59190476", "0.58894104", "0.58496875", "0.5776257", "0.5764778", "0.5742772", "0.5704037", "0.569994", "0.5676815", "0.5650656", "0.5642329", "0.5637369", "0.5636269...
0.744798
0
Method to remove samples with missing views PARAMETERS
def removeIncompleteSamples(data): print("Removing incomplete samples...") M = len(data) N = data[0].shape[0] samples_to_remove = [] for n in range(N): for m in range(M): if pd.isnull(data[m].iloc[n][0]): samples_to_remove.append(n) break if ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_intent_classifier_del_training_samples_all(self):\n pass", "def test_intent_classifier_del_training_samples(self):\n pass", "def test_other_study_not_in_queryset(self):\n # Delete all but five source traits, so that there are 5 from each study.\n study2 = factories.StudyFac...
[ "0.5974973", "0.5966185", "0.58715934", "0.58715934", "0.5855055", "0.58248854", "0.5814161", "0.5801252", "0.57774687", "0.5772661", "0.57554215", "0.5704306", "0.56977016", "0.5693439", "0.5690832", "0.56738245", "0.5666975", "0.5666975", "0.5666975", "0.5644226", "0.563809...
0.6024295
0
Method to save the training statistics in an hdf5 file PARAMETERS
def saveTrainingStats(model, hdf5): stats = model.getTrainingStats() stats_grp = hdf5.create_group("training_stats") stats_grp.create_dataset("activeK", data=stats["activeK"]) stats_grp.create_dataset("elbo", data=stats["elbo"]) stats_grp.create_dataset("elbo_terms", data=stats["elbo_terms"].T) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_as_hdf5(self, filename):", "def save_h5(self, filename):\n try:\n shutil.copyfile(filename, '{0}_bak'.format(filename))\n except IOError:\n print 'could not make backup of trainer param file (which is \\\n normal if we haven\\'t saved one until now)...
[ "0.76186526", "0.74484", "0.7302508", "0.7036124", "0.68702656", "0.68636805", "0.6862404", "0.6836825", "0.6830172", "0.6630677", "0.6627013", "0.66142386", "0.65550214", "0.64987785", "0.64877", "0.64374703", "0.6429999", "0.64238906", "0.64071083", "0.64017457", "0.6395792...
0.79240113
0
Method to save the training options in an hdf5 file PARAMETERS
def saveTrainingOpts(opts, hdf5): # Remove dictionaries from the options for k,v in opts.copy().items(): if type(v)==dict: for k1,v1 in v.items(): opts[str(k)+"_"+str(k1)] = v1 opts.pop(k) # Create HDF5 data set hdf5.create_dataset("training_opts", data=n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_h5(self, filename):\n try:\n shutil.copyfile(filename, '{0}_bak'.format(filename))\n except IOError:\n print 'could not make backup of trainer param file (which is \\\n normal if we haven\\'t saved one until now)'\n paramfile = tables.openFile(...
[ "0.7541448", "0.71382374", "0.6994086", "0.6971694", "0.6970202", "0.692363", "0.6838004", "0.68295485", "0.66984445", "0.6564147", "0.64481384", "0.64433485", "0.63179415", "0.6317367", "0.6292988", "0.6272117", "0.6240768", "0.62215", "0.6210662", "0.61986285", "0.6158499",...
0.757535
0
Method to save the model options in an hdf5 file PARAMETERS
def saveModelOpts(opts, hdf5): opts_interest = ["learnIntercept","schedule","likelihood","sparsity"] opts = dict((k, opts[k]) for k in opts_interest) grp = hdf5.create_group('model_opts') for k,v in opts.items(): grp.create_dataset(k, data=np.asarray(v).astype('S')) grp[k].attrs['names'] = n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_h5(self, filename):\n try:\n shutil.copyfile(filename, '{0}_bak'.format(filename))\n except IOError:\n print 'could not make backup of trainer param file (which is \\\n normal if we haven\\'t saved one until now)'\n paramfile = tables.openFile(...
[ "0.71215373", "0.69332534", "0.6906875", "0.68623835", "0.6848984", "0.6801983", "0.6710405", "0.6583333", "0.65404475", "0.6526262", "0.6478722", "0.64776677", "0.64507914", "0.64346147", "0.6415686", "0.6334888", "0.6334126", "0.63304484", "0.6325904", "0.6320708", "0.63110...
0.76416385
0
Returns the right file extension, codec and audio quality based on the command line arguments.
def audio_codec(): arguments = map_arguments() if arguments['-c'] == 'ogg': return '.ogg', 'libvorbis', arguments['-q'] elif arguments['-c'] == 'mp3': return '.mp3', 'libmp3lame', arguments['-q']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n songs = []\n first_line = sys.stdin.readline().split(' ', 1)\n songs_on_album, songs_to_select = int(first_line[0]), int(first_line[1])\n for i in range(songs_on_album):\n line = sys.stdin.readline().split(' ', 1)\n song = Song(line[1], int(line[0]), i+1)\n songs.append(song)\n\n print_...
[ "0.56709796", "0.5644258", "0.55935603", "0.55931133", "0.5572692", "0.54806256", "0.5473442", "0.54529715", "0.5429261", "0.5399557", "0.53953904", "0.53751093", "0.5370239", "0.53674275", "0.5362373", "0.5354838", "0.5344439", "0.5343309", "0.5330692", "0.5306567", "0.52950...
0.7217277
0
This function read a log file obtained from simulated tempering and returns a numpy array of shape (number of time points, number of states, 2) The first axis of the array refears to each output on the log file. The second axis refears to the temperature states And the last one to the counts and value of the correspond...
def get_weights_from_log(log, plot = False): with open(log, 'r') as f: log_file = f.readlines() i = 0 time = [] weights_info = [] weights_0 = [] while i < len(log_file): if 'init-lambda-weights[' in log_file[i]: weights_0.append(float(log_file[i].split('=')[-1])) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getWeights(self, format='list'):\n timer = None\n if conf.config.getboolean(\"Reports\", \"outputTimesForSections\"):\n timer = Timer()\n timer.start_timing()\n synapse_list = self._get_synaptic_data()\n if conf.config.getboolean(\"Reports\", \"outputTimesForSe...
[ "0.5679781", "0.5495576", "0.5362034", "0.527573", "0.5247644", "0.51613903", "0.51452", "0.51238173", "0.5120641", "0.5115963", "0.50911295", "0.50866115", "0.49406517", "0.4936814", "0.4911786", "0.48889357", "0.486517", "0.48642686", "0.4859323", "0.48575228", "0.4830234",...
0.7046495
0
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 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
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 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
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
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
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 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 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
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 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 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
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
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
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
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
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
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
get the menu title of the page depending on the given language
def get_menu_title(self, language=None, fallback=False, version_id=None, force_reload=False): menu_title = self.get_title_obj_attribute("menu_title", language, fallback, version_id, force_reload) if not menu_title: return self.get_title(language, True, version_id, force_reload) retur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getTitle(self):\n return self.context.getTitle(self.getLanguage())", "def get_title():", "def get_title_menu(self):\n return _(self.view_label).capitalize()", "def get_page_title(self, language=None, fallback=False, version_id=None, force_reload=False):\n page_title = self.get_title_...
[ "0.6920393", "0.68973166", "0.671494", "0.6652602", "0.6392951", "0.63896", "0.6386491", "0.6281369", "0.62758493", "0.62048024", "0.6185566", "0.61490595", "0.61490595", "0.61161995", "0.60877156", "0.6074168", "0.6031214", "0.6019012", "0.6019012", "0.5997675", "0.5944884",...
0.7287521
0
get the page title of the page depending on the given language
def get_page_title(self, language=None, fallback=False, version_id=None, force_reload=False): page_title = self.get_title_obj_attribute("page_title", language, fallback, version_id, force_reload) if not page_title: return self.get_menu_title(language, True, version_id, force_reload) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getTitle(self, language=None):\n document = self._get_or_add(language)\n return document.title", "def getTitle(self):\n return self.context.getTitle(self.getLanguage())", "def get_title():", "def page_title(self):\n # if view explicitly sets a page_title, use it\n if se...
[ "0.71803176", "0.70723855", "0.6914621", "0.68383604", "0.6718075", "0.66928214", "0.6652376", "0.65748155", "0.65583384", "0.65247035", "0.6469829", "0.63917917", "0.6382786", "0.63718766", "0.6353152", "0.63526255", "0.63420594", "0.6260748", "0.62148196", "0.62148196", "0....
0.737846
0
get content for the description meta tag for the page depending on the given language
def get_meta_description(self, language=None, fallback=True, version_id=None, force_reload=False): return self.get_title_obj_attribute("meta_description", language, fallback, version_id, force_reload)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_meta_description(self, article):\r\n return self.get_meta_content(article.doc, \"meta[name=description]\")", "def description_mega(self, html): # pylint: disable=too-many-statements,too-many-branches\n description_list = []\n with suppress(Exception):\n '''\n T...
[ "0.699441", "0.6745166", "0.6740249", "0.67005473", "0.6627198", "0.65410584", "0.6275418", "0.623432", "0.6216396", "0.6161247", "0.614077", "0.61108243", "0.6075515", "0.6053459", "0.605007", "0.60121346", "0.5990863", "0.5965748", "0.59061915", "0.5887589", "0.5883138", ...
0.70003384
0
get the template of this page.
def get_template(self): return self.template
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetTemplate(self, _page_data):\n return self.template", "def get_template(self):\n if self.get_website:\n return self.get_website.get_template()\n else:\n return default_entity.get_website.get_template()", "def template(self):\n return self._template", "def t...
[ "0.8522231", "0.81524044", "0.7965052", "0.7965052", "0.7965052", "0.7895042", "0.7553917", "0.75520504", "0.7433693", "0.7346615", "0.7325824", "0.7264637", "0.72359586", "0.69926757", "0.6973034", "0.69549125", "0.6891636", "0.6882589", "0.68770707", "0.68127596", "0.681229...
0.85542464
0
get the template of this page if defined or if closer parent if defined or DEFAULT_PAGE_TEMPLATE otherwise
def get_template_name(self): template = None if self.template: template = self.template if not template: for p in self.get_ancestors(ascending=True): if p.template: template = p.template break if not templat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_template(self):\n if self.get_website:\n return self.get_website.get_template()\n else:\n return default_entity.get_website.get_template()", "def GetTemplate(self, _page_data):\n return self.template", "def get_template_name(self):\n if self.template_name:\...
[ "0.6953846", "0.6819903", "0.6446561", "0.6422601", "0.63925564", "0.63040316", "0.62543637", "0.61951923", "0.56871915", "0.5661854", "0.5622901", "0.56095", "0.5555399", "0.5551583", "0.55412394", "0.553155", "0.55284125", "0.54785556", "0.54785556", "0.54650855", "0.546165...
0.6979716
0
Has user ability to move current page?
def has_move_page_permission(self, request): return self.has_generic_permission(request, "move_page")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_page(self, target, position='first-child'):\n self.move_to(target, position)\n # fire signal\n \n self.force_moderation_action = PageModeratorState.ACTION_MOVE\n cms_signals.page_moved.send(sender=Page, instance=self) #titles get saved before moderation\n self.sav...
[ "0.64280534", "0.6187641", "0.61322004", "0.58813006", "0.58044183", "0.578107", "0.57779676", "0.5712148", "0.5658178", "0.56542987", "0.56440187", "0.5615534", "0.5597054", "0.5594646", "0.5581836", "0.54903746", "0.5489693", "0.5466242", "0.54378325", "0.5430318", "0.54303...
0.67411345
0
Has user ability to moderate current page? If moderation isn't installed, nobody can moderate.
def has_moderate_permission(self, request): if not settings.CMS_MODERATOR: return False return self.has_generic_permission(request, "moderate")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def current_user_moderating(self):\n return self.user_moderating(users.GetCurrentUser())", "def can_be_moderated_by(user):\n return user.is_active and user.is_staff and (\n user.has_perm('blog.change_membership') or\n user.has_perm('blog.change_blog'))", "def is_moderator(self...
[ "0.7437271", "0.7325415", "0.72624916", "0.68007153", "0.65837425", "0.65674955", "0.6538372", "0.6484397", "0.6445654", "0.64426666", "0.6377128", "0.63274056", "0.63235515", "0.62783694", "0.6265251", "0.6246652", "0.62361526", "0.6231501", "0.6224706", "0.6207935", "0.6200...
0.76758987
0
Returns last page state if CMS_MODERATOR
def last_page_state(self): # TODO: optimize SQL... 1 query per page if settings.CMS_MODERATOR: # unknown state if no moderator try: return self.pagemoderatorstate_set.all().order_by('-created',)[0] except IndexError: pass ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_last_page(self):\n return self.page == self.last_page", "def get_last_page(self):\n return self.last_page", "def get_latest(self):\n self.cprint(\"##\\tGetting max page number...\\n\", log=True)\n return 1", "def is_last_allowable_page(self):\n if self.countable:\n ...
[ "0.63260895", "0.6136354", "0.5797387", "0.5597132", "0.5579155", "0.55518484", "0.5538862", "0.5519774", "0.5512011", "0.54611725", "0.53687274", "0.53618336", "0.5323161", "0.5318444", "0.53029406", "0.5288249", "0.5263255", "0.52350307", "0.5232209", "0.52288336", "0.51542...
0.81155026
0
Returns ordered set of all PageModerator instances, which should moderate this page
def get_moderator_queryset(self): if not settings.CMS_MODERATOR or not self.tree_id: return PageModerator.objects.get_empty_query_set() q = Q(page__tree_id=self.tree_id, page__level__lt=self.level, moderate_descendants=True) | \ Q(page__tree_id=self.tree_id, page__level=...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def fetch_moderated(self):\n\n logging.debug(\"Fetching moderated\")\n\n data = await self.client.request.get(\"/auth/user/playermoderated\")\n return [PlayerModeration.build_moderation(\n self.client, mod, self.loop) for mod in data[\"data\"]]", "def get_required_groups(pag...
[ "0.6223007", "0.57231057", "0.5459483", "0.5364359", "0.5333543", "0.5318118", "0.5259848", "0.5259629", "0.5243814", "0.52181244", "0.51199985", "0.51199985", "0.503113", "0.501669", "0.5010157", "0.5010113", "0.4990176", "0.4948901", "0.49395126", "0.49189487", "0.49040362"...
0.75413513
0
Returns true, if page is approved and published, or approved, but parents are missing..
def is_approved(self): return self.moderator_state in (Page.MODERATOR_APPROVED, Page.MODERATOR_APPROVED_WAITING_FOR_PARENTS)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def orphaned(self):\n return (self.parent is None)", "def has_parent(self):\n return False", "def has_parents(self):\n return len(self._parents) > 0", "def publish(self, fields=None, exclude=None):\n # clean moderation log\n self.pagemoderatorstate_set.all().delete()\n \...
[ "0.63411736", "0.6171674", "0.61385125", "0.60719556", "0.602873", "0.599978", "0.5943389", "0.59328663", "0.5920528", "0.58290297", "0.58004415", "0.5798648", "0.57899135", "0.57749325", "0.57547385", "0.5733244", "0.5728598", "0.5715474", "0.57106864", "0.5686434", "0.56839...
0.6747977
0