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 method should be overridden by subclasses, to define the forward pass of the subclass.
def forward(self,input): raise RuntimeError("All subclasses of Module must implement a forward method")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forward_pass(self):", "def forward(self)->None:", "def forward(self):\n raise NotImplemented", "def forward(self):\n raise NotImplemented", "def forward(self):\n raise NotImplemented", "def forward(self):\n pass", "def forward(self):\n pass", "def forward(self, ...
[ "0.82259226", "0.7959483", "0.7825266", "0.7825266", "0.7825266", "0.7743123", "0.7743123", "0.75479484", "0.75391036", "0.75391036", "0.73123294", "0.7310577", "0.7203087", "0.70683163", "0.6962889", "0.689811", "0.6812464", "0.68102765", "0.67889893", "0.6757962", "0.674344...
0.6940249
15
This method should be overridden by subclasses, to define the backward pass of the subclass, i.e. calculate the gradients.
def backward(self,input,grads): raise RuntimeError("All subclasses of Module must implement a forward method")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def backward(self, gradient):\n raise NotImplementedError()", "def backward(self, gradient):\n #TODO\n pass", "def backward(self, gradient):\n #TODO\n pass", "def backward(self):\n gradient = blah\n return gradient", "def backward(self):\n gradient = ...
[ "0.82223105", "0.80479836", "0.80479836", "0.79715073", "0.79715073", "0.7671202", "0.7602473", "0.7602473", "0.7551229", "0.74671155", "0.743707", "0.7411361", "0.7339398", "0.7335206", "0.73204434", "0.7286701", "0.72605926", "0.7177909", "0.7176175", "0.7144706", "0.711467...
0.6702949
61
Loads the training datasets.
def load_training_data(list_files): training_data = [] for tr_file in list_files: with open(os.path.join("data", tr_file)) as csv_file: reader = csv.reader(csv_file, delimiter=",") next(reader) for row in reader: training_data.append(row[1]) return...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_dataset(self):\n # Get all the files in the directory\n file_list = self.get_file_list()\n\n # Concatenate the data corresponding to a list of files\n data = self.concatenate_file_data(file_list)\n\n # Shuffle the data and create the training and the validation datasets\...
[ "0.81856126", "0.8118532", "0.80234087", "0.7803689", "0.7721517", "0.772132", "0.7582031", "0.7536961", "0.7536325", "0.7523101", "0.75056815", "0.74304795", "0.7396388", "0.73546124", "0.7322741", "0.72095716", "0.71921355", "0.7182269", "0.7180742", "0.71723825", "0.715488...
0.6772018
56
Loads a single training dataset.
def load_dataset(path): training_data = [] with open(path) as csv_file: reader = csv.reader(csv_file, delimiter=",") next(reader) for row in reader: training_data.append(row[1]) return training_data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _load_training_data(self):\n self._save_training_data()", "def load_dataset():\n\n\n train_dd_loader = DailyDialogLoader(PATH_TO_TRAIN_DATA, load=False)\n train_dataloader = DataLoader(train_dd_loader, batch_size=16, shuffle=True, num_workers=0,\n collate_fn=PadCollate...
[ "0.7245358", "0.71401083", "0.7106745", "0.7064546", "0.70641655", "0.6957694", "0.695757", "0.69105434", "0.6814488", "0.68131214", "0.6791823", "0.6780509", "0.67765695", "0.67636853", "0.6733562", "0.67234486", "0.6712425", "0.67052805", "0.6686271", "0.6671118", "0.667068...
0.68193704
8
Loads the training groundtruth results.
def load_training_gt(list_files): training_results = [] for res_file in list_files: with open(os.path.join("data", res_file)) as csv_file: reader = csv.reader(csv_file, delimiter=",") next(reader) for row in reader: training_results.append(int(row[1]))...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _load_training_data(self):\n self._save_training_data()", "def load(self):\n self.results = pickle_load('results', self.main_dir)", "def load_predicted_results(self):\n print(\"\\n\\nLoad prediction answers : \")\n with open(\"predicted_results\", \"rb\") as predicted_results:\n...
[ "0.7053863", "0.68711954", "0.6718674", "0.6639447", "0.6552436", "0.65086484", "0.6402301", "0.63730085", "0.6295958", "0.62917984", "0.6280856", "0.62741286", "0.6268007", "0.6238471", "0.61954767", "0.61931103", "0.6185083", "0.6154474", "0.61499846", "0.61415553", "0.6135...
0.62378716
14
Loads the training groundtruth results.
def load_gt(path): train_results = [] with open(path) as csv_file: reader = csv.reader(csv_file, delimiter=",") next(reader) for row in reader: train_results.append(int(row[1])) return np.array(train_results)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _load_training_data(self):\n self._save_training_data()", "def load(self):\n self.results = pickle_load('results', self.main_dir)", "def load_predicted_results(self):\n print(\"\\n\\nLoad prediction answers : \")\n with open(\"predicted_results\", \"rb\") as predicted_results:\n...
[ "0.7054438", "0.68732667", "0.6718145", "0.6640124", "0.65523094", "0.65084577", "0.6402774", "0.6373878", "0.6296962", "0.6290986", "0.62816954", "0.6274666", "0.6267359", "0.6238723", "0.62367076", "0.61935216", "0.6193316", "0.6186277", "0.6155171", "0.6149783", "0.6143509...
0.0
-1
Writes the predicted bounds in a CSV file.
def write_results(file_path, predictions): with open(file_path, "w") as csv_file: writer = csv.writer(csv_file, delimiter=",") writer.writerow(["Id", "Bound"]) for id, bound in enumerate(predictions): writer.writerow([id, bound])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bounds():\n\n with open('bounds.csv', 'w', newline='') as file:\n writer = csv.writer(file, delimiter=\",\")\n writer.writerow([\"File_number\", \"Bounds:Left\", \"Bounds:Bottom\" , \"Bounds:Right\" , \"Bounds:Top\"])\n \n for i in range(1,44):\n if i < 10:\n df = raste...
[ "0.67489994", "0.64240366", "0.6419536", "0.6406355", "0.63975656", "0.6377383", "0.6377383", "0.63396955", "0.6324414", "0.61491704", "0.61022496", "0.60909176", "0.6053285", "0.60495895", "0.59979385", "0.5981814", "0.59722394", "0.5954778", "0.59425664", "0.59258956", "0.5...
0.72739613
0
Automatic determination of MRTS
def test_autoThresh(): edges = [0, 1000] spikes1 = SpikeTrain([64.88600, 305.81000, 696.00000, 800.0000], edges) spikes2 = SpikeTrain([67.88600, 302.81000, 699.00000], edges) spikes3 = SpikeTrain([164.88600, 205.81000, 796.00000, 900.0000], edges) spikes4 = SpikeTrain([263.76400, 418.45000, 997.4800...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_mcts(self):\n self.mcts.sigstop = False\n self.running_mcts = True\n\n self.mcts.search(max_time=self.max_time, c=self.exploration, verbose=True)\n\n self.running_mcts = False\n\n print(self.mcts.dump(self.mcts.root, 0, c=0))\n return self.get_top5()", "def test_...
[ "0.57256216", "0.54592645", "0.54176086", "0.5301477", "0.5237363", "0.52280045", "0.5174289", "0.5125695", "0.5115831", "0.5085616", "0.5018095", "0.5009047", "0.50007856", "0.4991175", "0.49891", "0.4983163", "0.4967913", "0.4957134", "0.49367395", "0.49344268", "0.4933092"...
0.0
-1
compute water flux through each node
def get_flux(self): # iterate through points from top to bottom points = sorted(self.graph,key=lambda n: -n.z) for n in points: if n.z >= self.sealevel: n.flux += 1 zmin = n.z zmin2 = 1e99 min_n = None ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flux():\n delta = 0.01 # film thickness, [dm]\n c = pre * 10 ** 2 / (R * tem) # total concentration calculated by ideal gas equation, in [mol/L]\n D12 = 0.001626528 / pre # HCl diffusion in Air, [dm2/s] @296K\n D13 = 3e-7 # HCl gas diffusion in water, [dm2/s] @296K\n D23 = 1.5e-7 # CH4 gas...
[ "0.6161182", "0.5917691", "0.58981144", "0.5796191", "0.57369494", "0.57369494", "0.5732621", "0.5730577", "0.56704056", "0.5608803", "0.5575318", "0.5570114", "0.5533653", "0.55209166", "0.54866004", "0.5477688", "0.5452558", "0.5441911", "0.5438859", "0.5436432", "0.5420254...
0.66064185
0
normalize the water flux
def normalize_flux(self): fmax = 0 fmin = 1e99 for n in self.graph: if n.flux > fmax: fmax = n.flux if n.flux < fmin: fmin = n.flux for n in self.graph: n.flux = (n.flux-fmin)/(fmax-fmin)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize(wav, flux):\n return flux / flux.max() # maximum flux = 1\n\n # flux_norm = flux[wav>wav_norm][0]\n # return flux / flux_norm", "def _remove_flux_extinction(self):\n self.fluxUnred = self.flux.copy()\n self.fluxErrUnred = self.fluxErr.copy()\n self.fluxRenorm = self.f...
[ "0.720098", "0.71839106", "0.6935991", "0.6906558", "0.6506962", "0.6337792", "0.63301474", "0.6324191", "0.6317181", "0.63122255", "0.63009006", "0.62984145", "0.62856394", "0.6277954", "0.6255731", "0.62402797", "0.62205225", "0.6218154", "0.6181237", "0.61712116", "0.61687...
0.77366555
0
Saves the parameters into a dictionary that can later be e.g. savez'd. It is different from the Pytorch version in that the prefix of the variables is determined by the variable (/name?) scopes used when the cell was defined.
def save_parameters(self, session, out_dict=None): if out_dict is None: out_dict = {} for w in self.weights: out_dict[w.name.rsplit(':', 1)[0]] = session.run([w])[0] return out_dict
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _variables_to_save(self):\n save_vars = self.weights + self.biases\n save_names = [_.name for _ in save_vars]\n save_dict = {name: var for name, var in zip(save_names, save_vars)}\n return save_dict", "def save_parameters(self):\n paramfile = os.path.join(self._datadir, sel...
[ "0.70121944", "0.6368089", "0.636776", "0.63463885", "0.622241", "0.6198613", "0.61972576", "0.616711", "0.6138725", "0.61033726", "0.6083243", "0.6026282", "0.5963769", "0.5925412", "0.5909473", "0.5871749", "0.5840318", "0.58307344", "0.5823209", "0.5816673", "0.5795027", ...
0.6631182
1
Loads the parameters saved by save_parameters().
def load_parameters(self, session, data_dict): for w in self.weights: name = w.name.rsplit(':', 1)[0] if name in data_dict: session.run(w.assign(data_dict[name]))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_params(self):\n return self.params", "def _load_parameter(self):", "def load_params():\r\n return pickle.load(open('params.p', mode='rb'))", "def load_cls_params(self):\n with open('models/Final/linear_svc.p', 'rb') as model_file:\n model = pickle.load(model_file)\n ...
[ "0.77521527", "0.7616122", "0.7475974", "0.73228145", "0.7184305", "0.71652114", "0.71418935", "0.7136607", "0.7012619", "0.6917337", "0.69122446", "0.69078684", "0.6871735", "0.6807243", "0.67781794", "0.67363495", "0.6722905", "0.6722729", "0.6662458", "0.6612421", "0.65770...
0.6124836
49
Saves the parameters into a dictionary that can later be e.g. savez'd. It is different from the Pytorch version in that the prefix of the variables is determined by the variable (/name?) scopes used when the cell was defined.
def save_parameters(self, session, out_dict=None): if out_dict is None: out_dict = {} for layer in self.layers: layer.save_parameters(session, out_dict) return out_dict
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _variables_to_save(self):\n save_vars = self.weights + self.biases\n save_names = [_.name for _ in save_vars]\n save_dict = {name: var for name, var in zip(save_names, save_vars)}\n return save_dict", "def save_parameters(self, session, out_dict=None):\n if out_dict is None...
[ "0.70133185", "0.663021", "0.6368316", "0.63673604", "0.634539", "0.62220037", "0.61976147", "0.6197335", "0.6164007", "0.61014414", "0.60837275", "0.60256314", "0.5962757", "0.5926123", "0.5908395", "0.587091", "0.583851", "0.582901", "0.58223844", "0.58159804", "0.57932276"...
0.61386293
9
Loads the parameters saved by save_parameters().
def load_parameters(self, session, data_dict): for layer in self.layers: layer.load_parameters(session, data_dict)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_params(self):\n return self.params", "def _load_parameter(self):", "def load_params():\r\n return pickle.load(open('params.p', mode='rb'))", "def load_cls_params(self):\n with open('models/Final/linear_svc.p', 'rb') as model_file:\n model = pickle.load(model_file)\n ...
[ "0.77521527", "0.7616122", "0.7475974", "0.73228145", "0.7184305", "0.71652114", "0.71418935", "0.7136607", "0.7012619", "0.69122446", "0.69078684", "0.6871735", "0.6807243", "0.67781794", "0.67363495", "0.6722905", "0.6722729", "0.6662458", "0.6612421", "0.6577086", "0.65633...
0.6917337
9
Converts NxDxHxW label image to NxCxDxHxW, where each label gets converted to its corresponding onehot vector
def expand_as_one_hot(input, C, ignore_index=None): assert input.dim() == 4 shape = input.size() shape = list(shape) shape.insert(1, C) shape = tuple(shape) input = input.type(torch.LongTensor) # expand the input tensor to Nx1xDxHxW src = input.unsqueeze(1) if ignore_index is not ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def label2onehot(self, batch_size, labels):\r\n dim = 6\r\n out = torch.zeros(batch_size, dim)\r\n out[np.arange(batch_size), labels] = 1\r\n return out", "def label_to_one_hot(label, num_of_class=2):\r\n import numpy as np\r\n one_hot = np.zeros((len(label), num_of_class), dtyp...
[ "0.78784037", "0.77450097", "0.76988643", "0.7691433", "0.7674178", "0.7671359", "0.7590227", "0.7582794", "0.75499135", "0.7549292", "0.7545732", "0.7527726", "0.74868584", "0.7479391", "0.7456521", "0.7450905", "0.7450166", "0.74413705", "0.7438392", "0.7430508", "0.7421417...
0.0
-1
Get a list containing all elements in the arma_container.
def _get_list_of_elements(arma_container): n_elem = arma_container["n_elem"] mem = arma_container["mem"] elem_type = mem.type.target().unqualified() if 'complex' in elem_type.name: return [_cast_to_complex(mem[i]) for i in range(n_elem)] return [mem[i] for i in range(n_elem)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all(self):\n return list(self.iterator())", "def get_array(arma_container):\n # In case the user passed the name of the varaible, instead of a gdb.Value,\n # we get the corresponding gdb.Value\n if isinstance(arma_container, str):\n arma_container = gdb.parse_and_eval(arma_container)\n...
[ "0.6568955", "0.65409666", "0.65166247", "0.6506832", "0.6444223", "0.64083475", "0.6289796", "0.62836426", "0.6215201", "0.62119395", "0.62043554", "0.6201367", "0.61920005", "0.61659324", "0.6161435", "0.61315525", "0.6113563", "0.610823", "0.61022896", "0.60991925", "0.607...
0.77745867
0
Get a numpy array with the elements and shape of arma_container.
def get_array(arma_container): # In case the user passed the name of the varaible, instead of a gdb.Value, # we get the corresponding gdb.Value if isinstance(arma_container, str): arma_container = gdb.parse_and_eval(arma_container) n_rows = arma_container["n_rows"] n_cols = arma_container["...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_array(self):\n return numpy.array(self._ar)", "def _get_list_of_elements(arma_container):\n n_elem = arma_container[\"n_elem\"]\n mem = arma_container[\"mem\"]\n elem_type = mem.type.target().unqualified()\n\n if 'complex' in elem_type.name:\n return [_cast_to_complex(mem[i]) fo...
[ "0.63321656", "0.60761553", "0.59460145", "0.5888306", "0.577478", "0.5766841", "0.5765605", "0.5678656", "0.5668666", "0.5647278", "0.56204003", "0.5608568", "0.5605443", "0.55823827", "0.558154", "0.55734915", "0.55721813", "0.55278605", "0.55197483", "0.5516481", "0.550788...
0.8301161
0
Return a fully qualified class name string for class ``cls``.
def full_classname(cls: type) -> str: return ClassImporter.full_classname(cls)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def qualified_name(cls):\n return '{}.{}'.format(cls.__module__, cls.__name__)", "def fullname(cls):\n module = cls.__module__\n if module is None or module == str.__class__.__module__:\n return cls.__class__.__name__\n return module + '.' + cls.__class__.__name__", "def class_name(cls):...
[ "0.80164295", "0.7981724", "0.7926273", "0.7926273", "0.7805226", "0.7680299", "0.73659676", "0.73585546", "0.73313534", "0.72725195", "0.72346884", "0.72346884", "0.7160803", "0.71084", "0.7064977", "0.70488745", "0.70252043", "0.70252043", "0.70180553", "0.69375885", "0.691...
0.79708624
2
Return a class given the name of the class.
def find_class(self, class_name: str) -> Type: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_class(self, name):\n return self.host.get_class(name)", "def get_class(self, class_name):\n try:\n return self._classes[class_name]\n except KeyError:\n raise NameError", "def _find_class(self, class_name: str) -> Type:\n return self.class_resolver.find...
[ "0.8372218", "0.81583047", "0.8020621", "0.79538673", "0.78063154", "0.76401746", "0.7610307", "0.75208414", "0.7520116", "0.74729127", "0.74185145", "0.7407659", "0.73251104", "0.7274835", "0.7241607", "0.7190784", "0.7163989", "0.7153771", "0.70996106", "0.708592", "0.70688...
0.7584351
7
Initialize a new factory instance.
def __init__(self, config: Configurable, pattern: str = '{name}', default_name: str = 'default', class_resolver: ClassResolver = None): self.config = config self.pattern = pattern self.default_name = default_name if class_resolver is None: se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_factory():", "def create_init(cls):\n if cls.instance is None:\n cls.instance = Initializer()\n return cls.instance", "def new(self):\n self._init()", "def factory(self):\n return self._factory", "def factory(self):\n return self._factory", "def get_f...
[ "0.69164705", "0.6863559", "0.68633", "0.6818693", "0.6818693", "0.68156576", "0.68060565", "0.6730613", "0.66546345", "0.6599723", "0.64565337", "0.64565337", "0.6401555", "0.6392798", "0.6376683", "0.63631415", "0.6332759", "0.6313146", "0.6299909", "0.6292228", "0.62893575...
0.0
-1
Register a class with the factory. This method assumes the factory instance
def register(cls, instance_class: Type, name: str = None): if name is None: name = instance_class.__name__ if logger.isEnabledFor(logging.DEBUG): logger.debug(f'registering: {instance_class} for {cls} -> {name}') cls.INSTANCE_CLASSES[name] = instance_class
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register(cls):\n register(cls, cls.provided_class)", "def register_factory(factory, iface, requires, name):", "def register(cls, class_):\n cls._registered[class_.tag()] = class_", "def register_class(cls):\n if cls is RegisteredType:\n raise \"Please do _not_ register Reg...
[ "0.7473409", "0.7217543", "0.71381795", "0.7003167", "0.69550806", "0.6853087", "0.66359574", "0.66352725", "0.6622808", "0.65528065", "0.65243244", "0.65227586", "0.63966066", "0.63588905", "0.63349783", "0.6244078", "0.6239005", "0.6238816", "0.62195903", "0.6201522", "0.61...
0.626443
15
Resolve the class from the name.
def _find_class(self, class_name: str) -> Type: return self.class_resolver.find_class(class_name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_class(self, name):\n return self.host.get_class(name)", "def resolve(name, package=None):\n if isinstance(package, str):\n package = resolve_exposing(package)\n\n if package:\n name = resolve_name('.{}'.format(name), package.__name__)\n\n try:\n # Try to get a module\...
[ "0.74996245", "0.73361564", "0.7004807", "0.6987053", "0.6950935", "0.6922196", "0.6742277", "0.6717653", "0.6633428", "0.65981287", "0.65763247", "0.65573215", "0.653002", "0.6524172", "0.6512038", "0.64399755", "0.64003175", "0.6386054", "0.63680243", "0.63540214", "0.63294...
0.74676466
1
Get the class name and parameters to use for ``__init__``.
def _class_name_params(self, name: str): sec = self.pattern.format(**{'name': name}) if logger.isEnabledFor(logging.DEBUG): logger.debug(f'section: {sec}') params = {} try: params.update(self.config.populate({}, section=sec)) except Exception as e: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_class_init_keys(cls) -> Tuple[str, Optional[str], Optional[str]]:\n init_parameters = inspect.signature(cls.__init__).parameters\n # docs claims the params are always ordered\n # https://docs.python.org/3/library/inspect.html#inspect.Signature.parameters\n init_params = list(init_parameters.v...
[ "0.68772405", "0.662088", "0.6342232", "0.6323324", "0.6188284", "0.6186926", "0.61761373", "0.61742926", "0.6091533", "0.60284424", "0.5978482", "0.597811", "0.5969761", "0.5955229", "0.5955229", "0.5944783", "0.59247756", "0.5886437", "0.58832335", "0.5851189", "0.58311826"...
0.62443227
4
Create a new instance using key ``name``.
def instance(self, name: Optional[str] = None, *args, **kwargs): if logger.isEnabledFor(logging.DEBUG): logger.debug(f'new instance of {name}') t0 = time() name = self.default_name if name is None else name if logger.isEnabledFor(logging.DEBUG): logger.debug(f'cre...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new_key(self, key_name=None):\r\n return self.key_class(self, key_name)", "def create(cls, ns, name, **kwargs):\n key_name = '%s:%s' % (ns, name)\n return cls(key_name=key_name, ns=ns, name=name, **kwargs)", "def name_create(self, name):\n values = {\n 'name': name,\n...
[ "0.7232257", "0.71337765", "0.7104655", "0.69536877", "0.6703989", "0.66002125", "0.65732783", "0.6566274", "0.65462554", "0.65042996", "0.64359003", "0.6377844", "0.6363431", "0.6276123", "0.6272491", "0.6266294", "0.6210372", "0.6208771", "0.6208771", "0.61853826", "0.61846...
0.0
-1
Return a class by name.
def get_class(self, name: str) -> Type: if logger.isEnabledFor(logging.DEBUG): logger.debug(f'new instance of {name}') name = self.default_name if name is None else name if logger.isEnabledFor(logging.DEBUG): logger.debug(f'creating instance of {name}') class_name...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_class(self, name):\n return self.host.get_class(name)", "def construct_class_by_name(name, *args, **kwargs):\n parts = name.split('.')\n module_name, class_name = '.'.join(parts[:-1]), parts[-1]\n module = importlib.import_module(module_name)\n return getattr(module, class_name)(*args,...
[ "0.84980977", "0.80960107", "0.7904881", "0.7818355", "0.7756673", "0.76822025", "0.76616216", "0.75794125", "0.75199366", "0.7428794", "0.74179506", "0.73506993", "0.7310889", "0.7132525", "0.71238583", "0.7050008", "0.7013688", "0.6996641", "0.69842345", "0.69579434", "0.69...
0.7937184
2
Create an instance from a string used as option values in the configuration.
def from_config_string(self, v: str) -> Any: try: v = eval(v) except Exception: pass return self.instance(v)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fromstring(cls, string: str) -> 'Config':\n parser: configparser.ConfigParser = configparser.ConfigParser()\n parser.read_dict(dict(wpwatcher=Config.DEFAULT_CONFIG))\n parser.read_string(string)\n return cls.fromparser(parser)", "def from_str(cls, string):", "def create_from_arg...
[ "0.7496791", "0.7046284", "0.69129837", "0.6713198", "0.6646999", "0.6635789", "0.65656", "0.6554868", "0.6504417", "0.6445628", "0.6414875", "0.64102495", "0.64068425", "0.63516784", "0.63483465", "0.6325155", "0.63146764", "0.63088036", "0.62712175", "0.62662363", "0.625306...
0.7862316
0
Return a copy of this configuration factory that functionally works the same.
def clone(self) -> Any: return cp.copy(self)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __copy__(self):\n new_config = FuzzingConfig()\n\n new_config.use_examples_for_default = self.use_examples_for_default\n new_config.use_response_for_default = self.use_response_for_default\n new_config.use_embedded = self.use_embedded\n new_config.use_wordbook = self.use_word...
[ "0.7286043", "0.69984365", "0.69428957", "0.6785458", "0.67494476", "0.6692631", "0.66480064", "0.65916646", "0.6536674", "0.6497581", "0.64873344", "0.6476193", "0.6476193", "0.6455589", "0.6430411", "0.64302033", "0.6366175", "0.6362718", "0.6353676", "0.63217604", "0.63009...
0.0
-1
Initialize the configuration factory.
def __init__(self, *args, reload: Optional[bool] = False, shared: Optional[bool] = True, reload_pattern: Optional[Union[re.Pattern, str]] = None, **kwargs): if logger.isEnabledFor(logging.DEBUG): logger.debug(f'creating import config factory, reload...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_config(self):\n pass", "def initialize_from_config(self):", "def init_config() -> Config:\n ...", "def _init_config_(self):\n self._config= {}", "def initialize(self, **kwargs):\n\n # Defining the configuration object\n self.config = kwargs.get('config')", "def __i...
[ "0.76045656", "0.7255299", "0.7148624", "0.7001558", "0.69974756", "0.67300206", "0.6727606", "0.6687722", "0.6678989", "0.6662816", "0.6662816", "0.6587298", "0.65222806", "0.65083766", "0.6499257", "0.64791244", "0.64665663", "0.64665663", "0.6454289", "0.6438235", "0.64068...
0.0
-1
Clear any shared instances.
def clear(self): if self._shared is not None: self._shared.clear()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset(cls):\n cls._options = None\n cls._scoped_instances = {}", "def clear(self):\n return self._shared.clear()", "def clear_all(self):\n self.clear_redis()\n self.clear_cache()", "def clear_existing_modulestores():\r\n _MODULESTORES.clear()\r\n # pylint: disable=W0603\r...
[ "0.7023126", "0.6997275", "0.6878664", "0.6802849", "0.67914337", "0.6789421", "0.677575", "0.6768056", "0.67593515", "0.67557675", "0.6740717", "0.673127", "0.66101474", "0.6594861", "0.6563134", "0.65380585", "0.6535941", "0.65331453", "0.65293664", "0.6524044", "0.64898026...
0.7952969
0
Remove a shared (cached) object instance.
def clear_instance(self, name: str): if self._shared is not None: return self._shared.pop(name, None)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __delete__(self, obj):\n self._instances.pop(obj, None)", "def __delete__(self, obj):\n try:\n delattr(obj, self.cache_attr)\n except AttributeError:\n pass", "def __delete__(self, instance):\r\n self._set_instance_tag_cache(instance, '')", "def __delitem...
[ "0.72336996", "0.70047504", "0.67317575", "0.65398216", "0.64740163", "0.6439759", "0.6388525", "0.63874376", "0.6383596", "0.6340609", "0.63090307", "0.62901396", "0.62720126", "0.6261938", "0.62247956", "0.61950535", "0.6124602", "0.6124602", "0.6124602", "0.6124602", "0.61...
0.7036074
1
Return a copy of this configuration factory that functionally works the same. However, it does not copy over any resources generated during the life of the factory.
def clone(self) -> Any: clone = super().clone() clone.clear() return clone
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __copy__(self):\n new_config = FuzzingConfig()\n\n new_config.use_examples_for_default = self.use_examples_for_default\n new_config.use_response_for_default = self.use_response_for_default\n new_config.use_embedded = self.use_embedded\n new_config.use_wordbook = self.use_word...
[ "0.6886761", "0.6744836", "0.65485", "0.6495054", "0.6481339", "0.64424306", "0.64332163", "0.643071", "0.6342509", "0.6342509", "0.6323504", "0.6312829", "0.6283929", "0.6275074", "0.62745625", "0.6247065", "0.62115985", "0.6155805", "0.61544675", "0.6102668", "0.6100096", ...
0.0
-1
Create a new instance without it being shared. This only does something
def new_instance(self, name: str = None, *args, **kwargs): inst = self.instance(name, *args, **kwargs) self.clear_instance(name) return inst
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _new_instance(self):\n return self.__class__(self._vmodule)", "def _new_instance(self):\n return self.__class__(self._fmodule)", "def _new_instance(self):\n return self.__class__(self._fmodule)", "def __new__(cls):\n self = object.__new__(cls)\n self.acquired = False\n ...
[ "0.7111339", "0.7048529", "0.7048529", "0.6909566", "0.68670976", "0.6677149", "0.6643498", "0.6615346", "0.65907925", "0.65650487", "0.6544113", "0.6505606", "0.6485978", "0.6391797", "0.6350259", "0.6346318", "0.6346318", "0.6346318", "0.6313164", "0.6244281", "0.6238917", ...
0.66010326
8
Get path to credentials file.
def credentials_file() -> Path: Path.home().joinpath('.jina').mkdir(parents=True, exist_ok=True) return Path.home().joinpath('.jina').joinpath('access.yml')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_credentials_path(self):\n _log.debug(\"__init__::get_credentials_path, security_dir={}\".format(self.security_dir))\n return os.path.join(self.certificate.runtimes_dir, self.node_name)", "def get_credentials():\n home_dir = os.path.expanduser('~')\n credential_dir = os.path.join(home_...
[ "0.74603003", "0.74446946", "0.74132437", "0.736362", "0.73218745", "0.7309009", "0.72828794", "0.7238435", "0.7238435", "0.7238435", "0.7238435", "0.7238435", "0.71550614", "0.71420646", "0.71277803", "0.7127507", "0.7126071", "0.7121917", "0.7118622", "0.70948195", "0.70937...
0.6978286
36
test escape no value present
def test_escape_no_value_present(self): testdict = escapeddict.EscapedDict({'key1': 'value1', 'key2': 'value2 ${key_not_present} ${key1}'}) for key in testdict.keys(): print testdict[key] assert testdict['key1'] == 'value1' assert testdict['key2'] == 'value2 ${key_not_pr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_escape(self):\n bad_str = '''`~!@#$%^&*()_+-={}[]|\\\\;:'\",./<>?\\n\\r\\t '''\n self.run_escape_case(bad_str)", "def test_bogus_escape_not_raised(self):\r\n problem = self.build_problem(answer=u\"\\\\\", case_sensitive=False, regexp=True)\r\n\r\n self.assert_grade(problem, u...
[ "0.64300674", "0.63891804", "0.632605", "0.632605", "0.632605", "0.62506354", "0.61904687", "0.6154528", "0.6120166", "0.6108421", "0.60601854", "0.60116225", "0.60056365", "0.59879506", "0.5965529", "0.59039485", "0.59035116", "0.58851427", "0.5861278", "0.58183753", "0.5813...
0.62134564
6
test escape value as list
def test_escape_value_as_list(self): testdict = escapeddict.EscapedDict({'key1': 'value1', 'key2': ['value2', '${key1}']}) for key in testdict.keys(): print testdict[key] assert testdict['key1'] == 'value1' assert testdict['key2'] == ['value2', 'value1']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_listify(string, cast, expected):\n assert listify(string, cast) == expected", "def test_list(self):\n self.assertValue(\n ['foo', 'bar', 'hello'],\n 'foo\\nbar\\nhello\\n')", "def escape_list(mylist, escape_func):\n def escape(obj, escape_func=escape_func):\n tr...
[ "0.6201542", "0.61983675", "0.6041012", "0.6039107", "0.5854672", "0.5772972", "0.577114", "0.5768124", "0.5748182", "0.5698718", "0.5668131", "0.56647766", "0.56357306", "0.5625137", "0.561815", "0.5606561", "0.5593773", "0.55318505", "0.553185", "0.55124164", "0.5487262", ...
0.662992
0
List pull requests of a selected repository, default to repo in $PWD
def list_prs(service, repo): a = App() if repo: s = a.get_service(service, repo=repo) else: s = a.guess_service() prs = s.list_pull_requests() if not prs: print("No open pull requests.") return print(tabulate([ ( "#%s" % pr['id'], p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_pull_requests():\n pull_requests = []\n url_base = f\"https://github.com/{GITHUB_OWNER}/{GITHUB_REPO}/pull/\"\n repo = GITHUB.get_user(GITHUB_OWNER).get_repo(GITHUB_REPO)\n pulls = repo.get_pulls(base=\"main\", state=\"closed\")\n last_release_date = repo.get_latest_release().published_at\n ...
[ "0.6716363", "0.6487825", "0.64129436", "0.6397943", "0.6373597", "0.62904406", "0.62879294", "0.62411904", "0.6207153", "0.61943454", "0.6176015", "0.6155509", "0.6109742", "0.6085628", "0.6085367", "0.60782677", "0.6033034", "0.599106", "0.5944743", "0.5935052", "0.5926715"...
0.6417247
2
List git branches in current git repository
def list_branches(): a = App() print(tabulate(a.list_branches(), tablefmt="fancy_grid"))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __gitBranchList(self):\n self.vcs.gitListTagBranch(self.project.getProjectPath(), False)", "def branches(self) -> list[str]:\n _args: list[Arg] = []\n _ctx = self._select(\"branches\", _args)\n return _ctx.execute_sync(list[str])", "def list_branches(self) -> List[str]:\n ...
[ "0.7986789", "0.78010637", "0.7750258", "0.7690659", "0.7598177", "0.75201744", "0.73671293", "0.73134375", "0.7301224", "0.72663486", "0.72649246", "0.7242074", "0.72206014", "0.71917045", "0.7185191", "0.7182437", "0.71264684", "0.7067811", "0.7022855", "0.70193046", "0.698...
0.6632806
28
List the labels for the selected repository, default to repo in $PWD
def list_labels(service, repo): app = App() if repo: serv = app.get_service(service, repo=repo) else: serv = app.guess_service() repo_labels = serv.list_labels() if not repo_labels: print("No labels.") return print(tabulate([ ( label.name, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def labels(self):\r\n return labels.RepoLabels(self)", "def pull_labels(self, org):\n pass", "def getRepositoryName(self) -> unicode:\n ...", "def label(self, name):\r\n return labels.RepoLabel(self, name)", "def list_labels(self, repository):\n data = self._get_all_data(...
[ "0.7004953", "0.6531647", "0.6462931", "0.64514655", "0.6393306", "0.62721145", "0.6158077", "0.60925114", "0.6084946", "0.6084346", "0.6019508", "0.5938833", "0.590257", "0.5895671", "0.58784527", "0.5789973", "0.5752763", "0.57323766", "0.5720196", "0.5695936", "0.5695936",...
0.6889077
1
Update labels for the selected repository, default to repo in $PWD
def update_labels(source_repo, service, source_service, destination): app = App() if source_repo: serv = app.get_service(source_service, repo=source_repo) else: serv = app.guess_service() repo_labels = serv.list_labels() if not repo_labels: print("No labels.") return ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_labels(repo: Repository, labels: list[Label]):\n\n log.info(f\"Fetching existing labels from {repo.full_name}\")\n existing_labels = {label.name.casefold(): label for label in repo.get_labels()}\n log.info(f\"Found {len(existing_labels)} existing labels\")\n\n for label in labels:\n qual...
[ "0.62998533", "0.601725", "0.60083455", "0.60077965", "0.58129275", "0.57830775", "0.57446426", "0.57351315", "0.56834406", "0.5628812", "0.5615032", "0.5613544", "0.55440366", "0.5536597", "0.5534704", "0.5534704", "0.5534704", "0.5534704", "0.5534704", "0.54848963", "0.5429...
0.59565324
4
Initializes the Perceptron classifier. X and Y is the training data over which to learn the hyperplane If is_stochastic is True then the perceptron gradient steps will be stochastic not batch. step_size is the learning rate to be used. max_steps is the maximum number of iterations to use before giving up reg_constant i...
def __init__(self, X, Y, is_stochastic, step_size, max_steps, reg_constant=0): self.logger = logging.getLogger(__name__) self.logger.setLevel(logging.DEBUG) self.X = X self.Y = Y self.is_stochastic = is_stochastic if is_stochastic: self.logge...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, reg_penalty='l2', reg=0.001, k_fold=5, random_state=0):\n print(\"Initialize model Perceptron\")\n self.reg_penalty = reg_penalty\n self.reg = reg\n self.k_fold = k_fold\n self.random_state = random_state\n self.model = sklearn.linear_model.Perceptron(pe...
[ "0.68595326", "0.65547884", "0.5741013", "0.5741013", "0.5584914", "0.55068773", "0.5470129", "0.54565686", "0.5436972", "0.5432392", "0.5429865", "0.54216933", "0.5421074", "0.5415532", "0.5360338", "0.5347944", "0.53139025", "0.5288166", "0.5265048", "0.5245604", "0.5243017...
0.75320524
0
Learn the separating hyperplane on the training data
def learn(self): Xt = np.append(np.ones((self.X.shape[0], 1)), self.X, axis=1) Yt = self.Y * 2 - 1 w = np.ones(Xt.shape[1]) # avoiding random init, for debugging lw = [[] for k in range(len(w))] for iter in range(self.max_steps): P = Yt * np.dot(Xt, w) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def learn(self, Xtrain, ytrain):", "def train(self,features,y):\r\n \r\n if self.learn_type == \"nn\":\r\n #generate supervised dataset\r\n return(self.learner.train_on_batch(features,y))\r\n elif self.learn_type == \"linear\":\r\n grad = 0\r\n n =...
[ "0.6684203", "0.65931565", "0.6561966", "0.65566397", "0.65173364", "0.65173364", "0.65173364", "0.65173364", "0.65173364", "0.651586", "0.6497621", "0.6492383", "0.64562017", "0.64562017", "0.64539695", "0.6443783", "0.64437324", "0.6395101", "0.63939685", "0.6296024", "0.62...
0.69079155
0
Classify the given test set using the learned perceptron (and learning the perceptron to being with if not already done so). Returns confusion matrix of test result accuracy.
def classify(self, X_test, Y_test): if self.w is None: self.learn() c_matrix = np.asarray([[0, 0],[0,0]]) Xt = np.append(np.ones((X_test.shape[0], 1)), X_test, axis=1) Yt = Y_test class_prediction = np.sign(np.dot(Xt, self.w)) class_prediction = ((class...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_confusion_matrix(y_true, y_pred):\r\n\r\n ## 3 classes\r\n TP1, TP2, TP3, FP1, FP2, FP3, TN1, TN2, TN3, FN1, FN2, FN3 = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0\r\n\r\n for i in range(y_true.shape[0]):\r\n if y_true[i] == 0 and y_pred[i] == 0:\r\n TN1 += 1\r\n elif y_true[i] == ...
[ "0.6630832", "0.6571028", "0.6556596", "0.6473314", "0.64309907", "0.63886297", "0.6370331", "0.63595635", "0.6339869", "0.6319275", "0.6307369", "0.6293895", "0.6267422", "0.6246962", "0.6246624", "0.62017965", "0.61903733", "0.61852807", "0.6155317", "0.61364126", "0.613271...
0.66055423
1
Predict class for the given data, and return for each, a quantity that is positive if class is 1 and that is proportional to the likelihood of it being so.
def predict(self, X_test): if self.w is None: self.learn() Xt = np.append(np.ones((X_test.shape[0], 1)), X_test, axis=1) return np.dot(Xt, self.w)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def predict(self, testData=[]):\n result = []\n for classValue in self._classAttrs:\n #print(f'Computing Label: {classValue}, {self._classLabelMap[classValue]}')\n result.append(self._computeCondProb(testData, classValue))\n return self._classLabelMap[result.index(max(res...
[ "0.72790027", "0.71908313", "0.7190697", "0.7043576", "0.69684285", "0.69300467", "0.6913767", "0.68681943", "0.6833498", "0.68030864", "0.6747657", "0.6735201", "0.6731913", "0.67211103", "0.67160267", "0.6693065", "0.6685405", "0.6675456", "0.66752464", "0.66709", "0.666867...
0.0
-1
Provides callable object inspection result or raises an error when obj is not callable.
def __call__(self, obj: Any) -> CallableDetails: try: return CallableInspector.inspect(obj) except TypeError as e: raise IncompatibleHandlerFactoryError(f"{obj!r}: {e}")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __call__(self, obj: Any) -> CallableDetails:\n if self.subtype_of:\n if not isinstance(obj, self.subtype_of):\n raise IncompatibleHandlerFactoryError(\n f\"Object {obj!r} is not type of {self.subtype_of}\"\n )\n\n try:\n attr ...
[ "0.7163641", "0.69516593", "0.6710954", "0.66706973", "0.65568036", "0.624132", "0.61493", "0.6052162", "0.59412193", "0.5892052", "0.5885314", "0.58713126", "0.5717462", "0.57091385", "0.56844", "0.5650436", "0.5562526", "0.5492107", "0.5492107", "0.5463869", "0.5458223", ...
0.7690511
0
Initializes callable attribute inspection object, that (optionally) checks if object has valid type and performs callable inspection for given object attribute
def __init__(self, name: str, owner_subtype_of: Sequence[Any] = ()): self.name = name self.subtype_of = tuple(owner_subtype_of)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __call__(self, obj: Any) -> CallableDetails:\n if self.subtype_of:\n if not isinstance(obj, self.subtype_of):\n raise IncompatibleHandlerFactoryError(\n f\"Object {obj!r} is not type of {self.subtype_of}\"\n )\n\n try:\n attr ...
[ "0.6169512", "0.5867692", "0.5649971", "0.5479587", "0.54790753", "0.5438527", "0.5416831", "0.5392482", "0.538864", "0.5330999", "0.52994126", "0.5297237", "0.5277478", "0.52646536", "0.5259173", "0.5187636", "0.5184012", "0.5175098", "0.5161735", "0.51593304", "0.5156365", ...
0.0
-1
(Optionally) checks if object has valid type and performs callable inspection for given object attribute.
def __call__(self, obj: Any) -> CallableDetails: if self.subtype_of: if not isinstance(obj, self.subtype_of): raise IncompatibleHandlerFactoryError( f"Object {obj!r} is not type of {self.subtype_of}" ) try: attr = getattr(obj, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_object_input_type(func):\n @functools.wraps(func)\n def wrapper_check_input_type(ref, *args):\n new_args = [ref]\n for X in list(args):\n new_args.append(_check_type(X))\n return func(*new_args)\n return wrapper_check_input_type", "def callable(obj): # pylint: ...
[ "0.61445147", "0.60613203", "0.60088813", "0.6008327", "0.58711815", "0.5799993", "0.579401", "0.5771895", "0.5769235", "0.5731567", "0.57004875", "0.56973535", "0.5679467", "0.5675889", "0.5657475", "0.5612071", "0.55735457", "0.5561901", "0.5561592", "0.5544593", "0.5535281...
0.6381683
0
Initializes utility that finds primary argument for given callable object.
def __init__(self, name: Optional[str] = None): self.name = name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _find(self, details: CallableDetails) -> CallableArg:\n if self.name:\n return self._find_by_name(details, self.name)\n else:\n return self._get_first(details)", "def _get_first(details: CallableDetails) -> CallableArg:\n return details.args[0]", "def exec_init(se...
[ "0.60705334", "0.5996239", "0.59780276", "0.58660585", "0.58648115", "0.58648115", "0.55864275", "0.55150056", "0.5447591", "0.54198575", "0.5388015", "0.5355571", "0.53302926", "0.52588254", "0.5256217", "0.5247581", "0.52244556", "0.52153254", "0.52077585", "0.51786363", "0...
0.0
-1
Provides callable primary argument using `CallableDetails` object.
def __call__(self, details: CallableDetails) -> CallableArg: if not details.args: raise IncompatibleHandlerFactoryError( f"Callable {details.obj!r} has no explicit argument" ) arg = self._find(details) self._check_type(details, arg) return arg
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_first(details: CallableDetails) -> CallableArg:\n return details.args[0]", "def _find(self, details: CallableDetails) -> CallableArg:\n if self.name:\n return self._find_by_name(details, self.name)\n else:\n return self._get_first(details)", "def test_from_ca...
[ "0.7109241", "0.59839714", "0.5851964", "0.58431125", "0.5791142", "0.54043776", "0.5352862", "0.5227098", "0.5096238", "0.50932515", "0.5063101", "0.5007558", "0.49452066", "0.49097756", "0.48993295", "0.48318905", "0.4823576", "0.47898644", "0.47738937", "0.47529116", "0.47...
0.6864968
1
Finds primary callable argument using given details
def _find(self, details: CallableDetails) -> CallableArg: if self.name: return self._find_by_name(details, self.name) else: return self._get_first(details)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _find_by_name(details: CallableDetails, name: str):\n arg = details.arg_by_name(name)\n if not arg:\n raise IncompatibleHandlerFactoryError(\n f\"Callable {details.obj!r} has no argument named {name}\"\n )\n return arg", "def _get_first(details: Calla...
[ "0.7250849", "0.7104405", "0.7012228", "0.631682", "0.6020039", "0.6020039", "0.58984846", "0.57014513", "0.56677234", "0.56464416", "0.5597287", "0.55221516", "0.55119926", "0.55059236", "0.5500081", "0.54900837", "0.5486182", "0.5480125", "0.5451048", "0.5394405", "0.539440...
0.80219805
0
Tries to find primary argument by name using given callable details.
def _find_by_name(details: CallableDetails, name: str): arg = details.arg_by_name(name) if not arg: raise IncompatibleHandlerFactoryError( f"Callable {details.obj!r} has no argument named {name}" ) return arg
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _find(self, details: CallableDetails) -> CallableArg:\n if self.name:\n return self._find_by_name(details, self.name)\n else:\n return self._get_first(details)", "def __call__(self, details: CallableDetails) -> CallableArg:\n if not details.args:\n raise ...
[ "0.77201855", "0.67343926", "0.66744506", "0.6343532", "0.6250514", "0.6208963", "0.6162616", "0.6035895", "0.6024393", "0.5917119", "0.58666784", "0.5737716", "0.57368076", "0.5725504", "0.55969244", "0.5583836", "0.5477477", "0.5477477", "0.54448164", "0.54358494", "0.54218...
0.79737496
0
Returns first callable argument as primary
def _get_first(details: CallableDetails) -> CallableArg: return details.args[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getCallable():", "def one():\n return lambda f: lambda x: f(x)", "def _sfn(x):\n if len(x) == 1:\n return x[0]\n return fn(*x)", "def get_function(callable_):\n if isinstance(callable_, types.MethodType):\n return callable_.__func__\n return callable_", "def ide...
[ "0.66960406", "0.66022676", "0.63933474", "0.63744426", "0.62180066", "0.62013626", "0.6177867", "0.6130913", "0.60381055", "0.5894257", "0.5885121", "0.5880763", "0.5877375", "0.5840235", "0.58239746", "0.5770503", "0.57519287", "0.5726868", "0.5700403", "0.568225", "0.56512...
0.77594995
0
Checks given primary argument candidate is a valid one
def _check_type(details: CallableDetails, arg: CallableArg): if arg.type is None: raise HandlerFactoryError( f"Callable {details.obj!r} argument {arg.name} has no type annotation" ) if not isinstance(arg.type, type): raise HandlerFactoryError( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_args(self, args_):\n\n pass", "def __check_args(self):\n self.__check_args_type()\n self.__check_args_val()", "def valid_args(args):\n return args is not None and len(args) > 0", "def _check_args(self, args):\n if len(args) == 0:\n print(\"No parameters pr...
[ "0.6769899", "0.6752423", "0.66851634", "0.6584281", "0.64354455", "0.639382", "0.6384538", "0.6372433", "0.6343417", "0.6327111", "0.62636274", "0.6240947", "0.61763716", "0.6173696", "0.6136251", "0.61149687", "0.61081254", "0.6106819", "0.61019135", "0.60997623", "0.609799...
0.0
-1
Initializes callable handler factory using given specification.
def __init__( self, subject_as_keyword: bool, arg_map: Dict[str, str], arg_strict: bool ): self.subject_as_keyword = subject_as_keyword self.arg_map = arg_map self.arg_strict = arg_strict
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, handler_factory):\n self.handler_factory = handler_factory", "def _request_handler_factory(custom_param):\n\n def factory(*args):\n return _RequestHandler(custom_param, *args)\n\n return factory", "def test_init_adds_handler(self):\n pass", "def _instantiateHandl...
[ "0.69743943", "0.6180105", "0.6105791", "0.5773924", "0.5772643", "0.5765037", "0.56751215", "0.56560224", "0.5649918", "0.5647216", "0.56036854", "0.55175304", "0.5494751", "0.54794794", "0.5475322", "0.5472137", "0.54545325", "0.5437059", "0.5433695", "0.542079", "0.5419625...
0.0
-1
Creates callable handler using given specification and configuration.
def __call__(self, details: CallableDetails, arg: CallableArg, obj: Any) -> Handler: if not details.is_async: raise HandlerFactoryError(f"Object {details.obj!r} is not async callable") subject_name: Optional[str] if self.subject_as_keyword or not arg.is_positional: subje...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _request_handler_factory(custom_param):\n\n def factory(*args):\n return _RequestHandler(custom_param, *args)\n\n return factory", "def make_new_handler(self, *args, **kwargs):", "def create_handler(event, context):\n return update_endpoint(event)", "def request_handler(self, can_handle_f...
[ "0.5929271", "0.57534415", "0.57177836", "0.5481702", "0.52580607", "0.5249621", "0.5248432", "0.5231661", "0.52278626", "0.522743", "0.5192981", "0.5179029", "0.51718533", "0.5167504", "0.51572007", "0.5150701", "0.51149845", "0.5078468", "0.5066724", "0.5057126", "0.5011363...
0.5577627
3
This function returns the difference between the current position (`H1`) and a guess (`X`). It is used for the numeric fsolve.
def func(X, H1 = anglesAsNpArray): #motorAngles = inv_kinematic(X[0], X[1], X[2], X[3], X[4], X[5]) motorAngles = inv_kinematic(X) H2 = np.array(motorAngles) difference = H1 - H2 # calculate the difference between calulated and real angles return difference
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def diff(self, x1, x2):\n return x2 - x1", "def _hill_diff_diff(self, position):\n if position < 0:\n return 2\n else:\n return position * ((75 * (position ** 2)/((1 + 5 * position**2)**2.5)) - 5/((1 + 5 * position ** 2)**2.5)) \\\n - 10 * position/((1 + ...
[ "0.61347413", "0.6085866", "0.60638684", "0.6038321", "0.59709257", "0.5778428", "0.5737116", "0.5716165", "0.5680829", "0.5478029", "0.54694366", "0.54542005", "0.5452943", "0.5442601", "0.5441011", "0.54011977", "0.5392491", "0.53812736", "0.53619057", "0.53042966", "0.5246...
0.5861935
5
The column_expression() method is overridden to ensure that the SRID of the resulting WKBElement is correct
def column_expression(self, col): return getattr(func, self.impl.as_binary)( func.ST_Transform(col, self.app_srid), type_=self.__class__.impl(srid=self.app_srid) # srid could also be -1 so that the SRID is deduced from the # WKB data )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _column_water_vapor_expression(self):\n cwv_expression = '({c0}) + ({c1}) * ({Rji}) + ({c2}) * ({Rji})^2'\n\n return cwv_expression.format(c0=self.c0, c1=self.c1,\n Rji=DUMMY_Rji, c2=self.c2)", "def getGeometryColumnDef(self, schema, table, column):\r\n ...
[ "0.54994905", "0.51402336", "0.5061275", "0.501166", "0.49931175", "0.49211967", "0.4909486", "0.49018234", "0.4897842", "0.4888631", "0.487397", "0.4867399", "0.480978", "0.4799372", "0.4791726", "0.47903332", "0.47858167", "0.47667444", "0.47633633", "0.47496134", "0.474640...
0.7445827
0
Check if driver is installed and returns path
def getDriverPath(self, driverFolder, browser=None): for driverPath in list(driverFolder.glob('**/*.exe')): if browser is not None: if browser.lower() in driverPath.name: self.driverInstalledBool = True self.driverPath = driverPath ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_driver(drv):\n return GenericDriver.get_driver(drv)", "def driver_dir(self):\n if not self.metadata.driver_path:\n raise DriverParameterUndefined(\"driver_path undefined in metadata\")\n \n return os.path.join(self.driver_base_dir(),self.metadata.driver_path)", "def i...
[ "0.62105215", "0.59944856", "0.59613276", "0.5892248", "0.58769554", "0.5870386", "0.5859039", "0.58575493", "0.5809612", "0.57703876", "0.5740861", "0.57091326", "0.5631043", "0.5594376", "0.5565031", "0.5551958", "0.5550571", "0.55480534", "0.55416816", "0.5540941", "0.5538...
0.60263956
1
Creates selenium driver for webscrapping automation Downloads it into driver folder if not installed
def _downloadDriver(self): if not self.driverFolder.exists(): os.mkdir("driver") msgTxt = "User agent: " + self.userAgent + "<br>" self.announcer.announce(self.announcer.format_sse(msgTxt)) for browserVersion in self.userAgent.split(" "): if browserVersion.spli...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_selenium():\n # Define the options to run with headless mode enabled\n options = Options()\n options.headless = True\n\n # Instatiate the browser object here, pointing at an exectable location which should be located in the same\n # base directory as the script\n driver = webdriver.Fire...
[ "0.6866805", "0.6855302", "0.6822128", "0.6610871", "0.6569253", "0.656648", "0.6483102", "0.64660627", "0.6465365", "0.6460813", "0.63670164", "0.6320266", "0.6313826", "0.6309802", "0.6277847", "0.62708163", "0.62688744", "0.62457854", "0.6199809", "0.61945736", "0.6123801"...
0.7487497
0
Start selenium web driver
def createDriver(self, browser, driverPath, headless=None): self.headless = headless if browser == "Edg": edge_options = EdgeOptions() if self.headless: # make Edge headless edge_options.use_chromium = True edge_options.add_argume...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start(self):\n # iPhone\n #driver = webdriver.Remote(browser_name=\"iphone\", command_executor='http://172.24.101.36:3001/hub')\n # Android\n #driver = webdriver.Remote(browser_name=\"android\", command_executor='http://127.0.0.1:8080/hub')\n # Google Chrome \n #driver...
[ "0.77543885", "0.77543885", "0.77317667", "0.71477795", "0.70459723", "0.7023722", "0.68826663", "0.6781065", "0.6769597", "0.66986966", "0.666848", "0.66440135", "0.6625787", "0.65991884", "0.659535", "0.65879697", "0.6578746", "0.6569632", "0.6567064", "0.6567021", "0.65033...
0.0
-1
load old similarity matrix
def load_similarity(self, old_similarity_file): with open(old_similarity_file) as old_sim_f: for line in old_sim_f: fields = line.strip('\n').strip('\t').split('\t') if len(fields) == 2: s_vid = fields[0] score_str = fields[1] score_list = score_str.strip(' ').strip(',').split(',') if l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_matrix(self,filename):\n\n f = open(filename,'rb')\n tmp_dict = pickle.load(f)\n f.close()\n\n self.__dict__.update(tmp_dict)", "def loadmm(filepath):\n X = mmread(filepath)\n return fast_sparse_matrix(X)", "def load_matrices(self):\n self.wine_matrix =...
[ "0.62743086", "0.60209167", "0.5906724", "0.5877388", "0.58082116", "0.5714799", "0.5703919", "0.5644914", "0.56408775", "0.56357896", "0.56273323", "0.559635", "0.55857587", "0.5553376", "0.5532568", "0.55293345", "0.5527956", "0.5517922", "0.5509022", "0.55003285", "0.54926...
0.7791207
0
compute similarity matrix first compute similarity between old_video and videos then compute inner similarity of videos
def compute(self, old_videos, videos): linear_simialarity = LinearStructuralSimilarity([1.0, 0.5, 0.5, 0.5]) title_similarity = TitleSimilarity() tag_similarity = TagSimilarity() star_similarity = StarSimilarity() #compute doc vector for new vector self.compute_doc_vector(videos) #init s_matrix for new v...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_similarity(self):\n self.assertTrue(np.allclose(self.vectors.similarity('dog.n.01', 'dog.n.01'), 1))\n self.assertTrue(np.allclose(self.vectors.similarity('dog.n.01', 'mammal.n.01'), 0.180901358))", "def _calculate_similarity(self):\n self._logger.info(\"Calculating the similarity b...
[ "0.64262533", "0.6343288", "0.62151086", "0.6100288", "0.6099385", "0.60799444", "0.60501516", "0.6000153", "0.5994331", "0.5971573", "0.59625435", "0.5956585", "0.59330136", "0.5927438", "0.5920449", "0.5868006", "0.586378", "0.5842844", "0.5842844", "0.5830501", "0.58297914...
0.82006574
0
Data parser assuming the standard swissfel h5 format for raw data
def parseSFh5File_v01_old( files, memlimit_0D_MB=5, memlimit_mD_MB=132, createEscArrays=True ): if (type(files) is str) or (not np.iterable(files)): files = [files] datasets_all = [] for fina in files: fina = Path(fina) fh = h5py.File(fina.resolve(), mode="r") datasets = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def readH5 (dataset):\n if dataset.attrs['type']==PhotoZTemplateSED.typestr:\n return PhotoZTemplateSED()\n else:\n return None", "def parse_hdf5(inp, close=True, **kwargs):\n import json\n import h5py\n # Path\n path = kwargs.pop('path', '/')\n # Open\n if i...
[ "0.6743407", "0.65702033", "0.6296026", "0.628078", "0.62634206", "0.62465996", "0.617881", "0.6153489", "0.6063195", "0.6054801", "0.5956854", "0.59327334", "0.588888", "0.58754975", "0.58754975", "0.58637446", "0.5849271", "0.5845779", "0.58323854", "0.582739", "0.5811433",...
0.55477315
38
Helper method to visit a node by calling C{visit()} on each child of the node. This is useful because this vistitor only visits statements inside C{.body} attribute.
def generic_visit(self, node: ast.AST) -> None: for v in iter_values(node): self.visit(v)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generic_visit(self, node: Node, *args: t.Any, **kwargs: t.Any) -> t.Any:\n for child_node in node.iter_child_nodes():\n self.visit(child_node, *args, **kwargs)", "def generic_visit(self, n):\n self._add_ast_elem(n)\n for c_name, c in n.children():\n self.visit(c)", ...
[ "0.7334077", "0.673568", "0.6613816", "0.64196754", "0.638094", "0.6345343", "0.6302066", "0.62654185", "0.62625706", "0.62530327", "0.6222998", "0.61879945", "0.6138833", "0.6138833", "0.6036626", "0.59890574", "0.59713745", "0.59713745", "0.59661716", "0.5950219", "0.591372...
0.61534935
12
Returns the nested nodes in the body of a node.
def get_children(cls, node: ast.AST) -> Iterable[ast.AST]: body: Optional[Sequence[ast.AST]] = getattr(node, 'body', None) if body is not None: for child in body: yield child
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_child_nodes(node):\r\n return list(iter_child_nodes(node))", "def nodes(self):\r\n return (node.content for node in self.traverse())", "def children(node):\n\n return snd(node)", "def getVisitableNodes(self):\n\n value = self.subnode_loop_body\n\n if value is None:\n ...
[ "0.62883824", "0.6253895", "0.60750514", "0.60332704", "0.6013374", "0.58077276", "0.5789496", "0.56801975", "0.5561987", "0.54618096", "0.5426877", "0.5400886", "0.5373536", "0.5360819", "0.53477675", "0.534337", "0.5341113", "0.528977", "0.52756613", "0.52542585", "0.524975...
0.659452
0
Utility function to iterate assignments targets.
def iterassign(node:_AssingT) -> Iterator[Optional[List[str]]]: for target in node.targets if isinstance(node, ast.Assign) else [node.target]: dottedname = node2dottedname(target) yield dottedname
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __iter__(self) -> Iterator[BaseAssignment]:\n for assignments in self._assignments.values():\n for assignment in assignments:\n yield assignment", "def itermappings(self):\r\n return self.by_target.iteritems()", "def _init_targets(self):\n for ga_main, ga_targ i...
[ "0.6238221", "0.5730798", "0.57177293", "0.5576891", "0.5542461", "0.5514287", "0.5509637", "0.5486392", "0.5366283", "0.52967846", "0.52836627", "0.52819365", "0.5270679", "0.52261263", "0.52149117", "0.5211757", "0.5205998", "0.5185069", "0.5171819", "0.51701444", "0.514724...
0.71894705
0
Resove expression composed by L{ast.Attribute} and L{ast.Name} nodes to a list of names.
def node2dottedname(node: Optional[ast.AST]) -> Optional[List[str]]: parts = [] while isinstance(node, ast.Attribute): parts.append(node.attr) node = node.value if isinstance(node, ast.Name): parts.append(node.id) else: return None parts.reverse() return parts
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getAllNames(eList):\n if isinstance(eList, ast.Name): return [eList.id]\n if isinstance(eList, ast.List) or isinstance(eList, ast.Tuple):\n res = []\n for e in eList.elts:\n res += ModuleAffectation.getAllNames(e)\n return res\n\n #in attribute case\n return []", "def get_al...
[ "0.6460676", "0.60729074", "0.60377926", "0.59901816", "0.5879251", "0.58321583", "0.5814663", "0.5758657", "0.5712307", "0.5655078", "0.5655078", "0.5606655", "0.56022793", "0.55556303", "0.5539344", "0.553789", "0.55322945", "0.5528631", "0.5528631", "0.5498755", "0.5482725...
0.6924144
0
Binds the arguments of a function call to that function's signature.
def bind_args(sig: Signature, call: ast.Call) -> BoundArguments: kwargs = { kw.arg: kw.value for kw in call.keywords # When keywords are passed using '**kwargs', the 'arg' field will # be None. We don't currently support keywords passed that way. if kw.arg is not None ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bind(self, arg_names, **bound_params):\n bound_params=bound_params.copy()\n covered_args=set(bound_params)\n covered_args.update(arg_names)\n uncovered_mand_args=self.get_mandatory_args().difference(covered_args)\n if len(uncovered_mand_args)>0:\n raise TypeError(\...
[ "0.686672", "0.651832", "0.6490218", "0.64504725", "0.6233059", "0.61366934", "0.61016405", "0.6081702", "0.6081072", "0.5982045", "0.5922101", "0.5889668", "0.5869697", "0.5827673", "0.58158183", "0.57584053", "0.57411826", "0.57127994", "0.571075", "0.5703124", "0.5699975",...
0.7262054
0
Returns whether or not the given L{ast.Compare} is equal to C{__name__ == '__main__'}.
def is__name__equals__main__(cmp: ast.Compare) -> bool: return isinstance(cmp.left, ast.Name) \ and cmp.left.id == '__name__' \ and len(cmp.ops) == 1 \ and isinstance(cmp.ops[0], ast.Eq) \ and len(cmp.comparators) == 1 \ and _is_str_constant(cmp.comparators[0], '__main__')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pyname(ifmain=False):\n\n if ifmain is True:\n return __name__ == \"__main__\"\n return __name__", "def test_86_entry_point(self):\n\t\tinput = \"\"\"function main():boolean; begin return true; end\"\"\"\n\t\texpect = \"No entry point\"\n\t\tself.assertTrue(TestChecker.test(input,expect,486))", ...
[ "0.6524941", "0.5941381", "0.58739746", "0.56843954", "0.5605056", "0.5605056", "0.55951595", "0.555615", "0.5535139", "0.5534004", "0.5527757", "0.5511792", "0.5495729", "0.54766375", "0.5437922", "0.53829", "0.53390026", "0.5324442", "0.5317175", "0.5284627", "0.5268249", ...
0.81914234
0
Detect if this expr is firstly composed by one of the specified annotation(s)' full name.
def is_using_annotations(expr: Optional[ast.AST], annotations:Sequence[str], ctx:'model.Documentable') -> bool: full_name = node2fullname(expr, ctx) if full_name in annotations: return True if isinstance(expr, ast.Subscript): # Final[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _has_annotation(annotation, value):\n def matches_property_name(fun):\n \"\"\" return true if fun is a callable that has the correct annotation with value \"\"\"\n return callable(fun) and getattr(fun, annotation, None) == value\n\n return matches_property_name", "def find_decorator_annot...
[ "0.6133732", "0.5805781", "0.5771596", "0.57191354", "0.57060945", "0.56400615", "0.545979", "0.52515405", "0.518645", "0.5162041", "0.51450115", "0.51298565", "0.5105125", "0.509733", "0.5071324", "0.50644857", "0.5061237", "0.50583386", "0.50457674", "0.5022702", "0.5016724...
0.70489085
0
Does this AST node represent the literal constant None?
def is_none_literal(node: ast.expr) -> bool: return isinstance(node, (ast.Constant, ast.NameConstant)) and node.value is None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_literal(node):\n # Normal literals, True/False/None/Etc. in Python3\n if is_constant(node):\n return True\n\n # True/False/None/Etc. in Python2\n if isinstance(node, gast.Name) and node.id in ['True', 'False', 'None']:\n return True\n\n return False", "def is_none(obj):\n return obj is None"...
[ "0.71573704", "0.69151956", "0.685752", "0.6803881", "0.67793304", "0.6737035", "0.6721206", "0.6624201", "0.66209817", "0.6463004", "0.64455515", "0.6415827", "0.6412687", "0.63989663", "0.6345217", "0.63196254", "0.63196254", "0.6287789", "0.6263268", "0.6203727", "0.616627...
0.8856685
0
Replace all strings in the given expression by parsed versions.
def unstring_annotation(node: ast.expr, ctx:'model.Documentable', section:str='annotation') -> ast.expr: try: expr = _AnnotationStringParser().visit(node) except SyntaxError as ex: module = ctx.module assert module is not None module.report(f'syntax error in {section}: {ex}', lin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_evaluate_replace_expression(self):\n value = self.evaluate_common(\"replace('startswith','tart','cake')\")\n self.assertTrue(\n value.type_code == edm.SimpleType.String, \"Expected String\")\n self.assertTrue(value.value == \"scakeswith\")\n value = self.evaluate_com...
[ "0.5946568", "0.5588788", "0.5583122", "0.5541096", "0.5460228", "0.54547364", "0.54008454", "0.53724885", "0.5330291", "0.5280548", "0.5263197", "0.52612746", "0.5254677", "0.52531695", "0.5251866", "0.5183473", "0.51681066", "0.51247287", "0.5116059", "0.50677323", "0.50179...
0.0
-1
Whether this annotation node refers to a typing alias.
def is_typing_annotation(node: ast.AST, ctx: 'model.Documentable') -> bool: return is_using_annotations(node, TYPING_ALIAS, ctx) or \ is_using_annotations(node, SUBSCRIPTABLE_CLASSES_PEP585, ctx)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _assigns_typealias(node: nodes.NodeNG | None) -> bool:\n inferred = utils.safe_infer(node)\n if isinstance(inferred, nodes.ClassDef):\n if inferred.qname() == \".Union\":\n # Union is a special case because it can be used as a type alias\n # or as a type a...
[ "0.802317", "0.6705739", "0.6592284", "0.6592182", "0.65373164", "0.6446264", "0.64429694", "0.6420348", "0.5929463", "0.591582", "0.5890334", "0.5854305", "0.5834295", "0.58193356", "0.58193356", "0.5818589", "0.5749064", "0.57306594", "0.57211465", "0.5695293", "0.56425035"...
0.7278951
1
r""" In older CPython versions, the AST only tells us the end line number and we must approximate the start line number. This approximation is correct if the docstring does not contain explicit newlines ('\n') or joined lines ('\' at end of line). Leading blank lines are stripped by cleandoc(), so we must return the li...
def extract_docstring_linenum(node: ast.Str) -> int: doc = node.s lineno = node.lineno if _string_lineno_is_end: # In older CPython versions, the AST only tells us the end line # number and we must approximate the start line number. # This approximation is correct if the docstring do...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_docstring(node: ast.Str) -> Tuple[int, str]:\n lineno = extract_docstring_linenum(node)\n return lineno, inspect.cleandoc(node.s)", "def get_line_no(obj):\n try:\n lineno = getsourcelines(obj)[1]\n except:\n # no code found\n lineno = None\n return lineno", "def ...
[ "0.6592318", "0.64880145", "0.62865794", "0.6142324", "0.6134017", "0.6064574", "0.5985964", "0.598403", "0.59628624", "0.5903572", "0.5894252", "0.5847096", "0.5840898", "0.5822657", "0.5815142", "0.58113086", "0.57936656", "0.57820433", "0.5780574", "0.5721187", "0.57102555...
0.82820135
0
Extract docstring information from an ast node that represents the docstring.
def extract_docstring(node: ast.Str) -> Tuple[int, str]: lineno = extract_docstring_linenum(node) return lineno, inspect.cleandoc(node.s)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_info(self, docstring):\n pass", "def get_docstring(node, trim=True):\r\n if not isinstance(node, (FunctionDef, ClassDef, Module)):\r\n raise TypeError(\"%r can't have docstrings\" % node.__class__.__name__)\r\n if node.body and isinstance(node.body[0], Expr) and \\\r\n isins...
[ "0.7227713", "0.68695927", "0.6678261", "0.6563689", "0.65097564", "0.63284135", "0.6290309", "0.62477165", "0.6228817", "0.6196725", "0.59609747", "0.58749866", "0.58451766", "0.58434576", "0.58255154", "0.57662874", "0.57577497", "0.5751068", "0.57465714", "0.5742046", "0.5...
0.77947456
0
Parse binary data to a (list of) ticks structure.
def _parse_binary(self, bin): packets = self._split_packets(bin) # split data to individual ticks packet data = [] print_message("_parse_binary ") for packet in packets: instrument_token = self._unpack_int(packet, 0, 4) segment = instrument_token & 0xff # Retriv...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_data( self, data ):\n data = data.split( ',' )\n data = list( map( lambda x: x.strip(), data ) ) # remove white space\n # create data structure\n fields = [\n 'time',\n 'value'\n ] \n Reading = namedtuple( 'Reading', fields )\n \n ...
[ "0.61135006", "0.6055378", "0.60015744", "0.58360213", "0.58193314", "0.57560265", "0.5685558", "0.5674893", "0.5644839", "0.56013477", "0.5601027", "0.5582937", "0.55707127", "0.55646104", "0.55526763", "0.55485", "0.5535959", "0.5530505", "0.55291134", "0.5478263", "0.54535...
0.6553171
0
Funcao gulosa para realizar a compra e venda das acoes com base na regra do filtro
def greedy_filter_rule(np_array, filter_rule, money): i = 1 stock_count = 0 peaks = findPeakAndValley(np_array) while (i < len(np_array)): if (getSignal(np_array, i, filter_rule[FILTER_PREVIOUS_INDEX], peaks, filter_rule[FILTER_RATE_INDEX]) == 1): stock_count = int(money/np_array[i][...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filterRansac():\n pass", "def filter(self, filters):", "def aplicar_filtro(self, nome_filtro, mascara=None, tecnica=None):\n if tecnica:\n self.imagem_core.aplicar_filtro(\n nome_filtro=nome_filtro,\n tecnica=tecnica\n )\n else:\n ...
[ "0.6644583", "0.6120918", "0.60650533", "0.5967219", "0.572441", "0.56378996", "0.55968493", "0.55531615", "0.5436992", "0.54346037", "0.53792185", "0.53696275", "0.53539944", "0.531356", "0.5249722", "0.5241573", "0.520035", "0.5182611", "0.5163846", "0.51544535", "0.5147222...
0.0
-1
Funcao que encontra todos os picos e vales em um conjunto de dados
def findPeakAndValley(np): peakValleyArray = [] for i in range (1, len(np) - 1): if (np[i][STOCK_VALUE_INDEX] / np[i - 1][STOCK_VALUE_INDEX] > 1 and np[i + 1][STOCK_VALUE_INDEX] / np[i][STOCK_VALUE_INDEX] < 1): peakValleyArray.append(i) if (np[i][STOCK_VALUE_INDEX] / np[i - 1][STOCK_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getimgs():", "def esconderfichas(posicion_del_mouse):\r\n numerodecuadrado=numerocuadrado(posicion_del_mouse)\r\n for j in range(16):\r\n if numerodecuadrado==j+1:\r\n pygame.draw.rect(ventana,(135,206,250),Totalcuadrados[j].inflate(-10,-10))", "def cargar_imagenes(s...
[ "0.6220025", "0.6100009", "0.5943744", "0.5870396", "0.57638514", "0.57339865", "0.5687181", "0.5569781", "0.55651355", "0.5554342", "0.5548831", "0.5536759", "0.5528138", "0.5521925", "0.55168456", "0.5470549", "0.54660124", "0.54449826", "0.5436736", "0.5428106", "0.5426661...
0.0
-1
Decorate with this method to restrict to site admins.
def requires_admin(method): def wrapper(self, *args, **kwargs): user = users.get_current_user() if not user: if web.ctx.method == "GET": raise web.seeother(users.create_login_url(web.ctx.fullpath)) raise web.forbidden() elif not (users.is_curren...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def admin_required(f): # pragma: no cover\r\n @wraps(f)\r\n def decorated_function(*args, **kwargs):\r\n if current_user.admin:\r\n return f(*args, **kwargs)\r\n else:\r\n return abort(403)\r\n return decorated_function", "def admin_required(func):\n\n @functools.wr...
[ "0.7528415", "0.7462979", "0.7458936", "0.72655714", "0.72464097", "0.72039413", "0.7194642", "0.71797323", "0.709075", "0.7041312", "0.7041312", "0.7039178", "0.7028399", "0.7025085", "0.7011953", "0.7007678", "0.70071805", "0.69871885", "0.697566", "0.6973469", "0.6950791",...
0.71145314
8
get_output_names(hf) Returns a list of the output variables names in the HDF5 file.
def get_output_names(hf): return sorted(map(str, hf['/output/data'].keys()))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_output_names(self):\n outputNames = []\n for outVar in self.outputs:\n # outVar is of type InOutVar and the object that it contains is a PyFMI variable\n outputNames.append(outVar.get_object().name)\n return outputNames", "def get_output_names():\n names = [d...
[ "0.76356333", "0.6916509", "0.6748627", "0.65659255", "0.6232123", "0.61639875", "0.6125135", "0.6119702", "0.61163217", "0.6079278", "0.60771716", "0.6036082", "0.59585243", "0.5932175", "0.5917851", "0.59070086", "0.58867127", "0.5840342", "0.57954717", "0.5775529", "0.5723...
0.84170973
0
set_result(hf, var, data, desc='') Sets values of the output variable in the HDF5 file. Writes array to '/output/data/var'.
def set_result(hf, var, data, desc=''): try: del hf['/output/data/%s' % var] except: pass hf['/output/data/%s' % var] = data hf['/output/data/%s' % var].attrs['description'] = desc
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_result(hf, var=None):\n if '/output/data' not in hf:\n return []\n\n output_variables = get_output_names(hf)\n if len(output_variables) == 0:\n return []\n\n if var and var not in output_variables:\n print(\"Variable %s not found in output data\" % var)\n raise Value...
[ "0.6182932", "0.58338", "0.580313", "0.57810116", "0.57189673", "0.563597", "0.54657924", "0.53459704", "0.5341494", "0.5316227", "0.526054", "0.52308077", "0.5229582", "0.5224582", "0.52132416", "0.52110887", "0.52061415", "0.51927775", "0.5171107", "0.51699406", "0.5156512"...
0.7462429
0
get_result(hf, var=None) Returns an array containing the values of the output variable.
def get_result(hf, var=None): if '/output/data' not in hf: return [] output_variables = get_output_names(hf) if len(output_variables) == 0: return [] if var and var not in output_variables: print("Variable %s not found in output data" % var) raise ValueError if not ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_response(hf, var):\n psweep = hf.attrs['UQtype']\n return unpickle(hf['/%s/%s/response' % (psweep, var)].value)", "def _get_result(self):\r\n \r\n return self._result", "def remote_getResult(i=None):", "def get_result(self) -> Any:\n ...", "def getOutputValue(self, paramn...
[ "0.5833718", "0.5822366", "0.5708725", "0.5597114", "0.5449637", "0.540228", "0.5389764", "0.5344381", "0.53330904", "0.5330267", "0.5330267", "0.5330267", "0.5330267", "0.5330267", "0.5330267", "0.5304302", "0.5272941", "0.52592576", "0.52443486", "0.52309984", "0.52123004",...
0.86683446
0
get_param_names(hf) Returns a list of the input parameter names in the HDF5 file.
def get_param_names(hf): parameters = get_params(hf) return [p.name for p in parameters]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_param_names(self):\n return list(self.params.keys())", "def _get_fitted_param_names(self):\n return self._fitted_param_names", "def parameter_names(self) -> List[str]:", "def param_names(\n self, *, include_tp: bool = False, include_gq: bool = False\n ) -> List[str]:\n ...
[ "0.678714", "0.6763911", "0.67390025", "0.65343535", "0.64527595", "0.640645", "0.6373287", "0.63533026", "0.62380046", "0.62231135", "0.62230515", "0.6222808", "0.61919844", "0.6164576", "0.6138721", "0.60182977", "0.6003311", "0.59651834", "0.59189415", "0.5841817", "0.5808...
0.84310985
0
get_params(hf) Returns a list of arrays of input parameter values.
def get_params(hf): plist = [] for p in hf['/input/params']: val = hf['/input/params'][p].value if type(val) != str: val = val.decode('UTF-8') plist.append(unpickle(val)) return plist
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_param_names(hf):\n parameters = get_params(hf)\n return [p.name for p in parameters]", "def _get_parameters(self) -> list:\n return self.parameters", "def get_params(self):\n return list(self.params.values())", "def get_params(self):\n return self.arr", "def get_params(se...
[ "0.6893457", "0.6837561", "0.6804596", "0.6723788", "0.66528517", "0.65687764", "0.6551635", "0.6501132", "0.6497645", "0.64971256", "0.64833355", "0.63932973", "0.63927233", "0.63927233", "0.63614494", "0.636041", "0.6346599", "0.63385177", "0.63385177", "0.6331291", "0.6312...
0.778357
0
data_description(hf, var) Returns the description of an output variable. If the description is empty, returns the variable name.
def data_description(hf, var): desc = hf['/output/data/%s' % var].attrs['description'] if type(desc) != str: desc = desc.decode('UTF-8') if desc: return desc return var
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def param_description(hf, var):\n val = hf['/input/params/%s' % var].value\n if type(val) != str:\n val = val.decode('UTF-8')\n val = unpickle(val)\n desc = val.description\n\n if desc:\n return desc\n return var", "def get_result(hf, var=None):\n if '/output/data' not in hf:\n...
[ "0.6864165", "0.6221898", "0.60169995", "0.57531977", "0.55221105", "0.55126", "0.54335487", "0.5421851", "0.5389285", "0.5331602", "0.5328696", "0.5308557", "0.5298564", "0.52873766", "0.5269236", "0.5197202", "0.5176139", "0.5157434", "0.51519734", "0.51199126", "0.5100956"...
0.8516398
0
param_description(hf, var) Returns the description of an input variable. If the description is empty, returns the variable name.
def param_description(hf, var): val = hf['/input/params/%s' % var].value if type(val) != str: val = val.decode('UTF-8') val = unpickle(val) desc = val.description if desc: return desc return var
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def data_description(hf, var):\n desc = hf['/output/data/%s' % var].attrs['description']\n if type(desc) != str:\n desc = desc.decode('UTF-8')\n\n if desc:\n return desc\n return var", "def prompt_for_var_name():\n return input('Variable name? ')", "def __make_description(self, par...
[ "0.66426176", "0.5668525", "0.55906206", "0.5473964", "0.54583865", "0.540782", "0.540782", "0.540782", "0.540782", "0.540782", "0.53399444", "0.5315237", "0.5301181", "0.5249107", "0.52275527", "0.5164749", "0.5137802", "0.50963116", "0.5015387", "0.50141335", "0.50134474", ...
0.83119935
0
get_response(hf, var) Returns the response function for an output variable.
def get_response(hf, var): psweep = hf.attrs['UQtype'] return unpickle(hf['/%s/%s/response' % (psweep, var)].value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_result(hf, var=None):\n if '/output/data' not in hf:\n return []\n\n output_variables = get_output_names(hf)\n if len(output_variables) == 0:\n return []\n\n if var and var not in output_variables:\n print(\"Variable %s not found in output data\" % var)\n raise Value...
[ "0.6871027", "0.5856201", "0.5806765", "0.56712204", "0.56248873", "0.5505011", "0.54478437", "0.544699", "0.541844", "0.536069", "0.5339047", "0.53001714", "0.5293824", "0.51962996", "0.51894706", "0.5179314", "0.51732165", "0.5162863", "0.5153784", "0.5099067", "0.5099067",...
0.75603396
0
Do not return anything, modify nums inplace instead.
def rotate(self, nums: List[int], k: int) -> None: n = len(nums) k %= n for _ in range(k): nums.insert(0, nums.pop())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fn(i):\n if i == len(nums): ans.append(nums.copy())\n for j in range(i, len(nums)): \n nums[i], nums[j] = nums[j], nums[i]\n fn(i+1)\n nums[i], nums[j] = nums[j], nums[i]", "def double_nums(num_list):", "def remove_dups(nums):\r\n nums[:...
[ "0.70469916", "0.67161703", "0.66934896", "0.6586775", "0.6501143", "0.6482345", "0.6442288", "0.6407945", "0.6376896", "0.6372343", "0.63671577", "0.6365932", "0.63512594", "0.6328759", "0.6298402", "0.62855035", "0.62671727", "0.62472045", "0.62221444", "0.6193869", "0.6188...
0.0
-1
Do not return anything, modify nums inplace instead.
def rotate(self, nums: List[int], k: int) -> None: n = len(nums) k %= n nums[:] = nums[-k:] + nums[:-k]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fn(i):\n if i == len(nums): ans.append(nums.copy())\n for j in range(i, len(nums)): \n nums[i], nums[j] = nums[j], nums[i]\n fn(i+1)\n nums[i], nums[j] = nums[j], nums[i]", "def double_nums(num_list):", "def remove_dups(nums):\r\n nums[:...
[ "0.70469916", "0.67161703", "0.66934896", "0.6586775", "0.6501143", "0.6482345", "0.6442288", "0.6407945", "0.6376896", "0.6372343", "0.63671577", "0.6365932", "0.63512594", "0.6328759", "0.6298402", "0.62855035", "0.62671727", "0.62472045", "0.62221444", "0.6193869", "0.6188...
0.0
-1
Do not return anything, modify nums inplace instead.
def rotate(self, nums: List[int], k: int) -> None: n = len(nums) k %= n nums[:] = nums[::-1] nums[:k] = nums[:k][::-1] #print(nums) nums[k:] = nums[k:][::-1] #print(nums)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fn(i):\n if i == len(nums): ans.append(nums.copy())\n for j in range(i, len(nums)): \n nums[i], nums[j] = nums[j], nums[i]\n fn(i+1)\n nums[i], nums[j] = nums[j], nums[i]", "def double_nums(num_list):", "def remove_dups(nums):\r\n nums[:...
[ "0.70462054", "0.6715351", "0.66929126", "0.65873164", "0.65023595", "0.64822435", "0.6440834", "0.6406664", "0.63777506", "0.63735336", "0.6368216", "0.63669443", "0.6350561", "0.63289344", "0.62994266", "0.6287385", "0.6268109", "0.6247793", "0.6223016", "0.61956227", "0.61...
0.0
-1
Do not return anything, modify nums inplace instead.
def rotate(self, nums: List[int], k: int) -> None: n = len(nums) k %= n if k == 0:return start = 0 tmp = nums[start] cnt = 0 while cnt < n: nxt = (start + k) % n while nxt != start: nums[nxt], tmp = tmp, nums[nxt] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fn(i):\n if i == len(nums): ans.append(nums.copy())\n for j in range(i, len(nums)): \n nums[i], nums[j] = nums[j], nums[i]\n fn(i+1)\n nums[i], nums[j] = nums[j], nums[i]", "def double_nums(num_list):", "def remove_dups(nums):\r\n nums[:...
[ "0.70469916", "0.67161703", "0.66934896", "0.6586775", "0.6501143", "0.6482345", "0.6442288", "0.6407945", "0.6376896", "0.6372343", "0.63671577", "0.6365932", "0.63512594", "0.6328759", "0.6298402", "0.62855035", "0.62671727", "0.62472045", "0.62221444", "0.6193869", "0.6188...
0.0
-1
Gets the id from a slack users name
def get_id_from_name(slack_client, name): api_call = slack_client.api_call("users.list") if api_call.get('ok'): # retrieve all users so we can find our bot users = api_call.get('members') for user in users: if 'name' in user and user['name'] == name: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_slack_id(user):\n members = get_slack_users()\n user_name = [member for member in members if member.get('profile').get(\n 'email') == user['email']]\n return user_name[0].get('id') if user_name else ''", "def _get_user_id(self, name):\n try:\n apiResponse = twitchAPI.twi...
[ "0.8026936", "0.7219842", "0.7033729", "0.701138", "0.69746554", "0.6746316", "0.6746316", "0.6746316", "0.6739249", "0.67276496", "0.6724841", "0.6632618", "0.6632618", "0.66051096", "0.65846807", "0.6565719", "0.65635425", "0.65570116", "0.652876", "0.65262294", "0.651276",...
0.8519256
0
Will log details of the user
def details(self): logging.info(self.user)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_successful_login(sender, request, user, **kwargs):\r\n if settings.FEATURES['SQUELCH_PII_IN_LOGS']:\r\n AUDIT_LOG.info(u\"Login success - user.id: {0}\".format(user.id))\r\n else:\r\n AUDIT_LOG.info(u\"Login success - {0} ({1})\".format(user.username, user.email))", "def log_user_logg...
[ "0.7045293", "0.686289", "0.6788697", "0.67700326", "0.676148", "0.676148", "0.6721874", "0.67000073", "0.66643417", "0.6644595", "0.6636795", "0.6549175", "0.6535793", "0.64914346", "0.6446965", "0.64277387", "0.64151555", "0.63879734", "0.6370343", "0.6360823", "0.63441104"...
0.83647823
0
Will get the users presence
def presence(self): return self.slack_client.api_call("users.getPresence?user="+self.user_id)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def online(self):\n api_call = self.presence()\n if api_call.get('ok'):\n # retrieve all users so we can find our bot\n return api_call.get('online')\n return None", "def presence(self, params=None, timeout=None):\n params = params or {}\n path = '/channel...
[ "0.6822324", "0.6642054", "0.64109", "0.61725354", "0.60397285", "0.6022395", "0.60211736", "0.5923945", "0.584164", "0.58316106", "0.57659245", "0.5763912", "0.5741214", "0.5738428", "0.57166594", "0.5693123", "0.5687724", "0.56435466", "0.56251895", "0.56243795", "0.5612464...
0.8522565
0
Will get all users that are online
def online(self): api_call = self.presence() if api_call.get('ok'): # retrieve all users so we can find our bot return api_call.get('online') return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_online_users():\n online_users = models.User.query.filter(User.status == UserStatus.ONLINE).all()\n if online_users:\n return jsonify(online_users=[user.serialize for user in online_users])\n else:\n return {'online_users': []}", "def online_users(room):\n threshold = datetime.now...
[ "0.82204556", "0.80825126", "0.8029542", "0.74353147", "0.72630364", "0.7168741", "0.7161839", "0.71312636", "0.70974296", "0.695896", "0.68751913", "0.68485606", "0.68477714", "0.68081176", "0.6792076", "0.677629", "0.67632926", "0.67481744", "0.6738873", "0.6737787", "0.670...
0.65055305
43
Check that the data in the DataFrame is valid.
def sanitize_data(data: pd.DataFrame) -> pd.DataFrame: # discard nan values data.dropna(inplace=True) # Create conformers data['molecules'].apply(lambda mol: AllChem.EmbedMolecule(mol)) # Discard molecules that do not have conformer LOGGER.info("Removing molecules that don't have any conformer...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_dataframe_valid(self, df, option):\n # display(df)\n if df[option].isna().sum() > df.shape[0]/2:\n print(\"invalid data\")\n return False\n else:\n print(\"valid data\")\n return True", "def validateBedGraph(df):\n try:\n msg = ...
[ "0.8022101", "0.75164783", "0.74876267", "0.7412682", "0.7402119", "0.7385674", "0.73772913", "0.73698014", "0.7363236", "0.7298478", "0.7247538", "0.72318524", "0.7005214", "0.6975772", "0.6942253", "0.68710226", "0.6803546", "0.6792914", "0.678243", "0.6763489", "0.6757903"...
0.0
-1
Pretty JSON dump of an object.
def pprint(self,obj): return(json.dumps(obj, sort_keys=True, indent=2, separators=(',', ': ')))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def json_dumps(self, obj: object) -> str:\n return json.dumps(obj, sort_keys=self.beautify, indent=4)", "def print_json(obj):\n print(json.dumps(obj, indent=2))", "def pprint(obj):\n return json.dumps(obj, sort_keys=True, indent=2, separators=(',', ': '))", "def pprint(obj):\n return json.dum...
[ "0.79998887", "0.7930918", "0.7916694", "0.7916694", "0.78797597", "0.7752486", "0.7712631", "0.7646695", "0.7569254", "0.75250614", "0.74820435", "0.74561304", "0.741061", "0.7307335", "0.72820616", "0.7219065", "0.72057736", "0.70947427", "0.70880896", "0.7081247", "0.70657...
0.79296386
2
Retrieve the device information. returns a list of devices (may be just 1)
async def get_device_list(self): self.logger.debug("Retrieving device list information.") #url = 'https://{}/api/user/device'.format(self.apiHost) #suddenly stopped worrking, so use ''' #full version url = 'https://{}/api/user/device?lang=en&apiKey={}&getTags=1&version={}&ts={...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_devices(self):\n return self.api_request('GET', self.url + '/device', {})", "def list_devices(self):\n response = self.oauth.get(url=f'{self.base_url}/json/devices/list')\n\n result = response.json()['device']\n for device in result:\n print(device)", "def list_de...
[ "0.86730283", "0.8359798", "0.81520224", "0.8114519", "0.8109941", "0.81042016", "0.7998469", "0.7996502", "0.79862076", "0.79225564", "0.7898877", "0.7893741", "0.78413266", "0.7815098", "0.7796623", "0.7709441", "0.7665992", "0.7561833", "0.756045", "0.7517452", "0.74915403...
0.7405833
29
Connect to Hub Web Socket
async def _perform_connect(self): # Return connected if we are already connected. if self._websocket: if self._websocket.open: return True self.logger.debug("Starting connect.") self.logger.debug("Connecting to %s" % self.wsc_url) self._websocket = a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _connect(self):\r\n self.sock = socket.socket()\r\n host = \"pubsub.pubnub.com\"\r\n port = 80\r\n if self.use_ssl:\r\n self.sock = ssl.wrap_socket(self.sock)\r\n port = 443\r\n self.sock.connect((host, port))\r\n self.connected = True", "def co...
[ "0.67647475", "0.6674295", "0.6668855", "0.6447456", "0.64024764", "0.6394896", "0.63674134", "0.6354513", "0.63220066", "0.63130623", "0.6308134", "0.62977916", "0.6280327", "0.6187637", "0.6154695", "0.6130933", "0.61202985", "0.61073273", "0.6100157", "0.60983205", "0.6091...
0.0
-1
Connect to Hub Web Socket
async def connect(self): await self._perform_connect() self.logger.debug("ewelink Connected") self._publish('client', 'status', "Connected") self._disconnecting = False await self._receive_loop()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _connect(self):\r\n self.sock = socket.socket()\r\n host = \"pubsub.pubnub.com\"\r\n port = 80\r\n if self.use_ssl:\r\n self.sock = ssl.wrap_socket(self.sock)\r\n port = 443\r\n self.sock.connect((host, port))\r\n self.connected = True", "def co...
[ "0.67647475", "0.6674295", "0.6668855", "0.6447456", "0.64024764", "0.6394896", "0.63674134", "0.6354513", "0.63220066", "0.63130623", "0.6308134", "0.62977916", "0.6280327", "0.6187637", "0.6154695", "0.6130933", "0.61202985", "0.61073273", "0.6100157", "0.60983205", "0.6091...
0.57395875
57
Send a payload request to websocket
async def _send_request(self, command, waitResponse=False): # Make sure we're connected. await self._perform_connect() while self._timeout > 0: self.logger.debug('waiting for previous command response') await asyncio.sleep(1) self.logger.debug("Sending ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _send_websocket_request(self, name, msg):\n data = json.dumps(dict(name=name, msg=msg))\n self.websocket.send(data)", "def sendMessage(self, payload, isBinary):", "def Send(self, payload):\n self._sock.send(payload)", "def send(self, msg):\n self.ws.send(json.dumps(msg))", "asyn...
[ "0.7339152", "0.6924441", "0.68957126", "0.6877585", "0.6863502", "0.6824982", "0.67150366", "0.66515094", "0.657414", "0.6503672", "0.64857006", "0.64737594", "0.6409388", "0.6404948", "0.6355655", "0.6343522", "0.63304794", "0.62827003", "0.6254023", "0.62061894", "0.619910...
0.0
-1