query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Signature as an XMLRPC 'signature'.
def xmlrpc_signatures(self): return self.rpc_signatures
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _build_signature(self):\n sig_contents = \\\n self.payload + \".\" + \\\n b64encode(b\"application/xml\").decode(\"ascii\") + \".\" + \\\n b64encode(b\"base64url\").decode(\"ascii\") + \".\" + \\\n b64encode(b\"RSA-SHA256\").decode(\"ascii\")\n sig_hash...
[ "0.7184918", "0.69686896", "0.6912548", "0.69076985", "0.68146133", "0.6725265", "0.66943675", "0.66943675", "0.66943675", "0.6634204", "0.6633522", "0.6561415", "0.65550405", "0.6549917", "0.652938", "0.64934224", "0.64879084", "0.64691335", "0.64691335", "0.6420456", "0.640...
0.61701065
34
Get an RPC signature by full name.
def get_method(self, method): for provider in self.method_handlers: for candidate in provider.xmlrpc_methods(): #self.env.log.debug(candidate) p = Method(provider, *candidate) if p.name == method: return p raise MethodNotFo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_signature(self, signature_name=None):\n return None, None", "def methodSignature(self, name):\r\n methods = self._listMethods()\r\n for method in methods:\r\n if method == name:\r\n rtype = None\r\n ptypes = []\r\n parsed = gettags(...
[ "0.68723637", "0.6210406", "0.6134881", "0.5682582", "0.5608959", "0.5547333", "0.55103743", "0.5493435", "0.54649395", "0.545117", "0.5436935", "0.5410457", "0.5397576", "0.5373635", "0.53136307", "0.530501", "0.52819455", "0.52735406", "0.52712643", "0.5222953", "0.51910514...
0.0
-1
List all methods exposed via RPC. Returns a list of Method objects.
def all_methods(self, req): for provider in self.method_handlers: for candidate in provider.xmlrpc_methods(): # Expand all fields of method description yield Method(provider, *candidate)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_methods(self):\n if not len(self.methods):\n try:\n self.methods = self.server.system.listMethods()\n except xmlrpclib.Fault, fault:\n raise BlogError(fault.faultString)\n\n return self.methods.sort()", "def list_methods(self, request, co...
[ "0.78063536", "0.7760441", "0.75646675", "0.75589406", "0.73298264", "0.73274004", "0.70894814", "0.7067124", "0.6919358", "0.69090086", "0.6892955", "0.6814702", "0.6716248", "0.66190255", "0.6566362", "0.6554939", "0.651463", "0.6479363", "0.64611197", "0.645592", "0.644655...
0.6903047
10
Takes an array of RPC calls encoded as structs of the form (in
def multicall(self, req, signatures): for signature in signatures: try: yield self.get_method(signature['methodName'])(req, signature['params']) except Exception, e: yield e
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def _electrum_rpc(client: StratumClient, requests: List[Tuple[str, ...]]) -> List:\n if len(requests) == 0:\n return []\n\n if len(requests) == 1:\n request = requests[0]\n response = await client.RPC(*request)\n return [response]\n\n response = await client.batch_rpc(req...
[ "0.61889356", "0.5797257", "0.57828593", "0.5730372", "0.5644468", "0.55430084", "0.55263215", "0.5463228", "0.5446705", "0.53693557", "0.53529286", "0.53477484", "0.52750164", "0.5248507", "0.52267796", "0.5225138", "0.52248627", "0.52214015", "0.52191406", "0.51856226", "0....
0.0
-1
This method returns a list of strings, one for each (nonsystem) method supported by the RPC server.
def listMethods(self, req): for method in self.all_methods(req): yield method.name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_rpc_method_names(self):\n return [name for name in dir(self) if _is_rpc_call_method(getattr(self, name))]", "def get_rpc_method_names(self):\n return self._get_rpc_method_names()", "def method_list(self):\n\t\tmethod_names = list(self.methods.keys())\n\t\tmethod_names.sort()\n\t\tmethod_...
[ "0.74507785", "0.744676", "0.71273005", "0.7035459", "0.6956781", "0.6945243", "0.68644214", "0.6820046", "0.67968106", "0.6720064", "0.6699861", "0.665346", "0.65834975", "0.65580946", "0.654632", "0.64500207", "0.644959", "0.641104", "0.64056057", "0.6363595", "0.6349203", ...
0.62865925
22
This method takes one parameter, the name of a method implemented by the RPC server. It returns a documentation string describing the use of that method. If no such string is available, an empty string is returned. The documentation string may contain HTML markup.
def methodHelp(self, req, method): p = self.get_method(method) return '\n'.join((p.signature, '', p.description))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def methodHelp(self, name):\r\n methods = self._listMethods()\r\n for methodname in methods.keys():\r\n if methodname == name:\r\n return methods[methodname]\r\n raise RPCError(Faults.SIGNATURE_UNSUPPORTED)", "def method(name, doc):\n import html\n\n params = ...
[ "0.7297669", "0.694731", "0.68896276", "0.6688466", "0.6388553", "0.6385201", "0.63499844", "0.6292997", "0.6292498", "0.62701833", "0.6107226", "0.60769576", "0.60552335", "0.60015124", "0.59173465", "0.58777815", "0.58560765", "0.58364666", "0.5824243", "0.5823201", "0.5823...
0.71314836
1
This method takes one parameter, the name of a method implemented by the RPC server. It returns an array of possible signatures for this method. A signature is an array of types. The first of these types is the return type of the method, the rest are parameters.
def methodSignature(self, req, method): p = self.get_method(method) return [','.join([RPC_TYPES[x] for x in sig]) for sig in p.xmlrpc_signatures()]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def methodSignature(self, name):\r\n methods = self._listMethods()\r\n for method in methods:\r\n if method == name:\r\n rtype = None\r\n ptypes = []\r\n parsed = gettags(methods[method])\r\n for thing in parsed:\r\n ...
[ "0.76971966", "0.6802462", "0.6156515", "0.612154", "0.60075223", "0.5919079", "0.5902551", "0.5769066", "0.5688802", "0.55987453", "0.55483836", "0.54988164", "0.5416799", "0.54150325", "0.5402403", "0.5375287", "0.5298141", "0.5274757", "0.5253134", "0.5250529", "0.521413",...
0.6672202
2
Returns a list with three elements. First element is the epoch (0=Trac 0.10, 1=Trac 0.11 or higher). Second element is the major version number, third is the minor. Changes to the major version indicate API breaking changes, while minor version changes are simple additions, bug fixes, etc.
def getAPIVersion(self, req): import re import tracrpc match = re.match(r'([0-9]+)\.([0-9]+)\.([0-9]+)', tracrpc.__version__) return map(int, match.groups())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_version_number():\n return [0, 1, 0]", "def epoch():\n\treturn time.time()", "def epoch(self):\n return _coordsys.coordsys_epoch(self)", "def get_server_version():\n url_address = 'https://raw.githubusercontent.com/muhammadfredo/FrMaya/master/FrMaya/version.py'\n url_data = urllib...
[ "0.618254", "0.60157156", "0.5808671", "0.57772446", "0.57352424", "0.569133", "0.56790584", "0.5625292", "0.5474962", "0.5416474", "0.5317114", "0.5290706", "0.52808994", "0.5271004", "0.5269445", "0.52262104", "0.5208265", "0.5202156", "0.51972467", "0.5195646", "0.5194441"...
0.46996364
87
Read aligment file. Hansard alignment is expected.
def read_alignment(file): alignments = list() with open(file, 'r') as f: for line in f: line_lst = line.strip().split() align_lst = list() for pair in line_lst: src_idx, tgt_idx = pair.split('-') align_lst.append((int(src_idx),int(tgt_i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _read_next_alignment(self, stream):", "def read_alignment(filepath, filetype):\n\n return AlignIO.read(filepath, filetype)", "def read_extended_alignment(self, path, aformat=\"stockholm\",\n assertion=False):\n handle = open(path, 'r')\n insertions = None\n ...
[ "0.7092832", "0.67729056", "0.66494703", "0.65757024", "0.6385235", "0.6234432", "0.61711687", "0.5988653", "0.5938738", "0.590328", "0.588054", "0.58504915", "0.58363646", "0.58170205", "0.5765209", "0.5737609", "0.57110476", "0.5662642", "0.5653508", "0.5646126", "0.5622445...
0.65420896
4
Extract all phrases from word alignment.
def extract_phrase(self, src_text, tgt_text, alignment, max_phrase_len=0): def extract_from_range(tgt_start, tgt_end, src_start, src_end, max_phrase_len): """Extract a set of possible phrase given the source, language ranges. """ # print("rages", tgt_start, tgt_end, src_star...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_phrases(data,model):\n phrases = []\n alignment = model.alignment_idx\n for i in range(len(data)):\n sent_phrases = phrase_extraction(data[i][\"fr\"],data[i][\"en\"],alignment[i])\n phrases.append(sent_phrases)\n return phrases", "def lemmatized_phrases(self):\n phras...
[ "0.7157194", "0.6438471", "0.61811405", "0.6119933", "0.6069589", "0.60057", "0.59385145", "0.58645695", "0.5848218", "0.58418983", "0.58405614", "0.58251745", "0.57417756", "0.57353705", "0.57185733", "0.57103014", "0.5676527", "0.56694734", "0.56662035", "0.5655986", "0.563...
0.6709278
1
Extract a set of possible phrase given the source, language ranges.
def extract_from_range(tgt_start, tgt_end, src_start, src_end, max_phrase_len): # print("rages", tgt_start, tgt_end, src_start, src_end) if tgt_end < 0: return # If `src_align_idx` out of the `src_start` and `src_target`. for src_align_idx, tgt_align_idx ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_phrase(self, src_text, tgt_text, alignment, max_phrase_len=0):\n def extract_from_range(tgt_start, tgt_end, src_start, src_end, max_phrase_len):\n \"\"\"Extract a set of possible phrase given the source, language ranges.\n\n \"\"\"\n # print(\"rages\", tgt_start,...
[ "0.6873448", "0.5602197", "0.5513425", "0.55112517", "0.5479709", "0.54267764", "0.5333438", "0.52627516", "0.5251202", "0.5215412", "0.52010435", "0.5196199", "0.5195391", "0.51823145", "0.5178213", "0.51594794", "0.51498526", "0.5126929", "0.50857365", "0.50619686", "0.5037...
0.70351136
0
Extract phrase from list of the parallel sentences.
def extract_phrase_from_parallel_sentences(self, src_lst, tgt_lst, word_alignment, max_phrase_len=0, save_phrase_table=None): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_phrases(data,model):\n phrases = []\n alignment = model.alignment_idx\n for i in range(len(data)):\n sent_phrases = phrase_extraction(data[i][\"fr\"],data[i][\"en\"],alignment[i])\n phrases.append(sent_phrases)\n return phrases", "def sentence_parse(list_of_posts): \n fo...
[ "0.6296526", "0.6136638", "0.5852756", "0.5819079", "0.57264394", "0.5696509", "0.5664151", "0.559129", "0.55865973", "0.55777866", "0.5577783", "0.5568261", "0.553962", "0.54893243", "0.5487933", "0.54764163", "0.5456427", "0.5454422", "0.543709", "0.5425575", "0.5423253", ...
0.6505854
0
Compute log probability of sorucetarget phrase pairs. Note that we compute log p(f|e) due to the noise channel assumption.
def compute_log_probs(self, phrases, save_to_file=None): # Co-ocurrence for source and target phrase tgt_src_cnt = defaultdict(lambda: defaultdict(int)) # ocurrence for target (English) tgt_cnt = defaultdict(int) # Compute frequency and co-occurence for phrase_p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sentence_logprob(self, sentence):\n line = get_ngrams(sentence,3)\n log_por = 0.0\n for item in line:\n raw_por = self.smoothed_trigram_probability(item)\n log_por = log_por+math.log2(raw_por)\n\n return float(log_por)", "def sentence_logprob(self, sentence):...
[ "0.74536216", "0.72376466", "0.6940813", "0.69313174", "0.6906261", "0.6710182", "0.6671943", "0.66348374", "0.66269255", "0.66226804", "0.658965", "0.6519465", "0.6512543", "0.6429427", "0.6417837", "0.6415285", "0.63980013", "0.63869506", "0.6386877", "0.63799185", "0.63781...
0.7457257
0
Flatten nested list into a list of sorucetarget phrase pairs.
def flatten_phrase_collect(phrase_collect): flatten_phrse_collect = list() for phrase_lst in phrase_collect: pass return flatten_phrse_collect
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flatten(nested_list):\r\n return list(chain.from_iterable(nested_list))", "def _flatten(phrases):\n return [' '.join(phrase) for phrase in phrases]", "def flatten(nested_list):\n for elt in nested_list:\n if isinstance(elt, collections.Iterable) and not isinstance(elt, six.string_types)...
[ "0.68353754", "0.6703909", "0.6512857", "0.65088475", "0.64734936", "0.640399", "0.618579", "0.6086874", "0.6073905", "0.60664827", "0.60623664", "0.604358", "0.60098505", "0.5991506", "0.5989105", "0.5989105", "0.5974142", "0.5966722", "0.5949544", "0.5914635", "0.59093", ...
0.69660723
0
Summary Split data into nq blocks.
def split_data(data, nq, flag=1): if flag == 1: quantiles = np.linspace(data.min(), data.max(), nq + 1) elif flag == 2: segs = np.linspace(0, 100, nq + 1) quantiles = np.percentile(data, segs) quantiles[0] = quantiles[0] - 1e-15 quantiles[-1] = quantiles[-1] + 1e-15 grp_names...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_chunk_size_priority_over_n_splits(self):\n with self.subTest(input='list', chunk_size=1, n_splits=6):\n self.assertEqual(get_n_chunks(self.test_data, iterable_len=None, chunk_size=1, n_splits=6, n_jobs=None), 13)\n with self.subTest(input='numpy', chunk_size=1, n_splits=6):\n ...
[ "0.57900053", "0.5749784", "0.55733985", "0.55712456", "0.55246603", "0.55168134", "0.5494334", "0.5402945", "0.5363317", "0.5348577", "0.532229", "0.52557427", "0.5247931", "0.5193257", "0.5171128", "0.51542133", "0.5153879", "0.51524353", "0.5149456", "0.51452446", "0.51341...
0.5802561
0
Summary Calculate information coefficient
def calc_ic(data): return scs.spearmanr(data[:, 0], data[:, 1]).correlation
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def coefficient(self) -> float:\n ...", "def get_perfect_information(self):\n raise NotImplementedError", "def calculate(self):", "def summary(self):\n raise NotImplementedError", "def compute_statistics(self):", "def estimateInfo(Analysis, ImageData, diffract, print_opt=False): ...
[ "0.67050064", "0.6497096", "0.64120954", "0.62755823", "0.6260611", "0.6255357", "0.6219407", "0.6132243", "0.6056515", "0.6051543", "0.6032649", "0.602763", "0.6024639", "0.6019665", "0.5987596", "0.5975503", "0.59576994", "0.59452105", "0.59376025", "0.59330785", "0.5923176...
0.0
-1
Summary Calculate mean square error
def calc_mse(data, ax=0): return ((data[:, 0] - data[:, 1]) ** 2).mean(axis=ax)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def MeanSqError(self):\r\n\t\treturn self.mse", "def mean_squared_error(self):\n print('Mean squared error regression loss: ' + str(mean_squared_error(self.model.dataset.get_y_test(),\n self.model.get_predicted())))", "def get_...
[ "0.7567138", "0.7354275", "0.726577", "0.71755135", "0.70000595", "0.69570065", "0.69317585", "0.6890092", "0.6858004", "0.6785041", "0.677055", "0.67539006", "0.6746916", "0.6746916", "0.6723674", "0.67175984", "0.66966164", "0.66890544", "0.6660599", "0.66503626", "0.664182...
0.0
-1
online maxminscale normalization using key basic statistics.
def update_maxminscale(stats_on_target, lastest_minmax): target_xss, target_xs, target_xct = stats_on_target xmn, xmx = lastest_minmax zss = (target_xss - 2 * xmn * target_xs + target_xct * xmn**2) / (xmx - xmn)**2 zs = (target_xs - target_xct * xmn) / (xmx - xmn) zct = target_xct return zss, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _normalize(self, dataset):\n if self.max is None: # if we are normalizing the training set\n self.max, self.min = dataset.max(), dataset.min() # find max, min value for each columns\n for row in dataset.index: # for each row in dataset\n for c...
[ "0.63708794", "0.62702864", "0.61845", "0.61675406", "0.6165542", "0.61498797", "0.61322546", "0.6095306", "0.60869277", "0.6003787", "0.6002606", "0.60010904", "0.5944249", "0.59147775", "0.5865857", "0.58601046", "0.58502215", "0.5845374", "0.58325875", "0.5817523", "0.5789...
0.6510492
0
online zscore normalization using key basic statistics.
def update_zscore(stats_on_target, lastest_mustd): target_xss, target_xs, target_xct = stats_on_target xmu, xstd = lastest_mustd zss = (target_xss - 2 * target_xs * xmu + target_xct * xmu ** 2) / xstd ** 2 zs = (target_xs - target_xct * xmu) / xstd zct = target_xct return zss, zs, zct
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def zscore(vals):", "def z_score_std(train, test):\n scalers = {}\n for i, sample in enumerate(train):\n scalers[i] = StandardScaler()\n train[i] = scalers[i].fit_transform(sample)\n\n for i, sample in enumerate(test):\n test[i] = scalers[i].transform(sample)\n\n return train, te...
[ "0.66475713", "0.6414201", "0.6319118", "0.6291525", "0.61970514", "0.618369", "0.61619216", "0.60951513", "0.6063714", "0.6052275", "0.59794205", "0.59628385", "0.5939316", "0.59123677", "0.5901266", "0.5896098", "0.5873319", "0.58584255", "0.58458626", "0.58458626", "0.5845...
0.6038549
10
Creates a FlowNone, takes the command to which the Node is linked to.
def __init__(self, command: str = None, hints: bool = True): self.command = command self.children = [] # (predicate, node) self.hints = hints
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_new_flow(flow_root, requestor: Identifier, initial_command) \\\n -> Tuple[Optional[Flow], Optional[FlowNode]]:\n empty_context = {}\n flow = Flow(flow_root, requestor, empty_context)\n for possible_next_step in flow.next_steps():\n if possible_next_step.comman...
[ "0.62710094", "0.5478883", "0.5431005", "0.5244744", "0.5209037", "0.52035606", "0.5196872", "0.50918037", "0.50783676", "0.5072429", "0.49557534", "0.4943564", "0.48528713", "0.48491302", "0.48466516", "0.48291168", "0.47763118", "0.47480133", "0.47466248", "0.4736746", "0.4...
0.49670023
10
Construct the flow graph by connecting this node to another node or a command. The predicate is a function that tells the flow executor if the flow can enter the step without the user intervention (automatically).
def connect(self, node_or_command: Union['FlowNode', str], predicate: Predicate = lambda _: False, hints: bool = True): node_to_connect_to = node_or_command if isinstance(node_or_command, FlowNode) else FlowNode(node_or_command, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_new_flow(flow_root, requestor: Identifier, initial_command) \\\n -> Tuple[Optional[Flow], Optional[FlowNode]]:\n empty_context = {}\n flow = Flow(flow_root, requestor, empty_context)\n for possible_next_step in flow.next_steps():\n if possible_next_step.comman...
[ "0.6413768", "0.5331428", "0.52776724", "0.5124311", "0.51223505", "0.5108684", "0.50600624", "0.5043233", "0.5042275", "0.4964955", "0.49122655", "0.48988894", "0.48981482", "0.48565575", "0.484811", "0.4824072", "0.48154116", "0.4813976", "0.4800156", "0.4783596", "0.478087...
0.65801656
0
gets the predicate function for the specified child node.
def predicate_for_node(self, node: 'FlowNode'): for predicate, possible_node in self.children: if node == possible_node: return predicate return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_predicate(self):\n return self._predicate", "def predicate(f):\n wrapper = Predicate(f)\n update_wrapper(wrapper, f)\n return wrapper", "def predicate (self) :\n\n return self.__predicate__", "def to_predicate(self, node, f='predicate', map=None):\n\n if 'AK{}' == node.n...
[ "0.60676956", "0.59117705", "0.5859783", "0.5716894", "0.5592004", "0.54098916", "0.5391563", "0.5362847", "0.52606004", "0.52374494", "0.51913834", "0.50643146", "0.5036615", "0.49944842", "0.4963765", "0.49336788", "0.4933024", "0.49324915", "0.49315336", "0.49314764", "0.4...
0.69061804
0
Get the next steps that can be automatically executed according to the set predicates.
def next_autosteps(self) -> List[FlowNode]: return [node for predicate, node in self._current_step.children if predicate(self.ctx)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getSteps():", "def get_next_steps(self, steps):\n step_list = []\n\n steps_remaining = set(steps.keys())\n counter = 0\n max_counter = 10000\n next_steps = set()\n\n for step in steps_remaining:\n dependencies = steps[step]\n if len(dependencies...
[ "0.68260413", "0.61826456", "0.59532344", "0.59049976", "0.57587636", "0.56449825", "0.5614194", "0.5475476", "0.54743147", "0.54043585", "0.53964126", "0.53883094", "0.5375762", "0.5372784", "0.536757", "0.53402436", "0.5317131", "0.5306998", "0.53006005", "0.5283597", "0.52...
0.4923968
72
Get all the possible next steps after this one (predicates statisfied or not).
def next_steps(self) -> List[FlowNode]: return [node for predicate, node in self._current_step.children]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getSteps():", "def get_next_steps(self, steps):\n step_list = []\n\n steps_remaining = set(steps.keys())\n counter = 0\n max_counter = 10000\n next_steps = set()\n\n for step in steps_remaining:\n dependencies = steps[step]\n if len(dependencies...
[ "0.6234041", "0.58860874", "0.58491534", "0.5800428", "0.5592601", "0.5583821", "0.5574898", "0.5521146", "0.5507032", "0.5441927", "0.5365685", "0.5339986", "0.5337542", "0.5333407", "0.5318446", "0.53063506", "0.5300591", "0.5297238", "0.5295074", "0.5279935", "0.5268858", ...
0.6419919
0
Move on along the flow.
def advance(self, next_step: FlowNode, enforce_predicate=True): if enforce_predicate: predicate = self._current_step.predicate_for_node(next_step) if predicate is None: raise ValueError(f'There is no such children: {next_step}.') if not predicate(self.ctx): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forward(self):\n self.position += 1", "def step_forward(self):", "def advance(self) -> None:\n pass", "def advance(self):\n self._state = self._next_state", "def step(self, move):", "def forward( self ):\n self._has_change = True\n print( \"Forward\" )", "def move...
[ "0.74384344", "0.7432177", "0.7052693", "0.7011329", "0.68793774", "0.68633926", "0.6843568", "0.67537284", "0.6722338", "0.6645579", "0.6625062", "0.6621287", "0.6621287", "0.65949506", "0.6572828", "0.6572828", "0.6572828", "0.6570652", "0.6545895", "0.6537094", "0.65001476...
0.0
-1
Helper property to get the name of the flow.
def name(self) -> str: return self._root.name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flow_name(self):\n # This never changes (so no read locking needed).\n return self._flowdetail.name", "def flow_log_name(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"flow_log_name\")", "def step_name(self):\n return self._step_name", "def flow_id(self) -> ...
[ "0.89674693", "0.79398876", "0.69550246", "0.6820289", "0.68090695", "0.68007225", "0.6760528", "0.6747862", "0.67404884", "0.67219657", "0.6628888", "0.6625101", "0.6624028", "0.6591873", "0.6541664", "0.653939", "0.653911", "0.653911", "0.653911", "0.6525508", "0.6520471", ...
0.0
-1
The current step this Flow is waiting on.
def current_step(self) -> FlowNode: return self._current_step
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def step(self):\n return self._step", "def step(self):\n return self._step", "def step(self):\n return self._step", "def step(self):\n return self._step", "def get_step(self):\n return self.step", "def get_step(self):\n return self.step", "def step(self):\n ...
[ "0.80897826", "0.80897826", "0.80897826", "0.80897826", "0.80040395", "0.80040395", "0.79046434", "0.78787154", "0.78659546", "0.76517856", "0.7590155", "0.7244321", "0.71743906", "0.7152078", "0.70949507", "0.7006412", "0.6945117", "0.69421864", "0.6877987", "0.67704535", "0...
0.7882782
7
The original flowroot of this flow.
def root(self) -> FlowRoot: return self._root
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def root_orig(self):\n if hasattr(self, \"orig\"):\n return self.orig.root_orig\n return self", "def original(self):\n return self._original", "def original(self):\n return self._original", "def getOriginal(self,):\n\t\treturn self.original;", "def root(self):\n\t\tre...
[ "0.73445743", "0.6893548", "0.6893548", "0.6484647", "0.63805735", "0.63805735", "0.6353325", "0.6331243", "0.6286299", "0.62303126", "0.62067777", "0.62067777", "0.62067777", "0.6187001", "0.6182318", "0.6174468", "0.6174468", "0.6173917", "0.6116025", "0.60984105", "0.60967...
0.6993407
1
Get the name of this flow as described in its .plug file.
def name(self) -> str: return self._name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getName(self):\n return self.stepDictionary[self.getLocation()]", "def get_name(self):\n\t\treturn self.source.get_name()", "def display_name(self):\n try:\n return self.plug_dict['PlugName'].value\n except KeyError:\n return self.name", "def plugin_name(self):\...
[ "0.72229207", "0.7183337", "0.71583205", "0.7149492", "0.7129265", "0.7129265", "0.7129265", "0.7129265", "0.7129265", "0.7129265", "0.6979302", "0.6975787", "0.69578403", "0.6936074", "0.6934209", "0.6915648", "0.6910357", "0.6910357", "0.69089496", "0.69063693", "0.6899902"...
0.0
-1
Override if you want to do something at initialization phase (don't forget to super(Gnagna, self).activate())
def activate(self) -> None: self._bot.inject_flows_from(self) self.is_activated = True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def activate(self):\n pass", "def activate(self):\n raise NotImplementedError(\"Shouldn't be called\")", "def _activate(self):\n raise NotImplementedError('Subclasses must implement _activate()')", "def activate(self):\n super(Pixiv_bot, self).activate()", "def activate(self):\n...
[ "0.7181187", "0.7162541", "0.7085794", "0.6996718", "0.69452006", "0.6700154", "0.6605756", "0.6589444", "0.6585501", "0.64778143", "0.64478004", "0.64478004", "0.64430845", "0.6431264", "0.64214706", "0.64119846", "0.636943", "0.63071525", "0.6291065", "0.6280463", "0.628046...
0.0
-1
Override if you want to do something at tear down phase (don't forget to super(Gnagna, self).deactivate())
def deactivate(self) -> None: self._bot.remove_flows_from(self) self.is_activated = False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_deactivate(self) -> None:", "def deactivate(self):\n pass", "def deactivate(self):\n pass", "def on_deactivate(self):", "def deactivate(self):\n pass", "def deactivate(self):\n super(Pixiv_bot, self).deactivate()", "def deactivate(self):\n raise NotImplementedError...
[ "0.7673987", "0.7613473", "0.7613473", "0.756088", "0.7486912", "0.7407235", "0.72243154", "0.7201043", "0.70954955", "0.7069063", "0.69780624", "0.69780624", "0.69346464", "0.69018716", "0.69018716", "0.68386066", "0.68386066", "0.67960036", "0.6686626", "0.6686626", "0.6641...
0.0
-1
Helper to get a specific command.
def get_command(self, command_name: str): self._bot.all_commands.get(command_name, None)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_cmd(self, command):\n return self.commands[command][\"cmd\"]", "def get_command(self, ctx, cmd_name):\n path = \"%s.%s\" % (__name__, cmd_name)\n path = path.replace(\"-\", \"_\")\n try:\n module = importlib.import_module(path)\n return getattr(module, 'c...
[ "0.85638624", "0.8320065", "0.8262092", "0.81505215", "0.81448346", "0.8041625", "0.8030123", "0.79733753", "0.79297495", "0.7919713", "0.7854785", "0.784091", "0.77338827", "0.76426506", "0.76235944", "0.7594374", "0.7556176", "0.753687", "0.7505808", "0.74881387", "0.742349...
0.78783715
10
Register a flow with this executor.
def add_flow(self, flow: FlowRoot): with self._lock: self.flow_roots[flow.name] = flow
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register_flow(self, state, flow_id):\n self._flows[state] = flow_id\n _LOGGER.debug(\"Register state %s for flow_id %s\", state, flow_id)", "def flow(self, flow):\n\n self._flow = flow", "def add_flow_controller(cls, name, controller):\n cls.registered_controllers[name] = contro...
[ "0.69882387", "0.67626894", "0.6249088", "0.61617434", "0.6143314", "0.5989838", "0.58785754", "0.5878573", "0.58688176", "0.5865792", "0.5640574", "0.56151783", "0.5605409", "0.56050324", "0.553389", "0.5516025", "0.5483355", "0.5407733", "0.53915477", "0.53600454", "0.53564...
0.6806603
1
Trigger workflows that may have command cmd as a auto_trigger or an in flight flow waiting for command. This assume cmd has been correctly executed.
def trigger(self, cmd: str, requestor: Identifier, extra_context=None) -> Optional[Flow]: flow, next_step = self.check_inflight_flow_triggered(cmd, requestor) if not flow: flow, next_step = self._check_if_new_flow_is_triggered(cmd, requestor) if not flow: return None ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_if_new_flow_is_triggered(self, cmd: str, user: Identifier) -> Tuple[Optional[Flow], Optional[FlowNode]]:\n log.debug(\"Test if the command %s is an auto-trigger for any flow ...\", cmd)\n with self._lock:\n for name, flow_root in self.flow_roots.items():\n if cmd ...
[ "0.715326", "0.6214702", "0.5785957", "0.5547166", "0.54532874", "0.545297", "0.5442159", "0.5426565", "0.54126877", "0.54040956", "0.5393063", "0.5381227", "0.53534704", "0.5316226", "0.5302364", "0.5268394", "0.5265039", "0.5208793", "0.5185608", "0.51715356", "0.5159973", ...
0.6354978
1
Check if user is already running a flow.
def check_inflight_already_running(self, user: Identifier) -> bool: with self._lock: for flow in self.in_flight: if flow.requestor == user: return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def IsRunning(self):\n current_urn = self.Get(self.Schema.CURRENT_FLOW_URN)\n if current_urn:\n current_flow = aff4.FACTORY.Open(urn=current_urn,\n token=self.token, mode=\"r\")\n runner = current_flow.GetRunner()\n return runner.context.state == rdfvalue....
[ "0.69948125", "0.6222682", "0.61390924", "0.60672396", "0.6056235", "0.5998055", "0.59039176", "0.5898025", "0.58831185", "0.5882401", "0.58729315", "0.58365375", "0.58026636", "0.5799237", "0.5794511", "0.57941985", "0.57290274", "0.57271695", "0.5711765", "0.57040274", "0.5...
0.7122003
0
Check if a command from a specific user was expected in one of the running flow.
def check_inflight_flow_triggered(self, cmd: str, user: Identifier) -> Tuple[Optional[Flow], Optional[FlowNode]]: log.debug("Test if the command %s is a trigger for an inflight flow ...", cmd) # TODO: What if 2 flows wait for the same command ? with self._lock: for flow in self.in_fl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isOp(self, user, channel=None):\n if channel is not None:\n return user in self.opsets[channel]\n\n for ch in self.opsets:\n if user in self.opsets[ch]:\n return True\n return False", "def first_is_valid(command_from_user):\n arguement_entered_user...
[ "0.67603654", "0.65981525", "0.6361209", "0.62355417", "0.61246306", "0.61216444", "0.61108893", "0.6083007", "0.6078662", "0.6053866", "0.6019086", "0.5988494", "0.5978432", "0.59757924", "0.5973844", "0.5965293", "0.5941293", "0.59410834", "0.5940875", "0.59181905", "0.5878...
0.6565895
2
Trigger workflows that may have command cmd as a auto_trigger.. This assume cmd has been correctly executed.
def _check_if_new_flow_is_triggered(self, cmd: str, user: Identifier) -> Tuple[Optional[Flow], Optional[FlowNode]]: log.debug("Test if the command %s is an auto-trigger for any flow ...", cmd) with self._lock: for name, flow_root in self.flow_roots.items(): if cmd in flow_roo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trigger(self, cmd: str, requestor: Identifier, extra_context=None) -> Optional[Flow]:\n flow, next_step = self.check_inflight_flow_triggered(cmd, requestor)\n if not flow:\n flow, next_step = self._check_if_new_flow_is_triggered(cmd, requestor)\n if not flow:\n return...
[ "0.5883584", "0.58415097", "0.5791433", "0.5771063", "0.5762324", "0.576105", "0.5728582", "0.567646", "0.5645227", "0.5643713", "0.556337", "0.5523932", "0.54966164", "0.5453627", "0.54442376", "0.54439944", "0.5407391", "0.5404491", "0.53985775", "0.53704196", "0.53561866",...
0.7032899
0
Helper method to create a new FLow.
def _create_new_flow(flow_root, requestor: Identifier, initial_command) \ -> Tuple[Optional[Flow], Optional[FlowNode]]: empty_context = {} flow = Flow(flow_root, requestor, empty_context) for possible_next_step in flow.next_steps(): if possible_next_step.command == initia...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def makeLow(self, force = False):\n\t\tlow = self.reSize( 25, self.name + '_LOW', force )\n\t\treturn low", "def low(self, low: float):\n if low is None:\n raise ValueError(\"Invalid value for `low`, must not be `None`\") # noqa: E501\n\n self._low = low", "def toLow(self):\n\t\tif se...
[ "0.63650936", "0.6023866", "0.5982069", "0.5945411", "0.5836941", "0.57704055", "0.5701755", "0.5534835", "0.55330515", "0.54922855", "0.54561484", "0.5453786", "0.54480827", "0.54108757", "0.53992003", "0.5381154", "0.5377614", "0.5369102", "0.53397924", "0.5339053", "0.5302...
0.0
-1
Starts the execution of a Flow.
def start_flow(self, name: str, requestor: Identifier, initial_context: Mapping[str, Any]) -> Flow: if name not in self.flow_roots: raise ValueError(f'Flow {name} doesn\'t exist') if self.check_inflight_already_running(requestor): raise ValueError(f'User {str(requestor)} is alrea...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tcp_start(self, flow: mitmproxy.tcp.TCPFlow):", "def start_workflow(self, **params):\n raise NotImplementedError", "def start_execution(self):\n self.send_message(\"control.start\",None)", "def start(self):\n\t\tself.stream.start_stream()", "def StartFlow(flow_cls, client_id=None, flow_ar...
[ "0.683366", "0.67719877", "0.6592364", "0.6338926", "0.6324526", "0.63013583", "0.6232596", "0.62237495", "0.61859214", "0.61552155", "0.6142482", "0.6103612", "0.6054195", "0.6044066", "0.6017107", "0.60106254", "0.6002352", "0.5996425", "0.5991264", "0.59862465", "0.5986246...
0.63255805
4
Stops a specific flow. It is a no op if the flow doesn't exist. Returns the stopped flow if found.
def stop_flow(self, name: str, requestor: Identifier) -> Optional[Flow]: with self._lock: for flow in self.in_flight: if flow.name == name and flow.check_identifier(requestor): log.debug(f'Removing flow {str(flow)}.') self.in_flight.remove(flow...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stop(self, **kwargs):\n return self.client.api.stop(self.id, **kwargs)", "def del_flow(self, flow_name):\n\n try:\n of_response = requests.delete(self.url + \"restconf/config/opendaylight-inventory:nodes/node/\" + self.id +\n \"/table/0/flow/\...
[ "0.5746109", "0.5730475", "0.56689626", "0.5514384", "0.5421373", "0.5382266", "0.5365279", "0.5311939", "0.53013855", "0.5270593", "0.5240544", "0.5230865", "0.5225166", "0.52059144", "0.5201256", "0.5201256", "0.51601064", "0.51247495", "0.5124382", "0.511578", "0.5107241",...
0.72481436
0
This is where the flow execution happens from one of the thread of the pool.
def execute(self, flow: Flow): while True: autosteps = flow.next_autosteps() steps = flow.next_steps() if not steps: log.debug("Flow ended correctly.Nothing left to do.") with self._lock: self.in_flight.remove(flow) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_thread(self):", "def executor(self):", "def process(self):\n pass", "def do_work(self):", "def proceed(self):\n pass", "def task1(self):\n \n pass", "def task(self):", "def task(self):", "def run(self): \r\n return", "def step(self):\n ...
[ "0.7125269", "0.7070647", "0.64292413", "0.63673204", "0.6264586", "0.62056714", "0.61923915", "0.61923915", "0.61343116", "0.6133616", "0.61296713", "0.60785925", "0.6075723", "0.6042503", "0.5994667", "0.5994667", "0.5994667", "0.5984182", "0.5971679", "0.5971174", "0.59519...
0.0
-1
Transforms all symbols into words for the symbols.
def execute_layer(self, input_string): in_progress_string = input_string for symbol in MathSymbolsTransformLayer.SYMBOLS: in_progress_string = re.sub('\\s*\\' + symbol + '\\s*', " " + MathSymbolsTransformLayer.SYMBOLS[symbol] + " ", in_progress_string) return in_progress_string
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_words(self):\n\n for char, child in self.children.items():\n if child.is_word:\n yield f\"{char}\"\n else:\n for each in child.all_words():\n yield char + each", "def __macronize(self):\n self.macronizations = [Scansion(...
[ "0.60693365", "0.6052344", "0.6034144", "0.602034", "0.59230673", "0.5909303", "0.5891831", "0.58848506", "0.58590794", "0.5840725", "0.58196265", "0.5796355", "0.576007", "0.5752221", "0.575202", "0.57369643", "0.57285815", "0.57197636", "0.5717165", "0.57067674", "0.5704195...
0.0
-1
Dump GeoJSONlike `dict` to WKB and write it to the `dest_file`.
def dump(obj, dest_file): dest_file.write(dumps(obj))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_geojson(vec:gpd.GeoDataFrame, dest):\n\t\tdest = str(dest)\n\n\t\t# WGS 84\n\t\t#vec = vec.to_crs({'init': 'epsg:4326'})\n\n\t\tif os.path.isfile(dest):\n\t\t\tos.remove(dest)\n\t\t\t\n\t\tvec.to_file(dest, driver='GeoJSON', encoding='utf-8')", "def write_completed_dictionary_to_file(the_dict):\n\ttry:...
[ "0.609739", "0.5945163", "0.58861214", "0.5834858", "0.5822751", "0.57976556", "0.5769467", "0.5753955", "0.5746957", "0.57391405", "0.57300645", "0.5695011", "0.567155", "0.5647927", "0.56312424", "0.5610588", "0.5568535", "0.556709", "0.55411667", "0.55359286", "0.55297506"...
0.5775647
6
Load a GeoJSON `dict` object from a ``source_file`` containing WKB (as a byte string).
def load(source_file): return loads(source_file.read())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_from_geojson(self, filename_or_url):", "def load_file(file_path):\n with gzip.open(file_path, \"rb\") as fp:\n return json.loads(fp.read().decode('utf-8'))", "def load_data(fname):\n # load the json in gzip format\n with gzip.open(fname, 'r') as fin:\n data = json.loads(fin.read...
[ "0.64010257", "0.61291313", "0.5681875", "0.5647965", "0.5605012", "0.5605012", "0.55837893", "0.54541105", "0.5407322", "0.5381939", "0.5341912", "0.5317645", "0.5309902", "0.52989256", "0.52811605", "0.52782965", "0.5248164", "0.52470803", "0.5245445", "0.52391714", "0.5237...
0.5846785
2
Dump a GeoJSONlike `dict` to a WKB string.
def dumps(obj, big_endian=True): geom_type = obj['type'] exporter = __dumps_registry.get(geom_type) if exporter is None: __unsupported_geom_type(geom_type) return exporter(obj, big_endian)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dict_2_string(d):\n buff = io.StringIO()\n print_dictionary(d, output=buff)\n return buff.getvalue()", "def render_dict(dict):\n\t\treturn str.encode(str(dict))", "def json_dump_dict(dictionary):\n\n print(json.dumps(dictionary, indent=4, ensure_ascii=False).encode(\"utf8\").decode())\n\n re...
[ "0.6415069", "0.59991217", "0.5889633", "0.5886834", "0.58037204", "0.57551813", "0.5732175", "0.5725547", "0.5687833", "0.5661887", "0.56604487", "0.5609592", "0.556257", "0.55397433", "0.55241346", "0.5521883", "0.5501805", "0.54972357", "0.54923", "0.54878175", "0.5445764"...
0.5338177
34
Construct a GeoJson `dict` from WKB (`string`).
def loads(string): endianness = string[0:1] if endianness == BIG_ENDIAN: big_endian = True elif endianness == LITTLE_ENDIAN: big_endian = False else: raise ValueError("Invalid endian byte: '0x%s'. Expected 0x00 or 0x01" % binascii.hexlify(endianness.encod...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wkt_to_geojson(wkt_data: str) -> dict:\n parsed_wkt = wkt.loads(wkt_data)\n\n geo = geometry.mapping(parsed_wkt)\n\n if geo[\"type\"] == \"GeometryCollection\":\n feature_collection = []\n for g in geo[\"geometries\"]:\n feature = geojson.Feature(geometry=g)\n featu...
[ "0.6401019", "0.6142894", "0.6066461", "0.5939215", "0.589859", "0.5864854", "0.58608633", "0.58470094", "0.58136404", "0.5768865", "0.57323337", "0.5708001", "0.5695813", "0.56537974", "0.55651915", "0.55516964", "0.5541796", "0.55147684", "0.55017436", "0.54472226", "0.5386...
0.52620196
32
Dump a GeoJSONlike `dict` to a WKB string.
def __dump_point(obj, big_endian): wkb_string = b'' if big_endian: wkb_string += BIG_ENDIAN else: wkb_string += LITTLE_ENDIAN coords = obj['coordinates'] num_dims = len(coords) if num_dims == 2: type_byte_str = __WKB['2D']['Point'] elif num_dims == 3: type_b...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dict_2_string(d):\n buff = io.StringIO()\n print_dictionary(d, output=buff)\n return buff.getvalue()", "def render_dict(dict):\n\t\treturn str.encode(str(dict))", "def json_dump_dict(dictionary):\n\n print(json.dumps(dictionary, indent=4, ensure_ascii=False).encode(\"utf8\").decode())\n\n re...
[ "0.6415069", "0.59991217", "0.5889633", "0.5886834", "0.58037204", "0.57551813", "0.5732175", "0.5725547", "0.5687833", "0.5661887", "0.5609592", "0.556257", "0.55397433", "0.55241346", "0.5521883", "0.5501805", "0.54972357", "0.54923", "0.54878175", "0.5445764", "0.5443978",...
0.56604487
10
Dump a GeoJSONlike `dict` to a WKB string.
def __dump_linestring(obj, big_endian): wkb_string = b'' if big_endian: wkb_string += BIG_ENDIAN else: wkb_string += LITTLE_ENDIAN coords = obj['coordinates'] vertex = coords[0] # Infer the number of dimensions from the first vertex num_dims = len(vertex) if num_dims ==...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dict_2_string(d):\n buff = io.StringIO()\n print_dictionary(d, output=buff)\n return buff.getvalue()", "def render_dict(dict):\n\t\treturn str.encode(str(dict))", "def json_dump_dict(dictionary):\n\n print(json.dumps(dictionary, indent=4, ensure_ascii=False).encode(\"utf8\").decode())\n\n re...
[ "0.6415069", "0.59991217", "0.5889633", "0.5886834", "0.58037204", "0.57551813", "0.5732175", "0.5725547", "0.5687833", "0.5661887", "0.56604487", "0.5609592", "0.556257", "0.55397433", "0.55241346", "0.5521883", "0.5501805", "0.54972357", "0.54923", "0.54878175", "0.5445764"...
0.49451002
97
Convert byte data for a Point to a GeoJSON `dict`.
def __load_point(big_endian, type_bytes, data_bytes): endian_token = '>' if big_endian else '<' if type_bytes == WKB_2D['Point']: coords = struct.unpack('%sdd' % endian_token, data_bytes) elif type_bytes == WKB_Z['Point']: coords = struct.unpack('%sddd' % endian_token, data_bytes) elif ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def as_geom(data: dict) -> dict:\n geom = geom_from_geojson(data)\n validate_geom(geom)\n return geom", "def parse_point(line):\n return json.loads(line)", "def to_data(self):\n point = {\n 'point': [self.pt[0], self.pt[1], self.pt[2]],\n 'layer_height': self.layer_heig...
[ "0.61113554", "0.60749865", "0.59794545", "0.58607936", "0.58315086", "0.57933426", "0.5684637", "0.5668959", "0.56447315", "0.55123854", "0.5489289", "0.54598", "0.5451788", "0.54298854", "0.54289055", "0.5410997", "0.5388101", "0.5378883", "0.5308924", "0.5280801", "0.52757...
0.6990642
0
Cluster prey sequences according to mapped RefSeq
def refseq_based_clustering(self): self.refseq_based = NonRedSetDict() for prey in self.ivv_info.Prey_info().preys(): refseqid = self.get_refseq(prey) if refseqid: self.refseq_based.append_Dict(refseqid, prey)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def refseq_based_clustering(self):\n self.refseq_based = Usefuls.NonRedSet.NonRedSetDict()\n for prey in self.ivv_info.Prey_info().preys():\n refseqid = self.get_refseq(prey)\n if refseqid:\n self.refseq_based.append_Dict(refseqid, prey)", "def test_first_sequen...
[ "0.70106786", "0.6068481", "0.5995936", "0.5906224", "0.58543235", "0.58283967", "0.57719815", "0.5765596", "0.5720791", "0.56829274", "0.5669235", "0.5604671", "0.55728793", "0.5560698", "0.5556891", "0.5496786", "0.547497", "0.540696", "0.5392086", "0.537271", "0.5355906", ...
0.70810395
0
Returns all RefSeqs. refseq_based_clustering() must be precalled.
def get_all_refseq(self): return self.refseq_based.keys()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def references(self) -> \"IterableList[Reference]\":\n return Reference.list_items(self)", "def get_all_refobjs(self, ):\n return cmds.ls(type=\"jb_reftrack\")", "def references(self):\n ref_nodes = self.root.xpath(\".//bib-reference\")\n return list(\n itertools.chain.fr...
[ "0.67854905", "0.64765537", "0.6383024", "0.6376954", "0.6328095", "0.61806107", "0.61366177", "0.61037624", "0.60236764", "0.60163116", "0.59973496", "0.599216", "0.59824604", "0.59700936", "0.59552693", "0.59420055", "0.5773383", "0.57720006", "0.5713108", "0.5703122", "0.5...
0.77024484
1
This creates the symbols out of a stylegallery
def create_symbols(self, style_gallery, style_gallery_name, class_to_export): try: symbols_element = self.xml_document.getElementsByTagName("symbols")[0] except IndexError: symbols_element = self.xml_document.createElement("symbols") root_element = self.xml_document.getE...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_image_caption_pairs(self):", "def singleglyph(x):\n return [glyph(x)]", "def build_schematic(self, bg=None):", "def get_stylesheet():\n\n #ss_dict\n ss_dict = {'header_image' : HEADER_IMAGE,\n 'icon_true' : ICON_TRUE,\n 'icon_false' : ICON_FALSE,\n ...
[ "0.5846963", "0.5831491", "0.57929367", "0.5631854", "0.56144685", "0.55986845", "0.5543508", "0.55282354", "0.54610837", "0.5445795", "0.544179", "0.5433599", "0.54209745", "0.54185355", "0.53752816", "0.5288781", "0.5242281", "0.52400696", "0.5225346", "0.51927286", "0.5187...
0.69908535
0
MNSIT data set reader. returns (images, labels, length)
def read(cls, filepath, dataset = "training"): f = gzip.open(filepath, 'rb') train, valid, test = pickle.load(f, encoding='latin1') f.close() if dataset == "training": return (train[0], train[1], train[0].shape[0]) elif dataset == "valid": return (valid[0...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def readmnist(dataset = \"training\", path = \".\"):\n\n if dataset is \"training\":\n fname_img = os.path.join(path, 'train-images.idx3-ubyte')\n fname_lbl = os.path.join(path, 'train-labels.idx1-ubyte')\n elif dataset is \"testing\":\n fname_img = os.path.join(path, 't10k-images.idx3-u...
[ "0.66662216", "0.65385675", "0.643039", "0.63432693", "0.631567", "0.63038933", "0.6299887", "0.629129", "0.6280542", "0.6269882", "0.62673384", "0.6267094", "0.62668735", "0.6260505", "0.6247463", "0.6245875", "0.6233323", "0.62239766", "0.6222394", "0.62110656", "0.619755",...
0.0
-1
verify and extract data from a given token. If the token is valid, it's signed content is returned, otherwise None is returned.
def verify_auth_token(token): serializer = Serializer(SECRET_KEY) try: data = serializer.loads(token) except SignatureExpired: return None # valid token, but expired except BadSignature: return None # invalid token return data['token']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def processResponse(token, enc_key, sig_key):\n payload = []\n # Decrypt encrypted token (JWE).\n enc = jwe.JWE()\n enc.deserialize(token, key=enc_key)\n payload.append(enc.payload.decode(\"utf-8\"))\n # This again contains a signed token (JWS), so we deserialize it and verify the signature.\n ...
[ "0.6363309", "0.6217495", "0.609201", "0.59909505", "0.5985739", "0.5863285", "0.5818454", "0.5784145", "0.5750953", "0.5744397", "0.57275766", "0.56975555", "0.565575", "0.5648551", "0.55936986", "0.55830073", "0.5560457", "0.54820657", "0.5462631", "0.54586816", "0.5452226"...
0.6205273
2
A permutation is an ordered arrangement of objects. For example, 3124 is one possible permutation of the digits 1, 2, 3 and 4. If all of the permutations are listed numerically or alphabetically, we call it lexicographic order.
def euler24(): # import math # math.factorial(10) = 3628800, 3.6 million combinations # math.factorial(9) = 362880, so the first digit is '2' import time start = time.time() p = 10 limit = 1000000-1 result = [] LIST = [0,1,2,3,4,5,6,7,8,9] # higest digit, 10! permutations ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def permutation(a):\n rs = _generator.get_random_state()\n return rs.permutation(a)", "def permute(seq, permutation):\n return [seq[i] for i in permutation]", "def apply_permutation(hyper, pol, perm):\n pass", "def permutations(iterable):\n pass", "def permutations(lst):\n pass # Rep...
[ "0.70878094", "0.7079293", "0.6798157", "0.67574525", "0.6739657", "0.6581821", "0.65798986", "0.65650576", "0.6544407", "0.6519375", "0.65156496", "0.6494174", "0.64923877", "0.6444669", "0.64227724", "0.6330735", "0.63139623", "0.62964976", "0.6294119", "0.62916183", "0.628...
0.0
-1
Load pretrained Container and Containee model
def load_unary_model(self, model_name): model = Model(model_name, gpu_id = self.gpu_id) if model_name == 'Container': model.load_state_dict(torch.load(self.container_model_file)) else: model.load_state_dict(torch.load(self.containee_model_file)) return m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_model(self):\n if self.ckpt_flag:\n LOG('Skip Loading Pre-trained Model......')\n else:\n if self.params.pre_trained_from is not None and os.path.exists(self.params.pre_trained_from):\n try:\n LOG('Loading Pre-trained Model at %s' % sel...
[ "0.68571305", "0.6820545", "0.6752037", "0.67184067", "0.6527125", "0.64759344", "0.64290243", "0.642883", "0.64130765", "0.64024806", "0.6402233", "0.6401311", "0.640032", "0.6393529", "0.63868666", "0.63630337", "0.6353995", "0.6351601", "0.63504255", "0.63357174", "0.63206...
0.5897552
73
Implementation of forward System operation in parallel MRI or PFS(.) In
def A(x,mask,S): xS = x*S y_full = fft.fftshift(fft.fft2(fft.ifftshift(xS))) y = y_full[:,mask] return y
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forward(self, *args: Any, **kwargs: Any) -> Any:\n with torch.autograd.profiler.record_function(\"FullyShardedDataParallel.forward\"):\n self._lazy_init()\n args, kwargs = self._fsdp_root_pre_forward(*args, **kwargs)\n unused = None\n unshard_fn = functools.pa...
[ "0.6565294", "0.651697", "0.651697", "0.65023226", "0.63790023", "0.6378946", "0.63446945", "0.6307241", "0.63039196", "0.62907183", "0.6284443", "0.6284443", "0.6284443", "0.62749475", "0.6261079", "0.6261079", "0.625689", "0.62215006", "0.61801684", "0.61801684", "0.6164610...
0.0
-1
Implementation of backward System operation in parallel MRI or SFP(.) In
def A_H(y,mask,S): y_zf = np.zeros(S.shape,dtype='complex128') y_zf[:,mask] = y x_zf = fft.fftshift(fft.ifft2(fft.ifftshift(y_zf)))*(mask.size) x_zf_sum = ( x_zf*(S.conj()) ).sum(axis=0) return x_zf_sum
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _poputil_recompute_backward(op, grads):\n return grads", "def backward(self):\n raise NotImplementedError", "def backward(self, *output_grads):\n raise NotImplementedError", "def _poputil_block_recompute_backward(op, grads):\n return grads", "def backward(self,input,grads):\n\t\traise R...
[ "0.6908455", "0.69024163", "0.68750006", "0.6860696", "0.66619337", "0.66508573", "0.6564414", "0.6558091", "0.6501835", "0.6501835", "0.6501835", "0.6491457", "0.6469847", "0.6469847", "0.6469847", "0.6428603", "0.6383331", "0.6368481", "0.63591284", "0.63530004", "0.63241",...
0.0
-1
This function uses CG to perform the multicoil data update on the input image using the undersampled measurements, the coil sensitivities and knowedge of the samplimg pattern. In
def multicoil_cg(x_in,y,nu,x0,mask,S,n,niter): x = x0 x_zf_sum = A_H(y,mask,S) # [:,mask.flatten()] r = (nu*x_zf_sum) + x_in - (nu*A_H(A(x,mask,S),mask,S)) - (n*x) p = r rtr_old = np.vdot(r.flatten(),r.flatten()) for i in range(0,niter): Ap = (nu*A_H(A(p,mask,S),mask,S)) + (...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sweep_image_model():\n for c1 in [4, 8, 16]:\n for c2 in [2, 4]:\n for c3 in [2, 4]:\n for c4 in [1, 2]:\n flags = flag_reader.read_flag()\n print(c1)\n flags.channel_list = c1 * np.array([1, c2, c2*c3, c2*c3*c4])\n ...
[ "0.6060822", "0.60263777", "0.59473807", "0.5750547", "0.5673431", "0.563594", "0.5591974", "0.5587233", "0.5580261", "0.5544796", "0.5538529", "0.55316883", "0.5512721", "0.54656625", "0.5457929", "0.5441305", "0.54357713", "0.5429274", "0.54067105", "0.5392447", "0.5390518"...
0.56422526
5
check if given args are new
def __is_args_new(self, *args, **kwargs): # if input size is different if len(args) != len(self.__cached_args) or len(kwargs) != len(self.__cached_kwargs): return True # check args and kwargs for a, ca in zip(args, self.__cached_args): if a != (ca() if isinstance(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_args(self, args_):\n\n pass", "def _check_args(self, args):\n if len(args) == 0:\n print(\"No parameters provided.\")\n return False\n else:\n return True", "def __check_args(self):\n self.__check_args_type()\n self.__check_args_val...
[ "0.7180964", "0.67476994", "0.6550825", "0.64482", "0.61821944", "0.6121256", "0.6078874", "0.60775244", "0.5957351", "0.59326947", "0.59292126", "0.585978", "0.5825051", "0.57995284", "0.57905746", "0.5777149", "0.57604843", "0.5759606", "0.5752128", "0.5742403", "0.5735094"...
0.76295835
0
reset cache accessible via `self.__class__.(arg_name).reset(self)` pattern
def reset(self, instance): self.__flags[instance] = True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset(*args):", "def reset(*args):", "def reset(*args):", "def reset(self, *args, **kwargs):", "def reset(self, *args, **kwargs):\n ...", "def reset(self, *args):\n raise NotImplementedError", "def reset_cache(self, *args, **kwargs):\n value = self._fn(*self._inject_obj(args), ...
[ "0.7257476", "0.7257476", "0.7257476", "0.71849614", "0.71691287", "0.71223843", "0.69622254", "0.68289167", "0.66945654", "0.66581154", "0.6626647", "0.6614927", "0.6592734", "0.6586193", "0.65507424", "0.65431076", "0.6490789", "0.64488316", "0.6410432", "0.6410432", "0.640...
0.0
-1
decorator for cache reset reset to calculate
def resetter(self, func): def __wrapper(instance, *args, **kwargs): func(instance, *args, **kwargs) self.__flags[instance] = True return __wrapper
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_cache(self, *args, **kwargs):\n value = self._fn(*self._inject_obj(args), **kwargs)\n\n if self._cache:\n key = self.get_cache_key(*args, **kwargs)\n cache_backend.set(key, value, timeout=self._timeout)\n\n if self._memoize:\n memoization_key = self._...
[ "0.72918427", "0.6668384", "0.66570526", "0.64618593", "0.64618593", "0.63801813", "0.63740206", "0.6288314", "0.6280954", "0.6258521", "0.6232449", "0.62095875", "0.6208023", "0.61574566", "0.6136212", "0.61135143", "0.6102016", "0.6100977", "0.60796076", "0.6073473", "0.606...
0.0
-1
Return the two base images needed to create a lighthouse animation. base_img is either A full/relative path from the run context The name of a directory under lighthouses here
def load_base_images(base_img): if base_img is not None: if not os.path.exists(base_img): base_img = os.path.join(LIGHTHOUSES_DIR, base_img) return ( Image.open(os.path.join(base_img, 'on.gif')).convert('RGBA'), Image.open(os.path.join(base_img, 'off.gif')) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_imagebase(self):\n pass", "def get_random_base():\n\n n_base = count_raw_img('base')\n img = \"{}.jpg\".format(random.randint(1, n_base + 1))\n return Image.open(RAW_DIR_PATH['base'] + img)", "def propose_image_path():\n image_name = \"image_{}.png\".format(''.join(random.choice('abc...
[ "0.62116516", "0.6163408", "0.5916963", "0.57784426", "0.5775673", "0.5691343", "0.5683936", "0.5591003", "0.5576489", "0.55682087", "0.5541228", "0.548597", "0.5453294", "0.54221994", "0.54105973", "0.5399216", "0.535957", "0.5359305", "0.5342906", "0.531411", "0.52954346", ...
0.7206143
0
Given a light characteristic, return a list of 2tuples representing the state of light at any given time. A fixed light is the given colour, permanently >>> characteristic_to_light_states('F. R') [('R', 1)]
def characteristic_to_light_states(description): fragments = description.split() pattern_type, groups = parse_pattern(fragments.pop(0)) colour, fragments = get_colour_code(fragments) try: period = parse_period(fragments) except IndexError: if must_have_period(pattern_type, groups): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_states(crime):\n statelist = []\n for i in range(len(crime)-1):\n statelist.append(crime[i][0])\n return statelist", "def get_rgb_light():\n return list(light.rgb())", "def lights(self):\n return list(self.GetLights())", "def lights_on(self) -> list:\n return [\n ...
[ "0.5880032", "0.5774206", "0.5655911", "0.55833024", "0.5447408", "0.5406236", "0.54036015", "0.537056", "0.53520906", "0.5329592", "0.5319485", "0.5250559", "0.5245645", "0.5213831", "0.51771307", "0.51550233", "0.50853217", "0.507346", "0.50687844", "0.50391555", "0.5013721...
0.6722805
0
Given the split up characteristic, return the period in milliseconds The period is specified in seconds >>> parse_period(['2']) 2000 The letter 's' to mark the units may be present >>> parse_period(['3s']) 3000 It may be separated from the number by a space >>> parse_period(['4','s']) 4000 A Quick flash can only have a...
def parse_period(fragments): period_spec = fragments[-1] # The last term is the cycle period, # it may or may not have 's' for seconds # The 's' may or may not be attached to the number if period_spec == 's': period_spec = fragments[-2] if period_spec[-1] == 's': period_spec = pe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def period(self):\n period_ns = int(utils.readstr_all(os.path.join(_CHANNEL_PATH(self._chip,\n self._channel),\n 'period')))\n return int(period_ns / 1000)", "def get_period_sec...
[ "0.6479936", "0.644268", "0.6255988", "0.6126181", "0.59293336", "0.5887166", "0.5848696", "0.581168", "0.5801859", "0.57852525", "0.57155305", "0.57155305", "0.56989634", "0.5696296", "0.55982697", "0.55982697", "0.5581507", "0.55336004", "0.5522052", "0.55193275", "0.551443...
0.75614196
0
Crack a pattern definition into its type and any grouping. A pattern consists of the pattern type (e.g. flashing, occulting) and optionally a group designation in parentheses. The pattern definition could just be the type >>> parse_pattern('Fl') ('fl', [1]) It could have optional dots marking the abbreviation, these ca...
def parse_pattern(pattern): pattern_type, _, group_spec = pattern.partition('(') # Groups are separated by '+' in a composite pattern. groups = [ int(group) for group in group_spec[:-1].split('+') ] if group_spec else [1] # Some light lists use dots, some don't, just throw them away ret...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_pattern(pattern: NumberPattern | str) -> NumberPattern:\n if isinstance(pattern, NumberPattern):\n return pattern\n\n def _match_number(pattern):\n rv = number_re.search(pattern)\n if rv is None:\n raise ValueError(f\"Invalid number pattern {pattern!r}\")\n re...
[ "0.6776147", "0.61842924", "0.6145672", "0.60469675", "0.582925", "0.576661", "0.5751908", "0.5672661", "0.564937", "0.55928665", "0.5582709", "0.54133475", "0.5398375", "0.53610086", "0.5338687", "0.5337617", "0.53008944", "0.5261952", "0.5254372", "0.52399373", "0.5239051",...
0.7442205
0
Given a list of light states, collapse any adjacent entries that have the same state. If there are no adjacent matching states, there is no change to the output >>> collapse_states([('R',1), ('Y', 1), ('R', 1)]) [('R', 1), ('Y', 1), ('R', 1)] Adjacent states are collapsed, summing their durations >>> collapse_states([(...
def collapse_states(states): new_states = states[:1] for state in states[1:]: last_state = new_states[-1] if state[0] == last_state[0]: new_states[-1] = (state[0], last_state[1] + state[1]) else: new_states.append(state) return new_states
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def states_filter(state):\n if state.count(0) < state.count(1) or state.count(1) < state.count(0) - 1:\n return False\n\n rows = [[i, i+1, i+2] for i in [0, 3, 6]]\n cols = [[i, i+3, i+6] for i in [0, 1, 2]]\n\n winners = set()\n\n for row_indexes in rows:\n row = [state[ind] for ind i...
[ "0.52173054", "0.5162994", "0.50791174", "0.50559324", "0.4989781", "0.4952426", "0.4899571", "0.48871356", "0.48810527", "0.48748165", "0.48466158", "0.47453317", "0.47329503", "0.47069013", "0.46448886", "0.46182868", "0.4606048", "0.4591518", "0.45846918", "0.45573312", "0...
0.7746325
0
The Fixed pattern is simply an alwayson light in the given colour. groups and period are irrelevant.
def fixed(_groups, colour, _period): return [(colour, 1)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_pattern(colors=('green', 'blue', 'red')): # (10)\n for i in range(0, int(ceil(float(NUM_LEDS)/float(len(colors))))):\n for color in colors:\n push_color(color)", "def fill(self, color):", "def fill(self, colour: int, /) -> None:", "def occult...
[ "0.57946724", "0.57644004", "0.5761895", "0.5750514", "0.5239501", "0.52209616", "0.5144774", "0.51025516", "0.5077008", "0.50707483", "0.50707483", "0.5058601", "0.5058601", "0.5058601", "0.50353426", "0.5011609", "0.50076145", "0.50035447", "0.49892506", "0.49738902", "0.49...
0.72213733
0
A flash is a single colour displayed for a short period, followed by a longer period of darkness A single flash of a given colour is a 1 second flash >>> flash([1], 'R', 5000) [('R', 1000), ('Off', 4000)] Grouped flashes have a shorter duration >>> flash([3], 'R', 10000) [('R', 500), ('Off', 1000), ('R', 500), ('Off', ...
def flash(groups, colour, period): if groups == [1]: if period <= 2000: raise ValueError( "The cycle period for a flash must be longer than 2 seconds" ) return [ (colour, 1000), ('Off', period-1000) ] return light_sequenc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def long_flash(groups, colour, period):\n if groups == [1]:\n return [\n (colour, 2000),\n ('Off', period - 2000)\n ]\n return light_sequence(groups, colour, 'Off', period, 2000, 3000)", "def quick(groups, colour, period):\n # The cycle period cannot be longer than 1....
[ "0.6906268", "0.63640183", "0.53384686", "0.5311426", "0.52867997", "0.5262986", "0.5233251", "0.52132744", "0.5064614", "0.50232327", "0.4976142", "0.49747515", "0.49659762", "0.49345678", "0.4889537", "0.4873445", "0.4861576", "0.48529956", "0.48520216", "0.48484832", "0.48...
0.730446
0
A Long flash is at least 2 seconds
def long_flash(groups, colour, period): if groups == [1]: return [ (colour, 2000), ('Off', period - 2000) ] return light_sequence(groups, colour, 'Off', period, 2000, 3000)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_flash_timer(self):\r\n self.flashMillisecs = 1000\r\n self.flashTimer.start(50)", "def _flash(self,id,msg,duration=30.0):\n if duration>0:\n pass #gtk.timeout_add(duration,'')\n return self.statusbar.push(id,msg)", "def delay():\r\n time.sleep(2)", "def fla...
[ "0.74898815", "0.6975104", "0.67044026", "0.65149236", "0.6494031", "0.6478555", "0.6331387", "0.6299343", "0.62820214", "0.61999464", "0.6144084", "0.6137599", "0.59895545", "0.598306", "0.5923389", "0.5922658", "0.5920993", "0.59137625", "0.59004384", "0.5891849", "0.587960...
0.593689
14
isophase is a pattern with equal dark and light. There are no groups.
def isophase(_groups, colour, period): # Whole numbers are required, so odd numbers are dealt with by loading # the spare into the off period. # As this is in milliseconds, this will be imperceptible. # It is also unlikely, as the top-level input is in seconds # and has been multiplied up to millise...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_monochromatic(self):\n return equal(s.color for s in self.iter_states())", "def keep_measures(mosaiced_img, pattern):\n h, w = mosaiced_img.shape\n imout = np.zeros((h, w, 3))\n mask = np.zeros((h, w, 3))\n for i in range(2):\n for j in range(2):\n imout[i::2, j::2, pa...
[ "0.54219186", "0.52342373", "0.51545143", "0.5147554", "0.512688", "0.493742", "0.49075535", "0.48455277", "0.48435876", "0.48435876", "0.48414382", "0.48366624", "0.48366624", "0.48366624", "0.48335874", "0.4826204", "0.4740178", "0.47373027", "0.47355133", "0.4724675", "0.4...
0.5926785
0
An occulting pattern is the opposite of a flash dark with longer light
def occulting(groups, colour, period): if groups == [1]: return [ ('Off', 1000), (colour, period - 1000) ] return light_sequence(groups, 'Off', colour, period, 500, 1000)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dark(r, d):\n return d * 1.0 / (r + d) + d * r * 1.0 / ((r + d) ** 2)", "def long_flash(groups, colour, period):\n if groups == [1]:\n return [\n (colour, 2000),\n ('Off', period - 2000)\n ]\n return light_sequence(groups, colour, 'Off', period, 2000, 3000)", "d...
[ "0.6700004", "0.63176876", "0.6290823", "0.62734985", "0.60783553", "0.6075236", "0.6039119", "0.60094136", "0.59764445", "0.5948906", "0.5927794", "0.5921896", "0.5916064", "0.58963686", "0.5874015", "0.58716214", "0.58551055", "0.58461297", "0.5830117", "0.582028", "0.58135...
0.0
-1
A Quick flash is more than 50 per minute.
def quick(groups, colour, period): # The cycle period cannot be longer than 1.2s (60/50) # or shorter than 0.5s if groups == [1]: if period is not None: raise ValueError( "Quick Flash cycle periods must be longer than 0.5 seconds" ) return [ ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_flash_timer(self):\r\n self.flashMillisecs = 1000\r\n self.flashTimer.start(50)", "def giveFlash(self, amount):\n self.fb = amount\n if amount > 0:\n es.give(self.userid, \"weapon_flashbang\")", "def brief_led_flash(self):\n self._ubx.send('CFG-TP5', puls...
[ "0.7274421", "0.6186878", "0.6086867", "0.59733325", "0.58153445", "0.58117354", "0.5774111", "0.57247484", "0.5715428", "0.569542", "0.5694873", "0.5687403", "0.56838447", "0.5658738", "0.56574625", "0.5635628", "0.5612565", "0.5605468", "0.5590237", "0.55884016", "0.5575568...
0.61882275
1
Handle set of files .u, .v, and .w containing a fullfield formatted time series output from TurbSim. Tested with TurbSim v2.00.05cbjj, 25Feb2016
def __init__(self,prefix,verbose=False): self.prefix = prefix self.hub = dict() #hub-height wind speeds self.field = dict() #full NY x NZ field self._readTurbSimScalar(prefix,'u',verbose=verbose) self._readTurbSimScalar(prefix,'v',verbose=verbose) self._readTurbSimScalar(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def entries_from_goes_ts_files(*files, default_waveunit=None, source=None):\n\n\n \"\"\"\n ts_goes = ts.TimeSeries(file)\n statinfo = os.stat(file)\n entry = DatabaseEntry(path=file)\n entry.size = statinfo.st_size\n\n #header['INSTRUME'] = header['TELESCOP']# So E.G. 'GOES 6' instead 'X-ray Dete...
[ "0.634698", "0.5964177", "0.5961929", "0.59244645", "0.59130234", "0.5876912", "0.584045", "0.58363456", "0.58036953", "0.5788206", "0.5774949", "0.5697151", "0.56815135", "0.5672769", "0.5671861", "0.5652185", "0.5577706", "0.5569258", "0.5545952", "0.55439484", "0.55428064"...
0.0
-1
Write out binary VTK file with a single vector field. Can specify time index or output time.
def writeVTK(self,fname,itime=None,output_time=None): if output_time: itime = int(output_time / self.dt) if not itime: print 'Need to specify itime or output_time' return print 'Writing out time step',itime,': t=',self.t[itime] u = np.zeros((self.NY,1,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def saveVelocityAndPressureVTK_binary(pressure,u,v,w,x,y,z,filename,dims):\n numEl_size = u.size; numEl = np.prod(numEl_size);\n # open the file and write the ASCII header:\n file = open(filename,'w')\n file.write('# vtk DataFile Version 3.0\\n')\n file.write('VTK file for data post-processed with P...
[ "0.6757693", "0.66369015", "0.6426294", "0.63140506", "0.626889", "0.6226187", "0.607385", "0.604287", "0.6018301", "0.6018301", "0.5969815", "0.5968377", "0.594419", "0.5942577", "0.58605295", "0.5848289", "0.5788712", "0.5758208", "0.5744678", "0.5741473", "0.5739878", "0...
0.7530258
0
Call writeVTK for a range of times
def writeVTKSeries(self,prefix=None,step=1): if not prefix: prefix = self.prefix for i in range(0,self.N,step): fname = prefix + '_' + str(i) + '.vtk' self.writeVTK(fname,itime=i)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def writeVTK(self,fname,itime=None,output_time=None):\n if output_time:\n itime = int(output_time / self.dt)\n if not itime:\n print 'Need to specify itime or output_time'\n return\n print 'Writing out time step',itime,': t=',self.t[itime]\n u = np.zeros...
[ "0.67234313", "0.65439826", "0.61956275", "0.6171551", "0.584729", "0.58062536", "0.5772773", "0.5763361", "0.5762426", "0.56863654", "0.5424772", "0.5380682", "0.5364221", "0.53386146", "0.53386146", "0.5328883", "0.5259615", "0.5244934", "0.52399683", "0.5105576", "0.507751...
0.6567778
1
Manages the auto_anchor object creation, and the data required to set up the object. Also creates the data that the different functions need.
def data_manager_fixture(): class DataManager: def __init__(self): self.gen = 1000 self.cfg = get_cfg_defaults() mode = "test_inference" self.dataset = Dataset(None, self.cfg, mode) self.auto_anchors = AutoAnchors(self.dataset, self.cfg.model, sel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_anchors(self):\n self.anchors_dic = {}\n meta = self.get_metadata()\n lines = meta.split(\"|\")\n for line in lines:\n data= line.split()\n anchor_name = data[0]\n # appending anchor in dictionary with its coordinates \n self.anchors_...
[ "0.61813956", "0.5960812", "0.5898869", "0.580805", "0.56519794", "0.5590929", "0.5538197", "0.5498526", "0.5492101", "0.54861665", "0.54561716", "0.5454788", "0.5441797", "0.54283077", "0.54270804", "0.5386624", "0.53783137", "0.5377474", "0.5370247", "0.5364523", "0.5360114...
0.0
-1
Creates a minimal configuration for the user.
def create_default_user_config(server, port, user, api_key, whitelist_tags=[], ignore_proxy=True, verify_ssl=False): config = {} config_path = DEFAULT_CONFIG_PATH config['default'] = {'server': server, 'port': port, 'user': user, 'ap...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_config(self) -> None:\n pass", "def create_config(self) -> None:\n pass", "def create_empty_config_file():\n config = {\n \"config\": [\n {\n \"site\": {\n \"username\": \"\",\n \"name\": ...
[ "0.6830326", "0.6830326", "0.68101245", "0.67205757", "0.66883713", "0.6676231", "0.6484155", "0.6468319", "0.64551955", "0.63014174", "0.626041", "0.6171588", "0.61103344", "0.60650027", "0.6061568", "0.6031424", "0.5996078", "0.592579", "0.59251434", "0.59190315", "0.590579...
0.68759596
0
Dict with indicator_type keys, and list of (thing, whitelist_indicator_value) results.
def print_whitelist_results(results): if results: print("WHITELISTED:") for result in results: print("\t{}:".format(result)) for whitelist_match in results[result]: indicator_id = sip_client.get('indicators?exact_value={}'.format(whitelist_match[1]))[0]['id'] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_indicator(indicator: Dict[str, str]) -> Dict[str, Any]:\n indicator_obj = {\n \"value\": indicator.get('summary'),\n \"type\": INDICATOR_MAPPING_NAMES.get(indicator.get('type', '')),\n \"rawJSON\": indicator,\n \"score\": calculate_dbot_score(indicator.get(\"threatAssessSco...
[ "0.6396432", "0.60345435", "0.597668", "0.5744823", "0.5410479", "0.53097385", "0.52731967", "0.5235319", "0.5152018", "0.51344997", "0.5108702", "0.50672305", "0.5050555", "0.5023829", "0.49648893", "0.4906767", "0.48939675", "0.48489004", "0.48249677", "0.47569257", "0.4750...
0.4578551
45
rebuilds elements of flat_li to match list structure of original_li (or tuple if given as args)
def deflatten(flat_li, *original_li): if len(original_li) == 1: original_li = original_li[0] deflatten_li = [] i = 0 for el in original_li: if isinstance(el, Sequence): deflatten_li.append(flat_li[i:i+len(el)]) i += len(el) else: deflatten_li.a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flatten(self, l, ltypes=(list, tuple)):\n i = 0\n while i < len(l):\n while isinstance(l[i], ltypes):\n if not l[i]:\n l.pop(i)\n if not len(l):\n break\n else:\n l[i:i + 1] = ...
[ "0.6270293", "0.6178351", "0.61386776", "0.60761553", "0.58953786", "0.5860441", "0.5845089", "0.57745105", "0.5755302", "0.5732161", "0.56978935", "0.566958", "0.566346", "0.56503826", "0.5627321", "0.5624456", "0.5575356", "0.5567329", "0.5556008", "0.5543179", "0.55420625"...
0.7833961
0
generator decorator which executes the generator and returns results as list
def as_list(gen): return list(gen())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generator(func):\n\n @fn\n @wraps(func)\n def gen(*args, **kwargs):\n return Iter(func(*args, **kwargs))\n\n return gen", "def _for_each_generator(self,\n func: Callable[..., Any],\n *args: Iterable[Any]) -> List[Any]:\n return [func(gen...
[ "0.7420649", "0.72913647", "0.69836473", "0.67607874", "0.6716293", "0.66058916", "0.65415895", "0.64996743", "0.64882916", "0.6475754", "0.64716166", "0.64409065", "0.6438427", "0.63554263", "0.63165545", "0.6290795", "0.6278667", "0.626935", "0.6235086", "0.62313914", "0.62...
0.6480012
9
find all indices from list ``l`` where entries match specific object ``o``
def findall(l, o): return [i for i, u in enumerate(l) if u==o]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getAllIndex(ldata, fldata):\n\treturn list(map(lambda e : fldata.index(e), ldata))", "def matchloc(alist,val): \n return [ilc for ilc,jlc in enumerate(alist) if jlc==val]", "def get_indexes(from_list, find_list):\n\n df_find = pd.DataFrame(find_list, columns=['value'])\n df_from = pd.DataFrame(li...
[ "0.63037544", "0.6193546", "0.6087121", "0.6016721", "0.59283173", "0.5781884", "0.57606155", "0.5718999", "0.5709015", "0.56931007", "0.5680674", "0.5623687", "0.5537491", "0.551839", "0.5506623", "0.5459669", "0.5450619", "0.54497373", "0.53892154", "0.53692645", "0.5348893...
0.7872293
0
get all entries of list ``l`` at positions ``idx``
def getall(l, idx): return [l[i] for i in idx]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def multiListSlice(lol, index):\n divisor = 1\n values = []\n for i in range(0, len(lol)):\n index = (index / divisor) % len(lol[i])\n values[i] = lol[i][index]\n divisor *= len(lol[i])\n return values", "def extract_sub_list(mylist, indices):\n return [mylist[ii] for ii in in...
[ "0.6098279", "0.59349114", "0.58925664", "0.58031976", "0.5779936", "0.5718426", "0.56653845", "0.56569105", "0.5654663", "0.5648731", "0.5606806", "0.55991054", "0.55896133", "0.550258", "0.5500482", "0.54870623", "0.54548275", "0.54517424", "0.5408129", "0.54024506", "0.529...
0.82942766
0
removes duplicates in place by using del call
def remove_duplicates(l): unique = set() # we use a set because ``elem in set`` is much faster than ``elem in list`` i = 0 while i < len(l): elem = l[i] if elem in unique: del l[i] else: unique.add(elem) i += 1 return l
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rm_duplicates(self):\n # get uniq representation of existing detection documents\n existing = set(ed.uniq_data for ed in self.existing_detections)\n # remove duplicates\n for idx in xrange(len(self.new_detections)-1, -1, -1):\n nd = self.new_detections[idx]\n i...
[ "0.70536613", "0.6878427", "0.6793208", "0.6721995", "0.66623056", "0.6567927", "0.65093476", "0.64818907", "0.6457876", "0.6446315", "0.6445583", "0.64083076", "0.6384284", "0.6376325", "0.63333505", "0.63100076", "0.6299175", "0.6282895", "0.6246026", "0.6243735", "0.622440...
0.6000665
46
Split '1225,11' to array
def convert_tto(tto): return sum([range(int(b), int(e or b) + 1) for b, e in tto_regexp.findall(tto)], [])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ExtractNumbers(s):\n\n t = s.strip('[]\\n')\n comma_space = r', '\n re_comma_space = re.compile(comma_space)\n z = re_comma_space.split(t)\n #print z\n return z", "def split(a):\r\n compos = [-1] # compos stores the positions of the relevant commas in the argument string\r\n compos.ex...
[ "0.67174935", "0.65931076", "0.6341449", "0.63282", "0.62715924", "0.6268796", "0.6265045", "0.62486094", "0.61843127", "0.61589974", "0.61200494", "0.61004627", "0.6082922", "0.60798216", "0.6016594", "0.60149527", "0.5994863", "0.5956473", "0.5947249", "0.5928228", "0.59224...
0.0
-1
Extract tweet feature vector as NumPy array.
def make_tweet_nparr( txt ): # result storage fvec = numpy.empty( len(testFeatures) ) # search for each feature txtLow = ' ' + txt.lower() + ' ' for i in range( 0, len(testFeatures) ): key = testFeatures[i][0] fvec[i] = False for tstr in testFeatures[i][1]: fve...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_feature_array(tweets):\n feats=[]\n for t in tweets:\n feats.append(sent_features(t))\n return np.array(feats)", "def get_features_test(tweets):\n feats = get_feature_array(tweets)\n tfidf = vectorizer.transform(tweets).toarray()\n M = np.concatenate([tfidf,feats],axis=1)\n re...
[ "0.80908656", "0.700307", "0.6958721", "0.69240814", "0.67279756", "0.66883886", "0.6607619", "0.65651304", "0.6547444", "0.64348966", "0.6290983", "0.6258462", "0.6181728", "0.6144161", "0.61283016", "0.6070738", "0.6050265", "0.6045746", "0.60242474", "0.6001382", "0.599525...
0.54418045
91
Extract tweet feature vector as dictionary.
def make_tweet_dict( txt ): txtLow = ' ' + txt.lower() + ' ' # result storage fvec = {} # search for each feature for test in testFeatures: key = test[0] fvec[key] = False; for tstr in test[1]: fvec[key] = fvec[key] or (txtLow.find(tstr) != -1) return fve...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tweet2features(tweet):\r\n features = {\r\n 'len(tweet)': len(tweet),\r\n 'avg_word_length': get_avg_word_len(tweet)\r\n }\r\n return features", "def tweets_features(tweet):\n tweet = remove_stop_words(tweet)\n return {'TWEET': tweet}", "def get_feature_set_SA(tweet):\n feat...
[ "0.7318314", "0.72936505", "0.70175284", "0.6987621", "0.6677231", "0.66433674", "0.6634793", "0.6374446", "0.6298803", "0.62520707", "0.62181693", "0.6170607", "0.61336696", "0.6114916", "0.61006075", "0.6086418", "0.6078208", "0.6054301", "0.60526454", "0.6035818", "0.60035...
0.61875975
11
Convert dictionary feature vector to numpy array
def tweet_dict_to_nparr( dict ): fvec = numpy.empty( len(testFeatures) ) for i in range( 0, len(testFeatures) ): fvec[i] = dict[ testFeatures[i][0] ] return fvec
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dict_to_vector(self, dictionary):\n vector = []\n for key in dictionary:\n vector = np.concatenate((vector,dictionary[f'{key}'].flatten()))\n return vector", "def _dict2arr(self, key):\r\n # Prepare the matrix for the output:\r\n arr = np.empty((self._n_process,\...
[ "0.7267182", "0.6759521", "0.6714084", "0.65538764", "0.6532126", "0.6398057", "0.6383626", "0.63344187", "0.6267018", "0.6249601", "0.6215344", "0.6138086", "0.60986435", "0.60888034", "0.60870045", "0.60716164", "0.6066192", "0.60525304", "0.604994", "0.59986705", "0.599280...
0.6318512
8
Convert NumPy array to dictionary
def tweet_nparr_to_dict( nparr, use_standard_features=False ): fvec = {} if use_standard_features: assert len(nparr) == len(testFeatures) fvec = {} for i in range( 0, len(nparr) ): fvec[ testFeatures[i][0] ] = nparr[i] else: for i in range( 0, len(nparr) ): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rec_to_dict(arr):\n\n return dict(zip(arr.dtype.names, arr))", "def todict(self):\n return dict(self.array)", "def array_to_dict(arr: np.ndarray, domain: Optional[np.ndarray] = None) -> DictStrNum:\n\n if domain is None:\n keys, counts = np.unique(numpy_array(arr), return_counts=True)\n...
[ "0.77771544", "0.7065067", "0.69639283", "0.6936445", "0.66949195", "0.6554356", "0.62642986", "0.62447995", "0.62447995", "0.62447995", "0.62242985", "0.62224233", "0.62043583", "0.62043583", "0.6199028", "0.6120777", "0.61071545", "0.61017853", "0.60987467", "0.6083384", "0...
0.0
-1
Identifies empty feature vectors
def is_zero_dict( dict ): has_any_features = False for key in dict: has_any_features = has_any_features or dict[key] return not has_any_features
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def irrelevant_features(features):\n irrelevant = []\n for vec in set(features):\n if (features[vec].count(0)/len(indtf_features[vec])) < 0.1:\n irrelevant.append(vec)\n return irrelevant", "def empty(self):\n return _uhd_swig.uhd_size_vector_t_empty(self)", "def __len__(self)...
[ "0.6569177", "0.6282958", "0.6276785", "0.6192717", "0.6157447", "0.61539346", "0.61179924", "0.60928863", "0.60695285", "0.6041442", "0.60379803", "0.6028977", "0.60289145", "0.60216546", "0.5998104", "0.5947502", "0.5947502", "0.59333825", "0.59324276", "0.59223014", "0.591...
0.5867847
22
Preprocess a single image of layout [height, width, depth].
def preprocess_image(image, is_training): if is_training: # Resize the image to add four extra pixels on each side. image = tf.image.resize_image_with_crop_or_pad( image, _IMAGE_SIZE + 8, _IMAGE_SIZE + 8) # Randomly crop a [_HEIGHT, _WIDTH] section of the image. image = tf.random_crop(image, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preprocess(image):\n return image - MEAN_PIXEL", "def image_preprocessing(img):\n\n # Removing parasite data (sky, trees and front of the car)\n return img[60:-20, :, :]", "def preprocess(self, img):\n img_ = image.load_img(img, target_size=(299, 299))\n img_ = image.img_to_array(img...
[ "0.7163514", "0.7148098", "0.70862305", "0.68458503", "0.6814179", "0.6797915", "0.6732928", "0.67209995", "0.671532", "0.6702475", "0.6694466", "0.6693217", "0.6673145", "0.66544497", "0.66286415", "0.65898776", "0.6576983", "0.65552187", "0.6524786", "0.65217966", "0.651925...
0.59542423
93
These are the parameters that work for CIFAR10 data.
def __init__(self, resnet_size, data_format=None, num_classes=_NUM_CLASSES, resnet_version=resnet_model.DEFAULT_VERSION, dtype=resnet_model.DEFAULT_DTYPE): if resnet_size % 6 != 2: raise ValueError('resnet_size must be 6n + 2:', resnet_size) num_blocks = (resnet_size - 2) //...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_cifar10(self):\n\t\t# Get the data.\n\t\tself.x_train = self.x_train.reshape(self.nb_train, self.input_dim)\n\t\tself.x_test = self.x_test.reshape(self.nb_test, self.input_dim)\n\t\tself.x_train = self.x_train.astype('float32')\n\t\tself.x_test = self.x_test.astype('float32')\n\t\tself.x_train /= 255\n\t\t...
[ "0.65884995", "0.620409", "0.60628486", "0.59556997", "0.5827081", "0.5796021", "0.57901245", "0.57782847", "0.57458854", "0.5738722", "0.57135123", "0.5708363", "0.5680949", "0.56369066", "0.5576975", "0.55761087", "0.5503329", "0.547142", "0.546797", "0.54473364", "0.542363...
0.0
-1
Model function for CIFAR10.
def cifar10_model_fn(features, labels, mode, params): features = tf.reshape(features, [-1, _IMAGE_SIZE, _IMAGE_SIZE, _NUM_CHANNELS]) learning_rate_fn = resnet_run_loop.learning_rate_with_decay( batch_size=params['batch_size'], batch_denom=128, num_images=_NUM_IMAGES['train'], boundary_epochs=[10, 20, 3...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_cifar10(self):\n\t\t# Get the data.\n\t\tself.x_train = self.x_train.reshape(self.nb_train, self.input_dim)\n\t\tself.x_test = self.x_test.reshape(self.nb_test, self.input_dim)\n\t\tself.x_train = self.x_train.astype('float32')\n\t\tself.x_test = self.x_test.astype('float32')\n\t\tself.x_train /= 255\n\t\t...
[ "0.6843386", "0.650111", "0.609306", "0.60163224", "0.5996454", "0.59331244", "0.588775", "0.58561015", "0.5830527", "0.57808924", "0.57354146", "0.5720595", "0.5690742", "0.56661737", "0.5664544", "0.5653322", "0.56082076", "0.55979353", "0.5551245", "0.5541251", "0.5541251"...
0.6535784
1
Run ResNet CIFAR10 training and eval loop.
def run_flower(flags_obj): input_function = input_fn resnet_run_loop.resnet_main( flags_obj, cifar10_model_fn, input_function, DATASET_NAME, shape=[_IMAGE_SIZE, _IMAGE_SIZE, _NUM_CHANNELS])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cifar10_model_fn(features, labels, mode, params):\n features = tf.reshape(features, [-1, _IMAGE_SIZE, _IMAGE_SIZE, _NUM_CHANNELS])\n\n learning_rate_fn = resnet_run_loop.learning_rate_with_decay(\n batch_size=params['batch_size'], batch_denom=128,\n num_images=_NUM_IMAGES['train'], boundary_epochs=...
[ "0.68692064", "0.68146634", "0.67452115", "0.6699857", "0.6683113", "0.6682839", "0.6632425", "0.6484482", "0.6415731", "0.64139616", "0.6357005", "0.63551235", "0.631291", "0.6257653", "0.6231015", "0.6218077", "0.62155414", "0.6197411", "0.6194097", "0.6192405", "0.6187572"...
0.6743016
3
This is the main prediction adding function. It starts by grabbing a file to open from standard in, which contains one message board page. It processes each message contained in the page.
def main(): # db_user = raw_input('DB username: ') db_user = 'oraclech' pw = getpass.getpass() odb = oracle_db.OracleDb(db_user, pw, database='oraclech_new') contest_id = raw_input('Current Contest ID? ') round_num = raw_input('Current Round Number? ') round_nums = round_num.split(',') topic_num = ra...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_poems(self):\n file = open(self.name, \"r\")\n content = file.readlines()\n for i in content:\n self.add_msg_and_index(i.strip())", "def process_input_file(sess, char_dict, model_settings, model_vars, input_file):\n \n with open(input_file, 'r') as f:\n for s...
[ "0.5945443", "0.5409753", "0.5362085", "0.5329677", "0.52767473", "0.5266814", "0.5265608", "0.52539533", "0.5241925", "0.5217411", "0.5205404", "0.51909417", "0.5187099", "0.51860255", "0.5160676", "0.5133867", "0.5133248", "0.51240563", "0.5112366", "0.51108074", "0.5107463...
0.6416924
0
This function parses the predictions in one individual message. If the message contains predictions, they will be inserted into the oracle database.
def ParsePredictions(odb, message, contest, round_nums): duel = 0 if contest['CompetitorsPerMatch'] == 2: duel = 1 user_id = odb.GetUserId(message['User']) if user_id is None: user_id = GetUserId(odb, message['User'], add_alt=1) # This enables admins to enter predictions for other users. # TODO: M...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _parse_raw_predictions(self, raw_predictions):\n result = []\n for line in raw_predictions.split(\"\\n\"):\n line_parts = line.split(\"|\")\n type = line_parts[0]\n assert type.lstrip(\"*\") in (\n \"FP\", \"TP\", \"TN\", \"FN\"), 'Expected {} to be...
[ "0.61501306", "0.6139516", "0.60400605", "0.5975302", "0.5914858", "0.5826979", "0.582425", "0.57627505", "0.5746949", "0.5707061", "0.56706715", "0.5667077", "0.5660581", "0.5609151", "0.56070286", "0.5595583", "0.55625534", "0.5559505", "0.5535425", "0.55325687", "0.5504344...
0.6788969
0
Get the user id of an unrecognized user.
def GetUserId(odb, username, add_alt=0): print 'Unrecognized user %s.' % (username) alt = raw_input('Is this user in our DB (y/n)? ') if alt == 'y': main_name = raw_input('What is their primary username? ') user_id = odb.GetUserId(main_name) if user_id is None: user_id = GetUserId(odb, main_nam...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_unknown_userid(self):\n cursor = self.conn.cursor()\n unknown_user_str = dbtypes.User.null\n cursor.execute(\"select id from users where uniqueid='%s'\" % unknown_user_str)\n return cursor.fetchone()[0]", "def _get_user_id(self, user: Optional[Dict[str, Any]]) -> Optional[str...
[ "0.80115664", "0.7302841", "0.7226531", "0.7225523", "0.7225523", "0.7088756", "0.7004554", "0.6994547", "0.6994547", "0.6994547", "0.6941295", "0.6934723", "0.68709123", "0.68640584", "0.6849172", "0.67509985", "0.6687582", "0.66480327", "0.66480327", "0.66307473", "0.659805...
0.6174131
58
Figure out a competitor id based on a userinput name.
def DecipherName(odb, winner_name, line, type, contest, round_nums): competitor_id = None competitors = odb.GetCompetitors(winner_name, type=type) if competitors and len(competitors) > 1: comps_in_round = [] for comp in competitors: if odb.IsCompetitorInRounds(comp['CompetitorId'], contest, round_n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_id(cls, name):\n assert name, 'name is empty'\n if name in cls._ids:\n return cls._ids[name]\n sql = \"SELECT id FROM hive_communities WHERE name = :name\"\n cid = DB.query_one(sql, name=name)\n if cid:\n cls._ids[name] = cid\n cls._names[...
[ "0.6559644", "0.65396285", "0.65396285", "0.63410085", "0.5949359", "0.5924379", "0.58869797", "0.5779381", "0.5747495", "0.5730306", "0.5696639", "0.5695518", "0.56872874", "0.5674879", "0.5640459", "0.5591031", "0.5586947", "0.5575347", "0.5573894", "0.5563811", "0.5533301"...
0.5925194
5
Prompt for user input to figure out who predictions are for. This function is written so that the Oracle host can post predictions in the topic for other users.
def PromptForId(odb, message, orig_id=1): print 'Is this prediction for someone other than the poster?\n\n%s\n\n' % \ (message['Text']) diff_user = raw_input('(y/n): ') if diff_user == 'n': return orig_id user_name = raw_input('Username this prediction is for? ') user_id = odb.GetUserId(user_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_prompt(self):\n # we need _something_ in the dictionary even if the user decides to use all defaults\n # otherwise for some unknown reason it won't work\n user_in = {'__meta__': '__user_input__'}\n\n print('Please enter the information asked for in the following prompts in order ...
[ "0.64296", "0.6354998", "0.63514704", "0.6275108", "0.6199466", "0.6192252", "0.6019146", "0.59782445", "0.5917745", "0.590989", "0.584681", "0.58215415", "0.5810385", "0.579001", "0.5771973", "0.576907", "0.5767045", "0.5765213", "0.5736743", "0.5734095", "0.57227224", "0....
0.67718136
0
Implement the closure here.
def _define_objective(self, inputs, labels, targets, intended_classes=None, true_classes=None): def closure(model, criterion, optimizer, target_grad, target_gnorm): """This function will be evaluated on all GPUs.""" # noqa: D401 outputs = model(inputs) if self.args.target_cr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def closure(self, t):\n raise NotImplementedError", "def callback(self):\n pass # pragma: no cover", "def __call__(self):\n\t\treturn", "def __call__( self ):\n pass", "def apply(self):", "def apply(self) -> None:", "def apply(self) -> None:", "def closure(self):\n return...
[ "0.72084713", "0.67918205", "0.66439474", "0.6594649", "0.6570198", "0.65522903", "0.65522903", "0.6530278", "0.6526465", "0.6436523", "0.64173025", "0.64173025", "0.64173025", "0.64173025", "0.64173025", "0.6416854", "0.64145666", "0.6391834", "0.63399154", "0.63399154", "0....
0.0
-1