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
Draws interpolation plot for given interpolation polynomial and nodes.
def draw_interpolation_plot(start_x, end_x, interpolation_polynomial, nodes, freq=200, additional_polynomial=None, additional_nodes=None): # TODO: calculate figure size dynamically plt.figure(figsize=(8, 6), dpi=80) x = numpy.linspace(start_x, end_x, freq) # TODO: eval should...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def drawPolynomial(self, index, color, precision=200):\n graph = self.graphs[index]\n if len(graph) > 1:\n p = PolynomialInterpolation(graph, color)\n p.show(self.context, precision)", "def plot_interpolation(self):\r\n self.plot_all_logcalls(True)\r\n print_log(...
[ "0.61234254", "0.5854555", "0.58188057", "0.5757321", "0.57179767", "0.5697689", "0.5670117", "0.56530726", "0.56499636", "0.5633391", "0.56109315", "0.56016254", "0.5506603", "0.5506603", "0.5494239", "0.5491141", "0.5464488", "0.54549974", "0.5449367", "0.5433634", "0.53791...
0.7956468
0
This method runs a process and logs the output to both a log file and stdout
def _subprocess_check_log_output(cmd, cwd, logfile): _LOG.info("Execute (%s): %s", cwd, cmd) cmd_base = cmd[0] if isinstance(cmd, (list, tuple)) else cmd.split(" ", 1)[0] proc = subprocess.Popen( cmd, cwd=cwd, shell=True, bufsize=0, stdout=subprocess.PIPE, std...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _run(self, args, cwd=None, env=None, logmode='wb'):\n args = tuple(str(arg) for arg in args)\n if self.process and self.process.poll() is None: \n raise RuntimeError(\"A process is already running\")\n if self.logfile:\n self.logfile.close()\n self.logfile = op...
[ "0.6857958", "0.6650118", "0.652399", "0.6440963", "0.64121723", "0.6306234", "0.62717485", "0.62601966", "0.62601346", "0.6242067", "0.62301815", "0.62156785", "0.6205138", "0.61483353", "0.61483353", "0.6128637", "0.6101594", "0.60817", "0.605676", "0.59793603", "0.59590703...
0.0
-1
This method generates a header file containing the data contained in the numpy array provided. It is used to capture the tensor data (for both inputs and expected outputs) to be bundled into the standalone application.
def _create_header_file(tensor_name, npy_data, output_path, data_linkage): file_path = pathlib.Path(f"{output_path}/" + tensor_name).resolve() # create header file raw_path = file_path.with_suffix(".h").resolve() with open(raw_path, "w") as header_file: header_file.write("#include <stddef.h>\n")...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_header(_metadata, rename_padding=False):\n template = \"\"\"\\\n VERSION {version}\n FIELDS {fields}\n SIZE {size}\n TYPE {type}\n COUNT {count}\n WIDTH {width}\n HEIGHT {height}\n VIEWPOINT {viewpoint}\n POINTS {points}\n D...
[ "0.62532175", "0.6250455", "0.6128656", "0.61236686", "0.61083066", "0.60900545", "0.6076962", "0.60498697", "0.6037466", "0.6030116", "0.5991017", "0.59467375", "0.5944712", "0.59186554", "0.5880443", "0.5877636", "0.587325", "0.5867404", "0.5816105", "0.58092946", "0.580886...
0.7628469
0
Convert a tflite model buffer in a Relay module
def convert_to_relay(tflite_model_buf, bind_params_by_name=True): # TFLite.Model.Model has changed to TFLite.Model from 1.14 to 2.1 try: import tflite.Model # pylint: disable=import-outside-toplevel tflite_model = tflite.Model.Model.GetRootAsModel(tflite_model_buf, 0) except AttributeError...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_relay_module_and_inputs_from_tflite_file(tflite_model_file, bind_params_by_name=True):\n with open(tflite_model_file, \"rb\") as f:\n tflite_model_buf = f.read()\n mod, params = convert_to_relay(tflite_model_buf, bind_params_by_name)\n\n inputs = dict()\n for param in mod[\"main\"].pa...
[ "0.6981948", "0.6846798", "0.6283583", "0.61803657", "0.5930052", "0.5720828", "0.5706919", "0.56350565", "0.5599901", "0.5577139", "0.55073345", "0.55071956", "0.5415228", "0.53956825", "0.53790677", "0.5360498", "0.5250914", "0.52445364", "0.5237697", "0.52300274", "0.52069...
0.7927206
0
This method generates runtime.Modules for the tests
def compile_models( models: Union[List[AOTTestModel], AOTTestModel], interface_api: str, use_unpacked_api: bool, workspace_byte_alignment: int = 8, constant_byte_alignment: int = 8, enable_op_fusion: bool = True, pass_config: Dict[str, Any] = None, use_runtime_executor: bool = True, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_module(self):\n pass", "def make_modules(self, config):\n pass", "def modules():", "def test():\n return _make_modules(is_train=False)", "def setUp(self):\n self.modules = {}", "def test_generate_all_testing(self):\n pass", "def test_create_modules_5(self):\n ...
[ "0.7218219", "0.72155625", "0.70887715", "0.6988405", "0.6895615", "0.66870666", "0.6605496", "0.6373421", "0.6339255", "0.63342136", "0.63128173", "0.6293195", "0.6291521", "0.62130636", "0.62130636", "0.61693025", "0.6134017", "0.613319", "0.61327916", "0.6114747", "0.60912...
0.0
-1
This method uses the original test data and compiled runtime.Modules to run in the test runner to verify the results.
def run_and_check( models: List[AOTCompiledTestModel], runner: AOTTestRunner, interface_api: str, debug_calculated_workspaces=False, workspace_byte_alignment=8, constant_byte_alignment=8, data_linkage: AOTDataLinkage = None, test_dir: str = None, verbose: bool = False, use_worksp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def runTests(self):\n \n pass", "def runtest(self):", "def test_process_data(self):\n pass", "def test1():\n for test in pkl.load(open(TEST_RESOURCES_DIR / \"regression_vault.pkl\", \"rb\"))[:5]:\n init_dict, rslt = test\n np.testing.assert_array_equal(run_regression_test(in...
[ "0.6638031", "0.6631693", "0.64999235", "0.6455514", "0.6418419", "0.6384221", "0.63442385", "0.632622", "0.62952894", "0.6268668", "0.6258088", "0.6243169", "0.6238762", "0.62081796", "0.61851895", "0.6180172", "0.611677", "0.6106589", "0.6078657", "0.60766435", "0.6063972",...
0.0
-1
This is a wrapper API to compile and run models as test for AoT
def compile_and_run( models: Union[List[AOTTestModel], AOTTestModel], runner: AOTTestRunner, interface_api: str, use_unpacked_api: bool, debug_calculated_workspaces: bool = False, workspace_byte_alignment: int = 8, constant_byte_alignment: int = 8, enable_op_fusion: bool = True, data...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_build_model(arguments):\n ...", "def run_tests():\n source1 = TextModel('prep')\n source1.add_file('source_model_1.txt')\n \n source2 = TextModel('athletes')\n source2.add_file('source_model_2.txt')\n\n new1 = TextModel('my_writing')\n new1.add_file('my_writing.txt')\n new1.cl...
[ "0.7452091", "0.7298708", "0.7190168", "0.6873378", "0.6621304", "0.6594363", "0.65664387", "0.6546556", "0.651935", "0.65192693", "0.65000486", "0.6479922", "0.64395165", "0.6420277", "0.64168084", "0.64134866", "0.6403398", "0.6369678", "0.6283531", "0.62546074", "0.6254037...
0.66533005
4
Produces the min,max for a give data type.
def get_dtype_range(dtype: str) -> Tuple[int, int]: type_info = None np_dtype = np.dtype(dtype) kind = np_dtype.kind if kind == "f": type_info = np.finfo(np_dtype) elif kind in ["i", "u"]: type_info = np.iinfo(np_dtype) else: raise TypeError(f"dtype ({dtype}) must indica...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def min_max(self, data, era):\n return 0, np.max(data)", "def GetFieldMinMax(fielddef):\n minmax = {'c': (0, 0xff),\n '?': (0, 1),\n 'b': (~0x7f, 0x7f),\n 'B': (0, 0xff),\n 'h': (~0x7...
[ "0.6595436", "0.6573459", "0.63240343", "0.6323688", "0.6292171", "0.62297505", "0.61910516", "0.6189594", "0.6187843", "0.61333334", "0.6130908", "0.61257744", "0.6082531", "0.60706013", "0.60532266", "0.6048332", "0.60448104", "0.60303867", "0.6009819", "0.60043925", "0.599...
0.5915377
26
Generate reference data through executing the relay module
def generate_ref_data(mod, input_data, params=None, target="llvm"): with tvm.transform.PassContext(opt_level=3, config={"tir.disable_vectorize": True}): lib = relay.build(mod, target=target, params=params) lib_name = "mod.so" temp = utils.tempdir() lib_path = temp.relpath(lib_name) lib.expo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self):\n self.parser.parse_args()\n\n sys.stdout.write(\"ref: %s\\n\\n\" % self.gen_ref())", "def make_reference(self):\n self.make_reference2()", "def generate(self):", "def genReferences( self, aWeb ):\n try:\n for t in self.commands:\n ref= t.r...
[ "0.61367774", "0.573806", "0.56130826", "0.5543687", "0.55034256", "0.55034256", "0.55034256", "0.55034256", "0.55034256", "0.55034256", "0.55034256", "0.55034256", "0.55034256", "0.55034256", "0.5495478", "0.5490769", "0.54810923", "0.544518", "0.5430902", "0.5426326", "0.54...
0.61549
0
A helper function to create a Relay IRModule with inputs and params from a tflite file
def create_relay_module_and_inputs_from_tflite_file(tflite_model_file, bind_params_by_name=True): with open(tflite_model_file, "rb") as f: tflite_model_buf = f.read() mod, params = convert_to_relay(tflite_model_buf, bind_params_by_name) inputs = dict() for param in mod["main"].params: n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tflite_load_model(model_file):\n interpreter = tf.lite.Interpreter(model_path=model_file)\n interpreter.allocate_tensors()\n return interpreter", "def convert_to_relay(tflite_model_buf, bind_params_by_name=True):\n # TFLite.Model.Model has changed to TFLite.Model from 1.14 to 2.1\n try:\n ...
[ "0.63068986", "0.6023051", "0.5813477", "0.5714911", "0.5690382", "0.5531973", "0.55067134", "0.5490141", "0.5472677", "0.54595083", "0.5441401", "0.5435935", "0.5368517", "0.5319013", "0.5307069", "0.5298142", "0.5294426", "0.5289352", "0.52519286", "0.5250053", "0.5224872",...
0.8060826
0
Initialises a tree object.
def __init__(self, lower, upper): self.vector = self._initialise(lower, upper) self.seeds = 0 self.year = 0 self.valid = True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, tree):\n self._tree = tree", "def __init__(self, tree):\n self._tree = tree", "def __init__(self,tree):\n self._tree = tree", "def __init__(self, tree_node=None):\n self.root = tree_node", "def __init__(self):\n self.tree = {}", "def __init__(self):\n...
[ "0.8144038", "0.8144038", "0.8024923", "0.79929876", "0.77982944", "0.7713998", "0.7585025", "0.75807476", "0.75445074", "0.75445074", "0.73131335", "0.73130155", "0.7305011", "0.72859436", "0.72735286", "0.7250354", "0.7244573", "0.7243289", "0.72401434", "0.7235641", "0.721...
0.0
-1
Tree object comparison method.
def __cmp__(self, other): if hasattr(other, 'year'): return self.year.__cmp__(other.year)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compareTree(t1, t2):\n \n reorderTree(t1)\n reorderTree(t2)\n\n return compareTreeHelper(t1, t2)", "def __eq__(self, other: 'Tree') ->bool:\n return (type(self) is type(other) and\n self.value == other.value and\n self.children == other.children)", "def __eq...
[ "0.7647767", "0.75716287", "0.73822033", "0.72987217", "0.71460176", "0.70908886", "0.6981702", "0.6969616", "0.6951032", "0.69436485", "0.6897531", "0.68732524", "0.6837008", "0.6833025", "0.6833025", "0.6833025", "0.6833025", "0.6833025", "0.6814338", "0.6804265", "0.678041...
0.0
-1
Tree object equality test.
def __eq__(self, other): if hasattr(other, 'vector'): return self.vector == other.vector
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other: 'Tree') ->bool:\n return (type(self) is type(other) and\n self.value == other.value and\n self.children == other.children)", "def test_deep_equals(obja, objb, isequal):\n\n objatree = wo.typedtree(obja)\n objbtree = wo.typedtree(objb)\n match ...
[ "0.81907886", "0.8065539", "0.79538393", "0.78520125", "0.7722757", "0.7619981", "0.75722384", "0.7570807", "0.7570623", "0.7570623", "0.7570623", "0.7570623", "0.7570623", "0.7509258", "0.7502789", "0.7492585", "0.74790883", "0.74709064", "0.7460193", "0.7412015", "0.7403098...
0.0
-1
Tree object non equality test.
def __ne__(self, other): if hasattr(other, 'vector'): return self.vector != other.vector
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, obj):\r\n return assert_(self.obj != obj, '%r == %r' % (self.obj, obj))", "def __eq__(self, other):\n self = filter_tree(self, _remove_visit_meta)\n return super(Node, self).__eq__(filter_tree(other, _remove_visit_meta))", "def __ne__(self, obj):\n return not self._...
[ "0.7296645", "0.7240735", "0.7235913", "0.7218751", "0.71460253", "0.7126969", "0.7104418", "0.7090795", "0.7070545", "0.703232", "0.70297754", "0.70278966", "0.70278966", "0.70278966", "0.7015042", "0.6992102", "0.6992102", "0.6984518", "0.69703865", "0.6957141", "0.6948727"...
0.0
-1
Runs a forest optimisation algorithm.
def run(self, verbose=False): cost = {}; cost["best"] = []; cost["mean"] = [] for i in range(self.max_iters): # prints out information at current cycle if verbose: print("Iteration: {}".format(i), "Fitness: {}".format(self.forest[0][0])) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n t = []\n for i in range(1, 19):\n t.append(i)\n config = Config()\n config.DEBUG = True\n config['time_list']=t\n config['load_graphs_from_xml']=True\n\n defaults = dict(num_samples=100, max_depth=5, run=0, num_runs=1,num_trees=100, stat='logrank', split_stat='logrank', nu...
[ "0.70378083", "0.6852305", "0.64964634", "0.63519055", "0.6336262", "0.63104767", "0.6238995", "0.6202586", "0.60780305", "0.6055713", "0.6045708", "0.60246295", "0.59518003", "0.5943695", "0.5926124", "0.5907505", "0.5890044", "0.5862114", "0.5828884", "0.58246505", "0.58167...
0.61327165
8
1. INITIALISATION PHASE. Generates an initial population of tree(s). The initial population should cover the entire search space as much as possible by uniformly randomizing individuals within the search space constrained by the prescribed lower and upper bounds.
def __init__(self, lower, upper , fun , max_std, min_std , init_numb_trees = 10 , max_numb_trees = 20 , max_seeds = 10 , min_seeds = 1 , ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_population(pop_size):\n population = []\n for md in range(2, MAX_DEPTH - 1):\n for _ in range(int(pop_size / 2)):\n t = Tree()\n t.random_tree(grow=True, max_depth=md) # Grow method \n population.append(t)\n for _ in range(int(pop_size / 2)):\n ...
[ "0.6994021", "0.6852024", "0.6667913", "0.65817934", "0.6566167", "0.6549831", "0.6475767", "0.6451392", "0.63917255", "0.63385963", "0.6332622", "0.6298666", "0.6279179", "0.6251736", "0.62178755", "0.61706847", "0.6140735", "0.60748637", "0.6073261", "0.60537773", "0.605144...
0.58912426
30
2. SELECTION PHASE. If a tree does not reproduce, it becomes extinct. Thus, this leads to the requirement of a competitive exclusion in order to eliminate those trees with lower metric values. This is done to limit the maximum number of trees in the forest. Initially, fast reproduction of trees take place and all of th...
def select(self): def truncate(self): """ Truncates forest to maximum number of trees. """ self.population = self.population[:self.max_number_trees] def SortOnItem(list_, item_loc): """ Sorts based on a given item. """ templist = [elmt[item_loc] for el...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _prune( tree, impurity_crit, dataSet, treeSeq ):\n\n\t\tsaved = {}\n\n\t\ttotal_leaf_impurity, num_leaves = DecisionTree._fetch(tree, impurity_crit, dataSet, saved)\n\n\t\tnodes, sets, G = saved['node'], saved['set'], saved['G']\n\n\t\t# choose TreeNode such that g is minimum to prune\n\t\tmin_g_ind = np.argmi...
[ "0.62971836", "0.62759644", "0.6227639", "0.6085251", "0.6084228", "0.6072655", "0.6057905", "0.6017821", "0.6007997", "0.5916229", "0.58216655", "0.5750822", "0.5743819", "0.5695105", "0.5636572", "0.56322336", "0.5611677", "0.5590373", "0.5590373", "0.55826205", "0.55778784...
0.7099714
0
Truncates forest to maximum number of trees.
def truncate(self): self.population = self.population[:self.max_number_trees]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def max_depth_forest(self):\n return max(x.tree_.max_depth for x in self.result.estimators_)", "def reset_max_depth(self) -> None:\n # The max depth is now calculated on the fly, so this is a no-op.\n pass", "def truncate_features(self):\n num_variable = len(self.Train_data['X'][0])...
[ "0.60658157", "0.5753063", "0.57320607", "0.5690253", "0.56196177", "0.557107", "0.5399001", "0.53606296", "0.5356624", "0.5334575", "0.53127694", "0.529486", "0.5244779", "0.52287835", "0.52241135", "0.5215633", "0.5206999", "0.51637185", "0.5151103", "0.5127064", "0.5113451...
0.7533811
0
Sorts based on a given item.
def SortOnItem(list_, item_loc): templist = [elmt[item_loc] for elmt in list_] index = np.argsort(templist) return [list_[i] for i in index]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def uasort(item, func):\n return sort(item, func)", "def execute(self, item):\n items = item[\"items\"]\n reverse = not item.get(\"descending\", True)\n items.sort(key=operator.itemgetter(\"distance\"), reverse=reverse)\n\n return item", "def SortChildren(self, item):\r\n\r\n ...
[ "0.73161393", "0.72464734", "0.6715392", "0.66951114", "0.63434577", "0.6228377", "0.61038965", "0.60990417", "0.60690224", "0.60291386", "0.60132074", "0.59880716", "0.5957402", "0.5946752", "0.5913124", "0.58741784", "0.5858698", "0.5855381", "0.5847765", "0.5800869", "0.57...
0.6484688
4
3. REPRODUCTION PHASE. The trees will produce seeds based on their relative fitness which will then be spread over the problem space. Each seed, in turn, will grow into a new tree depending on external factors. A linear increase in the number of seeds produced by the trees of the forest is considered from max_seeds for...
def reproduce(self): def compute_seeds(fitness): """ Computes the number of seeds given a fitness value. """ seeds = (fitness-min_fitness) / (max_fitness-min_fitness) * \ (self.max_seeds-self.min_seeds) + self.min_seeds return round(seeds) # ev...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self,\n lower, upper ,\n fun ,\n max_std, min_std ,\n init_numb_trees = 10 ,\n max_numb_trees = 20 ,\n max_seeds = 10 ,\n min_seeds ...
[ "0.6857431", "0.6693448", "0.620608", "0.61089987", "0.60859585", "0.60058355", "0.59534144", "0.5926585", "0.5920129", "0.59118456", "0.58440024", "0.5819384", "0.5805844", "0.5803149", "0.5793257", "0.5775363", "0.5769751", "0.5761044", "0.5759271", "0.5751068", "0.5741327"...
0.784303
0
Computes the number of seeds given a fitness value.
def compute_seeds(fitness): seeds = (fitness-min_fitness) / (max_fitness-min_fitness) * \ (self.max_seeds-self.min_seeds) + self.min_seeds return round(seeds)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_fitness(self, **kwargs):\n self.__fitness = self.fitness_function.calculate(self.__genes, **kwargs)\n self.num_fitness_eval += 1\n return self.__fitness", "def fitness(self):\n # TO BE DECIDED\n return 1", "def calcFitness (self) :\n fitnessArray = [[8, ...
[ "0.6422853", "0.63974106", "0.62456286", "0.6235945", "0.612314", "0.60374177", "0.6036776", "0.59866303", "0.5981496", "0.5973722", "0.5966571", "0.59424984", "0.5921845", "0.5910393", "0.5909234", "0.5907262", "0.59053224", "0.5892766", "0.58769244", "0.5876505", "0.5841656...
0.7105341
0
4. SEED DISPERSAL PHASE. Seed dispersal is the movement or transport of seeds away from the parent tree. Seeds are randomly distributed over the dimensional search space by random numbers drawn from either a normal distribution or a uniform distribution. In the biology of dispersal, a dispersal vector is "an agent tran...
def disperse(self, tree, dtype="normal", n=2): # computes "dispersion spread" for current generation spread = self._dispersion_spread(n) # creates mother tree's offsprings known as seedlings for _ in range(tree.seeds): # creates new seedling by mutation of mother tree's DN...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deng_random(seeds):\n\n x = seeds[0]\n y = seeds[1]\n\n while 0<1:\n temp = x\n x = (x + y) % 1.0\n y = temp\n yield x", "def seed():", "def seed():\n pass", "def seed():\n pass", "def _seed(self, seed):\n self.world.seed(seed)", "def reproduce(self)...
[ "0.62226486", "0.6216759", "0.6068667", "0.6068667", "0.60506463", "0.6025185", "0.5997389", "0.5925686", "0.59127784", "0.59025425", "0.5878437", "0.5868725", "0.5820426", "0.57940364", "0.5784051", "0.5725177", "0.5720389", "0.56988484", "0.56769013", "0.5634516", "0.562095...
0.0
-1
Creates a seedling by randomly mutating the DNA of its mother tree. For each seed, a coin toss decides whether a local or global seeding takes place to ensure constant exploration of the search space.
def _mutate(self, tree, spread, dtype): # defines wrapper functions def uniform(lower, upper): """ Draws a random float number from a uniform distribution given by U[lower, upper]. """ return lower + random.random() * (upper - lower) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def seed():", "def generate_random_walker():\n # must have seeds that generate known problems\n must_have_seeds = [112, 308, 393]\n for seed in must_have_seeds:\n print(\"Last used seed: {}\".format(seed))\n detections = detections_simple_tracking(seed)\n yield simple_walker(data_si...
[ "0.6827026", "0.6489305", "0.6472902", "0.6374276", "0.6374276", "0.6366158", "0.63590467", "0.6344138", "0.6339408", "0.62854254", "0.62784153", "0.62761444", "0.6232792", "0.61779606", "0.6149257", "0.61197567", "0.60963154", "0.6078606", "0.6052686", "0.60478973", "0.60458...
0.59798753
30
Draws a random float number from a uniform distribution given by U[lower, upper].
def uniform(lower, upper): return lower + random.random() * (upper - lower)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _rand_float(self, low, high):\n\n return self.np_random.uniform(low, high)", "def draw_random_u(d):\n mu = np.zeros(d)\n cov = np.eye(d)\n u = multivariate_normal.rvs(mean=mu, cov=cov)\n return u / np.linalg.norm(u)", "def rand_uni_val() -> float:\n return random.uniform(0, 1)", "de...
[ "0.7035064", "0.67842853", "0.66727394", "0.65749025", "0.650535", "0.64895654", "0.6346513", "0.63048273", "0.62389475", "0.61971956", "0.6175181", "0.6122292", "0.61146706", "0.61146706", "0.6104602", "0.6089752", "0.60430914", "0.6024726", "0.6020649", "0.597315", "0.59624...
0.73602164
0
Draws a random float number from a normal distribution
def normal(mean, std): return random.gauss(mean, std)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def random_normal():\r\n return inverse_normal_cdf(random.random())", "def random_normal():\n return inverse_normal_cdf(random.random())", "def random_float():\n return (random() - 0.5) * 2", "def draw_normal(self):\n means, scale = self.get_means_and_scales()\n return np.random.normal...
[ "0.7677711", "0.7557377", "0.72493887", "0.724668", "0.69417983", "0.6804732", "0.67062134", "0.65800136", "0.65611786", "0.64893746", "0.62739146", "0.62513113", "0.6185571", "0.6180643", "0.6170201", "0.6118213", "0.6113022", "0.61081076", "0.60634816", "0.606164", "0.60532...
0.70076823
4
Computes standard deviation for current generation search.
def _dispersion_spread(self, n): return pow(self.max_iters-self.iteration, n) / pow(self.max_iters, n) * \ (self.max_std - self.min_std) + self.min_std
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_std(self) -> float:\n\n if self.data:\n return np.std(self.data)\n else:\n return self.sigma", "def stddev(self, sample=True):\n distance_squared = list(map(lambda x: (x - sum(self.data)/self.size)**2, self.data))\n\n if sample == True:\n ...
[ "0.7485085", "0.73712903", "0.73565", "0.72915614", "0.7247638", "0.7231712", "0.72311544", "0.7163135", "0.7097697", "0.70636594", "0.70502454", "0.7017676", "0.7010243", "0.6961241", "0.6959725", "0.69366497", "0.6936612", "0.6928692", "0.6888086", "0.68561345", "0.6811737"...
0.0
-1
Checks that the solution vector is within optimal problem's boundaries.
def _check(self, vector): for i, elmt in enumerate(vector): # checks lower bound if (elmt < self.lower[i]): vector[i] = self.lower[i] # checks upper bound elif (elmt > self.upper[i]): vector[i] = self.upper[i] return ve...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def feasible(self):\n return self.lowBound <= self._value <= self.upBound", "def in_box_bounds(self, test_vec):\n above_min = np.greater(test_vec, self.lower_vertex).all()\n below_max = np.greater(self.upper_vertex, test_vec).all()\n return above_min and below_max", "def check(self)...
[ "0.6974493", "0.6576027", "0.6430475", "0.6387279", "0.63408345", "0.63387513", "0.6308674", "0.62025046", "0.6115721", "0.6056194", "0.60385", "0.6000666", "0.59949714", "0.594604", "0.593078", "0.59297556", "0.5917851", "0.5897417", "0.5875833", "0.58327293", "0.58318603", ...
0.65248317
2
all_mapshapes = ['planar','toroid','cylinder'] all_lattices = ['hexa','rect']
def set_topology(self, mapsize = None, mapshape = 'planar', lattice = 'rect', mask = None, compname = None): self.mapshape = mapshape self.lattice = lattice #to set mask if mask == None: self.mask = np.ones([1,self.dim]) else: self.mask = mask ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generatePolygons():", "def world_map_template():\n fig, ax = plt.subplots(figsize=(20, 10))\n ax.plot(\n laea_x(np.pi, np.linspace(-np.pi / 2, np.pi / 2)),\n laea_y(np.pi, np.linspace(-np.pi / 2, np.pi / 2)),\n color=\"k\",\n zorder=10,\n )\n ax.plot(\n laea_x(-...
[ "0.63717324", "0.613321", "0.5944496", "0.5944336", "0.5906684", "0.57789654", "0.5769901", "0.57611984", "0.5754275", "0.5728243", "0.57055295", "0.5698698", "0.56905955", "0.56884706", "0.5656957", "0.56549674", "0.5640292", "0.56383663", "0.5637242", "0.5591361", "0.557938...
0.0
-1
initmethod = ['random', 'pca'] algos = ['seq','batch'] all_neigh = ['gaussian','manhatan','bubble','cut_gaussian','epanechicov' ] alfa_types = ['linear','inv','power']
def set_algorithm(self, initmethod = 'pca', algtype = 'batch', neighborhoodmethod = 'gaussian', alfatype = 'inv', alfaini = .5, alfafinal = .005): self.initmethod = initmethod self.algtype = algtype self.alfaini = alfaini self.alfafinal = alfafinal self.neigh = neighborhoodmethod
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, options, is_training=False):\n self.options = options\n self.is_training = is_training\n self.add_bi_directional_edges = None\n self.add_self_loop_edges = None\n self.use_reverse_edges = None", "def __init__(self, algorithm, iters, **params):\n self.algorithm=algorithm\n ...
[ "0.5801649", "0.57721746", "0.57621926", "0.5752019", "0.570017", "0.5656524", "0.5650794", "0.558717", "0.55626065", "0.5558151", "0.55303484", "0.55301005", "0.5512373", "0.55113596", "0.5471883", "0.5464631", "0.54539907", "0.54456383", "0.5424106", "0.54218847", "0.541595...
0.7114801
0
som and bmu_ind depending on the lattice "hexa" or "rect" we have different grid distance functions. bmu_ind is a number between 0 and number of nodes1. depending on the map size bmu_coord will be calculated and then distance matrix in the map will be returned
def grid_dist(self,bmu_ind): try: lattice = getattr(self, 'lattice') except: lattice = 'hexa' print 'lattice not found! Lattice as hexa was set' if lattice == 'rect': return rect_dist(self,bmu_ind) elif lattice == 'hexa': try: msize = getattr(self...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_nbh_distance_weight_matrix(\n self, neighborhood_func: float, bmu_pos: Tuple[int, int]\n ) -> np.ndarray:\n dist_mat = np.linalg.norm(self.node_list_ - bmu_pos, axis=1)\n\n pseudogaussian = np.exp(\n -np.divide(\n np.power(dist_mat, 2), (2 * np.power(neigh...
[ "0.57011366", "0.5595913", "0.5572306", "0.5561625", "0.5546656", "0.5420969", "0.5410991", "0.53931206", "0.5357705", "0.5275946", "0.5256405", "0.5252467", "0.52403647", "0.52389497", "0.52355295", "0.5224548", "0.5204496", "0.5180344", "0.51797044", "0.51730376", "0.514120...
0.752086
0
Confirm if the module is ready to use.
def confirm_installation(cls): # here, you should write any code needed to confirm that all the # dependencies required by your module are installed. # this class method will be executed when HADDOCK3 starts. # if you module does not import any run-time dependency, just leave # ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_ready() -> bool:\n return True", "def is_ready(self) -> bool:\n pass", "def if_ready(self, **kwargs):\n return True", "def ready(self):\n return True", "def is_ready(cls):\n\n return False", "def do_ready(self) -> bool:\n logger.info('Device ' + self.n...
[ "0.74207395", "0.7248439", "0.7105069", "0.70115364", "0.6927248", "0.68734705", "0.6796418", "0.6686295", "0.65093833", "0.64878744", "0.6479587", "0.6478549", "0.6433703", "0.63425285", "0.63339937", "0.63253385", "0.6316342", "0.62913597", "0.6279354", "0.62712103", "0.625...
0.6735416
7
helper function to get the next ocurring monday as a date object
def _get_next_monday(self): today = datetime.date.today() weekday_int = today.weekday() if weekday_int == 0: return today next_mon = today + timedelta(7 - weekday_int) return next_mon
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_next_monday(date):\n return date + datetime.timedelta(days=-date.weekday(), weeks=1)", "def wkday_on_first(yr, mon): # returns day of week of first of month of the given year (1/1/2016)\r\n TotalDays = 0\r\n for x in range(1754, yr):\r\n YearNum = yeardays(x)\r\n TotalDays += Year...
[ "0.80878097", "0.69910073", "0.67567307", "0.67550325", "0.6671787", "0.66657865", "0.65446717", "0.65446717", "0.65441513", "0.6513178", "0.64433354", "0.6440269", "0.6345591", "0.63378316", "0.62782484", "0.6256524", "0.62425745", "0.6242084", "0.61851376", "0.61851376", "0...
0.8260075
0
Helper function adding some known todo list items for the test user
def _add_todo_items(self): todo_list = ToDoList(day=self.day, user=self.user.user.rolllistuser) todo_list.save() items = [ 'feed the cats', 'drive to work', 'read a book', 'eat some food', ] todo_items = [] for item in ite...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_can_add_todo_list():\n scheduler = Scheduler()\n new_id = uuid.uuid4()\n\n scheduler.add_todo_list(new_id, \"my todo list\")\n\n Is(scheduler.get_amount_of_todo_lists()).not_none.integer.has_same_truth_of(1)", "def test_given_a_user_when_I_add_a_todo_Then_I_can_access_it_from...
[ "0.67881167", "0.6779041", "0.67479783", "0.6636232", "0.65715206", "0.6420959", "0.63876003", "0.63576937", "0.6330586", "0.62917775", "0.62856203", "0.6273896", "0.62697417", "0.6185657", "0.6137805", "0.6080443", "0.60529596", "0.60524225", "0.601782", "0.6005775", "0.5996...
0.74570924
0
Helper function adding some known todo list items for the test user for the previous day
def _backfill_todo_items_for_previous_day(self): previous_day_date = self.day.date - timedelta(days=1) day, created = Day.get_or_create(date=previous_day_date) todo_list = ToDoList(day=day, user=self.user.user.rolllistuser) todo_list.save() items = [ 'cut the grass'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _add_todo_items(self):\n\n todo_list = ToDoList(day=self.day, user=self.user.user.rolllistuser)\n todo_list.save()\n\n items = [\n 'feed the cats',\n 'drive to work',\n 'read a book',\n 'eat some food',\n ]\n todo_items = []\n ...
[ "0.7035588", "0.63662964", "0.62633353", "0.5987224", "0.59500104", "0.5935984", "0.59221303", "0.5910842", "0.5875174", "0.5867453", "0.5842675", "0.5828082", "0.5801755", "0.5759313", "0.5746675", "0.5741539", "0.5722921", "0.5661359", "0.56570214", "0.5634428", "0.5626967"...
0.73899007
0
Helper function adding some known schedule items for the test user
def _add_schedule_items(self): schedules = [ { 'start_time': '9:30 AM', 'end_time': '10:00 AM', 'title': 'Daily Scrum', 'location': 'Hogwarts', 'day': self.day, 'user': self.user.user.rolllistuser, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_add_recurring_schedule(self):\n pass", "def test_list_schedules(self):\n pass", "def _create_schedules(self):\n\n ''''''", "def add_schedule(doc_user, date, schedule, logger):\n #my_calendar = col_calendar.find_one({\"User\": doc_user[\"_id\"]})\n my_calendar = col_calenda...
[ "0.68778497", "0.6814362", "0.67497754", "0.6255919", "0.5921792", "0.58371866", "0.58195525", "0.5796732", "0.57783014", "0.5733727", "0.5705526", "0.5705507", "0.5691883", "0.5643566", "0.5565707", "0.5564822", "0.5547369", "0.5525819", "0.552174", "0.5512991", "0.5498908",...
0.7738
0
Chooses moves for computer based on state of current board and difficulty of AI
def AI(current_board, AI_symbol, opponent_symbol, difficulty): #Written by Cody West victory_conditions = [[0,4,8],[2,4,6],[0,1,2],[3,4,5],[6,7,8],[0,3,6],[1,4,7],[2,5,8]] #Establishes victory conditions to be checked if difficulty >= 2: #If difficulty is at least 2 ## Cody -- you could just write: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def human_turn(c_choice, h_choice,xi,yi):\r\n depth = len(empty_cells(board))\r\n if depth == 0 or game_over(board):\r\n return\r\n\r\n # Dictionary of valid moves\r\n move = -1\r\n moves = {\r\n 0: [0, 0], 1: [0, 1], 2: [0, 2], 3: [0, 3], 4: [0, 4], 5: [0, 5], 6: [0, 6], 7: [0, 7], 8...
[ "0.7180501", "0.7104202", "0.7091236", "0.7071786", "0.7070496", "0.7067395", "0.70613885", "0.69441974", "0.69415534", "0.692273", "0.69195575", "0.6913044", "0.69035596", "0.69028074", "0.68817395", "0.6827539", "0.68212116", "0.6801467", "0.67608017", "0.6755071", "0.67443...
0.66842777
26
Creates a list of victory conditions based on the size of the board
def create_victory_conditions(size): #Written by Cody West. Not used in current program, could be used to make boards of different sizes victory_conditions = [] for i in range(size): horizontal_victory = [] for n in range(size): horizontal_victory.append(size*i+n) victory_co...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_board(size) -> list:\n return list(itertools.product([i for i in range(size)], repeat=2))", "def create_board(self, size, cars):\n board = [[None for i in range(size)] for j in range(size)]\n\n for car in cars.values():\n for i in range(car.length):\n if car....
[ "0.66391665", "0.62301445", "0.6140845", "0.60436356", "0.6038024", "0.5961014", "0.5920955", "0.58922297", "0.5841574", "0.581635", "0.57947874", "0.5757776", "0.57379335", "0.57237613", "0.570596", "0.56783783", "0.5668432", "0.56344336", "0.5629953", "0.56038624", "0.56017...
0.8714315
0
Plays Tic Tac Toe
def TicTacToe(): #Written by Cody West current_board = [" "," "," "," "," "," "," "," "," "] #Empty board players = 0 #Number of players human_turn = 0 #Indicates whether the human goes first or second (is 0 for two player games) turn = 1 #Turn number while players != 1 and players != 2: #While a va...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tic_tac_toe(board, player_1, player_2):\n # do an initial clear\n os.system('clear')\n winner = False\n cur_player = player_1\n player_num = 1\n # do Tic-Tac-Toe until we have found a winner\n while not winner:\n print_board(board)\n move = raw_input('\\n%s, where would you l...
[ "0.7581382", "0.75775814", "0.74732363", "0.7191872", "0.714979", "0.7070667", "0.7068065", "0.7031623", "0.7028581", "0.6929111", "0.69243205", "0.6854077", "0.6834494", "0.6790149", "0.67888355", "0.6788085", "0.6787451", "0.6786783", "0.6753092", "0.67121536", "0.66924953"...
0.73010886
3
Calculates rscu values for each codon
def calculate_rscu(handle: str, genetic_code_num: int, min_len_threshold: int = 200, gene_analysis: bool = False, save_file: bool = False, file_name: str = 'RSCU_report', folder_path: str = 'Report') -> \ dict[str, float | dict[str, float]]: records = parse(handle, 'fasta') references...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def SumaryCompras(vj):\n\n vj.CompasCUC = vj.MontoPrecios = vj.GanancPrecios = 0.0\n\n for row in vj.tbCompras.rows.values():\n prec = vj.MD.Convert( row.precio, row.moneda, MD.Cuc ) # Siempre lleva el precio a CUC\n\n vj.MontoPrecios += ( prec * row.count )\n vj.CompasCUC ...
[ "0.56749076", "0.5645466", "0.5644362", "0.5638017", "0.56055605", "0.55989563", "0.5504229", "0.54844487", "0.54743993", "0.54574186", "0.54527915", "0.5400491", "0.53917223", "0.53822356", "0.53790843", "0.5347198", "0.5308095", "0.530323", "0.5293776", "0.5282645", "0.5274...
0.58999944
0
The id of a node is assigned after topological sort in reversed topological order. (Root has id 0.) Use python object id if this node is not assigned a id
def id_str(self): if hasattr(self, 'id'): return str(self.id) else: return 'obj%s' % id(self)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def node_id(self) -> int:\r\n return self._node_id", "def tree_id(self):\n if self.is_root:\n return 0\n elif self._link is not None:\n return self._link.tree_id\n else:\n return self._tree_id", "def readjust_node_id(self, lowerbound = 1):\n f...
[ "0.64536446", "0.63846886", "0.60527354", "0.59763664", "0.59402263", "0.59402263", "0.5815118", "0.58136594", "0.58034563", "0.5800961", "0.5798843", "0.57527506", "0.5713669", "0.56929845", "0.56770647", "0.56754446", "0.5672043", "0.5670681", "0.56547654", "0.56452453", "0...
0.0
-1
Returns label used in dot representation.
def dot_label(self, detailed = True): if detailed: return '%s: %s' % (self.id_str(), escape_quote(str(self))) else: return '%s' % self.id_str()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_label(cls) -> str:\n return cls._meta.label_lower.split('.')[-1]", "def label(self):\n return self._label_shape", "def get_label(self, ):\n return self.attrs.get(self.AttributeNames.LABEL, None)", "def label(self):\n # type: () -> str\n labels = self.__class__.__lab...
[ "0.7191946", "0.7056918", "0.70269096", "0.6999598", "0.6973575", "0.6969061", "0.690872", "0.6877721", "0.68696594", "0.68696594", "0.68696594", "0.6843672", "0.6832188", "0.682814", "0.68096936", "0.68096936", "0.680629", "0.680629", "0.680629", "0.680629", "0.6804637", "...
0.6813281
14
dot language representation of this node and its incoming edges
def dot(self, color='', detailed=True): result = 'n%s [label="%s" style="filled" color="%s"];\n' % \ (self.id_str(), self.dot_label(detailed=detailed), color) # write hyperedges for i, edge in enumerate(self.incoming): edgename = 'e%s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_dot_str(self) -> Text:\n s = []\n s.append(\"digraph {\")\n for node in self.nodes:\n label = str(node)\n if node in self.start_nodes:\n label += \"S\"\n if node in self.accept_nodes:\n label += \"A\"\n s.appen...
[ "0.6938999", "0.6668665", "0.66680014", "0.6605425", "0.65282595", "0.65282595", "0.64935935", "0.64716935", "0.64622414", "0.6457543", "0.640081", "0.635242", "0.6327601", "0.6325863", "0.6287123", "0.6281614", "0.6276902", "0.62522554", "0.62207454", "0.6217396", "0.6181901...
0.6186007
20
return a set of nodes who are within max_dist of self
def neighbors(self, max_dist=3): # TODO: this may have problems because the set doesn't # compare object id but uses user defined comparison methods # TODO: outgoing edges are no longer saved found = set() found.add(self) queue = [(self, 0)] while queue: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eligible_nodes(self):\n return [v for v in self.G if self.eligible_node(v)]", "def getMaximumDistances(self):\n pass", "def find(self, value, max_distance):\n\t\t# type: (Any, int) -> List[Tuple[int, Any]]\n\n\t\tnode = self.root\n\t\tret = [] # type: List[Tuple[int, Any]]\n\n\t\tif node is N...
[ "0.6185975", "0.61843127", "0.6099087", "0.60814947", "0.6033172", "0.60061944", "0.5881994", "0.58049726", "0.5757084", "0.57157856", "0.57139254", "0.5710196", "0.57095784", "0.5681697", "0.5668638", "0.56296057", "0.56086", "0.5608161", "0.5601407", "0.5596248", "0.55825",...
0.7041858
0
show the neighborhood of this node in a picture
def show_neighborhood(self, max_dist=3, detailed=True): dotstr = '' for node in self.neighbors(max_dist): if node is self: dotstr += node.dot(color='dodgerblue', detailed=detailed) else: dotstr += node.dot(detailed=detailed) dotstr = 'digra...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show(self):\n data = []\n for row in self.grid:\n mid, bottom = [], []\n for node in row:\n \tmid += [0, int(node.right)]\n \tbottom += [int(node.down), 1]\n data += mid + [0] + bottom + [0] \n data[self.width*2+1] = 1\n data[-1] = 1\n data += (s...
[ "0.7047486", "0.6181761", "0.6136457", "0.61287487", "0.59386134", "0.59066224", "0.5844902", "0.5810311", "0.5801892", "0.57685393", "0.5745063", "0.5735822", "0.5733103", "0.57241136", "0.57115674", "0.56976724", "0.56679213", "0.56657785", "0.5641514", "0.56204975", "0.559...
0.73047006
0
subpaths is a list of paths on tail nodes. return a new path generated by concatenating this edge. this is used in kbest paths generation.
def make_path(self, subpaths): assert len(self.tail) == len(subpaths), '%s' % self path = Path(self, subpaths) weight = self.hg.one for p in subpaths: if p is not None: weight = self.hg.prod(weight, p.weight) weight = self.hg.prod(weight, self.hg.w(sel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decompose_paths_rec(node_inner, path):\n if node_inner.is_leaf():\n path = np.append(path, str(node_inner.value))\n return path[None]\n else:\n paths = np.array([])\n for edge_name in node_inner.child_nodes:\n ...
[ "0.59228057", "0.5917371", "0.5893389", "0.5885784", "0.58473676", "0.57791805", "0.5497774", "0.54971564", "0.5475109", "0.5418675", "0.5359241", "0.5319792", "0.5247005", "0.51880467", "0.51860625", "0.516922", "0.51333255", "0.5104041", "0.5086994", "0.5030389", "0.5015719...
0.65290594
0
find nodes that are reachable from the top and count the number of outgoing edges for each node
def find_reachable_nodes(self): # find all reachable nodes down from the goal found = {} found[id(self.root)] = self.root queue = [self.root] #print >>sys.stderr, '---' while queue: node = queue.pop(0) if hasattr(node, 'dead'): if n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def num_edges(self):\n return self._top_exp.number_of_edges()", "def guess_num_nodes_from(edgelist):\n return np.max(edgelist) + 1", "def count(self):\r\n return self.count_helper(self.top_node)", "def count_nodes(self):\n\t\treturn self.__count_nodes(self)", "def compute_num_edges(graph):...
[ "0.64417076", "0.63781655", "0.63414526", "0.63138336", "0.6295989", "0.6219865", "0.621095", "0.61789745", "0.61628515", "0.61369354", "0.6134823", "0.61268103", "0.61224973", "0.60808635", "0.60650635", "0.60560346", "0.6023287", "0.60106254", "0.60075134", "0.59867114", "0...
0.5841281
32
top down topo sort. nodes that don't reach the target node are thrown away
def topo_sort(self): # TODO: detect cycles self.find_reachable_nodes() # save list of nodes in topo order self.nodes = [] # assign each node an id field incrementally cur_id = 0 # count visited outgoing edges for each node unvisited = {} for nid, n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reset_topological_order(self):\n self._topological_order = self._input_nodes[:]\n self.sorted = False", "def topologicalSort(self):\r\n visited = [False]*self.vertices \r\n stack =[]\r\n \"\"\"\r\n using stack, problems with using code given by\r\n professor ...
[ "0.6479977", "0.64079857", "0.63420755", "0.63285846", "0.62891173", "0.62466025", "0.6230972", "0.6165624", "0.61602473", "0.6127933", "0.6103531", "0.6076643", "0.60480684", "0.60202795", "0.5990248", "0.5957457", "0.59298575", "0.59276503", "0.592397", "0.59147286", "0.584...
0.7133982
0
make sure a given operation on the hypergraph is done
def assert_done(self, task): if task not in self.tasks_done: # do the task if not done method = getattr(self, task) method()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __call__(self, node, operations, last_operation):\n if last_operation == NO_OPERATION:\n return 0\n return 1", "def do_operation(self):\n operation = self.inputs['operation']\n res = self.entity.do_operation(self.context, **self.inputs)\n if res:\n ret...
[ "0.6206891", "0.59665424", "0.5583435", "0.5557241", "0.54633397", "0.54628277", "0.54410225", "0.5430571", "0.54086703", "0.5403374", "0.53677326", "0.5349503", "0.53490293", "0.53462434", "0.5256265", "0.5256106", "0.52509886", "0.5231918", "0.5228386", "0.5189172", "0.5187...
0.0
-1
show the hypergraph as a pic
def show(self): f = open('/tmp/dotty', 'w') f.write(self.dot()) f.close() os.system('cat /tmp/dotty | dot -Tgif > /tmp/dotty.gif') os.system('eog /tmp/dotty.gif')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_graph(g):\r\n net.draw(g,with_labels= True,font_size=16)\r\n plt.show()", "def plot_graph(self) -> None:", "def show_custom_graph(self):\n pass", "def show():\n\tplt.show()", "def print_image(indiv,name):\n routine = gp.compile(indiv,pset)\n output = gen_beat_output(routine)\n ...
[ "0.71855307", "0.69043744", "0.68482786", "0.67418605", "0.6528953", "0.64814496", "0.64277744", "0.6422355", "0.6409942", "0.6409942", "0.6409942", "0.6407268", "0.6398413", "0.6386937", "0.63642865", "0.6362115", "0.6361208", "0.6333713", "0.6332453", "0.6316993", "0.626138...
0.0
-1
A deserializer reads hypergraphs dumped into files back into memory. The deserializer is initialized with types of nodes and edges used to construct a hypergraph.
def __init__(self, node_class=Node, edge_class=Edge): self.node_class = node_class self.edge_class = edge_class
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deserialize(self, filename):\n f = open(filename)\n edges_tails = []\n nodes = []\n # first pass adds incoming edges to nodes\n for line in f:\n if '->' in line: # edge\n edge = self.edge_class()\n tail_ids, head_id = edge.deserialize...
[ "0.6980027", "0.5925386", "0.56901735", "0.5565185", "0.5561407", "0.5539062", "0.55311584", "0.55090475", "0.54942447", "0.54745305", "0.54636663", "0.5446424", "0.543744", "0.54293144", "0.54181665", "0.5398218", "0.5389438", "0.5359855", "0.5344951", "0.5344879", "0.531816...
0.0
-1
Read a file and return a toposorted hypergraph.
def deserialize(self, filename): f = open(filename) edges_tails = [] nodes = [] # first pass adds incoming edges to nodes for line in f: if '->' in line: # edge edge = self.edge_class() tail_ids, head_id = edge.deserialize(line) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_graph(filename):\n G = Hypergraph()\n\n f = open(filename, 'r', encoding='utf8')\n lines = f.readlines()\n if args.weighted:\n for line in lines:\n line = line.split()\n edge_name = line[0]\n weight = line[1]\n G.add_edge(edge_name, line[2:], ...
[ "0.7323825", "0.6937586", "0.68380326", "0.67994225", "0.67790306", "0.6770359", "0.6753334", "0.669916", "0.6612476", "0.65449065", "0.6532908", "0.6516059", "0.64703196", "0.64033914", "0.63891566", "0.6366815", "0.63625896", "0.634472", "0.6317197", "0.6311096", "0.6296221...
0.7031254
1
Standard backtracking approach to find the optimal opmesh assignment, starting with the optimal number of stages (best_n_stages). The return is a list [((layer_start, next_layer_start), submesh_shape_idx, sharding_config_idx)] where (layer_start, next_layer_start) is [) slice of the ops and submesh_shape_idx is the sub...
def get_optimal_submesh_assignments( best_n_stages, F_argmin, n_devices, n_ops, submesh_sizes ): current_s = best_n_stages current_layer = 0 current_devices = n_devices optimal_layer_submesh_assignments = [] while current_s > 0 and current_layer < n_ops and current_devices > 0: next_sta...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inter_op_dp_inner_loop(\n n_layers, n_devices, submesh_sizes, valid_idxs_costs, max_n_succ_stages\n):\n F = np.full((n_layers + 1, n_layers + 1, n_devices + 1), np.inf, dtype=np.float32)\n F_stage_max = np.full(\n (n_layers + 1, n_layers + 1, n_devices + 1), 0.0, dtype=np.float32\n )\n F_...
[ "0.59374243", "0.5722452", "0.51469857", "0.51208717", "0.51167727", "0.5081394", "0.50553244", "0.50473976", "0.5028678", "0.5010286", "0.49406895", "0.49098796", "0.48995638", "0.4865513", "0.48511472", "0.48335147", "0.48096806", "0.47716156", "0.4743922", "0.47341198", "0...
0.7721114
0
Equation 3 from the Alpa paper. Primary difference from the paper is the s 1 max_n_succ_stages check then placing that stage would lead to OOM and thus continue).
def inter_op_dp_inner_loop( n_layers, n_devices, submesh_sizes, valid_idxs_costs, max_n_succ_stages ): F = np.full((n_layers + 1, n_layers + 1, n_devices + 1), np.inf, dtype=np.float32) F_stage_max = np.full( (n_layers + 1, n_layers + 1, n_devices + 1), 0.0, dtype=np.float32 ) F_argmin = np....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def N_stages(self):\n return 5", "def num_seq_dep_stages(self):\n n_s = [0]*len(self)\n for i in range(len(self)):\n for j in range(i):\n if self.A[i,j] != 0:\n n_s[i] = max(n_s[i], n_s[j]+1)\n\n n = 0\n for i in range(len(self)):\n ...
[ "0.6784844", "0.6024626", "0.5881136", "0.5734935", "0.5676947", "0.5604572", "0.5486235", "0.5474955", "0.5474955", "0.5469111", "0.5425464", "0.5390522", "0.53749573", "0.5342366", "0.53054893", "0.5284547", "0.5250292", "0.5236084", "0.52332866", "0.521916", "0.5216811", ...
0.0
-1
DP to compute optimal latency and number of pipeline stages and mapping of stages to compute cluster submeshes.
def inter_op_dp( n_layers: int, n_devices: int, n_microbatches: int, submesh_shapes: List[Tuple[int, int]], intra_compute_costs, max_n_succ_stages, ): min_cost = np.inf best_solution = None prev_intra_cost = 0.0 gap = 1e-6 submesh_sizes: list = NumbaList() for n, m in su...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def N_stages(self):\n return 5", "def calculate_cpu_parameters(self):\n\n # Calculate the cpu parameters, needed for the\n # vpp_startup and grub configuration\n for i in self._nodes.items():\n node = i[1]\n\n # get total number of nic ports\n interfac...
[ "0.57785887", "0.5777118", "0.5627112", "0.5470846", "0.5466452", "0.5450876", "0.5448035", "0.5408511", "0.53821594", "0.5357281", "0.5329908", "0.5319501", "0.5319265", "0.531267", "0.5305732", "0.5291986", "0.5286079", "0.5273258", "0.52633226", "0.52444196", "0.5243653", ...
0.52850324
17
Count the number of times elem appears in the reversed iterator.
def count(self, elem): return self.iter.count(elem)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sequence_sorted_count(self, x, reverse=False):\n c = 0\n if reverse: it = reversed(self)\n else: it = iter(self)\n for v in it:\n if x == v:\n c += 1\n break\n for v in it:\n if x == v: c += 1\n else: break\n return c", "def count(self):\n\n count = 0\n x = self.begin\n...
[ "0.710874", "0.67030925", "0.65069044", "0.6468267", "0.6360811", "0.6293502", "0.62844634", "0.6255483", "0.62217087", "0.6204283", "0.61864936", "0.6095033", "0.6027348", "0.5992894", "0.5981212", "0.59621656", "0.59607416", "0.5958107", "0.59503806", "0.593788", "0.5935426...
0.70186836
1
Find the index of elem in the reversed iterator.
def index(self, elem): return _coconut.len(self.iter) - self.iter.index(elem) - 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def r_index(sequence, element):\n\n for i, e in enumerate(reversed(sequence)):\n if element == e:\n return len(sequence) - 1 - i\n else:\n raise ValueError(\"r_index(sequence, element):\\\n element not in the sequence\")", "def index(self, elem):\n ...
[ "0.7337428", "0.7109907", "0.67639583", "0.6708626", "0.66251403", "0.6604515", "0.6553324", "0.65205306", "0.6481329", "0.6373556", "0.6335034", "0.6285708", "0.6278031", "0.6270351", "0.62547594", "0.6241182", "0.62061155", "0.6160364", "0.6146057", "0.61259276", "0.6125455...
0.7336818
1
Count the number of times elem appears in the count.
def count(self, elem): if not self.step: return _coconut.float("inf") if elem == self.start else 0 return int(elem in self)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count(self, elem):\n return self.iter.count(elem)", "def count(self, element):\n count = 0\n for i in range(self._length): # Increment count when equal value is found\n if self._arr[i] == element:\n count += 1\n return count", "def counts(e, x):\n a...
[ "0.8477194", "0.81752723", "0.71697414", "0.71684057", "0.71658355", "0.712942", "0.7125302", "0.7106333", "0.70579606", "0.70207214", "0.69894207", "0.69779223", "0.69651765", "0.69367886", "0.6842948", "0.6840524", "0.6828532", "0.6813907", "0.6807838", "0.68026924", "0.679...
0.7615898
2
Find the index of elem in the count.
def index(self, elem): if elem not in self: raise _coconut.ValueError(_coconut.repr(elem) + " not in " + _coconut.repr(self)) return (elem - self.start) // self.step if self.step else 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index(self, elem):\n pointer = self.head\n i = 0\n while (pointer):\n if pointer.data == elem:\n return i\n pointer = pointer.next\n i += 1\n raise ValueError(\"{} is not in list\".format(elem))", "def index(self, elem):\n pon...
[ "0.7664608", "0.74272794", "0.7314248", "0.7284313", "0.7212289", "0.71917605", "0.7169984", "0.70909643", "0.7077145", "0.7066599", "0.7030703", "0.6965797", "0.69524926", "0.69229907", "0.689439", "0.68874395", "0.68740386", "0.68163633", "0.6796156", "0.6779805", "0.674583...
0.70635706
10
Decorator to add a new case to a patternmatching function, where the new case is checked last.
def addpattern(base_func, **kwargs): allow_any_func = kwargs.pop("allow_any_func", False) if not allow_any_func and not _coconut.getattr(base_func, "_coconut_is_match", False): _coconut.warnings.warn("Possible misuse of addpattern with non-pattern-matching function " + _coconut.repr(base_func) + " (pass...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _add_case(self, text=None, type=None, pattern=None, pattern_flags=0,\n preexe=False):\n def wrapper(func):\n if preexe:\n self.preexe_cases.append((func, text, type, pattern, pattern_flags))\n else:\n self.cases.append((func, text, typ...
[ "0.6772898", "0.6573733", "0.5659867", "0.553022", "0.5431647", "0.5417446", "0.5378049", "0.53306925", "0.5268356", "0.5241548", "0.5207836", "0.51987594", "0.511116", "0.5002985", "0.49989533", "0.49934804", "0.49919218", "0.4984045", "0.49082255", "0.49020272", "0.4897801"...
0.6158975
2
consume(iterable, keep_last) fully exhausts iterable and return the last keep_last elements.
def consume(iterable, keep_last=0): return _coconut.collections.deque(iterable, maxlen=keep_last)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def last(iterable):\n d = deque(iterable, maxlen=1)\n try:\n return d.pop()\n except IndexError:\n raise ValueError(\"Cannot return last item from empty iterable {!r}\".format(iterable))", "def last(iterable):\n it = iter(iterable)\n item = next(it)\n for item in it:\n pass...
[ "0.65945584", "0.6441955", "0.6378709", "0.6298682", "0.62027675", "0.5920305", "0.58600926", "0.56532353", "0.5636033", "0.5536152", "0.54646903", "0.5434246", "0.5425633", "0.53895926", "0.5381128", "0.5375591", "0.5357746", "0.5334514", "0.5308047", "0.52714187", "0.526574...
0.7717289
0
Construct an object of the given data_type containing the given arguments.
def makedata(data_type, *args): if _coconut.hasattr(data_type, "_make") and _coconut.issubclass(data_type, _coconut.tuple): return data_type._make(args) if _coconut.issubclass(data_type, (_coconut.map, _coconut.range, _coconut.abc.Iterator)): return args if _coconut.issubclass(data_type, _co...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, data_type=None):\n self.type = data_type", "def from_data(cls, data):\n return object.__new__(cls)", "def create(cls, data=None):\n # allow create() calls with no input\n if not data:\n data = {}\n\n return cls(**data)", "def __init__(self,\n ...
[ "0.65806115", "0.6494723", "0.6493428", "0.6436474", "0.63050216", "0.61820936", "0.6163499", "0.61415094", "0.60745573", "0.6070686", "0.6051727", "0.60087764", "0.6002497", "0.5975732", "0.5947289", "0.58672804", "0.5859592", "0.58576393", "0.5827365", "0.5820931", "0.58127...
0.7436465
0
fmap(func, obj) creates a copy of obj with func applied to its contents. Override by defining obj.__fmap__(func).
def fmap(func, obj): if _coconut.hasattr(obj, "__fmap__"): return obj.__fmap__(func) if obj.__class__.__module__ == "numpy": from numpy import vectorize return vectorize(func)(obj) return _coconut_makedata(obj.__class__, *(_coconut_starmap(func, obj.items()) if _coconut.isinstance(ob...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fmap(function, descriptor):\n return MappedDescriptor(descriptor, function)", "def map(self, func):\n return _(map(func, self._))", "def map(self, function):\n return FunctionalWrapper(map(function, self.data))", "def fmap(self, func):\n @wraps(self.v)\n def state_mapper(st...
[ "0.6220919", "0.5839332", "0.5682536", "0.56519437", "0.55576444", "0.5554828", "0.54123265", "0.53920573", "0.5390306", "0.53785086", "0.5342291", "0.5333462", "0.53316593", "0.532099", "0.526166", "0.52036095", "0.52029043", "0.51939046", "0.5186709", "0.51471406", "0.50727...
0.80145234
0
Decorator that memoizes a function, preventing it from being recomputed if it is called multiple times with the same arguments.
def memoize(maxsize=None, *args, **kwargs): return _coconut.functools.lru_cache(maxsize, *args, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def memoize(f):\n cache = {}\n @functools.wraps(f)\n def g(*args):\n ret = cache.get(args, cache)\n if ret is cache:\n ret = cache[args] = f(*args)\n return ret\n return g", "def memoize(func):\n cache = {}\n @wraps(func)\n def wrap(*args):\n if args no...
[ "0.8607585", "0.85202116", "0.8493943", "0.84850585", "0.8431629", "0.83458835", "0.830083", "0.82646495", "0.82383895", "0.82372373", "0.82353806", "0.8204611", "0.8204611", "0.8204611", "0.8190656", "0.814723", "0.81472206", "0.80591935", "0.80570954", "0.8055087", "0.80415...
0.68058383
66
Automatically starts the thread.
def __init__(self, file_name, max_queue_size=100): threading.Thread.__init__(self) self.daemon = True self.sqlite3_conn = sqlite3.connect(file_name, check_same_thread=False, detect_types=sqlite3.PARSE_DECLTYPES) self.sqlite3_cursor = self.sqlite3_conn.cursor() self.sql_queue = qu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start(self):\n self._setup_thread()\n self.thread.start()", "def start(self):\n self.thread.start()", "def start(self):\n self._thread.start()", "def start(self) -> None:\n start_thread(super().start, self.__class__.__name__)", "def start(self):\n \n sel...
[ "0.8236653", "0.81681097", "0.8104186", "0.8093559", "0.774491", "0.7613398", "0.7493972", "0.7435424", "0.734553", "0.73255163", "0.7319545", "0.7309675", "0.72819525", "0.72819525", "0.72664046", "0.7243573", "0.7182632", "0.7128363", "0.71228725", "0.71228725", "0.7110407"...
0.0
-1
Thread loop. This is an infinite loop. The iter method calls self.sql_queue.get() which blocks if there are not values in the queue. As soon as values are placed into the queue the process will continue. If many executes happen at once it will churn through them all before calling commit() to speed things up by reducin...
def run(self): logging.debug("run: Thread started") execute_count = 0 for token, query, values in iter(self.sql_queue.get, None): logging.debug("sql_queue: %s", self.sql_queue.qsize()) if token != self.exit_token: logging.debug("run: %s", query) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run():\r\n num_workers = g.num_query_queue_workers\r\n wq = WorkQueue(num_workers = num_workers)\r\n wq.start()\r\n\r\n while True:\r\n job = None\r\n #limit the total number of jobs in the WorkQueue. we don't\r\n #need to load the entire db queue right away (the db queue can\r...
[ "0.7164139", "0.6617921", "0.6452826", "0.6395609", "0.6328278", "0.62974733", "0.62549317", "0.6231184", "0.616941", "0.60640925", "0.6058464", "0.5961299", "0.588708", "0.5882663", "0.5875031", "0.5870313", "0.5865822", "0.5852583", "0.5845655", "0.5839005", "0.5820537", ...
0.7875983
0
Close down the thread and close the sqlite3 database file.
def close(self): self.exit_set = True self.sql_queue.put((self.exit_token, "", ""), timeout=5) # Sleep and check that the thread is done before returning. while self.thread_running: time.sleep(.01) # Don't kill the CPU waiting.
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close_db(connection: sqlite3.Connection):\n connection.commit()\n connection.close()", "def close_db(self):\n with nostderr():\n tb.file._open_files.close_all()", "def close(self):\n\t\tself.db.close()", "def cleanup(_):\n self.db.close()", "def close(self):\n ...
[ "0.72728205", "0.726023", "0.71503633", "0.71176696", "0.7114434", "0.7111585", "0.7087267", "0.7087267", "0.7087267", "0.7081732", "0.70814943", "0.6973683", "0.69685507", "0.69284976", "0.68923795", "0.6879302", "0.6870084", "0.68667877", "0.68667877", "0.68667877", "0.6866...
0.6315703
100
Return the queue size.
def queue_size(self): return self.sql_queue.qsize()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _getqueuesize(self):\n return self._queuesize", "def queue_size(self) -> int:\n return self._queue.qsize()", "def queue_size(self):\n return self._queue_size", "def qsize(self):\r\n return len(self._queue)", "def queue_size(self):\n # pylint: disable=protected-access\...
[ "0.92133445", "0.9186504", "0.91504335", "0.8877782", "0.8795246", "0.87893367", "0.8775905", "0.8775905", "0.8775905", "0.8775905", "0.8757166", "0.8754371", "0.8695905", "0.8690609", "0.8690609", "0.8606325", "0.85473734", "0.8437442", "0.8317189", "0.82109904", "0.81546557...
0.84914595
17
Get the query results for a specific token.
def query_results(self, token): delay = .001 while True: if token in self.results: return_val = self.results[token] del self.results[token] return return_val # Double back on the delay to a max of 8 seconds. This prevents ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def listSearches(self, authenticationToken):\r\n pass", "async def _perform_get_results(self, login_token, result_token):\n data = {\"resultSetToken\": result_token, \"token\": login_token}\n return await self._perform_request(\"get-results\", data, lambda r: r.json())", "def get_query_results...
[ "0.6801665", "0.67875", "0.67327553", "0.62611675", "0.6151787", "0.6134605", "0.5989142", "0.596726", "0.5918041", "0.5917684", "0.5901937", "0.5862396", "0.5783096", "0.5776911", "0.57683307", "0.5756532", "0.5746983", "0.5745782", "0.571591", "0.57145137", "0.5698427", "...
0.7163675
0
Create and save a user with the given username, email, and password.
def _create_user(self, username, email, password, **extra_fields): if not username: raise ValueError('The given username must be set') email = self.normalize_email(email) username = self.model.normalize_username(username) user = self.model(username=username, email=email, **ex...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_user(self, email, password,username, **extra_fields):\r\n if not email:\r\n raise ValueError('The given email must be set')\r\n if not username:\r\n raise ValueError('The given username must be set')\r\n email = self.normalize_email(email)\r\n user = se...
[ "0.859775", "0.8441594", "0.842702", "0.8424334", "0.8394744", "0.8389154", "0.834259", "0.8335656", "0.8334432", "0.83239305", "0.82892966", "0.82822585", "0.8275777", "0.8270387", "0.82692033", "0.8165085", "0.8160581", "0.8158989", "0.8143792", "0.8138259", "0.8128023", ...
0.84072465
4
A backend can raise `PermissionDenied` to shortcircuit permission checking.
def _user_has_perm(user, perm, obj): for backend in auth.get_backends(): if not hasattr(backend, 'has_perm'): continue try: if backend.has_perm(user, perm, obj): return True except PermissionDenied: return False return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def permission_required_or_403(perm, *args, **kwargs):\n kwargs['return_403'] = True\n return permission_required(perm, *args, **kwargs)", "def DeniedPermissions(self) -> _n_6_t_0:", "def test_only_add_perm(self):\n self.assertStatusCode(self.url, 403)", "def forbidden():\n return HttpError(4...
[ "0.7416006", "0.71565545", "0.6592668", "0.6589614", "0.6547855", "0.65448385", "0.64365923", "0.6416801", "0.6404717", "0.6373068", "0.63710433", "0.6339145", "0.6339145", "0.6339145", "0.6339145", "0.6312995", "0.6312995", "0.6291042", "0.62679636", "0.6225085", "0.6165789"...
0.0
-1
A backend can raise `PermissionDenied` to shortcircuit permission checking.
def _user_has_module_perms(user, app_label): for backend in auth.get_backends(): if not hasattr(backend, 'has_module_perms'): continue try: if backend.has_module_perms(user, app_label): return True except PermissionDenied: return False ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def permission_required_or_403(perm, *args, **kwargs):\n kwargs['return_403'] = True\n return permission_required(perm, *args, **kwargs)", "def DeniedPermissions(self) -> _n_6_t_0:", "def test_only_add_perm(self):\n self.assertStatusCode(self.url, 403)", "def forbidden():\n return HttpError(4...
[ "0.74162996", "0.71563745", "0.6592866", "0.6589361", "0.6548821", "0.6544809", "0.6436187", "0.6416667", "0.64040965", "0.6372819", "0.6371053", "0.6338895", "0.6338895", "0.6338895", "0.6338895", "0.63118577", "0.63118577", "0.629086", "0.6268523", "0.62251085", "0.61657155...
0.0
-1
Return the first_name plus the last_name, with a space in between.
def get_full_name(self): full_name = '%s %s' % (self.first_name, self.last_name) return full_name.strip()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def full_name(first_name, last_name):\n return first_name + \" \" + last_name", "def full_name(first_name, last_name):\n\t\n\treturn first_name + \" \" + last_name", "def get_formated_name(first_name,last_name):\n\tfull_name = first_name + '' + last_name\n\treturn full_name.title()", "def get_full_name(se...
[ "0.83421856", "0.82273436", "0.80990887", "0.8067676", "0.80525744", "0.8043721", "0.7993416", "0.7992513", "0.7992513", "0.7992513", "0.7978309", "0.7963202", "0.7957057", "0.79399455", "0.7936728", "0.79338795", "0.79154027", "0.7901051", "0.7892942", "0.787005", "0.7855431...
0.7785957
53
Return the short name for the user.
def get_short_name(self): return self.first_name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_short_name(self):\n return self.username", "def get_short_name(self):\n return self.username", "def get_short_name(self):\n return self.username", "def get_short_name(self):\n return f\"{self.first_name} {self.last_name[:1]}\" if self.first_name else self.username", "def...
[ "0.90364677", "0.90364677", "0.90364677", "0.8846686", "0.8816478", "0.8637505", "0.84531367", "0.83548844", "0.82865363", "0.82676977", "0.82676977", "0.820093", "0.8189229", "0.8159965", "0.8155279", "0.81156635", "0.81005275", "0.804605", "0.80386364", "0.79630274", "0.791...
0.8196602
28
Send an email to this user.
def email_user(self, subject, message, from_email=None, **kwargs): send_mail(subject, message, from_email, [self.email], **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def email_user(self, subject, message, from_email=None):\n send_mail(subject, message, from_email, [self.email])", "def email_user(self, subject, message, from_email=None):\n send_mail(subject, message, from_email, [self.email])", "def email_user(self, subject, message, from_email=None):\n ...
[ "0.8407289", "0.8407289", "0.8407289", "0.8407289", "0.8407289", "0.8407289", "0.8407289", "0.8407289", "0.83597654", "0.83339775", "0.83339775", "0.8311258", "0.8289855", "0.8277409", "0.82756543", "0.8237377", "0.82188", "0.8208959", "0.72830915", "0.7241861", "0.71827024",...
0.8291159
25
Returns the 2nd largest value from a given list.
def second_largest(values: List[int]) -> int: try: return sorted(set(values))[-2] except IndexError: raise ValueError("second_largest() needs at least two distinct values")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def two_largest(inlist):\n largest = second_largest = 0\n it1 = it2 = 0\n\n for i,item in enumerate(inlist):\n if item > largest:\n largest = item\n it1 = i\n elif largest > item > second_largest:\n second_largest = item\n it2 = i\n # Return the...
[ "0.79893696", "0.7755604", "0.76443726", "0.75765264", "0.7529355", "0.75202054", "0.75019395", "0.746542", "0.7456516", "0.738916", "0.7388165", "0.733121", "0.7291496", "0.7259317", "0.7139178", "0.713446", "0.70853615", "0.7072863", "0.6986864", "0.6984842", "0.6957062", ...
0.8168143
0
Find the program in the system path.
def FindEnv(progname): for path in os.environ['PATH'].split(':'): fullname = os.path.join(path, progname) if os.access(fullname, os.X_OK): return fullname raise AssertionError( "Could not find an executable named '%s' in the system path" % progname)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _which(self, program):\n\n def is_exe(path):\n return os.path.isfile(path) and os.access(path, os.X_OK)\n\n fpath, fname = os.path.split(program)\n if fpath:\n if is_exe(program):\n return program\n else:\n basedir = os.path.dirname(os...
[ "0.781772", "0.7618674", "0.74158335", "0.7389722", "0.7373021", "0.73094624", "0.7304917", "0.7303897", "0.7273199", "0.7246536", "0.7245675", "0.7232254", "0.72052497", "0.7189291", "0.7188439", "0.7188439", "0.7182894", "0.7165535", "0.7100432", "0.7094812", "0.6961689", ...
0.7299696
8
Try to get the path to pdb.py and return it in a list.
def GetPdbArgs(python): # Usually, python is /usr/bin/pythonxx and pdb is /usr/lib/pythonxx/pdb.py components = python.split('/') if len(components) >= 2: pdb_path = '/'.join(components[0:-2] + ['lib'] + components[-1:] + ['pdb.py']) if os.access(pdb_path, os.R_OK): return [p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pdbfile_list():\n import glob, os\n os.chdir(\"../Data\")\n file_list = []\n for file in glob.glob(\"*.pdb\"):\n file_list.append(file)\n return file_list", "def pdbfile_list():\n \n import glob, os\n os.chdir(\"../Data\")\n file_list = []\n for file in glob.glob(\"*.pdb\...
[ "0.7001057", "0.6927535", "0.6694564", "0.5969401", "0.5900031", "0.58544034", "0.5816103", "0.58008647", "0.58002234", "0.57855517", "0.57504606", "0.5737899", "0.5679186", "0.5636797", "0.55898374", "0.5576825", "0.54973745", "0.53993475", "0.53957206", "0.53377414", "0.532...
0.72876877
0
Print usage for the stub script.
def PrintOurUsage(): print 'Stub script %s (auto-generated). Options:' % sys.argv[0] print ('--helpstub ' 'Show help for stub script.') print ('--debug_binary ' 'Run python under debugger specified by --debugger.') print ('--debugger=<debugger> ' "Debugger f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def usage():", "def usage():", "def print_usage():\n print(helptxt)\n sys.exit(2)", "def usage():\n pass", "def usage() :\n\n print usage.__doc__", "def usage():\n print(__doc__.strip())", "def display_usage():\n print >> sys.stderr, __doc__", "def print_usage():\r\n print(\...
[ "0.810532", "0.810532", "0.80087817", "0.7974354", "0.7823985", "0.7744431", "0.7735299", "0.760537", "0.76011324", "0.76011324", "0.7589592", "0.7553557", "0.7550795", "0.75118643", "0.7472906", "0.746817", "0.7346284", "0.7329634", "0.7301601", "0.7280952", "0.7278727", "...
0.8339372
0
Run a module as a script. Locates the module's file and runs it in the current interpreter, or optionally a debugger.
def RunScriptModule(module): args = sys.argv[1:] debug_binary = False debugger = 'gdb --args' debug_script = False show_command_and_exit = False while args: if args[0] == '--helpstub': PrintOurUsage() sys.exit(0) if args[0] == '--debug_binary': debug_binary = True args = ar...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_python_script(package=None, module=None, args=[], p_args=[]):\n assert module is not None\n assert isinstance(args, (tuple, list)) and isinstance(p_args, (tuple, list))\n path = python_script_exists(package, module)\n run_program(sys.executable, p_args + [path] + args)", "def run_script(exten...
[ "0.6864769", "0.6780037", "0.6562564", "0.65126973", "0.63618916", "0.62197036", "0.6204552", "0.6153162", "0.6135312", "0.61225456", "0.61223215", "0.61039793", "0.60877556", "0.6078428", "0.603614", "0.5902457", "0.5856509", "0.58559155", "0.5846937", "0.58052075", "0.57135...
0.84551585
0
Takes an rng, returns a html form. Should be reworked.
def make_form(rng, root_name='ArchiveTransfer'): results = rng.to_form() inside = results[root_name] def make_input(value): """ depending on what is found in the rng, make the input""" what = value[0] if what.startswith('not editable'): what = what.replace('not editable:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rng():\n pass", "def rng():\n pass", "def create_html(self):\n rows = self.check()\n htmlrows = \"\"\n for row in rows:\n data = self._format_row(row)\n htmlrows += data\n \n return self.TEMPLATE.format(content=htmlrows)", "def _repr_html_(se...
[ "0.5834163", "0.5834163", "0.5702302", "0.56189793", "0.5424083", "0.5400542", "0.5398129", "0.53365695", "0.53144455", "0.5303006", "0.5300281", "0.5285712", "0.5281219", "0.52759695", "0.52519524", "0.52497476", "0.52317435", "0.5196451", "0.5196451", "0.5191627", "0.516962...
0.46454608
90
depending on what is found in the rng, make the input
def make_input(value): what = value[0] if what.startswith('not editable'): what = what.replace('not editable:', '').replace("'", "\'") if what.startswith('attribute:value:'): what = what.replace('attribute:value:', '').replace("'", "\'") return what
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rng():\n pass", "def rng():\n pass", "def __call__(self, mutant, rng):\n raise NotImplementedError", "def find_input():\n\n mat = [[5,0],[0,0],[0,0]]\n num_range = [0,2]\n sub = 3 #Number of pixels to be substituted.\n\n input = [mat, num_range, sub]\n\n return input", "def ...
[ "0.5973425", "0.5973425", "0.5430724", "0.5237212", "0.517664", "0.5133807", "0.5112024", "0.50218385", "0.4966752", "0.492342", "0.49195346", "0.48895872", "0.4850323", "0.47207487", "0.46716097", "0.46587282", "0.46179524", "0.4611999", "0.46064407", "0.46034813", "0.458794...
0.0
-1
walks through the dict, makes a form
def walk_dict(target_dict, depth=1): stuff = "" def metadata_in_name(target_string, values): """serioulsy""" return 0 in [target_string.find(value) for value in values] for rng_key, rng_val in sorted(target_dict.items(), key=lambda x: x[0]): if isinstance(rn...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_form(rng, root_name='ArchiveTransfer'):\n results = rng.to_form()\n inside = results[root_name]\n\n def make_input(value):\n \"\"\" depending on what is found in the rng, make the input\"\"\"\n what = value[0]\n if what.startswith('not editable'):\n what = what.rep...
[ "0.6394135", "0.6110445", "0.600457", "0.59126186", "0.586534", "0.5860337", "0.5741977", "0.5653947", "0.56515414", "0.5616137", "0.5573657", "0.55662775", "0.53771883", "0.5328441", "0.5310097", "0.52721184", "0.52581376", "0.52523905", "0.52309453", "0.52180254", "0.520978...
0.5852613
6
check if str startswith
def val_starts_with(base_string, strings): for the_string in strings: if base_string.startswith(the_string): return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def startswith(value, s):\n\n if not value: return False\n return value.find(s) == 0", "def starts_with(s, prefix):\n if prefix == '':\n return True\n elif s[0] != prefix[0]:\n return False\n else: # s[0] == prefix[0]\n return starts_with(s[1:], prefix[1:])", "def starts_w...
[ "0.83619857", "0.80160236", "0.7839395", "0.782759", "0.77381086", "0.77381086", "0.7594189", "0.7528208", "0.74058926", "0.7379807", "0.7277057", "0.727268", "0.7236201", "0.7222695", "0.72225994", "0.71874356", "0.7143091", "0.71142554", "0.7009802", "0.6997398", "0.6966478...
0.7260305
12
Generates a dict of dicts from dot separated keys. Yet without associated values.
def make_tree(dot_separated_keys): tree = {} for item in dot_separated_keys: inside_tree = tree for part in item.split('.'): inside_tree = inside_tree.setdefault(part, {}) return tree
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def undotted_keys(dict):\n return {k.lstrip(\".\"): v for k, v in dict.items()}", "def hdict(keys, value, sep=\".\"):\n return reduce(lambda v, k: {k: v}, reversed(keys.split(sep)), value)", "def create_recursive_dot_dict(data: Dict[str, Any], cls=DotDict) -> Union[DotDict, DotDefaultDict]:\n res = cl...
[ "0.73150593", "0.666839", "0.6528275", "0.647951", "0.6416033", "0.639155", "0.6269472", "0.6193029", "0.6132605", "0.6059191", "0.5956652", "0.59102404", "0.5872739", "0.5800979", "0.57487774", "0.5689122", "0.5673279", "0.562703", "0.5615472", "0.5609791", "0.56088036", "...
0.73592526
0
get from nested dict
def get_from_dict(data_dict, map_list): return reduce(lambda d, k: d[k], map_list, data_dict)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_nested(nested_dict, field):\n print(nested_dict, field)\n keys = field.split('.')\n current = nested_dict\n for k in keys:\n print('key', k, 'current', current)\n # return None for nested fields without a value in this doc\n if isinstance(curren...
[ "0.7243689", "0.70014375", "0.68189776", "0.67736", "0.67402154", "0.67402154", "0.67254245", "0.66089696", "0.65266186", "0.650513", "0.65000695", "0.6375932", "0.63684773", "0.6340982", "0.6306014", "0.6139669", "0.60748714", "0.6065115", "0.60559213", "0.60281414", "0.6015...
0.0
-1
set in nested dict
def set_in_dict(data_dict, map_list, value): target = get_from_dict(data_dict, map_list[:-1]) if isinstance(target, dict): if len(target[map_list[-1]]) == 0 and isinstance(value, str): target[map_list[-1]] = value else: target[map_list[-1]]['value'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nested_set(dictionary: dict, keys: list, value):\n nested_dict = dictionary\n for key in keys[:-1]:\n nested_dict = nested_dict[key]\n nested_dict[keys[-1]] = value\n return dictionary", "def test_deep_set_create(self):\n mdict = copy.deepcopy(self.dict1)\n res = dictupdate.s...
[ "0.71018374", "0.70984405", "0.704741", "0.6844214", "0.64120656", "0.63191766", "0.62922853", "0.6158688", "0.61120975", "0.611104", "0.5974053", "0.5923545", "0.58683455", "0.57761884", "0.57549286", "0.5738851", "0.5720999", "0.5719014", "0.5687486", "0.5683523", "0.568260...
0.5194484
88
Flattens nested dicts into a single level dict.
def dict_path(my_dict, path=None): if path is None: path = "" for k, v in my_dict.items(): newpath = path + ("." if path != "" else "") + k if isinstance(v, dict): for u in dict_path(v, newpath): yield u else: yield newpath, v
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flatten_dict(d):\n def items():\n for key, value in d.items():\n if isinstance(value, dict):\n for subkey, subvalue in flatten_dict(value).items():\n yield subkey, subvalue\n else:\n yield key, value\n\...
[ "0.77844065", "0.7741226", "0.7617096", "0.75616306", "0.7490885", "0.74481535", "0.71848184", "0.7180198", "0.7081588", "0.7011167", "0.6980138", "0.6957304", "0.69023675", "0.6792159", "0.6791752", "0.6770507", "0.67688465", "0.676429", "0.67099506", "0.6697252", "0.6693222...
0.0
-1
Sum of the factorials of the digits of a number x
def factsum(x): return sum(list(map(lambda x: factorial(x), getdigits(x))))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def factorial_digit_sum(n):\n sum = 0\n factStr = str(factorial(n))\n for digit in factStr:\n sum += int(digit)\n return sum", "def Sum_Numbers_x_Power_Digits(x):\n totalSum = 0 \n for i in xrange(10, 999999):\n if i == sum([int(j)**x for j in str(i)]):\n totalSum +=...
[ "0.7923695", "0.75797725", "0.75408524", "0.7531802", "0.7449112", "0.73583555", "0.7314269", "0.7309004", "0.7186043", "0.7158655", "0.71404076", "0.7107824", "0.70873946", "0.70631707", "0.7045362", "0.7043718", "0.7035779", "0.70124704", "0.6972245", "0.6952173", "0.694104...
0.8542544
0
Show portfolio of stocks
def index(): user_id = session.get('user_id') table_name = f'stocks_user{user_id}' db.execute("CREATE TABLE IF NOT EXISTS ? (stock_symbol TEXT NOT NULL, shares NUMBER NOT NULL, price NUMBER NOT NULL, time TEXT NOT NULL)", table_name) money = db.execute("SELECT dinheiro FROM users WHERE id = ?", user_id...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index():\n stocks = []\n username = session.get(\"username\")\n symbol_list = db.execute(\"SELECT stock_symbol FROM history WHERE username=:username GROUP BY stock_symbol\", username=username)\n cash_balance = db.execute(\"SELECT cash FROM users WHERE username=:username\", username=username)[0][\"c...
[ "0.7349525", "0.7257509", "0.7092902", "0.70840114", "0.70700926", "0.70322937", "0.70166755", "0.6955458", "0.69515324", "0.6818638", "0.67683095", "0.6739686", "0.66745", "0.66665316", "0.6584005", "0.65794265", "0.6577333", "0.6556571", "0.65012944", "0.64815927", "0.64735...
0.67541313
11
Buy shares of stock
def buy(): if request.method == 'GET': return render_template('buy.html') elif request.method == 'POST': try: shares = int(request.form.get('shares')) except: return apology('Quantidade de ações não inteira') if shares < 0: return apology('Q...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def buy(self, ctx, name, shares: int):\n\t\tplural = 's' if shares != 1 else ''\n\t\tcurrency = await bank.get_currency_name(ctx.guild)\n\t\tif shares < 1:\n\t\t\tawait ctx.send('You cannot buy less than one share.')\n\t\t\treturn\n\t\tname = name.upper()\n\t\ttry:\n\t\t\tstock_data = await self._get_stock_d...
[ "0.75090504", "0.73669976", "0.719782", "0.7076133", "0.702035", "0.70142156", "0.69631433", "0.6943623", "0.6915625", "0.691014", "0.6897359", "0.68731195", "0.6865242", "0.68647367", "0.6850216", "0.6848369", "0.6818854", "0.67891747", "0.6722476", "0.6719868", "0.67188966"...
0.6677518
29
Show history of transactions
def history(): user_id = session.get('user_id') table_name = f'stocks_user{user_id}' rows = db.execute("SELECT * FROM ?", table_name) return render_template('history.html', rows=rows)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def history():\n transactions = db.execute(\"SELECT Symbol, Shares, Transacted FROM cash WHERE id=:id\", id=session[\"user_id\"])\n return render_template(\"history.html\", transactions=transactions)", "def history():\n\n #Query transactions by user id\n trans = Transactions.query.filter_by(owner=ses...
[ "0.82002884", "0.8140903", "0.8114919", "0.8042388", "0.8033679", "0.80168986", "0.79338187", "0.7822898", "0.77456313", "0.77341163", "0.7718728", "0.7716838", "0.7708978", "0.7628142", "0.7624304", "0.7530955", "0.74965966", "0.7481556", "0.74478734", "0.7423578", "0.738227...
0.7030488
39
Sell shares of stock
def sell(): if request.method == "GET": symbols = [] table_name = f"stocks_user{session.get('user_id')}" rows = db.execute('SELECT DISTINCT stock_symbol FROM ? WHERE NOT stock_symbol="DINHEIRO" GROUP BY stock_symbol HAVING SUM(shares) >= 1', table_name) for row in rows: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sell_stock(self, symbol):\n amount_to_sell = self.get_equity(symbol)\n chirp.order_sell_fractional_by_price(symbol, amount_to_sell)\n self.L.add_line('', symbol, 'SOLD', amount_to_sell)", "async def sell(self, ctx, name, shares: int):\n\t\tplural = 's' if shares != 1 else ''\n\t\tif shar...
[ "0.76451164", "0.748746", "0.7260813", "0.71164954", "0.7057435", "0.70490545", "0.70268077", "0.69872165", "0.6972749", "0.6966809", "0.6915586", "0.68977857", "0.68829334", "0.6849716", "0.68191767", "0.68124473", "0.68022114", "0.6801836", "0.67799073", "0.67698354", "0.67...
0.6277801
65
Clone a functional `Model` instance. Model cloning is similar to calling a model on new inputs, except that it creates new layers (and thus new weights) instead of sharing the weights of the existing layers. Arguments
def _clone_functional_model(model, input_tensors=None): if not isinstance(model, Model): raise ValueError('Expected `model` argument ' 'to be a `Model` instance, got ', model) if isinstance(model, Sequential): raise ValueError('Expected `model` argument ' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clone_model(model, input_tensors=None):\n if isinstance(model, Sequential):\n return _clone_sequential_model(model, input_tensors=input_tensors)\n else:\n return _clone_functional_model(model, input_tensors=input_tensors)", "def copy(self):\n new_model = Model(\n name=se...
[ "0.75288594", "0.71179146", "0.6991728", "0.69553876", "0.6682947", "0.66104007", "0.65559334", "0.64254403", "0.6322556", "0.6287403", "0.62824917", "0.6236048", "0.6216818", "0.6197873", "0.615267", "0.6146778", "0.6113265", "0.5923647", "0.5900907", "0.5888005", "0.5863508...
0.68227845
4
Clone a `Sequential` model instance. Model cloning is similar to calling a model on new inputs, except that it creates new layers (and thus new weights) instead of sharing the weights of the existing layers. Arguments
def _clone_sequential_model(model, input_tensors=None): if not isinstance(model, Sequential): raise ValueError('Expected `model` argument ' 'to be a `Sequential` model instance, ' 'but got:', model) def clone(layer): return layer.__class__.from_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clone_model(model, input_tensors=None):\n if isinstance(model, Sequential):\n return _clone_sequential_model(model, input_tensors=input_tensors)\n else:\n return _clone_functional_model(model, input_tensors=input_tensors)", "def clone(self):\n return _libsbml.Model_clone(self)", ...
[ "0.7385709", "0.66616267", "0.6578116", "0.6526493", "0.6467478", "0.62646365", "0.62586915", "0.6220581", "0.6103913", "0.60691476", "0.6056226", "0.6018872", "0.6015779", "0.6011683", "0.5961887", "0.5907166", "0.58924145", "0.5868687", "0.58646977", "0.584091", "0.58357793...
0.7651821
0
Clone any `Model` instance. Model cloning is similar to calling a model on new inputs, except that it creates new layers (and thus new weights) instead of sharing the weights of the existing layers. Arguments
def clone_model(model, input_tensors=None): if isinstance(model, Sequential): return _clone_sequential_model(model, input_tensors=input_tensors) else: return _clone_functional_model(model, input_tensors=input_tensors)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clone(self):\n return _libsbml.Model_clone(self)", "def clone(self):\n return _libsbml.ModelCreator_clone(self)", "def copy(self):\n new_model = Model(\n name=self.name,\n functions=copy.deepcopy(self.functions),\n domain=self.domain.copy(),\n ...
[ "0.7209398", "0.70578766", "0.6805522", "0.6779844", "0.6744178", "0.6651548", "0.66036665", "0.64693105", "0.6441572", "0.64124787", "0.6412031", "0.64043045", "0.63693136", "0.636181", "0.6343172", "0.6320473", "0.6242863", "0.6219034", "0.61284405", "0.6126675", "0.6014657...
0.7679161
0
Initialize the joystick components
def init(self): pygame.init() pygame.joystick.init() self.controller = pygame.joystick.Joystick(0) self.controller.init() self.x=0 self.y=0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n self.isMoving = 0#0 is stop, 1 is moving forward, -1 is moving backward\n self.isRoutating = False\n pygame.init()\n pygame.joystick.init()\n self.controller = pygame.joystick.Joystick(0)\n self.controller.init()\n if not self.axis_data:\n ...
[ "0.77946836", "0.7709619", "0.7708428", "0.7690953", "0.76627296", "0.7585769", "0.7510696", "0.7043306", "0.69623667", "0.68985695", "0.6756267", "0.67009485", "0.65528977", "0.6516639", "0.64917547", "0.63566685", "0.63212687", "0.6281358", "0.61667794", "0.612322", "0.6119...
0.82271236
0
Listen for events to happen
def listen(self): if not self.axis_data: self.axis_data = {} if not self.button_data: self.button_data = {} for i in range(self.controller.get_numbuttons()): self.button_data[i] = False if not self.hat_data: self.hat_data = {} ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def events(self):", "def handleEvents(self, events):\n pass", "def on_event(self, event):\n pass", "def on_event(self, event):\r\n pass", "def on_event(self, event):", "def listen(self):\n pass", "def event_receive(self,event):\n\n pass", "def handle_event(self, eve...
[ "0.76001936", "0.7514999", "0.736961", "0.73453784", "0.7160621", "0.70146126", "0.6963289", "0.6895858", "0.6895355", "0.6894317", "0.6875384", "0.6862019", "0.68443125", "0.6844133", "0.6816759", "0.669522", "0.6687219", "0.66471237", "0.65838945", "0.6572624", "0.65486026"...
0.63651896
29
Shift the colormap by dragging the cursor left or right. Stretch the colormap by dragging the cursor up or down.
def ms_contrast(self, viewer, event, data_x, data_y, msg=True): if not self.cancmap: return False event.accept() msg = self.settings.get('msg_contrast', msg) x, y = self.get_win_xy(viewer) if event.state == 'move': self._tweak_colormap(viewer, x, y, 'pre...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shift_cmap(cmap, start=0., locpoint=0.5, stop=1.0, name='centered'):\r\n\r\n # declare a colour + transparency dictionary\r\n cdict={'red':[], 'green':[], 'blue':[], 'alpha':[]}\r\n\r\n # regular index to compute the colors\r\n RegInd = np.linspace(start, stop, cmap.N)\r\n\r\n # shifted index to...
[ "0.5790858", "0.57863927", "0.5722508", "0.56208885", "0.5615264", "0.56151456", "0.54330593", "0.54213333", "0.52664816", "0.52410126", "0.5228845", "0.5213258", "0.520547", "0.5198562", "0.5171602", "0.5124414", "0.5097131", "0.5093487", "0.5091165", "0.5089418", "0.5084612...
0.58629936
0
An interactive way to restore the colormap contrast settings after a warp operation.
def ms_contrast_restore(self, viewer, event, data_x, data_y, msg=True): if not self.cancmap: return False event.accept() if event.state == 'down': self.restore_contrast(viewer, msg=msg)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ms_contrast(self, viewer, event, data_x, data_y, msg=True):\n if not self.cancmap:\n return False\n event.accept()\n msg = self.settings.get('msg_contrast', msg)\n\n x, y = self.get_win_xy(viewer)\n\n if event.state == 'move':\n self._tweak_colormap(view...
[ "0.63572615", "0.6100809", "0.5673598", "0.5571644", "0.55231154", "0.551467", "0.547287", "0.5454797", "0.5436428", "0.53191686", "0.52949184", "0.52944916", "0.52695817", "0.5267348", "0.5224302", "0.52170444", "0.5212828", "0.52027863", "0.5189108", "0.5177404", "0.5158237...
0.64222914
0
This decorator is meant to decorate management commands. Any exceptions raised in the command's handle method will be logged and reraised.
def log_exceptions(cls): class NewClass(cls): def handle(self, *args, **options): try: super().handle(args, options) except Exception: logger.exception("Management command '{}' failed. Traceback follows: ".format(sys.argv[1])) raise ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def command(login_required=True):\n def decorate(f):\n def wrapper(self, *args):\n try:\n return f(self, *args)\n except ApiError as e:\n log_exception(e)\n raise BackendException('dpbx api error \"%s\"' % (e,))\n except Except...
[ "0.5904763", "0.578845", "0.5735835", "0.56567407", "0.56270766", "0.5600731", "0.5581101", "0.5554357", "0.5539104", "0.55316645", "0.5529846", "0.55071104", "0.5505431", "0.5505338", "0.5483254", "0.54173476", "0.54166645", "0.53439975", "0.53280574", "0.5321739", "0.526793...
0.62160754
0