query stringlengths 9 9.05k | document stringlengths 10 222k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 4 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
List all current voting channels on this server. | async def votechannel_list(self, ctx):
channels = await self.bot.db.execute(
"""
SELECT channel_id, voting_type FROM voting_channel WHERE guild_id = %s
""",
ctx.guild.id,
)
if not channels:
raise exceptions.Info("There are no voting cha... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def list_channel(self, ctx: MyContext):\n channels = self.db_get_channels(ctx.guild.id)\n if not channels: # we can't send an empty list\n await ctx.send(\n await self.bot._(\n ctx.guild.id, \"wormhole.error.no-channels\", p=ctx.prefix\n ... | [
"0.71503365",
"0.6976896",
"0.69284654",
"0.6899874",
"0.6884216",
"0.6682726",
"0.6654007",
"0.6644844",
"0.6593592",
"0.6583516",
"0.65069425",
"0.64936393",
"0.6460782",
"0.64148766",
"0.6403803",
"0.63897705",
"0.6348546",
"0.63290673",
"0.6302498",
"0.6297215",
"0.615387... | 0.8448704 | 0 |
List all current autoroles on this server. | async def autorole_list(self, ctx):
roles = await self.bot.db.execute(
"SELECT role_id FROM autorole WHERE guild_id = %s",
ctx.guild.id,
as_list=True,
)
content = discord.Embed(
title=f":scroll: Autoroles in {ctx.guild.name}", color=int("ffd983", 1... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_auths(self):\n return self.all_auths",
"def autorisaties(self) -> models.QuerySet:\n app_ids = [app.id for app in self.applicaties]\n config = AuthorizationsConfig.get_solo()\n return Autorisatie.objects.filter(\n applicatie_id__in=app_ids, component=config.comp... | [
"0.71425164",
"0.68860537",
"0.65675676",
"0.65675676",
"0.6553339",
"0.6491507",
"0.6429401",
"0.6317257",
"0.6275238",
"0.61803895",
"0.6161167",
"0.6077486",
"0.6065124",
"0.6048245",
"0.6046942",
"0.6010106",
"0.598708",
"0.59708256",
"0.59656996",
"0.5954551",
"0.5927159... | 0.71091723 | 1 |
Disable or enable automatic responses to certain message content such as hi or stfu. | async def autoresponses(self, ctx, value: bool):
await queries.update_setting(ctx, "guild_settings", "autoresponses", value)
self.bot.cache.autoresponse[str(ctx.guild.id)] = value
if value:
await util.send_success(ctx, "Automatic responses are now **enabled**")
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def disable(self):\n self.registrar.unregister_service(\"say\", namespace=__name__)",
"def _reset_to_text_response(self, agent):\n _coordinator_send_message(agent=agent, task_data={'respond_with_form': False})",
"async def goodbye_toggle(self, ctx, value: bool):\n await queries.update_setting(... | [
"0.6161575",
"0.577289",
"0.57692784",
"0.57114846",
"0.5710018",
"0.570837",
"0.57083106",
"0.5686204",
"0.5640309",
"0.55972797",
"0.5577694",
"0.55535847",
"0.55535847",
"0.55090517",
"0.5504524",
"0.5500683",
"0.54992765",
"0.54746073",
"0.5469087",
"0.54484427",
"0.54449... | 0.61072314 | 1 |
Toggle whether delete messages on blacklist trigger. | async def blacklist_delete(self, ctx, value: bool):
await queries.update_setting(ctx, "guild_settings", "delete_blacklisted_usage", value)
if value:
await util.send_success(ctx, "Now deleting messages that trigger any blacklists.")
else:
await util.send_success(ctx, "No l... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def toggle(self, ctx):\n guild = ctx.message.guild\n\n enabled = await self.config.guild(guild).enabled()\n\n enabled = not enabled\n await self.config.guild(guild).enabled.set(enabled)\n\n if enabled is True:\n await ctx.send(\"AntiSpam has been enabled\")\n ... | [
"0.60875565",
"0.5843003",
"0.58193666",
"0.5731226",
"0.5720672",
"0.5683036",
"0.56508",
"0.56109524",
"0.55927044",
"0.55832523",
"0.55055153",
"0.5469491",
"0.5446634",
"0.5423928",
"0.5404556",
"0.5403396",
"0.5397759",
"0.53962266",
"0.5384038",
"0.5375393",
"0.537423",... | 0.7454485 | 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 member of this server. | async def blacklist_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"
]
]
}
} | [
"async def member(self, ctx: commands.Context, member: discord.Member):\n\n if str(member.id) in self.user_blacklist:\n self.user_blacklist.remove(str(member.id))\n removed = True\n else:\n self.user_blacklist.append(str(member.id))\n removed = False\n\n ... | [
"0.6976776",
"0.6840214",
"0.681659",
"0.6687363",
"0.6502579",
"0.6474228",
"0.64588547",
"0.6437371",
"0.63243616",
"0.6312585",
"0.62162197",
"0.6149128",
"0.61392087",
"0.61242867",
"0.60680133",
"0.6018604",
"0.5973482",
"0.5965391",
"0.5944985",
"0.5902114",
"0.58989245... | 0.7193336 | 0 |
Blacklist someone globally from Miso Bot. | async def blacklist_global(self, ctx, user: discord.User, *, reason):
await self.bot.db.execute(
"INSERT IGNORE blacklisted_user VALUES (%s, %s)", user.id, reason
)
self.bot.cache.blacklist["global"]["user"].add(user.id)
await util.send_success(ctx, f"**{user}** can no longer... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def anti_bot(self, message):\n msg_list = self.ts.get_human_readable_message(message).lower().split(' ')\n bot_creation_date = self._get_creation_date(msg_list[1])\n viewers = self.ts.fetch_chatters_from_API()['viewers']\n mod_list = self.ts.get_mods()\n with codecs.open('whiteli... | [
"0.7429653",
"0.7169608",
"0.701961",
"0.69128525",
"0.69120663",
"0.6902885",
"0.6862316",
"0.68516874",
"0.6696523",
"0.659621",
"0.6447195",
"0.6391454",
"0.63389975",
"0.62858325",
"0.62719846",
"0.62275064",
"0.6200777",
"0.6172135",
"0.61428833",
"0.612086",
"0.6111407"... | 0.76539534 | 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 |
Calls pkgconfig with a constructed PKG_CONFIG_PATH environment variable. The PKG_CONFIG_PATH variable is constructed using | def call_pkgconfig(cmd, paths=None):
# locates the pkg-config program
pkg_config = find_executable('pkg-config')
if not pkg_config:
raise OSError("Cannot find `pkg-config' - did you install it?")
pkg_path = construct_search_paths(
prefixes=paths, suffix=os.sep + 'lib' + os.sep + 'pkgconfig')
env ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _prepend_pkg_config_path(path: str) -> str:\n pkgconf = os.environ.get('PKG_CONFIG_PATH')\n if pkgconf:\n return f'{path}{os.path.pathsep}{pkgconf}'\n return path",
"def pkg_config(name):\n\n proc = subprocess.Popen(['pkg-config', '--cflags', '--libs', name], stdout=subprocess.PIPE, stderr... | [
"0.67074317",
"0.6612001",
"0.62043417",
"0.5921221",
"0.53944844",
"0.5234052",
"0.51475054",
"0.5142054",
"0.5127263",
"0.5119361",
"0.51136976",
"0.51034796",
"0.5095964",
"0.50753903",
"0.50334996",
"0.5004503",
"0.4992592",
"0.49852714",
"0.497909",
"0.49065965",
"0.4897... | 0.6958124 | 0 |
Determines the version of pkgconfig which is installed | def version():
status, stdout, stderr = call_pkgconfig(['--version'])
if status != 0:
raise RuntimeError("pkg-config is not installed - please do it")
return stdout.strip() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_pkgcfg_ver(reqver_text, pkgname):\n\treqver = map(int, reqver_text.split('.'))\n\tpkgcmd = os.popen(pkg_config_path +\n ' pkg-config --modversion ' + pkgname, 'r')\n\tpkgcmd_text = pkgcmd.read()\n\tpkgcmd.close()\n\tmatch = re.search(r'^([0-9]+)\\.([0-9]+)\\.([0-9]+)', pkgcmd_tex... | [
"0.6641991",
"0.65226823",
"0.65226823",
"0.6453228",
"0.61556196",
"0.61546624",
"0.61434585",
"0.6132131",
"0.6124848",
"0.6121084",
"0.6113018",
"0.6032466",
"0.5996021",
"0.5958025",
"0.5948517",
"0.593605",
"0.59235",
"0.5894518",
"0.58497757",
"0.5847433",
"0.584635",
... | 0.81292754 | 0 |
Calls call_pkgconfig() with self.name and self.paths | def __xcall__(self, cmd):
return call_pkgconfig(cmd + [self.name], self.paths) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def call_pkgconfig(cmd, paths=None):\n\n # locates the pkg-config program\n pkg_config = find_executable('pkg-config')\n if not pkg_config:\n raise OSError(\"Cannot find `pkg-config' - did you install it?\")\n\n pkg_path = construct_search_paths(\n prefixes=paths, suffix=os.sep + 'lib' + os.sep + 'pkgc... | [
"0.66447085",
"0.5561827",
"0.55596524",
"0.54404974",
"0.5407052",
"0.5403892",
"0.53842944",
"0.537947",
"0.53239274",
"0.532152",
"0.5304144",
"0.5284712",
"0.52223057",
"0.51784086",
"0.5176215",
"0.5175768",
"0.5171042",
"0.51636726",
"0.5070778",
"0.50684524",
"0.506281... | 0.7519324 | 0 |
Returns a preprocessed list containing include directories. | def include_directories(self):
status, stdout, stderr = self.__xcall__(['--cflags-only-I'])
if status != 0:
raise RuntimeError("error querying --cflags-only-I for package `%s': %s" % (self.name, stderr))
retval = []
for token in stdout.split():
retval.append(token[2:])
return uniq(re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def include_dirs(self):",
"def set_include_dirs(self, lst):\n prefix = \"-I\"\n if self.command_basename_startswith(\"cl.\"):\n prefix = \"/I\"\n self.__include_directories = []\n for ii in lst:\n if os.path.isdir(ii):\n new_include_directory = prefix + ii\n if new_include_dir... | [
"0.70987767",
"0.6817322",
"0.6766013",
"0.67580116",
"0.6669968",
"0.6527065",
"0.65140164",
"0.6488053",
"0.64801323",
"0.64504886",
"0.6444608",
"0.6413678",
"0.64098024",
"0.61994565",
"0.6112269",
"0.6111958",
"0.60960174",
"0.59868497",
"0.59467554",
"0.5944289",
"0.592... | 0.68855226 | 1 |
Returns a preprocessed list containing libraries to link against | def libraries(self):
status, stdout, stderr = self.__xcall__(['--libs-only-l'])
if status != 0:
raise RuntimeError("error querying --libs-only-l for package `%s': %s" % (self.name, stderr))
retval = []
for token in stdout.split():
retval.append(token[2:])
return uniq(retval) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_library_list(self):\n ret = []\n prefix = \"-l\"\n if self.__command_basename.startswith(\"cl.\"):\n prefix = \"/l\"\n for ii in self.__libraries:\n ret += [prefix + ii]\n return ret",
"def libraries(self):\r\n ret = []\r\n for x in [y.type for y in self.variables] ... | [
"0.78083",
"0.7513513",
"0.7056382",
"0.6993075",
"0.68387985",
"0.6766917",
"0.6644834",
"0.6493935",
"0.64833564",
"0.6443088",
"0.62977767",
"0.6232702",
"0.61318505",
"0.6128087",
"0.612351",
"0.60844344",
"0.60600287",
"0.60587627",
"0.6056835",
"0.6031022",
"0.60161257"... | 0.75711346 | 1 |
Returns a preprocessed list containing extra link arguments. | def extra_link_args(self):
status, stdout, stderr = self.__xcall__(['--libs-only-other'])
if status != 0:
raise RuntimeError("error querying --libs-only-other for package `%s': %s" % (self.name, stderr))
return stdout.strip().split() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extra_args(self):\n return []",
"def add_extra_args(self):\n pass",
"def get_additional_hook_arguments(\n self,\n path_manager: PathManager,\n extra_arguments: Optional[Dict[str, str]] = None,\n ) -> List[str]:",
"def preprocess_arguments(self, *args, **kwargs):\n ... | [
"0.63731986",
"0.62541825",
"0.60703295",
"0.6023733",
"0.59588355",
"0.57804",
"0.5774337",
"0.577112",
"0.57497627",
"0.57260805",
"0.5645888",
"0.5613394",
"0.55956995",
"0.55905795",
"0.55537224",
"0.55465096",
"0.5546002",
"0.55343294",
"0.5519719",
"0.5517898",
"0.55165... | 0.6531617 | 0 |
Returns a list with all variable names know to this package | def variable_names(self):
status, stdout, stderr = self.__xcall__(['--print-variables'])
if status != 0:
raise RuntimeError("error querying --print-variables for package `%s': %s" % (self.name, stderr))
return stdout.strip().split() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_variables_names(self):\n return self.project.get_variable_names() + self.design.get_variable_names()",
"def varNames(self):\n return self.__varNames",
"def variable_names(self):\n \n return [x['variable'] for x in self.variable_dicts()]",
"def var_names(self):\n ... | [
"0.7876697",
"0.7791961",
"0.7715763",
"0.7681884",
"0.76527923",
"0.76282775",
"0.7505611",
"0.7396491",
"0.73422974",
"0.72504306",
"0.7182517",
"0.7160318",
"0.7042607",
"0.69792956",
"0.69792956",
"0.69792956",
"0.6966744",
"0.69590175",
"0.6954548",
"0.6921896",
"0.69149... | 0.81086004 | 0 |
Returns package availability and version number macros This method returns a python list with 1 macro indicating package availability, using standard GNU compatible names. For example, if the package is named ``blitz``, this | def package_macros(self):
from re import sub
NAME = sub(r'[\.\-\s]', '_', self.name.upper())
return [('HAVE_' + NAME, '1')] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_used_release_specs(package, installed_version=None):",
"def get_package_list():\n pip_freeze = subprocess.check_output(('pip', 'freeze')).decode('utf8')\n package_list = [x.strip().split('==') for x in pip_freeze.split('\\n') if x.find('==') != -1]\n package_list = [(x[0].lower(), x[1]) for x in... | [
"0.6512157",
"0.6315502",
"0.60636437",
"0.5901737",
"0.5865869",
"0.58063704",
"0.57469094",
"0.57015777",
"0.56891394",
"0.56119514",
"0.5560903",
"0.5534766",
"0.549211",
"0.549049",
"0.54788375",
"0.54682416",
"0.5409077",
"0.536008",
"0.5351097",
"0.53499746",
"0.5332549... | 0.71865726 | 0 |
Checks if the structure of sample at most matches the structure of reference. | def _compare_structure(sample, reference):
paths = MappingValidator._find_all_paths(reference)
result = True
for path in paths:
result = result and MappingValidator._validate_key(sample, path)
if not result:
break
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_verify_reference(perfectModelEnsemble_initialized_control, reference):\n pm = perfectModelEnsemble_initialized_control.generate_uninitialized()\n skill = (\n pm.verify(\n metric=\"rmse\", comparison=\"m2e\", dim=[\"init\", \"member\"], reference=reference\n )\n .expan... | [
"0.60541034",
"0.59529144",
"0.58798987",
"0.58677536",
"0.58677536",
"0.58677536",
"0.58677536",
"0.57812834",
"0.5696006",
"0.5679549",
"0.5679549",
"0.5679549",
"0.5660517",
"0.56444365",
"0.56420034",
"0.56084037",
"0.55949867",
"0.55516016",
"0.55409",
"0.5506905",
"0.54... | 0.7061883 | 0 |
Validate all values in mapping if they match their referencevalue. | def _validate_values(self, sample):
result = True
paths = []
#Search vor necessary paths accorduing to comparison_style
if self._comparison_style == ComparisonStyle.minimum:
paths = self._find_all_paths(self._reference)
else:
paths = self._find_all_paths(s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _validate_map(\n mapping: Mapping[str, Any], ref: str, types: Set[str],\n depth: int) -> Optional[SchemaError]:\n return _validate_type_recursively(\n mapping=mapping['values'],\n ref='{}/values'.format(ref),\n types=types,\n depth=depth + 1)",
"def validate_mappi... | [
"0.6899336",
"0.6258376",
"0.60826766",
"0.6078328",
"0.6065238",
"0.5967874",
"0.5946036",
"0.5866797",
"0.5862652",
"0.5792877",
"0.57778394",
"0.57387197",
"0.5664673",
"0.56462336",
"0.5614387",
"0.5595511",
"0.55953866",
"0.5585225",
"0.55339247",
"0.5480244",
"0.5409882... | 0.67175925 | 1 |
Tests comparing coord.Angle to astropy.coordinates.Angle | def test_angle():
# radians
theta_coord = 45. * coord.degrees
theta_astro = astropy.coordinates.Angle(pi/4., units.radian)
# degrees
np.testing.assert_almost_equal(theta_coord.rad, theta_astro.rad, decimal=12)
np.testing.assert_almost_equal(theta_coord / coord.degrees, theta_astro.degree, decim... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_calculate_angle():\n r1 = np.array([0, 0, -1])\n r2 = np.array([0, 0, 0])\n r3 = np.array([1, 0, 0])\n\n expected_angle = 90\n calculated_angle = molecool.calculate_angle(r1, r2, r3, degrees = True)\n\n assert expected_angle == calculated_angle",
"def test_comp_angle_opening(self, test... | [
"0.74958724",
"0.70050144",
"0.699027",
"0.69291717",
"0.67306197",
"0.6664233",
"0.65206933",
"0.6509634",
"0.64358175",
"0.6378449",
"0.6366705",
"0.6356877",
"0.6330454",
"0.6280965",
"0.62722915",
"0.6245148",
"0.6212064",
"0.62004215",
"0.61658835",
"0.6151347",
"0.60950... | 0.82847315 | 0 |
Basic tests of CelestialCoord construction and corresponding SkyCoord construction. | def test_basic():
a1 = astropy.coordinates.SkyCoord(10.625 * units.degree, 41.2 * units.degree)
c1 = coord.CelestialCoord(10.625 * coord.degrees, 41.2 * coord.degrees)
np.testing.assert_almost_equal(c1.rad, [a1.ra.rad, a1.dec.rad], decimal=12)
a2 = astropy.coordinates.SkyCoord('00:42.5 +41:12', unit=(u... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_sky_coord_classic(self):\n sc_cen = SkyCoord(SCS_CENTER)\n tab = conesearch.conesearch(\n sc_cen, SCS_RADIUS, catalog_db=self.url, verbose=self.verbose)\n assert len(tab) > 0",
"def test_find_cities(self):\n\n # Given\n game_state: CarcassonneGameState = Car... | [
"0.72270674",
"0.6355125",
"0.633353",
"0.6307962",
"0.62085503",
"0.620399",
"0.61857384",
"0.6183345",
"0.61713475",
"0.61638206",
"0.6144452",
"0.6130065",
"0.60932183",
"0.6073983",
"0.60255504",
"0.6024263",
"0.6013285",
"0.596432",
"0.596432",
"0.596432",
"0.59464",
"... | 0.67408043 | 1 |
Test the conversion from equatorial to galactic coordinates and back. | def test_galactic():
center = coord.CelestialCoord(coord.Angle.from_hms('17:45:37.1991'),
coord.Angle.from_dms('-28:56:10.2207'))
north = coord.CelestialCoord(coord.Angle.from_hms('12:51:26.27549'),
coord.Angle.from_dms('27:07:41.7043'))
sou... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GalacticToEquatorial(Galactic):\n \n # l,b,s => ra, dec, s\n l = Galactic[:,0]\n b = Galactic[:,1]\n cb = np.cos(b)\n sb = np.sin(b)\n dec = np.arcsin(np.cos(decgp)*cb*np.cos(l-lcp)+sb*np.sin(decgp))\n ra = ragp+np.arctan2(cb*np.sin(lcp-l),sb*np.cos(decgp)-cb*np... | [
"0.64235574",
"0.6356785",
"0.6293801",
"0.62425095",
"0.5853504",
"0.57593346",
"0.57523346",
"0.5751254",
"0.57508725",
"0.5750543",
"0.57351243",
"0.57328695",
"0.5729496",
"0.57282615",
"0.571389",
"0.5696795",
"0.56957716",
"0.5683406",
"0.56728977",
"0.55799973",
"0.556... | 0.666271 | 0 |
Test the conversion from equatorial to ecliptic coordinates and back. | def test_ecliptic():
# Note: These don't have the same level of agreement as galactic coords did.
# Possibly this is related to a caveat in the astropy documentation:
# "In the current version of astropy, the ecliptic frames do not yet have stringent
# accuracy tests."
# Or possibly, the Co... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_voe_coords_to_eqposn(c):\n if (c.system != voeventparse.definitions.sky_coord_system.utc_fk5_geo\n or c.units != 'deg'):\n raise ValueError(\"Unrecognised Coords type: %s, %s\" % (c.system, c.units))\n return Equatorial(c.ra/DEG_PER_RADIAN,c.dec/DEG_PER_RADIAN, epoch=J2000)",
"def... | [
"0.68134445",
"0.6084026",
"0.6024408",
"0.60124457",
"0.60124457",
"0.5996986",
"0.5921803",
"0.583746",
"0.5828925",
"0.58257174",
"0.57490486",
"0.57470924",
"0.57348686",
"0.57324046",
"0.57270604",
"0.5726407",
"0.57256776",
"0.5714674",
"0.56962246",
"0.568963",
"0.5687... | 0.6455512 | 1 |
Mock the send play command | def mock_send_play(start = 1, end = -1, d = 1, poses = None):
global sendPlayCallParams
sendPlayCallParams = { 'start': start, 'end': end, 'direction': d, 'poses': poses } | {
"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.6914049",
"0.68756104",
"0.6671119",
"0.66196835",
"0.6605352",
"0.64986813",
"0.6488218",
"0.6317932",
"0.6264313",
"0.6222181",
"0.6196272",
"0.6153642",
"0.610869",
"0.6063117",
"0.6046637",
"0.60396254",
"0.6036872",
"0.60170114",
"0.60081047",
"0.5987046",
"0.5959207"... | 0.7125662 | 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 |
Run phosim for broadband sed. | def run_phosim_broadband():
print('{} {} {}'.format('\n\n Begin running Phosim for catalog :','broadband', '\n\n'))
# output dir
outputdir1 = 'phosim_output_zipped/broadband_out'
replace_outdir(outputdir1)
# phosim command arguments relative to phosim installtion directory
instance... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main():\n\n\t# =========== Skim file & output file ===========\n\tskimLoc = \"$MJDDATADIR/surfmjd/analysis/skim/DS1/20160621_265313037/*.root\"\n\t# skimLoc = \"/Users/wisecg/datasets/ds1/*.root\"\n\t# wsOut = \"./output/waveSkim-1550-1650.root\"\n\twsOut = \"./output/waveSkim-1500-2000-mH-2.root\"\n\n\t# ====... | [
"0.5277393",
"0.49797785",
"0.49686465",
"0.49075043",
"0.48690727",
"0.4847482",
"0.47847685",
"0.47829846",
"0.47798195",
"0.4777603",
"0.47710115",
"0.47582075",
"0.4756884",
"0.47042078",
"0.4687227",
"0.46780294",
"0.467375",
"0.46664548",
"0.4646169",
"0.4644497",
"0.46... | 0.6581912 | 0 |
if no arguments provided, echos current session name | def do_session(self, name):
if name != "":
self.session = name
else:
print('\n'+self.session+'\n') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def session(self,ctx):\n if ctx.invoked_subcommand is None:\n await ctx.send(\"The current main session is \" + \"```\" + await self.config.sessions.main() + \"```\")",
"def getCurrentUsername(self):\n session = self.getSession()\n if session is not None:\n return... | [
"0.6630605",
"0.6496979",
"0.63429606",
"0.6290319",
"0.6256747",
"0.6194692",
"0.60581684",
"0.60391253",
"0.59876513",
"0.59752023",
"0.59662354",
"0.5929928",
"0.5833089",
"0.58244044",
"0.58176345",
"0.5771798",
"0.57696426",
"0.5731951",
"0.5721568",
"0.5718418",
"0.5715... | 0.71663195 | 0 |
Check buffer size if argument [num] passed, resize buffer to size num | def do_buffer_size(num: int):
if num == '':
print(len(cmd_parser.daq.data))
else:
try:
# TODO support rest of args to buffer resize
cmd_parser.daq.buffer_resize(int(num))
except ValueError:
print('invalid input, [num] mu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_resize_size(size):\n if isinstance(size, int):\n check_value(size, (1, FLOAT_MAX_INTEGER))\n elif isinstance(size, (tuple, list)) and len(size) == 2:\n for i, value in enumerate(size):\n check_value(value, (1, INT32_MAX), \"size at dim {0}\".format(i))\n else:\n r... | [
"0.5483356",
"0.5422928",
"0.53976387",
"0.53622746",
"0.53602207",
"0.5287084",
"0.52568537",
"0.52568537",
"0.5236801",
"0.52271515",
"0.52229625",
"0.52229625",
"0.5222143",
"0.5208141",
"0.5204174",
"0.5176342",
"0.5175779",
"0.51704556",
"0.51626736",
"0.51512283",
"0.51... | 0.7961774 | 0 |
Return the mapped classes and the engine from a given database | def map_database(connection):
eng = create_engine(connection)
metadata = MetaData()
metadata.reflect(eng)
base = automap_base(metadata=metadata)
base.prepare()
return base.classes, eng | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_engine(self, db_name):\n pass",
"def get_database_engine() -> Engine:\n return engine",
"def get_db(database):\n db = getattr(g, '_database', None)\n if db is None:\n intents_db = IntentsDatabaseEngine()\n expressions_db = ExpressionsDatabaseEngine()\n database_dict... | [
"0.624277",
"0.61903936",
"0.5981573",
"0.5934517",
"0.58612776",
"0.58416855",
"0.5755115",
"0.57526946",
"0.5718139",
"0.571291",
"0.5700332",
"0.5697808",
"0.56471187",
"0.5610118",
"0.56047946",
"0.5502123",
"0.54982364",
"0.5486181",
"0.5481824",
"0.5475892",
"0.5416511"... | 0.7997734 | 0 |
Parse galaxy config file and return database connection and engine | def config_parsing(configfile):
config = ConfigParser.ConfigParser()
config.read(configfile)
db_connection = config.get('app:main', 'database_connection')
db, eng = map_database(db_connection)
return db, eng | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_database_config(url):\n parsed = urlparse(url)\n\n config = {\n 'ENGINE': get_database_engine(parsed.scheme),\n 'NAME': parsed.path.lstrip('/'),\n 'HOST': parsed.hostname,\n 'USER': parsed.username or '',\n 'PASSWORD': parsed.password or '',\n 'PORT': parsed.... | [
"0.71468836",
"0.69431347",
"0.67738557",
"0.66180223",
"0.65968585",
"0.65951985",
"0.64858407",
"0.64565605",
"0.6444267",
"0.640329",
"0.6387886",
"0.63835734",
"0.6359741",
"0.6343927",
"0.63286555",
"0.62964356",
"0.6285326",
"0.6259335",
"0.6257268",
"0.62193364",
"0.62... | 0.80534613 | 0 |
converts the voltage value to a distribution of colours between yellow and white to black | def voltage_color(self, voltage):
set_of_colors = []
# black
set_of_colors.append('#000000')
# grey 1
set_of_colors.append('#474747')
# grey 2
set_of_colors.append('#B2B2B2')
# white
set_of_colors.append('#FFFFFF')
# yellow
set_of_c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getColor(self,number):\n if number >= 0:\n if self.inverse:\n ret = cs.hsv_to_rgb(0,0,abs(number/self.maxp))\n else:\n ret = cs.hsv_to_rgb(0,0,1-abs(number/self.maxp))\n else:\n if self.inverse:\n ret = cs.hsv_to_rgb(0,1-abs(number/self.maxn),1)\n else:\n r... | [
"0.7026213",
"0.70033115",
"0.6827387",
"0.66599476",
"0.648112",
"0.6476723",
"0.64435697",
"0.63744205",
"0.63696784",
"0.63115275",
"0.62383306",
"0.6227546",
"0.6210135",
"0.6187264",
"0.61757165",
"0.6121098",
"0.61151767",
"0.611333",
"0.6054253",
"0.6050479",
"0.604593... | 0.80214554 | 0 |
Immediately changes robot's position to specified by coordinates x, y, z | def replace_robot(self, x, y, z):
# min z = 0.1
arr = [x, y, z]
vrep.simxSetObjectPosition(self.client_id, self.handles['youBot' + self.postfix], -1, arr, ONE_SHOT_MODE) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_position(self, x, y, z):\n for sec in self.all:\n for i in range(int(nrn.n3d())):\n nrn.pt3dchange(i, \\\n x-self.x+nrn.x3d(i), \\\n y-self.y+nrn.y3d(i), \\\n z-self.z+nrn.z3d(i), \\\n... | [
"0.73598266",
"0.7286874",
"0.72725",
"0.71620715",
"0.7062355",
"0.69213384",
"0.69071823",
"0.6890328",
"0.68645614",
"0.68453",
"0.68453",
"0.6806454",
"0.6790831",
"0.6782551",
"0.67174673",
"0.67130244",
"0.66701263",
"0.66251385",
"0.66096544",
"0.6609483",
"0.6582883",... | 0.7974002 | 0 |
Returns data measured using LIDAR. Make sure robot you use has a lidar | def get_lidar_data(self):
error_code, ranges = vrep.simxGetStringSignal(self.client_id, 'scan ranges', STREAM_MODE)
time.sleep(0.1)
while len(ranges) == 0:
error_code, ranges = vrep.simxGetStringSignal(self.client_id, 'scan ranges', BUFFER_MODE)
ranges = vrep.simxUnpackFloats... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lidar_callback(self, data):\n try:\n lidar_data = list()\n lidar_degrees = list()\n overlay_lidar_data = list()\n overlay_lidar_degrees = list()\n\n for i in range(len(data.ranges)):\n degree = utils.rad2deg(data.angle_min + data.angl... | [
"0.6919174",
"0.6594578",
"0.60606086",
"0.60313416",
"0.5860034",
"0.58392364",
"0.5807859",
"0.5714537",
"0.56293255",
"0.5600644",
"0.5600129",
"0.55767256",
"0.5529029",
"0.552094",
"0.55153173",
"0.5506128",
"0.5482225",
"0.54649574",
"0.5414204",
"0.5371422",
"0.5369146... | 0.6615537 | 1 |
Set sensor parameters. Sensor name can be fastHokuyo_sensor1, kinect_depth, kinect_rgb. To get list of possible params call youbot.parameters_list | def set_parameter(self, sensor_name, parameter_name, parameter_value):
if parameter_name == 'perspective_angle':
parameter_value = parameter_value / (180 * 2) * math.pi
if parameter_name in self.params_f:
error = vrep.simxSetObjectFloatParameter(
self.client_id,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_parameters(self,params):\n K3Supervisor.set_parameters(self,params)\n self.gtg.set_parameters(self.parameters)\n self.avoidobstacles.set_parameters(self.parameters)\n self.wall.set_parameters(self.parameters)",
"def setParameters(self):\n\n # Set the parameters\n ... | [
"0.6276113",
"0.61270046",
"0.6060408",
"0.602405",
"0.6020808",
"0.59852475",
"0.5957766",
"0.5949292",
"0.5880289",
"0.5869566",
"0.5864805",
"0.584859",
"0.5827211",
"0.58127797",
"0.57573074",
"0.5753346",
"0.5735279",
"0.57312506",
"0.5703972",
"0.5690767",
"0.5686221",
... | 0.7040286 | 0 |
Symlinks a rule's input data into a temporary directory. This is useful both to create a hermetic set of inputs to pass to a documentation builder, or also in case we need to adjust the input data before passing it along. | def symlink_input(filegroup_resource_path, temp_dir, strip_prefix=None,
copy=False):
assert os.path.isdir(temp_dir)
manifest = runfiles.Create()
with open(manifest.Rlocation(filegroup_resource_path)) as f:
input_filenames = f.read().splitlines()
for name in input_filenames:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dummy_input(request, tmpdir_factory):\n # Init variables\n\n input_path = tmpdir_factory.mktemp(\"input_data\").join(\"datasink_test_s3.txt\")\n\n # Create input file\n input_path.write_binary(b\"ABCD1234\")\n\n # Return path\n return str(input_path)",
"def _save_stdin(self, stdin):\n\t\tse... | [
"0.5613835",
"0.5479438",
"0.53865576",
"0.5307909",
"0.53030896",
"0.5258564",
"0.5202292",
"0.51924664",
"0.5100349",
"0.50982475",
"0.508848",
"0.5066093",
"0.50566286",
"0.5039235",
"0.5038229",
"0.50270945",
"0.4978152",
"0.49494198",
"0.4943716",
"0.4941858",
"0.4919468... | 0.6610547 | 0 |
Runs a cleanup pass over all HTML output files, using a set of builtin fixups. Calling code may pass its own extra statements, as well. | def perl_cleanup_html_output(*, out_dir, extra_perl_statements=None):
# Collect the list of all HTML output files.
html_files = []
for dirpath, _, filenames in os.walk(out_dir):
for filename in filenames:
if filename.endswith(".html"):
html_files.append(os.path.relpath(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clean():\n possible_outputs = (\n '{}.html'.format(CONFIG['FULL_PROJECT_NAME']),\n '{}.epub'.format(CONFIG['FULL_PROJECT_NAME']),\n '{}.pdf'.format(CONFIG['FULL_PROJECT_NAME']),\n '{}.docx'.format(CONFIG['FULL_PROJECT_NAME']),\n '{}.odt'.format(CONFIG['FULL_PROJECT_NAME'])... | [
"0.67803067",
"0.65093404",
"0.6495693",
"0.64950496",
"0.6457496",
"0.6350708",
"0.63484263",
"0.63365364",
"0.63010615",
"0.6191002",
"0.6183488",
"0.6170248",
"0.61532885",
"0.6152051",
"0.6144488",
"0.6129948",
"0.61225027",
"0.60941803",
"0.60643804",
"0.60191107",
"0.60... | 0.7284113 | 0 |
Calls build() into out_dir, while also supplying a temp_dir. | def _call_build(*, build, out_dir):
with tempfile.TemporaryDirectory(
dir=os.environ.get("TEST_TMPDIR"),
prefix="doc_builder_temp_") as temp_dir:
return build(out_dir=out_dir, temp_dir=temp_dir) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mktemp(self):\n if self.dryrun:\n return os.path.expandvars(\"$TEMP/build\")\n\n return tempfile.mkdtemp()",
"def build(self):\n if os.path.exists(self.build_path) and not os.path.isdir(self.build_path):\n self._logger.error('Output path must be a folder if it alrea... | [
"0.6693745",
"0.65318495",
"0.65312374",
"0.63957155",
"0.621474",
"0.6171138",
"0.61145437",
"0.6096981",
"0.6027369",
"0.6008954",
"0.60056436",
"0.59535605",
"0.5934935",
"0.591534",
"0.58969146",
"0.58908546",
"0.5884066",
"0.5852764",
"0.58332646",
"0.57599777",
"0.57498... | 0.7080837 | 0 |
An implementation of socketserver.BaseServer.handle_error that ignores expected errors. | def _on_server_error(server, *_):
exception = sys.exc_info()[1]
if isinstance(exception, ConnectionError):
# These are expected errors when the browser closes the connection.
return
# Other errors would be unexpected, so print them.
traceback.print_exc() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patch_broken_pipe_error():\n from socketserver import BaseServer\n\n handle_error = BaseServer.handle_error\n\n def my_handle_error(self, request, client_address):\n type, err, tb = sys.exc_info()\n # there might be better ways to detect the specific erro\n if repr(err) == \"error... | [
"0.6932675",
"0.6442888",
"0.64354676",
"0.6412962",
"0.6412962",
"0.632604",
"0.6203608",
"0.6147532",
"0.60892075",
"0.6055273",
"0.6052481",
"0.6032375",
"0.60196114",
"0.5997642",
"0.5956193",
"0.59396404",
"0.5935701",
"0.58699536",
"0.5852821",
"0.5773886",
"0.572815",
... | 0.66380733 | 1 |
Reusable main() function for documentation binaries; processes commandline arguments and generates documentation. | def main(*, build, subdir, description, supports_modules=False,
supports_quick=False):
parser = argparse.ArgumentParser(description=description)
group = parser.add_mutually_exclusive_group()
group.add_argument(
"--serve", action='store_true',
help="Serve the documentation on the giv... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def libdoc_cli(arguments):\n LibDoc().execute_cli(arguments)",
"def main():\n sys.argv.extend(('--linklint-dir', THIS_DIR,\n '--source-dir', os.path.join(THIS_DIR, 'src'),\n '--project-dir', PROJECT_DIR))\n return docs.generate_docs.main()",
"def main():\n parser = a... | [
"0.7636151",
"0.7391294",
"0.7252765",
"0.7234365",
"0.72313726",
"0.7167421",
"0.7055181",
"0.69958127",
"0.69901484",
"0.6948578",
"0.69291013",
"0.67835206",
"0.6778355",
"0.67502314",
"0.67502314",
"0.67092395",
"0.66928566",
"0.6675915",
"0.66506964",
"0.6644262",
"0.662... | 0.75065213 | 1 |
Test that the plist_items option is working correctly. | def test_plist_items(tmp_path: Path):
create_package(tmp_path, source=PLIST_ITEMS_TEST[4])
output = check_output(
[sys.executable, "setup.py", "bdist_mac"],
text=True,
cwd=os.fspath(tmp_path),
)
print(output)
# Test that the additional keys were correctly added to the plist.
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_keep_list(self):\n input_item = self.item_class(name=[\"foo\", \"bar\"])\n il = ItemLoader(item=input_item)\n loaded_item = il.load_item()\n self.assertIsInstance(loaded_item, self.item_class)\n self.assertEqual(ItemAdapter(loaded_item).asdict(), {\"name\": [\"foo\", \"b... | [
"0.6441555",
"0.64165115",
"0.6366999",
"0.63468474",
"0.6236531",
"0.6205991",
"0.61825705",
"0.6169146",
"0.614385",
"0.6070881",
"0.5978384",
"0.59771633",
"0.5957149",
"0.58904463",
"0.586428",
"0.586428",
"0.5799499",
"0.57878184",
"0.57777727",
"0.57635236",
"0.5743338"... | 0.7832976 | 0 |
Calcuales the the natural log of the prior p(params). This implements the the fixed emperically determined priors from the paper. | def compute_log_prior(self,params: ndarray) -> float:
ln_tE = params[0]
ln_A0 = params[1]
ln_deltaT = params[2]
fbl = params[3]
mb = params[4]
# Equation (16,15,17) (note that Albrow uses "log" for log10)
log10e = np.log10(np.exp(1))
ln_pr_ln_tE = np.log(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_log_prob(self,params: ndarray) -> float:\n return self.compute_log_prior(params) + self.compute_log_likelihood(params)",
"def _log_prior_gradients(self):\r\n if self.priors is None:\r\n return 0.\r\n x = self._get_params()\r\n ret = np.zeros(x.size)\r\n [... | [
"0.76091146",
"0.7371126",
"0.72814584",
"0.72760296",
"0.7240055",
"0.7236163",
"0.7196639",
"0.7188493",
"0.7066744",
"0.70638007",
"0.7029924",
"0.70133555",
"0.6962118",
"0.69369596",
"0.69369596",
"0.69089544",
"0.6906893",
"0.6906438",
"0.69009686",
"0.68660134",
"0.684... | 0.73947585 | 1 |
Calculates the natural log of the likelihood p(data|params). Implements a standard Gaussian Likelihood. | def compute_log_likelihood(self,params: ndarray) -> float:
pred_mag = self._pred_mag(params,self.times)
sigma_2 = self.sd_mags**2
ln_likelihood = -0.5*np.sum((pred_mag - self.mags)**2 / sigma_2+ np.log(sigma_2))
return ln_likelihood | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def log_likelihood(X, parameters):\n check_data_type_column_data(X)\n check_model_params_dict(parameters)\n\n sigma = (1.0/parameters['rho'])**.5\n\n log_likelihood = numpy.sum(norm.logpdf(X,parameters['mu'],sigma))\n\n return log_likelihood",
"def log_likelihood(self, params):... | [
"0.7508061",
"0.72767997",
"0.7258539",
"0.7223624",
"0.7180882",
"0.7151825",
"0.7125991",
"0.70642906",
"0.70582336",
"0.7050475",
"0.7007016",
"0.6994917",
"0.69492894",
"0.6943179",
"0.69418025",
"0.6934573",
"0.6901201",
"0.69006485",
"0.68989974",
"0.6874367",
"0.685652... | 0.7306519 | 1 |
Calculates the negative natural log of the likelihood p(data|params). This is for optimizing purposes, for finding the maximum likelihood (mle) solution. | def neg_log_likelihood(self,params: ndarray) -> float:
return -self.compute_log_likelihood(params) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def neg_log_prob(self,params: ndarray) -> float:\n return -self.compute_log_prob(params)",
"def log_likelihood(self, params):\n # extract the parameters\n m1 = params['m1']\n m2 = params['m2']\n DL = params['DL']\n Tc = params['Tc']\n iota = params['iota']\n ... | [
"0.77713954",
"0.7544109",
"0.7317229",
"0.7240893",
"0.7203177",
"0.7124899",
"0.7113089",
"0.7102262",
"0.7081546",
"0.70794886",
"0.70794886",
"0.7061949",
"0.7042193",
"0.70398724",
"0.7020768",
"0.7008686",
"0.7008686",
"0.6993861",
"0.6922376",
"0.6899017",
"0.68945503"... | 0.7963539 | 0 |
Calculates the the natural log of the joint p(data,params). This is proportional to the posterior distribution. | def compute_log_prob(self,params: ndarray) -> float:
return self.compute_log_prior(params) + self.compute_log_likelihood(params) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def log_prob(self):",
"def calculateLogJointProbabilities(self, datum):\n\tlogJoint = util.Counter()\n\t#want to calculate log(P(y)) + log(sum(P(fi|y)))\n\t#where y is a label\n\tfor label in self.legalLabels:\n\t\tlogJoint[label] = math.log(self.prior_distribution_prob[label])\n\t\tfor feature, value in datum.i... | [
"0.7367025",
"0.7348983",
"0.722642",
"0.7059102",
"0.70346844",
"0.7020093",
"0.69919014",
"0.6969139",
"0.6954027",
"0.6954027",
"0.6945095",
"0.6940737",
"0.69243836",
"0.6905241",
"0.6862193",
"0.6827909",
"0.68258524",
"0.68257785",
"0.68035394",
"0.67972386",
"0.6782225... | 0.789454 | 0 |
Calculates the negative of the natural log of p(data,params). This is for optimizing purposes, for finding the maximum aposteroir (MAP) solution. | def neg_log_prob(self,params: ndarray) -> float:
return -self.compute_log_prob(params) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def log_p(self,z):\n return log_p_posterior(z, self.neg_posterior)",
"def safe_p_log_p(data):\n\n non_zero = data != 0\n result = numpy.zeros(data.shape, dtype=float)\n with numpy.errstate(invalid=\"raise\"):\n result[non_zero] = -data[non_zero] * numpy.log2(data[non_zero])\n return res... | [
"0.7699586",
"0.75272185",
"0.7411945",
"0.73009354",
"0.7299194",
"0.72129875",
"0.7187763",
"0.7068993",
"0.7061526",
"0.70612997",
"0.7043844",
"0.69435984",
"0.6911063",
"0.6869892",
"0.68453896",
"0.68145955",
"0.67920816",
"0.6737737",
"0.66958004",
"0.66734076",
"0.667... | 0.7901932 | 0 |
Finds the maximum likelihood (MLE) solution. Uses only the current data to find and assign the MLE parameters. This is minimizing chi^2. Prints the optimization result. | def train_MLE(self) -> None:
result = differential_evolution(self.neg_log_likelihood,
bounds=self.initial_params_bounds)
self.mle_params = result['x']
print(result) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def maxlikelihood(self):\n\n chi2 = lambda *args: -2 * lnlikelihood.lnlike(*args) \n # print('***DEBUGGING*** chi2 = ', chi2)\n # print('***DEBUGGING*** self.theta_guess = ', self.theta_guess)\n # print('***DEBUGGING*** self.transinfo = ', self.transinfo)\n # print('***D... | [
"0.67882365",
"0.59348327",
"0.5894277",
"0.5830054",
"0.575232",
"0.56581044",
"0.5625246",
"0.5594237",
"0.5593116",
"0.5591148",
"0.55847645",
"0.55694425",
"0.55037385",
"0.5476927",
"0.5463026",
"0.5452597",
"0.5446685",
"0.5432048",
"0.54116064",
"0.5410554",
"0.5401556... | 0.67546475 | 1 |
Predicts magnitudes using MAP solution. M = number of new times to predict at. | def predict_MAP(self,new_times: ndarray) -> ndarray:
return self._pred_mag(self.map_params,new_times) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def predict_MLE(self,new_times: ndarray) -> ndarray:\n return self._pred_mag(self.mle_params,new_times)",
"def _pred_mag(self,params: ndarray, times: ndarray) -> ndarray:\n tE = np.exp(params[0])\n A0 = np.exp(params[1])\n deltaT = np.exp(params[2])\n fbl = params[3]\n m... | [
"0.6083128",
"0.56991065",
"0.5618131",
"0.56114894",
"0.56114894",
"0.54825455",
"0.5327639",
"0.53208554",
"0.52831477",
"0.52614605",
"0.5253151",
"0.51878124",
"0.5187004",
"0.51805824",
"0.5120811",
"0.5114554",
"0.5107988",
"0.50931054",
"0.50931054",
"0.50931054",
"0.5... | 0.7307092 | 0 |
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 |
Finds the alert time in the data. This is defined in the paper as the time where there are 3 data points 1 standard deviation away from baseline. | def find_alert_time(self) -> None:
# Also not clear from the paper how to doe this,
# use the first 10 data points in the light curve to determine the magnitude
# baseline
mean_mag = np.mean(self.mags[:10])
std_mag = np.std(self.mags[:10])
num_above = 0
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_analyze_time(self):\n self.ph5validate.analyze_time()\n self.assertEqual(self.ph5validate.das_time.keys(), [('12183', 1, 500)])\n Dtime = self.ph5validate.das_time[('12183', 1, 500)]\n\n # 3 different deploy time\n self.assertEqual(len(Dtime['time_windows']), 5)\n\n ... | [
"0.5990477",
"0.58209413",
"0.58208877",
"0.58156",
"0.57620144",
"0.5673101",
"0.56323",
"0.5565282",
"0.5517574",
"0.5515952",
"0.5510017",
"0.5490735",
"0.5447371",
"0.54419374",
"0.5434978",
"0.5434944",
"0.542244",
"0.54200256",
"0.5411645",
"0.54094666",
"0.5409089",
... | 0.7926745 | 0 |
Adds a cloud data dict to the instance, base on the input_string | def __init__(self, input_string):
self.words_to_counts = {}
self.split_and_populate_words(input_string) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_input(input_string, trie):\n trie.insert(input_string) # add name to Trie",
"def read_string(self, string, **kwds):\n self._dict.update(json.loads(string))",
"def __init__(self, inputString=\"\"):\n self.setInputString(inputString)\n self.__setVarNames()\n self.__expressi... | [
"0.56919914",
"0.55682784",
"0.54298645",
"0.53829646",
"0.5267533",
"0.5210206",
"0.52044094",
"0.5183222",
"0.51680285",
"0.5168021",
"0.515392",
"0.5140981",
"0.51303226",
"0.51155186",
"0.50772077",
"0.5021945",
"0.5020643",
"0.5017638",
"0.50147086",
"0.5009846",
"0.4998... | 0.57263285 | 0 |
Initialize File Session Driver. settings section 'host' is recommended, the option 'prefix' is an optional. if prefix is not given, 'default' is the default. | def __init__(self, **settings):
super(FileSession, self).__init__(**settings)
self.host = settings.get("host", self.DEFAULT_SESSION_POSITION)
self._prefix = settings.get("prefix", 'default')
if not exists(self.host):
os.makedirs(self.host, 448) # only owner can visit this s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, fileName = \"netspy.conf\"):\n\t\tself.options = {'port' : '', 'server_port' : '', 'server_ip': '', 'service_list': [] }\n\t\tself.fileName = fileName\n\t\tself.loadFromFile(self.fileName)",
"def __init__(self, smartcards=None, **kwargs):\n FileSystemClient.__init_with_kwargs__(self, kw... | [
"0.59262127",
"0.58217466",
"0.5797809",
"0.57552093",
"0.57388306",
"0.5613104",
"0.5601962",
"0.5601011",
"0.55973256",
"0.5524866",
"0.5495558",
"0.5487103",
"0.5486128",
"0.5474107",
"0.540133",
"0.5362516",
"0.53614086",
"0.53287196",
"0.5299683",
"0.52640104",
"0.525464... | 0.7221573 | 0 |
retourne vrai si on peut former le mot avec les lettres de la liste | def mot_possible(mot:str,lettres:str)->bool:
retour = False
L=[]
for i in lettres:
if presente(i,mot)!=-1 :
L.append(i)
if len(L)>=len(mot):
retour = True
return(retour) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def editar_L0(L0):\n #percorre a lista\n #para cada elemento, percorre e ve se a primeira parte ou a ultima ou as duas sao '' e ,se for, tira\n #para cada elemento, percorre e ve se a ultima parte eh ponto ou virgula, se for tira \n for i in range(len(L0)):\n if L0[i][0:2] == \"''\" and L0[i][le... | [
"0.5759686",
"0.5732076",
"0.5322636",
"0.53158194",
"0.52445304",
"0.5096131",
"0.5041577",
"0.5026547",
"0.5025119",
"0.50187504",
"0.5018382",
"0.50037766",
"0.5001517",
"0.49978316",
"0.4984823",
"0.49654156",
"0.4959126",
"0.4954645",
"0.49391323",
"0.49331093",
"0.48782... | 0.5955658 | 0 |
select which eye to use. Data of the unselected eye will be removed. | def select_eye(data, use_eye):
if (use_eye == 'left') & ('pup_l' in data.columns):
data[['x','y','pup']] = data[['x_l','y_l','pup_l']]
elif (use_eye == 'right') & ('pup_r' in data.columns):
data[['x','y','pup']] = data[['x_r','y_r','pup_r']]
# when the eye requested is not available
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deselect_me(self):\r\n\t\tself.active = False",
"def select_tower(self, tower):\n for tower_type, shop_tower_view in self._tower_views:\n shop_tower_view.set_selected(False)\n if tower_type.__class__ == tower:\n shop_tower_view.set_selected(True)\n\n self._c... | [
"0.57724416",
"0.5672868",
"0.5575577",
"0.54836756",
"0.54060626",
"0.54060626",
"0.52739674",
"0.5264179",
"0.52551025",
"0.5250396",
"0.5233696",
"0.52229357",
"0.51954186",
"0.51422364",
"0.51160854",
"0.5104527",
"0.5104527",
"0.5097805",
"0.5074681",
"0.50719476",
"0.50... | 0.65286005 | 0 |
Detect blinks in pupil sizes and set pupil size around blinks as NaN. Blink detection is based on Hershman et al. (2018). | def deblink_pupil(df, column, samp_freq):
# detecting blinks
blinks = based_noise_blinks_detection(df[column].values, samp_freq)
# set samps during blinks as NaN
df[column + '_deblink'] = df[column]
for i in zip(blinks['blink_onset'],blinks['blink_offset']):
df[column + '_d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_blinking(self):\n if self.pupils_located:\n blinking_ratio = (self.eye_left.blinking + self.eye_right.blinking) / 2\n return blinking_ratio > 3.8",
"def interpolate_blinks(self, method='linear', lin_interpolation_points=[[-150],[150]], spline_interpolation_points=[[-0.15,-0.07... | [
"0.60936016",
"0.5745936",
"0.56748337",
"0.5457452",
"0.53441256",
"0.53379273",
"0.529168",
"0.5252009",
"0.5191336",
"0.5189391",
"0.518415",
"0.5125137",
"0.5113763",
"0.51118827",
"0.50969136",
"0.50687087",
"0.50637066",
"0.5056388",
"0.50524795",
"0.50383115",
"0.50372... | 0.6570772 | 0 |
perform rolling mean or hann smoothing on a column | def smooth_pupil(df, column, method='hann', window=10):
if len(df[column]) < window:
raise Exception('Length of data smaller than window size.')
if window < 3:
warnings.warn("Window size is too small (< 3). Smoothing not performed.")
if method not in ['rollingm... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def smooth(x, window,nan=True,old=False,fill='mean'):\n if nan:\n from Sp_parameters import nanmasked\n from scipy import interpolate\n ix = np.arange(len(x))\n xmasked, mask = nanmasked(x)\n if fill == 'mean':\n fv = np.mean(xmasked)\n elif fill == 'median':... | [
"0.6314557",
"0.6249574",
"0.62445706",
"0.6151236",
"0.6078539",
"0.60771596",
"0.6073987",
"0.60580486",
"0.6036201",
"0.6031932",
"0.6022767",
"0.6003929",
"0.60028756",
"0.5975392",
"0.5958373",
"0.5948299",
"0.5941447",
"0.5933349",
"0.59281266",
"0.5910775",
"0.59085554... | 0.71817005 | 0 |
performs baseline correction on pupil data | def baseline_correction(df, pup_col, time_col, baseline_range, method='subtractive'):
if method not in ['subtractive','divisive']:
raise Exception("Invalid baseline correction method. Please use 'subtractive' or 'divisive'.")
bl_mean = df.loc[(df[time_col] >= baseline_range[0]) & (df[... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def baseline_correct(self):\n\n x_a = np.arange(0, len(self.phased))\n # vector the same length as the data in one direction\n\n base = np.zeros((dim_matrix, dim_matrix))\n for i in range(0, len(self.phased)):\n phased_baseline = np.polyfit(x_a, self.phase... | [
"0.6531881",
"0.62890786",
"0.6217331",
"0.617967",
"0.61052096",
"0.5802438",
"0.5736517",
"0.5723023",
"0.566816",
"0.56250554",
"0.5504359",
"0.54824984",
"0.54698795",
"0.5409414",
"0.53657055",
"0.53657055",
"0.5345652",
"0.53421813",
"0.5333282",
"0.53200775",
"0.531825... | 0.7123004 | 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 |
Generate time series data over the time vector t. The value of t can be a sequence of integers generated using the numpy.arange() function. The default frequency is designed for 2750 samples. | def time_series(t, f=0.02):
T = t.size
# Seasonal component and time-varying trend component
ys = np.sin(2 * np.pi * f * t) * 0.6 + np.sin(1 / 5 * 2 * np.pi * f * t) * 0.2
# Amplitude modulation component
amp_mod = 0.5 * np.sin(1 / 6 * 2 * np.pi * f * t) + 0.8
ys *= amp_mod
ys = np.reshape(y... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_time_series(num_points, num_dims):\n phase = np.random.randn()\n period = np.random.uniform()\n times = np.linspace(0, 10, num_dims)\n scale = np.random.exponential(size=num_points)\n return np.outer(scale, np.sin(times / period + phase))",
"def fake_data(sample_rate=512,psd_segment_l... | [
"0.6736556",
"0.659461",
"0.6503622",
"0.64926344",
"0.6437805",
"0.6393325",
"0.6367344",
"0.62668175",
"0.62449056",
"0.6174473",
"0.61706257",
"0.6107033",
"0.6093634",
"0.6091746",
"0.60835767",
"0.6049629",
"0.6015912",
"0.5936667",
"0.5898186",
"0.58888006",
"0.58529484... | 0.70478433 | 0 |
Generate a dataset using the time_series function. The function generates a dataset comprising 'n_seqs' timeseries sequences of length T. This dataset is split into training, testing, and validation sets. Returns a training, a test, and validation dataset. | def generate_data(T = 2750, period = 50, n_seqs = 4):
# Use a fixed seed for repreducible results
np.random.seed(1)
# Frequency
f = 1/period
# Generate n_seqs of sequences using the time_series method
y = []
for i in range(n_seqs):
idx = np.random.randint(0, T)
y.append(ti... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_dataset(self, x, t, n_samples, noise, random=True, return_idx=False, random_state=42):\n assert ((x.shape[1] == 2) & (t.shape[1] == 1)), 'x and t should have shape (n_samples x 1)'\n u = self.generate_solution(x, t)\n\n X = np.concatenate([t, x], axis=1)\n y = u + noise * np.... | [
"0.6435442",
"0.6374005",
"0.6350481",
"0.6327455",
"0.6257049",
"0.62425745",
"0.6235227",
"0.61706805",
"0.6053244",
"0.5979172",
"0.5911962",
"0.5889661",
"0.5877714",
"0.5857917",
"0.5835533",
"0.58281624",
"0.58033496",
"0.5795021",
"0.5788117",
"0.5786155",
"0.57734877"... | 0.8150712 | 0 |
x = number of nodes in the linear network dim = the dimension of each weight vector corresponding to each nodes in the network | def initialisation(x, dim, n_iterations):
net_dim = x
init_radius = int(x / 4)
times = n_iterations / np.log(init_radius)
network = np.random.random((x,dim))
return net_dim, init_radius, times, network | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _forward(self, x):\n global global_epoch\n global_epoch += 1\n bias = -np.ones((x.shape[0], 1))\n tail = np.zeros((x.shape[0], self.dim_hid+self.dim_out))\n nodes = np.concatenate((bias, x, tail), axis=1)\n weight = self.weight * self.connectivity\n for i in ran... | [
"0.64593065",
"0.6312733",
"0.6305278",
"0.62892145",
"0.622389",
"0.62031335",
"0.61905336",
"0.611107",
"0.6026734",
"0.5993028",
"0.5993028",
"0.5972353",
"0.59585893",
"0.58770925",
"0.5865397",
"0.5855216",
"0.58343",
"0.5798107",
"0.5793388",
"0.5782956",
"0.5780248",
... | 0.6329795 | 1 |
Check if player exists in Players collection. Returns empty list if no player exists. If player exists, returns dict showing if br or fg data exists. | def player_exists(self, player):
res = self._db.Players.aggregate([{'$match': {'Name': player}},
{'$project':
{'br': {'$ifNull': ['$br', 0]},
'fg': {'$ifNull': ['$fg', 0]}}}
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_player(self, p: Player) -> bool:\n return p in self.players",
"def has_player(self, id):\r\n if id in self.players:\r\n return True\r\n \r\n return False",
"def check_win(self) -> Union[Player, None]:\n\t\tfor player in self.players:\n\t\t\tif len(player.deck) == ... | [
"0.68983775",
"0.6730047",
"0.6647593",
"0.6522126",
"0.64951974",
"0.64210033",
"0.6361015",
"0.6292166",
"0.62806696",
"0.6267315",
"0.6210109",
"0.60975343",
"0.60599285",
"0.6058406",
"0.6014438",
"0.59731406",
"0.5946809",
"0.5925837",
"0.5908906",
"0.5881675",
"0.586205... | 0.7800144 | 0 |
Return Player BR ID from Teams collection Player objects are in Fortyman array | def get_player_brid(self, player, team, year=None):
year = self._year if not year else year
fortypath = '$Fortyman.{}'.format(year)
namepath = '$Fortyman.{}.Name'.format(year)
bidpath = '$Fortyman.{}.bid'.format(year)
res = self._db.Teams.aggregate([{'$match': {'Tm': team}},
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_team_bid(self, team_id):\n\t\tplayer_ids = [(self.reference_id + team_id) % 4, (self.reference_id + team_id + 2) % 4]\n\t\tres = []\n\t\tsummable = True\n\t\tfor player_id in player_ids:\n\t\t\tif player_id in self.bids:\n\t\t\t\tif self.bids[player_id] == \"N\" or self.bids[player_id] == \"B\":\n\t\t\t\t\... | [
"0.6006488",
"0.58002996",
"0.5771956",
"0.57435316",
"0.56821424",
"0.56593627",
"0.5651891",
"0.5590214",
"0.5522346",
"0.55201375",
"0.54899096",
"0.5463544",
"0.5395016",
"0.53892416",
"0.53861994",
"0.53841716",
"0.53760535",
"0.5364719",
"0.5323653",
"0.53211504",
"0.53... | 0.65213543 | 0 |
Return team pitcher data from Games collection | def get_pitchers_by_game(self, team, date):
abbr = convert_name(team, how='abbr')
pitch = '{}.pitching'.format(abbr)
return self._db.Games.aggregate([{'$match':
{'$and': [{'date': date},
{'$or': [{'home' ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_teams():",
"def teams(self, game_id: int) -> DataFrame[Any]:",
"def get_player_stats_from_game(team, year, week):",
"def get_people(team):",
"def get_single_game_team_data(game, grouped_shot_data, pp_sit_data):\n game_stat_lines = list()\n game_id = game['game_id']\n home_id = game['home_i... | [
"0.68693125",
"0.6610843",
"0.6577653",
"0.6559358",
"0.63839734",
"0.6327564",
"0.62994874",
"0.62805307",
"0.62701905",
"0.621557",
"0.6210988",
"0.6196189",
"0.61902976",
"0.6185755",
"0.61834437",
"0.61783755",
"0.6135383",
"0.6122152",
"0.60657275",
"0.60543734",
"0.6042... | 0.73173296 | 0 |
Query all player objects given a team | def get_players_by_team(self, team, year=None):
year = self._year if not year else year
return self._db.Players.find({'{}.Team'.format(year) : team}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_queryset(self):\n team = get_object_or_404(models.Team, pk=self.kwargs.get('pk'))\n\n return team.players.all()",
"def find_players_for_team(self, team, src='roster', season=None):\n # creating class wide variable to hold current team\n if type(team) is str:\n team ... | [
"0.7441794",
"0.7308383",
"0.7305146",
"0.70083475",
"0.6581862",
"0.65165186",
"0.6475635",
"0.64408505",
"0.6189061",
"0.6168259",
"0.61635286",
"0.6138322",
"0.6114742",
"0.6103907",
"0.6045527",
"0.60125387",
"0.6009375",
"0.5976768",
"0.59735173",
"0.5966314",
"0.5939911... | 0.7332201 | 1 |
Return all docs in Team collection | def get_all_teams(self):
return self._db.Teams.find({}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def documents(self):\r\n return doc.Documents(self)",
"def _get_documents(self) -> Iterable[dict]:\n\n return self._db[\"documents\"]",
"def index(cls, db):\n return (Todo(**doc) for doc in cls.collection(db).find())",
"def test_get_all_for_team(self):\n team = Team.create(name='f... | [
"0.65098554",
"0.6294168",
"0.62648034",
"0.62586147",
"0.6211849",
"0.6189658",
"0.6073416",
"0.6018746",
"0.6014311",
"0.60027194",
"0.60026485",
"0.59767663",
"0.59513336",
"0.59268254",
"0.5918525",
"0.58900136",
"0.58810943",
"0.58797365",
"0.5875649",
"0.5843608",
"0.58... | 0.70208377 | 0 |
Query all game objects by given date | def get_games_by_date(self, date):
return self._db.Games.find({'date' : date}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __call__(self, date):\n for game in self._games:\n if game.datetime.year == date.year and \\\n game.datetime.month == date.month and \\\n game.datetime.day == date.day:\n return game\n raise ValueError('No games found for requested date')",
... | [
"0.7248055",
"0.6254848",
"0.58770686",
"0.5858514",
"0.5780547",
"0.5761338",
"0.57299364",
"0.5667569",
"0.5610656",
"0.55743295",
"0.55086875",
"0.55043006",
"0.5472266",
"0.54695195",
"0.5449813",
"0.5437314",
"0.5433963",
"0.5412661",
"0.53695893",
"0.53412926",
"0.53412... | 0.75370586 | 0 |
Query game preview for specific team | def get_team_game_preview(self, team, date):
abbr = convert_name(team, how='abbr')
return self._db.Games.find({'date' : date,
'$or' : [{'home' : abbr},
{'away' : abbr}]}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_team_game_previews(self, team, dates):\n abbr = convert_name(team, how='abbr')\n return self._db.Games.find({'date' : {'$in' : dates},\n '$or' : [{'home' : abbr},\n {'away' : abbr}]})",
"def getTeamInfo(team):\r\... | [
"0.6624338",
"0.65010005",
"0.6357424",
"0.6333016",
"0.61604846",
"0.6121797",
"0.6034834",
"0.5942914",
"0.5926001",
"0.5907585",
"0.5899037",
"0.58743787",
"0.58301115",
"0.5793244",
"0.57700795",
"0.5744426",
"0.5737215",
"0.57104313",
"0.569053",
"0.567354",
"0.5673149",... | 0.7516042 | 0 |
Query game preview for team given list of dates | def get_team_game_previews(self, team, dates):
abbr = convert_name(team, how='abbr')
return self._db.Games.find({'date' : {'$in' : dates},
'$or' : [{'home' : abbr},
{'away' : abbr}]}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_team_game_preview(self, team, date):\n abbr = convert_name(team, how='abbr')\n return self._db.Games.find({'date' : date,\n '$or' : [{'home' : abbr},\n {'away' : abbr}]})",
"def __call__(self, date):\n for... | [
"0.66713834",
"0.6377972",
"0.6331023",
"0.62907255",
"0.6262722",
"0.6188576",
"0.61689144",
"0.6080802",
"0.60751027",
"0.58672905",
"0.5806579",
"0.5798872",
"0.5789084",
"0.57799",
"0.57715464",
"0.57380354",
"0.5658206",
"0.56285685",
"0.56002957",
"0.55950874",
"0.55916... | 0.661973 | 1 |
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 |
Return top n pitchers sorted by stat | def get_top_n_pitchers(self, role, year, stat, ascending, n):
stat = 'pit_WAR' if stat == 'WAR' else stat
sort_key = 'fg.pit.{}.{}'.format(year, stat)
ids = self.get_starters_or_relievers(role=role, year=year, kind='pit')
sort_direction = 1 if ascending else -1
if stat == 'ERA':... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def top_by_num_of_ratings(self, n):\n return top_movies",
"def get_top_n_leaders(self, kind, stat, year, n):\n if stat in ['WAR', 'rank', 'G']:\n sort_key = 'fg.{0}.{1}.{0}_{2}'.format(kind, year, stat)\n else:\n sort_key = 'fg.{}.{}.{}'.format(kind, year, stat)\n\n... | [
"0.6808973",
"0.66511554",
"0.66491383",
"0.654208",
"0.64250934",
"0.6251189",
"0.6165081",
"0.6162983",
"0.61609346",
"0.61172175",
"0.6097772",
"0.60408896",
"0.60362566",
"0.6024945",
"0.59676087",
"0.59625465",
"0.59625465",
"0.5956659",
"0.59538746",
"0.5916932",
"0.589... | 0.7233811 | 0 |
Return set of all date values in Games collection for a specified year | def get_past_game_dates(self, year=None):
year = self._year if not year else year
data = list(self._db.Games.aggregate([{'$project':
{'_id' : 0,
'date' : 1}}]))
dates = set([x['date'] for x in dat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_player_games(self, year, use_local=True):",
"def all_match_data(year):\n year_match_data = []\n match_year_data = pm()\n for count in range(len(match_year_data)):\n if year == match_year_data[count][1]:\n year_match_data.append(match_year_data[count])\n for count in range(le... | [
"0.6871454",
"0.66479003",
"0.65550137",
"0.6538014",
"0.6501353",
"0.6389797",
"0.63651264",
"0.63318807",
"0.6313537",
"0.6291224",
"0.62657744",
"0.6216028",
"0.60670346",
"0.60484165",
"0.60418427",
"0.60398924",
"0.6034976",
"0.60272115",
"0.60138303",
"0.59491044",
"0.5... | 0.7347461 | 0 |
Return dates where games have not been updated. Delete games that are postponed but state hasn't changed. | def find_outdated_game_dates(self):
state = 'preview.gameData.status.detailedState'
old = self._db.Games.find({state : {'$nin' : ['Final']}})
return set([x['date'] for x in old]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_past_game_dates(self, year=None):\n year = self._year if not year else year\n data = list(self._db.Games.aggregate([{'$project':\n {'_id' : 0,\n 'date' : 1}}]))\n dates = set([x['date'] fo... | [
"0.58556795",
"0.57851714",
"0.57787824",
"0.5695505",
"0.56824774",
"0.5671181",
"0.56686157",
"0.56686157",
"0.55637944",
"0.54238003",
"0.5379474",
"0.53357476",
"0.53005356",
"0.52880293",
"0.524936",
"0.5222657",
"0.5188994",
"0.5156089",
"0.5115558",
"0.5109998",
"0.510... | 0.7772571 | 0 |
Find documents with the same gid. This happens when a game is postponed and played at a later date. | def find_duplicate_game_docs(self):
gids = self._db.Games.aggregate([{'$group':
{'_id' : '$gid',
'count' : {'$sum' : 1}}},
{'$match':
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_duplicate_game_docs(self):\n gids = self.find_duplicate_game_docs()\n for gid in gids:\n games = list(self._db.Games.aggregate([{'$match':\n {'gid' : gid}},\n {'$project':\n ... | [
"0.62802565",
"0.548343",
"0.53397965",
"0.52751833",
"0.52492416",
"0.5245115",
"0.5155788",
"0.51418126",
"0.50822026",
"0.49790588",
"0.49098143",
"0.489473",
"0.48798287",
"0.48738867",
"0.48738867",
"0.48712102",
"0.48651764",
"0.48614952",
"0.48553765",
"0.48486298",
"0... | 0.7284553 | 0 |
Delete duplicate document with earlier dates | def delete_duplicate_game_docs(self):
gids = self.find_duplicate_game_docs()
for gid in gids:
games = list(self._db.Games.aggregate([{'$match':
{'gid' : gid}},
{'$project':
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_old_news():\n # Configure the connection to the database\n client = MongoClient(os.environ['MongoDB_URI'])\n # client = MongoClient('localhost', 27017)\n db = client['kenya-news'] # Select the database\n collection = db.news\n time_boundary = datetime.now() - timedelta(hours=48)\n ... | [
"0.6318653",
"0.6047859",
"0.5887695",
"0.5745676",
"0.5742953",
"0.5725459",
"0.5702745",
"0.5637136",
"0.5588919",
"0.55640435",
"0.5553266",
"0.5495796",
"0.5480746",
"0.5475993",
"0.5422374",
"0.5387871",
"0.5375463",
"0.5334237",
"0.5323591",
"0.5288373",
"0.52843744",
... | 0.65224165 | 0 |
Return Game docs given list of gids | def query_by_gids(self, gids):
return self._db.Games.find({'gid' : {'$in': gids}}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def data_by_id(id_list: List[str]) -> Generator[GameData, None, None]:\n\ttarget = collection.find({\"_id\": {\"$in\": [ObjectId[id_] for id_ in id_list]}})\n\tfor data in target:\n\t\tyield GameData(data)",
"def documents(pmid_23982599, civic_aid6_document):\n return [pmid_23982599, civic_aid6_document]",
... | [
"0.6547182",
"0.6114383",
"0.6057727",
"0.60470533",
"0.5827189",
"0.5767226",
"0.57535547",
"0.5640038",
"0.55772567",
"0.5572946",
"0.5540477",
"0.5493897",
"0.5458952",
"0.54549515",
"0.5453846",
"0.54293627",
"0.541171",
"0.54083544",
"0.54082185",
"0.5402133",
"0.5390001... | 0.6843466 | 0 |
Tests for case insensitive dict. | def test_case_insensitive_dict() -> None:
d = CaseInsensitiveDict()
d['Accept'] = 'application/json'
d['content-type'] = 'application/xml'
assert d['accept'] == 'application/json'
assert d['Content-Type'] == 'application/xml'
assert 'accept' in d
assert 'ACCEPT' in d
assert 'CONTENT-TYP... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __contains__(self, key):\n return super(CaseInsensitiveStringDict, self).__contains__(key.lower())",
"def __getitem__(self, key):\n return super(CaseInsensitiveStringDict, self).__getitem__(key.lower())",
"def lower_dict(input_dict):\r\n return {k.lower(): v for k, v in input_dict.iteritem... | [
"0.75542045",
"0.7334505",
"0.7072797",
"0.7058309",
"0.6881498",
"0.67348933",
"0.673392",
"0.6684311",
"0.6632773",
"0.65982383",
"0.65865195",
"0.65395343",
"0.65304136",
"0.6528629",
"0.65276223",
"0.6505774",
"0.6487431",
"0.63836074",
"0.6370246",
"0.628752",
"0.6203165... | 0.735361 | 1 |
Creates a new route for the URL endpoint `path`. This decorator wraps the View endpoint to pass in the current `world` (deserialized from session data upon function entrance and serialized back into session once the function is done), any URL parameters, and then any request parameters (sorted by key name). | def simple_route(path: str, **options):
def decorator(f):
@app.route(path, **options)
@wraps(f)
def decorated_function(*args, **kwargs):
world = json.loads(session.get('world', json.dumps(INITIAL_WORLD)))
values = [v for k, v in sorted(request.values.items())]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def route(self, path, **params):\n\n def decorate(func):\n \"\"\"\n A function returned as a object in load time,\n which set route to given url along with decorated function.\n \"\"\"\n from aha.dispatch.router import get_router\n r = get_ro... | [
"0.67961967",
"0.66870797",
"0.6560879",
"0.65097165",
"0.6310897",
"0.58419055",
"0.58415574",
"0.58309335",
"0.56565386",
"0.56524444",
"0.56506586",
"0.56270754",
"0.5623817",
"0.5621617",
"0.5522048",
"0.55181795",
"0.5475289",
"0.54058194",
"0.539309",
"0.5358514",
"0.53... | 0.71932244 | 0 |
Resets the game's world state (stored in session) and redirects to the root page. | def reset():
session['world'] = json.dumps(INITIAL_WORLD)
return redirect('/') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset():\n if app.config['SESSION_KEY'] in session:\n session.pop(app.config['SESSION_KEY'])\n return redirect(url_for('home'))",
"def game():\n\tif \"username\" in session:\n\t\treturn render_template(\"index.html\")\n\telse:\n\t\treturn redirect(url_for(\"default\"))",
"def logout():\n ... | [
"0.7514909",
"0.66439366",
"0.64029133",
"0.63899624",
"0.63899624",
"0.63899624",
"0.6389141",
"0.63843346",
"0.6381038",
"0.63758916",
"0.63758916",
"0.63712555",
"0.63661706",
"0.6341641",
"0.63367635",
"0.6292188",
"0.62863386",
"0.62215567",
"0.6192882",
"0.6178839",
"0.... | 0.82404375 | 0 |
create the function do_twice to call the object "f" twice. | def do_twice(f):
f()
f() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def do_four(f):\n do_twice(f)\n do_twice(f)",
"def do_four(f):\n do_twice(f)\n do_twice(f)",
"def twice(func, value):\n return func(func(value))",
"def odd_execution(fn: \"Function\"):\n @wraps(fn)\n def inner(*args, **kwargs):\n CURR_TIME = datetime.now()\n print(CURR_TIME... | [
"0.73717797",
"0.73717797",
"0.70202065",
"0.6523627",
"0.642535",
"0.63109237",
"0.6124981",
"0.61074626",
"0.5993886",
"0.59700006",
"0.59519726",
"0.5951022",
"0.59120613",
"0.5846903",
"0.5834491",
"0.5834491",
"0.58240527",
"0.5811233",
"0.5790749",
"0.57904506",
"0.5775... | 0.8541979 | 0 |
Create the function do_four to call the function object "f" four times by calling the do_twice function twice | def do_four(f):
do_twice(f)
do_twice(f) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def do_twice(f):\n f()\n f()",
"def do_twice(f):\n f()\n f()",
"def make_func_repeater(f, x):\n\n def repeat(i, x=x):\n if i == 0:\n return x\n else:\n return repeat(i-1, f(x))\n return repeat",
"def cycle(f1, f2, f3):\n def how_many(n):\n def w... | [
"0.74182415",
"0.74182415",
"0.66757107",
"0.66298306",
"0.6284355",
"0.61755073",
"0.6159758",
"0.61385965",
"0.61127263",
"0.60751015",
"0.5963568",
"0.5957507",
"0.5957507",
"0.59402174",
"0.584601",
"0.58294326",
"0.57642394",
"0.5735674",
"0.56831145",
"0.56810653",
"0.5... | 0.8688527 | 0 |
Create the function print_column to create the row as +++ | def print_column():
print('+----+----+') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_column():\n print('+----+----+----+----+')",
"def print_row():\n print('| | | | |')",
"def print_row():\n print('| | |')",
"def print_row(row,writer,x):\n sys.stdout.write(unichr(0x2503))\n for n in xrange(row.shape[0]-1):\n writer(row[n],Width,(x,n))\n ... | [
"0.81624204",
"0.72505563",
"0.72155416",
"0.70616394",
"0.7036636",
"0.66434807",
"0.6569328",
"0.64005893",
"0.63131356",
"0.62982506",
"0.62721825",
"0.6180216",
"0.6169262",
"0.6168331",
"0.6168331",
"0.6156408",
"0.6145124",
"0.6129866",
"0.6124525",
"0.61244994",
"0.611... | 0.81936276 | 0 |
Create the function print_row to create the row as | | | | | def print_row():
print('| | |') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_row():\n print('| | | | |')",
"def print_row():\n print_line()",
"def print_row(row,writer,x):\n sys.stdout.write(unichr(0x2503))\n for n in xrange(row.shape[0]-1):\n writer(row[n],Width,(x,n))\n sys.stdout.write(unichr(0x2502))\n if row.shape[0] > 0:\n ... | [
"0.8530415",
"0.8037322",
"0.7570192",
"0.7344016",
"0.7273711",
"0.7273711",
"0.7255074",
"0.72117364",
"0.7150947",
"0.70779",
"0.6906739",
"0.688648",
"0.67918885",
"0.6748843",
"0.6737758",
"0.6712484",
"0.67114896",
"0.667912",
"0.66183704",
"0.6617458",
"0.65915364",
... | 0.8543663 | 0 |
Create the function print_rows to create four row as | | | | | def print_rows():
do_four(print_row) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_row():\n print('| | | | |')",
"def print_row():\n print('| | |')",
"def print_row():\n print_line()",
"def print_row(width, items):\n def fmt_item(x):\n if isinstance(x, np.ndarray):\n assert x.ndim == 0\n x = x.item()\n if isinstanc... | [
"0.80774254",
"0.80721897",
"0.7481978",
"0.73324364",
"0.7239502",
"0.70016986",
"0.6793718",
"0.67920196",
"0.678038",
"0.6720256",
"0.6629153",
"0.6617143",
"0.6586248",
"0.65632164",
"0.65439785",
"0.6513154",
"0.6493903",
"0.6437955",
"0.63823825",
"0.63634264",
"0.63491... | 0.823443 | 0 |
Create the function do_twice to call the function "f" twice. | def do_twice(f):
f()
f() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def do_four(f):\n do_twice(f)\n do_twice(f)",
"def do_four(f):\n do_twice(f)\n do_twice(f)",
"def twice(func, value):\n return func(func(value))",
"def odd_execution(fn: \"Function\"):\n @wraps(fn)\n def inner(*args, **kwargs):\n CURR_TIME = datetime.now()\n print(CURR_TIME... | [
"0.76318043",
"0.76318043",
"0.7147757",
"0.6678994",
"0.6643224",
"0.6446661",
"0.6399231",
"0.6222597",
"0.61540437",
"0.61071616",
"0.6096648",
"0.6017438",
"0.59643596",
"0.5861106",
"0.58394796",
"0.58394796",
"0.5804263",
"0.5804263",
"0.57816",
"0.5736237",
"0.5722506"... | 0.8612534 | 1 |
Create the function do_four to call the function "f" four times by calling the do_twice function twice. | def do_four(f):
do_twice(f)
do_twice(f) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def do_twice(f):\n f()\n f()",
"def do_twice(f):\n f()\n f()",
"def make_func_repeater(f, x):\n\n def repeat(i, x=x):\n if i == 0:\n return x\n else:\n return repeat(i-1, f(x))\n return repeat",
"def cycle(f1, f2, f3):\n def how_many(n):\n def w... | [
"0.7395011",
"0.7395011",
"0.66736555",
"0.6423195",
"0.6234515",
"0.61135775",
"0.6103619",
"0.59924036",
"0.5965913",
"0.5965913",
"0.5938952",
"0.5893887",
"0.58194464",
"0.5806442",
"0.57491344",
"0.5736796",
"0.5733715",
"0.56965375",
"0.56287766",
"0.55950177",
"0.54493... | 0.8775655 | 1 |
Create the function print_column to create the row as +++++ | def print_column():
print('+----+----+----+----+') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_column():\n print('+----+----+')",
"def print_row():\n print('| | |')",
"def print_row():\n print('| | | | |')",
"def print_row(row,writer,x):\n sys.stdout.write(unichr(0x2503))\n for n in xrange(row.shape[0]-1):\n writer(row[n],Width,(x,n))\n sys.stdo... | [
"0.8078306",
"0.7413043",
"0.7412309",
"0.7200651",
"0.7021943",
"0.6833584",
"0.67136157",
"0.66695964",
"0.6588344",
"0.6430257",
"0.64064354",
"0.63985914",
"0.63985616",
"0.63883376",
"0.6328548",
"0.6322892",
"0.62826204",
"0.62767565",
"0.6275681",
"0.6255467",
"0.62540... | 0.8039861 | 1 |
Create the function print_row to create the row as | | | | | | def print_row():
print('| | | | |') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_row():\n print('| | |')",
"def print_row():\n print_line()",
"def print_row(row,writer,x):\n sys.stdout.write(unichr(0x2503))\n for n in xrange(row.shape[0]-1):\n writer(row[n],Width,(x,n))\n sys.stdout.write(unichr(0x2502))\n if row.shape[0] > 0:\n writer(ro... | [
"0.84843177",
"0.8054256",
"0.7563549",
"0.73512983",
"0.72990143",
"0.72990143",
"0.7225399",
"0.7194312",
"0.713759",
"0.7085797",
"0.68847865",
"0.6880226",
"0.67731446",
"0.67656356",
"0.6765223",
"0.67457706",
"0.6735039",
"0.663375",
"0.66297144",
"0.6615596",
"0.659904... | 0.8487646 | 0 |
Create the function print_rows to create four rows as | | | | | | def print_rows():
do_four(print_row) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_row():\n print('| | | | |')",
"def print_row():\n print('| | |')",
"def print_row():\n print_line()",
"def print_row(width, items):\n def fmt_item(x):\n if isinstance(x, np.ndarray):\n assert x.ndim == 0\n x = x.item()\n if isinstanc... | [
"0.7912635",
"0.78900677",
"0.7386672",
"0.73117936",
"0.7099221",
"0.69814074",
"0.6759917",
"0.6750056",
"0.6665295",
"0.6647484",
"0.6598356",
"0.6563452",
"0.65490955",
"0.6546903",
"0.6508162",
"0.6475893",
"0.6455375",
"0.64157134",
"0.641503",
"0.6397736",
"0.63414997"... | 0.8226587 | 1 |
Takes a dictionary Returns a char representing the most occured alphabet in the given corpus. | def most_occured(dict):
max = dict['e']
max_alpha = 'e'
for i, j in zip(dict.values(), dict.keys()):
if max < i:
max = i
max_alpha = j
return max_alpha | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mostwantedletter(text):\n temp = Counter(text.lower())\n alpha_keys = {k:temp[k] for k,v in temp.items() if k.isalpha()}\n max_keys = [k for k,v in alpha_keys.items() if alpha_keys[k] == max(alpha_keys.values())]\n if len(max_keys) == 1:\n return max_keys[0]\n else:\n return min(ma... | [
"0.7199735",
"0.6682217",
"0.6393662",
"0.62353563",
"0.62098324",
"0.6076371",
"0.59980464",
"0.5973098",
"0.5958608",
"0.5934473",
"0.59121144",
"0.5911147",
"0.58804435",
"0.583623",
"0.5825005",
"0.5821255",
"0.5814215",
"0.5810383",
"0.5785716",
"0.5779856",
"0.57793164"... | 0.6827291 | 1 |
def save_variables(pickle_file_name, var, info, overwrite = False) | def save_variables(pickle_file_name, var, info, overwrite = False):
if os.path.exists(pickle_file_name) and overwrite == False:
raise Exception('{:s} exists and over write is false.'.format(pickle_file_name))
# Construct the dictionary
assert(type(var) == list); assert(type(info) == list);
d = {}
for i in... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def saveVar(var,name):\n with open(name+'.pickle','wb') as fl:\n pickle.dump(var,fl)",
"def save_pickle(file, variable):\n if file.split('.')[-1] != \"pkl\":\n file += \".pkl\"\n\n with open(file, 'wb') as f:\n pickle.dump(variable, f)\n print(\"Variable successfully saved in... | [
"0.8268068",
"0.8072408",
"0.7473958",
"0.73758066",
"0.68769544",
"0.6621232",
"0.6600465",
"0.64113957",
"0.6363832",
"0.63636",
"0.6273996",
"0.6261697",
"0.62546235",
"0.6127823",
"0.611359",
"0.61022425",
"0.61020553",
"0.60996777",
"0.60993475",
"0.60973966",
"0.6096183... | 0.879385 | 0 |
Makes the angle of beo's left arm match the angle of beo's right arm | def arm_mirror():
MOVEMENTS.disable_all_joints()
while True:
for i in range(3):
angle = MOVEMENTS.get_raw_angle(i*2)
MOVEMENTS.set_raw_angle(i*2 +1, angle)
sleep(0.01) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def turnRight(ev3):\n ev3.set_angle(\"A\", \"30\", \"90\")\n ev3.set_angle(\"B\", \"-30\", \"-90\")\n ev3.set_angle(\"C\", \"30\", \"90\")",
"def right(self, angle):\r\n self.rotation += angle",
"def _angle_of_attack(self, rel_wind, blade_chord):\n # blade_chord_vector - (relative_wind +... | [
"0.67735356",
"0.6648169",
"0.65576917",
"0.64816564",
"0.6466093",
"0.64443403",
"0.6438643",
"0.64365405",
"0.64068526",
"0.6406504",
"0.6392847",
"0.6385634",
"0.6363862",
"0.6343201",
"0.6316757",
"0.628297",
"0.61818933",
"0.617988",
"0.6163536",
"0.6158451",
"0.6157677"... | 0.66498315 | 1 |
Changes beo's eye expressions every few seconds | def eye_change():
expressions = ['wink', 'shut', 'sad', 'mad', 'default']
while True:
for i in expressions:
EYES.set_expression(i)
sleep(20) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def runsbeana(self):",
"def exp(self, exposure_time):\n print(f\"exp: {exposure_time}\")\n self.device_control.exposure = exposure_time\n yield",
"def fear_renewal(amygdala, stim_fear, stim_ext, ctx_fear, ctx_ext): \n amygdala.switch_context(ctx_fear)\n\n for i in range(5):\n ... | [
"0.5449574",
"0.539266",
"0.53811127",
"0.5362001",
"0.525605",
"0.52369916",
"0.5236414",
"0.5205917",
"0.5147299",
"0.51400155",
"0.5122824",
"0.5120047",
"0.5103095",
"0.5101254",
"0.51010066",
"0.5097395",
"0.50509566",
"0.5045716",
"0.5032723",
"0.5023793",
"0.50187033",... | 0.77104485 | 0 |
Says a short sentence every few seconds | def speak():
sentences = ['DESTROY ALL HU- I MEAN GREETINGS MEAT BAG',
'She sells sea shells by the sea shore', 'Other sentence']
while True:
AUDIO.speak(sentences[randint(0, 2)])
sleep(15) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def say(text, tts):\n tts.post.say(text)\n\n typing_speed = 95\n\n for word in text:\n sys.stdout.write(bcolors.BOLD + bcolors.OKGREEN + word)\n sys.stdout.flush()\n time.sleep(random.random()*10.0/typing_speed)\n print bcolors.ENDC + ''",
"def time_waste(n=3):\n time.sleep(n)... | [
"0.7190078",
"0.65190184",
"0.6507139",
"0.6467065",
"0.64649445",
"0.6446902",
"0.64457947",
"0.6395883",
"0.637384",
"0.6321483",
"0.6265584",
"0.62271446",
"0.62202686",
"0.6200323",
"0.61829233",
"0.6169846",
"0.61494637",
"0.6115991",
"0.6098328",
"0.6085162",
"0.6082713... | 0.6970961 | 1 |
this function does reference cleaning and then calls the parser | def process_and_dispatch(self):
references = []
for raw_block_references in self.raw_references:
bibcode = raw_block_references['bibcode']
block_references = raw_block_references['block_references']
item_nums = raw_block_references.get('item_nums', [])
pa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _parse(self):\n pass",
"def after_parsing(self):",
"def clean(c):",
"def reset(self):\n SGMLParser.reset(self)\n self.pieces = []",
"def pythonCleanupParser():\n libxml2mod.xmlPythonCleanupParser()",
"def process_and_dispatch(self):\n references = []\n for raw_block_refe... | [
"0.6146091",
"0.6059452",
"0.6025866",
"0.6023601",
"0.5990042",
"0.59849614",
"0.57998246",
"0.57939863",
"0.5772529",
"0.5741969",
"0.57262695",
"0.5704577",
"0.5692563",
"0.55635124",
"0.55362517",
"0.55362517",
"0.55362517",
"0.55362517",
"0.5480772",
"0.54793537",
"0.547... | 0.60848886 | 1 |
Read company names into a dictionary | def read_names_into_dict():
d = dict()
with open("SP_500_firms.csv") as csvfile:
input_file = csv.DictReader(csvfile)
for row in input_file:
#print(row)
d[row['Symbol']] = [row['Name'],row['Sector']]
return d | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_companies():\n list_of_companies = data_manager.get_data_from_file(filename=\"company/company_data.csv\")\n return list_of_companies",
"def create_names_dict(infile):\n return [name.strip(\"\\n\") for name in open(infile, \"r\")]",
"def get_company_info(company_name):\n\n # Fix formatting ... | [
"0.6544435",
"0.63628507",
"0.6041109",
"0.5989905",
"0.59653646",
"0.5857074",
"0.5828176",
"0.57851154",
"0.5781898",
"0.57342565",
"0.5723782",
"0.56979",
"0.5658726",
"0.56504184",
"0.564063",
"0.56225693",
"0.5609526",
"0.56045145",
"0.5538428",
"0.55281436",
"0.55239743... | 0.6374213 | 1 |
The output method that saves the content to a file and renders the appropriate template with the file's URL. | def output_file(self, mode, content, forced=False, basename=None):
new_filepath = self.get_filepath(content, basename=basename)
if not self.storage.exists(new_filepath) or forced:
self.storage.save(new_filepath, ContentFile(content.encode(self.charset)))
url = mark_safe(self.storage.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(self):\n path = os.path.join(os.path.dirname(__file__), '../pages/upload_information.html')\n self.response.out.write(template.render(path, {}))",
"def _render_file(self, content, path):\n if self._check_for_custom_config(path):\n self._use_custom_config(path)\n ret... | [
"0.66104424",
"0.6574674",
"0.6456632",
"0.64295334",
"0.64186823",
"0.6385647",
"0.638479",
"0.638167",
"0.6371736",
"0.6357564",
"0.6337024",
"0.6297615",
"0.62714696",
"0.6265047",
"0.62618923",
"0.6244673",
"0.62383056",
"0.62204665",
"0.62067145",
"0.6197484",
"0.6148947... | 0.70067215 | 0 |
The output method that directly returns the content for inline display. | def output_inline(self, mode, content, forced=False, basename=None):
context = {"content": content, "sri": _compute_sri_value(content)}
return self.render_output(mode, context) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __repr__(self):\n\n template = \"\"\"\n - inline : {}\n \"\"\"\n\n return super().__repr__() + template.format(self.inline)",
"def __html__(self):\n return str(self)",
"def output(self) -> str:\n self._contents = str(self._line) + \", \" + str(self._line)\n ... | [
"0.672035",
"0.66938335",
"0.6685333",
"0.6627836",
"0.65973985",
"0.6570415",
"0.6570415",
"0.6522949",
"0.6520397",
"0.64902925",
"0.6460883",
"0.64555144",
"0.6451963",
"0.6426757",
"0.6425399",
"0.6408224",
"0.6408224",
"0.6385279",
"0.63720715",
"0.6367564",
"0.63323545"... | 0.72743136 | 0 |
Stub Version of GetImageURL() method. This returns a random number. | def GetImageURL(value_1, value_2):
seed(abs(value_1)+abs(value_2))
return randint(1, 1000000) #Random number generation. | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_image_random(self):\n index = random.randrange(0, len(self._image_urls_file_name))\n if index >= len(self._image_urls):\n message = \"Url index does not exist: '%i'\" % index\n return (None, message)\n url = self._image_urls[index]\n message = \"Successful ... | [
"0.6827462",
"0.6746008",
"0.6431726",
"0.6097688",
"0.6037499",
"0.60342544",
"0.5891832",
"0.5882679",
"0.5864222",
"0.5853617",
"0.58306986",
"0.5802977",
"0.577419",
"0.5740004",
"0.570565",
"0.5699825",
"0.5682308",
"0.56636924",
"0.56491905",
"0.56463015",
"0.56408507",... | 0.6750178 | 1 |
Cache Infomation as a list with counter of Hits, Misses, Current Length, Total Length. | def info_cache():
return [custom_hit, custom_miss, len(custom_memory), total_custom_memory] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stats(self):\n if self.__cache:\n return {\n \"size\": self.__cache.currsize,\n \"maxsize\": self.__cache.maxsize,\n \"hits\": self._hits._value.get(),\n \"miss\": self._misses._value.get(),\n }\n ... | [
"0.5466743",
"0.5399242",
"0.5369182",
"0.5334547",
"0.53125817",
"0.5256458",
"0.52349484",
"0.51981616",
"0.5138307",
"0.5130971",
"0.5104699",
"0.50945795",
"0.50929266",
"0.50803566",
"0.5077638",
"0.50680363",
"0.5043436",
"0.50432724",
"0.50218165",
"0.5012172",
"0.4973... | 0.63933814 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.