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
Reduces context of all Complexes to minimum.
def reduce_context(self) -> 'Rate': transformer = ContextReducer() expression = transformer.transform(self.expression) return Rate(expression)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_smallest_complexes(self) -> List[Tuple[KappaComplex, int]]:\n min_known_size = min(self._known_sizes)\n return self.get_complexes_of_size(min_known_size)", "def get_least_abundant_complexes(self) -> List[KappaComplex]:\n min_abundance = min(self.get_all_abundances())\n return ...
[ "0.6119291", "0.6031423", "0.5607511", "0.55700815", "0.5492319", "0.5463556", "0.5457767", "0.54454035", "0.543563", "0.54164594", "0.5412301", "0.5373754", "0.5321607", "0.5311642", "0.52633315", "0.5208375", "0.51787424", "0.51676995", "0.51125735", "0.5090753", "0.5062827...
0.0
-1
Extracts all agents (Complex objects) and params (strings) used in the rate expression.
def get_params_and_agents(self): transformer = Extractor() transformer.transform(self.expression) return transformer.agents, transformer.params
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_params(self, fluents):\n objects_all = set()\n for fluent in fluents:\n objects = fluent.replace(\"(\",\"\").replace(\")\",\"\").split(\" \")[1:]\n objects_all.update(objects)\n\n return objects_all", "def agency_parse(sents):\r\n agency_list = []\r\n for...
[ "0.5253063", "0.5249049", "0.51650333", "0.51618207", "0.5152103", "0.5011535", "0.4967004", "0.4956623", "0.49522108", "0.4817477", "0.4795467", "0.47801977", "0.4771185", "0.47636265", "0.47541422", "0.47347352", "0.47026265", "0.46918315", "0.46914902", "0.46741778", "0.46...
0.6133339
0
Evaluates all agents (Complex objects) and params (strings) used in the rate expression in the case of direct approach. If the result is nan, None is returned instead.
def evaluate_direct(self, values, params) -> float: evaluater = DirectEvaluater(values, params) result = evaluater.transform(self.expression) try: value = sympy.sympify("".join(tree_to_string(result))) if value == sympy.nan: return None return...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluate(self):\n pass", "def evaluate(self):\n pass", "def EvaluateFields(self, *float, **kwargs):\n ...", "def evaluate(self) :\n pass", "def evaluate_function_by_objective(self, trajectory):\n objective_values_by_tag = []\n reachability_cost = False\n\n ...
[ "0.5595017", "0.5595017", "0.5572122", "0.5567145", "0.5547694", "0.552319", "0.5486117", "0.5442064", "0.54177994", "0.539049", "0.53373986", "0.5336998", "0.5336864", "0.5332235", "0.5328134", "0.52732295", "0.52488637", "0.5232826", "0.52327096", "0.52302974", "0.52294415"...
0.53055304
15
Create mathML representation of the formula.
def to_mathML(self): transformer = MathMLtransformer() expression = transformer.transform(self.expression) return "".join(tree_to_string(expression))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test4():\r\n xmlstr = u\"\"\"\r\n<math xmlns=\"http://www.w3.org/1998/Math/MathML\">\r\n <mstyle displaystyle=\"true\">\r\n <mn>1</mn>\r\n <mo>+</mo>\r\n <mfrac>\r\n <mn>2</mn>\r\n <mi>α</mi>\r\n </mfrac>\r\n </mstyle>\r\n</math>\r\n\"\"\"\r\n return formula(xmlstr)", "def test6...
[ "0.7040604", "0.68138045", "0.65808046", "0.6574732", "0.65385926", "0.6472483", "0.6285012", "0.62663835", "0.624848", "0.62187535", "0.6161438", "0.61542505", "0.6119849", "0.61086386", "0.60873944", "0.60085154", "0.60085154", "0.59776056", "0.5968168", "0.5900165", "0.588...
0.7725084
0
Create list representation of the formula.
def get_formula_in_list(self): return tree_to_string(self.expression)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def formula(self):\n terms = []\n for ff in self.formulae:\n terms += list(ff.terms)\n return Formula(terms)", "def list_formulae():\n return _list_tindyb_unique_values(\"formula\", dbpath=__dbpath__)", "def _calculate_loss_formula(self) -> List[List[List[Tuple]]]:\n s...
[ "0.70437", "0.6676098", "0.6222351", "0.60658044", "0.60172814", "0.6002962", "0.5927992", "0.58624697", "0.5815177", "0.5806504", "0.5780762", "0.57806325", "0.57665807", "0.57629836", "0.57332253", "0.5726223", "0.5720341", "0.5717428", "0.56982076", "0.56982076", "0.569368...
0.69195604
1
Recursively constructs a list form given lark tree.
def tree_to_string(tree): if type(tree) == Tree: return sum(list(map(tree_to_string, tree.children)), []) else: return [str(tree)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def construct(lst):\n t = Tree()\n t.root = lst[0]\n for node in lst[1:]:\n if isinstance(node, list):\n t.nodes.append(construct(node))\n else:\n t.nodes.append(node)\n return t", "def make_list(sv, piece):\r\n li=[tree_build(sv,x) for x in piece.split(Comma)] ...
[ "0.67158437", "0.66619134", "0.65940225", "0.649871", "0.64617497", "0.6454553", "0.64528763", "0.63798577", "0.63287824", "0.632201", "0.63201743", "0.6317067", "0.6289", "0.61436146", "0.6093468", "0.6087679", "0.6087478", "0.6053852", "0.6047779", "0.6039747", "0.6035412",...
0.0
-1
initialize a bullet at the ship position
def __init__(self, ai_settings, screen, ship): super().__init__() self.screen = screen # create a bullet and set its position self.rect = pygame.Rect(0, 0, ai_settings.bullet_width, ai_settings.bullet_height) self.rect.centerx = ship.rect.centerx ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, screen, ship):\n\n super().__init__()\n self.__screen = screen\n self.__ship = ship\n\n # bullet settings | may need to add to settings.py if each bullet makes a new bullet object. This will save memory by making less variables.\n self.__speed = 10.0\n s...
[ "0.77932", "0.77842873", "0.7643124", "0.7577425", "0.738928", "0.7282866", "0.7248737", "0.72338456", "0.713622", "0.7041886", "0.70413834", "0.69640034", "0.69577575", "0.6927438", "0.69020337", "0.6869925", "0.6840654", "0.68373877", "0.6827241", "0.67168593", "0.67021334"...
0.7887299
0
move the bullet upwards
def update(self): # update the float of bullet position self.y -= self.speed_factor # update the bullet position self.rect.y = self.y
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_bullet_pos(self):\n # Update the decimal position of the bullet.\n self.pos_y -= self.settings.bullet1_speed\n self.rect.top = self.pos_y", "def update_bullet_pos(self):\n # Update the decimal position of the bullet.\n self.pos_y -= self.settings.bullet2_speed\n ...
[ "0.73199105", "0.7231336", "0.6895837", "0.6827588", "0.6774943", "0.6770926", "0.6653424", "0.6574085", "0.6552159", "0.65327686", "0.64986193", "0.6491107", "0.6428194", "0.6423173", "0.6421763", "0.64159346", "0.64154524", "0.64030284", "0.6394651", "0.63754565", "0.634941...
0.6888012
3
Viser info om meg
async def botinfo(self, ctx): dev = await self.bot.fetch_user(170506717140877312) start = perf_counter() status_msg = await ctx.send('Beregner ping...') end = perf_counter() ping = int((end - start) * 1000) now = time() diff = int(now - self.bot.uptime) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def info(self):", "def info(self):", "def getInfo():", "def info(self, id):", "def _get_information(self):\n pass", "def get_info(self):\n pass", "def get_info(self):\n pass", "def show_data():", "def info(self) -> dict:", "def details(self):\n pass", "def manage_inf...
[ "0.7681606", "0.7681606", "0.69845444", "0.69098634", "0.6718268", "0.6708727", "0.6708727", "0.66090536", "0.6582148", "0.657769", "0.6513253", "0.6495082", "0.64657295", "0.6443784", "0.6431578", "0.6430953", "0.6407326", "0.6392954", "0.63706625", "0.63679975", "0.635423",...
0.0
-1
Sender link til Githubrepoet mitt
async def github(self, ctx): embed = discord.Embed(color=ctx.me.color) embed.set_thumbnail(url='https://cdn2.iconfinder.com/data/icons/black-' + 'white-social-media/64/social_media_logo_github-512.png') embed.add_field(name='🔗 Github Repo', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def github(self, ctx):\n await ctx.send('https://github.com/nick411077/nickcan_bot')", "def repo_link(repo):\n return \"https://github.com/\" + repo", "async def source(self, context):\n await context.channel.send(\"https://github.com/balfroim/TengriBOT\")", "async def github(self, ctx...
[ "0.7776452", "0.737018", "0.7063419", "0.6954377", "0.67049956", "0.6670979", "0.66477937", "0.64880365", "0.6467927", "0.6422395", "0.63994116", "0.63923115", "0.6389984", "0.6355992", "0.635127", "0.6271208", "0.6271208", "0.62204945", "0.62057585", "0.6115133", "0.6003482"...
0.7178173
2
Constructor of the class Tache
def __init__(self, _nom_tache="TACHEDEFAUT", _stimulus=Stimulus(), _function=None): Tache.nbTaches += 1 self.__func = _function self.__idTache = Tache.nbTaches self.__nomTache = _nom_tache self.__stimulus = _stimulus
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n self.ts = dict()\n self.cache = dict()", "def __init__(self, *args, **kwargs):\n self._cachedict = {}", "def __init__(self, cache, userProjects, tagRefs, commitTimes):\n\n self.cache = cache\n self.userProjects = userProjects\n self.tagRefs = tagR...
[ "0.71995646", "0.71786976", "0.70298886", "0.68493026", "0.67856336", "0.6779868", "0.6748471", "0.67351925", "0.67340314", "0.6727003", "0.6598493", "0.65515083", "0.65515083", "0.65311223", "0.6524382", "0.65066725", "0.6480144", "0.64521736", "0.64465106", "0.643464", "0.6...
0.67324185
9
We set the adapted methods in the object's dict
def __init__(self, obj, **adapted_methods): self.obj = obj self.__dict__.update(adapted_methods) # 将传入的实例属性作为适配器实例的属性
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, obj, adapted_methods):\n self.obj = obj\n self.__dict__.update(adapted_methods)", "def __methodDict(cls, _dict):\n baseList = list(cls.__bases__)\n baseList.reverse()\n for _super in baseList:\n __methodDict(_super, _dict)\n for key, value in cls.__dict__.items...
[ "0.83028156", "0.6736908", "0.650515", "0.64653665", "0.6337329", "0.6337329", "0.6337329", "0.6337329", "0.6337329", "0.6337329", "0.6337329", "0.6337329", "0.6337329", "0.6337329", "0.6337329", "0.6337329", "0.6337329", "0.6337329", "0.6337329", "0.6337329", "0.6337329", ...
0.7568555
1
All nonadapted calls are passed to the object
def __getattr__(self, attr): return getattr(self.obj, attr)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __call__( self ):\n pass", "def call(self):", "def __call__(self) -> None:", "def __call__(self):\n pass", "def __call__(self):\n pass", "def __call__(object):", "def __call__():", "def __call__():", "def __call__():", "def __call__():", "def __call__():", "def __call...
[ "0.72711945", "0.7265775", "0.72646254", "0.7219443", "0.7219443", "0.7213859", "0.71618366", "0.71618366", "0.71618366", "0.71618366", "0.71618366", "0.7161092", "0.7132795", "0.7132795", "0.7062126", "0.6952468", "0.6952468", "0.69240236", "0.6910088", "0.6901853", "0.69018...
0.0
-1
Print original object dict
def original_dict(self): return self.obj.__dict__
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_dict(self):\n print(self.__dict__)", "def printDict(self):\n print str(self)", "def Print(self):\n print(self.__dict__)", "def pprint(self):\r\n for i in self.items():\r\n print '%s => %r'%i", "def print(self):\n for fiction in self.fictions:\n ...
[ "0.81039244", "0.7928267", "0.75055933", "0.72775966", "0.71687734", "0.7167941", "0.70204604", "0.701462", "0.6982115", "0.69817173", "0.6981234", "0.6974909", "0.6959087", "0.6904796", "0.6788721", "0.67790294", "0.67391604", "0.67391604", "0.67391604", "0.67391604", "0.673...
0.64691746
42
Create folder if not exists
def make_path(params): if not tf.gfile.IsDirectory(params.ckpt_path): tf.gfile.MakeDirs(params.ckpt_path) if not tf.gfile.IsDirectory(params.best_ckpt_path): tf.gfile.MakeDirs(params.best_ckpt_path) if not tf.gfile.IsDirectory(params.summary_path): tf.gfile.MakeDirs(params.summary_pa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_folder_if_needed(path):\n if os.path.exists(path):\n print(\"{} dir exists\".format(path))\n else:\n print(\"{} dir does not exist. Creating dir.\".format(path))\n os.mkdir(path)", "def create_folder(path):\n if not exists(path):\n os.makedirs(path)", "def create...
[ "0.839917", "0.8314251", "0.8284336", "0.82129306", "0.8205338", "0.8044191", "0.8008447", "0.8005006", "0.79709786", "0.7897332", "0.78906685", "0.78545344", "0.7853726", "0.7849216", "0.78312", "0.7830149", "0.7824551", "0.78047574", "0.77948636", "0.7780666", "0.7772629", ...
0.0
-1
keep last time map can save much time
def clean_map(params): if tf.gfile.IsDirectory(params.vocab_path): tf.gfile.DeleteRecursively(params.vocab_path) if tf.gfile.IsDirectory(params.map_path): tf.gfile.DeleteRecursively(params.map_path) if tf.gfile.IsDirectory(params.best_ckpt_path): tf.gfile.DeleteRecursively(params.b...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def after_map(self, map):\n return map", "def after_map(self, map):\n return map", "def __init__(self):\n self.timeMap = defaultdict(list)", "def __init__(self):\n self.timeMap = defaultdict(list)", "def stale(map): # accept map<string,string> or map<string,list<string>>\n\tout...
[ "0.6274521", "0.6274521", "0.6000038", "0.6000038", "0.58436203", "0.57533914", "0.57413876", "0.56934685", "0.56619656", "0.5640083", "0.5623771", "0.55563545", "0.55355686", "0.55107003", "0.54612994", "0.54510313", "0.5426962", "0.54065144", "0.54045147", "0.5393049", "0.5...
0.0
-1
Clean current folder remove saved model and training log
def clean(params): if tf.gfile.IsDirectory(params.ckpt_path): tf.gfile.DeleteRecursively(params.ckpt_path) if tf.gfile.IsDirectory(params.summary_path): tf.gfile.DeleteRecursively(params.summary_path) if tf.gfile.IsDirectory(params.result_path): tf.gfile.DeleteRecursively(params.re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_up(model_path):\n cmds = [\"rm */grad*.pickle\",\n \"rm -r checkpoints\",\n \"rm */train_len\",\n \"rm log_human_read.csv\",\n \"rm */log_human_read.csv\",\n \"rm -r best_model\",\n \"rm */*epoch*\"]\n\n for cmd in cmds:\n os....
[ "0.7986761", "0.7719925", "0.7650752", "0.7520142", "0.748151", "0.7369668", "0.7326532", "0.7320341", "0.7308131", "0.7151704", "0.70959884", "0.70773524", "0.6987387", "0.69840676", "0.6975859", "0.6966981", "0.693704", "0.6923056", "0.687396", "0.6856459", "0.6849965", "...
0.6657697
33
Print configuration of the model
def print_config(config, logger): for k, v in config.items(): logger.info("{}:\t{}".format(k.ljust(15), v))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_config(self):\n for key in self._config.keys():\n print('[{0}] = {1}'.format(key, self._config[key]))", "def printModel(self):\n print(self.model)", "def printConf(self):\n print \"\"\n for pname, pvalue in self.neededParams.items():\n print pname, pv...
[ "0.7598561", "0.74524343", "0.734406", "0.72353727", "0.7195053", "0.7124494", "0.7012736", "0.698722", "0.6967232", "0.68909913", "0.68780494", "0.6877497", "0.686473", "0.6863235", "0.68204504", "0.67671645", "0.67535436", "0.674394", "0.66530126", "0.66449505", "0.66265845...
0.0
-1
The neural network model with one hidden layer.
def neural_network_model(x, n_nodes_hl, n_classes): # Hidden layer matrices hl_matrices = {"weights": tf.Variable(tf.random_uniform([784, n_nodes_hl], minval=-0.05, maxval=0.05)), "biases": tf.Variable(tf.random_uniform([n_nodes_hl], minval=-0.05, maxval=0.05))} # Output layer matri...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_model_net(n_input,n_hidden,n_output):\n net = Sequential(\n L.Linear(n_input, n_hidden), F.relu,\n L.Linear(n_hidden, n_hidden), F.relu,\n L.Linear(n_hidden, n_output), F.softmax)\n return net", "def create_nn(self):\n\n\t\tmodel = Sequential()\n\t\tmodel.add(Dense(32, input...
[ "0.7211679", "0.71470755", "0.7054242", "0.69929737", "0.6988671", "0.6933414", "0.6921008", "0.69089603", "0.686062", "0.6843244", "0.68393046", "0.6826296", "0.68152255", "0.6812757", "0.6780413", "0.67704916", "0.67687154", "0.6755603", "0.6697389", "0.6694642", "0.6688012...
0.0
-1
Trains the neural network.
def train_neural_network(x, y, n_nodes_hl, n_classes, n_epochs, batch_size): # Tensorflow optimizer and cost functions. prediction = neural_network_model(x, n_nodes_hl, n_classes) cost = tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits(logits=prediction[0], labels=y)) optimizer = tf.train.Ad...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trainNet():", "def TrainNetwork(self):\n\n self.logger.info('Train Network')\n self.netWork.TrainGenerator()\n\n # # train NetworkLSTM\n self.logger.info('Train NetworkLSTM')\n self.netWork.TrainLSTM()", "def train(self):\n self.mode = \"train\"\n self.onlin...
[ "0.7527884", "0.7150889", "0.69635123", "0.69635123", "0.6892674", "0.68760604", "0.68242776", "0.6752093", "0.66884845", "0.6665273", "0.6627296", "0.6620287", "0.6611225", "0.6604066", "0.65999776", "0.65999776", "0.65999776", "0.65999776", "0.65999776", "0.6572592", "0.657...
0.0
-1
reads table 3 (the header table) Word Name Type Description 1 ACODE(C) I Device code + 10Approach code 2 TCODE(C) I Table code 92 3 UNDEF(3) None 6 DCYCLE I Design cycle number 7 ROBJ RS Objective value 8 RCON RS Critical constraint value 9 UNDEF None 10 NUMWDE I Number of words per entry in DATA record (always 2) 11 U...
def _read_onmd_3(self, data: bytes, ndata: int): op2 = self.op2 op2.to_nx('; found ONMD (normalized mass density) table') #self.log.info('OUG table 3') #self.show_data(data, types='ifs') #self.log.info('----------------------------') #self.show_ndata(400, types='if') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _read_onr1_3(self, data: bytes, ndata: int):\n op2 = self.op2\n op2._analysis_code_fmt = b'i'\n op2.words = [\n 'aCode', 'tCode', 'eTotal', 'isubcase',\n '???', '???', 'element_name', 'load_set',\n 'format_code', 'num_wide', 'cva...
[ "0.6097406", "0.6090162", "0.58685327", "0.58382773", "0.57640666", "0.57008547", "0.5666904", "0.5664526", "0.5606233", "0.56033313", "0.5600495", "0.55739087", "0.5550053", "0.55278754", "0.5525435", "0.54984826", "0.54799986", "0.54679996", "0.5458644", "0.5425266", "0.540...
0.6139688
0
Word Name Type Description 1 EKEY I Device code + 10Element ID 2 VALUE RS Scalar value for element
def _read_onmd_4(self, data: bytes, ndata: int) -> int: if not data: return ndata op2 = self.op2 fdata = np.frombuffer(data, dtype=op2.fdtype8) idata = np.frombuffer(data, dtype=op2.idtype8) ndata = len(idata) #op2.log.warning(f'ndata={ndata}') eids =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def elements_sequence(cls):\n return [\n \"id\",\n \"extension\",\n \"modifierExtension\",\n \"type\",\n \"valueCodeableConcept\",\n \"valueString\",\n \"valueQuantity\",\n \"valueBase64Binary\",\n \"valueAtta...
[ "0.5626488", "0.5534891", "0.54946643", "0.544739", "0.5442132", "0.5379591", "0.53028905", "0.523074", "0.5208798", "0.5206778", "0.51697093", "0.514954", "0.51239896", "0.50785905", "0.5072233", "0.500107", "0.49955285", "0.49754468", "0.49752715", "0.49513328", "0.49442762...
0.0
-1
False means that gps is already enabled
def enable_gps(self): # No need to use as I have enabled GPS on start self.pass_command(b"AT+CGPS=1") return self.read_output()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_gps(self):\n row_type = self.get_type()\n is_gps = row_type in ('hidden geopoint', 'geopoint')\n return is_gps", "def is_opgepakt(self) -> bool:\n return not GPIO.input(self._afstandsensor_input_pin)", "def is_on(self):\n return False", "def disable_gps(self):\n ...
[ "0.66482323", "0.6637851", "0.65072066", "0.6449804", "0.6438032", "0.6392123", "0.6270508", "0.6245589", "0.6098313", "0.608869", "0.60436463", "0.6031218", "0.60095996", "0.5978279", "0.5975354", "0.5967209", "0.5967209", "0.5895945", "0.5873593", "0.5867402", "0.58629614",...
0.70518
0
False means that gps is already disabled
def disable_gps(self): self.pass_command(b"AT+CGPS=0,1") return self.read_output()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _isdisable(self):\n return self.dp.state()==PyTango.DevState.DISABLE", "def is_opgepakt(self) -> bool:\n return not GPIO.input(self._afstandsensor_input_pin)", "def enable_gps(self):\n # No need to use as I have enabled GPS on start\n self.pass_command(b\"AT+CGPS=1\")\n r...
[ "0.6694648", "0.6677886", "0.66372824", "0.6571751", "0.65400213", "0.649015", "0.6470005", "0.63290757", "0.6236902", "0.62049824", "0.62049824", "0.619324", "0.6179001", "0.6176285", "0.6136987", "0.6122205", "0.60925853", "0.6070729", "0.60671014", "0.604607", "0.6012523",...
0.69180495
0
Takes in RGB channels in range 0255 and outputs L or AB channels in range 1 to 1
def rgb_to_lab(img, l=False, ab=False): img = img / 255 l_chan = color.rgb2lab(img)[:, :, 0] l_chan = l_chan / 50 - 1 l_chan = l_chan[..., np.newaxis] ab_chan = color.rgb2lab(img)[:, :, 1:] ab_chan = (ab_chan + 128) / 255 * 2 - 1 if l: return l_chan else: return ab_chan
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lab_to_rgb(img_l, img_ab):\n lab = np.empty([*img_l.shape[0:2], 3])\n lab[:, :, 0] = np.squeeze(((img_l + 1) * 50))\n lab[:, :, 1:] = img_ab * 127\n return color.lab2rgb(lab)", "def convert_rgb_cmyk(rcol, gcol, bcol):\n if (rcol == 0) and (gcol == 0) and (bcol == 0):\n # black\n ...
[ "0.67191994", "0.67153925", "0.66415703", "0.65657836", "0.6533678", "0.6436578", "0.6332531", "0.63095754", "0.6278812", "0.62779766", "0.6174344", "0.6166381", "0.6164907", "0.6087721", "0.6085063", "0.60826355", "0.60440445", "0.6035109", "0.6034019", "0.6017981", "0.59934...
0.716853
0
Takes in LAB channels in range 1 to 1 and out puts RGB chanels in range 0255
def lab_to_rgb(img): new_img = np.zeros((256, 256, 3)) for i in range(len(img)): for j in range(len(img[i])): pix = img[i, j] new_img[i, j] = [(pix[0] + 1) * 50, (pix[1] + 1) / 2 * 255 - 128, (pix[2] + 1) / 2 * 255 - 128] new_img = color.lab2rgb(new_img) * 255 new_img = n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reduceColorRGB(channels,levels):\n data = (levels[2]*levels[1]*reduceColor(channels[0],levels[0])+\n levels[2]*reduceColor(channels[1],levels[1])+\n reduceColor(channels[2],levels[2])).astype(numpy.uint8)\n return data", "def rgb_to_lab(img, l=False, ab=False):\n img = img / 255\n l...
[ "0.68408406", "0.67221797", "0.6714735", "0.6651634", "0.6607305", "0.6541594", "0.6485886", "0.64274514", "0.63758796", "0.6362413", "0.6348317", "0.63105035", "0.62985694", "0.6281686", "0.6277677", "0.6239145", "0.6237213", "0.6224802", "0.6211154", "0.62056774", "0.618310...
0.6652208
3
store datetime in UTC epoch format
def db_datetime_utc(): t = datetime.datetime.utcnow() return time.mktime(t.timetuple())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def epoch():\n return datetime2epoch(datetime.now())", "def epoch(value):\n if isinstance(value, datetime.datetime):\n return int(calendar.timegm(value.timetuple())*1000)\n return '' #fails silently for non-datetime objects", "def datetime_to_epoch(datetime):\n return datetime.astype('int64'...
[ "0.74502915", "0.686895", "0.68666095", "0.6809088", "0.6774451", "0.67364866", "0.6691477", "0.6643883", "0.6598432", "0.65243083", "0.6441225", "0.6385608", "0.63715297", "0.6363587", "0.63558376", "0.6350722", "0.63506216", "0.6325994", "0.61974716", "0.6189022", "0.615355...
0.6269311
18
main cli entry point
def main(): print("dt.py usage:") utc = db_datetime_utc() print("\tdb_datetime_utc={}".format(utc)) strf = dt_datetime_strf() print("\tdb_datetime_strf={}".format(strf)) cd = fn_current_day() print("\tfn_current_day={}".format(cd))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n\tcli = Cli()\n\tcli.run()", "def main_cli():\n pass", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", ...
[ "0.8972725", "0.8866627", "0.8810281", "0.8810281", "0.8810281", "0.8810281", "0.8810281", "0.8810281", "0.8810281", "0.8810281", "0.8810281", "0.8810281", "0.8810281", "0.8810281", "0.8810281", "0.8810281", "0.8810281", "0.8810281", "0.8810281", "0.8810281", "0.8810281", "...
0.0
-1
Given an output file and compression options, write file to disk
def output(df, output_filename, compression="gzip", float_format=None): # Extract suffixes from the provided output file name filename, output_file_extension = os.path.splitext(output_filename) basefilename, non_compression_suffix = os.path.splitext(filename) # if no additional suffix was provided, ma...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compress(file, output, pw):\n try:\n bsc.compress_file(file, output, pw)\n print(Fore.GREEN + \"Compressed!\")\n except bsc.FrequencyOverflowException as err:\n print(err)\n except FileNotFoundError:\n print(Fore.RED + \"File not found!\")", "def Compress(input_filename, ...
[ "0.7134721", "0.7027491", "0.6610347", "0.6610347", "0.6465897", "0.63750476", "0.62212956", "0.6198638", "0.61960495", "0.61619914", "0.6149801", "0.61246526", "0.61099565", "0.60955524", "0.6076622", "0.6051214", "0.5991834", "0.59752506", "0.5943372", "0.5928858", "0.59076...
0.60654646
15
Determine the compression suffix
def infer_compression_suffix(compression="gzip"): assert ( compression in compress_options ), "{} is not supported, select one of {}".format( compression, list(compress_options.keys()) ) return compress_options[compression]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def suffix(self):\n return self[\"suffix\"]", "def suffix(self):\n return self[\"suffix\"]", "def suffix(self):\n return self._suffix", "def suffix(self):\n return self._suffix", "def suffix(self):\n return self._suffix", "def suffix ( self ) :\n return self.__su...
[ "0.6995122", "0.6995122", "0.6859668", "0.6859668", "0.6859668", "0.67904246", "0.67904246", "0.6689125", "0.66733366", "0.66489536", "0.6596177", "0.65468204", "0.6513631", "0.64851665", "0.6457852", "0.6457852", "0.6415643", "0.63191026", "0.6309062", "0.62950456", "0.61675...
0.78440577
0
Fit the model according to the given training data.
def fit(self, events: list, start=None): self._set('events', events) solver_obj = self._solver_obj model_obj = self._model_obj prox_obj = self._prox_obj # Pass the data to the model model_obj.fit(events) if self.step is None and self.solver in self._solvers_wit...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fit_training_data(self):\n self.model.fit(self.X_train)", "def train(self):\n\t\tself.model.fit(self.training_data, self.training_labels)", "def training(self):\n self.model.fit(self.train_x, self.train_y)", "def train(self, X_train, y_train):\n self.model.fit(X_train, y_train)", "...
[ "0.87955", "0.7953466", "0.7792826", "0.7765608", "0.7679195", "0.762431", "0.76024294", "0.7547753", "0.7518371", "0.7514943", "0.75139296", "0.75036854", "0.748743", "0.7479465", "0.741489", "0.7385917", "0.73583084", "0.7349582", "0.7334411", "0.73242617", "0.7324089", "...
0.0
-1
Create simulation object corresponding to the obtained coefficients
def _corresponding_simu(self): return SimuHawkes()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, coefficients):\n self.coefficients = coefficients", "def make_simulation(self):\n pass", "def make_simulations(self):\n pass", "def __init__(self, coefficients):\n \n if not isinstance(coefficients, list):\n raise TypeError(\"The coefficients v...
[ "0.69219035", "0.6558183", "0.6466944", "0.6050808", "0.5955769", "0.5922877", "0.58697486", "0.5864651", "0.58437353", "0.58185834", "0.58093745", "0.574187", "0.5736761", "0.570849", "0.56900716", "0.56668264", "0.56579447", "0.56499606", "0.56372267", "0.56255627", "0.5610...
0.0
-1
Computes kernel support. This makes our learner compliant with `tick.plot.plot_hawkes_kernels` API Returns
def get_kernel_supports(self): corresponding_simu = self._corresponding_simu() get_support = np.vectorize(lambda kernel: kernel.get_plot_support()) return get_support(corresponding_simu.kernels)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gpu_kernels(self, node, name):\r\n raise MethodNotDefined, 'gpu_kernels'", "def formK(x, y, kernel, cl):\n\n if kernel == 'se':\n k = lambda x,y: np.exp(-np.sum((x-y)**2)/2/cl**2)\n else:\n raise('Kernel %s not implemented' %(kernel))\n\n # form kernel matrix\n K = np.zeros((...
[ "0.6564831", "0.6482929", "0.64802843", "0.6396336", "0.6385014", "0.62651604", "0.6261421", "0.62435037", "0.624171", "0.61984396", "0.6155663", "0.61529", "0.6150613", "0.61215353", "0.6043905", "0.59859765", "0.5958535", "0.5947641", "0.5934029", "0.58887225", "0.58817625"...
0.59870625
15
Computes value of the specified kernel on given time values. This makes our learner compliant with `tick.plot.plot_hawkes_kernels` API
def get_kernel_values(self, i, j, abscissa_array): corresponding_simu = self._corresponding_simu() return corresponding_simu.kernels[i, j].get_values(abscissa_array)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _calc_kernel(self,\n freq_1: float,\n time_1: float,\n freq_2: float,\n time_2: float,\n dagg: tuple\n ) -> Tuple[ndarray, ndarray]:\n dt = self._process_tensor.dt\n #pieces of kernel...
[ "0.6388916", "0.6330207", "0.56808645", "0.5654577", "0.5581339", "0.5574208", "0.551221", "0.5440041", "0.5423327", "0.5355884", "0.52963275", "0.52958703", "0.5261591", "0.52035165", "0.5201529", "0.5200069", "0.5192944", "0.516031", "0.5128376", "0.511491", "0.5091666", ...
0.46586925
78
Computes kernel norms. This makes our learner compliant with `tick.plot.plot_hawkes_kernel_norms` API Returns
def get_kernel_norms(self): corresponding_simu = self._corresponding_simu() get_norm = np.vectorize(lambda kernel: kernel.get_norm()) return get_norm(corresponding_simu.kernels)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_kernel_norms(self):\n return self.adjacency", "def get_kernel_norms(self):\n return np.einsum('ijk->ij', self.amplitudes)", "def test():\n\n S = \"cells interlinked within cells interlinked\"\n T = \"within one stem and dreadfully distinct\"\n\n n = 2\n\n res = kernel(S, T, n)...
[ "0.72033006", "0.71901053", "0.615906", "0.6152614", "0.61227655", "0.61149186", "0.6101243", "0.60550433", "0.5833572", "0.5711156", "0.56671685", "0.56479853", "0.56010073", "0.5600019", "0.5600019", "0.55914766", "0.55762804", "0.5554799", "0.5539362", "0.55378884", "0.553...
0.711052
2
Compute score metric Score metric is log likelihood (the higher the better)
def score(self, events=None, end_times=None, coeffs=None): if events is None and not self._fitted: raise ValueError('You must either call `fit` before `score` or ' 'provide events') if coeffs is None: coeffs = self.coeffs if events is None a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_prob(self):", "def score(self, x, y=None):\n _, logp = self.score_samples(x)\n return logp", "def score(self, beam, logprobs):\n l_term = (((5 + len(beam.next_ys)) ** self.alpha) /\n ((5 + 1) ** self.alpha))\n return (logprobs / l_term)", "def logscore(sel...
[ "0.722884", "0.7096571", "0.6938812", "0.6919234", "0.68211555", "0.6802226", "0.680218", "0.6750187", "0.6743597", "0.67397064", "0.6718507", "0.6699917", "0.6673711", "0.6671561", "0.6669158", "0.6654119", "0.6653458", "0.6634947", "0.6624184", "0.6601385", "0.65951353", ...
0.0
-1
Value of intensity for a given realization with the fitted parameters
def estimated_intensity(self, events, intensity_track_step, end_time=None): if end_time is None: end_time = max(map(max, events)) simu = self._corresponding_simu() if intensity_track_step is not None: simu.track_intensity(intensity_track_step) simu.set_timestamp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def intensity(self) -> int:", "def intensity(self, value: int, /) -> None:", "def getIntensity(self):\n return self.getIntensityS() + self.getIntensityP()", "def getIntensity(self):\n return self.__intensity", "def intensity(self):\n LP = 1/np.sin(self.theta)**2/np.cos(self.theta)\n ...
[ "0.6636768", "0.6183384", "0.6173297", "0.6115786", "0.5891476", "0.58635974", "0.58545965", "0.5784298", "0.5761945", "0.5739829", "0.5737823", "0.56942713", "0.56911516", "0.56644094", "0.56120694", "0.5605097", "0.5585079", "0.55465746", "0.5526246", "0.551104", "0.5495735...
0.0
-1
Plot value of intensity for a given realization with the fitted
def plot_estimated_intensity(self, events, n_points=10000, plot_nodes=None, t_min=None, t_max=None, intensity_track_step=None, max_jumps=None, show=True, ax=None): simu = self._corresponding_simu() end_ti...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _plot(self):\r\n fig = plt.figure()\r\n\r\n # Take out second component of intensity if needed\r\n # if self._vna.isTwoComponents():\r\n # intensitySimplified = []\r\n # for i in range(len(self._intensity)):\r\n # tempSet = []\r\n # for j...
[ "0.6529947", "0.64933544", "0.6456019", "0.6423909", "0.62990135", "0.62622476", "0.6248921", "0.6150295", "0.6139854", "0.60945123", "0.6066144", "0.6061456", "0.60362685", "0.60311174", "0.6025191", "0.60246885", "0.60145164", "0.59960985", "0.598568", "0.5981324", "0.59775...
0.0
-1
Plot theoretical vs. empirical quantile of residuals
def qq_plots(self, events, end_time=None, **kwargs): simu = self._corresponding_simu() simu.set_timestamps(events, end_time=end_time) simu.store_compensator_values() return qq_plots(simu, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _plot_resid_vs_fitted(self, ax):\n\n res = self._model.fit()\n\n ax.plot(res.fittedvalues, res.resid, '.')\n ax.set_xlabel('Fitted ' + self._model.endog_names)\n ax.set_ylabel('Raw residual')\n plt.sca(ax)\n plt.axhline(color='k')", "def plotFittingResults(self):\n ...
[ "0.6489327", "0.6356597", "0.622481", "0.60979027", "0.59710073", "0.59438384", "0.5937397", "0.59337354", "0.59327924", "0.59215456", "0.5918136", "0.5911047", "0.5873584", "0.58607835", "0.58454406", "0.5817905", "0.5813889", "0.58001107", "0.57914937", "0.5779851", "0.5772...
0.0
-1
Every handshake divides the circle in to two more circles and so on. Let n = 8 So if a 5 shakes hand with 8 (5>6>7>8) it is 4th counting from 5 so i = 4, the circle gets divides in to the following i2 = 2(6>7) ni = 4 = (1>2>3>4) We memoize the solution for performance
def sol(n, mem): if mem[n] != -1: return mem[n] mem[n] = 0 for i in range(2, n+1): mem[n]+=sol(n-i, mem)*sol(i-2, mem) return mem[n]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getDivisors(n):", "def solve(n: int) -> None:\n count_triangles = 3 * n * n\n for x in range(1, n+1):\n for y in range(1, x+1):\n xy_gcd = gcd(x, y)\n move_x, move_y = x // xy_gcd, y // xy_gcd\n i = 1\n while y + i * move_x <= n and x - i * move_y >= 0...
[ "0.67083746", "0.6673296", "0.63833743", "0.6354389", "0.6299994", "0.6280611", "0.62785286", "0.6276249", "0.62576723", "0.62553996", "0.6235217", "0.622077", "0.620637", "0.61726683", "0.61644036", "0.61642444", "0.61611503", "0.61533004", "0.6144103", "0.61411136", "0.6136...
0.0
-1
Creates schema for Landslide Risk Knowledge Base in PostgreSQL/PostGIS.
def create_schema(schema): query = "CREATE SCHEMA IF NOT EXISTS {}".format(schema) qdb.execute(query)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_psql_schema():\n conn = connect_to_postgres()\n if conn is None:\n return\n\n cur = conn.cursor()\n try:\n create_scheme_command = \"\"\"\n CREATE TABLE IF NOT EXISTS article\n (\n ...
[ "0.6998833", "0.6590307", "0.6436303", "0.64080447", "0.63747925", "0.6283197", "0.626637", "0.62587404", "0.62334406", "0.62318414", "0.6173199", "0.6170685", "0.61540276", "0.61532134", "0.60995585", "0.60993516", "0.6079929", "0.6060911", "0.60438967", "0.60190845", "0.600...
0.62892795
5
Creates tables for Landslide Risk Knowledge Base in PostgreSQL/PostGIS.
def create_tables(): pk_contraint = "CONSTRAINT {}_pk PRIMARY KEY ({})" uq_contraint = "CONSTRAINT {}_uq UNIQUE ({})" fk_query = """CONSTRAINT {}_fk_{} FOREIGN KEY ({}) REFERENCES {}({}) ON UPDATE CASCADE O...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_tables(self):\n try:\n self.cursor.execute('CREATE SCHEMA sandbox')\n self.cursor.execute(\"DROP TABLE sandbox.dvds_rdbhdb_super;\")\n except (db.ProgrammingError, db.OperationalError), e:\n # sandbox may not exist\n pass #raise\n\n try:\n ...
[ "0.69526476", "0.69389075", "0.6879835", "0.67891175", "0.6712477", "0.6712477", "0.6628316", "0.6614976", "0.65785325", "0.65687066", "0.6565796", "0.65031064", "0.6483932", "0.6443893", "0.64278096", "0.6412687", "0.6409078", "0.63635635", "0.6348073", "0.628319", "0.628109...
0.70119447
0
Initialize a DNN. model_source file name of a model file to load, or a function that will return a keras model to be trained train_log_dir directory for training logs and intermediate files
def __init__(self, model_source = None, train_log_dir = None, name = "DNN2", auto_reload = False, only_final=False, denorm_out=True): super().__init__(name = name) self.model_source = model_source self.train_log_dir = train_log_dir self.feat_in_pipe_out, self.feat_in_pipe_in = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, targetDir, model):\n \n self.categoryFolder = targetDir\n self.model = model\n self.inputsFolder = os.path.join(targetDir, \"Inputs\")", "def load_model(cls, src_path, update_dict=None, steps=None):\n\n if steps is not None:\n json_file, _ = cls.ge...
[ "0.6362834", "0.63515884", "0.63212436", "0.625038", "0.61283296", "0.6118939", "0.61186624", "0.60846287", "0.60359854", "0.60246474", "0.6009134", "0.60089713", "0.5996532", "0.5990211", "0.59882444", "0.59662604", "0.59622073", "0.59598315", "0.59585315", "0.5947967", "0.5...
0.5668142
96
Trains for some epochs with some data
def train_network(self, data_x, data_y, optimizer_generator, num_epochs, batch_size, out_name, validation_split = 0.05, shuffle_data = True, loss="mse", metrics=None, center_out=True): training_process = multiprocessing.Process(target = self.train_network_process, args = (data_x, data_y, optimizer_generator, n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train(self, training_steps=10):", "def train_epoch(self, data_loader):\n raise NotImplementedError", "def _train_epoch(self, epoch):\n raise NotImplementedError", "def _train_epoch(self, epoch):\n raise NotImplementedError", "def _train_epoch(self, epoch):\n raise NotImpleme...
[ "0.7421083", "0.72503704", "0.71853274", "0.71853274", "0.71853274", "0.71853274", "0.71786654", "0.7167705", "0.70247066", "0.69450295", "0.69341606", "0.6913916", "0.68984646", "0.68733895", "0.6860187", "0.6858657", "0.6849496", "0.684491", "0.6843367", "0.6834051", "0.680...
0.0
-1
Trains the neural network. Parameters as in train_network
def train_network_process(self, data_x, data_y, optimizer_generator, num_epochs, batch_size, out_name, validation_split, shuffle_data, loss, metrics, center_out): import keras sys.stdout.flush() keras.backend.clear_session() sys.stdout.flush() # Load data train_data_in =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trainNet():", "def TrainNetwork(self):\n\n self.logger.info('Train Network')\n self.netWork.TrainGenerator()\n\n # # train NetworkLSTM\n self.logger.info('Train NetworkLSTM')\n self.netWork.TrainLSTM()", "def train_network(self):\n if self.trainData:\n i...
[ "0.81060195", "0.747009", "0.7258935", "0.72525483", "0.71911377", "0.718061", "0.718061", "0.7148891", "0.71361077", "0.71147525", "0.71140075", "0.7111254", "0.710922", "0.70586425", "0.7049106", "0.69973314", "0.6972276", "0.6972017", "0.6955216", "0.6938607", "0.6917167",...
0.0
-1
Trains the neural network. Parameters as in train_network
def train_maml(self, data_x, data_y, num_epochs, batch_size, out_name, lr_inner=0.01, log_steps=10): import tensorflow.keras as keras import tensorflow as tf import tensorflow.keras.backend as keras_backend import tempfile sys.stdout.flush() keras.backend.clear_s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trainNet():", "def TrainNetwork(self):\n\n self.logger.info('Train Network')\n self.netWork.TrainGenerator()\n\n # # train NetworkLSTM\n self.logger.info('Train NetworkLSTM')\n self.netWork.TrainLSTM()", "def train_network(self):\n if self.trainData:\n i...
[ "0.8105004", "0.7470511", "0.72590005", "0.72526705", "0.71902615", "0.7179189", "0.7179189", "0.7148377", "0.7135859", "0.71139663", "0.7112437", "0.7110073", "0.7109289", "0.70583564", "0.7047075", "0.6995485", "0.6970446", "0.69699377", "0.69544107", "0.69377553", "0.69153...
0.0
-1
Add data for decoding. Expected to have two dimensions.
def add_data(self, sample, data_id): sample = np.array(sample) if len(sample.shape) == 1: sample = sample.reshape(1, -1) self.feat_in_pipe_in.send(sample)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_data(self, data: np.ndarray):\n data = np.asarray(data)\n if data.ndim < 2:\n data = np.reshape(data, (-1, 1))\n\n self.create_storage(data)\n\n start = self._count\n finish = start + data.shape[0]\n self._data_store[start:finish, :] = data\n self._count += data.shape[0]", "def ...
[ "0.6536552", "0.6380621", "0.6368467", "0.6342112", "0.6320028", "0.6228011", "0.61977476", "0.6171592", "0.6133006", "0.6060495", "0.60330445", "0.6025808", "0.59899604", "0.5944065", "0.5923346", "0.5881405", "0.58508235", "0.58386886", "0.58261424", "0.5821282", "0.5797207...
0.56253105
25
Decodes frames and calls callbacks. At this point, model_source MUST be a loadable model
def mapping_runner(self): if not isinstance(self.model_source, str): raise ValueError("Tried to initialize mapping without a model") import keras sys.stdout.flush() keras.backend.clear_session() sys.stdout.flush() # Load model and normalizati...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_model(self, model_as_bytes: bytes) -> None:\n\n self.model = deserialize_from_zippy(model_as_bytes)", "def __load_model(self):\n loaded = load(self.__file_name)\n self.__model = loaded['model']\n self.__meta_data = loaded['metadata']\n self.__is_ready = True", "def l...
[ "0.5550051", "0.5520263", "0.551401", "0.54961157", "0.53745514", "0.53572786", "0.53572786", "0.53572786", "0.53572786", "0.53572786", "0.5355477", "0.5319443", "0.52494776", "0.52464616", "0.52464616", "0.5232727", "0.521921", "0.52057505", "0.51978254", "0.51830053", "0.51...
0.0
-1
Starts the decode process. train_mode has to be False to work.
def start_processing(self,recurse = True): if isinstance(self.model_source, str) and self.auto_reload: self.observer = ChangeWatcher(self.model_source) if self.mapping_process is None: self.run_map.value = True self.mapping_process = multiprocessing.Proce...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main(_):\n if FLAGS.decode != True:\n train()\n else:\n decode()", "def main(_):\n if not FLAGS.model_output_dir:\n raise ValueError(\n \"Undefined model output directory. Perhaps you forgot to set the --model_output_dir flag?\")\n \n if FLAGS.predict_input_file:\n decode()\...
[ "0.7725265", "0.6384868", "0.6331278", "0.62350583", "0.60470456", "0.58639306", "0.58612585", "0.57990646", "0.5696625", "0.55798745", "0.5493353", "0.5447467", "0.5445721", "0.54333603", "0.54184794", "0.5416709", "0.53970784", "0.5383735", "0.53531295", "0.5348048", "0.530...
0.0
-1
Stops the streaming process.
def stop_processing(self, recurse = True): super(DNN2, self).stop_processing(recurse) self.run_map.value = False if not self.mapping_process is None: # TODO sleep before murdering? self.mapping_process.terminate() self.mapping_process = None self.observer.stop() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stop(self):\n\t\tself.stream.stop_stream()", "def stop(self) -> None:\n self._stream.stop()", "def stop(self):\n self.stream.stop()\n self.running = False", "def stop_stream(self):\n pass", "def stop(self) -> None:\n self._stream.stop()", "def stopit(self):\n\n s...
[ "0.8439762", "0.8314608", "0.8238226", "0.8197213", "0.8136831", "0.77132726", "0.7639274", "0.7424965", "0.7239872", "0.7136373", "0.7054585", "0.7023677", "0.7021964", "0.6992744", "0.6950485", "0.6931976", "0.6930318", "0.69293743", "0.69258755", "0.6904613", "0.6896755", ...
0.0
-1
Estimate the directional derivative of a function of n variables. Uses the derivest method to provide both a directional derivative and an error estimate.
def directional_diff(fun, x, d, par = None, normalize = True, **kwargs): ##### PROCESS ARGUMENTS AND CHECK FOR VALIDITY ##### if kwargs.pop("deriv_order", 1) != 1: raise ValueError("directional_diff() can only perform " "first-order differentiation.") if kwargs.pop("vectoriz...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deriv(func, x, n=1, accuracy=0.0001, scaledown=1.25):\n n = int(n)\n if n <= 0:\n return func(x)\n else:\n return (deriv(func, x+accuracy, n-1, accuracy/scaledown, scaledown) - deriv(func, x, n-1, accuracy/scaledown, scaledown))/accuracy", "def test_directional_derivative(Objective, n)...
[ "0.71255857", "0.6946232", "0.68868744", "0.6877534", "0.6785127", "0.6599836", "0.63840693", "0.63807213", "0.614829", "0.60685265", "0.6025779", "0.6010709", "0.59734213", "0.59716225", "0.5969954", "0.59699386", "0.5964786", "0.5947285", "0.5928678", "0.5908682", "0.590868...
0.6490981
6
Calculate the logarithm of the Bayesian odds between models given a set of
def results_odds(results, oddstype="svn", scale="log10", **kwargs): if not isinstance(results, (str, Path, Result, dict)): raise TypeError("result must be a Result object or list of Result objects") if isinstance(results, Result): log10odds = results.log_10_evidence - results.log_10_noise_evid...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_prob(sentence, LM, smoothing=False, delta=0, vocabSize=0):\n word_list = sentence.split()\n log_prob = 0\n for i in range(len(word_list)-1):\n print(word_list[i], word_list[i+1])\n bi_count = LM['bi'][word_list[i]][word_list[i+1]]\n uni_count = LM['uni'][word_list[i]]\n ...
[ "0.64511937", "0.6265722", "0.61491966", "0.614309", "0.6135894", "0.6110079", "0.6082511", "0.60700923", "0.60603815", "0.5995703", "0.5903459", "0.58957595", "0.5887003", "0.58763105", "0.5876064", "0.5863208", "0.5853799", "0.5849781", "0.58410615", "0.58221054", "0.580939...
0.0
-1
Calculate the optimal matched filter signaltonoise ratio for a signal in given data based on the posterior samples. This can either be the signaltonoise ratio for the maximum aposteriori sample or for the maximum likelihood sample.
def optimal_snr(res, het, par=None, det=None, which="posterior", remove_outliers=False): # get posterior results files if isinstance(res, (str, Path)): if Path(res).is_dir(): resfiles = find_results_files(res) else: resfiles = {"dummyname": {"dummydet": res}} elif is...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def adv_ratio(self): # XXX\r\n bw = StatsRouter.global_bw_mean\r\n if bw == 0.0: return 0\r\n else: return self.bw/bw", "def infected_ratio(self):\n if self.max_pop != 0:\n return int(self.infected_pop) / self.max_pop\n else:\n return 1", "def calc_rates(h, p, P_max...
[ "0.5848377", "0.5493307", "0.5427488", "0.539445", "0.5320204", "0.5265624", "0.52554834", "0.5241904", "0.52287406", "0.52193356", "0.5190678", "0.5147648", "0.51428246", "0.51305693", "0.5119256", "0.5099221", "0.5082424", "0.5079487", "0.5066822", "0.5064177", "0.5059916",...
0.0
-1
Given a directory, go through all subdirectories and check if they contain results from cwinpy_pe. If they do, add them to a dictionary, keyed on the subdirectory name, with a subdictionary containing the path to the results
def find_results_files(resdir, fnamestr="cwinpy_pe"): if not isinstance(resdir, (str, Path)): raise TypeError(f"'{resdir}' must be a string or a Path object") respath = Path(resdir) if not respath.is_dir(): raise ValueError(f"'{resdir}' is not a directory") # iterate through directori...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_folder(root, path=\"\"):\n myDict = {}\n if path:\n if root.cd(path):\n for key in ROOT.gDirectory.GetListOfKeys():\n filterKey(root, key, path, myDict, \"__List\")\n else:\n for key in ROOT.gDirectory.GetListOfKeys():\n mypath = ROOT.gDirecto...
[ "0.6271076", "0.6237251", "0.62320423", "0.60597104", "0.6054745", "0.6023751", "0.5969229", "0.59455115", "0.5910583", "0.5897713", "0.58618456", "0.58485883", "0.5793558", "0.57651734", "0.5729901", "0.5695948", "0.5685411", "0.5640854", "0.56278336", "0.5600535", "0.559865...
0.5763771
14
Given a directory, find the heterodyned data files and sort them into a dictionary keyed on the source name with each value being a subdictionary keyed by detector name and pointing to the heterodyned file. This assumes
def find_heterodyned_files(hetdir, ext="hdf5"): if not isinstance(hetdir, (str, Path)): raise TypeError("hetdir must be a string or Path object") hetpath = Path(hetdir) if not hetpath.is_dir(): raise ValueError(f"{hetdir} is not a directory") # get all files with correct extension ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_file_dict():\n import os\n file_dict = {}\n for root, dirs, files in os.walk('.'):\n dirs[:] = [ # add any extra dirs to ignore #\n d for d in dirs\n if '.' not in d\n and 'ENV' not in d\n and '__' not in d\n and 'build' not in d\n ...
[ "0.6215566", "0.6135195", "0.6096218", "0.60056674", "0.5989737", "0.5972656", "0.5945372", "0.5938925", "0.5867696", "0.585495", "0.58186024", "0.57985175", "0.5786209", "0.577147", "0.57117325", "0.56910574", "0.56901246", "0.56848365", "0.5684253", "0.56584734", "0.5646487...
0.6336369
0
Plot the signaltonoise ratio for a set of sources versus their Bayesian odds. The inputs can either be a dictionary of SNRs, keyed on source name, and a dictionary of odds values, also keyed on source name, or it can be a directory path containing a set of cwinpy_pe parameter estimation results and a directory containi...
def plot_snr_vs_odds(S, R, **kwargs): if isinstance(S, (str, Path)) and isinstance(R, (str, Path)): # calculate SNRs and odds values try: snrs = optimal_snr( R, S, which=kwargs.pop("which", "posterior"), remove_outliers=kwa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_ratios(path='/Volumes/OptiHDD/data/pylith/3d/agu2014/output',\n\t\t\t\tsteps=['step01','step02'],\n\t\t\t\t#labels='',\n\t\t\t\tshow=True,\n\t\t\t\txscale=1e3,\n\t\t\t\tyscale=1e-2):\n\tplt.figure()\n\t#path = '/Users/scott/Desktop/elastic'\n\n\t# Deep source\n\t#labels = ['no APMB', 'APMB']\n\t#if labels...
[ "0.6201664", "0.58766454", "0.58370477", "0.57312804", "0.56986564", "0.5673041", "0.5670444", "0.56263053", "0.56102556", "0.55182964", "0.54761904", "0.547028", "0.5460293", "0.5450966", "0.54439896", "0.5438146", "0.5412085", "0.539946", "0.53983545", "0.5386303", "0.53858...
0.6297812
0
Defaults to rounding to two decimal places (or three significant figures for spindown ratios)
def __init__(self, name=None, type=None, dp=2, sf=3, scinot=True): self.name = name self.type = type self.dp = dp self.sf = sf self.scinot = scinot
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __round__(self, ???):", "def __round(num):\n return float(round(decimal.Decimal(num), DataGen.precision))", "def sround(x, precision=0):\n sr = StochasticRound(precision=precision)\n return sr.round(x)", "def round_half_up(number):\n return number.quantize(decimal.Decimal(\"0.01\"), round...
[ "0.71726626", "0.7026408", "0.679092", "0.66351366", "0.6633954", "0.6604349", "0.6587327", "0.65697914", "0.656455", "0.650757", "0.6477595", "0.6477595", "0.6477595", "0.6477595", "0.6477595", "0.6477595", "0.6477595", "0.6477595", "0.6477595", "0.6477595", "0.6477595", "...
0.0
-1
Create a publication quality plot of one set of results as a function
def plot(self, column, **kwargs): if isinstance(column, str): axiscols = ["F0ROT", column] elif isinstance(column, (list, tuple)): if len(column) == 1: column = column[0] axiscols = ["F0ROT", column] elif len(column) == 2: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluate(self, plot):", "def qq_plot(results, numQuantiles, method_types=[\"kw\", \"emma\"], mapping_labels=None, phenName=None, pdfFile=None, pngFile=None,\n\t perm_pvalues=None, **kwargs):\n\n\tif not mapping_labels:\n\t\tmapping_labels = method_types\n\n\tplt.figure(figsize=(5, 4))\n\t#plt.figure(figsi...
[ "0.6358671", "0.6227614", "0.61542094", "0.61238015", "0.6066807", "0.6048156", "0.60426307", "0.5986207", "0.5978632", "0.59749204", "0.59701324", "0.5954919", "0.59414935", "0.5896429", "0.5871218", "0.5835627", "0.5826131", "0.579724", "0.57892823", "0.57849526", "0.577812...
0.0
-1
Generate the grid on which to make the plot
def _generate_plot_grid(**kwargs): # check whether using a Seaborn joint plot if kwargs.pop("jointplot", False): try: import seaborn as sns except (ImportError, ModuleNotFoundError): raise ValueError("Seaborn must be installed to create a jointplo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_grid(self):\n length = self.size / 8\n # draw horizontal lines\n for y in range(0, self.size, length):\n self.window.create_line(0, y, self.size, y, fill = \"blue\")\n \n # draw vertical lines\n for x in range(0, self.size, length):\n self.wi...
[ "0.7782573", "0.76017785", "0.7581878", "0.7569566", "0.74595624", "0.7365985", "0.73288405", "0.7252459", "0.7250317", "0.7228076", "0.7221421", "0.72081643", "0.72037905", "0.7195863", "0.7173598", "0.71635544", "0.713842", "0.7126692", "0.70978045", "0.7077975", "0.7071913...
0.0
-1
Set the xy position of some annotating text by the point's location in a plot.
def _set_text_pos(xv, yv, xlims, ylims, ax, offsetx=0.08, offsety=0.07): # check log or linear scale xlim = np.log10(xlims) if ax.get_xscale() == "log" else xlims ylim = np.log10(ylims) if ax.get_yscale() == "log" else ylims x = np.log10(xv) if ax.get_xscale() == "log" else xv y...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def annotate_point(x, y, text, offset=5, offset_x=None, offset_y=None,\n text_kw={}):\n if offset_x is None or offset_y is None:\n offset_x = offset\n offset_y = offset\n ax = plt.gca()\n trans_offset = transforms.offset_copy(ax.transData, units='dots',\n ...
[ "0.7204751", "0.70156896", "0.68095434", "0.6770827", "0.6707462", "0.6529201", "0.64887315", "0.6440085", "0.64257395", "0.6420824", "0.636438", "0.6350544", "0.63500124", "0.6344234", "0.63359696", "0.62694347", "0.62663", "0.62663", "0.61969054", "0.6188161", "0.6113714", ...
0.68763167
2
Import dataset and store as (user, age, gender, education, querys).
def import_data(path, mode='train'): info_list = list() with codecs.open(path, 'r', 'gb18030') as fo: for line in fo.readlines(): infos = line.strip().split('\t') if mode == 'train' : [user, age, gender, education], querys = infos[0:4], infos[4:] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_data():\n\tscores = pd.read_csv('../data/user_assessment_scores.csv')\n\tviews = pd.read_csv('../data/user_course_views.csv')\n\ttags = pd.read_csv('../data/course_tags.csv')\n\tinterests = pd.read_csv('../data/user_interests.csv')\n\n\tdb_file = '../db/usersim.sqlite'\n\ttry:\n\t\tengine = sqlite3.connec...
[ "0.70883316", "0.6477563", "0.64409214", "0.62884766", "0.6244719", "0.6207699", "0.6170172", "0.59995556", "0.59695286", "0.59443945", "0.58292955", "0.5816049", "0.57771695", "0.5769951", "0.5764115", "0.5744769", "0.57430923", "0.5691017", "0.565815", "0.5649489", "0.56446...
0.6316197
3
Split zi in querys and write in the disk.
def zi_spliting(info_list, path, mode='train'): new_info_list = list() for infos in info_list: if mode == 'train': [user, age, gender, education, querys] = infos elif mode == 'test': [user, querys] = infos new_querys = list() for query in querys: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flush_to_disk(self):\n logger.info(\"Flushing %s queries from in-memory cache to disk\", len(self.batch_writes))\n rows = self.memory_connection.execute(f\"\"\"\n SELECT hash_id, query, raw_query, domain, intent FROM queries\n WHERE rowid IN ({\",\".join(self.batch_writes)});\n ...
[ "0.6057693", "0.5790732", "0.574135", "0.5588527", "0.5553472", "0.55255365", "0.5473328", "0.53616834", "0.5243696", "0.5214998", "0.5193215", "0.5192265", "0.51885676", "0.51661223", "0.51618826", "0.51062745", "0.50930005", "0.50851786", "0.5072133", "0.50682193", "0.50611...
0.66669464
0
Construct zi_dict with train and test.
def construct_zi_dict(train_info_list, test_info_list): zi_dict, train_dataset_list, test_dataset_list = dict(), list(), list() for user, age, gender, education, querys in train_info_list: for query in querys: for zi in query: if zi not in zi_dict: z...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def define_test(s_test, s_train):\n #2048/16=128\n m = 8\n x = random.randint(0,m) * s_train\n y = random.randint(0,m) * s_train\n z = random.randint(0,m) * s_train\n #print(x,y,z)\n return {'x':[x,x + s_test], 'y':[y,y + s_test], 'z':[z,z + s_test]}", "def _data_zip(train_data, eval_data, t...
[ "0.63030636", "0.62033963", "0.5901863", "0.58987844", "0.58168197", "0.5787425", "0.572789", "0.56477004", "0.55487585", "0.5511268", "0.54987353", "0.5493017", "0.5458069", "0.54230857", "0.54230857", "0.54230857", "0.54230857", "0.54230857", "0.53769624", "0.5376408", "0.5...
0.7252616
0
Try to find and return a matching window function file.
def find_window_measurement(version, sample, zmin, zmax, p, ell): from glob import glob # the directory holding any window results home_dir = os.environ['EBOSS_DIR'] dirname = os.path.join(home_dir, 'measurements', 'window', version) filename = f"RR_eboss_{version}-QSO-{sample}-*.json" pattern...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def locate():\n result = None\n\n # Locate sub functions: fastest to slowest\n loc_func = {\n # key, Windows only?, function\n \"cache\": (False, _locate_from_cache_file),\n \"registry\": (True, _locate_from_registry),\n }\n\n for key, value in loc_func.items():\n win_onl...
[ "0.6568787", "0.6021949", "0.599742", "0.5794594", "0.57798076", "0.5694531", "0.56704897", "0.5538679", "0.5511249", "0.5508984", "0.5486639", "0.5471497", "0.5471456", "0.5444735", "0.5408611", "0.5402508", "0.53828114", "0.53525645", "0.53482676", "0.53084975", "0.5294612"...
0.595634
3
Compute effective redshift and number density quantities.
def compute_effective_quantities(r, cosmo, p=None, P0=3e4, ell=0): assert 'Z' in r.columns assert 'NZ' in r.columns # weights w_fkp = 1. / (1 + r['NZ']*P0) if p is not None: w1 = fnl_weight(r['Z'], p=p) w2 = bias_weight(r['Z'], cosmo, ell=ell) else: w1 = w2 = 1.0 # ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cosmic_average_density_from(self, redshift: float) -> float:\r\n\r\n cosmic_average_density_kpc = (\r\n self.critical_density(z=redshift).to(\"solMass / kpc^3\").value\r\n )\r\n\r\n kpc_per_arcsec = self.kpc_per_arcsec_from(redshift=redshift)\r\n\r\n return cosmic_average...
[ "0.6067939", "0.601255", "0.59862447", "0.58703715", "0.58332103", "0.5765762", "0.57512295", "0.5700371", "0.56350297", "0.56209916", "0.56191134", "0.5541681", "0.5529908", "0.55091363", "0.54890424", "0.5478064", "0.54699796", "0.5466433", "0.5466238", "0.5391754", "0.5387...
0.5561082
11
Compute the effective redshift of a CatalogSource.
def compute_effective_redshift(cat): # the total weight total_weight = cat['Weight']*cat['FKPWeight'] # effective redshift zeff = (total_weight*cat['Z']).sum() / total_weight.sum() return cat.compute(zeff)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def makeSourceCat(self, distortedWcs):\n loadRes = self.refObjLoader.loadPixelBox(bbox=self.bbox, wcs=distortedWcs, filterName=\"r\")\n refCat = loadRes.refCat\n refCentroidKey = afwTable.Point2DKey(refCat.schema[\"centroid\"])\n refFluxRKey = refCat.schema[\"r_flux\"].asKey()\n\n ...
[ "0.52597326", "0.51466864", "0.5131956", "0.50191694", "0.49740767", "0.4853845", "0.48141217", "0.4778028", "0.4736358", "0.47122192", "0.4694604", "0.46868613", "0.46714836", "0.46576115", "0.46568698", "0.46133813", "0.46009", "0.4544731", "0.45407397", "0.4538425", "0.449...
0.692623
0
Compute the effective number density of a CatalogSource.
def compute_effective_nbar(cat): # the total weight total_weight = cat['Weight']*cat['FKPWeight'] # effective nbar nbar = (total_weight*cat['NZ']).sum() / total_weight.sum() return cat.compute(nbar)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def density( self ) :\n return self.__density", "def density( self ) :\n return self.__density", "def density( self ) :\n return self.__density", "def density(self):\n return self._density", "def density(self):\n return self.get_density()", "def _density(self):\n ...
[ "0.63332367", "0.63332367", "0.63332367", "0.63028103", "0.6245276", "0.62077314", "0.6154465", "0.6130706", "0.60398775", "0.6037856", "0.6001697", "0.59691787", "0.5904073", "0.59027845", "0.58638614", "0.5822731", "0.5779815", "0.5759084", "0.5722551", "0.5687284", "0.5682...
0.0
-1
Allow input redshift ranges via the command line
def redshift_range_type(s): try: return tuple(map(float, s.split(','))) except: raise TypeError("redshift range must be zmin,zmax")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_range(range_step, star_range):\n error_info = (\"<string>\", -1, -1, range_step)\n (star_min, star_max) = star_range\n range_step = range_step.replace(\"*\", \"{}-{}\".format(*star_range))\n range_step = range_step.split('/')\n if len(range_step) == 1:\n step = 1\n elif len(range...
[ "0.60699004", "0.594007", "0.58571297", "0.5856631", "0.57981825", "0.5776436", "0.5763221", "0.5705796", "0.56652683", "0.56404394", "0.5569514", "0.55306095", "0.55071014", "0.54717267", "0.5431856", "0.542844", "0.54148895", "0.53689265", "0.5350659", "0.5338169", "0.53315...
0.547086
14
Trim the redshift range of a CatalogSource.
def trim_redshift_range(s, zmin=None, zmax=None): # trim the redshift range if zmin is None: zmin = 0. if zmax is None: zmax = 10.0 return s[(s['Z'] > zmin) & (s['Z'] < zmax)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trim(self, start, end):", "def trim(self, start, stop=None):\n if stop is None:\n stop = self.data.shape[0]\n\n start = max(start, 0)\n stop = min(stop, self.data.shape[0])\n self.data = self.data.iloc[start:stop,:]", "def trim_region(self, start, stop):\n if s...
[ "0.65085673", "0.59823054", "0.5902807", "0.55606157", "0.5462624", "0.53439903", "0.5193237", "0.51859903", "0.5061092", "0.5031417", "0.50258857", "0.50171834", "0.5016415", "0.5004839", "0.49636784", "0.4956522", "0.49534982", "0.4952949", "0.493497", "0.4923749", "0.49187...
0.66857666
0
Return a unique hash string for the subset of ``attrs`` specified by ``usekeys``.
def make_hash(attrs, usekeys=None, N=10): if usekeys is None: d = attrs else: d = {k: attrs.get(k, None) for k in usekeys} s = json.dumps(d, sort_keys=True, cls=JSONEncoder).encode() return hashlib.sha1(s).hexdigest()[:N]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unique_hash(only_letters=False):\n\n if only_letters:\n return ''.join((chr(int(x) + 97) if x.isdigit() else x)\n for x in uuid.uuid4().hex)\n return uuid.uuid4().hex", "def generate_key(*args, **kwargs):\n return hashlib.md5(generate_str_key(**kwargs).encode()).hexdiges...
[ "0.6116779", "0.5941026", "0.5929928", "0.58604497", "0.583291", "0.5820026", "0.5805001", "0.5777121", "0.57417", "0.56319386", "0.5608807", "0.5590001", "0.5494286", "0.54475236", "0.54418105", "0.54005814", "0.53855014", "0.53316027", "0.53258616", "0.5296983", "0.5287548"...
0.75536317
0
Return a dict of key/values that generated a filename with a unique hash ID
def get_hashkeys(filename, cls): from nbodykit import lab # filename is a directory --> FIT result if os.path.isdir(filename): filename = os.path.join(os.path.abspath(filename), 'hashinfo.json') if not os.path.exists(filename): return import json # use json to l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_file(self) -> tuple:\r\n hash_md5 = hashlib.md5()\r\n with open(self.yara_base_file, \"rb\") as f:\r\n file_map = f.read()\r\n get_file_dict = get_matches(self, file_map)\r\n hash_md5.update(file_map)\r\n return hash_md5.hexdigest(), get_file_dict", "def hashFiles(direct...
[ "0.6731944", "0.6602148", "0.65610206", "0.6545702", "0.6483463", "0.6435844", "0.6379447", "0.6327119", "0.6283103", "0.62700856", "0.6226224", "0.62206787", "0.6216478", "0.61988825", "0.6169493", "0.6165634", "0.6083418", "0.60667855", "0.6039825", "0.6023578", "0.601291",...
0.6668095
1
Echo the key/values that generated the hash in the input filename
def echo_hash(): import argparse desc = 'echo the key/values that generated the hash in the input filename' parser = argparse.ArgumentParser(description=desc) h = 'the input file name' parser.add_argument('filenames', type=str, nargs='+', help=h) h = 'the result class' parser.add_argument(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_hash(self, fname, args):\n fobj = self._open_file(fname, args.binary)\n hash_value = self._calculate_hash(fobj)\n\n line = '{0} {1}{2}\\n'.format(hash_value, '*' if args.binary else ' ',\n fname)\n\n if '//' in line:\n line = '...
[ "0.6701367", "0.6636175", "0.6627226", "0.65526426", "0.653198", "0.6508728", "0.62754333", "0.61778194", "0.6140872", "0.6134116", "0.60154223", "0.59322345", "0.59317064", "0.59183043", "0.5915798", "0.5910977", "0.5874824", "0.58745474", "0.58403486", "0.5829077", "0.58126...
0.7862639
0
Get up/down status of all interfaces
def get_interfaces_status(device): try: out = device.parse('show ip interface brief') except SchemaEmptyParserError as e: log.error('No interface information found') return None # {'interface': {'GigabitEthernet1': {'interface_is_ok': 'YES', # 'ip_address': '172.16.1....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_interface_status(conn_obj, interface, device=\"dut\"):\n command = \"cat /sys/class/net/{}/operstate\".format(interface)\n if device==\"dut\":\n return utils_obj.remove_last_line_from_string(st.show(conn_obj, command, skip_tmpl=True))", "def interface_status(system_ip):\n\n click.secho(\"...
[ "0.6717401", "0.66641027", "0.66449285", "0.634017", "0.61802435", "0.60001135", "0.59895647", "0.59331095", "0.59069073", "0.58951986", "0.58087885", "0.5807881", "0.5795884", "0.5783786", "0.5783786", "0.5783786", "0.57551444", "0.5748707", "0.57450855", "0.57387745", "0.57...
0.649543
3
save an [1.0, 1.0] image
def imwrite(image, path): if image.ndim == 3 and image.shape[2] == 1: # for gray image image = np.array(image, copy=True) image.shape = image.shape[0:2] imgarray=((image+1.0)*127.5).astype(np.uint8) img=Image.fromarray(imgarray) img.save(path)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_image(image, image_path):\n image = ((image[0] + 1) * 127.5).astype(np.uint8) # convert from [-1, 1] to [0, 255]\n img = Image.fromarray(image)\n img.save(os.path.expanduser(image_path))", "def img_save(name,img):\n cv2.imwrite(name,img)", "def test_save_jpg():\n img = Image.new('RGB',...
[ "0.7184405", "0.7058263", "0.70391816", "0.70101696", "0.70036274", "0.6940388", "0.6931688", "0.69289064", "0.69088125", "0.6889043", "0.68391377", "0.6816189", "0.680161", "0.6763353", "0.67472714", "0.6711842", "0.6688862", "0.6683679", "0.6676861", "0.6668132", "0.6633004...
0.7254879
0
merge images into an image with (row h) (col w) `images` is in shape of N H W( C=1 or 3)
def immerge(images, row, col): h, w = images.shape[1], images.shape[2] if images.ndim == 4: img = np.zeros((h * row, w * col, images.shape[3])) elif images.ndim == 3: img = np.zeros((h * row, w * col)) for idx, image in enumerate(images): i = idx % col j = idx // col ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def merge(images, size, c_dim):\n h, w = images.shape[1], images.shape[2]\n \n img = np.zeros((h*size[0], w*size[1], c_dim))\n for idx, image in enumerate(images):\n i = idx % size[1]\n j = idx // size[1]\n img[j * h : j * h + h,i * w : i * w + w, :] = image\n #cv2.imshow(\"...
[ "0.81609666", "0.78292745", "0.7466903", "0.7396564", "0.7394297", "0.73224103", "0.7306454", "0.7252543", "0.72445625", "0.7218758", "0.71831924", "0.71621686", "0.71043366", "0.6990061", "0.6979655", "0.69541997", "0.6921044", "0.6872003", "0.68307626", "0.67826694", "0.674...
0.6832998
18
Generate a pool name. This function takes keyword arguments, usually the connection arguments and tries to generate a name for the pool.
def generate_pool_name(**kwargs): parts = [] for key in ("host", "port", "user", "database", "client_id"): try: parts.append(str(kwargs[key])) except KeyError: pass if not parts: raise PoolError("Failed generating pool name; specify pool_name") return "_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def NodePoolName(name: str) -> str:\n # GKE (or k8s?) requires nodepools use alphanumerics and hyphens\n # AKS requires full alphanumeric\n # PKB likes to use underscores strip them out.\n return name.replace('_', '')", "def _get_unique_name(self, name: str, prefix: str):\n if name is None:\n ...
[ "0.6692671", "0.64188457", "0.5920847", "0.58881325", "0.588302", "0.58691883", "0.5826616", "0.58163804", "0.5768133", "0.57644916", "0.57572246", "0.573129", "0.56918794", "0.56799304", "0.56768924", "0.5658768", "0.5649311", "0.55965006", "0.5596221", "0.5574093", "0.55608...
0.8913228
0
Update the timeout penalties directory. Update the timeout penalties by error dictionary used to deactivate a pool.
def update_timeout_penalties_by_error(penalty_dict): if penalty_dict and isinstance(penalty_dict, dict): _TIMEOUT_PENALTIES_BY_ERR_NO.update(penalty_dict)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _update_resource_timeouts(self, timeout):\n\n for resource_id, test_prep in self._test_preps.iteritems():\n try:\n test_prep.sut.update_lock_timeout(timeout)\n except CoreError:\n raise CoreError('The \"{0}\" resource is not currently checked out by th...
[ "0.64578515", "0.59423137", "0.5942137", "0.5757979", "0.5561408", "0.52926654", "0.52085173", "0.51905227", "0.49876463", "0.4952442", "0.49120688", "0.4895273", "0.48888853", "0.48456872", "0.4839235", "0.48297524", "0.4825805", "0.48181972", "0.4812415", "0.48100135", "0.4...
0.70020324
0
Connects to a TCP service.
def connect(self, params, connect_timeout=_CONNECT_TIMEOUT): if connect_timeout is not None: connect_timeout = connect_timeout / 1000 # Convert to seconds try: self._socket = socket.create_connection(params, connect_timeout) self._host = params[0] except Valu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connect(self) -> None:\n self.s.connect((self.ip, self.port))", "def connect(host, port, service=VoidService, config={}, ipv6=False, keepalive=False):\n s = SocketStream.connect(host, port, ipv6=ipv6, keepalive=keepalive)\n return connect_stream(s, service, config)", "def connect(self) -> None...
[ "0.7419392", "0.7120067", "0.70798755", "0.69959885", "0.6967482", "0.6898723", "0.68971574", "0.6848087", "0.68373835", "0.6834835", "0.6828523", "0.6828007", "0.68057334", "0.67539835", "0.6749781", "0.67291987", "0.67091995", "0.6700671", "0.6676571", "0.6674236", "0.66107...
0.0
-1
Receive data from the socket.
def read(self, count): if self._socket is None: raise OperationalError("MySQLx Connection not available") buf = [] while count > 0: data = self._socket.recv(count) if data == b"": raise RuntimeError("Unexpected connection close") bu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def receive(self):\n data = self.socket.recv(4096)\n return data", "def receive(self):\n\n return self.sock.recv(1024)", "def receive(self):\n\t\ttry:\n\t\t\tdata = self.protocol[0].readTcpSocket(self.socket)\n\t\t\tif len(self.protocol) > 1:\n\t\t\t\tfor protocol in self.protocol[1:]:\n\t...
[ "0.7867145", "0.76323104", "0.7517302", "0.7507524", "0.7318519", "0.7315371", "0.7296293", "0.7274737", "0.7238321", "0.723551", "0.7226901", "0.7162776", "0.7162383", "0.7149212", "0.71363044", "0.7119665", "0.71050173", "0.7100699", "0.70780414", "0.7059313", "0.70582426",...
0.0
-1
Send data to the socket.
def sendall(self, data): if self._socket is None: raise OperationalError("MySQLx Connection not available") try: self._socket.sendall(data) except OSError as err: raise OperationalError(f"Unexpected socket error: {err}") from err
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send(self, data):\n self.sock.send(data)", "def send(self, data):\n self.sock.send(data)", "def send(self, data):\n self.socket.sendall(data)", "def send(self, socket, data):\n data_length = len(data)\n socket.send(self.struct.pack(data_length))\n\n total_sent = ...
[ "0.8838532", "0.8838532", "0.8734111", "0.84183884", "0.8336636", "0.82360697", "0.82296145", "0.822127", "0.8193443", "0.8128526", "0.79960537", "0.79783434", "0.79776675", "0.7971629", "0.7860228", "0.7854447", "0.78504014", "0.7849109", "0.7843999", "0.783684", "0.7797629"...
0.7151017
74
Verifies if SSL is being used.
def is_ssl(self): return self._is_ssl
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validateSSL(self):\n return self.__validate_ssl", "def test_ssl_default(self):\n assert security.security_settings.ssl_verify()", "def require_ssl(self) -> bool:\n return pulumi.get(self, \"require_ssl\")", "def enable_ssl_verification(self) -> bool:\n return pulumi.get(self, ...
[ "0.80252874", "0.7999928", "0.7712244", "0.7647646", "0.7630415", "0.74153316", "0.734561", "0.72919285", "0.70821446", "0.7079489", "0.7049013", "0.6967571", "0.6874006", "0.68479514", "0.68237513", "0.68111855", "0.67735523", "0.671138", "0.6661785", "0.66480577", "0.659201...
0.7560468
5
Verifies if socket connection is being used.
def is_socket(self): return self._is_socket
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_connection(self):\n pass", "def check_connection(self):\n return False", "def check_socket(self):\n return self.__send_command(cmd=\"PING\")", "def is_open(self):\n return self._socket is not None", "def is_connected(self):\r\n return self.__socket is not None",...
[ "0.7159334", "0.71549284", "0.7146549", "0.7019205", "0.69122994", "0.68015295", "0.67169625", "0.6689815", "0.66590285", "0.66497767", "0.6599486", "0.6528221", "0.6498561", "0.64907825", "0.6480102", "0.64790636", "0.64349437", "0.64200467", "0.64186096", "0.6389978", "0.63...
0.6965475
4
Verifies if connection is secure.
def is_secure(self): return self._is_ssl or self._is_socket
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_secure():\n return get_config_handler().check_secure()", "def secure(self) -> bool:\n return self.get_state(self.args[CONF_OVERALL_SECURITY_STATUS]) == \"Secure\"", "def is_secure(self):\n return (self.nbits % 8 == 0) and (self.nbits >= params.MINIMUM_KEY_SIZE)", "def is_secure_tra...
[ "0.7685507", "0.73935765", "0.7042564", "0.68651164", "0.68104255", "0.6803506", "0.6792077", "0.6557997", "0.6509255", "0.6490868", "0.6275847", "0.6274484", "0.62523067", "0.62479746", "0.613625", "0.6082202", "0.6001328", "0.59894526", "0.59757334", "0.59134", "0.5912556",...
0.7985311
0
Verifies if connection is open.
def is_open(self): return self._socket is not None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_connection(self):\n pass", "def check_connection(self):\n return False", "def verify_state(self):\n if self.state == CONNECTING:\n self.state = OPEN\n\n self.conn.on_open(self.conn_info)", "def is_open(self) -> bool:\n return self._connection is not...
[ "0.796634", "0.7869226", "0.78058314", "0.76230377", "0.7580085", "0.7563486", "0.7369523", "0.73689747", "0.73669004", "0.7360953", "0.7269555", "0.72470146", "0.71744704", "0.71025157", "0.70434105", "0.7025732", "0.6922616", "0.6901552", "0.69015455", "0.688996", "0.688194...
0.7327522
10
Decorator used to catch OSError or RuntimeError.
def catch_network_exception(func): @wraps(func) def wrapper(self, *args, **kwargs): """Wrapper function.""" try: if ( isinstance(self, (Connection, PooledConnection)) and self.is_server_disconnected() ): raise InterfaceErro...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wrap_exceptions(fun):\n @functools.wraps(fun)\n def wrapper(self, *args, **kwargs):\n try:\n return fun(self, *args, **kwargs)\n except OSError as err:\n raise convert_oserror(err, pid=self.pid, name=self._name)\n return wrapper", "def wrap_exceptions(callable):\r...
[ "0.7695017", "0.7247748", "0.7040653", "0.62534463", "0.6238365", "0.62312466", "0.62018996", "0.61862934", "0.6183713", "0.61547", "0.6134926", "0.6057694", "0.60442215", "0.6039399", "0.60277003", "0.6022954", "0.5947926", "0.5945985", "0.59167236", "0.5910387", "0.5909122"...
0.5339442
93
Verifies if the Router is available to open connections.
def available(self): return self["available"]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def available(self) -> bool:\n return self._router.available", "def check_connection(self):\n pass", "def check_connection(self):\n return False", "def status_check(self):\n try:\n client = self.connect()\n client.sys.is_initialized() # make an actual network...
[ "0.7185104", "0.6873154", "0.676719", "0.66428316", "0.6609776", "0.65404373", "0.64591676", "0.6282458", "0.6256079", "0.6243562", "0.62160474", "0.6215624", "0.6189872", "0.6181357", "0.6159555", "0.6157582", "0.6147995", "0.6133156", "0.6132046", "0.61149454", "0.61143994"...
0.0
-1
Sets this Router unavailable to open connections.
def set_unavailable(self): self["available"] = False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unavailable(self):\r\n\r\n self._available = False\r\n self.owner.trigger(\"on_unavailable\")", "def set_unavailable(self, time_out=-1):\n if self._available:\n _LOGGER.warning(\n \"ConnectionPool.set_unavailable pool: %s time_out: %s\",\n self,\n...
[ "0.68024015", "0.63710225", "0.63632125", "0.618218", "0.57032275", "0.565823", "0.5600337", "0.5573427", "0.53834504", "0.5378982", "0.5320795", "0.52802694", "0.5193362", "0.51573664", "0.51213264", "0.50979555", "0.5076377", "0.5059898", "0.5033755", "0.5033186", "0.502316...
0.7030494
0
Verifies if the Router is available to open connections.
def get_connection_params(self): if "socket" in self: return self["socket"] return (self["host"], self["port"])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def available(self) -> bool:\n return self._router.available", "def check_connection(self):\n pass", "def check_connection(self):\n return False", "def status_check(self):\n try:\n client = self.connect()\n client.sys.is_initialized() # make an actual network...
[ "0.7185104", "0.6873154", "0.676719", "0.66428316", "0.6609776", "0.65404373", "0.64591676", "0.6282458", "0.6256079", "0.6243562", "0.62160474", "0.6215624", "0.6189872", "0.6181357", "0.6159555", "0.6157582", "0.6147995", "0.6133156", "0.6132046", "0.61149454", "0.61143994"...
0.0
-1
Get a list of the current available routers that shares the given priority.
def _get_available_routers(self, priority): router_list = self._routers_directory[priority] router_list = [router for router in router_list if router.available()] return router_list
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def best_routes_for_routers(self) -> Sequence['outputs.GetRouterStatusBestRoutesForRouterResult']:\n return pulumi.get(self, \"best_routes_for_routers\")", "def get_all_routers(self):\n import network\n sta_if = network.WLAN(network.STA_IF)\n sta_if.active(True)\n all_routers =...
[ "0.6171273", "0.6041962", "0.6034307", "0.5962338", "0.59141415", "0.58702815", "0.5838168", "0.58028054", "0.57238275", "0.5592458", "0.54240227", "0.5399914", "0.5386131", "0.536433", "0.5353427", "0.53302324", "0.5325058", "0.53171957", "0.53160673", "0.5314322", "0.528009...
0.820786
0
Get a random router from the group with the given priority.
def _get_random_connection_params(self, priority): router_list = self._get_available_routers(priority) if not router_list: return None if len(router_list) == 1: return router_list[0] last = len(router_list) - 1 index = random.randint(0, last) retu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_next_router(self):\n if not self._routers:\n self._can_failover = False\n router_settings = self._settings.copy()\n router_settings[\"host\"] = self._settings.get(\"host\", \"localhost\")\n router_settings[\"port\"] = self._settings.get(\"port\", 33060)\n ...
[ "0.6443754", "0.57199085", "0.5464766", "0.54480845", "0.5380465", "0.5349423", "0.5275978", "0.5257964", "0.5209318", "0.5207216", "0.518145", "0.5172855", "0.51230246", "0.50956744", "0.5080085", "0.5078181", "0.50336725", "0.5022846", "0.50095725", "0.49857655", "0.4927093...
0.7469789
0
Returns the next connection parameters.
def can_failover(self): return self._can_failover
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_connection_params(self):\n if \"socket\" in self:\n return self[\"socket\"]\n return (self[\"host\"], self[\"port\"])", "def get_next_params(self) -> dict:\n params = {arg_name: caller() for arg_name, caller in self.parameters}\n return params", "def get_next_conf...
[ "0.6497003", "0.6395513", "0.6133702", "0.6026297", "0.59929216", "0.5973705", "0.5958259", "0.59082526", "0.5906403", "0.58654267", "0.5837841", "0.5796319", "0.57765025", "0.5748857", "0.5573247", "0.54945695", "0.54510605", "0.54460186", "0.54292613", "0.54064214", "0.5403...
0.0
-1
Returns the next connection parameters.
def get_next_router(self): if not self._routers: self._can_failover = False router_settings = self._settings.copy() router_settings["host"] = self._settings.get("host", "localhost") router_settings["port"] = self._settings.get("port", 33060) return Rou...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_connection_params(self):\n if \"socket\" in self:\n return self[\"socket\"]\n return (self[\"host\"], self[\"port\"])", "def get_next_params(self) -> dict:\n params = {arg_name: caller() for arg_name, caller in self.parameters}\n return params", "def get_next_conf...
[ "0.6497003", "0.6395513", "0.6133702", "0.6026297", "0.59929216", "0.5973705", "0.5958259", "0.59082526", "0.5906403", "0.58654267", "0.5837841", "0.5796319", "0.57765025", "0.5748857", "0.5573247", "0.54945695", "0.54510605", "0.54460186", "0.54292613", "0.54064214", "0.5403...
0.0
-1
Returns the directory containing all the routers managed.
def get_routers_directory(self): return self._routers_directory
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_dir(self) -> typing.List[str]:\n if get_engineering_mode():\n return self.super_dir()\n return self.get_filtered_dir_list()", "def routers():\n routers = []\n\n for app_controller in __app_controllers__:\n routers.append(app_controller.router())\n\n ...
[ "0.67521036", "0.65163875", "0.6353083", "0.6312008", "0.62837875", "0.6214547", "0.62108445", "0.6205643", "0.6201469", "0.6192914", "0.61928076", "0.61797047", "0.6130378", "0.61286974", "0.6078683", "0.6051697", "0.6024993", "0.6024993", "0.60194445", "0.5997913", "0.59614...
0.7911935
0
Attempt to connect to the MySQL server.
def connect(self): # Loop and check error = None while self.router_manager.can_failover(): try: router = self.router_manager.get_next_router() self.stream.connect( router.get_connection_params(), self._connect_timeout ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _try_connect(self):\n try:\n return mysql.connect(\n host=self.host,\n database=self.database,\n user=self.user,\n passwd=self.password\n )\n except Error as e:\n raise ConnectionError(f\"Could not connec...
[ "0.7998331", "0.7804993", "0.77287346", "0.76593274", "0.76463294", "0.75799", "0.7428476", "0.7376065", "0.73624223", "0.731132", "0.7264756", "0.72550553", "0.7220029", "0.71614695", "0.71209896", "0.7086063", "0.69947755", "0.699159", "0.6932102", "0.68903357", "0.68701166...
0.0
-1
Set the TLS capabilities.
def _set_tls_capabilities(self, caps): if self.settings.get("ssl-mode") == SSLMode.DISABLED: return if self.stream.is_socket(): if self.settings.get("ssl-mode"): _LOGGER.warning("SSL not required when using Unix socket.") return if "tls" not ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_capabilities(self, capabilities: WlSeat.capability) -> None:\n lib.wlr_seat_set_capabilities(self._ptr, capabilities)", "def has_tls_support(self):\n return \"STARTTLS\" in self.__capabilities", "def setTlsOptions(self, tlsOptions):\n internals.blpapi_SessionOptions_setTlsOptions(\...
[ "0.6283395", "0.6046862", "0.59853387", "0.5933391", "0.5836795", "0.5719707", "0.5661212", "0.5588899", "0.55324024", "0.5484506", "0.5468711", "0.5426122", "0.5417852", "0.5377021", "0.52267647", "0.52210593", "0.52199686", "0.5201323", "0.51081294", "0.50878096", "0.506060...
0.8059733
0
Set the compression capabilities. If compression is available, negociates client and server algorithms. By trying to find an algorithm from the requested compression algorithms list, which is supported by the server. If no compression algorithms list is provided, the following priority
def _set_compression_capabilities(self, caps, compression, algorithms=None): compression_data = caps.get("compression") if compression_data is None: msg = "Compression requested but the server does not support it" if compression == Compression.REQUIRED: raise NotS...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_compression(self, compression):\n converter = geowave_pkg.datastore.redis.config.RedisOptions.CompressionConverter()\n self._java_ref.setCompression(converter.convert(compression))", "def handle_protocol_compression(self, session):\n if self.protocol_compression is not None:\n ...
[ "0.6046909", "0.5819362", "0.5407032", "0.53581226", "0.5113678", "0.49839842", "0.498346", "0.49380842", "0.49221307", "0.49186134", "0.4917529", "0.49124977", "0.488789", "0.4852176", "0.48067507", "0.47812027", "0.47570655", "0.4756323", "0.47503453", "0.4736139", "0.47208...
0.83857566
0
Authenticate with the MySQL server.
def _authenticate(self): auth = self.settings.get("auth") if auth: if auth == Auth.PLAIN: self._authenticate_plain() elif auth == Auth.SHA256_MEMORY: self._authenticate_sha256_memory() elif auth == Auth.MYSQL41: self._au...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authenticate(self):\n self.connection.authenticate()", "def _authenticate_mysql41(self):\n plugin = MySQL41AuthPlugin(self._user, self._password)\n self.protocol.send_auth_start(plugin.auth_name())\n extra_data = self.protocol.read_auth_continue()\n self.protocol.send_auth_...
[ "0.7066845", "0.6790553", "0.6733843", "0.66785955", "0.6470214", "0.64467686", "0.64348483", "0.6347208", "0.62260765", "0.62185633", "0.61826706", "0.61758596", "0.61049795", "0.6093329", "0.60829234", "0.60590667", "0.6051973", "0.60183966", "0.59824556", "0.5967553", "0.5...
0.62139976
10
Authenticate with the MySQL server using `MySQL41AuthPlugin`.
def _authenticate_mysql41(self): plugin = MySQL41AuthPlugin(self._user, self._password) self.protocol.send_auth_start(plugin.auth_name()) extra_data = self.protocol.read_auth_continue() self.protocol.send_auth_continue(plugin.auth_data(extra_data)) self.protocol.read_auth_ok()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authenticate(self):\n self.connection.authenticate()", "def _authenticate(self):\n auth = self.settings.get(\"auth\")\n if auth:\n if auth == Auth.PLAIN:\n self._authenticate_plain()\n elif auth == Auth.SHA256_MEMORY:\n self._authentica...
[ "0.6400933", "0.62732726", "0.61138994", "0.61138994", "0.60705614", "0.5945095", "0.58467805", "0.58269435", "0.5800302", "0.57872933", "0.57863736", "0.5760464", "0.57275146", "0.5718929", "0.5718551", "0.56705445", "0.5662705", "0.56346184", "0.56291765", "0.5603998", "0.5...
0.85435927
0
Authenticate with the MySQL server using `PlainAuthPlugin`.
def _authenticate_plain(self): if not self.stream.is_secure(): raise InterfaceError( "PLAIN authentication is not allowed via unencrypted connection" ) plugin = PlainAuthPlugin(self._user, self._password) self.protocol.send_auth_start(plugin.auth_name(), a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _authenticate_mysql41(self):\n plugin = MySQL41AuthPlugin(self._user, self._password)\n self.protocol.send_auth_start(plugin.auth_name())\n extra_data = self.protocol.read_auth_continue()\n self.protocol.send_auth_continue(plugin.auth_data(extra_data))\n self.protocol.read_au...
[ "0.7103007", "0.67480946", "0.6699975", "0.6312854", "0.6282266", "0.6259324", "0.622877", "0.622877", "0.6171425", "0.61585176", "0.60417956", "0.60392666", "0.58906585", "0.5858753", "0.5825263", "0.58198947", "0.58059144", "0.5794666", "0.5784688", "0.57266223", "0.5722434...
0.7235906
0
Authenticate with the MySQL server using `Sha256MemoryAuthPlugin`.
def _authenticate_sha256_memory(self): plugin = Sha256MemoryAuthPlugin(self._user, self._password) self.protocol.send_auth_start(plugin.auth_name()) extra_data = self.protocol.read_auth_continue() self.protocol.send_auth_continue(plugin.auth_data(extra_data)) self.protocol.read_a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _authenticate_mysql41(self):\n plugin = MySQL41AuthPlugin(self._user, self._password)\n self.protocol.send_auth_start(plugin.auth_name())\n extra_data = self.protocol.read_auth_continue()\n self.protocol.send_auth_continue(plugin.auth_data(extra_data))\n self.protocol.read_au...
[ "0.66558886", "0.6050372", "0.5807445", "0.5724545", "0.57190645", "0.56151664", "0.55641025", "0.5541321", "0.5529535", "0.5519596", "0.5519596", "0.55058753", "0.5492875", "0.5449138", "0.54403234", "0.5424199", "0.5413333", "0.54038423", "0.5382327", "0.53573394", "0.53550...
0.81344426
0