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 |
|---|---|---|---|---|---|---|
Compares the values numerically with their sign ignored. >>> ExtendedContext.min_mag(Decimal('3'), Decimal('2')) Decimal('2') >>> ExtendedContext.min_mag(Decimal('3'), Decimal('NaN')) Decimal('3') >>> ExtendedContext.min_mag(1, 2) Decimal('1') >>> ExtendedContext.min_mag(Decimal(1), 2) Decimal('1') >>> ExtendedContext.... | def min_mag(self, a, b):
a = _convert_other(a, raiseit=True)
return a.min_mag(b, context=self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def min_mag(self, other, context=None):\n other = _convert_other(other, raiseit=True)\n\n if context is None:\n context = getcontext()\n\n if self._is_special or other._is_special:\n # If one operand is a quiet NaN and the other is number, then the\n # number i... | [
"0.7074722",
"0.5972696",
"0.58875227",
"0.58206755",
"0.57772547",
"0.57025",
"0.56494695",
"0.5603759",
"0.5576338",
"0.557351",
"0.55685866",
"0.556812",
"0.55386186",
"0.5532878",
"0.5495559",
"0.54818666",
"0.5480725",
"0.5445025",
"0.544213",
"0.544213",
"0.5421225",
... | 0.68190736 | 1 |
Returns a rotated copy of a, b times. The coefficient of the result is a rotated copy of the digits in the coefficient of the first operand. The number of places of rotation is taken from the absolute value of the second operand, with the rotation being to the left if the second operand is positive or to the right othe... | def rotate(self, a, b):
a = _convert_other(a, raiseit=True)
return a.rotate(b, context=self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rotate(self, other, context=None):\n if context is None:\n context = getcontext()\n\n other = _convert_other(other, raiseit=True)\n\n ans = self._check_nans(other, context)\n if ans:\n return ans\n\n if other._exp != 0:\n return context._raise... | [
"0.700046",
"0.59659386",
"0.58983153",
"0.55286807",
"0.54450214",
"0.5416337",
"0.53902644",
"0.5384663",
"0.5374053",
"0.5331751",
"0.5321236",
"0.53012824",
"0.528979",
"0.528979",
"0.52759784",
"0.52093005",
"0.52093005",
"0.5208507",
"0.5204911",
"0.5126794",
"0.5126794... | 0.68985987 | 1 |
Normalizes op1, op2 to have the same exp and length of coefficient. Done during addition. | def _normalize(op1, op2, prec = 0):
if op1.exp < op2.exp:
tmp = op2
other = op1
else:
tmp = op1
other = op2
# Let exp = min(tmp.exp - 1, tmp.adjusted() - precision - 1).
# Then adding 10**exp to tmp has the same effect (after rounding)
# as adding any positive quanti... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calc(operand_1, operand_2):\n return operand_1*operand_2",
"def calc(operand_1, operand_2):\n return operand_1*operand_2",
"def do_math(op, op1, op2):\n \n if op == '*':\n return op1 * op2\n elif op == '/':\n return op1 / op2\n elif op == '+':\n return op1 + o... | [
"0.60158736",
"0.60158736",
"0.60117",
"0.5932527",
"0.5892393",
"0.5803572",
"0.57980967",
"0.5736066",
"0.5695001",
"0.561755",
"0.55571836",
"0.5548579",
"0.5515139",
"0.54723155",
"0.54492706",
"0.53574514",
"0.5353393",
"0.5337696",
"0.5314977",
"0.52742666",
"0.52649146... | 0.751689 | 0 |
Given integers x and M, M > 0, such that x/M is small in absolute value, compute an integer approximation to Mexp(x/M). For 0 <= x/M <= 2.4, the absolute error in the result is bounded by 60 (and is usually much smaller). | def _iexp(x, M, L=8):
# Algorithm: to compute exp(z) for a real number z, first divide z
# by a suitable power R of 2 so that |z/2**R| < 2**-L. Then
# compute expm1(z/2**R) = exp(z/2**R) - 1 using the usual Taylor
# series
#
# expm1(x) = x + x**2/2! + x**3/3! + ...
#
# Now use the ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def expm(M,tol=1e-6,maxit=30):\n n,m = M.shape\n assert n==m\n factor = 1.0\n X = np.identity(n,'d')\n eM = np.identity(n,'d')\n for j in range(1,maxit):\n factor /= j\n X = np.dot(X,M)\n if np.linalg.norm(X) < tol:\n break\n eM += factor*X\n else:\n ... | [
"0.7098049",
"0.67793113",
"0.6764881",
"0.6542314",
"0.6360001",
"0.63315666",
"0.631826",
"0.62048155",
"0.6102763",
"0.6032792",
"0.59927684",
"0.59766775",
"0.5953004",
"0.5924122",
"0.5893654",
"0.58833635",
"0.58478016",
"0.5781408",
"0.57748705",
"0.5749236",
"0.572499... | 0.7558264 | 0 |
Compute an approximation to exp(c10e), with p decimal places of precision. | def _dexp(c, e, p):
# we'll call iexp with M = 10**(p+2), giving p+3 digits of precision
p += 2
# compute log(10) with extra precision = adjusted exponent of c*10**e
extra = max(0, e + len(str(c)) - 1)
q = p + extra
# compute quotient c*10**e/(log(10)) = c*10**(e+q)/(log(10)*10**q),
# rou... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exp(x):\r\n\r\n return math.exp(x)",
"def exp(x):\n return np.e**x",
"def exponential_curve(p, t):\n A, C, tau = p\n return (A + C) * np.exp(-t / tau) + C",
"def e(value=1., rate=1.):\n return exponential_like(value, rate)",
"def exp(b, p):\n return at(powers(b), p)",
"def exponenti... | [
"0.67876613",
"0.6787403",
"0.6719368",
"0.6708577",
"0.670301",
"0.6695825",
"0.657489",
"0.64918",
"0.64475965",
"0.6435091",
"0.64073676",
"0.6361687",
"0.6361687",
"0.6354886",
"0.63217145",
"0.62878436",
"0.6274941",
"0.6270341",
"0.6264864",
"0.6225127",
"0.62085617",
... | 0.7641037 | 0 |
Use integration matrix to interpolate diffs | def interp_int(x_vals, y_vals):
h = x_vals[1] - x_vals[0]
M = integration_matrix(len(y_vals))
mat_int = h*M.dot(y_vals)
mat_int[1:] = mat_int[1:] - mat_int[:-1]
mat_int[0] = 0
return mat_int | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _integrate(self):\n\n from scipy.interpolate import UnivariateSpline\n\n self.density_depth = None\n self.knots = [0.0]\n self.X_int = [0.0]\n\n for start, end, density, _ in self.mat_list:\n self.knots.append(end)\n self.X_int.append(density * (end - st... | [
"0.6328233",
"0.61885977",
"0.61203873",
"0.5979351",
"0.5895685",
"0.57998854",
"0.5726616",
"0.57014185",
"0.56038195",
"0.55530626",
"0.5541418",
"0.5526566",
"0.5524637",
"0.55177855",
"0.5489966",
"0.54633284",
"0.5452213",
"0.545151",
"0.5442051",
"0.54407936",
"0.53921... | 0.61914504 | 1 |
Creates room in BBB server | def create_room(self, meeting_id: str, attendee_secret: str, moderator_secret: str,
max_participants: int = 100, guestPolicy: str = 'ALWAYS_ACCEPT', webcam_mod_only: bool = True):
xml_resp = self._get('create', **{
'meetingID': meeting_id,
'attendeePW:': attendee_secr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_room(room):\n\n if room.custom_server:\n return\n\n def _create_room(xmpp):\n muc = xmpp.plugin['xep_0045']\n muc.joinMUC(room.jid, xmpp.requested_jid.user)\n muc.configureRoom(room.jid, _set_form_values(xmpp, room))\n\n current_plugin.logger.info('Creating room %s',... | [
"0.7518534",
"0.7247811",
"0.705679",
"0.68542975",
"0.68232316",
"0.67175466",
"0.66659737",
"0.66535443",
"0.6610844",
"0.64145195",
"0.64082825",
"0.6393904",
"0.6376395",
"0.6303807",
"0.62965333",
"0.6249628",
"0.6235421",
"0.62284064",
"0.6207781",
"0.6176309",
"0.61741... | 0.61888075 | 19 |
Builds url allowing user to join the meeting. When user is redirected to that url he'll automatically join the room. | def get_join_url(self, meeting_id: str, password: str, join_as: str, assing_user_id: str,
join_via_html5: bool = False, user_is_guest: bool = False):
return self._build_url('join', **{
'meetingID': meeting_id,
'password': password,
'fullName': join_as,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def join_room():\n\n form = RoomForm()\n\n # if the form is submitted and valid\n if form.validate_on_submit():\n roomId = form.roomId.data.strip()\n password = form.password.data\n username = form.username.data.strip().replace(\" \", \"_\")\n\n b = BigBlueButton(BBB_SERVER_URL... | [
"0.68839467",
"0.64662963",
"0.64359206",
"0.6089791",
"0.6086687",
"0.5940859",
"0.59238434",
"0.59174263",
"0.57496667",
"0.574133",
"0.5727668",
"0.5708105",
"0.5691464",
"0.56856626",
"0.568553",
"0.5685309",
"0.5685309",
"0.5661718",
"0.56533784",
"0.5652632",
"0.5564161... | 0.72670907 | 0 |
Implementation of the gelu activation function. | def gelu(x):
return x * 0.5 * (1.0 + torch.erf(x / math.sqrt(2.0))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gelu(x):\n return tf.keras.activations.gelu(x)",
"def gelu(x):\n return tf.nn.gelu(x, approximate=True)",
"def gelu_fast(x):\n return 0.5 * x * (1.0 + torch.tanh(x * 0.7978845608 * (1.0 + 0.044715 * x * x)))",
"def gelu_new(x):\n return 0.5 * x * (1 + torch.tanh(\n math.sqrt(2 / math.p... | [
"0.8156728",
"0.77075464",
"0.74103373",
"0.7364669",
"0.7364094",
"0.7364094",
"0.73561054",
"0.7306623",
"0.72241336",
"0.7206583",
"0.7206583",
"0.7196593",
"0.7190447",
"0.7158747",
"0.7074584",
"0.7027239",
"0.70180595",
"0.6982674",
"0.6966983",
"0.6966983",
"0.69553304... | 0.6968394 | 19 |
Create Prioritized Replay buffer. | def __init__(self, size, alpha):
super(PrioritizedReplayBuffer, self).__init__(size)
assert alpha >= 0
self._alpha = alpha
it_capacity = 1
while it_capacity < size:
it_capacity *= 2
self._it_sum = SumSegmentTree(it_capacity)
self._it_min = MinSegment... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_replay_buffer(self):\n logger.info(\"setting up replay buffer\")\n if self.hps.prioritized_replay:\n if self.hps.unreal: # Unreal prioritized experience replay\n self.replay_buffer = UnrealReplayBuffer(self.hps.mem_size,\n ... | [
"0.68967235",
"0.6726801",
"0.64766884",
"0.64482725",
"0.6056115",
"0.60378754",
"0.58691096",
"0.5561734",
"0.55407757",
"0.5521371",
"0.5402302",
"0.53582233",
"0.53272617",
"0.53270197",
"0.5296132",
"0.52688795",
"0.5263801",
"0.5208025",
"0.5181228",
"0.51034504",
"0.50... | 0.56049216 | 8 |
Start a new wizard with a list of forms. form_list should be a list of Form classes (not instances). | def __init__(self, form_list, initial=None):
self.form_list = form_list[:]
self.initial = initial or {}
# Dictionary of extra template context variables.
self.extra_context = {}
# A zero-based counter keeping track of which step we're in.
self.step = 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def buildWizardTree(self, dlist):\n wiztree = QtWidgets.QWizard()\n wiztree.setWizardStyle(QtWidgets.QWizard.ModernStyle)\n wiztree.setWindowTitle(\"Setup\")\n wiztree.addPage(WizardPage(dlist[2]))\n wiztree.addPage(TextWithDropDown(dlist[1]))\n wiztree.addPage(TwoDatesDia... | [
"0.62878424",
"0.5551425",
"0.54450876",
"0.5337979",
"0.5319195",
"0.52610147",
"0.52474874",
"0.52423656",
"0.5093908",
"0.5088568",
"0.5086018",
"0.5073117",
"0.5062333",
"0.50483733",
"0.50393397",
"0.50021756",
"0.49091116",
"0.48811",
"0.48726436",
"0.48587167",
"0.4828... | 0.6049887 | 1 |
Hook for modifying the FormWizard's internal state, given a fully validated Form object. The Form is guaranteed to have clean, valid data. This method should not modify any of that data. Rather, it might want to set self.extra_context or dynamically alter self.form_list, based on previously submitted forms. Note that t... | def process_step(self, request, form, step):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __call__(self, request, *args, **kwargs):\r\n if 'extra_context' in kwargs:\r\n self.extra_context.update(kwargs['extra_context'])\r\n current_step = self.determine_step(request, *args, **kwargs)\r\n self.parse_params(request, *args, **kwargs)\r\n\r\n # Sanity check.\r\n ... | [
"0.64779633",
"0.592618",
"0.57318205",
"0.57152426",
"0.5708593",
"0.5697553",
"0.55792046",
"0.5542017",
"0.5542017",
"0.5542017",
"0.5512169",
"0.5487261",
"0.5480502",
"0.54793006",
"0.5455366",
"0.5416109",
"0.540785",
"0.53995043",
"0.53934836",
"0.53748935",
"0.535102"... | 0.6226086 | 1 |
[Split the dtaframe in train/test/oos and reduce train and test to dataframe with signal!=0 only] | def split_df(df,_start,_mid,_stop,_last):
df = df.dropna()
df['Date'] = pd.to_datetime(df.index)
df_train = df[(df.Date>=_start)&(df.Date<=_mid)]
df_test = df[(df.Date>_mid)&(df.Date<=_stop)]
df_oos = df[(df.Date>_stop)&(df.Date <= _last)]
df_train = df_train.drop(['Date'],axis=1)
d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def train_test_split(df, frac = 0.2):\n if isinstance(df, pd.DataFrame):\n \n train = df.sample(frac = 1 - frac, replace = False, random_state = 60)\n test = df.drop(train.index)\n \n return train, test\n \n else:\n \n raise FriendlyError(\"Sorry. It is my ... | [
"0.6499643",
"0.64822793",
"0.6431514",
"0.6282223",
"0.6231631",
"0.6212861",
"0.6156942",
"0.61272746",
"0.6122153",
"0.6119889",
"0.60808104",
"0.6026275",
"0.6009483",
"0.6006564",
"0.59943974",
"0.5988187",
"0.59793264",
"0.59778255",
"0.59689677",
"0.5966546",
"0.595791... | 0.6050368 | 11 |
There're better ways to generate unique colors, but this isn't awful. | def uniqueish_color():
return plt.cm.gist_ncar(np.random.random()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rand_color():\n return (randrange(0,256),randrange(0,256),randrange(0,256),)",
"def gen_color():\r\n return \"rgb(%s,%s,%s)\" % (\r\n random.randint(0, 160),\r\n random.randint(0, 160),\r\n random.randint(0, 160),\r\n )",
"def uniqueColor(string):\n return sum(round(c * 255... | [
"0.7606205",
"0.7593658",
"0.7507278",
"0.7362659",
"0.72709614",
"0.7177334",
"0.7126736",
"0.70578575",
"0.6928893",
"0.692804",
"0.6812119",
"0.67967",
"0.6774876",
"0.6755522",
"0.67542624",
"0.673733",
"0.6711678",
"0.66962415",
"0.66892636",
"0.66687816",
"0.66583586",
... | 0.769477 | 0 |
look for the last sequence of number(s) in a string and increment | def increment(s):
m = lastNum.search(s)
if m:
next = str(int(m.group(1))+1)
start, end = m.span(1)
s = s[:max(end-len(next), start)] + next + s[end:]
return s | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def look_and_say(num_str, iterations):\n\n counter = 0\n\n while counter < iterations:\n last_num = ''\n num_count = 0\n new_str = ''\n\n for i, num in enumerate(num_str):\n\n # Check if at end of string\n if i == len(num_str) - 1:\n # New num\... | [
"0.7178757",
"0.67116326",
"0.66083115",
"0.6375433",
"0.6342955",
"0.61960083",
"0.614499",
"0.60762554",
"0.60543305",
"0.60437083",
"0.60125285",
"0.5992045",
"0.5991226",
"0.5979013",
"0.59555954",
"0.58932686",
"0.58669037",
"0.58669037",
"0.5826408",
"0.5820717",
"0.581... | 0.8369669 | 0 |
Mid string item in the sequence | def midItem(self):
if len(self.items):
return self[self.items.keys()[len(self.items.keys())/2]]
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def middle(word):\n return word[1:-1]",
"def pick_middle_char(string):\n return string[floor((len(string) - 1) / 2)]",
"def get_middle(s: str) -> str:\n\n lists = list(s)\n if len(lists) % 2 == 0:\n return lists[len(lists) // 2 - 1] + lists[len(lists) // 2]\n return lists[len(lists) // 2]... | [
"0.6835348",
"0.66878045",
"0.65022916",
"0.6494787",
"0.64770705",
"0.63753694",
"0.6195543",
"0.6143789",
"0.6116775",
"0.61023426",
"0.6070718",
"0.6068506",
"0.6055613",
"0.6031082",
"0.59475744",
"0.5871217",
"0.5850508",
"0.5846193",
"0.58242303",
"0.5799244",
"0.579870... | 0.0 | -1 |
mid string item number | def midItemNumber(self):
if len(self.items):
return self.items.keys()[len(self.items.keys())/2]
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch_mid(self) -> int:\n current_mid = self._current_mid\n self._current_mid += 1\n self._current_mid %= 65535\n return current_mid",
"def getKey(item):\n return item[1]",
"def getitem_link(s, i):\r\n while i > 0:\r\n s, i = rest(s), i-1\r\n return first(s)",
... | [
"0.6235877",
"0.5943844",
"0.5877471",
"0.58498347",
"0.58347684",
"0.5802496",
"0.58002687",
"0.5623129",
"0.5614272",
"0.5612383",
"0.5596635",
"0.5596606",
"0.55674297",
"0.55186856",
"0.5514182",
"0.5506708",
"0.54973745",
"0.5484986",
"0.5478496",
"0.5474191",
"0.547295"... | 0.6230665 | 1 |
Level of padding for the sequence | def padding(self):
if not self.parsed:
self._parse_values()
return self._padding | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pad(self, minibatch):\n minibatch = list(minibatch)\n if not self.sequential:\n raise NotImplementedError()\n if self.fix_length is None:\n max_len = max(len(x) for x in minibatch)\n max_sub_len = 1\n for x in minibatch:\n for y in... | [
"0.7437563",
"0.73433024",
"0.70453465",
"0.6848056",
"0.669842",
"0.669204",
"0.66086286",
"0.6600276",
"0.65814143",
"0.6564",
"0.65610975",
"0.65598637",
"0.6503305",
"0.64470106",
"0.6444421",
"0.6421518",
"0.6398807",
"0.6386914",
"0.6385396",
"0.63828975",
"0.6377089",
... | 0.60023177 | 70 |
Return the number component of a sequenced string. | def num(self, string):
if not self.parsed:
self._parse_values()
if not self.is_part_of_sequence(string):
raise ValueError("Item is not part of the sequence")
start = self._primary_match.start('sequence')
end = start + self.padding
num = string[start:end]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getNum(self, s):\n logging.info(\"Getting num of: {}\".format(s))\n assert(isinstance(s, str))\n try:\n return int(self.numRegex.search(s).group(0))\n except Exception:\n return 9999999",
"def regex_internal(str):\r\n tmp = re.search(\"N\\d+\\-(\\d+)\", st... | [
"0.6903668",
"0.68480706",
"0.661315",
"0.6526144",
"0.6407169",
"0.63207823",
"0.6313363",
"0.6295852",
"0.6277826",
"0.62702036",
"0.6165902",
"0.6162532",
"0.6162452",
"0.61505455",
"0.60954994",
"0.60814977",
"0.60600734",
"0.6056785",
"0.6021176",
"0.5978335",
"0.5969468... | 0.74747574 | 0 |
spreadsheet column name to number | def id2num(s):
n = 0
for ch in s.upper():
n = n * 26 + (ord(ch) - 65) + 1
return n - 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def col_number(col):\n m = COLUMN_RE.match(col.upper())\n idx = 0\n for i, l in enumerate(reversed(m.group(0))):\n idx += (ord(l) - 64) * pow(26, i)\n return idx",
"def col_to_num(col_str):\n expn = 0\n col_num = 0\n for char in reversed(col_str):\n col_num ... | [
"0.6958247",
"0.68017274",
"0.68017274",
"0.6773031",
"0.66344815",
"0.65567225",
"0.65245515",
"0.6522446",
"0.64754045",
"0.64127964",
"0.63811296",
"0.6377983",
"0.6377198",
"0.6321071",
"0.6307904",
"0.630646",
"0.6296629",
"0.6271694",
"0.62615746",
"0.6259699",
"0.62456... | 0.0 | -1 |
Return a full name, formatted properly | def get_formatted_name(first_name, middle_name, last_name):
full_name = f"\n{first_name} {middle_name} {last_name}"
return full_name.title() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_formatted_name(first, last):\n full_name = first + \" \" + last\n return full_name.title()",
"def get_full_name(self):\n full_name = '%s %s' % (self.first_name, self.last_name)\n return full_name.strip()",
"def get_full_name(self):\n full_name = '%s %s' % (self.first_name, se... | [
"0.85869104",
"0.8585647",
"0.8585647",
"0.8585647",
"0.8585647",
"0.8585647",
"0.8585647",
"0.8585647",
"0.8585647",
"0.8585647",
"0.8585647",
"0.8585647",
"0.8585647",
"0.8585647",
"0.8585647",
"0.8585647",
"0.8585647",
"0.8585647",
"0.8585647",
"0.8585647",
"0.8585647",
... | 0.8445057 | 42 |
Return a full name, formatted properly | def get_formatted_name(first_name, last_name, middle_name=''):
if middle_name:
full_name = f"\n{first_name} {middle_name} {last_name}"
else:
full_name = f"\n{first_name} {last_name}"
return full_name.title() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_formatted_name(first, last):\n full_name = first + \" \" + last\n return full_name.title()",
"def get_full_name(self):\n full_name = '%s %s' % (self.first_name, self.last_name)\n return full_name.strip()",
"def get_full_name(self):\n full_name = '%s %s' % (self.first_name, se... | [
"0.85869104",
"0.8585647",
"0.8585647",
"0.8585647",
"0.8585647",
"0.8585647",
"0.8585647",
"0.8585647",
"0.8585647",
"0.8585647",
"0.8585647",
"0.8585647",
"0.8585647",
"0.8585647",
"0.8585647",
"0.8585647",
"0.8585647",
"0.8585647",
"0.8585647",
"0.8585647",
"0.8585647",
... | 0.82941335 | 56 |
Creacion ladrillos. Este metodo crea los ladrillos del nivel 1 mediante iteraciones | def creacionladrillos(self,barra):
y_ofs = 35
self.ladrillos = []
for i in range(3):
x_ofs = 35
for j in range(9):
self.ladrillos.append(pygame.Rect(x_ofs,y_ofs,anchoL,largoL))
x_ofs += anchoL + 10
y_ofs += largoL + 5 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def crear_tablero(self):\n self.tablero_juego = [PiezaGo(-1,-1,-1,-1)] * self.filas # Crea las filas del tablero\n for fila in range(self.filas):\n self.tablero_juego[fila] = [PiezaGo(-1, -1,-1,-1)] * self.columnas # Crea las columnas del tablero",
"def createPlan(self):\n temp ... | [
"0.623414",
"0.6176802",
"0.60832685",
"0.6078469",
"0.604737",
"0.6025677",
"0.600571",
"0.5859221",
"0.5826961",
"0.5804184",
"0.5803004",
"0.5704493",
"0.568889",
"0.56704813",
"0.5606125",
"0.55864465",
"0.55735356",
"0.55413246",
"0.55349624",
"0.55346364",
"0.55245477",... | 0.6068932 | 4 |
Return a list of Result objects. | def list_results(self):
return self._results.list_results() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_result(self):\n return list(self.get_result())",
"def getResultList(self):\n return self.__results",
"def each_result(self):\n return (result for result in self.results)",
"def get_results_list(self):\n return (self.__results)",
"def results(self):\n return se... | [
"0.7863191",
"0.7845196",
"0.770282",
"0.76493126",
"0.7609232",
"0.71180534",
"0.7105526",
"0.7075591",
"0.70635617",
"0.70261216",
"0.702256",
"0.6997613",
"0.698296",
"0.698296",
"0.69085014",
"0.6867432",
"0.68566436",
"0.68564475",
"0.68547416",
"0.6842299",
"0.68255234"... | 0.73276865 | 5 |
Begin commands for a particular axes. | def open_axes(self, ax, props):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_axes( self, axes ):\n self.ax = axes",
"def init_axis(self):\n #self.fig = Figure()\n #ax = self.fig.add_subplot(111) \n log.debug('Initializing plot')\n self.ax.cla()\n #ax = self.fig.axes[0]\n for name in SETTABLE_TRAITS:\n value = getattr(s... | [
"0.6193042",
"0.6019609",
"0.5943474",
"0.59145665",
"0.583155",
"0.55035055",
"0.5476649",
"0.5434209",
"0.53920084",
"0.5382126",
"0.5352574",
"0.5322218",
"0.53138787",
"0.52901715",
"0.5281558",
"0.5254883",
"0.5235403",
"0.5233167",
"0.52008134",
"0.51681405",
"0.5143774... | 0.5980897 | 2 |
Returns whether the version object represents a version greater than or equal to the minimum version and less than or equal to the maximum version. | def matches(self, min_version, max_version=None):
if not self:
raise ValueError("Null APIVersion doesn't support 'matches'.")
if isinstance(min_version, str):
min_version = APIVersion(version_str=min_version)
if isinstance(max_version, str):
max_version = AP... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isVersionBetween(min, max):\r\n\treturn isVersion(min) and not isVersion(max)",
"def matches(self, min_version, max_version):\n\n if self.is_null():\n raise ValueError(_(\"Null APIVersion doesn't support 'matches'.\"))\n if max_version.is_null() and min_version.is_null():\n ... | [
"0.8112843",
"0.7844236",
"0.7544584",
"0.731682",
"0.6983437",
"0.6950835",
"0.6885918",
"0.68542457",
"0.6797703",
"0.67011577",
"0.6662941",
"0.6588118",
"0.6544337",
"0.6535654",
"0.64847004",
"0.6459874",
"0.6452902",
"0.64202386",
"0.63217807",
"0.6316134",
"0.628525",
... | 0.7755328 | 2 |
Converts object to string representation which if used to create an APIVersion object results in the same version. | def get_string(self):
if not self:
raise ValueError("Null APIVersion cannot be converted to string.")
elif self.is_latest():
return "%s.%s" % (self.ver_major, "latest")
return "%s.%s" % (self.ver_major, self.ver_minor) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_string(self):\n if self.is_null():\n raise ValueError(\n _(\"Null APIVersion cannot be converted to string.\"))\n elif self.is_latest():\n return \"%s.%s\" % (self.ver_major, \"latest\")\n return \"%s.%s\" % (self.ver_major, self.ver_minor)",
"def... | [
"0.7092383",
"0.6611741",
"0.63847107",
"0.6300565",
"0.6299156",
"0.6292274",
"0.62886786",
"0.6287452",
"0.62498194",
"0.62498194",
"0.62397164",
"0.6224828",
"0.6222714",
"0.62181354",
"0.62149245",
"0.6212131",
"0.62066597",
"0.6202801",
"0.6098994",
"0.60856414",
"0.6085... | 0.7216858 | 0 |
Get or create cloud provider object | def _get_or_create_cloud_provider(self, provider_name):
try:
cloud_provider = CloudProvider.objects.get(
name=provider_name,
)
except ObjectDoesNotExist:
cloud_provider = CloudProvider(
name=provider_name,
)
self... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Cloud():\n ProviderClass = _find_provider(PROVIDERS)\n return ProviderClass()",
"def create_provider(uri):\n parsed_uri = urlparse(uri)\n provider_type = provider_types.get(parsed_uri.scheme, None)\n if not provider_type:\n return None\n return provider_type(uri)",
"def get_provider(self, prov... | [
"0.78730893",
"0.6762297",
"0.65964186",
"0.6509739",
"0.6506002",
"0.6496602",
"0.643803",
"0.63896346",
"0.63723105",
"0.6317071",
"0.6294656",
"0.62379074",
"0.6229784",
"0.62024003",
"0.61927783",
"0.6164055",
"0.61591196",
"0.61487126",
"0.614736",
"0.6064789",
"0.598717... | 0.83509254 | 0 |
Returns if entity has health left. | def is_alive(self):
return self.health > 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_dead(self):\n if self.health <= 0:\n return 1\n else:\n return 0",
"def is_dead(self):\n return self.health <= 0",
"def is_dead(self):\n return self.health <= 0",
"def standing(self):\n if self.health > 0:\n return True\n else:... | [
"0.7313001",
"0.7261116",
"0.7261116",
"0.7132274",
"0.70125043",
"0.6926476",
"0.68017834",
"0.67185664",
"0.6667062",
"0.6641466",
"0.66258377",
"0.6621384",
"0.65948665",
"0.6417033",
"0.6417033",
"0.64122486",
"0.64038444",
"0.6400012",
"0.6359119",
"0.63585293",
"0.63583... | 0.6779891 | 7 |
Bans a member in a chat. Members can't be banned in private or secret chats. In supergroups and channels, the user will not be able to return to the group on their own using invite links, etc., unless unbanned first | async def ban_chat_member(
self,
chat_id: int,
member_id: MessageSender,
banned_until_date: int,
revoke_messages: bool,
*,
request_id: str = None,
request_timeout: int = None,
skip_validation: bool = False
) ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ban(self, user):\n # Check if the chat is a group\n if self.type not in (\"group\", \"supergroup\"):\n raise RuntimeError(\"This chat is not a group or a supergroup!\")\n\n # Accept also an instance of `User`\n if isinstance(user, User):\n user = user.id\n\n ... | [
"0.7288118",
"0.712142",
"0.70828307",
"0.704965",
"0.6941585",
"0.6875646",
"0.6868921",
"0.6861242",
"0.67840093",
"0.6743855",
"0.667588",
"0.66735435",
"0.6649184",
"0.66430515",
"0.6642808",
"0.66204906",
"0.6619485",
"0.65865",
"0.6584371",
"0.65537596",
"0.65473086",
... | 0.76210755 | 0 |
Closes the TDLib instance. All databases will be flushed to disk and properly closed. After the close completes, updateAuthorizationState with authorizationStateClosed will be sent. Can be called before initialization | async def close(self, *, request_id: str = None, request_timeout: int = None) -> Ok:
return await self.client.request(
Close(),
request_id=request_id,
request_timeout=request_timeout,
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close(self):\n logging.debug(\"Closing database\")\n self.__c.close()",
"def close(self):\n self.db.close()\n\n self.db_env.close()",
"def close(self):\n if getattr(self, \"_db\", None) is not None:\n self._db.close()\n self._db = None",
"def close... | [
"0.6676132",
"0.65451896",
"0.65371615",
"0.6534819",
"0.6497192",
"0.64824015",
"0.64790666",
"0.64790666",
"0.647834",
"0.647645",
"0.646606",
"0.63713384",
"0.6343577",
"0.6333107",
"0.6304205",
"0.6292499",
"0.6278825",
"0.6277036",
"0.6274778",
"0.62506163",
"0.6236618",... | 0.0 | -1 |
Creates a new sticker set. Returns the newly created sticker set | async def create_new_sticker_set(
self,
user_id: int,
title: str,
name: str,
is_masks: bool,
stickers: list[InputSticker],
source: str,
*,
request_id: str = None,
request_timeout: int = None,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_sticker_set(\n self,\n name: str,\n ) -> StickerSet:\n\n return self._make_request()",
"def sticker(self, sticker_id):\n return Sticker(self, sticker_id)",
"async def add_sticker_to_set(\n self,\n user_id: int,\n name: str,\n ... | [
"0.6644131",
"0.63814586",
"0.637767",
"0.6100655",
"0.6063464",
"0.6039738",
"0.5969723",
"0.58080673",
"0.5667432",
"0.56536573",
"0.5631253",
"0.5591018",
"0.5564446",
"0.5515898",
"0.54896563",
"0.54280925",
"0.53501576",
"0.5322457",
"0.52885556",
"0.52572817",
"0.521609... | 0.7061422 | 0 |
Returns an existing chat corresponding to a known supergroup or channel | async def create_supergroup_chat(
self,
supergroup_id: int,
force: bool,
*,
request_id: str = None,
request_timeout: int = None,
skip_validation: bool = False
) -> Chat:
_constructor = CreateSupergroupChat.construct if skip_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_chat(self, chatid):\n pass",
"def get_chat(client, chat_id):\n chat = None\n for d in client.iter_dialogs():\n if d.entity.id == CHAT_ID:\n chat = d.entity\n break\n return chat",
"def getChat(self, id):\n if id in self.chats:\n return self... | [
"0.72150195",
"0.7093229",
"0.70362693",
"0.6836737",
"0.6702186",
"0.6670758",
"0.6526104",
"0.6489399",
"0.6443411",
"0.641301",
"0.63154596",
"0.62852424",
"0.6149128",
"0.61345726",
"0.6122425",
"0.6037103",
"0.60365266",
"0.60075456",
"0.5994674",
"0.5940527",
"0.5940283... | 0.5555127 | 41 |
Creates a voice chat (a group call bound to a chat). Available only for basic groups, supergroups and channels; requires can_manage_voice_chats rights | async def create_voice_chat(
self,
chat_id: int,
title: str,
start_date: int,
*,
request_id: str = None,
request_timeout: int = None,
skip_validation: bool = False
) -> GroupCallId:
_constructor = CreateVoiceChat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def groupchat(self, *args, **kwargs):\n kwargs['typ'] = 'groupchat'\n return self.message(*args, **kwargs)",
"def create_chat(self, phone_number) -> bool:\n\n \"\"\"\n Create chat via api command constructor\n \"\"\"\n\n api_send = APISend()\n command = api_se... | [
"0.63898087",
"0.635344",
"0.614471",
"0.61357534",
"0.609586",
"0.59620845",
"0.5868931",
"0.5786005",
"0.5784762",
"0.57587236",
"0.5716523",
"0.56587046",
"0.56545955",
"0.56173766",
"0.5595192",
"0.55676746",
"0.5521834",
"0.5480183",
"0.5453455",
"0.542078",
"0.54080576"... | 0.7993579 | 0 |
Deletes a chat along with all messages in the corresponding chat for all chat members; requires owner privileges. For group chats this will release the username and remove all members. Chats with more than 1000 members can't be deleted using this method | async def delete_chat(
self,
chat_id: int,
*,
request_id: str = None,
request_timeout: int = None,
skip_validation: bool = False
) -> Ok:
_constructor = DeleteChat.construct if skip_validation else DeleteChat
return await self.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete(self, chat_id):\n return",
"def removeChat(self, id):\n if id in self.chats:\n del self.chats[id]",
"async def clearChat(ctx, number=None):\n if number == None:\n await client.say(\"The format of this command is '.clearChat number'. Lines being the number of lines\... | [
"0.70242906",
"0.6742822",
"0.63662326",
"0.62997633",
"0.61729795",
"0.6089362",
"0.60192037",
"0.6005184",
"0.59715706",
"0.59657",
"0.58716476",
"0.58133817",
"0.5776298",
"0.5747914",
"0.57442653",
"0.57248104",
"0.56763935",
"0.55960155",
"0.5594959",
"0.55853736",
"0.55... | 0.6395789 | 2 |
Deletes all messages in the chat. Use chat.can_be_deleted_only_for_self and chat.can_be_deleted_for_all_users fields to find whether and how the method can be applied to the chat | async def delete_chat_history(
self,
chat_id: int,
remove_from_chat_list: bool,
revoke: bool,
*,
request_id: str = None,
request_timeout: int = None,
skip_validation: bool = False
) -> Ok:
_constructor = DeleteCh... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_messages(self, messages):\n return self.add_flags(messages, DELETED)",
"def delete(self, chat_id):\n return",
"async def all(self,ctx,*,limit: int=100):\n counter = await self.bot.purge_from(ctx.message.channel,limit=limit)\n await self.bot.say_edit(\"```py\\nDeleted {} m... | [
"0.7041362",
"0.67638814",
"0.6710774",
"0.66432196",
"0.656919",
"0.65197927",
"0.65133864",
"0.6411697",
"0.6381777",
"0.6300229",
"0.62394255",
"0.62228197",
"0.6210149",
"0.6197218",
"0.6190386",
"0.6181057",
"0.6179271",
"0.6173758",
"0.60617405",
"0.60596144",
"0.605718... | 0.5598969 | 60 |
Returns the period of inactivity after which the account of the current user will automatically be deleted | async def get_account_ttl(self, *, request_id: str = None, request_timeout: int = None) -> AccountTtl:
return await self.client.request(
GetAccountTtl(),
request_id=request_id,
request_timeout=request_timeout,
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_inactive_account_since_30_days(modeladmin, request, queryset):\n date_boundary = datetime.now() - timedelta(days=30)\n queryset.filter(date_joined__lt=date_boundary, is_active=False).delete()",
"def inactivity_timeout(self):\n return self._inactivity_timeout",
"def expires_in(self) ... | [
"0.66917616",
"0.62479275",
"0.6114564",
"0.60711",
"0.6032901",
"0.600757",
"0.59970134",
"0.5976873",
"0.593388",
"0.593388",
"0.59336704",
"0.59336704",
"0.59336704",
"0.59336704",
"0.59336704",
"0.59336704",
"0.59336704",
"0.59336704",
"0.59336615",
"0.59336615",
"0.59330... | 0.0 | -1 |
Returns application config, provided by the server. Can be called before authorization | async def get_application_config(self, *, request_id: str = None, request_timeout: int = None) -> JsonValue:
return await self.client.request(
GetApplicationConfig(),
request_id=request_id,
request_timeout=request_timeout,
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_app_config(self) -> Dict[str, Any]:\n return self.app_config",
"def get_app_config(self):\n return self._load_config_file(self._app_config_path)",
"def get_config(self):\r\n try:\r\n return self.app.get_config(self)\r\n except:\r\n return None",
"def ... | [
"0.8457199",
"0.829301",
"0.7705654",
"0.7593657",
"0.74428123",
"0.7403123",
"0.7356844",
"0.73234427",
"0.7306301",
"0.7295422",
"0.7281345",
"0.7245346",
"0.724335",
"0.72281456",
"0.72281456",
"0.72281456",
"0.72281456",
"0.72281456",
"0.72281456",
"0.72281456",
"0.722814... | 0.0 | -1 |
Returns the current authorization state; this is an offline request. For informational purposes only. Use updateAuthorizationState instead to maintain the current authorization state. Can be called before initialization | async def get_authorization_state(
self,
*,
request_id: str = None,
request_timeout: int = None
) -> AuthorizationState:
return await self.client.request(
GetAuthorizationState(),
request_id=request_id,
request_timeout=reque... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def request_authorization(self):\n\n self.auth_status = request_photokit_authorization()\n return self.auth_status",
"def state(self):\n\n return {\n 'Authorized': self.is_authorized\n }",
"def checkAuthorization(self):\n get_credential_details_url = f'https://{sel... | [
"0.66164124",
"0.6493896",
"0.620565",
"0.5937109",
"0.5867565",
"0.57388365",
"0.57267433",
"0.57190233",
"0.5687804",
"0.5590756",
"0.55718005",
"0.5548746",
"0.5529087",
"0.55003196",
"0.546704",
"0.5457858",
"0.5435067",
"0.54233265",
"0.5420703",
"0.54020226",
"0.5396346... | 0.7173172 | 0 |
Returns default icon name for a filter. Can be called synchronously | async def get_chat_filter_default_icon_name(
self,
filter_: ChatFilter,
*,
request_id: str = None,
request_timeout: int = None,
skip_validation: bool = False
) -> Text:
_constructor = GetChatFilterDefaultIconName.construct if skip_valid... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def icon(self):\n return DEFAULT_ICON",
"def icon(self):\n return DEFAULT_ICON",
"def icon(self):\n return DEFAULT_ICON",
"def icon():\n\n return None",
"def getDefaultActivityIcon(self):\n pass",
"def dameIcon(self):\r\n if self.context.tipoMedio==u\"imagen\":\r... | [
"0.6832949",
"0.6832949",
"0.6832949",
"0.6381944",
"0.63442683",
"0.62899965",
"0.6250261",
"0.6232301",
"0.62318045",
"0.6217094",
"0.61900127",
"0.6184605",
"0.6123435",
"0.608832",
"0.60628694",
"0.60471004",
"0.5993304",
"0.59829205",
"0.59829205",
"0.59829205",
"0.59829... | 0.8266669 | 0 |
Returns invite links for a chat created by specified administrator. Requires administrator privileges and can_invite_users right in the chat to get own links and owner privileges to get other links | async def get_chat_invite_links(
self,
chat_id: int,
creator_user_id: int,
is_revoked: bool,
offset_date: int,
offset_invite_link: str,
limit: int,
*,
request_id: str = None,
request_timeout: int = No... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def invite_link(self):\n if self.type not in (\"supergroup\", \"channel\"):\n raise RuntimeError(\"You can get the invite link only in a supergroup or a channel\")\n\n if hasattr(self, \"_cache_invite_link\"):\n return self._cache_invite_link\n\n chat = self._api.call(\"g... | [
"0.6227449",
"0.5621835",
"0.55948275",
"0.5408236",
"0.53463787",
"0.5280461",
"0.52300966",
"0.52186",
"0.51580465",
"0.5106266",
"0.5044192",
"0.5005136",
"0.49814454",
"0.49226552",
"0.48844784",
"0.48292965",
"0.48201436",
"0.48047492",
"0.48008752",
"0.4786404",
"0.4781... | 0.70336115 | 0 |
Converts a JsonValue object to corresponding JSONserialized string. Can be called synchronously | async def get_json_string(
self,
json_value: JsonValue,
*,
request_id: str = None,
request_timeout: int = None,
skip_validation: bool = False
) -> Text:
_constructor = GetJsonString.construct if skip_validation else GetJsonString
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def json(self, value):\n # represent as a string\n return self.string(value)",
"def serialise_to_json(value):\n return json.dumps(safe_for_serialisation(value))",
"def json_value(self) -> str:\n return json.dumps(self.string_value(), ensure_ascii=False)",
"def serialize(self, value):\n ... | [
"0.66019917",
"0.6588386",
"0.6576679",
"0.6496273",
"0.64139694",
"0.62707233",
"0.6260679",
"0.621774",
"0.6185576",
"0.6171779",
"0.61089146",
"0.6047037",
"0.6026821",
"0.59650946",
"0.59455365",
"0.5881394",
"0.5859612",
"0.5816647",
"0.5808721",
"0.5807049",
"0.58029693... | 0.6712724 | 0 |
Converts a JSONserialized string to corresponding JsonValue object. Can be called synchronously | async def get_json_value(
self,
json_: str,
*,
request_id: str = None,
request_timeout: int = None,
skip_validation: bool = False
) -> JsonValue:
_constructor = GetJsonValue.construct if skip_validation else GetJsonValue
return... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fromString(s):\n return json.loads(s, object_hook=json_object_hook)",
"def parse_json(self, json_str):\n\n return json.loads(json_str)",
"def parse_json(string):\n\n try:\n json_object = json.loads(string)\n except ValueError:\n return None\n else:\n... | [
"0.6826098",
"0.6561036",
"0.64533025",
"0.640621",
"0.6373751",
"0.63689685",
"0.63689685",
"0.63689685",
"0.63689685",
"0.63503176",
"0.6337375",
"0.6335967",
"0.63299376",
"0.6325456",
"0.63135046",
"0.63055116",
"0.629591",
"0.62566036",
"0.625109",
"0.6245181",
"0.622312... | 0.62292117 | 20 |
Returns information about the current localization target. This is an offline request if only_local is true. Can be called before authorization | async def get_localization_target_info(
self,
only_local: bool,
*,
request_id: str = None,
request_timeout: int = None,
skip_validation: bool = False
) -> LocalizationTargetInfo:
_constructor = GetLocalizationTargetInfo.construct if ski... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_localisation(self):\n parameters = {\n \"address\": self.location,\n \"key\": self.key,\n }\n headers = {\"date\": DATE, \"user-agent\": APP_NAME}\n response = requests.get(\n self.api_url, params=parameters, headers=headers, timeout=3\n )... | [
"0.5884451",
"0.56332886",
"0.5519441",
"0.5474549",
"0.54406095",
"0.5423059",
"0.54158044",
"0.53921086",
"0.5378381",
"0.52387154",
"0.5190453",
"0.51752216",
"0.51692104",
"0.51199514",
"0.5102294",
"0.50972444",
"0.50780267",
"0.50721836",
"0.5069597",
"0.5061282",
"0.50... | 0.76680386 | 0 |
Returns an HTTP URL which can be used to automatically authorize the user on a website after clicking an inline button of type inlineKeyboardButtonTypeLoginUrl. Use the method getLoginUrlInfo to find whether a prior user confirmation is needed. If an error is returned, then the button must be handled as an ordinary URL... | async def get_login_url(
self,
chat_id: int,
message_id: int,
button_id: int,
allow_write_access: bool,
*,
request_id: str = None,
request_timeout: int = None,
skip_validation: bool = False
) -> HttpUrl:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getLoginLink(self):\r\n if users.get_current_user():\r\n url = users.create_logout_url(self.request.uri)\r\n url_linktext = 'Logout'\r\n else:\r\n url = users.create_login_url(self.request.uri)\r\n url_linktext = 'Login'\r\n return (url, url_linktext)",
"def login_url(self, next)... | [
"0.6115779",
"0.59816325",
"0.5928615",
"0.5755176",
"0.56823057",
"0.56685406",
"0.5658428",
"0.56556934",
"0.56466204",
"0.5593826",
"0.55495983",
"0.5541953",
"0.5539294",
"0.55035543",
"0.54599357",
"0.54568034",
"0.54533255",
"0.5433467",
"0.5433467",
"0.54216063",
"0.53... | 0.53925467 | 20 |
Returns the current user | async def get_me(self, *, request_id: str = None, request_timeout: int = None) -> User:
return await self.client.request(
GetMe(),
request_id=request_id,
request_timeout=request_timeout,
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_current_user(self):\r\n return self._current_user",
"def get_current_user(self):\n return self._user",
"def current_user(self) -> pwncat.facts.User:\n\n return self.find_user(uid=self.platform.getuid())",
"def get_current_logged_in_user():\n return currentUser",
"def current_use... | [
"0.9019191",
"0.8921142",
"0.8870832",
"0.88484234",
"0.88426363",
"0.88426363",
"0.8670306",
"0.8663915",
"0.85842013",
"0.85760075",
"0.8570492",
"0.8565897",
"0.8526155",
"0.8508133",
"0.850237",
"0.8449099",
"0.8449099",
"0.8426629",
"0.84124446",
"0.84124446",
"0.8410924... | 0.0 | -1 |
Returns an IETF language tag of the language preferred in the country, which must be used to fill native fields in Telegram Passport personal details. Returns a 404 error if unknown | async def get_preferred_country_language(
self,
country_code: str,
*,
request_id: str = None,
request_timeout: int = None,
skip_validation: bool = False
) -> Text:
_constructor = GetPreferredCountryLanguage.construct if skip_validation ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(self, code):\n # language codes are always lower in pycountry\n code = code.lower()\n\n lang = language_mod.one(code)\n\n # abort if lang not found\n if not lang:\n abort(404, f\"No such language: {code}\")\n return lang",
"def get_language_header():\n... | [
"0.67694217",
"0.64814496",
"0.63714844",
"0.63714844",
"0.63413286",
"0.6243533",
"0.61511475",
"0.61428285",
"0.6111475",
"0.6092627",
"0.6041145",
"0.6040382",
"0.60380775",
"0.6026544",
"0.60106945",
"0.60106945",
"0.60010123",
"0.5995085",
"0.59347093",
"0.59147954",
"0.... | 0.6667231 | 1 |
Returns emoji corresponding to a sticker. The list is only for informational purposes, because a sticker is always sent with a fixed emoji from the corresponding Sticker object | async def get_sticker_emojis(
self,
sticker: InputFile,
*,
request_id: str = None,
request_timeout: int = None,
skip_validation: bool = False
) -> Emojis:
_constructor = GetStickerEmojis.construct if skip_validation else GetStickerEmoji... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def emoji(self) -> str:\n return self.random.choice(EMOJI)",
"def extract_emoji():\n\n\turl = \"http://www.unicode.org/Public/emoji/1.0/full-emoji-list.html\"\n\tcontent = urllib2.urlopen(url).read()\n\tsoup = BeautifulSoup(content)\n\n\trows = soup.find_all('tr')\n\temoji = []\n\n\tfor r in rows[1:]:\n\t... | [
"0.5876988",
"0.5723694",
"0.56911016",
"0.5621149",
"0.559594",
"0.5563033",
"0.5503927",
"0.54850304",
"0.5471118",
"0.5442299",
"0.54355466",
"0.5395055",
"0.5393887",
"0.5335414",
"0.5225096",
"0.5201242",
"0.51923853",
"0.5186236",
"0.5154433",
"0.51417184",
"0.5113869",... | 0.68503124 | 0 |
Returns the current privacy settings | async def get_user_privacy_setting_rules(
self,
setting: UserPrivacySetting,
*,
request_id: str = None,
request_timeout: int = None,
skip_validation: bool = False
) -> UserPrivacySettingRules:
_constructor = GetUserPrivacySettingRules.c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def privacy_mode(self):\n return self._attrs.get('privacy_mode')",
"def get_settings(self):\n return self._settings",
"def get_settings(self):\n return self.__settings",
"def privacy_policy(context, request):\n return {'support_address': Shared.support_address}",
"def settings(self)... | [
"0.72075903",
"0.67116827",
"0.6698644",
"0.6437106",
"0.63906366",
"0.63906366",
"0.63308775",
"0.62513363",
"0.6247953",
"0.62173945",
"0.6211445",
"0.6178136",
"0.6163798",
"0.616009",
"0.6134837",
"0.6131632",
"0.6121202",
"0.6120875",
"0.60927033",
"0.60102254",
"0.59598... | 0.0 | -1 |
Removes a chat action bar without any other action | async def remove_chat_action_bar(
self,
chat_id: int,
*,
request_id: str = None,
request_timeout: int = None,
skip_validation: bool = False
) -> Ok:
_constructor = RemoveChatActionBar.construct if skip_validation else RemoveChatActionBa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unload(self):\n for action in self.actions:\n self.iface.removePluginMenu(\n self.tr(u'&CCU'),\n action)\n self.toolbar.removeAction(action)",
"def button_clear():\n display_bar.delete(0, END)",
"def unload(self):\n for action in self.act... | [
"0.5999858",
"0.59863573",
"0.5975882",
"0.59610116",
"0.59332997",
"0.59119236",
"0.5886063",
"0.5872117",
"0.58444333",
"0.5819074",
"0.5811667",
"0.5808397",
"0.578055",
"0.5701048",
"0.5688748",
"0.5680588",
"0.56786674",
"0.5643425",
"0.56337005",
"0.5620642",
"0.5618055... | 0.7565915 | 0 |
Changes volume level of a participant of an active group call. If the current user can manage the group call, then the participant's volume level will be changed for all users with the default volume level | async def set_group_call_participant_volume_level(
self,
group_call_id: int,
participant_id: MessageSender,
volume_level: int,
*,
request_id: str = None,
request_timeout: int = None,
skip_validation: bool = False
) -> Ok... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_volume_level(self, volume: float) -> None:\n self.data.client.volume(int(volume * 100))",
"def volume_level(self, level):\n self._global_volume = level\n # individual player volume control method here",
"def set_volume_level(self, volume):\n import alsaaudio\n\n self.... | [
"0.68617725",
"0.68440425",
"0.66576666",
"0.66205114",
"0.65912545",
"0.64849603",
"0.6426878",
"0.6385446",
"0.63329494",
"0.63008684",
"0.6238291",
"0.6225691",
"0.6164624",
"0.60924745",
"0.60924745",
"0.60651004",
"0.6054736",
"0.6054736",
"0.604349",
"0.60195184",
"0.59... | 0.74855894 | 0 |
Sets new log stream for internal logging of TDLib. Can be called synchronously | async def set_log_stream(
self,
log_stream: LogStream,
*,
request_id: str = None,
request_timeout: int = None,
skip_validation: bool = False
) -> Ok:
_constructor = SetLogStream.construct if skip_validation else SetLogStream
re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_logstream(self, logstream):\n self.logstream = logstream",
"def set_stream_logger(self, stream=None, level=logging.DEBUG, log_format=None):\n log = logging.getLogger(LOGGER_NAME)\n log.setLevel(level)\n sh = logging.StreamHandler(stream)\n sh.setLevel(level)\n if... | [
"0.79658544",
"0.703947",
"0.70230925",
"0.69807863",
"0.69615394",
"0.6951747",
"0.66177595",
"0.65788037",
"0.65079373",
"0.6490568",
"0.6476449",
"0.6464141",
"0.6463775",
"0.6448196",
"0.6441364",
"0.6418513",
"0.64168257",
"0.6412363",
"0.6367634",
"0.63523954",
"0.63434... | 0.6798594 | 6 |
Changes the first and last name of the current user | async def set_name(
self,
first_name: str,
last_name: typing.Optional[str],
*,
request_id: str = None,
request_timeout: int = None,
skip_validation: bool = False
) -> Ok:
_constructor = SetName.construct if skip_validation e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_first_name(self, user_fname):\n\n self.user_fname = user_fname",
"def user_profile_setname(token, name_first, name_last):\n # Raise an AccessError if not a valid token\n is_valid_token(token)\n\n # Raise an InputError if either name is out of bounds\n if len(name_first) < 1 or len(n... | [
"0.81460315",
"0.7634863",
"0.74806744",
"0.7466159",
"0.72105426",
"0.71849036",
"0.7142502",
"0.7075463",
"0.7008939",
"0.6998858",
"0.6908393",
"0.6904914",
"0.68521196",
"0.6819415",
"0.67736715",
"0.67736715",
"0.67726463",
"0.6734027",
"0.6733361",
"0.66820425",
"0.6678... | 0.0 | -1 |
Sets the current network type. Can be called before authorization. Calling this method forces all network connections to reopen, mitigating the delay in switching between different networks, so it must be called whenever the network is changed, even if the network type remains the same. Network type is used to check wh... | async def set_network_type(
self,
type_: NetworkType,
*,
request_id: str = None,
request_timeout: int = None,
skip_validation: bool = False
) -> Ok:
_constructor = SetNetworkType.construct if skip_validation else SetNetworkType
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def network_type(self, network_type):\n\n self._network_type = network_type",
"def set_network_type(self,network_type):\n self.network_type = network_type\n return self",
"def network_type(self, network_type):\n if network_type is None:\n raise ValueError(\"Invalid value ... | [
"0.83752215",
"0.8317866",
"0.7667482",
"0.69681776",
"0.69234407",
"0.67739004",
"0.67739004",
"0.6572764",
"0.6406261",
"0.63441086",
"0.6267276",
"0.62149894",
"0.6162542",
"0.61486906",
"0.6128778",
"0.6010477",
"0.5999369",
"0.59820884",
"0.5972164",
"0.5943301",
"0.5792... | 0.7539888 | 3 |
Changes default participant identifier, which can be used to join voice chats in a chat | async def set_voice_chat_default_participant(
self,
chat_id: int,
default_participant_id: MessageSender,
*,
request_id: str = None,
request_timeout: int = None,
skip_validation: bool = False
) -> Ok:
_constructor = SetVoiceC... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assign_id( # type: ignore\n self, name: str = \"{self.callsign}_{idx:>03}\", idx: int = 0\n ):\n ...",
"def unique_id(self):\n return \"{}_{}\".format(super().unique_id, \"room\")",
"def tellplayer(self, userid, msg):\n es.tell(userid, \"#multi\", \"#green[UltiRank %s] #defa... | [
"0.5630204",
"0.5630047",
"0.55463785",
"0.5459722",
"0.5411041",
"0.5343969",
"0.53417295",
"0.52881455",
"0.52880937",
"0.52736336",
"0.5195735",
"0.51327276",
"0.5113642",
"0.51077306",
"0.510643",
"0.50805414",
"0.5078322",
"0.5071936",
"0.5057267",
"0.5055496",
"0.502494... | 0.7069913 | 0 |
Toggles whether current user's video is enabled | async def toggle_group_call_is_my_video_enabled(
self,
group_call_id: int,
is_my_video_enabled: bool,
*,
request_id: str = None,
request_timeout: int = None,
skip_validation: bool = False
) -> Ok:
_constructor = ToggleGroupC... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cam_video_chosen(self):\n self.cam_video_button.setEnabled(True)\n self.existing_video_button.setEnabled(False)",
"def setVideoDisplay(self):\n self.controller.set_video_display(self.videoDisplayCheckbox.isChecked())",
"def allow_video(self, video_id):\r\n print(\"allow_video ne... | [
"0.67478734",
"0.66660637",
"0.6464183",
"0.6412819",
"0.6412819",
"0.6412819",
"0.6412819",
"0.6412819",
"0.63836205",
"0.61335415",
"0.61095005",
"0.60749024",
"0.6069978",
"0.6029599",
"0.58997786",
"0.5865448",
"0.58448935",
"0.5839631",
"0.58087796",
"0.5805713",
"0.5800... | 0.5858948 | 16 |
Toggles whether current user's video is paused | async def toggle_group_call_is_my_video_paused(
self,
group_call_id: int,
is_my_video_paused: bool,
*,
request_id: str = None,
request_timeout: int = None,
skip_validation: bool = False
) -> Ok:
_constructor = ToggleGroupCal... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pause_video(self):\n global is_paused\n global now_playing\n global is_playing\n \n if (is_paused):\n print(\"Video already paused: \"+now_playing.title)\n elif(not(is_playing)):\n print(\"Cannot pause video: No video is currently playing\")\n ... | [
"0.77970594",
"0.7754611",
"0.7736707",
"0.76729286",
"0.7545069",
"0.7441388",
"0.74212736",
"0.74107337",
"0.7379212",
"0.7345311",
"0.73176104",
"0.7232349",
"0.7118761",
"0.70387447",
"0.7011183",
"0.69599694",
"0.6776594",
"0.66932696",
"0.66831005",
"0.66575915",
"0.665... | 0.5977556 | 70 |
Return the spatial model corresponding to the source named 'name' | def __get_spatial_model__(self,name):
if sum(name==self.extended_nicknames) != 1:
raise Exception("Cannot find spatial model for extended source %s" % name)
return self.extended_models[self.extended_nicknames==name][0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_data_by_name(self, name):\n model_data = self.get_model_by_name(name)\n if not model_data:\n return None\n return self.to_info(model_data)",
"def source_model(self):\n return self._source_model",
"def source_model(self):\n return self._source_model",
"def... | [
"0.59782434",
"0.5968736",
"0.5968736",
"0.59671265",
"0.5859498",
"0.57666063",
"0.5763698",
"0.57418215",
"0.57281053",
"0.57262933",
"0.5701833",
"0.56901425",
"0.564732",
"0.5634813",
"0.56319773",
"0.5630398",
"0.5595731",
"0.5583894",
"0.5499951",
"0.54974467",
"0.54789... | 0.81950504 | 0 |
Test if customUser predictions left setter works correctly. | def test_customUser_predictions_left_setter(self):
self.user.predictions_left = 50
result = self.user.predictionsLeft = 50
self.assertEquals(result, 50) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_customUser_has_predictions_left_true_when_pr_left_gr_0(self):\n self.user.predictions_left = 1\n result = self.user.has_predictions_left()\n self.assertTrue(result)",
"def test_customUser_remove_prediction(self):\n self.user.add_predictions()\n self.user.remove_predict... | [
"0.73571354",
"0.7201958",
"0.7090976",
"0.69788736",
"0.6896968",
"0.58497256",
"0.5768499",
"0.5743231",
"0.5689456",
"0.5678954",
"0.5636134",
"0.56265473",
"0.5588424",
"0.555656",
"0.5541438",
"0.54968464",
"0.5486871",
"0.54784703",
"0.54571587",
"0.5451078",
"0.5410027... | 0.790669 | 0 |
Retrieves list of reports. | def list_reports(
self,
profile_id: str,
max_results: int | None = None,
scope: str | None = None,
sort_field: str | None = None,
sort_order: str | None = None,
) -> list[dict]:
reports: list[dict] = []
conn = self.get_conn()
request = conn.rep... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_reports():\n return _ensure_list(request('report/list')['reports']['report'])",
"def get_reports():\n from models import Report\n\n filters = {}\n # TODO: Allow filtering by `created` timestamp.\n for field in ('id', 'url', 'ref'):\n if field in req.args:\n filters[field... | [
"0.9029882",
"0.7899556",
"0.77243286",
"0.74330133",
"0.72394806",
"0.7189531",
"0.71588767",
"0.7081223",
"0.68912554",
"0.68746513",
"0.6804422",
"0.6801146",
"0.67810357",
"0.6780005",
"0.67765385",
"0.6770585",
"0.6724386",
"0.6679516",
"0.66409844",
"0.6631074",
"0.6628... | 0.6877899 | 9 |
Returns a path relative to the root directory. | def from_root(path: str) -> str:
if os.name == 'nt':
path = path.replace('/', '\\')
return os.path.join(ROOT, path) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def root_relative_path(path):\n if path.startswith(Env.current.root_dir):\n path = path[Env.current.root_dir_len:]\n return path",
"def root_dir() -> Path:\n\n return Path(__file__).parent",
"def rootdir() -> path:\n return path(__file__).parent.abspath() / \"roots\"",
"def get_relative_pa... | [
"0.85766375",
"0.8188068",
"0.81276494",
"0.77468115",
"0.7733686",
"0.77321345",
"0.75976765",
"0.7569262",
"0.75077546",
"0.74904996",
"0.74550235",
"0.7400397",
"0.7356821",
"0.73242843",
"0.7282871",
"0.72744656",
"0.72241163",
"0.71988463",
"0.7182038",
"0.71760404",
"0.... | 0.7261786 | 16 |
Updates the user's NodeBB user properties. Accepted user properties can be found by referring to `updateProfile`. | def update(self, username, **payload):
uid = get_nodebb_uid_from_username(username)
payload.update({'_uid': uid})
return self.put('/api/v2/users/{}'.format(uid), **payload) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_profile(self, user_entity, profile, email):\n\n # set user properties from response\n user_entity.user_id = profile['id']\n user_entity.given_name = profile['given_name']\n user_entity.family_name = profile['family_name']\n user_entity.profile_link = profile['link']\n ... | [
"0.7075608",
"0.6863815",
"0.6835584",
"0.67786777",
"0.67481965",
"0.67237866",
"0.6674196",
"0.66398615",
"0.66319716",
"0.6624665",
"0.6601184",
"0.65761423",
"0.65139097",
"0.64880234",
"0.6426971",
"0.6422905",
"0.6410722",
"0.6339218",
"0.62926626",
"0.62780726",
"0.625... | 0.6170786 | 26 |
String for representing Feedback object. | def __str__(self):
return 'Feedback {self.id} ({self.electrode1}, {self.electrode2}, {self.electrode3}, {self.electrode4}, \"{self.analysis}\")'.format(
self=self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __repr__(self):\n return \"<Feedback %r>\" % self.notes",
"def format_feedback(cls, config, feedback):\n raise NotImplementedError()",
"def __str__(self):\n from ansys.dpf.core.core import _description\n\n return _description(self._message, self._server)",
"def __str__(self):\... | [
"0.7589536",
"0.67854404",
"0.65027714",
"0.64385885",
"0.6435723",
"0.6428352",
"0.642714",
"0.642714",
"0.64138424",
"0.63984305",
"0.6393464",
"0.638096",
"0.6372541",
"0.6369769",
"0.63674027",
"0.6357384",
"0.6355534",
"0.63122106",
"0.63117784",
"0.6301942",
"0.6282155"... | 0.76086634 | 0 |
String for representing the Model object. | def __str__(self):
return '%s, %s' % (self.last_name, self.first_name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _repr_model_(self):\n return str(self)",
"def get_model_string(self):\n raise NotImplementedError()",
"def __str__(self):\n\n return str(self.model)",
"def __repr__(self):\n s = '' \n s += 'Model Name: ' + self._name + '\\n'\n s += 'Machine Learning Model: ' + st... | [
"0.8188433",
"0.81442237",
"0.8093044",
"0.7905443",
"0.7821154",
"0.7794082",
"0.77520275",
"0.7728334",
"0.77101016",
"0.77041835",
"0.7616919",
"0.75828636",
"0.7530188",
"0.75026286",
"0.74704695",
"0.7447144",
"0.7390358",
"0.7385083",
"0.73765314",
"0.7370234",
"0.72876... | 0.0 | -1 |
String for representing the Model object. | def __str__(self):
return "record" + str(self.id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _repr_model_(self):\n return str(self)",
"def get_model_string(self):\n raise NotImplementedError()",
"def __str__(self):\n\n return str(self.model)",
"def __repr__(self):\n s = '' \n s += 'Model Name: ' + self._name + '\\n'\n s += 'Machine Learning Model: ' + st... | [
"0.8188433",
"0.81442237",
"0.8093044",
"0.7905443",
"0.7821154",
"0.7794082",
"0.77520275",
"0.7728334",
"0.77101016",
"0.77041835",
"0.7616919",
"0.75828636",
"0.7530188",
"0.75026286",
"0.74704695",
"0.7447144",
"0.7390358",
"0.7385083",
"0.73765314",
"0.7370234",
"0.72876... | 0.0 | -1 |
String for representing the Model object. | def __str__(self):
return self.title | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _repr_model_(self):\n return str(self)",
"def get_model_string(self):\n raise NotImplementedError()",
"def __str__(self):\n\n return str(self.model)",
"def __repr__(self):\n s = '' \n s += 'Model Name: ' + self._name + '\\n'\n s += 'Machine Learning Model: ' + st... | [
"0.8188433",
"0.81442237",
"0.8093044",
"0.7905443",
"0.7821154",
"0.7794082",
"0.77520275",
"0.7728334",
"0.77101016",
"0.77041835",
"0.7616919",
"0.75828636",
"0.7530188",
"0.75026286",
"0.74704695",
"0.7447144",
"0.7390358",
"0.7385083",
"0.73765314",
"0.7370234",
"0.72876... | 0.0 | -1 |
Presave signal handler for the `User` model; Used to ensure that the `PasswordHistory` is updated when a user changes | def user_pre_save(cls, sender, instance=None, created=False, **kwargs): # noqa
if not created and instance.pk:
current_password = User.objects.get(pk=instance.pk).password
if current_password != instance.password and current_password:
cls.objects.create(user=instance, ha... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_user_profile(sender, instance, **kwargs):\n instance.userprofile.save()",
"def save_user_profile(sender, instance, **kwargs):\n\tinstance.profile.save()",
"def save_user(user):\n user.save_user()",
"def save_user(user):\n user.save_user()",
"def save_user_profile(instance, **kwargs):\n ... | [
"0.6965569",
"0.68732953",
"0.6416669",
"0.6416669",
"0.63813925",
"0.6325285",
"0.62521154",
"0.6190516",
"0.6097088",
"0.6090975",
"0.60801274",
"0.602887",
"0.59599924",
"0.595911",
"0.5919664",
"0.5880975",
"0.58297044",
"0.5824534",
"0.58221495",
"0.582128",
"0.5817199",... | 0.55140185 | 44 |
Resize a face image to the proper size for training and detection. | def resize(image):
return cv2.resize(image,
(FACE_WIDTH, FACE_HEIGHT),
interpolation=cv2.INTER_LANCZOS4) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resize(image):\n return cv2.resize(image, (config.FACE_WIDTH, config.FACE_HEIGHT),\n interpolation=cv2.INTER_LANCZOS4)",
"def input_face_image():\n image = cv2.imread(\"dataset_scripts/tests/testImages/test_face1.jpg\")\n image = resize_image(image, 500)\n\n return image",
... | [
"0.7621176",
"0.7157749",
"0.63877356",
"0.6348004",
"0.631219",
"0.631051",
"0.621069",
"0.6177304",
"0.61563814",
"0.61501527",
"0.60696524",
"0.60247827",
"0.596061",
"0.59225535",
"0.58886343",
"0.58788925",
"0.58341336",
"0.58265156",
"0.5815547",
"0.5812241",
"0.5807134... | 0.75937605 | 1 |
Set up Dyson sensor from a config entry. | async def async_setup_entry(
hass: HomeAssistant, config_entry: ConfigEntry, async_add_entities: Callable
) -> None:
device = hass.data[DOMAIN][DATA_DEVICES][config_entry.entry_id]
name = config_entry.data[CONF_NAME]
if isinstance(device, Dyson360Eye) or isinstance(device, Dyson360Heurist):
enti... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_platform(hass, config, add_devices, discovery_info=None):\n\tadd_devices([AtlasSensor(\n\t\tname=config.get(CONF_NAME),\n\t\tport=config.get(CONF_PORT),\n\t\toffset=config.get(CONF_OFFSET),\n\t\tscale=config.get(CONF_SCALE)\n\t)])",
"def _dry_setup(hass, config, add_devices, discovery_info=None):\n ... | [
"0.66535807",
"0.64181703",
"0.6245456",
"0.6211277",
"0.6142088",
"0.6025696",
"0.60181934",
"0.5986294",
"0.5953105",
"0.5927261",
"0.5909221",
"0.58913815",
"0.5865035",
"0.5847232",
"0.5829039",
"0.5801658",
"0.58009356",
"0.57995147",
"0.57941115",
"0.57574284",
"0.57511... | 0.5931085 | 9 |
Return the name of the Dyson sensor. | def sub_name(self):
return self._SENSOR_NAME | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sensor_name(self):\n return self._sensor_name",
"def name(self):\n return self.sensor.name",
"def name(self):\n return self.sensor.name",
"def name(self):\n return SENSOR_NAME",
"def name(self) -> str:\n return self._sensor.name",
"def name(self):\n return f\... | [
"0.8300732",
"0.8244469",
"0.8244469",
"0.81841785",
"0.8168975",
"0.77713674",
"0.7594889",
"0.74248797",
"0.74248797",
"0.71241343",
"0.69088835",
"0.6850669",
"0.6850669",
"0.6846309",
"0.67901504",
"0.67561644",
"0.6734487",
"0.6726469",
"0.6714512",
"0.6702261",
"0.66963... | 0.73054034 | 9 |
Return the sensor's unique id. | def sub_unique_id(self):
return self._SENSOR_TYPE | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unique_id(self):\n return self.sensor.id",
"def unique_id(self):\n return self.sensor.id",
"def unique_id(self):\n return f\"{self.location_name}_{self.sensor_name}\"",
"def unique_id(self) -> str:\n return (\n f\"{self._doorbell.device_id}_\"\n f\"{SENSO... | [
"0.9189396",
"0.9189396",
"0.84046286",
"0.8309401",
"0.82842445",
"0.82539874",
"0.8240475",
"0.8197961",
"0.8093039",
"0.80662656",
"0.8054401",
"0.803651",
"0.79888386",
"0.79830194",
"0.7963142",
"0.77845126",
"0.7764752",
"0.77581334",
"0.7713997",
"0.7689332",
"0.768757... | 0.7412989 | 37 |
Return the "native" value for this sensor. Note that as of 20211028, Home Assistant does not support converting from Kelvin native unit to Celsius/Fahrenheit. So we return the Celsius value as it's the easiest to calculate. | def native_value(self) -> Optional[float]:
if (value := self._device.temperature) >= 0:
return value - 273.15
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def native_value(self) -> str:\n return self._pool.temperature",
"def native_value(self) -> float | None:\n if self.sensor_value is not None:\n return float(self.sensor_value)\n return None",
"def native_value(self) -> float | None:\n if self.entity_description.key == CON... | [
"0.7331694",
"0.7276587",
"0.7149902",
"0.69579315",
"0.69222283",
"0.6886363",
"0.6873936",
"0.68674284",
"0.6782665",
"0.6714828",
"0.66878164",
"0.6667531",
"0.6622943",
"0.66180325",
"0.6607009",
"0.6581089",
"0.65523267",
"0.65387845",
"0.65212387",
"0.6484394",
"0.64790... | 0.7469723 | 0 |
Process the "/account/{address}/properties" HTTP response. | def process_get_account_properties(
status: int,
json: dict,
network_type: models.NetworkType,
) -> models.AccountProperties:
assert status == 200
return models.AccountProperties.create_from_dto(json, network_type) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_property_by_address(address):\n params = \"address={}\".format(quote(address))\n\n url = \"{}/{}?{}\".format(api.URL, PATH, params)\n\n r = requests.get(url, headers=api.headers)\n return r.json()",
"def process_get_accounts_properties(\n status: int,\n json: dict,\n network_type: models.Net... | [
"0.58940977",
"0.58089143",
"0.5743718",
"0.56827176",
"0.560022",
"0.53168803",
"0.5198433",
"0.51152945",
"0.51027703",
"0.5042606",
"0.50336975",
"0.4992135",
"0.49447414",
"0.49371773",
"0.4932618",
"0.49271083",
"0.48853678",
"0.48630992",
"0.48338154",
"0.48096827",
"0.... | 0.63606757 | 0 |
Process the "/account/{public_key}/transactions" HTTP response. | def process_get_account_transactions(
status: int,
json: list,
network_type: models.NetworkType,
) -> typing.Sequence[models.Transaction]:
assert status == 200
return [models.Transaction.create_from_dto(i, network_type) for i in json] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transaction_response(self, txhash):\n\n response = self.client.get(\"/transaction/%s\" % (txhash, ))\n\n return response",
"def transactions(account_id):\n API_URL = 'https://api.nordeaopenbanking.com/v2' # this is freaking ugly\n url = \"{}/accounts/{}/transactions\".format(API_URL, acco... | [
"0.6415802",
"0.6382118",
"0.5682315",
"0.564481",
"0.5564785",
"0.5563266",
"0.5561564",
"0.5527369",
"0.5494899",
"0.5452876",
"0.53788376",
"0.535926",
"0.5325225",
"0.53150743",
"0.5263405",
"0.52317756",
"0.5224845",
"0.5214598",
"0.5211684",
"0.5196792",
"0.5172838",
... | 0.5705609 | 2 |
Process the "/transaction" HTTP response. | def process_get_transactions(
status: int,
json: list,
network_type: models.NetworkType,
):
assert status == 200
return [models.Transaction.create_from_dto(i, network_type) for i in json] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_response(self, request, response):\n transaction_after_request(response, base_status_code_error=400)\n return response",
"def transaction_response(self, txhash):\n\n response = self.client.get(\"/transaction/%s\" % (txhash, ))\n\n return response",
"def process(self):\n ... | [
"0.6792518",
"0.6691596",
"0.6595691",
"0.64508736",
"0.63522506",
"0.60947764",
"0.59640974",
"0.59614855",
"0.5862884",
"0.578339",
"0.5748461",
"0.57423663",
"0.57413006",
"0.5710859",
"0.5685761",
"0.56118566",
"0.55786437",
"0.5530647",
"0.55261594",
"0.55201656",
"0.548... | 0.49530566 | 100 |
Process the "/transaction" HTTP response. | def process_announce(
status: int,
json: dict,
network_type: models.NetworkType,
) -> models.TransactionAnnounceResponse:
assert ((status == 200) | (status == 202))
return models.TransactionAnnounceResponse.create_from_dto(json) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_response(self, request, response):\n transaction_after_request(response, base_status_code_error=400)\n return response",
"def transaction_response(self, txhash):\n\n response = self.client.get(\"/transaction/%s\" % (txhash, ))\n\n return response",
"def process(self):\n ... | [
"0.6790786",
"0.66929966",
"0.6595106",
"0.6450194",
"0.6349322",
"0.60915744",
"0.5965489",
"0.59628385",
"0.58610725",
"0.578533",
"0.57502085",
"0.5740314",
"0.5739466",
"0.5711446",
"0.5683069",
"0.56111777",
"0.5575572",
"0.55276126",
"0.55235124",
"0.5517659",
"0.548338... | 0.0 | -1 |
Starts an interactive request shell. | def shell(cls, renderer, shell_cls, requests, info):
# info may be used in subclasses
sh = shell_cls(renderer)
sh.run(requests) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def open_shell():\n app_ctx = AppContext()\n shell_ctx = globals()\n shell_ctx.update(vars(app_ctx))\n code.interact(local=shell_ctx)\n return",
"def shell(self):\r\n channel = self._ssh_client.invoke_shell()\r\n interactive_shell(channel)",
"def shellRequest(request):\n THREADS... | [
"0.6912595",
"0.67873746",
"0.6662841",
"0.6654031",
"0.64524853",
"0.6346877",
"0.6272875",
"0.62711734",
"0.6239459",
"0.62307036",
"0.62081313",
"0.6164645",
"0.61258554",
"0.60438323",
"0.5911411",
"0.5907359",
"0.5826694",
"0.58266246",
"0.57296014",
"0.5684056",
"0.5673... | 0.5632258 | 23 |
Creates an new window for the selection of the input data Consist of a Label and a Option Menu | def Input_Data():
global Input_Variable
global Top
Top = tk.Toplevel()
Top.grab_set()
Input_List = ["oxygenated", "deoxygenated", "beta value", "Predictor"]
Input_Variable = tk.StringVar()
Input_Variable.set(Input_List[0])
drop_Input = tk.OptionMenu(Top, Input_Variable, *Input_Li... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def CloneListNameToolWindow() -> None:\r\n\r\n main_window.new_window.show()",
"def Input_Predictor():\r\n global Oxy_List\r\n global Oxy_Value\r\n global Top2\r\n Top2 = tk.Toplevel()\r\n Top2.grab_set()\r\n Oxy_List = [[\"Oxy Value\", \"Deoxy Value\"], [1, 0]]\r\n Oxy_Value = tk... | [
"0.64298695",
"0.63652503",
"0.62704724",
"0.62575865",
"0.62339646",
"0.61860746",
"0.61860746",
"0.61860746",
"0.6183043",
"0.6047458",
"0.6034882",
"0.6020094",
"0.59438956",
"0.59388626",
"0.5936077",
"0.5926307",
"0.58810925",
"0.5873694",
"0.5871754",
"0.5787801",
"0.57... | 0.6849982 | 0 |
Closes Control window depended and update the Label depended on the selected command | def Close_Output():
Command_Label = ''
for i in range(len(command)):
Command_Label += str("command " + str(i + 1) + ": " + str(command[i].get() + "\n"))
Command_ = Command_Label[:-1] # delete last \n command
Label4.configure(text=Command_)
Top.destroy() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Close_Input_Command():\r\n Label2.configure(text=Command_Variable.get())\r\n Top.destroy()",
"def OnClose(self,event):\r\n res = self.notebook.CloseAll()\r\n if res is not True:\n return\n\n #check if console is hidden too\n #console = self.toolmgr.get_tool('Conso... | [
"0.83372957",
"0.68164384",
"0.6556772",
"0.6507785",
"0.6461461",
"0.6441097",
"0.63916004",
"0.6315877",
"0.6253547",
"0.62108386",
"0.62041545",
"0.61944324",
"0.6163408",
"0.6158293",
"0.6140468",
"0.6097437",
"0.6094398",
"0.6075614",
"0.6067094",
"0.60582656",
"0.604402... | 0.7633134 | 1 |
Check that MixedNB is equivalent to MultinomialNB for nominal variables. | def test_mixednb_all_nominals():
X, y, types = _classification_task()
# convert some features to nominal ones (one-hot encoded)
X = (X > 0).astype(int)
mixed_nb = MixedNB(is_nominal=[True] * 5)
mixed_nb.partial_fit(X, y, classes=['a', 'b', 'c'])
mixed_pred = mixed_nb.predict_proba(X)
mult... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_mixednb_all_continuous():\n X, y, types = _classification_task()\n\n mixed_nb = MixedNB(is_nominal=[False] * 5)\n mixed_nb.partial_fit(X, y, classes=['a', 'b', 'c'])\n mixed_pred = mixed_nb.predict_proba(X)\n\n gauss_nb = GaussianNB()\n gauss_nb.partial_fit(X, y, classes=['a', 'b', 'c'])... | [
"0.7471841",
"0.6743161",
"0.6092906",
"0.60226077",
"0.594361",
"0.5902775",
"0.5764067",
"0.5762714",
"0.5758564",
"0.5716277",
"0.5653246",
"0.5620388",
"0.55973077",
"0.5591894",
"0.55623883",
"0.54847634",
"0.54798996",
"0.5425547",
"0.54160255",
"0.54122823",
"0.5411517... | 0.82427734 | 0 |
Check that MixedNB is equivalent to GaussNB for continuous variables. | def test_mixednb_all_continuous():
X, y, types = _classification_task()
mixed_nb = MixedNB(is_nominal=[False] * 5)
mixed_nb.partial_fit(X, y, classes=['a', 'b', 'c'])
mixed_pred = mixed_nb.predict_proba(X)
gauss_nb = GaussianNB()
gauss_nb.partial_fit(X, y, classes=['a', 'b', 'c'])
gauss_pr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_mixednb_all_nominals():\n X, y, types = _classification_task()\n\n # convert some features to nominal ones (one-hot encoded)\n X = (X > 0).astype(int)\n\n mixed_nb = MixedNB(is_nominal=[True] * 5)\n mixed_nb.partial_fit(X, y, classes=['a', 'b', 'c'])\n mixed_pred = mixed_nb.predict_proba... | [
"0.60676974",
"0.58701026",
"0.57855105",
"0.5765282",
"0.576126",
"0.56896716",
"0.56535566",
"0.56441027",
"0.5535582",
"0.5503955",
"0.54294723",
"0.53886575",
"0.5381647",
"0.53049505",
"0.53006554",
"0.5255605",
"0.5250118",
"0.52463055",
"0.5242104",
"0.52284694",
"0.52... | 0.76375735 | 0 |
The arithmetic mean radius of the ellipsoid [Moritz1988]_. | def mean_radius(self):
return 1 / 3 * (2 * self.semimajor_axis + self.semiminor_axis) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_avg_radius(self):\n return sum([cell.radius for cell in self.cells]) / len(self.cells)",
"def radius(self):\n return float(np.mean(spsd.cdist(self.mContour, [self.centroid()])))",
"def radius_of_gyration(self):\n dist = (self.coordinates - self.center_of_gravity())**2\n # My... | [
"0.7010225",
"0.6745927",
"0.6745026",
"0.66593856",
"0.6632789",
"0.66087383",
"0.66076654",
"0.6605195",
"0.6601793",
"0.65394336",
"0.6537318",
"0.6487357",
"0.64476234",
"0.64476234",
"0.63712126",
"0.6364115",
"0.6337939",
"0.63340676",
"0.6322155",
"0.63097453",
"0.6305... | 0.79927486 | 0 |
r""" The volume bounded by the ellipsoid. | def volume(self):
return (4 / 3 * np.pi) * self.semimajor_axis**2 * self.semiminor_axis | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def volume(self) -> float:\n return self.velocity / 0x7F * self.envelope.env_pos / 0xFF",
"def volume(self, boundary):\n from scipy.special import gamma\n\n cov_det = np.linalg.det(self.cov)\n n = self.mean.shape[0]\n if cov_det == 0:\n cov_eigenvals, _ = np.linalg.e... | [
"0.74802375",
"0.7397792",
"0.7389439",
"0.7322463",
"0.7307579",
"0.72970456",
"0.7206682",
"0.7185269",
"0.71257794",
"0.71257794",
"0.708158",
"0.7050687",
"0.7014027",
"0.69670635",
"0.69202864",
"0.6899688",
"0.6822103",
"0.68070513",
"0.67637056",
"0.67614615",
"0.67502... | 0.73548543 | 3 |
r""" Radial distance from the center of the ellipsoid to its surface. Can be calculated from either geocentric geodetic or geocentric spherical latitudes. | def geocentric_radius(self, latitude, geodetic=True):
latitude_rad = np.radians(latitude)
coslat, sinlat = np.cos(latitude_rad), np.sin(latitude_rad)
# Avoid doing this in favour of having the user do the conversions when
# possible. It's not the case here, so we made an exception.
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def equivalent_radius(self):\n\n return np.sqrt(self.area / np.pi)",
"def outer_rad(self):\n return math.sqrt(self.omega[0] * self.omega[0] + self.omega[1] * self.omega[1])",
"def getRadius(self):\n return _math.sqrt(self._transform._matrix[0] ** 2 + self._transform._matrix[1] ** 2)",
"d... | [
"0.67511034",
"0.6746987",
"0.6729896",
"0.6703183",
"0.66788405",
"0.66366386",
"0.657742",
"0.65234613",
"0.64344984",
"0.6415351",
"0.640958",
"0.640958",
"0.63125396",
"0.6213552",
"0.6206786",
"0.6187152",
"0.61508095",
"0.61293256",
"0.6126773",
"0.6125049",
"0.6112765"... | 0.655301 | 7 |
r""" The prime vertical radius of curvature for a given geodetic latitude. | def prime_vertical_radius(self, sinlat):
return self.semimajor_axis / np.sqrt(
1 - self.first_eccentricity**2 * sinlat**2
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def radius_of_curvature(self):\n numerator = (\n 1 + (2 * self.params_meter[0] +\n self.params_meter[1]) ** 2) ** 1.5\n denom = np.abs(2 * self.params_meter[0])\n return numerator / denom",
"def get_curvature_radius(self):\n\n def circle_equation(c, points):... | [
"0.70492214",
"0.67635655",
"0.64216214",
"0.63880104",
"0.62520355",
"0.61953664",
"0.6173887",
"0.60963255",
"0.6004972",
"0.59957004",
"0.59819365",
"0.5905147",
"0.5905147",
"0.5886512",
"0.5880188",
"0.58724016",
"0.5833002",
"0.582812",
"0.5804905",
"0.57871413",
"0.577... | 0.7709675 | 0 |
Return the track legnth in G4 steps (~0.3 mm) for event_id | def track_length_in_steps(df, event_id):
return len(df.loc[event_id]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tgpp_L(d):\r\n L_3gpp = 10*1.73*np.log10(d) \r\n return L_3gpp",
"def g_lead(E):\n if (np.abs(E)<2):\n g_l = E.real/2. - (1.0j)*np.sqrt(1 - E.real**2/4.0)\n else:\n g_l = E.real/2. * ( 1. - np.sqrt(1 - 4.0/E.real**2) )\n\n return g_l",
"def get_Rost_ID_threshold(L, n=0):\n i... | [
"0.5569295",
"0.5471247",
"0.5378131",
"0.52851146",
"0.521451",
"0.50494385",
"0.5042925",
"0.49811804",
"0.4975221",
"0.49434823",
"0.49259546",
"0.4923349",
"0.49040696",
"0.49002782",
"0.48960787",
"0.48901963",
"0.48834324",
"0.48619533",
"0.4828003",
"0.4819981",
"0.481... | 0.52927047 | 3 |
Rebins DF in nbins | def rebin_df_in_z(df, event_id=0, nbins=25):
trk = df.loc[event_id]
bins = np.linspace(trk.z.min(), trk.z.max(), nbins)
groups = trk.groupby(pd.cut(trk.z, bins))
return groups.sum().dropna() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def n_bins(self):\n return self.n_xbins*self.n_ybins",
"def calcnBins(self,binlen):\n nbins = np.int_(self._Dom.getLens()/binlen);\n return nbins;",
"def n_bins(self):\n check_is_fitted(self, 'ratemap_')\n if self.is_2d:\n return self.n_bins_x*self.n_bins_y\n ... | [
"0.6735505",
"0.6728143",
"0.66037434",
"0.6495527",
"0.64661616",
"0.6347243",
"0.6346963",
"0.62534654",
"0.6181512",
"0.61572593",
"0.61119395",
"0.60924584",
"0.60801417",
"0.60232896",
"0.5999303",
"0.59726864",
"0.59705824",
"0.59566694",
"0.5952028",
"0.59244466",
"0.5... | 0.7093004 | 0 |
get instrument by providing symbol | def get_instrument_by_symbol(self, exchange, symbol):
# get instrument given exchange and symbol
exchange = exchange.upper()
# check if master contract exists
if exchange not in self.__master_contracts_by_symbol:
logger.warning(f"Cannot find exchange {exchange} in master cont... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_instrument():\n return libraries.get_one(instruments)",
"def instrumentLookup(instrument_df,symbol):\n try:\n return instrument_df[instrument_df.tradingsymbol==symbol].instrument_token.values[0]\n except:\n return -1",
"def get_symbol(self, symbol, stats):\n\n raise NotImpleme... | [
"0.70519257",
"0.6996153",
"0.6959848",
"0.647127",
"0.62967914",
"0.6287127",
"0.62109005",
"0.6081326",
"0.6077055",
"0.59423935",
"0.5855605",
"0.58471775",
"0.57732195",
"0.57364106",
"0.57162523",
"0.5714598",
"0.5710063",
"0.57020813",
"0.56923217",
"0.56815493",
"0.567... | 0.68435234 | 3 |
returns all the tradable contracts of an exchange placed in an OrderedDict and the key is the token | def __get_master_contract(self, exchange):
logger.info(f'Downloading master contracts for exchange: {exchange}')
body = self.__api_call_helper('master_contract', Requests.GET, {
'exchange': exchange}, None)
master_contract_by_token = OrderedDict()
ma... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_contracts(self):\n return list(self.contracts.values())",
"def _get_trades_from_invokation_info(invokationInfo):\n trades = []\n selection = invokationInfo.ExtensionObject().ActiveSheet().Selection()\n cells = selection.SelectedCells()\n for cell in cells:\n rowObject = cell... | [
"0.5980953",
"0.5515319",
"0.54811895",
"0.53710115",
"0.5355424",
"0.5246912",
"0.5179106",
"0.5163035",
"0.5150849",
"0.508639",
"0.4995295",
"0.4932019",
"0.4908946",
"0.49041885",
"0.4896976",
"0.4879809",
"0.48686314",
"0.48551545",
"0.48472205",
"0.48261005",
"0.4825925... | 0.43694153 | 86 |
Returns the path to the Faereld data hord. | def data_path(self) -> str:
return self.data_options["data_path"] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_data_path(self):\n return self.__path + '/data/'",
"def get_data_path(self):\n return self.__path + '/data/'",
"def data_path(self) -> str:\n return self._get(\"data_path\", \"./data/\")",
"def data_path(self):\n return self._data_path",
"def data_path(self):\n re... | [
"0.7737139",
"0.7737139",
"0.7716077",
"0.76000476",
"0.76000476",
"0.75041324",
"0.72062963",
"0.7193365",
"0.71569324",
"0.7108676",
"0.70015883",
"0.6985482",
"0.6959545",
"0.69264954",
"0.6916056",
"0.690953",
"0.68823355",
"0.68615",
"0.68564224",
"0.6852053",
"0.6847266... | 0.7479432 | 6 |
Returns whether or not wending dates should be used. | def use_wending(self) -> bool:
return self.data_options["use_wending"] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_is_week_date(self):\n return self.week_of_year is not None",
"def is_normal_working_day(date):\n return not(is_weekend(date) or is_bank_holiday(date))",
"def is_weekend(date):\n return date.weekday() in [5, 6]",
"def is_weekend(date):\n dow = date.strftime('%A')\n if dow.lower() in... | [
"0.6412122",
"0.6310312",
"0.6294391",
"0.62643564",
"0.62135863",
"0.6129575",
"0.60798967",
"0.6062015",
"0.5974034",
"0.59125894",
"0.5842278",
"0.57917136",
"0.5740925",
"0.5678854",
"0.5655724",
"0.5644562",
"0.56436026",
"0.56405014",
"0.56359094",
"0.563573",
"0.562184... | 0.67061013 | 0 |
Returns a list of areas that should be excluded from the total time summary graph. | def exclude_from_total_time(self) -> List[str]:
return self.__validate_list(self.summary_options["exclude_from_total_time"]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exclude_from_entry_time_distribution(self) -> List[str]:\n return self.__validate_list(\n self.summary_options[\"exclude_from_entry_time_distribution\"]\n )",
"def areas(self) -> list:\n\n return [{\n 'type': 'danger',\n 'min': 0.5 if self._invert else 0.... | [
"0.61127",
"0.59857476",
"0.5757657",
"0.5703659",
"0.54751223",
"0.54660755",
"0.5448531",
"0.53874135",
"0.5382863",
"0.5304747",
"0.53028333",
"0.5248144",
"0.5213866",
"0.5210158",
"0.5199197",
"0.5154775",
"0.5148625",
"0.51442266",
"0.5132364",
"0.5128986",
"0.5128028",... | 0.68608767 | 0 |
Returns a list of areas that should be excluded from the entry time distribution summary graph. | def exclude_from_entry_time_distribution(self) -> List[str]:
return self.__validate_list(
self.summary_options["exclude_from_entry_time_distribution"]
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exclude_from_total_time(self) -> List[str]:\n return self.__validate_list(self.summary_options[\"exclude_from_total_time\"])",
"def areas(self) -> list:\n\n return [{\n 'type': 'danger',\n 'min': 0.5 if self._invert else 0.,\n 'max': 1.0 if self._invert else 0.5... | [
"0.6186427",
"0.5882262",
"0.56081635",
"0.5554754",
"0.54691106",
"0.5434723",
"0.54206824",
"0.5416648",
"0.5392452",
"0.53890705",
"0.537256",
"0.5321157",
"0.53174543",
"0.5315828",
"0.5297026",
"0.52893007",
"0.52771103",
"0.52701455",
"0.5228747",
"0.5202911",
"0.520047... | 0.69636226 | 0 |
Saves power consumption to `work_space`/result.json when exit `with` scope. | def power_monitor(work_space: Path):
base_dir = Path('/sys/class/powercap/intel-rapl')
monitors: Dict[Path, Tuple[int, Dict[Path, int]]] = dict()
while True:
socket_id = len(monitors)
socket_monitor: Path = base_dir / f'intel-rapl:{socket_id}'
if socket_monitor.exists():
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_power_save(self, power_saving, wait_for_completion=True,\n operation_timeout=None):\n body = {'power-saving': power_saving}\n result = self.manager.session.post(\n self.uri + '/operations/set-cpc-power-save',\n body,\n wait_for_completion... | [
"0.5358636",
"0.5226634",
"0.5205946",
"0.5174397",
"0.5147442",
"0.5143372",
"0.5100896",
"0.50956786",
"0.5082304",
"0.49969256",
"0.49890766",
"0.49890766",
"0.49890766",
"0.49661285",
"0.49583516",
"0.49411896",
"0.4937542",
"0.49261633",
"0.48990834",
"0.48942363",
"0.48... | 0.489297 | 20 |
Loads data for the specified city and filters by month and day if applicable. | def load_data(city, month, day):
# load data file into a dataframe
df = pd.read_csv(CITY_DATA[city])
# convert the Start Time column to datetime
df['Start Time'] = pd.to_datetime(df['Start Time'])
df['End Time'] = pd.to_datetime(df['End Time'])
#added a new column for route to help identify sta... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_city_data(city, month, day):\n df = pd.read_csv(CITY_DATA[city])\n #extract month, day, hour from start time\n df['month'] = pd.to_datetime(df['Start Time']).dt.month_name()\n df['day'] = pd.to_datetime(df['Start Time']).dt.weekday\n df['hour'] = pd.to_datetime(df['Start Time']).dt.hour\n\n... | [
"0.83178896",
"0.82271785",
"0.8151072",
"0.8080235",
"0.80429125",
"0.80179566",
"0.8001298",
"0.7991342",
"0.79796046",
"0.79779583",
"0.7972516",
"0.79575616",
"0.7956268",
"0.79487044",
"0.7931529",
"0.79190195",
"0.79130477",
"0.7911821",
"0.79051876",
"0.7903256",
"0.79... | 0.7679982 | 85 |
Displays statistics on the most frequent times of travel. | def time_stats(df):
print('\nCalculating The Most Frequent Times of Travel...\n')
start_time = time.time()
# display the most common month
months = ['January', 'February', 'March', 'April', 'May', 'June']
popular_month_index = df['month'].mode()[0]-1
popular_month = months[popular_month_index]... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def time_stats(df):\r\n\r\n print('\\nThese are the statistics of the most frequent times of travel:\\n')\r\n start_time = time.time()\r\n\r\n # Display the most common month\r\n common_month = df['month'].mode()[0]\r\n print(\"- That's the most common month based on your selection: \" +\r\n ... | [
"0.79738975",
"0.785072",
"0.7799575",
"0.7781705",
"0.777433",
"0.77618814",
"0.7752622",
"0.773785",
"0.77256924",
"0.7717415",
"0.76847285",
"0.76830196",
"0.76803225",
"0.76792395",
"0.76495826",
"0.76443416",
"0.76433015",
"0.76420736",
"0.7623836",
"0.762375",
"0.762077... | 0.7629134 | 18 |
Displays statistics on the most popular stations and trip. | def station_stats(df):
print('\nCalculating The Most Popular Stations and Trip...\n')
start_time = time.time()
# display most commonly used start station
popular_start_station = df['Start Station'].mode()[0]
print('Most common starting station is: {}'.format(popular_start_station))
# display... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def station_stats(df):\n\n print('\\033[1m' + 'Calculating the most popular stations and trip...\\n' + '\\033[0m')\n start_time = time.time()\n\n # display the most commonly used start station\n\n start_stn = df['Start Station'].mode()[0]\n print('Most popular start station is {}.'.format(start_stn)... | [
"0.7810575",
"0.7673542",
"0.75394845",
"0.7498561",
"0.74905",
"0.7489439",
"0.7437802",
"0.7430209",
"0.7427633",
"0.742577",
"0.7412994",
"0.7405705",
"0.7382886",
"0.73795676",
"0.7374806",
"0.7366361",
"0.73567265",
"0.7352103",
"0.73054034",
"0.7300194",
"0.7298145",
... | 0.7324468 | 18 |
Displays statistics on the total and average trip duration. | def trip_duration_stats(df):
print('\nCalculating Trip Duration...\n')
start_time = time.time()
# display total travel time
total_trip_time_seconds = int(df['Trip Duration'].sum(axis = 0))
counter = total_trip_time_seconds
print('Total trip time across all trips is: {} seconds'.format(total_tr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trip_duration_stats(df):\r\n\r\n print('\\nThese are the statistics related to the trips durations:\\n')\r\n start_time = time.time()\r\n\r\n # Display total travel time\r\n total_travel_time = df['Trip Duration'].sum()\r\n print(\"\\n- The total travel time based on your selection is: \" +\r\n ... | [
"0.82698804",
"0.81186754",
"0.80481917",
"0.80468994",
"0.79780424",
"0.7962861",
"0.7959512",
"0.7946294",
"0.7936397",
"0.7929802",
"0.79278564",
"0.79269135",
"0.79246616",
"0.79200053",
"0.79158986",
"0.7915428",
"0.7913144",
"0.79076344",
"0.7903745",
"0.79023826",
"0.7... | 0.0 | -1 |
Encodes a tree to a single string. | def serialize(self, root: TreeNode) -> str:
if not root:
return ''
res = [self.serialize(root.left), root.val, self.serialize(root.right)]
return str(res) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encodeTree(self, tree, key):\n return self.encode(pickle.dumps(tree), key)",
"def serialize(self, root):\n if not root:\n return \"n\"\n s = \"\"\n stack = [root]\n while (stack):\n root = stack.pop(0)\n if root:\n s += str(ro... | [
"0.7828333",
"0.7516194",
"0.7130745",
"0.7053523",
"0.70320904",
"0.6999996",
"0.6999551",
"0.69677454",
"0.6933976",
"0.68666923",
"0.68547064",
"0.6809873",
"0.6801734",
"0.67982674",
"0.6774328",
"0.6767003",
"0.6755286",
"0.67515373",
"0.6745571",
"0.6665223",
"0.6665223... | 0.6884711 | 9 |
Encodes a tree to a single string. | def serialize(self, root: TreeNode) -> str:
def root_left_right(r):
if not r:
return []
return [r.val] + root_left_right(r.left) + root_left_right(r.right)
return str(root_left_right(root)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encodeTree(self, tree, key):\n return self.encode(pickle.dumps(tree), key)",
"def serialize(self, root):\n if not root:\n return \"n\"\n s = \"\"\n stack = [root]\n while (stack):\n root = stack.pop(0)\n if root:\n s += str(ro... | [
"0.78278124",
"0.7515946",
"0.71304095",
"0.7053364",
"0.7031874",
"0.6999469",
"0.6999095",
"0.69332165",
"0.68838483",
"0.68657243",
"0.68548083",
"0.6809354",
"0.6801677",
"0.67984694",
"0.6773517",
"0.6766546",
"0.6754318",
"0.67507386",
"0.6745785",
"0.6664641",
"0.66646... | 0.69672054 | 7 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.