query
stringlengths
10
2k
document
stringlengths
20
51.2k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Return group which specified variable belongs to.
def get_var_group(self, variable): return self.dataset[variable].group()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_group(self):\n\t\treturn self.variables.get('group')", "def get_group(self, group_name):\n\n return self._group[group_name]", "def what_is(self, _id):\n for g in self.groups:\n if _id in self.h_group_ids[g]:\n return g\n return None", "def getGroup(self, index):\n index = ...
[ "0.7664513", "0.69495916", "0.6586702", "0.65188766", "0.6496122", "0.64858675", "0.6438629", "0.6420008", "0.6369306", "0.6363457", "0.6362466", "0.6318557", "0.6317046", "0.6288889", "0.6288889", "0.6288889", "0.6219791", "0.6209329", "0.6189676", "0.6157111", "0.61287713",...
0.8086381
0
Returns dictionary containing the values in each variable specified in the variable list.
def extract_var_data(self, var_names): variable_dict = {} # Declaring dictionary used to store key-val pairs, var_name as key and the array as the value try: for var in var_names: variable_dict[var] = self.dataset[var].values return variable_dict except E...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dictOfVariables(self):\n return {x.name: x for x in self.variables}", "def get_variable_values_dict(self, vars):\n vars = list(vars)\n values = self.get_variable_values(vars)\n ret = OrderedDict()\n for var, value in zip(vars, values):\n ret[var] = value\n ...
[ "0.73812175", "0.7224125", "0.71311104", "0.71002686", "0.692769", "0.6803993", "0.67318344", "0.6728976", "0.6723781", "0.67019045", "0.66866034", "0.6637276", "0.6618296", "0.6594967", "0.6570592", "0.6499321", "0.6485431", "0.6477556", "0.6390929", "0.63758665", "0.6359514...
0.6770916
6
Create a onehot encoding of x of size k.
def one_hot(x, k, dtype=np.float32): return np.array(x[:, None] == np.arange(k), dtype)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _one_hot(z, K):\n z_one_hot = np.zeros((z.size, K))\n z_one_hot[np.arange(z.size), z] = 1\n return z_one_hot", "def one_hot(x, k, dtype=np.float32):\n return np.array(x[:, None] == np.arange(k), dtype)", "def _one_hot(x, k, dtype=np.float32):\n return np.array(x[:, None] == np.arange(k), dty...
[ "0.80434245", "0.79738784", "0.789764", "0.78884685", "0.7798938", "0.7713476", "0.75701195", "0.7564563", "0.74274504", "0.74171615", "0.7357122", "0.73545736", "0.73471665", "0.7343507", "0.72914994", "0.72856927", "0.7204719", "0.720342", "0.71893036", "0.7163224", "0.7161...
0.8009584
1
Construct a softmax output layer.
def output_layer(self, h_, labels_): with tf.name_scope("Output_Layer"): self.W_out_ = tf.get_variable("W_out", shape=[h_.get_shape()[1].value,len(self.embed[0])], initializer=tf.random_normal_initializer()) self.b_out_ = tf.get_variable("b_out", shape=[len(self.embed[0])], initializer=t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def softmax(x, name):\n with tf.name_scope(name):\n outputs = tf.nn.softmax (x)\n # Return layer's output\n return outputs", "def output_layer(self, x):\n if self.adaptive_softmax is None:\n if self.share_input_output_embed:\n x = F.linear(...
[ "0.7481631", "0.7153644", "0.70550036", "0.702259", "0.6953498", "0.6894149", "0.68394864", "0.66512126", "0.6646961", "0.6636902", "0.6604942", "0.6555411", "0.6524141", "0.65191555", "0.6512331", "0.6503102", "0.6494727", "0.64530355", "0.64172375", "0.6413864", "0.64031637...
0.0
-1
Make a Prophet object and initialize the analysis
def make_prophet(s, prior=0.5): if 'W' in s.index.freq.name: weekly_seasonality=False daily_seasonality=False if 'D' in s.index.freq.name: weekly_seasonality=True daily_seasonality=False m = Prophet( changepoint_range=1, changepoint_prior_scale=prior, weekly_s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self,\n threshold: float = .8,\n growth: str = 'linear',\n cap: float = None,\n holidays: pd.DataFrame = None,\n holidays_prior_scale: float = 10.,\n country_holidays: str = None,\n changepo...
[ "0.6936944", "0.6072374", "0.6019696", "0.56784457", "0.5453132", "0.54189754", "0.5372522", "0.5318098", "0.5317615", "0.53155684", "0.5249751", "0.5232811", "0.51976407", "0.5192305", "0.5188902", "0.5184633", "0.5178213", "0.5173168", "0.5162381", "0.51611847", "0.5155407"...
0.5428588
5
ValueSpec a specification of a persisted value.
def __init__(self, name: str, type: Type, expire_after_call: timedelta = None, expire_after_write: timedelta = None): if not name: raise ValueError("name can not be missing.") if not name.isidentifier(): raise Va...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def value_specs(self) -> Optional[pulumi.Input[Mapping[str, Any]]]:\n return pulumi.get(self, \"value_specs\")", "def value_specs(self) -> Optional[pulumi.Input[Mapping[str, Any]]]:\n return pulumi.get(self, \"value_specs\")", "def spec(self, value: typing.Union[\"VolumeAttachmentSpec\", dict]):\...
[ "0.57155794", "0.57155794", "0.56523716", "0.5461453", "0.5433755", "0.5394706", "0.53701085", "0.524572", "0.5201149", "0.50172067", "0.4961971", "0.4961971", "0.49473658", "0.49257162", "0.48924983", "0.4876372", "0.4863878", "0.48506796", "0.4827494", "0.4795814", "0.47921...
0.0
-1
This module uses the notion of TransferLearning I found VGG16 model to perform the best and nearly as good as mine This function configures our model, freezes the VGG 16 and adds a small module on top of it
def build_model(): pretrained_model = VGG16(input_shape=(fixed_size[0], fixed_size[1], 3), weights='imagenet', include_top=False) # We will not train the layers imported. for layer in pretrained_model.layers: layer.trainable = False transfer_learning_model = Sequential() transfer_learning_mo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n\t\tsuper(Vgg16, self).__init__()\n\t\tv = vgg16(pretrained= True)\n\t\t# Copy modules of vgg16\n\t\tfeatures = list(v.features)\n\t\tavgpool = v.avgpool\n\t\tsequentials = list(v.classifier)\n\t\tself.features = nn.ModuleList(features).eval() \n\t\tself.avgpool = avgpool\n\t\tself.sequentials...
[ "0.7378551", "0.7140043", "0.7088726", "0.70860106", "0.7069082", "0.7028083", "0.69971085", "0.6835972", "0.6807089", "0.68023854", "0.67977124", "0.67328876", "0.666724", "0.6654282", "0.6629273", "0.66262287", "0.6624668", "0.66023797", "0.6547663", "0.6541805", "0.6531674...
0.72276556
1
Name of this initiator group.
def initiator_group_name(self): return self._initiator_group_name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def group_name(self) -> str:\n return pulumi.get(self, \"group_name\")", "def group_name(self):\n\n return self._group_name", "def name(self):\n return f\"{self._group.friendly_name} {GROUP_SUFFIX}\"", "def getName(self):\n return _libsbml.Group_getName(self)", "def get_group_na...
[ "0.803714", "0.77505535", "0.7715831", "0.7704881", "0.7635519", "0.7535615", "0.75039047", "0.75039047", "0.7350636", "0.7316486", "0.73029464", "0.72832215", "0.72797227", "0.72797227", "0.72797227", "0.72797227", "0.7264888", "0.7243955", "0.72344804", "0.72338426", "0.723...
0.819768
0
Sets the learning rate to the initial LR decayed by 2 every 50 epochs
def adjust_learning_rate(jnet, optimizer, epoch): lr = args.lr * (0.5 ** (epoch // 10)) for param_group in optimizer.param_groups: param_group['lr'] = lr
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def adjust_learning_rate(init_lr, optimizer, epoch, n=100):\n init_lr = init_lr * (0.1 ** (epoch // n))\n print('learning rate : ', init_lr)\n for param_group in optimizer.param_groups:\n param_group['lr'] = init_lr", "def adjust_learning_rate(self, epoch):\n lr = self.lr * (0.5 ** (epoch ...
[ "0.77354497", "0.7694901", "0.76603293", "0.7651332", "0.76132274", "0.7598309", "0.7585125", "0.7580059", "0.75778633", "0.7571193", "0.7571193", "0.7565623", "0.7564755", "0.7563805", "0.7552611", "0.75456434", "0.75453395", "0.7544134", "0.7532659", "0.7512781", "0.7500937...
0.73904526
47
Computes the precision for the specified values of k
def accuracy(output, target, accuracy_thre): acc=[] total = target.size(0) dist = (output - target).abs().max(1)[0] for k in accuracy_thre: correct = 0 for i in dist: if i < k: correct += 1 acc.append(correct/total) return acc
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def precision(gt, pred, k):\n k = min(len(pred), k)\n den = min(len(gt), k)\n return sum([int(pred[i] in gt) for i in range(k)]) / den", "def precision_at_k(r, k):\n assert k >= 1\n r = np.asarray(r)[:k] != 0\n if r.size != k:\n raise ValueError('Relevance score length < k')\...
[ "0.76427615", "0.74189496", "0.7418079", "0.72710466", "0.72456723", "0.72446615", "0.7237539", "0.72213703", "0.7210107", "0.7058935", "0.6852219", "0.6786084", "0.67836976", "0.6768417", "0.67273885", "0.67181736", "0.67181736", "0.67181736", "0.67181736", "0.67181736", "0....
0.0
-1
Divide an iterable into chunks of size n
def chunks(seq: Sequence[T], n: int = 1000) -> Sequence[Sequence[T]]: # we batch 1000 sql commands instead of 10. 10 was extremely slow for i in range(0, len(seq), n): yield seq[i:i + n]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def chunk(iterable, n):\n iterable = [e for e in iterable]\n avg_length = int(math.ceil(len(iterable) / n))\n return [iterable[i * avg_length:(i + 1) * avg_length] for i in range(n)]", "def _chunks(l, n):\n\tfor i in range(0, len(l), n):\n\t\tyield l[i:i + n]", "def _chunks(l, n):\n for i in xrange...
[ "0.8677282", "0.84334344", "0.8399262", "0.8359042", "0.833468", "0.8324385", "0.8312788", "0.8304415", "0.83030224", "0.83028924", "0.83028924", "0.83028924", "0.83028924", "0.83028924", "0.829568", "0.8288074", "0.8281985", "0.82778", "0.82778", "0.82753277", "0.8274796", ...
0.0
-1
Retrieve the runtime parameter description.
def get_info(self): for i in range(self.n_retries + 1): try: return self._info_proxy() except rospy.ServiceException as e: rospy.logwarn( '%s could not retrieve info: %s, retrying...', self._name, str(e)) time.sleep(1.0)...
{ "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 __make_description(self, param_name):\n value = self._...
[ "0.7432788", "0.6802718", "0.6608534", "0.6540811", "0.6536414", "0.64576644", "0.6258081", "0.62560326", "0.62546146", "0.6239805", "0.6239805", "0.6239805", "0.62378633", "0.62378633", "0.62378633", "0.62378633", "0.62378633", "0.6221222", "0.6218303", "0.62021065", "0.6201...
0.0
-1
Creates an Entity object from a dict
def fromdict(cls, data: Mapping[str, Any]): try: atlist = AttribList.fromdict(data) return cls(device_id=data['device_id'], entity_type=atlist.entity_type, entity_name=data['entity_name'], protocol=data['protocol'], ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_dict(cls: T, source: dict[str, Any], connection: Connection) -> T:\n return super(Entity, cls).from_dict(source=source, connection=connection)", "def from_dict(cls, dikt) -> 'GnbrEntity':\n return util.deserialize_model(dikt, cls)", "def from_entity(cls, e):\n kwargs = {name: e.ge...
[ "0.74726915", "0.72745377", "0.72215784", "0.7028574", "0.7028574", "0.7028574", "0.7028574", "0.7028574", "0.7028574", "0.7028574", "0.7028574", "0.7028574", "0.7028574", "0.7028574", "0.7028574", "0.7028574", "0.7028574", "0.7028574", "0.7028574", "0.7028574", "0.7028574", ...
0.0
-1
Compute class labels from data matrix 'X'.
def predict(self, X): # Wrap 'predict' using a Lambda expression predict = (lambda clf, x: clf.predict(x) if hasattr(clf, 'predict') else clf.estimator.predict(x)) return [(name, predict(clf, X)) for name, clf in self.clf.items()]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def classify(self, X):\n x = convert_data( X )\n return self.internal.classify(*get_data(x))", "def predict(self, X):\n X = check_tensor(X, dtype=np.float32, n_dim=4)\n res = self._predict_proba(X)[:, :, 0, 0]\n indices = np.argsort(res, axis=1)\n indices = indices[:, -s...
[ "0.7336552", "0.71312594", "0.6966409", "0.69460934", "0.69460934", "0.68682706", "0.6867796", "0.67978495", "0.67814034", "0.6779488", "0.67732936", "0.6730473", "0.6720597", "0.6687367", "0.6665519", "0.66479397", "0.66396797", "0.66278577", "0.6618553", "0.6612811", "0.661...
0.0
-1
Create and configure an instance of the Flask application.
def create_app(test_config=None): app = Flask(__name__) # apply the blueprints to the app from app import common app.register_blueprint(common.bp) # default url for site app.add_url_rule("/", endpoint="index") return app
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_app():\n\n # 1 Create Flask application\n app = Flask(\n import_name=__name__,\n template_folder=\"templates\",\n static_folder=\"static\"\n )\n\n # 2 Update the apps configuration\n app = config_selector(app)\n register_error_handlers(app)\n\n cache.init_app(app...
[ "0.8524236", "0.8516853", "0.8504485", "0.83319825", "0.82396483", "0.82314265", "0.8200104", "0.81300336", "0.80288595", "0.8026753", "0.8019436", "0.79989535", "0.7984679", "0.7978355", "0.7973289", "0.7970172", "0.7959833", "0.79556865", "0.7952428", "0.7946338", "0.793713...
0.7588251
76
Builds a dictionary of transition probabilities based on the transition matrix provided
def getTransitionDict(self, probMatrix): line = 0 transitionDict = {} for prob in probMatrix: prob = prob.split() if line == 0: orderedStates = prob else: state1 = prob.pop(0) for i in range(len(orderedStates)): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def estimate_transition_params(symbol_symbol_counts, symbol_counts):\n\n transition_probabilities = {}\n for symbol1 in symbol_symbol_counts:\n transition_probabilities[symbol1] = {}\n for symbol2 in symbol_symbol_counts[symbol1]:\n if symbol_counts[symbol1] == 0:\n tr...
[ "0.6934553", "0.69232607", "0.6802361", "0.6799978", "0.6776263", "0.67528754", "0.6515377", "0.6503238", "0.6460577", "0.64418465", "0.6350844", "0.6329724", "0.6300354", "0.62308633", "0.61856866", "0.61784756", "0.6168638", "0.61442333", "0.61436385", "0.61251456", "0.6118...
0.7817806
0
Return an iso formatted string for the current UTC time
def tnow(): return datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isoformat_now():\n return datetime_isoformat(datetime.datetime.utcnow())", "def format_iso_now():\n return datetime.datetime.utcnow().isoformat()+'Z'", "def currentUTC():\n return str(datetime.utcnow())", "def iso_date(self, t=None):\n if t is None:\n t = time.time()\n tim...
[ "0.8109108", "0.809164", "0.7958262", "0.7741647", "0.7585387", "0.7552442", "0.7404626", "0.7332", "0.7243638", "0.7196859", "0.71618515", "0.7140206", "0.71285737", "0.71088606", "0.7062943", "0.70182335", "0.70182335", "0.7015272", "0.7015071", "0.7013581", "0.70095664", ...
0.6543511
65
Returns the primary type of resource this client works with.
def resource_type(self): return 'qos'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resource_type(self) -> Optional[str]:\n return pulumi.get(self, \"resource_type\")", "def resource_type(self) -> Optional[str]:\n return pulumi.get(self, \"resource_type\")", "def resource_type(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"resource_type\")", "def ...
[ "0.7724917", "0.7724917", "0.7425268", "0.7425268", "0.7425268", "0.7425268", "0.7425268", "0.7357114", "0.7356769", "0.71772075", "0.7139699", "0.7116063", "0.70979494", "0.6642737", "0.6618203", "0.6551315", "0.64047694", "0.64029247", "0.63773763", "0.63615155", "0.635429"...
0.0
-1
Create a QoS Specification. For a full list of available parameters, please refer to the official
def create_qos(self, **kwargs): post_body = json.dumps({'qos_specs': kwargs}) resp, body = self.post('qos-specs', post_body) body = json.loads(body) self.validate_response(schema.show_qos, resp, body) return rest_client.ResponseBody(resp, body)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_qos(self, specs):\n aname = \"cinder_v%s.create_qos\" % self.version\n name = self.generate_random_name()\n\n with atomic.ActionTimer(self, aname):\n return self._get_client().qos_specs.create(name, specs)", "def _create_qos_specs(self, name, values=None):\n if v...
[ "0.686167", "0.67896867", "0.67133135", "0.65024567", "0.6364153", "0.62897444", "0.62006146", "0.6131882", "0.56785053", "0.5630256", "0.563019", "0.5527091", "0.55141985", "0.55135745", "0.54422367", "0.54124385", "0.5382331", "0.5316895", "0.5239837", "0.52316684", "0.5203...
0.7113166
0
List all the QoS specifications created.
def list_qos(self): url = 'qos-specs' resp, body = self.get(url) body = json.loads(body) self.validate_response(schema.list_qos, resp, body) return rest_client.ResponseBody(resp, body)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_qos(self, search_opts=None):\n aname = \"cinder_v%s.list_qos\" % self.version\n with atomic.ActionTimer(self, aname):\n return self._get_client().qos_specs.list(search_opts)", "def create_qos(self, **kwargs):\n post_body = json.dumps({'qos_specs': kwargs})\n resp, ...
[ "0.67390376", "0.65757364", "0.65319103", "0.64933616", "0.6000424", "0.597016", "0.59578675", "0.5949403", "0.58467436", "0.58439744", "0.5838456", "0.5550228", "0.54971963", "0.5491561", "0.53447664", "0.5344072", "0.51313496", "0.5106537", "0.51012284", "0.50234056", "0.50...
0.7402834
0
Get the specified QoS specification.
def show_qos(self, qos_id): url = "qos-specs/%s" % qos_id resp, body = self.get(url) body = json.loads(body) self.validate_response(schema.show_qos, resp, body) return rest_client.ResponseBody(resp, body)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_qos(self, qos_id):\n aname = \"cinder_v%s.get_qos\" % self.version\n with atomic.ActionTimer(self, aname):\n return self._get_client().qos_specs.get(qos_id)", "def get_qos(tenant_id, qos_id):\n LOG.debug(\"get_qos() called\")\n session = db.get_session()\n try:\n ...
[ "0.62812495", "0.6192236", "0.60918766", "0.60918766", "0.60918766", "0.6069486", "0.5950984", "0.59468484", "0.5945616", "0.58748776", "0.5868449", "0.5830688", "0.57667404", "0.5625597", "0.5601869", "0.55945456", "0.5592277", "0.5536147", "0.54074717", "0.5381739", "0.5355...
0.5811162
12
Get the association of the specified QoS specification.
def show_association_qos(self, qos_id): url = "qos-specs/%s/associations" % qos_id resp, body = self.get(url) body = json.loads(body) self.validate_response(schema.show_association_qos, resp, body) return rest_client.ResponseBody(resp, body)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getAssociation(self, *args):\n return _libsbml.GeneProductAssociation_getAssociation(self, *args)", "def getAssociation(self, *args):\n return _libsbml.FbcOr_getAssociation(self, *args)", "def getAssociation(self, *args):\n return _libsbml.GeneAssociation_getAssociation(self, *args)", ...
[ "0.6263618", "0.6193483", "0.6128729", "0.58500904", "0.56355715", "0.54471433", "0.5368156", "0.5327578", "0.52952015", "0.52783805", "0.5216578", "0.5170039", "0.5107426", "0.50902504", "0.50902504", "0.50902504", "0.5033695", "0.5010923", "0.49869522", "0.489922", "0.48927...
0.6504925
0
Rotation about the yaxis.
def roty(t): c = np.cos(t) s = np.sin(t) return np.array([[c, 0, s], [0, 1, 0], [-s, 0, c]])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rot_y_deg(self):\n # TODO describe which axis this is\n return math.degrees(self._rot_y_rad)", "def rot_y_rad(self):\n return self._rot_y_rad", "def rotation_center_y(self, *args, **kwargs) -> Any:\n pass", "def rotate_y(self, angle):\n angle *= np.pi / 180\n ret...
[ "0.75396633", "0.7354722", "0.7102622", "0.7064357", "0.7036538", "0.6986756", "0.6895528", "0.6895528", "0.68484044", "0.68028474", "0.6717387", "0.66640604", "0.66279566", "0.6614649", "0.658053", "0.6575346", "0.6554816", "0.6505504", "0.63935125", "0.6393029", "0.63855916...
0.0
-1
Transforation matrix from rotation matrix and translation vector.
def transform_from_rot_trans(R, t): R = R.reshape(3, 3) t = t.reshape(3, 1) return np.vstack((np.hstack([R, t]), [0, 0, 0, 1]))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transformation_matrix(self):\n t = np.array([[0.0], [0.0], [0.0]])\n Rt = np.hstack([self.rotation_matrix, t])\n return np.vstack([Rt, np.array([0.0, 0.0, 0.0, 1.0])])", "def rotation_to_transformation_matrix(R):\n R = Matrix(R)\n T = R.col_insert(3, Matrix([0., 0., 0.]))\n T = ...
[ "0.77170056", "0.7399434", "0.7178414", "0.7170596", "0.70914817", "0.70642626", "0.696672", "0.69636685", "0.6960209", "0.69518274", "0.6869197", "0.6853872", "0.6838569", "0.68219584", "0.6796785", "0.67959565", "0.675783", "0.6752801", "0.6735544", "0.67316866", "0.6726265...
0.6602867
33
u"""a geometry method that returns the result as true if a single point is inside a rectangle.
def is_point_in(self, point): return (self.upperleft[0] <= point[0] <= self.upperright[0] and self.upperleft[1] <= point[1] <= self.bottomleft[1])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def in_rectangle(rect, point):\n if point[0] < rect[0]:\n return False\n\n elif point[1] < rect[1]:\n return False\n\n elif point[0] > rect[0] + rect[2]:\n return False\n\n elif point[1] > rect[1] + rect[3]:\n return False\n\n return True", "def inside(point, rectangle)...
[ "0.8190261", "0.80628246", "0.80404955", "0.7945674", "0.77917194", "0.76448005", "0.7562009", "0.74944776", "0.748635", "0.734343", "0.734343", "0.73410654", "0.7317746", "0.7301022", "0.7261144", "0.7215474", "0.7185175", "0.717302", "0.7160474", "0.71595424", "0.7155258", ...
0.6802904
46
u"""a geometry method that returns true if a single point is facing an edge.
def _point_faces_edge(self, edge, point): a = sqrt((edge[0][0] - edge[1][0]) ** 2 + (edge[0][1] - edge[1][1]) ** 2) b = sqrt((edge[0][0] - point[0]) ** 2 + (edge[0][1] - point[1]) ** 2) c = sqrt((edge[1][0] - point[0]) ** 2 + (edge[1][1] - point[1]) ** 2) ang1, ang2 = self._angle(b, a, c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isEdge(self,x,y):\r\n return self.matr[x][y]", "def isEdge(self,x,y):\n\t\treturn self._matr[x][y]", "def is_edge(self):\n if self._row == 0 or self._row == 9 or self._column == 0 or self._column == 9:\n # check that the edge is not actually a corner square\n if not self...
[ "0.7213712", "0.7184389", "0.6948606", "0.6931671", "0.69004", "0.68743634", "0.6871175", "0.6673136", "0.66165024", "0.656469", "0.646561", "0.6457592", "0.6428723", "0.6394784", "0.63617504", "0.63297075", "0.6313382", "0.62736875", "0.6268916", "0.6210656", "0.61989725", ...
0.74381036
0
u"""a geometry method that returns the area size of a triangle.
def _triangle_area_at_points(self, p1, p2, p3): a = sqrt((p1[0] - p2[0]) ** 2 + (p1[1] - p2[1]) ** 2) b = sqrt((p2[0] - p3[0]) ** 2 + (p2[1] - p3[1]) ** 2) c = sqrt((p1[0] - p3[0]) ** 2 + (p1[1] - p3[1]) ** 2) s = (a + b + c) / float(2) area = sqrt(s * (s - a) * (s - b) * (s - c)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def area_triangle(w, h):\n return w * h / 2", "def triangle_area(base, height):\n return (base * height) / 2", "def triangle_area(base, height): # Compute the area of a triangle\n area = (1.0 / 2) * base * height\n return area", "def area_triangle(triangle):\n return 0.5 * length_ve...
[ "0.7971838", "0.77646875", "0.7657961", "0.7630691", "0.75207424", "0.74356467", "0.74154377", "0.7414837", "0.7276447", "0.71875876", "0.7128434", "0.70684904", "0.70599234", "0.705813", "0.6993011", "0.69830805", "0.6942034", "0.6890241", "0.6869968", "0.68401945", "0.68397...
0.6835689
21
u"""a geometry method that returns the result as true if a single point is inside a rectangle.
def is_point_in(self, point): return (self.upperleft[0] <= point[0] <= self.upperright[0] and self.upperleft[1] <= point[1] <= self.bottomleft[1])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def in_rectangle(rect, point):\n if point[0] < rect[0]:\n return False\n\n elif point[1] < rect[1]:\n return False\n\n elif point[0] > rect[0] + rect[2]:\n return False\n\n elif point[1] > rect[1] + rect[3]:\n return False\n\n return True", "def inside(point, rectangle)...
[ "0.8190261", "0.80628246", "0.80404955", "0.7945674", "0.77917194", "0.76448005", "0.7562009", "0.74944776", "0.748635", "0.734343", "0.734343", "0.73410654", "0.7317746", "0.7301022", "0.7261144", "0.7215474", "0.7185175", "0.717302", "0.7160474", "0.71595424", "0.7155258", ...
0.6802904
47
u"""a geometry method that returns true if a group of footprints or a resort is in a line.
def _isLine(self): return (self.width == 0 and self.height > 1) or (self.height == 0 and self.width > 1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_line_in_multipoly(feature_1: Sequence, feature_2: Sequence) -> bool:\n\n return any(is_line_in_poly(feature_1, coords_2) for coords_2 in feature_2)", "def belongsToLine(self, index, direction, line): \n first_point = 1 \n if direction == 'Horizontal': # Check if index's y coordina...
[ "0.63367033", "0.6273117", "0.62297666", "0.6196147", "0.6194339", "0.6129758", "0.60498136", "0.6033815", "0.59298456", "0.59017956", "0.5897748", "0.58524024", "0.58368576", "0.58262783", "0.58209234", "0.57898647", "0.5786185", "0.57754904", "0.57718587", "0.5744138", "0.5...
0.66455185
1
u"""Returns the area size of the resort connected to the given neighborhood coordinate and 0 if the coordinate is not in the resort or it has been explored in a previous call.
def _resort_size(self, r, c): areasize = 1 stack = [(r, c)] self.visited[r][c] = True resort = [(c,r)] while stack: for r, c in self._neighbors(*stack.pop()): if self.grid[r][c] and not self.visited[r][c]: stack.append((r, c)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_area(building, pixel_size=1):\n return len(building.points) * (pixel_size**2)", "def calculate_area_from_raster(polygon_raster, pixel_size=1):\n return np.sum(polygon_raster)*(pixel_size**2)", "def _layer_size_score(size, hole_count, hole_area):\r\n board_area = size[0] * size[1]...
[ "0.71064985", "0.65536666", "0.6141775", "0.60333115", "0.60333115", "0.60333115", "0.5994447", "0.5994447", "0.5994447", "0.5994447", "0.59680057", "0.59678274", "0.5965399", "0.5931347", "0.5925301", "0.5920993", "0.5920196", "0.5903792", "0.58719003", "0.5866915", "0.58548...
0.62360394
2
String representation of db object
def __str__(self): return 'team_name : {} ,slogan: {}'.format( self.team_name, self.slogan)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n tablename = self.tablename()\n attrs = {}\n if Registry.SCHEMAS.has_key(tablename):\n for key in Registry.SCHEMAS[tablename]:\n attrs[key] = getattr(self, key, None)\n return \"<%s object: %s>\" % (self.__class__.__name__, str(attrs))", "...
[ "0.7898391", "0.73188376", "0.72499686", "0.7229528", "0.71211743", "0.7088101", "0.7086863", "0.7032279", "0.6978849", "0.6978849", "0.6963292", "0.6963292", "0.6905439", "0.68914455", "0.6860794", "0.6856596", "0.68239087", "0.68239087", "0.68239087", "0.68239087", "0.68239...
0.0
-1
A call to timestamp() requires no arguments.
def test_timestamp_requires_no_arguments(get_pipe_manager): pm = get_pipe_manager(name="TestPM") pm.timestamp()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fromtimestamp(cls, *args, **kwargs): # real signature unknown\r\n pass", "def timestamp():\n return time.time()", "def get_timestamp(self):\n raise NotImplementedError", "def timestamp(self, timestamp):\n if timestamp is not None and timestamp < 1:\n raise ValueError(\"...
[ "0.71783197", "0.69321483", "0.68036914", "0.67528117", "0.66967297", "0.6676742", "0.6666955", "0.6652712", "0.6640627", "0.65933985", "0.65451795", "0.65042794", "0.64590275", "0.64079744", "0.6402248", "0.63855255", "0.63566816", "0.63379306", "0.6332197", "0.62894017", "0...
0.67081445
4
Compute curvature of a contour
def curvature(contour,fn = 3, bn = 3): clen = contour.shape[0] E = np.zeros((clen,), np.float32) thetai = np.zeros((clen,), np.float32) for k in range(1,clen): # first and last few points if k < bn: bnd = 0 fnd = k + fn elif k + fn > clen-1: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def curvature(x, y):\n dalpha = np.pi/1000\n xd1 = np.gradient(x, 2)\n xd2 = np.gradient(xd1, 2)\n yd1 = np.gradient(y, 2)\n yd2 = np.gradient(yd1, 2)\n\n return np.abs(xd1*yd2 - yd1*xd2) / np.power(xd1**2 + yd1**2, 3.0/2.0)", "def curvature(self):\n return self.circle().curvature(self.o...
[ "0.7722437", "0.7636324", "0.76044375", "0.7381356", "0.73325527", "0.72154456", "0.71813434", "0.71430486", "0.7101096", "0.6955464", "0.68881685", "0.67844427", "0.6735265", "0.66962755", "0.6589425", "0.6585975", "0.6528163", "0.6486635", "0.64098597", "0.62889755", "0.625...
0.7185832
6
Get spglib symmetry dataset from a Structure.
def get_symmetry_dataset(structure: Structure, symprec: float = SYMMETRY_TOLERANCE, angle_tolerance: float = ANGLE_TOL) -> dict: cell = structure_to_spglib_cell(structure) return spglib.get_symmetry_dataset(cell=cell, sympr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_symmetry(self):\n from spglib import get_spacegroup\n cell = ( self.lattice, self.fractional_coordinates, self.atomic_nos )\n self.spacegroup = get_spacegroup(cell, symmprec=1e-5)\n print(\"Symmetry space group is\", self.spacegroup)", "def compute_symmetry_3d(structdata, sta...
[ "0.5667199", "0.5576883", "0.5519664", "0.5383802", "0.51993793", "0.5137195", "0.50729096", "0.5040277", "0.50244397", "0.50028515", "0.49727187", "0.49683923", "0.49554533", "0.49520043", "0.49364123", "0.49264452", "0.49063736", "0.48964316", "0.48910108", "0.48393065", "0...
0.7546716
0
Whetherit should check for an authenticated user. If this is a public data file manager, it should return False.
def requires_auth(self): return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_authenticated(self):\n return False", "def is_authenticated(self):\n return True", "def is_authenticated(self):\n return True", "def is_authenticated(self):\n return True", "def is_authenticated(self):\n return True", "def is_authenticated(self):\n return ...
[ "0.72884905", "0.7036176", "0.7036176", "0.7036176", "0.7036176", "0.7036176", "0.7036176", "0.7036176", "0.6915834", "0.69107413", "0.68421686", "0.6818588", "0.67913747", "0.67703974", "0.6762786", "0.6708415", "0.6702161", "0.6651022", "0.6611786", "0.6564845", "0.65545166...
0.66830087
17
Writes the introduction to the html email content.
def _write_html_preamble(self, recipient: str) -> str: preamble: str = attach_tag_p(f'Dear {recipient},') + '\n' \ + attach_tag_p( 'You are receiving this message because you participated ' + f'in {self.trip_title}.') + '\n' \ + attach_tag_p('I hope you ha...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def introduction_html(self) -> str:\n if self._introduction_md is None:\n return self._introduction_html\n else:\n return mistune.markdown(self._introduction_md)", "def add_intro(self):\n page = lambda x: pkgutil.get_data(\n 'pyscp_ebooks',\n 'reso...
[ "0.6521871", "0.6179133", "0.5656378", "0.55710584", "0.55645007", "0.5527772", "0.55186015", "0.54792017", "0.54788435", "0.54642403", "0.54564667", "0.544269", "0.5437287", "0.54079396", "0.54060835", "0.5405596", "0.5404658", "0.5389159", "0.53760314", "0.5361914", "0.5331...
0.6052208
2
Returns a random subsequence with min_stride <= stride <= max_stride. For example if self.length = 4 and we ask for a length 2
def random_subsequence(seq, length, min_stride=1, max_stride=1): # First pick a stride. if max_stride == min_stride: stride = min_stride else: stride = np.random.randint(min_stride, max_stride+1) # Now pick the starting index. # If the subsequence starts at index i, then its final eleme...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stride(max_seq_len: int) -> int:\n return max(1, max_seq_len // 2)", "def randslice_from_slicelen(slicelen, listlen):\n maxstart = listlen - slicelen\n start = randrange(maxstart + 1)\n maxstep = (listlen - start) // slicelen if slicelen else 1\n step = randrange(1, maxstep + 1)\n stop = star...
[ "0.63644624", "0.6139399", "0.613584", "0.5613276", "0.55990094", "0.55738974", "0.53581023", "0.528104", "0.5271141", "0.5230009", "0.51729834", "0.5146156", "0.5136879", "0.5118242", "0.51171905", "0.5092657", "0.5085889", "0.5073042", "0.50660276", "0.5060677", "0.50271285...
0.84703076
0
String for representing the Model object.
def __str__(self): return _('Order placed on') + ' ' + f'{ self.create_dt_tm.strftime("%d-%b-%Y") }, ${ self.total }'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return super().__str__() + self.model.__str__()", "def __str__(self):\n return \"DataModel(name={},attributes={},description={})\".format(\n self.name, {a.name: str(a) for a in self.attributes}, self.description\n )", "def __str__(self):\n \n res =...
[ "0.82368803", "0.79901737", "0.7849152", "0.78468513", "0.77520275", "0.7625378", "0.7625378", "0.76225406", "0.76225406", "0.75483394", "0.7522958", "0.7470355", "0.7469358", "0.7447144", "0.7447144", "0.74314755", "0.7427648", "0.7389925", "0.7351721", "0.73424315", "0.7322...
0.0
-1
This function will open website in chrome you have to first give the url and second you have to give the chorme path
def open_chrome(url,chrome_path): webbrowser.register('chrome', None,webbrowser.BackgroundBrowser(chrome_path)) webbrowser.get('chrome').open(url)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def open(url):\r\n webbrowser.open(url)", "def open_web_browser(url: str):\n Popen(web_browser + [url], stdout=DEVNULL, stderr=DEVNULL)", "def openurl(url):\n\n # Open the URL\n webbrowser.open(url)", "def open_web_chrome(url: str) -> webdriver.Chrome:\n options = webdriver.ChromeO...
[ "0.755337", "0.75032884", "0.73935777", "0.72128797", "0.7203306", "0.7188917", "0.7165283", "0.7111031", "0.71025693", "0.70683134", "0.69504917", "0.6929916", "0.69271356", "0.68253046", "0.6747373", "0.6713842", "0.66886365", "0.65740305", "0.6566772", "0.6566441", "0.6502...
0.82592404
0
Format an input column name to remove excess chars and whitespace. This method should help facilitate the merging of column names between two DataFrames.
def fmt(cls, n): return ''.join(c for c in n if c in cls.ALLOWED).lower()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name_cleaning(df):\n # Custom cleaning\n df.columns = [re.sub(\"[\\\\. \\\\(\\\\)\\\\/]+\", \"_\", elem) for elem in df.columns]\n df.columns = [re.sub(\"-\", \"_\", elem) for elem in df.columns]\n df.columns = [re.sub(\"'\", \"\", elem) for elem in df.columns]\n df.columns = [re.sub(\",\", \"_\...
[ "0.66500336", "0.6567615", "0.6563025", "0.64986926", "0.64688414", "0.6371572", "0.636582", "0.62946177", "0.62590057", "0.6198726", "0.6143737", "0.608173", "0.60666144", "0.6063911", "0.6063911", "0.60271204", "0.5992217", "0.58959657", "0.5894452", "0.5879924", "0.5879034...
0.0
-1
Validate the hybrid time index to be of len >= 8760. Raises FileInputError If len(time_index) < 8760 for the hybrid profile.
def _validate_time_index(self): if len(self.hybrid_time_index) < 8760: msg = ("The length of the merged time index ({}) is less than " "8760. Please ensure that the input profiles have a " "time index that overlaps >= 8760 times.") e = msg.format(len...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_ls_input_out_of_range(self):\n index = self.module.user_lookup_table_maker(b\"S|0090|5110|38399|LS\")\n waveform = helper_funcs.convert_c_array_to_list(self.module.waveform_lut,\n 0, index)\n print(f\"waveform: {waveform}\")\n ...
[ "0.55645454", "0.53349376", "0.52908105", "0.514851", "0.51223826", "0.50943077", "0.5067797", "0.50587714", "0.5051093", "0.5015825", "0.49757153", "0.49068865", "0.490585", "0.48379636", "0.48256257", "0.48134157", "0.48115572", "0.4785365", "0.47791785", "0.4764935", "0.47...
0.88489604
0
Validate the existence of unique values in the merge column. Raises FileInputError If merge column contains duplicate values in either the solar or the wind meta data.
def _validate_unique_merge_col(self): msg = ("Duplicate {}s were found. This is likely due to resource " "class binning, which is not supported at this time. " "Please re-run supply curve aggregation without " "resource class binning and ensure there are no duplicate...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _validate_merge_col_exists(self):\n msg = (\"Cannot hybridize: merge column {!r} missing from the \"\n \"{} meta data! ({!r})\")\n\n mc = ColNameFormatter.fmt(MERGE_COLUMN)\n for cols, fp, res in zip([self.__solar_cols, self.__wind_cols],\n [se...
[ "0.7891415", "0.7614765", "0.61395323", "0.60878676", "0.60165447", "0.58810294", "0.57699454", "0.5652946", "0.5633896", "0.5575958", "0.552", "0.54288876", "0.54203135", "0.5384327", "0.53775144", "0.5341186", "0.53313047", "0.53311586", "0.5328971", "0.5324311", "0.5319076...
0.86776817
0
Validate the existence of overlap in the merge column values. Raises FileInputError If merge column values do not overlap between the tow input files.
def _validate_merge_col_overlaps(self): mc = ColNameFormatter.fmt(MERGE_COLUMN) merge_col = self.solar_meta.columns[self.__solar_cols == mc].item() solar_vals = set(self.solar_meta[merge_col].values) merge_col = self.wind_meta.columns[self.__wind_cols == mc].item() wind_vals = se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _validate_merge_col_exists(self):\n msg = (\"Cannot hybridize: merge column {!r} missing from the \"\n \"{} meta data! ({!r})\")\n\n mc = ColNameFormatter.fmt(MERGE_COLUMN)\n for cols, fp, res in zip([self.__solar_cols, self.__wind_cols],\n [se...
[ "0.7486741", "0.7176547", "0.61411387", "0.6102821", "0.6066776", "0.60148036", "0.5996392", "0.58063793", "0.5786578", "0.57224697", "0.57176906", "0.56641287", "0.56431687", "0.5567696", "0.55234826", "0.5494183", "0.54478794", "0.5432173", "0.5406743", "0.5363546", "0.5342...
0.8913541
0
Validate the input parameters. This method validates that the input limit, fill, and ratio columns are formatted correctly.
def validate_input(self): self._validate_limits_cols_prefixed() self._validate_fillna_cols_prefixed() self._validate_ratio_input()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _validate_ratio_input(self):\n if self._ratio_bounds is None:\n return\n\n self._validate_ratio_bounds()\n self._validate_ratio_type()\n self._validate_ratio_format()\n self._validate_ratio_cols_prefixed()\n self._validate_ratio_cols_exist()", "def _data_p...
[ "0.7478021", "0.6782839", "0.66965306", "0.6670995", "0.6557589", "0.65344125", "0.6506362", "0.64263195", "0.6350137", "0.63460535", "0.6289092", "0.6277632", "0.6203114", "0.61995864", "0.61992794", "0.61950773", "0.61806136", "0.6178662", "0.6177398", "0.61739767", "0.6157...
0.81627876
0
Validate the ratio input parameters. This method validates that the input ratio columns are formatted correctly and exist in the input data. It also verifies that the `ratio_bounds` is correctly formatted.
def _validate_ratio_input(self): if self._ratio_bounds is None: return self._validate_ratio_bounds() self._validate_ratio_type() self._validate_ratio_format() self._validate_ratio_cols_prefixed() self._validate_ratio_cols_exist()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _validate_ratio_format(self):\n if '/' not in self._ratio:\n msg = (\"Ratio input {} does not contain the '/' character. \"\n \"Please make sure the ratio input is a string in the form \"\n \"'numerator_column_name/denominator_column_name'\")\n e...
[ "0.7760784", "0.7714941", "0.75114256", "0.69338435", "0.6844013", "0.628972", "0.6231458", "0.6212971", "0.5856549", "0.57090014", "0.56484723", "0.5637413", "0.56157666", "0.55607164", "0.55572057", "0.5542727", "0.55393887", "0.5529563", "0.5526014", "0.548384", "0.5476128...
0.86574155
0
Ensure that the ratio input is a string. Raises InputError If `ratio` is not a string.
def _validate_ratio_type(self): if not isinstance(self._ratio, str): msg = ("Ratio input type {} not understood. Please make sure " "the ratio input is a string in the form " "'numerator_column_name/denominator_column_name'. Ratio " "input: {!...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _validate_ratio_format(self):\n if '/' not in self._ratio:\n msg = (\"Ratio input {} does not contain the '/' character. \"\n \"Please make sure the ratio input is a string in the form \"\n \"'numerator_column_name/denominator_column_name'\")\n e...
[ "0.744509", "0.6211037", "0.59779984", "0.5810558", "0.56747997", "0.5636537", "0.5560869", "0.54170185", "0.53851706", "0.53279436", "0.5304914", "0.5284875", "0.52590173", "0.5254921", "0.52378595", "0.5217926", "0.52176386", "0.5211942", "0.5209529", "0.52087975", "0.52081...
0.8306787
0
Validate that the ratio input format is correct and can be parsed. Raises InputError If the '/' character is missing or of there are too many '/' characters.
def _validate_ratio_format(self): if '/' not in self._ratio: msg = ("Ratio input {} does not contain the '/' character. " "Please make sure the ratio input is a string in the form " "'numerator_column_name/denominator_column_name'") e = msg.format(se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _validate_ratio_type(self):\n if not isinstance(self._ratio, str):\n msg = (\"Ratio input type {} not understood. Please make sure \"\n \"the ratio input is a string in the form \"\n \"'numerator_column_name/denominator_column_name'. Ratio \"\n ...
[ "0.73980933", "0.7004482", "0.6500546", "0.62572384", "0.56892586", "0.55476534", "0.54579455", "0.54427433", "0.54277605", "0.53751886", "0.535323", "0.5218696", "0.5217071", "0.5215101", "0.51954955", "0.51836604", "0.51597065", "0.51439303", "0.5141729", "0.5051909", "0.50...
0.86093605
0
Ensure the ratio columns are formatted correctly. This check is important because the ratio limit step happens after the meta has been merged (so columns are already prefixed), but before the hybrid columns are computed. As a result, the ratio columns _must_ have a valid prefix. Raises InputError If ratio columns are n...
def _validate_ratio_cols_prefixed(self): for col in self._ratio_cols: self.__validate_col_prefix( col, (SOLAR_PREFIX, WIND_PREFIX), input_name='ratios' )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _validate_ratio_cols_exist(self):\n\n for col in self._ratio_cols:\n no_prefix_name = \"_\".join(col.split('_')[1:])\n if not self.data.contains_col(no_prefix_name):\n msg = (\"Input ratios column {!r} not found in either meta \"\n \"data! Pleas...
[ "0.7685625", "0.71891445", "0.66247326", "0.6569187", "0.61756104", "0.59779066", "0.58474874", "0.5542771", "0.5347169", "0.5317145", "0.50159115", "0.49957514", "0.49852097", "0.49845073", "0.49719888", "0.497121", "0.49402085", "0.49239317", "0.49203816", "0.48641172", "0....
0.7826254
0
Ensure the ratio columns exist if a ratio is specified. Raises FileInputError If ratio columns are not found in the meta data.
def _validate_ratio_cols_exist(self): for col in self._ratio_cols: no_prefix_name = "_".join(col.split('_')[1:]) if not self.data.contains_col(no_prefix_name): msg = ("Input ratios column {!r} not found in either meta " "data! Please check the inpu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _validate_ratio_format(self):\n if '/' not in self._ratio:\n msg = (\"Ratio input {} does not contain the '/' character. \"\n \"Please make sure the ratio input is a string in the form \"\n \"'numerator_column_name/denominator_column_name'\")\n e...
[ "0.63408744", "0.6176652", "0.58006966", "0.55848163", "0.5559693", "0.5524219", "0.5480099", "0.5457779", "0.51162285", "0.5073963", "0.50668687", "0.5056988", "0.5018335", "0.49608746", "0.4938702", "0.48875266", "0.48650214", "0.4860901", "0.48203823", "0.46765062", "0.464...
0.81428486
0
Get the arrays of the hybridized representative profiles. Returns
def profiles(self): return self._profiles
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vectorize(profiles):\n\n return np.concatenate([p.data for p in profiles])", "def _compute_hybridized_profiles_from_components(self):\n\n hp_name, sp_name, wp_name = OUTPUT_PROFILE_NAMES\n self._profiles[hp_name] = (self._profiles[sp_name]\n + self._profiles...
[ "0.64256316", "0.62255627", "0.5871764", "0.58320546", "0.5756811", "0.57429326", "0.56446856", "0.560089", "0.55956614", "0.5501641", "0.5398498", "0.537406", "0.53534853", "0.53223544", "0.52982664", "0.52645624", "0.5252892", "0.52124363", "0.52080137", "0.51605505", "0.51...
0.5425054
10
Compute the hybridized profiles. Returns `Hybridization` Instance of Hybridization object (itself) containing the hybridized meta as an attribute.
def run_meta(self): self.meta_hybridizer.hybridize() return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _compute_hybridized_profiles_from_components(self):\n\n hp_name, sp_name, wp_name = OUTPUT_PROFILE_NAMES\n self._profiles[hp_name] = (self._profiles[sp_name]\n + self._profiles[wp_name])", "def run_profiles(self):\n\n logger.info('Running hybrid profile ...
[ "0.7304179", "0.71179354", "0.7052028", "0.6548694", "0.6080351", "0.58725595", "0.57285", "0.5460207", "0.5442417", "0.5269281", "0.5247184", "0.5216419", "0.5195668", "0.515654", "0.50508267", "0.5036764", "0.5027387", "0.5026981", "0.4991385", "0.4955215", "0.49146044", ...
0.6480808
4
Compute all hybridized profiles. Returns `Hybridization` Instance of Hybridization object (itself) containing the hybridized profiles as attributes.
def run_profiles(self): logger.info('Running hybrid profile calculations.') self._init_profiles() self._compute_hybridized_profile_components() self._compute_hybridized_profiles_from_components() logger.info('Profile hybridization complete.') return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _compute_hybridized_profiles_from_components(self):\n\n hp_name, sp_name, wp_name = OUTPUT_PROFILE_NAMES\n self._profiles[hp_name] = (self._profiles[sp_name]\n + self._profiles[wp_name])", "def _compute_hybridized_profile_components(self):\n\n for params...
[ "0.733052", "0.7061389", "0.62688696", "0.5916327", "0.54421306", "0.54149187", "0.54028976", "0.53174865", "0.5264599", "0.5244064", "0.5241793", "0.5234794", "0.5228557", "0.52058893", "0.5167426", "0.5083976", "0.5015077", "0.49596864", "0.4946332", "0.49411702", "0.493650...
0.7537133
0
Initialize the output rep profiles attribute.
def _init_profiles(self): self._profiles = { k: np.zeros((len(self.hybrid_time_index), len(self.hybrid_meta)), dtype=np.float32) for k in OUTPUT_PROFILE_NAMES}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def profiles(self, profiles):\n\n self._profiles = profiles", "def profile(self, profile):\n\n self.width = profile['width']\n self.height = profile['height']\n self.crs = profile['crs']\n self.interleave = profile['interleave']\n self.resampling = profile['resampling']"...
[ "0.6229419", "0.5958581", "0.5942211", "0.58191633", "0.5738705", "0.5710127", "0.56795114", "0.5629888", "0.5613109", "0.55939484", "0.5537498", "0.549897", "0.5493992", "0.5451944", "0.54345554", "0.54297125", "0.5394949", "0.5347193", "0.53254014", "0.5318524", "0.53174424...
0.7465345
0
Compute the hybridized profiles from the resource components.
def _compute_hybridized_profiles_from_components(self): hp_name, sp_name, wp_name = OUTPUT_PROFILE_NAMES self._profiles[hp_name] = (self._profiles[sp_name] + self._profiles[wp_name])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _compute_hybridized_profile_components(self):\n\n for params in self.__rep_profile_hybridization_params:\n col, (hybrid_idxs, solar_idxs), fpath, p_name, dset_name = params\n capacity = self.hybrid_meta.loc[hybrid_idxs, col].values\n\n with Resource(fpath) as res:\n ...
[ "0.7780478", "0.6865406", "0.6113437", "0.58793914", "0.53639734", "0.5281016", "0.5194652", "0.5157139", "0.50896513", "0.5070324", "0.49811444", "0.49413982", "0.49034274", "0.486924", "0.48568314", "0.48337466", "0.47968993", "0.47571585", "0.47366613", "0.46830127", "0.46...
0.84109247
0
save json object to a local formatted text file, for debug
def save_json(json_obj, filename='tmp', gzipped=False): fn = "{}.json".format(filename) msg = json.dumps( json_obj, sort_keys=True, indent=4, separators=(',', ': ')) if gzipped: fn += '.gz' with gzip.open(fn, 'wb') as f: f.write(msg.encode()) else: with open...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_json_to_file(i):\n\n import json\n import ck.strings\n\n fn = i['json_file']\n\n if i.get('safe', '') == 'yes':\n d = i['dict']\n\n sd = {}\n\n # Check main unprintable keys\n for k in d:\n try:\n json.dumps(d[k])\n except Except...
[ "0.7603398", "0.758718", "0.7505596", "0.7498293", "0.74932706", "0.7483203", "0.7477207", "0.74627626", "0.7455293", "0.74475235", "0.7443212", "0.7422529", "0.73953176", "0.73812765", "0.7377412", "0.73682004", "0.7355333", "0.7322239", "0.7296622", "0.7261674", "0.72544754...
0.68073475
55
Compute the log(sum(exp(x), dim)) in a numerically stable manner
def log_sum_exp(x, dim=0): max_x = torch.max(x, dim)[0] new_x = x - max_x.unsqueeze(dim).expand_as(x) return max_x + (new_x.exp().sum(dim)).log()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_sum_exp(x):\n # TF ordering\n axis = len(x.shape) - 1\n m = paddle.max(x, axis=axis)\n m2 = paddle.max(x, axis=axis, keepdim=True)\n return m + paddle.log(paddle.sum(paddle.exp(x - m2), axis=axis))", "def log_sum_exp(x):\n x_max = x.max()\n return torch.log(torch.sum(torch.exp(x - x_...
[ "0.8737637", "0.8632534", "0.85753256", "0.85753256", "0.8486226", "0.8419485", "0.83770806", "0.8366393", "0.836031", "0.82517153", "0.8069758", "0.80121034", "0.7989599", "0.78910834", "0.7879209", "0.78198904", "0.7758573", "0.7745692", "0.7745692", "0.7743928", "0.7681906...
0.864414
1
Compute the log(mean(exp(x), dim)) in a numerically stable manner
def log_mean_exp(x, dim): return log_sum_exp(x, dim) - np.log(x.size(dim))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_mean_exp(y):\n # init\n batch_size = y.size(0)\n sample_size = y.size(1)\n\n # log_mean_exp\n max_sample = torch.max(y, dim=1)[0]\n reshaped_max_sample = max_sample.view(batch_size, -1)\n log_mean_exp = torch.log(torch.mean(torch.exp(y - reshaped_max_sample), dim=1)) + max_sample\n ...
[ "0.8120643", "0.807634", "0.79836255", "0.7971374", "0.7971374", "0.7897602", "0.7857478", "0.78487056", "0.7808672", "0.78054875", "0.7617721", "0.75351834", "0.7526225", "0.7488208", "0.7466935", "0.7418741", "0.73794657", "0.7338103", "0.7338103", "0.72932273", "0.7258506"...
0.89213103
0
Generate a random string of fixed length
def get_random_string(self, stringLength=10): import random letters = string.ascii_letters + string.digits return ''.join(random.choice(letters) for i in range(stringLength))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _generate_random_string(length: int):\n\tall_chars = string.ascii_letters + string.digits\n\treturn ''.join(random.choices(all_chars, k=length))", "def generate_random_string(length=6):\n n = int(length / 2 + 1)\n x = binascii.hexlify(os.urandom(n))\n s = x[:length]\n return s.decode(\"utf-8\")",...
[ "0.8680464", "0.8573714", "0.85486245", "0.85297275", "0.85209286", "0.84331024", "0.8432044", "0.84157014", "0.84120053", "0.8389201", "0.8345882", "0.8343962", "0.83406156", "0.83348686", "0.83240855", "0.82986933", "0.82911193", "0.8281826", "0.82818025", "0.82811046", "0....
0.810954
33
retrieve the content of the queue's head
def peek(self) -> str: return self.head.info
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def head(self):\n if self.isquiet():\n raise QueueEmpty()\n\n qcurr = self.base + \".\" + str(self.curr)\n assert os.path.exists(qcurr)\n qt = open(qcurr, \"r\")\n data = qt.read()\n qt.close()\n return data", "def first(self):\n if self.head is ...
[ "0.80366296", "0.7800245", "0.76338863", "0.7603481", "0.7574746", "0.75093466", "0.74380994", "0.7356256", "0.7318461", "0.7318461", "0.73128235", "0.72950137", "0.72648597", "0.71722394", "0.71617264", "0.71585107", "0.7156593", "0.7156593", "0.71508855", "0.7146457", "0.70...
0.0
-1
Return the name of the type.
def name(cls) -> str: return cls.__name__
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def type_name(self):\n return self._type_name", "def type_name(self):\n return self.TYPE_NAMES[self.type]", "def name(self) -> str:\n return self.type_data.name", "def type_name(self) -> str: # pragma: no cover\n return repr_type(self.type_obj)", "def type_name(self):\n retu...
[ "0.8975241", "0.89288163", "0.8821359", "0.8633515", "0.8520601", "0.8494277", "0.84091747", "0.82213336", "0.8103092", "0.80608094", "0.80222034", "0.80111617", "0.79611206", "0.7912035", "0.78821295", "0.78523624", "0.7818349", "0.7798682", "0.7798682", "0.77797246", "0.776...
0.76625746
36
Deserialize the given JSON value into a value of target type T.
def from_json(cls, value: Any) -> Optional[T]: return cls.convert(value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decode_typed_json(json_value: str) -> tp.Any:\n def type_check(dct: tp.Dict[tp.Any, tp.Any]) -> tp.Any:\n val: tp.Any = dct.get(\"__custom_key_type__\")\n if val is not None:\n dct.pop(\"__custom_key_type__\")\n if val == \"int\":\n dct = {int(key): val for...
[ "0.6918004", "0.6709094", "0.66292405", "0.6623994", "0.66079015", "0.6601179", "0.6598827", "0.6563815", "0.6557816", "0.655484", "0.64939713", "0.6426596", "0.6417449", "0.64030993", "0.6351258", "0.62919825", "0.6276884", "0.62765706", "0.62647086", "0.62563", "0.6241945",...
0.80409926
0
Return a full array with the same shape and type as a given array.
def full_like( a: PolyLike, fill_value: numpy.typing.ArrayLike, dtype: Optional[numpy.typing.DTypeLike] = None, order: str = "K", subok: bool = True, shape: Optional[Sequence[int]] = None, ) -> ndpoly: del subok if not isinstance(a, numpy.ndarray): a = numpoly.polynomial(a) f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extend_array_to_homogeneous(array):\n try:\n assert array.shape[0] in (2, 3, 4)\n dim, samples = array.shape\n return np.vstack((array, np.ones((1, samples))))\n\n except:\n assert array.shape[1] in (2, 3, 4)\n array = array.T\n dim, samples = array.shape\n ...
[ "0.69447416", "0.69312024", "0.6878362", "0.6839883", "0.6718401", "0.6669042", "0.65807486", "0.64744055", "0.64656514", "0.6439276", "0.6420006", "0.6417963", "0.6383718", "0.6347529", "0.6339529", "0.6337528", "0.6332387", "0.6328901", "0.6328836", "0.62828034", "0.6261307...
0.0
-1
Constructor of class User instance
def __init__(self, *args, **kwargs): if kwargs is not None and len(kwargs) != 0: for i in kwargs: if i == "__class__": continue if i == "created_at" or i == "updated_at": kwargs[i] = datetime.strptime(kwargs[i], ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, user: User):\n self.user = user", "def __init__(self, user):\n\n if isinstance(user, dict):\n # Every user must have these values\n self.id = user['id']\n self.name = user['first_name']\n\n # These are optional\n self.usernam...
[ "0.79171914", "0.7881945", "0.7822626", "0.7515284", "0.74732244", "0.731235", "0.72665083", "0.724053", "0.7208261", "0.7187882", "0.7098638", "0.7029427", "0.70086724", "0.6974097", "0.6943216", "0.69365585", "0.69365585", "0.69333965", "0.69304746", "0.69235206", "0.692148...
0.0
-1
Symmetrically normalize adjacency matrix.
def sym_adj(adj): adj = ss.coo_matrix(adj) rowsum = np.array(adj.sum(1)) d_inv_sqrt = np.power(rowsum, -0.5).flatten() d_inv_sqrt[np.isinf(d_inv_sqrt)] = 0. d_mat_inv_sqrt = ss.diags(d_inv_sqrt) return np.array(adj.dot(d_mat_inv_sqrt).transpose().dot(d_mat_inv_sqrt).astype(np.float32).todense())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize_adj(adj):\n\n rowsum = np.array(adj.sum(1))\n d_inv_sqrt = np.power(rowsum, -0.5).flatten()\n d_inv_sqrt[np.isinf(d_inv_sqrt)] = 0.\n d_mat_inv_sqrt = np.diag(d_inv_sqrt)\n return adj.dot(d_mat_inv_sqrt).transpose().dot(d_mat_inv_sqrt)", "def normalize_adj(adj):\n adj = sp.coo_mat...
[ "0.7884114", "0.76970685", "0.76970685", "0.76970685", "0.76970685", "0.76970685", "0.76970685", "0.76970685", "0.76970685", "0.76970685", "0.7690504", "0.75934774", "0.7564955", "0.7335085", "0.7303445", "0.7268166", "0.6883762", "0.6861357", "0.6859015", "0.68306", "0.68275...
0.60147786
50
Rename tensor name to the corresponding Keras layer weight name. Arguments
def get_filename(key): filename = str(key) filename = filename.replace('/', '_') filename = filename.replace('InceptionResnetV2_', '') # remove "Repeat" scope from filename filename = re_repeat.sub('B', filename) if re_block8.match(filename): # the last block8 has different name with t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def RenameTensor(tensor, target_name):\n return RenameTensorCC(_stringify_tensor(tensor), target_name)", "def apply_tensor_weight(tensor, weight, name='ApplyTensorWeight'):\n with tf.name_scope(name, values=[tensor, weight]):\n if not isinstance(weight, tf.Tensor):\n weight = tf.convert_t...
[ "0.648256", "0.63962924", "0.60735977", "0.59958005", "0.58565325", "0.5848214", "0.5803682", "0.5737698", "0.57057655", "0.5685398", "0.56846446", "0.56622493", "0.56553805", "0.5644054", "0.56333524", "0.5626021", "0.56220543", "0.56185746", "0.5550615", "0.5548869", "0.554...
0.0
-1
Returns a list of WeightSeq extracted from the sequence file
def parse(self): if self._parse is None: seqs = [] # list of Weighted Sequences generated by parsing file with open(self._seqfile, "r") as f: for i, l in enumerate(f.readlines()): try: float(l) # try if line is numbers only...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_sequence(self):\n\n with open(self.input_file, 'r') as input_file:\n\n tree = ET.parse(input_file)\n root = tree.getroot()\n\n #print('Root:', root)\n\n # TODO: Expand to handle multiple parts\n part_list_idx = -1\n part_idx = -1\n\n ...
[ "0.64108676", "0.6391239", "0.61099696", "0.579101", "0.5783094", "0.5779583", "0.5770836", "0.5766802", "0.5726474", "0.5646491", "0.5617893", "0.5602426", "0.5569256", "0.5554135", "0.55480313", "0.54824543", "0.54511106", "0.544651", "0.5443406", "0.54264915", "0.54146636"...
0.7071571
0
Return a copy of the Survey.
def copy(self): return self.from_dict(self.to_dict(True))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy(self):\n return self.__copy__()", "def copy(self):\n return self.__copy__()", "def copy(self):\n return self.__copy__()", "def copy(self):\n return self.__copy__()", "def copy(self):\n return copy.copy(self)", "def copy(self):\n return copy.copy(self)", ...
[ "0.6349983", "0.6349983", "0.6349983", "0.6349983", "0.63252985", "0.63252985", "0.63252985", "0.62984246", "0.62984246", "0.6283458", "0.62654525", "0.6253717", "0.6222788", "0.6222788", "0.6222788", "0.6222788", "0.6222788", "0.6222788", "0.6222788", "0.6222788", "0.6222788...
0.575316
89
Convert dictionary into its class instance.
def from_dict(cls, inp): return cls(**{k: v for k, v in inp.items() if k != '__class__'})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _from_dict(cls, _dict):\n return cls.from_dict(_dict)", "def _from_dict(cls, _dict):\n return cls.from_dict(_dict)", "def _from_dict(cls, _dict):\n return cls.from_dict(_dict)", "def _from_dict(cls, _dict):\n return cls.from_dict(_dict)", "def _from_dict(cls, _dict):\n ...
[ "0.7427839", "0.7427839", "0.7427839", "0.7427839", "0.7427839", "0.7427839", "0.7427839", "0.7427839", "0.7427839", "0.7427839", "0.7427839", "0.7427839", "0.7427839", "0.7427839", "0.7427839", "0.7427839", "0.7427839", "0.7427839", "0.7427839", "0.7427839", "0.7427839", "...
0.7000202
47
Total length of all dipole segments formed by the electrodes.
def length(self): if not hasattr(self, '_length'): lengths = np.linalg.norm(np.diff(self.points, axis=0), axis=1) self._segment_lengths = lengths self._length = lengths.sum() return self._length
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def perimeter(self):\n return sum([s.length for s in self.segments])", "def perimeter(self):\n return sum(seg.length for seg in self.segments) + \\\n sum([p.perimeter for p in self.subs])", "def Lengths(self):\n\n self.__do_essential_memebers_exist__()\n\n if self.ele...
[ "0.80503774", "0.7307756", "0.72855043", "0.7231356", "0.720365", "0.7186324", "0.7186324", "0.70576584", "0.7001449", "0.6893308", "0.6877794", "0.686698", "0.68479615", "0.68406725", "0.68000835", "0.6771557", "0.67691845", "0.674418", "0.6726382", "0.6705633", "0.6674243",...
0.7385069
1
Initiate an electric point.
def __init__(self, coordinates): if len(coordinates) != 5: raise ValueError( "Point coordinates are wrong defined. They must be " "defined as (x, y, z, azimuth, elevation)." f"Provided coordinates: {coordinates}." ) # Cast and sto...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n self.center = Point()\n self.velocity = Velocity()", "def __init__(self,E,px,py,pz):\n Particle.__init__(self)\n self.E=float(E)\n self.px=float(px)\n self.py=float(py)\n self.pz=float(pz)\n self.cal_pt()\n self.cal_phi()\n ...
[ "0.65331626", "0.6329798", "0.61928076", "0.61878675", "0.61624813", "0.6144587", "0.6140401", "0.6075552", "0.6075552", "0.60066694", "0.59935427", "0.59935427", "0.59897715", "0.59456974", "0.59206545", "0.59206545", "0.59206545", "0.58984107", "0.58923453", "0.5890462", "0...
0.6057053
9
Initiate an electric dipole.
def __init__(self, coordinates, length=1.0): # Cast coordinates. coordinates = np.asarray(coordinates, dtype=np.float64).squeeze() # Check which format was provided. is_point = coordinates.shape == (5, ) is_flat = coordinates.shape == (6, ) is_dipole = coordinates.shape...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n super().__init__()\n\n # Gadget state\n \n self.isDoorOpen = False\n self.verified = True\n\n # Ev3dev initialization\n self.leds = Leds()\n self.sound = Sound()\n self.drive = MoveTank(OUTPUT_B, OUTPUT_C)\n \n self....
[ "0.6139639", "0.57412803", "0.57412803", "0.5689211", "0.5685236", "0.5551022", "0.5539192", "0.55229694", "0.55106854", "0.5445942", "0.5390988", "0.5345029", "0.5322621", "0.53111583", "0.53058577", "0.5290464", "0.5287698", "0.52631265", "0.5261136", "0.52470624", "0.52304...
0.0
-1
Encode into a cmdexecutable string. This reimplements CreateProcess's quoting logic to turn a list of arguments into one single string for the shell to interpret. All double quotes are escaped with a backslash. Existing backslashes before a quote are doubled, so they are all escaped properly. Backslashes elsewhere are ...
def cmdify(self): return " ".join( itertools.chain( [_quote_if_contains(self.command, r"[\s^()]")], (_quote_if_contains(arg, r"[\s^]") for arg in self.args), ) )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sh_quote_safe_cmdline(args):\n return str.join(' ', (sh_quote_safe(arg) for arg in args))", "def sh_quote_unsafe_cmdline(args):\n return str.join(' ', (sh_quote_unsafe(arg) for arg in args))", "def _quote_arguments(args):\n return map(lambda x: '\"{}\"'.format(x) if ' ' in x else '{}'.format(x...
[ "0.6575339", "0.64446235", "0.64304733", "0.64175117", "0.63919944", "0.63228524", "0.6258994", "0.6122354", "0.58918214", "0.5871662", "0.586585", "0.5840996", "0.5836241", "0.57942694", "0.5723859", "0.5723824", "0.5671637", "0.56680745", "0.56675756", "0.5659947", "0.55863...
0.5867535
10
Split data to 1 batch each device.
def split_and_load(batch, ctx_list): num_ctx = len(ctx_list) new_batch = [] for i, data in enumerate(batch): new_data = [x.as_in_context(ctx) for x, ctx in zip(data, ctx_list)] new_batch.append(new_data) return new_batch
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _batchify(data: nd.NDArray, batch_size):\n # Work out how cleanly we can divide the dataset into bsz parts.\n nbatch = len(data) // batch_size\n # Trim off any extra elements that wouldn't cleanly fit (remainders).\n data = data[0: nbatch * batch_size]\n # Evenly divide the d...
[ "0.7008145", "0.69225854", "0.67516387", "0.6708468", "0.66717356", "0.65759706", "0.65389574", "0.6516114", "0.6464656", "0.64498186", "0.6442398", "0.6420633", "0.6341426", "0.6263667", "0.6261499", "0.625235", "0.62451035", "0.61681885", "0.61512464", "0.6141118", "0.61141...
0.0
-1
Evaluates the ecdf at x
def __call__(self, x): return np.mean(self.observations <= x)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eval_ecdf(self, vx, ecdf, x):\n if len(vx) != len(ecdf):\n raise ValueError('eval_ecdf: distribution and ecdf lengths don\\'t match') \n\n i = np.searchsorted(vx, x, side = 'right') - 1\n if i < 0:\n return 0.\n else:\n return ecdf[i]", "def ecdf(x...
[ "0.8146644", "0.7651154", "0.76503396", "0.75877863", "0.75877863", "0.7564818", "0.75498796", "0.7525826", "0.7518186", "0.7518186", "0.7516305", "0.7514393", "0.7513443", "0.7513443", "0.74846345", "0.74844706", "0.7467986", "0.7414829", "0.73802257", "0.7370195", "0.731885...
0.0
-1
Return output class of driver. Returns
def load_output_writer(output_params): if not isinstance(output_params, dict): raise ValueError("output_params must be a dictionary") driver_name = output_params["format"] if driver_name not in available_output_formats(): raise errors.MapcheteDriverError("driver %s not found" % driver_name) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_output_type(self):\n return self.__output_type", "def _get_output_type(self):\n return self.__output_type", "def _get_output_type(self):\n return self.__output_type", "def _get_output_type(self):\n return self.__output_type", "def _get_output_type(self):\n return self.__output_type"...
[ "0.7423048", "0.7423048", "0.7423048", "0.7423048", "0.7423048", "0.7423048", "0.7061609", "0.6484369", "0.6410715", "0.6298013", "0.62936586", "0.62860185", "0.6253708", "0.6236476", "0.62347573", "0.618444", "0.61479294", "0.61404", "0.6130181", "0.6086866", "0.6077479", ...
0.0
-1
Retrieve a node's attribute from the attrib hash.
def __getitem__(self, key): return self.attrib[key]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_node_attr(self, node, attr):\n return self.metrics[attr].ix[node]", "def _get_attr(self, attr, root=None):\n with self._h5file('r') as h5file:\n if root is None:\n obj = h5file\n else:\n obj = h5file[root]\n return get_decoded(...
[ "0.79159194", "0.7671952", "0.74305105", "0.71056813", "0.70064753", "0.6943956", "0.6936245", "0.6930656", "0.6913148", "0.68379766", "0.6834571", "0.68190086", "0.6767745", "0.6711323", "0.6706494", "0.6700773", "0.66855186", "0.66285855", "0.6615837", "0.65721554", "0.6536...
0.684031
9
Returns area of a circle
def circle_area(r): if r < 0: raise ValueError("Radius cannot be negative") return pi*(r**2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def circle_area(circle):\n return pi * circle.radius * circle.radius", "def area_of_circle(radius):\n return radius", "def circle_area(radius):\n area = radius ** 2 * math.pi\n return area", "def area(self):\n\t\t#print (self.radius*self.radius*math.pi)\n\t\tcircle_area = (self.radius*self.radius...
[ "0.9091267", "0.8981688", "0.87279946", "0.8713818", "0.8643989", "0.8638605", "0.85790324", "0.8510922", "0.84058666", "0.84058666", "0.8388797", "0.8306146", "0.82901704", "0.8135795", "0.8114081", "0.8105787", "0.8105787", "0.8066629", "0.8049314", "0.8016954", "0.80149436...
0.79305047
25
Test case for workflows_get
def test_workflows_get(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_workflows_find_one_get(self):\n pass", "def test_workflows_list(self):\n pass", "def test_workflows_id_team_get(self):\n pass", "def test_workflows_id_get(self):\n pass", "def test_workflows_id_exists_get(self):\n pass", "def test_get_workflow_definition(self):...
[ "0.8070687", "0.7967046", "0.79318464", "0.79281706", "0.75574213", "0.7503531", "0.74831486", "0.7395697", "0.72457546", "0.71581185", "0.70519435", "0.6942522", "0.68664724", "0.6820854", "0.6763503", "0.67598945", "0.6735586", "0.67130214", "0.66862565", "0.6623346", "0.66...
0.9234206
0
Find a chunk after the one specified which is not a file block.
def find_file_end(chunks, pos): pos = pos + 1 while pos < len(chunks)-1: if chunks[pos][0] != 0x100 and chunks[pos][0] != 0x102: # This is not a block return pos else: pos = pos + 1 return pos
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_file_start(chunks, pos):\n\n\tpos = pos - 1\n\twhile pos > 0:\n\n\t\tif chunks[pos][0] != 0x100 and chunks[pos][0] != 0x102:\n\n\t\t\t# This is not a block\n\t\t\treturn pos\n\n\t\telse:\n\t\t\tpos = pos - 1\n\n\treturn pos", "def find_next_block(chunks, pos):\n\n\twhile pos < len(chunks):\n\n\t\tpos, c...
[ "0.6899765", "0.68623376", "0.59608024", "0.58929473", "0.58870953", "0.58684754", "0.5796162", "0.5783809", "0.55599594", "0.5549232", "0.5542972", "0.55371046", "0.55353194", "0.5435706", "0.53687376", "0.53617156", "0.53470737", "0.53340805", "0.53241694", "0.5295418", "0....
0.76235753
0
Returns a random string of variable length.
def random_string(length=12): return ''.join( [random.choice(string.ascii_letters) for _ in range(length)])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def random_string(length=8):\n return \"\".join([random.choice(string.letters + string.digits) for x in range(length)])", "def _generate_random_string(length: int):\n\tall_chars = string.ascii_letters + string.digits\n\treturn ''.join(random.choices(all_chars, k=length))", "def random_string(length=10):\n\n...
[ "0.8512489", "0.8494098", "0.8467585", "0.8431015", "0.8429046", "0.8422014", "0.84187466", "0.8386291", "0.8382056", "0.83323145", "0.8321767", "0.8312012", "0.8303429", "0.82841396", "0.827306", "0.8264431", "0.8247679", "0.8245592", "0.82432973", "0.82397634", "0.8217627",...
0.79571426
56
Convert a string (bytes, str or unicode) to bytes.
def to_bytes(string): assert isinstance(string, basestring) if sys.version_info[0] >= 3: if isinstance(string, str): return string.encode('utf-8') else: return string else: if isinstance(string, unicode): return string.encode('utf-8') else:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def asbytes(s):\n if isinstance(s, bytes):\n return s\n else:\n return s.encode('utf-8')", "def _as_bytes(s):\n if isinstance(s, bytes):\n return s\n return bytes(s, encoding='latin_1')", "def str_to_bytes(data):\n u_type = type(b''.decode('utf8'))\n if isinstance...
[ "0.83166814", "0.8276273", "0.81541514", "0.80628175", "0.8053019", "0.79973334", "0.7918652", "0.78740764", "0.7695469", "0.76587254", "0.7574489", "0.75354373", "0.7494106", "0.7475211", "0.74321854", "0.73888975", "0.7321566", "0.726465", "0.7222552", "0.7194866", "0.71457...
0.83013546
1
Check to see if string is an validlyformatted web url.
def is_web_url(string): assert isinstance(string, basestring) parsed_url = urllib.parse.urlparse(string) return ((parsed_url.scheme.lower() == 'http' or parsed_url.scheme.lower() == 'https') and parsed_url.netloc)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def IsValidURL(s):\n return RE_COMPLEX_URL.match(s)", "def _is_url(string):\n return \"http\" in string", "def is_url(string):\n try:\n urlparse(string)\n return True\n except:\n return False", "def ISURL(value):\n value = value.strip()\n if ' ' in value: # Disallow sp...
[ "0.798556", "0.7913737", "0.79134065", "0.7560818", "0.74818385", "0.74496377", "0.7397994", "0.7380027", "0.7314372", "0.73088473", "0.7305197", "0.7286274", "0.72763705", "0.7266346", "0.724479", "0.72330725", "0.7223118", "0.7207615", "0.7198751", "0.71708184", "0.7154463"...
0.75416034
4
Object is an instance of one of the acceptable types or None.
def check_type(o, acceptable_types, may_be_none=True): if not isinstance(acceptable_types, tuple): acceptable_types = (acceptable_types,) if may_be_none and o is None: # Object is None, and that is OK! pass elif isinstance(o, acceptable_types): # Object is an instance of an ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _validate_type(self, name, obj, *args):\n if obj is None:\n return\n for arg in args:\n if isinstance(obj, arg):\n return\n raise TypeError(self.__class__.__name__ + '.' + name + ' is of type ' + type(obj).__name__ +\n '. Must be ...
[ "0.7372312", "0.7351118", "0.6914898", "0.6839669", "0.68230265", "0.6744745", "0.6712897", "0.6707553", "0.66834366", "0.6668038", "0.6668038", "0.6548762", "0.65037185", "0.64603335", "0.64498526", "0.6442158", "0.6440311", "0.6394822", "0.6354247", "0.6337706", "0.6329847"...
0.6951684
2
Creates a dict with the inputted items; pruning any that are `None`.
def dict_from_items_with_values(*dictionaries, **items): dict_list = list(dictionaries) dict_list.append(items) result = {} for d in dict_list: for key, value in d.items(): if value is not None: result[key] = value return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def noneless(**kwargs):\n return {k: v for k, v in kwargs.items() if v is not None}", "def non_none_dict(dikt: List[Tuple[str, Any]]) -> Dict[Any, Any]:\n return {k: v for k, v in dikt if v is not None}", "def _remove_nulls(self, params):\n\n if params is not None:\n return {key:value f...
[ "0.7203256", "0.71162754", "0.67997175", "0.67858404", "0.67538726", "0.6642284", "0.6626592", "0.6587944", "0.65840757", "0.65553176", "0.6552325", "0.6541382", "0.6531254", "0.6497841", "0.64602757", "0.64529175", "0.6367261", "0.6331639", "0.6307725", "0.6292292", "0.62476...
0.59300154
26
Return a fresh iterator.
def __iter__(self): return self.new_generator()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __iter__(self):\n self.reset()\n return self", "def __iter__(self):\n self.iterator = 0\n return self", "def __iter__(self):\n self.iterator = 0\n return self", "def __iter__(self):\n self.iterator = 0\n return self", "def __iter__(self):\n ...
[ "0.6787318", "0.6639856", "0.6639856", "0.6639856", "0.6639856", "0.64030266", "0.6359154", "0.6326801", "0.63230234", "0.6273083", "0.62508345", "0.6234522", "0.6232418", "0.622732", "0.62235445", "0.6155811", "0.61383545", "0.61202335", "0.60942787", "0.607228", "0.6065891"...
0.69935095
0
Performs nested merge of multiple dictionaries. The values from dictionaries appearing first takes precendence
def dict_merge(*dictionaries): merged_dict = {} def merge(source, defaults): source = copy.deepcopy(source) # Nested merge requires both source and defaults to be dictionary if isinstance(source, dict) and isinstance(defaults, dict): for key, value in defaults.items(): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def merge_dictionaries(d1, d2):\n\n if d2 is None: \n return\n\n for k, v in d2.items():\n if k not in d1:\n d1[k] = dict()\n if isinstance(v, dict):\n merge_dictionaries(d1[k], v)\n else:\n d1[k] = v", "def _merge_dicts(*args):\n return reduc...
[ "0.7520287", "0.75152767", "0.75104934", "0.744964", "0.74282724", "0.73904186", "0.7353902", "0.73469716", "0.73456043", "0.73341364", "0.7263729", "0.7252377", "0.7252377", "0.7252377", "0.7252377", "0.7252377", "0.7252377", "0.7225198", "0.72152394", "0.71977186", "0.71965...
0.71497715
24
Return an array of zeros with the same shape and type as a given array.
def zeros_like(a, dtype=None, order='K', subok=True, shape=None): res = np.full(a.shape, 0, dtype=a.dtype) return res
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def zeros_numpy_array(self,\n type_name,\n as_matrix = True):\n if as_matrix:\n return np.zeros((1, self.get_max_id(type_name)), dtype='float32')\n else:\n return np.zeros((self.get_max_id(type_name),), dtype='float32')", "def __array__(self):\n re...
[ "0.71901995", "0.7102643", "0.70028716", "0.6906397", "0.690314", "0.69028187", "0.67210937", "0.670826", "0.6682537", "0.6682537", "0.66433126", "0.66100216", "0.6585698", "0.65632486", "0.65425885", "0.65417486", "0.65417486", "0.6528437", "0.64924175", "0.645705", "0.63689...
0.7236643
0
Get the versiondependant directory where executables are installed.
def eplus_home(self): if self.idf.file_version <= Version("7.2"): install_dir = self.idf.file_version.current_install_dir / "bin" else: install_dir = ( self.idf.file_version.current_install_dir / "PreProcess" / "GrndTempCalc" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_bin_dir():\n return os.path.abspath(os.path.join(get_root_dir(), 'bin/'))", "def program_dir():\n if (Win32() and (hasattr(sys, 'frozen') or imp.is_frozen('__main__'))):\n # running from exe generated by py2exe\n return os.path.dirname(sys.executable)\n else:\n return sys.pa...
[ "0.7678771", "0.7629649", "0.74228954", "0.7351423", "0.7337144", "0.7321306", "0.73042876", "0.7187405", "0.7140525", "0.71285725", "0.71048546", "0.6975777", "0.6959856", "0.6957488", "0.6930089", "0.68593496", "0.6833496", "0.67838484", "0.67734593", "0.67662066", "0.67540...
0.636509
78
Returns a gaussian function with the given parameters
def gaussian(height, center_x, center_y, width_x, width_y): width_x = float(width_x) width_y = float(width_y) return lambda x,y: height*np.exp( -(((center_x-x)/width_x)**2+((center_y-y)/width_y)**2)/2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gaussian(x, *parameters):\n position, sigma, amplitude, background = parameters\n return amplitude * np.exp(-(x - position)**2 / (2.0 * sigma**2)) + background", "def gaussian(pars, x):\n A, b, mu, sigma = pars\n # return b + A/(np.sqrt(2*np.pi)*sigma**2) \\\n return b + A \\\n * np.exp...
[ "0.7936006", "0.78110605", "0.7589353", "0.749031", "0.74657845", "0.7387422", "0.73763347", "0.7243705", "0.7227015", "0.72231114", "0.713038", "0.7127564", "0.7118518", "0.70896465", "0.7083726", "0.70708406", "0.70604295", "0.70323956", "0.70142984", "0.69931597", "0.69804...
0.7267818
7
Set the format for a specific log level.
def setFormat(lvl, fmt): if lvl == DEBUG: Dispatcher.debugFormat = fmt elif lvl == COMMENT: Dispatcher.commentFormat = fmt elif lvl == INFO: Dispatcher.infoFormat = fmt elif lvl == WARNING: Dispatcher.warningFormat = fmt elif lvl == ERROR: Dispatcher.errorForm...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_log_level_format(level, format):\n formatter = logging.Formatter(fmt=format)\n logger.handlers[0].setFormatter(formatter)\n logger.setLevel(level)", "def set_log_format(format):\n root = logging.getLogger()\n handler = root.handlers[0]\n formatter = logging.Formatter(format)\n handle...
[ "0.8326675", "0.7306647", "0.7297867", "0.71461", "0.68146026", "0.676332", "0.67563736", "0.6729336", "0.6674633", "0.6656957", "0.65873337", "0.6585641", "0.65225023", "0.64628446", "0.64280134", "0.6377292", "0.634715", "0.6331354", "0.63311106", "0.63140166", "0.63116395"...
0.7133961
4
Changes the log level of existing log handlers
def setLevel(self, level): handlers = self.logger.handlers for handler in handlers: handler.setLevel(level)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_level(log_or_name, level):\n if isinstance(log_or_name, str):\n log = get_logger(log_or_name)\n else:\n log = log_or_name\n log.setLevel(level)\n for handler in log.handlers:\n handler.setLevel(level)", "def adjust_log_level(level='ERROR'):\n _logger = logger()\n ol...
[ "0.7290717", "0.70485944", "0.6943617", "0.6905589", "0.6900469", "0.68942964", "0.6889501", "0.68823797", "0.6866855", "0.6765658", "0.6734045", "0.6733529", "0.6714622", "0.6709143", "0.6705101", "0.66910774", "0.66720605", "0.6664049", "0.665063", "0.6620443", "0.65997595"...
0.7424739
0
Returns count of maximum consecutive ones that can be achieved by flipping m zeroes.
def max_ones_length(self, array, m): n = len(array) i, j = 0, 0 # sliding window indices curr_ones = 0 max_ones = 0 while j < n: if array[j]: # current element is 1, increase 1s count curr_ones += 1 j += 1 max_ones = m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def max_ones_seq(self, array, m):\n n = len(array)\n i, j = 0, 0 # start, end of current consecutive 1s sequence\n x, y = 0, 0 # start, end of longest consecutive 1s sequence\n while j < n:\n if array[j]: # current element is 1\n if j - i > y - x: # update ...
[ "0.6893887", "0.65101814", "0.6407813", "0.631066", "0.6254758", "0.62352514", "0.6232273", "0.6207942", "0.61769855", "0.61196387", "0.61055666", "0.60988253", "0.60544664", "0.6033804", "0.60193837", "0.5965587", "0.5893189", "0.58626795", "0.5847767", "0.5819652", "0.58049...
0.7667801
0
Plots an explantion of a single prediction as a waterfall plot. The SHAP value of a feature represents the impact of the evidence provided by that feature on the model's output. The waterfall plot is designed to visually display how the SHAP values (evidence) of each feature move the model output from our prior expecta...
def wfall(shap_values, max_display=10, show=True): dark_o= mpl.colors.to_rgb('dimgray') dim_g= mpl.colors.to_rgb('darkorange') base_values = shap_values.base_values features = shap_values.data feature_names = shap_values.feature_names lower_bounds = getattr(shap_values, "lower_bounds", Non...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def waterfall(shap_values, max_display=10, show=True, y_reverse=False, rank_absolute=True, raw_ascending=True):\n # Turn off interactive plot\n if show is False:\n plt.ioff()\n\n base_values = shap_values.base_values\n features = shap_values.display_data if shap_values.display_data is not None e...
[ "0.75429845", "0.6488294", "0.594002", "0.5885582", "0.5786359", "0.57558745", "0.57261145", "0.54675704", "0.5397909", "0.5311824", "0.5300442", "0.5288463", "0.5284333", "0.52532196", "0.524341", "0.5239114", "0.52311605", "0.5230331", "0.52274936", "0.5216817", "0.51673377...
0.7552447
0
Create a question with the given `question_text` and published the given number of `days` offset to now (negative for questions published in the past, positive for questions that have yet to be published).
def create_event(organizer, description, location, days): time = timezone.now() + datetime.timedelta(days=days) return Event.objects.create(event_organizer=organizer, event_desctiption=description, event_location=loaction, event_date = time)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_question(question_text, days):\n\ttime = timezone.now()+dt.timedelta(days=days)\n\treturn Question.objects.create(question_text=question_text, pub_date=time)", "def create_question(question_text, days):\n time = timezone.now() + timezone.timedelta(days=days)\n return Question.objects.create(ques...
[ "0.80268794", "0.7961707", "0.79341936", "0.79341936", "0.78734887", "0.72055525", "0.7146879", "0.68233657", "0.6122742", "0.60281944", "0.54793286", "0.54391104", "0.5400368", "0.5327857", "0.52856183", "0.5266188", "0.52563554", "0.52472454", "0.52389586", "0.52372223", "0...
0.0
-1
coming_up() returns false for event whose event_date is more than 7 days in the future.
def test_coming_up_seven_days_until(self): time = timezone.now() + datetime.timedelta(days=10) event = Event(event_date=time) self.assertIs(event.coming_up(), False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_coming_up_seven_days_past(self):\n time = timezone.now() + datetime.timedelta(days=-7)\n tomorrow_event = Event(event_date=time)\n self.assertIs(tomorrow_event.coming_up(), False)", "def test_coming_up_one_day_past(self):\n time = timezone.now() + datetime.timedelta(days=-1, ...
[ "0.8148623", "0.7653311", "0.7554201", "0.7468266", "0.74681044", "0.7382703", "0.66987747", "0.6370789", "0.6319554", "0.63135624", "0.6278618", "0.6153979", "0.6141238", "0.6093789", "0.606227", "0.60470486", "0.60265756", "0.60035163", "0.5997401", "0.59239984", "0.5902729...
0.8249643
0
Extracts requirements from file
def extract_requiremens(file): with open(file, 'r') as file: return file.read().splitlines()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_requirements(filename, *args, **kwargs):\n lineiter = (line.strip() for line in open(filename))\n return [line for line in lineiter if line and not line.startswith(\"#\")]", "def parse_requirements_txt():\n root = os.path.dirname(os.path.abspath(__file__))\n\n requirements = []\n depende...
[ "0.7864506", "0.785605", "0.7752473", "0.7693288", "0.7667365", "0.7660411", "0.76252174", "0.7612514", "0.75689715", "0.75689715", "0.75689715", "0.75657594", "0.75468904", "0.75338495", "0.7512407", "0.7490859", "0.7488078", "0.7486247", "0.74606407", "0.7452474", "0.743636...
0.68659645
44
Find root directory of android source tree
def find_root(): curdir = os.path.curdir fs_root = "/" # Do as build/envsetup.sh does # if this files exists, we're at root root_clue = "build/core/envsetup.mk" found = False while not found and not os.path.samefile(fs_root, curdir): if os.path.exists(os.path.join(curdir, root_clue)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def source_root_dir():\n return os.path.abspath(os.path.dirname(__file__))", "def root_dir():\r\n return Path(__file__).parent.parent", "def get_root_directory() -> str:\n return \"{}/../\".format(get_cur_directory(__file__))", "def root_dir():\n return os.path.dirname(os.path.realpath(__file__ +...
[ "0.7485199", "0.72626877", "0.70470035", "0.70062184", "0.70062184", "0.6999309", "0.6976717", "0.6962007", "0.69551116", "0.6920368", "0.6907915", "0.6885929", "0.68375987", "0.6822629", "0.6802973", "0.66275257", "0.66162664", "0.6585836", "0.6574158", "0.65687233", "0.6557...
0.6973183
7
Returns indices of bad rows (with absurdly high readings) from building 1099.
def find_bad_building1099(df : pd.DataFrame, y): return df[(df.building_id == 1099) & (df.meter == 2) & (y > 3e4)].index
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_invalid_rows(rows):\n\n invalid_row_indices = []\n for i, row in enumerate(rows):\n is_valid, col_id = is_row_well_formatted(row)\n if not is_valid:\n invalid_row_indices.append((i, col_id))\n\n return invalid_row_indices", "def find_bad_zeros(df : pd.DataFrame, y):\n ...
[ "0.6372683", "0.5847993", "0.58163613", "0.5712987", "0.57086277", "0.5675514", "0.5631074", "0.55058837", "0.5444953", "0.5429496", "0.54250795", "0.5417753", "0.54119563", "0.53947705", "0.5358459", "0.5345951", "0.53214365", "0.5304924", "0.5300727", "0.5296954", "0.528590...
0.67571837
0
Return MySensors devices for a platform.
def get_mysensors_devices(hass, domain): if MYSENSORS_PLATFORM_DEVICES.format(domain) not in hass.data: hass.data[MYSENSORS_PLATFORM_DEVICES.format(domain)] = {} return hass.data[MYSENSORS_PLATFORM_DEVICES.format(domain)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_devices(self):\n return self.api_request('GET', self.url + '/device', {})", "def get_devices(self):\n devices = self.get(\"event/device\")", "def get_devices(self):\n return get_devices(self.api_key)", "def get_devices():\n devices = []\n for device_id in range(pm.lib.Pm_Co...
[ "0.68569696", "0.6679099", "0.66768116", "0.66325873", "0.66100585", "0.64867175", "0.64808327", "0.64228743", "0.64004874", "0.63938224", "0.63351697", "0.62933505", "0.6269824", "0.62601966", "0.6258197", "0.62559813", "0.61981905", "0.61654925", "0.6144452", "0.6132", "0.6...
0.72125417
0
Set up the MySensors device.
def __init__(self, gateway, node_id, child_id, name, value_type): self.gateway = gateway self.node_id = node_id self.child_id = child_id self._name = name self.value_type = value_type child = gateway.sensors[node_id].children[child_id] self.child_type = child.type...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_sensors(self, configs):\n self.__sensors = self.setup_components(configs, 'scale_client.sensors')", "def _setup_sensor ( self ):\n self.spectral = Spectral ( np.array([450, 520, 630, 770., 1550, 2090.] ),\n np.array([ 520, 600, 690, 900., 1750., 2350.] ) ...
[ "0.6603934", "0.65007263", "0.64866245", "0.63908166", "0.6337923", "0.6306074", "0.6228583", "0.61765695", "0.61473536", "0.60903114", "0.6085271", "0.60847867", "0.6054465", "0.6034408", "0.60122997", "0.5987552", "0.5983139", "0.5969286", "0.5911789", "0.59089386", "0.5900...
0.0
-1