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 |
|---|---|---|---|---|---|---|
Test case for get_date_column_index when column name has left and right trailing spaces with 'Date'. | def test_get_date_column_index_dates_spaces_both_sides(self, date_spaces_both_sides_worksheet):
actual_result = date_spaces_both_sides_worksheet.get_date_column_index()
assert actual_result == 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_date_column_index_right_trailing_spaces(self, date_trailing_right_spaces_worksheet):\n\n actual_result = date_trailing_right_spaces_worksheet.get_date_column_index()\n assert actual_result == 0",
"def test_get_date_column_index_left_trailing_spaces(self, date_trailing_left_spaces_works... | [
"0.75458163",
"0.74885297",
"0.73222536",
"0.659821",
"0.6234132",
"0.57225263",
"0.5620066",
"0.54223055",
"0.5416918",
"0.5414933",
"0.537645",
"0.53192395",
"0.5310726",
"0.52563626",
"0.52513456",
"0.52411544",
"0.5214661",
"0.517968",
"0.5142795",
"0.5139926",
"0.5114689... | 0.71300393 | 3 |
Returns a random string of len n alphabets | def hash_gen(n):
domain = "abcdefghijklmnopqrstuvwxyz"
temp = ""
for i in range(0, n):
temp += domain[random.randrange(0, 26)]
return temp | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gen_rand_str(n):\n return \"\".join(random.choice(string.ascii_letters) for _ in range(n))",
"def randstr(n):\n alphabets = string.digits + string.letters\n return ''.join(random.choice(alphabets) for i in xrange(n))",
"def random_alpha(n=8):\n return \"\".join(random.SystemRandom().choice(... | [
"0.866959",
"0.86474377",
"0.8476402",
"0.84470123",
"0.82001007",
"0.8176532",
"0.81700337",
"0.8145675",
"0.8053305",
"0.7971005",
"0.79663837",
"0.7958915",
"0.7939521",
"0.7881841",
"0.7871715",
"0.7871162",
"0.78622895",
"0.78410995",
"0.78336436",
"0.7829303",
"0.780922... | 0.0 | -1 |
Renders home Page via get request to server/short | def home():
tc = totalclicks()
tl1, tl2, tl3 = topthreelinks()
bl1, bl2, bl3 = topblomoedlinks()
return flask.render_template('home.html', tc=tc, tl1=tl1, tl2=tl2, tl3=tl3, bl1=bl1, bl2=bl2, bl3=bl3) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(self):\n\n self.response.out.write(template.render('templates/home.html', None))",
"def get(self):\n if self.logged_in:\n self.render('home.html', {\n 'name': self.current_user.name,\n 'server': self.current_user.server,\n 'faction': factions.get(self.current_user.fact... | [
"0.79069793",
"0.78249097",
"0.7647826",
"0.7595297",
"0.7578243",
"0.7519296",
"0.75190306",
"0.7499392",
"0.74986225",
"0.74476576",
"0.7447526",
"0.74466145",
"0.7434499",
"0.7421663",
"0.7421282",
"0.7403467",
"0.7392529",
"0.7383648",
"0.73749393",
"0.73742604",
"0.73733... | 0.0 | -1 |
Get root directory for ACIS load review data. | def get_lr_root():
data_acis_lr = Path("data", "acis", "LoadReviews")
path = "/" / data_acis_lr
if not path.exists():
path = os.environ["SKA"] / data_acis_lr
if not path.exists():
raise FileNotFoundError("no available ACIS load review directory")
return path | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_root_dir():\n return os.path.dirname(os.path.dirname(__file__))",
"def get_root_directory() -> str:\n return \"{}/../\".format(get_cur_directory(__file__))",
"def root_dir():\r\n return Path(__file__).parent.parent",
"def root_dir():\n return dirname(dirname(__file__))",
"def rootdir():... | [
"0.68795156",
"0.68111616",
"0.67836326",
"0.6776731",
"0.6758963",
"0.67408526",
"0.67155176",
"0.6695734",
"0.6695734",
"0.6682036",
"0.66381526",
"0.66070306",
"0.65366346",
"0.65323985",
"0.65298766",
"0.651896",
"0.651377",
"0.649836",
"0.6481465",
"0.64255357",
"0.64240... | 0.8542885 | 0 |
Recall metric. Only computes a batchwise average of recall. Computes the recall, a metric for multilabel classification of how many relevant items are selected. | def recall(y_true, y_pred):
true_positives = K.sum(K.round(K.clip(y_true * y_pred, 0, 1)))
possible_positives = K.sum(K.round(K.clip(y_true, 0, 1)))
recall = true_positives / (possible_positives + K.epsilon())
return recall | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def recall(y_true, y_pred, average, labels):\n\n y_true, y_pred = check_metric_args(y_true, y_pred, average, labels)\n\n result = None\n\n m = len(y_true)\n n = len(labels)\n\n confusion_matrix = get_confusion_matrix(y_true, y_pred, labels).T\n\n if average == \"micro\":\n numerator = np.t... | [
"0.7605524",
"0.74488467",
"0.7404089",
"0.7280915",
"0.72097343",
"0.7165874",
"0.7157609",
"0.7145226",
"0.7145226",
"0.7145226",
"0.7145226",
"0.7145226",
"0.7145226",
"0.71317255",
"0.71007556",
"0.70663655",
"0.7064473",
"0.70627505",
"0.70627505",
"0.70627505",
"0.70627... | 0.70970625 | 28 |
Precision metric. Only computes a batchwise average of precision. Computes the precision, a metric for multilabel classification of how many selected items are relevant. | def precision(y_true, y_pred):
true_positives = K.sum(K.round(K.clip(y_true * y_pred, 0, 1)))
predicted_positives = K.sum(K.round(K.clip(y_pred, 0, 1)))
precision = true_positives / (predicted_positives + K.epsilon())
return precision | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def precision(self):\n self.overall_precision = precision_score(\n self.y_true, self.y_pred, average = self.average_type).round(self.digits_count_fp)\n self.classes_precision = precision_score(\n self.y_true, self.y_pred, average = None).round(self.digits_count_fp)",
"def comp... | [
"0.74895597",
"0.7288002",
"0.7157488",
"0.7152486",
"0.7064426",
"0.69853395",
"0.6965261",
"0.6953886",
"0.6911727",
"0.6832038",
"0.6816865",
"0.6808645",
"0.6804309",
"0.6804309",
"0.6804309",
"0.6804309",
"0.6804309",
"0.6804309",
"0.678481",
"0.67567295",
"0.67567295",
... | 0.6754354 | 40 |
return the row indices for columns values that match a list | def get_row_indices(df, col, vals):
return list(df[df[col].isin(vals)].index) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_indexes(from_list, find_list):\n\n df_find = pd.DataFrame(find_list, columns=['value'])\n df_from = pd.DataFrame(list(zip(from_list, np.arange(len(from_list)))), columns=['value', 'index'])\n indexes = pd.merge(df_from, df_find, on='value', how='inner')['index'].values\n return indexes",
"def... | [
"0.70611346",
"0.6631404",
"0.6606466",
"0.64161843",
"0.63754165",
"0.6358775",
"0.6354408",
"0.63298845",
"0.63192666",
"0.63010293",
"0.6225213",
"0.6114995",
"0.6109566",
"0.603413",
"0.5984162",
"0.59210813",
"0.5906775",
"0.58362526",
"0.58006567",
"0.57381606",
"0.5693... | 0.64672875 | 3 |
Sigmoid function >>> _sigmoid(0) 0.5 >>> _sigmoid(1) 0.7310585786300049 >>> _sigmoid(1) 0.2689414213699951 | def _sigmoid(x):
e=0
try:
e = _exp(-1*x)
except OverflowError:
return 0
return 1./(1.+e) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sigmoid(x):\n return 1 / (1 + exp(-x))",
"def sigmoid(x):\n return 1 / (1 + exp(-x))",
"def _sigmoid(x):\n return 1 / (1 + np.exp(-x))",
"def sigmoid(x):\n return 1.0/(1.0+exp(-x))",
"def sigmoid(x):\n\treturn 1 / (1 + m.exp(-x))",
"def sigmoid(x):\r\n return 1 / (1 + np.exp(-x))",
"... | [
"0.8867749",
"0.8867749",
"0.8820854",
"0.8809468",
"0.879854",
"0.87923795",
"0.8770231",
"0.87543714",
"0.8750382",
"0.87457734",
"0.8743967",
"0.8743967",
"0.8743967",
"0.8743967",
"0.8743967",
"0.8743967",
"0.874201",
"0.8739485",
"0.8728379",
"0.87266994",
"0.87216115",
... | 0.8325343 | 48 |
Returns the dot product of 2 lists >>> _mulVectors([1,2,3],[1,2,3]) 14 | def _mulVectors(X1,X2):
_checkSize(X1,X2)
return sum([ X1[i] * X2[i] for i in range(len(X1))]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dotproduct(vec1, vec2):\n return sum((a*b) for a, b in zip(vec1, vec2))",
"def dotproduct(vec1, vec2):\n import operator\n return sum(map(operator.mul, vec1, vec2))",
"def dot_product(vector1, vector2):\n return [reduce_by_multiplication(pair) for pair in zip(vector1, vector2)]",
"def dotprod... | [
"0.82830745",
"0.8274705",
"0.81603265",
"0.8138286",
"0.8128611",
"0.7960473",
"0.7894801",
"0.78153235",
"0.77994186",
"0.7692198",
"0.7660522",
"0.7660259",
"0.7646072",
"0.759312",
"0.75843084",
"0.7575049",
"0.7569205",
"0.75353223",
"0.753392",
"0.7532339",
"0.7513424",... | 0.8231128 | 2 |
Returns multiplication the scalor(S) and the list(X) >>> _scalorTimesVectors(10,[1,2,3]) [10, 20, 30] | def _scalorTimesVectors(S,X):
return [ S * x for x in X] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def matTimesVec(M, x):\n return [dot(m, x) for m in M]",
"def vecTimesMat(x, M):\n return [dot(m, x) for m in transpose(M)]",
"def scalar_mult(s, v):\n\tnewscal = [ ]\n\tfor i in range(len(v)):\n\t\tnewscal += [s * v[i]]\n\tprint(newscal)",
"def scalar_multiply(s: float, v: Vector) -> Vector:\n retu... | [
"0.71496856",
"0.64839834",
"0.64722633",
"0.6362707",
"0.6230986",
"0.6097502",
"0.6097502",
"0.60940933",
"0.60169995",
"0.59929883",
"0.59902364",
"0.59613544",
"0.5954022",
"0.59226525",
"0.5910791",
"0.5821028",
"0.5761365",
"0.5758822",
"0.5741302",
"0.5741302",
"0.5724... | 0.89016265 | 0 |
Same as _propagateInput; but applies softMax | def _propagateInputClassification(self,input):
Y,Z = self._propagateInputRegression(input)
#apply softmax function
try:
expY = [_exp(y) for y in Y]
#if the exp of the outputs starts getting too big just normalize the outputs
except Ove... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def softmax(input, dim, inplace=False):\n return FunctionLib.apply(\n 'Softmax', input.device, [input],\n outputs=[input if inplace else None], axis=dim)",
"def softmax(x):\r\n e_x = np.exp(x - np.expand_dims(np.max(x, axis=-1), axis=-1))\r\n return e_x / np.expand_dims(e_x.sum(axis=-1), a... | [
"0.7358187",
"0.733919",
"0.7335135",
"0.7213284",
"0.7121872",
"0.7059022",
"0.6995092",
"0.69889367",
"0.69882023",
"0.69850385",
"0.69782764",
"0.69782764",
"0.69633996",
"0.6953128",
"0.69064337",
"0.6903798",
"0.6893908",
"0.6893709",
"0.6890392",
"0.6884067",
"0.6876516... | 0.0 | -1 |
Returns the object as formatted machine tag string | def __str__ (self) :
return self.as_string() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return str(self.tag)",
"def __repr__(self):\n # mimic default __repr__\n T = type(self)\n module = T.__name__\n tag1 = \"<%s object at %s> \" % (module,hex(id(self)))\n\n # additional outputs\n tag2 = \"%s %s\" %(str(self.Extnum).zfill(3), se... | [
"0.7103871",
"0.6827557",
"0.6750508",
"0.66216487",
"0.65445375",
"0.6510715",
"0.64833546",
"0.6481327",
"0.64623463",
"0.6390252",
"0.6380036",
"0.63550663",
"0.6253432",
"0.6245985",
"0.62190235",
"0.618715",
"0.61832076",
"0.6156475",
"0.6152409",
"0.61367357",
"0.613614... | 0.0 | -1 |
Returns the object as formatted machine tag string | def __unicode__ (self) :
return self.as_string() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return str(self.tag)",
"def __repr__(self):\n # mimic default __repr__\n T = type(self)\n module = T.__name__\n tag1 = \"<%s object at %s> \" % (module,hex(id(self)))\n\n # additional outputs\n tag2 = \"%s %s\" %(str(self.Extnum).zfill(3), se... | [
"0.7103871",
"0.6827557",
"0.6750508",
"0.66216487",
"0.65445375",
"0.6510715",
"0.64833546",
"0.6481327",
"0.64623463",
"0.6390252",
"0.6380036",
"0.63550663",
"0.6253432",
"0.6245985",
"0.62190235",
"0.618715",
"0.61832076",
"0.6156475",
"0.6152409",
"0.61367357",
"0.613614... | 0.0 | -1 |
Returns the object as formatted machine tag string | def as_string (self) :
if self.is_machinetag() :
return "%s:%s=%s" % (self.namespace(), self.predicate(), self.value()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return str(self.tag)",
"def __repr__(self):\n # mimic default __repr__\n T = type(self)\n module = T.__name__\n tag1 = \"<%s object at %s> \" % (module,hex(id(self)))\n\n # additional outputs\n tag2 = \"%s %s\" %(str(self.Extnum).zfill(3), se... | [
"0.71001315",
"0.6824062",
"0.67462415",
"0.6617398",
"0.65402365",
"0.65108865",
"0.6480036",
"0.6478072",
"0.64599264",
"0.6386173",
"0.637718",
"0.63531446",
"0.62520564",
"0.62446433",
"0.621494",
"0.6183751",
"0.6180092",
"0.61537206",
"0.614988",
"0.61344665",
"0.613154... | 0.0 | -1 |
Return the total of additional charges. | def total_additional_charges(self) -> int:
total = 0
additional_charges = self.additional_charges
if additional_charges:
for charge in additional_charges:
total += charge['amount']
return total | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def amount(self):\n return self.subtotal + self.tax_subtotal + self.shipping",
"def charge(self):\n return sum(self.charges)",
"def total_paid(self) -> Decimal:\n return self.total_principal + self.total_interest",
"def get_total(self):\n total = 0.00\n\n for _drink in self... | [
"0.71277267",
"0.6898946",
"0.686973",
"0.68688905",
"0.6762035",
"0.67555",
"0.67554235",
"0.6713518",
"0.6709337",
"0.66825026",
"0.66805965",
"0.6660872",
"0.6645491",
"0.6633959",
"0.6617896",
"0.6608641",
"0.65867007",
"0.6585712",
"0.65786225",
"0.65693843",
"0.65225285... | 0.8809694 | 0 |
Calculate the total order price. | def _calculate_total_order_price(self, actual_order_price: int):
actual_order_price = actual_order_price if actual_order_price else 0
total_additional_charges = self.total_additional_charges
self.total_order_price = actual_order_price + total_additional_charges | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def total_price(self) -> Decimal:\n total_price: Decimal = ZERO_AMOUNT\n\n # Calculate the total price\n order_item: OrderItem\n for order_item in self.orderitem_set.all():\n total_price += order_item.total_price\n\n return total_price",
"def get_total_amount(self):\... | [
"0.83223325",
"0.82050586",
"0.7994789",
"0.7868834",
"0.7810966",
"0.7788873",
"0.7599784",
"0.75187224",
"0.745326",
"0.73647016",
"0.72929054",
"0.72782385",
"0.71961635",
"0.7182522",
"0.7109604",
"0.70727783",
"0.70621794",
"0.7007578",
"0.7005158",
"0.70008516",
"0.6957... | 0.79973507 | 2 |
Update timezone on this object. | def _timezone_observer(self, timezone):
if timezone:
self.timezone = timezone
for assignment in self.assignments:
assignment.timezone = timezone | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def timezone(self, timezone):\n\n self._timezone = timezone",
"def timezone(self, timezone):\n\n self._timezone = timezone",
"def timezone(self, timezone):\n\n self._timezone = timezone",
"def timezone(self, timezone):\n\n self._timezone = timezone",
"def timezone(self, timezone... | [
"0.7293421",
"0.7293421",
"0.7293421",
"0.7293421",
"0.7293421",
"0.7084848",
"0.6954386",
"0.68341845",
"0.67567706",
"0.6608798",
"0.650565",
"0.6438456",
"0.6384529",
"0.63625956",
"0.6343353",
"0.62989914",
"0.6144597",
"0.6111283",
"0.6052086",
"0.59976226",
"0.5967071",... | 0.67165744 | 9 |
Return a summarized version of the dict representation of this Class. Used to serialize this object within a parent object serialization. | def to_summary_dict(self) -> dict:
data = super().to_summary_dict()
return data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def serialize(self):\n data = {}\n\n for k, v in self.__dict__.items():\n if not k.startswith('__'):\n data[k] = v\n\n return data",
"def get_dict_repr(self):\n return self.__dict__",
"def dict(self):\n return self.__dict__",
"def dict(self):\n ... | [
"0.7485321",
"0.7435844",
"0.7396368",
"0.7396368",
"0.7396368",
"0.7396368",
"0.7396368",
"0.7396368",
"0.7396368",
"0.7373088",
"0.7370362",
"0.73304975",
"0.7199172",
"0.71921366",
"0.71906865",
"0.71906865",
"0.71895695",
"0.71789163",
"0.7176082",
"0.71306425",
"0.713057... | 0.73290676 | 12 |
Return a summarized version of the dict representation of this Class. Used to serialize this object within a parent object serialization. | def to_listing_dict(self) -> dict:
data = super().to_listing_dict()
return data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def serialize(self):\n data = {}\n\n for k, v in self.__dict__.items():\n if not k.startswith('__'):\n data[k] = v\n\n return data",
"def get_dict_repr(self):\n return self.__dict__",
"def dict(self):\n return self.__dict__",
"def dict(self):\n ... | [
"0.74855953",
"0.7438117",
"0.7397653",
"0.7397653",
"0.7397653",
"0.7397653",
"0.7397653",
"0.7397653",
"0.7397653",
"0.73732865",
"0.73712736",
"0.733187",
"0.73316944",
"0.7199134",
"0.7193921",
"0.71912485",
"0.71912485",
"0.71898353",
"0.7178618",
"0.7177354",
"0.7132634... | 0.0 | -1 |
Return a dict representation of this object. | def to_dict(self, excludes: list=None, includes: list=None):
data = super().to_dict(excludes=excludes, includes=includes)
data['assignments'] = []
for assignment in self.assignments:
assignment_data = assignment.to_summary_dict()
assignment_data = assignment._apply_actors... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_dict(self):\n return to_dict(self.__dict__)",
"def to_dict(self):\n return dict(self)",
"def as_dict(self):\n return self.__dict__",
"def asdict(self) -> dict:\n return self.__asdict(self)",
"def as_dict(self):\n return asdict(self)",
"def as_dict(self):\n ... | [
"0.87598675",
"0.87571734",
"0.87526554",
"0.8736366",
"0.868089",
"0.86781913",
"0.86670786",
"0.86670786",
"0.86670786",
"0.86670786",
"0.86670786",
"0.86670786",
"0.86561584",
"0.8653764",
"0.86528087",
"0.8652068",
"0.8648578",
"0.8631791",
"0.8631791",
"0.8631791",
"0.86... | 0.0 | -1 |
Returns the os_path.getsize for the file. Raises an exception if this file does not match the ContentLength stored in the metadata, or if self.data_file does not exist. | def get_data_file_size(self):
if self._is_dir:
# Directories have no size.
return 0
try:
file_size = 0
if self.data_file:
def _old_getsize():
file_size = os_path.getsize(self.data_file)
if X_CONTENT_L... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_file_size(self):\n try:\n return os.path.getsize(self.get_full_path())\n except Exception as e:\n raise SystemExit(f\"Could not complete operation: {e}\")",
"def get_file_size(self) -> int:\n return self.get_main_information()['FileSize']",
"def file_size(self... | [
"0.79786485",
"0.7814883",
"0.7777612",
"0.77536684",
"0.77322346",
"0.7623396",
"0.75644994",
"0.75169563",
"0.7512192",
"0.7489603",
"0.74549216",
"0.7409969",
"0.73295546",
"0.73295546",
"0.7328553",
"0.72921497",
"0.7287917",
"0.7287917",
"0.72554785",
"0.7225872",
"0.722... | 0.8455884 | 0 |
Convert a python datetime to DateTime. >>> import time, os >>> oldtz = os.environ['TZ'] >>> os.environ['TZ'] = 'Brazil/East' >>> time.tzset() >>> brt = gettz('Brazil/East') No timezone information, assume local timezone at the time. >>> dt2DT(datetime.datetime(2005, 11, 07, 18, 0, 0)) | def dt2DT(dt, tzname=None):
if tzname is None and dt.tzinfo is None:
# Assume local time
tz = gettz()
elif tzname is not None:
# Convert to timezone
tz = gettz(tzname)
else:
tz = None
if tz is not None:
dt = dt.replace(tzinfo=tz)
return DateTime(dt.iso... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def DT2dt(dt):\n tz = gettz(dt.timezone())\n value = datetime.datetime(dt.year(), dt.month(), dt.day(),\n dt.hour(), dt.minute(), int(dt.second()),\n int(dt.second()*1000000) % 1000000, tzinfo=tz)\n return value",
"def correct_dt_dst(datetime_obj... | [
"0.6768728",
"0.6215494",
"0.61177415",
"0.60828674",
"0.60801417",
"0.5969062",
"0.5876153",
"0.5874887",
"0.5826399",
"0.57556826",
"0.57460254",
"0.57046556",
"0.57025987",
"0.5630298",
"0.559434",
"0.5585297",
"0.5543213",
"0.5537942",
"0.5535058",
"0.55152464",
"0.546690... | 0.79371905 | 0 |
Convert a DateTime to python's datetime in UTC. | def DT2dt(dt):
tz = gettz(dt.timezone())
value = datetime.datetime(dt.year(), dt.month(), dt.day(),
dt.hour(), dt.minute(), int(dt.second()),
int(dt.second()*1000000) % 1000000, tzinfo=tz)
return value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_utc(dt):\n time_tuple = time.gmtime(time.mktime(dt.timetuple()))\n return datetime.datetime(*time_tuple[0:6])",
"def to_utc(dt):\n if dt.tzinfo is None:\n return dt.replace(tzinfo=pytz.utc)\n else:\n return dt.astimezone(pytz.utc)",
"def tz_as_utc(dt: datetime) -> datetime:\n ... | [
"0.75905657",
"0.7460992",
"0.74251246",
"0.73484915",
"0.72705597",
"0.72705597",
"0.72705597",
"0.7159778",
"0.7100077",
"0.7096452",
"0.7045675",
"0.7035341",
"0.69898105",
"0.68818486",
"0.68598443",
"0.68475384",
"0.6834485",
"0.68181765",
"0.67373836",
"0.6729912",
"0.6... | 0.0 | -1 |
Return the index if the item is present, return 1 otherwish | def get(self, item):
self._probeCount = 0
self._homeIndex = abs(self._hash(item)) % len(self._table)
distance = 1
index = self._homeIndex
while (self._table[index] != HashTable.EMPTY or \
self._table[index] == HashTable.DELETED) and \
self._table[i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_indx(self, item):\n for i, s in enumerate(self._data):\n if item in s:\n return i\n return None",
"def get_index(self, item: _T) -> int:\n if item not in self.item_to_index and self.unknown is not None:\n return self.item_to_index[self.unknown]\n ... | [
"0.78644097",
"0.76158994",
"0.7590267",
"0.74010223",
"0.73388886",
"0.730615",
"0.72583723",
"0.7257682",
"0.7204417",
"0.71522105",
"0.7140542",
"0.70622754",
"0.70417935",
"0.7019898",
"0.6964048",
"0.69144756",
"0.6903728",
"0.685975",
"0.68492013",
"0.68218356",
"0.6796... | 0.63831353 | 42 |
Saves json file constructed from some analysis results. The json will be used later to create a figure. File can be saved to an arbitrary location, but by default is saved to the current directory | def create_figure_file():
# Any plotly compliant dict or list that can be converted to json. You can use the Plotly python sdk to construct figures, by adding it to requirements.txt
fig = {"data": [{"x": ["giraffes", "orangutans", "monkeys"],
"y": [20, 14, 23],
"type":... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_to_file(data):\n\ttry:\n\t\toutput_file = open(\"output.json\", \"w\")\n\t\toutput_file.write(json.dumps(data))\n\texcept:\n\t print(Fore.GREEN + \"File not found or path is incorrect\")\n\tfinally:\n\t print(Fore.GREEN + \"Success go to output.json to look at the json\")",
"def saveFile(self, ... | [
"0.74676186",
"0.7340532",
"0.73331106",
"0.7328075",
"0.72201496",
"0.7210493",
"0.7205602",
"0.71725076",
"0.717184",
"0.71270937",
"0.70982176",
"0.70752877",
"0.706435",
"0.7041606",
"0.7031623",
"0.69831055",
"0.69801015",
"0.69684196",
"0.696613",
"0.69521713",
"0.69465... | 0.0 | -1 |
How many masters the cluster has. This normally just equals 1, but in cases where the cluster master has been destroyed this should return 0. Providers must override this property. | def num_masters(self) -> int:
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def master_count(self) -> Optional[pulumi.Input[int]]:\n return pulumi.get(self, \"master_count\")",
"def n_clusters(self):\n return len(self.clusters)",
"def num_slaves(self) -> int:\n raise NotImplementedError",
"def get_cluster_count(self) -> int:\n return len(self.get_all_clus... | [
"0.7022151",
"0.6695419",
"0.6564641",
"0.65161854",
"0.65141857",
"0.6474415",
"0.6264279",
"0.6163578",
"0.60960096",
"0.6094295",
"0.6062396",
"0.6033843",
"0.6031867",
"0.6012577",
"0.5948901",
"0.5948901",
"0.5945717",
"0.5930184",
"0.59178764",
"0.5892504",
"0.58862484"... | 0.79978013 | 0 |
How many slaves the cluster has. This is typically just len(self.slave_ips), but we need a separate property because slave IPs are not available when the cluster is stopped, and sometimes in that situation we still want to know how many slaves there are. Providers must override this property. | def num_slaves(self) -> int:
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def n_clusters(self):\n return len(self.clusters)",
"def num_masters(self) -> int:\n raise NotImplementedError",
"def num_nodes(self) -> int:\n return pulumi.get(self, \"num_nodes\")",
"def nodes(self):\n # TODO(sahid): I copied that part from legacy. That part may\n # be w... | [
"0.6956174",
"0.6842812",
"0.6730109",
"0.6670596",
"0.66681576",
"0.6590625",
"0.6556057",
"0.6464329",
"0.6440334",
"0.6435928",
"0.64263785",
"0.63495606",
"0.6342302",
"0.6342302",
"0.6342302",
"0.6342302",
"0.6342302",
"0.63227606",
"0.6318898",
"0.6315905",
"0.6314671",... | 0.85318273 | 0 |
Yield successive nsized chunks from l. | def chunks(l, n):
for i in xrange(0, len(l), n):
yield l[i:i+n] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _chunk(self, l, n):\n for i in range(0, len(l) + 1, n):\n yield l[i:i + n]",
"def chunks(self, l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]",
"def __chunks(l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]",
"def get_chunks(self, ... | [
"0.80388075",
"0.7924573",
"0.79226995",
"0.788447",
"0.7877021",
"0.781505",
"0.7764907",
"0.77549165",
"0.7743869",
"0.7731126",
"0.77281487",
"0.77241385",
"0.77024275",
"0.7688614",
"0.7688614",
"0.7663561",
"0.7656419",
"0.76552874",
"0.76552874",
"0.76452404",
"0.764524... | 0.0 | -1 |
Close the connection to the database. It is important to call this method after you are done using the DatabaseConnectionApp. In particular, if you create multiple instances of the DatabaseConnectionApp without closing them, you may run into errors where there are too many open connections to the database. | def close(self):
self.db.remove()
self.engine.dispose() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close_db_connection(cls):\n db.close()",
"def Close(self):\n l_logger.debug(\"Closing database connection\")\n self.db.close()",
"def close_database(self):\n if self._conn is not None:\n self._conn.close()\n self._conn = None",
"def close(self):\n ... | [
"0.83485955",
"0.8111377",
"0.8054819",
"0.8004254",
"0.7850042",
"0.7778653",
"0.77655923",
"0.7657",
"0.7654053",
"0.762978",
"0.75831896",
"0.75831896",
"0.75831896",
"0.75683075",
"0.75624627",
"0.75431126",
"0.75207716",
"0.7477181",
"0.74383205",
"0.740144",
"0.737922",... | 0.70698816 | 35 |
Returns the HMACHASH of 'value', using a key generated from key_salt and a secret (which defaults to settings.SECRET_KEY). A different key_salt should be passed in for every application of HMAC. | def salted_hmac(key_salt, value, secret=None):
if secret is None:
secret = settings.SECRET_KEY
key_salt = force_bytes(key_salt)
secret = force_bytes(secret)
# We need to generate a derived key from our base key. We can do this by
# passing the key_salt and our base key through a pseudo-ra... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def processor_hash(value):\r\n shared_secret = settings.CC_PROCESSOR['CyberSource'].get('SHARED_SECRET', '')\r\n hash_obj = hmac.new(shared_secret.encode('utf-8'), value.encode('utf-8'), sha1)\r\n return binascii.b2a_base64(hash_obj.digest())[:-1] # last character is a '\\n', which we don't want\r",
"d... | [
"0.68427604",
"0.6830125",
"0.63883483",
"0.63880825",
"0.611976",
"0.6026554",
"0.59682614",
"0.5881646",
"0.5830251",
"0.58141154",
"0.5790671",
"0.5789109",
"0.578052",
"0.5775786",
"0.5765492",
"0.5759221",
"0.57204187",
"0.5694122",
"0.5694122",
"0.56788504",
"0.5671105"... | 0.80568504 | 0 |
Create fake filesystem and flask app. | def create_app(self):
self.setUpPyfakefs()
self.fake_os = fake_filesystem.FakeOsModule(self.fs)
populate_fakefs(self)
app = MDFakeFSTestSite(
"MDWeb",
app_options={}
)
# Add the partials directory so we have access in the FakeFS
self.fs.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_app():\n\n # --------------------- #\n # Initial configuration #\n # --------------------- #\n\n instance_path = config.INSTANCE_PATH\n\n # Creates the instance path if it doesn't exist\n if not os.path.exists(instance_path):\n os.makedirs(instance_path)\n\n app = Flask(__nam... | [
"0.7283725",
"0.72802067",
"0.72710675",
"0.71540165",
"0.715258",
"0.71176285",
"0.7104267",
"0.70851594",
"0.70844847",
"0.70841163",
"0.7077864",
"0.7073691",
"0.7067809",
"0.7047708",
"0.70442647",
"0.7040676",
"0.70239615",
"0.7016241",
"0.6996569",
"0.6962295",
"0.69580... | 0.73683697 | 0 |
Missing content assets should be returned with a 404 status. | def test_missing_content_asset(self):
with self.app.test_client() as client:
response = client.get('/contentassets/missing_logo.png')
self.assert404(response) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def not_found(request):\n return Response(render_template('core/not_found.html'), status=404,\n mimetype='text/html')",
"def banner_not_found(self):\n self.set_status(404)\n self.write('Not found')",
"def no_file():\n return Response(\n content=byte... | [
"0.68677723",
"0.6863011",
"0.6834376",
"0.6755695",
"0.6643564",
"0.6573527",
"0.6558913",
"0.65571225",
"0.6545343",
"0.65427774",
"0.6520674",
"0.64922357",
"0.64748275",
"0.6466511",
"0.6448024",
"0.64182585",
"0.63868666",
"0.6376903",
"0.63726264",
"0.6361399",
"0.63593... | 0.80387706 | 0 |
Create fake filesystem and flask app. | def setUp(self):
self.setUpPyfakefs()
self.fake_os = fake_filesystem.FakeOsModule(self.fs)
populate_fakefs(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_app(self):\n self.setUpPyfakefs()\n self.fake_os = fake_filesystem.FakeOsModule(self.fs)\n\n populate_fakefs(self)\n\n app = MDFakeFSTestSite(\n \"MDWeb\",\n app_options={}\n )\n\n # Add the partials directory so we have access in the FakeF... | [
"0.7369482",
"0.72860086",
"0.7282669",
"0.72737354",
"0.7156784",
"0.7155232",
"0.711928",
"0.7106406",
"0.708762",
"0.7087317",
"0.70866114",
"0.7080722",
"0.7076514",
"0.70699173",
"0.7050852",
"0.70469594",
"0.7043855",
"0.702638",
"0.7018177",
"0.6999603",
"0.69648635",
... | 0.0 | -1 |
Missing content directory should raise FileExistsError. | def test_no_content_directory(self):
self.assertRaises(FileExistsError, MDFakeFSNoContentTestSite, "MDWeb") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_ensure_dir_exists(self):\n pass",
"def test_empty(self):\n self.assertFalse(os.path.exists('/'))",
"def testNoSuchDirectory(self):\n\n self.assertRaises(OSError,\n parse_package,\n \"no_such_directory\")",
"def test_nonExistentDi... | [
"0.7543506",
"0.7368105",
"0.7248981",
"0.7056842",
"0.70441145",
"0.6898858",
"0.6878514",
"0.6876698",
"0.67740375",
"0.6706945",
"0.66979283",
"0.6690011",
"0.6631263",
"0.66140795",
"0.66111237",
"0.6604554",
"0.6585691",
"0.65856755",
"0.658445",
"0.6554409",
"0.6536629"... | 0.82788646 | 0 |
This function gets the color of the center petal | def getCenterColor():
return input("What color do you want the center color to be?") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_center_color():\n center_color = input(\"What color should the center of the flower be?\")\n return center_color",
"def get_color(self):\n return self._io.last_state['color']['front-center']",
"def conseguir_color(self):\n return self.pluma.conseguir_color()",
"def getColor(self):... | [
"0.7443732",
"0.72704333",
"0.6890196",
"0.67407113",
"0.6731603",
"0.67171526",
"0.67090034",
"0.66526455",
"0.6636125",
"0.6636125",
"0.6636125",
"0.6636125",
"0.66143125",
"0.65934044",
"0.6591336",
"0.6558018",
"0.65353006",
"0.65120196",
"0.65088624",
"0.6499785",
"0.649... | 0.73833144 | 1 |
This function gets the color for each petal | def getPetalColor():
return input("What color do you want the petals to be?") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_petal_color():\n petal_color = input(\"What color should the flower petals be?\")\n return petal_color",
"def getColor(k) :\n colors = [\"#862B59\",\"#A10000\",\"#0A6308\",\"#123677\",\"#ff8100\",\"#F28686\",\"#6adf4f\",\"#58ccdd\",\"#3a3536\",\"#00ab7c\"]\n return colors[k]",
"def colors(self)... | [
"0.66976774",
"0.65681195",
"0.65080804",
"0.6335929",
"0.6334034",
"0.63315976",
"0.63271004",
"0.6270256",
"0.6201761",
"0.61972415",
"0.6196385",
"0.61886203",
"0.61886203",
"0.61739",
"0.61739",
"0.61739",
"0.61739",
"0.6152066",
"0.6144015",
"0.6127042",
"0.61138517",
... | 0.68258554 | 0 |
This function defines the turtle used for drawing the petals | def drawPetal(size, petalColor):
turtle.color(petalColor)
turtle.begin_fill()
for x in range(6):
turtle.forward(size)
turtle.left(60)
turtle.end_fill() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def draw_petal():\n turtle.forward(30)\n turtle.left(45)\n turtle.forward(30)\n turtle.left(135)\n turtle.forward(30)\n turtle.left(45)\n turtle.forward(30)\n turtle.left(135)",
"def draw_petal():\n turtle.forward(30)\n turtle.left(45)\n turtle.forward(30)\n turtle.left(135)\n... | [
"0.83980864",
"0.83980864",
"0.7732547",
"0.7442261",
"0.7235207",
"0.70870876",
"0.70790666",
"0.7029867",
"0.69549674",
"0.68823236",
"0.6854187",
"0.6842113",
"0.67714375",
"0.66764754",
"0.6663192",
"0.66429704",
"0.6600653",
"0.6566045",
"0.65505266",
"0.6541462",
"0.652... | 0.7785198 | 2 |
Return the actor representing this module in a rendering scene. | def get_actor(self):
return self.vtk_act | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def actor(self) -> vtkActor2D:\n return self.__actor",
"def getActor(self):\n raise NotImplementedError(\"\"\"The getActor method must be overridden to\n return vtkActor object.\"\"\")",
"def actor():\n return Actor()",
"def actor(self):\n raise NotImplementedError()",
"def... | [
"0.746911",
"0.73185354",
"0.6696679",
"0.6678901",
"0.6600943",
"0.6399228",
"0.61419314",
"0.6047183",
"0.60138744",
"0.5965007",
"0.5798978",
"0.5757287",
"0.56453305",
"0.5611815",
"0.5597894",
"0.5569658",
"0.55480844",
"0.545711",
"0.5453477",
"0.5453477",
"0.54482824",... | 0.7110259 | 2 |
Adjust quantiles array so that last axis labels the components of each data point. | def _process_quantiles(x, dim):
x = np.asarray(x, dtype=float)
if x.ndim == 0:
x = x[np.newaxis]
elif x.ndim == 1:
if dim == 1:
x = x[:, np.newaxis]
else:
x = x[np.newaxis, :]
return x | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def quantile_transform(X, *, axis=..., n_quantiles=..., output_distribution=..., ignore_implicit_zeros=..., subsample=..., random_state=..., copy=...):\n ...",
"def quantile_ndim(arr, quantiles):\n return pipe(\n zip(arr, quantiles),\n fmap(lambda x: np.quantile(*x, axis=-1, interpolation=\"n... | [
"0.63025475",
"0.6192949",
"0.6023752",
"0.60009724",
"0.59093165",
"0.5868786",
"0.5847202",
"0.5836669",
"0.58037055",
"0.5722725",
"0.5662372",
"0.56352705",
"0.56286263",
"0.55743194",
"0.5511481",
"0.5503057",
"0.5471478",
"0.54647976",
"0.5455615",
"0.5443686",
"0.54408... | 0.67671436 | 0 |
Create a frozen multivariate normal distribution. See `multivariate_normal_frozen` for more information. | def __call__(self, mean=None, cov=1):
return multivariate_normal_frozen(mean, cov) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self,\n mu,\n sigma,\n validate_args=False,\n allow_nan_stats=True,\n name=\"MultivariateNormalFull\"):\n parameters = locals()\n parameters.pop(\"self\")\n with ops.name_scope(name, values=[sigma]) as ns:\n cov = oper... | [
"0.5980134",
"0.5963932",
"0.59250677",
"0.59105575",
"0.5874803",
"0.58535403",
"0.583271",
"0.5821564",
"0.57510257",
"0.5748976",
"0.5745554",
"0.57115275",
"0.5700141",
"0.5696144",
"0.5679424",
"0.56625056",
"0.56391287",
"0.5637974",
"0.55918294",
"0.55470127",
"0.55365... | 0.6602165 | 0 |
Log of the multivariate normal probability density function. | def logpdf(self, x, mean, cov):
dim, mean, cov = _process_parameters(None, mean, cov)
x = _process_quantiles(x, dim)
prec_U, log_det_cov = _psd_pinv_decomposed_log_pdet(cov)
out = self._logpdf(x, mean, prec_U, log_det_cov)
return _squeeze_output(out) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def log_density_gaussian(x: torch.Tensor, mu: torch.Tensor, logvar: torch.Tensor):\n norm = -0.5 * (math.log(2 * math.pi) + logvar)\n log_density = norm - 0.5 * ((x - mu) ** 2 * torch.exp(-logvar))\n return log_density",
"def log_density_gaussian(x, mu, logvar):\n norm = - 0.5 * (math.log(2 * math.pi... | [
"0.74887073",
"0.74279535",
"0.73005456",
"0.71797556",
"0.71393716",
"0.71152455",
"0.71103704",
"0.705593",
"0.70316786",
"0.70059514",
"0.6890823",
"0.6890823",
"0.68871516",
"0.6846683",
"0.6843563",
"0.6843563",
"0.68430215",
"0.68100864",
"0.6778498",
"0.6749448",
"0.67... | 0.64847547 | 45 |
Multivariate normal probability density function. | def pdf(self, x, mean, cov):
dim, mean, cov = _process_parameters(None, mean, cov)
x = _process_quantiles(x, dim)
prec_U, log_det_cov = _psd_pinv_decomposed_log_pdet(cov)
out = np.exp(self._logpdf(x, mean, prec_U, log_det_cov))
return _squeeze_output(out) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _multivariate_gaussian(self, x, mu_k, sigma_k):\n return multivariate_normal.pdf(x, mu_k, sigma_k)",
"def multivariate_normal_density(mean, cov, X):\n \n evals, evecs = np.linalg.eigh(cov)\n cov_half_inv = evecs.dot(np.diag(evals**(-0.5))).dot(evecs.T)\n # print(evals)\n ... | [
"0.73178667",
"0.71835786",
"0.70131534",
"0.6985002",
"0.69657755",
"0.6815292",
"0.68136567",
"0.6805757",
"0.67742074",
"0.6755629",
"0.6660387",
"0.6635969",
"0.65877235",
"0.65769094",
"0.656567",
"0.656506",
"0.6548055",
"0.6519452",
"0.65179646",
"0.65038335",
"0.65034... | 0.0 | -1 |
Draw random samples from a multivariate normal distribution. | def rvs(self, mean=None, cov=1, size=1):
dim, mean, cov = _process_parameters(None, mean, cov)
out = np.random.multivariate_normal(mean, cov, size)
return _squeeze_output(out) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def draw_normal(self):\n means, scale = self.get_means_and_scales()\n return np.random.normal(means,scale,size=[self.sims,means.shape[0]]).T",
"def generate_samples(mu1,cov,number_of_samples):\n samples = np.random.multivariate_normal(mu1, cov,number_of_samples)\n return samples",
"def norm... | [
"0.7020903",
"0.6883893",
"0.6803882",
"0.6768237",
"0.67335993",
"0.6722228",
"0.671693",
"0.66195154",
"0.6615192",
"0.6601058",
"0.6599514",
"0.6582228",
"0.65699863",
"0.65699863",
"0.65699863",
"0.65699863",
"0.65699863",
"0.64762336",
"0.63881916",
"0.6337996",
"0.63127... | 0.5498338 | 93 |
Create a frozen multivariate normal distribution. | def __init__(self, mean=None, cov=1):
self.dim, self.mean, self.cov = _process_parameters(None, mean, cov)
self.prec_U, self._log_det_cov = _psd_pinv_decomposed_log_pdet(self.cov)
self._mnorm = multivariate_normal_gen() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normal(n):\n m=np.zeros((n,n))\n for i,j in itertools.product(range(n), range(n)):\n m[i][j]=normalvariate(0,1)\n return m",
"def __call__(self, mean=None, cov=1):\r\n return multivariate_normal_frozen(mean, cov)",
"def ndnormal(mus, sigmas):\n r = []\n for mu, sigma in zip(mus... | [
"0.6570486",
"0.65666693",
"0.6533315",
"0.64900917",
"0.6485892",
"0.6452156",
"0.644945",
"0.6441919",
"0.6414445",
"0.6329137",
"0.6321813",
"0.6308404",
"0.6306628",
"0.6291525",
"0.6290236",
"0.62793684",
"0.62735546",
"0.61701685",
"0.6143851",
"0.6141189",
"0.6104085",... | 0.0 | -1 |
The forward vector of the transform. Forward points along the zaxis. | def forward_vector(self):
return pm.datatypes.Vector(0, 0, 1).rotateBy(self.rotation) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_forward_vector(game_object: GameObject) -> CommonVector3:\n return CommonVector3.from_vector3(game_object.forward)",
"def forward(self):\n #print('forward\\r')\n self.linearVector = Vector3(x=1.0, y=0.0, z=0.0)\n self.angularVector = Vector3(x=0.0, y=0.0, z=0.0)",
"def forw... | [
"0.7252753",
"0.7172635",
"0.71689117",
"0.69192654",
"0.6874508",
"0.6808977",
"0.67507046",
"0.67247164",
"0.6721772",
"0.66750234",
"0.65421253",
"0.65292895",
"0.65157294",
"0.65126294",
"0.6400166",
"0.62937814",
"0.62841403",
"0.6246992",
"0.6231776",
"0.62201816",
"0.6... | 0.81256294 | 0 |
The world position of the transform. | def position(self):
return pm.datatypes.Point(self.transform.getTranslation(ws=True)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def coord(self):\r\n return self.model.coord",
"def position(self):\n return self.base_platform.position",
"def _world_point(self, point_3d):\n return self.obj.matrix_world @ point_3d",
"def getPosition(self):\n return self.ray.position",
"def get_position(self):\n return... | [
"0.71364063",
"0.70733637",
"0.7064138",
"0.70613736",
"0.70599985",
"0.7046842",
"0.70291597",
"0.70291597",
"0.6997913",
"0.6997913",
"0.6997913",
"0.695894",
"0.6940133",
"0.6940133",
"0.6940133",
"0.6933182",
"0.6933182",
"0.6923044",
"0.6920705",
"0.6920705",
"0.6920705"... | 0.7404848 | 0 |
The current rotation of the transform in euler angles. | def rotation(self):
return self.transform.getRotation() + [0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rotation_angle(self):\n return self.container['rotation_angle']",
"def rotation(self):\n return self._rotation",
"def rotation(self):\n return self._rotation",
"def rotation(self):\n return self._rotation",
"def rotation(self):\n return self._rotation",
"def rotatio... | [
"0.7925619",
"0.7917136",
"0.7917136",
"0.7917136",
"0.7917136",
"0.7917136",
"0.7917136",
"0.7917136",
"0.7917136",
"0.7917136",
"0.7917136",
"0.7917136",
"0.7850295",
"0.7700404",
"0.7644668",
"0.7376972",
"0.7244155",
"0.71309394",
"0.7129365",
"0.7068736",
"0.70530176",
... | 0.7967917 | 0 |
[up, down, left, right] num_room [1, 1] room = num_wall_moves 2[1,+1] + 4uplr room = 4 2 + 4 = 12 | def step(self, layout, action, item, item_index=None):
room_num = item // self.num_move
# print('move: ', item, room_num, self.num_move, self.out_size)
action_idx = item - room_num * self.num_move
index = action_idx if action_idx < self.num_move // 2 else action_idx // 2
sign = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wallsAndGates(self, rooms: List[List[int]]) -> None:\n if rooms==[]: return\n xcord=len(rooms)\n ycord=len(rooms[0])\n indexstack=[(i,j) for i in range(len(rooms)) for j in range(len(rooms[0])) if rooms[i][j] == 0]\n direction=[(0,1),(1,0),(0,-1),(-1,0)]\n gatenum=1\n ... | [
"0.6929311",
"0.69218886",
"0.6850273",
"0.6836812",
"0.6796616",
"0.66367865",
"0.6596703",
"0.6573686",
"0.653267",
"0.6440016",
"0.64081603",
"0.63777184",
"0.6310191",
"0.62624633",
"0.607653",
"0.6050495",
"0.5982715",
"0.59809256",
"0.5913876",
"0.5913562",
"0.58962035"... | 0.0 | -1 |
Scatter plot of data with estimates computed by norms. | def _create_data_plot(df, norms):
# plot data
ax = df.plot.scatter('x', 'y')
# plot estimates
for name, norm in norms.items():
model = sm.RLM(y, X, M=norm)
results = model.fit()
estimate = results.params
_plot_model(params=estimate,
label=name,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_scatter(data):\n minimum = data[data.columns[0]]\n distance = data[data.columns[1]]\n\n # Forms the scatterplot\n plt.scatter(minimum, distance)\n\n # Adds a title and axis names\n plt.title('Minimum vs Total distance', fontweight='bold', fontsize='large')\n plt.xlabel('Minimun Bound'... | [
"0.6694264",
"0.6283854",
"0.62149847",
"0.6201265",
"0.6131213",
"0.608715",
"0.6081281",
"0.6073397",
"0.6020319",
"0.5999375",
"0.59988016",
"0.5997095",
"0.5976106",
"0.5974476",
"0.5965404",
"0.59534806",
"0.5938065",
"0.59266406",
"0.59171295",
"0.59121144",
"0.5903311"... | 0.72779584 | 0 |
This property manage the position x of the rectangle | def x(self):
return self.__x | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_x_position(self):\n return self.rect.x",
"def get_x(self):\n return self.posX",
"def get_x(self):\n\t\treturn self._collision_rect.x + 14",
"def get_pos_x(self):\n return self.__pos_x",
"def _get_x(self):\n return self.position.x",
"def x(self):\r\n return self.posi... | [
"0.8094796",
"0.75956845",
"0.7526323",
"0.7254682",
"0.72355705",
"0.72139394",
"0.7063485",
"0.70254636",
"0.7015101",
"0.6948734",
"0.69090015",
"0.68522674",
"0.68509287",
"0.6834504",
"0.6832298",
"0.68166494",
"0.6784804",
"0.6755806",
"0.67333215",
"0.6705055",
"0.6702... | 0.0 | -1 |
This property manage the position y of the rectangle | def y(self):
return self.__y | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_y_position(self): \n return self.rect.y",
"def get_y(self):\n return self.posY",
"def y(self):\r\n return self.position.y",
"def _get_y(self):\n return self.position.y",
"def get_y(self):\n\t\treturn self._collision_rect.y + 25",
"def getYpos(self):\n return ... | [
"0.83626735",
"0.77175444",
"0.765391",
"0.76485145",
"0.75694126",
"0.7545628",
"0.7528195",
"0.7514096",
"0.74848086",
"0.74703515",
"0.73517656",
"0.73134494",
"0.7310516",
"0.72915375",
"0.7278858",
"0.727038",
"0.7263653",
"0.7227975",
"0.7227975",
"0.72180814",
"0.71732... | 0.6332691 | 92 |
This method return the str representation of the instance | def __str__(self):
name = self.__class__.__name__
id = self.id
x = self.x
y = self.y
wid = self.width
hei = self.height
return "[{}] ({}) {}/{} - {}/{}".format(name, id, x, y, wid, hei) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__ (self) :\n\n return self.as_string()",
"def __str__(self):\n return str(self.serialize())",
"def __str__(self):\n return repr(self)",
"def to_string(self):\r\n return self.__str__()",
"def __str__(self):\r\n return repr(self)",
"def __repr__(self):\n ... | [
"0.8708052",
"0.8640336",
"0.86329794",
"0.8622881",
"0.85513806",
"0.8533527",
"0.8533527",
"0.8533527",
"0.8533527",
"0.8533527",
"0.8533527",
"0.8533527",
"0.8533527",
"0.8533527",
"0.8533527",
"0.8533527",
"0.8533527",
"0.8533527",
"0.85162723",
"0.85162723",
"0.85162723"... | 0.0 | -1 |
The minimum distance between agents at which Cohesion force will continue to be applied to them. | def _getCohesionPositionThresholdForBlob(self, dataBlob):
return self._cohesionPositionThreshold_Random.valueForIntegerId(dataBlob.agentId) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_min_distance(self):\n return round(min(self.combined_euclidian_distance))",
"def potential_min(self):\n\n return self._args.min",
"def getMinimumDistancePacmanLand(self, pos):\n minD = 10000\n for p in self.ghostLandPositions:\n minD = min(minD, self.getMazeDistance(pos, p))\n ... | [
"0.70423424",
"0.6361152",
"0.63221353",
"0.6303824",
"0.61921144",
"0.6182308",
"0.6172141",
"0.6113895",
"0.6088835",
"0.60884947",
"0.6054407",
"0.60476637",
"0.5997712",
"0.5929155",
"0.59215236",
"0.5916439",
"0.590486",
"0.5880558",
"0.5872826",
"0.5848058",
"0.584319",... | 0.0 | -1 |
Convert pandas to numpy and make type 'float32'. | def translate_pandas_to_numpy(data_list:list) -> list:
list_size = len(data_list)
for i in range(list_size):
data_list[i] = data_list[i].values.astype('float32')
return data_list | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def data_convert2float32 (self, data):\r\n data = data.astype(np.float32)\r\n\r\n return data",
"def _cast_to_float64(matrix):\n return matrix.astype(np.float64) if matrix.dtype != np.float64 else matrix",
"def ts_float32(val):\n return np.float64(val)",
"def to_float32(elem):\n return... | [
"0.69673973",
"0.68146473",
"0.66961205",
"0.657789",
"0.64063495",
"0.6201809",
"0.61772823",
"0.6148752",
"0.6144046",
"0.61049205",
"0.6057269",
"0.59902483",
"0.595813",
"0.5933026",
"0.58986044",
"0.5866927",
"0.5858693",
"0.58343685",
"0.5822936",
"0.58161354",
"0.58088... | 0.7447224 | 0 |
Get SQLalchemy engine using credentials. | def get_engine(db_credentials):
url = 'postgresql://{user}:{passwd}@{host}:{port}/{db}'.format(
user=db_credentials['user'], passwd=db_credentials['pwd'], host=db_credentials['host'],
port=db_credentials['port'], db=db_credentials['db'])
engine = create_engine(url, pool_size = 50)
ret... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_database_engine() -> Engine:\n return engine",
"def get_db_engine():\n # get database connection url\n connection_url = get_db_connection_url()\n\n # Create engine from connection url\n engine = create_engine(connection_url)\n\n return engine",
"def get_engine(db_params: Dict[str, str... | [
"0.7736465",
"0.77179945",
"0.7659842",
"0.7645725",
"0.75911057",
"0.7288396",
"0.7288396",
"0.7288396",
"0.7288396",
"0.7257823",
"0.72494555",
"0.7230081",
"0.71337336",
"0.71157867",
"0.70651376",
"0.7051799",
"0.70391107",
"0.6883271",
"0.68726164",
"0.68438196",
"0.6798... | 0.8048837 | 0 |
MainWindow constructor. This widget will be our main window. We'll define all the UI components in here. | def __init__(self):
super().__init__()
# Main UI code goes here
widget = qtw.QWidget(minimumWidth=600)
self.setCentralWidget(widget)
widget.setLayout(qtw.QVBoxLayout())
self.url = qtw.QLineEdit()
self.table = qtw.QTableWidget(columnCount=2, rowCount=5)
sel... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, parent=None):\n super(MainWindow, self).__init__(parent)\n self.setupUi(self)",
"def __init__(self, parent=None):\n super(MainWindow, self).__init__(parent)\n self.setupUi(self)",
"def __init__(self, parent=None):\n super(MainWindow, self).__init__(parent)\... | [
"0.76260144",
"0.76260144",
"0.76260144",
"0.76260144",
"0.76260144",
"0.7478847",
"0.73637223",
"0.72616804",
"0.7229805",
"0.71999645",
"0.7199054",
"0.7174981",
"0.7120554",
"0.71148974",
"0.710717",
"0.7079177",
"0.702354",
"0.7003943",
"0.69791836",
"0.6962518",
"0.69221... | 0.0 | -1 |
This function returns a string with 3 decimal places, given the input x | def form2(x, pos):
return '%.2f' % x | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pretty_frac_format(x):\n\n x = x % 1\n fraction = Fraction(x).limit_denominator(8)\n if np.allclose(x, 1):\n x_str = \"0\"\n elif not np.allclose(x, float(fraction)):\n x = np.around(x, decimals=2)\n x_str = f\"{x:.3g}\"\n else:\n x_str = str(fraction)\n return x_s... | [
"0.7433454",
"0.7323446",
"0.7136587",
"0.7104594",
"0.688239",
"0.68148726",
"0.67920035",
"0.67920035",
"0.67920035",
"0.6770508",
"0.6757583",
"0.67197406",
"0.6632719",
"0.6577749",
"0.65644825",
"0.653247",
"0.65225375",
"0.64993256",
"0.6474347",
"0.6464643",
"0.6402216... | 0.6513934 | 20 |
This function returns a string with 3 decimal places, given the input x | def form5(x, pos):
return '%.7f' % x | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pretty_frac_format(x):\n\n x = x % 1\n fraction = Fraction(x).limit_denominator(8)\n if np.allclose(x, 1):\n x_str = \"0\"\n elif not np.allclose(x, float(fraction)):\n x = np.around(x, decimals=2)\n x_str = f\"{x:.3g}\"\n else:\n x_str = str(fraction)\n return x_s... | [
"0.7433174",
"0.7323813",
"0.7135859",
"0.71048325",
"0.6882904",
"0.68145263",
"0.67692286",
"0.6758125",
"0.67195195",
"0.66319686",
"0.65783006",
"0.65646285",
"0.65349853",
"0.65235424",
"0.6515146",
"0.6515146",
"0.6515146",
"0.6515146",
"0.6500868",
"0.6474393",
"0.6466... | 0.67925525 | 8 |
Creates an instance of this model from a dictionary | def from_dictionary(cls,
dictionary):
if dictionary is None:
return None
# Extract variables from the dictionary
backup_file_path = dictionary.get('backupFilePath')
excluded_file_paths = dictionary.get("excludedFilePaths")
skip_nested_volumes ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_dictionary(cls,\n dictionary):\n if dictionary is None:\n return None\n\n # Extract variables from the dictionary\n id = dictionary.get('id')\n name = dictionary.get('name')\n mtype = dictionary.get('type')\n usage_bytes = diction... | [
"0.83181584",
"0.8168118",
"0.8168118",
"0.8118749",
"0.8089047",
"0.79787344",
"0.7949278",
"0.79231393",
"0.7898951",
"0.78923255",
"0.788838",
"0.7882321",
"0.7882212",
"0.7876749",
"0.78585315",
"0.7836853",
"0.7801407",
"0.7801407",
"0.7801407",
"0.7801407",
"0.7801407",... | 0.7491968 | 85 |
Make a square gaussian kernel. size is the length of a side of the square sigma is fullwidthhalfmaximum, which can be thought of as an effective radius. | def makeGaussian(height, width, sigma=3, center=None):
x = np.arange(0, width, 1, float)
y = np.arange(0, height, 1, float)[:, np.newaxis]
if center is None:
x0 = width // 2
y0 = height // 2
else:
x0 = center[0]
y0 = center[1]
retu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gaussianKernel(size, sigma=1):\n\n colourers.info(f'Creating gaussian kernel of size {size} with sigma of {sigma}')\n size = int(size) // 2\n x, y = np.mgrid[-size:size+1, -size:size+1]\n normal = 1 / (2.0 * np.pi * sigma**2)\n g = np.exp(-((x**2 + y**2) / (2.0 * sigma ** 2))) * normal\n retu... | [
"0.77208084",
"0.7587945",
"0.7548043",
"0.7533773",
"0.7420347",
"0.7417534",
"0.7408084",
"0.7379982",
"0.7154051",
"0.71003413",
"0.70063967",
"0.6965621",
"0.6957081",
"0.6950103",
"0.693124",
"0.6929196",
"0.6927758",
"0.6864715",
"0.6797153",
"0.67613155",
"0.66919154",... | 0.62399364 | 45 |
{ pre n >= 0 post ans == 2 n return ans } | def double(n) :
if n == 0 :
ans = 0
"""{1. n == 0 premise
2. ans == 0 premise
3. ans == 2*n algebra 1 2
}"""
else :
subans = double(n - 1)
ans = subans + 2
"""{1. not(n == 0) premise
2. n >=0 premise
3. n > 0 algebra 1 2
4. subans == 2 *(n-1) premise
5. ans == subans + 2 pr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def solution2(n):\n ones = 0\n while n > 0:\n if n & 1:\n ones += 1\n n = n >> 1\n\n return 0 if ones % 2 == 0 else 1",
"def _n_choose_2(n):\n return (n * (n - 1)) // 2",
"def problem9_naive(n):\n for a in range(4, n, 4):\n for b in range(3, n - a):\n c... | [
"0.7202392",
"0.7198786",
"0.71719754",
"0.6965999",
"0.68125933",
"0.68012565",
"0.676054",
"0.67576087",
"0.6754657",
"0.6750336",
"0.67432845",
"0.6717569",
"0.66649425",
"0.65918076",
"0.65225464",
"0.6519586",
"0.6509439",
"0.6476019",
"0.64661455",
"0.6458696",
"0.64279... | 0.73465455 | 0 |
Reset the specific workspace. Remove all resources of given workspace. If workspace name is empty, the current workspace will be modified. | def ResetWorkspace(workspace_name=''):
_C.ResetWorkspace(workspace_name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ResetWorkspace(workspace_name=''):\n ResetWorkspaceCC(workspace_name)",
"def ClearWorkspace(workspace_name=''):\n _C.ClearWorkspace(workspace_name)",
"def ClearWorkspace(workspace_name=''):\n ClearWorkspaceCC(workspace_name)",
"def clear_workspace(client, workspace=None, filenames=None):\n ac... | [
"0.7912847",
"0.7576467",
"0.74971074",
"0.7385986",
"0.65266645",
"0.6210413",
"0.62101",
"0.59802896",
"0.5946357",
"0.5909171",
"0.5861294",
"0.58433056",
"0.57771504",
"0.57509047",
"0.57023746",
"0.5670598",
"0.55394864",
"0.5528475",
"0.5427279",
"0.542515",
"0.5358168"... | 0.79673105 | 0 |
Query the name represented in current workspace. | def GetTensorName(tensor):
return _C.GetTensorName(_stringify_tensor(tensor)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def workspace_name(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"workspace_name\")",
"def workspace_name(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"workspace_name\")",
"def workspace_name(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"workspace_name\")",
"... | [
"0.70040315",
"0.70040315",
"0.70040315",
"0.6709334",
"0.61963445",
"0.6164209",
"0.6080685",
"0.5957407",
"0.5957407",
"0.5957407",
"0.5957407",
"0.59215426",
"0.5820483",
"0.577272",
"0.5765387",
"0.5765387",
"0.5765387",
"0.5765387",
"0.5765387",
"0.5765387",
"0.5765387",... | 0.0 | -1 |
Constructor for the LunarAscentProblem class. | def __init__(self,
bodies: tudatpy.kernel.simulation.environment_setup.SystemOfBodies,
integrator_settings: tudatpy.kernel.simulation.propagation_setup.integrator.IntegratorSettings,
propagator_settings: tudatpy.kernel.simulation.propagation_setup.propagator.MultiTypeP... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, L, x0):\n\n # system geometry and release point\n self.L = L\n self.x0 = x0\n\n # Initializing variables for usage later\n self.passage_times = None\n self.dt = None\n self.sigma = None\n self.trajectories = []",
"def __init__(self,\n ... | [
"0.61324954",
"0.6056476",
"0.59302807",
"0.58841336",
"0.5878046",
"0.58567804",
"0.5855042",
"0.5688272",
"0.56732553",
"0.55967134",
"0.5582232",
"0.55510795",
"0.551664",
"0.55161023",
"0.5513487",
"0.5513013",
"0.54933184",
"0.54923993",
"0.5465218",
"0.5460572",
"0.5448... | 0.0 | -1 |
Constructor of the LunarAscentThrustGuidance class. | def __init__(self,
vehicle_body: str,
initial_time: float,
parameter_vector: list):
print('Initializing guidance...')
# Set arguments as attributes
self.vehicle_body = vehicle_body
self.initial_time = initial_time
self.parameter_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, strength, health, name, chance_dodge, chance_critical):\n self._health = health\n self.strength = strength\n self.name = name\n self.chance_dodge = chance_dodge\n self.chance_critical = chance_critical",
"def __init__(self):\n self.last_reward_pos = 0\... | [
"0.5866922",
"0.578728",
"0.5659223",
"0.5482749",
"0.5471003",
"0.5456738",
"0.542443",
"0.542066",
"0.5420496",
"0.5397718",
"0.5384686",
"0.5348846",
"0.5337103",
"0.53235835",
"0.5315605",
"0.5315061",
"0.5273534",
"0.52664745",
"0.5253254",
"0.5250097",
"0.52456325",
"... | 0.5683185 | 2 |
Retrieves the direction of the thrust in the inertial frame. This function is needed to get the thrust direction at each time step of the propagation, based on the thrust parameters provided. | def get_current_thrust_direction(self,
time: float) -> np.array:
# Interpolate with time
angle = self.thrust_angle_interpolator.interpolate(time)
# Set thrust in vertical frame and transpose it
thrust_direction_vertical_frame = np.array([[0, np.sin(an... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_direction(event):\n return event['result']['parameters']['direction']",
"def get_direction(self):\n return self.actual_coordinates[2]",
"def _thruster_hfp(motions: Dict[str, float]) -> int:\n surge, yaw, sway = motions[\"surge\"], motions[\"yaw\"], motions[\"sway\"]\n\n if surge... | [
"0.6276446",
"0.62155247",
"0.61864215",
"0.6178044",
"0.6138319",
"0.6135835",
"0.60697466",
"0.5979209",
"0.5959194",
"0.5931907",
"0.5920144",
"0.5917349",
"0.58839804",
"0.5832741",
"0.58262116",
"0.58082557",
"0.57814956",
"0.5746605",
"0.5733347",
"0.5724613",
"0.572043... | 0.72050625 | 0 |
Retrieves the magnitude of the thrust. This function is needed to get the thrust magnitude at each time step of the propagation, based on the thrust parameters provided. Currently, the thrust magnitude is constant. | def get_current_thrust_magnitude(self,
time: float) -> float:
return self.thrust_magnitude | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def magnitude(self):\n\t\treturn sqrt(self.dot(self))",
"def magnitude(self): # @todo @caution check: something wrong?\n\n return (math.sqrt(reduce(lambda x, y: x+y,\n [x**2 for x in self.vector])))",
"def get_magnitude(\n self, model_param: Dict[str, Union[float, List[float]]], sy... | [
"0.6589054",
"0.6449668",
"0.6295594",
"0.6244629",
"0.61431277",
"0.60655814",
"0.5956749",
"0.5948759",
"0.5948759",
"0.59411794",
"0.59407496",
"0.58943164",
"0.5869348",
"0.5860517",
"0.5852178",
"0.5830699",
"0.58281964",
"0.5708337",
"0.5698168",
"0.56786996",
"0.567739... | 0.72145724 | 0 |
Creates the thrust acceleration models from the LunarAscentThrustGuidance class and sets it in the propagator. | def get_thrust_acceleration_model_from_parameters(thrust_parameters: list,
bodies: tudatpy.kernel.simulation.environment_setup.SystemOfBodies,
initial_time: float,
specif... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self,\n vehicle_body: str,\n initial_time: float,\n parameter_vector: list):\n print('Initializing guidance...')\n # Set arguments as attributes\n self.vehicle_body = vehicle_body\n self.initial_time = initial_time\n se... | [
"0.52007926",
"0.5141271",
"0.5138577",
"0.5121363",
"0.5010593",
"0.49965638",
"0.48912236",
"0.48764595",
"0.48609746",
"0.48241824",
"0.47785723",
"0.47368607",
"0.47321242",
"0.4723249",
"0.47230604",
"0.47143203",
"0.4707249",
"0.47051737",
"0.46981522",
"0.46902364",
"0... | 0.60445714 | 0 |
Merge two RGB tuples. | def _merge_rgb(self, rgb1, rgb2):
r1, g1, b1 = self._int_to_bin(rgb1)
r2, g2, b2 = self._int_to_bin(rgb2)
rgb = r1[:4] + r2[:4], g1[:4] + g2[:4], b1[:4] + b2[:4]
return self._bin_to_int(rgb) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def combine_color(red, green, blue):\r\n\r\n return (red << 16) + (green << 8) + blue",
"def _binary_to_rgb(*args) -> tuple:\n if len(args) == 1:\n red = args[0][0]\n green = args[0][1]\n blue = args[0][2]\n elif len(args) == 3:\n red = args[0]\n ... | [
"0.73768806",
"0.68605113",
"0.6847478",
"0.68040514",
"0.6661399",
"0.66047245",
"0.65366215",
"0.6488804",
"0.6323478",
"0.6275577",
"0.62141013",
"0.6177352",
"0.6173669",
"0.61694735",
"0.61416996",
"0.6086507",
"0.60767424",
"0.6075502",
"0.6049484",
"0.6035401",
"0.5995... | 0.7531862 | 0 |
Convert kelvin to celcius. | def kelvin_2_celsius(x):
return x - 273.15 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def kelvin_to_celsius(temp):\n return temp - 273.15",
"def kelvinToCelcius(kelvin:float, ndigits = 2)->float:\n return round(float(kelvin) - 273.15, ndigits)",
"def celciusToKelvin(celcius: float, ndigits: int = 2)->float:\n return round(float(celcius) + 273.15, ndigits)",
"def GetKelvin(self):\n ... | [
"0.7975438",
"0.7551087",
"0.74725723",
"0.7458292",
"0.72936654",
"0.726419",
"0.7131983",
"0.70970404",
"0.70707303",
"0.70591885",
"0.70378",
"0.70239884",
"0.69731575",
"0.69647515",
"0.6919803",
"0.69033015",
"0.6843504",
"0.68306845",
"0.68278277",
"0.6819296",
"0.67487... | 0.7150101 | 6 |
Convert celcius to kelvin. | def celcius_2_kelvin(x):
return x + 273.15 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def celciusToKelvin(celcius: float, ndigits: int = 2)->float:\n return round(float(celcius) + 273.15, ndigits)",
"def kelvin_to_celsius(temp):\n return temp - 273.15",
"def GetKelvin(self):\n return self.GetCelcius() + 273.15",
"def degc_to_kelvin(x):\r\n return x + 273.15",
"def kelvinToCe... | [
"0.8163538",
"0.7870752",
"0.7769568",
"0.77016866",
"0.7505873",
"0.7443697",
"0.7409282",
"0.72250664",
"0.7189411",
"0.70492774",
"0.70453554",
"0.70422643",
"0.700724",
"0.68513936",
"0.68371665",
"0.6765495",
"0.674363",
"0.66032785",
"0.65952694",
"0.6576273",
"0.657041... | 0.69416314 | 13 |
Make sure that a long past date returns the appropriate error | def test_validate_date_entry_returns_correct_outOfBounds_if_past(self):
date_string = "1899-12-12"
date_format = settings.DATE_FORMATS['iso 8601']
error_string = "dates before {} are not permitted"
date_fmt = "%Y-%m-%d"
earliest_date = self.menu.OPTIONS['earliest allowed date']
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_validate_date_entry_returns_correct_outOfBounds_if_future(self):\n date_string = \"3018-01-21\"\n date_format = settings.DATE_FORMATS['iso 8601']\n\n error_text = \"dates in the future are not permitted\"\n\n result = self.menu.validate_date_entry(date_string, date_format)\n\n ... | [
"0.7094028",
"0.6902343",
"0.68786925",
"0.68729395",
"0.68215626",
"0.67192334",
"0.66143703",
"0.65506846",
"0.64799225",
"0.6477162",
"0.6331963",
"0.6301461",
"0.6246241",
"0.6240586",
"0.623969",
"0.62263966",
"0.619837",
"0.6161011",
"0.61141735",
"0.6074533",
"0.607448... | 0.73237896 | 0 |
Maximum input length supported by the encoder. | def max_positions(self):
return int(1e5) # an arbitrary large number | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_length(self) -> int | None:\n return self._underlying.max_length",
"def max_length(self):\n\t\treturn self._max_length",
"def _max_length(self):\n return self.__max_length",
"def max_size(self):\n raise NotImplementedError()",
"def len_max(self):\n return 16 + 16 + 8 + 8... | [
"0.79915965",
"0.7968504",
"0.7859362",
"0.7662151",
"0.7648042",
"0.7555859",
"0.74178326",
"0.74056953",
"0.73354554",
"0.7186268",
"0.71812737",
"0.7144131",
"0.7108449",
"0.7098418",
"0.70634687",
"0.7029977",
"0.7007656",
"0.69750416",
"0.69667345",
"0.69460034",
"0.6946... | 0.0 | -1 |
Similar to forward but only return features. | def extract_features(
self, prev_output_tokens, encoder_out, incremental_state=None
):
encoder_padding_mask = encoder_out['encoder_padding_mask']
encoder_out = encoder_out['encoder_out']
if incremental_state is not None:
prev_output_tokens = prev_output_tokens[:, -1:]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def forward(self, x):\n x = self.features(x)\n return x",
"def forward(self, x):\n out = self.features(x)\n out = out.view(out.size(0), -1)\n out = self.classifier(out)\n return out",
"def feature_forward(self, x):\n raise NotImplementedError",
"def forward(se... | [
"0.79685736",
"0.76057374",
"0.75061923",
"0.74989",
"0.7416604",
"0.7416604",
"0.72430384",
"0.72430384",
"0.72344655",
"0.708826",
"0.7087115",
"0.7075663",
"0.7028135",
"0.702447",
"0.70182985",
"0.69833726",
"0.69588363",
"0.6944338",
"0.6908374",
"0.68244886",
"0.6801439... | 0.0 | -1 |
Maximum output length supported by the decoder. | def max_positions(self):
return int(1e5) # an arbitrary large number | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def len_max(self):\n return 16 + 16 + 8 + 8 + Tools.bin_to_dec(self.get_data_size()) + Tools.bin_to_dec(self.get_verification_size())",
"def setMaxOutputLength(self, value):\n return self._set(maxOutputLength=value)",
"def setMaxOutputLength(self, value):\n return self._set(maxOutputLength... | [
"0.7432182",
"0.739371",
"0.739371",
"0.739371",
"0.7161702",
"0.7145069",
"0.701258",
"0.696493",
"0.6954823",
"0.6929437",
"0.68695945",
"0.68547714",
"0.68416184",
"0.6839447",
"0.6802614",
"0.67819893",
"0.67704797",
"0.6759785",
"0.67525315",
"0.67486465",
"0.6746449",
... | 0.0 | -1 |
View function for home page of site. | def index(request):
photos = Image.objects.all().order_by('-created')
no_of_photos = Image.objects.all().count()
context = {"photos": photos, 'no_of_photos': no_of_photos}
return render(request, 'photo/index.html', context=context) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def home(request):\n\treturn render(request, \"compta/home.html\")",
"def home_page(request):\r\n return render(request, 'ez_main/home_page.html')",
"def home(request):\r\n return render(request, 'home.html')",
"def homepage(request):\n\treturn render(request, 'core/homepage.html')",
"def homepage(req... | [
"0.8493426",
"0.84268916",
"0.83415145",
"0.83306193",
"0.82976943",
"0.8295291",
"0.8276345",
"0.82545686",
"0.82155704",
"0.8132563",
"0.81246215",
"0.81224865",
"0.8121264",
"0.81049734",
"0.8098485",
"0.80935514",
"0.80935514",
"0.80935514",
"0.80935514",
"0.80935514",
"0... | 0.0 | -1 |
Initializes the engine instance. Engine can be prebuilt, offering evaluation based on a particular JSON backend, or can be dynamic, building new logical components with each call. | def __init__(self, json=None, verbose=True):
self.verbose = verbose
if json:
self.composite_ = self.build_engine_from_json(json=json, verbose=verbose)
self.prebuilt_ = True
else:
self.prebuilt_ = False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _initialize_engine(self, engine: ExecutionEngine) -> None:\n _logger.debug('Middleware %r initialized with engine: %r', self, engine)",
"def __init__(self):\n self._workload = None\n self._engine = Engine()",
"def __init__(self, properties):\n super(Engine, self).__init__(self, ... | [
"0.66388524",
"0.6585366",
"0.6562431",
"0.6463608",
"0.6374987",
"0.6249574",
"0.6196951",
"0.6192912",
"0.6187051",
"0.61233556",
"0.60304344",
"0.5985679",
"0.5963483",
"0.5952134",
"0.5951983",
"0.59495527",
"0.5946662",
"0.5886087",
"0.5871995",
"0.5870233",
"0.58693796"... | 0.6635185 | 1 |
Return Gaussian with given parameters. y = ampl exp(4ln2 (xx0)^2 / fwhm^2) | def gaussian(x, x0=0.0, fwhm=1.0, ampl=1.0):
return ampl * np.exp(-4 * np.log(2) * ((x - x0) / fwhm) ** 2) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gaussian(amp, fwhm, mean, x):\n return amp * np.exp(-4. * np.log(2) * (x-mean)**2 / fwhm**2)",
"def gaussian(x, y, params):\n\n n = len(x)\n mix = np.zeros((n,))\n\n ex = (((x - params[0])**2) / (2.*params[2]**2))\n ey = (((y - params[1])**2) / (2.*params[2]**2))\n mix =... | [
"0.7207542",
"0.7046463",
"0.7029399",
"0.69889027",
"0.6976326",
"0.69592756",
"0.6916646",
"0.6903662",
"0.67467546",
"0.67467546",
"0.6703264",
"0.66944724",
"0.6617395",
"0.65959877",
"0.6550076",
"0.6439049",
"0.643874",
"0.64093244",
"0.6390287",
"0.63803816",
"0.637799... | 0.72723794 | 0 |
Return PseudoVoigt with given parameters. y = frac gaussian(x, x0, fwhm) + (1frac) lorentzian(x, x0, fwhm) | def pseudovoigt(x, x0=0.0, fwhm=1.0, ampl=1.0, frac=0.5):
if not 0 <= frac <= 1:
raise ValueError("frac must be 0 <= frac <= 1")
return frac * gaussian(x, x0, fwhm, ampl) + (1 - frac) * lorentzian(
x, x0, fwhm, ampl
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def psVoigt(self, X, xm, amp, w, m):\n return m * self.lorentz(X, xm, amp, w) + (1-m) * self.gauss(X, xm, amp, w)",
"def _Voigt(self, x, g_fwhm, l_fwhm, semi_amp=1, center=0.0):\n\t sigma = g_fwhm / np.sqrt(2.0 * np.log(2.0))\n\n\t return semi_amp * np.real(wofz(((x-center) + 1j*l_fwhm)/(sigma*np.sq... | [
"0.66173494",
"0.6532243",
"0.6532243",
"0.65070736",
"0.63796264",
"0.63131636",
"0.5970286",
"0.5865352",
"0.57675654",
"0.56898254",
"0.56426466",
"0.5603627",
"0.56001973",
"0.55570996",
"0.5538157",
"0.55278784",
"0.55265105",
"0.5526035",
"0.551107",
"0.55082554",
"0.54... | 0.7046958 | 0 |
Sets the merchant_id of this PortfolioIdDelResponsePortfolioItem. | def merchant_id(self, merchant_id):
if merchant_id is None:
raise ValueError("Invalid value for `merchant_id`, must not be `None`") # noqa: E501
self._merchant_id = merchant_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def merchant_id(self, merchant_id):\n\n self._merchant_id = merchant_id",
"def set_merchant_transaction_id(self, transaction_id):\n self.merchant_transaction_id = transaction_id",
"def merchant(self, merchant):\n if merchant is None:\n raise ValueError(\"Invalid value for `merch... | [
"0.73929584",
"0.64807767",
"0.6163476",
"0.5330709",
"0.520684",
"0.51950353",
"0.5121377",
"0.5108566",
"0.5025775",
"0.49855316",
"0.49788147",
"0.4882717",
"0.48812652",
"0.47672012",
"0.47672012",
"0.4712832",
"0.47085887",
"0.4706784",
"0.45794812",
"0.45793927",
"0.453... | 0.7136936 | 1 |
Sets the action of this PortfolioIdDelResponsePortfolioItem. | def action(self, action):
if action is None:
raise ValueError("Invalid value for `action`, must not be `None`") # noqa: E501
self._action = action | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def action(self, action):\n allowed_values = [\"DELETE\", \"NONE\"]\n if action not in allowed_values:\n raise ValueError(\n \"Invalid value for `action` ({0}), must be one of {1}\"\n .format(action, allowed_values)\n )\n\n self._action = act... | [
"0.5731511",
"0.53748775",
"0.5340105",
"0.5171771",
"0.5158516",
"0.5158516",
"0.5101424",
"0.5101424",
"0.5101424",
"0.5101424",
"0.5101424",
"0.5101424",
"0.5064165",
"0.506325",
"0.50008786",
"0.4998791",
"0.49634352",
"0.49520066",
"0.49461424",
"0.49049285",
"0.49030674... | 0.500939 | 14 |
Sets the gain_loss_dollars of this PortfolioIdDelResponsePortfolioItem. | def gain_loss_dollars(self, gain_loss_dollars):
if gain_loss_dollars is None:
raise ValueError("Invalid value for `gain_loss_dollars`, must not be `None`") # noqa: E501
self._gain_loss_dollars = gain_loss_dollars | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gain_loss_percentage(self, gain_loss_percentage):\n if gain_loss_percentage is None:\n raise ValueError(\"Invalid value for `gain_loss_percentage`, must not be `None`\") # noqa: E501\n\n self._gain_loss_percentage = gain_loss_percentage",
"def net_gain_loss_percentage():\n try:\n... | [
"0.5793073",
"0.5137945",
"0.51288927",
"0.5122116",
"0.5091791",
"0.5090042",
"0.5010013",
"0.5008859",
"0.49376446",
"0.48808986",
"0.4873786",
"0.48318732",
"0.47404653",
"0.47381547",
"0.4724406",
"0.4718258",
"0.4714019",
"0.47136298",
"0.46992344",
"0.46863592",
"0.4679... | 0.78395325 | 0 |
Sets the matched_state of this PortfolioIdDelResponsePortfolioItem. | def matched_state(self, matched_state):
if matched_state is None:
raise ValueError("Invalid value for `matched_state`, must not be `None`") # noqa: E501
self._matched_state = matched_state | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def match_id(self, match_id):\n\n self._match_id = match_id",
"def end_match(self, match_id):\n\n query = sC.DELETE_FROM_MATCHES_WHERE_ID_.format(match_id)\n\n self.execute_query(query)",
"def match_score(self, match_score):\n\n self._match_score = match_score",
"def __eq__(self, ... | [
"0.55045295",
"0.4942588",
"0.47066778",
"0.45807734",
"0.44554827",
"0.44428295",
"0.4417907",
"0.44098243",
"0.43942627",
"0.4361584",
"0.4319382",
"0.4285123",
"0.4285123",
"0.4265278",
"0.42546338",
"0.42480204",
"0.41545513",
"0.40974647",
"0.40938342",
"0.40886122",
"0.... | 0.5878933 | 0 |
Sets the purchase_date of this PortfolioIdDelResponsePortfolioItem. | def purchase_date(self, purchase_date):
if purchase_date is None:
raise ValueError("Invalid value for `purchase_date`, must not be `None`") # noqa: E501
self._purchase_date = purchase_date | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decommission_date(self, decommission_date):\n\n self._decommission_date = decommission_date",
"def purchase_date_time(self, purchase_date_time):\n if purchase_date_time is None:\n raise ValueError(\"Invalid value for `purchase_date_time`, must not be `None`\") # noqa: E501\n\n ... | [
"0.63222677",
"0.6139121",
"0.5844685",
"0.5730579",
"0.5730579",
"0.5561338",
"0.5561338",
"0.5525089",
"0.54284245",
"0.53899187",
"0.5386058",
"0.5380716",
"0.525117",
"0.52415365",
"0.5234184",
"0.52250683",
"0.52171373",
"0.52097356",
"0.52097356",
"0.52097356",
"0.52097... | 0.6780696 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, PortfolioIdDelResponsePortfolioItem):
return False
return self.__dict__ == other.__dict__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.84568954",
"0.83923674",
"0.81447554",
"0.81407183",
"0.81326675",
"0.80941343",
"0.8092415",
"0.8092415",
"0.8092415",
"0.8085536",
"0.8085536",
"0.8076502",
"0.8076502",
"0.8066026"
] | 0.0 | -1 |
Verify if a hash was generated by the password specified. | def verify_password(password, hash):
method = get_hash_algorithm(flask.current_app.config['HASH_ALGORITHM'])
return method.verify(password, hash) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def verify_password(self, hash, password):\r\n try:\r\n PasswordHasher().verify(hash, password)\r\n return True\r\n except:\r\n return False",
"def verify_password(self, password):\n return check_password_hash(self.password_hash, password)",
"def verify_passwor... | [
"0.81317127",
"0.79918575",
"0.7902963",
"0.78909004",
"0.76872784",
"0.7662686",
"0.76172304",
"0.76172304",
"0.76172304",
"0.76172304",
"0.76172304",
"0.76172304",
"0.76172304",
"0.7615896",
"0.7593239",
"0.75342226",
"0.75163007",
"0.7505962",
"0.7487259",
"0.7478594",
"0.... | 0.7885568 | 4 |
Test different shapes of input tensor. Mainly test different combinations of num_rows and num_cols. | def testDifferentTensorShapes(self):
pseudo_random = True
overlapping = True
for num_batches in [1, 3]:
for num_channels in [1, 3]:
for num_rows in [10, 20, 50]:
for num_cols in [10, 20, 50]:
tensor_shape = (num_batches, num_rows, num_cols, num_channels)
# ran... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _check_tensor_shapes(tensors):\n for tensor in tensors:\n tensor = tf.convert_to_tensor(value=tensor)\n tensor.get_shape().assert_has_rank(2)\n tensor.get_shape().assert_is_compatible_with(\n tf.convert_to_tensor(value=tensors[0]).get_shape())",
"def testFunction(self, input_shape, stride, k... | [
"0.6771283",
"0.6623845",
"0.65825635",
"0.63006365",
"0.6260925",
"0.62579334",
"0.6221797",
"0.62022156",
"0.6196459",
"0.61783963",
"0.61779076",
"0.61761034",
"0.6161502",
"0.61502683",
"0.6134124",
"0.6133079",
"0.60900277",
"0.60828644",
"0.60824025",
"0.60597074",
"0.6... | 0.65125096 | 3 |
Generate 'unique' random input tensor. 'Unique' means there's no collision values in the tensor, all elements are different. This is done by generating sequence of integers with step of 1 and then randomly shuffle these integers. | def _GenerateUniqueRandomInputTensor(self, shape):
num_elements = 1
for size in shape:
num_elements *= size
x = np.arange(num_elements, dtype=np.float32)
self._PRNG.shuffle(x)
return x.reshape(shape) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def flat_shuffle(tensor):\n shape_ = tensor.size()\n flat_tensor = tensor.view(-1)\n shuffled_flat_tensor = shuffle(flat_tensor)\n return shuffled_flat_tensor.view(shape_)",
"def generate_n_u(t):\n return np.unique(t, return_counts=True)[1]",
"def randu(*shape):\n # ATTENTION: whether you use... | [
"0.6420911",
"0.60496885",
"0.6042057",
"0.5988617",
"0.59506536",
"0.594913",
"0.59193707",
"0.5886433",
"0.5855505",
"0.58377117",
"0.57327443",
"0.5690145",
"0.56138015",
"0.55772686",
"0.5569318",
"0.55650306",
"0.55511075",
"0.5549563",
"0.55375504",
"0.55340195",
"0.553... | 0.77469957 | 0 |
Sets the id of this IncidentTemplate. | def id(self, id):
self._id = id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_id(self, id_):\n\n self.id_ = id_",
"def set_id(self, id):\n self.__id = id",
"def set_id(self, id):\n self.data['id'] = id",
"def SetId(self, id):\n self.id = int(id)",
"def set_id(self, id_=None):\n if id_ is None:\n self.id = id(self)\n else:\... | [
"0.74246585",
"0.7320574",
"0.72728455",
"0.7267677",
"0.69741964",
"0.6881379",
"0.6881379",
"0.6881379",
"0.6881379",
"0.6881379",
"0.68786645",
"0.6867626",
"0.6867626",
"0.6867626",
"0.6867626",
"0.6867626",
"0.6867626",
"0.6867626",
"0.6867626",
"0.6867626",
"0.6867626",... | 0.6768028 | 91 |
Sets the name of this IncidentTemplate. | def name(self, name):
self._name = name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_name(self, name):\n self._name = name",
"def set_name(self, name):\n\t\tself.name_ = name",
"def set_name(self, name):\n self.name = name",
"def set_name(self, name):\n self.name = name",
"def set_name(self, name):\n self.name = name",
"def set_name(self, name):\n ... | [
"0.74746394",
"0.7455473",
"0.7415756",
"0.7415756",
"0.7415756",
"0.7415756",
"0.7415756",
"0.7407989",
"0.7381878",
"0.7332634",
"0.7332634",
"0.73285013",
"0.7325056",
"0.722092",
"0.72113734",
"0.71872854",
"0.71872854",
"0.71872854",
"0.71872854",
"0.71872854",
"0.718728... | 0.71173644 | 100 |
Sets the group_id of this IncidentTemplate. | def group_id(self, group_id):
self._group_id = group_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def group_identifier(self, group_identifier):\n\n self._group_identifier = group_identifier",
"def group_id(self, group_id: int):\n if group_id is None:\n raise ValueError(\"Invalid value for `group_id`, must not be `None`\") # noqa: E501\n\n self._group_id = group_id",
"def se... | [
"0.7230241",
"0.70719296",
"0.70546216",
"0.701649",
"0.7008788",
"0.69496334",
"0.6833594",
"0.6792657",
"0.67621565",
"0.67583644",
"0.672879",
"0.672879",
"0.672879",
"0.66904974",
"0.66486627",
"0.6630525",
"0.65959513",
"0.6466996",
"0.6443987",
"0.6428352",
"0.63432276"... | 0.80219275 | 3 |
Sets the update_status of this IncidentTemplate. | def update_status(self, update_status):
allowed_values = ["investigating", "identified", "monitoring", "resolved", "scheduled", "in_progress", "verifying", "completed"] # noqa: E501
if self.local_vars_configuration.client_side_validation and update_status not in allowed_values: # noqa: E501
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(__self__, *,\n update_status: str):\n pulumi.set(__self__, \"update_status\", update_status)",
"def updateStatus(self, status):\n pass",
"def UpdateStatus(self, status):\r\n self.status.update(status)",
"def status(self, status):\n self._status = status",
... | [
"0.68230754",
"0.65792245",
"0.6313056",
"0.60260785",
"0.60260785",
"0.60260785",
"0.60260785",
"0.60260785",
"0.60260785",
"0.60260785",
"0.60099053",
"0.60099053",
"0.60099053",
"0.60099053",
"0.60099053",
"0.60099053",
"0.60099053",
"0.60099053",
"0.60099053",
"0.60099053",... | 0.7377901 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, IncidentTemplate):
return False
return self.to_dict() == other.to_dict() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.808826",
"0.808826",
"0.8054592",
"0.79827315",
"0.79666996",
"0.79666996",
"0.79666996",
"0.79666996",
"0.79666996",
"0.79666996",
"0.79666996",
"0.79666996",
"0.79666996",
"0.79666996",
"0.79666996",
"0.79666996",
"0.79666996",
"0.79666996",
"0.79666996",
"0.79666996",
"... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
if not isinstance(other, IncidentTemplate):
return True
return self.to_dict() != other.to_dict() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.8456082",
"0.83912885",
"0.81436425",
"0.81406975",
"0.8131807",
"0.8093013",
"0.80912536",
"0.80912536",
"0.80912536",
"0.8084505",
"0.8084505",
"0.8075543",
"0.8075543",
"0.8065009",
"0.80417395",
"0.80417395",
"0.80417395",
"0.80417395",
"0.80417395",
"0.80417395",
"0.8... | 0.0 | -1 |
generate CNN model given input size, channels, kernel_sizes and strides | def cnn(channels=(4, 16, 32), kernel_sizes=(8, 4), strides=(4, 2), in_size=84):
cnn_layers = []
output_size = in_size
for i in range(len(channels)-1):
in_channels, out_channels = channels[i], channels[i+1]
kernel_size, stride = kernel_sizes[i], strides[i]
conv = nn.Conv2d(in_channel... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def conv(c_in, c_out, k_size, stride=2, pad=1, bn=True):\n layers = []\n layers.append(nn.Conv2d(c_in, c_out, k_size, stride, pad, bias=True)) # bias=False\n if bn:\n layers.append(nn.BatchNorm2d(c_out))\n return nn.Sequential(*layers)",
"def conv(in_channels, out_channels, kernel_size, strid... | [
"0.71356314",
"0.70517457",
"0.7017613",
"0.7017011",
"0.69211715",
"0.69066066",
"0.6898658",
"0.6889347",
"0.6887702",
"0.6880089",
"0.68388766",
"0.6814131",
"0.6803217",
"0.67275405",
"0.6720525",
"0.669974",
"0.6673476",
"0.66316533",
"0.66260815",
"0.6616506",
"0.658491... | 0.78787047 | 0 |
Calculates the Hausdorff's distance [HD]_ of two needles. Both needles are truncated to start and end at the same slices. | def hausdorffDistance(self,id1,id2):
#productive #math
profprint()
node1 = slicer.mrmlScene.GetNodeByID(id1)
polydata1=node1.GetPolyData()
node2 = slicer.mrmlScene.GetNodeByID(id2)
polydata2=node2.GetPolyData()
nb1 = polydata1.GetNumberOfPoints()
nb2 = polydata2.GetNumberOfPoints()
m... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Hausdorff_distance(clust1, clust2, forward, dir):\n if forward == None:\n return max(Hausdorff_distance(clust1,clust2,True,dir),Hausdorff_distance(clust1,clust2,False,dir))\n else:\n clstart, clend = (clust1,clust2) if forward else (clust2,clust1)\n dx, dy = dir if forward else (-dir[0],-dir[1])\n return s... | [
"0.6701674",
"0.663564",
"0.6625377",
"0.65434706",
"0.6493009",
"0.6417718",
"0.63626313",
"0.6325076",
"0.63013965",
"0.62799823",
"0.6230968",
"0.617653",
"0.6169091",
"0.61599636",
"0.6097466",
"0.607543",
"0.60736144",
"0.6060494",
"0.5937603",
"0.59173405",
"0.5889318",... | 0.61212635 | 14 |
Returns the axial distance between the tip of two needles | def distTip(self,id1,id2):
#productive #math
profprint()
node = slicer.mrmlScene.GetNodeByID('vtkMRMLModelNode'+str(id1))
polydata=node.GetPolyData()
node2 = slicer.mrmlScene.GetNodeByID('vtkMRMLModelNode'+str(id2))
polydata2=node2.GetPolyData()
p,pbis=[0,0,0],[0,0,0]
p2=[0,0,0]
p2bi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dist(x, y):\n dx = x[0] - y[0]\n dy = x[1] - y[1]\n ans = dx**2 + dy**2\n ans = ans**(0.5)\n return ans",
"def dist(x, y):\n dx = x[0] - y[0]\n dy = x[1] - y[1]\n ans = dx**2 + dy**2\n ans =... | [
"0.7024393",
"0.7010588",
"0.6866394",
"0.68190604",
"0.6804195",
"0.67529464",
"0.6703184",
"0.66527224",
"0.6644499",
"0.66429156",
"0.6597854",
"0.659407",
"0.6588388",
"0.6574123",
"0.655004",
"0.6519588",
"0.6510772",
"0.6495006",
"0.6483284",
"0.64808416",
"0.64763665",... | 0.0 | -1 |
Get a Qt bold font ??? Used? | def getBoldFont( self ):
#obsolete?
profbox()
boldFont = qt.QFont( "Sans Serif", 12, qt.QFont.Bold )
return boldFont | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getBoldFont(self):\r\n # obsolete?\r\n profbox()\r\n boldFont = qt.QFont(\"Sans Serif\", 12, qt.QFont.Bold)\r\n return boldFont",
"def asBold(self):\n\t\treturn TextFont( self.name[0:2]+'B', self.size)",
"def get_default_font(bold=False):\n font = _QFont()\n font.setPointSize(FONT_SIZE)\n... | [
"0.8531085",
"0.7381077",
"0.7377874",
"0.7046928",
"0.6864032",
"0.6863521",
"0.6856567",
"0.6822501",
"0.6730293",
"0.66376287",
"0.66372424",
"0.65659153",
"0.65659153",
"0.65618026",
"0.65618026",
"0.65618026",
"0.6469601",
"0.6365785",
"0.634718",
"0.6324098",
"0.6310631... | 0.8658464 | 0 |
This data source provides the Vpc Peer Connections of the current Alibaba Cloud user. | def get_peer_connections(ids: Optional[Sequence[str]] = None,
name_regex: Optional[str] = None,
output_file: Optional[str] = None,
peer_connection_name: Optional[str] = None,
status: Optional[str] = None,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_connections(self):\r\n return users.UserConnections(self)",
"def getConnectionsBetweenSuperPeers(self):\r\n raise NotImplementedError()",
"def peer_list_all(self):\n return self.client.call('GET', self.name + 'peer-list/all')",
"def list_conns(self):\n\t\tres = []\n\t\tself.AL.a... | [
"0.6309224",
"0.57709324",
"0.5683697",
"0.5515731",
"0.5461865",
"0.5461865",
"0.54432523",
"0.54325545",
"0.5421239",
"0.54156554",
"0.5405928",
"0.5399641",
"0.53758717",
"0.5343734",
"0.53213006",
"0.5295045",
"0.52940905",
"0.5287351",
"0.5267869",
"0.52601004",
"0.52538... | 0.4837207 | 53 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.