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 |
|---|---|---|---|---|---|---|
Delete a draft belonging to a particular user. | def do_delete_draft(draft_id: int, user_profile: UserProfile) -> None:
try:
draft_object = Draft.objects.get(id=draft_id, user_profile=user_profile)
except Draft.DoesNotExist:
raise ResourceNotFoundError(_("Draft does not exist"))
draft_id = draft_object.id
draft_object.delete()
ev... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_draft(draft_uuid):\n api_request('delete', api_url('drafts', str(draft_uuid)))",
"def delete(self,\n draft_id,\n ):\n return self._invoke('delete',\n {\n 'draft_id': draft_id,\n })",
... | [
"0.7564674",
"0.7383004",
"0.6840054",
"0.6774973",
"0.67743796",
"0.66971105",
"0.6603117",
"0.65684706",
"0.654473",
"0.6492794",
"0.6456428",
"0.63981634",
"0.6362671",
"0.63221097",
"0.62822104",
"0.62783",
"0.62724733",
"0.62385744",
"0.61420053",
"0.61398315",
"0.612225... | 0.77435535 | 0 |
Get zero version `0.0.0` | def zero(cls: Type[_R]) -> _R:
return cls("0.0.0") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_version():\n return \"0.0.1 (prerelease prototype)\"",
"def version_number() -> int:\n return 0",
"def get_version():\n return '%d.%d.%d' % version_info",
"def current_version(self):\n try:\n return self.release_set.order_by('-created')[0].version\n except IndexError... | [
"0.7245187",
"0.668971",
"0.66882396",
"0.6665648",
"0.6570469",
"0.64901686",
"0.64345765",
"0.64268774",
"0.63672644",
"0.6360634",
"0.63367814",
"0.6328667",
"0.6325577",
"0.63126534",
"0.6253386",
"0.6247568",
"0.62471354",
"0.6241517",
"0.6227065",
"0.6226674",
"0.621898... | 0.68623227 | 1 |
Get next micro version. | def bump_micro(self: _R, inc: int = 1) -> _R:
if not self.is_stable:
return self.get_stable().bump_micro(inc - 1)
return self._replace(
BaseVersion(
epoch=0,
release=(self.major, self.minor, self.micro + inc),
pre=None,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next_version(major=False, minor=False, patch=True):\n try:\n r = Release.objects.latest()\n except Release.DoesNotExist:\n return Version('0.0.0')\n\n v = r.version\n if major:\n v = v.next_major()\n elif minor:\n v = v.next_minor()\n else:\n v = v.next_patc... | [
"0.6825203",
"0.6565859",
"0.6408749",
"0.6236738",
"0.6216092",
"0.60519856",
"0.60511297",
"0.6045051",
"0.5854707",
"0.5835003",
"0.58286273",
"0.577659",
"0.57726276",
"0.5756602",
"0.5756459",
"0.5703252",
"0.56749344",
"0.5653698",
"0.5628476",
"0.5624355",
"0.5614559",... | 0.6671826 | 1 |
Get stable version from pre or post release. | def get_stable(self: _R) -> _R:
return self._replace(
BaseVersion(
epoch=0,
release=(self.major, self.minor, self.micro),
pre=None,
post=None,
dev=None,
local=None,
)
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next_version(major=False, minor=False, patch=True):\n try:\n r = Release.objects.latest()\n except Release.DoesNotExist:\n return Version('0.0.0')\n\n v = r.version\n if major:\n v = v.next_major()\n elif minor:\n v = v.next_minor()\n else:\n v = v.next_patc... | [
"0.65761906",
"0.64690495",
"0.64539593",
"0.6419955",
"0.6369132",
"0.6336212",
"0.62359613",
"0.62115157",
"0.61312795",
"0.612242",
"0.6118793",
"0.61041874",
"0.6091029",
"0.6033105",
"0.59679747",
"0.59453046",
"0.5935324",
"0.5899036",
"0.58957833",
"0.58908105",
"0.588... | 0.6867934 | 0 |
helper function for checkPass returns the first element of charList found that works for the password at index i if it fails to find a character at i, prints i and returns an empty string instead of returning i. | def findChar(username, url, charList, i):
for ch in charList:
if(checkPasswordCharacter(ch, username, url, index = i)):
return ch
#only runs if no ch in charList match:
# return i #oof, there's no match if i is out of bounds, e.g. len(password) < i
print("Missing: " + i) #so I know when... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def checkPass(username, url, charList, n):\n # dikt = {}\n password = \"\"\n for i in range(0, n):\n if(testPassword(password, username, url)):\n return password #password is found! \n # https://stackoverflow.com/questions/189645/how-to-break-out-of-multiple-loops-in-python\n ch... | [
"0.71826273",
"0.6203832",
"0.6179515",
"0.6156986",
"0.61567867",
"0.60574234",
"0.6030019",
"0.59959686",
"0.59700435",
"0.5946914",
"0.5921345",
"0.5909927",
"0.5908256",
"0.58809274",
"0.5878235",
"0.5816463",
"0.5804979",
"0.5787845",
"0.5780203",
"0.57457215",
"0.572765... | 0.77611613 | 0 |
List of characters in database names | def makeDatabaseList():
charList = []
for ch in lower:
# ch = str(ch)
if(characterInDatabaseName(ch, url)):
charList.append(ch)
for ch in numbers:
ch = str(ch)
if(characterInDatabaseName(ch, url)):
charList.append(ch)
for ch in special:
ch = str(ch)
if(c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def makeDatabaseNamesList(n, ):",
"def get_database_names(self) -> Iterable[str]:\n custom_database_name = self.service_connection.__dict__.get(\"databaseName\")\n\n database_name = self.service_connection.__dict__.get(\n \"database\", custom_database_name or \"default\"\n )\n ... | [
"0.6628727",
"0.5976508",
"0.5936507",
"0.5901102",
"0.58635503",
"0.5853042",
"0.5845213",
"0.58389676",
"0.58144695",
"0.58012706",
"0.5732453",
"0.5721888",
"0.5696421",
"0.5669424",
"0.56576335",
"0.5632975",
"0.56264454",
"0.56206435",
"0.5605173",
"0.5598442",
"0.557013... | 0.7128734 | 0 |
returns list of characters that appear in any username | def userNameCharacters(url, tableName, caseSensitive = False, wildCards = True):
"""
sqlzoo characters
['a', 'c', 'd', 'e', 'h', 'i', 'j', 'k', 'n', 'o', 'p', 'r', 't', 'w', '_', '%']
"""
lst = []
for ch in special:
if(checkUsernameCharacter(ch, url, tableName, notLike = False, notLikeName = "", index ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_users():\n\treturn [unicode(name[:-4]).lower() for name in os.listdir(os.path.join(WORLD_DIR, 'players'))]",
"def check_user_name(self, username):\n usernames = []\n for user in self.__users:\n if user['username'] == username:\n usernames.append(user)\n retu... | [
"0.65302527",
"0.6494948",
"0.63683933",
"0.6244168",
"0.6195335",
"0.61639106",
"0.61376554",
"0.6136397",
"0.6090331",
"0.6048526",
"0.6043042",
"0.6035452",
"0.60292345",
"0.6010415",
"0.59815353",
"0.5924206",
"0.5911422",
"0.58786315",
"0.5807217",
"0.57925546",
"0.57895... | 0.68477184 | 0 |
generates all subsequences of ch with length k | def generateSubSequences(k, ch):
seq = ["".join(c) for c in itertools.product(ch, repeat = k)]
# discussion about the best way to do this:
# https://stackoverflow.com/questions/7074051/what-is-the-best-way-to-generate-all-possible-three-letter-strings
return seq | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_kmers(seq, k):\n\n return [seq[i:i+k] for i in range(len(seq)-k+1)]",
"def cut_kmer(sequence, k_mer):\n for i in range(0, len(sequence)-k_mer + 1):\n yield sequence[i:i+k_mer]",
"def kmer_list(s, k):\n kmer = []\n n = len(s)\n # n-k+1 is the available range of values or probabliti... | [
"0.6393046",
"0.63518596",
"0.6346528",
"0.63429147",
"0.62951434",
"0.62502956",
"0.62439233",
"0.61887056",
"0.6169127",
"0.6153225",
"0.61380696",
"0.6062542",
"0.6060054",
"0.6024283",
"0.6011528",
"0.6003349",
"0.59933025",
"0.5982021",
"0.5982021",
"0.59802747",
"0.5954... | 0.85543895 | 0 |
Adds a user's mysql tables back into the OCF database. | def _add_mysql(user, options, dump = None):
# Access the new username with user["username"]
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def insert_db():\n populate_tables()",
"def create_tables_and_apply_patches(self):\n\n if self.authorized and not self.db_tables_initiated:\n with self.connection.cursor() as cursor:\n for statement in self.parse_mysql_sql_file():\n cursor.execute(statement)... | [
"0.6519952",
"0.62828916",
"0.61585516",
"0.6156607",
"0.61473525",
"0.6075949",
"0.5991981",
"0.5991254",
"0.5913686",
"0.5912704",
"0.5908939",
"0.5908939",
"0.5899569",
"0.5880359",
"0.5877914",
"0.5871357",
"0.5836821",
"0.58103013",
"0.57808405",
"0.5778543",
"0.57273936... | 0.6568307 | 0 |
Class for handling all minidump symbolizing code on Android. | def __init__(self, dump_finder, build_dir, symbols_dir=None):
# Map from minidump path (string) to minidump_dump output (string).
self._minidump_dump_output = {}
# Map from minidump path (string) to the directory that should be used when
# looking for symbol binaries (string).
self._minidump_symbol_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def obfuscate():\r\n smali_file_list = u.load_smali_file() # Load smali files\r\n set()\r\n change_all_direct_method(\r\n set(\r\n find_all_direct_method(\r\n list(u.get_android_method_names()) + list(set(find_all_native_method(smali_file_list))),\r\n smali... | [
"0.5797563",
"0.53851175",
"0.5382028",
"0.5153331",
"0.4875175",
"0.48596218",
"0.47921395",
"0.4589166",
"0.45467687",
"0.45267266",
"0.45106924",
"0.44272697",
"0.441203",
"0.43683136",
"0.43274632",
"0.43264234",
"0.43178105",
"0.43031862",
"0.43031862",
"0.42946658",
"0.... | 0.6551352 | 0 |
Returns a list of paths to binaries where symbols may be located. | def GetSymbolBinaries(self, minidump):
libraries = self._ExtractLibraryNamesFromDump(minidump)
symbol_binary_dir = self._GetSymbolBinaryDirectory(minidump, libraries)
if not symbol_binary_dir:
return []
return [os.path.join(symbol_binary_dir, lib) for lib in libraries] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_binaries():\n\n builddir = Path(__file__).parent.parent / \"builddir\"\n\n bins = []\n\n for folder in [\"examples\", \"tests\", \"tools\"]:\n for path in sorted((builddir / folder).rglob(\"*\")):\n if path.stem.startswith(\"xnvme_single\"):\n continue\n ... | [
"0.7554683",
"0.65706384",
"0.6247244",
"0.6195482",
"0.61567324",
"0.61457145",
"0.6059669",
"0.60321474",
"0.60022146",
"0.60022146",
"0.59460664",
"0.5926765",
"0.5923688",
"0.5919705",
"0.58894503",
"0.5882842",
"0.5870094",
"0.5855827",
"0.58501244",
"0.5832909",
"0.5810... | 0.7863217 | 0 |
Extracts library names that may contain symbols from the minidump. This is a duplicate of the logic in Chromium's //build/android/stacktrace/crashpad_stackwalker.py. | def _ExtractLibraryNamesFromDump(self, minidump):
default_library_name = 'libmonochrome.so'
minidump_dump_output = self._GetMinidumpDumpOutput(minidump)
if not minidump_dump_output:
logging.warning(
'Could not get minidump_dump output, defaulting to library %s',
default_library_na... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetSymbolBinaries(self, minidump):\n libraries = self._ExtractLibraryNamesFromDump(minidump)\n symbol_binary_dir = self._GetSymbolBinaryDirectory(minidump, libraries)\n if not symbol_binary_dir:\n return []\n\n return [os.path.join(symbol_binary_dir, lib) for lib in libraries]",
"def get_pla... | [
"0.606551",
"0.5674643",
"0.56701034",
"0.5526038",
"0.5405917",
"0.5370439",
"0.5335965",
"0.52976125",
"0.52932",
"0.52613264",
"0.523408",
"0.52253866",
"0.5208155",
"0.51849467",
"0.51835585",
"0.5180916",
"0.51393825",
"0.51383364",
"0.513191",
"0.5112789",
"0.5104473",
... | 0.74637324 | 0 |
Gets the directory that should contain symbol binaries for |minidump|. | def _GetSymbolBinaryDirectory(self, minidump, libraries):
if minidump in self._minidump_symbol_binaries_directories:
return self._minidump_symbol_binaries_directories[minidump]
# Get the processor architecture reported by the minidump.
arch = None
matcher = re.compile(_PROCESSOR_ARCH_REGEX)
f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_bin_dir():\n return os.path.abspath(os.path.join(get_root_dir(), 'bin/'))",
"def GetSymbolBinaries(self, minidump):\n libraries = self._ExtractLibraryNamesFromDump(minidump)\n symbol_binary_dir = self._GetSymbolBinaryDirectory(minidump, libraries)\n if not symbol_binary_dir:\n return []\... | [
"0.6687989",
"0.668011",
"0.6666962",
"0.6321019",
"0.63035196",
"0.6107489",
"0.6062449",
"0.6049191",
"0.6031628",
"0.6012374",
"0.5988652",
"0.5959031",
"0.5932072",
"0.5915141",
"0.59118515",
"0.59096825",
"0.5886469",
"0.5836009",
"0.58122456",
"0.58107346",
"0.58003944"... | 0.7879615 | 0 |
Runs minidump_dump on the given minidump. Caches the result for reuse. | def _GetMinidumpDumpOutput(self, minidump):
if minidump in self._minidump_dump_output:
logging.debug('Returning cached minidump_dump output for %s', minidump)
return self._minidump_dump_output[minidump]
dumper_path = local_first_binary_manager.GetInstance().FetchPath(
'minidump_dump')
i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testPullMinidumps(self):\n def GetDumpLocation(_=None):\n return '/sdcard/dumps/'\n\n platform_backend = self._browser_backend.platform_backend\n time_offset = platform_backend.GetDeviceHostClockOffset()\n platform_backend.GetDumpLocation = GetDumpLocation\n remote_path = posixpath.join(Get... | [
"0.57792044",
"0.53705996",
"0.52849925",
"0.52743363",
"0.5234966",
"0.518306",
"0.51442665",
"0.5070806",
"0.5030404",
"0.49894577",
"0.49146363",
"0.49089596",
"0.48556525",
"0.4828357",
"0.48120502",
"0.47813582",
"0.47782636",
"0.4737786",
"0.46923456",
"0.46380943",
"0.... | 0.6442122 | 0 |
Red = Disable Blue = Enable Any problem such as plugins on dashboard is enable but show disable here, info Owner | async def plugin(self,ctx):
special_case = {"Anime":"myanimelist","Anti Raid":"antiraid"}
plugin_setting = await self.redis.hgetall("{}:Config:Cogs".format(ctx.message.guild.id))
embed = discord.Embed()
cogs = self.bot.cogs.keys()
for x in cogs:
setting = u"\U0001F5... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_enabled(self):",
"def check_disabled(self):\n return None",
"def get_status(self):\n return super(Cabling, self).get_status()",
"def enable(self):",
"def Enabled(self) -> bool:",
"def disable(self):",
"def isEnabled(self):",
"def disable_feature(self,reason,source=\"gff3_maniger\... | [
"0.64461994",
"0.61870736",
"0.6155342",
"0.606294",
"0.60158396",
"0.59407747",
"0.5909308",
"0.5869749",
"0.5851598",
"0.58354104",
"0.5772434",
"0.5748269",
"0.574007",
"0.5675615",
"0.5668143",
"0.5668143",
"0.5668143",
"0.5668143",
"0.5668143",
"0.5668143",
"0.5668143",
... | 0.65774465 | 0 |
store input into filename used pickle.dump | def store (input, filename) :
cout = open (filename, 'w')
pickle.dump (input, cout)
cout.close () | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def store(self, filename):",
"def pickle(self,data,filename):\n pickle.dump(data, open(filename, 'wb'))",
"def save_file_data(name, obj, input_path='/inputs'):\n filename = '{}/{}.pkl'.format(input_path, name)\n if not os.path.exists(os.path.dirname(filename)):\n try:\n os.makedi... | [
"0.7272676",
"0.7110179",
"0.69229895",
"0.67838925",
"0.6766273",
"0.67407393",
"0.67352134",
"0.6724542",
"0.6718559",
"0.6689364",
"0.6684626",
"0.6666956",
"0.6617081",
"0.6609867",
"0.65701944",
"0.65609634",
"0.6513856",
"0.6507621",
"0.6492011",
"0.64900124",
"0.648344... | 0.89019084 | 0 |
Sends args and kwargs to any configured callbacks. This handles the cases where the 'callbacks' variable is ``None``, a single function, or a list. | def _multiple_callbacks(callbacks, *args, **kwargs):
if isinstance(callbacks, list):
for cb in callbacks:
cb(*args, **kwargs)
return
if callbacks:
callbacks(*args, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_callbacks(self, **kwargs):\n for callback in self.CALLBACKS:\n getattr(self, callback)(**kwargs)",
"def callbacks(*args, addCallback: Script=None, clearAllCallbacks: bool=True, clearCallbacks:\n bool=True, describeHooks: bool=True, dumpCallbacks: bool=True, executeCallbacks... | [
"0.702277",
"0.66514504",
"0.65428776",
"0.651266",
"0.6477689",
"0.61787194",
"0.6089447",
"0.60846204",
"0.60464215",
"0.60348064",
"0.59095436",
"0.590122",
"0.5900241",
"0.5882658",
"0.5858614",
"0.5747529",
"0.57051486",
"0.5680165",
"0.56781036",
"0.5653725",
"0.5636546... | 0.7574884 | 0 |
Adds and connects attributes from default encore FKIK switch anim setup to rig nodes in scene Imports default control setup from file or you may specify source_ctrl in args to override | def make_fkikSwitch_connection_attrs(partpre=None, side='Lt', source_ctrl=None, tag_name='switch', snapTo=None,
add_attrs=None):
switch_anim = ''
if source_ctrl is not None:
switch_anim = source_ctrl
partpre = partpre
if partpre == '':
partpre = 'my... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def switch_setup(params, rig, ik_joints):\n\n # Duplicate for bind skeleton\n skeleton = [x.name() for x in params['ikSkeleton']]\n bind_skeleton = cmds.duplicate(skeleton, n=skeleton[0] + '_bnd_0')\n #bind_skeleton\n\n # Hide all attribute on Controller\n fkikcontrol = params['fkIkSwitch'].name(... | [
"0.5719306",
"0.5415949",
"0.5388942",
"0.5385029",
"0.5336632",
"0.5299819",
"0.5200528",
"0.5145229",
"0.5140653",
"0.51194525",
"0.5079638",
"0.50723904",
"0.50585204",
"0.50376135",
"0.5010488",
"0.49763772",
"0.49707508",
"0.49594924",
"0.4954051",
"0.4949411",
"0.494735... | 0.5789509 | 0 |
Create an IK attribute on the given ctrl, connect IK handles to ik switch. Also connect fk ctrls and ik ctrls visibility to switch. This will create an 'IK' attr on the switch ctrl | def create_fk_ik_switch(switch_ctrl, ik_handles, fk_ctrls, ik_ctrls, vis_ctrl=None, switch_attr_name='IK', vis_attr_name='fkIkCtrlVis'):
fk_ctrls = mc.ls(fk_ctrls)
ik_ctrls = mc.ls(ik_ctrls)
ik_handles = mc.ls(ik_handles)
if not vis_ctrl:
vis_ctrl = switch_ctrl
# Create attributes
if ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_soft_ik(ik_ctrl, ik_joints, ik_handle):\n\n # get name and constant variables\n name = ik_handle+'Soft'\n parent = utils.get_parent(ik_joints[0])\n ik_handle_parent = utils.get_parent(ik_handle)\n\n # get total length of joint chain\n chain_length = 0\n for jnt in ik_joints[1:]:\n ... | [
"0.6865341",
"0.670034",
"0.6326762",
"0.61733705",
"0.6086193",
"0.59026164",
"0.57446015",
"0.55481964",
"0.540773",
"0.5367092",
"0.53659767",
"0.51581305",
"0.5066359",
"0.493914",
"0.48905978",
"0.48687443",
"0.48397043",
"0.48023486",
"0.47860128",
"0.47808054",
"0.4765... | 0.7807563 | 0 |
Create soft ik constraint on ikHandle. | def create_soft_ik(ik_ctrl, ik_joints, ik_handle):
# get name and constant variables
name = ik_handle+'Soft'
parent = utils.get_parent(ik_joints[0])
ik_handle_parent = utils.get_parent(ik_handle)
# get total length of joint chain
chain_length = 0
for jnt in ik_joints[1:]:
chain_len... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_keep_in_constraint(self,der=2,limit=1e1,weight=1e5):\n print(\"Creating Keep in constraint\")\n constr = dict()\n constr['constraint_type'] = \"ellipsoid\"\n constr['weight'] = self.accel_weight\n constr['keep_out'] = False\n constr['der'] = der\n constr[... | [
"0.5469389",
"0.531737",
"0.52888745",
"0.51781154",
"0.50092465",
"0.49953595",
"0.49701515",
"0.4952075",
"0.49448365",
"0.49093467",
"0.49027547",
"0.4884955",
"0.4834274",
"0.47601178",
"0.47214177",
"0.46724012",
"0.4648716",
"0.46426857",
"0.4633451",
"0.46300042",
"0.4... | 0.7518777 | 0 |
Quaterion / matrix based twist for upper arms and legs. | def upper_twist(shoulder_jnt, up_arm_ik_jnt, lo_arm_ik_jnt, up_arm_jnt, lo_arm_jnt, up_arm_twist_jnts):
# Create a group that does not rotate and parent under the ik arm parent (shoulder)
stable_reader_grp = utils.create_node('transform', n=up_arm_ik_jnt+'_stable_reader', p=up_arm_ik_jnt)
# Create a grp t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lower_twist(lo_arm_ik_jnt, wrist_ik_jnt, lo_arm_jnt, lo_arm_twist_jnts, wrist_jnt=None):\n\n # Create a group that does not rotate and parent under the ik arm parent (shoulder)\n stable_reader_grp = utils.create_node('transform', n=lo_arm_ik_jnt+'_stable_reader', p=lo_arm_ik_jnt)\n\n # Create a grp th... | [
"0.5514963",
"0.52410305",
"0.5185732",
"0.51259094",
"0.5053267",
"0.5020422",
"0.49390778",
"0.4879556",
"0.48793352",
"0.4878152",
"0.4855",
"0.4854443",
"0.48542276",
"0.48520848",
"0.48423955",
"0.4821107",
"0.4791083",
"0.47887972",
"0.47870728",
"0.47847036",
"0.478411... | 0.56926125 | 0 |
Stretch setup for biped (2 joint chain) arms and legs | def biped_stretch(ik_ctrl,
ik_last_node,
pv_ctrl,
switch_ctrl,
up_arm_fk_ctrl,
lo_arm_fk_ctrl,
wrist_fk_ctrl,
up_arm_ik_jnt,
lo_arm_ik_jnt,
wrist_ik_jnt,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def multi_joint_stretch(ik_ctrl, ik_last_node, switch_ctrl, fk_ctrls, jnts, ik_handle):\n\n root_grp = utils.get_parent(jnts[0])\n stretch_jnts = jnts[1:]\n stretch_fk_ctrls = fk_ctrls[1:]\n\n # create attrs\n attrs = ['upStretch','loStretch']\n for i in reversed(range(len(stretch_jnts)-2)):\n ... | [
"0.6122613",
"0.60881704",
"0.5706191",
"0.5586057",
"0.554519",
"0.55225635",
"0.55225635",
"0.54242057",
"0.54017335",
"0.5394755",
"0.5353252",
"0.52999943",
"0.52834505",
"0.52750146",
"0.524787",
"0.5220676",
"0.5217967",
"0.51952493",
"0.51629597",
"0.5109538",
"0.51004... | 0.66334 | 0 |
Create stratch point constraints on a chain of stretch joints. | def stretch_twist_jnts(start_jnt, end_jnt, twist_jnts):
div = 1.0 / (len(twist_jnts)+1)
for i, joint in enumerate(twist_jnts):
weight = div*(i+1)
mc.pointConstraint(start_jnt, joint, weight=1.0-weight)
mc.pointConstraint(end_jnt, joint, weight=weight) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def multi_joint_stretch(ik_ctrl, ik_last_node, switch_ctrl, fk_ctrls, jnts, ik_handle):\n\n root_grp = utils.get_parent(jnts[0])\n stretch_jnts = jnts[1:]\n stretch_fk_ctrls = fk_ctrls[1:]\n\n # create attrs\n attrs = ['upStretch','loStretch']\n for i in reversed(range(len(stretch_jnts)-2)):\n ... | [
"0.60946095",
"0.5763195",
"0.5703657",
"0.5553354",
"0.5487165",
"0.5435914",
"0.53954494",
"0.51878697",
"0.51259",
"0.51116204",
"0.5077191",
"0.5054225",
"0.4999024",
"0.49555075",
"0.49334964",
"0.4926704",
"0.4873679",
"0.48712805",
"0.48634586",
"0.48509604",
"0.484819... | 0.66719025 | 0 |
Duplicate a joint chain. | def duplicate_chain(chain, search='', replace='', suffix=''):
if suffix:
suffix = '_'+suffix
new_jnts = []
for joint in chain:
new_name = joint.replace(search, replace, 1)+suffix
new_jnt = mc.duplicate(joint, po=1, n=new_name)[0]
if new_jnts:
mc.parent(new_jnt,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def skeleton_buildDuplicateChain(self,sourceJoints = None, modifier = 'rig', connectToModule = False, connectAs = 'rigJoints', connectToSource = None, singleMode = False, cgmType = None, indices = [],blockNames=False):\n _str_func = 'skeleton_buildDuplicateChain'\n \n \n if indices:\n log.debug... | [
"0.63030636",
"0.6269034",
"0.60625374",
"0.58090156",
"0.5777003",
"0.57204974",
"0.56585926",
"0.55766195",
"0.5560866",
"0.55120313",
"0.5510162",
"0.54400694",
"0.5433781",
"0.54283494",
"0.5389344",
"0.5383912",
"0.53801215",
"0.53679395",
"0.5365678",
"0.5365056",
"0.53... | 0.6813391 | 0 |
This function loops through directory and updates dates of files in said directory. | def update_date(dest=dest):
for root, _, files in os.walk(dest):
ignore = ["README.md","SUMMARY.md"]
_ = [edit_files(root + "/" + file) for file in files if (file not in ignore and file.endswith(".md"))] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _update_files():\n configuration_settings = get_configuration()\n\n # Need to find all of the files that are stored in the input_files directories in order to start building the\n # reports that will be used to generate the static log files.\n for input_path in configuration_settings.processing.inp... | [
"0.7497474",
"0.65693516",
"0.6360544",
"0.6272613",
"0.62687546",
"0.6217366",
"0.58838624",
"0.58187634",
"0.5807831",
"0.57809776",
"0.57797885",
"0.57654995",
"0.5759113",
"0.57328516",
"0.570991",
"0.56900525",
"0.56631005",
"0.56558955",
"0.5641615",
"0.5629182",
"0.562... | 0.7363431 | 1 |
Test combining each center's file errors | def test__combine_center_file_errors(syn):
expected_error = (
f"\t{ENT1.name} ({ENT1.id}):\n\nmy errors\nn\n\n"
f"\t{ENT1.name} ({ENT1.id}):\n\nerrors here\nf\n\n"
)
calls = [
mock.call("syn1234", downloadFile=False),
mock.call("syn2345", downloadFile=False),
]
with p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_single_error_merge(self):\n test_folder = base_path +'/test_data/merging_tests/error_test/'\n output_file = os.path.join(test_folder, \"output1.jpg\")\n\n self.assertRaises(mi.ImageError, lambda: mi.add_background(test_folder+\"dummy.txt\", test_folder+\"background.jpg\", output_file)... | [
"0.6594361",
"0.6371965",
"0.6179928",
"0.617114",
"0.613714",
"0.61048645",
"0.6091394",
"0.6054181",
"0.5993377",
"0.5975022",
"0.5965196",
"0.5943787",
"0.59276956",
"0.5922497",
"0.59199405",
"0.5838658",
"0.58281934",
"0.58267826",
"0.581185",
"0.58048946",
"0.57999486",... | 0.7143594 | 0 |
Test getting all center invalid errors | def test_get_center_invalid_errors(syn):
with patch.object(
syn, "tableQuery", return_value=QueryResponse
) as patch_query, patch.object(
write_invalid_reasons, "_combine_center_file_errors", return_value="errors"
) as patch_combine:
center_invalid = write_invalid_reasons.get_center_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_errors(self) -> None:",
"def storefront_check_errors():\n\n\tcurrentView = uidoc.ActiveView\n\tfamTypeDict = GetFamilyTypeDict(\"Fabrication-Error-Symbol\")\n\n\t# Clear existing error notations\n\terrorNotations = list(GetElementsInView(BuiltInCategory.OST_GenericAnnotation, Autodesk.Revit.DB.FamilyIn... | [
"0.68639857",
"0.65659684",
"0.6317057",
"0.6280998",
"0.624511",
"0.62418723",
"0.6231955",
"0.6174314",
"0.6160829",
"0.6155387",
"0.6125272",
"0.61134624",
"0.6105969",
"0.60783327",
"0.606288",
"0.60506743",
"0.604379",
"0.6016345",
"0.60074997",
"0.6006396",
"0.6003036",... | 0.73111194 | 0 |
Returns the highest magnification for the slide | def highest_mag(slide):
return int(slide.properties['aperio.AppMag']) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mag(self):\n return self.photosamplers.get_estimate(mag=True)[0]",
"def get_mag_for_size(slide, size):\n max_size = slide.dimensions\n max_mag = highest_mag(slide)\n downsample = np.average([max_dim/size_dim for max_dim, size_dim in zip(max_size, size)])\n return max_mag/downsample",
"de... | [
"0.7143382",
"0.6984062",
"0.6947595",
"0.6700194",
"0.6502702",
"0.6465279",
"0.6439392",
"0.6389368",
"0.62770873",
"0.62758964",
"0.6203424",
"0.6182897",
"0.6060569",
"0.6010728",
"0.6000861",
"0.59334785",
"0.5931892",
"0.59017086",
"0.5889821",
"0.58670044",
"0.584315",... | 0.8554771 | 0 |
Returns the magnification for each level in a slide | def level_mags(slide):
return [highest_mag(slide)/downsample for downsample in slide.level_downsamples] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_level_mag(slide, level):\n return level_mags(slide)[level]",
"def get_thumbnail_magnification(slide):\n ratio = np.asarray(slide.dimensions) / np.asarray(slide.associated_images[\"thumbnail\"].size)\n # np.sqrt(np.prod(ratio))\n return ratio",
"def get_level_for_mag(slide, mag):\n level... | [
"0.7798809",
"0.6923862",
"0.66853",
"0.65677786",
"0.62147903",
"0.6124908",
"0.61031574",
"0.6090716",
"0.6088541",
"0.58556306",
"0.5820038",
"0.56304854",
"0.5626129",
"0.56065404",
"0.5559378",
"0.54275894",
"0.54266506",
"0.5425498",
"0.53985816",
"0.53818405",
"0.52535... | 0.78430814 | 0 |
Returns the dimensions of a level | def get_level_size(slide, level):
return slide.level_dimensions[level] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dimensions():",
"def getDimensions():",
"def _get_ndim(self):\n return len(self.level_shapes[0])",
"def depth(self):\n return _libsbml.Dimensions_depth(self)",
"def dimensions(self) -> int:\n return pulumi.get(self, \"dimensions\")",
"def get_map_size(level):\n if level < 5:\n... | [
"0.7337827",
"0.7250944",
"0.7064121",
"0.7035364",
"0.6847221",
"0.67899704",
"0.67407316",
"0.6720339",
"0.66824",
"0.66605484",
"0.66371953",
"0.6546749",
"0.6472022",
"0.6469843",
"0.64618737",
"0.6444262",
"0.6423922",
"0.6412058",
"0.6396843",
"0.6379703",
"0.6365779",
... | 0.8075793 | 0 |
Returns the magnification at a particular level | def get_level_mag(slide, level):
return level_mags(slide)[level] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _calculate_magnification(self, times):\n if self._model.n_lenses == 2:\n factor = 10.\n params = self._model.parameters\n t_1 = params.t_0 - factor * params.t_E\n t_2 = params.t_0 + factor * params.t_E\n self._model.set_magnification_methods([t_1, '... | [
"0.67559737",
"0.6685309",
"0.66784066",
"0.65893006",
"0.6497956",
"0.62938315",
"0.61198086",
"0.6092812",
"0.6024545",
"0.5632027",
"0.55412483",
"0.5471536",
"0.54661393",
"0.5413815",
"0.5413614",
"0.53920174",
"0.53455603",
"0.5330778",
"0.5330044",
"0.5313709",
"0.5275... | 0.7867714 | 0 |
Get the level corresponding to a certain magnification, if available | def get_level_for_mag(slide, mag):
level_mags_rounded = list(np.round(level_mags(slide), decimals = 2))
if mag in level_mags_rounded:
return level_mags_rounded.index(mag)
else:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_level_mag(slide, level):\n return level_mags(slide)[level]",
"def getLevel(unique_name):",
"def level_mags(slide):\n return [highest_mag(slide)/downsample for downsample in slide.level_downsamples]",
"def mag(self):\n return self.photosamplers.get_estimate(mag=True)[0]",
"def get_lumin... | [
"0.76260245",
"0.6262649",
"0.62293607",
"0.61587805",
"0.60415137",
"0.6033318",
"0.58130866",
"0.5732402",
"0.57084596",
"0.5647901",
"0.5613819",
"0.5604842",
"0.5599045",
"0.55820286",
"0.5574072",
"0.5559694",
"0.55576396",
"0.555535",
"0.55302167",
"0.5511368",
"0.54941... | 0.7825988 | 0 |
Get the image size the highest magnification image would have to be resized to get an equivalent magnification | def get_size_for_mag(slide, mag):
max_size = slide.dimensions
max_mag = highest_mag(slide)
downsample = max_mag/mag
return [np.int(np.round(dim/downsample)) for dim in max_size] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getZoomFactor(imageSize, maxW, maxH):\n\timageW, imageH = imageSize\n\tzoomW = float(imageW) / float(maxW)\n\tzoomH = float(imageH) / float(maxH)\n\treturn max(zoomW, zoomH)",
"def get_image_size(self):",
"def get_thumbnail_magnification(slide):\n ratio = np.asarray(slide.dimensions) / np.asarray(slide.... | [
"0.70223284",
"0.69094974",
"0.6904307",
"0.6871893",
"0.6834652",
"0.67987007",
"0.6753258",
"0.6662533",
"0.6641104",
"0.6629991",
"0.6623062",
"0.66070765",
"0.65710425",
"0.6462559",
"0.6438334",
"0.64352167",
"0.64264476",
"0.6413869",
"0.64073336",
"0.6405353",
"0.63959... | 0.721434 | 0 |
Adds 5 latest blog posts as `latest_articles`, 5 latest comments as `latest_comments`, and all tags (annotated with `num_articles` field) as `tags` to the context, regardless of `request`. | def latest_content(request):
latest_articles = Article.published_articles()[:5]
latest_comments = Comment.objects.all().order_by('-pub_date')[:5]
tags = Tag.objects.annotate(num_articles=Count('article')).order_by(
'-num_articles')
contributors = Contributor.objects.annotate(
num_article... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def latest_blog_posts(self, request, *args, **kwargs):\n context = self.get_context(request, *args, **kwargs)\n context[\"latest_posts\"] = MyblogDetailPage.objects.live().public()[:1] \n return render(request, \"myblog/latest_posts.html\", context)",
"def last_five(request):\n fla... | [
"0.6630519",
"0.6064325",
"0.5982739",
"0.5916848",
"0.58361304",
"0.5788325",
"0.57815117",
"0.5755909",
"0.57152796",
"0.56332666",
"0.56171244",
"0.5601291",
"0.5582968",
"0.54634035",
"0.5452473",
"0.53599924",
"0.5354808",
"0.5313329",
"0.52591276",
"0.522024",
"0.521882... | 0.67686737 | 0 |
Format a Roku Channel name. | def format_channel_name(channel_number: str, channel_name: str | None = None) -> str:
if channel_name is not None and channel_name != "":
return f"{channel_name} ({channel_number})"
return channel_number | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def channel_name(radio_id: int, channel_id: int) -> str:\n return f\"COMM{radio_id} Ch {channel_id}\"",
"def channelName(self):\n channel_list = (\"Neutral\",\n \"BBC1\",\n \"BBC2\",\n \"ITV\",\n \"Channel 4... | [
"0.78294134",
"0.7059564",
"0.6983384",
"0.68293834",
"0.68293834",
"0.68293834",
"0.68293834",
"0.68293834",
"0.68293834",
"0.68293834",
"0.68293834",
"0.68293834",
"0.68293834",
"0.68293834",
"0.68293834",
"0.68293834",
"0.68293834",
"0.68293834",
"0.68293834",
"0.68293834",
... | 0.7868498 | 1 |
fetcher.get_projects() should return a list of projects. | def test_get_projects_returns_projects(fc: fetcher.Fetcher):
projects = fc.get_projects()
assert isinstance(projects, list)
assert isinstance(projects[0], models.Project) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_projects(self):\n projects = []\n page = 1\n while not len(projects) % 100:\n projects += self._get('/projects?{0}'.format(urllib.urlencode({'per_page': 100, 'page': page})))\n if not projects:\n break\n page += 1\n return projects... | [
"0.8439259",
"0.8330137",
"0.81635183",
"0.790544",
"0.7656669",
"0.7634909",
"0.7559611",
"0.7557729",
"0.7551785",
"0.7523433",
"0.7494402",
"0.7446309",
"0.74364996",
"0.7427242",
"0.73962003",
"0.7385047",
"0.73531884",
"0.7350818",
"0.73503566",
"0.7344059",
"0.7321423",... | 0.862502 | 0 |
fetchet.get_projects() should be able to filter on project. | def test_get_projects_filters(fc: fetcher.Fetcher, test_project_name):
projects = fc.get_projects(test_project_name)
assert isinstance(projects, list)
assert len(projects) == 1
assert projects[0].name == test_project_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_projects(self):\n pass",
"def test_list_project_request(self):\n pass",
"def test_list_projects(self):\n pass",
"def test_list_projects(self):\n pass",
"def test_get_projects_returns_projects(fc: fetcher.Fetcher):\n projects = fc.get_projects()\n assert isinst... | [
"0.740072",
"0.7351347",
"0.7287984",
"0.7287984",
"0.72771144",
"0.72143286",
"0.7165112",
"0.71590155",
"0.7144451",
"0.7075294",
"0.7046728",
"0.7021743",
"0.70181876",
"0.69926757",
"0.698769",
"0.6950364",
"0.6894256",
"0.68472075",
"0.6795028",
"0.67938405",
"0.6792199"... | 0.829477 | 0 |
fetcher.get_models() should return a list of models. | def test_get_models_returns_models(fc: fetcher.Fetcher):
ml = fc.get_models()
assert isinstance(ml, list)
assert isinstance(ml[0], models.LookmlModel) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_models(self, req, is_detail):\n context = req.environ['meteos.context']\n\n search_opts = {}\n search_opts.update(req.GET)\n\n # Remove keys that are not related to model attrs\n search_opts.pop('limit', None)\n search_opts.pop('offset', None)\n sort_key = ... | [
"0.7452906",
"0.72231185",
"0.7150281",
"0.71438277",
"0.70214987",
"0.69560665",
"0.69169444",
"0.6905092",
"0.68741965",
"0.6871369",
"0.6853938",
"0.6839921",
"0.67970765",
"0.67815137",
"0.6671083",
"0.66492426",
"0.6614827",
"0.65691483",
"0.6551473",
"0.64561534",
"0.64... | 0.769774 | 0 |
fetcher.get_models() should be able to filter on project or model. | def test_get_models_filters(fc: fetcher.Fetcher, test_project_name, test_model):
ml = fc.get_models(project=test_project_name)
assert all(m.project_name == test_project_name for m in ml)
ml = fc.get_models(model=test_model["name"])
assert all(m.name == test_model["name"] for m in ml)
ml = fc.get_m... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_models(self, req, is_detail):\n context = req.environ['meteos.context']\n\n search_opts = {}\n search_opts.update(req.GET)\n\n # Remove keys that are not related to model attrs\n search_opts.pop('limit', None)\n search_opts.pop('offset', None)\n sort_key = ... | [
"0.72766924",
"0.66285986",
"0.6556921",
"0.6551836",
"0.6296319",
"0.626473",
"0.6252031",
"0.61985433",
"0.61647654",
"0.61226976",
"0.61226976",
"0.607028",
"0.60465264",
"0.6035401",
"0.60337895",
"0.59634507",
"0.5959686",
"0.5941662",
"0.5922241",
"0.59054995",
"0.58814... | 0.75294465 | 0 |
fetcher.get_models() should throw if a model is not found. | def test_get_models_throws_if_model_does_not_exist(fc: fetcher.Fetcher, project, model):
with pytest.raises(exceptions.NotFoundError) as exc:
fc.get_models(project=project, model=model)
assert "An error occured while getting models." in str(exc.value) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_models_returns_models(fc: fetcher.Fetcher):\n ml = fc.get_models()\n assert isinstance(ml, list)\n assert isinstance(ml[0], models.LookmlModel)",
"def get_models(self, app_name):\n try:\n models = list(apps.get_app_config(app_name).get_models())\n return models\... | [
"0.7327567",
"0.69435924",
"0.67743224",
"0.67731684",
"0.666128",
"0.66390353",
"0.6595562",
"0.6590047",
"0.64084816",
"0.6316313",
"0.6267025",
"0.62651926",
"0.626041",
"0.6233475",
"0.6200443",
"0.61957514",
"0.61935633",
"0.61921066",
"0.61672646",
"0.61589247",
"0.6154... | 0.75194955 | 0 |
fetcher.get_used_models() should return models that have queries against them. | def test_get_used_models(fc: fetcher.Fetcher, test_model):
used_models = fc.get_used_models()
assert isinstance(used_models, dict)
assert len(used_models) > 0
assert all(type(model_name) == str for model_name in used_models.keys())
assert all(type(query_count) == int for query_count in used_models.v... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def availablemodels(self):\n return self.__models.keys()",
"def _get_models(self, req, is_detail):\n context = req.environ['meteos.context']\n\n search_opts = {}\n search_opts.update(req.GET)\n\n # Remove keys that are not related to model attrs\n search_opts.pop('limit'... | [
"0.70178705",
"0.66382486",
"0.6534866",
"0.631813",
"0.63044095",
"0.6285215",
"0.61792207",
"0.6041896",
"0.60361505",
"0.6007675",
"0.592958",
"0.5920479",
"0.58479476",
"0.5833444",
"0.58288264",
"0.5817674",
"0.58034897",
"0.58034897",
"0.58034897",
"0.58034897",
"0.5747... | 0.7987806 | 0 |
fetcher.get_explores() should return a list of explores. | def test_get_explores(fc: fetcher.Fetcher):
explores = fc.get_explores()
assert isinstance(explores, list)
assert len(explores) > 0
assert isinstance(explores[0], models.LookmlModelExplore) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_explores_filters(fc: fetcher.Fetcher):\n explores = fc.get_explores(model=\"henry_dusty\")\n assert all(e.model_name == \"henry_dusty\" for e in explores)\n\n explores = fc.get_explores(model=\"henry_qa\", explore=\"explore_2_joins_all_used\")\n assert all(\n e.model_name == \"henry... | [
"0.6731509",
"0.6563917",
"0.6551571",
"0.63968503",
"0.63752097",
"0.5857632",
"0.57382774",
"0.5567012",
"0.54315007",
"0.54032236",
"0.5390805",
"0.53766435",
"0.52719086",
"0.52510387",
"0.52280146",
"0.52221656",
"0.5203557",
"0.5185477",
"0.5180662",
"0.5156471",
"0.514... | 0.7531671 | 0 |
fetcher.get_explores() should be able to filter on model and/or explore. | def test_get_explores_filters(fc: fetcher.Fetcher):
explores = fc.get_explores(model="henry_dusty")
assert all(e.model_name == "henry_dusty" for e in explores)
explores = fc.get_explores(model="henry_qa", explore="explore_2_joins_all_used")
assert all(
e.model_name == "henry_qa" and e.name == "... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_explores(fc: fetcher.Fetcher):\n explores = fc.get_explores()\n assert isinstance(explores, list)\n assert len(explores) > 0\n assert isinstance(explores[0], models.LookmlModelExplore)",
"def test_get_used_explores(fc: fetcher.Fetcher, test_model, test_used_explore_names):\n used_expl... | [
"0.753411",
"0.6666877",
"0.6630365",
"0.63271785",
"0.6167889",
"0.5833313",
"0.55136293",
"0.53865874",
"0.53228235",
"0.53056663",
"0.5212486",
"0.51720136",
"0.51571435",
"0.5055647",
"0.50480455",
"0.50150645",
"0.49779034",
"0.49160555",
"0.49039322",
"0.4895284",
"0.48... | 0.822642 | 0 |
fetcher.get_explores() should throw if an explore/model is not found. | def test_get_explores_throws_if_model_or_explore_does_not_exist(
fc: fetcher.Fetcher, model: Optional[str], explore: Optional[str], msg: str
):
with pytest.raises(exceptions.NotFoundError) as exc:
fc.get_explores(model=model, explore=explore)
assert msg in str(exc.value) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_explores(fc: fetcher.Fetcher):\n explores = fc.get_explores()\n assert isinstance(explores, list)\n assert len(explores) > 0\n assert isinstance(explores[0], models.LookmlModelExplore)",
"def test_get_explores_filters(fc: fetcher.Fetcher):\n explores = fc.get_explores(model=\"henry_du... | [
"0.79972434",
"0.6808644",
"0.64591634",
"0.6081574",
"0.6081095",
"0.6056974",
"0.5249449",
"0.5153191",
"0.5144307",
"0.5057118",
"0.49663934",
"0.49415502",
"0.4938596",
"0.49360746",
"0.49263144",
"0.4916875",
"0.49087682",
"0.48916966",
"0.48450214",
"0.4824901",
"0.4805... | 0.73947066 | 1 |
fetcher.get_used_explores() should return all used explores. | def test_get_used_explores(fc: fetcher.Fetcher, test_model, test_used_explore_names):
used_explores = fc.get_used_explores(model=test_model["name"])
assert isinstance(used_explores, dict)
assert all(e in test_used_explore_names for e in used_explores) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_unused_explores(fc: fetcher.Fetcher, test_model, test_unused_explores):\n unused_explores = fc.get_unused_explores(model=test_model[\"name\"])\n assert all(e in test_unused_explores for e in unused_explores)",
"def test_get_explores_filters(fc: fetcher.Fetcher):\n explores = fc.get_explores... | [
"0.7264244",
"0.6198452",
"0.6186663",
"0.59214425",
"0.5807355",
"0.5651149",
"0.56107587",
"0.5609498",
"0.5529075",
"0.5527514",
"0.5387147",
"0.5349075",
"0.52784765",
"0.52772737",
"0.5273169",
"0.5267631",
"0.52531534",
"0.52378064",
"0.52269423",
"0.5195598",
"0.515275... | 0.7800213 | 0 |
fetcher.get_unused_explores() should return all unused explores. | def test_get_unused_explores(fc: fetcher.Fetcher, test_model, test_unused_explores):
unused_explores = fc.get_unused_explores(model=test_model["name"])
assert all(e in test_unused_explores for e in unused_explores) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_used_explores(fc: fetcher.Fetcher, test_model, test_used_explore_names):\n used_explores = fc.get_used_explores(model=test_model[\"name\"])\n assert isinstance(used_explores, dict)\n assert all(e in test_used_explore_names for e in used_explores)",
"def exploits(self):\n return self.... | [
"0.6674417",
"0.5879174",
"0.573975",
"0.5573522",
"0.5512234",
"0.5511594",
"0.54789424",
"0.5453956",
"0.54249877",
"0.5305752",
"0.52119917",
"0.5211895",
"0.5186949",
"0.5154393",
"0.5097592",
"0.50868165",
"0.50696427",
"0.4995546",
"0.49941427",
"0.49911252",
"0.4978347... | 0.7982038 | 0 |
fetcher.get_explore_fields() should return an explores fields. | def test_get_explore_fields_gets_fields(
fc: fetcher.Fetcher, test_model, test_explores_stats
):
test_explore = test_explores_stats[0]
explore = fc.get_explores(model=test_model["name"], explore=test_explore["name"])
assert isinstance(explore, list)
explore = explore[0]
assert isinstance(explore... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_explore_fields_gets_fields_for_dimension_or_measure_only_explores(\n fc: fetcher.Fetcher, test_model, test_dimensions_or_measures_only_explores\n):\n expected = test_dimensions_or_measures_only_explores[0]\n explore = fc.get_explores(model=test_model[\"name\"], explore=expected[\"name\"])\n ... | [
"0.7630596",
"0.71610755",
"0.619276",
"0.5935856",
"0.5886932",
"0.56719977",
"0.56685346",
"0.56128865",
"0.5601622",
"0.55978966",
"0.55809444",
"0.5578002",
"0.55722994",
"0.54728",
"0.5469623",
"0.5441008",
"0.543378",
"0.5390191",
"0.5388459",
"0.5369778",
"0.5361909",
... | 0.8270363 | 0 |
fetcher.get_explore_fields() should return when an explore has only dimensions or only measures. | def test_get_explore_fields_gets_fields_for_dimension_or_measure_only_explores(
fc: fetcher.Fetcher, test_model, test_dimensions_or_measures_only_explores
):
expected = test_dimensions_or_measures_only_explores[0]
explore = fc.get_explores(model=test_model["name"], explore=expected["name"])
assert isins... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_explore_fields_gets_fields(\n fc: fetcher.Fetcher, test_model, test_explores_stats\n):\n test_explore = test_explores_stats[0]\n explore = fc.get_explores(model=test_model[\"name\"], explore=test_explore[\"name\"])\n assert isinstance(explore, list)\n explore = explore[0]\n assert is... | [
"0.79898906",
"0.7255912",
"0.57427955",
"0.5689888",
"0.5485005",
"0.544207",
"0.5428259",
"0.54008704",
"0.5328612",
"0.52564484",
"0.5198791",
"0.5090246",
"0.5081006",
"0.5072066",
"0.50549966",
"0.5046278",
"0.49843732",
"0.49804208",
"0.49604252",
"0.49604252",
"0.49590... | 0.81051433 | 0 |
fetcher.get_explore_field_stats() should get the stats of all fields in an explore. | def test_get_explore_field_stats(
fc: fetcher.Fetcher,
looker_sdk: methods.Looker40SDK,
test_model,
test_used_explore_names,
test_explores_stats,
):
explore = fc.get_explores(
model=test_model["name"], explore=test_used_explore_names[0]
)[0]
actual_stats = fc.get_explore_field_st... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_explore_fields_gets_fields(\n fc: fetcher.Fetcher, test_model, test_explores_stats\n):\n test_explore = test_explores_stats[0]\n explore = fc.get_explores(model=test_model[\"name\"], explore=test_explore[\"name\"])\n assert isinstance(explore, list)\n explore = explore[0]\n assert is... | [
"0.757388",
"0.66561705",
"0.5693254",
"0.5563461",
"0.5562313",
"0.55102324",
"0.55069894",
"0.54181457",
"0.5415948",
"0.53354806",
"0.53127414",
"0.528702",
"0.5241747",
"0.52340806",
"0.52330387",
"0.52114326",
"0.51936793",
"0.5185652",
"0.51400167",
"0.5138318",
"0.5132... | 0.7587318 | 0 |
fetcher.get_explore_join_stats() should return the stats of all joins in an explore. | def test_get_explore_join_stats(fc: fetcher.Fetcher, test_model):
explore = fc.get_explores(
model=test_model["name"], explore="explore_2_joins_1_used"
)[0]
field_stats = {
"explore_2_joins_1_used.d1": 10,
"explore_2_joins_1_used.d2": 5,
"explore_2_joins_1_used.d3": 0,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_join_info(node):\n operator_info = node['operatorInfo']\n analyze_info = node['AnalyzeInfo']\n\n if 'Join' in node['id']:\n # Join Node\n join_type = extract_join_type(operator_info)\n conditions = extract_join_conditions(operator_info)\n current_node = JoinPlan(joi... | [
"0.5480241",
"0.53656536",
"0.50666654",
"0.5061134",
"0.49818888",
"0.4904676",
"0.48338452",
"0.48054832",
"0.47597033",
"0.47334749",
"0.4718956",
"0.47070545",
"0.46772164",
"0.46477938",
"0.46049055",
"0.45803955",
"0.45192826",
"0.44968593",
"0.44656146",
"0.44228086",
... | 0.83031076 | 0 |
Normalize audio file to range [1, 1] | def normalize(audio):
norm = audio/max(audio)
return norm | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalize(filename,wout=True):\n n, data, data_dB,sr,ch=inputwav(filename)\n if ch==1:\n diff=0-max(data_dB)\n if ch==2:\n d1=0-max(data_dB[:,0])\n d2=0-max(data_dB[:,1])\n diff=max(d1,d2)\n print('Adding '+str(diff)+' dB...')\n data_dB_norm=data_dB+diff\n data_nor... | [
"0.6990606",
"0.69585127",
"0.6922056",
"0.6835355",
"0.6835355",
"0.66305023",
"0.64685136",
"0.64316094",
"0.6400724",
"0.6398994",
"0.63599336",
"0.6334538",
"0.63280183",
"0.62815994",
"0.62611055",
"0.62473464",
"0.6237534",
"0.6221386",
"0.6176301",
"0.6140515",
"0.6132... | 0.78221744 | 0 |
Load an audio file and segment into 10s increments Save each segment to the target directory. Append the gender of the speaker and the segment index to the filename. | def segment_audio(filename, y_value, split='train', clf='gender'):
filepath = 'recordings/recordings/' + filename + '.mp3'
audio, sr = librosa.load(filepath, sr=16000)
audio = normalize(audio)
# Add gender label to filename for later processing
sex = y_value
if sex == 'female':
filenam... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def file_generator(files: list,\n segment_duration: float,\n sampleRate: int,\n db_thr: float or None = None,\n frame_length: int = 512,\n hop_length: int = 128,\n ) -> None:\n\n I = 0\n J = 0\n\n s... | [
"0.5985446",
"0.5802684",
"0.57816744",
"0.5737059",
"0.5693634",
"0.5681921",
"0.55937463",
"0.5582633",
"0.5564124",
"0.55507296",
"0.55322385",
"0.5512459",
"0.55056393",
"0.5496371",
"0.54751974",
"0.5456971",
"0.5410829",
"0.5401392",
"0.53417194",
"0.5321298",
"0.531510... | 0.70655805 | 0 |
Load an audio file (or segment). Add random noise to the file and save with new filename. | def noisy_data(filename, split='train', clf='gender'):
filepath = 'data/{}/{}/{}o.wav'.format(clf, split, filename)
audio, sr = librosa.load(filepath, sr=16000)
# Add noise
noisy = add_noise(audio)
# Write noise to file
sf.write('data/{}/{}/{}n.wav'.format(clf, split, filename), noisy, sr)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_audio(file_path):\n # load the audio file in its original sampling rate\n audio_data, sr = librosa.load(file_path, sr=sampling_rate)\n\n # get the common file name\n file_name = file_path.split(\"/\")[-1]\n file_name = file_name.split(\".wav\")[0]\n\n # calculate number of samples in the... | [
"0.62971425",
"0.6159043",
"0.5984587",
"0.59020734",
"0.58086365",
"0.5675305",
"0.56475496",
"0.5606833",
"0.559785",
"0.5565294",
"0.54593736",
"0.54581594",
"0.5443855",
"0.5441127",
"0.54234785",
"0.542045",
"0.5408668",
"0.53995633",
"0.53893155",
"0.5381253",
"0.537922... | 0.689111 | 0 |
Release a lock on the bus | def bus_release(self):
self._bus_lock.release() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def release_lock():\r\n get_lock.n_lock -= 1\r\n assert get_lock.n_lock >= 0\r\n # Only really release lock once all lock requests have ended.\r\n if get_lock.lock_is_enabled and get_lock.n_lock == 0:\r\n get_lock.start_time = None\r\n get_lock.unlocker.unlock()",
"def release_lock(self... | [
"0.7924762",
"0.7834396",
"0.77969474",
"0.77904904",
"0.74435604",
"0.74268526",
"0.73679256",
"0.7322436",
"0.7123128",
"0.7118452",
"0.71132535",
"0.709967",
"0.7089947",
"0.70288163",
"0.7005624",
"0.699237",
"0.6928809",
"0.6910996",
"0.6896251",
"0.687286",
"0.6866911",... | 0.8140664 | 0 |
Decorator to be used in apimethods to serve the swaggerdocumentation for this api. | def api_documentation(api: str, summary: str, in_model: BaseModel,
out_model: BaseModel, out_description: str) -> Callable:
for model, name in ((in_model, 'Input'), (out_model, 'Output')):
doc.Object(
make_dataclass(
f'Api{api[1:].title()}{name}',
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index():\n definition = {\n \"swagger\": \"2.0\",\n \"info\": {\n \"title\": flask.current_app.config.get(\"APPNAME\", \"Not specified\"),\n \"version\": flask.current_app.config.get(\"VERSION\", \"Not specified\"),\n },\n \"host\": request.host,\n \"... | [
"0.7308593",
"0.67804843",
"0.67267275",
"0.6568308",
"0.6500626",
"0.6489433",
"0.64708114",
"0.64436257",
"0.63863075",
"0.6336464",
"0.6331381",
"0.6279588",
"0.6140457",
"0.6124011",
"0.6117498",
"0.6093394",
"0.60924906",
"0.60902476",
"0.60646194",
"0.6054501",
"0.60270... | 0.6823912 | 1 |
Decorator to be used in apimethods to convert the requestdata to an instance of the passed `model`. This instance is passed to the decorated apiendpoint as the parameter `service_params`. | def api_inputmodel(api: str, model: BaseModel, servicename: str,
service_logger: logger) -> Callable:
def decorator(func):
@wraps(func)
async def function_wrapper(request, *args, **kwargs):
try:
service_params = model.parse_raw(request.body)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def api_outputmodel(api: str, model: BaseModel, servicename: str,\n service_logger: logger) -> Callable:\n\n def decorator(func):\n @wraps(func)\n async def function_wrapper(request, *args, **kwargs):\n service_result = await func(request, *args, **kwargs)\n ... | [
"0.6261429",
"0.61969465",
"0.5975331",
"0.56145257",
"0.5604642",
"0.55971265",
"0.558913",
"0.5562619",
"0.54409605",
"0.5427529",
"0.5384895",
"0.53138745",
"0.531021",
"0.5299018",
"0.52693087",
"0.52421254",
"0.5187899",
"0.5182848",
"0.51826674",
"0.5159831",
"0.5159831... | 0.7151013 | 0 |
Decorator to be used in apimethods to convert the responsedata of the decorated apimethod to a json based on the passed `model`. | def api_outputmodel(api: str, model: BaseModel, servicename: str,
service_logger: logger) -> Callable:
def decorator(func):
@wraps(func)
async def function_wrapper(request, *args, **kwargs):
service_result = await func(request, *args, **kwargs)
try:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def json_response(func):\n\t@wraps(func)\n\tdef decorated_view(*args, **kwargs):\n\t\tdata = func(*args, **kwargs)\n\t\tdata = json.dumps(data)\n\t\tresponse = make_response(data)\n\t\tresponse.headers['Content-Type'] = 'application/json'\n\t\treturn response\n\treturn decorated_view",
"def json_response(func):\... | [
"0.6303589",
"0.6233411",
"0.6158551",
"0.61566204",
"0.61502767",
"0.6142237",
"0.6134618",
"0.60121006",
"0.60005003",
"0.5990344",
"0.59364825",
"0.59224707",
"0.59192204",
"0.5905445",
"0.58905154",
"0.58634555",
"0.5848181",
"0.5831524",
"0.58291614",
"0.58150035",
"0.57... | 0.6607163 | 0 |
Update attempt to update branch to the given SHA. | def update_branch(self, name, sha):
branch_info = {
'sha': sha,
}
resp = self.patch('git/refs/heads/{}'.format(name), json=branch_info)
try:
resp.raise_for_status()
except Exception:
logger.error(resp.json())
raise
return ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_latest_branch (product, which, main_branch):\n\n name = \"Latest_ACE7TAO3_\" + which\n\n vprint ('Fast-forwarding', name, 'to', main_branch)\n ex (\"cd $DOC_ROOT/\" + product + \" && git fetch . \" + main_branch + \":\" + name)",
"def update(self, branch=None):\n if branch is None:\n ... | [
"0.62394434",
"0.62033707",
"0.58707505",
"0.5823983",
"0.57316476",
"0.5548735",
"0.54924744",
"0.5490744",
"0.54566896",
"0.53568214",
"0.533697",
"0.53313905",
"0.5318119",
"0.5305053",
"0.52909243",
"0.52125496",
"0.5172792",
"0.51444185",
"0.5125727",
"0.5123589",
"0.511... | 0.70466286 | 0 |
Verify that the release is actually read to be released If the release is new (corresponds to a release branch), then we check that the release is merged into master. If we can not find the release branch, we assume that it is a hotfix and we verify that the major version number matches the latest release. | def check_release_status(self, release_name, release_branch):
logger.debug('GitHubAPI.check_release_status args: {}; {}'.format(
release_name, release_branch)
)
release_version = extract_release_branch_version(release_name)
release_branch_base = build_release_base_name(get_co... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_release_branch():\n diff_string_config_yml = run_command(\"git diff origin/master .circleci/config.yml\")\n if re.search(r'[+-][ ]+CONTENT_VERSION: \".*', diff_string_config_yml):\n return True\n\n return False",
"def verify_tags(git_ref_target):\n latest_release = github_util.get_lates... | [
"0.69423383",
"0.6784403",
"0.66795766",
"0.6649919",
"0.6507445",
"0.64944094",
"0.63654304",
"0.6350596",
"0.6347604",
"0.63336277",
"0.6305721",
"0.6219666",
"0.62047046",
"0.61802447",
"0.6172858",
"0.612331",
"0.6118963",
"0.6113204",
"0.6088553",
"0.60614514",
"0.604839... | 0.73628855 | 0 |
Reads in audio file, processes it | def process_audio_file(self, file_name):
sig, sr = librosa.load(file_name, mono=True)
return self._extract_function(sig, sr) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_audio(f, downmix):\n if f.endswith('.mp3'):\n f = _mp3_hook(f)\n sr, audio = scipy.io.wavfile.read(f)\n if not audio.dtype is np.float32:\n audio = _normalize_pcm(audio)\n if downmix and len(audio.shape) == 2:\n audio = down_mix(audio)\n return sr, audio",
"def audioR... | [
"0.7045707",
"0.6956398",
"0.6821181",
"0.6742061",
"0.6704527",
"0.6699321",
"0.6644113",
"0.6615665",
"0.64650714",
"0.6453779",
"0.63955903",
"0.63811314",
"0.63749427",
"0.6367572",
"0.63429946",
"0.6340871",
"0.633396",
"0.6314544",
"0.6308602",
"0.6294938",
"0.6285965",... | 0.72694874 | 0 |
r""" Return ``n`` independent symbolic matrices in dimension ``d``. | def symbolic_max_plus_matrices(d, n, ch=None, typ='sym'):
d = int(d)
n = int(n)
if d <= 0:
raise ValueError("d (= {}) must be postive".format(d))
nvar = n * d * d
V = FreeModule(ZZ, nvar)
B = ((b,) for b in V.basis())
matrices = []
if d == 1:
typ = 'full'
if typ ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def basis(d, symbolic=True):\n X = sym.symbols('X')\n if d == 0:\n phi_sym = [1]\n else:\n if symbolic:\n h = sym.Rational(1, d) # node spacing\n nodes = [2*i*h - 1 for i in range(d+1)]\n else:\n nodes = np.linspace(-1, 1, d+1)\n \n phi_sym = [Lagrange_poly... | [
"0.59795463",
"0.5888374",
"0.57391495",
"0.5711324",
"0.5686454",
"0.5563071",
"0.5492323",
"0.5435326",
"0.5423058",
"0.5419523",
"0.54059994",
"0.5392236",
"0.538575",
"0.5366352",
"0.5356909",
"0.53455615",
"0.5337914",
"0.5334625",
"0.5330213",
"0.53227186",
"0.53154725"... | 0.58973736 | 1 |
r""" Return a string that describes the convex hull engine. | def convex_hull_engine(self):
return self.convex_hull._name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _repr_(self):\n desc = ''\n if self.n_vertices()==0:\n desc += 'The empty polyhedron'\n else:\n desc += 'A ' + repr(self.dim()) + '-dimensional polyhedron'\n desc += ' in '\n if self.field()==QQ: desc += 'QQ'\n else: desc += 'RDF'\n... | [
"0.66425604",
"0.63532376",
"0.6281747",
"0.60994506",
"0.60871357",
"0.5944821",
"0.5937618",
"0.5842721",
"0.5841963",
"0.5745582",
"0.57072836",
"0.5683671",
"0.5624012",
"0.5577006",
"0.55180144",
"0.54937017",
"0.5490255",
"0.5487594",
"0.54810053",
"0.5431776",
"0.54206... | 0.75023854 | 0 |
r""" Return the list of equal coefficients between self and other. | def equal_coefficients(self, other):
d = self._d
return [(i,j) for i in range(d) for j in range(d) \
if self[i][j] == other[i][j]] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __xor__(self, other):\n\n sym_diff = [value for value in self if value not in other]\n sym_diff.extend([value for value in other if value not in self])\n\n return sym_diff",
"def GetEqualConstrains(self):\n return _gmat_py.Spacecraft_GetEqualConstrains(self)",
"def coefficients(... | [
"0.66310555",
"0.6198817",
"0.61889756",
"0.5865301",
"0.5818835",
"0.5683608",
"0.5683608",
"0.56740135",
"0.5648324",
"0.56273437",
"0.56273437",
"0.5593266",
"0.55242145",
"0.5514569",
"0.546532",
"0.5455155",
"0.5414487",
"0.5409538",
"0.5363544",
"0.53480685",
"0.5334692... | 0.78071773 | 0 |
r""" Evaluates this symbolic matrix at the integer point ``p``. | def eval(self, p):
from max_plus.max_plus_int import minus_infinity, IntegerMaxPlusMatrix
F = FreeModule(ZZ, self._nvars)
p = F(p)
mat = []
d = self.dim()
for i in range(d):
row = []
for j in range(d):
pts = self[i,j]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def evaluate(self,p):\n if not self.initialized: self.__initialize__()\n if self.vp0: p_ = 1-p\n else: p_ = p\n if self.ids_to_consider is None:\n #sum on all parametrized cell\n cf = np.sum(self.V[self.p_ids-1]*p_)/self.V_tot - self.max_v_frac\n else:\n cf = np.sum((self.V[self.ids_t... | [
"0.6590414",
"0.64902985",
"0.5803352",
"0.576456",
"0.56841123",
"0.56735307",
"0.5545928",
"0.54923505",
"0.54681116",
"0.5413606",
"0.5399578",
"0.5339681",
"0.5316676",
"0.53084254",
"0.5288867",
"0.525981",
"0.52447516",
"0.5244498",
"0.5217221",
"0.521235",
"0.5206362",... | 0.6615458 | 0 |
r""" Perform a cyclic swap on the vertices. This is used in multiplication of symbolic upper matrices. Currently it is suboptimal but on the other hand, this cost much less than whatever convex hull computation. | def vertex_cyclic_swap(nvars, l, i):
if i == 0 or not l:
return l
ll = []
F = l[0].parent()
for v in l:
assert not v[-i:]
ll.append(F(tuple(v[-i:]) + tuple(v[:-i])))
for v in ll: v.set_immutable()
return tuple(ll) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vertex_swap(d, n, l, i1, i2, j1, j2):\n if i1 == i2 and j1 == j2:\n return l\n if i1 == j1:\n # (i1,i1) -> (i2,i2)\n assert i2 == j2\n def swap(v):\n swap2(d, n, v, i1, i2)\n elif i1 == i2:\n # (i,j1) -> (i,j2)\n def swap(v):\n swap2(d, n... | [
"0.6700525",
"0.6548219",
"0.62071115",
"0.619347",
"0.6155958",
"0.61089027",
"0.6073555",
"0.6059136",
"0.6011071",
"0.59793395",
"0.5920292",
"0.591253",
"0.59060276",
"0.5894991",
"0.58805555",
"0.5820859",
"0.5787564",
"0.5771385",
"0.57236433",
"0.57217413",
"0.5709025"... | 0.6623225 | 1 |
Creates a dashboard of plots for time steps, potential, kintetic, and total energy | def create_dashboard(h, t, k, p):
plt.style.use('seaborn')
# Initialize the dashboard
fig = plt.figure(figsize=(20, 8))
ax1 = fig.add_subplot(2, 2, 1)
ax2 = fig.add_subplot(2, 2, 2)
ax3 = fig.add_subplot(2, 2, 3)
ax4 = fig.add_subplot(2, 2, 4)
# Create individual graphs
dt_line, = a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_vanHove_dt(comp,conn,start,step_size,steps):\n \n (fin,) = conn.execute(\"select fout from comps where comp_key = ?\",comp).fetchone()\n (max_step,) = conn.execute(\"select max_step from vanHove_prams where comp_key = ?\",comp).fetchone()\n Fin = h5py.File(fin,'r')\n g = Fin[fd('vanHove... | [
"0.64270926",
"0.641641",
"0.63471955",
"0.633336",
"0.6203229",
"0.6157202",
"0.6156514",
"0.60662705",
"0.60575175",
"0.60480624",
"0.6023913",
"0.5948977",
"0.5948531",
"0.5910911",
"0.589686",
"0.5895649",
"0.58862346",
"0.58814776",
"0.5880334",
"0.58726776",
"0.58645946... | 0.77813894 | 0 |
Download and unpack the Zenodo minted data for the current stitches distribution. | def fetch_zenodo(self):
# full path to the stitches root directory where the example dir will be stored
if self.data_dir is None:
data_directory = pkg_resources.resource_filename('stitches', 'data')
else:
data_directory = self.data_dir
# build needed subdirector... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch_zenodo(self):\n\n # retrieve content from URL\n try:\n logging.info(f\"Downloading example data from {self.url}\")\n r = requests.get(self.url, stream=True)\n with io.BytesIO() as stream:\n with tqdm.wrapattr(\n stream,\n ... | [
"0.66224813",
"0.63485897",
"0.6268055",
"0.6250528",
"0.60906255",
"0.6000069",
"0.59467095",
"0.5897437",
"0.5875298",
"0.5873493",
"0.5796746",
"0.5769636",
"0.57534075",
"0.57515734",
"0.5747376",
"0.5746502",
"0.5727455",
"0.5726162",
"0.5718221",
"0.57016945",
"0.569462... | 0.7480389 | 0 |
Get all morbidities by war name. | def get_morbidities_for_war_era():
war_era_name = request.args.get('warEra')
if not war_era_name:
raise BadRequestError("warEra parameter is missing")
return datasources_service.get_morbidities_for_war_era(war_era_name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_war_eras():\n return datasources_service.get_war_eras()",
"def get_movies(self):\n worlds = ['cinemaworld',\n 'filmworld']\n\n pool = Pool(2)\n movies_world = pool.map(self.get_movies_list, worlds)\n pool.close()\n pool.join()\n\n for m_world ... | [
"0.530085",
"0.5216914",
"0.52164996",
"0.52158",
"0.512819",
"0.5046316",
"0.49238253",
"0.48991495",
"0.48724052",
"0.4854176",
"0.48369068",
"0.47993955",
"0.4775364",
"0.47421068",
"0.47291753",
"0.46694636",
"0.4650255",
"0.46441507",
"0.46405992",
"0.46394694",
"0.46272... | 0.69981116 | 0 |
Get list of all war eras. | def get_war_eras():
return datasources_service.get_war_eras() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ewriters():\n return dict(_ewriters)",
"def get_morbidities_for_war_era():\n war_era_name = request.args.get('warEra')\n if not war_era_name:\n raise BadRequestError(\"warEra parameter is missing\")\n return datasources_service.get_morbidities_for_war_era(war_era_name)",
"def list_shelve... | [
"0.5828334",
"0.5808068",
"0.57432085",
"0.5644334",
"0.56183976",
"0.5573372",
"0.5563877",
"0.55565184",
"0.55515826",
"0.55351365",
"0.55152845",
"0.55032134",
"0.54578054",
"0.54362935",
"0.54297596",
"0.5429045",
"0.5412836",
"0.54041094",
"0.5400069",
"0.5393652",
"0.53... | 0.7025474 | 0 |
Cancel an withdraw request. | def post_cancel_withdraw(self, withdraw_id: 'int') -> int:
params = {
"withdraw-id": withdraw_id
}
from huobi.service.wallet.post_cancel_withdraw import PostCancelWithdrawService
return PostCancelWithdrawService(params).request(**self.__kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Cancel(self, request, global_params=None):\n config = self.GetMethodConfig('Cancel')\n return self._RunMethod(\n config, request, global_params=global_params)",
"def Cancel(self, request, global_params=None):\n config = self.GetMethodConfig('Cancel')\n return self._RunMethod(\n ... | [
"0.66425055",
"0.66425055",
"0.66425055",
"0.66425055",
"0.66425055",
"0.66425055",
"0.66425055",
"0.66425055",
"0.66425055",
"0.66425055",
"0.66425055",
"0.66425055",
"0.66425055",
"0.66425055",
"0.66425055",
"0.66425055",
"0.66425055",
"0.66425055",
"0.66425055",
"0.66425055"... | 0.6858336 | 0 |
Get the withdraw quota for currencies | def get_account_withdraw_quota(self, currency: 'str') -> list:
check_should_not_none(currency, "currency")
params = {
"currency": currency,
}
from huobi.service.wallet.get_account_withdraw_quota import GetAccountWithdrawQuotaService
return GetAccountWithdrawQuotaSer... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def options_to_withdraw(self, amount):\n counter = PaperMoneyCounter() # aux class\n options = [] # options to withdraw\n remaining_cash = 0 # aux var\n\n if (amount % 20 == 0 or amount % 50 == 0) and (amount <= 1000): # is it allowed to withdraw?\n # prioritizing 100-dollar ... | [
"0.63382167",
"0.62305385",
"0.6179834",
"0.60655946",
"0.5956213",
"0.5947808",
"0.59429044",
"0.58825815",
"0.58773303",
"0.5864017",
"0.58567953",
"0.58432806",
"0.5827308",
"0.5814937",
"0.57675916",
"0.57590467",
"0.5756222",
"0.57123595",
"0.5685044",
"0.5678759",
"0.56... | 0.6826426 | 0 |
Parent get sub user depoist history. | def get_sub_user_deposit_history(self, sub_uid: 'int', currency: 'str' = None,
start_time: 'int' = None, end_time: 'int' = None,
sort: 'str' = None, limit: 'int' = None, from_id: 'int' = None) -> DepositHistory:
check_should_not_none(sub_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def last_history(self, user):\n return History.objects(user=user).order_by('-created_at').first()",
"def user_history(self):\n self.query_1 = \"SELECT * FROM orders WHERE user_id=%s\"\n self.input_1 = (self.user_id,) \n self.event = \"user_history\"\n self.message = \"Order his... | [
"0.61068934",
"0.6100039",
"0.60115993",
"0.59361994",
"0.59344065",
"0.58696795",
"0.5844484",
"0.5742806",
"0.571162",
"0.5664033",
"0.56583655",
"0.56562835",
"0.5651735",
"0.56295484",
"0.5605254",
"0.5565101",
"0.55631995",
"0.55622804",
"0.55606115",
"0.54985034",
"0.54... | 0.61268777 | 0 |
Add an obstacle to the map | def add_obstacle(self, obstacle_to_add):
if self.obstacles.size != 0:
self.obstacles = np.hstack((self.obstacles, obstacle_to_add))
else:
self.obstacles = np.array([obstacle_to_add]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_obstacle(self, x, y):\n self.BOARD[y][x].traversable = False\n self.board_array[y][x] = 1",
"def add_obstacle(self, x, y):\n self.BOARD[y][x].traversable = False\n self.board_array[y][x] = 1",
"def add_obstacle(self, *points: Tuple[float, float]):\n self.obstacles.app... | [
"0.75989723",
"0.75989723",
"0.7295586",
"0.7156997",
"0.6637772",
"0.65937614",
"0.6447093",
"0.6407341",
"0.6341093",
"0.6300385",
"0.6247986",
"0.6215138",
"0.61860317",
"0.60853684",
"0.6058344",
"0.6036493",
"0.60249126",
"0.60026395",
"0.5975957",
"0.59466404",
"0.59013... | 0.78030485 | 0 |
Add a waypoint to the drone | def add_waypoint(self, waypoint):
self.drone.add_waypoint(waypoint) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def waypoint_add_rel(self):\n pass",
"def waypoint_add_global(self):\n pass",
"def create_waypoint(self, waypoint):\n connection = self.__create_connection()\n try:\n waypoint_list = list(waypoint)\n key = self.__compound_key(waypoint)\n waypoint_lis... | [
"0.75902",
"0.7147039",
"0.6792248",
"0.62503475",
"0.6224604",
"0.6080674",
"0.60524154",
"0.6044039",
"0.603555",
"0.60317796",
"0.5964286",
"0.5918597",
"0.58790517",
"0.5873767",
"0.58673775",
"0.5866497",
"0.585557",
"0.5817661",
"0.58173054",
"0.57790995",
"0.5753916",
... | 0.8948917 | 0 |
Set the drone's location in the map | def set_drone_position(self, new_point):
self.drone.set_drone_position(new_point) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def m_location_set(self, x: int, y: int):\n pass",
"def set_location(self, location_set):",
"def set_location(self, lat, long):\n self._data['loc'] = [lat, long]",
"def location(self, value: 'Point'):\n self.geometry.location = value",
"def set_location(self, location):\n self.locat... | [
"0.6776562",
"0.67337173",
"0.6717304",
"0.66437644",
"0.66012245",
"0.65962243",
"0.65886664",
"0.6457518",
"0.643699",
"0.63909936",
"0.62847275",
"0.6281692",
"0.6220761",
"0.6214897",
"0.60538673",
"0.60247016",
"0.6005318",
"0.5934853",
"0.5927787",
"0.5925752",
"0.59109... | 0.6822219 | 0 |
Reset the obstacles' positions within the map (should be called when map is refreshed to clean the array) | def reset_obstacles(self):
self.obstacles = np.array([]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset(self):\n self.obstacles = []\n self._tick = 0",
"def recreate_obstacles(self):\n self.board_matrix = np.full(Dimension.board_size(), 1)\n self.obstacles = self.create_obstacles()",
"def reset(self) -> None:\n self.map = []\n for col in range(self.width):\n ... | [
"0.80095875",
"0.7382117",
"0.72062683",
"0.7101044",
"0.7061013",
"0.70536333",
"0.7010583",
"0.6989404",
"0.69813454",
"0.69743735",
"0.6880206",
"0.68602246",
"0.6838129",
"0.6808036",
"0.67923963",
"0.6767282",
"0.67519385",
"0.67181975",
"0.67109746",
"0.6702349",
"0.669... | 0.84130687 | 0 |
Generate possible paths around the passed obstacle | def generate_possible_paths(self, obstacle):
if self.does_uav_intersect_obstacle_vertically(obstacle, self.drone.get_point(), self.drone.get_waypoint_holder().get_current_waypoint()):
if self.does_path_intersect_obstacle_2d(obstacle, self.drone.get_point(), self.drone.get_waypoint_holder().get_curre... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_path(self, start_point: Pos, end_point: Pos, obstacles: list) -> list:\n pass",
"def drawpath(self,obstacles):\n for i in obstacles:\n self.distance_map[i[0],i[1]]=44\n print(\"Distance map\")\n print(self.distance_map)\n for i in self.footprint:\n ... | [
"0.7479054",
"0.6964157",
"0.6800724",
"0.6652429",
"0.65608233",
"0.6515328",
"0.6502793",
"0.64869034",
"0.64225703",
"0.63867986",
"0.62653744",
"0.6237662",
"0.61990416",
"0.61127084",
"0.61037284",
"0.60940355",
"0.6085445",
"0.6071979",
"0.6071137",
"0.6048148",
"0.6047... | 0.82060087 | 0 |
Determine if the UAV intersects an obstacle on the verticle axis | def does_uav_intersect_obstacle_vertically(self, obstacle, drone_point, waypoint):
if isinstance(obstacle, StationaryObstacle):
if drone_point[2] < obstacle.height + Constants.STATIONARY_OBSTACLE_SAFETY_RADIUS:
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inside_obstacle(point, obstacle):\r\n for obs in obstacle:\r\n if point[0] > obs[0][0] and point[0] < obs[0][2] and point[1] > obs[1][0] and point[1] < obs[1][2]:\r\n return 1\r\n return 0",
"def inside_obstacle(point, obstacle):\r\n for obs in obstacle:\r\n if point[0] > ob... | [
"0.66017944",
"0.66017944",
"0.65201724",
"0.6504722",
"0.6439276",
"0.6425067",
"0.638491",
"0.6364111",
"0.63495326",
"0.6324251",
"0.6221943",
"0.6213708",
"0.6208691",
"0.61606497",
"0.6156494",
"0.6152293",
"0.6147638",
"0.6138719",
"0.6131911",
"0.6120432",
"0.6107103",... | 0.71816885 | 0 |
Determine if the vector between a UAV's position and the current waypoint intersect an obstacle. | def does_path_intersect_obstacle_2d(self, obstacle, uav_point, waypoint):
drone_point = uav_point[:-1]
waypoint = waypoint[:-1]
obstacle_point = obstacle.get_point()[:-1]
waypoint_vector = np.subtract(waypoint, drone_point)
obstacle_vector = np.subtract(obstacle_point, drone_poi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def does_uav_intersect_obstacle_vertically(self, obstacle, drone_point, waypoint):\n if isinstance(obstacle, StationaryObstacle):\n if drone_point[2] < obstacle.height + Constants.STATIONARY_OBSTACLE_SAFETY_RADIUS:\n return True\n\n return False",
"def inside_obstacle(poin... | [
"0.7454063",
"0.7005391",
"0.7005391",
"0.69903654",
"0.6773237",
"0.66110426",
"0.6502717",
"0.6439229",
"0.64051235",
"0.6336705",
"0.6297145",
"0.6216562",
"0.621584",
"0.6154906",
"0.61373097",
"0.6084647",
"0.6082654",
"0.6072066",
"0.60683346",
"0.60457075",
"0.6034389"... | 0.7407062 | 1 |
Looks at the signs of the components of the vectors to determine if the direction of the obstacle is in the same direction as the waypoint (quadrants) | def is_obstacle_in_path_of_drone(self, obstacle_vector, waypoint_vector):
obstacle_list = obstacle_vector.tolist()
waypoint_list = waypoint_vector.tolist()
for index in range(len(obstacle_list)):
if all(item > 0 for item in [-1.0 * obstacle_list[index], waypoint_vector[index]]) or a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __check_direction(self, vector, coordinate):\n inverse_vector = -vector[0], -vector[1]\n # Calculate hits to direction\n hits = self.__direction(vector,1,coordinate)\n if hits == 5:\n return True\n # After reaching the end, add hits towards the opposite direction\n... | [
"0.7193433",
"0.65259945",
"0.6495801",
"0.6493202",
"0.6424737",
"0.6406378",
"0.640443",
"0.64031774",
"0.6398309",
"0.6398309",
"0.6398309",
"0.62759835",
"0.6256729",
"0.62326354",
"0.6192946",
"0.6183871",
"0.6148293",
"0.61077344",
"0.6098693",
"0.6095345",
"0.60564905"... | 0.72141993 | 0 |
Return the shortest path from the paths provided. This function assumes that the paths are possible waypoints calculated from the is_obstacle_in_path() function | def get_min_path(self, paths):
shortest_path = paths[0]
shortest_distance = self.get_path_distance(paths[0])
for path in paths[1:]:
distance = self.get_path_distance(path)
if distance < shortest_distance:
shortest_path = path
shortest_dis... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shortest_path(env, service, paths):\n for idp, path in enumerate(paths):\n if is_path_free(env.topology, path, service.number_units):\n return True, idp\n return False, env.k_paths # returns false and an index out of bounds if no path is available",
"def constructShortestPath(self):\r... | [
"0.7273277",
"0.70496786",
"0.69742703",
"0.6943726",
"0.68671346",
"0.6855859",
"0.68451226",
"0.68320864",
"0.6805442",
"0.67743856",
"0.6726081",
"0.6716487",
"0.6714552",
"0.670571",
"0.669246",
"0.66918075",
"0.665236",
"0.66394556",
"0.6638905",
"0.6598199",
"0.6593292"... | 0.81187457 | 0 |
Return the obstacles in the map | def get_obstacles(self):
return self.obstacles | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getObstacles(self):\r\n ausgabeObstacle = self.globalObstaclesList + self.globalHardObstaclesList\r\n self.globalObstaclesList = []\r\n return(ausgabeObstacle)",
"def obstacles(self):\r\n\r\n #Radious arround the head\r\n limit_sight = self.snake_sight\r\n head = sel... | [
"0.7732808",
"0.76378906",
"0.7601713",
"0.7597489",
"0.74278224",
"0.7182941",
"0.70999545",
"0.7085734",
"0.70508057",
"0.69266826",
"0.68817693",
"0.68608207",
"0.66608745",
"0.66440624",
"0.6596019",
"0.6556084",
"0.6540522",
"0.6464882",
"0.6458014",
"0.6457657",
"0.6408... | 0.83878875 | 0 |
Return True if the UAV has reached the current waypoint and false if not | def has_uav_reached_current_waypoint(self):
return self.drone.has_reached_waypoint() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_reached_waypoint_goal(self):\n return self.control_instance.check_reached_waypoint_goal()",
"def update(self):\n\n # If the agent has already reached the\n # last waypoint it doesn't need to update\n if self.finished:\n return True\n\n # Skip if the proxy d... | [
"0.7815707",
"0.7180824",
"0.70038074",
"0.69606185",
"0.694313",
"0.6907562",
"0.6907562",
"0.6904402",
"0.68095386",
"0.6806599",
"0.6785689",
"0.67554694",
"0.6742048",
"0.67407054",
"0.66793656",
"0.66658723",
"0.65675145",
"0.6564974",
"0.6496703",
"0.648724",
"0.6471804... | 0.864633 | 0 |
Hook to be invoked before the test method has been executed. May perform expensive setup here. | def before_test(self, func, *args, **kwargs):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def before_run_tests(cls):\n pass",
"def do_before(self):\r\n pass",
"def beforeTest(self, test):\n self.setupLoghandler()",
"def before(self) -> None:\n pass",
"def startTestHook(self):",
"def setUp(self):\n # use self.attribute to keep anything which needs to be acces... | [
"0.80520755",
"0.7866928",
"0.76243114",
"0.76155716",
"0.749539",
"0.74885553",
"0.7474587",
"0.74741113",
"0.73961705",
"0.7393307",
"0.7393307",
"0.73867905",
"0.7364386",
"0.7364033",
"0.73517734",
"0.7307922",
"0.7301422",
"0.7300426",
"0.7297788",
"0.7283322",
"0.726435... | 0.8013997 | 1 |
Generates fixture objects from the given response and stores them in the applicationspecific cache. | def execute(self, response):
if not has_request_context:
return
self._fallback_fixture_names()
try:
app = self.auto_fixture.app
# Create response fixture
fixture = Fixture.from_response(response, app, self.response_name)
self.auto_fi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def api_response():\n return load_fixture(\"smhi.json\", DOMAIN)",
"def fixture_retrieved():\n from aiida.plugins import DataFactory\n from aiida_logger.tests import TEST_DIR\n\n retrieved = DataFactory('folder')()\n retrieved.put_object_from_tree(path=os.path.join(TEST_DIR, 'input_files'))\n\n ... | [
"0.6123618",
"0.5608524",
"0.56062853",
"0.5596069",
"0.55481315",
"0.5504589",
"0.5498172",
"0.5480052",
"0.5423372",
"0.5308721",
"0.52908236",
"0.5271301",
"0.52630156",
"0.525457",
"0.5245118",
"0.52290255",
"0.52251756",
"0.5215446",
"0.5191281",
"0.51741076",
"0.5172798... | 0.6490722 | 0 |
Falls back to the default fixture names if no names could be determined up to this point. | def _fallback_fixture_names(self):
if not self.request_name or not self.response_name:
warnings.warn(
"No name was specified for the recorded fixture. Falling "
"back to default names.")
if not self.request_name:
self.request_name = __default_name... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def populate_fixtures():\n languages()\n words()",
"def fixtures():",
"def _find_fixtures(self, start_dir):\r\n fixtures = []\r\n def _find(arg, dirname, names):\r\n if (dirname.endswith('fixtures')) and (dirname.find('unit_test')==-1):\r\n for name in names:\r\n ... | [
"0.62607694",
"0.6084847",
"0.59035265",
"0.58864886",
"0.5782445",
"0.56454164",
"0.5598075",
"0.5590924",
"0.55757374",
"0.55625635",
"0.5513001",
"0.5497023",
"0.54902035",
"0.5441633",
"0.5436192",
"0.5364549",
"0.536005",
"0.535958",
"0.53501177",
"0.5234277",
"0.521221"... | 0.7567539 | 0 |
Generate ics from days. | def generate_ics(days: Sequence[dict], filename: Text) -> None:
cal = Calendar()
cal.add("X-WR-CALNAME", "中国法定节假日")
cal.add("X-WR-CALDESC", "中国法定节假日数据,自动每日抓取国务院公告。")
cal.add("VERSION", "2.0")
cal.add("METHOD", "PUBLISH")
cal.add("CLASS", "PUBLIC")
cal.add_component(_create_timezone())
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_ics(events, config):\n\n # Create the Calendar\n calendar = icalendar.Calendar()\n calendar.add('prodid', config.calendar_prodid)\n calendar.add('version', '2.0')\n calendar.add('method', 'publish')\n\n for event_data in events:\n # Create the event\n event = icalendar.... | [
"0.6347691",
"0.6087289",
"0.6072295",
"0.59718066",
"0.57362044",
"0.5708821",
"0.56834716",
"0.5679318",
"0.5669046",
"0.56072843",
"0.5576914",
"0.557137",
"0.557137",
"0.553295",
"0.54978454",
"0.5415384",
"0.5413129",
"0.53640497",
"0.5288981",
"0.52658474",
"0.52517194"... | 0.78284 | 0 |
Get user profile Fetches from the user collection by using the user's email as key. | def get_user_profile(email): # GET
# NOTE: This method previously called LCS with director credentials in order to retrieve the user's name
# We will update TeamRU to store names along with our user objects, saving the need to call LCS again
user_profile = coll("users").find_one({"_id": email})
if not ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _getProfileFromUser(self):\n # Make sure user is authenticated\n user = endpoints.get_current_user()\n if not user:\n raise endpoints.UnauthorizedException('Authorization required')\n # Get Profile from datastore\n user_id = user.email()\n p_key = ndb.Key(Pr... | [
"0.74857944",
"0.7336757",
"0.7331344",
"0.7298807",
"0.72768545",
"0.72726756",
"0.71711785",
"0.7168781",
"0.7130947",
"0.71272796",
"0.70798576",
"0.70757645",
"0.7041153",
"0.6998165",
"0.6979574",
"0.6948253",
"0.69294655",
"0.69286436",
"0.69207954",
"0.6915467",
"0.688... | 0.8088444 | 0 |
Create user profile Creates a new user profile from the user email, skills, prizes, and other fields. | def create_user_profile(email, **kwargs): # POST
user_exists = coll("users").find_one({"_id": email})
if user_exists:
return {"message": "User already exists"}, 400
# NOTE Doesn't make sense for a person to have prizes only a team should have this
coll("users").insert_one(
{
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create(self, data):\n # Make User\n username = data['email'].split(\"@\")[0]\n user = User.objects.create_user(**data, username=username, is_verified=False, is_client=True)\n Profile.objects.create(user=user)\n send_confirmation_email.delay(user_pk=user.pk)\n return us... | [
"0.75975007",
"0.74751395",
"0.7427103",
"0.73537993",
"0.7324293",
"0.7319972",
"0.7295748",
"0.7285775",
"0.7275217",
"0.7270615",
"0.7237489",
"0.72268796",
"0.72268796",
"0.72268796",
"0.7216276",
"0.7180537",
"0.716592",
"0.7164825",
"0.71644413",
"0.7159965",
"0.7144012... | 0.8317838 | 0 |
Resolver should be able to produce a value for a given key. If key doesn't exist, should return None. | def resolve(self, key: str) -> Optional[Any]:
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resolve(self, key: str) -> Optional[Any]:\n return self.dict.get(key)",
"def get(self, key: K)-> Optional[V]:\n return self._func(key)",
"def lookup(self, key):\n n = self.find(key)\n if n:\n return n.value\n else:\n return False",
"def _get(self, ... | [
"0.7909129",
"0.6813241",
"0.67681676",
"0.66341573",
"0.64758044",
"0.6463813",
"0.64607257",
"0.6392654",
"0.6385483",
"0.63703537",
"0.63212407",
"0.6292602",
"0.6284046",
"0.62764496",
"0.619645",
"0.6181006",
"0.617452",
"0.614984",
"0.6148691",
"0.6125853",
"0.61204463"... | 0.75538653 | 1 |
Resolver should be able to produce a value for a given key. If key doesn't exist, should return None. | def resolve(self, key: str) -> Optional[Any]:
return self.dict.get(key) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resolve(self, key: str) -> Optional[Any]:\n pass",
"def get(self, key: K)-> Optional[V]:\n return self._func(key)",
"def lookup(self, key):\n n = self.find(key)\n if n:\n return n.value\n else:\n return False",
"def _get(self, key):\n try:\n... | [
"0.75538653",
"0.6813241",
"0.67681676",
"0.66341573",
"0.64758044",
"0.6463813",
"0.64607257",
"0.6392654",
"0.6385483",
"0.63703537",
"0.63212407",
"0.6292602",
"0.6284046",
"0.62764496",
"0.619645",
"0.6181006",
"0.617452",
"0.614984",
"0.6148691",
"0.6125853",
"0.61204463... | 0.7909129 | 0 |
Determines the number of files each node will process in scatter gather environment | def number_of_files_per_node(files, number_of_nodes):
files_per_node = float(len(files))/float(number_of_nodes)
if files_per_node > 0.:
return int(math.floor(files_per_node))
else:
return int(math.ceil(files_per_node)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fileCount(self):\n pass",
"def countDataSize(self,filename):\n \n d = h5py.File(filename,'r')\n features = d['spectrometer/features'][:]\n select = self.selectData(features.astype(float), self.ifeature, d)\n N = len(features[select])\n d.close()\n\n N =... | [
"0.6732709",
"0.6647272",
"0.6646703",
"0.65596217",
"0.655924",
"0.6545861",
"0.65446675",
"0.6479833",
"0.64772725",
"0.6464439",
"0.6455599",
"0.6446589",
"0.6436676",
"0.641191",
"0.6406125",
"0.6391951",
"0.636867",
"0.6327254",
"0.63119394",
"0.63079107",
"0.62990075",
... | 0.7106992 | 0 |
Send a request to Slack and validate the response | def slack_request(url: str, headers: dict, data: dict) -> dict:
logger.debug(f'\nSending request to Slack API using {url}')
response = requests.post(url=url,
headers=headers,
data=data)
if response.status_code != 200:
logger.error(f'Got stat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_slackWH_send_good(get_slackwebhook, capsys):\n s = get_slackwebhook\n s.send()\n out, err = capsys.readouterr()\n assert \"Message sent\" in out",
"def __call(self, headers, method, data):\n url = 'https://slack.com/api/'+method\n req = requests.post(\n url=url,\n ... | [
"0.67223775",
"0.66398156",
"0.6534951",
"0.6358252",
"0.6333655",
"0.62352383",
"0.6171377",
"0.6148408",
"0.6085096",
"0.6081135",
"0.60650325",
"0.6040874",
"0.6038498",
"0.60302174",
"0.59917426",
"0.59649956",
"0.59637076",
"0.5943963",
"0.59014314",
"0.58998",
"0.588938... | 0.72009796 | 0 |
Create a report about stale branches for a list of repositories. | def check_stale_branches(event: dict, context) -> dict:
ssm_parameters = load_params('dev_tools', 'dev')
if 'jira_statuses_for_task_completion' in ssm_parameters and ssm_parameters['jira_statuses_for_task_completion']:
jira_statuses_for_task_completion = ssm_parameters['jira_statuses_for_task_completi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stale_pr_branches(config, args):\n repo = config.repo\n for pr in repo.pull_requests(state=\"closed\"):\n if pr.head.repo == pr.base.repo and repo.branch(pr.head.ref):\n yield {\n \"html_url\": pr.html_url,\n \"base_branch\": pr.base.ref,\n \"head_branch\": pr.head.ref,\n }"... | [
"0.71542406",
"0.57429",
"0.5712632",
"0.5642177",
"0.55806303",
"0.5520008",
"0.54752177",
"0.54629207",
"0.5433732",
"0.5424115",
"0.53311217",
"0.5299445",
"0.5283825",
"0.52417576",
"0.5239561",
"0.5191586",
"0.5190831",
"0.51559097",
"0.5126341",
"0.512589",
"0.50958616"... | 0.72896576 | 0 |
Reset this node's (and its children's) state to ready | def reset(self):
self.state = EvaluationState.ready
for child in self.children:
if hasattr(child, "reset"):
child.reset() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset(self):\n for c in self.children:\n c.reset()\n self.marked = False",
"def reset_tree(self):\n self.root = None\n self.action = None\n self.dist_probability = None",
"def reset(self):\n self.children.clear()",
"def reset(self):\r\n self... | [
"0.7023482",
"0.6967508",
"0.6964375",
"0.670918",
"0.67040575",
"0.6657348",
"0.65749437",
"0.65516037",
"0.65334755",
"0.64151716",
"0.6284906",
"0.62482226",
"0.62395614",
"0.61377215",
"0.61206025",
"0.6064591",
"0.604821",
"0.6045733",
"0.60326046",
"0.6019434",
"0.59808... | 0.75797325 | 0 |
Evaluates the node's (and its children's) state. Returns success if any node succeeds, else failure. | def evaluate(self, blackboard):
success = EvaluationState.success
for child in self.children:
state = child.__call__(blackboard)
if state == success:
return success
return EvaluationState.failure | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def evaluate(self, blackboard):\n success = EvaluationState.success\n\n state = success\n for child in self.children:\n state = child.__call__(blackboard)\n\n if state != success:\n break\n\n return state",
"def evaluate(self, tree):\n\t\tpass",
... | [
"0.71742636",
"0.6537723",
"0.6279385",
"0.6106426",
"0.6106426",
"0.60549605",
"0.60402316",
"0.60212874",
"0.5946995",
"0.58815885",
"0.58076704",
"0.5800487",
"0.57829833",
"0.5762511",
"0.56892544",
"0.56854844",
"0.56838524",
"0.5680494",
"0.56597567",
"0.56062233",
"0.5... | 0.6946291 | 1 |
imports 'catalog', and creates a pandas.DataFrame containing the columns specified in 'params'. 'catalog' is expected to be in the .csv format. | def import_data(catalog='xmatch_TGAS_Simbad.csv', params=None, nrows=None, delimiter=','):
print "Loading %s and creating DataFrame.." % catalog
df_imported = pd.read_csv(catalog, delimiter=delimiter, header=0, usecols=params, nrows=nrows)
print "..Done\n----------"
return df_imported | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_catalog(self):\n self.catalog = pd.read_csv(self.catalog_path, \n index_col=0, parse_dates=True)\n self.unique_years = self.catalog.index.year.unique()\n return",
"def loadData(catalog):\n return controller.loadData(catalog)",
"def loadData(catalog):\n return cont... | [
"0.6171639",
"0.5896814",
"0.5896814",
"0.58639306",
"0.58639306",
"0.58639306",
"0.58639306",
"0.58639306",
"0.5844626",
"0.57802",
"0.5761707",
"0.5757528",
"0.5681903",
"0.56408125",
"0.5618386",
"0.5584293",
"0.5555248",
"0.5497467",
"0.5468997",
"0.54676163",
"0.54645765... | 0.75542295 | 0 |
Open a table fits file and convert it to a pandas dataframe. | def import_fits(fitsfile='tgasptyc.fits'):
if isfile(fitsfile):
print "Opening %s.." % fitsfile
table = Table.read(fitsfile)
pandas_df = table.to_pandas()
else:
print "%s not found. Exiting." % fitsfile
sys.exit()
print "Converting table to pandas_df.."
print "..D... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def df_from_fits(filename, i=1):\n return pd.DataFrame.from_records(fitsio.FITS(filename)[i].read().byteswap().newbyteorder())",
"def load_fits_table(fname):\n\treturn fits.open(fname)[1].data",
"def load_fits(path: str, ncols: int, nonames: bool) -> DataFrame:\n assert not nonames\n\n from astropy.ta... | [
"0.72136354",
"0.70939803",
"0.6888955",
"0.6693443",
"0.65260655",
"0.64546525",
"0.64119506",
"0.6292741",
"0.60741687",
"0.6048607",
"0.59836",
"0.59633166",
"0.5962561",
"0.5943778",
"0.59254146",
"0.5899131",
"0.5885488",
"0.586403",
"0.57661194",
"0.5747174",
"0.5743360... | 0.7552445 | 0 |
creates a new column 'tycho2_id' in the tycho2 catalog. This is for comparison with the TGAS catalog. | def create_tycho_id(tycho2df):
tycho2df['tycho2_id'] = tycho2df.TYC1.astype(str).str.cat(tycho2df.TYC2.astype(str), sep='-')\
.str.cat(tycho2df.TYC3.astype(str), sep='-')
tycho2df = tycho2df.rename(columns={'HIP': 'hip'})
return tycho2df | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_idx2id(self, id2idx = None):\n if id2idx is None:\n return {v:k for k, v in self.id2idx.items()}\n return {v:k for k, v in id2idx.items()}",
"def getMcc2Id(self):\n return self._base.getMcc2Id()",
"def get_col2id( self, ratios_standardized, db ):\n\t\tcol_info_collection... | [
"0.50282025",
"0.50220966",
"0.5005243",
"0.49620757",
"0.49583018",
"0.4915321",
"0.4880197",
"0.4807147",
"0.4807147",
"0.4807147",
"0.4807147",
"0.47635424",
"0.47528297",
"0.46979147",
"0.4659034",
"0.4647828",
"0.45996457",
"0.45982006",
"0.4572538",
"0.456453",
"0.45589... | 0.7335801 | 0 |
select data with relative parallax error less than 'cutoff', add absolute magnitude columns for plotting. If catalog is not None, the cutoff on BV will not be applied (ensures initial variable stars DataFrame is not constrained in magnitudes) | def data_process(df_toprocess=None, cutoff=0.2, bv_cutoff=0.15, catalog=None):
print "Selecting objects.."
df_toprocess['sigma_pi/pi'] = df_toprocess.loc[:, 'parallax_error'].astype(float) / df_toprocess.loc[:, 'parallax']\
.astype(float)
print "..Done\nCutoff at relative parallax error of %s\n----... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def localize_red_clump(star_catalog,close_cat_idx,log):\n\n def select_within_range(mags, colours, mag_min, mag_max, col_min, col_max):\n \"\"\"Function to identify the set of array indices with values\n between the range indicated\"\"\"\n\n idx1 = np.where(colours >= col_min)[0]\n i... | [
"0.5334454",
"0.5270723",
"0.526012",
"0.5255001",
"0.51794606",
"0.51098704",
"0.50803125",
"0.5008346",
"0.49690634",
"0.49599707",
"0.49506727",
"0.49429023",
"0.49181986",
"0.49170044",
"0.4914409",
"0.48817256",
"0.4856762",
"0.48513559",
"0.48380238",
"0.48282054",
"0.4... | 0.5875681 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.