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 |
|---|---|---|---|---|---|---|
Get a list of existing Expenses, excluding the file attachments, that match the parameters. | def get(self, updated_at=None, settled_at=None, reimbursed_at=None, approved_at=None, state=None, offset=None,
verified=None, limit=None, fund_source=None, settlement_id=None):
return self._get_request({
'updated_at': updated_at,
'offset': offset,
'limit': limit,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_expenses(self, parameter=None):\n resp = zoho_http_client.get(base_url, self.details, self.headers, parameter)\n return parser.get_list(resp)",
"def get_queryset(self):\n user = self.request.user\n expenses = Expense.objects.filter(\n Q(userexpense__in=user.userexpe... | [
"0.68700606",
"0.5883191",
"0.58421665",
"0.56430805",
"0.5616613",
"0.54840475",
"0.54749477",
"0.54318",
"0.54196596",
"0.5229155",
"0.51613057",
"0.51613057",
"0.51501995",
"0.51189023",
"0.5077726",
"0.5045827",
"0.50404114",
"0.5034724",
"0.4977987",
"0.49505383",
"0.492... | 0.47741264 | 32 |
Get an Expense by Id including the file attachments. | def get_by_id(self, expense_id):
return self._get_request({}, Expenses.GET_EXPENSE_BY_ID.format(expense_id)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_attachments(self, expense_id):\n return self._get_request({}, Expenses.GET_EXPENSE_ATTACHMENTS.format(expense_id))",
"def get(self, expense_id):\n url = base_url + expense_id\n resp = zoho_http_client.get(url, self.details, self.headers)\n return parser.get_expense(resp)",
"... | [
"0.7257534",
"0.69819826",
"0.6602596",
"0.6230637",
"0.6055695",
"0.56958026",
"0.5655677",
"0.56548846",
"0.55900764",
"0.5537572",
"0.55257964",
"0.5494994",
"0.5471183",
"0.54495466",
"0.5415153",
"0.53838104",
"0.5374669",
"0.5351743",
"0.5349956",
"0.53443354",
"0.53412... | 0.739249 | 0 |
Creates a sizex by sizey matrix filled with zeros. | def make_matrix(sizex, sizey):
return [[0] * sizey for i in range(sizex)] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def matrix_init(sizex, sizey):\n return [[0]*sizey for i in range(sizex)]",
"def make_matrix(sizex, sizey):\n return [[0]*sizey for i in xrange(sizex)]",
"def zeroes(height, width):\n g = [[0.0 for _ in range(width)] for __ in range(height)]\n return Matrix(g)",
"def zeroMatrix(width, hei... | [
"0.8044378",
"0.7826062",
"0.7141801",
"0.71086985",
"0.70619905",
"0.7058825",
"0.63757265",
"0.6285351",
"0.6129874",
"0.6119288",
"0.6119288",
"0.6112796",
"0.6047175",
"0.59919316",
"0.5989762",
"0.5955519",
"0.5932239",
"0.5928885",
"0.58918095",
"0.5875584",
"0.5867596"... | 0.79192764 | 1 |
Stores a keyvalue dict into /settingsname.json file. | def StoreSettings(self, name, settings):
assert(isinstance(settings, dict))
file_path = os.path.join(self._root, Storage._SETTINGS_FILE % name)
if not settings:
if os.path.exists(file_path):
os.unlink(file_path)
return
with open(file_path, 'w') as f:
return json.dump(settings, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_settings(dic):\n json.dump(dic, open(\"resources/files/settings.txt\", \"w\"))\n\n # LEGACY\n # with open(\"resources/files/settings.txt\", \"w\", newline=\"\\n\") as w:\n # for sett, val in dic.items():\n # w.write(sett + '\\\\' + val + '\\n')",
"def save(... | [
"0.7391012",
"0.7266963",
"0.71199477",
"0.70493007",
"0.70454943",
"0.69322",
"0.68625546",
"0.6817008",
"0.6800389",
"0.6796468",
"0.67484325",
"0.6702263",
"0.6700651",
"0.6657715",
"0.6652475",
"0.6641371",
"0.6504202",
"0.64827096",
"0.64824116",
"0.6387421",
"0.63624173... | 0.77765596 | 0 |
Returns unicode string containing value of environment variable 'name'. | def getenv(name, default=None):
return os.environ.get(name, default) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def environment_variable_string(self, name):\n return \"$(\" + name + \")\"",
"def env_variable(self, name: str) -> Optional[str]:\n _args = [\n Arg(\"name\", name),\n ]\n _ctx = self._select(\"envVariable\", _args)\n return _ctx.execute_sync(Optional[str])",
"def ... | [
"0.71761024",
"0.71666235",
"0.6773447",
"0.67152184",
"0.65080357",
"0.6498964",
"0.6367053",
"0.61921793",
"0.6187177",
"0.615336",
"0.61046773",
"0.6100471",
"0.60977054",
"0.60636157",
"0.59212136",
"0.59068537",
"0.5893045",
"0.5887073",
"0.5873262",
"0.58180267",
"0.576... | 0.55107737 | 40 |
Logically right shifts value by n places. | def lrshift(val, n) -> np.int64:
return (val % (1 << 64)) >> n | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rshift(val, n):\n return (val % 0x100000000) >> n",
"def rshift(val, n):\n return (val % 0x100000000) >> n",
"def rshift(val: int, n: int) -> int:\n return (val % 0x100000000) >> n",
"def shift(a, n=1):\n return a[n:] + a[:n]",
"def vec_shift_right_n(x, n):\n return jnp.zeros_like(x)... | [
"0.80633104",
"0.80633104",
"0.79947037",
"0.7463259",
"0.7394932",
"0.6925711",
"0.68830913",
"0.67560947",
"0.6657734",
"0.6643168",
"0.6629813",
"0.6608858",
"0.65974516",
"0.6545955",
"0.6536871",
"0.6466921",
"0.64534676",
"0.6407731",
"0.6394487",
"0.6388541",
"0.635112... | 0.7938684 | 3 |
Set the Weapons totalAmmo state | def setTotalAmmoForWeapons(self):
for myWeapon in self.activeWeapons:
myWeapon.setTotalAmmo()
for myWeapon in self.amsWeapons:
myWeapon.setTotalAmmo() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reloadAmmo(self):\n for componentID, myComponent in self.components.iteritems():\n if myComponent.myComponentData.maxAmmo > 0:\n myComponent.currentAmount = myComponent.myComponentData.maxAmmo",
"def setMyStatus(self):\n self.clearMyStatus()\n for id, myComponen... | [
"0.70450485",
"0.6242401",
"0.6228078",
"0.6047097",
"0.58896303",
"0.5876648",
"0.5814055",
"0.579145",
"0.56938505",
"0.56286377",
"0.5623901",
"0.56091434",
"0.55547535",
"0.5504194",
"0.5488021",
"0.54642916",
"0.5455545",
"0.54522663",
"0.5409598",
"0.53584224",
"0.52797... | 0.851958 | 0 |
Set the Galaxy Object Owner of this Ship | def setMyGalaxy(self, galaxyObject):
self.myGalaxy = galaxyObject
galaxyObject.ships[self.id] = self | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_owner(self, owner):\n self.__owner = owner",
"def owner(self, owner):\n self._owner = owner",
"def owner(self, owner):\n self._owner = owner",
"def owner(self, owner):\n self._owner = owner",
"def owner(self, owner):\n self._owner = owner",
"def owner(self, owne... | [
"0.71902525",
"0.69705766",
"0.69705766",
"0.69705766",
"0.69705766",
"0.69080186",
"0.69080186",
"0.69080186",
"0.69080186",
"0.6906991",
"0.68075526",
"0.6619635",
"0.6297075",
"0.6271582",
"0.61416644",
"0.60078526",
"0.5973551",
"0.5957543",
"0.5897426",
"0.5821753",
"0.5... | 0.67367876 | 11 |
Predict action probabilities given states. | def predict_proba(states):
# convert states, compute logits, use softmax to get probability
predicted = agent(torch.Tensor(states))
probs = F.softmax(predicted).data.numpy()
return probs | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def predict(self, states, actions):\n obs = normalize(states,self.normalization['observations'][0],self.normalization['observations'][1])\n #delta = normalize(delta,normalization['delta'])\n acs = normalize(actions,self.normalization['actions'][0],self.normalization['actions'][1])\n don... | [
"0.7889162",
"0.7832179",
"0.7518147",
"0.73917705",
"0.738475",
"0.73525226",
"0.7326451",
"0.7172609",
"0.6978528",
"0.6968039",
"0.6906683",
"0.6872568",
"0.6853886",
"0.67995584",
"0.6768523",
"0.67283815",
"0.6702249",
"0.6667121",
"0.66327345",
"0.6601041",
"0.65962446"... | 0.73138726 | 7 |
take a list of immediate rewards r(s,a) for the whole session compute cumulative returns (a.k.a. G(s,a) in Sutton '16) G_t = r_t + gammar_{t+1} + gamma^2r_{t+2} + ... The simple way to compute cumulative rewards is to iterate from last to first time tick and compute G_t = r_t + gammaG_{t+1} recurrently You must return ... | def get_cumulative_rewards(rewards, # rewards at each step
gamma=0.99 # discount for reward
):
cumulative_rewards = []
prev = 0
for r in reversed(rewards):
prev = r + gamma * prev
cumulative_rewards.append(prev)
cumulat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_cumulative_rewards(rewards, # rewards at each step\n gamma=0.99 # discount for reward\n ):\n\n cumulative_rewards = np.empty_like(rewards)\n cumulative_rewards = cumulative_rewards.astype(float)\n cumulative_rewards[-1] = rewards[-1]\n\n for... | [
"0.8086463",
"0.75221175",
"0.74989986",
"0.7120142",
"0.7040207",
"0.6970117",
"0.69169426",
"0.68208987",
"0.6805671",
"0.6779615",
"0.6777824",
"0.6775084",
"0.6762717",
"0.6722188",
"0.6722188",
"0.67143553",
"0.6705431",
"0.6679104",
"0.6675288",
"0.66531205",
"0.6645495... | 0.7958346 | 1 |
Take an integer vector (tensor of variable) and convert it to 1hot matrix. | def to_one_hot(y, n_dims=None):
y_tensor = y.data if isinstance(y, Variable) else y
y_tensor = y_tensor.type(torch.LongTensor).view(-1, 1)
n_dims = n_dims if n_dims is not None else int(torch.max(y_tensor)) + 1
y_one_hot = torch.zeros(y_tensor.size()[0], n_dims).scatter_(1, y_tensor, 1)
return ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_one_hot(v):\n n = len(v)\n m = max(v) + 1\n out = np.zeros((n, m))\n out[np.arange(n), v] = 1\n return out",
"def one_hot_encode(vector, values = 10):\n n = len(vector)\n out = numpy.zeros( (n, values) )\n out[range(n), vector] = 1\n return out",
"def convert_to_onehot(vector,... | [
"0.8391626",
"0.7929691",
"0.7789748",
"0.77540445",
"0.76539844",
"0.7617844",
"0.7534543",
"0.7510506",
"0.74716616",
"0.74194384",
"0.72777975",
"0.7276192",
"0.7221585",
"0.72042435",
"0.71805406",
"0.7138245",
"0.71158314",
"0.7106408",
"0.71049434",
"0.70753795",
"0.707... | 0.0 | -1 |
return true if given entry is equal to the default one | def is_default(self, entry: str):
if entry == self.default_entry:
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_default(self):\r\n return self.default is not None",
"def isDefault (self):\n val = self.__getattribute__('StoredValue')\n dft = self.__class__.StoredValue\n return val==dft",
"def selected(self, key):\n default = self.default\n if not default:\n ret... | [
"0.6521376",
"0.6338704",
"0.63305163",
"0.63305163",
"0.6317462",
"0.6317462",
"0.6317462",
"0.6310651",
"0.6307207",
"0.61208886",
"0.60462457",
"0.5967732",
"0.5884814",
"0.5872585",
"0.585515",
"0.585515",
"0.5801563",
"0.5794065",
"0.5731509",
"0.5726565",
"0.57056355",
... | 0.85995895 | 0 |
Do not return anything, modify rooms inplace instead. | def wallsAndGates(self, rooms: List[List[int]]) -> None:
def get_gates(rooms):
res = []
M, N = len(rooms), len(rooms[0])
for i in range(M):
for j in range(N):
if rooms[i][j] == 0:
res.append((i, j))
retur... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rooms(self, rooms):\n\n self._rooms = rooms",
"def _add_rooms(self):\r\n rooms = self.model.get_all_rooms()\r\n\r\n for room in rooms:\r\n self._add_room(room)",
"def rooms(*args):\n send.system_message('\\n'.join(rooms()))",
"def all_rooms(self):\n pass",
... | [
"0.67922723",
"0.6150443",
"0.5985418",
"0.59520423",
"0.5938853",
"0.5910455",
"0.5802791",
"0.5788961",
"0.57677865",
"0.56960684",
"0.56584203",
"0.56518275",
"0.5649922",
"0.56375164",
"0.5580176",
"0.5570199",
"0.5540112",
"0.5534412",
"0.5534412",
"0.5529608",
"0.549605... | 0.0 | -1 |
Change the amount of reactions required to starboard a message. | async def starboard_amount(self, ctx, amount: int):
await queries.update_setting(ctx, "starboard_settings", "reaction_count", amount)
emoji_name, emoji_id, emoji_type = await self.bot.db.execute(
"""
SELECT emoji_name, emoji_id, emoji_type
FROM starboard_settings WHER... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def reactions(self, ctx):\n\n\t\tawait self.message_leaderboard(ctx, \"reactions\")",
"def add_reactions(_) -> int:\n return 1 << 6",
"def add_reactions(_) -> int:\n return 1 << 6",
"def replenish(self, amount: int):\n self._inventory += amount",
"def update_recruiting(self, rate... | [
"0.63772947",
"0.6179722",
"0.6179722",
"0.5825801",
"0.58167845",
"0.560417",
"0.5564357",
"0.5545454",
"0.55370396",
"0.5528173",
"0.5518888",
"0.55142504",
"0.55124456",
"0.5497931",
"0.54795575",
"0.54564846",
"0.54389095",
"0.54326606",
"0.5426115",
"0.54188395",
"0.5386... | 0.75119036 | 0 |
Show everything that's currently blacklisted. | async def blacklist_show(self, ctx):
content = discord.Embed(
title=f":scroll: {ctx.guild.name} Blacklist", color=int("ffd983", 16)
)
blacklisted_channels = await self.bot.db.execute(
"""
SELECT channel_id FROM blacklisted_channel WHERE guild_id = %s
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def blacklist_show(self, ctx: commands.Context, target):\r\n table = \"user_blacklist\" if isinstance(target, discord.User) else \"guild_blacklist\"\r\n check = await self.check_user(target.id, table)\r\n\r\n if check[0]:\r\n embed = discord.Embed(color=self.bot.colors.neutral... | [
"0.65985954",
"0.65490836",
"0.62632304",
"0.61212635",
"0.6108291",
"0.6012549",
"0.60075045",
"0.59662694",
"0.59497046",
"0.58699954",
"0.58676314",
"0.5832256",
"0.5816947",
"0.576713",
"0.5729382",
"0.57143086",
"0.57090116",
"0.57025844",
"0.56993335",
"0.56980777",
"0.... | 0.712458 | 0 |
Blacklist a guild from adding or using Miso Bot. | async def blacklist_guild(self, ctx, guild_id: int, *, reason):
guild = self.bot.get_guild(guild_id)
if guild is None:
raise exceptions.Warning(f"Cannot find guild with id `{guild_id}`")
await self.bot.db.execute(
"INSERT IGNORE blacklisted_guild VALUES (%s, %s)", guild.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def blacklist_add(self, ctx: commands.Context, target, *, reason: str = \"No reason given.\"):\r\n table = \"user_blacklist\" if isinstance(target, discord.User) else \"guild_blacklist\"\r\n guild = None\r\n\r\n try:\r\n check = await self.check_user(target.id, table)\r\n ... | [
"0.7025446",
"0.6901747",
"0.67592144",
"0.6756971",
"0.67436916",
"0.6689396",
"0.6515071",
"0.64903665",
"0.64557445",
"0.6422643",
"0.63652575",
"0.6328226",
"0.62941444",
"0.62683487",
"0.6249026",
"0.6137371",
"0.6133096",
"0.6083395",
"0.6079908",
"0.60692376",
"0.60347... | 0.8500234 | 0 |
Whitelist a member of this server. | async def whitelist_member(self, ctx, *members):
successes = []
fails = []
for member_arg in members:
try:
member = await commands.MemberConverter().convert(ctx, member_arg)
except commands.errors.BadArgument:
fails.append(f"Cannot find mem... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setWhitelist(self, w):\n return self._set(whitelist=w)",
"def retrieveWhitelist(self):\n members = self.con.getWhiteList()\n guilds = self.con.getGuildsInfo()\n\n for item in guilds:\n self.whitelist[item.split(',')[0]] = []\n\n for member in members:\n ... | [
"0.63895625",
"0.63019365",
"0.6277634",
"0.61892426",
"0.595784",
"0.58550394",
"0.5836929",
"0.5835141",
"0.57601684",
"0.5742741",
"0.5722418",
"0.56911397",
"0.5679584",
"0.5674961",
"0.56423336",
"0.5610417",
"0.55831367",
"0.5577368",
"0.55765194",
"0.55751",
"0.5507816... | 0.7015941 | 0 |
Mock UDP's appendToQueue and check for requesting update | def mock_appendToQueue_sendupdate(self, msg, label, handler = None):
command = unpack('>i',msg[0:4])[0]
check_command(src.drivers.hyundai_robot.Commands, command)
assert label == "send_update"
assert command == src.drivers.hyundai_robot.Commands.update | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_send_play(self):\n\n with patch.object(socket.socket, 'connect', return_value=True) as mock_connect, \\\n patch.object(socket.socket, 'bind', return_value=True) as mock_bind:\n src.drivers.hyundai_robot.udp = UdpConnector(\"localhost\", 8000)\n\n with patch.object(UdpCo... | [
"0.66058403",
"0.6385516",
"0.62901187",
"0.622264",
"0.6194493",
"0.6157991",
"0.60360336",
"0.60092777",
"0.5989119",
"0.5978262",
"0.59041816",
"0.57624495",
"0.57538354",
"0.57331836",
"0.57075644",
"0.5676246",
"0.5675813",
"0.5675242",
"0.56727403",
"0.5664446",
"0.5622... | 0.6392975 | 1 |
Return repr for the module. The method is deprecated. The import machinery does the job itself. | def module_repr(*args,**kw):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def module_repr(module): # reliably restored by inspect\n pass",
"def module_repr(module): # reliably restored by inspect\n pass",
"def module_repr(module): # reliably restored by inspect\n pass",
"def __repr__(self) -> str:\n return f\"<Module[{self.path}]>\"",
"def __repr__(se... | [
"0.81104344",
"0.81104344",
"0.81104344",
"0.7502372",
"0.73999244",
"0.68969315",
"0.67722857",
"0.65842247",
"0.6581517",
"0.6531543",
"0.652574",
"0.6469559",
"0.63845503",
"0.634502",
"0.63084537",
"0.6306228",
"0.62950504",
"0.62477756",
"0.6235535",
"0.61757797",
"0.614... | 0.7779252 | 3 |
Make robot turn left with specified speed | def left(self, speed):
vrep.simxSetJointTargetVelocity(self.client_id, self.handles['rollingJoint_rr' + self.postfix], -speed,
ONE_SHOT_MODE)
vrep.simxSetJointTargetVelocity(self.client_id, self.handles['rollingJoint_rl' + self.postfix], speed,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def spin_left(self, speed, degrees):\n print('turn left')\n self.robot.drive_system.right_motor.turn_on(-speed)\n self.robot.drive_system.left_motor.turn_on((speed))\n while True:\n if self.robot.drive_system.right_motor.get_position() / 5.5 >= \\\n degrees... | [
"0.78519845",
"0.7689447",
"0.76865536",
"0.76785344",
"0.7640258",
"0.76204324",
"0.7557581",
"0.7552755",
"0.747823",
"0.747823",
"0.73890245",
"0.7382144",
"0.7374836",
"0.7309489",
"0.7309489",
"0.72742915",
"0.7262627",
"0.7217074",
"0.7181926",
"0.7148702",
"0.71332186"... | 0.75868 | 6 |
Predicts magnitudes using MLE solution. M = number of new times to predict at. | def predict_MLE(self,new_times: ndarray) -> ndarray:
return self._pred_mag(self.mle_params,new_times) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _compute_linear_magnitude_term(index, M):\r\n if M <= c1:\r\n # this is the second term in eq. (2a), p. 20\r\n return a2 * (M - c1)\r\n else:\r\n # this is the second term in eq. (2b), p. 20\r\n return a7 * (M - c1)",
"def _compute_linear_magnitude_te... | [
"0.60314214",
"0.60314214",
"0.5845118",
"0.5772501",
"0.5654936",
"0.5633334",
"0.5606032",
"0.5600543",
"0.55962795",
"0.5563785",
"0.5506784",
"0.5504023",
"0.5456974",
"0.5453483",
"0.54316205",
"0.5401311",
"0.537555",
"0.53697044",
"0.53692",
"0.5354078",
"0.53449476",
... | 0.700783 | 0 |
Create the soft and initial target updates. The initial model parameters are assumed to be stored under the scope name "model", while the target policy parameters are assumed to be under the scope name "target". If an additional outer scope was provided when creating the policies, they can be passed under the `scope` p... | def _setup_target_updates(model_scope, target_scope, scope, tau, verbose):
if scope is not None:
model_scope = scope + '/' + model_scope
target_scope = scope + '/' + target_scope
return get_target_updates(
get_trainable_vars(model_scope),
get_trainable_va... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_soft_target_model_updates(target, source, tau):\n target_weights = target.get_weights()\n tau_values = np.ones(np.shape(target_weights)) * tau\n new_weights = (1 - tau_values) * target.get_weights() + tau_values * source.get_weights()\n target.set_weights(new_weights)\n return target",
"de... | [
"0.645382",
"0.61740875",
"0.6157597",
"0.59934604",
"0.59701246",
"0.5942507",
"0.5878838",
"0.5859867",
"0.5840106",
"0.58148605",
"0.5741857",
"0.57210577",
"0.57175577",
"0.57059765",
"0.5701641",
"0.56678057",
"0.56235176",
"0.56175566",
"0.5609587",
"0.5581089",
"0.5522... | 0.7070774 | 0 |
This function prints and plots the confusion matrix. Normalization can be applied by setting `normalize=True`. | def plot_confusion_matrix(cm, classes,
normalize=False,
title='Confusion matrix',
cmap=plt.cm.Blues):
plt.imshow(cm, interpolation='nearest', cmap=cmap)
plt.title(title)
plt.colorbar()
tick_marks = np.arange(len(classes))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_confusion_matrix(cm, classes=[0,1], normalize=False, title='Confusion matrix', print_matrix=False):\n\n if normalize:\n cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]\n print(\"Normalized confusion matrix\")\n else:\n print('Confusion matrix, without normalization')\n\n... | [
"0.819363",
"0.8094859",
"0.8028102",
"0.8018164",
"0.799278",
"0.79902315",
"0.7979656",
"0.7974647",
"0.79595697",
"0.7956129",
"0.7936602",
"0.79336774",
"0.7933392",
"0.79303294",
"0.79252326",
"0.7923459",
"0.79230803",
"0.79221183",
"0.79218185",
"0.7921176",
"0.7916744... | 0.78425056 | 56 |
Return list of dates where pitcher was active | def get_all_pitch_dates(self, name, team=None, year=None):
if not team:
team = self.get_player_team(name, year)
abbr = convert_name(team, how='abbr')
dates = self.get_past_game_dates_by_team(abbr, year)
active_dates = []
for date in dates:
if date == sel... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dates(self):\n dates = []\n d = self.date_a\n while d < self.date_b:\n dates.append(d)\n d += datetime.timedelta(1)\n\n return dates",
"def getSelectedDates(view):\n context = aq_inner(view.context)\n request = view.request\n ctx_selected... | [
"0.5938734",
"0.5932109",
"0.59259075",
"0.58879143",
"0.58033705",
"0.5781242",
"0.5707196",
"0.56895435",
"0.56295574",
"0.56178856",
"0.55789536",
"0.5545584",
"0.5545584",
"0.552718",
"0.5431489",
"0.5424563",
"0.54220444",
"0.54182255",
"0.5396042",
"0.5300514",
"0.52981... | 0.7033805 | 0 |
Find the last day where a pitcher was active | def get_last_pitch_date(self, name, team=None, year=None):
abbr = convert_name(team, how='abbr')
dates = self.get_past_game_dates_by_team(abbr, year)
for date in dates:
if date == self._day:
continue
game = list(self._db.Games.find({'$and': [{'date': date... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_last_update(self):\n return self.ticker.all().order_by('-created').first()",
"def test_last_tracking():\n yoga_last_day = analytics.last_day(yoga_habits_trackings())\n run_last_day = analytics.last_day(run_habits_trackings())\n read_last_day = analytics.last_day(read_habits_trackings())\n... | [
"0.5711776",
"0.5698133",
"0.56919146",
"0.5663159",
"0.5658922",
"0.56453675",
"0.5644211",
"0.5573224",
"0.5535718",
"0.5504673",
"0.54723215",
"0.5463215",
"0.54433113",
"0.54253143",
"0.5425239",
"0.54232335",
"0.5416583",
"0.5416504",
"0.54094905",
"0.53894705",
"0.53715... | 0.67224115 | 0 |
self.name = name self.tuition = tuition self.school_nid = school_nid self.course_to_teacher_list = course_to_teacher_list | def create_classes():
try:
print('创建班级'.center(60,'='))
#获取学校信息
school_list = School.get_all_obj_list()
for k,obj in enumerate(school_list):
print(k,obj,obj.addr)
sid = int(input('请输入学校:'))
school_obj = school_list[sid]
#显示课程,老师
print("课程,老... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n self.title = ''\n self.desc = '';\n self.course_number = ''\n self.duration = ''\n self.difficulty = ''\n self.instructors = ''\n self.url = ''",
"def __init__(self,student_id,lname,fname, major='Computer Science',gpa='0.0'):\n super()... | [
"0.67881155",
"0.6524761",
"0.63890845",
"0.6303851",
"0.6259323",
"0.62468433",
"0.6225434",
"0.6207888",
"0.62008864",
"0.61922985",
"0.6184403",
"0.61766523",
"0.61605144",
"0.6149303",
"0.6149108",
"0.6109819",
"0.6108552",
"0.6073387",
"0.60622895",
"0.60600847",
"0.6058... | 0.57642525 | 78 |
self.name = name self.tuition = tuition self.school_nid = school_nid self.course_to_teacher_list = course_to_teacher_list | def show_classes():
for obj in Classes.get_all_obj_list():
print('\033[33;1m[%s] [%s]校区 [%s]班级 学费[%s]\033[0m'.center(60, '-') \
% (obj.school_nid.get_obj_by_uuid().name, obj.school_nid.get_obj_by_uuid().addr, \
obj.name, obj.tuition)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n self.title = ''\n self.desc = '';\n self.course_number = ''\n self.duration = ''\n self.difficulty = ''\n self.instructors = ''\n self.url = ''",
"def __init__(self,student_id,lname,fname, major='Computer Science',gpa='0.0'):\n super()... | [
"0.6790343",
"0.652603",
"0.63902026",
"0.6305184",
"0.62612915",
"0.6248922",
"0.6226531",
"0.6210152",
"0.62022144",
"0.6194834",
"0.61859584",
"0.6177822",
"0.61626047",
"0.6150958",
"0.6150443",
"0.6111754",
"0.61105824",
"0.6074458",
"0.6063772",
"0.6061513",
"0.605565",... | 0.0 | -1 |
Sends a 401 response that enables basic auth | def authenticate():
return send_msg(
401,
'Must be connected',
headers={'WWW-Authenticate': 'Basic realm="Login Required"'}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authenticate():\n return Response('Not Authorized', 401, {'WWW-Authenticate': 'Basic realm=\"api\"'})",
"def authenticate():\n return Response(\n '', 401, {'WWW-Authenticate': 'Basic realm=\"Login Required\"'}\n )",
"def authenticate():\n return Response(\n 'You have to login with pro... | [
"0.8093693",
"0.8092711",
"0.79585856",
"0.7851594",
"0.7842797",
"0.78244835",
"0.78108114",
"0.78108114",
"0.78108114",
"0.78108114",
"0.78108114",
"0.78108114",
"0.78108114",
"0.78108114",
"0.78108114",
"0.78108114",
"0.78108114",
"0.78108114",
"0.78108114",
"0.78108114",
... | 0.76496667 | 40 |
Returns one user with matching id. | def delete_user(id):
user = Users.query.filter_by(id=id).first()
user.delete()
if not user:
return send_msg(404, 'Not Found')
return send_msg(204, "No data") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_single_user(self, id):\n for user in self.users:\n if user['id'] == id:\n return user",
"def get_user_by_id(self, id):\n\t\treturn self.users.get(id)",
"def find_user_by_id(id: str) -> User:\n\n # Find the id user in the database, else return None\n return... | [
"0.8888429",
"0.88077277",
"0.8797549",
"0.86952883",
"0.8579153",
"0.8569088",
"0.85048705",
"0.84092164",
"0.8404867",
"0.8320808",
"0.83021873",
"0.82902527",
"0.82658464",
"0.8229495",
"0.8221075",
"0.81859285",
"0.81743693",
"0.81743693",
"0.81743693",
"0.81743693",
"0.8... | 0.0 | -1 |
Returns one user with matching id. | def show_user(id):
user = Users.query.filter_by(id=id).first()
if not user:
return send_msg(404, 'Not Found')
user = user.as_dict()
user.pop('password')
return json.dumps(user) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_single_user(self, id):\n for user in self.users:\n if user['id'] == id:\n return user",
"def get_user_by_id(self, id):\n\t\treturn self.users.get(id)",
"def find_user_by_id(id: str) -> User:\n\n # Find the id user in the database, else return None\n return... | [
"0.8889121",
"0.8807574",
"0.8797205",
"0.8696181",
"0.8580564",
"0.85707647",
"0.85052776",
"0.8409932",
"0.84043556",
"0.83213866",
"0.83031476",
"0.8290722",
"0.82670933",
"0.82302195",
"0.82213426",
"0.8188063",
"0.81753683",
"0.81753683",
"0.81753683",
"0.81753683",
"0.8... | 0.0 | -1 |
data filter the stopWords and tokenizer | def load_data(file_name=None):
pos_review = pickle.load(open(file_name + 'pos_review.pkl', 'r'))
neg_review = pickle.load(open(file_name + 'neg_review.pkl', 'r'))
return pos_review, neg_review | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def preprocessing(data):\n #tokenizer = RegexpTokenizer(r'\\w+') # allow charachter only\n #words = tokenizer.tokenize(data) # tokenize : convert to words\n words = word_tokenize(data)\n # remove stop words & stemming\n new_words = []\n for word in words:\n if word not in stop_words:\n ... | [
"0.7715461",
"0.7242338",
"0.7221695",
"0.71253127",
"0.7072814",
"0.7045501",
"0.69890803",
"0.6890586",
"0.6843587",
"0.6807405",
"0.68034154",
"0.67726564",
"0.6750019",
"0.6739282",
"0.66622984",
"0.6654611",
"0.6629153",
"0.66100484",
"0.65764934",
"0.6556999",
"0.654207... | 0.0 | -1 |
Converts a binary OPF file (.dat or .opf) to a .json file. | def opf2json(opf_path: str, output_file: Optional[str] = None) -> None:
logger.info("Converting file: %s ...", opf_path)
header_format = "<iii"
header_size = struct.calcsize(header_format)
with open(opf_path, "rb") as f:
header_data = struct.unpack(header_format, f.read(header_size))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def verilog_to_json(verilog_filename, json_filename):\n system(f'yosys -p \"read_verilog {verilog_filename}\" '\n '-p \"write_json {json_filename}\"')",
"def dict_2_json(obj, filename):\n\twith open('data/output/' + filename, 'w') as fp:\n\t\tjson.dump(obj, fp, indent=4)",
"def to_bin_json(self, j... | [
"0.6118258",
"0.6042721",
"0.59791267",
"0.5867365",
"0.5807094",
"0.57787466",
"0.5758677",
"0.5737004",
"0.57077307",
"0.5640802",
"0.55905616",
"0.55708736",
"0.5537253",
"0.5508185",
"0.54944956",
"0.5476644",
"0.5473966",
"0.5452779",
"0.5449527",
"0.54450536",
"0.543474... | 0.7183994 | 0 |
Calculate the simple moving average for values of given dataframe. | def get_sma(data):
if data is None:
raise EmptyDataError('[!] Invalid data value')
result = TA.SMA(data)
if result is None:
raise IndicatorException
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __calculate_moving_average(self,df):\n for m in Config.moving_average_conf:\n if m['type']=='simple':\n df[m['label']]=round(df[Config.PRICE_COL].rolling(window=m['days']).mean(),2)\n else:\n df[m['label']]=round(df[Config.PRICE_COL].ewm(span=m['days']... | [
"0.78171605",
"0.7427968",
"0.7339694",
"0.7278831",
"0.7091837",
"0.66424924",
"0.6546067",
"0.6536235",
"0.6509854",
"0.64921653",
"0.64227074",
"0.64181644",
"0.6384694",
"0.637253",
"0.63664335",
"0.63083446",
"0.63012254",
"0.62818974",
"0.623537",
"0.61807245",
"0.61791... | 0.0 | -1 |
Calculate the double exponential moving average for values of given dataframe. | def get_dema(data):
if data is None:
raise EmptyDataError('[!] Invalid data value')
result = TA.DEMA(data)
if result is None:
raise IndicatorException
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exponential_weighted_moving_average(self, period=50,\n column='adj_close'):\n return pd.Series(\n self.ohlcv[column].ewm(ignore_na=False, min_periods=period - 1,\n span=period).mean(),\n name='... | [
"0.7214486",
"0.70401895",
"0.6972088",
"0.69681615",
"0.69144535",
"0.68758345",
"0.66631603",
"0.6593697",
"0.6416302",
"0.6377895",
"0.6363453",
"0.6363453",
"0.63626075",
"0.6335882",
"0.6321025",
"0.63168174",
"0.62198085",
"0.61779726",
"0.6168376",
"0.615137",
"0.60397... | 0.0 | -1 |
Calculate the triple exponential moving average for values of given dataframe. | def get_tema(data):
if data is None:
raise EmptyDataError('[!] Invalid data value')
result = TA.TEMA(data)
if result is None:
raise IndicatorException
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def avg_ttm_3y(df):\n return (1.0/3.0) * (df + df.shift(4) + df.shift(8))",
"def exponential_weighted_moving_average(self, period=50,\n column='adj_close'):\n return pd.Series(\n self.ohlcv[column].ewm(ignore_na=False, min_periods=period - 1,\n ... | [
"0.69679004",
"0.6884426",
"0.6781143",
"0.671638",
"0.65178716",
"0.6500385",
"0.646257",
"0.63620704",
"0.6352927",
"0.63019323",
"0.6279157",
"0.6174749",
"0.6084078",
"0.60838306",
"0.6078315",
"0.6042854",
"0.6042854",
"0.6037551",
"0.6031537",
"0.600193",
"0.5999108",
... | 0.0 | -1 |
Calculate the triangular moving average for values of given dataframe. | def get_trima(data):
if data is None:
raise EmptyDataError('[!] Invalid data value')
result = TA.TRIMA(data)
if result is None:
raise IndicatorException
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def moving_avg(df, key, lag):\n\n def _sma(key, window):\n values = list(map(lambda w: w[key], window))\n avg = round(reduce(lambda a, b: a + b, values) / len(values), 2)\n return avg\n\n return [_sma(key, df[i : i + lag + 1]) for i in range(len(df) - lag)]",
"def __calculate_moving_av... | [
"0.63981533",
"0.63918966",
"0.6347904",
"0.6225892",
"0.615141",
"0.6104265",
"0.6066322",
"0.59777844",
"0.5968551",
"0.59342325",
"0.59208655",
"0.58901983",
"0.58534235",
"0.5827511",
"0.5820779",
"0.5819875",
"0.5764454",
"0.5730367",
"0.5686892",
"0.5686736",
"0.5685169... | 0.0 | -1 |
Calculate the triple exponential moving average oscillator for values of given dataframe. | def get_trix(data):
if data is None:
raise EmptyDataError('[!] Invalid data value')
result = TA.TRIX(data)
if result is None:
raise IndicatorException
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_EMA(self, series, num_days=50):\n temp = series.copy().reset_index(drop=True) # DO NOT MODIFY THE ORIGINAL DATAFRAME!\n smoothing_factor = 2/(num_days+1)\n EMA_prev = 0.0\n for idx in range(len(temp)):\n EMA_current = (temp[idx]*smoothing_factor)+EMA_prev*(1-smoot... | [
"0.67951554",
"0.6733202",
"0.6696699",
"0.6556462",
"0.65431786",
"0.6446688",
"0.6374795",
"0.6332725",
"0.6332725",
"0.6276228",
"0.6233195",
"0.62331116",
"0.6190734",
"0.610091",
"0.6047623",
"0.6030936",
"0.5994476",
"0.5986854",
"0.59840614",
"0.59714335",
"0.58979726"... | 0.0 | -1 |
Calculate the Kaufman efficiency ratio for values of given dataframe. Example | def get_er(data):
if data is None:
raise EmptyDataError('[!] Invalid data value')
result = TA.ER(data)
if result is None:
raise IndicatorException
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_metric(df, preds):\n\n y = np.array(df['pressure'].values.tolist())\n\n # inspiratory phase\n mask = 1 - np.array(df['u_out'].values.tolist())\n\n # combine with mae calculusse\n mae = mask * np.abs(y - preds)\n mae = mae.sum() / mask.sum()\n\n return mae",
"def PP_EMP_AVG_PLA_TR... | [
"0.6357518",
"0.61950564",
"0.5994571",
"0.596013",
"0.59397066",
"0.5910252",
"0.5906029",
"0.57146853",
"0.57088876",
"0.56952226",
"0.5693367",
"0.5664849",
"0.5653881",
"0.5643955",
"0.5643782",
"0.5606317",
"0.5584927",
"0.5572554",
"0.5572151",
"0.55683696",
"0.55636245... | 0.0 | -1 |
Calculate the weighted moving avarage for values of given dataframe. | def get_wma(data):
if data is None:
raise EmptyDataError('[!] Invalid data value')
result = TA.WMA(data)
if result is None:
raise IndicatorException
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def weighted_moving_averages(\n dataframe: pd.DataFrame,\n avg_price_coeff: float = 1.0,\n avg_research_coeff: float = 1.0,\n avg_price_length: int = 2,\n avg_research_length: int = 2,\n) -> pd.DataFrame:\n\n # Splits out the price/research df to individual pandas Series.\n price = dataframe[P... | [
"0.66600055",
"0.65094674",
"0.65041304",
"0.63039964",
"0.6297979",
"0.6201731",
"0.6122396",
"0.59201014",
"0.59089345",
"0.5898357",
"0.5816904",
"0.58141315",
"0.5786238",
"0.57729906",
"0.5717491",
"0.5717491",
"0.57139176",
"0.5699369",
"0.56462276",
"0.56354654",
"0.56... | 0.0 | -1 |
Calculate the elastic volumeweighted MACD for values of given dataframe. | def get_evmacd(data):
if data is None:
raise EmptyDataError('[!] Invalid data value')
result = TA.EV_MACD(data)
if result is None:
raise IndicatorException
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def MACD(df_dict, a=12 ,b=26, c=9):\n for df in df_dict:\n df_dict[df][\"ma_fast\"] = df_dict[df][\"close\"].ewm(span=a, min_periods=a).mean()\n df_dict[df][\"ma_slow\"] = df_dict[df][\"close\"].ewm(span=b, min_periods=b).mean()\n df_dict[df][\"macd\"] = df_d... | [
"0.6930218",
"0.6742166",
"0.64537865",
"0.5947984",
"0.59340715",
"0.5879595",
"0.58621454",
"0.58562076",
"0.56027025",
"0.5593423",
"0.54846644",
"0.5451885",
"0.54450834",
"0.5433",
"0.53905845",
"0.53355753",
"0.52912873",
"0.5242914",
"0.5189817",
"0.5176947",
"0.516915... | 0.0 | -1 |
Calculate the momentum for values of given dataframe. | def get_mom(data):
if data is None:
raise EmptyDataError('[!] Invalid data value')
result = TA.MOM(data)
if result is None:
raise IndicatorException
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def momentum (self):\n\n for planet in self.planets: #this loop takes a 'planet' from 'self.planets' and computes it linear momentum.\n planet.momentum = planet.mass * planet.velocity #Each body's resulting momentum is updated to the body's information defined in the Particle class.",
"def calc... | [
"0.62278134",
"0.59690964",
"0.59096456",
"0.5851271",
"0.58479995",
"0.57952505",
"0.57575095",
"0.5708101",
"0.5610404",
"0.5552901",
"0.54771",
"0.5456846",
"0.54262125",
"0.54087526",
"0.5393181",
"0.53850347",
"0.5380527",
"0.5361942",
"0.5351693",
"0.5345581",
"0.534548... | 0.0 | -1 |
Calculate the relative strength index for values of given dataframe. | def get_rsi(data):
if data is None:
raise EmptyDataError('[!] Invalid data value')
result = TA.RSI(data)
if result is None:
raise IndicatorException
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def intrinsic_index_calc(df: pd.DataFrame):\n\n cur_index = 0\n df['Int_index'] = None\n df['Int_index'].iloc[0] = cur_index\n for i in range(len(df)):\n if df['Int_event'][i] in [-1, 1, -2, 2]:\n cur_index = cur_index + 1\n df['Int_index'].iloc[i] = cur_index\n\n return... | [
"0.6248406",
"0.6153391",
"0.59131473",
"0.582472",
"0.5815871",
"0.5641625",
"0.563922",
"0.55453086",
"0.5521628",
"0.5510295",
"0.5473429",
"0.54383945",
"0.539101",
"0.5385819",
"0.5380693",
"0.5373121",
"0.53584087",
"0.5354186",
"0.5300111",
"0.529265",
"0.5279914",
"... | 0.0 | -1 |
Calculate the true range for values of given dataframe. | def get_tr(data):
if data is None:
raise EmptyDataError('[!] Invalid data value')
result = TA.TR(data)
if result is None:
raise IndicatorException
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def range(df):\r\n\r\n\tdf_range_dict = dict()\r\n\r\n\tfor i, col in enumerate(df.columns):\r\n\t\tdf_range_dict[col] = [df[col].max(), df[col].min(), df[col].max() - df[col].min()]\r\n\r\n\tdf_range = pd.DataFrame(df_range_dict, index=['Max Value', 'Min Value', 'Range (Max - Min)'])\r\n\tpd.set_option('precision... | [
"0.7306046",
"0.6784566",
"0.65655226",
"0.6247994",
"0.59724736",
"0.596365",
"0.5946457",
"0.5946457",
"0.5944079",
"0.58845925",
"0.585791",
"0.582621",
"0.5789445",
"0.57841367",
"0.57841367",
"0.57718104",
"0.57510865",
"0.57302797",
"0.57285947",
"0.57258147",
"0.571912... | 0.0 | -1 |
Calculate the stochastic relative strength index for given dataframe. | def get_stoch_rsi(data):
if data is None:
raise EmptyDataError('[!] Invalid data value')
result = TA.STOCHRSI(data)
if result is None:
raise IndicatorException
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculateRelativeStrengthIndex(self, series, interval=14):\n\n if not isinstance(series, pd.Series):\n raise TypeError('Pandas Series required.')\n\n if not isinstance(interval, int):\n raise TypeError('Interval integer required.')\n\n if(len(series) < interval):\n ... | [
"0.61114347",
"0.59617704",
"0.5858609",
"0.58239985",
"0.56474984",
"0.5615828",
"0.5582248",
"0.55722487",
"0.5569849",
"0.5569431",
"0.55608475",
"0.55582726",
"0.54839706",
"0.5438064",
"0.543277",
"0.5416254",
"0.5408922",
"0.5408903",
"0.539879",
"0.5397164",
"0.538913"... | 0.0 | -1 |
Calculate the Williams oscillator for given dataframe. | def get_williams(data):
if data is None:
raise EmptyDataError('[!] Invalid data value')
result = TA.WILLIAMS(data)
if result is None:
raise IndicatorException
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ws(self, inhom_object):\n z = inhom_object.zeta\n # define bohr frequencies of eigenstates--currently a and b are \n # correlated \n wg = 0.0 + 0*z\n wa = z + self.wa_central\n wb = z + self.wb_central\n w2a = 2*wa - self.a_coupling\n w2b = 2*wb - self.b_... | [
"0.5819916",
"0.56620467",
"0.5630506",
"0.56271327",
"0.5624416",
"0.5617259",
"0.5590814",
"0.55715317",
"0.55592436",
"0.55413467",
"0.5531299",
"0.5516368",
"0.5509211",
"0.54991144",
"0.54916435",
"0.54808533",
"0.54791176",
"0.5465744",
"0.5457707",
"0.5424969",
"0.5420... | 0.0 | -1 |
Calculate the cumulative force index of given dataframe. | def get_cfi(data):
if data is None:
raise EmptyDataError('[!] Invalid data value')
result = TA.CFI(data)
if result is None:
raise IndicatorException
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def intrinsic_index_calc(df: pd.DataFrame):\n\n cur_index = 0\n df['Int_index'] = None\n df['Int_index'].iloc[0] = cur_index\n for i in range(len(df)):\n if df['Int_event'][i] in [-1, 1, -2, 2]:\n cur_index = cur_index + 1\n df['Int_index'].iloc[i] = cur_index\n\n return... | [
"0.67540276",
"0.5830148",
"0.571194",
"0.566068",
"0.55359113",
"0.55087405",
"0.5458011",
"0.54549384",
"0.5444036",
"0.54381555",
"0.54280114",
"0.54198885",
"0.5345912",
"0.5340662",
"0.5315211",
"0.5315124",
"0.53128576",
"0.52902746",
"0.52798945",
"0.5248952",
"0.52430... | 0.0 | -1 |
Calculate the chandelier exit indicator of given dataframe. | def get_chandelier(data):
if data is None:
raise EmptyDataError('[!] Invalid data value')
result = TA.CHANDELIER(data)
if result is None:
raise IndicatorException
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ichimokuBullish(df, i:int):\n\n\tif not df.__contains__('tenkansen') or not df.__contains__('kijunsen') or \\\n\t\tnot df.__contains__('senkou_a') or not df.__contains__('senkou_b'):\n\t\tIndicators.AddIndicator(df, indicator_name=\"ichimoku\", col_name=None, args=None)\n\n\tif i - 1 > 0 and i < len(df):\n\t\t... | [
"0.56444764",
"0.5501895",
"0.54319197",
"0.53372866",
"0.5269651",
"0.52079755",
"0.5191637",
"0.5155445",
"0.5134298",
"0.5125442",
"0.5114152",
"0.51105803",
"0.5080461",
"0.49948108",
"0.49596074",
"0.49574924",
"0.49353924",
"0.48768884",
"0.4856374",
"0.48539525",
"0.48... | 0.5045823 | 13 |
Tokenizes common abbreviations and punctuation, removes unwanted characters. Returns the clean string. | def clean_str(cleaned_tweet):
# string = re.sub(r"[^A-Za-z0-9(),!?\'\`]", " ", cleaned_tweet)
string = re.sub(r'(.)\1+', r'\1\1', cleaned_tweet)
string = re.sub(r"\'s", " \'s", string)
string = re.sub(r"\'ve", " \'ve", string)
string = re.sub(r"n\'t", " n\'t", string)
string = re.sub(r"\'re", " ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def detokenize(self, text):\n text = ' ' + text + ' '\n text = self._dash_fixes.sub(r' \\1-\\2 ', text)\n text = self._dash_fixes2.sub(r' \\1-\\2 ', text)\n text = self._currency_or_init_punct.sub(r' \\1', text)\n text = self._noprespace_punct.sub(r'\\1 ', text)\n text = s... | [
"0.695034",
"0.6765862",
"0.66595465",
"0.66142213",
"0.65782815",
"0.6533982",
"0.6529178",
"0.65289575",
"0.65241706",
"0.64820623",
"0.6479524",
"0.6428553",
"0.6423277",
"0.6398576",
"0.6371445",
"0.6368147",
"0.6368147",
"0.6363951",
"0.6355825",
"0.6340239",
"0.6324771"... | 0.60770917 | 43 |
True if the amount was parsed succesfully. | def check_amount_column(cls, line):
try:
price_val = cls.get_field(line, cls._AMOUNT_COL_NAME)
except (ValueError, IndexError, KeyError):
return False
return price_val is not None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def successful(self) -> bool:\n return self._unparsed_response is not None",
"def validate(self):\n if self.amount > 0:\n return True\n return False",
"def has_succeeded(self):\n return self.transaction_result == TERMINAL_PAYMENT_SUCCESS",
"def _is_amount_valid(self):\n... | [
"0.6963786",
"0.6948994",
"0.6597817",
"0.64457357",
"0.6438867",
"0.6409226",
"0.63324547",
"0.62709165",
"0.62273234",
"0.6201623",
"0.61532146",
"0.61354053",
"0.61354053",
"0.6127371",
"0.6097561",
"0.6096635",
"0.6053123",
"0.60404307",
"0.60080713",
"0.5962883",
"0.5960... | 0.5798072 | 28 |
Get a random element from the set. | def getRandom(self) -> int:
import random
return random.choice(self._array) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getRandom(self):\n return self.nums[random.randint(0, len(self.nums) - 1)]\n\n # Your RandomizedSet object will be instantiated and called as such:\n # obj = RandomizedSet()\n # param_1 = obj.insert(val)\n # param_2 = obj.remove(val)\n # param_3 = obj.getRandom()",
"... | [
"0.77060276",
"0.738916",
"0.7296881",
"0.72187954",
"0.6871744",
"0.68453854",
"0.68330806",
"0.67740154",
"0.67226046",
"0.6703282",
"0.6665089",
"0.66356236",
"0.66217655",
"0.6612035",
"0.66000897",
"0.6567767",
"0.6477719",
"0.6462421",
"0.64428514",
"0.64162946",
"0.640... | 0.59890753 | 66 |
Autocheck to see if ESN matrices have correct dimensions. | def _autocheck_dimensions(self):
# W dimensions check list
assert len(self.W.shape) == 2, f"W shape should be (N, N) but is {self.W.shape}."
assert self.W.shape[0] == self.W.shape[1], f"W shape should be (N, N) but is {self.W.shape}."
# Win dimensions check list
assert len(self.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _check_eigenmatrices(self):\n if self._has(\"P\") and self._has(\"Q\") and \\\n _simplify(_expand(self._.P * self._.Q)) \\\n != self.order(expand=True, simplify=True) \\\n * identity_matrix(SR, self._.d + 1):\n warn(Warning(\"the eigenmatrices do n... | [
"0.66708297",
"0.66519594",
"0.645523",
"0.6309418",
"0.62828445",
"0.6261575",
"0.6242177",
"0.615197",
"0.61310714",
"0.605591",
"0.60321075",
"0.5971746",
"0.5964203",
"0.5962521",
"0.5951845",
"0.5940196",
"0.5938569",
"0.5931965",
"0.59206873",
"0.5916518",
"0.5884517",
... | 0.6232846 | 7 |
Invalidate existing tokens issued for this user. | def invalidate_existing_tokens(self, client_id, user):
app = Application.objects.get(client_id=client_id)
tokens = AccessToken.objects.filter(user=user, application=app)
tokens.delete() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def expire_token(self):\n self.user_in_db = User.users_db.get(self.email)\n\n self.user_in_db.update({'token': ''})\n\n User.users_db.put(self.user_in_db)\n\n return {'success': True}",
"def _purge_expired_user_tokens():\n expired = models.Token.query.filter_by(\n _user_fk=c... | [
"0.6913114",
"0.67849505",
"0.6450037",
"0.6365823",
"0.62868136",
"0.62628525",
"0.62393385",
"0.61448014",
"0.6139599",
"0.61256796",
"0.61163163",
"0.6116211",
"0.6102149",
"0.6093293",
"0.60893947",
"0.6069814",
"0.5999578",
"0.5996173",
"0.5985803",
"0.5959749",
"0.59451... | 0.7791725 | 0 |
This function creates a DataFrame of the electricity balance of all regions. | def electricity_balance(dh: DataHandler):
# creates DataFrame of all electricity flows in TWh with index = ['alltec','r']
supply = dh.get("o_supply").groupby(["tec_supply", "r"]).sum()
supply.index.names = ["alltec", "r"]
supply = pd.concat([supply], keys=["supply"], names=["type"])
demand = dh.get(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_operation_balance_sheet(self):\n date_list = Operation_Invoice.objects.all().dates('origin', 'year')\n\n for years in date_list:\n Operation_Invoice.objects.filter(origin__year = years.year)\n\n expenses = 0\n balances = 0\n un_paid_count = 0\n conflicts... | [
"0.58328724",
"0.57492054",
"0.57220864",
"0.56592655",
"0.56283814",
"0.55676305",
"0.55500203",
"0.5539761",
"0.5522383",
"0.5430314",
"0.53675157",
"0.5343915",
"0.53427184",
"0.53288674",
"0.53116316",
"0.528094",
"0.5273634",
"0.5263308",
"0.5242708",
"0.5237714",
"0.522... | 0.68846506 | 0 |
Gets the edge_attribute of this OperationFilterKgraphTopNParameters. | def edge_attribute(self):
return self._edge_attribute | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edge(self) -> EdgeConfig:\n return self._edge",
"def get_edge_attributes(graph: BaseGraph, attr_key: str) -> Dict:\n return get_edge_attributes(graph.graph, attr_key)",
"def edge_array(self):\n return self._edge_array",
"def get_edge_size(self):\n return self._edge_size",
"d... | [
"0.6981031",
"0.6132798",
"0.5874107",
"0.5870594",
"0.5823603",
"0.574355",
"0.56904745",
"0.56496364",
"0.56381154",
"0.5628658",
"0.5599069",
"0.54278994",
"0.5393487",
"0.5335291",
"0.5283611",
"0.5282198",
"0.52543914",
"0.52404195",
"0.52097356",
"0.5201904",
"0.5186886... | 0.79824936 | 0 |
Gets the max_edges of this OperationFilterKgraphTopNParameters. | def max_edges(self):
return self._max_edges | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_nodes(self) -> pulumi.Input[int]:\n return pulumi.get(self, \"max_nodes\")",
"def num_edges(self):\n return self._top_exp.number_of_edges()",
"def get_parameters_max(self):\n maxValues = numpy.zeros(self.get_num_parameters())\n i = 0\n for p in self.parameters:\n ... | [
"0.6117776",
"0.61134166",
"0.607696",
"0.6068996",
"0.60188544",
"0.5996239",
"0.5915247",
"0.59126115",
"0.5887926",
"0.5842894",
"0.58412194",
"0.5758923",
"0.5754709",
"0.57310635",
"0.5722847",
"0.57169735",
"0.56968087",
"0.56936395",
"0.56856334",
"0.5683312",
"0.56739... | 0.76864016 | 0 |
Gets the qedge_keys of this OperationFilterKgraphTopNParameters. | def qedge_keys(self):
return self._qedge_keys | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def qnode_keys(self):\n return self._qnode_keys",
"def qedge_keys(self, qedge_keys):\n\n self._qedge_keys = qedge_keys",
"def keys(self):\n return self.params.keys()",
"def get_vertex_keys(self):\n return self.vertList.keys()",
"def keys(self):\n return self._key_to_node_... | [
"0.7288101",
"0.60991013",
"0.6067911",
"0.60389143",
"0.6025332",
"0.5948107",
"0.58627486",
"0.58592695",
"0.58093464",
"0.57137764",
"0.5697618",
"0.56480795",
"0.5603909",
"0.55899596",
"0.5586424",
"0.5583137",
"0.5570243",
"0.55641234",
"0.55617553",
"0.55617553",
"0.55... | 0.83435977 | 0 |
Gets the qnode_keys of this OperationFilterKgraphTopNParameters. | def qnode_keys(self):
return self._qnode_keys | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def qedge_keys(self):\n return self._qedge_keys",
"def keys(self):\n return self._key_to_node_index.keys()",
"def keys(self):\n list_all_dict = self.list_all()\n return list_all_dict[\"nodes\"] + list_all_dict[\"groups\"]",
"def keys(self):\n return self.params.keys()",
"... | [
"0.7329391",
"0.6825162",
"0.6334459",
"0.6125614",
"0.61179733",
"0.60077274",
"0.5966896",
"0.5966896",
"0.59188855",
"0.59103674",
"0.58554554",
"0.5844913",
"0.58417857",
"0.5838304",
"0.5831533",
"0.5819362",
"0.5817501",
"0.5809469",
"0.5809469",
"0.58055615",
"0.580543... | 0.8228556 | 0 |
Asserts the map identified boards matches the predefined connected boards. | def assertBoards(self, config_name, my_bcs):
# get defined boards
brds = []
for brd, chs in my_bcs:
brds.append(brd)
# get map identified boards
map_brds = []
for conn in self.map.configs[config_name]['SIS 3301']:
map_brds.append(conn[0])
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testBoardAll(self):\n self.assertEqual(self.boards.SelectBoards([]), {'all': 5})",
"def testBoardArch(self):\n self.assertEqual(self.boards.SelectBoards(['arm']),\n {'all': 2, 'arm': 2})",
"def testBoardDuplicate(self):\n self.assertEqual(self.boards.SelectBoard... | [
"0.68080086",
"0.6801656",
"0.6711426",
"0.66321903",
"0.6530586",
"0.6523621",
"0.6449439",
"0.6430011",
"0.63632405",
"0.6233215",
"0.6198039",
"0.61945087",
"0.6117289",
"0.6117289",
"0.6117289",
"0.60558516",
"0.6055197",
"0.6010283",
"0.5999192",
"0.59447634",
"0.5912163... | 0.77703667 | 0 |
Asserts the map identified channels for each board matches the predefined connected channels for each board. | def assertChannels(self, config_name, my_bcs):
# get defined boards
brds = []
for brd, chs in my_bcs:
brds.append(brd)
# assert discovered channels are equal to defined channels for
# each defined board
for conn in self.map.configs[config_name]['SIS 3301']:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assertBoards(self, config_name, my_bcs):\n # get defined boards\n brds = []\n for brd, chs in my_bcs:\n brds.append(brd)\n\n # get map identified boards\n map_brds = []\n for conn in self.map.configs[config_name]['SIS 3301']:\n map_brds.append(con... | [
"0.6782004",
"0.6423596",
"0.63748574",
"0.61178344",
"0.58554864",
"0.58554864",
"0.58554864",
"0.5841851",
"0.5801546",
"0.58009654",
"0.57957405",
"0.5762526",
"0.57379985",
"0.5707146",
"0.5659369",
"0.5634266",
"0.56340164",
"0.563076",
"0.56032413",
"0.55973357",
"0.555... | 0.71924806 | 0 |
Plot a single image | def plot_image(image: np.ndarray, title: Optional[str]=None, **kwargs) -> None:
shape = image.shape
if len(shape) == 3:
plt.imshow(image, **kwargs)
elif len(shape) == 2:
plt.imshow(image, **kwargs)
else:
raise TypeError(
"2-D array or 3-D array should be given but {}... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_single_image(image):\n image = image.cpu()\n \n assert type(image) is torch.Tensor, 'Image to plot is not torch.Tensor'\n image_size = int(np.sqrt(image.shape[0]))\n image = image.view(image_size, image_size)\n \n fig = plt.imshow(image, cmap = 'gray')\n fig.axes.get_xaxis().set_vi... | [
"0.81281024",
"0.7408361",
"0.7405754",
"0.7388386",
"0.73490447",
"0.73303634",
"0.72542965",
"0.72492766",
"0.72213274",
"0.72113335",
"0.72113335",
"0.72113335",
"0.7156847",
"0.713085",
"0.703215",
"0.7019729",
"0.70053864",
"0.6976004",
"0.6972658",
"0.69419533",
"0.6820... | 0.65770906 | 32 |
Sets the name of this XapiActivityDefinition. | def name(self, name):
self._name = name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_name(self, name: str):\n self._name = name",
"def set_name(self, name):\n self._name = name",
"def set_name(self, name):\n self.__name = name",
"def set_name(self, name):\n self.__name = name",
"def set_name(self, name):\n self.name = name",
"def set_name(self, ... | [
"0.68545634",
"0.6835925",
"0.6810064",
"0.6810064",
"0.6772631",
"0.6772631",
"0.6772631",
"0.6772631",
"0.6772631",
"0.6751053",
"0.6734458",
"0.6728493",
"0.67076063",
"0.67076063",
"0.67076063",
"0.67076063",
"0.66910774",
"0.6688871",
"0.6688127",
"0.66731036",
"0.664234... | 0.0 | -1 |
Sets the description of this XapiActivityDefinition. | def description(self, description):
self._description = description | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def description(self, value):\n self.definition.description = value",
"def set_description(self, description):\r\n self.__description = description",
"def set_description(self, desc: str) -> None:\n self.metadata.data[\"description\"] = desc",
"def set_description(self, description):\n ... | [
"0.6504493",
"0.6461133",
"0.6436999",
"0.64335847",
"0.6423845",
"0.63952726",
"0.6389435",
"0.6389435",
"0.6389435",
"0.6389435",
"0.6328096",
"0.6325781",
"0.6325781",
"0.6325781",
"0.6325781",
"0.6214217",
"0.6097988",
"0.6085367",
"0.60729986",
"0.60193044",
"0.6014856",... | 0.63695294 | 49 |
Sets the type of this XapiActivityDefinition. | def type(self, type):
self._type = type | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_type(self, type):\n self.type = type",
"def set_type(self, type):\n self.type = type",
"def activity_type(self, type_id):\r\n return activities.ActivityType(self, type_id)",
"def set_type(self, type):\n self._type = type",
"def type(self, type):\n if type is None:... | [
"0.6759379",
"0.6759379",
"0.67230564",
"0.66976887",
"0.6511598",
"0.6511598",
"0.6511598",
"0.64901173",
"0.64503807",
"0.6449069",
"0.6431961",
"0.6431961",
"0.6392932",
"0.6391411",
"0.6391411",
"0.6295457",
"0.6295457",
"0.62109745",
"0.6149191",
"0.6088811",
"0.6054531"... | 0.6396301 | 34 |
Sets the interaction_type of this XapiActivityDefinition. | def interaction_type(self, interaction_type):
self._interaction_type = interaction_type | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_interactions(self, interactions: dict):\n self._interactions = interactions",
"def set_type(self, type):\n self._type = type",
"def set_execution_type(self, type):\n self.execution_type = type",
"def set_type(self, type):\n self.type = type",
"def set_type(self, type):\n... | [
"0.5839863",
"0.5609744",
"0.5606239",
"0.5593561",
"0.5593561",
"0.5423773",
"0.542183",
"0.542183",
"0.542183",
"0.54202527",
"0.53968126",
"0.5381194",
"0.53191566",
"0.53191566",
"0.5311249",
"0.5304102",
"0.5289866",
"0.5289866",
"0.5289866",
"0.5289866",
"0.5289866",
... | 0.8043776 | 0 |
Sets the choices of this XapiActivityDefinition. | def choices(self, choices):
self._choices = choices | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def choices(self, choices: Iterable[Tuple[str, str]]):\n try:\n iter(choices)\n except TypeError:\n raise TypeError(\"'choices' isn't a valid iterable\")\n\n apply_choices = []\n for i, (choice_id, choice_label) in enumerate(choices):\n apply_choices.app... | [
"0.63967466",
"0.5922315",
"0.555645",
"0.55435973",
"0.5459039",
"0.53439164",
"0.5308223",
"0.52620864",
"0.5150234",
"0.50988597",
"0.5052014",
"0.5052004",
"0.5031704",
"0.4979425",
"0.49375927",
"0.48581317",
"0.4835073",
"0.4835073",
"0.47601628",
"0.4755359",
"0.475511... | 0.71045566 | 0 |
Sets the source of this XapiActivityDefinition. | def source(self, source):
self._source = source | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_source(self, source):\n self.data['source'] = source",
"def setSource(self, *args):\n return _libsbml.ExternalModelDefinition_setSource(self, *args)",
"def set_flow_source(self, source):\n self._source = source",
"def source(self, source: Source):\n self._source = source",... | [
"0.73185915",
"0.72253627",
"0.70042753",
"0.6929919",
"0.69140166",
"0.67720854",
"0.65249795",
"0.6447547",
"0.6362885",
"0.62801546",
"0.6198844",
"0.6198844",
"0.6152265",
"0.6133488",
"0.6129547",
"0.6081656",
"0.60280246",
"0.60010403",
"0.59713244",
"0.5919026",
"0.587... | 0.71193945 | 8 |
Sets the extensions of this XapiActivityDefinition. | def extensions(self, extensions):
self._extensions = extensions | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inject_extensions(self, extensions: Dict[str, str]) -> None:\n self.extensions = extensions",
"def setExtension(self, ext):\n if ext:\n self.extension = ext\n else:\n self.extension = None",
"def extensions(cls):\n raise NotImplementedError",
"def extensi... | [
"0.6449373",
"0.6285618",
"0.5845395",
"0.5802265",
"0.5802265",
"0.5787033",
"0.56601024",
"0.5616033",
"0.56079364",
"0.5589066",
"0.5587543",
"0.54442525",
"0.5423955",
"0.5389426",
"0.53421164",
"0.53269005",
"0.53126067",
"0.527798",
"0.5252857",
"0.52410066",
"0.519096"... | 0.7274568 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, XapiActivityDefinition):
return False
return self.__dict__ == other.__dict__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.80886984",
"0.80886984",
"0.8055307",
"0.7983415",
"0.79673034",
"0.79673034",
"0.79673034",
"0.79673034",
"0.79673034",
"0.79673034",
"0.79673034",
"0.79673034",
"0.79673034",
"0.79673034",
"0.79673034",
"0.79673034",
"0.79673034",
"0.79673034",
"0.79673034",
"0.79673034",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.845611",
"0.8391477",
"0.8144138",
"0.81410587",
"0.8132492",
"0.8093973",
"0.80920255",
"0.80920255",
"0.80920255",
"0.8085325",
"0.8085325",
"0.8076365",
"0.8076365",
"0.8065748"
] | 0.0 | -1 |
Init the sparse layer | def __init__(self, directory, index, x, w, leak, threshold, w_mask):
# define file names
self.directory = directory
self.w_filename = os.path.join(directory, "sp.%d.w.npy" % index)
self.leak_filename = os.path.join(directory, "sp.%d.leak.npy" % index)
self.threshold_filename = o... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_dense(self, layer):\n pass",
"def __init__(self, idxbase=0):\n if idxbase not in (0, 1):\n raise ValueError(\"Invalid index base\")\n\n self.api = cuSparse()\n self.idxbase = (CUSPARSE_INDEX_BASE_ZERO,\n CUSPARSE_INDEX_BASE_ONE)[idxbase]",
... | [
"0.7932703",
"0.65742",
"0.6531526",
"0.6451142",
"0.6419857",
"0.63293505",
"0.62560326",
"0.62102973",
"0.6203085",
"0.61957467",
"0.6160203",
"0.6158572",
"0.61111516",
"0.6109669",
"0.6089287",
"0.60848147",
"0.6062623",
"0.602183",
"0.60130715",
"0.5988288",
"0.59418225"... | 0.0 | -1 |
Mock out _branch, this is tested by TestBranch. | def branch_():
with mock.patch.object(branch, '_branch') as branch_:
yield branch_ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_branching(self):\r\n repo_dir = self.GIT_REPO_DIR\r\n # Test successful import from command\r\n if not os.path.isdir(repo_dir):\r\n os.mkdir(repo_dir)\r\n self.addCleanup(shutil.rmtree, repo_dir)\r\n\r\n # Checkout non existent branch\r\n with self.asse... | [
"0.65736276",
"0.63967484",
"0.63671947",
"0.63618445",
"0.63068736",
"0.6106301",
"0.61058015",
"0.6075282",
"0.6075282",
"0.6057084",
"0.6010536",
"0.597324",
"0.58579177",
"0.5852116",
"0.5834708",
"0.57880634",
"0.5748627",
"0.574554",
"0.57327986",
"0.5725962",
"0.572367... | 0.8044098 | 0 |
Branch if zero flag is set. | def test_branch_if_equal(self, test_cpu, branch_, zero_flag):
test_cpu.status.zero = zero_flag
branch.branch_if_equal(test_cpu, 10)
branch_.assert_called_with(test_cpu, zero_flag, 10) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_zero(self) -> bool:\n return self.field.zero == self",
"def is_zero(self):\n return (self._num == 0)",
"def is_zero(self, a):\n return not a",
"def isZero(self):\n return self.count == 0",
"def isZero(self):\n\t\treturn (self.p.isZero() & (self.q.isZero() == False))",
"... | [
"0.73442435",
"0.7181189",
"0.7122789",
"0.7102199",
"0.7065632",
"0.69411767",
"0.6940129",
"0.69140744",
"0.6856125",
"0.68253845",
"0.67980355",
"0.67463285",
"0.6736373",
"0.6630716",
"0.6627824",
"0.66026205",
"0.6597612",
"0.6459335",
"0.6395207",
"0.6393147",
"0.639208... | 0.5739825 | 68 |
Calculate the objective based on the objective and the splitted kl divergence constraints. | def obj(self, batch):
l_suff_stats = self.shuffle_up_stats(batch)
obj = self.main_obj(batch, l_suff_stats)
constraints = self.main_constraints(batch, l_suff_stats)
for lm, c in zip(self.lagrange_mults, constraints):
obj = obj + torch.exp(lm) * c
return obj | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _dK_computations(self, dL_dK):\r\n \r\n self._dL_dl = (dL_dK*self.variance*self._K_dvar*(self.input_dim/2.*(self._lengthscales_two.T**4 - self._lengthscales**4) + 2*self._lengthscales2*self._K_dist2)/(self._w2*self._w2*self._lengthscales)).sum(1)\r\n if self._lengthscales_two is self._leng... | [
"0.6217784",
"0.6212105",
"0.6027963",
"0.5963192",
"0.5909733",
"0.58576703",
"0.5830954",
"0.5765679",
"0.5753141",
"0.57248574",
"0.57196516",
"0.57000875",
"0.56685066",
"0.56663084",
"0.5661085",
"0.5649493",
"0.5645775",
"0.56212664",
"0.5609901",
"0.55843425",
"0.55436... | 0.0 | -1 |
The list of recognized values for this property. | def get_recognized_values(self):
return list(sorted(self._usr_to_hw.keys())) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def values(self) -> list:\n return self.__values",
"def Values(self):\r\n\t\treturn self._get_attribute('values')",
"def values(self):\n return [i.value for i in self.value]",
"def values(self):\n return list(item.value for item in self.mechanisms)",
"def values(self) -> List[BaseValue... | [
"0.7776817",
"0.7579224",
"0.75233203",
"0.7514931",
"0.7509868",
"0.74423045",
"0.7410171",
"0.7410171",
"0.7410171",
"0.7410171",
"0.7410171",
"0.7410171",
"0.7410171",
"0.7410171",
"0.7410171",
"0.7410171",
"0.7410171",
"0.7410171",
"0.7410171",
"0.7410171",
"0.7410171",
... | 0.6881653 | 65 |
Test load and unload of a ConfigEntry. | async def test_unload_entry(
hass: HomeAssistant,
component_setup: ComponentSetup,
) -> None:
await component_setup()
entries = hass.config_entries.async_entries(DOMAIN)
assert len(entries) == 1
entry = entries[0]
assert entry.state is ConfigEntryState.LOADED
assert await hass.config_e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def test_load_unload_config_entry(\n hass: HomeAssistant, mock_config_entry: MockConfigEntry, tmpdir: str\n) -> None:\n testfile = f\"{tmpdir}/file.txt\"\n create_file(testfile)\n hass.config.allowlist_external_dirs = {tmpdir}\n mock_config_entry.add_to_hass(hass)\n hass.config_entries.asyn... | [
"0.8022712",
"0.80203575",
"0.79891366",
"0.7923256",
"0.7873219",
"0.7767407",
"0.7665732",
"0.7546089",
"0.7456372",
"0.7408131",
"0.739424",
"0.73715615",
"0.7255246",
"0.7148939",
"0.6830259",
"0.6702352",
"0.6620025",
"0.6504506",
"0.6490757",
"0.64709985",
"0.64536756",... | 0.7563836 | 7 |
Test setup where existing token does not have sufficient scopes. | async def test_existing_token_missing_scope(
hass: HomeAssistant,
token_scopes: list[str],
component_setup: ComponentSetup,
config_entry: MockConfigEntry,
) -> None:
await component_setup()
entries = hass.config_entries.async_entries(DOMAIN)
assert len(entries) == 1
assert entries[0].st... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_good_with_no_prior_key(self):\n # config seems to be shared across tests, so we have to specifically set\n # it to None.\n config.set(xsrf_token_key=None)\n tool = utils.XsrfTool()\n token = tool.generate_token(12345, 'test_action')\n self.assertTrue(tool.verify_t... | [
"0.66060394",
"0.6446283",
"0.6427734",
"0.6411109",
"0.6395821",
"0.6386319",
"0.6365879",
"0.6337021",
"0.6335847",
"0.63339245",
"0.6327335",
"0.62977475",
"0.6295482",
"0.62670904",
"0.62594974",
"0.6250421",
"0.6250282",
"0.6245764",
"0.62408274",
"0.62391514",
"0.622701... | 0.7784333 | 0 |
Test setup with yaml file not found. | async def test_calendar_yaml_error(
hass: HomeAssistant,
component_setup: ComponentSetup,
mock_calendars_list: ApiResult,
test_api_calendar: dict[str, Any],
mock_events_list: ApiResult,
) -> None:
mock_calendars_list({"items": [test_api_calendar]})
mock_events_list({})
with patch("homea... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_raise_missing_file(self) -> None:\n with pytest.raises(FileNotFoundError):\n YAMLParser().parse(\"test/missing_file.yaml\")",
"def test_yml_file(self):\n self.assertTrue(os.path.exists(\n \"{}/app_spec.yml\".format(self.APP_PATH)),\n msg=\"[app_spec.yml] fi... | [
"0.74152607",
"0.7413427",
"0.6991487",
"0.6955671",
"0.691142",
"0.69004154",
"0.6897618",
"0.6892862",
"0.6860334",
"0.68401754",
"0.6835258",
"0.68158424",
"0.6802351",
"0.6773036",
"0.67707884",
"0.6753141",
"0.67109007",
"0.66665125",
"0.66293705",
"0.66253906",
"0.66045... | 0.0 | -1 |
Test case where reauth is required for token that cannot be refreshed. | async def test_expired_token_requires_reauth(
hass: HomeAssistant,
component_setup: ComponentSetup,
aioclient_mock: AiohttpClientMocker,
) -> None:
aioclient_mock.post(
"https://oauth2.googleapis.com/token",
status=http.HTTPStatus.BAD_REQUEST,
)
await component_setup()
ent... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_invalid_refresh_token(self):\n\n content_type = 'application/x-www-form-urlencoded'\n # Generate an auth and a refresh token.\n resp_1 = self.app.post('/v1/openid/token',\n params={\n 'refresh_token': 'invalid_refresh_tok... | [
"0.6976277",
"0.6827745",
"0.6798438",
"0.669153",
"0.6671915",
"0.66000515",
"0.65949583",
"0.6585366",
"0.6570169",
"0.6564486",
"0.65555704",
"0.6543437",
"0.6532987",
"0.64937395",
"0.64608955",
"0.64507073",
"0.6448669",
"0.6445473",
"0.64415866",
"0.6359006",
"0.6355563... | 0.7794217 | 0 |
Test load and remove of a ConfigEntry. | async def test_remove_entry(
hass: HomeAssistant,
mock_calendars_list: ApiResult,
component_setup: ComponentSetup,
test_api_calendar: dict[str, Any],
mock_events_list: ApiResult,
) -> None:
mock_calendars_list({"items": [test_api_calendar]})
mock_events_list({})
assert await component_se... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def test_unload_entry(hass: HomeAssistant) -> None:\n entry = MockConfigEntry(\n domain=DOMAIN,\n unique_id=\"0123456789\",\n data=DEFAULT_CONFIG,\n options=DEFAULT_OPTIONS,\n )\n entry.add_to_hass(hass)\n\n await hass.config_entries.async_setup(entry.entry_id)\n aw... | [
"0.759869",
"0.75549847",
"0.7544417",
"0.73696977",
"0.7236668",
"0.719791",
"0.7075915",
"0.70416075",
"0.7039041",
"0.70076984",
"0.6918488",
"0.68095267",
"0.6795073",
"0.679088",
"0.6783482",
"0.664579",
"0.64243895",
"0.63123125",
"0.629524",
"0.62842274",
"0.6278386",
... | 0.66271853 | 16 |
Convert to json string representation. | def to_json(self) -> str:
obj = {
'name': self.name,
'project_id': self.project_id,
}
if self.due_date is not None:
obj['due_date'] = date_helper.str_from_date(self.due_date)
if self.open_method is not None:
obj['open_method'] = self.open... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_json(self) -> str:\n return json.dumps(asdict(self))",
"def toJson(self):\n return json.dumps(self.toDict(), default=str)",
"def to_json(self) -> str:\n return json.dumps(self.to_dict())",
"def to_json(self) -> str:\n return json.dumps(self.to_dict())",
"def to_json(self)... | [
"0.8400197",
"0.8384769",
"0.8369793",
"0.8369793",
"0.8369793",
"0.8369793",
"0.8369793",
"0.8369793",
"0.8369793",
"0.8369793",
"0.8369793",
"0.8300007",
"0.8238099",
"0.8200652",
"0.8197334",
"0.81889313",
"0.8167703",
"0.81671494",
"0.81524897",
"0.81325126",
"0.8110952",... | 0.0 | -1 |
Returns the minimax action using self.depth and self.evaluationFunction | def getAction(self, gameState):
"*** YOUR CODE HERE ***"
logging.info('-'*80)
logging.info(f'{self.agentLogPrefix[1]} NEW GAME STATE')
logging.info('-'*80)
logging.info(f'{self.agentLogPrefix[1]} Number of agents in game state: {gameState.getNumAgents()}')
legalActions ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getAction(self, gameState: GameState):\n _max = float(\"-inf\")\n action = None\n for move in gameState.getLegalActions(0):\n util = minimax(self.evaluationFunction, 1, 0,\n gameState.generateSuccessor(0, move), self.depth)\n if util > _max o... | [
"0.7482665",
"0.7383559",
"0.71806973",
"0.7110041",
"0.70884514",
"0.70694935",
"0.70683014",
"0.7048308",
"0.70055133",
"0.69651455",
"0.69642085",
"0.69604385",
"0.6945924",
"0.68998593",
"0.6895832",
"0.688605",
"0.6826282",
"0.6767276",
"0.6758028",
"0.6751636",
"0.67054... | 0.0 | -1 |
Convert given arithmetic expression from infix to postfix notation. All values are still strings! | def infix_to_postfix(string_input):
stack_ops = []
output = []
value = ""
for item in string_input:
# item = operator
if item in ops_prec.keys():
value = value_to_output(value, output)
# pop elements while they have lower precedence
while (stack_ops
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def infix_to_postfix(expr):\n # you may find the following precedence dictionary useful\n prec = {'*': 2, '/': 2,\n '+': 1, '-': 1}\n ops = Stack()\n postfix = []\n toks = expr.split()\n ### BEGIN SOLUTION\n opp = {'*', '/','+', '-'}\n for x in toks:\n if str.isdigit(x):\n... | [
"0.834373",
"0.8128928",
"0.8122822",
"0.81204855",
"0.8106586",
"0.7954634",
"0.79336905",
"0.79245865",
"0.7897057",
"0.78880167",
"0.7883429",
"0.7792683",
"0.7710143",
"0.76627606",
"0.76539844",
"0.7609844",
"0.7577497",
"0.75693846",
"0.7565942",
"0.75258374",
"0.745146... | 0.79408216 | 6 |
Get the squared length of the vector. It is more efficent to use this method instead of first call get_length() or access .length and then do a sqrt(). | def get_length_sqrd(self):
return self.x**2 + self.y**2 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def length(v: Vec2) -> float:\n return sqrt(v.x ** 2 + v.y ** 2)",
"def length_vector(v):\n return sqrt(dot_vectors(v, v))",
"def length(self):\r\n\r\n return math.sqrt(self*self)",
"def length(self):\n return np.sqrt(np.sum(self**2, axis=1)).view(np.ndarray)",
"def getLength(self):\n ... | [
"0.7831202",
"0.759173",
"0.74314445",
"0.7365504",
"0.73259526",
"0.72921103",
"0.7283824",
"0.7281241",
"0.7228554",
"0.7208371",
"0.7189134",
"0.7187073",
"0.7173903",
"0.7167899",
"0.7068089",
"0.7037926",
"0.7018666",
"0.6989105",
"0.69523925",
"0.69243467",
"0.69145507"... | 0.7167348 | 14 |
Rotate the vector by angle_radians radians. | def rotate(self, angle_radians):
cos = math.cos(angle_radians)
sin = math.sin(angle_radians)
x = self.x*cos - self.y*sin
y = self.x*sin + self.y*cos
self.x = x
self.y = y | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rotate(vector, angle):\n return np.cos(angle) * vector[0] + np.sin(angle) * vector[1], \\\n -np.sin(angle) * vector[0] + np.cos(angle) * vector[1]",
"def rotate(self, radians):\n self._impl.rotate(radians)",
"def rotated(self, angle_radians):\n cos = math.cos(angle_radians)\n ... | [
"0.74542713",
"0.7453651",
"0.7389695",
"0.7318212",
"0.73095465",
"0.7300693",
"0.7126374",
"0.70702684",
"0.6974702",
"0.6883641",
"0.68153864",
"0.67945826",
"0.6788158",
"0.67712146",
"0.67669564",
"0.6765863",
"0.67575383",
"0.67490095",
"0.6743272",
"0.6676891",
"0.6656... | 0.7360493 | 3 |
Rotate the vector by angle_degrees degrees. | def rotate_degrees(self, angle_degrees):
self.rotate(math.radians(angle_degrees)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rotate(vector, angle):\n return np.cos(angle) * vector[0] + np.sin(angle) * vector[1], \\\n -np.sin(angle) * vector[0] + np.cos(angle) * vector[1]",
"def rot(vec, angle, degrees=True):\r\n if degrees:\r\n angle = np.radians(angle)\r\n r = np.array([[np.cos(-angle), -np.sin(-angle)],\r\... | [
"0.7969212",
"0.78765684",
"0.7647407",
"0.7609061",
"0.76077545",
"0.743453",
"0.741273",
"0.73943216",
"0.7259116",
"0.7219938",
"0.71916103",
"0.71554196",
"0.7150546",
"0.715036",
"0.7139389",
"0.7086456",
"0.7057819",
"0.6987557",
"0.6970409",
"0.69501626",
"0.6892157",
... | 0.7844516 | 2 |
Get a normalized copy of the vector | def normalized(self):
length = self.length
if length != 0:
return self/length
return Vec2d(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalized(self):\n len = self.length\n return Vector(self.x / len, self.y / len)",
"def normalize(self):\n self.vector /= np.linalg.norm(self.vector)",
"def normalize(self):\n return Vector(self.args + []) / self.magnitude()",
"def normalize(self):\n\t\tnorm = self.norm()\n\t... | [
"0.81880546",
"0.81318676",
"0.81098855",
"0.8078848",
"0.7996261",
"0.7970171",
"0.79353726",
"0.7922742",
"0.79148006",
"0.7909998",
"0.7863563",
"0.7835526",
"0.7814056",
"0.77766263",
"0.77655596",
"0.7762696",
"0.77525884",
"0.77299833",
"0.772563",
"0.7662124",
"0.76149... | 0.80740744 | 4 |
Normalize the vector and return its length before the normalization | def normalize_return_length(self):
length = self.length
if length != 0:
self.x /= length
self.y /= length
return length | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_vector_length(vector):\n return np.linalg.norm(vector)",
"def normalize(vec):\n min_ = np.min(vec)\n max_ = np.max(vec)\n if min_ != max_:\n n_vec = (vec-min_)/(max_-min_)\n return n_vec\n\n return vec",
"def normalize(vec):\n return vec / length(vec)",
"def length(vec... | [
"0.7846285",
"0.78378594",
"0.780802",
"0.77802336",
"0.766075",
"0.7448021",
"0.7428014",
"0.7389455",
"0.73492056",
"0.7339038",
"0.731229",
"0.72943395",
"0.72908527",
"0.7218219",
"0.7215954",
"0.72006273",
"0.7187827",
"0.71774834",
"0.71501124",
"0.7108761",
"0.7092399"... | 0.69877356 | 26 |
A unit vector pointing up | def unit():
return Vec2d(0, 1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unit(self):\r\n return Vector(self.x/self.length(), self.y/self.length())",
"def getUnitVector(self):\n return Vector.createFromPolar(1, self.angle)",
"def unit(direction):\r\n return Vector(0, -1).rotate(direction)",
"def unit_vector(self,vector):\n return vector / np.linalg.norm... | [
"0.7451307",
"0.7118181",
"0.70831156",
"0.6992387",
"0.6897176",
"0.6890229",
"0.6890229",
"0.6890229",
"0.6878542",
"0.68711114",
"0.6854694",
"0.68440104",
"0.68313295",
"0.6804538",
"0.6782493",
"0.6782493",
"0.6782493",
"0.6782493",
"0.6782493",
"0.6782493",
"0.6782493",... | 0.7370234 | 1 |
Get the domain name from an email address. 'a.person.com' becomes 'email'. | def email_extract(self, email_series: pd.Series):
return (email_series
.str.extract(self.email_extract_re, expand=False)
.map(lambda domain: '' if domain in self.blacklist_domains else domain)
.pipe(self._clean_domain_punctuation)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_domain(email_address: str) -> str:\n return email_address.lower().split(\"@\")[-1]",
"def _get_domain_for_email(email):\n return email.split('@')[1]",
"def email_domain(email):\n parts = email.split(\"@\")\n if len(parts) == 2:\n return parts[1]\n else:\n return None",
... | [
"0.89154553",
"0.8833268",
"0.8532866",
"0.8390516",
"0.83427054",
"0.7603493",
"0.734903",
"0.72232664",
"0.7025018",
"0.6775749",
"0.67693955",
"0.6768244",
"0.67385703",
"0.65958977",
"0.6515175",
"0.64847654",
"0.6467745",
"0.6425446",
"0.6401561",
"0.6387994",
"0.6378444... | 0.0 | -1 |
Extract the company uids matching `self.extract_uid_pat` into their own column. | def extract_uid(self, raw_names: pd.Series) -> pd.Series:
name_patterns = (patterns for kind, patterns in self.abolish_patterns.items() if kind != 'uid')
cleaned_names = self._clean_name(raw_names, chain(*name_patterns))
return cleaned_names.str.extract(self.extract_uid_pat, expand=False) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_company(row):\n global unknown_company_count_global\n associated_company = []\n\n # Identify the target company using known patterns in the tweet text.\n tweet = row['text_derived'].lower()\n author = row['user_screen_name'].lower()\n for company_pattern in PTN_companies:\n if ... | [
"0.54834795",
"0.5477508",
"0.5406373",
"0.50166327",
"0.4832243",
"0.47998986",
"0.47831786",
"0.4651213",
"0.46463442",
"0.46406296",
"0.4630403",
"0.46233618",
"0.46153215",
"0.45944312",
"0.45875332",
"0.45853752",
"0.45391092",
"0.45289016",
"0.4524619",
"0.45049787",
"0... | 0.58374155 | 0 |
Preprend implicit leading singleton dimensions. This is necessary for proper numpy broadcasting. Consider the following | def promote_shapes(*args):
if len(args) < 2:
return args
else:
shapes = [jnp.shape(arg) for arg in args]
batch_shape = lax.broadcast_shapes(*shapes)
num_dims = len(batch_shape)
return [
jnp.reshape(arg, (1,) * (num_dims - len(s)) + s)
if len(s) < n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shape_padleft(t, n_ones=1):\r\n _t = as_tensor_variable(t)\r\n\r\n pattern = ['x'] * n_ones + [i for i in xrange(_t.type.ndim)]\r\n return DimShuffle(_t.broadcastable, pattern)(_t)",
"def _frz(a):\n if a.ndim == 0:\n a.shape = (1,)\n return a",
"def infer_leading_dims(tensor, dim):\n ... | [
"0.59460205",
"0.5675864",
"0.5613765",
"0.560267",
"0.55998707",
"0.5570987",
"0.5558652",
"0.55425847",
"0.5521986",
"0.55159825",
"0.54067093",
"0.53944457",
"0.5344898",
"0.53409255",
"0.53316176",
"0.5324975",
"0.5322167",
"0.5291655",
"0.52658117",
"0.5253124",
"0.52280... | 0.0 | -1 |
Test the tag string representation | def test_tag_str(self):
tag = models.Tag.objects.create(
user=sample_user(),
name='Docker'
)
self.assertEqual(str(tag), tag.name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_tag_str(self):\n tag = models.Tag.objects.create(\n user=sample_user(),\n name='Internal'\n )\n\n self.assertEqual(str(tag), tag.name)",
"def test_tag_str(self):\n tag = models.Tag.objects.create(\n user=sample_user(),\n name='Vegan... | [
"0.7169322",
"0.6938016",
"0.6938016",
"0.69214636",
"0.692024",
"0.68987286",
"0.68849856",
"0.68607813",
"0.66859275",
"0.6493124",
"0.6378444",
"0.6312169",
"0.63072884",
"0.6214954",
"0.61638004",
"0.6154574",
"0.6083939",
"0.6064174",
"0.6059077",
"0.59844977",
"0.594746... | 0.70695263 | 1 |
Create a new user through a superuser. \f | async def create_user(current_active_user: AuthUserPublic = Depends(get_current_active_user),
form_data: AuthUserCreationForm = Depends()) -> AuthUserPublic:
if not current_active_user.is_superuser:
raise HTTPException(status_code=status.HTTP_403_FORBIDDEN,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def createsuperuser():\n\n email = prompt('User E-Mail')\n email_confirm = prompt('Confirm E-Mail')\n\n if not email == email_confirm:\n sys.exit('\\nCould not create user: E-Mail did not match')\n\n if not EMAIL_REGEX.match(email):\n sys.exit('\\nCould not create user: Invalid E-Mail add... | [
"0.8093182",
"0.8034714",
"0.8005862",
"0.7892218",
"0.7883257",
"0.78692764",
"0.78453225",
"0.78451777",
"0.78413445",
"0.77908325",
"0.77676547",
"0.7754382",
"0.77442443",
"0.77363753",
"0.7733197",
"0.77246505",
"0.77220684",
"0.7712074",
"0.7711902",
"0.7705642",
"0.770... | 0.0 | -1 |
Setup the Weather Underground API wrapper. | def __init__(self, key):
try:
# Python 2
if not isinstance(key, (unicode, str)):
raise TypeError('key is not of type unicode or str.')
except NameError:
# Python 3
if not isinstance(key, str):
raise TypeError('key is not of ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, api_key=\"3d34a9a9b0e544269a3ddbb97ec89ba7\", api_current=\"https://api.weatherbit.io/v2.0/current\", api_forecast = \"https://api.weatherbit.io/v2.0/forecast/hourly?\"): \n # constants\n self.API_KEY = api_key\n\n # necessary data for request\n self.API_CURREN... | [
"0.6558916",
"0.6364426",
"0.6305757",
"0.60877883",
"0.5884078",
"0.5875779",
"0.5787939",
"0.576882",
"0.5765331",
"0.5765331",
"0.5744964",
"0.5735187",
"0.57289064",
"0.5687842",
"0.56821775",
"0.5669815",
"0.56687194",
"0.5664689",
"0.56641424",
"0.56061417",
"0.559538",... | 0.0 | -1 |
Returns the GPS coordinates of a node in the form of a (lat, lon) tuple given its id number | def get_coords(data, id):
return data[id]['lat'], data[id]['lon'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getCoords(nodeName, nodeDatabase):\n\n\ttheNode = nodeDatabase[nodeName]\n\n\tif theNode == None:\n\t\treturn None\n\n\txTen = int(nodeName[0])\n\txOne = int(nodeName[1])\n\tyTen = int(nodeName[2])\n\tyOne = int(nodeName[3])\n\n\tx = xTen * 10 + xOne\n\ty = yTen * 10 + yOne\n\n\tx = float(x) + theNode[0]\n\ty ... | [
"0.71329355",
"0.69038033",
"0.68649656",
"0.6678277",
"0.64483297",
"0.6437842",
"0.6384114",
"0.63782245",
"0.6376769",
"0.63460857",
"0.62688994",
"0.6231134",
"0.620093",
"0.61817425",
"0.6147002",
"0.6127867",
"0.6123884",
"0.61216366",
"0.6117178",
"0.61138505",
"0.6066... | 0.7358231 | 0 |
Calculates the closest node in the given dataset to a specified query location | def get_closest_node(data, loc):
min_dist = None
closest = None
for i in data:
# Standard min-value search loop
dist = great_circle_distance(get_coords(data, i), loc)
if closest is None or dist < min_dist:
closest = i
min_dist = dist
return closest | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nearest(self, query):\n nearest_trees = list(map(lambda t: t.get_nearest_neighbor(query), self.trees))\n distances_pool = list(zip(map(lambda x: self.dist_fn(x, query), self.pool), self.pool))\n best = None\n best_cost = np.inf\n for cost, near in nearest_trees + distances_po... | [
"0.6762309",
"0.64828414",
"0.6479973",
"0.63704467",
"0.6340299",
"0.6289788",
"0.6275571",
"0.6218076",
"0.6161571",
"0.61138684",
"0.6088722",
"0.6031872",
"0.60286736",
"0.59927785",
"0.59881276",
"0.59858656",
"0.59744406",
"0.58517927",
"0.5811977",
"0.58055955",
"0.576... | 0.7300712 | 0 |
Returns all (context, reward) where the action was played. | def get_data(self, action):
n, _ = self.contexts.shape
ind = np.array([i for i in range(n) if self.actions[i] == action])
return self.contexts[ind, :], self.rewards[ind, action] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getReward(self):\n return self._mdp.R[self._prev_state,self._cur_state]",
"def get_action_history(self):\n\t\treturn self._action_history",
"def find_reward(self, opponent: Player) -> Dict[Action, Dict[Action, Score]]:\n\n if len(opponent.history) == 0:\n opp_prev_action = self._ra... | [
"0.6147814",
"0.6022552",
"0.59876364",
"0.5973903",
"0.5973903",
"0.5939489",
"0.5894192",
"0.5869531",
"0.58425534",
"0.5841221",
"0.5807607",
"0.5780774",
"0.5763582",
"0.57488453",
"0.573541",
"0.5716168",
"0.5705829",
"0.570321",
"0.57015854",
"0.56991476",
"0.56766206",... | 0.70654607 | 0 |
Returns all observations with onehot weights for actions. | def get_data_with_weights(self):
weights = np.zeros((self.contexts.shape[0], self.num_actions))
a_ind = np.array([(i, val) for i, val in enumerate(self.actions)])
weights[a_ind[:, 0], a_ind[:, 1]] = 1.0
return self.contexts, self.rewards, weights | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def one_hot(labels):\n one_hot_labels = np.zeros(labels.shape + (n_actions,))\n for c in range(n_actions):\n one_hot_labels[labels == c, c] = 1.0\n return one_hot_labels",
"def _action_to_one_hot(self, action):\n zeros = torch.zeros(\n action.size()[0], self.action_dim, dtype=to... | [
"0.69358236",
"0.6899132",
"0.6899132",
"0.6894169",
"0.66251886",
"0.63907874",
"0.639023",
"0.6163317",
"0.6143546",
"0.60526687",
"0.605132",
"0.6032157",
"0.59430504",
"0.5936057",
"0.59028864",
"0.58790654",
"0.5878528",
"0.586545",
"0.58595264",
"0.5852528",
"0.58412504... | 0.6504188 | 5 |
Get the best matched entity for a given query. If the entity is an alias of another entity, the aliased entity is returned. | def post(self, request, domain):
data = request.data.copy()
query_field = data.get("query_field")
query_value = data.get("query_value")
return_canonical = data.get("return_canonical", True)
block_attrs = data.get("block_attrs", {})
scorer_class = data.get("scorer", "fuzzy... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_top_match_or_None(solving_query):\n\ttry:\n\t\tmy_matches = api.search(\n\t\t\t\tsolving_query,\n\t\t\t\tlimit=1,\n\t\t\t\toutfields=['id',\n\t\t\t\t\t'title',\n\t\t\t\t\t'host.title',\n\t\t\t\t\t'host.volume',\n\t\t\t\t\t'host.pages.first',\n\t\t\t\t\t'host.pages.last',\n\t\t\t\t\t'publicationDate',\n\t\t... | [
"0.56701356",
"0.5669867",
"0.5421008",
"0.54176867",
"0.53503567",
"0.52362114",
"0.52350783",
"0.519154",
"0.518304",
"0.5154471",
"0.5130786",
"0.5120862",
"0.5043723",
"0.5017131",
"0.49763173",
"0.4973963",
"0.49389124",
"0.49064702",
"0.48633072",
"0.4856549",
"0.484834... | 0.0 | -1 |
Returns the snake's curvature energy. The straighter the snake the less the curvature energy. This energy's values are within 0 and 2(n2), where n is the number of control points. The curvature is measured by measuring the angles between all threepairs of control points. | def curvatureEnergy(self, controlpoints):
# only remember each curvature energy if the given control points are
# the snakes current control points
memorize_energies = np.equal(controlpoints, self.controlpoints).all()
# reset the curvature energy list if necessary
if memorize_ene... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def curvature(self):\n return self.circle().curvature(self.o, self.r, p = self.a)",
"def _curvature(self):\n y_eval = self.left_fitx.shape[0] - 10\n left_curverad = (((1 + (2 * self.left_fit[0] * y_eval + self.left_fit[1]) ** 2) ** 1.5) /\n np.absolute(2 * self.left_f... | [
"0.70094925",
"0.6831601",
"0.6831484",
"0.68248147",
"0.6619458",
"0.6403633",
"0.63608927",
"0.6249435",
"0.6113684",
"0.6083346",
"0.6066849",
"0.5933526",
"0.5919591",
"0.591756",
"0.5869741",
"0.5812689",
"0.5791419",
"0.5716179",
"0.5649723",
"0.56450933",
"0.5627129",
... | 0.7586239 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.