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
This function will be evaluated on all GPUs.
def closure(model, criterion, optimizer, target_grad, target_gnorm): # noqa: D401 outputs = model(inputs) if self.args.target_criterion in ['cw', 'carlini-wagner']: criterion = cw_loss else: pass # use the default for untargeted or targeted cross ent...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _gpu_and_random(self, exprs):\n if not GPU:\n return False\n if not all(tell_deterministic(i) for i in exprs):\n return True\n\n return False", "def main():\n\n # Create an empty array to hold our points.\n n = gpuarray.zeros(shape=(x, y, z),\n ...
[ "0.67035437", "0.65965104", "0.65801316", "0.65305763", "0.64696866", "0.63764197", "0.6337298", "0.6332883", "0.623927", "0.62189025", "0.6205842", "0.618085", "0.61776066", "0.615781", "0.6089916", "0.6078713", "0.6078713", "0.6073123", "0.6054747", "0.60293716", "0.6015013...
0.0
-1
Compute the blind passenger loss term.
def _passenger_loss(self, poison_grad, target_grad, target_gnorm): passenger_loss = 0 poison_norm = 0 SIM_TYPE = ['similarity', 'similarity-narrow', 'top5-similarity', 'top10-similarity', 'top20-similarity'] if self.args.loss == 'top10-similarity': _, indices = torch.topk(to...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_loss(self):", "def lfads_training_loss(params, lfads_hps, key, x_bxt, kl_scale, keep_rate):\n losses = lfads_losses(params, lfads_hps, key, x_bxt, kl_scale, keep_rate)\n return losses['total']", "def calc_loss(self, x: np.ndarray, y: np.ndarray) -> float:\n return self.descent.calc_loss(x,...
[ "0.7101872", "0.7088875", "0.7031537", "0.6961103", "0.68990636", "0.68538445", "0.6827168", "0.6820173", "0.6786275", "0.678076", "0.67776346", "0.67702687", "0.673941", "0.67255217", "0.67128986", "0.6688643", "0.6676217", "0.666976", "0.6667273", "0.66558874", "0.66343457"...
0.6535987
27
Implement the closure here.
def _define_objective(self, inputs, labels, targets, intended_classes, true_classes): def closure(model, criterion, optimizer, target_grad, target_gnorm): """This function will be evaluated on all GPUs.""" # noqa: D401 outputs = model(inputs) if self.args.target_criterion in...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def closure(self, t):\n raise NotImplementedError", "def callback(self):\n pass # pragma: no cover", "def __call__(self):\n\t\treturn", "def __call__( self ):\n pass", "def apply(self):", "def apply(self) -> None:", "def apply(self) -> None:", "def closure(self):\n return...
[ "0.72084713", "0.67918205", "0.66439474", "0.6594649", "0.6570198", "0.65522903", "0.65522903", "0.6530278", "0.6526465", "0.6436523", "0.64173025", "0.64173025", "0.64173025", "0.64173025", "0.64173025", "0.6416854", "0.64145666", "0.6391834", "0.63399154", "0.63399154", "0....
0.0
-1
This function will be evaluated on all GPUs.
def closure(model, criterion, optimizer, target_grad, target_gnorm): # noqa: D401 outputs = model(inputs) if self.args.target_criterion in ['cw', 'carlini-wagner']: criterion = cw_loss else: pass # use the default for untargeted or targeted cross ent...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _gpu_and_random(self, exprs):\n if not GPU:\n return False\n if not all(tell_deterministic(i) for i in exprs):\n return True\n\n return False", "def main():\n\n # Create an empty array to hold our points.\n n = gpuarray.zeros(shape=(x, y, z),\n ...
[ "0.67035437", "0.65965104", "0.65801316", "0.65305763", "0.64696866", "0.63764197", "0.6337298", "0.6332883", "0.623927", "0.62189025", "0.6205842", "0.618085", "0.61776066", "0.615781", "0.6089916", "0.6078713", "0.6078713", "0.6073123", "0.6054747", "0.60293716", "0.6015013...
0.0
-1
Enforce batchwise privacy if necessary. This is attacking a defense discussed in Hong et al., 2020 We enforce privacy on mini batches instead of instances to cope with effects on batch normalization This is reasonble as Hong et al. discuss that defense against poisoning mostly arises from the addition of noise to the g...
def _hide_gradient(self, gradient_list): if self.args.gradient_clip is not None: total_norm = torch.norm(torch.stack([torch.norm(grad) for grad in gradient_list])) clip_coef = self.args.gradient_clip / (total_norm + 1e-6) if clip_coef < 1: for grad in gradient...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_keras_unsafe_batch_size():\n model, X, y, Xval, yval = make_small_model()\n\n loss = tf.keras.losses.CategoricalCrossentropy(\n from_logits=False, reduction=tf.losses.Reduction.NONE\n )\n model.compile(loss=loss, optimizer=None)\n\n isDP, msg = safekeras.check_optimizer_is_DP(model.o...
[ "0.59551156", "0.5798743", "0.559241", "0.5435405", "0.5397174", "0.5382515", "0.531263", "0.5305372", "0.52814037", "0.5258523", "0.5241897", "0.5238457", "0.52154946", "0.51913124", "0.5172364", "0.51606447", "0.51105905", "0.51038843", "0.5099438", "0.50854", "0.5076326", ...
0.50958407
19
tokenized_sentence = ["tu", "que", "tal"] all_words = ["tu", "yo", "soy", "que", "tal"] bag = [ 1, 0, 0, 1, 1]
def bag_of_words(tokenized_sentence, all_words): tokenized_sentence = [stem(w) for w in tokenized_sentence] #print(tokenized_sentence) bag = np.zeros_like(all_words, dtype=np.float32) for idx, w in enumerate(all_words): if w in tokenized_sentence: bag[idx] = 1.0 return bag
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bag_of_words(batch, TEXT):\n V = len(TEXT.vocab)\n X = torch.zeros(batch.text.size(0), V)\n ones = torch.ones(batch.text.size(1))\n for b in range(batch.text.size(0)):\n X[b].index_add_(0, batch.text.data[b], ones)\n X[b][TEXT.vocab.stoi['<pad>']] = 0\n X = Variable(X, requires_gra...
[ "0.7064958", "0.6989011", "0.6753921", "0.66266555", "0.6409904", "0.63231957", "0.6267341", "0.62106866", "0.6205491", "0.6204041", "0.6201656", "0.61629564", "0.61408895", "0.60988027", "0.6071161", "0.60488117", "0.60472023", "0.59949446", "0.59798604", "0.5959912", "0.595...
0.8335468
0
Return a list of tuple pairs from a string of commaseparated pairs
def extract_pairs(raw): try: pairs = list(set([(p.split("-")[0].strip().upper(), p.split("-")[1].strip().upper()) for p in raw.split(",")])) except IndexError as e: raise IndexError("Invalid pair") for x, y in pairs: if not (len(x) > 1 and len(y) > 1): raise Exception(f'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _pairs(content: str) -> Generator[Tuple[Any, Any], None, None]:\n if not content.strip():\n return\n\n for pair in content.split(\",\"):\n\n x, *y = pair.split(\":\", maxsplit=1)\n if len(y) == 0:\n raise ValueError(f\"Cannot parse pair {pair}\")\n\n yield x.strip()...
[ "0.7547629", "0.7007731", "0.6750094", "0.658827", "0.6409757", "0.64013463", "0.63092816", "0.6293765", "0.62603337", "0.6251687", "0.62503666", "0.6168677", "0.6142506", "0.6126788", "0.6120142", "0.6057803", "0.6056945", "0.5997375", "0.594228", "0.5908846", "0.58880675", ...
0.6935102
2
|coro| Calls the internal callback that the command holds.
async def __call__(self, *args, **kwargs): if self.cog is not None: # manually pass the cog class to the coro instead of calling it as a method return await self.callback(self.cog, *args, **kwargs) else: return await self.callback(*args, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def perform_callback(self, *args, **kwargs):\n pass", "async def _run_command(self, command, *args, **kwargs):\n pass", "def execute(self):\n return self.callback(*self.args)", "async def exec(self, *args, **kwargs) -> None:\n if self.is_usable:\n if self.is_limited:\n ...
[ "0.69243807", "0.6909893", "0.6818065", "0.67567855", "0.6717582", "0.66642964", "0.66566145", "0.6656008", "0.66115445", "0.66091347", "0.6548687", "0.6502713", "0.64771914", "0.64045286", "0.63988125", "0.63556695", "0.63556355", "0.63522184", "0.6235755", "0.6161218", "0.6...
0.6829955
2
Creates a copy of this command. Returns
def copy(self): ret = self.__class__(self.callback, **self.__original_kwargs__) return self._ensure_assignment_on_copy(ret)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy (self):\n return self.__class__(self.name, self[:])", "def copy(self):\n new = object.__new__(type(self))\n new.bot = self.bot\n new.description = self.description\n new.icon_hash = self.icon_hash\n new.icon_type = self.icon_type\n new.id = 0\n new...
[ "0.70498085", "0.6929576", "0.69185376", "0.67951876", "0.6781262", "0.67583", "0.669616", "0.6664715", "0.6664715", "0.66360825", "0.6626673", "0.6619382", "0.66085666", "0.6604005", "0.6583924", "0.65665233", "0.6523402", "0.6514677", "0.64874953", "0.6483554", "0.64349014"...
0.0
-1
A decorator that registers a coroutine as a preinvoke hook. A preinvoke hook is called directly before the command is called. This makes it a useful function to set up database connections or any type of set up required.
def before_invoke(self, coro): if not asyncio.iscoroutinefunction(coro): raise TypeError('The pre-invoke hook must be a coroutine.') self._before_invoke = coro return coro
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def before_invoke(coro) -> Callable[[T], T]:\n def decorator(func: Union[Command, CoroFunc]) -> Union[Command, CoroFunc]:\n if isinstance(func, Command):\n func.before_invoke(coro)\n else:\n func.__before_invoke__ = coro\n return func\n return decorator # type: ign...
[ "0.711384", "0.59254164", "0.59139216", "0.57862735", "0.57862735", "0.57862735", "0.57862735", "0.5783765", "0.56661844", "0.55336636", "0.54575396", "0.5412497", "0.535912", "0.5343143", "0.5328596", "0.5258286", "0.5252766", "0.5236413", "0.5234541", "0.5177922", "0.516268...
0.7430255
0
A decorator that registers a coroutine as a postinvoke hook. A postinvoke hook is called directly after the command is called. This makes it a useful function to cleanup database connections or any type of clean up required.
def after_invoke(self, coro): if not asyncio.iscoroutinefunction(coro): raise TypeError('The post-invoke hook must be a coroutine.') self._after_invoke = coro return coro
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def after_invoke(coro) -> Callable[[T], T]:\n def decorator(func: Union[Command, CoroFunc]) -> Union[Command, CoroFunc]:\n if isinstance(func, Command):\n func.after_invoke(coro)\n else:\n func.__after_invoke__ = coro\n return func\n return decorator # type: ignore...
[ "0.7060543", "0.59133196", "0.5863492", "0.57352626", "0.56779206", "0.563653", "0.55416155", "0.5520004", "0.5520004", "0.5520004", "0.5520004", "0.5489191", "0.5475493", "0.54560333", "0.54542017", "0.5424057", "0.5418961", "0.5323915", "0.5317458", "0.5298286", "0.5239417"...
0.7256072
0
|coro| Checks if the command can be executed by checking all the predicates
async def can_run(self, ctx: Context) -> bool: if not self.enabled: raise DisabledCommand(f'{self.name} command is disabled') original = ctx.command ctx.command = self try: if not await ctx.bot.can_run(ctx): raise CheckFailure(f'The global check...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_commands(self):\n pass", "def run_command_check(self):\n pass", "def is_command(oin, env, pred_name: YPredName, arg: Any=None):\n return (env.check_predicate(obj, pred_name, arg) for obj in oin)", "def is_command_ancillary(args):\n # pylint: disable=bad-continuation\n if (\n ...
[ "0.7544951", "0.7229583", "0.7154898", "0.6828592", "0.6776484", "0.6664218", "0.65445536", "0.6532735", "0.6488253", "0.64757514", "0.6359895", "0.6333302", "0.6325952", "0.6274989", "0.6268233", "0.62203294", "0.6179746", "0.616666", "0.61375", "0.6132663", "0.6086138", "...
0.6836468
3
An iterator that recursively walks through all commands and subcommands. Yields
def walk_commands(self) -> typing.Generator[Command, None, None]: for command in self.commands: yield command if isinstance(command, Group): yield from command.walk_commands()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __iter__(self):\n for node in self.grammar.walk():\n yield node", "def HierarchyIterator(obj):\n while obj:\n yield obj\n for opChild in SplineInputGeneratorHelper.HierarchyIterator(obj.GetDown()):\n yield opChild\n obj = obj.GetNext()"...
[ "0.69049597", "0.6855705", "0.67742354", "0.67373574", "0.6698454", "0.6655534", "0.6623079", "0.65826356", "0.65400165", "0.650673", "0.63782173", "0.63522226", "0.63168263", "0.63032573", "0.63010323", "0.62850904", "0.62850904", "0.626276", "0.6249921", "0.62281144", "0.61...
0.75511664
0
A decorator that registers a coroutine as a preinvoke hook. This allows you to refer to one before invoke hook for several commands that do not have to be within the same cog. Example
def before_invoke(coro) -> Callable[[T], T]: def decorator(func: Union[Command, CoroFunc]) -> Union[Command, CoroFunc]: if isinstance(func, Command): func.before_invoke(coro) else: func.__before_invoke__ = coro return func return decorator # type: ignore
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def before_invoke(self, coro):\n if not asyncio.iscoroutinefunction(coro):\n raise TypeError('The pre-invoke hook must be a coroutine.')\n\n self._before_invoke = coro\n return coro", "def wrap_before(before, condition=lambda *args, **kwargs: True):\n def decorator(func):\n ...
[ "0.7762231", "0.61355424", "0.6063686", "0.5962607", "0.58490914", "0.5809584", "0.5795975", "0.5628273", "0.55104494", "0.55104494", "0.55104494", "0.55104494", "0.54770267", "0.5420125", "0.53899693", "0.53138167", "0.53052264", "0.52775484", "0.52747756", "0.5244982", "0.5...
0.7769411
0
A decorator that registers a coroutine as a postinvoke hook. This allows you to refer to one after invoke hook for several commands that do not have to be within the same cog.
def after_invoke(coro) -> Callable[[T], T]: def decorator(func: Union[Command, CoroFunc]) -> Union[Command, CoroFunc]: if isinstance(func, Command): func.after_invoke(coro) else: func.__after_invoke__ = coro return func return decorator # type: ignore
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def after_invoke(self, coro):\n if not asyncio.iscoroutinefunction(coro):\n raise TypeError('The post-invoke hook must be a coroutine.')\n\n self._after_invoke = coro\n return coro", "def Postcall(function_to_call_later): \n def postcall_inside(fun): \n @functo...
[ "0.7621359", "0.6003703", "0.590855", "0.580963", "0.56406933", "0.5633439", "0.5529226", "0.551219", "0.5412582", "0.53565824", "0.5354295", "0.5315982", "0.53044456", "0.5290917", "0.52646506", "0.5262968", "0.5256531", "0.52481365", "0.52188635", "0.5216198", "0.5194705", ...
0.77887046
0
Initialize your data structure here.
def __init__(self): self.hashmap = {}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _init_empty(self):\n self._data = []", "def __init__(self):\n self._data = []", "def __init__(self):\n self._data = []", "def __init__(self):\n self._data = []", "def __init__(self):\n self._data = []", "def __init__(self):\n self._data = []", "def __init__...
[ "0.7765608", "0.7645274", "0.7645274", "0.7645274", "0.7645274", "0.7645274", "0.7645274", "0.7595176", "0.75853467", "0.7558298", "0.7530608", "0.7530608", "0.7530608", "0.7530608", "0.7530608", "0.74971247", "0.74971247", "0.7478105", "0.7477832", "0.7477832", "0.7477832", ...
0.0
-1
Returns true if the message should be printed in the given timestamp, otherwise returns false. If this method returns false, the message will not be printed. The timestamp is in seconds granularity.
def shouldPrintMessage(self, timestamp: int, message: str) -> bool: if message not in self.hashmap: self.hashmap[message] = timestamp return True elif timestamp - self.hashmap[message] >= 10: self.hashmap[message] = timestamp return True return Fal...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shouldPrintMessage(self, timestamp, message):\n if message in self.msg_dict:\n pst_ts = self.msg_dict[message]\n if timestamp - pst_ts >= 10:\n self.msg_dict[message] = timestamp\n return True\n else:\n return False\n \...
[ "0.81442153", "0.81045413", "0.80361164", "0.7786668", "0.7709378", "0.7697737", "0.7580134", "0.74628806", "0.73462576", "0.70301074", "0.6919817", "0.6418114", "0.6398993", "0.61138827", "0.6103651", "0.607633", "0.60022604", "0.5952176", "0.59207034", "0.5854169", "0.58502...
0.72041863
9
A lightweight wrapper around `get_context()`. While this used to be the canonical method of instantiating a DataContext before 0.15.40, it is now recommended to use `get_context()`.
def BaseDataContext( # noqa: PLR0913 project_config: Union[DataContextConfig, Mapping], context_root_dir: Optional[PathStr] = None, runtime_environment: Optional[dict] = None, cloud_mode: bool = False, cloud_config: Optional[GXCloudConfig] = None, # Deprecated as of 0.15.37 ge_cloud_mode: b...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_context(cls):\n # create context for current thread if there is none yet\n thread_id = cls._get_thread_id()\n if thread_id not in cls._current_context:\n cls._current_context[thread_id] = DataContext()\n \n # return the requested DataContext\n return cls...
[ "0.78117675", "0.75992185", "0.6992268", "0.6849802", "0.68103427", "0.66601473", "0.66341734", "0.65982026", "0.6576827", "0.6547928", "0.64481944", "0.6436456", "0.63984936", "0.6376657", "0.6315649", "0.6252722", "0.62010777", "0.61932164", "0.61883074", "0.6184539", "0.61...
0.0
-1
Clips the given position to the min and max values which are given by the configuration.
def clipPosLimits(self, pos): return max(min(self.pos_max, pos), self.pos_min)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clip(self):\n if self._value < self.lowBound:\n self._value = self.lowBound\n elif self._value > self.upBound:\n self._value = self.upBound", "def _update_limits(self):\n if self.pos_x > self.max_x:\n self.max_x = self.pos_x\n if self.pos_y > self....
[ "0.6378307", "0.601431", "0.60079855", "0.5891191", "0.5891191", "0.5858452", "0.5838469", "0.5741724", "0.5692912", "0.56625235", "0.56378406", "0.56049365", "0.5560278", "0.55355376", "0.55305564", "0.5506636", "0.54941773", "0.5478835", "0.5417553", "0.5407499", "0.5398159...
0.549168
17
Clips the given position to the min and max values which are read from the motors.
def clipRawLimits(self, raw): return max(min(self.raw_max, raw), self.raw_min)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clip(self):\n if self._value < self.lowBound:\n self._value = self.lowBound\n elif self._value > self.upBound:\n self._value = self.upBound", "def _update_limits(self):\n if self.pos_x > self.max_x:\n self.max_x = self.pos_x\n if self.pos_y > self....
[ "0.58154917", "0.5753531", "0.56642437", "0.5660898", "0.5656791", "0.5598197", "0.55842364", "0.5549174", "0.55371904", "0.55026674", "0.54736996", "0.547152", "0.5464527", "0.54394066", "0.54118705", "0.54025453", "0.53908134", "0.5382611", "0.5371208", "0.5355029", "0.5333...
0.52654696
25
Returns the raw motor angle.
def raw(self): return float(self.uw.send(self.name + '.val')[0])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_angle(self):\n return self.bot_client.send_command(_Command.GetAngle)", "def getAngle(self):\n return self.articulateEncoder.getDistance()+self.angleOffset", "def angle(self):\n if self.__trigger == gyro_trigger_mode.GET_ANGLE_TRIGGER_READ:\n self.read_and_update_angle()...
[ "0.7897493", "0.7447755", "0.74181837", "0.7340101", "0.7331262", "0.7290696", "0.7290696", "0.7290696", "0.7280038", "0.7271251", "0.72595936", "0.7241423", "0.72328305", "0.71845204", "0.7175799", "0.7175799", "0.70919544", "0.6964341", "0.69560325", "0.6882237", "0.6830001...
0.0
-1
Sets the raw motor angle to raw.
def raw(self, raw): self.uw.send('%s.val = %.4f' % (self.name, self.clipRawLimits(raw)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_angle(self, value):\n if not -90 <= value <= 90:\n raise ValueError('Servo angle must be between -90 and 90 degrees')\n self.duty_cycle = ...", "def set_angle(self, ang):\n if ang < 0:\n ang = 0\n elif ang > 180:\n ang = 180\n dutyCycle ...
[ "0.6217187", "0.6139621", "0.5981916", "0.59780204", "0.5968334", "0.5963124", "0.5929604", "0.58463824", "0.58386225", "0.58235294", "0.5821314", "0.5779344", "0.577006", "0.57593364", "0.57482916", "0.57446665", "0.5732732", "0.57217443", "0.5697634", "0.56790173", "0.56654...
0.0
-1
Returns the position angle.
def pos(self): return (self.raw - self.raw_zero) / self.ratio
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def angle(self):\n return self._angle", "def angle(self):\n return self._angle", "def angle(self):\n return self._angle", "def angle(self):\n return math.degrees(math.atan2(self[1], self[0]))", "def angle(self) -> float:\n return self._angle", "def angle(self) -> float:...
[ "0.7897296", "0.7897296", "0.7897296", "0.78602666", "0.78450084", "0.78450084", "0.7791315", "0.7785088", "0.77567", "0.77245075", "0.7694945", "0.7674423", "0.76514906", "0.76398444", "0.7619912", "0.7619509", "0.761692", "0.7377269", "0.73328733", "0.7306481", "0.7301534",...
0.0
-1
Sets the position angle by using the MoveSpeed method which will generate an appropriate trajectory.
def pos(self, value): self.uw.send('%s.val = %.4f smooth:2' % (self.name, (self.clipPosLimits(value) * self.ratio) + self.raw_zero))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_angle(self, angle=0.0):\n self.angle = angle", "def setAngle(self, angle):\n self.vector.angle = angle", "def angle(self, angle):\n self._angle = angle\n self.x_rate = self._rate * cos(self._angle)\n self.y_rate = self._rate * sin(self._angle)", "def setAngle(self,a...
[ "0.713275", "0.7047413", "0.6900193", "0.68479806", "0.67285573", "0.67080504", "0.6651994", "0.6613435", "0.65998375", "0.6586775", "0.6586668", "0.6583904", "0.6562857", "0.6562816", "0.6555339", "0.65001845", "0.64947605", "0.6476751", "0.6425671", "0.64084893", "0.640674"...
0.0
-1
Moves the joint to it's center position which is based on the configuration.
def center(self): if self.pos != 0.0: self.pos = 0.0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def center(self, destination):\n self.move(destination=destination, origin=self.center)", "def __moveCenterTo(self, x, y):\n x0, y0, w, h = self.currentBox\n x2, y2 = x - (w/2), y - (h/2)\n self.__moveTo(x2, y2)", "def move(self, dt):\n lims = self.settings['agent']['jointLim...
[ "0.68540615", "0.66069347", "0.63885736", "0.63441104", "0.6240075", "0.61633927", "0.6161882", "0.60907334", "0.6087191", "0.6079575", "0.60515106", "0.599599", "0.5902333", "0.5902333", "0.5899517", "0.5879379", "0.5857834", "0.5857834", "0.5857834", "0.5846521", "0.5834355...
0.6212106
5
Moves the joint in position over time.
def move(self, position, time): self.uw.send(self.name + '.Move(%.4f, %.4f)' % (self.clipLimits(position), time), time)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move(self, dt):\n lims = self.settings['agent']['jointLimits']\n # print '[move] curr joint Angle:'\n # print self.jointAngle\n # print '[move] curr speed:'\n # print self.speed\n\n J = self.jointAngle + dt * np.array(self.speed)\n self.jointAngle[0] = min(max(J...
[ "0.77453464", "0.7130474", "0.7102428", "0.66326016", "0.65695906", "0.65682214", "0.656399", "0.65440696", "0.65246534", "0.6487018", "0.6408533", "0.6407845", "0.64014333", "0.6378285", "0.63696784", "0.6363772", "0.6341952", "0.6338761", "0.63288975", "0.632679", "0.632376...
0.6202988
30
Initializes a storage merge reader.
def __init__(self, session, storage_writer, task_storage_reader): super(StorageMergeReader, self).__init__() self._active_container_type = None self._active_generator = None self._container_types = [] self._event_data_identifier_mappings = {} self._event_data_parser_mappings = {} self._event...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n\n self.reader = reader.Reader()", "def __init__(self, storage_writer, task, redis_client=None):\n super(RedisMergeReader, self).__init__(storage_writer)\n self._active_container_type = None\n self._container_types = []\n self._active_cursor = 0\n self._add_active_conta...
[ "0.62885654", "0.58362806", "0.57856005", "0.5741826", "0.5728234", "0.5686032", "0.5671583", "0.55968064", "0.55951667", "0.55562574", "0.5551261", "0.5526546", "0.5510841", "0.54997456", "0.54607743", "0.54495597", "0.54392564", "0.54389495", "0.5437427", "0.5426284", "0.53...
0.70713705
0
Closes the merge reader.
def Close(self): self._task_storage_reader.Close() self._task_storage_reader = None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close(self):\n self.read1_batch = None\n self.read2_batch = None\n self.writer.close()", "def close(self) -> None:\n self._data_read_thread_exit.set()\n self._plc_raw_reader.close()", "def close(self):\n\n self.r.close()", "async def close(self):\n self.wr...
[ "0.666458", "0.6577255", "0.65621406", "0.63686776", "0.6257405", "0.612783", "0.6073545", "0.60268825", "0.6012104", "0.597271", "0.59165436", "0.59048855", "0.58956796", "0.58956796", "0.58783615", "0.58691126", "0.58595616", "0.5842735", "0.5793702", "0.57903874", "0.57751...
0.5807931
18
Adds an attribute container.
def AddAttributeContainer(self, container): if container.CONTAINER_TYPE == self._CONTAINER_TYPE_EVENT: event_data_identifier = container.GetEventDataIdentifier() event_data_lookup_key = event_data_identifier.CopyToString() event_data_identifier = self._event_data_identifier_mappings.get( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_attributes(self, attrs):\n self.attrs.add_container(attrs)", "def AddAttributeContainer(self, container):\n self._RaiseIfNotWritable()\n\n self._storage_file.AddAttributeContainer(container)\n\n if container.CONTAINER_TYPE == self._CONTAINER_TYPE_ANALYSIS_REPORT:\n self._UpdateAnalys...
[ "0.75477207", "0.7508515", "0.74494576", "0.6670482", "0.66451406", "0.6619809", "0.64255786", "0.63276106", "0.63160694", "0.6293641", "0.6259919", "0.62502015", "0.61483186", "0.6022993", "0.6013706", "0.59946126", "0.5993446", "0.5952222", "0.5945296", "0.5908125", "0.5889...
0.73643523
3
Reads attribute containers from a task store into the writer.
def MergeAttributeContainers(self, maximum_number_of_containers=0): if not self._container_types: self._container_types = list(self._CONTAINER_TYPES) if not self._active_container_type: logger.debug('Starting merge') else: logger.debug('Continuing merge of: {0:s}'.format( self._...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_attributes(self, dataset):\n if 'attributes' in self.configs:\n for key, value in self.configs['attributes'].items():\n setattr(dataset, key, value)", "def testGetAttributeContainers(self):\n redis_client = self._CreateRedisClient()\n\n test_store = redis_store.Red...
[ "0.5800981", "0.5413162", "0.5282194", "0.4992944", "0.4942496", "0.4919056", "0.4915868", "0.48092586", "0.47643942", "0.4708785", "0.46842325", "0.46792078", "0.46767762", "0.4647595", "0.46118864", "0.4574277", "0.45592013", "0.45582253", "0.4555862", "0.4551604", "0.45465...
0.0
-1
Handle page head and create dict with different content
def handle_page_head(self, head_content): return_dict = {} return_dict['title'] = self.find_in_content(r'title:.+', head_content) return_dict['permalink'] = self.find_in_content(r'permalink:.+', head_content) return return_dict
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ParsePageHead(read):\n page_head = {}\n result = struct.unpack_from(PageHeadFormat, read, 0)\n for i in xrange(len(PageHeadProperties)):\n page_head[PageHeadProperties[i]] = result[i]\n return page_head", "def handle_page_body(self, body_content):\n return_dict = {}\n return_...
[ "0.65806377", "0.6083205", "0.59432834", "0.59213173", "0.5893205", "0.58655334", "0.5822796", "0.5818106", "0.58166486", "0.57890755", "0.57307625", "0.5705943", "0.5701683", "0.5639737", "0.5633458", "0.56205946", "0.557755", "0.5573049", "0.5549238", "0.5528069", "0.552551...
0.8366756
0
Handle page body and create page dict
def handle_page_body(self, body_content): return_dict = {} return_dict['content'] = self.markdown_to_html(body_content) return return_dict
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_mapping_page(self, id, body):\n info = {}\n info['original'] = self.__re_search(body, *self.regx['original'])\n info['save'] = self.__re_search(body, *self.regx['save'])\n info['price'] = self.__re_search(body, *self.regx['price'])\n info['rebate'] = self.__re_search(bo...
[ "0.64590585", "0.6278418", "0.6139448", "0.5948847", "0.5872562", "0.5811106", "0.57711333", "0.57591534", "0.5752565", "0.57495147", "0.5747665", "0.5722854", "0.5712628", "0.571118", "0.5696923", "0.5694322", "0.5614354", "0.56108755", "0.56095475", "0.5606405", "0.5568982"...
0.7880545
0
Read pages and save the instance into database
def read_pages(self): for file in os.listdir(self.repo_path): if file.endswith('.md'): if str(file) is not ('README.md' or '404.md'): with open(self.repo_path + file, 'r') as page_file: file_data = page_file.read() c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save(self, *args, **kwargs):\n created = False\n if self.pk is None:\n created = True\n super(Base, self).save(*args, **kwargs)\n if created is True:\n for i in range(self.page_count):\n page = Page(work=self, number=i+1)\n page.sa...
[ "0.6114496", "0.60416394", "0.59844977", "0.59610665", "0.5876366", "0.5847255", "0.57638466", "0.5758273", "0.57403046", "0.57091016", "0.5637539", "0.5621401", "0.55633825", "0.5521344", "0.5509448", "0.55065763", "0.5492751", "0.54720575", "0.5468598", "0.54553676", "0.540...
0.6453269
0
read all files that we want at any time. we have to pass the extension and exception_list. exception_list will contain the list of all the files that should'nt be scanned. repo is the Repo db instance
def read_pages(self, repo, extension, exception_list): for file in os.listdir(self.repo_path): if file.endswith('.'.join(['', extension])): if file not in exception_list: file_handler = FileHandler(self.repo_path, file) content = file_handler.r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_files_with_extension(self, extension=sys.argv[1]) -> list:\n if extension == \"\":\n raise EnvironmentError(\"No extension provided!\")\n\n result = []\n for idx, file in enumerate(self.file_list):\n if re.search(extension + \"$\", file):\n result.a...
[ "0.6206179", "0.6107929", "0.6043444", "0.593927", "0.58915067", "0.58556247", "0.57860583", "0.57807255", "0.5777453", "0.5773534", "0.5771638", "0.57592523", "0.57556206", "0.5750356", "0.5739557", "0.57273585", "0.57255244", "0.57110775", "0.5685773", "0.56543374", "0.5647...
0.72571635
0
Start a daemon thread.
def kick_off(self): if self.status == self.stage + "_script" + "_ready": self.status = self.stage+"_running" self._update_status() p = Process(target=process_kick_off, args=(self.setting, self.script_dir, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _start_thread(self, fn, daemon=False):\n daemon = Thread(target=fn, daemon=daemon)\n daemon.start()", "def start_daemon(self, *args, **kwargs):\n pass", "def start(self) -> None:\n self.should_exit = False\n self._main_thread = threading.Thread(target=self._wrap_start, da...
[ "0.7886493", "0.7687948", "0.7490176", "0.74892354", "0.7463265", "0.73720425", "0.73632795", "0.73606414", "0.73606414", "0.73606414", "0.73606414", "0.7244983", "0.713184", "0.7104449", "0.7020524", "0.6900436", "0.6887967", "0.6858836", "0.67236525", "0.6631534", "0.661675...
0.0
-1
Update status to database
def _update_status(self): self._db_update({'status': self.status})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def updateStatus(self, status):\n pass", "def UpdateStatus(self, status):\r\n self.status.update(status)", "def updatestatus(self):\n self.status = self.query()\n if self.status['success']:\n return True\n else:\n return False", "def update_status(request_...
[ "0.8104977", "0.7823668", "0.7671553", "0.74507135", "0.7403075", "0.73636246", "0.72525454", "0.725253", "0.72357446", "0.7171517", "0.7166486", "0.70517457", "0.7043152", "0.7029378", "0.7019931", "0.6978809", "0.69682807", "0.6892425", "0.68785965", "0.6876388", "0.6852951...
0.90569335
0
Process environment to run a job.
def process_kick_off(setting, script_dir, stage): print("Info: run started for %s."%script_dir) run_dir = setting['run_dir'] _id = setting['_id'] process = subprocess.Popen("/bin/bash %s"%(script_dir), shell=True) process_pid = process.pid db = db_connector() db.run.update_one({'_id': _id}, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_env(self, job, private_data_dir, private_data_files=None):\n env = super(RunJob, self).build_env(job, private_data_dir, private_data_files=private_data_files)\n if private_data_files is None:\n private_data_files = {}\n # Set environment variables needed for inventory and ...
[ "0.6484504", "0.63290864", "0.61382174", "0.61110395", "0.6017838", "0.5864727", "0.574876", "0.56816065", "0.56475335", "0.56380653", "0.56336087", "0.5619758", "0.5615859", "0.56025904", "0.5592658", "0.55919296", "0.559164", "0.5563601", "0.55622053", "0.5527674", "0.55165...
0.0
-1
A run step will contain 3 stage, and run_dir created in the train stage.
def _create_run_dir(self): task_name = 'task_'+str(self.setting['task_id']) run_name = '_'.join(['run', str(self.setting['run_idx']), str(self.setting['_id'])]) run_dir = op.join(Job_Requestor.run_center, task_name, run_name) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train_step(self):\n pass", "def do_run(run, dirname, args):\n with tf.Graph().as_default():\n learner_assumptions = get_learner_assumption_kwargs(args)\n\n # Each run has a different random seed equal to the run id.\n np.random.seed(run)\n random.seed(run)\n\n is_...
[ "0.6543632", "0.6523984", "0.6473349", "0.6370569", "0.6366125", "0.62685615", "0.6171947", "0.60079527", "0.600611", "0.59939355", "0.5971192", "0.5918415", "0.5898618", "0.58898205", "0.5867497", "0.5855395", "0.5853683", "0.58412033", "0.58245564", "0.5821443", "0.5776301"...
0.5966843
11
Function to generate distributed training scripts.
def generate_disttrain_scipts(self): train_py = "/home/haihuam/Projects/RepPoints/mmdetection/tools/train.py" py = self.global_setting.get('python', sys.executable) ex_options = self.global_setting.get('train_options', str()) if not os.access(py, os.X_OK): py = "/home/haihua...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def script_generator(self):\n\n self._get_free_tcp_port()\n\n train_py = \"/home/haihuam/Projects/RepPoints/mmdetection/tools/train.py\"\n py = self.global_setting.get('python', sys.executable)\n ex_options = self.global_setting.get('train_options', str())\n\n if not os.access(py...
[ "0.7570193", "0.724141", "0.7049878", "0.6241078", "0.6189553", "0.6151004", "0.6111944", "0.6034311", "0.60096145", "0.59790266", "0.59271824", "0.58651984", "0.5852421", "0.5842843", "0.58210456", "0.58143574", "0.5811275", "0.58090484", "0.5808338", "0.58027387", "0.580093...
0.7527086
1
Function to generate distributed training scripts.
def generate_singletrain_scipts(self): py = self.global_setting.get('python', sys.executable) ex_options = self.global_setting.get('train_options', str()) train_py = "/home/haihuam/Projects/RepPoints/mmdetection/tools/train.py" if not os.access(py, os.X_OK): py = "/home/haih...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def script_generator(self):\n\n self._get_free_tcp_port()\n\n train_py = \"/home/haihuam/Projects/RepPoints/mmdetection/tools/train.py\"\n py = self.global_setting.get('python', sys.executable)\n ex_options = self.global_setting.get('train_options', str())\n\n if not os.access(py...
[ "0.7570193", "0.7527086", "0.724141", "0.6241078", "0.6189553", "0.6151004", "0.6111944", "0.6034311", "0.60096145", "0.59790266", "0.59271824", "0.58651984", "0.5852421", "0.5842843", "0.58210456", "0.58143574", "0.5811275", "0.58090484", "0.5808338", "0.58027387", "0.580093...
0.7049878
3
Function to generate the scripts to analyze the log.
def script_generator(self): analyze_tool = "/home/haihuam/Projects/RepPoints/mmdetection/tools/analyze_logs.py" ex_options = self.global_setting.get('analyze_options', str()) py = self.global_setting.get('python', sys.executable) if os.access(py, os.X_OK): content = "set -e \...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def script_generator(self):\n py = self.global_setting.get('python', sys.executable)\n ex_options = self.global_setting.get('evaluate_options', str())\n train_py = \"/home/haihuam/Projects/RepPoints/mmdetection/tools/train.py\"\n if os.access(py, os.X_OK):\n content = \"set -...
[ "0.6372324", "0.6196502", "0.58817005", "0.5872832", "0.5843183", "0.57949096", "0.5750669", "0.5748845", "0.57101727", "0.56722856", "0.5642168", "0.56294507", "0.5594446", "0.55805284", "0.552635", "0.55260634", "0.5525768", "0.5515622", "0.5510869", "0.5489981", "0.5473564...
0.81086046
0
Function to generate distributed training scripts.
def script_generator(self): self._get_free_tcp_port() train_py = "/home/haihuam/Projects/RepPoints/mmdetection/tools/train.py" py = self.global_setting.get('python', sys.executable) ex_options = self.global_setting.get('train_options', str()) if not os.access(py, os.X_OK): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_disttrain_scipts(self):\n train_py = \"/home/haihuam/Projects/RepPoints/mmdetection/tools/train.py\"\n py = self.global_setting.get('python', sys.executable)\n ex_options = self.global_setting.get('train_options', str())\n\n if not os.access(py, os.X_OK):\n py = ...
[ "0.7527086", "0.724141", "0.7049878", "0.6241078", "0.6189553", "0.6151004", "0.6111944", "0.6034311", "0.60096145", "0.59790266", "0.59271824", "0.58651984", "0.5852421", "0.5842843", "0.58210456", "0.58143574", "0.5811275", "0.58090484", "0.5808338", "0.58027387", "0.580093...
0.7570193
0
Function to generate distributed training scripts.
def script_generator(self): py = self.global_setting.get('python', sys.executable) ex_options = self.global_setting.get('evaluate_options', str()) train_py = "/home/haihuam/Projects/RepPoints/mmdetection/tools/train.py" if os.access(py, os.X_OK): content = "set -e \n" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def script_generator(self):\n\n self._get_free_tcp_port()\n\n train_py = \"/home/haihuam/Projects/RepPoints/mmdetection/tools/train.py\"\n py = self.global_setting.get('python', sys.executable)\n ex_options = self.global_setting.get('train_options', str())\n\n if not os.access(py...
[ "0.7570193", "0.7527086", "0.7049878", "0.6241078", "0.6189553", "0.6151004", "0.6111944", "0.6034311", "0.60096145", "0.59790266", "0.59271824", "0.58651984", "0.5852421", "0.5842843", "0.58210456", "0.58143574", "0.5811275", "0.58090484", "0.5808338", "0.58027387", "0.58009...
0.724141
2
Login to retrieve a temporary Authorization token
def get(self, name, password): if not Account(name).exists(): time.sleep(1) api_v1.abort(401, "Bad credentials") if Account(name).check(password): access_token = create_access_token(identity=name) return jsonify(access_token=access_token) else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def login(self):\n r = self._login_token()", "def _login_token(self):\n data = {\n 'cmd': 'login',\n 'login': self.username,\n 'password': self.password,\n }\n \n token = self.helper._post_request(\n self.basename,\n ...
[ "0.7765029", "0.7436251", "0.7297772", "0.7242992", "0.71246564", "0.706187", "0.70572585", "0.7040267", "0.70295143", "0.69927466", "0.69232893", "0.6919958", "0.69061095", "0.6899295", "0.68976974", "0.68976974", "0.689317", "0.68893045", "0.68805665", "0.68671083", "0.6860...
0.0
-1
Parses given yaml file using requirements and defaults. Required parameters are defined in this function along with parameter defaults. Parameters are grouped by package name.
def parse_config(file): # dictionaries specifying required parameters for various modules general = ["tube_number", "tube_radius", "collision_objects_filename"] optimizers = {"nelder_mead": ["optimizer_precision", "optimize_iterations"]} solvers = {"rrt": ["step_bound", "iteration_number", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_parameters(self):\n with open(INTERNAL_DATA_DIR / self.name_default_params, 'r') as f:\n return yaml.load(f, Loader=yaml.FullLoader)", "def yamlConfigForParsingPlugins():\n parameters = \"\"\"\njoinPaths: !joinPaths\n - a\n - b\n - \"c\"\nrunPageTemplates: !findRunPageTempl...
[ "0.60205275", "0.5976597", "0.59591246", "0.5929077", "0.58939296", "0.58272904", "0.5821543", "0.5787672", "0.5710688", "0.5634528", "0.56288314", "0.5624165", "0.5618275", "0.5608895", "0.55601114", "0.55350167", "0.55314714", "0.5524504", "0.5521616", "0.5514817", "0.55096...
0.548502
23
Validates and modifies the dictionary Checks tube number against given radii, max tube lengths, and given q_dof. Checks that the lengths are all divisible by delta_x and raises an error if not.
def config_validation(configuration): tube_num = configuration.get('tube_number') q_dof = configuration.get('q_dof') radius = configuration.get('tube_radius') delta_x = configuration.get('delta_x') tube_lengths = configuration.get('tube_lengths') if isinstance(q_dof, int): configuration...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check(self):\n # check for nonsense or missing mandatory parameters\n mdp = self.parameters.get( \"md\", [] )\n fp = self.parameters.get( \"files\", [] )\n ip = self.parameters.get( \"intervals\", [] )\n\n for keyword in (\"temperature\", \"steps\", \"stepsize\"):\n ...
[ "0.52189726", "0.5177317", "0.5169023", "0.51312196", "0.5052218", "0.50168866", "0.4954876", "0.48952448", "0.4873793", "0.4869507", "0.48316526", "0.48261344", "0.4816464", "0.47993284", "0.4798235", "0.47845814", "0.47829345", "0.47609234", "0.47100845", "0.46791354", "0.4...
0.6384456
0
Helper function that sets parameters for given package type. Gets the list of required parameters for the module specified by the config_key entry in the config. Adds these parameters to the config, if they exist; if not, sets to the default values with a printed message detailing the omission.
def _config_helper(config_key, required_dict, config, filename, defaults): this_type = config.get(config_key) if this_type not in required_dict: config[config_key] = defaults.get(config_key) print(f"{config_key} {this_type} does not exist. Using default of " f"{defaults.get(config_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assert_config_required(self, key: str, type_):\n\n self.config_required[key] = type_", "def update_config(self, config):\n self.config = {\n \"display_name\": \"\",\n \"description\": \"\",\n \"required\": 1,\n \"type\": \"string\"\n }\n ...
[ "0.5927595", "0.543951", "0.543951", "0.5400199", "0.53748196", "0.53700477", "0.5367941", "0.53294605", "0.53097403", "0.5300128", "0.5266753", "0.52600294", "0.52449757", "0.5216351", "0.52057993", "0.5176022", "0.51694614", "0.51691985", "0.51570326", "0.5136258", "0.51111...
0.53431654
7
code_ranges is a list of lists
def icd9_in_code_range(val, code_ranges): return any(val <= code_range[1] and val >= code_range[0] for code_range in code_ranges)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def merge_ranges():", "def summarize_ranges(self, ranges):\n if len(ranges) == 0: return []\n min_ = 'min'\n max_ = 'max'\n for r in ranges:\n if r[0][0] == \"min\":\n r[0][0] = min_\n else:\n min_ = r[0][0]\n if r[-1][1] ...
[ "0.68527627", "0.6253134", "0.6252875", "0.61829406", "0.61572516", "0.61479306", "0.612069", "0.6090808", "0.60688955", "0.60551345", "0.60524595", "0.5867531", "0.58523124", "0.58206266", "0.5810372", "0.5810281", "0.5805071", "0.5775448", "0.57740957", "0.57708406", "0.576...
0.60457057
11
Takes an object and returns a list of names of all the methods in that class
def classmethods(class_object): fn_tuple_list = inspect.getmembers(class_object, predicate=inspect.ismethod) fn_names = [ f_name for (f_name, method) in fn_tuple_list if not f_name.startswith("_") ] return fn_names
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def methods_of(obj):\r\n result = []\r\n for i in dir(obj):\r\n if callable(getattr(obj, i)) and not i.startswith('_'):\r\n result.append((i, getattr(obj, i)))\r\n return result", "def lookup(obj):\n objList = [method_name for method_name in dir(obj)\n if callable(geta...
[ "0.81180924", "0.77584505", "0.7427535", "0.7369807", "0.7367492", "0.7268082", "0.7225354", "0.70353705", "0.70313483", "0.70313483", "0.7011768", "0.6934401", "0.6904447", "0.68782264", "0.68726104", "0.6863157", "0.6825215", "0.6760233", "0.67479444", "0.67468894", "0.6688...
0.8122183
0
Takes a function as parameter and returns a list of argument names
def argnames(method): return [arg for arg in method.__code__.co_varnames if arg != "self"]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def arguments_from_funccode(f):\n fc = fc_or_c(f)\n vnames = fc.co_varnames\n nargs = fc.co_argcount\n # bound method and fake function will be None\n args = vnames[1 if is_bound(f) else 0:nargs]\n if not args:\n raise RuntimeError('Function has variable number of arguments')\n return l...
[ "0.7419391", "0.7338321", "0.70527124", "0.6997746", "0.6993407", "0.69520026", "0.6950231", "0.6946659", "0.68849266", "0.6846403", "0.6641554", "0.6599002", "0.6593807", "0.6548676", "0.6548385", "0.6535864", "0.65309715", "0.65237266", "0.6499961", "0.6365761", "0.63627267...
0.7037488
3
Returns name of class of an instance as a str
def classname(class_object): return class_object.__class__.__name__
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def instance_class_name(instance):\n return class_name(instance.__class__)", "def instance_class_name(instance):\n return class_name(instance.__class__)", "def getclassname(instance_or_cls):\n return getclass(instance_or_cls).__name__", "def className(self):\n namevalue = self.__class__.__nam...
[ "0.8504247", "0.8504247", "0.83157873", "0.8211755", "0.8108531", "0.8108531", "0.8054307", "0.7942855", "0.7918502", "0.7893028", "0.7857822", "0.7854775", "0.77941525", "0.7652028", "0.75155056", "0.75007874", "0.7458795", "0.74195534", "0.74195534", "0.7388337", "0.7353441...
0.76834095
13
Train the model with a given training set.
def train(self, training_set, missing_residues=None, use_aic=False): if not self.show_warnings: warning_list = warnings.filters[:] warnings.filterwarnings('ignore', category=TorusDBNWarning) if missing_residues is not None: missing_residues = read_missing...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train(self, training_set):\n self.originModel.train(training_set)\n return self", "def train(self, training_set):\n\n lengths = [ seq.shape[0] for seq in training_set ]\n\n #preprocessing the training set to obtain the desired shape\n concatenated_set = self.preprocessing(...
[ "0.8236125", "0.810741", "0.80620813", "0.7919706", "0.7710924", "0.7675048", "0.7651888", "0.76291656", "0.7588788", "0.75395983", "0.75060767", "0.7495371", "0.74554676", "0.7392441", "0.7390008", "0.73750174", "0.73489285", "0.73284245", "0.731839", "0.7304062", "0.7304062...
0.0
-1
The Akaike information criterion (AIC) is a measure of the relative goodness of fit of a statistical model. Akaike, Hirotugu (1974). "A new look at the statistical model
def calculate_AIC(self): hmm_ll_calculator = LikelihoodInfEngineHMM( dbn=self.model.dbn, hidden_node_index=0, check_dbn=False) ll_full = hmm_ll_calculator.calc_ll(self.seq_list, self.mismask_list) return 2 * ll_full - 2 * self._get_parameter_count()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_aic_ms(distribution):\n print(\"TESTING: AIC model selection for %s distribution\" % distribution.upper())\n params = dist.DISTRIBUTIONS[distribution][dist.KEY_TEST_PARAMS]\n print(\" creating sample\")\n test_sample = dist.samples(distribution, params)\n print(\" calculating AIC for all ...
[ "0.7080638", "0.67313176", "0.66234607", "0.6486055", "0.61601174", "0.6079734", "0.6033591", "0.57279545", "0.57276684", "0.563323", "0.56095815", "0.555238", "0.5534736", "0.5459357", "0.5456556", "0.54511565", "0.5418131", "0.5415451", "0.5370663", "0.5346118", "0.5329103"...
0.6961269
1
The Bayesian information criterion (BIC) is a criterion for model selection among a finite set of models. Schwarz, Gideon E. (1978). "Estimating the dimension of a model". Annals
def calculate_BIC(self): hmm_ll_calculator = LikelihoodInfEngineHMM( dbn=self.model.dbn, hidden_node_index=0, check_dbn=False) ll_full = hmm_ll_calculator.calc_ll(self.seq_list, self.mismask_list) return 2 * ll_full - self._get_parameter_count() * math.log( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_bic_ms(distribution):\n print(\"TESTING: BIC model selection for %s distribution\" % distribution.upper())\n params = dist.DISTRIBUTIONS[distribution][dist.KEY_TEST_PARAMS]\n print(\" creating sample\")\n test_sample = dist.samples(distribution, params)\n print(\" calculating BIC for all ...
[ "0.6738231", "0.6541316", "0.6489599", "0.63965064", "0.6255589", "0.61559856", "0.6112755", "0.6090768", "0.59615993", "0.59547305", "0.59203905", "0.59203905", "0.58714235", "0.5793341", "0.5740092", "0.57190186", "0.56444794", "0.5625056", "0.5620049", "0.5608862", "0.5584...
0.68793404
0
Check whether likelihood is oscilating during the training.
def __get_hairiness(self, ll_list): for j in xrange(self.convergence_window, len(ll_list)): match=0 for i in xrange(self.convergence_window): # Test if likelihood is oscillating if (ll_list[j-i] > ll_list[j-i+1] and ll_list[j-i] > ll_list[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_artificial(self):\n\t\treturn 0", "def sanity_check(self):\n res = True\n res = res and self.detected\n res = res and np.sum(self.diffs) < 30000 # experimental value\n return res", "def accept_move(misfit_current, likelihood_current, misfit_proposednext):\n if misfit_prop...
[ "0.6125425", "0.6125098", "0.6034057", "0.5971424", "0.59698826", "0.59594226", "0.59022266", "0.5869513", "0.58606696", "0.5846239", "0.5841704", "0.5766215", "0.57316715", "0.57314795", "0.57080024", "0.57065547", "0.5668403", "0.5638142", "0.5593511", "0.5579463", "0.55629...
0.5925486
6
Create sequence and mismask (mask that identifies values as hidden, observed or missing) from a training set.
def _create_sequence_and_mismask(self, training_set, missing_residues): seq_list = [] mismask_list = [] if not self.show_warnings: warning_list = warnings.filters[:] warnings.filterwarnings('ignore', category=TorusDBNWarning) training_set_cou...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _compute_masked_targets(self, item_ids: tf.Tensor, training: bool = False) -> MaskingInfo:\n\n labels = tf.cast(tf.fill(item_ids.shape, self.padding_idx), dtype=item_ids.dtype)\n non_padded_mask = tf.cast(item_ids != self.padding_idx, labels.dtype)\n rows_ids = tf.range(labels.shape[0], dt...
[ "0.62820804", "0.60834235", "0.5759483", "0.57154673", "0.56921595", "0.5655835", "0.56276035", "0.5595453", "0.55943155", "0.55873364", "0.55382186", "0.5523225", "0.54959726", "0.5485287", "0.54780704", "0.54613227", "0.5454266", "0.5439734", "0.5433462", "0.5433462", "0.54...
0.6283801
0
Optimization method to find the best size for the hidden node according to a training set.
def find_optimal_model( self, training_set, use_aic=False, min_node=10, max_node=90, start_size=20, end_size=5, node_samples=4, check_decreasing_ll=False, missing_residues=None): if not self.show_warnings: warning_list = warnings.filters[:] warnings....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_hidden_layer_size(self):\r\n return self.hidden_layer_size", "def get_num_hidden(self) -> int:\n return self.config.model_size", "def get_n_best(self):\n pass", "def get_final_emb_size(self):\n size = self.n_layers * 1 * 2 * self.hidden_size\n return size", ...
[ "0.5985635", "0.5964452", "0.593218", "0.58241916", "0.58158845", "0.58039904", "0.5761179", "0.5725219", "0.5707045", "0.5702115", "0.5667222", "0.56550604", "0.5606332", "0.5548744", "0.5548744", "0.5546417", "0.55433387", "0.5542178", "0.5492614", "0.5483099", "0.5469575",...
0.6054712
0
Print a message to the standard output, in case show_info is enabled.
def info(self, message): if self.show_info: print(message)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_info(msg):\n print(msg)", "def show_info(title, message):\n\n pass", "def print_info(message: str):\n global verbose\n if verbose:\n print(\"%s%s%s\" % (KYEL, message, KNRM))", "def info(msg, *args):\n if args:\n msg %= args\n click.echo(msg, file=sys.stdout)", "de...
[ "0.78605205", "0.7734865", "0.76229465", "0.7563187", "0.7400993", "0.73952097", "0.7378441", "0.7370511", "0.7139444", "0.7125532", "0.7115362", "0.71005535", "0.7092673", "0.70315975", "0.70026535", "0.6999533", "0.69383913", "0.69325316", "0.6913429", "0.6901743", "0.68721...
0.83142126
0
Get the current TorusDBN model.
def get_model(self): return self.model
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_model(self):\n # just return the first model, since all replicas are the same\n return self.call_async(0, '_async_get_model').gen()", "def get_model(self):\n return self.model.module if isinstance(self.model, DDP) else self.model", "def get_model(self):\n return self._model"...
[ "0.7258813", "0.72392356", "0.70535207", "0.70535207", "0.701487", "0.69739246", "0.6939528", "0.69378126", "0.69378126", "0.69378126", "0.69378126", "0.69378126", "0.693138", "0.6896313", "0.688577", "0.6831938", "0.6797406", "0.677369", "0.67602867", "0.6741396", "0.6736469...
0.7090027
11
The total number of observations.
def _get_observation_count(self): observation_count = 0 for sequence in self.seq_list: observation_count += sequence.shape[0] return observation_count
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getTotalIndividualCount(self):\r\n return self._n", "def count_data(self):\n try:\n ndata = len(self.x)\n logger.info(\"Number of data points: {0}\".format(ndata))\n except AttributeError:\n logger.error(\"Data object has not been defined\")\n ...
[ "0.7855842", "0.7715139", "0.76306987", "0.7599567", "0.757905", "0.74909234", "0.7462525", "0.74385345", "0.74164623", "0.73858225", "0.73710364", "0.73710364", "0.73710364", "0.7346027", "0.73373866", "0.7333386", "0.7324687", "0.73124564", "0.72969145", "0.7296742", "0.726...
0.7648131
2
The number of parameters.
def _get_parameter_count(self): parameters_d = 5; size_h = self.model.size_h return (size_h - 1) + size_h * ( (size_h - 1) + parameters_d + (self.model.size_aa - 1) + (self.model.size_ss - 1) + (self.model.size_cis - 1) )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def num_params(self):", "def number_of_parameters(self):\n return len(self.parameters)", "def _n_parameters(self):\n raise NotImplementedError", "def num_parameters(self) -> int:\n return len(self) * self.convention.value", "def get_num_parameters(self):\n return len(self.parame...
[ "0.90070146", "0.89986014", "0.89931357", "0.8770135", "0.8762096", "0.867157", "0.866098", "0.8596319", "0.85476184", "0.85042757", "0.8387441", "0.83733743", "0.83527464", "0.8283258", "0.8156946", "0.81524104", "0.8139067", "0.80919164", "0.8061227", "0.8043313", "0.804074...
0.77220786
28
Does the url contain a downloadable resource
def is_downloadable(url): h = requests.head(url, allow_redirects=True) header = h.headers content_type = header.get('content-type') if 'text' in content_type.lower(): return False if 'html' in content_type.lower(): return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_downloadable(url) -> bool:\n content_type = requests.head(url, allow_redirects=True).headers.get('content-type')\n if 'text' in content_type.lower() or 'html' in content_type.lower():\n return False\n return True", "def is_downloadable(self):\n return True", "def is_downloadable(s...
[ "0.7863911", "0.76044476", "0.75145316", "0.74376166", "0.736647", "0.7229701", "0.71826774", "0.7152465", "0.71362215", "0.70722294", "0.7068388", "0.70574546", "0.7050864", "0.6838795", "0.6838795", "0.6756243", "0.67460054", "0.66819596", "0.66469514", "0.6644246", "0.6609...
0.7924052
0
Go to the given workspace number.
def go_to(i3: i3ipc.Connection, workspace: int): i3.command(f"workspace number {workspace}")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def change_workspace(num):\n LOGGER.debug('change_workspace: requested workspace {}'.format(num))\n output = get_focused_output()\n prefix = get_workspace_prefix(output)\n ws_num = get_workspace_num(prefix, num)\n workspace = get_workspace(ws_num, prefix, num)\n result = switch_workspace(f'{works...
[ "0.71325797", "0.6187763", "0.6157023", "0.59943575", "0.5943539", "0.5912566", "0.58262795", "0.57753295", "0.5770139", "0.55275774", "0.5519753", "0.5467741", "0.54426324", "0.5431287", "0.5407863", "0.5407681", "0.5323033", "0.5264269", "0.5262899", "0.5244698", "0.5241639...
0.79520303
0
Move the focused container to the given workspace.
def move_to(i3: i3ipc.Connection, workspace: int): i3.command(f"move container to workspace number {workspace}")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_container(i3, name, monitor, container_id=None):\n i3.command(f'move container to workspace {name}')\n i3.command(f'workspace {name}, move workspace to output {monitor}')\n if container_id:\n i3.command(f'[con_id=\"{container_id}\"] focus')", "def set_workspace(client, workspace):\n d...
[ "0.72039133", "0.56448215", "0.55889195", "0.5587443", "0.5435935", "0.5378369", "0.5328443", "0.52069813", "0.5197307", "0.51802254", "0.50865215", "0.50180376", "0.50041604", "0.49425906", "0.48882422", "0.48878294", "0.4881337", "0.48195142", "0.4800425", "0.4756636", "0.4...
0.73667777
0
Find the workspace to switch to. If the current workspace is a target, go to the next target. If the current workspace isn't a target, go to the first open target.
def get_target_workspace(current_workspace, open_workspaces, target_workspaces): logger.debug('get_target_workspace(current: %s, open: %s, targets: %s)', current_workspace, open_workspaces, target_workspaces) if len(target_workspaces) <= 0: logger.debug('No workspaces given - defaultin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def go_to(i3: i3ipc.Connection, workspace: int):\n i3.command(f\"workspace number {workspace}\")", "def next_workspace(self, flag='next'):\n non_visible_workspaces = filter(lambda w: not w['visible'],\n self.get_workspaces())\n\n if non_visible_workspaces =...
[ "0.60954845", "0.58509964", "0.5680681", "0.56290454", "0.54656833", "0.53953046", "0.5384196", "0.53578043", "0.529885", "0.5252498", "0.520959", "0.52038735", "0.51325685", "0.50813437", "0.50762445", "0.5061682", "0.50541234", "0.5039189", "0.50001895", "0.49859533", "0.49...
0.73417485
0
Get the number of the current workspace.
def get_current_workspace_num(i3: i3ipc.Connection): return i3.get_tree().find_focused().workspace().num
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def workspace_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"workspace_id\")", "def workspace_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"workspace_id\")", "def workspace_id(self) -> str:\n return pulumi.get(self, \"workspace_id\")", "def workspace_id(self) -...
[ "0.70615363", "0.70615363", "0.70028317", "0.70028317", "0.68003416", "0.6721158", "0.67083037", "0.6684436", "0.6620677", "0.6572125", "0.6547534", "0.6448233", "0.6448233", "0.6275984", "0.6210025", "0.616503", "0.6121598", "0.6117455", "0.6078367", "0.6078367", "0.6078367"...
0.81946534
0
Get the numbers of open workspaces.
def get_open_workspaces(i3: i3ipc.Connection): return [ws.num for ws in i3.get_tree().workspaces()]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_opened_windows_list():\n\n global opened_windows_names\n EnumWindows(EnumWindowsProc(foreach_window), 0)\n return opened_windows_names", "def get_open_disk_space(self):\n count = 0\n for i in range(self.size):\n if self.disk_mem[i]==\".\":\n count += 1\n ...
[ "0.64218664", "0.63412476", "0.61509293", "0.6022424", "0.60122925", "0.5947481", "0.5943279", "0.5939426", "0.59035146", "0.58829737", "0.5813977", "0.57102287", "0.56623214", "0.56597006", "0.5650875", "0.5648794", "0.56483734", "0.5648095", "0.5639259", "0.5620538", "0.561...
0.7764141
0
We mock the call to ActivityStream
def test_search_view(client): with patch('search.helpers.search_with_activitystream') as search: mock_results = json.dumps( { 'took': 17, 'timed_out': False, '_shards': {'total': 4, 'successful': 4, 'skipped': 0, 'failed': 0}, 'hit...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_activity(self):\n pass", "def test_get_activity(self):\n pass", "def test_get_stream(self):\n pass", "def test_stream_publish(self):\n pass", "def test_meeting_live_stream_update(self):\n pass", "def test_workflows_change_stream_get(self):\n pass", ...
[ "0.6981633", "0.6981633", "0.69358", "0.673582", "0.6572297", "0.6561777", "0.65350914", "0.65160114", "0.63600963", "0.63600963", "0.63470894", "0.63404083", "0.62458944", "0.6218481", "0.6211634", "0.6186519", "0.6151537", "0.6102448", "0.60806936", "0.59994423", "0.5920417...
0.5863266
23
Provides an ndimensional parallel iterator that generates index tuples for each iteration point. Sequentially, pndindex is identical to np.ndindex.
def pndindex(*args): return np.ndindex(*args)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pndindex(*args):\n return np.ndindex(*args)", "def master_ndindex(self): # itermaster_indices(self):\n return itertools_product(\n *[range(*r) for r in self.location]\n ) # TODO check", "def _get_index_iterator(indexes, length):\n return combinations(indexes, length)", ...
[ "0.698849", "0.67596734", "0.6384372", "0.6358893", "0.6060668", "0.5980556", "0.59671396", "0.59533405", "0.58904546", "0.583905", "0.57712317", "0.57544845", "0.57544845", "0.57114184", "0.56809837", "0.5676592", "0.5672165", "0.5670588", "0.5669132", "0.5669132", "0.563339...
0.69749606
1
Initializes a new ``StreamingHandler``
def __init__( self, stream: TextIOWrapper, name: Optional[str] = None, level: Optional[LogLevel] = None, ): self.stream: TextIOWrapper = stream super().__init__(name=name, level=level)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_stream_handler(\n self, \n logger, \n loop, \n netconf_ip, \n netconf_port,\n statistics,\n xml_to_json_translator):\n self._logger = logger\n self._asyncio_loop = loop\n self._encoding = \"xml\"\n sel...
[ "0.7229474", "0.6860277", "0.66557497", "0.66515875", "0.66515875", "0.66443104", "0.660984", "0.6570745", "0.64102125", "0.638577", "0.63654643", "0.6354286", "0.6353217", "0.63436896", "0.6324287", "0.6289065", "0.6260624", "0.62495697", "0.62406313", "0.623029", "0.623029"...
0.5809078
53
Writes the full log entry to a configured stream
def write(self, message: str, level: LogLevel) -> None: if level >= self.min_level: self.stream.write(message)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _writeLog (self, item):\n self.log.write (item.encode (self.logEncoding))\n self.log.write (b'\\n')\n # instead of locking, check we’re running in the main thread\n if self.log.tell () > self.maxLogSize and \\\n threading.current_thread () is threading.main_thread ():...
[ "0.65572536", "0.64755356", "0.6350549", "0.6347381", "0.6335092", "0.6318135", "0.62677616", "0.62644315", "0.6250166", "0.6086238", "0.60699415", "0.60698074", "0.6056047", "0.60518456", "0.6018502", "0.60063845", "0.5952854", "0.59488386", "0.5948345", "0.594813", "0.59023...
0.0
-1
Creates the name for the handler called from ``__init__`` if a name is not given.
def _create_name(self) -> str: return self.stream.__class__.__name__
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __set_name__(self, cls, name):\n pass", "def _get_name(cls, **kwargs: Any) -> str:\n raise NotImplementedError('Subclasses must implement this method.') # pragma: no cover", "def __init__(__self__, *,\n name: pulumi.Input[str]):\n pulumi.set(__self__, \"name\", name)",...
[ "0.62612844", "0.61916685", "0.6182883", "0.61657673", "0.6151574", "0.61496806", "0.6144922", "0.61412007", "0.61395377", "0.61388636", "0.61388636", "0.61388636", "0.61388636", "0.61388636", "0.61388636", "0.6127988", "0.6106006", "0.60805684", "0.60805684", "0.60805684", "...
0.6380641
0
Initializes a new ``StdOutHandler``
def __init__( self, name: Optional[str] = "stdout", level: Optional[LogLevel] = None ): super().__init__(name=name, level=level, stream=stdout)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, UI, strm=None):\n logging.Handler.__init__(self)\n # replace Handler's instance-specific lock with the shared class lock\n # to ensure that only one instance of this handler can write to\n # the console at a time\n self.lock = TerminalHandler.sharedlock\n ...
[ "0.7315729", "0.6732507", "0.66628474", "0.6601927", "0.64137137", "0.63443863", "0.6217379", "0.61049914", "0.60902756", "0.5937705", "0.5926769", "0.5925762", "0.5896303", "0.5818868", "0.5801836", "0.5721819", "0.57171315", "0.5713157", "0.5690763", "0.56885356", "0.568552...
0.5459419
30
Initializes a new ``StdErrHandler``
def __init__( self, name: Optional[str] = "stderr", level: Optional[LogLevel] = None ): super().__init__(name=name, level=level, stream=stderr)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, UI, strm=None):\n logging.Handler.__init__(self)\n # replace Handler's instance-specific lock with the shared class lock\n # to ensure that only one instance of this handler can write to\n # the console at a time\n self.lock = TerminalHandler.sharedlock\n ...
[ "0.67312557", "0.61103314", "0.57938576", "0.5744193", "0.5707165", "0.5694952", "0.56396174", "0.56094813", "0.55404145", "0.5531009", "0.55161536", "0.54900914", "0.54808664", "0.5460166", "0.5435066", "0.54107255", "0.5393115", "0.53788733", "0.53571993", "0.5352271", "0.5...
0.5435048
15
Attempts to cache `objdoc` for module `modname`.
def __setitem__(self, modname: str, objdoc: Objdoc): spec = importlib.util.find_spec(modname) if spec.origin is None: raise CannotCache(f"not a module file; can't cache: {modname}") path = self.__get_path(spec) path = path.parent / (path.name + ".json.gz") check = _g...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __put_module_in_sys_cache(module_name, module_obj):\n #try:\n #if hasattr(sys, 'stypy_module_cache'):\n sys.stypy_module_cache[module_name] = module_obj\n # else:\n # __preload_sys_module_cache()\n # sys.stypy_module_cache[module_name] = module_obj\n # except:\n ...
[ "0.636846", "0.60199344", "0.5941785", "0.5705336", "0.56785536", "0.56135726", "0.5584943", "0.54140854", "0.53702223", "0.5348207", "0.5324705", "0.52313477", "0.51907396", "0.51213115", "0.50879973", "0.5077939", "0.5061241", "0.50270915", "0.49785343", "0.49644643", "0.49...
0.66609263
0
True if `path` is a subpath of `other`.
def is_subpath(path: Path, other: Path): try: Path(path).relative_to(other) except ValueError: return False else: return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_sub(parent, path):\n parent = canonical_path(parent, resolve_link=False)\n path = canonical_path(path, resolve_link=False)\n return os.path.commonprefix([parent, path]) == parent", "def _issubpath(self, a, b):\n p1 = a.rstrip(os.sep).split(os.sep)\n p2 = b.rstrip(os.sep).split(os.se...
[ "0.73897827", "0.7339206", "0.67567295", "0.65496707", "0.6387099", "0.6286626", "0.61776984", "0.61434525", "0.61350846", "0.61014986", "0.60929364", "0.6068817", "0.60278535", "0.5977593", "0.59686697", "0.59164315", "0.58905256", "0.58664703", "0.58248734", "0.58200943", "...
0.8505086
0
Returns the path to the objdoc cache for a module.
def _get_pycache_path(spec: ModuleSpec) -> Path: # Refuse to do __pycache__ caching for anything in PREFIX. # FIXME: Not sure if this is the right policy. if is_subpath(spec.origin, sys.prefix): raise CannotCache(spec.name) # Find out where the module cache file goes. mod_cache_path = impor...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_cache_path(self):", "def get_cache_path(self):", "def cache_path(self):", "def cache_path(self):", "def cachepath(self, *args, **kw):\n cachename = self.cachefunc(*args, **kw)\n ret = os.path.join(self.cachedir, cachename)+'.'+self.serializer\n return ret", "def get_module_pa...
[ "0.6733192", "0.6733192", "0.65243727", "0.65243727", "0.6192765", "0.6134021", "0.6128572", "0.6034457", "0.59029865", "0.58758134", "0.584348", "0.583628", "0.5831629", "0.5797197", "0.57850033", "0.5753407", "0.57359135", "0.56733376", "0.56616026", "0.5656423", "0.5656423...
0.71900195
0
Returns the path to the supdoc cache directory.
def get_cache_dir() -> Path: try: cache_dir = Path(os.environ["SUPDOC_CACHE_DIR"]) except KeyError: try: cache_dir = Path(os.environ["XDG_CACHE_DIR"]) except KeyError: if sys.platform == "linux": cache_dir = Path.home() / ".cache" elif ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cache_path(self):\n cache_path = os.path.join(os.path.dirname(__file__), '..', 'cache')\n if not os.path.exists(cache_path):\n os.mkdir(cache_path)\n return cache_path", "def cache_path(self):", "def cache_path(self):", "def get_cache_path(self):", "def get_cache_path(se...
[ "0.8008654", "0.77709967", "0.77709967", "0.7667538", "0.7667538", "0.7616764", "0.75312096", "0.75106233", "0.74233025", "0.7411959", "0.73736256", "0.7335555", "0.7317151", "0.7300587", "0.7297673", "0.7265668", "0.7265422", "0.7102412", "0.7053087", "0.7030431", "0.6959811...
0.81167746
0
Returns a cache that stores files in a separate directory.
def DirCache(dir: Path) -> Cache: dir = Path(dir) return Cache(lambda spec: dir / spec.name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_cachefile(filename):\n if not os.path.exists(cachedir):\n os.makedirs(cachedir)\n return os.path.join(cachedir, filename)", "def cache_file(cache_key):\n\n return MASTOOLS_DIR / f\"{cache_key}_cache.json\"", "def cache_path(self):", "def cache_path(self):", "def cache(*filepath):\n ...
[ "0.7048509", "0.6932892", "0.69263685", "0.69263685", "0.6910586", "0.68598944", "0.68423784", "0.6811715", "0.67268217", "0.67268217", "0.66995484", "0.6692884", "0.66060275", "0.6589656", "0.65850544", "0.6582661", "0.6568272", "0.6557517", "0.6557517", "0.6490931", "0.6454...
0.7716556
0
Caches modules in `modnames` and their submodules.
def cache_modules(*modnames) -> None: inspector = Inspector() modnames = { n for m in modnames for n in find_submodules(m) } for modname in modnames: logging.debug(f"inspecting: {modname}") objdoc = inspector.inspect_module(modname) logging.debug(f"writing cache: {modname}") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pymod_cache():\n pymod.cache.cache = Singleton(pymod.cache.factory)", "def _refresh_cache():\n global _num_types, _num_funcs\n\n num_types = interrogate_number_of_global_types()\n num_funcs = interrogate_number_of_functions()\n\n if num_types != _num_types:\n for i in range(num_types):\...
[ "0.65368474", "0.647988", "0.60674167", "0.6010362", "0.5922582", "0.5811887", "0.5756406", "0.57526934", "0.5709762", "0.5666927", "0.5654441", "0.5649179", "0.5631578", "0.5589954", "0.5557051", "0.5550639", "0.5539117", "0.54829466", "0.5482664", "0.5446342", "0.5420631", ...
0.82407486
0
Create a driver to the specified appium server & return driver,touch objects.
def create_driver(self, app_server): config = self.config[app_server] cmd = config['CMD'] server_name = config['NAME'] log_file_name = config['LOG_FILE_NAME'] full_log_path = os.path.join(os.environ['basedir'], 'logs', 'appium', log_file_name) url = config['URL'] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def appium_init(self):\n desired_cups = {}\n desired_cups['platformName'] = 'Android'\n desired_cups['platformVersion'] = android_version\n desired_cups['deviceName'] = device_name\n desired_cups['appPackage'] = pkg_name\n desired_cups['appActivity'] = activity\n de...
[ "0.6603057", "0.6471961", "0.6052382", "0.6052382", "0.6046912", "0.5883527", "0.5859736", "0.5768993", "0.56850535", "0.55772156", "0.54033375", "0.5355655", "0.5336413", "0.52726877", "0.5258186", "0.5250311", "0.52132326", "0.5192618", "0.5192618", "0.51881385", "0.5179297...
0.7865572
0
Close the application, quits the drivers.
def close_driver(self): package_dict = self.config['PACKAGE'] try: self.driver.terminate_app(package_dict[self.app_name]) # Kill app self.driver.quit() # Kill drivers except WebDriverException: pass finally: LOGGER.info("Closed {apl} on {...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def quit(self):\n self.driver.close_app()\n self.driver.quit()", "def close_application(self):\n self.close()\n QtGui.QApplication.exit()", "def close(self):\n\n self._driver.quit()", "def program_close():\n\n print(\"\\n\")\n sys.exit(0)", "def close(self):\n\n ...
[ "0.75867534", "0.7412425", "0.73730874", "0.73533124", "0.72978216", "0.7290101", "0.71743464", "0.7127176", "0.71195775", "0.7048997", "0.7048084", "0.6993627", "0.69605225", "0.69441557", "0.69411415", "0.6929923", "0.6924687", "0.69232714", "0.69213384", "0.69039327", "0.6...
0.7819079
0
Read mobile window size & sets the scroll length for a mobile.
def set_scroll_length(self): size = self.driver.get_window_size() self.x_cord = int(size['width'] / 2) self.start_y = int(size['height'] * 0.9) self.end_y = int(size['height'] * 0.1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _GetViewportSize(self):\n return self.tab.EvaluateJavaScript(\n '[ window.innerWidth, window.innerHeight ]')", "def get_window_size():\n global windowSize\n windowSize = DRIVER.driver.get_window_size()\n return windowSize", "def set_viewport_size(driver, device):\n if device == \"lapt...
[ "0.5914855", "0.5613949", "0.5598261", "0.5566157", "0.55612123", "0.5541413", "0.5541", "0.5487701", "0.5459118", "0.5452546", "0.5340624", "0.5302332", "0.524592", "0.51727504", "0.51644754", "0.5149017", "0.51306283", "0.50865525", "0.5083901", "0.5060446", "0.50539947", ...
0.65684086
0
Perform tap for requested element or coordinates.
def tap_screen(self, element=None, config=None, x_cord=None, y_cord=None): if element and config: self.touch.tap(x=config[element]['x'], y=config[element]['y']).perform() elif x_cord: self.touch.tap(x=x_cord, y=y_cord).perform() else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tap(self, locator, x_offset=None, y_offset=None, count=1):\r\n driver = self._current_application()\r\n el = self._element_find(locator, True, True)\r\n action = TouchAction(driver)\r\n action.tap(el, x_offset, y_offset, count).perform()", "def double_tap(self, locator):\r\n ...
[ "0.73958546", "0.6878971", "0.6814113", "0.6399038", "0.6340633", "0.58948916", "0.5836868", "0.57950395", "0.5761519", "0.5747372", "0.57057613", "0.56118274", "0.5496889", "0.5388753", "0.52636874", "0.5225673", "0.52115715", "0.5081884", "0.5049696", "0.50416523", "0.50377...
0.7536684
0
Swipe the screen to scroll down.
def swipe_up(self): self.driver.swipe(start_x=self.x_cord, start_y=self.start_y, end_x=self.x_cord, end_y=self.end_y, duration=1000)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def swipe_down(self):\n self.swipe_sub(SWIPE_MATRIX[1])", "def swipe_element_to_bottom_of_screen(self):\n window_size_y = self.driver.get_window_size()[\"height\"]\n self.swipe(30, window_size_y - 80, 30, window_size_y - 500)", "def swipe_down(self, page_portion=0.25):\n driver = self.d...
[ "0.758218", "0.71756256", "0.71166104", "0.7037795", "0.6950055", "0.69194794", "0.68665427", "0.6834109", "0.67843467", "0.676057", "0.66562134", "0.6606951", "0.65145755", "0.65032494", "0.6459125", "0.64556295", "0.64275724", "0.6410148", "0.6391791", "0.63822305", "0.6373...
0.7214927
1
Swipe the screen to move right.
def swipe_right(self, config): self.driver.swipe(start_x=config['SWIPE_RIGHT']['x'], start_y=config['SWIPE_RIGHT']['y'], end_x=(config['SWIPE_RIGHT']['x'] - 400), end_y=config['SWIPE_RIGHT']['y'], duration=1000)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def swipe_right(self):\n self.swipe_sub(SWIPE_MATRIX[3])", "def swipeRight (self) :\n rotated = Grid(np.rot90(self.grid))\n self.grid = np.rot90(np.rot90(np.rot90(rotated.swipeBase())))", "def right(self):\n self.move(1,0)", "def onMoveRight(self):\n self.mainGrid.moveRight()",...
[ "0.8454436", "0.78103113", "0.7573303", "0.74607587", "0.7398949", "0.73591566", "0.72639054", "0.7250936", "0.71935", "0.7191789", "0.7183003", "0.7181764", "0.71255744", "0.71070856", "0.70980036", "0.70931053", "0.7075506", "0.7070613", "0.70595074", "0.70166427", "0.69603...
0.83857
1
Method to perform long press of element or a coordinate.
def press_long(self, hold_time, element=None, config=None, x_cord=None, y_cord=None): if config: self.touch.long_press(x=config[element]['x'], y=config[element]['y'], duration=hold_time).release().perform() elif element: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_longpress(self, str_arg):\n arg = validateString(str_arg)\n # if arg.startswith(r'('):\n # raise ValueError('Bad argument, You may want to use longpress2 with coordinates as auguments.')\n x = 0\n y = 0\n seconds = 2000\n try:\n if arg.startswith(r...
[ "0.81420714", "0.789084", "0.7409583", "0.74057496", "0.6809658", "0.6745555", "0.6695679", "0.66722083", "0.6339727", "0.6332918", "0.6292188", "0.62683517", "0.61894494", "0.6077479", "0.6063342", "0.6041611", "0.6034741", "0.6032851", "0.5996023", "0.59428483", "0.59363294...
0.7710179
2
Method to perform long press of element or a coordinate and slide.
def press_long_and_slide(self, element, x_cord, y_cord, hold_time): if element: self.touch.long_press(el=element, duration=hold_time).move_to( x=x_cord, y=y_cord).release().perform() else: LOGGER.error('Element and co-ordinates must be given for long press!')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_longpress(self, str_arg):\n arg = validateString(str_arg)\n # if arg.startswith(r'('):\n # raise ValueError('Bad argument, You may want to use longpress2 with coordinates as auguments.')\n x = 0\n y = 0\n seconds = 2000\n try:\n if arg.startswith(r...
[ "0.8066344", "0.76812494", "0.7387225", "0.71065205", "0.65214574", "0.64916337", "0.6470704", "0.64311725", "0.62847203", "0.62028587", "0.60926753", "0.60913044", "0.60368675", "0.59834635", "0.59390086", "0.58624774", "0.58039314", "0.57924074", "0.57913846", "0.57878906", ...
0.8362803
0
Select an key on the screen using keycode.
def press_using_keycode(self, text): num = KEY_CODE_DICT[text] self.driver.press_keycode(num) time.sleep(3)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def keyevent(self, keycode: Union[str, int]) -> None:\n self.shell(['input', 'keyevent', str(keycode)])", "def keypress(key):\n k = PyKeyboard()\n if key == 'enter':\n key = k.return_key\n k.tap_key(key)", "def keypress(cls, _, key):\n return key", "def presskey(self, key):\...
[ "0.72298855", "0.70825064", "0.7031476", "0.7016587", "0.7005039", "0.6958417", "0.6877484", "0.6845089", "0.67478025", "0.674171", "0.6733207", "0.6687262", "0.66723675", "0.6649785", "0.6627836", "0.66275096", "0.65697426", "0.65491766", "0.6541191", "0.6495486", "0.6452972...
0.7188671
1
Press back button on mobile for 'num' times.
def press_back(self, num=1): for _11 in range(0, num): # _11 as dummy variable self.driver.back()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def press_back_button(self):\n self.driver.back()", "def __call__(self, count = 1):\r\n assert type(count) == types.IntType and count >= 1, \\\r\n 'Invalid count value (%s) given!' % count\r\n\r\n self.phone.comment('back(%s)' % (count != 1 and str(count) or \"\"))\r\n\r\n ...
[ "0.686586", "0.6603821", "0.6489235", "0.62731624", "0.6251216", "0.60601574", "0.6037806", "0.60344905", "0.5995057", "0.5986757", "0.59838754", "0.59783083", "0.59600383", "0.5889037", "0.5838801", "0.58346796", "0.57942283", "0.57372975", "0.57372975", "0.5688485", "0.5674...
0.7851241
0
Return element according to element type given.
def return_element(self, el_type, text, bounds=False): if el_type == 'access': element = self.driver.find_element_by_accessibility_id(text) elif el_type == 'id': element = self.driver.find_element_by_id(text) elif el_type == 'xpath' and bounds: element = self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def element_type(self) -> global___Type:", "def element(selection, sel_type='id'):\n selector = get_selector_method(sel_type)\n return selector(selection)", "def element_by_atom_type(atom_type, verbose=False):\n matched_element = None\n\n if matched_element is None and atom_type.mass:\n matc...
[ "0.7039218", "0.6531085", "0.65199196", "0.6413907", "0.6378142", "0.63359797", "0.6290994", "0.6273379", "0.62482876", "0.62119603", "0.6187754", "0.61422116", "0.60904515", "0.6073134", "0.60068643", "0.5997687", "0.59854156", "0.59780675", "0.59744245", "0.59307486", "0.59...
0.71218866
0
Return list of elements of class 'android.widget.TextView'.
def return_textview_elements(self): return self.driver.find_elements_by_class_name('android.widget.TextView')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def texts(self):\n return [elem.text for elem in self.web_elements]", "def get_elements_text(self, elements: Union[List[WebElement], Tuple[By, str]]) -> List[str]:\n elements = self.find_elements(elements)\n return [element.get_attribute('innerText') for element in elements]", "def get_all...
[ "0.6248276", "0.60573405", "0.60127634", "0.5948078", "0.5905251", "0.577305", "0.5733306", "0.56923234", "0.5615578", "0.556697", "0.5562241", "0.5440046", "0.5421704", "0.53165835", "0.53053695", "0.5239165", "0.52215254", "0.5188379", "0.51882476", "0.517459", "0.51421756"...
0.85841584
0
Return element matching the text which is passed to it.
def return_button(self, text, class_name='android.widget.TextView'): for button in self.driver.find_elements_by_class_name(class_name): if button.text == text: return button return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_text_in_element():\n nonlocal text_\n if text_ is None:\n text_ = element.text\n element_text = element.text\n if element_text == text:\n return element\n if text.lower() == element_text.lower():\n return el...
[ "0.7376054", "0.71084297", "0.6891974", "0.67400026", "0.662405", "0.64236134", "0.6199454", "0.61929", "0.6180942", "0.61549133", "0.6146275", "0.6094788", "0.6044545", "0.60304886", "0.6012001", "0.5969076", "0.5952407", "0.5950843", "0.5950843", "0.5889585", "0.58815986", ...
0.6416724
6
Click a specified element if present. Handles error inside the method if parameter is set.
def click_element(self, el_type, text, delay=3, handle_error=True): if el_type not in ['access', 'xpath']: LOGGER.error('Mentioned element does not exist!') button = None else: button = self.return_element(el_type=el_type, text=text) if handle_error: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def elementClick(self,locator=\"\",locatorType='id',element=None):\n\n\n try:\n if locator:\n element=self.getElement(locator,locatorType)\n\n element.click()\n self.logger.info(\"clicked on element with locator\"+locator+\" locatorType: \"+locatorType)\n\n ...
[ "0.7175649", "0.70856076", "0.7043328", "0.6983573", "0.6871981", "0.6846188", "0.6828609", "0.667858", "0.657414", "0.6499648", "0.6435625", "0.6419192", "0.63694227", "0.6356947", "0.63161623", "0.630584", "0.62764186", "0.6267747", "0.6248839", "0.62318325", "0.62288755", ...
0.6763409
7
Return element according to 'text' or 'search text' and clicks it.
def click_using_class(self, text, search_text=None, delay=3, is_button=False): if search_text: class_name = 'android.widget.EditText' button = self.return_button(search_text, class_name) elif is_button: class_name = 'android.widget.Button' button = self.re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def return_button(self, text, class_name='android.widget.TextView'):\n for button in self.driver.find_elements_by_class_name(class_name):\n if button.text == text:\n return button\n return None", "def click_search_button(self):\n self.click_element(self.generic_sear...
[ "0.661339", "0.65298027", "0.64589846", "0.63079387", "0.6279679", "0.6225251", "0.61082816", "0.60499865", "0.5844906", "0.5839642", "0.58275473", "0.58186126", "0.5792587", "0.57632035", "0.57194805", "0.569059", "0.568484", "0.5681119", "0.5595558", "0.5590351", "0.5569256...
0.72133875
0
Open application on mobile device.
def start_app(self): app_xpath = '//android.widget.FrameLayout[@content-desc=\"{app}\"]/android.widget.ImageView' LOGGER.info('Starting app now!') tex = app_xpath.format(app=self.app_name) try: self.click_element(el_type='xpath', text=tex, handle_error=False) except N...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def open_mobile_application(self, platform):\n if platform == ANDROID:\n self.appium_lib.open_application(APPIUM_URL_ANDROID, platformName = APPIUM_DESIRED_CAPS['platformName'],\n deviceName = APPIUM_DESIRED_CAPS['udid'],\n ...
[ "0.77800596", "0.7442968", "0.7184208", "0.62102145", "0.6025373", "0.6014739", "0.591356", "0.58947474", "0.58312345", "0.58172476", "0.57678336", "0.5743146", "0.5674543", "0.5626196", "0.56029844", "0.5575846", "0.55363363", "0.5530113", "0.55267155", "0.5506385", "0.55040...
0.68002564
3
Count letters in a name.
def counter(name): count_name = list(name) counter = 0 for letter in count_name: counter += 1 print(f"There are {counter} letter in the name {name}.") print(f"\tAnd btw... {name} backwards is {name[::-1].lower()}.")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def char_count(self, _list, char):\n\t\tcont = 0\n\t\tfor i in _list:\n\t\t\tcont += i[\"name\"].count(char.upper())\n\t\t\tcont += i[\"name\"].count(char.lower())\n\t\treturn cont", "def test_single_letter_count(self):\n self.assertEqual(functions.single_letter_count(\"Hello World\", \"h\"), 1)\n ...
[ "0.75467575", "0.74104375", "0.74040395", "0.739459", "0.73699015", "0.7357591", "0.7343402", "0.7343402", "0.7343402", "0.7343402", "0.731937", "0.7260459", "0.72601306", "0.72523135", "0.72024745", "0.7005587", "0.69186723", "0.6886823", "0.68676317", "0.68437684", "0.67980...
0.74775517
1
Converts the given str (str_in) to a datetime.date or datetime.datetime object, using the format optionally given as the parameter format_in.
def str2date(str_in, format_in="yyyy-mm-dd", typeout=None): if type(str_in) is not str: raise TypeError("str_in must be a str") if type(format_in) is not str: raise TypeError("format_in must be a str") if typeout is not dt.date and typeout is not dt.datetime and typeout is not None: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_date_from_string(self, datestr, fmt):\n return datetime.datetime.strptime(datestr, fmt)", "def str2date(date_str, date_format):\n return datetime.strptime(date_str, date_format)", "def _convert_date(date_string, s_format='%Y-%m-%d'):\r\n if isinstance(date_string, str):\r\n return d...
[ "0.76346546", "0.74792445", "0.7137026", "0.7019489", "0.7005402", "0.691273", "0.68818885", "0.687637", "0.684877", "0.68447477", "0.6791915", "0.67769426", "0.6754171", "0.6749142", "0.672639", "0.6686086", "0.6681176", "0.6680179", "0.66634023", "0.6661955", "0.66202503", ...
0.73334426
2
Try to get the date that a file was created, falling back to when it was last modified if that isn't possible.
def created(path): # TODO: Test this code block on other platforms (OS X/Linux) if platform.system() == 'Windows': date = datetime.fromtimestamp(os.path.getctime(path)).strftime('%Y-%m-%d') return date else: stat = os.stat(path) try: return stat.st_birthtime ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _creation_date(path_to_file):\n if platform.system() == \"Windows\":\n return os.path.getctime(path_to_file)\n else:\n stat = os.stat(path_to_file)\n try:\n return stat.st_birthtime\n except AttributeError:\n # We're probably on Linux. No easy way to get ...
[ "0.8190197", "0.805753", "0.8000129", "0.7986132", "0.7986132", "0.7926146", "0.76267004", "0.7622058", "0.7512643", "0.7511644", "0.744479", "0.7173829", "0.7128207", "0.696563", "0.6958586", "0.69365454", "0.6904673", "0.68706644", "0.67324805", "0.66605735", "0.66230446", ...
0.79197496
6
Detect object classes in an image using precomputed object proposals.
def detect(self, image): # Load the demo image # Detect all object classes and regress object bounds image = image_transform_1_3(image) timer = Timer() timer.tic() scores, boxes = self.im_detect(image) timer.toc() print('rois--------------', scores) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def detect_objects(interpreter, image):\n set_input_tensor(interpreter, image)\n interpreter.invoke()\n\n # Get all output details\n boxes = get_output_tensor(interpreter, 0)\n classes = get_output_tensor(interpreter, 1)\n scores = get_output_tensor(interpreter, 2)\n count = int(get_output_ten...
[ "0.71595085", "0.7112627", "0.7053825", "0.695533", "0.6803062", "0.6613106", "0.65618676", "0.6435698", "0.6388294", "0.6292531", "0.62065536", "0.6154667", "0.6117337", "0.6116278", "0.6087541", "0.6083871", "0.6029203", "0.59899825", "0.5947565", "0.59351975", "0.59153056"...
0.69261765
4